pub struct CardTracker {
instances: Vec<Instance>,
at: HashMap<String, usize>,
roster: HashMap<String, Roster>,
task_ids: HashMap<String, String>,
answers: HashMap<String, Answer>,
made_under: HashMap<String, String>,
child_owner: HashMap<String, usize>,
}Expand description
The instances as frames arrive, one at a time.
Fields§
§instances: Vec<Instance>§at: HashMap<String, usize>§roster: HashMap<String, Roster>§task_ids: HashMap<String, String>The task id the CLI assigned to a dispatch’s tool call, which is what lets a later lifecycle frame find the card it belongs to.
answers: HashMap<String, Answer>§made_under: HashMap<String, String>The call each assistant tool-use id was made under. Only a
parentless Task/Agent call opens an instance, so this is the link
that walks a deeper dispatch up to the card that owns it.
child_owner: HashMap<String, usize>The instance each of its recorded child calls belongs to, so a walk that names a child resolves without scanning every instance.
Implementations§
Source§impl CardTracker
impl CardTracker
Sourcepub fn apply(&mut self, message: &Message)
pub fn apply(&mut self, message: &Message)
Fold one frame in.
Every arm is a per-frame lookup, never a walk of the conversation.
The caller compares Self::cards against what it last held to
decide whether to announce - the list is the object, so a frame
that changed nothing private pushes nothing.
Sourcepub fn cards(&self) -> Vec<SubagentCard>
pub fn cards(&self) -> Vec<SubagentCard>
The instances as they stand, in dispatch order.
Sourcepub(crate) fn dispatch_of(&self, task_id: &str) -> Option<&str>
pub(crate) fn dispatch_of(&self, task_id: &str) -> Option<&str>
The row a refusal by task_id belongs under. The CLI names the agent,
never the dispatch, so the agent’s task id is resolved through the
chain; a task no instance owns answers None and the frame stays put.
Sourcepub(crate) fn owning_dispatch(&self, call: &str) -> Option<&str>
pub(crate) fn owning_dispatch(&self, call: &str) -> Option<&str>
The card dispatch that owns call: the call itself when it opened a
card, else the instance whose child line it is, else the call it was
made under. Only the outermost dispatch is a card, so a depth-3 call
names a child line rather than a card and needs the extra hop.
Sourcefn link_task(&mut self, task_id: &str, tool_use_id: Option<&str>)
fn link_task(&mut self, task_id: &str, tool_use_id: Option<&str>)
Note which task a dispatch’s tool call was assigned.
Sourcefn settle_child(&mut self, tool_use_id: &str, failed: bool)
fn settle_child(&mut self, tool_use_id: &str, failed: bool)
Settle the child call tool_use_id answers, when it is one of an
instance’s own calls.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CardTracker
impl RefUnwindSafe for CardTracker
impl Send for CardTracker
impl Sync for CardTracker
impl Unpin for CardTracker
impl UnsafeUnpin for CardTracker
impl UnwindSafe for CardTracker
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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