@tangle-network/agent-eval 0.128.2 → 0.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/CHANGELOG.md +279 -0
  2. package/README.md +19 -0
  3. package/dist/active-curriculum-C4mk67HP.js +214 -0
  4. package/dist/active-curriculum-C4mk67HP.js.map +1 -0
  5. package/dist/adversarial-smnADNFS.d.ts +21 -0
  6. package/dist/adversarial-smnADNFS.d.ts.map +1 -0
  7. package/dist/analyst/index.d.ts +83 -2932
  8. package/dist/analyst/index.d.ts.map +1 -0
  9. package/dist/analyst/index.js +319 -364
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/analyst-BkTS3C58.d.ts +89 -0
  12. package/dist/analyst-BkTS3C58.d.ts.map +1 -0
  13. package/dist/analyst-LsnNpSkm.js +152 -0
  14. package/dist/analyst-LsnNpSkm.js.map +1 -0
  15. package/dist/analyze-runs-C1CavBMk.js +1067 -0
  16. package/dist/analyze-runs-C1CavBMk.js.map +1 -0
  17. package/dist/analyze-runs-FsgYCinh.d.ts +72 -0
  18. package/dist/analyze-runs-FsgYCinh.d.ts.map +1 -0
  19. package/dist/attribute-vocabulary-DLJ6303h.d.ts +54 -0
  20. package/dist/attribute-vocabulary-DLJ6303h.d.ts.map +1 -0
  21. package/dist/authenticity/index.d.ts +81 -79
  22. package/dist/authenticity/index.d.ts.map +1 -0
  23. package/dist/authenticity/index.js +209 -193
  24. package/dist/authenticity/index.js.map +1 -1
  25. package/dist/baseline-HsBvw_dk.js +550 -0
  26. package/dist/baseline-HsBvw_dk.js.map +1 -0
  27. package/dist/baseline-hG3K85h4.d.ts +125 -0
  28. package/dist/baseline-hG3K85h4.d.ts.map +1 -0
  29. package/dist/belief-state/index.d.ts +448 -1205
  30. package/dist/belief-state/index.d.ts.map +1 -0
  31. package/dist/belief-state/index.js +1617 -1710
  32. package/dist/belief-state/index.js.map +1 -1
  33. package/dist/benchmarks/index.d.ts +2 -894
  34. package/dist/benchmarks/index.js +2 -59
  35. package/dist/benchmarks-DviOvUNr.js +754 -0
  36. package/dist/benchmarks-DviOvUNr.js.map +1 -0
  37. package/dist/builder-eval/index.d.ts +150 -662
  38. package/dist/builder-eval/index.d.ts.map +1 -0
  39. package/dist/builder-eval/index.js +356 -345
  40. package/dist/builder-eval/index.js.map +1 -1
  41. package/dist/calibration-CNWWA6K8.js +94 -0
  42. package/dist/calibration-CNWWA6K8.js.map +1 -0
  43. package/dist/campaign/index.d.ts +5 -6390
  44. package/dist/campaign/index.js +3 -212
  45. package/dist/campaign-CBKZvQ1H.js +3885 -0
  46. package/dist/campaign-CBKZvQ1H.js.map +1 -0
  47. package/dist/cli.d.ts +1 -1
  48. package/dist/cli.js +164 -174
  49. package/dist/cli.js.map +1 -1
  50. package/dist/client-C97NMzqi.d.ts +581 -0
  51. package/dist/client-C97NMzqi.d.ts.map +1 -0
  52. package/dist/client-CYzbdJOZ.js +637 -0
  53. package/dist/client-CYzbdJOZ.js.map +1 -0
  54. package/dist/code-agent-session-BjkMTQ7H.js +1390 -0
  55. package/dist/code-agent-session-BjkMTQ7H.js.map +1 -0
  56. package/dist/code-agent-session-DqqgOJaz.d.ts +143 -0
  57. package/dist/code-agent-session-DqqgOJaz.d.ts.map +1 -0
  58. package/dist/concurrency-DIxRZF_J.js +85 -0
  59. package/dist/concurrency-DIxRZF_J.js.map +1 -0
  60. package/dist/contract/index.d.ts +645 -5605
  61. package/dist/contract/index.d.ts.map +1 -0
  62. package/dist/contract/index.js +1730 -1937
  63. package/dist/contract/index.js.map +1 -1
  64. package/dist/control.d.ts +3 -1030
  65. package/dist/control.js +2 -32
  66. package/dist/cost-ledger-DIgQUFZZ.js +801 -0
  67. package/dist/cost-ledger-DIgQUFZZ.js.map +1 -0
  68. package/dist/cost-ledger-Dye6jCgg.d.ts +236 -0
  69. package/dist/cost-ledger-Dye6jCgg.d.ts.map +1 -0
  70. package/dist/dataset-BvtnC8Dc.d.ts +115 -0
  71. package/dist/dataset-BvtnC8Dc.d.ts.map +1 -0
  72. package/dist/default-registry-C-vFCSEc.js +2579 -0
  73. package/dist/default-registry-C-vFCSEc.js.map +1 -0
  74. package/dist/default-registry-CNPo-Vsb.d.ts +540 -0
  75. package/dist/default-registry-CNPo-Vsb.d.ts.map +1 -0
  76. package/dist/emitter-CPBAhxum.js +266 -0
  77. package/dist/emitter-CPBAhxum.js.map +1 -0
  78. package/dist/emitter-DGQGoLyj.d.ts +113 -0
  79. package/dist/emitter-DGQGoLyj.d.ts.map +1 -0
  80. package/dist/errors-8YnH8WlF.js +64 -0
  81. package/dist/errors-8YnH8WlF.js.map +1 -0
  82. package/dist/errors-CEk209JS.d.ts +76 -0
  83. package/dist/errors-CEk209JS.d.ts.map +1 -0
  84. package/dist/eval-campaign-DEm6c8ru.js +349 -0
  85. package/dist/eval-campaign-DEm6c8ru.js.map +1 -0
  86. package/dist/execution-tracks-CpgFPpS5.js +93 -0
  87. package/dist/execution-tracks-CpgFPpS5.js.map +1 -0
  88. package/dist/exporters-q9iL-2Jf.js +148 -0
  89. package/dist/exporters-q9iL-2Jf.js.map +1 -0
  90. package/dist/extract-usage-BrQ8mCLX.js +155 -0
  91. package/dist/extract-usage-BrQ8mCLX.js.map +1 -0
  92. package/dist/failure-cluster-CqcvCcdR.d.ts +59 -0
  93. package/dist/failure-cluster-CqcvCcdR.d.ts.map +1 -0
  94. package/dist/feedback-trajectory-CVaeREXV.d.ts +340 -0
  95. package/dist/feedback-trajectory-CVaeREXV.d.ts.map +1 -0
  96. package/dist/fuzz.d.ts +320 -646
  97. package/dist/fuzz.d.ts.map +1 -0
  98. package/dist/fuzz.js +670 -617
  99. package/dist/fuzz.js.map +1 -1
  100. package/dist/hf-dataset-DBJXXoY1.js +763 -0
  101. package/dist/hf-dataset-DBJXXoY1.js.map +1 -0
  102. package/dist/hosted/index.d.ts +11 -831
  103. package/dist/hosted/index.d.ts.map +1 -0
  104. package/dist/hosted/index.js +2 -37
  105. package/dist/index-2JJSA6-r2.d.ts +926 -0
  106. package/dist/index-2JJSA6-r2.d.ts.map +1 -0
  107. package/dist/index-6N0aYmpW.d.ts +217 -0
  108. package/dist/index-6N0aYmpW.d.ts.map +1 -0
  109. package/dist/index-BAvgST_9.d.ts +131 -0
  110. package/dist/index-BAvgST_9.d.ts.map +1 -0
  111. package/dist/index-BvnJuTGD.d.ts +68 -0
  112. package/dist/index-BvnJuTGD.d.ts.map +1 -0
  113. package/dist/index-C61Wi7yg.d.ts +547 -0
  114. package/dist/index-C61Wi7yg.d.ts.map +1 -0
  115. package/dist/index-CAPUUKaM.d.ts +335 -0
  116. package/dist/index-CAPUUKaM.d.ts.map +1 -0
  117. package/dist/index-DE5fb3EC.d.ts +2244 -0
  118. package/dist/index-DE5fb3EC.d.ts.map +1 -0
  119. package/dist/index-DSC51roc.d.ts +102 -0
  120. package/dist/index-DSC51roc.d.ts.map +1 -0
  121. package/dist/index.d.ts +3776 -15120
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.js +11185 -11191
  124. package/dist/index.js.map +1 -1
  125. package/dist/integrity-BzRbCHzi.js +424 -0
  126. package/dist/integrity-BzRbCHzi.js.map +1 -0
  127. package/dist/integrity-rmVhXWA7.d.ts +61 -0
  128. package/dist/integrity-rmVhXWA7.d.ts.map +1 -0
  129. package/dist/judge-calibration-DFtEMlde.d.ts +146 -0
  130. package/dist/judge-calibration-DFtEMlde.d.ts.map +1 -0
  131. package/dist/ledger-core/index.d.ts +2 -0
  132. package/dist/ledger-core/index.js +2 -0
  133. package/dist/ledger-core-DtZz1RG0.js +388 -0
  134. package/dist/ledger-core-DtZz1RG0.js.map +1 -0
  135. package/dist/llm-client--GR4JbZE.js +687 -0
  136. package/dist/llm-client--GR4JbZE.js.map +1 -0
  137. package/dist/llm-client-B_nIBlYo.d.ts +290 -0
  138. package/dist/llm-client-B_nIBlYo.d.ts.map +1 -0
  139. package/dist/matrix/index.d.ts +3 -155
  140. package/dist/matrix/index.js +2 -8
  141. package/dist/matrix-BzQnu2S6.js +270 -0
  142. package/dist/matrix-BzQnu2S6.js.map +1 -0
  143. package/dist/meta-eval/index.d.ts +4 -1027
  144. package/dist/meta-eval/index.js +393 -390
  145. package/dist/meta-eval/index.js.map +1 -1
  146. package/dist/metrics-C9YY1OcL.js +239 -0
  147. package/dist/metrics-C9YY1OcL.js.map +1 -0
  148. package/dist/mint-yN2M2eh0.js +201 -0
  149. package/dist/mint-yN2M2eh0.js.map +1 -0
  150. package/dist/multi-layer-verifier-BHY1gWAc.d.ts +138 -0
  151. package/dist/multi-layer-verifier-BHY1gWAc.d.ts.map +1 -0
  152. package/dist/multishot/index.d.ts +273 -481
  153. package/dist/multishot/index.d.ts.map +1 -0
  154. package/dist/multishot/index.js +595 -548
  155. package/dist/multishot/index.js.map +1 -1
  156. package/dist/off-policy-DvgzvtIx.js +220 -0
  157. package/dist/off-policy-DvgzvtIx.js.map +1 -0
  158. package/dist/off-policy-mskQw8Mb.d.ts +153 -0
  159. package/dist/off-policy-mskQw8Mb.d.ts.map +1 -0
  160. package/dist/openapi.json +1 -1
  161. package/dist/opencode-sqlite-BGrHeDu3.js +318 -0
  162. package/dist/opencode-sqlite-BGrHeDu3.js.map +1 -0
  163. package/dist/outcome-store-BYHIuO0e.d.ts +65 -0
  164. package/dist/outcome-store-BYHIuO0e.d.ts.map +1 -0
  165. package/dist/outcome-store-ChBKlTd_.js +75 -0
  166. package/dist/outcome-store-ChBKlTd_.js.map +1 -0
  167. package/dist/paired-arms-D9D0wXj2.js +260 -0
  168. package/dist/paired-arms-D9D0wXj2.js.map +1 -0
  169. package/dist/pipelines/index.d.ts +95 -532
  170. package/dist/pipelines/index.d.ts.map +1 -0
  171. package/dist/pipelines/index.js +497 -478
  172. package/dist/pipelines/index.js.map +1 -1
  173. package/dist/pre-registration-DakwTRXk.js +96 -0
  174. package/dist/pre-registration-DakwTRXk.js.map +1 -0
  175. package/dist/propose-review-control-LhIWGzHl.js +1458 -0
  176. package/dist/propose-review-control-LhIWGzHl.js.map +1 -0
  177. package/dist/query-CJ_DX8vl.d.ts +28 -0
  178. package/dist/query-CJ_DX8vl.d.ts.map +1 -0
  179. package/dist/query-Di7eEQ79.js +83 -0
  180. package/dist/query-Di7eEQ79.js.map +1 -0
  181. package/dist/raw-provider-sink-BQd7mzyT.js +201 -0
  182. package/dist/raw-provider-sink-BQd7mzyT.js.map +1 -0
  183. package/dist/raw-provider-sink-BU29Sh8h.d.ts +134 -0
  184. package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +1 -0
  185. package/dist/redact-7Aq1ukl-.js +107 -0
  186. package/dist/redact-7Aq1ukl-.js.map +1 -0
  187. package/dist/release-report-Cz9NKH39.js +603 -0
  188. package/dist/release-report-Cz9NKH39.js.map +1 -0
  189. package/dist/release-report-mvB2G4_J.d.ts +244 -0
  190. package/dist/release-report-mvB2G4_J.d.ts.map +1 -0
  191. package/dist/replay-GnyotH0J.js +1741 -0
  192. package/dist/replay-GnyotH0J.js.map +1 -0
  193. package/dist/replay-OoidtG1E.d.ts +749 -0
  194. package/dist/replay-OoidtG1E.d.ts.map +1 -0
  195. package/dist/reporting.d.ts +6 -1298
  196. package/dist/reporting.js +6 -50
  197. package/dist/researcher-CwTdwXG1.d.ts +314 -0
  198. package/dist/researcher-CwTdwXG1.d.ts.map +1 -0
  199. package/dist/reward-hacking-eAnOsynk.d.ts +224 -0
  200. package/dist/reward-hacking-eAnOsynk.d.ts.map +1 -0
  201. package/dist/reward-hacking-qipEpKvY.js +596 -0
  202. package/dist/reward-hacking-qipEpKvY.js.map +1 -0
  203. package/dist/reward-nw2xZGZG.js +137 -0
  204. package/dist/reward-nw2xZGZG.js.map +1 -0
  205. package/dist/rl.d.ts +916 -3596
  206. package/dist/rl.d.ts.map +1 -0
  207. package/dist/rl.js +2362 -1751
  208. package/dist/rl.js.map +1 -1
  209. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  210. package/dist/rollout/index.d.ts +3 -1048
  211. package/dist/rollout/index.js +8 -110
  212. package/dist/rollout-BOYjemfR.js +624 -0
  213. package/dist/rollout-BOYjemfR.js.map +1 -0
  214. package/dist/rubric-predictive-validity-B3xmbmS1.js +141 -0
  215. package/dist/rubric-predictive-validity-B3xmbmS1.js.map +1 -0
  216. package/dist/rubric-predictive-validity-Ku_clp_1.d.ts +74 -0
  217. package/dist/rubric-predictive-validity-Ku_clp_1.d.ts.map +1 -0
  218. package/dist/run-evidence-ClRX_8A9.d.ts +225 -0
  219. package/dist/run-evidence-ClRX_8A9.d.ts.map +1 -0
  220. package/dist/run-record-BuoE80Dq.js +467 -0
  221. package/dist/run-record-BuoE80Dq.js.map +1 -0
  222. package/dist/run-record-CnZu_gjl.d.ts +357 -0
  223. package/dist/run-record-CnZu_gjl.d.ts.map +1 -0
  224. package/dist/run-score-iEEAWiBY.js +41 -0
  225. package/dist/run-score-iEEAWiBY.js.map +1 -0
  226. package/dist/runtime-trajectory-1gyaTOoC.js +93 -0
  227. package/dist/runtime-trajectory-1gyaTOoC.js.map +1 -0
  228. package/dist/runtime-trajectory-BvSZcCHD.d.ts +50 -0
  229. package/dist/runtime-trajectory-BvSZcCHD.d.ts.map +1 -0
  230. package/dist/schema-BtVldJ3T.d.ts +206 -0
  231. package/dist/schema-BtVldJ3T.d.ts.map +1 -0
  232. package/dist/schema-C6DW4ZHR.js +821 -0
  233. package/dist/schema-C6DW4ZHR.js.map +1 -0
  234. package/dist/schema-CRhEY1SO.js +69 -0
  235. package/dist/schema-CRhEY1SO.js.map +1 -0
  236. package/dist/schema-Cef2cFmb.d.ts +408 -0
  237. package/dist/schema-Cef2cFmb.d.ts.map +1 -0
  238. package/dist/semantic-concept-judge-B6cWNJ2K.js +725 -0
  239. package/dist/semantic-concept-judge-B6cWNJ2K.js.map +1 -0
  240. package/dist/sequential-Br0mAPHA.js +148 -0
  241. package/dist/sequential-Br0mAPHA.js.map +1 -0
  242. package/dist/sequential-CYwq6Ff_.d.ts +141 -0
  243. package/dist/sequential-CYwq6Ff_.d.ts.map +1 -0
  244. package/dist/series-convergence-CjO2QdRW.js +43 -0
  245. package/dist/series-convergence-CjO2QdRW.js.map +1 -0
  246. package/dist/series-convergence-ofsqPWhs.d.ts +35 -0
  247. package/dist/series-convergence-ofsqPWhs.d.ts.map +1 -0
  248. package/dist/server-m5D9cvnG.js +1040 -0
  249. package/dist/server-m5D9cvnG.js.map +1 -0
  250. package/dist/skill-usage-C_pXm7lP.d.ts +534 -0
  251. package/dist/skill-usage-C_pXm7lP.d.ts.map +1 -0
  252. package/dist/skillopt-optimization-method-B7wX7XkF.d.ts +1739 -0
  253. package/dist/skillopt-optimization-method-B7wX7XkF.d.ts.map +1 -0
  254. package/dist/skillopt-optimization-method-D4ODwFVV.js +7712 -0
  255. package/dist/skillopt-optimization-method-D4ODwFVV.js.map +1 -0
  256. package/dist/statistics-Cmj6nynr.d.ts +514 -0
  257. package/dist/statistics-Cmj6nynr.d.ts.map +1 -0
  258. package/dist/statistics-CnnxdpOg.js +1437 -0
  259. package/dist/statistics-CnnxdpOg.js.map +1 -0
  260. package/dist/store-CT9YIIve.d.ts +117 -0
  261. package/dist/store-CT9YIIve.d.ts.map +1 -0
  262. package/dist/store-CxJry_cs.d.ts +229 -0
  263. package/dist/store-CxJry_cs.d.ts.map +1 -0
  264. package/dist/storyboard/index.d.ts +84 -203
  265. package/dist/storyboard/index.d.ts.map +1 -0
  266. package/dist/storyboard/index.js +609 -542
  267. package/dist/storyboard/index.js.map +1 -1
  268. package/dist/summary-report-BNs5nmXI.js +862 -0
  269. package/dist/summary-report-BNs5nmXI.js.map +1 -0
  270. package/dist/summary-report-Cj9gdw4i.d.ts +407 -0
  271. package/dist/summary-report-Cj9gdw4i.d.ts.map +1 -0
  272. package/dist/supervisor-run/index.d.ts +2 -849
  273. package/dist/supervisor-run/index.js +2 -64
  274. package/dist/supervisor-run-_lnTLM3z.js +1679 -0
  275. package/dist/supervisor-run-_lnTLM3z.js.map +1 -0
  276. package/dist/task-failure-attributes-CQZlB3et.js +311 -0
  277. package/dist/task-failure-attributes-CQZlB3et.js.map +1 -0
  278. package/dist/test-graded-scenario-BsqWLmPt.js +318 -0
  279. package/dist/test-graded-scenario-BsqWLmPt.js.map +1 -0
  280. package/dist/test-graded-scenario-D1TaI2va.d.ts +141 -0
  281. package/dist/test-graded-scenario-D1TaI2va.d.ts.map +1 -0
  282. package/dist/tools-BmuN627J.js +1085 -0
  283. package/dist/tools-BmuN627J.js.map +1 -0
  284. package/dist/trace-attributes.d.ts +2 -52
  285. package/dist/trace-attributes.js +131 -61
  286. package/dist/trace-attributes.js.map +1 -1
  287. package/dist/traces.d.ts +12 -2365
  288. package/dist/traces.js +12 -251
  289. package/dist/trajectory-D_7rLrvE.js +56 -0
  290. package/dist/trajectory-D_7rLrvE.js.map +1 -0
  291. package/dist/types-DGsxbAEd.d.ts +387 -0
  292. package/dist/types-DGsxbAEd.d.ts.map +1 -0
  293. package/dist/types-k9tZGKUg.d.ts +640 -0
  294. package/dist/types-k9tZGKUg.d.ts.map +1 -0
  295. package/dist/verdict-Dps8_okt.d.ts +37 -0
  296. package/dist/verdict-Dps8_okt.d.ts.map +1 -0
  297. package/dist/wire/index.d.ts +702 -1174
  298. package/dist/wire/index.d.ts.map +1 -0
  299. package/dist/wire/index.js +2 -81
  300. package/docs/feature-guide.md +1 -1
  301. package/docs/rollout.md +116 -2
  302. package/package.json +18 -10
  303. package/dist/benchmarks/index.js.map +0 -1
  304. package/dist/campaign/index.js.map +0 -1
  305. package/dist/chunk-2JX3CFMB.js +0 -695
  306. package/dist/chunk-2JX3CFMB.js.map +0 -1
  307. package/dist/chunk-2MKQIFS4.js +0 -183
  308. package/dist/chunk-2MKQIFS4.js.map +0 -1
  309. package/dist/chunk-3RF76KTD.js +0 -84
  310. package/dist/chunk-3RF76KTD.js.map +0 -1
  311. package/dist/chunk-5DTSBUL2.js +0 -159
  312. package/dist/chunk-5DTSBUL2.js.map +0 -1
  313. package/dist/chunk-7ZZMD7UK.js +0 -386
  314. package/dist/chunk-7ZZMD7UK.js.map +0 -1
  315. package/dist/chunk-BOD4O7OF.js +0 -40
  316. package/dist/chunk-BOD4O7OF.js.map +0 -1
  317. package/dist/chunk-BYT7ELPS.js +0 -1553
  318. package/dist/chunk-BYT7ELPS.js.map +0 -1
  319. package/dist/chunk-DJKY2TSY.js +0 -2428
  320. package/dist/chunk-DJKY2TSY.js.map +0 -1
  321. package/dist/chunk-DPUHNQLN.js +0 -232
  322. package/dist/chunk-DPUHNQLN.js.map +0 -1
  323. package/dist/chunk-DRYIUNWY.js +0 -622
  324. package/dist/chunk-DRYIUNWY.js.map +0 -1
  325. package/dist/chunk-EJGRPCO3.js +0 -617
  326. package/dist/chunk-EJGRPCO3.js.map +0 -1
  327. package/dist/chunk-EOSZT7PL.js +0 -2001
  328. package/dist/chunk-EOSZT7PL.js.map +0 -1
  329. package/dist/chunk-EZJEIH2R.js +0 -1559
  330. package/dist/chunk-EZJEIH2R.js.map +0 -1
  331. package/dist/chunk-GGE4NNQT.js +0 -65
  332. package/dist/chunk-GGE4NNQT.js.map +0 -1
  333. package/dist/chunk-HHWE3POT.js +0 -94
  334. package/dist/chunk-HHWE3POT.js.map +0 -1
  335. package/dist/chunk-IHQDPH7D.js +0 -171
  336. package/dist/chunk-IHQDPH7D.js.map +0 -1
  337. package/dist/chunk-JHCHEVET.js +0 -274
  338. package/dist/chunk-JHCHEVET.js.map +0 -1
  339. package/dist/chunk-K4DBDHLK.js +0 -158
  340. package/dist/chunk-K4DBDHLK.js.map +0 -1
  341. package/dist/chunk-K6N6XJJX.js +0 -306
  342. package/dist/chunk-K6N6XJJX.js.map +0 -1
  343. package/dist/chunk-MA6HLL3S.js +0 -65
  344. package/dist/chunk-MA6HLL3S.js.map +0 -1
  345. package/dist/chunk-MAZ26DC7.js +0 -99
  346. package/dist/chunk-MAZ26DC7.js.map +0 -1
  347. package/dist/chunk-MHELPNRP.js +0 -1212
  348. package/dist/chunk-MHELPNRP.js.map +0 -1
  349. package/dist/chunk-NACAGYSY.js +0 -1040
  350. package/dist/chunk-NACAGYSY.js.map +0 -1
  351. package/dist/chunk-NKAGIDE2.js +0 -7633
  352. package/dist/chunk-NKAGIDE2.js.map +0 -1
  353. package/dist/chunk-NPCTHQIO.js +0 -91
  354. package/dist/chunk-NPCTHQIO.js.map +0 -1
  355. package/dist/chunk-NYLOYM6N.js +0 -332
  356. package/dist/chunk-NYLOYM6N.js.map +0 -1
  357. package/dist/chunk-ONWEPEDO.js +0 -57
  358. package/dist/chunk-ONWEPEDO.js.map +0 -1
  359. package/dist/chunk-P5W7RQKK.js +0 -576
  360. package/dist/chunk-P5W7RQKK.js.map +0 -1
  361. package/dist/chunk-P6FYH6K4.js +0 -1161
  362. package/dist/chunk-P6FYH6K4.js.map +0 -1
  363. package/dist/chunk-PBE2LOSS.js +0 -669
  364. package/dist/chunk-PBE2LOSS.js.map +0 -1
  365. package/dist/chunk-PC4UYEBM.js +0 -166
  366. package/dist/chunk-PC4UYEBM.js.map +0 -1
  367. package/dist/chunk-PXE2VKMX.js +0 -140
  368. package/dist/chunk-PXE2VKMX.js.map +0 -1
  369. package/dist/chunk-PZ5AY32C.js +0 -10
  370. package/dist/chunk-PZ5AY32C.js.map +0 -1
  371. package/dist/chunk-RZTMDUO7.js +0 -49
  372. package/dist/chunk-RZTMDUO7.js.map +0 -1
  373. package/dist/chunk-S5YLIBFX.js +0 -136
  374. package/dist/chunk-S5YLIBFX.js.map +0 -1
  375. package/dist/chunk-SZLVEKMJ.js +0 -1446
  376. package/dist/chunk-SZLVEKMJ.js.map +0 -1
  377. package/dist/chunk-T4SQEITX.js +0 -95
  378. package/dist/chunk-T4SQEITX.js.map +0 -1
  379. package/dist/chunk-TBL77AUT.js +0 -355
  380. package/dist/chunk-TBL77AUT.js.map +0 -1
  381. package/dist/chunk-TSN7JT6D.js +0 -1646
  382. package/dist/chunk-TSN7JT6D.js.map +0 -1
  383. package/dist/chunk-TT4KNT67.js +0 -124
  384. package/dist/chunk-TT4KNT67.js.map +0 -1
  385. package/dist/chunk-UB2LOJ6Q.js +0 -4461
  386. package/dist/chunk-UB2LOJ6Q.js.map +0 -1
  387. package/dist/chunk-UWZZKKU7.js +0 -237
  388. package/dist/chunk-UWZZKKU7.js.map +0 -1
  389. package/dist/chunk-VBQ3CRKH.js +0 -291
  390. package/dist/chunk-VBQ3CRKH.js.map +0 -1
  391. package/dist/chunk-VGRCHJON.js +0 -163
  392. package/dist/chunk-VGRCHJON.js.map +0 -1
  393. package/dist/chunk-VI2UW6B6.js +0 -162
  394. package/dist/chunk-VI2UW6B6.js.map +0 -1
  395. package/dist/chunk-VLOATJQ2.js +0 -908
  396. package/dist/chunk-VLOATJQ2.js.map +0 -1
  397. package/dist/chunk-VQMK5FMP.js +0 -247
  398. package/dist/chunk-VQMK5FMP.js.map +0 -1
  399. package/dist/chunk-VZSRQ272.js +0 -149
  400. package/dist/chunk-VZSRQ272.js.map +0 -1
  401. package/dist/chunk-WGXIEX7P.js +0 -116
  402. package/dist/chunk-WGXIEX7P.js.map +0 -1
  403. package/dist/chunk-WS3NZZQQ.js +0 -929
  404. package/dist/chunk-WS3NZZQQ.js.map +0 -1
  405. package/dist/chunk-XDWDC2MP.js +0 -695
  406. package/dist/chunk-XDWDC2MP.js.map +0 -1
  407. package/dist/chunk-XPRT64IE.js +0 -766
  408. package/dist/chunk-XPRT64IE.js.map +0 -1
  409. package/dist/chunk-YJBNWCAA.js +0 -1056
  410. package/dist/chunk-YJBNWCAA.js.map +0 -1
  411. package/dist/chunk-ZET2UAYW.js +0 -89
  412. package/dist/chunk-ZET2UAYW.js.map +0 -1
  413. package/dist/chunk-ZUUWPZCV.js +0 -752
  414. package/dist/chunk-ZUUWPZCV.js.map +0 -1
  415. package/dist/control.js.map +0 -1
  416. package/dist/hosted/index.js.map +0 -1
  417. package/dist/matrix/index.js.map +0 -1
  418. package/dist/reporting.js.map +0 -1
  419. package/dist/rollout/index.js.map +0 -1
  420. package/dist/run-campaign-ISHFZ7FJ.js +0 -17
  421. package/dist/run-campaign-ISHFZ7FJ.js.map +0 -1
  422. package/dist/supervisor-run/index.js.map +0 -1
  423. package/dist/traces.js.map +0 -1
  424. package/dist/wire/index.js.map +0 -1
@@ -1,122 +1,153 @@
1
- import "../chunk-PZ5AY32C.js";
2
-
3
- // src/storyboard/code-edit.ts
4
- var EDIT_TOOLS = /(edit|write|patch|apply|str_replace|create.*file|save|insert|update.*file|multi_edit)/i;
1
+ //#region src/storyboard/code-edit.ts
2
+ const EDIT_TOOLS = /(edit|write|patch|apply|str_replace|create.*file|save|insert|update.*file|multi_edit)/i;
5
3
  function languageOf(path) {
6
- const ext = path.includes(".") ? path.split(".").pop()?.toLowerCase() : void 0;
7
- if (!ext) return void 0;
8
- const map = {
9
- ts: "ts",
10
- tsx: "tsx",
11
- js: "js",
12
- jsx: "jsx",
13
- mjs: "js",
14
- cjs: "js",
15
- py: "python",
16
- rs: "rust",
17
- go: "go",
18
- sol: "solidity",
19
- java: "java",
20
- rb: "ruby",
21
- php: "php",
22
- c: "c",
23
- cpp: "cpp",
24
- cs: "csharp",
25
- css: "css",
26
- scss: "scss",
27
- html: "html",
28
- json: "json",
29
- yaml: "yaml",
30
- yml: "yaml",
31
- toml: "toml",
32
- md: "markdown",
33
- sh: "bash",
34
- sql: "sql"
35
- };
36
- return map[ext] ?? ext;
4
+ const ext = path.includes(".") ? path.split(".").pop()?.toLowerCase() : void 0;
5
+ if (!ext) return void 0;
6
+ return {
7
+ ts: "ts",
8
+ tsx: "tsx",
9
+ js: "js",
10
+ jsx: "jsx",
11
+ mjs: "js",
12
+ cjs: "js",
13
+ py: "python",
14
+ rs: "rust",
15
+ go: "go",
16
+ sol: "solidity",
17
+ java: "java",
18
+ rb: "ruby",
19
+ php: "php",
20
+ c: "c",
21
+ cpp: "cpp",
22
+ cs: "csharp",
23
+ css: "css",
24
+ scss: "scss",
25
+ html: "html",
26
+ json: "json",
27
+ yaml: "yaml",
28
+ yml: "yaml",
29
+ toml: "toml",
30
+ md: "markdown",
31
+ sh: "bash",
32
+ sql: "sql"
33
+ }[ext] ?? ext;
37
34
  }
38
35
  function pick(obj, keys) {
39
- if (!obj || typeof obj !== "object") return void 0;
40
- const rec = obj;
41
- for (const k of Object.keys(rec)) {
42
- if (keys.includes(k.toLowerCase())) {
43
- const v = rec[k];
44
- if (typeof v === "string") return v;
45
- }
46
- }
47
- return void 0;
36
+ if (!obj || typeof obj !== "object") return void 0;
37
+ const rec = obj;
38
+ for (const k of Object.keys(rec)) if (keys.includes(k.toLowerCase())) {
39
+ const v = rec[k];
40
+ if (typeof v === "string") return v;
41
+ }
48
42
  }
49
43
  function countDiff(diff) {
50
- if (!diff) return { additions: 0, deletions: 0 };
51
- let additions = 0;
52
- let deletions = 0;
53
- for (const line of diff.split("\n")) {
54
- if (line.startsWith("+") && !line.startsWith("+++")) additions++;
55
- else if (line.startsWith("-") && !line.startsWith("---")) deletions++;
56
- }
57
- return { additions, deletions };
44
+ if (!diff) return {
45
+ additions: 0,
46
+ deletions: 0
47
+ };
48
+ let additions = 0;
49
+ let deletions = 0;
50
+ for (const line of diff.split("\n")) if (line.startsWith("+") && !line.startsWith("+++")) additions++;
51
+ else if (line.startsWith("-") && !line.startsWith("---")) deletions++;
52
+ return {
53
+ additions,
54
+ deletions
55
+ };
58
56
  }
57
+ /** Extract a CodeEdit from a single span, or undefined if it is not an edit. */
59
58
  function codeEditFromSpan(span) {
60
- if (span.kind !== "tool") return void 0;
61
- const tool = span;
62
- if (!EDIT_TOOLS.test(tool.toolName)) return void 0;
63
- const path = pick(tool.args, ["path", "file_path", "filepath", "filename", "file"]);
64
- if (!path) return void 0;
65
- const diff = pick(tool.args, ["diff", "patch"]);
66
- const after = pick(tool.args, ["content", "new_str", "new_string", "newtext", "text", "body"]);
67
- const before = pick(tool.args, ["old_str", "old_string", "oldtext", "original"]);
68
- const counts = countDiff(diff);
69
- return {
70
- spanId: span.spanId,
71
- path,
72
- language: languageOf(path),
73
- diff,
74
- before,
75
- after,
76
- additions: diff ? counts.additions : after ? after.split("\n").length : 0,
77
- deletions: diff ? counts.deletions : 0,
78
- startedAt: span.startedAt
79
- };
59
+ if (span.kind !== "tool") return void 0;
60
+ const tool = span;
61
+ if (!EDIT_TOOLS.test(tool.toolName)) return void 0;
62
+ const path = pick(tool.args, [
63
+ "path",
64
+ "file_path",
65
+ "filepath",
66
+ "filename",
67
+ "file"
68
+ ]);
69
+ if (!path) return void 0;
70
+ const diff = pick(tool.args, ["diff", "patch"]);
71
+ const after = pick(tool.args, [
72
+ "content",
73
+ "new_str",
74
+ "new_string",
75
+ "newtext",
76
+ "text",
77
+ "body"
78
+ ]);
79
+ const before = pick(tool.args, [
80
+ "old_str",
81
+ "old_string",
82
+ "oldtext",
83
+ "original"
84
+ ]);
85
+ const counts = countDiff(diff);
86
+ return {
87
+ spanId: span.spanId,
88
+ path,
89
+ language: languageOf(path),
90
+ diff,
91
+ before,
92
+ after,
93
+ additions: diff ? counts.additions : after ? after.split("\n").length : 0,
94
+ deletions: diff ? counts.deletions : 0,
95
+ startedAt: span.startedAt
96
+ };
80
97
  }
98
+ /** All code edits in a run, in chronological order. */
81
99
  function extractCodeEdits(spans) {
82
- return spans.map(codeEditFromSpan).filter((e) => e != null).sort((a, b) => a.startedAt - b.startedAt);
100
+ return spans.map(codeEditFromSpan).filter((e) => e != null).sort((a, b) => a.startedAt - b.startedAt);
83
101
  }
102
+ /** Pair each code-edit (`diff`) scene with its concrete edit, matched via the
103
+ * scene's evidence span ids. Scenes without a recoverable edit are dropped. */
84
104
  function codeEditsForStoryboard(storyboard, spans) {
85
- const bySpan = new Map(extractCodeEdits(spans).map((e) => [e.spanId, e]));
86
- const out = [];
87
- for (const scene of storyboard.scenes) {
88
- if (scene.sceneType !== "diff") continue;
89
- const edit = scene.evidenceSpanIds.map((id) => bySpan.get(id)).find((e) => e != null);
90
- if (edit) out.push({ scene, edit });
91
- }
92
- return out;
105
+ const bySpan = new Map(extractCodeEdits(spans).map((e) => [e.spanId, e]));
106
+ const out = [];
107
+ for (const scene of storyboard.scenes) {
108
+ if (scene.sceneType !== "diff") continue;
109
+ const edit = scene.evidenceSpanIds.map((id) => bySpan.get(id)).find((e) => e != null);
110
+ if (edit) out.push({
111
+ scene,
112
+ edit
113
+ });
114
+ }
115
+ return out;
93
116
  }
117
+ /** The text the animation types for an edit: prefer the full new file body,
118
+ * then the added lines of a diff, then a minimal placeholder so the scene is
119
+ * never blank. */
94
120
  function editAnimationText(edit) {
95
- if (edit.after?.trim()) return edit.after;
96
- if (edit.diff) {
97
- const added = edit.diff.split("\n").filter((l) => l.startsWith("+") && !l.startsWith("+++")).map((l) => l.slice(1)).join("\n");
98
- if (added.trim()) return added;
99
- }
100
- return `// ${edit.path}
101
- // (${edit.additions} line${edit.additions === 1 ? "" : "s"} written)`;
121
+ if (edit.after?.trim()) return edit.after;
122
+ if (edit.diff) {
123
+ const added = edit.diff.split("\n").filter((l) => l.startsWith("+") && !l.startsWith("+++")).map((l) => l.slice(1)).join("\n");
124
+ if (added.trim()) return added;
125
+ }
126
+ return `// ${edit.path}\n// (${edit.additions} line${edit.additions === 1 ? "" : "s"} written)`;
102
127
  }
103
128
  function esc(s) {
104
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
129
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
105
130
  }
131
+ /**
132
+ * Render a self-contained HTML page that animates the agent writing each file,
133
+ * character by character, with a filename tab, line numbers, and a blinking
134
+ * cursor — the shareable "watch it build" clip. No build step, no assets, no
135
+ * deps. The same `CodeEdit[]` feeds a Remotion MP4 renderer in a consumer
136
+ * package; this is the dependency-free baseline.
137
+ */
106
138
  function renderCodeAnimationHtml(source, opts = {}) {
107
- const edits = source.length > 0 && "path" in source[0] ? source : extractCodeEdits(source);
108
- const files = edits.map((e) => ({
109
- path: e.path,
110
- language: e.language ?? "",
111
- additions: e.additions,
112
- deletions: e.deletions,
113
- code: editAnimationText(e)
114
- }));
115
- const title = opts.title ?? "Agent writing code";
116
- const charsPerTick = opts.charsPerTick ?? 4;
117
- const pauseBetweenMs = opts.pauseBetweenMs ?? 900;
118
- const filesJson = JSON.stringify(files);
119
- return `<!doctype html>
139
+ const files = (source.length > 0 && "path" in source[0] ? source : extractCodeEdits(source)).map((e) => ({
140
+ path: e.path,
141
+ language: e.language ?? "",
142
+ additions: e.additions,
143
+ deletions: e.deletions,
144
+ code: editAnimationText(e)
145
+ }));
146
+ const title = opts.title ?? "Agent writing code";
147
+ const charsPerTick = opts.charsPerTick ?? 4;
148
+ const pauseBetweenMs = opts.pauseBetweenMs ?? 900;
149
+ const filesJson = JSON.stringify(files);
150
+ return `<!doctype html>
120
151
  <html lang="en">
121
152
  <head>
122
153
  <meta charset="utf-8" />
@@ -151,17 +182,17 @@ function renderCodeAnimationHtml(source, opts = {}) {
151
182
  </style>
152
183
  </head>
153
184
  <body>
154
- <h1>\u270F\uFE0F ${esc(title)}</h1>
185
+ <h1>✏️ ${esc(title)}</h1>
155
186
  <div class="editor">
156
187
  <div class="tabbar">
157
188
  <span class="dot r"></span><span class="dot y"></span><span class="dot g"></span>
158
- <span class="tab" id="tab">\u2014</span><span class="lang" id="lang"></span>
189
+ <span class="tab" id="tab">—</span><span class="lang" id="lang"></span>
159
190
  <span class="adds" id="adds"></span>
160
191
  </div>
161
192
  <div class="codewrap"><div class="gutter" id="gutter">1</div><pre id="code"></pre></div>
162
193
  </div>
163
194
  <div class="controls">
164
- <button id="pp">\u23F8 Pause</button><button id="restart">\u21BB Restart</button>
195
+ <button id="pp">⏸ Pause</button><button id="restart">↻ Restart</button>
165
196
  <span id="counter"></span>
166
197
  </div>
167
198
  <script>
@@ -185,473 +216,517 @@ function renderCodeAnimationHtml(source, opts = {}) {
185
216
  const f = FILES[fi];
186
217
  if (ci < f.code.length){ ci = Math.min(f.code.length, ci + CPT); paint(); raf = requestAnimationFrame(tick); }
187
218
  else if (fi < FILES.length - 1){ setTimeout(() => { fi++; ci = 0; setHeader(); paint(); raf = requestAnimationFrame(tick); }, PAUSE); }
188
- else { playing = false; document.getElementById('pp').textContent = '\u25B6 Play'; } }
189
- document.getElementById('pp').onclick = () => { if (!playing){ playing = true; paused = false; tick(); } else { paused = !paused; if (!paused) tick(); } document.getElementById('pp').textContent = paused ? '\u25B6 Play' : '\u23F8 Pause'; };
190
- document.getElementById('restart').onclick = () => { fi = 0; ci = 0; playing = true; paused = false; document.getElementById('pp').textContent = '\u23F8 Pause'; setHeader(); paint(); cancelAnimationFrame(raf); tick(); };
219
+ else { playing = false; document.getElementById('pp').textContent = ' Play'; } }
220
+ document.getElementById('pp').onclick = () => { if (!playing){ playing = true; paused = false; tick(); } else { paused = !paused; if (!paused) tick(); } document.getElementById('pp').textContent = paused ? ' Play' : ' Pause'; };
221
+ document.getElementById('restart').onclick = () => { fi = 0; ci = 0; playing = true; paused = false; document.getElementById('pp').textContent = ' Pause'; setHeader(); paint(); cancelAnimationFrame(raf); tick(); };
191
222
  if (FILES.length){ setHeader(); paint(); tick(); }
192
- </script>
223
+ <\/script>
193
224
  </body>
194
225
  </html>
195
226
  `;
196
227
  }
197
-
198
- // src/storyboard/index.ts
228
+ //#endregion
229
+ //#region src/storyboard/index.ts
199
230
  function str(v) {
200
- return typeof v === "string" && v.length > 0 ? v : void 0;
231
+ return typeof v === "string" && v.length > 0 ? v : void 0;
201
232
  }
202
233
  function num(v) {
203
- return typeof v === "number" ? v : void 0;
234
+ return typeof v === "number" ? v : void 0;
204
235
  }
205
236
  function attr(span, ...keys) {
206
- const a = span.attributes;
207
- if (!a) return void 0;
208
- for (const k of keys) if (a[k] != null) return a[k];
209
- return void 0;
237
+ const a = span.attributes;
238
+ if (!a) return void 0;
239
+ for (const k of keys) if (a[k] != null) return a[k];
210
240
  }
211
241
  function asObj(v) {
212
- return v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
242
+ return v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
213
243
  }
214
244
  function safeJson(v) {
215
- if (v == null) return void 0;
216
- if (typeof v === "string") return v;
217
- try {
218
- return JSON.stringify(v, null, 2);
219
- } catch {
220
- return String(v);
221
- }
245
+ if (v == null) return void 0;
246
+ if (typeof v === "string") return v;
247
+ try {
248
+ return JSON.stringify(v, null, 2);
249
+ } catch {
250
+ return String(v);
251
+ }
222
252
  }
253
+ /** Is this string an embeddable image (data URI or http URL)? */
223
254
  function isImageSrc(s) {
224
- return !!s && (s.startsWith("data:image") || /^https?:\/\//.test(s));
255
+ return !!s && (s.startsWith("data:image") || /^https?:\/\//.test(s));
225
256
  }
257
+ /** Pull the modality-appropriate visual out of whatever the span carries.
258
+ * Conventions (checked in priority order): an image rides on
259
+ * `attributes.screenshot|image|frame|videoFrame` or `result.screenshot`; a
260
+ * diff on `attributes.diff|patch` or `args.diff`; a command on `args` /
261
+ * `args.command`; an API call on a `url`/`method` in args; file content on
262
+ * `result`. Unknown tools degrade to an args/result inspector. */
226
263
  function extractVisual(span) {
227
- const shot = str(attr(span, "screenshot", "screenshotUrl", "image", "frame", "videoFrame")) ?? (span.kind === "tool" ? str(asObj(span.result)?.screenshot) ?? str(asObj(span.result)?.image) : void 0);
228
- if (span.kind === "tool") {
229
- const tn = span.toolName.toLowerCase();
230
- const a = asObj(span.args);
231
- if (/computer|cua|desktop|\bgui\b|xdotool|mouse|keyboard|screen_|pyautogui/.test(tn)) {
232
- return {
233
- type: "browser",
234
- action: str(a?.action) ?? span.toolName,
235
- url: str(a?.target),
236
- screenshot: shot
237
- };
238
- }
239
- if (/browser|playwright|puppeteer|\bpage\b|navigate|goto|\bclick\b|\btype\b|screenshot|dom/.test(
240
- tn
241
- )) {
242
- return {
243
- type: "browser",
244
- url: str(a?.url) ?? str(attr(span, "url")),
245
- action: str(a?.action) ?? str(a?.selector) ?? span.toolName,
246
- screenshot: shot
247
- };
248
- }
249
- const diff = str(attr(span, "diff", "patch")) ?? str(a?.diff) ?? str(a?.patch);
250
- if (diff && /edit|write|patch|apply|str_replace|create|save|file/.test(tn)) {
251
- return {
252
- type: "diff",
253
- path: str(a?.path) ?? str(a?.file) ?? str(attr(span, "path")) ?? "",
254
- patch: truncate(diff, 2e3)
255
- };
256
- }
257
- if (/edit|write|patch|apply|str_replace/.test(tn)) {
258
- const newText = str(a?.new_str) ?? str(a?.content) ?? str(a?.text);
259
- return {
260
- type: "diff",
261
- path: str(a?.path) ?? str(a?.file) ?? "",
262
- patch: newText ? `+ ${truncate(newText, 1600)}` : "(no diff captured)"
263
- };
264
- }
265
- if (/read|\bcat\b|open|view|get_file|load|fetch_file/.test(tn)) {
266
- const content = str(asObj(span.result)?.content) ?? (typeof span.result === "string" ? span.result : void 0) ?? str(attr(span, "content"));
267
- return {
268
- type: "code",
269
- path: str(a?.path) ?? str(a?.file) ?? "",
270
- content: truncate(content ?? "", 1400)
271
- };
272
- }
273
- if (/search|grep|find|glob|query/.test(tn)) {
274
- return {
275
- type: "terminal",
276
- command: `search ${str(a?.query) ?? str(a?.pattern) ?? ""}`.trim(),
277
- output: truncate(safeJson(span.result) ?? "", 1e3)
278
- };
279
- }
280
- const url = str(a?.url) ?? str(attr(span, "url"));
281
- if (url || /http|\bapi\b|fetch|request|webhook|rest|graphql|endpoint/.test(tn)) {
282
- return {
283
- type: "api",
284
- method: str(a?.method) ?? str(attr(span, "method")),
285
- url: url ?? span.toolName,
286
- status: num(attr(span, "status", "statusCode")) ?? num(asObj(span.result)?.status),
287
- request: truncate(str(a?.body) ?? safeJson(span.args) ?? "", 900),
288
- response: truncate(str(attr(span, "response")) ?? safeJson(span.result) ?? "", 900)
289
- };
290
- }
291
- if (/shell|exec|bash|\brun\b|terminal|command|sandbox|process/.test(tn)) {
292
- const command = typeof span.args === "string" ? span.args : str(a?.command) ?? str(a?.cmd) ?? span.toolName;
293
- const output = str(attr(span, "output", "stdout")) ?? (typeof span.result === "string" ? span.result : safeJson(span.result));
294
- return {
295
- type: "terminal",
296
- command: truncate(command, 240),
297
- output: truncate(output ?? "", 1400)
298
- };
299
- }
300
- return {
301
- type: "api",
302
- url: span.toolName,
303
- request: truncate(safeJson(span.args) ?? "", 900),
304
- response: truncate(safeJson(span.result) ?? "", 900)
305
- };
306
- }
307
- if (isImageSrc(shot)) return { type: "screenshot", src: shot };
308
- if (span.kind === "llm") {
309
- const text = str(span.output) ?? str(span.messages?.[span.messages.length - 1]?.content);
310
- return text ? { type: "prose", text: truncate(text, 900) } : { type: "none" };
311
- }
312
- if (span.kind === "sandbox")
313
- return { type: "terminal", command: span.name, output: str(attr(span, "output")) };
314
- return { type: "none" };
264
+ const shot = str(attr(span, "screenshot", "screenshotUrl", "image", "frame", "videoFrame")) ?? (span.kind === "tool" ? str(asObj(span.result)?.screenshot) ?? str(asObj(span.result)?.image) : void 0);
265
+ if (span.kind === "tool") {
266
+ const tn = span.toolName.toLowerCase();
267
+ const a = asObj(span.args);
268
+ if (/computer|cua|desktop|\bgui\b|xdotool|mouse|keyboard|screen_|pyautogui/.test(tn)) return {
269
+ type: "browser",
270
+ action: str(a?.action) ?? span.toolName,
271
+ url: str(a?.target),
272
+ screenshot: shot
273
+ };
274
+ if (/browser|playwright|puppeteer|\bpage\b|navigate|goto|\bclick\b|\btype\b|screenshot|dom/.test(tn)) return {
275
+ type: "browser",
276
+ url: str(a?.url) ?? str(attr(span, "url")),
277
+ action: str(a?.action) ?? str(a?.selector) ?? span.toolName,
278
+ screenshot: shot
279
+ };
280
+ const diff = str(attr(span, "diff", "patch")) ?? str(a?.diff) ?? str(a?.patch);
281
+ if (diff && /edit|write|patch|apply|str_replace|create|save|file/.test(tn)) return {
282
+ type: "diff",
283
+ path: str(a?.path) ?? str(a?.file) ?? str(attr(span, "path")) ?? "",
284
+ patch: truncate(diff, 2e3)
285
+ };
286
+ if (/edit|write|patch|apply|str_replace/.test(tn)) {
287
+ const newText = str(a?.new_str) ?? str(a?.content) ?? str(a?.text);
288
+ return {
289
+ type: "diff",
290
+ path: str(a?.path) ?? str(a?.file) ?? "",
291
+ patch: newText ? `+ ${truncate(newText, 1600)}` : "(no diff captured)"
292
+ };
293
+ }
294
+ if (/read|\bcat\b|open|view|get_file|load|fetch_file/.test(tn)) {
295
+ const content = str(asObj(span.result)?.content) ?? (typeof span.result === "string" ? span.result : void 0) ?? str(attr(span, "content"));
296
+ return {
297
+ type: "code",
298
+ path: str(a?.path) ?? str(a?.file) ?? "",
299
+ content: truncate(content ?? "", 1400)
300
+ };
301
+ }
302
+ if (/search|grep|find|glob|query/.test(tn)) return {
303
+ type: "terminal",
304
+ command: `search ${str(a?.query) ?? str(a?.pattern) ?? ""}`.trim(),
305
+ output: truncate(safeJson(span.result) ?? "", 1e3)
306
+ };
307
+ const url = str(a?.url) ?? str(attr(span, "url"));
308
+ if (url || /http|\bapi\b|fetch|request|webhook|rest|graphql|endpoint/.test(tn)) return {
309
+ type: "api",
310
+ method: str(a?.method) ?? str(attr(span, "method")),
311
+ url: url ?? span.toolName,
312
+ status: num(attr(span, "status", "statusCode")) ?? num(asObj(span.result)?.status),
313
+ request: truncate(str(a?.body) ?? safeJson(span.args) ?? "", 900),
314
+ response: truncate(str(attr(span, "response")) ?? safeJson(span.result) ?? "", 900)
315
+ };
316
+ if (/shell|exec|bash|\brun\b|terminal|command|sandbox|process/.test(tn)) {
317
+ const command = typeof span.args === "string" ? span.args : str(a?.command) ?? str(a?.cmd) ?? span.toolName;
318
+ const output = str(attr(span, "output", "stdout")) ?? (typeof span.result === "string" ? span.result : safeJson(span.result));
319
+ return {
320
+ type: "terminal",
321
+ command: truncate(command, 240),
322
+ output: truncate(output ?? "", 1400)
323
+ };
324
+ }
325
+ return {
326
+ type: "api",
327
+ url: span.toolName,
328
+ request: truncate(safeJson(span.args) ?? "", 900),
329
+ response: truncate(safeJson(span.result) ?? "", 900)
330
+ };
331
+ }
332
+ if (isImageSrc(shot)) return {
333
+ type: "screenshot",
334
+ src: shot
335
+ };
336
+ if (span.kind === "llm") {
337
+ const text = str(span.output) ?? str(span.messages?.[span.messages.length - 1]?.content);
338
+ return text ? {
339
+ type: "prose",
340
+ text: truncate(text, 900)
341
+ } : { type: "none" };
342
+ }
343
+ if (span.kind === "sandbox") return {
344
+ type: "terminal",
345
+ command: span.name,
346
+ output: str(attr(span, "output"))
347
+ };
348
+ return { type: "none" };
315
349
  }
316
350
  function toolLabel(span) {
317
- if (span.kind === "tool") {
318
- const a = asObj(span.args);
319
- const arg = typeof span.args === "string" ? span.args : a ? str(a.path) ?? str(a.url) ?? str(a.command) ?? str(a.query) ?? Object.values(a).find((v) => typeof v === "string") : void 0;
320
- return typeof arg === "string" && arg.length > 0 ? `${span.toolName}: ${truncate(arg, 60)}` : span.toolName;
321
- }
322
- return span.name;
351
+ if (span.kind === "tool") {
352
+ const a = asObj(span.args);
353
+ const arg = typeof span.args === "string" ? span.args : a ? str(a.path) ?? str(a.url) ?? str(a.command) ?? str(a.query) ?? Object.values(a).find((v) => typeof v === "string") : void 0;
354
+ return typeof arg === "string" && arg.length > 0 ? `${span.toolName}: ${truncate(arg, 60)}` : span.toolName;
355
+ }
356
+ return span.name;
323
357
  }
324
358
  function classify(span) {
325
- if (span.status === "error" || span.error) {
326
- return { kind: "observed_failure", importance: 5, label: span.error ?? span.name };
327
- }
328
- if (span.kind === "llm" || span.kind === "agent")
329
- return { kind: "reasoned", importance: 2, label: span.name };
330
- if (span.kind === "judge") return { kind: "evaluated", importance: 2, label: span.name };
331
- if (span.kind === "retrieval") return { kind: "searched", importance: 2, label: span.name };
332
- if (span.kind === "sandbox") return { kind: "ran_command", importance: 3, label: span.name };
333
- if (span.kind === "tool") {
334
- const tn = span.toolName.toLowerCase();
335
- const label = toolLabel(span);
336
- if (/computer|cua|desktop|\bgui\b|xdotool|pyautogui/.test(tn))
337
- return { kind: "used_computer", importance: 3, label };
338
- if (/browser|playwright|puppeteer|\bpage\b|navigate|goto|\bclick\b|screenshot|dom/.test(tn))
339
- return { kind: "used_browser", importance: 3, label };
340
- if (/edit|write|patch|apply|str_replace|create.*file|save/.test(tn))
341
- return { kind: "edited_code", importance: 4, label };
342
- if (/read|\bcat\b|open|view|get.*file|load/.test(tn))
343
- return { kind: "read_file", importance: 2, label };
344
- if (/search|grep|find|glob|query/.test(tn)) return { kind: "searched", importance: 2, label };
345
- if (/http|\bapi\b|fetch|request|webhook|rest|graphql|endpoint/.test(tn) || str(asObj(span.args)?.url)) {
346
- return { kind: "called_api", importance: 3, label };
347
- }
348
- if (/shell|exec|bash|\brun\b|terminal|command|process/.test(tn))
349
- return { kind: "ran_command", importance: 3, label };
350
- return { kind: "called_tool", importance: 3, label };
351
- }
352
- return { kind: "called_tool", importance: 2, label: span.name };
359
+ if (span.status === "error" || span.error) return {
360
+ kind: "observed_failure",
361
+ importance: 5,
362
+ label: span.error ?? span.name
363
+ };
364
+ if (span.kind === "llm" || span.kind === "agent") return {
365
+ kind: "reasoned",
366
+ importance: 2,
367
+ label: span.name
368
+ };
369
+ if (span.kind === "judge") return {
370
+ kind: "evaluated",
371
+ importance: 2,
372
+ label: span.name
373
+ };
374
+ if (span.kind === "retrieval") return {
375
+ kind: "searched",
376
+ importance: 2,
377
+ label: span.name
378
+ };
379
+ if (span.kind === "sandbox") return {
380
+ kind: "ran_command",
381
+ importance: 3,
382
+ label: span.name
383
+ };
384
+ if (span.kind === "tool") {
385
+ const tn = span.toolName.toLowerCase();
386
+ const label = toolLabel(span);
387
+ if (/computer|cua|desktop|\bgui\b|xdotool|pyautogui/.test(tn)) return {
388
+ kind: "used_computer",
389
+ importance: 3,
390
+ label
391
+ };
392
+ if (/browser|playwright|puppeteer|\bpage\b|navigate|goto|\bclick\b|screenshot|dom/.test(tn)) return {
393
+ kind: "used_browser",
394
+ importance: 3,
395
+ label
396
+ };
397
+ if (/edit|write|patch|apply|str_replace|create.*file|save/.test(tn)) return {
398
+ kind: "edited_code",
399
+ importance: 4,
400
+ label
401
+ };
402
+ if (/read|\bcat\b|open|view|get.*file|load/.test(tn)) return {
403
+ kind: "read_file",
404
+ importance: 2,
405
+ label
406
+ };
407
+ if (/search|grep|find|glob|query/.test(tn)) return {
408
+ kind: "searched",
409
+ importance: 2,
410
+ label
411
+ };
412
+ if (/http|\bapi\b|fetch|request|webhook|rest|graphql|endpoint/.test(tn) || str(asObj(span.args)?.url)) return {
413
+ kind: "called_api",
414
+ importance: 3,
415
+ label
416
+ };
417
+ if (/shell|exec|bash|\brun\b|terminal|command|process/.test(tn)) return {
418
+ kind: "ran_command",
419
+ importance: 3,
420
+ label
421
+ };
422
+ return {
423
+ kind: "called_tool",
424
+ importance: 3,
425
+ label
426
+ };
427
+ }
428
+ return {
429
+ kind: "called_tool",
430
+ importance: 2,
431
+ label: span.name
432
+ };
353
433
  }
354
- var KIND_VERB = {
355
- understood_task: "Understood the task",
356
- user_message: "User said",
357
- agent_reply: "Agent replied",
358
- reasoned: "Reasoned",
359
- ran_command: "Ran a command",
360
- read_file: "Read files",
361
- edited_code: "Edited code",
362
- searched: "Searched",
363
- used_browser: "Used the browser",
364
- used_computer: "Controlled the computer",
365
- called_api: "Called an API",
366
- called_tool: "Used a tool",
367
- evaluated: "Evaluated the result",
368
- observed_failure: "Hit a failure",
369
- completed: "Finished"
434
+ const KIND_VERB = {
435
+ understood_task: "Understood the task",
436
+ user_message: "User said",
437
+ agent_reply: "Agent replied",
438
+ reasoned: "Reasoned",
439
+ ran_command: "Ran a command",
440
+ read_file: "Read files",
441
+ edited_code: "Edited code",
442
+ searched: "Searched",
443
+ used_browser: "Used the browser",
444
+ used_computer: "Controlled the computer",
445
+ called_api: "Called an API",
446
+ called_tool: "Used a tool",
447
+ evaluated: "Evaluated the result",
448
+ observed_failure: "Hit a failure",
449
+ completed: "Finished"
370
450
  };
371
- var STANDALONE_KINDS = /* @__PURE__ */ new Set([
372
- "observed_failure",
373
- "understood_task",
374
- "user_message",
375
- "agent_reply"
451
+ /** Kinds that must never collapse into a neighbour — each is its own beat:
452
+ * a failure, and every conversation turn (so the dialogue reads in full). */
453
+ const STANDALONE_KINDS = /* @__PURE__ */ new Set([
454
+ "observed_failure",
455
+ "understood_task",
456
+ "user_message",
457
+ "agent_reply"
376
458
  ]);
459
+ /** Lift the conversation turns out of an LLM span. The user/assistant text
460
+ * lives in `LlmSpan.messages` (role:'user'|'assistant') and the new reply in
461
+ * `output`; the full history repeats across spans, so `seen` dedupes turns to
462
+ * the first time each is said. The first user turn becomes `understood_task`
463
+ * (the premise), later user turns `user_message`, assistant text `agent_reply`. */
377
464
  function conversationEvents(span, seen, state) {
378
- if (span.kind !== "llm") return [];
379
- const out = [];
380
- const emit = (kind, text, importance) => {
381
- const t = text.trim();
382
- if (!t) return;
383
- const who = kind === "agent_reply" ? "a" : "u";
384
- const key = `${who}
385
- ${t}`;
386
- if (seen.has(key)) return;
387
- seen.add(key);
388
- const speaker = kind === "understood_task" ? "Task" : kind === "user_message" ? "User" : "Agent";
389
- out.push({
390
- kind,
391
- title: `${speaker}: ${truncate(t, 64)}`,
392
- summary: truncate(t, 280),
393
- visual: { type: "prose", text: truncate(t, 1200) },
394
- evidenceSpanIds: [span.spanId],
395
- importance,
396
- startTs: span.startedAt,
397
- endTs: span.endedAt ?? span.startedAt
398
- });
399
- };
400
- for (const m of span.messages ?? []) {
401
- const content = str(m.content);
402
- if (!content) continue;
403
- if (m.role === "user") {
404
- emit(state.sawUser ? "user_message" : "understood_task", content, state.sawUser ? 4 : 5);
405
- state.sawUser = true;
406
- } else if (m.role === "assistant") {
407
- emit("agent_reply", content, 3);
408
- }
409
- }
410
- const reply = str(span.output);
411
- if (reply) emit("agent_reply", reply, 3);
412
- return out;
465
+ if (span.kind !== "llm") return [];
466
+ const out = [];
467
+ const emit = (kind, text, importance) => {
468
+ const t = text.trim();
469
+ if (!t) return;
470
+ const key = `${kind === "agent_reply" ? "a" : "u"}\n${t}`;
471
+ if (seen.has(key)) return;
472
+ seen.add(key);
473
+ const speaker = kind === "understood_task" ? "Task" : kind === "user_message" ? "User" : "Agent";
474
+ out.push({
475
+ kind,
476
+ title: `${speaker}: ${truncate(t, 64)}`,
477
+ summary: truncate(t, 280),
478
+ visual: {
479
+ type: "prose",
480
+ text: truncate(t, 1200)
481
+ },
482
+ evidenceSpanIds: [span.spanId],
483
+ importance,
484
+ startTs: span.startedAt,
485
+ endTs: span.endedAt ?? span.startedAt
486
+ });
487
+ };
488
+ for (const m of span.messages ?? []) {
489
+ const content = str(m.content);
490
+ if (!content) continue;
491
+ if (m.role === "user") {
492
+ emit(state.sawUser ? "user_message" : "understood_task", content, state.sawUser ? 4 : 5);
493
+ state.sawUser = true;
494
+ } else if (m.role === "assistant") emit("agent_reply", content, 3);
495
+ }
496
+ const reply = str(span.output);
497
+ if (reply) emit("agent_reply", reply, 3);
498
+ return out;
413
499
  }
500
+ /**
501
+ * Reduce a span tree into the meaningful moments a viewer cares about. The
502
+ * conversation (user asks, agent replies) is lifted from LLM spans first so the
503
+ * dialogue is first-class; the remaining work spans are classified + have their
504
+ * modality visual extracted. Adjacent same-kind work moments collapse (the
505
+ * compression step), carrying the latest visual; failures and conversation
506
+ * turns never collapse.
507
+ */
414
508
  function reduceToSemanticEvents(spans, opts = {}) {
415
- const collapse = opts.collapseAdjacent ?? true;
416
- const ordered = [...spans].sort((a, b) => a.startedAt - b.startedAt);
417
- const seen = /* @__PURE__ */ new Set();
418
- const convState = { sawUser: false };
419
- const raw = [];
420
- for (const s of ordered) {
421
- const conv = conversationEvents(s, seen, convState);
422
- if (conv.length > 0) {
423
- raw.push(...conv);
424
- continue;
425
- }
426
- const c = classify(s);
427
- raw.push({
428
- kind: c.kind,
429
- title: c.label,
430
- summary: `${KIND_VERB[c.kind]} \u2014 ${c.label}`,
431
- visual: extractVisual(s),
432
- evidenceSpanIds: [s.spanId],
433
- importance: c.importance,
434
- startTs: s.startedAt,
435
- endTs: s.endedAt ?? s.startedAt
436
- });
437
- }
438
- if (!collapse) return raw;
439
- const merged = [];
440
- for (const ev of raw) {
441
- const prev = merged[merged.length - 1];
442
- if (prev && prev.kind === ev.kind && !STANDALONE_KINDS.has(ev.kind)) {
443
- prev.evidenceSpanIds.push(...ev.evidenceSpanIds);
444
- prev.endTs = Math.max(prev.endTs, ev.endTs);
445
- if (ev.visual.type !== "none") prev.visual = ev.visual;
446
- const n = prev.evidenceSpanIds.length;
447
- prev.title = `${KIND_VERB[ev.kind]} (${n}\xD7)`;
448
- prev.summary = `${KIND_VERB[ev.kind]} ${n} time${n === 1 ? "" : "s"} \u2014 latest: ${ev.title}`;
449
- } else {
450
- merged.push({ ...ev, evidenceSpanIds: [...ev.evidenceSpanIds] });
451
- }
452
- }
453
- return merged;
509
+ const collapse = opts.collapseAdjacent ?? true;
510
+ const ordered = [...spans].sort((a, b) => a.startedAt - b.startedAt);
511
+ const seen = /* @__PURE__ */ new Set();
512
+ const convState = { sawUser: false };
513
+ const raw = [];
514
+ for (const s of ordered) {
515
+ const conv = conversationEvents(s, seen, convState);
516
+ if (conv.length > 0) {
517
+ raw.push(...conv);
518
+ continue;
519
+ }
520
+ const c = classify(s);
521
+ raw.push({
522
+ kind: c.kind,
523
+ title: c.label,
524
+ summary: `${KIND_VERB[c.kind]} ${c.label}`,
525
+ visual: extractVisual(s),
526
+ evidenceSpanIds: [s.spanId],
527
+ importance: c.importance,
528
+ startTs: s.startedAt,
529
+ endTs: s.endedAt ?? s.startedAt
530
+ });
531
+ }
532
+ if (!collapse) return raw;
533
+ const merged = [];
534
+ for (const ev of raw) {
535
+ const prev = merged[merged.length - 1];
536
+ if (prev && prev.kind === ev.kind && !STANDALONE_KINDS.has(ev.kind)) {
537
+ prev.evidenceSpanIds.push(...ev.evidenceSpanIds);
538
+ prev.endTs = Math.max(prev.endTs, ev.endTs);
539
+ if (ev.visual.type !== "none") prev.visual = ev.visual;
540
+ const n = prev.evidenceSpanIds.length;
541
+ prev.title = `${KIND_VERB[ev.kind]} (${n}×)`;
542
+ prev.summary = `${KIND_VERB[ev.kind]} ${n} time${n === 1 ? "" : "s"} latest: ${ev.title}`;
543
+ } else merged.push({
544
+ ...ev,
545
+ evidenceSpanIds: [...ev.evidenceSpanIds]
546
+ });
547
+ }
548
+ return merged;
454
549
  }
455
- var KIND_TO_SCENE = {
456
- understood_task: "title_card",
457
- user_message: "prompt",
458
- agent_reply: "reply",
459
- reasoned: "reasoning",
460
- ran_command: "terminal",
461
- read_file: "file",
462
- edited_code: "diff",
463
- searched: "search",
464
- used_browser: "browser",
465
- used_computer: "computer",
466
- called_api: "api",
467
- called_tool: "tool",
468
- evaluated: "eval",
469
- observed_failure: "error",
470
- completed: "summary"
550
+ const KIND_TO_SCENE = {
551
+ understood_task: "title_card",
552
+ user_message: "prompt",
553
+ agent_reply: "reply",
554
+ reasoned: "reasoning",
555
+ ran_command: "terminal",
556
+ read_file: "file",
557
+ edited_code: "diff",
558
+ searched: "search",
559
+ used_browser: "browser",
560
+ used_computer: "computer",
561
+ called_api: "api",
562
+ called_tool: "tool",
563
+ evaluated: "eval",
564
+ observed_failure: "error",
565
+ completed: "summary"
471
566
  };
472
- var DURATION_BY_IMPORTANCE = {
473
- 1: 2500,
474
- 2: 3e3,
475
- 3: 4e3,
476
- 4: 5e3,
477
- 5: 6e3
567
+ const DURATION_BY_IMPORTANCE = {
568
+ 1: 2500,
569
+ 2: 3e3,
570
+ 3: 4e3,
571
+ 4: 5e3,
572
+ 5: 6e3
478
573
  };
574
+ /**
575
+ * Select the moments worth showing and lay them out as scenes. Every failure
576
+ * (importance 5) and edit (4) is always kept; the rest fill the budget by
577
+ * importance, then re-sort chronological. A title card opens, a summary closes.
578
+ */
479
579
  function compileStoryboard(events, opts = {}) {
480
- const title = opts.title ?? "Agent run";
481
- const maxScenes = opts.maxScenes ?? 16;
482
- const taskEvent = events.find((e) => e.kind === "understood_task");
483
- const indexed = events.filter((ev) => ev.kind !== "understood_task").map((ev, i) => ({ ev, i }));
484
- const mustKeep = indexed.filter(({ ev }) => ev.importance >= 4);
485
- const rest = indexed.filter(({ ev }) => ev.importance < 4).sort((a, b) => b.ev.importance - a.ev.importance || a.i - b.i);
486
- const budget = Math.max(0, maxScenes - mustKeep.length);
487
- const selected = [...mustKeep, ...rest.slice(0, budget)].sort((a, b) => a.i - b.i);
488
- const actionScenes = selected.map(({ ev }) => ({
489
- sceneType: KIND_TO_SCENE[ev.kind],
490
- title: ev.title,
491
- narration: ev.summary,
492
- visual: ev.visual,
493
- durationMs: DURATION_BY_IMPORTANCE[ev.importance],
494
- evidenceSpanIds: ev.evidenceSpanIds
495
- }));
496
- const failures = events.filter((e) => e.kind === "observed_failure").length;
497
- const edits = events.filter((e) => e.kind === "edited_code").length;
498
- const commands = events.filter((e) => e.kind === "ran_command").length;
499
- const summaryNarration = `${events.length} moments \xB7 ${commands} command${commands === 1 ? "" : "s"} \xB7 ${edits} edit${edits === 1 ? "" : "s"} \xB7 ${failures} failure${failures === 1 ? "" : "s"}`;
500
- const scenes = [
501
- {
502
- sceneType: "title_card",
503
- title,
504
- narration: taskEvent ? taskEvent.summary : "The agent receives its task.",
505
- visual: taskEvent ? taskEvent.visual : { type: "none" },
506
- durationMs: 3e3,
507
- evidenceSpanIds: taskEvent ? taskEvent.evidenceSpanIds : []
508
- },
509
- ...actionScenes,
510
- {
511
- sceneType: "summary",
512
- title: failures > 0 ? "Finished \u2014 with failures" : "Finished",
513
- narration: summaryNarration,
514
- visual: { type: "none" },
515
- durationMs: 4e3,
516
- evidenceSpanIds: []
517
- }
518
- ];
519
- return { title, totalMs: scenes.reduce((s, sc) => s + sc.durationMs, 0), scenes };
580
+ const title = opts.title ?? "Agent run";
581
+ const maxScenes = opts.maxScenes ?? 16;
582
+ const taskEvent = events.find((e) => e.kind === "understood_task");
583
+ const indexed = events.filter((ev) => ev.kind !== "understood_task").map((ev, i) => ({
584
+ ev,
585
+ i
586
+ }));
587
+ const mustKeep = indexed.filter(({ ev }) => ev.importance >= 4);
588
+ const rest = indexed.filter(({ ev }) => ev.importance < 4).sort((a, b) => b.ev.importance - a.ev.importance || a.i - b.i);
589
+ const budget = Math.max(0, maxScenes - mustKeep.length);
590
+ const actionScenes = [...mustKeep, ...rest.slice(0, budget)].sort((a, b) => a.i - b.i).map(({ ev }) => ({
591
+ sceneType: KIND_TO_SCENE[ev.kind],
592
+ title: ev.title,
593
+ narration: ev.summary,
594
+ visual: ev.visual,
595
+ durationMs: DURATION_BY_IMPORTANCE[ev.importance],
596
+ evidenceSpanIds: ev.evidenceSpanIds
597
+ }));
598
+ const failures = events.filter((e) => e.kind === "observed_failure").length;
599
+ const edits = events.filter((e) => e.kind === "edited_code").length;
600
+ const commands = events.filter((e) => e.kind === "ran_command").length;
601
+ const summaryNarration = `${events.length} moments · ${commands} command${commands === 1 ? "" : "s"} · ${edits} edit${edits === 1 ? "" : "s"} · ${failures} failure${failures === 1 ? "" : "s"}`;
602
+ const scenes = [
603
+ {
604
+ sceneType: "title_card",
605
+ title,
606
+ narration: taskEvent ? taskEvent.summary : "The agent receives its task.",
607
+ visual: taskEvent ? taskEvent.visual : { type: "none" },
608
+ durationMs: 3e3,
609
+ evidenceSpanIds: taskEvent ? taskEvent.evidenceSpanIds : []
610
+ },
611
+ ...actionScenes,
612
+ {
613
+ sceneType: "summary",
614
+ title: failures > 0 ? "Finished — with failures" : "Finished",
615
+ narration: summaryNarration,
616
+ visual: { type: "none" },
617
+ durationMs: 4e3,
618
+ evidenceSpanIds: []
619
+ }
620
+ ];
621
+ return {
622
+ title,
623
+ totalMs: scenes.reduce((s, sc) => s + sc.durationMs, 0),
624
+ scenes
625
+ };
520
626
  }
521
- var SCENE_ICON = {
522
- title_card: "\u{1F3AC}",
523
- prompt: "\u{1F4AC}",
524
- reply: "\u{1F916}",
525
- reasoning: "\u{1F9E0}",
526
- terminal: "\u2328\uFE0F",
527
- file: "\u{1F4C4}",
528
- diff: "\u270F\uFE0F",
529
- search: "\u{1F50E}",
530
- browser: "\u{1F310}",
531
- computer: "\u{1F5A5}\uFE0F",
532
- api: "\u{1F50C}",
533
- tool: "\u{1F527}",
534
- eval: "\u2696\uFE0F",
535
- error: "\u274C",
536
- summary: "\u{1F3C1}"
627
+ const SCENE_ICON = {
628
+ title_card: "🎬",
629
+ prompt: "💬",
630
+ reply: "🤖",
631
+ reasoning: "🧠",
632
+ terminal: "⌨️",
633
+ file: "📄",
634
+ diff: "✏️",
635
+ search: "🔎",
636
+ browser: "🌐",
637
+ computer: "🖥️",
638
+ api: "🔌",
639
+ tool: "🔧",
640
+ eval: "⚖️",
641
+ error: "",
642
+ summary: "🏁"
537
643
  };
538
644
  function mmss(ms) {
539
- const s = Math.round(ms / 1e3);
540
- return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
645
+ const s = Math.round(ms / 1e3);
646
+ return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
541
647
  }
542
648
  function truncate(s, max) {
543
- return s.length <= max ? s : `${s.slice(0, Math.max(0, max - 1))}\u2026`;
649
+ return s.length <= max ? s : `${s.slice(0, Math.max(0, max - 1))}…`;
544
650
  }
545
651
  function escapeHtml(s) {
546
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
652
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
547
653
  }
654
+ /** A short modality tag for the markdown shot list. */
548
655
  function visualMarkdown(v) {
549
- switch (v.type) {
550
- case "screenshot":
551
- return `\u{1F5BC} screenshot (${truncate(v.src, 60)})`;
552
- case "browser":
553
- return `\u{1F310} ${v.action ?? "browser"}${v.url ? ` \u2192 ${v.url}` : ""}${v.screenshot ? " [screenshot]" : ""}`;
554
- case "diff":
555
- return `
556
-
557
- \`\`\`diff
558
- ${truncate(v.patch, 600)}
559
- \`\`\`${v.path ? `
560
- _${v.path}_` : ""}`;
561
- case "code":
562
- return `
563
-
564
- \`\`\`
565
- ${truncate(v.content, 500)}
566
- \`\`\`${v.path ? `
567
- _${v.path}_` : ""}`;
568
- case "terminal":
569
- return `
570
-
571
- \`\`\`sh
572
- $ ${v.command}${v.output ? `
573
- ${truncate(v.output, 500)}` : ""}
574
- \`\`\``;
575
- case "api":
576
- return `\u{1F50C} ${v.method ?? "CALL"} ${v.url}${v.status != null ? ` \u2192 ${v.status}` : ""}`;
577
- case "prose":
578
- return `
579
-
580
- > ${truncate(v.text, 400).replace(/\n/g, "\n> ")}`;
581
- default:
582
- return "";
583
- }
656
+ switch (v.type) {
657
+ case "screenshot": return `🖼 screenshot (${truncate(v.src, 60)})`;
658
+ case "browser": return `🌐 ${v.action ?? "browser"}${v.url ? ` → ${v.url}` : ""}${v.screenshot ? " [screenshot]" : ""}`;
659
+ case "diff": return `\n\n\`\`\`diff\n${truncate(v.patch, 600)}\n\`\`\`${v.path ? `\n_${v.path}_` : ""}`;
660
+ case "code": return `\n\n\`\`\`\n${truncate(v.content, 500)}\n\`\`\`${v.path ? `\n_${v.path}_` : ""}`;
661
+ case "terminal": return `\n\n\`\`\`sh\n$ ${v.command}${v.output ? `\n${truncate(v.output, 500)}` : ""}\n\`\`\``;
662
+ case "api": return `🔌 ${v.method ?? "CALL"} ${v.url}${v.status != null ? ` → ${v.status}` : ""}`;
663
+ case "prose": return `\n\n> ${truncate(v.text, 400).replace(/\n/g, "\n> ")}`;
664
+ default: return "";
665
+ }
584
666
  }
667
+ /** Build the (escaped, structured) HTML for a scene's visual. We never inject
668
+ * raw agent markup — every text part is escaped; only image `src` (data/http)
669
+ * is passed through as an attribute. */
585
670
  function visualHtml(v) {
586
- switch (v.type) {
587
- case "screenshot":
588
- return `<img class="shot" src="${escapeHtml(v.src)}" alt="screenshot" loading="lazy"/>`;
589
- case "browser": {
590
- const bar = `<div class="urlbar">${escapeHtml(v.url ?? v.action ?? "browser")}</div>`;
591
- const body = isImageSrc(v.screenshot) ? `<img class="shot" src="${escapeHtml(v.screenshot)}" alt="page" loading="lazy"/>` : `<div class="browser-action">${escapeHtml(v.action ?? "navigated")}</div>`;
592
- return `<div class="browser">${bar}${body}</div>`;
593
- }
594
- case "diff": {
595
- const lines = v.patch.split("\n").map((l) => {
596
- const cls = l.startsWith("+") ? "add" : l.startsWith("-") ? "del" : "";
597
- return `<span class="${cls}">${escapeHtml(l)}</span>`;
598
- });
599
- return `${v.path ? `<div class="pathhdr">${escapeHtml(v.path)}</div>` : ""}<pre class="diff">${lines.join("\n")}</pre>`;
600
- }
601
- case "code":
602
- return `${v.path ? `<div class="pathhdr">${escapeHtml(v.path)}</div>` : ""}<pre class="code">${escapeHtml(v.content)}</pre>`;
603
- case "terminal":
604
- return `<pre class="term"><span class="cmd">$ ${escapeHtml(v.command)}</span>${v.output ? `
605
- ${escapeHtml(v.output)}` : ""}</pre>`;
606
- case "api": {
607
- const badge = `<span class="method">${escapeHtml(v.method ?? "CALL")}</span> <span class="url">${escapeHtml(v.url)}</span>${v.status != null ? ` <span class="status s${Math.floor(v.status / 100)}">${v.status}</span>` : ""}`;
608
- const req = v.request ? `<div class="kv"><b>req</b><pre>${escapeHtml(v.request)}</pre></div>` : "";
609
- const res = v.response ? `<div class="kv"><b>res</b><pre>${escapeHtml(v.response)}</pre></div>` : "";
610
- return `<div class="api"><div class="apihdr">${badge}</div>${req}${res}</div>`;
611
- }
612
- case "prose":
613
- return `<div class="prose">${escapeHtml(v.text)}</div>`;
614
- default:
615
- return "";
616
- }
671
+ switch (v.type) {
672
+ case "screenshot": return `<img class="shot" src="${escapeHtml(v.src)}" alt="screenshot" loading="lazy"/>`;
673
+ case "browser": return `<div class="browser">${`<div class="urlbar">${escapeHtml(v.url ?? v.action ?? "browser")}</div>`}${isImageSrc(v.screenshot) ? `<img class="shot" src="${escapeHtml(v.screenshot)}" alt="page" loading="lazy"/>` : `<div class="browser-action">${escapeHtml(v.action ?? "navigated")}</div>`}</div>`;
674
+ case "diff": {
675
+ const lines = v.patch.split("\n").map((l) => {
676
+ return `<span class="${l.startsWith("+") ? "add" : l.startsWith("-") ? "del" : ""}">${escapeHtml(l)}</span>`;
677
+ });
678
+ return `${v.path ? `<div class="pathhdr">${escapeHtml(v.path)}</div>` : ""}<pre class="diff">${lines.join("\n")}</pre>`;
679
+ }
680
+ case "code": return `${v.path ? `<div class="pathhdr">${escapeHtml(v.path)}</div>` : ""}<pre class="code">${escapeHtml(v.content)}</pre>`;
681
+ case "terminal": return `<pre class="term"><span class="cmd">$ ${escapeHtml(v.command)}</span>${v.output ? `\n${escapeHtml(v.output)}` : ""}</pre>`;
682
+ case "api": return `<div class="api"><div class="apihdr">${`<span class="method">${escapeHtml(v.method ?? "CALL")}</span> <span class="url">${escapeHtml(v.url)}</span>${v.status != null ? ` <span class="status s${Math.floor(v.status / 100)}">${v.status}</span>` : ""}`}</div>${v.request ? `<div class="kv"><b>req</b><pre>${escapeHtml(v.request)}</pre></div>` : ""}${v.response ? `<div class="kv"><b>res</b><pre>${escapeHtml(v.response)}</pre></div>` : ""}</div>`;
683
+ case "prose": return `<div class="prose">${escapeHtml(v.text)}</div>`;
684
+ default: return "";
685
+ }
617
686
  }
687
+ /** Render the storyboard as a Markdown timeline — the human-readable shot list. */
618
688
  function renderStoryboardMarkdown(storyboard) {
619
- const out = [
620
- `# \u{1F3AC} ${storyboard.title}`,
621
- "",
622
- `_${storyboard.scenes.length} scenes \xB7 ${mmss(storyboard.totalMs)} replay_`,
623
- ""
624
- ];
625
- let elapsed = 0;
626
- for (const sc of storyboard.scenes) {
627
- out.push(`### [${mmss(elapsed)}] ${SCENE_ICON[sc.sceneType]} ${sc.title}`);
628
- out.push("");
629
- out.push(sc.narration);
630
- const vm = visualMarkdown(sc.visual);
631
- if (vm) out.push(vm);
632
- if (sc.evidenceSpanIds.length > 0) {
633
- out.push("");
634
- out.push(`_evidence: ${sc.evidenceSpanIds.length} span(s)_`);
635
- }
636
- out.push("");
637
- elapsed += sc.durationMs;
638
- }
639
- return out.join("\n");
689
+ const out = [
690
+ `# 🎬 ${storyboard.title}`,
691
+ "",
692
+ `_${storyboard.scenes.length} scenes · ${mmss(storyboard.totalMs)} replay_`,
693
+ ""
694
+ ];
695
+ let elapsed = 0;
696
+ for (const sc of storyboard.scenes) {
697
+ out.push(`### [${mmss(elapsed)}] ${SCENE_ICON[sc.sceneType]} ${sc.title}`);
698
+ out.push("");
699
+ out.push(sc.narration);
700
+ const vm = visualMarkdown(sc.visual);
701
+ if (vm) out.push(vm);
702
+ if (sc.evidenceSpanIds.length > 0) {
703
+ out.push("");
704
+ out.push(`_evidence: ${sc.evidenceSpanIds.length} span(s)_`);
705
+ }
706
+ out.push("");
707
+ elapsed += sc.durationMs;
708
+ }
709
+ return out.join("\n");
640
710
  }
711
+ /**
712
+ * Render the storyboard as a self-contained, auto-playing HTML replay — one
713
+ * shareable file, no build step, no external assets. Each scene animates in
714
+ * for its duration and SHOWS its modality (screenshot / diff / terminal / API
715
+ * / browser / prose); controls let a viewer scrub. This is the "free clip" a
716
+ * run produces; an MP4 is the same storyboard fed to Remotion in a consumer.
717
+ */
641
718
  function renderStoryboardHtml(storyboard, opts = {}) {
642
- const docTitle = opts.title ?? storyboard.title;
643
- const scenesJson = JSON.stringify(
644
- storyboard.scenes.map((s) => ({
645
- icon: SCENE_ICON[s.sceneType],
646
- type: s.sceneType,
647
- title: s.title,
648
- narration: s.narration,
649
- durationMs: s.durationMs,
650
- evidence: s.evidenceSpanIds.length,
651
- visual: visualHtml(s.visual)
652
- }))
653
- ).replace(/</g, "\\u003c");
654
- return `<!doctype html>
719
+ const docTitle = opts.title ?? storyboard.title;
720
+ const scenesJson = JSON.stringify(storyboard.scenes.map((s) => ({
721
+ icon: SCENE_ICON[s.sceneType],
722
+ type: s.sceneType,
723
+ title: s.title,
724
+ narration: s.narration,
725
+ durationMs: s.durationMs,
726
+ evidence: s.evidenceSpanIds.length,
727
+ visual: visualHtml(s.visual)
728
+ }))).replace(/</g, "\\u003c");
729
+ return `<!doctype html>
655
730
  <html lang="en">
656
731
  <head>
657
732
  <meta charset="utf-8" />
@@ -704,7 +779,7 @@ function renderStoryboardHtml(storyboard, opts = {}) {
704
779
  </head>
705
780
  <body>
706
781
  <div class="stage">
707
- <h1>\u{1F3AC} ${escapeHtml(docTitle)}</h1>
782
+ <h1>🎬 ${escapeHtml(docTitle)}</h1>
708
783
  <div class="card" id="card">
709
784
  <div class="head"><span class="icon" id="icon"></span><span class="title" id="title"></span></div>
710
785
  <div class="narration" id="narration"></div>
@@ -712,9 +787,9 @@ function renderStoryboardHtml(storyboard, opts = {}) {
712
787
  <div class="bar"><i id="fill"></i></div>
713
788
  </div>
714
789
  <div class="controls">
715
- <button id="playPause">\u23F8 Pause</button>
716
- <button id="prev">\u25C0 Prev</button>
717
- <button id="next">Next \u25B6</button>
790
+ <button id="playPause">⏸ Pause</button>
791
+ <button id="prev">◀ Prev</button>
792
+ <button id="next">Next ▶</button>
718
793
  <span id="counter"></span>
719
794
  <span class="dots" id="dots"></span>
720
795
  </div>
@@ -743,25 +818,17 @@ function renderStoryboardHtml(storyboard, opts = {}) {
743
818
  if (playing) raf = requestAnimationFrame(tick);
744
819
  }
745
820
  function go(n) { i = Math.max(0, Math.min(SCENES.length - 1, n)); start = 0; cancelAnimationFrame(raf); paint(); if (playing) raf = requestAnimationFrame(tick); }
746
- function updateBtn() { document.getElementById('playPause').textContent = playing ? '\u23F8 Pause' : '\u25B6 Play'; }
821
+ function updateBtn() { document.getElementById('playPause').textContent = playing ? ' Pause' : ' Play'; }
747
822
  document.getElementById('playPause').onclick = () => { playing = !playing; updateBtn(); start = 0; if (playing) raf = requestAnimationFrame(tick); else cancelAnimationFrame(raf); };
748
823
  document.getElementById('next').onclick = () => go(i + 1);
749
824
  document.getElementById('prev').onclick = () => go(i - 1);
750
825
  paint(); raf = requestAnimationFrame(tick);
751
- </script>
826
+ <\/script>
752
827
  </body>
753
828
  </html>
754
829
  `;
755
830
  }
756
- export {
757
- codeEditFromSpan,
758
- codeEditsForStoryboard,
759
- compileStoryboard,
760
- editAnimationText,
761
- extractCodeEdits,
762
- reduceToSemanticEvents,
763
- renderCodeAnimationHtml,
764
- renderStoryboardHtml,
765
- renderStoryboardMarkdown
766
- };
831
+ //#endregion
832
+ export { codeEditFromSpan, codeEditsForStoryboard, compileStoryboard, editAnimationText, extractCodeEdits, reduceToSemanticEvents, renderCodeAnimationHtml, renderStoryboardHtml, renderStoryboardMarkdown };
833
+
767
834
  //# sourceMappingURL=index.js.map