@tangle-network/agent-eval 0.128.2 → 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 (424) hide show
  1. package/CHANGELOG.md +279 -0
  2. package/README.md +19 -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 +83 -2932
  8. package/dist/analyst/index.d.ts.map +1 -0
  9. package/dist/analyst/index.js +319 -364
  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 -1205
  30. package/dist/belief-state/index.d.ts.map +1 -0
  31. package/dist/belief-state/index.js +1617 -1710
  32. package/dist/belief-state/index.js.map +1 -1
  33. package/dist/benchmarks/index.d.ts +2 -894
  34. package/dist/benchmarks/index.js +2 -59
  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 -6390
  44. package/dist/campaign/index.js +3 -212
  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 -174
  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 -5605
  61. package/dist/contract/index.d.ts.map +1 -0
  62. package/dist/contract/index.js +1730 -1937
  63. package/dist/contract/index.js.map +1 -1
  64. package/dist/control.d.ts +3 -1030
  65. package/dist/control.js +2 -32
  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 -617
  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 +3776 -15120
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.js +11185 -11191
  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 -481
  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 -1298
  196. package/dist/reporting.js +6 -50
  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 +916 -3596
  206. package/dist/rl.d.ts.map +1 -0
  207. package/dist/rl.js +2362 -1751
  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 -1048
  211. package/dist/rollout/index.js +8 -110
  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/run-record-BuoE80Dq.js.map +1 -0
  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 -849
  273. package/dist/supervisor-run/index.js +2 -64
  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 -251
  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 -1174
  298. package/dist/wire/index.d.ts.map +1 -0
  299. package/dist/wire/index.js +2 -81
  300. package/docs/feature-guide.md +1 -1
  301. package/docs/rollout.md +116 -2
  302. package/package.json +18 -10
  303. package/dist/benchmarks/index.js.map +0 -1
  304. package/dist/campaign/index.js.map +0 -1
  305. package/dist/chunk-2JX3CFMB.js +0 -695
  306. package/dist/chunk-2JX3CFMB.js.map +0 -1
  307. package/dist/chunk-2MKQIFS4.js +0 -183
  308. package/dist/chunk-2MKQIFS4.js.map +0 -1
  309. package/dist/chunk-3RF76KTD.js +0 -84
  310. package/dist/chunk-3RF76KTD.js.map +0 -1
  311. package/dist/chunk-5DTSBUL2.js +0 -159
  312. package/dist/chunk-5DTSBUL2.js.map +0 -1
  313. package/dist/chunk-7ZZMD7UK.js +0 -386
  314. package/dist/chunk-7ZZMD7UK.js.map +0 -1
  315. package/dist/chunk-BOD4O7OF.js +0 -40
  316. package/dist/chunk-BOD4O7OF.js.map +0 -1
  317. package/dist/chunk-BYT7ELPS.js +0 -1553
  318. package/dist/chunk-BYT7ELPS.js.map +0 -1
  319. package/dist/chunk-DJKY2TSY.js +0 -2428
  320. package/dist/chunk-DJKY2TSY.js.map +0 -1
  321. package/dist/chunk-DPUHNQLN.js +0 -232
  322. package/dist/chunk-DPUHNQLN.js.map +0 -1
  323. package/dist/chunk-DRYIUNWY.js +0 -622
  324. package/dist/chunk-DRYIUNWY.js.map +0 -1
  325. package/dist/chunk-EJGRPCO3.js +0 -617
  326. package/dist/chunk-EJGRPCO3.js.map +0 -1
  327. package/dist/chunk-EOSZT7PL.js +0 -2001
  328. package/dist/chunk-EOSZT7PL.js.map +0 -1
  329. package/dist/chunk-EZJEIH2R.js +0 -1559
  330. package/dist/chunk-EZJEIH2R.js.map +0 -1
  331. package/dist/chunk-GGE4NNQT.js +0 -65
  332. package/dist/chunk-GGE4NNQT.js.map +0 -1
  333. package/dist/chunk-HHWE3POT.js +0 -94
  334. package/dist/chunk-HHWE3POT.js.map +0 -1
  335. package/dist/chunk-IHQDPH7D.js +0 -171
  336. package/dist/chunk-IHQDPH7D.js.map +0 -1
  337. package/dist/chunk-JHCHEVET.js +0 -274
  338. package/dist/chunk-JHCHEVET.js.map +0 -1
  339. package/dist/chunk-K4DBDHLK.js +0 -158
  340. package/dist/chunk-K4DBDHLK.js.map +0 -1
  341. package/dist/chunk-K6N6XJJX.js +0 -306
  342. package/dist/chunk-K6N6XJJX.js.map +0 -1
  343. package/dist/chunk-MA6HLL3S.js +0 -65
  344. package/dist/chunk-MA6HLL3S.js.map +0 -1
  345. package/dist/chunk-MAZ26DC7.js +0 -99
  346. package/dist/chunk-MAZ26DC7.js.map +0 -1
  347. package/dist/chunk-MHELPNRP.js +0 -1212
  348. package/dist/chunk-MHELPNRP.js.map +0 -1
  349. package/dist/chunk-NACAGYSY.js +0 -1040
  350. package/dist/chunk-NACAGYSY.js.map +0 -1
  351. package/dist/chunk-NKAGIDE2.js +0 -7633
  352. package/dist/chunk-NKAGIDE2.js.map +0 -1
  353. package/dist/chunk-NPCTHQIO.js +0 -91
  354. package/dist/chunk-NPCTHQIO.js.map +0 -1
  355. package/dist/chunk-NYLOYM6N.js +0 -332
  356. package/dist/chunk-NYLOYM6N.js.map +0 -1
  357. package/dist/chunk-ONWEPEDO.js +0 -57
  358. package/dist/chunk-ONWEPEDO.js.map +0 -1
  359. package/dist/chunk-P5W7RQKK.js +0 -576
  360. package/dist/chunk-P5W7RQKK.js.map +0 -1
  361. package/dist/chunk-P6FYH6K4.js +0 -1161
  362. package/dist/chunk-P6FYH6K4.js.map +0 -1
  363. package/dist/chunk-PBE2LOSS.js +0 -669
  364. package/dist/chunk-PBE2LOSS.js.map +0 -1
  365. package/dist/chunk-PC4UYEBM.js +0 -166
  366. package/dist/chunk-PC4UYEBM.js.map +0 -1
  367. package/dist/chunk-PXE2VKMX.js +0 -140
  368. package/dist/chunk-PXE2VKMX.js.map +0 -1
  369. package/dist/chunk-PZ5AY32C.js +0 -10
  370. package/dist/chunk-PZ5AY32C.js.map +0 -1
  371. package/dist/chunk-RZTMDUO7.js +0 -49
  372. package/dist/chunk-RZTMDUO7.js.map +0 -1
  373. package/dist/chunk-S5YLIBFX.js +0 -136
  374. package/dist/chunk-S5YLIBFX.js.map +0 -1
  375. package/dist/chunk-SZLVEKMJ.js +0 -1446
  376. package/dist/chunk-SZLVEKMJ.js.map +0 -1
  377. package/dist/chunk-T4SQEITX.js +0 -95
  378. package/dist/chunk-T4SQEITX.js.map +0 -1
  379. package/dist/chunk-TBL77AUT.js +0 -355
  380. package/dist/chunk-TBL77AUT.js.map +0 -1
  381. package/dist/chunk-TSN7JT6D.js +0 -1646
  382. package/dist/chunk-TSN7JT6D.js.map +0 -1
  383. package/dist/chunk-TT4KNT67.js +0 -124
  384. package/dist/chunk-TT4KNT67.js.map +0 -1
  385. package/dist/chunk-UB2LOJ6Q.js +0 -4461
  386. package/dist/chunk-UB2LOJ6Q.js.map +0 -1
  387. package/dist/chunk-UWZZKKU7.js +0 -237
  388. package/dist/chunk-UWZZKKU7.js.map +0 -1
  389. package/dist/chunk-VBQ3CRKH.js +0 -291
  390. package/dist/chunk-VBQ3CRKH.js.map +0 -1
  391. package/dist/chunk-VGRCHJON.js +0 -163
  392. package/dist/chunk-VGRCHJON.js.map +0 -1
  393. package/dist/chunk-VI2UW6B6.js +0 -162
  394. package/dist/chunk-VI2UW6B6.js.map +0 -1
  395. package/dist/chunk-VLOATJQ2.js +0 -908
  396. package/dist/chunk-VLOATJQ2.js.map +0 -1
  397. package/dist/chunk-VQMK5FMP.js +0 -247
  398. package/dist/chunk-VQMK5FMP.js.map +0 -1
  399. package/dist/chunk-VZSRQ272.js +0 -149
  400. package/dist/chunk-VZSRQ272.js.map +0 -1
  401. package/dist/chunk-WGXIEX7P.js +0 -116
  402. package/dist/chunk-WGXIEX7P.js.map +0 -1
  403. package/dist/chunk-WS3NZZQQ.js +0 -929
  404. package/dist/chunk-WS3NZZQQ.js.map +0 -1
  405. package/dist/chunk-XDWDC2MP.js +0 -695
  406. package/dist/chunk-XDWDC2MP.js.map +0 -1
  407. package/dist/chunk-XPRT64IE.js +0 -766
  408. package/dist/chunk-XPRT64IE.js.map +0 -1
  409. package/dist/chunk-YJBNWCAA.js +0 -1056
  410. package/dist/chunk-YJBNWCAA.js.map +0 -1
  411. package/dist/chunk-ZET2UAYW.js +0 -89
  412. package/dist/chunk-ZET2UAYW.js.map +0 -1
  413. package/dist/chunk-ZUUWPZCV.js +0 -752
  414. package/dist/chunk-ZUUWPZCV.js.map +0 -1
  415. package/dist/control.js.map +0 -1
  416. package/dist/hosted/index.js.map +0 -1
  417. package/dist/matrix/index.js.map +0 -1
  418. package/dist/reporting.js.map +0 -1
  419. package/dist/rollout/index.js.map +0 -1
  420. package/dist/run-campaign-ISHFZ7FJ.js +0 -17
  421. package/dist/run-campaign-ISHFZ7FJ.js.map +0 -1
  422. package/dist/supervisor-run/index.js.map +0 -1
  423. package/dist/traces.js.map +0 -1
  424. package/dist/wire/index.js.map +0 -1
@@ -1,417 +1,420 @@
1
- import {
2
- calibrationCurve,
3
- calibrationFromPairs
4
- } from "../chunk-NPCTHQIO.js";
5
- import {
6
- analyzeSeries
7
- } from "../chunk-BOD4O7OF.js";
8
- import {
9
- FileSystemOutcomeStore,
10
- InMemoryOutcomeStore
11
- } from "../chunk-3RF76KTD.js";
12
- import {
13
- rubricPredictiveValidity
14
- } from "../chunk-S5YLIBFX.js";
15
- import {
16
- pearsonR,
17
- spearmanR
18
- } from "../chunk-MHELPNRP.js";
19
- import {
20
- aggregateLlm,
21
- llmSpans
22
- } from "../chunk-ZET2UAYW.js";
23
- import "../chunk-MA6HLL3S.js";
24
- import {
25
- ValidationError
26
- } from "../chunk-ONWEPEDO.js";
27
- import "../chunk-PZ5AY32C.js";
28
-
29
- // src/meta-eval/correlation-study.ts
1
+ import { s as ValidationError } from "../errors-8YnH8WlF.js";
2
+ import { A as spearmanR, E as pearsonR } from "../statistics-CnnxdpOg.js";
3
+ import { o as llmSpans, t as aggregateLlm } from "../query-Di7eEQ79.js";
4
+ import { t as analyzeSeries } from "../series-convergence-CjO2QdRW.js";
5
+ import { t as rubricPredictiveValidity } from "../rubric-predictive-validity-B3xmbmS1.js";
6
+ import { n as InMemoryOutcomeStore, t as FileSystemOutcomeStore } from "../outcome-store-ChBKlTd_.js";
7
+ import { n as calibrationFromPairs, t as calibrationCurve } from "../calibration-CNWWA6K8.js";
8
+ //#region src/meta-eval/correlation-study.ts
9
+ /**
10
+ * Correlation study — "does our eval score predict real-world outcomes?"
11
+ *
12
+ * This is the load-bearing signal. Takes a TraceStore + OutcomeStore,
13
+ * joins on runId, computes Pearson + Spearman + bootstrap CI for every
14
+ * (evalMetric, outcomeMetric) pair the caller declares.
15
+ *
16
+ * Without this number the framework is ornamental. With it and r > 0.6
17
+ * the framework is a moat — no other agent-eval tool publishes one.
18
+ */
30
19
  async function correlationStudy(traceStore, outcomeStore, evalMetrics, outcomeMetricNames, options = {}) {
31
- const runs = await traceStore.listRuns();
32
- const outcomes = await outcomeStore.list(options.outcomeFilter);
33
- const outcomesByRun = /* @__PURE__ */ new Map();
34
- for (const o of outcomes) {
35
- const arr = outcomesByRun.get(o.runId) ?? [];
36
- arr.push(o);
37
- outcomesByRun.set(o.runId, arr);
38
- }
39
- const reduction = options.reduction ?? "latest";
40
- const maxLag = options.maxCaptureLagMs ?? Infinity;
41
- const pairs = [];
42
- for (const em of evalMetrics) {
43
- for (const om of outcomeMetricNames) {
44
- pairs.push({ evalMetric: em.id, outcomeMetric: om, xs: [], ys: [] });
45
- }
46
- }
47
- let joined = 0;
48
- let skipped = 0;
49
- for (const run of runs) {
50
- const os = outcomesByRun.get(run.runId);
51
- if (!os || os.length === 0) {
52
- skipped++;
53
- continue;
54
- }
55
- const eligible = os.filter((o) => o.capturedAt - run.startedAt <= maxLag);
56
- if (eligible.length === 0) {
57
- skipped++;
58
- continue;
59
- }
60
- for (const em of evalMetrics) {
61
- const extract = em.extract ?? defaultExtract(em.id);
62
- const x = await extract(run, traceStore);
63
- if (x === null || !Number.isFinite(x)) continue;
64
- for (const om of outcomeMetricNames) {
65
- const values = eligible.map((o) => o.metrics[om]).filter((v) => typeof v === "number" && Number.isFinite(v));
66
- if (values.length === 0) continue;
67
- const y = reduce(values, reduction, eligible);
68
- if (y === null) continue;
69
- const pair = pairs.find((p) => p.evalMetric === em.id && p.outcomeMetric === om);
70
- pair.xs.push(x);
71
- pair.ys.push(y);
72
- }
73
- }
74
- joined++;
75
- }
76
- const results = pairs.filter((p) => p.xs.length >= 3).map((p) => {
77
- const pearson = pearsonR(p.xs, p.ys);
78
- const spearman = spearmanR(p.xs, p.ys);
79
- const pearsonCi95 = bootstrapPearsonCi(p.xs, p.ys, options.bootstrapIterations ?? 500);
80
- const verdict = Math.abs(pearson) >= 0.7 ? "strong" : Math.abs(pearson) >= 0.4 ? "moderate" : "weak";
81
- return {
82
- evalMetric: p.evalMetric,
83
- outcomeMetric: p.outcomeMetric,
84
- n: p.xs.length,
85
- pearson,
86
- spearman,
87
- pearsonCi95,
88
- verdict
89
- };
90
- });
91
- return { pairs: results, joinedSamples: joined, skippedRuns: skipped };
20
+ const runs = await traceStore.listRuns();
21
+ const outcomes = await outcomeStore.list(options.outcomeFilter);
22
+ const outcomesByRun = /* @__PURE__ */ new Map();
23
+ for (const o of outcomes) {
24
+ const arr = outcomesByRun.get(o.runId) ?? [];
25
+ arr.push(o);
26
+ outcomesByRun.set(o.runId, arr);
27
+ }
28
+ const reduction = options.reduction ?? "latest";
29
+ const maxLag = options.maxCaptureLagMs ?? Infinity;
30
+ const pairs = [];
31
+ for (const em of evalMetrics) for (const om of outcomeMetricNames) pairs.push({
32
+ evalMetric: em.id,
33
+ outcomeMetric: om,
34
+ xs: [],
35
+ ys: []
36
+ });
37
+ let joined = 0;
38
+ let skipped = 0;
39
+ for (const run of runs) {
40
+ const os = outcomesByRun.get(run.runId);
41
+ if (!os || os.length === 0) {
42
+ skipped++;
43
+ continue;
44
+ }
45
+ const eligible = os.filter((o) => o.capturedAt - run.startedAt <= maxLag);
46
+ if (eligible.length === 0) {
47
+ skipped++;
48
+ continue;
49
+ }
50
+ for (const em of evalMetrics) {
51
+ const x = await (em.extract ?? defaultExtract(em.id))(run, traceStore);
52
+ if (x === null || !Number.isFinite(x)) continue;
53
+ for (const om of outcomeMetricNames) {
54
+ const values = eligible.map((o) => o.metrics[om]).filter((v) => typeof v === "number" && Number.isFinite(v));
55
+ if (values.length === 0) continue;
56
+ const y = reduce(values, reduction, eligible);
57
+ if (y === null) continue;
58
+ const pair = pairs.find((p) => p.evalMetric === em.id && p.outcomeMetric === om);
59
+ pair.xs.push(x);
60
+ pair.ys.push(y);
61
+ }
62
+ }
63
+ joined++;
64
+ }
65
+ return {
66
+ pairs: pairs.filter((p) => p.xs.length >= 3).map((p) => {
67
+ const pearson = pearsonR(p.xs, p.ys);
68
+ const spearman = spearmanR(p.xs, p.ys);
69
+ const pearsonCi95 = bootstrapPearsonCi(p.xs, p.ys, options.bootstrapIterations ?? 500);
70
+ const verdict = Math.abs(pearson) >= .7 ? "strong" : Math.abs(pearson) >= .4 ? "moderate" : "weak";
71
+ return {
72
+ evalMetric: p.evalMetric,
73
+ outcomeMetric: p.outcomeMetric,
74
+ n: p.xs.length,
75
+ pearson,
76
+ spearman,
77
+ pearsonCi95,
78
+ verdict
79
+ };
80
+ }),
81
+ joinedSamples: joined,
82
+ skippedRuns: skipped
83
+ };
92
84
  }
93
85
  function reduce(values, kind, outcomes) {
94
- if (values.length === 0) return null;
95
- if (kind === "mean") return values.reduce((a, b) => a + b, 0) / values.length;
96
- if (kind === "max") return Math.max(...values);
97
- const latest = [...outcomes].sort((a, b) => b.capturedAt - a.capturedAt)[0];
98
- if (!latest) return null;
99
- const latestKey = Object.keys(latest.metrics)[0];
100
- const v = latestKey !== void 0 ? latest.metrics[latestKey] : void 0;
101
- const paired = outcomes.map((o) => {
102
- const k = Object.keys(o.metrics)[0];
103
- return {
104
- at: o.capturedAt,
105
- v: k !== void 0 ? values.find((x) => o.metrics[k] === x) : void 0
106
- };
107
- }).filter((p) => p.v !== void 0);
108
- if (paired.length === 0) return v ?? null;
109
- return paired.sort((a, b) => b.at - a.at)[0]?.v ?? null;
86
+ if (values.length === 0) return null;
87
+ if (kind === "mean") return values.reduce((a, b) => a + b, 0) / values.length;
88
+ if (kind === "max") return Math.max(...values);
89
+ const latest = [...outcomes].sort((a, b) => b.capturedAt - a.capturedAt)[0];
90
+ if (!latest) return null;
91
+ const latestKey = Object.keys(latest.metrics)[0];
92
+ const v = latestKey !== void 0 ? latest.metrics[latestKey] : void 0;
93
+ const paired = outcomes.map((o) => {
94
+ const k = Object.keys(o.metrics)[0];
95
+ return {
96
+ at: o.capturedAt,
97
+ v: k !== void 0 ? values.find((x) => o.metrics[k] === x) : void 0
98
+ };
99
+ }).filter((p) => p.v !== void 0);
100
+ if (paired.length === 0) return v ?? null;
101
+ return paired.sort((a, b) => b.at - a.at)[0]?.v ?? null;
110
102
  }
111
103
  function bootstrapPearsonCi(xs, ys, iterations) {
112
- const n = xs.length;
113
- if (n < 3) return { lower: NaN, upper: NaN };
114
- const rs = [];
115
- for (let b = 0; b < iterations; b++) {
116
- const rx = new Array(n);
117
- const ry = new Array(n);
118
- for (let i = 0; i < n; i++) {
119
- const idx = Math.floor(Math.random() * n);
120
- rx[i] = xs[idx];
121
- ry[i] = ys[idx];
122
- }
123
- const r = pearsonR(rx, ry);
124
- if (Number.isFinite(r)) rs.push(r);
125
- }
126
- rs.sort((a, b) => a - b);
127
- if (rs.length === 0) return { lower: NaN, upper: NaN };
128
- return {
129
- lower: rs[Math.floor(0.025 * rs.length)],
130
- upper: rs[Math.min(rs.length - 1, Math.floor(0.975 * rs.length))]
131
- };
104
+ const n = xs.length;
105
+ if (n < 3) return {
106
+ lower: NaN,
107
+ upper: NaN
108
+ };
109
+ const rs = [];
110
+ for (let b = 0; b < iterations; b++) {
111
+ const rx = new Array(n);
112
+ const ry = new Array(n);
113
+ for (let i = 0; i < n; i++) {
114
+ const idx = Math.floor(Math.random() * n);
115
+ rx[i] = xs[idx];
116
+ ry[i] = ys[idx];
117
+ }
118
+ const r = pearsonR(rx, ry);
119
+ if (Number.isFinite(r)) rs.push(r);
120
+ }
121
+ rs.sort((a, b) => a - b);
122
+ if (rs.length === 0) return {
123
+ lower: NaN,
124
+ upper: NaN
125
+ };
126
+ return {
127
+ lower: rs[Math.floor(.025 * rs.length)],
128
+ upper: rs[Math.min(rs.length - 1, Math.floor(.975 * rs.length))]
129
+ };
132
130
  }
133
131
  function defaultExtract(metric) {
134
- return async (run, store) => {
135
- switch (metric) {
136
- case "score":
137
- case "overallScore":
138
- return run.outcome?.score ?? null;
139
- case "pass":
140
- return run.outcome?.pass === true ? 1 : 0;
141
- case "durationMs":
142
- return run.endedAt && run.startedAt ? run.endedAt - run.startedAt : null;
143
- case "costUsd": {
144
- const llm = await llmSpans(store, run.runId);
145
- return aggregateLlm(llm).costUsd;
146
- }
147
- case "inputTokens": {
148
- const llm = await llmSpans(store, run.runId);
149
- return aggregateLlm(llm).inputTokens;
150
- }
151
- default:
152
- return null;
153
- }
154
- };
132
+ return async (run, store) => {
133
+ switch (metric) {
134
+ case "score":
135
+ case "overallScore": return run.outcome?.score ?? null;
136
+ case "pass": return run.outcome?.pass === true ? 1 : 0;
137
+ case "durationMs": return run.endedAt && run.startedAt ? run.endedAt - run.startedAt : null;
138
+ case "costUsd": return aggregateLlm(await llmSpans(store, run.runId)).costUsd;
139
+ case "inputTokens": return aggregateLlm(await llmSpans(store, run.runId)).inputTokens;
140
+ default: return null;
141
+ }
142
+ };
155
143
  }
156
-
157
- // src/meta-eval/sentinel.ts
158
- var SENTINEL_METRIC_NAMES = ["irr", "calibrationKappa", "sentinelPassRate"];
144
+ //#endregion
145
+ //#region src/meta-eval/sentinel.ts
146
+ /**
147
+ * Judge sentinel — eval trustworthiness as a continuously measured,
148
+ * alarmed trend.
149
+ *
150
+ * Judges are models; models change underneath us; calibration decays.
151
+ * This module composes three existing instruments into one loop:
152
+ *
153
+ * snapshot — adapters turn real instrument outputs (`calibrateJudge` /
154
+ * `calibrateJudgeContinuous`, `corpusInterRaterAgreement` /
155
+ * `continuousAgreement`, a rerun sentinel golden set) into
156
+ * `SentinelSnapshot`s
157
+ * series — `analyzeSeries` (src/series-convergence) classifies each
158
+ * judge×metric history as stabilized / drifting / noisy
159
+ * alarm — `judgeSentinelReport` turns trends + thresholds into named
160
+ * alarms; `evalHealthStamp` is the tiny object a campaign
161
+ * attaches to its verdicts
162
+ *
163
+ * Alarm conditions:
164
+ * - convergence state `drifting-down` on any tracked metric
165
+ * - irr below `minIrr`
166
+ * - calibrationKappa / sentinelPassRate dropped vs the series baseline
167
+ * beyond `maxKappaDrop` / `maxSentinelDrop`
168
+ * - judge model changed with no post-change golden-grounded snapshot
169
+ * (the silent-upgrade trap: judges agreeing with each other after a
170
+ * model swap proves nothing — only re-measuring against gold does)
171
+ * - newest snapshot older than `staleAfterDays` relative to `asOf`
172
+ *
173
+ * Wire-in: run the snapshot adapters from a post-campaign hook or a
174
+ * nightly job, append to a `SentinelStore`, then compute
175
+ * `judgeSentinelReport(await store.history(), { asOf })` with `asOf` =
176
+ * the campaign timestamp. Attach `evalHealthStamp(report)` to campaign
177
+ * verdicts: an alarmed sentinel means every downstream verdict carries
178
+ * an integrity warning until the judge is recalibrated.
179
+ *
180
+ * The module is clock-free — every timestamp (`at`, `asOf`) is
181
+ * caller-supplied ISO-8601, so reports are reproducible.
182
+ */
183
+ const SENTINEL_METRIC_NAMES = [
184
+ "irr",
185
+ "calibrationKappa",
186
+ "sentinelPassRate"
187
+ ];
159
188
  function parseIso(value, label) {
160
- const ms = typeof value === "string" ? Date.parse(value) : NaN;
161
- if (!Number.isFinite(ms)) {
162
- throw new ValidationError(
163
- `judge-sentinel: ${label} is not a parseable ISO timestamp: ${JSON.stringify(value)}`
164
- );
165
- }
166
- return ms;
189
+ const ms = typeof value === "string" ? Date.parse(value) : NaN;
190
+ if (!Number.isFinite(ms)) throw new ValidationError(`judge-sentinel: ${label} is not a parseable ISO timestamp: ${JSON.stringify(value)}`);
191
+ return ms;
167
192
  }
193
+ /** Shape guard for snapshots crossing a boundary (store append, JSONL load, report input). */
168
194
  function validateSentinelSnapshot(snapshot, source = "snapshot") {
169
- parseIso(snapshot.at, `${source}.at`);
170
- if (typeof snapshot.judgeId !== "string" || snapshot.judgeId.length === 0) {
171
- throw new ValidationError(`judge-sentinel: ${source}.judgeId must be a non-empty string`);
172
- }
173
- if (typeof snapshot.judgeModel !== "string" || snapshot.judgeModel.length === 0) {
174
- throw new ValidationError(`judge-sentinel: ${source}.judgeModel must be a non-empty string`);
175
- }
176
- if (snapshot.metrics === null || typeof snapshot.metrics !== "object") {
177
- throw new ValidationError(`judge-sentinel: ${source}.metrics must be an object (may be empty)`);
178
- }
179
- for (const [key, value] of Object.entries(snapshot.metrics)) {
180
- if (!SENTINEL_METRIC_NAMES.includes(key)) {
181
- throw new ValidationError(
182
- `judge-sentinel: ${source}.metrics carries unknown key "${key}" \u2014 known: ${SENTINEL_METRIC_NAMES.join(", ")}`
183
- );
184
- }
185
- if (value !== void 0 && !Number.isFinite(value)) {
186
- throw new ValidationError(
187
- `judge-sentinel: ${source}.metrics.${key} is not a finite number: ${String(value)}`
188
- );
189
- }
190
- }
195
+ parseIso(snapshot.at, `${source}.at`);
196
+ if (typeof snapshot.judgeId !== "string" || snapshot.judgeId.length === 0) throw new ValidationError(`judge-sentinel: ${source}.judgeId must be a non-empty string`);
197
+ if (typeof snapshot.judgeModel !== "string" || snapshot.judgeModel.length === 0) throw new ValidationError(`judge-sentinel: ${source}.judgeModel must be a non-empty string`);
198
+ if (snapshot.metrics === null || typeof snapshot.metrics !== "object") throw new ValidationError(`judge-sentinel: ${source}.metrics must be an object (may be empty)`);
199
+ for (const [key, value] of Object.entries(snapshot.metrics)) {
200
+ if (!SENTINEL_METRIC_NAMES.includes(key)) throw new ValidationError(`judge-sentinel: ${source}.metrics carries unknown key "${key}" — known: ${SENTINEL_METRIC_NAMES.join(", ")}`);
201
+ if (value !== void 0 && !Number.isFinite(value)) throw new ValidationError(`judge-sentinel: ${source}.metrics.${key} is not a finite number: ${String(value)}`);
202
+ }
191
203
  }
204
+ /**
205
+ * From `calibrateJudge` / `calibrateJudgeContinuous` output. Prefers the
206
+ * un-rounded continuous κ_w when the report carries one (integer κ
207
+ * discards information for [0,1] judges).
208
+ */
192
209
  function snapshotFromCalibration(report, meta) {
193
- const kappa = "weightedKappaContinuous" in report ? report.weightedKappaContinuous : report.kappa;
194
- if (!Number.isFinite(kappa)) {
195
- throw new ValidationError(
196
- `snapshotFromCalibration: \u03BA is not finite (n=${report.n}) \u2014 calibrate against \u22652 joined golden items before snapshotting`
197
- );
198
- }
199
- const snapshot = { ...meta, metrics: { calibrationKappa: kappa } };
200
- validateSentinelSnapshot(snapshot);
201
- return snapshot;
210
+ const kappa = "weightedKappaContinuous" in report ? report.weightedKappaContinuous : report.kappa;
211
+ if (!Number.isFinite(kappa)) throw new ValidationError(`snapshotFromCalibration: κ is not finite (n=${report.n}) — calibrate against ≥2 joined golden items before snapshotting`);
212
+ const snapshot = {
213
+ ...meta,
214
+ metrics: { calibrationKappa: kappa }
215
+ };
216
+ validateSentinelSnapshot(snapshot);
217
+ return snapshot;
202
218
  }
219
+ /**
220
+ * From `corpusInterRaterAgreement` (statistics.ts) or `continuousAgreement`
221
+ * (judge-calibration.ts) output. IRR = ICC(2,1) — the reliability
222
+ * coefficient both instruments compute. For ensemble-level agreement,
223
+ * `meta.judgeId` names the ensemble and `meta.judgeModel` pins its
224
+ * composition (e.g. a joined list of member model strings).
225
+ */
203
226
  function snapshotFromAgreement(report, meta) {
204
- const irr = "overallIcc" in report ? report.overallIcc : report.icc;
205
- if (!Number.isFinite(irr)) {
206
- throw new ValidationError(
207
- "snapshotFromAgreement: ICC is not finite \u2014 agreement needs \u22652 raters and \u22652 complete items"
208
- );
209
- }
210
- const snapshot = { ...meta, metrics: { irr } };
211
- validateSentinelSnapshot(snapshot);
212
- return snapshot;
227
+ const irr = "overallIcc" in report ? report.overallIcc : report.icc;
228
+ if (!Number.isFinite(irr)) throw new ValidationError("snapshotFromAgreement: ICC is not finite — agreement needs ≥2 raters and ≥2 complete items");
229
+ const snapshot = {
230
+ ...meta,
231
+ metrics: { irr }
232
+ };
233
+ validateSentinelSnapshot(snapshot);
234
+ return snapshot;
213
235
  }
236
+ /**
237
+ * From a rerun of a fixed sentinel golden set: the same `GoldenItem`s the
238
+ * judge was originally calibrated on, re-scored periodically. Pass rate =
239
+ * fraction of joined items where the judge stays within `tolerance` of the
240
+ * human score. Items the judge didn't score are excluded from the
241
+ * denominator; zero joined items is an error, not a 0% pass rate.
242
+ */
214
243
  function snapshotFromSentinelSet(scores, golden, meta, options = {}) {
215
- const tolerance = options.tolerance ?? 0.1;
216
- if (!Number.isFinite(tolerance) || tolerance < 0) {
217
- throw new ValidationError(
218
- `snapshotFromSentinelSet: tolerance must be a finite number \u2265 0, got ${tolerance}`
219
- );
220
- }
221
- const goldenById = /* @__PURE__ */ new Map();
222
- for (const item of golden) {
223
- if (!Number.isFinite(item.humanScore)) {
224
- throw new ValidationError(
225
- `snapshotFromSentinelSet: golden item "${item.itemId}" has a non-finite humanScore`
226
- );
227
- }
228
- if (goldenById.has(item.itemId)) {
229
- throw new ValidationError(`snapshotFromSentinelSet: duplicate golden itemId "${item.itemId}"`);
230
- }
231
- goldenById.set(item.itemId, item.humanScore);
232
- }
233
- let joined = 0;
234
- let passed = 0;
235
- for (const s of scores) {
236
- const human = goldenById.get(s.itemId);
237
- if (human === void 0) continue;
238
- if (!Number.isFinite(s.score)) {
239
- throw new ValidationError(
240
- `snapshotFromSentinelSet: judge score for item "${s.itemId}" is not finite`
241
- );
242
- }
243
- joined++;
244
- if (Math.abs(s.score - human) <= tolerance) passed++;
245
- }
246
- if (joined === 0) {
247
- throw new ValidationError(
248
- "snapshotFromSentinelSet: no judge scores joined the golden set \u2014 itemIds mismatch or empty sentinel run"
249
- );
250
- }
251
- const snapshot = { ...meta, metrics: { sentinelPassRate: passed / joined } };
252
- validateSentinelSnapshot(snapshot);
253
- return snapshot;
244
+ const tolerance = options.tolerance ?? .1;
245
+ if (!Number.isFinite(tolerance) || tolerance < 0) throw new ValidationError(`snapshotFromSentinelSet: tolerance must be a finite number ≥ 0, got ${tolerance}`);
246
+ const goldenById = /* @__PURE__ */ new Map();
247
+ for (const item of golden) {
248
+ if (!Number.isFinite(item.humanScore)) throw new ValidationError(`snapshotFromSentinelSet: golden item "${item.itemId}" has a non-finite humanScore`);
249
+ if (goldenById.has(item.itemId)) throw new ValidationError(`snapshotFromSentinelSet: duplicate golden itemId "${item.itemId}"`);
250
+ goldenById.set(item.itemId, item.humanScore);
251
+ }
252
+ let joined = 0;
253
+ let passed = 0;
254
+ for (const s of scores) {
255
+ const human = goldenById.get(s.itemId);
256
+ if (human === void 0) continue;
257
+ if (!Number.isFinite(s.score)) throw new ValidationError(`snapshotFromSentinelSet: judge score for item "${s.itemId}" is not finite`);
258
+ joined++;
259
+ if (Math.abs(s.score - human) <= tolerance) passed++;
260
+ }
261
+ if (joined === 0) throw new ValidationError("snapshotFromSentinelSet: no judge scores joined the golden set — itemIds mismatch or empty sentinel run");
262
+ const snapshot = {
263
+ ...meta,
264
+ metrics: { sentinelPassRate: passed / joined }
265
+ };
266
+ validateSentinelSnapshot(snapshot);
267
+ return snapshot;
254
268
  }
255
269
  function inMemorySentinelStore(initial = []) {
256
- for (const s of initial) validateSentinelSnapshot(s);
257
- const items = initial.map((s) => ({ ...s, metrics: { ...s.metrics } }));
258
- return {
259
- async append(snapshot) {
260
- validateSentinelSnapshot(snapshot);
261
- items.push({ ...snapshot, metrics: { ...snapshot.metrics } });
262
- },
263
- async history(judgeId) {
264
- const all = items.map((s) => ({ ...s, metrics: { ...s.metrics } }));
265
- return judgeId === void 0 ? all : all.filter((s) => s.judgeId === judgeId);
266
- }
267
- };
270
+ for (const s of initial) validateSentinelSnapshot(s);
271
+ const items = initial.map((s) => ({
272
+ ...s,
273
+ metrics: { ...s.metrics }
274
+ }));
275
+ return {
276
+ async append(snapshot) {
277
+ validateSentinelSnapshot(snapshot);
278
+ items.push({
279
+ ...snapshot,
280
+ metrics: { ...snapshot.metrics }
281
+ });
282
+ },
283
+ async history(judgeId) {
284
+ const all = items.map((s) => ({
285
+ ...s,
286
+ metrics: { ...s.metrics }
287
+ }));
288
+ return judgeId === void 0 ? all : all.filter((s) => s.judgeId === judgeId);
289
+ }
290
+ };
268
291
  }
292
+ /**
293
+ * JSONL store — one snapshot per line, appended atomically per call.
294
+ * A corrupt or shape-invalid line is a loud error naming the file and
295
+ * line number: a sentinel history that silently drops records would
296
+ * defeat the drift detection it exists to provide.
297
+ */
269
298
  function fileSentinelStore(path) {
270
- return {
271
- async append(snapshot) {
272
- validateSentinelSnapshot(snapshot);
273
- const fs = await import("fs/promises");
274
- const pathMod = await import("path");
275
- await fs.mkdir(pathMod.dirname(path), { recursive: true });
276
- await fs.appendFile(path, `${JSON.stringify(snapshot)}
277
- `, "utf8");
278
- },
279
- async history(judgeId) {
280
- const fs = await import("fs/promises");
281
- let raw;
282
- try {
283
- raw = await fs.readFile(path, "utf8");
284
- } catch (err) {
285
- if (err.code === "ENOENT") return [];
286
- throw err;
287
- }
288
- const lines = raw.split("\n");
289
- const snapshots = [];
290
- for (let i = 0; i < lines.length; i++) {
291
- const line = lines[i];
292
- if (line.trim().length === 0) continue;
293
- let parsed;
294
- try {
295
- parsed = JSON.parse(line);
296
- } catch (err) {
297
- throw new ValidationError(
298
- `judge-sentinel: store at ${path} has a corrupt JSONL line ${i + 1}: ${err.message}`
299
- );
300
- }
301
- const snapshot = parsed;
302
- validateSentinelSnapshot(snapshot, `${path}:${i + 1}`);
303
- snapshots.push(snapshot);
304
- }
305
- return judgeId === void 0 ? snapshots : snapshots.filter((s) => s.judgeId === judgeId);
306
- }
307
- };
299
+ return {
300
+ async append(snapshot) {
301
+ validateSentinelSnapshot(snapshot);
302
+ const fs = await import("node:fs/promises");
303
+ const pathMod = await import("node:path");
304
+ await fs.mkdir(pathMod.dirname(path), { recursive: true });
305
+ await fs.appendFile(path, `${JSON.stringify(snapshot)}\n`, "utf8");
306
+ },
307
+ async history(judgeId) {
308
+ const fs = await import("node:fs/promises");
309
+ let raw;
310
+ try {
311
+ raw = await fs.readFile(path, "utf8");
312
+ } catch (err) {
313
+ if (err.code === "ENOENT") return [];
314
+ throw err;
315
+ }
316
+ const lines = raw.split("\n");
317
+ const snapshots = [];
318
+ for (let i = 0; i < lines.length; i++) {
319
+ const line = lines[i];
320
+ if (line.trim().length === 0) continue;
321
+ let parsed;
322
+ try {
323
+ parsed = JSON.parse(line);
324
+ } catch (err) {
325
+ throw new ValidationError(`judge-sentinel: store at ${path} has a corrupt JSONL line ${i + 1}: ${err.message}`);
326
+ }
327
+ const snapshot = parsed;
328
+ validateSentinelSnapshot(snapshot, `${path}:${i + 1}`);
329
+ snapshots.push(snapshot);
330
+ }
331
+ return judgeId === void 0 ? snapshots : snapshots.filter((s) => s.judgeId === judgeId);
332
+ }
333
+ };
308
334
  }
309
- var MS_PER_DAY = 864e5;
335
+ const MS_PER_DAY = 864e5;
310
336
  function judgeSentinelReport(history, opts) {
311
- const asOfMs = parseIso(opts.asOf, "asOf");
312
- const minIrr = opts.thresholds?.minIrr ?? 0.6;
313
- const maxKappaDrop = opts.thresholds?.maxKappaDrop ?? 0.15;
314
- const maxSentinelDrop = opts.thresholds?.maxSentinelDrop ?? 0.1;
315
- const staleAfterDays = opts.thresholds?.staleAfterDays ?? 30;
316
- const byJudge = /* @__PURE__ */ new Map();
317
- for (const snapshot of history) {
318
- validateSentinelSnapshot(snapshot);
319
- const atMs = parseIso(snapshot.at, `snapshot.at (judge "${snapshot.judgeId}")`);
320
- const arr = byJudge.get(snapshot.judgeId) ?? [];
321
- arr.push({ ...snapshot, atMs });
322
- byJudge.set(snapshot.judgeId, arr);
323
- }
324
- const perJudge = [];
325
- const alarms = [];
326
- const insufficientHistory = [];
327
- for (const judgeId of [...byJudge.keys()].sort()) {
328
- const snaps = byJudge.get(judgeId).sort((a, b) => a.atMs - b.atMs);
329
- const newest = snaps[snaps.length - 1];
330
- const ageDays = (asOfMs - newest.atMs) / MS_PER_DAY;
331
- if (ageDays > staleAfterDays) {
332
- alarms.push(
333
- `judge "${judgeId}": stale \u2014 newest snapshot ${newest.at} is ${ageDays.toFixed(1)}d old vs asOf (limit ${staleAfterDays}d)`
334
- );
335
- }
336
- let changeIdx = -1;
337
- for (let i = 1; i < snaps.length; i++) {
338
- if (snaps[i].judgeModel !== snaps[i - 1].judgeModel) changeIdx = i;
339
- }
340
- if (changeIdx >= 0) {
341
- const recalibrated = snaps.slice(changeIdx).some(
342
- (s) => Number.isFinite(s.metrics.calibrationKappa) || Number.isFinite(s.metrics.sentinelPassRate)
343
- );
344
- if (!recalibrated) {
345
- alarms.push(
346
- `judge "${judgeId}": model changed "${snaps[changeIdx - 1].judgeModel}" \u2192 "${snaps[changeIdx].judgeModel}" at ${snaps[changeIdx].at} with no post-change calibration snapshot \u2014 silent-upgrade trap; rerun calibrateJudge or the sentinel set against the new model`
347
- );
348
- }
349
- }
350
- for (const metric of SENTINEL_METRIC_NAMES) {
351
- const values = snaps.filter((s) => typeof s.metrics[metric] === "number").map((s) => s.metrics[metric]);
352
- if (values.length === 0) continue;
353
- const convergence = analyzeSeries(values, opts.convergence);
354
- if (convergence.state === "insufficient-data")
355
- insufficientHistory.push(`${judgeId}:${metric}`);
356
- const current = values[values.length - 1];
357
- const baseline = values[0];
358
- const drift = current - baseline;
359
- const reasons = [];
360
- if (convergence.state === "drifting-down") {
361
- reasons.push(
362
- `convergence state drifting-down (tail run ${convergence.tailRun}, window mean ${convergence.windowMean.toFixed(3)})`
363
- );
364
- }
365
- if (metric === "irr" && current < minIrr) {
366
- reasons.push(`irr ${current.toFixed(3)} below floor ${minIrr}`);
367
- }
368
- if (metric === "calibrationKappa" && baseline - current > maxKappaDrop) {
369
- reasons.push(
370
- `calibrationKappa dropped ${(baseline - current).toFixed(3)} from baseline ${baseline.toFixed(3)} (limit ${maxKappaDrop})`
371
- );
372
- }
373
- if (metric === "sentinelPassRate" && baseline - current > maxSentinelDrop) {
374
- reasons.push(
375
- `sentinelPassRate dropped ${(baseline - current).toFixed(3)} from baseline ${baseline.toFixed(3)} (limit ${maxSentinelDrop})`
376
- );
377
- }
378
- const alarmed = reasons.length > 0;
379
- const trend = {
380
- judgeId,
381
- metric,
382
- state: convergence.state,
383
- current,
384
- baseline,
385
- drift,
386
- alarmed
387
- };
388
- if (alarmed) {
389
- trend.reason = reasons.join("; ");
390
- alarms.push(`judge "${judgeId}" ${metric}: ${trend.reason}`);
391
- }
392
- perJudge.push(trend);
393
- }
394
- }
395
- return { perJudge, alarms, healthy: alarms.length === 0, insufficientHistory };
337
+ const asOfMs = parseIso(opts.asOf, "asOf");
338
+ const minIrr = opts.thresholds?.minIrr ?? .6;
339
+ const maxKappaDrop = opts.thresholds?.maxKappaDrop ?? .15;
340
+ const maxSentinelDrop = opts.thresholds?.maxSentinelDrop ?? .1;
341
+ const staleAfterDays = opts.thresholds?.staleAfterDays ?? 30;
342
+ const byJudge = /* @__PURE__ */ new Map();
343
+ for (const snapshot of history) {
344
+ validateSentinelSnapshot(snapshot);
345
+ const atMs = parseIso(snapshot.at, `snapshot.at (judge "${snapshot.judgeId}")`);
346
+ const arr = byJudge.get(snapshot.judgeId) ?? [];
347
+ arr.push({
348
+ ...snapshot,
349
+ atMs
350
+ });
351
+ byJudge.set(snapshot.judgeId, arr);
352
+ }
353
+ const perJudge = [];
354
+ const alarms = [];
355
+ const insufficientHistory = [];
356
+ for (const judgeId of [...byJudge.keys()].sort()) {
357
+ const snaps = byJudge.get(judgeId).sort((a, b) => a.atMs - b.atMs);
358
+ const newest = snaps[snaps.length - 1];
359
+ const ageDays = (asOfMs - newest.atMs) / MS_PER_DAY;
360
+ if (ageDays > staleAfterDays) alarms.push(`judge "${judgeId}": stale — newest snapshot ${newest.at} is ${ageDays.toFixed(1)}d old vs asOf (limit ${staleAfterDays}d)`);
361
+ let changeIdx = -1;
362
+ for (let i = 1; i < snaps.length; i++) if (snaps[i].judgeModel !== snaps[i - 1].judgeModel) changeIdx = i;
363
+ if (changeIdx >= 0) {
364
+ if (!snaps.slice(changeIdx).some((s) => Number.isFinite(s.metrics.calibrationKappa) || Number.isFinite(s.metrics.sentinelPassRate))) alarms.push(`judge "${judgeId}": model changed "${snaps[changeIdx - 1].judgeModel}" → "${snaps[changeIdx].judgeModel}" at ${snaps[changeIdx].at} with no post-change calibration snapshot — silent-upgrade trap; rerun calibrateJudge or the sentinel set against the new model`);
365
+ }
366
+ for (const metric of SENTINEL_METRIC_NAMES) {
367
+ const values = snaps.filter((s) => typeof s.metrics[metric] === "number").map((s) => s.metrics[metric]);
368
+ if (values.length === 0) continue;
369
+ const convergence = analyzeSeries(values, opts.convergence);
370
+ if (convergence.state === "insufficient-data") insufficientHistory.push(`${judgeId}:${metric}`);
371
+ const current = values[values.length - 1];
372
+ const baseline = values[0];
373
+ const drift = current - baseline;
374
+ const reasons = [];
375
+ if (convergence.state === "drifting-down") reasons.push(`convergence state drifting-down (tail run ${convergence.tailRun}, window mean ${convergence.windowMean.toFixed(3)})`);
376
+ if (metric === "irr" && current < minIrr) reasons.push(`irr ${current.toFixed(3)} below floor ${minIrr}`);
377
+ if (metric === "calibrationKappa" && baseline - current > maxKappaDrop) reasons.push(`calibrationKappa dropped ${(baseline - current).toFixed(3)} from baseline ${baseline.toFixed(3)} (limit ${maxKappaDrop})`);
378
+ if (metric === "sentinelPassRate" && baseline - current > maxSentinelDrop) reasons.push(`sentinelPassRate dropped ${(baseline - current).toFixed(3)} from baseline ${baseline.toFixed(3)} (limit ${maxSentinelDrop})`);
379
+ const alarmed = reasons.length > 0;
380
+ const trend = {
381
+ judgeId,
382
+ metric,
383
+ state: convergence.state,
384
+ current,
385
+ baseline,
386
+ drift,
387
+ alarmed
388
+ };
389
+ if (alarmed) {
390
+ trend.reason = reasons.join("; ");
391
+ alarms.push(`judge "${judgeId}" ${metric}: ${trend.reason}`);
392
+ }
393
+ perJudge.push(trend);
394
+ }
395
+ }
396
+ return {
397
+ perJudge,
398
+ alarms,
399
+ healthy: alarms.length === 0,
400
+ insufficientHistory
401
+ };
396
402
  }
403
+ /**
404
+ * The object a campaign attaches to its verdicts. Compute it from the
405
+ * sentinel report in a post-campaign hook (or a nightly job feeding the
406
+ * next day's campaigns) and store it alongside the verdict payload.
407
+ * `healthy: false` means the judges that produced those verdicts have an
408
+ * unresolved drift / decay / silent-upgrade / staleness alarm — treat the
409
+ * verdicts as carrying an integrity warning until recalibration clears it.
410
+ */
397
411
  function evalHealthStamp(report) {
398
- return { healthy: report.healthy, alarms: [...report.alarms] };
412
+ return {
413
+ healthy: report.healthy,
414
+ alarms: [...report.alarms]
415
+ };
399
416
  }
400
- export {
401
- FileSystemOutcomeStore,
402
- InMemoryOutcomeStore,
403
- SENTINEL_METRIC_NAMES,
404
- calibrationCurve,
405
- calibrationFromPairs,
406
- correlationStudy,
407
- evalHealthStamp,
408
- fileSentinelStore,
409
- inMemorySentinelStore,
410
- judgeSentinelReport,
411
- rubricPredictiveValidity,
412
- snapshotFromAgreement,
413
- snapshotFromCalibration,
414
- snapshotFromSentinelSet,
415
- validateSentinelSnapshot
416
- };
417
+ //#endregion
418
+ export { FileSystemOutcomeStore, InMemoryOutcomeStore, SENTINEL_METRIC_NAMES, calibrationCurve, calibrationFromPairs, correlationStudy, evalHealthStamp, fileSentinelStore, inMemorySentinelStore, judgeSentinelReport, rubricPredictiveValidity, snapshotFromAgreement, snapshotFromCalibration, snapshotFromSentinelSet, validateSentinelSnapshot };
419
+
417
420
  //# sourceMappingURL=index.js.map