1use std::collections::HashMap;
2use std::path::PathBuf;
3use std::time::Duration;
4
5pub use agent_fetch::{DomainPattern, FetchPolicy};
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct SandboxConfig {
11 pub work_dir: PathBuf,
13
14 #[serde(default)]
16 pub mounts: Vec<MountPoint>,
17
18 #[serde(default)]
20 pub env_vars: HashMap<String, String>,
21
22 #[serde(default = "default_timeout")]
24 pub timeout: Duration,
25
26 #[serde(default = "default_memory_limit")]
28 pub memory_limit_bytes: u64,
29
30 #[serde(default = "default_fuel_limit")]
32 pub fuel_limit: u64,
33
34 #[serde(default)]
36 pub fetch_policy: Option<FetchPolicy>,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct MountPoint {
42 pub host_path: PathBuf,
44
45 pub guest_path: String,
47
48 #[serde(default)]
50 pub writable: bool,
51}
52
53fn default_timeout() -> Duration {
54 Duration::from_secs(30)
55}
56
57fn default_memory_limit() -> u64 {
58 512 * 1024 * 1024 }
60
61fn default_fuel_limit() -> u64 {
62 1_000_000_000 }
64
65impl Default for SandboxConfig {
66 fn default() -> Self {
67 Self {
68 work_dir: PathBuf::from("."),
69 mounts: Vec::new(),
70 env_vars: HashMap::new(),
71 timeout: default_timeout(),
72 memory_limit_bytes: default_memory_limit(),
73 fuel_limit: default_fuel_limit(),
74 fetch_policy: None,
75 }
76 }
77}