Skip to main content

ToolCallView

Struct ToolCallView 

Source
pub struct ToolCallView<'a> {
    pub call: &'a ToolCall,
    pub result: Option<&'a ToolResult>,
    pub state: CallState,
    pub theme: Theme,
    pub facts: Option<&'a ToolResultContext>,
    pub took: Option<Duration>,
    pub output: Option<&'a str>,
    pub children: &'a [ChildCall],
}
Expand description

A tool call and its result, if it has one yet, as a renderer sees them.

Fields§

§call: &'a ToolCall

The call. While it streams, its arguments are what has come of them, and its id is not the final one.

§result: Option<&'a ToolResult>

Its result, once it is in the conversation.

§state: CallState

Where the call stands.

§theme: Theme

The transcript’s colors.

§facts: Option<&'a ToolResultContext>

What the call published, such as rig-core’s ExitStatus and FilesChanged, once it settled: in this run, or in an earlier one of a resumed session whose effect log was kept.

§took: Option<Duration>

How long it ran, once it settled, as for facts.

§output: Option<&'a str>

The output so far of a running call whose tool reports it as it runs (CallOutput), such as a command’s: cut as tool output is cut, its last lines after a line that counts the earlier ones. None once the call answered, and before it printed anything.

§children: &'a [ChildCall]

The tool and model calls the call started, and those they started, in order, each after the one that started it, through any effect between that is no call: such as a subagent’s calls under the call that spawned it, through the spawn and the brief it was sent. Also after a resume, from the session’s effect log (PastEffects).

Implementations§

Source§

impl<'a> ToolCallView<'a>

Source

pub fn new( call: &'a ToolCall, result: Option<&'a ToolResult>, state: CallState, ) -> Self

call, answered by result if it was, standing as state, with no facts or output known, in the default colors.

Source

pub fn name(&self) -> &str

The tool’s name.

Source

pub fn argument(&self, key: &str) -> Option<&str>

The string argument key, if the call has one.

Source

pub fn result_text(&self) -> Option<String>

The result’s text, joined, if the tool answered.

Source

pub fn failed(&self) -> bool

Whether the call failed: the tool answered with an error, or the process it ran did not exit with 0 (ExitStatus).

Source

pub fn header( &self, title: impl Into<String>, detail: impl Into<String>, ) -> Line<'static>

The header line: title in bold and detail dimmed on a band tinted by where the call stands (Theme’s call_* colors), with the state in words too when it is running, held or failed (how its process ended, when it ran one).

Source

pub fn header_spans( &self, title: impl Into<String>, detail: Vec<Span<'static>>, ) -> Line<'static>

header with detail in spans styled by the look, such as a highlighted command; the state’s words still end it.

Source

pub fn result_lines(&self) -> Vec<Line<'static>>

The whole result, indented under the header, red for an error. A unified diff is coloured. The line that says the tool cut its output (OutputCut), naming the file with all of it, is on its side. Before the result, a running call’s progress.

Source

pub fn progress_lines(&self) -> Vec<Line<'static>>

A running call’s progress, indented under the header, where its result goes once it answers; none without one.

Source

pub fn default_lines(&self) -> Vec<Line<'static>>

The look of a tool with no renderer: the name, the arguments and the result.

Auto Trait Implementations§

§

impl<'a> Freeze for ToolCallView<'a>

§

impl<'a> RefUnwindSafe for ToolCallView<'a>

§

impl<'a> Send for ToolCallView<'a>

§

impl<'a> Sync for ToolCallView<'a>

§

impl<'a> Unpin for ToolCallView<'a>

§

impl<'a> UnsafeUnpin for ToolCallView<'a>

§

impl<'a> UnwindSafe for ToolCallView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more