import { R as RunRecord } from './run-record-etiCMsUq.js';
import { O as OutcomeStore } from './outcome-store-D6KWmYvj.js';

/**
 * 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>;

export { type RubricOutcomePair as R, type RubricPredictiveValidityInput as a, type RubricPredictiveValidityReport as b, type RubricRanking as c, rubricPredictiveValidity as r };
