pub struct SessionFile {
pub schema_version: u32,
pub goal: String,
pub model: String,
pub provider: String,
pub tool_registry_hash: String,
pub steps_consumed: usize,
pub transcript: Vec<Message>,
}Expand description
A saved session that can be resumed.
Fields§
§schema_version: u32§goal: StringThe original goal string.
model: StringModel name (e.g. “gpt-4o-mini”).
provider: StringProvider identifier (e.g. “openai”).
tool_registry_hash: StringBLAKE3 hash of the tool registry specs at the time of save. Used to detect tool changes that would make the session invalid.
steps_consumed: usizeNumber of steps already consumed.
transcript: Vec<Message>The full transcript so far (system prompt + user goal + all exchanges).
Implementations§
Source§impl SessionFile
impl SessionFile
Sourcepub fn new(
goal: String,
model: String,
provider: String,
tool_specs: &[ToolSpec],
steps_consumed: usize,
transcript: Vec<Message>,
) -> Self
pub fn new( goal: String, model: String, provider: String, tool_specs: &[ToolSpec], steps_consumed: usize, transcript: Vec<Message>, ) -> Self
Create a new session file from the agent’s current state.
Sourcepub fn validate_tool_registry(
&self,
current_specs: &[ToolSpec],
) -> Result<(), String>
pub fn validate_tool_registry( &self, current_specs: &[ToolSpec], ) -> Result<(), String>
Validate that the tool registry hash matches the current tool specs.
Returns Ok(()) if they match, or an error describing the mismatch.
Sourcepub fn into_transcript(self) -> Vec<Message>
pub fn into_transcript(self) -> Vec<Message>
Consume self and return the transcript.
Trait Implementations§
Source§impl Clone for SessionFile
impl Clone for SessionFile
Source§fn clone(&self) -> SessionFile
fn clone(&self) -> SessionFile
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 SessionFile
impl Debug for SessionFile
Source§impl<'de> Deserialize<'de> for SessionFile
impl<'de> Deserialize<'de> for SessionFile
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 SessionFile
impl RefUnwindSafe for SessionFile
impl Send for SessionFile
impl Sync for SessionFile
impl Unpin for SessionFile
impl UnsafeUnpin for SessionFile
impl UnwindSafe for SessionFile
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