skillfit 0.10.0 → 0.10.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.
- package/README.md +10 -2
- package/README.zh-CN.md +10 -2
- package/dist/cli.js +19 -13
- package/dist/commands/bench.js +99 -91
- package/dist/commands/eval-component.js +8 -1
- package/dist/commands/eval-export.js +32 -6
- package/dist/commands/eval-export.test.js +165 -8
- package/dist/commands/eval-interruption.test.js +238 -0
- package/dist/commands/eval-preflight.js +61 -0
- package/dist/commands/eval-preflight.test.js +239 -0
- package/dist/commands/eval-report.js +44 -13
- package/dist/commands/eval-report.test.js +2 -2
- package/dist/commands/eval.js +81 -59
- package/dist/harness/eval-audit.js +3 -1
- package/dist/harness/eval-budget.test.js +4 -2
- package/dist/harness/eval-component.test.js +6 -6
- package/dist/harness/executors/api.js +10 -1
- package/dist/harness/executors/api.test.js +43 -0
- package/dist/harness/executors/cli.js +24 -3
- package/dist/harness/experiment-session.js +60 -9
- package/dist/harness/experiment-session.test.js +43 -1
- package/dist/harness/input-snapshot.js +150 -0
- package/dist/harness/interruption.js +48 -0
- package/dist/harness/interruption.test.js +31 -0
- package/dist/harness/runner.js +53 -15
- package/dist/harness/trigger.js +20 -4
- package/docs/bench-check-json.md +8 -1
- package/docs/eval-case-preflight.md +110 -0
- package/docs/eval-component.md +28 -0
- package/docs/eval-costs.md +9 -0
- package/docs/evaluation-input-snapshots.md +124 -0
- package/docs/evaluation-interruption.md +89 -0
- package/docs/evaluation-reports.md +49 -0
- package/docs/experiment-workflow.md +9 -2
- package/docs/first-real-eval.md +5 -2
- package/docs/growth-roadmap-2026-10.md +15 -10
- package/docs/metrics.md +31 -0
- package/docs/plans/2026-10-16-case-workflow-and-release.md +19 -0
- package/docs/releases/0.10.0-ci-registry-install.json +140 -0
- package/docs/releases/0.10.0-feature-smoke.json +22 -0
- package/docs/releases/0.10.0-feature-smoke.mjs +62 -0
- package/docs/releases/0.10.0-signatures.txt +7 -0
- package/docs/releases/0.10.0-verification.json +76 -0
- package/docs/releases/0.10.0.md +44 -8
- package/docs/releases/0.10.1-feature-smoke.mjs +95 -0
- package/docs/releases/0.10.1.md +38 -0
- package/docs/replay-packages.md +14 -5
- package/docs/schemas/eval-preflight.schema.json +57 -0
- package/docs/schemas/eval-result.schema.json +11 -0
- package/docs/sharing-results.md +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,6 +94,10 @@ For eval and baseline calibration, `--trials` must be an integer from 1 to 20. F
|
|
|
94
94
|
|
|
95
95
|
Use `--max-calls <n>` for eval or baseline calibration to reject plans above a call ceiling (including enabled judges). New runs retain a frozen plan, call ledger, session state and artifact hashes; input/config drift or executor failures stop further calls. Partial runs cannot support an installation recommendation. Follow the [bounded experiment workflow](docs/experiment-workflow.md), including its environment limits.
|
|
96
96
|
|
|
97
|
+
Included in 0.10.1: Ctrl+C stops live evaluation processes and subsequent calls, retains available output/usage and seals a stopped run before exit 130. SIGTERM uses exit 143. Partial or unknown usage stays incomplete; interrupted prefixes cannot authorize an upgrade or retry themselves. See [interruption and retained records](docs/evaluation-interruption.md).
|
|
98
|
+
|
|
99
|
+
Also included in 0.10.1: live `eval` checks selected cases offline before any agent/judge call. Hard failures block execution; warnings and unknown evidence are reported separately and retained with the run. Previews declare these checks pending and execute no verifier/oracle. This adds local checking time and zero model calls. See [case preflight](docs/eval-case-preflight.md).
|
|
100
|
+
|
|
97
101
|
Supported agents: **Claude Code**, **OpenAI Codex CLI**, **Kimi Code** ([capability matrix](src/matrix/agents.json) — machine-readable, dated, doc-linked). Trigger-mode capture is currently verified for Kimi Code and Codex CLI.
|
|
98
102
|
|
|
99
103
|
## Build your own cases
|
|
@@ -197,10 +201,14 @@ Try the synthetic example below, then replace its path with the `Manifest:` path
|
|
|
197
201
|
node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
|
|
198
202
|
```
|
|
199
203
|
|
|
200
|
-
|
|
204
|
+
In 0.10.1, Markdown and JSON accept the same manifest, native run directory or portable package, including stopped/incomplete batches. Both assess saved evidence and explain acceptance separately from a quality verdict. `--replay`, `--records` and `--policy` work in either format; successful rendering does not authorize an upgrade. See [report inputs and states](docs/evaluation-reports.md).
|
|
205
|
+
|
|
206
|
+
New reports separate cached and uncached input, output, and elapsed time, with spending per successful task that includes failed runs. They show surviving pairs alongside all agent invocations, and mark partial or missing timeout usage instead of treating it as zero. Chat-completions API responses retain explicit cached-input counts, including zero; missing or invalid counts stay unknown. Older manifests identify these fields as unrecorded. See [cost accounting](docs/eval-costs.md).
|
|
201
207
|
|
|
202
208
|
Export a native paired run without a judge as a portable directory with original receipts, matching inputs, pinned compiled CLI, checksums and a replay entry point. Export previews by default; missing inputs or an existing destination stop it. The whole package can move to another machine. Replay calls no model, preserves stopped/unknown costs and authorizes no upgrade. Review project data before sharing; see [portable replay packages](docs/replay-packages.md).
|
|
203
209
|
|
|
210
|
+
Version 0.10.1 seals input copies before dispatch: later edits/deletions of the original Skill, bench or request no longer prevent export/replay. The plan records snapshot integrity, local copy time and storage; a damaged declared snapshot is rejected. Historical runs still need matching recovered inputs. See [sealed evaluation inputs](docs/evaluation-input-snapshots.md).
|
|
211
|
+
|
|
204
212
|
```bash
|
|
205
213
|
node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
|
|
206
214
|
node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --yes --json
|
|
@@ -292,7 +300,7 @@ Not affiliated with Anthropic, OpenAI, Moonshot AI, or any agent vendor. Evaluat
|
|
|
292
300
|
- [x] Optional `triggerClass` (`explicit`, `implicit`, `contextual`) on positive tasks. Unlabeled tasks stay in the pooled recall.
|
|
293
301
|
- [x] `--compete-installed` copies other user-level Skills into a trigger trial. System Skills and plugins outside the matrix directories are not copied. `installed` reports a long-body read separately from the task result; that read is not trigger recall.
|
|
294
302
|
- [ ] An installation recommendation. The July 2026 eight-skill study found no robust task-quality gain. The 67-Skill catalog and the 13-Skill starter set are not evaluated as sets.
|
|
295
|
-
- [x] npm publication (`skillfit@0.
|
|
303
|
+
- [x] npm publication (`skillfit@0.10.0`), with [verified CLI/OIDC publication and registry installation](docs/releases/0.10.0-verification.json). `npx skillfit` installs that release. Clone, `npm ci`, and `npm run build` remain valid.
|
|
296
304
|
- [x] Community bench and evidence submissions. Benches go in `benches/contrib`; evidence uses the Evidence submission issue template. CI runs the offline gates and does not call an agent.
|
|
297
305
|
- [ ] Cursor / Gemini CLI / OpenCode adapters
|
|
298
306
|
- [x] Streamable HTTP MCP preflight (`mcp check` transport `http`). It does not call a tool.
|
package/README.zh-CN.md
CHANGED
|
@@ -94,6 +94,10 @@ eval 和基线校准的 `--trials` 必须是 1 到 20 的整数。小数、格
|
|
|
94
94
|
|
|
95
95
|
eval 和基线校准可用 `--max-calls <n>` 拒绝超出调用上限的计划(包括启用的裁判调用)。新运行会保留固定计划、调用记录、session 状态和文件哈希;输入或配置变化、执行器失败后停止后续调用。未完成的运行不能支持安装建议。详见[有限且可核查的实验流程](docs/experiment-workflow.md),其中也说明环境控制的边界。
|
|
96
96
|
|
|
97
|
+
0.10.1 已包含:Ctrl+C 会停止正在运行的评测进程和后续调用,保留可用输出与用量,封存中止记录后以 130 退出。SIGTERM 对应 143。部分或未知用量仍不完整;中止批次不能获准升级,也不会自行重试。参见[中断与记录保留](docs/evaluation-interruption.md)。
|
|
98
|
+
|
|
99
|
+
0.10.1 还包含:正式 `eval` 会在任何 agent/裁判调用前离线检查所选 case。硬失败会阻止开跑;警告与未知证据分别报告,并随本批记录保留。预览会标明校验尚未执行,不运行评分器或参考解。它只增加本地校验时间,新增模型调用为零。参见 [case 开跑前校验](docs/eval-case-preflight.md)。
|
|
100
|
+
|
|
97
101
|
支持的 agent:**Claude Code**、**OpenAI Codex CLI**、**Kimi Code**([能力矩阵](src/matrix/agents.json)——机器可读、带验证日期、附官方文档链接)。trigger 模式的捕获目前已在 Kimi Code 和 Codex CLI 上验证过。
|
|
98
102
|
|
|
99
103
|
## 创建自己的 case
|
|
@@ -194,10 +198,14 @@ node dist/cli.js eval ./context7-experiment --bench ./my-context7-bench --agent
|
|
|
194
198
|
node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
|
|
195
199
|
```
|
|
196
200
|
|
|
197
|
-
|
|
201
|
+
0.10.1 中,普通报告和 JSON 都接受同样的 manifest、原生运行目录或复现包,包括中止和未完成批次。两者都会核查已存证据,并把采用决定与质量判定分开解释。`--replay`、`--records` 和 `--policy` 两种格式都能用;成功生成报告不代表获准升级。参见[报告输入和状态](docs/evaluation-reports.md)。
|
|
202
|
+
|
|
203
|
+
新报告分别列出缓存输入、未缓存输入、输出和耗时,并把失败运行的消耗计入每次成功任务的成本。报告同时展示存活配对和全部 agent 调用;超时导致的用量不完整或缺失会单独标记,不会当作零。Chat completions API 明确返回的缓存输入计数(包括零)会被保留;缺失或非法值仍记为未知。旧 manifest 会显示这些字段未记录。详见[成本统计](docs/eval-costs.md)。
|
|
198
204
|
|
|
199
205
|
没有 judge 的原生配对实验可导出为独立目录,包含原始记录、匹配的输入、当时的编译版 CLI、校验清单和重放入口。默认只预览;缺输入或目标目录已存在就停止。整个目录可搬到另一台机器,重放不调用模型,保留中止状态和未知成本,也不能授权升级。分享前检查项目数据,参见[可搬走的复现包](docs/replay-packages.md)。
|
|
200
206
|
|
|
207
|
+
0.10.1 会在调用前封存输入副本:原始 Skill、bench 或请求之后被修改、删除,也不影响导出和重放。计划会记录快照校验信息、本地复制耗时和存储量;已声明的快照损坏就拒绝使用。历史记录仍需找回匹配的原始输入。参见[评测输入封存](docs/evaluation-input-snapshots.md)。
|
|
208
|
+
|
|
201
209
|
```bash
|
|
202
210
|
node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
|
|
203
211
|
node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --yes --json
|
|
@@ -289,7 +297,7 @@ node ./personal-codex/setup.mjs --yes
|
|
|
289
297
|
- [x] 正例任务可选 `triggerClass`(`explicit`、`implicit`、`contextual`)。没标类别的任务仍只进汇总召回率。
|
|
290
298
|
- [x] `--compete-installed` 把其他用户级 Skill 复制进 trigger 试验。矩阵目录之外的系统 Skill 和插件不会被复制。`installed` 把「读了长正文」和任务结果分开报告;这次读取不是 trigger 召回率。
|
|
291
299
|
- [ ] 安装建议。2026 年 7 月的 8 个 Skill 实验没有可靠的任务质量增益。67 个 Skill 目录和 13 个入门套装都没有作为一组被评过。
|
|
292
|
-
- [x] 已发布到 npm(`skillfit@0.
|
|
300
|
+
- [x] 已发布到 npm(`skillfit@0.10.0`),并通过 [CLI/OIDC 发布与注册表安装验收](docs/releases/0.10.0-verification.json)。`npx skillfit` 安装的是这个版本。克隆后 `npm ci` 再 `npm run build` 仍然可用。
|
|
293
301
|
- [x] 社区 bench 与 evidence 提交。bench 放在 `benches/contrib`;证据用 Evidence submission issue 模板。CI 只跑离线检查,不调用 agent。
|
|
294
302
|
- [ ] Cursor / Gemini CLI / OpenCode 适配器
|
|
295
303
|
- [x] Streamable HTTP MCP 预检(`mcp check` 的 `http` 传输)。不会调用工具。
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ const USAGE = `skillfit ${VERSION} — evidence-driven configuration for AI codi
|
|
|
19
19
|
Usage:
|
|
20
20
|
skillfit doctor [--agent <id>] Inspect current agent configuration health
|
|
21
21
|
skillfit report [--agent <id>] [--json] Skill usage receipts from local session history (read-only)
|
|
22
|
-
skillfit report eval <manifest
|
|
22
|
+
skillfit report eval <manifest-or-run-dir> Assess saved evidence as Markdown (read-only)
|
|
23
23
|
skillfit report eval <manifest-or-run-dir> --json [--replay] Assess saved evidence for an Agent
|
|
24
24
|
skillfit report eval <run-dir> --export <new-dir> Plan a portable offline replay package
|
|
25
25
|
skillfit eval --request <request.json> --dry-run Return a pinned JSON plan without calls
|
|
@@ -47,9 +47,9 @@ Options:
|
|
|
47
47
|
--request <path> Version 1 Skill revision request (JSON output; excludes positional eval options)
|
|
48
48
|
--plan-sha <hash> Confirm the current --request dry-run plan before real calls
|
|
49
49
|
--json Machine output for bench check/list/show/edit/remove, report, and request-based eval
|
|
50
|
-
--policy <path> With report eval
|
|
51
|
-
--records <dir> With report eval
|
|
52
|
-
--replay With report eval
|
|
50
|
+
--policy <path> With report eval, assess against a policy (post-hoc changes cannot authorize adoption)
|
|
51
|
+
--records <dir> With report eval, use native evidence from this run directory
|
|
52
|
+
--replay With report eval, regrade cloned deliveries using the frozen bench
|
|
53
53
|
--export <dir> With report eval, plan a portable package; --yes writes a fresh destination
|
|
54
54
|
--input-root <label=path> With --export, recover pinned inputs from a matching copy (repeatable)
|
|
55
55
|
--compete-installed With --mode trigger, copy other user-level Skills into each trial so recall is not an upper bound
|
|
@@ -173,6 +173,10 @@ function jsonBenchCommand() {
|
|
|
173
173
|
return args.some(jsonFlag) && command[0] === 'bench' && supported.includes(command[1] ?? '') ? command[1] : null;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
+
function failureExitCode(fallback) {
|
|
177
|
+
const current = Number(process.exitCode);
|
|
178
|
+
return current === 130 || current === 143 ? current : fallback;
|
|
179
|
+
}
|
|
176
180
|
async function main() {
|
|
177
181
|
const { values, positionals } = parseArgs({
|
|
178
182
|
args: process.argv.slice(2),
|
|
@@ -211,8 +215,8 @@ async function main() {
|
|
|
211
215
|
throw new Error('--request applies only to eval.');
|
|
212
216
|
if (values['plan-sha'] !== undefined && (command !== 'eval' || values.request === undefined || values['dry-run']))
|
|
213
217
|
throw new Error('--plan-sha requires a non-dry-run eval --request.');
|
|
214
|
-
if ((values.policy !== undefined || values.records !== undefined || values.replay) && !(command === 'report' && positionals[1] === 'eval'
|
|
215
|
-
throw new Error('--policy, --records and --replay require report eval
|
|
218
|
+
if ((values.policy !== undefined || values.records !== undefined || values.replay) && !(command === 'report' && positionals[1] === 'eval')) {
|
|
219
|
+
throw new Error('--policy, --records and --replay require report eval.');
|
|
216
220
|
}
|
|
217
221
|
const common = {
|
|
218
222
|
agent: values.agent,
|
|
@@ -246,7 +250,7 @@ async function main() {
|
|
|
246
250
|
if (!positionals[2]) {
|
|
247
251
|
if (values.json)
|
|
248
252
|
throw new Error('report eval --json requires a manifest or native run directory.');
|
|
249
|
-
console.error('Usage: skillfit report eval <manifest
|
|
253
|
+
console.error('Usage: skillfit report eval <manifest-or-run-dir>');
|
|
250
254
|
process.exitCode = 2;
|
|
251
255
|
return;
|
|
252
256
|
}
|
|
@@ -262,7 +266,9 @@ async function main() {
|
|
|
262
266
|
policyPath: values.policy, recordsPath: values.records, replay: values.replay, benchDir: values.bench,
|
|
263
267
|
}), null, 2));
|
|
264
268
|
else
|
|
265
|
-
runEvalReport(positionals[2]
|
|
269
|
+
await runEvalReport(positionals[2], undefined, {
|
|
270
|
+
policyPath: values.policy, recordsPath: values.records, replay: values.replay, benchDir: values.bench,
|
|
271
|
+
});
|
|
266
272
|
return;
|
|
267
273
|
}
|
|
268
274
|
await runReport({ agent: values.agent, json: values.json ?? false });
|
|
@@ -275,7 +281,7 @@ async function main() {
|
|
|
275
281
|
const result = await runEvalComponent(values.request, { dryRun: values['dry-run'], expectedPlanSha256: values['plan-sha'], log: line => console.error(line) });
|
|
276
282
|
console.log(JSON.stringify(result, null, 2));
|
|
277
283
|
if (result.status === 'stopped')
|
|
278
|
-
process.exitCode = 2;
|
|
284
|
+
process.exitCode = failureExitCode(2);
|
|
279
285
|
return;
|
|
280
286
|
}
|
|
281
287
|
if (values.json)
|
|
@@ -456,21 +462,21 @@ main().catch((err) => {
|
|
|
456
462
|
const benchCommand = jsonBenchCommand();
|
|
457
463
|
if (benchCommand === 'check') {
|
|
458
464
|
console.log(JSON.stringify(benchCheckError(err), null, 2));
|
|
459
|
-
process.exitCode = 2;
|
|
465
|
+
process.exitCode = failureExitCode(2);
|
|
460
466
|
return;
|
|
461
467
|
}
|
|
462
468
|
if (benchCommand) {
|
|
463
469
|
console.log(JSON.stringify({ schemaVersion: 1, kind: 'skillfit.bench-error', status: 'error',
|
|
464
470
|
error: { code: 'INVALID_BENCH_OPERATION', message: err instanceof Error ? err.message : String(err) } }, null, 2));
|
|
465
|
-
process.exitCode = 2;
|
|
471
|
+
process.exitCode = failureExitCode(2);
|
|
466
472
|
return;
|
|
467
473
|
}
|
|
468
474
|
if (process.argv.some(arg => arg === '--request' || arg.startsWith('--request=')) ||
|
|
469
475
|
(process.argv.includes('--json') && process.argv.includes('report') && process.argv.includes('eval'))) {
|
|
470
476
|
console.log(JSON.stringify(componentError(err), null, 2));
|
|
471
|
-
process.exitCode = 2;
|
|
477
|
+
process.exitCode = failureExitCode(2);
|
|
472
478
|
return;
|
|
473
479
|
}
|
|
474
480
|
console.error(err instanceof Error ? err.message : String(err));
|
|
475
|
-
process.exitCode = 1;
|
|
481
|
+
process.exitCode = failureExitCode(1);
|
|
476
482
|
});
|
package/dist/commands/bench.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSyn
|
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
5
5
|
import { getAgent } from '../agents.js';
|
|
6
|
-
import { loadBench } from '../harness/bench.js';
|
|
6
|
+
import { loadBench, selectBenchTasks } from '../harness/bench.js';
|
|
7
7
|
import { ExperimentSession, validateCallBudget } from '../harness/experiment-session.js';
|
|
8
8
|
import { CliExecutor } from '../harness/executors/cli.js';
|
|
9
9
|
import { listFilesRecursive } from '../harness/hash.js';
|
|
@@ -15,6 +15,7 @@ import { confirm as confirmPrompt } from './confirm.js';
|
|
|
15
15
|
import { commandTemplateFiles } from './bench-command-template.js';
|
|
16
16
|
import { benchDiagnostic, benchCheckEvidence } from './bench-check-report.js';
|
|
17
17
|
import { BACKUP_SUFFIX } from './install.js';
|
|
18
|
+
import { withEvaluationInterrupts, throwIfEvaluationInterrupted } from '../harness/interruption.js';
|
|
18
19
|
const FIXTURE_SIZE_WARN_BYTES = 64 * 1024;
|
|
19
20
|
// benches/README.md: a verifier decomposes its acceptance criteria into 2–8 named checks.
|
|
20
21
|
const MIN_FACET_CHECKS = 2;
|
|
@@ -256,12 +257,13 @@ export async function runBenchCheck(options) {
|
|
|
256
257
|
const checks = [];
|
|
257
258
|
let identity = null;
|
|
258
259
|
const push = (code, status, message, task, evidence) => {
|
|
260
|
+
throwIfEvaluationInterrupted();
|
|
259
261
|
checks.push(benchDiagnostic(code, status, message, task, evidence));
|
|
260
262
|
log(renderCheck({ status, message }));
|
|
261
263
|
};
|
|
262
264
|
let bench;
|
|
263
265
|
try {
|
|
264
|
-
bench = loadBench(dir);
|
|
266
|
+
bench = selectBenchTasks(loadBench(dir), options.taskIds);
|
|
265
267
|
}
|
|
266
268
|
catch (error) {
|
|
267
269
|
push('BENCH_LOAD', 'FAIL', `bench does not load: ${error.message}`);
|
|
@@ -346,13 +348,16 @@ export async function runBenchCheck(options) {
|
|
|
346
348
|
const marker = JSON.parse(readFileSync(markerPath, 'utf8'));
|
|
347
349
|
for (const arm of ['baseline', 'treatment']) {
|
|
348
350
|
const behavior = marker[arm];
|
|
349
|
-
if (behavior?.output === undefined)
|
|
351
|
+
if (behavior?.output === undefined) {
|
|
352
|
+
taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', 'INFO', `${task.id}: no mock ${arm} output — this arm was not probed`);
|
|
350
353
|
continue;
|
|
354
|
+
}
|
|
351
355
|
const probe = await probeVerifier(bench.dir, task.verifier, behavior.output);
|
|
352
|
-
taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', 'INFO', `${task.id}: mock ${arm} output → verifier ${probe.exitCode === 0 ? 'pass' : 'fail'}`, benchCheckEvidence(probe, task.verifier));
|
|
356
|
+
taskPush(arm === 'baseline' ? 'MOCK_BASELINE' : 'MOCK_TREATMENT', probe.exitCode === null ? 'FAIL' : 'INFO', `${task.id}: mock ${arm} output → ${probe.exitCode === null ? verifierFailure('verifier', task.verifier, probe.error) : `verifier ${probe.exitCode === 0 ? 'pass' : 'fail'}`}`, benchCheckEvidence(probe, task.verifier));
|
|
353
357
|
}
|
|
354
358
|
}
|
|
355
359
|
catch (error) {
|
|
360
|
+
throwIfEvaluationInterrupted();
|
|
356
361
|
taskPush('MOCK_MARKER', 'FAIL', `${task.id}: ${MOCK_MARKER_FILE} is unreadable (${error.message})`);
|
|
357
362
|
}
|
|
358
363
|
}
|
|
@@ -417,99 +422,102 @@ async function calibrateBench(bench, options, push, log) {
|
|
|
417
422
|
push('INFO', `calibration plan: ${bench.tasks.length} task(s) × ${trials} baseline run(s), input ${inputMode}; ${plannedCalls} calls, ceiling ${maxCalls}; no agent started and no run directory created`);
|
|
418
423
|
return;
|
|
419
424
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
425
|
+
return withEvaluationInterrupts(async () => {
|
|
426
|
+
const emptySkillDir = mkdtempSync(join(tmpdir(), 'skillfit-calibrate-'));
|
|
427
|
+
let session;
|
|
428
|
+
let failure;
|
|
429
|
+
try {
|
|
430
|
+
const skill = {
|
|
431
|
+
kind: 'skill',
|
|
432
|
+
name: 'calibration-none',
|
|
433
|
+
sourceDir: emptySkillDir,
|
|
434
|
+
files: [],
|
|
435
|
+
sha256: '0'.repeat(64),
|
|
436
|
+
payload: '',
|
|
437
|
+
overlays: {},
|
|
438
|
+
};
|
|
439
|
+
const runGroup = options.runGroup ??
|
|
440
|
+
`calibrate-${new Date().toISOString().slice(0, 10).replaceAll('-', '')}-${String(Date.now() % 100000).padStart(5, '0')}`;
|
|
441
|
+
if (!RUN_GROUP_PATTERN.test(runGroup))
|
|
442
|
+
throw new Error(`Invalid run group: ${runGroup}`);
|
|
443
|
+
const runsRoot = options.runsRoot ?? resolve('runs');
|
|
444
|
+
push('INFO', `calibration plan: ${plannedCalls} baseline calls, ceiling ${maxCalls}; fresh output ${join(runsRoot, runGroup)}`);
|
|
445
|
+
session = new ExperimentSession({ bench, target: skill, groupDir: join(runsRoot, runGroup), plannedCalls,
|
|
446
|
+
maxCalls, agent: options.agent, injected: options.executor !== undefined, ...options.sessionOptions,
|
|
447
|
+
workspaces: bench.tasks.flatMap(task => Array.from({ length: trials }, (_, i) => join(runsRoot, runGroup, task.id, 'baseline', `trial-${i + 1}`))),
|
|
448
|
+
details: { mode: 'calibration', inputMode, trials, executor: executor.describe() } });
|
|
449
|
+
// Calibration measures inject-mode baseline difficulty, so it drives the inject path with an
|
|
450
|
+
// empty skill payload (prompt.ts drops a falsy payload, so no skill block is injected) and runs
|
|
451
|
+
// one arm per task. This used to route through trigger mode, whose `shouldTrigger` filter
|
|
452
|
+
// silently calibrated zero tasks on an unlabelled bench and then reported PASS 0/0.
|
|
453
|
+
const plan = {
|
|
454
|
+
bench,
|
|
455
|
+
target: skill,
|
|
456
|
+
inputMode,
|
|
457
|
+
executor: session.wrap(executor, 'agent'),
|
|
458
|
+
trials,
|
|
459
|
+
runsRoot,
|
|
460
|
+
runGroup,
|
|
461
|
+
log,
|
|
462
|
+
};
|
|
463
|
+
push('INFO', `calibration: ${trials} run(s) per task with no skill installed (baseline difficulty; input ${inputMode})`);
|
|
464
|
+
let discriminative = 0;
|
|
465
|
+
let tasksRun = 0;
|
|
466
|
+
const taskResults = [];
|
|
467
|
+
for (const task of bench.tasks) {
|
|
468
|
+
let passes = 0;
|
|
469
|
+
let completed = 0;
|
|
470
|
+
let errors = 0;
|
|
471
|
+
for (let trial = 1; trial <= trials; trial++) {
|
|
472
|
+
const outcome = await runTrial(plan, task.id, 'baseline', trial);
|
|
473
|
+
throwIfEvaluationInterrupted();
|
|
474
|
+
if (outcome.error !== null) {
|
|
475
|
+
errors++;
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
completed++;
|
|
479
|
+
if (outcome.passed)
|
|
480
|
+
passes++;
|
|
481
|
+
}
|
|
482
|
+
taskResults.push({ id: task.id, passes, completed, errors });
|
|
483
|
+
if (completed === 0) {
|
|
484
|
+
push('WARN', `${task.id}: no completed runs${errors > 0 ? ` (${errors} ungraded run(s))` : ''} — cannot assess difficulty`);
|
|
469
485
|
continue;
|
|
470
486
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
push('WARN', `${task.id}: baseline ${passes}/${completed} — too easy (saturated; cannot discriminate skill effects)`);
|
|
484
|
-
}
|
|
485
|
-
else if (rate <= 0.1) {
|
|
486
|
-
push('WARN', `${task.id}: baseline ${passes}/${completed} — too hard or broken (floor)`);
|
|
487
|
+
tasksRun++;
|
|
488
|
+
const rate = passes / completed;
|
|
489
|
+
if (rate >= 0.9) {
|
|
490
|
+
push('WARN', `${task.id}: baseline ${passes}/${completed} — too easy (saturated; cannot discriminate skill effects)`);
|
|
491
|
+
}
|
|
492
|
+
else if (rate <= 0.1) {
|
|
493
|
+
push('WARN', `${task.id}: baseline ${passes}/${completed} — too hard or broken (floor)`);
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
discriminative++;
|
|
497
|
+
push('PASS', `${task.id}: baseline ${passes}/${completed} — discriminative band`);
|
|
498
|
+
}
|
|
487
499
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
500
|
+
session.settle();
|
|
501
|
+
const result = { schemaVersion: 1, runGroup, inputMode, trials, tasks: taskResults, experiment: session.summary() };
|
|
502
|
+
writeFileSync(join(session.groupDir, '_calibration.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
|
|
503
|
+
session.finish(undefined, result, '_calibration.json');
|
|
504
|
+
if (session.summary().status !== 'completed')
|
|
505
|
+
push('FAIL', 'Calibration stopped or incomplete; inspect _session.json and _calls.jsonl before a fresh plan.');
|
|
506
|
+
if (tasksRun === 0) {
|
|
507
|
+
push('FAIL', `calibration ran 0 task(s): difficulty unmeasured (runs under ${runGroup})`);
|
|
508
|
+
return;
|
|
491
509
|
}
|
|
510
|
+
push(discriminative === tasksRun ? 'PASS' : 'INFO', `calibration: ${discriminative}/${tasksRun} task(s) in the discriminative band (runs under ${runGroup}; use --trials 3+ for steadier reads)`);
|
|
492
511
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
session.finish(undefined, result, '_calibration.json');
|
|
497
|
-
if (session.summary().status !== 'completed')
|
|
498
|
-
push('FAIL', 'Calibration stopped or incomplete; inspect _session.json and _calls.jsonl before a fresh plan.');
|
|
499
|
-
if (tasksRun === 0) {
|
|
500
|
-
push('FAIL', `calibration ran 0 task(s): difficulty unmeasured (runs under ${runGroup})`);
|
|
501
|
-
return;
|
|
512
|
+
catch (error) {
|
|
513
|
+
failure = error;
|
|
514
|
+
throw error;
|
|
502
515
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
finally {
|
|
510
|
-
session?.finish(failure);
|
|
511
|
-
rmSync(emptySkillDir, { recursive: true, force: true });
|
|
512
|
-
}
|
|
516
|
+
finally {
|
|
517
|
+
session?.finish(failure);
|
|
518
|
+
rmSync(emptySkillDir, { recursive: true, force: true });
|
|
519
|
+
}
|
|
520
|
+
});
|
|
513
521
|
}
|
|
514
522
|
function finish(dir, checks, log, calibrated = false, bench = null) {
|
|
515
523
|
const failures = checks.filter((c) => c.status === 'FAIL').length;
|
|
@@ -8,9 +8,11 @@ import { hashFileSet, listFilesRecursive, sha256Text } from '../harness/hash.js'
|
|
|
8
8
|
import { runEval } from './eval.js';
|
|
9
9
|
import { spendingBudgetReport } from '../harness/eval-budget.js';
|
|
10
10
|
import { verifyReplayPackage } from '../harness/replay-package.js';
|
|
11
|
+
import { CasePreflightFailed } from './eval-preflight.js';
|
|
11
12
|
export function componentError(error, code = 'INVALID_OR_FAILED_EVALUATION') {
|
|
12
13
|
return { schemaVersion: 1, kind: 'skillfit.eval-error', status: 'error',
|
|
13
|
-
error: { code, message: error instanceof Error ? error.message : String(error) },
|
|
14
|
+
error: { code: error instanceof CasePreflightFailed ? 'CASE_PREFLIGHT_FAILED' : code, message: error instanceof Error ? error.message : String(error) },
|
|
15
|
+
...(error instanceof CasePreflightFailed ? { casePreflight: error.preflight } : {}),
|
|
14
16
|
acceptance: { decision: 'inconclusive', eligibleForUpgrade: false, automaticUpgrade: false } };
|
|
15
17
|
}
|
|
16
18
|
export async function reportEvalComponent(path, options = {}) {
|
|
@@ -33,7 +35,10 @@ async function reportNativeEvaluation(path, options) {
|
|
|
33
35
|
throw new Error('No saved manifest or native plan found.');
|
|
34
36
|
const sessionPath = join(runDir, '_session.json');
|
|
35
37
|
const session = existsSync(sessionPath) ? record(readComponentJson(sessionPath).value, 'session') : null;
|
|
38
|
+
const nativePlan = record(readComponentJson(join(runDir, '_plan.json')).value, 'native plan');
|
|
36
39
|
return { schemaVersion: 1, kind: 'skillfit.eval-result', status: session ? 'stopped' : 'incomplete',
|
|
40
|
+
casePreflight: nativePlan.details ? record(nativePlan.details, 'native plan details').casePreflight ?? null : null,
|
|
41
|
+
inputSnapshot: nativePlan.inputSnapshot ?? null,
|
|
37
42
|
manifest: null, session, costs: stoppedAccounting(runDir), evidence: { verified: false, runDir, reasons: ['No final evaluation manifest; retained spending only.'] },
|
|
38
43
|
...(spendingBudget ? { spendingBudget } : {}),
|
|
39
44
|
acceptance: { decision: 'inconclusive', eligibleForUpgrade: false, automaticUpgrade: false,
|
|
@@ -45,6 +50,8 @@ async function reportNativeEvaluation(path, options) {
|
|
|
45
50
|
const result = assessEvaluation(data.value, audit, policy);
|
|
46
51
|
const nativePlan = audit.verified ? record(readComponentJson(join(runDir, '_plan.json')).value, 'native plan') : null;
|
|
47
52
|
return { ...result, manifest: { path: manifestPath, sha256: data.sha256, schemaVersion: 4 },
|
|
53
|
+
casePreflight: nativePlan ? record(nativePlan.details, 'native plan details').casePreflight ?? null : null,
|
|
54
|
+
inputSnapshot: nativePlan?.inputSnapshot ?? null,
|
|
48
55
|
...(spendingBudget ? { spendingBudget } : {}),
|
|
49
56
|
environment: nativePlan ? { nodeVersion: nativePlan.nodeVersion, agent: nativePlan.agent,
|
|
50
57
|
pairOrder: record(nativePlan.details, 'native plan details').pairOrder ?? null,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
3
3
|
import { loadBench } from '../harness/bench.js';
|
|
4
4
|
import { hashFileSet, sha256File } from '../harness/hash.js';
|
|
5
5
|
import { packageFiles, packageMember, portableReproducer, verifyReplayPackage } from '../harness/replay-package.js';
|
|
6
6
|
import { reportEvalComponent } from './eval-component.js';
|
|
7
|
+
import { verifyInputSnapshot } from '../harness/input-snapshot.js';
|
|
7
8
|
function overlaps(root, path) {
|
|
8
9
|
const rel = relative(root, path);
|
|
9
10
|
return !isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${sep}`);
|
|
@@ -12,8 +13,11 @@ function physical(path) {
|
|
|
12
13
|
let parent = resolve(path);
|
|
13
14
|
const parts = [];
|
|
14
15
|
while (!existsSync(parent)) {
|
|
16
|
+
const next = dirname(parent);
|
|
17
|
+
if (next === parent)
|
|
18
|
+
return resolve(path); // An original Windows drive can be absent after moving a run.
|
|
15
19
|
parts.unshift(basename(parent));
|
|
16
|
-
parent =
|
|
20
|
+
parent = next;
|
|
17
21
|
}
|
|
18
22
|
return join(realpathSync(parent), ...parts);
|
|
19
23
|
}
|
|
@@ -57,20 +61,33 @@ export async function exportEvaluation(input, output, options = {}) {
|
|
|
57
61
|
throw new Error('Portable replay currently requires paired native runs without a judge; separate judge spending is not fully recorded.');
|
|
58
62
|
if (!Array.isArray(plan.inputs) || typeof plan.packageVersion !== 'string')
|
|
59
63
|
throw new Error('Native input fingerprints or version are missing.');
|
|
64
|
+
const snapshot = verifyInputSnapshot(run, plan);
|
|
60
65
|
const copies = [];
|
|
66
|
+
const directories = new Set();
|
|
67
|
+
for (const entry of snapshot?.entries ?? [])
|
|
68
|
+
if (entry.label !== 'request') {
|
|
69
|
+
directories.add(`run/${entry.path}`);
|
|
70
|
+
for (const dir of entry.directories)
|
|
71
|
+
directories.add(`run/${entry.path}/${dir}`);
|
|
72
|
+
}
|
|
61
73
|
for (const path of [...files, '_artifacts.json'])
|
|
62
74
|
copies.push({ source: packageMember(run, path), target: `run/${path}`, sha256: sha256File(join(run, path)) });
|
|
63
75
|
const required = ['bench', 'target', 'implementation'];
|
|
64
76
|
if (plan.details?.baselineTarget)
|
|
65
77
|
required.push('baseline Skill');
|
|
66
78
|
const roots = [run];
|
|
79
|
+
// Even when copies come from the archive, preserve the existing boundary
|
|
80
|
+
// against writing an export into any original input directory.
|
|
81
|
+
const protectedRoots = [run];
|
|
67
82
|
for (const label of required) {
|
|
68
83
|
const fingerprint = plan.inputs.find((entry) => entry.label === label);
|
|
69
84
|
if (!fingerprint || !Array.isArray(fingerprint.files) || typeof fingerprint.root !== 'string')
|
|
70
85
|
throw new Error(`Missing pinned input: ${label}`);
|
|
71
86
|
const alias = label === 'baseline Skill' ? 'baseline-skill' : label;
|
|
72
|
-
|
|
87
|
+
protectedRoots.push(fingerprint.root);
|
|
88
|
+
const root = overrides.get(alias) ?? (label === 'bench' && options.benchDir ? resolve(options.benchDir) : snapshot?.roots.get(alias) ?? fingerprint.root);
|
|
73
89
|
roots.push(root);
|
|
90
|
+
protectedRoots.push(root);
|
|
74
91
|
const prefix = label === 'implementation' ? 'runtime/dist' : `inputs/${label === 'baseline Skill' ? 'baseline-skill' : label}`;
|
|
75
92
|
const paths = fingerprint.files;
|
|
76
93
|
// Every path must be safe before it is read; no configuration or global Skill roots are copied.
|
|
@@ -78,6 +95,12 @@ export async function exportEvaluation(input, output, options = {}) {
|
|
|
78
95
|
packageMember(root, path);
|
|
79
96
|
if (hashFileSet(root, paths) !== fingerprint.sha256)
|
|
80
97
|
throw new Error(`Pinned ${label} input changed or is unavailable; recover the original files before exporting.`);
|
|
98
|
+
const archived = snapshot?.entries.find(entry => entry.label === alias);
|
|
99
|
+
if (archived) {
|
|
100
|
+
directories.add(prefix);
|
|
101
|
+
for (const dir of archived.directories)
|
|
102
|
+
directories.add(`${prefix}/${dir}`);
|
|
103
|
+
}
|
|
81
104
|
for (const path of paths)
|
|
82
105
|
copies.push({ source: packageMember(root, path), target: `${prefix}/${path}`, sha256: sha256File(join(root, path)) });
|
|
83
106
|
}
|
|
@@ -86,19 +109,19 @@ export async function exportEvaluation(input, output, options = {}) {
|
|
|
86
109
|
if (!(label === 'request' && request) && !required.includes(label === 'baseline-skill' ? 'baseline Skill' : label))
|
|
87
110
|
throw new Error(`Input root is not part of this run: ${label}`);
|
|
88
111
|
if (request) {
|
|
89
|
-
const path = overrides.get('request') ?? request.path;
|
|
112
|
+
const path = overrides.get('request') ?? snapshot?.roots.get('request') ?? request.path;
|
|
90
113
|
if (!lstatSync(path).isFile() || sha256File(path) !== request.sha256)
|
|
91
114
|
throw new Error('Frozen request changed; recover the original request before exporting.');
|
|
92
115
|
copies.push({ source: path, target: 'inputs/request.json', sha256: request.sha256 });
|
|
93
116
|
}
|
|
94
|
-
if (
|
|
117
|
+
if (protectedRoots.some(root => overlaps(physical(root), physical(destination))))
|
|
95
118
|
throw new Error('Export destination must be outside the native run and pinned input roots.');
|
|
96
119
|
const log = options.log ?? console.log;
|
|
97
120
|
const apply = options.yes === true && !options.dryRun;
|
|
98
121
|
const preview = { schemaVersion: 1, kind: 'skillfit.eval-export', status: apply ? 'exported' : 'planned',
|
|
99
122
|
source: run, destination, sourcePlanSha256: planSha256, nativeStatus: session.status, hasManifest,
|
|
100
123
|
files: copies.length + 3, bytes: copies.reduce((sum, file) => sum + lstatSync(file.source).size, 0),
|
|
101
|
-
inputs: roots, modelCalls: 0, sharingReviewRequired: true };
|
|
124
|
+
inputs: roots, inputSource: snapshot ? 'sealed-snapshot' : 'original-or-recovered', modelCalls: 0, sharingReviewRequired: true };
|
|
102
125
|
log(`Portable export: ${run} -> ${destination}`);
|
|
103
126
|
for (const root of roots)
|
|
104
127
|
log(` source: ${root}`);
|
|
@@ -110,6 +133,8 @@ export async function exportEvaluation(input, output, options = {}) {
|
|
|
110
133
|
mkdirSync(dirname(destination), { recursive: true });
|
|
111
134
|
const stage = mkdtempSync(join(dirname(destination), '.skillfit-export-'));
|
|
112
135
|
try {
|
|
136
|
+
for (const dir of directories)
|
|
137
|
+
mkdirSync(join(stage, dir), { recursive: true });
|
|
113
138
|
for (const file of copies) {
|
|
114
139
|
const bytes = readFileSync(file.source);
|
|
115
140
|
if (sha256File(file.source) !== file.sha256)
|
|
@@ -117,6 +142,7 @@ export async function exportEvaluation(input, output, options = {}) {
|
|
|
117
142
|
const target = join(stage, file.target);
|
|
118
143
|
mkdirSync(dirname(target), { recursive: true });
|
|
119
144
|
writeFileSync(target, bytes, { flag: 'wx' });
|
|
145
|
+
chmodSync(target, lstatSync(file.source).mode & 0o777);
|
|
120
146
|
if (sha256File(target) !== file.sha256)
|
|
121
147
|
throw new Error(`Export copy verification failed: ${file.target}`);
|
|
122
148
|
}
|