@tangle-network/agent-eval 0.216.1 → 0.218.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 (532) hide show
  1. package/CHANGELOG.md +137 -57
  2. package/README.md +2 -2
  3. package/dist/adapters/http.d.ts +2 -2
  4. package/dist/{agent-profile-VFcQncbW.d.ts → agent-profile-DTt8uGP9.d.ts} +4 -17
  5. package/dist/agent-profile-DTt8uGP9.d.ts.map +1 -0
  6. package/dist/{agent-profile-cell-BK8mlqlq.js → agent-profile-cell-B1V1gUZs.js} +4 -53
  7. package/dist/agent-profile-cell-B1V1gUZs.js.map +1 -0
  8. package/dist/{agent-profile-cell-BNp-Js9F.d.ts → agent-profile-cell-BcpFbNd5.d.ts} +2 -22
  9. package/dist/agent-profile-cell-BcpFbNd5.d.ts.map +1 -0
  10. package/dist/{agreement-irr-BEWLIF3_.js → agreement-irr-BhAqjluA.js} +5 -5
  11. package/dist/agreement-irr-BhAqjluA.js.map +1 -0
  12. package/dist/analyst/index.d.ts +36 -169
  13. package/dist/analyst/index.d.ts.map +1 -1
  14. package/dist/analyst/index.js +17 -192
  15. package/dist/analyst/index.js.map +1 -1
  16. package/dist/{analyze-runs-D68fd-su.d.ts → analyze-runs-DjlZOVXx.d.ts} +5 -5
  17. package/dist/{analyze-runs-D68fd-su.d.ts.map → analyze-runs-DjlZOVXx.d.ts.map} +1 -1
  18. package/dist/{analyze-runs-C84irm4i.js → analyze-runs-DqPJaJ4X.js} +225 -21
  19. package/dist/analyze-runs-DqPJaJ4X.js.map +1 -0
  20. package/dist/authenticity/index.d.ts +0 -23
  21. package/dist/authenticity/index.d.ts.map +1 -1
  22. package/dist/authenticity/index.js +1 -34
  23. package/dist/authenticity/index.js.map +1 -1
  24. package/dist/{benchmark-command-By0vh8q7.js → benchmark-command-BupdHRyf.js} +1225 -661
  25. package/dist/benchmark-command-BupdHRyf.js.map +1 -0
  26. package/dist/benchmarks/index.d.ts +5 -6
  27. package/dist/benchmarks/index.d.ts.map +1 -1
  28. package/dist/benchmarks/index.js +4 -4
  29. package/dist/benchmarks/index.js.map +1 -1
  30. package/dist/builder-eval/index.d.ts +3 -3
  31. package/dist/builder-eval/index.js +2 -2
  32. package/dist/builder-eval/index.js.map +1 -1
  33. package/dist/campaign/index.d.ts +7 -7
  34. package/dist/campaign/index.js +15 -15
  35. package/dist/{campaign-BudZ70zo.js → campaign-CGvUTnmc.js} +324 -800
  36. package/dist/campaign-CGvUTnmc.js.map +1 -0
  37. package/dist/{campaign-evidence-Clrn4hBV.js → campaign-evidence-DunzcJGv.js} +10 -18
  38. package/dist/{campaign-evidence-Clrn4hBV.js.map → campaign-evidence-DunzcJGv.js.map} +1 -1
  39. package/dist/{canonical-B2RqLofv.js → canonical-Dq2hOQ8L.js} +2 -2
  40. package/dist/{canonical-B2RqLofv.js.map → canonical-Dq2hOQ8L.js.map} +1 -1
  41. package/dist/cell-spend-DEWR3nj-.js +90 -0
  42. package/dist/cell-spend-DEWR3nj-.js.map +1 -0
  43. package/dist/{chat-client-l-MVDlDk.js → chat-client-B2pXlPdx.js} +2 -2
  44. package/dist/{chat-client-l-MVDlDk.js.map → chat-client-B2pXlPdx.js.map} +1 -1
  45. package/dist/{chat-json-call-puMArmtW.js → chat-json-call-Dm9c-b41.js} +3 -2
  46. package/dist/chat-json-call-Dm9c-b41.js.map +1 -0
  47. package/dist/{claim-q4HQhK1G.js → claim-BPVuyHuy.js} +3 -3
  48. package/dist/{claim-q4HQhK1G.js.map → claim-BPVuyHuy.js.map} +1 -1
  49. package/dist/cli.js +113 -12
  50. package/dist/cli.js.map +1 -1
  51. package/dist/{client-BzL9niqi.d.ts → client-hwo3cJjR.d.ts} +3 -16
  52. package/dist/client-hwo3cJjR.d.ts.map +1 -0
  53. package/dist/{cluster-bootstrap-qcUWYFl-.js → cluster-bootstrap-DEwwhl0C.js} +3 -3
  54. package/dist/{cluster-bootstrap-qcUWYFl-.js.map → cluster-bootstrap-DEwwhl0C.js.map} +1 -1
  55. package/dist/{produced-state-BsDmnwxc.js → completion-verifier-DbLVf3i8.js} +9 -64
  56. package/dist/completion-verifier-DbLVf3i8.js.map +1 -0
  57. package/dist/contract/index.d.ts +12 -12
  58. package/dist/contract/index.js +107 -403
  59. package/dist/contract/index.js.map +1 -1
  60. package/dist/{cost-ledger-BP8V4kUQ.js → cost-ledger-D0352Z4d.js} +4 -8
  61. package/dist/cost-ledger-D0352Z4d.js.map +1 -0
  62. package/dist/dataset-DQqhOCPt.d.ts.map +1 -1
  63. package/dist/{default-registry-COhk9g36.js → default-registry-BJ-Pq6yL.js} +314 -285
  64. package/dist/default-registry-BJ-Pq6yL.js.map +1 -0
  65. package/dist/{default-registry-DzHiGruW.d.ts → default-registry-DXgLmoDI.d.ts} +7 -50
  66. package/dist/default-registry-DXgLmoDI.d.ts.map +1 -0
  67. package/dist/{define-agent-eval-CNTPzIkp.js → define-agent-eval-BGdFKlrc.js} +170 -110
  68. package/dist/define-agent-eval-BGdFKlrc.js.map +1 -0
  69. package/dist/{define-agent-eval-WSck0CZJ.d.ts → define-agent-eval-BlH10zEw.d.ts} +8 -8
  70. package/dist/define-agent-eval-BlH10zEw.d.ts.map +1 -0
  71. package/dist/{descriptive-DboxPZrG.js → descriptive-CVNy48rR.js} +2 -2
  72. package/dist/{descriptive-DboxPZrG.js.map → descriptive-CVNy48rR.js.map} +1 -1
  73. package/dist/diagnosis/index.d.ts +4 -14
  74. package/dist/diagnosis/index.d.ts.map +1 -1
  75. package/dist/diagnosis/index.js +67 -28
  76. package/dist/diagnosis/index.js.map +1 -1
  77. package/dist/{dspy-rlm-engine-LRCu61m5.js → dspy-rlm-engine-CSMwudLO.js} +5 -10
  78. package/dist/dspy-rlm-engine-CSMwudLO.js.map +1 -0
  79. package/dist/{emitter-HcCmFQl_.d.ts → emitter-DABYYTcH.d.ts} +5 -5
  80. package/dist/emitter-DABYYTcH.d.ts.map +1 -0
  81. package/dist/emitter-DbMXUIVP.js.map +1 -1
  82. package/dist/{engine-3A_4jOlI.d.ts → engine-BvZ0R-36.d.ts} +17 -21
  83. package/dist/engine-BvZ0R-36.d.ts.map +1 -0
  84. package/dist/{equal-terms-BtdXayCJ.js → equal-terms-DbPGcVtI.js} +2 -2
  85. package/dist/equal-terms-DbPGcVtI.js.map +1 -0
  86. package/dist/{errors-DVZiqS7K.js → errors-BcOs5MKW.js} +2 -8
  87. package/dist/{errors-DVZiqS7K.js.map → errors-BcOs5MKW.js.map} +1 -1
  88. package/dist/eval-campaign-BUMIxKTE.js +393 -0
  89. package/dist/eval-campaign-BUMIxKTE.js.map +1 -0
  90. package/dist/{evaluation-6Yoi74gM.d.ts → evaluation-BOZ38vOH.d.ts} +7 -7
  91. package/dist/evaluation-BOZ38vOH.d.ts.map +1 -0
  92. package/dist/evaluation.d.ts +2 -2
  93. package/dist/evaluation.js +1 -1
  94. package/dist/evaluation.js.map +1 -1
  95. package/dist/{exact-types-ClugMJfI.d.ts → exact-types-CflbJ9f3.d.ts} +2 -2
  96. package/dist/{exact-types-ClugMJfI.d.ts.map → exact-types-CflbJ9f3.d.ts.map} +1 -1
  97. package/dist/{exec-ChJ6d5if.js → exec-CpbtOXVt.js} +2 -24
  98. package/dist/{exec-ChJ6d5if.js.map → exec-CpbtOXVt.js.map} +1 -1
  99. package/dist/execution-tracks-CpgFPpS5.js.map +1 -1
  100. package/dist/experiment/index.d.ts +9 -112
  101. package/dist/experiment/index.d.ts.map +1 -1
  102. package/dist/experiment/index.js +258 -311
  103. package/dist/experiment/index.js.map +1 -1
  104. package/dist/{exporters-X4xwla8A.js → exporters-DWvM16LE.js} +3 -3
  105. package/dist/exporters-DWvM16LE.js.map +1 -0
  106. package/dist/{exporters-ChTnR90l.d.ts → exporters-Dk3oEbK_.d.ts} +2 -4
  107. package/dist/{exporters-ChTnR90l.d.ts.map → exporters-Dk3oEbK_.d.ts.map} +1 -1
  108. package/dist/{external-optimizer-process-BjMGUuds.js → external-optimizer-process-C3Wm7Vhn.js} +4 -3
  109. package/dist/external-optimizer-process-C3Wm7Vhn.js.map +1 -0
  110. package/dist/{external-optimizer-subprocess-BqW0hHcI.js → external-optimizer-subprocess-B5gdLRZv.js} +9 -11
  111. package/dist/external-optimizer-subprocess-B5gdLRZv.js.map +1 -0
  112. package/dist/{extract-usage-BrnzRJ6H.js → extract-usage-BZLU01kR.js} +2 -23
  113. package/dist/{extract-usage-BrnzRJ6H.js.map → extract-usage-BZLU01kR.js.map} +1 -1
  114. package/dist/{failure-cluster-CbgEDcFJ.d.ts → failure-cluster-DN0t63Z0.d.ts} +4 -43
  115. package/dist/failure-cluster-DN0t63Z0.d.ts.map +1 -0
  116. package/dist/{failure-taxonomy-CjabTATj.js → failure-taxonomy-Bx5oWqaW.js} +2 -19
  117. package/dist/{failure-taxonomy-CjabTATj.js.map → failure-taxonomy-Bx5oWqaW.js.map} +1 -1
  118. package/dist/{feedback-trajectory-C4EG0nNH.d.ts → feedback-trajectory-BWmhRBGu.d.ts} +7 -9
  119. package/dist/feedback-trajectory-BWmhRBGu.d.ts.map +1 -0
  120. package/dist/{semantic-concept-judge-BQF8te0T.js → findings-store-BtTzPL0d.js} +9 -249
  121. package/dist/findings-store-BtTzPL0d.js.map +1 -0
  122. package/dist/fuzz.d.ts +19 -62
  123. package/dist/fuzz.d.ts.map +1 -1
  124. package/dist/fuzz.js +62 -108
  125. package/dist/fuzz.js.map +1 -1
  126. package/dist/{hf-dataset-BR2yhuNn.js → hf-dataset-CKxIJQba.js} +4 -24
  127. package/dist/hf-dataset-CKxIJQba.js.map +1 -0
  128. package/dist/hosted/index.d.ts +2 -2
  129. package/dist/hosted/index.js +2 -2
  130. package/dist/{index-CyszSg4O.d.ts → index-B16FNdW5.d.ts} +145 -360
  131. package/dist/index-B16FNdW5.d.ts.map +1 -0
  132. package/dist/{index-DV-jSzxF.d.ts → index-BLGqZ81N.d.ts} +10 -15
  133. package/dist/{index-DV-jSzxF.d.ts.map → index-BLGqZ81N.d.ts.map} +1 -1
  134. package/dist/{index-BO41eGj5.d.ts → index-CX-GAUpw.d.ts} +3 -7
  135. package/dist/index-CX-GAUpw.d.ts.map +1 -0
  136. package/dist/{index-DHKEAv3s.d.ts → index-CalAsXMR.d.ts} +8 -68
  137. package/dist/index-CalAsXMR.d.ts.map +1 -0
  138. package/dist/{index-BFRO6chs.d.ts → index-CiRwLv2R.d.ts} +5 -69
  139. package/dist/index-CiRwLv2R.d.ts.map +1 -0
  140. package/dist/{index-DPcngtwt.d.ts → index-DbMOXYnP.d.ts} +11 -36
  141. package/dist/index-DbMOXYnP.d.ts.map +1 -0
  142. package/dist/index.d.ts +211 -218
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +999 -1714
  145. package/dist/index.js.map +1 -1
  146. package/dist/{integrity-dLiDe2kD.js → integrity-C8oUeB0g.js} +326 -203
  147. package/dist/integrity-C8oUeB0g.js.map +1 -0
  148. package/dist/{integrity-BXOsAb3i.js → integrity-W4CADcFc.js} +3 -7
  149. package/dist/{integrity-BXOsAb3i.js.map → integrity-W4CADcFc.js.map} +1 -1
  150. package/dist/{integrity-DAMEDFaC.d.ts → integrity-_qgZLA5p.d.ts} +4 -6
  151. package/dist/{integrity-DAMEDFaC.d.ts.map → integrity-_qgZLA5p.d.ts.map} +1 -1
  152. package/dist/{internal-Epl-YBZW.js → internal-BTK91Bqt.js} +3 -3
  153. package/dist/{internal-Epl-YBZW.js.map → internal-BTK91Bqt.js.map} +1 -1
  154. package/dist/{interval-CELpye1n.js → interval-Dq9gt7jx.js} +3 -3
  155. package/dist/{interval-CELpye1n.js.map → interval-Dq9gt7jx.js.map} +1 -1
  156. package/dist/{journal-DfRz9kps.js → journal-C7om8Gum.js} +157 -147
  157. package/dist/journal-C7om8Gum.js.map +1 -0
  158. package/dist/json-BhdsJaOQ.js +111 -0
  159. package/dist/json-BhdsJaOQ.js.map +1 -0
  160. package/dist/{judge-calibration-BpCy5XQl.js → judge-calibration-BkXMIWA4.js} +3 -3
  161. package/dist/{judge-calibration-BpCy5XQl.js.map → judge-calibration-BkXMIWA4.js.map} +1 -1
  162. package/dist/{judge-gate-iY9s4L44.js → judge-gate-Co5tuh57.js} +4 -27
  163. package/dist/{judge-gate-iY9s4L44.js.map → judge-gate-Co5tuh57.js.map} +1 -1
  164. package/dist/{judge-gate-CE7CQAgt.d.ts → judge-gate-DsL0yFcb.d.ts} +8 -9
  165. package/dist/judge-gate-DsL0yFcb.d.ts.map +1 -0
  166. package/dist/{kind-factory-BobI5Jy3.js → kind-factory-Gy4fXixd.js} +88 -17
  167. package/dist/kind-factory-Gy4fXixd.js.map +1 -0
  168. package/dist/ledger-core/index.d.ts +2 -2
  169. package/dist/ledger-core/index.js +4 -4
  170. package/dist/ledger-core/lock-holder.d.ts +2 -0
  171. package/dist/ledger-core/lock-holder.js +181 -0
  172. package/dist/ledger-core/lock-holder.js.map +1 -0
  173. package/dist/{ledger-core-Gq7yp8lP.js → ledger-core-CAxUdDk0.js} +5 -84
  174. package/dist/ledger-core-CAxUdDk0.js.map +1 -0
  175. package/dist/{llm-client-CyBAoYiX.js → llm-client-_Y6ic-tf.js} +243 -355
  176. package/dist/llm-client-_Y6ic-tf.js.map +1 -0
  177. package/dist/{llm-judge-CG12SQJq.js → llm-judge-Djxh-Uhs.js} +662 -482
  178. package/dist/llm-judge-Djxh-Uhs.js.map +1 -0
  179. package/dist/lock-holder-DaJbfpci.d.ts +86 -0
  180. package/dist/lock-holder-DaJbfpci.d.ts.map +1 -0
  181. package/dist/matrix/index.d.ts +3 -3
  182. package/dist/matrix/index.js +3 -2
  183. package/dist/{matrix-Dm0BQW7U.js → matrix-B8l-Nsxd.js} +3 -88
  184. package/dist/matrix-B8l-Nsxd.js.map +1 -0
  185. package/dist/{matrix-DSrSxjjy.d.ts → matrix-CCSBna4q.d.ts} +9 -18
  186. package/dist/matrix-CCSBna4q.d.ts.map +1 -0
  187. package/dist/{mean-DHoMiudD.js → mean-BbA_JCzW.js} +39 -5
  188. package/dist/mean-BbA_JCzW.js.map +1 -0
  189. package/dist/meta-eval/index.d.ts +5 -5
  190. package/dist/meta-eval/index.js +10 -10
  191. package/dist/metrics-BKaPBtIG.js.map +1 -1
  192. package/dist/{mint-DNU8QPG4.d.ts → mint-BRZXuwRi.d.ts} +4 -4
  193. package/dist/{mint-DNU8QPG4.d.ts.map → mint-BRZXuwRi.d.ts.map} +1 -1
  194. package/dist/{mint-QaD5cA0u.js → mint-CbdwjTPW.js} +4 -4
  195. package/dist/{mint-QaD5cA0u.js.map → mint-CbdwjTPW.js.map} +1 -1
  196. package/dist/{multi-layer-verifier-BUaQ4C17.d.ts → multi-layer-verifier-DEgMUk6v.d.ts} +2 -2
  197. package/dist/{multi-layer-verifier-BUaQ4C17.d.ts.map → multi-layer-verifier-DEgMUk6v.d.ts.map} +1 -1
  198. package/dist/{multiplicity-DQUFcbW4.js → multiplicity-Sg0U7h8j.js} +2 -2
  199. package/dist/{multiplicity-DQUFcbW4.js.map → multiplicity-Sg0U7h8j.js.map} +1 -1
  200. package/dist/multishot/golden/index.d.ts +1 -23
  201. package/dist/multishot/golden/index.d.ts.map +1 -1
  202. package/dist/multishot/golden/index.js +3 -3
  203. package/dist/multishot/golden/index.js.map +1 -1
  204. package/dist/multishot/index.d.ts +3 -12
  205. package/dist/multishot/index.d.ts.map +1 -1
  206. package/dist/multishot/index.js +4 -3
  207. package/dist/multishot/index.js.map +1 -1
  208. package/dist/openapi.json +114 -10
  209. package/dist/{otel-spans-B9tUXRHF.js → otel-spans-CdN909k1.js} +3 -3
  210. package/dist/{otel-spans-B9tUXRHF.js.map → otel-spans-CdN909k1.js.map} +1 -1
  211. package/dist/{paired-arms-CwMGJsrS.js → paired-arms-Ct4LTKc1.js} +32 -9
  212. package/dist/paired-arms-Ct4LTKc1.js.map +1 -0
  213. package/dist/{paired-binary-CvpFHfKZ.js → paired-binary-B_nejA44.js} +3 -36
  214. package/dist/paired-binary-B_nejA44.js.map +1 -0
  215. package/dist/{paired-promotion-decision-DPKz8ZnF.d.ts → paired-promotion-decision-CQMJ5xGN.d.ts} +2 -34
  216. package/dist/paired-promotion-decision-CQMJ5xGN.d.ts.map +1 -0
  217. package/dist/{paired-promotion-decision-DsAPYGCm.js → paired-promotion-decision-D0SHb-ZL.js} +3 -3
  218. package/dist/{paired-promotion-decision-DsAPYGCm.js.map → paired-promotion-decision-D0SHb-ZL.js.map} +1 -1
  219. package/dist/{pareto-Cm6ndrWN.js → pareto-CTv8vozZ.js} +11 -11
  220. package/dist/pareto-CTv8vozZ.js.map +1 -0
  221. package/dist/pipelines/index.d.ts +16 -19
  222. package/dist/pipelines/index.d.ts.map +1 -1
  223. package/dist/pipelines/index.js +4 -68
  224. package/dist/pipelines/index.js.map +1 -1
  225. package/dist/{power-and-mde-Hj2ubb4B.js → power-and-mde-N5nU4_Ly.js} +3 -3
  226. package/dist/{power-and-mde-Hj2ubb4B.js.map → power-and-mde-N5nU4_Ly.js.map} +1 -1
  227. package/dist/{prime-protocol-CHKgA3a6.js → prime-protocol-BFgGrEMP.js} +3 -3
  228. package/dist/prime-protocol-BFgGrEMP.js.map +1 -0
  229. package/dist/{prime-protocol-HiB9HX7E.d.ts → prime-protocol-BWG2DQIk.d.ts} +3 -21
  230. package/dist/prime-protocol-BWG2DQIk.d.ts.map +1 -0
  231. package/dist/profile-cell.d.ts +2 -2
  232. package/dist/profile-cell.js +2 -2
  233. package/dist/{promotion-gate-BawrdPYr.d.ts → promotion-gate-CxEHRsZW.d.ts} +7 -8
  234. package/dist/{promotion-gate-BawrdPYr.d.ts.map → promotion-gate-CxEHRsZW.d.ts.map} +1 -1
  235. package/dist/{promotion-policy-KO57gbyV.js → promotion-policy-6A8osGr_.js} +4 -4
  236. package/dist/{promotion-policy-KO57gbyV.js.map → promotion-policy-6A8osGr_.js.map} +1 -1
  237. package/dist/{proposal-findings-CY1xKn_a.js → proposal-findings-n-5WBbEx.js} +3 -3
  238. package/dist/proposal-findings-n-5WBbEx.js.map +1 -0
  239. package/dist/{query-BUCZCK7F.js → query-B_RZ36an.js} +5 -5
  240. package/dist/query-B_RZ36an.js.map +1 -0
  241. package/dist/{query-DK1nWcmp.d.ts → query-Cmv_U8vf.d.ts} +4 -24
  242. package/dist/{query-DK1nWcmp.d.ts.map → query-Cmv_U8vf.d.ts.map} +1 -1
  243. package/dist/{random-ByUSnV9w.js → random-DDDcC7YU.js} +2 -2
  244. package/dist/{random-ByUSnV9w.js.map → random-DDDcC7YU.js.map} +1 -1
  245. package/dist/{raw-provider-sink-DoHz4JNG.js → raw-provider-sink-75w4FWBj.js} +2 -2
  246. package/dist/{raw-provider-sink-DoHz4JNG.js.map → raw-provider-sink-75w4FWBj.js.map} +1 -1
  247. package/dist/{redact-mtCCcT8z.d.ts → redact-DXdlFb_U.d.ts} +2 -3
  248. package/dist/redact-DXdlFb_U.d.ts.map +1 -0
  249. package/dist/{redact-B5xXKqQ3.js → redact-mtkTiJVk.js} +2 -7
  250. package/dist/{redact-B5xXKqQ3.js.map → redact-mtkTiJVk.js.map} +1 -1
  251. package/dist/{registry-D7_hm2fK.d.ts → registry-ssNoHzwD.d.ts} +4 -4
  252. package/dist/{registry-D7_hm2fK.d.ts.map → registry-ssNoHzwD.d.ts.map} +1 -1
  253. package/dist/{release-confidence-CpuP65S5.js → release-confidence-CYIFH-fp.js} +6 -11
  254. package/dist/release-confidence-CYIFH-fp.js.map +1 -0
  255. package/dist/{report-command-SC9nqb4M.js → render-Cs34y0iX.js} +625 -587
  256. package/dist/render-Cs34y0iX.js.map +1 -0
  257. package/dist/reporting.d.ts +6 -6
  258. package/dist/reporting.js +8 -8
  259. package/dist/{researcher-CEcfku-T.d.ts → researcher-GU1tV4dn.d.ts} +9 -9
  260. package/dist/{researcher-CEcfku-T.d.ts.map → researcher-GU1tV4dn.d.ts.map} +1 -1
  261. package/dist/{reward-CpCmAM8L.d.ts → reward-DrZ71vnf.d.ts} +3 -26
  262. package/dist/reward-DrZ71vnf.d.ts.map +1 -0
  263. package/dist/{reward-hacking-E0d-WVcP.js → reward-hacking-ByuETaIb.js} +3 -3
  264. package/dist/{reward-hacking-E0d-WVcP.js.map → reward-hacking-ByuETaIb.js.map} +1 -1
  265. package/dist/{reward-hacking-RVdZ6Kkt.d.ts → reward-hacking-E52wq86n.d.ts} +5 -18
  266. package/dist/reward-hacking-E52wq86n.d.ts.map +1 -0
  267. package/dist/reward-nw2xZGZG.js.map +1 -1
  268. package/dist/rl.d.ts +117 -295
  269. package/dist/rl.d.ts.map +1 -1
  270. package/dist/rl.js +27 -747
  271. package/dist/rl.js.map +1 -1
  272. package/dist/rollout/index.d.ts +5 -5
  273. package/dist/rollout/index.js +7 -8
  274. package/dist/{rollout-DZV1t2Wg.js → rollout-Dd1ucT_M.js} +88 -13
  275. package/dist/rollout-Dd1ucT_M.js.map +1 -0
  276. package/dist/{rubric-predictive-validity-DaFW70y9.js → rubric-predictive-validity-D3_oI72N.js} +3 -3
  277. package/dist/{rubric-predictive-validity-DaFW70y9.js.map → rubric-predictive-validity-D3_oI72N.js.map} +1 -1
  278. package/dist/{rubric-predictive-validity-C03EC7ZE.d.ts → rubric-predictive-validity-DiwT8PbL.d.ts} +2 -2
  279. package/dist/{rubric-predictive-validity-C03EC7ZE.d.ts.map → rubric-predictive-validity-DiwT8PbL.d.ts.map} +1 -1
  280. package/dist/{run-record-C1E24G2A.d.ts → run-record-CaxbLq6Y.d.ts} +4 -10
  281. package/dist/run-record-CaxbLq6Y.d.ts.map +1 -0
  282. package/dist/{run-record-C5e7FjhJ.js → run-record-CysKLB93.js} +3 -3
  283. package/dist/run-record-CysKLB93.js.map +1 -0
  284. package/dist/{run-record-Boc5IUTp.js → run-record-DhEJgoPz.js} +4 -4
  285. package/dist/{run-record-Boc5IUTp.js.map → run-record-DhEJgoPz.js.map} +1 -1
  286. package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -1
  287. package/dist/{schema-CSf6qWgZ.js → schema-Bt2vLFm3.js} +2 -14
  288. package/dist/schema-Bt2vLFm3.js.map +1 -0
  289. package/dist/schema-C-ziyJD7.d.ts.map +1 -1
  290. package/dist/{schema-BuiujZ-g.js → schema-CvhfLjtZ.js} +78 -48
  291. package/dist/schema-CvhfLjtZ.js.map +1 -0
  292. package/dist/{schema-2g7trUwH.d.ts → schema-D6EVKzTB.d.ts} +4 -5
  293. package/dist/schema-D6EVKzTB.d.ts.map +1 -0
  294. package/dist/search/index.d.ts +3 -31
  295. package/dist/search/index.d.ts.map +1 -1
  296. package/dist/search/index.js +4 -4
  297. package/dist/{search-kernel-DyNEa6IU.d.ts → search-kernel-p9JB3SmL.d.ts} +10 -27
  298. package/dist/search-kernel-p9JB3SmL.d.ts.map +1 -0
  299. package/dist/{search-ledger-CVUGLDZp.js → search-ledger-ClpN4I3e.js} +7 -7
  300. package/dist/{search-ledger-CVUGLDZp.js.map → search-ledger-ClpN4I3e.js.map} +1 -1
  301. package/dist/{search-ledger-file-DDQUgvCg.js → search-ledger-file-Bd5Tioq6.js} +4 -4
  302. package/dist/search-ledger-file-Bd5Tioq6.js.map +1 -0
  303. package/dist/{search-shipper-BOSD46qv.js → search-shipper-Bg2HW3Uv.js} +4 -4
  304. package/dist/search-shipper-Bg2HW3Uv.js.map +1 -0
  305. package/dist/{search-summary-BQCSWf1g.js → search-summary-CrBuvVnf.js} +5 -5
  306. package/dist/{search-summary-BQCSWf1g.js.map → search-summary-CrBuvVnf.js.map} +1 -1
  307. package/dist/{sequential-CzK5DarL.js → sequential-BVv1sjsw.js} +2 -32
  308. package/dist/{sequential-CzK5DarL.js.map → sequential-BVv1sjsw.js.map} +1 -1
  309. package/dist/{sequential-Bf_pbE50.js → sequential-CimQrbjv.js} +5 -5
  310. package/dist/sequential-CimQrbjv.js.map +1 -0
  311. package/dist/{sequential-BhsrMupG.d.ts → sequential-KwGspfeR.d.ts} +2 -9
  312. package/dist/{sequential-BhsrMupG.d.ts.map → sequential-KwGspfeR.d.ts.map} +1 -1
  313. package/dist/{sequential-eprocess-DM_qENCl.js → sequential-eprocess-DodI6RoF.js} +2 -2
  314. package/dist/{sequential-eprocess-DM_qENCl.js.map → sequential-eprocess-DodI6RoF.js.map} +1 -1
  315. package/dist/{server-e9oWO_bN.js → server-C6M0qR8h.js} +101 -101
  316. package/dist/server-C6M0qR8h.js.map +1 -0
  317. package/dist/{single-run-lock-CV9Eyd_q.js → single-run-lock-Dekd8_Wv.js} +7 -7
  318. package/dist/single-run-lock-Dekd8_Wv.js.map +1 -0
  319. package/dist/{skillopt-optimization-method-BiwA8nfX.js → skillopt-optimization-method-5dlex7MJ.js} +1386 -1184
  320. package/dist/skillopt-optimization-method-5dlex7MJ.js.map +1 -0
  321. package/dist/{spans-BHAUXMGN.d.ts → spans-CVngGij3.d.ts} +2 -2
  322. package/dist/{spans-BHAUXMGN.d.ts.map → spans-CVngGij3.d.ts.map} +1 -1
  323. package/dist/{statistical-heldout-CYpGaoDH.d.ts → statistical-heldout-BHfLZHrm.d.ts} +8 -67
  324. package/dist/statistical-heldout-BHfLZHrm.d.ts.map +1 -0
  325. package/dist/{statistical-heldout-42NlCNDe.js → statistical-heldout-Bksv92Th.js} +3 -3
  326. package/dist/statistical-heldout-Bksv92Th.js.map +1 -0
  327. package/dist/{steps-Bg5-KVx1.d.ts → steps-DlepJPwD.d.ts} +2 -56
  328. package/dist/steps-DlepJPwD.d.ts.map +1 -0
  329. package/dist/{store-C4avFjIi.d.ts → store-B3nWRy3B.d.ts} +2 -2
  330. package/dist/{store-C4avFjIi.d.ts.map → store-B3nWRy3B.d.ts.map} +1 -1
  331. package/dist/{store-otlp-DJ9dtA5x.js → store-otlp-BteDAbHK.js} +3 -3
  332. package/dist/{store-otlp-DJ9dtA5x.js.map → store-otlp-BteDAbHK.js.map} +1 -1
  333. package/dist/{store-tool-spans-CIX5arAG.js → store-tool-spans-D5l_OfTJ.js} +8 -8
  334. package/dist/store-tool-spans-D5l_OfTJ.js.map +1 -0
  335. package/dist/{store-tool-spans-DdCSPa7C.d.ts → store-tool-spans-DZS0HWVf.d.ts} +9 -18
  336. package/dist/store-tool-spans-DZS0HWVf.d.ts.map +1 -0
  337. package/dist/storyboard/index.d.ts +4 -11
  338. package/dist/storyboard/index.d.ts.map +1 -1
  339. package/dist/storyboard/index.js +1 -16
  340. package/dist/storyboard/index.js.map +1 -1
  341. package/dist/{summary-report-V_JACR4Y.js → summary-report-BsXJoYX5.js} +88 -10
  342. package/dist/summary-report-BsXJoYX5.js.map +1 -0
  343. package/dist/{summary-report-bdFDXq0b.d.ts → summary-report-CkbRcSuu.d.ts} +25 -19
  344. package/dist/summary-report-CkbRcSuu.d.ts.map +1 -0
  345. package/dist/supervisor-run/index.d.ts +60 -28
  346. package/dist/supervisor-run/index.d.ts.map +1 -1
  347. package/dist/supervisor-run/index.js +4 -458
  348. package/dist/supervisor-run/index.js.map +1 -1
  349. package/dist/{systemone-BomhHr2c.d.ts → systemone-BMzDJb1i.d.ts} +5 -5
  350. package/dist/{systemone-BomhHr2c.d.ts.map → systemone-BMzDJb1i.d.ts.map} +1 -1
  351. package/dist/systemone-protocol.js +1 -1
  352. package/dist/{systemone-review-CUVcQJu6.d.ts → systemone-review-CwE6JGIp.d.ts} +2 -2
  353. package/dist/{systemone-review-CUVcQJu6.d.ts.map → systemone-review-CwE6JGIp.d.ts.map} +1 -1
  354. package/dist/{systemone-review-D7sXwsqq.js → systemone-review-DzdOJ8I6.js} +3 -3
  355. package/dist/{systemone-review-D7sXwsqq.js.map → systemone-review-DzdOJ8I6.js.map} +1 -1
  356. package/dist/systemone.d.ts +5 -5
  357. package/dist/systemone.js +5 -5
  358. package/dist/systemone.js.map +1 -1
  359. package/dist/{task-failure-attributes-hEmASjix.js → task-failure-attributes-BMsblaDh.js} +3 -3
  360. package/dist/task-failure-attributes-BMsblaDh.js.map +1 -0
  361. package/dist/{terminal-record-DZyQZ3pz.js → terminal-record-D4Rv-j1W.js} +244 -196
  362. package/dist/terminal-record-D4Rv-j1W.js.map +1 -0
  363. package/dist/{tool-groups-C3NEcdCM.d.ts → tool-groups-DyNz2JZ_.d.ts} +3 -3
  364. package/dist/tool-groups-DyNz2JZ_.d.ts.map +1 -0
  365. package/dist/{tool-waste-BKgvd-TP.d.ts → tool-waste-CkjzWmeY.d.ts} +25 -28
  366. package/dist/tool-waste-CkjzWmeY.d.ts.map +1 -0
  367. package/dist/{tool-waste-BlesqTqW.js → tool-waste-DLsjS_p-.js} +5 -5
  368. package/dist/{tool-waste-BlesqTqW.js.map → tool-waste-DLsjS_p-.js.map} +1 -1
  369. package/dist/{trace-questions-CM2CAocU.d.ts → trace-questions-xxwgsuMi.d.ts} +4 -9
  370. package/dist/{trace-questions-CM2CAocU.d.ts.map → trace-questions-xxwgsuMi.d.ts.map} +1 -1
  371. package/dist/trace-repair/index.d.ts +14 -211
  372. package/dist/trace-repair/index.d.ts.map +1 -1
  373. package/dist/trace-repair/index.js +865 -981
  374. package/dist/trace-repair/index.js.map +1 -1
  375. package/dist/traces.d.ts +18 -46
  376. package/dist/traces.d.ts.map +1 -1
  377. package/dist/traces.js +13 -13
  378. package/dist/traces.js.map +1 -1
  379. package/dist/trajectory-replay/index.d.ts +7 -118
  380. package/dist/trajectory-replay/index.d.ts.map +1 -1
  381. package/dist/trajectory-replay/index.js +921 -869
  382. package/dist/trajectory-replay/index.js.map +1 -1
  383. package/dist/{tree-C1XYeXvy.js → tree-B5e1uAeL.js} +132 -21
  384. package/dist/tree-B5e1uAeL.js.map +1 -0
  385. package/dist/{types-Cbe2fWBa.d.ts → types-BKCzzmit.d.ts} +3 -3
  386. package/dist/{types-Cbe2fWBa.d.ts.map → types-BKCzzmit.d.ts.map} +1 -1
  387. package/dist/{types-B3jzCp0p.js → types-BXgASBCL.js} +2 -2
  388. package/dist/{types-B3jzCp0p.js.map → types-BXgASBCL.js.map} +1 -1
  389. package/dist/{types-C1tnkEgM.d.ts → types-CW8ewATZ.d.ts} +4 -113
  390. package/dist/types-CW8ewATZ.d.ts.map +1 -0
  391. package/dist/{types-BqkVmHfv.d.ts → types-CmXY0PQf.d.ts} +2 -4
  392. package/dist/types-CmXY0PQf.d.ts.map +1 -0
  393. package/dist/{types-C02qtnG8.d.ts → types-D-mgRzlh.d.ts} +7 -28
  394. package/dist/types-D-mgRzlh.d.ts.map +1 -0
  395. package/dist/{types-IXD2HJzu.js → types-DqFMNTgK.js} +2 -4
  396. package/dist/types-DqFMNTgK.js.map +1 -0
  397. package/dist/{types-Cq8mSbq8.d.ts → types-DtkO1G9L.d.ts} +7 -9
  398. package/dist/{types-Cq8mSbq8.d.ts.map → types-DtkO1G9L.d.ts.map} +1 -1
  399. package/dist/{verdict-Dl0tiT1X.js → verdict-BGQmxQ8A.js} +3 -3
  400. package/dist/verdict-BGQmxQ8A.js.map +1 -0
  401. package/dist/{verdict-E4eRNf7-.d.ts → verdict-C24NELtN.d.ts} +2 -15
  402. package/dist/{verdict-E4eRNf7-.d.ts.map → verdict-C24NELtN.d.ts.map} +1 -1
  403. package/dist/{verdict-cache-Bm8EKL2s.js → verdict-cache-CL_7tePD.js} +2 -2
  404. package/dist/verdict-cache-CL_7tePD.js.map +1 -0
  405. package/dist/wire/index.d.ts +31 -410
  406. package/dist/wire/index.d.ts.map +1 -1
  407. package/dist/wire/index.js +2 -2
  408. package/docs/changes/jev-evidence-review.md +1 -1
  409. package/docs/changes/jev-product-adoption.md +1 -1
  410. package/docs/changes/jev-recorded-evidence.md +1 -1
  411. package/docs/design/statistics-decisions.md +18 -18
  412. package/docs/design.md +1 -1
  413. package/docs/eval-surface-map.md +1 -0
  414. package/docs/evaluation-integrity.md +1 -1
  415. package/docs/profile-json-identity.md +1 -2
  416. package/docs/proofs/campaign-attempt-retention-20261001/README.md +2 -2
  417. package/docs/public-api.md +158 -538
  418. package/docs/rollout.md +1 -1
  419. package/docs/trace-repair-admission.md +1 -1
  420. package/docs/wire-protocol.md +1 -1
  421. package/package.json +7 -2
  422. package/dist/active-curriculum-B_Lc9kfO.js +0 -61
  423. package/dist/active-curriculum-B_Lc9kfO.js.map +0 -1
  424. package/dist/agent-profile-VFcQncbW.d.ts.map +0 -1
  425. package/dist/agent-profile-cell-BK8mlqlq.js.map +0 -1
  426. package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +0 -1
  427. package/dist/agreement-irr-BEWLIF3_.js.map +0 -1
  428. package/dist/analyze-runs-C84irm4i.js.map +0 -1
  429. package/dist/baseline-Udi_PLuT.js +0 -259
  430. package/dist/baseline-Udi_PLuT.js.map +0 -1
  431. package/dist/benchmark-CXmVVHH2.js +0 -562
  432. package/dist/benchmark-CXmVVHH2.js.map +0 -1
  433. package/dist/benchmark-command-By0vh8q7.js.map +0 -1
  434. package/dist/campaign-BudZ70zo.js.map +0 -1
  435. package/dist/chat-json-call-puMArmtW.js.map +0 -1
  436. package/dist/claude-jsonl-dZir12m6.js +0 -86
  437. package/dist/claude-jsonl-dZir12m6.js.map +0 -1
  438. package/dist/client-BzL9niqi.d.ts.map +0 -1
  439. package/dist/cost-ledger-BP8V4kUQ.js.map +0 -1
  440. package/dist/counterfactual-CPaWN99-.d.ts +0 -60
  441. package/dist/counterfactual-CPaWN99-.d.ts.map +0 -1
  442. package/dist/counterfactual-Dn3veueY.js +0 -98
  443. package/dist/counterfactual-Dn3veueY.js.map +0 -1
  444. package/dist/default-registry-COhk9g36.js.map +0 -1
  445. package/dist/default-registry-DzHiGruW.d.ts.map +0 -1
  446. package/dist/define-agent-eval-CNTPzIkp.js.map +0 -1
  447. package/dist/define-agent-eval-WSck0CZJ.d.ts.map +0 -1
  448. package/dist/dspy-rlm-engine-LRCu61m5.js.map +0 -1
  449. package/dist/effect-sizes-BhzEpXMc.js +0 -82
  450. package/dist/effect-sizes-BhzEpXMc.js.map +0 -1
  451. package/dist/emitter-HcCmFQl_.d.ts.map +0 -1
  452. package/dist/engine-3A_4jOlI.d.ts.map +0 -1
  453. package/dist/equal-terms-BtdXayCJ.js.map +0 -1
  454. package/dist/eval-campaign-90jeaCAI.js +0 -343
  455. package/dist/eval-campaign-90jeaCAI.js.map +0 -1
  456. package/dist/evaluation-6Yoi74gM.d.ts.map +0 -1
  457. package/dist/exporters-X4xwla8A.js.map +0 -1
  458. package/dist/external-optimizer-process-BjMGUuds.js.map +0 -1
  459. package/dist/external-optimizer-subprocess-BqW0hHcI.js.map +0 -1
  460. package/dist/failure-cluster-CbgEDcFJ.d.ts.map +0 -1
  461. package/dist/feedback-trajectory-C4EG0nNH.d.ts.map +0 -1
  462. package/dist/hf-dataset-BR2yhuNn.js.map +0 -1
  463. package/dist/index-BFRO6chs.d.ts.map +0 -1
  464. package/dist/index-BO41eGj5.d.ts.map +0 -1
  465. package/dist/index-CyszSg4O.d.ts.map +0 -1
  466. package/dist/index-DHKEAv3s.d.ts.map +0 -1
  467. package/dist/index-DPcngtwt.d.ts.map +0 -1
  468. package/dist/integrity-dLiDe2kD.js.map +0 -1
  469. package/dist/journal-DfRz9kps.js.map +0 -1
  470. package/dist/judge-gate-CE7CQAgt.d.ts.map +0 -1
  471. package/dist/kind-factory-BobI5Jy3.js.map +0 -1
  472. package/dist/ledger-core-Gq7yp8lP.js.map +0 -1
  473. package/dist/llm-client-CyBAoYiX.js.map +0 -1
  474. package/dist/llm-judge-CG12SQJq.js.map +0 -1
  475. package/dist/matrix-DSrSxjjy.d.ts.map +0 -1
  476. package/dist/matrix-Dm0BQW7U.js.map +0 -1
  477. package/dist/mean-DHoMiudD.js.map +0 -1
  478. package/dist/normal-DsJZtrJc.js +0 -25
  479. package/dist/normal-DsJZtrJc.js.map +0 -1
  480. package/dist/paired-arms-CwMGJsrS.js.map +0 -1
  481. package/dist/paired-binary-CvpFHfKZ.js.map +0 -1
  482. package/dist/paired-promotion-decision-DPKz8ZnF.d.ts.map +0 -1
  483. package/dist/pareto-Cm6ndrWN.js.map +0 -1
  484. package/dist/prime-protocol-CHKgA3a6.js.map +0 -1
  485. package/dist/prime-protocol-HiB9HX7E.d.ts.map +0 -1
  486. package/dist/produced-state-BsDmnwxc.js.map +0 -1
  487. package/dist/proposal-findings-CY1xKn_a.js.map +0 -1
  488. package/dist/query-BUCZCK7F.js.map +0 -1
  489. package/dist/redact-mtCCcT8z.d.ts.map +0 -1
  490. package/dist/release-confidence-CpuP65S5.js.map +0 -1
  491. package/dist/report-command-SC9nqb4M.js.map +0 -1
  492. package/dist/reward-CpCmAM8L.d.ts.map +0 -1
  493. package/dist/reward-hacking-RVdZ6Kkt.d.ts.map +0 -1
  494. package/dist/rollout-DZV1t2Wg.js.map +0 -1
  495. package/dist/run-record-C1E24G2A.d.ts.map +0 -1
  496. package/dist/run-record-C5e7FjhJ.js.map +0 -1
  497. package/dist/schema-2g7trUwH.d.ts.map +0 -1
  498. package/dist/schema-BuiujZ-g.js.map +0 -1
  499. package/dist/schema-CSf6qWgZ.js.map +0 -1
  500. package/dist/search-kernel-DyNEa6IU.d.ts.map +0 -1
  501. package/dist/search-ledger-file-DDQUgvCg.js.map +0 -1
  502. package/dist/search-shipper-BOSD46qv.js.map +0 -1
  503. package/dist/semantic-concept-judge-BQF8te0T.js.map +0 -1
  504. package/dist/sequential-Bf_pbE50.js.map +0 -1
  505. package/dist/server-e9oWO_bN.js.map +0 -1
  506. package/dist/single-run-lock-CV9Eyd_q.js.map +0 -1
  507. package/dist/skillopt-optimization-method-BiwA8nfX.js.map +0 -1
  508. package/dist/statistical-heldout-42NlCNDe.js.map +0 -1
  509. package/dist/statistical-heldout-CYpGaoDH.d.ts.map +0 -1
  510. package/dist/steps-Bg5-KVx1.d.ts.map +0 -1
  511. package/dist/store-tool-spans-CIX5arAG.js.map +0 -1
  512. package/dist/store-tool-spans-DdCSPa7C.d.ts.map +0 -1
  513. package/dist/student-t-DVPW7CdL.js +0 -39
  514. package/dist/student-t-DVPW7CdL.js.map +0 -1
  515. package/dist/summary-report-V_JACR4Y.js.map +0 -1
  516. package/dist/summary-report-bdFDXq0b.d.ts.map +0 -1
  517. package/dist/task-failure-attributes-hEmASjix.js.map +0 -1
  518. package/dist/terminal-record-DZyQZ3pz.js.map +0 -1
  519. package/dist/tool-groups-C3NEcdCM.d.ts.map +0 -1
  520. package/dist/tool-waste-BKgvd-TP.d.ts.map +0 -1
  521. package/dist/trajectory-Y1fmdlw7.d.ts +0 -24
  522. package/dist/trajectory-Y1fmdlw7.d.ts.map +0 -1
  523. package/dist/tree-C1XYeXvy.js.map +0 -1
  524. package/dist/types-BqkVmHfv.d.ts.map +0 -1
  525. package/dist/types-C02qtnG8.d.ts.map +0 -1
  526. package/dist/types-C1tnkEgM.d.ts.map +0 -1
  527. package/dist/types-IXD2HJzu.js.map +0 -1
  528. package/dist/usage-receipt-Cx3xNeyB.js +0 -76
  529. package/dist/usage-receipt-Cx3xNeyB.js.map +0 -1
  530. package/dist/verdict-Dl0tiT1X.js.map +0 -1
  531. package/dist/verdict-cache-Bm8EKL2s.js.map +0 -1
  532. package/docs/design/self-improvement-evidence-audit.md +0 -263
@@ -1 +0,0 @@
1
- {"version":3,"file":"report-command-SC9nqb4M.js","names":["round","round","record","record"],"sources":["../src/supervisor-run/patch-stats.ts","../src/supervisor-run/analyze.ts","../src/supervisor-run/render.ts","../src/supervisor-run/coordination-reader.ts","../src/supervisor-run/runtime-source-limits.ts","../src/supervisor-run/runtime-reader.ts","../src/supervisor-run/reader.ts","../src/supervisor-run/report-command.ts"],"sourcesContent":["/** Unified-diff target, line, and test-file touch counts. */\nimport type { PatchStats } from './types'\n\n/** Unified-diff stats. Counts `+++ b/<path>` targets, body +/- lines, and test-file touches. */\nexport function parsePatch(text: string): PatchStats {\n const files = new Set<string>()\n const testFiles = new Set<string>()\n let added = 0\n let removed = 0\n for (const line of text.split('\\n')) {\n if (line.startsWith('+++ ')) {\n const p = line.slice(4).trim().replace(/^b\\//, '')\n if (p !== '/dev/null') {\n files.add(p)\n if (isTestPath(p)) testFiles.add(p)\n }\n continue\n }\n if (line.startsWith('--- ') || line.startsWith('diff --git') || line.startsWith('index ')) {\n continue\n }\n if (line.startsWith('+')) added += 1\n else if (line.startsWith('-')) removed += 1\n }\n return {\n files: files.size,\n linesAdded: added,\n linesRemoved: removed,\n testFilesTouched: [...testFiles].sort(),\n }\n}\n\nfunction isTestPath(p: string): boolean {\n const base = p.split('/').pop() ?? p\n return (\n /(^|\\/)(tests?|__tests__|testing|spec)(\\/|$)/.test(p) ||\n /\\.(test|spec)\\.[cm]?[jt]sx?$/.test(base) ||\n /^test_.*\\.py$/.test(base) ||\n /_test\\.py$/.test(base)\n )\n}\n","/**\n * The pure analyzer. Takes already-read bytes (`SupervisorRunSources`) and\n * returns the report — every metric derivable from a synthetic journal string\n * with no filesystem, no process, and no network. All I/O lives in a reader\n * (`reader.ts` is one).\n */\n\nimport { roundDecimal as round } from '../math/round-decimal'\nimport { summarizeNumberSeries } from '../statistics'\nimport { parsePatch } from './patch-stats'\nimport {\n asRecord,\n parseJson,\n parseJsonl,\n parseSupervisorTree,\n type SpawnRow,\n type WorkerLogFacts,\n workerSourceKey,\n} from './source-facts'\nimport { readTerminalRecord } from './terminal-record'\nimport {\n type DecisionMetrics,\n type EconomicsMetrics,\n isUnavailable,\n type Measured,\n type OrchestrationMetrics,\n type OutcomeMetrics,\n type PatchStats,\n type PerWorkerRow,\n type SpendMeasurements,\n type SteerBreakdown,\n SUPERVISOR_RUN_SCHEMA,\n type SupervisorRunReport,\n type SupervisorRunSources,\n type Unavailable,\n unavailable,\n} from './types'\n\nconst NO_CACHE_COUNTERS = 'the journal carries no cache-token counters for this role'\n\nconst NO_CACHE_BREAKDOWN =\n 'Runtime recorded cacheBreakdownKnown:false — the provider reported a total without splitting cache reads from writes'\n\n// ---------------------------------------------------------------------------\n// The analyzer.\n// ---------------------------------------------------------------------------\n\n/**\n * Analyze already-read supervisor-run bytes. Pure and synchronous: same bytes\n * in, same report out (modulo `generatedAt`, which `now` pins in tests).\n */\nexport function analyzeSupervisorRunSources(\n src: SupervisorRunSources,\n now: () => number = Date.now,\n): SupervisorRunReport {\n const gaps: string[] = []\n const gap = (what: string, reason: string): Unavailable => {\n gaps.push(`${what}: ${reason}`)\n return unavailable(reason)\n }\n\n const journalMissing =\n src.journalMissingReason ??\n (src.supRunDir === null ? 'no Runtime supervisor run directory' : 'journal.jsonl absent')\n const haveJournal = src.journal !== null\n const tree = parseSupervisorTree(src)\n const state = tree.state\n const result = parseJson(src.result)\n const judge = parseJson(src.judge)\n // Runtime's terminal record is named on the report so a status never arrives unlabeled.\n const terminal = readTerminalRecord({\n state,\n result,\n failure: src.failure === undefined ? undefined : parseJson(src.failure),\n })\n const { rootId, workerSpawns, workerCloses, startedAt, completedAt } = tree\n const rootSpawn =\n rootId === null ? null : (tree.spawns.find((spawn) => spawn.id === rootId) ?? null)\n const spawnById = new Map(workerSpawns.map((spawn) => [spawn.id, spawn]))\n const spawnsByLabel = new Map<string, SpawnRow[]>()\n for (const spawn of workerSpawns) {\n const matches = spawnsByLabel.get(spawn.label) ?? []\n matches.push(spawn)\n spawnsByLabel.set(spawn.label, matches)\n }\n const spawnsForSource = (\n worker: NonNullable<SupervisorRunSources['workers']>[number],\n ): readonly SpawnRow[] => {\n if (worker.workerId === undefined) return spawnsByLabel.get(worker.label) ?? []\n const spawn = spawnById.get(worker.workerId)\n return spawn === undefined ? [] : [spawn]\n }\n const spawnForSource = (\n worker: NonNullable<SupervisorRunSources['workers']>[number],\n ): SpawnRow | null => {\n const matches = spawnsForSource(worker)\n return matches.length === 1 ? (matches[0] ?? null) : null\n }\n\n // Wall provenance: explicit stamps when the store wrote both; otherwise the\n // journal event span (a lower bound) when there is no completion stamp at\n // all. A present-but-inverted stamp pair is corruption, not absence, and\n // stays unavailable.\n const wallSpanStart = startedAt ?? tree.firstEventAt\n const wallSpanEnd = tree.lastEventAt\n let supervisorWallMs: Measured<number>\n let supervisorWallSource: Measured<'stamps' | 'journal-span'>\n if (startedAt !== null && completedAt !== null && completedAt >= startedAt) {\n supervisorWallMs = completedAt - startedAt\n supervisorWallSource = 'stamps'\n } else if (\n completedAt === null &&\n wallSpanStart !== null &&\n wallSpanEnd !== null &&\n wallSpanEnd >= wallSpanStart\n ) {\n supervisorWallMs = wallSpanEnd - wallSpanStart\n supervisorWallSource = 'journal-span'\n } else {\n const reason = !haveJournal\n ? journalMissing\n : 'no parseable start/complete timestamps in state.json or journal'\n supervisorWallMs = gap('supervisorWallMs', reason)\n supervisorWallSource = unavailable(reason)\n }\n // Where the measured wall ends — the completion stamp, or the last stamped\n // journal event on the journal-span path. Idle and utilization integrate to\n // this bound so their denominator is the wall they are reported against.\n const wallEndAt = completedAt ?? (supervisorWallSource === 'journal-span' ? wallSpanEnd : null)\n\n // ── steers (worker inbox + control events) ─────────────────────────────\n const steerRows: SteerBreakdown[] = []\n let steerQueuedTotal = 0\n let steerDeliveredTotal = 0\n let upLegMessages = 0\n if (src.workers !== null) {\n for (const w of src.workers) {\n const facts = tree.workerLogs.get(workerSourceKey(w))\n const queued = facts?.steersQueued ?? null\n const delivered = facts?.steersDelivered ?? null\n upLegMessages += facts?.questions ?? 0\n if (queued !== null && delivered !== null) {\n steerRows.push({ workerId: w.workerId ?? null, worker: w.label, queued, delivered })\n }\n if (queued !== null) steerQueuedTotal += queued\n if (delivered !== null) steerDeliveredTotal += delivered\n }\n }\n const workersGapReason = src.workersMissingReason ?? 'workers/ directory absent'\n const unavailableReasons = (pick: (facts: WorkerLogFacts) => string | null): string | null => {\n const reasons = tree.workerLogRows\n .map((facts) => pick(facts))\n .filter((reason): reason is string => reason !== null)\n return reasons.length === 0\n ? null\n : `exact steer accounting unavailable for ${reasons.length} worker row(s): ${[...new Set(reasons)].join(' | ')}`\n }\n const queuedGapReason = unavailableReasons((facts) => facts.steersQueuedUnavailable)\n const deliveredGapReason = unavailableReasons((facts) => facts.steersDeliveredUnavailable)\n const workerEventsGapReason = unavailableReasons((facts) =>\n !facts.eventsCaptured\n ? 'events absent'\n : facts.eventsInvalidRows > 0\n ? 'events contain malformed rows'\n : null,\n )\n const steers: Measured<number> =\n src.workers === null\n ? gap('steers', workersGapReason)\n : queuedGapReason === null\n ? steerQueuedTotal\n : gap('steers', queuedGapReason)\n const steersDelivered: Measured<number> =\n src.workers === null\n ? unavailable(workersGapReason)\n : deliveredGapReason === null\n ? steerDeliveredTotal\n : unavailable(deliveredGapReason)\n const steersByWorker: Measured<readonly SteerBreakdown[]> =\n src.workers === null\n ? unavailable(workersGapReason)\n : queuedGapReason === null && deliveredGapReason === null\n ? steerRows\n : unavailable(queuedGapReason ?? deliveredGapReason ?? workersGapReason)\n\n // The `[driver] registered tools: …supervisor_steer…` banner names the verb without\n // invoking it, so banner lines are subtracted from the raw mention count.\n const driverSteerCalls: Measured<number> =\n src.driverLog === null\n ? gap('driverSteerCalls', 'driver.log absent')\n : Math.max(\n 0,\n (src.driverLog.match(/supervisor_steer/g) ?? []).length -\n registrationMentions(src.driverLog),\n )\n\n // ── waves / concurrency / idle ─────────────────────────────────────────\n const timeline: { at: number; delta: 1 | -1 }[] = []\n for (const s of workerSpawns) if (s.at !== null) timeline.push({ at: s.at, delta: 1 })\n for (const c of workerCloses) if (c.at !== null) timeline.push({ at: c.at, delta: -1 })\n timeline.sort((a, b) => a.at - b.at || a.delta - b.delta)\n\n let waves = 0\n const waveSizes: number[] = []\n let closedSinceWaveStart = true\n for (const step of timeline) {\n if (step.delta === 1) {\n if (closedSinceWaveStart) {\n waves += 1\n waveSizes.push(0)\n closedSinceWaveStart = false\n }\n waveSizes[waveSizes.length - 1] = (waveSizes[waveSizes.length - 1] ?? 0) + 1\n } else {\n closedSinceWaveStart = true\n }\n }\n\n let live = 0\n let maxConcurrency = 0\n let idleMs = 0\n let sumWorkerWallMs = 0\n let prev = startedAt\n for (const step of timeline) {\n if (prev !== null && step.at >= prev) {\n const span = step.at - prev\n if (live === 0) idleMs += span\n sumWorkerWallMs += span * live\n }\n live += step.delta\n if (live > maxConcurrency) maxConcurrency = live\n prev = step.at\n }\n if (prev !== null && wallEndAt !== null && wallEndAt >= prev) {\n const span = wallEndAt - prev\n if (live === 0) idleMs += span\n sumWorkerWallMs += span * live\n }\n\n const firstWorkerSpawnAt = workerSpawns.reduce<number | null>(\n (acc, s) => (s.at === null ? acc : acc === null ? s.at : Math.min(acc, s.at)),\n null,\n )\n const closeById = new Map(workerCloses.map((close) => [close.id, close]))\n const childSpawnsByParent = new Map<string, SpawnRow[]>()\n for (const spawn of workerSpawns) {\n if (spawn.parent === null) continue\n const siblings = childSpawnsByParent.get(spawn.parent) ?? []\n siblings.push(spawn)\n childSpawnsByParent.set(spawn.parent, siblings)\n }\n\n let respawns = 0\n let observeThenRespawn = 0\n let respawnWithoutEvidence = 0\n const repeatedLabelSet = new Set<string>()\n for (const siblings of childSpawnsByParent.values()) {\n const labelCounts = new Map<string, number>()\n for (const spawn of siblings) {\n labelCounts.set(spawn.label, (labelCounts.get(spawn.label) ?? 0) + 1)\n }\n for (const [label, count] of labelCounts) {\n if (count > 1) repeatedLabelSet.add(label)\n }\n\n const orderedSpawns = siblings\n .map((spawn, index) => ({ spawn, index }))\n .filter(\n (row): row is { spawn: SpawnRow & { at: number }; index: number } => row.spawn.at !== null,\n )\n .sort((a, b) => a.spawn.at - b.spawn.at || a.index - b.index)\n const directCloseTimes = siblings\n .map((spawn) => closeById.get(spawn.id)?.at ?? null)\n .filter((at): at is number => at !== null)\n .sort((a, b) => a - b)\n const firstDirectClose = directCloseTimes[0] ?? null\n\n for (let i = 1; i < orderedSpawns.length; i += 1) {\n const previous = orderedSpawns[i - 1]?.spawn.at\n const current = orderedSpawns[i]?.spawn.at\n if (previous === undefined || current === undefined) continue\n if (firstDirectClose === null || current <= firstDirectClose) continue\n respawns += 1\n const sawEvidence = hasNumberBetween(directCloseTimes, previous, current)\n if (sawEvidence) observeThenRespawn += 1\n else respawnWithoutEvidence += 1\n }\n }\n const repeatedLabels = [...repeatedLabelSet]\n\n const parentOf = new Map(tree.spawns.map((s) => [s.id, s.parent]))\n let delegationDepth = 0\n for (const s of workerSpawns) {\n let d = 0\n let cur: string | null = s.id\n const seen = new Set<string>()\n while (cur !== null && cur !== rootId && !seen.has(cur)) {\n seen.add(cur)\n d += 1\n cur = parentOf.get(cur) ?? null\n }\n if (d > delegationDepth) delegationDepth = d\n }\n\n const orchestration: OrchestrationMetrics = {\n workersSpawned: haveJournal ? workerSpawns.length : gap('workersSpawned', journalMissing),\n workersSettled: haveJournal\n ? workerCloses.filter((c) => c.kind === 'settled').length\n : unavailable(journalMissing),\n workersCancelled: haveJournal\n ? workerCloses.filter((c) => c.kind === 'cancelled').length\n : unavailable(journalMissing),\n steers,\n steersDelivered,\n steersByWorker,\n driverSteerCalls,\n waves: haveJournal ? waves : unavailable(journalMissing),\n waveSizes: haveJournal ? waveSizes : unavailable(journalMissing),\n maxConcurrency: haveJournal ? maxConcurrency : unavailable(journalMissing),\n respawns: haveJournal ? respawns : unavailable(journalMissing),\n repeatedLabels: haveJournal ? repeatedLabels : unavailable(journalMissing),\n delegationDepth: haveJournal ? delegationDepth : unavailable(journalMissing),\n timeToFirstSpawnMs:\n startedAt !== null && firstWorkerSpawnAt !== null\n ? firstWorkerSpawnAt - startedAt\n : haveJournal\n ? unavailable('no worker spawn timestamps')\n : unavailable(journalMissing),\n supervisorWallMs,\n supervisorWallSource,\n idleMs: isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : idleMs,\n idlePct:\n isUnavailable(supervisorWallMs) || supervisorWallMs === 0\n ? isUnavailable(supervisorWallMs)\n ? unavailable(supervisorWallMs.unavailable)\n : unavailable('supervisor wall is 0ms')\n : round((idleMs / supervisorWallMs) * 100, 1),\n workerUtilization:\n isUnavailable(supervisorWallMs) || supervisorWallMs === 0\n ? isUnavailable(supervisorWallMs)\n ? unavailable(supervisorWallMs.unavailable)\n : unavailable('supervisor wall is 0ms')\n : round(sumWorkerWallMs / supervisorWallMs, 3),\n }\n\n // ── decision quality ───────────────────────────────────────────────────\n const settledByStatus: Record<string, number> = {}\n const settledVerdicts: Record<string, number> = {}\n for (const c of workerCloses) {\n const key = c.status ?? 'unknown'\n settledByStatus[key] = (settledByStatus[key] ?? 0) + 1\n if (c.verdict !== null) settledVerdicts[c.verdict] = (settledVerdicts[c.verdict] ?? 0) + 1\n }\n\n // A store with no verify step never says pass or fail. Counting its silent\n // workers as `rejected: 0 / accepted: 0` would read as \"nothing was accepted\".\n const verdictLimit = src.limits.workerVerdicts\n // A store that retains no delivered patch still SETTLES a verdict, and that verdict is\n // the acceptance decision it recorded. Only the split between a green verdict backed by\n // a patch and a green verdict with nothing behind it needs patch bytes, so the\n // deliverables limit takes `emptyPass` and leaves `accepted` measured.\n const deliverablesLimit = src.limits.deliverables\n let accepted = 0\n let emptyPass = 0\n let evidenceBytes = 0\n const sourceVerdicts: boolean[] = []\n for (const w of src.workers ?? []) {\n const f = tree.workerLogs.get(workerSourceKey(w))\n if (f?.finished) evidenceBytes += f.evidenceBytes\n const spawn = spawnForSource(w)\n const close = spawn === null ? null : (closeById.get(spawn.id) ?? null)\n const passed = close?.valid ?? f?.passed ?? null\n if (passed !== null) sourceVerdicts.push(passed)\n if (passed === true) {\n if (deliverablesLimit !== null || (w.patchBytes ?? f?.finishedPatchBytes ?? 0) > 0) {\n accepted += 1\n } else {\n emptyPass += 1\n }\n }\n }\n const settledCloses = workerCloses.filter((close) => close.kind === 'settled')\n const structuredVerdicts = settledCloses\n .map((close) => close.valid)\n .filter((valid): valid is boolean => valid !== null)\n const journalVerdictsComplete =\n settledCloses.length > 0 && structuredVerdicts.length === settledCloses.length\n const sourceVerdictsComplete =\n sourceVerdicts.length > 0 && sourceVerdicts.length >= settledCloses.length\n const rejected = journalVerdictsComplete\n ? structuredVerdicts.filter((valid) => !valid).length\n : sourceVerdictsComplete\n ? sourceVerdicts.filter((valid) => !valid).length\n : 0\n const rejectedLimit =\n journalVerdictsComplete || sourceVerdictsComplete\n ? null\n : settledCloses.length > 0\n ? (verdictLimit ?? 'a settled journal verdict has no validity and no matched worker log')\n : verdictLimit !== null\n ? verdictLimit\n : !haveJournal && src.workers === null\n ? workersGapReason\n : null\n\n const decision: DecisionMetrics = {\n settledByStatus: haveJournal ? settledByStatus : gap('settledByStatus', journalMissing),\n settledVerdicts:\n verdictLimit !== null\n ? unavailable(verdictLimit)\n : haveJournal\n ? settledVerdicts\n : unavailable(journalMissing),\n accepted:\n verdictLimit !== null\n ? gap('accepted', verdictLimit)\n : src.workers === null\n ? unavailable(workersGapReason)\n : accepted,\n rejected: rejectedLimit === null ? rejected : unavailable(rejectedLimit),\n emptyPass:\n verdictLimit !== null\n ? gap('emptyPass', verdictLimit)\n : deliverablesLimit !== null\n ? gap('emptyPass', deliverablesLimit)\n : src.workers === null\n ? unavailable(workersGapReason)\n : emptyPass,\n observeThenRespawn: haveJournal ? observeThenRespawn : unavailable(journalMissing),\n respawnWithoutEvidence: haveJournal ? respawnWithoutEvidence : unavailable(journalMissing),\n reviewActions:\n src.workers === null\n ? unavailable(workersGapReason)\n : queuedGapReason === null\n ? steerQueuedTotal + upLegMessages\n : unavailable(queuedGapReason),\n workerEvidenceBytes:\n src.workers === null\n ? unavailable(workersGapReason)\n : workerEventsGapReason === null\n ? evidenceBytes\n : unavailable(workerEventsGapReason),\n }\n\n // ── economics ──────────────────────────────────────────────────────────\n const rootChildIds = new Set(\n workerSpawns.filter((spawn) => spawn.parent === rootId).map((spawn) => spawn.id),\n )\n const rootChildCloses = workerCloses.filter((close) => rootChildIds.has(close.id))\n // Runtime marks a spend record `usdKnown: false` / `tokensKnown: false` when the work\n // HAPPENED but no provider receipt covered its price or its tokens. Folding such a record\n // in prices unreported work at zero; dropping the whole channel discards every record that\n // DID report. So each channel sums only the reporting records and names the rest.\n const rootChildSpends = rootChildCloses.filter((close) => close.hasSpend)\n const workerUsdUnknownNodes = rootChildSpends\n .filter((close) => !close.spend.usdKnown)\n .map((close) => close.id)\n const workerTokensUnknownNodes = rootChildSpends\n .filter((close) => !close.spend.tokensKnown)\n .map((close) => close.id)\n const workerTokenSpends = rootChildSpends.filter((close) => close.spend.tokensKnown)\n const journalWorkerIn = workerTokenSpends.reduce((a, c) => a + c.spend.tokens.input, 0)\n const journalWorkerOut = workerTokenSpends.reduce((a, c) => a + c.spend.tokens.output, 0)\n const journalWorkerUsd = rootChildSpends\n .filter((close) => close.spend.usdKnown)\n .reduce((a, c) => a + c.spend.usd, 0)\n const usdUnknownIds = new Set(\n workerCloses.filter((close) => close.hasSpend && !close.spend.usdKnown).map((c) => c.id),\n )\n const workerUsdById = new Map<string, number>()\n for (const c of workerCloses) {\n if (usdUnknownIds.has(c.id)) continue\n workerUsdById.set(c.id, (workerUsdById.get(c.id) ?? 0) + c.spend.usd)\n }\n const labelById = new Map(workerSpawns.map((spawn) => [spawn.id, spawn.label]))\n const usdUnknownLabels = new Set(\n [...usdUnknownIds].map((id) => labelById.get(id)).filter((l): l is string => l !== undefined),\n )\n const workerUsdByLabel = new Map<string, number>()\n for (const close of workerCloses) {\n const label = labelById.get(close.id)\n if (label === undefined || usdUnknownLabels.has(label)) continue\n workerUsdByLabel.set(label, (workerUsdByLabel.get(label) ?? 0) + close.spend.usd)\n }\n const brainUsdUnknownNodes =\n tree.brain.usdUnknownCount > 0 && rootId !== null ? ([rootId] as const) : []\n const brainTokensUnknownNodes =\n tree.brain.tokensUnknownCount > 0 && rootId !== null ? ([rootId] as const) : []\n const usdKnownRecords =\n tree.brain.usdKnownCount + rootChildSpends.filter((close) => close.spend.usdKnown).length\n const usdUnknownRecords = tree.brain.usdUnknownCount + workerUsdUnknownNodes.length\n const usdUnknownNodes = [...brainUsdUnknownNodes, ...workerUsdUnknownNodes]\n // The named nodes are what makes the gap actionable, but a fleet run can have hundreds,\n // and this string lands in a report line. Name the first few and count the rest.\n const NAMED_NODE_LIMIT = 5\n const nameNodes = (nodes: readonly string[]): string => {\n if (nodes.length === 0) return ''\n const shown = nodes.slice(0, NAMED_NODE_LIMIT)\n const rest = nodes.length - shown.length\n return ` (${shown.join(', ')}${rest === 0 ? '' : ` +${rest} more`})`\n }\n const unpriced = (unknown: number, total: number, nodes: readonly string[]): string =>\n `Runtime recorded usdKnown:false on ${unknown} of ${total} spend record(s)${nameNodes(nodes)}`\n // A token total is a bare `Measured<number>` with no record denominator beside it, so a\n // partial sum there would be an unlabelled floor — the exact collapse this module refuses.\n // Spend has `SpendMeasurement.records`/`unknownRecords` to carry the split, so it stays\n // partial; tokens go absent with the unreporting nodes named.\n const unreportedTokens = (unknown: number, total: number, nodes: readonly string[]): string =>\n `Runtime recorded tokensKnown:false on ${unknown} of ${total} spend record(s)${nameNodes(nodes)}`\n const usdPartial = usdKnownRecords > 0 && usdUnknownRecords > 0\n const usdAllUnknown = usdKnownRecords === 0 && usdUnknownRecords > 0\n // A role whose records are ALL unreported has nothing measured to report, so it stays\n // unavailable. A role with some of each keeps its sum and labels it in `source`.\n const brainTokensUnreported =\n tree.brain.tokensUnknownCount === 0\n ? null\n : unreportedTokens(\n tree.brain.tokensUnknownCount,\n tree.brain.meteredCount,\n brainTokensUnknownNodes,\n )\n const brainUsdUnreported =\n tree.brain.usdKnownCount > 0 || tree.brain.usdUnknownCount === 0\n ? null\n : unpriced(tree.brain.usdUnknownCount, tree.brain.meteredCount, brainUsdUnknownNodes)\n const workerUsdUnreported =\n workerUsdUnknownNodes.length === 0 || workerUsdUnknownNodes.length < rootChildSpends.length\n ? null\n : unpriced(workerUsdUnknownNodes.length, rootChildSpends.length, workerUsdUnknownNodes)\n const sq = src.harnessWorkerTokens\n const harnessGapReason =\n src.harnessMissingReason ?? 'harness session store unavailable and journal settled spend is 0'\n const workerTokenLimit = src.limits.workerTokens\n const workerTokensUnreported =\n workerTokensUnknownNodes.length === 0\n ? null\n : unreportedTokens(\n workerTokensUnknownNodes.length,\n rootChildSpends.length,\n workerTokensUnknownNodes,\n )\n const workerIn: Measured<number> =\n workerTokenLimit !== null\n ? gap('workers.tokensIn', workerTokenLimit)\n : workerTokensUnreported !== null\n ? gap('workers.tokensIn', workerTokensUnreported)\n : sq !== null\n ? journalWorkerIn + sq.input\n : haveJournal\n ? journalWorkerIn\n : gap('workers.tokensIn', harnessGapReason)\n const workerOut: Measured<number> =\n workerTokenLimit !== null\n ? unavailable(workerTokenLimit)\n : workerTokensUnreported !== null\n ? unavailable(workerTokensUnreported)\n : sq !== null\n ? journalWorkerOut + sq.output\n : haveJournal\n ? journalWorkerOut\n : unavailable(harnessGapReason)\n\n const stateResult = asRecord(state?.result)\n const stateUsd = typeof stateResult.spentUsd === 'number' ? stateResult.spentUsd : null\n const resultSpentTotal = asRecord(result?.spentTotal)\n const resultCloseUsd =\n typeof resultSpentTotal.usd === 'number' && Number.isFinite(resultSpentTotal.usd)\n ? resultSpentTotal.usd\n : null\n // The close record: what the store wrote as settled when the run closed.\n const closeUsd = stateUsd ?? resultCloseUsd\n // A store that logs tokens but never a price yields usd 0 from every sum. That\n // 0 is the store's silence, not a free run, so the limit outranks the sum.\n const usdLimit = src.limits.spendUsd\n // The close record carries its own completeness flag: `spentTotal.usdKnown: false` means\n // Runtime priced part of the run from a catalog, so the number is a floor, not a total.\n const closeUsdUnreported =\n stateUsd === null && resultCloseUsd !== null && resultSpentTotal.usdKnown === false\n const usdUnreportedReason = unpriced(\n usdUnknownRecords,\n usdKnownRecords + usdUnknownRecords,\n usdUnknownNodes,\n )\n // Which numbers may be partial, and which must go absent: a number may be a floor only\n // when its own record carries the known/unknown split beside it — `SpendMeasurement`\n // has `records`/`unknownRecords`, and `RoleSpend` has `source`. `totalUsd` is a bare\n // scalar, so a floor there is an unlabelled understatement and stays unavailable; the\n // partial sum with its denominators lives in `spend.journalDerived`, which this type's\n // own doc already names as the field to prefer.\n const totalUsd: Measured<number> =\n usdLimit !== null\n ? gap('totalUsd', usdLimit)\n : stateUsd !== null\n ? round(stateUsd, 6)\n : !haveJournal\n ? gap('totalUsd', journalMissing)\n : usdUnknownRecords > 0\n ? gap('totalUsd', usdUnreportedReason)\n : round(tree.brain.usd + journalWorkerUsd, 6)\n\n const journalSpendRecords = usdKnownRecords\n // `journalDerived` keeps its partial sum: `records` and `unknownRecords` state exactly\n // how much of the run it covers. Only an all-unreported channel has nothing to report.\n const journalDerivedAvailable = usdLimit === null && haveJournal && !usdAllUnknown\n const closeRecordAvailable = usdLimit === null && closeUsd !== null && !closeUsdUnreported\n const spend: SpendMeasurements = {\n journalDerived: {\n usd: journalDerivedAvailable\n ? round(tree.brain.usd + journalWorkerUsd, 6)\n : unavailable(usdLimit ?? (haveJournal ? usdUnreportedReason : journalMissing)),\n records: journalDerivedAvailable ? journalSpendRecords : 0,\n unknownRecords: usdLimit === null && haveJournal ? usdUnknownRecords : 0,\n partial: journalDerivedAvailable && usdPartial,\n unknownNodes: usdLimit === null && haveJournal ? usdUnknownNodes : [],\n },\n closeRecord: {\n usd: closeRecordAvailable\n ? round(closeUsd as number, 6)\n : unavailable(\n usdLimit ??\n (closeUsdUnreported\n ? 'close record incomplete: result.json spentTotal.usdKnown is false'\n : 'no close record: neither state.json result.spentUsd nor result.json spentTotal.usd is present'),\n ),\n records: closeRecordAvailable ? 1 : 0,\n unknownRecords: closeUsdUnreported ? 1 : 0,\n partial: false,\n unknownNodes: closeUsdUnreported && rootId !== null ? [rootId] : [],\n },\n }\n\n const noteCaptureGaps = (\n owner: string,\n captures: SupervisorRunSources['rootWorkspaceCaptures'],\n ): void => {\n if (captures === null || captures?.length === 0) {\n gaps.push(`${owner} workspaceCapture: no retained output capture evidence`)\n } else if (captures !== undefined) {\n for (const [index, capture] of captures.entries()) {\n const source = `${owner} workspaceCapture[${index + 1}]`\n if (capture.projectionGap !== null) gaps.push(`${source}: ${capture.projectionGap}`)\n if (capture.coverageComplete === false) {\n gaps.push(\n `${source}: ${capture.incompleteReason ?? 'provider reported incomplete coverage'}`,\n )\n }\n if (capture.coverageComplete === null && capture.projectionGap === null) {\n gaps.push(`${source}: capture coverage was not recorded`)\n }\n }\n }\n }\n noteCaptureGaps(`root ${rootId ?? src.runRef}`, src.rootWorkspaceCaptures)\n const perWorker: PerWorkerRow[] = (src.workers ?? []).map((w) => {\n noteCaptureGaps(`worker ${w.workerId ?? w.label}`, w.workspaceCaptures)\n const f = tree.workerLogs.get(workerSourceKey(w))\n const matchingSpawns = spawnsForSource(w)\n const spawn = spawnForSource(w)\n const close = spawn === null ? null : (closeById.get(spawn.id) ?? null)\n const passed = close?.valid ?? f?.passed ?? null\n const matchingRoles = new Set(matchingSpawns.map((candidate) => candidate.role))\n const matchingRuntimes = new Set(matchingSpawns.map((candidate) => candidate.runtime))\n const matchingProfiles = new Set(matchingSpawns.map((candidate) => candidate.profileDigest))\n const journalWallMs =\n spawn?.at !== null &&\n spawn?.at !== undefined &&\n close?.at !== null &&\n close?.at !== undefined &&\n close.at >= spawn.at\n ? close.at - spawn.at\n : null\n return {\n workerId: w.workerId ?? null,\n worker: w.label,\n role: matchingRoles.size === 1 ? (matchingSpawns[0]?.role ?? null) : null,\n runtime: matchingRuntimes.size === 1 ? (matchingSpawns[0]?.runtime ?? null) : null,\n profileDigest:\n matchingProfiles.size === 1 ? (matchingSpawns[0]?.profileDigest ?? null) : null,\n status: close?.status ?? null,\n failure: close?.reason ?? null,\n infra: close?.infra ?? null,\n wallMs: f?.started != null && f.finishedAt != null ? f.finishedAt - f.started : journalWallMs,\n tokensIn:\n w.tokensIn ??\n (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.input : null),\n tokensOut:\n w.tokensOut ??\n (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.output : null),\n usd:\n usdLimit !== null\n ? null\n : w.workerId === undefined\n ? (workerUsdByLabel.get(w.label) ?? null)\n : (workerUsdById.get(w.workerId) ?? null),\n patchBytes: w.patchBytes ?? f?.finishedPatchBytes ?? null,\n passed,\n score: close?.score ?? f?.score ?? null,\n workspaceCaptures: w.workspaceCaptures ?? null,\n }\n })\n const wallDistribution = summarizeNumberSeries(\n perWorker.map((w) => w.wallMs).filter((w): w is number => w !== null),\n )\n\n const brainCalls = parseJsonl(src.brainLog)\n const managerTokenLimit = src.limits.managerTokens\n const economics: EconomicsMetrics = {\n resourceRecords:\n src.journal === null && !tree.resourceRecords?.length\n ? unavailable(journalMissing)\n : (tree.resourceRecords ?? []),\n brain: {\n tokensIn:\n managerTokenLimit !== null\n ? gap('brain.tokensIn', managerTokenLimit)\n : !haveJournal\n ? gap('brain.tokensIn', journalMissing)\n : brainTokensUnreported !== null\n ? gap('brain.tokensIn', brainTokensUnreported)\n : tree.brain.tokensIn,\n tokensOut:\n managerTokenLimit !== null\n ? unavailable(managerTokenLimit)\n : !haveJournal\n ? unavailable(journalMissing)\n : brainTokensUnreported !== null\n ? unavailable(brainTokensUnreported)\n : tree.brain.tokensOut,\n usd:\n usdLimit !== null\n ? unavailable(usdLimit)\n : !haveJournal\n ? unavailable(journalMissing)\n : brainUsdUnreported !== null\n ? unavailable(brainUsdUnreported)\n : round(tree.brain.usd, 6),\n cacheRead:\n managerTokenLimit !== null\n ? unavailable(managerTokenLimit)\n : !haveJournal\n ? unavailable(journalMissing)\n : brainTokensUnreported !== null\n ? unavailable(brainTokensUnreported)\n : !tree.brain.hasCache\n ? unavailable(NO_CACHE_COUNTERS)\n : tree.brain.cacheBreakdownKnown\n ? tree.brain.cacheRead\n : unavailable(NO_CACHE_BREAKDOWN),\n cacheWrite:\n managerTokenLimit !== null\n ? unavailable(managerTokenLimit)\n : !haveJournal\n ? unavailable(journalMissing)\n : brainTokensUnreported !== null\n ? unavailable(brainTokensUnreported)\n : !tree.brain.hasCache\n ? unavailable(NO_CACHE_COUNTERS)\n : tree.brain.cacheBreakdownKnown\n ? tree.brain.cacheWrite\n : unavailable(NO_CACHE_BREAKDOWN),\n source:\n managerTokenLimit ??\n (haveJournal\n ? `journal metered events (n=${tree.brain.meteredCount})${\n tree.brain.usdKnownCount > 0 && tree.brain.usdUnknownCount > 0\n ? ` — ${tree.brain.usdUnknownCount} unpriced`\n : ''\n }`\n : journalMissing),\n },\n brainTruncations:\n src.brainLog === null\n ? gap(\n 'brain.brainTruncations',\n src.brainLogMissingReason ??\n (src.supRunDir === null\n ? 'no Runtime supervisor run directory'\n : 'brain.jsonl absent — this source has no brain-call tap, so truncation cannot be ruled out'),\n )\n : brainCalls.filter((c) => c.finish_reason === 'length').length,\n workers: {\n tokensIn: workerIn,\n tokensOut: workerOut,\n cacheRead:\n workerTokenLimit !== null\n ? unavailable(workerTokenLimit)\n : sq?.cacheRead !== undefined\n ? sq.cacheRead\n : unavailable(NO_CACHE_COUNTERS),\n cacheWrite:\n workerTokenLimit !== null\n ? unavailable(workerTokenLimit)\n : sq?.cacheWrite !== undefined\n ? sq.cacheWrite\n : unavailable(NO_CACHE_COUNTERS),\n usd:\n usdLimit !== null\n ? unavailable(usdLimit)\n : !haveJournal\n ? unavailable(journalMissing)\n : workerUsdUnreported !== null\n ? unavailable(workerUsdUnreported)\n : round(journalWorkerUsd, 6),\n source: `${\n workerTokenLimit !== null\n ? workerTokenLimit\n : sq !== null\n ? `journal settled spend + ${sq.store} sessions (n=${sq.sessions})`\n : `journal settled spend only — ${src.harnessMissingReason ?? 'harness session store unavailable'}`\n }${\n workerUsdUnknownNodes.length > 0 && workerUsdUnknownNodes.length < rootChildSpends.length\n ? ` — ${workerUsdUnknownNodes.length} unpriced`\n : ''\n }`,\n },\n spend,\n totalUsd,\n totalUsdSource:\n usdLimit !== null\n ? usdLimit\n : stateUsd !== null\n ? `state.json result.spentUsd${rootChildCloses.length > 0 && journalWorkerUsd === 0 ? ' — brain-priced only; worker CLI inference is unpriced (see worker token counts)' : ''}`\n : !haveJournal\n ? journalMissing\n : usdUnknownRecords > 0\n ? usdUnreportedReason\n : 'journal metered + settled usd',\n costPerAcceptedPatchUsd: isUnavailable(totalUsd)\n ? unavailable(totalUsd.unavailable)\n : isUnavailable(decision.accepted)\n ? unavailable(decision.accepted.unavailable)\n : decision.accepted === 0\n ? unavailable('no accepted worker patch (cost has no denominator)')\n : round(totalUsd / decision.accepted, 6),\n workerWallMsDistribution:\n wallDistribution === null\n ? unavailable(\n src.workers === null ? workersGapReason : 'no worker start/finish pairs captured',\n )\n : wallDistribution,\n perWorker: src.workers === null ? unavailable(workersGapReason) : perWorker,\n }\n\n // ── outcome ────────────────────────────────────────────────────────────\n const patchStats: Measured<PatchStats> =\n src.patch === null\n ? gap('patch', src.limits.deliverables ?? 'delivered patch file absent')\n : parsePatch(src.patch)\n\n const outcome: OutcomeMetrics = {\n supStatus: isUnavailable(terminal.supStatus)\n ? gap('supStatus', terminal.supStatus.unavailable)\n : terminal.supStatus,\n supStatusSource: terminal.supStatusSource,\n supReason: terminal.supReason,\n failure: terminal.failure,\n supVerdict:\n pickString(state, 'verdict') ??\n pickString(result, 'sup_verdict') ??\n unavailable('no state.json / result.json verdict'),\n delivered:\n typeof stateResult.delivered === 'boolean'\n ? stateResult.delivered\n : typeof result?.delivered === 'boolean'\n ? result.delivered\n : unavailable('no delivered flag in state.json or result.json'),\n judgeResolved:\n judge === null\n ? gap('judge', 'judge.json absent')\n : typeof judge.resolved === 'boolean'\n ? judge.resolved\n : null,\n judgeScore:\n judge === null\n ? unavailable('judge.json absent')\n : typeof judge.score === 'number'\n ? judge.score\n : null,\n judgePassed:\n judge === null\n ? unavailable('judge.json absent')\n : typeof judge.passed === 'number'\n ? judge.passed\n : null,\n judgeTotal:\n judge === null\n ? unavailable('judge.json absent')\n : typeof judge.total === 'number'\n ? judge.total\n : null,\n verifyPass:\n typeof result?.verify_pass === 'boolean'\n ? result.verify_pass\n : gap('verifyPass', 'result.json absent or has no verify_pass'),\n verifyRc:\n typeof result?.verify_rc === 'number'\n ? result.verify_rc\n : unavailable('result.json absent or has no verify_rc'),\n patch: patchStats,\n judgeSource: src.judgeSource,\n }\n\n return {\n schema: SUPERVISOR_RUN_SCHEMA,\n runRef: src.runRef,\n instanceId: src.instanceId,\n arm: src.arm,\n supervisorId: rootId !== null ? rootId : unavailable(journalMissing),\n supervisorProfileDigest:\n rootSpawn?.profileDigest !== null && rootSpawn?.profileDigest !== undefined\n ? rootSpawn.profileDigest\n : gap('supervisorProfileDigest', 'root spawned event has no profile digest'),\n generatedAt: new Date(now()).toISOString(),\n orchestration,\n decision,\n economics,\n outcome,\n rootWorkspaceCaptures: src.rootWorkspaceCaptures ?? null,\n gaps,\n traceCommand:\n src.traceCommand ??\n 'npx --yes @tangle-network/traces@latest analyze --harness opencode --cwd <worker-clone-cwd>',\n }\n}\n\n/** Whether sorted values contain one value in the inclusive interval. */\nfunction hasNumberBetween(sorted: readonly number[], low: number, high: number): boolean {\n let left = 0\n let right = sorted.length\n while (left < right) {\n const middle = left + Math.floor((right - left) / 2)\n if ((sorted[middle] as number) < low) left = middle + 1\n else right = middle\n }\n return left < sorted.length && (sorted[left] as number) <= high\n}\n\n/** `[driver] registered tools: …supervisor_steer…` is a banner, not an invocation. */\nfunction registrationMentions(driverLog: string): number {\n let n = 0\n for (const line of driverLog.split('\\n')) {\n if (line.includes('registered tools:') && line.includes('supervisor_steer')) n += 1\n }\n return n\n}\n\nfunction pickString(rec: Record<string, unknown> | null, key: string): string | null {\n const v = rec?.[key]\n return typeof v === 'string' ? v : null\n}\n","/**\n * Human-readable renderings of a supervisor-run report. Zero and unavailable\n * render differently on purpose (`0` vs `unavailable — <reason>`), because the\n * two have driven opposite conclusions about the same architecture.\n */\n\nimport { roundDecimal as round } from '../math/round-decimal'\nimport {\n isUnavailable,\n type Measured,\n type ResourceSpendRecord,\n type SupervisorRunReport,\n type SupervisorRunRollup,\n showMeasured,\n type TerminalFailure,\n} from './types'\n\n/**\n * The block appended to a run log after every run — the answers an operator asks\n * for, in the log tail, with no extra command.\n */\nexport function renderSupervisorRunHeadline(r: SupervisorRunReport): string {\n const o = r.orchestration\n const steerNote = isUnavailable(o.steers)\n ? `unavailable — ${o.steers.unavailable}`\n : o.steers === 0\n ? '0 (spawn→wait→respawn only; no mid-task steering)'\n : `${o.steers} queued / ${showMeasured(o.steersDelivered)} delivered`\n return [\n `RUN-REPORT ${r.instanceId ?? '?'} [${r.arm ?? '?'}]`,\n ` status=${showMeasured(r.outcome.supStatus)} source=${showMeasured(r.outcome.supStatusSource)}` +\n ` reason=${showMeasured(r.outcome.supReason)} failure=${fmtFailure(r.outcome.failure)}`,\n ` steers=${steerNote}`,\n ` waves=${showMeasured(o.waves)} sizes=${isUnavailable(o.waveSizes) ? `unavailable — ${o.waveSizes.unavailable}` : `[${o.waveSizes.join(',')}]`}` +\n ` workers=${showMeasured(o.workersSpawned)} settled=${showMeasured(o.workersSettled)} cancelled=${showMeasured(o.workersCancelled)}`,\n ` concurrency max=${showMeasured(o.maxConcurrency)} utilization=${showMeasured(o.workerUtilization)}` +\n ` idle=${fmtMs(o.idleMs)} (${showMeasured(o.idlePct)}%) wall=${fmtMs(o.supervisorWallMs)}` +\n `${o.supervisorWallSource === 'journal-span' ? ' (journal-span lower bound)' : ''}`,\n ` respawns=${showMeasured(o.respawns)} evidence→respawn=${showMeasured(r.decision.observeThenRespawn)}` +\n ` blind-respawn=${showMeasured(r.decision.respawnWithoutEvidence)} depth=${showMeasured(o.delegationDepth)}`,\n ` accepted=${showMeasured(r.decision.accepted)} rejected=${showMeasured(r.decision.rejected)} empty-pass=${showMeasured(r.decision.emptyPass)}`,\n ` brain=$${showMeasured(r.economics.brain.usd)} total=$${showMeasured(r.economics.totalUsd)}` +\n ` judge.resolved=${showMeasured(r.outcome.judgeResolved)} score=${showMeasured(r.outcome.judgeScore)}` +\n ` verify=${showMeasured(r.outcome.verifyPass)}`,\n r.gaps.length > 0 ? ` gaps(${r.gaps.length}): ${r.gaps.join('; ')}` : ' gaps: none',\n ].join('\\n')\n}\n\n/**\n * The recorded error on one line; `none recorded` and `unavailable` stay\n * distinct, and a throw the run outlived is labeled so it is not read as the\n * outcome of the settled result beside it.\n */\nfunction fmtFailure(v: Measured<TerminalFailure | null>): string {\n if (isUnavailable(v)) return `unavailable — ${v.unavailable}`\n if (v === null) return 'none recorded'\n const name = v.name ?? 'unavailable — record has no error.name'\n const message = v.message ?? 'unavailable — record has no error.message'\n const attempt = v.earlierAttempt ? ', earlier attempt' : ''\n return `${name}: ${message} [${v.source}${v.at === null ? '' : ` at ${v.at}`}${attempt}]`\n}\n\nfunction resourceRows(records: Measured<readonly ResourceSpendRecord[]>): string[] {\n if (isUnavailable(records)) return [`unavailable — ${records.unavailable}`, '']\n const out = [\n 'Receipts are source records, not additive totals.',\n 'A false completeness flag means the amount is a recorded subtotal, not complete usage.',\n '',\n '| Node | Source | Resource | Unit | Amount | Known |',\n '|---|---|---|---|---:|---|',\n ]\n const cell = (value: string) => value.replace(/\\|/g, '\\\\|').replace(/\\r?\\n/g, ' ')\n for (const record of records) {\n const prefix = `| ${cell(record.nodeId ?? 'unavailable')} | ${cell(record.source)} |`\n if (isUnavailable(record.resources)) {\n out.push(`${prefix} ${cell(showMeasured(record.resources))} | — | — | — |`)\n } else if (record.resources.length === 0) {\n out.push(`${prefix} recorded empty map | — | — | — |`)\n } else {\n for (const receipt of record.resources) {\n out.push(\n `${prefix} ${cell(showMeasured(receipt.name))} | ${cell(showMeasured(receipt.unit))} | ${cell(showMeasured(receipt.amount))} | ${cell(showMeasured(receipt.known))} |`,\n )\n }\n }\n }\n if (!records.length) out.push('| — | — | no spend records | — | — | — |')\n out.push('')\n return out\n}\n\nfunction fmtMs(v: Measured<number>): string {\n if (isUnavailable(v)) return `unavailable — ${v.unavailable}`\n if (v < 1000) return `${v}ms`\n const s = v / 1000\n if (s < 120) return `${round(s, 1)}s`\n return `${round(s / 60, 1)}min`\n}\n\nexport function renderSupervisorRunMarkdown(r: SupervisorRunReport): string {\n const o = r.orchestration\n const d = r.decision\n const e = r.economics\n const out: string[] = []\n out.push(`# Run report — ${r.instanceId ?? 'unknown instance'} [${r.arm ?? 'unknown arm'}]`)\n out.push('')\n out.push('```')\n out.push(renderSupervisorRunHeadline(r))\n out.push('```')\n out.push('')\n out.push(`- Run: \\`${r.runRef}\\``)\n out.push(`- Supervisor: \\`${showMeasured(r.supervisorId)}\\``)\n out.push(`- Supervisor profile: \\`${showMeasured(r.supervisorProfileDigest)}\\``)\n out.push(`- Generated: ${r.generatedAt}`)\n out.push('')\n\n out.push('## Orchestration')\n out.push('')\n out.push('| Metric | Value |')\n out.push('|---|---|')\n out.push(`| Workers spawned | ${showMeasured(o.workersSpawned)} |`)\n out.push(`| Workers settled | ${showMeasured(o.workersSettled)} |`)\n out.push(`| Workers cancelled | ${showMeasured(o.workersCancelled)} |`)\n out.push(`| **Steers (mid-task messages to live workers)** | **${showMeasured(o.steers)}** |`)\n out.push(`| Steers delivered | ${showMeasured(o.steersDelivered)} |`)\n out.push(`| Outer-driver \\`supervisor_steer\\` calls | ${showMeasured(o.driverSteerCalls)} |`)\n out.push(`| Spawn waves | ${showMeasured(o.waves)} |`)\n out.push(\n `| Wave sizes | ${isUnavailable(o.waveSizes) ? showMeasured(o.waveSizes) : `[${o.waveSizes.join(', ')}]`} |`,\n )\n out.push(`| Max concurrency | ${showMeasured(o.maxConcurrency)} |`)\n out.push(`| Respawns (after same parent's first settle) | ${showMeasured(o.respawns)} |`)\n out.push(\n `| Repeated labels | ${isUnavailable(o.repeatedLabels) ? showMeasured(o.repeatedLabels) : o.repeatedLabels.length === 0 ? 'none' : o.repeatedLabels.join(', ')} |`,\n )\n out.push(`| Delegation depth | ${showMeasured(o.delegationDepth)} |`)\n out.push(`| Time to first spawn | ${fmtMs(o.timeToFirstSpawnMs)} |`)\n out.push(\n `| Supervisor wall | ${fmtMs(o.supervisorWallMs)}${isUnavailable(o.supervisorWallSource) ? '' : ` (source: ${o.supervisorWallSource}${o.supervisorWallSource === 'journal-span' ? ', lower bound' : ''})`} |`,\n )\n out.push(`| Idle (zero live workers) | ${fmtMs(o.idleMs)} (${showMeasured(o.idlePct)}%) |`)\n out.push(\n `| Worker utilization (Σ worker wall ÷ supervisor wall) | ${showMeasured(o.workerUtilization)} |`,\n )\n out.push('')\n\n if (!isUnavailable(o.steersByWorker) && o.steersByWorker.length > 0) {\n out.push('### Steers per worker')\n out.push('')\n out.push('| Worker id | Label | Queued | Delivered |')\n out.push('|---|---|---:|---:|')\n for (const s of o.steersByWorker) {\n out.push(\n `| ${s.workerId === null ? 'unavailable — worker id absent; label join used' : `\\`${s.workerId}\\``} | \\`${s.worker}\\` | ${s.queued} | ${s.delivered} |`,\n )\n }\n out.push('')\n } else if (isUnavailable(o.steersByWorker)) {\n out.push(`### Steers per worker\\n\\nunavailable — ${o.steersByWorker.unavailable}\\n`)\n }\n\n out.push('## Decision quality')\n out.push('')\n out.push('| Metric | Value |')\n out.push('|---|---|')\n out.push(`| Settled by status | ${fmtCounts(d.settledByStatus)} |`)\n out.push(`| Settled verdicts | ${fmtCounts(d.settledVerdicts)} |`)\n out.push(`| Accepted (verify green + patch bytes) | ${showMeasured(d.accepted)} |`)\n out.push(`| Rejected (verify red) | ${showMeasured(d.rejected)} |`)\n out.push(`| Empty pass (green, no patch) | ${showMeasured(d.emptyPass)} |`)\n out.push(`| Evidence → respawn sequences | ${showMeasured(d.observeThenRespawn)} |`)\n out.push(\n `| Respawn with no same-parent settled evidence in front | ${showMeasured(d.respawnWithoutEvidence)} |`,\n )\n out.push(`| Review actions (steers + worker questions) | ${showMeasured(d.reviewActions)} |`)\n out.push(\n `| Worker evidence returned | ${isUnavailable(d.workerEvidenceBytes) ? showMeasured(d.workerEvidenceBytes) : `${d.workerEvidenceBytes} bytes`} |`,\n )\n out.push('')\n\n out.push('## Economics')\n out.push('')\n out.push('| Role | Tokens in | Tokens out | Cache read | Cache write | USD | Source |')\n out.push('|---|---:|---:|---:|---:|---:|---|')\n out.push(\n `| brain | ${showMeasured(e.brain.tokensIn)} | ${showMeasured(e.brain.tokensOut)} | ${showMeasured(e.brain.cacheRead)} | ${showMeasured(e.brain.cacheWrite)} | ${showMeasured(e.brain.usd)} | ${e.brain.source} |`,\n )\n out.push(\n `| workers | ${showMeasured(e.workers.tokensIn)} | ${showMeasured(e.workers.tokensOut)} | ${showMeasured(e.workers.cacheRead)} | ${showMeasured(e.workers.cacheWrite)} | ${showMeasured(e.workers.usd)} | ${e.workers.source} |`,\n )\n out.push('')\n if (!isUnavailable(e.brainTruncations) && e.brainTruncations > 0) {\n out.push(\n `- **BRAIN OUTPUT TRUNCATED: ${e.brainTruncations} completion(s) hit \\`finish_reason: \"length\"\\`** — the supervisor ` +\n 'acted on a half-written plan. Its output ceiling is too low; see `brain.jsonl` for the per-call `req_max_tokens`.',\n )\n } else {\n out.push(\n `- Brain completions truncated (finish_reason=length): ${showMeasured(e.brainTruncations)}`,\n )\n }\n out.push(`- Total USD: ${showMeasured(e.totalUsd)} (source: ${e.totalUsdSource})`)\n out.push(\n `- Spend measured two ways: journal-derived $${showMeasured(e.spend.journalDerived.usd)} over ${e.spend.journalDerived.records} journal record(s) (execution accounting) · ` +\n `close-record $${showMeasured(e.spend.closeRecord.usd)} over ${e.spend.closeRecord.records} close record(s) (billing-shaped). Divergence is a signal, not an error.`,\n )\n out.push(`- Cost per accepted patch: ${showMeasured(e.costPerAcceptedPatchUsd)}`)\n if (isUnavailable(e.workerWallMsDistribution)) {\n out.push(`- Worker wall distribution: unavailable — ${e.workerWallMsDistribution.unavailable}`)\n } else {\n const w = e.workerWallMsDistribution\n out.push(\n `- Worker wall (n=${w.n}): min ${fmtMs(w.min)} / p50 ${fmtMs(w.p50)} / p90 ${fmtMs(w.p90)} / max ${fmtMs(w.max)} / Σ ${fmtMs(w.sum)}`,\n )\n }\n out.push('')\n if (!isUnavailable(e.perWorker) && e.perWorker.length > 0) {\n out.push(\n '| Worker id | Label | Role | Runtime | Profile digest | Status | Failure | Infra | Wall | Tokens in | Tokens out | Patch bytes | Verify passed | Score |',\n )\n out.push('|---|---|---|---|---|---|---|---|---:|---:|---:|---:|---|---:|')\n for (const w of e.perWorker) {\n out.push(\n `| ${w.workerId === null ? 'unavailable — worker id absent; label join used' : `\\`${w.workerId}\\``} | \\`${w.worker}\\` | ${w.role ?? 'unavailable — source recorded no role'} | ${w.runtime ?? 'unavailable — source recorded no runtime'} | ${w.profileDigest === null ? 'unavailable — source recorded no profile digest' : `\\`${w.profileDigest}\\``} | ${w.status ?? 'unavailable — no terminal event'} | ${w.failure ?? 'none recorded'} | ${w.infra ?? 'unavailable'} | ${w.wallMs === null ? 'unavailable — no spawn/finish pair' : fmtMs(w.wallMs)} | ${w.tokensIn ?? 'unavailable — store does not attribute tokens per worker'} | ${w.tokensOut ?? 'unavailable — store does not attribute tokens per worker'} | ${w.patchBytes ?? 'unavailable — no worker patch file'} | ${w.passed === null ? 'unavailable — no verdict' : String(w.passed)} | ${w.score ?? 'unavailable — no numeric score'} |`,\n )\n }\n out.push('')\n }\n\n if (e.resourceRecords !== undefined) {\n out.push('## Named resource receipts', '', ...resourceRows(e.resourceRecords))\n }\n\n out.push('## Outcome')\n out.push('')\n out.push('| Metric | Value |')\n out.push('|---|---|')\n out.push(`| Supervisor status | ${showMeasured(r.outcome.supStatus)} |`)\n out.push(`| Status source | ${showMeasured(r.outcome.supStatusSource)} |`)\n out.push(`| Terminal reason | ${showMeasured(r.outcome.supReason)} |`)\n out.push(`| Failure | ${fmtFailure(r.outcome.failure)} |`)\n out.push(`| Supervisor verdict | ${showMeasured(r.outcome.supVerdict)} |`)\n out.push(`| Delivered | ${showMeasured(r.outcome.delivered)} |`)\n out.push(`| Judge resolved | ${showMeasured(r.outcome.judgeResolved)} |`)\n out.push(`| Judge score | ${showMeasured(r.outcome.judgeScore)} |`)\n out.push(\n `| Judge passed / total | ${showMeasured(r.outcome.judgePassed)} / ${showMeasured(r.outcome.judgeTotal)} |`,\n )\n out.push(\n `| Judge source | ${r.outcome.judgeSource ?? 'unavailable — no judge.json and no ledger row'} |`,\n )\n out.push(\n `| Verify gate | pass=${showMeasured(r.outcome.verifyPass)} rc=${showMeasured(r.outcome.verifyRc)} |`,\n )\n if (isUnavailable(r.outcome.patch)) {\n out.push(`| Patch | unavailable — ${r.outcome.patch.unavailable} |`)\n } else {\n const p = r.outcome.patch\n out.push(\n `| Patch | ${p.files} file(s), +${p.linesAdded}/-${p.linesRemoved}, test files touched: ${p.testFilesTouched.length === 0 ? 'none' : p.testFilesTouched.join(', ')} |`,\n )\n }\n out.push('')\n out.push('## Gaps')\n out.push('')\n if (r.gaps.length === 0) out.push('None — every metric above is backed by a present artifact.')\n else for (const g of r.gaps) out.push(`- ${g}`)\n out.push('')\n out.push(\n `> Harness-session view of the same run (model calls, stuck loops, tool errors): \\`${r.traceCommand}\\``,\n )\n out.push('')\n return out.join('\\n')\n}\n\nfunction fmtCounts(v: Measured<Record<string, number>>): string {\n if (isUnavailable(v)) return showMeasured(v as unknown as Measured<string>)\n const entries = Object.entries(v)\n return entries.length === 0 ? 'none' : entries.map(([k, n]) => `${k}=${n}`).join(', ')\n}\n\nexport function renderSupervisorRollupMarkdown(\n rollup: SupervisorRunRollup,\n title = 'Round rollup',\n): string {\n const out: string[] = []\n out.push(`# ${title}`)\n out.push('')\n out.push(`- Cells: ${rollup.cells}`)\n out.push(\n `- **Steers across all cells: ${showMeasured(rollup.steersTotal)}** (cells with ≥1 steer: ${showMeasured(rollup.cellsWithSteers)}; cells where the steer count is unavailable: ${rollup.cellsWithUnavailableSteers})`,\n )\n out.push(`- Waves per cell (mean): ${showMeasured(rollup.wavesMean)}`)\n out.push(`- Max concurrency observed: ${showMeasured(rollup.maxConcurrencyMax)}`)\n out.push(`- Worker utilization (mean): ${showMeasured(rollup.utilizationMean)}`)\n out.push(`- Idle share (mean): ${showMeasured(rollup.idlePctMean)}%`)\n out.push(\n `- Workers spawned: ${showMeasured(rollup.workersSpawnedTotal)} · accepted: ${showMeasured(rollup.acceptedTotal)}`,\n )\n out.push(\n `- Spend: $${showMeasured(rollup.usdTotal)} · judged resolved: ${showMeasured(rollup.resolvedCount)}/${rollup.cells}`,\n )\n out.push(\n `- Spend measured two ways: journal-derived $${showMeasured(rollup.spendUsd.journalDerived.value)} over ${rollup.spendUsd.journalDerived.runs}/${rollup.cells} runs (execution accounting) · ` +\n `close-record $${showMeasured(rollup.spendUsd.closeRecord.value)} over ${rollup.spendUsd.closeRecord.runs}/${rollup.cells} runs (billing-shaped)`,\n )\n out.push('')\n out.push('| Instance | Arm | Steers | Waves | Utilization | Idle % | Resolved | USD |')\n out.push('|---|---|---:|---:|---:|---:|---|---:|')\n for (const c of rollup.perCell) {\n out.push(\n `| ${c.instanceId ?? '?'} | ${c.arm ?? '?'} | ${showMeasured(c.steers)} | ${showMeasured(c.waves)} | ${showMeasured(c.utilization)} | ${showMeasured(c.idlePct)} | ${showMeasured(c.resolved)} | ${showMeasured(c.usd)} |`,\n )\n }\n out.push('')\n for (const cell of rollup.perCell) {\n if (cell.resourceRecords !== undefined) {\n out.push(\n `## Resource receipts — ${cell.instanceId ?? '?'} [${cell.arm ?? '?'}]`,\n '',\n ...resourceRows(cell.resourceRecords),\n )\n }\n }\n return out.join('\\n')\n}\n","/**\n * Optional Runtime run-dir files, read as bytes.\n *\n * `coordination-log.jsonl` is Runtime's JSONL of `{ runId, seq, at, event }`:\n * questions, steers, answers and peer mail between nodes. The `team-shape`\n * analyst reads communication and steer edges from it.\n */\n\nimport { readFile } from 'node:fs/promises'\nimport { join } from 'node:path'\n\nconst COORDINATION_FILE = 'coordination-log.jsonl'\n\n/** File text, or null when the file does not exist. Any other read error throws. */\nexport async function readMaybe(path: string): Promise<string | null> {\n return readFile(path, 'utf8').catch((error: unknown) => {\n if (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n (error as { code: unknown }).code === 'ENOENT'\n ) {\n return null\n }\n throw error\n })\n}\n\n/** The run's coordination log, or null when Runtime wrote none. */\nexport function readCoordinationLog(runDir: string): Promise<string | null> {\n return readMaybe(join(runDir, COORDINATION_FILE))\n}\n","import { nonEmptyString, recordOrNull as record } from './source-facts'\nimport type { SourceLimits } from './types'\n\nfunction spendRecord(value: unknown): Record<string, unknown> | null {\n const spend = record(value)\n if (spend === null) return null\n const tokens = record(spend.tokens)\n if (\n tokens === null ||\n typeof tokens.input !== 'number' ||\n !Number.isFinite(tokens.input) ||\n tokens.input < 0 ||\n typeof tokens.output !== 'number' ||\n !Number.isFinite(tokens.output) ||\n tokens.output < 0 ||\n typeof spend.usd !== 'number' ||\n !Number.isFinite(spend.usd) ||\n spend.usd < 0 ||\n (spend.usdKnown !== undefined && typeof spend.usdKnown !== 'boolean')\n ) {\n return null\n }\n return spend\n}\n\nexport function sourceLimits(\n root: string,\n events: readonly Record<string, unknown>[],\n workerIds: ReadonlySet<string>,\n): SourceLimits {\n const rootMeters = events.filter((event) => event.kind === 'metered' && event.id === root)\n const invalidRootMeters = rootMeters.filter((event) => spendRecord(event.spend) === null)\n const rootMeterReason =\n rootMeters.length === 0\n ? 'Runtime journal has no root metered event'\n : invalidRootMeters.length > 0\n ? `${invalidRootMeters.length} root metered event(s) lack complete spend`\n : null\n const closes = events.filter(\n (event) =>\n workerIds.has(nonEmptyString(event.id) ?? '') &&\n (event.kind === 'settled' || event.kind === 'cancelled'),\n )\n const settledById = new Map<string, Record<string, unknown>[]>()\n for (const event of closes) {\n const id = nonEmptyString(event.id)\n if (id === null) continue\n const matches = settledById.get(id) ?? []\n matches.push(event)\n settledById.set(id, matches)\n }\n const incompleteWorkers = [...workerIds].filter((id) => {\n const terminal = settledById.get(id)\n return (\n terminal?.length !== 1 ||\n terminal[0]?.kind !== 'settled' ||\n spendRecord(terminal[0]?.spent) === null\n )\n })\n const missingVerdicts = [...workerIds].filter((id) => {\n const terminal = settledById.get(id)?.[0]\n if (terminal?.kind !== 'settled') return true\n const verdict = record(terminal.verdict)\n return typeof verdict?.valid !== 'boolean'\n })\n\n return {\n managerTokens: rootMeterReason,\n workerTokens:\n incompleteWorkers.length === 0\n ? null\n : `${incompleteWorkers.length}/${workerIds.size} child invocation(s) lack one settled spend record`,\n // `usdKnown: false` on ONE record is not a limit of this store: the store priced every\n // other record, and a limit here discards them all. The analyzer folds the flag per\n // record instead, and reports a partial total with the unpriced nodes named.\n spendUsd:\n rootMeterReason !== null\n ? rootMeterReason\n : incompleteWorkers.length > 0\n ? 'at least one child invocation lacks a settled spend record'\n : null,\n workerVerdicts:\n missingVerdicts.length === 0\n ? null\n : `${missingVerdicts.length}/${workerIds.size} child invocation(s) lack a structured validity verdict`,\n deliverables:\n workerIds.size === 0\n ? null\n : 'Runtime FileRunContext does not retain per-child delivered patches',\n }\n}\n","/**\n * Reader for agent-runtime's file-backed supervision context.\n *\n * Runtime stores multiple recursive trees in one `spawn-journal.jsonl`.\n * Each line is an envelope whose `root` identifies the local tree. A journal\n * can connect a nested tree with `spawned.ownedTreeRoot`. It can also use the\n * spawned child id as the nested root when no owned tree is recorded. Either\n * way the nested tree may repeat its owner's spawn as a parentless marker: the\n * owner's id, not the tree key, identifies it (an owned tree's key is a path\n * such as `root/root:s0`). Descendant spawns must occur in the tree their\n * parent owns. This reader removes a duplicate marker and preserves the other\n * envelopes for the supervisor-run analyzer. Runtime stores profile\n * identity below `identity` and does not emit Eval's role field. This boundary\n * projects those fields without changing Runtime's dialect.\n *\n * Transcripts come from Runtime's own records too: `root-stream.jsonl` is the root's, each\n * worker's turn outputs and native-session receipt are read from the journal, and every blob\n * a record names is checked on disk (see `nodeTranscripts`).\n *\n * The run's terminal record is Runtime's own: `result.json` is the\n * `SupervisedResult` that `supervise()` returned, verbatim, and its `kind`\n * (`winner`, `no-winner`, or whatever a later arm is called) is the status.\n * `failure.json` (`{ runId, pursuitId, at, error: { name, message } }`) is the\n * record Runtime writes when `supervise()` threw before a result landed. Both\n * pass through as bytes; `terminal-record.ts` reads them. The reader does not\n * decide which kinds count: a kind it refuses is a run that recorded its\n * outcome and got reported as having none. The reader does not synthesize status fields. The analyzer names the Runtime\n * record that supplied a status, so status provenance cannot be mislabelled.\n *\n * `usdKnown: false` / `tokensKnown: false` on ONE record is not a limit of this\n * store. The store recorded every other record completely, so the flags travel\n * through to the analyzer per record, which reports the measured nodes and\n * names the unreported ones.\n */\n\nimport { readFile, stat } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { hashCanonical } from '../ledger-core/canonical'\nimport type { RolloutWorkspaceCapture } from '../rollout/schema'\nimport { readCoordinationLog, readMaybe } from './coordination-reader'\nimport { sourceLimits } from './runtime-source-limits'\nimport { nonEmptyString, recordOrNull as record } from './source-facts'\nimport {\n NO_SOURCE_LIMITS,\n type SupervisorRunReader,\n type SupervisorRunSources,\n type WorkerLogSource,\n type WorkerNativeSession,\n} from './types'\n\nconst JOURNAL_FILE = 'spawn-journal.jsonl'\nconst OBSERVER_FILE = 'observer.jsonl'\nconst ROOT_STREAM_FILE = 'root-stream.jsonl'\nconst BLOB_DIR = 'blobs'\nconst RESULT_FILE = 'result.json'\nconst FAILURE_FILE = 'failure.json'\n\n/**\n * The files only Runtime's durable layer writes. Any one of them marks a\n * Runtime run directory: `supervise()` opens the spawn journal on its first\n * event, and `supervisePursuit` appends the observer's `before` event and, on\n * a throw, the failure record before any spawn.\n *\n * Measured motive (discovery-lab recursive smoke r1, 2026-09-06): the first\n * attempt threw on a caller input error 16 minutes before the corrected attempt\n * opened the spawn journal. At that instant the directory held `observer.jsonl`\n * (2 records) and the failure record and no journal, so a journal-only test\n * routed it to an unrelated reader, which reads neither file, and the recorded\n * throw was reported as no run at all.\n */\nconst RUNTIME_RUN_DIR_MARKERS: readonly string[] = [JOURNAL_FILE, OBSERVER_FILE, FAILURE_FILE]\n\ninterface BeginRecord {\n readonly root: string\n readonly at: string\n readonly line: number\n}\n\ninterface EventRecord {\n readonly root: string\n readonly event: Record<string, unknown>\n readonly line: number\n}\n\ninterface NormalizedRuntimeJournal {\n readonly root: string\n readonly startedAt: string\n readonly journal: string\n readonly events: readonly Record<string, unknown>[]\n}\n\nfunction profileDigest(event: Record<string, unknown>): string | null {\n const direct = nonEmptyString(event.profileDigest)\n if (direct !== null) return direct\n const identity = record(event.identity)\n return identity === null ? null : nonEmptyString(identity.profileDigest)\n}\n\nfunction formatError(path: string, line: number, detail: string): Error {\n return new Error(`${path}:${line}: invalid Runtime spawn journal: ${detail}`)\n}\n\nfunction parseEnvelopeJournal(text: string, path: string): NormalizedRuntimeJournal {\n const begins: BeginRecord[] = []\n const events: EventRecord[] = []\n const begun = new Map<string, BeginRecord>()\n\n for (const [index, sourceLine] of text.split('\\n').entries()) {\n const line = index + 1\n const trimmed = sourceLine.trim()\n if (trimmed.length === 0) continue\n let parsed: unknown\n try {\n parsed = JSON.parse(trimmed)\n } catch {\n throw formatError(path, line, 'line is not JSON')\n }\n const envelope = record(parsed)\n if (envelope === null) throw formatError(path, line, 'line is not an object')\n const kind = nonEmptyString(envelope.kind)\n const root = nonEmptyString(envelope.root)\n if (root === null) throw formatError(path, line, 'root must be a non-empty string')\n\n if (kind === 'begin') {\n const at = nonEmptyString(envelope.at)\n if (at === null || !Number.isFinite(Date.parse(at))) {\n throw formatError(path, line, 'begin.at must be an ISO timestamp')\n }\n if (begun.has(root)) throw formatError(path, line, `tree ${JSON.stringify(root)} began twice`)\n const begin = { root, at, line }\n begun.set(root, begin)\n begins.push(begin)\n continue\n }\n\n if (kind !== 'event') {\n throw formatError(path, line, \"kind must be 'begin' or 'event'\")\n }\n if (!begun.has(root)) {\n throw formatError(path, line, `event for tree ${JSON.stringify(root)} precedes begin`)\n }\n const event = record(envelope.event)\n if (event === null) throw formatError(path, line, 'event must be an object')\n if (nonEmptyString(event.kind) === null) {\n throw formatError(path, line, 'event.kind must be a non-empty string')\n }\n events.push({ root, event: { ...event }, line })\n }\n\n if (begins.length === 0) throw formatError(path, 1, 'no begin record')\n\n const parentSpawnsById = new Map<string, EventRecord[]>()\n const parentSpawnsByOwnedTreeRoot = new Map<string, EventRecord[]>()\n for (const entry of events) {\n if (entry.event.kind !== 'spawned') continue\n const id = nonEmptyString(entry.event.id)\n if (id === null) continue\n if (nonEmptyString(entry.event.parent) !== null) {\n const ownedTreeRoot = nonEmptyString(entry.event.ownedTreeRoot)\n if (ownedTreeRoot !== null) {\n const owners = parentSpawnsByOwnedTreeRoot.get(ownedTreeRoot) ?? []\n owners.push(entry)\n parentSpawnsByOwnedTreeRoot.set(ownedTreeRoot, owners)\n } else {\n const matches = parentSpawnsById.get(id) ?? []\n matches.push(entry)\n parentSpawnsById.set(id, matches)\n }\n }\n }\n\n const nestedRoots = new Set<string>()\n const nestedParentSpawns = new Map<string, EventRecord>()\n for (const begin of begins) {\n const parentSpawns = [\n ...new Set([\n ...(parentSpawnsByOwnedTreeRoot.get(begin.root) ?? []),\n ...(parentSpawnsById.get(begin.root) ?? []),\n ]),\n ].filter((entry) => entry.root !== begin.root)\n if (parentSpawns.length > 1) {\n throw formatError(\n path,\n begin.line,\n `tree ${JSON.stringify(begin.root)} has ${parentSpawns.length} parent spawns`,\n )\n }\n if (parentSpawns.length === 1) {\n nestedRoots.add(begin.root)\n nestedParentSpawns.set(begin.root, parentSpawns[0] as EventRecord)\n }\n }\n\n const topRoots = begins.filter((begin) => !nestedRoots.has(begin.root))\n if (topRoots.length !== 1) {\n throw formatError(\n path,\n topRoots[0]?.line ?? 1,\n `expected one top-level tree, found ${topRoots.length}`,\n )\n }\n const top = topRoots[0] as BeginRecord\n\n // A tree's root marker is a parentless spawn of the node that owns the tree: the top root\n // itself, or the parent spawn that owns a nested tree. An owned tree's key is a path, so\n // the owner's id is compared, never the tree key.\n const ownerIdByTree = new Map<string, string>([[top.root, top.root]])\n for (const [nestedRoot, parentSpawn] of nestedParentSpawns) {\n const ownerId = nonEmptyString(parentSpawn.event.id)\n if (ownerId !== null) ownerIdByTree.set(nestedRoot, ownerId)\n }\n const isRootMarker = (entry: EventRecord): boolean =>\n entry.event.kind === 'spawned' &&\n (entry.event.parent === undefined || entry.event.parent === null) &&\n nonEmptyString(entry.event.id) !== null &&\n entry.event.id === ownerIdByTree.get(entry.root)\n const rootMarkersByTree = new Map<string, EventRecord[]>()\n for (const entry of events) {\n if (!isRootMarker(entry)) continue\n const markers = rootMarkersByTree.get(entry.root) ?? []\n markers.push(entry)\n rootMarkersByTree.set(entry.root, markers)\n }\n\n for (const nestedRoot of nestedRoots) {\n const markers = rootMarkersByTree.get(nestedRoot) ?? []\n if (markers.length > 1) {\n throw formatError(\n path,\n begun.get(nestedRoot)?.line ?? 1,\n `nested tree ${JSON.stringify(nestedRoot)} contains ${markers.length} root markers`,\n )\n }\n const parentSpawn = nestedParentSpawns.get(nestedRoot)\n if (parentSpawn === undefined) {\n throw formatError(\n path,\n begun.get(nestedRoot)?.line ?? 1,\n `nested tree ${JSON.stringify(nestedRoot)} has no parent spawn`,\n )\n }\n const markerDigest = profileDigest(markers[0]?.event ?? {})\n const parentDigest = profileDigest(parentSpawn.event)\n if (markerDigest !== null && parentDigest !== null && markerDigest !== parentDigest) {\n throw formatError(\n path,\n markers[0]?.line ?? 1,\n `nested tree ${JSON.stringify(nestedRoot)} disagrees with its parent profile digest`,\n )\n }\n if (parentDigest === null && markerDigest !== null) {\n parentSpawn.event.profileDigest = markerDigest\n }\n }\n\n const ownedTreeBySupervisorId = new Map<string, string>([[top.root, top.root]])\n for (const [nestedRoot, parentSpawn] of nestedParentSpawns) {\n const supervisorId = nonEmptyString(parentSpawn.event.id)\n if (supervisorId === null) continue\n const priorTree = ownedTreeBySupervisorId.get(supervisorId)\n if (priorTree !== undefined && priorTree !== nestedRoot) {\n throw formatError(\n path,\n parentSpawn.line,\n `spawn ${JSON.stringify(supervisorId)} owns both ${JSON.stringify(priorTree)} and ${JSON.stringify(nestedRoot)}`,\n )\n }\n ownedTreeBySupervisorId.set(supervisorId, nestedRoot)\n }\n for (const entry of events) {\n if (entry.event.kind !== 'spawned') continue\n const parentId = nonEmptyString(entry.event.parent)\n if (parentId === null) continue\n const parentTree = ownedTreeBySupervisorId.get(parentId)\n if (parentTree === undefined) {\n throw formatError(\n path,\n entry.line,\n `spawn ${JSON.stringify(entry.event.id)} names parent ${JSON.stringify(parentId)}, which owns no journal tree`,\n )\n }\n if (entry.root !== parentTree) {\n throw formatError(\n path,\n entry.line,\n `spawn ${JSON.stringify(entry.event.id)} is in tree ${JSON.stringify(entry.root)}, but parent ${JSON.stringify(parentId)} owns tree ${JSON.stringify(parentTree)}`,\n )\n }\n }\n\n // Runtime's recursive atom has no supervisor/worker role field. A tree root\n // is a supervisor; a child without its own tree is a worker.\n const supervisorIds = new Set([\n top.root,\n ...[...nestedParentSpawns.values()]\n .map((entry) => nonEmptyString(entry.event.id))\n .filter((id): id is string => id !== null),\n ])\n const normalized = events\n .filter((entry) => !(nestedRoots.has(entry.root) && isRootMarker(entry)))\n .map((entry) => {\n const event = { ...entry.event }\n if (event.kind === 'spawned') {\n const digest = profileDigest(event)\n if (event.profileDigest === undefined && digest !== null) {\n event.profileDigest = digest\n }\n if (event.role === undefined) {\n event.role = supervisorIds.has(nonEmptyString(event.id) ?? '') ? 'supervisor' : 'worker'\n }\n }\n return { root: entry.root, event }\n })\n\n const rootMarkers = rootMarkersByTree.get(top.root) ?? []\n if (rootMarkers.length !== 1) {\n throw formatError(\n path,\n top.line,\n `top-level tree ${JSON.stringify(top.root)} must contain one root marker`,\n )\n }\n\n return {\n root: top.root,\n startedAt: top.at,\n // Keep Runtime's event envelope intact. The pure source parser uses the envelope to\n // distinguish an understood-but-unmodeled Runtime event from an unreadable flat record.\n journal: `${normalized\n .map((entry) => JSON.stringify({ kind: 'event', root: entry.root, event: entry.event }))\n .join('\\n')}\\n`,\n events: normalized.map((entry) => entry.event),\n }\n}\n\nfunction parseOptionalRecord(text: string | null, path: string): Record<string, unknown> | null {\n if (text === null) return null\n let parsed: unknown\n try {\n parsed = JSON.parse(text)\n } catch {\n throw new Error(`${path}: invalid JSON`)\n }\n const value = record(parsed)\n if (value === null) throw new Error(`${path}: expected a JSON object`)\n return value\n}\n\n/**\n * Refuse a `result.json` that belongs to another run. Runtime's result carries\n * its own `tree.root`; a settled record with a different root is a copied or\n * misplaced file, and reading its status onto this journal misreports the run.\n */\nfunction assertResultMatchesJournal(\n root: string,\n result: Record<string, unknown> | null,\n resultPath: string,\n): void {\n const resultKind = result === null ? null : nonEmptyString(result.kind)\n if (resultKind === null || result === null) return\n const resultRoot = nonEmptyString(record(result.tree)?.root)\n if (resultRoot === null) {\n throw new Error(`${resultPath}: Runtime ${resultKind} result has no tree.root`)\n }\n if (resultRoot !== root) {\n throw new Error(\n `${resultPath}: root ${JSON.stringify(resultRoot)} does not match journal root ${JSON.stringify(root)}`,\n )\n }\n}\n\n/**\n * Refuse a `failure.json` that is not a failure record. Runtime writes\n * `{ runId, pursuitId, at, error: { name, message } }`; a document without an\n * `error` object is not one, and reading it as a failure invents a terminal\n * state the run never recorded. The record carries no tree root, so its\n * identity is not checked against the journal.\n */\nfunction assertFailureRecord(failure: Record<string, unknown> | null, failurePath: string): void {\n if (failure === null) return\n if (record(failure.error) === null) {\n throw new Error(`${failurePath}: Runtime failure record has no error object`)\n }\n}\n\n/**\n * The journal's begin stamp in the analyzer's state-document shape. It carries\n * the run identity and start instant only; the terminal status lives in\n * Runtime's own `result.json` / `failure.json`, which the analyzer reads by\n * name, so no synthetic status field is fabricated here.\n */\nfunction runtimeBeginState(root: string, startedAt: string): string {\n return JSON.stringify({ id: root, startedAt })\n}\n\n/**\n * The file Runtime's `FileResultBlobStore` writes for one content address\n * (`sha256:<hex>` → `blobs/sha256-<hex>.json`), or null for anything that is not one.\n */\nfunction blobFile(runDir: string, ref: unknown): string | null {\n return typeof ref === 'string' && /^sha256:[0-9a-f]{64}$/u.test(ref)\n ? join(runDir, BLOB_DIR, `${ref.replace(':', '-')}.json`)\n : null\n}\n\ntype NodeTranscript = Pick<\n WorkerLogSource,\n 'transcriptRef' | 'turns' | 'nativeSession' | 'workspaceCaptures'\n>\n\ninterface NodeTranscriptFacts {\n dispatched: number\n readonly outputRefs: { value: unknown; turn: boolean }[]\n readonly outputPositions: Map<string, number>\n receipt: Record<string, unknown> | null\n}\n\n/** A later receipt replaces an earlier one, except that an absence never replaces an available one. */\nfunction keepReceipt(fact: NodeTranscriptFacts, receipt: Record<string, unknown> | null): void {\n if (receipt === null) return\n if (fact.receipt?.status === 'available' && receipt.status !== 'available') return\n fact.receipt = receipt\n}\n\n/**\n * The files each harness writes its conversation to. A receipt can be available and complete\n * while holding none of them: on the 2026-10-04 trace proof a Pi worker that never wrote a session\n * stored only `.pi/agent/models-store.json`, and this summary counted it as a transcript.\n */\nconst HARNESS_SESSION_FILE: Readonly<Record<string, RegExp>> = {\n 'claude-code': /(^|\\/)\\.claude\\/projects\\/.+\\.jsonl$/u,\n codex: /(^|\\/)\\.codex\\/sessions\\/.+\\.jsonl$/u,\n pi: /(^|\\/)\\.pi\\/agent\\/sessions\\/.+\\.jsonl$/u,\n opencode:\n /(^|\\/)(\\.local\\/share\\/opencode\\/(opencode\\.db|storage\\/session\\/.+\\.json|export\\/.+\\.json)|\\.opencode\\/sessions\\/.+)$/u,\n}\n\n/** Session files the receipt's transcript blob lists, or undefined when it cannot say. */\nasync function receiptSessionFiles(file: string): Promise<number | undefined> {\n let descriptor: unknown\n try {\n descriptor = JSON.parse(await readFile(file, 'utf8'))\n } catch {\n return undefined\n }\n const harness = record(descriptor)?.harness\n const files = record(descriptor)?.files\n const pattern = typeof harness === 'string' ? HARNESS_SESSION_FILE[harness] : undefined\n if (pattern === undefined || !Array.isArray(files)) return undefined\n return files.filter((entry) => {\n const path = record(entry)?.path\n return typeof path === 'string' && pattern.test(path)\n }).length\n}\n\ntype NativeSessionState = 'complete' | 'partial' | 'no-session-file' | 'unavailable' | 'none'\n\nfunction nativeSessionState(session: WorkerNativeSession | null | undefined): NativeSessionState {\n if (session === null || session === undefined) return 'none'\n if (session.status !== 'available') return 'unavailable'\n if (session.coverageComplete === false) return 'partial'\n if (session.sessionFiles === 0) return 'no-session-file'\n return 'complete'\n}\n\n/**\n * What this reader can say about harness-session traces. Every spawned worker counts, including\n * one that recorded nothing; the root is reported apart because its receipt lives in result.json\n * (`rootHarnessTranscript`), not on a worker. Runtime records the session identity on each\n * receipt, so the sessions are read per node, not through one command. A receipt counts as a\n * session only when its copy is complete and holds a file the harness writes its conversation to.\n */\nfunction nativeTraceSummary(\n workers: readonly WorkerLogSource[],\n root: NodeTranscript | undefined,\n): string {\n const states = workers.map((worker) => nativeSessionState(worker.nativeSession))\n const count = (state: NativeSessionState): number => states.filter((s) => s === state).length\n const rootSession = root?.nativeSession ?? null\n const rootState = nativeSessionState(rootSession)\n const rootText =\n rootSession === null\n ? 'no receipt'\n : rootSession.status === 'unavailable'\n ? `unavailable (${rootSession.reason})`\n : rootState === 'complete'\n ? 'complete'\n : rootState === 'partial'\n ? 'partial copy'\n : 'no session file'\n if (rootSession === null && states.every((state) => state === 'none'))\n return 'unavailable — no node carries a Runtime harness transcript receipt'\n const gaps = [\n count('partial') > 0 ? `${count('partial')} only a partial copy` : null,\n count('no-session-file') > 0\n ? `${count('no-session-file')} a receipt with no session file`\n : null,\n ].filter((gap): gap is string => gap !== null)\n return `per node — ${count('complete')} of ${workers.length} workers carry a complete native session receipt (workers[].nativeSession)${gaps.length > 0 ? `; ${gaps.join('; ')}` : ''}; root: ${rootText} (result.json rootHarnessTranscript)`\n}\n\nasync function workspaceCapturesFromOutput(\n runDir: string,\n ref: unknown,\n): Promise<RolloutWorkspaceCapture[]> {\n const outRef = typeof ref === 'string' ? ref : null\n const blobPath = blobFile(runDir, ref)\n const missing = (projectionGap: string): RolloutWorkspaceCapture => ({\n outRef,\n blobPath,\n receiptPointer: null,\n receipt: null,\n attempts: null,\n coverageComplete: null,\n incompleteReason: null,\n projectionGap,\n })\n if (blobPath === null) return [missing('Runtime output has no valid content address')]\n if (!(await isFile(blobPath))) return [missing('Runtime output blob is missing or not a file')]\n const raw = await readMaybe(blobPath)\n if (raw === null) return [missing('Runtime output blob is missing')]\n let output: unknown\n try {\n output = JSON.parse(raw)\n } catch {\n return [missing('Runtime output blob is not JSON')]\n }\n let addressGap: string | null = null\n try {\n if (hashCanonical(output) !== outRef) {\n addressGap = 'Runtime output content address does not match output blob'\n }\n } catch {\n addressGap = 'Runtime output cannot be canonically hashed'\n }\n const project = (rawReceipt: unknown, receiptPointer: string | null): RolloutWorkspaceCapture => {\n const receipt = record(rawReceipt)\n if (receipt === null) {\n return {\n ...missing(\n `workspaceCapture receipt is absent or malformed${addressGap === null ? '' : `; ${addressGap}`}`,\n ),\n receiptPointer,\n receipt: rawReceipt,\n }\n }\n const provenance = record(receipt.provenance)\n const attempts = Array.isArray(provenance?.attempts) ? provenance.attempts : null\n const coverageComplete =\n typeof receipt.coverageComplete === 'boolean' ? receipt.coverageComplete : null\n const incompleteReason =\n typeof receipt.incompleteReason === 'string' ? receipt.incompleteReason : null\n const gaps: string[] = []\n if (addressGap !== null) gaps.push(addressGap)\n if (coverageComplete === null) gaps.push('workspaceCapture.coverageComplete is absent')\n if (record(receipt.snapshot) === null) gaps.push('workspaceCapture.snapshot is absent')\n if (provenance === null) gaps.push('workspaceCapture.provenance is absent')\n if (attempts === null) gaps.push('workspaceCapture.provenance.attempts is absent')\n else if (attempts.length === 0 || attempts.some((attempt) => record(attempt) === null)) {\n gaps.push('workspaceCapture.provenance.attempts is empty or malformed')\n }\n return {\n outRef,\n blobPath,\n receiptPointer,\n receipt,\n attempts,\n coverageComplete,\n incompleteReason,\n projectionGap: gaps.length > 0 ? gaps.join('; ') : null,\n }\n }\n const result = record(output)\n const captures: RolloutWorkspaceCapture[] = []\n // Use the record's field order and each array's order so every retained source stays ordered.\n for (const key of Object.keys(result ?? {})) {\n if (key === 'workspaceCapture') {\n captures.push(project(result?.[key], '/workspaceCapture'))\n } else if (key === 'workspaceCaptures') {\n const receipts = result?.[key]\n if (Array.isArray(receipts) && receipts.length > 0) {\n for (const [index, receipt] of receipts.entries()) {\n captures.push(project(receipt, `/workspaceCaptures/${index}`))\n }\n } else {\n captures.push({\n ...missing(\n `workspaceCaptures is empty or malformed${addressGap === null ? '' : `; ${addressGap}`}`,\n ),\n receiptPointer: '/workspaceCaptures',\n receipt: receipts ?? null,\n })\n }\n }\n }\n return captures.length > 0 ? captures : [project(null, null)]\n}\n\n/**\n * What Runtime retained of each node's decisions, from its own records.\n *\n * - A turn is one `execution-admitted` event in the `dispatched` phase. Its `execution-result`\n * names an output blob holding that turn's provider event stream (reasoning, tool calls and\n * results as the harness reported them). A dispatched turn with no retained output lost its\n * record, which is how a worker that went down mid-turn shows up.\n * - Every event's `outRef` enters the same collector, once per node and address. Terminal\n * records retain ordinary and steerable results; they are not counted as dispatched turns.\n * - The terminal event's `harnessTranscript` receipt covers the harness's native session files.\n * Those are the only record of the harness's own subagents, so an unavailable receipt is a\n * separate gap from a missing turn, and its reason is Runtime's, verbatim. `settled`,\n * `cancelled` and `reconciled` all carry one; an available receipt is never replaced by a later\n * absence. The root has no terminal event, so its receipt is the settle record's\n * `rootHarnessTranscript`.\n *\n * Blob files are checked on disk: a receipt that names a blob the directory no longer holds is\n * not a retained transcript.\n */\nasync function nodeTranscripts(\n runDir: string,\n events: readonly Record<string, unknown>[],\n nodeIds: ReadonlySet<string>,\n root?: { readonly id: string; readonly receipt: Record<string, unknown> | null },\n): Promise<Map<string, NodeTranscript>> {\n const facts = new Map<string, NodeTranscriptFacts>()\n const entry = (id: string): NodeTranscriptFacts => {\n let found = facts.get(id)\n if (found === undefined) {\n found = { dispatched: 0, outputRefs: [], outputPositions: new Map(), receipt: null }\n facts.set(id, found)\n }\n return found\n }\n for (const event of events) {\n const id = nonEmptyString(event.id)\n if (id === null || !nodeIds.has(id)) continue\n if (Object.hasOwn(event, 'outRef')) {\n const fact = entry(id)\n const ref = event.outRef\n const position = typeof ref === 'string' ? fact.outputPositions.get(ref) : undefined\n if (position !== undefined) {\n if (event.kind === 'execution-result') fact.outputRefs[position]!.turn = true\n } else {\n if (typeof ref === 'string') fact.outputPositions.set(ref, fact.outputRefs.length)\n fact.outputRefs.push({ value: ref, turn: event.kind === 'execution-result' })\n }\n }\n if (event.kind === 'execution-admitted' && record(event.admission)?.phase === 'dispatched') {\n entry(id).dispatched += 1\n } else if (\n event.kind === 'settled' ||\n event.kind === 'cancelled' ||\n event.kind === 'reconciled'\n ) {\n // A reconciled node carries its receipt on `reconciled`, which 15 available transcripts of\n // the 2026-10-04 Discovery archives did and this reader once skipped.\n keepReceipt(entry(id), record(event.harnessTranscript))\n }\n }\n if (root !== undefined && nodeIds.has(root.id)) keepReceipt(entry(root.id), root.receipt)\n const out = new Map<string, NodeTranscript>()\n for (const [id, fact] of facts) {\n const retained: string[] = []\n let retainedTurns = 0\n const workspaceCaptures: RolloutWorkspaceCapture[] = []\n for (const { value: ref, turn } of fact.outputRefs) {\n const file = blobFile(runDir, ref)\n if (file !== null && (await isFile(file))) {\n retained.push(file)\n if (turn) retainedTurns += 1\n }\n workspaceCaptures.push(...(await workspaceCapturesFromOutput(runDir, ref)))\n }\n let nativeSession: WorkerNativeSession | null = null\n if (fact.receipt !== null) {\n if (fact.receipt.status === 'available') {\n const file = blobFile(runDir, fact.receipt.transcriptRef)\n if (file !== null && (await isFile(file))) {\n const sessionFiles = await receiptSessionFiles(file)\n const coverageComplete = fact.receipt.coverageComplete\n nativeSession = {\n status: 'available',\n ref: file,\n ...(typeof coverageComplete === 'boolean' ? { coverageComplete } : {}),\n ...(sessionFiles === undefined ? {} : { sessionFiles }),\n }\n } else {\n nativeSession = { status: 'unavailable', reason: 'receipt-blob-missing' }\n }\n } else {\n nativeSession = {\n status: 'unavailable',\n reason: nonEmptyString(fact.receipt.reason) ?? 'unavailable',\n }\n }\n }\n out.set(id, {\n // The native session is the fuller record; the newest turn output is the next best.\n transcriptRef:\n nativeSession?.status === 'available' ? nativeSession.ref : (retained.at(-1) ?? null),\n turns: { dispatched: fact.dispatched, retained: retainedTurns },\n nativeSession,\n workspaceCaptures: workspaceCaptures.length > 0 ? workspaceCaptures : null,\n })\n }\n return out\n}\n\nexport interface RuntimeReaderOptions {\n /**\n * Throw on a missing spawn journal instead of returning absent-shaped\n * sources. The default (false) models a journal-less run dir — a\n * pre-supervise death, a backfilled zombie — as a readable absence.\n */\n readonly strict?: boolean\n}\n\n/**\n * Sources for a run dir whose spawn journal does not exist. Mirrors the\n * absent shape the reader returns for a missing store: every\n * journal-dependent metric downstream reads `unavailable`, never 0.\n */\n/**\n * The run identity a terminal record names when no journal exists yet: the\n * settle record's `tree.root`, else the failure record's `runId`. Both are\n * Runtime's own `runId`, so the report names the run the record is about\n * instead of `?`.\n */\nfunction recordedRunId(\n result: Record<string, unknown> | null,\n failure: Record<string, unknown> | null,\n): string | null {\n return nonEmptyString(record(result?.tree)?.root) ?? nonEmptyString(failure?.runId)\n}\n\nfunction absentRuntimeSupervisorRun(\n runDir: string,\n resultText: string | null,\n failureText: string | null,\n instanceId: string | null,\n): SupervisorRunSources {\n const reason = `no Runtime spawn journal (${JOURNAL_FILE}) under ${runDir}`\n return {\n runRef: runDir,\n instanceId,\n arm: null,\n supRunDir: null,\n journal: null,\n journalMissingReason: reason,\n brainLog: null,\n brainLogMissingReason:\n 'Runtime FileRunContext records spend but not model completion finish reasons',\n state: null,\n progress: null,\n workers: null,\n workersMissingReason: reason,\n result: resultText,\n failure: failureText,\n judge: null,\n judgeSource: null,\n patch: null,\n driverLog: null,\n harnessWorkerTokens: null,\n harnessMissingReason: 'Runtime FileRunContext has no external worker-token join',\n limits: NO_SOURCE_LIMITS,\n rootTranscriptRef: null,\n rootWorkspaceCaptures: null,\n traceCommand: 'unavailable — Runtime FileRunContext records no provider-session trace identity',\n }\n}\n\n/**\n * Read one agent-runtime `createFileRunContext(dir)` directory.\n *\n * A run dir without `spawn-journal.jsonl` returns the same absent-shaped\n * sources the reader returns for a missing store: `journal` and\n * `workers` null, each with its reason, so every dependent metric reads\n * `unavailable` — never 0 and never a throw. Its `result.json` and\n * `failure.json` are still read, so a run that died before its first spawn\n * reports the failure Runtime recorded. Pass `strict: true` to throw on the\n * missing journal instead. A journal, result, or failure document that exists\n * but cannot be parsed always throws: a corrupt record is a defect, not an\n * absence.\n *\n * The reader translates storage envelopes only. It does not assign research\n * roles, interpret artifacts, or turn process completion into a quality\n * verdict.\n */\nexport async function readRuntimeSupervisorRun(\n runDir: string,\n opts: RuntimeReaderOptions = {},\n): Promise<SupervisorRunSources> {\n const journalPath = join(runDir, JOURNAL_FILE)\n const rawJournal =\n opts.strict === true ? await readFile(journalPath, 'utf8') : await readMaybe(journalPath)\n const resultPath = join(runDir, RESULT_FILE)\n const failurePath = join(runDir, FAILURE_FILE)\n const resultText = await readMaybe(resultPath)\n const failureText = await readMaybe(failurePath)\n const failure = parseOptionalRecord(failureText, failurePath)\n assertFailureRecord(failure, failurePath)\n const result = parseOptionalRecord(resultText, resultPath)\n if (rawJournal === null) {\n return absentRuntimeSupervisorRun(\n runDir,\n resultText,\n failureText,\n recordedRunId(result, failure),\n )\n }\n const normalized = parseEnvelopeJournal(rawJournal, journalPath)\n assertResultMatchesJournal(normalized.root, result, resultPath)\n\n const spawns = normalized.events.filter(\n (event) => event.kind === 'spawned' && nonEmptyString(event.id) !== null,\n )\n const childSpawns = spawns.filter((event) => event.id !== normalized.root)\n const workerIds = new Set(\n childSpawns.map((event) => nonEmptyString(event.id)).filter((id): id is string => id !== null),\n )\n const transcripts = await nodeTranscripts(\n runDir,\n normalized.events,\n new Set([normalized.root, ...workerIds]),\n { id: normalized.root, receipt: record(result?.rootHarnessTranscript) },\n )\n const workers: WorkerLogSource[] = childSpawns.map((event) => {\n const workerId = nonEmptyString(event.id) as string\n const transcript = transcripts.get(workerId)\n return {\n workerId,\n label: nonEmptyString(event.label) ?? String(event.id),\n events: null,\n inbox: null,\n patchBytes: null,\n transcriptRef: transcript?.transcriptRef ?? null,\n turns: transcript?.turns ?? { dispatched: 0, retained: 0 },\n nativeSession: transcript?.nativeSession ?? null,\n workspaceCaptures: transcript?.workspaceCaptures ?? null,\n patchPath: null,\n }\n })\n // Runtime appends every root provider event to the root stream as it arrives.\n const rootStream = join(runDir, ROOT_STREAM_FILE)\n\n return {\n runRef: runDir,\n instanceId: normalized.root,\n arm: null,\n supRunDir: runDir,\n journal: normalized.journal,\n brainLog: null,\n brainLogMissingReason:\n 'Runtime FileRunContext records spend but not model completion finish reasons',\n state: runtimeBeginState(normalized.root, normalized.startedAt),\n progress: null,\n workers,\n workersMissingReason: null,\n result: resultText,\n failure: failureText,\n judge: null,\n judgeSource: null,\n patch: null,\n driverLog: null,\n coordinationLog: await readCoordinationLog(runDir),\n harnessWorkerTokens: null,\n harnessMissingReason: 'Runtime FileRunContext has no external worker-token join',\n limits: sourceLimits(normalized.root, normalized.events, workerIds),\n rootTranscriptRef: (await isFile(rootStream)) ? rootStream : null,\n rootWorkspaceCaptures: transcripts.get(normalized.root)?.workspaceCaptures ?? null,\n traceCommand: nativeTraceSummary(workers, transcripts.get(normalized.root)),\n }\n}\n\n/** The agent-runtime file-backed layout as a `SupervisorRunReader`. */\nexport function runtimeSupervisorRunReader(\n runDir: string,\n opts: RuntimeReaderOptions = {},\n): SupervisorRunReader {\n return { runRef: runDir, read: () => readRuntimeSupervisorRun(runDir, opts) }\n}\n\n/**\n * True when a directory holds any file only Runtime's durable layer writes:\n * the spawn journal, the observer journal, or the failure record. A run that\n * threw before its first spawn has no journal yet and is still a Runtime run.\n */\nexport async function isRuntimeSupervisorRunDir(runDir: string): Promise<boolean> {\n for (const marker of RUNTIME_RUN_DIR_MARKERS) {\n if (await isFile(join(runDir, marker))) return true\n }\n return false\n}\n\nasync function isFile(path: string): Promise<boolean> {\n return stat(path)\n .then((entry) => entry.isFile())\n .catch((error: unknown) => {\n if (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n ((error as { code: unknown }).code === 'ENOENT' ||\n (error as { code: unknown }).code === 'ENOTDIR')\n ) {\n return false\n }\n throw error\n })\n}\n","/**\n * Runtime supervisor-run reader and report writers.\n *\n * Runtime's file-backed supervision context is the only live on-disk contract.\n * Other stores implement `SupervisorRunReader` and feed the same pure analyzer;\n * this module owns path discovery and report output for Runtime runs.\n */\n\nimport { appendFile, mkdir, readdir, writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { analyzeSupervisorRunSources } from './analyze'\nimport { renderSupervisorRunHeadline, renderSupervisorRunMarkdown } from './render'\nimport { isRuntimeSupervisorRunDir, readRuntimeSupervisorRun } from './runtime-reader'\nimport type { SupervisorRunReader, SupervisorRunReport, SupervisorRunSources } from './types'\n\n/**\n * Analyze a supervisor run. Accepts a Runtime run directory, any\n * `SupervisorRunReader`, or already-read source bytes — so a\n * caller with its own store never has to touch the filesystem layout.\n */\nexport async function analyzeSupervisorRun(\n input: string | SupervisorRunReader | SupervisorRunSources,\n): Promise<SupervisorRunReport> {\n if (typeof input === 'string') {\n return analyzeSupervisorRunSources(await readRuntimeSupervisorRun(input))\n }\n if (isReader(input)) return analyzeSupervisorRunSources(await input.read())\n return analyzeSupervisorRunSources(input)\n}\n\nfunction isReader(input: SupervisorRunReader | SupervisorRunSources): input is SupervisorRunReader {\n return typeof (input as SupervisorRunReader).read === 'function'\n}\n\nexport interface WriteSupervisorRunOptions {\n /** Append the headline block here (the experiment's run log). */\n readonly appendHeadlineTo?: string\n /** Also console.log the headline (default true). */\n readonly echo?: boolean\n /**\n * Write `run-report.{json,md}` here instead of into the run dir. Set when\n * reporting over a run directory that must stay READ-ONLY (a live run, an\n * archived generation).\n */\n readonly reportDir?: string\n}\n\n/**\n * Read a completed run, write `run-report.json` + `run-report.md` beside its\n * artifacts, and append the headline block to the run log. Never throws on a\n * missing artifact — a run that produced nothing still yields a report whose\n * every metric says why.\n */\nexport async function writeSupervisorRunReport(\n runDir: string,\n opts: WriteSupervisorRunOptions = {},\n): Promise<SupervisorRunReport> {\n const sources = await readRuntimeSupervisorRun(runDir)\n const report = analyzeSupervisorRunSources(sources)\n const md = renderSupervisorRunMarkdown(report)\n const dest = opts.reportDir ?? runDir\n const stem = opts.reportDir === undefined ? 'run-report' : supervisorReportStem(runDir)\n if (opts.reportDir !== undefined) await mkdir(opts.reportDir, { recursive: true }).catch(() => {})\n await writeFile(join(dest, `${stem}.json`), JSON.stringify(report, null, 1)).catch(() => {})\n await writeFile(join(dest, `${stem}.md`), md).catch(() => {})\n const headline = renderSupervisorRunHeadline(report)\n if (opts.appendHeadlineTo !== undefined) {\n await appendFile(opts.appendHeadlineTo, `${headline}\\n`).catch(() => {})\n }\n if (opts.echo !== false) console.log(headline)\n return report\n}\n\n/**\n * File stem for out-of-tree reports. Built from the run path's identifying\n * segments — candidate tag (the segment under `arm-runs/`), rep, instance, arm\n * — so two runs of the same instance from different candidates/reps never\n * overwrite each other.\n */\nfunction supervisorReportStem(runDir: string): string {\n const parts = runDir.split('/').filter(Boolean)\n const arm = parts[parts.length - 1] ?? 'cell'\n const iid = parts[parts.length - 2] ?? 'instance'\n const rep = parts.find((p) => /^rep-\\d+$/.test(p))\n const armRunsIdx = parts.indexOf('arm-runs')\n const tag = armRunsIdx >= 0 ? parts[armRunsIdx + 1] : undefined\n return [tag, rep, iid, arm]\n .filter((s): s is string => s !== undefined && s !== 'runs')\n .join('.')\n .replace(/[^A-Za-z0-9._-]/g, '_')\n}\n\n/**\n * Best-effort wrapper for a hot path: a reporting failure must never kill a run\n * that already produced real work. Returns null and logs the reason instead.\n */\nexport async function writeSupervisorRunReportSafe(\n runDir: string,\n opts: WriteSupervisorRunOptions = {},\n): Promise<SupervisorRunReport | null> {\n try {\n return await writeSupervisorRunReport(runDir, opts)\n } catch (err) {\n console.log(\n `RUN-REPORT failed for ${runDir}: ${err instanceof Error ? err.message : String(err)}`,\n )\n return null\n }\n}\n\n/**\n * Every Runtime supervisor run below `root`.\n *\n * When `root` itself is one run, return no children so callers can distinguish\n * a single report from a parent-directory rollup.\n */\nexport async function findSupervisorRunDirs(root: string): Promise<string[]> {\n if (await isRuntimeSupervisorRunDir(root)) {\n return []\n }\n const found: string[] = []\n const walk = async (dir: string, depth: number): Promise<void> => {\n if (depth > 8) return\n const entries = await readdir(dir, { withFileTypes: true }).catch(() => [])\n for (const e of entries) {\n if (!e.isDirectory()) continue\n if (e.name === 'node_modules' || e.name === '.git') continue\n const full = join(dir, e.name)\n if (await isRuntimeSupervisorRunDir(full)) {\n found.push(full)\n continue\n }\n await walk(full, depth + 1)\n }\n }\n await walk(root, 0)\n return found.sort()\n}\n","/**\n * `agent-eval supervisor-run report <runDir>` takes one run directory and\n * prints the report the module already renders. The command reads through\n * `analyzeSupervisorRun`, so a Runtime run directory takes the\n * same path and the status comes from the record `terminal-record.ts` names.\n *\n * Exit codes follow the other self-parsing subcommands: 2 for a usage error,\n * 1 when the directory cannot be read (missing, not a directory, or a corrupt\n * journal or terminal record), 0 after the report was written to stdout.\n */\n\nimport { stat } from 'node:fs/promises'\nimport { resolve } from 'node:path'\nimport { errorMessage } from '../errors'\nimport { analyzeSupervisorRun } from './reader'\nimport { renderSupervisorRunHeadline, renderSupervisorRunMarkdown } from './render'\n\nexport type SupervisorRunReportFormat = 'headline' | 'markdown' | 'json'\n\nconst FORMATS: readonly SupervisorRunReportFormat[] = ['headline', 'markdown', 'json']\n\nexport const SUPERVISOR_RUN_USAGE =\n 'usage: agent-eval supervisor-run report <runDir> [--format headline|markdown|json]'\n\n/** Output sinks, injectable so tests read the exact bytes a terminal would. */\nexport interface SupervisorRunCommandIo {\n readonly stdout: (text: string) => void\n readonly stderr: (text: string) => void\n}\n\nconst PROCESS_IO: SupervisorRunCommandIo = {\n stdout: (text) => {\n process.stdout.write(text)\n },\n stderr: (text) => {\n process.stderr.write(text)\n },\n}\n\ninterface ReportArgs {\n readonly runDir: string\n readonly format: SupervisorRunReportFormat\n}\n\nfunction isFormat(value: string): value is SupervisorRunReportFormat {\n return (FORMATS as readonly string[]).includes(value)\n}\n\nfunction parseReportArgs(argv: readonly string[]): ReportArgs {\n let runDir: string | null = null\n let format: SupervisorRunReportFormat = 'headline'\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i] as string\n if (arg === '--format') {\n const raw = argv[++i]\n if (raw === undefined || !isFormat(raw)) {\n throw new Error(\n `--format expects one of ${FORMATS.join('|')}, got ${JSON.stringify(raw ?? '')}`,\n )\n }\n format = raw\n } else if (arg.startsWith('--format=')) {\n const raw = arg.slice('--format='.length)\n if (!isFormat(raw)) {\n throw new Error(`--format expects one of ${FORMATS.join('|')}, got ${JSON.stringify(raw)}`)\n }\n format = raw\n } else if (arg.startsWith('--')) {\n throw new Error(`unknown flag \"${arg}\"`)\n } else if (runDir === null) {\n runDir = arg\n } else {\n throw new Error(`unexpected argument \"${arg}\"`)\n }\n }\n if (runDir === null) throw new Error(SUPERVISOR_RUN_USAGE)\n return { runDir, format }\n}\n\n/**\n * CLI driver for `agent-eval supervisor-run`. `argv` is everything after the\n * command name, so `['report', runDir, ...flags]`. Returns the process exit code.\n */\nexport async function runSupervisorRunCommand(\n argv: readonly string[],\n io: SupervisorRunCommandIo = PROCESS_IO,\n): Promise<number> {\n const [verb, ...rest] = argv\n if (verb === undefined || verb === '--help' || verb === '-h' || verb === 'help') {\n io.stdout(`${SUPERVISOR_RUN_USAGE}\\n`)\n return verb === undefined ? 2 : 0\n }\n if (verb !== 'report') {\n io.stderr(`unknown supervisor-run subcommand \"${verb}\"\\n${SUPERVISOR_RUN_USAGE}\\n`)\n return 2\n }\n if (rest.includes('--help') || rest.includes('-h')) {\n io.stdout(`${SUPERVISOR_RUN_USAGE}\\n`)\n return 0\n }\n\n let args: ReportArgs\n try {\n args = parseReportArgs(rest)\n } catch (error) {\n io.stderr(`${errorMessage(error)}\\n`)\n return 2\n }\n\n const runDir = resolve(args.runDir)\n // A path that is not a directory is a caller error, not a run with every\n // measurement missing: reporting an absent-shaped run for a typo would read\n // as evidence about a run that never existed.\n const entry = await stat(runDir).catch(() => null)\n if (entry === null || !entry.isDirectory()) {\n io.stderr(`[agent-eval] supervisor-run report: ${runDir} is not a directory\\n`)\n return 1\n }\n\n try {\n const report = await analyzeSupervisorRun(runDir)\n switch (args.format) {\n case 'headline':\n io.stdout(`${renderSupervisorRunHeadline(report)}\\n`)\n break\n case 'markdown':\n io.stdout(renderSupervisorRunMarkdown(report))\n break\n case 'json':\n io.stdout(`${JSON.stringify(report, null, 2)}\\n`)\n break\n }\n return 0\n } catch (error) {\n io.stderr(`[agent-eval] supervisor-run report failed for ${runDir}: ${errorMessage(error)}\\n`)\n return 1\n }\n}\n"],"mappings":";;;;;;;;;AAIA,SAAgB,WAAW,MAA0B;CACnD,MAAM,wBAAQ,IAAI,IAAY;CAC9B,MAAM,4BAAY,IAAI,IAAY;CAClC,IAAI,QAAQ;CACZ,IAAI,UAAU;CACd,KAAK,MAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;EACnC,IAAI,KAAK,WAAW,MAAM,GAAG;GAC3B,MAAM,IAAI,KAAK,MAAM,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O,4BAA4B,MAAM,CAAC;IAC7C;GACF,KAAK,QACH,GAAG,OAAO,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GAAG;EAEpD;EACA,OAAO;CACT,SAAS,OAAO;EACd,GAAG,OAAO,iDAAiD,OAAO,IAAI,aAAa,KAAK,EAAE,GAAG;EAC7F,OAAO;CACT;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reward-CpCmAM8L.d.ts","names":[],"sources":["../src/rollout/reward.ts"],"mappings":";;;;;;;KA2BY;;KAGP,SAAS,KAAK;;iBAGH,gBAAgB,QAAQ;;;;;;;;;;;;;;iBAiBxB,mBAAmB,QAAQ,QAAQ,OAAO;;;;;;;;;;;;;;;;iBAmB1C,cACd,QAAQ,QACR,SAAQ;;KAOE;;;;;;;iBAQI,YAAY,QAAQ,QAAQ,SAAQ,kBAA8B;;;;;;;;;iBAelE,cACd,QAAQ,QACR,SAAQ;;;;;;;;;;;;iBAiBM,eAAe,QAAQ;EAAW;EAAuB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reward-hacking-RVdZ6Kkt.d.ts","names":[],"sources":["../src/rl/verifiable-reward.ts","../src/rl/reward-hacking.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+DY,yBAAyB;UAEpB;;EAEf;;EAEA,QAAQ;;;;;;;;EAQR;;;;;;EAMA;;EAEA;;;;;;;EAOA,YAAY;;;;;;;;;;;EAWZ;;;;;;;;;;;;;;;;;;EAkBA;;UAGe;;;;;;;;EAQf;;;;EAIA,aAAa,sBAAsB;;;;;;;EAOnC;;;;;EAKA;;;;;;;;;;;;EAYA;;;;;;;;;;;;;;;iBA+Dc,wBACd,QAAQ,oBACR,OAAM,oCACL;;;;;;;;;;;;;;;;;;;;;;;iBAqGa,oCACd,MAAM,aACN,OAAM,oCACL;EAAQ;EAAe,QAAQ;;;;;;;;;;;iBA4GlB,gCACd,MAAM,aACN,OAAM,oCACL;EAAQ,KAAK;EAAW,QAAQ;;;;KC1YvB;UAMK;EACf,QAAQ;;EAER;EACA;;EAEA,QAAQ;;UAGO;EACf,UAAU;;EAEV,kBAAkB;;;;;;EAMlB;;EAEA;;EAEA;;UAGe;;;;;EAKf,MAAM;;;;;EAKN,WAAW,KAAK;;;;;;EAMhB,WAAW,KAAK;;;;;;EAMhB,qBAAqB,KAAK;;;;;EAK1B;;;;;EAKA;IAAe;IAAkB;;;;;EAIjC,0BAA0B;;iBAgBZ,oBAAoB,OAAO,2BAA2B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"rollout-DZV1t2Wg.js","names":[],"sources":["../src/rollout/interchange/harbor.ts","../src/rollout/readers/opencode-sqlite.ts"],"sourcesContent":["/**\n * Harbor ATIF-v1.7 interchange — `tangle.rollout.v1` ⇄ Agent Trajectory\n * Interchange Format.\n *\n * ATIF is the portability format (spec:\n * https://www.harborframework.com/docs/agents/trajectory-format, normative\n * RFC: harbor-framework/harbor `rfcs/0001-trajectory-format.md`). It sits\n * BELOW the waist of the rollout hourglass in both directions — export reads\n * `RolloutLine[]`, import writes `RolloutLine[]` — and it is never a source\n * of training labels:\n *\n * ATIF models NO reward, NO judge verdict, NO task/split coordinates.\n *\n * Consequences, both deliberate:\n * - EXPORT drops `outcome.reward`, `outcome.reward_source` and\n * `outcome.verdict` entirely. They are not smuggled into `extra`: a\n * third-party reading our ATIF file must not be able to mistake an\n * agent-eval judge score for something ATIF sanctioned.\n * - IMPORT therefore mints UNLABELED lines: `reward: null` (the existing\n * \"null reward is a labeled gap, never 0\" semantics), `verdict: null`,\n * and a `provenance.gap` naming the missing label. An imported\n * trajectory is not a training example until a judge scores it.\n *\n * Everything else we own that ATIF has no field for travels in a namespaced\n * escrow at `extra.tangle.*`, so our own round-trip is exact while a foreign\n * reader can ignore it. Fields that neither ATIF nor the escrow can carry\n * come back explicitly null / fail-closed, never invented.\n *\n * THE ESCROW IS NAMESPACED, NOT AUTHENTICATED. Anyone can write\n * `extra.tangle.*` into a file. So the escrow may restore what a value IS, but\n * never what a line is ALLOWED to do: `task.split` is forced to `holdout` on\n * every import regardless of what the document claims, and promoting an\n * imported trajectory to a trainable split is an explicit, greppable act\n * (`relabelImportedSplit`) rather than a property of the file. The document\n * keeps its claim — the claim just is not authority.\n *\n * Multi-agent shape differs on purpose. ATIF EMBEDS children in\n * `subagent_trajectories`; we keep a flat ledger with a normalized\n * `parent_rollout_id` edge. Export assembles the tree, import flattens it.\n * `session_id` is RUN-scoped in ATIF, so it carries `run_id` — the coordinate\n * that is shared by every invocation of one run — not `rollout_id`, which\n * identifies a single invocation and would split one run across session ids.\n *\n * ROUND-TRIPPING IS IDEMPOTENT: `import(export(import(export(x))))` is\n * byte-identical to `import(export(x))`. Import composes `provenance.gap` as a\n * de-duplicated ordered set rather than appending, and it emits every\n * `ChatMessage` with keys in the canonical schema order (role, content,\n * reasoning_content, tool_calls, tool_call_id, name, is_copied_context), so a\n * ledger hashed on serialized bytes sees no diff across further passes. The\n * FIRST import may re-order a producer's keys — that is the canonicalization.\n *\n * NOT building a Letta converter. Letta's trajectory-v1 is a strict subset of\n * what we need from ATIF here — no per-step or aggregate cost, no\n * multi-agent/subagent structure, no token-id or logprob channel — so a Letta\n * sink would carry less than this one and add a second format to keep\n * correct. Decision recorded in docs/rollout.md; do not re-litigate without a\n * concrete consumer that reads Letta and cannot read ATIF.\n */\n\nimport {\n assertRolloutLine,\n type ChatMessage,\n type ChatRole,\n type ChatToolCall,\n type GatedEvidence,\n ROLLOUT_CAPTURES,\n ROLLOUT_ROLES,\n ROLLOUT_SCHEMA,\n ROLLOUT_SPLITS,\n type RolloutArtifacts,\n type RolloutCapture,\n type RolloutCostBlock,\n type RolloutLine,\n type RolloutPolicy,\n type RolloutRole,\n type RolloutSplit,\n type RolloutStep,\n type RolloutTask,\n type ToolDef,\n} from '../schema'\n\nexport const ATIF_SCHEMA_VERSION = 'ATIF-v1.7'\n\n/** Gap note on every imported line — ATIF carries no verdict, so nothing is scored. */\nexport const HARBOR_IMPORT_GAP = 'imported from Harbor ATIF; no verdict'\n\n/** Namespaced escrow key for everything ATIF does not model but we must not lose. */\nconst ESCROW = 'tangle'\n\n/**\n * Marks a step we synthesized purely to hold tool results that answered no\n * assistant turn IN THIS DOCUMENT. ATIF has no `tool` source, so such results\n * need a carrier step; the marker lets import drop the carrier instead of\n * inventing a turn.\n *\n * A carrier's results carry NO `source_call_id`. RFC 0001 rule 2 requires every\n * `source_call_id` to match a `tool_call_id` in the same step's `tool_calls`,\n * and a carrier declares no calls (a `system` step cannot legally make one), so\n * emitting the id there would produce an invalid document. The id is escrowed\n * instead and restored verbatim on import — the link survives without the\n * document lying about who made the call.\n */\nconst TOOL_RESULTS_ONLY = 'tool-results-only'\n\n// ---------------------------------------------------------------------------\n// ATIF-v1.7 wire types (RFC 0001). Optional fields are optional here too.\n// ---------------------------------------------------------------------------\n\nexport type HarborStepSource = 'system' | 'user' | 'agent'\n\nexport interface HarborImageSource {\n media_type: string\n path: string\n}\n\nexport interface HarborContentPart {\n type: 'text' | 'image'\n text?: string\n source?: HarborImageSource\n}\n\nexport interface HarborToolCall {\n tool_call_id: string\n function_name: string\n /** ATIF requires a decoded JSON object here, unlike our raw argument string. */\n arguments: Record<string, unknown>\n extra?: Record<string, unknown>\n}\n\nexport interface HarborSubagentTrajectoryRef {\n trajectory_id?: string\n trajectory_path?: string\n /** Informational only since v1.7 — never a resolution key. */\n session_id?: string\n extra?: Record<string, unknown>\n}\n\nexport interface HarborObservationResult {\n source_call_id?: string\n content?: string | HarborContentPart[]\n subagent_trajectory_ref?: HarborSubagentTrajectoryRef[]\n extra?: Record<string, unknown>\n}\n\nexport interface HarborObservation {\n results: HarborObservationResult[]\n}\n\nexport interface HarborMetrics {\n prompt_tokens?: number\n completion_tokens?: number\n cached_tokens?: number\n cost_usd?: number\n prompt_token_ids?: number[]\n completion_token_ids?: number[]\n logprobs?: number[]\n extra?: Record<string, unknown>\n}\n\nexport interface HarborStep {\n /** Ordinal, sequential from 1. */\n step_id: number\n timestamp?: string\n source: HarborStepSource\n model_name?: string\n reasoning_effort?: string | number\n message: string | HarborContentPart[]\n reasoning_content?: string\n tool_calls?: HarborToolCall[]\n observation?: HarborObservation\n metrics?: HarborMetrics\n llm_call_count?: number\n is_copied_context?: boolean\n extra?: Record<string, unknown>\n}\n\nexport interface HarborAgent {\n name: string\n version: string\n model_name?: string\n /** OpenAI function-calling schema — byte-identical to our `ToolDef`. */\n tool_definitions?: ToolDef[]\n extra?: Record<string, unknown>\n}\n\nexport interface HarborFinalMetrics {\n total_prompt_tokens?: number\n total_completion_tokens?: number\n total_cached_tokens?: number\n total_cost_usd?: number\n total_steps?: number\n extra?: Record<string, unknown>\n}\n\nexport interface HarborTrajectory {\n schema_version: string\n session_id?: string\n /** Required on embedded subagents; we always set it so lines stay joinable. */\n trajectory_id?: string\n agent: HarborAgent\n steps: HarborStep[]\n notes?: string\n final_metrics?: HarborFinalMetrics\n continued_trajectory_ref?: string\n subagent_trajectories?: HarborTrajectory[]\n extra?: Record<string, unknown>\n}\n\n// ---------------------------------------------------------------------------\n// Shared helpers\n// ---------------------------------------------------------------------------\n\nconst isRecord = (v: unknown): v is Record<string, unknown> =>\n typeof v === 'object' && v !== null && !Array.isArray(v)\n\nconst asString = (v: unknown): string | undefined => (typeof v === 'string' ? v : undefined)\n\nconst asNumberOrNull = (v: unknown): number | null =>\n typeof v === 'number' && Number.isFinite(v) ? v : null\n\nconst asIntegerOrUndefined = (v: unknown): number | undefined =>\n Number.isInteger(v) ? (v as number) : undefined\n\nconst asNumberArray = (v: unknown): number[] | undefined =>\n Array.isArray(v) && v.every((n) => typeof n === 'number' && Number.isFinite(n))\n ? (v as number[])\n : undefined\n\nconst asIntegerArray = (v: unknown): number[] | undefined =>\n Array.isArray(v) && v.every((n) => Number.isInteger(n)) ? (v as number[]) : undefined\n\n/**\n * Builds a `ChatMessage` with keys in the schema's declaration order.\n *\n * Object key order is insertion order in JS, so a message assembled\n * conditionally field-by-field serializes differently depending on which\n * optional fields were present — which makes a byte-hashed ledger see a diff\n * across an import that changed nothing. One builder, one order, stable bytes.\n */\nfunction canonicalChatMessage(parts: {\n role: ChatRole\n content: string | null\n reasoning_content?: string\n tool_calls?: ChatToolCall[]\n tool_call_id?: string\n name?: string\n is_copied_context?: boolean\n}): ChatMessage {\n const message: ChatMessage = { role: parts.role, content: parts.content }\n if (parts.reasoning_content !== undefined) message.reasoning_content = parts.reasoning_content\n if (parts.tool_calls !== undefined) message.tool_calls = parts.tool_calls\n if (parts.tool_call_id !== undefined) message.tool_call_id = parts.tool_call_id\n if (parts.name !== undefined) message.name = parts.name\n if (parts.is_copied_context === true) message.is_copied_context = true\n return message\n}\n\n/** Reads the `extra.tangle` escrow, tolerating a foreign file that has none. */\nfunction escrowOf(extra: Record<string, unknown> | undefined): Record<string, unknown> | undefined {\n if (!isRecord(extra)) return undefined\n const value = extra[ESCROW]\n return isRecord(value) ? value : undefined\n}\n\nfunction escrowSection(\n escrow: Record<string, unknown> | undefined,\n key: string,\n): Record<string, unknown> | undefined {\n if (escrow === undefined) return undefined\n const value = escrow[key]\n return isRecord(value) ? value : undefined\n}\n\n// ---------------------------------------------------------------------------\n// Export: RolloutLine[] → ATIF trajectory tree\n// ---------------------------------------------------------------------------\n\nfunction toHarborToolCall(call: ChatToolCall): HarborToolCall {\n // ATIF requires `arguments` to be a JSON object; ours is the raw\n // JSON-encoded string the model emitted, and models really do emit\n // malformed ones. Keep the exact bytes in `extra` so import restores the\n // string verbatim instead of re-serializing a normalized parse.\n let parsed: Record<string, unknown> | undefined\n try {\n const decoded: unknown = JSON.parse(call.function.arguments)\n if (isRecord(decoded)) parsed = decoded\n } catch {\n parsed = undefined\n }\n return {\n tool_call_id: call.id,\n function_name: call.function.name,\n arguments: parsed ?? {},\n extra: { [ESCROW]: { arguments_raw: call.function.arguments } },\n }\n}\n\n/**\n * `linked` = this result is attached to the step that actually declared the\n * call, so `source_call_id` is legal (RFC 0001 rule 2). When it is not, the id\n * goes to escrow instead of onto the wire.\n */\nfunction toObservationResult(message: ChatMessage, linked: boolean): HarborObservationResult {\n const result: HarborObservationResult = {}\n if (linked && message.tool_call_id !== undefined) result.source_call_id = message.tool_call_id\n if (message.content !== null) result.content = message.content\n const escrow: Record<string, unknown> = {}\n if (!linked && message.tool_call_id !== undefined) escrow.source_call_id = message.tool_call_id\n if (message.name !== undefined) escrow.name = message.name\n // `content: null` on a tool turn is meaningful (a tool that returned\n // nothing) and is not the same as the empty string ATIF would round-trip it to.\n if (message.content === null) escrow.content_null = true\n if (message.reasoning_content !== undefined) escrow.reasoning_content = message.reasoning_content\n if (message.is_copied_context === true) escrow.is_copied_context = true\n if (Object.keys(escrow).length > 0) result.extra = { [ESCROW]: escrow }\n return result\n}\n\n/** True when `step` is the agent turn that declared `callId` — the rule-2 test. */\nfunction declaresCall(step: HarborStep, callId: string | undefined): boolean {\n if (callId === undefined) return false\n return step.tool_calls?.some((call) => call.tool_call_id === callId) === true\n}\n\n/**\n * Attaches the four RL fields lifted from ATIF onto the agent step the span\n * describes. They are ALSO escrowed with the whole span under `extra.tangle`,\n * on purpose: the escrow is how our own round-trip stays exact, and these\n * native fields are how a foreign consumer — which never reads our escrow —\n * gets the logprobs and token ids at all. A field carried only in the escrow is\n * not an interchange field.\n */\nfunction applySpanMetrics(step: HarborStep, span: RolloutStep | undefined): void {\n if (span === undefined) return\n if (span.llm_call_count !== undefined) step.llm_call_count = span.llm_call_count\n const metrics: HarborMetrics = {}\n if (span.prompt_token_ids !== undefined) metrics.prompt_token_ids = span.prompt_token_ids\n if (span.completion_token_ids !== undefined) {\n metrics.completion_token_ids = span.completion_token_ids\n }\n if (span.logprobs !== undefined) metrics.logprobs = span.logprobs\n if (Object.keys(metrics).length > 0) step.metrics = metrics\n}\n\n/**\n * Coalescing fold, not a 1:1 map: ATIF has no `tool` source, so a tool result\n * becomes an `observation.results[]` entry on the agent step THAT DECLARED ITS\n * `tool_call_id`.\n *\n * Linking by id, not by adjacency. Adjacency emitted invalid documents in three\n * shapes the RFC forbids — an assistant turn with no `tool_calls` swallowing the\n * results that followed it, a result whose id matched none of the preceding\n * step's calls, and an unanswered result riding a `system` step that carried a\n * `source_call_id` it could never declare. Attaching only to the step that owns\n * the id also preserves message order exactly: a result either joins the step\n * immediately before it or becomes its own carrier at its own position.\n *\n * `line.steps` span projections are matched to agent steps in order (k-th llm\n * span → k-th agent step) purely to fill ATIF's native per-step `metrics`;\n * extra spans on either side are simply not matched, never invented.\n */\nfunction messagesToSteps(line: RolloutLine): HarborStep[] {\n const steps: HarborStep[] = []\n const llmSpans = (line.steps ?? []).filter((span) => span.kind === 'llm')\n let nextSpan = 0\n for (const message of line.messages) {\n if (message.role === 'tool') {\n const previous = steps[steps.length - 1]\n if (previous !== undefined && declaresCall(previous, message.tool_call_id)) {\n if (previous.observation === undefined) previous.observation = { results: [] }\n previous.observation.results.push(toObservationResult(message, true))\n continue\n }\n // A tool result answering no assistant turn in this document (truncated or\n // reconstructed transcript). It still has to survive, so it rides a marked\n // carrier step whose observation states no call id.\n const carrier: HarborStep = {\n step_id: steps.length + 1,\n source: 'system',\n message: '',\n observation: { results: [toObservationResult(message, false)] },\n extra: { [ESCROW]: { synthetic: TOOL_RESULTS_ONLY } },\n }\n if (message.is_copied_context === true) carrier.is_copied_context = true\n steps.push(carrier)\n continue\n }\n const step: HarborStep = {\n step_id: steps.length + 1,\n source: message.role === 'assistant' ? 'agent' : message.role,\n message: message.content ?? '',\n }\n const escrow: Record<string, unknown> = {}\n if (message.content === null) escrow.content_null = true\n if (message.name !== undefined) escrow.name = message.name\n if (message.role === 'assistant') {\n if (line.policy.model !== null) step.model_name = line.policy.model\n if (message.reasoning_content !== undefined) {\n step.reasoning_content = message.reasoning_content\n }\n if (message.tool_calls !== undefined && message.tool_calls.length > 0) {\n step.tool_calls = message.tool_calls.map(toHarborToolCall)\n }\n applySpanMetrics(step, llmSpans[nextSpan])\n nextSpan += 1\n } else if (message.reasoning_content !== undefined) {\n // ATIF confines `reasoning_content` to agent steps; ours is not confined.\n escrow.reasoning_content = message.reasoning_content\n }\n // RFC 0001 rule 7: a copied-context turn was not authored by this agent, and\n // an SFT pipeline MUST exclude it. Native ATIF field, both directions.\n if (message.is_copied_context === true) step.is_copied_context = true\n if (Object.keys(escrow).length > 0) step.extra = { [ESCROW]: escrow }\n steps.push(step)\n }\n return steps\n}\n\nfunction finalMetricsOf(line: RolloutLine, stepCount: number): HarborFinalMetrics {\n const metrics: HarborFinalMetrics = {}\n if (line.cost.tokens_in !== null) metrics.total_prompt_tokens = line.cost.tokens_in\n if (line.cost.tokens_out !== null) metrics.total_completion_tokens = line.cost.tokens_out\n if (line.cost.cache_read !== null) metrics.total_cached_tokens = line.cost.cache_read\n // Omitted, never 0, when cost was not captured — a fake 0 is a lie about spend.\n if (line.cost.usd !== null) metrics.total_cost_usd = line.cost.usd\n metrics.total_steps = stepCount\n // ATIF has no aggregate field for these three; `reasoning_tokens` under\n // `extra` is the key the RFC's own worked example uses.\n const extra: Record<string, unknown> = {}\n if (line.cost.tokens_reasoning !== null) extra.reasoning_tokens = line.cost.tokens_reasoning\n if (line.cost.cache_write !== null) extra.cache_write_tokens = line.cost.cache_write\n if (line.cost.wall_s !== null) extra.wall_s = line.cost.wall_s\n if (line.cost.llm_call_count !== undefined && line.cost.llm_call_count !== null) {\n extra.llm_call_count = line.cost.llm_call_count\n }\n if (Object.keys(extra).length > 0) metrics.extra = extra\n return metrics\n}\n\nfunction notesOf(line: RolloutLine): string | undefined {\n const parts: string[] = []\n if (line.provenance.gap !== undefined) parts.push(line.provenance.gap)\n if (line.outcome.realness_gated === true) {\n // ATIF has no gate field. A third-party consumer that ignores `extra`\n // would otherwise see a gamed trajectory with nothing marking it, so the\n // flag is stated in prose as well. This export carries no reward at all,\n // so it is not a training-data door — but it is an audit record.\n parts.push('realness-gated: this run faked its success signal (anti-Goodhart gate fired)')\n }\n return parts.length > 0 ? parts.join(' | ') : undefined\n}\n\nfunction toTrajectoryNode(line: RolloutLine): HarborTrajectory {\n const steps = messagesToSteps(line)\n const trajectory: HarborTrajectory = {\n schema_version: ATIF_SCHEMA_VERSION,\n // RUN-scoped, per the spec — so it is `run_id`, the coordinate every\n // invocation of one run shares. `rollout_id` identifies a single\n // invocation: using it gave two roots of the same run different session\n // ids, and foreign tooling that groups by session_id would split the run.\n session_id: line.run_id,\n trajectory_id: line.rollout_id,\n agent: {\n // ATIF requires both; ours are nullable, so a null is substituted here\n // and restored on import from the escrowed policy — never guessed back.\n name: line.policy.harness ?? 'unknown',\n version: line.policy.harness_version ?? '0.0.0',\n ...(line.policy.model !== null ? { model_name: line.policy.model } : {}),\n ...(line.tool_defs.length > 0 ? { tool_definitions: line.tool_defs } : {}),\n },\n steps,\n final_metrics: finalMetricsOf(line, steps.length),\n extra: {\n [ESCROW]: {\n schema: line.schema,\n rollout_id: line.rollout_id,\n parent_rollout_id: line.parent_rollout_id,\n run_id: line.run_id,\n ...(line.experiment_id !== undefined ? { experiment_id: line.experiment_id } : {}),\n ...(line.candidate_id !== undefined ? { candidate_id: line.candidate_id } : {}),\n generation: line.generation,\n candidate_index: line.candidate_index,\n role: line.role,\n task: line.task,\n policy: line.policy,\n // Span projections overlap the same turns as `steps[]`; folding them\n // into ATIF steps would double-count the run, so they stay escrowed.\n ...(line.steps !== undefined ? { spans: line.steps } : {}),\n outcome: {\n // reward / reward_source / verdict are deliberately absent — see the\n // module header. Only the non-scalar outcome fields travel.\n metrics: line.outcome.metrics,\n is_completed: line.outcome.is_completed,\n is_truncated: line.outcome.is_truncated,\n error: line.outcome.error,\n ...(line.outcome.realness_gated !== undefined\n ? { realness_gated: line.outcome.realness_gated }\n : {}),\n },\n artifacts: line.artifacts,\n provenance: line.provenance,\n },\n },\n }\n const notes = notesOf(line)\n if (notes !== undefined) trajectory.notes = notes\n return trajectory\n}\n\ninterface Forest {\n roots: RolloutLine[]\n childrenOf: Map<string, RolloutLine[]>\n}\n\nfunction buildForest(lines: RolloutLine[]): Forest {\n const byId = new Map<string, RolloutLine>()\n for (const line of lines) {\n if (byId.has(line.rollout_id)) {\n throw new Error(`duplicate rollout_id in input: ${line.rollout_id}`)\n }\n byId.set(line.rollout_id, line)\n }\n const roots: RolloutLine[] = []\n const childrenOf = new Map<string, RolloutLine[]>()\n for (const line of lines) {\n const parent = line.parent_rollout_id\n // A parent outside this set is a root OF WHAT WE HAVE: the edge is kept in\n // escrow so a later import restores the dangling pointer instead of nulling it.\n if (parent === null || !byId.has(parent)) {\n roots.push(line)\n continue\n }\n const siblings = childrenOf.get(parent)\n if (siblings === undefined) childrenOf.set(parent, [line])\n else siblings.push(line)\n }\n // Every line has a parent inside the set: the edges form a cycle with no\n // root. Returning zero documents would drop the whole episode silently.\n if (lines.length > 0 && roots.length === 0) {\n throw new Error(\n `parent_rollout_id cycle: no root among ${lines.length} lines (${lines.map((l) => l.rollout_id).join(', ')})`,\n )\n }\n return { roots, childrenOf }\n}\n\nfunction assemble(line: RolloutLine, forest: Forest, onPath: Set<string>): HarborTrajectory {\n if (onPath.has(line.rollout_id)) {\n throw new Error(`parent_rollout_id cycle through rollout_id ${line.rollout_id}`)\n }\n onPath.add(line.rollout_id)\n const node = toTrajectoryNode(line)\n const children = forest.childrenOf.get(line.rollout_id)\n if (children !== undefined && children.length > 0) {\n node.subagent_trajectories = children.map((child) => assemble(child, forest, onPath))\n }\n onPath.delete(line.rollout_id)\n return node\n}\n\n/**\n * Assemble one episode's flat lines into a single ATIF trajectory tree,\n * linked by `parent_rollout_id`.\n *\n * Reward, verdict and split are NOT emitted (ATIF models none of them); the\n * split and the rest of the task coordinates survive only in `extra.tangle`.\n *\n * We deliberately do NOT synthesize an `observation.subagent_trajectory_ref`\n * pointing at each child: our ledger records WHICH invocation spawned a\n * worker, not which STEP did, and attaching the ref to a guessed step would\n * fabricate a causal claim. Children are embedded in `subagent_trajectories`\n * (each with the `trajectory_id` the spec requires) and the edge is stated in\n * the child's escrowed `parent_rollout_id`.\n *\n * Throws when the lines are not one tree — use `toHarborTrajectories` for a forest.\n */\nexport function toHarborTrajectory(lines: RolloutLine[]): HarborTrajectory {\n const trees = toHarborTrajectories(lines)\n if (trees.length === 0) throw new Error('toHarborTrajectory: no lines')\n if (trees.length > 1) {\n const ids = trees.map((t) => t.trajectory_id ?? '?').join(', ')\n throw new Error(\n `toHarborTrajectory: ${trees.length} roots (${ids}) — ATIF is one tree per document; use toHarborTrajectories`,\n )\n }\n return trees[0]!\n}\n\n/** Every independent tree in the input, one ATIF document each. */\nexport function toHarborTrajectories(lines: RolloutLine[]): HarborTrajectory[] {\n const forest = buildForest(lines)\n return forest.roots.map((root) => assemble(root, forest, new Set()))\n}\n\n// ---------------------------------------------------------------------------\n// Import: ATIF trajectory tree → RolloutLine[]\n// ---------------------------------------------------------------------------\n\nfunction contentToString(message: string | HarborContentPart[]): string {\n if (typeof message === 'string') return message\n return message\n .map((part) =>\n part.type === 'image'\n ? // Our chat content is text-only. Describing the image is honest about\n // what the source held; dropping it silently would not be.\n `[image ${part.source?.media_type ?? 'unknown'} ${part.source?.path ?? ''}]`.trim()\n : (part.text ?? ''),\n )\n .join('\\n')\n}\n\nfunction fromHarborToolCall(call: HarborToolCall): ChatToolCall {\n const raw = asString(escrowOf(call.extra)?.arguments_raw)\n return {\n id: call.tool_call_id,\n type: 'function',\n function: { name: call.function_name, arguments: raw ?? JSON.stringify(call.arguments ?? {}) },\n }\n}\n\nfunction fromObservationResult(\n result: HarborObservationResult,\n callId: string | undefined,\n): ChatMessage {\n const escrow = escrowOf(result.extra)\n return canonicalChatMessage({\n role: 'tool',\n content:\n escrow?.content_null === true\n ? null\n : result.content === undefined\n ? ''\n : contentToString(result.content),\n reasoning_content: asString(escrow?.reasoning_content),\n tool_call_id: callId,\n name: asString(escrow?.name),\n is_copied_context: escrow?.is_copied_context === true,\n })\n}\n\nfunction stepsToMessages(steps: HarborStep[]): ChatMessage[] {\n const messages: ChatMessage[] = []\n for (const step of steps) {\n const escrow = escrowOf(step.extra)\n const carrierOnly = escrow?.synthetic === TOOL_RESULTS_ONLY\n if (!carrierOnly) {\n messages.push(\n canonicalChatMessage({\n role: step.source === 'agent' ? 'assistant' : step.source,\n content: escrow?.content_null === true ? null : contentToString(step.message),\n reasoning_content: step.reasoning_content ?? asString(escrow?.reasoning_content),\n tool_calls:\n step.tool_calls !== undefined && step.tool_calls.length > 0\n ? step.tool_calls.map(fromHarborToolCall)\n : undefined,\n name: asString(escrow?.name),\n is_copied_context: step.is_copied_context === true,\n }),\n )\n }\n for (const result of step.observation?.results ?? []) {\n const resultEscrow = escrowOf(result.extra)\n const callId = result.source_call_id ?? asString(resultEscrow?.source_call_id)\n if (carrierOnly) {\n // Our own carrier: every result on it was a tool turn, and its call id\n // (if the transcript had one) is in escrow, not on the wire.\n messages.push(fromObservationResult(result, callId))\n continue\n }\n if (typeof callId === 'string') {\n messages.push(fromObservationResult(result, callId))\n continue\n }\n // ATIF allows a result from a non-tool-calling action. Our chat schema\n // requires `tool_call_id` on a tool turn, so inventing one would forge a\n // link; the text is preserved as a system observation instead.\n if (result.content !== undefined) {\n messages.push(\n canonicalChatMessage({ role: 'system', content: contentToString(result.content) }),\n )\n }\n }\n }\n return messages\n}\n\nfunction taskFrom(escrow: Record<string, unknown> | undefined, fallbackId: string): RolloutTask {\n const task = escrowSection(escrow, 'task')\n return {\n suite: asString(task?.suite) ?? 'harbor-atif-import',\n instance_id: asString(task?.instance_id) ?? fallbackId,\n // ALWAYS holdout — the escrowed claim is read for nothing here.\n //\n // `extra.tangle.task.split` is a namespaced key, not an authenticated one:\n // a hand-written or third-party document can set `split: 'search'` as\n // easily as our own exporter can, and honouring it made \"this file says so\"\n // sufficient to walk into a training export. Trainability is a decision\n // about a file, so it is made by an operator through\n // `relabelImportedSplit`, never by the file about itself. The claim is not\n // destroyed — it stays readable in the source document.\n split: 'holdout',\n seed: asNumberOrNull(task?.seed),\n rep: asIntegerOrUndefined(task?.rep) ?? 0,\n }\n}\n\nfunction policyFrom(\n escrow: Record<string, unknown> | undefined,\n agent: HarborAgent,\n): RolloutPolicy {\n const escrowed = escrowSection(escrow, 'policy')\n if (escrowed !== undefined) {\n // Our own export: restore verbatim, including the nulls ATIF forced us to\n // substitute placeholders for in `agent.name` / `agent.version`.\n return {\n harness: asString(escrowed.harness) ?? null,\n harness_version: asString(escrowed.harness_version) ?? null,\n model: asString(escrowed.model) ?? null,\n provider: asString(escrowed.provider) ?? null,\n profile_commit: asString(escrowed.profile_commit) ?? null,\n ...(escrowed.prompt_hash !== undefined\n ? { prompt_hash: asString(escrowed.prompt_hash) ?? null }\n : {}),\n ...(escrowed.config_hash !== undefined\n ? { config_hash: asString(escrowed.config_hash) ?? null }\n : {}),\n ...(escrowed.agent_profile_cell_id !== undefined\n ? { agent_profile_cell_id: asString(escrowed.agent_profile_cell_id) ?? null }\n : {}),\n sampling: isRecord(escrowed.sampling) ? escrowed.sampling : null,\n }\n }\n return {\n harness: agent.name,\n harness_version: agent.version,\n model: agent.model_name ?? null,\n provider: null,\n profile_commit: null,\n sampling: null,\n }\n}\n\nfunction artifactsFrom(escrow: Record<string, unknown> | undefined): RolloutArtifacts {\n const artifacts = escrowSection(escrow, 'artifacts')\n return {\n patch_path: asString(artifacts?.patch_path) ?? null,\n run_dir: asString(artifacts?.run_dir) ?? null,\n transcript_ref: asString(artifacts?.transcript_ref) ?? null,\n }\n}\n\nfunction costFrom(final: HarborFinalMetrics | undefined): RolloutCostBlock {\n const rawExtra = final?.extra\n const extra = isRecord(rawExtra) ? rawExtra : undefined\n const calls = asIntegerOrUndefined(extra?.llm_call_count)\n return {\n usd: asNumberOrNull(final?.total_cost_usd),\n tokens_in: asNumberOrNull(final?.total_prompt_tokens),\n tokens_out: asNumberOrNull(final?.total_completion_tokens),\n tokens_reasoning: asNumberOrNull(extra?.reasoning_tokens),\n cache_read: asNumberOrNull(final?.total_cached_tokens),\n cache_write: asNumberOrNull(extra?.cache_write_tokens),\n wall_s: asNumberOrNull(extra?.wall_s),\n ...(calls !== undefined ? { llm_call_count: calls } : {}),\n }\n}\n\n/**\n * Recovers span projections from ATIF's NATIVE per-step channel, for documents\n * with no `extra.tangle.spans` escrow — i.e. everything a foreign producer\n * writes. Without this the logprobs and token ids a Harbor-native trainer\n * records would be read, validated, and then dropped on the floor.\n *\n * Only steps that actually carry one of the four fields produce a span: an\n * agent step with no metrics means \"not captured\", and inventing an empty span\n * for it would claim the run had a shape we did not observe.\n */\nfunction spansFromSteps(steps: HarborStep[]): RolloutStep[] {\n const spans: RolloutStep[] = []\n for (const step of steps) {\n if (step.source !== 'agent') continue\n const calls = asIntegerOrUndefined(step.llm_call_count)\n const promptIds = asIntegerArray(step.metrics?.prompt_token_ids)\n const completionIds = asIntegerArray(step.metrics?.completion_token_ids)\n const logprobs = asNumberArray(step.metrics?.logprobs)\n if (\n calls === undefined &&\n promptIds === undefined &&\n completionIds === undefined &&\n logprobs === undefined\n ) {\n continue\n }\n spans.push({\n kind: 'llm',\n name: step.model_name ?? 'chat',\n ...(calls !== undefined ? { llm_call_count: calls } : {}),\n ...(promptIds !== undefined ? { prompt_token_ids: promptIds } : {}),\n ...(completionIds !== undefined ? { completion_token_ids: completionIds } : {}),\n ...(logprobs !== undefined ? { logprobs } : {}),\n })\n }\n return spans\n}\n\n/**\n * Composes `provenance.gap` as an ordered SET of reasons.\n *\n * Appending made the note accrete on every pass (\"…no verdict | …no verdict\"),\n * which both grows without bound and breaks byte-level idempotency for a ledger\n * hashed on its serialized lines.\n */\nfunction composeGap(escrowedGap: string | undefined, added: readonly string[]): string {\n const parts: string[] = []\n const seen = new Set<string>()\n for (const raw of [...(escrowedGap?.split(' | ') ?? []), ...added]) {\n const reason = raw.trim()\n if (reason.length === 0 || seen.has(reason)) continue\n seen.add(reason)\n parts.push(reason)\n }\n return parts.join(' | ')\n}\n\nexport interface FromHarborOptions {\n /** Injected clock for deterministic output when the source carries no capture time. */\n now?: () => Date\n}\n\nfunction nodeToLine(\n trajectory: HarborTrajectory,\n parentId: string | null,\n capturedAt: string,\n): RolloutLine {\n const escrow = escrowOf(trajectory.extra)\n const rolloutId =\n asString(escrow?.rollout_id) ?? trajectory.trajectory_id ?? trajectory.session_id\n if (rolloutId === undefined || rolloutId.length === 0) {\n throw new Error(\n 'fromHarborTrajectory: trajectory has no trajectory_id or session_id — cannot mint a joinable rollout_id without inventing one',\n )\n }\n const outcome = escrowSection(escrow, 'outcome')\n const provenance = escrowSection(escrow, 'provenance')\n const capture = provenance?.capture\n const escrowedGap = asString(provenance?.gap)\n const role = escrow?.role\n const escrowedSpans = escrow?.spans\n // The escrow wins when it exists (our own export: exact, including an empty\n // array, which claims \"captured, none\" rather than \"not captured\"), and the\n // native per-step channel is the fallback (a foreign export: still signal).\n const nativeSpans = spansFromSteps(trajectory.steps)\n const spans: RolloutStep[] | undefined = Array.isArray(escrowedSpans)\n ? (escrowedSpans as RolloutStep[])\n : nativeSpans.length > 0\n ? nativeSpans\n : undefined\n const messages = stepsToMessages(trajectory.steps)\n const line: RolloutLine = {\n schema: ROLLOUT_SCHEMA,\n rollout_id: rolloutId,\n // The tree edge wins for embedded children; for a root, the escrowed\n // pointer may reference a line outside this document and is preserved.\n parent_rollout_id: parentId ?? asString(escrow?.parent_rollout_id) ?? null,\n run_id: asString(escrow?.run_id) ?? trajectory.session_id ?? rolloutId,\n // Required keys on the wire (0.127.0): a foreign document that never\n // stated them imports as explicit `null`, not as an absent field.\n experiment_id: asString(escrow?.experiment_id) ?? null,\n candidate_id: asString(escrow?.candidate_id) ?? null,\n generation: asIntegerOrUndefined(escrow?.generation) ?? null,\n candidate_index: asIntegerOrUndefined(escrow?.candidate_index) ?? null,\n role: ROLLOUT_ROLES.includes(role as RolloutRole) ? (role as RolloutRole) : 'agent',\n task: taskFrom(escrow, rolloutId),\n policy: policyFrom(escrow, trajectory.agent),\n messages,\n tool_defs: trajectory.agent.tool_definitions ?? [],\n ...(spans !== undefined ? { steps: spans } : {}),\n outcome: {\n // ATIF carries no label. Null is the labeled gap; a 0 here would be a\n // fabricated failure and a 1 a fabricated success.\n reward: null,\n reward_source: null,\n verdict: null,\n metrics: isRecord(outcome?.metrics) ? outcome.metrics : {},\n is_completed: typeof outcome?.is_completed === 'boolean' ? outcome.is_completed : true,\n is_truncated:\n typeof outcome?.is_truncated === 'boolean'\n ? outcome.is_truncated\n : trajectory.continued_trajectory_ref !== undefined,\n error: asString(outcome?.error) ?? null,\n // The anti-Goodhart flag is restored when the source document stated\n // it; the wire schema requires the field, so a document that never did\n // imports as `false`. That is safe here because the reward is already\n // forced to `null` (not trainable) and `realness_screened` stays\n // absent = unknown rather than claiming a screen ran.\n realness_gated: outcome?.realness_gated === true,\n },\n cost: costFrom(trajectory.final_metrics),\n artifacts: artifactsFrom(escrow),\n provenance: {\n captured_at: asString(provenance?.captured_at) ?? capturedAt,\n capture: ROLLOUT_CAPTURES.includes(capture as RolloutCapture)\n ? (capture as RolloutCapture)\n : 'backfill',\n gap: composeGap(escrowedGap, [HARBOR_IMPORT_GAP]),\n // Restored for the same reason `realness_gated` is, and with the opposite\n // risk profile from the reward: this is the gated run's own measurement\n // bag, moved off `outcome` by `gateGamedOutcome` so no exporter reads it\n // as training input. Dropping it here would silently destroy the audit\n // trail that says WHY the run was flagged and what it claimed, on the one\n // population an auditor most wants to inspect. It cannot be fail-open —\n // nothing projects `provenance` into a training row.\n ...(isRecord(provenance?.gated_evidence)\n ? { gated_evidence: provenance.gated_evidence as GatedEvidence }\n : {}),\n },\n }\n assertRolloutLine(line, `rollout line imported from ATIF trajectory ${rolloutId}`)\n return line\n}\n\n/**\n * Flatten an ATIF trajectory tree back into `tangle.rollout.v1` lines, parent\n * first, each child carrying `parent_rollout_id`.\n *\n * Every line comes back UNLABELED: `reward`, `reward_source` and `verdict` are\n * null and `provenance.gap` says why. ATIF models no verdict, so scoring an\n * imported trajectory is a judge's job, not this function's. Every line lands\n * on `holdout` whatever the document claims — see `relabelImportedSplit`.\n */\nexport function fromHarborTrajectory(\n trajectory: HarborTrajectory,\n options: FromHarborOptions = {},\n): RolloutLine[] {\n const capturedAt = (options.now?.() ?? new Date()).toISOString()\n const lines: RolloutLine[] = []\n const walk = (node: HarborTrajectory, parentId: string | null, onPath: Set<string>): void => {\n const line = nodeToLine(node, parentId, capturedAt)\n if (onPath.has(line.rollout_id)) {\n throw new Error(`subagent_trajectories cycle through trajectory_id ${line.rollout_id}`)\n }\n onPath.add(line.rollout_id)\n lines.push(line)\n for (const child of node.subagent_trajectories ?? []) {\n walk(child, line.rollout_id, onPath)\n }\n onPath.delete(line.rollout_id)\n }\n walk(trajectory, null, new Set())\n return lines\n}\n\n/**\n * THE explicit door out of `holdout` for imported lines.\n *\n * Import forces `holdout` because a document's own claim about its split is not\n * evidence — anyone can write `extra.tangle.task.split`. Promoting a file to a\n * trainable split is an operator's decision about provenance they verified, so\n * it is a separate, greppable call: `grep relabelImportedSplit` enumerates\n * every place foreign data was declared trainable, which is exactly the audit\n * the trusted-escrow version made impossible.\n *\n * Returns plain `RolloutLine`s. They still have to pass `assertMinted` (and its\n * anti-Goodhart check) to reach an exporter — re-labeling a split is not\n * minting a reward.\n */\nexport function relabelImportedSplit(\n lines: readonly RolloutLine[],\n split: RolloutSplit,\n): RolloutLine[] {\n if (!ROLLOUT_SPLITS.includes(split)) {\n throw new Error(`relabelImportedSplit: unknown split ${String(split)}`)\n }\n return lines.map((line) => ({ ...line, task: { ...line.task, split } }))\n}\n","/**\n * OpenCode's SQLite store (~/.local/share/opencode/opencode.db) as canonical chat-with-tools\n * messages, through @tangle-network/harness-sessions: the one reader of harness sessions shared\n * with Discovery, agent-record, traces and the blog. The store is read from a private copy, never\n * in place, and a tool part that errored or never finished is read as what it is rather than\n * refused.\n */\n\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport {\n type HarnessSession,\n opencodeReader,\n opencodeSessionsInStore,\n type SessionRef,\n toChatMessages,\n} from '@tangle-network/harness-sessions'\nimport type { ChatMessage } from '../schema'\n\nexport const DEFAULT_OPENCODE_DB = join(homedir(), '.local', 'share', 'opencode', 'opencode.db')\n\n/** Sessions whose cwd is `directory` (the worker-clone join key), oldest first. */\nexport async function findOpencodeSessionsByDirectory(\n directory: string,\n db: string = DEFAULT_OPENCODE_DB,\n): Promise<SessionRef[]> {\n const refs = await opencodeSessionsInStore(db, null, { cwd: directory })\n return refs.filter((ref) => ref.cwd === directory).reverse()\n}\n\n/** One session, normalized. */\nexport async function readOpencodeSession(\n sessionId: string,\n db: string = DEFAULT_OPENCODE_DB,\n): Promise<HarnessSession> {\n const [ref] = await opencodeSessionsInStore(db, null, { nativeSessionId: sessionId })\n if (ref === undefined) throw new Error(`OpenCode session ${sessionId} is not in ${db}`)\n return opencodeReader.read(ref)\n}\n\n/** One session's canonical messages: each model step, then the results of its tool calls. */\nexport async function readOpencodeSessionMessages(\n sessionId: string,\n db: string = DEFAULT_OPENCODE_DB,\n): Promise<ChatMessage[]> {\n return toChatMessages(await readOpencodeSession(sessionId, db))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,MAAa,sBAAsB;;AAGnC,MAAa,oBAAoB;;AAGjC,MAAM,SAAS;;;;;;;;;;;;;;AAef,MAAM,oBAAoB;AA8G1B,MAAM,YAAY,MAChB,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAEzD,MAAM,YAAY,MAAoC,OAAO,MAAM,WAAW,IAAI,KAAA;AAElF,MAAM,kBAAkB,MACtB,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,IAAI,IAAI;AAEpD,MAAM,wBAAwB,MAC5B,OAAO,UAAU,CAAC,IAAK,IAAe,KAAA;AAExC,MAAM,iBAAiB,MACrB,MAAM,QAAQ,CAAC,KAAK,EAAE,OAAO,MAAM,OAAO,MAAM,YAAY,OAAO,SAAS,CAAC,CAAC,IACzE,IACD,KAAA;AAEN,MAAM,kBAAkB,MACtB,MAAM,QAAQ,CAAC,KAAK,EAAE,OAAO,MAAM,OAAO,UAAU,CAAC,CA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;EACT,YAAY,iBAAiB;;;;;;;iBAWf,kBAAkB,iBAAiB;;iBA2SnC,YAAY,iBAAiB,SAAS;;iBAUtC,mBACd;EACG;EAAU,OAAO;;EAAgB;EAAW,OAAO;;;;;;;;iBA2FxC,iBAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-record-C5e7FjhJ.js","names":[],"sources":["../src/campaign/run-record.ts"],"sourcesContent":["import type { AgentProfileCell } from '../agent-profile-cell'\nimport type { CostProvenance } from '../cost-ledger'\nimport type {\n JudgeScoresRecord,\n RunCostProvenance,\n RunOutcome,\n RunRecord,\n RunSearchCoordinates,\n RunSplitTag,\n RunTerminalOutcome,\n RunTraceRef,\n} from '../run-record'\nimport { validateRunRecord } from '../run-record'\nimport { mean } from '../statistics/mean'\nimport type { CampaignCellResult, JudgeScore } from './types'\n\nexport interface CampaignCellRunRecordOptions {\n /** With `search`, this must be `searchCellRunId(search)`. */\n runId: string\n experimentId: string\n candidateId: string\n model: string\n promptHash: string\n configHash: string\n commitSha: string\n splitTag: RunSplitTag\n seed?: number\n scenarioId?: string\n /** Estimated total for a cell that proved no spend at all. A cell that\n * proved part of its spend keeps that floor instead. */\n defaultCostUsd?: number\n agentProfile?: AgentProfileCell\n raw?: Record<string, number>\n search?: RunSearchCoordinates\n traceRef?: RunTraceRef\n}\n\nexport interface CampaignCellQualityProjection {\n score?: number\n judgeScores?: JudgeScoresRecord\n successfulJudgeScores: Record<string, JudgeScore>\n failedJudges: string[]\n raw: Record<string, number>\n}\n\n/**\n * A campaign cell carried a judge score without a `dimensions` record.\n *\n * Two exported types share the name `JudgeScore`: the campaign verdict\n * (`{ dimensions, composite, notes }` from `@tangle-network/agent-eval/campaign`)\n * and the root export's flat per-dimension row (`{ judgeName, dimension, score }`\n * from `@tangle-network/agent-eval`). Campaign aggregation accepts only the\n * campaign shape; the flat shape previously crashed here with an opaque\n * TypeError deep inside aggregation.\n */\nexport class CampaignJudgeScoreShapeError extends TypeError {\n constructor(judgeName: string) {\n super(\n `campaign cell judge '${judgeName}' carries a score without a 'dimensions' record. ` +\n `Use the campaign JudgeScore ({ dimensions, composite, notes }) from ` +\n `'@tangle-network/agent-eval/campaign'; the root export's JudgeScore ` +\n `({ judgeName, dimension, score }) is a different type with the same name.`,\n )\n this.name = 'CampaignJudgeScoreShapeError'\n }\n}\n\nexport interface CampaignCellExecutionEvidence {\n terminalOutcome: RunTerminalOutcome\n executionErrorCount?: number\n judgeErrorCount?: number\n unclassifiedErrorCount?: number\n terminalFailureReason?: string\n}\n\n/**\n * Project one campaign cell into the canonical run format.\n *\n * A dispatch error establishes terminal execution failure. A judge error only\n * establishes that quality measurement failed after dispatch completed.\n * Failures without a stage remain unknown. No failure becomes a zero-quality\n * label.\n */\nexport function campaignCellToRunRecord<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n options: CampaignCellRunRecordOptions,\n): RunRecord {\n const quality = projectCampaignCellQuality(cell)\n const execution = campaignCellExecutionEvidence(cell)\n const judgeErrorCount = Math.max(\n quality.raw.judge_error_count ?? 0,\n execution.judgeErrorCount ?? 0,\n )\n const costProvenance = campaignCellRunCostProvenance(cell, options.defaultCostUsd)\n const costUsd = costProvenance.usd\n const raw: Record<string, number> = {\n ...finiteMetrics(options.raw),\n ...quality.raw,\n rep: cell.rep,\n duration_ms: cell.durationMs,\n ...(costUsd === null ? {} : { cost_usd: costUsd }),\n tokens_input: cell.tokenUsage.input,\n tokens_output: cell.tokenUsage.output,\n tokens_known: cell.tokenUsage.tokensKnown === false ? 0 : 1,\n latency_ms: cell.durationMs,\n ...(execution.executionErrorCount === undefined\n ? {}\n : { execution_error_count: execution.executionErrorCount }),\n ...(judgeErrorCount > 0 ? { judge_error_count: judgeErrorCount } : {}),\n ...(execution.unclassifiedErrorCount === undefined\n ? {}\n : { unclassified_error_count: execution.unclassifiedErrorCount }),\n }\n if (typeof cell.generation === 'number') raw.generation = cell.generation\n if (cell.tokenUsage.reasoning !== undefined) {\n raw.tokens_reasoning = cell.tokenUsage.reasoning\n }\n if (cell.tokenUsage.cached !== undefined) raw.tokens_cached = cell.tokenUsage.cached\n if (cell.tokenUsage.cacheWrite !== undefined) {\n raw.tokens_cache_write = cell.tokenUsage.cacheWrite\n }\n if (cell.tokenUsage.tokensKnown !== false && costUsd !== null && costUsd > 0) {\n raw.tokens_per_dollar = (cell.tokenUsage.input + cell.tokenUsage.output) / costUsd\n }\n if (costUsd !== null && quality.score !== undefined && quality.score > 0.01) {\n raw.cost_per_quality = costUsd / quality.score\n }\n\n const outcome: RunOutcome = {\n raw,\n ...(quality.judgeScores ? { judgeScores: quality.judgeScores } : {}),\n }\n if (quality.score !== undefined) {\n if (options.splitTag === 'holdout') outcome.holdoutScore = quality.score\n else outcome.searchScore = quality.score\n }\n\n return validateRunRecord({\n runId: options.runId,\n experimentId: options.experimentId,\n candidateId: options.candidateId,\n seed: options.seed ?? cell.seed,\n model: options.model,\n promptHash: options.promptHash,\n configHash: options.configHash,\n commitSha: options.commitSha,\n wallMs: cell.durationMs,\n costUsd,\n costProvenance,\n tokenUsage: { ...cell.tokenUsage },\n terminalOutcome: execution.terminalOutcome,\n ...(execution.terminalFailureReason\n ? { terminalFailureReason: execution.terminalFailureReason }\n : {}),\n outcome,\n splitTag: options.splitTag,\n scenarioId: options.scenarioId ?? cell.scenarioId,\n ...(options.agentProfile ? { agentProfile: options.agentProfile } : {}),\n ...(options.search ? { search: options.search } : {}),\n ...(options.traceRef ? { traceRef: options.traceRef } : {}),\n })\n}\n\n/**\n * A cell's cost as a RunRecord states it. An uncaptured cell's `costUsd` is\n * the spend its receipts proved, so a positive one is the run's floor. The\n * caller's `defaultCostUsd` stands in only when nothing was proved: a proven\n * floor is never replaced by a guess.\n */\nfunction campaignCellRunCostProvenance<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n defaultCostUsd: number | undefined,\n): RunCostProvenance {\n const provenance = campaignCellCostProvenance(cell)\n if (provenance.kind !== 'uncaptured') return provenance\n if (cell.costUsd > 0) return { kind: 'lower-bound', usd: null, knownLowerBoundUsd: cell.costUsd }\n return defaultCostUsd === undefined ? provenance : { kind: 'estimated', usd: defaultCostUsd }\n}\n\n/**\n * Validate the cost fields that cross campaign cache and RunRecord boundaries.\n * `costUsd` is a known subtotal for uncaptured cells, but it must equal the\n * authoritative total whenever that total is observed or estimated.\n */\nexport function campaignCellCostProvenance<TArtifact>(\n cell: Pick<CampaignCellResult<TArtifact>, 'cellId' | 'costUsd' | 'costProvenance'>,\n): CostProvenance {\n if (!Number.isFinite(cell.costUsd) || cell.costUsd < 0) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid costUsd`)\n }\n const provenance = cell.costProvenance\n if (!provenance || typeof provenance !== 'object') {\n throw new Error(`campaign cell '${cell.cellId}' has no costProvenance`)\n }\n if (provenance.kind === 'uncaptured') {\n if (provenance.usd !== null) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid uncaptured costProvenance`)\n }\n return { kind: 'uncaptured', usd: null }\n }\n if (\n (provenance.kind !== 'observed' && provenance.kind !== 'estimated') ||\n !Number.isFinite(provenance.usd) ||\n provenance.usd < 0\n ) {\n throw new Error(`campaign cell '${cell.cellId}' has invalid costProvenance`)\n }\n if (provenance.usd !== cell.costUsd) {\n throw new Error(`campaign cell '${cell.cellId}' has costUsd inconsistent with costProvenance`)\n }\n return { kind: provenance.kind, usd: provenance.usd }\n}\n\nexport function campaignCellExecutionEvidence<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n): CampaignCellExecutionEvidence {\n if (cell.errorStage === 'dispatch') {\n return {\n terminalOutcome: 'failed',\n executionErrorCount: 1,\n ...(cell.error ? { terminalFailureReason: cell.error } : {}),\n }\n }\n if (cell.errorStage === 'judge') {\n return {\n terminalOutcome: 'succeeded',\n executionErrorCount: 0,\n judgeErrorCount: 1,\n }\n }\n if (!cell.error) {\n return { terminalOutcome: 'succeeded', executionErrorCount: 0 }\n }\n return {\n terminalOutcome: 'unknown',\n unclassifiedErrorCount: 1,\n }\n}\n\n/**\n * Produce the only task-quality view used by campaign aggregates and exports.\n *\n * Successful judge results remain available for diagnosis after another judge\n * fails, but a task score exists only for an error-free cell whose reported\n * judge values are all finite.\n */\nexport function projectCampaignCellQuality<TArtifact>(\n cell: CampaignCellResult<TArtifact>,\n): CampaignCellQualityProjection {\n if (cell.errorStage === 'dispatch') {\n return { successfulJudgeScores: {}, failedJudges: [], raw: {} }\n }\n\n const perJudge: Record<string, Record<string, number>> = {}\n const successfulJudgeScores: Record<string, JudgeScore> = {}\n const dimensionValues = new Map<string, number[]>()\n const composites: number[] = []\n const notes: string[] = []\n const failedJudges = new Set<string>(\n cell.errorStage === 'judge' ? [cell.errorJudge ?? 'unknown-judge'] : [],\n )\n const raw: Record<string, number> = {}\n\n for (const [judgeName, score] of Object.entries(cell.judgeScores)) {\n const dimensionsShape = (score as { dimensions?: unknown }).dimensions\n if (\n typeof dimensionsShape !== 'object' ||\n dimensionsShape === null ||\n Array.isArray(dimensionsShape)\n ) {\n throw new CampaignJudgeScoreShapeError(judgeName)\n }\n const finiteDimensions = Object.values(score.dimensions).every(Number.isFinite)\n if (score.failed || !Number.isFinite(score.composite) || !finiteDimensions) {\n failedJudges.add(judgeName)\n continue\n }\n\n composites.push(score.composite)\n successfulJudgeScores[judgeName] = score\n const dimensions = { ...score.dimensions }\n perJudge[judgeName] = dimensions\n for (const [dimension, value] of Object.entries(dimensions)) {\n raw[`${judgeName}.${dimension}`] = value\n const values = dimensionValues.get(dimension) ?? []\n values.push(value)\n dimensionValues.set(dimension, values)\n }\n if (score.notes) notes.push(`${judgeName}: ${score.notes}`)\n for (const failedJudge of score.failedJudges ?? []) {\n failedJudges.add(`${judgeName}/${failedJudge}`)\n }\n }\n\n if (failedJudges.size > 0) raw.judge_error_count = failedJudges.size\n const sortedFailedJudges = [...failedJudges].sort()\n if (composites.length === 0) {\n return {\n successfulJudgeScores,\n failedJudges: sortedFailedJudges,\n raw,\n }\n }\n\n const composite = mean(composites)\n const perDimMean = Object.fromEntries(\n [...dimensionValues.entries()].map(([dimension, values]) => [dimension, mean(values)]),\n )\n const complete =\n cell.error === undefined && cell.errorStage === undefined && failedJudges.size === 0\n if (complete) raw.composite = composite\n\n return {\n ...(complete ? { score: composite } : {}),\n raw,\n successfulJudgeScores,\n failedJudges: sortedFailedJudges,\n judgeScores: {\n perJudge,\n perDimMean,\n composite,\n ...(sortedFailedJudges.length > 0 ? { failedJudges: sortedFailedJudges } : {}),\n ...(notes.length > 0 ? { notes: notes.join(' | ') } : {}),\n },\n }\n}\n\nfunction finiteMetrics(metrics: Record<string, number> | undefined): Record<string, number> {\n const finite: Record<string, number> = {}\n for (const [key, value] of Object.entries(metrics ?? {})) {\n if (Number.isFinite(value)) finite[key] = value\n }\n return finite\n}\n"],"mappings":";;;;;;;;;;;;;AAuDA,IAAa,+BAAb,cAAkD,UAAU;CAC1D,YAAY,WAAmB;EAC7B,MACE,wBAAwB,UAAU,mQAIpC;EACA,KAAK,OAAO;CACd;AACF;;;;;;;;;AAkBA,SAAgB,wBACd,MACA,SACW;CACX,MAAM,UAAU,2BAA2B,IAAI;CAC/C,MAAM,YAAY,8BAA8B,IAAI;CACpD,MAAM,kBAAkB,KAAK,IAC3B,QAAQ,IAAI,qBAAqB,GACjC,UAAU,mBAAmB,CAC/B;CACA,MAAM,iBAAiB,8BAA8B,MAAM,QAAQ,cAAc;CACjF,MAAM,UAAU,eAAe;CAC/B,MAAM,MAA8B;EAClC,GAAG,cAAc,QAAQ,GAAG;EAC5B,GAAG,QAAQ;EACX,KAAK,KAAK;EACV,aAAa,KAAK;EAClB,GAAI,YAAY,OAAO,CAAC,IAAI,EAAE,UAAU,QAAQ;EAChD,cAAc,KAAK,WAAW;EAC9B,eAAe,KAAK,WAAW;EAC/B,cAAc,KAAK,WAAW,gBAAgB,QAAQ,IAAI;EAC1D,YAAY,KAAK;EACjB,GAAI,UAAU,wBAAwB,KAAA,IAClC,CAAC,IACD,EAAE,uBAAuB,UAAU,oBAAoB;EAC3D,GAAI,kBAAkB,IAAI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 -1 +0,0 @@
1
- {"version":3,"file":"schema-2g7trUwH.d.ts","names":[],"sources":["../src/trace/schema.ts"],"mappings":";;;;;;;;;;;;cAYa;KAID;UAEK;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,eAAe;EACf;;;;;;;;;KAUU;UAEK;EACf;;;;;;;;;;;EAWA;EACA;EACA;;EAEA;;EAEA;;EAEA;EACA;;EAEA,iBAAiB;;EAEjB;;;EAGA;;EAEA;;EAEA;;EAEA,QAAQ;EACR;EACA;EACA,QAAQ;EACR,UAAU;EACV,SAAS;;EAET,OAAO;;;;;;EAMP,UAAU;;;UAIK;;EAEf;;EAEA;;EAEA;;KAKU;KAEA;UAEK;EACf;EACA;EACA;EACA,MAAM;EACN;EACA;EACA;EACA,SAAS;EACT;;EAEA,aAAa;;UAGE;EACf;EACA;EACA;;EAEA,SAAS;IAAQ;IAAqB;IAAc;;;UAGrC,gBAAgB;EAC/B;EACA;EACA,UAAU;EACV;EACA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;UAGe,iBAAiB;EAChC;EACA;EACA;;EAEA;EACA;EACA;;UAGe,sBAAsB;EACrC;EACA;EACA,MAAM;IAAQ;IAAe;IAAe;;;UAG7B,kBAAkB;EACjC;EACA;;EAEA;EACA;;EAEA;EACA;EACA;;UAGe,oBAAoB;EACnC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;UAGe,oBAAoB;EACnC;;KAGU,OAAO,UAAU,WAAW,gBAAgB,YAAY,cAAc;KAItE;UAUK;EACf;EACA;EACA;EACA,MAAM;EACN;EACA,SAAS;;UAKM;EACf;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;;EAEA;;UAKe;EACf;EACA;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;;;cAyBW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgFD,uBAAuB;iBAInB,UAAU,GAAG,OAAO,KAAK;iBAGzB,WAAW,GAAG,OAAO,KAAK;iBAG1B,YAAY,GAAG,OAAO,KAAK"}