Skip to content

feat: accessors for session pin, chat history and history usage - #2

Merged
ftsartek merged 1 commit into
mainfrom
chore/internal-getters
Jul 19, 2026
Merged

ftsartek merged 1 commit into
mainfrom
chore/internal-getters

Conversation

@ftsartek

Copy link
Copy Markdown
Collaborator

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 construction
  • newSession() - generate and switch to a fresh random pin, using the same generation as autoSession
  • history() / setHistory() - read and restore the chat history, so conversations can be persisted between processes; the setter validates each turn has role and content keys
  • writeHistory() / setWriteHistory() - toggle history recording after construction
  • historyUsage() - 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() and setHistory() reset the tally

Deliberately not exposed: apiKey, transport and fqdn/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.

- 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
@ftsartek
ftsartek merged commit b1a477a into main Jul 19, 2026
8 checks passed
@ftsartek
ftsartek deleted the chore/internal-getters branch July 19, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant