/**
 * `runImprovementLoop` — the gated-promotion shell around the improvement
 * loop body (`runOptimization`). Proposes candidate surfaces via the
 * `SurfaceProposer`, re-scores the winner against the baseline on a
 * holdout set, runs the release gate, and optionally opens a PR.
 *
 * Role vocabulary (see docs/design/loop-taxonomy.md):
 *   - PROPOSER   = the `SurfaceProposer` (evolutionary GEPA mutator OR
 *                  reflective analyst). Proposes candidate SURFACES — the
 *                  worker's system prompt / tool config — NOT conversation
 *                  turns.
 *   - MEASUREMENT= `runCampaign`. Scores one surface by running the worker
 *                  (via `dispatch`) over scenarios and judging the output.
 *   - WORKER     = the agent harness in the sandbox, invoked behind the
 *                  topology-opaque `dispatch` seam — never referenced here.
 *
 * Distinct from `runLoop` in `@tangle-network/agent-runtime`, which is the
 * INNER conversation loop (execution driver ↔ workers in a sandbox). `runImprovementLoop`
 * is the OUTER loop: it improves the surface that those workers run.
 *
 * Hard-refuses unsafe configurations:
 *   - `tracing: 'off'` when a proposer is wired (improvement is unattributable)
 *   - `autoOnPromote: 'config'` — DEFERRED to Pass B; v0.40 only ships
 *     `'pr'` and `'none'`.
 */
import { openAutoPr } from '../auto-pr';
import type { CampaignResult, Gate, MutableSurface, Scenario } from '../types';
import type { RunOptimizationOptions, RunOptimizationResult } from './run-optimization';
export type RunImprovementLoopOptions<TScenario extends Scenario, TArtifact> = RunOptimizationOptions<TScenario, TArtifact> & {
    /** Holdout scenarios kept OUT of the training optimization pool — used
     *  ONLY to score baseline vs winner for the gate. */
    holdoutScenarios: TScenario[];
    /** Promotion gate. Substrate strongly recommends `defaultProductionGate`
     *  for production wiring (composes red-team / reward-hacking / canary /
     *  heldout). */
    gate: Gate<TArtifact, TScenario>;
    /** What to do when the gate ships:
     *   - `'pr'`: open a PR via `openAutoPr`
     *   - `'none'`: just report — caller decides what to do with the winner
     *  v0.40 does NOT support `'config'` (live-runtime self-mutation) —
     *  deferred to Pass B behind safety stack. */
    autoOnPromote: 'pr' | 'none';
    /** GH owner / repo for the auto-PR. Required when autoOnPromote === 'pr'. */
    ghOwner?: string;
    ghRepo?: string;
    /** Optional render override — substrate writes a diff-shaped surface; pass
     *  a function to format the promoted surface differently. */
    renderPromotedDiff?: (winnerSurface: MutableSurface, baselineSurface: MutableSurface) => string;
};
export interface RunImprovementLoopResult<TArtifact, TScenario extends Scenario> extends RunOptimizationResult<TArtifact, TScenario> {
    baselineOnHoldout: CampaignResult<TArtifact, TScenario>;
    winnerOnHoldout: CampaignResult<TArtifact, TScenario>;
    gateResult: Awaited<ReturnType<Gate<TArtifact, TScenario>['decide']>>;
    /** Unified baseline→winner surface diff. Computed UNCONDITIONALLY (not only
     *  when `autoOnPromote === 'pr'`) so the diff that the gate decided on is
     *  always present on the result + in the emitted provenance record. Empty
     *  string when winner == baseline (no change to diff). */
    promotedDiff: string;
    prResult?: ReturnType<typeof openAutoPr>;
}
export declare function runImprovementLoop<TScenario extends Scenario, TArtifact>(opts: RunImprovementLoopOptions<TScenario, TArtifact>): Promise<RunImprovementLoopResult<TArtifact, TScenario>>;
export declare function defaultRenderDiff(winnerSurface: MutableSurface, baselineSurface: MutableSurface): string;
//# sourceMappingURL=run-improvement-loop.d.ts.map