/**
 * Verifier Ladder
 *
 * Turns the repository's completion gates (build, type-check, test, lint)
 * into a programmatic verifier that the convergence loop can call after each
 * model iteration. Each rung runs a real command in the project root; the
 * ladder reports a pass/fail per rung, an aggregate score (fraction of rungs
 * passed), and structured feedback sized for small-model context budgets.
 *
 * Detection is npm-centric (package.json scripts); callers targeting other
 * ecosystems can pass explicit rungs.
 */
export interface GateRung {
    /** Stable identifier, e.g. 'build', 'typecheck', 'test', 'lint' */
    id: string;
    /** Human-readable name shown in feedback */
    name: string;
    /** Executable to run (no shell interpolation) */
    command: string;
    /** Arguments passed verbatim */
    args: string[];
    /**
     * Required rungs gate delivery: the ladder only passes when all required
     * rungs pass, and a required failure stops later rungs (fail-fast).
     * Optional rungs are reported but never block delivery.
     */
    required: boolean;
    /** Per-rung timeout in milliseconds */
    timeoutMs: number;
}
export type RungFailureReason = 'exit' | 'timeout' | 'signal' | 'spawn-error';
export interface RungResult {
    id: string;
    name: string;
    passed: boolean;
    /** True when the rung never ran because an earlier required rung failed */
    skipped: boolean;
    exitCode: number | null;
    /** Why the rung failed; undefined when it passed or was skipped */
    failureReason?: RungFailureReason;
    durationMs: number;
    /** Tail of combined stdout+stderr, truncated for prompt injection */
    outputTail: string;
}
export interface LadderResult {
    /** True when every required rung passed */
    passed: boolean;
    /** Fraction of all rungs that passed (skipped rungs count as not passed) */
    score: number;
    results: RungResult[];
    /** Structured feedback for the next loop iteration */
    feedback: string;
}
export interface LadderOptions {
    /** Stop at the first failing required rung (default true — cheaper feedback) */
    failFast?: boolean;
    /** Max characters of command output included per failing rung (default 2000) */
    outputTailChars?: number;
    /** Default per-rung timeout in ms (default 300000) */
    timeoutMs?: number;
}
/**
 * Detect the gate rungs available in a project from its package.json scripts.
 * Order matters: cheap/structural gates run before expensive ones so failure
 * feedback arrives fast.
 */
export declare function detectRungs(projectRoot: string, timeoutMs?: number): GateRung[];
/** Run a single rung synchronously in the project root. */
export declare function runRung(rung: GateRung, projectRoot: string, tailChars?: number): RungResult;
/**
 * Build feedback text from rung results. Only the first failing required
 * rung's output is included in detail — small models do better with one
 * concrete problem at a time than with a wall of every failure.
 */
export declare function formatFeedback(results: RungResult[], rungs: GateRung[]): string;
/** Run the full ladder, honoring fail-fast for required rungs. */
export declare function runLadder(rungs: GateRung[], projectRoot: string, options?: LadderOptions): LadderResult;
//# sourceMappingURL=verifier-ladder.d.ts.map