Repository navigation
feat: accessors for session pin, chat history and history usage - #2
Merged
Merged
Conversation
- sessionPin()/setSessionPin() and newSession() to read, change or regenerate the session pin after construction - history()/setHistory() to persist and restore conversations - writeHistory()/setWriteHistory() to toggle history recording - historyUsage() totalling token usage across the stored conversation - README and CHANGELOG entries, pre-tagged as v1.1.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds public accessors for client state that was previously constructor-only, ahead of tagging v1.1.0:
sessionPin()/setSessionPin()- read, change or clear (null) the session pin after constructionnewSession()- generate and switch to a fresh random pin, using the same generation asautoSessionhistory()/setHistory()- read and restore the chat history, so conversations can be persisted between processes; the setter validates each turn hasroleandcontentkeyswriteHistory()/setWriteHistory()- toggle history recording after constructionhistoryUsage()- total token usage across the calls that built the stored history; input tokens count what the server processed, since each call resends the conversation.clearHistory()andsetHistory()reset the tallyDeliberately not exposed:
apiKey,transportandfqdn/secure- connection identity belongs to a new client.Testing
Ten new tests; the full suite passes (105 tests, 266 assertions) with phpstan level 8 and php-cs-fixer clean on PHP 8.5. CI runs the matrix from 7.4 to 8.5.