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 set_thread_goal(
&mut self,
params: &ThreadGoalSetParams,
) -> Result<Option<ThreadGoal>>
pub fn set_thread_goal( &mut self, params: &ThreadGoalSetParams, ) -> Result<Option<ThreadGoal>>
Sets or replaces the persisted goal for a thread.
Sourcepub fn get_thread_goal(
&self,
params: &ThreadGoalGetParams,
) -> Result<Option<ThreadGoal>>
pub fn get_thread_goal( &self, params: &ThreadGoalGetParams, ) -> Result<Option<ThreadGoal>>
Reads the persisted goal for a thread.
Sourcepub fn clear_thread_goal(
&mut self,
params: &ThreadGoalClearParams,
) -> Result<bool>
pub fn clear_thread_goal( &mut self, params: &ThreadGoalClearParams, ) -> Result<bool>
Clears the persisted goal for a thread, returning whether one existed.
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.