Skip to content

Chat Channel

Reference for the ahp-chat:/<uuid> channel — per-chat state, the turn lifecycle, tool-call state machine, attachments, pending messages, and input requests. A chat belongs to a session (see Session Channel); a session may contain multiple chats. See Chat Channel specification for the wire-level overview.

JSON Schema: state.schema.json

State Types

ChatState

Full state for a single chat, loaded when a client subscribes to the chat's URI.

The lightweight catalog representation of a chat is {@link ChatSummary}, carried in {@link SessionState.chats | SessionState.chats}. ChatStatedenormalizes every {@link ChatSummary} field directly onto itself so subscribers receive one flat object instead of having to merge a nested summary sub-object. Producers MUST keep the two representations consistent: any change to the inlined fields below SHOULD also be announced on the parent session via the matching {@link SessionChatUpdatedAction | session/chatUpdated} action.

FieldTypeRequiredDescription
resourceURIYesChat URI
titlestringYesChat title
statusSessionStatusYesCurrent chat status (reuses SessionStatus shape)
activitystringNoHuman-readable description of what the chat is currently doing
modifiedAtstringYesLast modification timestamp (ISO 8601, e.g. "2025-03-10T18:42:03.123Z")
modelModelSelectionNoOptional per-chat model override (defaults to the session's model)
agentAgentSelectionNoOptional per-chat agent override (defaults to the session's agent)
originChatOriginNoHow this chat came into existence
interactivityChatInteractivityNoHow the user can interact with this chat. See {@link ChatInteractivity}.

Supports agent-team patterns where worker chats are read-only or hidden. Absence defaults to {@link ChatInteractivity.Full} for backward compatibility.
workingDirectoryURINoOptional per-chat working directory.

If absent, the chat inherits {@link SessionSummary.workingDirectory | the session's working directory}. Hosts MAY override this for individual chats — for example, to give a subordinate chat its own git worktree so multiple chats in a session can make independent edits that the orchestrator later merges back.
turnsTurn[]YesCompleted turns
activeTurnActiveTurnNoCurrently in-progress turn
steeringMessagePendingMessageNoMessage to inject into the current turn at a convenient point
queuedMessagesPendingMessage[]NoMessages to send automatically as new turns after the current turn finishes
inputRequestsChatInputRequest[]NoRequests for user input that are currently blocking or informing chat progress
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this chat.

ChatSummary

Lightweight catalog entry for a chat, carried in {@link SessionState.chats | SessionState.chats}. The full conversation lives in {@link ChatState}, which inlines (denormalizes) every field below.

FieldTypeRequiredDescription
resourceURIYesChat URI
titlestringYesChat title
statusSessionStatusYesCurrent chat status (reuses SessionStatus shape)
activitystringNoHuman-readable description of what the chat is currently doing
modifiedAtstringYesLast modification timestamp (ISO 8601, e.g. "2025-03-10T18:42:03.123Z")
modelModelSelectionNoOptional per-chat model override (defaults to the session's model)
agentAgentSelectionNoOptional per-chat agent override (defaults to the session's agent)
originChatOriginNoHow this chat came into existence
interactivityChatInteractivityNoHow the user can interact with this chat. See {@link ChatInteractivity}.

Supports agent-team patterns where worker chats are read-only or hidden. Absence defaults to {@link ChatInteractivity.Full} for backward compatibility.
workingDirectoryURINoOptional per-chat working directory.

If absent, the chat inherits {@link SessionSummary.workingDirectory | the session's working directory}. See {@link ChatState.workingDirectory} for usage notes.

ChatOriginKind

Discriminant for {@link ChatOrigin} — how a chat came into existence.

MemberValueDescription
User'user'User created the chat explicitly (e.g. via the host UI).
Fork'fork'Forked from an existing chat at a specific turn.
Tool'tool'Spawned by a tool call running in another chat (e.g. a sub-agent delegation).

ChatOrigin

How a chat came into existence. Clients MAY use it to render contextual UI (parent indicators, fork markers, "spawned by tool" badges).

The tool variant records a tool-spawned worker from the worker's side: its chat/toolCallId identify the spawning tool call in the parent chat. This is the canonical record of the spawn relationship. The same edge is surfaced from the parent's side by {@link ToolResultSubagentContent}, whose resource is this chat's URI; hosts MUST keep the two consistent.

{ kind: ChatOriginKind.User } | { kind: ChatOriginKind.Fork; chat: URI; turnId: string } | { kind: ChatOriginKind.Tool; chat: URI; toolCallId: string }

ChatInteractivity

How a user can interact with a chat.

  • Full — user can send messages and watch (default when absent)
  • ReadOnly — user can watch but not send messages (e.g. agent team workers)
  • Hidden — internal worker not shown in UI at all

Supports the agent-team pattern where a lead chat is fully interactive and worker chats are read-only (visible for observability) or hidden (internal implementation detail). The harness sets this based on the chat's role; the UI uses it to show appropriate controls.

MemberValueDescription
Full'full'User can send messages and watch (default when absent)
ReadOnly'read-only'User can watch but not send messages
Hidden'hidden'Internal worker not shown in UI at all

PendingMessageKind

Discriminant for pending message kinds.

MemberValueDescription
Steering'steering'Injected into the current turn at a convenient point
Queued'queued'Sent automatically as a new turn after the current turn finishes

PendingMessage

A message queued for future delivery to the agent.

Steering messages are injected into the current turn mid-flight. Queued messages are automatically started as new turns after the current turn naturally finishes.

FieldTypeDescription
idstringUnique identifier for this pending message
messageMessageThe message that will start the next turn

ChatInputResponseKind

How a client completed an input request.

MemberValue
Accept'accept'
Decline'decline'
Cancel'cancel'

ChatInputQuestionKind

Question/input control kind.

MemberValue
Text'text'
Number'number'
Integer'integer'
Boolean'boolean'
SingleSelect'single-select'
MultiSelect'multi-select'

ChatInputOption

A choice in a select-style question.

FieldTypeRequiredDescription
idstringYesStable option identifier; for MCP enum values this is the enum string
labelstringYesDisplay label
descriptionstringNoOptional secondary text
recommendedbooleanNoWhether this option is the recommended/default choice

ChatInputTextQuestion

Text question within a chat input request.

FieldTypeRequiredDescription
kindChatInputQuestionKind.TextYes
formatstringNoFormat hint for text questions, such as email, uri, date, or date-time
minnumberNoMinimum string length
maxnumberNoMaximum string length
defaultValuestringNoDefault text

ChatInputNumberQuestion

Numeric question within a chat input request.

FieldTypeRequiredDescription
kindChatInputQuestionKind.Number | ChatInputQuestionKind.IntegerYes
minnumberNoMinimum value
maxnumberNoMaximum value
defaultValuenumberNoDefault numeric value

ChatInputBooleanQuestion

Boolean question within a chat input request.

FieldTypeRequiredDescription
kindChatInputQuestionKind.BooleanYes
defaultValuebooleanNoDefault boolean value

ChatInputSingleSelectQuestion

Single-select question within a chat input request.

FieldTypeRequiredDescription
kindChatInputQuestionKind.SingleSelectYes
optionsChatInputOption[]YesOptions the user may select from
allowFreeformInputbooleanNoWhether the user may enter text instead of selecting an option

ChatInputMultiSelectQuestion

Multi-select question within a chat input request.

FieldTypeRequiredDescription
kindChatInputQuestionKind.MultiSelectYes
optionsChatInputOption[]YesOptions the user may select from
allowFreeformInputbooleanNoWhether the user may enter text in addition to selecting options
minnumberNoMinimum selected item count
maxnumberNoMaximum selected item count

ChatInputQuestion

One question within a chat input request.

ChatInputTextQuestion | ChatInputNumberQuestion | ChatInputBooleanQuestion | ChatInputSingleSelectQuestion | ChatInputMultiSelectQuestion

ChatInputRequest

A live request for user input.

The server creates or replaces requests with chat/inputRequested. Clients sync drafts with chat/inputAnswerChanged and complete requests with chat/inputCompleted.

FieldTypeRequiredDescription
idstringYesStable request identifier
messagestringNoDisplay message for the request as a whole
urlURINoURL the user should review or open, for URL-style elicitations
questionsChatInputQuestion[]NoOrdered questions to ask the user
answersRecord<string, ChatInputAnswer>NoCurrent draft or submitted answers, keyed by question ID

ChatInputAnswerValueKind

Answer value kind.

MemberValue
Text'text'
Number'number'
Boolean'boolean'
Selected'selected'
SelectedMany'selected-many'

ChatInputTextAnswerValue

Value captured for one answer.

FieldTypeDescription
kindChatInputAnswerValueKind.Text
valuestring

ChatInputNumberAnswerValue

FieldTypeDescription
kindChatInputAnswerValueKind.Number
valuenumber

ChatInputBooleanAnswerValue

FieldTypeDescription
kindChatInputAnswerValueKind.Boolean
valueboolean

ChatInputSelectedAnswerValue

FieldTypeRequiredDescription
kindChatInputAnswerValueKind.SelectedYes
valuestringYes
freeformValuesstring[]NoFree-form text entered instead of selecting an option

ChatInputSelectedManyAnswerValue

FieldTypeRequiredDescription
kindChatInputAnswerValueKind.SelectedManyYes
valuestring[]Yes
freeformValuesstring[]NoFree-form text entered in addition to selected options

ChatInputAnswerValue

ChatInputTextAnswerValue | ChatInputNumberAnswerValue | ChatInputBooleanAnswerValue | ChatInputSelectedAnswerValue | ChatInputSelectedManyAnswerValue

ChatInputAnswered

FieldTypeDescription
stateChatInputAnswerState.Draft | ChatInputAnswerState.SubmittedAnswer state
valueChatInputAnswerValueAnswer value

ChatInputSkipped

FieldTypeRequiredDescription
stateChatInputAnswerState.SkippedYesAnswer state
freeformValuesstring[]NoFree-form reason or value captured while skipping, if any

ChatInputAnswerState

Answer lifecycle state.

MemberValue
Draft'draft'
Submitted'submitted'
Skipped'skipped'

ChatInputAnswer

Draft, submitted, or skipped answer for one question.

ChatInputAnswered | ChatInputSkipped

TurnState

How a turn ended.

MemberValue
Complete'complete'
Cancelled'cancelled'
Error'error'

MessageAttachmentKind

Discriminant for {@link MessageAttachment} variants.

MemberValueDescription
Simple'simple'A simple, opaque attachment whose representation is described by the producer.
EmbeddedResource'embeddedResource'An attachment whose data is embedded inline as a base64 string.
Resource'resource'An attachment that references a resource by URI.
Annotations'annotations'An attachment that references annotations on an annotations channel.

Turn

A completed request/response cycle.

FieldTypeRequiredDescription
idstringYesTurn identifier
messageMessageYesThe message that initiated the turn
responsePartsResponsePart[]YesAll response content in stream order: text, tool calls, reasoning, and content refs.

Consumers should derive display text by concatenating markdown parts, and find tool calls by filtering for ToolCall parts.
usageUsageInfo | undefinedYesToken usage info
stateTurnStateYesHow the turn ended
errorErrorInfoNoError details if state is 'error'

ActiveTurn

An in-progress turn — the assistant is actively streaming.

FieldTypeDescription
idstringTurn identifier
messageMessageThe message that initiated the turn
responsePartsResponsePart[]All response content in stream order: text, tool calls, reasoning, and content refs.

Tool call parts include pendingPermissions when permissions are awaiting user approval.
usageUsageInfo | undefinedToken usage info

MessageKind

Discriminant for {@link MessageOrigin} — identifies who produced a message.

MemberValueDescription
User'user'Sent directly by the user.
Agent'agent'Produced by the agent itself rather than the user — for example, an agent that seeds the first message of a chat it spawned.
Tool'tool'Produced by a tool rather than the user — for example, a tool that spawns a worker chat whose first message carries a seed prompt.
SystemNotification'systemNotification'A system-generated notification rather than a direct user message.

MessageOrigin

Identifies the origin of a {@link Message} — who produced it. For the message that initiates a turn ({@link Turn.message}), this is also the origin of the turn; for steering or queued messages it is just the origin of that message.

FieldTypeDescription
kindMessageKindThe kind of actor that produced the message.

Message

A message that initiates or steers a turn. Messages can originate from the user, the agent, a tool, or be system-generated (see {@link MessageOrigin}).

Attachments MAY be referenced inside {@link Message.text} via their {@link MessageAttachmentBase.range} field. Attachments without a range are still associated with the message but do not correspond to a specific span in the text.

FieldTypeRequiredDescription
textstringYesMessage text
originMessageOriginYesThe origin of the message
attachmentsMessageAttachment[]NoFile/selection attachments
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this message.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry context that does not fit any other field. Mirrors the MCP _meta convention.

MessageAttachmentBase

Common fields shared by all {@link MessageAttachment} variants.

FieldTypeRequiredDescription
labelstringYesA human-readable label for the attachment (e.g. the filename of a file attachment). Used for display in UI.
rangeTextRangeNoIf defined, the range in {@link Message.text} that references this attachment. This is a text range, not a byte range.
displayKindstringNoAdvisory display hint for clients rendering this attachment. Recognized values include:

- 'image': the attachment is an image - 'document': the attachment is a textual document - 'symbol': the attachment is a code symbol (e.g. a function or class) - 'directory': the attachment is a folder - 'selection': the attachment is a selection within a document

Implementations MAY provide additional values; clients SHOULD fall back to a reasonable default when an unknown value is encountered.
_metaRecord<string, unknown>NoAdditional implementation-defined metadata for the attachment.

If the attachment was produced by the completions command, the client MUST preserve every property of _meta originally returned by the agent host when sending the user message containing the accepted completion.

SimpleMessageAttachment

A simple, opaque attachment whose model representation is described by the producer.

FieldTypeRequiredDescription
typeMessageAttachmentKind.SimpleYesDiscriminant
modelRepresentationstringNoRepresentation of the attachment as it should be shown to the model.

If the attachment was produced by the client, this property MUST be defined so the agent host can correctly interpret the attachment. This property MAY be omitted when the attachment originated from a completions response.

MessageEmbeddedResourceAttachment

An attachment whose data is embedded inline as a base64 string.

Use this for small binary payloads (e.g. a pasted image) that should be delivered with the user message itself rather than fetched separately.

FieldTypeRequiredDescription
typeMessageAttachmentKind.EmbeddedResourceYesDiscriminant
datastringYesBase64-encoded binary data
contentTypestringYesContent MIME type (e.g. "image/png", "application/pdf")
selectionTextSelectionNoOptional selection within the attached textual resource.

Only meaningful for textual resources.

MessageResourceAttachment

An attachment that references a resource by URI. The content is not delivered inline; consumers can fetch it via resourceRead when needed.

FieldTypeRequiredDescription
typeMessageAttachmentKind.ResourceYesDiscriminant
selectionTextSelectionNoOptional selection within the referenced textual resource.

Only meaningful for textual resources.

MessageAnnotationsAttachment

An attachment that references annotations on a session's annotations channel (see {@link AnnotationsState}).

When {@link annotationIds} is omitted the attachment references every annotation on the channel; when present it references only the listed {@link Annotation.id | annotation ids}.

FieldTypeRequiredDescription
typeMessageAttachmentKind.AnnotationsYesDiscriminant
resourceURIYesThe annotations channel URI (typically ahp-session:/&lt;uuid&gt;/annotations). Matches {@link AnnotationsSummary.resource}.
annotationIdsstring[]NoSpecific {@link Annotation.id | annotation ids} to reference. When omitted, the attachment references all annotations on the channel.

MessageAttachment

An attachment associated with a {@link Message}.

SimpleMessageAttachment | MessageEmbeddedResourceAttachment | MessageResourceAttachment | MessageAnnotationsAttachment

ResponsePartKind

Discriminant for response part types.

MemberValue
Markdown'markdown'
ContentRef'contentRef'
ToolCall'toolCall'
Reasoning'reasoning'
SystemNotification'systemNotification'

MarkdownResponsePart

FieldTypeDescription
kindResponsePartKind.MarkdownDiscriminant
idstringPart identifier, used by chat/delta to target this part for content appends
contentstringMarkdown content

ResourceReponsePart

A content part that's a reference to large content stored outside the state tree.

FieldTypeDescription
kindResponsePartKind.ContentRefDiscriminant

ToolCallResponsePart

A tool call represented as a response part.

Tool calls are part of the response stream, interleaved with text and reasoning. The toolCall.toolCallId serves as the part identifier for actions that target this part.

FieldTypeDescription
kindResponsePartKind.ToolCallDiscriminant
toolCallToolCallStateFull tool call lifecycle state

ReasoningResponsePart

Reasoning/thinking content from the model.

FieldTypeDescription
kindResponsePartKind.ReasoningDiscriminant
idstringPart identifier, used by chat/reasoning to target this part for content appends
contentstringAccumulated reasoning text

ResponsePart

MarkdownResponsePart | ResourceReponsePart | ToolCallResponsePart | ReasoningResponsePart | SystemNotificationResponsePart

SystemNotificationResponsePart

A system notification surfaced as part of the response stream.

System notifications are messages authored by the agent harness that need to be visible to both the agent (for situational awareness) and the user (for transcript continuity). Examples include "background subagent X completed" or "task Y was cancelled".

FieldTypeDescription
kindResponsePartKind.SystemNotificationDiscriminant
contentStringOrMarkdownThe text of the system notification

ToolCallStatus

Status of a tool call in the lifecycle state machine.

MemberValue
Streaming'streaming'
PendingConfirmation'pending-confirmation'
Running'running'
PendingResultConfirmation'pending-result-confirmation'
Completed'completed'
Cancelled'cancelled'

ToolCallConfirmationReason

How a tool call was confirmed for execution.

  • NotNeeded — No confirmation required (auto-approved)
  • UserAction — User explicitly approved
  • Setting — Approved by a persistent user setting
MemberValue
NotNeeded'not-needed'
UserAction'user-action'
Setting'setting'

ToolCallCancellationReason

Why a tool call was cancelled.

MemberValue
Denied'denied'
Skipped'skipped'
ResultDenied'result-denied'

ConfirmationOptionKind

Whether a confirmation option represents an approval or denial action.

MemberValue
Approve'approve'
Deny'deny'

ConfirmationOption

A confirmation option that the server offers for a tool call awaiting approval. Allows richer choices beyond simple approve/deny — for example, "Approve in this Session" or "Deny with reason."

FieldTypeRequiredDescription
idstringYesUnique identifier for the option, returned in the confirmed action
labelstringYesHuman-readable label displayed to the user
kindConfirmationOptionKindYesWhether this option represents an approval or denial
groupnumberNoLogical group number for visual categorisation.

Clients SHOULD display options in the order they are defined and MAY use differing group numbers to insert dividers between logical clusters of options.

ToolCallContributorKind

MemberValue
Client'client'
MCP'mcp'

ToolCallClientContributor

FieldTypeDescription
kindToolCallContributorKind.Client
clientIdstringIf this tool is provided by a client, the clientId of the owning client. Absent for server-side tools.

When set, the identified client is responsible for executing the tool and dispatching chat/toolCallComplete with the result.

ToolCallMcpContributor

FieldTypeDescription
kindToolCallContributorKind.MCP
customizationIdstringCustomization ID of the corresponding MCP server in {@link SessionState.customizations}.

ToolCallContributor

ToolCallClientContributor | ToolCallMcpContributor

ToolCallResult

Tool execution result details, available after execution completes.

FieldTypeRequiredDescription
successbooleanYesWhether the tool succeeded
pastTenseMessageStringOrMarkdownYesPast-tense description of what the tool did
contentToolResultContent[]NoUnstructured result content blocks.

This mirrors the content field of MCP CallToolResult.
structuredContentRecord<string, unknown>NoOptional structured result object.

This mirrors the structuredContent field of MCP CallToolResult.
error
{
  message: string;
  code?: string
}
NoError details if the tool failed

ToolCallStreamingState

LM is streaming the tool call parameters.

FieldTypeRequiredDescription
statusToolCallStatus.StreamingYes
partialInputstringNoPartial parameters accumulated so far
invocationMessageStringOrMarkdownNoProgress message shown while parameters are streaming

ToolCallPendingConfirmationState

Parameters are complete, or a running tool requires re-confirmation (e.g. a mid-execution permission check).

FieldTypeRequiredDescription
statusToolCallStatus.PendingConfirmationYes
confirmationTitleStringOrMarkdownNoShort title for the confirmation prompt (e.g. "Run in terminal", "Write file")
edits
{
  items: FileEdit[]
}
NoFile edits that this tool call will perform, for preview before confirmation
editablebooleanNoWhether the agent host allows the client to edit the tool's input parameters before confirming
optionsConfirmationOption[]NoOptions the server offers for this confirmation. When present, the client SHOULD render these instead of a plain approve/deny UI. Each option belongs to a {@link ConfirmationOptionGroup} so the client can still categorise the choices.

ToolCallRunningState

Tool is actively executing.

FieldTypeRequiredDescription
statusToolCallStatus.RunningYes
confirmedToolCallConfirmationReasonYesHow the tool was confirmed for execution
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided
contentToolResultContent[]NoPartial content produced while the tool is still executing.

For example, a terminal content block lets clients subscribe to live output before the tool completes.

ToolCallPendingResultConfirmationState

Tool finished executing, waiting for client to approve the result.

FieldTypeRequiredDescription
statusToolCallStatus.PendingResultConfirmationYes
confirmedToolCallConfirmationReasonYesHow the tool was confirmed for execution
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided

ToolCallCompletedState

Tool completed successfully or with an error.

FieldTypeRequiredDescription
statusToolCallStatus.CompletedYes
confirmedToolCallConfirmationReasonYesHow the tool was confirmed for execution
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided

ToolCallCancelledState

Tool call was cancelled before execution.

FieldTypeRequiredDescription
statusToolCallStatus.CancelledYes
reasonToolCallCancellationReasonYesWhy the tool was cancelled
reasonMessageStringOrMarkdownNoOptional message explaining the cancellation
userSuggestionMessageNoWhat the user suggested doing instead
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided

ToolCallState

Discriminated union of all tool call lifecycle states.

See the state model guide for the full state machine diagram.

ToolCallStreamingState | ToolCallPendingConfirmationState | ToolCallRunningState | ToolCallPendingResultConfirmationState | ToolCallCompletedState | ToolCallCancelledState

ToolResultContentType

Discriminant for tool result content types.

MemberValue
Text'text'
EmbeddedResource'embeddedResource'
Resource'resource'
FileEdit'fileEdit'
Terminal'terminal'
Subagent'subagent'

ToolResultTextContent

Text content in a tool result.

Mirrors MCP TextContent.

FieldTypeDescription
typeToolResultContentType.Text
textstringThe text content

ToolResultEmbeddedResourceContent

Base64-encoded binary content embedded in a tool result.

Mirrors MCP EmbeddedResource for inline binary data.

FieldTypeDescription
typeToolResultContentType.EmbeddedResource
datastringBase64-encoded data
contentTypestringContent type (e.g. "image/png", "application/pdf")

ToolResultResourceContent

A reference to a resource stored outside the tool result.

Wraps {@link ContentRef} for lazy-loading large results.

FieldTypeDescription
typeToolResultContentType.Resource

ToolResultFileEditContent

Describes a file modification performed by a tool.

FieldTypeDescription
typeToolResultContentType.FileEdit

ToolResultTerminalContent

A reference to a terminal whose output is relevant to this tool result.

Clients can subscribe to the terminal's URI to stream its output in real time, providing live feedback while a tool is executing.

FieldTypeDescription
typeToolResultContentType.Terminal
resourceURITerminal URI (subscribable for full terminal state)
titlestringDisplay title for the terminal content

ToolResultSubagentContent

A reference, embedded in a tool result, to a worker chat spawned by the tool call (a sub-agent delegation), referenced by a chat URI (ahp-chat:/...).

This is the spawning tool call's forward view of the worker. The worker chat records the same edge in reverse via its {@link ChatOrigin} (kind: 'tool'), whose toolCallId identifies the tool call that emitted this content.

FieldTypeRequiredDescription
typeToolResultContentType.SubagentYes
resourceURIYesWorker chat URI (subscribable for full chat state)
titlestringYesDisplay title for the subagent
agentNamestringNoInternal agent name
descriptionstringNoHuman-readable description of the subagent's task

ToolResultContent

Content block in a tool result.

Mirrors the content blocks in MCP CallToolResult.content, plus ToolResultResourceContent for lazy-loading large results, ToolResultFileEditContent for file edit diffs, ToolResultTerminalContent for live terminal output, and ToolResultSubagentContent for tool-spawned worker chats (AHP extensions).

ToolResultTextContent | ToolResultEmbeddedResourceContent | ToolResultResourceContent | ToolResultFileEditContent | ToolResultTerminalContent | ToolResultSubagentContent

Actions

Mutate ChatState. Scoped to a chat URI via the enclosing ActionEnvelope.channel.

JSON Schema: actions.schema.json

chat/turnStarted

A new message has been sent to the agent, and a new turn starts.

A client is only allowed to send {@link MessageKind.User} messages.

FieldTypeRequiredDescription
typeActionType.ChatTurnStartedYes
turnIdstringYesTurn identifier
messageMessageYesThe new message
queuedMessageIdstringNoIf this turn was auto-started from a queued message, the ID of that message
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/delta

Streaming text chunk from the assistant, appended to a specific response part.

The server MUST first emit a chat/responsePart to create the target part (markdown or reasoning), then use this action to append text to it.

FieldTypeRequiredDescription
typeActionType.ChatDeltaYes
turnIdstringYesTurn identifier
partIdstringYesIdentifier of the response part to append to
contentstringYesText chunk
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/responsePart

Structured content appended to the response.

FieldTypeRequiredDescription
typeActionType.ChatResponsePartYes
turnIdstringYesTurn identifier
partResponsePartYesResponse part (markdown or content ref)
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/toolCallStart

A tool call begins — parameters are streaming from the LM.

The server sets {@link ToolCallContributor | contributor} to identify the origin of the tool. For client-provided tools, the named client is responsible for executing the tool once it reaches the running state and dispatching chat/toolCallComplete. For MCP-served tools, the server executes the call against the named McpServerCustomization.

FieldTypeRequiredDescription
typeActionType.ChatToolCallStartYes
toolNamestringYesInternal tool name (for debugging/logging)
displayNamestringYesHuman-readable tool name
contributorToolCallContributorNoReference to the contributor of the tool being called. Absent for server-side tools that are not contributed by a client or MCP server.

chat/toolCallDelta

Streaming partial parameters for a tool call.

FieldTypeRequiredDescription
typeActionType.ChatToolCallDeltaYes
contentstringYesPartial parameter content to append
invocationMessageStringOrMarkdownNoUpdated progress message

chat/toolCallReady

Tool call parameters are complete, or a running tool requires re-confirmation.

When dispatched for a streaming tool call, transitions to pending-confirmation or directly to running if confirmed is set.

When dispatched for a running tool call (e.g. mid-execution permission needed), transitions back to pending-confirmation. The invocationMessage and _meta SHOULD be updated to describe the specific confirmation needed. Clients use the standard chat/toolCallConfirmed flow to approve or deny.

For client-provided tools, the server typically sets confirmed to 'not-needed' so the tool transitions directly to running, where the owning client can begin execution immediately.

FieldTypeRequiredDescription
typeActionType.ChatToolCallReadyYes
invocationMessageStringOrMarkdownYesMessage describing what the tool will do or what confirmation is needed
toolInputstringNoRaw tool input
confirmationTitleStringOrMarkdownNoShort title for the confirmation prompt (e.g. "Run in terminal", "Write file")
edits
{
  items: FileEdit[]
}
NoFile edits that this tool call will perform, for preview before confirmation
editablebooleanNoWhether the agent host allows the client to edit the tool's input parameters before confirming
confirmedToolCallConfirmationReasonNoIf set, the tool was auto-confirmed and transitions directly to running
optionsConfirmationOption[]NoOptions the server offers for this confirmation. When present, the client SHOULD render these instead of a plain approve/deny UI. Each option belongs to a {@link ConfirmationOptionGroup} so the client can still categorise the choices.

chat/toolCallConfirmed (approved)

Client approves a pending tool call. The tool transitions to running.

FieldTypeRequiredDescription
typeActionType.ChatToolCallConfirmedYes
approvedtrueYesThe tool call was approved
confirmedToolCallConfirmationReasonYesHow the tool was confirmed
editedToolInputstringNoEdited tool input parameters, if the client modified them before confirming
selectedOptionIdstringNoID of the selected confirmation option, if the server provided options

chat/toolCallConfirmed (denied)

Client denies a pending tool call. The tool transitions to cancelled.

For client-provided tools, the owning client MUST dispatch this if it does not recognize the tool or cannot execute it.

FieldTypeRequiredDescription
typeActionType.ChatToolCallConfirmedYes
approvedfalseYesThe tool call was denied
reasonToolCallCancellationReason.Denied | ToolCallCancellationReason.SkippedYesWhy the tool was cancelled
userSuggestionMessageNoWhat the user suggested doing instead
reasonMessageStringOrMarkdownNoOptional explanation for the denial
selectedOptionIdstringNoID of the selected confirmation option, if the server provided options

ChatToolCallConfirmedAction

Client confirms or denies a pending tool call.

ChatToolCallApprovedAction | ChatToolCallDeniedAction

chat/toolCallComplete

Tool execution finished. Transitions to completed or pending-result-confirmation if requiresResultConfirmation is true.

For client-provided tools (where toolClientId is set on the tool call state), the owning client dispatches this action with the execution result. The server SHOULD reject this action if the dispatching client does not match toolClientId.

Servers waiting on a client tool call MAY time out after a reasonable duration if the implementing client disconnects or becomes unresponsive, and dispatch this action with result.success = false and an appropriate error.

FieldTypeRequiredDescription
typeActionType.ChatToolCallCompleteYes
resultToolCallResultYesExecution result
requiresResultConfirmationbooleanNoIf true, the result requires client approval before finalizing

chat/toolCallResultConfirmed

Client approves or denies a tool's result.

If approved is false, the tool transitions to cancelled with reason result-denied.

FieldTypeDescription
typeActionType.ChatToolCallResultConfirmed
approvedbooleanWhether the result was approved

chat/toolCallContentChanged

Partial content produced while a tool is still executing.

Replaces the content array on the running tool call state. Clients can use this to display live feedback (e.g. a terminal reference) before the tool completes.

For client-provided tools (where toolClientId is set on the tool call state), the owning client dispatches this action to stream intermediate content while executing. The server SHOULD reject this action if the dispatching client does not match toolClientId.

FieldTypeDescription
typeActionType.ChatToolCallContentChanged
contentToolResultContent[]The current partial content for the running tool call

chat/turnComplete

Turn finished — the assistant is idle.

FieldTypeRequiredDescription
typeActionType.ChatTurnCompleteYes
turnIdstringYesTurn identifier
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/turnCancelled

Turn was aborted; server stops processing.

FieldTypeRequiredDescription
typeActionType.ChatTurnCancelledYes
turnIdstringYesTurn identifier
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/error

Error during turn processing.

FieldTypeRequiredDescription
typeActionType.ChatErrorYes
turnIdstringYesTurn identifier
errorErrorInfoYesError details
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/usage

Token usage report for a turn.

FieldTypeRequiredDescription
typeActionType.ChatUsageYes
turnIdstringYesTurn identifier
usageUsageInfoYesToken usage data
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/reasoning

Reasoning/thinking text from the model, appended to a specific reasoning response part.

The server MUST first emit a chat/responsePart to create the target reasoning part, then use this action to append text to it.

FieldTypeRequiredDescription
typeActionType.ChatReasoningYes
turnIdstringYesTurn identifier
partIdstringYesIdentifier of the reasoning response part to append to
contentstringYesReasoning text chunk
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this action.

Clients MAY look for well-known keys here to provide enhanced UI, and agent hosts MAY use it to carry per-event context that does not fit any other field — for example, attributing the event to a specific agent (such as a sub-agent acting within the turn). Mirrors the MCP _meta convention.

chat/truncated

Truncates a session's history. If turnId is provided, all turns after that turn are removed and the specified turn is kept. If turnId is omitted, all turns are removed.

If there is an active turn it is silently dropped and the chat status returns to idle.

Common use-case: truncate old data then dispatch a new chat/turnStarted with an edited message.

FieldTypeRequiredDescription
typeActionType.ChatTruncatedYes
turnIdstringNoKeep turns up to and including this turn. Omit to clear all turns.

chat/pendingMessageSet

A pending message was set (upsert semantics: creates or replaces).

For steering messages, this always replaces the single steering message. For queued messages, if a message with the given id already exists it is updated in place; otherwise it is appended to the queue. If the chat is idle when a queued message is set, the server SHOULD immediately consume it and start a new turn.

A client is only allowed to send {@link MessageKind.User} messages.

FieldTypeDescription
typeActionType.ChatPendingMessageSet
kindPendingMessageKindWhether this is a steering or queued message
idstringUnique identifier for this pending message
messageMessageThe message content

chat/pendingMessageRemoved

A pending message was removed (steering or queued).

Dispatched by clients to cancel a pending message, or by the server when it consumes a message (e.g. starting a turn from a queued message or injecting a steering message into the current turn).

FieldTypeDescription
typeActionType.ChatPendingMessageRemoved
kindPendingMessageKindWhether this is a steering or queued message
idstringIdentifier of the pending message to remove

chat/queuedMessagesReordered

Reorder the queued messages.

The order array contains the IDs of queued messages in their new desired order. IDs not present in the current queue are ignored. Queued messages whose IDs are absent from order are appended at the end in their original relative order (so a client with a stale view of the queue never silently drops messages).

FieldTypeDescription
typeActionType.ChatQueuedMessagesReordered
orderstring[]Queued message IDs in the desired order

chat/inputRequested

A session requested input from the user.

Full-request upsert semantics: the request replaces any existing request with the same id, or is appended if it is new. Answer drafts are preserved unless request.answers is provided.

FieldTypeDescription
typeActionType.ChatInputRequested
requestChatInputRequestInput request to create or replace

chat/inputAnswerChanged

A client updated, submitted, skipped, or removed a single in-progress answer.

Dispatching with answer: undefined removes that question's answer draft.

FieldTypeRequiredDescription
typeActionType.ChatInputAnswerChangedYes
requestIdstringYesInput request identifier
questionIdstringYesQuestion identifier within the input request
answerChatInputAnswerNoUpdated answer, or undefined to clear an answer draft

chat/inputCompleted

A client accepted, declined, or cancelled a session input request.

If accepted, the server uses answers (when provided) plus the request's synced answer state to resume the blocked operation.

FieldTypeRequiredDescription
typeActionType.ChatInputCompletedYes
requestIdstringYesInput request identifier
responseChatInputResponseKindYesCompletion outcome
answersRecord<string, ChatInputAnswer>NoOptional final answer replacement, keyed by question ID

ChatAction

ChatTurnStartedAction | ChatDeltaAction | ChatResponsePartAction | ChatToolCallStartAction | ChatToolCallDeltaAction | ChatToolCallReadyAction | ChatToolCallConfirmedAction | ChatToolCallCompleteAction | ChatToolCallResultConfirmedAction | ChatToolCallContentChangedAction | ChatTurnCompleteAction | ChatTurnCancelledAction | ChatErrorAction | ChatUsageAction | ChatReasoningAction | ChatTruncatedAction | ChatPendingMessageSetAction | ChatPendingMessageRemovedAction | ChatQueuedMessagesReorderedAction | ChatInputRequestedAction | ChatInputAnswerChangedAction | ChatInputCompletedAction

Commands

JSON Schema: commands.schema.json

createChat

Creates a new chat within a session.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeRequiredDescription
channelURIYesSession URI containing the new chat.
chatURIYesChat URI (client-chosen, e.g. ahp-chat:/&lt;uuid&gt;).
initialMessageMessageNoOptional initial message for the new chat.
modelModelSelectionNoOptional per-chat model override.
agentAgentSelectionNoOptional per-chat agent override.
sourceChatForkSourceNoOptional source chat and turn to fork from.

Result: null on success.


disposeChat

Disposes a chat and cleans up server-side resources.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

No parameters.

Result: null on success.


Released under the MIT License.