/** * Subprocess Sandbox * * Provides true process isolation for code execution by spawning * a separate Node.js process. This is more secure than Worker Threads * because: * - Separate V8 isolate (no shared memory) * - Can be killed without affecting main process * - Resource limits enforced by OS * - No prototype pollution can escape to main process */ /** * Tool definition for the sandbox */ export interface SandboxTool { name: string; description: string; inputSchema?: Record; } /** * Message types for IPC communication */ export interface SandboxMessage { type: 'execute' | 'tool_call' | 'tool_result' | 'log' | 'result' | 'error' | 'ready'; id?: string; toolName?: string; params?: unknown; result?: unknown; error?: string; data?: unknown; code?: string; tools?: SandboxTool[]; level?: 'log' | 'warn' | 'error' | 'debug'; } /** * Result of code execution */ export interface SandboxExecutionResult { result: unknown; logs: string[]; error?: string; duration: number; } /** * Configuration for the subprocess sandbox */ export interface SubprocessSandboxConfig { /** Maximum execution time in milliseconds (default: 30000) */ timeout: number; /** Maximum memory in MB (default: 128) */ memoryLimit: number; /** Minimum environment (only PATH) */ minimalEnv: boolean; } /** * Subprocess Sandbox implementation */ export declare class SubprocessSandbox { private config; private process; private pendingToolCalls; private messageId; constructor(config?: Partial); /** * Execute code in isolated subprocess * * @param code - Code to execute * @param tools - Available tools * @param toolExecutor - Function to execute tool calls * @returns Execution result */ execute(code: string, tools: SandboxTool[], toolExecutor: (toolName: string, params: unknown) => Promise): Promise; /** * Terminate the sandbox process if running */ terminate(): void; /** * Check if sandbox process is running */ isRunning(): boolean; } /** * Create a subprocess sandbox instance */ export declare function createSubprocessSandbox(config?: Partial): SubprocessSandbox; //# sourceMappingURL=subprocess-sandbox.d.ts.map