@tangle-network/agent-eval 0.217.1 → 0.219.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 (258) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/dist/adapters/http.d.ts +3 -3
  3. package/dist/adapters/http.d.ts.map +1 -1
  4. package/dist/adapters/http.js +1 -0
  5. package/dist/adapters/http.js.map +1 -1
  6. package/dist/{agent-profile-DTt8uGP9.d.ts → agent-profile-D01Io2Xw.d.ts} +4 -4
  7. package/dist/{agent-profile-DTt8uGP9.d.ts.map → agent-profile-D01Io2Xw.d.ts.map} +1 -1
  8. package/dist/analyst/index.d.ts +13 -13
  9. package/dist/analyst/index.d.ts.map +1 -1
  10. package/dist/analyst/index.js +10 -10
  11. package/dist/analyst/index.js.map +1 -1
  12. package/dist/{analyze-runs-DyeNcenW.d.ts → analyze-runs-BWAHBDAw.d.ts} +4 -4
  13. package/dist/{analyze-runs-DyeNcenW.d.ts.map → analyze-runs-BWAHBDAw.d.ts.map} +1 -1
  14. package/dist/{benchmark-command-xQK8nOI6.js → benchmark-command-BzmMTnvC.js} +664 -565
  15. package/dist/benchmark-command-BzmMTnvC.js.map +1 -0
  16. package/dist/benchmarks/index.d.ts +5 -5
  17. package/dist/benchmarks/index.js +3 -3
  18. package/dist/benchmarks/index.js.map +1 -1
  19. package/dist/campaign/index.d.ts +8 -8
  20. package/dist/campaign/index.js +11 -11
  21. package/dist/{campaign-CJGkxAQ6.js → campaign-BVPC6ODQ.js} +452 -282
  22. package/dist/campaign-BVPC6ODQ.js.map +1 -0
  23. package/dist/{campaign-evidence-CQYw8_0H.js → campaign-evidence-DunzcJGv.js} +2 -2
  24. package/dist/campaign-evidence-DunzcJGv.js.map +1 -0
  25. package/dist/{chat-client-ldqxYYTN.js → chat-client-CMQ8_h4J.js} +2 -2
  26. package/dist/{chat-client-ldqxYYTN.js.map → chat-client-CMQ8_h4J.js.map} +1 -1
  27. package/dist/{chat-json-call-DavzexSp.js → chat-json-call-BrZKn0L3.js} +2 -2
  28. package/dist/{chat-json-call-DavzexSp.js.map → chat-json-call-BrZKn0L3.js.map} +1 -1
  29. package/dist/cli.js +10 -10
  30. package/dist/{completion-verifier-B_jw6C9p.js → completion-verifier-Cigap8CG.js} +5 -5
  31. package/dist/{completion-verifier-B_jw6C9p.js.map → completion-verifier-Cigap8CG.js.map} +1 -1
  32. package/dist/contract/index.d.ts +11 -11
  33. package/dist/contract/index.js +91 -11
  34. package/dist/contract/index.js.map +1 -1
  35. package/dist/{cost-ledger-D0352Z4d.js → cost-ledger-BGZB6yY2.js} +75 -2
  36. package/dist/cost-ledger-BGZB6yY2.js.map +1 -0
  37. package/dist/{cost-ledger-Jk62OBfF.d.ts → cost-ledger-C1W3ICmP.d.ts} +26 -2
  38. package/dist/cost-ledger-C1W3ICmP.d.ts.map +1 -0
  39. package/dist/{default-registry-ClYjq3QE.js → default-registry-BrKmT01n.js} +310 -278
  40. package/dist/{default-registry-ClYjq3QE.js.map → default-registry-BrKmT01n.js.map} +1 -1
  41. package/dist/{default-registry-DXgLmoDI.d.ts → default-registry-Cwg_QN3d.d.ts} +6 -6
  42. package/dist/{default-registry-DXgLmoDI.d.ts.map → default-registry-Cwg_QN3d.d.ts.map} +1 -1
  43. package/dist/{define-agent-eval-BIkH_gAR.d.ts → define-agent-eval-C2nFhHPu.d.ts} +8 -8
  44. package/dist/{define-agent-eval-BIkH_gAR.d.ts.map → define-agent-eval-C2nFhHPu.d.ts.map} +1 -1
  45. package/dist/{define-agent-eval-BDxNlP3D.js → define-agent-eval-UQY3VbJ2.js} +165 -105
  46. package/dist/define-agent-eval-UQY3VbJ2.js.map +1 -0
  47. package/dist/diagnosis/index.d.ts +2 -2
  48. package/dist/{dspy-rlm-engine-DhdCr1Dc.js → dspy-rlm-engine-Bn_Mt_LW.js} +3 -3
  49. package/dist/{dspy-rlm-engine-DhdCr1Dc.js.map → dspy-rlm-engine-Bn_Mt_LW.js.map} +1 -1
  50. package/dist/{engine-BvZ0R-36.d.ts → engine-BpGGw6cd.d.ts} +3 -3
  51. package/dist/{engine-BvZ0R-36.d.ts.map → engine-BpGGw6cd.d.ts.map} +1 -1
  52. package/dist/eval-campaign-BUMIxKTE.js +393 -0
  53. package/dist/eval-campaign-BUMIxKTE.js.map +1 -0
  54. package/dist/{evaluation-jTjC_QQD.d.ts → evaluation-CBdQt_kr.d.ts} +4 -4
  55. package/dist/{evaluation-jTjC_QQD.d.ts.map → evaluation-CBdQt_kr.d.ts.map} +1 -1
  56. package/dist/evaluation.d.ts +1 -1
  57. package/dist/evaluation.js +1 -1
  58. package/dist/{exact-types-CflbJ9f3.d.ts → exact-types-BYFmYq44.d.ts} +2 -2
  59. package/dist/{exact-types-CflbJ9f3.d.ts.map → exact-types-BYFmYq44.d.ts.map} +1 -1
  60. package/dist/experiment/index.d.ts +24 -1
  61. package/dist/experiment/index.d.ts.map +1 -1
  62. package/dist/experiment/index.js +110 -71
  63. package/dist/experiment/index.js.map +1 -1
  64. package/dist/{exporters-Cl6IeNAu.js → exporters-DWvM16LE.js} +2 -2
  65. package/dist/{exporters-Cl6IeNAu.js.map → exporters-DWvM16LE.js.map} +1 -1
  66. package/dist/{external-optimizer-process-KVFGvYX1.js → external-optimizer-process-wOLfzsCC.js} +2 -2
  67. package/dist/{external-optimizer-process-KVFGvYX1.js.map → external-optimizer-process-wOLfzsCC.js.map} +1 -1
  68. package/dist/{external-optimizer-subprocess-XIHBOSKt.js → external-optimizer-subprocess-D670Oxf2.js} +4 -4
  69. package/dist/{external-optimizer-subprocess-XIHBOSKt.js.map → external-optimizer-subprocess-D670Oxf2.js.map} +1 -1
  70. package/dist/{feedback-trajectory-BWmhRBGu.d.ts → feedback-trajectory-DhB9WzYg.d.ts} +3 -3
  71. package/dist/{feedback-trajectory-BWmhRBGu.d.ts.map → feedback-trajectory-DhB9WzYg.d.ts.map} +1 -1
  72. package/dist/{findings-store-BMVQtEsm.js → findings-store-CvNo712L.js} +6 -6
  73. package/dist/{findings-store-BMVQtEsm.js.map → findings-store-CvNo712L.js.map} +1 -1
  74. package/dist/fuzz.d.ts +1 -1
  75. package/dist/fuzz.js +1 -1
  76. package/dist/{hf-dataset-D9f7-oX7.js → hf-dataset-CKxIJQba.js} +3 -3
  77. package/dist/{hf-dataset-D9f7-oX7.js.map → hf-dataset-CKxIJQba.js.map} +1 -1
  78. package/dist/hosted/index.js +1 -1
  79. package/dist/{index-CX-GAUpw.d.ts → index-CHxwfW5g.d.ts} +2 -2
  80. package/dist/{index-CX-GAUpw.d.ts.map → index-CHxwfW5g.d.ts.map} +1 -1
  81. package/dist/{index-BLGqZ81N.d.ts → index-CVFStrQD.d.ts} +8 -8
  82. package/dist/{index-BLGqZ81N.d.ts.map → index-CVFStrQD.d.ts.map} +1 -1
  83. package/dist/{index-9jJ2fKSX.d.ts → index-CalAsXMR.d.ts} +7 -5
  84. package/dist/index-CalAsXMR.d.ts.map +1 -0
  85. package/dist/{index-CiRwLv2R.d.ts → index-D7fmC-1K.d.ts} +3 -4
  86. package/dist/index-D7fmC-1K.d.ts.map +1 -0
  87. package/dist/{index-BiT6RtNH.d.ts → index-DAXfpVf7.d.ts} +10 -10
  88. package/dist/{index-BiT6RtNH.d.ts.map → index-DAXfpVf7.d.ts.map} +1 -1
  89. package/dist/{index-ZuWx52WG.d.ts → index-Q6DvdcwI.d.ts} +67 -24
  90. package/dist/index-Q6DvdcwI.d.ts.map +1 -0
  91. package/dist/index.d.ts +26 -26
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +615 -692
  94. package/dist/index.js.map +1 -1
  95. package/dist/{integrity-DOd9Q86O.js → integrity-C8oUeB0g.js} +322 -197
  96. package/dist/integrity-C8oUeB0g.js.map +1 -0
  97. package/dist/{integrity-_qgZLA5p.d.ts → integrity-CCwvezWS.d.ts} +2 -2
  98. package/dist/{integrity-_qgZLA5p.d.ts.map → integrity-CCwvezWS.d.ts.map} +1 -1
  99. package/dist/{journal-CR4QikYp.js → journal-C7om8Gum.js} +48 -38
  100. package/dist/journal-C7om8Gum.js.map +1 -0
  101. package/dist/judge-gate-Co5tuh57.js.map +1 -1
  102. package/dist/{judge-gate-DsL0yFcb.d.ts → judge-gate-Dc_mXQsL.d.ts} +2 -2
  103. package/dist/judge-gate-Dc_mXQsL.d.ts.map +1 -0
  104. package/dist/{kind-factory-Gy4fXixd.js → kind-factory-BhxbtUsQ.js} +2 -2
  105. package/dist/{kind-factory-Gy4fXixd.js.map → kind-factory-BhxbtUsQ.js.map} +1 -1
  106. package/dist/ledger-core/index.d.ts +1 -1
  107. package/dist/ledger-core/index.js +2 -2
  108. package/dist/ledger-core/lock-holder.d.ts +2 -0
  109. package/dist/ledger-core/lock-holder.js +181 -0
  110. package/dist/ledger-core/lock-holder.js.map +1 -0
  111. package/dist/{ledger-core-DrJhbms9.js → ledger-core-CAxUdDk0.js} +2 -2
  112. package/dist/{ledger-core-DrJhbms9.js.map → ledger-core-CAxUdDk0.js.map} +1 -1
  113. package/dist/{llm-client-BshCREn6.js → llm-client-DXuOTseU.js} +239 -249
  114. package/dist/llm-client-DXuOTseU.js.map +1 -0
  115. package/dist/{llm-judge-C8jMTNNG.js → llm-judge-Cc8vDJh_.js} +648 -459
  116. package/dist/llm-judge-Cc8vDJh_.js.map +1 -0
  117. package/dist/lock-holder-DaJbfpci.d.ts +86 -0
  118. package/dist/lock-holder-DaJbfpci.d.ts.map +1 -0
  119. package/dist/matrix/index.d.ts +2 -2
  120. package/dist/{matrix-DHe-dwVJ.d.ts → matrix-Cf-AGxGh.d.ts} +4 -4
  121. package/dist/{matrix-DHe-dwVJ.d.ts.map → matrix-Cf-AGxGh.d.ts.map} +1 -1
  122. package/dist/meta-eval/index.d.ts +2 -2
  123. package/dist/{mint-zszyYlpA.js → mint-CbdwjTPW.js} +2 -2
  124. package/dist/{mint-zszyYlpA.js.map → mint-CbdwjTPW.js.map} +1 -1
  125. package/dist/{mint-BRZXuwRi.d.ts → mint-CkzpVPdz.d.ts} +3 -3
  126. package/dist/{mint-BRZXuwRi.d.ts.map → mint-CkzpVPdz.d.ts.map} +1 -1
  127. package/dist/multishot/golden/index.d.ts +1 -1
  128. package/dist/multishot/index.d.ts +2 -2
  129. package/dist/multishot/index.js.map +1 -1
  130. package/dist/openapi.json +1 -1
  131. package/dist/{pareto-BzsxidFD.js → pareto-BiBnQXAE.js} +306 -212
  132. package/dist/pareto-BiBnQXAE.js.map +1 -0
  133. package/dist/pipelines/index.d.ts.map +1 -1
  134. package/dist/pipelines/index.js.map +1 -1
  135. package/dist/{prime-protocol-BWG2DQIk.d.ts → prime-protocol-CckHBxGu.d.ts} +3 -3
  136. package/dist/{prime-protocol-BWG2DQIk.d.ts.map → prime-protocol-CckHBxGu.d.ts.map} +1 -1
  137. package/dist/{promotion-gate-DaY95yU6.d.ts → promotion-gate-CkVZHagC.d.ts} +3 -3
  138. package/dist/{promotion-gate-DaY95yU6.d.ts.map → promotion-gate-CkVZHagC.d.ts.map} +1 -1
  139. package/dist/{proposal-findings-BbWidvUk.js → proposal-findings-E1aSC_cU.js} +2 -2
  140. package/dist/{proposal-findings-BbWidvUk.js.map → proposal-findings-E1aSC_cU.js.map} +1 -1
  141. package/dist/{registry-ssNoHzwD.d.ts → registry-B_yG-1jh.d.ts} +5 -5
  142. package/dist/{registry-ssNoHzwD.d.ts.map → registry-B_yG-1jh.d.ts.map} +1 -1
  143. package/dist/{render-C-w2EZ6p.js → render-Cs34y0iX.js} +404 -208
  144. package/dist/render-Cs34y0iX.js.map +1 -0
  145. package/dist/reporting.d.ts +3 -3
  146. package/dist/{researcher-0ABVIdGa.d.ts → researcher-H0p44OYC.d.ts} +5 -5
  147. package/dist/{researcher-0ABVIdGa.d.ts.map → researcher-H0p44OYC.d.ts.map} +1 -1
  148. package/dist/{reward-DrZ71vnf.d.ts → reward-BeUgVVC_.d.ts} +2 -2
  149. package/dist/{reward-DrZ71vnf.d.ts.map → reward-BeUgVVC_.d.ts.map} +1 -1
  150. package/dist/{reward-hacking-E52wq86n.d.ts → reward-hacking-WTxUbtbb.d.ts} +2 -2
  151. package/dist/{reward-hacking-E52wq86n.d.ts.map → reward-hacking-WTxUbtbb.d.ts.map} +1 -1
  152. package/dist/rl.d.ts +8 -8
  153. package/dist/rl.js +4 -4
  154. package/dist/rollout/index.d.ts +3 -3
  155. package/dist/rollout/index.js +5 -5
  156. package/dist/{rollout-D6C50mfA.js → rollout-Dd1ucT_M.js} +5 -5
  157. package/dist/{rollout-D6C50mfA.js.map → rollout-Dd1ucT_M.js.map} +1 -1
  158. package/dist/{rubric-predictive-validity-DiwT8PbL.d.ts → rubric-predictive-validity-noY7uE03.d.ts} +2 -2
  159. package/dist/{rubric-predictive-validity-DiwT8PbL.d.ts.map → rubric-predictive-validity-noY7uE03.d.ts.map} +1 -1
  160. package/dist/{run-record-CaxbLq6Y.d.ts → run-record-C3awiXPf.d.ts} +2 -2
  161. package/dist/{run-record-CaxbLq6Y.d.ts.map → run-record-C3awiXPf.d.ts.map} +1 -1
  162. package/dist/schema-C-ziyJD7.d.ts.map +1 -1
  163. package/dist/{schema-DxcKTzbi.js → schema-CvhfLjtZ.js} +77 -47
  164. package/dist/schema-CvhfLjtZ.js.map +1 -0
  165. package/dist/search/index.d.ts +2 -2
  166. package/dist/search/index.d.ts.map +1 -1
  167. package/dist/search/index.js +2 -2
  168. package/dist/{search-kernel-DxqjBxA-.d.ts → search-kernel-Dloxd6gs.d.ts} +5 -5
  169. package/dist/{search-kernel-DxqjBxA-.d.ts.map → search-kernel-Dloxd6gs.d.ts.map} +1 -1
  170. package/dist/{search-ledger-TUvB5gWH.js → search-ledger-CZRqtFbW.js} +252 -245
  171. package/dist/search-ledger-CZRqtFbW.js.map +1 -0
  172. package/dist/{search-ledger-file-UKCO2r8a.js → search-ledger-file-Bd5Tioq6.js} +3 -3
  173. package/dist/{search-ledger-file-UKCO2r8a.js.map → search-ledger-file-Bd5Tioq6.js.map} +1 -1
  174. package/dist/{search-shipper-Cw2z3-td.js → search-shipper-Dn3NLsuH.js} +3 -3
  175. package/dist/{search-shipper-Cw2z3-td.js.map → search-shipper-Dn3NLsuH.js.map} +1 -1
  176. package/dist/{search-summary-DQIvJsSB.js → search-summary-D4bwYnAE.js} +3 -3
  177. package/dist/{search-summary-DQIvJsSB.js.map → search-summary-D4bwYnAE.js.map} +1 -1
  178. package/dist/{server-DoVbqqtJ.js → server-8TS8XCvg.js} +3 -3
  179. package/dist/{server-DoVbqqtJ.js.map → server-8TS8XCvg.js.map} +1 -1
  180. package/dist/{single-run-lock-U58yf8N6.js → single-run-lock-Dekd8_Wv.js} +7 -7
  181. package/dist/single-run-lock-Dekd8_Wv.js.map +1 -0
  182. package/dist/{skillopt-optimization-method-kyL94-ri.js → skillopt-optimization-method-DLKqdhcR.js} +1384 -1059
  183. package/dist/skillopt-optimization-method-DLKqdhcR.js.map +1 -0
  184. package/dist/{statistical-heldout-C9AbgREN.d.ts → statistical-heldout-3z3I-kJN.d.ts} +3 -3
  185. package/dist/{statistical-heldout-C9AbgREN.d.ts.map → statistical-heldout-3z3I-kJN.d.ts.map} +1 -1
  186. package/dist/{store-otlp-BteDAbHK.js → store-otlp-dyWE3wAG.js} +2 -2
  187. package/dist/{store-otlp-BteDAbHK.js.map → store-otlp-dyWE3wAG.js.map} +1 -1
  188. package/dist/{store-tool-spans-D5l_OfTJ.js → store-tool-spans-DIUgZbzu.js} +3 -3
  189. package/dist/{store-tool-spans-D5l_OfTJ.js.map → store-tool-spans-DIUgZbzu.js.map} +1 -1
  190. package/dist/{store-tool-spans-DZS0HWVf.d.ts → store-tool-spans-DPwXHQkH.d.ts} +7 -7
  191. package/dist/{store-tool-spans-DZS0HWVf.d.ts.map → store-tool-spans-DPwXHQkH.d.ts.map} +1 -1
  192. package/dist/{summary-report-DM7tlml1.d.ts → summary-report-C8V49Jt3.d.ts} +18 -3
  193. package/dist/summary-report-C8V49Jt3.d.ts.map +1 -0
  194. package/dist/supervisor-run/index.d.ts.map +1 -1
  195. package/dist/supervisor-run/index.js +3 -3
  196. package/dist/{systemone-Bp_Ac0p1.d.ts → systemone-DVA7t76V.d.ts} +6 -6
  197. package/dist/{systemone-Bp_Ac0p1.d.ts.map → systemone-DVA7t76V.d.ts.map} +1 -1
  198. package/dist/{systemone-review-CwE6JGIp.d.ts → systemone-review-CUBMuTLi.d.ts} +2 -2
  199. package/dist/{systemone-review-CwE6JGIp.d.ts.map → systemone-review-CUBMuTLi.d.ts.map} +1 -1
  200. package/dist/systemone.d.ts +3 -3
  201. package/dist/{terminal-record-78g6E4vh.js → terminal-record-D4Rv-j1W.js} +241 -193
  202. package/dist/{terminal-record-78g6E4vh.js.map → terminal-record-D4Rv-j1W.js.map} +1 -1
  203. package/dist/{tool-groups-DyNz2JZ_.d.ts → tool-groups-LISbBWCg.d.ts} +3 -3
  204. package/dist/tool-groups-LISbBWCg.d.ts.map +1 -0
  205. package/dist/{trace-questions-xxwgsuMi.d.ts → trace-questions-C42fYEE4.d.ts} +4 -4
  206. package/dist/{trace-questions-xxwgsuMi.d.ts.map → trace-questions-C42fYEE4.d.ts.map} +1 -1
  207. package/dist/trace-repair/index.d.ts +3 -3
  208. package/dist/traces.d.ts +6 -6
  209. package/dist/traces.js +3 -3
  210. package/dist/trajectory-replay/index.d.ts +4 -1
  211. package/dist/trajectory-replay/index.d.ts.map +1 -1
  212. package/dist/trajectory-replay/index.js +854 -823
  213. package/dist/trajectory-replay/index.js.map +1 -1
  214. package/dist/{tree-BGRglkKd.js → tree-DSqwJpL9.js} +122 -14
  215. package/dist/tree-DSqwJpL9.js.map +1 -0
  216. package/dist/{types-CW8ewATZ.d.ts → types-8yQzNm8u.d.ts} +4 -4
  217. package/dist/{types-CW8ewATZ.d.ts.map → types-8yQzNm8u.d.ts.map} +1 -1
  218. package/dist/{types-D8GhJoHk.d.ts → types-CHfn1zg5.d.ts} +70 -72
  219. package/dist/types-CHfn1zg5.d.ts.map +1 -0
  220. package/dist/{types-DtMbFw6U.d.ts → types-D8GXK9Z5.d.ts} +3 -3
  221. package/dist/{types-DtMbFw6U.d.ts.map → types-D8GXK9Z5.d.ts.map} +1 -1
  222. package/dist/{types-D-mgRzlh.d.ts → types-eMhdacVp.d.ts} +2 -2
  223. package/dist/{types-D-mgRzlh.d.ts.map → types-eMhdacVp.d.ts.map} +1 -1
  224. package/dist/wire/index.d.ts +3 -3
  225. package/dist/wire/index.js +1 -1
  226. package/docs/campaign-proposers.md +16 -0
  227. package/docs/concepts.md +31 -0
  228. package/docs/design/statistics-decisions.md +1 -1
  229. package/docs/eval-surface-map.md +1 -0
  230. package/docs/profile-json-identity.md +1 -2
  231. package/docs/public-api.md +100 -88
  232. package/package.json +8 -6
  233. package/dist/benchmark-command-xQK8nOI6.js.map +0 -1
  234. package/dist/campaign-CJGkxAQ6.js.map +0 -1
  235. package/dist/campaign-evidence-CQYw8_0H.js.map +0 -1
  236. package/dist/cost-ledger-D0352Z4d.js.map +0 -1
  237. package/dist/cost-ledger-Jk62OBfF.d.ts.map +0 -1
  238. package/dist/define-agent-eval-BDxNlP3D.js.map +0 -1
  239. package/dist/eval-campaign-BLEfBGbA.js +0 -343
  240. package/dist/eval-campaign-BLEfBGbA.js.map +0 -1
  241. package/dist/index-9jJ2fKSX.d.ts.map +0 -1
  242. package/dist/index-CiRwLv2R.d.ts.map +0 -1
  243. package/dist/index-ZuWx52WG.d.ts.map +0 -1
  244. package/dist/integrity-DOd9Q86O.js.map +0 -1
  245. package/dist/journal-CR4QikYp.js.map +0 -1
  246. package/dist/judge-gate-DsL0yFcb.d.ts.map +0 -1
  247. package/dist/llm-client-BshCREn6.js.map +0 -1
  248. package/dist/llm-judge-C8jMTNNG.js.map +0 -1
  249. package/dist/pareto-BzsxidFD.js.map +0 -1
  250. package/dist/render-C-w2EZ6p.js.map +0 -1
  251. package/dist/schema-DxcKTzbi.js.map +0 -1
  252. package/dist/search-ledger-TUvB5gWH.js.map +0 -1
  253. package/dist/single-run-lock-U58yf8N6.js.map +0 -1
  254. package/dist/skillopt-optimization-method-kyL94-ri.js.map +0 -1
  255. package/dist/summary-report-DM7tlml1.d.ts.map +0 -1
  256. package/dist/tool-groups-DyNz2JZ_.d.ts.map +0 -1
  257. package/dist/tree-BGRglkKd.js.map +0 -1
  258. package/dist/types-D8GhJoHk.d.ts.map +0 -1
@@ -4,10 +4,10 @@ import { t as confidenceInterval } from "./descriptive-CVNy48rR.js";
4
4
  import { s as wilson } from "./paired-binary-B_nejA44.js";
5
5
  import { r as DECISION_PAIRED_DELTA_STATISTIC } from "./mean-BbA_JCzW.js";
6
6
  import { i as pairedDeltaTest, r as minimumPairsForPairedDeltaTest, t as decidePairedPromotion } from "./paired-promotion-decision-D0SHb-ZL.js";
7
- import { a as SearchLedgerError } from "./search-ledger-file-UKCO2r8a.js";
7
+ import { a as SearchLedgerError } from "./search-ledger-file-Bd5Tioq6.js";
8
8
  import { s as redactText } from "./redact-mtkTiJVk.js";
9
- import { l as searchUnitScores, p as USD_TOLERANCE, t as FileSearchLedger, u as searchCellId } from "./search-ledger-TUvB5gWH.js";
10
- import { t as acquireSingleRunLock } from "./single-run-lock-U58yf8N6.js";
9
+ import { l as searchUnitScores, p as USD_TOLERANCE, t as FileSearchLedger, u as searchCellId } from "./search-ledger-CZRqtFbW.js";
10
+ import { t as acquireSingleRunLock } from "./single-run-lock-Dekd8_Wv.js";
11
11
  //#region src/statistics/normalize-signed-zero.ts
12
12
  /** Normalize IEEE negative zero before numerical evidence reaches canonical JSON. */
13
13
  function normalizeSignedZero(value) {
@@ -262,6 +262,39 @@ function sum(values) {
262
262
  return total;
263
263
  }
264
264
  //#endregion
265
+ //#region src/campaign/search-kernel-artifacts.ts
266
+ /** The artifact each node holds: kept in memory once seen, else loaded from the ledger. */
267
+ var SearchArtifactCache = class {
268
+ load;
269
+ artifacts = /* @__PURE__ */ new Map();
270
+ /** Children a proposal returned, by artifact digest, until they are registered. */
271
+ proposed = /* @__PURE__ */ new Map();
272
+ constructor(load) {
273
+ this.load = load;
274
+ }
275
+ get(nodeId) {
276
+ const held = this.artifacts.get(nodeId);
277
+ if (held !== void 0) return held;
278
+ const artifact = this.load(nodeId);
279
+ this.artifacts.set(nodeId, artifact);
280
+ return artifact;
281
+ }
282
+ seed(nodeId, artifact) {
283
+ this.artifacts.set(nodeId, artifact);
284
+ }
285
+ /** Hold a proposed child until the ledger registers its node. */
286
+ propose(digest, artifact) {
287
+ this.proposed.set(digest, artifact);
288
+ }
289
+ /** The node registered: it takes the artifact proposed under its digest, if one is held. */
290
+ register(nodeId, digest) {
291
+ const held = this.proposed.get(digest);
292
+ if (held === void 0) return;
293
+ this.proposed.delete(digest);
294
+ if (!this.artifacts.has(nodeId)) this.artifacts.set(nodeId, held);
295
+ }
296
+ };
297
+ //#endregion
265
298
  //#region src/paired-promotion-power.ts
266
299
  /**
267
300
  * @module
@@ -1381,6 +1414,119 @@ var SearchKernelClaim = class {
1381
1414
  }
1382
1415
  };
1383
1416
  //#endregion
1417
+ //#region src/campaign/search-kernel-completions.ts
1418
+ /** Hand-off between work that finishes asynchronously and the loop that records it. */
1419
+ /** Completions in arrival order; one waiter at a time sleeps until one arrives or `wakeUp` fires. */
1420
+ var SearchCompletionQueue = class {
1421
+ items = [];
1422
+ wake = null;
1423
+ /** The next completion, or null when `wakeUp` ended the wait without one. */
1424
+ async next() {
1425
+ if (this.items.length === 0) await new Promise((resolve) => {
1426
+ this.wake = resolve;
1427
+ });
1428
+ return this.items.shift() ?? null;
1429
+ }
1430
+ push(item) {
1431
+ this.items.push(item);
1432
+ this.wakeUp();
1433
+ }
1434
+ wakeUp() {
1435
+ const wake = this.wake;
1436
+ this.wake = null;
1437
+ wake?.();
1438
+ }
1439
+ };
1440
+ //#endregion
1441
+ //#region src/campaign/search-kernel-lanes.ts
1442
+ /** Execution lanes: their queues, in-flight counts, and the dollar holds sized from settled spend. */
1443
+ var SearchLanes = class {
1444
+ host;
1445
+ byName = /* @__PURE__ */ new Map();
1446
+ operationCosts = [];
1447
+ constructor(declared, host) {
1448
+ this.host = host;
1449
+ for (const lane of declared) {
1450
+ if (!Number.isSafeInteger(lane.capacity) || lane.capacity < 1) throw new TypeError(`runSearch: lane ${lane.name} needs a positive integer capacity`);
1451
+ if (!Number.isFinite(lane.cellUsd) || lane.cellUsd < 0) throw new TypeError(`runSearch: lane ${lane.name} needs a finite non-negative cellUsd`);
1452
+ if (this.byName.has(lane.name)) throw new TypeError(`runSearch: lane ${lane.name} is declared twice`);
1453
+ this.byName.set(lane.name, {
1454
+ ...lane,
1455
+ inFlight: 0,
1456
+ queues: [
1457
+ [],
1458
+ [],
1459
+ [],
1460
+ []
1461
+ ],
1462
+ settledCosts: []
1463
+ });
1464
+ }
1465
+ if (this.byName.size === 0) throw new TypeError("runSearch: the executor declares no lane");
1466
+ }
1467
+ enqueue(cell) {
1468
+ this.byName.get(cell.lane).queues[STAGE_PRIORITY[cell.stage]].push(cell.cellId);
1469
+ }
1470
+ queuedCount() {
1471
+ let count = 0;
1472
+ for (const lane of this.byName.values()) for (const queue of lane.queues) count += queue.length;
1473
+ return count;
1474
+ }
1475
+ /** Concurrent slots the lanes offer, within the budget's concurrency cap. */
1476
+ capacity() {
1477
+ let total = 0;
1478
+ for (const lane of this.byName.values()) total += lane.capacity;
1479
+ const cap = this.host.state().header.budget.maxConcurrency;
1480
+ return cap === null ? total : Math.min(cap, total);
1481
+ }
1482
+ /** A hard lane holds its enforced maximum. An estimate lane holds 1.5 times
1483
+ * the 99th percentile of its settled cells once 20 settled, else its prior. */
1484
+ cellReservation(lane) {
1485
+ if (lane.costCap === "hard") return {
1486
+ kind: "hard",
1487
+ usd: lane.cellUsd
1488
+ };
1489
+ return {
1490
+ kind: "estimate",
1491
+ usd: estimate(lane.settledCosts, lane.cellUsd)
1492
+ };
1493
+ }
1494
+ maxCellReservation() {
1495
+ let most = 0;
1496
+ for (const lane of this.byName.values()) most = Math.max(most, this.cellReservation(lane).usd);
1497
+ return most;
1498
+ }
1499
+ operationReservation() {
1500
+ return {
1501
+ kind: "estimate",
1502
+ usd: estimate(this.operationCosts, this.host.operationPriorUsd())
1503
+ };
1504
+ }
1505
+ /** A recorded proposal's spend sizes the next proposal's hold. */
1506
+ recordOperationCost(usd) {
1507
+ this.operationCosts.push(usd);
1508
+ }
1509
+ /** Overspend took committed spend, open holds and the unspent claim reserve
1510
+ * past the cap. Nothing new is proposed then, even at a zero-dollar prior. */
1511
+ overCap() {
1512
+ const state = this.host.state();
1513
+ const { maxUsd } = state.header.budget;
1514
+ if (maxUsd === null) return false;
1515
+ const { committedUsd, openReservationUsd } = state.audit.spend;
1516
+ return committedUsd + openReservationUsd + state.budget.claimReserveUsd > maxUsd + USD_TOLERANCE;
1517
+ }
1518
+ pastDeadline() {
1519
+ const deadline = this.host.state().header.budget.deadline;
1520
+ return deadline !== null && this.host.now() >= Date.parse(deadline);
1521
+ }
1522
+ };
1523
+ function estimate(costs, prior) {
1524
+ if (costs.length < 20) return prior;
1525
+ const sorted = [...costs].sort((a, b) => a - b);
1526
+ const p99 = sorted[Math.min(sorted.length - 1, Math.ceil(.99 * sorted.length) - 1)];
1527
+ return Math.round(ESTIMATE_MARGIN * p99 * 1e9) / 1e9;
1528
+ }
1529
+ //#endregion
1384
1530
  //#region src/search/lenses/shared.ts
1385
1531
  /**
1386
1532
  * Shared, pure helpers for `src/search/lenses/*`.
@@ -1710,39 +1856,98 @@ function round4(value) {
1710
1856
  return Math.round(value * 1e4) / 1e4;
1711
1857
  }
1712
1858
  //#endregion
1713
- //#region src/campaign/search-kernel-runner.ts
1714
- /** Event loop and mutable scheduling state for one ledger-backed search. */
1715
- var SearchKernel = class {
1716
- options;
1717
- recorder;
1718
- maxAttempts;
1719
- now;
1859
+ //#region src/campaign/search-kernel-progress.ts
1860
+ var SearchNodeProgress = class {
1720
1861
  state;
1721
- lanes = /* @__PURE__ */ new Map();
1722
- inFlight = /* @__PURE__ */ new Map();
1723
- proposal = null;
1724
- proposalController = null;
1725
- completions = [];
1726
- wake = null;
1727
1862
  /** Unfinished cells per node. */
1728
1863
  pending = /* @__PURE__ */ new Map();
1729
1864
  /** Admitted nodes whose screen finished, in registration order. */
1730
1865
  screened = [];
1731
1866
  screenedSet = /* @__PURE__ */ new Set();
1732
1867
  admitted = /* @__PURE__ */ new Set();
1733
- expansionOf = /* @__PURE__ */ new Map();
1734
- artifacts = /* @__PURE__ */ new Map();
1735
- /** Children a proposal returned, by artifact digest, until they are registered. */
1736
- proposed = /* @__PURE__ */ new Map();
1737
- /** Cells the ledger showed unsettled at start: an earlier process may hold their attempt. */
1738
- adoptable = /* @__PURE__ */ new Set();
1739
- operationCosts = [];
1868
+ constructor(state) {
1869
+ this.state = state;
1870
+ }
1871
+ /** Unfinished cells of a node; zero when none was ever allocated. */
1872
+ count(nodeId) {
1873
+ return this.pending.get(nodeId) ?? 0;
1874
+ }
1875
+ add(nodeId, cells) {
1876
+ this.pending.set(nodeId, this.count(nodeId) + cells);
1877
+ }
1878
+ /** One of the node's cells finished; returns how many remain. */
1879
+ release(nodeId) {
1880
+ const left = (this.pending.get(nodeId) ?? 1) - 1;
1881
+ this.pending.set(nodeId, left);
1882
+ return left;
1883
+ }
1884
+ /** Admitted and running nothing: ready for the allocator to rank. */
1885
+ idle(nodeId) {
1886
+ return this.admitted.has(nodeId) && this.count(nodeId) === 0;
1887
+ }
1888
+ screening() {
1889
+ return this.admitted.size - this.screenedSet.size;
1890
+ }
1891
+ markScreened(nodeId) {
1892
+ if (this.screenedSet.has(nodeId)) return;
1893
+ this.screenedSet.add(nodeId);
1894
+ const state = this.state();
1895
+ const ordinal = state.node(nodeId).ordinal;
1896
+ let index = this.screened.length;
1897
+ while (index > 0 && state.node(this.screened[index - 1]).ordinal > ordinal) index--;
1898
+ this.screened = [
1899
+ ...this.screened.slice(0, index),
1900
+ nodeId,
1901
+ ...this.screened.slice(index)
1902
+ ];
1903
+ }
1904
+ };
1905
+ //#endregion
1906
+ //#region src/campaign/search-kernel-proposals.ts
1907
+ /** The one proposal in flight and the proposals that have completed. */
1908
+ var SearchProposalSlot = class {
1909
+ /** The running proposal, or null when none runs. */
1910
+ running = null;
1911
+ controller = null;
1740
1912
  /** Operations started: the next one's id. */
1741
- expansions = 0;
1913
+ started = 0;
1742
1914
  /** Proposals that completed, by operation index. A proposal an interrupted
1743
1915
  * process lost counts toward none of the stop rules, so a resumed search
1744
1916
  * makes the proposals the uninterrupted one would have made. */
1745
1917
  completed = [];
1918
+ begin(running, controller) {
1919
+ this.running = running;
1920
+ this.controller = controller;
1921
+ }
1922
+ end() {
1923
+ this.running = null;
1924
+ this.controller = null;
1925
+ }
1926
+ abort(reason) {
1927
+ this.controller?.abort(reason);
1928
+ }
1929
+ /** Completed proposals made after the given expansion. */
1930
+ completedAfter(expansion) {
1931
+ return this.completed.filter((index) => index > expansion).length;
1932
+ }
1933
+ };
1934
+ //#endregion
1935
+ //#region src/campaign/search-kernel-runner.ts
1936
+ /** Event loop and mutable scheduling state for one ledger-backed search. */
1937
+ var SearchKernel = class {
1938
+ options;
1939
+ recorder;
1940
+ maxAttempts;
1941
+ state;
1942
+ lanes;
1943
+ inFlight = /* @__PURE__ */ new Map();
1944
+ proposals = new SearchProposalSlot();
1945
+ completions = new SearchCompletionQueue();
1946
+ progress = new SearchNodeProgress(() => this.state);
1947
+ expansionOf = /* @__PURE__ */ new Map();
1948
+ artifacts;
1949
+ /** Cells the ledger showed unsettled at start: an earlier process may hold their attempt. */
1950
+ adoptable = /* @__PURE__ */ new Set();
1746
1951
  stopReason = null;
1747
1952
  failure = null;
1748
1953
  /** The claim's design once expansion stopped; the search then only claims. */
@@ -1751,27 +1956,15 @@ var SearchKernel = class {
1751
1956
  this.options = options;
1752
1957
  this.recorder = options.recorder;
1753
1958
  this.maxAttempts = options.maxAttempts ?? 3;
1754
- this.now = options.now ?? Date.now;
1755
1959
  if (!Number.isSafeInteger(this.maxAttempts) || this.maxAttempts < 1) throw new TypeError("runSearch: maxAttempts must be a positive integer");
1756
1960
  const { maxExpansions } = options;
1757
1961
  if (maxExpansions !== void 0 && (!Number.isSafeInteger(maxExpansions) || maxExpansions < 0)) throw new TypeError("runSearch: maxExpansions must be a non-negative integer");
1758
- for (const lane of options.executor.lanes()) {
1759
- if (!Number.isSafeInteger(lane.capacity) || lane.capacity < 1) throw new TypeError(`runSearch: lane ${lane.name} needs a positive integer capacity`);
1760
- if (!Number.isFinite(lane.cellUsd) || lane.cellUsd < 0) throw new TypeError(`runSearch: lane ${lane.name} needs a finite non-negative cellUsd`);
1761
- if (this.lanes.has(lane.name)) throw new TypeError(`runSearch: lane ${lane.name} is declared twice`);
1762
- this.lanes.set(lane.name, {
1763
- ...lane,
1764
- inFlight: 0,
1765
- queues: [
1766
- [],
1767
- [],
1768
- [],
1769
- []
1770
- ],
1771
- settledCosts: []
1772
- });
1773
- }
1774
- if (this.lanes.size === 0) throw new TypeError("runSearch: the executor declares no lane");
1962
+ this.lanes = new SearchLanes(options.executor.lanes(), {
1963
+ state: () => this.state,
1964
+ now: options.now ?? Date.now,
1965
+ operationPriorUsd: () => options.proposer.reservationUsd ?? 0
1966
+ });
1967
+ this.artifacts = new SearchArtifactCache((nodeId) => options.codec.load(options.recorder, this.state.node(nodeId)));
1775
1968
  const kernel = this;
1776
1969
  this.claim = new SearchKernelClaim({
1777
1970
  get state() {
@@ -1785,12 +1978,12 @@ var SearchKernel = class {
1785
1978
  },
1786
1979
  recorder: this.recorder,
1787
1980
  options,
1788
- lanes: this.lanes,
1981
+ lanes: this.lanes.byName,
1789
1982
  refresh: () => this.refresh(),
1790
- cellReservation: (lane) => this.cellReservation(this.lanes.get(lane.name)),
1791
- maxCellReservation: () => this.maxCellReservation(),
1792
- operationReservation: () => this.operationReservation(),
1793
- enqueue: (cell) => this.enqueue(cell)
1983
+ cellReservation: (lane) => this.lanes.cellReservation(this.lanes.byName.get(lane.name)),
1984
+ maxCellReservation: () => this.lanes.maxCellReservation(),
1985
+ operationReservation: () => this.lanes.operationReservation(),
1986
+ enqueue: (cell) => this.lanes.enqueue(cell)
1794
1987
  });
1795
1988
  }
1796
1989
  async run() {
@@ -1812,8 +2005,8 @@ var SearchKernel = class {
1812
2005
  const { signal } = this.options;
1813
2006
  const onAbort = () => {
1814
2007
  for (const controller of this.inFlight.values()) controller.abort(signal?.reason);
1815
- this.proposalController?.abort(signal?.reason);
1816
- this.wakeUp();
2008
+ this.proposals.abort(signal?.reason);
2009
+ this.completions.wakeUp();
1817
2010
  };
1818
2011
  signal?.addEventListener("abort", onAbort, { once: true });
1819
2012
  try {
@@ -1849,7 +2042,7 @@ var SearchKernel = class {
1849
2042
  await this.refresh();
1850
2043
  } else if (this.state.node(rootId).artifactDigest !== rootInput.artifactDigest) throw new Error(`runSearch: search ${this.recorder.searchId} started from another root artifact; a changed start is a derived search`);
1851
2044
  const root = this.state.rootNodeId;
1852
- this.artifacts.set(root, this.options.root);
2045
+ this.artifacts.seed(root, this.options.root);
1853
2046
  this.expansionOf.set(root, -1);
1854
2047
  if (this.state.audit.cells.allocated === 0) this.claim.assertReady();
1855
2048
  await this.claim.restore();
@@ -1858,11 +2051,11 @@ var SearchKernel = class {
1858
2051
  const operationId = `expand-${expansion}`;
1859
2052
  const operation = this.state.operation(operationId);
1860
2053
  if (!operation) break;
1861
- this.expansions = expansion + 1;
2054
+ this.proposals.started = expansion + 1;
1862
2055
  if (operation.recorded) {
1863
- this.operationCosts.push(operation.spentUsd);
2056
+ this.lanes.recordOperationCost(operation.spentUsd);
1864
2057
  recorded.push(expansion);
1865
- if (operation.outcome === "completed") this.completed.push(expansion);
2058
+ if (operation.outcome === "completed") this.proposals.completed.push(expansion);
1866
2059
  continue;
1867
2060
  }
1868
2061
  await this.recorder.recordOperation({
@@ -1885,24 +2078,24 @@ var SearchKernel = class {
1885
2078
  const edge = this.state.edge(node.edgeIds[0]);
1886
2079
  const expansion = edge.proposer?.operationId ? searchExpansionIndex(edge.proposer.operationId) : null;
1887
2080
  this.expansionOf.set(node.nodeId, expansion ?? -1);
1888
- if (node.status !== "invalid") this.admitted.add(node.nodeId);
2081
+ if (node.status !== "invalid") this.progress.admitted.add(node.nodeId);
1889
2082
  }
1890
2083
  for (const cell of this.state.cells()) {
1891
- const lane = cell.lane === null ? void 0 : this.lanes.get(cell.lane);
2084
+ const lane = cell.lane === null ? void 0 : this.lanes.byName.get(cell.lane);
1892
2085
  if (cell.final && lane) lane.settledCosts.push(cell.spentUsd);
1893
2086
  if (this.cellDone(cell)) continue;
1894
2087
  if (!lane) throw new Error(`runSearch: cell ${cell.cellId} was placed on lane ${String(cell.lane)}, which the executor does not declare`);
1895
2088
  this.adoptable.add(cell.cellId);
1896
- this.enqueue(cell);
1897
- if (cell.stage !== "claim") this.pending.set(cell.nodeId, (this.pending.get(cell.nodeId) ?? 0) + 1);
2089
+ this.lanes.enqueue(cell);
2090
+ if (cell.stage !== "claim") this.progress.add(cell.nodeId, 1);
1898
2091
  }
1899
2092
  if (this.claim.plan) return;
1900
2093
  for (const expansion of recorded) await this.finishProposal(expansion);
1901
- for (const node of this.state.nodes()) if (this.admitted.has(node.nodeId) && !isTerminal(node)) await this.allocateFor(node.nodeId);
2094
+ for (const node of this.state.nodes()) if (this.progress.admitted.has(node.nodeId) && !isTerminal(node)) await this.allocateFor(node.nodeId);
1902
2095
  for (const nodeId of this.state.nodeIds()) {
1903
- if (!this.admitted.has(nodeId)) continue;
1904
- if (this.state.node(nodeId).status === "advanced") this.markScreened(nodeId);
1905
- else if ((this.pending.get(nodeId) ?? 0) === 0) await this.screenDone(nodeId);
2096
+ if (!this.progress.admitted.has(nodeId)) continue;
2097
+ if (this.state.node(nodeId).status === "advanced") this.progress.markScreened(nodeId);
2098
+ else if (this.progress.count(nodeId) === 0) await this.screenDone(nodeId);
1906
2099
  }
1907
2100
  await this.advance();
1908
2101
  }
@@ -1913,36 +2106,20 @@ var SearchKernel = class {
1913
2106
  this.failure ??= { error: this.options.signal?.reason ?? /* @__PURE__ */ new Error("aborted") };
1914
2107
  return;
1915
2108
  }
1916
- if (this.pastDeadline()) {
2109
+ if (this.lanes.pastDeadline()) {
1917
2110
  this.stopReason ??= "deadline";
1918
- if (this.queuedCount() > 0) await this.cancelQueued("deadline");
2111
+ if (this.lanes.queuedCount() > 0) await this.cancelQueued("deadline");
1919
2112
  }
1920
2113
  this.dispatch();
1921
- const blocked = this.stopReason === null && this.proposal === null ? await this.tryExpand() : null;
1922
- if (!(this.inFlight.size > 0 || this.proposal !== null)) {
1923
- if (this.queuedCount() > 0) continue;
2114
+ const blocked = this.stopReason === null && this.proposals.running === null ? await this.tryExpand() : null;
2115
+ if (!(this.inFlight.size > 0 || this.proposals.running !== null)) {
2116
+ if (this.lanes.queuedCount() > 0) continue;
1924
2117
  this.stopReason ??= blocked ?? "converged";
1925
2118
  return;
1926
2119
  }
1927
- await this.handle(await this.next());
2120
+ await this.handle(await this.completions.next());
1928
2121
  }
1929
2122
  }
1930
- /** The next completion, or null when an abort woke the loop without one. */
1931
- async next() {
1932
- if (this.completions.length === 0) await new Promise((resolve) => {
1933
- this.wake = resolve;
1934
- });
1935
- return this.completions.shift() ?? null;
1936
- }
1937
- push(completion) {
1938
- this.completions.push(completion);
1939
- this.wakeUp();
1940
- }
1941
- wakeUp() {
1942
- const wake = this.wake;
1943
- this.wake = null;
1944
- wake?.();
1945
- }
1946
2123
  async handle(completion) {
1947
2124
  if (completion === null) return;
1948
2125
  if (completion.kind === "cell") await this.settle(completion);
@@ -1951,16 +2128,16 @@ var SearchKernel = class {
1951
2128
  /** Abort everything in flight and record what still completes. */
1952
2129
  async drain(reason) {
1953
2130
  for (const controller of this.inFlight.values()) controller.abort(reason);
1954
- this.proposalController?.abort(reason);
1955
- while (this.inFlight.size > 0 || this.proposal !== null) await this.handle(await this.next());
2131
+ this.proposals.abort(reason);
2132
+ while (this.inFlight.size > 0 || this.proposals.running !== null) await this.handle(await this.completions.next());
1956
2133
  }
1957
2134
  /** Fill free lane slots with queued cells. A queued cell was admitted when
1958
2135
  * it was allocated, so starting it needs no further decision. */
1959
2136
  dispatch() {
1960
2137
  if (this.failure || this.options.signal?.aborted) return;
1961
- const claimOnly = this.pastDeadline();
2138
+ const claimOnly = this.lanes.pastDeadline();
1962
2139
  const cap = this.state.header.budget.maxConcurrency;
1963
- for (const lane of this.lanes.values()) while (lane.inFlight < lane.capacity && (cap === null || this.inFlight.size < cap)) {
2140
+ for (const lane of this.lanes.byName.values()) while (lane.inFlight < lane.capacity && (cap === null || this.inFlight.size < cap)) {
1964
2141
  const cellId = (claimOnly ? lane.queues[STAGE_PRIORITY.claim] : lane.queues.find((waiting) => waiting.length > 0))?.shift();
1965
2142
  if (cellId === void 0) break;
1966
2143
  this.start(cellId, lane);
@@ -1982,19 +2159,19 @@ var SearchKernel = class {
1982
2159
  lane: lane.name,
1983
2160
  attempt,
1984
2161
  runId: `${cellId}:${attempt}`,
1985
- artifact: this.artifact(cell.nodeId),
2162
+ artifact: this.artifacts.get(cell.nodeId),
1986
2163
  signal: controller.signal
1987
2164
  };
1988
2165
  const adopt = this.adoptable.delete(cellId);
1989
2166
  this.inFlight.set(cellId, controller);
1990
2167
  lane.inFlight += 1;
1991
2168
  const { executor } = this.options;
1992
- (async () => (adopt ? await executor.adopt(work) : null) ?? await executor.run(work))().then((result) => this.push({
2169
+ (async () => (adopt ? await executor.adopt(work) : null) ?? await executor.run(work))().then((result) => this.completions.push({
1993
2170
  kind: "cell",
1994
2171
  cellId,
1995
2172
  attempt,
1996
2173
  result
1997
- }), (error) => this.push({
2174
+ }), (error) => this.completions.push({
1998
2175
  kind: "cell",
1999
2176
  cellId,
2000
2177
  attempt,
@@ -2005,7 +2182,7 @@ var SearchKernel = class {
2005
2182
  const { cellId, attempt } = completion;
2006
2183
  this.inFlight.delete(cellId);
2007
2184
  const before = this.state.cell(cellId);
2008
- const lane = this.lanes.get(before.lane);
2185
+ const lane = this.lanes.byName.get(before.lane);
2009
2186
  lane.inFlight -= 1;
2010
2187
  if (!completion.result) {
2011
2188
  this.failure ??= { error: completion.error };
@@ -2023,13 +2200,11 @@ var SearchKernel = class {
2023
2200
  if (cell.final) lane.settledCosts.push(cell.spentUsd);
2024
2201
  if (!this.cellDone(cell)) {
2025
2202
  if (this.failure || this.options.signal?.aborted) return;
2026
- this.enqueue(cell);
2203
+ this.lanes.enqueue(cell);
2027
2204
  return;
2028
2205
  }
2029
2206
  if (cell.stage === "claim") return;
2030
- const left = (this.pending.get(cell.nodeId) ?? 1) - 1;
2031
- this.pending.set(cell.nodeId, left);
2032
- if (left === 0) await this.onNodeIdle(cell.nodeId);
2207
+ if (this.progress.release(cell.nodeId) === 0) await this.onNodeIdle(cell.nodeId);
2033
2208
  }
2034
2209
  /** Every cell allocated to the node is done: its screen, or a rung. */
2035
2210
  async onNodeIdle(nodeId) {
@@ -2041,7 +2216,7 @@ var SearchKernel = class {
2041
2216
  * search fails or is aborted, no rung opens; a search that stopped
2042
2217
  * expanding still measures the nodes that earned it. */
2043
2218
  async advance() {
2044
- if (this.claim.plan || this.failure || this.options.signal?.aborted || this.pastDeadline()) return;
2219
+ if (this.claim.plan || this.failure || this.options.signal?.aborted || this.lanes.pastDeadline()) return;
2045
2220
  for (const decision of this.options.allocation.advance(this.allocationView())) await this.allocateFor(decision.nodeId, decision);
2046
2221
  }
2047
2222
  /**
@@ -2051,7 +2226,7 @@ var SearchKernel = class {
2051
2226
  * becomes a parent; any other node is screened. Returns whether it was.
2052
2227
  */
2053
2228
  async screenDone(nodeId) {
2054
- if (!this.claim.plan && !this.screenedSet.has(nodeId) && this.state.node(nodeId).status !== "advanced") {
2229
+ if (!this.claim.plan && !this.progress.screenedSet.has(nodeId) && this.state.node(nodeId).status !== "advanced") {
2055
2230
  const divergence = searchDivergence(this.state, nodeId);
2056
2231
  if (divergence) {
2057
2232
  await this.recorder.decideNode({
@@ -2062,25 +2237,13 @@ var SearchKernel = class {
2062
2237
  reason: divergence.reason
2063
2238
  });
2064
2239
  await this.refresh();
2065
- this.admitted.delete(nodeId);
2240
+ this.progress.admitted.delete(nodeId);
2066
2241
  return false;
2067
2242
  }
2068
2243
  }
2069
- this.markScreened(nodeId);
2244
+ this.progress.markScreened(nodeId);
2070
2245
  return true;
2071
2246
  }
2072
- markScreened(nodeId) {
2073
- if (this.screenedSet.has(nodeId)) return;
2074
- this.screenedSet.add(nodeId);
2075
- const ordinal = this.state.node(nodeId).ordinal;
2076
- let index = this.screened.length;
2077
- while (index > 0 && this.state.node(this.screened[index - 1]).ordinal > ordinal) index--;
2078
- this.screened = [
2079
- ...this.screened.slice(0, index),
2080
- nodeId,
2081
- ...this.screened.slice(index)
2082
- ];
2083
- }
2084
2247
  /**
2085
2248
  * Allocate the cells the allocator plans for a node through its rung and the
2086
2249
  * ledger lacks. With a rank decision, the rung is the decision's, and the
@@ -2099,12 +2262,12 @@ var SearchKernel = class {
2099
2262
  ...plan,
2100
2263
  nodeId
2101
2264
  });
2102
- const lane = this.lanes.get(laneName);
2265
+ const lane = this.lanes.byName.get(laneName);
2103
2266
  if (!lane) throw new Error(`runSearch: the executor placed a cell on unknown lane ${laneName}`);
2104
2267
  return {
2105
2268
  plan,
2106
2269
  lane,
2107
- reservation: this.cellReservation(lane)
2270
+ reservation: this.lanes.cellReservation(lane)
2108
2271
  };
2109
2272
  });
2110
2273
  const hold = placed.reduce((sum, { reservation }) => sum + reservation.usd, 0);
@@ -2125,9 +2288,9 @@ var SearchKernel = class {
2125
2288
  await this.refresh();
2126
2289
  for (const { plan } of placed) {
2127
2290
  const cellId = searchCellId(this.recorder.searchId, nodeId, plan.taskId, plan.split, plan.rep);
2128
- this.enqueue(this.state.cell(cellId));
2291
+ this.lanes.enqueue(this.state.cell(cellId));
2129
2292
  }
2130
- this.pending.set(nodeId, (this.pending.get(nodeId) ?? 0) + placed.length);
2293
+ this.progress.add(nodeId, placed.length);
2131
2294
  this.dispatch();
2132
2295
  return true;
2133
2296
  }
@@ -2135,16 +2298,8 @@ var SearchKernel = class {
2135
2298
  await this.recorder.decideNode(decision);
2136
2299
  await this.refresh();
2137
2300
  }
2138
- enqueue(cell) {
2139
- this.lanes.get(cell.lane).queues[STAGE_PRIORITY[cell.stage]].push(cell.cellId);
2140
- }
2141
- queuedCount() {
2142
- let count = 0;
2143
- for (const lane of this.lanes.values()) for (const queue of lane.queues) count += queue.length;
2144
- return count;
2145
- }
2146
2301
  async cancelQueued(reason) {
2147
- for (const lane of this.lanes.values()) for (const [priority, queue] of lane.queues.entries()) {
2302
+ for (const lane of this.lanes.byName.values()) for (const [priority, queue] of lane.queues.entries()) {
2148
2303
  if (priority === STAGE_PRIORITY.claim) continue;
2149
2304
  for (const cellId of queue.splice(0)) {
2150
2305
  const cell = this.state.cell(cellId);
@@ -2155,9 +2310,7 @@ var SearchKernel = class {
2155
2310
  });
2156
2311
  await this.refresh();
2157
2312
  }
2158
- const left = (this.pending.get(cell.nodeId) ?? 1) - 1;
2159
- this.pending.set(cell.nodeId, left);
2160
- if (left === 0) this.markScreened(cell.nodeId);
2313
+ if (this.progress.release(cell.nodeId) === 0) this.progress.markScreened(cell.nodeId);
2161
2314
  }
2162
2315
  }
2163
2316
  }
@@ -2171,26 +2324,26 @@ var SearchKernel = class {
2171
2324
  const { maxNodes, maxCells } = this.state.header.budget;
2172
2325
  if (maxNodes !== null && this.state.audit.nodes >= maxNodes) return "max-nodes";
2173
2326
  const { maxExpansions } = this.options;
2174
- if (maxExpansions !== void 0 && this.completed.length >= maxExpansions) return "max-nodes";
2175
- if (this.queuedCount() > 0) return "converged";
2176
- if (this.inFlight.size >= 2 * this.capacity()) return "converged";
2327
+ if (maxExpansions !== void 0 && this.proposals.completed.length >= maxExpansions) return "max-nodes";
2328
+ if (this.lanes.queuedCount() > 0) return "converged";
2329
+ if (this.inFlight.size >= 2 * this.lanes.capacity()) return "converged";
2177
2330
  const view = this.policyView();
2178
2331
  const { policy } = this.options;
2179
2332
  const leader = policy.leader(view);
2180
- if (policy.patience !== void 0 && this.completed.filter((index) => index > (this.expansionOf.get(leader) ?? -1)).length >= policy.patience) return "patience";
2333
+ if (policy.patience !== void 0 && this.proposals.completedAfter(this.expansionOf.get(leader) ?? -1) >= policy.patience) return "patience";
2181
2334
  const screen = this.options.allocation.screenSize(this.state);
2182
- const operation = this.operationReservation();
2335
+ const operation = this.lanes.operationReservation();
2183
2336
  const children = this.options.proposer.childrenPerProposal ?? 1;
2184
- const need = operation.usd + children * screen * this.maxCellReservation();
2337
+ const need = operation.usd + children * screen * this.lanes.maxCellReservation();
2185
2338
  const { headroomUsd } = this.state.budget;
2186
- if (headroomUsd !== null && (need > headroomUsd + 1e-9 || this.overCap())) return "budget";
2339
+ if (headroomUsd !== null && (need > headroomUsd + 1e-9 || this.lanes.overCap())) return "budget";
2187
2340
  if (maxCells !== null && this.state.audit.cells.allocated + children * screen > maxCells) return "budget";
2188
2341
  const expansion = policy.expand(view);
2189
2342
  if (expansion === null) return "converged";
2190
2343
  const screened = new Set(view.screened);
2191
2344
  if (expansion.parents.length === 0) throw new Error(`runSearch: policy ${policy.name} proposed an expansion without a parent`);
2192
2345
  for (const parent of expansion.parents) if (!screened.has(parent)) throw new Error(`runSearch: policy ${policy.name} named parent ${parent}, which has not finished its screen; a node becomes a parent only after its screen completes`);
2193
- const index = this.expansions++;
2346
+ const index = this.proposals.started++;
2194
2347
  const operationId = `expand-${index}`;
2195
2348
  await this.recorder.startOperation({
2196
2349
  operationId,
@@ -2205,20 +2358,19 @@ var SearchKernel = class {
2205
2358
  operator: expansion.operator,
2206
2359
  parents: expansion.parents.map((nodeId) => ({
2207
2360
  nodeId,
2208
- artifact: this.artifact(nodeId)
2361
+ artifact: this.artifacts.get(nodeId)
2209
2362
  })),
2210
2363
  leader,
2211
2364
  signal: controller.signal
2212
2365
  };
2213
- this.proposalController = controller;
2214
- this.proposal = this.options.proposer.propose(request).then((result) => this.push({
2366
+ const running = this.options.proposer.propose(request).then((result) => this.completions.push({
2215
2367
  kind: "proposal",
2216
2368
  expansion: index,
2217
2369
  operationId,
2218
2370
  request,
2219
2371
  selection: expansion.selection,
2220
2372
  result
2221
- }), (error) => this.push({
2373
+ }), (error) => this.completions.push({
2222
2374
  kind: "proposal",
2223
2375
  expansion: index,
2224
2376
  operationId,
@@ -2226,11 +2378,11 @@ var SearchKernel = class {
2226
2378
  selection: expansion.selection,
2227
2379
  error
2228
2380
  }));
2381
+ this.proposals.begin(running, controller);
2229
2382
  return null;
2230
2383
  }
2231
2384
  async recordProposal(completion) {
2232
- this.proposal = null;
2233
- this.proposalController = null;
2385
+ this.proposals.end();
2234
2386
  const { operationId, expansion } = completion;
2235
2387
  const { proposer, codec, admit } = this.options;
2236
2388
  const result = completion.result;
@@ -2278,9 +2430,9 @@ var SearchKernel = class {
2278
2430
  artifacts: [this.recorder.blob("proposal", blob)]
2279
2431
  });
2280
2432
  await this.refresh();
2281
- this.operationCosts.push(this.state.operation(operationId).spentUsd);
2282
- this.completed.push(expansion);
2283
- for (const [index, child] of blob.children.entries()) this.proposed.set(child.node.artifactDigest, result.children[index].artifact);
2433
+ this.lanes.recordOperationCost(this.state.operation(operationId).spentUsd);
2434
+ this.proposals.completed.push(expansion);
2435
+ for (const [index, child] of blob.children.entries()) this.artifacts.propose(child.node.artifactDigest, result.children[index].artifact);
2284
2436
  if (result.stop !== void 0 || blob.children.length === 0) this.stopReason ??= "converged";
2285
2437
  await this.finishProposal(expansion);
2286
2438
  }
@@ -2294,11 +2446,7 @@ var SearchKernel = class {
2294
2446
  const { proposer } = this.options;
2295
2447
  for (const [index, child] of blob.children.entries()) {
2296
2448
  const { nodeId } = await this.recorder.registerNode(child.node);
2297
- const held = this.proposed.get(child.node.artifactDigest);
2298
- if (held !== void 0) {
2299
- this.proposed.delete(child.node.artifactDigest);
2300
- if (!this.artifacts.has(nodeId)) this.artifacts.set(nodeId, held);
2301
- }
2449
+ this.artifacts.register(nodeId, child.node.artifactDigest);
2302
2450
  const edgeId = await this.recorder.recordEdge({
2303
2451
  childNodeId: nodeId,
2304
2452
  parents: blob.parents,
@@ -2330,10 +2478,10 @@ var SearchKernel = class {
2330
2478
  await this.refresh();
2331
2479
  continue;
2332
2480
  }
2333
- if (this.admitted.has(nodeId) || node.status === "invalid") continue;
2334
- this.admitted.add(nodeId);
2481
+ if (this.progress.admitted.has(nodeId) || node.status === "invalid") continue;
2482
+ this.progress.admitted.add(nodeId);
2335
2483
  await this.allocateFor(nodeId);
2336
- if ((this.pending.get(nodeId) ?? 0) === 0) this.markScreened(nodeId);
2484
+ if (this.progress.count(nodeId) === 0) this.progress.markScreened(nodeId);
2337
2485
  }
2338
2486
  }
2339
2487
  async close() {
@@ -2349,7 +2497,7 @@ var SearchKernel = class {
2349
2497
  const decisions = unclaimedSearchDecisions(this.state, view, leader, {
2350
2498
  rule: this.options.policy.name,
2351
2499
  stopReason: this.stopReason,
2352
- screened: this.screenedSet
2500
+ screened: this.progress.screenedSet
2353
2501
  });
2354
2502
  for (const decision of decisions) await this.recorder.decideNode(decision);
2355
2503
  await this.recorder.close({
@@ -2360,76 +2508,22 @@ var SearchKernel = class {
2360
2508
  }
2361
2509
  policyView() {
2362
2510
  return searchPolicyView(this.state, {
2363
- screened: this.screened,
2364
- screening: this.admitted.size - this.screenedSet.size,
2365
- expansions: this.completed.length,
2511
+ screened: this.progress.screened,
2512
+ screening: this.progress.screening(),
2513
+ expansions: this.proposals.completed.length,
2366
2514
  maxAttempts: this.maxAttempts
2367
2515
  });
2368
2516
  }
2369
2517
  allocationView() {
2370
2518
  return {
2371
2519
  state: this.state,
2372
- idle: (nodeId) => this.admitted.has(nodeId) && (this.pending.get(nodeId) ?? 0) === 0
2520
+ idle: (nodeId) => this.progress.idle(nodeId)
2373
2521
  };
2374
2522
  }
2375
- artifact(nodeId) {
2376
- const held = this.artifacts.get(nodeId);
2377
- if (held !== void 0) return held;
2378
- const artifact = this.options.codec.load(this.recorder, this.state.node(nodeId));
2379
- this.artifacts.set(nodeId, artifact);
2380
- return artifact;
2381
- }
2382
- capacity() {
2383
- let total = 0;
2384
- for (const lane of this.lanes.values()) total += lane.capacity;
2385
- const cap = this.state.header.budget.maxConcurrency;
2386
- return cap === null ? total : Math.min(cap, total);
2387
- }
2388
- /** A hard lane holds its enforced maximum. An estimate lane holds 1.5 times
2389
- * the 99th percentile of its settled cells once 20 settled, else its prior. */
2390
- cellReservation(lane) {
2391
- if (lane.costCap === "hard") return {
2392
- kind: "hard",
2393
- usd: lane.cellUsd
2394
- };
2395
- return {
2396
- kind: "estimate",
2397
- usd: estimate(lane.settledCosts, lane.cellUsd)
2398
- };
2399
- }
2400
- maxCellReservation() {
2401
- let most = 0;
2402
- for (const lane of this.lanes.values()) most = Math.max(most, this.cellReservation(lane).usd);
2403
- return most;
2404
- }
2405
- operationReservation() {
2406
- return {
2407
- kind: "estimate",
2408
- usd: estimate(this.operationCosts, this.options.proposer.reservationUsd ?? 0)
2409
- };
2410
- }
2411
- /** Overspend took committed spend, open holds and the unspent claim reserve
2412
- * past the cap. Nothing new is proposed then, even at a zero-dollar prior. */
2413
- overCap() {
2414
- const { maxUsd } = this.state.header.budget;
2415
- if (maxUsd === null) return false;
2416
- const { committedUsd, openReservationUsd } = this.state.audit.spend;
2417
- return committedUsd + openReservationUsd + this.state.budget.claimReserveUsd > maxUsd + USD_TOLERANCE;
2418
- }
2419
- pastDeadline() {
2420
- const deadline = this.state.header.budget.deadline;
2421
- return deadline !== null && this.now() >= Date.parse(deadline);
2422
- }
2423
2523
  async refresh() {
2424
2524
  this.state = await this.recorder.state();
2425
2525
  }
2426
2526
  };
2427
- function estimate(costs, prior) {
2428
- if (costs.length < 20) return prior;
2429
- const sorted = [...costs].sort((a, b) => a - b);
2430
- const p99 = sorted[Math.min(sorted.length - 1, Math.ceil(.99 * sorted.length) - 1)];
2431
- return Math.round(ESTIMATE_MARGIN * p99 * 1e9) / 1e9;
2432
- }
2433
2527
  /** Spend of work whose result was lost: unknown, with no proven floor. */
2434
2528
  function interruptedAccounting() {
2435
2529
  return {
@@ -2536,4 +2630,4 @@ function paretoFrontierWithCrowding(candidates, objectives) {
2536
2630
  //#endregion
2537
2631
  export { normalizeSignedZero as A, SEARCH_ESTIMATOR as C, searchEstimateMethod as D, searchCellSetDigest as E, searchPosterior as O, requiredPairsForPairedPromotion as S, estimateNodeFromCells as T, planSearchClaim as _, searchDivergence as a, verifySearchClaim as b, MIN_OUTCOMES_FOR_WEIGHT as c, rankingSplit as d, summarizeSamples as f, decideSearchClaim as g, SEARCH_CLAIM_RULE as h, runSearch as i, seedFromDigest as k, operatorYield as l, searchExpansionIndex as m, paretoFrontier as n, searchPolicyView as o, SEARCH_KERNEL_SOURCE as p, paretoFrontierWithCrowding as r, EXPANSION_OPERATORS as s, dominates as t, INSUFFICIENT_FROM as u, searchClaimDecision as v, estimateNode as w, pairedPromotionPower as x, searchClaimReserveUsd as y };
2538
2632
 
2539
- //# sourceMappingURL=pareto-BzsxidFD.js.map
2633
+ //# sourceMappingURL=pareto-BiBnQXAE.js.map