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
package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.d.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export class TimeoutError extends Error {
|
|
2
|
+
readonly name: 'TimeoutError';
|
|
3
|
+
constructor(message?: string);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type ClearablePromise<T> = {
|
|
7
|
+
/**
|
|
8
|
+
Clear the timeout.
|
|
9
|
+
*/
|
|
10
|
+
clear: () => void;
|
|
11
|
+
} & Promise<T>;
|
|
12
|
+
|
|
13
|
+
export type Options<ReturnType> = {
|
|
14
|
+
/**
|
|
15
|
+
Milliseconds before timing out.
|
|
16
|
+
|
|
17
|
+
Passing `Infinity` will cause it to never time out.
|
|
18
|
+
*/
|
|
19
|
+
milliseconds: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
Do something other than rejecting with an error on timeout.
|
|
23
|
+
|
|
24
|
+
You could for example retry:
|
|
25
|
+
|
|
26
|
+
@example
|
|
27
|
+
```
|
|
28
|
+
import {setTimeout} from 'node:timers/promises';
|
|
29
|
+
import pTimeout from 'p-timeout';
|
|
30
|
+
|
|
31
|
+
const delayedPromise = () => setTimeout(200);
|
|
32
|
+
|
|
33
|
+
await pTimeout(delayedPromise(), {
|
|
34
|
+
milliseconds: 50,
|
|
35
|
+
fallback: () => {
|
|
36
|
+
return pTimeout(delayedPromise(), {
|
|
37
|
+
milliseconds: 300
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
*/
|
|
43
|
+
fallback?: () => ReturnType | Promise<ReturnType>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
Specify a custom error message or error to throw when it times out:
|
|
47
|
+
|
|
48
|
+
- `message: 'too slow'` will throw `TimeoutError('too slow')`
|
|
49
|
+
- `message: new MyCustomError('it’s over 9000')` will throw the same error instance
|
|
50
|
+
- `message: false` will make the promise resolve with `undefined` instead of rejecting
|
|
51
|
+
|
|
52
|
+
If you do a custom error, it's recommended to sub-class `TimeoutError`:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
import {TimeoutError} from 'p-timeout';
|
|
56
|
+
|
|
57
|
+
class MyCustomError extends TimeoutError {
|
|
58
|
+
name = "MyCustomError";
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
*/
|
|
62
|
+
message?: string | Error | false;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
Custom implementations for the `setTimeout` and `clearTimeout` functions.
|
|
66
|
+
|
|
67
|
+
Useful for testing purposes, in particular to work around [`sinon.useFakeTimers()`](https://sinonjs.org/releases/latest/fake-timers/).
|
|
68
|
+
|
|
69
|
+
@example
|
|
70
|
+
```
|
|
71
|
+
import pTimeout from 'p-timeout';
|
|
72
|
+
import sinon from 'sinon';
|
|
73
|
+
|
|
74
|
+
const originalSetTimeout = setTimeout;
|
|
75
|
+
const originalClearTimeout = clearTimeout;
|
|
76
|
+
|
|
77
|
+
sinon.useFakeTimers();
|
|
78
|
+
|
|
79
|
+
// Use `pTimeout` without being affected by `sinon.useFakeTimers()`:
|
|
80
|
+
await pTimeout(doSomething(), {
|
|
81
|
+
milliseconds: 2000,
|
|
82
|
+
customTimers: {
|
|
83
|
+
setTimeout: originalSetTimeout,
|
|
84
|
+
clearTimeout: originalClearTimeout
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
*/
|
|
89
|
+
readonly customTimers?: {
|
|
90
|
+
setTimeout: typeof globalThis.setTimeout;
|
|
91
|
+
clearTimeout: typeof globalThis.clearTimeout;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
You can abort the promise using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
96
|
+
|
|
97
|
+
_Requires Node.js 16 or later._
|
|
98
|
+
|
|
99
|
+
@example
|
|
100
|
+
```
|
|
101
|
+
import pTimeout from 'p-timeout';
|
|
102
|
+
import delay from 'delay';
|
|
103
|
+
|
|
104
|
+
const delayedPromise = delay(3000);
|
|
105
|
+
|
|
106
|
+
const abortController = new AbortController();
|
|
107
|
+
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
abortController.abort();
|
|
110
|
+
}, 100);
|
|
111
|
+
|
|
112
|
+
await pTimeout(delayedPromise, {
|
|
113
|
+
milliseconds: 2000,
|
|
114
|
+
signal: abortController.signal
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
*/
|
|
118
|
+
signal?: globalThis.AbortSignal;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
Timeout a promise after a specified amount of time.
|
|
123
|
+
|
|
124
|
+
If you pass in a cancelable promise, specifically a promise with a `.cancel()` method, that method will be called when the `pTimeout` promise times out.
|
|
125
|
+
|
|
126
|
+
@param input - Promise to decorate.
|
|
127
|
+
@returns A decorated `input` that times out after `milliseconds` time. It has a `.clear()` method that clears the timeout.
|
|
128
|
+
|
|
129
|
+
@example
|
|
130
|
+
```
|
|
131
|
+
import {setTimeout} from 'node:timers/promises';
|
|
132
|
+
import pTimeout from 'p-timeout';
|
|
133
|
+
|
|
134
|
+
const delayedPromise = () => setTimeout(200);
|
|
135
|
+
|
|
136
|
+
await pTimeout(delayedPromise(), {
|
|
137
|
+
milliseconds: 50,
|
|
138
|
+
fallback: () => {
|
|
139
|
+
return pTimeout(delayedPromise(), {milliseconds: 300});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
*/
|
|
144
|
+
export default function pTimeout<ValueType, ReturnType = ValueType>(
|
|
145
|
+
input: PromiseLike<ValueType>,
|
|
146
|
+
options: Options<ReturnType> & {message: false}
|
|
147
|
+
): ClearablePromise<ValueType | ReturnType | undefined>;
|
|
148
|
+
export default function pTimeout<ValueType, ReturnType = ValueType>(
|
|
149
|
+
input: PromiseLike<ValueType>,
|
|
150
|
+
options: Options<ReturnType>
|
|
151
|
+
): ClearablePromise<ValueType | ReturnType>;
|
package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export class TimeoutError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'TimeoutError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
An error to be thrown when the request is aborted by AbortController.
|
|
10
|
+
DOMException is thrown instead of this Error when DOMException is available.
|
|
11
|
+
*/
|
|
12
|
+
export class AbortError extends Error {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super();
|
|
15
|
+
this.name = 'AbortError';
|
|
16
|
+
this.message = message;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
TODO: Remove AbortError and just throw DOMException when targeting Node 18.
|
|
22
|
+
*/
|
|
23
|
+
const getDOMException = errorMessage => globalThis.DOMException === undefined
|
|
24
|
+
? new AbortError(errorMessage)
|
|
25
|
+
: new DOMException(errorMessage);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
TODO: Remove below function and just 'reject(signal.reason)' when targeting Node 18.
|
|
29
|
+
*/
|
|
30
|
+
const getAbortedReason = signal => {
|
|
31
|
+
const reason = signal.reason === undefined
|
|
32
|
+
? getDOMException('This operation was aborted.')
|
|
33
|
+
: signal.reason;
|
|
34
|
+
|
|
35
|
+
return reason instanceof Error ? reason : getDOMException(reason);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default function pTimeout(promise, options) {
|
|
39
|
+
const {
|
|
40
|
+
milliseconds,
|
|
41
|
+
fallback,
|
|
42
|
+
message,
|
|
43
|
+
customTimers = {setTimeout, clearTimeout},
|
|
44
|
+
} = options;
|
|
45
|
+
|
|
46
|
+
let timer;
|
|
47
|
+
let abortHandler;
|
|
48
|
+
|
|
49
|
+
const wrappedPromise = new Promise((resolve, reject) => {
|
|
50
|
+
if (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {
|
|
51
|
+
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (options.signal) {
|
|
55
|
+
const {signal} = options;
|
|
56
|
+
if (signal.aborted) {
|
|
57
|
+
reject(getAbortedReason(signal));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
abortHandler = () => {
|
|
61
|
+
reject(getAbortedReason(signal));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
signal.addEventListener('abort', abortHandler, {once: true});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (milliseconds === Number.POSITIVE_INFINITY) {
|
|
68
|
+
promise.then(resolve, reject);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// We create the error outside of `setTimeout` to preserve the stack trace.
|
|
73
|
+
const timeoutError = new TimeoutError();
|
|
74
|
+
|
|
75
|
+
timer = customTimers.setTimeout.call(undefined, () => {
|
|
76
|
+
if (fallback) {
|
|
77
|
+
try {
|
|
78
|
+
resolve(fallback());
|
|
79
|
+
} catch (error) {
|
|
80
|
+
reject(error);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (typeof promise.cancel === 'function') {
|
|
87
|
+
promise.cancel();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (message === false) {
|
|
91
|
+
resolve();
|
|
92
|
+
} else if (message instanceof Error) {
|
|
93
|
+
reject(message);
|
|
94
|
+
} else {
|
|
95
|
+
timeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;
|
|
96
|
+
reject(timeoutError);
|
|
97
|
+
}
|
|
98
|
+
}, milliseconds);
|
|
99
|
+
|
|
100
|
+
(async () => {
|
|
101
|
+
try {
|
|
102
|
+
resolve(await promise);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
reject(error);
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const cancelablePromise = wrappedPromise.finally(() => {
|
|
110
|
+
cancelablePromise.clear();
|
|
111
|
+
if (abortHandler && options.signal) {
|
|
112
|
+
options.signal.removeEventListener('abort', abortHandler);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
cancelablePromise.clear = () => {
|
|
117
|
+
customTimers.clearTimeout.call(undefined, timer);
|
|
118
|
+
timer = undefined;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return cancelablePromise;
|
|
122
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p-timeout",
|
|
3
|
+
"version": "6.1.3",
|
|
4
|
+
"description": "Timeout a promise after a specified amount of time",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/p-timeout",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": "./index.js",
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=14.16"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --test test.mjs"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"index.js",
|
|
25
|
+
"index.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"promise",
|
|
29
|
+
"timeout",
|
|
30
|
+
"error",
|
|
31
|
+
"invalidate",
|
|
32
|
+
"async",
|
|
33
|
+
"await",
|
|
34
|
+
"promises",
|
|
35
|
+
"time",
|
|
36
|
+
"out",
|
|
37
|
+
"cancel",
|
|
38
|
+
"bluebird"
|
|
39
|
+
],
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"ava": "^4.3.1",
|
|
42
|
+
"delay": "^5.0.0",
|
|
43
|
+
"in-range": "^3.0.0",
|
|
44
|
+
"p-cancelable": "^4.0.1",
|
|
45
|
+
"sinon": "^19.0.2",
|
|
46
|
+
"time-span": "^5.1.0",
|
|
47
|
+
"tsd": "^0.22.0",
|
|
48
|
+
"xo": "^0.54.2"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/readme.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# p-timeout
|
|
2
|
+
|
|
3
|
+
> Timeout a promise after a specified amount of time
|
|
4
|
+
|
|
5
|
+
> [!NOTE]
|
|
6
|
+
> You may want to use `AbortSignal.timeout()` instead. [Learn more.](#abortsignal)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install p-timeout
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import {setTimeout} from 'node:timers/promises';
|
|
18
|
+
import pTimeout from 'p-timeout';
|
|
19
|
+
|
|
20
|
+
const delayedPromise = setTimeout(200);
|
|
21
|
+
|
|
22
|
+
await pTimeout(delayedPromise, {
|
|
23
|
+
milliseconds: 50,
|
|
24
|
+
});
|
|
25
|
+
//=> [TimeoutError: Promise timed out after 50 milliseconds]
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
### pTimeout(input, options)
|
|
31
|
+
|
|
32
|
+
Returns a decorated `input` that times out after `milliseconds` time. It has a `.clear()` method that clears the timeout.
|
|
33
|
+
|
|
34
|
+
If you pass in a cancelable promise, specifically a promise with a `.cancel()` method, that method will be called when the `pTimeout` promise times out.
|
|
35
|
+
|
|
36
|
+
#### input
|
|
37
|
+
|
|
38
|
+
Type: `Promise`
|
|
39
|
+
|
|
40
|
+
Promise to decorate.
|
|
41
|
+
|
|
42
|
+
#### options
|
|
43
|
+
|
|
44
|
+
Type: `object`
|
|
45
|
+
|
|
46
|
+
##### milliseconds
|
|
47
|
+
|
|
48
|
+
Type: `number`
|
|
49
|
+
|
|
50
|
+
Milliseconds before timing out.
|
|
51
|
+
|
|
52
|
+
Passing `Infinity` will cause it to never time out.
|
|
53
|
+
|
|
54
|
+
##### message
|
|
55
|
+
|
|
56
|
+
Type: `string | Error | false`\
|
|
57
|
+
Default: `'Promise timed out after 50 milliseconds'`
|
|
58
|
+
|
|
59
|
+
Specify a custom error message or error to throw when it times out:
|
|
60
|
+
|
|
61
|
+
- `message: 'too slow'` will throw `TimeoutError('too slow')`
|
|
62
|
+
- `message: new MyCustomError('it’s over 9000')` will throw the same error instance
|
|
63
|
+
- `message: false` will make the promise resolve with `undefined` instead of rejecting
|
|
64
|
+
|
|
65
|
+
If you do a custom error, it's recommended to sub-class `TimeoutError`:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
import {TimeoutError} from 'p-timeout';
|
|
69
|
+
|
|
70
|
+
class MyCustomError extends TimeoutError {
|
|
71
|
+
name = "MyCustomError";
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
##### fallback
|
|
76
|
+
|
|
77
|
+
Type: `Function`
|
|
78
|
+
|
|
79
|
+
Do something other than rejecting with an error on timeout.
|
|
80
|
+
|
|
81
|
+
You could for example retry:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import {setTimeout} from 'node:timers/promises';
|
|
85
|
+
import pTimeout from 'p-timeout';
|
|
86
|
+
|
|
87
|
+
const delayedPromise = () => setTimeout(200);
|
|
88
|
+
|
|
89
|
+
await pTimeout(delayedPromise(), {
|
|
90
|
+
milliseconds: 50,
|
|
91
|
+
fallback: () => {
|
|
92
|
+
return pTimeout(delayedPromise(), {milliseconds: 300});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
##### customTimers
|
|
98
|
+
|
|
99
|
+
Type: `object` with function properties `setTimeout` and `clearTimeout`
|
|
100
|
+
|
|
101
|
+
Custom implementations for the `setTimeout` and `clearTimeout` functions.
|
|
102
|
+
|
|
103
|
+
Useful for testing purposes, in particular to work around [`sinon.useFakeTimers()`](https://sinonjs.org/releases/latest/fake-timers/).
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
import {setTimeout} from 'node:timers/promises';
|
|
109
|
+
import pTimeout from 'p-timeout';
|
|
110
|
+
|
|
111
|
+
const originalSetTimeout = setTimeout;
|
|
112
|
+
const originalClearTimeout = clearTimeout;
|
|
113
|
+
|
|
114
|
+
sinon.useFakeTimers();
|
|
115
|
+
|
|
116
|
+
// Use `pTimeout` without being affected by `sinon.useFakeTimers()`:
|
|
117
|
+
await pTimeout(doSomething(), {
|
|
118
|
+
milliseconds: 2000,
|
|
119
|
+
customTimers: {
|
|
120
|
+
setTimeout: originalSetTimeout,
|
|
121
|
+
clearTimeout: originalClearTimeout
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### signal
|
|
127
|
+
|
|
128
|
+
Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
129
|
+
|
|
130
|
+
You can abort the promise using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
|
|
131
|
+
|
|
132
|
+
*Requires Node.js 16 or later.*
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
import pTimeout from 'p-timeout';
|
|
136
|
+
import delay from 'delay';
|
|
137
|
+
|
|
138
|
+
const delayedPromise = delay(3000);
|
|
139
|
+
|
|
140
|
+
const abortController = new AbortController();
|
|
141
|
+
|
|
142
|
+
setTimeout(() => {
|
|
143
|
+
abortController.abort();
|
|
144
|
+
}, 100);
|
|
145
|
+
|
|
146
|
+
await pTimeout(delayedPromise, {
|
|
147
|
+
milliseconds: 2000,
|
|
148
|
+
signal: abortController.signal
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### TimeoutError
|
|
153
|
+
|
|
154
|
+
Exposed for instance checking and sub-classing.
|
|
155
|
+
|
|
156
|
+
## Related
|
|
157
|
+
|
|
158
|
+
- [delay](https://github.com/sindresorhus/delay) - Delay a promise a specified amount of time
|
|
159
|
+
- [p-min-delay](https://github.com/sindresorhus/p-min-delay) - Delay a promise a minimum amount of time
|
|
160
|
+
- [p-retry](https://github.com/sindresorhus/p-retry) - Retry a promise-returning function
|
|
161
|
+
- [More…](https://github.com/sindresorhus/promise-fun)
|
|
162
|
+
|
|
163
|
+
## AbortSignal
|
|
164
|
+
|
|
165
|
+
> Modern alternative to `p-timeout`
|
|
166
|
+
|
|
167
|
+
Asynchronous functions like `fetch` can accept an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal), which can be conveniently created with [`AbortSignal.timeout()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static).
|
|
168
|
+
|
|
169
|
+
The advantage over `p-timeout` is that the promise-generating function (like `fetch`) is actually notified that the user is no longer expecting an answer, so it can interrupt its work and free resources.
|
|
170
|
+
|
|
171
|
+
```js
|
|
172
|
+
// Call API, timeout after 5 seconds
|
|
173
|
+
const response = await fetch('./my-api', {signal: AbortSignal.timeout(5000)});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
async function buildWall(signal) {
|
|
178
|
+
for (const brick of bricks) {
|
|
179
|
+
signal.throwIfAborted();
|
|
180
|
+
// Or: if (signal.aborted) { return; }
|
|
181
|
+
|
|
182
|
+
await layBrick();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Stop long work after 60 seconds
|
|
187
|
+
await buildWall(AbortSignal.timeout(60_000))
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
You can also combine multiple signals, like when you have a timeout *and* an `AbortController` triggered with a “Cancel” button click. You can use the upcoming [`AbortSignal.any()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static) helper or [`abort-utils`](https://github.com/fregante/abort-utils/blob/main/source/merge-signals.md).
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import {spawnSync} from 'node:child_process';
|
|
5
|
+
test('input rejection has no unhandled cleanup promise', () => {const result = spawnSync(process.execPath, ['--input-type=module', '-e', "import pTimeout from './index.js'; import {getEventListeners} from 'node:events'; const unhandled=[]; process.on('unhandledRejection',e=>unhandled.push(e.message)); const controller=new AbortController(), error=new Error('source'); let same=false; try{await pTimeout(Promise.reject(error),{milliseconds:100,signal:controller.signal});}catch(e){same=e===error;} await new Promise(r=>setImmediate(r)); await new Promise(r=>setImmediate(r)); console.log(JSON.stringify({same,unhandled,listeners:getEventListeners(controller.signal,'abort').length}));"], {encoding:'utf8',timeout:3000}); assert.equal(result.status, 0); assert.deepEqual(JSON.parse(result.stdout.trim()), {same:true,unhandled:[],listeners:0});});
|
package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test-clock.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
|
|
3
|
+
export async function flush() {
|
|
4
|
+
for (let i = 0; i < 24; i++) await Promise.resolve();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function observe(promise) {
|
|
8
|
+
const state = {status: 'pending'};
|
|
9
|
+
Promise.resolve(promise).then(
|
|
10
|
+
value => Object.assign(state, {status: 'fulfilled', value}),
|
|
11
|
+
reason => Object.assign(state, {status: 'rejected', reason}),
|
|
12
|
+
);
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function gate() {
|
|
17
|
+
let release;
|
|
18
|
+
const promise = new Promise(resolve => { release = resolve; });
|
|
19
|
+
return {promise, release};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Only test processes replace their clock; fixtures and the eval runner stay unchanged.
|
|
23
|
+
export async function withClock(run) {
|
|
24
|
+
const original = {setTimeout: globalThis.setTimeout, clearTimeout: globalThis.clearTimeout, now: Date.now};
|
|
25
|
+
let now = 1000, serial = 0;
|
|
26
|
+
const timers = new Map(), errors = [];
|
|
27
|
+
globalThis.setTimeout = (fn, delay = 0, ...args) => {
|
|
28
|
+
const id = ++serial;
|
|
29
|
+
timers.set(id, {at: now + Math.max(0, Number(delay)), fn, args});
|
|
30
|
+
return id;
|
|
31
|
+
};
|
|
32
|
+
globalThis.clearTimeout = id => timers.delete(id);
|
|
33
|
+
Date.now = () => now;
|
|
34
|
+
const clock = {
|
|
35
|
+
get now() { return now; },
|
|
36
|
+
get pending() { return timers.size; },
|
|
37
|
+
async advance(amount) {
|
|
38
|
+
const end = now + amount;
|
|
39
|
+
for (let steps = 0; ; steps++) {
|
|
40
|
+
assert.ok(steps < 1000, 'timer queue must make bounded progress');
|
|
41
|
+
const next = [...timers.entries()].filter(([, t]) => t.at <= end)
|
|
42
|
+
.sort((a, b) => a[1].at - b[1].at || a[0] - b[0])[0];
|
|
43
|
+
if (!next) break;
|
|
44
|
+
const [id, timer] = next;
|
|
45
|
+
timers.delete(id); now = timer.at;
|
|
46
|
+
try {
|
|
47
|
+
const result = timer.fn(...timer.args);
|
|
48
|
+
if (result?.then) Promise.resolve(result).catch(error => errors.push(error));
|
|
49
|
+
} catch (error) { errors.push(error); }
|
|
50
|
+
await flush();
|
|
51
|
+
}
|
|
52
|
+
now = end;
|
|
53
|
+
await flush();
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
await run(clock);
|
|
58
|
+
await flush();
|
|
59
|
+
assert.deepEqual(errors, [], 'scheduled callbacks must not throw outside their public promises');
|
|
60
|
+
} finally {
|
|
61
|
+
globalThis.setTimeout = original.setTimeout;
|
|
62
|
+
globalThis.clearTimeout = original.clearTimeout;
|
|
63
|
+
Date.now = original.now;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p-timeout",
|
|
3
|
+
"version": "6.1.3",
|
|
4
|
+
"description": "Timeout a promise after a specified amount of time",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/p-timeout",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": "./index.js",
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=14.16"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "xo && ava && tsd"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"index.js",
|
|
25
|
+
"index.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"promise",
|
|
29
|
+
"timeout",
|
|
30
|
+
"error",
|
|
31
|
+
"invalidate",
|
|
32
|
+
"async",
|
|
33
|
+
"await",
|
|
34
|
+
"promises",
|
|
35
|
+
"time",
|
|
36
|
+
"out",
|
|
37
|
+
"cancel",
|
|
38
|
+
"bluebird"
|
|
39
|
+
],
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"ava": "^4.3.1",
|
|
42
|
+
"delay": "^5.0.0",
|
|
43
|
+
"in-range": "^3.0.0",
|
|
44
|
+
"p-cancelable": "^4.0.1",
|
|
45
|
+
"sinon": "^19.0.2",
|
|
46
|
+
"time-span": "^5.1.0",
|
|
47
|
+
"tsd": "^0.22.0",
|
|
48
|
+
"xo": "^0.54.2"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Legacy command events follow async hooks and the action. Preserve the existing ordinary public behavior and fix the reported defect.
|
|
2
|
+
|
|
3
|
+
This is pinned historical upstream runtime source with local offline fixtures. Run npm test with Node; do not install dependencies or use the network or fetch upstream fixes. Editable functional files: lib/command.js. Add an executable new *.test.mjs regression using node:test and the public API; it must distinguish the defect. Keep supplied tests, helper, vendored dependency, original metadata record, types and documentation unchanged. Explain the cause and checks actually run.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
A child output configuration change leaves its parent unchanged. Preserve the existing ordinary public behavior and fix the reported defect.
|
|
2
|
+
|
|
3
|
+
This is pinned historical upstream runtime source with local offline fixtures. Run npm test with Node; do not install dependencies or use the network or fetch upstream fixes. Editable functional files: lib/command.js. Add an executable new *.test.mjs regression using node:test and the public API; it must distinguish the defect. Keep supplied tests, helper, vendored dependency, original metadata record, types and documentation unchanged. Explain the cause and checks actually run.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Queued calls retain their own AsyncLocalStorage context. Preserve the existing ordinary public behavior and fix the reported defect.
|
|
2
|
+
|
|
3
|
+
This is pinned historical upstream runtime source with local offline fixtures. Run npm test with Node; do not install dependencies or use the network or fetch upstream fixes. Editable functional files: index.js; package.json imports/files fields; optional async-hooks-stub.js. Add an executable new *.test.mjs regression using node:test and the public API; it must distinguish the defect. Keep supplied tests, helper, vendored dependency, original metadata record, types and documentation unchanged. Explain the cause and checks actually run.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Iterator failure does not leave scheduled mapper rejections unhandled. Preserve the existing ordinary public behavior and fix the reported defect.
|
|
2
|
+
|
|
3
|
+
This is pinned historical upstream runtime source with local offline fixtures. Run npm test with Node; do not install dependencies or use the network or fetch upstream fixes. Editable functional files: index.js. Add an executable new *.test.mjs regression using node:test and the public API; it must distinguish the defect. Keep supplied tests, helper, vendored dependency, original metadata record, types and documentation unchanged. Explain the cause and checks actually run.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Delayed synchronous exceptions reject the returned promise. Preserve the existing ordinary public behavior and fix the reported defect.
|
|
2
|
+
|
|
3
|
+
This is pinned historical upstream runtime source with local offline fixtures. Run npm test with Node; do not install dependencies or use the network or fetch upstream fixes. Editable functional files: index.js. Add an executable new *.test.mjs regression using node:test and the public API; it must distinguish the defect. Keep supplied tests, helper, vendored dependency, original metadata record, types and documentation unchanged. Explain the cause and checks actually run.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Custom timers receive a compatible call receiver. Preserve the existing ordinary public behavior and fix the reported defect.
|
|
2
|
+
|
|
3
|
+
This is pinned historical upstream runtime source with local offline fixtures. Run npm test with Node; do not install dependencies or use the network or fetch upstream fixes. Editable functional files: index.js. Add an executable new *.test.mjs regression using node:test and the public API; it must distinguish the defect. Keep supplied tests, helper, vendored dependency, original metadata record, types and documentation unchanged. Explain the cause and checks actually run.
|