Skip to main content

BackendTool

Struct BackendTool 

Source
pub struct BackendTool { /* private fields */ }
Expand description

A tool a plugin’s backend serves ("run": "backend"): each call is a tool request.

Implementations§

Source§

impl BackendTool

Source

pub fn new( name: String, plugin: PluginRef, decl: ManifestTool, backend: Arc<Backend>, ) -> Self

Source

pub fn with_cards(self, cards: Vec<(String, bool)>) -> Self

The card views its plugin declares (views with "site": "card"): (id, web view).

Source

pub fn with_types(self, types: ArtifactTypes) -> Self

Save the artifact versions its results carry with these types (the chat’s).

Source

pub fn with_timeout(self, timeout: Duration) -> Self

Source

pub fn declared(&self) -> &ManifestTool

Trait Implementations§

Source§

impl Tool for BackendTool

Source§

fn pending_title(&self, args: &Value) -> String

The declared title too while it runs, on approval cards and when it fails (not “Run describe_sheet”).

Source§

fn spec(&self) -> ToolSpec

Source§

fn title(&self, args: &Value) -> String

Short human title for the finished call, e.g. “Wrote notes.md”. args is untrusted.
Source§

fn access(&self, _args: &Value) -> Access

What this call would do; drives the permission gate. Must not have side effects.
Source§

fn always_ask(&self, args: &Value) -> Option<String>

Some(warning) if this call must be approved by a person every time: no policy, “always allow” grant or --auto-approve lets it run (e.g. installing system-wide). The warning is shown on the approval card.
Source§

fn run(&self, args: &Value, ctx: &ToolContext<'_>) -> ToolOutput

Do it. args is untrusted model output: validate everything, never panic.
Source§

fn preview(&self, args: &Value, _workspace: &Path) -> Option<Preview>

A readable account of what the call would do, for approval cards: e.g. a diff for a file write. Reads only, no side effects; bounded. Defaults to the key arguments.
Source§

fn card(&self, _args: &Value) -> Option<Card>

The card a person confirms this call on, in plain words (Card); None: the preview, then the arguments in full. Only used for calls that must be confirmed.
Source§

fn concurrent(&self) -> bool

Calls of this tool start before the other calls of the same round and run side by side, each on a thread of its own (results still go back in call order). For tools that mostly wait, like delegate.
Source§

fn repeatable(&self, _args: &Value) -> bool

The same call can mean something new each time, so the turn’s repeat guard (“you already called this”) lets it through: reads of state that changes, or undo.

Auto Trait Implementations§

§

impl !RefUnwindSafe for BackendTool

§

impl !UnwindSafe for BackendTool

§

impl Forget for BackendTool

§

impl Freeze for BackendTool
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const LeafNode<String, String> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, String)>>: Freeze, PhantomData<Value>: Freeze, *const LeafNode<String, Value> is !null: Freeze, PhantomData<Box<(String, Value)>>: Freeze, PhantomData<String>: Freeze, *const ArcInner<Backend> is !null: Freeze, PhantomData<ArcInner<Backend>>: Freeze, *const ArcInner<RwLock<Vec<ArtifactType>>> is !null: Freeze, PhantomData<ArcInner<RwLock<Vec<ArtifactType>>>>: Freeze, PhantomData<(String, bool)>: Freeze,

§

impl Move for BackendTool

§

impl Send for BackendTool
where RawVecInner: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, Arc<Backend>: Send, Arc<RwLock<Vec<ArtifactType>>>: Send,

§

impl Sync for BackendTool
where RawVecInner: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, Arc<Backend>: Sync, Arc<RwLock<Vec<ArtifactType>>>: Sync,

§

impl Unpin for BackendTool
where *const u8 is !null: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Arc<Backend>: Unpin, Arc<RwLock<Vec<ArtifactType>>>: Unpin,

§

impl UnsafeUnpin for BackendTool

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.