@tangle-network/agent-eval 0.129.0 → 0.130.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -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-BJgDGkAD.js +754 -0
  36. package/dist/benchmarks-BJgDGkAD.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-aKJt6emI.js +3886 -0
  46. package/dist/campaign-aKJt6emI.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-CD_WZ_Xr.d.ts +2250 -0
  116. package/dist/index-CD_WZ_Xr.d.ts.map +1 -0
  117. package/dist/index-DSC51roc.d.ts +102 -0
  118. package/dist/index-DSC51roc.d.ts.map +1 -0
  119. package/dist/index-Em67JBjs.d.ts +335 -0
  120. package/dist/index-Em67JBjs.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-CUmHkGbI.js +7718 -0
  253. package/dist/skillopt-optimization-method-CUmHkGbI.js.map +1 -0
  254. package/dist/skillopt-optimization-method-CWKVTnks.d.ts +1740 -0
  255. package/dist/skillopt-optimization-method-CWKVTnks.d.ts.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/docs/campaign-proposers.md +1 -0
  301. package/package.json +17 -9
  302. package/dist/benchmarks/index.js.map +0 -1
  303. package/dist/campaign/index.js.map +0 -1
  304. package/dist/chunk-2QU3YOPR.js +0 -7374
  305. package/dist/chunk-2QU3YOPR.js.map +0 -1
  306. package/dist/chunk-3OCR4R5I.js +0 -728
  307. package/dist/chunk-3OCR4R5I.js.map +0 -1
  308. package/dist/chunk-3RF76KTD.js +0 -84
  309. package/dist/chunk-3RF76KTD.js.map +0 -1
  310. package/dist/chunk-56TAVBOK.js +0 -698
  311. package/dist/chunk-5DTSBUL2.js +0 -159
  312. package/dist/chunk-5DTSBUL2.js.map +0 -1
  313. package/dist/chunk-7FO3TNPI.js +0 -232
  314. package/dist/chunk-7FO3TNPI.js.map +0 -1
  315. package/dist/chunk-7ZZMD7UK.js +0 -386
  316. package/dist/chunk-7ZZMD7UK.js.map +0 -1
  317. package/dist/chunk-BOD4O7OF.js +0 -40
  318. package/dist/chunk-BOD4O7OF.js.map +0 -1
  319. package/dist/chunk-BSO5JDQH.js +0 -2335
  320. package/dist/chunk-BSO5JDQH.js.map +0 -1
  321. package/dist/chunk-C6LXANRU.js +0 -1550
  322. package/dist/chunk-C6LXANRU.js.map +0 -1
  323. package/dist/chunk-DODXQREJ.js +0 -752
  324. package/dist/chunk-DODXQREJ.js.map +0 -1
  325. package/dist/chunk-DRYIUNWY.js +0 -622
  326. package/dist/chunk-DRYIUNWY.js.map +0 -1
  327. package/dist/chunk-E7QXT7SX.js +0 -183
  328. package/dist/chunk-E7QXT7SX.js.map +0 -1
  329. package/dist/chunk-EG66UGL4.js +0 -341
  330. package/dist/chunk-EG66UGL4.js.map +0 -1
  331. package/dist/chunk-FXTVJPYD.js +0 -576
  332. package/dist/chunk-FXTVJPYD.js.map +0 -1
  333. package/dist/chunk-G7MGMCZD.js +0 -153
  334. package/dist/chunk-G7MGMCZD.js.map +0 -1
  335. package/dist/chunk-GGE4NNQT.js +0 -65
  336. package/dist/chunk-GGE4NNQT.js.map +0 -1
  337. package/dist/chunk-H23X7XKK.js +0 -181
  338. package/dist/chunk-H23X7XKK.js.map +0 -1
  339. package/dist/chunk-HHWE3POT.js +0 -94
  340. package/dist/chunk-HHWE3POT.js.map +0 -1
  341. package/dist/chunk-HPWUNB47.js +0 -289
  342. package/dist/chunk-HPWUNB47.js.map +0 -1
  343. package/dist/chunk-IYCLP2N2.js +0 -766
  344. package/dist/chunk-IYCLP2N2.js.map +0 -1
  345. package/dist/chunk-JHCHEVET.js +0 -274
  346. package/dist/chunk-JHCHEVET.js.map +0 -1
  347. package/dist/chunk-JQSF5DQT.js +0 -701
  348. package/dist/chunk-JQSF5DQT.js.map +0 -1
  349. package/dist/chunk-K4DBDHLK.js +0 -158
  350. package/dist/chunk-K4DBDHLK.js.map +0 -1
  351. package/dist/chunk-K6N6XJJX.js +0 -306
  352. package/dist/chunk-K6N6XJJX.js.map +0 -1
  353. package/dist/chunk-M4YBQKIJ.js +0 -1040
  354. package/dist/chunk-M4YBQKIJ.js.map +0 -1
  355. package/dist/chunk-MA6HLL3S.js +0 -65
  356. package/dist/chunk-MA6HLL3S.js.map +0 -1
  357. package/dist/chunk-MAZ26DC7.js +0 -99
  358. package/dist/chunk-MAZ26DC7.js.map +0 -1
  359. package/dist/chunk-NPCTHQIO.js +0 -91
  360. package/dist/chunk-NPCTHQIO.js.map +0 -1
  361. package/dist/chunk-NY44NC4A.js +0 -1056
  362. package/dist/chunk-NY44NC4A.js.map +0 -1
  363. package/dist/chunk-OIUOT4QD.js +0 -44
  364. package/dist/chunk-OIUOT4QD.js.map +0 -1
  365. package/dist/chunk-ONWEPEDO.js +0 -57
  366. package/dist/chunk-ONWEPEDO.js.map +0 -1
  367. package/dist/chunk-OWN5NPMC.js +0 -152
  368. package/dist/chunk-OWN5NPMC.js.map +0 -1
  369. package/dist/chunk-P6FYH6K4.js +0 -1161
  370. package/dist/chunk-P6FYH6K4.js.map +0 -1
  371. package/dist/chunk-PC4UYEBM.js +0 -166
  372. package/dist/chunk-PC4UYEBM.js.map +0 -1
  373. package/dist/chunk-PC5DOSM7.js +0 -579
  374. package/dist/chunk-PC5DOSM7.js.map +0 -1
  375. package/dist/chunk-PXE2VKMX.js +0 -140
  376. package/dist/chunk-PXE2VKMX.js.map +0 -1
  377. package/dist/chunk-PZ5AY32C.js +0 -10
  378. package/dist/chunk-PZ5AY32C.js.map +0 -1
  379. package/dist/chunk-QB6BDBP2.js +0 -4464
  380. package/dist/chunk-QB6BDBP2.js.map +0 -1
  381. package/dist/chunk-RXHCETDZ.js +0 -536
  382. package/dist/chunk-RXHCETDZ.js.map +0 -1
  383. package/dist/chunk-RZTMDUO7.js +0 -49
  384. package/dist/chunk-RZTMDUO7.js.map +0 -1
  385. package/dist/chunk-SFLLL76A.js +0 -669
  386. package/dist/chunk-SFLLL76A.js.map +0 -1
  387. package/dist/chunk-SZLVEKMJ.js +0 -1446
  388. package/dist/chunk-SZLVEKMJ.js.map +0 -1
  389. package/dist/chunk-T4SQEITX.js +0 -95
  390. package/dist/chunk-T4SQEITX.js.map +0 -1
  391. package/dist/chunk-T6RLYGAD.js +0 -158
  392. package/dist/chunk-T6RLYGAD.js.map +0 -1
  393. package/dist/chunk-TJVT4QFF.js +0 -911
  394. package/dist/chunk-TJVT4QFF.js.map +0 -1
  395. package/dist/chunk-TQ7LNKZ3.js +0 -136
  396. package/dist/chunk-TQ7LNKZ3.js.map +0 -1
  397. package/dist/chunk-U4L7JRPZ.js +0 -1706
  398. package/dist/chunk-U4L7JRPZ.js.map +0 -1
  399. package/dist/chunk-U4PHLT2N.js +0 -419
  400. package/dist/chunk-U4PHLT2N.js.map +0 -1
  401. package/dist/chunk-VCZ5FQYW.js +0 -928
  402. package/dist/chunk-VCZ5FQYW.js.map +0 -1
  403. package/dist/chunk-VI2UW6B6.js +0 -162
  404. package/dist/chunk-VI2UW6B6.js.map +0 -1
  405. package/dist/chunk-VQMK5FMP.js +0 -247
  406. package/dist/chunk-VQMK5FMP.js.map +0 -1
  407. package/dist/chunk-WGXIEX7P.js +0 -116
  408. package/dist/chunk-WGXIEX7P.js.map +0 -1
  409. package/dist/chunk-WVATSFCP.js +0 -1553
  410. package/dist/chunk-WVATSFCP.js.map +0 -1
  411. package/dist/chunk-X4YIBDER.js +0 -1662
  412. package/dist/chunk-X4YIBDER.js.map +0 -1
  413. package/dist/chunk-YQN4ICPP.js +0 -355
  414. package/dist/chunk-YQN4ICPP.js.map +0 -1
  415. package/dist/chunk-ZET2UAYW.js +0 -89
  416. package/dist/chunk-ZET2UAYW.js.map +0 -1
  417. package/dist/chunk-ZHTZ4EYI.js +0 -1212
  418. package/dist/chunk-ZHTZ4EYI.js.map +0 -1
  419. package/dist/control.js.map +0 -1
  420. package/dist/hosted/index.js.map +0 -1
  421. package/dist/matrix/index.js.map +0 -1
  422. package/dist/reporting.js.map +0 -1
  423. package/dist/rollout/index.js.map +0 -1
  424. package/dist/run-campaign-OJJ7CZF4.js +0 -18
  425. package/dist/run-campaign-OJJ7CZF4.js.map +0 -1
  426. package/dist/supervisor-run/index.js.map +0 -1
  427. package/dist/traces.js.map +0 -1
  428. package/dist/wire/index.js.map +0 -1
@@ -1,1056 +0,0 @@
1
- import {
2
- LlmRouteAssertionError,
3
- assertLlmRoute,
4
- callLlmJson,
5
- costReceiptFromLlm,
6
- costReceiptFromLlmError,
7
- maximumChargeForLlmRequest
8
- } from "./chunk-SFLLL76A.js";
9
- import {
10
- CostLedger
11
- } from "./chunk-VCZ5FQYW.js";
12
-
13
- // src/wire/schemas.ts
14
- import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
15
- import { z } from "zod";
16
- extendZodWithOpenApi(z);
17
- var RubricDimensionSchema = z.object({
18
- id: z.string().min(1).describe('Short stable id like "buyer_quality" \u2014 used as the key in scoring output.'),
19
- description: z.string().min(1).describe("One-line plain-English meaning. Read by humans reviewing low scores."),
20
- weight: z.number().min(0).default(1).describe("Relative weight in the composite score. Default 1; 0 disables."),
21
- min: z.number().default(0).describe("Lower bound of valid score for this dimension."),
22
- max: z.number().default(1).describe("Upper bound of valid score for this dimension.")
23
- }).openapi("RubricDimension");
24
- var FailureModeSchema = z.object({
25
- id: z.string().min(1).describe('Short stable id like "ai-cadence" \u2014 used in detection lists.'),
26
- description: z.string().min(1).describe("Plain-English description of the failure pattern.")
27
- }).openapi("FailureMode");
28
- var RubricSchema = z.object({
29
- name: z.string().min(1).describe('Stable name like "anti-slop" \u2014 used by clients to invoke this rubric.'),
30
- description: z.string().min(1).describe("What this rubric measures. Shown in /v1/rubrics listing."),
31
- systemPrompt: z.string().min(1).describe(
32
- 'Instructs the judging LLM. Should explain the persona (e.g. "senior engineer reviewing voice"), what to score on, and what to return.'
33
- ),
34
- dimensions: z.array(RubricDimensionSchema).min(1).describe("Scoring axes. The composite score is a weighted sum of these."),
35
- failureModes: z.array(FailureModeSchema).default([]).describe("Patterns to detect; each detected mode appears in the result.failureModes list."),
36
- wins: z.array(FailureModeSchema).default([]).describe("Positive patterns; each detected one appears in the result.wins list.")
37
- }).openapi("Rubric");
38
- var JudgeRequestSchema = z.object({
39
- rubricName: z.string().optional().describe("Use a built-in rubric by name. Mutually exclusive with `rubric`."),
40
- rubric: RubricSchema.optional().describe(
41
- "Inline rubric definition. Mutually exclusive with `rubricName`."
42
- ),
43
- content: z.string().min(1).describe("The text being judged \u2014 a tweet, a blog post, a code snippet, anything stringly."),
44
- context: z.record(z.string(), z.unknown()).optional().describe(
45
- "Free-form metadata for the rubric to use \u2014 analytics, source URL, author, etc. Surfaced to the LLM."
46
- ),
47
- model: z.string().optional().describe("Override the judge model configured by the server.")
48
- }).refine((v) => Boolean(v.rubricName) !== Boolean(v.rubric), {
49
- message: "Provide exactly one of `rubricName` or `rubric`."
50
- }).openapi("JudgeRequest");
51
- var JudgeResultSchema = z.object({
52
- composite: z.number().min(0).max(1).describe("Weighted combination of dimension scores in 0..1. The single number to gate on."),
53
- dimensions: z.record(z.string(), z.number()).describe("Per-dimension score, keyed by RubricDimension.id."),
54
- failureModes: z.array(z.string()).default([]).describe("Failure-mode ids detected in the content (subset of rubric.failureModes ids)."),
55
- wins: z.array(z.string()).default([]).describe("Win ids detected in the content (subset of rubric.wins ids)."),
56
- rationale: z.string().describe("Plain-English explanation of the score. Surfaced to the human reviewer."),
57
- rubricVersion: z.string().describe(
58
- "Stable hash of the rubric used. Scores are only comparable across runs when this matches."
59
- ),
60
- model: z.string().describe("Model that produced the judgement, for reproducibility."),
61
- durationMs: z.number().int().nonnegative().describe("End-to-end wall time for this call.")
62
- }).openapi("JudgeResult");
63
- var RubricInfoSchema = z.object({
64
- name: z.string().describe("Pass this to /v1/judge as `rubricName`."),
65
- description: z.string().describe("What this rubric measures."),
66
- dimensions: z.array(z.object({ id: z.string(), description: z.string(), weight: z.number() })).describe("The scoring axes this rubric uses, with weights."),
67
- failureModes: z.array(z.string()).default([]).describe("Failure-mode ids this rubric detects."),
68
- rubricVersion: z.string().describe("Stable hash \u2014 match this to compare scores across runs.")
69
- }).openapi("RubricInfo");
70
- var ListRubricsResponseSchema = z.object({
71
- rubrics: z.array(RubricInfoSchema)
72
- }).openapi("ListRubricsResponse");
73
- var VersionResponseSchema = z.object({
74
- package: z.string().describe('Package name (always "@tangle-network/agent-eval").'),
75
- version: z.string().describe("Semver of the running server. Match your client to this."),
76
- wireVersion: z.string().describe(
77
- "Wire-protocol semver. Bumps separately from package version when the schema changes."
78
- ),
79
- apiSurface: z.array(z.string()).describe("List of supported method names.")
80
- }).openapi("VersionResponse");
81
- var HealthResponseSchema = z.object({
82
- status: z.literal("ok"),
83
- uptimeSec: z.number()
84
- }).openapi("HealthResponse");
85
- var TraceEventSchema = z.object({
86
- eventId: z.string().min(1).describe("Stable id for the event. Use ULID or UUID."),
87
- runId: z.string().min(1).describe("Run this event belongs to."),
88
- spanId: z.string().optional().describe("Span that emitted the event, if any."),
89
- kind: z.enum([
90
- "log",
91
- "error",
92
- "budget_decrement",
93
- "budget_breach",
94
- "state_mutation",
95
- "policy_violation",
96
- "redaction_applied",
97
- "custom"
98
- ]).describe("Coarse event category \u2014 matches the TraceSchema v1 EventKind enum."),
99
- timestamp: z.number().int().nonnegative().describe("Unix millis. Must be monotonically non-decreasing within a span."),
100
- payload: z.record(z.string(), z.unknown()).describe("Free-form payload \u2014 the runtime owns the shape.")
101
- }).openapi("TraceEvent");
102
- var TracesIngestRequestSchema = z.object({
103
- events: z.array(TraceEventSchema).min(1).max(1e4).describe("Batch of events. Max 10k per call \u2014 bigger streams should be chunked.")
104
- }).openapi("TracesIngestRequest");
105
- var TracesIngestResponseSchema = z.object({
106
- accepted: z.number().int().nonnegative().describe("Number of events persisted."),
107
- rejected: z.number().int().nonnegative().describe("Number of events the store refused \u2014 see `errors[]` for reasons."),
108
- errors: z.array(
109
- z.object({
110
- eventId: z.string().describe("Event id this error applies to."),
111
- message: z.string().describe("Why the event was rejected.")
112
- })
113
- ).default([])
114
- }).openapi("TracesIngestResponse");
115
- var FeedbackLabelSchema = z.object({
116
- id: z.string().optional(),
117
- source: z.enum(["user", "judge", "environment", "metric", "policy", "system"]),
118
- kind: z.enum([
119
- "approve",
120
- "reject",
121
- "select",
122
- "edit",
123
- "rank",
124
- "rate",
125
- "comment",
126
- "metric_outcome",
127
- "policy_block",
128
- "revision_request"
129
- ]),
130
- value: z.unknown(),
131
- reason: z.string().optional(),
132
- severity: z.enum(["info", "warning", "error", "critical"]).optional(),
133
- createdAt: z.string().describe("ISO-8601 UTC."),
134
- metadata: z.record(z.string(), z.unknown()).optional()
135
- }).openapi("FeedbackLabel");
136
- var FeedbackAttemptSchema = z.object({
137
- id: z.string().min(1),
138
- stepIndex: z.number().int().nonnegative(),
139
- artifactType: z.enum([
140
- "text",
141
- "code",
142
- "plan",
143
- "research",
144
- "action",
145
- "ui",
146
- "decision",
147
- "data",
148
- "other"
149
- ]),
150
- artifact: z.unknown(),
151
- options: z.array(z.unknown()).optional(),
152
- proposedAction: z.object({
153
- type: z.string(),
154
- risk: z.enum(["low", "medium", "high"]).optional(),
155
- costUsd: z.number().optional(),
156
- externalSideEffect: z.boolean().optional(),
157
- requiresApproval: z.boolean().optional(),
158
- metadata: z.record(z.string(), z.unknown()).optional()
159
- }).optional(),
160
- feedback: z.array(FeedbackLabelSchema).optional(),
161
- createdAt: z.string(),
162
- metadata: z.record(z.string(), z.unknown()).optional()
163
- }).openapi("FeedbackAttempt");
164
- var FeedbackTrajectorySchema = z.object({
165
- id: z.string().min(1).describe("Stable id; idempotency key for the trajectory."),
166
- projectId: z.string().optional(),
167
- scenarioId: z.string().optional(),
168
- task: z.object({
169
- intent: z.string().min(1),
170
- context: z.unknown().optional()
171
- }),
172
- attempts: z.array(FeedbackAttemptSchema).default([]),
173
- labels: z.array(FeedbackLabelSchema).default([]),
174
- outcome: z.object({
175
- success: z.boolean().optional(),
176
- score: z.number().optional(),
177
- metrics: z.record(z.string(), z.number()).optional(),
178
- costUsd: z.number().optional(),
179
- detail: z.string().optional(),
180
- observedAt: z.string().optional(),
181
- metadata: z.record(z.string(), z.unknown()).optional()
182
- }).optional(),
183
- split: z.enum(["train", "dev", "test", "holdout"]).optional(),
184
- tags: z.record(z.string(), z.string()).optional(),
185
- createdAt: z.string().describe("ISO-8601 UTC."),
186
- updatedAt: z.string().optional(),
187
- metadata: z.record(z.string(), z.unknown()).optional()
188
- }).openapi("FeedbackTrajectory");
189
- var FeedbackIngestResponseSchema = z.object({
190
- id: z.string().describe("Trajectory id that was persisted."),
191
- persisted: z.boolean().describe("True when the trajectory was saved (idempotent on id).")
192
- }).openapi("FeedbackIngestResponse");
193
- var ErrorResponseSchema = z.object({
194
- error: z.object({
195
- code: z.string().describe(
196
- 'Machine-readable code: "validation_error", "rubric_not_found", "judge_error".'
197
- ),
198
- message: z.string().describe("Human-readable message."),
199
- details: z.unknown().optional().describe("Optional structured detail.")
200
- }).describe("Errors are always wrapped in this shape across all endpoints.")
201
- }).openapi("ErrorResponse");
202
- var WIRE_VERSION = "1.0.0";
203
- function hashRubric(rubric) {
204
- const stable = stableStringify(rubric);
205
- let h = 5381;
206
- for (let i = 0; i < stable.length; i++) {
207
- h = h * 33 ^ stable.charCodeAt(i);
208
- }
209
- return `${rubric.name}@${(h >>> 0).toString(16).padStart(8, "0")}`;
210
- }
211
- function stableStringify(value) {
212
- if (Array.isArray(value)) return `[${value.map((item) => stableStringify(item)).join(",")}]`;
213
- if (value && typeof value === "object") {
214
- const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item)}`);
215
- return `{${entries.join(",")}}`;
216
- }
217
- return JSON.stringify(value);
218
- }
219
-
220
- // src/wire/rubrics.ts
221
- var ANTI_SLOP = {
222
- name: "anti-slop",
223
- description: "Voice and signal quality for content aimed at senior engineers. Catches AI cadence, marketing tone, and engagement-bait shapes.",
224
- systemPrompt: `You are evaluating a piece of content written for senior engineers and technical founders.
225
-
226
- You score three things:
227
- - buyer_quality (0..1): would a senior engineer in the target ICP find this worth their attention? High = specific, earned, technically interesting. Low = generic, hyped, off-target.
228
- - voice (0..1): does it read like a person who built the thing, or like AI/marketing copy?
229
- - signal (0..1): does it contain a non-obvious detail, constraint, or claim a reader couldn't get from the public docs?
230
-
231
- Detect failure modes (return ids matching):
232
- - ai-cadence: rule-of-three openings, em-dash flourish, "Let me explain", "Here's the thing", AI rhythm
233
- - marketing-tone: "We're excited to announce", "thrilled", "delighted", "game-changer", buzzword stack
234
- - vague-claim: technical claim without a specific component, file, or measurement
235
- - no-hook: opening doesn't earn attention from the target reader
236
- - engagement-bait: "agree?", "thoughts?", listicles, controversy-fishing, hook-detail-pitch
237
- - off-icp: content shape would attract motivational/grift/hype audiences instead of buyers
238
- - stale-claim: repeats a positioning line we've used many times this month
239
-
240
- Detect wins (return ids matching):
241
- - specific-component: names a real file, component, or measurement
242
- - earned-detail: shares a non-obvious detail not derivable from public docs
243
- - constraint-articulated: names a real tradeoff and the side chosen
244
- - honest-failure: describes a real failure mode and what was done about it
245
-
246
- Return ONLY JSON matching the response schema. Be conservative \u2014 most content has 0-1 wins and 1-2 failure modes, not many of each.`,
247
- dimensions: [
248
- {
249
- id: "buyer_quality",
250
- description: "Would the target buyer find this worth attention?",
251
- weight: 0.5,
252
- min: 0,
253
- max: 1
254
- },
255
- {
256
- id: "voice",
257
- description: "Does it sound like a builder, not AI or marketing?",
258
- weight: 0.3,
259
- min: 0,
260
- max: 1
261
- },
262
- {
263
- id: "signal",
264
- description: "Non-obvious detail, constraint, or claim?",
265
- weight: 0.2,
266
- min: 0,
267
- max: 1
268
- }
269
- ],
270
- failureModes: [
271
- { id: "ai-cadence", description: "AI-rhythm openings and transitions" },
272
- { id: "marketing-tone", description: "Buzzwords, hype, corporate-PR voice" },
273
- { id: "vague-claim", description: "Technical claim without specifics" },
274
- { id: "no-hook", description: "Opening fails to earn attention" },
275
- { id: "engagement-bait", description: "Listicle/controversy/agree-pattern" },
276
- { id: "off-icp", description: "Voice attracts the wrong audience" },
277
- { id: "stale-claim", description: "Reuses an over-used positioning line" }
278
- ],
279
- wins: [
280
- { id: "specific-component", description: "Names a real file/component/number" },
281
- { id: "earned-detail", description: "Detail not in public docs" },
282
- { id: "constraint-articulated", description: "Names a real tradeoff" },
283
- { id: "honest-failure", description: "Describes a real failure honestly" }
284
- ]
285
- };
286
- var BUILTIN_RUBRICS = {
287
- "anti-slop": ANTI_SLOP
288
- };
289
- function getBuiltinRubric(name) {
290
- return BUILTIN_RUBRICS[name];
291
- }
292
- function listBuiltinRubrics() {
293
- return Object.values(BUILTIN_RUBRICS).map((r) => ({
294
- name: r.name,
295
- description: r.description,
296
- dimensions: r.dimensions.map((d) => ({
297
- id: d.id,
298
- description: d.description,
299
- weight: d.weight
300
- })),
301
- failureModes: r.failureModes.map((f) => f.id),
302
- rubricVersion: hashRubric(r)
303
- }));
304
- }
305
-
306
- // src/wire/handlers.ts
307
- import { readFileSync } from "fs";
308
- import { dirname, resolve } from "path";
309
- import { fileURLToPath } from "url";
310
- var WireError = class extends Error {
311
- constructor(code, message, status = 400, details) {
312
- super(message);
313
- this.code = code;
314
- this.status = status;
315
- this.details = details;
316
- this.name = "WireError";
317
- }
318
- code;
319
- status;
320
- details;
321
- };
322
- function judgeOutputSchema(rubric) {
323
- return {
324
- name: "JudgeOutput",
325
- schema: {
326
- type: "object",
327
- additionalProperties: false,
328
- properties: {
329
- dimensions: {
330
- type: "object",
331
- additionalProperties: false,
332
- properties: Object.fromEntries(
333
- rubric.dimensions.map((d) => [
334
- d.id,
335
- { type: "number", minimum: d.min, maximum: d.max }
336
- ])
337
- ),
338
- required: rubric.dimensions.map((d) => d.id)
339
- },
340
- failureModes: {
341
- type: "array",
342
- items: { type: "string", enum: rubric.failureModes.map((f) => f.id) }
343
- },
344
- wins: {
345
- type: "array",
346
- items: { type: "string", enum: rubric.wins.map((w) => w.id) }
347
- },
348
- rationale: { type: "string" }
349
- },
350
- required: ["dimensions", "rationale"]
351
- }
352
- };
353
- }
354
- function validateJudgeOutput(value, rubric) {
355
- if (!value || typeof value !== "object") {
356
- throw new WireError("judge_error", "Judge returned malformed output.", 500, value);
357
- }
358
- const raw = value;
359
- const rawDimensions = raw.dimensions;
360
- if (!rawDimensions || typeof rawDimensions !== "object" || Array.isArray(rawDimensions)) {
361
- throw new WireError("judge_error", "Judge returned malformed dimensions.", 500, value);
362
- }
363
- const dimensions = {};
364
- const dimensionRecord = rawDimensions;
365
- for (const dim of rubric.dimensions) {
366
- const score = dimensionRecord[dim.id];
367
- if (typeof score !== "number" || !Number.isFinite(score) || score < dim.min || score > dim.max) {
368
- throw new WireError(
369
- "judge_error",
370
- `Judge returned invalid score for dimension "${dim.id}".`,
371
- 500,
372
- value
373
- );
374
- }
375
- dimensions[dim.id] = score;
376
- }
377
- const allowedFailures = new Set(rubric.failureModes.map((mode) => mode.id));
378
- const allowedWins = new Set(rubric.wins.map((win) => win.id));
379
- const failureModes = validateIdArray(raw.failureModes, allowedFailures, "failureModes", value);
380
- const wins = validateIdArray(raw.wins, allowedWins, "wins", value);
381
- if (typeof raw.rationale !== "string" || raw.rationale.trim().length === 0) {
382
- throw new WireError("judge_error", "Judge returned missing rationale.", 500, value);
383
- }
384
- return { dimensions, failureModes, wins, rationale: raw.rationale };
385
- }
386
- function validateIdArray(raw, allowed, field, original) {
387
- if (raw === void 0) return [];
388
- if (!Array.isArray(raw)) {
389
- throw new WireError("judge_error", `Judge returned non-array ${field}.`, 500, original);
390
- }
391
- const out = [];
392
- for (const item of raw) {
393
- if (typeof item !== "string" || !allowed.has(item)) {
394
- throw new WireError(
395
- "judge_error",
396
- `Judge returned unknown ${field} id "${String(item)}".`,
397
- 500,
398
- original
399
- );
400
- }
401
- out.push(item);
402
- }
403
- return out;
404
- }
405
- function compositeScore(dimensions, rubric) {
406
- let weighted = 0;
407
- let totalWeight = 0;
408
- for (const dim of rubric.dimensions) {
409
- const raw = dimensions[dim.id] ?? 0;
410
- const range = dim.max - dim.min || 1;
411
- const normalized = Math.max(0, Math.min(1, (raw - dim.min) / range));
412
- weighted += normalized * dim.weight;
413
- totalWeight += dim.weight;
414
- }
415
- return totalWeight > 0 ? weighted / totalWeight : 0;
416
- }
417
- function buildJudgePrompt(content, context) {
418
- const ctx = context && Object.keys(context).length ? JSON.stringify(context) : "";
419
- return [
420
- `CONTENT TO JUDGE:`,
421
- content,
422
- "",
423
- ctx ? `CONTEXT (metadata, analytics, etc.):` : "",
424
- ctx ? ctx : ""
425
- ].filter(Boolean).join("\n");
426
- }
427
- var DEFAULT_JUDGE_MODEL = "claude-sonnet-4-6";
428
- async function handleJudge(req, options = {}) {
429
- let rubric;
430
- if (req.rubricName) {
431
- const found = getBuiltinRubric(req.rubricName);
432
- if (!found) {
433
- throw new WireError("rubric_not_found", `No built-in rubric named "${req.rubricName}".`, 404);
434
- }
435
- rubric = found;
436
- } else if (req.rubric) {
437
- rubric = req.rubric;
438
- } else {
439
- throw new WireError("validation_error", "Provide either `rubricName` or `rubric`.", 422);
440
- }
441
- if (options.routeRequirements) {
442
- try {
443
- assertLlmRoute(options.llm ?? {}, options.routeRequirements);
444
- } catch (error) {
445
- if (!(error instanceof LlmRouteAssertionError)) throw error;
446
- const noEndpoint = error.reason === "no_explicit_base_url";
447
- throw new WireError(
448
- noEndpoint ? "llm_not_configured" : "llm_route_rejected",
449
- noEndpoint ? "No model endpoint is configured. Pass llm.baseUrl or configure the CLI provider environment variables." : error.message,
450
- 503,
451
- { reason: error.reason }
452
- );
453
- }
454
- }
455
- const startedAt = Date.now();
456
- const model = req.model ?? options.defaultModel ?? DEFAULT_JUDGE_MODEL;
457
- const request = {
458
- model,
459
- messages: [
460
- { role: "system", content: rubric.systemPrompt },
461
- { role: "user", content: buildJudgePrompt(req.content, req.context) }
462
- ],
463
- jsonSchema: judgeOutputSchema(rubric),
464
- temperature: 0,
465
- maxTokens: 4e3,
466
- timeoutMs: 6e4
467
- };
468
- const ledger = options.costLedger ?? new CostLedger();
469
- const paid = await ledger.runPaidCall({
470
- channel: "judge",
471
- phase: options.costPhase ?? "wire.judge",
472
- actor: `wire.${req.rubricName ?? "inline"}`,
473
- model,
474
- maximumCharge: maximumChargeForLlmRequest(request, options.llm),
475
- signal: options.signal,
476
- execute: (signal, callId) => callLlmJson(request, {
477
- ...options.llm,
478
- signal,
479
- idempotencyKey: callId
480
- }),
481
- receipt: ({ result: result2 }) => costReceiptFromLlm(result2),
482
- receiptFromError: costReceiptFromLlmError
483
- });
484
- if (!paid.succeeded) throw paid.error;
485
- const { value, result } = paid.value;
486
- const output = validateJudgeOutput(value, rubric);
487
- const composite = compositeScore(output.dimensions, rubric);
488
- const durationMs = Date.now() - startedAt;
489
- return {
490
- composite,
491
- dimensions: output.dimensions,
492
- failureModes: output.failureModes ?? [],
493
- wins: output.wins ?? [],
494
- rationale: output.rationale,
495
- rubricVersion: hashRubric(rubric),
496
- model: result.model,
497
- durationMs
498
- };
499
- }
500
- function handleListRubrics() {
501
- return { rubrics: listBuiltinRubrics() };
502
- }
503
- var CACHED_VERSION;
504
- function readPackageVersion() {
505
- if (CACHED_VERSION) return CACHED_VERSION;
506
- const here = dirname(fileURLToPath(import.meta.url));
507
- const candidates = [
508
- resolve(here, "..", "..", "package.json"),
509
- // src/wire → repo root
510
- resolve(here, "..", "package.json")
511
- // dist → repo root
512
- ];
513
- for (const path of candidates) {
514
- try {
515
- const pkg = JSON.parse(readFileSync(path, "utf-8"));
516
- if (pkg.version) {
517
- CACHED_VERSION = pkg.version;
518
- return pkg.version;
519
- }
520
- } catch {
521
- }
522
- }
523
- return "0.0.0-unknown";
524
- }
525
- function handleVersion() {
526
- return {
527
- package: "@tangle-network/agent-eval",
528
- version: readPackageVersion(),
529
- wireVersion: WIRE_VERSION,
530
- apiSurface: ["judge", "listRubrics", "version", "feedback.ingest", "traces.ingest"]
531
- };
532
- }
533
- async function handleTracesIngest(req, stores) {
534
- if (!stores.traceStore) {
535
- throw new WireError(
536
- "service_unavailable",
537
- "No trace store configured on this server. Pass `traceStore` to `createApp`.",
538
- 503
539
- );
540
- }
541
- const errors = [];
542
- let accepted = 0;
543
- for (const event of req.events) {
544
- try {
545
- await stores.traceStore.appendEvent(event);
546
- accepted++;
547
- } catch (err) {
548
- errors.push({
549
- eventId: event.eventId,
550
- message: err instanceof Error ? err.message : String(err)
551
- });
552
- }
553
- }
554
- return { accepted, rejected: errors.length, errors };
555
- }
556
- async function handleFeedbackIngest(req, stores) {
557
- if (!stores.feedbackStore) {
558
- throw new WireError(
559
- "service_unavailable",
560
- "No feedback store configured on this server. Pass `feedbackStore` to `createApp`.",
561
- 503
562
- );
563
- }
564
- await stores.feedbackStore.save(req);
565
- return { id: req.id, persisted: true };
566
- }
567
-
568
- // src/wire/openapi.ts
569
- import { OpenAPIRegistry, OpenApiGeneratorV31 } from "@asteasolutions/zod-to-openapi";
570
- function buildOpenApi(packageVersion) {
571
- const registry = new OpenAPIRegistry();
572
- registry.register("JudgeRequest", JudgeRequestSchema);
573
- registry.register("JudgeResult", JudgeResultSchema);
574
- registry.register("ListRubricsResponse", ListRubricsResponseSchema);
575
- registry.register("VersionResponse", VersionResponseSchema);
576
- registry.register("HealthResponse", HealthResponseSchema);
577
- registry.register("ErrorResponse", ErrorResponseSchema);
578
- registry.register("TracesIngestRequest", TracesIngestRequestSchema);
579
- registry.register("TracesIngestResponse", TracesIngestResponseSchema);
580
- registry.register("FeedbackTrajectory", FeedbackTrajectorySchema);
581
- registry.register("FeedbackIngestResponse", FeedbackIngestResponseSchema);
582
- registry.registerPath({
583
- method: "post",
584
- path: "/v1/judge",
585
- summary: "Score a piece of content against a rubric",
586
- description: "Runs the judging LLM with the named (or inline) rubric and returns dimension scores, detected failure modes, wins, and a composite score in 0..1.",
587
- request: {
588
- body: {
589
- content: {
590
- "application/json": { schema: JudgeRequestSchema }
591
- }
592
- }
593
- },
594
- responses: {
595
- 200: {
596
- description: "Successful judgement",
597
- content: { "application/json": { schema: JudgeResultSchema } }
598
- },
599
- 400: {
600
- description: "Validation error",
601
- content: { "application/json": { schema: ErrorResponseSchema } }
602
- },
603
- 404: {
604
- description: "Rubric not found",
605
- content: { "application/json": { schema: ErrorResponseSchema } }
606
- },
607
- 500: {
608
- description: "Judge error",
609
- content: { "application/json": { schema: ErrorResponseSchema } }
610
- }
611
- }
612
- });
613
- registry.registerPath({
614
- method: "get",
615
- path: "/v1/rubrics",
616
- summary: "List built-in rubrics",
617
- description: "Returns every rubric registered server-side, with their dimensions and stable rubricVersion hash.",
618
- responses: {
619
- 200: {
620
- description: "Listing",
621
- content: { "application/json": { schema: ListRubricsResponseSchema } }
622
- }
623
- }
624
- });
625
- registry.registerPath({
626
- method: "get",
627
- path: "/v1/version",
628
- summary: "Server and wire-protocol version",
629
- description: "Match your client version to `version`; check `wireVersion` for compatibility.",
630
- responses: {
631
- 200: {
632
- description: "Version info",
633
- content: { "application/json": { schema: VersionResponseSchema } }
634
- }
635
- }
636
- });
637
- registry.registerPath({
638
- method: "get",
639
- path: "/healthz",
640
- summary: "Liveness check",
641
- responses: {
642
- 200: {
643
- description: "OK",
644
- content: { "application/json": { schema: HealthResponseSchema } }
645
- }
646
- }
647
- });
648
- registry.registerPath({
649
- method: "post",
650
- path: "/v1/traces/ingest",
651
- summary: "Ingest a batch of production TraceEvents",
652
- description: "Append a batch of TraceEvents to the configured TraceStore. Accepts application/json ({events:[...]}) or application/x-ndjson (one event per line). Returns counts of accepted + rejected events.",
653
- request: {
654
- body: {
655
- content: {
656
- "application/json": { schema: TracesIngestRequestSchema },
657
- "application/x-ndjson": { schema: TracesIngestRequestSchema }
658
- }
659
- }
660
- },
661
- responses: {
662
- 200: {
663
- description: "Ingestion summary",
664
- content: { "application/json": { schema: TracesIngestResponseSchema } }
665
- },
666
- 400: {
667
- description: "Validation error",
668
- content: { "application/json": { schema: ErrorResponseSchema } }
669
- },
670
- 401: {
671
- description: "Unauthorized (when bearer auth is configured)",
672
- content: { "application/json": { schema: ErrorResponseSchema } }
673
- },
674
- 503: {
675
- description: "No trace store configured",
676
- content: { "application/json": { schema: ErrorResponseSchema } }
677
- }
678
- }
679
- });
680
- registry.registerPath({
681
- method: "post",
682
- path: "/v1/feedback",
683
- summary: "Ingest a FeedbackTrajectory from production",
684
- description: "Persist a single FeedbackTrajectory. Idempotent on trajectory.id \u2014 re-posting replaces the prior record. Used by production runtimes to forward user \u{1F44D}/\u{1F44E}/edits into the eval substrate.",
685
- request: {
686
- body: {
687
- content: {
688
- "application/json": { schema: FeedbackTrajectorySchema }
689
- }
690
- }
691
- },
692
- responses: {
693
- 200: {
694
- description: "Persisted",
695
- content: { "application/json": { schema: FeedbackIngestResponseSchema } }
696
- },
697
- 400: {
698
- description: "Validation error",
699
- content: { "application/json": { schema: ErrorResponseSchema } }
700
- },
701
- 401: {
702
- description: "Unauthorized (when bearer auth is configured)",
703
- content: { "application/json": { schema: ErrorResponseSchema } }
704
- },
705
- 503: {
706
- description: "No feedback store configured",
707
- content: { "application/json": { schema: ErrorResponseSchema } }
708
- }
709
- }
710
- });
711
- const generator = new OpenApiGeneratorV31(registry.definitions);
712
- const doc = generator.generateDocument({
713
- openapi: "3.1.0",
714
- info: {
715
- title: "@tangle-network/agent-eval \u2014 wire protocol",
716
- version: packageVersion,
717
- description: `HTTP and stdio RPC interface to agent-eval. The TypeScript runtime is the source of truth; this spec is the contract that cross-language clients (Python, Rust, Go) generate from.
718
-
719
- Wire-protocol version: ${WIRE_VERSION}. Bumps on breaking changes to request/response schemas.`,
720
- contact: { name: "Tangle Network", url: "https://github.com/tangle-network/agent-eval" },
721
- license: { name: "MIT" }
722
- },
723
- servers: [{ url: "http://localhost:5005", description: "Local agent-eval serve" }]
724
- });
725
- const rubricRef = { $ref: "#/components/schemas/Rubric" };
726
- const commonJudgeFields = {
727
- content: { type: "string", minLength: 1 },
728
- context: { type: "object", additionalProperties: true },
729
- model: { type: "string" }
730
- };
731
- doc.components ??= {};
732
- doc.components.schemas ??= {};
733
- doc.components.schemas.JudgeRequest = {
734
- oneOf: [
735
- {
736
- type: "object",
737
- additionalProperties: false,
738
- required: ["rubricName", "content"],
739
- properties: {
740
- rubricName: { type: "string", minLength: 1 },
741
- ...commonJudgeFields
742
- }
743
- },
744
- {
745
- type: "object",
746
- additionalProperties: false,
747
- required: ["rubric", "content"],
748
- properties: {
749
- rubric: rubricRef,
750
- ...commonJudgeFields
751
- }
752
- }
753
- ],
754
- description: "Judge request. Provide exactly one of rubricName or rubric."
755
- };
756
- return doc;
757
- }
758
-
759
- // src/wire/rpc.ts
760
- async function dispatchRpc(req, options = {}) {
761
- try {
762
- switch (req.method) {
763
- case "judge": {
764
- const parsed = JudgeRequestSchema.safeParse(req.params);
765
- if (!parsed.success) {
766
- return {
767
- error: {
768
- code: "validation_error",
769
- message: "params did not match JudgeRequest schema.",
770
- details: parsed.error.issues
771
- }
772
- };
773
- }
774
- return {
775
- result: await handleJudge(parsed.data, {
776
- llm: options.llm,
777
- defaultModel: options.judgeModel,
778
- routeRequirements: options.llmRouteRequirements
779
- })
780
- };
781
- }
782
- case "listRubrics":
783
- return { result: handleListRubrics() };
784
- case "version":
785
- return { result: handleVersion() };
786
- default:
787
- return {
788
- error: {
789
- code: "unknown_method",
790
- message: `No such method: ${req.method}`
791
- }
792
- };
793
- }
794
- } catch (err) {
795
- if (err instanceof WireError) {
796
- return { error: { code: err.code, message: err.message, details: err.details } };
797
- }
798
- const message = err instanceof Error ? err.message : String(err);
799
- return { error: { code: "internal_error", message } };
800
- }
801
- }
802
- async function readAll(stream) {
803
- const chunks = [];
804
- for await (const chunk of stream) {
805
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
806
- }
807
- return Buffer.concat(chunks).toString("utf-8");
808
- }
809
- async function runRpcOnce(method, options = {}) {
810
- const raw = await readAll(process.stdin);
811
- let req;
812
- try {
813
- const body = JSON.parse(raw);
814
- req = method ? { method, params: body } : body;
815
- } catch (err) {
816
- process.stdout.write(
817
- `${JSON.stringify({
818
- error: {
819
- code: "parse_error",
820
- message: `stdin was not valid JSON: ${err instanceof Error ? err.message : String(err)}`
821
- }
822
- })}
823
- `
824
- );
825
- return 1;
826
- }
827
- const out = await dispatchRpc(req, options);
828
- process.stdout.write(`${JSON.stringify(out)}
829
- `);
830
- return "error" in out ? 1 : 0;
831
- }
832
- async function runRpcBatch(method, options = {}) {
833
- const raw = await readAll(process.stdin);
834
- const lines = raw.split("\n").filter((l) => l.trim().length > 0);
835
- let exitCode = 0;
836
- for (const line of lines) {
837
- let req;
838
- try {
839
- const body = JSON.parse(line);
840
- req = method ? { method, params: body } : body;
841
- } catch (err) {
842
- process.stdout.write(
843
- `${JSON.stringify({
844
- error: {
845
- code: "parse_error",
846
- message: `line was not valid JSON: ${err instanceof Error ? err.message : String(err)}`
847
- }
848
- })}
849
- `
850
- );
851
- exitCode = 1;
852
- continue;
853
- }
854
- const out = await dispatchRpc(req, options);
855
- process.stdout.write(`${JSON.stringify(out)}
856
- `);
857
- if ("error" in out) exitCode = 1;
858
- }
859
- return exitCode;
860
- }
861
-
862
- // src/wire/server.ts
863
- import { serve } from "@hono/node-server";
864
- import { Hono } from "hono";
865
- import { cors } from "hono/cors";
866
- var STARTED_AT = Date.now();
867
- var AUTH_EXEMPT_PATHS = /* @__PURE__ */ new Set(["/healthz", "/v1/version", "/openapi.json"]);
868
- function createApp(opts = {}) {
869
- const app = new Hono();
870
- app.use("*", cors());
871
- if (opts.auth) {
872
- const verify = opts.auth.bearer;
873
- app.use("*", async (c, next) => {
874
- const path = new URL(c.req.url).pathname;
875
- if (AUTH_EXEMPT_PATHS.has(path)) return next();
876
- const raw = c.req.header("authorization") ?? "";
877
- const match = raw.match(/^Bearer\s+(.+)$/i);
878
- if (!match) {
879
- throw new WireError("unauthorized", "Missing or malformed Authorization header.", 401);
880
- }
881
- const token = match[1];
882
- const ok = typeof verify === "string" ? token === verify : await verify(token);
883
- if (!ok) {
884
- throw new WireError("unauthorized", "Invalid bearer token.", 401);
885
- }
886
- return next();
887
- });
888
- }
889
- app.onError((err, c) => {
890
- if (err instanceof WireError) {
891
- const status = err.status;
892
- return c.json(
893
- { error: { code: err.code, message: err.message, details: err.details } },
894
- status
895
- );
896
- }
897
- console.error("[agent-eval] unhandled error:", err);
898
- return c.json({ error: { code: "internal_error", message: "Internal server error." } }, 500);
899
- });
900
- app.get(
901
- "/healthz",
902
- (c) => c.json({ status: "ok", uptimeSec: (Date.now() - STARTED_AT) / 1e3 })
903
- );
904
- app.get("/v1/version", (c) => c.json(handleVersion()));
905
- app.get("/v1/rubrics", (c) => c.json(handleListRubrics()));
906
- app.post("/v1/judge", async (c) => {
907
- const raw = await c.req.json().catch(() => null);
908
- if (raw == null) {
909
- throw new WireError("validation_error", "Request body must be JSON.", 400);
910
- }
911
- const parsed = JudgeRequestSchema.safeParse(raw);
912
- if (!parsed.success) {
913
- throw new WireError(
914
- "validation_error",
915
- "Request did not match JudgeRequest schema.",
916
- 400,
917
- parsed.error.issues
918
- );
919
- }
920
- const result = await handleJudge(parsed.data, {
921
- llm: opts.llm,
922
- defaultModel: opts.judgeModel,
923
- routeRequirements: opts.llmRouteRequirements
924
- });
925
- return c.json(result);
926
- });
927
- app.post("/v1/traces/ingest", async (c) => {
928
- const contentType = c.req.header("content-type") ?? "";
929
- let payload;
930
- if (contentType.includes("application/x-ndjson")) {
931
- const text = await c.req.text();
932
- const events = text.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
933
- try {
934
- return JSON.parse(line);
935
- } catch {
936
- throw new WireError(
937
- "validation_error",
938
- "NDJSON line did not parse as JSON.",
939
- 400,
940
- line.slice(0, 200)
941
- );
942
- }
943
- });
944
- payload = { events };
945
- } else {
946
- payload = await c.req.json().catch(() => null);
947
- }
948
- if (payload == null) {
949
- throw new WireError("validation_error", "Request body must be JSON or NDJSON.", 400);
950
- }
951
- const parsed = TracesIngestRequestSchema.safeParse(payload);
952
- if (!parsed.success) {
953
- throw new WireError(
954
- "validation_error",
955
- "Request did not match TracesIngestRequest schema.",
956
- 400,
957
- parsed.error.issues
958
- );
959
- }
960
- const result = await handleTracesIngest(parsed.data, opts.stores ?? {});
961
- return c.json(result);
962
- });
963
- app.post("/v1/feedback", async (c) => {
964
- const raw = await c.req.json().catch(() => null);
965
- if (raw == null) {
966
- throw new WireError("validation_error", "Request body must be JSON.", 400);
967
- }
968
- const parsed = FeedbackTrajectorySchema.safeParse(raw);
969
- if (!parsed.success) {
970
- throw new WireError(
971
- "validation_error",
972
- "Request did not match FeedbackTrajectory schema.",
973
- 400,
974
- parsed.error.issues
975
- );
976
- }
977
- const result = await handleFeedbackIngest(parsed.data, opts.stores ?? {});
978
- return c.json(result);
979
- });
980
- app.get("/openapi.json", (c) => c.json(buildOpenApi(handleVersion().version)));
981
- return app;
982
- }
983
- function startServer(opts = {}) {
984
- const app = createApp(opts);
985
- const port = opts.port ?? 5005;
986
- const host = opts.host ?? "127.0.0.1";
987
- return serve({ fetch: app.fetch, port, hostname: host }, ({ address, port: actualPort }) => {
988
- console.log(`[agent-eval] serving on http://${address}:${actualPort}`);
989
- });
990
- }
991
- function startServerAsync(opts = {}) {
992
- const app = createApp(opts);
993
- const port = opts.port ?? 5005;
994
- const host = opts.host ?? "127.0.0.1";
995
- return new Promise((resolve2, reject) => {
996
- let settled = false;
997
- let server;
998
- server = serve({ fetch: app.fetch, port, hostname: host }, ({ address, port: actualPort }) => {
999
- if (settled) return;
1000
- settled = true;
1001
- console.log(`[agent-eval] serving on http://${address}:${actualPort}`);
1002
- resolve2({
1003
- server,
1004
- port: actualPort,
1005
- host: address,
1006
- close: () => new Promise((res, rej) => {
1007
- server.close((err) => err ? rej(err) : res());
1008
- })
1009
- });
1010
- });
1011
- server.on("error", (err) => {
1012
- if (settled) return;
1013
- settled = true;
1014
- reject(err);
1015
- });
1016
- });
1017
- }
1018
-
1019
- export {
1020
- RubricDimensionSchema,
1021
- FailureModeSchema,
1022
- RubricSchema,
1023
- JudgeRequestSchema,
1024
- JudgeResultSchema,
1025
- RubricInfoSchema,
1026
- ListRubricsResponseSchema,
1027
- VersionResponseSchema,
1028
- HealthResponseSchema,
1029
- TraceEventSchema,
1030
- TracesIngestRequestSchema,
1031
- TracesIngestResponseSchema,
1032
- FeedbackLabelSchema,
1033
- FeedbackAttemptSchema,
1034
- FeedbackTrajectorySchema,
1035
- FeedbackIngestResponseSchema,
1036
- ErrorResponseSchema,
1037
- WIRE_VERSION,
1038
- hashRubric,
1039
- BUILTIN_RUBRICS,
1040
- getBuiltinRubric,
1041
- listBuiltinRubrics,
1042
- WireError,
1043
- handleJudge,
1044
- handleListRubrics,
1045
- handleVersion,
1046
- handleTracesIngest,
1047
- handleFeedbackIngest,
1048
- buildOpenApi,
1049
- dispatchRpc,
1050
- runRpcOnce,
1051
- runRpcBatch,
1052
- createApp,
1053
- startServer,
1054
- startServerAsync
1055
- };
1056
- //# sourceMappingURL=chunk-NY44NC4A.js.map