@tangle-network/agent-eval 2.0.5 → 2.0.9

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 (309) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/adapters/http.d.ts +2 -2
  3. package/dist/{agent-profile-CcOq7bOO.d.ts → agent-profile-ORN4aArD.d.ts} +5 -5
  4. package/dist/{agent-profile-CcOq7bOO.d.ts.map → agent-profile-ORN4aArD.d.ts.map} +1 -1
  5. package/dist/analyst/index.d.ts +15 -15
  6. package/dist/analyst/index.js +18 -14
  7. package/dist/analyst/index.js.map +1 -1
  8. package/dist/{analyze-runs-C_9cXPZn.js → analyze-runs-CE_5VKh2.js} +6 -5
  9. package/dist/{analyze-runs-C_9cXPZn.js.map → analyze-runs-CE_5VKh2.js.map} +1 -1
  10. package/dist/analyze-runs-DT693FJ7.d.ts +65 -0
  11. package/dist/analyze-runs-DT693FJ7.d.ts.map +1 -0
  12. package/dist/app-grade/index.d.ts +4 -4
  13. package/dist/app-grade/index.js +1 -1
  14. package/dist/{benchmark-command-MfXRocwZ.js → benchmark-command-DLg8E4y8.js} +16 -9
  15. package/dist/benchmark-command-DLg8E4y8.js.map +1 -0
  16. package/dist/benchmarks/index.d.ts +4 -4
  17. package/dist/benchmarks/index.js +4 -4
  18. package/dist/builder-eval/index.js +2 -2
  19. package/dist/calibration-CrORXMWx.d.ts +128 -0
  20. package/dist/calibration-CrORXMWx.d.ts.map +1 -0
  21. package/dist/{calibration-Cfoup0xz.js → calibration-Dz8mQb5P.js} +2 -2
  22. package/dist/{calibration-Cfoup0xz.js.map → calibration-Dz8mQb5P.js.map} +1 -1
  23. package/dist/campaign/index.d.ts +8 -8
  24. package/dist/campaign/index.js +12 -11
  25. package/dist/{campaign-DfSWSreo.js → campaign-C_S3MOYa.js} +1589 -14
  26. package/dist/campaign-C_S3MOYa.js.map +1 -0
  27. package/dist/{campaign-evidence-D_oBFfLc.js → campaign-evidence-BTfzZo1u.js} +4 -4
  28. package/dist/{campaign-evidence-D_oBFfLc.js.map → campaign-evidence-BTfzZo1u.js.map} +1 -1
  29. package/dist/{campaign-evidence-BmMs8YJt.d.ts → campaign-evidence-CM4FBOkX.d.ts} +5 -5
  30. package/dist/{campaign-evidence-BmMs8YJt.d.ts.map → campaign-evidence-CM4FBOkX.d.ts.map} +1 -1
  31. package/dist/{cluster-Bj90LK-1.d.ts → chat-client-uQNXGuO4.d.ts} +3 -240
  32. package/dist/chat-client-uQNXGuO4.d.ts.map +1 -0
  33. package/dist/cli.js +6 -6
  34. package/dist/cluster-C-K0N2br.d.ts +241 -0
  35. package/dist/cluster-C-K0N2br.d.ts.map +1 -0
  36. package/dist/{cluster-bootstrap-DPzVy3_K.js → cluster-bootstrap-DXbnIdm8.js} +3 -2
  37. package/dist/{cluster-bootstrap-DPzVy3_K.js.map → cluster-bootstrap-DXbnIdm8.js.map} +1 -1
  38. package/dist/{completion-verifier-Cy38EpGE.d.ts → completion-verifier-C7wipJOK.d.ts} +2 -2
  39. package/dist/{completion-verifier-Cy38EpGE.d.ts.map → completion-verifier-C7wipJOK.d.ts.map} +1 -1
  40. package/dist/contract/index.d.ts +14 -12
  41. package/dist/contract/index.js +13 -11
  42. package/dist/contract/index.js.map +1 -1
  43. package/dist/{decision-point-C46p-p9v.js → decision-point-CfqtnGop.js} +3 -3
  44. package/dist/{decision-point-C46p-p9v.js.map → decision-point-CfqtnGop.js.map} +1 -1
  45. package/dist/{default-registry-CUuorCWZ.d.ts → default-registry-Bskl2HzV.d.ts} +6 -7
  46. package/dist/default-registry-Bskl2HzV.d.ts.map +1 -0
  47. package/dist/{default-registry-IkE3byrA.js → default-registry-kps1SOaD.js} +27 -15
  48. package/dist/default-registry-kps1SOaD.js.map +1 -0
  49. package/dist/define-agent-eval-Dnh4jXLX.js +96 -0
  50. package/dist/define-agent-eval-Dnh4jXLX.js.map +1 -0
  51. package/dist/define-agent-eval-tu3anVlk.d.ts +52 -0
  52. package/dist/define-agent-eval-tu3anVlk.d.ts.map +1 -0
  53. package/dist/diagnosis/index.d.ts +3 -3
  54. package/dist/diagnosis/index.js +1 -1
  55. package/dist/{dspy-rlm-engine-DE11iBcC.js → dspy-rlm-engine-DQbPdT_o.js} +8 -4
  56. package/dist/{dspy-rlm-engine-DE11iBcC.js.map → dspy-rlm-engine-DQbPdT_o.js.map} +1 -1
  57. package/dist/{emitter-BjW3NnX-.js → emitter-xN9wGTVw.js} +9 -2
  58. package/dist/{emitter-BjW3NnX-.js.map → emitter-xN9wGTVw.js.map} +1 -1
  59. package/dist/{eval-campaign-Cyk-tkLh.js → eval-campaign-DswSn7Gm.js} +3 -3
  60. package/dist/{eval-campaign-Cyk-tkLh.js.map → eval-campaign-DswSn7Gm.js.map} +1 -1
  61. package/dist/{evaluation-DfyLPVL1.d.ts → evaluation-C4-tf3Z_.d.ts} +4 -4
  62. package/dist/{evaluation-DfyLPVL1.d.ts.map → evaluation-C4-tf3Z_.d.ts.map} +1 -1
  63. package/dist/evaluation.d.ts +1 -1
  64. package/dist/{exact-types-CiCXYhNK.d.ts → exact-types-CUsSMW3n.d.ts} +2 -2
  65. package/dist/{exact-types-CiCXYhNK.d.ts.map → exact-types-CUsSMW3n.d.ts.map} +1 -1
  66. package/dist/{execution-insight-wUNXxo5Y.d.ts → execution-insight-YihQrSqd.d.ts} +2 -2
  67. package/dist/{execution-insight-wUNXxo5Y.d.ts.map → execution-insight-YihQrSqd.d.ts.map} +1 -1
  68. package/dist/experiment/index.d.ts +5 -5
  69. package/dist/experiment/index.js +10 -184
  70. package/dist/experiment/index.js.map +1 -1
  71. package/dist/{external-optimizer-process-4QdcF7Kd.js → external-optimizer-process-CVi1x2nb.js} +2 -2
  72. package/dist/{external-optimizer-process-4QdcF7Kd.js.map → external-optimizer-process-CVi1x2nb.js.map} +1 -1
  73. package/dist/{external-optimizer-subprocess-BW0ZWUUr.js → external-optimizer-subprocess-mV-2swJI.js} +3 -357
  74. package/dist/external-optimizer-subprocess-mV-2swJI.js.map +1 -0
  75. package/dist/{feedback-trajectory-HJticMDz.d.ts → feedback-trajectory-D7hgL6y5.d.ts} +3 -3
  76. package/dist/{feedback-trajectory-HJticMDz.d.ts.map → feedback-trajectory-D7hgL6y5.d.ts.map} +1 -1
  77. package/dist/finding-scope-B_As3F_v.js +359 -0
  78. package/dist/finding-scope-B_As3F_v.js.map +1 -0
  79. package/dist/{findings-store-BxpV-hfH.js → findings-store-CZy5kUDo.js} +26 -19
  80. package/dist/findings-store-CZy5kUDo.js.map +1 -0
  81. package/dist/fuzz.js +1 -1
  82. package/dist/{harness-session-lines-CSxKR6no.js → harness-session-lines-CTh1-uOb.js} +21 -19
  83. package/dist/harness-session-lines-CTh1-uOb.js.map +1 -0
  84. package/dist/{index-Ucp54Pcl.d.ts → index--vDCtdaj.d.ts} +7 -8
  85. package/dist/index--vDCtdaj.d.ts.map +1 -0
  86. package/dist/{index-CKjqN9_U.d.ts → index-CIqYaySd.d.ts} +89 -3
  87. package/dist/index-CIqYaySd.d.ts.map +1 -0
  88. package/dist/{index-C6TG1LwA.d.ts → index-Cav3abKy.d.ts} +256 -131
  89. package/dist/index-Cav3abKy.d.ts.map +1 -0
  90. package/dist/{index-CR-guIiZ.d.ts → index-DmMHTDjT.d.ts} +10 -8
  91. package/dist/index-DmMHTDjT.d.ts.map +1 -0
  92. package/dist/{index-oX0TuJFv.d.ts → index-Er8TKQ3q.d.ts} +4 -4
  93. package/dist/{index-oX0TuJFv.d.ts.map → index-Er8TKQ3q.d.ts.map} +1 -1
  94. package/dist/{index-B_k8aY9k.d.ts → index-moZnazVj.d.ts} +22 -21
  95. package/dist/index-moZnazVj.d.ts.map +1 -0
  96. package/dist/index.d.ts +33 -30
  97. package/dist/index.js +27 -24
  98. package/dist/index.js.map +1 -1
  99. package/dist/{analyze-runs-Ke0WbAf6.d.ts → insight-report-DYofCMLx.d.ts} +4 -64
  100. package/dist/insight-report-DYofCMLx.d.ts.map +1 -0
  101. package/dist/{integrity-B9320cw1.d.ts → integrity-BJGstiCh.d.ts} +2 -2
  102. package/dist/{integrity-B9320cw1.d.ts.map → integrity-BJGstiCh.d.ts.map} +1 -1
  103. package/dist/{judge-gate-DqlzOBOm.js → judge-gate-DANg5FLq.js} +2 -2
  104. package/dist/{judge-gate-DqlzOBOm.js.map → judge-gate-DANg5FLq.js.map} +1 -1
  105. package/dist/{kind-factory-BDd4rhML.js → kind-factory-B-xCxG7p.js} +33 -5
  106. package/dist/kind-factory-B-xCxG7p.js.map +1 -0
  107. package/dist/llm-judge-DFoSy4Qn.js +476 -0
  108. package/dist/llm-judge-DFoSy4Qn.js.map +1 -0
  109. package/dist/{matrix-DlSrRl_v.d.ts → matrix-OgdWQBQa.d.ts} +6 -2
  110. package/dist/matrix-OgdWQBQa.d.ts.map +1 -0
  111. package/dist/measure-validity-plan-B1_qYlsk.d.ts +143 -0
  112. package/dist/measure-validity-plan-B1_qYlsk.d.ts.map +1 -0
  113. package/dist/measure-validity-plan-t0YQRzJQ.js +117 -0
  114. package/dist/measure-validity-plan-t0YQRzJQ.js.map +1 -0
  115. package/dist/meta-eval/index.d.ts +5 -3
  116. package/dist/meta-eval/index.js +664 -14
  117. package/dist/meta-eval/index.js.map +1 -1
  118. package/dist/multishot/golden/index.d.ts +1 -1
  119. package/dist/multishot/index.d.ts +458 -4
  120. package/dist/multishot/index.d.ts.map +1 -1
  121. package/dist/multishot/index.js +926 -47
  122. package/dist/multishot/index.js.map +1 -1
  123. package/dist/openapi.json +1 -1
  124. package/dist/{llm-judge-DQJTQx01.js → optimization-method-D4CpYsVA.js} +18 -482
  125. package/dist/optimization-method-D4CpYsVA.js.map +1 -0
  126. package/dist/{outcome-observations-DL3CC8w1.js → outcome-observations-DEh8_V_P.js} +31 -6
  127. package/dist/outcome-observations-DEh8_V_P.js.map +1 -0
  128. package/dist/outcome-store-CHtuvstd.d.ts +56 -0
  129. package/dist/outcome-store-CHtuvstd.d.ts.map +1 -0
  130. package/dist/{paired-arms-DZhH3FGu.js → paired-arms-B6EXnI47.js} +3 -2
  131. package/dist/{paired-arms-DZhH3FGu.js.map → paired-arms-B6EXnI47.js.map} +1 -1
  132. package/dist/{paired-promotion-decision-ChHBuuHV.d.ts → paired-promotion-decision-DuvRdnsW.d.ts} +2 -2
  133. package/dist/{paired-promotion-decision-ChHBuuHV.d.ts.map → paired-promotion-decision-DuvRdnsW.d.ts.map} +1 -1
  134. package/dist/{paired-promotion-decision-Dn3-jaq4.js → paired-promotion-decision-xYe881cD.js} +3 -2
  135. package/dist/{paired-promotion-decision-Dn3-jaq4.js.map → paired-promotion-decision-xYe881cD.js.map} +1 -1
  136. package/dist/{paired-promotion-power-BlzXdgMD.js → paired-promotion-power-DirShsIs.js} +3 -3
  137. package/dist/{paired-promotion-power-BlzXdgMD.js.map → paired-promotion-power-DirShsIs.js.map} +1 -1
  138. package/dist/paired-tests-CXcD_B80.js +688 -0
  139. package/dist/paired-tests-CXcD_B80.js.map +1 -0
  140. package/dist/pareto-DIVE5D0T.js +81 -0
  141. package/dist/pareto-DIVE5D0T.js.map +1 -0
  142. package/dist/pipelines/index.d.ts +2 -1
  143. package/dist/pipelines/index.d.ts.map +1 -1
  144. package/dist/pipelines/index.js +1 -1
  145. package/dist/{sequential-BphITa5b.js → power-DTg6u30w.js} +181 -4
  146. package/dist/power-DTg6u30w.js.map +1 -0
  147. package/dist/{prime-protocol-iEaSEGZB.d.ts → prime-protocol-Jm2pWh--.d.ts} +2 -2
  148. package/dist/{prime-protocol-iEaSEGZB.d.ts.map → prime-protocol-Jm2pWh--.d.ts.map} +1 -1
  149. package/dist/{promotion-gate-CGkxh36r.d.ts → promotion-gate-BXgcORnM.d.ts} +2 -2
  150. package/dist/{promotion-gate-CGkxh36r.d.ts.map → promotion-gate-BXgcORnM.d.ts.map} +1 -1
  151. package/dist/{promotion-policy-CxDIh-9p.js → promotion-policy-Z5E-C32U.js} +4 -4
  152. package/dist/{promotion-policy-CxDIh-9p.js.map → promotion-policy-Z5E-C32U.js.map} +1 -1
  153. package/dist/{proposal-findings-DedMih-u.js → proposal-findings-CfRFCFXS.js} +2 -2
  154. package/dist/{proposal-findings-DedMih-u.js.map → proposal-findings-CfRFCFXS.js.map} +1 -1
  155. package/dist/{registry-V8o2kZtn.d.ts → registry-DEZDECdr.d.ts} +4 -4
  156. package/dist/{registry-V8o2kZtn.d.ts.map → registry-DEZDECdr.d.ts.map} +1 -1
  157. package/dist/{release-confidence-BLHOMK5Q.js → release-confidence-Cndq1hwi.js} +2 -2
  158. package/dist/{release-confidence-BLHOMK5Q.js.map → release-confidence-Cndq1hwi.js.map} +1 -1
  159. package/dist/reporting.d.ts +5 -5
  160. package/dist/reporting.js +6 -5
  161. package/dist/reporting.js.map +1 -1
  162. package/dist/{research-report-D6XIK0eK.d.ts → research-report-CIgUe1lv.d.ts} +2 -2
  163. package/dist/{research-report-D6XIK0eK.d.ts.map → research-report-CIgUe1lv.d.ts.map} +1 -1
  164. package/dist/{researcher---DhHG4J.d.ts → researcher-CY_byuZl.d.ts} +4 -4
  165. package/dist/{researcher---DhHG4J.d.ts.map → researcher-CY_byuZl.d.ts.map} +1 -1
  166. package/dist/{reward-hacking-DKAflk2c.js → reward-hacking-DMTm1OBd.js} +2 -2
  167. package/dist/{reward-hacking-DKAflk2c.js.map → reward-hacking-DMTm1OBd.js.map} +1 -1
  168. package/dist/rl.d.ts +9 -8
  169. package/dist/rl.d.ts.map +1 -1
  170. package/dist/rl.js +11 -10
  171. package/dist/rl.js.map +1 -1
  172. package/dist/rollout/index.d.ts +2 -2
  173. package/dist/rollout/index.js +2 -2
  174. package/dist/{rollout-DVwpCHBC.js → rollout-B_lrpd9a.js} +2 -2
  175. package/dist/{rollout-DVwpCHBC.js.map → rollout-B_lrpd9a.js.map} +1 -1
  176. package/dist/{rubric-predictive-validity--6z0q8s6.js → rubric-predictive-validity-BXJ92Jp_.js} +3 -9
  177. package/dist/rubric-predictive-validity-BXJ92Jp_.js.map +1 -0
  178. package/dist/{rubric-predictive-validity-C9wc7f_D.d.ts → rubric-predictive-validity-DH94_0Q1.d.ts} +3 -56
  179. package/dist/rubric-predictive-validity-DH94_0Q1.d.ts.map +1 -0
  180. package/dist/{run-improvement-loop-CtLyPb5-.d.ts → run-improvement-loop-BaPDVbW8.d.ts} +384 -11
  181. package/dist/run-improvement-loop-BaPDVbW8.d.ts.map +1 -0
  182. package/dist/{run-record-Bqg0NZ_e.js → run-record-CuO8ErrI.js} +3 -2
  183. package/dist/run-record-CuO8ErrI.js.map +1 -0
  184. package/dist/{runtime-rollouts-DdUijr_t.js → runtime-rollouts-Vv-BAqmq.js} +3 -3
  185. package/dist/{runtime-rollouts-DdUijr_t.js.map → runtime-rollouts-Vv-BAqmq.js.map} +1 -1
  186. package/dist/search/index.d.ts +2 -2
  187. package/dist/search/index.js +2 -2
  188. package/dist/{search-kernel-DXA1EhnN.d.ts → search-kernel-BzTeb89p.d.ts} +3 -3
  189. package/dist/{search-kernel-DXA1EhnN.d.ts.map → search-kernel-BzTeb89p.d.ts.map} +1 -1
  190. package/dist/{pareto-Bg75Gajo.js → search-kernel-DOPW08Hx.js} +6 -88
  191. package/dist/search-kernel-DOPW08Hx.js.map +1 -0
  192. package/dist/{search-summary-B1x1Vmzh.js → search-summary-CYOHZAAy.js} +4 -4
  193. package/dist/{search-summary-B1x1Vmzh.js.map → search-summary-CYOHZAAy.js.map} +1 -1
  194. package/dist/{define-agent-eval-B6uE3gNu.js → self-improve-CIFqccHV.js} +8 -97
  195. package/dist/self-improve-CIFqccHV.js.map +1 -0
  196. package/dist/{define-agent-eval-D17XsdAt.d.ts → self-improve-DY8ZY4lY.d.ts} +8 -54
  197. package/dist/self-improve-DY8ZY4lY.d.ts.map +1 -0
  198. package/dist/{sequential-BhbTSxpt.d.ts → sequential-B9iROM1S.d.ts} +2 -2
  199. package/dist/{sequential-BhbTSxpt.d.ts.map → sequential-B9iROM1S.d.ts.map} +1 -1
  200. package/dist/{sequential-ux_XrjBf.js → sequential-tZjGysXY.js} +3 -3
  201. package/dist/{sequential-ux_XrjBf.js.map → sequential-tZjGysXY.js.map} +1 -1
  202. package/dist/{skillopt-optimization-method-D_swD0Cy.js → skillopt-optimization-method-CbHBkopM.js} +9 -8
  203. package/dist/{skillopt-optimization-method-D_swD0Cy.js.map → skillopt-optimization-method-CbHBkopM.js.map} +1 -1
  204. package/dist/{statistical-heldout-CaS4T-43.js → statistical-heldout-C7Jjo5nP.js} +3 -3
  205. package/dist/{statistical-heldout-CaS4T-43.js.map → statistical-heldout-C7Jjo5nP.js.map} +1 -1
  206. package/dist/{statistics-DSidA5I2.js → statistics-BPl13X3G.js} +208 -700
  207. package/dist/statistics-BPl13X3G.js.map +1 -0
  208. package/dist/statistics.d.ts +3 -3
  209. package/dist/statistics.js +3 -2
  210. package/dist/{store-otlp-CR9fWum6.js → store-otlp-CdeW7NWq.js} +2 -2
  211. package/dist/{store-otlp-CR9fWum6.js.map → store-otlp-CdeW7NWq.js.map} +1 -1
  212. package/dist/{store-tool-spans-tkdUJWup.js → store-tool-spans-CVX-jfkk.js} +3 -3
  213. package/dist/{store-tool-spans-tkdUJWup.js.map → store-tool-spans-CVX-jfkk.js.map} +1 -1
  214. package/dist/{store-tool-spans-C47hUUVM.d.ts → store-tool-spans-Dq8r0PbJ.d.ts} +4 -5
  215. package/dist/store-tool-spans-Dq8r0PbJ.d.ts.map +1 -0
  216. package/dist/{summary-report-CI4J6gxU.js → summary-report-DzbnK81K.js} +15 -7
  217. package/dist/summary-report-DzbnK81K.js.map +1 -0
  218. package/dist/summary-report-figures-CJHygLgw.d.ts.map +1 -1
  219. package/dist/supervisor-run/index.d.ts +1 -1
  220. package/dist/supervisor-run/index.js +1 -1
  221. package/dist/{systemone-MXhFSYdy.d.ts → systemone-BuSZTI88.d.ts} +8 -7
  222. package/dist/systemone-BuSZTI88.d.ts.map +1 -0
  223. package/dist/{systemone-review-C9kbs3zD.d.ts → systemone-review-mlfxWdLz.d.ts} +2 -2
  224. package/dist/{systemone-review-C9kbs3zD.d.ts.map → systemone-review-mlfxWdLz.d.ts.map} +1 -1
  225. package/dist/systemone.d.ts +3 -3
  226. package/dist/systemone.js +1 -1
  227. package/dist/{tool-groups-BSd08M7B.d.ts → tool-groups-PNDX8fd-.d.ts} +2 -3
  228. package/dist/tool-groups-PNDX8fd-.d.ts.map +1 -0
  229. package/dist/{tool-waste-u7JJ_BlE.js → tool-waste-783VCo1y.js} +3 -2
  230. package/dist/{tool-waste-u7JJ_BlE.js.map → tool-waste-783VCo1y.js.map} +1 -1
  231. package/dist/tool-waste-B01AMpID.d.ts +121 -0
  232. package/dist/tool-waste-B01AMpID.d.ts.map +1 -0
  233. package/dist/{trace-questions-CJANeK9P.d.ts → trace-questions-DBtr4jWi.d.ts} +2 -3
  234. package/dist/trace-questions-DBtr4jWi.d.ts.map +1 -0
  235. package/dist/trace-repair/index.d.ts +1 -1
  236. package/dist/trace-repair/index.js +1 -1
  237. package/dist/traces.d.ts +4 -5
  238. package/dist/traces.d.ts.map +1 -1
  239. package/dist/traces.js +4 -4
  240. package/dist/trajectory-B3o6Ald_.d.ts +100 -0
  241. package/dist/trajectory-B3o6Ald_.d.ts.map +1 -0
  242. package/dist/trajectory-replay/index.js +1 -1
  243. package/dist/{tree-DQMlcNFI.js → tree-CtlQQL1w.js} +6 -4
  244. package/dist/{tree-DQMlcNFI.js.map → tree-CtlQQL1w.js.map} +1 -1
  245. package/dist/{types-DD1eUTLn.d.ts → types-BO948H-U.d.ts} +7 -4
  246. package/dist/{types-DD1eUTLn.d.ts.map → types-BO948H-U.d.ts.map} +1 -1
  247. package/dist/{types-AGUuvnae.d.ts → types-CKNAzCSA.d.ts} +158 -3
  248. package/dist/types-CKNAzCSA.d.ts.map +1 -0
  249. package/dist/{types-BLv2Ngla.d.ts → types-D-WF1KM3.d.ts} +2 -2
  250. package/dist/{types-BLv2Ngla.d.ts.map → types-D-WF1KM3.d.ts.map} +1 -1
  251. package/dist/types-DK4vNv5q.js.map +1 -1
  252. package/dist/{types-CE9JMZhk.d.ts → types-DbeIGi73.d.ts} +2 -2
  253. package/dist/{types-CE9JMZhk.d.ts.map → types-DbeIGi73.d.ts.map} +1 -1
  254. package/dist/types-_tlhWGUq.js.map +1 -1
  255. package/dist/wire/index.d.ts +4 -4
  256. package/dist/world/index.d.ts +529 -0
  257. package/dist/world/index.d.ts.map +1 -0
  258. package/dist/world/index.js +1356 -0
  259. package/dist/world/index.js.map +1 -0
  260. package/docs/campaign-proposers.md +7 -0
  261. package/docs/concepts.md +2 -0
  262. package/docs/design/statistics-decisions.md +31 -0
  263. package/docs/eval-surface-map.md +4 -1
  264. package/docs/feature-guide.md +2 -0
  265. package/docs/multi-turn-optimization.md +80 -0
  266. package/docs/outcome-validity.md +69 -0
  267. package/docs/public-api.md +86 -31
  268. package/docs/trace-analysis.md +1 -0
  269. package/docs/world.md +104 -0
  270. package/package.json +7 -2
  271. package/dist/analyze-runs-Ke0WbAf6.d.ts.map +0 -1
  272. package/dist/benchmark-command-MfXRocwZ.js.map +0 -1
  273. package/dist/campaign-DfSWSreo.js.map +0 -1
  274. package/dist/cluster-Bj90LK-1.d.ts.map +0 -1
  275. package/dist/default-registry-CUuorCWZ.d.ts.map +0 -1
  276. package/dist/default-registry-IkE3byrA.js.map +0 -1
  277. package/dist/define-agent-eval-B6uE3gNu.js.map +0 -1
  278. package/dist/define-agent-eval-D17XsdAt.d.ts.map +0 -1
  279. package/dist/engine-BZVXOc6n.d.ts +0 -152
  280. package/dist/engine-BZVXOc6n.d.ts.map +0 -1
  281. package/dist/external-optimizer-subprocess-BW0ZWUUr.js.map +0 -1
  282. package/dist/findings-store-BxpV-hfH.js.map +0 -1
  283. package/dist/harness-session-lines-CSxKR6no.js.map +0 -1
  284. package/dist/index-B_k8aY9k.d.ts.map +0 -1
  285. package/dist/index-C6TG1LwA.d.ts.map +0 -1
  286. package/dist/index-CKjqN9_U.d.ts.map +0 -1
  287. package/dist/index-CR-guIiZ.d.ts.map +0 -1
  288. package/dist/index-Ucp54Pcl.d.ts.map +0 -1
  289. package/dist/interval-CWyxqDpE.d.ts +0 -43
  290. package/dist/interval-CWyxqDpE.d.ts.map +0 -1
  291. package/dist/kind-factory-BDd4rhML.js.map +0 -1
  292. package/dist/llm-judge-DQJTQx01.js.map +0 -1
  293. package/dist/matrix-DlSrRl_v.d.ts.map +0 -1
  294. package/dist/outcome-observations-DL3CC8w1.js.map +0 -1
  295. package/dist/pareto-Bg75Gajo.js.map +0 -1
  296. package/dist/rubric-predictive-validity--6z0q8s6.js.map +0 -1
  297. package/dist/rubric-predictive-validity-C9wc7f_D.d.ts.map +0 -1
  298. package/dist/run-improvement-loop-CtLyPb5-.d.ts.map +0 -1
  299. package/dist/run-record-Bqg0NZ_e.js.map +0 -1
  300. package/dist/sequential-BphITa5b.js.map +0 -1
  301. package/dist/statistics-DSidA5I2.js.map +0 -1
  302. package/dist/store-tool-spans-C47hUUVM.d.ts.map +0 -1
  303. package/dist/summary-report-CI4J6gxU.js.map +0 -1
  304. package/dist/systemone-MXhFSYdy.d.ts.map +0 -1
  305. package/dist/tool-groups-BSd08M7B.d.ts.map +0 -1
  306. package/dist/tool-waste-CIhtU1ad.d.ts +0 -217
  307. package/dist/tool-waste-CIhtU1ad.d.ts.map +0 -1
  308. package/dist/trace-questions-CJANeK9P.d.ts.map +0 -1
  309. package/dist/types-AGUuvnae.d.ts.map +0 -1
@@ -1,16 +1,18 @@
1
1
  import { n as CaptureIntegrityError, s as ValidationError } from "../errors-DeEEV9Vx.js";
2
2
  import { a as hashCanonical, i as compareCodeUnits } from "../canonical-DKgL_Wby.js";
3
- import { $ as continuousAgreement, Q as calibrateJudgeContinuous, Z as calibrateJudge, et as positionalBias, nt as verbosityBias, tt as selfPreference } from "../statistics-DSidA5I2.js";
3
+ import { f as spearmanR } from "../paired-tests-CXcD_B80.js";
4
4
  import { t as mulberry32 } from "../random-DrzcgC7F.js";
5
+ import { $ as selfPreference, H as clusteredAssociation, Q as positionalBias, V as associationEstimate, X as calibrateJudgeContinuous, Y as calibrateJudge, Z as continuousAgreement, b as benjaminiHochberg, et as verbosityBias, n as sampleMedian } from "../statistics-BPl13X3G.js";
5
6
  import { s as runMetricExtractor } from "../query-Dhjkwqyx.js";
6
7
  import { n as callLlmJson } from "../llm-client-Dw4x6EdE.js";
7
- import { a as validateObservationOptions, i as reduceOutcomeMetric, n as correlationSummary, r as hasVariation, t as assertUniqueObservationIds } from "../outcome-observations-DL3CC8w1.js";
8
- import { a as rankedProbabilityScore, i as multiclassBrierScore, n as calibrationCurve, r as calibrationFromPairs, t as brierScore } from "../calibration-Cfoup0xz.js";
9
- import { a as judgeGateDecision, c as snapshotFromJudgeAgreement, d as judgeSentinelReport, f as snapshotFromAgreement, g as withJudgeRetry, h as validateSentinelSnapshot, i as assertJudgeMayGate, l as evalHealthStamp, m as snapshotFromSentinelSet, n as JudgeGateRefusedError, o as measureJudgeAgreement, p as snapshotFromCalibration, r as addCalibrationVerdicts, s as registerCalibrationSet, t as DEFAULT_JUDGE_GATE_POLICY, u as fileSentinelStore } from "../judge-gate-DqlzOBOm.js";
8
+ import { a as reduceOutcomeMetric, i as hasVariation, n as correlationSummary, o as reduceOutcomeObservation, r as groupOutcomesByRun, s as validateObservationOptions, t as assertUniqueObservationIds } from "../outcome-observations-DEh8_V_P.js";
9
+ import { a as rankedProbabilityScore, i as multiclassBrierScore, n as calibrationCurve, r as calibrationFromPairs, t as brierScore } from "../calibration-Dz8mQb5P.js";
10
+ import { a as judgeGateDecision, c as snapshotFromJudgeAgreement, d as judgeSentinelReport, f as snapshotFromAgreement, g as withJudgeRetry, h as validateSentinelSnapshot, i as assertJudgeMayGate, l as evalHealthStamp, m as snapshotFromSentinelSet, n as JudgeGateRefusedError, o as measureJudgeAgreement, p as snapshotFromCalibration, r as addCalibrationVerdicts, s as registerCalibrationSet, t as DEFAULT_JUDGE_GATE_POLICY, u as fileSentinelStore } from "../judge-gate-DANg5FLq.js";
10
11
  import { t as computeInterval } from "../interval-Bd2f4CRT.js";
11
- import { t as clusterBootstrapMean } from "../cluster-bootstrap-DPzVy3_K.js";
12
- import { t as rubricPredictiveValidity } from "../rubric-predictive-validity--6z0q8s6.js";
12
+ import { t as clusterBootstrapMean } from "../cluster-bootstrap-DXbnIdm8.js";
13
+ import { t as rubricPredictiveValidity } from "../rubric-predictive-validity-BXJ92Jp_.js";
13
14
  import { n as InMemoryOutcomeStore, r as OutcomeStoreError, t as FileSystemOutcomeStore } from "../outcome-store-TarrcfHG.js";
15
+ import { n as verifyMeasureValidityPlan } from "../measure-validity-plan-t0YQRzJQ.js";
14
16
  import { z } from "zod";
15
17
  // src/meta-eval/correlation-study.ts
16
18
  /**
@@ -36,13 +38,7 @@ async function correlationStudy(traceStore, outcomeStore, evalMetrics, outcomeMe
36
38
  const metricNames = [...outcomeMetricNames];
37
39
  const runs = await traceStore.listRuns();
38
40
  assertUniqueObservationIds(runs.map((run) => run.runId), "runId");
39
- const outcomes = await outcomeStore.list(options.outcomeFilter);
40
- const outcomesByRun = /* @__PURE__ */ new Map();
41
- for (const o of outcomes) {
42
- const arr = outcomesByRun.get(o.runId) ?? [];
43
- arr.push(o);
44
- outcomesByRun.set(o.runId, arr);
45
- }
41
+ const outcomesByRun = groupOutcomesByRun(await outcomeStore.list(options.outcomeFilter));
46
42
  const pairs = [];
47
43
  for (const em of extractors) for (const om of metricNames) pairs.push({
48
44
  evalMetric: em.id,
@@ -584,6 +580,660 @@ function gateJudgeCalibration(perJudge, config) {
584
580
  cells
585
581
  };
586
582
  }
583
+ // src/meta-eval/measure-records.ts
584
+ /**
585
+ * Changes and the outcomes joined to them, shared by the measure validity
586
+ * study and the guard drift check. Internal to `meta-eval`; `MeasuredChange`
587
+ * is public through the barrel.
588
+ */
589
+ function validateChanges(changes, plan, requireUniqueIds) {
590
+ const ids = /* @__PURE__ */ new Set();
591
+ for (const [index, change] of changes.entries()) {
592
+ const where = `change ${index}${typeof change?.id === "string" ? ` (${change.id})` : ""}`;
593
+ if (typeof change?.id !== "string" || change.id.trim().length === 0) throw new ValidationError(`${where}: id must be a nonempty string`);
594
+ if (requireUniqueIds && ids.has(change.id)) throw new ValidationError(`${where}: duplicate change id`);
595
+ ids.add(change.id);
596
+ if (!Number.isFinite(change.at)) throw new ValidationError(`${where}: at must be finite`);
597
+ if (typeof change.unit !== "string" || change.unit.length === 0) throw new ValidationError(`${where}: unit must be a nonempty string`);
598
+ for (const measure of plan.measures) {
599
+ const value = change.measures?.[measure.id];
600
+ if (value !== void 0 && !Number.isFinite(value)) throw new ValidationError(`${where}: measure ${measure.id} must be finite; omit it when unmeasured`);
601
+ const movement = change.movements?.[measure.id];
602
+ if (movement === void 0) continue;
603
+ if (!Number.isFinite(movement.before) || !Number.isFinite(movement.after)) throw new ValidationError(`${where}: movement of ${measure.id} must be finite`);
604
+ if (measure.noise === void 0) throw new ValidationError(`${where}: records a movement of ${measure.id} but the plan declares no noise for it`);
605
+ }
606
+ }
607
+ }
608
+ function eligibleObservations(observations, change, plan, preCut) {
609
+ const counts = {
610
+ capturedBeforeChange: 0,
611
+ capturedAfterCutForPreCutChange: 0,
612
+ beyondMaxCaptureLag: 0
613
+ };
614
+ const eligible = [];
615
+ for (const observation of observations) if (observation.capturedAt < change.at) counts.capturedBeforeChange++;
616
+ else if (plan.maxCaptureLagMs !== void 0 && observation.capturedAt - change.at > plan.maxCaptureLagMs) counts.beyondMaxCaptureLag++;
617
+ else if (preCut && observation.capturedAt > plan.cut) counts.capturedAfterCutForPreCutChange++;
618
+ else eligible.push(observation);
619
+ return {
620
+ eligible,
621
+ ...counts
622
+ };
623
+ }
624
+ function joinOutcomes(eligible, change, outcomes, reduction) {
625
+ const joined = /* @__PURE__ */ new Map();
626
+ for (const outcome of outcomes) {
627
+ const reduced = reduceOutcomeObservation(eligible, outcome.id, reduction);
628
+ if (reduced === null) continue;
629
+ if (outcome.kind === "binary" && reduced.value !== 0 && reduced.value !== 1) throw new ValidationError(`change ${change.id}: binary outcome ${outcome.id} reduced to ${reduced.value}; record 0 or 1`);
630
+ const higher = outcome.direction === "higher-is-better";
631
+ joined.set(outcome.id, {
632
+ better: outcome.kind === "binary" ? higher ? reduced.value : 1 - reduced.value : higher ? reduced.value : -reduced.value,
633
+ capturedAt: reduced.capturedAt
634
+ });
635
+ }
636
+ return joined;
637
+ }
638
+ function statisticOf(outcome) {
639
+ return outcome.kind === "binary" ? "auc" : "spearman";
640
+ }
641
+ // src/meta-eval/measure-selection.ts
642
+ /**
643
+ * The subset of admitted measures to climb, the guards kept unoptimized beside
644
+ * it, and the check that a climbed measure has not drifted away from them.
645
+ *
646
+ * Selection reads only changes before the cut: each candidate is standardized
647
+ * by its before-cut median and robust scale and aligned to its direction, and
648
+ * greedy forward selection adds the measure that most raises the equal-weight
649
+ * composite's statistic, skipping a candidate redundant with one already
650
+ * climbed. Equal weights are deliberate: fitted weights on a few hundred
651
+ * changes overfit, and unit weights lose little when measures share a cause.
652
+ */
653
+ /**
654
+ * Whether a climbed measure rose while its guards did not, in a batch of
655
+ * later changes. Guards are measured at change time, so this reads before the
656
+ * outcome arrives; the outcome shift is reported when the batch has outcomes.
657
+ */
658
+ async function guardDrift(input) {
659
+ const { report, tolerance } = input;
660
+ if (!Number.isFinite(tolerance) || tolerance < 0) throw new ValidationError("guardDrift: tolerance must be finite and nonnegative");
661
+ const selection = report.selections.find((row) => row.outcome === input.outcome);
662
+ if (!selection) throw new ValidationError(`guardDrift: the report has no selection for outcome ${input.outcome}`);
663
+ const plan = report.plan;
664
+ validateChanges(input.batch, plan, false);
665
+ const guards = selection.guards;
666
+ const interval = (rows) => {
667
+ const units = new Set(rows.map((row) => row.unit)).size;
668
+ if (rows.length === 0 || units < plan.minUnits) return null;
669
+ const result = clusterBootstrapMean(rows.map((row) => ({
670
+ cluster: row.unit,
671
+ value: row.value
672
+ })), {
673
+ confidence: plan.confidence,
674
+ resamples: plan.resamples,
675
+ ...plan.seed === void 0 ? {} : { seed: plan.seed }
676
+ });
677
+ return {
678
+ n: rows.length,
679
+ units,
680
+ estimate: result.mean,
681
+ low: result.low,
682
+ high: result.high
683
+ };
684
+ };
685
+ const centered = (change, measure, direction, reference) => {
686
+ const value = change.measures[measure];
687
+ return value === void 0 ? null : alignedZ(value, direction, reference) - reference.meanZ;
688
+ };
689
+ const measures = selection.climb.map((climbed) => {
690
+ const shiftRows = [];
691
+ const guardRows = [];
692
+ const divergenceRows = [];
693
+ for (const change of input.batch) {
694
+ const own = centered(change, climbed.measure, climbed.direction, climbed.reference);
695
+ const guardValues = guards.map((guard) => centered(change, guard.measure, guard.direction, guard.reference)).filter((value) => value !== null);
696
+ if (own !== null) shiftRows.push({
697
+ unit: change.unit,
698
+ value: own
699
+ });
700
+ if (guardValues.length === 0) continue;
701
+ const guardMean = guardValues.reduce((sum, value) => sum + value, 0) / guardValues.length;
702
+ guardRows.push({
703
+ unit: change.unit,
704
+ value: guardMean
705
+ });
706
+ if (own !== null) divergenceRows.push({
707
+ unit: change.unit,
708
+ value: own - guardMean
709
+ });
710
+ }
711
+ const divergence = guards.length === 0 ? null : interval(divergenceRows);
712
+ return {
713
+ measure: climbed.measure,
714
+ status: divergence === null ? "insufficient" : divergence.low > tolerance ? "drift" : "within-tolerance",
715
+ shift: interval(shiftRows),
716
+ guardShift: guards.length === 0 ? null : interval(guardRows),
717
+ divergence
718
+ };
719
+ });
720
+ let outcomeShift = null;
721
+ const outcomeSpec = plan.outcomes.find((row) => row.id === input.outcome);
722
+ const reference = selection.outcomeReference;
723
+ if (input.outcomes && reference) {
724
+ const byRun = groupOutcomesByRun(await input.outcomes.list());
725
+ const rows = [];
726
+ for (const change of input.batch) {
727
+ const { eligible } = eligibleObservations(byRun.get(change.id) ?? [], change, plan, false);
728
+ const joined = joinOutcomes(eligible, change, [outcomeSpec], plan.reduction).get(outcomeSpec.id);
729
+ if (!joined) continue;
730
+ rows.push({
731
+ unit: change.unit,
732
+ value: reference.kind === "binary" ? joined.better - reference.betterRate : (joined.better - reference.center) / reference.scale - reference.meanZ
733
+ });
734
+ }
735
+ outcomeShift = interval(rows);
736
+ }
737
+ return {
738
+ outcome: input.outcome,
739
+ guards: guards.map((guard) => guard.measure),
740
+ status: selection.climb.length === 0 || guards.length === 0 ? "no-guards" : measures.some((row) => row.status === "drift") ? "drift" : measures.every((row) => row.status === "insufficient") ? "insufficient" : "no-drift",
741
+ measures,
742
+ outcomeShift
743
+ };
744
+ }
745
+ function outcomeReference(outcome, pre) {
746
+ const values = pre.flatMap((row) => {
747
+ const joined = row.outcomes.get(outcome.id);
748
+ return joined === void 0 ? [] : [joined.better];
749
+ });
750
+ if (values.length === 0) return null;
751
+ if (outcome.kind === "binary") return {
752
+ kind: "binary",
753
+ betterRate: values.reduce((sum, value) => sum + value, 0) / values.length
754
+ };
755
+ const scaled = robustScale(values);
756
+ if (scaled === null) return null;
757
+ const meanZ = values.reduce((sum, value) => sum + (value - scaled.center) / scaled.scale, 0) / values.length;
758
+ return {
759
+ kind: "continuous",
760
+ ...scaled,
761
+ meanZ
762
+ };
763
+ }
764
+ function robustScale(values) {
765
+ const center = sampleMedian(values);
766
+ if (center === null) return null;
767
+ const mad = sampleMedian(values.map((value) => Math.abs(value - center))) * 1.4826;
768
+ if (mad > 0) return {
769
+ center,
770
+ scale: mad
771
+ };
772
+ if (values.length < 2) return null;
773
+ const mean = values.reduce((sum, value) => sum + value, 0) / values.length;
774
+ const sd = Math.sqrt(values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / (values.length - 1));
775
+ return sd > 0 ? {
776
+ center,
777
+ scale: sd
778
+ } : null;
779
+ }
780
+ function alignedZ(value, direction, reference) {
781
+ return (direction === "higher" ? 1 : -1) * (value - reference.center) / reference.scale;
782
+ }
783
+ function selectMeasures(outcome, pairs, pre, post, plan, outcomeRef) {
784
+ const statistic = statisticOf(outcome);
785
+ const nullValue = statistic === "auc" ? .5 : 0;
786
+ const admitted = pairs.filter((pair) => pair.outcome === outcome.id && (pair.label === "predicts" || pair.label === "predicts-pooled-only"));
787
+ const excluded = [];
788
+ const references = /* @__PURE__ */ new Map();
789
+ const candidates = [];
790
+ for (const pair of admitted) {
791
+ if (pair.label === "predicts-pooled-only") {
792
+ excluded.push({
793
+ measure: pair.measure,
794
+ reason: "pooled-only"
795
+ });
796
+ continue;
797
+ }
798
+ const movement = pair.movement?.label;
799
+ if (movement === "insensitive" || movement === "moves-against-outcome") {
800
+ excluded.push({
801
+ measure: pair.measure,
802
+ reason: movement
803
+ });
804
+ continue;
805
+ }
806
+ const values = pre.flatMap((row) => {
807
+ const value = row.change.measures[pair.measure];
808
+ return value === void 0 ? [] : [value];
809
+ });
810
+ const scaled = robustScale(values);
811
+ if (scaled === null) continue;
812
+ const z = values.map((value) => alignedZ(value, pair.direction, scaled));
813
+ references.set(pair.measure, {
814
+ ...scaled,
815
+ meanZ: z.reduce((sum, value) => sum + value, 0) / z.length
816
+ });
817
+ candidates.push(pair);
818
+ }
819
+ const pairOf = new Map(candidates.map((pair) => [pair.measure, pair]));
820
+ const compositeRows = (rows, set) => rows.flatMap((row) => {
821
+ const joined = row.outcomes.get(outcome.id);
822
+ if (joined === void 0) return [];
823
+ let sum = 0;
824
+ for (const measure of set) {
825
+ const value = row.change.measures[measure];
826
+ if (value === void 0) return [];
827
+ sum += alignedZ(value, pairOf.get(measure).direction, references.get(measure));
828
+ }
829
+ return [{
830
+ x: sum / set.length,
831
+ y: joined.better,
832
+ unit: row.change.unit
833
+ }];
834
+ });
835
+ const objective = (set) => {
836
+ const rows = compositeRows(pre, set);
837
+ return rows.length < 3 ? NaN : associationEstimate(statistic, rows);
838
+ };
839
+ const redundancy = (measure, climbed) => {
840
+ let best = null;
841
+ for (const other of climbed) {
842
+ const xs = [];
843
+ const ys = [];
844
+ for (const row of pre) {
845
+ const x = row.change.measures[measure];
846
+ const y = row.change.measures[other];
847
+ if (x === void 0 || y === void 0) continue;
848
+ xs.push(x);
849
+ ys.push(y);
850
+ }
851
+ if (xs.length < 3) continue;
852
+ const correlation = Math.abs(spearmanR(xs, ys));
853
+ if (Number.isFinite(correlation) && (best === null || correlation > best.correlation)) best = {
854
+ with: other,
855
+ correlation
856
+ };
857
+ }
858
+ return best;
859
+ };
860
+ const climb = [];
861
+ const guards = [];
862
+ let remaining = candidates.map((pair) => pair.measure);
863
+ let current = nullValue;
864
+ const guard = (measure, reason) => {
865
+ const nearest = redundancy(measure, climb.map((row) => row.measure));
866
+ return {
867
+ measure,
868
+ direction: pairOf.get(measure).direction,
869
+ reason,
870
+ redundantWith: reason === "redundant" ? nearest?.with ?? null : null,
871
+ correlation: nearest?.correlation ?? null,
872
+ reference: references.get(measure)
873
+ };
874
+ };
875
+ while (remaining.length > 0) {
876
+ const climbed = climb.map((row) => row.measure);
877
+ remaining = remaining.filter((measure) => {
878
+ const nearest = redundancy(measure, climbed);
879
+ if (nearest === null || nearest.correlation < plan.selection.maxRedundancy) return true;
880
+ guards.push(guard(measure, "redundant"));
881
+ return false;
882
+ });
883
+ if (remaining.length === 0 || climb.length >= plan.selection.maxMeasures) break;
884
+ let best = null;
885
+ for (const measure of remaining) {
886
+ const value = objective([...climbed, measure]);
887
+ if (Number.isFinite(value) && (best === null || value > best.value)) best = {
888
+ measure,
889
+ value
890
+ };
891
+ }
892
+ if (best === null) break;
893
+ const gain = best.value - current;
894
+ if (climb.length === 0 ? !(gain > 0) : !(gain >= plan.selection.minGain)) break;
895
+ climb.push({
896
+ measure: best.measure,
897
+ gain
898
+ });
899
+ current = best.value;
900
+ remaining = remaining.filter((measure) => measure !== best.measure);
901
+ }
902
+ const sizeLimited = climb.length >= plan.selection.maxMeasures;
903
+ for (const measure of remaining) guards.push(guard(measure, sizeLimited ? "size-limit" : "no-gain"));
904
+ const climbedIds = climb.map((row) => row.measure);
905
+ const postRows = climbedIds.length === 0 ? [] : compositeRows(post, climbedIds);
906
+ const postUnits = new Set(postRows.map((row) => row.unit)).size;
907
+ const composite = {
908
+ preCut: climbedIds.length === 0 ? null : {
909
+ n: compositeRows(pre, climbedIds).length,
910
+ estimate: current
911
+ },
912
+ postCut: postRows.length >= plan.minJoined && postUnits >= plan.minUnits && Number.isFinite(associationEstimate(statistic, postRows)) ? clusteredAssociation(postRows, {
913
+ statistic,
914
+ alternative: "greater",
915
+ resamples: plan.resamples,
916
+ confidence: plan.confidence,
917
+ ...plan.seed === void 0 ? {} : { seed: plan.seed }
918
+ }) : null
919
+ };
920
+ return {
921
+ outcome: outcome.id,
922
+ climb: climb.map(({ measure, gain }) => {
923
+ const pair = pairOf.get(measure);
924
+ return {
925
+ measure,
926
+ direction: pair.direction,
927
+ preCutGain: gain,
928
+ postCutEstimate: pair.postCut.association.estimate,
929
+ leadTimeMs: pair.leadTimeMs,
930
+ cost: plan.measures.find((row) => row.id === measure).cost ?? null,
931
+ reference: references.get(measure)
932
+ };
933
+ }),
934
+ guards,
935
+ excluded,
936
+ composite,
937
+ outcomeReference: outcomeRef
938
+ };
939
+ }
940
+ // src/meta-eval/measure-validity.ts
941
+ /**
942
+ * Which recorded numbers predict a result decided later, on changes they were
943
+ * not chosen on, and which few of them to climb.
944
+ *
945
+ * A change has an id, a time, an independent unit and numbers known when it
946
+ * was made. Outcomes join to it through `DeploymentOutcome.runId` and carry
947
+ * their own capture time. The sealed plan's cut splits the changes: changes
948
+ * before it, with outcomes known by it, fix each measure's direction, the
949
+ * standardization and the selected subset; every reported statistic comes from
950
+ * changes at or after it with those choices fixed. Intervals resample whole
951
+ * units. Each test is one-sided, in the direction fixed before the cut, and
952
+ * Benjamini-Hochberg at the plan's level runs across every pair tested. A
953
+ * pooled statistic compares changes across units; a within-unit statistic
954
+ * compares changes of the same unit, so a measure that only tells units apart
955
+ * is visible as `predicts-pooled-only`.
956
+ *
957
+ * Prediction is not causation. An admitted measure forecasts the outcome of
958
+ * changes like these; it does not show that raising the measure raises the
959
+ * outcome. Records that show cause assign changes at random or interleave
960
+ * them, so the measure moves for reasons unrelated to the outcome.
961
+ */
962
+ const HYPOTHESIS = "one-sided: the measure, aligned to the direction fixed before the cut, is above the null for the better outcome; Benjamini-Hochberg per family at the plan level";
963
+ const CLAIM = {
964
+ causal: false,
965
+ scope: "held-out prediction: the measure forecasts the outcome of changes after the cut",
966
+ causeRequires: "randomized or interleaved assignment of changes, so the measure moves for reasons unrelated to the outcome"
967
+ };
968
+ /** Rank every planned measure against every planned outcome on changes after the cut. */
969
+ async function measureValidityStudy(input) {
970
+ const sealed = structuredClone(input.plan);
971
+ if (!verifyMeasureValidityPlan(sealed)) throw new ValidationError("measureValidityStudy: the plan seal does not verify; seal it with sealMeasureValidityPlan before reading changes after the cut");
972
+ const plan = sealed.plan;
973
+ validateChanges(input.changes, plan, true);
974
+ const byRun = groupOutcomesByRun(await input.outcomes.list());
975
+ const excluded = {
976
+ capturedBeforeChange: 0,
977
+ capturedAfterCutForPreCutChange: 0,
978
+ beyondMaxCaptureLag: 0
979
+ };
980
+ const prepared = input.changes.map((change) => {
981
+ const preCut = change.at < plan.cut;
982
+ const { eligible, ...counts } = eligibleObservations(byRun.get(change.id) ?? [], change, plan, preCut);
983
+ excluded.capturedBeforeChange += counts.capturedBeforeChange;
984
+ excluded.capturedAfterCutForPreCutChange += counts.capturedAfterCutForPreCutChange;
985
+ excluded.beyondMaxCaptureLag += counts.beyondMaxCaptureLag;
986
+ return {
987
+ change,
988
+ preCut,
989
+ outcomes: joinOutcomes(eligible, change, plan.outcomes, plan.reduction)
990
+ };
991
+ });
992
+ const pre = prepared.filter((row) => row.preCut);
993
+ const post = prepared.filter((row) => !row.preCut);
994
+ const preUnits = new Set(pre.map((row) => row.change.unit));
995
+ const postUnits = new Set(post.map((row) => row.change.unit));
996
+ const pairs = [];
997
+ for (const measure of plan.measures) for (const outcome of plan.outcomes) pairs.push(assessPair(measure.id, outcome, pre, post, plan));
998
+ const tested = pairs.filter((pair) => pair.postCut.association !== null);
999
+ const { qValues } = benjaminiHochberg(tested.map((pair) => pair.postCut.association.pValue), plan.level);
1000
+ tested.forEach((pair, index) => {
1001
+ pair.postCut.qValue = qValues[index];
1002
+ });
1003
+ const withinTested = tested.filter((pair) => pair.postCut.withinUnit !== null);
1004
+ const withinQ = benjaminiHochberg(withinTested.map((pair) => pair.postCut.withinUnit.pValue), plan.level).qValues;
1005
+ withinTested.forEach((pair, index) => {
1006
+ pair.postCut.withinUnitQValue = withinQ[index];
1007
+ });
1008
+ for (const pair of tested) {
1009
+ const association = pair.postCut.association;
1010
+ if (pair.postCut.qValue <= plan.level) {
1011
+ const withinShown = pair.postCut.withinUnit === null || pair.postCut.withinUnitQValue <= plan.level;
1012
+ pair.label = withinShown ? "predicts" : "predicts-pooled-only";
1013
+ pair.reason = withinShown ? null : "within-unit-not-shown";
1014
+ } else {
1015
+ pair.label = "not-shown";
1016
+ pair.reason = association.high < association.null ? "direction-reversed" : "not-significant";
1017
+ }
1018
+ }
1019
+ const outcomeReferences = new Map(plan.outcomes.map((outcome) => [outcome.id, outcomeReference(outcome, pre)]));
1020
+ for (const pair of pairs) {
1021
+ const outcome = plan.outcomes.find((row) => row.id === pair.outcome);
1022
+ pair.movement = assessMovement(pair, outcome, post, plan, outcomeReferences.get(outcome.id));
1023
+ }
1024
+ const movementTested = pairs.filter((pair) => pair.movement?.agreement);
1025
+ const movementQ = benjaminiHochberg(movementTested.map((pair) => pair.movement.agreement.pValue), plan.level).qValues;
1026
+ movementTested.forEach((pair, index) => {
1027
+ const movement = pair.movement;
1028
+ const agreement = movement.agreement;
1029
+ const q = movementQ[index];
1030
+ movement.qValue = q;
1031
+ movement.label = q <= plan.level ? "moves-with-outcome" : agreement.high < agreement.null ? "moves-against-outcome" : "agreement-not-shown";
1032
+ });
1033
+ const selections = plan.outcomes.map((outcome) => selectMeasures(outcome, pairs, pre, post, plan, outcomeReferences.get(outcome.id)));
1034
+ return {
1035
+ planDigest: sealed.digest,
1036
+ plan,
1037
+ claim: { ...CLAIM },
1038
+ hypothesis: HYPOTHESIS,
1039
+ changes: {
1040
+ total: prepared.length,
1041
+ preCut: pre.length,
1042
+ postCut: post.length
1043
+ },
1044
+ units: {
1045
+ preCut: preUnits.size,
1046
+ postCut: postUnits.size,
1047
+ both: [...postUnits].filter((unit) => preUnits.has(unit)).length
1048
+ },
1049
+ excludedObservations: excluded,
1050
+ coverage: plan.measures.map((measure) => coverageOf(measure.id, pre, post)),
1051
+ pairs,
1052
+ tested: tested.length,
1053
+ withinUnitTested: withinTested.length,
1054
+ admitted: pairs.filter((pair) => pair.label === "predicts").length,
1055
+ movementTested: movementTested.length,
1056
+ selections
1057
+ };
1058
+ }
1059
+ function coverageOf(measure, pre, post) {
1060
+ const measured = (rows) => rows.filter((row) => row.change.measures[measure] !== void 0).length;
1061
+ const changes = pre.length + post.length;
1062
+ const total = measured(pre) + measured(post);
1063
+ return {
1064
+ measure,
1065
+ changes,
1066
+ measured: total,
1067
+ share: changes === 0 ? 0 : total / changes,
1068
+ preCut: {
1069
+ changes: pre.length,
1070
+ measured: measured(pre)
1071
+ },
1072
+ postCut: {
1073
+ changes: post.length,
1074
+ measured: measured(post)
1075
+ },
1076
+ movements: [...pre, ...post].filter((row) => row.change.movements?.[measure] !== void 0).length
1077
+ };
1078
+ }
1079
+ function joinedRows(rows, measure, outcome) {
1080
+ return rows.flatMap((row) => {
1081
+ const x = row.change.measures[measure];
1082
+ const joined = row.outcomes.get(outcome);
1083
+ return x === void 0 || joined === void 0 ? [] : [{
1084
+ x,
1085
+ y: joined.better,
1086
+ unit: row.change.unit,
1087
+ lag: joined.capturedAt - row.change.at
1088
+ }];
1089
+ });
1090
+ }
1091
+ function assessPair(measure, outcome, pre, post, plan) {
1092
+ const statistic = statisticOf(outcome);
1093
+ const nullValue = statistic === "auc" ? .5 : 0;
1094
+ const preRows = joinedRows(pre, measure, outcome.id);
1095
+ const postRows = joinedRows(post, measure, outcome.id);
1096
+ const preEstimate = preRows.length >= 3 ? associationEstimate(statistic, preRows) : NaN;
1097
+ const direction = !Number.isFinite(preEstimate) ? null : preEstimate > nullValue ? "higher" : preEstimate < nullValue ? "lower" : null;
1098
+ const postUnits = new Set(postRows.map((row) => row.unit)).size;
1099
+ const lags = postRows.map((row) => row.lag);
1100
+ const result = {
1101
+ measure,
1102
+ outcome: outcome.id,
1103
+ statistic,
1104
+ label: "insufficient",
1105
+ reason: null,
1106
+ direction,
1107
+ preCut: {
1108
+ n: preRows.length,
1109
+ units: new Set(preRows.map((row) => row.unit)).size,
1110
+ estimate: Number.isFinite(preEstimate) ? preEstimate : null
1111
+ },
1112
+ postCut: {
1113
+ n: postRows.length,
1114
+ units: postUnits,
1115
+ minority: minorityCount(postRows.map((row) => row.x)),
1116
+ association: null,
1117
+ qValue: null,
1118
+ withinUnit: null,
1119
+ withinUnitQValue: null
1120
+ },
1121
+ leadTimeMs: lags.length === 0 ? null : {
1122
+ median: sampleMedian(lags),
1123
+ min: lags.reduce((a, b) => Math.min(a, b)),
1124
+ max: lags.reduce((a, b) => Math.max(a, b))
1125
+ },
1126
+ movement: null
1127
+ };
1128
+ const aligned = postRows.map((row) => ({
1129
+ x: direction === "lower" ? -row.x : row.x,
1130
+ y: row.y,
1131
+ unit: row.unit
1132
+ }));
1133
+ if (postRows.length < plan.minJoined) result.reason = "below-minimum-count";
1134
+ else if (postUnits < plan.minUnits) result.reason = "too-few-units";
1135
+ else if (result.postCut.minority < plan.minMinority) result.reason = "too-little-variation";
1136
+ else if (direction === null) result.reason = "no-pre-cut-direction";
1137
+ else if (!Number.isFinite(associationEstimate(statistic, aligned))) result.reason = "constant-after-cut";
1138
+ if (result.reason !== null) return result;
1139
+ const options = {
1140
+ statistic,
1141
+ alternative: "greater",
1142
+ resamples: plan.resamples,
1143
+ confidence: plan.confidence,
1144
+ ...plan.seed === void 0 ? {} : { seed: plan.seed }
1145
+ };
1146
+ result.postCut.association = clusteredAssociation(aligned, options);
1147
+ if (comparableUnits(aligned) >= plan.minUnits && Number.isFinite(associationEstimate(statistic, aligned, "within-unit"))) result.postCut.withinUnit = clusteredAssociation(aligned, {
1148
+ ...options,
1149
+ scope: "within-unit"
1150
+ });
1151
+ return result;
1152
+ }
1153
+ /** Values that differ from the most common value: the smaller class of a two-valued measure. */
1154
+ function minorityCount(values) {
1155
+ const counts = /* @__PURE__ */ new Map();
1156
+ let largest = 0;
1157
+ for (const value of values) {
1158
+ const count = (counts.get(value) ?? 0) + 1;
1159
+ counts.set(value, count);
1160
+ largest = Math.max(largest, count);
1161
+ }
1162
+ return values.length - largest;
1163
+ }
1164
+ /** Units holding a comparable pair: two changes with different outcomes. */
1165
+ function comparableUnits(rows) {
1166
+ const seen = /* @__PURE__ */ new Map();
1167
+ const comparable = /* @__PURE__ */ new Set();
1168
+ for (const row of rows) {
1169
+ const first = seen.get(row.unit);
1170
+ if (first === void 0) seen.set(row.unit, row.y);
1171
+ else if (first !== row.y) comparable.add(row.unit);
1172
+ }
1173
+ return comparable.size;
1174
+ }
1175
+ function assessMovement(pair, outcome, post, plan, reference) {
1176
+ const noise = plan.measures.find((row) => row.id === pair.measure).noise;
1177
+ const rows = post.flatMap((row) => {
1178
+ const movement = row.change.movements?.[pair.measure];
1179
+ return movement === void 0 ? [] : [{
1180
+ row,
1181
+ delta: movement.after - movement.before
1182
+ }];
1183
+ });
1184
+ if (noise === void 0 || rows.length === 0) return null;
1185
+ const units = new Set(rows.map(({ row }) => row.change.unit)).size;
1186
+ const moved = rows.filter(({ delta }) => Math.abs(delta) > noise);
1187
+ const result = {
1188
+ label: "insufficient",
1189
+ changes: rows.length,
1190
+ units,
1191
+ moved: moved.length,
1192
+ sensitivity: null,
1193
+ agreement: null,
1194
+ qValue: null
1195
+ };
1196
+ if (rows.length < plan.minJoined || units < plan.minUnits) return result;
1197
+ const sensitivity = clusterBootstrapMean(rows.map(({ row, delta }) => ({
1198
+ cluster: row.change.unit,
1199
+ value: Math.abs(delta) > noise ? 1 : 0
1200
+ })), {
1201
+ confidence: plan.confidence,
1202
+ resamples: plan.resamples,
1203
+ ...plan.seed === void 0 ? {} : { seed: plan.seed }
1204
+ });
1205
+ result.sensitivity = {
1206
+ estimate: sensitivity.mean,
1207
+ low: sensitivity.low,
1208
+ high: sensitivity.high
1209
+ };
1210
+ if (sensitivity.high < plan.minSensitivity) {
1211
+ result.label = "insensitive";
1212
+ return result;
1213
+ }
1214
+ if (pair.direction === null || reference === null) return result;
1215
+ const sign = pair.direction === "higher" ? 1 : -1;
1216
+ const agreementRows = moved.flatMap(({ row, delta }) => {
1217
+ const joined = row.outcomes.get(outcome.id);
1218
+ if (joined === void 0) return [];
1219
+ const better = reference.kind === "binary" ? joined.better : joined.better > reference.center ? 1 : joined.better < reference.center ? 0 : null;
1220
+ return better === null ? [] : [{
1221
+ x: Math.sign(sign * delta),
1222
+ y: better,
1223
+ unit: row.change.unit
1224
+ }];
1225
+ });
1226
+ const agreementUnits = new Set(agreementRows.map((row) => row.unit)).size;
1227
+ if (agreementRows.length < plan.minJoined || agreementUnits < plan.minUnits || !Number.isFinite(associationEstimate("auc", agreementRows))) return result;
1228
+ result.agreement = clusteredAssociation(agreementRows, {
1229
+ statistic: "auc",
1230
+ alternative: "greater",
1231
+ resamples: plan.resamples,
1232
+ confidence: plan.confidence,
1233
+ ...plan.seed === void 0 ? {} : { seed: plan.seed }
1234
+ });
1235
+ return result;
1236
+ }
587
1237
  // src/meta-eval/plants.ts
588
1238
  /**
589
1239
  * Plants — seeded known-wrong items that measure the grader, not the work.
@@ -1064,6 +1714,6 @@ function unseededRejection(manifest, scoreByItemId) {
1064
1714
  rejectionRate: decided === 0 ? null : rejected / decided
1065
1715
  };
1066
1716
  }
1067
- export { DEFAULT_JUDGE_GATE_POLICY, FileSystemOutcomeStore, InMemoryOutcomeStore, JudgeGateRefusedError, OutcomeStoreError, addCalibrationVerdicts, assertJudgeMayGate, auditEvaluator, auditProbabilityPolicy, brierScore, calibrateJudge, calibrateJudgeContinuous, calibrateJudgePanel, calibrationCurve, calibrationFromPairs, catchRate, clusterBootstrapMean, continuousAgreement, correlationStudy, definePlant, evalHealthStamp, evaluatorAdmissionPolicySchema, evaluatorAuditObservationSchema, fileSentinelStore, gateJudgeCalibration, judgeGateDecision, judgeSentinelReport, measureJudgeAgreement, multiclassBrierScore, perturbEvidence, planEvaluatorAudit, plantByPerturbation, positionalBias, rankedProbabilityScore, registerCalibrationSet, rubricPredictiveValidity, seedPlants, selfPreference, snapshotFromAgreement, snapshotFromCalibration, snapshotFromJudgeAgreement, snapshotFromSentinelSet, validateSentinelSnapshot, verbosityBias };
1717
+ export { DEFAULT_JUDGE_GATE_POLICY, FileSystemOutcomeStore, InMemoryOutcomeStore, JudgeGateRefusedError, OutcomeStoreError, addCalibrationVerdicts, assertJudgeMayGate, auditEvaluator, auditProbabilityPolicy, brierScore, calibrateJudge, calibrateJudgeContinuous, calibrateJudgePanel, calibrationCurve, calibrationFromPairs, catchRate, clusterBootstrapMean, continuousAgreement, correlationStudy, definePlant, evalHealthStamp, evaluatorAdmissionPolicySchema, evaluatorAuditObservationSchema, fileSentinelStore, gateJudgeCalibration, guardDrift, judgeGateDecision, judgeSentinelReport, measureJudgeAgreement, measureValidityStudy, multiclassBrierScore, perturbEvidence, planEvaluatorAudit, plantByPerturbation, positionalBias, rankedProbabilityScore, registerCalibrationSet, rubricPredictiveValidity, seedPlants, selfPreference, snapshotFromAgreement, snapshotFromCalibration, snapshotFromJudgeAgreement, snapshotFromSentinelSet, validateSentinelSnapshot, verbosityBias };
1068
1718
 
1069
1719
  //# sourceMappingURL=index.js.map