Skip to content

Session Channel

Reference for the ahp-session:/<uuid> channel — per-session state, the turn lifecycle, tool-call state machine, attachments, pending messages, input requests, and per-session customizations. See Session Channel specification for the wire-level overview.

JSON Schema: state.schema.json

State Types

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
userMessageUserMessageThe message content

SessionLifecycle

Session initialization state.

MemberValue
Creating'creating'
Ready'ready'
CreationFailed'creationFailed'

SessionStatus

Bitset of summary-level session status flags.

Use bitwise checks instead of equality for non-terminal activity. For example, status & SessionStatus.InProgress matches both ordinary in-progress turns and turns that are paused waiting for input.

MemberValueDescription
Idle1Session is idle — no turn is active.
Error1 << 1Session ended with an error.
InProgress1 << 3A turn is actively streaming.
InputNeeded(1 << 3) | (1 << 4)A turn is in progress but blocked waiting for user input or tool confirmation.
IsRead1 << 5The client has viewed this session since its last modification.
IsArchived1 << 6The session has been archived by the client.

SessionState

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

FieldTypeRequiredDescription
summarySessionSummaryYesLightweight session metadata
lifecycleSessionLifecycleYesSession initialization state
creationErrorErrorInfoNoError details if creation failed
serverToolsToolDefinition[]NoTools provided by the server (agent host) for this session
activeClientSessionActiveClientNoThe client currently providing tools and interactive capabilities to this session
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
inputRequestsSessionInputRequest[]NoRequests for user input that are currently blocking or informing session progress
configSessionConfigStateNoSession configuration schema and current values
customizationsCustomization[]NoTop-level customizations active in this session.

Always container customizations — {@link PluginCustomization} or {@link DirectoryCustomization}. Children (agents, skills, prompts, rules, hooks, MCP servers) live in each container's {@link ContainerCustomizationBase.children | children} array.

Client-published plugins arrive via {@link SessionActiveClient.customizations | activeClient.customizations} and the host propagates them into this list (typically with the container's clientId set and children populated).
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this session.

Clients MAY look for well-known keys here to provide enhanced UI. For example, a git key may provide extra git metadata about the session's workingDirectory.

SessionActiveClient

The client currently providing tools and interactive capabilities to a session.

Only one client may be active per session at a time. The server SHOULD automatically unset the active client if that client disconnects.

FieldTypeRequiredDescription
clientIdstringYesClient identifier (matches clientId from initialize)
displayNamestringNoHuman-readable client name (e.g. "VS Code")
toolsToolDefinition[]YesTools this client provides to the session
customizationsClientPluginCustomization[]NoPlugin customizations this client contributes to the session.

Clients publish in Open Plugins format — i.e. always container-shaped plugins. They MAY synthesize virtual plugins in memory and rely on the host to expand them into concrete children inside {@link SessionState.customizations}.

ProjectInfo

Server-owned project metadata for a session.

FieldTypeDescription
uriURIProject URI
displayNamestringHuman-readable project name

SessionSummary

FieldTypeRequiredDescription
resourceURIYesSession URI
providerstringYesAgent provider ID
titlestringYesSession title
statusSessionStatusYesCurrent session status
activitystringNoHuman-readable description of what the session is currently doing
createdAtnumberYesCreation timestamp
modifiedAtnumberYesLast modification timestamp
projectProjectInfoNoServer-owned project for this session
modelModelSelectionNoCurrently selected model
agentAgentSelectionNoCurrently selected custom agent.

Absent (undefined) means no custom agent is selected for this session — the session uses the provider's default behavior.
workingDirectoryURINoThe working directory URI for this session
changesetsChangesetSummary[]NoCatalogue of changesets the server can produce for this session. Each entry advertises a subscribable view of file changes (uncommitted, session-wide, per-turn, etc.) and the URI template the client expands before subscribing. See {@link ChangesetSummary} for the full shape and {@link /guide/changesets | Changesets} for an overview of the model.

AgentSelection

A selected custom agent for a session.

The uri identifies a specific custom agent (matching an {@link AgentCustomization.uri | AgentCustomization.uri} exposed via the session's effective customizations). Consumers resolve the agent's display name by looking up uri in the session's customization tree.

A session with no agent selected uses the provider's default behavior.

FieldTypeDescription
uriURIStable agent URI (matches an {@link AgentCustomization.uri}).

SessionConfigPropertySchema

A session configuration property descriptor.

Extends the generic {@link ConfigPropertySchema} with session-specific display extensions.

FieldTypeRequiredDescription
enumDynamicbooleanNoDisplay extension: when true, the full set of allowed values is too large to enumerate statically. The client SHOULD use sessionConfigCompletions to fetch matching values based on user input. Any values in enum are seed/recent values for initial display.
sessionMutablebooleanNoWhen true, the user may change this property after session creation

SessionConfigSchema

A JSON Schema object describing available session configuration metadata.

FieldTypeRequiredDescription
type'object'YesJSON Schema: always 'object'
propertiesRecord<string, SessionConfigPropertySchema>YesJSON Schema: property descriptors keyed by property id
requiredstring[]NoJSON Schema: list of required property ids

SessionConfigState

Live session configuration metadata.

The schema describes the available configuration properties and the values contain the current value for each resolved property.

FieldTypeDescription
schemaSessionConfigSchemaJSON Schema describing available configuration properties
valuesRecord<string, unknown>Current configuration values

SessionInputResponseKind

How a client completed an input request.

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

SessionInputQuestionKind

Question/input control kind.

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

SessionInputOption

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

SessionInputTextQuestion

Text question within a session input request.

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

SessionInputNumberQuestion

Numeric question within a session input request.

FieldTypeRequiredDescription
kindSessionInputQuestionKind.Number | SessionInputQuestionKind.IntegerYes
minnumberNoMinimum value
maxnumberNoMaximum value
defaultValuenumberNoDefault numeric value

SessionInputBooleanQuestion

Boolean question within a session input request.

FieldTypeRequiredDescription
kindSessionInputQuestionKind.BooleanYes
defaultValuebooleanNoDefault boolean value

SessionInputSingleSelectQuestion

Single-select question within a session input request.

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

SessionInputMultiSelectQuestion

Multi-select question within a session input request.

FieldTypeRequiredDescription
kindSessionInputQuestionKind.MultiSelectYes
optionsSessionInputOption[]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

SessionInputQuestion

One question within a session input request.

SessionInputTextQuestion | SessionInputNumberQuestion | SessionInputBooleanQuestion | SessionInputSingleSelectQuestion | SessionInputMultiSelectQuestion

SessionInputRequest

A live request for user input.

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

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

SessionInputAnswerValueKind

Answer value kind.

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

SessionInputTextAnswerValue

Value captured for one answer.

FieldTypeDescription
kindSessionInputAnswerValueKind.Text
valuestring

SessionInputNumberAnswerValue

FieldTypeDescription
kindSessionInputAnswerValueKind.Number
valuenumber

SessionInputBooleanAnswerValue

FieldTypeDescription
kindSessionInputAnswerValueKind.Boolean
valueboolean

SessionInputSelectedAnswerValue

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

SessionInputSelectedManyAnswerValue

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

SessionInputAnswerValue

SessionInputTextAnswerValue | SessionInputNumberAnswerValue | SessionInputBooleanAnswerValue | SessionInputSelectedAnswerValue | SessionInputSelectedManyAnswerValue

SessionInputAnswered

FieldTypeDescription
stateSessionInputAnswerState.Draft | SessionInputAnswerState.SubmittedAnswer state
valueSessionInputAnswerValueAnswer value

SessionInputSkipped

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

SessionInputAnswerState

Answer lifecycle state.

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

SessionInputAnswer

Draft, submitted, or skipped answer for one question.

SessionInputAnswered | SessionInputSkipped

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.

Turn

A completed request/response cycle.

FieldTypeRequiredDescription
idstringYesTurn identifier
userMessageUserMessageYesThe user's input
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
userMessageUserMessageThe user's input
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

UserMessage

A user message and its associated attachments.

Attachments MAY be referenced inside {@link UserMessage.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
attachmentsMessageAttachment[]NoFile/selection attachments

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 UserMessage.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.

MessageAttachment

An attachment associated with a {@link UserMessage}.

SimpleMessageAttachment | MessageEmbeddedResourceAttachment | MessageResourceAttachment

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 session/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 session/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.

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
userSuggestionUserMessageNoWhat 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

ToolDefinition

Describes a tool available in a session, provided by either the server or the active client.

FieldTypeRequiredDescription
namestringYesUnique tool identifier
titlestringNoHuman-readable display name
descriptionstringNoDescription of what the tool does
inputSchema
{
  type: 'object';
  properties?: Record<string,
  object>;
  required?: string[];
}
NoJSON Schema defining the expected input parameters.

Optional because client-provided tools may not have formal schemas. Mirrors MCP Tool.inputSchema.
outputSchema
{
  type: 'object';
  properties?: Record<string,
  object>;
  required?: string[];
}
NoJSON Schema defining the structure of the tool's output.

Mirrors MCP Tool.outputSchema.
annotationsToolAnnotationsNoBehavioral hints about the tool. All properties are advisory.
_metaRecord<string, unknown>NoAdditional provider-specific metadata.

Mirrors the MCP _meta convention.

ToolAnnotations

Behavioral hints about a tool. All properties are advisory and not guaranteed to faithfully describe tool behavior.

Mirrors MCP ToolAnnotations from the Model Context Protocol specification.

FieldTypeRequiredDescription
titlestringNoAlternate human-readable title
readOnlyHintbooleanNoTool does not modify its environment (default: false)
destructiveHintbooleanNoTool may perform destructive updates (default: true)
idempotentHintbooleanNoRepeated calls with the same arguments have no additional effect (default: false)
openWorldHintbooleanNoTool may interact with external entities (default: true)

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 to a subagent session spawned by a tool.

Clients can subscribe to the subagent's session URI to stream its progress in real time, including inner tool calls and responses.

FieldTypeRequiredDescription
typeToolResultContentType.SubagentYes
resourceURIYesSubagent session URI (subscribable for full session 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 subagent sessions (AHP extensions).

ToolResultTextContent | ToolResultEmbeddedResourceContent | ToolResultResourceContent | ToolResultFileEditContent | ToolResultTerminalContent | ToolResultSubagentContent

CustomizationType

Discriminant for the kind of customization.

Top-level entries in {@link SessionState.customizations} and {@link AgentInfo.customizations} are always {@link CustomizationType.Plugin | Plugin} or {@link CustomizationType.Directory | Directory}; the remaining types appear only as children of those containers.

MemberValue
Plugin'plugin'
Directory'directory'
Agent'agent'
Skill'skill'
Prompt'prompt'
Rule'rule'
Hook'hook'
McpServer'mcpServer'

ChildCustomizationType

Customization types that appear as children of a {@link PluginCustomization} or {@link DirectoryCustomization}.

CustomizationType.Agent | CustomizationType.Skill | CustomizationType.Prompt | CustomizationType.Rule | CustomizationType.Hook | CustomizationType.McpServer

CustomizationLoadStatus

Discriminant values for {@link CustomizationLoadState}.

MemberValue
Loading'loading'
Loaded'loaded'
Degraded'degraded'
Error'error'

CustomizationLoadingState

Container is being loaded by the host.

FieldTypeDescription
kindCustomizationLoadStatus.Loading

CustomizationLoadedState

Container loaded successfully.

FieldTypeDescription
kindCustomizationLoadStatus.Loaded

CustomizationDegradedState

Container partially loaded but has warnings.

FieldTypeDescription
kindCustomizationLoadStatus.Degraded
messagestringHuman-readable description of the warning.

CustomizationErrorState

Container failed to load.

FieldTypeDescription
kindCustomizationLoadStatus.Error
messagestringHuman-readable error message.

CustomizationLoadState

Discriminated load state for a container customization ({@link PluginCustomization} or {@link DirectoryCustomization}).

CustomizationLoadingState | CustomizationLoadedState | CustomizationDegradedState | CustomizationErrorState

PluginCustomization

An Open Plugins plugin.

FieldTypeDescription
typeCustomizationType.Plugin

ClientPluginCustomization

A {@link PluginCustomization} as published by a client. Extends the server-facing shape with an opaque nonce so the host can detect when the client's view of a plugin has changed and re-parse only as needed.

Clients SHOULD include a nonce. Server-side fields like {@link ContainerCustomizationBase.children | children} and {@link ContainerCustomizationBase.load | load} are typically left absent on publication and populated by the host when the resolved plugin appears in {@link SessionState.customizations}.

FieldTypeRequiredDescription
noncestringNoOpaque version token used by the host to detect changes.

DirectoryCustomization

A directory the host watches for this session.

Presence in the customization list signals that the host may discover customizations from this directory. When writable is true, clients MAY persist new customizations into the directory using resourceWrite; the host will then surface the resulting child via the customization actions.

The directory may not yet exist on disk.

FieldTypeDescription
typeCustomizationType.Directory
contentsChildCustomizationTypeWhich child customization type this directory holds.
writablebooleanWhether clients may write into this directory.

AgentCustomization

A custom agent contributed by a plugin or directory.

Mirrors the Open Plugins agent format: a markdown file with YAML frontmatter, where the body is the agent's system prompt.

FieldTypeRequiredDescription
typeCustomizationType.AgentYes
descriptionstringNoShort description of what the agent specializes in and when to invoke it. Sourced from the agent file's frontmatter description.

SkillCustomization

A skill contributed by a plugin or directory.

Covers both Open Plugins skill formats — the skills/ directory layout (one subdirectory per skill, each with a SKILL.md) and the flatter commands/ directory of slash-command skills.

FieldTypeRequiredDescription
typeCustomizationType.SkillYes
descriptionstringNoShort description used for help text and auto-invocation matching. Sourced from the skill's frontmatter description.
disableModelInvocationbooleanNoWhen true, only the user can invoke this skill — the agent will not auto-invoke it. Sourced from the command skill's frontmatter disable-model-invocation flag.

PromptCustomization

A prompt contributed by a plugin or directory.

FieldTypeRequiredDescription
typeCustomizationType.PromptYes
descriptionstringNoShort description of what the prompt does.

RuleCustomization

A rule contributed by a plugin or directory.

Mirrors the Open Plugins rule format: a markdown file (e.g. .mdc) whose body is injected into context while the rule is active. This type also covers tool-specific "instruction" formats (e.g. VS Code Copilot's .github/instructions/*.md), which differ only in naming — they share the same semantics of description, optional always-on activation, and optional glob scoping.

FieldTypeRequiredDescription
typeCustomizationType.RuleYes
descriptionstringNoDescription of what the rule enforces.
alwaysApplybooleanNoWhen true, the rule is always active (subject to globs if any). When false or absent, the agent or user decides whether to apply the rule.
globsstring[]NoGlob patterns the rule applies to. When present, the rule is only active for matching files.

HookCustomization

A hook manifest contributed by a plugin or directory.

FieldTypeDescription
typeCustomizationType.Hook

McpServerCustomization

An MCP manifest contributed by a plugin or directory.

When the server is declared inline in the containing plugin manifest, uri points at the manifest file and {@link CustomizationBase.range | range} narrows it to the declaration's span.

FieldTypeDescription
typeCustomizationType.McpServer

ChildCustomization

Child customizations that live inside a {@link PluginCustomization} or {@link DirectoryCustomization}.

AgentCustomization | SkillCustomization | PromptCustomization | RuleCustomization | HookCustomization | McpServerCustomization

Customization

A top-level customization active in a session. Always a container ({@link PluginCustomization} or {@link DirectoryCustomization}); the remaining customization types appear inside the container's {@link ContainerCustomizationBase.children | children} array.

PluginCustomization | DirectoryCustomization

Actions

Mutate SessionState. Scoped to a session URI via the enclosing ActionEnvelope.channel.

JSON Schema: actions.schema.json

session/ready

Session backend initialized successfully.

FieldTypeDescription
typeActionType.SessionReady

session/creationFailed

Session backend failed to initialize.

FieldTypeDescription
typeActionType.SessionCreationFailed
errorErrorInfoError details

session/turnStarted

User sent a message; server starts agent processing.

FieldTypeRequiredDescription
typeActionType.SessionTurnStartedYes
turnIdstringYesTurn identifier
userMessageUserMessageYesUser's message
queuedMessageIdstringNoIf this turn was auto-started from a queued message, the ID of that message

session/delta

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

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

FieldTypeDescription
typeActionType.SessionDelta
turnIdstringTurn identifier
partIdstringIdentifier of the response part to append to
contentstringText chunk

session/responsePart

Structured content appended to the response.

FieldTypeDescription
typeActionType.SessionResponsePart
turnIdstringTurn identifier
partResponsePartResponse part (markdown or content ref)

session/toolCallStart

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

For client-provided tools, the server sets toolClientId to identify the owning client. That client is responsible for executing the tool once it reaches the running state and dispatching session/toolCallComplete.

FieldTypeRequiredDescription
typeActionType.SessionToolCallStartYes
toolNamestringYesInternal tool name (for debugging/logging)
displayNamestringYesHuman-readable tool name
toolClientIdstringNoIf this tool is provided by a client, the clientId of the owning client. Absent for server-side tools.

session/toolCallDelta

Streaming partial parameters for a tool call.

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

session/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 session/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.SessionToolCallReadyYes
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.

session/toolCallConfirmed (approved)

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

FieldTypeRequiredDescription
typeActionType.SessionToolCallConfirmedYes
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

session/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.SessionToolCallConfirmedYes
approvedfalseYesThe tool call was denied
reasonToolCallCancellationReason.Denied | ToolCallCancellationReason.SkippedYesWhy the tool was cancelled
userSuggestionUserMessageNoWhat the user suggested doing instead
reasonMessageStringOrMarkdownNoOptional explanation for the denial
selectedOptionIdstringNoID of the selected confirmation option, if the server provided options

SessionToolCallConfirmedAction

Client confirms or denies a pending tool call.

SessionToolCallApprovedAction | SessionToolCallDeniedAction

session/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.SessionToolCallCompleteYes
resultToolCallResultYesExecution result
requiresResultConfirmationbooleanNoIf true, the result requires client approval before finalizing

session/toolCallResultConfirmed

Client approves or denies a tool's result.

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

FieldTypeDescription
typeActionType.SessionToolCallResultConfirmed
approvedbooleanWhether the result was approved

session/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.SessionToolCallContentChanged
contentToolResultContent[]The current partial content for the running tool call

session/turnComplete

Turn finished — the assistant is idle.

FieldTypeDescription
typeActionType.SessionTurnComplete
turnIdstringTurn identifier

session/turnCancelled

Turn was aborted; server stops processing.

FieldTypeDescription
typeActionType.SessionTurnCancelled
turnIdstringTurn identifier

session/error

Error during turn processing.

FieldTypeDescription
typeActionType.SessionError
turnIdstringTurn identifier
errorErrorInfoError details

session/titleChanged

Session title updated. Fired by the server when the title is auto-generated from conversation, or dispatched by a client to rename a session.

FieldTypeDescription
typeActionType.SessionTitleChanged
titlestringNew title

session/usage

Token usage report for a turn.

FieldTypeDescription
typeActionType.SessionUsage
turnIdstringTurn identifier
usageUsageInfoToken usage data

session/reasoning

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

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

FieldTypeDescription
typeActionType.SessionReasoning
turnIdstringTurn identifier
partIdstringIdentifier of the reasoning response part to append to
contentstringReasoning text chunk

session/modelChanged

Model changed for this session.

FieldTypeDescription
typeActionType.SessionModelChanged
modelModelSelectionNew model selection

session/agentChanged

Custom agent selection changed for this session.

Omitting agent (or setting it to undefined) clears the selection and resets the session to no selected custom agent (provider default behavior).

When a turn is currently active, the server MUST defer the change until the active turn completes, then apply it for the next turn (same rule as {@link SessionModelChangedAction | session/modelChanged}).

FieldTypeRequiredDescription
typeActionType.SessionAgentChangedYes
agentAgentSelectionNoNew agent selection, or undefined to clear the selection and reset the session to no selected custom agent.

session/isReadChanged

The read state of the session changed.

Dispatched by a client to mark a session as read (e.g. after viewing it) or unread (e.g. after new activity since the client last looked at it).

FieldTypeDescription
typeActionType.SessionIsReadChanged
isReadbooleanWhether the session has been read

session/isArchivedChanged

The archived state of the session changed.

Dispatched by a client to archive a session (e.g. the task is complete) or to unarchive it.

FieldTypeDescription
typeActionType.SessionIsArchivedChanged
isArchivedbooleanWhether the session is archived

session/activityChanged

The activity description of the session changed.

Dispatched by the server to indicate what the session is currently doing (e.g. running a tool, thinking). Clear activity by setting it to undefined.

FieldTypeDescription
typeActionType.SessionActivityChanged
activitystring | undefinedHuman-readable description of current activity, or undefined to clear

session/changesetsChanged

The {@link ChangesetSummary | catalogue of changesets} the agent host advertises for this session changed. Replaces state.summary.changesets entirely (full-replacement semantics) — set to undefined to clear the catalogue.

Producers dispatch this whenever entries are added, removed, or have their aggregate counts (additions / deletions / files) refreshed. The fan-out happens through this action so observers see catalogue mutations in the same {@link ChangesetAction | per-changeset} action stream they already follow for file-level updates.

FieldTypeDescription
typeActionType.SessionChangesetsChanged
changesetsChangesetSummary[] | undefinedNew catalogue, or undefined to clear it

session/serverToolsChanged

Server tools for this session have changed.

Full-replacement semantics: the tools array replaces the previous serverTools entirely.

FieldTypeDescription
typeActionType.SessionServerToolsChanged
toolsToolDefinition[]Updated server tools list (full replacement)

session/activeClientChanged

The active client for this session has changed.

A client dispatches this action with its own SessionActiveClient to claim the active role, or with null to release it. The server SHOULD reject if another client is already active. The server SHOULD automatically dispatch this action with activeClient: null when the active client disconnects.

FieldTypeDescription
typeActionType.SessionActiveClientChanged
activeClientSessionActiveClient | nullThe new active client, or null to unset

session/activeClientToolsChanged

The active client's tool list has changed.

Full-replacement semantics: the tools array replaces the active client's previous tools entirely. The server SHOULD reject if the dispatching client is not the current active client.

FieldTypeDescription
typeActionType.SessionActiveClientToolsChanged
toolsToolDefinition[]Updated client tools list (full replacement)

session/customizationsChanged

The session's customizations have changed.

Full-replacement semantics: the customizations array replaces the previous customizations entirely.

FieldTypeDescription
typeActionType.SessionCustomizationsChanged
customizationsCustomization[]Updated customization list (full replacement).

session/customizationToggled

A client toggled a container customization on or off.

Targets a top-level container (plugin or directory) by id. Only containers have an enabled flag; children are always active when their container is enabled. Is a no-op when no matching container is found.

FieldTypeDescription
typeActionType.SessionCustomizationToggled
idstringThe id of the container to toggle.
enabledbooleanWhether to enable or disable the container.

session/customizationUpdated

Upserts a top-level customization (plugin or directory).

The reducer locates the existing entry by customization.id:

  • If found, the entry is replaced entirely with customization, including its children array. To preserve existing children, the host must include them on the payload.
  • If not found, the entry is appended.
FieldTypeDescription
typeActionType.SessionCustomizationUpdated
customizationCustomizationThe customization to upsert (matched by customization.id).

session/customizationRemoved

Removes a customization by id.

Searches every container and its children for the entry. If the entry is a container, its children are removed with it. Is a no-op when no matching id is found.

FieldTypeDescription
typeActionType.SessionCustomizationRemoved
idstringThe id of the customization to remove.

session/configChanged

Client changed a mutable config value mid-session.

Only properties with sessionMutable: true in the config schema may be changed. The server validates and broadcasts the action; the reducer merges the new values into state.config.values.

FieldTypeRequiredDescription
typeActionType.SessionConfigChangedYes
configRecord<string, unknown>YesUpdated config values
replacebooleanNoWhen true, replaces all config values instead of merging

session/metaChanged

The session's _meta side-channel changed. Replaces state._meta entirely (full-replacement semantics). Producers SHOULD merge any keys they wish to preserve into the new value before dispatching.

FieldTypeDescription
typeActionType.SessionMetaChanged
_metaRecord<string, unknown> | undefinedNew _meta payload, or undefined to clear it

session/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 session status returns to idle.

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

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

session/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 session is idle when a queued message is set, the server SHOULD immediately consume it and start a new turn.

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

session/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.SessionPendingMessageRemoved
kindPendingMessageKindWhether this is a steering or queued message
idstringIdentifier of the pending message to remove

session/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.SessionQueuedMessagesReordered
orderstring[]Queued message IDs in the desired order

session/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.SessionInputRequested
requestSessionInputRequestInput request to create or replace

session/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.SessionInputAnswerChangedYes
requestIdstringYesInput request identifier
questionIdstringYesQuestion identifier within the input request
answerSessionInputAnswerNoUpdated answer, or undefined to clear an answer draft

session/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.SessionInputCompletedYes
requestIdstringYesInput request identifier
responseSessionInputResponseKindYesCompletion outcome
answersRecord<string, SessionInputAnswer>NoOptional final answer replacement, keyed by question ID

Commands

JSON Schema: commands.schema.json

createSession

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeRequiredDescription
channelURIYesSession URI (client-chosen, e.g. ahp-session:/&lt;uuid&gt;)
providerstringNoAgent provider ID
modelModelSelectionNoModel selection (ID and optional model-specific configuration)
agentAgentSelectionNoInitial custom agent selection for the new session.

Omit to start the session with no custom agent selected (provider default).
workingDirectoryURINoWorking directory for the session
forkSessionForkSourceNoFork from an existing session. The new session is populated with content from the source session up to and including the specified turn's response.
configRecord<string, unknown>NoAgent-specific configuration values collected via resolveSessionConfig. Keys and values correspond to the schema returned by the server.
activeClientSessionActiveClientNoEagerly claim the active client role for the new session.

When provided, the server initializes the session with this client as the active client, equivalent to dispatching a session/activeClientChanged action immediately after creation. The clientId MUST match the clientId the creating client supplied in initialize.

Result: null on success.


disposeSession

Disposes a session and cleans up server-side resources.

The server broadcasts a root/sessionRemoved notification to all clients.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

No parameters.

Result: null on success.


fetchTurns

Fetches historical turns for a session. Used for lazy loading of conversation history.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeRequiredDescription
channelURIYesSession URI
beforestringNoTurn ID to fetch before (exclusive). Omit to fetch from the most recent turn.
limitnumberNoMaximum number of turns to return. Server MAY impose its own upper bound.

Result:

FieldTypeDescription
turnsTurn[]The requested turns, ordered oldest-first
hasMorebooleanWhether more turns exist before the returned range

Example:

jsonc
// Client → Server (fetch the 20 most recent turns)
{ "jsonrpc": "2.0", "id": 8, "method": "fetchTurns",
  "params": { "channel": "ahp-session:/<uuid>", "limit": 20 } }

// Server → Client
{ "jsonrpc": "2.0", "id": 8, "result": {
  "turns": [ { "id": "t1", ... }, { "id": "t2", ... } ],
  "hasMore": true
}}

// Client → Server (fetch 20 turns before t1)
{ "jsonrpc": "2.0", "id": 9, "method": "fetchTurns",
  "params": { "channel": "ahp-session:/<uuid>", "before": "t1", "limit": 20 } }

completions

Requests completion items for a partially-typed input (e.g. a user message the user is currently composing). Used to power @-mention pickers, file/symbol references, and similar inline-completion experiences.

Servers SHOULD treat this command as best-effort and return promptly. The client SHOULD debounce calls to avoid flooding the server with requests on every keystroke.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeDescription
kindCompletionItemKindWhat kind of completion is being requested.
channelURIThe session URI the completion is being requested for.
textstringThe complete text of the input being completed (e.g. the full user message text typed so far).
offsetnumberThe character offset within text at which the completion is requested, measured in UTF-16 code units. MUST satisfy 0 &lt;= offset &lt;= text.length.

Result:

FieldTypeDescription
itemsCompletionItem[]The completion items, in the order the server suggests displaying them.

Example:

jsonc
// User has typed "look at

---

Released under the MIT License.