skillfit 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -15
- package/README.zh-CN.md +41 -15
- 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 +166 -53
- 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 +68 -38
- package/dist/commands/bench.test.js +101 -0
- package/dist/commands/eval-component.js +17 -0
- package/dist/commands/eval-export.js +152 -0
- package/dist/commands/eval-export.test.js +122 -0
- package/dist/commands/eval.js +14 -3
- package/dist/commands/eval.test.js +58 -1
- package/dist/harness/bench.js +21 -2
- package/dist/harness/eval-audit.js +42 -4
- package/dist/harness/eval-budget.js +51 -0
- package/dist/harness/eval-budget.test.js +210 -0
- package/dist/harness/eval-component.test.js +36 -0
- package/dist/harness/eval-contract.js +5 -1
- package/dist/harness/replay-package.js +85 -0
- package/dist/harness/runner.js +22 -1
- package/docs/bench-authoring.md +40 -0
- package/docs/bench-check-json.md +115 -0
- package/docs/case-management.md +65 -0
- package/docs/eval-component.md +60 -49
- 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/first-real-eval.md +6 -0
- package/docs/growth-roadmap-2026-10.md +57 -93
- package/docs/metrics.md +21 -0
- package/docs/plans/2026-10-14-evidence-and-release-sequence.md +30 -13
- 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 +30 -0
- package/docs/releases/0.10.0.md +45 -0
- package/docs/releases/0.9.0-verification.json +38 -0
- package/docs/releases/0.9.0.md +20 -3
- 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 +65 -0
- package/docs/releases/trusted-publishing.md +114 -0
- package/docs/replay-packages.md +88 -0
- package/docs/schemas/bench-check.schema.json +109 -0
- package/docs/schemas/eval-request.schema.json +12 -0
- package/docs/sharing-results.md +6 -0
- 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 +3 -3
- package/skills/skillfit/SKILL.md +17 -5
package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export type LimitFunction = {
|
|
2
|
+
/**
|
|
3
|
+
The number of promises that are currently running.
|
|
4
|
+
*/
|
|
5
|
+
readonly activeCount: number;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
|
9
|
+
*/
|
|
10
|
+
readonly pendingCount: number;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
Get or set the concurrency limit.
|
|
14
|
+
*/
|
|
15
|
+
concurrency: number;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
Discard pending promises that are waiting to run.
|
|
19
|
+
|
|
20
|
+
This might be useful if you want to tear down the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
|
21
|
+
|
|
22
|
+
Note: This does not cancel promises that are already running.
|
|
23
|
+
|
|
24
|
+
When `rejectOnClear` is enabled, pending promises are rejected with an `AbortError`.
|
|
25
|
+
This is recommended if you await the returned promises, for example with `Promise.all`, so pending tasks do not remain unresolved after `clearQueue()`.
|
|
26
|
+
*/
|
|
27
|
+
clearQueue: () => void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
Process an iterable of inputs with limited concurrency.
|
|
31
|
+
|
|
32
|
+
The mapper function receives the item value and its index.
|
|
33
|
+
|
|
34
|
+
This is a convenience function for processing inputs that arrive in batches. For more complex use cases, see [p-map](https://github.com/sindresorhus/p-map).
|
|
35
|
+
|
|
36
|
+
@param iterable - An iterable containing an argument for the given function.
|
|
37
|
+
@param mapperFunction - Promise-returning/async function.
|
|
38
|
+
@returns A promise equivalent to `Promise.all(Array.from(iterable, (item, index) => limit(mapperFunction, item, index)))`.
|
|
39
|
+
*/
|
|
40
|
+
map: <Input, ReturnType> (
|
|
41
|
+
iterable: Iterable<Input>,
|
|
42
|
+
mapperFunction: (input: Input, index: number) => PromiseLike<ReturnType> | ReturnType
|
|
43
|
+
) => Promise<ReturnType[]>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
@param fn - Promise-returning/async function.
|
|
47
|
+
@param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.
|
|
48
|
+
|
|
49
|
+
Warning: Avoid calling the same `limit` function inside a function that is already limited by it. This can create a deadlock where inner tasks never run. Use a separate limiter for inner tasks.
|
|
50
|
+
|
|
51
|
+
@returns The promise returned by calling `fn(...arguments)`.
|
|
52
|
+
*/
|
|
53
|
+
<Arguments extends unknown[], ReturnType>(
|
|
54
|
+
function_: (...arguments_: Arguments) => PromiseLike<ReturnType> | ReturnType,
|
|
55
|
+
...arguments_: Arguments
|
|
56
|
+
): Promise<ReturnType>;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
Run multiple promise-returning & async functions with limited concurrency.
|
|
61
|
+
|
|
62
|
+
@param concurrency - Concurrency limit. Minimum: `1`. You can pass a number or an options object with a `concurrency` property.
|
|
63
|
+
@returns A `limit` function.
|
|
64
|
+
|
|
65
|
+
@example
|
|
66
|
+
```
|
|
67
|
+
import pLimit from 'p-limit';
|
|
68
|
+
|
|
69
|
+
const limit = pLimit(1);
|
|
70
|
+
|
|
71
|
+
const input = [
|
|
72
|
+
limit(() => fetchSomething('foo')),
|
|
73
|
+
limit(() => fetchSomething('bar')),
|
|
74
|
+
limit(() => doSomething())
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
// Only one promise is run at once
|
|
78
|
+
const result = await Promise.all(input);
|
|
79
|
+
console.log(result);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
@example
|
|
83
|
+
```
|
|
84
|
+
import pLimit from 'p-limit';
|
|
85
|
+
|
|
86
|
+
const limit = pLimit({concurrency: 1});
|
|
87
|
+
```
|
|
88
|
+
*/
|
|
89
|
+
export default function pLimit(concurrency: number | Options): LimitFunction;
|
|
90
|
+
|
|
91
|
+
export type Options = {
|
|
92
|
+
/**
|
|
93
|
+
Concurrency limit.
|
|
94
|
+
|
|
95
|
+
Minimum: `1`.
|
|
96
|
+
*/
|
|
97
|
+
readonly concurrency: number;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
Reject pending promises with an `AbortError` when `clearQueue()` is called.
|
|
101
|
+
|
|
102
|
+
Default: `false`.
|
|
103
|
+
|
|
104
|
+
This is recommended if you await the returned promises, for example with `Promise.all`, so pending tasks do not remain unresolved after `clearQueue()`.
|
|
105
|
+
*/
|
|
106
|
+
readonly rejectOnClear?: boolean;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
Returns a function with limited concurrency.
|
|
111
|
+
|
|
112
|
+
The returned function manages its own concurrent executions, allowing you to call it multiple times without exceeding the specified concurrency limit.
|
|
113
|
+
|
|
114
|
+
Ideal for scenarios where you need to control the number of simultaneous executions of a single function, rather than managing concurrency across multiple functions.
|
|
115
|
+
|
|
116
|
+
@param function_ - Promise-returning/async function.
|
|
117
|
+
@return Function with limited concurrency.
|
|
118
|
+
|
|
119
|
+
@example
|
|
120
|
+
```
|
|
121
|
+
import {limitFunction} from 'p-limit';
|
|
122
|
+
|
|
123
|
+
const limitedFunction = limitFunction(async () => {
|
|
124
|
+
return doSomething();
|
|
125
|
+
}, {concurrency: 1});
|
|
126
|
+
|
|
127
|
+
const input = Array.from({length: 10}, limitedFunction);
|
|
128
|
+
|
|
129
|
+
// Only one promise is run at once.
|
|
130
|
+
await Promise.all(input);
|
|
131
|
+
```
|
|
132
|
+
*/
|
|
133
|
+
export function limitFunction<Arguments extends unknown[], ReturnType>(
|
|
134
|
+
function_: (...arguments_: Arguments) => PromiseLike<ReturnType>,
|
|
135
|
+
options: Options
|
|
136
|
+
): ((...arguments_: Arguments) => Promise<ReturnType>) & Pick<LimitFunction, 'clearQueue'>;
|
package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import Queue from './vendor/yocto-queue/index.js';
|
|
2
|
+
|
|
3
|
+
export default function pLimit(concurrency) {
|
|
4
|
+
let rejectOnClear = false;
|
|
5
|
+
|
|
6
|
+
if (typeof concurrency === 'object') {
|
|
7
|
+
({concurrency, rejectOnClear = false} = concurrency);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
validateConcurrency(concurrency);
|
|
11
|
+
|
|
12
|
+
if (typeof rejectOnClear !== 'boolean') {
|
|
13
|
+
throw new TypeError('Expected `rejectOnClear` to be a boolean');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const queue = new Queue();
|
|
17
|
+
let activeCount = 0;
|
|
18
|
+
|
|
19
|
+
const resumeNext = () => {
|
|
20
|
+
// Process the next queued function if we're under the concurrency limit
|
|
21
|
+
if (activeCount < concurrency && queue.size > 0) {
|
|
22
|
+
activeCount++;
|
|
23
|
+
queue.dequeue().run();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const next = () => {
|
|
28
|
+
activeCount--;
|
|
29
|
+
resumeNext();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const run = async (function_, resolve, arguments_) => {
|
|
33
|
+
// Execute the function and capture the result promise
|
|
34
|
+
const result = (async () => function_(...arguments_))();
|
|
35
|
+
|
|
36
|
+
// Resolve immediately with the promise (don't wait for completion)
|
|
37
|
+
resolve(result);
|
|
38
|
+
|
|
39
|
+
// Wait for the function to complete (success or failure)
|
|
40
|
+
// We catch errors here to prevent unhandled rejections,
|
|
41
|
+
// but the original promise rejection is preserved for the caller
|
|
42
|
+
try {
|
|
43
|
+
await result;
|
|
44
|
+
} catch {}
|
|
45
|
+
|
|
46
|
+
// Decrement active count and process next queued function
|
|
47
|
+
next();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const enqueue = (function_, resolve, reject, arguments_) => {
|
|
51
|
+
const queueItem = {reject};
|
|
52
|
+
|
|
53
|
+
// Queue the internal resolve function instead of the run function
|
|
54
|
+
// to preserve the asynchronous execution context.
|
|
55
|
+
new Promise(internalResolve => { // eslint-disable-line promise/param-names
|
|
56
|
+
queueItem.run = internalResolve;
|
|
57
|
+
queue.enqueue(queueItem);
|
|
58
|
+
}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then
|
|
59
|
+
|
|
60
|
+
// Start processing immediately if we haven't reached the concurrency limit
|
|
61
|
+
if (activeCount < concurrency) {
|
|
62
|
+
resumeNext();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const generator = (function_, ...arguments_) => new Promise((resolve, reject) => {
|
|
67
|
+
enqueue(function_, resolve, reject, arguments_);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
Object.defineProperties(generator, {
|
|
71
|
+
activeCount: {
|
|
72
|
+
get: () => activeCount,
|
|
73
|
+
},
|
|
74
|
+
pendingCount: {
|
|
75
|
+
get: () => queue.size,
|
|
76
|
+
},
|
|
77
|
+
clearQueue: {
|
|
78
|
+
value() {
|
|
79
|
+
if (!rejectOnClear) {
|
|
80
|
+
queue.clear();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const abortError = AbortSignal.abort().reason;
|
|
85
|
+
|
|
86
|
+
while (queue.size > 0) {
|
|
87
|
+
queue.dequeue().reject(abortError);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
concurrency: {
|
|
92
|
+
get: () => concurrency,
|
|
93
|
+
|
|
94
|
+
set(newConcurrency) {
|
|
95
|
+
validateConcurrency(newConcurrency);
|
|
96
|
+
concurrency = newConcurrency;
|
|
97
|
+
|
|
98
|
+
queueMicrotask(() => {
|
|
99
|
+
// eslint-disable-next-line no-unmodified-loop-condition
|
|
100
|
+
while (activeCount < concurrency && queue.size > 0) {
|
|
101
|
+
resumeNext();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
map: {
|
|
107
|
+
async value(iterable, function_) {
|
|
108
|
+
const promises = [];
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
Array.from(iterable, (value, index) => {
|
|
112
|
+
const promise = generator(function_, value, index);
|
|
113
|
+
promises.push(promise);
|
|
114
|
+
return promise;
|
|
115
|
+
});
|
|
116
|
+
} catch (error) {
|
|
117
|
+
// The iterable threw, so `Promise.all` never observes the already scheduled promises. Observe them here to avoid unhandled rejections.
|
|
118
|
+
for (const promise of promises) {
|
|
119
|
+
promise.catch(() => {}); // eslint-disable-line promise/prefer-await-to-then
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return Promise.all(promises);
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return generator;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function limitFunction(function_, options) {
|
|
134
|
+
const limit = pLimit(options);
|
|
135
|
+
|
|
136
|
+
const limitedFunction = (...arguments_) => limit(() => function_(...arguments_));
|
|
137
|
+
Object.defineProperty(limitedFunction, 'clearQueue', {
|
|
138
|
+
value: limit.clearQueue,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
return limitedFunction;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function validateConcurrency(concurrency) {
|
|
145
|
+
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
146
|
+
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
|
147
|
+
}
|
|
148
|
+
}
|
package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/license
ADDED
|
@@ -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.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p-limit",
|
|
3
|
+
"version": "7.3.2",
|
|
4
|
+
"description": "Run multiple promise-returning & async functions with limited concurrency",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/p-limit",
|
|
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": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "node --test test.mjs"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"index.js",
|
|
27
|
+
"index.d.ts"
|
|
28
|
+
],
|
|
29
|
+
"keywords": [
|
|
30
|
+
"promise",
|
|
31
|
+
"limit",
|
|
32
|
+
"limited",
|
|
33
|
+
"concurrency",
|
|
34
|
+
"throttle",
|
|
35
|
+
"throat",
|
|
36
|
+
"rate",
|
|
37
|
+
"batch",
|
|
38
|
+
"ratelimit",
|
|
39
|
+
"task",
|
|
40
|
+
"queue",
|
|
41
|
+
"async",
|
|
42
|
+
"await",
|
|
43
|
+
"promises",
|
|
44
|
+
"bluebird"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"yocto-queue": "^1.2.1"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"ava": "^6.4.1",
|
|
51
|
+
"in-range": "^3.0.0",
|
|
52
|
+
"random-int": "^3.0.0",
|
|
53
|
+
"time-span": "^5.1.0",
|
|
54
|
+
"tsd": "^0.33.0",
|
|
55
|
+
"xo": "^1.2.1"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/readme.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# p-limit
|
|
2
|
+
|
|
3
|
+
> Run multiple promise-returning & async functions with limited concurrency
|
|
4
|
+
|
|
5
|
+
*Works in Node.js and browsers.*
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install p-limit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import pLimit from 'p-limit';
|
|
17
|
+
|
|
18
|
+
const limit = pLimit(1);
|
|
19
|
+
|
|
20
|
+
const input = [
|
|
21
|
+
limit(() => fetchSomething('foo')),
|
|
22
|
+
limit(() => fetchSomething('bar')),
|
|
23
|
+
limit(() => doSomething())
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
// Only one promise is run at once
|
|
27
|
+
const result = await Promise.all(input);
|
|
28
|
+
console.log(result);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### pLimit(concurrency) <sup>default export</sup>
|
|
34
|
+
|
|
35
|
+
Returns a `limit` function.
|
|
36
|
+
|
|
37
|
+
#### concurrency
|
|
38
|
+
|
|
39
|
+
Type: `number | object`\
|
|
40
|
+
Minimum: `1`
|
|
41
|
+
|
|
42
|
+
Concurrency limit.
|
|
43
|
+
|
|
44
|
+
You can pass a number or an options object with a `concurrency` property.
|
|
45
|
+
|
|
46
|
+
#### rejectOnClear
|
|
47
|
+
|
|
48
|
+
Type: `boolean`\
|
|
49
|
+
Default: `false`
|
|
50
|
+
|
|
51
|
+
Reject pending promises with an `AbortError` when `clearQueue()` is called.
|
|
52
|
+
This is recommended if you await the returned promises, for example with `Promise.all`, so pending tasks do not remain unresolved after `clearQueue()`.
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import pLimit from 'p-limit';
|
|
56
|
+
|
|
57
|
+
const limit = pLimit({concurrency: 1});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### limit(fn, ...args)
|
|
61
|
+
|
|
62
|
+
Returns the promise returned by calling `fn(...args)`.
|
|
63
|
+
|
|
64
|
+
#### fn
|
|
65
|
+
|
|
66
|
+
Type: `Function`
|
|
67
|
+
|
|
68
|
+
Promise-returning/async function.
|
|
69
|
+
|
|
70
|
+
#### args
|
|
71
|
+
|
|
72
|
+
Any arguments to pass through to `fn`.
|
|
73
|
+
|
|
74
|
+
Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.
|
|
75
|
+
|
|
76
|
+
Warning: Avoid calling the same `limit` function inside a function that is already limited by it. This can create a deadlock where inner tasks never run. Use a separate limiter for inner tasks.
|
|
77
|
+
|
|
78
|
+
### limit.map(iterable, mapperFunction)
|
|
79
|
+
|
|
80
|
+
Process an iterable of inputs with limited concurrency.
|
|
81
|
+
|
|
82
|
+
The mapper function receives the item value and its index.
|
|
83
|
+
|
|
84
|
+
Returns a promise equivalent to `Promise.all(Array.from(iterable, (item, index) => limit(mapperFunction, item, index)))`.
|
|
85
|
+
|
|
86
|
+
This is a convenience function for processing inputs that arrive in batches. For more complex use cases, see [p-map](https://github.com/sindresorhus/p-map).
|
|
87
|
+
|
|
88
|
+
### limit.activeCount
|
|
89
|
+
|
|
90
|
+
The number of promises that are currently running.
|
|
91
|
+
|
|
92
|
+
### limit.pendingCount
|
|
93
|
+
|
|
94
|
+
The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
|
95
|
+
|
|
96
|
+
### limit.clearQueue()
|
|
97
|
+
|
|
98
|
+
Discard pending promises that are waiting to run.
|
|
99
|
+
|
|
100
|
+
This might be useful if you want to tear down the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
|
101
|
+
|
|
102
|
+
Note: This does not cancel promises that are already running.
|
|
103
|
+
|
|
104
|
+
When `rejectOnClear` is enabled, pending promises are rejected with an `AbortError`.
|
|
105
|
+
This is recommended if you await the returned promises, for example with `Promise.all`, so pending tasks do not remain unresolved after `clearQueue()`.
|
|
106
|
+
|
|
107
|
+
### limit.concurrency
|
|
108
|
+
|
|
109
|
+
Get or set the concurrency limit.
|
|
110
|
+
|
|
111
|
+
### limitFunction(fn, options) <sup>named export</sup>
|
|
112
|
+
|
|
113
|
+
Returns a function with limited concurrency.
|
|
114
|
+
|
|
115
|
+
The returned function manages its own concurrent executions, allowing you to call it multiple times without exceeding the specified concurrency limit.
|
|
116
|
+
|
|
117
|
+
Ideal for scenarios where you need to control the number of simultaneous executions of a single function, rather than managing concurrency across multiple functions.
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import {limitFunction} from 'p-limit';
|
|
121
|
+
|
|
122
|
+
const limitedFunction = limitFunction(async () => {
|
|
123
|
+
return doSomething();
|
|
124
|
+
}, {concurrency: 1});
|
|
125
|
+
|
|
126
|
+
const input = Array.from({length: 10}, limitedFunction);
|
|
127
|
+
|
|
128
|
+
// Only one promise is run at once.
|
|
129
|
+
await Promise.all(input);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### fn
|
|
133
|
+
|
|
134
|
+
Type: `Function`
|
|
135
|
+
|
|
136
|
+
Promise-returning/async function.
|
|
137
|
+
|
|
138
|
+
#### options
|
|
139
|
+
|
|
140
|
+
Type: `object`
|
|
141
|
+
|
|
142
|
+
#### concurrency
|
|
143
|
+
|
|
144
|
+
Type: `number`\
|
|
145
|
+
Minimum: `1`
|
|
146
|
+
|
|
147
|
+
Concurrency limit.
|
|
148
|
+
|
|
149
|
+
#### rejectOnClear
|
|
150
|
+
|
|
151
|
+
Type: `boolean`\
|
|
152
|
+
Default: `false`
|
|
153
|
+
|
|
154
|
+
Reject pending promises with an `AbortError` when `clearQueue()` is called.
|
|
155
|
+
This is recommended if you await the returned promises, for example with `Promise.all`, so pending tasks do not remain unresolved after `clearQueue()`.
|
|
156
|
+
|
|
157
|
+
### limitedFunction.clearQueue()
|
|
158
|
+
|
|
159
|
+
Discard pending calls that have not started yet.
|
|
160
|
+
|
|
161
|
+
When `rejectOnClear` is enabled, pending promises are rejected with an `AbortError`. Otherwise, their promises remain unresolved.
|
|
162
|
+
|
|
163
|
+
This does not cancel calls that are already running.
|
|
164
|
+
|
|
165
|
+
## Recipes
|
|
166
|
+
|
|
167
|
+
See [recipes.md](recipes.md) for common use cases and patterns.
|
|
168
|
+
|
|
169
|
+
## FAQ
|
|
170
|
+
|
|
171
|
+
### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package?
|
|
172
|
+
|
|
173
|
+
This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue.
|
|
174
|
+
|
|
175
|
+
## Related
|
|
176
|
+
|
|
177
|
+
- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions
|
|
178
|
+
- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions
|
|
179
|
+
- [p-map](https://github.com/sindresorhus/p-map) - Run promise-returning & async functions concurrently with different inputs
|
|
180
|
+
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
|
|
181
|
+
- [More…](https://github.com/sindresorhus/promise-fun)
|
|
@@ -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('iterator failure leaves no unhandled mapper rejection', () => {const result = spawnSync(process.execPath, ['--input-type=module', '-e', "import pLimit from './index.js'; const unhandled=[]; process.on('unhandledRejection', e=>unhandled.push(e.message)); const limit=pLimit(1), error=new Error('iterator'); function* values(){yield 1;yield 2;throw error;} let same=false; try{await limit.map(values(),async v=>{throw new Error('mapper-'+v);});}catch(e){same=e===error;} await limit(()=>{}); await new Promise(r=>setImmediate(r)); await new Promise(r=>setImmediate(r)); console.log(JSON.stringify({same,unhandled,active:limit.activeCount,pending:limit.pendingCount}));"], {encoding:'utf8', timeout:3000}); assert.equal(result.status, 0); assert.deepEqual(JSON.parse(result.stdout.trim()), {same:true,unhandled:[],active:0,pending:0});});
|
|
@@ -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
|
+
}
|
package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import * as api from './index.js';
|
|
4
|
+
test('ordinary public API remains usable', async () => {const limit = api.default(2); assert.deepEqual(await Promise.all([limit(() => 2), limit(async () => 4)]), [2, 4]);});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p-limit",
|
|
3
|
+
"version": "7.3.2",
|
|
4
|
+
"description": "Run multiple promise-returning & async functions with limited concurrency",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/p-limit",
|
|
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": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "xo && ava && tsd",
|
|
24
|
+
"benchmark": "node benchmark.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"index.js",
|
|
28
|
+
"index.d.ts"
|
|
29
|
+
],
|
|
30
|
+
"keywords": [
|
|
31
|
+
"promise",
|
|
32
|
+
"limit",
|
|
33
|
+
"limited",
|
|
34
|
+
"concurrency",
|
|
35
|
+
"throttle",
|
|
36
|
+
"throat",
|
|
37
|
+
"rate",
|
|
38
|
+
"batch",
|
|
39
|
+
"ratelimit",
|
|
40
|
+
"task",
|
|
41
|
+
"queue",
|
|
42
|
+
"async",
|
|
43
|
+
"await",
|
|
44
|
+
"promises",
|
|
45
|
+
"bluebird"
|
|
46
|
+
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"yocto-queue": "^1.2.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"ava": "^6.4.1",
|
|
52
|
+
"in-range": "^3.0.0",
|
|
53
|
+
"random-int": "^3.0.0",
|
|
54
|
+
"time-span": "^5.1.0",
|
|
55
|
+
"tsd": "^0.33.0",
|
|
56
|
+
"xo": "^1.2.1"
|
|
57
|
+
}
|
|
58
|
+
}
|