pub struct AppStateSnapshot {
pub session_id: String,
pub message_count: usize,
pub last_tool_results: Vec<ToolResultEntry>,
pub snapshot_timestamp_ms: u64,
pub completed: bool,
pub project_dir: String,
pub cost_usd: f64,
}Expand description
Essential application state that is persisted for crash recovery.
Fields§
§session_id: StringThe active session ID.
message_count: usizeNumber of messages exchanged so far.
last_tool_results: Vec<ToolResultEntry>Last tool results (tool name -> truncated output), limited to most recent.
snapshot_timestamp_ms: u64Timestamp (ms since epoch) when the snapshot was taken.
completed: boolWhether the session ended cleanly.
project_dir: StringProject directory associated with the session.
cost_usd: f64Cumulative cost in USD.
Implementations§
Source§impl AppStateSnapshot
impl AppStateSnapshot
Sourcepub fn new(
session_id: impl Into<String>,
project_dir: impl Into<String>,
) -> Self
pub fn new( session_id: impl Into<String>, project_dir: impl Into<String>, ) -> Self
Create a new snapshot with the given session ID.
Sourcepub fn record_tool_result(&mut self, entry: ToolResultEntry, max_entries: usize)
pub fn record_tool_result(&mut self, entry: ToolResultEntry, max_entries: usize)
Record a tool result. Keeps at most max_entries most recent results.
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark the session as completed (clean exit).
Trait Implementations§
Source§impl Clone for AppStateSnapshot
impl Clone for AppStateSnapshot
Source§fn clone(&self) -> AppStateSnapshot
fn clone(&self) -> AppStateSnapshot
Returns a duplicate of the value. Read more
1.0.0 · 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 AppStateSnapshot
impl Debug for AppStateSnapshot
Source§impl<'de> Deserialize<'de> for AppStateSnapshot
impl<'de> Deserialize<'de> for AppStateSnapshot
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
Source§impl PartialEq for AppStateSnapshot
impl PartialEq for AppStateSnapshot
Source§impl Serialize for AppStateSnapshot
impl Serialize for AppStateSnapshot
impl StructuralPartialEq for AppStateSnapshot
Auto Trait Implementations§
impl Freeze for AppStateSnapshot
impl RefUnwindSafe for AppStateSnapshot
impl Send for AppStateSnapshot
impl Sync for AppStateSnapshot
impl Unpin for AppStateSnapshot
impl UnsafeUnpin for AppStateSnapshot
impl UnwindSafe for AppStateSnapshot
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