/**
 * ContainerRuntime — execute automations as local binaries or as containers,
 * speaking the {@link ./protocol.ts | Container Execution Protocol}.
 *
 * Two modes:
 *
 *   - **Binary**: spawn a local executable directly (Rust/Go/Python binary).
 *     The runtime uses `node:child_process.spawn` by default; tests inject a
 *     `SpawnFn` to avoid actually running anything.
 *
 *   - **Container**: delegate to a host-provided {@link SandboxExecutor}.
 *     This is structurally compatible with Command Center's `DockerExecutor`
 *     (hardened isolation), so the SDK stays decoupled from any specific
 *     sandbox implementation.
 *
 * @public @since 1.2.0
 */
import { type ChildProcess } from "node:child_process";
import { type ExecutionResult } from "./protocol.js";
/**
 * Description of a sandboxed job — structurally identical to Command Center's
 * `SandboxJob`. Defined here so the SDK has no dependency on a specific
 * sandbox implementation.
 *
 * @public
 */
export interface SandboxJob {
    image: string;
    command: string[];
    stdin?: string;
    env?: Record<string, string>;
    cwd?: string;
    timeoutMs: number;
    networkMode?: "none" | "outbound" | "bridge";
    readOnlyRoot?: boolean;
    memoryMb?: number;
    cpuQuota?: number;
}
/**
 * Outcome of a sandbox run — structurally identical to Command Center's
 * `SandboxResult`.
 *
 * @public
 */
export interface SandboxResult {
    exitCode: number;
    stdout: string;
    stderr: string;
    timedOut: boolean;
    durationMs: number;
}
/**
 * Port for a process sandbox (Docker, Firecracker, etc.). The host injects an
 * implementation at runtime; the SDK never depends on a concrete sandbox.
 *
 * @public
 */
export interface SandboxExecutor {
    run(job: SandboxJob): Promise<SandboxResult>;
}
/**
 * Spawn function signature, mirrors `node:child_process.spawn`. Injectable so
 * tests can avoid spawning real subprocesses.
 *
 * @public
 */
export type SpawnFn = (cmd: string, args: string[], opts: {
    env?: NodeJS.ProcessEnv;
    cwd?: string;
    stdio: ["pipe", "pipe", "pipe"];
    signal?: AbortSignal;
}) => ChildProcess;
/**
 * Options for {@link ContainerRuntime.executeContainer}.
 *
 * @public
 */
export interface ContainerExecutionOptions {
    executionId?: string;
    timeoutSeconds?: number;
    extraEnv?: Record<string, string>;
    mode?: string;
    networkMode?: "none" | "outbound" | "bridge";
    readOnlyRoot?: boolean;
    memoryMb?: number;
    cpuQuota?: number;
}
/**
 * Options for {@link ContainerRuntime.executeBinary}.
 *
 * @public
 */
export interface BinaryExecutionOptions {
    executionId?: string;
    timeoutSeconds?: number;
    extraEnv?: Record<string, string>;
    cwd?: string;
    mode?: string;
}
/**
 * Construct a {@link ContainerRuntime} bound to a {@link SandboxExecutor}
 * (for container mode) and optionally a custom {@link SpawnFn} (for binary
 * mode tests).
 *
 * @public
 */
export interface ContainerRuntimeOptions {
    /** Sandbox executor for container mode. Required if executeContainer() is called. */
    sandbox?: SandboxExecutor;
    /** Spawn function for binary mode. Defaults to node:child_process.spawn. */
    spawnFn?: SpawnFn;
    /** Default timeout when callers don't specify one. */
    defaultTimeoutSeconds?: number;
}
/**
 * Run automations via either a sandboxed container (host-injected) or a local
 * binary subprocess. Both paths produce a uniform {@link ExecutionResult}.
 *
 * @public
 */
export declare class ContainerRuntime {
    private readonly sandbox;
    private readonly spawnFn;
    private readonly defaultTimeoutSeconds;
    constructor(opts?: ContainerRuntimeOptions);
    /**
     * Execute an automation packaged as a container image. Delegates to the
     * injected {@link SandboxExecutor} so isolation policy (caps, network,
     * read-only FS) lives in the host implementation.
     */
    executeContainer<T = unknown>(image: string, automationName: string, input: unknown, options?: ContainerExecutionOptions): Promise<ExecutionResult<T>>;
    /**
     * Execute an automation packaged as a local binary (Rust release, Python
     * wrapper, shell script). No container — just a hardened subprocess.
     */
    executeBinary<T = unknown>(command: string[], automationName: string, input: unknown, options?: BinaryExecutionOptions): Promise<ExecutionResult<T>>;
    private runSubprocess;
    private toExecutionResult;
}
//# sourceMappingURL=runtime.d.ts.map