@rulvar/evals 1.1.0 → 1.3.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 CHANGED
@@ -2,7 +2,7 @@ import { CompiledWorkflow, DeclaredLadder, Effort, Engine, EvidenceRef, Json, Js
2
2
 
3
3
  //#region src/case.d.ts
4
4
  /**
5
- * One quality-measurement case (docs/09, section 7.1). The shape is the
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 (docs/04, section "Role 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 (docs/09, section 7.2).
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 (docs/04 role quality floors). */
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 (docs/05, 5.4); default 3. */
216
+ /** CAS-rebase attempts; default 3. */
217
217
  attempts?: number;
218
218
  }
219
- /** One measured claim, TTL applied per the docs/05 decay table. */
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 (docs/05:
254
- * "a fingerprint change immediately flips the model's eval claims to
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 (docs/05, 5.4). */
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;
@@ -364,7 +363,7 @@ interface RunCheckpointOptions {
364
363
  suite?: RunEvalSuiteOptions;
365
364
  /**
366
365
  * Orchestrated runs need room for the orchestrator cap math (the
367
- * run ceiling must host the finalize reserve; docs/07, 12.2): their
366
+ * run ceiling must host the finalize reserve): their
368
367
  * suite options default to `suite` but usually carry a larger
369
368
  * budgetUsd.
370
369
  */
package/dist/index.js CHANGED
@@ -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
- * Owning spec: docs/09-observability-testing-spec.md, section
10
- * "@rulvar/evals"; determinism rules in docs/11-testing-strategy.md,
11
- * section "Eval CI": judge graders run THROUGH the engine, so judge calls
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/05, sections "Data model"
258
- * and "Commit discipline"). The pipeline-side commit path: builds
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, TTL applied per the docs/05 decay table. */
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; docs/05, section "Grounding and
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 (docs/05:
357
- * "a fingerprint change immediately flips the model's eval claims to
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
  */
@@ -396,9 +394,8 @@ async function flipStaleOnCanaryDrift(store, model, freshFingerprint, options) {
396
394
  //#endregion
397
395
  //#region src/checkpoint.ts
398
396
  /**
399
- * The phases 1-2 measured-value checkpoint (M12-T01; docs/05, section
400
- * "Phases and placement"; the quantitative criteria of OQ-09,
401
- * 14-open-questions.md, closed at M11-T06). The M12 gate: kb_propose
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
402
399
  * and the proposal loop ship ONLY if the knowledge card demonstrably
403
400
  * improves tier and agentType selection on eval cases.
404
401
  *
@@ -418,7 +415,11 @@ async function flipStaleOnCanaryDrift(store, model, freshFingerprint, options) {
418
415
  * with and without the knowledge store configured (the card docks
419
416
  * into the spawn tool description when configured). Criterion 2
420
417
  * holds when the card-informed arm matches or beats the baseline
421
- * pass rate at no more than 105 percent of its cost.
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).
422
423
  *
423
424
  * The checkpoint PASSES only when both criteria hold. Methodology
424
425
  * guard: the claims the treatment consumes MUST come from a seeding
@@ -427,6 +428,18 @@ async function flipStaleOnCanaryDrift(store, model, freshFingerprint, options) {
427
428
  */
428
429
  /** IEEE754 guard for the rule boundaries (0.8 + 0.05 exceeds 0.85). */
429
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
+ }
430
443
  /** The OQ-09 cell rule (shared by the per-cell and pooled verdicts). */
431
444
  function rungRuleHolds(baseline, treatment) {
432
445
  const equalOrBetterCheaper = treatment.passRate >= baseline.passRate - EPSILON && treatment.totalCostUsd <= .9 * baseline.totalCostUsd + EPSILON;
@@ -507,7 +520,7 @@ async function runValueCheckpoint(checkpointPool, options) {
507
520
  criterion2 = {
508
521
  baseline,
509
522
  informed,
510
- passed: informed.n > 0 && informed.passRate > 0 && informed.passRate >= baseline.passRate && informed.totalCostUsd <= 1.05 * baseline.totalCostUsd + EPSILON
523
+ passed: informed.n > 0 && informed.passRate > 0 && agentTypeRuleHolds(baseline, informed)
511
524
  };
512
525
  }
513
526
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/evals",
3
- "version": "1.1.0",
3
+ "version": "1.3.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/core": "1.1.0",
26
- "@rulvar/testing": "1.1.0"
25
+ "@rulvar/core": "1.3.0",
26
+ "@rulvar/testing": "1.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.20.0",