{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/agent/sandbox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,sBAAsB;AACtB,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAgB;IAE9B,YAAY,MAAM,EAAE,aAAa,EAEhC;IAED;;OAEG;IACH,SAAS,IAAI,OAAO,CAEnB;IAED;;OAEG;IACG,OAAO,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GACtD,OAAO,CAAC;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC,CAeD;IAED;;OAEG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhD;IAED;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE;IAED;;OAEG;IACH,OAAO,CAAC,eAAe;CA+BvB","sourcesContent":["/**\n * Sandbox Manager - Docker-based sandbox execution\n *\n * Provides isolated execution environment for agent tools.\n */\n\nimport type { SandboxConfig } from \"./types.js\";\n\n/** Sandbox manager */\nexport class SandboxManager {\n\tprivate config: SandboxConfig;\n\n\tconstructor(config: SandboxConfig) {\n\t\tthis.config = config;\n\t}\n\n\t/**\n\t * Check if sandbox is enabled\n\t */\n\tisEnabled(): boolean {\n\t\treturn this.config.enabled;\n\t}\n\n\t/**\n\t * Execute command in sandbox\n\t */\n\tasync execute(\n\t\tcommand: string,\n\t\toptions?: { cwd?: string; env?: Record<string, string> },\n\t): Promise<{\n\t\tsuccess: boolean;\n\t\tstdout: string;\n\t\tstderr: string;\n\t\texitCode: number;\n\t}> {\n\t\tif (!this.config.enabled) {\n\t\t\tthrow new Error(\"Sandbox is not enabled\");\n\t\t}\n\n\t\t// TODO: Implement Docker-based execution\n\t\t// This is a placeholder\n\t\tconsole.log(`[Sandbox] Would execute: ${command}`);\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tstdout: \"\",\n\t\t\tstderr: \"\",\n\t\t\texitCode: 0,\n\t\t};\n\t}\n\n\t/**\n\t * Read file from sandbox\n\t */\n\tasync readFile(filePath: string): Promise<string> {\n\t\tif (!this.config.enabled) {\n\t\t\tthrow new Error(\"Sandbox is not enabled\");\n\t\t}\n\n\t\t// TODO: Implement\n\t\tthrow new Error(\"Not implemented\");\n\t}\n\n\t/**\n\t * Write file to sandbox\n\t */\n\tasync writeFile(filePath: string, content: string): Promise<void> {\n\t\tif (!this.config.enabled) {\n\t\t\tthrow new Error(\"Sandbox is not enabled\");\n\t\t}\n\n\t\t// TODO: Implement\n\t\tthrow new Error(\"Not implemented\");\n\t}\n\n\t/**\n\t * Build Docker run arguments\n\t */\n\tprivate buildDockerArgs(): string[] {\n\t\tconst args: string[] = [];\n\n\t\t// Add mounts\n\t\tif (this.config.workspace) {\n\t\t\targs.push(\"-v\", `${this.config.workspace}:/workspace`);\n\t\t}\n\n\t\tfor (const [host, container] of Object.entries(this.config.readOnlyMounts ?? {})) {\n\t\t\targs.push(\"-v\", `${host}:${container}:ro`);\n\t\t}\n\n\t\tfor (const [host, container] of Object.entries(this.config.readWriteMounts ?? {})) {\n\t\t\targs.push(\"-v\", `${host}:${container}`);\n\t\t}\n\n\t\t// Add environment variables\n\t\tfor (const [key, value] of Object.entries(this.config.env ?? {})) {\n\t\t\targs.push(\"-e\", `${key}=${value}`);\n\t\t}\n\n\t\t// Add resource limits\n\t\tif (this.config.limits?.memory) {\n\t\t\targs.push(\"--memory\", this.config.limits.memory);\n\t\t}\n\t\tif (this.config.limits?.cpus) {\n\t\t\targs.push(\"--cpus\", this.config.limits.cpus);\n\t\t}\n\n\t\treturn args;\n\t}\n}\n"]}