import type { SandboxAdapter, SandboxMachine } from "../escalation/sandbox.js"; export interface BoxEditResult { ok: boolean; summary: string; filesChanged: string[]; testsRun: number; fns?: string[]; servesUi?: boolean; } /** The mutable inside-the-box state an in-box agent edits. */ export interface FakeBoxState { env: Record; /** The vendo.json the box serves (schedules + egress declarations). */ manifest: { schedules?: Array<{ cron: string; fn: string; }>; egress?: string[]; }; /** POST /fn/ handlers the agent installed. */ fns: Map) => unknown>; /** * Wave 4 (layer 3) — served pages the agent installed on non-/fn GET paths * (path → HTML body). When present, the box "serves a real web app". */ pages: Map; /** The box's disk, as the seam's `files` reads and writes it — the app's * SOURCE, distinct from the pages the box serves. */ files: Map; } /** The injectable in-box coding agent: mutates box state, returns a result. */ export type FakeBoxAgent = (task: { prompt: string; context?: string; env: Record; box: FakeBoxState; }) => BoxEditResult | Promise; interface FakeBoxOptions { agent?: FakeBoxAgent; } export interface FakeBoxAdapter extends SandboxAdapter { /** Every machine this adapter created (for assertions on live/torn-down state). */ readonly machines: FakeBoxMachine[]; } declare class FakeBoxMachine implements SandboxMachine { readonly state: FakeBoxState; readonly allowedDomains: readonly string[] | undefined; private readonly agent; readonly id: string; destroyed: boolean; stopped: boolean; /** Task results by id (control-port task store). */ private readonly tasks; /** The seam's file operations (sandbox.ts), over the box's own disk. */ readonly files: SandboxMachine["files"]; constructor(state: FakeBoxState, allowedDomains: readonly string[] | undefined, agent: FakeBoxAgent); private appPort; /** Every request that actually crossed into this box, in order — what a * payload-only assertion has to read (build contract §9.8). */ readonly received: Array<{ method: string; path: string; headers: Record; }>; request(req: { method: string; path: string; port?: number; headers?: Record; body?: Uint8Array | string; }): Promise<{ status: number; headers: Record; body: Uint8Array; }>; private control; private app; url(port?: number): Promise; snapshot(): Promise; stop(): Promise; destroy(): Promise; } export declare const fakeBoxSandbox: (options?: FakeBoxOptions) => FakeBoxAdapter; export {}; //# sourceMappingURL=fake-box.d.ts.map