skillfit 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/README.md +48 -14
  2. package/README.zh-CN.md +48 -14
  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 +183 -64
  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 +166 -128
  233. package/dist/commands/bench.test.js +101 -0
  234. package/dist/commands/eval-component.js +25 -1
  235. package/dist/commands/eval-export.js +178 -0
  236. package/dist/commands/eval-export.test.js +279 -0
  237. package/dist/commands/eval-interruption.test.js +238 -0
  238. package/dist/commands/eval-preflight.js +61 -0
  239. package/dist/commands/eval-preflight.test.js +239 -0
  240. package/dist/commands/eval-report.js +44 -13
  241. package/dist/commands/eval-report.test.js +2 -2
  242. package/dist/commands/eval.js +94 -61
  243. package/dist/commands/eval.test.js +58 -1
  244. package/dist/harness/bench.js +21 -2
  245. package/dist/harness/eval-audit.js +45 -5
  246. package/dist/harness/eval-budget.js +51 -0
  247. package/dist/harness/eval-budget.test.js +212 -0
  248. package/dist/harness/eval-component.test.js +36 -0
  249. package/dist/harness/eval-contract.js +5 -1
  250. package/dist/harness/executors/api.js +10 -1
  251. package/dist/harness/executors/api.test.js +43 -0
  252. package/dist/harness/executors/cli.js +24 -3
  253. package/dist/harness/experiment-session.js +60 -9
  254. package/dist/harness/experiment-session.test.js +43 -1
  255. package/dist/harness/input-snapshot.js +150 -0
  256. package/dist/harness/interruption.js +48 -0
  257. package/dist/harness/interruption.test.js +31 -0
  258. package/dist/harness/replay-package.js +85 -0
  259. package/dist/harness/runner.js +74 -15
  260. package/dist/harness/trigger.js +20 -4
  261. package/docs/bench-authoring.md +40 -0
  262. package/docs/bench-check-json.md +122 -0
  263. package/docs/case-management.md +65 -0
  264. package/docs/eval-case-preflight.md +110 -0
  265. package/docs/eval-component.md +88 -49
  266. package/docs/eval-costs.md +9 -0
  267. package/docs/evaluation-input-snapshots.md +124 -0
  268. package/docs/evaluation-interruption.md +89 -0
  269. package/docs/evaluation-reports.md +49 -0
  270. package/docs/examples/check-receiver-mechanism-proposal.mjs +124 -0
  271. package/docs/examples/prepare-native-diff-probe.mjs +75 -0
  272. package/docs/examples/reproduce-independent-comparison-budget.mjs +73 -0
  273. package/docs/experiment-workflow.md +9 -2
  274. package/docs/first-real-eval.md +10 -1
  275. package/docs/growth-roadmap-2026-10.md +62 -93
  276. package/docs/metrics.md +52 -0
  277. package/docs/plans/2026-10-14-evidence-and-release-sequence.md +29 -12
  278. package/docs/plans/2026-10-15-independent-comparison-budget.json +1769 -0
  279. package/docs/plans/2026-10-15-independent-comparison-inputs.json +373 -0
  280. package/docs/plans/2026-10-15-independent-comparison-proposal.md +177 -0
  281. package/docs/plans/2026-10-15-native-diff-mechanism.md +105 -0
  282. package/docs/plans/2026-10-15-receiver-mechanism-proposal.json +342 -0
  283. package/docs/plans/2026-10-15-receiver-mechanism-proposal.md +146 -0
  284. package/docs/plans/2026-10-15-receiver-mechanism-verification.json +105 -0
  285. package/docs/plans/2026-10-16-case-workflow-and-release.md +49 -0
  286. package/docs/releases/0.10.0-ci-registry-install.json +140 -0
  287. package/docs/releases/0.10.0-feature-smoke.json +22 -0
  288. package/docs/releases/0.10.0-feature-smoke.mjs +62 -0
  289. package/docs/releases/0.10.0-signatures.txt +7 -0
  290. package/docs/releases/0.10.0-verification.json +76 -0
  291. package/docs/releases/0.10.0.md +81 -0
  292. package/docs/releases/0.10.1-feature-smoke.mjs +95 -0
  293. package/docs/releases/0.10.1.md +38 -0
  294. package/docs/releases/0.9.1-first-publication.json +249 -0
  295. package/docs/releases/0.9.1-verification.json +122 -0
  296. package/docs/releases/0.9.1.md +33 -1
  297. package/docs/releases/trusted-publishing.md +61 -0
  298. package/docs/replay-packages.md +97 -0
  299. package/docs/schemas/bench-check.schema.json +109 -0
  300. package/docs/schemas/eval-preflight.schema.json +57 -0
  301. package/docs/schemas/eval-request.schema.json +12 -0
  302. package/docs/schemas/eval-result.schema.json +11 -0
  303. package/docs/sharing-results.md +11 -2
  304. package/docs/skill-evaluation-evidence.md +52 -0
  305. package/evidence/2026-10-15-diagnosing-receiver-correction.md +140 -0
  306. package/evidence/2026-10-15-independent-comparison-regression-stop.md +162 -0
  307. package/evidence/2026-10-15-independent-offline-readiness.md +144 -0
  308. package/evidence/2026-10-15-native-diff-mechanism.md +196 -0
  309. package/evidence/2026-10-15-receiver-mechanism-stop.md +154 -0
  310. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/README.md +35 -0
  311. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/expected.json +577 -0
  312. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/receiver-contract.test.mjs +138 -0
  313. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/replay.mjs +127 -0
  314. package/evidence/artifacts/2026-10-15-diagnosing-receiver-correction/verification.json +105 -0
  315. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/README.md +32 -0
  316. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/checks.json +32 -0
  317. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
  318. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/verification.json +25 -0
  319. package/evidence/artifacts/2026-10-15-independent-offline-readiness/README.md +17 -0
  320. package/evidence/artifacts/2026-10-15-independent-offline-readiness/verification.json +1548 -0
  321. package/evidence/artifacts/2026-10-15-native-diff-mechanism/README.md +48 -0
  322. package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
  323. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/README.md +38 -0
  324. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/checks.json +118 -0
  325. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
  326. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/verification.json +36 -0
  327. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/LICENSE +21 -0
  328. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/SKILL.md +51 -0
  329. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/agents/openai.yaml +3 -0
  330. package/evidence/inputs/diagnosing-bugs-compact-v4.1-receiver/scripts/hitl-loop.template.sh +44 -0
  331. package/package.json +1 -1
  332. package/skills/skillfit/SKILL.md +17 -5
@@ -3,7 +3,7 @@ import { homedir } from 'node:os';
3
3
  import { join, resolve } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { getAgent } from '../agents.js';
6
- import { loadBench } from '../harness/bench.js';
6
+ import { loadBench, selectBenchTasks } from '../harness/bench.js';
7
7
  import { RUN_GROUP_PATTERN } from '../harness/constants.js';
8
8
  import { ExperimentSession, validateCallBudget } from '../harness/experiment-session.js';
9
9
  import { ApiExecutor } from '../harness/executors/api.js';
@@ -18,6 +18,10 @@ import { collectInstalledSkillFingerprint } from '../harness/bundle.js';
18
18
  import { installedUserSkills } from '../harness/receipts.js';
19
19
  import { collectEvaluationTarget } from '../harness/target.js';
20
20
  import { renderTriggerSummary, runTriggerExperiment, } from '../harness/trigger.js';
21
+ import { parseSpendingBudget } from '../harness/eval-budget.js';
22
+ import { withEvaluationInterrupts, throwIfEvaluationInterrupted } from '../harness/interruption.js';
23
+ import { CASE_PREFLIGHT_POLICY, checkEvalCases } from './eval-preflight.js';
24
+ import { INPUT_SNAPSHOT_POLICY } from '../harness/input-snapshot.js';
21
25
  export const DEFAULT_EVAL_TRIALS = 5;
22
26
  function bundledBenchesRoot() {
23
27
  return fileURLToPath(new URL('../../benches', import.meta.url));
@@ -111,7 +115,7 @@ function sessionFor(options, bench, target, trials, runsRoot, runGroup, armNames
111
115
  maxCalls: options.maxCalls, agent: options.agent, injected: options.executor !== undefined,
112
116
  ...options.sessionOptions, guardFiles: options.guardFiles,
113
117
  workspaces: bench.tasks.flatMap(task => armNames.flatMap(arm => Array.from({ length: trials }, (_, i) => join(runsRoot, runGroup, task.id, arm, `trial-${i + 1}`)))),
114
- details });
118
+ details: { ...details, ...(options.taskIds ? { taskIds: bench.tasks.map(task => task.id) } : {}) } });
115
119
  }
116
120
  function estimatePromptTokens(bench, target, inputMode) {
117
121
  let fixtureBytes = 0;
@@ -234,6 +238,7 @@ async function runEvalTrigger(options, bench, skill, trials, log) {
234
238
  : `Compete : ${competitors.map((entry) => entry.name).join(', ')}`;
235
239
  if (options.dryRun) {
236
240
  log(renderTriggerPlan(bench, skill, executor, trials, runsRoot, runGroup, installDir));
241
+ log('Case preflight: pending; required before execution. Dry run does not execute verifiers or oracles.');
237
242
  log(competeLine);
238
243
  log(`Calls : ${plannedCalls} planned; ceiling ${maxCalls} (agent calls only)`);
239
244
  return null;
@@ -244,34 +249,44 @@ async function runEvalTrigger(options, bench, skill, trials, log) {
244
249
  if (!installDir) {
245
250
  throw new Error('trigger mode needs a skill install directory: pass --agent (the matrix provides one) or skillInstallDir.');
246
251
  }
247
- log(renderTriggerPlan(bench, skill, executor, trials, runsRoot, runGroup, installDir).replace(' (dry run)', '').replace(' (not created)', '').replace('Dry run — nothing was written.', `Calls : ${plannedCalls} planned; ceiling ${maxCalls}`));
248
- log(competeLine);
249
- const session = sessionFor(options, bench, skill, trials, runsRoot, runGroup, ['installed'], plannedCalls, { mode: 'trigger', trials, executor: executor.describe() });
250
- let manifest;
251
- try {
252
- manifest = await runTriggerExperiment({
253
- bench,
254
- skill,
255
- executor: session.wrap(executor, 'agent'),
256
- session,
257
- trials,
258
- runsRoot,
259
- runGroup,
260
- skillInstallDir: installDir,
261
- competitors,
262
- detection,
263
- log,
264
- });
265
- }
266
- catch (error) {
267
- session.finish(error);
268
- throw error;
269
- }
270
- session.finish(undefined, manifest);
271
- log(renderTriggerSummary(manifest, join(runsRoot, runGroup, 'manifest.json')));
272
- return manifest;
252
+ return withEvaluationInterrupts(async () => {
253
+ if (existsSync(join(runsRoot, runGroup)))
254
+ throw new Error(`Run group directory already exists: ${join(runsRoot, runGroup)}`);
255
+ const eligible = { ...bench, tasks: bench.tasks.filter(t => t.shouldTrigger !== undefined) };
256
+ const casePreflight = await checkEvalCases(eligible, [skill], false, log);
257
+ throwIfEvaluationInterrupted();
258
+ log(renderTriggerPlan(bench, skill, executor, trials, runsRoot, runGroup, installDir).replace(' (dry run)', '').replace(' (not created)', '').replace('Dry run — nothing was written.', `Calls : ${plannedCalls} planned; ceiling ${maxCalls}`));
259
+ log(competeLine);
260
+ const session = sessionFor(options, bench, skill, trials, runsRoot, runGroup, ['installed'], plannedCalls, { mode: 'trigger', trials, executor: executor.describe(), casePreflight });
261
+ let manifest;
262
+ try {
263
+ manifest = await runTriggerExperiment({
264
+ bench,
265
+ skill,
266
+ executor: session.wrap(executor, 'agent'),
267
+ session,
268
+ trials,
269
+ runsRoot,
270
+ runGroup,
271
+ skillInstallDir: installDir,
272
+ competitors,
273
+ detection,
274
+ log,
275
+ });
276
+ throwIfEvaluationInterrupted();
277
+ }
278
+ catch (error) {
279
+ session.finish(error);
280
+ throw error;
281
+ }
282
+ session.finish(undefined, manifest);
283
+ log(renderTriggerSummary(manifest, join(runsRoot, runGroup, 'manifest.json')));
284
+ return manifest;
285
+ });
273
286
  }
274
287
  export async function runEval(options) {
288
+ if (options.spendingBudget !== undefined && options.mode === 'trigger')
289
+ throw new Error('spendingBudget applies only to paired evaluations.');
275
290
  const executorTimeoutSeconds = options.executorTimeoutSeconds ?? DEFAULT_CLI_TIMEOUT_MS / 1000;
276
291
  if (!Number.isSafeInteger(executorTimeoutSeconds) || executorTimeoutSeconds < 1 || executorTimeoutSeconds > 3600) {
277
292
  throw new Error('executorTimeoutSeconds must be an integer between 1 and 3600.');
@@ -305,7 +320,7 @@ export async function runEval(options) {
305
320
  throw new Error(`--trials must be an integer between 1 and 20, got ${trials}`);
306
321
  }
307
322
  const benchDir = resolveBenchDir(options.bench);
308
- const bench = loadBench(benchDir);
323
+ const bench = selectBenchTasks(loadBench(benchDir), options.taskIds);
309
324
  let target = collectEvaluationTarget(options.skillPath);
310
325
  let baselineTarget;
311
326
  let skillInstallDir;
@@ -371,6 +386,9 @@ export async function runEval(options) {
371
386
  throw new Error(`${target.kind} experiments require a CLI executor; API executors cannot load project configuration files.`);
372
387
  }
373
388
  const judge = options.judgeExecutor !== undefined ? options.judgeExecutor : resolveJudge(options.judgeAgent);
389
+ const spendingBudget = options.spendingBudget === undefined ? undefined : parseSpendingBudget(options.spendingBudget);
390
+ if (spendingBudget && judge)
391
+ throw new Error('spendingBudget requires a paired evaluation without a judge; judge usage is not covered.');
374
392
  if (options.judgeAgent && options.judgeAgent === options.agent) {
375
393
  log('Warning: judge and executor are the same agent — self-preference bias risk (docs/metrics.md L4).');
376
394
  }
@@ -384,18 +402,24 @@ export async function runEval(options) {
384
402
  if (!RUN_GROUP_PATTERN.test(runGroup))
385
403
  throw new Error(`Invalid run group: ${runGroup}`);
386
404
  options.onPlan?.({
405
+ casePreflight: { ...CASE_PREFLIGHT_POLICY, status: 'pending' },
406
+ inputSnapshot: { ...INPUT_SNAPSHOT_POLICY },
387
407
  target: { name: target.name, sourceDir: target.sourceDir, sha256: target.sha256, files: target.files },
388
408
  baseline: baselineTarget ? { name: baselineTarget.name, sourceDir: baselineTarget.sourceDir, sha256: baselineTarget.sha256, files: baselineTarget.files } : null,
389
409
  bench: { name: bench.name, dir: bench.dir, sha256: bench.contentSha256, taskIds: bench.tasks.map(t => t.id) },
390
410
  executor: executor?.describe() ?? null, judge: judge?.describe() ?? null, inputMode,
391
411
  installDir: skillInstallDir ?? null, trials, plannedCalls, maxCalls, pairOrder,
412
+ ...(spendingBudget ? { spendingBudget } : {}),
392
413
  ...(installed ? { nativeDiffTool: nativeDiffDescriptor() } : {}),
393
414
  ...(options.agent || options.executorTimeoutSeconds !== undefined ? { executorTimeoutSeconds } : {}), outputDir: join(runsRoot, runGroup),
394
415
  });
395
416
  if (options.dryRun) {
396
417
  log(renderPlan(bench, target, executor, judge, trials, runsRoot, runGroup, inputMode, baselineTarget));
418
+ log('Case preflight: pending; required before execution. Dry run does not execute verifiers or oracles.');
397
419
  log(`Calls : ${plannedCalls} planned; ceiling ${maxCalls} (includes both judge orders when enabled)`);
398
420
  log(`Pair order: ${pairOrder}; arms remain adjacent`);
421
+ if (spendingBudget)
422
+ log(`Spending stop lines: ${JSON.stringify(spendingBudget)}; checked between calls, in-flight overshoot remains possible`);
399
423
  if (options.agent || options.executorTimeoutSeconds !== undefined)
400
424
  log(`Agent deadline: ${executorTimeoutSeconds}s per invocation in both arms`);
401
425
  if (skillInstallDir) {
@@ -408,36 +432,45 @@ export async function runEval(options) {
408
432
  if (!executor) {
409
433
  throw new Error('No executor available; pass --agent or set SKILLFIT_API_KEY.');
410
434
  }
411
- log(renderPlan(bench, target, executor, judge, trials, runsRoot, runGroup, inputMode, baselineTarget).replace(' (dry run)', '').replace(' (not created)', '').replace('Dry run — nothing was written.', `Calls : ${plannedCalls} planned; ceiling ${maxCalls}`));
412
- const session = sessionFor(options, bench, target, trials, runsRoot, runGroup, ['baseline', 'treatment'], plannedCalls, { mode: installed ? 'installed' : 'inject', inputMode, trials, pairOrder,
413
- ...(installed ? { nativeDiffTool: nativeDiffDescriptor() } : {}),
414
- ...(options.agent || options.executorTimeoutSeconds !== undefined ? { executorTimeoutSeconds } : {}), executor: executor.describe(), judge: judge?.describe() ?? null,
415
- ...(options.component ? { component: options.component } : {}),
416
- ...(baselineTarget ? { baselineTarget: { name: baselineTarget.name, sourceDir: baselineTarget.sourceDir, bundleSha256: baselineTarget.sha256, files: baselineTarget.files } } : {}) }, baselineTarget);
417
- let manifest;
418
- try {
419
- manifest = await runExperiment({
420
- bench,
421
- target,
422
- baselineTarget,
423
- component: options.component,
424
- pairOrder,
425
- inputMode,
426
- ...(skillInstallDir ? { skillInstallDir, skillSearchDirs } : {}),
427
- executor: session.wrap(executor, 'agent'),
428
- judge: judge ? session.wrap(judge, 'judge') : null,
429
- session,
430
- trials,
431
- runsRoot,
432
- runGroup,
433
- log,
434
- });
435
- }
436
- catch (error) {
437
- session.finish(error);
438
- throw error;
439
- }
440
- session.finish(undefined, manifest);
441
- log(renderSummary(manifest, join(runsRoot, runGroup, 'manifest.json')));
442
- return manifest;
435
+ return withEvaluationInterrupts(async () => {
436
+ if (existsSync(join(runsRoot, runGroup)))
437
+ throw new Error(`Run group directory already exists: ${join(runsRoot, runGroup)}`);
438
+ const casePreflight = await checkEvalCases(bench, [target, ...(baselineTarget ? [baselineTarget] : [])], installed, log);
439
+ throwIfEvaluationInterrupted();
440
+ log(renderPlan(bench, target, executor, judge, trials, runsRoot, runGroup, inputMode, baselineTarget).replace(' (dry run)', '').replace(' (not created)', '').replace('Dry run — nothing was written.', `Calls : ${plannedCalls} planned; ceiling ${maxCalls}`));
441
+ const session = sessionFor(options, bench, target, trials, runsRoot, runGroup, ['baseline', 'treatment'], plannedCalls, { mode: installed ? 'installed' : 'inject', inputMode, trials, pairOrder, casePreflight,
442
+ ...(spendingBudget ? { spendingBudget } : {}),
443
+ ...(installed ? { nativeDiffTool: nativeDiffDescriptor() } : {}),
444
+ ...(options.agent || options.executorTimeoutSeconds !== undefined ? { executorTimeoutSeconds } : {}), executor: executor.describe(), judge: judge?.describe() ?? null,
445
+ ...(options.component ? { component: options.component } : {}),
446
+ ...(baselineTarget ? { baselineTarget: { name: baselineTarget.name, sourceDir: baselineTarget.sourceDir, bundleSha256: baselineTarget.sha256, files: baselineTarget.files } } : {}) }, baselineTarget);
447
+ let manifest;
448
+ try {
449
+ manifest = await runExperiment({
450
+ bench,
451
+ target,
452
+ baselineTarget,
453
+ component: options.component,
454
+ pairOrder,
455
+ ...(spendingBudget ? { spendingBudget } : {}),
456
+ inputMode,
457
+ ...(skillInstallDir ? { skillInstallDir, skillSearchDirs } : {}),
458
+ executor: session.wrap(executor, 'agent'),
459
+ judge: judge ? session.wrap(judge, 'judge') : null,
460
+ session,
461
+ trials,
462
+ runsRoot,
463
+ runGroup,
464
+ log,
465
+ });
466
+ throwIfEvaluationInterrupted();
467
+ }
468
+ catch (error) {
469
+ session.finish(error);
470
+ throw error;
471
+ }
472
+ session.finish(undefined, manifest);
473
+ log(renderSummary(manifest, join(runsRoot, runGroup, 'manifest.json')));
474
+ return manifest;
475
+ });
443
476
  }
@@ -1,14 +1,71 @@
1
1
  import assert from 'node:assert/strict';
2
- import { existsSync, mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
4
  import { tmpdir } from 'node:os';
4
5
  import { join } from 'node:path';
5
6
  import { fileURLToPath } from 'node:url';
6
7
  import { test } from 'node:test';
7
8
  import { MockExecutor } from '../harness/executors/mock.js';
8
9
  import { runEval } from './eval.js';
10
+ import { loadBench, selectBenchTasks } from '../harness/bench.js';
11
+ import { reportEvalComponent } from './eval-component.js';
9
12
  const PACKAGE_ROOT = fileURLToPath(new URL('../..', import.meta.url));
10
13
  const BUNDLED_CODE_REVIEW = join(PACKAGE_ROOT, 'benches', 'code-review');
11
14
  const BUNDLED_DEBUGGING = join(PACKAGE_ROOT, 'benches', 'debugging');
15
+ test('task selection preserves manifest order and full hash; budgets and replay use only selected tasks', async (t) => {
16
+ const full = loadBench(BUNDLED_CODE_REVIEW);
17
+ const ids = [full.tasks[1].id, full.tasks[0].id];
18
+ const selected = selectBenchTasks(full, ids);
19
+ assert.deepEqual(selected.tasks.map(task => task.id), [...ids].reverse());
20
+ assert.equal(selected.contentSha256, full.contentSha256);
21
+ const root = tmp(t, 'skillfit-selection-'), runsRoot = join(root, 'runs');
22
+ let calls = 0;
23
+ const mock = new MockExecutor();
24
+ const executor = { describe: () => mock.describe(), run: async (...args) => { calls++; return mock.run(...args); } };
25
+ const base = { skillPath: makeSkill(t), bench: BUNDLED_CODE_REVIEW, taskIds: ids, trials: 1, maxCalls: 4,
26
+ yes: true, executor, judgeExecutor: null, runsRoot, runGroup: 'subset', log: () => { } };
27
+ await runEval({ ...base, dryRun: true, onPlan: plan => {
28
+ assert.equal(plan.plannedCalls, 4);
29
+ assert.deepEqual(plan.bench.taskIds, [...ids].reverse());
30
+ } });
31
+ assert.equal(calls, 0);
32
+ assert.ok(!existsSync(runsRoot));
33
+ const manifest = await runEval({ ...base, dryRun: false });
34
+ assert.ok(manifest && 'overall' in manifest);
35
+ assert.equal(calls, 4);
36
+ assert.equal(manifest.bench.taskCount, 2);
37
+ assert.ok(manifest.warnings.some(w => w.includes('indicative')));
38
+ const native = JSON.parse(readFileSync(join(runsRoot, 'subset/_plan.json'), 'utf8'));
39
+ assert.deepEqual(native.details.taskIds, [...ids].reverse());
40
+ const replay = await reportEvalComponent(join(runsRoot, 'subset'), { replay: true });
41
+ assert.ok('evidence' in replay && replay.evidence.verified);
42
+ assert.equal(calls, 4, 'replay must not call an executor');
43
+ });
44
+ test('invalid or over-budget selections stop before any executor or output starts', async (t) => {
45
+ const runsRoot = join(tmp(t, 'skillfit-selection-invalid-'), 'runs');
46
+ const task = loadBench(BUNDLED_CODE_REVIEW).tasks[0].id;
47
+ let calls = 0;
48
+ const executor = { describe: () => ({ kind: 'mock', model: 'offline' }), run: async () => { calls++; throw new Error('must not run'); } };
49
+ const base = { skillPath: makeSkill(t), bench: BUNDLED_CODE_REVIEW, trials: 1, yes: true,
50
+ dryRun: false, executor, judgeExecutor: null, runsRoot, log: () => { } };
51
+ for (const ids of [[], [task, task], ['absent'], ['../bad']]) {
52
+ await assert.rejects(() => runEval({ ...base, taskIds: ids }), /taskIds|Duplicate task|Unknown task/);
53
+ }
54
+ await assert.rejects(() => runEval({ ...base, taskIds: [task], maxCalls: 1 }), /exceeding/);
55
+ assert.equal(calls, 0);
56
+ assert.ok(!existsSync(runsRoot));
57
+ });
58
+ test('CLI repeatable task selectors preview only selected cases and reject duplicate IDs', t => {
59
+ const cli = fileURLToPath(new URL('../cli.js', import.meta.url));
60
+ const base = [cli, 'eval', makeSkill(t), '--bench', BUNDLED_CODE_REVIEW, '--agent', 'codex', '--trials', '1', '--dry-run'];
61
+ const result = spawnSync(process.execPath, [...base, '--task', 'review-r2', '--task', 'review-r1'], { encoding: 'utf8' });
62
+ assert.equal(result.status, 0, result.stderr);
63
+ assert.match(result.stdout, /2 task\(s\) × 2 conditions × 1 = 4 runs/);
64
+ assert.ok(result.stdout.indexOf('review-r1: fixture') < result.stdout.indexOf('review-r2: fixture'));
65
+ const invalid = spawnSync(process.execPath, [...base, '--task', 'review-r1', '--task', 'review-r1'], { encoding: 'utf8' });
66
+ assert.equal(invalid.status, 1);
67
+ assert.match(invalid.stderr, /Duplicate task/);
68
+ });
12
69
  function tmp(t, prefix) {
13
70
  const dir = mkdtempSync(join(tmpdir(), prefix));
14
71
  t.after(() => rmSync(dir, { recursive: true, force: true }));
@@ -23,7 +23,7 @@ function assertCommandTokensExist(benchDir, command, label) {
23
23
  }
24
24
  }
25
25
  }
26
- function validateTask(benchDir, raw, index) {
26
+ export function validateBenchTask(benchDir, raw, index) {
27
27
  if (typeof raw !== 'object' || raw === null) {
28
28
  throw new Error(`bench.json task #${index + 1} must be an object`);
29
29
  }
@@ -120,7 +120,7 @@ export function loadBench(benchDir) {
120
120
  if (!Array.isArray(raw.tasks) || raw.tasks.length === 0) {
121
121
  throw new Error(`bench.json in ${dir} must list at least one task`);
122
122
  }
123
- const tasks = raw.tasks.map((task, index) => validateTask(dir, task, index));
123
+ const tasks = raw.tasks.map((task, index) => validateBenchTask(dir, task, index));
124
124
  const seen = new Set();
125
125
  for (const task of tasks) {
126
126
  if (seen.has(task.id)) {
@@ -132,3 +132,22 @@ export function loadBench(benchDir) {
132
132
  const contentSha256 = hashFileSet(dir, listFilesRecursive(dir));
133
133
  return { dir, name, schemaVersion: BENCH_SCHEMA_VERSION, tasks, contentSha256 };
134
134
  }
135
+ /** Keep manifest order so selecting IDs cannot silently change balanced pair order. */
136
+ export function parseTaskIds(value) {
137
+ const taskIds = value;
138
+ if (!Array.isArray(taskIds) || taskIds.length === 0 || taskIds.some(id => typeof id !== 'string' || !TASK_ID_PATTERN.test(id))) {
139
+ throw new Error('taskIds must be a nonempty array of valid task IDs.');
140
+ }
141
+ if (new Set(taskIds).size !== taskIds.length)
142
+ throw new Error('Duplicate task selection.');
143
+ return [...taskIds];
144
+ }
145
+ export function selectBenchTasks(bench, selection) {
146
+ if (selection === undefined)
147
+ return bench;
148
+ const taskIds = parseTaskIds(selection);
149
+ const missing = taskIds.filter(id => !bench.tasks.some(task => task.id === id));
150
+ if (missing.length)
151
+ throw new Error(`Unknown task selection: ${missing.join(', ')}`);
152
+ return { ...bench, tasks: bench.tasks.filter(task => taskIds.includes(task.id)) };
153
+ }
@@ -13,6 +13,8 @@ import { verdictFromOutput } from './verifier-summary.js';
13
13
  import { parseEvalReport } from '../commands/eval-report.js';
14
14
  import { pairConditions } from './types.js';
15
15
  import { NATIVE_DIFF_PATH, NATIVE_DIFF_SNAPSHOT } from './native-diff.js';
16
+ import { assertSpendingCanContinue, parseSpendingBudget, spendingBudgetState } from './eval-budget.js';
17
+ import { verifyInputSnapshot } from './input-snapshot.js';
16
18
  function inside(root, path) {
17
19
  const rel = relative(root, path);
18
20
  return !isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${sep}`);
@@ -98,6 +100,7 @@ export async function auditEvaluation(value, runDir, options = {}) {
98
100
  assert.equal(index.planSha256, report.experiment.planSha256);
99
101
  assert.deepEqual(readComponentJson(join(root, '_session.json')).value, report.experiment);
100
102
  const plan = record(readComponentJson(join(root, '_plan.json')).value, 'native plan');
103
+ const inputSnapshot = verifyInputSnapshot(root, plan);
101
104
  const details = record(plan.details, 'native plan details');
102
105
  let pairOrder = null;
103
106
  if (raw.pairOrder !== undefined || details.pairOrder !== undefined) {
@@ -136,11 +139,14 @@ export async function auditEvaluation(value, runDir, options = {}) {
136
139
  else
137
140
  assert.equal(raw.nativeDiffTool, undefined, 'Unrecorded native diff environment.');
138
141
  const all = { baseline: [], treatment: [] }, paired = { baseline: [], treatment: [] };
139
- const bench = options.replay ? loadBench(options.benchDir ?? String(record(raw.bench, 'bench').dir)) : null;
142
+ if (details.taskIds !== undefined)
143
+ assert.deepEqual(details.taskIds, report.tasks.map(task => task.id), 'Selected task IDs differ from the frozen plan.');
144
+ const bench = options.replay ? loadBench(options.benchDir ?? inputSnapshot?.roots.get('bench') ?? String(record(raw.bench, 'bench').dir)) : null;
140
145
  if (bench)
141
146
  assert.equal(bench.contentSha256, report.bench.sha256, 'Replay bench differs from the frozen task set.');
142
147
  let invoked = 0;
143
148
  const expectedAgentOrder = [];
149
+ const budgetReceipts = new Map();
144
150
  const rawTasks = raw.tasks;
145
151
  for (const [taskIndex, task] of report.tasks.entries()) {
146
152
  assert.ok(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(task.id), 'Unsafe task id.');
@@ -151,6 +157,7 @@ export async function auditEvaluation(value, runDir, options = {}) {
151
157
  const rel = `${task.id}/${arm}/trial-${trial}/_result.json`;
152
158
  assert.ok(typeof files[rel] === 'string', `Receipt not sealed: ${rel}`);
153
159
  const r = receipt(readComponentJson(member(root, rel)).value);
160
+ budgetReceipts.set(`${task.id}/${arm}/trial-${trial}`, r);
154
161
  assert.equal(r.condition, arm);
155
162
  assert.equal(r.taskId, task.id);
156
163
  assert.equal(r.trial, trial);
@@ -240,6 +247,28 @@ export async function auditEvaluation(value, runDir, options = {}) {
240
247
  if (pairOrder)
241
248
  assert.deepEqual(ledger.filter(e => e.event === 'started' && e.role === 'agent')
242
249
  .map(e => String(e.workdir).split(/[\\/]/).slice(-3).join('/')), expectedAgentOrder, 'Recorded execution order differs from the frozen pair order.');
250
+ if (details.spendingBudget !== undefined) {
251
+ const limits = parseSpendingBudget(details.spendingBudget);
252
+ assert.ok(pairOrder, 'Budget replay requires the recorded pair order.');
253
+ assert.ok(typeof files['_budget.jsonl'] === 'string', 'Budget events are not sealed.');
254
+ const events = readFileSync(join(root, '_budget.jsonl'), 'utf8').trim().split('\n').filter(Boolean).map(line => JSON.parse(line));
255
+ assert.equal(events.length, expectedAgentOrder.length * 2, 'Budget event coverage differs from calls.');
256
+ const observations = [];
257
+ for (const [ordinal, path] of expectedAgentOrder.entries()) {
258
+ const [taskId, condition, trialPath] = path.split('/');
259
+ const trial = Number(trialPath.slice('trial-'.length));
260
+ const before = spendingBudgetState(limits, observations);
261
+ assertSpendingCanContinue(before);
262
+ assert.deepEqual(events[ordinal * 2], { phase: 'before-call', taskId, condition, trial, state: before }, 'Budget before-call state differs from receipts.');
263
+ observations.push(budgetReceipts.get(path));
264
+ const after = spendingBudgetState(limits, observations);
265
+ assert.equal(after.incomplete.length, 0, 'Budget run has missing final usage.');
266
+ assert.notEqual(after.reason, 'EXECUTION_FAILED');
267
+ assert.deepEqual(events[ordinal * 2 + 1], { phase: 'after-call', taskId, condition, trial, state: after }, 'Budget after-call state differs from receipts.');
268
+ }
269
+ }
270
+ else
271
+ assert.equal(files['_budget.jsonl'], undefined, 'Budget events were not declared in the native plan.');
243
272
  // This component does not run a judge whose separate usage would be absent from agent costs.
244
273
  assert.ok(raw.judge == null, 'Judge usage is not covered by component accounting.');
245
274
  audit.verified = true;
@@ -256,12 +285,22 @@ export function stoppedAccounting(runDir) {
256
285
  const paired = { baseline: [], treatment: [] };
257
286
  const ledger = existsSync(join(root, '_calls.jsonl')) ? readFileSync(join(root, '_calls.jsonl'), 'utf8').trim().split('\n').filter(Boolean).map(line => record(JSON.parse(line), 'ledger')) : [];
258
287
  let missingReceipts = 0;
288
+ const invalidReceipts = [];
259
289
  for (const event of ledger.filter(e => e.event === 'started' && e.role === 'agent')) {
260
290
  const parts = String(event.workdir).split(/[\\/]/), trialDir = parts.slice(-3).join('/');
261
291
  assert.ok(/^[a-zA-Z0-9][a-zA-Z0-9._-]*\/(baseline|treatment)\/trial-[0-9]+$/.test(trialDir));
262
292
  const arm = parts.at(-2), file = join(root, trialDir, '_result.json');
263
- if (existsSync(file))
264
- all[arm].push(receipt(readComponentJson(file).value));
293
+ if (existsSync(file)) {
294
+ try {
295
+ all[arm].push(receipt(readComponentJson(file).value));
296
+ }
297
+ catch (error) {
298
+ // Keep the malformed file untouched. It is not safe to turn invalid counters
299
+ // into a complete cost record, nor to hide every other retained invocation.
300
+ invalidReceipts.push({ path: `${trialDir}/_result.json`, reason: String(error) });
301
+ all[arm].push({ executorInvoked: true, passed: false, error: 'Invocation receipt invalid; raw file retained', durationSeconds: NaN, tokens: null, usageStatus: 'unknown' });
302
+ }
303
+ }
265
304
  else {
266
305
  missingReceipts++;
267
306
  all[arm].push({ executorInvoked: true, passed: false, error: 'Invocation receipt missing', durationSeconds: NaN, tokens: null, usageStatus: 'unknown' });
@@ -269,7 +308,8 @@ export function stoppedAccounting(runDir) {
269
308
  }
270
309
  const populations = summarizeCosts(all, paired);
271
310
  return { populations, startedAgentDispatches: all.baseline.length + all.treatment.length,
272
- recordedExecutorInvocations: populations.attempts.baseline.runs + populations.attempts.treatment.runs - missingReceipts,
273
- invocationsWithUnknownReceipts: missingReceipts,
311
+ recordedExecutorInvocations: populations.attempts.baseline.runs + populations.attempts.treatment.runs - missingReceipts - invalidReceipts.length,
312
+ invocationsWithUnknownReceipts: missingReceipts + invalidReceipts.length,
313
+ ...(invalidReceipts.length ? { invalidReceipts } : {}),
274
314
  scope: 'Known agent invocation spending from stopped-run receipts; missing fields remain unknown. No paired efficacy comparison or exact bill.' };
275
315
  }
@@ -0,0 +1,51 @@
1
+ import { COST_METRICS, summarizeCosts } from './costs.js';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ export function parseSpendingBudget(value) {
5
+ if (!value || typeof value !== 'object' || Array.isArray(value))
6
+ throw new Error('spendingBudget must be an object.');
7
+ const input = value;
8
+ if (Object.keys(input).some(key => !COST_METRICS.includes(key)))
9
+ throw new Error('spendingBudget has unknown fields.');
10
+ return Object.fromEntries(COST_METRICS.map(metric => {
11
+ const amount = input[metric];
12
+ if (typeof amount !== 'number' || !Number.isFinite(amount) || amount <= 0 || amount > Number.MAX_SAFE_INTEGER ||
13
+ (metric !== 'durationSeconds' && !Number.isSafeInteger(amount))) {
14
+ throw new Error(`spendingBudget.${metric} must be a positive ${metric === 'durationSeconds' ? 'finite number' : 'safe integer'}.`);
15
+ }
16
+ return [metric, amount];
17
+ }));
18
+ }
19
+ export function spendingBudgetState(limits, observations) {
20
+ const counter = (value) => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 ? value : undefined;
21
+ const normalized = observations.map(row => ({ ...row, tokens: row.tokens ? {
22
+ input: counter(row.tokens.input), cachedInput: counter(row.tokens.cachedInput), output: counter(row.tokens.output),
23
+ } : null }));
24
+ const population = summarizeCosts({ baseline: normalized, treatment: [] }, { baseline: [], treatment: [] }).attempts.baseline;
25
+ const reached = COST_METRICS.filter(metric => population.metrics[metric].knownTotal >= limits[metric]);
26
+ const incomplete = COST_METRICS.filter(metric => population.metrics[metric].coverage.final !== population.runs);
27
+ const executionFailed = observations.some(row => row.error !== null);
28
+ const reason = executionFailed ? 'EXECUTION_FAILED' : incomplete.length ? 'FINAL_USAGE_MISSING' : reached.length ? 'SPENDING_BUDGET_REACHED' : null;
29
+ return { schemaVersion: 1, invocations: population.runs, metrics: population.metrics, reached, incomplete, reason };
30
+ }
31
+ export function assertSpendingCanContinue(state) {
32
+ if (state.reason)
33
+ throw new Error(`${state.reason}: no further agent calls; reached=${state.reached.join(',') || 'none'}, incomplete=${state.incomplete.join(',') || 'none'}. Retained spending is not discarded; no retry or replacement.`);
34
+ }
35
+ /** Informational on stopped evidence; a completed native audit verifies every event. */
36
+ export function spendingBudgetReport(runDir) {
37
+ const planPath = join(runDir, '_plan.json');
38
+ if (!existsSync(planPath))
39
+ return null;
40
+ const plan = JSON.parse(readFileSync(planPath, 'utf8'));
41
+ if (plan.details?.spendingBudget === undefined)
42
+ return null;
43
+ const limits = parseSpendingBudget(plan.details.spendingBudget), path = join(runDir, '_budget.jsonl');
44
+ try {
45
+ const events = existsSync(path) ? readFileSync(path, 'utf8').trim().split('\n').filter(Boolean).map(line => JSON.parse(line)) : [];
46
+ return { limits, events: events.length, latestState: events.at(-1)?.state ?? null, readError: null };
47
+ }
48
+ catch (error) {
49
+ return { limits, events: null, latestState: null, readError: String(error) };
50
+ }
51
+ }