feat(types): multi-chat sessions (ahp-chat: channel)#197
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Go generator was missing the ChatToolCallApproved/Denied/Confirmed discriminated union variants and the ChatAction top-level union from its explicit-skip list, causing exhaustiveness warnings during codegen. Kotlin regeneration picked up trivial drift in State.generated.kt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds the user-facing documentation for the new `ahp-chat:` channel introduced by the multi-chat session split: chat-channel.md specification page and updates the per-client CHANGELOG entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…mming
- New generateChatChannelPage in scripts/generate-markdown.ts emits the
ahp-chat:/ reference page from types/channels-chat/{state,actions,commands}.ts.
- Session spec doc slimmed: turn lifecycle moves to chat-channel.md;
fetchTurns/completions removed from session command table; validation
table reduced to session-scoped actions only; new 'Chat aggregation'
section spelling out how SessionSummary.status/activity/modifiedAt
derive from chats.
- Sidebar: add 'Chat Channel' entries to both /specification/ and
/reference/ sidebars.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the Rust generator to split session-scoped and chat-scoped protocol surfaces: rename `SessionInput*` types to `ChatInput*`, add `ChatState`/`ChatSummary`/`ChatOrigin` state types and chat commands, partition the action map into `session/*` and `chat/*`, and add a merged chat tool-call-confirmed helper. Split the reducer into a slimmed session reducer (lifecycle, metadata, customizations, chats catalogue) and a new `apply_action_to_chat` chat reducer (turn lifecycle, tool calls, input requests, pending messages). Track chat state in `MultiHostStateMirror` and update fixtures/tests for the new state shapes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # CHANGELOG.md # clients/go/CHANGELOG.md # clients/go/ahptypes/version.generated.go # clients/go/examples/reducers_demo/main.go # clients/go/release-metadata.json # clients/kotlin/CHANGELOG.md # clients/kotlin/release-metadata.json # clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Version.generated.kt # clients/rust/CHANGELOG.md # clients/rust/crates/ahp-types/src/version.rs # clients/rust/release-metadata.json # clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Version.generated.swift # clients/swift/CHANGELOG.md # clients/swift/release-metadata.json # clients/typescript/CHANGELOG.md # clients/typescript/release-metadata.json # types/version/registry.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 |
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