pub struct TaskManager { /* private fields */ }Expand description
Task manager for persisting and managing tasks
Implementations§
Source§impl TaskManager
impl TaskManager
Sourcepub fn new(base_dir: impl Into<PathBuf>) -> Self
pub fn new(base_dir: impl Into<PathBuf>) -> Self
Create a new task manager with the given base directory
Sourcepub fn load_task_list(&self, session_id: &str) -> Result<TaskList, TaskError>
pub fn load_task_list(&self, session_id: &str) -> Result<TaskList, TaskError>
Load the full task list for a session.
This returns the persisted state (or an empty list if none exists yet). It is used by checkpoint/rewind to snapshot and restore task state.
Sourcepub fn replace_task_list(&self, task_list: TaskList) -> Result<(), TaskError>
pub fn replace_task_list(&self, task_list: TaskList) -> Result<(), TaskError>
Replace the persisted task list for a session.
This is primarily used by checkpoint/rewind to restore a previous task state.
Sourcepub fn set_current_task_id(
&self,
session_id: &str,
task_id: Option<String>,
) -> Result<(), TaskError>
pub fn set_current_task_id( &self, session_id: &str, task_id: Option<String>, ) -> Result<(), TaskError>
Set or clear the current task pointer for a session.
If task_id is Some, it must exist in the session’s task list.
Sourcepub fn get_current_task_id(
&self,
session_id: &str,
) -> Result<Option<String>, TaskError>
pub fn get_current_task_id( &self, session_id: &str, ) -> Result<Option<String>, TaskError>
Get the current task pointer for a session.
Sourcepub fn create_task(
&self,
session_id: &str,
name: impl Into<String>,
description: impl Into<String>,
parent_id: Option<String>,
) -> Result<Task, TaskError>
pub fn create_task( &self, session_id: &str, name: impl Into<String>, description: impl Into<String>, parent_id: Option<String>, ) -> Result<Task, TaskError>
Create a new task
Sourcepub fn update_task_status(
&self,
session_id: &str,
task_id: &str,
status: TaskStatus,
) -> Result<(), TaskError>
pub fn update_task_status( &self, session_id: &str, task_id: &str, status: TaskStatus, ) -> Result<(), TaskError>
Update a task’s status
Sourcepub fn update_task(
&self,
session_id: &str,
task_id: &str,
name: Option<String>,
description: Option<String>,
) -> Result<(), TaskError>
pub fn update_task( &self, session_id: &str, task_id: &str, name: Option<String>, description: Option<String>, ) -> Result<(), TaskError>
Update a task’s name and description
Sourcepub fn delete_task(
&self,
session_id: &str,
task_id: &str,
) -> Result<Task, TaskError>
pub fn delete_task( &self, session_id: &str, task_id: &str, ) -> Result<Task, TaskError>
Delete a task
Sourcepub fn list_tasks(&self, session_id: &str) -> Result<Vec<Task>, TaskError>
pub fn list_tasks(&self, session_id: &str) -> Result<Vec<Task>, TaskError>
List all tasks for a session
Sourcepub fn get_hierarchy(
&self,
session_id: &str,
) -> Result<Vec<(Task, Vec<Task>)>, TaskError>
pub fn get_hierarchy( &self, session_id: &str, ) -> Result<Vec<(Task, Vec<Task>)>, TaskError>
Get task hierarchy for a session
Sourcepub fn list_descendants(
&self,
session_id: &str,
task_id: &str,
) -> Result<Vec<Task>, TaskError>
pub fn list_descendants( &self, session_id: &str, task_id: &str, ) -> Result<Vec<Task>, TaskError>
List all descendant tasks for the given task.
Sourcepub fn get_task_tree(
&self,
session_id: &str,
) -> Result<Vec<TaskTreeNode>, TaskError>
pub fn get_task_tree( &self, session_id: &str, ) -> Result<Vec<TaskTreeNode>, TaskError>
Get a full recursive task tree for a session.
Sourcepub fn add_task_dependency(
&self,
session_id: &str,
task_id: &str,
blocked_by_id: &str,
) -> Result<(), TaskError>
pub fn add_task_dependency( &self, session_id: &str, task_id: &str, blocked_by_id: &str, ) -> Result<(), TaskError>
Add a dependency relationship to a task.
Sourcepub fn set_task_background_job(
&self,
session_id: &str,
task_id: &str,
job: Option<TaskBackgroundJob>,
) -> Result<(), TaskError>
pub fn set_task_background_job( &self, session_id: &str, task_id: &str, job: Option<TaskBackgroundJob>, ) -> Result<(), TaskError>
Update background job state for a task.
Sourcepub fn create_agent_task(
&self,
session_id: &str,
name: impl Into<String>,
description: impl Into<String>,
agent_id: Option<String>,
parent_id: Option<String>,
) -> Result<Task, TaskError>
pub fn create_agent_task( &self, session_id: &str, name: impl Into<String>, description: impl Into<String>, agent_id: Option<String>, parent_id: Option<String>, ) -> Result<Task, TaskError>
Create a task from an agent (during LLM processing)
Sourcepub fn create_orchestrator_task(
&self,
session_id: &str,
orchestrator_task_id: impl Into<String>,
agent_id: impl Into<String>,
name: impl Into<String>,
description: impl Into<String>,
context: Option<Value>,
) -> Result<Task, TaskError>
pub fn create_orchestrator_task( &self, session_id: &str, orchestrator_task_id: impl Into<String>, agent_id: impl Into<String>, name: impl Into<String>, description: impl Into<String>, context: Option<Value>, ) -> Result<Task, TaskError>
Create a task from an orchestrator delegated task
Sourcepub fn find_by_orchestrator_id(
&self,
session_id: &str,
orchestrator_task_id: &str,
) -> Result<Option<Task>, TaskError>
pub fn find_by_orchestrator_id( &self, session_id: &str, orchestrator_task_id: &str, ) -> Result<Option<Task>, TaskError>
Find a task by its orchestrator_task_id
Sourcepub fn update_task_metadata(
&self,
session_id: &str,
task_id: &str,
metadata: Value,
) -> Result<(), TaskError>
pub fn update_task_metadata( &self, session_id: &str, task_id: &str, metadata: Value, ) -> Result<(), TaskError>
Update a task’s metadata
Sourcepub fn materialize_requirement_breakdown(
&self,
session_id: &str,
specs: &[RequirementBreakdownTaskSpec],
) -> Result<MaterializedTaskBreakdown, TaskError>
pub fn materialize_requirement_breakdown( &self, session_id: &str, specs: &[RequirementBreakdownTaskSpec], ) -> Result<MaterializedTaskBreakdown, TaskError>
Materialize a requirement breakdown into persisted agent-created tasks.
Sourcepub fn materialize_requirement_breakdown_under_parent(
&self,
session_id: &str,
parent_task_id: &str,
specs: &[RequirementBreakdownTaskSpec],
) -> Result<MaterializedTaskBreakdown, TaskError>
pub fn materialize_requirement_breakdown_under_parent( &self, session_id: &str, parent_task_id: &str, specs: &[RequirementBreakdownTaskSpec], ) -> Result<MaterializedTaskBreakdown, TaskError>
Materialize a requirement breakdown beneath an existing tracked root task.
Sourcepub fn initialize_auto_tracked_execution_plan(
&self,
session_id: &str,
root_task_name: &str,
original_input: &str,
specs: &[RequirementBreakdownTaskSpec],
) -> Result<AutoTrackedExecutionPlan, TaskError>
pub fn initialize_auto_tracked_execution_plan( &self, session_id: &str, root_task_name: &str, original_input: &str, specs: &[RequirementBreakdownTaskSpec], ) -> Result<AutoTrackedExecutionPlan, TaskError>
Create a tracked root task and materialize a shared execution plan under it.
Sourcepub fn cancel_open_descendants(
&self,
session_id: &str,
task_id: &str,
) -> Result<Vec<String>, TaskError>
pub fn cancel_open_descendants( &self, session_id: &str, task_id: &str, ) -> Result<Vec<String>, TaskError>
Cancel any descendant tasks that are still open.
Sourcepub fn record_task_result(
&self,
session_id: &str,
task_id: &str,
success: bool,
output: String,
tool_calls: i32,
duration_ms: i32,
) -> Result<TaskStatus, TaskError>
pub fn record_task_result( &self, session_id: &str, task_id: &str, success: bool, output: String, tool_calls: i32, duration_ms: i32, ) -> Result<TaskStatus, TaskError>
Record the result metadata for a task and update its status.
Sourcepub fn finalize_tracked_task_after_agent_run(
&self,
session_id: &str,
task_id: &str,
) -> Result<TrackedTaskFinalization, TaskError>
pub fn finalize_tracked_task_after_agent_run( &self, session_id: &str, task_id: &str, ) -> Result<TrackedTaskFinalization, TaskError>
Reconcile a tracked task after an agent run by examining descendant state.
Sourcepub fn record_memory_event(
&self,
session_id: &str,
task_id: &str,
event: TaskMemoryEvent,
) -> Result<(), TaskError>
pub fn record_memory_event( &self, session_id: &str, task_id: &str, event: TaskMemoryEvent, ) -> Result<(), TaskError>
Record a structured memory lifecycle event in task metadata.
Sourcepub fn get_memory_lifecycle(
&self,
session_id: &str,
task_id: &str,
) -> Result<Option<TaskMemoryLifecycle>, TaskError>
pub fn get_memory_lifecycle( &self, session_id: &str, task_id: &str, ) -> Result<Option<TaskMemoryLifecycle>, TaskError>
Read structured memory lifecycle data from task metadata.
Sourcepub fn update_execution_state<F>(
&self,
session_id: &str,
task_id: &str,
update: F,
) -> Result<TaskExecutionState, TaskError>where
F: FnOnce(&mut TaskExecutionState),
pub fn update_execution_state<F>(
&self,
session_id: &str,
task_id: &str,
update: F,
) -> Result<TaskExecutionState, TaskError>where
F: FnOnce(&mut TaskExecutionState),
Update the runtime execution state stored in task metadata.
Sourcepub fn get_execution_state(
&self,
session_id: &str,
task_id: &str,
) -> Result<Option<TaskExecutionState>, TaskError>
pub fn get_execution_state( &self, session_id: &str, task_id: &str, ) -> Result<Option<TaskExecutionState>, TaskError>
Read runtime execution state from task metadata.
Auto Trait Implementations§
impl !Freeze for TaskManager
impl RefUnwindSafe for TaskManager
impl Send for TaskManager
impl Sync for TaskManager
impl Unpin for TaskManager
impl UnwindSafe for TaskManager
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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].