pub struct SessionStore { /* private fields */ }Expand description
Handles persistence of sessions as JSONL files in a directory.
By default, uses ~/.local/share/tinyharness/sessions/. This can be
overridden with SessionStore::new for testing or alternative paths.
Implementations§
Source§impl SessionStore
impl SessionStore
Sourcepub fn default_path() -> Self
pub fn default_path() -> Self
Create a store that uses the default session directory
(~/.local/share/tinyharness/sessions/).
Sourcepub fn ensure_dir(&self) -> Result<(), SessionError>
pub fn ensure_dir(&self) -> Result<(), SessionError>
Ensure the session directory exists.
Sourcepub fn create(
&self,
working_dir: &str,
mode: AgentMode,
provider: &str,
model: Option<String>,
) -> Session
pub fn create( &self, working_dir: &str, mode: AgentMode, provider: &str, model: Option<String>, ) -> Session
Create a brand-new session and write its initial metadata to disk.
Returns the new Session handle.
Sourcepub fn load(
&self,
session_id: &str,
) -> Result<(Session, Vec<Message>), SessionError>
pub fn load( &self, session_id: &str, ) -> Result<(Session, Vec<Message>), SessionError>
Load an existing session by its full ID. Returns the session handle and the conversation messages.
Sourcepub fn find_latest_for_dir(&self, working_dir: &str) -> Option<String>
pub fn find_latest_for_dir(&self, working_dir: &str) -> Option<String>
Find the most recent session for a given working directory.
Sourcepub fn find_by_prefix(&self, prefix: &str) -> Result<String, SessionError>
pub fn find_by_prefix(&self, prefix: &str) -> Result<String, SessionError>
Find a session by an ID prefix.
Sourcepub fn list_all(&self) -> Vec<SessionMeta>
pub fn list_all(&self) -> Vec<SessionMeta>
List all sessions, most recently updated first.
Auto Trait Implementations§
impl Freeze for SessionStore
impl RefUnwindSafe for SessionStore
impl Send for SessionStore
impl Sync for SessionStore
impl Unpin for SessionStore
impl UnsafeUnpin for SessionStore
impl UnwindSafe for SessionStore
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
Mutably borrows from an owned value. Read more