skillfit 0.12.0 → 0.13.1

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.
Files changed (147) hide show
  1. package/README.md +60 -119
  2. package/README.zh-CN.md +60 -116
  3. package/dist/commands/bench-check-report.js +1 -34
  4. package/dist/commands/bench.js +6 -239
  5. package/dist/commands/eval-preflight-error.js +9 -0
  6. package/dist/commands/eval-preflight.js +4 -11
  7. package/dist/commands/eval-report.js +6 -459
  8. package/dist/commands/install.js +14 -98
  9. package/dist/harness/bench-check.js +277 -0
  10. package/dist/harness/bench-diagnostics.js +34 -0
  11. package/dist/harness/eval-acceptance.js +1 -1
  12. package/dist/harness/eval-audit.js +1 -1
  13. package/dist/harness/eval-manifest.js +456 -0
  14. package/dist/install/constants.js +1 -0
  15. package/dist/install/transaction.js +112 -0
  16. package/docs/README.md +65 -0
  17. package/docs/architecture.md +86 -0
  18. package/docs/archive-delivery.md +83 -0
  19. package/docs/archive-inventory.md +91 -0
  20. package/docs/evaluation-reports.md +1 -1
  21. package/docs/first-real-eval.md +12 -10
  22. package/docs/growth-roadmap-2026-10.md +17 -18
  23. package/docs/package-contents.md +80 -0
  24. package/docs/plans/2026-10-20-archive-replay-verification.json +125 -0
  25. package/docs/plans/2026-10-20-archive-source-verification.json +256 -0
  26. package/docs/plans/2026-10-20-delivery-verification.json +146 -0
  27. package/docs/plans/2026-10-20-docs-architecture-cleanup.md +233 -0
  28. package/docs/plans/2026-10-20-install-transactions-and-archive-delivery.md +233 -0
  29. package/docs/plans/2026-10-21-npm-0.13.0-release.md +74 -0
  30. package/docs/plans/2026-10-21-npm-0.13.1-release.md +38 -0
  31. package/docs/releases/0.12.0-attestation-check.json +22 -0
  32. package/docs/releases/0.12.0-attestations.json +155 -0
  33. package/docs/releases/0.12.0-ci-registry-install.json +90 -0
  34. package/docs/releases/0.12.0-feature-smoke.json +34 -0
  35. package/docs/releases/0.12.0-foundations-smoke.json +1576 -0
  36. package/docs/releases/0.12.0-local-registry-install.json +75 -0
  37. package/docs/releases/0.12.0-preparation-attempt-1.json +22 -0
  38. package/docs/releases/0.12.0-registry-metadata.json +96 -0
  39. package/docs/releases/0.12.0-signatures.txt +6 -0
  40. package/docs/releases/0.12.0-verification.json +99 -0
  41. package/docs/releases/0.12.0.md +14 -0
  42. package/docs/releases/0.13.0-archive-replays.json +266 -0
  43. package/docs/releases/0.13.0-archive-restoration.json +168 -0
  44. package/docs/releases/0.13.0-attestation-check.json +22 -0
  45. package/docs/releases/0.13.0-attestations.json +147 -0
  46. package/docs/releases/0.13.0-ci-registry-install.json +60 -0
  47. package/docs/releases/0.13.0-feature-smoke.json +41 -0
  48. package/docs/releases/0.13.0-feature-smoke.mjs +114 -0
  49. package/docs/releases/0.13.0-foundations-smoke.json +1576 -0
  50. package/docs/releases/0.13.0-local-registry-install.json +40 -0
  51. package/docs/releases/0.13.0-preparation.json +102 -0
  52. package/docs/releases/0.13.0-preview-review.json +16 -0
  53. package/docs/releases/0.13.0-registry-metadata.json +92 -0
  54. package/docs/releases/0.13.0-signatures.txt +12 -0
  55. package/docs/releases/0.13.0-verification.json +136 -0
  56. package/docs/releases/0.13.0.md +112 -0
  57. package/docs/releases/0.13.1-feature-smoke.mjs +116 -0
  58. package/docs/releases/0.13.1-preparation-failure-1.json +25 -0
  59. package/docs/releases/0.13.1-preparation.json +149 -0
  60. package/docs/releases/0.13.1.md +62 -0
  61. package/docs/releases/archive-delivery-smoke.mjs +37 -0
  62. package/docs/releases/release-docs-smoke.mjs +37 -0
  63. package/docs/reproducible-offline-example.md +1 -1
  64. package/evidence/README.md +24 -1
  65. package/evidence/archive-catalog.v1.json +8044 -0
  66. package/evidence/fetch-archives.mjs +211 -0
  67. package/package.json +9 -2
  68. package/skills/skillfit/SKILL.md +20 -6
  69. package/dist/cli.test.js +0 -193
  70. package/dist/commands/bench-calibration.test.js +0 -237
  71. package/dist/commands/bench-check-json.test.js +0 -242
  72. package/dist/commands/bench-manage.test.js +0 -87
  73. package/dist/commands/bench.test.js +0 -1166
  74. package/dist/commands/bundle.test.js +0 -142
  75. package/dist/commands/calibration-cli.test.js +0 -145
  76. package/dist/commands/doctor.test.js +0 -280
  77. package/dist/commands/eval-agent-preflight.test.js +0 -269
  78. package/dist/commands/eval-cli-usage.test.js +0 -75
  79. package/dist/commands/eval-export-modes.test.js +0 -350
  80. package/dist/commands/eval-export.test.js +0 -279
  81. package/dist/commands/eval-interruption.test.js +0 -263
  82. package/dist/commands/eval-preflight.test.js +0 -382
  83. package/dist/commands/eval-report.test.js +0 -367
  84. package/dist/commands/eval.test.js +0 -503
  85. package/dist/commands/evaluation-report.test.js +0 -243
  86. package/dist/commands/install.test.js +0 -555
  87. package/dist/commands/npm-first-run.test.js +0 -74
  88. package/dist/commands/replay-cancellation.test.js +0 -105
  89. package/dist/commands/report.test.js +0 -110
  90. package/dist/commands/setup.test.js +0 -150
  91. package/dist/commands/upstream.test.js +0 -139
  92. package/dist/commands/workflow-entrypoints.test.js +0 -137
  93. package/dist/docs.test.js +0 -154
  94. package/dist/frontmatter.test.js +0 -49
  95. package/dist/harness/bench.test.js +0 -109
  96. package/dist/harness/bundle.test.js +0 -71
  97. package/dist/harness/codex-usage.test.js +0 -87
  98. package/dist/harness/costs.test.js +0 -92
  99. package/dist/harness/eval-budget.test.js +0 -237
  100. package/dist/harness/eval-component.test.js +0 -770
  101. package/dist/harness/eval-efficiency.test.js +0 -56
  102. package/dist/harness/execution-timing.test.js +0 -61
  103. package/dist/harness/executors/api.test.js +0 -175
  104. package/dist/harness/executors/cli.test.js +0 -541
  105. package/dist/harness/executors/mock.test.js +0 -43
  106. package/dist/harness/experiment-session.test.js +0 -317
  107. package/dist/harness/installed-skill.test.js +0 -162
  108. package/dist/harness/interruption.test.js +0 -31
  109. package/dist/harness/judge-accounting.test.js +0 -216
  110. package/dist/harness/judge.test.js +0 -181
  111. package/dist/harness/kimi-usage.test.js +0 -62
  112. package/dist/harness/native-diff.test.js +0 -53
  113. package/dist/harness/oss-lru-cache.test.js +0 -79
  114. package/dist/harness/oss-normalize-url.test.js +0 -64
  115. package/dist/harness/oss-regression-witness.test.js +0 -89
  116. package/dist/harness/oss-skill-followup.test.js +0 -59
  117. package/dist/harness/prompt.test.js +0 -48
  118. package/dist/harness/receipts.test.js +0 -148
  119. package/dist/harness/report.test.js +0 -297
  120. package/dist/harness/runner.test.js +0 -635
  121. package/dist/harness/skill-revision.test.js +0 -148
  122. package/dist/harness/stats.test.js +0 -124
  123. package/dist/harness/target.test.js +0 -60
  124. package/dist/harness/trigger.test.js +0 -261
  125. package/dist/harness/verifier-summary.test.js +0 -99
  126. package/dist/harness/verifier.test.js +0 -128
  127. package/dist/harness/waza-behavior.test.js +0 -139
  128. package/dist/mcp/probe.test.js +0 -139
  129. package/evidence/artifacts/2026-10-12-diagnosing-revision/calibration-records.tar.gz +0 -0
  130. package/evidence/artifacts/2026-10-12-diagnosing-revision/interrupted-records.tar.gz +0 -0
  131. package/evidence/artifacts/2026-10-12-diagnosing-revision/validation-records.tar.gz +0 -0
  132. package/evidence/artifacts/2026-10-12-diagnosing-v2/regression-records.tar.gz +0 -0
  133. package/evidence/artifacts/2026-10-12-diagnosing-v2/transfer-records.tar.gz +0 -0
  134. package/evidence/artifacts/2026-10-12-normalize-url-v2-available/readiness-records.tar.gz +0 -0
  135. package/evidence/artifacts/2026-10-12-normalize-url-v2-comparison/records.tar.gz +0 -0
  136. package/evidence/artifacts/2026-10-12-normalize-url-v2-recovery/records.tar.gz +0 -0
  137. package/evidence/artifacts/2026-10-12-normalize-url-v2-validated/records.tar.gz +0 -0
  138. package/evidence/artifacts/2026-10-13-debugging-completed-development/package.tar.gz +0 -0
  139. package/evidence/artifacts/2026-10-13-debugging-controls-and-sleep-stop/package.tar.gz +0 -0
  140. package/evidence/artifacts/2026-10-13-debugging-development-stops/package.tar.gz +0 -0
  141. package/evidence/artifacts/2026-10-14-debugging-followup-routing-stop/package.tar.gz +0 -0
  142. package/evidence/artifacts/2026-10-14-debugging-independent-validation/package.tar.gz +0 -0
  143. package/evidence/artifacts/2026-10-14-debugging-reading-pilot-and-cost-review/package.tar.gz +0 -0
  144. package/evidence/artifacts/2026-10-14-debugging-spending-stop/package.tar.gz +0 -0
  145. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
  146. package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
  147. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
@@ -1,16 +1,17 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
2
+ import { inspectBenchIntegrity, copyFixture, runOracleGate } from '../harness/bench-check.js';
3
+ import { CasePreflightFailed } from './eval-preflight-error.js';
4
+ import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
5
  import { tmpdir } from 'node:os';
4
6
  import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
5
7
  import { BENCH_SCHEMA_VERSION, loadBench, selectBenchTasks, validateBenchTask } from '../harness/bench.js';
6
8
  import { resolveBenchDir } from '../harness/bench-location.js';
7
- import { listFilesRecursive, sha256File, sha256Text } from '../harness/hash.js';
9
+ import { sha256File, sha256Text } from '../harness/hash.js';
8
10
  import { runVerifier, verifierFailure } from '../harness/runner.js';
9
11
  import { MOCK_MARKER_FILE } from '../harness/constants.js';
10
- import { verdictFromOutput } from '../harness/verifier-summary.js';
11
12
  import { confirm as confirmPrompt } from './confirm.js';
12
13
  import { commandTemplateFiles } from './bench-command-template.js';
13
- import { benchDiagnostic, benchCheckEvidence } from './bench-check-report.js';
14
+ import { benchDiagnostic } from '../harness/bench-diagnostics.js';
14
15
  import { BACKUP_SUFFIX } from './install.js';
15
16
  import { withEvaluationInterrupts, throwIfEvaluationInterrupted } from '../harness/interruption.js';
16
17
  import { assertAgentEnvironment, renderAgentEnvironment } from '../harness/agent-preflight.js';
@@ -20,13 +21,6 @@ import { BenchDraftSession } from './bench-draft.js';
20
21
  import { parseVerifierTimeoutSeconds } from '../harness/verifier-timeout.js';
21
22
  export { captureSourceFiles } from './bench-source.js';
22
23
  export { prepareBenchCalibration } from './bench-calibration.js';
23
- const FIXTURE_SIZE_WARN_BYTES = 64 * 1024;
24
- // benches/README.md: a verifier decomposes its acceptance criteria into 2–8 named checks.
25
- const MIN_FACET_CHECKS = 2;
26
- const MAX_FACET_CHECKS = 8;
27
- // docs/metrics.md: >=30% of trigger-labelled tasks should be negative controls.
28
- const NEGATIVE_CONTROL_TARGET = 0.3;
29
- const NEGATIVE_CONTROL_PERCENT = 30;
30
24
  function templateFiles(benchName) {
31
25
  return {
32
26
  'bench.json': `${JSON.stringify({
@@ -146,114 +140,6 @@ export async function runBenchInit(options) {
146
140
  log('This is a teaching case. Replace it with your own task before measuring Skill benefit.');
147
141
  return { dir, created };
148
142
  }
149
- async function probeVerifier(benchDir, verifier, output, timeoutSeconds) {
150
- const dir = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
151
- try {
152
- if (output !== null) {
153
- writeFileSync(join(dir, '_output.md'), output, 'utf8');
154
- }
155
- const result = await runVerifier(benchDir, verifier, dir, timeoutSeconds);
156
- return {
157
- exitCode: result.exitCode,
158
- error: result.error,
159
- output: result.output,
160
- checks: verdictFromOutput(result.output)?.checks ?? null,
161
- };
162
- }
163
- finally {
164
- rmSync(dir, { recursive: true, force: true });
165
- }
166
- }
167
- function facetCountCheck(taskId, checks) {
168
- // `checks` is optional in the verifier contract; with no checks there is no graded signal to gate.
169
- if (checks === null)
170
- return null;
171
- if (checks.length >= MIN_FACET_CHECKS && checks.length <= MAX_FACET_CHECKS) {
172
- return {
173
- status: 'PASS',
174
- message: `${taskId}: ${checks.length} facet check(s), within the ${MIN_FACET_CHECKS}–${MAX_FACET_CHECKS} contract`,
175
- };
176
- }
177
- const why = checks.length < MIN_FACET_CHECKS
178
- ? 'a single check is binary pass/fail in facet costume — it carries none of the graded signal facet scores exist to provide'
179
- : 'the trial score is dominated by whatever these checks happen to measure, and the per-facet table stops being readable';
180
- return {
181
- status: 'WARN',
182
- message: `${taskId}: ${checks.length} facet check(s) — outside the ${MIN_FACET_CHECKS}–${MAX_FACET_CHECKS} range in benches/README.md (${why})`,
183
- };
184
- }
185
- function copyFixture(fixtureDir, dest) {
186
- for (const rel of listFilesRecursive(fixtureDir)) {
187
- const target = join(dest, rel);
188
- mkdirSync(dirname(target), { recursive: true });
189
- writeFileSync(target, readFileSync(join(fixtureDir, rel)));
190
- }
191
- }
192
- async function runOracleGate(benchDir, fixtureDir, oracle, verifier, timeoutSeconds, record) {
193
- const dir = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
194
- try {
195
- copyFixture(fixtureDir, dir);
196
- const oracleRun = await runVerifier(benchDir, oracle, dir, timeoutSeconds);
197
- record?.('oracle', oracleRun);
198
- if (oracleRun.error !== null || oracleRun.exitCode !== 0) {
199
- return {
200
- kind: 'oracle-failed',
201
- result: oracleRun,
202
- command: oracle,
203
- exitCode: oracleRun.exitCode,
204
- reason: oracleRun.error !== null || oracleRun.exitCode === null ? verifierFailure('oracle', oracle, oracleRun.error) : null,
205
- };
206
- }
207
- const graded = await runVerifier(benchDir, verifier, dir, timeoutSeconds);
208
- record?.('oracle-verifier', graded);
209
- if (graded.error !== null || graded.exitCode !== 0) {
210
- return {
211
- kind: 'verifier-failed',
212
- result: graded,
213
- command: verifier,
214
- reason: graded.error !== null || graded.exitCode === null ? verifierFailure('verifier', verifier, graded.error) : null,
215
- };
216
- }
217
- const score = verdictFromOutput(graded.output)?.score ?? null;
218
- if (score !== null && score < 1) {
219
- return { kind: 'low-score', score, result: graded, command: verifier };
220
- }
221
- return { kind: 'pass', score, result: graded, command: verifier };
222
- }
223
- finally {
224
- rmSync(dir, { recursive: true, force: true });
225
- }
226
- }
227
- async function probeOracle(benchDir, fixture, oracle, verifier, timeoutSeconds) {
228
- const gate = await runOracleGate(benchDir, join(benchDir, fixture), oracle, verifier, timeoutSeconds);
229
- switch (gate.kind) {
230
- case 'oracle-failed':
231
- return {
232
- status: 'FAIL',
233
- evidence: benchCheckEvidence(gate.result, gate.command),
234
- message: gate.reason ??
235
- `oracle command itself failed (exit ${gate.exitCode}) — the reference solution cannot run`,
236
- };
237
- case 'verifier-failed':
238
- return {
239
- status: 'FAIL',
240
- evidence: benchCheckEvidence(gate.result, gate.command),
241
- message: gate.reason ?? 'oracle solution does not pass the verifier — the task is unwinnable or the oracle is stale',
242
- };
243
- case 'low-score':
244
- return {
245
- status: 'FAIL',
246
- evidence: benchCheckEvidence(gate.result, gate.command),
247
- message: `oracle passes the verifier but scores ${gate.score.toFixed(2)} on its checks — the checks are stricter than the exit code`,
248
- };
249
- case 'pass':
250
- return {
251
- status: 'PASS',
252
- evidence: benchCheckEvidence(gate.result, gate.command),
253
- message: `oracle solution passes the verifier${gate.score !== null ? ' with full checks' : ''}`,
254
- };
255
- }
256
- }
257
143
  function renderCheck({ status, message }) {
258
144
  return `[${status}] ${message}`;
259
145
  }
@@ -304,125 +190,7 @@ async function runBenchCheckWithinInterrupts(options, strictCalibration = false)
304
190
  }
305
191
  }
306
192
  const offlineStarted = performance.now();
307
- let labeledTasks = 0;
308
- let negativeTasks = 0;
309
- for (const task of bench.tasks) {
310
- const taskPush = (code, status, message, evidence) => push(code, status, message, task, evidence);
311
- let facetChecks = null;
312
- if ((task.verifierKind ?? 'output') === 'command') {
313
- const fixtureCopy = mkdtempSync(join(tmpdir(), 'skillfit-check-'));
314
- try {
315
- copyFixture(join(bench.dir, task.fixture), fixtureCopy);
316
- const pristine = await runVerifier(bench.dir, task.verifier, fixtureCopy, task.verifierTimeoutSeconds);
317
- facetChecks = verdictFromOutput(pristine.output)?.checks ?? null;
318
- if (pristine.error !== null || pristine.exitCode === null) {
319
- // Without this branch a verifier that cannot even be spawned reads as a clean NOP gate:
320
- // "fails on the untouched fixture" is exactly what `exitCode !== 0` looks like.
321
- taskPush('UNTOUCHED_FIXTURE', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, pristine.error)}`, benchCheckEvidence(pristine, task.verifier));
322
- }
323
- else if (pristine.exitCode === 0) {
324
- taskPush('UNTOUCHED_FIXTURE', 'FAIL', `${task.id}: command verifier already passes on the untouched fixture — the task is solved or the verifier is broken`, benchCheckEvidence(pristine, task.verifier));
325
- }
326
- else {
327
- taskPush('UNTOUCHED_FIXTURE', 'PASS', `${task.id}: command verifier fails on the untouched fixture (the failure reproduces)`, benchCheckEvidence(pristine, task.verifier));
328
- }
329
- }
330
- finally {
331
- rmSync(fixtureCopy, { recursive: true, force: true });
332
- }
333
- }
334
- else {
335
- const missing = await probeVerifier(bench.dir, task.verifier, null, task.verifierTimeoutSeconds);
336
- if (missing.error !== null || missing.exitCode === null) {
337
- taskPush('MISSING_OUTPUT', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, missing.error)}`, benchCheckEvidence(missing, task.verifier));
338
- }
339
- else if (missing.exitCode === 0) {
340
- taskPush('MISSING_OUTPUT', 'FAIL', `${task.id}: verifier does not reject a missing _output.md`, benchCheckEvidence(missing, task.verifier));
341
- }
342
- else {
343
- taskPush('MISSING_OUTPUT', 'PASS', `${task.id}: verifier rejects missing output`, benchCheckEvidence(missing, task.verifier));
344
- }
345
- const empty = await probeVerifier(bench.dir, task.verifier, '', task.verifierTimeoutSeconds);
346
- facetChecks = empty.checks;
347
- if (empty.error !== null || empty.exitCode === null) {
348
- taskPush('EMPTY_OUTPUT', 'FAIL', `${task.id}: ${verifierFailure('verifier', task.verifier, empty.error)}`, benchCheckEvidence(empty, task.verifier));
349
- }
350
- else if (empty.exitCode === 0) {
351
- taskPush('EMPTY_OUTPUT', 'FAIL', `${task.id}: verifier passes an empty output — it cannot tell success from silence`, benchCheckEvidence(empty, task.verifier));
352
- }
353
- else {
354
- taskPush('EMPTY_OUTPUT', 'PASS', `${task.id}: verifier rejects empty output`, benchCheckEvidence(empty, task.verifier));
355
- }
356
- }
357
- const facetGate = facetCountCheck(task.id, facetChecks);
358
- if (facetGate)
359
- taskPush('FACET_COUNT', facetGate.status, facetGate.message);
360
- if (task.oracle) {
361
- const oracleResult = await probeOracle(bench.dir, task.fixture, task.oracle, task.verifier, task.verifierTimeoutSeconds);
362
- taskPush('ORACLE', oracleResult.status, `${task.id}: ${oracleResult.message}`, oracleResult.evidence);
363
- }
364
- else {
365
- taskPush('ORACLE', 'WARN', `${task.id}: no oracle — task winnability is unverified (nothing proves a correct solution passes this verifier; register one with --oracle or write ground-truth/oracle-${task.id}.mjs)`);
366
- }
367
- const markerPath = join(bench.dir, task.fixture, MOCK_MARKER_FILE);
368
- if ((task.verifierKind ?? 'output') === 'command') {
369
- taskPush('MOCK_COVERAGE', 'INFO', `${task.id}: command verifier — mock-arm probes not applicable (a mock writes _output.md text, not file edits)${task.oracle
370
- ? '; offline coverage comes from the oracle and NOP gates above'
371
- : '; with no oracle registered, nothing offline shows this task is solvable'}`);
372
- }
373
- else if (existsSync(markerPath)) {
374
- try {
375
- const marker = JSON.parse(readFileSync(markerPath, 'utf8'));
376
- for (const arm of ['baseline', 'treatment']) {
377
- const behavior = marker[arm];
378
- if (behavior?.output === undefined) {
379
- taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', 'INFO', `${task.id}: no mock ${arm} output — this arm was not probed`);
380
- continue;
381
- }
382
- const probe = await probeVerifier(bench.dir, task.verifier, behavior.output, task.verifierTimeoutSeconds);
383
- taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', probe.error !== null || probe.exitCode === null ? 'FAIL' : 'INFO', `${task.id}: mock ${arm} output → ${probe.error !== null || probe.exitCode === null ? verifierFailure('verifier', task.verifier, probe.error) : `verifier ${probe.exitCode === 0 ? 'pass' : 'fail'}`}`, benchCheckEvidence(probe, task.verifier));
384
- }
385
- }
386
- catch (error) {
387
- throwIfEvaluationInterrupted();
388
- taskPush('MOCK_MARKER', 'FAIL', `${task.id}: ${MOCK_MARKER_FILE} is unreadable (${error.message})`);
389
- }
390
- }
391
- else {
392
- taskPush('MOCK_COVERAGE', 'INFO', `${task.id}: no ${MOCK_MARKER_FILE} (offline mock runs will produce empty outputs)`);
393
- }
394
- const fixtureDir = join(bench.dir, task.fixture);
395
- const fixtureBytes = listFilesRecursive(fixtureDir)
396
- .map((rel) => statSync(join(fixtureDir, rel)).size)
397
- .reduce((sum, size) => sum + size, 0);
398
- if (fixtureBytes > FIXTURE_SIZE_WARN_BYTES) {
399
- taskPush('FIXTURE_SIZE', 'WARN', `${task.id}: fixture is ${Math.round(fixtureBytes / 1024)} KB — inject mode inlines it into every prompt; keep it lean`);
400
- }
401
- else {
402
- taskPush('FIXTURE_SIZE', 'PASS', `${task.id}: fixture size ${Math.round(fixtureBytes / 1024)} KB`);
403
- }
404
- if (task.shouldTrigger === undefined) {
405
- taskPush('TRIGGER_LABEL', 'INFO', `${task.id}: no shouldTrigger label (trigger mode will skip this task)`);
406
- }
407
- else {
408
- labeledTasks++;
409
- if (task.shouldTrigger === false)
410
- negativeTasks++;
411
- }
412
- }
413
- if (labeledTasks > 0) {
414
- const fraction = negativeTasks / labeledTasks;
415
- const percent = Math.round(fraction * 100);
416
- if (negativeTasks === 0) {
417
- push('NEGATIVE_CONTROLS', 'WARN', 'no shouldTrigger:false (negative-control) tasks — trigger mode cannot measure false-trigger rate (see docs/metrics.md)');
418
- }
419
- else if (fraction < NEGATIVE_CONTROL_TARGET) {
420
- push('NEGATIVE_CONTROLS', 'WARN', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — below the ${NEGATIVE_CONTROL_PERCENT}% target in docs/metrics.md, so false-trigger rate rests on a thin sample`);
421
- }
422
- else {
423
- push('NEGATIVE_CONTROLS', 'PASS', `${negativeTasks}/${labeledTasks} labeled task(s) are negative controls (${percent}%) — at or above the ${NEGATIVE_CONTROL_PERCENT}% target`);
424
- }
425
- }
193
+ await inspectBenchIntegrity(bench, push);
426
194
  if (calibration) {
427
195
  const offlineReport = { dir, bench: identity, checks, failures: checks.filter(check => check.status === 'FAIL').length,
428
196
  warnings: checks.filter(check => check.status === 'WARN').length };
@@ -432,7 +200,6 @@ async function runBenchCheckWithinInterrupts(options, strictCalibration = false)
432
200
  log(`[UNKNOWN] ${check.code}: ${check.message}`);
433
201
  if (casePreflight.status === 'blocked') {
434
202
  if (strictCalibration) {
435
- const { CasePreflightFailed } = await import('./eval-preflight.js');
436
203
  throw new CasePreflightFailed(casePreflight);
437
204
  }
438
205
  push('CALIBRATION', 'FAIL', 'Offline case preflight blocked calibration; no agent calls or run directory were created. Fix every hard failure before a fresh plan.');
@@ -0,0 +1,9 @@
1
+ export class CasePreflightFailed extends Error {
2
+ preflight;
3
+ constructor(preflight) {
4
+ super('Offline case preflight blocked evaluation; no agent or judge calls were made.\n' +
5
+ preflight.checks.filter(c => c.status === 'FAIL').map(c => `[FAIL] ${c.code}${c.taskId ? ` (${c.taskId})` : ''}: ${c.message}${c.remediation ? ` Remedy: ${c.remediation}` : ''}`).join('\n'));
6
+ this.preflight = preflight;
7
+ this.name = 'CasePreflightFailed';
8
+ }
9
+ }
@@ -1,18 +1,11 @@
1
+ import { CasePreflightFailed } from './eval-preflight-error.js';
2
+ export { CasePreflightFailed } from './eval-preflight-error.js';
1
3
  import { loadBench } from '../harness/bench.js';
2
4
  import { collectInstalledSkillTarget } from '../harness/installed-skill.js';
3
5
  import { throwIfEvaluationInterrupted } from '../harness/interruption.js';
4
6
  import { collectEvaluationTarget } from '../harness/target.js';
5
- import { runBenchCheck } from './bench.js';
7
+ import { runOfflineBenchCheck } from '../harness/bench-check.js';
6
8
  export const CASE_PREFLIGHT_POLICY = { schemaVersion: 1, scope: 'offline-case-integrity', required: true };
7
- export class CasePreflightFailed extends Error {
8
- preflight;
9
- constructor(preflight) {
10
- super('Offline case preflight blocked evaluation; no agent or judge calls were made.\n' +
11
- preflight.checks.filter(c => c.status === 'FAIL').map(c => `[FAIL] ${c.code}${c.taskId ? ` (${c.taskId})` : ''}: ${c.message}${c.remediation ? ` Remedy: ${c.remediation}` : ''}`).join('\n'));
12
- this.preflight = preflight;
13
- this.name = 'CasePreflightFailed';
14
- }
15
- }
16
9
  function globalCheck(code, status, message) {
17
10
  return { code, status, message, taskId: null, location: { path: 'bench.json', field: null },
18
11
  remediation: status === 'FAIL' ? 'Fix the inputs or check error and run a fresh preview before executing.' : null, evidence: null };
@@ -22,7 +15,7 @@ export async function checkEvalCases(bench, targets, installed, log) {
22
15
  const started = performance.now();
23
16
  let checks;
24
17
  try {
25
- const result = await runBenchCheck({ dir: bench.dir, taskIds: bench.tasks.map(t => t.id), calibrate: false, log: () => { } });
18
+ const result = await runOfflineBenchCheck({ dir: bench.dir, taskIds: bench.tasks.map(t => t.id), log: () => { } });
26
19
  checks = result.checks.map(check => {
27
20
  const unknown = (check.code === 'ORACLE' && check.status === 'WARN') ||
28
21
  ((check.code === 'MOCK_BASELINE' || check.code === 'MOCK_TREATMENT') && check.status === 'INFO' && check.evidence === null) ||