pub struct SessionStore { /* private fields */ }Implementations§
Source§impl SessionStore
impl SessionStore
pub fn open(path: &Path) -> Result<Self>
pub fn open_in_memory() -> Result<Self>
pub fn create_session(&mut self, new: NewSession) -> Result<Session>
pub fn get_session(&self, id: &str) -> Result<Option<Session>>
pub fn find_latest_session(&self, cwd: &str) -> Result<Option<Session>>
pub fn find_client_session( &self, cwd: &str, key: &str, ) -> Result<Option<Session>>
pub fn recent_sessions(&self, cwd: &str, limit: usize) -> Result<Vec<Session>>
pub fn first_user_prompt(&self, session_id: &str) -> Result<Option<String>>
pub fn rebind_client_session_key( &mut self, cwd: &str, key: &str, target_session_id: &str, ) -> Result<()>
pub fn append_item( &mut self, session_id: &str, role: Role, blocks: Vec<ContentBlock>, ) -> Result<ConversationItem>
pub fn append_assistant_item( &mut self, session_id: &str, blocks: Vec<ContentBlock>, usage: Option<Usage>, ) -> Result<ConversationItem>
pub fn append_turn_interrupted( &mut self, session_id: &str, ) -> Result<ConversationItem>
pub fn replace_branch_with_summary( &mut self, session_id: &str, summary: &str, ) -> Result<ConversationItem>
pub fn get_item(&self, id: &str) -> Result<Option<ConversationItem>>
pub fn active_branch(&self, session_id: &str) -> Result<Vec<ConversationItem>>
pub fn rewind(&mut self, session_id: &str, item_id: &str) -> Result<()>
pub fn user_checkpoints( &self, session_id: &str, ) -> Result<Vec<ConversationItem>>
pub fn count_items(&self, session_id: &str) -> Result<usize>
pub fn update_model_selection( &self, session_id: &str, provider_type: &str, model: &str, model_profile: &str, effort: Option<&str>, ) -> Result<()>
pub fn clear_session(&self, session_id: &str) -> Result<()>
pub fn record_input_history(&self, text: &str) -> Result<()>
pub fn recent_input_history(&self, limit: usize) -> Result<Vec<String>>
pub fn prune_input_history(&self, maximum: usize) -> Result<()>
pub fn record_file_snapshots( &self, session_id: &str, turn_item_id: &str, snapshots: &[FileSnapshot], ) -> Result<()>
Sourcepub fn snapshots_from_turn(
&self,
session_id: &str,
item_id: &str,
) -> Result<Vec<FileSnapshot>>
pub fn snapshots_from_turn( &self, session_id: &str, item_id: &str, ) -> Result<Vec<FileSnapshot>>
Snapshots taken from item_id’s turn onwards, newest first so a restore
replays them in reverse order.
Rewinding to a checkpoint means continuing from that message again, so the work done in response to it is discarded too, which is why its own turn is included rather than only later ones.
pub fn delete_snapshots_from_turn( &self, session_id: &str, item_id: &str, ) -> Result<()>
Sourcepub fn session_request_usage(&self, session_id: &str) -> Result<Vec<Usage>>
pub fn session_request_usage(&self, session_id: &str) -> Result<Vec<Usage>>
Usage of every request the session ever made, one entry per request, including requests on branches a rewind left behind: all of them were paid for. Kept per request because tiered prices depend on how large that individual request was.
Sourcepub fn cached_prices(
&self,
key: &str,
ttl: Duration,
) -> Result<Option<(Schedule, String)>>
pub fn cached_prices( &self, key: &str, ttl: Duration, ) -> Result<Option<(Schedule, String)>>
Cached model prices, ignored once older than ttl so a price change is
picked up without making every /status hit the network. The whole
schedule is stored, tiers included, so a cache hit prices large requests
the same way a fresh lookup would.