/**
 * `runCampaign` — Pass A substrate primitive. ONE function that orchestrates
 * scenarios → dispatch → artifacts → judges → aggregates, with full
 * reproducibility (seed + manifest hash), cell-level resumability, bootstrap
 * CIs, and the `LabeledScenarioStore` capture flywheel.
 *
 * Improvement loops (optimizer / gate / autoOnPromote) ride on top of this
 * primitive but live in `presets/run-improvement-loop.ts`. This file keeps
 * the core orchestrator minimal — Phase 1 of the Pass A track.
 */
import { type CampaignStorage } from './storage';
import type { CampaignResult, CampaignTraceWriter, DispatchFn, JudgeConfig, LabeledScenarioStore, Scenario } from './types';
export interface RunCampaignOptions<TScenario extends Scenario, TArtifact> {
    scenarios: TScenario[];
    dispatch: DispatchFn<TScenario, TArtifact>;
    judges?: JudgeConfig<TArtifact, TScenario>[];
    /** Required for reproducibility. Default 42. */
    seed?: number;
    /** Per-scenario replicates for CI bands. Default 1; raise to 5+ for
     *  bootstrap-tight intervals on critical eval. */
    reps?: number;
    /** When true (default), completed cells are cached by
     *  (manifestHash, scenarioId, rep, generation). Re-runs skip cached cells. */
    resumable?: boolean;
    /** Optional store — when present, every artifact + judge score is captured
     *  with the configured `captureSource`. Capture is default ON; pass `'off'`
     *  to disable. */
    labeledStore?: LabeledScenarioStore | 'off';
    captureSource?: 'production-trace' | 'eval-run' | 'manual' | 'red-team' | 'synthetic';
    captureSourceVersionHash?: string;
    /** Wall-clock cost cap across all cells. Cells beyond ceiling are skipped. */
    costCeiling?: number;
    /** Max concurrent cells. Default 2. */
    maxConcurrency?: number;
    /**
     * Per-cell dispatch deadline in ms. A `dispatch` that neither resolves nor
     * rejects within this window is a hang (a stalled model request, an
     * exhausted runtime resource, a backend that never closes its stream). When
     * set, the cell's `ctx.signal` is aborted and the cell is recorded as a LOUD
     * error (`dispatch exceeded <N>ms`) so the campaign proceeds and the failure
     * is visible — instead of one wedged cell silently hanging the whole run (and
     * every loop/CI job above it) forever. `undefined`/`0` = unbounded (legacy).
     */
    dispatchTimeoutMs?: number;
    /** Required: where artifacts + traces land. */
    runDir: string;
    /** Tracing posture. Default is the substrate's `FileSystemTraceStore` rooted
     *  at `<runDir>/traces/`. `'off'` disables capture entirely — substrate
     *  refuses this when the caller wires `autoOnPromote !== 'none'`. */
    tracing?: 'on' | 'off';
    /**
     * Per-cell usage expectation — the early, fine-grained sibling of the
     * batch `assertRealBackend` guard. A cell that produced an artifact (no
     * error) but reported `costUsd === 0` AND zero tokens is a stub: the
     * dispatch never reported LLM activity via `ctx.cost`. Modes:
     *   - `'warn'` (default) — log the offending cell loudly, keep going.
     *   - `'assert'` — throw `BackendIntegrityError` on the first such cell
     *     (fail-fast; recommended for CI campaigns expecting real LLM calls).
     *   - `'off'` — no check (replay / deterministic-only / offline analysis).
     */
    expectUsage?: 'assert' | 'warn' | 'off';
    /** Test seam — override the wall clock for deterministic tests. */
    now?: () => Date;
    /** Test seam — override per-cell trace writer factory. */
    buildTraceWriter?: (cellId: string, dir: string) => CampaignTraceWriter;
    /** Storage backend for run/cell dirs, the resumability cache, artifacts,
     *  and trace spans. Default: the Node filesystem (`fsCampaignStorage`).
     *  Pass `inMemoryCampaignStorage()` to run in a filesystem-less runtime
     *  (Cloudflare Workers, Deno, edge) — the `CampaignResult` is still
     *  produced; artifacts/traces just aren't persisted to disk. */
    storage?: CampaignStorage;
    /**
     * Optional per-cell placement strategy. Returns an opaque string the
     * substrate forwards as `ctx.placement` to the Dispatch — placement-aware
     * Dispatches (e.g. `httpDispatch` from `/adapters/http`) use it to route
     * each cell to the right worker, region, or sandbox. When unset, every
     * cell receives `ctx.placement = undefined` and behaves identically to
     * the in-process case.
     *
     * @example
     *   cellPlacement: ({ scenario }) => scenario.tags?.includes('eu') ? 'eu-west' : 'us-east'
     */
    cellPlacement?: (input: {
        scenario: TScenario;
        rep: number;
        generation?: number;
    }) => string | undefined;
}
export declare function runCampaign<TScenario extends Scenario, TArtifact>(opts: RunCampaignOptions<TScenario, TArtifact>): Promise<CampaignResult<TArtifact, TScenario>>;
//# sourceMappingURL=run-campaign.d.ts.map