@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
@@ -0,0 +1,624 @@
1
+ import { a as ROLLOUT_SPLITS, i as ROLLOUT_SCHEMA, n as ROLLOUT_CAPTURES, r as ROLLOUT_ROLES, u as assertRolloutLine } from "./schema-C6DW4ZHR.js";
2
+ import "./exporters-q9iL-2Jf.js";
3
+ import "./hf-dataset-DBJXXoY1.js";
4
+ import "./mint-yN2M2eh0.js";
5
+ import "./opencode-sqlite-BGrHeDu3.js";
6
+ //#region src/rollout/interchange/harbor.ts
7
+ /**
8
+ * Harbor ATIF-v1.7 interchange — `tangle.rollout.v1` ⇄ Agent Trajectory
9
+ * Interchange Format.
10
+ *
11
+ * ATIF is the portability format (spec:
12
+ * https://www.harborframework.com/docs/agents/trajectory-format, normative
13
+ * RFC: harbor-framework/harbor `rfcs/0001-trajectory-format.md`). It sits
14
+ * BELOW the waist of the rollout hourglass in both directions — export reads
15
+ * `RolloutLine[]`, import writes `RolloutLine[]` — and it is never a source
16
+ * of training labels:
17
+ *
18
+ * ATIF models NO reward, NO judge verdict, NO task/split coordinates.
19
+ *
20
+ * Consequences, both deliberate:
21
+ * - EXPORT drops `outcome.reward`, `outcome.reward_source` and
22
+ * `outcome.verdict` entirely. They are not smuggled into `extra`: a
23
+ * third-party reading our ATIF file must not be able to mistake an
24
+ * agent-eval judge score for something ATIF sanctioned.
25
+ * - IMPORT therefore mints UNLABELED lines: `reward: null` (the existing
26
+ * "null reward is a labeled gap, never 0" semantics), `verdict: null`,
27
+ * and a `provenance.gap` naming the missing label. An imported
28
+ * trajectory is not a training example until a judge scores it.
29
+ *
30
+ * Everything else we own that ATIF has no field for travels in a namespaced
31
+ * escrow at `extra.tangle.*`, so our own round-trip is exact while a foreign
32
+ * reader can ignore it. Fields that neither ATIF nor the escrow can carry
33
+ * come back explicitly null / fail-closed, never invented.
34
+ *
35
+ * THE ESCROW IS NAMESPACED, NOT AUTHENTICATED. Anyone can write
36
+ * `extra.tangle.*` into a file. So the escrow may restore what a value IS, but
37
+ * never what a line is ALLOWED to do: `task.split` is forced to `holdout` on
38
+ * every import regardless of what the document claims, and promoting an
39
+ * imported trajectory to a trainable split is an explicit, greppable act
40
+ * (`relabelImportedSplit`) rather than a property of the file. The document
41
+ * keeps its claim — the claim just is not authority.
42
+ *
43
+ * Multi-agent shape differs on purpose. ATIF EMBEDS children in
44
+ * `subagent_trajectories`; we keep a flat ledger with a normalized
45
+ * `parent_rollout_id` edge. Export assembles the tree, import flattens it.
46
+ * `session_id` is RUN-scoped in ATIF, so it carries `run_id` — the coordinate
47
+ * that is shared by every invocation of one run — not `rollout_id`, which
48
+ * identifies a single invocation and would split one run across session ids.
49
+ *
50
+ * ROUND-TRIPPING IS IDEMPOTENT: `import(export(import(export(x))))` is
51
+ * byte-identical to `import(export(x))`. Import composes `provenance.gap` as a
52
+ * de-duplicated ordered set rather than appending, and it emits every
53
+ * `ChatMessage` with keys in the canonical schema order (role, content,
54
+ * reasoning_content, tool_calls, tool_call_id, name, is_copied_context), so a
55
+ * ledger hashed on serialized bytes sees no diff across further passes. The
56
+ * FIRST import may re-order a producer's keys — that is the canonicalization.
57
+ *
58
+ * NOT building a Letta converter. Letta's trajectory-v1 is a strict subset of
59
+ * what we need from ATIF here — no per-step or aggregate cost, no
60
+ * multi-agent/subagent structure, no token-id or logprob channel — so a Letta
61
+ * sink would carry less than this one and add a second format to keep
62
+ * correct. Decision recorded in docs/rollout.md; do not re-litigate without a
63
+ * concrete consumer that reads Letta and cannot read ATIF.
64
+ */
65
+ const ATIF_SCHEMA_VERSION = "ATIF-v1.7";
66
+ /** Gap note on every imported line — ATIF carries no verdict, so nothing is scored. */
67
+ const HARBOR_IMPORT_GAP = "imported from Harbor ATIF; no verdict";
68
+ /** Namespaced escrow key for everything ATIF does not model but we must not lose. */
69
+ const ESCROW = "tangle";
70
+ /**
71
+ * Marks a step we synthesized purely to hold tool results that answered no
72
+ * assistant turn IN THIS DOCUMENT. ATIF has no `tool` source, so such results
73
+ * need a carrier step; the marker lets import drop the carrier instead of
74
+ * inventing a turn.
75
+ *
76
+ * A carrier's results carry NO `source_call_id`. RFC 0001 rule 2 requires every
77
+ * `source_call_id` to match a `tool_call_id` in the same step's `tool_calls`,
78
+ * and a carrier declares no calls (a `system` step cannot legally make one), so
79
+ * emitting the id there would produce an invalid document. The id is escrowed
80
+ * instead and restored verbatim on import — the link survives without the
81
+ * document lying about who made the call.
82
+ */
83
+ const TOOL_RESULTS_ONLY = "tool-results-only";
84
+ const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
85
+ const asString = (v) => typeof v === "string" ? v : void 0;
86
+ const asNumberOrNull = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
87
+ const asIntegerOrUndefined = (v) => Number.isInteger(v) ? v : void 0;
88
+ const asNumberArray = (v) => Array.isArray(v) && v.every((n) => typeof n === "number" && Number.isFinite(n)) ? v : void 0;
89
+ const asIntegerArray = (v) => Array.isArray(v) && v.every((n) => Number.isInteger(n)) ? v : void 0;
90
+ /**
91
+ * Builds a `ChatMessage` with keys in the schema's declaration order.
92
+ *
93
+ * Object key order is insertion order in JS, so a message assembled
94
+ * conditionally field-by-field serializes differently depending on which
95
+ * optional fields were present — which makes a byte-hashed ledger see a diff
96
+ * across an import that changed nothing. One builder, one order, stable bytes.
97
+ */
98
+ function canonicalChatMessage(parts) {
99
+ const message = {
100
+ role: parts.role,
101
+ content: parts.content
102
+ };
103
+ if (parts.reasoning_content !== void 0) message.reasoning_content = parts.reasoning_content;
104
+ if (parts.tool_calls !== void 0) message.tool_calls = parts.tool_calls;
105
+ if (parts.tool_call_id !== void 0) message.tool_call_id = parts.tool_call_id;
106
+ if (parts.name !== void 0) message.name = parts.name;
107
+ if (parts.is_copied_context === true) message.is_copied_context = true;
108
+ return message;
109
+ }
110
+ /** Reads the `extra.tangle` escrow, tolerating a foreign file that has none. */
111
+ function escrowOf(extra) {
112
+ if (!isRecord(extra)) return void 0;
113
+ const value = extra[ESCROW];
114
+ return isRecord(value) ? value : void 0;
115
+ }
116
+ function escrowSection(escrow, key) {
117
+ if (escrow === void 0) return void 0;
118
+ const value = escrow[key];
119
+ return isRecord(value) ? value : void 0;
120
+ }
121
+ function toHarborToolCall(call) {
122
+ let parsed;
123
+ try {
124
+ const decoded = JSON.parse(call.function.arguments);
125
+ if (isRecord(decoded)) parsed = decoded;
126
+ } catch {
127
+ parsed = void 0;
128
+ }
129
+ return {
130
+ tool_call_id: call.id,
131
+ function_name: call.function.name,
132
+ arguments: parsed ?? {},
133
+ extra: { [ESCROW]: { arguments_raw: call.function.arguments } }
134
+ };
135
+ }
136
+ /**
137
+ * `linked` = this result is attached to the step that actually declared the
138
+ * call, so `source_call_id` is legal (RFC 0001 rule 2). When it is not, the id
139
+ * goes to escrow instead of onto the wire.
140
+ */
141
+ function toObservationResult(message, linked) {
142
+ const result = {};
143
+ if (linked && message.tool_call_id !== void 0) result.source_call_id = message.tool_call_id;
144
+ if (message.content !== null) result.content = message.content;
145
+ const escrow = {};
146
+ if (!linked && message.tool_call_id !== void 0) escrow.source_call_id = message.tool_call_id;
147
+ if (message.name !== void 0) escrow.name = message.name;
148
+ if (message.content === null) escrow.content_null = true;
149
+ if (message.reasoning_content !== void 0) escrow.reasoning_content = message.reasoning_content;
150
+ if (message.is_copied_context === true) escrow.is_copied_context = true;
151
+ if (Object.keys(escrow).length > 0) result.extra = { [ESCROW]: escrow };
152
+ return result;
153
+ }
154
+ /** True when `step` is the agent turn that declared `callId` — the rule-2 test. */
155
+ function declaresCall(step, callId) {
156
+ if (callId === void 0) return false;
157
+ return step.tool_calls?.some((call) => call.tool_call_id === callId) === true;
158
+ }
159
+ /**
160
+ * Attaches the four RL fields lifted from ATIF onto the agent step the span
161
+ * describes. They are ALSO escrowed with the whole span under `extra.tangle`,
162
+ * on purpose: the escrow is how our own round-trip stays exact, and these
163
+ * native fields are how a foreign consumer — which never reads our escrow —
164
+ * gets the logprobs and token ids at all. A field carried only in the escrow is
165
+ * not an interchange field.
166
+ */
167
+ function applySpanMetrics(step, span) {
168
+ if (span === void 0) return;
169
+ if (span.llm_call_count !== void 0) step.llm_call_count = span.llm_call_count;
170
+ const metrics = {};
171
+ if (span.prompt_token_ids !== void 0) metrics.prompt_token_ids = span.prompt_token_ids;
172
+ if (span.completion_token_ids !== void 0) metrics.completion_token_ids = span.completion_token_ids;
173
+ if (span.logprobs !== void 0) metrics.logprobs = span.logprobs;
174
+ if (Object.keys(metrics).length > 0) step.metrics = metrics;
175
+ }
176
+ /**
177
+ * Coalescing fold, not a 1:1 map: ATIF has no `tool` source, so a tool result
178
+ * becomes an `observation.results[]` entry on the agent step THAT DECLARED ITS
179
+ * `tool_call_id`.
180
+ *
181
+ * Linking by id, not by adjacency. Adjacency emitted invalid documents in three
182
+ * shapes the RFC forbids — an assistant turn with no `tool_calls` swallowing the
183
+ * results that followed it, a result whose id matched none of the preceding
184
+ * step's calls, and an unanswered result riding a `system` step that carried a
185
+ * `source_call_id` it could never declare. Attaching only to the step that owns
186
+ * the id also preserves message order exactly: a result either joins the step
187
+ * immediately before it or becomes its own carrier at its own position.
188
+ *
189
+ * `line.steps` span projections are matched to agent steps in order (k-th llm
190
+ * span → k-th agent step) purely to fill ATIF's native per-step `metrics`;
191
+ * extra spans on either side are simply not matched, never invented.
192
+ */
193
+ function messagesToSteps(line) {
194
+ const steps = [];
195
+ const llmSpans = (line.steps ?? []).filter((span) => span.kind === "llm");
196
+ let nextSpan = 0;
197
+ for (const message of line.messages) {
198
+ if (message.role === "tool") {
199
+ const previous = steps[steps.length - 1];
200
+ if (previous !== void 0 && declaresCall(previous, message.tool_call_id)) {
201
+ if (previous.observation === void 0) previous.observation = { results: [] };
202
+ previous.observation.results.push(toObservationResult(message, true));
203
+ continue;
204
+ }
205
+ const carrier = {
206
+ step_id: steps.length + 1,
207
+ source: "system",
208
+ message: "",
209
+ observation: { results: [toObservationResult(message, false)] },
210
+ extra: { [ESCROW]: { synthetic: TOOL_RESULTS_ONLY } }
211
+ };
212
+ if (message.is_copied_context === true) carrier.is_copied_context = true;
213
+ steps.push(carrier);
214
+ continue;
215
+ }
216
+ const step = {
217
+ step_id: steps.length + 1,
218
+ source: message.role === "assistant" ? "agent" : message.role,
219
+ message: message.content ?? ""
220
+ };
221
+ const escrow = {};
222
+ if (message.content === null) escrow.content_null = true;
223
+ if (message.name !== void 0) escrow.name = message.name;
224
+ if (message.role === "assistant") {
225
+ if (line.policy.model !== null) step.model_name = line.policy.model;
226
+ if (message.reasoning_content !== void 0) step.reasoning_content = message.reasoning_content;
227
+ if (message.tool_calls !== void 0 && message.tool_calls.length > 0) step.tool_calls = message.tool_calls.map(toHarborToolCall);
228
+ applySpanMetrics(step, llmSpans[nextSpan]);
229
+ nextSpan += 1;
230
+ } else if (message.reasoning_content !== void 0) escrow.reasoning_content = message.reasoning_content;
231
+ if (message.is_copied_context === true) step.is_copied_context = true;
232
+ if (Object.keys(escrow).length > 0) step.extra = { [ESCROW]: escrow };
233
+ steps.push(step);
234
+ }
235
+ return steps;
236
+ }
237
+ function finalMetricsOf(line, stepCount) {
238
+ const metrics = {};
239
+ if (line.cost.tokens_in !== null) metrics.total_prompt_tokens = line.cost.tokens_in;
240
+ if (line.cost.tokens_out !== null) metrics.total_completion_tokens = line.cost.tokens_out;
241
+ if (line.cost.cache_read !== null) metrics.total_cached_tokens = line.cost.cache_read;
242
+ if (line.cost.usd !== null) metrics.total_cost_usd = line.cost.usd;
243
+ metrics.total_steps = stepCount;
244
+ const extra = {};
245
+ if (line.cost.tokens_reasoning !== null) extra.reasoning_tokens = line.cost.tokens_reasoning;
246
+ if (line.cost.cache_write !== null) extra.cache_write_tokens = line.cost.cache_write;
247
+ if (line.cost.wall_s !== null) extra.wall_s = line.cost.wall_s;
248
+ if (line.cost.llm_call_count !== void 0 && line.cost.llm_call_count !== null) extra.llm_call_count = line.cost.llm_call_count;
249
+ if (Object.keys(extra).length > 0) metrics.extra = extra;
250
+ return metrics;
251
+ }
252
+ function notesOf(line) {
253
+ const parts = [];
254
+ if (line.provenance.gap !== void 0) parts.push(line.provenance.gap);
255
+ if (line.outcome.realness_gated === true) parts.push("realness-gated: this run faked its success signal (anti-Goodhart gate fired)");
256
+ return parts.length > 0 ? parts.join(" | ") : void 0;
257
+ }
258
+ function toTrajectoryNode(line) {
259
+ const steps = messagesToSteps(line);
260
+ const trajectory = {
261
+ schema_version: ATIF_SCHEMA_VERSION,
262
+ session_id: line.run_id,
263
+ trajectory_id: line.rollout_id,
264
+ agent: {
265
+ name: line.policy.harness ?? "unknown",
266
+ version: line.policy.harness_version ?? "0.0.0",
267
+ ...line.policy.model !== null ? { model_name: line.policy.model } : {},
268
+ ...line.tool_defs.length > 0 ? { tool_definitions: line.tool_defs } : {}
269
+ },
270
+ steps,
271
+ final_metrics: finalMetricsOf(line, steps.length),
272
+ extra: { [ESCROW]: {
273
+ schema: line.schema,
274
+ rollout_id: line.rollout_id,
275
+ parent_rollout_id: line.parent_rollout_id,
276
+ run_id: line.run_id,
277
+ ...line.experiment_id !== void 0 ? { experiment_id: line.experiment_id } : {},
278
+ ...line.candidate_id !== void 0 ? { candidate_id: line.candidate_id } : {},
279
+ generation: line.generation,
280
+ candidate_index: line.candidate_index,
281
+ role: line.role,
282
+ task: line.task,
283
+ policy: line.policy,
284
+ ...line.steps !== void 0 ? { spans: line.steps } : {},
285
+ outcome: {
286
+ metrics: line.outcome.metrics,
287
+ is_completed: line.outcome.is_completed,
288
+ is_truncated: line.outcome.is_truncated,
289
+ error: line.outcome.error,
290
+ ...line.outcome.realness_gated !== void 0 ? { realness_gated: line.outcome.realness_gated } : {}
291
+ },
292
+ artifacts: line.artifacts,
293
+ provenance: line.provenance
294
+ } }
295
+ };
296
+ const notes = notesOf(line);
297
+ if (notes !== void 0) trajectory.notes = notes;
298
+ return trajectory;
299
+ }
300
+ function buildForest(lines) {
301
+ const byId = /* @__PURE__ */ new Map();
302
+ for (const line of lines) {
303
+ if (byId.has(line.rollout_id)) throw new Error(`duplicate rollout_id in input: ${line.rollout_id}`);
304
+ byId.set(line.rollout_id, line);
305
+ }
306
+ const roots = [];
307
+ const childrenOf = /* @__PURE__ */ new Map();
308
+ for (const line of lines) {
309
+ const parent = line.parent_rollout_id;
310
+ if (parent === null || !byId.has(parent)) {
311
+ roots.push(line);
312
+ continue;
313
+ }
314
+ const siblings = childrenOf.get(parent);
315
+ if (siblings === void 0) childrenOf.set(parent, [line]);
316
+ else siblings.push(line);
317
+ }
318
+ if (lines.length > 0 && roots.length === 0) throw new Error(`parent_rollout_id cycle: no root among ${lines.length} lines (${lines.map((l) => l.rollout_id).join(", ")})`);
319
+ return {
320
+ roots,
321
+ childrenOf
322
+ };
323
+ }
324
+ function assemble(line, forest, onPath) {
325
+ if (onPath.has(line.rollout_id)) throw new Error(`parent_rollout_id cycle through rollout_id ${line.rollout_id}`);
326
+ onPath.add(line.rollout_id);
327
+ const node = toTrajectoryNode(line);
328
+ const children = forest.childrenOf.get(line.rollout_id);
329
+ if (children !== void 0 && children.length > 0) node.subagent_trajectories = children.map((child) => assemble(child, forest, onPath));
330
+ onPath.delete(line.rollout_id);
331
+ return node;
332
+ }
333
+ /**
334
+ * Assemble one episode's flat lines into a single ATIF trajectory tree,
335
+ * linked by `parent_rollout_id`.
336
+ *
337
+ * Reward, verdict and split are NOT emitted (ATIF models none of them); the
338
+ * split and the rest of the task coordinates survive only in `extra.tangle`.
339
+ *
340
+ * We deliberately do NOT synthesize an `observation.subagent_trajectory_ref`
341
+ * pointing at each child: our ledger records WHICH invocation spawned a
342
+ * worker, not which STEP did, and attaching the ref to a guessed step would
343
+ * fabricate a causal claim. Children are embedded in `subagent_trajectories`
344
+ * (each with the `trajectory_id` the spec requires) and the edge is stated in
345
+ * the child's escrowed `parent_rollout_id`.
346
+ *
347
+ * Throws when the lines are not one tree — use `toHarborTrajectories` for a forest.
348
+ */
349
+ function toHarborTrajectory(lines) {
350
+ const trees = toHarborTrajectories(lines);
351
+ if (trees.length === 0) throw new Error("toHarborTrajectory: no lines");
352
+ if (trees.length > 1) {
353
+ const ids = trees.map((t) => t.trajectory_id ?? "?").join(", ");
354
+ throw new Error(`toHarborTrajectory: ${trees.length} roots (${ids}) — ATIF is one tree per document; use toHarborTrajectories`);
355
+ }
356
+ return trees[0];
357
+ }
358
+ /** Every independent tree in the input, one ATIF document each. */
359
+ function toHarborTrajectories(lines) {
360
+ const forest = buildForest(lines);
361
+ return forest.roots.map((root) => assemble(root, forest, /* @__PURE__ */ new Set()));
362
+ }
363
+ function contentToString(message) {
364
+ if (typeof message === "string") return message;
365
+ return message.map((part) => part.type === "image" ? `[image ${part.source?.media_type ?? "unknown"} ${part.source?.path ?? ""}]`.trim() : part.text ?? "").join("\n");
366
+ }
367
+ function fromHarborToolCall(call) {
368
+ const raw = asString(escrowOf(call.extra)?.arguments_raw);
369
+ return {
370
+ id: call.tool_call_id,
371
+ type: "function",
372
+ function: {
373
+ name: call.function_name,
374
+ arguments: raw ?? JSON.stringify(call.arguments ?? {})
375
+ }
376
+ };
377
+ }
378
+ function fromObservationResult(result, callId) {
379
+ const escrow = escrowOf(result.extra);
380
+ return canonicalChatMessage({
381
+ role: "tool",
382
+ content: escrow?.content_null === true ? null : result.content === void 0 ? "" : contentToString(result.content),
383
+ reasoning_content: asString(escrow?.reasoning_content),
384
+ tool_call_id: callId,
385
+ name: asString(escrow?.name),
386
+ is_copied_context: escrow?.is_copied_context === true
387
+ });
388
+ }
389
+ function stepsToMessages(steps) {
390
+ const messages = [];
391
+ for (const step of steps) {
392
+ const escrow = escrowOf(step.extra);
393
+ const carrierOnly = escrow?.synthetic === TOOL_RESULTS_ONLY;
394
+ if (!carrierOnly) messages.push(canonicalChatMessage({
395
+ role: step.source === "agent" ? "assistant" : step.source,
396
+ content: escrow?.content_null === true ? null : contentToString(step.message),
397
+ reasoning_content: step.reasoning_content ?? asString(escrow?.reasoning_content),
398
+ tool_calls: step.tool_calls !== void 0 && step.tool_calls.length > 0 ? step.tool_calls.map(fromHarborToolCall) : void 0,
399
+ name: asString(escrow?.name),
400
+ is_copied_context: step.is_copied_context === true
401
+ }));
402
+ for (const result of step.observation?.results ?? []) {
403
+ const resultEscrow = escrowOf(result.extra);
404
+ const callId = result.source_call_id ?? asString(resultEscrow?.source_call_id);
405
+ if (carrierOnly) {
406
+ messages.push(fromObservationResult(result, callId));
407
+ continue;
408
+ }
409
+ if (typeof callId === "string") {
410
+ messages.push(fromObservationResult(result, callId));
411
+ continue;
412
+ }
413
+ if (result.content !== void 0) messages.push(canonicalChatMessage({
414
+ role: "system",
415
+ content: contentToString(result.content)
416
+ }));
417
+ }
418
+ }
419
+ return messages;
420
+ }
421
+ function taskFrom(escrow, fallbackId) {
422
+ const task = escrowSection(escrow, "task");
423
+ return {
424
+ suite: asString(task?.suite) ?? "harbor-atif-import",
425
+ instance_id: asString(task?.instance_id) ?? fallbackId,
426
+ split: "holdout",
427
+ seed: asNumberOrNull(task?.seed),
428
+ rep: asIntegerOrUndefined(task?.rep) ?? 0
429
+ };
430
+ }
431
+ function policyFrom(escrow, agent) {
432
+ const escrowed = escrowSection(escrow, "policy");
433
+ if (escrowed !== void 0) return {
434
+ harness: asString(escrowed.harness) ?? null,
435
+ harness_version: asString(escrowed.harness_version) ?? null,
436
+ model: asString(escrowed.model) ?? null,
437
+ provider: asString(escrowed.provider) ?? null,
438
+ profile_commit: asString(escrowed.profile_commit) ?? null,
439
+ ...escrowed.prompt_hash !== void 0 ? { prompt_hash: asString(escrowed.prompt_hash) ?? null } : {},
440
+ ...escrowed.config_hash !== void 0 ? { config_hash: asString(escrowed.config_hash) ?? null } : {},
441
+ ...escrowed.agent_profile_cell_id !== void 0 ? { agent_profile_cell_id: asString(escrowed.agent_profile_cell_id) ?? null } : {},
442
+ sampling: isRecord(escrowed.sampling) ? escrowed.sampling : null
443
+ };
444
+ return {
445
+ harness: agent.name,
446
+ harness_version: agent.version,
447
+ model: agent.model_name ?? null,
448
+ provider: null,
449
+ profile_commit: null,
450
+ sampling: null
451
+ };
452
+ }
453
+ function artifactsFrom(escrow) {
454
+ const artifacts = escrowSection(escrow, "artifacts");
455
+ return {
456
+ patch_path: asString(artifacts?.patch_path) ?? null,
457
+ run_dir: asString(artifacts?.run_dir) ?? null,
458
+ transcript_ref: asString(artifacts?.transcript_ref) ?? null
459
+ };
460
+ }
461
+ function costFrom(final) {
462
+ const rawExtra = final?.extra;
463
+ const extra = isRecord(rawExtra) ? rawExtra : void 0;
464
+ const calls = asIntegerOrUndefined(extra?.llm_call_count);
465
+ return {
466
+ usd: asNumberOrNull(final?.total_cost_usd),
467
+ tokens_in: asNumberOrNull(final?.total_prompt_tokens),
468
+ tokens_out: asNumberOrNull(final?.total_completion_tokens),
469
+ tokens_reasoning: asNumberOrNull(extra?.reasoning_tokens),
470
+ cache_read: asNumberOrNull(final?.total_cached_tokens),
471
+ cache_write: asNumberOrNull(extra?.cache_write_tokens),
472
+ wall_s: asNumberOrNull(extra?.wall_s),
473
+ ...calls !== void 0 ? { llm_call_count: calls } : {}
474
+ };
475
+ }
476
+ /**
477
+ * Recovers span projections from ATIF's NATIVE per-step channel, for documents
478
+ * with no `extra.tangle.spans` escrow — i.e. everything a foreign producer
479
+ * writes. Without this the logprobs and token ids a Harbor-native trainer
480
+ * records would be read, validated, and then dropped on the floor.
481
+ *
482
+ * Only steps that actually carry one of the four fields produce a span: an
483
+ * agent step with no metrics means "not captured", and inventing an empty span
484
+ * for it would claim the run had a shape we did not observe.
485
+ */
486
+ function spansFromSteps(steps) {
487
+ const spans = [];
488
+ for (const step of steps) {
489
+ if (step.source !== "agent") continue;
490
+ const calls = asIntegerOrUndefined(step.llm_call_count);
491
+ const promptIds = asIntegerArray(step.metrics?.prompt_token_ids);
492
+ const completionIds = asIntegerArray(step.metrics?.completion_token_ids);
493
+ const logprobs = asNumberArray(step.metrics?.logprobs);
494
+ if (calls === void 0 && promptIds === void 0 && completionIds === void 0 && logprobs === void 0) continue;
495
+ spans.push({
496
+ kind: "llm",
497
+ name: step.model_name ?? "chat",
498
+ ...calls !== void 0 ? { llm_call_count: calls } : {},
499
+ ...promptIds !== void 0 ? { prompt_token_ids: promptIds } : {},
500
+ ...completionIds !== void 0 ? { completion_token_ids: completionIds } : {},
501
+ ...logprobs !== void 0 ? { logprobs } : {}
502
+ });
503
+ }
504
+ return spans;
505
+ }
506
+ /**
507
+ * Composes `provenance.gap` as an ordered SET of reasons.
508
+ *
509
+ * Appending made the note accrete on every pass ("…no verdict | …no verdict"),
510
+ * which both grows without bound and breaks byte-level idempotency for a ledger
511
+ * hashed on its serialized lines.
512
+ */
513
+ function composeGap(escrowedGap, added) {
514
+ const parts = [];
515
+ const seen = /* @__PURE__ */ new Set();
516
+ for (const raw of [...escrowedGap?.split(" | ") ?? [], ...added]) {
517
+ const reason = raw.trim();
518
+ if (reason.length === 0 || seen.has(reason)) continue;
519
+ seen.add(reason);
520
+ parts.push(reason);
521
+ }
522
+ return parts.join(" | ");
523
+ }
524
+ function nodeToLine(trajectory, parentId, capturedAt) {
525
+ const escrow = escrowOf(trajectory.extra);
526
+ const rolloutId = asString(escrow?.rollout_id) ?? trajectory.trajectory_id ?? trajectory.session_id;
527
+ if (rolloutId === void 0 || rolloutId.length === 0) throw new Error("fromHarborTrajectory: trajectory has no trajectory_id or session_id — cannot mint a joinable rollout_id without inventing one");
528
+ const outcome = escrowSection(escrow, "outcome");
529
+ const provenance = escrowSection(escrow, "provenance");
530
+ const capture = provenance?.capture;
531
+ const escrowedGap = asString(provenance?.gap);
532
+ const role = escrow?.role;
533
+ const escrowedSpans = escrow?.spans;
534
+ const nativeSpans = spansFromSteps(trajectory.steps);
535
+ const spans = Array.isArray(escrowedSpans) ? escrowedSpans : nativeSpans.length > 0 ? nativeSpans : void 0;
536
+ const messages = stepsToMessages(trajectory.steps);
537
+ const line = {
538
+ schema: ROLLOUT_SCHEMA,
539
+ rollout_id: rolloutId,
540
+ parent_rollout_id: parentId ?? asString(escrow?.parent_rollout_id) ?? null,
541
+ run_id: asString(escrow?.run_id) ?? trajectory.session_id ?? rolloutId,
542
+ experiment_id: asString(escrow?.experiment_id) ?? null,
543
+ candidate_id: asString(escrow?.candidate_id) ?? null,
544
+ generation: asIntegerOrUndefined(escrow?.generation) ?? null,
545
+ candidate_index: asIntegerOrUndefined(escrow?.candidate_index) ?? null,
546
+ role: ROLLOUT_ROLES.includes(role) ? role : "agent",
547
+ task: taskFrom(escrow, rolloutId),
548
+ policy: policyFrom(escrow, trajectory.agent),
549
+ messages,
550
+ tool_defs: trajectory.agent.tool_definitions ?? [],
551
+ ...spans !== void 0 ? { steps: spans } : {},
552
+ outcome: {
553
+ reward: null,
554
+ reward_source: null,
555
+ verdict: null,
556
+ metrics: isRecord(outcome?.metrics) ? outcome.metrics : {},
557
+ is_completed: typeof outcome?.is_completed === "boolean" ? outcome.is_completed : true,
558
+ is_truncated: typeof outcome?.is_truncated === "boolean" ? outcome.is_truncated : trajectory.continued_trajectory_ref !== void 0,
559
+ error: asString(outcome?.error) ?? null,
560
+ realness_gated: outcome?.realness_gated === true
561
+ },
562
+ cost: costFrom(trajectory.final_metrics),
563
+ artifacts: artifactsFrom(escrow),
564
+ provenance: {
565
+ captured_at: asString(provenance?.captured_at) ?? capturedAt,
566
+ capture: ROLLOUT_CAPTURES.includes(capture) ? capture : "backfill",
567
+ gap: composeGap(escrowedGap, [HARBOR_IMPORT_GAP]),
568
+ ...isRecord(provenance?.gated_evidence) ? { gated_evidence: provenance.gated_evidence } : {}
569
+ }
570
+ };
571
+ assertRolloutLine(line, `rollout line imported from ATIF trajectory ${rolloutId}`);
572
+ return line;
573
+ }
574
+ /**
575
+ * Flatten an ATIF trajectory tree back into `tangle.rollout.v1` lines, parent
576
+ * first, each child carrying `parent_rollout_id`.
577
+ *
578
+ * Every line comes back UNLABELED: `reward`, `reward_source` and `verdict` are
579
+ * null and `provenance.gap` says why. ATIF models no verdict, so scoring an
580
+ * imported trajectory is a judge's job, not this function's. Every line lands
581
+ * on `holdout` whatever the document claims — see `relabelImportedSplit`.
582
+ */
583
+ function fromHarborTrajectory(trajectory, options = {}) {
584
+ const capturedAt = (options.now?.() ?? /* @__PURE__ */ new Date()).toISOString();
585
+ const lines = [];
586
+ const walk = (node, parentId, onPath) => {
587
+ const line = nodeToLine(node, parentId, capturedAt);
588
+ if (onPath.has(line.rollout_id)) throw new Error(`subagent_trajectories cycle through trajectory_id ${line.rollout_id}`);
589
+ onPath.add(line.rollout_id);
590
+ lines.push(line);
591
+ for (const child of node.subagent_trajectories ?? []) walk(child, line.rollout_id, onPath);
592
+ onPath.delete(line.rollout_id);
593
+ };
594
+ walk(trajectory, null, /* @__PURE__ */ new Set());
595
+ return lines;
596
+ }
597
+ /**
598
+ * THE explicit door out of `holdout` for imported lines.
599
+ *
600
+ * Import forces `holdout` because a document's own claim about its split is not
601
+ * evidence — anyone can write `extra.tangle.task.split`. Promoting a file to a
602
+ * trainable split is an operator's decision about provenance they verified, so
603
+ * it is a separate, greppable call: `grep relabelImportedSplit` enumerates
604
+ * every place foreign data was declared trainable, which is exactly the audit
605
+ * the trusted-escrow version made impossible.
606
+ *
607
+ * Returns plain `RolloutLine`s. They still have to pass `assertMinted` (and its
608
+ * anti-Goodhart check) to reach an exporter — re-labeling a split is not
609
+ * minting a reward.
610
+ */
611
+ function relabelImportedSplit(lines, split) {
612
+ if (!ROLLOUT_SPLITS.includes(split)) throw new Error(`relabelImportedSplit: unknown split ${String(split)}`);
613
+ return lines.map((line) => ({
614
+ ...line,
615
+ task: {
616
+ ...line.task,
617
+ split
618
+ }
619
+ }));
620
+ }
621
+ //#endregion
622
+ export { toHarborTrajectories as a, relabelImportedSplit as i, HARBOR_IMPORT_GAP as n, toHarborTrajectory as o, fromHarborTrajectory as r, ATIF_SCHEMA_VERSION as t };
623
+
624
+ //# sourceMappingURL=rollout-BOYjemfR.js.map