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
impl BackendTool
pub fn new( name: String, plugin: PluginRef, decl: ManifestTool, backend: Arc<Backend>, ) -> Self
Sourcepub fn with_cards(self, cards: Vec<(String, bool)>) -> Self
pub fn with_cards(self, cards: Vec<(String, bool)>) -> Self
The card views its plugin declares (views with "site": "card"): (id, web view).
Sourcepub fn with_types(self, types: ArtifactTypes) -> Self
pub fn with_types(self, types: ArtifactTypes) -> Self
Save the artifact versions its results carry with these types (the chat’s).
pub fn with_timeout(self, timeout: Duration) -> Self
pub fn declared(&self) -> &ManifestTool
Trait Implementations§
Source§impl Tool for BackendTool
impl Tool for BackendTool
fn spec(&self) -> ToolSpec
Source§fn title(&self, args: &Value) -> String
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
fn access(&self, _args: &Value) -> Access
What this call would do; drives the permission gate. Must not have side effects.
Source§fn run(&self, args: &Value, ctx: &ToolContext<'_>) -> ToolOutput
fn run(&self, args: &Value, ctx: &ToolContext<'_>) -> ToolOutput
Do it.
args is untrusted model output: validate everything, never panic.Source§fn pending_title(&self, _args: &Value) -> String
fn pending_title(&self, _args: &Value) -> String
Title for the call before and while it runs, and on approval cards, e.g.
“Write notes.md”. Defaults to “Run ”.
Source§fn preview(&self, args: &Value, _workspace: &Path) -> Option<Preview>
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 always_ask(&self, _args: &Value) -> Option<String>
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 concurrent(&self) -> bool
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.Auto Trait Implementations§
impl !RefUnwindSafe for BackendTool
impl !UnwindSafe for BackendTool
impl Forget for BackendTool
impl Freeze for BackendTool
impl Move for BackendTool
impl Send for BackendTool
impl Sync for BackendTool
impl Unpin for BackendTool
impl UnsafeUnpin for BackendTool
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
Mutably borrows from an owned value. Read more