import type { SandboxAdapter, SandboxMachine } from "../escalation/sandbox.js"; export interface MachineRequest { method: string; path: string; port?: number; headers?: Record; body?: Uint8Array | string; } export interface MachineResponse { status: number; headers: Record; body: Uint8Array | string; } /** The box's boundary as the fake's in-process app handler sees it. */ export interface MachineAppContext { env: Readonly>; allowedDomains: readonly string[] | undefined; port: number; } export type MachineApp = (request: MachineRequest, ctx: MachineAppContext) => MachineResponse | Promise; /** The v2 create spec (the seam's SandboxAdapter.create parameter, kept local for the fake's internal signatures). */ export interface FakeCreateSpec { template?: string; env: Record; allowedDomains?: string[]; } /** Test machine with deterministic I/O and inspectable state. */ export declare class FakeSandboxMachine implements SandboxMachine { readonly id: string; readonly allowedDomains: readonly string[] | undefined; readonly template: string | undefined; private readonly saveSnapshot; readonly requests: MachineRequest[]; readonly fileContents: Map; /** The seam's file operations (sandbox.ts), over this machine's contents. * Url/request/snapshot are lifecycle-guarded separately. */ readonly files: SandboxMachine["files"]; readonly env: Record; readonly port: number; /** v2 sleep flag; also true once destroyed. Writable for test scripting. */ stopped: boolean; /** v2 gone-for-good flag. */ destroyed: boolean; app: MachineApp | undefined; constructor(id: string, env: Record, allowedDomains: readonly string[] | undefined, template: string | undefined, files: ReadonlyMap, app: MachineApp | undefined, saveSnapshot: (machine: FakeSandboxMachine) => string); private appContext; private ensureRunning; request(request: MachineRequest): Promise<{ status: number; headers: Record; body: Uint8Array; }>; setApp(app: MachineApp): void; snapshot(): Promise; url(port?: number): Promise; stop(): Promise; destroy(): Promise; } export interface FakeSandboxAdapter extends SandboxAdapter { readonly machines: Map; create(spec: FakeCreateSpec): Promise; resume(snapshotRef: string, policy?: { allowedDomains: string[] | undefined; }): Promise; setApp(app: MachineApp): void; } /** Create an in-process sandbox adapter whose requests dispatch to a machine app handler. */ export declare const fakeSandbox: (options?: { app?: MachineApp; }) => FakeSandboxAdapter; //# sourceMappingURL=fake-sandbox.d.ts.map