use std::collections::HashMap;
use std::path::PathBuf;
use std::time::Duration;
pub use agent_fetch::{DomainPattern, FetchPolicy};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SandboxConfig {
pub work_dir: PathBuf,
#[serde(default)]
pub mounts: Vec<MountPoint>,
#[serde(default)]
pub env_vars: HashMap<String, String>,
#[serde(default = "default_timeout")]
pub timeout: Duration,
#[serde(default = "default_memory_limit")]
pub memory_limit_bytes: u64,
#[serde(default = "default_fuel_limit")]
pub fuel_limit: u64,
#[serde(default)]
pub fetch_policy: Option<FetchPolicy>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MountPoint {
pub host_path: PathBuf,
pub guest_path: String,
#[serde(default)]
pub writable: bool,
}
fn default_timeout() -> Duration {
Duration::from_secs(30)
}
fn default_memory_limit() -> u64 {
512 * 1024 * 1024 }
fn default_fuel_limit() -> u64 {
1_000_000_000 }
impl Default for SandboxConfig {
fn default() -> Self {
Self {
work_dir: PathBuf::from("."),
mounts: Vec::new(),
env_vars: HashMap::new(),
timeout: default_timeout(),
memory_limit_bytes: default_memory_limit(),
fuel_limit: default_fuel_limit(),
fetch_policy: None,
}
}
}