skillfit 0.10.1 → 0.11.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/README.md +18 -6
- package/README.zh-CN.md +18 -6
- package/benches/README.md +2 -2
- package/dist/cli.js +132 -28
- package/dist/cli.test.js +94 -0
- package/dist/commands/bench-calibration.js +197 -0
- package/dist/commands/bench-calibration.test.js +237 -0
- package/dist/commands/bench-check-json.test.js +24 -3
- package/dist/commands/bench.js +63 -143
- package/dist/commands/calibration-cli.test.js +145 -0
- package/dist/commands/eval-agent-preflight.test.js +245 -0
- package/dist/commands/eval-cli.js +31 -0
- package/dist/commands/eval-component.js +52 -28
- package/dist/commands/eval-export-modes.test.js +350 -0
- package/dist/commands/eval-export.js +12 -4
- package/dist/commands/eval-plan.js +37 -0
- package/dist/commands/eval-preflight.test.js +144 -1
- package/dist/commands/eval-report.js +18 -3
- package/dist/commands/eval-single-arm-replay.js +21 -0
- package/dist/commands/eval-single-arm-report.js +223 -0
- package/dist/commands/eval.js +106 -56
- package/dist/commands/evaluation-report.js +5 -0
- package/dist/commands/evaluation-report.test.js +243 -0
- package/dist/commands/replay-cancellation.test.js +105 -0
- package/dist/commands/workflow-entrypoints.test.js +137 -0
- package/dist/harness/agent-preflight.js +180 -0
- package/dist/harness/bench.js +2 -1
- package/dist/harness/command.js +49 -0
- package/dist/harness/eval-audit.js +161 -16
- package/dist/harness/eval-budget.js +46 -2
- package/dist/harness/eval-budget.test.js +26 -1
- package/dist/harness/eval-component.test.js +163 -0
- package/dist/harness/eval-contract.js +11 -5
- package/dist/harness/executors/api.js +4 -3
- package/dist/harness/executors/api.test.js +18 -0
- package/dist/harness/experiment-session.js +18 -10
- package/dist/harness/experiment-session.test.js +8 -0
- package/dist/harness/invocation-costs.js +72 -0
- package/dist/harness/judge-accounting.test.js +216 -0
- package/dist/harness/judge-audit.js +56 -0
- package/dist/harness/judge.js +86 -21
- package/dist/harness/replay-package.js +71 -5
- package/dist/harness/runner.js +40 -30
- package/dist/harness/runner.test.js +23 -0
- package/dist/harness/single-arm-audit.js +436 -0
- package/dist/harness/trigger.js +21 -3
- package/dist/harness/trigger.test.js +12 -0
- package/dist/harness/verifier-error.js +65 -0
- package/dist/harness/verifier.test.js +128 -0
- package/docs/bench-authoring.md +34 -9
- package/docs/bench-check-json.md +28 -5
- package/docs/eval-agent-preflight.md +101 -0
- package/docs/eval-case-preflight.md +5 -0
- package/docs/eval-component.md +38 -10
- package/docs/eval-costs.md +44 -0
- package/docs/eval-planning.md +153 -0
- package/docs/evaluation-input-snapshots.md +2 -1
- package/docs/evaluation-interruption.md +22 -10
- package/docs/evaluation-reports.md +97 -3
- package/docs/experiment-workflow.md +7 -0
- package/docs/first-real-eval.md +50 -3
- package/docs/growth-roadmap-2026-10.md +41 -9
- package/docs/metrics.md +40 -3
- package/docs/plans/2026-10-17-workflow-foundations.md +64 -0
- package/docs/releases/0.10.1-ci-registry-install.json +70 -0
- package/docs/releases/0.10.1-feature-smoke.json +28 -0
- package/docs/releases/0.10.1-local-registry-install.json +60 -0
- package/docs/releases/0.10.1-registry-metadata.json +33 -0
- package/docs/releases/0.10.1-signatures.txt +7 -0
- package/docs/releases/0.10.1-verification.json +90 -0
- package/docs/releases/0.10.1.md +37 -4
- package/docs/releases/0.11.0-feature-smoke.mjs +224 -0
- package/docs/releases/0.11.0.md +47 -0
- package/docs/replay-packages.md +38 -6
- package/docs/schemas/agent-preflight.schema.json +31 -0
- package/docs/schemas/calibration-plan.schema.json +22 -0
- package/docs/schemas/calibration-result.schema.json +17 -0
- package/docs/schemas/eval-request.schema.json +1 -1
- package/docs/schemas/eval-result.schema.json +3 -1
- package/docs/schemas/invocation-costs.schema.json +31 -0
- package/docs/schemas/judge-call.schema.json +22 -0
- package/docs/schemas/single-arm-report.schema.json +20 -0
- package/docs/schemas/verifier-error.schema.json +11 -0
- package/docs/sharing-results.md +3 -0
- package/docs/verifier-contract.md +99 -0
- package/package.json +1 -1
- package/skills/skillfit/SKILL.md +41 -8
package/README.md
CHANGED
|
@@ -65,8 +65,8 @@ The skill fired once in nine in-domain tasks — and the tasks pass 3/3 without
|
|
|
65
65
|
## Install
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
|
-
npx skillfit@0.
|
|
69
|
-
npx skillfit@0.
|
|
68
|
+
npx skillfit@0.11.0 --help
|
|
69
|
+
npx skillfit@0.11.0 doctor
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
`npx skillfit` installs the published release and needs Node.js 22 or newer. The quick start below uses a source checkout so you can run the benches that ship in this repository. After `npm run build`, `node dist/cli.js` is that checkout's CLI. `skillfit` is the command installed from npm.
|
|
@@ -114,9 +114,13 @@ node dist/cli.js eval skills/skillfit --bench my-bench --agent codex --input wor
|
|
|
114
114
|
|
|
115
115
|
This is a synthetic teaching case, not a Skill benchmark. Replace the fixture, prompt, verifier and oracle with your actual task before measuring benefit. The preview shows two planned calls and starts none. Omit `--kind` (or use `--kind output`) for the existing reply-grading starter. Capture an observed failure with `bench add --freeze`, or import a maintainer fix with `--from-commit`; follow the [authoring guide](docs/bench-authoring.md).
|
|
116
116
|
|
|
117
|
-
Agent callers can use `bench check --json` for versioned gate identifiers, task IDs, locations, failure reasons, remediation suggestions and bounded verifier evidence. stdout is JSON only; exit codes distinguish passed checks, failed checks and errors.
|
|
117
|
+
Agent callers can use `bench check --json` for versioned gate identifiers, task IDs, locations, failure reasons, remediation suggestions and bounded verifier evidence. stdout is JSON only; exit codes distinguish passed checks, failed checks and errors. Without `--calibrate`, this remains an offline integrity check; warnings still need review. Version 0.11.0 also supports a separate `--calibrate --json --dry-run` plan, with explicit hash confirmation before JSON execution. See the [JSON contract](docs/bench-check-json.md).
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
Version 0.11.0 supports quoted verifier/oracle arguments, including script paths with spaces. Recognized grader load/runtime errors and explicit infrastructure-error messages block offline gates or become ungraded evaluation errors, preserving agent costs. Normal task failures and assertions remain graded failures. See [verifier commands and error reporting](docs/verifier-contract.md).
|
|
120
|
+
|
|
121
|
+
The same source checks the Agent environment in eval and baseline-calibration previews and before dispatch: CLI file availability, matrix capability matching and global same-name Skill conflicts. Known failures block before case probes or model calls; login remains explicitly unknown offline. Checks are sealed with the run and read without probing the current machine during report/replay. See [Agent environment preflight](docs/eval-agent-preflight.md).
|
|
122
|
+
|
|
123
|
+
List and inspect cases, then preview an edit or removal. `--yes` applies a validated manifest change with a backup; removal preserves the case files. Select a smaller paired eval, trigger run or baseline calibration using repeated `--task`, or `taskIds` in a paired JSON request. IDs and order are frozen, budgets count only selected cases, and small samples remain indicative. See [case management](docs/case-management.md).
|
|
120
124
|
|
|
121
125
|
```bash
|
|
122
126
|
node dist/cli.js bench list my-bench --json
|
|
@@ -165,6 +169,10 @@ Requests can also pin `executorTimeoutSeconds` (default 600) for both versions.
|
|
|
165
169
|
|
|
166
170
|
Available in 0.10.0: optional `spendingBudget` sets five absolute batch stop lines. Reaching a line or losing complete final usage stops subsequent calls and retains spending; an in-flight call may overshoot. See the [guard contract](docs/eval-component.md#input-and-execution).
|
|
167
171
|
|
|
172
|
+
Version 0.11.0 unifies ordinary paired/trigger eval planning and paired Agent request plans. Ordinary eval also accepts `--json`, `--spending-budget <file>`, `--executor-timeout-seconds`, `--runs-root` and `--run-group`, plus `--pair-order` for paired runs; JSON execution requires the preview hash. Requests can set `baselineSkill: null` for no Skill installed by the harness in baseline, matching ordinary installed eval without `--baseline-skill`. This measures installation benefit but cannot authorize revision adoption. See [shared settings and confirmation](docs/eval-planning.md).
|
|
173
|
+
|
|
174
|
+
The same source gives baseline calibration and trigger runs JSON previews, frozen task selection, call/spending limits and per-call deadlines. Preview runs no verifier, oracle or agent; hard case/environment failures block live execution. JSON execution needs an explicit fresh group and the exact preview hash (`plan.planSha256` for calibration, `plan.sha256` for eval). Calibration measures baseline difficulty; trigger measures discovery. Neither establishes paired Skill benefit or authorizes adoption.
|
|
175
|
+
|
|
168
176
|
Failed Codex JSON calls can retain identity-bound partial usage from local numeric counters. Private transcript bodies stay out of exports, and partial usage never satisfies the final-cost or adoption gates.
|
|
169
177
|
|
|
170
178
|
```bash
|
|
@@ -203,9 +211,13 @@ node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
|
|
|
203
211
|
|
|
204
212
|
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
213
|
|
|
214
|
+
Version 0.11.0 also reads calibration directories/`_calibration.json` and trigger manifests in either format. Completed calibration stays completed and shows baseline difficulty; trigger reports show recall, false-trigger rate, precision, F1 and detection coverage. New sealed single-arm runs support native audit, offline delivery replay and portable export; standalone historical summaries stay unverified. These separate reports cannot authorize adoption or use paired acceptance-policy options. See [report types](docs/evaluation-reports.md#calibration-and-trigger-reports-source-after-npm-0101).
|
|
215
|
+
|
|
206
216
|
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).
|
|
207
217
|
|
|
208
|
-
|
|
218
|
+
Version 0.11.0 records `invocationCosts` for primary Agent, judge and total spending, preserving failed/partial/unknown usage. Optional judge spending shares the batch stop lines; an explicitly enabled API judge with missing credentials fails instead of silently turning off. Historical missing judge receipts stay unknown. See [cost accounting](docs/eval-costs.md).
|
|
219
|
+
|
|
220
|
+
That source can export a supported sealed native paired, calibration or trigger run, including new paired runs with judge receipts, as a portable directory with original receipts, matching inputs, pinned compiled CLI, checksums and a replay entry point. Export previews by default; missing inputs, required receipt/runtime support 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).
|
|
209
221
|
|
|
210
222
|
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
223
|
|
|
@@ -300,7 +312,7 @@ Not affiliated with Anthropic, OpenAI, Moonshot AI, or any agent vendor. Evaluat
|
|
|
300
312
|
- [x] Optional `triggerClass` (`explicit`, `implicit`, `contextual`) on positive tasks. Unlabeled tasks stay in the pooled recall.
|
|
301
313
|
- [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.
|
|
302
314
|
- [ ] 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.
|
|
303
|
-
- [x] npm publication (`skillfit@0.10.
|
|
315
|
+
- [x] npm publication (`skillfit@0.10.1`), with [verified CLI/OIDC publication and registry installation](docs/releases/0.10.1-verification.json). `npx skillfit` installs that release. Clone, `npm ci`, and `npm run build` remain valid.
|
|
304
316
|
- [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.
|
|
305
317
|
- [ ] Cursor / Gemini CLI / OpenCode adapters
|
|
306
318
|
- [x] Streamable HTTP MCP preflight (`mcp check` transport `http`). It does not call a tool.
|
package/README.zh-CN.md
CHANGED
|
@@ -65,8 +65,8 @@ F1 : 0.20 (no CI: a harmonic mean of two proportions has no clo
|
|
|
65
65
|
## 安装
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
|
-
npx skillfit@0.
|
|
69
|
-
npx skillfit@0.
|
|
68
|
+
npx skillfit@0.11.0 --help
|
|
69
|
+
npx skillfit@0.11.0 doctor
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
`npx skillfit` 安装的是已发布的版本,需要 Node.js 22 或更新。下面的快速开始用的是源码检出,这样才能跑本仓库自带的 bench。`npm run build` 之后,`node dist/cli.js` 是这份检出的 CLI。`skillfit` 是从 npm 装上的命令。
|
|
@@ -114,9 +114,13 @@ node dist/cli.js eval skills/skillfit --bench my-bench --agent codex --input wor
|
|
|
114
114
|
|
|
115
115
|
这是用于教格式的合成案例,不是 Skill 基准。在衡量收益前,把初始文件、任务请求、评分器和参考修复一起替换为你的真实任务。预览会显示计划调用两次,实际一次也不会启动。不传 `--kind`(或用 `--kind output`)仍生成原来的回复评分模板。已有失败可用 `bench add --freeze` 固定,维护者修复可用 `--from-commit` 导入;参见[编写指南](docs/bench-authoring.md)。
|
|
116
116
|
|
|
117
|
-
Agent 可以用 `bench check --json` 读取带版本的校验标识、任务 ID、位置、失败原因、处理建议和限长的评分器证据。标准输出只有 JSON
|
|
117
|
+
Agent 可以用 `bench check --json` 读取带版本的校验标识、任务 ID、位置、失败原因、处理建议和限长的评分器证据。标准输出只有 JSON,退出码区分通过、校验失败和执行错误。不加 `--calibrate` 时,它仍是离线完整性校验,警告仍需检查。0.11.0还支持独立的 `--calibrate --json --dry-run` 计划;JSON 正式执行前必须明确确认计划哈希。参见 [JSON 契约](docs/bench-check-json.md)。
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
0.11.0支持给校验器和参考解命令的参数加引号,包括含空格的脚本路径。已识别的评分器加载/运行异常及显式基础设施错误消息会阻止离线校验通过,或记为不参与评分的评测错误,同时保留 Agent 成本。正常任务失败和断言失败仍参与评分。详见[校验命令与错误报告](docs/verifier-contract.md)。
|
|
120
|
+
|
|
121
|
+
0.11.0 还会在 eval 和基线校准的预览及开跑前检查 Agent 环境:CLI 文件是否可用、能力是否与矩阵声明匹配,以及全局是否存在同名 Skill。已知失败会在 case 探测或模型调用前拦住;登录状态明确标为离线未知。检查结果随运行封存,报告和重放读取当时记录,不探测当前机器。详见 [Agent 环境自检](docs/eval-agent-preflight.md)。
|
|
122
|
+
|
|
123
|
+
可以列出和查看 case,再预览编辑或移除操作。加 `--yes` 才会备份并应用通过校验的清单变更;移除会保留 case 文件。配对评估、触发率测试和基线校准都可重复 `--task` 只选择部分 case;配对 JSON 请求用 `taskIds`。所选 ID 和顺序会固定到计划中,预算只计算所选 case,小样本仍只作参考。参见 [case 管理](docs/case-management.md)。
|
|
120
124
|
|
|
121
125
|
```bash
|
|
122
126
|
node dist/cli.js bench list my-bench --json
|
|
@@ -162,6 +166,10 @@ node dist/cli.js eval ./skill-new --baseline-skill ./skill-old --mode installed
|
|
|
162
166
|
|
|
163
167
|
0.10.0 已包含可选 `spendingBudget`,设置五项整批预算停止线。触线或缺失完整最终用量时停止后续调用并保留花费;正在运行的一次仍可能越线。详见[预算检查契约](docs/eval-component.md#input-and-execution)。
|
|
164
168
|
|
|
169
|
+
0.11.0统一了普通配对/触发率 eval 和配对 Agent 请求的计划生成。普通 eval 也支持 `--json`、`--spending-budget <file>`、`--executor-timeout-seconds`、`--runs-root` 和 `--run-group`,配对实验另可设置 `--pair-order`;JSON 执行必须确认预览指纹。请求可用 `baselineSkill: null` 表示 baseline 不由 harness 安装 Skill,与普通 installed eval 省略 `--baseline-skill` 对应。这能测量安装收益,但不能授权采用某个修订版本。详见[统一设置与确认流程](docs/eval-planning.md)。
|
|
170
|
+
|
|
171
|
+
0.11.0 还为基线校准和触发率测试提供 JSON 预览、固定任务选择、调用/消耗上限及每次调用的超时。预览不执行评分器、参考解或 Agent;case 或环境硬失败会阻止正式开跑。JSON 执行必须指定新的批次名,并提交准确的预览哈希(校准用 `plan.planSha256`,eval 用 `plan.sha256`)。校准测基线难度,触发率测试测发现能力,两者都不能证明配对的 Skill 收益或授权采用。
|
|
172
|
+
|
|
165
173
|
失败的 Codex JSON 调用可从本地数值计数器保留身份匹配的部分用量。导出不包含私有会话正文;部分用量仍不能满足最终成本覆盖或采用门槛。
|
|
166
174
|
|
|
167
175
|
```bash
|
|
@@ -200,9 +208,13 @@ node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
|
|
|
200
208
|
|
|
201
209
|
0.10.1 中,普通报告和 JSON 都接受同样的 manifest、原生运行目录或复现包,包括中止和未完成批次。两者都会核查已存证据,并把采用决定与质量判定分开解释。`--replay`、`--records` 和 `--policy` 两种格式都能用;成功生成报告不代表获准升级。参见[报告输入和状态](docs/evaluation-reports.md)。
|
|
202
210
|
|
|
211
|
+
0.11.0还支持用两种格式读取校准目录/`_calibration.json` 和触发率 manifest。已完成的校准保持完成状态,展示基线难度;触发率报告展示召回率、误触发率、精确率、F1 和检测覆盖情况。新封存的单组运行支持原生证据审计、离线交付结果重放和便携导出;独立的历史摘要仍未验证。这两种报告不能授权采用,也不能使用配对采用策略选项。参见[报告类型](docs/evaluation-reports.md#calibration-and-trigger-reports-source-after-npm-0101)。
|
|
212
|
+
|
|
203
213
|
新报告分别列出缓存输入、未缓存输入、输出和耗时,并把失败运行的消耗计入每次成功任务的成本。报告同时展示存活配对和全部 agent 调用;超时导致的用量不完整或缺失会单独标记,不会当作零。Chat completions API 明确返回的缓存输入计数(包括零)会被保留;缺失或非法值仍记为未知。旧 manifest 会显示这些字段未记录。详见[成本统计](docs/eval-costs.md)。
|
|
204
214
|
|
|
205
|
-
|
|
215
|
+
0.11.0用 `invocationCosts` 分别记录 Agent、裁判和合计消耗,保留失败、部分和未知用量。可选裁判的消耗计入同一批次停线;显式启用 API 裁判却缺少凭据会报错,不会静默关闭。历史缺失的裁判记录仍标未知。参见[成本统计](docs/eval-costs.md)。
|
|
216
|
+
|
|
217
|
+
同一份源码可把受支持且已封存的原生配对、校准和触发率实验(包括带有新裁判记录的配对实验)导出为独立目录,包含原始记录、匹配的输入、当时的编译版 CLI、校验清单和重放入口。默认只预览;缺输入、缺少必需的调用记录/原始运行时支持或目标目录已存在就停止。整个目录可搬到另一台机器,重放不调用模型,保留中止状态和未知成本,也不能授权升级。分享前检查项目数据,参见[可搬走的复现包](docs/replay-packages.md)。
|
|
206
218
|
|
|
207
219
|
0.10.1 会在调用前封存输入副本:原始 Skill、bench 或请求之后被修改、删除,也不影响导出和重放。计划会记录快照校验信息、本地复制耗时和存储量;已声明的快照损坏就拒绝使用。历史记录仍需找回匹配的原始输入。参见[评测输入封存](docs/evaluation-input-snapshots.md)。
|
|
208
220
|
|
|
@@ -297,7 +309,7 @@ node ./personal-codex/setup.mjs --yes
|
|
|
297
309
|
- [x] 正例任务可选 `triggerClass`(`explicit`、`implicit`、`contextual`)。没标类别的任务仍只进汇总召回率。
|
|
298
310
|
- [x] `--compete-installed` 把其他用户级 Skill 复制进 trigger 试验。矩阵目录之外的系统 Skill 和插件不会被复制。`installed` 把「读了长正文」和任务结果分开报告;这次读取不是 trigger 召回率。
|
|
299
311
|
- [ ] 安装建议。2026 年 7 月的 8 个 Skill 实验没有可靠的任务质量增益。67 个 Skill 目录和 13 个入门套装都没有作为一组被评过。
|
|
300
|
-
- [x] 已发布到 npm(`skillfit@0.10.
|
|
312
|
+
- [x] 已发布到 npm(`skillfit@0.10.1`),并通过 [CLI/OIDC 发布与注册表安装验收](docs/releases/0.10.1-verification.json)。`npx skillfit` 安装的是这个版本。克隆后 `npm ci` 再 `npm run build` 仍然可用。
|
|
301
313
|
- [x] 社区 bench 与 evidence 提交。bench 放在 `benches/contrib`;证据用 Evidence submission issue 模板。CI 只跑离线检查,不调用 agent。
|
|
302
314
|
- [ ] Cursor / Gemini CLI / OpenCode 适配器
|
|
303
315
|
- [x] Streamable HTTP MCP 预检(`mcp check` 的 `http` 传输)。不会调用工具。
|
package/benches/README.md
CHANGED
|
@@ -90,9 +90,9 @@ All paths must stay inside the bench directory.
|
|
|
90
90
|
|
|
91
91
|
The verifier is the heart of a bench. It must be **deterministic**: same run directory in, same verdict out — no network, no clocks, no randomness.
|
|
92
92
|
|
|
93
|
-
- Invocation: `<verifier command> <absolute run directory>`, working directory = bench root. The command is
|
|
93
|
+
- Invocation: `<verifier command> <absolute run directory>`, working directory = bench root. The command is spawned **without a shell**, so its first token must be an executable the operating system can start directly: `node verifiers/x.mjs` works, while a bare `npm test` or a `.cmd`/`.bat` wrapper does not (`ENOENT` / `EINVAL` on Windows). Source after npm 0.10.1 groups quoted arguments, so `node "verifiers/check answer.mjs"` works; malformed quoting fails before execution. No shell expansion runs. See [command and error contract](../docs/verifier-contract.md). If the verdict genuinely comes from a shell command, use `bench add --freeze --verifier-cmd "<cmd>"`, which writes a generated `verifiers/<task-id>.mjs` that node runs and that runs your command under a shell inside. Keeping the harness's own spawn shell-free is deliberate, not an oversight — benches are contributed by third parties, and a shell here would turn `"verifier": "node v.mjs & curl …"` in somebody else's `bench.json` into code execution on your machine.
|
|
94
94
|
- A verifier that produces **no exit code at all** — unspawnable, or killed by the 2-minute timeout — has graded nothing, so it is never read as a verdict: `bench check` fails the task and names the cause, and `eval` excludes that trial *and its paired arm* from the rates rather than scoring a fabricated failure. Without that, a broken verifier command would look like a 0% pass rate in both arms and get reported as "bench too hard".
|
|
95
|
-
- **
|
|
95
|
+
- **For a functioning verifier, exit code 0 = pass, anything else = fail.** Source after npm 0.10.1 separately excludes recognized grader infrastructure errors, including bench-owned Node uncaught exceptions and explicit `skillfit.verifier-error` JSON messages. They cannot satisfy NOP gates or score a model failure merely by exiting nonzero. Candidate failures/assertions retain normal grading; agent spending stays recorded. See [the contract and custom-runtime error channel](../docs/verifier-contract.md).
|
|
96
96
|
- Print a one-line JSON summary as the **last stdout line**. The harness parses it (tolerating surrounding noise) and saves the raw output to `_verifier.txt`:
|
|
97
97
|
- `passed` (boolean) — informational; the exit code is authoritative, and a disagreement is flagged as a warning.
|
|
98
98
|
- `checks` (optional) — `[{"name": "discount-boundary", "pass": true}, ...]`: the acceptance criteria decomposed into 2–8 named programmatic checks. The trial **score** is the fraction of checks passed; scores feed the per-facet table and the paired-bootstrap Δscore CI in the report, letting a bench resolve effects binary pass/fail cannot at small sample sizes. Checks never flip a verdict. Keep them deterministic and outcome-focused. `bench check` reads the count back out of your verifier and warns outside 2–8: one check is binary pass/fail in facet costume and carries none of the graded signal, while a dozen lets whatever those checks happen to measure dominate the score.
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { parseArgs } from 'node:util';
|
|
3
|
-
import {
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
import { runBenchAdd, runBenchCheck, runBenchInit, prepareBenchCalibration, runBenchCalibration } from './commands/bench.js';
|
|
4
5
|
import { benchCheckError, benchCheckJson } from './commands/bench-check-report.js';
|
|
5
6
|
import { inspectBench, manageBench } from './commands/bench-manage.js';
|
|
6
7
|
import { exportEvaluation } from './commands/eval-export.js';
|
|
7
8
|
import { runBundleExport } from './commands/bundle.js';
|
|
8
9
|
import { runDoctor } from './commands/doctor.js';
|
|
9
|
-
import { DEFAULT_EVAL_TRIALS
|
|
10
|
+
import { DEFAULT_EVAL_TRIALS } from './commands/eval.js';
|
|
11
|
+
import { runEvalCli } from './commands/eval-cli.js';
|
|
12
|
+
import { readComponentJson } from './harness/eval-contract.js';
|
|
13
|
+
import { parseSpendingBudget } from './harness/eval-budget.js';
|
|
10
14
|
import { runEvalReport } from './commands/eval-report.js';
|
|
11
|
-
import { componentError,
|
|
15
|
+
import { componentError, runEvalComponent } from './commands/eval-component.js';
|
|
16
|
+
import { readEvaluationReport } from './commands/evaluation-report.js';
|
|
12
17
|
import { runInstall } from './commands/install.js';
|
|
13
18
|
import { runMcpCheck } from './commands/mcp.js';
|
|
14
19
|
import { runReport } from './commands/report.js';
|
|
@@ -19,8 +24,8 @@ const USAGE = `skillfit ${VERSION} — evidence-driven configuration for AI codi
|
|
|
19
24
|
Usage:
|
|
20
25
|
skillfit doctor [--agent <id>] Inspect current agent configuration health
|
|
21
26
|
skillfit report [--agent <id>] [--json] Skill usage receipts from local session history (read-only)
|
|
22
|
-
skillfit report eval <
|
|
23
|
-
skillfit report eval <
|
|
27
|
+
skillfit report eval <summary-or-run-dir> Read paired, calibration or trigger reports (read-only)
|
|
28
|
+
skillfit report eval <summary-or-run-dir> --json Return a typed saved-evidence report for an Agent
|
|
24
29
|
skillfit report eval <run-dir> --export <new-dir> Plan a portable offline replay package
|
|
25
30
|
skillfit eval --request <request.json> --dry-run Return a pinned JSON plan without calls
|
|
26
31
|
skillfit eval --request <request.json> --plan-sha <sha256> Run that plan and return JSON evidence
|
|
@@ -41,21 +46,26 @@ Usage:
|
|
|
41
46
|
|
|
42
47
|
Options:
|
|
43
48
|
--agent <id> Target agent: claude-code | codex | kimi-code (default: all detected)
|
|
44
|
-
--judge-agent <id> Drive
|
|
49
|
+
--judge-agent <id> Drive a paired eval's blind judge (prefer a different family than --agent)
|
|
45
50
|
--mode <mode> Eval mode: inject (default) | installed (paired complete Skill) | trigger (single arm)
|
|
46
51
|
--baseline-skill <path> With --mode installed, compare a previous Skill version against the target
|
|
47
52
|
--request <path> Version 1 Skill revision request (JSON output; excludes positional eval options)
|
|
48
|
-
--plan-sha <hash> Confirm
|
|
49
|
-
--json Machine output for bench check/list/show/edit/remove, report, and
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
--
|
|
53
|
+
--plan-sha <hash> Confirm an eval/calibration dry-run plan (also needs --run-group)
|
|
54
|
+
--json Machine output for bench check/list/show/edit/remove, report, eval and calibration
|
|
55
|
+
--spending-budget <file> Eval/calibration: input, cachedInput, uncachedInput, output, durationSeconds stop lines
|
|
56
|
+
--executor-timeout-seconds <n> Eval/calibration: executor deadline (integer 1–3600)
|
|
57
|
+
--pair-order <order> Paired eval: baseline-first (default) | balanced
|
|
58
|
+
--runs-root <dir> Eval/calibration output parent (default: ./runs)
|
|
59
|
+
--run-group <name> Fresh eval group; reuse its name when confirming a preview
|
|
60
|
+
--policy <path> With paired report eval, assess against a policy (post-hoc changes cannot authorize adoption)
|
|
61
|
+
--records <dir> With paired report eval, use native evidence from this run directory
|
|
62
|
+
--replay With report eval, audit receipts and regrade cloned deliveries; never call a model
|
|
53
63
|
--export <dir> With report eval, plan a portable package; --yes writes a fresh destination
|
|
54
64
|
--input-root <label=path> With --export, recover pinned inputs from a matching copy (repeatable)
|
|
55
65
|
--compete-installed With --mode trigger, copy other user-level Skills into each trial so recall is not an upper bound
|
|
56
66
|
--input <mode> Paired eval or baseline calibration: snapshot (default) | workspace (CLI only)
|
|
57
67
|
--bench <path> Bench directory for eval (default: bundled benches)
|
|
58
|
-
--task <id> With eval, select cases (repeatable, manifest order); requests use taskIds
|
|
68
|
+
--task <id> With eval/calibration, select cases (repeatable, manifest order); requests use taskIds
|
|
59
69
|
--trials <n> Repetitions per condition for eval (integer 1–20; default: ${DEFAULT_EVAL_TRIALS})
|
|
60
70
|
--max-calls <n> Call ceiling for eval / bench check --calibrate (includes enabled judges)
|
|
61
71
|
Also controls baseline calibration repetitions
|
|
@@ -112,6 +122,11 @@ const CLI_OPTIONS = {
|
|
|
112
122
|
'baseline-skill': { type: 'string' },
|
|
113
123
|
request: { type: 'string' },
|
|
114
124
|
'plan-sha': { type: 'string' },
|
|
125
|
+
'spending-budget': { type: 'string' },
|
|
126
|
+
'executor-timeout-seconds': { type: 'string' },
|
|
127
|
+
'pair-order': { type: 'string' },
|
|
128
|
+
'runs-root': { type: 'string' },
|
|
129
|
+
'run-group': { type: 'string' },
|
|
115
130
|
policy: { type: 'string' },
|
|
116
131
|
records: { type: 'string' },
|
|
117
132
|
replay: { type: 'boolean', default: false },
|
|
@@ -192,14 +207,15 @@ async function main() {
|
|
|
192
207
|
console.log(USAGE);
|
|
193
208
|
return;
|
|
194
209
|
}
|
|
210
|
+
const calibrationCommand = command === 'bench' && positionals[1] === 'check' && values.calibrate;
|
|
195
211
|
if (values['baseline-skill'] !== undefined && command !== 'eval') {
|
|
196
212
|
throw new Error('--baseline-skill applies only to eval --mode installed.');
|
|
197
213
|
}
|
|
198
214
|
if (values.kind !== undefined && !(command === 'bench' && positionals[1] === 'init')) {
|
|
199
215
|
throw new Error('--kind applies only to bench init.');
|
|
200
216
|
}
|
|
201
|
-
if (values.task !== undefined && command !== 'eval' && !(command === 'bench' && positionals[1] === 'add')) {
|
|
202
|
-
throw new Error('--task applies only to eval or bench add.');
|
|
217
|
+
if (values.task !== undefined && command !== 'eval' && !calibrationCommand && !(command === 'bench' && positionals[1] === 'add')) {
|
|
218
|
+
throw new Error('--task applies only to eval, calibration or bench add.');
|
|
203
219
|
}
|
|
204
220
|
if ((values.set || values.unset) && !(command === 'bench' && positionals[1] === 'edit'))
|
|
205
221
|
throw new Error('--set and --unset apply only to bench edit.');
|
|
@@ -213,8 +229,18 @@ async function main() {
|
|
|
213
229
|
throw new Error('bench add requires exactly one --task.');
|
|
214
230
|
if (values.request !== undefined && command !== 'eval')
|
|
215
231
|
throw new Error('--request applies only to eval.');
|
|
216
|
-
if (values['plan-sha'] !== undefined && (command !== 'eval'
|
|
217
|
-
throw new Error('--plan-sha requires a non-dry-run eval
|
|
232
|
+
if (values['plan-sha'] !== undefined && ((command !== 'eval' && !calibrationCommand) || values['dry-run']))
|
|
233
|
+
throw new Error('--plan-sha requires a non-dry-run eval or calibration.');
|
|
234
|
+
const evalSettings = ['spending-budget', 'executor-timeout-seconds', 'pair-order', 'runs-root', 'run-group'];
|
|
235
|
+
if (command !== 'eval' && !calibrationCommand && evalSettings.some(key => values[key] !== undefined))
|
|
236
|
+
throw new Error('Budget, timeout and output settings apply only to eval or calibration.');
|
|
237
|
+
if (calibrationCommand && values['pair-order'] !== undefined)
|
|
238
|
+
throw new Error('--pair-order requires a paired eval.');
|
|
239
|
+
if (calibrationCommand && (values.mode !== undefined || values['judge-agent'] !== undefined || values['baseline-skill'] !== undefined || values['compete-installed'] || values.bench !== undefined)) {
|
|
240
|
+
throw new Error('Calibration is single-arm: --mode, --judge-agent, --baseline-skill, --compete-installed and --bench do not apply; supply the bench directory after check.');
|
|
241
|
+
}
|
|
242
|
+
if (values['runs-root'] !== undefined && (!values['runs-root'].trim() || values['runs-root'].includes('\0')))
|
|
243
|
+
throw new Error('--runs-root must be a non-empty path.');
|
|
218
244
|
if ((values.policy !== undefined || values.records !== undefined || values.replay) && !(command === 'report' && positionals[1] === 'eval')) {
|
|
219
245
|
throw new Error('--policy, --records and --replay require report eval.');
|
|
220
246
|
}
|
|
@@ -249,8 +275,8 @@ async function main() {
|
|
|
249
275
|
if (positionals[1] === 'eval') {
|
|
250
276
|
if (!positionals[2]) {
|
|
251
277
|
if (values.json)
|
|
252
|
-
throw new Error('report eval --json requires a
|
|
253
|
-
console.error('Usage: skillfit report eval <
|
|
278
|
+
throw new Error('report eval --json requires a saved summary or native run directory.');
|
|
279
|
+
console.error('Usage: skillfit report eval <summary-or-run-dir>');
|
|
254
280
|
process.exitCode = 2;
|
|
255
281
|
return;
|
|
256
282
|
}
|
|
@@ -262,7 +288,7 @@ async function main() {
|
|
|
262
288
|
return;
|
|
263
289
|
}
|
|
264
290
|
if (values.json)
|
|
265
|
-
console.log(JSON.stringify(await
|
|
291
|
+
console.log(JSON.stringify(await readEvaluationReport(positionals[2], {
|
|
266
292
|
policyPath: values.policy, recordsPath: values.records, replay: values.replay, benchDir: values.bench,
|
|
267
293
|
}), null, 2));
|
|
268
294
|
else
|
|
@@ -275,7 +301,7 @@ async function main() {
|
|
|
275
301
|
return;
|
|
276
302
|
case 'eval': {
|
|
277
303
|
if (values.request !== undefined) {
|
|
278
|
-
if (positionals.length !== 1 || ['agent', 'mode', 'baseline-skill', 'bench', 'task', 'trials', 'max-calls', 'input', 'judge-agent'].some(key => values[key] !== undefined) || values['compete-installed']) {
|
|
304
|
+
if (positionals.length !== 1 || ['agent', 'mode', 'baseline-skill', 'bench', 'task', 'trials', 'max-calls', 'input', 'judge-agent', ...evalSettings].some(key => values[key] !== undefined) || values['compete-installed']) {
|
|
279
305
|
throw new Error('--request cannot be combined with a target or positional eval settings; put settings in the request.');
|
|
280
306
|
}
|
|
281
307
|
const result = await runEvalComponent(values.request, { dryRun: values['dry-run'], expectedPlanSha256: values['plan-sha'], log: line => console.error(line) });
|
|
@@ -284,33 +310,57 @@ async function main() {
|
|
|
284
310
|
process.exitCode = failureExitCode(2);
|
|
285
311
|
return;
|
|
286
312
|
}
|
|
287
|
-
if (values
|
|
288
|
-
throw new Error('eval --
|
|
313
|
+
if (values['plan-sha'] !== undefined && !values['run-group'])
|
|
314
|
+
throw new Error('Positional eval --plan-sha requires --run-group from the dry-run plan.');
|
|
315
|
+
if (values.json && !values['dry-run'] && values['plan-sha'] === undefined)
|
|
316
|
+
throw new Error('JSON eval execution requires --plan-sha from a dry-run and --run-group; no calls started.');
|
|
289
317
|
const skillPath = positionals[1];
|
|
290
318
|
if (!skillPath) {
|
|
319
|
+
if (values.json)
|
|
320
|
+
throw new Error('Usage: skillfit eval <target-path> [options]');
|
|
291
321
|
console.error('Usage: skillfit eval <target-path> [--bench <path>] [--trials <n>] [--agent <id>] [--mode <mode>]');
|
|
292
322
|
process.exitCode = 2;
|
|
293
323
|
return;
|
|
294
324
|
}
|
|
295
325
|
const mode = values.mode ?? 'inject';
|
|
296
326
|
if (mode !== 'inject' && mode !== 'installed' && mode !== 'trigger') {
|
|
327
|
+
if (values.json)
|
|
328
|
+
throw new Error(`Unknown --mode: ${mode} (expected "inject", "installed" or "trigger")`);
|
|
297
329
|
console.error(`Unknown --mode: ${mode} (expected "inject", "installed" or "trigger")`);
|
|
298
330
|
process.exitCode = 2;
|
|
299
331
|
return;
|
|
300
332
|
}
|
|
301
|
-
|
|
333
|
+
if (values['runs-root'] !== undefined && (!values['runs-root'].trim() || values['runs-root'].includes('\0')))
|
|
334
|
+
throw new Error('--runs-root must be a non-empty path.');
|
|
335
|
+
const spendingBudget = values['spending-budget'] === undefined ? undefined : parseSpendingBudget(readComponentJson(resolve(values['spending-budget'])).value);
|
|
336
|
+
const options = {
|
|
302
337
|
...common,
|
|
303
338
|
skillPath,
|
|
304
339
|
baselineSkillPath: values['baseline-skill'],
|
|
305
340
|
bench: values.bench,
|
|
306
341
|
taskIds: values.task,
|
|
307
|
-
mode,
|
|
342
|
+
mode: mode,
|
|
308
343
|
inputMode,
|
|
309
344
|
judgeAgent: values['judge-agent'],
|
|
310
345
|
competeInstalled: values['compete-installed'],
|
|
311
346
|
maxCalls,
|
|
312
347
|
trials,
|
|
313
|
-
|
|
348
|
+
spendingBudget,
|
|
349
|
+
executorTimeoutSeconds: values['executor-timeout-seconds'] === undefined ? undefined : Number(values['executor-timeout-seconds']),
|
|
350
|
+
pairOrder: values['pair-order'],
|
|
351
|
+
runsRoot: values['runs-root'] === undefined ? undefined : resolve(values['runs-root']),
|
|
352
|
+
runGroup: values['run-group'],
|
|
353
|
+
log: values.json ? (line) => console.error(line) : (line) => console.log(line),
|
|
354
|
+
};
|
|
355
|
+
{
|
|
356
|
+
const result = await runEvalCli(options, values['plan-sha']);
|
|
357
|
+
if (values.json)
|
|
358
|
+
console.log(JSON.stringify(result, null, 2));
|
|
359
|
+
else if ('executionError' in result)
|
|
360
|
+
console.error(result.executionError);
|
|
361
|
+
if (result.status === 'stopped')
|
|
362
|
+
process.exitCode = failureExitCode(2);
|
|
363
|
+
}
|
|
314
364
|
return;
|
|
315
365
|
}
|
|
316
366
|
case 'mcp': {
|
|
@@ -395,8 +445,57 @@ async function main() {
|
|
|
395
445
|
return;
|
|
396
446
|
}
|
|
397
447
|
if (subcommand === 'check') {
|
|
398
|
-
if (values.
|
|
399
|
-
|
|
448
|
+
if (values.calibrate) {
|
|
449
|
+
if (values['plan-sha'] !== undefined && !values['run-group'])
|
|
450
|
+
throw new Error('Calibration --plan-sha requires --run-group from the preview.');
|
|
451
|
+
if (values.json && !values['dry-run'] && !values['plan-sha'])
|
|
452
|
+
throw new Error('JSON calibration execution requires --plan-sha and --run-group; no calls started.');
|
|
453
|
+
const calibrate = { agent: values.agent, inputMode: inputMode, maxCalls, trials,
|
|
454
|
+
dryRun: values['dry-run'] ?? false,
|
|
455
|
+
runsRoot: values['runs-root'] === undefined ? undefined : resolve(values['runs-root']),
|
|
456
|
+
runGroup: values['run-group'],
|
|
457
|
+
executorTimeoutSeconds: values['executor-timeout-seconds'] === undefined ? undefined : Number(values['executor-timeout-seconds']),
|
|
458
|
+
spendingBudget: values['spending-budget'] === undefined ? undefined : parseSpendingBudget(readComponentJson(resolve(values['spending-budget'])).value),
|
|
459
|
+
reviewedPlanSha256: values['plan-sha'] };
|
|
460
|
+
const plan = prepareBenchCalibration({ dir: positionals[2], taskIds: values.task, calibrate });
|
|
461
|
+
if (values['dry-run']) {
|
|
462
|
+
if (values.json)
|
|
463
|
+
console.log(JSON.stringify({ schemaVersion: 1, kind: 'skillfit.calibration-result', status: 'planned', plan,
|
|
464
|
+
acceptance: { decision: 'inconclusive', eligibleForUpgrade: false, automaticUpgrade: false } }, null, 2));
|
|
465
|
+
else {
|
|
466
|
+
console.log(`calibration executor: ${plan.executor?.detail ?? plan.executor?.model ?? 'unresolved'}`);
|
|
467
|
+
console.log(`calibration plan: ${plan.bench.taskIds.length} task(s) × ${plan.trials} baseline run(s), input ${plan.inputMode}; ${plan.plannedCalls} calls, ceiling ${plan.maxCalls}`);
|
|
468
|
+
console.log(`Agent environment: ${plan.agentPreflight.status}; login remains offline unknown`);
|
|
469
|
+
console.log(`Executor deadline: ${plan.executorTimeoutSeconds}s; output ${plan.outputDir}`);
|
|
470
|
+
if (plan.spendingBudget)
|
|
471
|
+
console.log(`Spending stop lines: ${JSON.stringify(plan.spendingBudget)}`);
|
|
472
|
+
console.log(`Plan SHA: ${plan.planSha256}`);
|
|
473
|
+
console.log('Dry run: no verifier, oracle or agent started; nothing written.');
|
|
474
|
+
}
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
try {
|
|
478
|
+
const report = await runBenchCalibration({ dir: positionals[2], taskIds: values.task,
|
|
479
|
+
log: values.json ? line => console.error(line) : undefined,
|
|
480
|
+
calibrate: { ...calibrate, runsRoot: plan.runsRoot, runGroup: plan.runGroup, reviewedPlanSha256: plan.planSha256 } });
|
|
481
|
+
if (values.json)
|
|
482
|
+
console.log(JSON.stringify(await readEvaluationReport(plan.outputDir), null, 2));
|
|
483
|
+
if (report.failures > 0)
|
|
484
|
+
process.exitCode = failureExitCode(1);
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
const { existsSync } = await import('node:fs');
|
|
488
|
+
if (!existsSync(resolve(plan.outputDir, '_plan.json')))
|
|
489
|
+
throw error;
|
|
490
|
+
const report = await readEvaluationReport(plan.outputDir);
|
|
491
|
+
if (values.json)
|
|
492
|
+
console.log(JSON.stringify({ ...report, executionError: error instanceof Error ? error.message : String(error) }, null, 2));
|
|
493
|
+
else
|
|
494
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
495
|
+
process.exitCode = failureExitCode(2);
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
400
499
|
const report = await runBenchCheck({
|
|
401
500
|
dir: positionals[2],
|
|
402
501
|
log: values.json ? () => { } : undefined,
|
|
@@ -460,6 +559,11 @@ async function main() {
|
|
|
460
559
|
}
|
|
461
560
|
main().catch((err) => {
|
|
462
561
|
const benchCommand = jsonBenchCommand();
|
|
562
|
+
if (benchCommand === 'check' && process.argv.includes('--calibrate')) {
|
|
563
|
+
console.log(JSON.stringify(componentError(err), null, 2));
|
|
564
|
+
process.exitCode = failureExitCode(2);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
463
567
|
if (benchCommand === 'check') {
|
|
464
568
|
console.log(JSON.stringify(benchCheckError(err), null, 2));
|
|
465
569
|
process.exitCode = failureExitCode(2);
|
|
@@ -472,7 +576,7 @@ main().catch((err) => {
|
|
|
472
576
|
return;
|
|
473
577
|
}
|
|
474
578
|
if (process.argv.some(arg => arg === '--request' || arg.startsWith('--request=')) ||
|
|
475
|
-
(process.argv.
|
|
579
|
+
(process.argv.some(arg => arg === '--json' || arg.startsWith('--json=')) && process.argv.includes('eval'))) {
|
|
476
580
|
console.log(JSON.stringify(componentError(err), null, 2));
|
|
477
581
|
process.exitCode = failureExitCode(2);
|
|
478
582
|
return;
|
package/dist/cli.test.js
CHANGED
|
@@ -97,3 +97,97 @@ test('CLI wires the previous Skill into an installed dry-run and rejects single-
|
|
|
97
97
|
assert.equal(unrelated.stdout, '');
|
|
98
98
|
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
99
99
|
});
|
|
100
|
+
test('ordinary JSON/human and Agent request previews expose the same effective installed no-Skill plan', t => {
|
|
101
|
+
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-shared-plan-'));
|
|
102
|
+
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
103
|
+
const skill = join(cwd, 'candidate');
|
|
104
|
+
cpSync(join(PACKAGE_ROOT, 'skills/skillfit'), skill, { recursive: true });
|
|
105
|
+
const bench = join(PACKAGE_ROOT, 'benches/code-review'), task = JSON.parse(readFileSync(join(bench, 'bench.json'), 'utf8')).tasks[0].id;
|
|
106
|
+
const limits = { input: 1000, cachedInput: 1000, uncachedInput: 1000, output: 1000, durationSeconds: 1000 };
|
|
107
|
+
const budget = join(cwd, 'budget.json'), request = join(cwd, 'request.json');
|
|
108
|
+
writeFileSync(budget, JSON.stringify(limits));
|
|
109
|
+
writeFileSync(request, JSON.stringify({ schemaVersion: 1, baselineSkill: null, candidateSkill: skill, bench, taskIds: [task], agent: 'codex',
|
|
110
|
+
purpose: 'development', trials: 1, maxCalls: 2, pairOrder: 'balanced', executorTimeoutSeconds: 17, spendingBudget: limits,
|
|
111
|
+
runsRoot: join(cwd, 'runs'), runGroup: 'shared' }));
|
|
112
|
+
const args = ['eval', skill, '--mode', 'installed', '--bench', bench, '--task', task, '--agent', 'codex', '--trials', '1', '--max-calls', '2',
|
|
113
|
+
'--pair-order', 'balanced', '--executor-timeout-seconds', '17', '--spending-budget', budget, '--runs-root', join(cwd, 'runs'), '--run-group', 'shared', '--dry-run'];
|
|
114
|
+
const env = { ...process.env, SKILLFIT_JUDGE: '0' };
|
|
115
|
+
const ordinary = spawnSync(process.execPath, [CLI, ...args, '--json'], { cwd, env, encoding: 'utf8', timeout: 30_000 });
|
|
116
|
+
const agent = spawnSync(process.execPath, [CLI, 'eval', '--request', request, '--dry-run'], { cwd, env, encoding: 'utf8', timeout: 30_000 });
|
|
117
|
+
const human = spawnSync(process.execPath, [CLI, ...args], { cwd, env, encoding: 'utf8', timeout: 30_000 });
|
|
118
|
+
for (const result of [ordinary, agent, human])
|
|
119
|
+
assert.equal(result.status, 0, result.stderr);
|
|
120
|
+
const plan = JSON.parse(ordinary.stdout).plan, agentPlan = JSON.parse(agent.stdout).plan;
|
|
121
|
+
assert.deepEqual(plan.evaluation, agentPlan.evaluation);
|
|
122
|
+
assert.equal(plan.evaluation.baseline, null);
|
|
123
|
+
assert.deepEqual(plan.evaluation.spendingBudget, limits);
|
|
124
|
+
assert.equal(plan.evaluation.executorTimeoutSeconds, 17);
|
|
125
|
+
assert.equal(agentPlan.request.baselineSkill, null);
|
|
126
|
+
assert.match(human.stdout, /no Skill installed by the harness/);
|
|
127
|
+
assert.ok(human.stdout.includes(plan.sha256));
|
|
128
|
+
assert.match(human.stdout, /Agent deadline: 17s/);
|
|
129
|
+
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
130
|
+
for (const override of [['--executor-timeout-seconds', '18'], ['--spending-budget', budget], ['--run-group', 'other']]) {
|
|
131
|
+
const bad = spawnSync(process.execPath, [CLI, 'eval', '--request', request, '--dry-run', ...override], { cwd, env, encoding: 'utf8' });
|
|
132
|
+
assert.equal(bad.status, 2);
|
|
133
|
+
assert.match(JSON.parse(bad.stdout).error.message, /cannot be combined/);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
test('positional JSON eval rejects unconfirmed execution and invalid new controls without writes or calls', t => {
|
|
137
|
+
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-new-controls-'));
|
|
138
|
+
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
139
|
+
// No target or executor is supplied: even a broken guard cannot dispatch a real model.
|
|
140
|
+
for (const args of [['eval', '--json'], ['eval', '--json', '--plan-sha', 'a'.repeat(64)]]) {
|
|
141
|
+
const result = spawnSync(process.execPath, [CLI, ...args], { cwd, encoding: 'utf8' });
|
|
142
|
+
assert.equal(result.status, 2);
|
|
143
|
+
const error = JSON.parse(result.stdout);
|
|
144
|
+
assert.equal(error.kind, 'skillfit.eval-error');
|
|
145
|
+
assert.match(error.error.message, /plan-sha|run-group/);
|
|
146
|
+
assert.equal(error.acceptance.eligibleForUpgrade, false);
|
|
147
|
+
}
|
|
148
|
+
for (const value of ['0', '3601', '1.5', 'NaN', '2junk']) {
|
|
149
|
+
const result = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--agent', 'codex', '--dry-run', '--json', '--executor-timeout-seconds', value], { cwd, encoding: 'utf8' });
|
|
150
|
+
assert.equal(result.status, 2);
|
|
151
|
+
assert.match(JSON.parse(result.stdout).error.message, /executorTimeoutSeconds/);
|
|
152
|
+
}
|
|
153
|
+
const file = join(cwd, 'budget.json');
|
|
154
|
+
writeFileSync(file, JSON.stringify({ input: 10 }));
|
|
155
|
+
const invalid = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json', '--spending-budget', file], { cwd, encoding: 'utf8' });
|
|
156
|
+
assert.equal(invalid.status, 2);
|
|
157
|
+
assert.match(JSON.parse(invalid.stdout).error.message, /spendingBudget/);
|
|
158
|
+
const unrelated = spawnSync(process.execPath, [CLI, 'doctor', '--executor-timeout-seconds', '17'], { cwd, encoding: 'utf8' });
|
|
159
|
+
assert.equal(unrelated.status, 1);
|
|
160
|
+
assert.match(unrelated.stderr, /apply only to eval/);
|
|
161
|
+
for (const args of [['eval'], [...COMMANDS[0], '--mode', 'invalid'], [...COMMANDS[0], '--runs-root', '']]) {
|
|
162
|
+
const invalid = spawnSync(process.execPath, [CLI, ...args, '--json', '--dry-run'], { cwd, encoding: 'utf8' });
|
|
163
|
+
assert.equal(invalid.status, 2);
|
|
164
|
+
assert.equal(JSON.parse(invalid.stdout).kind, 'skillfit.eval-error');
|
|
165
|
+
}
|
|
166
|
+
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
167
|
+
});
|
|
168
|
+
test('API, trigger and judged paired previews bind deadlines and budgets without starting executors', t => {
|
|
169
|
+
const cwd = mkdtempSync(join(tmpdir(), 'skillfit-cli-api-plan-'));
|
|
170
|
+
t.after(() => rmSync(cwd, { recursive: true, force: true }));
|
|
171
|
+
const env = { ...process.env, SKILLFIT_API_KEY: 'synthetic-dry-run-only', SKILLFIT_API_BASE_URL: 'https://offline.invalid/v1', SKILLFIT_JUDGE: '0' };
|
|
172
|
+
const api = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json', '--executor-timeout-seconds', '9'], { cwd, env, encoding: 'utf8' });
|
|
173
|
+
assert.equal(api.status, 0, api.stderr);
|
|
174
|
+
const plan = JSON.parse(api.stdout).plan.evaluation;
|
|
175
|
+
assert.equal(plan.executor.kind, 'api');
|
|
176
|
+
assert.equal(plan.executorTimeoutSeconds, 9);
|
|
177
|
+
const defaults = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json'], { cwd, env, encoding: 'utf8' });
|
|
178
|
+
assert.equal(defaults.status, 0, defaults.stderr);
|
|
179
|
+
assert.equal(JSON.parse(defaults.stdout).plan.evaluation.executorTimeoutSeconds, 120);
|
|
180
|
+
const trigger = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--agent', 'codex', '--mode', 'trigger', '--dry-run', '--json'], { cwd, env, encoding: 'utf8' });
|
|
181
|
+
assert.equal(trigger.status, 0, trigger.stderr);
|
|
182
|
+
assert.equal(JSON.parse(trigger.stdout).plan.evaluation.mode, 'trigger');
|
|
183
|
+
const file = join(cwd, 'budget.json');
|
|
184
|
+
writeFileSync(file, JSON.stringify({ input: 100, cachedInput: 100, uncachedInput: 100, output: 100, durationSeconds: 100 }));
|
|
185
|
+
for (const flags of [['--mode', 'trigger', '--agent', 'codex'], ['--judge-agent', 'codex', '--agent', 'codex']]) {
|
|
186
|
+
const result = spawnSync(process.execPath, [CLI, ...COMMANDS[0], '--dry-run', '--json', '--spending-budget', file, ...flags], { cwd, env, encoding: 'utf8' });
|
|
187
|
+
assert.equal(result.status, 0, result.stderr);
|
|
188
|
+
const preview = JSON.parse(result.stdout).plan.evaluation;
|
|
189
|
+
assert.deepEqual(preview.spendingBudget, JSON.parse(readFileSync(file, 'utf8')));
|
|
190
|
+
assert.equal(preview.plannedCalls, flags[0] === '--mode' ? 25 : 100);
|
|
191
|
+
}
|
|
192
|
+
assert.equal(existsSync(join(cwd, 'runs')), false);
|
|
193
|
+
});
|