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, commands running on this host; the
path is canonicalized, falling back to the input if
canonicalization fails (canonicalization requires every component
to exist). A build without the local-shell feature installs the
no-shell executor: every command fails in-band until a real one is
installed.
Sourcepub fn with_env(
workspace: impl Into<PathBuf>,
env: &BTreeMap<String, String>,
) -> ShellTools
pub fn with_env( workspace: impl Into<PathBuf>, env: &BTreeMap<String, String>, ) -> ShellTools
Tools rooted at workspace whose commands run with env
layered over the inherited environment — how a frontend hands
its agent’s tools a connection (a daemon URL, a scoped token, a
PATH addition) without touching the process environment. A wired
crate::vision macro rides the same map: its staging
directory’s var lights the inbox up. A build without the
local-shell feature installs the no-shell executor either way:
the env has nothing to ride on.
Sourcepub fn with_executor(
workspace: impl Into<PathBuf>,
exec: Arc<dyn ShellExecutor>,
) -> ShellTools
pub fn with_executor( workspace: impl Into<PathBuf>, exec: Arc<dyn ShellExecutor>, ) -> ShellTools
Tools rooted at workspace whose commands run on exec — the
seam a remote-shell frontend comes in through.
Sourcepub fn with_vision_inbox(self, inbox: Option<PathBuf>) -> ShellTools
pub fn with_vision_inbox(self, inbox: Option<PathBuf>) -> ShellTools
Lights the vision inbox up explicitly — the seam a resolver that
runs its own inner ShellTools (the subagents extension) uses to
inherit its parent’s inbox, since it builds on
Self::with_executor, which reads no env map.
Sourcepub fn vision_inbox(&self) -> Option<&Path>
pub fn vision_inbox(&self) -> Option<&Path>
The staging directory images attach from, when a frontend wired
the crate::vision macro for this shell.
Sourcepub fn executor(&self) -> Arc<dyn ShellExecutor> ⓘ
pub fn executor(&self) -> Arc<dyn ShellExecutor> ⓘ
The executor commands run on. A resolver that runs its own inner
ShellTools — the subagents extension — builds the inner one on
the same executor, so subagents land where the turn’s commands
land.
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 current_approval(&self) -> Option<Arc<dyn Approval>>
pub fn current_approval(&self) -> Option<Arc<dyn Approval>>
The approval hook installed for the current turn, if any. A
resolver that runs its own inner ShellTools — the subagents
extension — reads this to inherit the turn’s policy rather than
holding a hook of its own.
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,
ToolResult::failure instead.Source§fn resolve_streaming<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: ToolCall,
ctx: &'life1 ToolContext,
progress: &'life2 mut dyn ToolProgress,
) -> 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 ToolProgress,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
ShellTools: 'async_trait,
Source§fn replay_safety(&self, _name: &str) -> ReplaySafety
fn replay_safety(&self, _name: &str) -> ReplaySafety
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.