import { A as AnalystRegistry } from './default-registry-GyE8X5SP.js';
import { a as DatasetScenario } from './dataset-BbGkaN2I.js';
import { R as RunRecord } from './run-record-CP2ObebC.js';
import { I as InsightReport } from './insight-report-BnRjTibG.js';

/**
 * # `analyzeRuns()` — turn a set of agent runs into an actionable decision packet.
 *
 * Wires the substrate's statistical, calibration, clustering, Pareto, and
 * release-confidence primitives into one `InsightReport`. Two top-level
 * entry points use this function:
 *
 *   - `selfImprove()` calls it on the campaign output to attach a packet
 *     to every run.
 *   - Consumers with observed `RunRecord[]` (production traces, gold
 *     corpora, approve/reject tables) call it directly via `analyzeRuns()`
 *     for analysis without a closed loop.
 *
 * Every section is opt-in based on what the input data supports — the
 * function never invents signal. If runs carry no judge scores, `judges`
 * is empty. If there's no baseline/candidate split, `lift` is undefined.
 * If no `analyst` is wired, `failureClusters` is undefined.
 *
 * The `recommendations` array is the human-readable layer; everything
 * else is the evidence backing each recommendation.
 */

interface AnalyzeRunsOptions {
    /** The runs to analyze. */
    runs: RunRecord[];
    /** Which split to score against when reading composite from RunOutcome.
     *  Default: holdout when ANY run has a `holdoutScore`, else search. */
    split?: 'search' | 'holdout' | 'auto';
    /** Pairwise analysis configuration. When both `baselineCandidateId` and
     *  `candidateCandidateId` are present, lift is computed on paired
     *  (experimentId, seed) tuples shared between the two sides. */
    baselineCandidateId?: string;
    candidateCandidateId?: string;
    /** Canary scenarios — checked against every run's raw output for
     *  holdout contamination. */
    canaryScenarios?: DatasetScenario[];
    /** Analyst registry for failure clustering. When omitted, the
     *  `failureClusters` section is left undefined. */
    analyst?: AnalystRegistry;
    /** Downstream outcome metric per run (e.g. engagement rate, approval
     *  rate, downstream pass rate). When present, the report includes
     *  `outcomeCorrelation` + a simple linear reward model fit. */
    outcomeSignal?: {
        metric: string;
        valueByRunId: Record<string, number>;
    };
    /** Multi-rater feedback for inter-rater agreement. Each entry is one
     *  rater's score for one run. Two or more raters → kappa + disagreement
     *  triage list. */
    raterScores?: Array<{
        runId: string;
        rater: string;
        score: number;
    }>;
    /** Number of histogram bins for distributional summaries. Default 12. */
    histogramBins?: number;
    /** Decision threshold — the smallest composite lift the caller cares
     *  about. Used by the recommendations engine to call ship vs hold.
     *  Default 0.02. */
    decisionThreshold?: number;
    /** Optional prior-period runs. When set, the report includes
     *  `priorPeriodComparison` with per-metric Welch-CI deltas and
     *  recommendations fire on statistically significant regressions.
     *  The two windows do NOT have to share scenarios — the comparison
     *  is two-sample unpaired (the substrate's `lift` field uses paired
     *  bootstrap on shared (experimentId, seed) tuples; this is the
     *  shape for "this week vs last week" rather than "candidate vs
     *  baseline within a campaign"). */
    baselineRuns?: RunRecord[];
    /** Human-readable label for the baseline window, e.g. "vs prior 7
     *  days", "vs v3.1 release". Surfaces in recommendations + UI. */
    baselineLabel?: string;
}
declare function analyzeRuns(opts: AnalyzeRunsOptions): Promise<InsightReport>;

export { type AnalyzeRunsOptions as A, analyzeRuns as a };
