pub struct SessionState {Show 19 fields
pub version: u64,
pub generation: u64,
pub last_seq: u64,
pub active_run: Option<RunId>,
pub cwd_identity: Option<CwdIdentity>,
pub context_tokens: Option<u64>,
pub estimated_cost_usd: Option<f64>,
pub run_agent: Option<AgentId>,
pub creation_agent: Option<Box<AgentSnapshot>>,
pub run_snapshot: Option<Box<AgentSnapshot>>,
pub run_selected_suffix: Option<Vec<FrozenModelBinding>>,
pub model_selection: SessionModelState,
pub goal: Option<GoalState>,
pub transcript: Vec<TranscriptItem>,
pub pending_inputs: VecDeque<PendingInput>,
pub voided_inputs: Vec<String>,
pub thinking_durations: HashMap<(u64, u64), Duration>,
pub tools: HashMap<ToolCallId, ToolCallState>,
pub approvals: Vec<ApprovalState>,
/* private fields */
}Expand description
Per-session projection of persisted events and live output.
Fields§
§version: u64Changes whenever the visible projection mutates, for UI cache invalidation.
generation: u64§last_seq: u64§active_run: Option<RunId>§cwd_identity: Option<CwdIdentity>§context_tokens: Option<u64>Total context occupied at the end of the latest committed turn
(input_tokens + output_tokens); None when the turn reported no
usage, so the bottom bar hides its context segment.
estimated_cost_usd: Option<f64>Latest authoritative session usage cost fetched from the engine.
None covers both not-yet-fetched and unpriced usage; both hide the
bottom-bar segment.
run_agent: Option<AgentId>Frozen producing agent of the latest accepted RunStarted.
creation_agent: Option<Box<AgentSnapshot>>The complete frozen creation snapshot from SessionCreated,
including the exact frozen fallback chain. Delegated draft
projections derive only from this, never from live descriptors.
run_snapshot: Option<Box<AgentSnapshot>>The complete frozen snapshot of the latest accepted RunStarted.
run_selected_suffix: Option<Vec<FrozenModelBinding>>The authoritative exact suffix from the latest accepted RunStarted:
after any run-selection variant override, this vector — never a
reconstruction from the agent fallback chain — is what attempts and
delegated pickers use.
model_selection: SessionModelState§goal: Option<GoalState>§transcript: Vec<TranscriptItem>§pending_inputs: VecDeque<PendingInput>The engine’s pending-input lane for this session, reduced purely from admission/promotion/recall events: steered messages the model has not seen yet. Source of the queue strip between the conversation pane and the composer.
voided_inputs: Vec<String>Pending inputs the engine voided at run end (no per-entry events), parked here until the UI restores their text into the composer — user text is never silently lost. Drained by the UI on sight.
thinking_durations: HashMap<(u64, u64), Duration>Elapsed thinking time per sealed thinking part, keyed by
(item_id, part_id) and derived from durable event timestamps.
tools: HashMap<ToolCallId, ToolCallState>§approvals: Vec<ApprovalState>Implementations§
Source§impl SessionState
impl SessionState
pub fn is_open_assistant_part(&self, item_id: u64, part_id: u64) -> bool
pub fn is_open_thinking(&self, item_id: u64, part_id: u64) -> bool
Sourcepub fn has_open_thinking(&self) -> bool
pub fn has_open_thinking(&self) -> bool
Whether any assistant part is still streaming thinking content.
Sourcepub fn has_running_tool(&self) -> bool
pub fn has_running_tool(&self) -> bool
Whether any tool call in this session is still running.
Sourcepub fn has_pending_producers(&self) -> bool
pub fn has_pending_producers(&self) -> bool
Whether any producer message is waiting for a model run to claim it.
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionState
impl Debug for SessionState
Source§impl Default for SessionState
impl Default for SessionState
Source§fn default() -> SessionState
fn default() -> SessionState
Auto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnsafeUnpin for SessionState
impl UnwindSafe for SessionState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more