pub struct InMemorySubagentTaskTracker { /* private fields */ }Implementations§
Source§impl InMemorySubagentTaskTracker
impl InMemorySubagentTaskTracker
pub fn new() -> Self
Sourcepub fn with_max_terminal_tasks(max: usize) -> Self
pub fn with_max_terminal_tasks(max: usize) -> Self
Construct a tracker with an optional FIFO cap on terminal-state snapshots. Running tasks are never dropped.
Sourcepub async fn register_canceller(&self, task_id: &str, token: CancellationToken)
pub async fn register_canceller(&self, task_id: &str, token: CancellationToken)
Register a CancellationToken for a running task so callers can
trigger cancellation through cancel(task_id). The task executor
is expected to remove the entry on exit via clear_canceller.
pub async fn clear_canceller(&self, task_id: &str)
Sourcepub async fn cancel(&self, task_id: &str) -> bool
pub async fn cancel(&self, task_id: &str) -> bool
Fire the registered token and mark the snapshot as Cancelled.
Returns true if a token was found (caller can interpret as
“cancellation initiated”), false if the task id was unknown or
the task already finished. The eventual SubagentEnd event won’t
overwrite the Cancelled status — see record_event.
Sourcepub async fn record_event(&self, event: &AgentEvent)
pub async fn record_event(&self, event: &AgentEvent)
Apply a single agent event to the tracker. Non-subagent events are ignored.
pub async fn get(&self, task_id: &str) -> Option<SubagentTaskSnapshot>
pub async fn list(&self) -> Vec<SubagentTaskSnapshot>
pub async fn list_pending(&self) -> Vec<SubagentTaskSnapshot>
pub async fn list_for_parent( &self, parent_session_id: &str, ) -> Vec<SubagentTaskSnapshot>
Sourcepub async fn replace_snapshots(&self, snapshots: Vec<SubagentTaskSnapshot>)
pub async fn replace_snapshots(&self, snapshots: Vec<SubagentTaskSnapshot>)
Replace the tracker’s task snapshots with the given set. Cancellers
are not restored (they are runtime-only channels tied to live
child loops). After replace_snapshots, any task whose status was
Running at checkpoint time will appear Running in the tracker
but cancel(task_id) will return false because no canceller is
registered — callers should normally checkpoint at a quiescent
point so no tasks are Running.
Used by SessionStore rehydration to
restore the materialized subagent view of a previously-saved
session.
Trait Implementations§
Source§impl Debug for InMemorySubagentTaskTracker
impl Debug for InMemorySubagentTaskTracker
Source§impl Default for InMemorySubagentTaskTracker
impl Default for InMemorySubagentTaskTracker
Source§fn default() -> InMemorySubagentTaskTracker
fn default() -> InMemorySubagentTaskTracker
Auto Trait Implementations§
impl !Freeze for InMemorySubagentTaskTracker
impl !RefUnwindSafe for InMemorySubagentTaskTracker
impl Send for InMemorySubagentTaskTracker
impl Sync for InMemorySubagentTaskTracker
impl Unpin for InMemorySubagentTaskTracker
impl UnsafeUnpin for InMemorySubagentTaskTracker
impl !UnwindSafe for InMemorySubagentTaskTracker
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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