Skip to main content

SessionTurnState

Struct SessionTurnState 

Source
pub struct SessionTurnState {
    pub tool_calls: HashMap<String, ToolCall>,
    pub task_tool_use_ids: HashMap<String, String>,
    pub model_id: String,
    pub requested_model_id: Option<String>,
    pub resolved_runtime_model_id: Option<String>,
    pub mode: Option<PermissionMode>,
    pub supported_mode_ids: Vec<PermissionMode>,
    pub runtime_unavailable_mode_ids: Vec<PermissionMode>,
    pub mode_state: Option<ModeState>,
    pub agents_emitted_this_turn: bool,
    pub last_assistant_error: Option<String>,
}
Expand description

Per-session SDK turn state - model-resolution cache, mode capability state, MCP per-server cooldowns, and the auth/error flags that survive across messages. Held authoritatively by forge-workspace; a view projects from there.

Fields§

§tool_calls: HashMap<String, ToolCall>

Live tool-call store keyed by tool_use_id for cross-message tool_use ↔ tool_result pairing.

§task_tool_use_ids: HashMap<String, String>

Maps task-tool task_id → tool_use_id so TaskProgress / TaskNotification messages can resolve back to the originating tool call for ToolCallUpdate emission.

§model_id: String

Raw model id from the CLI’s session-init payload.

§requested_model_id: Option<String>

Model id explicitly requested via /model.

§resolved_runtime_model_id: Option<String>

Resolved model id after runtime fallback from the requested id.

§mode: Option<PermissionMode>

Active permission mode (typed enum, not the wire string). Populated from System(init).permissionMode and the SetMode command path.

§supported_mode_ids: Vec<PermissionMode>

Permission modes the runtime currently supports.

§runtime_unavailable_mode_ids: Vec<PermissionMode>

Permission modes recognised but currently unavailable.

§mode_state: Option<ModeState>

Current mode resolution alongside the human-readable label.

§agents_emitted_this_turn: bool

Whether the agents catalogue has been emitted for this turn. The first system/init of a turn carries it; subsequent re-fires within the same turn are no-ops.

§last_assistant_error: Option<String>

Last assistant error subtype seen on the wire - survives across messages so a subsequent Result can classify the turn correctly.

Trait Implementations§

Source§

impl Debug for SessionTurnState

Source§

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

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

impl Default for SessionTurnState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more