@tangle-network/agent-eval 1.0.38 → 1.0.40
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 +12 -0
- package/dist/adapters/http.d.ts +1 -1
- package/dist/{agent-profile-BKgR30kv.d.ts → agent-profile-hytrwAnN.d.ts} +166 -166
- package/dist/agent-profile-hytrwAnN.d.ts.map +1 -0
- package/dist/analyst/index.d.ts +2 -2
- package/dist/analyst/index.js +5 -5
- package/dist/app-grade/index.d.ts +1 -1
- package/dist/{benchmark-command-BpmrrgzA.js → benchmark-command-CJw3ijDV.js} +5 -5
- package/dist/{benchmark-command-BpmrrgzA.js.map → benchmark-command-CJw3ijDV.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 +3 -3
- package/dist/campaign/index.js +3 -3
- package/dist/{campaign-BU6bJNvu.js → campaign-DawSkDag.js} +3 -3
- package/dist/{campaign-BU6bJNvu.js.map → campaign-DawSkDag.js.map} +1 -1
- package/dist/{statistical-heldout-RmdXoz2e.d.ts → campaign-evidence-C1c6uihA.d.ts} +413 -413
- package/dist/campaign-evidence-C1c6uihA.d.ts.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/contract/index.d.ts +5 -5
- package/dist/contract/index.js +4 -4
- package/dist/{default-registry-CpGvgSYQ.js → default-registry-BE5Rj9ba.js} +8 -32
- package/dist/default-registry-BE5Rj9ba.js.map +1 -0
- package/dist/default-registry-C5x2jyD6.d.ts.map +1 -1
- package/dist/{define-agent-eval-4KGwzIVt.d.ts → define-agent-eval-C4yoCqkc.d.ts} +3 -4
- package/dist/define-agent-eval-C4yoCqkc.d.ts.map +1 -0
- package/dist/{define-agent-eval-BeLMK-OM.js → define-agent-eval-CyU7eAzj.js} +5 -4
- package/dist/define-agent-eval-CyU7eAzj.js.map +1 -0
- package/dist/{dspy-rlm-engine-EC-Pkdf-.js → dspy-rlm-engine-aM1RWOUT.js} +2 -2
- package/dist/{dspy-rlm-engine-EC-Pkdf-.js.map → dspy-rlm-engine-aM1RWOUT.js.map} +1 -1
- package/dist/experiment/index.d.ts +1 -1
- package/dist/{feedback-trajectory-FamLu3Wt.d.ts → feedback-trajectory-CCWiFzeE.d.ts} +2 -2
- package/dist/{feedback-trajectory-FamLu3Wt.d.ts.map → feedback-trajectory-CCWiFzeE.d.ts.map} +1 -1
- package/dist/{findings-store-71J302Ls.js → findings-store-B8pq8Rhr.js} +3 -3
- package/dist/{findings-store-71J302Ls.js.map → findings-store-B8pq8Rhr.js.map} +1 -1
- package/dist/{index-BsTGJf2M.d.ts → index-BuuUhU_V.d.ts} +9 -9
- package/dist/{index-BsTGJf2M.d.ts.map → index-BuuUhU_V.d.ts.map} +1 -1
- package/dist/{index-CzEGCOWM.d.ts → index-CXoFLNKI.d.ts} +4 -4
- package/dist/{index-CzEGCOWM.d.ts.map → index-CXoFLNKI.d.ts.map} +1 -1
- package/dist/{index-RBV2Y-7X.d.ts → index-HdlzN11G.d.ts} +2 -2
- package/dist/{index-RBV2Y-7X.d.ts.map → index-HdlzN11G.d.ts.map} +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +8 -8
- package/dist/{kind-factory-BTUq1Byh.js → kind-factory-B5FfFE5G.js} +20 -2
- package/dist/{kind-factory-BTUq1Byh.js.map → kind-factory-B5FfFE5G.js.map} +1 -1
- package/dist/{llm-judge-BBHrAlcE.js → llm-judge-DHgx29ro.js} +74 -20
- package/dist/llm-judge-DHgx29ro.js.map +1 -0
- package/dist/openapi.json +1 -1
- package/dist/{researcher-k925Q6Jb.d.ts → researcher-DvFDa1o1.d.ts} +2 -2
- package/dist/{researcher-k925Q6Jb.d.ts.map → researcher-DvFDa1o1.d.ts.map} +1 -1
- package/dist/rl.d.ts +1 -1
- package/dist/{index-OvU1UXKC.d.ts → run-improvement-loop-BAxDnaPI.d.ts} +1619 -1619
- package/dist/run-improvement-loop-BAxDnaPI.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-BmfnAzG4.js → skillopt-optimization-method-Du3GbReg.js} +10 -4
- package/dist/{skillopt-optimization-method-BmfnAzG4.js.map → skillopt-optimization-method-Du3GbReg.js.map} +1 -1
- package/dist/{store-otlp-DQK9hCtH.js → store-otlp-DHc_E78m.js} +2 -2
- package/dist/{store-otlp-DQK9hCtH.js.map → store-otlp-DHc_E78m.js.map} +1 -1
- package/dist/{store-tool-spans-BRR9hsPP.js → store-tool-spans-BR4IhZYZ.js} +3 -3
- package/dist/{store-tool-spans-BRR9hsPP.js.map → store-tool-spans-BR4IhZYZ.js.map} +1 -1
- package/dist/traces.js +3 -3
- package/dist/wire/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/agent-profile-BKgR30kv.d.ts.map +0 -1
- package/dist/default-registry-CpGvgSYQ.js.map +0 -1
- package/dist/define-agent-eval-4KGwzIVt.d.ts.map +0 -1
- package/dist/define-agent-eval-BeLMK-OM.js.map +0 -1
- package/dist/index-OvU1UXKC.d.ts.map +0 -1
- package/dist/llm-judge-BBHrAlcE.js.map +0 -1
- package/dist/statistical-heldout-RmdXoz2e.d.ts.map +0 -1
|
@@ -63,367 +63,6 @@ declare class FinalEvidenceConflictError extends FinalEvidenceError {
|
|
|
63
63
|
declare function openFinalEvidenceLedger(options: {
|
|
64
64
|
path: string;
|
|
65
65
|
}): FinalEvidenceLedger;
|
|
66
|
-
/**
|
|
67
|
-
* Reproducibility attestation for any serializable report object.
|
|
68
|
-
*
|
|
69
|
-
* `attest()` binds a report to its content address (sha-256 over canonical
|
|
70
|
-
* JSON) AND binds that address to the provenance needed to reproduce it:
|
|
71
|
-
* model versions, seeds, price-table hash, code SHA, inputs hash. The outer
|
|
72
|
-
* `envelopeHash` prevents provenance from being rewritten while leaving the
|
|
73
|
-
* report hash valid.
|
|
74
|
-
*
|
|
75
|
-
* Layering: content-addressing is the substrate's job; cryptographic SIGNING
|
|
76
|
-
* (who vouches for the attestation, key management, transparency logs) is the
|
|
77
|
-
* consumer's layer on top. An `AttestedReport` is a stable byte-identical
|
|
78
|
-
* payload a consumer can sign — the substrate never holds keys.
|
|
79
|
-
*
|
|
80
|
-
* Generic by design: the report parameter is ANY value `canonicalJson`
|
|
81
|
-
* accepts (campaign results, fuzz capsules, scorecards, cost ledgers). Do not
|
|
82
|
-
* couple this module to a specific report schema.
|
|
83
|
-
*/
|
|
84
|
-
/** Hash scheme identifier carried by every attestation. A verifier rejects
|
|
85
|
-
* unknown algorithms instead of guessing. */
|
|
86
|
-
declare const ATTESTATION_ALGORITHM: "sha256/canonical-json";
|
|
87
|
-
interface AttestationProvenance {
|
|
88
|
-
/** Every model involved in producing the report, name → version/id. */
|
|
89
|
-
modelVersions: Record<string, string>;
|
|
90
|
-
/** RNG seeds the run was driven by, when seeded. */
|
|
91
|
-
seeds?: number[];
|
|
92
|
-
/** Content hash of the price table used for cost figures — cost numbers
|
|
93
|
-
* are only reproducible against the same prices. */
|
|
94
|
-
priceTableHash?: string;
|
|
95
|
-
/** Git SHA of the code that produced the report. */
|
|
96
|
-
codeSha: string;
|
|
97
|
-
/** Content hash of the input set (scenarios, dataset manifest, ...). */
|
|
98
|
-
inputsHash?: string;
|
|
99
|
-
/** ISO-8601 timestamp, caller-supplied — the substrate stays clock-free
|
|
100
|
-
* so attestation is deterministic and testable. */
|
|
101
|
-
createdAt: string;
|
|
102
|
-
}
|
|
103
|
-
interface AttestedReport {
|
|
104
|
-
/** Hex sha-256 over the canonical JSON of the report. */
|
|
105
|
-
reportHash: string;
|
|
106
|
-
provenance: AttestationProvenance;
|
|
107
|
-
algorithm: typeof ATTESTATION_ALGORITHM;
|
|
108
|
-
/** Hex sha-256 over `{ reportHash, provenance, algorithm }`. */
|
|
109
|
-
envelopeHash: string;
|
|
110
|
-
}
|
|
111
|
-
interface AttestationVerification {
|
|
112
|
-
valid: boolean;
|
|
113
|
-
/** Populated iff `valid` is false — names the exact mismatch. */
|
|
114
|
-
reason?: string;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Content-address a report and bind it to its provenance. Throws (via
|
|
118
|
-
* `canonicalJson`) if the report or provenance contains undefined / function /
|
|
119
|
-
* symbol / non-finite numbers — an attestation that cannot be unambiguously
|
|
120
|
-
* serialized cannot be trusted.
|
|
121
|
-
*/
|
|
122
|
-
declare function attest(report: unknown, provenance: AttestationProvenance): AttestedReport;
|
|
123
|
-
/**
|
|
124
|
-
* Verify a report against its attestation. Returns a typed outcome rather
|
|
125
|
-
* than throwing: an unverifiable report (e.g. one that no longer
|
|
126
|
-
* canonicalizes) is a verification failure with the cause in `reason`, not a
|
|
127
|
-
* crash — verifiers run in pipelines that must record WHY, not die.
|
|
128
|
-
*
|
|
129
|
-
* Both the report hash and the provenance envelope must verify.
|
|
130
|
-
* Missing envelope hashes cannot establish provenance and fail verification.
|
|
131
|
-
*/
|
|
132
|
-
declare function verifyAttestation(report: unknown, attested: AttestedReport): AttestationVerification;
|
|
133
|
-
declare const EVIDENCE_RECEIPT_VERSION: "1.0.0";
|
|
134
|
-
/** Closed promotion vocabulary. A typo or unknown future kind is never independent by default. */
|
|
135
|
-
declare const EVIDENCE_AUTHORITY_KINDS: readonly ["candidate-self-report", "independent-evaluator", "independent-replication", "human-review", "production-canary"];
|
|
136
|
-
type EvidenceAuthorityKind = (typeof EVIDENCE_AUTHORITY_KINDS)[number];
|
|
137
|
-
interface EvidenceAuthority {
|
|
138
|
-
readonly kind: EvidenceAuthorityKind;
|
|
139
|
-
/** Stable authority/service/person identifier; never inferred from model prose. */
|
|
140
|
-
readonly id: string;
|
|
141
|
-
}
|
|
142
|
-
interface EvidenceBinding {
|
|
143
|
-
readonly schemaVersion: typeof EVIDENCE_RECEIPT_VERSION;
|
|
144
|
-
/** Stable objective identity spanning retries, forks, resumes, and multiple runs. */
|
|
145
|
-
readonly pursuitId: string;
|
|
146
|
-
/** Concrete execution/evaluation run this evidence was produced from. */
|
|
147
|
-
readonly runId: string;
|
|
148
|
-
/** Exact candidate/program/profile bundle under evaluation. */
|
|
149
|
-
readonly candidateDigest: string;
|
|
150
|
-
/** Exact evaluator/checker program or registered experiment definition. */
|
|
151
|
-
readonly evaluatorDigest: string;
|
|
152
|
-
/** Exact sandbox/container/dependency/environment identity. */
|
|
153
|
-
readonly environmentDigest: string;
|
|
154
|
-
/** Commitment to the input set. The hidden inputs themselves need not be exposed. */
|
|
155
|
-
readonly inputSetCommitment: string;
|
|
156
|
-
/** Content identity of the raw evaluated output/artifact set. */
|
|
157
|
-
readonly outputDigest: string;
|
|
158
|
-
/** Content identity of the evaluation result/report/verdict body. */
|
|
159
|
-
readonly resultDigest: string;
|
|
160
|
-
readonly authority: EvidenceAuthority;
|
|
161
|
-
/** Optional experiment seal that governed the evaluation. */
|
|
162
|
-
readonly experimentDigest?: string;
|
|
163
|
-
/** Optional observer-journal chain tip covering the execution being evaluated. */
|
|
164
|
-
readonly observerDigest?: string;
|
|
165
|
-
}
|
|
166
|
-
interface EvidenceReceipt {
|
|
167
|
-
readonly binding: EvidenceBinding;
|
|
168
|
-
readonly attestation: AttestedReport;
|
|
169
|
-
}
|
|
170
|
-
interface EvidenceReceiptVerification {
|
|
171
|
-
readonly valid: boolean;
|
|
172
|
-
readonly reason?: string;
|
|
173
|
-
}
|
|
174
|
-
interface CreateEvidenceReceiptInput extends Omit<EvidenceBinding, 'schemaVersion'> {}
|
|
175
|
-
/**
|
|
176
|
-
* Mint a content-attested evidence receipt. Required identity fields are deliberately
|
|
177
|
-
* non-optional: unknown evidence stays unknown and cannot accidentally look certified.
|
|
178
|
-
* The attestation's input provenance must equal the receipt commitment so two competing
|
|
179
|
-
* descriptions of the evaluated population cannot coexist inside one valid receipt.
|
|
180
|
-
*/
|
|
181
|
-
declare function createEvidenceReceipt(input: CreateEvidenceReceiptInput, provenance: AttestationProvenance): EvidenceReceipt;
|
|
182
|
-
/**
|
|
183
|
-
* Verify evidence identity and its provenance envelope. Changing the evaluator,
|
|
184
|
-
* model versions, input commitment, or creation record invalidates the evidence.
|
|
185
|
-
*/
|
|
186
|
-
declare function verifyEvidenceReceipt(receipt: EvidenceReceipt): EvidenceReceiptVerification;
|
|
187
|
-
/**
|
|
188
|
-
* Promotion may choose a stricter policy, but this primitive makes the basic separation
|
|
189
|
-
* explicit: only a recognized independent authority is independent. Unknown/forged kinds
|
|
190
|
-
* and candidate self-reports both return false.
|
|
191
|
-
*/
|
|
192
|
-
declare function isIndependentEvidence(receipt: EvidenceReceipt): boolean;
|
|
193
|
-
/** Caller-owned execution context. Eval never infers evaluator authority or environment identity. */
|
|
194
|
-
type CampaignEvidenceContext = Pick<CreateEvidenceReceiptInput, 'pursuitId' | 'evaluatorDigest' | 'environmentDigest' | 'authority' | 'experimentDigest' | 'observerDigest'> & {
|
|
195
|
-
provenance: Omit<AttestationProvenance, 'inputsHash'>;
|
|
196
|
-
};
|
|
197
|
-
/** Bind a complete measured campaign to its executed surface and actual outputs. */
|
|
198
|
-
declare function createCampaignEvidenceReceipt<S extends Scenario, A>(input: {
|
|
199
|
-
campaign: CampaignResult<A, S>;
|
|
200
|
-
surface: MutableSurface;
|
|
201
|
-
context: CampaignEvidenceContext;
|
|
202
|
-
}): EvidenceReceipt;
|
|
203
|
-
/**
|
|
204
|
-
* Pareto frontier — multi-objective optimization over candidate runs.
|
|
205
|
-
*
|
|
206
|
-
* Lifted from ADC pareto.ts and blueprint-agent frontier.ts. When you're
|
|
207
|
-
* trading off (cost, latency, quality) or (passRate, tokenBudget,
|
|
208
|
-
* ttfb), you rarely have a single "winner" — you have a set of
|
|
209
|
-
* non-dominated candidates. This module exposes:
|
|
210
|
-
*
|
|
211
|
-
* - `paretoFrontier`: filter a set of candidates to the non-dominated ones
|
|
212
|
-
* - `dominates`: does A dominate B across all objectives?
|
|
213
|
-
*
|
|
214
|
-
* Each objective is declared with a direction: 'maximize' (higher=better)
|
|
215
|
-
* or 'minimize' (lower=better). Candidates are any object; pass an
|
|
216
|
-
* `objective(candidate)` accessor.
|
|
217
|
-
*/
|
|
218
|
-
type Direction = 'maximize' | 'minimize';
|
|
219
|
-
interface Objective<T> {
|
|
220
|
-
/** Stable label used in reports. */
|
|
221
|
-
name: string;
|
|
222
|
-
direction: Direction;
|
|
223
|
-
value: (candidate: T) => number;
|
|
224
|
-
}
|
|
225
|
-
interface ParetoResult<T> {
|
|
226
|
-
frontier: T[];
|
|
227
|
-
dominated: T[];
|
|
228
|
-
/** Index map: frontier[i] dominates each of dominatedBy[i]. */
|
|
229
|
-
dominanceMap: Array<{
|
|
230
|
-
dominator: T;
|
|
231
|
-
dominated: T[];
|
|
232
|
-
}>;
|
|
233
|
-
}
|
|
234
|
-
/** Does candidate A weakly dominate B — strictly better on at least one objective and no worse on any? */
|
|
235
|
-
declare function dominates<T>(a: T, b: T, objectives: Objective<T>[]): boolean;
|
|
236
|
-
/**
|
|
237
|
-
* Compute the non-dominated frontier. Candidates with NaN/Infinity on any
|
|
238
|
-
* objective are excluded (can't rank them). A candidate enters the frontier
|
|
239
|
-
* iff no other candidate dominates it.
|
|
240
|
-
*/
|
|
241
|
-
declare function paretoFrontier<T>(candidates: T[], objectives: Objective<T>[]): ParetoResult<T>;
|
|
242
|
-
/** Where an objective's per-cell scalar comes from. `composite` reads the
|
|
243
|
-
* judge's composite; `dimension` reads a named per-dimension score. */
|
|
244
|
-
type ObjectiveSource = {
|
|
245
|
-
kind: 'composite';
|
|
246
|
-
} | {
|
|
247
|
-
kind: 'dimension';
|
|
248
|
-
dimension: string;
|
|
249
|
-
};
|
|
250
|
-
interface PromotionObjective {
|
|
251
|
-
/** Stable label used in reports + `contributingGates`. */
|
|
252
|
-
name: string;
|
|
253
|
-
source: ObjectiveSource;
|
|
254
|
-
/** 'maximize' (quality dims) or 'minimize' (error/risk/length dims). Orients
|
|
255
|
-
* the paired delta so a positive bootstrap always means "candidate better". */
|
|
256
|
-
direction: Direction;
|
|
257
|
-
/** Declared binary support {0, binaryScale}, including zero-only observations.
|
|
258
|
-
* Must be finite and positive; paired cell scores must be 0 or this scale.
|
|
259
|
-
* Uses the risk-difference mean and rejects the 'median' statistic. */
|
|
260
|
-
binaryScale?: number;
|
|
261
|
-
/** The good-direction paired-delta CI lower bound must EXCEED this to count
|
|
262
|
-
* as a significant gain on this axis. Interpreted in the judge's native
|
|
263
|
-
* scale. Default 0 (⇒ "confidently better"). */
|
|
264
|
-
gainThreshold?: number;
|
|
265
|
-
/** A floor breach (regression) is declared when the good-direction CI lower
|
|
266
|
-
* bound is below −floorTolerance, or when the exact small-sample test proves
|
|
267
|
-
* a drop past it. Defaults to 0.05 times the declared binary scale, or
|
|
268
|
-
* auto-scales off observed magnitudes (0.05 on [0,1], 5 on 0-100). */
|
|
269
|
-
floorTolerance?: number;
|
|
270
|
-
}
|
|
271
|
-
/** Per-axis verdict from the shared paired decision rule.
|
|
272
|
-
* 'regressed' includes uncertainty that prevents clearing the regression floor. */
|
|
273
|
-
type AxisVerdict = 'improved' | 'regressed' | 'flat' | 'few_runs' | 'indeterminate';
|
|
274
|
-
interface AxisEvidence {
|
|
275
|
-
name: string;
|
|
276
|
-
source: ObjectiveSource;
|
|
277
|
-
direction: Direction;
|
|
278
|
-
/** Paired bootstrap on the GOOD-DIRECTION delta (oriented by `direction`):
|
|
279
|
-
* a positive value means the candidate is better on this axis.
|
|
280
|
-
*
|
|
281
|
-
* DIAGNOSTIC on a pass/fail axis: there the verdict is decided on Tango's
|
|
282
|
-
* score interval instead, because a percentile bootstrap over a three-atom
|
|
283
|
-
* delta lattice is not a valid interval at the nonzero margin `floorTolerance`
|
|
284
|
-
* and `gainThreshold` create. `ci` carries the interval that decided. */
|
|
285
|
-
bootstrap: PairedBootstrapResult;
|
|
286
|
-
/** Which paired statistic `bootstrap.low`/`.high` bracket. `'mean'` unless the
|
|
287
|
-
* caller asked for the median — on a pass/fail axis the median and its whole
|
|
288
|
-
* CI are pinned at 0 by tie domination and can see neither a gain nor a
|
|
289
|
-
* regression. `bootstrap.median` still carries the median point estimate. */
|
|
290
|
-
bootstrapStatistic: 'median' | 'mean';
|
|
291
|
-
/** The interval the axis verdict was actually decided on, good-direction and
|
|
292
|
-
* in the axis's native units. */
|
|
293
|
-
ci: {
|
|
294
|
-
low: number;
|
|
295
|
-
high: number;
|
|
296
|
-
};
|
|
297
|
-
/** Which estimator produced `ci`. */
|
|
298
|
-
decisionStatistic: PairedDecisionStatistic;
|
|
299
|
-
/** McNemar's exact evidence on a pass/fail axis; null otherwise. */
|
|
300
|
-
mcnemar: PairedMcNemarEvidence | null;
|
|
301
|
-
/** `ci` has zero width or non-finite bounds. It cannot establish a gain or
|
|
302
|
-
* clear a regression floor, regardless of the point estimate. */
|
|
303
|
-
indeterminate: boolean;
|
|
304
|
-
/** Paired observations contributing to this axis. */
|
|
305
|
-
n: number;
|
|
306
|
-
minimumRequired: number;
|
|
307
|
-
decisionMethod: PairedDecisionMethod;
|
|
308
|
-
gainThreshold: number;
|
|
309
|
-
floorTolerance: number;
|
|
310
|
-
verdict: AxisVerdict;
|
|
311
|
-
}
|
|
312
|
-
interface EvidenceVector {
|
|
313
|
-
/** One entry per objective — NOTHING averaged across axes. */
|
|
314
|
-
axes: AxisEvidence[];
|
|
315
|
-
/** Smallest paired n across axes that produced observations — the binding
|
|
316
|
-
* evidence-sufficiency constraint. 0 when no axis produced observations. */
|
|
317
|
-
minN: number;
|
|
318
|
-
/** Aggregate per-side cost from the gate context (a constraint input, not a
|
|
319
|
-
* CI axis — see the module header). */
|
|
320
|
-
cost: {
|
|
321
|
-
candidate: number;
|
|
322
|
-
baseline: number;
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
/** A promotion strategy: a pure function from the evidence vector to a verdict.
|
|
326
|
-
* Many policies can run over the same `EvidenceVector` and disagree — that's
|
|
327
|
-
* the point (competing strategies, shared evidence). */
|
|
328
|
-
type PromotionPolicy = (ev: EvidenceVector) => GateResult;
|
|
329
|
-
interface BuildEvidenceVectorOptions {
|
|
330
|
-
/** Minimum paired observations before an axis can claim significance; below
|
|
331
|
-
* it the axis is `few_runs`. The exact small-sample test may require more
|
|
332
|
-
* observations at the selected confidence. */
|
|
333
|
-
minProductiveRuns?: number;
|
|
334
|
-
/** Confidence level for every axis bootstrap. Default 0.95. */
|
|
335
|
-
confidence?: number;
|
|
336
|
-
/** Bootstrap resamples. Default 2000. */
|
|
337
|
-
resamples?: number;
|
|
338
|
-
/** Fixed bootstrap seed for a deterministic, reproducible verdict. Default 1337. */
|
|
339
|
-
seed?: number;
|
|
340
|
-
/** Paired statistic every axis CI is computed on. Default `'mean'` — see
|
|
341
|
-
* {@link DECISION_PAIRED_DELTA_STATISTIC} for why the median is not. */
|
|
342
|
-
statistic?: 'mean' | 'median';
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* The Evidence Bus. For each objective, pair candidate vs baseline by full
|
|
346
|
-
* cellId and bootstrap a CI on the good-direction paired delta. Reuses the
|
|
347
|
-
* exact `pairHoldout` + `pairedBootstrap` machinery the held-out gate uses, so
|
|
348
|
-
* a single source of truth governs pairing granularity + scale handling.
|
|
349
|
-
*/
|
|
350
|
-
declare function buildEvidenceVector<TArtifact, TScenario extends Scenario>(ctx: GateContext<TArtifact, TScenario>, objectives: PromotionObjective[], opts?: BuildEvidenceVectorOptions): EvidenceVector;
|
|
351
|
-
/**
|
|
352
|
-
* Require a supported gain and every configured regression floor to clear.
|
|
353
|
-
* A failed floor holds the candidate, including when uncertainty permits a loss.
|
|
354
|
-
* Missing or indeterminate evidence requires more work; no gain holds release.
|
|
355
|
-
*/
|
|
356
|
-
declare const paretoPolicy: PromotionPolicy;
|
|
357
|
-
interface ParetoSignificanceGateOptions extends BuildEvidenceVectorOptions {
|
|
358
|
-
/** The objective vector. Every axis is both a gain source and a safety floor. */
|
|
359
|
-
objectives: PromotionObjective[];
|
|
360
|
-
/** Strategy applied to the evidence vector. Default `paretoPolicy`. Override
|
|
361
|
-
* to run a stricter/looser strategy over the SAME bus (competing policies). */
|
|
362
|
-
policy?: PromotionPolicy;
|
|
363
|
-
/** Override the gate name in reports. */
|
|
364
|
-
name?: string;
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Wrap the bus + a policy as a `Gate`. Plugs into the existing
|
|
368
|
-
* `runImprovementLoop({ gate })` slot and composes via `composeGate`; default
|
|
369
|
-
* loop behavior is unchanged because consumers opt in by passing this gate.
|
|
370
|
-
*/
|
|
371
|
-
declare function paretoSignificanceGate<TArtifact = unknown, TScenario extends Scenario = Scenario>(options: ParetoSignificanceGateOptions): Gate<TArtifact, TScenario>;
|
|
372
|
-
/**
|
|
373
|
-
* Approximate detectable lift from baseline variance and the intended sample size.
|
|
374
|
-
*
|
|
375
|
-
* Model: the ship rule is `CI.low(paired Δ) > deltaThreshold`. Approximating the
|
|
376
|
-
* bootstrap CI as normal, `CI.low ≈ effect − z·sd_Δ/√n`, so the smallest shippable
|
|
377
|
-
* effect is `MDE = deltaThreshold + z·sd_Δ/√n`. This estimates `sd_Δ` as
|
|
378
|
-
* `√2·sd_baseline`, assuming equal arm variances and zero paired correlation.
|
|
379
|
-
* Actual candidate variance and paired correlation can move the threshold in either direction.
|
|
380
|
-
* This diagnostic does not replace the gate or guarantee a detection probability.
|
|
381
|
-
*
|
|
382
|
-
* Supply one baseline mean per independent observation used by the comparison.
|
|
383
|
-
* With declared source units, repetitions and variants refine those means without increasing n.
|
|
384
|
-
* `selfImprove` attaches this diagnostic after its final measurement.
|
|
385
|
-
*/
|
|
386
|
-
interface PowerPreflightOptions {
|
|
387
|
-
/** Baseline composites at the comparison's independent observation unit. */
|
|
388
|
-
baselineComposites: number[];
|
|
389
|
-
/** Independent paired observations planned for the comparison.
|
|
390
|
-
* Defaults to `baselineComposites.length`. */
|
|
391
|
-
pairedN?: number;
|
|
392
|
-
/** The ship gate's effect-size threshold. Default 0.05 (defaultProductionGate). */
|
|
393
|
-
deltaThreshold?: number;
|
|
394
|
-
/** CI confidence the gate uses. Default 0.95. */
|
|
395
|
-
confidence?: number;
|
|
396
|
-
/** Whether the holdout uses the gate's judge family.
|
|
397
|
-
* More observations cannot establish freedom from systematic scoring bias.
|
|
398
|
-
* Default false. */
|
|
399
|
-
sharedScorerChannel?: boolean;
|
|
400
|
-
}
|
|
401
|
-
interface PowerPreflight {
|
|
402
|
-
/** Paired observations the comparison will have. */
|
|
403
|
-
n: number;
|
|
404
|
-
/** Sample standard deviation of baseline observation means. */
|
|
405
|
-
sd: number;
|
|
406
|
-
/** Approximate lift needed to put a normal interval above the gate threshold. */
|
|
407
|
-
mde: number;
|
|
408
|
-
/** Baseline holdout composite mean. */
|
|
409
|
-
baselineMean: number;
|
|
410
|
-
/** Headroom to a perfect 1.0 composite (the largest achievable lift on a [0,1] judge). */
|
|
411
|
-
headroom: number;
|
|
412
|
-
/** Whether this approximation exceeds the estimated [0,1] score headroom.
|
|
413
|
-
* This is a planning warning, not a proof that promotion is impossible. */
|
|
414
|
-
underpowered: boolean;
|
|
415
|
-
/** True when composites look [0,1]-scaled; headroom/underpowered are only
|
|
416
|
-
* meaningful under that convention (0-100 judges get mde/sd/n but no verdict). */
|
|
417
|
-
scaleAssumed: boolean;
|
|
418
|
-
deltaThreshold: number;
|
|
419
|
-
confidence: number;
|
|
420
|
-
/** Notes unmeasured systematic bias when the gate shares its scoring channel. */
|
|
421
|
-
sharedChannelCaveat?: string;
|
|
422
|
-
/** One actionable sentence for humans and logs. */
|
|
423
|
-
recommendation: string;
|
|
424
|
-
}
|
|
425
|
-
/** Estimate detectable lift from baseline independent observations before budgeting a comparison. */
|
|
426
|
-
declare function powerPreflight(opts: PowerPreflightOptions): PowerPreflight;
|
|
427
66
|
/** Expected seed identities must be supplied independently of completed observations. */
|
|
428
67
|
interface ArmAssignment {
|
|
429
68
|
pairKey: string;
|
|
@@ -558,63 +197,287 @@ interface PairedMetricDelta {
|
|
|
558
197
|
p: number;
|
|
559
198
|
} | null;
|
|
560
199
|
}
|
|
561
|
-
interface ComparePairedArmsOptions extends PairArmsOptions {
|
|
562
|
-
/** Supply all expected seeds to report as-assigned and as-formed populations. */
|
|
563
|
-
assignments?: readonly ArmAssignment[];
|
|
564
|
-
/** Metrics to compare. Default: every metric name observed on any matched
|
|
565
|
-
* pair, sorted. A name that appears on no pair is still reported (with
|
|
566
|
-
* `n = 0`) so a misspelled metric is visible instead of vanishing. */
|
|
567
|
-
metricNames?: string[];
|
|
568
|
-
/** Passed through to `pairedBootstrap` — set `seed` for reproducible CIs. */
|
|
569
|
-
bootstrap?: PairedBootstrapOptions;
|
|
200
|
+
interface ComparePairedArmsOptions extends PairArmsOptions {
|
|
201
|
+
/** Supply all expected seeds to report as-assigned and as-formed populations. */
|
|
202
|
+
assignments?: readonly ArmAssignment[];
|
|
203
|
+
/** Metrics to compare. Default: every metric name observed on any matched
|
|
204
|
+
* pair, sorted. A name that appears on no pair is still reported (with
|
|
205
|
+
* `n = 0`) so a misspelled metric is visible instead of vanishing. */
|
|
206
|
+
metricNames?: string[];
|
|
207
|
+
/** Passed through to `pairedBootstrap` — set `seed` for reproducible CIs. */
|
|
208
|
+
bootstrap?: PairedBootstrapOptions;
|
|
209
|
+
}
|
|
210
|
+
interface PairedArmsComparison {
|
|
211
|
+
/** Absent when the assignment population is unknown (no roster supplied). */
|
|
212
|
+
armPopulations?: ArmPopulationReading[];
|
|
213
|
+
nPairs: number;
|
|
214
|
+
nUnpairedBaseline: number;
|
|
215
|
+
nUnpairedTreatment: number;
|
|
216
|
+
/** null when no matched pair carries `pass` on both sides — a pass/fail
|
|
217
|
+
* verdict over rows that never measured pass/fail would be fabricated. */
|
|
218
|
+
correctness: PairedCorrectness | null;
|
|
219
|
+
metricDeltas: PairedMetricDelta[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Full matched-pair arm comparison: pair via {@link pairArms}, then compose
|
|
223
|
+
* the paired estimators from `statistics` over the matched pairs.
|
|
224
|
+
*
|
|
225
|
+
* Correctness uses only the pairs where both sides carry `pass` (`mcnemar.n`
|
|
226
|
+
* is that subset's size); each metric uses only the pairs where both sides
|
|
227
|
+
* carry a finite value for it, with the remainder counted in `nMissing`.
|
|
228
|
+
* Deltas are treatment − baseline throughout. With an assignment roster, pairing
|
|
229
|
+
* covers declared seed identities; missing observations remain identity-only rows
|
|
230
|
+
* and never contribute fabricated outcomes or metrics. Per-arm summaries report
|
|
231
|
+
* every assignment and the explicitly formed subset separately.
|
|
232
|
+
*
|
|
233
|
+
* Fail-loud: inherits {@link pairArms}'s unknown-arm throw, and throws on a
|
|
234
|
+
* non-finite metric value — silently treating corrupt telemetry as "metric
|
|
235
|
+
* absent" would misreport it as missing coverage.
|
|
236
|
+
*/
|
|
237
|
+
declare function comparePairedArms(rows: readonly PairedArmRow[], opts: ComparePairedArmsOptions): PairedArmsComparison;
|
|
238
|
+
interface MatchedRunRecordPair {
|
|
239
|
+
pairKey: string;
|
|
240
|
+
repKey: string;
|
|
241
|
+
baseline: RunRecord;
|
|
242
|
+
treatment: RunRecord;
|
|
243
|
+
}
|
|
244
|
+
interface PairRunRecordsResult {
|
|
245
|
+
pairs: MatchedRunRecordPair[];
|
|
246
|
+
unpairedBaseline: RunRecord[];
|
|
247
|
+
unpairedTreatment: RunRecord[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Pair two RunRecord arms by the identity of the evaluated work:
|
|
251
|
+
* `(experimentId, scenarioId, seed)`.
|
|
252
|
+
*
|
|
253
|
+
* Falling back to array order, candidate id, or experiment id can compare
|
|
254
|
+
* different tasks and fabricate lift. Duplicate identities throw.
|
|
255
|
+
*/
|
|
256
|
+
declare function pairRunRecords(baselineRuns: readonly RunRecord[], treatmentRuns: readonly RunRecord[]): PairRunRecordsResult;
|
|
257
|
+
/**
|
|
258
|
+
* Approximate detectable lift from baseline variance and the intended sample size.
|
|
259
|
+
*
|
|
260
|
+
* Model: the ship rule is `CI.low(paired Δ) > deltaThreshold`. Approximating the
|
|
261
|
+
* bootstrap CI as normal, `CI.low ≈ effect − z·sd_Δ/√n`, so the smallest shippable
|
|
262
|
+
* effect is `MDE = deltaThreshold + z·sd_Δ/√n`. This estimates `sd_Δ` as
|
|
263
|
+
* `√2·sd_baseline`, assuming equal arm variances and zero paired correlation.
|
|
264
|
+
* Actual candidate variance and paired correlation can move the threshold in either direction.
|
|
265
|
+
* This diagnostic does not replace the gate or guarantee a detection probability.
|
|
266
|
+
*
|
|
267
|
+
* Supply one baseline mean per independent observation used by the comparison.
|
|
268
|
+
* With declared source units, repetitions and variants refine those means without increasing n.
|
|
269
|
+
* `selfImprove` attaches this diagnostic after its final measurement.
|
|
270
|
+
*/
|
|
271
|
+
interface PowerPreflightOptions {
|
|
272
|
+
/** Baseline composites at the comparison's independent observation unit. */
|
|
273
|
+
baselineComposites: number[];
|
|
274
|
+
/** Independent paired observations planned for the comparison.
|
|
275
|
+
* Defaults to `baselineComposites.length`. */
|
|
276
|
+
pairedN?: number;
|
|
277
|
+
/** The ship gate's effect-size threshold. Default 0.05 (defaultProductionGate). */
|
|
278
|
+
deltaThreshold?: number;
|
|
279
|
+
/** CI confidence the gate uses. Default 0.95. */
|
|
280
|
+
confidence?: number;
|
|
281
|
+
/** Whether the holdout uses the gate's judge family.
|
|
282
|
+
* More observations cannot establish freedom from systematic scoring bias.
|
|
283
|
+
* Default false. */
|
|
284
|
+
sharedScorerChannel?: boolean;
|
|
285
|
+
}
|
|
286
|
+
interface PowerPreflight {
|
|
287
|
+
/** Paired observations the comparison will have. */
|
|
288
|
+
n: number;
|
|
289
|
+
/** Sample standard deviation of baseline observation means. */
|
|
290
|
+
sd: number;
|
|
291
|
+
/** Approximate lift needed to put a normal interval above the gate threshold. */
|
|
292
|
+
mde: number;
|
|
293
|
+
/** Baseline holdout composite mean. */
|
|
294
|
+
baselineMean: number;
|
|
295
|
+
/** Headroom to a perfect 1.0 composite (the largest achievable lift on a [0,1] judge). */
|
|
296
|
+
headroom: number;
|
|
297
|
+
/** Whether this approximation exceeds the estimated [0,1] score headroom.
|
|
298
|
+
* This is a planning warning, not a proof that promotion is impossible. */
|
|
299
|
+
underpowered: boolean;
|
|
300
|
+
/** True when composites look [0,1]-scaled; headroom/underpowered are only
|
|
301
|
+
* meaningful under that convention (0-100 judges get mde/sd/n but no verdict). */
|
|
302
|
+
scaleAssumed: boolean;
|
|
303
|
+
deltaThreshold: number;
|
|
304
|
+
confidence: number;
|
|
305
|
+
/** Notes unmeasured systematic bias when the gate shares its scoring channel. */
|
|
306
|
+
sharedChannelCaveat?: string;
|
|
307
|
+
/** One actionable sentence for humans and logs. */
|
|
308
|
+
recommendation: string;
|
|
309
|
+
}
|
|
310
|
+
/** Estimate detectable lift from baseline independent observations before budgeting a comparison. */
|
|
311
|
+
declare function powerPreflight(opts: PowerPreflightOptions): PowerPreflight;
|
|
312
|
+
/**
|
|
313
|
+
* Pareto frontier — multi-objective optimization over candidate runs.
|
|
314
|
+
*
|
|
315
|
+
* Lifted from ADC pareto.ts and blueprint-agent frontier.ts. When you're
|
|
316
|
+
* trading off (cost, latency, quality) or (passRate, tokenBudget,
|
|
317
|
+
* ttfb), you rarely have a single "winner" — you have a set of
|
|
318
|
+
* non-dominated candidates. This module exposes:
|
|
319
|
+
*
|
|
320
|
+
* - `paretoFrontier`: filter a set of candidates to the non-dominated ones
|
|
321
|
+
* - `dominates`: does A dominate B across all objectives?
|
|
322
|
+
*
|
|
323
|
+
* Each objective is declared with a direction: 'maximize' (higher=better)
|
|
324
|
+
* or 'minimize' (lower=better). Candidates are any object; pass an
|
|
325
|
+
* `objective(candidate)` accessor.
|
|
326
|
+
*/
|
|
327
|
+
type Direction = 'maximize' | 'minimize';
|
|
328
|
+
interface Objective<T> {
|
|
329
|
+
/** Stable label used in reports. */
|
|
330
|
+
name: string;
|
|
331
|
+
direction: Direction;
|
|
332
|
+
value: (candidate: T) => number;
|
|
333
|
+
}
|
|
334
|
+
interface ParetoResult<T> {
|
|
335
|
+
frontier: T[];
|
|
336
|
+
dominated: T[];
|
|
337
|
+
/** Index map: frontier[i] dominates each of dominatedBy[i]. */
|
|
338
|
+
dominanceMap: Array<{
|
|
339
|
+
dominator: T;
|
|
340
|
+
dominated: T[];
|
|
341
|
+
}>;
|
|
342
|
+
}
|
|
343
|
+
/** Does candidate A weakly dominate B — strictly better on at least one objective and no worse on any? */
|
|
344
|
+
declare function dominates<T>(a: T, b: T, objectives: Objective<T>[]): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Compute the non-dominated frontier. Candidates with NaN/Infinity on any
|
|
347
|
+
* objective are excluded (can't rank them). A candidate enters the frontier
|
|
348
|
+
* iff no other candidate dominates it.
|
|
349
|
+
*/
|
|
350
|
+
declare function paretoFrontier<T>(candidates: T[], objectives: Objective<T>[]): ParetoResult<T>;
|
|
351
|
+
/** Where an objective's per-cell scalar comes from. `composite` reads the
|
|
352
|
+
* judge's composite; `dimension` reads a named per-dimension score. */
|
|
353
|
+
type ObjectiveSource = {
|
|
354
|
+
kind: 'composite';
|
|
355
|
+
} | {
|
|
356
|
+
kind: 'dimension';
|
|
357
|
+
dimension: string;
|
|
358
|
+
};
|
|
359
|
+
interface PromotionObjective {
|
|
360
|
+
/** Stable label used in reports + `contributingGates`. */
|
|
361
|
+
name: string;
|
|
362
|
+
source: ObjectiveSource;
|
|
363
|
+
/** 'maximize' (quality dims) or 'minimize' (error/risk/length dims). Orients
|
|
364
|
+
* the paired delta so a positive bootstrap always means "candidate better". */
|
|
365
|
+
direction: Direction;
|
|
366
|
+
/** Declared binary support {0, binaryScale}, including zero-only observations.
|
|
367
|
+
* Must be finite and positive; paired cell scores must be 0 or this scale.
|
|
368
|
+
* Uses the risk-difference mean and rejects the 'median' statistic. */
|
|
369
|
+
binaryScale?: number;
|
|
370
|
+
/** The good-direction paired-delta CI lower bound must EXCEED this to count
|
|
371
|
+
* as a significant gain on this axis. Interpreted in the judge's native
|
|
372
|
+
* scale. Default 0 (⇒ "confidently better"). */
|
|
373
|
+
gainThreshold?: number;
|
|
374
|
+
/** A floor breach (regression) is declared when the good-direction CI lower
|
|
375
|
+
* bound is below −floorTolerance, or when the exact small-sample test proves
|
|
376
|
+
* a drop past it. Defaults to 0.05 times the declared binary scale, or
|
|
377
|
+
* auto-scales off observed magnitudes (0.05 on [0,1], 5 on 0-100). */
|
|
378
|
+
floorTolerance?: number;
|
|
379
|
+
}
|
|
380
|
+
/** Per-axis verdict from the shared paired decision rule.
|
|
381
|
+
* 'regressed' includes uncertainty that prevents clearing the regression floor. */
|
|
382
|
+
type AxisVerdict = 'improved' | 'regressed' | 'flat' | 'few_runs' | 'indeterminate';
|
|
383
|
+
interface AxisEvidence {
|
|
384
|
+
name: string;
|
|
385
|
+
source: ObjectiveSource;
|
|
386
|
+
direction: Direction;
|
|
387
|
+
/** Paired bootstrap on the GOOD-DIRECTION delta (oriented by `direction`):
|
|
388
|
+
* a positive value means the candidate is better on this axis.
|
|
389
|
+
*
|
|
390
|
+
* DIAGNOSTIC on a pass/fail axis: there the verdict is decided on Tango's
|
|
391
|
+
* score interval instead, because a percentile bootstrap over a three-atom
|
|
392
|
+
* delta lattice is not a valid interval at the nonzero margin `floorTolerance`
|
|
393
|
+
* and `gainThreshold` create. `ci` carries the interval that decided. */
|
|
394
|
+
bootstrap: PairedBootstrapResult;
|
|
395
|
+
/** Which paired statistic `bootstrap.low`/`.high` bracket. `'mean'` unless the
|
|
396
|
+
* caller asked for the median — on a pass/fail axis the median and its whole
|
|
397
|
+
* CI are pinned at 0 by tie domination and can see neither a gain nor a
|
|
398
|
+
* regression. `bootstrap.median` still carries the median point estimate. */
|
|
399
|
+
bootstrapStatistic: 'median' | 'mean';
|
|
400
|
+
/** The interval the axis verdict was actually decided on, good-direction and
|
|
401
|
+
* in the axis's native units. */
|
|
402
|
+
ci: {
|
|
403
|
+
low: number;
|
|
404
|
+
high: number;
|
|
405
|
+
};
|
|
406
|
+
/** Which estimator produced `ci`. */
|
|
407
|
+
decisionStatistic: PairedDecisionStatistic;
|
|
408
|
+
/** McNemar's exact evidence on a pass/fail axis; null otherwise. */
|
|
409
|
+
mcnemar: PairedMcNemarEvidence | null;
|
|
410
|
+
/** `ci` has zero width or non-finite bounds. It cannot establish a gain or
|
|
411
|
+
* clear a regression floor, regardless of the point estimate. */
|
|
412
|
+
indeterminate: boolean;
|
|
413
|
+
/** Paired observations contributing to this axis. */
|
|
414
|
+
n: number;
|
|
415
|
+
minimumRequired: number;
|
|
416
|
+
decisionMethod: PairedDecisionMethod;
|
|
417
|
+
gainThreshold: number;
|
|
418
|
+
floorTolerance: number;
|
|
419
|
+
verdict: AxisVerdict;
|
|
420
|
+
}
|
|
421
|
+
interface EvidenceVector {
|
|
422
|
+
/** One entry per objective — NOTHING averaged across axes. */
|
|
423
|
+
axes: AxisEvidence[];
|
|
424
|
+
/** Smallest paired n across axes that produced observations — the binding
|
|
425
|
+
* evidence-sufficiency constraint. 0 when no axis produced observations. */
|
|
426
|
+
minN: number;
|
|
427
|
+
/** Aggregate per-side cost from the gate context (a constraint input, not a
|
|
428
|
+
* CI axis — see the module header). */
|
|
429
|
+
cost: {
|
|
430
|
+
candidate: number;
|
|
431
|
+
baseline: number;
|
|
432
|
+
};
|
|
570
433
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
*
|
|
579
|
-
|
|
580
|
-
|
|
434
|
+
/** A promotion strategy: a pure function from the evidence vector to a verdict.
|
|
435
|
+
* Many policies can run over the same `EvidenceVector` and disagree — that's
|
|
436
|
+
* the point (competing strategies, shared evidence). */
|
|
437
|
+
type PromotionPolicy = (ev: EvidenceVector) => GateResult;
|
|
438
|
+
interface BuildEvidenceVectorOptions {
|
|
439
|
+
/** Minimum paired observations before an axis can claim significance; below
|
|
440
|
+
* it the axis is `few_runs`. The exact small-sample test may require more
|
|
441
|
+
* observations at the selected confidence. */
|
|
442
|
+
minProductiveRuns?: number;
|
|
443
|
+
/** Confidence level for every axis bootstrap. Default 0.95. */
|
|
444
|
+
confidence?: number;
|
|
445
|
+
/** Bootstrap resamples. Default 2000. */
|
|
446
|
+
resamples?: number;
|
|
447
|
+
/** Fixed bootstrap seed for a deterministic, reproducible verdict. Default 1337. */
|
|
448
|
+
seed?: number;
|
|
449
|
+
/** Paired statistic every axis CI is computed on. Default `'mean'` — see
|
|
450
|
+
* {@link DECISION_PAIRED_DELTA_STATISTIC} for why the median is not. */
|
|
451
|
+
statistic?: 'mean' | 'median';
|
|
581
452
|
}
|
|
582
453
|
/**
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
* is that subset's size); each metric uses only the pairs where both sides
|
|
588
|
-
* carry a finite value for it, with the remainder counted in `nMissing`.
|
|
589
|
-
* Deltas are treatment − baseline throughout. With an assignment roster, pairing
|
|
590
|
-
* covers declared seed identities; missing observations remain identity-only rows
|
|
591
|
-
* and never contribute fabricated outcomes or metrics. Per-arm summaries report
|
|
592
|
-
* every assignment and the explicitly formed subset separately.
|
|
593
|
-
*
|
|
594
|
-
* Fail-loud: inherits {@link pairArms}'s unknown-arm throw, and throws on a
|
|
595
|
-
* non-finite metric value — silently treating corrupt telemetry as "metric
|
|
596
|
-
* absent" would misreport it as missing coverage.
|
|
454
|
+
* The Evidence Bus. For each objective, pair candidate vs baseline by full
|
|
455
|
+
* cellId and bootstrap a CI on the good-direction paired delta. Reuses the
|
|
456
|
+
* exact `pairHoldout` + `pairedBootstrap` machinery the held-out gate uses, so
|
|
457
|
+
* a single source of truth governs pairing granularity + scale handling.
|
|
597
458
|
*/
|
|
598
|
-
declare function
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
interface
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
459
|
+
declare function buildEvidenceVector<TArtifact, TScenario extends Scenario>(ctx: GateContext<TArtifact, TScenario>, objectives: PromotionObjective[], opts?: BuildEvidenceVectorOptions): EvidenceVector;
|
|
460
|
+
/**
|
|
461
|
+
* Require a supported gain and every configured regression floor to clear.
|
|
462
|
+
* A failed floor holds the candidate, including when uncertainty permits a loss.
|
|
463
|
+
* Missing or indeterminate evidence requires more work; no gain holds release.
|
|
464
|
+
*/
|
|
465
|
+
declare const paretoPolicy: PromotionPolicy;
|
|
466
|
+
interface ParetoSignificanceGateOptions extends BuildEvidenceVectorOptions {
|
|
467
|
+
/** The objective vector. Every axis is both a gain source and a safety floor. */
|
|
468
|
+
objectives: PromotionObjective[];
|
|
469
|
+
/** Strategy applied to the evidence vector. Default `paretoPolicy`. Override
|
|
470
|
+
* to run a stricter/looser strategy over the SAME bus (competing policies). */
|
|
471
|
+
policy?: PromotionPolicy;
|
|
472
|
+
/** Override the gate name in reports. */
|
|
473
|
+
name?: string;
|
|
609
474
|
}
|
|
610
475
|
/**
|
|
611
|
-
*
|
|
612
|
-
* `(
|
|
613
|
-
*
|
|
614
|
-
* Falling back to array order, candidate id, or experiment id can compare
|
|
615
|
-
* different tasks and fabricate lift. Duplicate identities throw.
|
|
476
|
+
* Wrap the bus + a policy as a `Gate`. Plugs into the existing
|
|
477
|
+
* `runImprovementLoop({ gate })` slot and composes via `composeGate`; default
|
|
478
|
+
* loop behavior is unchanged because consumers opt in by passing this gate.
|
|
616
479
|
*/
|
|
617
|
-
declare function
|
|
480
|
+
declare function paretoSignificanceGate<TArtifact = unknown, TScenario extends Scenario = Scenario>(options: ParetoSignificanceGateOptions): Gate<TArtifact, TScenario>;
|
|
618
481
|
/**
|
|
619
482
|
* Pre-registered hypotheses — declare what you're testing BEFORE the
|
|
620
483
|
* run, check it AFTER. Prevents p-hacking, optional stopping, and the
|
|
@@ -998,5 +861,142 @@ declare function dimensionRegressions(candidate: Map<string, Record<string, Judg
|
|
|
998
861
|
independentUnitByScenarioId?: ReadonlyMap<string, string>;
|
|
999
862
|
minProductiveRuns?: number;
|
|
1000
863
|
}): DimensionRegression[];
|
|
1001
|
-
|
|
1002
|
-
|
|
864
|
+
/**
|
|
865
|
+
* Reproducibility attestation for any serializable report object.
|
|
866
|
+
*
|
|
867
|
+
* `attest()` binds a report to its content address (sha-256 over canonical
|
|
868
|
+
* JSON) AND binds that address to the provenance needed to reproduce it:
|
|
869
|
+
* model versions, seeds, price-table hash, code SHA, inputs hash. The outer
|
|
870
|
+
* `envelopeHash` prevents provenance from being rewritten while leaving the
|
|
871
|
+
* report hash valid.
|
|
872
|
+
*
|
|
873
|
+
* Layering: content-addressing is the substrate's job; cryptographic SIGNING
|
|
874
|
+
* (who vouches for the attestation, key management, transparency logs) is the
|
|
875
|
+
* consumer's layer on top. An `AttestedReport` is a stable byte-identical
|
|
876
|
+
* payload a consumer can sign — the substrate never holds keys.
|
|
877
|
+
*
|
|
878
|
+
* Generic by design: the report parameter is ANY value `canonicalJson`
|
|
879
|
+
* accepts (campaign results, fuzz capsules, scorecards, cost ledgers). Do not
|
|
880
|
+
* couple this module to a specific report schema.
|
|
881
|
+
*/
|
|
882
|
+
/** Hash scheme identifier carried by every attestation. A verifier rejects
|
|
883
|
+
* unknown algorithms instead of guessing. */
|
|
884
|
+
declare const ATTESTATION_ALGORITHM: "sha256/canonical-json";
|
|
885
|
+
interface AttestationProvenance {
|
|
886
|
+
/** Every model involved in producing the report, name → version/id. */
|
|
887
|
+
modelVersions: Record<string, string>;
|
|
888
|
+
/** RNG seeds the run was driven by, when seeded. */
|
|
889
|
+
seeds?: number[];
|
|
890
|
+
/** Content hash of the price table used for cost figures — cost numbers
|
|
891
|
+
* are only reproducible against the same prices. */
|
|
892
|
+
priceTableHash?: string;
|
|
893
|
+
/** Git SHA of the code that produced the report. */
|
|
894
|
+
codeSha: string;
|
|
895
|
+
/** Content hash of the input set (scenarios, dataset manifest, ...). */
|
|
896
|
+
inputsHash?: string;
|
|
897
|
+
/** ISO-8601 timestamp, caller-supplied — the substrate stays clock-free
|
|
898
|
+
* so attestation is deterministic and testable. */
|
|
899
|
+
createdAt: string;
|
|
900
|
+
}
|
|
901
|
+
interface AttestedReport {
|
|
902
|
+
/** Hex sha-256 over the canonical JSON of the report. */
|
|
903
|
+
reportHash: string;
|
|
904
|
+
provenance: AttestationProvenance;
|
|
905
|
+
algorithm: typeof ATTESTATION_ALGORITHM;
|
|
906
|
+
/** Hex sha-256 over `{ reportHash, provenance, algorithm }`. */
|
|
907
|
+
envelopeHash: string;
|
|
908
|
+
}
|
|
909
|
+
interface AttestationVerification {
|
|
910
|
+
valid: boolean;
|
|
911
|
+
/** Populated iff `valid` is false — names the exact mismatch. */
|
|
912
|
+
reason?: string;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Content-address a report and bind it to its provenance. Throws (via
|
|
916
|
+
* `canonicalJson`) if the report or provenance contains undefined / function /
|
|
917
|
+
* symbol / non-finite numbers — an attestation that cannot be unambiguously
|
|
918
|
+
* serialized cannot be trusted.
|
|
919
|
+
*/
|
|
920
|
+
declare function attest(report: unknown, provenance: AttestationProvenance): AttestedReport;
|
|
921
|
+
/**
|
|
922
|
+
* Verify a report against its attestation. Returns a typed outcome rather
|
|
923
|
+
* than throwing: an unverifiable report (e.g. one that no longer
|
|
924
|
+
* canonicalizes) is a verification failure with the cause in `reason`, not a
|
|
925
|
+
* crash — verifiers run in pipelines that must record WHY, not die.
|
|
926
|
+
*
|
|
927
|
+
* Both the report hash and the provenance envelope must verify.
|
|
928
|
+
* Missing envelope hashes cannot establish provenance and fail verification.
|
|
929
|
+
*/
|
|
930
|
+
declare function verifyAttestation(report: unknown, attested: AttestedReport): AttestationVerification;
|
|
931
|
+
declare const EVIDENCE_RECEIPT_VERSION: "1.0.0";
|
|
932
|
+
/** Closed promotion vocabulary. A typo or unknown future kind is never independent by default. */
|
|
933
|
+
declare const EVIDENCE_AUTHORITY_KINDS: readonly ["candidate-self-report", "independent-evaluator", "independent-replication", "human-review", "production-canary"];
|
|
934
|
+
type EvidenceAuthorityKind = (typeof EVIDENCE_AUTHORITY_KINDS)[number];
|
|
935
|
+
interface EvidenceAuthority {
|
|
936
|
+
readonly kind: EvidenceAuthorityKind;
|
|
937
|
+
/** Stable authority/service/person identifier; never inferred from model prose. */
|
|
938
|
+
readonly id: string;
|
|
939
|
+
}
|
|
940
|
+
interface EvidenceBinding {
|
|
941
|
+
readonly schemaVersion: typeof EVIDENCE_RECEIPT_VERSION;
|
|
942
|
+
/** Stable objective identity spanning retries, forks, resumes, and multiple runs. */
|
|
943
|
+
readonly pursuitId: string;
|
|
944
|
+
/** Concrete execution/evaluation run this evidence was produced from. */
|
|
945
|
+
readonly runId: string;
|
|
946
|
+
/** Exact candidate/program/profile bundle under evaluation. */
|
|
947
|
+
readonly candidateDigest: string;
|
|
948
|
+
/** Exact evaluator/checker program or registered experiment definition. */
|
|
949
|
+
readonly evaluatorDigest: string;
|
|
950
|
+
/** Exact sandbox/container/dependency/environment identity. */
|
|
951
|
+
readonly environmentDigest: string;
|
|
952
|
+
/** Commitment to the input set. The hidden inputs themselves need not be exposed. */
|
|
953
|
+
readonly inputSetCommitment: string;
|
|
954
|
+
/** Content identity of the raw evaluated output/artifact set. */
|
|
955
|
+
readonly outputDigest: string;
|
|
956
|
+
/** Content identity of the evaluation result/report/verdict body. */
|
|
957
|
+
readonly resultDigest: string;
|
|
958
|
+
readonly authority: EvidenceAuthority;
|
|
959
|
+
/** Optional experiment seal that governed the evaluation. */
|
|
960
|
+
readonly experimentDigest?: string;
|
|
961
|
+
/** Optional observer-journal chain tip covering the execution being evaluated. */
|
|
962
|
+
readonly observerDigest?: string;
|
|
963
|
+
}
|
|
964
|
+
interface EvidenceReceipt {
|
|
965
|
+
readonly binding: EvidenceBinding;
|
|
966
|
+
readonly attestation: AttestedReport;
|
|
967
|
+
}
|
|
968
|
+
interface EvidenceReceiptVerification {
|
|
969
|
+
readonly valid: boolean;
|
|
970
|
+
readonly reason?: string;
|
|
971
|
+
}
|
|
972
|
+
interface CreateEvidenceReceiptInput extends Omit<EvidenceBinding, 'schemaVersion'> {}
|
|
973
|
+
/**
|
|
974
|
+
* Mint a content-attested evidence receipt. Required identity fields are deliberately
|
|
975
|
+
* non-optional: unknown evidence stays unknown and cannot accidentally look certified.
|
|
976
|
+
* The attestation's input provenance must equal the receipt commitment so two competing
|
|
977
|
+
* descriptions of the evaluated population cannot coexist inside one valid receipt.
|
|
978
|
+
*/
|
|
979
|
+
declare function createEvidenceReceipt(input: CreateEvidenceReceiptInput, provenance: AttestationProvenance): EvidenceReceipt;
|
|
980
|
+
/**
|
|
981
|
+
* Verify evidence identity and its provenance envelope. Changing the evaluator,
|
|
982
|
+
* model versions, input commitment, or creation record invalidates the evidence.
|
|
983
|
+
*/
|
|
984
|
+
declare function verifyEvidenceReceipt(receipt: EvidenceReceipt): EvidenceReceiptVerification;
|
|
985
|
+
/**
|
|
986
|
+
* Promotion may choose a stricter policy, but this primitive makes the basic separation
|
|
987
|
+
* explicit: only a recognized independent authority is independent. Unknown/forged kinds
|
|
988
|
+
* and candidate self-reports both return false.
|
|
989
|
+
*/
|
|
990
|
+
declare function isIndependentEvidence(receipt: EvidenceReceipt): boolean;
|
|
991
|
+
/** Caller-owned execution context. Eval never infers evaluator authority or environment identity. */
|
|
992
|
+
type CampaignEvidenceContext = Pick<CreateEvidenceReceiptInput, 'pursuitId' | 'evaluatorDigest' | 'environmentDigest' | 'authority' | 'experimentDigest' | 'observerDigest'> & {
|
|
993
|
+
provenance: Omit<AttestationProvenance, 'inputsHash'>;
|
|
994
|
+
};
|
|
995
|
+
/** Bind a complete measured campaign to its executed surface and actual outputs. */
|
|
996
|
+
declare function createCampaignEvidenceReceipt<S extends Scenario, A>(input: {
|
|
997
|
+
campaign: CampaignResult<A, S>;
|
|
998
|
+
surface: MutableSurface;
|
|
999
|
+
context: CampaignEvidenceContext;
|
|
1000
|
+
}): EvidenceReceipt;
|
|
1001
|
+
export { Objective as $, SequentialPairedGateOptions as A, signManifest as B, heldoutSignificance as C, FinalEvidenceError as Ct, SequentialGateDecision as D, FinalEvidenceRecord as Dt, SequentialDecideOptions as E, FinalEvidenceOutcome as Et, HypothesisResult as F, EvidenceVector as G, AxisEvidence as H, SignedManifest as I, PromotionObjective as J, ObjectiveSource as K, SignedManifestAlgo as L, sequentialDecide as M, sequentialPairedGate as N, SequentialObservation as O, FinalEvidenceReservation as Ot, HypothesisManifest as P, paretoSignificanceGate as Q, hashJson as R, dimensionRegressions as S, FinalEvidenceConflictError as St, SequentialDecideFn as T, FinalEvidenceMeasurement as Tt, AxisVerdict as U, verifyManifest as V, BuildEvidenceVectorOptions as W, buildEvidenceVector as X, PromotionPolicy as Y, paretoPolicy as Z, verifyAttestation as _, pairArms as _t, EvidenceAuthorityKind as a, powerPreflight as at, HeldoutSignificanceOptions as b, ArmPopulationReading as bt, EvidenceReceiptVerification as c, MatchedRunRecordPair as ct, verifyEvidenceReceipt as d, PairRunRecordsResult as dt, ParetoResult as et, ATTESTATION_ALGORITHM as f, PairedArmRow as ft, attest as g, comparePairedArms as gt, AttestedReport as h, PairedMetricDelta as ht, EvidenceAuthority as i, PowerPreflightOptions as it, SequentialStreamState as j, SequentialPairedGate as k, openFinalEvidenceLedger as kt, createEvidenceReceipt as l, PairArmsOptions as lt, AttestationVerification as m, PairedCorrectness as mt, createCampaignEvidenceReceipt as n, paretoFrontier as nt, EvidenceBinding as o, ComparePairedArmsOptions as ot, AttestationProvenance as p, PairedArmsComparison as pt, ParetoSignificanceGateOptions as q, CreateEvidenceReceiptInput as r, PowerPreflight as rt, EvidenceReceipt as s, MatchedPair as st, CampaignEvidenceContext as t, dominates as tt, isIndependentEvidence as u, PairArmsResult as ut, DimensionRegression as v, pairRunRecords as vt, pairHoldout as w, FinalEvidenceLedger as wt, PairedHoldout as x, ArmPopulationSummary as xt, HeldoutSignificance as y, ArmAssignment as yt, manifestContentDigest as z };
|
|
1002
|
+
//# sourceMappingURL=campaign-evidence-C1c6uihA.d.ts.map
|