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.
Files changed (305) hide show
  1. package/README.md +41 -15
  2. package/README.zh-CN.md +41 -15
  3. package/benches/README.md +23 -0
  4. package/benches/contrib/README.md +1 -0
  5. package/benches/contrib/oss-skill-independent/README.md +60 -0
  6. package/benches/contrib/oss-skill-independent/bench.json +79 -0
  7. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/LICENSE +22 -0
  8. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/Readme.md +1015 -0
  9. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/esm.mjs +15 -0
  10. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/index.js +27 -0
  11. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/argument.js +147 -0
  12. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/command.js +1944 -0
  13. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/error.js +45 -0
  14. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/help.js +396 -0
  15. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/option.js +208 -0
  16. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/lib/suggestSimilar.js +100 -0
  17. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package-support.json +16 -0
  18. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/package.json +63 -0
  19. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test-clock.mjs +65 -0
  20. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/test.mjs +4 -0
  21. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.d.ts +774 -0
  22. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/typings/index.test-d.ts +416 -0
  23. package/benches/contrib/oss-skill-independent/fixtures/commander-async-listener-order/upstream-package.json +69 -0
  24. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/LICENSE +22 -0
  25. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/Readme.md +1149 -0
  26. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/esm.mjs +16 -0
  27. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/index.js +24 -0
  28. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/argument.js +149 -0
  29. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/command.js +2662 -0
  30. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/error.js +39 -0
  31. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/help.js +713 -0
  32. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/option.js +367 -0
  33. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/lib/suggestSimilar.js +101 -0
  34. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package-support.json +16 -0
  35. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/package.json +71 -0
  36. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test-clock.mjs +65 -0
  37. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/test.mjs +4 -0
  38. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/esm.d.mts +3 -0
  39. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.d.ts +1045 -0
  40. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/typings/index.test-d.ts +737 -0
  41. package/benches/contrib/oss-skill-independent/fixtures/commander-output-isolation/upstream-package.json +82 -0
  42. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.d.ts +40 -0
  43. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/index.js +68 -0
  44. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/license +9 -0
  45. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/package.json +54 -0
  46. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/readme.md +99 -0
  47. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test-clock.mjs +65 -0
  48. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/test.mjs +4 -0
  49. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/upstream-package.json +54 -0
  50. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/index.js +67 -0
  51. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/license +9 -0
  52. package/benches/contrib/oss-skill-independent/fixtures/limit-async-context/vendor/yocto-queue/package.json +46 -0
  53. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.d.ts +136 -0
  54. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/index.js +132 -0
  55. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/license +9 -0
  56. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/package.json +57 -0
  57. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/readme.md +181 -0
  58. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test-clock.mjs +65 -0
  59. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/test.mjs +4 -0
  60. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/upstream-package.json +58 -0
  61. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
  62. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
  63. package/benches/contrib/oss-skill-independent/fixtures/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
  64. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.d.ts +136 -0
  65. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/index.js +116 -0
  66. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/license +9 -0
  67. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/package.json +60 -0
  68. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/readme.md +170 -0
  69. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test-clock.mjs +65 -0
  70. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/test.mjs +4 -0
  71. package/benches/contrib/oss-skill-independent/fixtures/throttle-sync-throw/upstream-package.json +60 -0
  72. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.d.ts +149 -0
  73. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/index.js +93 -0
  74. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/license +9 -0
  75. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/package.json +52 -0
  76. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/readme.md +192 -0
  77. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test-clock.mjs +65 -0
  78. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/test.mjs +4 -0
  79. package/benches/contrib/oss-skill-independent/fixtures/timeout-custom-timers/upstream-package.json +52 -0
  80. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.d.ts +151 -0
  81. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/index.js +114 -0
  82. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/license +9 -0
  83. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/package.json +48 -0
  84. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/readme.md +158 -0
  85. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test-clock.mjs +65 -0
  86. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/test.mjs +4 -0
  87. package/benches/contrib/oss-skill-independent/fixtures/timeout-infinity-abort/upstream-package.json +48 -0
  88. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.d.ts +151 -0
  89. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/index.js +122 -0
  90. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/license +9 -0
  91. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/package.json +50 -0
  92. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/readme.md +190 -0
  93. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test-clock.mjs +65 -0
  94. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/test.mjs +4 -0
  95. package/benches/contrib/oss-skill-independent/fixtures/timeout-rejection-listener/upstream-package.json +50 -0
  96. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/LICENSE +22 -0
  97. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/Readme.md +1015 -0
  98. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/esm.mjs +15 -0
  99. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/index.js +27 -0
  100. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/argument.js +147 -0
  101. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/command.js +1948 -0
  102. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/error.js +45 -0
  103. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/help.js +396 -0
  104. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/option.js +208 -0
  105. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/lib/suggestSimilar.js +100 -0
  106. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package-support.json +16 -0
  107. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/package.json +63 -0
  108. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/regression.test.mjs +5 -0
  109. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test-clock.mjs +65 -0
  110. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/test.mjs +4 -0
  111. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.d.ts +774 -0
  112. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/typings/index.test-d.ts +416 -0
  113. package/benches/contrib/oss-skill-independent/ground-truth/commander-async-listener-order/upstream-package.json +69 -0
  114. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/LICENSE +22 -0
  115. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/Readme.md +1149 -0
  116. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/esm.mjs +16 -0
  117. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/index.js +24 -0
  118. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/argument.js +149 -0
  119. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/command.js +2666 -0
  120. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/error.js +39 -0
  121. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/help.js +713 -0
  122. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/option.js +367 -0
  123. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/lib/suggestSimilar.js +101 -0
  124. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package-support.json +16 -0
  125. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/package.json +71 -0
  126. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/regression.test.mjs +5 -0
  127. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test-clock.mjs +65 -0
  128. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/test.mjs +4 -0
  129. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/esm.d.mts +3 -0
  130. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.d.ts +1045 -0
  131. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/typings/index.test-d.ts +737 -0
  132. package/benches/contrib/oss-skill-independent/ground-truth/commander-output-isolation/upstream-package.json +82 -0
  133. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/async-hooks-stub.js +15 -0
  134. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.d.ts +40 -0
  135. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/index.js +71 -0
  136. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/license +9 -0
  137. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/package.json +61 -0
  138. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/readme.md +99 -0
  139. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/regression.test.mjs +6 -0
  140. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test-clock.mjs +65 -0
  141. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/test.mjs +4 -0
  142. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/upstream-package.json +54 -0
  143. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/index.js +67 -0
  144. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/license +9 -0
  145. package/benches/contrib/oss-skill-independent/ground-truth/limit-async-context/vendor/yocto-queue/package.json +46 -0
  146. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.d.ts +136 -0
  147. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/index.js +148 -0
  148. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/license +9 -0
  149. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/package.json +57 -0
  150. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/readme.md +181 -0
  151. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/regression.test.mjs +5 -0
  152. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test-clock.mjs +65 -0
  153. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/test.mjs +4 -0
  154. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/upstream-package.json +58 -0
  155. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/index.js +84 -0
  156. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/license +9 -0
  157. package/benches/contrib/oss-skill-independent/ground-truth/limit-map-iteration-rejection/vendor/yocto-queue/package.json +48 -0
  158. package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-async-listener-order.mjs +1 -0
  159. package/benches/contrib/oss-skill-independent/ground-truth/oracle-commander-output-isolation.mjs +1 -0
  160. package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-async-context.mjs +1 -0
  161. package/benches/contrib/oss-skill-independent/ground-truth/oracle-limit-map-iteration-rejection.mjs +1 -0
  162. package/benches/contrib/oss-skill-independent/ground-truth/oracle-throttle-sync-throw.mjs +1 -0
  163. package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-custom-timers.mjs +1 -0
  164. package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-infinity-abort.mjs +1 -0
  165. package/benches/contrib/oss-skill-independent/ground-truth/oracle-timeout-rejection-listener.mjs +1 -0
  166. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.d.ts +136 -0
  167. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/index.js +121 -0
  168. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/license +9 -0
  169. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/package.json +60 -0
  170. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/readme.md +170 -0
  171. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/regression.test.mjs +6 -0
  172. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test-clock.mjs +65 -0
  173. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/test.mjs +4 -0
  174. package/benches/contrib/oss-skill-independent/ground-truth/throttle-sync-throw/upstream-package.json +60 -0
  175. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.d.ts +149 -0
  176. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/index.js +95 -0
  177. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/license +9 -0
  178. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/package.json +52 -0
  179. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/readme.md +192 -0
  180. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/regression.test.mjs +5 -0
  181. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test-clock.mjs +65 -0
  182. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/test.mjs +4 -0
  183. package/benches/contrib/oss-skill-independent/ground-truth/timeout-custom-timers/upstream-package.json +52 -0
  184. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.d.ts +151 -0
  185. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/index.js +114 -0
  186. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/license +9 -0
  187. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/package.json +48 -0
  188. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/readme.md +158 -0
  189. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/regression.test.mjs +5 -0
  190. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test-clock.mjs +65 -0
  191. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/test.mjs +4 -0
  192. package/benches/contrib/oss-skill-independent/ground-truth/timeout-infinity-abort/upstream-package.json +48 -0
  193. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.d.ts +151 -0
  194. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/index.js +122 -0
  195. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/license +9 -0
  196. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/package.json +50 -0
  197. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/readme.md +190 -0
  198. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/regression.test.mjs +5 -0
  199. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test-clock.mjs +65 -0
  200. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/test.mjs +4 -0
  201. package/benches/contrib/oss-skill-independent/ground-truth/timeout-rejection-listener/upstream-package.json +50 -0
  202. package/benches/contrib/oss-skill-independent/prompts/commander-async-listener-order.md +3 -0
  203. package/benches/contrib/oss-skill-independent/prompts/commander-output-isolation.md +3 -0
  204. package/benches/contrib/oss-skill-independent/prompts/limit-async-context.md +3 -0
  205. package/benches/contrib/oss-skill-independent/prompts/limit-map-iteration-rejection.md +3 -0
  206. package/benches/contrib/oss-skill-independent/prompts/throttle-sync-throw.md +3 -0
  207. package/benches/contrib/oss-skill-independent/prompts/timeout-custom-timers.md +3 -0
  208. package/benches/contrib/oss-skill-independent/prompts/timeout-infinity-abort.md +3 -0
  209. package/benches/contrib/oss-skill-independent/prompts/timeout-rejection-listener.md +3 -0
  210. package/benches/contrib/oss-skill-independent/provenance.json +1903 -0
  211. package/benches/contrib/oss-skill-independent/task-specs.json +63 -0
  212. package/benches/contrib/oss-skill-independent/test-clock.mjs +65 -0
  213. package/benches/contrib/oss-skill-independent/verifiers/cases.mjs +197 -0
  214. package/benches/contrib/oss-skill-independent/verifiers/commander-async-listener-order.mjs +1 -0
  215. package/benches/contrib/oss-skill-independent/verifiers/commander-output-isolation.mjs +1 -0
  216. package/benches/contrib/oss-skill-independent/verifiers/grade.mjs +48 -0
  217. package/benches/contrib/oss-skill-independent/verifiers/limit-async-context.mjs +1 -0
  218. package/benches/contrib/oss-skill-independent/verifiers/limit-map-iteration-rejection.mjs +1 -0
  219. package/benches/contrib/oss-skill-independent/verifiers/probe.mjs +16 -0
  220. package/benches/contrib/oss-skill-independent/verifiers/regression-evidence.mjs +105 -0
  221. package/benches/contrib/oss-skill-independent/verifiers/test-reporter.mjs +29 -0
  222. package/benches/contrib/oss-skill-independent/verifiers/throttle-sync-throw.mjs +1 -0
  223. package/benches/contrib/oss-skill-independent/verifiers/timeout-custom-timers.mjs +1 -0
  224. package/benches/contrib/oss-skill-independent/verifiers/timeout-infinity-abort.mjs +1 -0
  225. package/benches/contrib/oss-skill-independent/verifiers/timeout-rejection-listener.mjs +1 -0
  226. package/dist/cli.js +166 -53
  227. package/dist/commands/bench-check-json.test.js +221 -0
  228. package/dist/commands/bench-check-report.js +48 -0
  229. package/dist/commands/bench-command-template.js +129 -0
  230. package/dist/commands/bench-manage.js +91 -0
  231. package/dist/commands/bench-manage.test.js +87 -0
  232. package/dist/commands/bench.js +68 -38
  233. package/dist/commands/bench.test.js +101 -0
  234. package/dist/commands/eval-component.js +17 -0
  235. package/dist/commands/eval-export.js +152 -0
  236. package/dist/commands/eval-export.test.js +122 -0
  237. package/dist/commands/eval.js +14 -3
  238. package/dist/commands/eval.test.js +58 -1
  239. package/dist/harness/bench.js +21 -2
  240. package/dist/harness/eval-audit.js +42 -4
  241. package/dist/harness/eval-budget.js +51 -0
  242. package/dist/harness/eval-budget.test.js +210 -0
  243. package/dist/harness/eval-component.test.js +36 -0
  244. package/dist/harness/eval-contract.js +5 -1
  245. package/dist/harness/replay-package.js +85 -0
  246. package/dist/harness/runner.js +22 -1
  247. package/docs/bench-authoring.md +40 -0
  248. package/docs/bench-check-json.md +115 -0
  249. package/docs/case-management.md +65 -0
  250. package/docs/eval-component.md +60 -49
  251. package/docs/examples/check-receiver-mechanism-proposal.mjs +124 -0
  252. package/docs/examples/prepare-native-diff-probe.mjs +75 -0
  253. package/docs/examples/reproduce-independent-comparison-budget.mjs +73 -0
  254. package/docs/first-real-eval.md +6 -0
  255. package/docs/growth-roadmap-2026-10.md +57 -93
  256. package/docs/metrics.md +21 -0
  257. package/docs/plans/2026-10-14-evidence-and-release-sequence.md +30 -13
  258. package/docs/plans/2026-10-15-independent-comparison-budget.json +1769 -0
  259. package/docs/plans/2026-10-15-independent-comparison-inputs.json +373 -0
  260. package/docs/plans/2026-10-15-independent-comparison-proposal.md +177 -0
  261. package/docs/plans/2026-10-15-native-diff-mechanism.md +105 -0
  262. package/docs/plans/2026-10-15-receiver-mechanism-proposal.json +342 -0
  263. package/docs/plans/2026-10-15-receiver-mechanism-proposal.md +146 -0
  264. package/docs/plans/2026-10-15-receiver-mechanism-verification.json +105 -0
  265. package/docs/plans/2026-10-16-case-workflow-and-release.md +30 -0
  266. package/docs/releases/0.10.0.md +45 -0
  267. package/docs/releases/0.9.0-verification.json +38 -0
  268. package/docs/releases/0.9.0.md +20 -3
  269. package/docs/releases/0.9.1-first-publication.json +249 -0
  270. package/docs/releases/0.9.1-verification.json +122 -0
  271. package/docs/releases/0.9.1.md +65 -0
  272. package/docs/releases/trusted-publishing.md +114 -0
  273. package/docs/replay-packages.md +88 -0
  274. package/docs/schemas/bench-check.schema.json +109 -0
  275. package/docs/schemas/eval-request.schema.json +12 -0
  276. package/docs/sharing-results.md +6 -0
  277. package/docs/skill-evaluation-evidence.md +52 -0
  278. package/evidence/2026-10-15-diagnosing-receiver-correction.md +140 -0
  279. package/evidence/2026-10-15-independent-comparison-regression-stop.md +162 -0
  280. package/evidence/2026-10-15-independent-offline-readiness.md +144 -0
  281. package/evidence/2026-10-15-native-diff-mechanism.md +196 -0
  282. package/evidence/2026-10-15-receiver-mechanism-stop.md +154 -0
  283. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/README.md +35 -0
  284. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/expected.json +577 -0
  285. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/receiver-contract.test.mjs +138 -0
  286. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/replay.mjs +127 -0
  287. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/verification.json +105 -0
  288. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/README.md +32 -0
  289. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/checks.json +32 -0
  290. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
  291. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/verification.json +25 -0
  292. package/evidence/artifacts/2026-10-15-independent-offline-readiness/README.md +17 -0
  293. package/evidence/artifacts/2026-10-15-independent-offline-readiness/verification.json +1548 -0
  294. package/evidence/artifacts/2026-10-15-native-diff-mechanism/README.md +48 -0
  295. package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
  296. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/README.md +38 -0
  297. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/checks.json +118 -0
  298. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
  299. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/verification.json +36 -0
  300. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/LICENSE +21 -0
  301. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/SKILL.md +51 -0
  302. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/agents/openai.yaml +3 -0
  303. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/scripts/hitl-loop.template.sh +44 -0
  304. package/package.json +3 -3
  305. package/skills/skillfit/SKILL.md +17 -5
@@ -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 () => {assert.equal(await api.default(Promise.resolve(7), {milliseconds: 100}), 7);});
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "p-timeout",
3
+ "version": "7.0.0",
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": {
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
+ },
25
+ "files": [
26
+ "index.js",
27
+ "index.d.ts"
28
+ ],
29
+ "keywords": [
30
+ "promise",
31
+ "timeout",
32
+ "error",
33
+ "invalidate",
34
+ "async",
35
+ "await",
36
+ "promises",
37
+ "time",
38
+ "out",
39
+ "cancel",
40
+ "bluebird"
41
+ ],
42
+ "devDependencies": {
43
+ "ava": "^6.4.1",
44
+ "delay": "^6.0.0",
45
+ "in-range": "^3.0.0",
46
+ "p-cancelable": "^4.0.1",
47
+ "sinon": "^21.0.0",
48
+ "time-span": "^5.1.0",
49
+ "tsd": "^0.33.0",
50
+ "xo": "^1.2.2"
51
+ }
52
+ }
@@ -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>;
@@ -0,0 +1,114 @@
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
+
48
+ const cancelablePromise = new Promise((resolve, reject) => {
49
+ if (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {
50
+ throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
51
+ }
52
+
53
+ if (options.signal) {
54
+ const {signal} = options;
55
+ if (signal.aborted) {
56
+ reject(getAbortedReason(signal));
57
+ }
58
+
59
+ signal.addEventListener('abort', () => {
60
+ reject(getAbortedReason(signal));
61
+ });
62
+ }
63
+
64
+ if (milliseconds === Number.POSITIVE_INFINITY) {
65
+ promise.then(resolve, reject);
66
+ return;
67
+ }
68
+
69
+ // We create the error outside of `setTimeout` to preserve the stack trace.
70
+ const timeoutError = new TimeoutError();
71
+
72
+ timer = customTimers.setTimeout.call(undefined, () => {
73
+ if (fallback) {
74
+ try {
75
+ resolve(fallback());
76
+ } catch (error) {
77
+ reject(error);
78
+ }
79
+
80
+ return;
81
+ }
82
+
83
+ if (typeof promise.cancel === 'function') {
84
+ promise.cancel();
85
+ }
86
+
87
+ if (message === false) {
88
+ resolve();
89
+ } else if (message instanceof Error) {
90
+ reject(message);
91
+ } else {
92
+ timeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;
93
+ reject(timeoutError);
94
+ }
95
+ }, milliseconds);
96
+
97
+ (async () => {
98
+ try {
99
+ resolve(await promise);
100
+ } catch (error) {
101
+ reject(error);
102
+ } finally {
103
+ customTimers.clearTimeout.call(undefined, timer);
104
+ }
105
+ })();
106
+ });
107
+
108
+ cancelablePromise.clear = () => {
109
+ customTimers.clearTimeout.call(undefined, timer);
110
+ timer = undefined;
111
+ };
112
+
113
+ return cancelablePromise;
114
+ }
@@ -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,48 @@
1
+ {
2
+ "name": "p-timeout",
3
+ "version": "6.1.1",
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
+ "engines": {
17
+ "node": ">=14.16"
18
+ },
19
+ "scripts": {
20
+ "test": "node --test test.mjs"
21
+ },
22
+ "files": [
23
+ "index.js",
24
+ "index.d.ts"
25
+ ],
26
+ "keywords": [
27
+ "promise",
28
+ "timeout",
29
+ "error",
30
+ "invalidate",
31
+ "async",
32
+ "await",
33
+ "promises",
34
+ "time",
35
+ "out",
36
+ "cancel",
37
+ "bluebird"
38
+ ],
39
+ "devDependencies": {
40
+ "ava": "^4.3.1",
41
+ "delay": "^5.0.0",
42
+ "in-range": "^3.0.0",
43
+ "p-cancelable": "^4.0.1",
44
+ "time-span": "^5.1.0",
45
+ "tsd": "^0.22.0",
46
+ "xo": "^0.54.2"
47
+ }
48
+ }
@@ -0,0 +1,158 @@
1
+ # p-timeout
2
+
3
+ > Timeout a promise after a specified amount of time
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install p-timeout
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import {setTimeout} from 'node:timers/promises';
15
+ import pTimeout from 'p-timeout';
16
+
17
+ const delayedPromise = setTimeout(200);
18
+
19
+ await pTimeout(delayedPromise, {
20
+ milliseconds: 50,
21
+ });
22
+ //=> [TimeoutError: Promise timed out after 50 milliseconds]
23
+ ```
24
+
25
+ ## API
26
+
27
+ ### pTimeout(input, options)
28
+
29
+ Returns a decorated `input` that times out after `milliseconds` time. It has a `.clear()` method that clears the timeout.
30
+
31
+ 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.
32
+
33
+ #### input
34
+
35
+ Type: `Promise`
36
+
37
+ Promise to decorate.
38
+
39
+ #### options
40
+
41
+ Type: `object`
42
+
43
+ ##### milliseconds
44
+
45
+ Type: `number`
46
+
47
+ Milliseconds before timing out.
48
+
49
+ Passing `Infinity` will cause it to never time out.
50
+
51
+ ##### message
52
+
53
+ Type: `string | Error | false`\
54
+ Default: `'Promise timed out after 50 milliseconds'`
55
+
56
+ Specify a custom error message or error to throw when it times out:
57
+
58
+ - `message: 'too slow'` will throw `TimeoutError('too slow')`
59
+ - `message: new MyCustomError('it’s over 9000')` will throw the same error instance
60
+ - `message: false` will make the promise resolve with `undefined` instead of rejecting
61
+
62
+ If you do a custom error, it's recommended to sub-class `TimeoutError`:
63
+
64
+ ```js
65
+ import {TimeoutError} from 'p-timeout';
66
+
67
+ class MyCustomError extends TimeoutError {
68
+ name = "MyCustomError";
69
+ }
70
+ ```
71
+
72
+ ##### fallback
73
+
74
+ Type: `Function`
75
+
76
+ Do something other than rejecting with an error on timeout.
77
+
78
+ You could for example retry:
79
+
80
+ ```js
81
+ import {setTimeout} from 'node:timers/promises';
82
+ import pTimeout from 'p-timeout';
83
+
84
+ const delayedPromise = () => setTimeout(200);
85
+
86
+ await pTimeout(delayedPromise(), {
87
+ milliseconds: 50,
88
+ fallback: () => {
89
+ return pTimeout(delayedPromise(), {milliseconds: 300});
90
+ },
91
+ });
92
+ ```
93
+
94
+ ##### customTimers
95
+
96
+ Type: `object` with function properties `setTimeout` and `clearTimeout`
97
+
98
+ Custom implementations for the `setTimeout` and `clearTimeout` functions.
99
+
100
+ Useful for testing purposes, in particular to work around [`sinon.useFakeTimers()`](https://sinonjs.org/releases/latest/fake-timers/).
101
+
102
+ Example:
103
+
104
+ ```js
105
+ import {setTimeout} from 'node:timers/promises';
106
+ import pTimeout from 'p-timeout';
107
+
108
+ const originalSetTimeout = setTimeout;
109
+ const originalClearTimeout = clearTimeout;
110
+
111
+ sinon.useFakeTimers();
112
+
113
+ // Use `pTimeout` without being affected by `sinon.useFakeTimers()`:
114
+ await pTimeout(doSomething(), {
115
+ milliseconds: 2000,
116
+ customTimers: {
117
+ setTimeout: originalSetTimeout,
118
+ clearTimeout: originalClearTimeout
119
+ }
120
+ });
121
+ ```
122
+
123
+ #### signal
124
+
125
+ Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
126
+
127
+ You can abort the promise using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
128
+
129
+ *Requires Node.js 16 or later.*
130
+
131
+ ```js
132
+ import pTimeout from 'p-timeout';
133
+ import delay from 'delay';
134
+
135
+ const delayedPromise = delay(3000);
136
+
137
+ const abortController = new AbortController();
138
+
139
+ setTimeout(() => {
140
+ abortController.abort();
141
+ }, 100);
142
+
143
+ await pTimeout(delayedPromise, {
144
+ milliseconds: 2000,
145
+ signal: abortController.signal
146
+ });
147
+ ```
148
+
149
+ ### TimeoutError
150
+
151
+ Exposed for instance checking and sub-classing.
152
+
153
+ ## Related
154
+
155
+ - [delay](https://github.com/sindresorhus/delay) - Delay a promise a specified amount of time
156
+ - [p-min-delay](https://github.com/sindresorhus/p-min-delay) - Delay a promise a minimum amount of time
157
+ - [p-retry](https://github.com/sindresorhus/p-retry) - Retry a promise-returning function
158
+ - [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 pTimeout from './index.js';
5
+ test('Infinity keeps abort handling', async () => {const controller = new AbortController(), error = new Error('abort'); controller.abort(error); const state = {status:'pending'}; pTimeout(new Promise(()=>{}), {milliseconds:Infinity,signal:controller.signal}).then(value=>Object.assign(state,{status:'fulfilled',value}), reason=>Object.assign(state,{status:'rejected',reason})); for(let i=0;i<32;i++) await Promise.resolve(); assert.equal(state.status,'rejected'); assert.equal(state.reason,error);});
@@ -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,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 () => {assert.equal(await api.default(Promise.resolve(7), {milliseconds: 100}), 7);});
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "p-timeout",
3
+ "version": "6.1.1",
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
+ "engines": {
17
+ "node": ">=14.16"
18
+ },
19
+ "scripts": {
20
+ "test": "xo && ava && tsd"
21
+ },
22
+ "files": [
23
+ "index.js",
24
+ "index.d.ts"
25
+ ],
26
+ "keywords": [
27
+ "promise",
28
+ "timeout",
29
+ "error",
30
+ "invalidate",
31
+ "async",
32
+ "await",
33
+ "promises",
34
+ "time",
35
+ "out",
36
+ "cancel",
37
+ "bluebird"
38
+ ],
39
+ "devDependencies": {
40
+ "ava": "^4.3.1",
41
+ "delay": "^5.0.0",
42
+ "in-range": "^3.0.0",
43
+ "p-cancelable": "^4.0.1",
44
+ "time-span": "^5.1.0",
45
+ "tsd": "^0.22.0",
46
+ "xo": "^0.54.2"
47
+ }
48
+ }