import type { ShellExecutor, FileSystemExecutor } from '../tool/types.js'; import type { Sandbox, SandboxConfig, SandboxManager, ScriptLanguage } from './types.js'; export interface LocalSandboxOptions extends Partial { allowedReadDirs?: string[]; env?: Record; cleanupOnDestroy?: boolean; strictPath?: boolean; } export declare class LocalSandboxFileSystemExecutor implements FileSystemExecutor { private readonly rootDir; private readonly maxFileSize; private readonly allowedReadDirs; private readonly strictPath; constructor(rootDir: string, maxFileSize?: number, allowedReadDirs?: string[], strictPath?: boolean); readFile(filePath: string): Promise; readFileBuffer(filePath: string): Promise; writeFile(filePath: string, content: string): Promise; writeFileBuffer(filePath: string, content: Buffer): Promise; appendFile(filePath: string, content: string): Promise; listDir(dirPath: string): Promise; private isInside; private resolveWritePath; private resolveReadPath; } export declare class LocalSandboxShellExecutor implements ShellExecutor { private readonly rootDir; private readonly commandRestriction; private readonly maxBuffer; private guard; private outputBuffer; private env; constructor(rootDir: string, commandRestriction?: boolean, env?: Record, maxBuffer?: number); exec(command: string, timeout?: number): Promise; write(_data: string): void; read(lines?: number): string; /** * 检测命令中是否引用了沙箱目录之外的路径(绝对路径 / ~/ / $HOME / file:// / Windows 盘符 / 父目录穿越)。 * 实际逻辑统一收敛在 ./path-guard.ts(与 agent-server 共享单一来源)。 */ private findOutsideSandboxPath; } export declare class LocalSandbox implements Sandbox { readonly id: string; readonly rootDir: string; private fsExecutor; private shellExecutor; private cleanupOnDestroy; constructor(id: string, options: LocalSandboxOptions); init(): Promise; getShellExecutor(): ShellExecutor; getFileSystemExecutor(): FileSystemExecutor; runScript(language: ScriptLanguage, code: string, timeout?: number): Promise; destroy(): Promise; } export declare class LocalSandboxManager implements SandboxManager { private readonly options; private sandboxes; constructor(options?: LocalSandboxOptions); create(id: string, config?: Partial): Promise; get(id: string): Sandbox | undefined; destroy(id: string): Promise; destroyAll(): Promise; } //# sourceMappingURL=local-sandbox.d.ts.map