Skip to main content

ChatState

Struct ChatState 

Source
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: Uri

Chat URI

§title: String

Chat title

§status: u32

Current chat status (reuses SessionStatus shape)

§activity: Option<String>

Human-readable description of what the chat is currently doing

§modified_at: String

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

Trait Implementations§

Source§

impl Clone for ChatState

Source§

fn clone(&self) -> ChatState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChatState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ChatState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ChatState

Source§

fn eq(&self, other: &ChatState) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ChatState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ChatState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.