@tangle-network/agent-eval 1.0.29 → 1.0.32

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 (292) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +1 -0
  3. package/dist/adapters/http.d.ts +2 -2
  4. package/dist/{agent-profile-BF1WLMco.d.ts → agent-profile-BpLyM2kL.d.ts} +2 -2
  5. package/dist/{agent-profile-BF1WLMco.d.ts.map → agent-profile-BpLyM2kL.d.ts.map} +1 -1
  6. package/dist/{agent-profile-cell-3kYxUsK2.d.ts → agent-profile-cell-BTsrta0H.d.ts} +2 -9
  7. package/dist/agent-profile-cell-BTsrta0H.d.ts.map +1 -0
  8. package/dist/agent-profile-cell-CT5JYueM.js.map +1 -1
  9. package/dist/analyst/index.d.ts +13 -13
  10. package/dist/analyst/index.js +11 -11
  11. package/dist/{analyze-runs-BaziIw93.d.ts → analyze-runs-DfUDLaCk.d.ts} +6 -16
  12. package/dist/analyze-runs-DfUDLaCk.d.ts.map +1 -0
  13. package/dist/{analyze-runs-BCSHzqna.js → analyze-runs-YagfYgfx.js} +5 -5
  14. package/dist/{analyze-runs-BCSHzqna.js.map → analyze-runs-YagfYgfx.js.map} +1 -1
  15. package/dist/app-grade/index.d.ts +3 -5
  16. package/dist/app-grade/index.d.ts.map +1 -1
  17. package/dist/app-grade/index.js +2 -6
  18. package/dist/app-grade/index.js.map +1 -1
  19. package/dist/{benchmark-command-DRAHkn4D.js → benchmark-command-CTmr-oo4.js} +11 -10
  20. package/dist/benchmark-command-CTmr-oo4.js.map +1 -0
  21. package/dist/benchmarks/index.d.ts +7 -6
  22. package/dist/benchmarks/index.d.ts.map +1 -1
  23. package/dist/benchmarks/index.js +13 -5
  24. package/dist/benchmarks/index.js.map +1 -1
  25. package/dist/builder-eval/index.js +1 -1
  26. package/dist/{calibration-Cf-wpqqO.js → calibration-DE2WQmlX.js} +2 -2
  27. package/dist/{calibration-Cf-wpqqO.js.map → calibration-DE2WQmlX.js.map} +1 -1
  28. package/dist/campaign/index.d.ts +8 -8
  29. package/dist/campaign/index.js +14 -14
  30. package/dist/{campaign-Cqz2vk2p.js → campaign-CtdTo5em.js} +15 -15
  31. package/dist/{campaign-Cqz2vk2p.js.map → campaign-CtdTo5em.js.map} +1 -1
  32. package/dist/{campaign-evidence-CVNKiK0q.js → campaign-evidence-BS2-OSFN.js} +4 -4
  33. package/dist/{campaign-evidence-CVNKiK0q.js.map → campaign-evidence-BS2-OSFN.js.map} +1 -1
  34. package/dist/cli.js +9 -8
  35. package/dist/cli.js.map +1 -1
  36. package/dist/{cluster-bootstrap-B0MTOBRU.js → cluster-bootstrap-ClPYIWoX.js} +2 -2
  37. package/dist/{cluster-bootstrap-B0MTOBRU.js.map → cluster-bootstrap-ClPYIWoX.js.map} +1 -1
  38. package/dist/contract/index.d.ts +12 -11
  39. package/dist/contract/index.js +56 -34
  40. package/dist/contract/index.js.map +1 -1
  41. package/dist/{decision-point-CQOczIIH.js → decision-point-DvX1Z4Ue.js} +3 -3
  42. package/dist/{decision-point-CQOczIIH.js.map → decision-point-DvX1Z4Ue.js.map} +1 -1
  43. package/dist/{default-registry-DoIBhuS-.d.ts → default-registry-2Ziw-0sL.d.ts} +7 -7
  44. package/dist/{default-registry-DoIBhuS-.d.ts.map → default-registry-2Ziw-0sL.d.ts.map} +1 -1
  45. package/dist/{default-registry-D-xd7KxV.js → default-registry-DeiYGNKW.js} +3 -3
  46. package/dist/{default-registry-D-xd7KxV.js.map → default-registry-DeiYGNKW.js.map} +1 -1
  47. package/dist/{define-agent-eval-Be2Ser8j.d.ts → define-agent-eval-DmCV1TZo.d.ts} +7 -7
  48. package/dist/{define-agent-eval-Be2Ser8j.d.ts.map → define-agent-eval-DmCV1TZo.d.ts.map} +1 -1
  49. package/dist/{define-agent-eval-BLVewqJm.js → define-agent-eval-GgvRcpNL.js} +7 -7
  50. package/dist/{define-agent-eval-BLVewqJm.js.map → define-agent-eval-GgvRcpNL.js.map} +1 -1
  51. package/dist/diagnosis/index.d.ts +4 -3
  52. package/dist/diagnosis/index.d.ts.map +1 -1
  53. package/dist/diagnosis/index.js +1 -1
  54. package/dist/{dspy-rlm-engine-BS_jxE0P.js → dspy-rlm-engine-DJ_4E-PM.js} +3 -3
  55. package/dist/{dspy-rlm-engine-BS_jxE0P.js.map → dspy-rlm-engine-DJ_4E-PM.js.map} +1 -1
  56. package/dist/{engine-CPBhCLJR.d.ts → engine-yaSDTpEa.d.ts} +2 -2
  57. package/dist/{engine-CPBhCLJR.d.ts.map → engine-yaSDTpEa.d.ts.map} +1 -1
  58. package/dist/{eval-campaign-DpkToY_w.js → eval-campaign-bpSlwr6t.js} +2 -2
  59. package/dist/{eval-campaign-DpkToY_w.js.map → eval-campaign-bpSlwr6t.js.map} +1 -1
  60. package/dist/{evaluation-BjRgUyst.d.ts → evaluation-BQQ2ga5W.d.ts} +4 -4
  61. package/dist/{evaluation-BjRgUyst.d.ts.map → evaluation-BQQ2ga5W.d.ts.map} +1 -1
  62. package/dist/evaluation.d.ts +1 -1
  63. package/dist/{exact-types-DEnrf7NX.d.ts → exact-types-xrjBO9sb.d.ts} +2 -2
  64. package/dist/{exact-types-DEnrf7NX.d.ts.map → exact-types-xrjBO9sb.d.ts.map} +1 -1
  65. package/dist/execution-insight-B-My58JW.d.ts +14 -0
  66. package/dist/execution-insight-B-My58JW.d.ts.map +1 -0
  67. package/dist/experiment/index.d.ts +3 -3
  68. package/dist/experiment/index.js +7 -7
  69. package/dist/{exporters-BKZLt1Px.js → exporters-CfKvJlti.js} +70 -43
  70. package/dist/exporters-CfKvJlti.js.map +1 -0
  71. package/dist/{external-optimizer-process-m9xln7zN.js → external-optimizer-process-jiq4CZD0.js} +2 -2
  72. package/dist/{external-optimizer-process-m9xln7zN.js.map → external-optimizer-process-jiq4CZD0.js.map} +1 -1
  73. package/dist/{external-optimizer-subprocess-GO6s84Ov.js → external-optimizer-subprocess-DUOcOqly.js} +2 -2
  74. package/dist/{external-optimizer-subprocess-GO6s84Ov.js.map → external-optimizer-subprocess-DUOcOqly.js.map} +1 -1
  75. package/dist/failure-cluster-OvKQ0BTq.d.ts +32 -0
  76. package/dist/failure-cluster-OvKQ0BTq.d.ts.map +1 -0
  77. package/dist/{failure-cluster-DOoa7CBg.d.ts → failure-taxonomy-C_SQZ_SJ.d.ts} +2 -30
  78. package/dist/failure-taxonomy-C_SQZ_SJ.d.ts.map +1 -0
  79. package/dist/{feedback-trajectory-DxkG5EPi.d.ts → feedback-trajectory-BbwTH49m.d.ts} +3 -3
  80. package/dist/{feedback-trajectory-DxkG5EPi.d.ts.map → feedback-trajectory-BbwTH49m.d.ts.map} +1 -1
  81. package/dist/{findings-store-CTy71Lnr.js → findings-store-B7JpmgJx.js} +3 -3
  82. package/dist/{findings-store-CTy71Lnr.js.map → findings-store-B7JpmgJx.js.map} +1 -1
  83. package/dist/fuzz.js +1 -1
  84. package/dist/harness-session-lines-hAxOvmtP.js +205 -0
  85. package/dist/harness-session-lines-hAxOvmtP.js.map +1 -0
  86. package/dist/{hf-dataset-Bv114tzB.js → hf-dataset-Cc81I0vQ.js} +65 -141
  87. package/dist/hf-dataset-Cc81I0vQ.js.map +1 -0
  88. package/dist/hosted/index.js +1 -1
  89. package/dist/{index-BI9ecONy.d.ts → index-8hbrQwdR.d.ts} +26 -11
  90. package/dist/index-8hbrQwdR.d.ts.map +1 -0
  91. package/dist/{index-AjfEHHA8.d.ts → index-BFpDeCuS.d.ts} +7 -7
  92. package/dist/{index-AjfEHHA8.d.ts.map → index-BFpDeCuS.d.ts.map} +1 -1
  93. package/dist/{index-DHWFYUVW.d.ts → index-Bcy00QoN.d.ts} +87 -144
  94. package/dist/index-Bcy00QoN.d.ts.map +1 -0
  95. package/dist/{index-BriU7rfL.d.ts → index-BfxYoHGF.d.ts} +226 -6
  96. package/dist/index-BfxYoHGF.d.ts.map +1 -0
  97. package/dist/{index-D-0mg-eu.d.ts → index-BnqugnsM.d.ts} +31 -11
  98. package/dist/index-BnqugnsM.d.ts.map +1 -0
  99. package/dist/{index-C8a9Dyan.d.ts → index-BwJtNdaj.d.ts} +21 -24
  100. package/dist/index-BwJtNdaj.d.ts.map +1 -0
  101. package/dist/{index-VSN1IZQp.d.ts → index-Yec_iihg.d.ts} +4 -3
  102. package/dist/index-Yec_iihg.d.ts.map +1 -0
  103. package/dist/index.d.ts +34 -31
  104. package/dist/index.js +21 -21
  105. package/dist/{integrity-BHM4voOx.js → integrity-BSs9dgKW.js} +3 -3
  106. package/dist/{integrity-BHM4voOx.js.map → integrity-BSs9dgKW.js.map} +1 -1
  107. package/dist/{journal-CTX5uK-n.js → journal-F3msN9OD.js} +5 -399
  108. package/dist/journal-F3msN9OD.js.map +1 -0
  109. package/dist/journal-file-AekB57Er.js +400 -0
  110. package/dist/journal-file-AekB57Er.js.map +1 -0
  111. package/dist/judge-calibration-DnrbQaXI.d.ts +144 -0
  112. package/dist/judge-calibration-DnrbQaXI.d.ts.map +1 -0
  113. package/dist/{judge-gate-DsoI5tx7.js → judge-gate-MP1rHOB4.js} +2 -2
  114. package/dist/{judge-gate-DsoI5tx7.js.map → judge-gate-MP1rHOB4.js.map} +1 -1
  115. package/dist/ledger-core/index.js +3 -2
  116. package/dist/{ledger-core-24IxvmVY.js → ledger-core-COxrkkZi.js} +2 -2
  117. package/dist/{ledger-core-24IxvmVY.js.map → ledger-core-COxrkkZi.js.map} +1 -1
  118. package/dist/{llm-judge-DzAT7Wka.js → llm-judge-Cc33WVHX.js} +102 -27
  119. package/dist/llm-judge-Cc33WVHX.js.map +1 -0
  120. package/dist/{matrix-DdniPG_M.d.ts → matrix-D0fEU0fq.d.ts} +2 -2
  121. package/dist/{matrix-DdniPG_M.d.ts.map → matrix-D0fEU0fq.d.ts.map} +1 -1
  122. package/dist/meta-eval/index.d.ts +3 -3
  123. package/dist/meta-eval/index.js +6 -6
  124. package/dist/{mint-Ck92efNo.js → mint-g8elU5yW.js} +11 -35
  125. package/dist/mint-g8elU5yW.js.map +1 -0
  126. package/dist/multishot/golden/index.d.ts +1 -1
  127. package/dist/multishot/index.d.ts +2 -2
  128. package/dist/openapi.json +1 -1
  129. package/dist/{outcome-observations-DPkH-LHQ.js → outcome-observations-YFFmdGGW.js} +2 -2
  130. package/dist/{outcome-observations-DPkH-LHQ.js.map → outcome-observations-YFFmdGGW.js.map} +1 -1
  131. package/dist/{paired-arms-DjMEtYI9.js → paired-arms-CMSTbLqX.js} +2 -2
  132. package/dist/{paired-arms-DjMEtYI9.js.map → paired-arms-CMSTbLqX.js.map} +1 -1
  133. package/dist/{paired-promotion-decision-DawN2o0G.d.ts → paired-promotion-decision-BBSxTo-h.d.ts} +2 -2
  134. package/dist/{paired-promotion-decision-DawN2o0G.d.ts.map → paired-promotion-decision-BBSxTo-h.d.ts.map} +1 -1
  135. package/dist/{paired-promotion-decision-Bi9__RQS.js → paired-promotion-decision-BoWHWL1i.js} +2 -2
  136. package/dist/{paired-promotion-decision-Bi9__RQS.js.map → paired-promotion-decision-BoWHWL1i.js.map} +1 -1
  137. package/dist/{paired-promotion-power-D03cUj9E.js → paired-promotion-power-BXH3gzvs.js} +3 -3
  138. package/dist/{paired-promotion-power-D03cUj9E.js.map → paired-promotion-power-BXH3gzvs.js.map} +1 -1
  139. package/dist/{pareto-UzjB3ZBk.js → pareto-B226QGVD.js} +54 -47
  140. package/dist/pareto-B226QGVD.js.map +1 -0
  141. package/dist/pipelines/index.d.ts +1 -1
  142. package/dist/pipelines/index.js +1 -1
  143. package/dist/{prime-protocol-RUPtoYiI.d.ts → prime-protocol-3aHqoxSH.d.ts} +2 -2
  144. package/dist/{prime-protocol-RUPtoYiI.d.ts.map → prime-protocol-3aHqoxSH.d.ts.map} +1 -1
  145. package/dist/profile-cell.d.ts +2 -2
  146. package/dist/{promotion-gate-DG_PSJx_.d.ts → promotion-gate-D-ffRHFQ.d.ts} +3 -3
  147. package/dist/{promotion-gate-DG_PSJx_.d.ts.map → promotion-gate-D-ffRHFQ.d.ts.map} +1 -1
  148. package/dist/{promotion-policy-DCgftbnd.js → promotion-policy-CfgRPGx0.js} +4 -4
  149. package/dist/{promotion-policy-DCgftbnd.js.map → promotion-policy-CfgRPGx0.js.map} +1 -1
  150. package/dist/{proposal-findings-CS6LoGGp.js → proposal-findings-BFtn6Lcx.js} +2 -2
  151. package/dist/{proposal-findings-CS6LoGGp.js.map → proposal-findings-BFtn6Lcx.js.map} +1 -1
  152. package/dist/{registry-BqoX13FD.d.ts → registry-x5n4GeBx.d.ts} +3 -3
  153. package/dist/{registry-BqoX13FD.d.ts.map → registry-x5n4GeBx.d.ts.map} +1 -1
  154. package/dist/{release-confidence-B4Xxdpmn.js → release-confidence-baM0TqCx.js} +2 -2
  155. package/dist/{release-confidence-B4Xxdpmn.js.map → release-confidence-baM0TqCx.js.map} +1 -1
  156. package/dist/reporting.d.ts +13 -6
  157. package/dist/reporting.d.ts.map +1 -1
  158. package/dist/reporting.js +5 -5
  159. package/dist/{summary-report-9kwI6jFQ.d.ts → research-report-CUbXuGX-.d.ts} +6 -121
  160. package/dist/research-report-CUbXuGX-.d.ts.map +1 -0
  161. package/dist/{researcher-BuojS14L.d.ts → researcher-D6D7q9uQ.d.ts} +4 -4
  162. package/dist/{researcher-BuojS14L.d.ts.map → researcher-D6D7q9uQ.d.ts.map} +1 -1
  163. package/dist/{reward-hacking-BYiDFbIl.js → reward-hacking-DNiHskry.js} +2 -2
  164. package/dist/{reward-hacking-BYiDFbIl.js.map → reward-hacking-DNiHskry.js.map} +1 -1
  165. package/dist/{reward-hacking-CIdVwVe4.d.ts → reward-hacking-_CAip56v.d.ts} +2 -2
  166. package/dist/{reward-hacking-CIdVwVe4.d.ts.map → reward-hacking-_CAip56v.d.ts.map} +1 -1
  167. package/dist/rl.d.ts +35 -17
  168. package/dist/rl.d.ts.map +1 -1
  169. package/dist/rl.js +116 -24
  170. package/dist/rl.js.map +1 -1
  171. package/dist/rollout/index.d.ts +5 -6
  172. package/dist/rollout/index.js +7 -6
  173. package/dist/{rollout-B86tqluQ.js → rollout-CCh4eSB3.js} +6 -5
  174. package/dist/{rollout-B86tqluQ.js.map → rollout-CCh4eSB3.js.map} +1 -1
  175. package/dist/{rollout-nodes-DhSPJ2X7.js → rollout-nodes-DzmHlPAC.js} +2 -2
  176. package/dist/rollout-nodes-DzmHlPAC.js.map +1 -0
  177. package/dist/{rubric-predictive-validity-Bbi88Aut.d.ts → rubric-predictive-validity-BTN3nNhC.d.ts} +2 -2
  178. package/dist/{rubric-predictive-validity-Bbi88Aut.d.ts.map → rubric-predictive-validity-BTN3nNhC.d.ts.map} +1 -1
  179. package/dist/{rubric-predictive-validity-DL7gJ51F.js → rubric-predictive-validity-Cln7r56F.js} +2 -2
  180. package/dist/{rubric-predictive-validity-DL7gJ51F.js.map → rubric-predictive-validity-Cln7r56F.js.map} +1 -1
  181. package/dist/{run-record-DTTx9Ktr.js → run-record-CbrxTcCO.js} +2 -2
  182. package/dist/{run-record-DTTx9Ktr.js.map → run-record-CbrxTcCO.js.map} +1 -1
  183. package/dist/{run-record-pBlhZizT.d.ts → run-record-hti3ETmO.d.ts} +2 -2
  184. package/dist/{run-record-pBlhZizT.d.ts.map → run-record-hti3ETmO.d.ts.map} +1 -1
  185. package/dist/{runtime-rollouts-BNrm5nC_.js → runtime-rollouts-C_hBaYXe.js} +279 -55
  186. package/dist/{runtime-rollouts-BNrm5nC_.js.map → runtime-rollouts-C_hBaYXe.js.map} +1 -1
  187. package/dist/{schema-PDKQ_iNE.d.ts → schema-BTTzvMnn.d.ts} +24 -5
  188. package/dist/schema-BTTzvMnn.d.ts.map +1 -0
  189. package/dist/{schema-ChIZfnqY.js → schema-b18jtzZw.js} +56 -3
  190. package/dist/schema-b18jtzZw.js.map +1 -0
  191. package/dist/search/index.d.ts +2 -2
  192. package/dist/search/index.js +2 -2
  193. package/dist/{search-kernel-C4XnLKIW.d.ts → search-kernel-IpyhPDQd.d.ts} +287 -276
  194. package/dist/search-kernel-IpyhPDQd.d.ts.map +1 -0
  195. package/dist/{search-ledger-9liYyZf5.js → search-ledger-D_ENQh0d.js} +4 -4
  196. package/dist/{search-ledger-9liYyZf5.js.map → search-ledger-D_ENQh0d.js.map} +1 -1
  197. package/dist/{search-ledger-file-BhOdgYIt.js → search-ledger-file-J8Xh9pU_.js} +3 -3
  198. package/dist/{search-ledger-file-BhOdgYIt.js.map → search-ledger-file-J8Xh9pU_.js.map} +1 -1
  199. package/dist/{search-shipper-B6tMNx1I.js → search-shipper-BUf7s92U.js} +3 -3
  200. package/dist/{search-shipper-B6tMNx1I.js.map → search-shipper-BUf7s92U.js.map} +1 -1
  201. package/dist/{search-summary-CISbbxyr.js → search-summary-B2RpvkkQ.js} +5 -5
  202. package/dist/{search-summary-CISbbxyr.js.map → search-summary-B2RpvkkQ.js.map} +1 -1
  203. package/dist/{sequential-1-T2oi1_.d.ts → sequential-B-zx24n_.d.ts} +2 -2
  204. package/dist/{sequential-1-T2oi1_.d.ts.map → sequential-B-zx24n_.d.ts.map} +1 -1
  205. package/dist/{sequential-Ko7T-zvu.js → sequential-C6k0Wrb7.js} +3 -3
  206. package/dist/{sequential-Ko7T-zvu.js.map → sequential-C6k0Wrb7.js.map} +1 -1
  207. package/dist/{sequential-9TVb5Nu5.js → sequential-pLr7Ukad.js} +3 -3
  208. package/dist/{sequential-9TVb5Nu5.js.map → sequential-pLr7Ukad.js.map} +1 -1
  209. package/dist/{single-run-lock-CUj2tjxT.js → single-run-lock-BSKsoeQF.js} +2 -2
  210. package/dist/{single-run-lock-CUj2tjxT.js.map → single-run-lock-BSKsoeQF.js.map} +1 -1
  211. package/dist/{skillopt-optimization-method-BtX7xXDd.js → skillopt-optimization-method-BnR2yh-a.js} +11 -11
  212. package/dist/{skillopt-optimization-method-BtX7xXDd.js.map → skillopt-optimization-method-BnR2yh-a.js.map} +1 -1
  213. package/dist/{statistical-heldout-Bx1QUDNy.d.ts → statistical-heldout-AvgLVFp6.d.ts} +6 -6
  214. package/dist/{statistical-heldout-Bx1QUDNy.d.ts.map → statistical-heldout-AvgLVFp6.d.ts.map} +1 -1
  215. package/dist/{statistical-heldout-DLO4Ebos.js → statistical-heldout-BvcAVtof.js} +3 -3
  216. package/dist/{statistical-heldout-DLO4Ebos.js.map → statistical-heldout-BvcAVtof.js.map} +1 -1
  217. package/dist/{statistics-CvvC-MPv.js → statistics-CHs0jlsY.js} +184 -2
  218. package/dist/statistics-CHs0jlsY.js.map +1 -0
  219. package/dist/statistics.d.ts +2 -2
  220. package/dist/statistics.js +2 -2
  221. package/dist/{store-tool-spans-kCDPEwjL.d.ts → store-tool-spans-Bm0-YhHG.d.ts} +5 -5
  222. package/dist/{store-tool-spans-kCDPEwjL.d.ts.map → store-tool-spans-Bm0-YhHG.d.ts.map} +1 -1
  223. package/dist/{summary-report-BEhqoxrA.js → summary-report-BgdIlM_w.js} +3 -3
  224. package/dist/{summary-report-BEhqoxrA.js.map → summary-report-BgdIlM_w.js.map} +1 -1
  225. package/dist/summary-report-figures-BoFCoiOP.d.ts +112 -0
  226. package/dist/summary-report-figures-BoFCoiOP.d.ts.map +1 -0
  227. package/dist/supervisor-run/index.d.ts +32 -8
  228. package/dist/supervisor-run/index.d.ts.map +1 -1
  229. package/dist/supervisor-run/index.js +3 -3
  230. package/dist/{systemone-CSwi1hp-.d.ts → systemone-DPVj7a1g.d.ts} +7 -7
  231. package/dist/{systemone-CSwi1hp-.d.ts.map → systemone-DPVj7a1g.d.ts.map} +1 -1
  232. package/dist/{systemone-review-WpWosn3a.d.ts → systemone-review-CrnsTRav.d.ts} +2 -2
  233. package/dist/{systemone-review-WpWosn3a.d.ts.map → systemone-review-CrnsTRav.d.ts.map} +1 -1
  234. package/dist/systemone.d.ts +3 -3
  235. package/dist/systemone.js +1 -1
  236. package/dist/{tool-groups-Bcasvncd.d.ts → tool-groups-5pgmtTmE.d.ts} +3 -3
  237. package/dist/tool-groups-5pgmtTmE.d.ts.map +1 -0
  238. package/dist/{tool-waste-BqSmmPUz.js → tool-waste-DWSohyd3.js} +2 -2
  239. package/dist/{tool-waste-BqSmmPUz.js.map → tool-waste-DWSohyd3.js.map} +1 -1
  240. package/dist/{trace-questions-DI42jXPj.d.ts → trace-questions-ETZDn5ax.d.ts} +3 -3
  241. package/dist/{trace-questions-DI42jXPj.d.ts.map → trace-questions-ETZDn5ax.d.ts.map} +1 -1
  242. package/dist/trace-repair/index.d.ts +2 -2
  243. package/dist/trace-repair/index.js +1 -1
  244. package/dist/traces.d.ts +4 -4
  245. package/dist/training-admission-xaDOlQ_U.d.ts +31 -0
  246. package/dist/training-admission-xaDOlQ_U.d.ts.map +1 -0
  247. package/dist/{tree-D2cNtu9m.js → tree-DA_WI1aV.js} +5 -5
  248. package/dist/{tree-D2cNtu9m.js.map → tree-DA_WI1aV.js.map} +1 -1
  249. package/dist/{types-DbGSC2No.d.ts → types-Dtt11Ppr.d.ts} +2 -2
  250. package/dist/{types-DbGSC2No.d.ts.map → types-Dtt11Ppr.d.ts.map} +1 -1
  251. package/dist/{types-CLGrB4Sv.d.ts → types-_dfu6Ox2.d.ts} +4 -4
  252. package/dist/{types-CLGrB4Sv.d.ts.map → types-_dfu6Ox2.d.ts.map} +1 -1
  253. package/dist/{types-ByrbgALT.d.ts → types-qJwFZTqa.d.ts} +7 -6
  254. package/dist/types-qJwFZTqa.d.ts.map +1 -0
  255. package/dist/{types-CEgIBy0W.d.ts → types-rf0yhJmW.d.ts} +3 -3
  256. package/dist/{types-CEgIBy0W.d.ts.map → types-rf0yhJmW.d.ts.map} +1 -1
  257. package/dist/wire/index.d.ts +1 -1
  258. package/docs/adopt-stack.md +2 -0
  259. package/docs/concepts.md +4 -1
  260. package/docs/design/statistics-decisions.md +17 -0
  261. package/docs/rollout.md +124 -4
  262. package/docs/search-ledger.md +18 -1
  263. package/docs/trace-analysis.md +11 -3
  264. package/package.json +3 -3
  265. package/dist/agent-profile-cell-3kYxUsK2.d.ts.map +0 -1
  266. package/dist/analyze-runs-BaziIw93.d.ts.map +0 -1
  267. package/dist/benchmark-command-DRAHkn4D.js.map +0 -1
  268. package/dist/exporters-BKZLt1Px.js.map +0 -1
  269. package/dist/exporters-dQKYD_Zo.d.ts +0 -159
  270. package/dist/exporters-dQKYD_Zo.d.ts.map +0 -1
  271. package/dist/failure-cluster-DOoa7CBg.d.ts.map +0 -1
  272. package/dist/hf-dataset-Bv114tzB.js.map +0 -1
  273. package/dist/index-BI9ecONy.d.ts.map +0 -1
  274. package/dist/index-BriU7rfL.d.ts.map +0 -1
  275. package/dist/index-C8a9Dyan.d.ts.map +0 -1
  276. package/dist/index-D-0mg-eu.d.ts.map +0 -1
  277. package/dist/index-DHWFYUVW.d.ts.map +0 -1
  278. package/dist/index-VSN1IZQp.d.ts.map +0 -1
  279. package/dist/journal-CTX5uK-n.js.map +0 -1
  280. package/dist/llm-judge-DzAT7Wka.js.map +0 -1
  281. package/dist/mint-Ck92efNo.js.map +0 -1
  282. package/dist/pareto-UzjB3ZBk.js.map +0 -1
  283. package/dist/reward-ap_R9mCH.d.ts +0 -53
  284. package/dist/reward-ap_R9mCH.d.ts.map +0 -1
  285. package/dist/rollout-nodes-DhSPJ2X7.js.map +0 -1
  286. package/dist/schema-ChIZfnqY.js.map +0 -1
  287. package/dist/schema-PDKQ_iNE.d.ts.map +0 -1
  288. package/dist/search-kernel-C4XnLKIW.d.ts.map +0 -1
  289. package/dist/statistics-CvvC-MPv.js.map +0 -1
  290. package/dist/summary-report-9kwI6jFQ.d.ts.map +0 -1
  291. package/dist/tool-groups-Bcasvncd.d.ts.map +0 -1
  292. package/dist/types-ByrbgALT.d.ts.map +0 -1
@@ -1,9 +1,9 @@
1
- import { a as RunRecord } from "./run-record-pBlhZizT.js";
2
- import { B as FindingTreatment } from "./types-DbGSC2No.js";
3
- import { E as PairedBootstrapResult, I as McNemarResult, R as RiskDifferenceResult, T as PairedBootstrapOptions, r as EProcessState } from "./index-DHWFYUVW.js";
1
+ import { a as RunRecord } from "./run-record-hti3ETmO.js";
2
+ import { B as FindingTreatment } from "./types-Dtt11Ppr.js";
3
+ import { F as PairedBootstrapResult, G as McNemarResult, P as PairedBootstrapOptions, f as EProcessState, q as RiskDifferenceResult } from "./index-Bcy00QoN.js";
4
4
  import { r as LedgerHash } from "./canonical-gLeHiqzd.js";
5
- import { R as Scenario, a as CampaignResult, b as GenerationRecord, h as GateContext, j as MutableSurface, p as Gate, v as GateResult, w as JudgeScore } from "./types-ByrbgALT.js";
6
- import { a as PairedPromotionDecision, i as PairedMcNemarEvidence, r as PairedDecisionStatistic, t as PairedDecisionMethod } from "./paired-promotion-decision-DawN2o0G.js";
5
+ import { R as Scenario, a as CampaignResult, b as GenerationRecord, h as GateContext, j as MutableSurface, p as Gate, v as GateResult, w as JudgeScore } from "./types-qJwFZTqa.js";
6
+ import { a as PairedPromotionDecision, i as PairedMcNemarEvidence, r as PairedDecisionStatistic, t as PairedDecisionMethod } from "./paired-promotion-decision-BBSxTo-h.js";
7
7
  import { z } from "zod";
8
8
  declare const reservationSchema: z.ZodObject<{
9
9
  requestId: z.ZodString;
@@ -997,4 +997,4 @@ declare function dimensionRegressions(candidate: Map<string, Record<string, Judg
997
997
  minProductiveRuns?: number;
998
998
  }): DimensionRegression[];
999
999
  export { paretoPolicy as $, PairRunRecordsResult as A, ArmPopulationSummary as B, signManifest as C, FinalEvidenceError as Ct, MatchedRunRecordPair as D, FinalEvidenceRecord as Dt, MatchedPair as E, FinalEvidenceOutcome as Et, comparePairedArms as F, AxisVerdict as G, PowerPreflightOptions as H, pairArms as I, ObjectiveSource as J, BuildEvidenceVectorOptions as K, pairRunRecords as L, PairedArmsComparison as M, PairedCorrectness as N, PairArmsOptions as O, FinalEvidenceReservation as Ot, PairedMetricDelta as P, buildEvidenceVector as Q, ArmAssignment as R, manifestContentDigest as S, FinalEvidenceConflictError as St, ComparePairedArmsOptions as T, FinalEvidenceMeasurement as Tt, powerPreflight as U, PowerPreflight as V, AxisEvidence as W, PromotionObjective as X, ParetoSignificanceGateOptions as Y, PromotionPolicy as Z, HypothesisManifest as _, AttestationProvenance as _t, dimensionRegressions as a, CampaignEvidenceContext as at, SignedManifestAlgo as b, attest as bt, SequentialDecideFn as c, EvidenceAuthority as ct, SequentialObservation as d, EvidenceReceipt as dt, paretoSignificanceGate as et, SequentialPairedGate as f, EvidenceReceiptVerification as ft, sequentialPairedGate as g, ATTESTATION_ALGORITHM as gt, sequentialDecide as h, verifyEvidenceReceipt as ht, PairedHoldout as i, paretoFrontier as it, PairedArmRow as j, PairArmsResult as k, openFinalEvidenceLedger as kt, SequentialDecideOptions as l, EvidenceAuthorityKind as lt, SequentialStreamState as m, isIndependentEvidence as mt, HeldoutSignificance as n, ParetoResult as nt, heldoutSignificance as o, createCampaignEvidenceReceipt as ot, SequentialPairedGateOptions as p, createEvidenceReceipt as pt, EvidenceVector as q, HeldoutSignificanceOptions as r, dominates as rt, pairHoldout as s, CreateEvidenceReceiptInput as st, DimensionRegression as t, Objective as tt, SequentialGateDecision as u, EvidenceBinding as ut, HypothesisResult as v, AttestationVerification as vt, verifyManifest as w, FinalEvidenceLedger as wt, hashJson as x, verifyAttestation as xt, SignedManifest as y, AttestedReport as yt, ArmPopulationReading as z };
1000
- //# sourceMappingURL=statistical-heldout-Bx1QUDNy.d.ts.map
1000
+ //# sourceMappingURL=statistical-heldout-AvgLVFp6.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"statistical-heldout-Bx1QUDNy.d.ts","names":["_$__evidence_receipt0.EvidenceReceipt"],"sources":["../src/experiment/final-evidence.ts","../src/attestation.ts","../src/experiment/evidence-receipt.ts","../src/experiment/campaign-evidence.ts","../src/pareto.ts","../src/campaign/gates/promotion-policy.ts","../src/campaign/gates/power-preflight.ts","../src/arm-populations.ts","../src/paired-arms.ts","../src/pre-registration.ts","../src/campaign/gates/sequential.ts","../src/campaign/gates/statistical-heldout.ts"],"mappings":";;;;;;;cASM,mBAAiB,EAAA;;;;;;GAQZ,EAAA,KAAA;;KAGC,2BAA2B,EAAE,aAAa;cAEhD,mBAAiB,EAAA;;;GAKZ,EAA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experiment/final-evidence.ts","../src/attestation.ts","../src/experiment/evidence-receipt.ts","../src/experiment/campaign-evidence.ts","../src/pareto.ts","../src/campaign/gates/promotion-policy.ts","../src/campaign/gates/power-preflight.ts","../src/arm-populations.ts","../src/paired-arms.ts","../src/pre-registration.ts","../src/campaign/gates/sequential.ts","../src/campaign/gates/statistical-heldout.ts"],"mappings":";;;;;;;cASM,mBAAiB,EAAA;;;;;;GAQZ,EAAA,KAAA;;KAGC,2BAA2B,EAAE,aAAa;cAEhD,mBAAiB,EAAA;;;GAKZ,EAAA,KAAA;KAEC,2BAA2B,EAAE,aAAa;UAgCrC;EACf,aAAa;EACb,iBAAiB;EACjB;IAAY,aAAa;IAA0B,WAAW;;;KAGpD,qBAAqB;EAC3B;EAAiB,OAAO;;EACxB;EAAkB;IAAS;IAA8C;;;UAE9D;EACf,QACE,OAAO,2BACN,QAAQ;IAAuB,QAAQ;IAAqB;;EAC/D,OACE,mBACA,aAAa,2BACZ,QAAQ;IAAuB,QAAQ;IAAqB;;EAC/D,QAAQ,QAAQ,qBAAqB;;;cAI1B,2BAA2B;WAE3B;EAAA,YAAA,8CACT;;;cAQS,mCAAmC;EAClC,YAAA;;;iBA+HE,wBAAwB;EAAW;IAAiB;;;;;;;;;;;;;;;;;;;;;cCvMvD;UAEI;;EAEf,eAAe;;EAEf;;;EAGA;;EAEA;;EAEA;;;EAGA;;UAGe;;EAEf;EACA,YAAY;EACZ,kBAAkB;;EAElB;;UAGe;EACf;;EAEA;;;;;;;;iBAiBc,OAAO,iBAAiB,YAAY,wBAAwB;;;;;;;;;;iBAoB5D,kBACd,iBACA,UAAU,iBACT;cC1EG;;cAGA;KAQM,gCAAgC;UAS3B;WACN,MAAM;;WAEN;;UAGM;WACN,sBAAsB;;WAEtB;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA,WAAW;;WAEX;;WAEA;;UAGM;WACN,SAAS;WACT,aAAa;;UAGP;WACN;WACA;;UAGM,mCAAmC,K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EAEA;IAAM;IAAa;;;EAEnB,mBAAmB;;EAEnB,SAAS;;EAET;;;;EAIA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;;;;;;;;;iBAkBc,qBACd,WAAW,YAAY,eAAe,cACtC,UAAU,YAAY,eAAe,cACrC,aAAa,aACb,8BACA;EACE;EACA;EACA;EACA;;;EAGA;EACA,8BAA8B;EAC9B;IAED"}
@@ -1,5 +1,5 @@
1
- import { p as pairedBootstrap } from "./statistics-CvvC-MPv.js";
2
- import { t as decidePairedPromotion } from "./paired-promotion-decision-Bi9__RQS.js";
1
+ import { v as pairedBootstrap } from "./statistics-CHs0jlsY.js";
2
+ import { t as decidePairedPromotion } from "./paired-promotion-decision-BoWHWL1i.js";
3
3
  // src/campaign/gates/statistical-heldout.ts
4
4
  /**
5
5
  * Held-out inference pairs execution cells and judge identities before taking
@@ -252,4 +252,4 @@ function dimensionRegressions(candidate, baseline, scenarioIds, criticalDimensio
252
252
  }
253
253
  export { heldoutSignificance as a, dimensionRegressions as i, aggregatePairedHoldout as n, pairHoldout as o, detectScale as r, TIE_WARN_FRACTION as t };
254
254
 
255
- //# sourceMappingURL=statistical-heldout-DLO4Ebos.js.map
255
+ //# sourceMappingURL=statistical-heldout-BvcAVtof.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"statistical-heldout-DLO4Ebos.js","names":[],"sources":["../src/campaign/gates/statistical-heldout.ts"],"sourcesContent":["/**\n * Held-out inference pairs execution cells and judge identities before taking\n * means within registered independent units. Repetitions can improve a unit's\n * precision without increasing n. Ungrouped inference concerns independently\n * sampled execution cells conditional on a fixed scenario roster.\n *\n * The shared paired decision rule selects the estimator and statistical test.\n * Dimension reports retain missing coverage so required safety checks cannot\n * pass through absent evidence. Thresholds use the judge's native score scale.\n */\n\nimport {\n decidePairedPromotion,\n type PairedDecisionMethod,\n type PairedDecisionStatistic,\n type PairedMcNemarEvidence,\n type PairedPromotionDecision,\n} from '../../paired-promotion-decision'\nimport {\n DECISION_PAIRED_DELTA_STATISTIC,\n type PairedBootstrapResult,\n pairedBootstrap,\n} from '../../statistics'\nimport type { JudgeScore } from '../types'\n\n/** Tie fraction at/above which a gate annotates its verdict with the tie share.\n * Tie-domination of the median bites structurally at >= 0.5 (the median is then\n * 0 by construction); 0.4 is a softer warn threshold that flags a run APPROACHING\n * that regime, so an operator sees it before the median goes fully blind. */\nexport const TIE_WARN_FRACTION = 0.4\n\nexport interface PairedHoldout {\n /** Baseline scalar per paired cell (same order as `after`/`cellIds`). */\n before: number[]\n /** Candidate scalar per paired cell. */\n after: number[]\n /** The full cellIds (`scenario:rep`) that paired, in order. */\n cellIds: string[]\n}\n\n/** Campaign cell IDs append a numeric repetition after the scenario's full ID. */\nfunction scenarioIdFromCellId(cellId: string): string {\n const separator = cellId.lastIndexOf(':')\n const repetition = cellId.slice(separator + 1)\n if (\n separator < 1 ||\n cellId.trim() !== cellId ||\n !/^(0|[1-9]\\d*)$/.test(repetition) ||\n !Number.isSafeInteger(Number(repetition))\n ) {\n throw new Error(`pairHoldout: malformed cellId '${cellId}'; expected scenarioId:rep`)\n }\n return cellId.slice(0, separator)\n}\n\n/** Preserve cell pairing before taking equal-weight independent-unit means. */\nexport function aggregatePairedHoldout(\n paired: PairedHoldout,\n independentUnitByScenarioId?: ReadonlyMap<string, string>,\n): { before: number[]; after: number[]; unitIds: string[] } {\n if (\n paired.before.length !== paired.after.length ||\n paired.before.length !== paired.cellIds.length\n ) {\n throw new Error('aggregatePairedHoldout: scores and cellIds must have the same length')\n }\n if (new Set(paired.cellIds).size !== paired.cellIds.length) {\n throw new Error('aggregatePairedHoldout: duplicate cellIds cannot count as new observations')\n }\n if (\n paired.before.some((value) => !Number.isFinite(value)) ||\n paired.after.some((value) => !Number.isFinite(value))\n ) {\n throw new Error('aggregatePairedHoldout: paired scores must be finite')\n }\n if (independentUnitByScenarioId === undefined) {\n return { before: [...paired.before], after: [...paired.after], unitIds: [...paired.cellIds] }\n }\n const scenarioIds = paired.cellIds.map(scenarioIdFromCellId)\n const groups = new Map<string, { before: number; after: number; n: number }>()\n for (let i = 0; i < paired.cellIds.length; i++) {\n const scenarioId = scenarioIds[i]!\n const unitId = independentUnitByScenarioId.get(scenarioId)\n if (typeof unitId !== 'string' || unitId.length === 0 || unitId.trim() !== unitId) {\n throw new Error(\n `aggregatePairedHoldout: missing independent unit for scenario '${scenarioId}'`,\n )\n }\n const group = groups.get(unitId) ?? { before: 0, after: 0, n: 0 }\n group.before += paired.before[i]!\n group.after += paired.after[i]!\n group.n += 1\n groups.set(unitId, group)\n }\n const unitIds = [...groups.keys()].sort()\n return {\n before: unitIds.map((id) => groups.get(id)!.before / groups.get(id)!.n),\n after: unitIds.map((id) => groups.get(id)!.after / groups.get(id)!.n),\n unitIds,\n }\n}\n\n/**\n * Pair candidate vs baseline holdout observations by FULL cellId. `select`\n * pulls the scalar from a cell's judge reports (composite, or a named\n * dimension); a cell contributes the mean of `select` across its judges. Cells\n * whose scenario is not in `scenarioIds`, or where `select` is undefined for\n * every judge on both sides, are skipped. The selected judge IDs must agree\n * within each pair. Throws when the two maps disagree on holdout cell IDs — a\n * load-bearing invariant: the baseline + winner holdout campaigns run the same\n * scenarios with the same seed base, so their cellIds MUST align; a mismatch\n * means a silent pairing bug, not a soft fallback.\n */\nexport function pairHoldout(\n candidate: Map<string, Record<string, JudgeScore>>,\n baseline: Map<string, Record<string, JudgeScore>>,\n scenarioIds: Set<string>,\n select: (s: JudgeScore) => number | undefined,\n): PairedHoldout {\n const cellValues = (\n byCell: Map<string, Record<string, JudgeScore>>,\n cellId: string,\n ): Map<string, number> => {\n const scores = byCell.get(cellId)\n const values = new Map<string, number>()\n if (!scores) return values\n for (const [judgeId, s] of Object.entries(scores)) {\n if (s.failed === true) {\n throw new Error(`pairHoldout: cell '${cellId}' contains a failed judge score`)\n }\n const v = select(s)\n if (typeof v === 'number' && !Number.isFinite(v)) {\n throw new Error(`pairHoldout: cell '${cellId}' contains a non-finite selected score`)\n }\n if (typeof v === 'number') values.set(judgeId, v)\n }\n return values\n }\n\n const inScope = (cellId: string) => scenarioIds.has(scenarioIdFromCellId(cellId))\n const candCells = [...candidate.keys()].filter(inScope).sort()\n const baseCells = [...baseline.keys()].filter(inScope).sort()\n // Alignment invariant — the holdout campaigns share scenarios + seed, so the\n // cell sets must be identical. Differ ⇒ a real pairing bug; fail loud.\n if (candCells.length !== baseCells.length || candCells.some((c, i) => c !== baseCells[i])) {\n throw new Error(\n `pairHoldout: candidate/baseline holdout cells do not align — ` +\n `candidate=[${candCells.join(',')}] baseline=[${baseCells.join(',')}]. ` +\n `Both holdout campaigns must run the same scenarios with the same seed base.`,\n )\n }\n\n const before: number[] = []\n const after: number[] = []\n const cellIds: string[] = []\n for (const cellId of candCells) {\n const b = cellValues(baseline, cellId)\n const a = cellValues(candidate, cellId)\n // A scalar absent on both sides means that dimension was not scored. A\n // one-sided absence is asymmetric evidence loss, never a row to discard.\n if (b.size === 0 && a.size === 0) continue\n if (b.size === 0 || a.size === 0) {\n throw new Error(`pairHoldout: cell '${cellId}' has a selected score on only one arm`)\n }\n if (b.size !== a.size || [...b.keys()].some((id) => !a.has(id))) {\n throw new Error(`pairHoldout: cell '${cellId}' selected judge IDs do not align`)\n }\n const judgeIds = [...b.keys()].sort()\n before.push(meanSelectedScores(judgeIds.map((id) => b.get(id)!)))\n after.push(meanSelectedScores(judgeIds.map((id) => a.get(id)!)))\n cellIds.push(cellId)\n }\n return { before, after, cellIds }\n}\n\nfunction meanSelectedScores(values: number[]): number {\n const first = values[0]!\n // Summing identical fractional scores can round their mean outside the\n // declared binary support. An agreeing judge set preserves its exact value.\n return values.every((value) => value === first)\n ? first\n : values.reduce((sum, value) => sum + value, 0) / values.length\n}\n\nexport interface HeldoutSignificance {\n paired: PairedHoldout\n /**\n * The paired bootstrap on the requested statistic (MEAN by default — see the\n * tie note on `heldoutSignificance`).\n *\n * DIAGNOSTIC, not necessarily the interval the verdict keyed on. On a\n * two-point (pass/fail) outcome the decision routes to Tango's score interval\n * instead, because a percentile bootstrap of the mean over a three-atom\n * lattice is not a valid interval at a nonzero margin. Read\n * `decision.low`/`decision.high` for the interval that actually decided, and\n * `decisionStatistic` for which one it is.\n */\n bootstrap: PairedBootstrapResult\n /** The MEDIAN paired-delta bootstrap, reported as a diagnostic. When many\n * scenarios are tied (both sides solve them), the median is pinned near 0\n * regardless of the mean lift — comparing the two exposes tie-domination. */\n medianBootstrap: PairedBootstrapResult\n /**\n * The full promotion decision: which estimator the outcome's shape admits,\n * the interval it produced, McNemar's exact veto on the two-point path, and\n * whether the interval was zero-width (no evidence in either direction). The\n * single source of `significant`.\n */\n decision: PairedPromotionDecision\n /** Which paired estimator the verdict was decided on. */\n decisionStatistic: PairedDecisionStatistic\n /** McNemar's exact evidence on the two-point path; null otherwise. */\n mcnemar: PairedMcNemarEvidence | null\n /** Fraction of paired observations that are exact ties (|delta| < 1e-9). A\n * high tie fraction is WHY a median-based gate would have missed a real lift;\n * it is the observability the tie fix adds. */\n tieFraction: number\n /** Number of paired observation units, after configured aggregation. */\n n: number\n /** Original matched execution cells, before aggregation. */\n pairedCellN: number\n observationUnit: 'registered' | 'cell'\n /** Registered unit IDs, or cell IDs on the ungrouped path. */\n unitIds: string[]\n /** Effective minimum for the requested target and chosen estimator. */\n minimumRequired: number\n /** Statistical method that carried the decision. */\n decisionMethod: PairedDecisionMethod\n /** Exact one-sided p-value on the small-sample path; otherwise null. */\n pValue: number | null\n /** True iff n >= minimumRequired, the DECIDING interval has nonzero width,\n * its lower bound clears the threshold, and McNemar's exact test does not\n * veto at a non-negative threshold. */\n significant: boolean\n /** Set when n < minimumRequired — too little evidence to claim significance. */\n fewRuns: boolean\n}\n\nexport interface HeldoutSignificanceOptions {\n deltaThreshold?: number\n minProductiveRuns?: number\n confidence?: number\n resamples?: number\n /** Fixed by default for a deterministic, reproducible gate verdict. */\n seed?: number\n statistic?: 'mean' | 'median'\n /** Group full cell pairs into equal-weight independent units before inference. */\n independentUnitByScenarioId?: ReadonlyMap<string, string>\n}\n\n/**\n * Significance of the held-out composite lift: ship only when the lower bound\n * of the interval the outcome's shape ADMITS exceeds `deltaThreshold` (default\n * 0 ⇒ \"confidently positive\"). Interpret `deltaThreshold` in the judge's native\n * scale.\n *\n * The decision is delegated whole to {@link decidePairedPromotion}, the one\n * copy of the rule (`src/paired-promotion-decision.ts`), which `HeldOutGate`\n * also calls. That module's header carries the measurements; the short version\n * is three guards a bare `bootstrap.low > threshold` does not have:\n *\n * - a two-point (pass/fail) outcome decides on Tango's SCORE interval, the\n * only paired-binary construction that stays valid at a nonzero margin;\n * - McNemar's exact test VETOES at any non-negative threshold;\n * - a ZERO-WIDTH interval is refused rather than promoted, in either\n * direction — [0,0] clears every negative threshold and [g,g] clears every\n * threshold below g, and both are an absence of evidence, not a result.\n *\n * Measured on this function before those guards landed, at a nominal 5 %:\n * 14.60 % false promotion at n = 40 on a paired-binary noninferiority boundary,\n * and 88.50 % at n = 6 under a bounded asymmetric null whose true mean paired\n * delta is exactly 0.\n *\n * Continuous mean targets require bootstrap eligibility. Explicit median\n * targets can use the exact sign test at its confidence-dependent minimum.\n */\nexport function heldoutSignificance(\n paired: PairedHoldout,\n opts: HeldoutSignificanceOptions = {},\n): HeldoutSignificance {\n const deltaThreshold = opts.deltaThreshold ?? 0\n const confidence = opts.confidence ?? 0.95\n const resamples = opts.resamples ?? 2000\n const seed = opts.seed ?? 1337\n // DEFAULT to the MEAN paired delta, not the median. The median is destroyed by\n // TIES: whenever both baseline and candidate solve a holdout scenario (a common\n // case once the agent is decent — and INCREASINGLY common as you add holdout\n // scenarios for statistical power), that scenario contributes delta 0. When\n // >=50% of paired cells are ties the median is pinned at 0 regardless of a large,\n // consistent lift on the rest, and the gate holds a genuinely better candidate.\n // (Measured live, supervisor-lab run 6: 40 cells, 20 ties, MEAN +0.177, MEDIAN 0\n // → false hold. Doubling the holdout for \"power\" made it WORSE by adding ties.)\n // The mean equals the reported aggregate lift, ties correctly contribute 0\n // without dominating, and it is the textbook paired-comparison estimator; the\n // median is kept as a reported diagnostic. Callers wanting outlier-robustness at\n // the cost of tie-blindness can still pass `statistic: 'median'`.\n const statistic = opts.statistic ?? 'mean'\n const observations = aggregatePairedHoldout(paired, opts.independentUnitByScenarioId)\n const decision = decidePairedPromotion(observations.before, observations.after, {\n confidence,\n resamples,\n statistic,\n seed,\n threshold: deltaThreshold,\n minPairs: opts.minProductiveRuns,\n })\n // `decision.bootstrap` is null exactly when the score interval decided, so\n // the requested-statistic bootstrap is computed here for the diagnostic\n // field. Same two bootstraps as before on every path.\n const bootstrap =\n decision.bootstrap ??\n pairedBootstrap(observations.before, observations.after, {\n confidence,\n resamples,\n statistic,\n seed,\n })\n const medianBootstrap =\n statistic === 'median'\n ? bootstrap\n : pairedBootstrap(observations.before, observations.after, {\n confidence,\n resamples,\n statistic: 'median',\n seed,\n })\n const n = observations.before.length\n let ties = 0\n for (let i = 0; i < n; i += 1) {\n const after = observations.after[i]!\n const before = observations.before[i]!\n if (Math.abs(after - before) < 1e-9) ties += 1\n }\n const tieFraction = n === 0 ? 0 : ties / n\n return {\n paired,\n bootstrap,\n medianBootstrap,\n decision,\n decisionStatistic: decision.statistic,\n mcnemar: decision.mcnemar,\n tieFraction,\n n,\n pairedCellN: paired.cellIds.length,\n observationUnit: opts.independentUnitByScenarioId === undefined ? 'cell' : 'registered',\n unitIds: observations.unitIds,\n minimumRequired: decision.minimumPairs,\n decisionMethod: decision.method,\n pValue: decision.pValue,\n significant: decision.promote,\n fewRuns: !decision.sufficient,\n }\n}\n\nexport interface DimensionRegression {\n dimension: string\n /** Paired bootstrap on (candidate − baseline). DIAGNOSTIC on a pass/fail\n * dimension, where `ci` carries the interval that decided instead. */\n bootstrap: PairedBootstrapResult\n /** Which paired statistic `bootstrap.low` is the lower bound of. `'mean'`\n * unless the caller asked for the median. `bootstrap.median` still carries\n * the median point estimate either way. */\n bootstrapStatistic: 'median' | 'mean'\n /** The interval `regressed` was decided on, in the dimension's native units. */\n ci: { low: number; high: number }\n /** Which estimator produced `ci`. */\n decisionStatistic: PairedDecisionStatistic\n /** McNemar's exact evidence on a pass/fail dimension; null otherwise. */\n mcnemar: PairedMcNemarEvidence | null\n /** `ci` has zero width — no evidence in either direction. */\n indeterminate: boolean\n /** The bootstrap lower bound is below negative tolerance, or the shared\n * paired test supports a drop exceeding tolerance. Missing coverage and\n * insufficient observations are reported separately. */\n regressed: boolean\n tolerance: number\n n: number\n pairedCellN: number\n observationUnit: 'registered' | 'cell'\n /** Statistical minimum for the configured independent observation unit. */\n minimumRequired: number\n fewRuns: boolean\n /** Both arms lack this dimension on these otherwise matched execution cells. */\n missingCellIds: string[]\n /** Configured scenarios with no paired dimension measurement at all. */\n missingScenarioIds: string[]\n}\n\n/** Detect the native scale of a set of scores: 0-100 when any magnitude clears\n * 1.5, else [0,1]. Used to auto-scale the regression tolerance so a default\n * expressed for [0,1] is not silently a no-op on a 0-100 dimension. */\nexport function detectScale(values: number[]): 1 | 100 {\n return values.some((v) => Math.abs(v) > 1.5) ? 100 : 1\n}\n\n/**\n * Report required-dimension evidence after full pairing and optional unit means.\n * A bootstrap floor breach or a shared paired test supporting a drop marks\n * regression. These two criteria are distinct; `ci` records the shared\n * estimator and `bootstrap` records the floor interval. Missing observations\n * and insufficient n remain explicit for the caller's evidence policy.\n * The default tolerance is 0.05 on [0,1] and 5 on a detected 0-100 scale.\n */\nexport function dimensionRegressions(\n candidate: Map<string, Record<string, JudgeScore>>,\n baseline: Map<string, Record<string, JudgeScore>>,\n scenarioIds: Set<string>,\n criticalDimensions: string[],\n opts: {\n tolerance?: number\n confidence?: number\n resamples?: number\n seed?: number\n /** Paired statistic the CI is computed on. Default `'mean'` — see\n * {@link DECISION_PAIRED_DELTA_STATISTIC} for why the median is not. */\n statistic?: 'mean' | 'median'\n independentUnitByScenarioId?: ReadonlyMap<string, string>\n minProductiveRuns?: number\n } = {},\n): DimensionRegression[] {\n const out: DimensionRegression[] = []\n const expectedCellIds = [...baseline.keys()]\n .filter((cellId) => scenarioIds.has(scenarioIdFromCellId(cellId)))\n .sort()\n for (const dim of criticalDimensions) {\n const paired = pairHoldout(candidate, baseline, scenarioIds, (s) => s.dimensions[dim])\n if (paired.before.length === 0) continue // dimension not scored on this judge\n const observations = aggregatePairedHoldout(paired, opts.independentUnitByScenarioId)\n const measuredCells = new Set(paired.cellIds)\n const measuredScenarios = new Set(paired.cellIds.map(scenarioIdFromCellId))\n const tolerance = opts.tolerance ?? 0.05 * detectScale([...paired.before, ...paired.after])\n const bootstrapStatistic = opts.statistic ?? DECISION_PAIRED_DELTA_STATISTIC\n const shared = {\n confidence: opts.confidence ?? 0.95,\n resamples: opts.resamples ?? 2000,\n statistic: bootstrapStatistic,\n seed: opts.seed ?? 1337,\n minPairs: opts.minProductiveRuns,\n }\n const guard = decidePairedPromotion(observations.before, observations.after, shared)\n const regression = decidePairedPromotion(observations.after, observations.before, {\n ...shared,\n threshold: tolerance,\n })\n const bootstrap =\n guard.bootstrap ?? pairedBootstrap(observations.before, observations.after, shared)\n out.push({\n dimension: dim,\n bootstrap,\n bootstrapStatistic,\n ci: { low: guard.low, high: guard.high },\n decisionStatistic: guard.statistic,\n mcnemar: guard.mcnemar,\n indeterminate: guard.indeterminate,\n // Fires on EITHER burden of proof — see `floorBreached` in\n // `promotion-policy.ts` for the same rule and the reasoning. The CI arm\n // is the contract this interface and `default-production-gate`'s reason\n // string both state (\"CI.low < -tolerance\"), read off the DECIDING\n // interval; the exact-test arm adds the small-sample path where the\n // bootstrap interval is descriptive only.\n // The credible-worst-case arm stays on the BOOTSTRAP — see the same\n // decision in `floorBreached` (`promotion-policy.ts`). On a pass/fail\n // dimension the score interval is ±z²/(n+z²) even when every pair is\n // concordant, so reading the floor off it would flag an unchanged safety\n // dimension as regressed at any realistic n. The PROVEN-drop arm does use\n // the shared rule, which is what closes the fail-open hole that mattered:\n // a genuine pass/fail regression is now judged on an interval valid at\n // the nonzero `tolerance`, instead of a bootstrap that is pinned wherever\n // ties dominate.\n regressed: bootstrap.low < -tolerance || regression.promote,\n tolerance,\n n: observations.before.length,\n pairedCellN: paired.cellIds.length,\n observationUnit: opts.independentUnitByScenarioId === undefined ? 'cell' : 'registered',\n minimumRequired: guard.minimumPairs,\n fewRuns: !guard.sufficient,\n missingCellIds: expectedCellIds.filter((cellId) => !measuredCells.has(cellId)),\n missingScenarioIds: [...scenarioIds].filter((id) => !measuredScenarios.has(id)).sort(),\n })\n }\n return out\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,oBAAoB;;AAYjC,SAAS,qBAAqB,QAAwB;CACpD,MAAM,YAAY,OAAO,YAAY,GAAG;CACxC,MAAM,aAAa,OAAO,MAAM,YAAY,CAAC;CAC7C,IACE,YAAY,KACZ,OAAO,KAAK,MAAM,UAClB,CAAC,iBAAiB,KAAK,UAAU,KACjC,CAAC,OAAO,cAAc,OAAO,UAAU,CAAC,GAExC,MAAM,IAAI,MAAM,kCAAkC,OAAO,2BAA2B;CAEtF,OAAO,OAAO,MAAM,GAAG,SAAS;AAClC;;AAGA,SAAgB,uBACd,QACA,6BAC0D;CAC1D,IACE,OAAO,OAAO,WAAW,OAAO,MAAM,UACtC,OAAO,OAAO,WAAW,OAAO,QAAQ,QAExC,MAAM,IAAI,MAAM,sEAAsE;CAExF,IAAI,IAAI,IAAI,OAAO,OAAO,CAAC,CAAC,SAAS,OAAO,QAAQ,QAClD,MAAM,IAAI,MAAM,4EAA4E;CAE9F,IACE,OAAO,OAAO,MAAM,UAAU,CAAC,OAAO,SAAS,KAAK,CAAC,KACrD,OAAO,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,KAAK,CAAC,GAEpD,MAAM,IAAI,MAAM,sDAAsD;CAExE,IAAI,gCAAgC,KAAA,GAClC,OAAO;EAAE,QAAQ,CAAC,GAAG,OAAO,MAAM;EAAG,OAAO,CAAC,GAAG,OAAO,KAAK;EAAG,SAAS,CAAC,GAAG,OAAO,OAAO;CAAE;CAE9F,MAAM,cAAc,OAAO,QAAQ,IA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EACpF,IAAI,KAAK;GACP,WAAW;GACX;GACA;GACA,IAAI;IAAE,KAAK,MAAM;IAAK,MAAM,MAAM;GAAK;GACvC,mBAAmB,MAAM;GACzB,SAAS,MAAM;GACf,eAAe,MAAM;GAgBrB,WAAW,UAAU,MAAM,CAAC,aAAa,WAAW;GACpD;GACA,GAAG,aAAa,OAAO;GACvB,aAAa,OAAO,QAAQ;GAC5B,iBAAiB,KAAK,gCAAgC,KAAA,IAAY,SAAS;GAC3E,iBAAiB,MAAM;GACvB,SAAS,CAAC,MAAM;GAChB,gBAAgB,gBAAgB,QAAQ,WAAW,CAAC,cAAc,IAAI,MAAM,CAAC;GAC7E,oBAAoB,CAAC,GAAG,WAAW,CAAC,CAAC,QAAQ,OAAO,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK;EACvF,CAAC;CACH;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"statistical-heldout-BvcAVtof.js","names":[],"sources":["../src/campaign/gates/statistical-heldout.ts"],"sourcesContent":["/**\n * Held-out inference pairs execution cells and judge identities before taking\n * means within registered independent units. Repetitions can improve a unit's\n * precision without increasing n. Ungrouped inference concerns independently\n * sampled execution cells conditional on a fixed scenario roster.\n *\n * The shared paired decision rule selects the estimator and statistical test.\n * Dimension reports retain missing coverage so required safety checks cannot\n * pass through absent evidence. Thresholds use the judge's native score scale.\n */\n\nimport {\n decidePairedPromotion,\n type PairedDecisionMethod,\n type PairedDecisionStatistic,\n type PairedMcNemarEvidence,\n type PairedPromotionDecision,\n} from '../../paired-promotion-decision'\nimport {\n DECISION_PAIRED_DELTA_STATISTIC,\n type PairedBootstrapResult,\n pairedBootstrap,\n} from '../../statistics'\nimport type { JudgeScore } from '../types'\n\n/** Tie fraction at/above which a gate annotates its verdict with the tie share.\n * Tie-domination of the median bites structurally at >= 0.5 (the median is then\n * 0 by construction); 0.4 is a softer warn threshold that flags a run APPROACHING\n * that regime, so an operator sees it before the median goes fully blind. */\nexport const TIE_WARN_FRACTION = 0.4\n\nexport interface PairedHoldout {\n /** Baseline scalar per paired cell (same order as `after`/`cellIds`). */\n before: number[]\n /** Candidate scalar per paired cell. */\n after: number[]\n /** The full cellIds (`scenario:rep`) that paired, in order. */\n cellIds: string[]\n}\n\n/** Campaign cell IDs append a numeric repetition after the scenario's full ID. */\nfunction scenarioIdFromCellId(cellId: string): string {\n const separator = cellId.lastIndexOf(':')\n const repetition = cellId.slice(separator + 1)\n if (\n separator < 1 ||\n cellId.trim() !== cellId ||\n !/^(0|[1-9]\\d*)$/.test(repetition) ||\n !Number.isSafeInteger(Number(repetition))\n ) {\n throw new Error(`pairHoldout: malformed cellId '${cellId}'; expected scenarioId:rep`)\n }\n return cellId.slice(0, separator)\n}\n\n/** Preserve cell pairing before taking equal-weight independent-unit means. */\nexport function aggregatePairedHoldout(\n paired: PairedHoldout,\n independentUnitByScenarioId?: ReadonlyMap<string, string>,\n): { before: number[]; after: number[]; unitIds: string[] } {\n if (\n paired.before.length !== paired.after.length ||\n paired.before.length !== paired.cellIds.length\n ) {\n throw new Error('aggregatePairedHoldout: scores and cellIds must have the same length')\n }\n if (new Set(paired.cellIds).size !== paired.cellIds.length) {\n throw new Error('aggregatePairedHoldout: duplicate cellIds cannot count as new observations')\n }\n if (\n paired.before.some((value) => !Number.isFinite(value)) ||\n paired.after.some((value) => !Number.isFinite(value))\n ) {\n throw new Error('aggregatePairedHoldout: paired scores must be finite')\n }\n if (independentUnitByScenarioId === undefined) {\n return { before: [...paired.before], after: [...paired.after], unitIds: [...paired.cellIds] }\n }\n const scenarioIds = paired.cellIds.map(scenarioIdFromCellId)\n const groups = new Map<string, { before: number; after: number; n: number }>()\n for (let i = 0; i < paired.cellIds.length; i++) {\n const scenarioId = scenarioIds[i]!\n const unitId = independentUnitByScenarioId.get(scenarioId)\n if (typeof unitId !== 'string' || unitId.length === 0 || unitId.trim() !== unitId) {\n throw new Error(\n `aggregatePairedHoldout: missing independent unit for scenario '${scenarioId}'`,\n )\n }\n const group = groups.get(unitId) ?? { before: 0, after: 0, n: 0 }\n group.before += paired.before[i]!\n group.after += paired.after[i]!\n group.n += 1\n groups.set(unitId, group)\n }\n const unitIds = [...groups.keys()].sort()\n return {\n before: unitIds.map((id) => groups.get(id)!.before / groups.get(id)!.n),\n after: unitIds.map((id) => groups.get(id)!.after / groups.get(id)!.n),\n unitIds,\n }\n}\n\n/**\n * Pair candidate vs baseline holdout observations by FULL cellId. `select`\n * pulls the scalar from a cell's judge reports (composite, or a named\n * dimension); a cell contributes the mean of `select` across its judges. Cells\n * whose scenario is not in `scenarioIds`, or where `select` is undefined for\n * every judge on both sides, are skipped. The selected judge IDs must agree\n * within each pair. Throws when the two maps disagree on holdout cell IDs — a\n * load-bearing invariant: the baseline + winner holdout campaigns run the same\n * scenarios with the same seed base, so their cellIds MUST align; a mismatch\n * means a silent pairing bug, not a soft fallback.\n */\nexport function pairHoldout(\n candidate: Map<string, Record<string, JudgeScore>>,\n baseline: Map<string, Record<string, JudgeScore>>,\n scenarioIds: Set<string>,\n select: (s: JudgeScore) => number | undefined,\n): PairedHoldout {\n const cellValues = (\n byCell: Map<string, Record<string, JudgeScore>>,\n cellId: string,\n ): Map<string, number> => {\n const scores = byCell.get(cellId)\n const values = new Map<string, number>()\n if (!scores) return values\n for (const [judgeId, s] of Object.entries(scores)) {\n if (s.failed === true) {\n throw new Error(`pairHoldout: cell '${cellId}' contains a failed judge score`)\n }\n const v = select(s)\n if (typeof v === 'number' && !Number.isFinite(v)) {\n throw new Error(`pairHoldout: cell '${cellId}' contains a non-finite selected score`)\n }\n if (typeof v === 'number') values.set(judgeId, v)\n }\n return values\n }\n\n const inScope = (cellId: string) => scenarioIds.has(scenarioIdFromCellId(cellId))\n const candCells = [...candidate.keys()].filter(inScope).sort()\n const baseCells = [...baseline.keys()].filter(inScope).sort()\n // Alignment invariant — the holdout campaigns share scenarios + seed, so the\n // cell sets must be identical. Differ ⇒ a real pairing bug; fail loud.\n if (candCells.length !== baseCells.length || candCells.some((c, i) => c !== baseCells[i])) {\n throw new Error(\n `pairHoldout: candidate/baseline holdout cells do not align — ` +\n `candidate=[${candCells.join(',')}] baseline=[${baseCells.join(',')}]. ` +\n `Both holdout campaigns must run the same scenarios with the same seed base.`,\n )\n }\n\n const before: number[] = []\n const after: number[] = []\n const cellIds: string[] = []\n for (const cellId of candCells) {\n const b = cellValues(baseline, cellId)\n const a = cellValues(candidate, cellId)\n // A scalar absent on both sides means that dimension was not scored. A\n // one-sided absence is asymmetric evidence loss, never a row to discard.\n if (b.size === 0 && a.size === 0) continue\n if (b.size === 0 || a.size === 0) {\n throw new Error(`pairHoldout: cell '${cellId}' has a selected score on only one arm`)\n }\n if (b.size !== a.size || [...b.keys()].some((id) => !a.has(id))) {\n throw new Error(`pairHoldout: cell '${cellId}' selected judge IDs do not align`)\n }\n const judgeIds = [...b.keys()].sort()\n before.push(meanSelectedScores(judgeIds.map((id) => b.get(id)!)))\n after.push(meanSelectedScores(judgeIds.map((id) => a.get(id)!)))\n cellIds.push(cellId)\n }\n return { before, after, cellIds }\n}\n\nfunction meanSelectedScores(values: number[]): number {\n const first = values[0]!\n // Summing identical fractional scores can round their mean outside the\n // declared binary support. An agreeing judge set preserves its exact value.\n return values.every((value) => value === first)\n ? first\n : values.reduce((sum, value) => sum + value, 0) / values.length\n}\n\nexport interface HeldoutSignificance {\n paired: PairedHoldout\n /**\n * The paired bootstrap on the requested statistic (MEAN by default — see the\n * tie note on `heldoutSignificance`).\n *\n * DIAGNOSTIC, not necessarily the interval the verdict keyed on. On a\n * two-point (pass/fail) outcome the decision routes to Tango's score interval\n * instead, because a percentile bootstrap of the mean over a three-atom\n * lattice is not a valid interval at a nonzero margin. Read\n * `decision.low`/`decision.high` for the interval that actually decided, and\n * `decisionStatistic` for which one it is.\n */\n bootstrap: PairedBootstrapResult\n /** The MEDIAN paired-delta bootstrap, reported as a diagnostic. When many\n * scenarios are tied (both sides solve them), the median is pinned near 0\n * regardless of the mean lift — comparing the two exposes tie-domination. */\n medianBootstrap: PairedBootstrapResult\n /**\n * The full promotion decision: which estimator the outcome's shape admits,\n * the interval it produced, McNemar's exact veto on the two-point path, and\n * whether the interval was zero-width (no evidence in either direction). The\n * single source of `significant`.\n */\n decision: PairedPromotionDecision\n /** Which paired estimator the verdict was decided on. */\n decisionStatistic: PairedDecisionStatistic\n /** McNemar's exact evidence on the two-point path; null otherwise. */\n mcnemar: PairedMcNemarEvidence | null\n /** Fraction of paired observations that are exact ties (|delta| < 1e-9). A\n * high tie fraction is WHY a median-based gate would have missed a real lift;\n * it is the observability the tie fix adds. */\n tieFraction: number\n /** Number of paired observation units, after configured aggregation. */\n n: number\n /** Original matched execution cells, before aggregation. */\n pairedCellN: number\n observationUnit: 'registered' | 'cell'\n /** Registered unit IDs, or cell IDs on the ungrouped path. */\n unitIds: string[]\n /** Effective minimum for the requested target and chosen estimator. */\n minimumRequired: number\n /** Statistical method that carried the decision. */\n decisionMethod: PairedDecisionMethod\n /** Exact one-sided p-value on the small-sample path; otherwise null. */\n pValue: number | null\n /** True iff n >= minimumRequired, the DECIDING interval has nonzero width,\n * its lower bound clears the threshold, and McNemar's exact test does not\n * veto at a non-negative threshold. */\n significant: boolean\n /** Set when n < minimumRequired — too little evidence to claim significance. */\n fewRuns: boolean\n}\n\nexport interface HeldoutSignificanceOptions {\n deltaThreshold?: number\n minProductiveRuns?: number\n confidence?: number\n resamples?: number\n /** Fixed by default for a deterministic, reproducible gate verdict. */\n seed?: number\n statistic?: 'mean' | 'median'\n /** Group full cell pairs into equal-weight independent units before inference. */\n independentUnitByScenarioId?: ReadonlyMap<string, string>\n}\n\n/**\n * Significance of the held-out composite lift: ship only when the lower bound\n * of the interval the outcome's shape ADMITS exceeds `deltaThreshold` (default\n * 0 ⇒ \"confidently positive\"). Interpret `deltaThreshold` in the judge's native\n * scale.\n *\n * The decision is delegated whole to {@link decidePairedPromotion}, the one\n * copy of the rule (`src/paired-promotion-decision.ts`), which `HeldOutGate`\n * also calls. That module's header carries the measurements; the short version\n * is three guards a bare `bootstrap.low > threshold` does not have:\n *\n * - a two-point (pass/fail) outcome decides on Tango's SCORE interval, the\n * only paired-binary construction that stays valid at a nonzero margin;\n * - McNemar's exact test VETOES at any non-negative threshold;\n * - a ZERO-WIDTH interval is refused rather than promoted, in either\n * direction — [0,0] clears every negative threshold and [g,g] clears every\n * threshold below g, and both are an absence of evidence, not a result.\n *\n * Measured on this function before those guards landed, at a nominal 5 %:\n * 14.60 % false promotion at n = 40 on a paired-binary noninferiority boundary,\n * and 88.50 % at n = 6 under a bounded asymmetric null whose true mean paired\n * delta is exactly 0.\n *\n * Continuous mean targets require bootstrap eligibility. Explicit median\n * targets can use the exact sign test at its confidence-dependent minimum.\n */\nexport function heldoutSignificance(\n paired: PairedHoldout,\n opts: HeldoutSignificanceOptions = {},\n): HeldoutSignificance {\n const deltaThreshold = opts.deltaThreshold ?? 0\n const confidence = opts.confidence ?? 0.95\n const resamples = opts.resamples ?? 2000\n const seed = opts.seed ?? 1337\n // DEFAULT to the MEAN paired delta, not the median. The median is destroyed by\n // TIES: whenever both baseline and candidate solve a holdout scenario (a common\n // case once the agent is decent — and INCREASINGLY common as you add holdout\n // scenarios for statistical power), that scenario contributes delta 0. When\n // >=50% of paired cells are ties the median is pinned at 0 regardless of a large,\n // consistent lift on the rest, and the gate holds a genuinely better candidate.\n // (Measured live, supervisor-lab run 6: 40 cells, 20 ties, MEAN +0.177, MEDIAN 0\n // → false hold. Doubling the holdout for \"power\" made it WORSE by adding ties.)\n // The mean equals the reported aggregate lift, ties correctly contribute 0\n // without dominating, and it is the textbook paired-comparison estimator; the\n // median is kept as a reported diagnostic. Callers wanting outlier-robustness at\n // the cost of tie-blindness can still pass `statistic: 'median'`.\n const statistic = opts.statistic ?? 'mean'\n const observations = aggregatePairedHoldout(paired, opts.independentUnitByScenarioId)\n const decision = decidePairedPromotion(observations.before, observations.after, {\n confidence,\n resamples,\n statistic,\n seed,\n threshold: deltaThreshold,\n minPairs: opts.minProductiveRuns,\n })\n // `decision.bootstrap` is null exactly when the score interval decided, so\n // the requested-statistic bootstrap is computed here for the diagnostic\n // field. Same two bootstraps as before on every path.\n const bootstrap =\n decision.bootstrap ??\n pairedBootstrap(observations.before, observations.after, {\n confidence,\n resamples,\n statistic,\n seed,\n })\n const medianBootstrap =\n statistic === 'median'\n ? bootstrap\n : pairedBootstrap(observations.before, observations.after, {\n confidence,\n resamples,\n statistic: 'median',\n seed,\n })\n const n = observations.before.length\n let ties = 0\n for (let i = 0; i < n; i += 1) {\n const after = observations.after[i]!\n const before = observations.before[i]!\n if (Math.abs(after - before) < 1e-9) ties += 1\n }\n const tieFraction = n === 0 ? 0 : ties / n\n return {\n paired,\n bootstrap,\n medianBootstrap,\n decision,\n decisionStatistic: decision.statistic,\n mcnemar: decision.mcnemar,\n tieFraction,\n n,\n pairedCellN: paired.cellIds.length,\n observationUnit: opts.independentUnitByScenarioId === undefined ? 'cell' : 'registered',\n unitIds: observations.unitIds,\n minimumRequired: decision.minimumPairs,\n decisionMethod: decision.method,\n pValue: decision.pValue,\n significant: decision.promote,\n fewRuns: !decision.sufficient,\n }\n}\n\nexport interface DimensionRegression {\n dimension: string\n /** Paired bootstrap on (candidate − baseline). DIAGNOSTIC on a pass/fail\n * dimension, where `ci` carries the interval that decided instead. */\n bootstrap: PairedBootstrapResult\n /** Which paired statistic `bootstrap.low` is the lower bound of. `'mean'`\n * unless the caller asked for the median. `bootstrap.median` still carries\n * the median point estimate either way. */\n bootstrapStatistic: 'median' | 'mean'\n /** The interval `regressed` was decided on, in the dimension's native units. */\n ci: { low: number; high: number }\n /** Which estimator produced `ci`. */\n decisionStatistic: PairedDecisionStatistic\n /** McNemar's exact evidence on a pass/fail dimension; null otherwise. */\n mcnemar: PairedMcNemarEvidence | null\n /** `ci` has zero width — no evidence in either direction. */\n indeterminate: boolean\n /** The bootstrap lower bound is below negative tolerance, or the shared\n * paired test supports a drop exceeding tolerance. Missing coverage and\n * insufficient observations are reported separately. */\n regressed: boolean\n tolerance: number\n n: number\n pairedCellN: number\n observationUnit: 'registered' | 'cell'\n /** Statistical minimum for the configured independent observation unit. */\n minimumRequired: number\n fewRuns: boolean\n /** Both arms lack this dimension on these otherwise matched execution cells. */\n missingCellIds: string[]\n /** Configured scenarios with no paired dimension measurement at all. */\n missingScenarioIds: string[]\n}\n\n/** Detect the native scale of a set of scores: 0-100 when any magnitude clears\n * 1.5, else [0,1]. Used to auto-scale the regression tolerance so a default\n * expressed for [0,1] is not silently a no-op on a 0-100 dimension. */\nexport function detectScale(values: number[]): 1 | 100 {\n return values.some((v) => Math.abs(v) > 1.5) ? 100 : 1\n}\n\n/**\n * Report required-dimension evidence after full pairing and optional unit means.\n * A bootstrap floor breach or a shared paired test supporting a drop marks\n * regression. These two criteria are distinct; `ci` records the shared\n * estimator and `bootstrap` records the floor interval. Missing observations\n * and insufficient n remain explicit for the caller's evidence policy.\n * The default tolerance is 0.05 on [0,1] and 5 on a detected 0-100 scale.\n */\nexport function dimensionRegressions(\n candidate: Map<string, Record<string, JudgeScore>>,\n baseline: Map<string, Record<string, JudgeScore>>,\n scenarioIds: Set<string>,\n criticalDimensions: string[],\n opts: {\n tolerance?: number\n confidence?: number\n resamples?: number\n seed?: number\n /** Paired statistic the CI is computed on. Default `'mean'` — see\n * {@link DECISION_PAIRED_DELTA_STATISTIC} for why the median is not. */\n statistic?: 'mean' | 'median'\n independentUnitByScenarioId?: ReadonlyMap<string, string>\n minProductiveRuns?: number\n } = {},\n): DimensionRegression[] {\n const out: DimensionRegression[] = []\n const expectedCellIds = [...baseline.keys()]\n .filter((cellId) => scenarioIds.has(scenarioIdFromCellId(cellId)))\n .sort()\n for (const dim of criticalDimensions) {\n const paired = pairHoldout(candidate, baseline, scenarioIds, (s) => s.dimensions[dim])\n if (paired.before.length === 0) continue // dimension not scored on this judge\n const observations = aggregatePairedHoldout(paired, opts.independentUnitByScenarioId)\n const measuredCells = new Set(paired.cellIds)\n const measuredScenarios = new Set(paired.cellIds.map(scenarioIdFromCellId))\n const tolerance = opts.tolerance ?? 0.05 * detectScale([...paired.before, ...paired.after])\n const bootstrapStatistic = opts.statistic ?? DECISION_PAIRED_DELTA_STATISTIC\n const shared = {\n confidence: opts.confidence ?? 0.95,\n resamples: opts.resamples ?? 2000,\n statistic: bootstrapStatistic,\n seed: opts.seed ?? 1337,\n minPairs: opts.minProductiveRuns,\n }\n const guard = decidePairedPromotion(observations.before, observations.after, shared)\n const regression = decidePairedPromotion(observations.after, observations.before, {\n ...shared,\n threshold: tolerance,\n })\n const bootstrap =\n guard.bootstrap ?? pairedBootstrap(observations.before, observations.after, shared)\n out.push({\n dimension: dim,\n bootstrap,\n bootstrapStatistic,\n ci: { low: guard.low, high: guard.high },\n decisionStatistic: guard.statistic,\n mcnemar: guard.mcnemar,\n indeterminate: guard.indeterminate,\n // Fires on EITHER burden of proof — see `floorBreached` in\n // `promotion-policy.ts` for the same rule and the reasoning. The CI arm\n // is the contract this interface and `default-production-gate`'s reason\n // string both state (\"CI.low < -tolerance\"), read off the DECIDING\n // interval; the exact-test arm adds the small-sample path where the\n // bootstrap interval is descriptive only.\n // The credible-worst-case arm stays on the BOOTSTRAP — see the same\n // decision in `floorBreached` (`promotion-policy.ts`). On a pass/fail\n // dimension the score interval is ±z²/(n+z²) even when every pair is\n // concordant, so reading the floor off it would flag an unchanged safety\n // dimension as regressed at any realistic n. The PROVEN-drop arm does use\n // the shared rule, which is what closes the fail-open hole that mattered:\n // a genuine pass/fail regression is now judged on an interval valid at\n // the nonzero `tolerance`, instead of a bootstrap that is pinned wherever\n // ties dominate.\n regressed: bootstrap.low < -tolerance || regression.promote,\n tolerance,\n n: observations.before.length,\n pairedCellN: paired.cellIds.length,\n observationUnit: opts.independentUnitByScenarioId === undefined ? 'cell' : 'registered',\n minimumRequired: guard.minimumPairs,\n fewRuns: !guard.sufficient,\n missingCellIds: expectedCellIds.filter((cellId) => !measuredCells.has(cellId)),\n missingScenarioIds: [...scenarioIds].filter((id) => !measuredScenarios.has(id)).sort(),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BAAiB,KAAK,gCAAgC,KAAA,IAAY,SAAS;GAC3E,iBAAiB,MAAM;GACvB,SAAS,CAAC,MAAM;GAChB,gBAAgB,gBAAgB,QAAQ,WAAW,CAAC,cAAc,IAAI,MAAM,CAAC;GAC7E,oBAAoB,CAAC,GAAG,WAAW,CAAC,CAAC,QAAQ,OAAO,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK;EACvF,CAAC;CACH;CACA,OAAO;AACT"}
@@ -2629,6 +2629,188 @@ function assertResumable(resume, params) {
2629
2629
  }
2630
2630
  return resume;
2631
2631
  }
2632
- export { meanConfidenceInterval as $, fisherExactTwoSided as A, summarizeDistribution as B, passAtK as C, holm as D, bonferroni as E, cliffsDelta as F, nominalAgreement as G, corpusInterRaterAgreement as H, cohensD as I, continuousAgreement as J, calibrateJudge as K, interpretCliffs as L, normalTwoSidedPValue as M, studentTTwoSidedPValue as N, chiSquared as O, twoByTwoPValue as P, confidenceInterval as Q, pairedCohensDz as R, pairedRiskDifferenceScore as S, benjaminiHochberg as T, corpusInterRaterAgreementFromJudgeScores as U, rocAuc as V, interRaterReliability as W, selfPreference as X, positionalBias as Y, verbosityBias as Z, independentRiskDifference as _, placeboBand as _t, wilcoxonSignedRank as a, summarizeNumberSeries as at, pairedRiskDifference as b, pairedMde as c, mean as ct, BOOTSTRAP_GATE_MIN_N as d, makeRng as dt, partialCredit as et, DECISION_PAIRED_DELTA_STATISTIC as f, medianInPlace as ft, pairedTTest as g, clusterBootstrap as gt, pairedSignTest as h, DEFAULT_BOOTSTRAP_SEED as ht, mannWhitneyU as i, studentTCritical as it, linearRegressionSlope as j, chiSquaredPValue as k, requiredPairedSampleSize as l, meanOrNull as lt, pairedDeltaTieFraction as m, zQuantile as mt, sampleMedian as n, ranks as nt, mcnemarPower as o, weightedComposite as ot, pairedBootstrap as p, seedFromData as pt, calibrateJudgeContinuous as q, summarizeSample as r, spearmanR as rt, mcnemarRequiredN as s, weightedMean as st, eProcess as t, pearsonR as tt, requiredSampleSize as u, meanOrZero as ut, mcnemar as v, studentTCdf as vt, wilson as w, pairedRiskDifferenceExact as x, pairedBinaryScale as y, studentTQuantile as yt, percentileNearestRank as z };
2632
+ // src/statistics/clustered-paired.ts
2633
+ const groupsOf = (items, cluster) => {
2634
+ const groups = /* @__PURE__ */ new Map();
2635
+ items.forEach((item, index) => {
2636
+ const key = cluster(item, index);
2637
+ if (typeof key !== "string" || !key) throw new ValidationError("clustered statistics require a string cluster id");
2638
+ groups.set(key, [...groups.get(key) ?? [], item]);
2639
+ });
2640
+ return [...groups.values()];
2641
+ };
2642
+ /**
2643
+ * Leave-one-cluster-out jackknife: theta +- t_{(1+level)/2, G-1} * sqrt((G-1)/G * sum_g (theta_(g) - mean)^2).
2644
+ * Deterministic, so its tails carry no resampling noise; null bounds below two clusters or when the full statistic or any required deletion is non-finite.
2645
+ */
2646
+ function clusterJackknife(items, cluster, statistic, { level = .95 } = {}) {
2647
+ if (!(level > 0 && level < 1)) throw new ValidationError("clusterJackknife: level must be in (0,1)");
2648
+ const groups = groupsOf(items, cluster);
2649
+ const theta = statistic([...items]);
2650
+ const estimate = Number.isFinite(theta) ? theta : null;
2651
+ if (groups.length < 2 || estimate === null) return {
2652
+ estimate,
2653
+ low: null,
2654
+ high: null,
2655
+ clusters: groups.length
2656
+ };
2657
+ const leave = groups.map((_, g) => statistic(groups.flatMap((rows, h) => h === g ? [] : rows)));
2658
+ if (leave.some((value) => !Number.isFinite(value))) return {
2659
+ estimate,
2660
+ low: null,
2661
+ high: null,
2662
+ clusters: groups.length
2663
+ };
2664
+ const mean = leave.reduce((sum, value) => sum + value, 0) / leave.length;
2665
+ const g = groups.length;
2666
+ const half = studentTQuantile((1 + level) / 2, g - 1) * Math.sqrt((g - 1) / g * leave.reduce((sum, value) => sum + (value - mean) ** 2, 0));
2667
+ const low = estimate - half;
2668
+ const high = estimate + half;
2669
+ return Number.isFinite(mean) && Number.isFinite(half) && Number.isFinite(low) && Number.isFinite(high) ? {
2670
+ estimate,
2671
+ low,
2672
+ high,
2673
+ clusters: g
2674
+ } : {
2675
+ estimate,
2676
+ low: null,
2677
+ high: null,
2678
+ clusters: g
2679
+ };
2680
+ }
2681
+ /**
2682
+ * Two-sided cluster sign-flip randomization test of a zero mean difference: each cluster's summed difference keeps or
2683
+ * flips its sign at random; p = (1 + #|mean*| >= |mean|) / (1 + resamples). Its level is exact when the null distribution
2684
+ * of each cluster's sum is symmetric about zero, which a t interval on few clusters of binary pairs is not at small alpha.
2685
+ */
2686
+ function clusterSignFlipTest(pairs, { resamples = 4999, seed = 1 } = {}) {
2687
+ if (!Number.isSafeInteger(resamples) || resamples < 1) throw new ValidationError("clusterSignFlipTest: resamples must be a positive integer");
2688
+ if (pairs.some((pair) => !Number.isFinite(pair.delta))) throw new ValidationError("clusterSignFlipTest: paired differences must be finite");
2689
+ const sums = groupsOf(pairs, (pair) => pair.cluster).map((rows) => rows.reduce((sum, pair) => sum + pair.delta, 0));
2690
+ if (sums.some((sum) => !Number.isFinite(sum))) throw new ValidationError("clusterSignFlipTest: clustered sums must be finite");
2691
+ if (sums.length < 2) return null;
2692
+ const observed = Math.abs(sums.reduce((sum, value) => sum + value, 0) / pairs.length);
2693
+ if (!Number.isFinite(observed)) throw new ValidationError("clusterSignFlipTest: observed total must be finite");
2694
+ const rng = mulberry32(seed);
2695
+ let extreme = 0;
2696
+ for (let b = 0; b < resamples; b++) {
2697
+ let total = 0;
2698
+ for (const sum of sums) total += rng() < .5 ? -sum : sum;
2699
+ if (!Number.isFinite(total)) throw new ValidationError("clusterSignFlipTest: permutation total must be finite");
2700
+ if (Math.abs(total / pairs.length) >= observed - 1e-12) extreme++;
2701
+ }
2702
+ return (1 + extreme) / (1 + resamples);
2703
+ }
2704
+ /** Mean paired difference with its cluster jackknife interval and cluster sign-flip p-value. */
2705
+ function clusteredPairedContrast(pairs, { level = .95, resamples, seed } = {}) {
2706
+ const mean = (sample) => sample.length ? sample.reduce((sum, pair) => sum + pair.delta, 0) / sample.length : NaN;
2707
+ return {
2708
+ pairs: pairs.length,
2709
+ ...clusterJackknife(pairs, (pair) => pair.cluster, mean, { level }),
2710
+ pValue: clusterSignFlipTest(pairs, {
2711
+ resamples,
2712
+ seed
2713
+ })
2714
+ };
2715
+ }
2716
+ function validateBinaryDesign({ pairs, clusters, controlRate, icc, alpha, power = .8 }) {
2717
+ if (!Number.isSafeInteger(pairs) || !Number.isSafeInteger(clusters) || clusters < 2 || pairs < clusters) throw new ValidationError("clustered binary design requires integer pairs >= clusters >= 2");
2718
+ if (!(controlRate >= 0 && controlRate <= 1 && icc >= 0 && icc <= 1)) throw new ValidationError("clustered binary design controlRate and icc must be in [0,1]");
2719
+ if (!(alpha > 0 && alpha < 1 && power > 0 && power < 1)) throw new ValidationError("clustered binary design alpha and power must be in (0,1)");
2720
+ }
2721
+ /**
2722
+ * Planning paired success-rate difference with arm-specific cluster effects and no within-pair correlation.
2723
+ * delta = z * sqrt((p*(1-p) + (p+delta)*(1-p-delta)) * design / pairs).
2724
+ * Solves the variance fixed point; null means no finite positive solution in the attainable interval.
2725
+ */
2726
+ function clusteredBinaryMde({ pairs, clusters, controlRate, icc, alpha, power = .8 }) {
2727
+ validateBinaryDesign({
2728
+ pairs,
2729
+ clusters,
2730
+ controlRate,
2731
+ icc,
2732
+ alpha,
2733
+ power
2734
+ });
2735
+ const design = 1 + (pairs / clusters - 1) * icc;
2736
+ const z = studentTQuantile(1 - alpha / 2, clusters - 1) + studentTQuantile(power, clusters - 1);
2737
+ const a = 1 + pairs / (z * z * design);
2738
+ const b = 1 - 2 * controlRate;
2739
+ const pq = controlRate * (1 - controlRate);
2740
+ const d = Math.hypot(b, Math.sqrt(8 * a * pq));
2741
+ const delta = b >= 0 ? (b + d) / (2 * a) : 4 * pq / (d - b);
2742
+ const detectable = Number.isFinite(z) && z > 0 && delta > 0 && delta <= 1 - controlRate;
2743
+ return {
2744
+ designEffect: design,
2745
+ mde: detectable ? delta : null,
2746
+ detectable
2747
+ };
2748
+ }
2749
+ /** Paired binary outcomes with arm-specific cluster effects N(0, icc p(1-p)) on the success probability and a planted effect. */
2750
+ function simulatedPairs({ pairs, clusters, controlRate, icc }, effect, rng) {
2751
+ const normal = () => Math.sqrt(-2 * Math.log(1 - rng())) * Math.cos(2 * Math.PI * rng());
2752
+ const sd = Math.sqrt(icc * controlRate * (1 - controlRate));
2753
+ const shift = [0, 1].map(() => Array.from({ length: clusters }, () => sd * normal()));
2754
+ return Array.from({ length: pairs }, (_, i) => {
2755
+ const [control, treatment] = [0, 1].map((arm) => Number(rng() < Math.min(1, Math.max(0, controlRate + (arm ? effect : 0) + shift[arm][i % clusters]))));
2756
+ return {
2757
+ cluster: `c${i % clusters}`,
2758
+ delta: treatment - control
2759
+ };
2760
+ });
2761
+ }
2762
+ /**
2763
+ * Seeded false-positive rate and power, with Monte Carlo standard errors. Without an effect, searches an attainable
2764
+ * candidate using common random draws; its independent reporting cohort does not guarantee the requested true power.
2765
+ */
2766
+ function simulateClusteredBinaryContrast(design) {
2767
+ const { reps, seed = 1, alpha, power = .8 } = design;
2768
+ if (!Number.isSafeInteger(reps) || reps < 1) throw new ValidationError("simulateClusteredBinaryContrast: reps must be a positive integer");
2769
+ if (design.effect !== void 0 && (!Number.isFinite(design.effect) || design.controlRate + design.effect < 0 || design.controlRate + design.effect > 1)) throw new ValidationError("simulateClusteredBinaryContrast: effect must give a success rate in [0,1]");
2770
+ const { mde } = clusteredBinaryMde(design);
2771
+ const rate = (effect, offset, n = reps) => {
2772
+ let rejected = 0;
2773
+ for (let rep = 0; rep < n; rep++) {
2774
+ const p = clusterSignFlipTest(simulatedPairs(design, effect, mulberry32(seed + offset + rep)));
2775
+ if (p !== null && p <= alpha) rejected++;
2776
+ }
2777
+ return {
2778
+ rate: rejected / n,
2779
+ se: Math.sqrt(rejected / n * (1 - rejected / n) / n)
2780
+ };
2781
+ };
2782
+ let effect = design.effect;
2783
+ if (effect === void 0) {
2784
+ const maximum = 1 - design.controlRate;
2785
+ let [low, high] = [mde ?? 0, Math.min(maximum, mde === null ? maximum : 1.5 * mde)];
2786
+ const searchPower = (delta) => rate(delta, 2000003, Math.ceil(reps / 4)).rate;
2787
+ if (!(high > 0)) throw new ValidationError("simulateClusteredBinaryContrast: no positive attainable effect");
2788
+ if (searchPower(high) < power) high = maximum;
2789
+ if (searchPower(high) < power) throw new ValidationError("simulateClusteredBinaryContrast: requested power is not bracketed");
2790
+ if (searchPower(low) >= power) {
2791
+ low = 0;
2792
+ if (searchPower(low) >= power) throw new ValidationError("simulateClusteredBinaryContrast: requested power is not bracketed");
2793
+ }
2794
+ for (let step = 0; step < 6; step++) {
2795
+ const middle = (low + high) / 2;
2796
+ if (searchPower(middle) >= power) high = middle;
2797
+ else low = middle;
2798
+ }
2799
+ effect = high;
2800
+ }
2801
+ const falsePositive = rate(0, 0);
2802
+ const detected = rate(effect, 1000003);
2803
+ return {
2804
+ ...design,
2805
+ power,
2806
+ mde,
2807
+ effect,
2808
+ falsePositiveRate: falsePositive.rate,
2809
+ falsePositiveSe: falsePositive.se,
2810
+ simulatedPower: detected.rate,
2811
+ simulatedPowerSe: detected.se
2812
+ };
2813
+ }
2814
+ export { continuousAgreement as $, benjaminiHochberg as A, cliffsDelta as B, mcnemar as C, studentTCdf as Ct, pairedRiskDifferenceScore as D, pairedRiskDifferenceExact as E, fisherExactTwoSided as F, summarizeDistribution as G, interpretCliffs as H, linearRegressionSlope as I, corpusInterRaterAgreementFromJudgeScores as J, rocAuc as K, normalTwoSidedPValue as L, holm as M, chiSquared as N, passAtK as O, chiSquaredPValue as P, calibrateJudgeContinuous as Q, studentTTwoSidedPValue as R, independentRiskDifference as S, placeboBand as St, pairedRiskDifference as T, pairedCohensDz as U, cohensD as V, percentileNearestRank as W, nominalAgreement as X, interRaterReliability as Y, calibrateJudge as Z, DECISION_PAIRED_DELTA_STATISTIC as _, medianInPlace as _t, simulateClusteredBinaryContrast as a, partialCredit as at, pairedSignTest as b, DEFAULT_BOOTSTRAP_SEED as bt, summarizeSample as c, spearmanR as ct, mcnemarPower as d, weightedComposite as dt, positionalBias as et, mcnemarRequiredN as f, weightedMean as ft, BOOTSTRAP_GATE_MIN_N as g, makeRng as gt, requiredSampleSize as h, meanOrZero as ht, clusteredPairedContrast as i, meanConfidenceInterval as it, bonferroni as j, wilson as k, mannWhitneyU as l, studentTCritical as lt, requiredPairedSampleSize as m, meanOrNull as mt, clusterSignFlipTest as n, verbosityBias as nt, eProcess as o, pearsonR as ot, pairedMde as p, mean as pt, corpusInterRaterAgreement as q, clusteredBinaryMde as r, confidenceInterval as rt, sampleMedian as s, ranks as st, clusterJackknife as t, selfPreference as tt, wilcoxonSignedRank as u, summarizeNumberSeries as ut, pairedBootstrap as v, seedFromData as vt, pairedBinaryScale as w, studentTQuantile as wt, pairedTTest as x, clusterBootstrap as xt, pairedDeltaTieFraction as y, zQuantile as yt, twoByTwoPValue as z };
2633
2815
 
2634
- //# sourceMappingURL=statistics-CvvC-MPv.js.map
2816
+ //# sourceMappingURL=statistics-CHs0jlsY.js.map