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>
| _meta?: Record<string, unknown>; | ||
| } | ||
|
|
||
| export interface ChatSummary { |
There was a problem hiding this comment.
Aligned with learnings from #187 I suggest we have a distinct ChatSummary and just denormalize the data on the ChatState as appropriate, instead of having ChatSummary embedded within the ChatState
| export interface SessionChatsChangedAction { | ||
| type: ActionType.SessionChatsChanged; | ||
| /** Updated chat catalog. */ | ||
| chats: ChatSummary[]; |
There was a problem hiding this comment.
We will also likely want upsert semantics and updates replacing Partial<ChatSummary>. Have your agent look at what we do for sessions/session summaries and mirror that here
| /** Human-readable description of what the chat is currently doing */ | ||
| activity?: string; | ||
| /** Last modification timestamp */ | ||
| modifiedAt: number; |
There was a problem hiding this comment.
Let's have this be an ISO timestamp string instead (also a callout from #187)
| defaultChat?: URI; | ||
| /** Session configuration schema and current values */ | ||
| config?: SessionConfigState; | ||
| /** |
There was a problem hiding this comment.
Down below on SessionSummary we should note how that data is expected to be derived from chat data. E.g. activity may be the activity of the primary chat, status should include input needed if any session needs input. Does not need to be too Opus-style lengthy, but just a guide for implementors
| /** Optional per-chat agent override (defaults to the session's agent) */ | ||
| agent?: AgentSelection; | ||
| /** How this chat came into existence */ | ||
| origin?: ChatOrigin; |
There was a problem hiding this comment.
In discussion this morning we brought up the notion of chats in a session having their own working directories. I think this is probably valid and models how some orchestration systems work (agent swarms operating on worktrees and PRing/merging to each other when finishes). We can retain the default/primary workingDirectory on the session level but also should defined them for specific chats
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