use std::path::{Path, PathBuf};
use crate::core::error::RustChainError;
pub struct SandboxConfig {
pub cpu_limit_ms: u64,
pub memory_limit_mb: u64,
pub allowed_paths: Vec<PathBuf>,
}
pub struct AgentSandbox {
config: SandboxConfig,
}
impl AgentSandbox {
pub fn new(config: SandboxConfig) -> Self {
Self { config }
}
pub fn validate_access(&self, path: &Path) -> bool {
self.config.allowed_paths.iter().any(|p| path.starts_with(p))
}
pub fn enforce_limits(&self) {
println!(
"[Sandbox] Enforcing limits: {} ms CPU, {} MB memory",
self.config.cpu_limit_ms,
self.config.memory_limit_mb
);
}
}