@tangle-network/agent-eval 0.216.0 → 0.217.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (553) hide show
  1. package/CHANGELOG.md +141 -57
  2. package/README.md +2 -2
  3. package/dist/adapters/http.d.ts +3 -3
  4. package/dist/{agent-profile-CIA2Atnt.d.ts → agent-profile-DTt8uGP9.d.ts} +5 -18
  5. package/dist/agent-profile-DTt8uGP9.d.ts.map +1 -0
  6. package/dist/{agent-profile-cell-BYc0bxsL.js → agent-profile-cell-B1V1gUZs.js} +4 -53
  7. package/dist/agent-profile-cell-B1V1gUZs.js.map +1 -0
  8. package/dist/{agent-profile-cell-BNp-Js9F.d.ts → agent-profile-cell-BcpFbNd5.d.ts} +2 -22
  9. package/dist/agent-profile-cell-BcpFbNd5.d.ts.map +1 -0
  10. package/dist/{agreement-irr-DsTURxdr.js → agreement-irr-BhAqjluA.js} +5 -5
  11. package/dist/agreement-irr-BhAqjluA.js.map +1 -0
  12. package/dist/analyst/index.d.ts +37 -170
  13. package/dist/analyst/index.d.ts.map +1 -1
  14. package/dist/analyst/index.js +17 -192
  15. package/dist/analyst/index.js.map +1 -1
  16. package/dist/{analyze-runs-3xpby3p2.js → analyze-runs-DqPJaJ4X.js} +763 -555
  17. package/dist/analyze-runs-DqPJaJ4X.js.map +1 -0
  18. package/dist/{analyze-runs-CSDAh8A7.d.ts → analyze-runs-DyeNcenW.d.ts} +18 -16
  19. package/dist/analyze-runs-DyeNcenW.d.ts.map +1 -0
  20. package/dist/authenticity/index.d.ts +0 -23
  21. package/dist/authenticity/index.d.ts.map +1 -1
  22. package/dist/authenticity/index.js +1 -34
  23. package/dist/authenticity/index.js.map +1 -1
  24. package/dist/{benchmark-command-CByl9dxG.js → benchmark-command-xQK8nOI6.js} +591 -109
  25. package/dist/benchmark-command-xQK8nOI6.js.map +1 -0
  26. package/dist/benchmarks/index.d.ts +5 -6
  27. package/dist/benchmarks/index.d.ts.map +1 -1
  28. package/dist/benchmarks/index.js +4 -4
  29. package/dist/benchmarks/index.js.map +1 -1
  30. package/dist/builder-eval/index.d.ts +3 -3
  31. package/dist/builder-eval/index.js +2 -2
  32. package/dist/builder-eval/index.js.map +1 -1
  33. package/dist/campaign/index.d.ts +8 -8
  34. package/dist/campaign/index.js +15 -15
  35. package/dist/{campaign-BQ-Jujuj.js → campaign-CJGkxAQ6.js} +256 -765
  36. package/dist/campaign-CJGkxAQ6.js.map +1 -0
  37. package/dist/{campaign-evidence-OcUciD-N.js → campaign-evidence-CQYw8_0H.js} +10 -18
  38. package/dist/{campaign-evidence-OcUciD-N.js.map → campaign-evidence-CQYw8_0H.js.map} +1 -1
  39. package/dist/{canonical-BsZVgBhW.js → canonical-Dq2hOQ8L.js} +2 -2
  40. package/dist/{canonical-BsZVgBhW.js.map → canonical-Dq2hOQ8L.js.map} +1 -1
  41. package/dist/cell-spend-DEWR3nj-.js +90 -0
  42. package/dist/cell-spend-DEWR3nj-.js.map +1 -0
  43. package/dist/{chat-client-DthPOYGd.js → chat-client-ldqxYYTN.js} +2 -2
  44. package/dist/{chat-client-DthPOYGd.js.map → chat-client-ldqxYYTN.js.map} +1 -1
  45. package/dist/{chat-json-call-BrKsyspg.js → chat-json-call-DavzexSp.js} +3 -2
  46. package/dist/chat-json-call-DavzexSp.js.map +1 -0
  47. package/dist/{claim-BXcZw-jo.js → claim-BPVuyHuy.js} +4 -4
  48. package/dist/claim-BPVuyHuy.js.map +1 -0
  49. package/dist/cli.js +113 -12
  50. package/dist/cli.js.map +1 -1
  51. package/dist/{client-BzL9niqi.d.ts → client-hwo3cJjR.d.ts} +3 -16
  52. package/dist/client-hwo3cJjR.d.ts.map +1 -0
  53. package/dist/{cluster-bootstrap-B3JywQQn.js → cluster-bootstrap-DEwwhl0C.js} +3 -3
  54. package/dist/{cluster-bootstrap-B3JywQQn.js.map → cluster-bootstrap-DEwwhl0C.js.map} +1 -1
  55. package/dist/{produced-state-ZCtDBxAE.js → completion-verifier-B_jw6C9p.js} +9 -64
  56. package/dist/completion-verifier-B_jw6C9p.js.map +1 -0
  57. package/dist/contract/index.d.ts +13 -13
  58. package/dist/contract/index.js +1041 -1473
  59. package/dist/contract/index.js.map +1 -1
  60. package/dist/{cost-ledger-D2FnJPBF.js → cost-ledger-D0352Z4d.js} +832 -817
  61. package/dist/cost-ledger-D0352Z4d.js.map +1 -0
  62. package/dist/{cost-ledger-CO7UyEcQ.d.ts → cost-ledger-Jk62OBfF.d.ts} +12 -47
  63. package/dist/cost-ledger-Jk62OBfF.d.ts.map +1 -0
  64. package/dist/dataset-DQqhOCPt.d.ts.map +1 -1
  65. package/dist/{default-registry-Cn1LQ2Ve.js → default-registry-ClYjq3QE.js} +8 -11
  66. package/dist/default-registry-ClYjq3QE.js.map +1 -0
  67. package/dist/{default-registry-BrWh62zf.d.ts → default-registry-DXgLmoDI.d.ts} +7 -50
  68. package/dist/default-registry-DXgLmoDI.d.ts.map +1 -0
  69. package/dist/{define-agent-eval-Ch3MWX6k.js → define-agent-eval-BDxNlP3D.js} +10 -10
  70. package/dist/define-agent-eval-BDxNlP3D.js.map +1 -0
  71. package/dist/{define-agent-eval-CEWkX5wZ.d.ts → define-agent-eval-BIkH_gAR.d.ts} +9 -9
  72. package/dist/define-agent-eval-BIkH_gAR.d.ts.map +1 -0
  73. package/dist/{descriptive-CnU8Yq29.js → descriptive-CVNy48rR.js} +2 -2
  74. package/dist/{descriptive-CnU8Yq29.js.map → descriptive-CVNy48rR.js.map} +1 -1
  75. package/dist/diagnosis/index.d.ts +4 -14
  76. package/dist/diagnosis/index.d.ts.map +1 -1
  77. package/dist/diagnosis/index.js +67 -28
  78. package/dist/diagnosis/index.js.map +1 -1
  79. package/dist/{dspy-rlm-engine-D-KX_e64.js → dspy-rlm-engine-DhdCr1Dc.js} +5 -10
  80. package/dist/dspy-rlm-engine-DhdCr1Dc.js.map +1 -0
  81. package/dist/{emitter-HcCmFQl_.d.ts → emitter-DABYYTcH.d.ts} +5 -5
  82. package/dist/emitter-DABYYTcH.d.ts.map +1 -0
  83. package/dist/emitter-DbMXUIVP.js.map +1 -1
  84. package/dist/{engine-C_zNWfM8.d.ts → engine-BvZ0R-36.d.ts} +18 -22
  85. package/dist/engine-BvZ0R-36.d.ts.map +1 -0
  86. package/dist/{equal-terms-Blx9Zk5I.js → equal-terms-DbPGcVtI.js} +2 -2
  87. package/dist/equal-terms-DbPGcVtI.js.map +1 -0
  88. package/dist/{errors-Dngq5h35.js → errors-BcOs5MKW.js} +6 -8
  89. package/dist/{errors-Dngq5h35.js.map → errors-BcOs5MKW.js.map} +1 -1
  90. package/dist/{eval-campaign-4byTtqrf.js → eval-campaign-BLEfBGbA.js} +6 -6
  91. package/dist/{eval-campaign-4byTtqrf.js.map → eval-campaign-BLEfBGbA.js.map} +1 -1
  92. package/dist/{evaluation-Cn2dRZIz.d.ts → evaluation-jTjC_QQD.d.ts} +8 -8
  93. package/dist/evaluation-jTjC_QQD.d.ts.map +1 -0
  94. package/dist/evaluation.d.ts +2 -2
  95. package/dist/evaluation.js +1 -1
  96. package/dist/evaluation.js.map +1 -1
  97. package/dist/{exact-types-CD0lf5Qd.d.ts → exact-types-CflbJ9f3.d.ts} +2 -2
  98. package/dist/{exact-types-CD0lf5Qd.d.ts.map → exact-types-CflbJ9f3.d.ts.map} +1 -1
  99. package/dist/{exec-ChJ6d5if.js → exec-CpbtOXVt.js} +2 -24
  100. package/dist/{exec-ChJ6d5if.js.map → exec-CpbtOXVt.js.map} +1 -1
  101. package/dist/execution-tracks-CpgFPpS5.js.map +1 -1
  102. package/dist/experiment/index.d.ts +331 -33
  103. package/dist/experiment/index.d.ts.map +1 -1
  104. package/dist/experiment/index.js +303 -101
  105. package/dist/experiment/index.js.map +1 -1
  106. package/dist/{exporters-X4xwla8A.js → exporters-Cl6IeNAu.js} +3 -3
  107. package/dist/exporters-Cl6IeNAu.js.map +1 -0
  108. package/dist/{exporters-ChTnR90l.d.ts → exporters-Dk3oEbK_.d.ts} +2 -4
  109. package/dist/{exporters-ChTnR90l.d.ts.map → exporters-Dk3oEbK_.d.ts.map} +1 -1
  110. package/dist/{external-optimizer-process-nnsY5D_4.js → external-optimizer-process-KVFGvYX1.js} +4 -3
  111. package/dist/external-optimizer-process-KVFGvYX1.js.map +1 -0
  112. package/dist/{external-optimizer-subprocess-DcerlZSG.js → external-optimizer-subprocess-XIHBOSKt.js} +551 -553
  113. package/dist/external-optimizer-subprocess-XIHBOSKt.js.map +1 -0
  114. package/dist/{extract-usage-BrnzRJ6H.js → extract-usage-BZLU01kR.js} +2 -23
  115. package/dist/{extract-usage-BrnzRJ6H.js.map → extract-usage-BZLU01kR.js.map} +1 -1
  116. package/dist/{failure-cluster-CbgEDcFJ.d.ts → failure-cluster-DN0t63Z0.d.ts} +4 -43
  117. package/dist/failure-cluster-DN0t63Z0.d.ts.map +1 -0
  118. package/dist/{failure-taxonomy-CjabTATj.js → failure-taxonomy-Bx5oWqaW.js} +2 -19
  119. package/dist/{failure-taxonomy-CjabTATj.js.map → failure-taxonomy-Bx5oWqaW.js.map} +1 -1
  120. package/dist/{feedback-trajectory-DkaDj0dj.d.ts → feedback-trajectory-BWmhRBGu.d.ts} +8 -13
  121. package/dist/feedback-trajectory-BWmhRBGu.d.ts.map +1 -0
  122. package/dist/{semantic-concept-judge-zQBG9hHU.js → findings-store-BMVQtEsm.js} +13 -255
  123. package/dist/findings-store-BMVQtEsm.js.map +1 -0
  124. package/dist/fuzz.d.ts +20 -63
  125. package/dist/fuzz.d.ts.map +1 -1
  126. package/dist/fuzz.js +62 -108
  127. package/dist/fuzz.js.map +1 -1
  128. package/dist/{hf-dataset-BR2yhuNn.js → hf-dataset-D9f7-oX7.js} +4 -24
  129. package/dist/hf-dataset-D9f7-oX7.js.map +1 -0
  130. package/dist/hosted/index.d.ts +2 -2
  131. package/dist/hosted/index.js +2 -2
  132. package/dist/{index-DHKEAv3s.d.ts → index-9jJ2fKSX.d.ts} +2 -64
  133. package/dist/index-9jJ2fKSX.d.ts.map +1 -0
  134. package/dist/{index-oQ4aHziK.d.ts → index-BLGqZ81N.d.ts} +11 -16
  135. package/dist/{index-oQ4aHziK.d.ts.map → index-BLGqZ81N.d.ts.map} +1 -1
  136. package/dist/{index-DlH0Y9gI.d.ts → index-BiT6RtNH.d.ts} +31 -43
  137. package/dist/index-BiT6RtNH.d.ts.map +1 -0
  138. package/dist/{index-Ch9VxCpK.d.ts → index-CX-GAUpw.d.ts} +4 -8
  139. package/dist/index-CX-GAUpw.d.ts.map +1 -0
  140. package/dist/{index-CPJJr98o.d.ts → index-CiRwLv2R.d.ts} +5 -68
  141. package/dist/index-CiRwLv2R.d.ts.map +1 -0
  142. package/dist/{index-NvGBiO8H.d.ts → index-ZuWx52WG.d.ts} +266 -495
  143. package/dist/index-ZuWx52WG.d.ts.map +1 -0
  144. package/dist/index.d.ts +2256 -2165
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +514 -1192
  147. package/dist/index.js.map +1 -1
  148. package/dist/{integrity-BV1ZDf42.js → integrity-DOd9Q86O.js} +7 -12
  149. package/dist/integrity-DOd9Q86O.js.map +1 -0
  150. package/dist/{integrity-BvnVARVl.js → integrity-W4CADcFc.js} +3 -7
  151. package/dist/{integrity-BvnVARVl.js.map → integrity-W4CADcFc.js.map} +1 -1
  152. package/dist/{integrity-CCAxGVK6.d.ts → integrity-_qgZLA5p.d.ts} +4 -6
  153. package/dist/{integrity-CCAxGVK6.d.ts.map → integrity-_qgZLA5p.d.ts.map} +1 -1
  154. package/dist/{internal-CRHwS9iz.js → internal-BTK91Bqt.js} +3 -3
  155. package/dist/{internal-CRHwS9iz.js.map → internal-BTK91Bqt.js.map} +1 -1
  156. package/dist/interval-Dq9gt7jx.js +219 -0
  157. package/dist/interval-Dq9gt7jx.js.map +1 -0
  158. package/dist/interval-ohuOJurX.d.ts +47 -0
  159. package/dist/interval-ohuOJurX.d.ts.map +1 -0
  160. package/dist/{journal-DvKCvjty.js → journal-CR4QikYp.js} +110 -110
  161. package/dist/journal-CR4QikYp.js.map +1 -0
  162. package/dist/json-BhdsJaOQ.js +111 -0
  163. package/dist/json-BhdsJaOQ.js.map +1 -0
  164. package/dist/{judge-calibration-N44V04Se.js → judge-calibration-BkXMIWA4.js} +3 -3
  165. package/dist/{judge-calibration-N44V04Se.js.map → judge-calibration-BkXMIWA4.js.map} +1 -1
  166. package/dist/{judge-gate-B1qYnkpi.js → judge-gate-Co5tuh57.js} +4 -27
  167. package/dist/judge-gate-Co5tuh57.js.map +1 -0
  168. package/dist/{judge-gate-DNcUrRFA.d.ts → judge-gate-DsL0yFcb.d.ts} +9 -10
  169. package/dist/judge-gate-DsL0yFcb.d.ts.map +1 -0
  170. package/dist/{kind-factory-CbZ-6tvu.js → kind-factory-Gy4fXixd.js} +88 -17
  171. package/dist/kind-factory-Gy4fXixd.js.map +1 -0
  172. package/dist/ledger-core/index.d.ts +2 -2
  173. package/dist/ledger-core/index.js +4 -4
  174. package/dist/{ledger-core-B2hahzrt.js → ledger-core-DrJhbms9.js} +5 -84
  175. package/dist/ledger-core-DrJhbms9.js.map +1 -0
  176. package/dist/{llm-client-DQveoxSM.js → llm-client-BshCREn6.js} +90 -219
  177. package/dist/llm-client-BshCREn6.js.map +1 -0
  178. package/dist/{llm-judge-PXV7Xljl.js → llm-judge-C8jMTNNG.js} +501 -931
  179. package/dist/llm-judge-C8jMTNNG.js.map +1 -0
  180. package/dist/matrix/index.d.ts +4 -4
  181. package/dist/matrix/index.js +3 -2
  182. package/dist/{matrix-_BV9-Lk5.js → matrix-B8l-Nsxd.js} +7 -96
  183. package/dist/matrix-B8l-Nsxd.js.map +1 -0
  184. package/dist/{matrix-CHMiebFx.d.ts → matrix-DHe-dwVJ.d.ts} +10 -19
  185. package/dist/matrix-DHe-dwVJ.d.ts.map +1 -0
  186. package/dist/{paired-tests-jbwPdSz5.js → mean-BbA_JCzW.js} +45 -5
  187. package/dist/mean-BbA_JCzW.js.map +1 -0
  188. package/dist/meta-eval/index.d.ts +6 -6
  189. package/dist/meta-eval/index.js +10 -10
  190. package/dist/meta-eval/index.js.map +1 -1
  191. package/dist/metrics-BKaPBtIG.js.map +1 -1
  192. package/dist/mint-BRZXuwRi.d.ts +81 -0
  193. package/dist/mint-BRZXuwRi.d.ts.map +1 -0
  194. package/dist/{mint-Csor1BLJ.js → mint-zszyYlpA.js} +4 -4
  195. package/dist/{mint-Csor1BLJ.js.map → mint-zszyYlpA.js.map} +1 -1
  196. package/dist/{multi-layer-verifier-BUaQ4C17.d.ts → multi-layer-verifier-DEgMUk6v.d.ts} +2 -2
  197. package/dist/{multi-layer-verifier-BUaQ4C17.d.ts.map → multi-layer-verifier-DEgMUk6v.d.ts.map} +1 -1
  198. package/dist/{multiplicity-D9cjmStq.js → multiplicity-Sg0U7h8j.js} +2 -2
  199. package/dist/{multiplicity-D9cjmStq.js.map → multiplicity-Sg0U7h8j.js.map} +1 -1
  200. package/dist/multishot/golden/index.d.ts +1 -23
  201. package/dist/multishot/golden/index.d.ts.map +1 -1
  202. package/dist/multishot/golden/index.js +5 -8
  203. package/dist/multishot/golden/index.js.map +1 -1
  204. package/dist/multishot/index.d.ts +3 -12
  205. package/dist/multishot/index.d.ts.map +1 -1
  206. package/dist/multishot/index.js +4 -3
  207. package/dist/multishot/index.js.map +1 -1
  208. package/dist/nonnegative-number-DvdMxg_f.js +9 -0
  209. package/dist/nonnegative-number-DvdMxg_f.js.map +1 -0
  210. package/dist/openapi.json +114 -10
  211. package/dist/{otel-spans-C8YIJWy1.js → otel-spans-CdN909k1.js} +3 -3
  212. package/dist/{otel-spans-C8YIJWy1.js.map → otel-spans-CdN909k1.js.map} +1 -1
  213. package/dist/{paired-arms-DzKn0TfY.js → paired-arms-Ct4LTKc1.js} +32 -9
  214. package/dist/paired-arms-Ct4LTKc1.js.map +1 -0
  215. package/dist/{paired-binary-Q36bhn2R.js → paired-binary-B_nejA44.js} +3 -36
  216. package/dist/paired-binary-B_nejA44.js.map +1 -0
  217. package/dist/{paired-promotion-decision-DPKz8ZnF.d.ts → paired-promotion-decision-CQMJ5xGN.d.ts} +2 -34
  218. package/dist/paired-promotion-decision-CQMJ5xGN.d.ts.map +1 -0
  219. package/dist/{paired-promotion-decision-BN6IQTiu.js → paired-promotion-decision-D0SHb-ZL.js} +3 -3
  220. package/dist/{paired-promotion-decision-BN6IQTiu.js.map → paired-promotion-decision-D0SHb-ZL.js.map} +1 -1
  221. package/dist/{search-kernel-BztlERLv.js → pareto-BzsxidFD.js} +883 -861
  222. package/dist/pareto-BzsxidFD.js.map +1 -0
  223. package/dist/pipelines/index.d.ts +16 -19
  224. package/dist/pipelines/index.d.ts.map +1 -1
  225. package/dist/pipelines/index.js +4 -68
  226. package/dist/pipelines/index.js.map +1 -1
  227. package/dist/{power-and-mde-fK5Qocwo.js → power-and-mde-N5nU4_Ly.js} +3 -3
  228. package/dist/{power-and-mde-fK5Qocwo.js.map → power-and-mde-N5nU4_Ly.js.map} +1 -1
  229. package/dist/predicate-FdKmElA_.js +38 -0
  230. package/dist/predicate-FdKmElA_.js.map +1 -0
  231. package/dist/{prime-protocol-DcAK9pC8.js → prime-protocol-BFgGrEMP.js} +3 -3
  232. package/dist/prime-protocol-BFgGrEMP.js.map +1 -0
  233. package/dist/{prime-protocol-CEE4BR9N.d.ts → prime-protocol-BWG2DQIk.d.ts} +4 -22
  234. package/dist/prime-protocol-BWG2DQIk.d.ts.map +1 -0
  235. package/dist/profile-cell.d.ts +2 -2
  236. package/dist/profile-cell.js +2 -2
  237. package/dist/{release-confidence-BK2QCB5M.d.ts → promotion-gate-DaY95yU6.d.ts} +105 -106
  238. package/dist/promotion-gate-DaY95yU6.d.ts.map +1 -0
  239. package/dist/{promotion-policy-CWW35UWq.js → promotion-policy-6A8osGr_.js} +4 -4
  240. package/dist/{promotion-policy-CWW35UWq.js.map → promotion-policy-6A8osGr_.js.map} +1 -1
  241. package/dist/{proposal-findings-BZiMTzAF.js → proposal-findings-BbWidvUk.js} +3 -3
  242. package/dist/proposal-findings-BbWidvUk.js.map +1 -0
  243. package/dist/{query-B1D1qp2Z.js → query-B_RZ36an.js} +5 -5
  244. package/dist/query-B_RZ36an.js.map +1 -0
  245. package/dist/{query-DK1nWcmp.d.ts → query-Cmv_U8vf.d.ts} +4 -24
  246. package/dist/{query-DK1nWcmp.d.ts.map → query-Cmv_U8vf.d.ts.map} +1 -1
  247. package/dist/{random-Dn5fPWkt.js → random-DDDcC7YU.js} +2 -2
  248. package/dist/{random-Dn5fPWkt.js.map → random-DDDcC7YU.js.map} +1 -1
  249. package/dist/{raw-provider-sink-rB2DYxr6.js → raw-provider-sink-75w4FWBj.js} +2 -2
  250. package/dist/{raw-provider-sink-rB2DYxr6.js.map → raw-provider-sink-75w4FWBj.js.map} +1 -1
  251. package/dist/{redact-Cveoq6fJ.d.ts → redact-DXdlFb_U.d.ts} +4 -21
  252. package/dist/redact-DXdlFb_U.d.ts.map +1 -0
  253. package/dist/{redact-Dk1ZdJEm.js → redact-mtkTiJVk.js} +92 -98
  254. package/dist/redact-mtkTiJVk.js.map +1 -0
  255. package/dist/{registry-JYfPxcVz.d.ts → registry-ssNoHzwD.d.ts} +5 -5
  256. package/dist/{registry-JYfPxcVz.d.ts.map → registry-ssNoHzwD.d.ts.map} +1 -1
  257. package/dist/{release-confidence-Dbe9AS_X.js → release-confidence-CYIFH-fp.js} +6 -11
  258. package/dist/release-confidence-CYIFH-fp.js.map +1 -0
  259. package/dist/{report-command-y8H6RSX8.js → render-C-w2EZ6p.js} +331 -554
  260. package/dist/render-C-w2EZ6p.js.map +1 -0
  261. package/dist/reporting-html-Kvlc8oMt.js +100 -0
  262. package/dist/reporting-html-Kvlc8oMt.js.map +1 -0
  263. package/dist/reporting.d.ts +6 -6
  264. package/dist/reporting.js +8 -8
  265. package/dist/{researcher-f6mZhh58.d.ts → researcher-0ABVIdGa.d.ts} +9 -9
  266. package/dist/{researcher-f6mZhh58.d.ts.map → researcher-0ABVIdGa.d.ts.map} +1 -1
  267. package/dist/reward-DrZ71vnf.d.ts +55 -0
  268. package/dist/reward-DrZ71vnf.d.ts.map +1 -0
  269. package/dist/{reward-hacking-BFcQgkux.js → reward-hacking-ByuETaIb.js} +3 -3
  270. package/dist/{reward-hacking-BFcQgkux.js.map → reward-hacking-ByuETaIb.js.map} +1 -1
  271. package/dist/{reward-hacking-DHA7c1l8.d.ts → reward-hacking-E52wq86n.d.ts} +5 -18
  272. package/dist/reward-hacking-E52wq86n.d.ts.map +1 -0
  273. package/dist/reward-nw2xZGZG.js.map +1 -1
  274. package/dist/rl.d.ts +117 -295
  275. package/dist/rl.d.ts.map +1 -1
  276. package/dist/rl.js +27 -747
  277. package/dist/rl.js.map +1 -1
  278. package/dist/rollout/index.d.ts +5 -4
  279. package/dist/rollout/index.js +7 -8
  280. package/dist/{rollout-D9bKKBnZ.js → rollout-D6C50mfA.js} +88 -13
  281. package/dist/rollout-D6C50mfA.js.map +1 -0
  282. package/dist/round-decimal-COrKglMh.js +10 -0
  283. package/dist/round-decimal-COrKglMh.js.map +1 -0
  284. package/dist/{rubric-predictive-validity-BsgkBfT0.js → rubric-predictive-validity-D3_oI72N.js} +3 -3
  285. package/dist/{rubric-predictive-validity-BsgkBfT0.js.map → rubric-predictive-validity-D3_oI72N.js.map} +1 -1
  286. package/dist/{rubric-predictive-validity-2SgHxoa5.d.ts → rubric-predictive-validity-DiwT8PbL.d.ts} +2 -2
  287. package/dist/{rubric-predictive-validity-2SgHxoa5.d.ts.map → rubric-predictive-validity-DiwT8PbL.d.ts.map} +1 -1
  288. package/dist/{run-record-D1Hw-Jml.d.ts → run-record-CaxbLq6Y.d.ts} +5 -11
  289. package/dist/run-record-CaxbLq6Y.d.ts.map +1 -0
  290. package/dist/{run-record-ES07wfz9.js → run-record-CysKLB93.js} +3 -5
  291. package/dist/run-record-CysKLB93.js.map +1 -0
  292. package/dist/{run-record-DlTZ_lqe.js → run-record-DhEJgoPz.js} +4 -4
  293. package/dist/{run-record-DlTZ_lqe.js.map → run-record-DhEJgoPz.js.map} +1 -1
  294. package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -1
  295. package/dist/{schema-CSf6qWgZ.js → schema-Bt2vLFm3.js} +2 -14
  296. package/dist/schema-Bt2vLFm3.js.map +1 -0
  297. package/dist/schema-C-ziyJD7.d.ts.map +1 -1
  298. package/dist/{schema-2g7trUwH.d.ts → schema-D6EVKzTB.d.ts} +4 -5
  299. package/dist/schema-D6EVKzTB.d.ts.map +1 -0
  300. package/dist/{schema-BuiujZ-g.js → schema-DxcKTzbi.js} +2 -2
  301. package/dist/schema-DxcKTzbi.js.map +1 -0
  302. package/dist/search/index.d.ts +39 -53
  303. package/dist/search/index.d.ts.map +1 -1
  304. package/dist/search/index.js +4 -4
  305. package/dist/{search-kernel-CpcKH5Ih.d.ts → search-kernel-DxqjBxA-.d.ts} +18 -31
  306. package/dist/search-kernel-DxqjBxA-.d.ts.map +1 -0
  307. package/dist/{search-ledger-d7V8o9Lk.js → search-ledger-TUvB5gWH.js} +189 -199
  308. package/dist/search-ledger-TUvB5gWH.js.map +1 -0
  309. package/dist/{search-ledger-file-BqOo-bVo.js → search-ledger-file-UKCO2r8a.js} +4 -4
  310. package/dist/search-ledger-file-UKCO2r8a.js.map +1 -0
  311. package/dist/search-ledger-types-p2xKfiDJ.d.ts.map +1 -1
  312. package/dist/{search-shipper-er4pK5_Y.js → search-shipper-Cw2z3-td.js} +4 -4
  313. package/dist/search-shipper-Cw2z3-td.js.map +1 -0
  314. package/dist/{search-summary-CBvz3u_S.js → search-summary-DQIvJsSB.js} +5 -5
  315. package/dist/{search-summary-CBvz3u_S.js.map → search-summary-DQIvJsSB.js.map} +1 -1
  316. package/dist/{sequential-CzK5DarL.js → sequential-BVv1sjsw.js} +2 -32
  317. package/dist/{sequential-CzK5DarL.js.map → sequential-BVv1sjsw.js.map} +1 -1
  318. package/dist/{sequential-D-1PPCmM.js → sequential-CimQrbjv.js} +5 -5
  319. package/dist/sequential-CimQrbjv.js.map +1 -0
  320. package/dist/{sequential-BhsrMupG.d.ts → sequential-KwGspfeR.d.ts} +2 -9
  321. package/dist/{sequential-BhsrMupG.d.ts.map → sequential-KwGspfeR.d.ts.map} +1 -1
  322. package/dist/{sequential-eprocess-D1jKoihe.js → sequential-eprocess-DodI6RoF.js} +2 -2
  323. package/dist/{sequential-eprocess-D1jKoihe.js.map → sequential-eprocess-DodI6RoF.js.map} +1 -1
  324. package/dist/{server-DbcC7xMl.js → server-DoVbqqtJ.js} +101 -101
  325. package/dist/server-DoVbqqtJ.js.map +1 -0
  326. package/dist/{single-run-lock-fVu3MZWH.js → single-run-lock-U58yf8N6.js} +2 -2
  327. package/dist/{single-run-lock-fVu3MZWH.js.map → single-run-lock-U58yf8N6.js.map} +1 -1
  328. package/dist/{skillopt-optimization-method-CCtzralq.js → skillopt-optimization-method-kyL94-ri.js} +428 -91
  329. package/dist/skillopt-optimization-method-kyL94-ri.js.map +1 -0
  330. package/dist/{spans-D9_ehFuk.d.ts → spans-CVngGij3.d.ts} +2 -2
  331. package/dist/{spans-D9_ehFuk.d.ts.map → spans-CVngGij3.d.ts.map} +1 -1
  332. package/dist/{statistical-heldout-1Gbmex7v.js → statistical-heldout-Bksv92Th.js} +3 -3
  333. package/dist/statistical-heldout-Bksv92Th.js.map +1 -0
  334. package/dist/{statistical-heldout-BeR4bOdg.d.ts → statistical-heldout-C9AbgREN.d.ts} +8 -67
  335. package/dist/statistical-heldout-C9AbgREN.d.ts.map +1 -0
  336. package/dist/{steps-Bg5-KVx1.d.ts → steps-DlepJPwD.d.ts} +2 -56
  337. package/dist/steps-DlepJPwD.d.ts.map +1 -0
  338. package/dist/{store-C4avFjIi.d.ts → store-B3nWRy3B.d.ts} +2 -2
  339. package/dist/{store-C4avFjIi.d.ts.map → store-B3nWRy3B.d.ts.map} +1 -1
  340. package/dist/{store-otlp-DtB4Slsr.js → store-otlp-BteDAbHK.js} +135 -132
  341. package/dist/store-otlp-BteDAbHK.js.map +1 -0
  342. package/dist/{store-tool-spans-fZIigrpP.js → store-tool-spans-D5l_OfTJ.js} +9 -9
  343. package/dist/store-tool-spans-D5l_OfTJ.js.map +1 -0
  344. package/dist/{store-tool-spans-DR1SrCLK.d.ts → store-tool-spans-DZS0HWVf.d.ts} +157 -165
  345. package/dist/store-tool-spans-DZS0HWVf.d.ts.map +1 -0
  346. package/dist/storyboard/index.d.ts +4 -11
  347. package/dist/storyboard/index.d.ts.map +1 -1
  348. package/dist/storyboard/index.js +21 -19
  349. package/dist/storyboard/index.js.map +1 -1
  350. package/dist/{summary-report-DtdRucM0.js → summary-report-BsXJoYX5.js} +588 -598
  351. package/dist/summary-report-BsXJoYX5.js.map +1 -0
  352. package/dist/{summary-report-C-CtItCN.d.ts → summary-report-DM7tlml1.d.ts} +16 -20
  353. package/dist/summary-report-DM7tlml1.d.ts.map +1 -0
  354. package/dist/supervisor-run/index.d.ts +189 -153
  355. package/dist/supervisor-run/index.d.ts.map +1 -1
  356. package/dist/supervisor-run/index.js +58 -450
  357. package/dist/supervisor-run/index.js.map +1 -1
  358. package/dist/{systemone-CpTLAlqb.d.ts → systemone-Bp_Ac0p1.d.ts} +6 -6
  359. package/dist/{systemone-CpTLAlqb.d.ts.map → systemone-Bp_Ac0p1.d.ts.map} +1 -1
  360. package/dist/systemone-protocol.js +1 -1
  361. package/dist/{systemone-review-B_yo1xsd.d.ts → systemone-review-CwE6JGIp.d.ts} +2 -2
  362. package/dist/{systemone-review-B_yo1xsd.d.ts.map → systemone-review-CwE6JGIp.d.ts.map} +1 -1
  363. package/dist/{systemone-review-BZWfrtq1.js → systemone-review-DzdOJ8I6.js} +3 -3
  364. package/dist/{systemone-review-BZWfrtq1.js.map → systemone-review-DzdOJ8I6.js.map} +1 -1
  365. package/dist/systemone.d.ts +5 -5
  366. package/dist/systemone.js +5 -5
  367. package/dist/systemone.js.map +1 -1
  368. package/dist/{task-failure-attributes-DngaLdE4.js → task-failure-attributes-BMsblaDh.js} +3 -3
  369. package/dist/task-failure-attributes-BMsblaDh.js.map +1 -0
  370. package/dist/{terminal-record-BHocwFw1.js → terminal-record-78g6E4vh.js} +17 -13
  371. package/dist/terminal-record-78g6E4vh.js.map +1 -0
  372. package/dist/{tool-groups-mcxOXVlb.d.ts → tool-groups-DyNz2JZ_.d.ts} +3 -3
  373. package/dist/tool-groups-DyNz2JZ_.d.ts.map +1 -0
  374. package/dist/{tool-waste-Wi4g6Ekb.d.ts → tool-waste-CkjzWmeY.d.ts} +53 -56
  375. package/dist/tool-waste-CkjzWmeY.d.ts.map +1 -0
  376. package/dist/{tool-waste-D52PqU9Q.js → tool-waste-DLsjS_p-.js} +5 -5
  377. package/dist/{tool-waste-D52PqU9Q.js.map → tool-waste-DLsjS_p-.js.map} +1 -1
  378. package/dist/{trace-questions-DG7nqLQ7.d.ts → trace-questions-xxwgsuMi.d.ts} +5 -10
  379. package/dist/{trace-questions-DG7nqLQ7.d.ts.map → trace-questions-xxwgsuMi.d.ts.map} +1 -1
  380. package/dist/trace-repair/index.d.ts +15 -212
  381. package/dist/trace-repair/index.d.ts.map +1 -1
  382. package/dist/trace-repair/index.js +865 -987
  383. package/dist/trace-repair/index.js.map +1 -1
  384. package/dist/traces.d.ts +76 -86
  385. package/dist/traces.d.ts.map +1 -1
  386. package/dist/traces.js +13 -13
  387. package/dist/traces.js.map +1 -1
  388. package/dist/trajectory-replay/index.d.ts +3 -117
  389. package/dist/trajectory-replay/index.d.ts.map +1 -1
  390. package/dist/trajectory-replay/index.js +98 -56
  391. package/dist/trajectory-replay/index.js.map +1 -1
  392. package/dist/{tree-rXLW3M_4.js → tree-BGRglkKd.js} +2355 -2414
  393. package/dist/tree-BGRglkKd.js.map +1 -0
  394. package/dist/{types-B3jzCp0p.js → types-BXgASBCL.js} +2 -2
  395. package/dist/{types-B3jzCp0p.js.map → types-BXgASBCL.js.map} +1 -1
  396. package/dist/{types-oKRhQAde.d.ts → types-CW8ewATZ.d.ts} +5 -114
  397. package/dist/types-CW8ewATZ.d.ts.map +1 -0
  398. package/dist/{types-BqkVmHfv.d.ts → types-CmXY0PQf.d.ts} +2 -4
  399. package/dist/types-CmXY0PQf.d.ts.map +1 -0
  400. package/dist/{types-DBZ7keha.d.ts → types-D-mgRzlh.d.ts} +9 -72
  401. package/dist/types-D-mgRzlh.d.ts.map +1 -0
  402. package/dist/{types-B4C5nFw6.d.ts → types-D8GhJoHk.d.ts} +79 -75
  403. package/dist/types-D8GhJoHk.d.ts.map +1 -0
  404. package/dist/{types-IXD2HJzu.js → types-DqFMNTgK.js} +2 -4
  405. package/dist/types-DqFMNTgK.js.map +1 -0
  406. package/dist/{types-CfZMIzB_.d.ts → types-DtMbFw6U.d.ts} +3 -3
  407. package/dist/{types-CfZMIzB_.d.ts.map → types-DtMbFw6U.d.ts.map} +1 -1
  408. package/dist/{verdict-DhPoXApk.js → verdict-BGQmxQ8A.js} +3 -3
  409. package/dist/verdict-BGQmxQ8A.js.map +1 -0
  410. package/dist/{verdict-E4eRNf7-.d.ts → verdict-C24NELtN.d.ts} +2 -15
  411. package/dist/{verdict-E4eRNf7-.d.ts.map → verdict-C24NELtN.d.ts.map} +1 -1
  412. package/dist/{verdict-cache-BQEsVy9n.js → verdict-cache-CL_7tePD.js} +2 -2
  413. package/dist/verdict-cache-CL_7tePD.js.map +1 -0
  414. package/dist/wire/index.d.ts +32 -411
  415. package/dist/wire/index.d.ts.map +1 -1
  416. package/dist/wire/index.js +2 -2
  417. package/docs/changes/jev-evidence-review.md +1 -1
  418. package/docs/changes/jev-product-adoption.md +1 -1
  419. package/docs/changes/jev-recorded-evidence.md +1 -1
  420. package/docs/design/mlbenchmarks-book-review.md +1 -1
  421. package/docs/design/mlbenchmarks-review/probes.mts +23 -31
  422. package/docs/design/statistics-decisions.md +17 -17
  423. package/docs/design.md +1 -1
  424. package/docs/evaluation-integrity.md +1 -1
  425. package/docs/experiment.md +1 -1
  426. package/docs/proofs/campaign-attempt-retention-20261001/README.md +2 -2
  427. package/docs/public-api.md +138 -529
  428. package/docs/rollout.md +1 -1
  429. package/docs/trace-repair-admission.md +1 -1
  430. package/docs/wire-protocol.md +1 -1
  431. package/package.json +1 -1
  432. package/dist/active-curriculum-B_Lc9kfO.js +0 -61
  433. package/dist/active-curriculum-B_Lc9kfO.js.map +0 -1
  434. package/dist/agent-profile-CIA2Atnt.d.ts.map +0 -1
  435. package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +0 -1
  436. package/dist/agent-profile-cell-BYc0bxsL.js.map +0 -1
  437. package/dist/agreement-irr-DsTURxdr.js.map +0 -1
  438. package/dist/analyze-runs-3xpby3p2.js.map +0 -1
  439. package/dist/analyze-runs-CSDAh8A7.d.ts.map +0 -1
  440. package/dist/ast-DJ6Bc7ab.js +0 -558
  441. package/dist/ast-DJ6Bc7ab.js.map +0 -1
  442. package/dist/ast-hI-vjW6J.d.ts +0 -457
  443. package/dist/ast-hI-vjW6J.d.ts.map +0 -1
  444. package/dist/baseline-Dm8966du.js +0 -259
  445. package/dist/baseline-Dm8966du.js.map +0 -1
  446. package/dist/benchmark-BywPeAUo.js +0 -562
  447. package/dist/benchmark-BywPeAUo.js.map +0 -1
  448. package/dist/benchmark-command-CByl9dxG.js.map +0 -1
  449. package/dist/campaign-BQ-Jujuj.js.map +0 -1
  450. package/dist/chat-json-call-BrKsyspg.js.map +0 -1
  451. package/dist/claim-BXcZw-jo.js.map +0 -1
  452. package/dist/claude-jsonl-dZir12m6.js +0 -86
  453. package/dist/claude-jsonl-dZir12m6.js.map +0 -1
  454. package/dist/client-BzL9niqi.d.ts.map +0 -1
  455. package/dist/cost-ledger-CO7UyEcQ.d.ts.map +0 -1
  456. package/dist/cost-ledger-D2FnJPBF.js.map +0 -1
  457. package/dist/counterfactual-CPaWN99-.d.ts +0 -60
  458. package/dist/counterfactual-CPaWN99-.d.ts.map +0 -1
  459. package/dist/counterfactual-DtMWvn7D.js +0 -98
  460. package/dist/counterfactual-DtMWvn7D.js.map +0 -1
  461. package/dist/default-registry-BrWh62zf.d.ts.map +0 -1
  462. package/dist/default-registry-Cn1LQ2Ve.js.map +0 -1
  463. package/dist/define-agent-eval-CEWkX5wZ.d.ts.map +0 -1
  464. package/dist/define-agent-eval-Ch3MWX6k.js.map +0 -1
  465. package/dist/dspy-rlm-engine-D-KX_e64.js.map +0 -1
  466. package/dist/effect-sizes-DiH8MGOH.js +0 -82
  467. package/dist/effect-sizes-DiH8MGOH.js.map +0 -1
  468. package/dist/emitter-HcCmFQl_.d.ts.map +0 -1
  469. package/dist/engine-C_zNWfM8.d.ts.map +0 -1
  470. package/dist/equal-terms-Blx9Zk5I.js.map +0 -1
  471. package/dist/evaluation-Cn2dRZIz.d.ts.map +0 -1
  472. package/dist/exporters-X4xwla8A.js.map +0 -1
  473. package/dist/external-optimizer-process-nnsY5D_4.js.map +0 -1
  474. package/dist/external-optimizer-subprocess-DcerlZSG.js.map +0 -1
  475. package/dist/failure-cluster-CbgEDcFJ.d.ts.map +0 -1
  476. package/dist/feedback-trajectory-DkaDj0dj.d.ts.map +0 -1
  477. package/dist/hf-dataset-BR2yhuNn.js.map +0 -1
  478. package/dist/index-CPJJr98o.d.ts.map +0 -1
  479. package/dist/index-Ch9VxCpK.d.ts.map +0 -1
  480. package/dist/index-DHKEAv3s.d.ts.map +0 -1
  481. package/dist/index-DlH0Y9gI.d.ts.map +0 -1
  482. package/dist/index-NvGBiO8H.d.ts.map +0 -1
  483. package/dist/integrity-BV1ZDf42.js.map +0 -1
  484. package/dist/journal-DvKCvjty.js.map +0 -1
  485. package/dist/judge-gate-B1qYnkpi.js.map +0 -1
  486. package/dist/judge-gate-DNcUrRFA.d.ts.map +0 -1
  487. package/dist/kind-factory-CbZ-6tvu.js.map +0 -1
  488. package/dist/ledger-core-B2hahzrt.js.map +0 -1
  489. package/dist/llm-client-DQveoxSM.js.map +0 -1
  490. package/dist/llm-judge-PXV7Xljl.js.map +0 -1
  491. package/dist/matrix-CHMiebFx.d.ts.map +0 -1
  492. package/dist/matrix-_BV9-Lk5.js.map +0 -1
  493. package/dist/mint-DCGoBYhB.d.ts +0 -155
  494. package/dist/mint-DCGoBYhB.d.ts.map +0 -1
  495. package/dist/normal-DsJZtrJc.js +0 -25
  496. package/dist/normal-DsJZtrJc.js.map +0 -1
  497. package/dist/paired-arms-DzKn0TfY.js.map +0 -1
  498. package/dist/paired-binary-Q36bhn2R.js.map +0 -1
  499. package/dist/paired-promotion-decision-DPKz8ZnF.d.ts.map +0 -1
  500. package/dist/paired-tests-jbwPdSz5.js.map +0 -1
  501. package/dist/prime-protocol-CEE4BR9N.d.ts.map +0 -1
  502. package/dist/prime-protocol-DcAK9pC8.js.map +0 -1
  503. package/dist/produced-state-ZCtDBxAE.js.map +0 -1
  504. package/dist/proposal-findings-BZiMTzAF.js.map +0 -1
  505. package/dist/query-B1D1qp2Z.js.map +0 -1
  506. package/dist/redact-Cveoq6fJ.d.ts.map +0 -1
  507. package/dist/redact-Dk1ZdJEm.js.map +0 -1
  508. package/dist/release-confidence-BK2QCB5M.d.ts.map +0 -1
  509. package/dist/release-confidence-Dbe9AS_X.js.map +0 -1
  510. package/dist/report-command-y8H6RSX8.js.map +0 -1
  511. package/dist/reward-hacking-DHA7c1l8.d.ts.map +0 -1
  512. package/dist/rollout-D9bKKBnZ.js.map +0 -1
  513. package/dist/run-record-D1Hw-Jml.d.ts.map +0 -1
  514. package/dist/run-record-ES07wfz9.js.map +0 -1
  515. package/dist/schema-2g7trUwH.d.ts.map +0 -1
  516. package/dist/schema-BuiujZ-g.js.map +0 -1
  517. package/dist/schema-CSf6qWgZ.js.map +0 -1
  518. package/dist/search-kernel-BztlERLv.js.map +0 -1
  519. package/dist/search-kernel-CpcKH5Ih.d.ts.map +0 -1
  520. package/dist/search-ledger-d7V8o9Lk.js.map +0 -1
  521. package/dist/search-ledger-file-BqOo-bVo.js.map +0 -1
  522. package/dist/search-shipper-er4pK5_Y.js.map +0 -1
  523. package/dist/semantic-concept-judge-zQBG9hHU.js.map +0 -1
  524. package/dist/sequential-D-1PPCmM.js.map +0 -1
  525. package/dist/server-DbcC7xMl.js.map +0 -1
  526. package/dist/skillopt-optimization-method-CCtzralq.js.map +0 -1
  527. package/dist/statistical-heldout-1Gbmex7v.js.map +0 -1
  528. package/dist/statistical-heldout-BeR4bOdg.d.ts.map +0 -1
  529. package/dist/steps-Bg5-KVx1.d.ts.map +0 -1
  530. package/dist/store-otlp-DtB4Slsr.js.map +0 -1
  531. package/dist/store-tool-spans-DR1SrCLK.d.ts.map +0 -1
  532. package/dist/store-tool-spans-fZIigrpP.js.map +0 -1
  533. package/dist/student-t-BQeKJx2N.js +0 -39
  534. package/dist/student-t-BQeKJx2N.js.map +0 -1
  535. package/dist/summary-report-C-CtItCN.d.ts.map +0 -1
  536. package/dist/summary-report-DtdRucM0.js.map +0 -1
  537. package/dist/task-failure-attributes-DngaLdE4.js.map +0 -1
  538. package/dist/terminal-record-BHocwFw1.js.map +0 -1
  539. package/dist/tool-groups-mcxOXVlb.d.ts.map +0 -1
  540. package/dist/tool-waste-Wi4g6Ekb.d.ts.map +0 -1
  541. package/dist/trajectory-Y1fmdlw7.d.ts +0 -24
  542. package/dist/trajectory-Y1fmdlw7.d.ts.map +0 -1
  543. package/dist/tree-rXLW3M_4.js.map +0 -1
  544. package/dist/types-B4C5nFw6.d.ts.map +0 -1
  545. package/dist/types-BqkVmHfv.d.ts.map +0 -1
  546. package/dist/types-DBZ7keha.d.ts.map +0 -1
  547. package/dist/types-IXD2HJzu.js.map +0 -1
  548. package/dist/types-oKRhQAde.d.ts.map +0 -1
  549. package/dist/usage-receipt-Cx3xNeyB.js +0 -76
  550. package/dist/usage-receipt-Cx3xNeyB.js.map +0 -1
  551. package/dist/verdict-DhPoXApk.js.map +0 -1
  552. package/dist/verdict-cache-BQEsVy9n.js.map +0 -1
  553. package/docs/design/self-improvement-evidence-audit.md +0 -263
@@ -1,443 +1,225 @@
1
- import { i as pairedCohensDz } from "./effect-sizes-DiH8MGOH.js";
2
- import { r as welchsTTest } from "./baseline-Dm8966du.js";
3
- import { a as spearmanR, r as pearsonR } from "./descriptive-CnU8Yq29.js";
4
- import { r as continuousAgreement } from "./judge-calibration-N44V04Se.js";
5
- import { o as pairedTTest, r as pairedBootstrap } from "./paired-tests-jbwPdSz5.js";
6
- import { i as requiredPairedSampleSize, r as pairedMde } from "./power-and-mde-fK5Qocwo.js";
7
- import { r as pairRunRecords } from "./paired-arms-DzKn0TfY.js";
8
- import { n as aggregatePairedHoldout } from "./statistical-heldout-1Gbmex7v.js";
9
- import "./query-B1D1qp2Z.js";
1
+ import { s as ValidationError } from "./errors-BcOs5MKW.js";
10
2
  import { r as observedSplitScore } from "./reward-nw2xZGZG.js";
11
- import { c as validateRunRecord } from "./run-record-DlTZ_lqe.js";
12
- import { r as paretoChart } from "./summary-report-DtdRucM0.js";
13
- //#region src/contamination-guard.ts
14
- function checkCanaries(output, scenarios) {
15
- const leaks = [];
16
- for (const s of scenarios) {
17
- if (!s.canary) continue;
18
- if (output.includes(s.canary)) leaks.push({
19
- scenarioId: s.id,
20
- canary: s.canary,
21
- evidence: excerpt(output, s.canary)
22
- });
23
- }
24
- return leaks;
3
+ import { c as validateRunRecord } from "./run-record-DhEJgoPz.js";
4
+ import { c as pairedCohensDz, o as cohensD, r as paretoChart } from "./summary-report-BsXJoYX5.js";
5
+ import { t as interpolatedQuantile } from "./quantile--0yb07pD.js";
6
+ import { c as lnGamma, l as regularizedIncompleteBeta, t as assertFiniteSample$1 } from "./internal-BTK91Bqt.js";
7
+ import { a as spearmanR, r as pearsonR } from "./descriptive-CVNy48rR.js";
8
+ import { r as continuousAgreement } from "./judge-calibration-BkXMIWA4.js";
9
+ import { o as normalCdf, r as pairRunRecords } from "./paired-arms-Ct4LTKc1.js";
10
+ import { i as pairedBootstrap, l as studentTQuantile, s as pairedTTest, t as mean$1 } from "./mean-BbA_JCzW.js";
11
+ import { i as requiredPairedSampleSize, r as pairedMde } from "./power-and-mde-N5nU4_Ly.js";
12
+ import { n as aggregatePairedHoldout } from "./statistical-heldout-Bksv92Th.js";
13
+ import "./query-B_RZ36an.js";
14
+ //#region src/statistics/inference.ts
15
+ /** Two-sided normal tail, evaluated without subtracting a near-one CDF. */
16
+ function normalTwoSidedPValue(z) {
17
+ if (Number.isNaN(z)) throw new ValidationError("normalTwoSidedPValue: z must not be NaN");
18
+ return Math.min(1, 2 * normalCdf(-Math.abs(z)));
25
19
  }
26
- function excerpt(source, needle) {
27
- const at = source.indexOf(needle);
28
- if (at < 0) return "";
29
- const start = Math.max(0, at - 30);
30
- const end = Math.min(source.length, at + needle.length + 30);
31
- return (start > 0 ? "…" : "") + source.slice(start, end) + (end < source.length ? "…" : "");
20
+ /** Two-sided Student-t tail, preserving small tail probabilities. */
21
+ function studentTTwoSidedPValue(t, df) {
22
+ if (Number.isNaN(t) || !Number.isFinite(df) || df <= 0) throw new ValidationError("studentTTwoSidedPValue: t must not be NaN and df must be positive and finite");
23
+ return regularizedIncompleteBeta(df / (df + t * t), df / 2, .5);
32
24
  }
33
- //#endregion
34
- //#region src/contract/analyze-runs.ts
35
- /** Summarize runtime facts without interpreting task quality or promotion readiness. */
36
- function summarizeExecution(opts) {
37
- const runs = opts.runs.map(validateRunRecord);
38
- return {
39
- execution: computeExecutionInsight(runs, opts.histogramBins ?? 12),
40
- costProvenance: summarizeCostProvenance(runs)
41
- };
25
+ function table(a, b, c, d) {
26
+ if (![
27
+ a,
28
+ b,
29
+ c,
30
+ d
31
+ ].every((value) => Number.isSafeInteger(value) && value >= 0) || !Number.isSafeInteger(a + b + c + d)) throw new ValidationError("contingency table: counts and total must be nonnegative safe integers");
32
+ return a + b + c + d;
42
33
  }
43
- /** A bootstrap interval with no spread: every resample landed on the same
44
- * value, so the interval carries no information about how far the point
45
- * estimate could be wrong and cannot support a directional claim. */
46
- function zeroWidth(ci) {
47
- return !Number.isFinite(ci[0]) || !Number.isFinite(ci[1]) || ci[0] === ci[1];
34
+ /** Pearson statistic for a 2x2 table; empty or fixed margins have statistic zero. */
35
+ function chiSquared(a, b, c, d) {
36
+ const n = table(a, b, c, d);
37
+ if (!n) return 0;
38
+ const expected = [
39
+ (a + b) * (a + c) / n,
40
+ (a + b) * (b + d) / n,
41
+ (c + d) * (a + c) / n,
42
+ (c + d) * (b + d) / n
43
+ ];
44
+ if (expected.some((value) => value === 0)) return 0;
45
+ return [
46
+ a,
47
+ b,
48
+ c,
49
+ d
50
+ ].reduce((sum, value, i) => sum + (value - expected[i]) ** 2 / expected[i], 0);
48
51
  }
49
- async function analyzeRuns(opts) {
50
- const runs = opts.runs.map(validateRunRecord);
51
- const bins = opts.histogramBins ?? 12;
52
- const threshold = opts.decisionThreshold ?? .02;
53
- if (!Number.isFinite(threshold)) throw new Error(`analyzeRuns: decisionThreshold must be finite, got ${threshold}`);
54
- const split = resolveSplit(runs, opts.split ?? "auto");
55
- const compositeWithIds = runs.map((r) => ({
56
- runId: r.runId,
57
- score: compositeOf(r, split)
58
- })).filter((p) => Number.isFinite(p.score));
59
- const composite = distributionOf(compositeWithIds.map((p) => p.score), bins, compositeWithIds);
60
- const perDimension = computePerDimension(runs, bins);
61
- const { execution, costProvenance: provenance } = summarizeExecution({
62
- runs,
63
- histogramBins: bins
64
- });
65
- const knownCostRuns = runs.filter((run) => run.costProvenance.usd !== null);
66
- const costs = knownCostRuns.map((r) => r.costUsd).filter(isFiniteNumber);
67
- const costDist = distributionOf(costs, bins);
68
- const pareto = paretoChart(knownCostRuns, { split });
69
- const degraded = {};
70
- if (provenance.uncaptured.n + provenance.lowerBound.n > 0) degraded.cost = diagnoseCostCoverage(runs, provenance);
71
- else if (costs.length === 0 || costs.every((c) => c === 0)) degraded.cost = `all ${runs.length} explicitly observed or estimated USD values are $0`;
72
- if (pareto.points.length < 2) degraded.pareto = pareto.points.length === 0 ? "no candidates — Pareto unavailable" : "single candidate — Pareto is a single point, not a frontier";
73
- const costQuality = {
74
- cost: costDist,
75
- pareto,
76
- provenance,
77
- ...degraded.cost || degraded.pareto ? { degraded } : {}
52
+ /** One-degree-of-freedom chi-squared survival probability. */
53
+ function chiSquaredPValue(statistic) {
54
+ if (Number.isNaN(statistic) || statistic < 0) throw new ValidationError("chiSquaredPValue: statistic must be nonnegative and not NaN");
55
+ return normalTwoSidedPValue(Math.sqrt(statistic));
56
+ }
57
+ /** Fisher two-sided probability: sum all fixed-margin tables no likelier than the observed table. */
58
+ function fisherExactTwoSided(a, b, c, d) {
59
+ const n = table(a, b, c, d), row1 = a + b, row2 = c + d, col1 = a + c;
60
+ if (!n || !row1 || !row2 || !col1 || col1 === n) return 1;
61
+ const logChoose = (total, count) => lnGamma(total + 1) - lnGamma(count + 1) - lnGamma(total - count + 1);
62
+ const denominator = logChoose(n, col1);
63
+ const logP = (count) => logChoose(row1, count) + logChoose(row2, col1 - count) - denominator;
64
+ const threshold = logP(a) + 1e-7;
65
+ let p = 0;
66
+ for (let k = Math.max(0, col1 - row2); k <= Math.min(row1, col1); k++) {
67
+ const probability = logP(k);
68
+ if (probability <= threshold) p += Math.exp(probability);
69
+ }
70
+ return Math.min(1, p);
71
+ }
72
+ /** Fisher when any expected count is below five; otherwise Pearson's chi-squared tail. */
73
+ function twoByTwoPValue(a, b, c, d) {
74
+ const n = table(a, b, c, d);
75
+ if (!n) return 1;
76
+ return Math.min((a + b) * (a + c), (a + b) * (b + d), (c + d) * (a + c), (c + d) * (b + d)) / n < 5 ? fisherExactTwoSided(a, b, c, d) : chiSquaredPValue(chiSquared(a, b, c, d));
77
+ }
78
+ /** Centered least-squares slope; null p-value means no slope test was possible. */
79
+ function linearRegressionSlope(points) {
80
+ assertFiniteSample$1("linearRegressionSlope", "x", points.map((point) => point.x));
81
+ assertFiniteSample$1("linearRegressionSlope", "y", points.map((point) => point.y));
82
+ if (points.length < 2) return {
83
+ slope: 0,
84
+ rSquared: 0,
85
+ slopePValue: null
78
86
  };
79
- const judges = computeJudgeInsights(runs);
80
- const interRater = opts.raterScores ? computeInterRater(opts.raterScores) : void 0;
81
- const lift = computeLift(runs, opts.baselineCandidateId, opts.candidateCandidateId, split, opts.independentUnitByScenarioId);
82
- const failureClusters = opts.analyst ? await computeFailureClusters(runs, opts.analyst, split) : void 0;
83
- const failureClasses = computeFailureClasses(runs, split);
84
- const contamination = opts.canaryScenarios ? computeContamination(runs, opts.canaryScenarios) : void 0;
85
- const outcomeCorrelation = opts.outcomeSignal ? computeOutcomeCorrelation(runs, opts.outcomeSignal, split) : void 0;
86
- const release = buildReleaseScorecard(composite, lift, contamination);
87
- const priorPeriodComparison = opts.baselineRuns ? computePriorPeriodComparison(runs, opts.baselineRuns, split, opts.baselineLabel) : void 0;
88
- const recommendations = buildRecommendations({
89
- composite,
90
- judges,
91
- interRater,
92
- lift,
93
- failureClusters,
94
- failureClasses,
95
- contamination,
96
- outcomeCorrelation,
97
- priorPeriodComparison,
98
- threshold
99
- });
87
+ const n = points.length;
88
+ const meanX = points.reduce((sum, point) => sum + point.x / n, 0);
89
+ const meanY = points.reduce((sum, point) => sum + point.y / n, 0);
90
+ const sxx = points.reduce((sum, point) => sum + (point.x - meanX) ** 2, 0);
91
+ const syy = points.reduce((sum, point) => sum + (point.y - meanY) ** 2, 0);
92
+ const sxy = points.reduce((sum, point) => sum + (point.x - meanX) * (point.y - meanY), 0);
93
+ if (!sxx) return {
94
+ slope: 0,
95
+ rSquared: 0,
96
+ slopePValue: null
97
+ };
98
+ const slope = sxy / sxx;
99
+ const residual = points.reduce((sum, point) => sum + (point.y - meanY - slope * (point.x - meanX)) ** 2, 0);
100
+ if (![
101
+ slope,
102
+ residual,
103
+ sxx,
104
+ sxy,
105
+ syy
106
+ ].every(Number.isFinite)) throw new ValidationError("linearRegressionSlope: sample arithmetic exceeded finite range");
100
107
  return {
101
- n: runs.length,
102
- execution,
103
- composite,
104
- perDimension,
105
- costQuality,
106
- judges,
107
- interRater,
108
- lift,
109
- failureClusters,
110
- contamination,
111
- outcomeCorrelation,
112
- release,
113
- ...failureClasses ? { failureClasses } : {},
114
- ...priorPeriodComparison ? { priorPeriodComparison } : {},
115
- recommendations
108
+ slope,
109
+ rSquared: syy === 0 ? 0 : Math.max(0, 1 - residual / syy),
110
+ slopePValue: n < 3 ? null : residual === 0 ? slope === 0 ? 1 : 0 : studentTTwoSidedPValue(slope / Math.sqrt(residual / (n - 2) / sxx), n - 2)
116
111
  };
117
112
  }
118
- function computeExecutionInsight(runs, bins) {
119
- const aggregateRows = runs.flatMap((run) => {
120
- const usage = aggregateTokenUsage(run);
121
- return usage ? [{
122
- usage,
123
- costUsd: finiteRaw(run, "aggregate_cost_usd")
124
- }] : [];
125
- });
126
- const aggregateCosts = aggregateRows.flatMap((row) => row.costUsd !== void 0 ? [row.costUsd] : []);
127
- const modelCounts = /* @__PURE__ */ new Map();
128
- let executionErrorRuns = 0;
129
- let executionErrorEvents = 0;
130
- let errorReportingRuns = 0;
131
- let errorSpanEvents = 0;
132
- let errorSpanReportingRuns = 0;
133
- const terminalOutcomes = {
134
- succeeded: 0,
135
- failed: 0,
136
- cancelled: 0,
137
- incomplete: 0,
138
- unknown: 0
113
+ //#endregion
114
+ //#region src/baseline.ts
115
+ /**
116
+ * Baseline regression detection.
117
+ *
118
+ * Lifted from ADC baseline.ts. Every promotion-blocking signal boils down
119
+ * to: "is this run measurably worse than baseline?" — with enough
120
+ * statistical rigor to distinguish noise from drift.
121
+ *
122
+ * Uses:
123
+ * - Welch's t-test (unequal variance) for per-metric mean comparison
124
+ * - Cohen's d for effect size magnitude
125
+ * - IQR for stability flag (unstable samples can't be trusted for comparisons)
126
+ *
127
+ * Returns a structured verdict: improved | regressed | stable | unstable.
128
+ */
129
+ function mean(xs) {
130
+ return xs.length ? xs.reduce((sum, value) => sum + value / xs.length, 0) : NaN;
131
+ }
132
+ /** Inter-quartile range; 0 when the sample has no spread. */
133
+ function iqr(xs) {
134
+ if (xs.length === 0) return 0;
135
+ const sorted = [...xs].sort((a, b) => a - b);
136
+ return interpolatedQuantile(sorted, .75) - interpolatedQuantile(sorted, .25);
137
+ }
138
+ /**
139
+ * Welch's t-test and 95% interval for two independent samples.
140
+ *
141
+ * Uses the Student-t distribution at every finite degree of freedom. Fewer
142
+ * than two observations per side and zero observed standard error cannot
143
+ * define a t reference distribution; those cases return an explicit status,
144
+ * `NaN` inferential fields, and no interval rather than fabricated certainty.
145
+ */
146
+ function welchsTTest(a, b) {
147
+ assertFiniteSample("a", a);
148
+ assertFiniteSample("b", b);
149
+ const mA = mean(a);
150
+ const mB = mean(b);
151
+ const delta = mB - mA;
152
+ if (a.length && !Number.isFinite(mA) || b.length && !Number.isFinite(mB) || a.length && b.length && !Number.isFinite(delta)) throw new RangeError("welchsTTest: sample arithmetic exceeded finite range");
153
+ if (a.length < 2 || b.length < 2) return {
154
+ status: "insufficient-sample",
155
+ meanA: mA,
156
+ meanB: mB,
157
+ delta,
158
+ standardError: NaN,
159
+ t: NaN,
160
+ df: NaN,
161
+ p: NaN,
162
+ ci95: null,
163
+ cohensD: null
139
164
  };
140
- const errorsByTerminalOutcome = {
141
- succeeded: {
142
- withErrors: 0,
143
- withoutErrors: 0,
144
- unreported: 0
145
- },
146
- failed: {
147
- withErrors: 0,
148
- withoutErrors: 0,
149
- unreported: 0
150
- },
151
- cancelled: {
152
- withErrors: 0,
153
- withoutErrors: 0,
154
- unreported: 0
155
- },
156
- incomplete: {
157
- withErrors: 0,
158
- withoutErrors: 0,
159
- unreported: 0
160
- },
161
- unknown: {
162
- withErrors: 0,
163
- withoutErrors: 0,
164
- unreported: 0
165
- }
165
+ const vA = variance(a, mA);
166
+ const vB = variance(b, mB);
167
+ const seSquared = vA / a.length + vB / b.length;
168
+ if (!Number.isFinite(seSquared)) throw new RangeError("welchsTTest: sample arithmetic exceeded finite range");
169
+ const d = cohensD(a, b);
170
+ if (seSquared === 0) return {
171
+ status: "zero-variance",
172
+ meanA: mA,
173
+ meanB: mB,
174
+ delta,
175
+ standardError: 0,
176
+ t: delta === 0 ? 0 : Math.sign(delta) * Number.POSITIVE_INFINITY,
177
+ df: NaN,
178
+ p: NaN,
179
+ ci95: null,
180
+ cohensD: null
166
181
  };
167
- let modelCallRuns = 0;
168
- let modelCallEvents = 0;
169
- let modelCallReportingRuns = 0;
170
- for (const run of runs) {
171
- modelCounts.set(run.model, (modelCounts.get(run.model) ?? 0) + 1);
172
- const terminalOutcome = run.terminalOutcome;
173
- terminalOutcomes[terminalOutcome] += 1;
174
- const modelCalls = nonNegativeCountRaw(run, "llm_span_count");
175
- if (modelCalls !== void 0) {
176
- modelCallEvents += modelCalls;
177
- modelCallReportingRuns += 1;
178
- }
179
- const usage = run.tokenUsage;
180
- if ((modelCalls ?? 0) > 0 || usage.input > 0 || usage.output > 0 || (usage.cached ?? 0) > 0 || (usage.cacheWrite ?? 0) > 0) modelCallRuns += 1;
181
- const errorEvents = reportedExecutionErrorEvents(run);
182
- if (errorEvents !== void 0) {
183
- executionErrorEvents += errorEvents;
184
- errorReportingRuns += 1;
185
- if (errorEvents > 0) {
186
- executionErrorRuns += 1;
187
- errorsByTerminalOutcome[terminalOutcome].withErrors += 1;
188
- } else errorsByTerminalOutcome[terminalOutcome].withoutErrors += 1;
189
- } else errorsByTerminalOutcome[terminalOutcome].unreported += 1;
190
- const reportedErrorSpans = nonNegativeCountRaw(run, "error_span_count");
191
- if (reportedErrorSpans !== void 0) {
192
- errorSpanEvents += reportedErrorSpans;
193
- errorSpanReportingRuns += 1;
194
- }
195
- }
182
+ const standardError = Math.sqrt(seSquared);
183
+ const t = delta / standardError;
184
+ const fractionA = vA / a.length / seSquared;
185
+ const fractionB = vB / b.length / seSquared;
186
+ const df = 1 / (fractionA ** 2 / (a.length - 1) + fractionB ** 2 / (b.length - 1));
187
+ const p = studentTTwoSidedPValue(t, df);
188
+ if (d === null) throw new Error("welchsTTest: non-zero standard error produced no pooled effect size");
189
+ const halfWidth = studentTQuantile(.975, df) * standardError;
190
+ if (![
191
+ df,
192
+ d,
193
+ halfWidth,
194
+ delta - halfWidth,
195
+ delta + halfWidth
196
+ ].every(Number.isFinite)) throw new RangeError("welchsTTest: sample arithmetic exceeded finite range");
196
197
  return {
197
- durationMs: distributionOf(runs.map((run) => run.wallMs), bins),
198
- queueMs: distributionOf(runs.filter((run) => run.queueMs !== void 0).map((run) => run.queueMs), bins),
199
- tokenUsage: summarizeTokenUsage(runs.map((run) => run.tokenUsage), bins),
200
- aggregateUsage: {
201
- runs: aggregateRows.length,
202
- tokenUsage: summarizeTokenUsage(aggregateRows.map((row) => row.usage), bins),
203
- costUsd: distributionOf(aggregateCosts, bins),
204
- totalCostUsd: aggregateCosts.reduce((total, value) => total + value, 0)
205
- },
206
- models: [...modelCounts.entries()].map(([model, count]) => ({
207
- model,
208
- runs: count
209
- })).sort((left, right) => right.runs - left.runs || left.model.localeCompare(right.model)),
210
- modelCalls: {
211
- runs: modelCallRuns,
212
- events: modelCallEvents,
213
- reportingRuns: modelCallReportingRuns
214
- },
215
- executionErrors: {
216
- runs: executionErrorRuns,
217
- fraction: errorReportingRuns > 0 ? executionErrorRuns / errorReportingRuns : null,
218
- events: executionErrorEvents,
219
- reportingRuns: errorReportingRuns,
220
- errorSpanEvents,
221
- errorSpanReportingRuns,
222
- byTerminalOutcome: errorsByTerminalOutcome
223
- },
224
- terminalOutcomes
198
+ status: "ok",
199
+ meanA: mA,
200
+ meanB: mB,
201
+ delta,
202
+ standardError,
203
+ t,
204
+ df,
205
+ p,
206
+ ci95: [delta - halfWidth, delta + halfWidth],
207
+ cohensD: d
225
208
  };
226
209
  }
227
- function reportedExecutionErrorEvents(run) {
228
- return nonNegativeCountRaw(run, "execution_error_count");
210
+ function variance(xs, m) {
211
+ return xs.reduce((acc, x) => acc + (x - m) ** 2, 0) / (xs.length - 1);
229
212
  }
230
- function nonNegativeCountRaw(run, key) {
231
- const value = finiteRaw(run, key);
232
- return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
213
+ function assertFiniteSample(name, sample) {
214
+ const invalid = sample.find((value) => !Number.isFinite(value));
215
+ if (invalid !== void 0) throw new RangeError(`welchsTTest: sample ${name} must contain only finite values, got ${invalid}`);
233
216
  }
234
- function summarizeTokenUsage(usages, bins) {
235
- const reasoning = usages.flatMap((usage) => usage.reasoning !== void 0 ? [usage.reasoning] : []);
236
- const cached = usages.flatMap((usage) => usage.cached !== void 0 ? [usage.cached] : []);
237
- const cacheWrite = usages.flatMap((usage) => usage.cacheWrite !== void 0 ? [usage.cacheWrite] : []);
238
- return {
239
- input: distributionOf(usages.map((usage) => usage.input), bins),
240
- output: distributionOf(usages.map((usage) => usage.output), bins),
241
- reasoning: distributionOf(reasoning, bins),
242
- cached: distributionOf(cached, bins),
243
- cacheWrite: distributionOf(cacheWrite, bins),
244
- totals: {
245
- input: usages.reduce((total, usage) => total + usage.input, 0),
246
- output: usages.reduce((total, usage) => total + usage.output, 0),
247
- reasoning: reasoning.reduce((total, value) => total + value, 0),
248
- cached: cached.reduce((total, value) => total + value, 0),
249
- cacheWrite: cacheWrite.reduce((total, value) => total + value, 0)
250
- }
251
- };
252
- }
253
- function aggregateTokenUsage(run) {
254
- const input = finiteRaw(run, "aggregate_prompt_tokens");
255
- const output = finiteRaw(run, "aggregate_completion_tokens");
256
- const reasoning = finiteRaw(run, "aggregate_reasoning_tokens");
257
- const cached = finiteRaw(run, "aggregate_cached_tokens");
258
- const cacheWrite = finiteRaw(run, "aggregate_cache_write_tokens");
259
- if (input === void 0 && output === void 0 && reasoning === void 0 && cached === void 0 && cacheWrite === void 0) return void 0;
260
- return {
261
- input: input ?? 0,
262
- output: output ?? 0,
263
- ...reasoning !== void 0 ? { reasoning } : {},
264
- ...cached !== void 0 ? { cached } : {},
265
- ...cacheWrite !== void 0 ? { cacheWrite } : {}
266
- };
267
- }
268
- function finiteRaw(run, key) {
269
- const value = run.outcome.raw[key];
270
- return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
271
- }
272
- function summarizeCostProvenance(runs) {
273
- const summary = {
274
- observed: {
275
- n: 0,
276
- totalUsd: 0
277
- },
278
- estimated: {
279
- n: 0,
280
- totalUsd: 0
281
- },
282
- lowerBound: {
283
- n: 0,
284
- floorUsd: 0
285
- },
286
- uncaptured: { n: 0 },
287
- knownFraction: 0
288
- };
289
- for (const run of runs) {
290
- const cost = run.costProvenance;
291
- if (cost.kind === "uncaptured") summary.uncaptured.n += 1;
292
- else if (cost.kind === "lower-bound") {
293
- summary.lowerBound.n += 1;
294
- summary.lowerBound.floorUsd += cost.knownLowerBoundUsd;
295
- } else {
296
- summary[cost.kind].n += 1;
297
- summary[cost.kind].totalUsd += cost.usd;
298
- }
299
- }
300
- const known = summary.observed.n + summary.estimated.n;
301
- summary.knownFraction = runs.length > 0 ? known / runs.length : 0;
302
- return summary;
303
- }
304
- function diagnoseCostCoverage(runs, provenance) {
305
- const unknown = provenance.uncaptured.n + provenance.lowerBound.n;
306
- const known = provenance.observed.n + provenance.estimated.n;
307
- const floor = provenance.lowerBound.n > 0 ? ` (${provenance.lowerBound.n} of them cost at least $${provenance.lowerBound.floorUsd.toFixed(6)} together)` : "";
308
- if (unknown === runs.length) return `USD cost total unknown for all ${runs.length} runs${floor} — no observed or estimated USD values; token and wall-time metrics remain available.`;
309
- return `USD cost total unknown for ${unknown}/${runs.length} runs${floor}; excluded those rows from cost statistics (${known}/${runs.length} retained: ${provenance.observed.n} observed, ${provenance.estimated.n} estimated).`;
310
- }
311
- /**
312
- * Model-free task-failure tally.
313
- *
314
- * Explicit non-success classes are task-failure evidence.
315
- * A low task score without a class is counted as `unknown`.
316
- */
317
- function computeFailureClasses(runs, split) {
318
- const counts = /* @__PURE__ */ new Map();
319
- for (const r of runs) {
320
- if (!isTaskFailure(r, split)) continue;
321
- const key = r.failureClass !== void 0 && r.failureClass !== "success" ? r.failureClass : "unknown";
322
- counts.set(key, (counts.get(key) ?? 0) + 1);
323
- }
324
- if (counts.size === 0) return void 0;
325
- const n = runs.length;
326
- return [...counts.entries()].map(([failureClass, count]) => ({
327
- failureClass,
328
- count,
329
- share: n > 0 ? count / n : 0
330
- })).sort((a, b) => b.count - a.count || a.failureClass.localeCompare(b.failureClass));
331
- }
332
- function computePriorPeriodComparison(current, baseline, split, windowLabel) {
333
- if (current.length === 0 || baseline.length === 0) return void 0;
334
- const metrics = {};
335
- const directions = {};
336
- const compositeCurrent = current.map((r) => compositeOf(r, split)).filter(Number.isFinite);
337
- const compositeBaseline = baseline.map((r) => compositeOf(r, split)).filter(Number.isFinite);
338
- if (compositeCurrent.length > 0 && compositeBaseline.length > 0) {
339
- metrics.composite = welchCompare(compositeBaseline, compositeCurrent);
340
- directions.composite = "higher-is-better";
341
- }
342
- const costCurrent = knownCostValues(current);
343
- const costBaseline = knownCostValues(baseline);
344
- if (costCurrent.length > 0 && costBaseline.length > 0) {
345
- metrics.cost = welchCompare(costBaseline, costCurrent);
346
- directions.cost = "lower-is-better";
347
- }
348
- const durCurrent = current.map((r) => r.wallMs).filter(Number.isFinite);
349
- const durBaseline = baseline.map((r) => r.wallMs).filter(Number.isFinite);
350
- if (durCurrent.length > 0 && durBaseline.length > 0) {
351
- metrics.duration = welchCompare(durBaseline, durCurrent);
352
- directions.duration = "lower-is-better";
353
- }
354
- const tokCurrent = current.map((r) => (r.tokenUsage.input ?? 0) + (r.tokenUsage.output ?? 0)).filter(Number.isFinite);
355
- const tokBaseline = baseline.map((r) => (r.tokenUsage.input ?? 0) + (r.tokenUsage.output ?? 0)).filter(Number.isFinite);
356
- if (tokCurrent.length > 0 && tokBaseline.length > 0) {
357
- metrics.tokenUsage = welchCompare(tokBaseline, tokCurrent);
358
- directions.tokenUsage = "lower-is-better";
359
- }
360
- const dimsCurrent = collectPerDimension(current);
361
- const dimsBaseline = collectPerDimension(baseline);
362
- for (const dim of Object.keys(dimsCurrent)) {
363
- const b = dimsBaseline[dim];
364
- const c = dimsCurrent[dim];
365
- if (!b || b.length === 0 || !c || c.length === 0) continue;
366
- metrics[`dim.${dim}`] = welchCompare(b, c);
367
- directions[`dim.${dim}`] = "higher-is-better";
368
- }
369
- const regressedMetrics = [];
370
- const improvedMetrics = [];
371
- const inconclusiveMetrics = [];
372
- for (const [name, delta] of Object.entries(metrics)) {
373
- if (delta.status !== "ok") {
374
- inconclusiveMetrics.push(name);
375
- continue;
376
- }
377
- if (!delta.significant) continue;
378
- if ((directions[name] ?? "higher-is-better") === "higher-is-better" ? delta.delta > 0 : delta.delta < 0) improvedMetrics.push(name);
379
- else regressedMetrics.push(name);
380
- }
381
- return {
382
- baselineN: baseline.length,
383
- currentN: current.length,
384
- ...windowLabel ? { windowLabel } : {},
385
- metrics,
386
- regressedMetrics,
387
- improvedMetrics,
388
- inconclusiveMetrics
389
- };
390
- }
391
- function knownCostValues(runs) {
392
- return runs.filter((run) => run.costProvenance.usd !== null).map((run) => run.costUsd).filter(isFiniteNumber);
393
- }
394
- function isFiniteNumber(value) {
395
- return typeof value === "number" && Number.isFinite(value);
396
- }
397
- /** Collect per-dimension values across runs (from outcome.judgeScores.perDimMean). */
398
- function collectPerDimension(runs) {
399
- const out = {};
400
- for (const r of runs) {
401
- const perDim = r.outcome.judgeScores?.perDimMean;
402
- if (!perDim) continue;
403
- for (const [dim, value] of Object.entries(perDim)) {
404
- if (!Number.isFinite(value)) continue;
405
- if (!out[dim]) out[dim] = [];
406
- out[dim].push(value);
407
- }
408
- }
409
- return out;
410
- }
411
- /** Adapt the shared two-sample Welch result to the report contract. */
412
- function welchCompare(baseline, current) {
413
- const result = welchsTTest(baseline, current);
414
- const base = {
415
- current: result.meanB,
416
- baseline: result.meanA,
417
- delta: result.delta,
418
- baselineN: baseline.length,
419
- currentN: current.length
420
- };
421
- if (result.status !== "ok") return {
422
- ...base,
423
- status: result.status,
424
- ci95: null,
425
- pValue: null,
426
- cohensD: null,
427
- significant: false
428
- };
429
- return {
430
- ...base,
431
- status: "ok",
432
- ci95: result.ci95,
433
- pValue: result.p,
434
- cohensD: result.cohensD,
435
- significant: result.p < .05 && Math.abs(result.cohensD) >= .2
436
- };
437
- }
438
- function resolveSplit(runs, pref) {
439
- if (pref !== "auto") return pref;
440
- return runs.some((r) => Number.isFinite(observedSplitScore(r, "holdout"))) ? "holdout" : "search";
217
+ //#endregion
218
+ //#region src/contract/quality-insight.ts
219
+ /** Observed score distributions, judge agreement, and downstream quality correlation. */
220
+ function resolveSplit(runs, pref) {
221
+ if (pref !== "auto") return pref;
222
+ return runs.some((r) => Number.isFinite(observedSplitScore(r, "holdout"))) ? "holdout" : "search";
441
223
  }
442
224
  /**
443
225
  * RAW (`observedSplitScore`): `analyzeRuns` describes what a set of runs
@@ -462,15 +244,15 @@ function distributionOf(values, bins, withIds) {
462
244
  };
463
245
  const sorted = [...values].sort((a, b) => a - b);
464
246
  const n = sorted.length;
465
- const mean = sorted.reduce((s, v) => s + v, 0) / n;
247
+ const mean = mean$1(sorted);
466
248
  const variance = sorted.reduce((s, v) => s + (v - mean) ** 2, 0) / n;
467
249
  const stddev = Math.sqrt(variance);
468
250
  const tailRuns = withIds ? [...withIds].sort((a, b) => a.score - b.score).slice(0, Math.min(5, withIds.length)) : void 0;
469
251
  return {
470
252
  n,
471
253
  mean,
472
- p50: percentile(sorted, .5),
473
- p95: percentile(sorted, .95),
254
+ p50: interpolatedQuantile(sorted, .5),
255
+ p95: interpolatedQuantile(sorted, .95),
474
256
  stddev,
475
257
  min: sorted[0],
476
258
  max: sorted[n - 1],
@@ -478,16 +260,6 @@ function distributionOf(values, bins, withIds) {
478
260
  ...tailRuns ? { tailRuns } : {}
479
261
  };
480
262
  }
481
- function percentile(sorted, q) {
482
- if (sorted.length === 0) return 0;
483
- if (sorted.length === 1) return sorted[0];
484
- const idx = (sorted.length - 1) * q;
485
- const lo = Math.floor(idx);
486
- const hi = Math.ceil(idx);
487
- if (lo === hi) return sorted[lo];
488
- const w = idx - lo;
489
- return sorted[lo] * (1 - w) + sorted[hi] * w;
490
- }
491
263
  /** Even-width histogram over the value range. Returns inclusive-lo /
492
264
  * exclusive-hi bins (closed on right for the last bin) compatible with
493
265
  * the substrate's `GainDistributionBin` shape. */
@@ -533,6 +305,20 @@ function computePerDimension(runs, bins) {
533
305
  for (const [dim, values] of byDim) out[dim] = distributionOf(values, bins);
534
306
  return out;
535
307
  }
308
+ /** Collect per-dimension values across runs (from outcome.judgeScores.perDimMean). */
309
+ function collectPerDimension(runs) {
310
+ const out = {};
311
+ for (const r of runs) {
312
+ const perDim = r.outcome.judgeScores?.perDimMean;
313
+ if (!perDim) continue;
314
+ for (const [dim, value] of Object.entries(perDim)) {
315
+ if (!Number.isFinite(value)) continue;
316
+ if (!out[dim]) out[dim] = [];
317
+ out[dim].push(value);
318
+ }
319
+ }
320
+ return out;
321
+ }
536
322
  function computeJudgeInsights(runs) {
537
323
  const out = {};
538
324
  const byJudge = /* @__PURE__ */ new Map();
@@ -617,84 +403,469 @@ function computeInterRater(ratings) {
617
403
  perPair,
618
404
  disagreementCases
619
405
  };
620
- }
621
- function computeLift(runs, baselineId, candidateId, split, independentUnitByScenarioId) {
622
- let bId = baselineId;
623
- let cId = candidateId;
624
- if (!bId || !cId) {
625
- const ids = [...new Set(runs.map((r) => r.candidateId))];
626
- if (ids.length !== 2) return void 0;
627
- const [idA, idB] = ids;
628
- const scoresA = finiteCompositeScores(runs.filter((run) => run.candidateId === idA), split);
629
- const scoresB = finiteCompositeScores(runs.filter((run) => run.candidateId === idB), split);
630
- if (scoresA.length === 0 || scoresB.length === 0) return void 0;
631
- const meanA = mean(scoresA);
632
- const meanB = mean(scoresB);
633
- bId = meanA <= meanB ? idA : idB;
634
- cId = meanA <= meanB ? idB : idA;
406
+ }
407
+ function computeOutcomeCorrelation(runs, outcome, split) {
408
+ const xs = [];
409
+ const ys = [];
410
+ for (const run of runs) {
411
+ const y = outcome.valueByRunId[run.runId];
412
+ if (y === void 0 || !Number.isFinite(y)) continue;
413
+ const x = compositeOf(run, split);
414
+ if (!Number.isFinite(x)) continue;
415
+ xs.push(x);
416
+ ys.push(y);
417
+ }
418
+ if (xs.length < 3) return void 0;
419
+ const p = pearsonR(xs, ys);
420
+ const s = spearmanR(xs, ys);
421
+ const meanX = meanOrZero(xs);
422
+ const meanY = meanOrZero(ys);
423
+ let num = 0;
424
+ let denom = 0;
425
+ for (let i = 0; i < xs.length; i++) {
426
+ num += (xs[i] - meanX) * (ys[i] - meanY);
427
+ denom += (xs[i] - meanX) ** 2;
428
+ }
429
+ const slope = denom === 0 ? 0 : num / denom;
430
+ const intercept = meanY - slope * meanX;
431
+ const ssTot = ys.reduce((a, y) => a + (y - meanY) ** 2, 0);
432
+ const ssRes = ys.reduce((a, y, i) => a + (y - (intercept + slope * xs[i])) ** 2, 0);
433
+ const r2 = ssTot === 0 ? 0 : 1 - ssRes / ssTot;
434
+ return {
435
+ metric: outcome.metric,
436
+ n: xs.length,
437
+ pearson: p,
438
+ spearman: s,
439
+ rewardModel: {
440
+ intercept,
441
+ slope,
442
+ r2
443
+ }
444
+ };
445
+ }
446
+ function finiteCompositeScores(runs, split) {
447
+ return runs.map((run) => compositeOf(run, split)).filter(Number.isFinite);
448
+ }
449
+ function isFiniteNumber(value) {
450
+ return typeof value === "number" && Number.isFinite(value);
451
+ }
452
+ function meanOrZero(arr) {
453
+ return arr.length === 0 ? 0 : mean$1(arr);
454
+ }
455
+ //#endregion
456
+ //#region src/contract/comparison-insight.ts
457
+ /** Paired candidate lift and independent prior-period metric comparisons. */
458
+ function computePriorPeriodComparison(current, baseline, split, windowLabel) {
459
+ if (current.length === 0 || baseline.length === 0) return void 0;
460
+ const metrics = {};
461
+ const directions = {};
462
+ const compositeCurrent = current.map((r) => compositeOf(r, split)).filter(Number.isFinite);
463
+ const compositeBaseline = baseline.map((r) => compositeOf(r, split)).filter(Number.isFinite);
464
+ if (compositeCurrent.length > 0 && compositeBaseline.length > 0) {
465
+ metrics.composite = welchCompare(compositeBaseline, compositeCurrent);
466
+ directions.composite = "higher-is-better";
467
+ }
468
+ const costCurrent = knownCostValues(current);
469
+ const costBaseline = knownCostValues(baseline);
470
+ if (costCurrent.length > 0 && costBaseline.length > 0) {
471
+ metrics.cost = welchCompare(costBaseline, costCurrent);
472
+ directions.cost = "lower-is-better";
473
+ }
474
+ const durCurrent = current.map((r) => r.wallMs).filter(Number.isFinite);
475
+ const durBaseline = baseline.map((r) => r.wallMs).filter(Number.isFinite);
476
+ if (durCurrent.length > 0 && durBaseline.length > 0) {
477
+ metrics.duration = welchCompare(durBaseline, durCurrent);
478
+ directions.duration = "lower-is-better";
479
+ }
480
+ const tokCurrent = current.map((r) => (r.tokenUsage.input ?? 0) + (r.tokenUsage.output ?? 0)).filter(Number.isFinite);
481
+ const tokBaseline = baseline.map((r) => (r.tokenUsage.input ?? 0) + (r.tokenUsage.output ?? 0)).filter(Number.isFinite);
482
+ if (tokCurrent.length > 0 && tokBaseline.length > 0) {
483
+ metrics.tokenUsage = welchCompare(tokBaseline, tokCurrent);
484
+ directions.tokenUsage = "lower-is-better";
485
+ }
486
+ const dimsCurrent = collectPerDimension(current);
487
+ const dimsBaseline = collectPerDimension(baseline);
488
+ for (const dim of Object.keys(dimsCurrent)) {
489
+ const b = dimsBaseline[dim];
490
+ const c = dimsCurrent[dim];
491
+ if (!b || b.length === 0 || !c || c.length === 0) continue;
492
+ metrics[`dim.${dim}`] = welchCompare(b, c);
493
+ directions[`dim.${dim}`] = "higher-is-better";
494
+ }
495
+ const regressedMetrics = [];
496
+ const improvedMetrics = [];
497
+ const inconclusiveMetrics = [];
498
+ for (const [name, delta] of Object.entries(metrics)) {
499
+ if (delta.status !== "ok") {
500
+ inconclusiveMetrics.push(name);
501
+ continue;
502
+ }
503
+ if (!delta.significant) continue;
504
+ if ((directions[name] ?? "higher-is-better") === "higher-is-better" ? delta.delta > 0 : delta.delta < 0) improvedMetrics.push(name);
505
+ else regressedMetrics.push(name);
506
+ }
507
+ return {
508
+ baselineN: baseline.length,
509
+ currentN: current.length,
510
+ ...windowLabel ? { windowLabel } : {},
511
+ metrics,
512
+ regressedMetrics,
513
+ improvedMetrics,
514
+ inconclusiveMetrics
515
+ };
516
+ }
517
+ function knownCostValues(runs) {
518
+ return runs.filter((run) => run.costProvenance.usd !== null).map((run) => run.costUsd).filter(isFiniteNumber);
519
+ }
520
+ /** Adapt the shared two-sample Welch result to the report contract. */
521
+ function welchCompare(baseline, current) {
522
+ const result = welchsTTest(baseline, current);
523
+ const base = {
524
+ current: result.meanB,
525
+ baseline: result.meanA,
526
+ delta: result.delta,
527
+ baselineN: baseline.length,
528
+ currentN: current.length
529
+ };
530
+ if (result.status !== "ok") return {
531
+ ...base,
532
+ status: result.status,
533
+ ci95: null,
534
+ pValue: null,
535
+ cohensD: null,
536
+ significant: false
537
+ };
538
+ return {
539
+ ...base,
540
+ status: "ok",
541
+ ci95: result.ci95,
542
+ pValue: result.p,
543
+ cohensD: result.cohensD,
544
+ significant: result.p < .05 && Math.abs(result.cohensD) >= .2
545
+ };
546
+ }
547
+ function computeLift(runs, baselineId, candidateId, split, independentUnitByScenarioId) {
548
+ let bId = baselineId;
549
+ let cId = candidateId;
550
+ if (!bId || !cId) {
551
+ const ids = [...new Set(runs.map((r) => r.candidateId))];
552
+ if (ids.length !== 2) return void 0;
553
+ const [idA, idB] = ids;
554
+ const scoresA = finiteCompositeScores(runs.filter((run) => run.candidateId === idA), split);
555
+ const scoresB = finiteCompositeScores(runs.filter((run) => run.candidateId === idB), split);
556
+ if (scoresA.length === 0 || scoresB.length === 0) return void 0;
557
+ const meanA = meanOrZero(scoresA);
558
+ const meanB = meanOrZero(scoresB);
559
+ bId = meanA <= meanB ? idA : idB;
560
+ cId = meanA <= meanB ? idB : idA;
561
+ }
562
+ const baseline = runs.filter((r) => r.candidateId === bId);
563
+ const candidate = runs.filter((r) => r.candidateId === cId);
564
+ if (baseline.length === 0 || candidate.length === 0) return void 0;
565
+ const scoredBaseline = baseline.filter((run) => Number.isFinite(compositeOf(run, split)));
566
+ const scoredCandidate = candidate.filter((run) => Number.isFinite(compositeOf(run, split)));
567
+ const pairing = pairRunRecords(scoredBaseline, scoredCandidate);
568
+ let pairedBaseline = pairing.pairs.map((pair) => compositeOf(pair.baseline, split));
569
+ let pairedCandidate = pairing.pairs.map((pair) => compositeOf(pair.treatment, split));
570
+ if (pairedBaseline.length === 0) return void 0;
571
+ const grouped = independentUnitByScenarioId ? aggregatePairedHoldout({
572
+ before: pairedBaseline,
573
+ after: pairedCandidate,
574
+ cellIds: pairing.pairs.map((pair, index) => `${pair.pairKey}:${index}`)
575
+ }, new Map(pairing.pairs.map((pair) => [pair.pairKey, independentUnitByScenarioId.get(pair.baseline.scenarioId)]))) : void 0;
576
+ if (grouped) {
577
+ pairedBaseline = grouped.before;
578
+ pairedCandidate = grouped.after;
579
+ }
580
+ const reverseInferredArms = grouped !== void 0 && (!baselineId || !candidateId) && meanOrZero(pairedBaseline) > meanOrZero(pairedCandidate);
581
+ if (reverseInferredArms) [pairedBaseline, pairedCandidate] = [pairedCandidate, pairedBaseline];
582
+ const baselineMean = meanOrZero(pairedBaseline);
583
+ const candidateMean = meanOrZero(pairedCandidate);
584
+ const delta = candidateMean - baselineMean;
585
+ const bootstrap = pairedBootstrap(pairedBaseline, pairedCandidate, {
586
+ confidence: .95,
587
+ resamples: 2e3,
588
+ statistic: "mean"
589
+ });
590
+ const tTest = pairedTTest(pairedBaseline, pairedCandidate);
591
+ const d = pairedCohensDz(pairedBaseline, pairedCandidate);
592
+ const mde = pairedMde({
593
+ nPaired: pairedBaseline.length,
594
+ power: .8,
595
+ alpha: .05
596
+ });
597
+ const requiredN = d === null || d === 0 ? null : requiredPairedSampleSize({
598
+ effect: Math.abs(d),
599
+ power: .8,
600
+ alpha: .05
601
+ });
602
+ return {
603
+ baselineMean,
604
+ candidateMean,
605
+ delta,
606
+ ci95: [bootstrap.low, bootstrap.high],
607
+ pValue: tTest.p,
608
+ n: pairedBaseline.length,
609
+ ...grouped ? {
610
+ pairedRunN: pairing.pairs.length,
611
+ independentUnitIds: grouped.unitIds
612
+ } : {},
613
+ minimumRequired: 20,
614
+ decisionEligible: bootstrap.gateEligible,
615
+ unpairedBaseline: (reverseInferredArms ? pairing.unpairedTreatment : pairing.unpairedBaseline).length,
616
+ unpairedCandidate: (reverseInferredArms ? pairing.unpairedBaseline : pairing.unpairedTreatment).length,
617
+ cohensD: d,
618
+ mde,
619
+ requiredN
620
+ };
621
+ }
622
+ //#endregion
623
+ //#region src/contract/execution-insight.ts
624
+ /** Runtime usage, terminal outcomes, execution errors, and cost capture facts. */
625
+ /** Summarize runtime facts without interpreting task quality or promotion readiness. */
626
+ function summarizeExecution(opts) {
627
+ const runs = opts.runs.map(validateRunRecord);
628
+ return {
629
+ execution: computeExecutionInsight(runs, opts.histogramBins ?? 12),
630
+ costProvenance: summarizeCostProvenance(runs)
631
+ };
632
+ }
633
+ function computeExecutionInsight(runs, bins) {
634
+ const aggregateRows = runs.flatMap((run) => {
635
+ const usage = aggregateTokenUsage(run);
636
+ return usage ? [{
637
+ usage,
638
+ costUsd: finiteRaw(run, "aggregate_cost_usd")
639
+ }] : [];
640
+ });
641
+ const aggregateCosts = aggregateRows.flatMap((row) => row.costUsd !== void 0 ? [row.costUsd] : []);
642
+ const modelCounts = /* @__PURE__ */ new Map();
643
+ let executionErrorRuns = 0;
644
+ let executionErrorEvents = 0;
645
+ let errorReportingRuns = 0;
646
+ let errorSpanEvents = 0;
647
+ let errorSpanReportingRuns = 0;
648
+ const terminalOutcomes = {
649
+ succeeded: 0,
650
+ failed: 0,
651
+ cancelled: 0,
652
+ incomplete: 0,
653
+ unknown: 0
654
+ };
655
+ const errorsByTerminalOutcome = {
656
+ succeeded: {
657
+ withErrors: 0,
658
+ withoutErrors: 0,
659
+ unreported: 0
660
+ },
661
+ failed: {
662
+ withErrors: 0,
663
+ withoutErrors: 0,
664
+ unreported: 0
665
+ },
666
+ cancelled: {
667
+ withErrors: 0,
668
+ withoutErrors: 0,
669
+ unreported: 0
670
+ },
671
+ incomplete: {
672
+ withErrors: 0,
673
+ withoutErrors: 0,
674
+ unreported: 0
675
+ },
676
+ unknown: {
677
+ withErrors: 0,
678
+ withoutErrors: 0,
679
+ unreported: 0
680
+ }
681
+ };
682
+ let modelCallRuns = 0;
683
+ let modelCallEvents = 0;
684
+ let modelCallReportingRuns = 0;
685
+ for (const run of runs) {
686
+ modelCounts.set(run.model, (modelCounts.get(run.model) ?? 0) + 1);
687
+ const terminalOutcome = run.terminalOutcome;
688
+ terminalOutcomes[terminalOutcome] += 1;
689
+ const modelCalls = nonNegativeCountRaw(run, "llm_span_count");
690
+ if (modelCalls !== void 0) {
691
+ modelCallEvents += modelCalls;
692
+ modelCallReportingRuns += 1;
693
+ }
694
+ const usage = run.tokenUsage;
695
+ if ((modelCalls ?? 0) > 0 || usage.input > 0 || usage.output > 0 || (usage.cached ?? 0) > 0 || (usage.cacheWrite ?? 0) > 0) modelCallRuns += 1;
696
+ const errorEvents = reportedExecutionErrorEvents(run);
697
+ if (errorEvents !== void 0) {
698
+ executionErrorEvents += errorEvents;
699
+ errorReportingRuns += 1;
700
+ if (errorEvents > 0) {
701
+ executionErrorRuns += 1;
702
+ errorsByTerminalOutcome[terminalOutcome].withErrors += 1;
703
+ } else errorsByTerminalOutcome[terminalOutcome].withoutErrors += 1;
704
+ } else errorsByTerminalOutcome[terminalOutcome].unreported += 1;
705
+ const reportedErrorSpans = nonNegativeCountRaw(run, "error_span_count");
706
+ if (reportedErrorSpans !== void 0) {
707
+ errorSpanEvents += reportedErrorSpans;
708
+ errorSpanReportingRuns += 1;
709
+ }
710
+ }
711
+ return {
712
+ durationMs: distributionOf(runs.map((run) => run.wallMs), bins),
713
+ queueMs: distributionOf(runs.filter((run) => run.queueMs !== void 0).map((run) => run.queueMs), bins),
714
+ tokenUsage: summarizeTokenUsage(runs.map((run) => run.tokenUsage), bins),
715
+ aggregateUsage: {
716
+ runs: aggregateRows.length,
717
+ tokenUsage: summarizeTokenUsage(aggregateRows.map((row) => row.usage), bins),
718
+ costUsd: distributionOf(aggregateCosts, bins),
719
+ totalCostUsd: aggregateCosts.reduce((total, value) => total + value, 0)
720
+ },
721
+ models: [...modelCounts.entries()].map(([model, count]) => ({
722
+ model,
723
+ runs: count
724
+ })).sort((left, right) => right.runs - left.runs || left.model.localeCompare(right.model)),
725
+ modelCalls: {
726
+ runs: modelCallRuns,
727
+ events: modelCallEvents,
728
+ reportingRuns: modelCallReportingRuns
729
+ },
730
+ executionErrors: {
731
+ runs: executionErrorRuns,
732
+ fraction: errorReportingRuns > 0 ? executionErrorRuns / errorReportingRuns : null,
733
+ events: executionErrorEvents,
734
+ reportingRuns: errorReportingRuns,
735
+ errorSpanEvents,
736
+ errorSpanReportingRuns,
737
+ byTerminalOutcome: errorsByTerminalOutcome
738
+ },
739
+ terminalOutcomes
740
+ };
741
+ }
742
+ function reportedExecutionErrorEvents(run) {
743
+ return nonNegativeCountRaw(run, "execution_error_count");
744
+ }
745
+ function nonNegativeCountRaw(run, key) {
746
+ const value = finiteRaw(run, key);
747
+ return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
748
+ }
749
+ function summarizeTokenUsage(usages, bins) {
750
+ const reasoning = usages.flatMap((usage) => usage.reasoning !== void 0 ? [usage.reasoning] : []);
751
+ const cached = usages.flatMap((usage) => usage.cached !== void 0 ? [usage.cached] : []);
752
+ const cacheWrite = usages.flatMap((usage) => usage.cacheWrite !== void 0 ? [usage.cacheWrite] : []);
753
+ return {
754
+ input: distributionOf(usages.map((usage) => usage.input), bins),
755
+ output: distributionOf(usages.map((usage) => usage.output), bins),
756
+ reasoning: distributionOf(reasoning, bins),
757
+ cached: distributionOf(cached, bins),
758
+ cacheWrite: distributionOf(cacheWrite, bins),
759
+ totals: {
760
+ input: usages.reduce((total, usage) => total + usage.input, 0),
761
+ output: usages.reduce((total, usage) => total + usage.output, 0),
762
+ reasoning: reasoning.reduce((total, value) => total + value, 0),
763
+ cached: cached.reduce((total, value) => total + value, 0),
764
+ cacheWrite: cacheWrite.reduce((total, value) => total + value, 0)
765
+ }
766
+ };
767
+ }
768
+ function aggregateTokenUsage(run) {
769
+ const input = finiteRaw(run, "aggregate_prompt_tokens");
770
+ const output = finiteRaw(run, "aggregate_completion_tokens");
771
+ const reasoning = finiteRaw(run, "aggregate_reasoning_tokens");
772
+ const cached = finiteRaw(run, "aggregate_cached_tokens");
773
+ const cacheWrite = finiteRaw(run, "aggregate_cache_write_tokens");
774
+ if (input === void 0 && output === void 0 && reasoning === void 0 && cached === void 0 && cacheWrite === void 0) return void 0;
775
+ return {
776
+ input: input ?? 0,
777
+ output: output ?? 0,
778
+ ...reasoning !== void 0 ? { reasoning } : {},
779
+ ...cached !== void 0 ? { cached } : {},
780
+ ...cacheWrite !== void 0 ? { cacheWrite } : {}
781
+ };
782
+ }
783
+ function finiteRaw(run, key) {
784
+ const value = run.outcome.raw[key];
785
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
786
+ }
787
+ function summarizeCostProvenance(runs) {
788
+ const summary = {
789
+ observed: {
790
+ n: 0,
791
+ totalUsd: 0
792
+ },
793
+ estimated: {
794
+ n: 0,
795
+ totalUsd: 0
796
+ },
797
+ lowerBound: {
798
+ n: 0,
799
+ floorUsd: 0
800
+ },
801
+ uncaptured: { n: 0 },
802
+ knownFraction: 0
803
+ };
804
+ for (const run of runs) {
805
+ const cost = run.costProvenance;
806
+ if (cost.kind === "uncaptured") summary.uncaptured.n += 1;
807
+ else if (cost.kind === "lower-bound") {
808
+ summary.lowerBound.n += 1;
809
+ summary.lowerBound.floorUsd += cost.knownLowerBoundUsd;
810
+ } else {
811
+ summary[cost.kind].n += 1;
812
+ summary[cost.kind].totalUsd += cost.usd;
813
+ }
635
814
  }
636
- const baseline = runs.filter((r) => r.candidateId === bId);
637
- const candidate = runs.filter((r) => r.candidateId === cId);
638
- if (baseline.length === 0 || candidate.length === 0) return void 0;
639
- const scoredBaseline = baseline.filter((run) => Number.isFinite(compositeOf(run, split)));
640
- const scoredCandidate = candidate.filter((run) => Number.isFinite(compositeOf(run, split)));
641
- const pairing = pairRunRecords(scoredBaseline, scoredCandidate);
642
- let pairedBaseline = pairing.pairs.map((pair) => compositeOf(pair.baseline, split));
643
- let pairedCandidate = pairing.pairs.map((pair) => compositeOf(pair.treatment, split));
644
- if (pairedBaseline.length === 0) return void 0;
645
- const grouped = independentUnitByScenarioId ? aggregatePairedHoldout({
646
- before: pairedBaseline,
647
- after: pairedCandidate,
648
- cellIds: pairing.pairs.map((pair, index) => `${pair.pairKey}:${index}`)
649
- }, new Map(pairing.pairs.map((pair) => [pair.pairKey, independentUnitByScenarioId.get(pair.baseline.scenarioId)]))) : void 0;
650
- if (grouped) {
651
- pairedBaseline = grouped.before;
652
- pairedCandidate = grouped.after;
815
+ const known = summary.observed.n + summary.estimated.n;
816
+ summary.knownFraction = runs.length > 0 ? known / runs.length : 0;
817
+ return summary;
818
+ }
819
+ function diagnoseCostCoverage(runs, provenance) {
820
+ const unknown = provenance.uncaptured.n + provenance.lowerBound.n;
821
+ const known = provenance.observed.n + provenance.estimated.n;
822
+ const floor = provenance.lowerBound.n > 0 ? ` (${provenance.lowerBound.n} of them cost at least $${provenance.lowerBound.floorUsd.toFixed(6)} together)` : "";
823
+ if (unknown === runs.length) return `USD cost total unknown for all ${runs.length} runs${floor} — no observed or estimated USD values; token and wall-time metrics remain available.`;
824
+ return `USD cost total unknown for ${unknown}/${runs.length} runs${floor}; excluded those rows from cost statistics (${known}/${runs.length} retained: ${provenance.observed.n} observed, ${provenance.estimated.n} estimated).`;
825
+ }
826
+ //#endregion
827
+ //#region src/contamination-guard.ts
828
+ function checkCanaries(output, scenarios) {
829
+ const leaks = [];
830
+ for (const s of scenarios) {
831
+ if (!s.canary) continue;
832
+ if (output.includes(s.canary)) leaks.push({
833
+ scenarioId: s.id,
834
+ canary: s.canary,
835
+ evidence: excerpt(output, s.canary)
836
+ });
653
837
  }
654
- const reverseInferredArms = grouped !== void 0 && (!baselineId || !candidateId) && mean(pairedBaseline) > mean(pairedCandidate);
655
- if (reverseInferredArms) [pairedBaseline, pairedCandidate] = [pairedCandidate, pairedBaseline];
656
- const baselineMean = mean(pairedBaseline);
657
- const candidateMean = mean(pairedCandidate);
658
- const delta = candidateMean - baselineMean;
659
- const bootstrap = pairedBootstrap(pairedBaseline, pairedCandidate, {
660
- confidence: .95,
661
- resamples: 2e3,
662
- statistic: "mean"
663
- });
664
- const tTest = pairedTTest(pairedBaseline, pairedCandidate);
665
- const d = pairedCohensDz(pairedBaseline, pairedCandidate);
666
- const mde = pairedMde({
667
- nPaired: pairedBaseline.length,
668
- power: .8,
669
- alpha: .05
670
- });
671
- const requiredN = d === null || d === 0 ? null : requiredPairedSampleSize({
672
- effect: Math.abs(d),
673
- power: .8,
674
- alpha: .05
675
- });
676
- return {
677
- baselineMean,
678
- candidateMean,
679
- delta,
680
- ci95: [bootstrap.low, bootstrap.high],
681
- pValue: tTest.p,
682
- n: pairedBaseline.length,
683
- ...grouped ? {
684
- pairedRunN: pairing.pairs.length,
685
- independentUnitIds: grouped.unitIds
686
- } : {},
687
- minimumRequired: 20,
688
- decisionEligible: bootstrap.gateEligible,
689
- unpairedBaseline: (reverseInferredArms ? pairing.unpairedTreatment : pairing.unpairedBaseline).length,
690
- unpairedCandidate: (reverseInferredArms ? pairing.unpairedBaseline : pairing.unpairedTreatment).length,
691
- cohensD: d,
692
- mde,
693
- requiredN
694
- };
838
+ return leaks;
695
839
  }
696
- function mean(arr) {
697
- return arr.length === 0 ? 0 : arr.reduce((s, v) => s + v, 0) / arr.length;
840
+ function excerpt(source, needle) {
841
+ const at = source.indexOf(needle);
842
+ if (at < 0) return "";
843
+ const start = Math.max(0, at - 30);
844
+ const end = Math.min(source.length, at + needle.length + 30);
845
+ return (start > 0 ? "…" : "") + source.slice(start, end) + (end < source.length ? "…" : "");
846
+ }
847
+ //#endregion
848
+ //#region src/contract/failure-insight.ts
849
+ /**
850
+ * Model-free task-failure tally.
851
+ *
852
+ * Explicit non-success classes are task-failure evidence.
853
+ * A low task score without a class is counted as `unknown`.
854
+ */
855
+ function computeFailureClasses(runs, split) {
856
+ const counts = /* @__PURE__ */ new Map();
857
+ for (const r of runs) {
858
+ if (!isTaskFailure(r, split)) continue;
859
+ const key = r.failureClass !== void 0 && r.failureClass !== "success" ? r.failureClass : "unknown";
860
+ counts.set(key, (counts.get(key) ?? 0) + 1);
861
+ }
862
+ if (counts.size === 0) return void 0;
863
+ const n = runs.length;
864
+ return [...counts.entries()].map(([failureClass, count]) => ({
865
+ failureClass,
866
+ count,
867
+ share: n > 0 ? count / n : 0
868
+ })).sort((a, b) => b.count - a.count || a.failureClass.localeCompare(b.failureClass));
698
869
  }
699
870
  async function computeFailureClusters(runs, analyst, split) {
700
871
  const failed = runs.filter((run) => isTaskFailure(run, split));
@@ -731,9 +902,6 @@ async function computeFailureClusters(runs, analyst, split) {
731
902
  totalFailures: failed.length
732
903
  };
733
904
  }
734
- function finiteCompositeScores(runs, split) {
735
- return runs.map((run) => compositeOf(run, split)).filter(Number.isFinite);
736
- }
737
905
  function isTaskFailure(run, split) {
738
906
  if (run.failureClass !== void 0 && run.failureClass !== "success") return true;
739
907
  const score = compositeOf(run, split);
@@ -766,44 +934,13 @@ function stringifyOutput(run) {
766
934
  if (typeof metadata?.output === "string") return metadata.output;
767
935
  if (typeof metadata?.text === "string") return metadata.text;
768
936
  }
769
- function computeOutcomeCorrelation(runs, outcome, split) {
770
- const xs = [];
771
- const ys = [];
772
- for (const run of runs) {
773
- const y = outcome.valueByRunId[run.runId];
774
- if (y === void 0 || !Number.isFinite(y)) continue;
775
- const x = compositeOf(run, split);
776
- if (!Number.isFinite(x)) continue;
777
- xs.push(x);
778
- ys.push(y);
779
- }
780
- if (xs.length < 3) return void 0;
781
- const p = pearsonR(xs, ys);
782
- const s = spearmanR(xs, ys);
783
- const meanX = mean(xs);
784
- const meanY = mean(ys);
785
- let num = 0;
786
- let denom = 0;
787
- for (let i = 0; i < xs.length; i++) {
788
- num += (xs[i] - meanX) * (ys[i] - meanY);
789
- denom += (xs[i] - meanX) ** 2;
790
- }
791
- const slope = denom === 0 ? 0 : num / denom;
792
- const intercept = meanY - slope * meanX;
793
- const ssTot = ys.reduce((a, y) => a + (y - meanY) ** 2, 0);
794
- const ssRes = ys.reduce((a, y, i) => a + (y - (intercept + slope * xs[i])) ** 2, 0);
795
- const r2 = ssTot === 0 ? 0 : 1 - ssRes / ssTot;
796
- return {
797
- metric: outcome.metric,
798
- n: xs.length,
799
- pearson: p,
800
- spearman: s,
801
- rewardModel: {
802
- intercept,
803
- slope,
804
- r2
805
- }
806
- };
937
+ //#endregion
938
+ //#region src/contract/insight-recommendations.ts
939
+ /** A bootstrap interval with no spread: every resample landed on the same
940
+ * value, so the interval carries no information about how far the point
941
+ * estimate could be wrong and cannot support a directional claim. */
942
+ function zeroWidth(ci) {
943
+ return !Number.isFinite(ci[0]) || !Number.isFinite(ci[1]) || ci[0] === ci[1];
807
944
  }
808
945
  function buildReleaseScorecard(composite, lift, contamination) {
809
946
  const axes = [];
@@ -985,6 +1122,77 @@ function buildRecommendations(ctx) {
985
1122
  return out;
986
1123
  }
987
1124
  //#endregion
988
- export { summarizeExecution as n, checkCanaries as r, analyzeRuns as t };
1125
+ //#region src/contract/analyze-runs.ts
1126
+ async function analyzeRuns(opts) {
1127
+ const runs = opts.runs.map(validateRunRecord);
1128
+ const bins = opts.histogramBins ?? 12;
1129
+ const threshold = opts.decisionThreshold ?? .02;
1130
+ if (!Number.isFinite(threshold)) throw new Error(`analyzeRuns: decisionThreshold must be finite, got ${threshold}`);
1131
+ const split = resolveSplit(runs, opts.split ?? "auto");
1132
+ const compositeWithIds = runs.map((r) => ({
1133
+ runId: r.runId,
1134
+ score: compositeOf(r, split)
1135
+ })).filter((p) => Number.isFinite(p.score));
1136
+ const composite = distributionOf(compositeWithIds.map((p) => p.score), bins, compositeWithIds);
1137
+ const perDimension = computePerDimension(runs, bins);
1138
+ const { execution, costProvenance: provenance } = summarizeExecution({
1139
+ runs,
1140
+ histogramBins: bins
1141
+ });
1142
+ const knownCostRuns = runs.filter((run) => run.costProvenance.usd !== null);
1143
+ const costs = knownCostRuns.map((r) => r.costUsd).filter(isFiniteNumber);
1144
+ const costDist = distributionOf(costs, bins);
1145
+ const pareto = paretoChart(knownCostRuns, { split });
1146
+ const degraded = {};
1147
+ if (provenance.uncaptured.n + provenance.lowerBound.n > 0) degraded.cost = diagnoseCostCoverage(runs, provenance);
1148
+ else if (costs.length === 0 || costs.every((c) => c === 0)) degraded.cost = `all ${runs.length} explicitly observed or estimated USD values are $0`;
1149
+ if (pareto.points.length < 2) degraded.pareto = pareto.points.length === 0 ? "no candidates — Pareto unavailable" : "single candidate — Pareto is a single point, not a frontier";
1150
+ const costQuality = {
1151
+ cost: costDist,
1152
+ pareto,
1153
+ provenance,
1154
+ ...degraded.cost || degraded.pareto ? { degraded } : {}
1155
+ };
1156
+ const judges = computeJudgeInsights(runs);
1157
+ const interRater = opts.raterScores ? computeInterRater(opts.raterScores) : void 0;
1158
+ const lift = computeLift(runs, opts.baselineCandidateId, opts.candidateCandidateId, split, opts.independentUnitByScenarioId);
1159
+ const failureClusters = opts.analyst ? await computeFailureClusters(runs, opts.analyst, split) : void 0;
1160
+ const failureClasses = computeFailureClasses(runs, split);
1161
+ const contamination = opts.canaryScenarios ? computeContamination(runs, opts.canaryScenarios) : void 0;
1162
+ const outcomeCorrelation = opts.outcomeSignal ? computeOutcomeCorrelation(runs, opts.outcomeSignal, split) : void 0;
1163
+ const release = buildReleaseScorecard(composite, lift, contamination);
1164
+ const priorPeriodComparison = opts.baselineRuns ? computePriorPeriodComparison(runs, opts.baselineRuns, split, opts.baselineLabel) : void 0;
1165
+ const recommendations = buildRecommendations({
1166
+ composite,
1167
+ judges,
1168
+ interRater,
1169
+ lift,
1170
+ failureClusters,
1171
+ failureClasses,
1172
+ contamination,
1173
+ outcomeCorrelation,
1174
+ priorPeriodComparison,
1175
+ threshold
1176
+ });
1177
+ return {
1178
+ n: runs.length,
1179
+ execution,
1180
+ composite,
1181
+ perDimension,
1182
+ costQuality,
1183
+ judges,
1184
+ interRater,
1185
+ lift,
1186
+ failureClusters,
1187
+ contamination,
1188
+ outcomeCorrelation,
1189
+ release,
1190
+ ...failureClasses ? { failureClasses } : {},
1191
+ ...priorPeriodComparison ? { priorPeriodComparison } : {},
1192
+ recommendations
1193
+ };
1194
+ }
1195
+ //#endregion
1196
+ export { welchsTTest as a, fisherExactTwoSided as c, studentTTwoSidedPValue as d, twoByTwoPValue as f, iqr as i, linearRegressionSlope as l, checkCanaries as n, chiSquared as o, summarizeExecution as r, chiSquaredPValue as s, analyzeRuns as t, normalTwoSidedPValue as u };
989
1197
 
990
- //# sourceMappingURL=analyze-runs-3xpby3p2.js.map
1198
+ //# sourceMappingURL=analyze-runs-DqPJaJ4X.js.map