pub struct PersistedSessionState {Show 19 fields
pub session_id: String,
pub policy: SessionPolicy,
pub session_graph: SessionGraph,
pub turn_index: usize,
pub token_usage: TokenUsage,
pub last_prompt_usage: Option<PromptUsage>,
pub mode_turn_options: ModeTurnOptions,
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
Serializable persistence snapshot used by stores, resume, and child session snapshots.
Fields§
§session_id: String§policy: SessionPolicy§session_graph: SessionGraph§turn_index: usize§token_usage: TokenUsage§last_prompt_usage: Option<PromptUsage>§mode_turn_options: ModeTurnOptions§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 PersistedSessionState
impl PersistedSessionState
pub fn from_state(state: SessionStateEnvelope) -> Self
pub fn export_state(&self) -> SessionStateEnvelope
pub fn apply_exported_state(&mut self, state: &SessionStateEnvelope)
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], tool_calls: &[ToolCallRecord], )
pub fn replace_active_tool_calls(&mut self, tool_calls: &[ToolCallRecord])
pub fn append_active_read_delta( &mut self, messages: &[Message], tool_calls: &[ToolCallRecord], )
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)
Trait Implementations§
Source§impl Clone for PersistedSessionState
impl Clone for PersistedSessionState
Source§fn clone(&self) -> PersistedSessionState
fn clone(&self) -> PersistedSessionState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PersistedSessionState
impl Debug for PersistedSessionState
Source§impl Default for PersistedSessionState
impl Default for PersistedSessionState
Source§impl<'de> Deserialize<'de> for PersistedSessionState
impl<'de> Deserialize<'de> for PersistedSessionState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PersistedSessionState
impl !RefUnwindSafe for PersistedSessionState
impl Send for PersistedSessionState
impl Sync for PersistedSessionState
impl Unpin for PersistedSessionState
impl UnsafeUnpin for PersistedSessionState
impl !UnwindSafe for PersistedSessionState
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
Mutably borrows from an owned value. Read more