@tangle-network/agent-eval 2.0.7 → 2.0.10

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 (314) hide show
  1. package/CHANGELOG.md +80 -16
  2. package/dist/adapters/http.d.ts +2 -2
  3. package/dist/{agent-profile-CRdalpZv.d.ts → agent-profile-_JzxgLDM.d.ts} +11 -5
  4. package/dist/{agent-profile-CRdalpZv.d.ts.map → agent-profile-_JzxgLDM.d.ts.map} +1 -1
  5. package/dist/analyst/index.d.ts +14 -13
  6. package/dist/analyst/index.d.ts.map +1 -1
  7. package/dist/analyst/index.js +34 -13
  8. package/dist/analyst/index.js.map +1 -1
  9. package/dist/analyze-runs-Izz_ZeWg.d.ts +65 -0
  10. package/dist/analyze-runs-Izz_ZeWg.d.ts.map +1 -0
  11. package/dist/{analyze-runs-C_9cXPZn.js → analyze-runs-xhH2Qxoc.js} +6 -5
  12. package/dist/{analyze-runs-C_9cXPZn.js.map → analyze-runs-xhH2Qxoc.js.map} +1 -1
  13. package/dist/app-grade/index.d.ts +4 -4
  14. package/dist/app-grade/index.js +1 -1
  15. package/dist/{benchmark-command-DkBMUDwy.js → benchmark-command-CGQXNFj7.js} +12 -8
  16. package/dist/benchmark-command-CGQXNFj7.js.map +1 -0
  17. package/dist/benchmarks/index.d.ts +4 -4
  18. package/dist/benchmarks/index.js +4 -4
  19. package/dist/builder-eval/index.js +2 -2
  20. package/dist/calibration-CrORXMWx.d.ts +128 -0
  21. package/dist/calibration-CrORXMWx.d.ts.map +1 -0
  22. package/dist/{calibration-Cfoup0xz.js → calibration-Dz8mQb5P.js} +2 -2
  23. package/dist/{calibration-Cfoup0xz.js.map → calibration-Dz8mQb5P.js.map} +1 -1
  24. package/dist/campaign/index.d.ts +8 -8
  25. package/dist/campaign/index.js +13 -12
  26. package/dist/{campaign-DfSWSreo.js → campaign-eus7YRs2.js} +1590 -15
  27. package/dist/campaign-eus7YRs2.js.map +1 -0
  28. package/dist/{campaign-evidence-BojANgU7.d.ts → campaign-evidence-BOcX4w0r.d.ts} +5 -5
  29. package/dist/{campaign-evidence-BojANgU7.d.ts.map → campaign-evidence-BOcX4w0r.d.ts.map} +1 -1
  30. package/dist/{campaign-evidence-D_oBFfLc.js → campaign-evidence-KM5GTsHG.js} +5 -5
  31. package/dist/{campaign-evidence-D_oBFfLc.js.map → campaign-evidence-KM5GTsHG.js.map} +1 -1
  32. package/dist/{cluster-Bj90LK-1.d.ts → chat-client-BlTooBDA.d.ts} +9 -241
  33. package/dist/chat-client-BlTooBDA.d.ts.map +1 -0
  34. package/dist/{chat-client-CvyDOQBv.js → chat-client-Oyot5tyo.js} +2 -2
  35. package/dist/{chat-client-CvyDOQBv.js.map → chat-client-Oyot5tyo.js.map} +1 -1
  36. package/dist/{chat-json-call-DMrwmB-k.js → chat-json-call-DTmv2uNY.js} +2 -2
  37. package/dist/{chat-json-call-DMrwmB-k.js.map → chat-json-call-DTmv2uNY.js.map} +1 -1
  38. package/dist/cli.js +7 -7
  39. package/dist/cluster-BJ0nW3P7.d.ts +241 -0
  40. package/dist/cluster-BJ0nW3P7.d.ts.map +1 -0
  41. package/dist/{cluster-bootstrap-DPzVy3_K.js → cluster-bootstrap-CTC8Dd30.js} +3 -2
  42. package/dist/{cluster-bootstrap-DPzVy3_K.js.map → cluster-bootstrap-CTC8Dd30.js.map} +1 -1
  43. package/dist/{completion-verifier-DsotH2l3.js → completion-verifier-CCPG2Yc0.js} +3 -3
  44. package/dist/{completion-verifier-DsotH2l3.js.map → completion-verifier-CCPG2Yc0.js.map} +1 -1
  45. package/dist/{completion-verifier-Cy38EpGE.d.ts → completion-verifier-CQOC3_bm.d.ts} +2 -2
  46. package/dist/{completion-verifier-Cy38EpGE.d.ts.map → completion-verifier-CQOC3_bm.d.ts.map} +1 -1
  47. package/dist/contract/index.d.ts +14 -12
  48. package/dist/contract/index.js +14 -12
  49. package/dist/contract/index.js.map +1 -1
  50. package/dist/{decision-point-C46p-p9v.js → decision-point-CfqtnGop.js} +3 -3
  51. package/dist/{decision-point-C46p-p9v.js.map → decision-point-CfqtnGop.js.map} +1 -1
  52. package/dist/{default-registry-BWFPtmuI.js → default-registry-Rs5uzlfJ.js} +4 -4
  53. package/dist/{default-registry-BWFPtmuI.js.map → default-registry-Rs5uzlfJ.js.map} +1 -1
  54. package/dist/{default-registry-xoX0PMCb.d.ts → default-registry-X8McMoUV.d.ts} +6 -6
  55. package/dist/{default-registry-xoX0PMCb.d.ts.map → default-registry-X8McMoUV.d.ts.map} +1 -1
  56. package/dist/define-agent-eval-D8ntOXqV.js +96 -0
  57. package/dist/define-agent-eval-D8ntOXqV.js.map +1 -0
  58. package/dist/define-agent-eval-DH5-xi-F.d.ts +52 -0
  59. package/dist/define-agent-eval-DH5-xi-F.d.ts.map +1 -0
  60. package/dist/diagnosis/index.d.ts +3 -3
  61. package/dist/diagnosis/index.js +1 -1
  62. package/dist/{dspy-rlm-engine-r7YpKLhS.js → dspy-rlm-engine-ChE1PUM5.js} +3 -3
  63. package/dist/{dspy-rlm-engine-r7YpKLhS.js.map → dspy-rlm-engine-ChE1PUM5.js.map} +1 -1
  64. package/dist/{emitter-BjW3NnX-.js → emitter-xN9wGTVw.js} +9 -2
  65. package/dist/{emitter-BjW3NnX-.js.map → emitter-xN9wGTVw.js.map} +1 -1
  66. package/dist/{eval-campaign-Cyk-tkLh.js → eval-campaign-BciGnrGy.js} +3 -3
  67. package/dist/{eval-campaign-Cyk-tkLh.js.map → eval-campaign-BciGnrGy.js.map} +1 -1
  68. package/dist/{evaluation-X5E22NQK.d.ts → evaluation-CjZH6gW0.d.ts} +4 -4
  69. package/dist/{evaluation-X5E22NQK.d.ts.map → evaluation-CjZH6gW0.d.ts.map} +1 -1
  70. package/dist/evaluation.d.ts +1 -1
  71. package/dist/{exact-types-DjuabhUV.d.ts → exact-types-BIHqYBYf.d.ts} +2 -2
  72. package/dist/{exact-types-DjuabhUV.d.ts.map → exact-types-BIHqYBYf.d.ts.map} +1 -1
  73. package/dist/{execution-insight-CE20Bxq0.d.ts → execution-insight-YihQrSqd.d.ts} +2 -2
  74. package/dist/{execution-insight-CE20Bxq0.d.ts.map → execution-insight-YihQrSqd.d.ts.map} +1 -1
  75. package/dist/experiment/index.d.ts +5 -5
  76. package/dist/experiment/index.js +10 -184
  77. package/dist/experiment/index.js.map +1 -1
  78. package/dist/{external-optimizer-contracts-ZDBfbZ_s.js → external-optimizer-contracts-BFV8lnhl.js} +7 -2
  79. package/dist/{external-optimizer-contracts-ZDBfbZ_s.js.map → external-optimizer-contracts-BFV8lnhl.js.map} +1 -1
  80. package/dist/{external-optimizer-process-4QdcF7Kd.js → external-optimizer-process-B6emPodQ.js} +3 -3
  81. package/dist/{external-optimizer-process-4QdcF7Kd.js.map → external-optimizer-process-B6emPodQ.js.map} +1 -1
  82. package/dist/{external-optimizer-subprocess-BW0ZWUUr.js → external-optimizer-subprocess-_O06eDVA.js} +35 -376
  83. package/dist/external-optimizer-subprocess-_O06eDVA.js.map +1 -0
  84. package/dist/{feedback-trajectory-BMkJezPc.d.ts → feedback-trajectory-CoQPmSJV.d.ts} +3 -3
  85. package/dist/{feedback-trajectory-BMkJezPc.d.ts.map → feedback-trajectory-CoQPmSJV.d.ts.map} +1 -1
  86. package/dist/finding-scope-B_As3F_v.js +359 -0
  87. package/dist/finding-scope-B_As3F_v.js.map +1 -0
  88. package/dist/{findings-store-DV8WA5nD.js → findings-store-CvYUzQBR.js} +4 -4
  89. package/dist/{findings-store-DV8WA5nD.js.map → findings-store-CvYUzQBR.js.map} +1 -1
  90. package/dist/fuzz.js +1 -1
  91. package/dist/{index-C6TG1LwA.d.ts → index-BSb3fJyZ.d.ts} +318 -131
  92. package/dist/index-BSb3fJyZ.d.ts.map +1 -0
  93. package/dist/{index-CKjqN9_U.d.ts → index-Bk1XEkP7.d.ts} +99 -3
  94. package/dist/index-Bk1XEkP7.d.ts.map +1 -0
  95. package/dist/{index-DAFZRMlF.d.ts → index-BmWw8zN6.d.ts} +10 -8
  96. package/dist/index-BmWw8zN6.d.ts.map +1 -0
  97. package/dist/{index-DKpMyD_Z.d.ts → index-CCOaNmh2.d.ts} +7 -7
  98. package/dist/{index-DKpMyD_Z.d.ts.map → index-CCOaNmh2.d.ts.map} +1 -1
  99. package/dist/{index-xEM_SoCl.d.ts → index-ZffK_5sD.d.ts} +22 -20
  100. package/dist/index-ZffK_5sD.d.ts.map +1 -0
  101. package/dist/{index-BqAPIToS.d.ts → index-aRalB_Ma.d.ts} +3 -3
  102. package/dist/{index-BqAPIToS.d.ts.map → index-aRalB_Ma.d.ts.map} +1 -1
  103. package/dist/index.d.ts +33 -29
  104. package/dist/index.js +28 -25
  105. package/dist/index.js.map +1 -1
  106. package/dist/{analyze-runs-xjKBBqIB.d.ts → insight-report-DYofCMLx.d.ts} +4 -64
  107. package/dist/insight-report-DYofCMLx.d.ts.map +1 -0
  108. package/dist/{integrity-BF0tJK21.js → integrity-DacT3oJ1.js} +2 -2
  109. package/dist/{integrity-BF0tJK21.js.map → integrity-DacT3oJ1.js.map} +1 -1
  110. package/dist/{integrity-B9320cw1.d.ts → integrity-DotDLWtj.d.ts} +2 -2
  111. package/dist/{integrity-B9320cw1.d.ts.map → integrity-DotDLWtj.d.ts.map} +1 -1
  112. package/dist/{judge-gate-DqlzOBOm.js → judge-gate-CpD3wmcf.js} +3 -3
  113. package/dist/{judge-gate-DqlzOBOm.js.map → judge-gate-CpD3wmcf.js.map} +1 -1
  114. package/dist/{llm-client-Dw4x6EdE.js → llm-client-Dk8lBnMh.js} +15 -2
  115. package/dist/{llm-client-Dw4x6EdE.js.map → llm-client-Dk8lBnMh.js.map} +1 -1
  116. package/dist/llm-judge-DYmEdo3M.js +476 -0
  117. package/dist/llm-judge-DYmEdo3M.js.map +1 -0
  118. package/dist/{matrix-CqZSpwgN.d.ts → matrix-BDl7hoBr.d.ts} +6 -2
  119. package/dist/matrix-BDl7hoBr.d.ts.map +1 -0
  120. package/dist/measure-validity-plan-BReXzcVh.d.ts +201 -0
  121. package/dist/measure-validity-plan-BReXzcVh.d.ts.map +1 -0
  122. package/dist/measure-validity-plan-CJkBNzX_.js +154 -0
  123. package/dist/measure-validity-plan-CJkBNzX_.js.map +1 -0
  124. package/dist/meta-eval/index.d.ts +5 -3
  125. package/dist/meta-eval/index.js +808 -15
  126. package/dist/meta-eval/index.js.map +1 -1
  127. package/dist/multishot/golden/index.d.ts +1 -1
  128. package/dist/multishot/index.d.ts +497 -4
  129. package/dist/multishot/index.d.ts.map +1 -1
  130. package/dist/multishot/index.js +1000 -48
  131. package/dist/multishot/index.js.map +1 -1
  132. package/dist/node-transport-DJno8V46.js +62 -0
  133. package/dist/node-transport-DJno8V46.js.map +1 -0
  134. package/dist/openapi.json +1 -1
  135. package/dist/{llm-judge-DQJTQx01.js → optimization-method-4JlbMxd2.js} +38 -513
  136. package/dist/optimization-method-4JlbMxd2.js.map +1 -0
  137. package/dist/{outcome-observations-DL3CC8w1.js → outcome-observations-DEh8_V_P.js} +31 -6
  138. package/dist/outcome-observations-DEh8_V_P.js.map +1 -0
  139. package/dist/outcome-store-CHtuvstd.d.ts +56 -0
  140. package/dist/outcome-store-CHtuvstd.d.ts.map +1 -0
  141. package/dist/{paired-arms-DZhH3FGu.js → paired-arms-CJH5Q0wx.js} +3 -2
  142. package/dist/{paired-arms-DZhH3FGu.js.map → paired-arms-CJH5Q0wx.js.map} +1 -1
  143. package/dist/{paired-promotion-decision-Dn3-jaq4.js → paired-promotion-decision-BtfVwEAk.js} +3 -2
  144. package/dist/{paired-promotion-decision-Dn3-jaq4.js.map → paired-promotion-decision-BtfVwEAk.js.map} +1 -1
  145. package/dist/{paired-promotion-decision-ChHBuuHV.d.ts → paired-promotion-decision-DJlI4z_k.d.ts} +2 -2
  146. package/dist/{paired-promotion-decision-ChHBuuHV.d.ts.map → paired-promotion-decision-DJlI4z_k.d.ts.map} +1 -1
  147. package/dist/{paired-promotion-power-BlzXdgMD.js → paired-promotion-power-DG1avBKf.js} +3 -3
  148. package/dist/{paired-promotion-power-BlzXdgMD.js.map → paired-promotion-power-DG1avBKf.js.map} +1 -1
  149. package/dist/paired-tests-CXcD_B80.js +688 -0
  150. package/dist/paired-tests-CXcD_B80.js.map +1 -0
  151. package/dist/pareto-DIVE5D0T.js +81 -0
  152. package/dist/pareto-DIVE5D0T.js.map +1 -0
  153. package/dist/pipelines/index.d.ts +2 -1
  154. package/dist/pipelines/index.d.ts.map +1 -1
  155. package/dist/pipelines/index.js +1 -1
  156. package/dist/{sequential-BphITa5b.js → power-COie_o6E.js} +181 -4
  157. package/dist/power-COie_o6E.js.map +1 -0
  158. package/dist/{prime-protocol-Cv6_47rh.d.ts → prime-protocol-BRMk6dGI.d.ts} +2 -2
  159. package/dist/{prime-protocol-Cv6_47rh.d.ts.map → prime-protocol-BRMk6dGI.d.ts.map} +1 -1
  160. package/dist/{promotion-gate-CGkxh36r.d.ts → promotion-gate-B0VTBoXg.d.ts} +2 -2
  161. package/dist/{promotion-gate-CGkxh36r.d.ts.map → promotion-gate-B0VTBoXg.d.ts.map} +1 -1
  162. package/dist/{promotion-policy-CxDIh-9p.js → promotion-policy-BgI7PsQn.js} +4 -4
  163. package/dist/{promotion-policy-CxDIh-9p.js.map → promotion-policy-BgI7PsQn.js.map} +1 -1
  164. package/dist/{proposal-findings-DedMih-u.js → proposal-findings-CfRFCFXS.js} +2 -2
  165. package/dist/{proposal-findings-DedMih-u.js.map → proposal-findings-CfRFCFXS.js.map} +1 -1
  166. package/dist/{registry-CIjC6SdV.d.ts → registry-BeInzotS.d.ts} +4 -4
  167. package/dist/{registry-CIjC6SdV.d.ts.map → registry-BeInzotS.d.ts.map} +1 -1
  168. package/dist/{release-confidence-BLHOMK5Q.js → release-confidence-Cndq1hwi.js} +2 -2
  169. package/dist/{release-confidence-BLHOMK5Q.js.map → release-confidence-Cndq1hwi.js.map} +1 -1
  170. package/dist/reporting.d.ts +5 -5
  171. package/dist/reporting.js +6 -5
  172. package/dist/reporting.js.map +1 -1
  173. package/dist/{research-report-D6XIK0eK.d.ts → research-report-CL5_UqCX.d.ts} +2 -2
  174. package/dist/{research-report-D6XIK0eK.d.ts.map → research-report-CL5_UqCX.d.ts.map} +1 -1
  175. package/dist/{researcher---DhHG4J.d.ts → researcher-BOpZP_Ja.d.ts} +4 -4
  176. package/dist/{researcher---DhHG4J.d.ts.map → researcher-BOpZP_Ja.d.ts.map} +1 -1
  177. package/dist/{reward-hacking-DKAflk2c.js → reward-hacking-DMTm1OBd.js} +2 -2
  178. package/dist/{reward-hacking-DKAflk2c.js.map → reward-hacking-DMTm1OBd.js.map} +1 -1
  179. package/dist/rl.d.ts +9 -8
  180. package/dist/rl.d.ts.map +1 -1
  181. package/dist/rl.js +11 -10
  182. package/dist/rl.js.map +1 -1
  183. package/dist/rollout/index.d.ts +2 -2
  184. package/dist/rollout/index.js +1 -1
  185. package/dist/{rollout-B_lrpd9a.js → rollout--rSr43Pd.js} +2 -2
  186. package/dist/{rollout-B_lrpd9a.js.map → rollout--rSr43Pd.js.map} +1 -1
  187. package/dist/{rollout-nodes-Vas6OSxX.js → rollout-nodes-DFxKpIr2.js} +39 -10
  188. package/dist/rollout-nodes-DFxKpIr2.js.map +1 -0
  189. package/dist/{rubric-predictive-validity--6z0q8s6.js → rubric-predictive-validity-BXJ92Jp_.js} +3 -9
  190. package/dist/rubric-predictive-validity-BXJ92Jp_.js.map +1 -0
  191. package/dist/{rubric-predictive-validity-C9wc7f_D.d.ts → rubric-predictive-validity-DH94_0Q1.d.ts} +3 -56
  192. package/dist/rubric-predictive-validity-DH94_0Q1.d.ts.map +1 -0
  193. package/dist/{run-improvement-loop-BfwOUudy.d.ts → run-improvement-loop-BeHu5D9Z.d.ts} +396 -11
  194. package/dist/run-improvement-loop-BeHu5D9Z.d.ts.map +1 -0
  195. package/dist/{run-record-Bqg0NZ_e.js → run-record-CuO8ErrI.js} +3 -2
  196. package/dist/run-record-CuO8ErrI.js.map +1 -0
  197. package/dist/{runtime-rollouts-drQynu3t.js → runtime-rollouts-CE0MbQPq.js} +55 -8
  198. package/dist/runtime-rollouts-CE0MbQPq.js.map +1 -0
  199. package/dist/search/index.d.ts +2 -2
  200. package/dist/search/index.js +2 -2
  201. package/dist/{search-kernel-DJq9bUDU.d.ts → search-kernel-CJZ-ZSV1.d.ts} +3 -3
  202. package/dist/{search-kernel-DJq9bUDU.d.ts.map → search-kernel-CJZ-ZSV1.d.ts.map} +1 -1
  203. package/dist/{pareto-Bg75Gajo.js → search-kernel-mZc79S6N.js} +6 -88
  204. package/dist/search-kernel-mZc79S6N.js.map +1 -0
  205. package/dist/{search-summary-B1x1Vmzh.js → search-summary-CCgP2qXz.js} +4 -4
  206. package/dist/{search-summary-B1x1Vmzh.js.map → search-summary-CCgP2qXz.js.map} +1 -1
  207. package/dist/{define-agent-eval-Cjc0wWnO.d.ts → self-improve-B1fsNejr.d.ts} +8 -54
  208. package/dist/self-improve-B1fsNejr.d.ts.map +1 -0
  209. package/dist/{define-agent-eval-B6uE3gNu.js → self-improve-C_Bcdmv8.js} +9 -97
  210. package/dist/self-improve-C_Bcdmv8.js.map +1 -0
  211. package/dist/{sequential-BhbTSxpt.d.ts → sequential-CHplorpC.d.ts} +2 -2
  212. package/dist/{sequential-BhbTSxpt.d.ts.map → sequential-CHplorpC.d.ts.map} +1 -1
  213. package/dist/{sequential-ux_XrjBf.js → sequential-DR-pnYQ7.js} +3 -3
  214. package/dist/{sequential-ux_XrjBf.js.map → sequential-DR-pnYQ7.js.map} +1 -1
  215. package/dist/{server-1fzBCxMh.js → server-aZFmRucn.js} +3 -3
  216. package/dist/{server-1fzBCxMh.js.map → server-aZFmRucn.js.map} +1 -1
  217. package/dist/{skillopt-optimization-method-D_swD0Cy.js → skillopt-optimization-method-DHk1K757.js} +95 -40
  218. package/dist/skillopt-optimization-method-DHk1K757.js.map +1 -0
  219. package/dist/{statistical-heldout-CaS4T-43.js → statistical-heldout-CL_7mI5C.js} +3 -3
  220. package/dist/{statistical-heldout-CaS4T-43.js.map → statistical-heldout-CL_7mI5C.js.map} +1 -1
  221. package/dist/{statistics-DSidA5I2.js → statistics-AKnVFnK-.js} +233 -700
  222. package/dist/statistics-AKnVFnK-.js.map +1 -0
  223. package/dist/statistics.d.ts +3 -3
  224. package/dist/statistics.js +3 -2
  225. package/dist/{store-tool-spans-DniaFwjM.d.ts → store-tool-spans-M3WxeRrG.d.ts} +4 -4
  226. package/dist/{store-tool-spans-DniaFwjM.d.ts.map → store-tool-spans-M3WxeRrG.d.ts.map} +1 -1
  227. package/dist/{summary-report-CI4J6gxU.js → summary-report-DyBkOC6V.js} +15 -7
  228. package/dist/summary-report-DyBkOC6V.js.map +1 -0
  229. package/dist/summary-report-figures-CJHygLgw.d.ts.map +1 -1
  230. package/dist/supervisor-run/index.d.ts +12 -2
  231. package/dist/supervisor-run/index.d.ts.map +1 -1
  232. package/dist/supervisor-run/index.js +3 -3
  233. package/dist/{systemone-DzY-2Zri.d.ts → systemone-4PadCE4C.d.ts} +8 -7
  234. package/dist/systemone-4PadCE4C.d.ts.map +1 -0
  235. package/dist/{systemone-review-CXecR_m-.d.ts → systemone-review-DpAXWDkL.d.ts} +2 -2
  236. package/dist/{systemone-review-CXecR_m-.d.ts.map → systemone-review-DpAXWDkL.d.ts.map} +1 -1
  237. package/dist/systemone.d.ts +3 -3
  238. package/dist/systemone.js +1 -1
  239. package/dist/{tool-groups-DF6OqhoG.d.ts → tool-groups-SlnoQNyT.d.ts} +2 -2
  240. package/dist/tool-groups-SlnoQNyT.d.ts.map +1 -0
  241. package/dist/tool-waste-B01AMpID.d.ts +121 -0
  242. package/dist/tool-waste-B01AMpID.d.ts.map +1 -0
  243. package/dist/{tool-waste-u7JJ_BlE.js → tool-waste-BZnYSa6J.js} +3 -2
  244. package/dist/{tool-waste-u7JJ_BlE.js.map → tool-waste-BZnYSa6J.js.map} +1 -1
  245. package/dist/{trace-questions-DO8y3J-E.d.ts → trace-questions-ybyF0B6N.d.ts} +2 -2
  246. package/dist/{trace-questions-DO8y3J-E.d.ts.map → trace-questions-ybyF0B6N.d.ts.map} +1 -1
  247. package/dist/trace-repair/index.d.ts +1 -1
  248. package/dist/trace-repair/index.js +1 -1
  249. package/dist/traces.d.ts +4 -4
  250. package/dist/traces.js +1 -1
  251. package/dist/trajectory-B3o6Ald_.d.ts +100 -0
  252. package/dist/trajectory-B3o6Ald_.d.ts.map +1 -0
  253. package/dist/trajectory-replay/index.js +1 -1
  254. package/dist/{tree-DQMlcNFI.js → tree-CiIe-f3f.js} +6 -4
  255. package/dist/{tree-DQMlcNFI.js.map → tree-CiIe-f3f.js.map} +1 -1
  256. package/dist/{types-fuOwNq1C.d.ts → types-B1W3v8dT.d.ts} +3 -2
  257. package/dist/types-B1W3v8dT.d.ts.map +1 -0
  258. package/dist/{types-BMSDkS8l.d.ts → types-D5XtEH9Q.d.ts} +11 -4
  259. package/dist/{types-BMSDkS8l.d.ts.map → types-D5XtEH9Q.d.ts.map} +1 -1
  260. package/dist/types-DK4vNv5q.js.map +1 -1
  261. package/dist/{types-D_PfKC59.d.ts → types-an-CUndX.d.ts} +2 -2
  262. package/dist/{types-D_PfKC59.d.ts.map → types-an-CUndX.d.ts.map} +1 -1
  263. package/dist/{types-BLv2Ngla.d.ts → types-xVtEOBhO.d.ts} +31 -8
  264. package/dist/types-xVtEOBhO.d.ts.map +1 -0
  265. package/dist/wire/index.d.ts +2 -2
  266. package/dist/wire/index.js +1 -1
  267. package/dist/world/index.d.ts +529 -0
  268. package/dist/world/index.d.ts.map +1 -0
  269. package/dist/world/index.js +1356 -0
  270. package/dist/world/index.js.map +1 -0
  271. package/docs/campaign-proposers.md +7 -0
  272. package/docs/concepts.md +2 -0
  273. package/docs/design/statistics-decisions.md +48 -0
  274. package/docs/eval-surface-map.md +5 -2
  275. package/docs/feature-guide.md +3 -1
  276. package/docs/multi-turn-optimization.md +84 -0
  277. package/docs/outcome-validity.md +108 -0
  278. package/docs/public-api.md +89 -34
  279. package/docs/{multi-shot-optimization.md → trajectory-optimization.md} +1 -1
  280. package/docs/world.md +104 -0
  281. package/package.json +6 -1
  282. package/dist/analyze-runs-xjKBBqIB.d.ts.map +0 -1
  283. package/dist/benchmark-command-DkBMUDwy.js.map +0 -1
  284. package/dist/campaign-DfSWSreo.js.map +0 -1
  285. package/dist/cluster-Bj90LK-1.d.ts.map +0 -1
  286. package/dist/define-agent-eval-B6uE3gNu.js.map +0 -1
  287. package/dist/define-agent-eval-Cjc0wWnO.d.ts.map +0 -1
  288. package/dist/external-optimizer-subprocess-BW0ZWUUr.js.map +0 -1
  289. package/dist/index-C6TG1LwA.d.ts.map +0 -1
  290. package/dist/index-CKjqN9_U.d.ts.map +0 -1
  291. package/dist/index-DAFZRMlF.d.ts.map +0 -1
  292. package/dist/index-xEM_SoCl.d.ts.map +0 -1
  293. package/dist/interval-CWyxqDpE.d.ts +0 -43
  294. package/dist/interval-CWyxqDpE.d.ts.map +0 -1
  295. package/dist/llm-judge-DQJTQx01.js.map +0 -1
  296. package/dist/matrix-CqZSpwgN.d.ts.map +0 -1
  297. package/dist/outcome-observations-DL3CC8w1.js.map +0 -1
  298. package/dist/pareto-Bg75Gajo.js.map +0 -1
  299. package/dist/rollout-nodes-Vas6OSxX.js.map +0 -1
  300. package/dist/rubric-predictive-validity--6z0q8s6.js.map +0 -1
  301. package/dist/rubric-predictive-validity-C9wc7f_D.d.ts.map +0 -1
  302. package/dist/run-improvement-loop-BfwOUudy.d.ts.map +0 -1
  303. package/dist/run-record-Bqg0NZ_e.js.map +0 -1
  304. package/dist/runtime-rollouts-drQynu3t.js.map +0 -1
  305. package/dist/sequential-BphITa5b.js.map +0 -1
  306. package/dist/skillopt-optimization-method-D_swD0Cy.js.map +0 -1
  307. package/dist/statistics-DSidA5I2.js.map +0 -1
  308. package/dist/summary-report-CI4J6gxU.js.map +0 -1
  309. package/dist/systemone-DzY-2Zri.d.ts.map +0 -1
  310. package/dist/tool-groups-DF6OqhoG.d.ts.map +0 -1
  311. package/dist/tool-waste-CIhtU1ad.d.ts +0 -217
  312. package/dist/tool-waste-CIhtU1ad.d.ts.map +0 -1
  313. package/dist/types-BLv2Ngla.d.ts.map +0 -1
  314. package/dist/types-fuOwNq1C.d.ts.map +0 -1
@@ -2,31 +2,29 @@ import { s as ValidationError } from "./errors-DeEEV9Vx.js";
2
2
  import { a as hashCanonical, i as compareCodeUnits, r as canonicalString, t as LEDGER_HASH_PATTERN } from "./canonical-DKgL_Wby.js";
3
3
  import { c as searchCellRunId, i as modelHasSnapshot } from "./run-record-CqUft6Yf.js";
4
4
  import { n as compareModelIdentities, t as captureModelTreatment } from "./model-comparison-CgnVh4Ph.js";
5
- import { dt as weightedComposite, pt as mean$1, rt as confidenceInterval, ut as summarizeNumberSeries } from "./statistics-DSidA5I2.js";
5
+ import { _ as mean$1, m as summarizeNumberSeries, s as confidenceInterval } from "./paired-tests-CXcD_B80.js";
6
6
  import { t as mulberry32 } from "./random-DrzcgC7F.js";
7
- import { r as minimumPairsForPairedDeltaTest } from "./paired-promotion-decision-Dn3-jaq4.js";
8
- import { a as heldoutSignificance, i as dimensionRegressions, o as pairHoldout } from "./statistical-heldout-CaS4T-43.js";
7
+ import { n as paretoFrontier, r as paretoFrontierWithCrowding } from "./pareto-DIVE5D0T.js";
8
+ import { r as minimumPairsForPairedDeltaTest } from "./paired-promotion-decision-BtfVwEAk.js";
9
+ import { a as heldoutSignificance, i as dimensionRegressions, o as pairHoldout } from "./statistical-heldout-CL_7mI5C.js";
9
10
  import { a as mapConcurrent } from "./journal-3y-btqaP.js";
10
11
  import { n as contentHash } from "./verdict-cache-BPaYxfG8.js";
11
- import { r as projectCampaignCellQuality, t as campaignCellCostProvenance } from "./run-record-Bqg0NZ_e.js";
12
- import { n as CostAccountingIncompleteError, t as CostLedger } from "./cost-ledger-C5CCidPm.js";
13
- import { A as assertCompleteCampaign, E as summarizeAgentReceiptIntegrity, F as formatCoverageFailures, M as campaignScenarioIdentity, N as campaignSplitDigest, O as assertCampaignDesign, S as FinalEvidenceError, f as campaignBreakdown, h as campaignMeanCompositeOrNull, j as campaignCoverage, k as assertCampaignSplitIdentity, m as campaignMeanComposite, w as BackendIntegrityError, x as FinalEvidenceConflictError } from "./campaign-evidence-D_oBFfLc.js";
12
+ import { r as projectCampaignCellQuality, t as campaignCellCostProvenance } from "./run-record-CuO8ErrI.js";
13
+ import { n as CostAccountingIncompleteError } from "./cost-ledger-C5CCidPm.js";
14
+ import { A as assertCampaignSplitIdentity, C as FinalEvidenceError, D as summarizeAgentReceiptIntegrity, I as formatCoverageFailures, M as campaignCoverage, N as campaignScenarioIdentity, P as campaignSplitDigest, S as FinalEvidenceConflictError, T as BackendIntegrityError, f as campaignBreakdown, h as campaignMeanCompositeOrNull, j as assertCompleteCampaign, k as assertCampaignDesign, m as campaignMeanComposite } from "./campaign-evidence-KM5GTsHG.js";
14
15
  import { t as deepFreezeCanonicalJson } from "./deep-freeze-CK8-2W7p.js";
15
- import { b as createRunCostLedger, x as fsCampaignStorage } from "./external-optimizer-subprocess-BW0ZWUUr.js";
16
+ import { f as createRunCostLedger, p as fsCampaignStorage } from "./finding-scope-B_As3F_v.js";
16
17
  import { c as surfaceDispatchRef, l as surfaceHash, o as renderSurfaceDiff, s as surfaceContentHash, u as surfaceHashMatches } from "./json-recovery-BRUCeQxo.js";
17
18
  import { r as summarizeEvaluationUnits, t as defineEvaluationClaim } from "./claim-BWEXwwBk.js";
18
19
  import { a as validateSearchLedgerEvent, d as searchNodeId, f as searchTaskSetDigest, i as replaySearchLedgerText, n as openSearchLedger, u as searchCellId } from "./search-ledger-C7t68cmy.js";
19
- import { D as CLAIM_OPERATION, O as SEARCH_KERNEL_SOURCE, b as estimateNode, i as runSearch, k as searchExpansionIndex, n as paretoFrontier, o as searchPolicyView, r as paretoFrontierWithCrowding, s as EXPANSION_OPERATORS } from "./pareto-Bg75Gajo.js";
20
+ import { C as CLAIM_OPERATION, T as searchExpansionIndex, _ as estimateNode, i as EXPANSION_OPERATORS, r as searchPolicyView, t as runSearch, w as SEARCH_KERNEL_SOURCE } from "./search-kernel-mZc79S6N.js";
20
21
  import { c as redactText, m as detectPersonalData, n as REDACTION_VERSION, p as detectCredential } from "./redact-zp_ILC4l.js";
21
- import { t as detectRewardHacking } from "./reward-hacking-DKAflk2c.js";
22
- import { t as assertProposalFindings } from "./proposal-findings-DedMih-u.js";
23
- import { i as stripFencedJson, n as isRecord } from "./json-DtvZNAU9.js";
24
- import { c as isExternalTextCandidate } from "./external-optimizer-contracts-ZDBfbZ_s.js";
25
- import { n as searchProposerView, t as renderSearchSummary } from "./search-summary-B1x1Vmzh.js";
26
- import { a as maximumChargeForLlmRequest, i as costReceiptFromLlmError, r as costReceiptFromLlm } from "./llm-client-Dw4x6EdE.js";
27
- import { t as JudgeParseError } from "./judges-BLxg5p8E.js";
22
+ import { t as detectRewardHacking } from "./reward-hacking-DMTm1OBd.js";
23
+ import { t as assertProposalFindings } from "./proposal-findings-CfRFCFXS.js";
24
+ import { n as isRecord } from "./json-DtvZNAU9.js";
25
+ import { l as isExternalTextCandidate } from "./external-optimizer-contracts-BFV8lnhl.js";
26
+ import { n as searchProposerView, t as renderSearchSummary } from "./search-summary-CCgP2qXz.js";
28
27
  import { createHash } from "node:crypto";
29
- import { z } from "zod";
30
28
  import { writeFileSync } from "node:fs";
31
29
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
32
30
  import { toW3CTraceId } from "@tangle-network/agent-trace-contract";
@@ -686,7 +684,9 @@ async function executeCell(args) {
686
684
  const startMs = Date.now();
687
685
  const run = openAttempt(args, cellDir, attemptCostTags);
688
686
  const { attempt, attemptDir, attemptPrefix, artifactsByPath, trace } = run;
687
+ const dispatchStartMs = Date.now();
689
688
  const dispatch = await dispatchCell(args, run);
689
+ const dispatchMs = Date.now() - dispatchStartMs;
690
690
  await awaitCellShutdown(args, run, dispatch.dispatched, costTags);
691
691
  const { artifact } = dispatch;
692
692
  const { agentCost, tokenUsage } = measureAgentUsage(args, costTags);
@@ -730,6 +730,7 @@ async function executeCell(args) {
730
730
  costCallIds,
731
731
  tokenUsage,
732
732
  durationMs: Date.now() - startMs,
733
+ dispatchMs,
733
734
  seed: args.slot.cellSeed,
734
735
  cached: false,
735
736
  traceRef,
@@ -1142,20 +1143,6 @@ async function runCampaign(opts) {
1142
1143
  scenarios: opts.scenarios.map(campaignScenarioIdentity)
1143
1144
  };
1144
1145
  }
1145
- // src/campaign/presets/run-eval.ts
1146
- /**
1147
- * `runEval` — the simplest preset over `runCampaign`. No optimizer, no
1148
- * gate, no auto-PR. Just: run scenarios through dispatch, score with
1149
- * judges, return CampaignResult.
1150
- *
1151
- * The 80% case for consumers who want a scorecard, not an improvement loop.
1152
- */
1153
- /**
1154
- * Simplest evaluation preset: run scenarios through dispatch, score with judges, and return a `CampaignResult` — no optimizer, no gate, no PR.
1155
- */
1156
- async function runEval(opts) {
1157
- return runCampaign(opts);
1158
- }
1159
1146
  // src/campaign/final-evidence.ts
1160
1147
  /** Capture identities before an asynchronous search can mutate its caller's options. */
1161
1148
  function captureFinalEvidencePolicy(policy) {
@@ -2728,20 +2715,7 @@ async function runFinalComparison(opts) {
2728
2715
  assertCompleteHoldout("baseline", baselineOnHoldout);
2729
2716
  assertCompleteHoldout("winner", winnerOnHoldout);
2730
2717
  }
2731
- const candidateArtifacts = /* @__PURE__ */ new Map();
2732
- const baselineArtifacts = /* @__PURE__ */ new Map();
2733
- const judgeScores = /* @__PURE__ */ new Map();
2734
- const baselineJudgeScores = /* @__PURE__ */ new Map();
2735
- for (const cell of winnerOnHoldout.cells) {
2736
- candidateArtifacts.set(cell.cellId, cell.artifact);
2737
- judgeScores.set(cell.cellId, cell.judgeScores);
2738
- }
2739
- for (const cell of baselineOnHoldout.cells) {
2740
- baselineArtifacts.set(cell.cellId, cell.artifact);
2741
- baselineJudgeScores.set(cell.cellId, cell.judgeScores);
2742
- }
2743
- let neutralizedArtifacts;
2744
- let neutralizedJudgeScores;
2718
+ let neutralized;
2745
2719
  let neutralizedOnHoldout;
2746
2720
  let neutralizedSurface;
2747
2721
  if (controlSurface !== void 0) {
@@ -2759,12 +2733,7 @@ async function runFinalComparison(opts) {
2759
2733
  runDir: `${opts.runDir}/holdout-neutralized`
2760
2734
  });
2761
2735
  assertCompleteHoldout("neutralized", neutralizedOnHoldout);
2762
- neutralizedArtifacts = /* @__PURE__ */ new Map();
2763
- neutralizedJudgeScores = /* @__PURE__ */ new Map();
2764
- for (const cell of neutralizedOnHoldout.cells) {
2765
- neutralizedArtifacts.set(cell.cellId, cell.artifact);
2766
- neutralizedJudgeScores.set(cell.cellId, cell.judgeScores);
2767
- }
2736
+ neutralized = gateArms(baselineOnHoldout, neutralizedOnHoldout);
2768
2737
  }
2769
2738
  const models = (cell) => {
2770
2739
  const reported = cellReceiptModels(cell);
@@ -2799,17 +2768,10 @@ async function runFinalComparison(opts) {
2799
2768
  reasons: ["served model identity does not support the declared comparison"],
2800
2769
  contributingGates: []
2801
2770
  } : await opts.gate.decide({
2802
- candidateArtifacts,
2803
- baselineArtifacts,
2804
- judgeScores,
2805
- baselineJudgeScores,
2806
- neutralizedArtifacts,
2807
- neutralizedJudgeScores,
2771
+ ...gateArms(baselineOnHoldout, winnerOnHoldout),
2772
+ neutralizedArtifacts: neutralized?.candidateArtifacts,
2773
+ neutralizedJudgeScores: neutralized?.judgeScores,
2808
2774
  scenarios: structuredClone(finalScenarios),
2809
- cost: {
2810
- candidate: winnerOnHoldout.aggregates.cost.totalCostUsd,
2811
- baseline: baselineOnHoldout.aggregates.cost.totalCostUsd
2812
- },
2813
2775
  costLedger,
2814
2776
  costPhase: costPhase("promotion.gate"),
2815
2777
  signal: opts.signal ?? new AbortController().signal
@@ -2838,6 +2800,19 @@ async function runFinalComparison(opts) {
2838
2800
  promotedDiff
2839
2801
  };
2840
2802
  }
2803
+ /** The paired cells of a baseline and a candidate campaign, keyed by cell id, as a gate reads them. */
2804
+ function gateArms(baseline, candidate) {
2805
+ return {
2806
+ baselineArtifacts: new Map(baseline.cells.map((cell) => [cell.cellId, cell.artifact])),
2807
+ candidateArtifacts: new Map(candidate.cells.map((cell) => [cell.cellId, cell.artifact])),
2808
+ baselineJudgeScores: new Map(baseline.cells.map((cell) => [cell.cellId, cell.judgeScores])),
2809
+ judgeScores: new Map(candidate.cells.map((cell) => [cell.cellId, cell.judgeScores])),
2810
+ cost: {
2811
+ candidate: candidate.aggregates.cost.totalCostUsd,
2812
+ baseline: baseline.aggregates.cost.totalCostUsd
2813
+ }
2814
+ };
2815
+ }
2841
2816
  // src/campaign/allocation.ts
2842
2817
  /**
2843
2818
  * Allocation: where a search spends rollouts.
@@ -5242,6 +5217,7 @@ async function runImprovementLoop(opts) {
5242
5217
  costCeilingUsd: opts.costCeiling
5243
5218
  });
5244
5219
  const dispatchTimeoutMs = opts.dispatchTimeoutMs ?? DEFAULT_DISPATCH_TIMEOUT_MS;
5220
+ opts.gate.admitHeldOut?.(opts.holdoutScenarios);
5245
5221
  if (opts.claim?.generalization === "new-units") assertIndependentEvaluationSplit(opts.claim, opts.holdoutScenarios, opts.scenarios);
5246
5222
  if (opts.finalEvidence) {
5247
5223
  if (opts.holdout === "deferred") throw new Error("final evidence requires a measured comparison");
@@ -5730,457 +5706,6 @@ function assertOptimizationProvenance(methodName, value) {
5730
5706
  }
5731
5707
  if (value.optimizerModel === void 0 !== (value.optimizerCallRef === void 0) || value.optimizerModel === void 0 !== (value.modelExecutions === void 0)) fail("optimizerModel execution provenance");
5732
5708
  }
5733
- // src/run-score.ts
5734
- const DEFAULT_RUN_SCORE_WEIGHTS = {
5735
- success: 4,
5736
- goalProgress: 2,
5737
- repoGroundedness: 1.5,
5738
- driftPenalty: -1.5,
5739
- toolUseQuality: 1,
5740
- patchQuality: 1.25,
5741
- testReality: 1.5,
5742
- finalGate: 3,
5743
- reviewerBlockers: -2,
5744
- costUsd: -.2,
5745
- wallSeconds: -.1
5746
- };
5747
- function aggregateRunScore(score, weights = {}) {
5748
- const w = {
5749
- ...DEFAULT_RUN_SCORE_WEIGHTS,
5750
- ...weights
5751
- };
5752
- return Object.keys(DEFAULT_RUN_SCORE_WEIGHTS).map((key) => w[key] * (key === "costUsd" || key === "wallSeconds" ? Math.max(0, finiteOrZero(score[key]) / (key === "wallSeconds" ? 60 : 1)) : clamp01(score[key]))).reduce((sum, term) => sum + term);
5753
- }
5754
- function clamp01(value) {
5755
- return Math.max(0, Math.min(1, finiteOrZero(value)));
5756
- }
5757
- function finiteOrZero(value) {
5758
- return Number.isFinite(value) ? value : 0;
5759
- }
5760
- // src/campaign/transient-failure.ts
5761
- const BASE_TRANSIENT = /\b50[234]\b|no stream output|produced no stream|admission timed out|admission_rejected|queue_timeout|fetch failed|ECONNRESET|This operation was aborted/i;
5762
- const TIMEOUT_PATTERN = /timeout after \d+ ?ms|cli-bridge timeout/i;
5763
- /**
5764
- * A provider refusal about a SPENT ALLOWANCE, which is not the same thing as a rate limit. It
5765
- * becomes a release time only when a date follows it; the phrase alone stays retryable.
5766
- *
5767
- * `rate limit reached` is deliberately absent. Measured 2026-09-01: a z.ai 429 payload carries
5768
- * `Rate limit reached for requests` and, 4,134 characters later in the same attempt log,
5769
- * `reset at 2026-09-02 02:05:02`. That reset is minutes away and retrying it is correct. A
5770
- * per-minute limit recovers on its own; an allowance does not.
5771
- */
5772
- const QUOTA_PHRASE = /hit your usage limit|usage limit reached|insufficient balance|quota exceeded/gi;
5773
- /**
5774
- * The clause that introduces the release time. The date may sit behind a purchase link and an
5775
- * `or`, so the phrase and the clause are matched independently rather than as one span.
5776
- */
5777
- const RELEASE_CLAUSE = /(?:try again|resets?|available again|retry)\s+(?:at|on|after)\s+([^\n]{4,80})/i;
5778
- /**
5779
- * How far past a refusal its release time may sit. Long enough for the purchase URL the codex
5780
- * message puts between them, far shorter than one attempt record — see `quotaExhaustedUntil`.
5781
- */
5782
- const RELEASE_WINDOW_CHARS = 400;
5783
- /**
5784
- * The shapes a stated release is written in, in the order they are tried. THESE ARE THE
5785
- * VALIDATION: a fragment that matches none of them is not a date, whatever `Date.parse` makes of
5786
- * it. That matters — `Date.parse('Blursday 9999')` returns 9999-01-01, and a bare four-digit
5787
- * number in prose would otherwise become a release nine thousand years out and stop a caller
5788
- * forever.
5789
- */
5790
- const RELEASE_SHAPES = [
5791
- /\d{4}-\d{2}-\d{2}(?:[T ]\d{1,2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2}))?(?![\d\s:T-])/,
5792
- /(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?\s+\d{1,2}(?:st|nd|rd|th)?,?\s+\d{4}(?:,?\s+\d{1,2}:\d{2}(?::\d{2})?\s*(?:[AaPp]\.?[Mm]\.?)?)?/,
5793
- /\d{1,2}(?:st|nd|rd|th)?\s+(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?,?\s+\d{4}/,
5794
- /\d{1,2}\/\d{1,2}\/\d{4}(?:,?\s+\d{1,2}:\d{2}(?::\d{2})?\s*(?:[AaPp]\.?[Mm]\.?)?)?/
5795
- ];
5796
- /**
5797
- * The instant a provider says a spent quota works again, or null when the text states none.
5798
- *
5799
- * MEASURED (2026-09-01, discovery lab). The codex/ChatGPT backend answered
5800
- * `You've hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more
5801
- * credits or try again at Sep 6th, 2026 8:29 PM.` — a refusal SIX DAYS out. 25 supervised runs met
5802
- * it. 21 of them retried it 12 times over about 31 minutes and settled with zero children, zero
5803
- * tokens and zero claims: about 11 hours of one subscription's capacity spent on a wall that had
5804
- * already told the caller when it would come down.
5805
- *
5806
- * The distinction this draws is not "quota" versus "not quota". It is "the provider named a
5807
- * release time" versus "it did not". A bare 429, or z.ai's `您的账户已达到速率限制`, recovers on
5808
- * its own in seconds and SHOULD be retried; those return null here and keep their existing
5809
- * treatment. Only a stated release is terminal, and only until that instant.
5810
- *
5811
- * A date with no zone is read in the host's zone, because a CLI renders it in the host's zone.
5812
- * An unparseable date returns null rather than a guess: a caller that stops dispatching must
5813
- * never do so on a misread string.
5814
- *
5815
- * @param message the provider's error text
5816
- * @returns the stated release time, or null when the text names none
5817
- */
5818
- function quotaExhaustedUntil(message) {
5819
- if (!message) return null;
5820
- QUOTA_PHRASE.lastIndex = 0;
5821
- for (let phrase = QUOTA_PHRASE.exec(message); phrase !== null; phrase = QUOTA_PHRASE.exec(message)) {
5822
- const stated = RELEASE_CLAUSE.exec(message.slice(phrase.index, phrase.index + RELEASE_WINDOW_CHARS))?.[1];
5823
- if (stated === void 0) continue;
5824
- for (const shape of RELEASE_SHAPES) {
5825
- const found = shape.exec(stated);
5826
- if (found === null) continue;
5827
- const until = Date.parse(found[0].replace(/\b(\d{1,2})(?:st|nd|rd|th)\b/gi, "$1"));
5828
- if (Number.isFinite(until)) return new Date(until);
5829
- }
5830
- }
5831
- return null;
5832
- }
5833
- /**
5834
- * True when the error text describes an infrastructure hiccup that should be
5835
- * retried rather than scored. Empty/undefined input is not transient.
5836
- */
5837
- function isTransientTransportFailure(message, opts = {}) {
5838
- if (!message) return false;
5839
- const until = quotaExhaustedUntil(message);
5840
- if (until !== null && until.getTime() > (opts.now ?? Date.now())) return false;
5841
- if (BASE_TRANSIENT.test(message)) return true;
5842
- if ((opts.retryFullDurationTimeouts ?? false) && TIMEOUT_PATTERN.test(message)) return true;
5843
- for (const p of opts.extraPatterns ?? []) if (p.test(message)) return true;
5844
- return false;
5845
- }
5846
- /**
5847
- * Ready-made `cellRetry.retryable` predicate: true for a dispatch-stage
5848
- * failure whose error message `isTransientTransportFailure` classifies as an
5849
- * infrastructure hiccup. A judge-stage failure is never retried here — the
5850
- * dispatch already produced an artifact, so re-dispatching would score a
5851
- * different sample. A per-cell dispatch deadline ("dispatch exceeded <N>ms")
5852
- * is not transient by default; opt in via `extraPatterns` or
5853
- * `retryFullDurationTimeouts` when queue starvation eats the clock. A provider refusal that
5854
- * states its own release time is never retried while that time is in the future
5855
- * (`quotaExhaustedUntil`).
5856
- */
5857
- function transientDispatchFailure(opts = {}) {
5858
- return (failure) => failure.stage === "dispatch" && isTransientTransportFailure(failure.error.message, opts);
5859
- }
5860
- // src/llm-judge.ts
5861
- /**
5862
- * `llmJudge` — the single-LLM-call bridge that turns a rubric prompt into a
5863
- * canonical campaign `JudgeConfig`.
5864
- *
5865
- * The `JudgeConfig` contract (src/campaign/types.ts) is deliberately a
5866
- * function, not a fixed LLM-prompt shape: real consumers judge with
5867
- * ensembles, deterministic checks, or one LLM call. `ensembleJudge`
5868
- * (src/judge-panel.ts) covers the multi-model case. `llmJudge` covers the
5869
- * common single-call case the `JudgeConfig` doc-comment names:
5870
- * one model call against `prompt`, parsed into the canonical `JudgeScore`
5871
- * (`{ dimensions, composite, notes }`) on the campaign [0,1] scale.
5872
- *
5873
- * Transport is injected as a `ChatClient` (src/analyst/chat-client.ts) — the
5874
- * substrate's transport-agnostic LLM seam — so the judge stays decoupled from
5875
- * router-vs-sandbox-vs-cli-bridge and is unit-testable with the `mock`
5876
- * transport. The composite is computed by `weightedComposite` (the same
5877
- * sum-normalized weighting `ensembleJudge` uses), so a lift is attributable to
5878
- * the dimension scores, not to a bespoke reducer.
5879
- *
5880
- * Fail-loud throughout: an unparseable model response throws `JudgeParseError`;
5881
- * a response missing a declared dimension throws; an out-of-range score throws.
5882
- * A thrown judge is recorded by the campaign engine as a failed cell, never
5883
- * folded into a silent zero.
5884
- */
5885
- /**
5886
- * Build a campaign-shaped `JudgeConfig` whose `score()` makes ONE LLM call
5887
- * against `prompt` and reduces the model's per-dimension scores to a canonical
5888
- * `JudgeScore` in `[0,1]`.
5889
- *
5890
- * The model is instructed to return JSON `{ "dimensions": { <key>: <number>, … },
5891
- * "notes": "…" }`; the helper strips fenced JSON, validates every declared
5892
- * dimension is present and in range, normalizes by `scale`, and composites via
5893
- * `weightedComposite`.
5894
- */
5895
- function llmJudge(name, prompt, opts) {
5896
- if (!name.trim()) throw new Error("llmJudge: name must be non-empty");
5897
- if (!prompt.trim()) throw new Error(`llmJudge '${name}': prompt must be non-empty`);
5898
- const model = opts.model ?? opts.chat.defaultModel;
5899
- if (!model) throw new Error(`llmJudge '${name}': no model on opts and no defaultModel on the ChatClient — pass opts.model or bind defaultModel at createChatClient().`);
5900
- const dimensions = normalizeDimensions(opts.dimensions, name);
5901
- const scale = opts.scale ?? "unit";
5902
- const divisor = scale === "ten" ? 10 : 1;
5903
- const scoring = opts.scoring ?? { method: "sampled" };
5904
- if (scoring.method === "expectation" && scale !== "ten") throw new Error(`llmJudge '${name}': expectation scoring requires scale 'ten' — a [0,1] score is not one token, so no single position carries its distribution`);
5905
- const renderUser = opts.renderUser ?? ((input) => JSON.stringify({
5906
- scenario: input.scenario,
5907
- artifact: input.artifact
5908
- }, null, 2));
5909
- if (opts.weights) {
5910
- for (const key of Object.keys(opts.weights)) if (!dimensions.some((d) => d.key === key)) throw new Error(`llmJudge '${name}': weights names dimension '${key}' that is not declared in dimensions`);
5911
- }
5912
- const systemPrompt = `${prompt}\n\n${renderContract(dimensions, scale)}`;
5913
- const directCostLedger = opts.costLedger ?? new CostLedger();
5914
- let jsonSchema;
5915
- if (opts.responseSchema) {
5916
- const schema = { ...z.toJSONSchema(opts.responseSchema.schema) };
5917
- delete schema.$schema;
5918
- jsonSchema = {
5919
- name: opts.responseSchema.name,
5920
- schema
5921
- };
5922
- }
5923
- const declaredJudgeVersion = opts.judgeVersion?.trim();
5924
- if (opts.judgeVersion !== void 0 && !declaredJudgeVersion) throw new Error(`llmJudge '${name}': judgeVersion must be non-empty when provided`);
5925
- return {
5926
- name,
5927
- dimensions,
5928
- judgeVersion: declaredJudgeVersion ?? contentHash({
5929
- kind: "llmJudge",
5930
- prompt: systemPrompt,
5931
- model,
5932
- transport: opts.chat.transport,
5933
- maximumAttempts: opts.chat.maximumAttempts ?? null,
5934
- temperature: opts.temperature ?? .1,
5935
- maxTokens: opts.maxTokens ?? 800,
5936
- weights: opts.weights ?? null,
5937
- scale,
5938
- scoring,
5939
- jsonSchema: jsonSchema ?? null,
5940
- renderUser: opts.renderUser?.toString() ?? null
5941
- }),
5942
- appliesTo: opts.appliesTo,
5943
- async score({ artifact, scenario, signal, costLedger, costPhase, costTags }) {
5944
- const request = {
5945
- model,
5946
- messages: [{
5947
- role: "system",
5948
- content: systemPrompt
5949
- }, {
5950
- role: "user",
5951
- content: renderUser({
5952
- artifact,
5953
- scenario
5954
- })
5955
- }],
5956
- jsonMode: true,
5957
- jsonSchema,
5958
- ...scoring.method === "expectation" ? { logprobs: { topLogprobs: EXPECTATION_TOP_LOGPROBS } } : {},
5959
- temperature: opts.temperature ?? .1,
5960
- maxTokens: opts.maxTokens ?? 800
5961
- };
5962
- const paid = await (costLedger ?? directCostLedger).runPaidCall({
5963
- channel: "judge",
5964
- phase: costPhase ?? "judge",
5965
- actor: name,
5966
- model,
5967
- maximumCharge: opts.chat.maximumAttempts === void 0 ? void 0 : maximumChargeForLlmRequest(request, { maximumAttempts: opts.chat.maximumAttempts }),
5968
- tags: {
5969
- ...costTags,
5970
- scenarioId: scenario.id
5971
- },
5972
- signal,
5973
- execute: (callSignal, callId) => opts.chat.chat(request, {
5974
- signal: callSignal,
5975
- idempotencyKey: callId
5976
- }),
5977
- receipt: costReceiptFromLlm,
5978
- receiptFromError: costReceiptFromLlmError
5979
- });
5980
- if (!paid.succeeded) throw paid.error;
5981
- const response = paid.value;
5982
- const llmCall = {
5983
- usage: response.usage,
5984
- costUsd: response.costUsd,
5985
- model: response.model,
5986
- durationMs: response.durationMs
5987
- };
5988
- const parsed = parseResponse(name, response, opts.responseSchema?.schema, llmCall);
5989
- const rawDims = parsed.dimensions ?? parsed.scores;
5990
- if (!rawDims || typeof rawDims !== "object") throw new JudgeParseError(name, response.content, {
5991
- cause: /* @__PURE__ */ new Error("response has no `dimensions` object"),
5992
- llmCall
5993
- });
5994
- const sampled = {};
5995
- for (const { key } of dimensions) {
5996
- const raw = rawDims[key];
5997
- const value = Number(raw);
5998
- if (raw === void 0 || raw === null || !Number.isFinite(value)) throw new JudgeParseError(name, response.content, {
5999
- cause: /* @__PURE__ */ new Error(`dimension '${key}' missing or non-numeric (got ${JSON.stringify(raw)})`),
6000
- llmCall
6001
- });
6002
- sampled[key] = value;
6003
- }
6004
- let scoringMethod = "sampled";
6005
- let distribution;
6006
- const dims = {};
6007
- if (scoring.method === "expectation") {
6008
- const expectation = expectedDimensionScores({
6009
- tokens: response.logprobs ?? null,
6010
- sampled,
6011
- maxScore: divisor
6012
- });
6013
- if (expectation.kind === "unavailable") {
6014
- if (scoring.whenUnavailable === "fail") throw new Error(`llmJudge '${name}': expectation scoring is unavailable — ${expectation.reason}`);
6015
- } else {
6016
- scoringMethod = "expectation";
6017
- distribution = expectation.distribution;
6018
- for (const { key } of dimensions) dims[key] = clamp01(expectation.scores[key] / divisor);
6019
- }
6020
- }
6021
- if (scoringMethod === "sampled") for (const { key } of dimensions) dims[key] = clamp01(sampled[key] / divisor);
6022
- const weights = opts.weights ?? Object.fromEntries(dimensions.map((d) => [d.key, 1 / dimensions.length]));
6023
- const { composite } = weightedComposite({
6024
- dims,
6025
- weights
6026
- });
6027
- return {
6028
- dimensions: dims,
6029
- composite,
6030
- notes: firstString(parsed.notes) ?? firstString(parsed.rationale) ?? `${name}: composite ${composite.toFixed(3)} over ${dimensions.length} dimension(s)`,
6031
- llmCall,
6032
- ...opts.scoring ? { scoringMethod } : {},
6033
- ...distribution ? { distribution } : {}
6034
- };
6035
- }
6036
- };
6037
- }
6038
- /** Alternatives requested per score token. Twenty is the documented ceiling of
6039
- * the OpenAI-compatible `top_logprobs` field, and a grade scale has at most
6040
- * eleven integer candidates, so the window always covers the whole scale. */
6041
- const EXPECTATION_TOP_LOGPROBS = 20;
6042
- /**
6043
- * Expected grade per dimension: locate the token that carried each dimension's
6044
- * integer score, then average the integer grades the model considered at that
6045
- * position, weighted by their probabilities.
6046
- *
6047
- * Unavailable — never silently approximated — when the provider returned no
6048
- * log probabilities, when a dimension's grade is not in the token stream, or
6049
- * when the grade did not land in exactly one token (a two-token `10`, a float).
6050
- */
6051
- function expectedDimensionScores(input) {
6052
- const { tokens, sampled, maxScore } = input;
6053
- if (tokens === null) return {
6054
- kind: "unavailable",
6055
- reason: "the provider returned no logprobs"
6056
- };
6057
- if (tokens.length === 0) return {
6058
- kind: "unavailable",
6059
- reason: "the provider returned an empty logprob stream"
6060
- };
6061
- const offsets = [];
6062
- let text = "";
6063
- for (const token of tokens) {
6064
- offsets.push(text.length);
6065
- text += token.token;
6066
- }
6067
- const scores = {};
6068
- const distribution = {};
6069
- for (const [key, value] of Object.entries(sampled)) {
6070
- const match = new RegExp(`"${escapeRegExp(key)}"\\s*:\\s*`).exec(text);
6071
- if (!match) return {
6072
- kind: "unavailable",
6073
- reason: `dimension '${key}' is not in the token stream`
6074
- };
6075
- const scoreOffset = match.index + match[0].length;
6076
- let index = -1;
6077
- for (let position = 0; position < offsets.length; position++) if (offsets[position] <= scoreOffset) index = position;
6078
- else break;
6079
- const token = tokens[index];
6080
- if (!token) return {
6081
- kind: "unavailable",
6082
- reason: `dimension '${key}' has no token at its score position`
6083
- };
6084
- if (integerGrade(token.token, maxScore) !== value) return {
6085
- kind: "unavailable",
6086
- reason: `dimension '${key}' scored ${value}, which is not the whole of its token '${token.token}'`
6087
- };
6088
- const candidates = [];
6089
- let total = 0;
6090
- for (const alternative of token.top.length > 0 ? token.top : [token]) {
6091
- const grade = integerGrade(alternative.token, maxScore);
6092
- if (grade === null) continue;
6093
- const probability = Math.exp(alternative.logprob);
6094
- if (!Number.isFinite(probability) || probability <= 0) continue;
6095
- candidates.push({
6096
- score: grade,
6097
- probability
6098
- });
6099
- total += probability;
6100
- }
6101
- if (candidates.length === 0 || total <= 0) return {
6102
- kind: "unavailable",
6103
- reason: `dimension '${key}' has no integer grade in its probability window`
6104
- };
6105
- let expectation = 0;
6106
- for (const candidate of candidates) expectation += candidate.probability / total * candidate.score;
6107
- scores[key] = expectation;
6108
- distribution[key] = candidates.map((candidate) => ({
6109
- score: candidate.score,
6110
- probability: candidate.probability / total
6111
- })).sort((left, right) => left.score - right.score);
6112
- }
6113
- return {
6114
- kind: "expectation",
6115
- scores,
6116
- distribution
6117
- };
6118
- }
6119
- /** The token's integer grade on the judge's scale, or null when the token is
6120
- * not exactly one integer in range. */
6121
- function integerGrade(token, maxScore) {
6122
- const trimmed = token.trim();
6123
- if (!/^\d+$/.test(trimmed)) return null;
6124
- const value = Number(trimmed);
6125
- return Number.isInteger(value) && value >= 0 && value <= maxScore ? value : null;
6126
- }
6127
- function escapeRegExp(value) {
6128
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6129
- }
6130
- function normalizeDimensions(input, name) {
6131
- const raw = input && input.length > 0 ? input : ["quality"];
6132
- const out = [];
6133
- const seen = /* @__PURE__ */ new Set();
6134
- for (const d of raw) {
6135
- const dim = typeof d === "string" ? {
6136
- key: d,
6137
- description: d
6138
- } : d;
6139
- if (!dim.key.trim()) throw new Error(`llmJudge '${name}': dimension key must be non-empty`);
6140
- if (seen.has(dim.key)) throw new Error(`llmJudge '${name}': duplicate dimension key '${dim.key}'`);
6141
- seen.add(dim.key);
6142
- out.push(dim);
6143
- }
6144
- return out;
6145
- }
6146
- function renderContract(dimensions, scale) {
6147
- const range = scale === "ten" ? "0 to 10" : "0.0 to 1.0";
6148
- const lines = dimensions.map((d) => ` - "${d.key}": ${d.description} (score ${range})`);
6149
- const example = `{"dimensions": {${dimensions.map((d) => `"${d.key}": <number>`).join(", ")}}, "notes": "<one-line rationale>"}`;
6150
- return [
6151
- "Score the artifact on EACH of these dimensions:",
6152
- ...lines,
6153
- "",
6154
- `Respond with JSON ONLY, no prose. Every dimension is a number in [${range}]:`,
6155
- example
6156
- ].join("\n");
6157
- }
6158
- function parseResponse(name, response, schema, llmCall) {
6159
- const { content } = response;
6160
- const fail = (cause) => new JudgeParseError(name, content, {
6161
- cause,
6162
- llmCall
6163
- });
6164
- if (response.finishReason != null && response.finishReason !== "stop") throw fail(/* @__PURE__ */ new Error(`response did not complete normally (finishReason=${response.finishReason})`));
6165
- if (schema) try {
6166
- return schema.parse(JSON.parse(stripFencedJson(content)));
6167
- } catch (cause) {
6168
- throw fail(cause);
6169
- }
6170
- const stripped = content.replace(/```json\n?|\n?```/g, "").trim();
6171
- const objMatch = stripped.match(/\{[\s\S]*\}/);
6172
- const payload = objMatch ? objMatch[0] : stripped;
6173
- try {
6174
- const parsed = JSON.parse(payload);
6175
- if (typeof parsed !== "object" || parsed === null) throw new Error("parsed value is not an object");
6176
- return parsed;
6177
- } catch (cause) {
6178
- throw fail(cause);
6179
- }
6180
- }
6181
- function firstString(value) {
6182
- return typeof value === "string" && value.trim() ? value : void 0;
6183
- }
6184
- export { prepareSearchFinalEvidence as $, verifySearchHistoryReceipt as A, openAutoPr as B, searchEdgeId as C, assertSearchHistoryMatchesState as D, assertSearchHistoryAdmissionOptions as E, searchReceiptAccounting as F, redTeamReport as G, defaultProductionGate as H, asha as I, runCanaries as J, scoreRedTeamOutput as K, uniform as L, campaignCellSearchResult as M, searchModelIdentity as N, createSearchHistoryReceipt as O, searchProposalExecution as P, exposeFinalEvidence as Q, finalComparisonCampaigns as R, developmentClaim as S, surfaceNode as T, DEFAULT_RED_TEAM_CORPUS as U, captureJudge as V, redTeamDataset as W, captureFinalEvidencePolicy as X, assertIndependentEvaluationSplit as Y, evaluationUnitMap as Z, beam as _, clamp01 as a, resolveRunDir as at, incumbentWithOperatorBandit as b, assertGepaCandidatePopulationSummary as c, cellCachePath as ct, costFromLedgerSummary as d, reserveFinalEvidence as et, optimizationTokenUsageFromSummary as f, aide as g, isProposedCandidate as h, aggregateRunScore as i, planCampaignRun as it, campaignCellMeasurement as j, verifySearchHistoryArtifact as k, readGepaCandidatePopulationArtifact as l, withUncapturedAgentSpend as lt, runOptimization as m, isTransientTransportFailure as n, runEval as nt, assertArtifactDescriptionSetOnce as o, cellReceiptModels as ot, runImprovementLoop as p, Dataset as q, transientDispatchFailure as r, runCampaign as rt, executeOptimizationMethod as s, buildCellSchedule as st, llmJudge as t, withFinalEvidenceSources as tt, combineComparisonCosts as u, computeManifestHash as ut, crowdedFrontierParent as v, surfaceDiff as w, SearchRecorder as x, incumbent as y, runFinalComparison as z };
5709
+ export { planCampaignRun as $, searchReceiptAccounting as A, redTeamDataset as B, createSearchHistoryReceipt as C, campaignCellSearchResult as D, campaignCellMeasurement as E, runFinalComparison as F, assertIndependentEvaluationSplit as G, scoreRedTeamOutput as H, openAutoPr as I, exposeFinalEvidence as J, captureFinalEvidencePolicy as K, captureJudge as L, uniform as M, finalComparisonCampaigns as N, searchModelIdentity as O, gateArms as P, runCampaign as Q, defaultProductionGate as R, assertSearchHistoryMatchesState as S, verifySearchHistoryReceipt as T, Dataset as U, redTeamReport as V, runCanaries as W, reserveFinalEvidence as X, prepareSearchFinalEvidence as Y, withFinalEvidenceSources as Z, developmentClaim as _, combineComparisonCosts as a, computeManifestHash as at, surfaceNode as b, runImprovementLoop as c, aide as d, resolveRunDir as et, beam as f, SearchRecorder as g, incumbentWithOperatorBandit as h, readGepaCandidatePopulationArtifact as i, withUncapturedAgentSpend as it, asha as j, searchProposalExecution as k, runOptimization as l, incumbent as m, executeOptimizationMethod as n, buildCellSchedule as nt, costFromLedgerSummary as o, crowdedFrontierParent as p, evaluationUnitMap as q, assertGepaCandidatePopulationSummary as r, cellCachePath as rt, optimizationTokenUsageFromSummary as s, assertArtifactDescriptionSetOnce as t, cellReceiptModels as tt, isProposedCandidate as u, searchEdgeId as v, verifySearchHistoryArtifact as w, assertSearchHistoryAdmissionOptions as x, surfaceDiff as y, DEFAULT_RED_TEAM_CORPUS as z };
6185
5710
 
6186
- //# sourceMappingURL=llm-judge-DQJTQx01.js.map
5711
+ //# sourceMappingURL=optimization-method-4JlbMxd2.js.map