pub trait SessionManager: Send + Sync {
// Required methods
fn list(&self) -> BoxFuture<'_, Result<Vec<SessionMetadata>, AgentError>>;
fn resume(
&self,
session_id: &str,
) -> BoxFuture<'_, Result<Session, AgentError>>;
fn save(&self, session: &Session) -> BoxFuture<'_, Result<(), AgentError>>;
fn delete(&self, session_id: &str) -> BoxFuture<'_, Result<(), AgentError>>;
fn fork(
&self,
session_id: &str,
new_name: Option<String>,
) -> BoxFuture<'_, Result<SessionMetadata, AgentError>>;
fn rewind(
&self,
session_id: &str,
turn_index: u32,
) -> BoxFuture<'_, Result<Session, AgentError>>;
fn tag(
&self,
session_id: &str,
tags: Vec<String>,
) -> BoxFuture<'_, Result<(), AgentError>>;
fn rename(
&self,
session_id: &str,
new_name: String,
) -> BoxFuture<'_, Result<(), AgentError>>;
}Expand description
Manages session persistence and lifecycle operations.
All operations are async and return AgentError on failure.
Required Methods§
Sourcefn list(&self) -> BoxFuture<'_, Result<Vec<SessionMetadata>, AgentError>>
fn list(&self) -> BoxFuture<'_, Result<Vec<SessionMetadata>, AgentError>>
List all sessions, ordered by most-recently updated first.
Sourcefn resume(&self, session_id: &str) -> BoxFuture<'_, Result<Session, AgentError>>
fn resume(&self, session_id: &str) -> BoxFuture<'_, Result<Session, AgentError>>
Load a session by ID.
Sourcefn save(&self, session: &Session) -> BoxFuture<'_, Result<(), AgentError>>
fn save(&self, session: &Session) -> BoxFuture<'_, Result<(), AgentError>>
Save (create or update) a session.
Sourcefn delete(&self, session_id: &str) -> BoxFuture<'_, Result<(), AgentError>>
fn delete(&self, session_id: &str) -> BoxFuture<'_, Result<(), AgentError>>
Delete a session and all associated data.
Sourcefn fork(
&self,
session_id: &str,
new_name: Option<String>,
) -> BoxFuture<'_, Result<SessionMetadata, AgentError>>
fn fork( &self, session_id: &str, new_name: Option<String>, ) -> BoxFuture<'_, Result<SessionMetadata, AgentError>>
Fork a session — create a copy with a new ID.
The forked session shares the same history up to the fork point but accumulates diverging state independently thereafter.
Sourcefn rewind(
&self,
session_id: &str,
turn_index: u32,
) -> BoxFuture<'_, Result<Session, AgentError>>
fn rewind( &self, session_id: &str, turn_index: u32, ) -> BoxFuture<'_, Result<Session, AgentError>>
Rewind a session to a previous turn.
turn_index is zero-based. Messages beyond turn_index are discarded.