pub trait BashSandbox: Send + Sync {
// Required methods
fn exec_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
command: &'life1 str,
guest_workspace: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SandboxOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn exec<'life0, 'async_trait>(
&'life0 self,
request: SandboxCommandRequest,
) -> Pin<Box<dyn Future<Output = Result<SandboxExecutionOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Abstraction over sandbox bash execution used by the bash built-in tool.
Implement this trait to provide a custom sandbox backend. The host
application constructs the implementation and passes it to the session
via ToolContext::with_sandbox.
Required Methods§
Sourcefn exec_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
command: &'life1 str,
guest_workspace: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SandboxOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn exec_command<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
command: &'life1 str,
guest_workspace: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SandboxOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute a shell command inside the sandbox.
command— the shell command string (passed asbash -c <command>).guest_workspace— the guest path where the workspace is mounted (e.g.,"/workspace").
Provided Methods§
Sourcefn exec<'life0, 'async_trait>(
&'life0 self,
request: SandboxCommandRequest,
) -> Pin<Box<dyn Future<Output = Result<SandboxExecutionOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn exec<'life0, 'async_trait>(
&'life0 self,
request: SandboxCommandRequest,
) -> Pin<Box<dyn Future<Output = Result<SandboxExecutionOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute a command with the complete host tool contract.
Existing implementations inherit a compatibility adapter that delegates
to Self::exec_command. Sandboxes that spawn a real process should
override this method so timeout and output-stream semantics are not
silently lost.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".