@tangle-network/agent-eval 0.216.1 → 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 (521) hide show
  1. package/CHANGELOG.md +102 -57
  2. package/README.md +2 -2
  3. package/dist/adapters/http.d.ts +2 -2
  4. package/dist/{agent-profile-VFcQncbW.d.ts → agent-profile-DTt8uGP9.d.ts} +4 -17
  5. package/dist/agent-profile-DTt8uGP9.d.ts.map +1 -0
  6. package/dist/{agent-profile-cell-BK8mlqlq.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-BEWLIF3_.js → agreement-irr-BhAqjluA.js} +5 -5
  11. package/dist/agreement-irr-BhAqjluA.js.map +1 -0
  12. package/dist/analyst/index.d.ts +36 -169
  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-C84irm4i.js → analyze-runs-DqPJaJ4X.js} +225 -21
  17. package/dist/analyze-runs-DqPJaJ4X.js.map +1 -0
  18. package/dist/{analyze-runs-D68fd-su.d.ts → analyze-runs-DyeNcenW.d.ts} +5 -5
  19. package/dist/{analyze-runs-D68fd-su.d.ts.map → analyze-runs-DyeNcenW.d.ts.map} +1 -1
  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-By0vh8q7.js → benchmark-command-xQK8nOI6.js} +554 -89
  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 +7 -7
  34. package/dist/campaign/index.js +15 -15
  35. package/dist/{campaign-BudZ70zo.js → campaign-CJGkxAQ6.js} +23 -530
  36. package/dist/campaign-CJGkxAQ6.js.map +1 -0
  37. package/dist/{campaign-evidence-Clrn4hBV.js → campaign-evidence-CQYw8_0H.js} +10 -18
  38. package/dist/{campaign-evidence-Clrn4hBV.js.map → campaign-evidence-CQYw8_0H.js.map} +1 -1
  39. package/dist/{canonical-B2RqLofv.js → canonical-Dq2hOQ8L.js} +2 -2
  40. package/dist/{canonical-B2RqLofv.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-l-MVDlDk.js → chat-client-ldqxYYTN.js} +2 -2
  44. package/dist/{chat-client-l-MVDlDk.js.map → chat-client-ldqxYYTN.js.map} +1 -1
  45. package/dist/{chat-json-call-puMArmtW.js → chat-json-call-DavzexSp.js} +3 -2
  46. package/dist/chat-json-call-DavzexSp.js.map +1 -0
  47. package/dist/{claim-q4HQhK1G.js → claim-BPVuyHuy.js} +3 -3
  48. package/dist/{claim-q4HQhK1G.js.map → claim-BPVuyHuy.js.map} +1 -1
  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-qcUWYFl-.js → cluster-bootstrap-DEwwhl0C.js} +3 -3
  54. package/dist/{cluster-bootstrap-qcUWYFl-.js.map → cluster-bootstrap-DEwwhl0C.js.map} +1 -1
  55. package/dist/{produced-state-BsDmnwxc.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 +12 -12
  58. package/dist/contract/index.js +25 -401
  59. package/dist/contract/index.js.map +1 -1
  60. package/dist/{cost-ledger-BP8V4kUQ.js → cost-ledger-D0352Z4d.js} +4 -8
  61. package/dist/cost-ledger-D0352Z4d.js.map +1 -0
  62. package/dist/dataset-DQqhOCPt.d.ts.map +1 -1
  63. package/dist/{default-registry-COhk9g36.js → default-registry-ClYjq3QE.js} +8 -11
  64. package/dist/default-registry-ClYjq3QE.js.map +1 -0
  65. package/dist/{default-registry-DzHiGruW.d.ts → default-registry-DXgLmoDI.d.ts} +7 -50
  66. package/dist/default-registry-DXgLmoDI.d.ts.map +1 -0
  67. package/dist/{define-agent-eval-CNTPzIkp.js → define-agent-eval-BDxNlP3D.js} +10 -10
  68. package/dist/{define-agent-eval-CNTPzIkp.js.map → define-agent-eval-BDxNlP3D.js.map} +1 -1
  69. package/dist/{define-agent-eval-WSck0CZJ.d.ts → define-agent-eval-BIkH_gAR.d.ts} +8 -8
  70. package/dist/define-agent-eval-BIkH_gAR.d.ts.map +1 -0
  71. package/dist/{descriptive-DboxPZrG.js → descriptive-CVNy48rR.js} +2 -2
  72. package/dist/{descriptive-DboxPZrG.js.map → descriptive-CVNy48rR.js.map} +1 -1
  73. package/dist/diagnosis/index.d.ts +4 -14
  74. package/dist/diagnosis/index.d.ts.map +1 -1
  75. package/dist/diagnosis/index.js +67 -28
  76. package/dist/diagnosis/index.js.map +1 -1
  77. package/dist/{dspy-rlm-engine-LRCu61m5.js → dspy-rlm-engine-DhdCr1Dc.js} +5 -10
  78. package/dist/dspy-rlm-engine-DhdCr1Dc.js.map +1 -0
  79. package/dist/{emitter-HcCmFQl_.d.ts → emitter-DABYYTcH.d.ts} +5 -5
  80. package/dist/emitter-DABYYTcH.d.ts.map +1 -0
  81. package/dist/emitter-DbMXUIVP.js.map +1 -1
  82. package/dist/{engine-3A_4jOlI.d.ts → engine-BvZ0R-36.d.ts} +17 -21
  83. package/dist/engine-BvZ0R-36.d.ts.map +1 -0
  84. package/dist/{equal-terms-BtdXayCJ.js → equal-terms-DbPGcVtI.js} +2 -2
  85. package/dist/equal-terms-DbPGcVtI.js.map +1 -0
  86. package/dist/{errors-DVZiqS7K.js → errors-BcOs5MKW.js} +2 -8
  87. package/dist/{errors-DVZiqS7K.js.map → errors-BcOs5MKW.js.map} +1 -1
  88. package/dist/{eval-campaign-90jeaCAI.js → eval-campaign-BLEfBGbA.js} +6 -6
  89. package/dist/{eval-campaign-90jeaCAI.js.map → eval-campaign-BLEfBGbA.js.map} +1 -1
  90. package/dist/{evaluation-6Yoi74gM.d.ts → evaluation-jTjC_QQD.d.ts} +7 -7
  91. package/dist/evaluation-jTjC_QQD.d.ts.map +1 -0
  92. package/dist/evaluation.d.ts +2 -2
  93. package/dist/evaluation.js +1 -1
  94. package/dist/evaluation.js.map +1 -1
  95. package/dist/{exact-types-ClugMJfI.d.ts → exact-types-CflbJ9f3.d.ts} +2 -2
  96. package/dist/{exact-types-ClugMJfI.d.ts.map → exact-types-CflbJ9f3.d.ts.map} +1 -1
  97. package/dist/{exec-ChJ6d5if.js → exec-CpbtOXVt.js} +2 -24
  98. package/dist/{exec-ChJ6d5if.js.map → exec-CpbtOXVt.js.map} +1 -1
  99. package/dist/execution-tracks-CpgFPpS5.js.map +1 -1
  100. package/dist/experiment/index.d.ts +9 -112
  101. package/dist/experiment/index.d.ts.map +1 -1
  102. package/dist/experiment/index.js +149 -241
  103. package/dist/experiment/index.js.map +1 -1
  104. package/dist/{exporters-X4xwla8A.js → exporters-Cl6IeNAu.js} +3 -3
  105. package/dist/exporters-Cl6IeNAu.js.map +1 -0
  106. package/dist/{exporters-ChTnR90l.d.ts → exporters-Dk3oEbK_.d.ts} +2 -4
  107. package/dist/{exporters-ChTnR90l.d.ts.map → exporters-Dk3oEbK_.d.ts.map} +1 -1
  108. package/dist/{external-optimizer-process-BjMGUuds.js → external-optimizer-process-KVFGvYX1.js} +4 -3
  109. package/dist/external-optimizer-process-KVFGvYX1.js.map +1 -0
  110. package/dist/{external-optimizer-subprocess-BqW0hHcI.js → external-optimizer-subprocess-XIHBOSKt.js} +9 -11
  111. package/dist/external-optimizer-subprocess-XIHBOSKt.js.map +1 -0
  112. package/dist/{extract-usage-BrnzRJ6H.js → extract-usage-BZLU01kR.js} +2 -23
  113. package/dist/{extract-usage-BrnzRJ6H.js.map → extract-usage-BZLU01kR.js.map} +1 -1
  114. package/dist/{failure-cluster-CbgEDcFJ.d.ts → failure-cluster-DN0t63Z0.d.ts} +4 -43
  115. package/dist/failure-cluster-DN0t63Z0.d.ts.map +1 -0
  116. package/dist/{failure-taxonomy-CjabTATj.js → failure-taxonomy-Bx5oWqaW.js} +2 -19
  117. package/dist/{failure-taxonomy-CjabTATj.js.map → failure-taxonomy-Bx5oWqaW.js.map} +1 -1
  118. package/dist/{feedback-trajectory-C4EG0nNH.d.ts → feedback-trajectory-BWmhRBGu.d.ts} +7 -9
  119. package/dist/feedback-trajectory-BWmhRBGu.d.ts.map +1 -0
  120. package/dist/{semantic-concept-judge-BQF8te0T.js → findings-store-BMVQtEsm.js} +9 -249
  121. package/dist/findings-store-BMVQtEsm.js.map +1 -0
  122. package/dist/fuzz.d.ts +19 -62
  123. package/dist/fuzz.d.ts.map +1 -1
  124. package/dist/fuzz.js +62 -108
  125. package/dist/fuzz.js.map +1 -1
  126. package/dist/{hf-dataset-BR2yhuNn.js → hf-dataset-D9f7-oX7.js} +4 -24
  127. package/dist/hf-dataset-D9f7-oX7.js.map +1 -0
  128. package/dist/hosted/index.d.ts +2 -2
  129. package/dist/hosted/index.js +2 -2
  130. package/dist/{index-DHKEAv3s.d.ts → index-9jJ2fKSX.d.ts} +2 -64
  131. package/dist/index-9jJ2fKSX.d.ts.map +1 -0
  132. package/dist/{index-DV-jSzxF.d.ts → index-BLGqZ81N.d.ts} +10 -15
  133. package/dist/{index-DV-jSzxF.d.ts.map → index-BLGqZ81N.d.ts.map} +1 -1
  134. package/dist/{index-DPcngtwt.d.ts → index-BiT6RtNH.d.ts} +11 -36
  135. package/dist/index-BiT6RtNH.d.ts.map +1 -0
  136. package/dist/{index-BO41eGj5.d.ts → index-CX-GAUpw.d.ts} +3 -7
  137. package/dist/index-CX-GAUpw.d.ts.map +1 -0
  138. package/dist/{index-BFRO6chs.d.ts → index-CiRwLv2R.d.ts} +5 -69
  139. package/dist/index-CiRwLv2R.d.ts.map +1 -0
  140. package/dist/{index-CyszSg4O.d.ts → index-ZuWx52WG.d.ts} +115 -347
  141. package/dist/index-ZuWx52WG.d.ts.map +1 -0
  142. package/dist/index.d.ts +211 -218
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +402 -1040
  145. package/dist/index.js.map +1 -1
  146. package/dist/{integrity-dLiDe2kD.js → integrity-DOd9Q86O.js} +7 -9
  147. package/dist/integrity-DOd9Q86O.js.map +1 -0
  148. package/dist/{integrity-BXOsAb3i.js → integrity-W4CADcFc.js} +3 -7
  149. package/dist/{integrity-BXOsAb3i.js.map → integrity-W4CADcFc.js.map} +1 -1
  150. package/dist/{integrity-DAMEDFaC.d.ts → integrity-_qgZLA5p.d.ts} +4 -6
  151. package/dist/{integrity-DAMEDFaC.d.ts.map → integrity-_qgZLA5p.d.ts.map} +1 -1
  152. package/dist/{internal-Epl-YBZW.js → internal-BTK91Bqt.js} +3 -3
  153. package/dist/{internal-Epl-YBZW.js.map → internal-BTK91Bqt.js.map} +1 -1
  154. package/dist/{interval-CELpye1n.js → interval-Dq9gt7jx.js} +3 -3
  155. package/dist/{interval-CELpye1n.js.map → interval-Dq9gt7jx.js.map} +1 -1
  156. package/dist/{journal-DfRz9kps.js → journal-CR4QikYp.js} +110 -110
  157. package/dist/journal-CR4QikYp.js.map +1 -0
  158. package/dist/json-BhdsJaOQ.js +111 -0
  159. package/dist/json-BhdsJaOQ.js.map +1 -0
  160. package/dist/{judge-calibration-BpCy5XQl.js → judge-calibration-BkXMIWA4.js} +3 -3
  161. package/dist/{judge-calibration-BpCy5XQl.js.map → judge-calibration-BkXMIWA4.js.map} +1 -1
  162. package/dist/{judge-gate-iY9s4L44.js → judge-gate-Co5tuh57.js} +4 -27
  163. package/dist/{judge-gate-iY9s4L44.js.map → judge-gate-Co5tuh57.js.map} +1 -1
  164. package/dist/{judge-gate-CE7CQAgt.d.ts → judge-gate-DsL0yFcb.d.ts} +8 -9
  165. package/dist/judge-gate-DsL0yFcb.d.ts.map +1 -0
  166. package/dist/{kind-factory-BobI5Jy3.js → kind-factory-Gy4fXixd.js} +88 -17
  167. package/dist/kind-factory-Gy4fXixd.js.map +1 -0
  168. package/dist/ledger-core/index.d.ts +2 -2
  169. package/dist/ledger-core/index.js +4 -4
  170. package/dist/{ledger-core-Gq7yp8lP.js → ledger-core-DrJhbms9.js} +5 -84
  171. package/dist/ledger-core-DrJhbms9.js.map +1 -0
  172. package/dist/{llm-client-CyBAoYiX.js → llm-client-BshCREn6.js} +6 -108
  173. package/dist/llm-client-BshCREn6.js.map +1 -0
  174. package/dist/{llm-judge-CG12SQJq.js → llm-judge-C8jMTNNG.js} +24 -32
  175. package/dist/llm-judge-C8jMTNNG.js.map +1 -0
  176. package/dist/matrix/index.d.ts +3 -3
  177. package/dist/matrix/index.js +3 -2
  178. package/dist/{matrix-Dm0BQW7U.js → matrix-B8l-Nsxd.js} +3 -88
  179. package/dist/matrix-B8l-Nsxd.js.map +1 -0
  180. package/dist/{matrix-DSrSxjjy.d.ts → matrix-DHe-dwVJ.d.ts} +9 -18
  181. package/dist/matrix-DHe-dwVJ.d.ts.map +1 -0
  182. package/dist/{mean-DHoMiudD.js → mean-BbA_JCzW.js} +39 -5
  183. package/dist/mean-BbA_JCzW.js.map +1 -0
  184. package/dist/meta-eval/index.d.ts +5 -5
  185. package/dist/meta-eval/index.js +10 -10
  186. package/dist/metrics-BKaPBtIG.js.map +1 -1
  187. package/dist/{mint-DNU8QPG4.d.ts → mint-BRZXuwRi.d.ts} +4 -4
  188. package/dist/{mint-DNU8QPG4.d.ts.map → mint-BRZXuwRi.d.ts.map} +1 -1
  189. package/dist/{mint-QaD5cA0u.js → mint-zszyYlpA.js} +4 -4
  190. package/dist/{mint-QaD5cA0u.js.map → mint-zszyYlpA.js.map} +1 -1
  191. package/dist/{multi-layer-verifier-BUaQ4C17.d.ts → multi-layer-verifier-DEgMUk6v.d.ts} +2 -2
  192. package/dist/{multi-layer-verifier-BUaQ4C17.d.ts.map → multi-layer-verifier-DEgMUk6v.d.ts.map} +1 -1
  193. package/dist/{multiplicity-DQUFcbW4.js → multiplicity-Sg0U7h8j.js} +2 -2
  194. package/dist/{multiplicity-DQUFcbW4.js.map → multiplicity-Sg0U7h8j.js.map} +1 -1
  195. package/dist/multishot/golden/index.d.ts +1 -23
  196. package/dist/multishot/golden/index.d.ts.map +1 -1
  197. package/dist/multishot/golden/index.js +3 -3
  198. package/dist/multishot/golden/index.js.map +1 -1
  199. package/dist/multishot/index.d.ts +3 -12
  200. package/dist/multishot/index.d.ts.map +1 -1
  201. package/dist/multishot/index.js +4 -3
  202. package/dist/multishot/index.js.map +1 -1
  203. package/dist/openapi.json +114 -10
  204. package/dist/{otel-spans-B9tUXRHF.js → otel-spans-CdN909k1.js} +3 -3
  205. package/dist/{otel-spans-B9tUXRHF.js.map → otel-spans-CdN909k1.js.map} +1 -1
  206. package/dist/{paired-arms-CwMGJsrS.js → paired-arms-Ct4LTKc1.js} +32 -9
  207. package/dist/paired-arms-Ct4LTKc1.js.map +1 -0
  208. package/dist/{paired-binary-CvpFHfKZ.js → paired-binary-B_nejA44.js} +3 -36
  209. package/dist/paired-binary-B_nejA44.js.map +1 -0
  210. package/dist/{paired-promotion-decision-DPKz8ZnF.d.ts → paired-promotion-decision-CQMJ5xGN.d.ts} +2 -34
  211. package/dist/paired-promotion-decision-CQMJ5xGN.d.ts.map +1 -0
  212. package/dist/{paired-promotion-decision-DsAPYGCm.js → paired-promotion-decision-D0SHb-ZL.js} +3 -3
  213. package/dist/{paired-promotion-decision-DsAPYGCm.js.map → paired-promotion-decision-D0SHb-ZL.js.map} +1 -1
  214. package/dist/{pareto-Cm6ndrWN.js → pareto-BzsxidFD.js} +11 -11
  215. package/dist/pareto-BzsxidFD.js.map +1 -0
  216. package/dist/pipelines/index.d.ts +16 -19
  217. package/dist/pipelines/index.d.ts.map +1 -1
  218. package/dist/pipelines/index.js +4 -68
  219. package/dist/pipelines/index.js.map +1 -1
  220. package/dist/{power-and-mde-Hj2ubb4B.js → power-and-mde-N5nU4_Ly.js} +3 -3
  221. package/dist/{power-and-mde-Hj2ubb4B.js.map → power-and-mde-N5nU4_Ly.js.map} +1 -1
  222. package/dist/{prime-protocol-CHKgA3a6.js → prime-protocol-BFgGrEMP.js} +3 -3
  223. package/dist/prime-protocol-BFgGrEMP.js.map +1 -0
  224. package/dist/{prime-protocol-HiB9HX7E.d.ts → prime-protocol-BWG2DQIk.d.ts} +3 -21
  225. package/dist/prime-protocol-BWG2DQIk.d.ts.map +1 -0
  226. package/dist/profile-cell.d.ts +2 -2
  227. package/dist/profile-cell.js +2 -2
  228. package/dist/{promotion-gate-BawrdPYr.d.ts → promotion-gate-DaY95yU6.d.ts} +7 -8
  229. package/dist/{promotion-gate-BawrdPYr.d.ts.map → promotion-gate-DaY95yU6.d.ts.map} +1 -1
  230. package/dist/{promotion-policy-KO57gbyV.js → promotion-policy-6A8osGr_.js} +4 -4
  231. package/dist/{promotion-policy-KO57gbyV.js.map → promotion-policy-6A8osGr_.js.map} +1 -1
  232. package/dist/{proposal-findings-CY1xKn_a.js → proposal-findings-BbWidvUk.js} +3 -3
  233. package/dist/proposal-findings-BbWidvUk.js.map +1 -0
  234. package/dist/{query-BUCZCK7F.js → query-B_RZ36an.js} +5 -5
  235. package/dist/query-B_RZ36an.js.map +1 -0
  236. package/dist/{query-DK1nWcmp.d.ts → query-Cmv_U8vf.d.ts} +4 -24
  237. package/dist/{query-DK1nWcmp.d.ts.map → query-Cmv_U8vf.d.ts.map} +1 -1
  238. package/dist/{random-ByUSnV9w.js → random-DDDcC7YU.js} +2 -2
  239. package/dist/{random-ByUSnV9w.js.map → random-DDDcC7YU.js.map} +1 -1
  240. package/dist/{raw-provider-sink-DoHz4JNG.js → raw-provider-sink-75w4FWBj.js} +2 -2
  241. package/dist/{raw-provider-sink-DoHz4JNG.js.map → raw-provider-sink-75w4FWBj.js.map} +1 -1
  242. package/dist/{redact-mtCCcT8z.d.ts → redact-DXdlFb_U.d.ts} +2 -3
  243. package/dist/redact-DXdlFb_U.d.ts.map +1 -0
  244. package/dist/{redact-B5xXKqQ3.js → redact-mtkTiJVk.js} +2 -7
  245. package/dist/{redact-B5xXKqQ3.js.map → redact-mtkTiJVk.js.map} +1 -1
  246. package/dist/{registry-D7_hm2fK.d.ts → registry-ssNoHzwD.d.ts} +4 -4
  247. package/dist/{registry-D7_hm2fK.d.ts.map → registry-ssNoHzwD.d.ts.map} +1 -1
  248. package/dist/{release-confidence-CpuP65S5.js → release-confidence-CYIFH-fp.js} +6 -11
  249. package/dist/release-confidence-CYIFH-fp.js.map +1 -0
  250. package/dist/{report-command-SC9nqb4M.js → render-C-w2EZ6p.js} +205 -363
  251. package/dist/render-C-w2EZ6p.js.map +1 -0
  252. package/dist/reporting.d.ts +6 -6
  253. package/dist/reporting.js +8 -8
  254. package/dist/{researcher-CEcfku-T.d.ts → researcher-0ABVIdGa.d.ts} +9 -9
  255. package/dist/{researcher-CEcfku-T.d.ts.map → researcher-0ABVIdGa.d.ts.map} +1 -1
  256. package/dist/{reward-CpCmAM8L.d.ts → reward-DrZ71vnf.d.ts} +3 -26
  257. package/dist/reward-DrZ71vnf.d.ts.map +1 -0
  258. package/dist/{reward-hacking-E0d-WVcP.js → reward-hacking-ByuETaIb.js} +3 -3
  259. package/dist/{reward-hacking-E0d-WVcP.js.map → reward-hacking-ByuETaIb.js.map} +1 -1
  260. package/dist/{reward-hacking-RVdZ6Kkt.d.ts → reward-hacking-E52wq86n.d.ts} +5 -18
  261. package/dist/reward-hacking-E52wq86n.d.ts.map +1 -0
  262. package/dist/reward-nw2xZGZG.js.map +1 -1
  263. package/dist/rl.d.ts +117 -295
  264. package/dist/rl.d.ts.map +1 -1
  265. package/dist/rl.js +27 -747
  266. package/dist/rl.js.map +1 -1
  267. package/dist/rollout/index.d.ts +5 -5
  268. package/dist/rollout/index.js +7 -8
  269. package/dist/{rollout-DZV1t2Wg.js → rollout-D6C50mfA.js} +88 -13
  270. package/dist/rollout-D6C50mfA.js.map +1 -0
  271. package/dist/{rubric-predictive-validity-DaFW70y9.js → rubric-predictive-validity-D3_oI72N.js} +3 -3
  272. package/dist/{rubric-predictive-validity-DaFW70y9.js.map → rubric-predictive-validity-D3_oI72N.js.map} +1 -1
  273. package/dist/{rubric-predictive-validity-C03EC7ZE.d.ts → rubric-predictive-validity-DiwT8PbL.d.ts} +2 -2
  274. package/dist/{rubric-predictive-validity-C03EC7ZE.d.ts.map → rubric-predictive-validity-DiwT8PbL.d.ts.map} +1 -1
  275. package/dist/{run-record-C1E24G2A.d.ts → run-record-CaxbLq6Y.d.ts} +4 -10
  276. package/dist/run-record-CaxbLq6Y.d.ts.map +1 -0
  277. package/dist/{run-record-C5e7FjhJ.js → run-record-CysKLB93.js} +3 -3
  278. package/dist/run-record-CysKLB93.js.map +1 -0
  279. package/dist/{run-record-Boc5IUTp.js → run-record-DhEJgoPz.js} +4 -4
  280. package/dist/{run-record-Boc5IUTp.js.map → run-record-DhEJgoPz.js.map} +1 -1
  281. package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -1
  282. package/dist/{schema-CSf6qWgZ.js → schema-Bt2vLFm3.js} +2 -14
  283. package/dist/schema-Bt2vLFm3.js.map +1 -0
  284. package/dist/schema-C-ziyJD7.d.ts.map +1 -1
  285. package/dist/{schema-2g7trUwH.d.ts → schema-D6EVKzTB.d.ts} +4 -5
  286. package/dist/schema-D6EVKzTB.d.ts.map +1 -0
  287. package/dist/{schema-BuiujZ-g.js → schema-DxcKTzbi.js} +2 -2
  288. package/dist/schema-DxcKTzbi.js.map +1 -0
  289. package/dist/search/index.d.ts +3 -31
  290. package/dist/search/index.d.ts.map +1 -1
  291. package/dist/search/index.js +4 -4
  292. package/dist/{search-kernel-DyNEa6IU.d.ts → search-kernel-DxqjBxA-.d.ts} +10 -27
  293. package/dist/search-kernel-DxqjBxA-.d.ts.map +1 -0
  294. package/dist/{search-ledger-CVUGLDZp.js → search-ledger-TUvB5gWH.js} +7 -7
  295. package/dist/{search-ledger-CVUGLDZp.js.map → search-ledger-TUvB5gWH.js.map} +1 -1
  296. package/dist/{search-ledger-file-DDQUgvCg.js → search-ledger-file-UKCO2r8a.js} +4 -4
  297. package/dist/search-ledger-file-UKCO2r8a.js.map +1 -0
  298. package/dist/{search-shipper-BOSD46qv.js → search-shipper-Cw2z3-td.js} +4 -4
  299. package/dist/search-shipper-Cw2z3-td.js.map +1 -0
  300. package/dist/{search-summary-BQCSWf1g.js → search-summary-DQIvJsSB.js} +5 -5
  301. package/dist/{search-summary-BQCSWf1g.js.map → search-summary-DQIvJsSB.js.map} +1 -1
  302. package/dist/{sequential-CzK5DarL.js → sequential-BVv1sjsw.js} +2 -32
  303. package/dist/{sequential-CzK5DarL.js.map → sequential-BVv1sjsw.js.map} +1 -1
  304. package/dist/{sequential-Bf_pbE50.js → sequential-CimQrbjv.js} +5 -5
  305. package/dist/sequential-CimQrbjv.js.map +1 -0
  306. package/dist/{sequential-BhsrMupG.d.ts → sequential-KwGspfeR.d.ts} +2 -9
  307. package/dist/{sequential-BhsrMupG.d.ts.map → sequential-KwGspfeR.d.ts.map} +1 -1
  308. package/dist/{sequential-eprocess-DM_qENCl.js → sequential-eprocess-DodI6RoF.js} +2 -2
  309. package/dist/{sequential-eprocess-DM_qENCl.js.map → sequential-eprocess-DodI6RoF.js.map} +1 -1
  310. package/dist/{server-e9oWO_bN.js → server-DoVbqqtJ.js} +101 -101
  311. package/dist/server-DoVbqqtJ.js.map +1 -0
  312. package/dist/{single-run-lock-CV9Eyd_q.js → single-run-lock-U58yf8N6.js} +2 -2
  313. package/dist/{single-run-lock-CV9Eyd_q.js.map → single-run-lock-U58yf8N6.js.map} +1 -1
  314. package/dist/{skillopt-optimization-method-BiwA8nfX.js → skillopt-optimization-method-kyL94-ri.js} +17 -95
  315. package/dist/skillopt-optimization-method-kyL94-ri.js.map +1 -0
  316. package/dist/{spans-BHAUXMGN.d.ts → spans-CVngGij3.d.ts} +2 -2
  317. package/dist/{spans-BHAUXMGN.d.ts.map → spans-CVngGij3.d.ts.map} +1 -1
  318. package/dist/{statistical-heldout-42NlCNDe.js → statistical-heldout-Bksv92Th.js} +3 -3
  319. package/dist/statistical-heldout-Bksv92Th.js.map +1 -0
  320. package/dist/{statistical-heldout-CYpGaoDH.d.ts → statistical-heldout-C9AbgREN.d.ts} +8 -67
  321. package/dist/statistical-heldout-C9AbgREN.d.ts.map +1 -0
  322. package/dist/{steps-Bg5-KVx1.d.ts → steps-DlepJPwD.d.ts} +2 -56
  323. package/dist/steps-DlepJPwD.d.ts.map +1 -0
  324. package/dist/{store-C4avFjIi.d.ts → store-B3nWRy3B.d.ts} +2 -2
  325. package/dist/{store-C4avFjIi.d.ts.map → store-B3nWRy3B.d.ts.map} +1 -1
  326. package/dist/{store-otlp-DJ9dtA5x.js → store-otlp-BteDAbHK.js} +3 -3
  327. package/dist/{store-otlp-DJ9dtA5x.js.map → store-otlp-BteDAbHK.js.map} +1 -1
  328. package/dist/{store-tool-spans-CIX5arAG.js → store-tool-spans-D5l_OfTJ.js} +8 -8
  329. package/dist/store-tool-spans-D5l_OfTJ.js.map +1 -0
  330. package/dist/{store-tool-spans-DdCSPa7C.d.ts → store-tool-spans-DZS0HWVf.d.ts} +9 -18
  331. package/dist/store-tool-spans-DZS0HWVf.d.ts.map +1 -0
  332. package/dist/storyboard/index.d.ts +4 -11
  333. package/dist/storyboard/index.d.ts.map +1 -1
  334. package/dist/storyboard/index.js +1 -16
  335. package/dist/storyboard/index.js.map +1 -1
  336. package/dist/{summary-report-V_JACR4Y.js → summary-report-BsXJoYX5.js} +88 -10
  337. package/dist/summary-report-BsXJoYX5.js.map +1 -0
  338. package/dist/{summary-report-bdFDXq0b.d.ts → summary-report-DM7tlml1.d.ts} +10 -19
  339. package/dist/summary-report-DM7tlml1.d.ts.map +1 -0
  340. package/dist/supervisor-run/index.d.ts +60 -28
  341. package/dist/supervisor-run/index.d.ts.map +1 -1
  342. package/dist/supervisor-run/index.js +4 -458
  343. package/dist/supervisor-run/index.js.map +1 -1
  344. package/dist/{systemone-BomhHr2c.d.ts → systemone-Bp_Ac0p1.d.ts} +5 -5
  345. package/dist/{systemone-BomhHr2c.d.ts.map → systemone-Bp_Ac0p1.d.ts.map} +1 -1
  346. package/dist/systemone-protocol.js +1 -1
  347. package/dist/{systemone-review-CUVcQJu6.d.ts → systemone-review-CwE6JGIp.d.ts} +2 -2
  348. package/dist/{systemone-review-CUVcQJu6.d.ts.map → systemone-review-CwE6JGIp.d.ts.map} +1 -1
  349. package/dist/{systemone-review-D7sXwsqq.js → systemone-review-DzdOJ8I6.js} +3 -3
  350. package/dist/{systemone-review-D7sXwsqq.js.map → systemone-review-DzdOJ8I6.js.map} +1 -1
  351. package/dist/systemone.d.ts +5 -5
  352. package/dist/systemone.js +5 -5
  353. package/dist/systemone.js.map +1 -1
  354. package/dist/{task-failure-attributes-hEmASjix.js → task-failure-attributes-BMsblaDh.js} +3 -3
  355. package/dist/task-failure-attributes-BMsblaDh.js.map +1 -0
  356. package/dist/{terminal-record-DZyQZ3pz.js → terminal-record-78g6E4vh.js} +5 -5
  357. package/dist/terminal-record-78g6E4vh.js.map +1 -0
  358. package/dist/{tool-groups-C3NEcdCM.d.ts → tool-groups-DyNz2JZ_.d.ts} +3 -3
  359. package/dist/tool-groups-DyNz2JZ_.d.ts.map +1 -0
  360. package/dist/{tool-waste-BKgvd-TP.d.ts → tool-waste-CkjzWmeY.d.ts} +25 -28
  361. package/dist/tool-waste-CkjzWmeY.d.ts.map +1 -0
  362. package/dist/{tool-waste-BlesqTqW.js → tool-waste-DLsjS_p-.js} +5 -5
  363. package/dist/{tool-waste-BlesqTqW.js.map → tool-waste-DLsjS_p-.js.map} +1 -1
  364. package/dist/{trace-questions-CM2CAocU.d.ts → trace-questions-xxwgsuMi.d.ts} +4 -9
  365. package/dist/{trace-questions-CM2CAocU.d.ts.map → trace-questions-xxwgsuMi.d.ts.map} +1 -1
  366. package/dist/trace-repair/index.d.ts +14 -211
  367. package/dist/trace-repair/index.d.ts.map +1 -1
  368. package/dist/trace-repair/index.js +865 -981
  369. package/dist/trace-repair/index.js.map +1 -1
  370. package/dist/traces.d.ts +18 -46
  371. package/dist/traces.d.ts.map +1 -1
  372. package/dist/traces.js +13 -13
  373. package/dist/traces.js.map +1 -1
  374. package/dist/trajectory-replay/index.d.ts +3 -117
  375. package/dist/trajectory-replay/index.d.ts.map +1 -1
  376. package/dist/trajectory-replay/index.js +98 -56
  377. package/dist/trajectory-replay/index.js.map +1 -1
  378. package/dist/{tree-C1XYeXvy.js → tree-BGRglkKd.js} +13 -10
  379. package/dist/tree-BGRglkKd.js.map +1 -0
  380. package/dist/{types-B3jzCp0p.js → types-BXgASBCL.js} +2 -2
  381. package/dist/{types-B3jzCp0p.js.map → types-BXgASBCL.js.map} +1 -1
  382. package/dist/{types-C1tnkEgM.d.ts → types-CW8ewATZ.d.ts} +4 -113
  383. package/dist/types-CW8ewATZ.d.ts.map +1 -0
  384. package/dist/{types-BqkVmHfv.d.ts → types-CmXY0PQf.d.ts} +2 -4
  385. package/dist/types-CmXY0PQf.d.ts.map +1 -0
  386. package/dist/{types-C02qtnG8.d.ts → types-D-mgRzlh.d.ts} +7 -28
  387. package/dist/types-D-mgRzlh.d.ts.map +1 -0
  388. package/dist/{types-Cq8mSbq8.d.ts → types-D8GhJoHk.d.ts} +7 -9
  389. package/dist/{types-Cq8mSbq8.d.ts.map → types-D8GhJoHk.d.ts.map} +1 -1
  390. package/dist/{types-IXD2HJzu.js → types-DqFMNTgK.js} +2 -4
  391. package/dist/types-DqFMNTgK.js.map +1 -0
  392. package/dist/{types-Cbe2fWBa.d.ts → types-DtMbFw6U.d.ts} +3 -3
  393. package/dist/{types-Cbe2fWBa.d.ts.map → types-DtMbFw6U.d.ts.map} +1 -1
  394. package/dist/{verdict-Dl0tiT1X.js → verdict-BGQmxQ8A.js} +3 -3
  395. package/dist/verdict-BGQmxQ8A.js.map +1 -0
  396. package/dist/{verdict-E4eRNf7-.d.ts → verdict-C24NELtN.d.ts} +2 -15
  397. package/dist/{verdict-E4eRNf7-.d.ts.map → verdict-C24NELtN.d.ts.map} +1 -1
  398. package/dist/{verdict-cache-Bm8EKL2s.js → verdict-cache-CL_7tePD.js} +2 -2
  399. package/dist/verdict-cache-CL_7tePD.js.map +1 -0
  400. package/dist/wire/index.d.ts +31 -410
  401. package/dist/wire/index.d.ts.map +1 -1
  402. package/dist/wire/index.js +2 -2
  403. package/docs/changes/jev-evidence-review.md +1 -1
  404. package/docs/changes/jev-product-adoption.md +1 -1
  405. package/docs/changes/jev-recorded-evidence.md +1 -1
  406. package/docs/design/statistics-decisions.md +17 -17
  407. package/docs/design.md +1 -1
  408. package/docs/evaluation-integrity.md +1 -1
  409. package/docs/proofs/campaign-attempt-retention-20261001/README.md +2 -2
  410. package/docs/public-api.md +138 -529
  411. package/docs/rollout.md +1 -1
  412. package/docs/trace-repair-admission.md +1 -1
  413. package/docs/wire-protocol.md +1 -1
  414. package/package.json +1 -1
  415. package/dist/active-curriculum-B_Lc9kfO.js +0 -61
  416. package/dist/active-curriculum-B_Lc9kfO.js.map +0 -1
  417. package/dist/agent-profile-VFcQncbW.d.ts.map +0 -1
  418. package/dist/agent-profile-cell-BK8mlqlq.js.map +0 -1
  419. package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +0 -1
  420. package/dist/agreement-irr-BEWLIF3_.js.map +0 -1
  421. package/dist/analyze-runs-C84irm4i.js.map +0 -1
  422. package/dist/baseline-Udi_PLuT.js +0 -259
  423. package/dist/baseline-Udi_PLuT.js.map +0 -1
  424. package/dist/benchmark-CXmVVHH2.js +0 -562
  425. package/dist/benchmark-CXmVVHH2.js.map +0 -1
  426. package/dist/benchmark-command-By0vh8q7.js.map +0 -1
  427. package/dist/campaign-BudZ70zo.js.map +0 -1
  428. package/dist/chat-json-call-puMArmtW.js.map +0 -1
  429. package/dist/claude-jsonl-dZir12m6.js +0 -86
  430. package/dist/claude-jsonl-dZir12m6.js.map +0 -1
  431. package/dist/client-BzL9niqi.d.ts.map +0 -1
  432. package/dist/cost-ledger-BP8V4kUQ.js.map +0 -1
  433. package/dist/counterfactual-CPaWN99-.d.ts +0 -60
  434. package/dist/counterfactual-CPaWN99-.d.ts.map +0 -1
  435. package/dist/counterfactual-Dn3veueY.js +0 -98
  436. package/dist/counterfactual-Dn3veueY.js.map +0 -1
  437. package/dist/default-registry-COhk9g36.js.map +0 -1
  438. package/dist/default-registry-DzHiGruW.d.ts.map +0 -1
  439. package/dist/define-agent-eval-WSck0CZJ.d.ts.map +0 -1
  440. package/dist/dspy-rlm-engine-LRCu61m5.js.map +0 -1
  441. package/dist/effect-sizes-BhzEpXMc.js +0 -82
  442. package/dist/effect-sizes-BhzEpXMc.js.map +0 -1
  443. package/dist/emitter-HcCmFQl_.d.ts.map +0 -1
  444. package/dist/engine-3A_4jOlI.d.ts.map +0 -1
  445. package/dist/equal-terms-BtdXayCJ.js.map +0 -1
  446. package/dist/evaluation-6Yoi74gM.d.ts.map +0 -1
  447. package/dist/exporters-X4xwla8A.js.map +0 -1
  448. package/dist/external-optimizer-process-BjMGUuds.js.map +0 -1
  449. package/dist/external-optimizer-subprocess-BqW0hHcI.js.map +0 -1
  450. package/dist/failure-cluster-CbgEDcFJ.d.ts.map +0 -1
  451. package/dist/feedback-trajectory-C4EG0nNH.d.ts.map +0 -1
  452. package/dist/hf-dataset-BR2yhuNn.js.map +0 -1
  453. package/dist/index-BFRO6chs.d.ts.map +0 -1
  454. package/dist/index-BO41eGj5.d.ts.map +0 -1
  455. package/dist/index-CyszSg4O.d.ts.map +0 -1
  456. package/dist/index-DHKEAv3s.d.ts.map +0 -1
  457. package/dist/index-DPcngtwt.d.ts.map +0 -1
  458. package/dist/integrity-dLiDe2kD.js.map +0 -1
  459. package/dist/journal-DfRz9kps.js.map +0 -1
  460. package/dist/judge-gate-CE7CQAgt.d.ts.map +0 -1
  461. package/dist/kind-factory-BobI5Jy3.js.map +0 -1
  462. package/dist/ledger-core-Gq7yp8lP.js.map +0 -1
  463. package/dist/llm-client-CyBAoYiX.js.map +0 -1
  464. package/dist/llm-judge-CG12SQJq.js.map +0 -1
  465. package/dist/matrix-DSrSxjjy.d.ts.map +0 -1
  466. package/dist/matrix-Dm0BQW7U.js.map +0 -1
  467. package/dist/mean-DHoMiudD.js.map +0 -1
  468. package/dist/normal-DsJZtrJc.js +0 -25
  469. package/dist/normal-DsJZtrJc.js.map +0 -1
  470. package/dist/paired-arms-CwMGJsrS.js.map +0 -1
  471. package/dist/paired-binary-CvpFHfKZ.js.map +0 -1
  472. package/dist/paired-promotion-decision-DPKz8ZnF.d.ts.map +0 -1
  473. package/dist/pareto-Cm6ndrWN.js.map +0 -1
  474. package/dist/prime-protocol-CHKgA3a6.js.map +0 -1
  475. package/dist/prime-protocol-HiB9HX7E.d.ts.map +0 -1
  476. package/dist/produced-state-BsDmnwxc.js.map +0 -1
  477. package/dist/proposal-findings-CY1xKn_a.js.map +0 -1
  478. package/dist/query-BUCZCK7F.js.map +0 -1
  479. package/dist/redact-mtCCcT8z.d.ts.map +0 -1
  480. package/dist/release-confidence-CpuP65S5.js.map +0 -1
  481. package/dist/report-command-SC9nqb4M.js.map +0 -1
  482. package/dist/reward-CpCmAM8L.d.ts.map +0 -1
  483. package/dist/reward-hacking-RVdZ6Kkt.d.ts.map +0 -1
  484. package/dist/rollout-DZV1t2Wg.js.map +0 -1
  485. package/dist/run-record-C1E24G2A.d.ts.map +0 -1
  486. package/dist/run-record-C5e7FjhJ.js.map +0 -1
  487. package/dist/schema-2g7trUwH.d.ts.map +0 -1
  488. package/dist/schema-BuiujZ-g.js.map +0 -1
  489. package/dist/schema-CSf6qWgZ.js.map +0 -1
  490. package/dist/search-kernel-DyNEa6IU.d.ts.map +0 -1
  491. package/dist/search-ledger-file-DDQUgvCg.js.map +0 -1
  492. package/dist/search-shipper-BOSD46qv.js.map +0 -1
  493. package/dist/semantic-concept-judge-BQF8te0T.js.map +0 -1
  494. package/dist/sequential-Bf_pbE50.js.map +0 -1
  495. package/dist/server-e9oWO_bN.js.map +0 -1
  496. package/dist/skillopt-optimization-method-BiwA8nfX.js.map +0 -1
  497. package/dist/statistical-heldout-42NlCNDe.js.map +0 -1
  498. package/dist/statistical-heldout-CYpGaoDH.d.ts.map +0 -1
  499. package/dist/steps-Bg5-KVx1.d.ts.map +0 -1
  500. package/dist/store-tool-spans-CIX5arAG.js.map +0 -1
  501. package/dist/store-tool-spans-DdCSPa7C.d.ts.map +0 -1
  502. package/dist/student-t-DVPW7CdL.js +0 -39
  503. package/dist/student-t-DVPW7CdL.js.map +0 -1
  504. package/dist/summary-report-V_JACR4Y.js.map +0 -1
  505. package/dist/summary-report-bdFDXq0b.d.ts.map +0 -1
  506. package/dist/task-failure-attributes-hEmASjix.js.map +0 -1
  507. package/dist/terminal-record-DZyQZ3pz.js.map +0 -1
  508. package/dist/tool-groups-C3NEcdCM.d.ts.map +0 -1
  509. package/dist/tool-waste-BKgvd-TP.d.ts.map +0 -1
  510. package/dist/trajectory-Y1fmdlw7.d.ts +0 -24
  511. package/dist/trajectory-Y1fmdlw7.d.ts.map +0 -1
  512. package/dist/tree-C1XYeXvy.js.map +0 -1
  513. package/dist/types-BqkVmHfv.d.ts.map +0 -1
  514. package/dist/types-C02qtnG8.d.ts.map +0 -1
  515. package/dist/types-C1tnkEgM.d.ts.map +0 -1
  516. package/dist/types-IXD2HJzu.js.map +0 -1
  517. package/dist/usage-receipt-Cx3xNeyB.js +0 -76
  518. package/dist/usage-receipt-Cx3xNeyB.js.map +0 -1
  519. package/dist/verdict-Dl0tiT1X.js.map +0 -1
  520. package/dist/verdict-cache-Bm8EKL2s.js.map +0 -1
  521. package/docs/design/self-improvement-evidence-audit.md +0 -263
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/pipelines/first-divergence.ts","../../src/pipelines/regression.ts","../../src/pipelines/stuck-loop.ts"],"mappings":";;;;;;;;iBAyBiB;;EAEf;EACA;EACA;;EAEA,QAAQ,SAAS;;YAGP;iBAEK;EACf;EACA;EACA;;iBAGe;;EAEf;;EAEA;EACA,UAAU;;EAEV,aAAa;;YAGH;iBAEK;;EAEf;EACA,MAAM;;EAEN;EACA;;EAEA,aAAa;EACb;;iBAGe;;EAEf,OAAO;;EAEP;;EAEA;;EAEA;;EAEA,iBAAiB;;wBAGH,UAAU,YAAY,YAAY,YAAY,aAAa;iBAwI1D;EACf;EACA;;EAEA;EACA,QAAQ;EACR,QAAQ;EACR;EACA;;EAEA,MAAM;;wBAGc,oBACpB,OAAO,YACP,cACA,eACC,QAAQ;;;;;;;wBAmCK,mBAAmB,gBAAgB,kBAAkB;;;iBC7PpD;EACf;EACA;;;EAGA,WAAW,KAAK,KAAK,OAAO,eAAe;;iBAG5B,0BAA0B;EACzC,UAAU;EACV,WAAW;;wBAGS,eACpB,OAAO,YACP,SAAS,kBACT,SAAS,oBACR,QAAQ;;;iBCFM;EACf;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;iBAGe;EACf,UAAU;EACV;EACA;;iBAGe;;EAEf;;EAEA;;;;;EAKA;;EAEA;;wBAGoB,cACpB,OAAO,YACP,UAAS,mBACR,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/pipelines/first-divergence.ts","../../src/pipelines/regression.ts","../../src/pipelines/stuck-loop.ts"],"mappings":";;;;;;;UAyBiB;;EAEf;EACA;EACA;;EAEA,QAAQ,SAAS;;KAGP;UAEK;EACf;EACA;EACA;;UAGe;;EAEf;;EAEA;EACA,UAAU;;EAEV,aAAa;;KAGH;UAEK;;EAEf;EACA,MAAM;;EAEN;EACA;;EAEA,aAAa;EACb;;UAGe;;EAEf,OAAO;;EAEP;;EAEA;;EAEA;;EAEA,iBAAiB;;wBAGH,UAAU,YAAY,YAAY,YAAY,aAAa;UAwI1D;EACf;EACA;;EAEA;EACA,QAAQ;EACR,QAAQ;EACR;EACA;;EAEA,MAAM;;;;;;;;wBA0CQ,mBAAmB,gBAAgB,kBAAkB;;;UC7PpD;EACf;EACA;;;EAGA,WAAW,KAAK,KAAK,OAAO,eAAe;;UAG5B,0BAA0B;EACzC,UAAU;EACV,WAAW;;;;iBCKI;EACf;EACA;EACA;;EAEA;EACA;;EAEA;;EAEA;;iBAGe;EACf,UAAU;EACV;EACA;;iBAGe;;EAEf;;EAEA;;;;;EAKA;;EAEA;;wBAGoB,cACpB,OAAO,YACP,UAAS,mBACR,QAAQ"}
@@ -1,9 +1,7 @@
1
- import { a as isToolSpan } from "../schema-CSf6qWgZ.js";
2
- import { t as compareToBaseline } from "../baseline-Udi_PLuT.js";
3
- import { a as hasCapturedToolArgs, l as runMetricExtractor, r as argHash } from "../query-BUCZCK7F.js";
4
- import { t as buildTrajectory } from "../trajectory-D_7rLrvE.js";
1
+ import { i as isToolSpan } from "../schema-Bt2vLFm3.js";
2
+ import { r as hasCapturedToolArgs, t as argHash } from "../query-B_RZ36an.js";
5
3
  import { t as executionTrackByLane } from "../execution-tracks-CpgFPpS5.js";
6
- import { a as budgetBreachView, i as failureClusterView, n as computeToolUseMetrics, r as judgeAgreementView, t as toolWasteView } from "../tool-waste-BlesqTqW.js";
4
+ import { a as budgetBreachView, i as failureClusterView, n as computeToolUseMetrics, r as judgeAgreementView, t as toolWasteView } from "../tool-waste-DLsjS_p-.js";
7
5
  //#region src/pipelines/first-divergence.ts
8
6
  function diffSteps(a, b) {
9
7
  const partnerOfA = /* @__PURE__ */ new Map();
@@ -124,34 +122,6 @@ function differencesBetween(x, y) {
124
122
  function describe(step) {
125
123
  return `${step.kind} "${step.name}"`;
126
124
  }
127
- async function firstDivergenceView(store, runA, runB) {
128
- const [a, b] = await Promise.all([buildTrajectory(store, runA), buildTrajectory(store, runB)]);
129
- const diff = diffSteps(a.steps.map(trajectoryDiffStep), b.steps.map(trajectoryDiffStep));
130
- const divergence = diff.firstDivergence;
131
- return {
132
- runA,
133
- runB,
134
- firstDivergenceIndex: divergence?.index ?? null,
135
- ...divergence?.a != null ? { aStep: a.steps[divergence.a] } : {},
136
- ...divergence?.b != null ? { bStep: b.steps[divergence.b] } : {},
137
- ...divergence ? { reason: divergence.reason } : {},
138
- commonPrefixLen: diff.commonPrefixLen,
139
- diff
140
- };
141
- }
142
- function trajectoryDiffStep(step) {
143
- const span = step.span;
144
- const fields = { status: span.status ?? null };
145
- if (span.kind === "tool") fields.tool = span.toolName;
146
- if (span.kind === "llm") fields.model = span.model;
147
- if (span.kind === "judge") fields.dimension = span.dimension;
148
- return {
149
- id: span.spanId,
150
- name: span.name,
151
- kind: span.kind,
152
- fields
153
- };
154
- }
155
125
  /**
156
126
  * One run's spans as diff steps, in containment order: depth first, siblings
157
127
  * by start time, the same order `buildTrajectory` gives a trace store run.
@@ -191,40 +161,6 @@ function diffStepsFromSpans(spans) {
191
161
  return ordered;
192
162
  }
193
163
  //#endregion
194
- //#region src/pipelines/regression.ts
195
- /**
196
- * RegressionView — compares a candidate slice to a baseline slice on a
197
- * named metric. Delegates the statistics (Welch's t-test, Cohen's d,
198
- * IQR stability) to `baseline.ts`.
199
- *
200
- * This is the entry point for CI regression gates: "given runs tagged
201
- * release=A and release=B, did any metric regress?"
202
- */
203
- async function regressionView(store, metrics, options) {
204
- const baselineRuns = await store.listRuns(options.baseline);
205
- const candidateRuns = await store.listRuns(options.candidate);
206
- const samples = await Promise.all(metrics.map(async (m) => {
207
- const extract = m.extract ?? runMetricExtractor(m.metric);
208
- const baseline = await extractAll(baselineRuns, extract, store);
209
- const candidate = await extractAll(candidateRuns, extract, store);
210
- return {
211
- metric: m.metric,
212
- higherIsBetter: m.higherIsBetter,
213
- baseline,
214
- candidate
215
- };
216
- }));
217
- return compareToBaseline(samples, options);
218
- }
219
- async function extractAll(runs, extract, store) {
220
- const out = [];
221
- for (const r of runs) {
222
- const v = await extract(r, store);
223
- if (v !== null && Number.isFinite(v)) out.push(v);
224
- }
225
- return out;
226
- }
227
- //#endregion
228
164
  //#region src/pipelines/stuck-loop.ts
229
165
  /**
230
166
  * StuckLoopView — detects when an agent calls the same tool with the
@@ -375,6 +311,6 @@ function callsAreSerial(previous, next) {
375
311
  return previous.span.endedAt !== void 0 && previous.span.endedAt <= next.span.startedAt;
376
312
  }
377
313
  //#endregion
378
- export { budgetBreachView, computeToolUseMetrics, diffSteps, diffStepsFromSpans, failureClusterView, firstDivergenceView, judgeAgreementView, regressionView, stuckLoopView, toolWasteView };
314
+ export { budgetBreachView, computeToolUseMetrics, diffSteps, diffStepsFromSpans, failureClusterView, judgeAgreementView, stuckLoopView, toolWasteView };
379
315
 
380
316
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/pipelines/first-divergence.ts","../../src/pipelines/regression.ts","../../src/pipelines/stuck-loop.ts"],"sourcesContent":["/**\n * Step diff between two runs, with the first divergence marked.\n *\n * Steps pair in three passes, each over the steps still unpaired:\n * 1. `id`: the same step id in both runs, e.g. a forked run that kept its\n * parent's span ids.\n * 2. `position`: the same index with the same name and kind.\n * 3. `name`: the same name and kind anywhere, first unpaired step in order.\n * A step left unpaired exists in only one run. The first divergence is the\n * first index at which the two runs stop agreeing step for step, and it says\n * how: a paired step changed, one run replaced, added or removed a step, or the\n * runs ran the same steps in a different order.\n *\n * `diffSteps` reads plain `DiffStep` lists, so the same diff serves agent-eval\n * trace stores (`firstDivergenceView`) and flat OTLP spans\n * (`diffStepsFromSpans`). Use it to attribute \"why is variant B better?\" to a\n * step, and to compare sibling or parent and child runs of a search tree.\n */\n\nimport type { DiagnosisSpan } from '../diagnosis/spans'\nimport type { Span } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\nimport { buildTrajectory, type TrajectoryStep } from '../trajectory'\n\n/** One step of a run, as the diff reads it. */\nexport interface DiffStep {\n /** The step's id within its run. */\n id: string\n name: string\n kind: string\n /** Fields compared once two steps pair, such as status, tool or model. */\n fields: Readonly<Record<string, string | number | boolean | null>>\n}\n\nexport type StepPairing = 'id' | 'position' | 'name'\n\nexport interface FieldDifference {\n field: string\n a: string | number | boolean | null\n b: string | number | boolean | null\n}\n\nexport interface StepPair {\n /** Index in run A. */\n a: number\n /** Index in run B. */\n b: number\n pairedBy: StepPairing\n /** Empty when the paired steps agree on name, kind and every field. */\n differences: FieldDifference[]\n}\n\nexport type StepDivergenceKind = 'changed' | 'replaced' | 'only-in-a' | 'only-in-b' | 'reordered'\n\nexport interface StepDivergence {\n /** The first index at which the runs stop agreeing; equals `commonPrefixLen`. */\n index: number\n kind: StepDivergenceKind\n /** Index of the step at `index` in each run, or null when that run has ended. */\n a: number | null\n b: number | null\n /** Set when `kind` is `changed`. */\n differences: FieldDifference[]\n reason: string\n}\n\nexport interface StepDiff {\n /** Paired steps in run A order. */\n pairs: StepPair[]\n /** Indexes of run A steps with no partner in run B. */\n onlyInA: number[]\n /** Indexes of run B steps with no partner in run A. */\n onlyInB: number[]\n /** Leading steps paired index for index with no difference. */\n commonPrefixLen: number\n /** Null when the runs agree step for step. */\n firstDivergence: StepDivergence | null\n}\n\nexport function diffSteps(a: readonly DiffStep[], b: readonly DiffStep[]): StepDiff {\n const partnerOfA = new Map<number, { b: number; pairedBy: StepPairing }>()\n const pairedB = new Set<number>()\n const pair = (i: number, j: number, pairedBy: StepPairing) => {\n partnerOfA.set(i, { b: j, pairedBy })\n pairedB.add(j)\n }\n\n const bById = new Map<string, number[]>()\n b.forEach((step, j) => {\n const list = bById.get(step.id)\n if (list) list.push(j)\n else bById.set(step.id, [j])\n })\n a.forEach((step, i) => {\n const j = bById.get(step.id)?.find((candidate) => !pairedB.has(candidate))\n if (j !== undefined) pair(i, j, 'id')\n })\n a.forEach((step, i) => {\n if (partnerOfA.has(i) || i >= b.length || pairedB.has(i)) return\n if (sameShape(step, b[i]!)) pair(i, i, 'position')\n })\n a.forEach((step, i) => {\n if (partnerOfA.has(i)) return\n const j = b.findIndex((candidate, index) => !pairedB.has(index) && sameShape(step, candidate))\n if (j >= 0) pair(i, j, 'name')\n })\n\n const pairs: StepPair[] = [...partnerOfA.entries()]\n .sort(([x], [y]) => x - y)\n .map(([i, partner]) => ({\n a: i,\n b: partner.b,\n pairedBy: partner.pairedBy,\n differences: differencesBetween(a[i]!, b[partner.b]!),\n }))\n const pairByA = new Map(pairs.map((entry) => [entry.a, entry]))\n const partnerOfB = new Map(pairs.map((entry) => [entry.b, entry.a]))\n\n let prefix = 0\n while (prefix < a.length && prefix < b.length) {\n const entry = pairByA.get(prefix)\n if (!entry || entry.b !== prefix || entry.differences.length > 0) break\n prefix += 1\n }\n\n return {\n pairs,\n onlyInA: a.map((_, i) => i).filter((i) => !partnerOfA.has(i)),\n onlyInB: b.map((_, j) => j).filter((j) => !pairedB.has(j)),\n commonPrefixLen: prefix,\n firstDivergence:\n prefix === a.length && prefix === b.length\n ? null\n : divergenceAt(prefix, a, b, pairByA.get(prefix), partnerOfB),\n }\n}\n\nfunction divergenceAt(\n index: number,\n a: readonly DiffStep[],\n b: readonly DiffStep[],\n pairOfA: StepPair | undefined,\n partnerOfB: ReadonlyMap<number, number>,\n): StepDivergence {\n const stepA = a[index]\n const stepB = b[index]\n const base = {\n index,\n a: stepA ? index : null,\n b: stepB ? index : null,\n differences: [] as FieldDifference[],\n }\n if (stepA && stepB && pairOfA?.b === index) {\n return {\n ...base,\n kind: 'changed',\n differences: pairOfA.differences,\n reason: `at index ${index}, ${describe(stepA)} changed: ${pairOfA.differences\n .map((d) => `${d.field} ${String(d.a)} vs ${String(d.b)}`)\n .join('; ')}`,\n }\n }\n const aUnpaired = stepA !== undefined && pairOfA === undefined\n const bUnpaired = stepB !== undefined && !partnerOfB.has(index)\n if (stepA && stepB && aUnpaired && bUnpaired) {\n return {\n ...base,\n kind: 'replaced',\n reason: `at index ${index}, A ran ${describe(stepA)} and B ran ${describe(stepB)}`,\n }\n }\n if (stepA && aUnpaired) {\n return {\n ...base,\n kind: 'only-in-a',\n reason: `at index ${index}, only A has ${describe(stepA)}`,\n }\n }\n if (stepB && bUnpaired) {\n return {\n ...base,\n kind: 'only-in-b',\n reason: `at index ${index}, only B has ${describe(stepB)}`,\n }\n }\n return {\n ...base,\n kind: 'reordered',\n reason: `at index ${index}, A ran ${describe(stepA!)} and B ran ${describe(stepB!)}; both steps occur in the other run at a different position`,\n }\n}\n\nfunction sameShape(x: DiffStep, y: DiffStep): boolean {\n return x.name === y.name && x.kind === y.kind\n}\n\nfunction differencesBetween(x: DiffStep, y: DiffStep): FieldDifference[] {\n const differences: FieldDifference[] = []\n if (x.kind !== y.kind) differences.push({ field: 'kind', a: x.kind, b: y.kind })\n if (x.name !== y.name) differences.push({ field: 'name', a: x.name, b: y.name })\n const fields = [...new Set([...Object.keys(x.fields), ...Object.keys(y.fields)])].sort()\n for (const field of fields) {\n const left = x.fields[field] ?? null\n const right = y.fields[field] ?? null\n if (left !== right) differences.push({ field, a: left, b: right })\n }\n return differences\n}\n\nfunction describe(step: DiffStep): string {\n return `${step.kind} \"${step.name}\"`\n}\n\n// ── agent-eval trace store ────────────────────────────────────────────\n\nexport interface DivergenceReport {\n runA: string\n runB: string\n /** Null when the runs agree step for step. */\n firstDivergenceIndex: number | null\n aStep?: TrajectoryStep\n bStep?: TrajectoryStep\n reason?: string\n commonPrefixLen: number\n /** The step diff behind the first divergence, over trajectory step indexes. */\n diff: StepDiff\n}\n\nexport async function firstDivergenceView(\n store: TraceStore,\n runA: string,\n runB: string,\n): Promise<DivergenceReport> {\n const [a, b] = await Promise.all([buildTrajectory(store, runA), buildTrajectory(store, runB)])\n const diff = diffSteps(a.steps.map(trajectoryDiffStep), b.steps.map(trajectoryDiffStep))\n const divergence = diff.firstDivergence\n return {\n runA,\n runB,\n firstDivergenceIndex: divergence?.index ?? null,\n ...(divergence?.a != null ? { aStep: a.steps[divergence.a] } : {}),\n ...(divergence?.b != null ? { bStep: b.steps[divergence.b] } : {}),\n ...(divergence ? { reason: divergence.reason } : {}),\n commonPrefixLen: diff.commonPrefixLen,\n diff,\n }\n}\n\nfunction trajectoryDiffStep(step: TrajectoryStep): DiffStep {\n const span: Span = step.span\n const fields: Record<string, string | number | boolean | null> = {\n status: span.status ?? null,\n }\n if (span.kind === 'tool') fields.tool = span.toolName\n if (span.kind === 'llm') fields.model = span.model\n if (span.kind === 'judge') fields.dimension = span.dimension\n return { id: span.spanId, name: span.name, kind: span.kind, fields }\n}\n\n// ── flat OTLP spans ───────────────────────────────────────────────────\n\n/**\n * One run's spans as diff steps, in containment order: depth first, siblings\n * by start time, the same order `buildTrajectory` gives a trace store run.\n * Spans whose parent is absent, or whose parents form a cycle, start their own\n * subtree, so every span appears exactly once.\n */\nexport function diffStepsFromSpans(spans: readonly DiagnosisSpan[]): DiffStep[] {\n const ids = new Set(spans.map((span) => span.spanId))\n const children = new Map<string | null, DiagnosisSpan[]>()\n for (const span of spans) {\n const parent =\n span.parentSpanId !== null && ids.has(span.parentSpanId) ? span.parentSpanId : null\n const list = children.get(parent)\n if (list) list.push(span)\n else children.set(parent, [span])\n }\n // Span ids are random per run, so two runs of the same logical trace can carry\n // different ids for \"the same\" span. Siblings that share a start time (a common\n // case: parallel steps a driver starts together) must still sort the same way\n // in both runs, or the diff below reports a false `reordered` divergence purely\n // from spanId noise. End time, kind and name are content, not per-run identity,\n // so they break the tie before spanId, which is the last resort.\n const byStart = (x: DiagnosisSpan, y: DiagnosisSpan) =>\n (x.startMs ?? 0) - (y.startMs ?? 0) ||\n (x.endMs ?? 0) - (y.endMs ?? 0) ||\n x.kind.localeCompare(y.kind) ||\n x.name.localeCompare(y.name) ||\n x.spanId.localeCompare(y.spanId)\n for (const list of children.values()) list.sort(byStart)\n const ordered: DiffStep[] = []\n const visited = new Set<string>()\n const visit = (span: DiagnosisSpan) => {\n if (visited.has(span.spanId)) return\n visited.add(span.spanId)\n ordered.push({\n id: span.spanId,\n name: span.name,\n kind: span.kind,\n fields: { status: span.status, tool: span.toolName, model: span.model },\n })\n for (const child of children.get(span.spanId) ?? []) visit(child)\n }\n for (const root of children.get(null) ?? []) visit(root)\n for (const span of [...spans].sort(byStart)) visit(span)\n return ordered\n}\n","/**\n * RegressionView — compares a candidate slice to a baseline slice on a\n * named metric. Delegates the statistics (Welch's t-test, Cohen's d,\n * IQR stability) to `baseline.ts`.\n *\n * This is the entry point for CI regression gates: \"given runs tagged\n * release=A and release=B, did any metric regress?\"\n */\n\nimport { type BaselineOptions, type BaselineReport, compareToBaseline } from '../baseline'\nimport { runMetricExtractor } from '../trace/query'\nimport type { Run } from '../trace/schema'\nimport type { RunFilter, TraceStore } from '../trace/store'\n\nexport interface RegressionSpec {\n metric: string\n higherIsBetter: boolean\n /** Extract a scalar from a run. Omit it and `metric` must name one of\n * `RUN_METRICS`; any other name is refused. */\n extract?: (run: Run, store: TraceStore) => Promise<number | null>\n}\n\nexport interface RegressionOptions extends BaselineOptions {\n baseline: RunFilter\n candidate: RunFilter\n}\n\nexport async function regressionView(\n store: TraceStore,\n metrics: RegressionSpec[],\n options: RegressionOptions,\n): Promise<BaselineReport> {\n const baselineRuns = await store.listRuns(options.baseline)\n const candidateRuns = await store.listRuns(options.candidate)\n const samples = await Promise.all(\n metrics.map(async (m) => {\n const extract = m.extract ?? runMetricExtractor(m.metric)\n const baseline = await extractAll(baselineRuns, extract, store)\n const candidate = await extractAll(candidateRuns, extract, store)\n return { metric: m.metric, higherIsBetter: m.higherIsBetter, baseline, candidate }\n }),\n )\n return compareToBaseline(samples, options)\n}\n\nasync function extractAll(\n runs: Run[],\n extract: (r: Run, s: TraceStore) => Promise<number | null>,\n store: TraceStore,\n): Promise<number[]> {\n const out: number[] = []\n for (const r of runs) {\n const v = await extract(r, store)\n if (v !== null && Number.isFinite(v)) out.push(v)\n }\n return out\n}\n","/**\n * StuckLoopView — detects when an agent calls the same tool with the\n * same (or structurally similar) arguments ≥ N times in a short window.\n *\n * Rationale: agents that loop are the number-one production failure\n * mode on long-horizon flows. The view returns (runId, toolName,\n * argHash, occurrences, windowMs) for each detected loop plus a\n * fraction of runs affected.\n */\n\nimport { executionTrackByLane } from '../trace/execution-tracks'\nimport { argHash, hasCapturedToolArgs } from '../trace/query'\nimport { isToolSpan, type Span, type ToolSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nconst DEFAULT_MAX_WINDOW_MS = 60_000\nconst DEFAULT_MAX_INTERVENING_TOOL_CALLS = 0\n\ninterface ScopedToolCall {\n span: ToolSpan\n scopeSpanId: string | null\n laneSpanId: string | null\n}\n\ninterface IndexedToolCall extends ScopedToolCall {\n toolCallIndex: number\n trackId: string\n}\n\nexport interface StuckLoopFinding {\n runId: string\n toolName: string\n argHash: string\n /** Calls in this episode's densest qualifying interval, not the whole-run total. */\n occurrences: number\n spanIds: string[]\n /** Nearest agent ancestor, or the direct parent when ancestry is incomplete. */\n scopeSpanId?: string\n /** Milliseconds between first and last call in the loop. */\n windowMs: number\n}\n\nexport interface StuckLoopReport {\n findings: StuckLoopFinding[]\n affectedRunRatio: number\n totalRuns: number\n}\n\nexport interface StuckLoopOptions {\n /** Minimum call count to flag a loop (default 3). */\n minOccurrences?: number\n /** Maximum time between the first and last repeated call (default 60 seconds). */\n maxWindowMs?: number\n /**\n * Maximum other tool calls allowed between adjacent repeats (default 0).\n * Set to 1 to detect alternating patterns such as A,B,A,B,A.\n */\n maxInterveningToolCalls?: number\n /** Filter to a specific runId; omit to scan the entire corpus. */\n runId?: string\n}\n\nexport async function stuckLoopView(\n store: TraceStore,\n options: StuckLoopOptions = {},\n): Promise<StuckLoopReport> {\n const minOccurrences = options.minOccurrences ?? 3\n const maxWindowMs = options.maxWindowMs ?? DEFAULT_MAX_WINDOW_MS\n const maxInterveningToolCalls =\n options.maxInterveningToolCalls ?? DEFAULT_MAX_INTERVENING_TOOL_CALLS\n if (!Number.isInteger(minOccurrences) || minOccurrences < 1) {\n throw new RangeError('minOccurrences must be a positive integer')\n }\n if (!Number.isFinite(maxWindowMs) || maxWindowMs < 0) {\n throw new RangeError('maxWindowMs must be a finite non-negative number')\n }\n if (!Number.isInteger(maxInterveningToolCalls) || maxInterveningToolCalls < 0) {\n throw new RangeError('maxInterveningToolCalls must be a non-negative integer')\n }\n const runs = options.runId\n ? [{ runId: options.runId }]\n : (await store.listRuns()).map((r) => ({ runId: r.runId }))\n\n const findings: StuckLoopFinding[] = []\n for (const { runId } of runs) {\n const spans = await store.spans({ runId })\n const spansById = new Map(spans.map((span) => [span.spanId, span]))\n const scopedTools: ScopedToolCall[] = spans\n .filter(isToolSpan)\n .map((span, sourceIndex) => ({ span, sourceIndex }))\n .sort((a, b) => a.span.startedAt - b.span.startedAt || a.sourceIndex - b.sourceIndex)\n .map(({ span }) => ({ span, ...executionScope(span, spansById) }))\n const trackByLane = executionTrackByLane(\n scopedTools.map((call) => {\n const direct = call.laneSpanId === null || call.laneSpanId === call.scopeSpanId\n const timed = direct\n ? call.span\n : call.laneSpanId\n ? spansById.get(call.laneSpanId)\n : undefined\n return {\n key: executionKey(call),\n scopeKey: JSON.stringify(call.scopeSpanId),\n start: timed?.startedAt ?? null,\n end: timed?.endedAt ?? null,\n }\n }),\n )\n const nextToolIndexByTrack = new Map<string, number>()\n const orderedTools: IndexedToolCall[] = scopedTools.map((call) => {\n const trackId = trackByLane.get(executionKey(call))!\n const toolCallIndex = nextToolIndexByTrack.get(trackId) ?? 0\n nextToolIndexByTrack.set(trackId, toolCallIndex + 1)\n return { ...call, toolCallIndex, trackId }\n })\n const byKey = new Map<\n string,\n {\n calls: IndexedToolCall[]\n argHash: string\n toolName: string\n scopeSpanId: string | null\n }\n >()\n for (const call of orderedTools) {\n if (!hasCapturedToolArgs(call.span)) continue\n const h = argHash(call.span.args)\n const key = JSON.stringify([call.trackId, call.span.toolName, h])\n const bucket = byKey.get(key) ?? {\n calls: [],\n argHash: h,\n toolName: call.span.toolName,\n scopeSpanId: call.scopeSpanId,\n }\n bucket.calls.push(call)\n byKey.set(key, bucket)\n }\n for (const { calls, argHash: h, toolName, scopeSpanId } of byKey.values()) {\n if (calls.length < minOccurrences) continue\n let episodeStart = 0\n for (let episodeEnd = 1; episodeEnd <= calls.length; episodeEnd += 1) {\n const previous = calls[episodeEnd - 1]!\n const next = calls[episodeEnd]\n const episodeEnded =\n next === undefined ||\n next.span.startedAt - previous.span.startedAt > maxWindowMs ||\n next.toolCallIndex - previous.toolCallIndex - 1 > maxInterveningToolCalls ||\n !callsAreSerial(previous, next)\n if (!episodeEnded) continue\n\n const episode = calls.slice(episodeStart, episodeEnd)\n let left = 0\n let bestStart = 0\n let bestEnd = -1\n for (let right = 0; right < episode.length; right += 1) {\n while (episode[right]!.span.startedAt - episode[left]!.span.startedAt > maxWindowMs) {\n left += 1\n }\n if (right - left > bestEnd - bestStart) {\n bestStart = left\n bestEnd = right\n }\n }\n if (bestEnd - bestStart + 1 >= minOccurrences) {\n const loop = episode.slice(bestStart, bestEnd + 1)\n const first = loop[0]!.span.startedAt\n const last = loop[loop.length - 1]!.span.startedAt\n findings.push({\n runId,\n toolName,\n argHash: h,\n occurrences: loop.length,\n spanIds: loop.map((call) => call.span.spanId),\n ...(scopeSpanId ? { scopeSpanId } : {}),\n windowMs: last - first,\n })\n }\n episodeStart = episodeEnd\n }\n }\n }\n\n const affectedRuns = new Set(findings.map((f) => f.runId))\n return {\n findings,\n affectedRunRatio: runs.length > 0 ? affectedRuns.size / runs.length : 0,\n totalRuns: runs.length,\n }\n}\n\nfunction laneKey(call: Pick<ScopedToolCall, 'scopeSpanId' | 'laneSpanId'>): string {\n return JSON.stringify([call.scopeSpanId, call.laneSpanId])\n}\n\nfunction executionKey(call: ScopedToolCall): string {\n return call.laneSpanId === null || call.laneSpanId === call.scopeSpanId\n ? JSON.stringify([call.scopeSpanId, call.span.spanId])\n : laneKey(call)\n}\n\nfunction executionScope(\n span: ToolSpan,\n spansById: ReadonlyMap<string, Span>,\n): { scopeSpanId: string | null; laneSpanId: string | null } {\n const directParent = span.parentSpanId\n if (!directParent) return { scopeSpanId: null, laneSpanId: null }\n\n let currentId: string | undefined = directParent\n let laneSpanId: string | null = null\n const seen = new Set<string>()\n while (currentId && !seen.has(currentId)) {\n seen.add(currentId)\n const current = spansById.get(currentId)\n if (!current) return { scopeSpanId: directParent, laneSpanId: directParent }\n if (current.kind === 'agent') {\n return { scopeSpanId: current.spanId, laneSpanId: laneSpanId ?? current.spanId }\n }\n laneSpanId = current.spanId\n currentId = current.parentSpanId\n }\n return { scopeSpanId: directParent, laneSpanId: directParent }\n}\n\nfunction callsAreSerial(previous: IndexedToolCall, next: IndexedToolCall): boolean {\n return previous.span.endedAt !== undefined && previous.span.endedAt <= next.span.startedAt\n}\n"],"mappings":";;;;;;;AA+EA,SAAgB,UAAU,GAAwB,GAAkC;CAClF,MAAM,6BAAa,IAAI,IAAkD;CACzE,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,QAAQ,GAAW,GAAW,aAA0B;EAC5D,WAAW,IAAI,GAAG;GAAE,GAAG;GAAG;EAAS,CAAC;EACpC,QAAQ,IAAI,CAAC;CACf;CAEA,MAAM,wBAAQ,IAAI,IAAsB;CACxC,EAAE,SAAS,MAAM,MAAM;EACrB,MAAM,OAAO,MAAM,IAAI,KAAK,EAAE;EAC9B,IAAI,MAAM,KAAK,KAAK,CAAC;OAChB,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;CAC7B,CAAC;CACD,EAAE,SAAS,MAAM,MAAM;EACrB,MAAM,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC,QAAQ,IAAI,SAAS,CAAC;EACzE,IAAI,MAAM,KAAA,GAAW,KAAK,GAAG,GAAG,IAAI;CAC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,SAAS,GAAG;EACxC,KAAK,IAAI,SAAS;EAClB,MAAM,UAAU,UAAU,IAAI,SAAS;EACvC,IAAI,CAAC,SAAS,OAAO;GAAE,aAAa;GAAc,YAAY;EAAa;EAC3E,IAAI,QAAQ,SAAS,SACnB,OAAO;GAAE,aAAa,QAAQ;GAAQ,YAAY,cAAc,QAAQ;EAAO;EAEjF,aAAa,QAAQ;EACrB,YAAY,QAAQ;CACtB;CACA,OAAO;EAAE,aAAa;EAAc,YAAY;CAAa;AAC/D;AAEA,SAAS,eAAe,UAA2B,MAAgC;CACjF,OAAO,SAAS,KAAK,YAAY,KAAA,KAAa,SAAS,KAAK,WAAW,KAAK,KAAK;AACnF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/pipelines/first-divergence.ts","../../src/pipelines/stuck-loop.ts"],"sourcesContent":["/**\n * Step diff between two runs, with the first divergence marked.\n *\n * Steps pair in three passes, each over the steps still unpaired:\n * 1. `id`: the same step id in both runs, e.g. a forked run that kept its\n * parent's span ids.\n * 2. `position`: the same index with the same name and kind.\n * 3. `name`: the same name and kind anywhere, first unpaired step in order.\n * A step left unpaired exists in only one run. The first divergence is the\n * first index at which the two runs stop agreeing step for step, and it says\n * how: a paired step changed, one run replaced, added or removed a step, or the\n * runs ran the same steps in a different order.\n *\n * `diffSteps` reads plain `DiffStep` lists, so the same diff serves agent-eval\n * trace stores (`firstDivergenceView`) and flat OTLP spans\n * (`diffStepsFromSpans`). Use it to attribute \"why is variant B better?\" to a\n * step, and to compare sibling or parent and child runs of a search tree.\n */\n\nimport type { DiagnosisSpan } from '../diagnosis/spans'\nimport type { Span } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\nimport { buildTrajectory, type TrajectoryStep } from '../trajectory'\n\n/** One step of a run, as the diff reads it. */\nexport interface DiffStep {\n /** The step's id within its run. */\n id: string\n name: string\n kind: string\n /** Fields compared once two steps pair, such as status, tool or model. */\n fields: Readonly<Record<string, string | number | boolean | null>>\n}\n\nexport type StepPairing = 'id' | 'position' | 'name'\n\nexport interface FieldDifference {\n field: string\n a: string | number | boolean | null\n b: string | number | boolean | null\n}\n\nexport interface StepPair {\n /** Index in run A. */\n a: number\n /** Index in run B. */\n b: number\n pairedBy: StepPairing\n /** Empty when the paired steps agree on name, kind and every field. */\n differences: FieldDifference[]\n}\n\nexport type StepDivergenceKind = 'changed' | 'replaced' | 'only-in-a' | 'only-in-b' | 'reordered'\n\nexport interface StepDivergence {\n /** The first index at which the runs stop agreeing; equals `commonPrefixLen`. */\n index: number\n kind: StepDivergenceKind\n /** Index of the step at `index` in each run, or null when that run has ended. */\n a: number | null\n b: number | null\n /** Set when `kind` is `changed`. */\n differences: FieldDifference[]\n reason: string\n}\n\nexport interface StepDiff {\n /** Paired steps in run A order. */\n pairs: StepPair[]\n /** Indexes of run A steps with no partner in run B. */\n onlyInA: number[]\n /** Indexes of run B steps with no partner in run A. */\n onlyInB: number[]\n /** Leading steps paired index for index with no difference. */\n commonPrefixLen: number\n /** Null when the runs agree step for step. */\n firstDivergence: StepDivergence | null\n}\n\nexport function diffSteps(a: readonly DiffStep[], b: readonly DiffStep[]): StepDiff {\n const partnerOfA = new Map<number, { b: number; pairedBy: StepPairing }>()\n const pairedB = new Set<number>()\n const pair = (i: number, j: number, pairedBy: StepPairing) => {\n partnerOfA.set(i, { b: j, pairedBy })\n pairedB.add(j)\n }\n\n const bById = new Map<string, number[]>()\n b.forEach((step, j) => {\n const list = bById.get(step.id)\n if (list) list.push(j)\n else bById.set(step.id, [j])\n })\n a.forEach((step, i) => {\n const j = bById.get(step.id)?.find((candidate) => !pairedB.has(candidate))\n if (j !== undefined) pair(i, j, 'id')\n })\n a.forEach((step, i) => {\n if (partnerOfA.has(i) || i >= b.length || pairedB.has(i)) return\n if (sameShape(step, b[i]!)) pair(i, i, 'position')\n })\n a.forEach((step, i) => {\n if (partnerOfA.has(i)) return\n const j = b.findIndex((candidate, index) => !pairedB.has(index) && sameShape(step, candidate))\n if (j >= 0) pair(i, j, 'name')\n })\n\n const pairs: StepPair[] = [...partnerOfA.entries()]\n .sort(([x], [y]) => x - y)\n .map(([i, partner]) => ({\n a: i,\n b: partner.b,\n pairedBy: partner.pairedBy,\n differences: differencesBetween(a[i]!, b[partner.b]!),\n }))\n const pairByA = new Map(pairs.map((entry) => [entry.a, entry]))\n const partnerOfB = new Map(pairs.map((entry) => [entry.b, entry.a]))\n\n let prefix = 0\n while (prefix < a.length && prefix < b.length) {\n const entry = pairByA.get(prefix)\n if (!entry || entry.b !== prefix || entry.differences.length > 0) break\n prefix += 1\n }\n\n return {\n pairs,\n onlyInA: a.map((_, i) => i).filter((i) => !partnerOfA.has(i)),\n onlyInB: b.map((_, j) => j).filter((j) => !pairedB.has(j)),\n commonPrefixLen: prefix,\n firstDivergence:\n prefix === a.length && prefix === b.length\n ? null\n : divergenceAt(prefix, a, b, pairByA.get(prefix), partnerOfB),\n }\n}\n\nfunction divergenceAt(\n index: number,\n a: readonly DiffStep[],\n b: readonly DiffStep[],\n pairOfA: StepPair | undefined,\n partnerOfB: ReadonlyMap<number, number>,\n): StepDivergence {\n const stepA = a[index]\n const stepB = b[index]\n const base = {\n index,\n a: stepA ? index : null,\n b: stepB ? index : null,\n differences: [] as FieldDifference[],\n }\n if (stepA && stepB && pairOfA?.b === index) {\n return {\n ...base,\n kind: 'changed',\n differences: pairOfA.differences,\n reason: `at index ${index}, ${describe(stepA)} changed: ${pairOfA.differences\n .map((d) => `${d.field} ${String(d.a)} vs ${String(d.b)}`)\n .join('; ')}`,\n }\n }\n const aUnpaired = stepA !== undefined && pairOfA === undefined\n const bUnpaired = stepB !== undefined && !partnerOfB.has(index)\n if (stepA && stepB && aUnpaired && bUnpaired) {\n return {\n ...base,\n kind: 'replaced',\n reason: `at index ${index}, A ran ${describe(stepA)} and B ran ${describe(stepB)}`,\n }\n }\n if (stepA && aUnpaired) {\n return {\n ...base,\n kind: 'only-in-a',\n reason: `at index ${index}, only A has ${describe(stepA)}`,\n }\n }\n if (stepB && bUnpaired) {\n return {\n ...base,\n kind: 'only-in-b',\n reason: `at index ${index}, only B has ${describe(stepB)}`,\n }\n }\n return {\n ...base,\n kind: 'reordered',\n reason: `at index ${index}, A ran ${describe(stepA!)} and B ran ${describe(stepB!)}; both steps occur in the other run at a different position`,\n }\n}\n\nfunction sameShape(x: DiffStep, y: DiffStep): boolean {\n return x.name === y.name && x.kind === y.kind\n}\n\nfunction differencesBetween(x: DiffStep, y: DiffStep): FieldDifference[] {\n const differences: FieldDifference[] = []\n if (x.kind !== y.kind) differences.push({ field: 'kind', a: x.kind, b: y.kind })\n if (x.name !== y.name) differences.push({ field: 'name', a: x.name, b: y.name })\n const fields = [...new Set([...Object.keys(x.fields), ...Object.keys(y.fields)])].sort()\n for (const field of fields) {\n const left = x.fields[field] ?? null\n const right = y.fields[field] ?? null\n if (left !== right) differences.push({ field, a: left, b: right })\n }\n return differences\n}\n\nfunction describe(step: DiffStep): string {\n return `${step.kind} \"${step.name}\"`\n}\n\n// ── agent-eval trace store ────────────────────────────────────────────\n\nexport interface DivergenceReport {\n runA: string\n runB: string\n /** Null when the runs agree step for step. */\n firstDivergenceIndex: number | null\n aStep?: TrajectoryStep\n bStep?: TrajectoryStep\n reason?: string\n commonPrefixLen: number\n /** The step diff behind the first divergence, over trajectory step indexes. */\n diff: StepDiff\n}\n\nexport async function firstDivergenceView(\n store: TraceStore,\n runA: string,\n runB: string,\n): Promise<DivergenceReport> {\n const [a, b] = await Promise.all([buildTrajectory(store, runA), buildTrajectory(store, runB)])\n const diff = diffSteps(a.steps.map(trajectoryDiffStep), b.steps.map(trajectoryDiffStep))\n const divergence = diff.firstDivergence\n return {\n runA,\n runB,\n firstDivergenceIndex: divergence?.index ?? null,\n ...(divergence?.a != null ? { aStep: a.steps[divergence.a] } : {}),\n ...(divergence?.b != null ? { bStep: b.steps[divergence.b] } : {}),\n ...(divergence ? { reason: divergence.reason } : {}),\n commonPrefixLen: diff.commonPrefixLen,\n diff,\n }\n}\n\nfunction trajectoryDiffStep(step: TrajectoryStep): DiffStep {\n const span: Span = step.span\n const fields: Record<string, string | number | boolean | null> = {\n status: span.status ?? null,\n }\n if (span.kind === 'tool') fields.tool = span.toolName\n if (span.kind === 'llm') fields.model = span.model\n if (span.kind === 'judge') fields.dimension = span.dimension\n return { id: span.spanId, name: span.name, kind: span.kind, fields }\n}\n\n// ── flat OTLP spans ───────────────────────────────────────────────────\n\n/**\n * One run's spans as diff steps, in containment order: depth first, siblings\n * by start time, the same order `buildTrajectory` gives a trace store run.\n * Spans whose parent is absent, or whose parents form a cycle, start their own\n * subtree, so every span appears exactly once.\n */\nexport function diffStepsFromSpans(spans: readonly DiagnosisSpan[]): DiffStep[] {\n const ids = new Set(spans.map((span) => span.spanId))\n const children = new Map<string | null, DiagnosisSpan[]>()\n for (const span of spans) {\n const parent =\n span.parentSpanId !== null && ids.has(span.parentSpanId) ? span.parentSpanId : null\n const list = children.get(parent)\n if (list) list.push(span)\n else children.set(parent, [span])\n }\n // Span ids are random per run, so two runs of the same logical trace can carry\n // different ids for \"the same\" span. Siblings that share a start time (a common\n // case: parallel steps a driver starts together) must still sort the same way\n // in both runs, or the diff below reports a false `reordered` divergence purely\n // from spanId noise. End time, kind and name are content, not per-run identity,\n // so they break the tie before spanId, which is the last resort.\n const byStart = (x: DiagnosisSpan, y: DiagnosisSpan) =>\n (x.startMs ?? 0) - (y.startMs ?? 0) ||\n (x.endMs ?? 0) - (y.endMs ?? 0) ||\n x.kind.localeCompare(y.kind) ||\n x.name.localeCompare(y.name) ||\n x.spanId.localeCompare(y.spanId)\n for (const list of children.values()) list.sort(byStart)\n const ordered: DiffStep[] = []\n const visited = new Set<string>()\n const visit = (span: DiagnosisSpan) => {\n if (visited.has(span.spanId)) return\n visited.add(span.spanId)\n ordered.push({\n id: span.spanId,\n name: span.name,\n kind: span.kind,\n fields: { status: span.status, tool: span.toolName, model: span.model },\n })\n for (const child of children.get(span.spanId) ?? []) visit(child)\n }\n for (const root of children.get(null) ?? []) visit(root)\n for (const span of [...spans].sort(byStart)) visit(span)\n return ordered\n}\n","/**\n * StuckLoopView — detects when an agent calls the same tool with the\n * same (or structurally similar) arguments ≥ N times in a short window.\n *\n * Rationale: agents that loop are the number-one production failure\n * mode on long-horizon flows. The view returns (runId, toolName,\n * argHash, occurrences, windowMs) for each detected loop plus a\n * fraction of runs affected.\n */\n\nimport { executionTrackByLane } from '../trace/execution-tracks'\nimport { argHash, hasCapturedToolArgs } from '../trace/query'\nimport { isToolSpan, type Span, type ToolSpan } from '../trace/schema'\nimport type { TraceStore } from '../trace/store'\n\nconst DEFAULT_MAX_WINDOW_MS = 60_000\nconst DEFAULT_MAX_INTERVENING_TOOL_CALLS = 0\n\ninterface ScopedToolCall {\n span: ToolSpan\n scopeSpanId: string | null\n laneSpanId: string | null\n}\n\ninterface IndexedToolCall extends ScopedToolCall {\n toolCallIndex: number\n trackId: string\n}\n\nexport interface StuckLoopFinding {\n runId: string\n toolName: string\n argHash: string\n /** Calls in this episode's densest qualifying interval, not the whole-run total. */\n occurrences: number\n spanIds: string[]\n /** Nearest agent ancestor, or the direct parent when ancestry is incomplete. */\n scopeSpanId?: string\n /** Milliseconds between first and last call in the loop. */\n windowMs: number\n}\n\nexport interface StuckLoopReport {\n findings: StuckLoopFinding[]\n affectedRunRatio: number\n totalRuns: number\n}\n\nexport interface StuckLoopOptions {\n /** Minimum call count to flag a loop (default 3). */\n minOccurrences?: number\n /** Maximum time between the first and last repeated call (default 60 seconds). */\n maxWindowMs?: number\n /**\n * Maximum other tool calls allowed between adjacent repeats (default 0).\n * Set to 1 to detect alternating patterns such as A,B,A,B,A.\n */\n maxInterveningToolCalls?: number\n /** Filter to a specific runId; omit to scan the entire corpus. */\n runId?: string\n}\n\nexport async function stuckLoopView(\n store: TraceStore,\n options: StuckLoopOptions = {},\n): Promise<StuckLoopReport> {\n const minOccurrences = options.minOccurrences ?? 3\n const maxWindowMs = options.maxWindowMs ?? DEFAULT_MAX_WINDOW_MS\n const maxInterveningToolCalls =\n options.maxInterveningToolCalls ?? DEFAULT_MAX_INTERVENING_TOOL_CALLS\n if (!Number.isInteger(minOccurrences) || minOccurrences < 1) {\n throw new RangeError('minOccurrences must be a positive integer')\n }\n if (!Number.isFinite(maxWindowMs) || maxWindowMs < 0) {\n throw new RangeError('maxWindowMs must be a finite non-negative number')\n }\n if (!Number.isInteger(maxInterveningToolCalls) || maxInterveningToolCalls < 0) {\n throw new RangeError('maxInterveningToolCalls must be a non-negative integer')\n }\n const runs = options.runId\n ? [{ runId: options.runId }]\n : (await store.listRuns()).map((r) => ({ runId: r.runId }))\n\n const findings: StuckLoopFinding[] = []\n for (const { runId } of runs) {\n const spans = await store.spans({ runId })\n const spansById = new Map(spans.map((span) => [span.spanId, span]))\n const scopedTools: ScopedToolCall[] = spans\n .filter(isToolSpan)\n .map((span, sourceIndex) => ({ span, sourceIndex }))\n .sort((a, b) => a.span.startedAt - b.span.startedAt || a.sourceIndex - b.sourceIndex)\n .map(({ span }) => ({ span, ...executionScope(span, spansById) }))\n const trackByLane = executionTrackByLane(\n scopedTools.map((call) => {\n const direct = call.laneSpanId === null || call.laneSpanId === call.scopeSpanId\n const timed = direct\n ? call.span\n : call.laneSpanId\n ? spansById.get(call.laneSpanId)\n : undefined\n return {\n key: executionKey(call),\n scopeKey: JSON.stringify(call.scopeSpanId),\n start: timed?.startedAt ?? null,\n end: timed?.endedAt ?? null,\n }\n }),\n )\n const nextToolIndexByTrack = new Map<string, number>()\n const orderedTools: IndexedToolCall[] = scopedTools.map((call) => {\n const trackId = trackByLane.get(executionKey(call))!\n const toolCallIndex = nextToolIndexByTrack.get(trackId) ?? 0\n nextToolIndexByTrack.set(trackId, toolCallIndex + 1)\n return { ...call, toolCallIndex, trackId }\n })\n const byKey = new Map<\n string,\n {\n calls: IndexedToolCall[]\n argHash: string\n toolName: string\n scopeSpanId: string | null\n }\n >()\n for (const call of orderedTools) {\n if (!hasCapturedToolArgs(call.span)) continue\n const h = argHash(call.span.args)\n const key = JSON.stringify([call.trackId, call.span.toolName, h])\n const bucket = byKey.get(key) ?? {\n calls: [],\n argHash: h,\n toolName: call.span.toolName,\n scopeSpanId: call.scopeSpanId,\n }\n bucket.calls.push(call)\n byKey.set(key, bucket)\n }\n for (const { calls, argHash: h, toolName, scopeSpanId } of byKey.values()) {\n if (calls.length < minOccurrences) continue\n let episodeStart = 0\n for (let episodeEnd = 1; episodeEnd <= calls.length; episodeEnd += 1) {\n const previous = calls[episodeEnd - 1]!\n const next = calls[episodeEnd]\n const episodeEnded =\n next === undefined ||\n next.span.startedAt - previous.span.startedAt > maxWindowMs ||\n next.toolCallIndex - previous.toolCallIndex - 1 > maxInterveningToolCalls ||\n !callsAreSerial(previous, next)\n if (!episodeEnded) continue\n\n const episode = calls.slice(episodeStart, episodeEnd)\n let left = 0\n let bestStart = 0\n let bestEnd = -1\n for (let right = 0; right < episode.length; right += 1) {\n while (episode[right]!.span.startedAt - episode[left]!.span.startedAt > maxWindowMs) {\n left += 1\n }\n if (right - left > bestEnd - bestStart) {\n bestStart = left\n bestEnd = right\n }\n }\n if (bestEnd - bestStart + 1 >= minOccurrences) {\n const loop = episode.slice(bestStart, bestEnd + 1)\n const first = loop[0]!.span.startedAt\n const last = loop[loop.length - 1]!.span.startedAt\n findings.push({\n runId,\n toolName,\n argHash: h,\n occurrences: loop.length,\n spanIds: loop.map((call) => call.span.spanId),\n ...(scopeSpanId ? { scopeSpanId } : {}),\n windowMs: last - first,\n })\n }\n episodeStart = episodeEnd\n }\n }\n }\n\n const affectedRuns = new Set(findings.map((f) => f.runId))\n return {\n findings,\n affectedRunRatio: runs.length > 0 ? affectedRuns.size / runs.length : 0,\n totalRuns: runs.length,\n }\n}\n\nfunction laneKey(call: Pick<ScopedToolCall, 'scopeSpanId' | 'laneSpanId'>): string {\n return JSON.stringify([call.scopeSpanId, call.laneSpanId])\n}\n\nfunction executionKey(call: ScopedToolCall): string {\n return call.laneSpanId === null || call.laneSpanId === call.scopeSpanId\n ? JSON.stringify([call.scopeSpanId, call.span.spanId])\n : laneKey(call)\n}\n\nfunction executionScope(\n span: ToolSpan,\n spansById: ReadonlyMap<string, Span>,\n): { scopeSpanId: string | null; laneSpanId: string | null } {\n const directParent = span.parentSpanId\n if (!directParent) return { scopeSpanId: null, laneSpanId: null }\n\n let currentId: string | undefined = directParent\n let laneSpanId: string | null = null\n const seen = new Set<string>()\n while (currentId && !seen.has(currentId)) {\n seen.add(currentId)\n const current = spansById.get(currentId)\n if (!current) return { scopeSpanId: directParent, laneSpanId: directParent }\n if (current.kind === 'agent') {\n return { scopeSpanId: current.spanId, laneSpanId: laneSpanId ?? current.spanId }\n }\n laneSpanId = current.spanId\n currentId = current.parentSpanId\n }\n return { scopeSpanId: directParent, laneSpanId: directParent }\n}\n\nfunction callsAreSerial(previous: IndexedToolCall, next: IndexedToolCall): boolean {\n return previous.span.endedAt !== undefined && previous.span.endedAt <= next.span.startedAt\n}\n"],"mappings":";;;;;AA+EA,SAAgB,UAAU,GAAwB,GAAkC;CAClF,MAAM,6BAAa,IAAI,IAAkD;CACzE,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,QAAQ,GAAW,GAAW,aAA0B;EAC5D,WAAW,IAAI,GAAG;GAAE,GAAG;GAAG;EAAS,CAAC;EACpC,QAAQ,IAAI,CAAC;CACf;CAEA,MAAM,wBAAQ,IAAI,IAAsB;CACxC,EAAE,SAAS,MAAM,MAAM;EACrB,MAAM,OAAO,MAAM,IAAI,KAAK,EAAE;EAC9B,IAAI,MAAM,KAAK,KAAK,CAAC;OAChB,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;CAC7B,CAAC;CACD,EAAE,SAAS,MAAM,MAAM;EACrB,MAAM,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC,QAAQ,IAAI,SAAS,CAAC;EACzE,IAAI,MAAM,KAAA,GAAW,KAAK,GAAG,GAAG,IAAI;CACtC,CAAC;CACD,EAAE,SAAS,MAAM,MAAM;EACrB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nF"}
@@ -1,5 +1,5 @@
1
- import { s as zQuantile } from "./internal-Epl-YBZW.js";
2
- import { t as normalCdf } from "./normal-DsJZtrJc.js";
1
+ import { s as zQuantile } from "./internal-BTK91Bqt.js";
2
+ import { o as normalCdf } from "./paired-arms-Ct4LTKc1.js";
3
3
  //#region src/statistics/power-and-mde.ts
4
4
  /**
5
5
  * Required N per arm for a two-sample comparison at target effect size,
@@ -97,4 +97,4 @@ function mcnemarPower(opts) {
97
97
  //#endregion
98
98
  export { requiredSampleSize as a, requiredPairedSampleSize as i, mcnemarRequiredN as n, pairedMde as r, mcnemarPower as t };
99
99
 
100
- //# sourceMappingURL=power-and-mde-Hj2ubb4B.js.map
100
+ //# sourceMappingURL=power-and-mde-N5nU4_Ly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"power-and-mde-Hj2ubb4B.js","names":[],"sources":["../src/statistics/power-and-mde.ts"],"sourcesContent":["import { normalCdf } from '../math/normal'\nimport { zQuantile } from './internal'\n\n// ── Power analysis + minimum detectable effect ───────────────────────\n\n/**\n * Required N per arm for a two-sample comparison at target effect size,\n * alpha, and power. Normal-approximation formula:\n * n = 2 * ( (z_{1-α/2} + z_{1-β}) / d )^2\n * where d is Cohen's d. Returns Infinity for effect ≤ 0.\n */\nexport function requiredSampleSize(opts: {\n effect: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n const effect = opts.effect\n if (!Number.isFinite(effect) || effect <= 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n const n = 2 * ((zAlpha + zBeta) / effect) ** 2\n return Math.ceil(n)\n}\n\n/**\n * Required number of paired observations for a target Cohen's dz.\n * Unlike the independent-groups formula, this has no two-arm factor of two.\n *\n * Normal quantiles with no t correction, so treat the result as a LOWER bound:\n * it returns 32 where the exact t-based answer is 34 at dz = 0.5, and 13 where\n * it is 15 at dz = 0.8 — a 6–13 % shortfall precisely in the range a caller\n * consults to decide whether 3–10 repetitions suffice.\n */\nexport function requiredPairedSampleSize(opts: {\n effect: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n const effect = opts.effect\n if (!Number.isFinite(effect) || effect <= 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n return Math.ceil(((zAlpha + zBeta) / effect) ** 2)\n}\n\n/**\n * Minimum detectable paired effect (standardised units) for a target paired\n * sample size: d_min = (z_{1-α/2} + z_β) / sqrt(n_paired). Multiply by\n * sd(deltas) for score units; treat as a lower bound — Wilcoxon and bootstrap\n * have asymptotic relative efficiency below 1 vs the t-test on heavy tails.\n */\nexport function pairedMde(opts: {\n nPaired: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n if (!Number.isFinite(opts.nPaired) || opts.nPaired <= 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n return (zAlpha + zBeta) / Math.sqrt(opts.nPaired)\n}\n\n/**\n * Number of paired observations needed for a McNemar test to reach a target\n * power — the pre-registration companion to {@link mcnemar}. Parametrised by the\n * expected discordant-cell probabilities `p10` (P[treatment wins on a pair]) and\n * `p01` (P[control wins]); concordant pairs carry no information, so the count\n * is driven entirely by the discordant rate. Lachin's (1992) asymptotic normal\n * approximation: with discordant rate `pDisc = p10 + p01` and marginal effect\n * `δ = p10 − p01`,\n * n = ( z_{1-α/2}·√pDisc + z_{1-β}·√(pDisc − δ²) )² / δ².\n * Returns Infinity when there is no effect (p10 === p01). Asymptotic — at the\n * tiny discordant counts where the exact {@link mcnemar} differs from the normal\n * approximation, treat the result as a lower bound and prefer the discordant-pair\n * floor.\n */\nexport function mcnemarRequiredN(opts: {\n p10: number\n p01: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n const { p10, p01 } = opts\n if (p10 < 0 || p01 < 0 || p10 + p01 > 1) {\n throw new Error(`mcnemarRequiredN: require p10,p01 ≥ 0 and p10+p01 ≤ 1 (got ${p10}, ${p01})`)\n }\n const delta = p10 - p01\n if (delta === 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const pDisc = p10 + p01\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n const n =\n (zAlpha * Math.sqrt(pDisc) + zBeta * Math.sqrt(Math.max(0, pDisc - delta * delta))) ** 2 /\n (delta * delta)\n return Math.ceil(n)\n}\n\n/**\n * Power of a McNemar test at a given number of paired observations, the inverse\n * of {@link mcnemarRequiredN} (same Lachin asymptotic model, same parameters).\n * Returns a value in [0, 1]; equals `alpha` when there is no effect.\n */\nexport function mcnemarPower(opts: {\n p10: number\n p01: number\n nPairs: number\n alpha?: number\n twoSided?: boolean\n}): number {\n const { p10, p01, nPairs } = opts\n if (p10 < 0 || p01 < 0 || p10 + p01 > 1) {\n throw new Error(`mcnemarPower: require p10,p01 ≥ 0 and p10+p01 ≤ 1 (got ${p10}, ${p01})`)\n }\n const alpha = opts.alpha ?? 0.05\n const twoSided = opts.twoSided ?? true\n const delta = p10 - p01\n if (delta === 0 || nPairs <= 0) return alpha\n const pDisc = p10 + p01\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const denom = Math.sqrt(Math.max(1e-12, pDisc - delta * delta))\n const zBeta = (Math.sqrt(nPairs) * Math.abs(delta) - zAlpha * Math.sqrt(pDisc)) / denom\n return Math.min(1, Math.max(0, normalCdf(zBeta)))\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,mBAAmB,MAKxB;CACT,MAAM,SA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KAAK,SAAS;CAC5B,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,WAAW,KAAK,YAAY;CAClC,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,UAAU,WAAW,IAAI,QAAQ,IAAI,IAAI,KAAK;CAC7D,MAAM,QAAQ,UAAU,KAAK;CAC7B,MAAM,KACH,SAAS,KAAK,KAAK,KAAK,IAAI,QAAQ,KAAK,KAAK,KAAK,IAAI,GAAG,QAAQ,QAAQ,KAAK,CAAC,MAAM,KACtF,QAAQ;CACX,OAAO,KAAK,KAAK,CAAC;AACpB;;;;;;AAOA,SAAgB,aAAa,MAMlB;CACT,MAAM,EAAE,KAAK,KAAK,WAAW;CAC7B,IAAI,MAAM,KAAK,MAAM,KAAK,MAAM,MAAM,GACpC,MAAM,IAAI,MAAM,0DAA0D,IAAI,IAAI,IAAI,EAAE;CAE1F,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,WAAW,KAAK,YAAY;CAClC,MAAM,QAAQ,MAAM;CACpB,IAAI,UAAU,KAAK,UAAU,GAAG,OAAO;CACvC,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,UAAU,WAAW,IAAI,QAAQ,IAAI,IAAI,KAAK;CAC7D,MAAM,QAAQ,KAAK,KAAK,KAAK,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC;CAC9D,MAAM,SAAS,KAAK,KAAK,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,SAAS,KAAK,KAAK,KAAK,KAAK;CAClF,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,UAAU,KAAK,CAAC,CAAC;AAClD"}
1
+ {"version":3,"file":"power-and-mde-N5nU4_Ly.js","names":[],"sources":["../src/statistics/power-and-mde.ts"],"sourcesContent":["import { normalCdf } from '../math/normal'\nimport { zQuantile } from './internal'\n\n// ── Power analysis + minimum detectable effect ───────────────────────\n\n/**\n * Required N per arm for a two-sample comparison at target effect size,\n * alpha, and power. Normal-approximation formula:\n * n = 2 * ( (z_{1-α/2} + z_{1-β}) / d )^2\n * where d is Cohen's d. Returns Infinity for effect ≤ 0.\n */\nexport function requiredSampleSize(opts: {\n effect: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n const effect = opts.effect\n if (!Number.isFinite(effect) || effect <= 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n const n = 2 * ((zAlpha + zBeta) / effect) ** 2\n return Math.ceil(n)\n}\n\n/**\n * Required number of paired observations for a target Cohen's dz.\n * Unlike the independent-groups formula, this has no two-arm factor of two.\n *\n * Normal quantiles with no t correction, so treat the result as a LOWER bound:\n * it returns 32 where the exact t-based answer is 34 at dz = 0.5, and 13 where\n * it is 15 at dz = 0.8 — a 6–13 % shortfall precisely in the range a caller\n * consults to decide whether 3–10 repetitions suffice.\n */\nexport function requiredPairedSampleSize(opts: {\n effect: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n const effect = opts.effect\n if (!Number.isFinite(effect) || effect <= 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n return Math.ceil(((zAlpha + zBeta) / effect) ** 2)\n}\n\n/**\n * Minimum detectable paired effect (standardised units) for a target paired\n * sample size: d_min = (z_{1-α/2} + z_β) / sqrt(n_paired). Multiply by\n * sd(deltas) for score units; treat as a lower bound — Wilcoxon and bootstrap\n * have asymptotic relative efficiency below 1 vs the t-test on heavy tails.\n */\nexport function pairedMde(opts: {\n nPaired: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n if (!Number.isFinite(opts.nPaired) || opts.nPaired <= 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n return (zAlpha + zBeta) / Math.sqrt(opts.nPaired)\n}\n\n/**\n * Number of paired observations needed for a McNemar test to reach a target\n * power — the pre-registration companion to {@link mcnemar}. Parametrised by the\n * expected discordant-cell probabilities `p10` (P[treatment wins on a pair]) and\n * `p01` (P[control wins]); concordant pairs carry no information, so the count\n * is driven entirely by the discordant rate. Lachin's (1992) asymptotic normal\n * approximation: with discordant rate `pDisc = p10 + p01` and marginal effect\n * `δ = p10 − p01`,\n * n = ( z_{1-α/2}·√pDisc + z_{1-β}·√(pDisc − δ²) )² / δ².\n * Returns Infinity when there is no effect (p10 === p01). Asymptotic — at the\n * tiny discordant counts where the exact {@link mcnemar} differs from the normal\n * approximation, treat the result as a lower bound and prefer the discordant-pair\n * floor.\n */\nexport function mcnemarRequiredN(opts: {\n p10: number\n p01: number\n alpha?: number\n power?: number\n twoSided?: boolean\n}): number {\n const { p10, p01 } = opts\n if (p10 < 0 || p01 < 0 || p10 + p01 > 1) {\n throw new Error(`mcnemarRequiredN: require p10,p01 ≥ 0 and p10+p01 ≤ 1 (got ${p10}, ${p01})`)\n }\n const delta = p10 - p01\n if (delta === 0) return Infinity\n const alpha = opts.alpha ?? 0.05\n const power = opts.power ?? 0.8\n const twoSided = opts.twoSided ?? true\n const pDisc = p10 + p01\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const zBeta = zQuantile(power)\n const n =\n (zAlpha * Math.sqrt(pDisc) + zBeta * Math.sqrt(Math.max(0, pDisc - delta * delta))) ** 2 /\n (delta * delta)\n return Math.ceil(n)\n}\n\n/**\n * Power of a McNemar test at a given number of paired observations, the inverse\n * of {@link mcnemarRequiredN} (same Lachin asymptotic model, same parameters).\n * Returns a value in [0, 1]; equals `alpha` when there is no effect.\n */\nexport function mcnemarPower(opts: {\n p10: number\n p01: number\n nPairs: number\n alpha?: number\n twoSided?: boolean\n}): number {\n const { p10, p01, nPairs } = opts\n if (p10 < 0 || p01 < 0 || p10 + p01 > 1) {\n throw new Error(`mcnemarPower: require p10,p01 ≥ 0 and p10+p01 ≤ 1 (got ${p10}, ${p01})`)\n }\n const alpha = opts.alpha ?? 0.05\n const twoSided = opts.twoSided ?? true\n const delta = p10 - p01\n if (delta === 0 || nPairs <= 0) return alpha\n const pDisc = p10 + p01\n const zAlpha = zQuantile(twoSided ? 1 - alpha / 2 : 1 - alpha)\n const denom = Math.sqrt(Math.max(1e-12, pDisc - delta * delta))\n const zBeta = (Math.sqrt(nPairs) * Math.abs(delta) - zAlpha * Math.sqrt(pDisc)) / denom\n return Math.min(1, Math.max(0, normalCdf(zBeta)))\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,mBAAmB,MAKxB;CACT,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,OAAO,SAAS,MAAM,KAAK,UAAU,GAAG,OAAO;CACpD,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,WAAW,KAAK,YAAY;CAGlC,MAAM,IAAI,MAFK,UAAU,WAAW,IAAI,QAAQ,IAAI,IAAI,KAEnC,IADP,UAAU,KACK,KAAK,WAAW;CAC7C,OAAO,KAAK,KAAK,CAAC;AACpB;;;;;;;;;;AAWA,SAAgB,yBAAyB,MAK9B;CACT,MAAM,SAAS,KAAK;CACpB,IAAI,CAAC,OAAO,SAAS,MAAM,KAAK,UAAU,GAAG,OAAO;CACpD,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,QAAQ,KAAK,SAAS;CAC5B,MAAM,WAAW,KAAK,YAAY;CAClC,MAAM,SAAS,UAAU,WAAW,IAAI,QAAQ,IAAI,IAAI,KAAK;CAC7D,MAAM,QAAQ,UAAU,KAAK;CAC7B,OAAO,KAAK,OAAO,SAAS,SAAS,WAAW,CAAC;AACnD;;;;;;;AAQA,SAAgB,UAAU,MAKf;CACT,IAAI,C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AU,WAAW,IAAI,QAAQ,IAAI,IAAI,KAAK;CAC7D,MAAM,QAAQ,KAAK,KAAK,KAAK,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC;CAC9D,MAAM,SAAS,KAAK,KAAK,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,SAAS,KAAK,KAAK,KAAK,KAAK;CAClF,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,UAAU,KAAK,CAAC,CAAC;AAClD"}
@@ -1,4 +1,4 @@
1
- import { s as ValidationError } from "./errors-DVZiqS7K.js";
1
+ import { s as ValidationError } from "./errors-BcOs5MKW.js";
2
2
  import { createHash } from "node:crypto";
3
3
  //#region src/analyst/reply-contract.ts
4
4
  /**
@@ -478,6 +478,6 @@ function primeProtocolSha256(identity) {
478
478
  })).digest("hex");
479
479
  }
480
480
  //#endregion
481
- export { extractPrimeJsonObject as a, primeProtocolSha256 as c, runPrimeExchange as d, decodeReplyRows as f, emptyPrimeRawUsage as i, primeReplyDefect as l, buildPrimePrompt as n, mergePrimeRawUsage as o, buildPrimeRepairPrompt as r, normalizePrimeUsage as s, analystUsageReceiptFromPrimeUsage as t, projectPrimeTrajectory as u };
481
+ export { normalizePrimeUsage as a, runPrimeExchange as c, mergePrimeRawUsage as i, decodeReplyRows as l, buildPrimePrompt as n, primeProtocolSha256 as o, buildPrimeRepairPrompt as r, projectPrimeTrajectory as s, analystUsageReceiptFromPrimeUsage as t };
482
482
 
483
- //# sourceMappingURL=prime-protocol-CHKgA3a6.js.map
483
+ //# sourceMappingURL=prime-protocol-BFgGrEMP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prime-protocol-BFgGrEMP.js","names":[],"sources":["../src/analyst/reply-contract.ts","../src/analyst/prime-protocol.ts"],"sourcesContent":["/**\n * The reply grammar an analyst arm holds a model to, independent of transport.\n *\n * One contract serves every arm shape: the inline bridge protocol\n * (`runPrimeExchange`) reads the base fields, and one-shot JSON arms\n * additionally use the strict-envelope and all-rejected knobs. `PrimeReplyContract`\n * in ./prime-protocol is a type alias of this contract, so a consumer written\n * against the prime protocol names the same grammar object.\n */\n\nimport { ValidationError } from '../errors'\n\n/** Verdict of decoding one raw reply row. */\nexport type ReplyRowDecoded<TRow> = { ok: true; row: TRow } | { ok: false; reason: string }\n\n/** A strictly parsed reply envelope: the row array plus retained extras. */\nexport interface ReplyEnvelope {\n rows: readonly unknown[]\n /** Envelope fields beside the rows the arm retains (e.g. a `report` string). */\n extras: Record<string, unknown>\n}\n\nexport interface ReplyContract<TRow> {\n /** Name of the reply's row array, e.g. `blocks` or `findings`. */\n rowsField: string\n /** Row-grammar lines spliced into the first-turn prompt. */\n contractLines: readonly string[]\n /**\n * The same grammar restated for the repair turn, which never carries the\n * evidence. Empty when the arm declares zero repair turns.\n */\n repairContractLines: readonly string[]\n /**\n * Validate and convert one raw row in a single pass. One function rather than\n * a separate validator and constructor, so the two can never disagree about\n * what a valid row is.\n */\n decodeRow(row: unknown, index: number): ReplyRowDecoded<TRow>\n /**\n * Cap on ACCEPTED rows. The cap is applied after decoding, so malformed rows\n * never consume an accepted slot; the surplus is reported as `overflow`.\n * Omit when the consumer's own expansion owns the cap and records the drop.\n */\n maxRows?: number\n /**\n * Strict envelope parse for one-shot JSON arms. Throws on an envelope defect\n * (missing report, unknown key, over-cap row count). When absent, rows are\n * read from `rowsField` on the parsed reply object.\n */\n parseEnvelope?(value: unknown): ReplyEnvelope\n /**\n * What a reply whose EVERY reported row was rejected means. `fail` throws a\n * validation error carrying each rejection; `accept-empty` (the default)\n * keeps the honest empty result beside the recorded rejections.\n */\n whenAllRowsRejected?: 'fail' | 'accept-empty'\n /**\n * Message prefix for the `fail` case, in the contract's own row vocabulary\n * (e.g. \"every reported failure block was malformed\").\n */\n allRejectedMessage?: string\n}\n\n/** One rejected row, indexed as the model reported it. */\nexport interface ReplyRowRejection {\n index: number\n reason: string\n}\n\nexport interface DecodedReply<TRow> {\n rows: TRow[]\n /** Envelope fields beside the rows (empty when the contract has no envelope). */\n extras: Record<string, unknown>\n rejected: ReplyRowRejection[]\n /** Rows the model reported, before decoding or the count cap. */\n reportedRows: number\n /** Valid rows dropped by `maxRows`. */\n overflow: number\n}\n\n/**\n * The per-row half of a decode: validate each raw row under the contract's\n * grammar and cap ACCEPTED rows. Shape before count — a malformed row never\n * consumes an accepted slot. Shared by every consumer of a `ReplyContract`\n * row array, whatever envelope handling surrounds it.\n */\nexport function decodeContractRows<TRow>(\n contract: Pick<ReplyContract<TRow>, 'decodeRow' | 'maxRows'>,\n rawRows: readonly unknown[],\n): { rows: TRow[]; rejected: ReplyRowRejection[]; overflow: number } {\n const rows: TRow[] = []\n const rejected: ReplyRowRejection[] = []\n let overflow = 0\n rawRows.forEach((row, index) => {\n const decoded = contract.decodeRow(row, index)\n if (!decoded.ok) {\n rejected.push({ index, reason: decoded.reason })\n return\n }\n if (contract.maxRows !== undefined && rows.length >= contract.maxRows) {\n overflow += 1\n return\n }\n rows.push(decoded.row)\n })\n return { rows, rejected, overflow }\n}\n\n/**\n * Decode a parsed reply value under a contract: strict envelope when declared,\n * then per-row decoding, then the all-rejected policy.\n */\nexport function decodeReplyRows<TRow>(\n contract: ReplyContract<TRow>,\n value: unknown,\n): DecodedReply<TRow> {\n let rawRows: readonly unknown[]\n let extras: Record<string, unknown> = {}\n if (contract.parseEnvelope) {\n const envelope = contract.parseEnvelope(value)\n rawRows = envelope.rows\n extras = envelope.extras\n } else {\n const record =\n typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined\n const field = record?.[contract.rowsField]\n if (!Array.isArray(field)) {\n throw new ValidationError(`reply has no \"${contract.rowsField}\" array`)\n }\n rawRows = field\n }\n const { rows, rejected, overflow } = decodeContractRows(contract, rawRows)\n if (rows.length === 0 && rawRows.length > 0 && contract.whenAllRowsRejected === 'fail') {\n throw new ValidationError(\n `${contract.allRejectedMessage ?? 'every reported row was malformed'}: ${rejected\n .map((entry) => entry.reason)\n .join(' | ')}`,\n )\n }\n return { rows, extras, rejected, reportedRows: rawRows.length, overflow }\n}\n","import { createHash } from 'node:crypto'\nimport type { CustomTokenPricing } from '../cost-ledger'\nimport type { PrimeBridgeTransport, PrimeBridgeTransportResult } from './prime-bridge-transport'\nimport { decodeContractRows, type ReplyContract, type ReplyRowDecoded } from './reply-contract'\nimport type { AnalystUsageReceipt } from './types'\n\n/**\n * The prime analyst protocol: a one-shot RLM reached through an\n * OpenAI-compatible bridge, given the whole trajectory inline because it has no\n * REPL and no trace tools, answering in one fenced JSON block of short strings.\n *\n * This module owns every part of that protocol that does not depend on what the\n * rows MEAN: prompt and contract composition, the bounded repair turn, reply\n * extraction, row decoding order, the render-measure-fall-back-fail-loud\n * projection ladder, usage normalization, and the protocol identity digest.\n *\n * The cut: the core speaks RAW ROWS and never names a finding type. It knows a\n * prime reply carries an `answer` string plus an array of rows under a named\n * field, and that each row is decoded by a caller-supplied function. Consumers\n * — the CodeTraceBench benchmark runner here, a span-grounded trace analyzer\n * elsewhere — map decoded rows into their own finding shape on the way out. So\n * nothing in this file may import a block type, a finding type, or a trace\n * store, and no consumer needs another copy of the protocol.\n */\n\n// ── Reply contract ───────────────────────────────────────────────────\n\n/**\n * The prime reply grammar is the general analyst reply contract: these aliases\n * keep every prime-protocol consumer compiling against the shared type in\n * ./reply-contract. The exchange below reads the base fields (`rowsField`,\n * contract lines, `decodeRow`, `maxRows`); the strict-envelope knobs serve\n * one-shot JSON arms and are inert here.\n */\nexport type PrimeRowDecoded<TRow> = ReplyRowDecoded<TRow>\n\nexport type PrimeReplyContract<TRow> = ReplyContract<TRow>\n\n// ── Prompt composition ───────────────────────────────────────────────\n\nexport interface PrimePromptSpec {\n question: string\n /** Task definition spliced under a `TASK DEFINITION:` heading. Omit when the question is the whole task. */\n taskDefinition?: string\n contractLines: readonly string[]\n /** Line introducing the trajectory, e.g. `TRAJECTORY (trace_id X; 12 assistant step spans; ...):`. */\n trajectoryHeader: string\n renderedTrajectory: string\n /** Material appended after the trajectory, e.g. the final-verification spans. */\n trailer?: string\n}\n\nexport function buildPrimePrompt(spec: PrimePromptSpec): string {\n return [\n `QUESTION: ${spec.question}`,\n '',\n ...(spec.taskDefinition === undefined ? [] : ['TASK DEFINITION:', spec.taskDefinition, '']),\n ...spec.contractLines,\n '',\n spec.trajectoryHeader,\n spec.renderedTrajectory,\n ...(spec.trailer === undefined ? [] : ['', spec.trailer]),\n ].join('\\n')\n}\n\nexport interface PrimeRepairPromptSpec {\n defect: string\n previousReply: string\n repairContractLines: readonly string[]\n}\n\n/** Carries the malformed reply and the contract — never the trajectory. */\nexport function buildPrimeRepairPrompt(spec: PrimeRepairPromptSpec): string {\n return [\n 'Your previous reply to a trace-analysis task was structurally malformed and could not be parsed',\n `(${spec.defect}). Below is your previous reply verbatim. Re-emit ONLY the corrected JSON — one`,\n 'fenced ```json block, no other text, no tools. The JSON object has exactly two fields:',\n ...spec.repairContractLines,\n '',\n 'PREVIOUS REPLY:',\n spec.previousReply,\n ].join('\\n')\n}\n\n// ── Reply extraction ─────────────────────────────────────────────────\n\n/**\n * Recover the reply's JSON object.\n *\n * Distinct from `extractJsonPayload` in ../llm-client, which serves a response\n * that DECLARES a JSON root and therefore must not scan onward. A prime reply\n * is prose plus a fenced block, and when the model emits several fences the\n * last one is its answer — so fences are scanned in reverse, and only then is a\n * brace-to-brace slice tried.\n */\nfunction extractPrimeJsonObject(text: string): Record<string, unknown> | null {\n const direct = parsePrimeJsonObject(text)\n if (direct) return direct\n const fenced = [...text.matchAll(/```(?:json)?\\s*\\n?([\\s\\S]*?)```/g)]\n for (let index = fenced.length - 1; index >= 0; index -= 1) {\n const candidate = parsePrimeJsonObject(fenced[index]![1]!)\n if (candidate) return candidate\n }\n const start = text.indexOf('{')\n const end = text.lastIndexOf('}')\n if (start >= 0 && end > start) {\n const candidate = parsePrimeJsonObject(text.slice(start, end + 1))\n if (candidate) return candidate\n }\n return null\n}\n\n/** Why the reply cannot be read as a prime answer, or null when it can. */\nfunction primeReplyDefect(\n parsed: Record<string, unknown> | null,\n rowsField: string,\n): string | null {\n if (parsed === null) return 'no parseable JSON object'\n if (!Array.isArray(parsed[rowsField])) return `JSON has no \"${rowsField}\" array`\n return null\n}\n\nfunction parsePrimeJsonObject(text: string): Record<string, unknown> | null {\n try {\n const value: unknown = JSON.parse(text.trim())\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null\n } catch {\n return null\n }\n}\n\n// ── Usage ────────────────────────────────────────────────────────────\n\n/**\n * Token accounting exactly as the bridge reported it. Lossless on purpose: a\n * side the bridge did not report stays null rather than becoming a zero, and a\n * side it DID report survives even when its partner is missing.\n */\nexport interface PrimeRawUsage {\n /**\n * Model-usage records the bridge observed. NOT a count of bridge round trips:\n * one prime turn routes several internal model calls, so a single turn\n * typically reports 3-5.\n */\n calls: number | null\n /** Prompt tokens the bridge reported; null when it reported none. */\n inputTokens: number | null\n /** Completion tokens the bridge reported; null when it reported none. */\n outputTokens: number | null\n /**\n * True when the bridge DERIVED the counts (from character lengths) because\n * the backend reported no usage of its own. Pricing derived counts produces a\n * guess about a guess, which a reader must be able to tell apart from a\n * rate-estimated cost over exact tokens.\n */\n bridgeEstimated: boolean\n}\n\nfunction emptyPrimeRawUsage(): PrimeRawUsage {\n return { calls: null, inputTokens: null, outputTokens: null, bridgeEstimated: false }\n}\n\n/** Read the bridge's OpenAI-shaped `usage` object. */\nexport function normalizePrimeUsage(raw: unknown): PrimeRawUsage {\n if (typeof raw !== 'object' || raw === null) return emptyPrimeRawUsage()\n const record = raw as Record<string, unknown>\n return {\n calls: tokenCountOrNull(record.model_requests),\n inputTokens: tokenCountOrNull(record.prompt_tokens),\n outputTokens: tokenCountOrNull(record.completion_tokens),\n bridgeEstimated: record.estimated === true,\n }\n}\n\n/**\n * Sum two turns. Each side poisons independently: two turns that both report\n * input and neither report output yield a real input total beside a null\n * output, because discarding a measured count is as wrong as inventing one.\n */\nexport function mergePrimeRawUsage(a: PrimeRawUsage, b: PrimeRawUsage): PrimeRawUsage {\n return {\n calls: sumOrNull(a.calls, b.calls),\n inputTokens: sumOrNull(a.inputTokens, b.inputTokens),\n outputTokens: sumOrNull(a.outputTokens, b.outputTokens),\n bridgeEstimated: a.bridgeEstimated || b.bridgeEstimated,\n }\n}\n\nfunction sumOrNull(a: number | null, b: number | null): number | null {\n return a !== null && b !== null ? a + b : null\n}\n\nfunction tokenCountOrNull(value: unknown): number | null {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 ? value : null\n}\n\n/**\n * Bind raw prime usage to agent-eval's typed receipt.\n *\n * `RunTokenUsage.input` and `.output` are non-nullable, so a one-sided count\n * cannot round-trip through `tokens` without writing a zero nobody measured.\n * The complete-accounting field therefore stays null, the reported side is\n * carried verbatim in `partialTokens`, and its price becomes the receipt's\n * `knownCostUsd` lower bound.\n *\n * Only agent-eval calls this; consumers with no pricing table read\n * `PrimeRawUsage` directly.\n */\nexport function analystUsageReceiptFromPrimeUsage(\n usage: PrimeRawUsage,\n pricing: CustomTokenPricing,\n): AnalystUsageReceipt {\n const { calls, inputTokens, outputTokens, bridgeEstimated } = usage\n const estimatedTokens = bridgeEstimated ? { tokensEstimated: true } : {}\n if (inputTokens !== null && outputTokens !== null) {\n return {\n calls,\n tokens: { input: inputTokens, output: outputTokens },\n cost: { kind: 'estimated', usd: priceTokens(inputTokens, outputTokens, pricing) },\n ...estimatedTokens,\n }\n }\n if (inputTokens === null && outputTokens === null) {\n return { calls, tokens: null, cost: { kind: 'uncaptured', usd: null }, ...estimatedTokens }\n }\n return {\n calls,\n tokens: null,\n partialTokens: { input: inputTokens, output: outputTokens },\n cost: { kind: 'uncaptured', usd: null },\n knownCostUsd: priceTokens(inputTokens ?? 0, outputTokens ?? 0, pricing),\n ...estimatedTokens,\n }\n}\n\nfunction priceTokens(input: number, output: number, pricing: CustomTokenPricing): number {\n return (input * pricing.inputUsdPerMillion + output * pricing.outputUsdPerMillion) / 1_000_000\n}\n\n// ── Two-turn exchange ────────────────────────────────────────────────\n\n/**\n * Why an exchange ended without a readable reply. `deadline` and `aborted` are\n * separate members from `transport` on purpose: a model that ran past its\n * deadline, a caller who cancelled, and a bridge that refused the connection\n * demand three different responses, and a record that conflates them cannot be\n * acted on.\n */\nexport type PrimeFailure =\n | {\n kind: 'transport' | 'unparseable-json' | 'no-content' | 'deadline' | 'malformed-reply'\n message: string\n }\n | { kind: 'http-status'; message: string; status: number; bodySnippet: string }\n | { kind: 'aborted'; message: string; cause: unknown }\n\nexport interface PrimeRepairState {\n attempted: boolean\n /** Null when no repair turn ran, or when the repair turn never returned a reply. */\n succeeded: boolean | null\n}\n\n/** One completed bridge turn. A turn that failed produces no record. */\nexport interface PrimeTurnRecord {\n turn: 'first' | 'repair'\n usage: PrimeRawUsage\n /** The reply's `usage` object verbatim; null when the bridge sent none. */\n rawUsage: unknown\n}\n\nexport interface PrimeRejectedRow {\n index: number\n reason: string\n}\n\nexport type PrimeExchangeOutcome<TRow> =\n | {\n ok: true\n /** The reply's `answer` field; null when absent or not a string. */\n answer: string | null\n rows: TRow[]\n rejected: PrimeRejectedRow[]\n /** Rows the model reported, before decoding or the count cap. */\n reportedRows: number\n /** Valid rows dropped by `contract.maxRows`. */\n overflow: number\n usage: PrimeRawUsage\n turns: PrimeTurnRecord[]\n repair: PrimeRepairState\n reply: string\n }\n | {\n ok: false\n failure: PrimeFailure\n usage: PrimeRawUsage\n turns: PrimeTurnRecord[]\n repair: PrimeRepairState\n /** The last reply received, when one arrived — the diagnostic artifact for a malformed case. */\n reply?: string\n }\n\nexport interface PrimeExchangeOptions<TRow> {\n contract: PrimeReplyContract<TRow>\n prompt: string\n transport: PrimeBridgeTransport\n /** Full endpoint, e.g. `http://localhost:4181/v1/chat/completions`. */\n url: string\n model: string\n /** Deadline for ONE turn. Prime analyses routinely exceed five minutes. */\n timeoutMs: number\n /** Whether a structurally malformed reply gets one bounded repair turn. */\n repair: boolean\n signal?: AbortSignal\n}\n\n/**\n * Run the protocol: one call, one bounded repair turn on a structurally\n * malformed reply, then decode. Zero valid rows from a well-formed reply is an\n * honest null, not a failure.\n */\nexport async function runPrimeExchange<TRow>(\n options: PrimeExchangeOptions<TRow>,\n): Promise<PrimeExchangeOutcome<TRow>> {\n const { contract } = options\n const turns: PrimeTurnRecord[] = []\n const repair: PrimeRepairState = { attempted: false, succeeded: null }\n\n const first = await callPrimeTurn(options, options.prompt)\n if (!first.ok) {\n return { ok: false, failure: first.failure, usage: mergeTurns(turns), turns, repair }\n }\n turns.push({ turn: 'first', usage: first.usage, rawUsage: first.rawUsage })\n\n let reply = first.content\n let parsed = extractPrimeJsonObject(reply)\n let defect = primeReplyDefect(parsed, contract.rowsField)\n\n if (defect !== null && options.repair) {\n repair.attempted = true\n const second = await callPrimeTurn(\n options,\n buildPrimeRepairPrompt({\n defect,\n previousReply: reply,\n repairContractLines: contract.repairContractLines,\n }),\n )\n if (!second.ok) {\n return { ok: false, failure: second.failure, usage: mergeTurns(turns), turns, repair, reply }\n }\n turns.push({ turn: 'repair', usage: second.usage, rawUsage: second.rawUsage })\n reply = second.content\n parsed = extractPrimeJsonObject(reply)\n defect = primeReplyDefect(parsed, contract.rowsField)\n repair.succeeded = defect === null\n }\n\n const usage = mergeTurns(turns)\n if (defect !== null) {\n return {\n ok: false,\n failure: {\n kind: 'malformed-reply',\n message: `${defect} in prime reply${repair.attempted ? ' even after the bounded repair turn' : ''}`,\n },\n usage,\n turns,\n repair,\n reply,\n }\n }\n\n const rawRows = parsed![contract.rowsField] as unknown[]\n const { rows, rejected, overflow } = decodeContractRows(contract, rawRows)\n const answer = parsed!.answer\n return {\n ok: true,\n answer: typeof answer === 'string' ? answer : null,\n rows,\n rejected,\n reportedRows: rawRows.length,\n overflow,\n usage,\n turns,\n repair,\n reply,\n }\n}\n\ntype PrimeTurnOutcome =\n | { ok: true; content: string; usage: PrimeRawUsage; rawUsage: unknown }\n | { ok: false; failure: PrimeFailure }\n\nasync function callPrimeTurn<TRow>(\n options: PrimeExchangeOptions<TRow>,\n content: string,\n): Promise<PrimeTurnOutcome> {\n const { transport, url, model, timeoutMs, signal } = options\n const controller = new AbortController()\n const forwardAbort = () => controller.abort(signal?.reason)\n if (signal?.aborted) controller.abort(signal.reason)\n else signal?.addEventListener('abort', forwardAbort, { once: true })\n const deadline = setTimeout(() => controller.abort(), timeoutMs)\n let result: PrimeBridgeTransportResult\n try {\n result = await transport({\n url,\n body: { model, messages: [{ role: 'user', content }] },\n signal: controller.signal,\n })\n } catch (error) {\n if (signal?.aborted) {\n return {\n ok: false,\n failure: {\n kind: 'aborted',\n message: 'prime exchange cancelled by the caller',\n cause: error,\n },\n }\n }\n if (controller.signal.aborted) {\n return {\n ok: false,\n failure: { kind: 'deadline', message: `bridge call exceeded ${timeoutMs}ms` },\n }\n }\n return {\n ok: false,\n failure: {\n kind: 'transport',\n message: `bridge transport failure: ${error instanceof Error ? error.message : String(error)}`,\n },\n }\n } finally {\n clearTimeout(deadline)\n signal?.removeEventListener('abort', forwardAbort)\n }\n\n if (result.status !== 200) {\n const bodySnippet = result.text.slice(0, 500)\n return {\n ok: false,\n failure: {\n kind: 'http-status',\n message: `bridge HTTP ${result.status}: ${bodySnippet}`,\n status: result.status,\n bodySnippet,\n },\n }\n }\n let response: unknown\n try {\n response = JSON.parse(result.text)\n } catch {\n return {\n ok: false,\n failure: {\n kind: 'unparseable-json',\n message: `bridge returned unparseable JSON (${result.text.length} bytes)`,\n },\n }\n }\n const replyContent = primeReplyContent(response)\n if (replyContent === null) {\n return {\n ok: false,\n failure: { kind: 'no-content', message: 'bridge reply carries no message content' },\n }\n }\n const rawUsage = primeReplyUsage(response)\n return { ok: true, content: replyContent, usage: normalizePrimeUsage(rawUsage), rawUsage }\n}\n\n/**\n * Fold from the FIRST turn, never from an empty receipt: an all-null identity\n * would poison every side it merged with and erase counts the bridge reported.\n */\nfunction mergeTurns(turns: readonly PrimeTurnRecord[]): PrimeRawUsage {\n if (turns.length === 0) return emptyPrimeRawUsage()\n return turns\n .slice(1)\n .reduce<PrimeRawUsage>((total, turn) => mergePrimeRawUsage(total, turn.usage), turns[0]!.usage)\n}\n\nfunction primeReplyContent(response: unknown): string | null {\n if (typeof response !== 'object' || response === null) return null\n const choices = (response as { choices?: unknown }).choices\n if (!Array.isArray(choices) || choices.length === 0) return null\n const message = (choices[0] as { message?: unknown })?.message\n if (typeof message !== 'object' || message === null) return null\n const content = (message as { content?: unknown }).content\n return typeof content === 'string' && content.length > 0 ? content : null\n}\n\nfunction primeReplyUsage(response: unknown): unknown {\n if (typeof response !== 'object' || response === null) return null\n return (response as { usage?: unknown }).usage ?? null\n}\n\n// ── Trajectory projection ────────────────────────────────────────────\n\n/**\n * Where the inlined trajectory comes from. The protocol needs only two moves —\n * fetch it all, or fetch a reduced version — so no store, artifact path, or\n * span type enters the shared signature.\n */\nexport interface PrimeProjectionSource<TItem> {\n /** The full projection, or null when the source declares itself oversized. */\n full(): Promise<readonly TItem[] | null>\n /** A reduced projection of the same material. */\n capped(): Promise<readonly TItem[]>\n /** How `capped` reduces, named for the failure message, e.g. `per-attribute cap 1200`. */\n cappedDescription: string\n}\n\nexport interface PrimeProjectionDelivery {\n mode: 'inline-json'\n fetch: 'full' | 'capped'\n renderedChars: number\n}\n\nexport type PrimeProjectionOutcome<TItem> =\n | {\n ok: true\n items: readonly TItem[]\n rendered: string\n delivery: PrimeProjectionDelivery\n }\n | { ok: false; reason: string; renderedChars: number }\n\n/**\n * Render, measure, fall back to the capped projection, re-measure, fail loud.\n *\n * Inline is the only delivery prime has, so an oversized trajectory is a\n * refusal rather than a silent truncation: dropping spans would understate the\n * trajectory and the analyst would answer a question about a different run.\n */\nexport async function projectPrimeTrajectory<TItem>(\n source: PrimeProjectionSource<TItem>,\n limits: { maxInlineChars: number },\n): Promise<PrimeProjectionOutcome<TItem>> {\n let fetch: PrimeProjectionDelivery['fetch'] = 'full'\n let items = await source.full()\n if (items === null) {\n fetch = 'capped'\n items = await source.capped()\n }\n let rendered = JSON.stringify(items)\n if (rendered.length > limits.maxInlineChars && fetch === 'full') {\n fetch = 'capped'\n items = await source.capped()\n rendered = JSON.stringify(items)\n }\n if (rendered.length > limits.maxInlineChars) {\n return {\n ok: false,\n reason: `trajectory renders to ${rendered.length} chars even at ${source.cappedDescription}; inline delivery impossible`,\n renderedChars: rendered.length,\n }\n }\n return {\n ok: true,\n items,\n rendered,\n delivery: { mode: 'inline-json', fetch, renderedChars: rendered.length },\n }\n}\n\n// ── Protocol identity ────────────────────────────────────────────────\n\nexport interface PrimeProtocolIdentity {\n question: string\n taskDefinition?: string\n contractLines: readonly string[]\n repairContractLines: readonly string[]\n /** Numeric limits the contract states, e.g. row and width caps. */\n limits: Readonly<Record<string, number>>\n}\n\n/**\n * Digest of everything a consumer can send to the bridge under the prime\n * protocol, recorded per observation so a prime result names the exact contract\n * that produced it.\n *\n * Computed over the ACTUALLY composed contract, so two consumers that both\n * stamp `analyst_id: 'prime'` while asking materially different questions get\n * different digests by construction. That is what makes 'prime' a reproducible\n * claim rather than a label.\n */\nexport function primeProtocolSha256(identity: PrimeProtocolIdentity): string {\n return createHash('sha256')\n .update(\n JSON.stringify({\n kind: 'prime-analyst-protocol',\n question: identity.question,\n taskPrompt: identity.taskDefinition ?? null,\n outputContract: identity.contractLines,\n repairContract: buildPrimeRepairPrompt({\n defect: '<defect>',\n previousReply: '<previous-reply>',\n repairContractLines: identity.repairContractLines,\n }),\n limits: identity.limits,\n }),\n )\n .digest('hex')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsFA,SAAgB,mBACd,UACA,SACmE;CACnE,MAAM,OAAe,CAAC;CACtB,MAAM,WAAgC,CAAC;CACvC,IAAI,WAAW;CACf,QAAQ,SAAS,KAAK,UAAU;EAC9B,MAAM,UAAU,SAAS,UAAU,KAAK,KAAK;EAC7C,IAAI,CAAC,QAAQ,IAAI;GACf,SAAS,KAAK;IAAE;IAAO,QAAQ,QAAQ;GAAO,CAAC;GAC/C;EACF;EACA,IAAI,SAAS,YAAY,KAAA,KAAa,KAAK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AK;CACnC,IAAI,SAAS,SAAS,OAAO,kBAAkB,UAAU,QAAQ;EAC/D,QAAQ;EACR,QAAQ,MAAM,OAAO,OAAO;EAC5B,WAAW,KAAK,UAAU,KAAK;CACjC;CACA,IAAI,SAAS,SAAS,OAAO,gBAC3B,OAAO;EACL,IAAI;EACJ,QAAQ,yBAAyB,SAAS,OAAO,iBAAiB,OAAO,kBAAkB;EAC3F,eAAe,SAAS;CAC1B;CAEF,OAAO;EACL,IAAI;EACJ;EACA;EACA,UAAU;GAAE,MAAM;GAAe;GAAO,eAAe,SAAS;EAAO;CACzE;AACF;;;;;;;;;;;AAuBA,SAAgB,oBAAoB,UAAyC;CAC3E,OAAO,WAAW,QAAQ,CAAC,CACxB,OACC,KAAK,UAAU;EACb,MAAM;EACN,UAAU,SAAS;EACnB,YAAY,SAAS,kBAAkB;EACvC,gBAAgB,SAAS;EACzB,gBAAgB,uBAAuB;GACrC,QAAQ;GACR,eAAe;GACf,qBAAqB,SAAS;EAChC,CAAC;EACD,QAAQ,SAAS;CACnB,CAAC,CACH,CAAC,CACA,OAAO,KAAK;AACjB"}
@@ -1,5 +1,5 @@
1
1
  import { p as CustomTokenPricing } from "./cost-ledger-Jk62OBfF.js";
2
- import { m as AnalystUsageReceipt } from "./types-C1tnkEgM.js";
2
+ import { p as AnalystUsageReceipt } from "./types-CW8ewATZ.js";
3
3
  import { t as PrimeBridgeTransport } from "./prime-bridge-transport-6feEglLf.js";
4
4
  //#region src/analyst/reply-contract.d.ts
5
5
  /**
@@ -80,11 +80,6 @@ interface DecodedReply<TRow> {
80
80
  /** Valid rows dropped by `maxRows`. */
81
81
  overflow: number;
82
82
  }
83
- /**
84
- * Decode a parsed reply value under a contract: strict envelope when declared,
85
- * then per-row decoding, then the all-rejected policy.
86
- */
87
- declare function decodeReplyRows<TRow>(contract: ReplyContract<TRow>, value: unknown): DecodedReply<TRow>;
88
83
  //#endregion
89
84
  //#region src/analyst/prime-protocol.d.ts
90
85
  /**
@@ -133,18 +128,6 @@ interface PrimeRepairPromptSpec {
133
128
  }
134
129
  /** Carries the malformed reply and the contract — never the trajectory. */
135
130
  declare function buildPrimeRepairPrompt(spec: PrimeRepairPromptSpec): string;
136
- /**
137
- * Recover the reply's JSON object.
138
- *
139
- * Distinct from `extractJsonPayload` in ../llm-client, which serves a response
140
- * that DECLARES a JSON root and therefore must not scan onward. A prime reply
141
- * is prose plus a fenced block, and when the model emits several fences the
142
- * last one is its answer — so fences are scanned in reverse, and only then is a
143
- * brace-to-brace slice tried.
144
- */
145
- declare function extractPrimeJsonObject(text: string): Record<string, unknown> | null;
146
- /** Why the reply cannot be read as a prime answer, or null when it can. */
147
- declare function primeReplyDefect(parsed: Record<string, unknown> | null, rowsField: string): string | null;
148
131
  /**
149
132
  * Token accounting exactly as the bridge reported it. Lossless on purpose: a
150
133
  * side the bridge did not report stays null rather than becoming a zero, and a
@@ -169,7 +152,6 @@ interface PrimeRawUsage {
169
152
  */
170
153
  bridgeEstimated: boolean;
171
154
  }
172
- declare function emptyPrimeRawUsage(): PrimeRawUsage;
173
155
  /** Read the bridge's OpenAI-shaped `usage` object. */
174
156
  declare function normalizePrimeUsage(raw: unknown): PrimeRawUsage;
175
157
  /**
@@ -327,5 +309,5 @@ interface PrimeProtocolIdentity {
327
309
  */
328
310
  declare function primeProtocolSha256(identity: PrimeProtocolIdentity): string;
329
311
  //#endregion
330
- export { ReplyRowDecoded as A, primeProtocolSha256 as C, DecodedReply as D, runPrimeExchange as E, decodeReplyRows as M, ReplyContract as O, normalizePrimeUsage as S, projectPrimeTrajectory as T, buildPrimePrompt as _, PrimeProjectionOutcome as a, extractPrimeJsonObject as b, PrimeProtocolIdentity as c, PrimeRepairPromptSpec as d, PrimeRepairState as f, analystUsageReceiptFromPrimeUsage as g, PrimeTurnRecord as h, PrimeProjectionDelivery as i, ReplyRowRejection as j, ReplyEnvelope as k, PrimeRawUsage as l, PrimeRowDecoded as m, PrimeExchangeOutcome as n, PrimeProjectionSource as o, PrimeReplyContract as p, PrimeFailure as r, PrimePromptSpec as s, PrimeExchangeOptions as t, PrimeRejectedRow as u, buildPrimeRepairPrompt as v, primeReplyDefect as w, mergePrimeRawUsage as x, emptyPrimeRawUsage as y };
331
- //# sourceMappingURL=prime-protocol-HiB9HX7E.d.ts.map
312
+ export { runPrimeExchange as C, ReplyRowDecoded as D, ReplyEnvelope as E, ReplyRowRejection as O, projectPrimeTrajectory as S, ReplyContract as T, buildPrimePrompt as _, PrimeProjectionOutcome as a, normalizePrimeUsage as b, PrimeProtocolIdentity as c, PrimeRepairPromptSpec as d, PrimeRepairState as f, analystUsageReceiptFromPrimeUsage as g, PrimeTurnRecord as h, PrimeProjectionDelivery as i, PrimeRawUsage as l, PrimeRowDecoded as m, PrimeExchangeOutcome as n, PrimeProjectionSource as o, PrimeReplyContract as p, PrimeFailure as r, PrimePromptSpec as s, PrimeExchangeOptions as t, PrimeRejectedRow as u, buildPrimeRepairPrompt as v, DecodedReply as w, primeProtocolSha256 as x, mergePrimeRawUsage as y };
313
+ //# sourceMappingURL=prime-protocol-BWG2DQIk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prime-protocol-BWG2DQIk.d.ts","names":[],"sources":["../src/analyst/reply-contract.ts","../src/analyst/prime-protocol.ts"],"mappings":";;;;;;;;;;;;;;KAaY,gBAAgB;EAAU;EAAU,KAAK;;EAAW;EAAW;;;UAG1D;EACf;;EAEA,QAAQ;;UAGO,cAAc;;EAE7B;;EAEA;;;;;EAKA;;;;;;EAMA,UAAU,cAAc,gBAAgB,gBAAgB;;;;;;EAMxD;;;;;;EAMA,eAAe,iBAAiB;;;;;;EAMhC;;;;;EAKA;;;UAIe;EACf;EACA;;UAGe,aAAa;EAC5B,MAAM;;EAEN,QAAQ;EACR,UAAU;;EAEV;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KC3CU,gBAAgB,QAAQ,gBAAgB;KAExC,mBAAmB,QAAQ,cAAc;UAIpC;EACf;;EAEA;EACA;;EAEA;EACA;;EAEA;;iBAGc,iBAAiB,MAAM;UAatB;EACf;EACA;EACA;;;iBAIc,uBAAuB,MAAM;;;;;;UAoE5B;;;;;;EAMf;;EAEA;;EAEA;;;;;;;EAOA;;;iBAQc,oBAAoB,eAAe;;;;;;iBAgBnC,mBAAmB,GAAG,eAAe,GAAG,gBAAgB;;;;;;;;;;;;;iBA6BxD,kCACd,OAAO,eACP,SAAS,qBACR;;;;;;;;KAqCS;EAEN;EACA;;EAEA;EAAqB;EAAiB;EAAgB;;EACtD;EAAiB;EAAiB;;UAEvB;EACf;;EAEA;;;UAIe;EACf;EACA,OAAO;;EAEP;;UAGe;EACf;EACA;;KAGU,qBAAqB;EAE3B;;EAEA;EACA,MAAM;EACN,UAAU;;EAEV;;EAEA;EACA,OAAO;EACP,OAAO;EACP,QAAQ;EACR;;EAGA;EACA,SAAS;EACT,OAAO;EACP,OAAO;EACP,QAAQ;;EAER;;UAGW,qBAAqB;EACpC,UAAU,mBAAmB;EAC7B;EACA,WAAW;;EAEX;EACA;;EAEA;;EAEA;EACA,SAAS;;;;;;;iBAQW,iBAAiB,MACrC,SAAS,qBAAqB,QAC7B,QAAQ,qBAAqB;;;;;;UAyLf,sBAAsB;;EAErC,QAAQ,iBAAiB;;EAEzB,UAAU,iBAAiB;;EAE3B;;UAGe;EACf;EACA;EACA;;KAGU,uBAAuB;EAE7B;EACA,gBAAgB;EAChB;EACA,UAAU;;EAEV;EAAW;EAAgB;;;;;;;;;iBASX,uBAAuB,OAC3C,QAAQ,sBAAsB,QAC9B;EAAU;IACT,QAAQ,uBAAuB;UA8BjB;EACf;EACA;EACA;EACA;;EAEA,QAAQ,SAAS;;;;;;;;;;;;iBAaH,oBAAoB,UAAU"}
@@ -1,2 +1,2 @@
1
- import { S as verifyAgentProfileCell, _ as buildAgentProfileCell, a as AgentProfileCellSchemaVersion, b as toAgentProfileJson, c as AgentProfileHarness, d as AgentProfileKind, f as AgentProfileSource, g as buildAgentInterfaceProfileCell, h as assertRunAgentProfileCell, i as AgentProfileCellInput, l as AgentProfileJson, m as agentProfileCellKey, n as AgentInterfaceProfileLike, o as AgentProfileCellValidationError, p as AgentProfileSourceInput, r as AgentProfileCell, s as AgentProfileDimensionValue, t as AGENT_PROFILE_KINDS, u as AgentProfileJsonObject, v as groupRunsByAgentProfileCell, x as validateAgentProfileCell, y as requireAgentProfileCell } from "./agent-profile-cell-BNp-Js9F.js";
2
- export { AGENT_PROFILE_KINDS, AgentInterfaceProfileLike, AgentProfileCell, AgentProfileCellInput, AgentProfileCellSchemaVersion, AgentProfileCellValidationError, AgentProfileDimensionValue, AgentProfileHarness, AgentProfileJson, AgentProfileJsonObject, AgentProfileKind, AgentProfileSource, AgentProfileSourceInput, agentProfileCellKey, assertRunAgentProfileCell, buildAgentInterfaceProfileCell, buildAgentProfileCell, groupRunsByAgentProfileCell, requireAgentProfileCell, toAgentProfileJson, validateAgentProfileCell, verifyAgentProfileCell };
1
+ import { _ as toAgentProfileJson, a as AgentProfileCellSchemaVersion, c as AgentProfileHarness, d as AgentProfileKind, f as AgentProfileSource, g as groupRunsByAgentProfileCell, h as buildAgentProfileCell, i as AgentProfileCellInput, l as AgentProfileJson, m as agentProfileCellKey, n as AgentInterfaceProfileLike, o as AgentProfileCellValidationError, p as AgentProfileSourceInput, r as AgentProfileCell, s as AgentProfileDimensionValue, t as AGENT_PROFILE_KINDS, u as AgentProfileJsonObject, v as validateAgentProfileCell, y as verifyAgentProfileCell } from "./agent-profile-cell-BcpFbNd5.js";
2
+ export { AGENT_PROFILE_KINDS, AgentInterfaceProfileLike, AgentProfileCell, AgentProfileCellInput, AgentProfileCellSchemaVersion, AgentProfileCellValidationError, AgentProfileDimensionValue, AgentProfileHarness, AgentProfileJson, AgentProfileJsonObject, AgentProfileKind, AgentProfileSource, AgentProfileSourceInput, agentProfileCellKey, buildAgentProfileCell, groupRunsByAgentProfileCell, toAgentProfileJson, validateAgentProfileCell, verifyAgentProfileCell };
@@ -1,2 +1,2 @@
1
- import { a as buildAgentInterfaceProfileCell, c as requireAgentProfileCell, d as verifyAgentProfileCell, i as assertRunAgentProfileCell, l as toAgentProfileJson, n as AgentProfileCellValidationError, o as buildAgentProfileCell, r as agentProfileCellKey, s as groupRunsByAgentProfileCell, t as AGENT_PROFILE_KINDS, u as validateAgentProfileCell } from "./agent-profile-cell-BK8mlqlq.js";
2
- export { AGENT_PROFILE_KINDS, AgentProfileCellValidationError, agentProfileCellKey, assertRunAgentProfileCell, buildAgentInterfaceProfileCell, buildAgentProfileCell, groupRunsByAgentProfileCell, requireAgentProfileCell, toAgentProfileJson, validateAgentProfileCell, verifyAgentProfileCell };
1
+ import { a as groupRunsByAgentProfileCell, c as verifyAgentProfileCell, i as buildAgentProfileCell, n as AgentProfileCellValidationError, o as toAgentProfileJson, r as agentProfileCellKey, s as validateAgentProfileCell, t as AGENT_PROFILE_KINDS } from "./agent-profile-cell-B1V1gUZs.js";
2
+ export { AGENT_PROFILE_KINDS, AgentProfileCellValidationError, agentProfileCellKey, buildAgentProfileCell, groupRunsByAgentProfileCell, toAgentProfileJson, validateAgentProfileCell, verifyAgentProfileCell };
@@ -1,7 +1,7 @@
1
- import { o as FailureClass } from "./schema-2g7trUwH.js";
2
- import { a as RunRecord, c as RunSplitTag } from "./run-record-C1E24G2A.js";
1
+ import { o as FailureClass } from "./schema-D6EVKzTB.js";
2
+ import { a as RunRecord, c as RunSplitTag } from "./run-record-CaxbLq6Y.js";
3
3
  import { i as DatasetSplit, n as DatasetManifest, r as DatasetScenario } from "./dataset-DQqhOCPt.js";
4
- import { b as GateDecision } from "./summary-report-bdFDXq0b.js";
4
+ import { S as HeldOutGateDecision } from "./summary-report-DM7tlml1.js";
5
5
  //#region src/statistics/rank-tests.d.ts
6
6
  /** How a rank test's p-value was actually computed. */
7
7
  type RankTestMethod = 'exact' | 'permutation' | 'asymptotic';
@@ -135,7 +135,7 @@ interface ReleaseConfidenceInput {
135
135
  scenarios?: readonly DatasetScenario[];
136
136
  runs?: readonly RunRecord[];
137
137
  traces?: readonly ReleaseTraceEvidence[];
138
- gateDecision?: GateDecision | null;
138
+ gateDecision?: HeldOutGateDecision | null;
139
139
  thresholds?: ReleaseConfidenceThresholds;
140
140
  }
141
141
  interface ReleaseConfidenceAxis {
@@ -197,11 +197,10 @@ interface ReleaseConfidenceScorecard {
197
197
  issues: ReleaseConfidenceIssue[];
198
198
  metrics: ReleaseConfidenceMetrics;
199
199
  dataset: DatasetManifest | null;
200
- gateDecision: GateDecision | null;
200
+ gateDecision: HeldOutGateDecision | null;
201
201
  summary: string;
202
202
  }
203
203
  declare function evaluateReleaseConfidence(input: ReleaseConfidenceInput): ReleaseConfidenceScorecard;
204
- declare function assertReleaseConfidence(input: ReleaseConfidenceInput): ReleaseConfidenceScorecard;
205
204
  //#endregion
206
205
  //#region src/promotion-gate.d.ts
207
206
  /**
@@ -301,5 +300,5 @@ declare function judgeReplayGate<TOutput>(args: JudgeReplayGateArgs<TOutput>): P
301
300
  candidateSamples: number;
302
301
  }>;
303
302
  //#endregion
304
- export { WilcoxonSignedRankResult as C, RankTestOptions as S, wilcoxonSignedRank as T, assertReleaseConfidence as _, bootstrapCi as a, RankTestMethod as b, ReleaseConfidenceAxis as c, ReleaseConfidenceIssue as d, ReleaseConfidenceMetrics as f, ReleaseTraceEvidence as g, ReleaseConfidenceThresholds as h, Verdict as i, ReleaseConfidenceAxisName as l, ReleaseConfidenceStatus as m, BootstrapResult as n, judgeReplayGate as o, ReleaseConfidenceScorecard as p, JudgeReplayGateArgs as r, ActionableSideInfo as s, BootstrapOptions as t, ReleaseConfidenceInput as u, evaluateReleaseConfidence as v, mannWhitneyU as w, RankTestMethodRequest as x, MannWhitneyResult as y };
305
- //# sourceMappingURL=promotion-gate-BawrdPYr.d.ts.map
303
+ export { mannWhitneyU as C, WilcoxonSignedRankResult as S, evaluateReleaseConfidence as _, bootstrapCi as a, RankTestMethodRequest as b, ReleaseConfidenceAxis as c, ReleaseConfidenceIssue as d, ReleaseConfidenceMetrics as f, ReleaseTraceEvidence as g, ReleaseConfidenceThresholds as h, Verdict as i, ReleaseConfidenceAxisName as l, ReleaseConfidenceStatus as m, BootstrapResult as n, judgeReplayGate as o, ReleaseConfidenceScorecard as p, JudgeReplayGateArgs as r, ActionableSideInfo as s, BootstrapOptions as t, ReleaseConfidenceInput as u, MannWhitneyResult as v, wilcoxonSignedRank as w, RankTestOptions as x, RankTestMethod as y };
304
+ //# sourceMappingURL=promotion-gate-DaY95yU6.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"promotion-gate-BawrdPYr.d.ts","names":[],"sources":["../src/statistics/rank-tests.ts","../src/release-confidence.ts","../src/promotion-gate.ts"],"mappings":";;;;;;KAiCY;;;;;KAMA;UAEK;;EAEf,SAAS;;EAET;;;EAGA;;UAYe;;EAEf;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;;;;;;;;;;;;;iBAec,aACd,aACA,aACA,OAAM,kBACL;UAuFc;;;EAGf;;EAEA;;EAEA,QAAQ;;EAER;;EAEA;;;;;;;;;;;;;;;iBAgBc,mBACd,kBACA,iBACA,OAAM,kBACL;;;;KCzLS;;UAGK;;EAEf;;EAEA;EACA,WAAW;;EAEX;;EAEA;;EAEA;;EAEA;EACA,WAAW;;KAGD;KACA;UAQK;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;;EAEA,eAAe;EACf,MAAM;EACN,WAAW;;UAGI;;EAEf;EACA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA,UAAU;EACV,qBAAqB;EACrB,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,aAAa;;UAGE;EACf,MAAM;EACN,QAAQ;EACR;EACA;;UAGe;EACf,MAAM;EACN;EACA;EACA;;UAGe;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa,OAAO;EACpB,cAAc;EACd,oBAAoB,QAAQ,OAAO;EACnC,0BAA0B;;;;;;;EAO1B;;UAGe;EACf;EACA;EACA;EACA,QAAQ;EACR;EACA,MAAM;EACN,QAAQ;EACR,SAAS;EACT,SAAS;EACT,cAAc;EACd;;iBAkBc,0BACd,OAAO,yBACN;iBA4Ha,wBAAwB,OAAO,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;KCtR5D;UAEK;EACf;EACA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA,SAAS;;UAGM;;EAEf;;EAEA;;;;;;EAMA;;;EAGA;;;;;;;;;iBAUc,YACd,oBACA,qBACA,UAAS,mBACR;;;;;;;;;;;;;;;;UA0Gc,oBAAoB;EACnC,iBAAiB;EACjB,kBAAkB;;EAElB,QAAQ,QAAQ,YAAY;EAC5B;EACA;;EAEA;;EAEA;;;;;iBAMoB,gBAAgB,SACpC,MAAM,oBAAoB,WACzB,QAAQ;EAAoB;EAAyB"}
1
+ {"version":3,"file":"promotion-gate-DaY95yU6.d.ts","names":[],"sources":["../src/statistics/rank-tests.ts","../src/release-confidence.ts","../src/promotion-gate.ts"],"mappings":";;;;;;KAiCY;;;;;KAMA;UAEK;;EAEf,SAAS;;EAET;;;EAGA;;UAYe;;EAEf;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;;;;;;;;;;;;;iBAec,aACd,aACA,aACA,OAAM,kBACL;UAuFc;;;EAGf;;EAEA;;EAEA,QAAQ;;EAER;;EAEA;;;;;;;;;;;;;;;iBAgBc,mBACd,kBACA,iBACA,OAAM,kBACL;;;;KCzLE;;UAGY;;EAEf;;EAEA;EACA,WAAW;;EAEX;;EAEA;;EAEA;;EAEA;EACA,WAAW;;KAGD;KACA;UAQK;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;;EAEA,eAAe;EACf,MAAM;EACN,WAAW;;UAGI;;EAEf;EACA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA;;UAGe;EACf;EACA;EACA;EACA,UAAU;EACV,qBAAqB;EACrB,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,aAAa;;UAGE;EACf,MAAM;EACN,QAAQ;EACR;EACA;;UAGe;EACf,MAAM;EACN;EACA;EACA;;UAGe;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa,OAAO;EACpB,cAAc;EACd,oBAAoB,QAAQ,OAAO;EACnC,0BAA0B;;;;;;;EAO1B;;UAGe;EACf;EACA;EACA;EACA,QAAQ;EACR;EACA,MAAM;EACN,QAAQ;EACR,SAAS;EACT,SAAS;EACT,cAAc;EACd;;iBAkBc,0BACd,OAAO,yBACN;;;;;;;;;;;;;;;;;;;;;;;;;;;KC1JS;UAEK;EACf;EACA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA,SAAS;;UAGM;;EAEf;;EAEA;;;;;;EAMA;;;EAGA;;;;;;;;;iBAUc,YACd,oBACA,qBACA,UAAS,mBACR;;;;;;;;;;;;;;;;UA0Gc,oBAAoB;EACnC,iBAAiB;EACjB,kBAAkB;;EAElB,QAAQ,QAAQ,YAAY;EAC5B;EACA;;EAEA;;EAEA;;;;;iBAMoB,gBAAgB,SACpC,MAAM,oBAAoB,WACzB,QAAQ;EAAoB;EAAyB"}
@@ -1,6 +1,6 @@
1
- import { i as pairedBootstrap } from "./mean-DHoMiudD.js";
2
- import { t as decidePairedPromotion } from "./paired-promotion-decision-DsAPYGCm.js";
3
- import { o as pairHoldout, r as detectScale } from "./statistical-heldout-42NlCNDe.js";
1
+ import { i as pairedBootstrap } from "./mean-BbA_JCzW.js";
2
+ import { t as decidePairedPromotion } from "./paired-promotion-decision-D0SHb-ZL.js";
3
+ import { o as pairHoldout, r as detectScale } from "./statistical-heldout-Bksv92Th.js";
4
4
  //#region src/campaign/gates/promotion-policy.ts
5
5
  /**
6
6
  * Build paired evidence for each objective and apply a promotion policy.
@@ -171,4 +171,4 @@ function paretoSignificanceGate(options) {
171
171
  //#endregion
172
172
  export { paretoPolicy as n, paretoSignificanceGate as r, buildEvidenceVector as t };
173
173
 
174
- //# sourceMappingURL=promotion-policy-KO57gbyV.js.map
174
+ //# sourceMappingURL=promotion-policy-6A8osGr_.js.map