pub struct ToolContext<'a> {
pub cwd: PathBuf,
pub session_id: String,
pub approve_fn: &'a (dyn Fn(&str) -> bool + Send + Sync),
pub yolo: bool,
pub identity: Option<Identity>,
pub sandbox_enabled: bool,
}Expand description
Context passed to every tool execution.
Fields§
§cwd: PathBuf§session_id: String§approve_fn: &'a (dyn Fn(&str) -> bool + Send + Sync)Callback: returns true if user approves the command.
yolo: boolWhether to skip all approval (YOLO mode).
identity: Option<Identity>Who is invoking this tool call. None means “assume LocalOwner”
— the default for legacy callers that predate the identity system.
New callers should always populate this.
sandbox_enabled: boolWhether the sandbox layer is enabled at runtime (from
[sandbox] enabled in config.toml). When false, tools skip the
pre_exec hook regardless of identity — this matches the “opt-in”
design promise so upgrading users see no behavior change.
Implementations§
Source§impl ToolContext<'_>
impl ToolContext<'_>
Sourcepub fn approve(&self, command: &str) -> bool
pub fn approve(&self, command: &str) -> bool
Check whether the given command is approved, either by YOLO mode or the approval callback.
Sourcepub fn effective_identity(&self) -> Identity
pub fn effective_identity(&self) -> Identity
Return the effective identity for this tool call, defaulting to
aegis_security::Identity::LocalOwner when unset.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ToolContext<'a>
impl<'a> !UnwindSafe for ToolContext<'a>
impl<'a> Freeze for ToolContext<'a>
impl<'a> Send for ToolContext<'a>
impl<'a> Sync for ToolContext<'a>
impl<'a> Unpin for ToolContext<'a>
impl<'a> UnsafeUnpin for ToolContext<'a>
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