pub struct SessionManager { /* private fields */ }Expand description
Manages the session store at ~/.roma/sessions/.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(config_home: &Path) -> Self
pub fn new(config_home: &Path) -> Self
Create a new session manager rooted at config_home/sessions/.
Sourcepub fn with_home(home: PathBuf) -> Self
pub fn with_home(home: PathBuf) -> Self
Create a session manager rooted at a specific path (for testing).
Sourcepub fn session_dir(&self, id: &str) -> PathBuf
pub fn session_dir(&self, id: &str) -> PathBuf
Return the directory for a specific session id.
Sourcepub fn save(
&self,
session: &ChatSession,
meta: &SessionMeta,
) -> Result<(), ClassifiedError>
pub fn save( &self, session: &ChatSession, meta: &SessionMeta, ) -> Result<(), ClassifiedError>
Save a session and its metadata.
Returns an error if meta.id does not match session.session_id.
If meta.first_user_message is None, it is auto-populated from the
first user message in the session (truncated to 200 chars).
Sourcepub fn load(&self, id: &str) -> Result<ChatSession, ClassifiedError>
pub fn load(&self, id: &str) -> Result<ChatSession, ClassifiedError>
Load a session by id.
Sourcepub fn load_meta(&self, id: &str) -> Result<SessionMeta, ClassifiedError>
pub fn load_meta(&self, id: &str) -> Result<SessionMeta, ClassifiedError>
Load session metadata by id.
Sourcepub fn list(&self) -> Result<Vec<SessionMeta>, ClassifiedError>
pub fn list(&self) -> Result<Vec<SessionMeta>, ClassifiedError>
List all saved sessions, sorted by updated_at descending.
Sourcepub fn delete(&self, id: &str) -> Result<(), ClassifiedError>
pub fn delete(&self, id: &str) -> Result<(), ClassifiedError>
Delete a session by id.
The id must be a bare UUID string with no path separators or ..
components to prevent directory traversal.
Sourcepub fn search(&self, query: &str) -> Result<Vec<SessionMeta>, ClassifiedError>
pub fn search(&self, query: &str) -> Result<Vec<SessionMeta>, ClassifiedError>
Search sessions by keyword. Matches against title, id, and first_user_message fields in metadata. Case-insensitive.