1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum SandboxError {
5 #[error("WASM runtime error: {0}")]
6 Runtime(#[from] wasmtime::Error),
7
8 #[error("IO error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("path traversal blocked: {0}")]
12 PathTraversal(String),
13
14 #[error("command not found: {0}")]
15 CommandNotFound(String),
16
17 #[error("execution timed out after {0:?}")]
18 Timeout(std::time::Duration),
19
20 #[error("sandbox destroyed")]
21 Destroyed,
22
23 #[error(
24 "WASM toolbox not available — build with: cargo build --target wasm32-wasip1 -p agent-toolbox --release"
25 )]
26 ToolboxNotAvailable,
27
28 #[error("networking disabled: configure fetch_policy to enable")]
29 NetworkingDisabled,
30
31 #[error("fetch error: {0}")]
32 Fetch(String),
33
34 #[error("{0}")]
35 Other(String),
36}
37
38pub type Result<T> = std::result::Result<T, SandboxError>;