pub struct SessionManager { /* private fields */ }Expand description
Manages session-scoped scratch files for memory ingestion.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn start_session(
&self,
session_id: &str,
agent_type: &str,
) -> Result<PathBuf>
pub fn start_session( &self, session_id: &str, agent_type: &str, ) -> Result<PathBuf>
Start a new agent session and create a scratch file.
If a scratch file already exists for this session (e.g. from a previous session start in the same project), it is overwritten to reflect the new session.
Sourcepub fn append_learning(
&self,
session_id: &str,
content: &str,
confidence: f32,
) -> Result<()>
pub fn append_learning( &self, session_id: &str, content: &str, confidence: f32, ) -> Result<()>
Append a learning entry to a session scratch file.
Sourcepub fn merge_session(
&self,
session_id: &str,
hot_cache: &mut HotCache,
max_entries: usize,
) -> Result<usize, AgentError>
pub fn merge_session( &self, session_id: &str, hot_cache: &mut HotCache, max_entries: usize, ) -> Result<usize, AgentError>
Merge learnings from a scratch file into the hot cache. Does NOT rename the scratch file — caller must call mark_session_merged() after persisting the cache to avoid data loss on save failure.
Sourcepub fn mark_session_merged(&self, session_id: &str) -> Result<(), AgentError>
pub fn mark_session_merged(&self, session_id: &str) -> Result<(), AgentError>
Mark a session scratch file as merged (rename .md → .merged.md). Call this AFTER cache persistence succeeds to avoid data loss.
Sourcepub fn cleanup_old_sessions(&self) -> Result<usize>
pub fn cleanup_old_sessions(&self) -> Result<usize>
Clean up merged session files older than 7 days.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more