feat(types): multi-chat sessions (ahp-chat: channel)#197
Conversation
Addresses connor4312's five inline review comments on PR #197: 1. Denormalize ChatSummary into ChatState - flatten the summary nesting so ChatState exposes resource/title/status/activity/modifiedAt/origin directly. ChatSummary stays as the lightweight session-catalog view. 2. Add upsert/partial semantics for chat catalog mutations: replace SessionChatsChangedAction (full-replacement) with three targeted actions: SessionChatAddedAction (upsert by summary.resource), SessionChatRemovedAction (clears defaultChat if removed), SessionChatUpdatedAction (Partial<ChatSummary> merge). 3. Change modifiedAt from epoch millis (number) to ISO-8601 string on both ChatSummary and ChatState. Reducers emit new Date(Date.now()).toISOString() so existing Date.now mocks remain deterministic. 4. Document SessionSummary aggregate derivation rules - status promotion (InputNeeded > InProgress > Idle), activity, modifiedAt as max of chat modifiedAts, workingDirectory as the default-chat fallback. 5. Add optional workingDirectory to ChatState/ChatSummary so harnesses can support agent-swarm worktree patterns where cooperating chats pin to different working directories. Codegen + clients: - Fix Rust/Kotlin/Swift generators to emit Partial<T> structs that are referenced only from actions (previously only notification-side partials were emitted). - Regenerate all clients (Rust, Kotlin, Swift, TypeScript, Go). - Port hand-written reducers in Rust, Go, Kotlin, Swift to match the new action shape and ISO timestamps. - Migrate all 87 chat reducer fixtures to the flat ChatState shape with ISO modifiedAt; replace 3 old chatsChanged fixtures with 6 fixtures covering chatAdded upsert, chatRemoved + defaultChat clearing, and chatUpdated partial merge (plus no-op cases). Docs: update chat-channel.md and session-channel.md with the denormalized shape, per-chat workingDirectory, catalog mutation actions, and the full session aggregation rules. Changelogs: updated root + all 5 client CHANGELOGs under Unreleased. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
left a comment
There was a problem hiding this comment.
I think this overall is looking good. Feel free to promote to 'ready for review' when you're happy with it. We should avoid merging until we have a PR ready on the VS Code side of things too, just so we don't block other people getting stuff into AHP main while adoption happens.
|
@connor4312 thanks for the review — all five points are addressed in 41ab532 and the threads are resolved. Summary of changes:
Codegen/clients: fixed the Rust/Kotlin/Swift generators to emit |
|
in case you missed before your last comment
Looks like some conflicts came up but should be easily agent-resolvable |
Squashed implementation of multiple chats per session plus Connor's review feedback. Will be re-expanded/force-pushed after rebasing onto latest main.
41ab532 to
2abd787
Compare
The rebased tool-call metadata change reintroduced an explicit `List<Annotation>` type on the annotationsRemoved reducer branch, which resolved to `kotlin.Annotation` instead of the generated type and broke `compileKotlin`. Drop the explicit annotation so the element type is inferred from `state.annotations`, matching the sibling branches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Promoted to ready for review.
Per your note, holding merge until the VS Code-side adoption PR is ready. |
Revert "feat(types): multi-chat sessions (ahp-chat: channel)" (#197)
Implements the multi-chat sessions proposal (design discussion, approved).
Splits the AHP session model: a session becomes a shared coordination scope (workspace, project, model/agent defaults, tools, config), and a session can hold multiple chats, each its own independently subscribable conversation over the shared scope.
What ships in this PR (Phase 1: protocol types)
ahp-chat:channel.types/channels-chat/{state,commands,actions,reducer}.ts.ChatStatecarries the turn / input / pending-message state today living onSessionState.ChatSummarywith optional per-chatmodel/agentoverrides and anorigin?: ChatOriginprovenance field.ChatOrigindiscriminated union:User/Fork/Tool(per-call discussion with @connor4312 —Toolcarries{ chat, toolCallId }so tool-spawned chats reference their spawning tool call).SessionStatechanges:turns,activeTurn,steeringMessage,queuedMessages,inputRequests.chats: ChatSummary[],defaultChat?: URI(UI input-routing hint — not a hierarchy marker).createChat(with optionalChatForkSource { chat, turnId }),disposeChat.fetchTurns/completionsnow take anahp-chat:channel URI.chats[]/defaultChathandling.PROTOCOL_VERSION0.3.0→0.4.0(allowed pre-1.0 perversioning.md).Subsequent phases (will land in follow-up commits on this branch)
Verification
npm run testpasses: 241/241, 100% branch coverage ontypes/reducers.ts.Notes for reviewers
docs/proposals/multi-chat-sessions.mdon PR docs: add multi-chat sessions proposal #184; design discussion is captured there.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com