@tangle-network/agent-eval 0.129.0 → 0.130.0

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 (427) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/dist/active-curriculum-C4mk67HP.js +214 -0
  4. package/dist/active-curriculum-C4mk67HP.js.map +1 -0
  5. package/dist/adversarial-smnADNFS.d.ts +21 -0
  6. package/dist/adversarial-smnADNFS.d.ts.map +1 -0
  7. package/dist/analyst/index.d.ts +81 -2872
  8. package/dist/analyst/index.d.ts.map +1 -0
  9. package/dist/analyst/index.js +319 -360
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/analyst-BkTS3C58.d.ts +89 -0
  12. package/dist/analyst-BkTS3C58.d.ts.map +1 -0
  13. package/dist/analyst-LsnNpSkm.js +152 -0
  14. package/dist/analyst-LsnNpSkm.js.map +1 -0
  15. package/dist/analyze-runs-C1CavBMk.js +1067 -0
  16. package/dist/analyze-runs-C1CavBMk.js.map +1 -0
  17. package/dist/analyze-runs-FsgYCinh.d.ts +72 -0
  18. package/dist/analyze-runs-FsgYCinh.d.ts.map +1 -0
  19. package/dist/attribute-vocabulary-DLJ6303h.d.ts +54 -0
  20. package/dist/attribute-vocabulary-DLJ6303h.d.ts.map +1 -0
  21. package/dist/authenticity/index.d.ts +81 -79
  22. package/dist/authenticity/index.d.ts.map +1 -0
  23. package/dist/authenticity/index.js +209 -193
  24. package/dist/authenticity/index.js.map +1 -1
  25. package/dist/baseline-HsBvw_dk.js +550 -0
  26. package/dist/baseline-HsBvw_dk.js.map +1 -0
  27. package/dist/baseline-hG3K85h4.d.ts +125 -0
  28. package/dist/baseline-hG3K85h4.d.ts.map +1 -0
  29. package/dist/belief-state/index.d.ts +448 -1188
  30. package/dist/belief-state/index.d.ts.map +1 -0
  31. package/dist/belief-state/index.js +1617 -1709
  32. package/dist/belief-state/index.js.map +1 -1
  33. package/dist/benchmarks/index.d.ts +2 -891
  34. package/dist/benchmarks/index.js +2 -60
  35. package/dist/benchmarks-DviOvUNr.js +754 -0
  36. package/dist/benchmarks-DviOvUNr.js.map +1 -0
  37. package/dist/builder-eval/index.d.ts +150 -662
  38. package/dist/builder-eval/index.d.ts.map +1 -0
  39. package/dist/builder-eval/index.js +356 -345
  40. package/dist/builder-eval/index.js.map +1 -1
  41. package/dist/calibration-CNWWA6K8.js +94 -0
  42. package/dist/calibration-CNWWA6K8.js.map +1 -0
  43. package/dist/campaign/index.d.ts +5 -6381
  44. package/dist/campaign/index.js +3 -213
  45. package/dist/campaign-CBKZvQ1H.js +3885 -0
  46. package/dist/campaign-CBKZvQ1H.js.map +1 -0
  47. package/dist/cli.d.ts +1 -1
  48. package/dist/cli.js +164 -175
  49. package/dist/cli.js.map +1 -1
  50. package/dist/client-C97NMzqi.d.ts +581 -0
  51. package/dist/client-C97NMzqi.d.ts.map +1 -0
  52. package/dist/client-CYzbdJOZ.js +637 -0
  53. package/dist/client-CYzbdJOZ.js.map +1 -0
  54. package/dist/code-agent-session-BjkMTQ7H.js +1390 -0
  55. package/dist/code-agent-session-BjkMTQ7H.js.map +1 -0
  56. package/dist/code-agent-session-DqqgOJaz.d.ts +143 -0
  57. package/dist/code-agent-session-DqqgOJaz.d.ts.map +1 -0
  58. package/dist/concurrency-DIxRZF_J.js +85 -0
  59. package/dist/concurrency-DIxRZF_J.js.map +1 -0
  60. package/dist/contract/index.d.ts +645 -5565
  61. package/dist/contract/index.d.ts.map +1 -0
  62. package/dist/contract/index.js +1730 -1938
  63. package/dist/contract/index.js.map +1 -1
  64. package/dist/control.d.ts +3 -1030
  65. package/dist/control.js +2 -33
  66. package/dist/cost-ledger-DIgQUFZZ.js +801 -0
  67. package/dist/cost-ledger-DIgQUFZZ.js.map +1 -0
  68. package/dist/cost-ledger-Dye6jCgg.d.ts +236 -0
  69. package/dist/cost-ledger-Dye6jCgg.d.ts.map +1 -0
  70. package/dist/dataset-BvtnC8Dc.d.ts +115 -0
  71. package/dist/dataset-BvtnC8Dc.d.ts.map +1 -0
  72. package/dist/default-registry-C-vFCSEc.js +2579 -0
  73. package/dist/default-registry-C-vFCSEc.js.map +1 -0
  74. package/dist/default-registry-CNPo-Vsb.d.ts +540 -0
  75. package/dist/default-registry-CNPo-Vsb.d.ts.map +1 -0
  76. package/dist/emitter-CPBAhxum.js +266 -0
  77. package/dist/emitter-CPBAhxum.js.map +1 -0
  78. package/dist/emitter-DGQGoLyj.d.ts +113 -0
  79. package/dist/emitter-DGQGoLyj.d.ts.map +1 -0
  80. package/dist/errors-8YnH8WlF.js +64 -0
  81. package/dist/errors-8YnH8WlF.js.map +1 -0
  82. package/dist/errors-CEk209JS.d.ts +76 -0
  83. package/dist/errors-CEk209JS.d.ts.map +1 -0
  84. package/dist/eval-campaign-DEm6c8ru.js +349 -0
  85. package/dist/eval-campaign-DEm6c8ru.js.map +1 -0
  86. package/dist/execution-tracks-CpgFPpS5.js +93 -0
  87. package/dist/execution-tracks-CpgFPpS5.js.map +1 -0
  88. package/dist/exporters-q9iL-2Jf.js +148 -0
  89. package/dist/exporters-q9iL-2Jf.js.map +1 -0
  90. package/dist/extract-usage-BrQ8mCLX.js +155 -0
  91. package/dist/extract-usage-BrQ8mCLX.js.map +1 -0
  92. package/dist/failure-cluster-CqcvCcdR.d.ts +59 -0
  93. package/dist/failure-cluster-CqcvCcdR.d.ts.map +1 -0
  94. package/dist/feedback-trajectory-CVaeREXV.d.ts +340 -0
  95. package/dist/feedback-trajectory-CVaeREXV.d.ts.map +1 -0
  96. package/dist/fuzz.d.ts +320 -646
  97. package/dist/fuzz.d.ts.map +1 -0
  98. package/dist/fuzz.js +670 -618
  99. package/dist/fuzz.js.map +1 -1
  100. package/dist/hf-dataset-DBJXXoY1.js +763 -0
  101. package/dist/hf-dataset-DBJXXoY1.js.map +1 -0
  102. package/dist/hosted/index.d.ts +11 -831
  103. package/dist/hosted/index.d.ts.map +1 -0
  104. package/dist/hosted/index.js +2 -37
  105. package/dist/index-2JJSA6-r2.d.ts +926 -0
  106. package/dist/index-2JJSA6-r2.d.ts.map +1 -0
  107. package/dist/index-6N0aYmpW.d.ts +217 -0
  108. package/dist/index-6N0aYmpW.d.ts.map +1 -0
  109. package/dist/index-BAvgST_9.d.ts +131 -0
  110. package/dist/index-BAvgST_9.d.ts.map +1 -0
  111. package/dist/index-BvnJuTGD.d.ts +68 -0
  112. package/dist/index-BvnJuTGD.d.ts.map +1 -0
  113. package/dist/index-C61Wi7yg.d.ts +547 -0
  114. package/dist/index-C61Wi7yg.d.ts.map +1 -0
  115. package/dist/index-CAPUUKaM.d.ts +335 -0
  116. package/dist/index-CAPUUKaM.d.ts.map +1 -0
  117. package/dist/index-DE5fb3EC.d.ts +2244 -0
  118. package/dist/index-DE5fb3EC.d.ts.map +1 -0
  119. package/dist/index-DSC51roc.d.ts +102 -0
  120. package/dist/index-DSC51roc.d.ts.map +1 -0
  121. package/dist/index.d.ts +3755 -15555
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.js +11182 -11216
  124. package/dist/index.js.map +1 -1
  125. package/dist/integrity-BzRbCHzi.js +424 -0
  126. package/dist/integrity-BzRbCHzi.js.map +1 -0
  127. package/dist/integrity-rmVhXWA7.d.ts +61 -0
  128. package/dist/integrity-rmVhXWA7.d.ts.map +1 -0
  129. package/dist/judge-calibration-DFtEMlde.d.ts +146 -0
  130. package/dist/judge-calibration-DFtEMlde.d.ts.map +1 -0
  131. package/dist/ledger-core/index.d.ts +2 -0
  132. package/dist/ledger-core/index.js +2 -0
  133. package/dist/ledger-core-DtZz1RG0.js +388 -0
  134. package/dist/ledger-core-DtZz1RG0.js.map +1 -0
  135. package/dist/llm-client--GR4JbZE.js +687 -0
  136. package/dist/llm-client--GR4JbZE.js.map +1 -0
  137. package/dist/llm-client-B_nIBlYo.d.ts +290 -0
  138. package/dist/llm-client-B_nIBlYo.d.ts.map +1 -0
  139. package/dist/matrix/index.d.ts +3 -155
  140. package/dist/matrix/index.js +2 -8
  141. package/dist/matrix-BzQnu2S6.js +270 -0
  142. package/dist/matrix-BzQnu2S6.js.map +1 -0
  143. package/dist/meta-eval/index.d.ts +4 -1027
  144. package/dist/meta-eval/index.js +393 -390
  145. package/dist/meta-eval/index.js.map +1 -1
  146. package/dist/metrics-C9YY1OcL.js +239 -0
  147. package/dist/metrics-C9YY1OcL.js.map +1 -0
  148. package/dist/mint-yN2M2eh0.js +201 -0
  149. package/dist/mint-yN2M2eh0.js.map +1 -0
  150. package/dist/multi-layer-verifier-BHY1gWAc.d.ts +138 -0
  151. package/dist/multi-layer-verifier-BHY1gWAc.d.ts.map +1 -0
  152. package/dist/multishot/index.d.ts +273 -480
  153. package/dist/multishot/index.d.ts.map +1 -0
  154. package/dist/multishot/index.js +595 -548
  155. package/dist/multishot/index.js.map +1 -1
  156. package/dist/off-policy-DvgzvtIx.js +220 -0
  157. package/dist/off-policy-DvgzvtIx.js.map +1 -0
  158. package/dist/off-policy-mskQw8Mb.d.ts +153 -0
  159. package/dist/off-policy-mskQw8Mb.d.ts.map +1 -0
  160. package/dist/openapi.json +1 -1
  161. package/dist/opencode-sqlite-BGrHeDu3.js +318 -0
  162. package/dist/opencode-sqlite-BGrHeDu3.js.map +1 -0
  163. package/dist/outcome-store-BYHIuO0e.d.ts +65 -0
  164. package/dist/outcome-store-BYHIuO0e.d.ts.map +1 -0
  165. package/dist/outcome-store-ChBKlTd_.js +75 -0
  166. package/dist/outcome-store-ChBKlTd_.js.map +1 -0
  167. package/dist/paired-arms-D9D0wXj2.js +260 -0
  168. package/dist/paired-arms-D9D0wXj2.js.map +1 -0
  169. package/dist/pipelines/index.d.ts +95 -532
  170. package/dist/pipelines/index.d.ts.map +1 -0
  171. package/dist/pipelines/index.js +497 -478
  172. package/dist/pipelines/index.js.map +1 -1
  173. package/dist/pre-registration-DakwTRXk.js +96 -0
  174. package/dist/pre-registration-DakwTRXk.js.map +1 -0
  175. package/dist/propose-review-control-LhIWGzHl.js +1458 -0
  176. package/dist/propose-review-control-LhIWGzHl.js.map +1 -0
  177. package/dist/query-CJ_DX8vl.d.ts +28 -0
  178. package/dist/query-CJ_DX8vl.d.ts.map +1 -0
  179. package/dist/query-Di7eEQ79.js +83 -0
  180. package/dist/query-Di7eEQ79.js.map +1 -0
  181. package/dist/raw-provider-sink-BQd7mzyT.js +201 -0
  182. package/dist/raw-provider-sink-BQd7mzyT.js.map +1 -0
  183. package/dist/raw-provider-sink-BU29Sh8h.d.ts +134 -0
  184. package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +1 -0
  185. package/dist/redact-7Aq1ukl-.js +107 -0
  186. package/dist/redact-7Aq1ukl-.js.map +1 -0
  187. package/dist/release-report-Cz9NKH39.js +603 -0
  188. package/dist/release-report-Cz9NKH39.js.map +1 -0
  189. package/dist/release-report-mvB2G4_J.d.ts +244 -0
  190. package/dist/release-report-mvB2G4_J.d.ts.map +1 -0
  191. package/dist/replay-GnyotH0J.js +1741 -0
  192. package/dist/replay-GnyotH0J.js.map +1 -0
  193. package/dist/replay-OoidtG1E.d.ts +749 -0
  194. package/dist/replay-OoidtG1E.d.ts.map +1 -0
  195. package/dist/reporting.d.ts +6 -1312
  196. package/dist/reporting.js +6 -51
  197. package/dist/researcher-CwTdwXG1.d.ts +314 -0
  198. package/dist/researcher-CwTdwXG1.d.ts.map +1 -0
  199. package/dist/reward-hacking-eAnOsynk.d.ts +224 -0
  200. package/dist/reward-hacking-eAnOsynk.d.ts.map +1 -0
  201. package/dist/reward-hacking-qipEpKvY.js +596 -0
  202. package/dist/reward-hacking-qipEpKvY.js.map +1 -0
  203. package/dist/reward-nw2xZGZG.js +137 -0
  204. package/dist/reward-nw2xZGZG.js.map +1 -0
  205. package/dist/rl.d.ts +760 -4010
  206. package/dist/rl.d.ts.map +1 -0
  207. package/dist/rl.js +2325 -1958
  208. package/dist/rl.js.map +1 -1
  209. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  210. package/dist/rollout/index.d.ts +3 -2087
  211. package/dist/rollout/index.js +8 -168
  212. package/dist/rollout-BOYjemfR.js +624 -0
  213. package/dist/rollout-BOYjemfR.js.map +1 -0
  214. package/dist/rubric-predictive-validity-B3xmbmS1.js +141 -0
  215. package/dist/rubric-predictive-validity-B3xmbmS1.js.map +1 -0
  216. package/dist/rubric-predictive-validity-Ku_clp_1.d.ts +74 -0
  217. package/dist/rubric-predictive-validity-Ku_clp_1.d.ts.map +1 -0
  218. package/dist/run-evidence-ClRX_8A9.d.ts +225 -0
  219. package/dist/run-evidence-ClRX_8A9.d.ts.map +1 -0
  220. package/dist/run-record-BuoE80Dq.js +467 -0
  221. package/dist/{chunk-56TAVBOK.js.map → run-record-BuoE80Dq.js.map} +1 -1
  222. package/dist/run-record-CnZu_gjl.d.ts +357 -0
  223. package/dist/run-record-CnZu_gjl.d.ts.map +1 -0
  224. package/dist/run-score-iEEAWiBY.js +41 -0
  225. package/dist/run-score-iEEAWiBY.js.map +1 -0
  226. package/dist/runtime-trajectory-1gyaTOoC.js +93 -0
  227. package/dist/runtime-trajectory-1gyaTOoC.js.map +1 -0
  228. package/dist/runtime-trajectory-BvSZcCHD.d.ts +50 -0
  229. package/dist/runtime-trajectory-BvSZcCHD.d.ts.map +1 -0
  230. package/dist/schema-BtVldJ3T.d.ts +206 -0
  231. package/dist/schema-BtVldJ3T.d.ts.map +1 -0
  232. package/dist/schema-C6DW4ZHR.js +821 -0
  233. package/dist/schema-C6DW4ZHR.js.map +1 -0
  234. package/dist/schema-CRhEY1SO.js +69 -0
  235. package/dist/schema-CRhEY1SO.js.map +1 -0
  236. package/dist/schema-Cef2cFmb.d.ts +408 -0
  237. package/dist/schema-Cef2cFmb.d.ts.map +1 -0
  238. package/dist/semantic-concept-judge-B6cWNJ2K.js +725 -0
  239. package/dist/semantic-concept-judge-B6cWNJ2K.js.map +1 -0
  240. package/dist/sequential-Br0mAPHA.js +148 -0
  241. package/dist/sequential-Br0mAPHA.js.map +1 -0
  242. package/dist/sequential-CYwq6Ff_.d.ts +141 -0
  243. package/dist/sequential-CYwq6Ff_.d.ts.map +1 -0
  244. package/dist/series-convergence-CjO2QdRW.js +43 -0
  245. package/dist/series-convergence-CjO2QdRW.js.map +1 -0
  246. package/dist/series-convergence-ofsqPWhs.d.ts +35 -0
  247. package/dist/series-convergence-ofsqPWhs.d.ts.map +1 -0
  248. package/dist/server-m5D9cvnG.js +1040 -0
  249. package/dist/server-m5D9cvnG.js.map +1 -0
  250. package/dist/skill-usage-C_pXm7lP.d.ts +534 -0
  251. package/dist/skill-usage-C_pXm7lP.d.ts.map +1 -0
  252. package/dist/skillopt-optimization-method-B7wX7XkF.d.ts +1739 -0
  253. package/dist/skillopt-optimization-method-B7wX7XkF.d.ts.map +1 -0
  254. package/dist/skillopt-optimization-method-D4ODwFVV.js +7712 -0
  255. package/dist/skillopt-optimization-method-D4ODwFVV.js.map +1 -0
  256. package/dist/statistics-Cmj6nynr.d.ts +514 -0
  257. package/dist/statistics-Cmj6nynr.d.ts.map +1 -0
  258. package/dist/statistics-CnnxdpOg.js +1437 -0
  259. package/dist/statistics-CnnxdpOg.js.map +1 -0
  260. package/dist/store-CT9YIIve.d.ts +117 -0
  261. package/dist/store-CT9YIIve.d.ts.map +1 -0
  262. package/dist/store-CxJry_cs.d.ts +229 -0
  263. package/dist/store-CxJry_cs.d.ts.map +1 -0
  264. package/dist/storyboard/index.d.ts +84 -203
  265. package/dist/storyboard/index.d.ts.map +1 -0
  266. package/dist/storyboard/index.js +609 -542
  267. package/dist/storyboard/index.js.map +1 -1
  268. package/dist/summary-report-BNs5nmXI.js +862 -0
  269. package/dist/summary-report-BNs5nmXI.js.map +1 -0
  270. package/dist/summary-report-Cj9gdw4i.d.ts +407 -0
  271. package/dist/summary-report-Cj9gdw4i.d.ts.map +1 -0
  272. package/dist/supervisor-run/index.d.ts +2 -959
  273. package/dist/supervisor-run/index.js +2 -65
  274. package/dist/supervisor-run-_lnTLM3z.js +1679 -0
  275. package/dist/supervisor-run-_lnTLM3z.js.map +1 -0
  276. package/dist/task-failure-attributes-CQZlB3et.js +311 -0
  277. package/dist/task-failure-attributes-CQZlB3et.js.map +1 -0
  278. package/dist/test-graded-scenario-BsqWLmPt.js +318 -0
  279. package/dist/test-graded-scenario-BsqWLmPt.js.map +1 -0
  280. package/dist/test-graded-scenario-D1TaI2va.d.ts +141 -0
  281. package/dist/test-graded-scenario-D1TaI2va.d.ts.map +1 -0
  282. package/dist/tools-BmuN627J.js +1085 -0
  283. package/dist/tools-BmuN627J.js.map +1 -0
  284. package/dist/trace-attributes.d.ts +2 -52
  285. package/dist/trace-attributes.js +131 -61
  286. package/dist/trace-attributes.js.map +1 -1
  287. package/dist/traces.d.ts +12 -2365
  288. package/dist/traces.js +12 -252
  289. package/dist/trajectory-D_7rLrvE.js +56 -0
  290. package/dist/trajectory-D_7rLrvE.js.map +1 -0
  291. package/dist/types-DGsxbAEd.d.ts +387 -0
  292. package/dist/types-DGsxbAEd.d.ts.map +1 -0
  293. package/dist/types-k9tZGKUg.d.ts +640 -0
  294. package/dist/types-k9tZGKUg.d.ts.map +1 -0
  295. package/dist/verdict-Dps8_okt.d.ts +37 -0
  296. package/dist/verdict-Dps8_okt.d.ts.map +1 -0
  297. package/dist/wire/index.d.ts +702 -1173
  298. package/dist/wire/index.d.ts.map +1 -0
  299. package/dist/wire/index.js +2 -81
  300. package/package.json +17 -9
  301. package/dist/benchmarks/index.js.map +0 -1
  302. package/dist/campaign/index.js.map +0 -1
  303. package/dist/chunk-2QU3YOPR.js +0 -7374
  304. package/dist/chunk-2QU3YOPR.js.map +0 -1
  305. package/dist/chunk-3OCR4R5I.js +0 -728
  306. package/dist/chunk-3OCR4R5I.js.map +0 -1
  307. package/dist/chunk-3RF76KTD.js +0 -84
  308. package/dist/chunk-3RF76KTD.js.map +0 -1
  309. package/dist/chunk-56TAVBOK.js +0 -698
  310. package/dist/chunk-5DTSBUL2.js +0 -159
  311. package/dist/chunk-5DTSBUL2.js.map +0 -1
  312. package/dist/chunk-7FO3TNPI.js +0 -232
  313. package/dist/chunk-7FO3TNPI.js.map +0 -1
  314. package/dist/chunk-7ZZMD7UK.js +0 -386
  315. package/dist/chunk-7ZZMD7UK.js.map +0 -1
  316. package/dist/chunk-BOD4O7OF.js +0 -40
  317. package/dist/chunk-BOD4O7OF.js.map +0 -1
  318. package/dist/chunk-BSO5JDQH.js +0 -2335
  319. package/dist/chunk-BSO5JDQH.js.map +0 -1
  320. package/dist/chunk-C6LXANRU.js +0 -1550
  321. package/dist/chunk-C6LXANRU.js.map +0 -1
  322. package/dist/chunk-DODXQREJ.js +0 -752
  323. package/dist/chunk-DODXQREJ.js.map +0 -1
  324. package/dist/chunk-DRYIUNWY.js +0 -622
  325. package/dist/chunk-DRYIUNWY.js.map +0 -1
  326. package/dist/chunk-E7QXT7SX.js +0 -183
  327. package/dist/chunk-E7QXT7SX.js.map +0 -1
  328. package/dist/chunk-EG66UGL4.js +0 -341
  329. package/dist/chunk-EG66UGL4.js.map +0 -1
  330. package/dist/chunk-FXTVJPYD.js +0 -576
  331. package/dist/chunk-FXTVJPYD.js.map +0 -1
  332. package/dist/chunk-G7MGMCZD.js +0 -153
  333. package/dist/chunk-G7MGMCZD.js.map +0 -1
  334. package/dist/chunk-GGE4NNQT.js +0 -65
  335. package/dist/chunk-GGE4NNQT.js.map +0 -1
  336. package/dist/chunk-H23X7XKK.js +0 -181
  337. package/dist/chunk-H23X7XKK.js.map +0 -1
  338. package/dist/chunk-HHWE3POT.js +0 -94
  339. package/dist/chunk-HHWE3POT.js.map +0 -1
  340. package/dist/chunk-HPWUNB47.js +0 -289
  341. package/dist/chunk-HPWUNB47.js.map +0 -1
  342. package/dist/chunk-IYCLP2N2.js +0 -766
  343. package/dist/chunk-IYCLP2N2.js.map +0 -1
  344. package/dist/chunk-JHCHEVET.js +0 -274
  345. package/dist/chunk-JHCHEVET.js.map +0 -1
  346. package/dist/chunk-JQSF5DQT.js +0 -701
  347. package/dist/chunk-JQSF5DQT.js.map +0 -1
  348. package/dist/chunk-K4DBDHLK.js +0 -158
  349. package/dist/chunk-K4DBDHLK.js.map +0 -1
  350. package/dist/chunk-K6N6XJJX.js +0 -306
  351. package/dist/chunk-K6N6XJJX.js.map +0 -1
  352. package/dist/chunk-M4YBQKIJ.js +0 -1040
  353. package/dist/chunk-M4YBQKIJ.js.map +0 -1
  354. package/dist/chunk-MA6HLL3S.js +0 -65
  355. package/dist/chunk-MA6HLL3S.js.map +0 -1
  356. package/dist/chunk-MAZ26DC7.js +0 -99
  357. package/dist/chunk-MAZ26DC7.js.map +0 -1
  358. package/dist/chunk-NPCTHQIO.js +0 -91
  359. package/dist/chunk-NPCTHQIO.js.map +0 -1
  360. package/dist/chunk-NY44NC4A.js +0 -1056
  361. package/dist/chunk-NY44NC4A.js.map +0 -1
  362. package/dist/chunk-OIUOT4QD.js +0 -44
  363. package/dist/chunk-OIUOT4QD.js.map +0 -1
  364. package/dist/chunk-ONWEPEDO.js +0 -57
  365. package/dist/chunk-ONWEPEDO.js.map +0 -1
  366. package/dist/chunk-OWN5NPMC.js +0 -152
  367. package/dist/chunk-OWN5NPMC.js.map +0 -1
  368. package/dist/chunk-P6FYH6K4.js +0 -1161
  369. package/dist/chunk-P6FYH6K4.js.map +0 -1
  370. package/dist/chunk-PC4UYEBM.js +0 -166
  371. package/dist/chunk-PC4UYEBM.js.map +0 -1
  372. package/dist/chunk-PC5DOSM7.js +0 -579
  373. package/dist/chunk-PC5DOSM7.js.map +0 -1
  374. package/dist/chunk-PXE2VKMX.js +0 -140
  375. package/dist/chunk-PXE2VKMX.js.map +0 -1
  376. package/dist/chunk-PZ5AY32C.js +0 -10
  377. package/dist/chunk-PZ5AY32C.js.map +0 -1
  378. package/dist/chunk-QB6BDBP2.js +0 -4464
  379. package/dist/chunk-QB6BDBP2.js.map +0 -1
  380. package/dist/chunk-RXHCETDZ.js +0 -536
  381. package/dist/chunk-RXHCETDZ.js.map +0 -1
  382. package/dist/chunk-RZTMDUO7.js +0 -49
  383. package/dist/chunk-RZTMDUO7.js.map +0 -1
  384. package/dist/chunk-SFLLL76A.js +0 -669
  385. package/dist/chunk-SFLLL76A.js.map +0 -1
  386. package/dist/chunk-SZLVEKMJ.js +0 -1446
  387. package/dist/chunk-SZLVEKMJ.js.map +0 -1
  388. package/dist/chunk-T4SQEITX.js +0 -95
  389. package/dist/chunk-T4SQEITX.js.map +0 -1
  390. package/dist/chunk-T6RLYGAD.js +0 -158
  391. package/dist/chunk-T6RLYGAD.js.map +0 -1
  392. package/dist/chunk-TJVT4QFF.js +0 -911
  393. package/dist/chunk-TJVT4QFF.js.map +0 -1
  394. package/dist/chunk-TQ7LNKZ3.js +0 -136
  395. package/dist/chunk-TQ7LNKZ3.js.map +0 -1
  396. package/dist/chunk-U4L7JRPZ.js +0 -1706
  397. package/dist/chunk-U4L7JRPZ.js.map +0 -1
  398. package/dist/chunk-U4PHLT2N.js +0 -419
  399. package/dist/chunk-U4PHLT2N.js.map +0 -1
  400. package/dist/chunk-VCZ5FQYW.js +0 -928
  401. package/dist/chunk-VCZ5FQYW.js.map +0 -1
  402. package/dist/chunk-VI2UW6B6.js +0 -162
  403. package/dist/chunk-VI2UW6B6.js.map +0 -1
  404. package/dist/chunk-VQMK5FMP.js +0 -247
  405. package/dist/chunk-VQMK5FMP.js.map +0 -1
  406. package/dist/chunk-WGXIEX7P.js +0 -116
  407. package/dist/chunk-WGXIEX7P.js.map +0 -1
  408. package/dist/chunk-WVATSFCP.js +0 -1553
  409. package/dist/chunk-WVATSFCP.js.map +0 -1
  410. package/dist/chunk-X4YIBDER.js +0 -1662
  411. package/dist/chunk-X4YIBDER.js.map +0 -1
  412. package/dist/chunk-YQN4ICPP.js +0 -355
  413. package/dist/chunk-YQN4ICPP.js.map +0 -1
  414. package/dist/chunk-ZET2UAYW.js +0 -89
  415. package/dist/chunk-ZET2UAYW.js.map +0 -1
  416. package/dist/chunk-ZHTZ4EYI.js +0 -1212
  417. package/dist/chunk-ZHTZ4EYI.js.map +0 -1
  418. package/dist/control.js.map +0 -1
  419. package/dist/hosted/index.js.map +0 -1
  420. package/dist/matrix/index.js.map +0 -1
  421. package/dist/reporting.js.map +0 -1
  422. package/dist/rollout/index.js.map +0 -1
  423. package/dist/run-campaign-OJJ7CZF4.js +0 -18
  424. package/dist/run-campaign-OJJ7CZF4.js.map +0 -1
  425. package/dist/supervisor-run/index.js.map +0 -1
  426. package/dist/traces.js.map +0 -1
  427. package/dist/wire/index.js.map +0 -1
@@ -1,517 +1,536 @@
1
- import {
2
- DEFAULT_RULES,
3
- classifyFailure,
4
- compareToBaseline,
5
- computeToolUseMetrics
6
- } from "../chunk-FXTVJPYD.js";
7
- import {
8
- executionTrackByLane
9
- } from "../chunk-HHWE3POT.js";
10
- import {
11
- buildTrajectory
12
- } from "../chunk-RZTMDUO7.js";
13
- import {
14
- interRaterReliability,
15
- pearsonR
16
- } from "../chunk-ZHTZ4EYI.js";
17
- import {
18
- aggregateLlm,
19
- argHash,
20
- hasCapturedToolArgs,
21
- llmSpans,
22
- runFailureClass,
23
- toolSpans
24
- } from "../chunk-ZET2UAYW.js";
25
- import {
26
- isToolSpan
27
- } from "../chunk-MA6HLL3S.js";
28
- import "../chunk-ONWEPEDO.js";
29
- import "../chunk-PZ5AY32C.js";
30
-
31
- // src/pipelines/budget-breach.ts
1
+ import { t as executionTrackByLane } from "../execution-tracks-CpgFPpS5.js";
2
+ import { E as pearsonR, u as interRaterReliability } from "../statistics-CnnxdpOg.js";
3
+ import { s as isToolSpan } from "../schema-CRhEY1SO.js";
4
+ import { t as buildTrajectory } from "../trajectory-D_7rLrvE.js";
5
+ import { i as hasCapturedToolArgs, l as toolSpans, n as argHash, o as llmSpans, s as runFailureClass, t as aggregateLlm } from "../query-Di7eEQ79.js";
6
+ import { a as DEFAULT_RULES, i as computeToolUseMetrics, o as classifyFailure, t as compareToBaseline } from "../baseline-HsBvw_dk.js";
7
+ //#region src/pipelines/budget-breach.ts
32
8
  async function budgetBreachView(store, options = {}) {
33
- const runs = await store.listRuns({
34
- scenarioId: options.scenarioId,
35
- variantId: options.variantId
36
- });
37
- const findings = [];
38
- const byDimension = {};
39
- const byScenario = {};
40
- const byVariant = {};
41
- for (const run of runs) {
42
- const entries = await store.budget(run.runId);
43
- for (const e of entries) {
44
- if (!e.breached) continue;
45
- const excessRatio = e.limit > 0 ? e.consumed / e.limit : Infinity;
46
- findings.push({
47
- runId: run.runId,
48
- scenarioId: run.scenarioId,
49
- variantId: run.variantId,
50
- dimension: e.dimension,
51
- limit: e.limit,
52
- consumed: e.consumed,
53
- excessRatio,
54
- timestamp: e.timestamp
55
- });
56
- byDimension[e.dimension] = (byDimension[e.dimension] ?? 0) + 1;
57
- byScenario[run.scenarioId] = (byScenario[run.scenarioId] ?? 0) + 1;
58
- if (run.variantId) byVariant[run.variantId] = (byVariant[run.variantId] ?? 0) + 1;
59
- }
60
- }
61
- const breachedRuns = new Set(findings.map((f) => f.runId));
62
- return {
63
- findings,
64
- byDimension,
65
- byScenario,
66
- byVariant,
67
- totalRuns: runs.length,
68
- breachedRunRatio: runs.length > 0 ? breachedRuns.size / runs.length : 0
69
- };
9
+ const runs = await store.listRuns({
10
+ scenarioId: options.scenarioId,
11
+ variantId: options.variantId
12
+ });
13
+ const findings = [];
14
+ const byDimension = {};
15
+ const byScenario = {};
16
+ const byVariant = {};
17
+ for (const run of runs) {
18
+ const entries = await store.budget(run.runId);
19
+ for (const e of entries) {
20
+ if (!e.breached) continue;
21
+ const excessRatio = e.limit > 0 ? e.consumed / e.limit : Infinity;
22
+ findings.push({
23
+ runId: run.runId,
24
+ scenarioId: run.scenarioId,
25
+ variantId: run.variantId,
26
+ dimension: e.dimension,
27
+ limit: e.limit,
28
+ consumed: e.consumed,
29
+ excessRatio,
30
+ timestamp: e.timestamp
31
+ });
32
+ byDimension[e.dimension] = (byDimension[e.dimension] ?? 0) + 1;
33
+ byScenario[run.scenarioId] = (byScenario[run.scenarioId] ?? 0) + 1;
34
+ if (run.variantId) byVariant[run.variantId] = (byVariant[run.variantId] ?? 0) + 1;
35
+ }
36
+ }
37
+ const breachedRuns = new Set(findings.map((f) => f.runId));
38
+ return {
39
+ findings,
40
+ byDimension,
41
+ byScenario,
42
+ byVariant,
43
+ totalRuns: runs.length,
44
+ breachedRunRatio: runs.length > 0 ? breachedRuns.size / runs.length : 0
45
+ };
70
46
  }
71
-
72
- // src/pipelines/failure-cluster.ts
47
+ //#endregion
48
+ //#region src/pipelines/failure-cluster.ts
49
+ /**
50
+ * FailureClusterView — groups failed runs by (failureClass, triggerTool,
51
+ * argHash-prefix) so weekly reviews can prioritize the top-N clusters.
52
+ *
53
+ * Each cluster includes: N runs, scenarios affected, representative
54
+ * error message, a proposed mitigation hint (rule → action table).
55
+ */
73
56
  async function failureClusterView(store, options = {}) {
74
- const rules = options.rules ?? DEFAULT_RULES;
75
- const minSize = options.minClusterSize ?? 1;
76
- const runs = await store.listRuns();
77
- const clusters = /* @__PURE__ */ new Map();
78
- let totalFailures = 0;
79
- for (const run of runs) {
80
- if (run.status === "completed" && run.outcome?.pass !== false) continue;
81
- totalFailures++;
82
- const spans = await store.spans({ runId: run.runId });
83
- const events = await store.events({ runId: run.runId });
84
- const cls = classifyFailure({ run, spans, events }, rules);
85
- let toolName;
86
- let argPrefix;
87
- let dimension;
88
- if (cls.triggerSpanId) {
89
- const trig = spans.find((s) => s.spanId === cls.triggerSpanId);
90
- if (trig?.kind === "tool") {
91
- toolName = trig.toolName;
92
- if (hasCapturedToolArgs(trig)) argPrefix = argHash(trig.args).slice(0, 16);
93
- } else if (trig?.kind === "judge") {
94
- dimension = trig.dimension;
95
- }
96
- }
97
- if (!toolName) {
98
- const ts = await toolSpans(store, run.runId);
99
- const errored = ts.filter((t) => t.status === "error").pop();
100
- if (errored) {
101
- toolName = errored.toolName;
102
- if (hasCapturedToolArgs(errored)) argPrefix = argHash(errored.args).slice(0, 16);
103
- }
104
- }
105
- if (!dimension) {
106
- const judge = spans.find((s) => s.kind === "judge" && typeof s.dimension === "string");
107
- if (judge?.kind === "judge") dimension = judge.dimension;
108
- }
109
- const key = `${cls.failureClass}|${toolName ?? ""}|${argPrefix ?? ""}|${dimension ?? ""}`;
110
- let cluster = clusters.get(key);
111
- if (!cluster) {
112
- cluster = {
113
- failureClass: cls.failureClass,
114
- toolName,
115
- argPrefix,
116
- dimension,
117
- runCount: 0,
118
- scenarioIds: [],
119
- exampleRunId: run.runId,
120
- exampleError: firstErrorMessage(spans) ?? cls.reason
121
- };
122
- clusters.set(key, cluster);
123
- }
124
- cluster.runCount++;
125
- if (!cluster.scenarioIds.includes(run.scenarioId)) cluster.scenarioIds.push(run.scenarioId);
126
- }
127
- const arr = [...clusters.values()].filter((c) => c.runCount >= minSize).sort((a, b) => b.runCount - a.runCount);
128
- return { clusters: arr, totalFailures, totalRuns: runs.length };
57
+ const rules = options.rules ?? DEFAULT_RULES;
58
+ const minSize = options.minClusterSize ?? 1;
59
+ const runs = await store.listRuns();
60
+ const clusters = /* @__PURE__ */ new Map();
61
+ let totalFailures = 0;
62
+ for (const run of runs) {
63
+ if (run.status === "completed" && run.outcome?.pass !== false) continue;
64
+ totalFailures++;
65
+ const spans = await store.spans({ runId: run.runId });
66
+ const cls = classifyFailure({
67
+ run,
68
+ spans,
69
+ events: await store.events({ runId: run.runId })
70
+ }, rules);
71
+ let toolName;
72
+ let argPrefix;
73
+ let dimension;
74
+ if (cls.triggerSpanId) {
75
+ const trig = spans.find((s) => s.spanId === cls.triggerSpanId);
76
+ if (trig?.kind === "tool") {
77
+ toolName = trig.toolName;
78
+ if (hasCapturedToolArgs(trig)) argPrefix = argHash(trig.args).slice(0, 16);
79
+ } else if (trig?.kind === "judge") dimension = trig.dimension;
80
+ }
81
+ if (!toolName) {
82
+ const errored = (await toolSpans(store, run.runId)).filter((t) => t.status === "error").pop();
83
+ if (errored) {
84
+ toolName = errored.toolName;
85
+ if (hasCapturedToolArgs(errored)) argPrefix = argHash(errored.args).slice(0, 16);
86
+ }
87
+ }
88
+ if (!dimension) {
89
+ const judge = spans.find((s) => s.kind === "judge" && typeof s.dimension === "string");
90
+ if (judge?.kind === "judge") dimension = judge.dimension;
91
+ }
92
+ const key = `${cls.failureClass}|${toolName ?? ""}|${argPrefix ?? ""}|${dimension ?? ""}`;
93
+ let cluster = clusters.get(key);
94
+ if (!cluster) {
95
+ cluster = {
96
+ failureClass: cls.failureClass,
97
+ toolName,
98
+ argPrefix,
99
+ dimension,
100
+ runCount: 0,
101
+ scenarioIds: [],
102
+ exampleRunId: run.runId,
103
+ exampleError: firstErrorMessage(spans) ?? cls.reason
104
+ };
105
+ clusters.set(key, cluster);
106
+ }
107
+ cluster.runCount++;
108
+ if (!cluster.scenarioIds.includes(run.scenarioId)) cluster.scenarioIds.push(run.scenarioId);
109
+ }
110
+ return {
111
+ clusters: [...clusters.values()].filter((c) => c.runCount >= minSize).sort((a, b) => b.runCount - a.runCount),
112
+ totalFailures,
113
+ totalRuns: runs.length
114
+ };
129
115
  }
130
116
  function firstErrorMessage(spans) {
131
- const errored = spans.find((s) => s.status === "error");
132
- return errored?.error;
117
+ return spans.find((s) => s.status === "error")?.error;
133
118
  }
134
-
135
- // src/pipelines/first-divergence.ts
119
+ //#endregion
120
+ //#region src/pipelines/first-divergence.ts
136
121
  async function firstDivergenceView(store, runA, runB, options = {}) {
137
- const [a, b] = await Promise.all([buildTrajectory(store, runA), buildTrajectory(store, runB)]);
138
- const eq = options.stepEquals ?? defaultStepEquals;
139
- const minLen = Math.min(a.steps.length, b.steps.length);
140
- for (let i = 0; i < minLen; i++) {
141
- const aStep = a.steps[i];
142
- const bStep = b.steps[i];
143
- if (!eq(aStep, bStep)) {
144
- return {
145
- runA,
146
- runB,
147
- firstDivergenceIndex: i,
148
- aStep,
149
- bStep,
150
- reason: describeDifference(aStep, bStep),
151
- commonPrefixLen: i
152
- };
153
- }
154
- }
155
- if (a.steps.length === b.steps.length) {
156
- return { runA, runB, firstDivergenceIndex: null, commonPrefixLen: minLen };
157
- }
158
- const longer = a.steps.length > b.steps.length ? a : b;
159
- const extra = longer.steps.length - minLen;
160
- const reason = minLen === 0 ? `one trajectory is empty; the other has ${extra} step(s) starting at index 0` : `one trajectory has ${extra} more step(s) after index ${minLen - 1}`;
161
- return {
162
- runA,
163
- runB,
164
- firstDivergenceIndex: minLen,
165
- aStep: a.steps[minLen],
166
- bStep: b.steps[minLen],
167
- reason,
168
- commonPrefixLen: minLen
169
- };
122
+ const [a, b] = await Promise.all([buildTrajectory(store, runA), buildTrajectory(store, runB)]);
123
+ const eq = options.stepEquals ?? defaultStepEquals;
124
+ const minLen = Math.min(a.steps.length, b.steps.length);
125
+ for (let i = 0; i < minLen; i++) {
126
+ const aStep = a.steps[i];
127
+ const bStep = b.steps[i];
128
+ if (!eq(aStep, bStep)) return {
129
+ runA,
130
+ runB,
131
+ firstDivergenceIndex: i,
132
+ aStep,
133
+ bStep,
134
+ reason: describeDifference(aStep, bStep),
135
+ commonPrefixLen: i
136
+ };
137
+ }
138
+ if (a.steps.length === b.steps.length) return {
139
+ runA,
140
+ runB,
141
+ firstDivergenceIndex: null,
142
+ commonPrefixLen: minLen
143
+ };
144
+ const extra = (a.steps.length > b.steps.length ? a : b).steps.length - minLen;
145
+ const reason = minLen === 0 ? `one trajectory is empty; the other has ${extra} step(s) starting at index 0` : `one trajectory has ${extra} more step(s) after index ${minLen - 1}`;
146
+ return {
147
+ runA,
148
+ runB,
149
+ firstDivergenceIndex: minLen,
150
+ aStep: a.steps[minLen],
151
+ bStep: b.steps[minLen],
152
+ reason,
153
+ commonPrefixLen: minLen
154
+ };
170
155
  }
171
156
  function defaultStepEquals(a, b) {
172
- if (a.span.kind !== b.span.kind) return false;
173
- if (a.span.kind === "tool" && b.span.kind === "tool") return a.span.toolName === b.span.toolName;
174
- if (a.span.kind === "llm" && b.span.kind === "llm") return a.span.model === b.span.model;
175
- if (a.span.kind === "judge" && b.span.kind === "judge")
176
- return a.span.dimension === b.span.dimension;
177
- return a.span.name === b.span.name;
157
+ if (a.span.kind !== b.span.kind) return false;
158
+ if (a.span.kind === "tool" && b.span.kind === "tool") return a.span.toolName === b.span.toolName;
159
+ if (a.span.kind === "llm" && b.span.kind === "llm") return a.span.model === b.span.model;
160
+ if (a.span.kind === "judge" && b.span.kind === "judge") return a.span.dimension === b.span.dimension;
161
+ return a.span.name === b.span.name;
178
162
  }
179
163
  function describeDifference(a, b) {
180
- if (a.span.kind !== b.span.kind) return `kind ${a.span.kind} vs ${b.span.kind}`;
181
- if (a.span.kind === "tool" && b.span.kind === "tool" && a.span.toolName !== b.span.toolName) {
182
- return `tool ${a.span.toolName} vs ${b.span.toolName}`;
183
- }
184
- if (a.span.kind === "llm" && b.span.kind === "llm" && a.span.model !== b.span.model) {
185
- return `model ${a.span.model} vs ${b.span.model}`;
186
- }
187
- return `name "${a.span.name}" vs "${b.span.name}"`;
164
+ if (a.span.kind !== b.span.kind) return `kind ${a.span.kind} vs ${b.span.kind}`;
165
+ if (a.span.kind === "tool" && b.span.kind === "tool" && a.span.toolName !== b.span.toolName) return `tool ${a.span.toolName} vs ${b.span.toolName}`;
166
+ if (a.span.kind === "llm" && b.span.kind === "llm" && a.span.model !== b.span.model) return `model ${a.span.model} vs ${b.span.model}`;
167
+ return `name "${a.span.name}" vs "${b.span.name}"`;
188
168
  }
189
-
190
- // src/pipelines/judge-agreement.ts
169
+ //#endregion
170
+ //#region src/pipelines/judge-agreement.ts
171
+ /**
172
+ * JudgeAgreementView — pairwise agreement between judges across the
173
+ * corpus, grouped by dimension.
174
+ *
175
+ * Output drives two workflows:
176
+ * - Judge robustness audit: "does Claude agree with GPT at κ ≥ 0.6?"
177
+ * - Calibration tracking: κ vs golden human labels over time (by
178
+ * providing a `humanGoldenJudgeId`).
179
+ */
191
180
  async function judgeAgreementView(store) {
192
- const all = (await store.spans({ kind: "judge" })).filter(
193
- (s) => s.kind === "judge"
194
- );
195
- if (all.length === 0) return { pairs: [], dimensions: [], judgeIds: [] };
196
- const byDimension = /* @__PURE__ */ new Map();
197
- for (const s of all) {
198
- const arr = byDimension.get(s.dimension) ?? [];
199
- arr.push(s);
200
- byDimension.set(s.dimension, arr);
201
- }
202
- const judgeIds = [...new Set(all.map((s) => s.judgeId))].sort();
203
- const pairs = [];
204
- for (const [dim, spans] of byDimension) {
205
- const byJudge = /* @__PURE__ */ new Map();
206
- for (const s of spans) {
207
- const m = byJudge.get(s.judgeId) ?? /* @__PURE__ */ new Map();
208
- m.set(s.targetSpanId, s.score);
209
- byJudge.set(s.judgeId, m);
210
- }
211
- const judgesHere = [...byJudge.keys()];
212
- for (let i = 0; i < judgesHere.length; i++) {
213
- for (let j = i + 1; j < judgesHere.length; j++) {
214
- const judgeI = judgesHere[i];
215
- const judgeJ = judgesHere[j];
216
- const a = byJudge.get(judgeI);
217
- const b = byJudge.get(judgeJ);
218
- const common = [];
219
- for (const [target, scoreA] of a) {
220
- const scoreB = b.get(target);
221
- if (scoreB !== void 0) common.push([scoreA, scoreB]);
222
- }
223
- if (common.length < 2) continue;
224
- const judgeScores = common.map(
225
- ([scoreA, scoreB]) => [
226
- { judgeName: judgeI, dimension: dim, score: scoreA, reasoning: "" },
227
- { judgeName: judgeJ, dimension: dim, score: scoreB, reasoning: "" }
228
- ]
229
- );
230
- const k = interRaterReliability(
231
- judgeScores[0].map((_, k2) => judgeScores.map((pair) => pair[k2]))
232
- );
233
- pairs.push({
234
- judgeA: judgeI,
235
- judgeB: judgeJ,
236
- dimension: dim,
237
- commonItems: common.length,
238
- pearson: pearsonR(
239
- common.map((c) => c[0]),
240
- common.map((c) => c[1])
241
- ),
242
- krippendorff: k
243
- });
244
- }
245
- }
246
- }
247
- return {
248
- pairs: pairs.sort((a, b) => b.commonItems - a.commonItems),
249
- dimensions: [...byDimension.keys()].sort(),
250
- judgeIds
251
- };
181
+ const all = (await store.spans({ kind: "judge" })).filter((s) => s.kind === "judge");
182
+ if (all.length === 0) return {
183
+ pairs: [],
184
+ dimensions: [],
185
+ judgeIds: []
186
+ };
187
+ const byDimension = /* @__PURE__ */ new Map();
188
+ for (const s of all) {
189
+ const arr = byDimension.get(s.dimension) ?? [];
190
+ arr.push(s);
191
+ byDimension.set(s.dimension, arr);
192
+ }
193
+ const judgeIds = [...new Set(all.map((s) => s.judgeId))].sort();
194
+ const pairs = [];
195
+ for (const [dim, spans] of byDimension) {
196
+ const byJudge = /* @__PURE__ */ new Map();
197
+ for (const s of spans) {
198
+ const m = byJudge.get(s.judgeId) ?? /* @__PURE__ */ new Map();
199
+ m.set(s.targetSpanId, s.score);
200
+ byJudge.set(s.judgeId, m);
201
+ }
202
+ const judgesHere = [...byJudge.keys()];
203
+ for (let i = 0; i < judgesHere.length; i++) for (let j = i + 1; j < judgesHere.length; j++) {
204
+ const judgeI = judgesHere[i];
205
+ const judgeJ = judgesHere[j];
206
+ const a = byJudge.get(judgeI);
207
+ const b = byJudge.get(judgeJ);
208
+ const common = [];
209
+ for (const [target, scoreA] of a) {
210
+ const scoreB = b.get(target);
211
+ if (scoreB !== void 0) common.push([scoreA, scoreB]);
212
+ }
213
+ if (common.length < 2) continue;
214
+ const judgeScores = common.map(([scoreA, scoreB]) => [{
215
+ judgeName: judgeI,
216
+ dimension: dim,
217
+ score: scoreA,
218
+ reasoning: ""
219
+ }, {
220
+ judgeName: judgeJ,
221
+ dimension: dim,
222
+ score: scoreB,
223
+ reasoning: ""
224
+ }]);
225
+ const k = interRaterReliability(judgeScores[0].map((_, k2) => judgeScores.map((pair) => pair[k2])));
226
+ pairs.push({
227
+ judgeA: judgeI,
228
+ judgeB: judgeJ,
229
+ dimension: dim,
230
+ commonItems: common.length,
231
+ pearson: pearsonR(common.map((c) => c[0]), common.map((c) => c[1])),
232
+ krippendorff: k
233
+ });
234
+ }
235
+ }
236
+ return {
237
+ pairs: pairs.sort((a, b) => b.commonItems - a.commonItems),
238
+ dimensions: [...byDimension.keys()].sort(),
239
+ judgeIds
240
+ };
252
241
  }
253
-
254
- // src/pipelines/regression.ts
242
+ //#endregion
243
+ //#region src/pipelines/regression.ts
244
+ /**
245
+ * RegressionView — compares a candidate slice to a baseline slice on a
246
+ * named metric. Delegates the statistics (Welch's t-test, Cohen's d,
247
+ * IQR stability) to `baseline.ts`.
248
+ *
249
+ * This is the entry point for CI regression gates: "given runs tagged
250
+ * release=A and release=B, did any metric regress?"
251
+ */
255
252
  async function regressionView(store, metrics, options) {
256
- const baselineRuns = await store.listRuns(options.baseline);
257
- const candidateRuns = await store.listRuns(options.candidate);
258
- const samples = await Promise.all(
259
- metrics.map(async (m) => {
260
- const extract = m.extract ?? defaultExtract(m.metric);
261
- const baseline = await extractAll(baselineRuns, extract, store);
262
- const candidate = await extractAll(candidateRuns, extract, store);
263
- return { metric: m.metric, higherIsBetter: m.higherIsBetter, baseline, candidate };
264
- })
265
- );
266
- return compareToBaseline(samples, options);
253
+ const baselineRuns = await store.listRuns(options.baseline);
254
+ const candidateRuns = await store.listRuns(options.candidate);
255
+ return compareToBaseline(await Promise.all(metrics.map(async (m) => {
256
+ const extract = m.extract ?? defaultExtract(m.metric);
257
+ const baseline = await extractAll(baselineRuns, extract, store);
258
+ const candidate = await extractAll(candidateRuns, extract, store);
259
+ return {
260
+ metric: m.metric,
261
+ higherIsBetter: m.higherIsBetter,
262
+ baseline,
263
+ candidate
264
+ };
265
+ })), options);
267
266
  }
268
267
  async function extractAll(runs, extract, store) {
269
- const out = [];
270
- for (const r of runs) {
271
- const v = await extract(r, store);
272
- if (v !== null && Number.isFinite(v)) out.push(v);
273
- }
274
- return out;
268
+ const out = [];
269
+ for (const r of runs) {
270
+ const v = await extract(r, store);
271
+ if (v !== null && Number.isFinite(v)) out.push(v);
272
+ }
273
+ return out;
275
274
  }
276
275
  function defaultExtract(metric) {
277
- return async (run, store) => {
278
- switch (metric) {
279
- case "score":
280
- case "overallScore":
281
- return run.outcome?.score ?? null;
282
- case "pass":
283
- return run.outcome?.pass === true ? 1 : 0;
284
- case "durationMs":
285
- return run.endedAt && run.startedAt ? run.endedAt - run.startedAt : null;
286
- case "costUsd": {
287
- const llm = await llmSpans(store, run.runId);
288
- return aggregateLlm(llm).costUsd;
289
- }
290
- case "inputTokens": {
291
- const llm = await llmSpans(store, run.runId);
292
- return aggregateLlm(llm).inputTokens;
293
- }
294
- case "outputTokens": {
295
- const llm = await llmSpans(store, run.runId);
296
- return aggregateLlm(llm).outputTokens;
297
- }
298
- case "failureClass": {
299
- return runFailureClass(run) === "success" ? 1 : 0;
300
- }
301
- default:
302
- return null;
303
- }
304
- };
276
+ return async (run, store) => {
277
+ switch (metric) {
278
+ case "score":
279
+ case "overallScore": return run.outcome?.score ?? null;
280
+ case "pass": return run.outcome?.pass === true ? 1 : 0;
281
+ case "durationMs": return run.endedAt && run.startedAt ? run.endedAt - run.startedAt : null;
282
+ case "costUsd": return aggregateLlm(await llmSpans(store, run.runId)).costUsd;
283
+ case "inputTokens": return aggregateLlm(await llmSpans(store, run.runId)).inputTokens;
284
+ case "outputTokens": return aggregateLlm(await llmSpans(store, run.runId)).outputTokens;
285
+ case "failureClass": return runFailureClass(run) === "success" ? 1 : 0;
286
+ default: return null;
287
+ }
288
+ };
305
289
  }
306
-
307
- // src/pipelines/stuck-loop.ts
308
- var DEFAULT_MAX_WINDOW_MS = 6e4;
309
- var DEFAULT_MAX_INTERVENING_TOOL_CALLS = 0;
290
+ //#endregion
291
+ //#region src/pipelines/stuck-loop.ts
292
+ /**
293
+ * StuckLoopView detects when an agent calls the same tool with the
294
+ * same (or structurally similar) arguments ≥ N times in a short window.
295
+ *
296
+ * Rationale: agents that loop are the number-one production failure
297
+ * mode on long-horizon flows. The view returns (runId, toolName,
298
+ * argHash, occurrences, windowMs) for each detected loop plus a
299
+ * fraction of runs affected.
300
+ */
301
+ const DEFAULT_MAX_WINDOW_MS = 6e4;
302
+ const DEFAULT_MAX_INTERVENING_TOOL_CALLS = 0;
310
303
  async function stuckLoopView(store, options = {}) {
311
- const minOccurrences = options.minOccurrences ?? 3;
312
- const maxWindowMs = options.maxWindowMs ?? DEFAULT_MAX_WINDOW_MS;
313
- const maxInterveningToolCalls = options.maxInterveningToolCalls ?? DEFAULT_MAX_INTERVENING_TOOL_CALLS;
314
- if (!Number.isInteger(minOccurrences) || minOccurrences < 1) {
315
- throw new RangeError("minOccurrences must be a positive integer");
316
- }
317
- if (!Number.isFinite(maxWindowMs) || maxWindowMs < 0) {
318
- throw new RangeError("maxWindowMs must be a finite non-negative number");
319
- }
320
- if (!Number.isInteger(maxInterveningToolCalls) || maxInterveningToolCalls < 0) {
321
- throw new RangeError("maxInterveningToolCalls must be a non-negative integer");
322
- }
323
- const runs = options.runId ? [{ runId: options.runId }] : (await store.listRuns()).map((r) => ({ runId: r.runId }));
324
- const findings = [];
325
- for (const { runId } of runs) {
326
- const spans = await store.spans({ runId });
327
- const spansById = new Map(spans.map((span) => [span.spanId, span]));
328
- const scopedTools = spans.filter(isToolSpan).map((span, sourceIndex) => ({ span, sourceIndex })).sort((a, b) => a.span.startedAt - b.span.startedAt || a.sourceIndex - b.sourceIndex).map(({ span }) => ({ span, ...executionScope(span, spansById) }));
329
- const trackByLane = executionTrackByLane(
330
- scopedTools.map((call) => {
331
- const direct = call.laneSpanId === null || call.laneSpanId === call.scopeSpanId;
332
- const timed = direct ? call.span : call.laneSpanId ? spansById.get(call.laneSpanId) : void 0;
333
- return {
334
- key: executionKey(call),
335
- scopeKey: JSON.stringify(call.scopeSpanId),
336
- start: timed?.startedAt ?? null,
337
- end: timed?.endedAt ?? null
338
- };
339
- })
340
- );
341
- const nextToolIndexByTrack = /* @__PURE__ */ new Map();
342
- const orderedTools = scopedTools.map((call) => {
343
- const trackId = trackByLane.get(executionKey(call));
344
- const toolCallIndex = nextToolIndexByTrack.get(trackId) ?? 0;
345
- nextToolIndexByTrack.set(trackId, toolCallIndex + 1);
346
- return { ...call, toolCallIndex, trackId };
347
- });
348
- const byKey = /* @__PURE__ */ new Map();
349
- for (const call of orderedTools) {
350
- if (!hasCapturedToolArgs(call.span)) continue;
351
- const h = argHash(call.span.args);
352
- const key = JSON.stringify([call.trackId, call.span.toolName, h]);
353
- const bucket = byKey.get(key) ?? {
354
- calls: [],
355
- argHash: h,
356
- toolName: call.span.toolName,
357
- scopeSpanId: call.scopeSpanId
358
- };
359
- bucket.calls.push(call);
360
- byKey.set(key, bucket);
361
- }
362
- for (const { calls, argHash: h, toolName, scopeSpanId } of byKey.values()) {
363
- if (calls.length < minOccurrences) continue;
364
- let episodeStart = 0;
365
- for (let episodeEnd = 1; episodeEnd <= calls.length; episodeEnd += 1) {
366
- const previous = calls[episodeEnd - 1];
367
- const next = calls[episodeEnd];
368
- const episodeEnded = next === void 0 || next.span.startedAt - previous.span.startedAt > maxWindowMs || next.toolCallIndex - previous.toolCallIndex - 1 > maxInterveningToolCalls || !callsAreSerial(previous, next);
369
- if (!episodeEnded) continue;
370
- const episode = calls.slice(episodeStart, episodeEnd);
371
- let left = 0;
372
- let bestStart = 0;
373
- let bestEnd = -1;
374
- for (let right = 0; right < episode.length; right += 1) {
375
- while (episode[right].span.startedAt - episode[left].span.startedAt > maxWindowMs) {
376
- left += 1;
377
- }
378
- if (right - left > bestEnd - bestStart) {
379
- bestStart = left;
380
- bestEnd = right;
381
- }
382
- }
383
- if (bestEnd - bestStart + 1 >= minOccurrences) {
384
- const loop = episode.slice(bestStart, bestEnd + 1);
385
- const first = loop[0].span.startedAt;
386
- const last = loop[loop.length - 1].span.startedAt;
387
- findings.push({
388
- runId,
389
- toolName,
390
- argHash: h,
391
- occurrences: loop.length,
392
- spanIds: loop.map((call) => call.span.spanId),
393
- ...scopeSpanId ? { scopeSpanId } : {},
394
- windowMs: last - first
395
- });
396
- }
397
- episodeStart = episodeEnd;
398
- }
399
- }
400
- }
401
- const affectedRuns = new Set(findings.map((f) => f.runId));
402
- return {
403
- findings,
404
- affectedRunRatio: runs.length > 0 ? affectedRuns.size / runs.length : 0,
405
- totalRuns: runs.length
406
- };
304
+ const minOccurrences = options.minOccurrences ?? 3;
305
+ const maxWindowMs = options.maxWindowMs ?? DEFAULT_MAX_WINDOW_MS;
306
+ const maxInterveningToolCalls = options.maxInterveningToolCalls ?? DEFAULT_MAX_INTERVENING_TOOL_CALLS;
307
+ if (!Number.isInteger(minOccurrences) || minOccurrences < 1) throw new RangeError("minOccurrences must be a positive integer");
308
+ if (!Number.isFinite(maxWindowMs) || maxWindowMs < 0) throw new RangeError("maxWindowMs must be a finite non-negative number");
309
+ if (!Number.isInteger(maxInterveningToolCalls) || maxInterveningToolCalls < 0) throw new RangeError("maxInterveningToolCalls must be a non-negative integer");
310
+ const runs = options.runId ? [{ runId: options.runId }] : (await store.listRuns()).map((r) => ({ runId: r.runId }));
311
+ const findings = [];
312
+ for (const { runId } of runs) {
313
+ const spans = await store.spans({ runId });
314
+ const spansById = new Map(spans.map((span) => [span.spanId, span]));
315
+ const scopedTools = spans.filter(isToolSpan).map((span, sourceIndex) => ({
316
+ span,
317
+ sourceIndex
318
+ })).sort((a, b) => a.span.startedAt - b.span.startedAt || a.sourceIndex - b.sourceIndex).map(({ span }) => ({
319
+ span,
320
+ ...executionScope(span, spansById)
321
+ }));
322
+ const trackByLane = executionTrackByLane(scopedTools.map((call) => {
323
+ const timed = call.laneSpanId === null || call.laneSpanId === call.scopeSpanId ? call.span : call.laneSpanId ? spansById.get(call.laneSpanId) : void 0;
324
+ return {
325
+ key: executionKey(call),
326
+ scopeKey: JSON.stringify(call.scopeSpanId),
327
+ start: timed?.startedAt ?? null,
328
+ end: timed?.endedAt ?? null
329
+ };
330
+ }));
331
+ const nextToolIndexByTrack = /* @__PURE__ */ new Map();
332
+ const orderedTools = scopedTools.map((call) => {
333
+ const trackId = trackByLane.get(executionKey(call));
334
+ const toolCallIndex = nextToolIndexByTrack.get(trackId) ?? 0;
335
+ nextToolIndexByTrack.set(trackId, toolCallIndex + 1);
336
+ return {
337
+ ...call,
338
+ toolCallIndex,
339
+ trackId
340
+ };
341
+ });
342
+ const byKey = /* @__PURE__ */ new Map();
343
+ for (const call of orderedTools) {
344
+ if (!hasCapturedToolArgs(call.span)) continue;
345
+ const h = argHash(call.span.args);
346
+ const key = JSON.stringify([
347
+ call.trackId,
348
+ call.span.toolName,
349
+ h
350
+ ]);
351
+ const bucket = byKey.get(key) ?? {
352
+ calls: [],
353
+ argHash: h,
354
+ toolName: call.span.toolName,
355
+ scopeSpanId: call.scopeSpanId
356
+ };
357
+ bucket.calls.push(call);
358
+ byKey.set(key, bucket);
359
+ }
360
+ for (const { calls, argHash: h, toolName, scopeSpanId } of byKey.values()) {
361
+ if (calls.length < minOccurrences) continue;
362
+ let episodeStart = 0;
363
+ for (let episodeEnd = 1; episodeEnd <= calls.length; episodeEnd += 1) {
364
+ const previous = calls[episodeEnd - 1];
365
+ const next = calls[episodeEnd];
366
+ if (!(next === void 0 || next.span.startedAt - previous.span.startedAt > maxWindowMs || next.toolCallIndex - previous.toolCallIndex - 1 > maxInterveningToolCalls || !callsAreSerial(previous, next))) continue;
367
+ const episode = calls.slice(episodeStart, episodeEnd);
368
+ let left = 0;
369
+ let bestStart = 0;
370
+ let bestEnd = -1;
371
+ for (let right = 0; right < episode.length; right += 1) {
372
+ while (episode[right].span.startedAt - episode[left].span.startedAt > maxWindowMs) left += 1;
373
+ if (right - left > bestEnd - bestStart) {
374
+ bestStart = left;
375
+ bestEnd = right;
376
+ }
377
+ }
378
+ if (bestEnd - bestStart + 1 >= minOccurrences) {
379
+ const loop = episode.slice(bestStart, bestEnd + 1);
380
+ const first = loop[0].span.startedAt;
381
+ const last = loop[loop.length - 1].span.startedAt;
382
+ findings.push({
383
+ runId,
384
+ toolName,
385
+ argHash: h,
386
+ occurrences: loop.length,
387
+ spanIds: loop.map((call) => call.span.spanId),
388
+ ...scopeSpanId ? { scopeSpanId } : {},
389
+ windowMs: last - first
390
+ });
391
+ }
392
+ episodeStart = episodeEnd;
393
+ }
394
+ }
395
+ }
396
+ const affectedRuns = new Set(findings.map((f) => f.runId));
397
+ return {
398
+ findings,
399
+ affectedRunRatio: runs.length > 0 ? affectedRuns.size / runs.length : 0,
400
+ totalRuns: runs.length
401
+ };
407
402
  }
408
403
  function laneKey(call) {
409
- return JSON.stringify([call.scopeSpanId, call.laneSpanId]);
404
+ return JSON.stringify([call.scopeSpanId, call.laneSpanId]);
410
405
  }
411
406
  function executionKey(call) {
412
- return call.laneSpanId === null || call.laneSpanId === call.scopeSpanId ? JSON.stringify([call.scopeSpanId, call.span.spanId]) : laneKey(call);
407
+ return call.laneSpanId === null || call.laneSpanId === call.scopeSpanId ? JSON.stringify([call.scopeSpanId, call.span.spanId]) : laneKey(call);
413
408
  }
414
409
  function executionScope(span, spansById) {
415
- const directParent = span.parentSpanId;
416
- if (!directParent) return { scopeSpanId: null, laneSpanId: null };
417
- let currentId = directParent;
418
- let laneSpanId = null;
419
- const seen = /* @__PURE__ */ new Set();
420
- while (currentId && !seen.has(currentId)) {
421
- seen.add(currentId);
422
- const current = spansById.get(currentId);
423
- if (!current) return { scopeSpanId: directParent, laneSpanId: directParent };
424
- if (current.kind === "agent") {
425
- return { scopeSpanId: current.spanId, laneSpanId: laneSpanId ?? current.spanId };
426
- }
427
- laneSpanId = current.spanId;
428
- currentId = current.parentSpanId;
429
- }
430
- return { scopeSpanId: directParent, laneSpanId: directParent };
410
+ const directParent = span.parentSpanId;
411
+ if (!directParent) return {
412
+ scopeSpanId: null,
413
+ laneSpanId: null
414
+ };
415
+ let currentId = directParent;
416
+ let laneSpanId = null;
417
+ const seen = /* @__PURE__ */ new Set();
418
+ while (currentId && !seen.has(currentId)) {
419
+ seen.add(currentId);
420
+ const current = spansById.get(currentId);
421
+ if (!current) return {
422
+ scopeSpanId: directParent,
423
+ laneSpanId: directParent
424
+ };
425
+ if (current.kind === "agent") return {
426
+ scopeSpanId: current.spanId,
427
+ laneSpanId: laneSpanId ?? current.spanId
428
+ };
429
+ laneSpanId = current.spanId;
430
+ currentId = current.parentSpanId;
431
+ }
432
+ return {
433
+ scopeSpanId: directParent,
434
+ laneSpanId: directParent
435
+ };
431
436
  }
432
437
  function callsAreSerial(previous, next) {
433
- return previous.span.endedAt !== void 0 && previous.span.endedAt <= next.span.startedAt;
438
+ return previous.span.endedAt !== void 0 && previous.span.endedAt <= next.span.startedAt;
434
439
  }
435
-
436
- // src/pipelines/tool-waste.ts
440
+ //#endregion
441
+ //#region src/pipelines/tool-waste.ts
442
+ /**
443
+ * ToolWasteView — fraction of tool calls whose results weren't used
444
+ * downstream. Without a "used" signal we fall back to structural
445
+ * proxies: error calls, duplicate calls, and tool calls followed by
446
+ * zero subsequent LLM spans are all considered waste.
447
+ *
448
+ * Consumers can pass a `usageOracle` that inspects a tool span and
449
+ * returns true iff the tool's result appears in a later LLM message,
450
+ * artifact, or state mutation — that's the canonical definition; the
451
+ * default heuristic is a reasonable fallback.
452
+ */
437
453
  async function toolWasteView(store, options = {}) {
438
- const runs = options.runId ? [options.runId] : (await store.listRuns()).map((r) => r.runId);
439
- const byRun = [];
440
- let totalCalls = 0;
441
- let totalWasted = 0;
442
- for (const runId of runs) {
443
- const tools = await toolSpans(store, runId);
444
- if (tools.length === 0) {
445
- byRun.push({ runId, wastedCalls: 0, totalCalls: 0, wasteRate: 0 });
446
- continue;
447
- }
448
- const llms = await llmSpans(store, runId);
449
- const sortedLlm = [...llms].sort((a, b) => a.startedAt - b.startedAt);
450
- const startTimes = sortedLlm.map((l) => l.startedAt);
451
- const suffixText = buildSuffixText(sortedLlm);
452
- let wasted = 0;
453
- for (const t of tools) {
454
- if (t.status === "error") {
455
- wasted++;
456
- continue;
457
- }
458
- const cutoff = upperBound(startTimes, t.startedAt);
459
- if (options.usageOracle) {
460
- if (!options.usageOracle(t, { llm: sortedLlm.slice(cutoff) })) wasted++;
461
- } else {
462
- const resultStr = stringify(t.result);
463
- if (resultStr === "") continue;
464
- const haystack = suffixText[cutoff] ?? "";
465
- const used = haystack.includes(resultStr.slice(0, 120));
466
- if (!used) wasted++;
467
- }
468
- }
469
- const wasteRate = wasted / tools.length;
470
- byRun.push({ runId, wastedCalls: wasted, totalCalls: tools.length, wasteRate });
471
- totalCalls += tools.length;
472
- totalWasted += wasted;
473
- }
474
- return { byRun, overallWasteRate: totalCalls > 0 ? totalWasted / totalCalls : 0 };
454
+ const runs = options.runId ? [options.runId] : (await store.listRuns()).map((r) => r.runId);
455
+ const byRun = [];
456
+ let totalCalls = 0;
457
+ let totalWasted = 0;
458
+ for (const runId of runs) {
459
+ const tools = await toolSpans(store, runId);
460
+ if (tools.length === 0) {
461
+ byRun.push({
462
+ runId,
463
+ wastedCalls: 0,
464
+ totalCalls: 0,
465
+ wasteRate: 0
466
+ });
467
+ continue;
468
+ }
469
+ const sortedLlm = [...await llmSpans(store, runId)].sort((a, b) => a.startedAt - b.startedAt);
470
+ const startTimes = sortedLlm.map((l) => l.startedAt);
471
+ const suffixText = buildSuffixText(sortedLlm);
472
+ let wasted = 0;
473
+ for (const t of tools) {
474
+ if (t.status === "error") {
475
+ wasted++;
476
+ continue;
477
+ }
478
+ const cutoff = upperBound(startTimes, t.startedAt);
479
+ if (options.usageOracle) {
480
+ if (!options.usageOracle(t, { llm: sortedLlm.slice(cutoff) })) wasted++;
481
+ } else {
482
+ const resultStr = stringify(t.result);
483
+ if (resultStr === "") continue;
484
+ if (!(suffixText[cutoff] ?? "").includes(resultStr.slice(0, 120))) wasted++;
485
+ }
486
+ }
487
+ const wasteRate = wasted / tools.length;
488
+ byRun.push({
489
+ runId,
490
+ wastedCalls: wasted,
491
+ totalCalls: tools.length,
492
+ wasteRate
493
+ });
494
+ totalCalls += tools.length;
495
+ totalWasted += wasted;
496
+ }
497
+ return {
498
+ byRun,
499
+ overallWasteRate: totalCalls > 0 ? totalWasted / totalCalls : 0
500
+ };
475
501
  }
502
+ /**
503
+ * Build per-position suffix haystacks: result[i] is the concatenation of every
504
+ * string message content in spans[i..end]. Built back-to-front so each entry
505
+ * reuses the next one — O(total message text) rather than O(spans²).
506
+ */
476
507
  function buildSuffixText(spans) {
477
- const result = new Array(spans.length + 1);
478
- result[spans.length] = "";
479
- for (let i = spans.length - 1; i >= 0; i--) {
480
- const own = spans[i].messages.map(
481
- (m) => typeof m.content === "string" ? m.content : ""
482
- ).join("\n");
483
- result[i] = `${own}
484
- ${result[i + 1]}`;
485
- }
486
- return result;
508
+ const result = new Array(spans.length + 1);
509
+ result[spans.length] = "";
510
+ for (let i = spans.length - 1; i >= 0; i--) result[i] = `${spans[i].messages.map((m) => typeof m.content === "string" ? m.content : "").join("\n")}\n${result[i + 1]}`;
511
+ return result;
487
512
  }
513
+ /** Index of the first element strictly greater than `target` in a sorted array. */
488
514
  function upperBound(sorted, target) {
489
- let lo = 0;
490
- let hi = sorted.length;
491
- while (lo < hi) {
492
- const mid = lo + hi >>> 1;
493
- if (sorted[mid] <= target) lo = mid + 1;
494
- else hi = mid;
495
- }
496
- return lo;
515
+ let lo = 0;
516
+ let hi = sorted.length;
517
+ while (lo < hi) {
518
+ const mid = lo + hi >>> 1;
519
+ if (sorted[mid] <= target) lo = mid + 1;
520
+ else hi = mid;
521
+ }
522
+ return lo;
497
523
  }
498
524
  function stringify(v) {
499
- if (v === null || v === void 0) return "";
500
- if (typeof v === "string") return v;
501
- try {
502
- return JSON.stringify(v);
503
- } catch {
504
- return String(v);
505
- }
525
+ if (v === null || v === void 0) return "";
526
+ if (typeof v === "string") return v;
527
+ try {
528
+ return JSON.stringify(v);
529
+ } catch {
530
+ return String(v);
531
+ }
506
532
  }
507
- export {
508
- budgetBreachView,
509
- computeToolUseMetrics,
510
- failureClusterView,
511
- firstDivergenceView,
512
- judgeAgreementView,
513
- regressionView,
514
- stuckLoopView,
515
- toolWasteView
516
- };
533
+ //#endregion
534
+ export { budgetBreachView, computeToolUseMetrics, failureClusterView, firstDivergenceView, judgeAgreementView, regressionView, stuckLoopView, toolWasteView };
535
+
517
536
  //# sourceMappingURL=index.js.map