/** * Sandboxed JavaScript execution environment for RLM queries. * Feature #1: RLM Environment Core * * Uses QuickJS via quickjs-emscripten for true sandboxing. */ /** * Document representation in RLM environment. */ export interface DocVariable { content: string; metadata: { path: string; size: number; lines: number; modified: string; }; path: string; } /** * Sandbox configuration options. */ export interface SandboxOptions { /** Execution timeout in ms (default: 5000) */ timeout?: number; /** Memory limit in MB (default: 64) */ memoryLimit?: number; } /** * Result of code execution. */ export interface ExecutionResult { result: T; executionTimeMs: number; memoryUsed?: number; } /** * Timeout error thrown when execution exceeds time limit. */ export declare class TimeoutError extends Error { constructor(timeoutMs: number); } /** * Memory error thrown when execution exceeds memory limit. */ export declare class MemoryError extends Error { constructor(limitMb: number); } /** * Sandboxed RLM execution environment. */ export interface RlmEnvironment { /** * Execute JavaScript code with doc/docs variable available. * @param code - JavaScript code to execute * @returns Promise resolving to execution result * @throws TimeoutError if execution exceeds timeout * @throws MemoryError if execution exceeds memory limit * @throws SecurityError if code attempts prohibited operations */ execute(code: string): Promise>; /** * Release resources. Always call when done. */ dispose(): void; } /** * Create a sandboxed execution environment with document(s) loaded. * @param doc - Single DocVariable or array for multi-query * @param options - Sandbox configuration */ export declare function createEnvironment(doc: DocVariable | DocVariable[], options?: SandboxOptions): Promise; //# sourceMappingURL=sandbox.d.ts.map