pub struct LocalProcess {
pub program: String,
pub allow_args: Vec<String>,
pub env: BTreeMap<String, String>,
pub max_output: usize,
pub timeout_ms: u64,
pub calls: u64,
}Expand description
A sandboxed local process tool.
The allowlist is the program plus its permitted argument prefixes. The child
gets a scrubbed environment (only what the caller allows), no shell, and a
byte-bounded stdout. Anything else is rpc/tool-policy.
Fields§
§program: StringAbsolute program path or allowlisted name.
allow_args: Vec<String>Arguments the caller may pass (each must be an exact match or a prefix
when it ends with *).
env: BTreeMap<String, String>Environment variables the child inherits.
max_output: usizeMaximum output bytes.
timeout_ms: u64Maximum wall-clock time one invocation may take before the child is killed. Bounded on purpose: a tool that never returns must not hold the caller forever (H2.44).
calls: u64Calls served.
Implementations§
Source§impl LocalProcess
impl LocalProcess
Sourcepub fn new(program: impl Into<String>, allow_args: &[&str]) -> Self
pub fn new(program: impl Into<String>, allow_args: &[&str]) -> Self
Build a tool for program with an argument allowlist.
Sourcepub fn with_timeout(self, timeout_ms: u64) -> Self
pub fn with_timeout(self, timeout_ms: u64) -> Self
Set the per-invocation wall-clock ceiling.
Sourcepub fn policy(&self) -> ToolPolicy
pub fn policy(&self) -> ToolPolicy
Policy for a capability: process execution must be granted explicitly.
Trait Implementations§
Source§impl Debug for LocalProcess
impl Debug for LocalProcess
Source§impl Provider for LocalProcess
impl Provider for LocalProcess
Source§fn mutating(&self, _method: &str) -> bool
fn mutating(&self, _method: &str) -> bool
method mutates provider state (refused on read-only caps).Source§fn invoke(&mut self, _object: u64, call: &Call) -> Result<Response>
fn invoke(&mut self, _object: u64, call: &Call) -> Result<Response>
object.Source§fn has_method(&self, method: &str) -> bool
fn has_method(&self, method: &str) -> bool
method.Source§fn on_drop(&mut self, _object: u64, _cap: CapId)
fn on_drop(&mut self, _object: u64, _cap: CapId)
object is dropped.Source§fn take_drop_notifications(&mut self) -> Vec<(u64, CapId)>
fn take_drop_notifications(&mut self) -> Vec<(u64, CapId)>
Provider::on_drop. Read more