skillfit 0.9.1 → 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 +48 -14
- package/README.zh-CN.md +48 -14
- package/benches/README.md +23 -0
- package/benches/contrib/README.md +1 -0
- package/benches/contrib/oss-skill-independent/README.md +60 -0
- package/benches/contrib/oss-skill-independent/bench.json +79 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/Readme.md +1015 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/esm.mjs +15 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/index.js +27 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/argument.js +147 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/command.js +1944 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/error.js +45 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/help.js +396 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/option.js +208 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/suggestSimilar.js +100 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package.json +63 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.d.ts +774 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.test-d.ts +416 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/upstream-package.json +69 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/Readme.md +1149 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/esm.mjs +16 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/index.js +24 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/argument.js +149 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/command.js +2662 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/error.js +39 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/help.js +713 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/option.js +367 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/suggestSimilar.js +101 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package.json +71 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/esm.d.mts +3 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.d.ts +1045 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.test-d.ts +737 -0
- package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/upstream-package.json +82 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.d.ts +40 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.js +68 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/package.json +54 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/readme.md +99 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/upstream-package.json +54 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/index.js +67 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/package.json +46 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.js +132 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/package.json +57 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/readme.md +181 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/upstream-package.json +58 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.js +116 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/package.json +60 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/readme.md +170 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/upstream-package.json +60 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.d.ts +149 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.js +93 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/package.json +52 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/readme.md +192 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/upstream-package.json +52 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.js +114 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/package.json +48 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/readme.md +158 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/upstream-package.json +48 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.js +122 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/license +9 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/package.json +50 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/readme.md +190 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/upstream-package.json +50 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/Readme.md +1015 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/esm.mjs +15 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/index.js +27 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/argument.js +147 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/command.js +1948 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/error.js +45 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/help.js +396 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/option.js +208 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/suggestSimilar.js +100 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package.json +63 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.d.ts +774 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.test-d.ts +416 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/upstream-package.json +69 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/LICENSE +22 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/Readme.md +1149 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/esm.mjs +16 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/index.js +24 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/argument.js +149 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/command.js +2666 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/error.js +39 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/help.js +713 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/option.js +367 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/suggestSimilar.js +101 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package-support.json +16 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package.json +71 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/esm.d.mts +3 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.d.ts +1045 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.test-d.ts +737 -0
- package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/upstream-package.json +82 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/async-hooks-stub.js +15 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.d.ts +40 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.js +71 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/package.json +61 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/readme.md +99 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/regression.test.mjs +6 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/upstream-package.json +54 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/index.js +67 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/package.json +46 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.js +148 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/package.json +57 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/readme.md +181 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/upstream-package.json +58 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-async-listener-order.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-output-isolation.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-async-context.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-map-iteration-rejection.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-throttle-sync-throw.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-custom-timers.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-infinity-abort.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-rejection-listener.mjs +1 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.d.ts +136 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.js +121 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/package.json +60 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/readme.md +170 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/regression.test.mjs +6 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/upstream-package.json +60 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.d.ts +149 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.js +95 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/package.json +52 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/readme.md +192 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/upstream-package.json +52 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.js +114 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/package.json +48 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/readme.md +158 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/upstream-package.json +48 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.d.ts +151 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.js +122 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/license +9 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/package.json +50 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/readme.md +190 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/regression.test.mjs +5 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test.mjs +4 -0
- package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/upstream-package.json +50 -0
- package/benches/contrib/oss-skill-independent/prompts/commander-async-listener-order.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/commander-output-isolation.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/limit-async-context.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/limit-map-iteration-rejection.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/throttle-sync-throw.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/timeout-custom-timers.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/timeout-infinity-abort.md +3 -0
- package/benches/contrib/oss-skill-independent/prompts/timeout-rejection-listener.md +3 -0
- package/benches/contrib/oss-skill-independent/provenance.json +1903 -0
- package/benches/contrib/oss-skill-independent/task-specs.json +63 -0
- package/benches/contrib/oss-skill-independent/test-clock.mjs +65 -0
- package/benches/contrib/oss-skill-independent/verifiers/cases.mjs +197 -0
- package/benches/contrib/oss-skill-independent/verifiers/commander-async-listener-order.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/commander-output-isolation.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/grade.mjs +48 -0
- package/benches/contrib/oss-skill-independent/verifiers/limit-async-context.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/limit-map-iteration-rejection.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/probe.mjs +16 -0
- package/benches/contrib/oss-skill-independent/verifiers/regression-evidence.mjs +105 -0
- package/benches/contrib/oss-skill-independent/verifiers/test-reporter.mjs +29 -0
- package/benches/contrib/oss-skill-independent/verifiers/throttle-sync-throw.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/timeout-custom-timers.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/timeout-infinity-abort.mjs +1 -0
- package/benches/contrib/oss-skill-independent/verifiers/timeout-rejection-listener.mjs +1 -0
- package/dist/cli.js +183 -64
- package/dist/commands/bench-check-json.test.js +221 -0
- package/dist/commands/bench-check-report.js +48 -0
- package/dist/commands/bench-command-template.js +129 -0
- package/dist/commands/bench-manage.js +91 -0
- package/dist/commands/bench-manage.test.js +87 -0
- package/dist/commands/bench.js +166 -128
- package/dist/commands/bench.test.js +101 -0
- package/dist/commands/eval-component.js +25 -1
- package/dist/commands/eval-export.js +178 -0
- package/dist/commands/eval-export.test.js +279 -0
- 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 +94 -61
- package/dist/commands/eval.test.js +58 -1
- package/dist/harness/bench.js +21 -2
- package/dist/harness/eval-audit.js +45 -5
- package/dist/harness/eval-budget.js +51 -0
- package/dist/harness/eval-budget.test.js +212 -0
- package/dist/harness/eval-component.test.js +36 -0
- package/dist/harness/eval-contract.js +5 -1
- 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/replay-package.js +85 -0
- package/dist/harness/runner.js +74 -15
- package/dist/harness/trigger.js +20 -4
- package/docs/bench-authoring.md +40 -0
- package/docs/bench-check-json.md +122 -0
- package/docs/case-management.md +65 -0
- package/docs/eval-case-preflight.md +110 -0
- package/docs/eval-component.md +88 -49
- 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/examples/check-receiver-mechanism-proposal.mjs +124 -0
- package/docs/examples/prepare-native-diff-probe.mjs +75 -0
- package/docs/examples/reproduce-independent-comparison-budget.mjs +73 -0
- package/docs/experiment-workflow.md +9 -2
- package/docs/first-real-eval.md +10 -1
- package/docs/growth-roadmap-2026-10.md +62 -93
- package/docs/metrics.md +52 -0
- package/docs/plans/2026-10-14-evidence-and-release-sequence.md +29 -12
- package/docs/plans/2026-10-15-independent-comparison-budget.json +1769 -0
- package/docs/plans/2026-10-15-independent-comparison-inputs.json +373 -0
- package/docs/plans/2026-10-15-independent-comparison-proposal.md +177 -0
- package/docs/plans/2026-10-15-native-diff-mechanism.md +105 -0
- package/docs/plans/2026-10-15-receiver-mechanism-proposal.json +342 -0
- package/docs/plans/2026-10-15-receiver-mechanism-proposal.md +146 -0
- package/docs/plans/2026-10-15-receiver-mechanism-verification.json +105 -0
- package/docs/plans/2026-10-16-case-workflow-and-release.md +49 -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 +81 -0
- package/docs/releases/0.10.1-feature-smoke.mjs +95 -0
- package/docs/releases/0.10.1.md +38 -0
- package/docs/releases/0.9.1-first-publication.json +249 -0
- package/docs/releases/0.9.1-verification.json +122 -0
- package/docs/releases/0.9.1.md +33 -1
- package/docs/releases/trusted-publishing.md +61 -0
- package/docs/replay-packages.md +97 -0
- package/docs/schemas/bench-check.schema.json +109 -0
- package/docs/schemas/eval-preflight.schema.json +57 -0
- package/docs/schemas/eval-request.schema.json +12 -0
- package/docs/schemas/eval-result.schema.json +11 -0
- package/docs/sharing-results.md +11 -2
- package/docs/skill-evaluation-evidence.md +52 -0
- package/evidence/2026-10-15-diagnosing-receiver-correction.md +140 -0
- package/evidence/2026-10-15-independent-comparison-regression-stop.md +162 -0
- package/evidence/2026-10-15-independent-offline-readiness.md +144 -0
- package/evidence/2026-10-15-native-diff-mechanism.md +196 -0
- package/evidence/2026-10-15-receiver-mechanism-stop.md +154 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/README.md +35 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/expected.json +577 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/receiver-contract.test.mjs +138 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/replay.mjs +127 -0
- package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/verification.json +105 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/README.md +32 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/checks.json +32 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/verification.json +25 -0
- package/evidence/artifacts/2026-10-15-independent-offline-readiness/README.md +17 -0
- package/evidence/artifacts/2026-10-15-independent-offline-readiness/verification.json +1548 -0
- package/evidence/artifacts/2026-10-15-native-diff-mechanism/README.md +48 -0
- package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/README.md +38 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/checks.json +118 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/verification.json +36 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/LICENSE +21 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/SKILL.md +51 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/agents/openai.yaml +3 -0
- package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/scripts/hitl-loop.template.sh +44 -0
- package/package.json +1 -1
- package/skills/skillfit/SKILL.md +17 -5
|
@@ -9,6 +9,7 @@ import { ExperimentSession, normalizeProjectTrust, validateCallBudget } from './
|
|
|
9
9
|
import { sha256File } from './hash.js';
|
|
10
10
|
import { runEval } from '../commands/eval.js';
|
|
11
11
|
import { runBenchCheck } from '../commands/bench.js';
|
|
12
|
+
import { packageFiles } from './replay-package.js';
|
|
12
13
|
function setup(t) {
|
|
13
14
|
const root = mkdtempSync(join(tmpdir(), 'skillfit-session-'));
|
|
14
15
|
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
@@ -19,7 +20,7 @@ function setup(t) {
|
|
|
19
20
|
writeFileSync(join(skill, 'SKILL.md'), '---\nname: candidate\ndescription: offline fixture\n---\nInspect boundaries.\n');
|
|
20
21
|
writeFileSync(join(benchDir, 'fixture', 'index.js'), 'module.exports = 1;\n');
|
|
21
22
|
writeFileSync(join(benchDir, 'prompt.md'), 'Fix the cache.\n');
|
|
22
|
-
writeFileSync(join(benchDir, 'verify.mjs'), 'process.exit(0);\n
|
|
23
|
+
writeFileSync(join(benchDir, 'verify.mjs'), "import{existsSync,readFileSync}from'node:fs';import{join}from'node:path';const output=join(process.argv[2],'_output.md');process.exit(existsSync(output)&&readFileSync(output,'utf8').trim()?0:1);\n");
|
|
23
24
|
writeFileSync(join(benchDir, 'bench.json'), JSON.stringify({ schemaVersion: 1, name: 'session-test', tasks: [
|
|
24
25
|
{ id: 'one', fixture: 'fixture', prompt: 'prompt.md', verifier: 'node verify.mjs', shouldTrigger: true },
|
|
25
26
|
] }));
|
|
@@ -88,6 +89,45 @@ test('a changed frozen input retains returned output but blocks subsequent calls
|
|
|
88
89
|
assert.equal(calls, 1);
|
|
89
90
|
assert.equal(session.summary().status, 'stopped');
|
|
90
91
|
});
|
|
92
|
+
test('input snapshots exist and are bound before dispatch; modifying one stops further calls with usage retained', async (t) => {
|
|
93
|
+
const s = setup(t), session = new ExperimentSession(s.options);
|
|
94
|
+
const plan = JSON.parse(readFileSync(join(s.groupDir, '_plan.json'), 'utf8'));
|
|
95
|
+
const snapshot = JSON.parse(readFileSync(join(s.groupDir, '_inputs.json'), 'utf8'));
|
|
96
|
+
assert.equal(plan.inputSnapshot.sha256, sha256File(join(s.groupDir, '_inputs.json')));
|
|
97
|
+
assert.deepEqual(snapshot.entries.map((entry) => entry.label).sort(), ['bench', 'implementation', 'target']);
|
|
98
|
+
const files = packageFiles(join(s.groupDir, '_inputs'));
|
|
99
|
+
assert.equal(plan.inputSnapshot.cost.files, files.length + 1);
|
|
100
|
+
assert.equal(plan.inputSnapshot.cost.bytes, files.reduce((sum, file) => sum + readFileSync(join(s.groupDir, '_inputs', file)).length, 0) + readFileSync(join(s.groupDir, '_inputs.json')).length);
|
|
101
|
+
assert.equal(plan.inputSnapshot.cost.modelCalls, 0);
|
|
102
|
+
assert.ok(plan.inputSnapshot.cost.durationMs >= 0);
|
|
103
|
+
let calls = 0;
|
|
104
|
+
const guarded = session.wrap({ ...s.executor, run: async () => {
|
|
105
|
+
calls++;
|
|
106
|
+
assert.equal(readFileSync(join(s.groupDir, '_inputs/target/SKILL.md'), 'utf8'), readFileSync(join(s.skill, 'SKILL.md'), 'utf8'));
|
|
107
|
+
writeFileSync(join(s.groupDir, '_inputs/target/SKILL.md'), 'changed snapshot');
|
|
108
|
+
return { output: 'retained', tokens: { input: 12, output: 3 } };
|
|
109
|
+
} }, 'agent');
|
|
110
|
+
const result = await guarded.run('first', s.root);
|
|
111
|
+
assert.match(result.guardError, /snapshot hash mismatch/);
|
|
112
|
+
assert.deepEqual(result.tokens, { input: 12, output: 3 });
|
|
113
|
+
await assert.rejects(guarded.run('partner', s.root), /snapshot hash mismatch/);
|
|
114
|
+
assert.equal(calls, 1);
|
|
115
|
+
session.finish();
|
|
116
|
+
assert.equal(session.summary().status, 'stopped');
|
|
117
|
+
});
|
|
118
|
+
test('source drift during snapshot setup fails before dispatch and removes only its fresh output', async (t) => {
|
|
119
|
+
const s = setup(t);
|
|
120
|
+
let calls = 0;
|
|
121
|
+
const runsRoot = join(s.root, 'drift'), group = join(runsRoot, 'saved');
|
|
122
|
+
mkdirSync(runsRoot);
|
|
123
|
+
writeFileSync(join(runsRoot, 'kept'), 'existing sibling');
|
|
124
|
+
await assert.rejects(runEval({ skillPath: s.skill, bench: s.benchDir, executor: { ...s.executor, run: async () => { calls++; return { output: 'done' }; } },
|
|
125
|
+
judgeExecutor: null, agent: 'codex', trials: 1, dryRun: false, yes: true, runsRoot, runGroup: 'saved', log: () => { },
|
|
126
|
+
sessionOptions: { homeDir: s.root, env: {}, versionProbe: () => { writeFileSync(join(s.benchDir, 'prompt.md'), 'changed after fingerprinting'); return 'fake 1.0'; } } }), /changed.*snapshot|snapshot.*changed/i);
|
|
127
|
+
assert.equal(calls, 0);
|
|
128
|
+
assert.ok(!existsSync(group));
|
|
129
|
+
assert.equal(readFileSync(join(runsRoot, 'kept'), 'utf8'), 'existing sibling');
|
|
130
|
+
});
|
|
91
131
|
test('executor failure stops further actual calls and keeps a failure receipt without secrets', async (t) => {
|
|
92
132
|
const s = setup(t);
|
|
93
133
|
let calls = 0;
|
|
@@ -121,6 +161,8 @@ test('temporary profile config is pinned, planned trust additions are allowed, m
|
|
|
121
161
|
const plan = readFileSync(join(s.groupDir, '_plan.json'), 'utf8');
|
|
122
162
|
assert.equal(plan.includes('PRIVATE_SECRET'), false);
|
|
123
163
|
assert.match(plan, /"model_reasoning_effort": "high"/);
|
|
164
|
+
const snapshot = JSON.parse(readFileSync(join(s.groupDir, '_inputs.json'), 'utf8'));
|
|
165
|
+
assert.deepEqual(snapshot.entries.map((entry) => entry.label).sort(), ['bench', 'implementation', 'target'], 'private agent configuration remains fingerprint-only');
|
|
124
166
|
writeFileSync(config, readFileSync(config, 'utf8') + `\n[projects.${JSON.stringify(s.options.workspaces[0])}]\ntrust_level = "trusted"\n`);
|
|
125
167
|
session.check();
|
|
126
168
|
writeFileSync(config, readFileSync(config, 'utf8').replace('"offline"', '"changed"'));
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { chmodSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { isAbsolute, join, relative, sep } from 'node:path';
|
|
4
|
+
import { hashFileSet, sha256File } from './hash.js';
|
|
5
|
+
import { packageFiles, packageMember } from './replay-package.js';
|
|
6
|
+
const ALIASES = new Map([['bench', 'bench'], ['target', 'target'], ['implementation', 'implementation'], ['baseline Skill', 'baseline-skill']]);
|
|
7
|
+
export const INPUT_SNAPSHOT_POLICY = { schemaVersion: 1, required: true, status: 'pending' };
|
|
8
|
+
/** Includes empty directories; excludes Git metadata and the current native run. */
|
|
9
|
+
export function inputDirectories(root, exclude) {
|
|
10
|
+
const result = [];
|
|
11
|
+
const walk = (prefix) => {
|
|
12
|
+
for (const entry of readdirSync(join(root, prefix), { withFileTypes: true })) {
|
|
13
|
+
const path = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
14
|
+
const rel = exclude ? relative(exclude, join(root, path)) : '..';
|
|
15
|
+
if (entry.name === '.git' || (exclude && !isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${sep}`)))
|
|
16
|
+
continue;
|
|
17
|
+
if (entry.isSymbolicLink())
|
|
18
|
+
throw new Error(`Unpinned symbolic link in input snapshot: ${path}`);
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
result.push(path);
|
|
21
|
+
walk(path);
|
|
22
|
+
}
|
|
23
|
+
else if (!entry.isFile())
|
|
24
|
+
throw new Error(`Unsupported input snapshot entry: ${path}`);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
walk('');
|
|
28
|
+
return result.sort();
|
|
29
|
+
}
|
|
30
|
+
function selectedInputs(inputs) {
|
|
31
|
+
assert.ok(Array.isArray(inputs), 'Native input fingerprints are missing.');
|
|
32
|
+
const selected = inputs.filter(input => input && ALIASES.has(input.label));
|
|
33
|
+
for (const label of ['bench', 'target', 'implementation'])
|
|
34
|
+
assert.equal(selected.filter(input => input.label === label).length, 1, `Missing or repeated snapshot input: ${label}`);
|
|
35
|
+
assert.equal(new Set(selected.map(input => input.label)).size, selected.length, 'Repeated snapshot input.');
|
|
36
|
+
for (const input of selected) {
|
|
37
|
+
assert.ok(typeof input.root === 'string' && Array.isArray(input.files) && input.files.every(path => typeof path === 'string'));
|
|
38
|
+
assert.deepEqual([...new Set(input.files)].sort(), input.files, 'Snapshot file list must be sorted and unique.');
|
|
39
|
+
assert.match(input.sha256, /^[a-f0-9]{64}$/);
|
|
40
|
+
}
|
|
41
|
+
return selected;
|
|
42
|
+
}
|
|
43
|
+
function requestInput(guards) {
|
|
44
|
+
if (guards === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
assert.ok(Array.isArray(guards), 'Invalid native request guards.');
|
|
47
|
+
const requests = guards.filter(file => file?.label === 'component request');
|
|
48
|
+
assert.ok(requests.length <= 1, 'Repeated component request guard.');
|
|
49
|
+
if (requests[0]) {
|
|
50
|
+
assert.equal(typeof requests[0].path, 'string');
|
|
51
|
+
assert.match(requests[0].sha256, /^[a-f0-9]{64}$/);
|
|
52
|
+
}
|
|
53
|
+
return requests[0];
|
|
54
|
+
}
|
|
55
|
+
/** Called only in an exclusively claimed fresh run, before publishing _plan.json. */
|
|
56
|
+
export function freezeInputSnapshot(run, inputs, guards) {
|
|
57
|
+
const started = performance.now(), entries = [];
|
|
58
|
+
let bytes = 0, files = 0;
|
|
59
|
+
const copy = (source, target) => {
|
|
60
|
+
const content = readFileSync(source);
|
|
61
|
+
writeFileSync(target, content, { flag: 'wx' });
|
|
62
|
+
chmodSync(target, lstatSync(source).mode & 0o777);
|
|
63
|
+
bytes += content.length;
|
|
64
|
+
files++;
|
|
65
|
+
};
|
|
66
|
+
mkdirSync(join(run, '_inputs'));
|
|
67
|
+
for (const input of selectedInputs(inputs)) {
|
|
68
|
+
const label = ALIASES.get(input.label), path = `_inputs/${label}`, root = join(run, path);
|
|
69
|
+
const directories = inputDirectories(input.root, input.exclude);
|
|
70
|
+
mkdirSync(root);
|
|
71
|
+
for (const dir of directories)
|
|
72
|
+
mkdirSync(join(root, dir), { recursive: true });
|
|
73
|
+
for (const file of input.files) {
|
|
74
|
+
const source = packageMember(input.root, file);
|
|
75
|
+
copy(source, join(root, file));
|
|
76
|
+
}
|
|
77
|
+
if (hashFileSet(root, input.files) !== input.sha256)
|
|
78
|
+
throw new Error(`Input changed while sealing snapshot: ${label}`);
|
|
79
|
+
assert.deepEqual(inputDirectories(input.root, input.exclude), directories, `Input directories changed while sealing snapshot: ${label}`);
|
|
80
|
+
const executableFiles = input.files.filter(file => (lstatSync(join(root, file)).mode & 0o111) !== 0);
|
|
81
|
+
entries.push({ label, path, files: [...input.files], directories, executableFiles, sha256: input.sha256 });
|
|
82
|
+
}
|
|
83
|
+
const request = requestInput(guards);
|
|
84
|
+
if (request) {
|
|
85
|
+
const path = '_inputs/request.json';
|
|
86
|
+
if (!lstatSync(request.path).isFile())
|
|
87
|
+
throw new Error('Input request must be a regular file.');
|
|
88
|
+
copy(request.path, join(run, path));
|
|
89
|
+
if (sha256File(join(run, path)) !== request.sha256)
|
|
90
|
+
throw new Error('Request changed while sealing snapshot.');
|
|
91
|
+
entries.push({ label: 'request', path, files: [], directories: [], executableFiles: [], sha256: request.sha256 });
|
|
92
|
+
}
|
|
93
|
+
writeFileSync(join(run, '_inputs.json'), JSON.stringify({ schemaVersion: 1, kind: 'skillfit.eval-inputs', entries }, null, 2) + '\n', { flag: 'wx' });
|
|
94
|
+
bytes += lstatSync(join(run, '_inputs.json')).size;
|
|
95
|
+
files++;
|
|
96
|
+
const snapshot = { schemaVersion: 1, indexPath: '_inputs.json', sha256: sha256File(join(run, '_inputs.json')),
|
|
97
|
+
cost: { modelCalls: 0, durationMs: Math.round(performance.now() - started), bytes, files } };
|
|
98
|
+
verifyInputSnapshot(run, { inputs, guardFiles: guards, inputSnapshot: snapshot });
|
|
99
|
+
snapshot.cost.durationMs = Math.round(performance.now() - started);
|
|
100
|
+
return snapshot;
|
|
101
|
+
}
|
|
102
|
+
/** A declared snapshot never falls back to mutable originals when damaged. */
|
|
103
|
+
export function verifyInputSnapshot(run, plan) {
|
|
104
|
+
if (plan.inputSnapshot === undefined)
|
|
105
|
+
return null; // Historical run: retain the old recovery path.
|
|
106
|
+
const descriptor = plan.inputSnapshot;
|
|
107
|
+
assert.ok(descriptor && descriptor.schemaVersion === 1 && descriptor.indexPath === '_inputs.json', 'Invalid input snapshot descriptor.');
|
|
108
|
+
const indexPath = packageMember(run, '_inputs.json');
|
|
109
|
+
assert.equal(sha256File(indexPath), descriptor.sha256, 'Input snapshot index changed.');
|
|
110
|
+
const index = JSON.parse(readFileSync(indexPath, 'utf8'));
|
|
111
|
+
assert.ok(index.schemaVersion === 1 && index.kind === 'skillfit.eval-inputs' && Array.isArray(index.entries), 'Invalid input snapshot index.');
|
|
112
|
+
const inputs = selectedInputs(plan.inputs), request = requestInput(plan.guardFiles);
|
|
113
|
+
const expectedLabels = [...inputs.map(input => ALIASES.get(input.label)), ...(request ? ['request'] : [])].sort();
|
|
114
|
+
assert.deepEqual(index.entries.map(entry => entry.label).sort(), expectedLabels, 'Input snapshot coverage changed.');
|
|
115
|
+
assert.ok(lstatSync(join(run, '_inputs')).isDirectory(), 'Input snapshot root must be a regular directory.');
|
|
116
|
+
const expectedFiles = [], expectedDirectories = [], roots = new Map();
|
|
117
|
+
for (const entry of index.entries) {
|
|
118
|
+
const path = entry.label === 'request' ? '_inputs/request.json' : `_inputs/${entry.label}`;
|
|
119
|
+
assert.equal(entry.path, path, 'Unsafe input snapshot root.');
|
|
120
|
+
if (entry.label === 'request') {
|
|
121
|
+
assert.equal(entry.sha256, request.sha256);
|
|
122
|
+
assert.equal(sha256File(packageMember(run, path)), request.sha256, 'Input request snapshot changed.');
|
|
123
|
+
assert.deepEqual(entry.files, []);
|
|
124
|
+
assert.deepEqual(entry.directories, []);
|
|
125
|
+
assert.deepEqual(entry.executableFiles, []);
|
|
126
|
+
expectedFiles.push('request.json');
|
|
127
|
+
roots.set(entry.label, join(run, path));
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const input = inputs.find(input => ALIASES.get(input.label) === entry.label);
|
|
131
|
+
assert.deepEqual(entry.files, input.files, 'Input snapshot file coverage changed.');
|
|
132
|
+
assert.equal(entry.sha256, input.sha256);
|
|
133
|
+
const root = join(run, path);
|
|
134
|
+
assert.ok(lstatSync(root).isDirectory(), 'Input snapshot root must be a regular directory.');
|
|
135
|
+
for (const file of entry.files)
|
|
136
|
+
packageMember(root, file);
|
|
137
|
+
assert.deepEqual(packageFiles(root), entry.files, 'Input snapshot inventory changed.');
|
|
138
|
+
assert.deepEqual(inputDirectories(root), entry.directories, 'Input snapshot directories changed.');
|
|
139
|
+
assert.ok(Array.isArray(entry.executableFiles) && entry.executableFiles.every(file => entry.files.includes(file)), 'Invalid snapshot executable file list.');
|
|
140
|
+
if (process.platform !== 'win32')
|
|
141
|
+
assert.deepEqual(entry.files.filter(file => (lstatSync(join(root, file)).mode & 0o111) !== 0), entry.executableFiles, 'Input snapshot executable modes changed.');
|
|
142
|
+
assert.equal(hashFileSet(root, entry.files), input.sha256, `Input snapshot hash mismatch: ${entry.label}`);
|
|
143
|
+
expectedFiles.push(...entry.files.map(file => `${entry.label}/${file}`));
|
|
144
|
+
roots.set(entry.label, root);
|
|
145
|
+
expectedDirectories.push(entry.label, ...entry.directories.map(dir => `${entry.label}/${dir}`));
|
|
146
|
+
}
|
|
147
|
+
assert.deepEqual(packageFiles(join(run, '_inputs')), expectedFiles.sort(), 'Input snapshot inventory changed.');
|
|
148
|
+
assert.deepEqual(inputDirectories(join(run, '_inputs')), expectedDirectories.sort(), 'Input snapshot directories changed.');
|
|
149
|
+
return { entries: index.entries, roots };
|
|
150
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
export class EvaluationInterrupted extends Error {
|
|
3
|
+
signalName;
|
|
4
|
+
receivedAt = new Date().toISOString();
|
|
5
|
+
exitCode;
|
|
6
|
+
constructor(signalName) {
|
|
7
|
+
super(`Evaluation interrupted by ${signalName}; no further calls. Retained receipts must not be retried or replaced automatically.`);
|
|
8
|
+
this.signalName = signalName;
|
|
9
|
+
this.name = 'EvaluationInterrupted';
|
|
10
|
+
this.exitCode = signalName === 'SIGINT' ? 130 : 143;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// The cancellation belongs to this asynchronous evaluation, including its git,
|
|
14
|
+
// verifier and judge work. Imports, previews and unrelated commands install no handlers.
|
|
15
|
+
const evaluations = new AsyncLocalStorage();
|
|
16
|
+
export function evaluationSignal() {
|
|
17
|
+
return evaluations.getStore();
|
|
18
|
+
}
|
|
19
|
+
export function throwIfEvaluationInterrupted() {
|
|
20
|
+
evaluationSignal()?.throwIfAborted();
|
|
21
|
+
}
|
|
22
|
+
export async function withEvaluationInterrupts(operation) {
|
|
23
|
+
if (evaluationSignal())
|
|
24
|
+
return operation();
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
const interrupt = (signal) => {
|
|
27
|
+
if (controller.signal.aborted)
|
|
28
|
+
return;
|
|
29
|
+
const reason = new EvaluationInterrupted(signal);
|
|
30
|
+
process.exitCode = reason.exitCode;
|
|
31
|
+
process.stderr.write(`${signal}: stopping evaluation processes and sealing retained records…\n`);
|
|
32
|
+
controller.abort(reason);
|
|
33
|
+
};
|
|
34
|
+
const onInt = () => interrupt('SIGINT'), onTerm = () => interrupt('SIGTERM');
|
|
35
|
+
process.on('SIGINT', onInt);
|
|
36
|
+
process.on('SIGTERM', onTerm);
|
|
37
|
+
try {
|
|
38
|
+
return await evaluations.run(controller.signal, async () => {
|
|
39
|
+
const result = await operation();
|
|
40
|
+
throwIfEvaluationInterrupted();
|
|
41
|
+
return result;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
process.removeListener('SIGINT', onInt);
|
|
46
|
+
process.removeListener('SIGTERM', onTerm);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { test } from 'node:test';
|
|
3
|
+
import { evaluationSignal, withEvaluationInterrupts } from './interruption.js';
|
|
4
|
+
const counts = () => [process.listenerCount('SIGINT'), process.listenerCount('SIGTERM')];
|
|
5
|
+
test('normal and failed operations restore signal handlers and asynchronous context', async () => {
|
|
6
|
+
const before = counts();
|
|
7
|
+
assert.equal(evaluationSignal(), undefined);
|
|
8
|
+
assert.equal(await withEvaluationInterrupts(async () => {
|
|
9
|
+
assert.ok(evaluationSignal());
|
|
10
|
+
await Promise.resolve();
|
|
11
|
+
assert.ok(evaluationSignal());
|
|
12
|
+
return 'done';
|
|
13
|
+
}), 'done');
|
|
14
|
+
assert.deepEqual(counts(), before);
|
|
15
|
+
assert.equal(evaluationSignal(), undefined);
|
|
16
|
+
await assert.rejects(withEvaluationInterrupts(async () => { throw new Error('offline setup failed'); }), /offline setup failed/);
|
|
17
|
+
assert.deepEqual(counts(), before);
|
|
18
|
+
assert.equal(evaluationSignal(), undefined);
|
|
19
|
+
});
|
|
20
|
+
test('concurrent operations keep distinct cancellation contexts and clean up all handlers', async () => {
|
|
21
|
+
const before = counts();
|
|
22
|
+
const signals = await Promise.all([1, 2].map(() => withEvaluationInterrupts(async () => {
|
|
23
|
+
const signal = evaluationSignal();
|
|
24
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
25
|
+
assert.equal(evaluationSignal(), signal);
|
|
26
|
+
return signal;
|
|
27
|
+
})));
|
|
28
|
+
assert.notEqual(signals[0], signals[1]);
|
|
29
|
+
assert.deepEqual(counts(), before);
|
|
30
|
+
assert.equal(evaluationSignal(), undefined);
|
|
31
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstatSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
|
|
3
|
+
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
4
|
+
export function packageFiles(root, prefix = '') {
|
|
5
|
+
const files = [];
|
|
6
|
+
for (const entry of readdirSync(join(root, prefix), { withFileTypes: true })) {
|
|
7
|
+
if (entry.name === '.git')
|
|
8
|
+
continue;
|
|
9
|
+
const path = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
10
|
+
if (entry.isSymbolicLink())
|
|
11
|
+
throw new Error(`Portable packages do not support symbolic links: ${path}`);
|
|
12
|
+
if (entry.isDirectory())
|
|
13
|
+
files.push(...packageFiles(root, path));
|
|
14
|
+
else if (entry.isFile())
|
|
15
|
+
files.push(path);
|
|
16
|
+
else
|
|
17
|
+
throw new Error(`Unsupported artifact: ${path}`);
|
|
18
|
+
}
|
|
19
|
+
return files.sort();
|
|
20
|
+
}
|
|
21
|
+
export function packageMember(root, path) {
|
|
22
|
+
if (!path || isAbsolute(path) || /^[A-Za-z]:/.test(path) || path.includes('\\') || path.includes('\0') ||
|
|
23
|
+
path.split('/').some(part => !part || part === '.' || part === '..' || part === '.git'))
|
|
24
|
+
throw new Error(`Unsafe package path: ${path}`);
|
|
25
|
+
const target = resolve(root, path), rel = relative(realpathSync(root), realpathSync(target));
|
|
26
|
+
if (isAbsolute(rel) || rel === '..' || rel.startsWith(`..${sep}`) || !lstatSync(target).isFile())
|
|
27
|
+
throw new Error(`Package file escapes its root: ${path}`);
|
|
28
|
+
return target;
|
|
29
|
+
}
|
|
30
|
+
export function packageHash(path) {
|
|
31
|
+
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
32
|
+
}
|
|
33
|
+
/** Checksums detect changed/missing files; they do not authenticate an unknown publisher. */
|
|
34
|
+
export function verifyReplayPackage(root) {
|
|
35
|
+
const metadata = JSON.parse(readFileSync(packageMember(root, 'replay-package.json'), 'utf8'));
|
|
36
|
+
if (metadata.schemaVersion !== 1 || metadata.kind !== 'skillfit.replay-package' ||
|
|
37
|
+
typeof metadata.sourcePlanSha256 !== 'string' || !/^[a-f0-9]{64}$/.test(metadata.sourcePlanSha256) ||
|
|
38
|
+
typeof metadata.hasManifest !== 'boolean' || !['completed', 'stopped', 'incomplete'].includes(metadata.nativeStatus) ||
|
|
39
|
+
!metadata.files || typeof metadata.files !== 'object' || Array.isArray(metadata.files))
|
|
40
|
+
throw new Error('Invalid replay-package.json.');
|
|
41
|
+
const actual = packageFiles(root).filter(path => path !== 'replay-package.json');
|
|
42
|
+
if (JSON.stringify(actual) !== JSON.stringify(Object.keys(metadata.files).sort()))
|
|
43
|
+
throw new Error('Portable file inventory changed.');
|
|
44
|
+
for (const [path, hash] of Object.entries(metadata.files)) {
|
|
45
|
+
if (typeof hash !== 'string' || !/^[a-f0-9]{64}$/.test(hash) || packageHash(packageMember(root, path)) !== hash)
|
|
46
|
+
throw new Error(`Portable file hash mismatch: ${path}`);
|
|
47
|
+
}
|
|
48
|
+
if (packageHash(packageMember(root, 'run/_plan.json')) !== metadata.sourcePlanSha256)
|
|
49
|
+
throw new Error('Portable native plan changed.');
|
|
50
|
+
const session = JSON.parse(readFileSync(packageMember(root, 'run/_session.json'), 'utf8'));
|
|
51
|
+
if (session.planSha256 !== metadata.sourcePlanSha256 || session.status !== metadata.nativeStatus)
|
|
52
|
+
throw new Error('Portable session differs from its source plan.');
|
|
53
|
+
for (const file of ['run/_artifacts.json', 'inputs/bench/bench.json', 'runtime/package.json', 'runtime/dist/cli.js', 'reproduce.mjs']) {
|
|
54
|
+
if (!(file in metadata.files))
|
|
55
|
+
throw new Error(`Required portable file is missing: ${file}`);
|
|
56
|
+
}
|
|
57
|
+
if (metadata.hasManifest !== ('run/manifest.json' in metadata.files))
|
|
58
|
+
throw new Error('Portable manifest coverage changed.');
|
|
59
|
+
return metadata;
|
|
60
|
+
}
|
|
61
|
+
/** Serialize these dependency-free functions so old pinned runtimes need no new export API. */
|
|
62
|
+
export function portableReproducer() {
|
|
63
|
+
return `import {createHash} from 'node:crypto';
|
|
64
|
+
import {lstatSync,readFileSync,readdirSync,realpathSync} from 'node:fs';
|
|
65
|
+
import {isAbsolute,join,relative,resolve,sep} from 'node:path';
|
|
66
|
+
import {fileURLToPath} from 'node:url';
|
|
67
|
+
import {spawnSync} from 'node:child_process';
|
|
68
|
+
${packageFiles.toString()}
|
|
69
|
+
${packageMember.toString()}
|
|
70
|
+
${packageHash.toString()}
|
|
71
|
+
${verifyReplayPackage.toString()}
|
|
72
|
+
try {
|
|
73
|
+
const root=fileURLToPath(new URL('.',import.meta.url)), metadata=verifyReplayPackage(root);
|
|
74
|
+
if(process.argv.includes('--verify-only')) {
|
|
75
|
+
console.log(JSON.stringify({schemaVersion:1,kind:'skillfit.replay-package-verification',verified:true,files:Object.keys(metadata.files).length,nativeStatus:metadata.nativeStatus,modelCalls:0}));
|
|
76
|
+
} else {
|
|
77
|
+
const child=spawnSync(process.execPath,[join(root,'runtime/dist/cli.js'),'report','eval',join(root,'run'),'--json','--replay','--bench',join(root,'inputs/bench')],{cwd:root,encoding:'utf8',maxBuffer:32*1024*1024});
|
|
78
|
+
if(child.error||child.status!==0) throw new Error(child.error?.message||child.stderr||'Pinned offline replay failed.');
|
|
79
|
+
const result=JSON.parse(child.stdout);
|
|
80
|
+
if(metadata.hasManifest&&!result.evidence?.verified) throw new Error('Offline evidence audit failed: '+JSON.stringify(result.evidence));
|
|
81
|
+
console.log(JSON.stringify({...result,portableReplay:{verified:true,sourcePlanSha256:metadata.sourcePlanSha256,modelCalls:0,scope:'Offline evidence reproduction; no new observations or upgrade authorization.'}},null,2));
|
|
82
|
+
}
|
|
83
|
+
} catch(error) { console.error(error.message); process.exitCode=2; }
|
|
84
|
+
`;
|
|
85
|
+
}
|
package/dist/harness/runner.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import { cpSync, existsSync, mkdirSync, readFileSync,
|
|
2
|
+
import { appendFileSync, cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
import { MOCK_MARKER_FILE, RUN_GROUP_PATTERN } from './constants.js';
|
|
5
5
|
import { assertInstalledSkillFixtures, assertSkillRevisionTargets, installSkillResources, installedSkillDestination } from './installed-skill.js';
|
|
6
6
|
import { collectInstalledSkillFingerprint } from './bundle.js';
|
|
7
7
|
import { judgePair } from './judge.js';
|
|
8
8
|
import { killTree, treeSpawnOptions } from './kill-tree.js';
|
|
9
|
+
import { evaluationSignal, throwIfEvaluationInterrupted } from './interruption.js';
|
|
9
10
|
import { assertInputModeSupported, buildTaskPrompt, snapshotRepoFiles } from './prompt.js';
|
|
10
11
|
import { buildWarnings, verdictFor, } from './report.js';
|
|
11
12
|
import { mcnemarExactP, pairedDeltaBootstrapCI, pairedScoreBootstrapCI } from './stats.js';
|
|
@@ -17,6 +18,7 @@ import { ExecutorFailure } from './types.js';
|
|
|
17
18
|
import { summarizeCosts } from './costs.js';
|
|
18
19
|
import { executionClock } from './execution-timing.js';
|
|
19
20
|
import { verdictFromOutput } from './verifier-summary.js';
|
|
21
|
+
import { assertSpendingCanContinue, parseSpendingBudget, spendingBudgetState } from './eval-budget.js';
|
|
20
22
|
function applyOverlay(overlayDir, runDir) {
|
|
21
23
|
for (const rel of listFilesRecursive(overlayDir)) {
|
|
22
24
|
const destination = join(runDir, rel);
|
|
@@ -27,6 +29,9 @@ function applyOverlay(overlayDir, runDir) {
|
|
|
27
29
|
const VERIFIER_TIMEOUT_MS = 2 * 60 * 1000;
|
|
28
30
|
const MAX_PROCESS_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
29
31
|
function runProcess(command, args, cwd, timeoutMs) {
|
|
32
|
+
const signal = evaluationSignal();
|
|
33
|
+
if (signal?.aborted)
|
|
34
|
+
return Promise.resolve({ exitCode: null, output: '', error: signal.reason.message });
|
|
30
35
|
return new Promise((resolvePromise) => {
|
|
31
36
|
let child;
|
|
32
37
|
try {
|
|
@@ -42,15 +47,47 @@ function runProcess(command, args, cwd, timeoutMs) {
|
|
|
42
47
|
let bytes = 0;
|
|
43
48
|
let timedOut = false;
|
|
44
49
|
let overflow = false;
|
|
50
|
+
let stopping = false;
|
|
51
|
+
let settled = false;
|
|
52
|
+
let drainTimer;
|
|
53
|
+
const finish = (result) => {
|
|
54
|
+
if (settled)
|
|
55
|
+
return;
|
|
56
|
+
settled = true;
|
|
57
|
+
clearTimeout(timer);
|
|
58
|
+
clearTimeout(drainTimer);
|
|
59
|
+
signal?.removeEventListener('abort', onAbort);
|
|
60
|
+
resolvePromise(result);
|
|
61
|
+
};
|
|
62
|
+
const result = (code) => ({
|
|
63
|
+
exitCode: signal?.aborted || timedOut || overflow ? null : code,
|
|
64
|
+
output: timedOut ? `${output}\n[timed out after ${timeoutMs}ms]` : output,
|
|
65
|
+
error: signal?.aborted ? signal.reason.message : overflow
|
|
66
|
+
? `output exceeded ${MAX_PROCESS_OUTPUT_BYTES} bytes` : timedOut ? `timed out after ${timeoutMs}ms` : null,
|
|
67
|
+
});
|
|
68
|
+
const stop = () => {
|
|
69
|
+
if (stopping || settled)
|
|
70
|
+
return;
|
|
71
|
+
stopping = true;
|
|
72
|
+
killTree(child);
|
|
73
|
+
drainTimer = setTimeout(() => {
|
|
74
|
+
child.stdin?.destroy();
|
|
75
|
+
child.stdout.destroy();
|
|
76
|
+
child.stderr.destroy();
|
|
77
|
+
child.unref();
|
|
78
|
+
finish(result(null));
|
|
79
|
+
}, 2000);
|
|
80
|
+
};
|
|
81
|
+
const onAbort = () => stop();
|
|
45
82
|
const timer = setTimeout(() => {
|
|
46
83
|
timedOut = true;
|
|
47
|
-
|
|
84
|
+
stop();
|
|
48
85
|
}, timeoutMs);
|
|
49
86
|
const take = (chunk) => {
|
|
50
87
|
bytes += chunk.length;
|
|
51
88
|
if (bytes > MAX_PROCESS_OUTPUT_BYTES) {
|
|
52
89
|
overflow = true;
|
|
53
|
-
|
|
90
|
+
stop();
|
|
54
91
|
return;
|
|
55
92
|
}
|
|
56
93
|
output += chunk.toString('utf8');
|
|
@@ -62,18 +99,14 @@ function runProcess(command, args, cwd, timeoutMs) {
|
|
|
62
99
|
child.stdin?.on('error', () => { });
|
|
63
100
|
child.stdin?.end();
|
|
64
101
|
child.on('error', (error) => {
|
|
65
|
-
|
|
66
|
-
resolvePromise({ exitCode: null, output, error: error.message });
|
|
102
|
+
finish({ exitCode: null, output, error: error.message });
|
|
67
103
|
});
|
|
68
104
|
child.on('close', (code) => {
|
|
69
|
-
|
|
70
|
-
const limited = overflow ? `output exceeded ${MAX_PROCESS_OUTPUT_BYTES} bytes` : null;
|
|
71
|
-
resolvePromise({
|
|
72
|
-
exitCode: timedOut || overflow ? null : code,
|
|
73
|
-
output: timedOut ? `${output}\n[timed out after ${timeoutMs}ms]` : output,
|
|
74
|
-
error: limited ?? (timedOut ? `timed out after ${timeoutMs}ms` : null),
|
|
75
|
-
});
|
|
105
|
+
finish(result(code));
|
|
76
106
|
});
|
|
107
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
108
|
+
if (signal?.aborted)
|
|
109
|
+
onAbort();
|
|
77
110
|
});
|
|
78
111
|
}
|
|
79
112
|
export async function gitInit(dir) {
|
|
@@ -117,6 +150,7 @@ export async function engagementError(output, verifierKind, runDir, gitInitializ
|
|
|
117
150
|
return ENGAGEMENT_ERROR;
|
|
118
151
|
}
|
|
119
152
|
export async function runTrial(plan, taskId, condition, trial) {
|
|
153
|
+
throwIfEvaluationInterrupted();
|
|
120
154
|
const { bench, executor } = plan;
|
|
121
155
|
const target = condition === 'baseline' && plan.baselineTarget ? plan.baselineTarget : plan.target;
|
|
122
156
|
if (plan.baselineTarget) {
|
|
@@ -164,6 +198,7 @@ export async function runTrial(plan, taskId, condition, trial) {
|
|
|
164
198
|
installNativeDiffTool(runDir);
|
|
165
199
|
}
|
|
166
200
|
const gitInitialized = await gitInit(runDir);
|
|
201
|
+
throwIfEvaluationInterrupted();
|
|
167
202
|
const taskPromptText = readFileSync(join(bench.dir, task.prompt), 'utf8');
|
|
168
203
|
const prompt = buildTaskPrompt(taskPromptText, snapshot, condition === 'treatment' && !plan.skillInstallDir ? target.payload : null,
|
|
169
204
|
// Workspace configuration experiments must let the agent use its configured tools and inspect
|
|
@@ -443,6 +478,7 @@ async function judgeTaskTrials(plan, taskId, outcomes) {
|
|
|
443
478
|
writeFileSync(join(taskDir, `judge-trial-${trial}.json`), `${JSON.stringify({ trial, seed, ...result }, null, 2)}\n`, 'utf8');
|
|
444
479
|
}
|
|
445
480
|
catch (error) {
|
|
481
|
+
throwIfEvaluationInterrupted();
|
|
446
482
|
plan.log?.(`Judge failed for ${task.id} trial ${trial}: ${error.message}`);
|
|
447
483
|
}
|
|
448
484
|
}
|
|
@@ -566,6 +602,9 @@ function summarizeTask(taskId, outcomes, survivors, judgeResults, readObservatio
|
|
|
566
602
|
};
|
|
567
603
|
}
|
|
568
604
|
export async function runExperiment(plan) {
|
|
605
|
+
const budget = plan.spendingBudget === undefined ? undefined : parseSpendingBudget(plan.spendingBudget);
|
|
606
|
+
if (budget && plan.judge)
|
|
607
|
+
throw new Error('spendingBudget does not cover judge calls.');
|
|
569
608
|
assertInputModeSupported(plan.inputMode ?? 'snapshot', plan.executor);
|
|
570
609
|
const pairOrder = plan.pairOrder ?? 'baseline-first';
|
|
571
610
|
if (pairOrder !== 'baseline-first' && pairOrder !== 'balanced')
|
|
@@ -589,9 +628,10 @@ export async function runExperiment(plan) {
|
|
|
589
628
|
throw new Error(`trials must be an integer between 1 and 20, got ${plan.trials}`);
|
|
590
629
|
}
|
|
591
630
|
const groupDir = join(plan.runsRoot, plan.runGroup);
|
|
592
|
-
if (existsSync(groupDir)
|
|
593
|
-
|
|
594
|
-
|
|
631
|
+
if (existsSync(groupDir)) {
|
|
632
|
+
if (plan.session?.groupDir !== resolve(groupDir))
|
|
633
|
+
throw new Error(`Run group directory already exists: ${groupDir}`);
|
|
634
|
+
plan.session.assertPrepared();
|
|
595
635
|
}
|
|
596
636
|
mkdirSync(groupDir, { recursive: true });
|
|
597
637
|
if (plan.skillInstallDir)
|
|
@@ -599,6 +639,14 @@ export async function runExperiment(plan) {
|
|
|
599
639
|
const taskSummaries = [];
|
|
600
640
|
const allOutcomes = { baseline: [], treatment: [] };
|
|
601
641
|
const allSurvivors = { baseline: [], treatment: [] };
|
|
642
|
+
const budgetObservations = [];
|
|
643
|
+
const budgetEvent = (phase, taskId, condition, trial) => {
|
|
644
|
+
if (!budget)
|
|
645
|
+
return null;
|
|
646
|
+
const state = spendingBudgetState(budget, budgetObservations);
|
|
647
|
+
appendFileSync(join(groupDir, '_budget.jsonl'), JSON.stringify({ phase, taskId, condition, trial, state }) + '\n', 'utf8');
|
|
648
|
+
return state;
|
|
649
|
+
};
|
|
602
650
|
for (const [taskIndex, task] of plan.bench.tasks.entries()) {
|
|
603
651
|
const outcomes = { baseline: [], treatment: [] };
|
|
604
652
|
// Interleaved: the trial loop is outermost so the two arms of a pair run adjacently. Running
|
|
@@ -606,10 +654,21 @@ export async function runExperiment(plan) {
|
|
|
606
654
|
// provider drift or rate-limit degradation would land entirely on one arm.
|
|
607
655
|
for (let trial = 1; trial <= plan.trials; trial++) {
|
|
608
656
|
for (const condition of pairConditions(pairOrder, taskIndex, trial)) {
|
|
657
|
+
throwIfEvaluationInterrupted();
|
|
658
|
+
const before = budgetEvent('before-call', task.id, condition, trial);
|
|
659
|
+
if (before)
|
|
660
|
+
assertSpendingCanContinue(before);
|
|
609
661
|
plan.log?.(`Running ${task.id} / ${condition} / trial ${trial}…`);
|
|
610
662
|
const outcome = await runTrial(plan, task.id, condition, trial);
|
|
611
663
|
outcomes[condition].push(outcome);
|
|
612
664
|
allOutcomes[condition].push(outcome);
|
|
665
|
+
budgetObservations.push(outcome);
|
|
666
|
+
const after = budgetEvent('after-call', task.id, condition, trial);
|
|
667
|
+
throwIfEvaluationInterrupted();
|
|
668
|
+
// A reached line prevents the next call; incomplete or failed evidence stops even
|
|
669
|
+
// after the final scheduled call. One in-flight invocation may cross a stop line.
|
|
670
|
+
if (after && (after.incomplete.length || after.reason === 'EXECUTION_FAILED'))
|
|
671
|
+
assertSpendingCanContinue(after);
|
|
613
672
|
}
|
|
614
673
|
}
|
|
615
674
|
const survivors = pairedSurvivors(outcomes);
|
package/dist/harness/trigger.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { cpSync, existsSync, mkdirSync, readFileSync,
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { MOCK_MARKER_FILE, RUN_GROUP_PATTERN } from './constants.js';
|
|
4
4
|
import { collectInstalledSkillFingerprint, collectSkillBundle } from './bundle.js';
|
|
5
5
|
import { OUTPUT_CONTRACT } from './prompt.js';
|
|
6
6
|
import { engagementError, gitInit, runVerifier, verifierFailure, verifierLogFor } from './runner.js';
|
|
7
7
|
import { wilson95 } from './stats.js';
|
|
8
|
+
import { throwIfEvaluationInterrupted } from './interruption.js';
|
|
9
|
+
import { ExecutorFailure } from './types.js';
|
|
8
10
|
import { verdictFromOutput } from './verifier-summary.js';
|
|
9
11
|
async function runTriggerTrial(plan, taskId, trial, installedSkill) {
|
|
12
|
+
throwIfEvaluationInterrupted();
|
|
10
13
|
const task = plan.bench.tasks.find((t) => t.id === taskId);
|
|
11
14
|
if (!task)
|
|
12
15
|
throw new Error(`Unknown task: ${taskId}`);
|
|
@@ -18,6 +21,7 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
|
|
|
18
21
|
cpSync(join(plan.bench.dir, task.fixture), runDir, { recursive: true });
|
|
19
22
|
rmSync(join(runDir, MOCK_MARKER_FILE), { force: true });
|
|
20
23
|
const gitInitialized = await gitInit(runDir);
|
|
24
|
+
throwIfEvaluationInterrupted();
|
|
21
25
|
const taskPromptText = readFileSync(join(plan.bench.dir, task.promptTrigger ?? task.prompt), 'utf8');
|
|
22
26
|
const prompt = `${[taskPromptText.trimEnd(), OUTPUT_CONTRACT].join('\n\n')}\n`;
|
|
23
27
|
writeFileSync(join(runDir, '_prompt.txt'), prompt, 'utf8');
|
|
@@ -43,6 +47,7 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
|
|
|
43
47
|
let rawOutput = null;
|
|
44
48
|
let error = null;
|
|
45
49
|
let tokens = null;
|
|
50
|
+
let failedUsage;
|
|
46
51
|
let triggered = null;
|
|
47
52
|
try {
|
|
48
53
|
if (!gitInitialized && task.verifierKind === 'command') {
|
|
@@ -57,6 +62,13 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
|
|
|
57
62
|
}
|
|
58
63
|
catch (executorError) {
|
|
59
64
|
error = executorError.message;
|
|
65
|
+
if (executorError instanceof ExecutorFailure) {
|
|
66
|
+
output = executorError.result.output;
|
|
67
|
+
rawOutput = executorError.result.rawOutput ?? null;
|
|
68
|
+
tokens = executorError.result.tokens ?? null;
|
|
69
|
+
triggered = executorError.result.skillTriggered ?? null;
|
|
70
|
+
failedUsage = executorError.result.usageStatus ?? 'unknown';
|
|
71
|
+
}
|
|
60
72
|
}
|
|
61
73
|
if (error === null) {
|
|
62
74
|
error = await engagementError(output, task.verifierKind, runDir, gitInitialized);
|
|
@@ -100,6 +112,7 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
|
|
|
100
112
|
checks,
|
|
101
113
|
error,
|
|
102
114
|
tokens,
|
|
115
|
+
...(failedUsage ? { usageStatus: failedUsage } : {}),
|
|
103
116
|
};
|
|
104
117
|
writeFileSync(join(runDir, '_result.json'), `${JSON.stringify({
|
|
105
118
|
schemaVersion: 1,
|
|
@@ -229,9 +242,10 @@ export async function runTriggerExperiment(plan) {
|
|
|
229
242
|
throw new Error('Trigger mode requires a real CLI executor with trigger detection; the mock executor cannot invoke skills.');
|
|
230
243
|
}
|
|
231
244
|
const groupDir = join(plan.runsRoot, plan.runGroup);
|
|
232
|
-
if (existsSync(groupDir)
|
|
233
|
-
|
|
234
|
-
|
|
245
|
+
if (existsSync(groupDir)) {
|
|
246
|
+
if (plan.session?.groupDir !== resolve(groupDir))
|
|
247
|
+
throw new Error(`Run group directory already exists: ${groupDir}`);
|
|
248
|
+
plan.session.assertPrepared();
|
|
235
249
|
}
|
|
236
250
|
const installedSkill = collectInstalledSkillFingerprint(plan.skill.sourceDir);
|
|
237
251
|
if (collectSkillBundle(plan.skill.sourceDir, plan.skill.name).sha256 !== plan.skill.sha256) {
|
|
@@ -247,8 +261,10 @@ export async function runTriggerExperiment(plan) {
|
|
|
247
261
|
for (const task of eligible) {
|
|
248
262
|
const records = [];
|
|
249
263
|
for (let trial = 1; trial <= plan.trials; trial++) {
|
|
264
|
+
throwIfEvaluationInterrupted();
|
|
250
265
|
plan.log?.(`Running ${task.id} / installed / trial ${trial}…`);
|
|
251
266
|
records.push(await runTriggerTrial(plan, task.id, trial, installedSkill));
|
|
267
|
+
throwIfEvaluationInterrupted();
|
|
252
268
|
}
|
|
253
269
|
taskSummaries.push(summarizeTriggerTask(task.id, task.shouldTrigger ?? false, task.triggerClass, records));
|
|
254
270
|
}
|