/**
 * script-runner.ts — SandboxedScriptRunner interface + DirectEvalRunner stub
 *
 * Phase 5 scaffold: defines the interface that the isolated-vm implementation
 * will satisfy, and provides a DirectEvalRunner that keeps providers working
 * without the native isolated-vm package.
 *
 * See README-design.ts for the full design rationale.
 */
/** Options controlling the resource limits applied to a sandboxed script call. */
export interface SandboxOptions {
    /** Maximum CPU time (wall-clock) in milliseconds before the script is killed. Default: 50. */
    cpuTimeLimitMs: number;
    /** Maximum V8 heap size in megabytes for the Isolate. Default: 32. */
    memoryLimitMb: number;
    /**
     * Whitelist of global names the script may access.
     * The full allowed surface is documented in README-design.ts.
     * Default: ['console', 'JSON', 'Math', 'Date', 'String', 'Number', 'Boolean',
     *           'Array', 'Object', 'RegExp']
     */
    allowedGlobals: string[];
}
/** Default resource limits applied when no options are supplied. */
export declare const DEFAULT_SANDBOX_OPTIONS: SandboxOptions;
/**
 * Contract for sandboxed script execution.
 *
 * Implementations:
 *   - DirectEvalRunner  — no-op stub; uses eval() with a try/catch (unsafe, no limits).
 *   - IsolatedVmRunner  — Phase 5 full implementation using the `isolated-vm` package.
 *
 * Usage:
 *   const runner = createScriptRunner({ cpuTimeLimitMs: 50, memoryLimitMb: 32 });
 *   const result = await runner.run(scriptSource, { input, sdk });
 *   runner.dispose();
 */
export interface SandboxedScriptRunner {
    /**
     * Execute `script` synchronously inside a sandboxed context.
     *
     * @param script   JavaScript source string. The script body should
     *                 evaluate to the desired return value (the last expression
     *                 is returned, module.exports is NOT consulted).
     *                 Example: `"input.tail.includes('✓') ? 'idle' : 'generating'"`
     *
     * @param context  Plain key/value pairs injected as globals inside the
     *                 sandbox. All values must be JSON-serializable.
     *                 Typically: `{ input: <CliStatusInput>, sdk: <sdk facade> }`
     *
     * @param options  Optional per-call overrides for resource limits.
     *                 Merged with the options supplied to createScriptRunner().
     *
     * @returns        The value produced by the script (JSON-deserialized from
     *                 the sandbox). May be `unknown` — callers must validate.
     *
     * @throws         Re-throws if the script contains a syntax error.
     *                 Returns `undefined` (via rejection) on timeout or OOM.
     */
    run(script: string, context: Record<string, unknown>, options?: Partial<SandboxOptions>): Promise<unknown>;
    /**
     * Release all resources held by this runner (Isolate, Contexts, etc.).
     * After dispose(), calling run() has undefined behavior.
     */
    dispose(): void;
}
/**
 * No-op stub used when isolated-vm is not available (graceful degradation).
 *
 * Falls back to direct `eval()` inside a try/catch — there are no CPU or
 * memory limits. A warning is logged on the first run() call to make the
 * fallback visible in daemon logs.
 *
 * This implementation is suitable for:
 *   - Development environments where isolated-vm is not installed.
 *   - Unit tests (no native dependency required).
 *   - Graceful fallback for existing extended-legacy providers while Phase 5
 *     is being rolled out.
 *
 * NOT suitable for production use with untrusted script sources.
 */
export declare class DirectEvalRunner implements SandboxedScriptRunner {
    private warned;
    private readonly defaultOptions;
    constructor(options?: Partial<SandboxOptions>);
    run(script: string, context: Record<string, unknown>, _options?: Partial<SandboxOptions>): Promise<unknown>;
    dispose(): void;
}
/**
 * Factory: returns IsolatedVmRunner if isolated-vm is installed, else DirectEvalRunner.
 *
 * Logs a warning when falling back to DirectEvalRunner so the operator is aware
 * that sandboxing is inactive.
 *
 * @param options  Resource limit defaults applied to every run() call unless
 *                 overridden at the call site. Merged with DEFAULT_SANDBOX_OPTIONS.
 */
export declare function createScriptRunner(options?: Partial<SandboxOptions>): SandboxedScriptRunner;
