export { C as CalibrationBin, a as CalibrationOptions, b as CalibrationPair, c as CalibrationReport, d as CorrelationResult, e as CorrelationStudyOptions, f as CorrelationStudyResult, E as EvalMetricSpec, O as OutcomePair, g as calibrationCurve, h as calibrationFromPairs, i as correlationStudy } from '../calibration-BPmzuVPk.js';
export { D as DeploymentOutcome, F as FileSystemOutcomeStore, a as FileSystemOutcomeStoreOptions, I as InMemoryOutcomeStore, O as OutcomeFilter, b as OutcomeStore } from '../outcome-store-rnXLEqSn.js';
export { R as RubricOutcomePair, a as RubricPredictiveValidityInput, b as RubricPredictiveValidityReport, c as RubricRanking, r as rubricPredictiveValidity } from '../rubric-predictive-validity-C2hDKM8Z.js';
import { C as ContinuousAgreement, a as CalibrationResult, b as ContinuousCalibrationResult, c as CandidateScore, G as GoldenItem } from '../judge-calibration-0p2QcWNE.js';
import { S as SeriesConvergenceOptions, a as SeriesConvergenceResult } from '../series-convergence-D5OWMBg6.js';
import { C as CorpusAgreementReport } from '../statistics-xP-cWc5k.js';
import '../store-BcFXE6LG.js';
import '../schema-m0gsnbt3.js';
import '../run-record-CP2ObebC.js';
import '@tangle-network/agent-interface';
import '../errors-CzMUYo7b.js';
import '../types-C7DGg5ex.js';
import '@tangle-network/tcloud';

/**
 * Judge sentinel — eval trustworthiness as a continuously measured,
 * alarmed trend.
 *
 * Judges are models; models change underneath us; calibration decays.
 * This module composes three existing instruments into one loop:
 *
 *   snapshot — adapters turn real instrument outputs (`calibrateJudge` /
 *              `calibrateJudgeContinuous`, `corpusInterRaterAgreement` /
 *              `continuousAgreement`, a rerun sentinel golden set) into
 *              `SentinelSnapshot`s
 *   series   — `analyzeSeries` (src/series-convergence) classifies each
 *              judge×metric history as stabilized / drifting / noisy
 *   alarm    — `judgeSentinelReport` turns trends + thresholds into named
 *              alarms; `evalHealthStamp` is the tiny object a campaign
 *              attaches to its verdicts
 *
 * Alarm conditions:
 *   - convergence state `drifting-down` on any tracked metric
 *   - irr below `minIrr`
 *   - calibrationKappa / sentinelPassRate dropped vs the series baseline
 *     beyond `maxKappaDrop` / `maxSentinelDrop`
 *   - judge model changed with no post-change golden-grounded snapshot
 *     (the silent-upgrade trap: judges agreeing with each other after a
 *     model swap proves nothing — only re-measuring against gold does)
 *   - newest snapshot older than `staleAfterDays` relative to `asOf`
 *
 * Wire-in: run the snapshot adapters from a post-campaign hook or a
 * nightly job, append to a `SentinelStore`, then compute
 * `judgeSentinelReport(await store.history(), { asOf })` with `asOf` =
 * the campaign timestamp. Attach `evalHealthStamp(report)` to campaign
 * verdicts: an alarmed sentinel means every downstream verdict carries
 * an integrity warning until the judge is recalibrated.
 *
 * The module is clock-free — every timestamp (`at`, `asOf`) is
 * caller-supplied ISO-8601, so reports are reproducible.
 */

declare const SENTINEL_METRIC_NAMES: readonly ["irr", "calibrationKappa", "sentinelPassRate"];
type SentinelMetricName = (typeof SENTINEL_METRIC_NAMES)[number];
interface SentinelMetrics {
    /** Inter-rater reliability — ICC(2,1) from agreement instruments. */
    irr?: number;
    /** Weighted κ vs the human golden set (`calibrateJudge*`). */
    calibrationKappa?: number;
    /** Fraction of a fixed sentinel golden set the judge still scores within tolerance. */
    sentinelPassRate?: number;
}
interface SentinelSnapshot {
    /** Caller-supplied ISO-8601 timestamp — the module never reads a clock. */
    at: string;
    judgeId: string;
    /** Exact model identity behind the judge (pin the full version string). */
    judgeModel: string;
    /**
     * Metrics measured at `at`. May be empty: an empty-metrics snapshot is a
     * model-change marker — it records the new `judgeModel` immediately and
     * the silent-upgrade alarm stays raised until a golden-grounded snapshot
     * (calibrationKappa or sentinelPassRate) follows.
     */
    metrics: SentinelMetrics;
}
/** Identity + timestamp the caller supplies alongside an instrument output. */
interface SnapshotMeta {
    at: string;
    judgeId: string;
    judgeModel: string;
}
/** Shape guard for snapshots crossing a boundary (store append, JSONL load, report input). */
declare function validateSentinelSnapshot(snapshot: SentinelSnapshot, source?: string): void;
/**
 * From `calibrateJudge` / `calibrateJudgeContinuous` output. Prefers the
 * un-rounded continuous κ_w when the report carries one (integer κ
 * discards information for [0,1] judges).
 */
declare function snapshotFromCalibration(report: CalibrationResult | ContinuousCalibrationResult, meta: SnapshotMeta): SentinelSnapshot;
/**
 * From `corpusInterRaterAgreement` (statistics.ts) or `continuousAgreement`
 * (judge-calibration.ts) output. IRR = ICC(2,1) — the reliability
 * coefficient both instruments compute. For ensemble-level agreement,
 * `meta.judgeId` names the ensemble and `meta.judgeModel` pins its
 * composition (e.g. a joined list of member model strings).
 */
declare function snapshotFromAgreement(report: CorpusAgreementReport | ContinuousAgreement, meta: SnapshotMeta): SentinelSnapshot;
interface SentinelSetOptions {
    /** Max |judge − human| for an item to count as passed. Default 0.1 (tuned for [0,1] scores). */
    tolerance?: number;
}
/**
 * From a rerun of a fixed sentinel golden set: the same `GoldenItem`s the
 * judge was originally calibrated on, re-scored periodically. Pass rate =
 * fraction of joined items where the judge stays within `tolerance` of the
 * human score. Items the judge didn't score are excluded from the
 * denominator; zero joined items is an error, not a 0% pass rate.
 */
declare function snapshotFromSentinelSet(scores: CandidateScore[], golden: GoldenItem[], meta: SnapshotMeta, options?: SentinelSetOptions): SentinelSnapshot;
interface SentinelStore {
    append(snapshot: SentinelSnapshot): Promise<void>;
    /** All snapshots (optionally for one judge), in append order. */
    history(judgeId?: string): Promise<SentinelSnapshot[]>;
}
declare function inMemorySentinelStore(initial?: SentinelSnapshot[]): SentinelStore;
/**
 * JSONL store — one snapshot per line, appended atomically per call.
 * A corrupt or shape-invalid line is a loud error naming the file and
 * line number: a sentinel history that silently drops records would
 * defeat the drift detection it exists to provide.
 */
declare function fileSentinelStore(path: string): SentinelStore;
interface SentinelThresholds {
    /** Floor for irr — below it the judge ensemble is unreliable regardless of trend. Default 0.6. */
    minIrr?: number;
    /** Max tolerated calibrationKappa drop vs the series baseline. Default 0.15. */
    maxKappaDrop?: number;
    /** Max tolerated sentinelPassRate drop vs the series baseline. Default 0.1. */
    maxSentinelDrop?: number;
    /** Newest snapshot older than this (days, vs asOf) = the sentinel itself went blind. Default 30. */
    staleAfterDays?: number;
}
interface JudgeSentinelOptions {
    /** Caller-supplied ISO timestamp staleness is measured against. */
    asOf: string;
    thresholds?: SentinelThresholds;
    /** Forwarded to `analyzeSeries` (window, stableCv, driftRun). */
    convergence?: SeriesConvergenceOptions;
}
interface SentinelTrend {
    judgeId: string;
    metric: SentinelMetricName;
    /** Verbatim `analyzeSeries` state for this judge×metric history. */
    state: SeriesConvergenceResult['state'];
    /** Newest value in the series. */
    current: number;
    /** Oldest value in the series — the reference the drop thresholds compare against. */
    baseline: number;
    /** current − baseline (signed; negative = decayed). */
    drift: number;
    alarmed: boolean;
    reason?: string;
}
interface SentinelReport {
    perJudge: SentinelTrend[];
    alarms: string[];
    healthy: boolean;
    /**
     * `judgeId:metric` pairs with too few snapshots for the convergence
     * machine. Named, not counted — a blind spot you can't see is a blind
     * spot you won't fix. Floor/drop checks still apply to thin series, so
     * insufficient history alone never masks an alarm.
     */
    insufficientHistory: string[];
}
declare function judgeSentinelReport(history: SentinelSnapshot[], opts: JudgeSentinelOptions): SentinelReport;
interface EvalHealthStamp {
    healthy: boolean;
    alarms: string[];
}
/**
 * The object a campaign attaches to its verdicts. Compute it from the
 * sentinel report in a post-campaign hook (or a nightly job feeding the
 * next day's campaigns) and store it alongside the verdict payload.
 * `healthy: false` means the judges that produced those verdicts have an
 * unresolved drift / decay / silent-upgrade / staleness alarm — treat the
 * verdicts as carrying an integrity warning until recalibration clears it.
 */
declare function evalHealthStamp(report: SentinelReport): EvalHealthStamp;

export { type EvalHealthStamp, type JudgeSentinelOptions, SENTINEL_METRIC_NAMES, type SentinelMetricName, type SentinelMetrics, type SentinelReport, type SentinelSetOptions, type SentinelSnapshot, type SentinelStore, type SentinelThresholds, type SentinelTrend, type SnapshotMeta, evalHealthStamp, fileSentinelStore, inMemorySentinelStore, judgeSentinelReport, snapshotFromAgreement, snapshotFromCalibration, snapshotFromSentinelSet, validateSentinelSnapshot };
