pub struct ThreadManager { /* private fields */ }Expand description
Manages thread lifecycle: spawn, resume, fork, archive, and persistence.
Implementations§
Source§impl ThreadManager
impl ThreadManager
Sourcepub fn new(store: StateStore) -> Self
pub fn new(store: StateStore) -> Self
Creates a new ThreadManager backed by the given state store.
Sourcepub fn state_store(&self) -> &StateStore
pub fn state_store(&self) -> &StateStore
Returns a reference to the underlying state store.
Sourcepub fn spawn_thread_with_history(
&mut self,
model_provider: String,
cwd: PathBuf,
initial_history: InitialHistory,
persist_extended_history: bool,
) -> Result<NewThread>
pub fn spawn_thread_with_history( &mut self, model_provider: String, cwd: PathBuf, initial_history: InitialHistory, persist_extended_history: bool, ) -> Result<NewThread>
Spawns a new thread with the given initial history and persists it.
Sourcepub fn resume_thread_with_history(
&mut self,
params: &ThreadResumeParams,
fallback_cwd: &Path,
model_provider: String,
) -> Result<Option<NewThread>>
pub fn resume_thread_with_history( &mut self, params: &ThreadResumeParams, fallback_cwd: &Path, model_provider: String, ) -> Result<Option<NewThread>>
Resumes an existing thread, returning None if not found.
Sourcepub fn fork_thread(
&mut self,
params: &ThreadForkParams,
fallback_cwd: &Path,
) -> Result<Option<NewThread>>
pub fn fork_thread( &mut self, params: &ThreadForkParams, fallback_cwd: &Path, ) -> Result<Option<NewThread>>
Forks an existing thread into a new one, inheriting the parent’s provider.
Sourcepub fn list_threads(&self, params: &ThreadListParams) -> Result<Vec<Thread>>
pub fn list_threads(&self, params: &ThreadListParams) -> Result<Vec<Thread>>
Lists threads matching the given filter parameters.
Sourcepub fn read_thread(&self, params: &ThreadReadParams) -> Result<Option<Thread>>
pub fn read_thread(&self, params: &ThreadReadParams) -> Result<Option<Thread>>
Reads a single thread by id, or None if not found.
Sourcepub fn set_thread_name(
&mut self,
params: &ThreadSetNameParams,
) -> Result<Option<Thread>>
pub fn set_thread_name( &mut self, params: &ThreadSetNameParams, ) -> Result<Option<Thread>>
Sets the display name for a thread, returning the updated thread or None.
Sourcepub fn archive_thread(&mut self, thread_id: &str) -> Result<()>
pub fn archive_thread(&mut self, thread_id: &str) -> Result<()>
Archives a thread so it no longer appears in default listings.
Sourcepub fn unarchive_thread(&mut self, thread_id: &str) -> Result<()>
pub fn unarchive_thread(&mut self, thread_id: &str) -> Result<()>
Restores an archived thread to active status.
Auto Trait Implementations§
impl Freeze for ThreadManager
impl RefUnwindSafe for ThreadManager
impl Send for ThreadManager
impl Sync for ThreadManager
impl Unpin for ThreadManager
impl UnsafeUnpin for ThreadManager
impl UnwindSafe for ThreadManager
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