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.
Files changed (51) hide show
  1. package/README.md +10 -2
  2. package/README.zh-CN.md +10 -2
  3. package/dist/cli.js +19 -13
  4. package/dist/commands/bench.js +99 -91
  5. package/dist/commands/eval-component.js +8 -1
  6. package/dist/commands/eval-export.js +32 -6
  7. package/dist/commands/eval-export.test.js +165 -8
  8. package/dist/commands/eval-interruption.test.js +238 -0
  9. package/dist/commands/eval-preflight.js +61 -0
  10. package/dist/commands/eval-preflight.test.js +239 -0
  11. package/dist/commands/eval-report.js +44 -13
  12. package/dist/commands/eval-report.test.js +2 -2
  13. package/dist/commands/eval.js +81 -59
  14. package/dist/harness/eval-audit.js +3 -1
  15. package/dist/harness/eval-budget.test.js +4 -2
  16. package/dist/harness/eval-component.test.js +6 -6
  17. package/dist/harness/executors/api.js +10 -1
  18. package/dist/harness/executors/api.test.js +43 -0
  19. package/dist/harness/executors/cli.js +24 -3
  20. package/dist/harness/experiment-session.js +60 -9
  21. package/dist/harness/experiment-session.test.js +43 -1
  22. package/dist/harness/input-snapshot.js +150 -0
  23. package/dist/harness/interruption.js +48 -0
  24. package/dist/harness/interruption.test.js +31 -0
  25. package/dist/harness/runner.js +53 -15
  26. package/dist/harness/trigger.js +20 -4
  27. package/docs/bench-check-json.md +8 -1
  28. package/docs/eval-case-preflight.md +110 -0
  29. package/docs/eval-component.md +28 -0
  30. package/docs/eval-costs.md +9 -0
  31. package/docs/evaluation-input-snapshots.md +124 -0
  32. package/docs/evaluation-interruption.md +89 -0
  33. package/docs/evaluation-reports.md +49 -0
  34. package/docs/experiment-workflow.md +9 -2
  35. package/docs/first-real-eval.md +5 -2
  36. package/docs/growth-roadmap-2026-10.md +15 -10
  37. package/docs/metrics.md +31 -0
  38. package/docs/plans/2026-10-16-case-workflow-and-release.md +19 -0
  39. package/docs/releases/0.10.0-ci-registry-install.json +140 -0
  40. package/docs/releases/0.10.0-feature-smoke.json +22 -0
  41. package/docs/releases/0.10.0-feature-smoke.mjs +62 -0
  42. package/docs/releases/0.10.0-signatures.txt +7 -0
  43. package/docs/releases/0.10.0-verification.json +76 -0
  44. package/docs/releases/0.10.0.md +44 -8
  45. package/docs/releases/0.10.1-feature-smoke.mjs +95 -0
  46. package/docs/releases/0.10.1.md +38 -0
  47. package/docs/replay-packages.md +14 -5
  48. package/docs/schemas/eval-preflight.schema.json +57 -0
  49. package/docs/schemas/eval-result.schema.json +11 -0
  50. package/docs/sharing-results.md +5 -2
  51. package/package.json +1 -1
@@ -0,0 +1,95 @@
1
+ import assert from 'node:assert/strict';
2
+ import {spawnSync} from 'node:child_process';
3
+ import {existsSync,mkdirSync,mkdtempSync,readFileSync,renameSync,rmSync,writeFileSync} from 'node:fs';
4
+ import {join,resolve} from 'node:path';
5
+ import {pathToFileURL} from 'node:url';
6
+
7
+ // Argument 1: an extracted or registry-installed skillfit package. Argument 2:
8
+ // a fresh parent directory for synthetic data and the resulting JSON receipt.
9
+ const installed=resolve(process.argv[2]), parent=resolve(process.argv[3]);
10
+ mkdirSync(parent,{recursive:true});
11
+ const root=mkdtempSync(join(parent,'case-smoke-')), bench=join(root,'bench'), skill=join(root,'skill');
12
+ const load=path=>import(pathToFileURL(join(installed,'dist',path)).href);
13
+ const {runBenchInit}=await load('commands/bench.js');
14
+ const {runEval}=await load('commands/eval.js');
15
+ const {exportEvaluation}=await load('commands/eval-export.js');
16
+ const {MockExecutor}=await load('harness/executors/mock.js');
17
+ const {ApiExecutor}=await load('harness/executors/api.js');
18
+ const {ExecutorFailure}=await load('harness/types.js');
19
+ const {ExperimentSession}=await load('harness/experiment-session.js');
20
+ const {collectEvaluationTarget}=await load('harness/target.js');
21
+ const {loadBench}=await load('harness/bench.js');
22
+ const {runTrial}=await load('harness/runner.js');
23
+ const {summarizeCosts}=await load('harness/costs.js');
24
+ const cli=(...args)=>{
25
+ const child=spawnSync(process.execPath,[join(installed,'dist/cli.js'),...args],{cwd:root,encoding:'utf8',timeout:60_000,maxBuffer:16*1024*1024});
26
+ assert.equal(child.status,0,child.stderr||child.stdout); return child.stdout;
27
+ };
28
+ const checks={}; let fakeApiResponses=0;
29
+ for(const cached of [0,80,undefined]) {
30
+ const fetchImpl=async()=>{fakeApiResponses++;return new Response(JSON.stringify({choices:[{message:{content:'offline'}}],usage:{prompt_tokens:100,completion_tokens:10,...(cached!==undefined?{prompt_tokens_details:{cached_tokens:cached}}:{})}}),{status:200});};
31
+ const result=await new ApiExecutor({apiKey:'synthetic-no-network',fetchImpl}).run('offline');
32
+ assert.deepEqual(result.tokens,{input:100,output:10,...(cached!==undefined?{cachedInput:cached}:{})});
33
+ const record={executorInvoked:true,passed:true,error:null,durationSeconds:1,tokens:result.tokens,usageStatus:'final'};
34
+ const costs=summarizeCosts({baseline:[record],treatment:[]},{baseline:[record],treatment:[]}).attempts.baseline.metrics;
35
+ assert.equal(costs.cachedInput.knownTotal,cached??0);
36
+ assert.equal(costs.uncachedInput.coverage.unknown,cached===undefined?1:0);
37
+ if(cached!==undefined) assert.equal(costs.uncachedInput.knownTotal,100-cached);
38
+ }
39
+ checks.apiCacheZeroKnownAndUnknown=true;
40
+ assert.equal(cli('--version').trim(),'0.10.1'); checks.version=true;
41
+ const help=cli('--help'); for(const flag of ['--export','--input-root','bench list','bench remove','--task']) assert.ok(help.includes(flag)); checks.help=true;
42
+ await runBenchInit({dir:bench,yes:true,log:()=>{}});
43
+ const manifestPath=join(bench,'bench.json'), initial=JSON.parse(readFileSync(manifestPath));
44
+ initial.tasks.push({...initial.tasks[0],id:'second-case'}); writeFileSync(manifestPath,JSON.stringify(initial));
45
+ assert.equal(JSON.parse(cli('bench','list',bench,'--json')).tasks.length,2);
46
+ assert.equal(JSON.parse(cli('bench','show',bench,'second-case','--json')).tasks[0].id,'second-case'); checks.listShow=true;
47
+ const before=readFileSync(manifestPath,'utf8');
48
+ assert.equal(JSON.parse(cli('bench','edit',bench,'second-case','--set','shouldTrigger=false','--json')).status,'planned');
49
+ assert.equal(readFileSync(manifestPath,'utf8'),before);
50
+ assert.equal(JSON.parse(cli('bench','edit',bench,'second-case','--set','shouldTrigger=false','--yes','--json')).status,'applied');
51
+ assert.equal(readFileSync(manifestPath+'.skillfit-bak','utf8'),before); checks.editPlanBackup=true;
52
+ assert.equal(JSON.parse(cli('bench','remove',bench,'second-case','--yes','--json')).status,'applied');
53
+ assert.ok(existsSync(join(bench,initial.tasks[0].prompt))); checks.removePreservesFiles=true;
54
+ const health=JSON.parse(cli('bench','check',bench,'--json')); assert.ok(Array.isArray(health.checks)); checks.benchCheckJson=true;
55
+ mkdirSync(skill); writeFileSync(join(skill,'SKILL.md'),'# Synthetic publication smoke\n');
56
+ const mock=new MockExecutor(); let syntheticCalls=0;
57
+ const executor={describe:()=>mock.describe(),run:async(...args)=>{syntheticCalls++;return mock.run(...args)}};
58
+ const options={skillPath:skill,bench,taskIds:['example-task'],trials:1,maxCalls:2,executor,judgeExecutor:null,yes:true,runsRoot:join(root,'runs'),runGroup:'synthetic',log:()=>{}};
59
+ await runEval({...options,dryRun:true,onPlan:p=>{assert.equal(p.plannedCalls,2);assert.deepEqual(p.bench.taskIds,['example-task']);}});
60
+ assert.equal(syntheticCalls,0); checks.selectedPreviewNoCalls=true;
61
+ await runEval({...options,dryRun:false}); assert.equal(syntheticCalls,2);
62
+ const run=join(root,'runs/synthetic'), output=join(root,'export');
63
+ const original=JSON.parse(cli('report','eval',run,'--json'));
64
+ assert.equal(original.casePreflight.status,'ready'); checks.offlineCasePreflight=true;
65
+ const human=cli('report','eval',run); assert.ok(human.includes(`State: ${original.status}`));
66
+ assert.ok(human.includes(`Acceptance: ${original.acceptance.decision}`)); assert.ok(human.includes('Automatic upgrade: no'));
67
+ assert.equal(cli('report','eval',join(run,'manifest.json')),human); checks.unifiedReportInputs=true;
68
+ const stopped=join(root,'runs/stopped'), target=collectEvaluationTarget(skill), loaded=loadBench(bench);
69
+ const stoppedExecutor={describe:()=>mock.describe(),run:async()=>{syntheticCalls++;throw new ExecutorFailure('synthetic stop',{output:'partial',tokens:{input:9,cachedInput:3,output:2},usageStatus:'partial'});}};
70
+ const session=new ExperimentSession({bench:loaded,target,groupDir:stopped,workspaces:[join(stopped,'example-task/baseline/trial-1')],plannedCalls:2,maxCalls:2,injected:true,details:{mode:'inject'}});
71
+ await runTrial({bench:loaded,target,executor:session.wrap(stoppedExecutor,'agent'),trials:1,runsRoot:join(root,'runs'),runGroup:'stopped',log:()=>{}},'example-task','baseline',1);
72
+ session.finish(new Error('synthetic stop'));
73
+ const stoppedJson=JSON.parse(cli('report','eval',stopped,'--json')), stoppedHuman=cli('report','eval',stopped);
74
+ assert.equal(stoppedJson.status,'stopped'); assert.equal(stoppedJson.acceptance.eligibleForUpgrade,false);
75
+ assert.ok(stoppedHuman.includes('State: stopped')); assert.ok(stoppedHuman.includes('Retained costs')); assert.ok(stoppedHuman.includes('partial'));
76
+ checks.stoppedReportsRetainPartialCosts=true;
77
+ for(const path of [bench,skill]) rmSync(path,{recursive:true});
78
+ const plan=JSON.parse(cli('report','eval',run,'--export',output,'--json')); assert.equal(plan.status,'planned'); assert.equal(plan.inputSource,'sealed-snapshot'); assert.ok(!existsSync(output)); checks.sealedInputsWithoutOriginals=true; checks.exportPlan=true;
79
+ await exportEvaluation(run,output,{yes:true,log:()=>{}});
80
+ const moved=join(root,'moved package'); renameSync(output,moved);
81
+ rmSync(join(root,'runs'),{recursive:true});
82
+ const reproduce=verify=>{
83
+ const child=spawnSync(process.execPath,[join(moved,'reproduce.mjs'),...(verify?['--verify-only']:[])],{cwd:root,encoding:'utf8',timeout:60_000,maxBuffer:16*1024*1024});
84
+ assert.equal(child.status,0,child.stderr); return JSON.parse(child.stdout);
85
+ };
86
+ assert.equal(reproduce(true).verified,true); checks.portableChecksums=true;
87
+ const replay=reproduce(false); assert.equal(replay.evidence.verified,true); assert.deepEqual(replay.costs,original.costs);
88
+ assert.equal(replay.acceptance.eligibleForUpgrade,false); assert.equal(replay.acceptance.automaticUpgrade,false);
89
+ const inspected=JSON.parse(cli('report','eval',moved,'--json','--replay')); assert.equal(inspected.portablePackage.integrityVerified,true);
90
+ assert.ok(cli('report','eval',moved,'--replay').includes('Native evidence: verified'));
91
+ assert.equal(syntheticCalls,3); checks.movedPackageReplayWithoutOriginals=true; checks.exactCosts=true;
92
+ const receipt={schemaVersion:1,kind:'skillfit.release-case-workflow-smoke',version:'0.10.1',verifiedAt:new Date().toISOString(),modelCalls:0,agentCliCalls:0,syntheticExecutorCalls:syntheticCalls,fakeApiResponses,checks};
93
+ writeFileSync(join(parent,'feature-smoke.json'),JSON.stringify(receipt,null,2)+'\n',{flag:'wx'});
94
+ rmSync(root,{recursive:true});
95
+ console.log(JSON.stringify(receipt));
@@ -0,0 +1,38 @@
1
+ # skillfit 0.10.1
2
+
3
+ Prepared for the existing [manual OIDC publication procedure](trusted-publishing.md).
4
+ Publication is pending; npm 0.10.0 remains the verified published release until
5
+ the registry and installed archive checks succeed. This record will retain the
6
+ actual source, workflow and installation receipts after publication.
7
+
8
+ ## Delivered workflow
9
+
10
+ - Read explicit chat-completions cached-input counts into retained costs and
11
+ spending checks. Zero stays zero; absent or invalid cache evidence stays unknown.
12
+ - Open a manifest, native run directory or portable package in either Markdown
13
+ or JSON. Both audit the same saved evidence and show acceptance reasons.
14
+ Stopped/incomplete runs retain spending without becoming completed comparisons.
15
+ - Include Ctrl+C/SIGTERM cleanup and stopped-record sealing, mandatory offline
16
+ case checks before live eval, and input snapshots sealed before dispatch.
17
+ Export/replay survives original-input edits, deletion and moved run directories.
18
+
19
+ See [report inputs](../evaluation-reports.md), [cost accounting](../eval-costs.md),
20
+ [interruption](../evaluation-interruption.md), [case preflight](../eval-case-preflight.md)
21
+ and [input snapshots](../evaluation-input-snapshots.md). This release changes CLI
22
+ reliability and reproducibility, not the statistical or adoption policy. No real
23
+ model evaluations or agent CLI calls are added; historical evidence stays unchanged.
24
+
25
+ ## Reproduce the installed-feature checks
26
+
27
+ The [offline recipe](0.10.1-feature-smoke.mjs) accepts an extracted or isolated
28
+ registry-installed package and a fresh output parent:
29
+
30
+ ```bash
31
+ node docs/releases/0.10.1-feature-smoke.mjs /absolute/path/to/node_modules/skillfit /tmp/skillfit-0.10.1-feature-smoke
32
+ ```
33
+
34
+ It checks the case workflow, API cache parsing with fake fetch, shared human/JSON
35
+ reports, stopped costs, input sealing and moved-package replay after originals
36
+ are removed. Only injected synthetic executors and fake API responses are used.
37
+ It retains `feature-smoke.json` and cleans its generated project/run data. No
38
+ Skill efficacy or token-cost reduction claim follows from implementation checks.
@@ -30,10 +30,12 @@ the copied compiled CLI, grades temporary delivery copies and returns JSON. The
30
30
  last command above uses the currently installed CLI and the packaged bench.
31
31
 
32
32
  The source must have sealed native evidence. A completed manifest must pass the
33
- native evidence audit. Missing, changed or linked artifacts and missing/changed
34
- pinned inputs reject the export. Original bench, complete candidate/baseline Skill
35
- resources, compiled implementation and original request (when recorded) must still
36
- be available. The live harness does not automatically archive every source tree.
33
+ native evidence audit. Missing, changed or linked native artifacts reject export.
34
+ Version 0.10.1 [seals inputs before dispatch](evaluation-input-snapshots.md)
35
+ and exports those copies even after original bench/Skill/request directories change
36
+ or disappear. A declared but damaged snapshot is an error, never a silent fallback.
37
+ Older runs without snapshots still need matching original or recovered bench,
38
+ complete candidate/baseline resources, compiled implementation and original request.
37
39
 
38
40
  Recover original files elsewhere and provide matching paths when necessary:
39
41
 
@@ -44,7 +46,8 @@ skillfit report eval ./runs/my-run --export ./exports/my-run --input-root bench=
44
46
  Only labels present in that run may be supplied; fingerprints must match exactly.
45
47
  `request` names a file, all other labels name directories. `--bench <path>` is a
46
48
  shortcut for the export's bench root; do not combine it with `--input-root bench`.
47
- This recovers paths, not missing evidence or permission to change a cohort.
49
+ This recovers paths, not missing evidence or permission to change a cohort. Explicit
50
+ overrides do not bypass validation of a new run's declared input archive.
48
51
 
49
52
  ## Contents and machine contract
50
53
 
@@ -69,6 +72,12 @@ count (excluding generated metadata), `modelCalls: 0` and
69
72
  evaluation error envelope and exit 2. Export cannot be mixed with `--replay`,
70
73
  `--records` or `--policy`.
71
74
 
75
+ Current source also returns `inputSource: "sealed-snapshot"` for archived inputs
76
+ or `"original-or-recovered"` for historical runs. Native archives remain unchanged
77
+ inside `run/`; portable layout inputs/runtime are extra copies counted by the
78
+ export preview. Per-run snapshot copy time and storage are recorded separately
79
+ in the native plan and JSON assessment's `inputSnapshot.cost`.
80
+
72
81
  ## Evidence and sharing boundaries
73
82
 
74
83
  Stopped or incomplete native runs can be exported with their partial/unknown
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "Skillfit offline evaluation case preflight version 1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["schemaVersion", "kind", "scope", "status", "bench", "checks", "summary", "cost"],
7
+ "properties": {
8
+ "schemaVersion": { "const": 1 },
9
+ "kind": { "const": "skillfit.eval-preflight" },
10
+ "scope": { "const": "offline-case-integrity" },
11
+ "status": { "enum": ["ready", "blocked"] },
12
+ "bench": {
13
+ "type": "object", "additionalProperties": false,
14
+ "required": ["dir", "sha256", "taskIds"],
15
+ "properties": {
16
+ "dir": { "type": "string" },
17
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
18
+ "taskIds": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
19
+ }
20
+ },
21
+ "checks": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "object", "additionalProperties": false,
25
+ "required": ["code", "status", "message", "taskId", "location", "remediation", "evidence"],
26
+ "properties": {
27
+ "code": { "enum": ["BENCH_LOAD", "UNTOUCHED_FIXTURE", "MISSING_OUTPUT", "EMPTY_OUTPUT", "FACET_COUNT", "ORACLE", "MOCK_COVERAGE", "MOCK_MARKER", "MOCK_BASELINE", "MOCK_TREATMENT", "FIXTURE_SIZE", "TRIGGER_LABEL", "NEGATIVE_CONTROLS", "LIVE_DIFFICULTY", "INPUT_CHANGED", "CHECK_ERROR"] },
28
+ "status": { "enum": ["PASS", "FAIL", "WARN", "UNKNOWN", "INFO"] },
29
+ "message": { "type": "string" },
30
+ "taskId": { "type": ["string", "null"] },
31
+ "location": { "$ref": "bench-check.schema.json#/properties/checks/items/properties/location" },
32
+ "remediation": { "type": ["string", "null"] },
33
+ "evidence": { "$ref": "bench-check.schema.json#/properties/checks/items/properties/evidence" }
34
+ }
35
+ }
36
+ },
37
+ "summary": {
38
+ "type": "object", "additionalProperties": false,
39
+ "required": ["failures", "warnings", "unknown", "passed", "info"],
40
+ "properties": {
41
+ "failures": { "type": "integer", "minimum": 0 },
42
+ "warnings": { "type": "integer", "minimum": 0 },
43
+ "unknown": { "type": "integer", "minimum": 0 },
44
+ "passed": { "type": "integer", "minimum": 0 },
45
+ "info": { "type": "integer", "minimum": 0 }
46
+ }
47
+ },
48
+ "cost": {
49
+ "type": "object", "additionalProperties": false,
50
+ "required": ["modelCalls", "durationMs"],
51
+ "properties": { "modelCalls": { "const": 0 }, "durationMs": { "type": "integer", "minimum": 0 } }
52
+ }
53
+ },
54
+ "allOf": [
55
+ { "if": { "properties": { "status": { "const": "ready" } } }, "then": { "properties": { "summary": { "properties": { "failures": { "const": 0 } } } } }, "else": { "properties": { "summary": { "properties": { "failures": { "minimum": 1 } } } } } }
56
+ ]
57
+ }
@@ -9,6 +9,17 @@
9
9
  "status": { "enum": ["planned", "completed", "stopped", "incomplete", "reported", "error"] },
10
10
  "plan": { "type": "object", "required": ["sha256", "request", "evaluation"] },
11
11
  "manifest": { "type": ["object", "null"] },
12
+ "casePreflight": { "anyOf": [{ "$ref": "eval-preflight.schema.json" }, { "type": "null" }] },
13
+ "inputSnapshot": {
14
+ "type": ["object", "null"],
15
+ "required": ["schemaVersion", "indexPath", "sha256", "cost"],
16
+ "properties": {
17
+ "schemaVersion": { "const": 1 }, "indexPath": { "const": "_inputs.json" },
18
+ "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
19
+ "cost": { "type": "object", "required": ["modelCalls", "durationMs", "bytes", "files"],
20
+ "properties": { "modelCalls": { "const": 0 }, "durationMs": { "type": "integer", "minimum": 0 }, "bytes": { "type": "integer", "minimum": 0 }, "files": { "type": "integer", "minimum": 0 } } }
21
+ }
22
+ },
12
23
  "identity": { "type": "object" },
13
24
  "quality": { "type": "object", "required": ["statisticalVerdict", "improvedPairs", "regressedPairs", "tasks"] },
14
25
  "costs": {
@@ -12,8 +12,11 @@ Try a clearly synthetic schema-v4 example first:
12
12
  node dist/cli.js report eval docs/examples/eval-manifest.synthetic.json
13
13
  ```
14
14
 
15
- After a paired `skillfit eval` run, replace the example path with the `Manifest:` path printed at the
16
- bottom of its output. This command is read-only: it does not call an agent,
15
+ After a paired `skillfit eval` run, replace the example path with its native run
16
+ directory or the printed `Manifest:` path. Since 0.10.1, Markdown and JSON accept
17
+ the same manifest/run/package inputs and show audit and acceptance reasons.
18
+ Stopped/incomplete runs show retained costs without inventing a completed quality
19
+ comparison. See [report inputs and states](evaluation-reports.md). This command is read-only: it does not call an agent,
17
20
  rerun a verifier, change the manifest, or alter the verdict. Paste its output into a pull request or
18
21
  issue. The JSON manifest remains the canonical record; attach it when you want someone else to audit
19
22
  the task-level outcomes and provenance. The Markdown includes target and bench hashes, the executor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillfit",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Evidence-driven configuration for AI coding agents: measure which skills, rules and MCP servers actually help — then install only those.",
5
5
  "type": "module",
6
6
  "bin": {