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>,
pub preset: Option<String>,
}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).
preset: Option<String>Resolved provider preset id (e.g. “deepseek”) at session creation
time. None when the user did not configure a preset — kept
optional for back-compat with pre-preset-config session files.
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
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 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>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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