@tangle-network/agent-eval 0.209.1 → 0.211.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/dist/adapters/http.d.ts +1 -1
- package/dist/analyst/index.d.ts +2 -2
- package/dist/analyst/index.js +1 -1
- package/dist/{analyze-runs-0cdYMgob.js → analyze-runs-3xpby3p2.js} +4 -4
- package/dist/analyze-runs-3xpby3p2.js.map +1 -0
- package/dist/{benchmark-command-Cve7mHNC.js → benchmark-command-S8tCtkxh.js} +3 -3
- package/dist/{benchmark-command-Cve7mHNC.js.map → benchmark-command-S8tCtkxh.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +2 -2
- package/dist/campaign/index.d.ts +2 -2
- package/dist/campaign/index.js +9 -9
- package/dist/{campaign-evidence-B5qsCHEn.js → campaign-evidence-OcUciD-N.js} +2 -2
- package/dist/campaign-evidence-OcUciD-N.js.map +1 -0
- package/dist/{campaign-CvhmiLKa.js → campaign-wvvJA1ps.js} +10 -10
- package/dist/{campaign-CvhmiLKa.js.map → campaign-wvvJA1ps.js.map} +1 -1
- package/dist/claude-jsonl-dZir12m6.js +86 -0
- package/dist/claude-jsonl-dZir12m6.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/contract/index.d.ts +5 -5
- package/dist/contract/index.js +90 -14
- package/dist/contract/index.js.map +1 -1
- package/dist/counterfactual-DtMWvn7D.js.map +1 -1
- package/dist/{define-agent-eval-_nyV5nev.d.ts → define-agent-eval-B_zZY2AZ.d.ts} +3 -3
- package/dist/{define-agent-eval-_nyV5nev.d.ts.map → define-agent-eval-B_zZY2AZ.d.ts.map} +1 -1
- package/dist/{define-agent-eval-Csd47ur_.js → define-agent-eval-CoXXDCMu.js} +4 -4
- package/dist/{define-agent-eval-Csd47ur_.js.map → define-agent-eval-CoXXDCMu.js.map} +1 -1
- package/dist/diagnosis/index.js +1 -1
- package/dist/{eval-campaign-C31Qbv77.js → eval-campaign-4byTtqrf.js} +2 -2
- package/dist/{eval-campaign-C31Qbv77.js.map → eval-campaign-4byTtqrf.js.map} +1 -1
- package/dist/experiment/index.d.ts +1 -1
- package/dist/experiment/index.js +6 -6
- package/dist/feedback-trajectory-CX01700m.d.ts.map +1 -1
- package/dist/{index-H-u7f-w3.d.ts → index-D0_l25We.d.ts} +20 -41
- package/dist/{index-H-u7f-w3.d.ts.map → index-D0_l25We.d.ts.map} +1 -1
- package/dist/{index-BHh9Z9El.d.ts → index-DnZdBxCL.d.ts} +9 -6
- package/dist/{index-BHh9Z9El.d.ts.map → index-DnZdBxCL.d.ts.map} +1 -1
- package/dist/{index-Ddi5M-TQ.d.ts → index-xnhRdqik.d.ts} +3 -14
- package/dist/{index-Ddi5M-TQ.d.ts.map → index-xnhRdqik.d.ts.map} +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/judge-gate-B1_O0QIs.d.ts +454 -0
- package/dist/judge-gate-B1_O0QIs.d.ts.map +1 -0
- package/dist/judge-gate-B1qYnkpi.js +658 -0
- package/dist/judge-gate-B1qYnkpi.js.map +1 -0
- package/dist/{llm-judge-C0256VT_.js → llm-judge-Tr7MBUnf.js} +6 -6
- package/dist/llm-judge-Tr7MBUnf.js.map +1 -0
- package/dist/meta-eval/index.d.ts +2 -132
- package/dist/meta-eval/index.d.ts.map +1 -1
- package/dist/meta-eval/index.js +2 -275
- package/dist/meta-eval/index.js.map +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{paired-arms-B5v-X7No.js → paired-arms-DzKn0TfY.js} +2 -2
- package/dist/{paired-arms-B5v-X7No.js.map → paired-arms-DzKn0TfY.js.map} +1 -1
- package/dist/{paired-binary-b2L3WKqr.js → paired-binary-Q36bhn2R.js} +13 -9
- package/dist/paired-binary-Q36bhn2R.js.map +1 -0
- package/dist/{paired-promotion-decision-2deJ7sDX.js → paired-promotion-decision-BN6IQTiu.js} +2 -2
- package/dist/{paired-promotion-decision-2deJ7sDX.js.map → paired-promotion-decision-BN6IQTiu.js.map} +1 -1
- package/dist/{produced-state-CgB9g0VX.js → produced-state-CKybuR9F.js} +3 -3
- package/dist/produced-state-CKybuR9F.js.map +1 -0
- package/dist/{promotion-policy-CCmyEH_c.js → promotion-policy-CWW35UWq.js} +3 -3
- package/dist/{promotion-policy-CCmyEH_c.js.map → promotion-policy-CWW35UWq.js.map} +1 -1
- package/dist/reporting.js +2 -2
- package/dist/rl.js +3 -3
- package/dist/rollout/index.d.ts +2 -2
- package/dist/rollout/index.js +3 -3
- package/dist/{rollout-BZqQc0YY.js → rollout-D9bKKBnZ.js} +29 -164
- package/dist/rollout-D9bKKBnZ.js.map +1 -0
- package/dist/search/index.js +2 -2
- package/dist/{search-kernel-Bfe3kzRk.js → search-kernel-BIXWM7YV.js} +3 -3
- package/dist/search-kernel-BIXWM7YV.js.map +1 -0
- package/dist/{search-summary-DK1bwTAf.js → search-summary-nwrtXxC_.js} +3 -3
- package/dist/{search-summary-DK1bwTAf.js.map → search-summary-nwrtXxC_.js.map} +1 -1
- package/dist/{sequential-BOzBND4t.js → sequential-D-1PPCmM.js} +2 -2
- package/dist/{sequential-BOzBND4t.js.map → sequential-D-1PPCmM.js.map} +1 -1
- package/dist/{skillopt-optimization-method-BCojvoP1.js → skillopt-optimization-method-DujPOiwD.js} +4 -4
- package/dist/{skillopt-optimization-method-BCojvoP1.js.map → skillopt-optimization-method-DujPOiwD.js.map} +1 -1
- package/dist/{statistical-heldout-BP6iEJvR.js → statistical-heldout-1Gbmex7v.js} +2 -2
- package/dist/{statistical-heldout-BP6iEJvR.js.map → statistical-heldout-1Gbmex7v.js.map} +1 -1
- package/dist/{statistical-heldout-D0rX_IDl.d.ts → statistical-heldout-8RGPIeyo.d.ts} +14 -10
- package/dist/statistical-heldout-8RGPIeyo.d.ts.map +1 -0
- package/dist/{summary-report-BsaEFEwA.js → summary-report-DtdRucM0.js} +2 -2
- package/dist/{summary-report-BsaEFEwA.js.map → summary-report-DtdRucM0.js.map} +1 -1
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +34 -69
- package/dist/supervisor-run/index.js.map +1 -1
- package/dist/{tree-CZ78tiPg.js → tree-kc1d80yF.js} +3 -3
- package/dist/{tree-CZ78tiPg.js.map → tree-kc1d80yF.js.map} +1 -1
- package/docs/concepts.md +14 -0
- package/docs/experiment.md +10 -0
- package/docs/trace-analysis.md +3 -0
- package/package.json +4 -3
- package/dist/analyze-runs-0cdYMgob.js.map +0 -1
- package/dist/campaign-evidence-B5qsCHEn.js.map +0 -1
- package/dist/claude-jsonl-CG3JUbTJ.js +0 -211
- package/dist/claude-jsonl-CG3JUbTJ.js.map +0 -1
- package/dist/llm-judge-C0256VT_.js.map +0 -1
- package/dist/paired-binary-b2L3WKqr.js.map +0 -1
- package/dist/produced-state-CgB9g0VX.js.map +0 -1
- package/dist/rollout-BZqQc0YY.js.map +0 -1
- package/dist/search-kernel-Bfe3kzRk.js.map +0 -1
- package/dist/series-convergence-CjO2QdRW.js +0 -43
- package/dist/series-convergence-CjO2QdRW.js.map +0 -1
- package/dist/series-convergence-hEfKdoi-.d.ts +0 -126
- package/dist/series-convergence-hEfKdoi-.d.ts.map +0 -1
- package/dist/statistical-heldout-D0rX_IDl.d.ts.map +0 -1
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { a as JudgeError } from "./errors-DEE6u6ot.js";
|
|
2
|
+
import { u as JudgeScore } from "./types-Lub7o6bN.js";
|
|
3
|
+
import { a as ContinuousCalibrationResult, i as ContinuousAgreementOptions, n as CandidateScore, o as GoldenItem, r as ContinuousAgreement, t as CalibrationResult } from "./judge-calibration-DFtEMlde.js";
|
|
4
|
+
import { a as ComputedInterval } from "./ast-hI-vjW6J.js";
|
|
5
|
+
//#region src/statistics/agreement-irr.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Inter-rater reliability — Krippendorff's α under the squared-difference
|
|
8
|
+
* metric, pooled across dimensions.
|
|
9
|
+
*
|
|
10
|
+
* Each inner array is one judge's scores. Items are matched by position
|
|
11
|
+
* WITHIN a dimension: the k-th score a judge supplies carrying dimension
|
|
12
|
+
* `d` is item k of `d`, and the ratings compared against each other are
|
|
13
|
+
* the ones different judges gave to the same item. Every judge that scores
|
|
14
|
+
* a dimension at all must supply the same number of scores for it —
|
|
15
|
+
* ragged input cannot be aligned into items and throws rather than
|
|
16
|
+
* comparing mismatched items.
|
|
17
|
+
*
|
|
18
|
+
* α = 1 − D_observed / D_expected: D_observed averages the squared
|
|
19
|
+
* difference over within-item judge pairs, D_expected over every pair of
|
|
20
|
+
* ratings irrespective of item. α = 1 is perfect agreement, 0 is chance,
|
|
21
|
+
* negative is systematic disagreement.
|
|
22
|
+
*/
|
|
23
|
+
declare function interRaterReliability(judgeScores: JudgeScore[][]): number;
|
|
24
|
+
interface CorpusScoreRecord {
|
|
25
|
+
/** Stable identifier for the rated item (scenario, span, turn, …). */
|
|
26
|
+
itemId: string;
|
|
27
|
+
/** Identifier for the judge that produced this score. */
|
|
28
|
+
judgeName: string;
|
|
29
|
+
/** Dimension name (matches `JudgeScore.dimension`). */
|
|
30
|
+
dimension: string;
|
|
31
|
+
/** Numeric score; must be finite. */
|
|
32
|
+
score: number;
|
|
33
|
+
}
|
|
34
|
+
interface CorpusAgreementPerDimension extends ContinuousAgreement {
|
|
35
|
+
dimension: string;
|
|
36
|
+
/** Item IDs that contributed to this dimension's matrix (every judge scored them). */
|
|
37
|
+
itemIds: string[];
|
|
38
|
+
/** Judge IDs that contributed to this dimension's matrix. */
|
|
39
|
+
judgeIds: string[];
|
|
40
|
+
}
|
|
41
|
+
interface CorpusAgreementReport {
|
|
42
|
+
/** Per-dimension ICC(2,1) + κ_w + Pearson + Spearman + bootstrap CIs. */
|
|
43
|
+
perDimension: CorpusAgreementPerDimension[];
|
|
44
|
+
/** Mean ICC across dimensions (NaN if no dimension yielded a finite ICC). */
|
|
45
|
+
overallIcc: number;
|
|
46
|
+
/** Mean weighted κ across dimensions (NaN if none finite). */
|
|
47
|
+
overallWeightedKappa: number;
|
|
48
|
+
/** Dimensions evaluated (sorted). */
|
|
49
|
+
dimensions: string[];
|
|
50
|
+
/** Judges seen across the corpus (sorted). */
|
|
51
|
+
judgeIds: string[];
|
|
52
|
+
}
|
|
53
|
+
interface CorpusAgreementOptions extends ContinuousAgreementOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Restrict the audit to these dimensions. Default = every dimension
|
|
56
|
+
* that appears in the input. A dimension named here but absent from
|
|
57
|
+
* the input throws — silent omission would corrupt the overall metric.
|
|
58
|
+
*/
|
|
59
|
+
dimensions?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* Restrict the audit to these judges. Default = every judge that
|
|
62
|
+
* appears in the input. A judge named here but absent from a
|
|
63
|
+
* dimension throws (see "fail loud" below).
|
|
64
|
+
*/
|
|
65
|
+
judges?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Corpus-wide inter-rater agreement across N items × M judges × D dimensions.
|
|
69
|
+
*
|
|
70
|
+
* For each dimension, builds the [n_items][n_judges] matrix of scores
|
|
71
|
+
* (keeping only items every judge rated on that dimension), then runs
|
|
72
|
+
* `continuousAgreement` to get ICC(2,1), κ_w, Pearson, Spearman, and
|
|
73
|
+
* bootstrap CIs. Reports a pooled mean across dimensions as a single
|
|
74
|
+
* "is this judge panel reliable on this corpus?" number.
|
|
75
|
+
*
|
|
76
|
+
* Fail-loud contract:
|
|
77
|
+
* - Empty input throws.
|
|
78
|
+
* - Fewer than 2 judges or fewer than 2 items per dimension throws.
|
|
79
|
+
* - A judge present in some dimensions but with zero scored items on
|
|
80
|
+
* another dimension throws (would silently shrink the matrix).
|
|
81
|
+
* - Duplicate (itemId, judgeName, dimension) records throw.
|
|
82
|
+
*/
|
|
83
|
+
declare function corpusInterRaterAgreement(records: CorpusScoreRecord[], opts?: CorpusAgreementOptions): CorpusAgreementReport;
|
|
84
|
+
/**
|
|
85
|
+
* Convenience adapter for `JudgeScore[]` data keyed externally by item.
|
|
86
|
+
*
|
|
87
|
+
* Use when you have per-item arrays of `JudgeScore[]` (e.g. one
|
|
88
|
+
* `ScenarioResult.judgeScores` per scenario) and want corpus-wide
|
|
89
|
+
* agreement without manually flattening. `itemId` must be unique per
|
|
90
|
+
* row of `itemsScores`.
|
|
91
|
+
*/
|
|
92
|
+
declare function corpusInterRaterAgreementFromJudgeScores(itemsScores: Array<{
|
|
93
|
+
itemId: string;
|
|
94
|
+
scores: JudgeScore[];
|
|
95
|
+
}>, opts?: CorpusAgreementOptions): CorpusAgreementReport;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/series-convergence.d.ts
|
|
98
|
+
/**
|
|
99
|
+
* Series convergence — detects whether a sequence of scalar measurements
|
|
100
|
+
* is stabilizing, drifting, or noisy. It reads drift *across* runs, e.g.
|
|
101
|
+
* "are my nightly eval scores stabilizing?".
|
|
102
|
+
*
|
|
103
|
+
* Three signals:
|
|
104
|
+
* - stabilized: last K values have low variance (< epsilon) — done
|
|
105
|
+
* - drifting: recent trend is monotonic and beyond noise — regressing or improving
|
|
106
|
+
* - noisy: neither — keep iterating, but flag as untrustworthy for gating
|
|
107
|
+
*/
|
|
108
|
+
interface SeriesConvergenceOptions {
|
|
109
|
+
/** Window size for "recent" analysis (default 5). */
|
|
110
|
+
window?: number;
|
|
111
|
+
/** Coefficient-of-variation threshold below which the window is stabilized (default 0.05 = 5%). */
|
|
112
|
+
stableCv?: number;
|
|
113
|
+
/** Minimum monotone run length to call drift (default 3). */
|
|
114
|
+
driftRun?: number;
|
|
115
|
+
}
|
|
116
|
+
interface SeriesConvergenceResult {
|
|
117
|
+
state: 'stabilized' | 'drifting-up' | 'drifting-down' | 'noisy' | 'insufficient-data';
|
|
118
|
+
windowMean: number;
|
|
119
|
+
windowCv: number;
|
|
120
|
+
/** Longest monotonic run at the tail of the series (positive for up, negative for down). */
|
|
121
|
+
tailRun: number;
|
|
122
|
+
/** True when n ≥ window AND windowCv ≤ stableCv. */
|
|
123
|
+
stable: boolean;
|
|
124
|
+
}
|
|
125
|
+
declare function analyzeSeries(values: number[], options?: SeriesConvergenceOptions): SeriesConvergenceResult;
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/meta-eval/sentinel.d.ts
|
|
128
|
+
declare const SENTINEL_METRIC_NAMES: readonly ['irr', 'calibrationKappa', 'sentinelPassRate'];
|
|
129
|
+
type SentinelMetricName = (typeof SENTINEL_METRIC_NAMES)[number];
|
|
130
|
+
interface SentinelMetrics {
|
|
131
|
+
/** Inter-rater reliability — ICC(2,1) from agreement instruments. */
|
|
132
|
+
irr?: number;
|
|
133
|
+
/** Weighted κ vs the human golden set (`calibrateJudge*`). */
|
|
134
|
+
calibrationKappa?: number;
|
|
135
|
+
/** Fraction of a fixed sentinel golden set the judge still scores within tolerance. */
|
|
136
|
+
sentinelPassRate?: number;
|
|
137
|
+
}
|
|
138
|
+
interface SentinelSnapshot {
|
|
139
|
+
/** Caller-supplied ISO-8601 timestamp — the module never reads a clock. */
|
|
140
|
+
at: string;
|
|
141
|
+
judgeId: string;
|
|
142
|
+
/** Exact model identity behind the judge (pin the full version string). */
|
|
143
|
+
judgeModel: string;
|
|
144
|
+
/**
|
|
145
|
+
* Metrics measured at `at`. May be empty: an empty-metrics snapshot is a
|
|
146
|
+
* model-change marker — it records the new `judgeModel` immediately and
|
|
147
|
+
* the silent-upgrade alarm stays raised until a golden-grounded snapshot
|
|
148
|
+
* (calibrationKappa or sentinelPassRate) follows.
|
|
149
|
+
*/
|
|
150
|
+
metrics: SentinelMetrics;
|
|
151
|
+
}
|
|
152
|
+
/** Identity + timestamp the caller supplies alongside an instrument output. */
|
|
153
|
+
interface SnapshotMeta {
|
|
154
|
+
at: string;
|
|
155
|
+
judgeId: string;
|
|
156
|
+
judgeModel: string;
|
|
157
|
+
}
|
|
158
|
+
/** Shape guard for snapshots crossing a boundary (store append, JSONL load, report input). */
|
|
159
|
+
declare function validateSentinelSnapshot(snapshot: SentinelSnapshot, source?: string): void;
|
|
160
|
+
/**
|
|
161
|
+
* From `calibrateJudge` / `calibrateJudgeContinuous` output. Prefers the
|
|
162
|
+
* un-rounded continuous κ_w when the report carries one (integer κ
|
|
163
|
+
* discards information for [0,1] judges).
|
|
164
|
+
*/
|
|
165
|
+
declare function snapshotFromCalibration(report: CalibrationResult | ContinuousCalibrationResult, meta: SnapshotMeta): SentinelSnapshot;
|
|
166
|
+
/**
|
|
167
|
+
* From `corpusInterRaterAgreement` (statistics.ts) or `continuousAgreement`
|
|
168
|
+
* (judge-calibration.ts) output. IRR = ICC(2,1) — the reliability
|
|
169
|
+
* coefficient both instruments compute. For ensemble-level agreement,
|
|
170
|
+
* `meta.judgeId` names the ensemble and `meta.judgeModel` pins its
|
|
171
|
+
* composition (e.g. a joined list of member model strings).
|
|
172
|
+
*/
|
|
173
|
+
declare function snapshotFromAgreement(report: CorpusAgreementReport | ContinuousAgreement, meta: SnapshotMeta): SentinelSnapshot;
|
|
174
|
+
interface SentinelSetOptions {
|
|
175
|
+
/** Max |judge − human| for an item to count as passed. Default 0.1 (tuned for [0,1] scores). */
|
|
176
|
+
tolerance?: number;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* From a rerun of a fixed sentinel golden set: the same `GoldenItem`s the
|
|
180
|
+
* judge was originally calibrated on, re-scored periodically. Pass rate =
|
|
181
|
+
* fraction of joined items where the judge stays within `tolerance` of the
|
|
182
|
+
* human score. Items the judge didn't score are excluded from the
|
|
183
|
+
* denominator; zero joined items is an error, not a 0% pass rate.
|
|
184
|
+
*/
|
|
185
|
+
declare function snapshotFromSentinelSet(scores: CandidateScore[], golden: GoldenItem[], meta: SnapshotMeta, options?: SentinelSetOptions): SentinelSnapshot;
|
|
186
|
+
interface SentinelStore {
|
|
187
|
+
append(snapshot: SentinelSnapshot): Promise<void>;
|
|
188
|
+
/** All snapshots (optionally for one judge), in append order. */
|
|
189
|
+
history(judgeId?: string): Promise<SentinelSnapshot[]>;
|
|
190
|
+
}
|
|
191
|
+
declare function inMemorySentinelStore(initial?: SentinelSnapshot[]): SentinelStore;
|
|
192
|
+
/**
|
|
193
|
+
* JSONL store — one snapshot per line, appended atomically per call.
|
|
194
|
+
* A corrupt or shape-invalid line is a loud error naming the file and
|
|
195
|
+
* line number: a sentinel history that silently drops records would
|
|
196
|
+
* defeat the drift detection it exists to provide.
|
|
197
|
+
*/
|
|
198
|
+
declare function fileSentinelStore(path: string): SentinelStore;
|
|
199
|
+
interface SentinelThresholds {
|
|
200
|
+
/** Floor for irr — below it the judge ensemble is unreliable regardless of trend. Default 0.6. */
|
|
201
|
+
minIrr?: number;
|
|
202
|
+
/** Max tolerated calibrationKappa drop vs the series baseline. Default 0.15. */
|
|
203
|
+
maxKappaDrop?: number;
|
|
204
|
+
/** Max tolerated sentinelPassRate drop vs the series baseline. Default 0.1. */
|
|
205
|
+
maxSentinelDrop?: number;
|
|
206
|
+
/** Newest snapshot older than this (days, vs asOf) = the sentinel itself went blind. Default 30. */
|
|
207
|
+
staleAfterDays?: number;
|
|
208
|
+
}
|
|
209
|
+
interface JudgeSentinelOptions {
|
|
210
|
+
/** Caller-supplied ISO timestamp staleness is measured against. */
|
|
211
|
+
asOf: string;
|
|
212
|
+
thresholds?: SentinelThresholds;
|
|
213
|
+
/** Forwarded to `analyzeSeries` (window, stableCv, driftRun). */
|
|
214
|
+
convergence?: SeriesConvergenceOptions;
|
|
215
|
+
}
|
|
216
|
+
interface SentinelTrend {
|
|
217
|
+
judgeId: string;
|
|
218
|
+
metric: SentinelMetricName;
|
|
219
|
+
/** Verbatim `analyzeSeries` state for this judge×metric history. */
|
|
220
|
+
state: SeriesConvergenceResult['state'];
|
|
221
|
+
/** Newest value in the series. */
|
|
222
|
+
current: number;
|
|
223
|
+
/** Oldest value in the series — the reference the drop thresholds compare against. */
|
|
224
|
+
baseline: number;
|
|
225
|
+
/** current − baseline (signed; negative = decayed). */
|
|
226
|
+
drift: number;
|
|
227
|
+
alarmed: boolean;
|
|
228
|
+
reason?: string;
|
|
229
|
+
}
|
|
230
|
+
interface SentinelReport {
|
|
231
|
+
perJudge: SentinelTrend[];
|
|
232
|
+
alarms: string[];
|
|
233
|
+
healthy: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* `judgeId:metric` pairs with too few snapshots for the convergence
|
|
236
|
+
* machine. Named, not counted — a blind spot you can't see is a blind
|
|
237
|
+
* spot you won't fix. Floor/drop checks still apply to thin series, so
|
|
238
|
+
* insufficient history alone never masks an alarm.
|
|
239
|
+
*/
|
|
240
|
+
insufficientHistory: string[];
|
|
241
|
+
}
|
|
242
|
+
declare function judgeSentinelReport(history: SentinelSnapshot[], opts: JudgeSentinelOptions): SentinelReport;
|
|
243
|
+
interface EvalHealthStamp {
|
|
244
|
+
healthy: boolean;
|
|
245
|
+
alarms: string[];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The object a campaign attaches to its verdicts. Compute it from the
|
|
249
|
+
* sentinel report in a post-campaign hook (or a nightly job feeding the
|
|
250
|
+
* next day's campaigns) and store it alongside the verdict payload.
|
|
251
|
+
* `healthy: false` means the judges that produced those verdicts have an
|
|
252
|
+
* unresolved drift / decay / silent-upgrade / staleness alarm — treat the
|
|
253
|
+
* verdicts as carrying an integrity warning until recalibration clears it.
|
|
254
|
+
*/
|
|
255
|
+
declare function evalHealthStamp(report: SentinelReport): EvalHealthStamp;
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/meta-eval/judge-gate.d.ts
|
|
258
|
+
type OwnerVerdict = 'pass' | 'fail';
|
|
259
|
+
/** One item the owner decided, with where that decision is recorded. */
|
|
260
|
+
interface CalibrationExample {
|
|
261
|
+
/** Stable id of the decided item; a judge run names it in `exampleId`. */
|
|
262
|
+
id: string;
|
|
263
|
+
verdict: OwnerVerdict;
|
|
264
|
+
/** The person whose verdict this is. Never a model. */
|
|
265
|
+
labeledBy: string;
|
|
266
|
+
/** ISO-8601 time the verdict was given. */
|
|
267
|
+
labeledAt: string;
|
|
268
|
+
/** Where the verdict is recorded, e.g. `gtm:asset_decision:<id>`. */
|
|
269
|
+
source: string;
|
|
270
|
+
/** What the owner judged (an image digest, a run id), so a replay judges the same thing. */
|
|
271
|
+
evidenceRef?: string;
|
|
272
|
+
note?: string;
|
|
273
|
+
}
|
|
274
|
+
interface JudgeCalibrationSet {
|
|
275
|
+
judgeId: string;
|
|
276
|
+
/** Whose verdicts the judge stands in for. */
|
|
277
|
+
owner: string;
|
|
278
|
+
examples: readonly CalibrationExample[];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Validate a calibration set and return a normalized copy ordered by example
|
|
282
|
+
* id. Every verdict needs its person, time and source; ids are unique.
|
|
283
|
+
*/
|
|
284
|
+
declare function registerCalibrationSet(set: JudgeCalibrationSet): JudgeCalibrationSet;
|
|
285
|
+
interface CalibrationMerge {
|
|
286
|
+
set: JudgeCalibrationSet;
|
|
287
|
+
/** Ids that joined the set. */
|
|
288
|
+
added: string[];
|
|
289
|
+
/** Ids whose verdict a later decision replaced. */
|
|
290
|
+
superseded: string[];
|
|
291
|
+
/** Ids whose incoming verdict was already recorded, or older than the recorded one. */
|
|
292
|
+
unchanged: string[];
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Join new owner verdicts to a set. A verdict already recorded from the same
|
|
296
|
+
* source is unchanged, so ingestion can rerun. A later verdict on an item
|
|
297
|
+
* replaces an earlier one: the owner changed their mind, and the set keeps
|
|
298
|
+
* what they decided last.
|
|
299
|
+
*/
|
|
300
|
+
declare function addCalibrationVerdicts(set: JudgeCalibrationSet, verdicts: readonly CalibrationExample[]): CalibrationMerge;
|
|
301
|
+
/** One gate decision the judge made on a calibration example. */
|
|
302
|
+
interface JudgeRun {
|
|
303
|
+
exampleId: string;
|
|
304
|
+
/** The judge's decision after its own sample aggregation (median, majority). */
|
|
305
|
+
verdict: OwnerVerdict;
|
|
306
|
+
/** The per-sample verdicts behind that decision, when the judge samples. */
|
|
307
|
+
samples?: readonly OwnerVerdict[];
|
|
308
|
+
}
|
|
309
|
+
interface JudgeRunMeta {
|
|
310
|
+
judgeId: string;
|
|
311
|
+
/** Exact model identity, or `deterministic` for a grader without one. */
|
|
312
|
+
judgeModel: string;
|
|
313
|
+
rubricVersion: string;
|
|
314
|
+
measuredAt: string;
|
|
315
|
+
}
|
|
316
|
+
interface JudgeConfusion {
|
|
317
|
+
/** Judge pass, owner pass. */
|
|
318
|
+
truePass: number;
|
|
319
|
+
/** Judge fail, owner fail. */
|
|
320
|
+
trueFail: number;
|
|
321
|
+
/** Judge pass, owner fail: the judge let through what the owner rejected. */
|
|
322
|
+
falsePass: number;
|
|
323
|
+
/** Judge fail, owner pass: the judge blocked what the owner accepted. */
|
|
324
|
+
falseFail: number;
|
|
325
|
+
}
|
|
326
|
+
interface JudgeExampleAgreement {
|
|
327
|
+
id: string;
|
|
328
|
+
verdict: OwnerVerdict;
|
|
329
|
+
runs: number;
|
|
330
|
+
/** Share of runs that passed. */
|
|
331
|
+
passRate: number;
|
|
332
|
+
/** Share of runs that reached the owner's verdict. */
|
|
333
|
+
agreement: number;
|
|
334
|
+
}
|
|
335
|
+
interface JudgeAgreement extends JudgeRunMeta {
|
|
336
|
+
owner: string;
|
|
337
|
+
/** Examples in the calibration set. */
|
|
338
|
+
examples: number;
|
|
339
|
+
/** Examples the judge ran on at least once. */
|
|
340
|
+
judged: number;
|
|
341
|
+
/** Judged examples per owner verdict. */
|
|
342
|
+
judgedByVerdict: Record<OwnerVerdict, number>;
|
|
343
|
+
runs: number;
|
|
344
|
+
/** Runs that reached the owner's verdict, over all runs; null with no runs. */
|
|
345
|
+
accuracy: number | null;
|
|
346
|
+
/**
|
|
347
|
+
* Exact (Clopper-Pearson) 95% interval for the share of judged examples on
|
|
348
|
+
* which every run reached the owner's verdict. Examples, not runs, are the
|
|
349
|
+
* independent units.
|
|
350
|
+
*/
|
|
351
|
+
exampleAccuracy: {
|
|
352
|
+
agreed: number;
|
|
353
|
+
judged: number;
|
|
354
|
+
interval: ComputedInterval;
|
|
355
|
+
} | null;
|
|
356
|
+
/**
|
|
357
|
+
* Cohen's κ between the judge and the owner over runs. Null when undefined:
|
|
358
|
+
* no runs, or both sides used a single verdict.
|
|
359
|
+
*/
|
|
360
|
+
kappa: number | null;
|
|
361
|
+
/** Runs that failed what the owner passed, over runs on owner passes; null with none. A veto judge is held to this. */
|
|
362
|
+
falseFailRate: number | null;
|
|
363
|
+
/** Runs that failed what the owner failed, over runs on owner fails; null with none. */
|
|
364
|
+
catchRate: number | null;
|
|
365
|
+
confusion: JudgeConfusion;
|
|
366
|
+
variance: {
|
|
367
|
+
/** Mean over judged examples of p(1 − p), p the example's run pass rate. 0 = no run changed its mind. */
|
|
368
|
+
betweenRuns: number | null;
|
|
369
|
+
/** Mean over runs that reported samples of p(1 − p) across those samples; null when none did. */
|
|
370
|
+
withinRun: number | null;
|
|
371
|
+
/** Examples whose runs disagree with each other. */
|
|
372
|
+
unstable: string[];
|
|
373
|
+
};
|
|
374
|
+
/** Examples with at least one run against the owner, least agreement first. */
|
|
375
|
+
disagreements: JudgeExampleAgreement[];
|
|
376
|
+
/** Examples without any run. */
|
|
377
|
+
unjudged: string[];
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Agreement between a judge's runs and the owner's verdicts on one
|
|
381
|
+
* calibration set. A run that names an example outside the set is an error:
|
|
382
|
+
* a silently dropped run would overstate agreement.
|
|
383
|
+
*/
|
|
384
|
+
declare function measureJudgeAgreement(set: JudgeCalibrationSet, runs: readonly JudgeRun[], meta: JudgeRunMeta): JudgeAgreement;
|
|
385
|
+
interface JudgeGatePolicy {
|
|
386
|
+
/**
|
|
387
|
+
* `verdict`: the judge passes and blocks, so accuracy and κ must hold.
|
|
388
|
+
* `veto`: it only blocks, so its false-fail rate on owner passes must hold.
|
|
389
|
+
*/
|
|
390
|
+
decides: 'verdict' | 'veto';
|
|
391
|
+
/** Judged examples required before the judge may gate; for a veto judge, owner passes. */
|
|
392
|
+
minExamples: number;
|
|
393
|
+
/** Judged examples required of each owner verdict, so κ is defined. */
|
|
394
|
+
minPerVerdict: number;
|
|
395
|
+
/** Floor on run accuracy. */
|
|
396
|
+
minAccuracy: number;
|
|
397
|
+
/** Floor on Cohen's κ. */
|
|
398
|
+
minKappa: number;
|
|
399
|
+
/** Ceiling on a veto judge's false-fail rate. */
|
|
400
|
+
maxFalseFailRate: number;
|
|
401
|
+
/** A report older than this (days, vs `asOf`) no longer calibrates the judge. */
|
|
402
|
+
maxAgeDays: number;
|
|
403
|
+
/** Drift thresholds forwarded to `judgeSentinelReport` over the history. */
|
|
404
|
+
drift?: SentinelThresholds;
|
|
405
|
+
}
|
|
406
|
+
declare const DEFAULT_JUDGE_GATE_POLICY: Readonly<JudgeGatePolicy>;
|
|
407
|
+
type JudgeGateStatus = 'calibrated' | 'uncalibrated' | 'below-threshold' | 'drifted';
|
|
408
|
+
interface JudgeGateDecision {
|
|
409
|
+
judgeId: string;
|
|
410
|
+
judgeModel: string;
|
|
411
|
+
rubricVersion: string;
|
|
412
|
+
/** True only for `calibrated`. */
|
|
413
|
+
mayGate: boolean;
|
|
414
|
+
status: JudgeGateStatus;
|
|
415
|
+
/** Why the judge may not gate; empty when it may. */
|
|
416
|
+
reasons: string[];
|
|
417
|
+
agreement: JudgeAgreement | null;
|
|
418
|
+
policy: JudgeGatePolicy;
|
|
419
|
+
}
|
|
420
|
+
interface JudgeGateInput {
|
|
421
|
+
judgeId: string;
|
|
422
|
+
/** The model the judge runs now. */
|
|
423
|
+
judgeModel: string;
|
|
424
|
+
/** The rubric the judge runs now. */
|
|
425
|
+
rubricVersion: string;
|
|
426
|
+
/** The latest calibration report; null when the judge was never measured. */
|
|
427
|
+
agreement: JudgeAgreement | null;
|
|
428
|
+
asOf: string;
|
|
429
|
+
/** Sentinel snapshots for this judge, oldest first or in any order. */
|
|
430
|
+
history?: readonly SentinelSnapshot[];
|
|
431
|
+
policy?: Partial<JudgeGatePolicy>;
|
|
432
|
+
}
|
|
433
|
+
/** Whether a judge may gate now, and every reason it may not. */
|
|
434
|
+
declare function judgeGateDecision(input: JudgeGateInput): JudgeGateDecision;
|
|
435
|
+
/** Thrown by `assertJudgeMayGate`; carries the refused decision. */
|
|
436
|
+
declare class JudgeGateRefusedError extends JudgeError {
|
|
437
|
+
readonly decision: JudgeGateDecision;
|
|
438
|
+
constructor(decision: JudgeGateDecision);
|
|
439
|
+
}
|
|
440
|
+
/** Throw unless the decision lets the judge gate. */
|
|
441
|
+
declare function assertJudgeMayGate(decision: JudgeGateDecision): void;
|
|
442
|
+
/**
|
|
443
|
+
* The sentinel snapshot for one calibration run. A deciding judge records
|
|
444
|
+
* accuracy as `sentinelPassRate` and κ as `calibrationKappa` when it is
|
|
445
|
+
* defined; a veto judge records the share of owner passes it let through as
|
|
446
|
+
* `sentinelPassRate`. Append it to the judge's `SentinelStore`; the gate reads
|
|
447
|
+
* drift from that history.
|
|
448
|
+
*/
|
|
449
|
+
declare function snapshotFromJudgeAgreement(agreement: JudgeAgreement, options?: {
|
|
450
|
+
decides?: JudgeGatePolicy['decides'];
|
|
451
|
+
}): SentinelSnapshot;
|
|
452
|
+
//#endregion
|
|
453
|
+
export { SentinelThresholds as A, validateSentinelSnapshot as B, JudgeSentinelOptions as C, SentinelSetOptions as D, SentinelReport as E, inMemorySentinelStore as F, CorpusAgreementPerDimension as G, SeriesConvergenceResult as H, judgeSentinelReport as I, corpusInterRaterAgreement as J, CorpusAgreementReport as K, snapshotFromAgreement as L, SnapshotMeta as M, evalHealthStamp as N, SentinelSnapshot as O, fileSentinelStore as P, snapshotFromCalibration as R, EvalHealthStamp as S, SentinelMetrics as T, analyzeSeries as U, SeriesConvergenceOptions as V, CorpusAgreementOptions as W, interRaterReliability as X, corpusInterRaterAgreementFromJudgeScores as Y, assertJudgeMayGate as _, JudgeCalibrationSet as a, registerCalibrationSet as b, JudgeGateDecision as c, JudgeGateRefusedError as d, JudgeGateStatus as f, addCalibrationVerdicts as g, OwnerVerdict as h, JudgeAgreement as i, SentinelTrend as j, SentinelStore as k, JudgeGateInput as l, JudgeRunMeta as m, CalibrationMerge as n, JudgeConfusion as o, JudgeRun as p, CorpusScoreRecord as q, DEFAULT_JUDGE_GATE_POLICY as r, JudgeExampleAgreement as s, CalibrationExample as t, JudgeGatePolicy as u, judgeGateDecision as v, SentinelMetricName as w, snapshotFromJudgeAgreement as x, measureJudgeAgreement as y, snapshotFromSentinelSet as z };
|
|
454
|
+
//# sourceMappingURL=judge-gate-B1_O0QIs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge-gate-B1_O0QIs.d.ts","names":[],"sources":["../src/statistics/agreement-irr.ts","../src/series-convergence.ts","../src/meta-eval/sentinel.ts","../src/meta-eval/judge-gate.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAyBgB,sBAAsB,aAAa;UA0ElC;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe,oCAAoC;EACnD;;EAEA;;EAEA;;UAGe;;EAEf,cAAc;;EAEd;;EAEA;;EAEA;;EAEA;;UAGe,+BAA+B;;;;;;EAM9C;;;;;;EAMA;;;;;;;;;;;;;;;;;;iBAmBc,0BACd,SAAS,qBACT,OAAM,yBACL;;;;;;;;;iBA0Ha,yCACd,aAAa;EAAQ;EAAgB,QAAQ;IAC7C,OAAM,yBACL;;;;;;;;;;;;;UCvRc;;EAEf;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;;EAEA;;EAEA;;iBAGc,cACd,kBACA,UAAS,2BACR;;;cCoBG;KAEM,6BAA6B;UAExB;;EAEf;;EAEA;;EAEA;;UAGe;;EAEf;EACA;;EAEA;;;;;;;EAOA,SAAS;;;UAIM;EACf;EACA;EACA;;;iBAcc,yBAAyB,UAAU,kBAAkB;;;;;;iBAiCrD,wBACd,QAAQ,oBAAoB,6BAC5B,MAAM,eACL;;;;;;;;iBAmBa,sBACd,QAAQ,wBAAwB,qBAChC,MAAM,eACL;UAYc;;EAEf;;;;;;;;;iBAUc,wBACd,QAAQ,kBACR,QAAQ,cACR,MAAM,cACN,UAAS,qBACR;UA4Cc;EACf,OAAO,UAAU,mBAAmB;;EAEpC,QAAQ,mBAAmB,QAAQ;;iBAGrB,sBAAsB,UAAS,qBAA0B;;;;;;;iBAqBzD,kBAAkB,eAAe;UA0ChC;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;;EAEf;EACA,aAAa;;EAEb,cAAc;;UAGC;EACf;EACA,QAAQ;;EAER,OAAO;;EAEP;;EAEA;;EAEA;EACA;EACA;;UAGe;EACf,UAAU;EACV;EACA;;;;;;;EAOA;;iBAKc,oBACd,SAAS,oBACT,MAAM,uBACL;UA6Gc;EACf;EACA;;;;;;;;;;iBAWc,gBAAgB,QAAQ,iBAAiB;;;KChb7C;;UAGK;;EAEf;EACA,SAAS;;EAET;;EAEA;;EAEA;;EAEA;EACA;;UAGe;EACf;;EAEA;EACA,mBAAmB;;;;;;iBAuDL,uBAAuB,KAAK,sBAAsB;UAwBjD;EACf,KAAK;;EAEL;;EAEA;;EAEA;;;;;;;;iBASc,uBACd,KAAK,qBACL,mBAAmB,uBAClB;;UAkCc;EACf;;EAEA,SAAS;;EAET,mBAAmB;;UAGJ;EACf;;EAEA;EACA;EACA;;UAGe;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;EACf;EACA,SAAS;EACT;;EAEA;;EAEA;;UAGe,uBAAuB;EACtC;;EAEA;;EAEA;;EAEA,iBAAiB,OAAO;EACxB;;EAEA;;;;;;EAMA;IAAmB;IAAgB;IAAgB,UAAU;;;;;;EAK7D;;EAEA;;EAEA;EACA,WAAW;EACX;;IAEE;;IAEA;;IAEA;;;EAGF,eAAe;;EAEf;;;;;;;iBAyBc,sBACd,KAAK,qBACL,eAAe,YACf,MAAM,eACL;UA+Gc;;;;;EAKf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;cAGG,2BAA2B,SAAS;KAUrC;UAEK;EACf;EACA;EACA;;EAEA;EACA,QAAQ;;EAER;EACA,WAAW;EACX,QAAQ;;UAGO;EACf;;EAEA;;EAEA;;EAEA,WAAW;EACX;;EAEA,mBAAmB;EACnB,SAAS,QAAQ;;;iBAUH,kBAAkB,OAAO,iBAAiB;;cA2G7C,8BAA8B;WAChC,UAAU;EAEnB,YAAY,UAAU;;;iBASR,mBAAmB,UAAU;;;;;;;;iBAW7B,2BACd,WAAW,gBACX;EAAW,UAAU;IACpB"}
|