pub struct RuntimeSessionState {Show 21 fields
pub session_id: String,
pub policy: SessionPolicy,
pub agent_frames: Vec<AgentFrameRecord>,
pub current_agent_frame_id: AgentFrameId,
pub session_graph: SessionGraph,
pub turn_index: usize,
pub token_usage: TokenUsage,
pub last_prompt_usage: Option<PromptUsage>,
pub protocol_turn_options: ProtocolTurnOptions,
pub tool_state_ref: Option<BlobRef>,
pub tool_state_generation: Option<u64>,
pub tool_state_snapshot: Option<ToolState>,
pub plugin_snapshot_ref: Option<BlobRef>,
pub plugin_snapshot_revision: Option<u64>,
pub plugin_snapshot: Option<PluginSessionSnapshot>,
pub execution_state_ref: Option<BlobRef>,
pub execution_state_snapshot: Option<Vec<u8>>,
pub token_ledger: Vec<TokenLedgerEntry>,
pub checkpoint_ref: Option<BlobRef>,
pub head_revision: Option<u64>,
pub graph_replace_required: bool,
}Expand description
The runtime’s view of a session: the persistable snapshot fields
plus scratch fields the runtime tracks but never persists
(head-revision CAS guard, pending dirty-write buffers, replace-graph
flag). Public serialization goes through RuntimeSessionState::to_snapshot,
which drops runtime-only fields by construction.
Fields§
§session_id: String§policy: SessionPolicy§agent_frames: Vec<AgentFrameRecord>§current_agent_frame_id: AgentFrameId§session_graph: SessionGraph§turn_index: usize§token_usage: TokenUsage§last_prompt_usage: Option<PromptUsage>§protocol_turn_options: ProtocolTurnOptions§tool_state_ref: Option<BlobRef>§tool_state_generation: Option<u64>§tool_state_snapshot: Option<ToolState>§plugin_snapshot_ref: Option<BlobRef>§plugin_snapshot_revision: Option<u64>§plugin_snapshot: Option<PluginSessionSnapshot>§execution_state_ref: Option<BlobRef>§execution_state_snapshot: Option<Vec<u8>>§token_ledger: Vec<TokenLedgerEntry>Cost-accounting ledger. Every LLM call (parent turns, subagent
children, compaction, observers, background helpers) contributes an
entry keyed by (source, model). Separate from token_usage
which tracks context-window accounting only.
checkpoint_ref: Option<BlobRef>§head_revision: Option<u64>Store head revision observed by the runtime. Commits use it for
optimistic concurrency; None means the runtime is creating the
first persisted head.
graph_replace_required: boolSignals that the next commit must write the full graph (a
destructive rewrite happened, e.g. heal_orphaned_leaf). Cleared
after the next commit.
Implementations§
Source§impl RuntimeSessionState
impl RuntimeSessionState
pub fn from_snapshot(snapshot: SessionSnapshot) -> Self
pub fn to_snapshot(&self) -> SessionSnapshot
pub fn apply_snapshot(&mut self, snapshot: &SessionSnapshot)
pub fn stamp_runtime_state( &mut self, tool_state: Option<&ToolState>, plugin_snapshot: Option<&PluginSessionSnapshot>, )
pub fn usage_report(&self) -> SessionUsageReport
pub fn replace_active_read_state(&mut self, messages: &[Message])
pub fn append_active_read_delta(&mut self, messages: &[Message])
pub fn append_active_conversation_messages(&mut self, messages: &[Message])
pub fn read_view(&self) -> SessionReadView
pub fn session_graph(&self) -> &SessionGraph
pub fn policy(&self) -> &SessionPolicy
pub fn turn_state(&self) -> PersistedTurnState
pub fn token_ledger(&self) -> &[TokenLedgerEntry]
pub fn apply_persisted_commit_result(&mut self, result: RuntimeCommitResult)
pub fn discard_runtime_snapshots(&mut self)
pub fn set_execution_state_snapshot( &mut self, execution_state_snapshot: Option<Vec<u8>>, )
pub fn execution_state_snapshot(&self) -> Option<&[u8]>
pub fn refresh_plugin_snapshots(&mut self, plugins: &PluginSession)
Source§impl RuntimeSessionState
impl RuntimeSessionState
pub fn current_agent_frame(&self) -> Option<&AgentFrameRecord>
pub fn current_agent_frame_mut(&mut self) -> Option<&mut AgentFrameRecord>
pub fn effective_policy(&self) -> &SessionPolicy
pub fn effective_protocol_turn_options(&self) -> &ProtocolTurnOptions
pub fn ensure_agent_frame_initialized(&mut self)
pub fn reset_initial_agent_frame( &mut self, assignment: AgentFrameAssignment, protocol_turn_options: ProtocolTurnOptions, )
pub fn append_agent_frame(&mut self, frame: AgentFrameRecord)
Trait Implementations§
Source§impl Clone for RuntimeSessionState
impl Clone for RuntimeSessionState
Source§fn clone(&self) -> RuntimeSessionState
fn clone(&self) -> RuntimeSessionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more