Add accounts and profiles with active gateway switching #32

Open
opened 2026-08-22 09:47:29 +00:00 by kayg · 1 comment
Owner

Scope

Add accounts and profiles so the user can keep multiple gateway identities and switch the active gateway/account explicitly. This issue covers the deferred account/profile work and the active-account switch; it does not change the read-only Gateway settings work shipping now.

Current state

The current client is single-active-gateway even though credentials can coexist:

  • serverURL lives in UserDefaults and is written only by sign-in.
  • Credentials are already stored as one file per gateway.
  • The transcript cache slugifies only the session id.
  • hermternal_search_sessions has PRIMARY KEY(session_id) with no gateway column.

These current keys and the live-client lifecycle are not sufficient for two gateways that reuse a durable session id.

Acceptance criteria

  • An account carries its gateway URL, provider, and chosen authentication method, and those fields persist independently for multiple accounts.
  • Switching accounts tears down the live socket and cancels in-flight work through the existing generation mechanism; the implementation does not introduce a second cancellation or generation mechanism.
  • The transcript cache and search index are scoped per account, so a session id from one backend can never resolve against another backend.
  • Search results and deep links identify the account/backend unambiguously across accounts.
  • A deep link naming a different account offers to switch to that account rather than silently opening the wrong chat or failing.
  • Signing out of one account leaves all other accounts, credentials, and their data intact.

Not blocked / boundaries

The read-only Settings → Gateway section and the authentication-method picker are being built now and are not blocked by this issue. They show the current gateway and current method for now; gateway switching waits for accounts and profiles. The picker must offer only authentication methods the client can perform.

  • #1 covers adding username/password authentication; it is a second method implementation, not account/profile switching.
  • #4 covers the base chat/message deep-link routes; this issue adds account disambiguation and switching behavior.
  • #8 covers local BM25 chat search; this issue adds account scoping to search data and results.
  • #11 covers macOS Spotlight indexing; account identity must remain unambiguous when those links are resolved.
  • #31 covers future iOS portability seams; account/profile work should preserve those capability boundaries.

This issue intentionally does not duplicate those neighbors.

## Scope Add accounts and profiles so the user can keep multiple gateway identities and switch the active gateway/account explicitly. This issue covers the deferred account/profile work and the active-account switch; it does not change the read-only Gateway settings work shipping now. ## Current state The current client is single-active-gateway even though credentials can coexist: - `serverURL` lives in UserDefaults and is written only by sign-in. - Credentials are already stored as one file per gateway. - The transcript cache slugifies only the session id. - `hermternal_search_sessions` has `PRIMARY KEY(session_id)` with no gateway column. These current keys and the live-client lifecycle are not sufficient for two gateways that reuse a durable session id. ## Acceptance criteria - [ ] An account carries its gateway URL, provider, and chosen authentication method, and those fields persist independently for multiple accounts. - [ ] Switching accounts tears down the live socket and cancels in-flight work through the existing generation mechanism; the implementation does not introduce a second cancellation or generation mechanism. - [ ] The transcript cache and search index are scoped per account, so a session id from one backend can never resolve against another backend. - [ ] Search results and deep links identify the account/backend unambiguously across accounts. - [ ] A deep link naming a different account offers to switch to that account rather than silently opening the wrong chat or failing. - [ ] Signing out of one account leaves all other accounts, credentials, and their data intact. ## Not blocked / boundaries The read-only Settings → Gateway section and the authentication-method picker are being built now and are not blocked by this issue. They show the current gateway and current method for now; gateway switching waits for accounts and profiles. The picker must offer only authentication methods the client can perform. ## Related issues - #1 covers adding username/password authentication; it is a second method implementation, not account/profile switching. - #4 covers the base chat/message deep-link routes; this issue adds account disambiguation and switching behavior. - #8 covers local BM25 chat search; this issue adds account scoping to search data and results. - #11 covers macOS Spotlight indexing; account identity must remain unambiguous when those links are resolved. - #31 covers future iOS portability seams; account/profile work should preserve those capability boundaries. This issue intentionally does not duplicate those neighbors.
Author
Owner

The visible sidebar account row is a separate, present-tense increment from this issue's deferred account/profile switching work. I opened #33 for it: #33.

#33 covers the left-aligned system-component pill at the bottom of the sidebar, the matching single masked-material bottom soft edge, composition-injected identity display string, and the open question of which identity the gateway genuinely exposes (with a documented fallback chain). Keeping it separate avoids expanding this issue's switching/cache/deep-link/sign-out scope while still cross-referencing this account/profile model.

The visible sidebar account row is a separate, present-tense increment from this issue's deferred account/profile switching work. I opened #33 for it: https://git.kayg.org/kayg/hermternal-apple/issues/33. #33 covers the left-aligned system-component pill at the bottom of the sidebar, the matching single masked-material bottom soft edge, composition-injected identity display string, and the open question of which identity the gateway genuinely exposes (with a documented fallback chain). Keeping it separate avoids expanding this issue's switching/cache/deep-link/sign-out scope while still cross-referencing this account/profile model.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/hermternal-apple#32
No description provided.