@tangle-network/agent-eval 0.129.0 → 0.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/dist/active-curriculum-C4mk67HP.js +214 -0
  4. package/dist/active-curriculum-C4mk67HP.js.map +1 -0
  5. package/dist/adversarial-smnADNFS.d.ts +21 -0
  6. package/dist/adversarial-smnADNFS.d.ts.map +1 -0
  7. package/dist/analyst/index.d.ts +81 -2872
  8. package/dist/analyst/index.d.ts.map +1 -0
  9. package/dist/analyst/index.js +319 -360
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/analyst-BkTS3C58.d.ts +89 -0
  12. package/dist/analyst-BkTS3C58.d.ts.map +1 -0
  13. package/dist/analyst-LsnNpSkm.js +152 -0
  14. package/dist/analyst-LsnNpSkm.js.map +1 -0
  15. package/dist/analyze-runs-C1CavBMk.js +1067 -0
  16. package/dist/analyze-runs-C1CavBMk.js.map +1 -0
  17. package/dist/analyze-runs-FsgYCinh.d.ts +72 -0
  18. package/dist/analyze-runs-FsgYCinh.d.ts.map +1 -0
  19. package/dist/attribute-vocabulary-DLJ6303h.d.ts +54 -0
  20. package/dist/attribute-vocabulary-DLJ6303h.d.ts.map +1 -0
  21. package/dist/authenticity/index.d.ts +81 -79
  22. package/dist/authenticity/index.d.ts.map +1 -0
  23. package/dist/authenticity/index.js +209 -193
  24. package/dist/authenticity/index.js.map +1 -1
  25. package/dist/baseline-HsBvw_dk.js +550 -0
  26. package/dist/baseline-HsBvw_dk.js.map +1 -0
  27. package/dist/baseline-hG3K85h4.d.ts +125 -0
  28. package/dist/baseline-hG3K85h4.d.ts.map +1 -0
  29. package/dist/belief-state/index.d.ts +448 -1188
  30. package/dist/belief-state/index.d.ts.map +1 -0
  31. package/dist/belief-state/index.js +1617 -1709
  32. package/dist/belief-state/index.js.map +1 -1
  33. package/dist/benchmarks/index.d.ts +2 -891
  34. package/dist/benchmarks/index.js +2 -60
  35. package/dist/benchmarks-DviOvUNr.js +754 -0
  36. package/dist/benchmarks-DviOvUNr.js.map +1 -0
  37. package/dist/builder-eval/index.d.ts +150 -662
  38. package/dist/builder-eval/index.d.ts.map +1 -0
  39. package/dist/builder-eval/index.js +356 -345
  40. package/dist/builder-eval/index.js.map +1 -1
  41. package/dist/calibration-CNWWA6K8.js +94 -0
  42. package/dist/calibration-CNWWA6K8.js.map +1 -0
  43. package/dist/campaign/index.d.ts +5 -6381
  44. package/dist/campaign/index.js +3 -213
  45. package/dist/campaign-CBKZvQ1H.js +3885 -0
  46. package/dist/campaign-CBKZvQ1H.js.map +1 -0
  47. package/dist/cli.d.ts +1 -1
  48. package/dist/cli.js +164 -175
  49. package/dist/cli.js.map +1 -1
  50. package/dist/client-C97NMzqi.d.ts +581 -0
  51. package/dist/client-C97NMzqi.d.ts.map +1 -0
  52. package/dist/client-CYzbdJOZ.js +637 -0
  53. package/dist/client-CYzbdJOZ.js.map +1 -0
  54. package/dist/code-agent-session-BjkMTQ7H.js +1390 -0
  55. package/dist/code-agent-session-BjkMTQ7H.js.map +1 -0
  56. package/dist/code-agent-session-DqqgOJaz.d.ts +143 -0
  57. package/dist/code-agent-session-DqqgOJaz.d.ts.map +1 -0
  58. package/dist/concurrency-DIxRZF_J.js +85 -0
  59. package/dist/concurrency-DIxRZF_J.js.map +1 -0
  60. package/dist/contract/index.d.ts +645 -5565
  61. package/dist/contract/index.d.ts.map +1 -0
  62. package/dist/contract/index.js +1730 -1938
  63. package/dist/contract/index.js.map +1 -1
  64. package/dist/control.d.ts +3 -1030
  65. package/dist/control.js +2 -33
  66. package/dist/cost-ledger-DIgQUFZZ.js +801 -0
  67. package/dist/cost-ledger-DIgQUFZZ.js.map +1 -0
  68. package/dist/cost-ledger-Dye6jCgg.d.ts +236 -0
  69. package/dist/cost-ledger-Dye6jCgg.d.ts.map +1 -0
  70. package/dist/dataset-BvtnC8Dc.d.ts +115 -0
  71. package/dist/dataset-BvtnC8Dc.d.ts.map +1 -0
  72. package/dist/default-registry-C-vFCSEc.js +2579 -0
  73. package/dist/default-registry-C-vFCSEc.js.map +1 -0
  74. package/dist/default-registry-CNPo-Vsb.d.ts +540 -0
  75. package/dist/default-registry-CNPo-Vsb.d.ts.map +1 -0
  76. package/dist/emitter-CPBAhxum.js +266 -0
  77. package/dist/emitter-CPBAhxum.js.map +1 -0
  78. package/dist/emitter-DGQGoLyj.d.ts +113 -0
  79. package/dist/emitter-DGQGoLyj.d.ts.map +1 -0
  80. package/dist/errors-8YnH8WlF.js +64 -0
  81. package/dist/errors-8YnH8WlF.js.map +1 -0
  82. package/dist/errors-CEk209JS.d.ts +76 -0
  83. package/dist/errors-CEk209JS.d.ts.map +1 -0
  84. package/dist/eval-campaign-DEm6c8ru.js +349 -0
  85. package/dist/eval-campaign-DEm6c8ru.js.map +1 -0
  86. package/dist/execution-tracks-CpgFPpS5.js +93 -0
  87. package/dist/execution-tracks-CpgFPpS5.js.map +1 -0
  88. package/dist/exporters-q9iL-2Jf.js +148 -0
  89. package/dist/exporters-q9iL-2Jf.js.map +1 -0
  90. package/dist/extract-usage-BrQ8mCLX.js +155 -0
  91. package/dist/extract-usage-BrQ8mCLX.js.map +1 -0
  92. package/dist/failure-cluster-CqcvCcdR.d.ts +59 -0
  93. package/dist/failure-cluster-CqcvCcdR.d.ts.map +1 -0
  94. package/dist/feedback-trajectory-CVaeREXV.d.ts +340 -0
  95. package/dist/feedback-trajectory-CVaeREXV.d.ts.map +1 -0
  96. package/dist/fuzz.d.ts +320 -646
  97. package/dist/fuzz.d.ts.map +1 -0
  98. package/dist/fuzz.js +670 -618
  99. package/dist/fuzz.js.map +1 -1
  100. package/dist/hf-dataset-DBJXXoY1.js +763 -0
  101. package/dist/hf-dataset-DBJXXoY1.js.map +1 -0
  102. package/dist/hosted/index.d.ts +11 -831
  103. package/dist/hosted/index.d.ts.map +1 -0
  104. package/dist/hosted/index.js +2 -37
  105. package/dist/index-2JJSA6-r2.d.ts +926 -0
  106. package/dist/index-2JJSA6-r2.d.ts.map +1 -0
  107. package/dist/index-6N0aYmpW.d.ts +217 -0
  108. package/dist/index-6N0aYmpW.d.ts.map +1 -0
  109. package/dist/index-BAvgST_9.d.ts +131 -0
  110. package/dist/index-BAvgST_9.d.ts.map +1 -0
  111. package/dist/index-BvnJuTGD.d.ts +68 -0
  112. package/dist/index-BvnJuTGD.d.ts.map +1 -0
  113. package/dist/index-C61Wi7yg.d.ts +547 -0
  114. package/dist/index-C61Wi7yg.d.ts.map +1 -0
  115. package/dist/index-CAPUUKaM.d.ts +335 -0
  116. package/dist/index-CAPUUKaM.d.ts.map +1 -0
  117. package/dist/index-DE5fb3EC.d.ts +2244 -0
  118. package/dist/index-DE5fb3EC.d.ts.map +1 -0
  119. package/dist/index-DSC51roc.d.ts +102 -0
  120. package/dist/index-DSC51roc.d.ts.map +1 -0
  121. package/dist/index.d.ts +3755 -15555
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.js +11182 -11216
  124. package/dist/index.js.map +1 -1
  125. package/dist/integrity-BzRbCHzi.js +424 -0
  126. package/dist/integrity-BzRbCHzi.js.map +1 -0
  127. package/dist/integrity-rmVhXWA7.d.ts +61 -0
  128. package/dist/integrity-rmVhXWA7.d.ts.map +1 -0
  129. package/dist/judge-calibration-DFtEMlde.d.ts +146 -0
  130. package/dist/judge-calibration-DFtEMlde.d.ts.map +1 -0
  131. package/dist/ledger-core/index.d.ts +2 -0
  132. package/dist/ledger-core/index.js +2 -0
  133. package/dist/ledger-core-DtZz1RG0.js +388 -0
  134. package/dist/ledger-core-DtZz1RG0.js.map +1 -0
  135. package/dist/llm-client--GR4JbZE.js +687 -0
  136. package/dist/llm-client--GR4JbZE.js.map +1 -0
  137. package/dist/llm-client-B_nIBlYo.d.ts +290 -0
  138. package/dist/llm-client-B_nIBlYo.d.ts.map +1 -0
  139. package/dist/matrix/index.d.ts +3 -155
  140. package/dist/matrix/index.js +2 -8
  141. package/dist/matrix-BzQnu2S6.js +270 -0
  142. package/dist/matrix-BzQnu2S6.js.map +1 -0
  143. package/dist/meta-eval/index.d.ts +4 -1027
  144. package/dist/meta-eval/index.js +393 -390
  145. package/dist/meta-eval/index.js.map +1 -1
  146. package/dist/metrics-C9YY1OcL.js +239 -0
  147. package/dist/metrics-C9YY1OcL.js.map +1 -0
  148. package/dist/mint-yN2M2eh0.js +201 -0
  149. package/dist/mint-yN2M2eh0.js.map +1 -0
  150. package/dist/multi-layer-verifier-BHY1gWAc.d.ts +138 -0
  151. package/dist/multi-layer-verifier-BHY1gWAc.d.ts.map +1 -0
  152. package/dist/multishot/index.d.ts +273 -480
  153. package/dist/multishot/index.d.ts.map +1 -0
  154. package/dist/multishot/index.js +595 -548
  155. package/dist/multishot/index.js.map +1 -1
  156. package/dist/off-policy-DvgzvtIx.js +220 -0
  157. package/dist/off-policy-DvgzvtIx.js.map +1 -0
  158. package/dist/off-policy-mskQw8Mb.d.ts +153 -0
  159. package/dist/off-policy-mskQw8Mb.d.ts.map +1 -0
  160. package/dist/openapi.json +1 -1
  161. package/dist/opencode-sqlite-BGrHeDu3.js +318 -0
  162. package/dist/opencode-sqlite-BGrHeDu3.js.map +1 -0
  163. package/dist/outcome-store-BYHIuO0e.d.ts +65 -0
  164. package/dist/outcome-store-BYHIuO0e.d.ts.map +1 -0
  165. package/dist/outcome-store-ChBKlTd_.js +75 -0
  166. package/dist/outcome-store-ChBKlTd_.js.map +1 -0
  167. package/dist/paired-arms-D9D0wXj2.js +260 -0
  168. package/dist/paired-arms-D9D0wXj2.js.map +1 -0
  169. package/dist/pipelines/index.d.ts +95 -532
  170. package/dist/pipelines/index.d.ts.map +1 -0
  171. package/dist/pipelines/index.js +497 -478
  172. package/dist/pipelines/index.js.map +1 -1
  173. package/dist/pre-registration-DakwTRXk.js +96 -0
  174. package/dist/pre-registration-DakwTRXk.js.map +1 -0
  175. package/dist/propose-review-control-LhIWGzHl.js +1458 -0
  176. package/dist/propose-review-control-LhIWGzHl.js.map +1 -0
  177. package/dist/query-CJ_DX8vl.d.ts +28 -0
  178. package/dist/query-CJ_DX8vl.d.ts.map +1 -0
  179. package/dist/query-Di7eEQ79.js +83 -0
  180. package/dist/query-Di7eEQ79.js.map +1 -0
  181. package/dist/raw-provider-sink-BQd7mzyT.js +201 -0
  182. package/dist/raw-provider-sink-BQd7mzyT.js.map +1 -0
  183. package/dist/raw-provider-sink-BU29Sh8h.d.ts +134 -0
  184. package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +1 -0
  185. package/dist/redact-7Aq1ukl-.js +107 -0
  186. package/dist/redact-7Aq1ukl-.js.map +1 -0
  187. package/dist/release-report-Cz9NKH39.js +603 -0
  188. package/dist/release-report-Cz9NKH39.js.map +1 -0
  189. package/dist/release-report-mvB2G4_J.d.ts +244 -0
  190. package/dist/release-report-mvB2G4_J.d.ts.map +1 -0
  191. package/dist/replay-GnyotH0J.js +1741 -0
  192. package/dist/replay-GnyotH0J.js.map +1 -0
  193. package/dist/replay-OoidtG1E.d.ts +749 -0
  194. package/dist/replay-OoidtG1E.d.ts.map +1 -0
  195. package/dist/reporting.d.ts +6 -1312
  196. package/dist/reporting.js +6 -51
  197. package/dist/researcher-CwTdwXG1.d.ts +314 -0
  198. package/dist/researcher-CwTdwXG1.d.ts.map +1 -0
  199. package/dist/reward-hacking-eAnOsynk.d.ts +224 -0
  200. package/dist/reward-hacking-eAnOsynk.d.ts.map +1 -0
  201. package/dist/reward-hacking-qipEpKvY.js +596 -0
  202. package/dist/reward-hacking-qipEpKvY.js.map +1 -0
  203. package/dist/reward-nw2xZGZG.js +137 -0
  204. package/dist/reward-nw2xZGZG.js.map +1 -0
  205. package/dist/rl.d.ts +760 -4010
  206. package/dist/rl.d.ts.map +1 -0
  207. package/dist/rl.js +2325 -1958
  208. package/dist/rl.js.map +1 -1
  209. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  210. package/dist/rollout/index.d.ts +3 -2087
  211. package/dist/rollout/index.js +8 -168
  212. package/dist/rollout-BOYjemfR.js +624 -0
  213. package/dist/rollout-BOYjemfR.js.map +1 -0
  214. package/dist/rubric-predictive-validity-B3xmbmS1.js +141 -0
  215. package/dist/rubric-predictive-validity-B3xmbmS1.js.map +1 -0
  216. package/dist/rubric-predictive-validity-Ku_clp_1.d.ts +74 -0
  217. package/dist/rubric-predictive-validity-Ku_clp_1.d.ts.map +1 -0
  218. package/dist/run-evidence-ClRX_8A9.d.ts +225 -0
  219. package/dist/run-evidence-ClRX_8A9.d.ts.map +1 -0
  220. package/dist/run-record-BuoE80Dq.js +467 -0
  221. package/dist/{chunk-56TAVBOK.js.map → run-record-BuoE80Dq.js.map} +1 -1
  222. package/dist/run-record-CnZu_gjl.d.ts +357 -0
  223. package/dist/run-record-CnZu_gjl.d.ts.map +1 -0
  224. package/dist/run-score-iEEAWiBY.js +41 -0
  225. package/dist/run-score-iEEAWiBY.js.map +1 -0
  226. package/dist/runtime-trajectory-1gyaTOoC.js +93 -0
  227. package/dist/runtime-trajectory-1gyaTOoC.js.map +1 -0
  228. package/dist/runtime-trajectory-BvSZcCHD.d.ts +50 -0
  229. package/dist/runtime-trajectory-BvSZcCHD.d.ts.map +1 -0
  230. package/dist/schema-BtVldJ3T.d.ts +206 -0
  231. package/dist/schema-BtVldJ3T.d.ts.map +1 -0
  232. package/dist/schema-C6DW4ZHR.js +821 -0
  233. package/dist/schema-C6DW4ZHR.js.map +1 -0
  234. package/dist/schema-CRhEY1SO.js +69 -0
  235. package/dist/schema-CRhEY1SO.js.map +1 -0
  236. package/dist/schema-Cef2cFmb.d.ts +408 -0
  237. package/dist/schema-Cef2cFmb.d.ts.map +1 -0
  238. package/dist/semantic-concept-judge-B6cWNJ2K.js +725 -0
  239. package/dist/semantic-concept-judge-B6cWNJ2K.js.map +1 -0
  240. package/dist/sequential-Br0mAPHA.js +148 -0
  241. package/dist/sequential-Br0mAPHA.js.map +1 -0
  242. package/dist/sequential-CYwq6Ff_.d.ts +141 -0
  243. package/dist/sequential-CYwq6Ff_.d.ts.map +1 -0
  244. package/dist/series-convergence-CjO2QdRW.js +43 -0
  245. package/dist/series-convergence-CjO2QdRW.js.map +1 -0
  246. package/dist/series-convergence-ofsqPWhs.d.ts +35 -0
  247. package/dist/series-convergence-ofsqPWhs.d.ts.map +1 -0
  248. package/dist/server-m5D9cvnG.js +1040 -0
  249. package/dist/server-m5D9cvnG.js.map +1 -0
  250. package/dist/skill-usage-C_pXm7lP.d.ts +534 -0
  251. package/dist/skill-usage-C_pXm7lP.d.ts.map +1 -0
  252. package/dist/skillopt-optimization-method-B7wX7XkF.d.ts +1739 -0
  253. package/dist/skillopt-optimization-method-B7wX7XkF.d.ts.map +1 -0
  254. package/dist/skillopt-optimization-method-D4ODwFVV.js +7712 -0
  255. package/dist/skillopt-optimization-method-D4ODwFVV.js.map +1 -0
  256. package/dist/statistics-Cmj6nynr.d.ts +514 -0
  257. package/dist/statistics-Cmj6nynr.d.ts.map +1 -0
  258. package/dist/statistics-CnnxdpOg.js +1437 -0
  259. package/dist/statistics-CnnxdpOg.js.map +1 -0
  260. package/dist/store-CT9YIIve.d.ts +117 -0
  261. package/dist/store-CT9YIIve.d.ts.map +1 -0
  262. package/dist/store-CxJry_cs.d.ts +229 -0
  263. package/dist/store-CxJry_cs.d.ts.map +1 -0
  264. package/dist/storyboard/index.d.ts +84 -203
  265. package/dist/storyboard/index.d.ts.map +1 -0
  266. package/dist/storyboard/index.js +609 -542
  267. package/dist/storyboard/index.js.map +1 -1
  268. package/dist/summary-report-BNs5nmXI.js +862 -0
  269. package/dist/summary-report-BNs5nmXI.js.map +1 -0
  270. package/dist/summary-report-Cj9gdw4i.d.ts +407 -0
  271. package/dist/summary-report-Cj9gdw4i.d.ts.map +1 -0
  272. package/dist/supervisor-run/index.d.ts +2 -959
  273. package/dist/supervisor-run/index.js +2 -65
  274. package/dist/supervisor-run-_lnTLM3z.js +1679 -0
  275. package/dist/supervisor-run-_lnTLM3z.js.map +1 -0
  276. package/dist/task-failure-attributes-CQZlB3et.js +311 -0
  277. package/dist/task-failure-attributes-CQZlB3et.js.map +1 -0
  278. package/dist/test-graded-scenario-BsqWLmPt.js +318 -0
  279. package/dist/test-graded-scenario-BsqWLmPt.js.map +1 -0
  280. package/dist/test-graded-scenario-D1TaI2va.d.ts +141 -0
  281. package/dist/test-graded-scenario-D1TaI2va.d.ts.map +1 -0
  282. package/dist/tools-BmuN627J.js +1085 -0
  283. package/dist/tools-BmuN627J.js.map +1 -0
  284. package/dist/trace-attributes.d.ts +2 -52
  285. package/dist/trace-attributes.js +131 -61
  286. package/dist/trace-attributes.js.map +1 -1
  287. package/dist/traces.d.ts +12 -2365
  288. package/dist/traces.js +12 -252
  289. package/dist/trajectory-D_7rLrvE.js +56 -0
  290. package/dist/trajectory-D_7rLrvE.js.map +1 -0
  291. package/dist/types-DGsxbAEd.d.ts +387 -0
  292. package/dist/types-DGsxbAEd.d.ts.map +1 -0
  293. package/dist/types-k9tZGKUg.d.ts +640 -0
  294. package/dist/types-k9tZGKUg.d.ts.map +1 -0
  295. package/dist/verdict-Dps8_okt.d.ts +37 -0
  296. package/dist/verdict-Dps8_okt.d.ts.map +1 -0
  297. package/dist/wire/index.d.ts +702 -1173
  298. package/dist/wire/index.d.ts.map +1 -0
  299. package/dist/wire/index.js +2 -81
  300. package/package.json +17 -9
  301. package/dist/benchmarks/index.js.map +0 -1
  302. package/dist/campaign/index.js.map +0 -1
  303. package/dist/chunk-2QU3YOPR.js +0 -7374
  304. package/dist/chunk-2QU3YOPR.js.map +0 -1
  305. package/dist/chunk-3OCR4R5I.js +0 -728
  306. package/dist/chunk-3OCR4R5I.js.map +0 -1
  307. package/dist/chunk-3RF76KTD.js +0 -84
  308. package/dist/chunk-3RF76KTD.js.map +0 -1
  309. package/dist/chunk-56TAVBOK.js +0 -698
  310. package/dist/chunk-5DTSBUL2.js +0 -159
  311. package/dist/chunk-5DTSBUL2.js.map +0 -1
  312. package/dist/chunk-7FO3TNPI.js +0 -232
  313. package/dist/chunk-7FO3TNPI.js.map +0 -1
  314. package/dist/chunk-7ZZMD7UK.js +0 -386
  315. package/dist/chunk-7ZZMD7UK.js.map +0 -1
  316. package/dist/chunk-BOD4O7OF.js +0 -40
  317. package/dist/chunk-BOD4O7OF.js.map +0 -1
  318. package/dist/chunk-BSO5JDQH.js +0 -2335
  319. package/dist/chunk-BSO5JDQH.js.map +0 -1
  320. package/dist/chunk-C6LXANRU.js +0 -1550
  321. package/dist/chunk-C6LXANRU.js.map +0 -1
  322. package/dist/chunk-DODXQREJ.js +0 -752
  323. package/dist/chunk-DODXQREJ.js.map +0 -1
  324. package/dist/chunk-DRYIUNWY.js +0 -622
  325. package/dist/chunk-DRYIUNWY.js.map +0 -1
  326. package/dist/chunk-E7QXT7SX.js +0 -183
  327. package/dist/chunk-E7QXT7SX.js.map +0 -1
  328. package/dist/chunk-EG66UGL4.js +0 -341
  329. package/dist/chunk-EG66UGL4.js.map +0 -1
  330. package/dist/chunk-FXTVJPYD.js +0 -576
  331. package/dist/chunk-FXTVJPYD.js.map +0 -1
  332. package/dist/chunk-G7MGMCZD.js +0 -153
  333. package/dist/chunk-G7MGMCZD.js.map +0 -1
  334. package/dist/chunk-GGE4NNQT.js +0 -65
  335. package/dist/chunk-GGE4NNQT.js.map +0 -1
  336. package/dist/chunk-H23X7XKK.js +0 -181
  337. package/dist/chunk-H23X7XKK.js.map +0 -1
  338. package/dist/chunk-HHWE3POT.js +0 -94
  339. package/dist/chunk-HHWE3POT.js.map +0 -1
  340. package/dist/chunk-HPWUNB47.js +0 -289
  341. package/dist/chunk-HPWUNB47.js.map +0 -1
  342. package/dist/chunk-IYCLP2N2.js +0 -766
  343. package/dist/chunk-IYCLP2N2.js.map +0 -1
  344. package/dist/chunk-JHCHEVET.js +0 -274
  345. package/dist/chunk-JHCHEVET.js.map +0 -1
  346. package/dist/chunk-JQSF5DQT.js +0 -701
  347. package/dist/chunk-JQSF5DQT.js.map +0 -1
  348. package/dist/chunk-K4DBDHLK.js +0 -158
  349. package/dist/chunk-K4DBDHLK.js.map +0 -1
  350. package/dist/chunk-K6N6XJJX.js +0 -306
  351. package/dist/chunk-K6N6XJJX.js.map +0 -1
  352. package/dist/chunk-M4YBQKIJ.js +0 -1040
  353. package/dist/chunk-M4YBQKIJ.js.map +0 -1
  354. package/dist/chunk-MA6HLL3S.js +0 -65
  355. package/dist/chunk-MA6HLL3S.js.map +0 -1
  356. package/dist/chunk-MAZ26DC7.js +0 -99
  357. package/dist/chunk-MAZ26DC7.js.map +0 -1
  358. package/dist/chunk-NPCTHQIO.js +0 -91
  359. package/dist/chunk-NPCTHQIO.js.map +0 -1
  360. package/dist/chunk-NY44NC4A.js +0 -1056
  361. package/dist/chunk-NY44NC4A.js.map +0 -1
  362. package/dist/chunk-OIUOT4QD.js +0 -44
  363. package/dist/chunk-OIUOT4QD.js.map +0 -1
  364. package/dist/chunk-ONWEPEDO.js +0 -57
  365. package/dist/chunk-ONWEPEDO.js.map +0 -1
  366. package/dist/chunk-OWN5NPMC.js +0 -152
  367. package/dist/chunk-OWN5NPMC.js.map +0 -1
  368. package/dist/chunk-P6FYH6K4.js +0 -1161
  369. package/dist/chunk-P6FYH6K4.js.map +0 -1
  370. package/dist/chunk-PC4UYEBM.js +0 -166
  371. package/dist/chunk-PC4UYEBM.js.map +0 -1
  372. package/dist/chunk-PC5DOSM7.js +0 -579
  373. package/dist/chunk-PC5DOSM7.js.map +0 -1
  374. package/dist/chunk-PXE2VKMX.js +0 -140
  375. package/dist/chunk-PXE2VKMX.js.map +0 -1
  376. package/dist/chunk-PZ5AY32C.js +0 -10
  377. package/dist/chunk-PZ5AY32C.js.map +0 -1
  378. package/dist/chunk-QB6BDBP2.js +0 -4464
  379. package/dist/chunk-QB6BDBP2.js.map +0 -1
  380. package/dist/chunk-RXHCETDZ.js +0 -536
  381. package/dist/chunk-RXHCETDZ.js.map +0 -1
  382. package/dist/chunk-RZTMDUO7.js +0 -49
  383. package/dist/chunk-RZTMDUO7.js.map +0 -1
  384. package/dist/chunk-SFLLL76A.js +0 -669
  385. package/dist/chunk-SFLLL76A.js.map +0 -1
  386. package/dist/chunk-SZLVEKMJ.js +0 -1446
  387. package/dist/chunk-SZLVEKMJ.js.map +0 -1
  388. package/dist/chunk-T4SQEITX.js +0 -95
  389. package/dist/chunk-T4SQEITX.js.map +0 -1
  390. package/dist/chunk-T6RLYGAD.js +0 -158
  391. package/dist/chunk-T6RLYGAD.js.map +0 -1
  392. package/dist/chunk-TJVT4QFF.js +0 -911
  393. package/dist/chunk-TJVT4QFF.js.map +0 -1
  394. package/dist/chunk-TQ7LNKZ3.js +0 -136
  395. package/dist/chunk-TQ7LNKZ3.js.map +0 -1
  396. package/dist/chunk-U4L7JRPZ.js +0 -1706
  397. package/dist/chunk-U4L7JRPZ.js.map +0 -1
  398. package/dist/chunk-U4PHLT2N.js +0 -419
  399. package/dist/chunk-U4PHLT2N.js.map +0 -1
  400. package/dist/chunk-VCZ5FQYW.js +0 -928
  401. package/dist/chunk-VCZ5FQYW.js.map +0 -1
  402. package/dist/chunk-VI2UW6B6.js +0 -162
  403. package/dist/chunk-VI2UW6B6.js.map +0 -1
  404. package/dist/chunk-VQMK5FMP.js +0 -247
  405. package/dist/chunk-VQMK5FMP.js.map +0 -1
  406. package/dist/chunk-WGXIEX7P.js +0 -116
  407. package/dist/chunk-WGXIEX7P.js.map +0 -1
  408. package/dist/chunk-WVATSFCP.js +0 -1553
  409. package/dist/chunk-WVATSFCP.js.map +0 -1
  410. package/dist/chunk-X4YIBDER.js +0 -1662
  411. package/dist/chunk-X4YIBDER.js.map +0 -1
  412. package/dist/chunk-YQN4ICPP.js +0 -355
  413. package/dist/chunk-YQN4ICPP.js.map +0 -1
  414. package/dist/chunk-ZET2UAYW.js +0 -89
  415. package/dist/chunk-ZET2UAYW.js.map +0 -1
  416. package/dist/chunk-ZHTZ4EYI.js +0 -1212
  417. package/dist/chunk-ZHTZ4EYI.js.map +0 -1
  418. package/dist/control.js.map +0 -1
  419. package/dist/hosted/index.js.map +0 -1
  420. package/dist/matrix/index.js.map +0 -1
  421. package/dist/reporting.js.map +0 -1
  422. package/dist/rollout/index.js.map +0 -1
  423. package/dist/run-campaign-OJJ7CZF4.js +0 -18
  424. package/dist/run-campaign-OJJ7CZF4.js.map +0 -1
  425. package/dist/supervisor-run/index.js.map +0 -1
  426. package/dist/traces.js.map +0 -1
  427. package/dist/wire/index.js.map +0 -1
@@ -1,752 +0,0 @@
1
- import {
2
- computeFindingId
3
- } from "./chunk-BSO5JDQH.js";
4
- import {
5
- Mutex,
6
- aggregateRunScore,
7
- clamp01
8
- } from "./chunk-WGXIEX7P.js";
9
- import {
10
- callLlmJson,
11
- costReceiptFromLlm,
12
- costReceiptFromLlmError,
13
- maximumChargeForLlmRequest
14
- } from "./chunk-SFLLL76A.js";
15
- import {
16
- CostLedger
17
- } from "./chunk-VCZ5FQYW.js";
18
- import {
19
- NotFoundError
20
- } from "./chunk-ONWEPEDO.js";
21
-
22
- // src/locked-jsonl-appender.ts
23
- import { appendFileSync, existsSync, mkdirSync } from "fs";
24
- import { dirname } from "path";
25
- var mutexes = /* @__PURE__ */ new Map();
26
- function getMutex(path) {
27
- let m = mutexes.get(path);
28
- if (!m) {
29
- m = new Mutex();
30
- mutexes.set(path, m);
31
- }
32
- return m;
33
- }
34
- var LockedJsonlAppender = class {
35
- constructor(path) {
36
- this.path = path;
37
- this.mutex = getMutex(path);
38
- if (!existsSync(dirname(path))) {
39
- mkdirSync(dirname(path), { recursive: true });
40
- }
41
- }
42
- path;
43
- mutex;
44
- async append(entry) {
45
- const line = `${JSON.stringify(entry)}
46
- `;
47
- await this.mutex.runExclusive(() => {
48
- appendFileSync(this.path, line);
49
- });
50
- }
51
- };
52
-
53
- // src/analyst/findings-store.ts
54
- import { existsSync as existsSync2, readFileSync } from "fs";
55
- var FindingsStore = class {
56
- constructor(path) {
57
- this.path = path;
58
- this.appender = new LockedJsonlAppender(path);
59
- }
60
- path;
61
- appender;
62
- async append(runId, findings) {
63
- for (const f of findings) {
64
- const row = { ...f, run_id: runId };
65
- await this.appender.append(row);
66
- }
67
- }
68
- /** Load every persisted finding. Discards malformed trailing lines silently. */
69
- loadAll() {
70
- if (!existsSync2(this.path)) return [];
71
- const raw = readFileSync(this.path, "utf8");
72
- if (!raw) return [];
73
- const out = [];
74
- for (const line of raw.split("\n")) {
75
- if (!line) continue;
76
- try {
77
- out.push(JSON.parse(line));
78
- } catch {
79
- }
80
- }
81
- return out;
82
- }
83
- /** Filter to a single run. */
84
- loadRun(runId) {
85
- return this.loadAll().filter((r) => r.run_id === runId);
86
- }
87
- };
88
- function defaultIsMaterial(a, b) {
89
- if (a.severity !== b.severity) return true;
90
- if (Math.abs((a.confidence ?? 0) - (b.confidence ?? 0)) > 0.05) return true;
91
- if (a.evidence_refs.length !== b.evidence_refs.length) return true;
92
- return false;
93
- }
94
- function diffFindings(previous, current, policy = {}) {
95
- const isMaterial = policy.isMaterial ?? defaultIsMaterial;
96
- const prevById = new Map(previous.map((f) => [f.finding_id, f]));
97
- const curById = new Map(current.map((f) => [f.finding_id, f]));
98
- const appeared = [];
99
- const disappeared = [];
100
- const persisted = [];
101
- const changed = [];
102
- for (const [id, cur] of curById) {
103
- const prev = prevById.get(id);
104
- if (!prev) {
105
- appeared.push(cur);
106
- continue;
107
- }
108
- if (isMaterial(prev, cur)) {
109
- changed.push({ previous: prev, current: cur });
110
- } else {
111
- persisted.push(cur);
112
- }
113
- }
114
- for (const [id, prev] of prevById) {
115
- if (!curById.has(id)) disappeared.push(prev);
116
- }
117
- return { appeared, disappeared, persisted, changed };
118
- }
119
-
120
- // src/analyst/kinds/skill-usage.ts
121
- import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
122
- import { join } from "path";
123
- var BLOAT_LINE_THRESHOLD = 300;
124
- var TANGLE_PRIVATE_RE = /\b(cli-bridge|tangletools|ops-board|drew-gtr-pro|@tangle-network\/|~\/company|tangle\.tools|gtm-agent)\b|\bkimi\b|\btcloud\b/gi;
125
- var TRIGGER_RE = /triggers?\s*[:-]/i;
126
- function listSkillDirs(root) {
127
- if (!existsSync3(root)) return [];
128
- const out = [];
129
- for (const entry of readdirSync(root, { withFileTypes: true })) {
130
- if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
131
- const skillMd = join(root, entry.name, "SKILL.md");
132
- if (existsSync3(skillMd)) out.push({ name: entry.name, path: skillMd });
133
- }
134
- return out;
135
- }
136
- function walkJsonl(dir, cap) {
137
- if (!existsSync3(dir)) return [];
138
- const files = [];
139
- const stack = [dir];
140
- while (stack.length) {
141
- const cur = stack.pop();
142
- let entries;
143
- try {
144
- entries = readdirSync(cur, { withFileTypes: true });
145
- } catch {
146
- continue;
147
- }
148
- for (const e of entries) {
149
- const full = join(cur, e.name);
150
- if (e.isDirectory()) stack.push(full);
151
- else if (e.name.endsWith(".jsonl")) {
152
- files.push(full);
153
- if (cap > 0 && files.length >= cap) return files;
154
- }
155
- }
156
- }
157
- return files;
158
- }
159
- function frontmatterDescription(body) {
160
- const fm = /^---\n([\s\S]*?)\n---/.exec(body);
161
- const block = fm?.[1] ?? "";
162
- const m = /description:\s*(.+)/i.exec(block);
163
- return m?.[1] ?? "";
164
- }
165
- function countArtifacts(roots, name, aliases) {
166
- let n = 0;
167
- for (const root of roots) {
168
- const candidates = [join(root, ".evolve", name), ...aliases.map((a) => join(root, a))];
169
- for (const dir of candidates) {
170
- if (!existsSync3(dir)) continue;
171
- try {
172
- if (statSync(dir).isDirectory()) n += readdirSync(dir).length;
173
- else n += 1;
174
- } catch {
175
- }
176
- }
177
- }
178
- return n;
179
- }
180
- function buildSkillUsageReport(config) {
181
- const skills = config.skillRoots.flatMap(
182
- ({ root, kind }) => listSkillDirs(root).map((s) => ({ ...s, kind }))
183
- );
184
- const names = skills.map((s) => s.name);
185
- const direct = new Map(names.map((n) => [n, 0]));
186
- const slash = new Map(names.map((n) => [n, 0]));
187
- const skillRe = /"skill"\s*:\s*"([a-z0-9_:-]+)"/g;
188
- const cmdRe = /<command-name>\/?([a-z0-9_:-]+)<\/command-name>/g;
189
- let transcripts = 0;
190
- for (const dir of config.transcriptDirs) {
191
- for (const file of walkJsonl(dir, config.maxTranscriptsPerDir ?? 0)) {
192
- transcripts += 1;
193
- let data;
194
- try {
195
- data = readFileSync2(file, "utf8");
196
- } catch {
197
- continue;
198
- }
199
- for (const m of data.matchAll(skillRe)) {
200
- const g = m[1];
201
- if (!g) continue;
202
- const n = g.split(":").pop() ?? g;
203
- const prev = direct.get(n);
204
- if (prev !== void 0) direct.set(n, prev + 1);
205
- }
206
- for (const m of data.matchAll(cmdRe)) {
207
- const g = m[1];
208
- if (g === void 0) continue;
209
- const prev = slash.get(g);
210
- if (prev !== void 0) slash.set(g, prev + 1);
211
- }
212
- }
213
- }
214
- const bodies = /* @__PURE__ */ new Map();
215
- for (const s of skills) {
216
- try {
217
- bodies.set(s.name, readFileSync2(s.path, "utf8"));
218
- } catch {
219
- bodies.set(s.name, "");
220
- }
221
- }
222
- const inbound = new Map(names.map((n) => [n, 0]));
223
- for (const target of names) {
224
- const ref = new RegExp(`/${target}\\b|\\[\\[${target}\\]\\]`);
225
- for (const s of skills) {
226
- if (s.name === target) continue;
227
- if (ref.test(bodies.get(s.name) ?? "")) inbound.set(target, inbound.get(target) + 1);
228
- }
229
- }
230
- const records = skills.map((s) => {
231
- const body = bodies.get(s.name) ?? "";
232
- const dir = s.path.replace(/\/SKILL\.md$/, "");
233
- return {
234
- name: s.name,
235
- kind: s.kind,
236
- path: s.path,
237
- lines: body ? body.split("\n").length : 0,
238
- directInvocations: direct.get(s.name) ?? 0,
239
- slashInvocations: slash.get(s.name) ?? 0,
240
- inboundRefs: inbound.get(s.name) ?? 0,
241
- artifactCount: countArtifacts(
242
- config.artifactRoots ?? [],
243
- s.name,
244
- config.artifactAliases?.[s.name] ?? []
245
- ),
246
- tanglePrivateRefs: (body.match(TANGLE_PRIVATE_RE) ?? []).length,
247
- hasReferencesDir: existsSync3(join(dir, "references")),
248
- hasEvalsDir: existsSync3(join(dir, "evals")),
249
- logsRuns: body.includes("skill-runs.jsonl"),
250
- hasTriggerPhrases: TRIGGER_RE.test(frontmatterDescription(body) || body.slice(0, 600))
251
- };
252
- });
253
- return { generatedFromTraces: transcripts, records };
254
- }
255
- var ANALYST_ID = "skill-usage";
256
- function finding(area, subject, claim, severity, confidence, producedAt, recommended, evidenceUri, rationale) {
257
- return {
258
- schema_version: "1.0.0",
259
- finding_id: computeFindingId({ analyst_id: ANALYST_ID, area, subject, claim }),
260
- analyst_id: ANALYST_ID,
261
- produced_at: producedAt,
262
- severity,
263
- area,
264
- claim,
265
- rationale,
266
- evidence_refs: [{ kind: "artifact", uri: evidenceUri }],
267
- recommended_action: recommended,
268
- confidence,
269
- subject
270
- };
271
- }
272
- function emitSkillUsageFindings(report, producedAt) {
273
- const out = [];
274
- for (const r of report.records) {
275
- const directTotal = r.directInvocations + r.slashInvocations;
276
- const trueUsage = directTotal + r.inboundRefs + r.artifactCount;
277
- if (trueUsage === 0) {
278
- out.push(
279
- finding(
280
- "skill-usage",
281
- r.name,
282
- `Skill '${r.name}' has zero usage across all signals (direct, slash, inbound-refs, artifacts)`,
283
- "high",
284
- 0.6,
285
- producedAt,
286
- "Confirm the skill covers a real recurring job; if not, deprecate. Zero true usage is the only deterministic deprecation candidate.",
287
- r.path,
288
- "No Skill-tool call, no slash invocation, no sibling dispatches to it, and no on-disk artifacts."
289
- )
290
- );
291
- } else if (directTotal === 0 && r.inboundRefs + r.artifactCount > 0) {
292
- out.push(
293
- finding(
294
- "skill-usage",
295
- r.name,
296
- `Skill '${r.name}' shows 0 direct invocations but is used via orchestration/artifacts (inbound=${r.inboundRefs}, artifacts=${r.artifactCount})`,
297
- "info",
298
- 0.8,
299
- producedAt,
300
- "Do NOT treat as unused \u2014 usage is real but logged under parent skills or on disk. Strengthen direct-invocation discovery only if direct use is desired.",
301
- r.path,
302
- "The Skill-tool counter undercounts orchestrated/chained leaf skills."
303
- )
304
- );
305
- }
306
- if (directTotal <= 2 && !r.hasTriggerPhrases) {
307
- out.push(
308
- finding(
309
- "discoverability",
310
- r.name,
311
- `Skill '${r.name}' is rarely invoked directly and its description has no explicit trigger phrases`,
312
- "medium",
313
- 0.7,
314
- producedAt,
315
- "Add a `Triggers:` clause with verbatim user phrases to the frontmatter description so the model auto-invokes it.",
316
- r.path
317
- )
318
- );
319
- }
320
- if (r.kind === "public" && r.tanglePrivateRefs > 0) {
321
- out.push(
322
- finding(
323
- "safety",
324
- r.name,
325
- `Public skill '${r.name}' carries ${r.tanglePrivateRefs} Tangle-private reference(s)`,
326
- "high",
327
- 0.75,
328
- producedAt,
329
- "Sanitize incidental internal refs (cli-bridge/kimi/tcloud/~company/private repos) or relocate to a private repo. Verify @tangle-network/* refs are to PUBLISHED packages before treating as a leak.",
330
- r.path
331
- )
332
- );
333
- }
334
- if (r.lines > BLOAT_LINE_THRESHOLD && !r.hasReferencesDir) {
335
- out.push(
336
- finding(
337
- "maintainability",
338
- r.name,
339
- `Skill '${r.name}' is ${r.lines} lines with no references/ split (progressive disclosure)`,
340
- "medium",
341
- 0.8,
342
- producedAt,
343
- `Split detail into references/ loaded on demand; keep SKILL.md a short overview. ${r.lines} lines load into every session's context budget.`,
344
- r.path
345
- )
346
- );
347
- }
348
- if (!r.hasEvalsDir) {
349
- out.push(
350
- finding(
351
- "data-quality",
352
- r.name,
353
- `Skill '${r.name}' ships no evals/`,
354
- "low",
355
- 0.6,
356
- producedAt,
357
- "Add evals/evals.json with >=3 scenarios proving the skill beats baseline; gives regression coverage.",
358
- r.path
359
- )
360
- );
361
- }
362
- if (!r.logsRuns) {
363
- out.push(
364
- finding(
365
- "observability",
366
- r.name,
367
- `Skill '${r.name}' never appends to .evolve/skill-runs.jsonl`,
368
- "low",
369
- 0.55,
370
- producedAt,
371
- "Append one run line to .evolve/skill-runs.jsonl on completion, or declare it a non-logging leaf, so the self-improvement loop can see it ran.",
372
- r.path
373
- )
374
- );
375
- }
376
- }
377
- return out;
378
- }
379
- var SkillUsageAnalyst = class {
380
- id = ANALYST_ID;
381
- description = "Deterministic multi-signal skill-usage analysis: flags dead skills, measurement-invisible (orchestrated) usage, discovery gaps, public-repo leaks, bloat, missing evals, and missing run-logging.";
382
- inputKind = "custom";
383
- cost = { kind: "deterministic", est_usd_per_run: 0 };
384
- version = "1.0.0";
385
- async analyze(input, ctx) {
386
- const producedAt = ctx.tags?.producedAt ?? (/* @__PURE__ */ new Date()).toISOString();
387
- ctx.log?.(
388
- `skill-usage: ${input.records.length} skills over ${input.generatedFromTraces} transcripts`
389
- );
390
- return emitSkillUsageFindings(input, producedAt);
391
- }
392
- };
393
- var SKILL_USAGE_ANALYST = new SkillUsageAnalyst();
394
-
395
- // src/run-critic.ts
396
- var DEFAULT_DRIFT_PATTERNS = [
397
- /https?:\/\//i,
398
- /\btitle:\s/i,
399
- /\bsummary:\s/i,
400
- /\burl:\s/i,
401
- /\bnpm package usage\b/i,
402
- /\bnews\b/i
403
- ];
404
- var RunCritic = class {
405
- weights;
406
- driftPatterns;
407
- constructor(options = {}) {
408
- this.weights = options.weights;
409
- this.driftPatterns = options.driftPatterns ?? DEFAULT_DRIFT_PATTERNS;
410
- }
411
- async score(store, runId) {
412
- const run = await store.getRun(runId);
413
- if (!run) throw new NotFoundError(`run ${runId} not found`);
414
- const [spans, events, artifacts, budget] = await Promise.all([
415
- store.spans({ runId }),
416
- store.events({ runId }),
417
- store.artifacts(runId),
418
- store.budget(runId)
419
- ]);
420
- return this.scoreTrace({ run, spans, events, artifacts, budget });
421
- }
422
- scoreTrace(trace) {
423
- const notes = [];
424
- const llmSpans = trace.spans.filter(
425
- (s) => s.kind === "llm"
426
- );
427
- const toolSpans = trace.spans.filter(
428
- (s) => s.kind === "tool"
429
- );
430
- const judgeSpans = trace.spans.filter(
431
- (s) => s.kind === "judge"
432
- );
433
- const sandboxSpans = trace.spans.filter(
434
- (s) => s.kind === "sandbox"
435
- );
436
- const finalGateSpans = judgeSpans.filter(
437
- (span) => span.dimension === "final_gate" || span.attributes?.finalGate === true
438
- );
439
- const success = trace.run.outcome?.pass === true ? 1 : trace.run.status === "completed" ? 0.5 : 0;
440
- if (!success) notes.push("run did not complete with pass=true");
441
- const judgeAverage = judgeSpans.length ? judgeSpans.reduce((sum, span) => sum + normalizeJudgeScore(span.score), 0) / judgeSpans.length : void 0;
442
- const outcomeScore = typeof trace.run.outcome?.score === "number" ? clamp01(
443
- trace.run.outcome.score > 1 ? trace.run.outcome.score / 100 : trace.run.outcome.score
444
- ) : void 0;
445
- const goalProgress = outcomeScore ?? judgeAverage ?? success;
446
- const successfulTools = toolSpans.filter((span) => span.status !== "error").length;
447
- const toolUseQuality = toolSpans.length === 0 ? 0 : successfulTools / toolSpans.length;
448
- if (toolSpans.length === 0) notes.push("no tool spans recorded");
449
- const patchEvidence = trace.artifacts.length + toolSpans.filter((span) => /write|edit|patch|apply/i.test(span.toolName)).length;
450
- const patchQuality = patchEvidence > 0 ? clamp01(patchEvidence / 4) : 0;
451
- if (!patchQuality) notes.push("no artifact or edit evidence recorded");
452
- const sandboxTests = sandboxSpans.filter(
453
- (span) => typeof span.testsTotal === "number" && span.testsTotal > 0
454
- );
455
- const testReality = sandboxTests.length ? sandboxTests.reduce(
456
- (sum, span) => sum + (span.testsPassed ?? 0) / Math.max(1, span.testsTotal ?? 1),
457
- 0
458
- ) / sandboxTests.length : toolSpans.some(
459
- (span) => /\btest|vitest|pytest|jest|build|tsc\b/i.test(JSON.stringify(span.args))
460
- ) ? 0.4 : 0;
461
- if (!testReality) notes.push("no real test/build evidence recorded");
462
- const blockerSpans = judgeSpans.filter((span) => isBlockingJudge(span));
463
- const finalGateBlockers = finalGateSpans.filter((span) => isBlockingJudge(span));
464
- const finalGate = finalGateSpans.length ? finalGateBlockers.length ? 0 : 1 : success;
465
- if (finalGateBlockers.length)
466
- notes.push(`final gate blocked by ${finalGateBlockers.length} reviewer(s)`);
467
- else if (!finalGateSpans.length) notes.push("no final gate judgment recorded");
468
- const reviewerBlockers = judgeSpans.length ? blockerSpans.length / judgeSpans.length : 0;
469
- if (reviewerBlockers) notes.push(`detected ${blockerSpans.length} blocking reviewer signal(s)`);
470
- const positiveGroundingSignals = patchEvidence + sandboxSpans.length + llmSpans.filter((span) => looksRepoGrounded(span.output ?? "")).length;
471
- const driftSignals = llmSpans.filter((span) => this.isDrift(span.output ?? "")).length + trace.events.filter((event) => this.isDrift(JSON.stringify(event.payload))).length;
472
- const repoGroundedness = positiveGroundingSignals + driftSignals === 0 ? 0 : positiveGroundingSignals / (positiveGroundingSignals + driftSignals);
473
- const driftPenalty = positiveGroundingSignals + driftSignals === 0 ? 0 : driftSignals / (positiveGroundingSignals + driftSignals);
474
- if (driftSignals > 0) notes.push(`detected ${driftSignals} drift signal(s)`);
475
- const costUsd = trace.budget.length ? Math.max(
476
- ...trace.budget.filter((entry) => entry.dimension === "usd").map((entry) => entry.consumed),
477
- 0
478
- ) : llmSpans.reduce((sum, span) => sum + (span.costUsd ?? 0), 0);
479
- const wallSeconds = trace.run.endedAt && trace.run.startedAt ? Math.max(0, (trace.run.endedAt - trace.run.startedAt) / 1e3) : 0;
480
- return {
481
- success,
482
- goalProgress,
483
- repoGroundedness,
484
- driftPenalty,
485
- toolUseQuality,
486
- patchQuality,
487
- testReality,
488
- finalGate,
489
- reviewerBlockers,
490
- costUsd,
491
- wallSeconds,
492
- notes
493
- };
494
- }
495
- rank(score) {
496
- return aggregateRunScore(score, this.weights);
497
- }
498
- isDrift(text) {
499
- return this.driftPatterns.some((pattern) => pattern.test(text));
500
- }
501
- };
502
- function normalizeJudgeScore(score) {
503
- return score > 1 ? clamp01(score / 10) : clamp01(score);
504
- }
505
- function looksRepoGrounded(text) {
506
- return /(?:src\/|tests?\/|package\.json|tsconfig|\.ts\b|\.tsx\b|git status|pnpm |npm |vitest|pytest|jest)/i.test(
507
- text
508
- );
509
- }
510
- function isBlockingJudge(span) {
511
- return span.attributes?.blocking === true || span.attributes?.verdict === "BLOCKING" || positiveNumber(span.attributes?.blockingFindings) || positiveNumber(span.attributes?.highFindings) || span.score <= 2;
512
- }
513
- function positiveNumber(value) {
514
- return typeof value === "number" && value > 0;
515
- }
516
-
517
- // src/semantic-concept-judge.ts
518
- var DEFAULT_COMPLEXITY_WEIGHTS = {
519
- render: 1,
520
- integrate: 2,
521
- compute: 2.5
522
- };
523
- var SEMANTIC_CONCEPT_JUDGE_VERSION = "semantic-concept-judge-v1-2026-04-24";
524
- var DEFAULT_MAX_SOURCE = 45e3;
525
- var DEFAULT_MAX_HTML = 3e4;
526
- var DEFAULT_MAX_PER_FILE = 2e4;
527
- var DEFAULT_TIMEOUT = 3e5;
528
- var DEFAULT_MAX_TOKENS = 16e3;
529
- var DEFAULT_MODEL = "claude-sonnet-4-6";
530
- var SEMANTIC_SCHEMA = {
531
- type: "object",
532
- additionalProperties: false,
533
- required: ["summary", "concepts"],
534
- properties: {
535
- summary: { type: "string", minLength: 20, maxLength: 600 },
536
- concepts: {
537
- type: "array",
538
- minItems: 1,
539
- items: {
540
- type: "object",
541
- additionalProperties: false,
542
- required: ["concept", "present", "score", "evidence", "severity"],
543
- properties: {
544
- concept: { type: "string", minLength: 1, maxLength: 120 },
545
- present: { type: "boolean" },
546
- score: { type: "number", minimum: 0, maximum: 10 },
547
- evidence: { type: "string", minLength: 5, maxLength: 400 },
548
- severity: { type: "string", enum: ["critical", "major", "minor", "info"] }
549
- }
550
- }
551
- }
552
- }
553
- };
554
- function truncate(body, cap, label) {
555
- if (body.length <= cap) return body;
556
- return `${body.slice(0, cap)}
557
- \u2026 [truncated ${body.length - cap} chars of ${label}]`;
558
- }
559
- function buildPrompt(input, opts) {
560
- const sourceBlob = input.sourceFiles.filter((f) => f.content.length <= opts.maxPerFileChars).map((f) => `--- FILE: ${f.path} ---
561
- ${f.content}`).join("\n\n");
562
- const html = input.servedHtml ?? "";
563
- return `You are a strict code-review judge evaluating whether an agent's 0-to-1 build actually implements the features the user asked for.
564
-
565
- You MUST distinguish:
566
- (a) WORKING code that implements the concept (rendered UI, wired handler, real API call),
567
- (b) KEYWORD-PRESENT stub (comments mentioning the concept, variable names, TODOs),
568
- (c) ABSENT (concept nowhere).
569
-
570
- A comment like "// TODO: add mint button" is NOT present \u2014 score 2-3. Only count a concept as present if there is real functional code: a rendered component, a call handler wired to state or a network call, a computed value actually used.
571
-
572
- USER REQUEST (what the agent was asked to build):
573
- ${input.userRequest}
574
-
575
- ${input.artifactLabel ? `ARTIFACT METADATA:
576
- name: ${input.artifactLabel}
577
- description: ${input.artifactDescription ?? ""}
578
-
579
- ` : ""}EXPECTED CONCEPTS (each must be graded independently):
580
- ${input.expectedConcepts.map(
581
- (c, i) => ` ${i + 1}. "${c.name}"${c.keywords?.length ? ` \u2014 hints: [${c.keywords.slice(0, 6).join(" | ")}]` : ""}`
582
- ).join("\n")}
583
-
584
- ${html ? `SERVED HTML (what the preview returns when hit):
585
- ${truncate(html, opts.maxHtmlChars, "HTML")}
586
-
587
- ` : ""}SOURCE FILES (the agent's workdir):
588
- ${truncate(sourceBlob, opts.maxSourceChars, "source")}
589
-
590
- For EACH concept, return:
591
- - concept: the concept name as given (match exactly)
592
- - present: boolean \u2014 does a working implementation exist?
593
- - score: 0-10 \u2014 10 = production-ready; 7 = functional but thin; 4 = partial/stubbed; 2 = keyword-only comment; 0 = absent
594
- - evidence: cite "<file>:<line>" or "served-html:<selector>" pointing at the strongest supporting code. If the concept is absent or stubbed, explain what's missing.
595
- - severity:
596
- "info" when present: true AND score >= 7
597
- "minor" when present: true AND 4 <= score < 7
598
- "major" when present: false OR score < 4
599
- "critical" when the concept is not only absent but a core user flow depends on it
600
-
601
- Also produce a "summary" (one sentence, 20-600 chars): overall verdict on whether this is a shippable implementation of the user request vs a keyword-dense placeholder.
602
-
603
- BE SKEPTICAL. Keyword matching already passed \u2014 your job is to catch what keyword matching misses. If the agent shipped a working build, say so. If it shipped a stub, say so. Don't grade on effort.
604
-
605
- Return STRICT JSON. No prose outside the JSON.`;
606
- }
607
- async function runSemanticConceptJudge(input, options = {}) {
608
- const start = Date.now();
609
- const totalCount = input.expectedConcepts.length;
610
- if (totalCount === 0) {
611
- return {
612
- kind: "semantic-concept",
613
- version: SEMANTIC_CONCEPT_JUDGE_VERSION,
614
- score: 0,
615
- presentCount: 0,
616
- totalCount: 0,
617
- findings: [],
618
- summary: "no expected concepts declared",
619
- durationMs: 0,
620
- costUsd: null,
621
- available: false,
622
- error: "no expected concepts declared"
623
- };
624
- }
625
- const opts = {
626
- model: options.model ?? DEFAULT_MODEL,
627
- timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT,
628
- maxTokens: options.maxTokens ?? DEFAULT_MAX_TOKENS,
629
- maxSourceChars: options.maxSourceChars ?? DEFAULT_MAX_SOURCE,
630
- maxPerFileChars: options.maxPerFileChars ?? DEFAULT_MAX_PER_FILE,
631
- maxHtmlChars: options.maxHtmlChars ?? DEFAULT_MAX_HTML,
632
- llm: options.llm ?? {},
633
- costLedger: options.costLedger ?? new CostLedger(),
634
- costPhase: options.costPhase ?? "judge.semantic-concept",
635
- costTags: options.costTags ?? {},
636
- signal: options.signal ?? new AbortController().signal,
637
- weightConcepts: options.weightConcepts ?? "mean",
638
- complexityWeights: { ...DEFAULT_COMPLEXITY_WEIGHTS, ...options.complexityWeights ?? {} }
639
- };
640
- const weightForConcept = (spec) => {
641
- if (opts.weightConcepts === "mean") return 1;
642
- if (spec.weight != null) return spec.weight;
643
- if (opts.weightConcepts === "complexity") {
644
- return opts.complexityWeights[spec.complexity ?? "render"] ?? 1;
645
- }
646
- return 1;
647
- };
648
- const weightByName = new Map(
649
- input.expectedConcepts.map((c) => [c.name, weightForConcept(c)])
650
- );
651
- let receipt;
652
- try {
653
- const request = {
654
- model: opts.model,
655
- messages: [
656
- {
657
- role: "system",
658
- content: "You are a strict code-review judge. Return strict JSON only. No prose outside the JSON. A keyword in a comment is NOT a working implementation."
659
- },
660
- { role: "user", content: buildPrompt(input, opts) }
661
- ],
662
- jsonSchema: { name: "semantic_concept_judge", schema: SEMANTIC_SCHEMA },
663
- temperature: 0,
664
- maxTokens: opts.maxTokens,
665
- timeoutMs: opts.timeoutMs
666
- };
667
- const paid = await opts.costLedger.runPaidCall({
668
- channel: "judge",
669
- phase: opts.costPhase,
670
- actor: "semantic-concept",
671
- model: opts.model,
672
- ...Object.keys(opts.costTags).length > 0 ? { tags: opts.costTags } : {},
673
- maximumCharge: maximumChargeForLlmRequest(request, opts.llm),
674
- signal: opts.signal,
675
- execute: (signal, callId) => callLlmJson(request, {
676
- ...opts.llm,
677
- signal,
678
- idempotencyKey: callId
679
- }),
680
- receipt: ({ result }) => costReceiptFromLlm(result),
681
- receiptFromError: costReceiptFromLlmError
682
- });
683
- receipt = paid.receipt;
684
- if (!paid.succeeded) throw paid.error;
685
- const { value } = paid.value;
686
- if (!value?.concepts || !Array.isArray(value.concepts)) {
687
- throw new Error('judge returned malformed response \u2014 expected array under "concepts"');
688
- }
689
- const findings = value.concepts.map((c) => ({
690
- concept: String(c.concept),
691
- present: Boolean(c.present),
692
- score: Math.max(0, Math.min(10, Number(c.score ?? 0))),
693
- evidence: String(c.evidence ?? ""),
694
- severity: ["critical", "major", "minor", "info"].includes(c.severity) ? c.severity : "info"
695
- }));
696
- const presentCount = findings.filter((f) => f.present && f.score >= 7).length;
697
- let weightSum = 0;
698
- let weightedScoreSum = 0;
699
- for (const f of findings) {
700
- const w = weightByName.get(f.concept) ?? 1;
701
- weightSum += w;
702
- weightedScoreSum += w * f.score;
703
- }
704
- const scoreAvg = weightSum > 0 ? weightedScoreSum / weightSum : findings.reduce((a, f) => a + f.score, 0) / Math.max(1, findings.length);
705
- return {
706
- kind: "semantic-concept",
707
- version: SEMANTIC_CONCEPT_JUDGE_VERSION,
708
- score: Number((scoreAvg / 10).toFixed(3)),
709
- presentCount,
710
- totalCount,
711
- findings,
712
- summary: String(value.summary ?? ""),
713
- durationMs: Date.now() - start,
714
- costUsd: paid.receipt.costUnknown ? null : paid.receipt.costUsd,
715
- available: true
716
- };
717
- } catch (err) {
718
- return {
719
- kind: "semantic-concept",
720
- version: SEMANTIC_CONCEPT_JUDGE_VERSION,
721
- score: 0,
722
- presentCount: 0,
723
- totalCount,
724
- findings: [],
725
- summary: "",
726
- durationMs: Date.now() - start,
727
- costUsd: receipt && !receipt.costUnknown ? receipt.costUsd : null,
728
- available: false,
729
- error: err instanceof Error ? err.message : String(err)
730
- };
731
- }
732
- }
733
- function createSemanticConceptJudge(options = {}) {
734
- return (input) => runSemanticConceptJudge(input, options);
735
- }
736
-
737
- export {
738
- LockedJsonlAppender,
739
- FindingsStore,
740
- defaultIsMaterial,
741
- diffFindings,
742
- buildSkillUsageReport,
743
- emitSkillUsageFindings,
744
- SkillUsageAnalyst,
745
- SKILL_USAGE_ANALYST,
746
- RunCritic,
747
- DEFAULT_COMPLEXITY_WEIGHTS,
748
- SEMANTIC_CONCEPT_JUDGE_VERSION,
749
- runSemanticConceptJudge,
750
- createSemanticConceptJudge
751
- };
752
- //# sourceMappingURL=chunk-DODXQREJ.js.map