pub struct ShellTool { /* private fields */ }Expand description
The confined shell tool.
Registers under "shell". Accepts either argv form (program + args) or a
free-form cmd string parsed by the safe-subset engine. Leash refusals
(out-of-scope exec/fs, a refused construct) are returned as a structured
denied envelope (denied: true), not a hard error.
Implementations§
Source§impl ShellTool
impl ShellTool
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct the tool with the real OS spawner, environment, and dir lister,
and the default LimitsPolicy.
Sourcepub fn with_config(limits: LimitsPolicy) -> Self
pub fn with_config(limits: LimitsPolicy) -> Self
Construct with the real seams and a caller-supplied LimitsPolicy — the
configurability seam (agent-bridle#143): tune timeouts / output / glob caps.
Sourcepub fn with_output_observer(
self,
observer: Arc<dyn ShellOutputObserver>,
) -> Self
pub fn with_output_observer( self, observer: Arc<dyn ShellOutputObserver>, ) -> Self
Attach a presentation-only observer for bounded stdout/stderr chunks.
The observer is queued only after leash admission. It receives at most
the configured output cap per stream and cannot change authorization or
the final result envelope. Delivery may finish asynchronously after the
invocation returns; on_finish marks the queue-drained boundary.
Sourcepub fn with_sandbox_policy(self, sandbox: SandboxPolicy) -> Self
pub fn with_sandbox_policy(self, sandbox: SandboxPolicy) -> Self
Set the sandbox mechanism policy (read/exec allow-lists, ABI floors) the L3 backend enforces (I5-B, #144). The default is today’s built-in allow-lists.
Trait Implementations§
Source§impl Tool for ShellTool
impl Tool for ShellTool
Source§fn name(&self) -> &str
fn name(&self) -> &str
tools/list and in
crate::Registry::dispatch).Source§fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
cx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invoke<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
cx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
cx proves the leash was passed; the tool enforces
per-operation policy by calling cx.check_exec, cx.check_path_*, etc.