@rulvar/evals 1.0.0 → 1.2.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/dist/index.d.ts +97 -12
- package/dist/index.js +166 -13
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CompiledWorkflow, Effort, Engine, EvidenceRef, Json, JsonSchema, ModelClaim, ModelKnowledgeStore, ModelRef, ModelSpec, RunOutcome, SchemaSpec, TaskClass, Usage, WireError, Workflow } from "@rulvar/core";
|
|
1
|
+
import { CompiledWorkflow, DeclaredLadder, Effort, Engine, EvidenceRef, Json, JsonSchema, KnowledgeSnapshot, ModelClaim, ModelKnowledgeStore, ModelRef, ModelSpec, RunOutcome, SchemaSpec, TaskClass, Usage, WireError, Workflow } from "@rulvar/core";
|
|
2
2
|
|
|
3
3
|
//#region src/case.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* One quality-measurement case
|
|
5
|
+
* One quality-measurement case. The shape is the
|
|
6
6
|
* documented interface verbatim; display names derive from the workflow
|
|
7
7
|
* name (the suite runner disambiguates duplicates by ordinal).
|
|
8
8
|
*/
|
|
@@ -24,7 +24,7 @@ interface GraderVerdict {
|
|
|
24
24
|
/**
|
|
25
25
|
* A judge invocation specification. The judge runs through the engine as
|
|
26
26
|
* an ordinary journaled, budgeted invocation; model selection is subject
|
|
27
|
-
* to the router quality floors
|
|
27
|
+
* to the router quality floors,
|
|
28
28
|
* and @rulvar/evals ships NO default judge model: weak defaults for
|
|
29
29
|
* judging are forbidden, so the model is always explicit.
|
|
30
30
|
*/
|
|
@@ -65,7 +65,7 @@ interface EvalCaseResult {
|
|
|
65
65
|
judgeCostUsd: number;
|
|
66
66
|
/**
|
|
67
67
|
* run:start to run:end of the target run, from event timestamps; no
|
|
68
|
-
* separate measurement channel exists
|
|
68
|
+
* separate measurement channel exists.
|
|
69
69
|
*/
|
|
70
70
|
latencyMs: number;
|
|
71
71
|
/** The target run's normalized usage. */
|
|
@@ -162,7 +162,7 @@ declare function rubricGrader(criteria: RubricCriterion[], options?: RubricGrade
|
|
|
162
162
|
/** The default judge verdict shape. */
|
|
163
163
|
declare const JUDGE_VERDICT_SCHEMA: JsonSchema;
|
|
164
164
|
interface JudgeGraderOptions {
|
|
165
|
-
/** Judge model; required, never defaulted (
|
|
165
|
+
/** Judge model; required, never defaulted (role quality floors). */
|
|
166
166
|
model: ModelSpec;
|
|
167
167
|
/** What to judge: the criteria prose embedded into the judge prompt. */
|
|
168
168
|
instruction: string;
|
|
@@ -213,10 +213,10 @@ interface EvalCommitterOptions {
|
|
|
213
213
|
committerId: string;
|
|
214
214
|
/** The emitting sweep report; every claim's gate references it. */
|
|
215
215
|
reportId: string;
|
|
216
|
-
/** CAS-rebase attempts
|
|
216
|
+
/** CAS-rebase attempts; default 3. */
|
|
217
217
|
attempts?: number;
|
|
218
218
|
}
|
|
219
|
-
/** One measured claim
|
|
219
|
+
/** One measured claim; claimExpiry applies the TTL from the decay table. */
|
|
220
220
|
declare function evalMeasuredClaim(input: MeasuredClaimInput, committerId: string): ModelClaim;
|
|
221
221
|
/**
|
|
222
222
|
* Commits measured claims through the eval-committer gate with the
|
|
@@ -250,9 +250,8 @@ interface CanaryDriftReport {
|
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
252
|
* Flips the model's ACTIVE eval-measured claims to stale when their
|
|
253
|
-
* recorded canary fingerprint differs from the fresh one
|
|
254
|
-
*
|
|
255
|
-
* stale"). Claims without a recorded fingerprint have no baseline and
|
|
253
|
+
* recorded canary fingerprint differs from the fresh one. Claims
|
|
254
|
+
* without a recorded fingerprint have no baseline and
|
|
256
255
|
* stay untouched (the documented no-probe posture); a second run is
|
|
257
256
|
* an idempotent noop. CAS-rebased like every maintenance commit.
|
|
258
257
|
*/
|
|
@@ -284,7 +283,7 @@ interface SweepThresholds {
|
|
|
284
283
|
interface RunSweepOptions {
|
|
285
284
|
/** Deterministic, caller-minted; every claim's evidence and gate reference it. */
|
|
286
285
|
reportId: string;
|
|
287
|
-
/** The dedicated identity
|
|
286
|
+
/** The dedicated committer identity. */
|
|
288
287
|
committerId: string;
|
|
289
288
|
/** ISO date of the sweep; the TTL table applies from it (no wall clock inside). */
|
|
290
289
|
observedAt: string;
|
|
@@ -332,4 +331,90 @@ declare const SWEEP_THRESHOLD_DEFAULTS: SweepThresholds;
|
|
|
332
331
|
*/
|
|
333
332
|
declare function runSweepMatrix(pool: SweepPool, options: RunSweepOptions): Promise<SweepReport>;
|
|
334
333
|
//#endregion
|
|
335
|
-
|
|
334
|
+
//#region src/checkpoint.d.ts
|
|
335
|
+
/** One declared checkpoint ladder: rungs are concrete pool members. */
|
|
336
|
+
interface CheckpointLadder extends DeclaredLadder {
|
|
337
|
+
name: string;
|
|
338
|
+
startTier: number;
|
|
339
|
+
rungs: SweepModel[];
|
|
340
|
+
}
|
|
341
|
+
interface CheckpointPool {
|
|
342
|
+
ladders: CheckpointLadder[];
|
|
343
|
+
/** The measurement half; the seeding sweep MUST NOT have seen these. */
|
|
344
|
+
evalCases: SweepCase[];
|
|
345
|
+
}
|
|
346
|
+
interface OrchestratedCase {
|
|
347
|
+
/** The workflow drives an orchestrate-role run; graders judge its outcome. */
|
|
348
|
+
case: EvalCase;
|
|
349
|
+
}
|
|
350
|
+
interface RunCheckpointOptions {
|
|
351
|
+
/** The claims snapshot produced by the seeding sweep (disjoint cases). */
|
|
352
|
+
snapshot: KnowledgeSnapshot;
|
|
353
|
+
/** ISO date of the evaluation (recorded in the report; no wall clock inside). */
|
|
354
|
+
observedAt: string;
|
|
355
|
+
/** An engine per concrete pool member (the caller owns adapters and budgets). */
|
|
356
|
+
engineFor: (member: SweepModel) => Engine | Promise<Engine>;
|
|
357
|
+
/**
|
|
358
|
+
* Criterion 2 engines: withKnowledge true configures the SAME store
|
|
359
|
+
* snapshot behind stores.modelKnowledge; false omits it entirely.
|
|
360
|
+
*/
|
|
361
|
+
orchestrateEngineFor?: (withKnowledge: boolean) => Engine | Promise<Engine>;
|
|
362
|
+
orchestratedCases?: OrchestratedCase[];
|
|
363
|
+
suite?: RunEvalSuiteOptions;
|
|
364
|
+
/**
|
|
365
|
+
* Orchestrated runs need room for the orchestrator cap math (the
|
|
366
|
+
* run ceiling must host the finalize reserve): their
|
|
367
|
+
* suite options default to `suite` but usually carry a larger
|
|
368
|
+
* budgetUsd.
|
|
369
|
+
*/
|
|
370
|
+
orchestratedSuite?: RunEvalSuiteOptions;
|
|
371
|
+
}
|
|
372
|
+
interface CheckpointArm {
|
|
373
|
+
passRate: number;
|
|
374
|
+
totalCostUsd: number;
|
|
375
|
+
n: number;
|
|
376
|
+
}
|
|
377
|
+
interface CheckpointCell {
|
|
378
|
+
ladder: string;
|
|
379
|
+
taskClass: TaskClass;
|
|
380
|
+
defaultTier: number;
|
|
381
|
+
/** The tier the treatment arm ran at (default when no recommendation). */
|
|
382
|
+
treatmentTier: number;
|
|
383
|
+
recommended: boolean;
|
|
384
|
+
baseline: CheckpointArm;
|
|
385
|
+
treatment: CheckpointArm;
|
|
386
|
+
passed: boolean;
|
|
387
|
+
}
|
|
388
|
+
interface CriterionOneReport {
|
|
389
|
+
cells: CheckpointCell[];
|
|
390
|
+
cellsPassed: number;
|
|
391
|
+
majorityHolds: boolean;
|
|
392
|
+
pooledBaseline: CheckpointArm;
|
|
393
|
+
pooledTreatment: CheckpointArm;
|
|
394
|
+
pooledHolds: boolean;
|
|
395
|
+
passed: boolean;
|
|
396
|
+
}
|
|
397
|
+
interface CriterionTwoReport {
|
|
398
|
+
baseline: CheckpointArm;
|
|
399
|
+
informed: CheckpointArm;
|
|
400
|
+
passed: boolean;
|
|
401
|
+
}
|
|
402
|
+
interface CheckpointReport {
|
|
403
|
+
observedAt: string;
|
|
404
|
+
criterion1: CriterionOneReport;
|
|
405
|
+
criterion2?: CriterionTwoReport;
|
|
406
|
+
/** Both criteria (criterion 2 counts as failed when unmeasured). */
|
|
407
|
+
passed: boolean;
|
|
408
|
+
}
|
|
409
|
+
/** The OQ-09 cell rule (shared by the per-cell and pooled verdicts). */
|
|
410
|
+
declare function rungRuleHolds(baseline: CheckpointArm, treatment: CheckpointArm): boolean;
|
|
411
|
+
/**
|
|
412
|
+
* Runs the checkpoint over the fixed pool. Sequential in declaration
|
|
413
|
+
* order (deterministic cassette consumption when recorded); every cell
|
|
414
|
+
* runs baseline then treatment.
|
|
415
|
+
*/
|
|
416
|
+
declare function runValueCheckpoint(checkpointPool: CheckpointPool, options: RunCheckpointOptions): Promise<CheckpointReport>;
|
|
417
|
+
/** The deterministic render for the M12 gate docs amendment. */
|
|
418
|
+
declare function renderCheckpointReport(report: CheckpointReport): string;
|
|
419
|
+
//#endregion
|
|
420
|
+
export { type CanaryDriftReport, type CanaryProbeSet, type CheckpointArm, type CheckpointCell, type CheckpointLadder, type CheckpointPool, type CheckpointReport, type CriterionOneReport, type CriterionTwoReport, type EvalCase, type EvalCaseResult, type EvalCommitterOptions, EvalJudgeError, type EvalMatrixReport, type EvalSuiteResult, type GoldenGraderOptions, type Grader, type GraderContext, type GraderVerdict, JUDGE_VERDICT_SCHEMA, type JudgeGraderOptions, type JudgeSpec, type MatrixCell, type MatrixCellReport, type MeasuredClaimInput, type OrchestratedCase, type RubricCriterion, type RubricGraderOptions, type RunCheckpointOptions, type RunEvalCaseOptions, type RunEvalSuiteOptions, type RunSweepOptions, SWEEP_THRESHOLD_DEFAULTS, type SweepCase, type SweepCellReport, type SweepModel, type SweepPool, type SweepReport, type SweepThresholds, canaryFingerprint, commitEvalMeasured, evalMeasuredClaim, flipStaleOnCanaryDrift, goldenGrader, judgeGrader, normalizeCanaryOutput, renderCheckpointReport, rubricGrader, runEvalCase, runEvalMatrix, runEvalSuite, runSweepMatrix, runValueCheckpoint, rungRuleHolds };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KnowledgeCasError, claimExpiry, defineWorkflow } from "@rulvar/core";
|
|
1
|
+
import { KnowledgeCasError, claimExpiry, compileVerifiedLayer, defineWorkflow } from "@rulvar/core";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
//#region src/case.ts
|
|
4
4
|
/**
|
|
@@ -6,9 +6,9 @@ import { createHash } from "node:crypto";
|
|
|
6
6
|
* suite runners. A separate quality-measurement package built strictly on
|
|
7
7
|
* the public APIs (L6).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Determinism rules (https://docs.rulvar.com/guide/evals and
|
|
10
|
+
* https://docs.rulvar.com/guide/testing): judge graders run THROUGH the
|
|
11
|
+
* engine, so judge calls
|
|
12
12
|
* are journaled, budgeted, and VCR-recordable, and an eval suite replays
|
|
13
13
|
* deterministically from cassettes with zero live calls.
|
|
14
14
|
*/
|
|
@@ -254,14 +254,14 @@ function judgeGrader(options) {
|
|
|
254
254
|
//#endregion
|
|
255
255
|
//#region src/committer.ts
|
|
256
256
|
/**
|
|
257
|
-
* The eval-committer identity (M11-T01; docs/
|
|
258
|
-
*
|
|
257
|
+
* The eval-committer identity (M11-T01; https://docs.rulvar.com/guide/model-knowledge).
|
|
258
|
+
* The pipeline-side commit path: builds
|
|
259
259
|
* eval-committer-gated ops (the coherence square: class eval-measured,
|
|
260
260
|
* author eval-pipeline, metrics present) and commits them with the
|
|
261
261
|
* documented CAS-rebase recipe. Humans never call this; their path is
|
|
262
262
|
* the human gate and it structurally cannot carry metrics.
|
|
263
263
|
*/
|
|
264
|
-
/** One measured claim
|
|
264
|
+
/** One measured claim; claimExpiry applies the TTL from the decay table. */
|
|
265
265
|
function evalMeasuredClaim(input, committerId) {
|
|
266
266
|
return {
|
|
267
267
|
id: input.id,
|
|
@@ -318,8 +318,7 @@ async function commitEvalMeasured(store, claims, options) {
|
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/canary.ts
|
|
320
320
|
/**
|
|
321
|
-
* The canary fingerprint (M11-T04;
|
|
322
|
-
* decay"; OQ-06). The optional compensation for silent alias
|
|
321
|
+
* The canary fingerprint (M11-T04; OQ-06). The optional compensation for silent alias
|
|
323
322
|
* re-pointing that modelEpoch honestly cannot catch: a FIXED probe set
|
|
324
323
|
* at temperature 0, run through the ordinary engine (journaled,
|
|
325
324
|
* budgeted, VCR-recordable), hashed over normalized outputs. A
|
|
@@ -353,9 +352,8 @@ async function canaryFingerprint(engine, probes) {
|
|
|
353
352
|
}
|
|
354
353
|
/**
|
|
355
354
|
* Flips the model's ACTIVE eval-measured claims to stale when their
|
|
356
|
-
* recorded canary fingerprint differs from the fresh one
|
|
357
|
-
*
|
|
358
|
-
* stale"). Claims without a recorded fingerprint have no baseline and
|
|
355
|
+
* recorded canary fingerprint differs from the fresh one. Claims
|
|
356
|
+
* without a recorded fingerprint have no baseline and
|
|
359
357
|
* stay untouched (the documented no-probe posture); a second run is
|
|
360
358
|
* an idempotent noop. CAS-rebased like every maintenance commit.
|
|
361
359
|
*/
|
|
@@ -394,6 +392,161 @@ async function flipStaleOnCanaryDrift(store, model, freshFingerprint, options) {
|
|
|
394
392
|
throw lastCas ?? /* @__PURE__ */ new Error("flipStaleOnCanaryDrift: unreachable");
|
|
395
393
|
}
|
|
396
394
|
//#endregion
|
|
395
|
+
//#region src/checkpoint.ts
|
|
396
|
+
/**
|
|
397
|
+
* The phases 1-2 measured-value checkpoint (M12-T01; the quantitative
|
|
398
|
+
* criteria of OQ-09, closed at M11-T06). The M12 gate: kb_propose
|
|
399
|
+
* and the proposal loop ship ONLY if the knowledge card demonstrably
|
|
400
|
+
* improves tier and agentType selection on eval cases.
|
|
401
|
+
*
|
|
402
|
+
* Two experiments, both A/B under identical fixed pools:
|
|
403
|
+
*
|
|
404
|
+
* 1. RUNG SELECTION, per (ladder, taskClass) cell: the baseline arm
|
|
405
|
+
* runs every eval case at the ladder's DEFAULT start tier; the
|
|
406
|
+
* treatment arm runs at the tier recommended by
|
|
407
|
+
* compileVerifiedLayer over the store's claims (default when no
|
|
408
|
+
* recommendation). A cell passes when the treatment reaches a pass
|
|
409
|
+
* rate at least equal to the baseline at no more than 90 percent
|
|
410
|
+
* of its cost, OR at least 5 points above it at no more than its
|
|
411
|
+
* cost. Criterion 1 holds when a MAJORITY of cells pass AND the
|
|
412
|
+
* pooled aggregate passes the same rule.
|
|
413
|
+
*
|
|
414
|
+
* 2. AGENTTYPE SELECTION, pooled: the same orchestrate-role cases run
|
|
415
|
+
* with and without the knowledge store configured (the card docks
|
|
416
|
+
* into the spawn tool description when configured). Criterion 2
|
|
417
|
+
* holds when the card-informed arm matches or beats the baseline
|
|
418
|
+
* pass rate at no more than 105 percent of its cost, OR beats it
|
|
419
|
+
* by at least 15 points at no more than 115 percent of its cost
|
|
420
|
+
* (the quality branch; OQ-09 as amended 2026-07-12: the baseline
|
|
421
|
+
* fails CHEAPLY, so the flat cost bar tightened exactly when the
|
|
422
|
+
* card was winning on quality).
|
|
423
|
+
*
|
|
424
|
+
* The checkpoint PASSES only when both criteria hold. Methodology
|
|
425
|
+
* guard: the claims the treatment consumes MUST come from a seeding
|
|
426
|
+
* sweep over a DISJOINT case set (the seed/eval split is the caller's
|
|
427
|
+
* pool contract), or the measurement is leakage.
|
|
428
|
+
*/
|
|
429
|
+
/** IEEE754 guard for the rule boundaries (0.8 + 0.05 exceeds 0.85). */
|
|
430
|
+
const EPSILON = 1e-9;
|
|
431
|
+
/**
|
|
432
|
+
* The OQ-09 criterion 2 rule (as amended 2026-07-12): match-or-beat at
|
|
433
|
+
* 105 percent of baseline cost, OR at least 15 points better at 115
|
|
434
|
+
* percent (the quality branch: the baseline fails cheaply, so the flat
|
|
435
|
+
* bar tightened exactly when the card won on quality). The vacuous-pass
|
|
436
|
+
* guard stays with the caller.
|
|
437
|
+
*/
|
|
438
|
+
function agentTypeRuleHolds(baseline, informed) {
|
|
439
|
+
const matchesCheaply = informed.passRate >= baseline.passRate - EPSILON && informed.totalCostUsd <= 1.05 * baseline.totalCostUsd + EPSILON;
|
|
440
|
+
const clearlyBetterNearCost = informed.passRate >= baseline.passRate + .15 - EPSILON && informed.totalCostUsd <= 1.15 * baseline.totalCostUsd + EPSILON;
|
|
441
|
+
return matchesCheaply || clearlyBetterNearCost;
|
|
442
|
+
}
|
|
443
|
+
/** The OQ-09 cell rule (shared by the per-cell and pooled verdicts). */
|
|
444
|
+
function rungRuleHolds(baseline, treatment) {
|
|
445
|
+
const equalOrBetterCheaper = treatment.passRate >= baseline.passRate - EPSILON && treatment.totalCostUsd <= .9 * baseline.totalCostUsd + EPSILON;
|
|
446
|
+
const clearlyBetterAtCost = treatment.passRate >= baseline.passRate + .05 - EPSILON && treatment.totalCostUsd <= baseline.totalCostUsd + EPSILON;
|
|
447
|
+
return equalOrBetterCheaper || clearlyBetterAtCost;
|
|
448
|
+
}
|
|
449
|
+
function armOf(suite) {
|
|
450
|
+
return {
|
|
451
|
+
passRate: suite.passRate,
|
|
452
|
+
totalCostUsd: suite.totalCostUsd,
|
|
453
|
+
n: suite.results.length
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function pool(arms) {
|
|
457
|
+
const n = arms.reduce((sum, arm) => sum + arm.n, 0);
|
|
458
|
+
const passed = arms.reduce((sum, arm) => sum + arm.passRate * arm.n, 0);
|
|
459
|
+
const cost = arms.reduce((sum, arm) => sum + arm.totalCostUsd, 0);
|
|
460
|
+
return {
|
|
461
|
+
passRate: n === 0 ? 0 : passed / n,
|
|
462
|
+
totalCostUsd: cost,
|
|
463
|
+
n
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Runs the checkpoint over the fixed pool. Sequential in declaration
|
|
468
|
+
* order (deterministic cassette consumption when recorded); every cell
|
|
469
|
+
* runs baseline then treatment.
|
|
470
|
+
*/
|
|
471
|
+
async function runValueCheckpoint(checkpointPool, options) {
|
|
472
|
+
const recommendations = compileVerifiedLayer(options.snapshot.claims.filter((claim) => claim.status === "active"), checkpointPool.ladders);
|
|
473
|
+
const byTaskClass = /* @__PURE__ */ new Map();
|
|
474
|
+
for (const entry of checkpointPool.evalCases) {
|
|
475
|
+
const bucket = byTaskClass.get(entry.taskClass) ?? [];
|
|
476
|
+
bucket.push(entry.case);
|
|
477
|
+
byTaskClass.set(entry.taskClass, bucket);
|
|
478
|
+
}
|
|
479
|
+
const cells = [];
|
|
480
|
+
for (const ladder of checkpointPool.ladders) for (const [taskClass, cases] of byTaskClass) {
|
|
481
|
+
const recommendation = recommendations.find((row) => row.ladder === ladder.name && row.taskClass === taskClass);
|
|
482
|
+
const treatmentTier = recommendation?.recommendedTier ?? ladder.startTier;
|
|
483
|
+
const baseMember = ladder.rungs[ladder.startTier];
|
|
484
|
+
const treatMember = ladder.rungs[treatmentTier];
|
|
485
|
+
if (baseMember === void 0 || treatMember === void 0) throw new Error(`checkpoint: ladder '${ladder.name}' lacks rung ${String(treatmentTier)}`);
|
|
486
|
+
const baseline = armOf(await runEvalSuite(await options.engineFor(baseMember), cases, options.suite ?? {}));
|
|
487
|
+
const treatment = treatmentTier === ladder.startTier ? baseline : armOf(await runEvalSuite(await options.engineFor(treatMember), cases, options.suite ?? {}));
|
|
488
|
+
cells.push({
|
|
489
|
+
ladder: ladder.name,
|
|
490
|
+
taskClass,
|
|
491
|
+
defaultTier: ladder.startTier,
|
|
492
|
+
treatmentTier,
|
|
493
|
+
recommended: recommendation !== void 0,
|
|
494
|
+
baseline,
|
|
495
|
+
treatment,
|
|
496
|
+
passed: rungRuleHolds(baseline, treatment)
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
const recommendedCells = cells.filter((cell) => cell.recommended);
|
|
500
|
+
const cellsPassed = recommendedCells.filter((cell) => cell.passed).length;
|
|
501
|
+
const majorityHolds = recommendedCells.length > 0 && cellsPassed * 2 > recommendedCells.length;
|
|
502
|
+
const pooledBaseline = pool(cells.map((cell) => cell.baseline));
|
|
503
|
+
const pooledTreatment = pool(cells.map((cell) => cell.treatment));
|
|
504
|
+
const pooledHolds = rungRuleHolds(pooledBaseline, pooledTreatment);
|
|
505
|
+
const criterion1 = {
|
|
506
|
+
cells,
|
|
507
|
+
cellsPassed,
|
|
508
|
+
majorityHolds,
|
|
509
|
+
pooledBaseline,
|
|
510
|
+
pooledTreatment,
|
|
511
|
+
pooledHolds,
|
|
512
|
+
passed: majorityHolds && pooledHolds
|
|
513
|
+
};
|
|
514
|
+
let criterion2;
|
|
515
|
+
if (options.orchestrateEngineFor !== void 0 && options.orchestratedCases !== void 0) {
|
|
516
|
+
const cases = options.orchestratedCases.map((entry) => entry.case);
|
|
517
|
+
const orchestratedSuite = options.orchestratedSuite ?? options.suite ?? {};
|
|
518
|
+
const baseline = armOf(await runEvalSuite(await options.orchestrateEngineFor(false), cases, orchestratedSuite));
|
|
519
|
+
const informed = armOf(await runEvalSuite(await options.orchestrateEngineFor(true), cases, orchestratedSuite));
|
|
520
|
+
criterion2 = {
|
|
521
|
+
baseline,
|
|
522
|
+
informed,
|
|
523
|
+
passed: informed.n > 0 && informed.passRate > 0 && agentTypeRuleHolds(baseline, informed)
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
return {
|
|
527
|
+
observedAt: options.observedAt,
|
|
528
|
+
criterion1,
|
|
529
|
+
...criterion2 === void 0 ? {} : { criterion2 },
|
|
530
|
+
passed: criterion1.passed && criterion2 !== void 0 && criterion2.passed
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
const percent = (rate) => `${(rate * 100).toFixed(1)}%`;
|
|
534
|
+
const usd = (value) => `$${value.toFixed(4)}`;
|
|
535
|
+
/** The deterministic render for the M12 gate docs amendment. */
|
|
536
|
+
function renderCheckpointReport(report) {
|
|
537
|
+
const lines = [
|
|
538
|
+
`Measured-value checkpoint (OQ-09) at ${report.observedAt}: ` + (report.passed ? "PASSED" : "FAILED"),
|
|
539
|
+
"",
|
|
540
|
+
`Criterion 1 (rung selection): ${report.criterion1.passed ? "holds" : "fails"} (${String(report.criterion1.cellsPassed)}/${String(report.criterion1.cells.length)} cells, pooled ${report.criterion1.pooledHolds ? "holds" : "fails"})`
|
|
541
|
+
];
|
|
542
|
+
for (const cell of report.criterion1.cells) lines.push(`* ${cell.ladder} :: ${cell.taskClass}: baseline tier ${String(cell.defaultTier)} ${percent(cell.baseline.passRate)} at ${usd(cell.baseline.totalCostUsd)}; treatment tier ${String(cell.treatmentTier)}${cell.recommended ? "" : " (no recommendation)"} ${percent(cell.treatment.passRate)} at ${usd(cell.treatment.totalCostUsd)}; ${cell.passed ? "pass" : "fail"} (n=${String(cell.baseline.n)})`);
|
|
543
|
+
if (report.criterion2 !== void 0) {
|
|
544
|
+
const c2 = report.criterion2;
|
|
545
|
+
lines.push("", `Criterion 2 (agentType selection): ${c2.passed ? "holds" : "fails"} (baseline ${percent(c2.baseline.passRate)} at ${usd(c2.baseline.totalCostUsd)}; card-informed ${percent(c2.informed.passRate)} at ${usd(c2.informed.totalCostUsd)}; n=${String(c2.baseline.n)})`);
|
|
546
|
+
} else lines.push("", "Criterion 2 (agentType selection): NOT MEASURED (counts as failed)");
|
|
547
|
+
return lines.join("\n");
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
397
550
|
//#region src/sweeps.ts
|
|
398
551
|
const SWEEP_THRESHOLD_DEFAULTS = {
|
|
399
552
|
strength: .9,
|
|
@@ -485,4 +638,4 @@ async function runSweepMatrix(pool, options) {
|
|
|
485
638
|
return report;
|
|
486
639
|
}
|
|
487
640
|
//#endregion
|
|
488
|
-
export { EvalJudgeError, JUDGE_VERDICT_SCHEMA, SWEEP_THRESHOLD_DEFAULTS, canaryFingerprint, commitEvalMeasured, evalMeasuredClaim, flipStaleOnCanaryDrift, goldenGrader, judgeGrader, normalizeCanaryOutput, rubricGrader, runEvalCase, runEvalMatrix, runEvalSuite, runSweepMatrix };
|
|
641
|
+
export { EvalJudgeError, JUDGE_VERDICT_SCHEMA, SWEEP_THRESHOLD_DEFAULTS, canaryFingerprint, commitEvalMeasured, evalMeasuredClaim, flipStaleOnCanaryDrift, goldenGrader, judgeGrader, normalizeCanaryOutput, renderCheckpointReport, rubricGrader, runEvalCase, runEvalMatrix, runEvalSuite, runSweepMatrix, runValueCheckpoint, rungRuleHolds };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/evals",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "rulvar evals: eval cases, golden outputs, rubric and judge graders, matrix sweeps, canary fingerprint.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rulvar/
|
|
26
|
-
"@rulvar/
|
|
25
|
+
"@rulvar/core": "1.2.0",
|
|
26
|
+
"@rulvar/testing": "1.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.20.0",
|