cortexai-wasm 0.1.0

WebAssembly bindings for Cortex AI agents — run agents in the browser, and WASM sandbox for untrusted tool execution on the host
Documentation
//! Error types for the WASM tool sandbox.

use std::time::Duration;

use thiserror::Error;

/// Errors that can occur during WASM sandbox operations.
#[derive(Error, Debug)]
pub enum SandboxError {
    /// WASM module failed to compile.
    #[error("WASM compilation failed: {0}")]
    CompilationFailed(String),

    /// WASM module execution failed (trap, missing export, etc).
    #[error("WASM execution failed: {0}")]
    ExecutionFailed(String),

    /// The module exceeded its memory allocation.
    #[error("Memory limit exceeded: module tried to exceed {limit_bytes} bytes")]
    MemoryLimitExceeded { limit_bytes: usize },

    /// The module exceeded its execution time limit.
    #[error("Execution timeout exceeded: limit was {limit:?}")]
    TimeoutExceeded { limit: Duration },

    /// The module exhausted its fuel (CPU) budget.
    #[error("Fuel exhausted: budget was {fuel_limit} units")]
    FuelExhausted { fuel_limit: u64 },
}