pub struct ChatState {Show 16 fields
pub resource: Uri,
pub title: String,
pub status: u32,
pub activity: Option<String>,
pub modified_at: String,
pub origin: Option<ChatOrigin>,
pub interactivity: Option<ChatInteractivity>,
pub working_directory: Option<Uri>,
pub turns: Vec<Turn>,
pub turns_next_cursor: Option<String>,
pub active_turn: Option<ActiveTurn>,
pub steering_message: Option<PendingMessage>,
pub queued_messages: Option<Vec<PendingMessage>>,
pub input_requests: Option<Vec<ChatInputRequest>>,
pub draft: Option<Message>,
pub meta: Option<JsonObject>,
}Expand description
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}. ChatState
denormalizes 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.
Fields§
§resource: UriChat URI
title: StringChat title
status: u32Current chat status (reuses SessionStatus shape)
activity: Option<String>Human-readable description of what the chat is currently doing
modified_at: StringLast modification timestamp (ISO 8601, e.g. "2025-03-10T18:42:03.123Z")
origin: Option<ChatOrigin>How this chat came into existence
interactivity: Option<ChatInteractivity>How 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.
working_directory: Option<Uri>Optional per-chat working directory.
If absent, the chat inherits {@link SessionState.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.
turns: Vec<Turn>Completed turns
turns_next_cursor: Option<String>Cursor for loading older completed turns into this chat state.
Presence means turns is a tail window and more historical turns are
available. Pass this opaque cursor to fetchTurns; the host MUST insert
the loaded turns into state and update or clear this cursor before
responding. Absence means the state contains all retained turns.
active_turn: Option<ActiveTurn>Currently in-progress turn
steering_message: Option<PendingMessage>Message to inject into the current turn at a convenient point
queued_messages: Option<Vec<PendingMessage>>Messages to send automatically as new turns after the current turn finishes
input_requests: Option<Vec<ChatInputRequest>>Requests for user input that are currently blocking or informing chat progress
draft: Option<Message>The user’s in-progress draft input for this chat — the message they are composing but have not sent yet, including its {@link Message.model | model} / {@link Message.agent | agent} selection and attachments.
Clients MAY periodically sync their local input state into this field so
a draft survives reloads and is visible to other clients viewing the same
chat. Eager syncing is not required — clients SHOULD debounce and MAY
sync only at convenient points. When presenting input UI for an existing
chat, clients SHOULD use any draft to initialize their input state.
Cleared (set to undefined) once the message is sent.
meta: Option<JsonObject>Additional provider-specific metadata for this chat.