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.