pub struct ExecutorContext {
pub cwd: Option<String>,
pub env: HashMap<String, String>,
pub session_id: Option<String>,
pub approval_policy: AskForApproval,
pub sandbox_policy: SandboxPolicy,
pub timeout_ms: Option<u64>,
}Expand description
Context passed to tool executors.
Contains all state needed for permission checks and execution.
Bridges with hanzo-protocol’s AskForApproval and SandboxPolicy.
Fields§
§cwd: Option<String>Working directory for filesystem operations
env: HashMap<String, String>Environment variables
session_id: Option<String>User/session ID for audit
approval_policy: AskForApprovalWhen to ask for approval (from hanzo-protocol)
sandbox_policy: SandboxPolicyHow to sandbox execution (from hanzo-protocol)
timeout_ms: Option<u64>Timeout in milliseconds
Implementations§
Source§impl ExecutorContext
impl ExecutorContext
Sourcepub fn with_cwd(cwd: impl Into<String>) -> Self
pub fn with_cwd(cwd: impl Into<String>) -> Self
Create a new context with specified working directory
Sourcepub fn check_approval(&self, operation: &str) -> PermissionResult
pub fn check_approval(&self, operation: &str) -> PermissionResult
Check if an operation should be approved
Sourcepub fn is_path_writable(&self, path: &Path) -> bool
pub fn is_path_writable(&self, path: &Path) -> bool
Check if a path is writable under current sandbox policy
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Create a permissive context (for trusted environments)
Trait Implementations§
Source§impl Clone for ExecutorContext
impl Clone for ExecutorContext
Source§fn clone(&self) -> ExecutorContext
fn clone(&self) -> ExecutorContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExecutorContext
impl Debug for ExecutorContext
Auto Trait Implementations§
impl Freeze for ExecutorContext
impl RefUnwindSafe for ExecutorContext
impl Send for ExecutorContext
impl Sync for ExecutorContext
impl Unpin for ExecutorContext
impl UnsafeUnpin for ExecutorContext
impl UnwindSafe for ExecutorContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more