/** * The execution body: Context → Plan → Execute → Judge → Report. Every variable behavior * is injected (invariant #2); with a fixed-scenario Planner + deterministic Critic, no LLM * runs (invariant #4). */ import type { CustomAction, Harness, StepHandler, StepHealer } from "./ports.js"; import type { Result, RunUsage, StepProgress } from "./types.js"; import type { TraceScope } from "./trace.js"; /** * Seams a host (CLI, desktop app, CI) plugs into — the engine emits/accepts, the host * decides what to do. `onStep` for a live timeline, `captureScreenshots` for visual * replay, `signal` for a Stop button, `actions` for product-defined interactions. None of * these put UI in the engine. */ export interface RunHarnessOptions { signal?: AbortSignal; onStep?: (progress: StepProgress) => void; captureScreenshots?: boolean; /** Product-defined interactions for `{ kind: "custom", name }` steps, registered by name. */ actions?: Record; /** Replace the Execute-stage dispatch chain entirely (advanced); defaults to built-ins + `actions`. */ stepHandlers?: StepHandler[]; /** Repair a step whose `expect` fails (surgical self-heal); absent → a diverged step just fails. */ stepHealer?: StepHealer; /** How long a step's `expect` is polled (readiness) before it counts as diverged. Default 2000ms. */ expectTimeoutMs?: number; /** Snapshot of the run's LLM usage, taken after Judge and attached as `result.usage` — so every * report carries its own cost proof (a clean replay shows `llmCalls: 0`). */ usage?: () => RunUsage; /** First-path-segment prefixes URL matching may strip as locales (fallback only, #86). Which * segments are locales is an app trait the consumer declares — the engine default is a small * conservative list (`DEFAULT_LOCALE_PREFIXES`); override it when the app serves other locales * or has real routes that look like locales (`/my`, `/tv`). `[]` disables stripping. */ localePrefixes?: readonly string[]; /** Per-event trace scope (spec/core/trace.md) — `step`/`assertion`/`heal` kinds; absent → no emission. */ trace?: TraceScope; } export declare function runHarness(harness: Harness, task: string, opts?: RunHarnessOptions): Promise;