pub struct ChatState {Show 15 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_directories: Option<Vec<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 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_directories: Option<Vec<Uri>>The subset of the session’s
{@link SessionState.workingDirectories | workingDirectories} that this
chat’s agent has tool access to. Every entry MUST be present in the owning
session’s workingDirectories; servers MUST reject a
chat/workingDirectorySet action that violates this constraint.
When absent, the chat inherits the full session set. When present but empty (not recommended), the chat has no working-directory tool access at all.
Dispatch chat/workingDirectorySet / chat/workingDirectoryRemoved to
update the subset on a running chat.
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
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.