pub struct ConversationManager { /* private fields */ }Expand description
Manages conversation persistence for a project
Implementations§
Source§impl ConversationManager
impl ConversationManager
Sourcepub fn new(project_dir: impl AsRef<Path>) -> Result<Self>
pub fn new(project_dir: impl AsRef<Path>) -> Result<Self>
Create a new conversation manager for a project directory
Sourcepub fn save_conversation(
&self,
conversation: &ConversationHistory,
) -> Result<()>
pub fn save_conversation( &self, conversation: &ConversationHistory, ) -> Result<()>
Save a conversation to disk
Sourcepub fn save_compaction_archive(
&self,
archive: &CompactionArchive,
) -> Result<PathBuf>
pub fn save_compaction_archive( &self, archive: &CompactionArchive, ) -> Result<PathBuf>
Save the raw messages removed by a compaction. Archives live
outside the hot conversation JSON so /load and /list don’t
parse old transcripts on every startup.
Sourcepub fn load_conversation(&self, id: &str) -> Result<ConversationHistory>
pub fn load_conversation(&self, id: &str) -> Result<ConversationHistory>
Load a specific conversation by ID
Sourcepub fn load_last_conversation(&self) -> Result<Option<ConversationHistory>>
pub fn load_last_conversation(&self) -> Result<Option<ConversationHistory>>
Load the most recent valid conversation.
Iterates files newest-first by mtime and returns the first that reads,
parses, and has a valid id — skipping (with a warning) any unreadable,
unparseable, or traversing-id file. Mirrors list_conversations’s
tolerance so one corrupt/partial file (e.g. a crash mid-write) can’t make
--continue hard-fail; it falls back to the next-newest valid conversation.
Sourcepub fn list_conversations(&self) -> Result<Vec<ConversationHistory>>
pub fn list_conversations(&self) -> Result<Vec<ConversationHistory>>
List all conversations in the project
Sourcepub fn list_conversation_metas(&self) -> Result<Vec<ConversationMeta>>
pub fn list_conversation_metas(&self) -> Result<Vec<ConversationMeta>>
Fast session list: read each <id>.meta sidecar; for a session that
lacks a (valid) one — older, or written by a pre-sidecar build — fall
back to fully parsing its <id>.json. Message-less sessions are skipped.
Newest-first. Cheaper than [list_conversations] for display-only paths.
Sourcepub fn delete_conversation(&self, id: &str) -> Result<()>
pub fn delete_conversation(&self, id: &str) -> Result<()>
Delete a conversation (and its metadata sidecar).
Sourcepub fn conversations_dir(&self) -> &Path
pub fn conversations_dir(&self) -> &Path
Get the conversations directory path
pub fn compactions_dir(&self) -> &Path
Trait Implementations§
Source§impl Clone for ConversationManager
impl Clone for ConversationManager
Source§fn clone(&self) -> ConversationManager
fn clone(&self) -> ConversationManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConversationManager
impl RefUnwindSafe for ConversationManager
impl Send for ConversationManager
impl Sync for ConversationManager
impl Unpin for ConversationManager
impl UnsafeUnpin for ConversationManager
impl UnwindSafe for ConversationManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
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>
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