pub struct ShellTools { /* private fields */ }Expand description
The built-in tool set: bash. Shared behind an Arc between the
engine’s Agent and the driver.
Implementations§
Source§impl ShellTools
impl ShellTools
Sourcepub fn builtin_specs() -> Vec<ToolSpec>
pub fn builtin_specs() -> Vec<ToolSpec>
The specs the built-in tool set advertises. Fixed at compile time and independent of the instance: the system-prompt renderer names the same tools the resolver offers, so the prompt and the API’s tools array cannot drift.
Sourcepub fn new(workspace: impl Into<PathBuf>) -> ShellTools
pub fn new(workspace: impl Into<PathBuf>) -> ShellTools
Tools rooted at workspace; the path is canonicalized, falling back
to the input if canonicalization fails (canonicalization requires
every component to exist).
Sourcepub fn install_approval(&self, approval: Arc<dyn Approval>)
pub fn install_approval(&self, approval: Arc<dyn Approval>)
Installs the approval hook consulted by the tool. Call once per turn before stepping; tool resolution cannot overlap another turn’s hook, so the swap is safe.
Sourcepub fn clear_approval(&self)
pub fn clear_approval(&self)
Removes the approval hook; calls reject until one is installed again.
Trait Implementations§
Source§impl ToolResolver for ShellTools
impl ToolResolver for ShellTools
Source§fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolCall,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
ShellTools: 'async_trait,
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolCall,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
ShellTools: 'async_trait,
Turn a model’s call into a result. Errors become in-band results:
implementations must not panic and must not abort on unknown names
or bad arguments — return
ToolResult::failure instead.Source§fn resolve_streaming<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: ToolCall,
ctx: &'life1 ToolContext,
progress: &'life2 mut (dyn for<'a> FnMut(&'a str) + Send),
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
ShellTools: 'async_trait,
fn resolve_streaming<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: ToolCall,
ctx: &'life1 ToolContext,
progress: &'life2 mut (dyn for<'a> FnMut(&'a str) + Send),
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
ShellTools: 'async_trait,
Resolve with progress: an implementation running something long —
a shell command — calls
progress with human-facing output
chunks (complete lines) as they land, so a sink can render them
live; the full text still arrives in the returned result. The
default ignores progress and resolves as usual.Source§fn replay_safety(&self, _name: &str) -> ReplaySafety
fn replay_safety(&self, _name: &str) -> ReplaySafety
The replay safety of one offered tool (see
ReplaySafety),
consulted when a crash left a committed call without its result.
Defaults to ReplaySafety::Unsafe: a resolver that does not
classify its tools is treated as entirely side-effecting.Auto Trait Implementations§
impl !Freeze for ShellTools
impl RefUnwindSafe for ShellTools
impl Send for ShellTools
impl Sync for ShellTools
impl Unpin for ShellTools
impl UnsafeUnpin for ShellTools
impl UnwindSafe for ShellTools
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