type AgentProfileCellSchemaVersion = 'agent-profile-cell/v1';
type AgentProfileDimensionValue = string | number | boolean | null;
interface AgentProfileSource {
    /** Runtime/profile contract being fingerprinted, e.g. `agent-interface-profile`. */
    kind: string;
    /** sha256 over the canonical source profile object. */
    hash: string;
}
interface AgentProfileHarness {
    id: string;
    version?: string;
    hash?: string;
}
interface AgentProfileCell {
    schemaVersion: AgentProfileCellSchemaVersion;
    cellId: string;
    profileId: string;
    sourceProfile: AgentProfileSource;
    harness?: AgentProfileHarness;
    model?: string;
    promptHash?: string;
    dimensions?: Record<string, AgentProfileDimensionValue>;
}

type FailureClass = 'success' | 'reasoning_error' | 'tool_selection_error' | 'tool_argument_error' | 'tool_recovery_failure' | 'hallucination' | 'instruction_following' | 'safety_refusal_miss' | 'policy_violation' | 'budget_exceeded' | 'format_drift' | 'permission_escalation' | 'pii_leak' | 'cost_overrun' | 'timeout' | 'sandbox_failure' | 'missing_user_data' | 'missing_domain_data' | 'missing_codebase_context' | 'missing_runtime_context' | 'missing_credentials' | 'missing_integration_connection' | 'missing_integration_scope' | 'integration_approval_required' | 'integration_auth_expired' | 'integration_provider_failure' | 'bad_integration_manifest' | 'unsafe_integration_write_denied' | 'stale_external_data' | 'bad_retrieval' | 'insufficient_evidence' | 'contradictory_evidence' | 'ambiguous_user_intent' | 'knowledge_readiness_blocked' | 'unknown';

/**
 * Paper-grade RunRecord schema + runtime validator.
 *
 * Every run that participates in a promotion gate, paper table, or
 * researcher loop SHOULD be recorded as a `RunRecord`. The mandatory
 * fields are exactly those the paper "Two Loops, Three Roles" requires
 * for reproducibility: who/what/when/cost/seed/hash, plus the search vs
 * holdout split tag and either a `searchScore` or a `holdoutScore`.
 *
 * This is intentionally NOT a replacement for the rich `Run` /
 * `ProposeReviewReport` / `ScenarioResult` types already in the
 * package. Those are runtime structures with full provenance. A
 * `RunRecord` is the analysis-time projection — the JSON-friendly
 * row you'd put in a parquet file or paste into a notebook.
 *
 * Validate at the boundary:
 *
 *   const rec = validateRunRecord(rawJson)         // throws on missing
 *   const ok  = isRunRecord(rawJson)               // boolean check
 *   const rec = parseRunRecordSafe(rawJson)        // { ok, value | error }
 *
 * The validator runs in pure TS — zod is intentionally NOT a
 * dependency. Round-trip tested in `tests/run-record.test.ts`.
 */

/** Search/dev/holdout split tag. 'search' is the paper-grade alias for the
 *  combined train+test pool that the optimizer is allowed to read. */
type RunSplitTag = 'search' | 'dev' | 'holdout';
interface RunTokenUsage {
    input: number;
    /** All generated tokens charged as output, including reasoning tokens. */
    output: number;
    /** Reasoning-token subset of `output`, when the provider reports it. */
    reasoning?: number;
    /** Prompt tokens served from a provider cache. */
    cached?: number;
    /** Prompt tokens written into a provider cache. */
    cacheWrite?: number;
}
/**
 * How a run's USD amount was obtained.
 *
 * `costUsd` remains mandatory for wire compatibility. New producers should
 * always populate this discriminated union so a missing bill is never
 * mistaken for an observed zero-dollar run. For `uncaptured`, `costUsd` uses
 * the legacy `0` sentinel while this field carries the truthful null.
 */
type RunCostProvenance = {
    kind: 'observed';
    usd: number;
} | {
    kind: 'estimated';
    usd: number;
} | {
    kind: 'uncaptured';
    usd: null;
};
interface RunJudgeMetadata {
    model: string;
    promptVersion: string;
    /** [0,1] confidence the judge declared. Constant judge confidence
     *  across many runs is a fallback signal (see `canary.ts`). */
    confidence: number;
    /** True if the judge degraded to a fallback path (rules-only,
     *  prior-call cache, etc.). The canary uses this to alert. */
    fallback: boolean;
}
/**
 * Per-judge / per-dimension breakdown for runs scored by an ensemble of
 * judges over a multi-dimensional rubric.
 *
 * The collapsed `outcome.searchScore` / `holdoutScore` carries the
 * composite the gate uses. The full breakdown belongs here so consumers
 * can answer "which judge disagreed?", "which dimension dragged the
 * composite down?", and "did half the panel fail?" without re-running.
 *
 * `perJudge[judgeId][dim]` is the canonical source; `perDimMean` and
 * `composite` are convenience projections — derivable but precomputed so
 * downstream IRR primitives (`interRaterReliability`,
 * `corpusInterRaterAgreement`) and reporters don't pay the same
 * aggregation twice.
 *
 * Fail-loud discipline: judges that errored out land in `failedJudges`
 * by id. A missing key in `perJudge` is ambiguous (silent zero vs not
 * run); the explicit list makes a partial-failure recorded as such.
 */
interface JudgeScoresRecord {
    /** Per-judge per-dimension scores. `{ "kimi-k2.6": { helpfulness: 0.8, clarity: 0.7 }, ... }`. */
    perJudge: Record<string, Record<string, number>>;
    /** Per-dim mean across judges. Convenience — derivable from `perJudge`. */
    perDimMean: Record<string, number>;
    /** Composite mean across all dims and judges. Mirrors the score
     *  the gate sees on `outcome.searchScore` / `holdoutScore`. */
    composite: number;
    /** Judges that errored or returned an unparseable verdict. Recorded
     *  by id (e.g. `['glm-5.1']`) so a partial-failure case is explicit,
     *  not inferred from missing keys in `perJudge`. */
    failedJudges?: string[];
    /** Free-form notes the judges emitted (joined across judges or
     *  first-judge only — consumer's choice). */
    notes?: string;
}
interface RunOutcome {
    /** Score on the search/optimization split. Optional because a
     *  holdout-only evaluation only fills `holdoutScore`. */
    searchScore?: number;
    /** Score on the held-out split. Optional because a search-only run
     *  only fills `searchScore`. At least one must be present. */
    holdoutScore?: number;
    /** Bag of any other metric the run produced — judge dimensions,
     *  pass/fail counters, latency stats, etc. Numeric only — keeps
     *  reporters honest. */
    raw: Record<string, number>;
    /** Per-judge / per-dim breakdown. Consumers writing ensemble
     *  judgements populate this; substrate primitives like
     *  `interRaterReliability` and `corpusInterRaterAgreement` accept
     *  these records as input. Optional — single-judge or scalar-only
     *  runs leave it unset. */
    judgeScores?: JudgeScoresRecord;
    /** Authenticity / realness verdict — did the run build the REAL thing on the
     *  intended infra, or fake it (see `./authenticity`)? Optional: only domains
     *  with an authenticity config populate it. Carried in the corpus so the
     *  flywheel / off-policy learning can optimize for real completion, not gamed
     *  pass-rate. `score` is 0-1; `gated` is the anti-Goodhart flag — a gated run
     *  must not count as a real success regardless of `score`. */
    realness?: {
        score: number;
        gated: boolean;
        reason?: string;
    };
}
/**
 * Mandatory paper-grade fields for a single evaluation run. Optional
 * fields are extension points; mandatory fields throw if missing.
 *
 * Hash discipline:
 *   - `promptHash` is the sha256 of the EFFECTIVE prompt sent to the
 *     model (after any steering bundle merge).
 *   - `configHash` is the sha256 of the effective run config (model,
 *     temperature, tools, judges, splits). The pair (promptHash,
 *     configHash) uniquely identifies an experiment cell.
 *
 * Model snapshot discipline:
 *   - `model` MUST encode a snapshot version. Bare aliases like
 *     `claude-sonnet-4` or `gpt-4o` are banned — they remap silently.
 *     Use `claude-sonnet-4-6@2025-04-15` or `gpt-4o-2024-11-20`.
 */
interface RunRecord {
    /** UUID for the run. */
    runId: string;
    /** Logical experiment grouping (a treatment vs a baseline within
     *  the same sweep should share `experimentId`). */
    experimentId: string;
    /** Stable identifier for the candidate (variant) being run. The
     *  promotion gate compares two `candidateId`s on matched items. */
    candidateId: string;
    /** RNG seed for the run. Always recorded — silent re-seeding is
     *  the most common cause of non-reproducible numbers. */
    seed: number;
    /** Model identifier WITH snapshot version. */
    model: string;
    /** sha256 of the effective prompt (post-steering). */
    promptHash: string;
    /** sha256 of the effective config. */
    configHash: string;
    /** Git SHA the harness was run from. */
    commitSha: string;
    /** End-to-end wall-clock duration in milliseconds. */
    wallMs: number;
    /** Time spent queued before execution started, if known. */
    queueMs?: number;
    /** Total USD cost. Mandatory — runs without a cost number are
     *  unbounded by definition and must not be admitted into the gate.
     *  `0` is retained as the compatibility sentinel for an uncaptured amount;
     *  inspect `costProvenance` before treating it as observed. */
    costUsd: number;
    /** Observed, model-priced estimate, or genuinely uncaptured USD amount.
     *  Optional only so existing serialized RunRecords remain valid. */
    costProvenance?: RunCostProvenance;
    /** Token usage breakdown. */
    tokenUsage: RunTokenUsage;
    /** Judge-side metadata, if a judge was used. */
    judgeMetadata?: RunJudgeMetadata;
    /** Per-split scores + raw bag. */
    outcome: RunOutcome;
    /** Canonical, cross-agent failure class drawn from the shared
     *  `FAILURE_CLASSES` taxonomy. This is the aggregation key that makes
     *  "which failure dominates across the whole fleet" answerable in ONE
     *  vocabulary — every agent classifies against the same enum. Producers
     *  set it via the substrate classifier; leave unset only when the failure
     *  genuinely can't be classified. */
    failureClass?: FailureClass;
    /** Free-form domain-specific failure detail, scoped UNDER `failureClass`
     *  (e.g. failureClass='tool_recovery_failure', failureMode='forge_build_unsatisfied').
     *  The within-agent drill-down; `failureClass` is the cross-agent key. */
    failureMode?: string;
    /** Which split this run was drawn from. */
    splitTag: RunSplitTag;
    /**
     * Stable scenario identifier the run was scored against. Optional for
     * backwards compatibility, but **strongly recommended**: every primitive
     * that pairs runs by scenario (preferences, paired stats, BT tournament)
     * keys on this. The campaign artifact populates it canonically; legacy
     * runs without it fall back to inference from `outcome.raw.scenario_id`
     * or `experimentId`.
     */
    scenarioId?: string;
    /**
     * Canonical identity for the agent profile cell that produced this row:
     * profile artifact hash plus optional harness/model/prompt/reporting
     * dimensions. Use `agentProfile.cellId` to group persona sweeps and
     * longitudinal reports by the complete source profile, not by a loose
     * candidate label or opaque config hash.
     */
    agentProfile?: AgentProfileCell;
}

/**
 * OutcomeStore — deployment outcomes attached to Run IDs.
 *
 * Outcomes arrive asynchronously from production telemetry after the
 * eval run completed: user ratings, retention flags, conversion events,
 * revenue, support-ticket rate, anything a product team can measure.
 * The store is a peer to TraceStore — separate lifecycle, same runId
 * foreign key.
 *
 * The whole point of this module is to make the meta-eval correlation
 * question computable: `correlate(evalMetric, outcomeMetric) → r, ρ, n, CI`.
 */
interface DeploymentOutcome {
    runId: string;
    capturedAt: number;
    /** Numeric outcomes keyed by name — retention_7d, csat, revenue_usd, etc. */
    metrics: Record<string, number>;
    /** Dimensions for stratified analysis — cohort, region, user_segment. */
    labels?: Record<string, string>;
    /** Free-form provenance (source system, pipeline version). */
    source?: string;
}
interface OutcomeFilter {
    runIds?: string[];
    since?: number;
    until?: number;
    label?: {
        key: string;
        value: string;
    };
    source?: string;
}
interface OutcomeStore {
    append(outcome: DeploymentOutcome): Promise<void>;
    /** All outcomes attached to this run (a single run can have many — multiple
     *  capture windows over deployment time). */
    forRun(runId: string): Promise<DeploymentOutcome[]>;
    list(filter?: OutcomeFilter): Promise<DeploymentOutcome[]>;
}

/**
 * Rubric predictive validity — does our eval rubric predict deployment
 * outcomes?
 *
 * `correlationStudy` (already in this package) joins a `TraceStore` to an
 * `OutcomeStore` and computes Pearson + Spearman + bootstrap CI for each
 * (eval-metric, outcome-metric) pair. That answers "does X correlate with
 * Y at all." `rubricPredictiveValidity` is the campaign-shaped wrapper
 * around it: take a sequence of `RunRecord`s (the canonical campaign
 * artifact) and a `DeploymentOutcomeStore`, join on `runId`, return a
 * ranked verdict on every rubric whose dimension scores were captured in
 * `outcome.raw`.
 *
 * The point — quoting the methodology doc — is that **without this loop
 * every rubric is faith-based**. Once it's wired, you know which rubrics
 * have earned their promotion power and which ones are decoration.
 *
 *   const validity = await rubricPredictiveValidity({
 *     runs: lastQuarter,
 *     outcomes: shipFlagOutcomeStore,
 *     outcomeMetrics: ['revenue_lift', 'retention_30d', 'csat'],
 *     rubrics: ['anti_slop', 'semantic_concept', 'tool_recovery'],
 *   })
 *   for (const r of validity.ranked) {
 *     console.log(`${r.rubric} → ${r.bestOutcome}: ρ=${r.spearman.toFixed(2)}`)
 *   }
 *
 * The function is intentionally read-only. Use the verdict to deprecate
 * decorative rubrics, re-weight composite scores, or trigger a
 * recalibration sweep when predictive validity drops below a threshold.
 */

interface RubricPredictiveValidityInput {
    /**
     * Canonical campaign output. Each record's `outcome.raw[<rubricId>]`
     * provides the eval score; missing keys are silently skipped per pair.
     */
    runs: RunRecord[];
    outcomes: OutcomeStore;
    /**
     * Outcome metric names to evaluate against. Each must appear in at
     * least one `DeploymentOutcome.metrics` keyspace; pairs with too few
     * joined samples are excluded from the result.
     */
    outcomeMetrics: string[];
    /**
     * Rubric ids to evaluate. Must appear as keys in `RunRecord.outcome.raw`.
     * If omitted, every numeric key in `outcome.raw` across the run set is
     * treated as a rubric.
     */
    rubrics?: string[];
    /** Minimum joined-sample count before a pair is reported. Default 8. */
    minSamples?: number;
    /** Bootstrap resamples for CI. Default 500. */
    bootstrapResamples?: number;
    /** Random seed for the bootstrap (mulberry32). Default unset (Math.random). */
    seed?: number;
    /**
     * Reduction when multiple outcomes attach to one runId. Default `'latest'`
     * (most recently captured).
     */
    reduction?: 'latest' | 'mean' | 'max';
}
interface RubricOutcomePair {
    rubric: string;
    outcome: string;
    n: number;
    pearson: number;
    spearman: number;
    ci95: {
        low: number;
        high: number;
    };
    /**
     * Verdict bucket. `load_bearing` ≥ 0.7, `informative` ≥ 0.4,
     * `decorative` < 0.4 in absolute correlation. A negative correlation
     * with a desired outcome is also `decorative` — actively misleading
     * is worse than uninformative.
     */
    verdict: 'load_bearing' | 'informative' | 'decorative';
}
interface RubricRanking {
    rubric: string;
    /** Outcome metric this rubric correlated best with. */
    bestOutcome: string;
    spearman: number;
    pearson: number;
    n: number;
    verdict: RubricOutcomePair['verdict'];
}
interface RubricPredictiveValidityReport {
    pairs: RubricOutcomePair[];
    /** Per-rubric best pair, sorted descending by |spearman|. */
    ranked: RubricRanking[];
    joinedSamples: number;
    skippedRuns: number;
    /** Rubrics that were declared but never produced a usable score. */
    rubricsWithoutData: string[];
}
declare function rubricPredictiveValidity(input: RubricPredictiveValidityInput): Promise<RubricPredictiveValidityReport>;

/**
 * Bootstrap-CI promotion gate.
 *
 * In any iterative-improvement loop (GEPA, prompt evolution, dataset
 * curation), the question is "did this generation actually improve, or are
 * we celebrating noise?". With small N and noisy outcomes, point-estimate
 * deltas lie. Bootstrap confidence intervals tell the operator whether the
 * delta is real before code or prompts get promoted.
 *
 * This module is pure functions — no I/O, no model calls. Easy to unit-test
 * and to compose into any verdict gate.
 *
 * Default gate:
 *   - Bootstrap mean baseline vs candidate (1k resamples).
 *   - Compute the delta distribution; pass if the lower CI bound > 0.
 *   - Tunable confidence (default 95%) and resample count.
 *
 * Verdict semantics intentionally match the existing `experiments.jsonl`
 * vocabulary:
 *   - ADVANCE: candidate's CI lower bound > baseline mean (real win)
 *   - KEEP:    overlap, but candidate point estimate >= baseline (neutral)
 *   - REVERT:  candidate's CI upper bound < baseline mean (real regression)
 *   - INCONCLUSIVE: not enough samples or CI straddles zero with no signal
 */
type Verdict = 'ADVANCE' | 'KEEP' | 'REVERT' | 'INCONCLUSIVE';
interface BootstrapResult {
    baselineMean: number;
    candidateMean: number;
    /** candidateMean - baselineMean, point estimate. */
    delta: number;
    /** Lower bound of the (1 - alpha) CI on the delta. */
    ciLower: number;
    /** Upper bound of the (1 - alpha) CI on the delta. */
    ciUpper: number;
    /** Number of bootstrap resamples used. */
    iterations: number;
    alpha: number;
    verdict: Verdict;
}
interface BootstrapOptions {
    /** Confidence level alpha (default 0.05 → 95% CI). */
    alpha?: number;
    /** Number of resamples (default 1000). */
    iterations?: number;
    /**
     * Minimum total samples (baseline + candidate) below which we always
     * return INCONCLUSIVE — bootstrap with too few samples is meaningless.
     * Default 6 (combined).
     */
    minTotalSamples?: number;
    /** RNG seed for reproducibility. Default: Math.random. */
    seed?: number;
}
/**
 * Compute the bootstrap CI on (candidateMean - baselineMean) and a verdict.
 *
 * Uses simple percentile bootstrap on the difference of resampled means.
 * That's the standard non-parametric primitive — no distributional
 * assumptions, robust to skew, easy to reason about.
 */
declare function bootstrapCi(baseline: number[], candidate: number[], options?: BootstrapOptions): BootstrapResult;
/**
 * Judge-replay promotion gate.
 *
 * The cheap inner-loop judge that drives an evolution run is by definition
 * fast and noisy. When you're about to promote a winning variant to the
 * canonical default, you want a STRONGER judge (a more expensive model, a
 * human grader, a separately-trained reward model) to confirm the win
 * generalises beyond the inner loop.
 *
 * This helper takes raw winner + baseline outputs, scores both through the
 * stronger judge, and applies `bootstrapCi`. ADVANCE means the stronger
 * judge agrees the winner is real with the configured confidence. Doesn't
 * matter what shape your "output" is — pass a string, an object, anything
 * the judge can read.
 */
interface JudgeReplayGateArgs<TOutput> {
    baselineOutputs: TOutput[];
    candidateOutputs: TOutput[];
    /** Stronger judge — async to allow LLM calls. Return a 0..N scalar score. */
    judge: (output: TOutput) => Promise<number> | number;
    alpha?: number;
    iterations?: number;
    /** RNG seed for reproducibility. */
    seed?: number;
    /** Maximum concurrent judge calls. Default 4. */
    judgeConcurrency?: number;
}
/**
 * Confirm a candidate's win with a stronger judge: score baseline and candidate outputs independently, then bootstrap a CI to verify the lift generalises beyond the inner loop.
 */
declare function judgeReplayGate<TOutput>(args: JudgeReplayGateArgs<TOutput>): Promise<BootstrapResult & {
    baselineSamples: number;
    candidateSamples: number;
}>;

/**
 * Dataset — versioned, sliceable, content-hashed scenario collection.
 *
 * Scenarios stop being ephemeral arrays and become first-class
 * artifacts. Every Dataset carries:
 *   - content hash (sha256 over canonicalized scenario array)
 *   - provenance (contributor, createdAt, sourceUrl)
 *   - split labels (train | dev | test | holdout)
 *   - difficulty tiers (easy | medium | hard | extreme)
 *   - tags (free-form, per-scenario)
 *
 * `Dataset.slice({ difficulty, split, holdout, seed })` returns a
 * deterministic, reproducible subset. Holdout slices are locked: you
 * can read them but `mutate` throws, which prevents "oh I'll just
 * tweak that one scenario" contamination drift.
 */
type DatasetSplit = 'train' | 'dev' | 'test' | 'holdout';
type DatasetDifficulty = 'easy' | 'medium' | 'hard' | 'extreme';
interface DatasetScenario {
    id: string;
    /** Arbitrary payload; the framework doesn't interpret it. */
    payload: unknown;
    split?: DatasetSplit;
    difficulty?: DatasetDifficulty;
    /** Canary token that MUST NOT round-trip through a correct agent output. */
    canary?: string;
    /**
     * Behavioral-canary forbidden pattern. A string OR a serialized regex
     * (`/.../flags`) that the agent under test MUST NOT emit. Used by
     * {@link import('./canary').checkBehavioralCanary | checkBehavioralCanary},
     * which inverts the contamination-style semantic: presence in the
     * agent output is a LEAK / failure, not a positive signal.
     *
     * Falls back to {@link canary} when omitted.
     */
    forbiddenPattern?: string;
    tags?: Record<string, string>;
}
interface DatasetProvenance {
    contributor?: string;
    createdAt: string;
    sourceUrl?: string;
    license?: string;
    description?: string;
    /** Monotonic human-readable version (e.g. "2026.04.20"). */
    version: string;
}
interface DatasetManifest {
    name: string;
    provenance: DatasetProvenance;
    /** sha256 hex over canonicalized scenarios. */
    contentHash: string;
    scenarioCount: number;
    splitCounts: Record<DatasetSplit, number>;
}

/**
 * HeldOutGate — first-class held-out paired-delta promotion gate.
 *
 * Encodes the "honesty override" pattern that lived inline in
 * `~/webb/redteam/scripts/agent-eval-autoresearch.ts:138–171`.
 * The optimizer's best-guess is one thing; what we should actually
 * ship is another. The gate is the line between them.
 *
 * A candidate is promoted iff ALL three pass:
 *
 *   1. **Productive runs**: the candidate has at least
 *      `minProductiveRuns` paired observations on items where BOTH
 *      candidate and baseline produced a real (non-silent) score.
 *   2. **Paired delta**: the lower bound of the bootstrap CI on the
 *      median per-item delta (candidate − baseline) on the HOLDOUT
 *      split is strictly greater than `pairedDeltaThreshold`.
 *   3. **Overfit gap**: the candidate's gap between search-split
 *      score and holdout-split score is no worse (more positive)
 *      than the baseline's gap by more than `overfitGapThreshold`.
 *      "Better on search, worse on holdout" is the canonical
 *      overfit pattern; this catches it.
 *
 * The decision carries a machine-readable `rejectionCode` plus an
 * `evidence` block with every number the gate looked at, so the
 * downstream researcher / paper / dashboard can re-derive the
 * verdict without re-running.
 *
 * See also:
 *   - `src/statistics.ts` for `pairedBootstrap` + `wilcoxonSignedRank`
 *   - `src/run-record.ts` for the input row schema
 *   - `src/reference-replay.ts` for the older, reference-replay-
 *     specific promotion path (still useful for replay-style evals).
 */

type HeldOutGateRejectionCode = 'few_runs' | 'negative_delta' | 'overfit_gap' | 'cost_ceiling';
interface GateEvidence {
    /** Number of paired (candidate, baseline) holdout observations used. */
    productiveRuns: number;
    /** Median of (candidate − baseline) paired holdout deltas. */
    medianPairedDelta: number;
    /** Bootstrap CI on the median paired holdout delta. */
    pairedCI: {
        low: number;
        high: number;
    };
    /** Wilcoxon signed-rank p-value on the paired holdout deltas. */
    pairedPValue: number;
    /** Mean candidate score on the search split (NaN if none). */
    searchScore: number;
    /** Mean candidate score on the holdout split (NaN if none). */
    holdoutScore: number;
    /** Candidate (search − holdout) gap. */
    overfitGap: number;
    /** Baseline (search − holdout) gap. */
    baselineOverfitGap: number;
    /** Median per-task USD cost across the candidate's runs. Recorded
     *  even when no `costPerTaskCeiling` is configured so downstream
     *  dashboards (intelligence.tangle.tools) can render \$/task per
     *  generation regardless of gating policy. */
    medianCandidateCost: number;
    /** Median per-task USD cost across the baseline runs, for
     *  symmetric reporting. */
    medianBaselineCost: number;
}
interface GateDecision {
    /** Final promote/no-promote verdict. */
    promote: boolean;
    /** The candidate that was evaluated. */
    candidateId: string;
    /** The baseline it was compared against. */
    baselineId: string;
    /** Every number the gate looked at, for audit + paper export. */
    evidence: GateEvidence;
    /** Human-readable reason. */
    reason: string;
    /** Machine-readable rejection code, or null on promote. */
    rejectionCode: HeldOutGateRejectionCode | null;
}

/**
 * Release confidence gate.
 *
 * This is the production-facing composition layer over the lower-level
 * primitives:
 *   - Dataset manifests prove corpus/version coverage.
 *   - RunRecord rows prove reproducible search/holdout outcomes.
 *   - Multi-shot trace evidence carries turn counts and ASI diagnostics.
 *   - HeldOutGate decisions remain the paired promotion authority.
 *
 * The gate is intentionally pure and conservative. Missing declared evidence
 * fails closed instead of being treated as a neutral zero.
 */

/** Severity of an actionable finding attached to a run/trace. */
type AsiSeverity = 'info' | 'warning' | 'error' | 'critical';
/** Actionable side-info — a diagnosed finding the loop can act on. */
interface ActionableSideInfo {
    /** Stable expectation/check id when available. */
    expectationId?: string;
    /** Human-readable diagnosis of what happened. */
    message: string;
    severity?: AsiSeverity;
    /** Concrete trace excerpt, file path, tool call, screenshot id, etc. */
    evidence?: string;
    /** Prompt/tool/context surface likely responsible. */
    responsibleSurface?: string;
    /** Suggested fix in natural language. */
    suggestion?: string;
    /** Whether this expectation was satisfied. Defaults to false for ASI rows. */
    matched?: boolean;
    metadata?: Record<string, unknown>;
}
type ReleaseConfidenceStatus = 'pass' | 'warn' | 'fail';
type ReleaseConfidenceAxisName = 'corpus' | 'quality' | 'generalization' | 'diagnostics' | 'efficiency';
interface ReleaseTraceEvidence {
    scenarioId: string;
    candidateId?: string;
    split?: RunSplitTag;
    score?: number;
    ok?: boolean;
    turnCount?: number;
    costUsd?: number;
    durationMs?: number;
    failureMode?: string;
    asi?: ActionableSideInfo[];
    metadata?: Record<string, unknown>;
}
interface ReleaseConfidenceThresholds {
    /** Require a Dataset manifest or explicit scenarios. Default true. */
    requireCorpus?: boolean;
    minScenarioCount?: number;
    minSearchRuns?: number;
    minHoldoutRuns?: number;
    /** Require at least one holdout scenario/run. Default true. */
    requireHoldout?: boolean;
    minPassRate?: number;
    minMeanScore?: number;
    /** Search mean may exceed holdout mean by at most this much. */
    maxOverfitGap?: number;
    maxMeanCostUsd?: number;
    maxP95WallMs?: number;
    /** Low-score/failed rows must carry ASI. Default true. */
    requireAsiForFailures?: boolean;
    /** Score below this is considered a failure for ASI coverage. Default 0.5. */
    failureScoreThreshold?: number;
}
interface ReleaseConfidenceInput {
    target: string;
    candidateId?: string;
    baselineId?: string;
    dataset?: DatasetManifest;
    scenarios?: readonly DatasetScenario[];
    runs?: readonly RunRecord[];
    traces?: readonly ReleaseTraceEvidence[];
    gateDecision?: GateDecision | null;
    thresholds?: ReleaseConfidenceThresholds;
}
interface ReleaseConfidenceAxis {
    name: ReleaseConfidenceAxisName;
    status: ReleaseConfidenceStatus;
    score: number;
    detail: string;
}
interface ReleaseConfidenceIssue {
    axis: ReleaseConfidenceAxisName;
    severity: 'critical' | 'warning';
    code: string;
    detail: string;
}
interface ReleaseConfidenceMetrics {
    scenarioCount: number;
    searchRuns: number;
    holdoutRuns: number;
    passRate: number;
    meanScore: number;
    searchMeanScore: number;
    holdoutMeanScore: number;
    overfitGap: number;
    meanCostUsd: number;
    p95WallMs: number;
    failedRows: number;
    failuresWithAsi: number;
    singleShotTraces: number;
    multiShotTraces: number;
    splitCounts: Record<DatasetSplit, number>;
    domainCounts: Record<string, number>;
    failureModeCounts: Record<string, number>;
    responsibleSurfaceCounts: Record<string, number>;
}
interface ReleaseConfidenceScorecard {
    target: string;
    candidateId: string | null;
    baselineId: string | null;
    status: ReleaseConfidenceStatus;
    promote: boolean;
    axes: ReleaseConfidenceAxis[];
    issues: ReleaseConfidenceIssue[];
    metrics: ReleaseConfidenceMetrics;
    dataset: DatasetManifest | null;
    gateDecision: GateDecision | null;
    summary: string;
}
declare function evaluateReleaseConfidence(input: ReleaseConfidenceInput): ReleaseConfidenceScorecard;
declare function assertReleaseConfidence(input: ReleaseConfidenceInput): ReleaseConfidenceScorecard;

interface RenderReleaseReportOptions {
    title?: string;
    runs?: readonly RunRecord[];
    comparator?: string;
    traceAnalystFindings?: readonly string[];
    nextActions?: readonly string[];
}
declare function renderReleaseReport(scorecard: ReleaseConfidenceScorecard, options?: RenderReleaseReportOptions): string;

/**
 * Always-valid sequential evaluation.
 *
 * `researchReport` assumes a single pre-specified analysis. Real
 * consumers run campaigns weekly / nightly / per-PR; each new run silently
 * inflates the false-discovery rate, because the BH-FDR guarantee is for
 * the *first* look, not the 47th. Without time-uniform inference,
 * launch-decision teams either (a) don't peek, which forfeits the cost
 * advantage of stop-when-decisive, or (b) peek and pretend they didn't,
 * which forfeits scientific validity.
 *
 * This module ships **e-value-based confidence sequences** for paired
 * bounded outcomes. The methodology is the predictable plug-in betting
 * martingale of Waudby-Smith & Ramdas (2024) — provably valid at *any*
 * stopping time. Concretely:
 *
 *   For paired deltas D_1, D_2, … ∈ [-c, c] with the null H_0: E[D] ≤ 0,
 *   a betting fraction λ_i is chosen using only D_{1..i-1} (predictable
 *   plug-in), and the running e-value is
 *
 *     E_t = ∏_{i=1}^{t} (1 + λ_i · D_i)
 *
 *   E_t is a non-negative martingale under H_0 with E[E_t] ≤ 1, so by
 *   Ville's inequality, P(∃ t : E_t ≥ 1/α) ≤ α — we can reject the null
 *   at any time without inflating the type-I error.
 *
 * Combined with `runEvalCampaign`, every consumer running rolling
 * campaigns gains the ability to ship the moment evidence is decisive,
 * stop-early on dead-on-arrival variants, and accumulate evidence across
 * partial runs without spending the FDR budget. No new sweep is wasted.
 *
 * References:
 *   - Howard, S. R., Ramdas, A., McAuliffe, J., Sekhon, J. (2021).
 *     Time-uniform, nonparametric, nonasymptotic confidence sequences.
 *     Annals of Statistics, 49(2), 1055–1080.
 *   - Waudby-Smith, I., Ramdas, A. (2024). Estimating means of bounded
 *     random variables by betting. JRSS B, 86(1), 1–27.
 */
type SequentialDecision = 'promote_now' | 'continue' | 'reject_now' | 'equivalent';
interface PairedEvalueOptions {
    /**
     * Bound on |delta|. Default 1 (matching most score scales). Must satisfy
     * c > 0; deltas outside [-c, c] are clipped with a warning attached to
     * the return value.
     */
    bound?: number;
    /** Target Type-I error. Default 0.05. */
    alpha?: number;
    /**
     * Region of Practical Equivalence on the *mean* paired delta. When
     * supplied, the verdict can return `'equivalent'` once the running
     * confidence sequence on the mean is fully contained in [low, high].
     */
    rope?: {
        low: number;
        high: number;
    };
    /** Initial bet shrinkage (0 < scale ≤ 1). Default 0.5 — empirically robust. */
    initialBetShrinkage?: number;
}
interface PairedEvalueStep {
    /** 1-indexed observation count. */
    t: number;
    delta: number;
    /** Running e-value E_t = ∏ (1 + λ_i · D_i). */
    evalue: number;
    /** Time-uniform p-value at stopping time t. */
    pValue: number;
    /** Lower bound of the empirical Bernstein confidence sequence at level 1-α. */
    csLow: number;
    csHigh: number;
    /** Verdict at this stopping time. */
    decision: SequentialDecision;
}
interface PairedEvalueSequence {
    steps: PairedEvalueStep[];
    /** The decision at the final step. */
    finalDecision: SequentialDecision;
    /** Index (1-based) at which a non-`continue` decision first fired, or null. */
    decisionFiredAt: number | null;
    /** True if any deltas were clipped to [-bound, bound]. */
    clipped: boolean;
}
/**
 * Run the paired e-value sequence over an in-order delta stream.
 *
 * Use for *streaming* / interim analyses: pass the deltas you have so
 * far, get the verdict at every prefix length. The decision is
 * monotone-stable in the sense that once `'reject_now'` or `'promote_now'`
 * fires, the verdict at later steps remains decisive (the e-value is a
 * non-negative martingale; once it crosses the threshold, it's crossed).
 */
declare function pairedEvalueSequence(deltas: number[], opts?: PairedEvalueOptions): PairedEvalueSequence;
interface InterimReleaseConfidenceInput {
    /**
     * One delta series per candidate (paired deltas vs comparator). Order
     * within a series is the order the campaigns were run.
     */
    deltaSeries: Array<{
        candidateId: string;
        deltas: number[];
    }>;
    alpha?: number;
    bound?: number;
    rope?: {
        low: number;
        high: number;
    };
}
interface InterimReleaseConfidence {
    candidates: Array<{
        candidateId: string;
        decision: SequentialDecision;
        decisionFiredAt: number | null;
        finalEvalue: number;
        finalPValue: number;
        pairs: number;
        csLow: number;
        csHigh: number;
    }>;
    /**
     * Campaign-level recommendation: pick the strongest 'promote_now', else
     * 'continue' if any candidate is still live, else 'reject_now' if every
     * candidate is dead, else 'equivalent'.
     */
    recommendation: {
        decision: SequentialDecision;
        candidateId: string | null;
    };
}
/**
 * Run interim sequential analyses across many candidates at once,
 * preserving the time-uniform α guarantee for each candidate's series and
 * synthesising a campaign-level recommendation. Designed to be called on
 * every campaign tick — the recommendation is anytime-valid.
 */
declare function evaluateInterimReleaseConfidence(input: InterimReleaseConfidenceInput): InterimReleaseConfidence;

/**
 * Wilcoxon signed-rank test — paired non-parametric alternative.
 * Use when the differences aren't normally distributed.
 */
declare function wilcoxonSignedRank(before: number[], after: number[]): {
    w: number;
    p: number;
};
/**
 * Benjamini–Hochberg false discovery rate. Returns adjusted q-values and
 * significance at the target FDR; handles ties and preserves q monotonicity.
 */
declare function benjaminiHochberg(pValues: number[], fdr?: number): {
    qValues: number[];
    significant: boolean[];
};
interface PairedBootstrapResult {
    /** Number of paired observations. */
    n: number;
    /** Median of paired deltas (after − before). */
    median: number;
    /** Mean of paired deltas. */
    mean: number;
    /** Lower bound of the bootstrap CI on the chosen statistic. */
    low: number;
    /** Upper bound of the bootstrap CI on the chosen statistic. */
    high: number;
    /** Confidence level used (e.g. 0.95). */
    confidence: number;
    /** Number of bootstrap resamples used. */
    resamples: number;
}
interface PairedBootstrapOptions {
    /** Confidence level. Default 0.95. */
    confidence?: number;
    /** Bootstrap resample count. Default 2000. */
    resamples?: number;
    /** Statistic to bootstrap. Default 'median'. */
    statistic?: 'median' | 'mean';
    /** Deterministic seed. If omitted, uses Math.random(). */
    seed?: number;
}
/**
 * Paired bootstrap on (after − before) deltas. Returns a CI on the chosen
 * statistic (median by default); pairs are resampled with replacement. The
 * lower bound is what the promotion gate checks — `low > threshold` means the
 * gain is real at the confidence level. Throws on unequal sample sizes.
 */
declare function pairedBootstrap(before: number[], after: number[], opts?: PairedBootstrapOptions): PairedBootstrapResult;

/**
 * FailureClusterView — groups failed runs by (failureClass, triggerTool,
 * argHash-prefix) so weekly reviews can prioritize the top-N clusters.
 *
 * Each cluster includes: N runs, scenarios affected, representative
 * error message, a proposed mitigation hint (rule → action table).
 */

interface FailureCluster {
    failureClass: FailureClass;
    /** Tool name when the trigger was a tool span, else undefined. */
    toolName?: string;
    /** First 16 chars of argHash — clusters similar args. */
    argPrefix?: string;
    /**
     * Source dimension when the trigger was a judge span (e.g. `'format'`,
     * `'safety'`, `'correctness'`). Lets cross-template aggregators
     * group failures by the dimension that fired without overloading
     * `argPrefix`. Optional — clusters without this field deserialize cleanly.
     */
    dimension?: string;
    runCount: number;
    scenarioIds: string[];
    exampleError?: string;
    exampleRunId: string;
}
interface FailureClusterReport {
    clusters: FailureCluster[];
    totalFailures: number;
    totalRuns: number;
}

/**
 * Reporting helpers — production summaries and paper-quality figures — sit alongside `reporter.ts` rather
 * than replacing it.
 *
 * Three artefacts:
 *
 *   - `summaryTable`           Markdown table of per-candidate means,
 *                            95% bootstrap CIs, BH-adjusted Wilcoxon
 *                            p-values, and Cohen's d versus a
 *                            comparator candidate.
 *   - `paretoChart`         Abstract spec for a cost vs quality
 *                            scatter, with gate decisions overlaid.
 *                            Returns numbers + labels — caller
 *                            chooses the plotting library.
 *   - `gainHistogram`
 *                            Per-item paired holdout deltas as a
 *                            histogram spec (bins + counts + median +
 *                            CI). Same "data, not images" contract.
 *
 * The figure types are PlotSpecs — JSON-friendly, library-agnostic.
 * They aren't React components and they aren't PNGs; they are
 * what you'd hand to vega-lite, plotly, matplotlib, or your own
 * Canvas renderer to draw the actual figure.
 */

interface SummaryTableOptions {
    /** Comparator candidate id. Wilcoxon + Cohen's d are computed
     *  versus this candidate. Required for paired stats columns. */
    comparator?: string;
    /** Which split to read scores from. Default 'holdout'. */
    split?: 'search' | 'holdout';
    /** Confidence level for the bootstrap CI on the mean. Default 0.95. */
    confidence?: number;
    /** FDR for BH adjustment of the comparison p-values. Default 0.05. */
    fdr?: number;
}
interface SummaryTableRow {
    candidateId: string;
    n: number;
    mean: number;
    ciLow: number;
    ciHigh: number;
    /** BH-adjusted q-value vs comparator. NaN if no comparator. */
    qValue: number;
    /** Cohen's d vs comparator. NaN if no comparator. */
    cohensD: number;
}
interface SummaryTable {
    rows: SummaryTableRow[];
    comparator: string | null;
    split: 'search' | 'holdout';
    /** Pre-rendered markdown — drop into a paper or PR. */
    markdown: string;
}
/**
 * Table 1 helper. Buckets runs by `candidateId`, computes mean +
 * bootstrap CI on the chosen split, and (when a comparator is given)
 * BH-adjusted Wilcoxon p + Cohen's d versus that comparator.
 */
declare function summaryTable(runs: RunRecord[], opts?: SummaryTableOptions): SummaryTable;
interface ParetoPoint {
    candidateId: string;
    /** Mean USD cost per run on the chosen split. */
    cost: number;
    /** Mean score on the chosen split. */
    quality: number;
    /** Number of runs that informed this point. */
    n: number;
    /** Whether this candidate is on the Pareto frontier — high
     *  quality, low cost, no dominator. */
    onFrontier: boolean;
    /** Optional gate verdict for this candidate, if a `GateDecision`
     *  for it was passed in. */
    gate?: 'promote' | 'reject_few_runs' | 'reject_negative_delta' | 'reject_overfit_gap' | null;
}
interface ParetoFigureSpec {
    kind: 'pareto-cost-quality';
    split: 'search' | 'holdout';
    points: ParetoPoint[];
    axes: {
        x: 'costUsd';
        y: 'score';
    };
}
/**
 * Cost vs quality scatter spec. `gateDecisions` is keyed by
 * candidate id; if present, every point picks up the gate verdict
 * for overlay.
 */
declare function paretoChart(runs: RunRecord[], opts?: {
    split?: 'search' | 'holdout';
    gateDecisions?: Record<string, GateDecision>;
}): ParetoFigureSpec;
interface GainDistributionBin {
    /** Inclusive lower edge. */
    lo: number;
    /** Exclusive upper edge (or inclusive if it's the last bin). */
    hi: number;
    /** Number of pairs whose delta lands in this bin. */
    count: number;
}
interface GainDistributionFigureSpec {
    kind: 'gain-distribution';
    candidateId: string;
    comparator: string;
    split: 'search' | 'holdout';
    /** Number of pairs used. */
    n: number;
    bins: GainDistributionBin[];
    median: number;
    ci: {
        low: number;
        high: number;
    };
}
interface GainDistributionOptions {
    /** Number of histogram bins. Default 11 (so the centre is exact at 0). */
    bins?: number;
    /** Which split to use. Default 'holdout'. */
    split?: 'search' | 'holdout';
    /** Confidence level for the CI. Default 0.95. */
    confidence?: number;
    /** Bootstrap resamples. Default 2000. */
    resamples?: number;
    /** Deterministic seed. */
    seed?: number;
}
/**
 * Held-out improvement distribution: per-pair delta (candidate −
 * comparator), histogrammed. Includes the bootstrap CI on the median
 * delta — same primitive the promotion gate uses.
 */
declare function gainHistogram(runs: RunRecord[], candidateId: string, comparator: string, opts?: GainDistributionOptions): GainDistributionFigureSpec;
type ResearchReportDecision = 'promote' | 'hold' | 'reject' | 'equivalent' | 'needs_more_data';
/**
 * Hard floor below which a paired comparison is treated as uninformative
 * regardless of `minPairs`. Mirrors the lower limit on Wilcoxon signed-rank
 * exact tables; below this the test has no power to separate effect sizes.
 */
declare const RESEARCH_REPORT_HARD_PAIR_FLOOR = 6;
interface ResearchReportOptions {
    /** Human-readable report title. */
    title?: string;
    /** Comparator candidate id. Required for statistical decision guidance. */
    comparator?: string;
    /** Which split to use for the primary decision. Default 'holdout'. */
    split?: 'search' | 'holdout';
    /** Confidence level used by lower-level report helpers. Default 0.95. */
    confidence?: number;
    /** FDR threshold for q-values. Default 0.05. */
    fdr?: number;
    /**
     * Soft floor on paired observations before issuing a directional
     * promote / reject. Below this we report `needs_more_data` and surface the
     * minimum detectable effect at the current N. Default 20 — chosen so the
     * Wilcoxon signed-rank approximation is reasonable and so the paired
     * bootstrap CI has non-degenerate coverage. Hard floor is enforced at
     * `RESEARCH_REPORT_HARD_PAIR_FLOOR` (6) regardless of this value.
     */
    minPairs?: number;
    /**
     * Region of Practical Equivalence on the paired delta. When a candidate's
     * paired-delta CI is fully contained in `[low, high]`, the decision is
     * `equivalent` rather than `hold`. Sourced from the domain owner — there is
     * no statistically-defensible default.
     */
    rope?: {
        low: number;
        high: number;
    };
    /**
     * Power for the minimum detectable effect (MDE) reported on each candidate.
     * Default 0.8.
     */
    mdePower?: number;
    /**
     * Two-sided alpha for the MDE. Default matches `fdr` so the reported MDE
     * lines up with the test the report actually runs.
     */
    mdeAlpha?: number;
    /** Optional held-out gate decisions keyed by candidate id. */
    gateDecisions?: Record<string, GateDecision>;
    /** Optional failure clusters from failureClusterView. */
    failureClusters?: FailureClusterReport;
    /** Build gain histograms for these candidates. Defaults to all non-comparator candidates. */
    candidateIds?: string[];
    /** Deterministic bootstrap seed passed to gainHistogram and the posterior helper. */
    seed?: number;
    /** Report timestamp. Defaults to current time. */
    generatedAt?: string;
    /**
     * Hash of a preregistered protocol (e.g. `signManifest({...}).contentHash`).
     * Embedded verbatim in the report so the analysis can be cited as the
     * preregistered one rather than a post-hoc fishing expedition.
     */
    preregistrationHash?: string;
}
interface ResearchReportRecommendation {
    decision: ResearchReportDecision;
    candidateId: string | null;
    rationale: string[];
    risks: string[];
    nextActions: string[];
}
interface ResearchReportCandidate {
    candidateId: string;
    n: number;
    mean: number;
    ciLow: number;
    ciHigh: number;
    qValue: number;
    cohensD: number;
    meanDeltaVsComparator: number | null;
    pairedN: number;
    medianGain: number | null;
    meanGain: number | null;
    gainCi: {
        low: number;
        high: number;
    } | null;
    /**
     * Bayesian-bootstrap-style posterior summaries on the paired delta. Computed
     * from the same resamples that produce the gain CI; interpretable as
     * "fraction of resamples in which the candidate beats the comparator on
     * matched pairs."
     */
    prGreaterThanZero: number | null;
    prInRope: number | null;
    /**
     * Minimum detectable effect (in score units) at the candidate's paired N,
     * the configured power, and the configured alpha. Standardised by the
     * observed paired-delta SD and inverted via `requiredSampleSize`. Reported
     * for every candidate so a `needs_more_data` verdict is actionable.
     */
    mde: number | null;
    onParetoFrontier: boolean;
    gate?: ParetoPoint['gate'];
    decision: ResearchReportDecision;
    decisionReason: string;
}
interface ResearchReportMethodology {
    /**
     * Plain-language assumptions the report depends on. Read these first when
     * deciding whether the verdict is load-bearing for a launch decision.
     */
    assumptions: string[];
    /** Tests and estimators the verdict was computed from. */
    methods: string[];
    /** Alternatives the author considered and why this report didn't take them. */
    alternatives: string[];
    /** Failure modes — when this report should NOT drive a decision. */
    whenNotToApply: string[];
    /** Citations for the methodological choices above. */
    citations: string[];
}
interface ResearchReport {
    kind: 'agent-eval-research-report';
    title: string;
    generatedAt: string;
    split: 'search' | 'holdout';
    comparator: string | null;
    /**
     * SHA-256 over the canonicalised set of `(runId, candidateId, split)` triples
     * the report was computed from, plus the comparator and split. Stable across
     * key insertion order; recomputable by the reader to verify provenance.
     */
    runFingerprint: string;
    preregistrationHash: string | null;
    rope: {
        low: number;
        high: number;
    } | null;
    executiveSummary: string[];
    recommendation: ResearchReportRecommendation;
    candidates: ResearchReportCandidate[];
    summary: SummaryTable;
    charts: {
        pareto: ParetoFigureSpec;
        gains: GainDistributionFigureSpec[];
    };
    methodology: ResearchReportMethodology;
    failureClusters?: FailureClusterReport;
    markdown: string;
    html: string;
}
/**
 * Executive research report for CPO / AI-lead / launch-review consumption.
 *
 * Composes:
 *   - `summaryTable`         marginal stats with BH-FDR-adjusted q-values
 *   - `paretoChart`           cost-vs-quality frontier with gate overlay
 *   - `gainHistogram`         per-candidate paired-delta distribution
 *   - paired posterior (this file): bootstrap CI on median, Pr(Δ>0),
 *                              Pr(Δ∈ROPE), MDE at the configured power
 *
 * Decisions are made on paired evidence — never on marginal means alone —
 * and respect any held-out gate decision the caller passes through. The
 * report embeds a SHA-256 fingerprint of the input run set and, optionally,
 * the hash of a preregistered protocol so a downstream reader can verify
 * provenance and that the analysis was the preregistered one.
 *
 * Async because the fingerprint uses Web Crypto via `hashJson`; deterministic
 * for any fixed `runs`, `seed`, and ROPE.
 */
declare function researchReport(runs: RunRecord[], opts?: ResearchReportOptions): Promise<ResearchReport>;

export { type BootstrapOptions, type BootstrapResult, type GainDistributionBin, type GainDistributionFigureSpec, type GainDistributionOptions, type InterimReleaseConfidence, type InterimReleaseConfidenceInput, type JudgeReplayGateArgs, type PairedBootstrapOptions, type PairedBootstrapResult, type PairedEvalueOptions, type PairedEvalueSequence, type PairedEvalueStep, type ParetoFigureSpec, type ParetoPoint, RESEARCH_REPORT_HARD_PAIR_FLOOR, type ReleaseConfidenceAxis, type ReleaseConfidenceAxisName, type ReleaseConfidenceInput, type ReleaseConfidenceIssue, type ReleaseConfidenceMetrics, type ReleaseConfidenceScorecard, type ReleaseConfidenceStatus, type ReleaseConfidenceThresholds, type ReleaseTraceEvidence, type RenderReleaseReportOptions, type ResearchReport, type ResearchReportCandidate, type ResearchReportDecision, type ResearchReportMethodology, type ResearchReportOptions, type ResearchReportRecommendation, type RubricOutcomePair, type RubricPredictiveValidityInput, type RubricPredictiveValidityReport, type RubricRanking, type SequentialDecision, type SummaryTable, type SummaryTableOptions, type SummaryTableRow, type Verdict, assertReleaseConfidence, benjaminiHochberg, bootstrapCi, evaluateInterimReleaseConfidence, evaluateReleaseConfidence, gainHistogram, judgeReplayGate, pairedBootstrap, pairedEvalueSequence, paretoChart, renderReleaseReport, researchReport, rubricPredictiveValidity, summaryTable, wilcoxonSignedRank };
