pub struct SessionManager { /* private fields */ }Expand description
Manager for session storage.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn start_new(&mut self, project_path: Option<&Path>) -> Result<&Session>
pub fn start_new(&mut self, project_path: Option<&Path>) -> Result<&Session>
Start a new session.
Sourcepub fn continue_last(
&mut self,
project_path: Option<&Path>,
) -> Result<Option<&Session>>
pub fn continue_last( &mut self, project_path: Option<&Path>, ) -> Result<Option<&Session>>
Continue the last session (for –continue).
Sourcepub fn resume(
&mut self,
query: &str,
project_path: Option<&Path>,
) -> Result<Option<&Session>>
pub fn resume( &mut self, query: &str, project_path: Option<&Path>, ) -> Result<Option<&Session>>
Resume a specific session by ID or name (for –resume).
Sourcepub fn save_current(&mut self) -> Result<()>
pub fn save_current(&mut self) -> Result<()>
Save the current session to disk.
Sourcepub fn update_stats(&mut self, last_input_tokens: u32, total_output_tokens: u64)
pub fn update_stats(&mut self, last_input_tokens: u32, total_output_tokens: u64)
Update current session stats after a turn.
Sourcepub fn record_compression(&mut self, entry: CompressionHistoryEntry)
pub fn record_compression(&mut self, entry: CompressionHistoryEntry)
Record a compression event in the session history.
Sourcepub fn set_messages(&mut self, messages: Vec<Message>)
pub fn set_messages(&mut self, messages: Vec<Message>)
Set messages for the current session.
Sourcepub fn messages_mut(&mut self) -> Option<&mut Vec<Message>>
pub fn messages_mut(&mut self) -> Option<&mut Vec<Message>>
Get mutable reference to messages.
Sourcepub fn current_id(&self) -> Option<&str>
pub fn current_id(&self) -> Option<&str>
Get the current session ID.
Sourcepub fn current_name(&self) -> Option<&str>
pub fn current_name(&self) -> Option<&str>
Get the current session name.
Sourcepub fn rename_current(&mut self, new_name: &str) -> Result<()>
pub fn rename_current(&mut self, new_name: &str) -> Result<()>
Rename the current session.
Sourcepub fn clear_current(&mut self) -> Result<()>
pub fn clear_current(&mut self) -> Result<()>
Clear the current session (start fresh).
Sourcepub fn list_sessions(&self) -> &[SessionMetadata]
pub fn list_sessions(&self) -> &[SessionMetadata]
List all sessions.
Sourcepub fn has_current(&self) -> bool
pub fn has_current(&self) -> bool
Check if there’s a current session.
Sourcepub fn current_metadata(&self) -> Option<&SessionMetadata>
pub fn current_metadata(&self) -> Option<&SessionMetadata>
Get current session metadata.
Sourcepub fn history_path(&self) -> PathBuf
pub fn history_path(&self) -> PathBuf
Get the history file path (legacy compatibility).
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
impl UnwindSafe for SessionManager
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