@tangle-network/agent-eval 0.216.0 → 0.217.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 (553) hide show
  1. package/CHANGELOG.md +141 -57
  2. package/README.md +2 -2
  3. package/dist/adapters/http.d.ts +3 -3
  4. package/dist/{agent-profile-CIA2Atnt.d.ts → agent-profile-DTt8uGP9.d.ts} +5 -18
  5. package/dist/agent-profile-DTt8uGP9.d.ts.map +1 -0
  6. package/dist/{agent-profile-cell-BYc0bxsL.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-DsTURxdr.js → agreement-irr-BhAqjluA.js} +5 -5
  11. package/dist/agreement-irr-BhAqjluA.js.map +1 -0
  12. package/dist/analyst/index.d.ts +37 -170
  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-3xpby3p2.js → analyze-runs-DqPJaJ4X.js} +763 -555
  17. package/dist/analyze-runs-DqPJaJ4X.js.map +1 -0
  18. package/dist/{analyze-runs-CSDAh8A7.d.ts → analyze-runs-DyeNcenW.d.ts} +18 -16
  19. package/dist/analyze-runs-DyeNcenW.d.ts.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-CByl9dxG.js → benchmark-command-xQK8nOI6.js} +591 -109
  25. package/dist/benchmark-command-xQK8nOI6.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 +8 -8
  34. package/dist/campaign/index.js +15 -15
  35. package/dist/{campaign-BQ-Jujuj.js → campaign-CJGkxAQ6.js} +256 -765
  36. package/dist/campaign-CJGkxAQ6.js.map +1 -0
  37. package/dist/{campaign-evidence-OcUciD-N.js → campaign-evidence-CQYw8_0H.js} +10 -18
  38. package/dist/{campaign-evidence-OcUciD-N.js.map → campaign-evidence-CQYw8_0H.js.map} +1 -1
  39. package/dist/{canonical-BsZVgBhW.js → canonical-Dq2hOQ8L.js} +2 -2
  40. package/dist/{canonical-BsZVgBhW.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-DthPOYGd.js → chat-client-ldqxYYTN.js} +2 -2
  44. package/dist/{chat-client-DthPOYGd.js.map → chat-client-ldqxYYTN.js.map} +1 -1
  45. package/dist/{chat-json-call-BrKsyspg.js → chat-json-call-DavzexSp.js} +3 -2
  46. package/dist/chat-json-call-DavzexSp.js.map +1 -0
  47. package/dist/{claim-BXcZw-jo.js → claim-BPVuyHuy.js} +4 -4
  48. package/dist/claim-BPVuyHuy.js.map +1 -0
  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-B3JywQQn.js → cluster-bootstrap-DEwwhl0C.js} +3 -3
  54. package/dist/{cluster-bootstrap-B3JywQQn.js.map → cluster-bootstrap-DEwwhl0C.js.map} +1 -1
  55. package/dist/{produced-state-ZCtDBxAE.js → completion-verifier-B_jw6C9p.js} +9 -64
  56. package/dist/completion-verifier-B_jw6C9p.js.map +1 -0
  57. package/dist/contract/index.d.ts +13 -13
  58. package/dist/contract/index.js +1041 -1473
  59. package/dist/contract/index.js.map +1 -1
  60. package/dist/{cost-ledger-D2FnJPBF.js → cost-ledger-D0352Z4d.js} +832 -817
  61. package/dist/cost-ledger-D0352Z4d.js.map +1 -0
  62. package/dist/{cost-ledger-CO7UyEcQ.d.ts → cost-ledger-Jk62OBfF.d.ts} +12 -47
  63. package/dist/cost-ledger-Jk62OBfF.d.ts.map +1 -0
  64. package/dist/dataset-DQqhOCPt.d.ts.map +1 -1
  65. package/dist/{default-registry-Cn1LQ2Ve.js → default-registry-ClYjq3QE.js} +8 -11
  66. package/dist/default-registry-ClYjq3QE.js.map +1 -0
  67. package/dist/{default-registry-BrWh62zf.d.ts → default-registry-DXgLmoDI.d.ts} +7 -50
  68. package/dist/default-registry-DXgLmoDI.d.ts.map +1 -0
  69. package/dist/{define-agent-eval-Ch3MWX6k.js → define-agent-eval-BDxNlP3D.js} +10 -10
  70. package/dist/define-agent-eval-BDxNlP3D.js.map +1 -0
  71. package/dist/{define-agent-eval-CEWkX5wZ.d.ts → define-agent-eval-BIkH_gAR.d.ts} +9 -9
  72. package/dist/define-agent-eval-BIkH_gAR.d.ts.map +1 -0
  73. package/dist/{descriptive-CnU8Yq29.js → descriptive-CVNy48rR.js} +2 -2
  74. package/dist/{descriptive-CnU8Yq29.js.map → descriptive-CVNy48rR.js.map} +1 -1
  75. package/dist/diagnosis/index.d.ts +4 -14
  76. package/dist/diagnosis/index.d.ts.map +1 -1
  77. package/dist/diagnosis/index.js +67 -28
  78. package/dist/diagnosis/index.js.map +1 -1
  79. package/dist/{dspy-rlm-engine-D-KX_e64.js → dspy-rlm-engine-DhdCr1Dc.js} +5 -10
  80. package/dist/dspy-rlm-engine-DhdCr1Dc.js.map +1 -0
  81. package/dist/{emitter-HcCmFQl_.d.ts → emitter-DABYYTcH.d.ts} +5 -5
  82. package/dist/emitter-DABYYTcH.d.ts.map +1 -0
  83. package/dist/emitter-DbMXUIVP.js.map +1 -1
  84. package/dist/{engine-C_zNWfM8.d.ts → engine-BvZ0R-36.d.ts} +18 -22
  85. package/dist/engine-BvZ0R-36.d.ts.map +1 -0
  86. package/dist/{equal-terms-Blx9Zk5I.js → equal-terms-DbPGcVtI.js} +2 -2
  87. package/dist/equal-terms-DbPGcVtI.js.map +1 -0
  88. package/dist/{errors-Dngq5h35.js → errors-BcOs5MKW.js} +6 -8
  89. package/dist/{errors-Dngq5h35.js.map → errors-BcOs5MKW.js.map} +1 -1
  90. package/dist/{eval-campaign-4byTtqrf.js → eval-campaign-BLEfBGbA.js} +6 -6
  91. package/dist/{eval-campaign-4byTtqrf.js.map → eval-campaign-BLEfBGbA.js.map} +1 -1
  92. package/dist/{evaluation-Cn2dRZIz.d.ts → evaluation-jTjC_QQD.d.ts} +8 -8
  93. package/dist/evaluation-jTjC_QQD.d.ts.map +1 -0
  94. package/dist/evaluation.d.ts +2 -2
  95. package/dist/evaluation.js +1 -1
  96. package/dist/evaluation.js.map +1 -1
  97. package/dist/{exact-types-CD0lf5Qd.d.ts → exact-types-CflbJ9f3.d.ts} +2 -2
  98. package/dist/{exact-types-CD0lf5Qd.d.ts.map → exact-types-CflbJ9f3.d.ts.map} +1 -1
  99. package/dist/{exec-ChJ6d5if.js → exec-CpbtOXVt.js} +2 -24
  100. package/dist/{exec-ChJ6d5if.js.map → exec-CpbtOXVt.js.map} +1 -1
  101. package/dist/execution-tracks-CpgFPpS5.js.map +1 -1
  102. package/dist/experiment/index.d.ts +331 -33
  103. package/dist/experiment/index.d.ts.map +1 -1
  104. package/dist/experiment/index.js +303 -101
  105. package/dist/experiment/index.js.map +1 -1
  106. package/dist/{exporters-X4xwla8A.js → exporters-Cl6IeNAu.js} +3 -3
  107. package/dist/exporters-Cl6IeNAu.js.map +1 -0
  108. package/dist/{exporters-ChTnR90l.d.ts → exporters-Dk3oEbK_.d.ts} +2 -4
  109. package/dist/{exporters-ChTnR90l.d.ts.map → exporters-Dk3oEbK_.d.ts.map} +1 -1
  110. package/dist/{external-optimizer-process-nnsY5D_4.js → external-optimizer-process-KVFGvYX1.js} +4 -3
  111. package/dist/external-optimizer-process-KVFGvYX1.js.map +1 -0
  112. package/dist/{external-optimizer-subprocess-DcerlZSG.js → external-optimizer-subprocess-XIHBOSKt.js} +551 -553
  113. package/dist/external-optimizer-subprocess-XIHBOSKt.js.map +1 -0
  114. package/dist/{extract-usage-BrnzRJ6H.js → extract-usage-BZLU01kR.js} +2 -23
  115. package/dist/{extract-usage-BrnzRJ6H.js.map → extract-usage-BZLU01kR.js.map} +1 -1
  116. package/dist/{failure-cluster-CbgEDcFJ.d.ts → failure-cluster-DN0t63Z0.d.ts} +4 -43
  117. package/dist/failure-cluster-DN0t63Z0.d.ts.map +1 -0
  118. package/dist/{failure-taxonomy-CjabTATj.js → failure-taxonomy-Bx5oWqaW.js} +2 -19
  119. package/dist/{failure-taxonomy-CjabTATj.js.map → failure-taxonomy-Bx5oWqaW.js.map} +1 -1
  120. package/dist/{feedback-trajectory-DkaDj0dj.d.ts → feedback-trajectory-BWmhRBGu.d.ts} +8 -13
  121. package/dist/feedback-trajectory-BWmhRBGu.d.ts.map +1 -0
  122. package/dist/{semantic-concept-judge-zQBG9hHU.js → findings-store-BMVQtEsm.js} +13 -255
  123. package/dist/findings-store-BMVQtEsm.js.map +1 -0
  124. package/dist/fuzz.d.ts +20 -63
  125. package/dist/fuzz.d.ts.map +1 -1
  126. package/dist/fuzz.js +62 -108
  127. package/dist/fuzz.js.map +1 -1
  128. package/dist/{hf-dataset-BR2yhuNn.js → hf-dataset-D9f7-oX7.js} +4 -24
  129. package/dist/hf-dataset-D9f7-oX7.js.map +1 -0
  130. package/dist/hosted/index.d.ts +2 -2
  131. package/dist/hosted/index.js +2 -2
  132. package/dist/{index-DHKEAv3s.d.ts → index-9jJ2fKSX.d.ts} +2 -64
  133. package/dist/index-9jJ2fKSX.d.ts.map +1 -0
  134. package/dist/{index-oQ4aHziK.d.ts → index-BLGqZ81N.d.ts} +11 -16
  135. package/dist/{index-oQ4aHziK.d.ts.map → index-BLGqZ81N.d.ts.map} +1 -1
  136. package/dist/{index-DlH0Y9gI.d.ts → index-BiT6RtNH.d.ts} +31 -43
  137. package/dist/index-BiT6RtNH.d.ts.map +1 -0
  138. package/dist/{index-Ch9VxCpK.d.ts → index-CX-GAUpw.d.ts} +4 -8
  139. package/dist/index-CX-GAUpw.d.ts.map +1 -0
  140. package/dist/{index-CPJJr98o.d.ts → index-CiRwLv2R.d.ts} +5 -68
  141. package/dist/index-CiRwLv2R.d.ts.map +1 -0
  142. package/dist/{index-NvGBiO8H.d.ts → index-ZuWx52WG.d.ts} +266 -495
  143. package/dist/index-ZuWx52WG.d.ts.map +1 -0
  144. package/dist/index.d.ts +2256 -2165
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +514 -1192
  147. package/dist/index.js.map +1 -1
  148. package/dist/{integrity-BV1ZDf42.js → integrity-DOd9Q86O.js} +7 -12
  149. package/dist/integrity-DOd9Q86O.js.map +1 -0
  150. package/dist/{integrity-BvnVARVl.js → integrity-W4CADcFc.js} +3 -7
  151. package/dist/{integrity-BvnVARVl.js.map → integrity-W4CADcFc.js.map} +1 -1
  152. package/dist/{integrity-CCAxGVK6.d.ts → integrity-_qgZLA5p.d.ts} +4 -6
  153. package/dist/{integrity-CCAxGVK6.d.ts.map → integrity-_qgZLA5p.d.ts.map} +1 -1
  154. package/dist/{internal-CRHwS9iz.js → internal-BTK91Bqt.js} +3 -3
  155. package/dist/{internal-CRHwS9iz.js.map → internal-BTK91Bqt.js.map} +1 -1
  156. package/dist/interval-Dq9gt7jx.js +219 -0
  157. package/dist/interval-Dq9gt7jx.js.map +1 -0
  158. package/dist/interval-ohuOJurX.d.ts +47 -0
  159. package/dist/interval-ohuOJurX.d.ts.map +1 -0
  160. package/dist/{journal-DvKCvjty.js → journal-CR4QikYp.js} +110 -110
  161. package/dist/journal-CR4QikYp.js.map +1 -0
  162. package/dist/json-BhdsJaOQ.js +111 -0
  163. package/dist/json-BhdsJaOQ.js.map +1 -0
  164. package/dist/{judge-calibration-N44V04Se.js → judge-calibration-BkXMIWA4.js} +3 -3
  165. package/dist/{judge-calibration-N44V04Se.js.map → judge-calibration-BkXMIWA4.js.map} +1 -1
  166. package/dist/{judge-gate-B1qYnkpi.js → judge-gate-Co5tuh57.js} +4 -27
  167. package/dist/judge-gate-Co5tuh57.js.map +1 -0
  168. package/dist/{judge-gate-DNcUrRFA.d.ts → judge-gate-DsL0yFcb.d.ts} +9 -10
  169. package/dist/judge-gate-DsL0yFcb.d.ts.map +1 -0
  170. package/dist/{kind-factory-CbZ-6tvu.js → kind-factory-Gy4fXixd.js} +88 -17
  171. package/dist/kind-factory-Gy4fXixd.js.map +1 -0
  172. package/dist/ledger-core/index.d.ts +2 -2
  173. package/dist/ledger-core/index.js +4 -4
  174. package/dist/{ledger-core-B2hahzrt.js → ledger-core-DrJhbms9.js} +5 -84
  175. package/dist/ledger-core-DrJhbms9.js.map +1 -0
  176. package/dist/{llm-client-DQveoxSM.js → llm-client-BshCREn6.js} +90 -219
  177. package/dist/llm-client-BshCREn6.js.map +1 -0
  178. package/dist/{llm-judge-PXV7Xljl.js → llm-judge-C8jMTNNG.js} +501 -931
  179. package/dist/llm-judge-C8jMTNNG.js.map +1 -0
  180. package/dist/matrix/index.d.ts +4 -4
  181. package/dist/matrix/index.js +3 -2
  182. package/dist/{matrix-_BV9-Lk5.js → matrix-B8l-Nsxd.js} +7 -96
  183. package/dist/matrix-B8l-Nsxd.js.map +1 -0
  184. package/dist/{matrix-CHMiebFx.d.ts → matrix-DHe-dwVJ.d.ts} +10 -19
  185. package/dist/matrix-DHe-dwVJ.d.ts.map +1 -0
  186. package/dist/{paired-tests-jbwPdSz5.js → mean-BbA_JCzW.js} +45 -5
  187. package/dist/mean-BbA_JCzW.js.map +1 -0
  188. package/dist/meta-eval/index.d.ts +6 -6
  189. package/dist/meta-eval/index.js +10 -10
  190. package/dist/meta-eval/index.js.map +1 -1
  191. package/dist/metrics-BKaPBtIG.js.map +1 -1
  192. package/dist/mint-BRZXuwRi.d.ts +81 -0
  193. package/dist/mint-BRZXuwRi.d.ts.map +1 -0
  194. package/dist/{mint-Csor1BLJ.js → mint-zszyYlpA.js} +4 -4
  195. package/dist/{mint-Csor1BLJ.js.map → mint-zszyYlpA.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-D9cjmStq.js → multiplicity-Sg0U7h8j.js} +2 -2
  199. package/dist/{multiplicity-D9cjmStq.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 +5 -8
  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/nonnegative-number-DvdMxg_f.js +9 -0
  209. package/dist/nonnegative-number-DvdMxg_f.js.map +1 -0
  210. package/dist/openapi.json +114 -10
  211. package/dist/{otel-spans-C8YIJWy1.js → otel-spans-CdN909k1.js} +3 -3
  212. package/dist/{otel-spans-C8YIJWy1.js.map → otel-spans-CdN909k1.js.map} +1 -1
  213. package/dist/{paired-arms-DzKn0TfY.js → paired-arms-Ct4LTKc1.js} +32 -9
  214. package/dist/paired-arms-Ct4LTKc1.js.map +1 -0
  215. package/dist/{paired-binary-Q36bhn2R.js → paired-binary-B_nejA44.js} +3 -36
  216. package/dist/paired-binary-B_nejA44.js.map +1 -0
  217. package/dist/{paired-promotion-decision-DPKz8ZnF.d.ts → paired-promotion-decision-CQMJ5xGN.d.ts} +2 -34
  218. package/dist/paired-promotion-decision-CQMJ5xGN.d.ts.map +1 -0
  219. package/dist/{paired-promotion-decision-BN6IQTiu.js → paired-promotion-decision-D0SHb-ZL.js} +3 -3
  220. package/dist/{paired-promotion-decision-BN6IQTiu.js.map → paired-promotion-decision-D0SHb-ZL.js.map} +1 -1
  221. package/dist/{search-kernel-BztlERLv.js → pareto-BzsxidFD.js} +883 -861
  222. package/dist/pareto-BzsxidFD.js.map +1 -0
  223. package/dist/pipelines/index.d.ts +16 -19
  224. package/dist/pipelines/index.d.ts.map +1 -1
  225. package/dist/pipelines/index.js +4 -68
  226. package/dist/pipelines/index.js.map +1 -1
  227. package/dist/{power-and-mde-fK5Qocwo.js → power-and-mde-N5nU4_Ly.js} +3 -3
  228. package/dist/{power-and-mde-fK5Qocwo.js.map → power-and-mde-N5nU4_Ly.js.map} +1 -1
  229. package/dist/predicate-FdKmElA_.js +38 -0
  230. package/dist/predicate-FdKmElA_.js.map +1 -0
  231. package/dist/{prime-protocol-DcAK9pC8.js → prime-protocol-BFgGrEMP.js} +3 -3
  232. package/dist/prime-protocol-BFgGrEMP.js.map +1 -0
  233. package/dist/{prime-protocol-CEE4BR9N.d.ts → prime-protocol-BWG2DQIk.d.ts} +4 -22
  234. package/dist/prime-protocol-BWG2DQIk.d.ts.map +1 -0
  235. package/dist/profile-cell.d.ts +2 -2
  236. package/dist/profile-cell.js +2 -2
  237. package/dist/{release-confidence-BK2QCB5M.d.ts → promotion-gate-DaY95yU6.d.ts} +105 -106
  238. package/dist/promotion-gate-DaY95yU6.d.ts.map +1 -0
  239. package/dist/{promotion-policy-CWW35UWq.js → promotion-policy-6A8osGr_.js} +4 -4
  240. package/dist/{promotion-policy-CWW35UWq.js.map → promotion-policy-6A8osGr_.js.map} +1 -1
  241. package/dist/{proposal-findings-BZiMTzAF.js → proposal-findings-BbWidvUk.js} +3 -3
  242. package/dist/proposal-findings-BbWidvUk.js.map +1 -0
  243. package/dist/{query-B1D1qp2Z.js → query-B_RZ36an.js} +5 -5
  244. package/dist/query-B_RZ36an.js.map +1 -0
  245. package/dist/{query-DK1nWcmp.d.ts → query-Cmv_U8vf.d.ts} +4 -24
  246. package/dist/{query-DK1nWcmp.d.ts.map → query-Cmv_U8vf.d.ts.map} +1 -1
  247. package/dist/{random-Dn5fPWkt.js → random-DDDcC7YU.js} +2 -2
  248. package/dist/{random-Dn5fPWkt.js.map → random-DDDcC7YU.js.map} +1 -1
  249. package/dist/{raw-provider-sink-rB2DYxr6.js → raw-provider-sink-75w4FWBj.js} +2 -2
  250. package/dist/{raw-provider-sink-rB2DYxr6.js.map → raw-provider-sink-75w4FWBj.js.map} +1 -1
  251. package/dist/{redact-Cveoq6fJ.d.ts → redact-DXdlFb_U.d.ts} +4 -21
  252. package/dist/redact-DXdlFb_U.d.ts.map +1 -0
  253. package/dist/{redact-Dk1ZdJEm.js → redact-mtkTiJVk.js} +92 -98
  254. package/dist/redact-mtkTiJVk.js.map +1 -0
  255. package/dist/{registry-JYfPxcVz.d.ts → registry-ssNoHzwD.d.ts} +5 -5
  256. package/dist/{registry-JYfPxcVz.d.ts.map → registry-ssNoHzwD.d.ts.map} +1 -1
  257. package/dist/{release-confidence-Dbe9AS_X.js → release-confidence-CYIFH-fp.js} +6 -11
  258. package/dist/release-confidence-CYIFH-fp.js.map +1 -0
  259. package/dist/{report-command-y8H6RSX8.js → render-C-w2EZ6p.js} +331 -554
  260. package/dist/render-C-w2EZ6p.js.map +1 -0
  261. package/dist/reporting-html-Kvlc8oMt.js +100 -0
  262. package/dist/reporting-html-Kvlc8oMt.js.map +1 -0
  263. package/dist/reporting.d.ts +6 -6
  264. package/dist/reporting.js +8 -8
  265. package/dist/{researcher-f6mZhh58.d.ts → researcher-0ABVIdGa.d.ts} +9 -9
  266. package/dist/{researcher-f6mZhh58.d.ts.map → researcher-0ABVIdGa.d.ts.map} +1 -1
  267. package/dist/reward-DrZ71vnf.d.ts +55 -0
  268. package/dist/reward-DrZ71vnf.d.ts.map +1 -0
  269. package/dist/{reward-hacking-BFcQgkux.js → reward-hacking-ByuETaIb.js} +3 -3
  270. package/dist/{reward-hacking-BFcQgkux.js.map → reward-hacking-ByuETaIb.js.map} +1 -1
  271. package/dist/{reward-hacking-DHA7c1l8.d.ts → reward-hacking-E52wq86n.d.ts} +5 -18
  272. package/dist/reward-hacking-E52wq86n.d.ts.map +1 -0
  273. package/dist/reward-nw2xZGZG.js.map +1 -1
  274. package/dist/rl.d.ts +117 -295
  275. package/dist/rl.d.ts.map +1 -1
  276. package/dist/rl.js +27 -747
  277. package/dist/rl.js.map +1 -1
  278. package/dist/rollout/index.d.ts +5 -4
  279. package/dist/rollout/index.js +7 -8
  280. package/dist/{rollout-D9bKKBnZ.js → rollout-D6C50mfA.js} +88 -13
  281. package/dist/rollout-D6C50mfA.js.map +1 -0
  282. package/dist/round-decimal-COrKglMh.js +10 -0
  283. package/dist/round-decimal-COrKglMh.js.map +1 -0
  284. package/dist/{rubric-predictive-validity-BsgkBfT0.js → rubric-predictive-validity-D3_oI72N.js} +3 -3
  285. package/dist/{rubric-predictive-validity-BsgkBfT0.js.map → rubric-predictive-validity-D3_oI72N.js.map} +1 -1
  286. package/dist/{rubric-predictive-validity-2SgHxoa5.d.ts → rubric-predictive-validity-DiwT8PbL.d.ts} +2 -2
  287. package/dist/{rubric-predictive-validity-2SgHxoa5.d.ts.map → rubric-predictive-validity-DiwT8PbL.d.ts.map} +1 -1
  288. package/dist/{run-record-D1Hw-Jml.d.ts → run-record-CaxbLq6Y.d.ts} +5 -11
  289. package/dist/run-record-CaxbLq6Y.d.ts.map +1 -0
  290. package/dist/{run-record-ES07wfz9.js → run-record-CysKLB93.js} +3 -5
  291. package/dist/run-record-CysKLB93.js.map +1 -0
  292. package/dist/{run-record-DlTZ_lqe.js → run-record-DhEJgoPz.js} +4 -4
  293. package/dist/{run-record-DlTZ_lqe.js.map → run-record-DhEJgoPz.js.map} +1 -1
  294. package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -1
  295. package/dist/{schema-CSf6qWgZ.js → schema-Bt2vLFm3.js} +2 -14
  296. package/dist/schema-Bt2vLFm3.js.map +1 -0
  297. package/dist/schema-C-ziyJD7.d.ts.map +1 -1
  298. package/dist/{schema-2g7trUwH.d.ts → schema-D6EVKzTB.d.ts} +4 -5
  299. package/dist/schema-D6EVKzTB.d.ts.map +1 -0
  300. package/dist/{schema-BuiujZ-g.js → schema-DxcKTzbi.js} +2 -2
  301. package/dist/schema-DxcKTzbi.js.map +1 -0
  302. package/dist/search/index.d.ts +39 -53
  303. package/dist/search/index.d.ts.map +1 -1
  304. package/dist/search/index.js +4 -4
  305. package/dist/{search-kernel-CpcKH5Ih.d.ts → search-kernel-DxqjBxA-.d.ts} +18 -31
  306. package/dist/search-kernel-DxqjBxA-.d.ts.map +1 -0
  307. package/dist/{search-ledger-d7V8o9Lk.js → search-ledger-TUvB5gWH.js} +189 -199
  308. package/dist/search-ledger-TUvB5gWH.js.map +1 -0
  309. package/dist/{search-ledger-file-BqOo-bVo.js → search-ledger-file-UKCO2r8a.js} +4 -4
  310. package/dist/search-ledger-file-UKCO2r8a.js.map +1 -0
  311. package/dist/search-ledger-types-p2xKfiDJ.d.ts.map +1 -1
  312. package/dist/{search-shipper-er4pK5_Y.js → search-shipper-Cw2z3-td.js} +4 -4
  313. package/dist/search-shipper-Cw2z3-td.js.map +1 -0
  314. package/dist/{search-summary-CBvz3u_S.js → search-summary-DQIvJsSB.js} +5 -5
  315. package/dist/{search-summary-CBvz3u_S.js.map → search-summary-DQIvJsSB.js.map} +1 -1
  316. package/dist/{sequential-CzK5DarL.js → sequential-BVv1sjsw.js} +2 -32
  317. package/dist/{sequential-CzK5DarL.js.map → sequential-BVv1sjsw.js.map} +1 -1
  318. package/dist/{sequential-D-1PPCmM.js → sequential-CimQrbjv.js} +5 -5
  319. package/dist/sequential-CimQrbjv.js.map +1 -0
  320. package/dist/{sequential-BhsrMupG.d.ts → sequential-KwGspfeR.d.ts} +2 -9
  321. package/dist/{sequential-BhsrMupG.d.ts.map → sequential-KwGspfeR.d.ts.map} +1 -1
  322. package/dist/{sequential-eprocess-D1jKoihe.js → sequential-eprocess-DodI6RoF.js} +2 -2
  323. package/dist/{sequential-eprocess-D1jKoihe.js.map → sequential-eprocess-DodI6RoF.js.map} +1 -1
  324. package/dist/{server-DbcC7xMl.js → server-DoVbqqtJ.js} +101 -101
  325. package/dist/server-DoVbqqtJ.js.map +1 -0
  326. package/dist/{single-run-lock-fVu3MZWH.js → single-run-lock-U58yf8N6.js} +2 -2
  327. package/dist/{single-run-lock-fVu3MZWH.js.map → single-run-lock-U58yf8N6.js.map} +1 -1
  328. package/dist/{skillopt-optimization-method-CCtzralq.js → skillopt-optimization-method-kyL94-ri.js} +428 -91
  329. package/dist/skillopt-optimization-method-kyL94-ri.js.map +1 -0
  330. package/dist/{spans-D9_ehFuk.d.ts → spans-CVngGij3.d.ts} +2 -2
  331. package/dist/{spans-D9_ehFuk.d.ts.map → spans-CVngGij3.d.ts.map} +1 -1
  332. package/dist/{statistical-heldout-1Gbmex7v.js → statistical-heldout-Bksv92Th.js} +3 -3
  333. package/dist/statistical-heldout-Bksv92Th.js.map +1 -0
  334. package/dist/{statistical-heldout-BeR4bOdg.d.ts → statistical-heldout-C9AbgREN.d.ts} +8 -67
  335. package/dist/statistical-heldout-C9AbgREN.d.ts.map +1 -0
  336. package/dist/{steps-Bg5-KVx1.d.ts → steps-DlepJPwD.d.ts} +2 -56
  337. package/dist/steps-DlepJPwD.d.ts.map +1 -0
  338. package/dist/{store-C4avFjIi.d.ts → store-B3nWRy3B.d.ts} +2 -2
  339. package/dist/{store-C4avFjIi.d.ts.map → store-B3nWRy3B.d.ts.map} +1 -1
  340. package/dist/{store-otlp-DtB4Slsr.js → store-otlp-BteDAbHK.js} +135 -132
  341. package/dist/store-otlp-BteDAbHK.js.map +1 -0
  342. package/dist/{store-tool-spans-fZIigrpP.js → store-tool-spans-D5l_OfTJ.js} +9 -9
  343. package/dist/store-tool-spans-D5l_OfTJ.js.map +1 -0
  344. package/dist/{store-tool-spans-DR1SrCLK.d.ts → store-tool-spans-DZS0HWVf.d.ts} +157 -165
  345. package/dist/store-tool-spans-DZS0HWVf.d.ts.map +1 -0
  346. package/dist/storyboard/index.d.ts +4 -11
  347. package/dist/storyboard/index.d.ts.map +1 -1
  348. package/dist/storyboard/index.js +21 -19
  349. package/dist/storyboard/index.js.map +1 -1
  350. package/dist/{summary-report-DtdRucM0.js → summary-report-BsXJoYX5.js} +588 -598
  351. package/dist/summary-report-BsXJoYX5.js.map +1 -0
  352. package/dist/{summary-report-C-CtItCN.d.ts → summary-report-DM7tlml1.d.ts} +16 -20
  353. package/dist/summary-report-DM7tlml1.d.ts.map +1 -0
  354. package/dist/supervisor-run/index.d.ts +189 -153
  355. package/dist/supervisor-run/index.d.ts.map +1 -1
  356. package/dist/supervisor-run/index.js +58 -450
  357. package/dist/supervisor-run/index.js.map +1 -1
  358. package/dist/{systemone-CpTLAlqb.d.ts → systemone-Bp_Ac0p1.d.ts} +6 -6
  359. package/dist/{systemone-CpTLAlqb.d.ts.map → systemone-Bp_Ac0p1.d.ts.map} +1 -1
  360. package/dist/systemone-protocol.js +1 -1
  361. package/dist/{systemone-review-B_yo1xsd.d.ts → systemone-review-CwE6JGIp.d.ts} +2 -2
  362. package/dist/{systemone-review-B_yo1xsd.d.ts.map → systemone-review-CwE6JGIp.d.ts.map} +1 -1
  363. package/dist/{systemone-review-BZWfrtq1.js → systemone-review-DzdOJ8I6.js} +3 -3
  364. package/dist/{systemone-review-BZWfrtq1.js.map → systemone-review-DzdOJ8I6.js.map} +1 -1
  365. package/dist/systemone.d.ts +5 -5
  366. package/dist/systemone.js +5 -5
  367. package/dist/systemone.js.map +1 -1
  368. package/dist/{task-failure-attributes-DngaLdE4.js → task-failure-attributes-BMsblaDh.js} +3 -3
  369. package/dist/task-failure-attributes-BMsblaDh.js.map +1 -0
  370. package/dist/{terminal-record-BHocwFw1.js → terminal-record-78g6E4vh.js} +17 -13
  371. package/dist/terminal-record-78g6E4vh.js.map +1 -0
  372. package/dist/{tool-groups-mcxOXVlb.d.ts → tool-groups-DyNz2JZ_.d.ts} +3 -3
  373. package/dist/tool-groups-DyNz2JZ_.d.ts.map +1 -0
  374. package/dist/{tool-waste-Wi4g6Ekb.d.ts → tool-waste-CkjzWmeY.d.ts} +53 -56
  375. package/dist/tool-waste-CkjzWmeY.d.ts.map +1 -0
  376. package/dist/{tool-waste-D52PqU9Q.js → tool-waste-DLsjS_p-.js} +5 -5
  377. package/dist/{tool-waste-D52PqU9Q.js.map → tool-waste-DLsjS_p-.js.map} +1 -1
  378. package/dist/{trace-questions-DG7nqLQ7.d.ts → trace-questions-xxwgsuMi.d.ts} +5 -10
  379. package/dist/{trace-questions-DG7nqLQ7.d.ts.map → trace-questions-xxwgsuMi.d.ts.map} +1 -1
  380. package/dist/trace-repair/index.d.ts +15 -212
  381. package/dist/trace-repair/index.d.ts.map +1 -1
  382. package/dist/trace-repair/index.js +865 -987
  383. package/dist/trace-repair/index.js.map +1 -1
  384. package/dist/traces.d.ts +76 -86
  385. package/dist/traces.d.ts.map +1 -1
  386. package/dist/traces.js +13 -13
  387. package/dist/traces.js.map +1 -1
  388. package/dist/trajectory-replay/index.d.ts +3 -117
  389. package/dist/trajectory-replay/index.d.ts.map +1 -1
  390. package/dist/trajectory-replay/index.js +98 -56
  391. package/dist/trajectory-replay/index.js.map +1 -1
  392. package/dist/{tree-rXLW3M_4.js → tree-BGRglkKd.js} +2355 -2414
  393. package/dist/tree-BGRglkKd.js.map +1 -0
  394. package/dist/{types-B3jzCp0p.js → types-BXgASBCL.js} +2 -2
  395. package/dist/{types-B3jzCp0p.js.map → types-BXgASBCL.js.map} +1 -1
  396. package/dist/{types-oKRhQAde.d.ts → types-CW8ewATZ.d.ts} +5 -114
  397. package/dist/types-CW8ewATZ.d.ts.map +1 -0
  398. package/dist/{types-BqkVmHfv.d.ts → types-CmXY0PQf.d.ts} +2 -4
  399. package/dist/types-CmXY0PQf.d.ts.map +1 -0
  400. package/dist/{types-DBZ7keha.d.ts → types-D-mgRzlh.d.ts} +9 -72
  401. package/dist/types-D-mgRzlh.d.ts.map +1 -0
  402. package/dist/{types-B4C5nFw6.d.ts → types-D8GhJoHk.d.ts} +79 -75
  403. package/dist/types-D8GhJoHk.d.ts.map +1 -0
  404. package/dist/{types-IXD2HJzu.js → types-DqFMNTgK.js} +2 -4
  405. package/dist/types-DqFMNTgK.js.map +1 -0
  406. package/dist/{types-CfZMIzB_.d.ts → types-DtMbFw6U.d.ts} +3 -3
  407. package/dist/{types-CfZMIzB_.d.ts.map → types-DtMbFw6U.d.ts.map} +1 -1
  408. package/dist/{verdict-DhPoXApk.js → verdict-BGQmxQ8A.js} +3 -3
  409. package/dist/verdict-BGQmxQ8A.js.map +1 -0
  410. package/dist/{verdict-E4eRNf7-.d.ts → verdict-C24NELtN.d.ts} +2 -15
  411. package/dist/{verdict-E4eRNf7-.d.ts.map → verdict-C24NELtN.d.ts.map} +1 -1
  412. package/dist/{verdict-cache-BQEsVy9n.js → verdict-cache-CL_7tePD.js} +2 -2
  413. package/dist/verdict-cache-CL_7tePD.js.map +1 -0
  414. package/dist/wire/index.d.ts +32 -411
  415. package/dist/wire/index.d.ts.map +1 -1
  416. package/dist/wire/index.js +2 -2
  417. package/docs/changes/jev-evidence-review.md +1 -1
  418. package/docs/changes/jev-product-adoption.md +1 -1
  419. package/docs/changes/jev-recorded-evidence.md +1 -1
  420. package/docs/design/mlbenchmarks-book-review.md +1 -1
  421. package/docs/design/mlbenchmarks-review/probes.mts +23 -31
  422. package/docs/design/statistics-decisions.md +17 -17
  423. package/docs/design.md +1 -1
  424. package/docs/evaluation-integrity.md +1 -1
  425. package/docs/experiment.md +1 -1
  426. package/docs/proofs/campaign-attempt-retention-20261001/README.md +2 -2
  427. package/docs/public-api.md +138 -529
  428. package/docs/rollout.md +1 -1
  429. package/docs/trace-repair-admission.md +1 -1
  430. package/docs/wire-protocol.md +1 -1
  431. package/package.json +1 -1
  432. package/dist/active-curriculum-B_Lc9kfO.js +0 -61
  433. package/dist/active-curriculum-B_Lc9kfO.js.map +0 -1
  434. package/dist/agent-profile-CIA2Atnt.d.ts.map +0 -1
  435. package/dist/agent-profile-cell-BNp-Js9F.d.ts.map +0 -1
  436. package/dist/agent-profile-cell-BYc0bxsL.js.map +0 -1
  437. package/dist/agreement-irr-DsTURxdr.js.map +0 -1
  438. package/dist/analyze-runs-3xpby3p2.js.map +0 -1
  439. package/dist/analyze-runs-CSDAh8A7.d.ts.map +0 -1
  440. package/dist/ast-DJ6Bc7ab.js +0 -558
  441. package/dist/ast-DJ6Bc7ab.js.map +0 -1
  442. package/dist/ast-hI-vjW6J.d.ts +0 -457
  443. package/dist/ast-hI-vjW6J.d.ts.map +0 -1
  444. package/dist/baseline-Dm8966du.js +0 -259
  445. package/dist/baseline-Dm8966du.js.map +0 -1
  446. package/dist/benchmark-BywPeAUo.js +0 -562
  447. package/dist/benchmark-BywPeAUo.js.map +0 -1
  448. package/dist/benchmark-command-CByl9dxG.js.map +0 -1
  449. package/dist/campaign-BQ-Jujuj.js.map +0 -1
  450. package/dist/chat-json-call-BrKsyspg.js.map +0 -1
  451. package/dist/claim-BXcZw-jo.js.map +0 -1
  452. package/dist/claude-jsonl-dZir12m6.js +0 -86
  453. package/dist/claude-jsonl-dZir12m6.js.map +0 -1
  454. package/dist/client-BzL9niqi.d.ts.map +0 -1
  455. package/dist/cost-ledger-CO7UyEcQ.d.ts.map +0 -1
  456. package/dist/cost-ledger-D2FnJPBF.js.map +0 -1
  457. package/dist/counterfactual-CPaWN99-.d.ts +0 -60
  458. package/dist/counterfactual-CPaWN99-.d.ts.map +0 -1
  459. package/dist/counterfactual-DtMWvn7D.js +0 -98
  460. package/dist/counterfactual-DtMWvn7D.js.map +0 -1
  461. package/dist/default-registry-BrWh62zf.d.ts.map +0 -1
  462. package/dist/default-registry-Cn1LQ2Ve.js.map +0 -1
  463. package/dist/define-agent-eval-CEWkX5wZ.d.ts.map +0 -1
  464. package/dist/define-agent-eval-Ch3MWX6k.js.map +0 -1
  465. package/dist/dspy-rlm-engine-D-KX_e64.js.map +0 -1
  466. package/dist/effect-sizes-DiH8MGOH.js +0 -82
  467. package/dist/effect-sizes-DiH8MGOH.js.map +0 -1
  468. package/dist/emitter-HcCmFQl_.d.ts.map +0 -1
  469. package/dist/engine-C_zNWfM8.d.ts.map +0 -1
  470. package/dist/equal-terms-Blx9Zk5I.js.map +0 -1
  471. package/dist/evaluation-Cn2dRZIz.d.ts.map +0 -1
  472. package/dist/exporters-X4xwla8A.js.map +0 -1
  473. package/dist/external-optimizer-process-nnsY5D_4.js.map +0 -1
  474. package/dist/external-optimizer-subprocess-DcerlZSG.js.map +0 -1
  475. package/dist/failure-cluster-CbgEDcFJ.d.ts.map +0 -1
  476. package/dist/feedback-trajectory-DkaDj0dj.d.ts.map +0 -1
  477. package/dist/hf-dataset-BR2yhuNn.js.map +0 -1
  478. package/dist/index-CPJJr98o.d.ts.map +0 -1
  479. package/dist/index-Ch9VxCpK.d.ts.map +0 -1
  480. package/dist/index-DHKEAv3s.d.ts.map +0 -1
  481. package/dist/index-DlH0Y9gI.d.ts.map +0 -1
  482. package/dist/index-NvGBiO8H.d.ts.map +0 -1
  483. package/dist/integrity-BV1ZDf42.js.map +0 -1
  484. package/dist/journal-DvKCvjty.js.map +0 -1
  485. package/dist/judge-gate-B1qYnkpi.js.map +0 -1
  486. package/dist/judge-gate-DNcUrRFA.d.ts.map +0 -1
  487. package/dist/kind-factory-CbZ-6tvu.js.map +0 -1
  488. package/dist/ledger-core-B2hahzrt.js.map +0 -1
  489. package/dist/llm-client-DQveoxSM.js.map +0 -1
  490. package/dist/llm-judge-PXV7Xljl.js.map +0 -1
  491. package/dist/matrix-CHMiebFx.d.ts.map +0 -1
  492. package/dist/matrix-_BV9-Lk5.js.map +0 -1
  493. package/dist/mint-DCGoBYhB.d.ts +0 -155
  494. package/dist/mint-DCGoBYhB.d.ts.map +0 -1
  495. package/dist/normal-DsJZtrJc.js +0 -25
  496. package/dist/normal-DsJZtrJc.js.map +0 -1
  497. package/dist/paired-arms-DzKn0TfY.js.map +0 -1
  498. package/dist/paired-binary-Q36bhn2R.js.map +0 -1
  499. package/dist/paired-promotion-decision-DPKz8ZnF.d.ts.map +0 -1
  500. package/dist/paired-tests-jbwPdSz5.js.map +0 -1
  501. package/dist/prime-protocol-CEE4BR9N.d.ts.map +0 -1
  502. package/dist/prime-protocol-DcAK9pC8.js.map +0 -1
  503. package/dist/produced-state-ZCtDBxAE.js.map +0 -1
  504. package/dist/proposal-findings-BZiMTzAF.js.map +0 -1
  505. package/dist/query-B1D1qp2Z.js.map +0 -1
  506. package/dist/redact-Cveoq6fJ.d.ts.map +0 -1
  507. package/dist/redact-Dk1ZdJEm.js.map +0 -1
  508. package/dist/release-confidence-BK2QCB5M.d.ts.map +0 -1
  509. package/dist/release-confidence-Dbe9AS_X.js.map +0 -1
  510. package/dist/report-command-y8H6RSX8.js.map +0 -1
  511. package/dist/reward-hacking-DHA7c1l8.d.ts.map +0 -1
  512. package/dist/rollout-D9bKKBnZ.js.map +0 -1
  513. package/dist/run-record-D1Hw-Jml.d.ts.map +0 -1
  514. package/dist/run-record-ES07wfz9.js.map +0 -1
  515. package/dist/schema-2g7trUwH.d.ts.map +0 -1
  516. package/dist/schema-BuiujZ-g.js.map +0 -1
  517. package/dist/schema-CSf6qWgZ.js.map +0 -1
  518. package/dist/search-kernel-BztlERLv.js.map +0 -1
  519. package/dist/search-kernel-CpcKH5Ih.d.ts.map +0 -1
  520. package/dist/search-ledger-d7V8o9Lk.js.map +0 -1
  521. package/dist/search-ledger-file-BqOo-bVo.js.map +0 -1
  522. package/dist/search-shipper-er4pK5_Y.js.map +0 -1
  523. package/dist/semantic-concept-judge-zQBG9hHU.js.map +0 -1
  524. package/dist/sequential-D-1PPCmM.js.map +0 -1
  525. package/dist/server-DbcC7xMl.js.map +0 -1
  526. package/dist/skillopt-optimization-method-CCtzralq.js.map +0 -1
  527. package/dist/statistical-heldout-1Gbmex7v.js.map +0 -1
  528. package/dist/statistical-heldout-BeR4bOdg.d.ts.map +0 -1
  529. package/dist/steps-Bg5-KVx1.d.ts.map +0 -1
  530. package/dist/store-otlp-DtB4Slsr.js.map +0 -1
  531. package/dist/store-tool-spans-DR1SrCLK.d.ts.map +0 -1
  532. package/dist/store-tool-spans-fZIigrpP.js.map +0 -1
  533. package/dist/student-t-BQeKJx2N.js +0 -39
  534. package/dist/student-t-BQeKJx2N.js.map +0 -1
  535. package/dist/summary-report-C-CtItCN.d.ts.map +0 -1
  536. package/dist/summary-report-DtdRucM0.js.map +0 -1
  537. package/dist/task-failure-attributes-DngaLdE4.js.map +0 -1
  538. package/dist/terminal-record-BHocwFw1.js.map +0 -1
  539. package/dist/tool-groups-mcxOXVlb.d.ts.map +0 -1
  540. package/dist/tool-waste-Wi4g6Ekb.d.ts.map +0 -1
  541. package/dist/trajectory-Y1fmdlw7.d.ts +0 -24
  542. package/dist/trajectory-Y1fmdlw7.d.ts.map +0 -1
  543. package/dist/tree-rXLW3M_4.js.map +0 -1
  544. package/dist/types-B4C5nFw6.d.ts.map +0 -1
  545. package/dist/types-BqkVmHfv.d.ts.map +0 -1
  546. package/dist/types-DBZ7keha.d.ts.map +0 -1
  547. package/dist/types-IXD2HJzu.js.map +0 -1
  548. package/dist/types-oKRhQAde.d.ts.map +0 -1
  549. package/dist/usage-receipt-Cx3xNeyB.js +0 -76
  550. package/dist/usage-receipt-Cx3xNeyB.js.map +0 -1
  551. package/dist/verdict-DhPoXApk.js.map +0 -1
  552. package/dist/verdict-cache-BQEsVy9n.js.map +0 -1
  553. package/docs/design/self-improvement-evidence-audit.md +0 -263
@@ -1,8 +1,41 @@
1
- import { a as hashCanonical } from "./canonical-BsZVgBhW.js";
2
- import { o as summarizeNumberSeries } from "./descriptive-CnU8Yq29.js";
3
- import { a as parseJson, c as workerSourceKey, d as SUPERVISOR_RUN_SCHEMA, f as isUnavailable, i as asRecord, l as NO_SOURCE_LIMITS, m as unavailable, o as parseJsonl, p as showMeasured, r as readTerminalRecord, s as parseSupervisorTree, u as SUPERVISOR_RUN_ROLLUP_SCHEMA } from "./terminal-record-BHocwFw1.js";
4
- import { join, resolve } from "node:path";
5
- import { appendFile, mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
1
+ import { a as hashCanonical } from "./canonical-Dq2hOQ8L.js";
2
+ import { o as summarizeNumberSeries } from "./descriptive-CVNy48rR.js";
3
+ import { t as roundDecimal } from "./round-decimal-COrKglMh.js";
4
+ import { a as nonEmptyString, c as parseSupervisorTree, d as NO_SOURCE_LIMITS, g as unavailable, h as showMeasured, i as asRecord, l as recordOrNull, m as isUnavailable, o as parseJsonRecord, p as SUPERVISOR_RUN_SCHEMA, r as readTerminalRecord, s as parseJsonl, u as workerSourceKey } from "./terminal-record-78g6E4vh.js";
5
+ import { join } from "node:path";
6
+ import { readFile, readdir, stat } from "node:fs/promises";
7
+ //#region src/supervisor-run/patch-stats.ts
8
+ /** Unified-diff stats. Counts `+++ b/<path>` targets, body +/- lines, and test-file touches. */
9
+ function parsePatch(text) {
10
+ const files = /* @__PURE__ */ new Set();
11
+ const testFiles = /* @__PURE__ */ new Set();
12
+ let added = 0;
13
+ let removed = 0;
14
+ for (const line of text.split("\n")) {
15
+ if (line.startsWith("+++ ")) {
16
+ const p = line.slice(4).trim().replace(/^b\//, "");
17
+ if (p !== "/dev/null") {
18
+ files.add(p);
19
+ if (isTestPath(p)) testFiles.add(p);
20
+ }
21
+ continue;
22
+ }
23
+ if (line.startsWith("--- ") || line.startsWith("diff --git") || line.startsWith("index ")) continue;
24
+ if (line.startsWith("+")) added += 1;
25
+ else if (line.startsWith("-")) removed += 1;
26
+ }
27
+ return {
28
+ files: files.size,
29
+ linesAdded: added,
30
+ linesRemoved: removed,
31
+ testFilesTouched: [...testFiles].sort()
32
+ };
33
+ }
34
+ function isTestPath(p) {
35
+ const base = p.split("/").pop() ?? p;
36
+ return /(^|\/)(tests?|__tests__|testing|spec)(\/|$)/.test(p) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(base) || /^test_.*\.py$/.test(base) || /_test\.py$/.test(base);
37
+ }
38
+ //#endregion
6
39
  //#region src/supervisor-run/analyze.ts
7
40
  /**
8
41
  * The pure analyzer. Takes already-read bytes (`SupervisorRunSources`) and
@@ -26,12 +59,12 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
26
59
  const haveJournal = src.journal !== null;
27
60
  const tree = parseSupervisorTree(src);
28
61
  const state = tree.state;
29
- const result = parseJson(src.result);
30
- const judge = parseJson(src.judge);
62
+ const result = parseJsonRecord(src.result);
63
+ const judge = parseJsonRecord(src.judge);
31
64
  const terminal = readTerminalRecord({
32
65
  state,
33
66
  result,
34
- failure: src.failure === void 0 ? void 0 : parseJson(src.failure)
67
+ failure: src.failure === void 0 ? void 0 : parseJsonRecord(src.failure)
35
68
  });
36
69
  const { rootId, workerSpawns, workerCloses, startedAt, completedAt } = tree;
37
70
  const rootSpawn = rootId === null ? null : tree.spawns.find((spawn) => spawn.id === rootId) ?? null;
@@ -203,8 +236,8 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
203
236
  supervisorWallMs,
204
237
  supervisorWallSource,
205
238
  idleMs: isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : idleMs,
206
- idlePct: isUnavailable(supervisorWallMs) || supervisorWallMs === 0 ? isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : unavailable("supervisor wall is 0ms") : round(idleMs / supervisorWallMs * 100, 1),
207
- workerUtilization: isUnavailable(supervisorWallMs) || supervisorWallMs === 0 ? isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : unavailable("supervisor wall is 0ms") : round(sumWorkerWallMs / supervisorWallMs, 3)
239
+ idlePct: isUnavailable(supervisorWallMs) || supervisorWallMs === 0 ? isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : unavailable("supervisor wall is 0ms") : roundDecimal(idleMs / supervisorWallMs * 100, 1),
240
+ workerUtilization: isUnavailable(supervisorWallMs) || supervisorWallMs === 0 ? isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : unavailable("supervisor wall is 0ms") : roundDecimal(sumWorkerWallMs / supervisorWallMs, 3)
208
241
  };
209
242
  const settledByStatus = {};
210
243
  const settledVerdicts = {};
@@ -303,20 +336,20 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
303
336
  const usdLimit = src.limits.spendUsd;
304
337
  const closeUsdUnreported = stateUsd === null && resultCloseUsd !== null && resultSpentTotal.usdKnown === false;
305
338
  const usdUnreportedReason = unpriced(usdUnknownRecords, usdKnownRecords + usdUnknownRecords, usdUnknownNodes);
306
- const totalUsd = usdLimit !== null ? gap("totalUsd", usdLimit) : stateUsd !== null ? round(stateUsd, 6) : !haveJournal ? gap("totalUsd", journalMissing) : usdUnknownRecords > 0 ? gap("totalUsd", usdUnreportedReason) : round(tree.brain.usd + journalWorkerUsd, 6);
339
+ const totalUsd = usdLimit !== null ? gap("totalUsd", usdLimit) : stateUsd !== null ? roundDecimal(stateUsd, 6) : !haveJournal ? gap("totalUsd", journalMissing) : usdUnknownRecords > 0 ? gap("totalUsd", usdUnreportedReason) : roundDecimal(tree.brain.usd + journalWorkerUsd, 6);
307
340
  const journalSpendRecords = usdKnownRecords;
308
341
  const journalDerivedAvailable = usdLimit === null && haveJournal && !usdAllUnknown;
309
342
  const closeRecordAvailable = usdLimit === null && closeUsd !== null && !closeUsdUnreported;
310
343
  const spend = {
311
344
  journalDerived: {
312
- usd: journalDerivedAvailable ? round(tree.brain.usd + journalWorkerUsd, 6) : unavailable(usdLimit ?? (haveJournal ? usdUnreportedReason : journalMissing)),
345
+ usd: journalDerivedAvailable ? roundDecimal(tree.brain.usd + journalWorkerUsd, 6) : unavailable(usdLimit ?? (haveJournal ? usdUnreportedReason : journalMissing)),
313
346
  records: journalDerivedAvailable ? journalSpendRecords : 0,
314
347
  unknownRecords: usdLimit === null && haveJournal ? usdUnknownRecords : 0,
315
348
  partial: journalDerivedAvailable && usdPartial,
316
349
  unknownNodes: usdLimit === null && haveJournal ? usdUnknownNodes : []
317
350
  },
318
351
  closeRecord: {
319
- usd: closeRecordAvailable ? round(closeUsd, 6) : unavailable(usdLimit ?? (closeUsdUnreported ? "close record incomplete: result.json spentTotal.usdKnown is false" : "no close record: neither state.json result.spentUsd nor result.json spentTotal.usd is present")),
352
+ usd: closeRecordAvailable ? roundDecimal(closeUsd, 6) : unavailable(usdLimit ?? (closeUsdUnreported ? "close record incomplete: result.json spentTotal.usdKnown is false" : "no close record: neither state.json result.spentUsd nor result.json spentTotal.usd is present")),
320
353
  records: closeRecordAvailable ? 1 : 0,
321
354
  unknownRecords: closeUsdUnreported ? 1 : 0,
322
355
  partial: false,
@@ -371,7 +404,7 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
371
404
  brain: {
372
405
  tokensIn: managerTokenLimit !== null ? gap("brain.tokensIn", managerTokenLimit) : !haveJournal ? gap("brain.tokensIn", journalMissing) : brainTokensUnreported !== null ? gap("brain.tokensIn", brainTokensUnreported) : tree.brain.tokensIn,
373
406
  tokensOut: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : tree.brain.tokensOut,
374
- usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : brainUsdUnreported !== null ? unavailable(brainUsdUnreported) : round(tree.brain.usd, 6),
407
+ usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : brainUsdUnreported !== null ? unavailable(brainUsdUnreported) : roundDecimal(tree.brain.usd, 6),
375
408
  cacheRead: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : !tree.brain.hasCache ? unavailable(NO_CACHE_COUNTERS) : tree.brain.cacheBreakdownKnown ? tree.brain.cacheRead : unavailable(NO_CACHE_BREAKDOWN),
376
409
  cacheWrite: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : !tree.brain.hasCache ? unavailable(NO_CACHE_COUNTERS) : tree.brain.cacheBreakdownKnown ? tree.brain.cacheWrite : unavailable(NO_CACHE_BREAKDOWN),
377
410
  source: managerTokenLimit ?? (haveJournal ? `journal metered events (n=${tree.brain.meteredCount})${tree.brain.usdKnownCount > 0 && tree.brain.usdUnknownCount > 0 ? ` — ${tree.brain.usdUnknownCount} unpriced` : ""}` : journalMissing)
@@ -382,13 +415,13 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
382
415
  tokensOut: workerOut,
383
416
  cacheRead: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheRead !== void 0 ? sq.cacheRead : unavailable(NO_CACHE_COUNTERS),
384
417
  cacheWrite: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheWrite !== void 0 ? sq.cacheWrite : unavailable(NO_CACHE_COUNTERS),
385
- usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : workerUsdUnreported !== null ? unavailable(workerUsdUnreported) : round(journalWorkerUsd, 6),
418
+ usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : workerUsdUnreported !== null ? unavailable(workerUsdUnreported) : roundDecimal(journalWorkerUsd, 6),
386
419
  source: `${workerTokenLimit !== null ? workerTokenLimit : sq !== null ? `journal settled spend + ${sq.store} sessions (n=${sq.sessions})` : `journal settled spend only — ${src.harnessMissingReason ?? "harness session store unavailable"}`}${workerUsdUnknownNodes.length > 0 && workerUsdUnknownNodes.length < rootChildSpends.length ? ` — ${workerUsdUnknownNodes.length} unpriced` : ""}`
387
420
  },
388
421
  spend,
389
422
  totalUsd,
390
423
  totalUsdSource: usdLimit !== null ? usdLimit : stateUsd !== null ? `state.json result.spentUsd${rootChildCloses.length > 0 && journalWorkerUsd === 0 ? " — brain-priced only; worker CLI inference is unpriced (see worker token counts)" : ""}` : !haveJournal ? journalMissing : usdUnknownRecords > 0 ? usdUnreportedReason : "journal metered + settled usd",
391
- costPerAcceptedPatchUsd: isUnavailable(totalUsd) ? unavailable(totalUsd.unavailable) : isUnavailable(decision.accepted) ? unavailable(decision.accepted.unavailable) : decision.accepted === 0 ? unavailable("no accepted worker patch (cost has no denominator)") : round(totalUsd / decision.accepted, 6),
424
+ costPerAcceptedPatchUsd: isUnavailable(totalUsd) ? unavailable(totalUsd.unavailable) : isUnavailable(decision.accepted) ? unavailable(decision.accepted.unavailable) : decision.accepted === 0 ? unavailable("no accepted worker patch (cost has no denominator)") : roundDecimal(totalUsd / decision.accepted, 6),
392
425
  workerWallMsDistribution: wallDistribution === null ? unavailable(src.workers === null ? workersGapReason : "no worker start/finish pairs captured") : wallDistribution,
393
426
  perWorker: src.workers === null ? unavailable(workersGapReason) : perWorker
394
427
  };
@@ -447,304 +480,6 @@ function pickString(rec, key) {
447
480
  const v = rec?.[key];
448
481
  return typeof v === "string" ? v : null;
449
482
  }
450
- function round(v, digits) {
451
- const f = 10 ** digits;
452
- return Math.round(v * f) / f;
453
- }
454
- /** Unified-diff stats. Counts `+++ b/<path>` targets, body +/- lines, and test-file touches. */
455
- function parsePatch(text) {
456
- const files = /* @__PURE__ */ new Set();
457
- const testFiles = /* @__PURE__ */ new Set();
458
- let added = 0;
459
- let removed = 0;
460
- for (const line of text.split("\n")) {
461
- if (line.startsWith("+++ ")) {
462
- const p = line.slice(4).trim().replace(/^b\//, "");
463
- if (p !== "/dev/null") {
464
- files.add(p);
465
- if (isTestPath(p)) testFiles.add(p);
466
- }
467
- continue;
468
- }
469
- if (line.startsWith("--- ") || line.startsWith("diff --git") || line.startsWith("index ")) continue;
470
- if (line.startsWith("+")) added += 1;
471
- else if (line.startsWith("-")) removed += 1;
472
- }
473
- return {
474
- files: files.size,
475
- linesAdded: added,
476
- linesRemoved: removed,
477
- testFilesTouched: [...testFiles].sort()
478
- };
479
- }
480
- function isTestPath(p) {
481
- const base = p.split("/").pop() ?? p;
482
- return /(^|\/)(tests?|__tests__|testing|spec)(\/|$)/.test(p) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(base) || /^test_.*\.py$/.test(base) || /_test\.py$/.test(base);
483
- }
484
- /**
485
- * Aggregate many supervisor-run reports. A metric no run could measure stays
486
- * `unavailable` rather than becoming a 0-valued mean, and cells whose steer
487
- * count was unavailable are counted separately from cells that measured zero.
488
- */
489
- function rollupSupervisorRuns(reports) {
490
- const known = (vals) => vals.filter((v) => !isUnavailable(v));
491
- const steerVals = known(reports.map((r) => r.orchestration.steers));
492
- const waveVals = known(reports.map((r) => r.orchestration.waves));
493
- const concVals = known(reports.map((r) => r.orchestration.maxConcurrency));
494
- const utilVals = known(reports.map((r) => r.orchestration.workerUtilization));
495
- const idleVals = known(reports.map((r) => r.orchestration.idlePct));
496
- const spawnVals = known(reports.map((r) => r.orchestration.workersSpawned));
497
- const acceptVals = known(reports.map((r) => r.decision.accepted));
498
- const usdVals = known(reports.map((r) => r.economics.totalUsd));
499
- const journalSpendVals = known(reports.map((r) => r.economics.spend.journalDerived.usd));
500
- const closeSpendVals = known(reports.map((r) => r.economics.spend.closeRecord.usd));
501
- const resolvedVals = known(reports.map((r) => r.outcome.judgeResolved));
502
- const sum = (xs) => xs.reduce((a, b) => a + b, 0);
503
- const mean = (xs) => xs.length === 0 ? unavailable("no cell reported this metric") : round(sum(xs) / xs.length, 3);
504
- const perCell = reports.map((r) => ({
505
- instanceId: r.instanceId,
506
- arm: r.arm,
507
- steers: r.orchestration.steers,
508
- waves: r.orchestration.waves,
509
- utilization: r.orchestration.workerUtilization,
510
- idlePct: r.orchestration.idlePct,
511
- resolved: r.outcome.judgeResolved,
512
- usd: r.economics.totalUsd,
513
- ...r.economics.resourceRecords === void 0 ? {} : { resourceRecords: r.economics.resourceRecords }
514
- }));
515
- return {
516
- schema: SUPERVISOR_RUN_ROLLUP_SCHEMA,
517
- cells: reports.length,
518
- steersTotal: steerVals.length === 0 ? unavailable("no cell reported a steer count") : sum(steerVals),
519
- cellsWithSteers: steerVals.length === 0 ? unavailable("no cell reported a steer count") : steerVals.filter((n) => n > 0).length,
520
- cellsWithUnavailableSteers: reports.filter((r) => isUnavailable(r.orchestration.steers)).length,
521
- wavesMean: mean(waveVals),
522
- maxConcurrencyMax: concVals.length === 0 ? unavailable("no cell reported concurrency") : Math.max(...concVals),
523
- utilizationMean: mean(utilVals),
524
- idlePctMean: mean(idleVals),
525
- workersSpawnedTotal: spawnVals.length === 0 ? unavailable("no cell reported spawns") : sum(spawnVals),
526
- acceptedTotal: acceptVals.length === 0 ? unavailable("no cell reported acceptance") : sum(acceptVals),
527
- usdTotal: usdVals.length === 0 ? unavailable("no cell reported spend") : round(sum(usdVals), 6),
528
- spendUsd: {
529
- journalDerived: {
530
- value: journalSpendVals.length === 0 ? unavailable("no cell measured journal-derived spend") : round(sum(journalSpendVals), 6),
531
- runs: journalSpendVals.length
532
- },
533
- closeRecord: {
534
- value: closeSpendVals.length === 0 ? unavailable("no cell carried a close record") : round(sum(closeSpendVals), 6),
535
- runs: closeSpendVals.length
536
- }
537
- },
538
- resolvedCount: resolvedVals.length === 0 ? unavailable("no cell reported a judge verdict") : resolvedVals.filter((v) => v === true).length,
539
- perCell
540
- };
541
- }
542
- //#endregion
543
- //#region src/supervisor-run/render.ts
544
- /**
545
- * Human-readable renderings of a supervisor-run report. Zero and unavailable
546
- * render differently on purpose (`0` vs `unavailable — <reason>`), because the
547
- * two have driven opposite conclusions about the same architecture.
548
- */
549
- /**
550
- * The block appended to a run log after every run — the answers an operator asks
551
- * for, in the log tail, with no extra command.
552
- */
553
- function renderSupervisorRunHeadline(r) {
554
- const o = r.orchestration;
555
- const steerNote = isUnavailable(o.steers) ? `unavailable — ${o.steers.unavailable}` : o.steers === 0 ? "0 (spawn→wait→respawn only; no mid-task steering)" : `${o.steers} queued / ${showMeasured(o.steersDelivered)} delivered`;
556
- return [
557
- `RUN-REPORT ${r.instanceId ?? "?"} [${r.arm ?? "?"}]`,
558
- ` status=${showMeasured(r.outcome.supStatus)} source=${showMeasured(r.outcome.supStatusSource)} reason=${showMeasured(r.outcome.supReason)} failure=${fmtFailure(r.outcome.failure)}`,
559
- ` steers=${steerNote}`,
560
- ` waves=${showMeasured(o.waves)} sizes=${isUnavailable(o.waveSizes) ? `unavailable — ${o.waveSizes.unavailable}` : `[${o.waveSizes.join(",")}]`} workers=${showMeasured(o.workersSpawned)} settled=${showMeasured(o.workersSettled)} cancelled=${showMeasured(o.workersCancelled)}`,
561
- ` concurrency max=${showMeasured(o.maxConcurrency)} utilization=${showMeasured(o.workerUtilization)} idle=${fmtMs(o.idleMs)} (${showMeasured(o.idlePct)}%) wall=${fmtMs(o.supervisorWallMs)}${o.supervisorWallSource === "journal-span" ? " (journal-span lower bound)" : ""}`,
562
- ` respawns=${showMeasured(o.respawns)} evidence→respawn=${showMeasured(r.decision.observeThenRespawn)} blind-respawn=${showMeasured(r.decision.respawnWithoutEvidence)} depth=${showMeasured(o.delegationDepth)}`,
563
- ` accepted=${showMeasured(r.decision.accepted)} rejected=${showMeasured(r.decision.rejected)} empty-pass=${showMeasured(r.decision.emptyPass)}`,
564
- ` brain=$${showMeasured(r.economics.brain.usd)} total=$${showMeasured(r.economics.totalUsd)} judge.resolved=${showMeasured(r.outcome.judgeResolved)} score=${showMeasured(r.outcome.judgeScore)} verify=${showMeasured(r.outcome.verifyPass)}`,
565
- r.gaps.length > 0 ? ` gaps(${r.gaps.length}): ${r.gaps.join("; ")}` : " gaps: none"
566
- ].join("\n");
567
- }
568
- /**
569
- * The recorded error on one line; `none recorded` and `unavailable` stay
570
- * distinct, and a throw the run outlived is labeled so it is not read as the
571
- * outcome of the settled result beside it.
572
- */
573
- function fmtFailure(v) {
574
- if (isUnavailable(v)) return `unavailable — ${v.unavailable}`;
575
- if (v === null) return "none recorded";
576
- const name = v.name ?? "unavailable — record has no error.name";
577
- const message = v.message ?? "unavailable — record has no error.message";
578
- const attempt = v.earlierAttempt ? ", earlier attempt" : "";
579
- return `${name}: ${message} [${v.source}${v.at === null ? "" : ` at ${v.at}`}${attempt}]`;
580
- }
581
- function resourceRows(records) {
582
- if (isUnavailable(records)) return [`unavailable — ${records.unavailable}`, ""];
583
- const out = [
584
- "Receipts are source records, not additive totals.",
585
- "A false completeness flag means the amount is a recorded subtotal, not complete usage.",
586
- "",
587
- "| Node | Source | Resource | Unit | Amount | Known |",
588
- "|---|---|---|---|---:|---|"
589
- ];
590
- const cell = (value) => value.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
591
- for (const record of records) {
592
- const prefix = `| ${cell(record.nodeId ?? "unavailable")} | ${cell(record.source)} |`;
593
- if (isUnavailable(record.resources)) out.push(`${prefix} ${cell(showMeasured(record.resources))} | — | — | — |`);
594
- else if (record.resources.length === 0) out.push(`${prefix} recorded empty map | — | — | — |`);
595
- else for (const receipt of record.resources) out.push(`${prefix} ${cell(showMeasured(receipt.name))} | ${cell(showMeasured(receipt.unit))} | ${cell(showMeasured(receipt.amount))} | ${cell(showMeasured(receipt.known))} |`);
596
- }
597
- if (!records.length) out.push("| — | — | no spend records | — | — | — |");
598
- out.push("");
599
- return out;
600
- }
601
- function fmtMs(v) {
602
- if (isUnavailable(v)) return `unavailable — ${v.unavailable}`;
603
- if (v < 1e3) return `${v}ms`;
604
- const s = v / 1e3;
605
- if (s < 120) return `${round(s, 1)}s`;
606
- return `${round(s / 60, 1)}min`;
607
- }
608
- function renderSupervisorRunMarkdown(r) {
609
- const o = r.orchestration;
610
- const d = r.decision;
611
- const e = r.economics;
612
- const out = [];
613
- out.push(`# Run report — ${r.instanceId ?? "unknown instance"} [${r.arm ?? "unknown arm"}]`);
614
- out.push("");
615
- out.push("```");
616
- out.push(renderSupervisorRunHeadline(r));
617
- out.push("```");
618
- out.push("");
619
- out.push(`- Run: \`${r.runRef}\``);
620
- out.push(`- Supervisor: \`${showMeasured(r.supervisorId)}\``);
621
- out.push(`- Supervisor profile: \`${showMeasured(r.supervisorProfileDigest)}\``);
622
- out.push(`- Generated: ${r.generatedAt}`);
623
- out.push("");
624
- out.push("## Orchestration");
625
- out.push("");
626
- out.push("| Metric | Value |");
627
- out.push("|---|---|");
628
- out.push(`| Workers spawned | ${showMeasured(o.workersSpawned)} |`);
629
- out.push(`| Workers settled | ${showMeasured(o.workersSettled)} |`);
630
- out.push(`| Workers cancelled | ${showMeasured(o.workersCancelled)} |`);
631
- out.push(`| **Steers (mid-task messages to live workers)** | **${showMeasured(o.steers)}** |`);
632
- out.push(`| Steers delivered | ${showMeasured(o.steersDelivered)} |`);
633
- out.push(`| Outer-driver \`supervisor_steer\` calls | ${showMeasured(o.driverSteerCalls)} |`);
634
- out.push(`| Spawn waves | ${showMeasured(o.waves)} |`);
635
- out.push(`| Wave sizes | ${isUnavailable(o.waveSizes) ? showMeasured(o.waveSizes) : `[${o.waveSizes.join(", ")}]`} |`);
636
- out.push(`| Max concurrency | ${showMeasured(o.maxConcurrency)} |`);
637
- out.push(`| Respawns (after same parent's first settle) | ${showMeasured(o.respawns)} |`);
638
- out.push(`| Repeated labels | ${isUnavailable(o.repeatedLabels) ? showMeasured(o.repeatedLabels) : o.repeatedLabels.length === 0 ? "none" : o.repeatedLabels.join(", ")} |`);
639
- out.push(`| Delegation depth | ${showMeasured(o.delegationDepth)} |`);
640
- out.push(`| Time to first spawn | ${fmtMs(o.timeToFirstSpawnMs)} |`);
641
- out.push(`| Supervisor wall | ${fmtMs(o.supervisorWallMs)}${isUnavailable(o.supervisorWallSource) ? "" : ` (source: ${o.supervisorWallSource}${o.supervisorWallSource === "journal-span" ? ", lower bound" : ""})`} |`);
642
- out.push(`| Idle (zero live workers) | ${fmtMs(o.idleMs)} (${showMeasured(o.idlePct)}%) |`);
643
- out.push(`| Worker utilization (Σ worker wall ÷ supervisor wall) | ${showMeasured(o.workerUtilization)} |`);
644
- out.push("");
645
- if (!isUnavailable(o.steersByWorker) && o.steersByWorker.length > 0) {
646
- out.push("### Steers per worker");
647
- out.push("");
648
- out.push("| Worker id | Label | Queued | Delivered |");
649
- out.push("|---|---|---:|---:|");
650
- for (const s of o.steersByWorker) out.push(`| ${s.workerId === null ? "unavailable — worker id absent; label join used" : `\`${s.workerId}\``} | \`${s.worker}\` | ${s.queued} | ${s.delivered} |`);
651
- out.push("");
652
- } else if (isUnavailable(o.steersByWorker)) out.push(`### Steers per worker\n\nunavailable — ${o.steersByWorker.unavailable}\n`);
653
- out.push("## Decision quality");
654
- out.push("");
655
- out.push("| Metric | Value |");
656
- out.push("|---|---|");
657
- out.push(`| Settled by status | ${fmtCounts(d.settledByStatus)} |`);
658
- out.push(`| Settled verdicts | ${fmtCounts(d.settledVerdicts)} |`);
659
- out.push(`| Accepted (verify green + patch bytes) | ${showMeasured(d.accepted)} |`);
660
- out.push(`| Rejected (verify red) | ${showMeasured(d.rejected)} |`);
661
- out.push(`| Empty pass (green, no patch) | ${showMeasured(d.emptyPass)} |`);
662
- out.push(`| Evidence → respawn sequences | ${showMeasured(d.observeThenRespawn)} |`);
663
- out.push(`| Respawn with no same-parent settled evidence in front | ${showMeasured(d.respawnWithoutEvidence)} |`);
664
- out.push(`| Review actions (steers + worker questions) | ${showMeasured(d.reviewActions)} |`);
665
- out.push(`| Worker evidence returned | ${isUnavailable(d.workerEvidenceBytes) ? showMeasured(d.workerEvidenceBytes) : `${d.workerEvidenceBytes} bytes`} |`);
666
- out.push("");
667
- out.push("## Economics");
668
- out.push("");
669
- out.push("| Role | Tokens in | Tokens out | Cache read | Cache write | USD | Source |");
670
- out.push("|---|---:|---:|---:|---:|---:|---|");
671
- out.push(`| brain | ${showMeasured(e.brain.tokensIn)} | ${showMeasured(e.brain.tokensOut)} | ${showMeasured(e.brain.cacheRead)} | ${showMeasured(e.brain.cacheWrite)} | ${showMeasured(e.brain.usd)} | ${e.brain.source} |`);
672
- out.push(`| workers | ${showMeasured(e.workers.tokensIn)} | ${showMeasured(e.workers.tokensOut)} | ${showMeasured(e.workers.cacheRead)} | ${showMeasured(e.workers.cacheWrite)} | ${showMeasured(e.workers.usd)} | ${e.workers.source} |`);
673
- out.push("");
674
- if (!isUnavailable(e.brainTruncations) && e.brainTruncations > 0) out.push(`- **BRAIN OUTPUT TRUNCATED: ${e.brainTruncations} completion(s) hit \`finish_reason: "length"\`** — the supervisor acted on a half-written plan. Its output ceiling is too low; see \`brain.jsonl\` for the per-call \`req_max_tokens\`.`);
675
- else out.push(`- Brain completions truncated (finish_reason=length): ${showMeasured(e.brainTruncations)}`);
676
- out.push(`- Total USD: ${showMeasured(e.totalUsd)} (source: ${e.totalUsdSource})`);
677
- out.push(`- Spend measured two ways: journal-derived $${showMeasured(e.spend.journalDerived.usd)} over ${e.spend.journalDerived.records} journal record(s) (execution accounting) · close-record $${showMeasured(e.spend.closeRecord.usd)} over ${e.spend.closeRecord.records} close record(s) (billing-shaped). Divergence is a signal, not an error.`);
678
- out.push(`- Cost per accepted patch: ${showMeasured(e.costPerAcceptedPatchUsd)}`);
679
- if (isUnavailable(e.workerWallMsDistribution)) out.push(`- Worker wall distribution: unavailable — ${e.workerWallMsDistribution.unavailable}`);
680
- else {
681
- const w = e.workerWallMsDistribution;
682
- out.push(`- Worker wall (n=${w.n}): min ${fmtMs(w.min)} / p50 ${fmtMs(w.p50)} / p90 ${fmtMs(w.p90)} / max ${fmtMs(w.max)} / Σ ${fmtMs(w.sum)}`);
683
- }
684
- out.push("");
685
- if (!isUnavailable(e.perWorker) && e.perWorker.length > 0) {
686
- out.push("| Worker id | Label | Role | Runtime | Profile digest | Status | Failure | Infra | Wall | Tokens in | Tokens out | Patch bytes | Verify passed | Score |");
687
- out.push("|---|---|---|---|---|---|---|---|---:|---:|---:|---:|---|---:|");
688
- for (const w of e.perWorker) out.push(`| ${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"} |`);
689
- out.push("");
690
- }
691
- if (e.resourceRecords !== void 0) out.push("## Named resource receipts", "", ...resourceRows(e.resourceRecords));
692
- out.push("## Outcome");
693
- out.push("");
694
- out.push("| Metric | Value |");
695
- out.push("|---|---|");
696
- out.push(`| Supervisor status | ${showMeasured(r.outcome.supStatus)} |`);
697
- out.push(`| Status source | ${showMeasured(r.outcome.supStatusSource)} |`);
698
- out.push(`| Terminal reason | ${showMeasured(r.outcome.supReason)} |`);
699
- out.push(`| Failure | ${fmtFailure(r.outcome.failure)} |`);
700
- out.push(`| Supervisor verdict | ${showMeasured(r.outcome.supVerdict)} |`);
701
- out.push(`| Delivered | ${showMeasured(r.outcome.delivered)} |`);
702
- out.push(`| Judge resolved | ${showMeasured(r.outcome.judgeResolved)} |`);
703
- out.push(`| Judge score | ${showMeasured(r.outcome.judgeScore)} |`);
704
- out.push(`| Judge passed / total | ${showMeasured(r.outcome.judgePassed)} / ${showMeasured(r.outcome.judgeTotal)} |`);
705
- out.push(`| Judge source | ${r.outcome.judgeSource ?? "unavailable — no judge.json and no ledger row"} |`);
706
- out.push(`| Verify gate | pass=${showMeasured(r.outcome.verifyPass)} rc=${showMeasured(r.outcome.verifyRc)} |`);
707
- if (isUnavailable(r.outcome.patch)) out.push(`| Patch | unavailable — ${r.outcome.patch.unavailable} |`);
708
- else {
709
- const p = r.outcome.patch;
710
- out.push(`| Patch | ${p.files} file(s), +${p.linesAdded}/-${p.linesRemoved}, test files touched: ${p.testFilesTouched.length === 0 ? "none" : p.testFilesTouched.join(", ")} |`);
711
- }
712
- out.push("");
713
- out.push("## Gaps");
714
- out.push("");
715
- if (r.gaps.length === 0) out.push("None — every metric above is backed by a present artifact.");
716
- else for (const g of r.gaps) out.push(`- ${g}`);
717
- out.push("");
718
- out.push(`> Harness-session view of the same run (model calls, stuck loops, tool errors): \`${r.traceCommand}\``);
719
- out.push("");
720
- return out.join("\n");
721
- }
722
- function fmtCounts(v) {
723
- if (isUnavailable(v)) return showMeasured(v);
724
- const entries = Object.entries(v);
725
- return entries.length === 0 ? "none" : entries.map(([k, n]) => `${k}=${n}`).join(", ");
726
- }
727
- function renderSupervisorRollupMarkdown(rollup, title = "Round rollup") {
728
- const out = [];
729
- out.push(`# ${title}`);
730
- out.push("");
731
- out.push(`- Cells: ${rollup.cells}`);
732
- out.push(`- **Steers across all cells: ${showMeasured(rollup.steersTotal)}** (cells with ≥1 steer: ${showMeasured(rollup.cellsWithSteers)}; cells where the steer count is unavailable: ${rollup.cellsWithUnavailableSteers})`);
733
- out.push(`- Waves per cell (mean): ${showMeasured(rollup.wavesMean)}`);
734
- out.push(`- Max concurrency observed: ${showMeasured(rollup.maxConcurrencyMax)}`);
735
- out.push(`- Worker utilization (mean): ${showMeasured(rollup.utilizationMean)}`);
736
- out.push(`- Idle share (mean): ${showMeasured(rollup.idlePctMean)}%`);
737
- out.push(`- Workers spawned: ${showMeasured(rollup.workersSpawnedTotal)} · accepted: ${showMeasured(rollup.acceptedTotal)}`);
738
- out.push(`- Spend: $${showMeasured(rollup.usdTotal)} · judged resolved: ${showMeasured(rollup.resolvedCount)}/${rollup.cells}`);
739
- out.push(`- Spend measured two ways: journal-derived $${showMeasured(rollup.spendUsd.journalDerived.value)} over ${rollup.spendUsd.journalDerived.runs}/${rollup.cells} runs (execution accounting) · close-record $${showMeasured(rollup.spendUsd.closeRecord.value)} over ${rollup.spendUsd.closeRecord.runs}/${rollup.cells} runs (billing-shaped)`);
740
- out.push("");
741
- out.push("| Instance | Arm | Steers | Waves | Utilization | Idle % | Resolved | USD |");
742
- out.push("|---|---|---:|---:|---:|---:|---|---:|");
743
- for (const c of rollup.perCell) out.push(`| ${c.instanceId ?? "?"} | ${c.arm ?? "?"} | ${showMeasured(c.steers)} | ${showMeasured(c.waves)} | ${showMeasured(c.utilization)} | ${showMeasured(c.idlePct)} | ${showMeasured(c.resolved)} | ${showMeasured(c.usd)} |`);
744
- out.push("");
745
- for (const cell of rollup.perCell) if (cell.resourceRecords !== void 0) out.push(`## Resource receipts — ${cell.instanceId ?? "?"} [${cell.arm ?? "?"}]`, "", ...resourceRows(cell.resourceRecords));
746
- return out.join("\n");
747
- }
748
483
  //#endregion
749
484
  //#region src/supervisor-run/coordination-reader.ts
750
485
  /**
@@ -767,6 +502,45 @@ function readCoordinationLog(runDir) {
767
502
  return readMaybe(join(runDir, COORDINATION_FILE));
768
503
  }
769
504
  //#endregion
505
+ //#region src/supervisor-run/runtime-source-limits.ts
506
+ function spendRecord(value) {
507
+ const spend = recordOrNull(value);
508
+ if (spend === null) return null;
509
+ const tokens = recordOrNull(spend.tokens);
510
+ if (tokens === null || typeof tokens.input !== "number" || !Number.isFinite(tokens.input) || tokens.input < 0 || typeof tokens.output !== "number" || !Number.isFinite(tokens.output) || tokens.output < 0 || typeof spend.usd !== "number" || !Number.isFinite(spend.usd) || spend.usd < 0 || spend.usdKnown !== void 0 && typeof spend.usdKnown !== "boolean") return null;
511
+ return spend;
512
+ }
513
+ function sourceLimits(root, events, workerIds) {
514
+ const rootMeters = events.filter((event) => event.kind === "metered" && event.id === root);
515
+ const invalidRootMeters = rootMeters.filter((event) => spendRecord(event.spend) === null);
516
+ const rootMeterReason = rootMeters.length === 0 ? "Runtime journal has no root metered event" : invalidRootMeters.length > 0 ? `${invalidRootMeters.length} root metered event(s) lack complete spend` : null;
517
+ const closes = events.filter((event) => workerIds.has(nonEmptyString(event.id) ?? "") && (event.kind === "settled" || event.kind === "cancelled"));
518
+ const settledById = /* @__PURE__ */ new Map();
519
+ for (const event of closes) {
520
+ const id = nonEmptyString(event.id);
521
+ if (id === null) continue;
522
+ const matches = settledById.get(id) ?? [];
523
+ matches.push(event);
524
+ settledById.set(id, matches);
525
+ }
526
+ const incompleteWorkers = [...workerIds].filter((id) => {
527
+ const terminal = settledById.get(id);
528
+ return terminal?.length !== 1 || terminal[0]?.kind !== "settled" || spendRecord(terminal[0]?.spent) === null;
529
+ });
530
+ const missingVerdicts = [...workerIds].filter((id) => {
531
+ const terminal = settledById.get(id)?.[0];
532
+ if (terminal?.kind !== "settled") return true;
533
+ return typeof recordOrNull(terminal.verdict)?.valid !== "boolean";
534
+ });
535
+ return {
536
+ managerTokens: rootMeterReason,
537
+ workerTokens: incompleteWorkers.length === 0 ? null : `${incompleteWorkers.length}/${workerIds.size} child invocation(s) lack one settled spend record`,
538
+ spendUsd: rootMeterReason !== null ? rootMeterReason : incompleteWorkers.length > 0 ? "at least one child invocation lacks a settled spend record" : null,
539
+ workerVerdicts: missingVerdicts.length === 0 ? null : `${missingVerdicts.length}/${workerIds.size} child invocation(s) lack a structured validity verdict`,
540
+ deliverables: workerIds.size === 0 ? null : "Runtime FileRunContext does not retain per-child delivered patches"
541
+ };
542
+ }
543
+ //#endregion
770
544
  //#region src/supervisor-run/runtime-reader.ts
771
545
  /**
772
546
  * Reader for agent-runtime's file-backed supervision context.
@@ -826,16 +600,10 @@ const RUNTIME_RUN_DIR_MARKERS = [
826
600
  OBSERVER_FILE,
827
601
  FAILURE_FILE
828
602
  ];
829
- function record(value) {
830
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
831
- }
832
- function nonEmptyString(value) {
833
- return typeof value === "string" && value.length > 0 ? value : null;
834
- }
835
603
  function profileDigest(event) {
836
604
  const direct = nonEmptyString(event.profileDigest);
837
605
  if (direct !== null) return direct;
838
- const identity = record(event.identity);
606
+ const identity = recordOrNull(event.identity);
839
607
  return identity === null ? null : nonEmptyString(identity.profileDigest);
840
608
  }
841
609
  function formatError(path, line, detail) {
@@ -855,7 +623,7 @@ function parseEnvelopeJournal(text, path) {
855
623
  } catch {
856
624
  throw formatError(path, line, "line is not JSON");
857
625
  }
858
- const envelope = record(parsed);
626
+ const envelope = recordOrNull(parsed);
859
627
  if (envelope === null) throw formatError(path, line, "line is not an object");
860
628
  const kind = nonEmptyString(envelope.kind);
861
629
  const root = nonEmptyString(envelope.root);
@@ -875,7 +643,7 @@ function parseEnvelopeJournal(text, path) {
875
643
  }
876
644
  if (kind !== "event") throw formatError(path, line, "kind must be 'begin' or 'event'");
877
645
  if (!begun.has(root)) throw formatError(path, line, `event for tree ${JSON.stringify(root)} precedes begin`);
878
- const event = record(envelope.event);
646
+ const event = recordOrNull(envelope.event);
879
647
  if (event === null) throw formatError(path, line, "event must be an object");
880
648
  if (nonEmptyString(event.kind) === null) throw formatError(path, line, "event.kind must be a non-empty string");
881
649
  events.push({
@@ -960,76 +728,39 @@ function parseEnvelopeJournal(text, path) {
960
728
  const normalized = events.filter((entry) => !(nestedRoots.has(entry.root) && isRootMarker(entry))).map((entry) => {
961
729
  const event = { ...entry.event };
962
730
  if (event.kind === "spawned") {
963
- const digest = profileDigest(event);
964
- if (event.profileDigest === void 0 && digest !== null) event.profileDigest = digest;
965
- if (event.role === void 0) event.role = supervisorIds.has(nonEmptyString(event.id) ?? "") ? "supervisor" : "worker";
966
- }
967
- return {
968
- root: entry.root,
969
- event
970
- };
971
- });
972
- if ((rootMarkersByTree.get(top.root) ?? []).length !== 1) throw formatError(path, top.line, `top-level tree ${JSON.stringify(top.root)} must contain one root marker`);
973
- return {
974
- root: top.root,
975
- startedAt: top.at,
976
- journal: `${normalized.map((entry) => JSON.stringify({
977
- kind: "event",
978
- root: entry.root,
979
- event: entry.event
980
- })).join("\n")}\n`,
981
- events: normalized.map((entry) => entry.event)
982
- };
983
- }
984
- function parseOptionalRecord(text, path) {
985
- if (text === null) return null;
986
- let parsed;
987
- try {
988
- parsed = JSON.parse(text);
989
- } catch {
990
- throw new Error(`${path}: invalid JSON`);
991
- }
992
- const value = record(parsed);
993
- if (value === null) throw new Error(`${path}: expected a JSON object`);
994
- return value;
995
- }
996
- function spendRecord(value) {
997
- const spend = record(value);
998
- if (spend === null) return null;
999
- const tokens = record(spend.tokens);
1000
- if (tokens === null || typeof tokens.input !== "number" || !Number.isFinite(tokens.input) || tokens.input < 0 || typeof tokens.output !== "number" || !Number.isFinite(tokens.output) || tokens.output < 0 || typeof spend.usd !== "number" || !Number.isFinite(spend.usd) || spend.usd < 0 || spend.usdKnown !== void 0 && typeof spend.usdKnown !== "boolean") return null;
1001
- return spend;
1002
- }
1003
- function sourceLimits(root, events, workerIds) {
1004
- const rootMeters = events.filter((event) => event.kind === "metered" && event.id === root);
1005
- const invalidRootMeters = rootMeters.filter((event) => spendRecord(event.spend) === null);
1006
- const rootMeterReason = rootMeters.length === 0 ? "Runtime journal has no root metered event" : invalidRootMeters.length > 0 ? `${invalidRootMeters.length} root metered event(s) lack complete spend` : null;
1007
- const closes = events.filter((event) => workerIds.has(nonEmptyString(event.id) ?? "") && (event.kind === "settled" || event.kind === "cancelled"));
1008
- const settledById = /* @__PURE__ */ new Map();
1009
- for (const event of closes) {
1010
- const id = nonEmptyString(event.id);
1011
- if (id === null) continue;
1012
- const matches = settledById.get(id) ?? [];
1013
- matches.push(event);
1014
- settledById.set(id, matches);
1015
- }
1016
- const incompleteWorkers = [...workerIds].filter((id) => {
1017
- const terminal = settledById.get(id);
1018
- return terminal?.length !== 1 || terminal[0]?.kind !== "settled" || spendRecord(terminal[0]?.spent) === null;
1019
- });
1020
- const missingVerdicts = [...workerIds].filter((id) => {
1021
- const terminal = settledById.get(id)?.[0];
1022
- if (terminal?.kind !== "settled") return true;
1023
- return typeof record(terminal.verdict)?.valid !== "boolean";
731
+ const digest = profileDigest(event);
732
+ if (event.profileDigest === void 0 && digest !== null) event.profileDigest = digest;
733
+ if (event.role === void 0) event.role = supervisorIds.has(nonEmptyString(event.id) ?? "") ? "supervisor" : "worker";
734
+ }
735
+ return {
736
+ root: entry.root,
737
+ event
738
+ };
1024
739
  });
740
+ if ((rootMarkersByTree.get(top.root) ?? []).length !== 1) throw formatError(path, top.line, `top-level tree ${JSON.stringify(top.root)} must contain one root marker`);
1025
741
  return {
1026
- managerTokens: rootMeterReason,
1027
- workerTokens: incompleteWorkers.length === 0 ? null : `${incompleteWorkers.length}/${workerIds.size} child invocation(s) lack one settled spend record`,
1028
- spendUsd: rootMeterReason !== null ? rootMeterReason : incompleteWorkers.length > 0 ? "at least one child invocation lacks a settled spend record" : null,
1029
- workerVerdicts: missingVerdicts.length === 0 ? null : `${missingVerdicts.length}/${workerIds.size} child invocation(s) lack a structured validity verdict`,
1030
- deliverables: workerIds.size === 0 ? null : "Runtime FileRunContext does not retain per-child delivered patches"
742
+ root: top.root,
743
+ startedAt: top.at,
744
+ journal: `${normalized.map((entry) => JSON.stringify({
745
+ kind: "event",
746
+ root: entry.root,
747
+ event: entry.event
748
+ })).join("\n")}\n`,
749
+ events: normalized.map((entry) => entry.event)
1031
750
  };
1032
751
  }
752
+ function parseOptionalRecord(text, path) {
753
+ if (text === null) return null;
754
+ let parsed;
755
+ try {
756
+ parsed = JSON.parse(text);
757
+ } catch {
758
+ throw new Error(`${path}: invalid JSON`);
759
+ }
760
+ const value = recordOrNull(parsed);
761
+ if (value === null) throw new Error(`${path}: expected a JSON object`);
762
+ return value;
763
+ }
1033
764
  /**
1034
765
  * Refuse a `result.json` that belongs to another run. Runtime's result carries
1035
766
  * its own `tree.root`; a settled record with a different root is a copied or
@@ -1038,7 +769,7 @@ function sourceLimits(root, events, workerIds) {
1038
769
  function assertResultMatchesJournal(root, result, resultPath) {
1039
770
  const resultKind = result === null ? null : nonEmptyString(result.kind);
1040
771
  if (resultKind === null || result === null) return;
1041
- const resultRoot = nonEmptyString(record(result.tree)?.root);
772
+ const resultRoot = nonEmptyString(recordOrNull(result.tree)?.root);
1042
773
  if (resultRoot === null) throw new Error(`${resultPath}: Runtime ${resultKind} result has no tree.root`);
1043
774
  if (resultRoot !== root) throw new Error(`${resultPath}: root ${JSON.stringify(resultRoot)} does not match journal root ${JSON.stringify(root)}`);
1044
775
  }
@@ -1051,7 +782,7 @@ function assertResultMatchesJournal(root, result, resultPath) {
1051
782
  */
1052
783
  function assertFailureRecord(failure, failurePath) {
1053
784
  if (failure === null) return;
1054
- if (record(failure.error) === null) throw new Error(`${failurePath}: Runtime failure record has no error object`);
785
+ if (recordOrNull(failure.error) === null) throw new Error(`${failurePath}: Runtime failure record has no error object`);
1055
786
  }
1056
787
  /**
1057
788
  * The journal's begin stamp in the analyzer's state-document shape. It carries
@@ -1097,12 +828,12 @@ async function receiptSessionFiles(file) {
1097
828
  } catch {
1098
829
  return;
1099
830
  }
1100
- const harness = record(descriptor)?.harness;
1101
- const files = record(descriptor)?.files;
831
+ const harness = recordOrNull(descriptor)?.harness;
832
+ const files = recordOrNull(descriptor)?.files;
1102
833
  const pattern = typeof harness === "string" ? HARNESS_SESSION_FILE[harness] : void 0;
1103
834
  if (pattern === void 0 || !Array.isArray(files)) return void 0;
1104
835
  return files.filter((entry) => {
1105
- const path = record(entry)?.path;
836
+ const path = recordOrNull(entry)?.path;
1106
837
  return typeof path === "string" && pattern.test(path);
1107
838
  }).length;
1108
839
  }
@@ -1160,23 +891,23 @@ async function workspaceCapturesFromOutput(runDir, ref) {
1160
891
  addressGap = "Runtime output cannot be canonically hashed";
1161
892
  }
1162
893
  const project = (rawReceipt, receiptPointer) => {
1163
- const receipt = record(rawReceipt);
894
+ const receipt = recordOrNull(rawReceipt);
1164
895
  if (receipt === null) return {
1165
896
  ...missing(`workspaceCapture receipt is absent or malformed${addressGap === null ? "" : `; ${addressGap}`}`),
1166
897
  receiptPointer,
1167
898
  receipt: rawReceipt
1168
899
  };
1169
- const provenance = record(receipt.provenance);
900
+ const provenance = recordOrNull(receipt.provenance);
1170
901
  const attempts = Array.isArray(provenance?.attempts) ? provenance.attempts : null;
1171
902
  const coverageComplete = typeof receipt.coverageComplete === "boolean" ? receipt.coverageComplete : null;
1172
903
  const incompleteReason = typeof receipt.incompleteReason === "string" ? receipt.incompleteReason : null;
1173
904
  const gaps = [];
1174
905
  if (addressGap !== null) gaps.push(addressGap);
1175
906
  if (coverageComplete === null) gaps.push("workspaceCapture.coverageComplete is absent");
1176
- if (record(receipt.snapshot) === null) gaps.push("workspaceCapture.snapshot is absent");
907
+ if (recordOrNull(receipt.snapshot) === null) gaps.push("workspaceCapture.snapshot is absent");
1177
908
  if (provenance === null) gaps.push("workspaceCapture.provenance is absent");
1178
909
  if (attempts === null) gaps.push("workspaceCapture.provenance.attempts is absent");
1179
- else if (attempts.length === 0 || attempts.some((attempt) => record(attempt) === null)) gaps.push("workspaceCapture.provenance.attempts is empty or malformed");
910
+ else if (attempts.length === 0 || attempts.some((attempt) => recordOrNull(attempt) === null)) gaps.push("workspaceCapture.provenance.attempts is empty or malformed");
1180
911
  return {
1181
912
  outRef,
1182
913
  blobPath,
@@ -1188,7 +919,7 @@ async function workspaceCapturesFromOutput(runDir, ref) {
1188
919
  projectionGap: gaps.length > 0 ? gaps.join("; ") : null
1189
920
  };
1190
921
  };
1191
- const result = record(output);
922
+ const result = recordOrNull(output);
1192
923
  const captures = [];
1193
924
  for (const key of Object.keys(result ?? {})) if (key === "workspaceCapture") captures.push(project(result?.[key], "/workspaceCapture"));
1194
925
  else if (key === "workspaceCaptures") {
@@ -1253,8 +984,8 @@ async function nodeTranscripts(runDir, events, nodeIds, root) {
1253
984
  });
1254
985
  }
1255
986
  }
1256
- if (event.kind === "execution-admitted" && record(event.admission)?.phase === "dispatched") entry(id).dispatched += 1;
1257
- else if (event.kind === "settled" || event.kind === "cancelled" || event.kind === "reconciled") keepReceipt(entry(id), record(event.harnessTranscript));
987
+ if (event.kind === "execution-admitted" && recordOrNull(event.admission)?.phase === "dispatched") entry(id).dispatched += 1;
988
+ else if (event.kind === "settled" || event.kind === "cancelled" || event.kind === "reconciled") keepReceipt(entry(id), recordOrNull(event.harnessTranscript));
1258
989
  }
1259
990
  if (root !== void 0 && nodeIds.has(root.id)) keepReceipt(entry(root.id), root.receipt);
1260
991
  const out = /* @__PURE__ */ new Map();
@@ -1316,7 +1047,7 @@ async function nodeTranscripts(runDir, events, nodeIds, root) {
1316
1047
  * instead of `?`.
1317
1048
  */
1318
1049
  function recordedRunId(result, failure) {
1319
- return nonEmptyString(record(result?.tree)?.root) ?? nonEmptyString(failure?.runId);
1050
+ return nonEmptyString(recordOrNull(result?.tree)?.root) ?? nonEmptyString(failure?.runId);
1320
1051
  }
1321
1052
  function absentRuntimeSupervisorRun(runDir, resultText, failureText, instanceId) {
1322
1053
  const reason = `no Runtime spawn journal (${JOURNAL_FILE}) under ${runDir}`;
@@ -1381,7 +1112,7 @@ async function readRuntimeSupervisorRun(runDir, opts = {}) {
1381
1112
  const workerIds = new Set(childSpawns.map((event) => nonEmptyString(event.id)).filter((id) => id !== null));
1382
1113
  const transcripts = await nodeTranscripts(runDir, normalized.events, /* @__PURE__ */ new Set([normalized.root, ...workerIds]), {
1383
1114
  id: normalized.root,
1384
- receipt: record(result?.rootHarnessTranscript)
1115
+ receipt: recordOrNull(result?.rootHarnessTranscript)
1385
1116
  });
1386
1117
  const workers = childSpawns.map((event) => {
1387
1118
  const workerId = nonEmptyString(event.id);
@@ -1430,13 +1161,6 @@ async function readRuntimeSupervisorRun(runDir, opts = {}) {
1430
1161
  traceCommand: nativeTraceSummary(workers, transcripts.get(normalized.root))
1431
1162
  };
1432
1163
  }
1433
- /** The agent-runtime file-backed layout as a `SupervisorRunReader`. */
1434
- function runtimeSupervisorRunReader(runDir, opts = {}) {
1435
- return {
1436
- runRef: runDir,
1437
- read: () => readRuntimeSupervisorRun(runDir, opts)
1438
- };
1439
- }
1440
1164
  /**
1441
1165
  * True when a directory holds any file only Runtime's durable layer writes:
1442
1166
  * the spawn journal, the observer journal, or the failure record. A run that
@@ -1475,56 +1199,6 @@ function isReader(input) {
1475
1199
  return typeof input.read === "function";
1476
1200
  }
1477
1201
  /**
1478
- * Read a completed run, write `run-report.json` + `run-report.md` beside its
1479
- * artifacts, and append the headline block to the run log. Never throws on a
1480
- * missing artifact — a run that produced nothing still yields a report whose
1481
- * every metric says why.
1482
- */
1483
- async function writeSupervisorRunReport(runDir, opts = {}) {
1484
- const report = analyzeSupervisorRunSources(await readRuntimeSupervisorRun(runDir));
1485
- const md = renderSupervisorRunMarkdown(report);
1486
- const dest = opts.reportDir ?? runDir;
1487
- const stem = opts.reportDir === void 0 ? "run-report" : supervisorReportStem(runDir);
1488
- if (opts.reportDir !== void 0) await mkdir(opts.reportDir, { recursive: true }).catch(() => {});
1489
- await writeFile(join(dest, `${stem}.json`), JSON.stringify(report, null, 1)).catch(() => {});
1490
- await writeFile(join(dest, `${stem}.md`), md).catch(() => {});
1491
- const headline = renderSupervisorRunHeadline(report);
1492
- if (opts.appendHeadlineTo !== void 0) await appendFile(opts.appendHeadlineTo, `${headline}\n`).catch(() => {});
1493
- if (opts.echo !== false) console.log(headline);
1494
- return report;
1495
- }
1496
- /**
1497
- * File stem for out-of-tree reports. Built from the run path's identifying
1498
- * segments — candidate tag (the segment under `arm-runs/`), rep, instance, arm
1499
- * — so two runs of the same instance from different candidates/reps never
1500
- * overwrite each other.
1501
- */
1502
- function supervisorReportStem(runDir) {
1503
- const parts = runDir.split("/").filter(Boolean);
1504
- const arm = parts[parts.length - 1] ?? "cell";
1505
- const iid = parts[parts.length - 2] ?? "instance";
1506
- const rep = parts.find((p) => /^rep-\d+$/.test(p));
1507
- const armRunsIdx = parts.indexOf("arm-runs");
1508
- return [
1509
- armRunsIdx >= 0 ? parts[armRunsIdx + 1] : void 0,
1510
- rep,
1511
- iid,
1512
- arm
1513
- ].filter((s) => s !== void 0 && s !== "runs").join(".").replace(/[^A-Za-z0-9._-]/g, "_");
1514
- }
1515
- /**
1516
- * Best-effort wrapper for a hot path: a reporting failure must never kill a run
1517
- * that already produced real work. Returns null and logs the reason instead.
1518
- */
1519
- async function writeSupervisorRunReportSafe(runDir, opts = {}) {
1520
- try {
1521
- return await writeSupervisorRunReport(runDir, opts);
1522
- } catch (err) {
1523
- console.log(`RUN-REPORT failed for ${runDir}: ${err instanceof Error ? err.message : String(err)}`);
1524
- return null;
1525
- }
1526
- }
1527
- /**
1528
1202
  * Every Runtime supervisor run below `root`.
1529
1203
  *
1530
1204
  * When `root` itself is one run, return no children so callers can distinguish
@@ -1551,109 +1225,212 @@ async function findSupervisorRunDirs(root) {
1551
1225
  return found.sort();
1552
1226
  }
1553
1227
  //#endregion
1554
- //#region src/supervisor-run/report-command.ts
1228
+ //#region src/supervisor-run/render.ts
1555
1229
  /**
1556
- * `agent-eval supervisor-run report <runDir>` takes one run directory and
1557
- * prints the report the module already renders. The command reads through
1558
- * `analyzeSupervisorRun`, so a Runtime run directory takes the
1559
- * same path and the status comes from the record `terminal-record.ts` names.
1560
- *
1561
- * Exit codes follow the other self-parsing subcommands: 2 for a usage error,
1562
- * 1 when the directory cannot be read (missing, not a directory, or a corrupt
1563
- * journal or terminal record), 0 after the report was written to stdout.
1230
+ * Human-readable renderings of a supervisor-run report. Zero and unavailable
1231
+ * render differently on purpose (`0` vs `unavailable — <reason>`), because the
1232
+ * two have driven opposite conclusions about the same architecture.
1564
1233
  */
1565
- const FORMATS = [
1566
- "headline",
1567
- "markdown",
1568
- "json"
1569
- ];
1570
- const SUPERVISOR_RUN_USAGE = "usage: agent-eval supervisor-run report <runDir> [--format headline|markdown|json]";
1571
- const PROCESS_IO = {
1572
- stdout: (text) => {
1573
- process.stdout.write(text);
1574
- },
1575
- stderr: (text) => {
1576
- process.stderr.write(text);
1577
- }
1578
- };
1579
- function isFormat(value) {
1580
- return FORMATS.includes(value);
1581
- }
1582
- function parseReportArgs(argv) {
1583
- let runDir = null;
1584
- let format = "headline";
1585
- for (let i = 0; i < argv.length; i++) {
1586
- const arg = argv[i];
1587
- if (arg === "--format") {
1588
- const raw = argv[++i];
1589
- if (raw === void 0 || !isFormat(raw)) throw new Error(`--format expects one of ${FORMATS.join("|")}, got ${JSON.stringify(raw ?? "")}`);
1590
- format = raw;
1591
- } else if (arg.startsWith("--format=")) {
1592
- const raw = arg.slice(9);
1593
- if (!isFormat(raw)) throw new Error(`--format expects one of ${FORMATS.join("|")}, got ${JSON.stringify(raw)}`);
1594
- format = raw;
1595
- } else if (arg.startsWith("--")) throw new Error(`unknown flag "${arg}"`);
1596
- else if (runDir === null) runDir = arg;
1597
- else throw new Error(`unexpected argument "${arg}"`);
1598
- }
1599
- if (runDir === null) throw new Error(SUPERVISOR_RUN_USAGE);
1600
- return {
1601
- runDir,
1602
- format
1603
- };
1604
- }
1605
- function errorMessage(error) {
1606
- return error instanceof Error ? error.message : String(error);
1234
+ /**
1235
+ * The block appended to a run log after every run — the answers an operator asks
1236
+ * for, in the log tail, with no extra command.
1237
+ */
1238
+ function renderSupervisorRunHeadline(r) {
1239
+ const o = r.orchestration;
1240
+ const steerNote = isUnavailable(o.steers) ? `unavailable — ${o.steers.unavailable}` : o.steers === 0 ? "0 (spawn→wait→respawn only; no mid-task steering)" : `${o.steers} queued / ${showMeasured(o.steersDelivered)} delivered`;
1241
+ return [
1242
+ `RUN-REPORT ${r.instanceId ?? "?"} [${r.arm ?? "?"}]`,
1243
+ ` status=${showMeasured(r.outcome.supStatus)} source=${showMeasured(r.outcome.supStatusSource)} reason=${showMeasured(r.outcome.supReason)} failure=${fmtFailure(r.outcome.failure)}`,
1244
+ ` steers=${steerNote}`,
1245
+ ` waves=${showMeasured(o.waves)} sizes=${isUnavailable(o.waveSizes) ? `unavailable — ${o.waveSizes.unavailable}` : `[${o.waveSizes.join(",")}]`} workers=${showMeasured(o.workersSpawned)} settled=${showMeasured(o.workersSettled)} cancelled=${showMeasured(o.workersCancelled)}`,
1246
+ ` concurrency max=${showMeasured(o.maxConcurrency)} utilization=${showMeasured(o.workerUtilization)} idle=${fmtMs(o.idleMs)} (${showMeasured(o.idlePct)}%) wall=${fmtMs(o.supervisorWallMs)}${o.supervisorWallSource === "journal-span" ? " (journal-span lower bound)" : ""}`,
1247
+ ` respawns=${showMeasured(o.respawns)} evidence→respawn=${showMeasured(r.decision.observeThenRespawn)} blind-respawn=${showMeasured(r.decision.respawnWithoutEvidence)} depth=${showMeasured(o.delegationDepth)}`,
1248
+ ` accepted=${showMeasured(r.decision.accepted)} rejected=${showMeasured(r.decision.rejected)} empty-pass=${showMeasured(r.decision.emptyPass)}`,
1249
+ ` brain=$${showMeasured(r.economics.brain.usd)} total=$${showMeasured(r.economics.totalUsd)} judge.resolved=${showMeasured(r.outcome.judgeResolved)} score=${showMeasured(r.outcome.judgeScore)} verify=${showMeasured(r.outcome.verifyPass)}`,
1250
+ r.gaps.length > 0 ? ` gaps(${r.gaps.length}): ${r.gaps.join("; ")}` : " gaps: none"
1251
+ ].join("\n");
1607
1252
  }
1608
1253
  /**
1609
- * CLI driver for `agent-eval supervisor-run`. `argv` is everything after the
1610
- * command name, so `['report', runDir, ...flags]`. Returns the process exit code.
1254
+ * The recorded error on one line; `none recorded` and `unavailable` stay
1255
+ * distinct, and a throw the run outlived is labeled so it is not read as the
1256
+ * outcome of the settled result beside it.
1611
1257
  */
1612
- async function runSupervisorRunCommand(argv, io = PROCESS_IO) {
1613
- const [verb, ...rest] = argv;
1614
- if (verb === void 0 || verb === "--help" || verb === "-h" || verb === "help") {
1615
- io.stdout(`${SUPERVISOR_RUN_USAGE}\n`);
1616
- return verb === void 0 ? 2 : 0;
1617
- }
1618
- if (verb !== "report") {
1619
- io.stderr(`unknown supervisor-run subcommand "${verb}"\n${SUPERVISOR_RUN_USAGE}\n`);
1620
- return 2;
1621
- }
1622
- if (rest.includes("--help") || rest.includes("-h")) {
1623
- io.stdout(`${SUPERVISOR_RUN_USAGE}\n`);
1624
- return 0;
1258
+ function fmtFailure(v) {
1259
+ if (isUnavailable(v)) return `unavailable — ${v.unavailable}`;
1260
+ if (v === null) return "none recorded";
1261
+ const name = v.name ?? "unavailable — record has no error.name";
1262
+ const message = v.message ?? "unavailable — record has no error.message";
1263
+ const attempt = v.earlierAttempt ? ", earlier attempt" : "";
1264
+ return `${name}: ${message} [${v.source}${v.at === null ? "" : ` at ${v.at}`}${attempt}]`;
1265
+ }
1266
+ function resourceRows(records) {
1267
+ if (isUnavailable(records)) return [`unavailable — ${records.unavailable}`, ""];
1268
+ const out = [
1269
+ "Receipts are source records, not additive totals.",
1270
+ "A false completeness flag means the amount is a recorded subtotal, not complete usage.",
1271
+ "",
1272
+ "| Node | Source | Resource | Unit | Amount | Known |",
1273
+ "|---|---|---|---|---:|---|"
1274
+ ];
1275
+ const cell = (value) => value.replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
1276
+ for (const record of records) {
1277
+ const prefix = `| ${cell(record.nodeId ?? "unavailable")} | ${cell(record.source)} |`;
1278
+ if (isUnavailable(record.resources)) out.push(`${prefix} ${cell(showMeasured(record.resources))} | — | — | — |`);
1279
+ else if (record.resources.length === 0) out.push(`${prefix} recorded empty map | — | — | — |`);
1280
+ else for (const receipt of record.resources) out.push(`${prefix} ${cell(showMeasured(receipt.name))} | ${cell(showMeasured(receipt.unit))} | ${cell(showMeasured(receipt.amount))} | ${cell(showMeasured(receipt.known))} |`);
1625
1281
  }
1626
- let args;
1627
- try {
1628
- args = parseReportArgs(rest);
1629
- } catch (error) {
1630
- io.stderr(`${errorMessage(error)}\n`);
1631
- return 2;
1282
+ if (!records.length) out.push("| — | — | no spend records | — | — | — |");
1283
+ out.push("");
1284
+ return out;
1285
+ }
1286
+ function fmtMs(v) {
1287
+ if (isUnavailable(v)) return `unavailable — ${v.unavailable}`;
1288
+ if (v < 1e3) return `${v}ms`;
1289
+ const s = v / 1e3;
1290
+ if (s < 120) return `${roundDecimal(s, 1)}s`;
1291
+ return `${roundDecimal(s / 60, 1)}min`;
1292
+ }
1293
+ function renderSupervisorRunMarkdown(r) {
1294
+ const o = r.orchestration;
1295
+ const d = r.decision;
1296
+ const e = r.economics;
1297
+ const out = [];
1298
+ out.push(`# Run report — ${r.instanceId ?? "unknown instance"} [${r.arm ?? "unknown arm"}]`);
1299
+ out.push("");
1300
+ out.push("```");
1301
+ out.push(renderSupervisorRunHeadline(r));
1302
+ out.push("```");
1303
+ out.push("");
1304
+ out.push(`- Run: \`${r.runRef}\``);
1305
+ out.push(`- Supervisor: \`${showMeasured(r.supervisorId)}\``);
1306
+ out.push(`- Supervisor profile: \`${showMeasured(r.supervisorProfileDigest)}\``);
1307
+ out.push(`- Generated: ${r.generatedAt}`);
1308
+ out.push("");
1309
+ out.push("## Orchestration");
1310
+ out.push("");
1311
+ out.push("| Metric | Value |");
1312
+ out.push("|---|---|");
1313
+ out.push(`| Workers spawned | ${showMeasured(o.workersSpawned)} |`);
1314
+ out.push(`| Workers settled | ${showMeasured(o.workersSettled)} |`);
1315
+ out.push(`| Workers cancelled | ${showMeasured(o.workersCancelled)} |`);
1316
+ out.push(`| **Steers (mid-task messages to live workers)** | **${showMeasured(o.steers)}** |`);
1317
+ out.push(`| Steers delivered | ${showMeasured(o.steersDelivered)} |`);
1318
+ out.push(`| Outer-driver \`supervisor_steer\` calls | ${showMeasured(o.driverSteerCalls)} |`);
1319
+ out.push(`| Spawn waves | ${showMeasured(o.waves)} |`);
1320
+ out.push(`| Wave sizes | ${isUnavailable(o.waveSizes) ? showMeasured(o.waveSizes) : `[${o.waveSizes.join(", ")}]`} |`);
1321
+ out.push(`| Max concurrency | ${showMeasured(o.maxConcurrency)} |`);
1322
+ out.push(`| Respawns (after same parent's first settle) | ${showMeasured(o.respawns)} |`);
1323
+ out.push(`| Repeated labels | ${isUnavailable(o.repeatedLabels) ? showMeasured(o.repeatedLabels) : o.repeatedLabels.length === 0 ? "none" : o.repeatedLabels.join(", ")} |`);
1324
+ out.push(`| Delegation depth | ${showMeasured(o.delegationDepth)} |`);
1325
+ out.push(`| Time to first spawn | ${fmtMs(o.timeToFirstSpawnMs)} |`);
1326
+ out.push(`| Supervisor wall | ${fmtMs(o.supervisorWallMs)}${isUnavailable(o.supervisorWallSource) ? "" : ` (source: ${o.supervisorWallSource}${o.supervisorWallSource === "journal-span" ? ", lower bound" : ""})`} |`);
1327
+ out.push(`| Idle (zero live workers) | ${fmtMs(o.idleMs)} (${showMeasured(o.idlePct)}%) |`);
1328
+ out.push(`| Worker utilization (Σ worker wall ÷ supervisor wall) | ${showMeasured(o.workerUtilization)} |`);
1329
+ out.push("");
1330
+ if (!isUnavailable(o.steersByWorker) && o.steersByWorker.length > 0) {
1331
+ out.push("### Steers per worker");
1332
+ out.push("");
1333
+ out.push("| Worker id | Label | Queued | Delivered |");
1334
+ out.push("|---|---|---:|---:|");
1335
+ for (const s of o.steersByWorker) out.push(`| ${s.workerId === null ? "unavailable — worker id absent; label join used" : `\`${s.workerId}\``} | \`${s.worker}\` | ${s.queued} | ${s.delivered} |`);
1336
+ out.push("");
1337
+ } else if (isUnavailable(o.steersByWorker)) out.push(`### Steers per worker\n\nunavailable — ${o.steersByWorker.unavailable}\n`);
1338
+ out.push("## Decision quality");
1339
+ out.push("");
1340
+ out.push("| Metric | Value |");
1341
+ out.push("|---|---|");
1342
+ out.push(`| Settled by status | ${fmtCounts(d.settledByStatus)} |`);
1343
+ out.push(`| Settled verdicts | ${fmtCounts(d.settledVerdicts)} |`);
1344
+ out.push(`| Accepted (verify green + patch bytes) | ${showMeasured(d.accepted)} |`);
1345
+ out.push(`| Rejected (verify red) | ${showMeasured(d.rejected)} |`);
1346
+ out.push(`| Empty pass (green, no patch) | ${showMeasured(d.emptyPass)} |`);
1347
+ out.push(`| Evidence → respawn sequences | ${showMeasured(d.observeThenRespawn)} |`);
1348
+ out.push(`| Respawn with no same-parent settled evidence in front | ${showMeasured(d.respawnWithoutEvidence)} |`);
1349
+ out.push(`| Review actions (steers + worker questions) | ${showMeasured(d.reviewActions)} |`);
1350
+ out.push(`| Worker evidence returned | ${isUnavailable(d.workerEvidenceBytes) ? showMeasured(d.workerEvidenceBytes) : `${d.workerEvidenceBytes} bytes`} |`);
1351
+ out.push("");
1352
+ out.push("## Economics");
1353
+ out.push("");
1354
+ out.push("| Role | Tokens in | Tokens out | Cache read | Cache write | USD | Source |");
1355
+ out.push("|---|---:|---:|---:|---:|---:|---|");
1356
+ out.push(`| brain | ${showMeasured(e.brain.tokensIn)} | ${showMeasured(e.brain.tokensOut)} | ${showMeasured(e.brain.cacheRead)} | ${showMeasured(e.brain.cacheWrite)} | ${showMeasured(e.brain.usd)} | ${e.brain.source} |`);
1357
+ out.push(`| workers | ${showMeasured(e.workers.tokensIn)} | ${showMeasured(e.workers.tokensOut)} | ${showMeasured(e.workers.cacheRead)} | ${showMeasured(e.workers.cacheWrite)} | ${showMeasured(e.workers.usd)} | ${e.workers.source} |`);
1358
+ out.push("");
1359
+ if (!isUnavailable(e.brainTruncations) && e.brainTruncations > 0) out.push(`- **BRAIN OUTPUT TRUNCATED: ${e.brainTruncations} completion(s) hit \`finish_reason: "length"\`** — the supervisor acted on a half-written plan. Its output ceiling is too low; see \`brain.jsonl\` for the per-call \`req_max_tokens\`.`);
1360
+ else out.push(`- Brain completions truncated (finish_reason=length): ${showMeasured(e.brainTruncations)}`);
1361
+ out.push(`- Total USD: ${showMeasured(e.totalUsd)} (source: ${e.totalUsdSource})`);
1362
+ out.push(`- Spend measured two ways: journal-derived $${showMeasured(e.spend.journalDerived.usd)} over ${e.spend.journalDerived.records} journal record(s) (execution accounting) · close-record $${showMeasured(e.spend.closeRecord.usd)} over ${e.spend.closeRecord.records} close record(s) (billing-shaped). Divergence is a signal, not an error.`);
1363
+ out.push(`- Cost per accepted patch: ${showMeasured(e.costPerAcceptedPatchUsd)}`);
1364
+ if (isUnavailable(e.workerWallMsDistribution)) out.push(`- Worker wall distribution: unavailable — ${e.workerWallMsDistribution.unavailable}`);
1365
+ else {
1366
+ const w = e.workerWallMsDistribution;
1367
+ out.push(`- Worker wall (n=${w.n}): min ${fmtMs(w.min)} / p50 ${fmtMs(w.p50)} / p90 ${fmtMs(w.p90)} / max ${fmtMs(w.max)} / Σ ${fmtMs(w.sum)}`);
1632
1368
  }
1633
- const runDir = resolve(args.runDir);
1634
- const entry = await stat(runDir).catch(() => null);
1635
- if (entry === null || !entry.isDirectory()) {
1636
- io.stderr(`[agent-eval] supervisor-run report: ${runDir} is not a directory\n`);
1637
- return 1;
1369
+ out.push("");
1370
+ if (!isUnavailable(e.perWorker) && e.perWorker.length > 0) {
1371
+ out.push("| Worker id | Label | Role | Runtime | Profile digest | Status | Failure | Infra | Wall | Tokens in | Tokens out | Patch bytes | Verify passed | Score |");
1372
+ out.push("|---|---|---|---|---|---|---|---|---:|---:|---:|---:|---|---:|");
1373
+ for (const w of e.perWorker) out.push(`| ${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"} |`);
1374
+ out.push("");
1638
1375
  }
1639
- try {
1640
- const report = await analyzeSupervisorRun(runDir);
1641
- switch (args.format) {
1642
- case "headline":
1643
- io.stdout(`${renderSupervisorRunHeadline(report)}\n`);
1644
- break;
1645
- case "markdown":
1646
- io.stdout(renderSupervisorRunMarkdown(report));
1647
- break;
1648
- case "json": io.stdout(`${JSON.stringify(report, null, 2)}\n`);
1649
- }
1650
- return 0;
1651
- } catch (error) {
1652
- io.stderr(`[agent-eval] supervisor-run report failed for ${runDir}: ${errorMessage(error)}\n`);
1653
- return 1;
1376
+ if (e.resourceRecords !== void 0) out.push("## Named resource receipts", "", ...resourceRows(e.resourceRecords));
1377
+ out.push("## Outcome");
1378
+ out.push("");
1379
+ out.push("| Metric | Value |");
1380
+ out.push("|---|---|");
1381
+ out.push(`| Supervisor status | ${showMeasured(r.outcome.supStatus)} |`);
1382
+ out.push(`| Status source | ${showMeasured(r.outcome.supStatusSource)} |`);
1383
+ out.push(`| Terminal reason | ${showMeasured(r.outcome.supReason)} |`);
1384
+ out.push(`| Failure | ${fmtFailure(r.outcome.failure)} |`);
1385
+ out.push(`| Supervisor verdict | ${showMeasured(r.outcome.supVerdict)} |`);
1386
+ out.push(`| Delivered | ${showMeasured(r.outcome.delivered)} |`);
1387
+ out.push(`| Judge resolved | ${showMeasured(r.outcome.judgeResolved)} |`);
1388
+ out.push(`| Judge score | ${showMeasured(r.outcome.judgeScore)} |`);
1389
+ out.push(`| Judge passed / total | ${showMeasured(r.outcome.judgePassed)} / ${showMeasured(r.outcome.judgeTotal)} |`);
1390
+ out.push(`| Judge source | ${r.outcome.judgeSource ?? "unavailable — no judge.json and no ledger row"} |`);
1391
+ out.push(`| Verify gate | pass=${showMeasured(r.outcome.verifyPass)} rc=${showMeasured(r.outcome.verifyRc)} |`);
1392
+ if (isUnavailable(r.outcome.patch)) out.push(`| Patch | unavailable — ${r.outcome.patch.unavailable} |`);
1393
+ else {
1394
+ const p = r.outcome.patch;
1395
+ out.push(`| Patch | ${p.files} file(s), +${p.linesAdded}/-${p.linesRemoved}, test files touched: ${p.testFilesTouched.length === 0 ? "none" : p.testFilesTouched.join(", ")} |`);
1654
1396
  }
1397
+ out.push("");
1398
+ out.push("## Gaps");
1399
+ out.push("");
1400
+ if (r.gaps.length === 0) out.push("None — every metric above is backed by a present artifact.");
1401
+ else for (const g of r.gaps) out.push(`- ${g}`);
1402
+ out.push("");
1403
+ out.push(`> Harness-session view of the same run (model calls, stuck loops, tool errors): \`${r.traceCommand}\``);
1404
+ out.push("");
1405
+ return out.join("\n");
1406
+ }
1407
+ function fmtCounts(v) {
1408
+ if (isUnavailable(v)) return showMeasured(v);
1409
+ const entries = Object.entries(v);
1410
+ return entries.length === 0 ? "none" : entries.map(([k, n]) => `${k}=${n}`).join(", ");
1411
+ }
1412
+ function renderSupervisorRollupMarkdown(rollup, title = "Round rollup") {
1413
+ const out = [];
1414
+ out.push(`# ${title}`);
1415
+ out.push("");
1416
+ out.push(`- Cells: ${rollup.cells}`);
1417
+ out.push(`- **Steers across all cells: ${showMeasured(rollup.steersTotal)}** (cells with ≥1 steer: ${showMeasured(rollup.cellsWithSteers)}; cells where the steer count is unavailable: ${rollup.cellsWithUnavailableSteers})`);
1418
+ out.push(`- Waves per cell (mean): ${showMeasured(rollup.wavesMean)}`);
1419
+ out.push(`- Max concurrency observed: ${showMeasured(rollup.maxConcurrencyMax)}`);
1420
+ out.push(`- Worker utilization (mean): ${showMeasured(rollup.utilizationMean)}`);
1421
+ out.push(`- Idle share (mean): ${showMeasured(rollup.idlePctMean)}%`);
1422
+ out.push(`- Workers spawned: ${showMeasured(rollup.workersSpawnedTotal)} · accepted: ${showMeasured(rollup.acceptedTotal)}`);
1423
+ out.push(`- Spend: $${showMeasured(rollup.usdTotal)} · judged resolved: ${showMeasured(rollup.resolvedCount)}/${rollup.cells}`);
1424
+ out.push(`- Spend measured two ways: journal-derived $${showMeasured(rollup.spendUsd.journalDerived.value)} over ${rollup.spendUsd.journalDerived.runs}/${rollup.cells} runs (execution accounting) · close-record $${showMeasured(rollup.spendUsd.closeRecord.value)} over ${rollup.spendUsd.closeRecord.runs}/${rollup.cells} runs (billing-shaped)`);
1425
+ out.push("");
1426
+ out.push("| Instance | Arm | Steers | Waves | Utilization | Idle % | Resolved | USD |");
1427
+ out.push("|---|---|---:|---:|---:|---:|---|---:|");
1428
+ for (const c of rollup.perCell) out.push(`| ${c.instanceId ?? "?"} | ${c.arm ?? "?"} | ${showMeasured(c.steers)} | ${showMeasured(c.waves)} | ${showMeasured(c.utilization)} | ${showMeasured(c.idlePct)} | ${showMeasured(c.resolved)} | ${showMeasured(c.usd)} |`);
1429
+ out.push("");
1430
+ for (const cell of rollup.perCell) if (cell.resourceRecords !== void 0) out.push(`## Resource receipts — ${cell.instanceId ?? "?"} [${cell.arm ?? "?"}]`, "", ...resourceRows(cell.resourceRecords));
1431
+ return out.join("\n");
1655
1432
  }
1656
1433
  //#endregion
1657
- export { writeSupervisorRunReportSafe as a, runtimeSupervisorRunReader as c, renderSupervisorRunMarkdown as d, analyzeSupervisorRunSources as f, writeSupervisorRunReport as i, renderSupervisorRollupMarkdown as l, rollupSupervisorRuns as m, analyzeSupervisorRun as n, isRuntimeSupervisorRunDir as o, parsePatch as p, findSupervisorRunDirs as r, readRuntimeSupervisorRun as s, runSupervisorRunCommand as t, renderSupervisorRunHeadline as u };
1434
+ export { findSupervisorRunDirs as a, analyzeSupervisorRunSources as c, analyzeSupervisorRun as i, parsePatch as l, renderSupervisorRunHeadline as n, isRuntimeSupervisorRunDir as o, renderSupervisorRunMarkdown as r, readRuntimeSupervisorRun as s, renderSupervisorRollupMarkdown as t };
1658
1435
 
1659
- //# sourceMappingURL=report-command-y8H6RSX8.js.map
1436
+ //# sourceMappingURL=render-C-w2EZ6p.js.map