pub trait AgentSessionStore {
// Required methods
fn sessions(&self) -> Result<Vec<AgentSession>, ConfigError>;
fn state_file_path(&self) -> Result<Option<PathBuf>, ConfigError>;
fn upsert(&self, session: &AgentSession) -> Result<(), ConfigError>;
fn set_state(
&self,
id: &AgentSessionId,
state: AgentSessionState,
) -> Result<(), ConfigError>;
fn set_owner_process_id(
&self,
id: &AgentSessionId,
process_id: AgentProcessId,
process_start_token: Option<AgentProcessStartToken>,
wrapper_process_id: Option<AgentProcessId>,
) -> Result<(), ConfigError>;
fn capture_native_id(
&self,
id: &AgentSessionId,
provider: AgentTool,
process_id: AgentProcessId,
parent_process_id: Option<AgentProcessId>,
native_id: NativeSessionId,
) -> Result<(), ConfigError>;
}Expand description
Persists agent-session identity and history across TUI lifetimes.
Required Methods§
Sourcefn sessions(&self) -> Result<Vec<AgentSession>, ConfigError>
fn sessions(&self) -> Result<Vec<AgentSession>, ConfigError>
Loads sessions in history order, oldest first.
§Errors
Returns a ConfigError when the state file cannot be read or parsed.
Sourcefn state_file_path(&self) -> Result<Option<PathBuf>, ConfigError>
fn state_file_path(&self) -> Result<Option<PathBuf>, ConfigError>
Returns the durable state-file location inherited by provider hooks.
§Errors
Returns a ConfigError when the state location cannot be resolved.
Sourcefn upsert(&self, session: &AgentSession) -> Result<(), ConfigError>
fn upsert(&self, session: &AgentSession) -> Result<(), ConfigError>
Inserts or replaces a session and makes it the newest history entry.
§Errors
Returns a ConfigError when the state file cannot be updated.
Sourcefn set_state(
&self,
id: &AgentSessionId,
state: AgentSessionState,
) -> Result<(), ConfigError>
fn set_state( &self, id: &AgentSessionId, state: AgentSessionState, ) -> Result<(), ConfigError>
Changes a session’s open/closed state and moves it to the end of history.
§Errors
Returns a ConfigError when the state file cannot be updated.
Sourcefn set_owner_process_id(
&self,
id: &AgentSessionId,
process_id: AgentProcessId,
process_start_token: Option<AgentProcessStartToken>,
wrapper_process_id: Option<AgentProcessId>,
) -> Result<(), ConfigError>
fn set_owner_process_id( &self, id: &AgentSessionId, process_id: AgentProcessId, process_start_token: Option<AgentProcessStartToken>, wrapper_process_id: Option<AgentProcessId>, ) -> Result<(), ConfigError>
Binds a session to the process currently launched on its behalf.
§Errors
Returns a ConfigError when the session cannot be updated.
Sourcefn capture_native_id(
&self,
id: &AgentSessionId,
provider: AgentTool,
process_id: AgentProcessId,
parent_process_id: Option<AgentProcessId>,
native_id: NativeSessionId,
) -> Result<(), ConfigError>
fn capture_native_id( &self, id: &AgentSessionId, provider: AgentTool, process_id: AgentProcessId, parent_process_id: Option<AgentProcessId>, native_id: NativeSessionId, ) -> Result<(), ConfigError>
Records the latest identity reported by the session’s owning provider. Same-provider conversation changes replace the previous identity.
§Errors
Returns a ConfigError when the state file cannot be updated or the
lifecycle event comes from a different provider.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".