@hanzo/dev 4.0.1 → 4.2.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 (371) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
  3. package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
  4. package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
  5. package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
  6. package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
  7. package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
  8. package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
  9. package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
  10. package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
  11. package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
  12. package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
  13. package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
  14. package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
  15. package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
  16. package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
  17. package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
  18. package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
  19. package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
  20. package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
  21. package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
  22. package/dist/builder/activity.d.ts +16 -0
  23. package/dist/builder/activity.js +51 -0
  24. package/dist/builder/address.d.ts +11 -0
  25. package/dist/builder/address.js +50 -0
  26. package/dist/builder/ago.d.ts +2 -0
  27. package/dist/builder/ago.js +18 -0
  28. package/dist/builder/api/agents.d.ts +139 -0
  29. package/dist/builder/api/agents.js +253 -0
  30. package/dist/builder/api/auto.d.ts +166 -0
  31. package/dist/builder/api/auto.js +300 -0
  32. package/dist/builder/api/billing.d.ts +263 -0
  33. package/dist/builder/api/billing.js +401 -0
  34. package/dist/builder/api/call.d.ts +53 -0
  35. package/dist/builder/api/call.js +123 -0
  36. package/dist/builder/api/capabilities.d.ts +14 -0
  37. package/dist/builder/api/capabilities.js +41 -0
  38. package/dist/builder/api/changes.d.ts +74 -0
  39. package/dist/builder/api/changes.js +75 -0
  40. package/dist/builder/api/chat.d.ts +12 -0
  41. package/dist/builder/api/chat.js +28 -0
  42. package/dist/builder/api/cli.d.ts +59 -0
  43. package/dist/builder/api/cli.js +133 -0
  44. package/dist/builder/api/codebases.d.ts +46 -0
  45. package/dist/builder/api/codebases.js +100 -0
  46. package/dist/builder/api/coding.d.ts +117 -0
  47. package/dist/builder/api/coding.js +222 -0
  48. package/dist/builder/api/connectors.d.ts +76 -0
  49. package/dist/builder/api/connectors.js +111 -0
  50. package/dist/builder/api/consent.d.ts +22 -0
  51. package/dist/builder/api/consent.js +28 -0
  52. package/dist/builder/api/conversations.d.ts +20 -0
  53. package/dist/builder/api/conversations.js +23 -0
  54. package/dist/builder/api/draft.d.ts +38 -0
  55. package/dist/builder/api/draft.js +87 -0
  56. package/dist/builder/api/environment.d.ts +55 -0
  57. package/dist/builder/api/environment.js +126 -0
  58. package/dist/builder/api/gallery.d.ts +32 -0
  59. package/dist/builder/api/gallery.js +85 -0
  60. package/dist/builder/api/git.d.ts +59 -0
  61. package/dist/builder/api/git.js +117 -0
  62. package/dist/builder/api/github.d.ts +230 -0
  63. package/dist/builder/api/github.js +373 -0
  64. package/dist/builder/api/keys.d.ts +35 -0
  65. package/dist/builder/api/keys.js +72 -0
  66. package/dist/builder/api/library.d.ts +116 -0
  67. package/dist/builder/api/library.js +214 -0
  68. package/dist/builder/api/limits.d.ts +69 -0
  69. package/dist/builder/api/limits.js +86 -0
  70. package/dist/builder/api/links.d.ts +51 -0
  71. package/dist/builder/api/links.js +75 -0
  72. package/dist/builder/api/machines.d.ts +122 -0
  73. package/dist/builder/api/machines.js +238 -0
  74. package/dist/builder/api/mcp.d.ts +10 -0
  75. package/dist/builder/api/mcp.js +47 -0
  76. package/dist/builder/api/members.d.ts +35 -0
  77. package/dist/builder/api/members.js +95 -0
  78. package/dist/builder/api/memory.d.ts +14 -0
  79. package/dist/builder/api/memory.js +35 -0
  80. package/dist/builder/api/models.d.ts +17 -0
  81. package/dist/builder/api/models.js +20 -0
  82. package/dist/builder/api/places.d.ts +32 -0
  83. package/dist/builder/api/places.js +29 -0
  84. package/dist/builder/api/platform.d.ts +68 -0
  85. package/dist/builder/api/platform.js +87 -0
  86. package/dist/builder/api/plugins.d.ts +42 -0
  87. package/dist/builder/api/plugins.js +175 -0
  88. package/dist/builder/api/pref.d.ts +77 -0
  89. package/dist/builder/api/pref.js +93 -0
  90. package/dist/builder/api/profile.d.ts +11 -0
  91. package/dist/builder/api/profile.js +41 -0
  92. package/dist/builder/api/projects.d.ts +99 -0
  93. package/dist/builder/api/projects.js +166 -0
  94. package/dist/builder/api/provider.d.ts +49 -0
  95. package/dist/builder/api/provider.js +96 -0
  96. package/dist/builder/api/sandbox.d.ts +90 -0
  97. package/dist/builder/api/sandbox.js +223 -0
  98. package/dist/builder/api/sessions.d.ts +123 -0
  99. package/dist/builder/api/sessions.js +255 -0
  100. package/dist/builder/api/skills.d.ts +82 -0
  101. package/dist/builder/api/skills.js +117 -0
  102. package/dist/builder/api/sse.d.ts +24 -0
  103. package/dist/builder/api/sse.js +68 -0
  104. package/dist/builder/api/studio.d.ts +59 -0
  105. package/dist/builder/api/studio.js +91 -0
  106. package/dist/builder/api/talk.d.ts +48 -0
  107. package/dist/builder/api/talk.js +81 -0
  108. package/dist/builder/api/tools.d.ts +34 -0
  109. package/dist/builder/api/tools.js +37 -0
  110. package/dist/builder/api/turn.d.ts +202 -0
  111. package/dist/builder/api/turn.js +772 -0
  112. package/dist/builder/api/verdict.d.ts +3 -0
  113. package/dist/builder/api/verdict.js +21 -0
  114. package/dist/builder/api/webhooks.d.ts +47 -0
  115. package/dist/builder/api/webhooks.js +82 -0
  116. package/dist/builder/api/work.d.ts +110 -0
  117. package/dist/builder/api/work.js +218 -0
  118. package/dist/builder/ask.d.ts +51 -0
  119. package/dist/builder/ask.js +147 -0
  120. package/dist/builder/automations.d.ts +33 -0
  121. package/dist/builder/automations.js +453 -0
  122. package/dist/builder/awake.d.ts +24 -0
  123. package/dist/builder/awake.js +68 -0
  124. package/dist/builder/back.d.ts +30 -0
  125. package/dist/builder/back.js +105 -0
  126. package/dist/builder/builder.d.ts +12 -0
  127. package/dist/builder/builder.js +162 -0
  128. package/dist/builder/carry.d.ts +48 -0
  129. package/dist/builder/carry.js +278 -0
  130. package/dist/builder/choice.d.ts +134 -0
  131. package/dist/builder/choice.js +152 -0
  132. package/dist/builder/claims.d.ts +13 -0
  133. package/dist/builder/claims.js +35 -0
  134. package/dist/builder/clipboard.d.ts +2 -0
  135. package/dist/builder/clipboard.js +10 -0
  136. package/dist/builder/customize/agents.d.ts +11 -0
  137. package/dist/builder/customize/agents.js +513 -0
  138. package/dist/builder/customize/connectors.d.ts +2 -0
  139. package/dist/builder/customize/connectors.js +319 -0
  140. package/dist/builder/customize/drafted.d.ts +4 -0
  141. package/dist/builder/customize/drafted.js +92 -0
  142. package/dist/builder/customize/index.d.ts +8 -0
  143. package/dist/builder/customize/index.js +127 -0
  144. package/dist/builder/customize/inventory.d.ts +14 -0
  145. package/dist/builder/customize/inventory.js +127 -0
  146. package/dist/builder/customize/load.d.ts +9 -0
  147. package/dist/builder/customize/load.js +22 -0
  148. package/dist/builder/customize/ocean.d.ts +41 -0
  149. package/dist/builder/customize/ocean.js +332 -0
  150. package/dist/builder/customize/plugins.d.ts +2 -0
  151. package/dist/builder/customize/plugins.js +136 -0
  152. package/dist/builder/customize/roles.d.ts +4 -0
  153. package/dist/builder/customize/roles.js +105 -0
  154. package/dist/builder/customize/say.d.ts +13 -0
  155. package/dist/builder/customize/say.js +32 -0
  156. package/dist/builder/customize/skills.d.ts +2 -0
  157. package/dist/builder/customize/skills.js +208 -0
  158. package/dist/builder/customize/ui.d.ts +152 -0
  159. package/dist/builder/customize/ui.js +208 -0
  160. package/dist/builder/data.d.ts +57 -0
  161. package/dist/builder/data.js +322 -0
  162. package/dist/builder/design.d.ts +140 -0
  163. package/dist/builder/design.js +175 -0
  164. package/dist/builder/desk.d.ts +48 -0
  165. package/dist/builder/desk.js +449 -0
  166. package/dist/builder/dev-mode.d.ts +43 -0
  167. package/dist/builder/dev-mode.js +120 -0
  168. package/dist/builder/door.d.ts +11 -0
  169. package/dist/builder/door.js +126 -0
  170. package/dist/builder/environment.d.ts +23 -0
  171. package/dist/builder/environment.js +193 -0
  172. package/dist/builder/files.d.ts +23 -0
  173. package/dist/builder/files.js +175 -0
  174. package/dist/builder/find.d.ts +7 -0
  175. package/dist/builder/find.js +80 -0
  176. package/dist/builder/foot.d.ts +30 -0
  177. package/dist/builder/foot.js +79 -0
  178. package/dist/builder/forge.d.ts +4 -0
  179. package/dist/builder/forge.js +639 -0
  180. package/dist/builder/gear.d.ts +60 -0
  181. package/dist/builder/gear.js +180 -0
  182. package/dist/builder/git.d.ts +21 -0
  183. package/dist/builder/git.js +118 -0
  184. package/dist/builder/github-sync.d.ts +70 -0
  185. package/dist/builder/github-sync.js +435 -0
  186. package/dist/builder/gutter.d.ts +17 -0
  187. package/dist/builder/gutter.js +25 -0
  188. package/dist/builder/handoff.d.ts +8 -0
  189. package/dist/builder/handoff.js +22 -0
  190. package/dist/builder/host.d.ts +189 -0
  191. package/dist/builder/host.js +46 -0
  192. package/dist/builder/index.d.ts +108 -0
  193. package/dist/builder/index.js +99 -0
  194. package/dist/builder/landing.d.ts +34 -0
  195. package/dist/builder/landing.js +725 -0
  196. package/dist/builder/library.d.ts +21 -0
  197. package/dist/builder/library.js +526 -0
  198. package/dist/builder/local.d.ts +80 -0
  199. package/dist/builder/local.js +124 -0
  200. package/dist/builder/make.d.ts +10 -0
  201. package/dist/builder/make.js +120 -0
  202. package/dist/builder/markdown.d.ts +49 -0
  203. package/dist/builder/markdown.js +125 -0
  204. package/dist/builder/marks.d.ts +15 -0
  205. package/dist/builder/marks.js +18 -0
  206. package/dist/builder/merge.d.ts +223 -0
  207. package/dist/builder/merge.js +380 -0
  208. package/dist/builder/meter.d.ts +31 -0
  209. package/dist/builder/meter.js +54 -0
  210. package/dist/builder/mind.d.ts +107 -0
  211. package/dist/builder/mind.js +335 -0
  212. package/dist/builder/names.d.ts +40 -0
  213. package/dist/builder/names.js +189 -0
  214. package/dist/builder/nav.d.ts +28 -0
  215. package/dist/builder/nav.js +218 -0
  216. package/dist/builder/out.d.ts +16 -0
  217. package/dist/builder/out.js +24 -0
  218. package/dist/builder/page.d.ts +55 -0
  219. package/dist/builder/page.js +217 -0
  220. package/dist/builder/pane.d.ts +30 -0
  221. package/dist/builder/pane.js +21 -0
  222. package/dist/builder/panel.d.ts +101 -0
  223. package/dist/builder/panel.js +408 -0
  224. package/dist/builder/pdf.d.ts +139 -0
  225. package/dist/builder/pdf.js +847 -0
  226. package/dist/builder/pick.d.ts +10 -0
  227. package/dist/builder/pick.js +38 -0
  228. package/dist/builder/plain.d.ts +59 -0
  229. package/dist/builder/plain.js +209 -0
  230. package/dist/builder/plan.d.ts +63 -0
  231. package/dist/builder/plan.js +155 -0
  232. package/dist/builder/plans.d.ts +1 -0
  233. package/dist/builder/plans.js +157 -0
  234. package/dist/builder/plugin.d.ts +60 -0
  235. package/dist/builder/plugin.js +1 -0
  236. package/dist/builder/plugins/design.d.ts +8 -0
  237. package/dist/builder/plugins/design.js +71 -0
  238. package/dist/builder/plugins/index.d.ts +46 -0
  239. package/dist/builder/plugins/index.js +117 -0
  240. package/dist/builder/plugins/pdf.d.ts +18 -0
  241. package/dist/builder/plugins/pdf.js +83 -0
  242. package/dist/builder/plugins/project.d.ts +5 -0
  243. package/dist/builder/plugins/project.js +68 -0
  244. package/dist/builder/plugins/research.d.ts +24 -0
  245. package/dist/builder/plugins/research.js +147 -0
  246. package/dist/builder/plugins/sketch.d.ts +9 -0
  247. package/dist/builder/plugins/sketch.js +101 -0
  248. package/dist/builder/plugins/slides.d.ts +14 -0
  249. package/dist/builder/plugins/slides.js +55 -0
  250. package/dist/builder/plugins/template.d.ts +13 -0
  251. package/dist/builder/plugins/template.js +95 -0
  252. package/dist/builder/prefs.d.ts +29 -0
  253. package/dist/builder/prefs.js +91 -0
  254. package/dist/builder/preview-url.d.ts +47 -0
  255. package/dist/builder/preview-url.js +107 -0
  256. package/dist/builder/project.d.ts +18 -0
  257. package/dist/builder/project.js +604 -0
  258. package/dist/builder/prose.d.ts +4 -0
  259. package/dist/builder/prose.js +57 -0
  260. package/dist/builder/publish.d.ts +18 -0
  261. package/dist/builder/publish.js +141 -0
  262. package/dist/builder/question.d.ts +33 -0
  263. package/dist/builder/question.js +64 -0
  264. package/dist/builder/redesign.d.ts +32 -0
  265. package/dist/builder/redesign.js +117 -0
  266. package/dist/builder/removal.d.ts +71 -0
  267. package/dist/builder/removal.js +73 -0
  268. package/dist/builder/reply.d.ts +50 -0
  269. package/dist/builder/reply.js +196 -0
  270. package/dist/builder/roles.d.ts +10 -0
  271. package/dist/builder/roles.js +28 -0
  272. package/dist/builder/route.d.ts +85 -0
  273. package/dist/builder/route.js +126 -0
  274. package/dist/builder/run.d.ts +4 -0
  275. package/dist/builder/run.js +804 -0
  276. package/dist/builder/runmeta.d.ts +16 -0
  277. package/dist/builder/runmeta.js +69 -0
  278. package/dist/builder/say.d.ts +2 -0
  279. package/dist/builder/say.js +7 -0
  280. package/dist/builder/scheduled.d.ts +3 -0
  281. package/dist/builder/scheduled.js +328 -0
  282. package/dist/builder/section.d.ts +27 -0
  283. package/dist/builder/section.js +60 -0
  284. package/dist/builder/settings/account.d.ts +1 -0
  285. package/dist/builder/settings/account.js +111 -0
  286. package/dist/builder/settings/billing.d.ts +1 -0
  287. package/dist/builder/settings/billing.js +210 -0
  288. package/dist/builder/settings/capabilities.d.ts +1 -0
  289. package/dist/builder/settings/capabilities.js +66 -0
  290. package/dist/builder/settings/card.d.ts +31 -0
  291. package/dist/builder/settings/card.js +140 -0
  292. package/dist/builder/settings/code.d.ts +1 -0
  293. package/dist/builder/settings/code.js +70 -0
  294. package/dist/builder/settings/credits.d.ts +10 -0
  295. package/dist/builder/settings/credits.js +123 -0
  296. package/dist/builder/settings/environments.d.ts +1 -0
  297. package/dist/builder/settings/environments.js +60 -0
  298. package/dist/builder/settings/general.d.ts +1 -0
  299. package/dist/builder/settings/general.js +58 -0
  300. package/dist/builder/settings/index.d.ts +4 -0
  301. package/dist/builder/settings/index.js +25 -0
  302. package/dist/builder/settings/integrations.d.ts +8 -0
  303. package/dist/builder/settings/integrations.js +138 -0
  304. package/dist/builder/settings/keys.d.ts +1 -0
  305. package/dist/builder/settings/keys.js +114 -0
  306. package/dist/builder/settings/list.d.ts +10 -0
  307. package/dist/builder/settings/list.js +28 -0
  308. package/dist/builder/settings/machines.d.ts +4 -0
  309. package/dist/builder/settings/machines.js +243 -0
  310. package/dist/builder/settings/members.d.ts +1 -0
  311. package/dist/builder/settings/members.js +77 -0
  312. package/dist/builder/settings/memory.d.ts +1 -0
  313. package/dist/builder/settings/memory.js +62 -0
  314. package/dist/builder/settings/notifications.d.ts +1 -0
  315. package/dist/builder/settings/notifications.js +111 -0
  316. package/dist/builder/settings/plan.d.ts +17 -0
  317. package/dist/builder/settings/plan.js +131 -0
  318. package/dist/builder/settings/privacy.d.ts +1 -0
  319. package/dist/builder/settings/privacy.js +76 -0
  320. package/dist/builder/settings/sections.d.ts +16 -0
  321. package/dist/builder/settings/sections.js +34 -0
  322. package/dist/builder/settings/shared.d.ts +6 -0
  323. package/dist/builder/settings/shared.js +58 -0
  324. package/dist/builder/settings/ui.d.ts +50 -0
  325. package/dist/builder/settings/ui.js +53 -0
  326. package/dist/builder/settings/usage.d.ts +1 -0
  327. package/dist/builder/settings/usage.js +24 -0
  328. package/dist/builder/shared.d.ts +26 -0
  329. package/dist/builder/shared.js +15 -0
  330. package/dist/builder/shelf.d.ts +16 -0
  331. package/dist/builder/shelf.js +219 -0
  332. package/dist/builder/side.d.ts +40 -0
  333. package/dist/builder/side.js +208 -0
  334. package/dist/builder/site.d.ts +75 -0
  335. package/dist/builder/site.js +138 -0
  336. package/dist/builder/spend.d.ts +21 -0
  337. package/dist/builder/spend.js +80 -0
  338. package/dist/builder/standing.d.ts +36 -0
  339. package/dist/builder/standing.js +66 -0
  340. package/dist/builder/suggest.d.ts +238 -0
  341. package/dist/builder/suggest.js +463 -0
  342. package/dist/builder/suggestions.d.ts +49 -0
  343. package/dist/builder/suggestions.js +260 -0
  344. package/dist/builder/summary.d.ts +60 -0
  345. package/dist/builder/summary.js +81 -0
  346. package/dist/builder/sync.d.ts +1 -0
  347. package/dist/builder/sync.js +187 -0
  348. package/dist/builder/tabs.d.ts +85 -0
  349. package/dist/builder/tabs.js +288 -0
  350. package/dist/builder/talk.d.ts +5 -0
  351. package/dist/builder/talk.js +108 -0
  352. package/dist/builder/thread.d.ts +60 -0
  353. package/dist/builder/thread.js +302 -0
  354. package/dist/builder/tools.d.ts +22 -0
  355. package/dist/builder/tools.js +52 -0
  356. package/dist/builder/transcript.d.ts +47 -0
  357. package/dist/builder/transcript.js +108 -0
  358. package/dist/builder/voice.d.ts +8 -0
  359. package/dist/builder/voice.js +24 -0
  360. package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
  361. package/dist/core.js +1 -0
  362. package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
  363. package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
  364. package/dist/index.d.ts +2 -0
  365. package/dist/index.js +2 -1
  366. package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
  367. package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
  368. package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
  369. package/package.json +101 -11
  370. /package/{index.d.ts → dist/core.d.ts} +0 -0
  371. /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
@@ -0,0 +1,804 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * One run, live: its transcript as it streams, the controls that reach it —
4
+ * steer, pause, resume, stop — the pull request once it pushes one, and the
5
+ * follow-up that continues it once it has finished.
6
+ *
7
+ * The detail read is the record and the stream adds to it; the two overlap
8
+ * whenever a turn lands between the read and the subscribe, so turns are merged
9
+ * by sequence. A reconnect after a drop re-reads the detail — the platform drops
10
+ * a subscriber that falls behind, and frames missed then are only in the read.
11
+ *
12
+ * Steering a machine's run is a queue it drains between steps: a press is
13
+ * confirmed as RECORDED, and the status is left to the feed to correct. A
14
+ * sandbox run is steered through `POST /v1/agent/coding/{session}/steer`, which
15
+ * stops it with its work kept and opens a follow-up with the words.
16
+ *
17
+ * A sandbox run is one agent invocation that takes its task on its command line
18
+ * (apps/coding steer.go), so what continues it is a new run: a paused run is
19
+ * carried on, and a finished one followed up, by `POST /v1/agent/coding` from
20
+ * the branch its work was kept on — the platform's own continue, done here —
21
+ * with the model and effort the composer shows (mind.tsx), which Chat and New share.
22
+ *
23
+ * It reads as a chat: the person's ask opens it, each thing the agent said can
24
+ * be copied and judged (a verdict is `build.verdict` on the event bus, as a
25
+ * project's turns send it), and the title is the menu of what can be done to
26
+ * the run. Share opens its story to the public build route.
27
+ */
28
+ import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
29
+ import { phrase } from '@hanzo/i18n';
30
+ import { useI18n } from '@hanzo/i18n/react';
31
+ import { Check, ChevronDown, ChevronRight, Clock, Copy, ExternalLink, FileDiff, Folder, GitPullRequest, Globe, Layers, MessageSquare, MoreHorizontal, Pencil, Share, SlidersHorizontal, Square, SquareTerminal, } from '@hanzogui/lucide-icons-2';
32
+ import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, } from '@hanzo/ui';
33
+ import { Steer } from '@hanzo/ui/agents';
34
+ import { Composer, Failure, measure } from '@hanzo/ui/chat';
35
+ import { useLimits } from '@hanzo/ui/product/useLimits';
36
+ import { useDictation, useVoice } from '@hanzo/voice';
37
+ import { useEffect, useMemo, useState } from 'react';
38
+ import { Confirm } from './ask.js';
39
+ import { copy as toClipboard } from './clipboard.js';
40
+ import { approve, followUp, headline, retry, start, steer } from './api/coding.js';
41
+ import { limits as readLimits } from './api/models.js';
42
+ import { get, list, message, pause, publish, remove, rename, resume, stop, story, took } from './api/sessions.js';
43
+ import { answer, cards, followed, outcome, pull, settled, steps } from './api/turn.js';
44
+ import { answer as reply, say as talk, talks } from './api/talk.js';
45
+ import { verdict } from './api/verdict.js';
46
+ import { useKept, useProjects, useRead, useRun } from './data.js';
47
+ import { mark } from './runmeta.js';
48
+ import { Desk, SEED } from './desk.js';
49
+ import { useDevMode } from './dev-mode.js';
50
+ import { KeepAwake, useKeepAwake } from './awake.js';
51
+ import { useHost, useTarget } from './host.js';
52
+ import { Publish } from './publish.js';
53
+ import { path } from './route.js';
54
+ import { useSpend } from './spend.js';
55
+ import { level, pacing, useMind } from './mind.js';
56
+ import { Out } from './out.js';
57
+ import { Gutter } from './gutter.js';
58
+ import { gap, pane, RING, RING_INSET } from './pane.js';
59
+ import { useEar, useSpoken } from './voice.js';
60
+ import { speaker } from './reply.js';
61
+ import { PanelToggle } from './panel.js';
62
+ import { schedule } from './scheduled.js';
63
+ import { SideProvider, useSplit } from './side.js';
64
+ import { PAGE, useDeck, useKey, usePanel } from './tabs.js';
65
+ import { cleanErrorText, isAlreadyRunningError, isSessionActive, isSessionLive, linkThread, resolveSessionState, threadChain, useThreadLinks, } from './thread.js';
66
+ import { carrying, compose, pick, read as readFiles } from './tools.js';
67
+ import { useCarry } from './carry.js';
68
+ import { Talk } from './talk.js';
69
+ import { Transcript } from './transcript.js';
70
+ /** A session's status as the line under its title says it; one the service adds later is drawn as it comes. */
71
+ const STATUS = {
72
+ running: phrase('running'),
73
+ started: phrase('running'),
74
+ starting: phrase('starting'),
75
+ queued: phrase('queued'),
76
+ routed: phrase('running'),
77
+ resumed: phrase('running'),
78
+ paused: phrase('paused'),
79
+ done: phrase('done'),
80
+ completed: phrase('done'),
81
+ error: phrase('error'),
82
+ stopped: phrase('stopped'),
83
+ };
84
+ /** One session's page: a conversation (talk.tsx) or one unified coding session thread, as its record says. */
85
+ export function Run({ id }) {
86
+ const host = useHost();
87
+ const t = useTarget();
88
+ const links = useThreadLinks();
89
+ const chain = useMemo(() => threadChain(id, links), [id, links]);
90
+ const activeId = chain[chain.length - 1] ?? id;
91
+ // Signed out, there is nothing to read: the gateway answers a bare session with a refusal.
92
+ const state = useRun(t, host.person ? activeId : null);
93
+ return talks(state.record) ? _jsx(Talk, { id: activeId, state: state }) : _jsx(Job, { id: id, activeId: activeId, chain: chain, state: state });
94
+ }
95
+ function Job({ id, activeId, chain, state: read }) {
96
+ const { t: say } = useI18n();
97
+ const host = useHost();
98
+ const t = useTarget();
99
+ const spend = useSpend();
100
+ const signed = Boolean(host.person);
101
+ const [devMode, setDevMode] = useDevMode();
102
+ const { detail, record, events, status, refused } = read;
103
+ const [draft, setDraft] = useState('');
104
+ const [files, setFiles] = useState([]);
105
+ const [note, setNote] = useState('');
106
+ const [busy, setBusy] = useState(false);
107
+ const [notify, setNotify] = useState(null);
108
+ // The side panel: open or shut as Dev was left, its tabs as they were arranged.
109
+ const wide = useMedia().md;
110
+ const [desk, setDesk] = usePanel('dev', true, wide);
111
+ const side = useDeck('dev', SEED);
112
+ useKey(() => setDesk(!desk));
113
+ // The side panel's column: the person's width, the run hidden behind it, full screen (side.tsx).
114
+ const split = useSplit(desk && wide, 'run', () => setDesk(false));
115
+ // Stop was pressed here: the session keeps its work after it answers, and says so with its status.
116
+ const [stopping, setStopping] = useState(false);
117
+ // The working sandbox turn words were said to here: its follow-up continues in this thread once it starts.
118
+ const [steered, setSteered] = useState('');
119
+ // Earlier turns in this single-thread session, keyed by session id.
120
+ const [historyTurns, setHistoryTurns] = useState({});
121
+ // Optimistic user prompt shown while a steer/follow-up turn spins up.
122
+ const [pendingPrompt, setPendingPrompt] = useState(null);
123
+ // 1-click Publish dialog opened from Preview.
124
+ const [publishSource, setPublishSource] = useState(null);
125
+ const [publishRev, setPublishRev] = useState(0);
126
+ const [naming, setNaming] = useState(false);
127
+ const [deleting, setDeleting] = useState(false);
128
+ const [name, setName] = useState('');
129
+ const [copied, setCopied] = useState('');
130
+ const [unfolded, setUnfolded] = useState(false);
131
+ const [outputStyle, setOutputStyle] = useKept('hanzo.build.output.style', 'default');
132
+ const [transcriptView, setTranscriptView] = useKept('hanzo.build.transcript.view', 'normal');
133
+ const [envColumn, setEnvColumn] = useState(false);
134
+ const [splitPanes, setSplitPanes] = useState([]);
135
+ const [queued, setQueued] = useState([]);
136
+ const [keepAwake, setKeepAwake] = useKeepAwake();
137
+ const [nowMs, setNowMs] = useState(() => Date.now());
138
+ // The model and effort a session started here uses: the one choice Chat and New share.
139
+ const { limits } = useLimits(signed ? (signal) => readLimits(t, signal) : null, t);
140
+ const mind = useMind(t, limits?.plan, host.topUp);
141
+ const voice = useVoice({ speech: useEar(t), language: useSpoken(), ...useDictation(draft, setDraft) });
142
+ const tools = useCarry(t, activeId, (tab) => host.go(path({ kind: 'customize', tab })), {
143
+ draft,
144
+ setDraft,
145
+ attach: async (attachments) => {
146
+ const text = attachments.filter((file) => !file.type.startsWith('image/'));
147
+ const result = await readFiles(files, text, say);
148
+ setFiles(result.files);
149
+ setNote(result.note || (text.length !== attachments.length ? say('Attach text files in Dev. Images are supported in Chat.') : ''));
150
+ },
151
+ go: (href) => href.startsWith('http') ? host.open(href) : host.go(href),
152
+ });
153
+ const plugins = {
154
+ ...tools.plugins,
155
+ rows: tools.plugins.rows.filter((row) => row.id !== 'sketch'),
156
+ };
157
+ const listen = useMemo(() => speaker(t), [t]);
158
+ // Load any earlier turns in this thread chain that are not yet cached in memory.
159
+ const earlierIds = useMemo(() => chain.slice(0, -1), [chain]);
160
+ useEffect(() => {
161
+ if (!signed || earlierIds.length === 0)
162
+ return;
163
+ const missing = earlierIds.filter((eid) => !historyTurns[eid]);
164
+ if (missing.length === 0)
165
+ return;
166
+ let cancelled = false;
167
+ void Promise.all(missing.map(async (eid) => {
168
+ try {
169
+ const d = await get(t, eid, { limit: 500 });
170
+ return [eid, { events: d.recent, title: d.title, repo: d.repo, mode: d.mode }];
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ })).then((entries) => {
176
+ if (cancelled)
177
+ return;
178
+ const patch = {};
179
+ for (const entry of entries)
180
+ if (entry)
181
+ patch[entry[0]] = entry[1];
182
+ if (Object.keys(patch).length)
183
+ setHistoryTurns((prev) => ({ ...prev, ...patch }));
184
+ });
185
+ return () => {
186
+ cancelled = true;
187
+ };
188
+ }, [signed, t, earlierIds, historyTurns]);
189
+ // Clear the optimistic prompt once the new follow-up turn starts narrating its own cards.
190
+ useEffect(() => {
191
+ if (pendingPrompt && activeId !== pendingPrompt.afterId && events.length > 0) {
192
+ setPendingPrompt(null);
193
+ }
194
+ }, [pendingPrompt, activeId, events.length]);
195
+ const mode = record?.mode ?? '';
196
+ // Build unified single-thread cards chronologically across earlier turns + current active turn.
197
+ const shown = useMemo(() => {
198
+ const buildTurn = (turnId, evs, turnMode, turnTitle, turnRepo) => {
199
+ const drawn = cards(evs, turnMode, say);
200
+ const ask = headline(turnTitle, turnRepo);
201
+ const opens = drawn[0]?.kind === 'said' && drawn[0].who === 'person';
202
+ const withAsk = ask && drawn.length && !opens ? [{ kind: 'said', key: 'ask', who: 'person', text: ask }, ...drawn] : drawn;
203
+ return turnId === activeId && earlierIds.length === 0
204
+ ? withAsk
205
+ : withAsk.map((c) => ({ ...c, key: `${turnId}:${c.key}` }));
206
+ };
207
+ const merged = [];
208
+ for (const eid of earlierIds) {
209
+ const snap = historyTurns[eid];
210
+ if (!snap)
211
+ continue;
212
+ merged.push(...buildTurn(eid, snap.events, snap.mode, snap.title, snap.repo));
213
+ }
214
+ merged.push(...buildTurn(activeId, events, mode, record?.title ?? '', record?.repo ?? ''));
215
+ if (pendingPrompt && (activeId === pendingPrompt.afterId || events.length === 0)) {
216
+ const alreadyShown = merged.some((c) => c.kind === 'said' && c.who === 'person' && c.text.trim() === pendingPrompt.text.trim());
217
+ if (!alreadyShown) {
218
+ merged.push({ kind: 'said', key: `pending:${pendingPrompt.afterId}`, who: 'person', text: pendingPrompt.text });
219
+ }
220
+ }
221
+ return merged;
222
+ }, [earlierIds, historyTurns, activeId, events, mode, record, say, pendingPrompt]);
223
+ const end = outcome(events);
224
+ const plan = useMemo(() => steps(events), [events]);
225
+ const kept = useMemo(() => settled(events), [events]);
226
+ const next = useMemo(() => followed(events), [events]);
227
+ const state = resolveSessionState(status, end.status);
228
+ // Where the session's work is published: its project's own address, read again when
229
+ // the session says it went live, never an address an event names.
230
+ const built = useProjects(t, signed && Boolean(record?.project));
231
+ const rebuilt = built.reload;
232
+ useEffect(() => {
233
+ if (end.published)
234
+ rebuilt();
235
+ }, [end.published, rebuilt]);
236
+ // What a session publishes opens in the panel: the Preview, chosen and shown.
237
+ useEffect(() => {
238
+ if (!end.published)
239
+ return;
240
+ side.open({ kind: 'preview', title: say('Preview') });
241
+ setDesk(true);
242
+ // On each publish, not on each render.
243
+ // eslint-disable-next-line react-hooks/exhaustive-deps
244
+ }, [end.published]);
245
+ const proj = built.value.find((p) => p.slug === record?.project);
246
+ const site = proj?.live ?? '';
247
+ const pr = pull(record?.pr ?? '', record?.repo ?? '');
248
+ const live = isSessionLive(state);
249
+ const running = signed && live && !detail.error;
250
+ const active = running && isSessionActive(state);
251
+ const paused = running && state === 'paused';
252
+ const finished = signed && !live && !detail.error && Boolean(record);
253
+ // A sandbox session is held by the coding service, which pauses it with its work
254
+ // kept and has no resume of its own; a machine drains its commands itself.
255
+ const held = (record?.environment || 'sandbox') === 'sandbox';
256
+ // Words go to the session while it works, unless it is a paused sandbox session, which a follow-up turn carries on.
257
+ const steering = running && !(paused && held);
258
+ // A follow-up clones what the session kept, so it waits until the session has said where that is.
259
+ const waiting = (paused && held && !kept.settled) || (finished && stopping && !kept.settled);
260
+ const rootTitle = earlierIds.length ? historyTurns[earlierIds[0]]?.title : '';
261
+ const title = rootTitle || record?.title || (detail.loading ? '' : say('Untitled session'));
262
+ // A setup session explores and installs before it answers, which takes minutes.
263
+ const setup = mode === 'setup';
264
+ const [seen, setSeen] = useKept('hanzo.build.setup.seen', false);
265
+ // How long setup sessions have taken here: the ones this person can see, finished.
266
+ const past = useRead(setup && running ? () => list(t, { kind: 'coding', status: 'done', limit: 500 }) : null, [], [t, setup, running]);
267
+ const span = took(past.value, 'setup');
268
+ const earlier = record
269
+ ? {
270
+ id: activeId,
271
+ title: record.title || title,
272
+ repo: record.repo,
273
+ base: record.base,
274
+ environment: record.environment,
275
+ project: record.project,
276
+ mode,
277
+ pushed: kept.pushed,
278
+ }
279
+ : null;
280
+ const planned = mode === 'plan' && finished && (state === 'done' || state === 'completed') ? answer(events) : '';
281
+ // A failed session is tried again with the person's words as it recorded them.
282
+ const failed = finished && state === 'error';
283
+ const asked = shown.find((c) => c.kind === 'said' && c.who === 'person');
284
+ const again = asked && asked.kind === 'said' ? asked.text : '';
285
+ // What the recorded read left out once initial pagination and live replay are merged.
286
+ const hidden = Math.max(0, (detail.value?.events ?? 0) - events.length);
287
+ // Only a session still working is on a step.
288
+ const current = running ? plan.find((x) => !x.done) : undefined;
289
+ // Snapshot the active turn before appending a follow-up to the thread chain.
290
+ const snapshotCurrent = () => {
291
+ if (!activeId)
292
+ return;
293
+ setHistoryTurns((prev) => ({
294
+ ...prev,
295
+ [activeId]: {
296
+ events,
297
+ title: record?.title ?? '',
298
+ repo: record?.repo ?? '',
299
+ mode,
300
+ },
301
+ }));
302
+ };
303
+ // Complete the reminder in this view, using the device only when it permits it.
304
+ useEffect(() => {
305
+ if (!notify || running)
306
+ return;
307
+ setNotify(null);
308
+ const title = record?.title || say('Session finished');
309
+ const body = say('This session has finished.');
310
+ setNote(body);
311
+ if (notify !== 'device' || typeof Notification === 'undefined' || Notification.permission !== 'granted')
312
+ return;
313
+ void (async () => {
314
+ try {
315
+ const worker = await navigator.serviceWorker?.getRegistration();
316
+ if (worker)
317
+ await worker.showNotification(title, { body });
318
+ else
319
+ new Notification(title, { body });
320
+ }
321
+ catch {
322
+ // The result is already shown in the session.
323
+ }
324
+ })();
325
+ }, [notify, running, record?.title, say]);
326
+ const ask = async () => {
327
+ let allowed = false;
328
+ try {
329
+ if (typeof Notification !== 'undefined') {
330
+ const current = Notification.permission;
331
+ allowed = (current === 'default' ? await Notification.requestPermission() : current) === 'granted';
332
+ }
333
+ }
334
+ catch {
335
+ // Browser permission can be unavailable even when the API exists.
336
+ }
337
+ setNotify(allowed ? 'device' : 'in-app');
338
+ setNote(allowed ? '' : say('We’ll show the result here. For a device alert, allow notifications for this site in your browser or device settings.'));
339
+ };
340
+ /** Something that answers a sentence for the note, or throws the reason. One at a time. */
341
+ const act = async (work) => {
342
+ if (busy)
343
+ return;
344
+ setBusy(true);
345
+ setNote('');
346
+ try {
347
+ setNote(await work());
348
+ }
349
+ catch (e) {
350
+ setNote(cleanErrorText(e.message));
351
+ }
352
+ finally {
353
+ setBusy(false);
354
+ }
355
+ };
356
+ /**
357
+ * A new turn's ask with the model and effort the composer shows, Enso named as
358
+ * itself: a turn that names none takes the person's saved coding default
359
+ * (apps/coding start.go), which is not what the composer shows.
360
+ */
361
+ const tuned = (a) => ({ ...a, model: mind.model, effort: level(mind.effort) });
362
+ // A setup session's work IS its environment: the panel opens on it.
363
+ useEffect(() => {
364
+ if (mode === 'setup')
365
+ side.open({ kind: 'environment', title: say('Environment') });
366
+ // Once the session says what it is.
367
+ // eslint-disable-next-line react-hooks/exhaustive-deps
368
+ }, [mode]);
369
+ /** An answer's artifact, open in the panel as a page rendered from its own bytes. */
370
+ const look = (a) => {
371
+ side.open({ kind: PAGE, title: a.name, body: a.body, type: a.mime });
372
+ setDesk(true);
373
+ };
374
+ /**
375
+ * Words for the session while it works. A machine drains them between steps; a
376
+ * sandbox session stops with its work kept and continues in a follow-up turn
377
+ * inside this same thread (api/coding.ts `steer`).
378
+ */
379
+ const tell = async (words) => {
380
+ if (held) {
381
+ await steer(t, activeId, words);
382
+ setSteered(activeId);
383
+ setPendingPrompt({ text: words, afterId: activeId });
384
+ return say('Redirecting session — keeping current work and continuing here');
385
+ }
386
+ await message(t, activeId, words);
387
+ return say('Sent — recorded on this session');
388
+ };
389
+ /**
390
+ * Continue this session in the SAME thread (or branch out when `fork` is true).
391
+ * If the backend reports the active turn is still running, seamlessly steer it
392
+ * instead of failing with an "already running" error.
393
+ */
394
+ const carry = async (said, how = 'follow', fork = false) => {
395
+ if (!earlier)
396
+ throw new Error(say('This session is still being read'));
397
+ if (paused)
398
+ await stop(t, activeId, 'Continued in this session').catch(() => undefined);
399
+ // A session a conversation started is carried on by the conversation (talk.ts): the
400
+ // words go there, in its session, and so does the reader.
401
+ if (record?.parent && !fork) {
402
+ const words = how === 'approve' ? `Carry out this plan:\n\n${said.trim()}` : said.trim() || 'Continue where the session left off.';
403
+ // Approving the plan is going ahead: the conversation leaves Plan for Auto, so
404
+ // the turn it starts builds.
405
+ await talk(t, { session: record.parent, input: words, model: mind.model, effort: level(mind.effort), ...(how === 'approve' ? { mode: 'auto' } : {}) });
406
+ setDraft('');
407
+ setFiles([]);
408
+ host.go(record.parent);
409
+ return '';
410
+ }
411
+ const ask = how === 'approve' ? approve(earlier, said) : how === 'retry' ? retry(earlier, said) : followUp(earlier, said);
412
+ let run;
413
+ try {
414
+ run = await start(t, tuned(ask));
415
+ }
416
+ catch (e) {
417
+ // Race condition: backend says the turn is still running — steer smoothly in place instead of throwing.
418
+ if (!fork && isAlreadyRunningError(e) && said.trim()) {
419
+ const msg = await tell(said.trim());
420
+ setDraft('');
421
+ setFiles([]);
422
+ return msg;
423
+ }
424
+ throw e;
425
+ }
426
+ setDraft('');
427
+ setFiles([]);
428
+ setStopping(false);
429
+ if (fork) {
430
+ host.go(run.session);
431
+ return '';
432
+ }
433
+ snapshotCurrent();
434
+ if (said.trim())
435
+ setPendingPrompt({ text: said.trim(), afterId: activeId });
436
+ linkThread(activeId, run.session);
437
+ return '';
438
+ };
439
+ /**
440
+ * A press that starts a turn with no words typed (Try again, Approve and build, Resume on a sandbox session, Fork) asks
441
+ * first, before anything says it is starting; words the person typed and sent are their own ask. A no starts
442
+ * nothing and says nothing.
443
+ */
444
+ const ahead = async (said, how) => {
445
+ if (busy)
446
+ return;
447
+ const asked = {
448
+ retry: { title: say('Try this session again?'), what: say('This starts a new turn with the same ask.'), yes: say('Try again') },
449
+ approve: { title: say('Build this plan?'), what: say('This starts a build turn that carries out the plan.'), yes: say('Approve and build') },
450
+ resume: { title: say('Resume this session?'), what: say('This continues the session from its branch.'), yes: say('Resume') },
451
+ fork: { title: say('Fork this session?'), what: say('This starts a separate session from this one’s work, with the same ask.'), yes: say('Fork') },
452
+ };
453
+ if (!(await spend.ask({ kind: 'run', uses: held ? 'computer' : 'credits', ...asked[how] })))
454
+ return;
455
+ await act(() => carry(said, how === 'resume' || how === 'fork' ? 'follow' : how, how === 'fork'));
456
+ };
457
+ // When a steered turn hands off (`followed` status event with `next`), continue inside the same thread.
458
+ useEffect(() => {
459
+ if (!next || next === activeId)
460
+ return;
461
+ if (steered === activeId || !chain.includes(next)) {
462
+ snapshotCurrent();
463
+ linkThread(activeId, next);
464
+ if (steered === activeId)
465
+ setSteered('');
466
+ }
467
+ // On the follow-up's arrival.
468
+ // eslint-disable-next-line react-hooks/exhaustive-deps
469
+ }, [steered, activeId, next]);
470
+ // The composer sends words, with any files fenced after them, and only while it is enabled.
471
+ const send = () => {
472
+ const words = compose([tools.text, draft.trim()].filter(Boolean).join('\n\n'), files);
473
+ if (!words)
474
+ return;
475
+ if (steering) {
476
+ void act(async () => {
477
+ const said = await tell(words);
478
+ setDraft('');
479
+ setFiles([]);
480
+ return said;
481
+ });
482
+ return;
483
+ }
484
+ void act(() => carry(words));
485
+ };
486
+ const command = (c) => {
487
+ switch (c) {
488
+ case 'stop':
489
+ void act(async () => {
490
+ await stop(t, activeId);
491
+ setStopping(true);
492
+ return say('Stop requested — the session keeps its work on its branch');
493
+ });
494
+ return;
495
+ case 'pause':
496
+ void act(async () => {
497
+ await pause(t, activeId);
498
+ return held ? say('Pause requested — the session keeps its work on its branch and waits') : say('Pause asked — the machine pauses when it reads it');
499
+ });
500
+ return;
501
+ case 'resume':
502
+ if (held)
503
+ void ahead('', 'resume');
504
+ else
505
+ void act(async () => {
506
+ await resume(t, activeId);
507
+ return say('Resume asked — the machine goes on when it reads it');
508
+ });
509
+ return;
510
+ }
511
+ };
512
+ const copy = async (what, value) => {
513
+ if (await toClipboard(value))
514
+ setCopied(what);
515
+ else
516
+ setNote(say('This browser would not copy.'));
517
+ };
518
+ const share = (on) => act(async () => {
519
+ await publish(t, activeId, on);
520
+ detail.reload();
521
+ return on ? say('Shared — anyone with the link can read this session’s story') : say('No longer shared');
522
+ });
523
+ // What the title's menu does to the session.
524
+ const manage = [
525
+ ...(signed && record
526
+ ? [
527
+ {
528
+ key: 'rename',
529
+ label: say('Rename'),
530
+ icon: _jsx(Pencil, { size: 16 }),
531
+ onSelect: () => {
532
+ setName(title);
533
+ setNaming(true);
534
+ },
535
+ },
536
+ ]
537
+ : []),
538
+ { key: 'copy', label: copied === 'id' ? say('Copied') : say('Copy session id'), icon: _jsx(Copy, { size: 16 }), description: activeId, onSelect: () => void copy('id', activeId) },
539
+ // What this run was asked, as a task that runs again on a schedule: the ask it opened with.
540
+ ...(signed && record
541
+ ? [
542
+ {
543
+ key: 'schedule',
544
+ label: say('Schedule this'),
545
+ icon: _jsx(Clock, { size: 16 }),
546
+ description: say('Run it again on a schedule'),
547
+ onSelect: () => {
548
+ const first = shown.find((c) => c.kind === 'said' && c.who === 'person');
549
+ schedule(first && 'text' in first ? first.text : headline(record.title, record.repo), host.go);
550
+ },
551
+ },
552
+ ]
553
+ : []),
554
+ ];
555
+ // Sharing opens the public build route, which is addressed by the org and the project a run built.
556
+ const link = record?.published ? story(t, record.org || host.org, record.project) : '';
557
+ const sharing = signed && record?.project
558
+ ? [
559
+ record.published
560
+ ? { key: 'unshare', label: say('Stop sharing'), icon: _jsx(Globe, { size: 16 }), onSelect: () => void share(false) }
561
+ : { key: 'share', label: say('Share publicly'), icon: _jsx(Globe, { size: 16 }), description: say('Anyone with the link can read it'), onSelect: () => void share(true) },
562
+ ...(link ? [{ key: 'link', label: copied === 'link' ? say('Copied') : say('Copy public link'), icon: _jsx(Copy, { size: 16 }), description: link, onSelect: () => void copy('link', link) }] : []),
563
+ ]
564
+ : [];
565
+ const sendQueued = (qid) => {
566
+ const item = queued.find((q) => q.id === qid);
567
+ if (!item)
568
+ return;
569
+ setQueued((prev) => prev.filter((q) => q.id !== qid));
570
+ if (steering) {
571
+ void act(() => tell(item.text));
572
+ return;
573
+ }
574
+ void act(() => carry(item.text));
575
+ };
576
+ const enqueue = () => {
577
+ const words = compose([tools.text, draft.trim()].filter(Boolean).join('\n\n'), files);
578
+ if (!words)
579
+ return;
580
+ setQueued((prev) => [...prev, { id: `q-${Date.now()}-${prev.length}`, text: words }]);
581
+ setDraft('');
582
+ setFiles([]);
583
+ };
584
+ useEffect(() => {
585
+ if (!running || paused)
586
+ return;
587
+ const timer = setInterval(() => setNowMs(Date.now()), 1000);
588
+ return () => clearInterval(timer);
589
+ }, [running, paused]);
590
+ const toggleDockPane = (kind, label) => {
591
+ if (!desk)
592
+ setDesk(true);
593
+ setSplitPanes((prev) => {
594
+ if (prev.includes(kind)) {
595
+ const next = prev.filter((k) => k !== kind);
596
+ if (next.length === 1) {
597
+ const single = next[0];
598
+ side.open({ kind: single, title: say(single.charAt(0).toUpperCase() + single.slice(1)) });
599
+ }
600
+ return next;
601
+ }
602
+ const activeKind = side.tabs.find((x) => x.id === side.at)?.kind ?? '';
603
+ const base = prev.length === 0 && activeKind && ['terminal', 'preview', 'diff', 'files'].includes(activeKind) && activeKind !== kind ? [activeKind] : prev;
604
+ const next = [...base, kind];
605
+ if (next.length === 1)
606
+ side.open({ kind, title: label });
607
+ return next;
608
+ });
609
+ };
610
+ const elapsedSec = useMemo(() => {
611
+ const startMs = record?.createdAt ? Date.parse(record.createdAt) : NaN;
612
+ if (!Number.isFinite(startMs))
613
+ return 0;
614
+ return Math.max(1, Math.floor((nowMs - startMs) / 1000));
615
+ }, [record?.createdAt, nowMs]);
616
+ const elapsedLabel = useMemo(() => {
617
+ const mins = Math.floor(elapsedSec / 60);
618
+ const secs = elapsedSec % 60;
619
+ return mins > 0 ? `${mins}m ${secs}s` : `${secs}s`;
620
+ }, [elapsedSec]);
621
+ const tokenLabel = useMemo(() => {
622
+ const chars = events.reduce((sum, e) => sum + JSON.stringify(e.payload ?? '').length, 0);
623
+ const tok = Math.max(100, Math.round(chars / 4));
624
+ return tok >= 1000 ? `${(tok / 1000).toFixed(1)}k tokens` : `${tok} tokens`;
625
+ }, [events]);
626
+ const bgTaskCount = useMemo(() => shown.filter((c) => (c.kind === 'shell' || c.kind === 'step') && c.ran === 'running' && running).length, [shown, running]);
627
+ const save = () => void act(async () => {
628
+ await rename(t, activeId, name);
629
+ setNaming(false);
630
+ detail.reload();
631
+ return say('Renamed');
632
+ });
633
+ const placeholder = !signed
634
+ ? say('Sign in to follow up')
635
+ : waiting
636
+ ? paused
637
+ ? say('Pausing — the session is keeping its work…')
638
+ : say('Stopping — the session is keeping its work…')
639
+ : paused && held
640
+ ? say('Continue this session with a follow up')
641
+ : running
642
+ ? setup
643
+ ? say('Add a follow up for the setup agent')
644
+ : say('Steer or redirect this session…')
645
+ : finished
646
+ ? record?.parent
647
+ ? say('Follow up — continues the conversation')
648
+ : say('Follow up — continues in this session')
649
+ : say('Reading this session…');
650
+ const openPublish = proj?.repo || record?.repo
651
+ ? () => {
652
+ const clone = proj?.repo || (record?.repo ? `https://github.com/${record.repo}.git` : '');
653
+ if (!clone)
654
+ return;
655
+ const slug = proj?.slug || record?.project || record?.repo.split('/').pop() || 'app';
656
+ setPublishSource({
657
+ repo: clone,
658
+ title: proj?.name || record?.repo || title,
659
+ ref: record?.branch || proj?.branch || record?.base || 'main',
660
+ name: slug,
661
+ project: slug,
662
+ preview: site || undefined,
663
+ });
664
+ }
665
+ : undefined;
666
+ const desk_ = (sheet, inset = !sheet) => (_jsx(Desk, { id: activeId, repo: record?.repo ?? '', branch: record?.branch ?? '', base: record?.base ?? '', environment: record?.environment ?? '', mode: mode, pr: pr, title: title, project: record?.project ?? '', sandbox: record?.sandbox ?? '', site: site, published: end.published + publishRev, sessionStatus: state, events: events, live: running, menu: [...manage, ...sharing], refused: signed ? refused || (detail.error ? say(detail.error.message) : '') : say('Sign in to follow this session.'), retry: signed ? say('Retry') : say('Sign in'), onRetry: signed ? detail.reload : () => host.signIn?.(), side: side, sheet: sheet, topRightInset: inset, onPublish: openPublish, onHide: () => setDesk(false), envColumn: envColumn, splitPanes: splitPanes, onCloseSplitPane: (pid) => setSplitPanes((prev) => prev.filter((k) => k !== pid)), onExpandSplitPane: (pid) => {
667
+ setSplitPanes([]);
668
+ side.open({ kind: pid, title: say(pid.charAt(0).toUpperCase() + pid.slice(1)) });
669
+ } }));
670
+ const triggerButton = (_jsxs(XStack, { render: "button", "aria-label": say('Manage this session'), items: "center", gap: "$1.5", maxW: "100%", minW: 0, px: "$1.5", mx: "$-1.5", py: "$0.5", minH: 32, "$max-md": { minH: 40 }, rounded: "$2", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { render: "h1", size: "$5", color: "$ink", numberOfLines: 1, minW: 0, children: title }), _jsx(ChevronDown, { size: 14, opacity: 0.7 })] }));
671
+ const mobileWorkspaceOpen = !wide && desk;
672
+ return (_jsxs(XStack, { "data-slot": "run-split", display: "grid", gridTemplateColumns: wide && desk ? 'minmax(0, 1fr) auto' : 'minmax(0, 1fr)', width: "100%", height: "100%", minH: 0, minW: 0, overflow: "hidden", children: [_jsxs(YStack, { "data-slot": "run", ref: split.main, ...pane, display: "grid", gridTemplateRows: !wide ? (mobileWorkspaceOpen ? 'auto auto minmax(0, 1fr)' : 'auto auto minmax(0, 1fr) auto') : 'auto minmax(0, 1fr) auto', width: "100%", height: "100%", minH: 0, minW: 0, overflow: "hidden", children: [_jsxs(XStack, { "data-slot": "run-header", px: "$4", "$max-md": { px: '$3' }, pt: "$3", pb: "$2", gap: "$1.5", items: "center", minH: 44, minW: 0, style: !desk || !wide ? { paddingInlineEnd: 'calc(16px + var(--hanzo-shell-top-right-inset, 0px))' } : undefined, children: [spend.dialog, _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(XStack, { items: "center", gap: "$1", maxW: "100%", minW: 0, children: signed && record ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: triggerButton }), _jsxs(DropdownMenuContent, { align: "start", minW: 210, children: [_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Open in') }) }), _jsxs(DropdownMenuSubContent, { minW: 170, children: [_jsx(DropdownMenuItem, { onSelect: () => {
673
+ window.open(`vscode://file/home/z/work/${record.repo.split('/').pop() || ''}`, '_blank');
674
+ }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: "VS Code" }) }), _jsx(DropdownMenuItem, { onSelect: () => {
675
+ window.open(`cursor://file/home/z/work/${record.repo.split('/').pop() || ''}`, '_blank');
676
+ }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: "Cursor" }) }), _jsx(DropdownMenuItem, { onSelect: () => {
677
+ side.open({ kind: 'terminal', title: say(devMode ? 'Terminal' : 'Activity') });
678
+ setDesk(true);
679
+ }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: say(devMode ? 'Terminal' : 'Activity') }) }), record.repo ? (_jsx(DropdownMenuItem, { onSelect: () => {
680
+ window.open(pr.href || `https://github.com/${record.repo}`, '_blank', 'noopener,noreferrer');
681
+ }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: "GitHub" }) })) : null, _jsx(DropdownMenuItem, { onSelect: () => void copy('path', record.repo || id), children: _jsx(SizableText, { size: "$2", color: "$ink", children: say('Copy path') }) })] })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { "aria-label": say('Rename'), onSelect: () => {
682
+ setName(title);
683
+ setNaming(true);
684
+ }, children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Rename') }), _jsx(DropdownMenuShortcut, { children: "R" })] }), _jsxs(DropdownMenuItem, { "aria-label": say('Fork'), onSelect: () => {
685
+ void ahead(again || headline(record.title, record.repo), 'fork');
686
+ }, children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Fork') }), _jsx(DropdownMenuShortcut, { children: "F" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Transcript view') }) }), _jsx(DropdownMenuSubContent, { minW: 160, children: [
687
+ ['normal', say('Normal')],
688
+ ['thinking', say('Thinking')],
689
+ ['verbose', say('Verbose')],
690
+ ].map(([val, label]) => (_jsxs(DropdownMenuItem, { onSelect: () => setTranscriptView(val), children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: label }), transcriptView === val ? _jsx(Check, { size: 14, color: "$blue10" }) : null] }, val))) })] }), _jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Output style') }) }), _jsxs(DropdownMenuSubContent, { minW: 170, children: [[
691
+ ['default', say('Default')],
692
+ ['proactive', say('Proactive')],
693
+ ['concise', say('Concise')],
694
+ ['explanatory', say('Explanatory')],
695
+ ['learning', say('Learning')],
696
+ ].map(([val, label]) => (_jsxs(DropdownMenuItem, { onSelect: () => setOutputStyle(val), children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: label }), outputStyle === val ? _jsx(Check, { size: 14, color: "$blue10" }) : null] }, val))), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => setOutputStyle('custom'), children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('New style...') }) })] })] }), _jsxs(DropdownMenuItem, { "aria-label": say('Developer mode'), "aria-checked": devMode, onSelect: () => setDevMode(!devMode), children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: say('Developer mode') }), _jsx(SizableText, { size: "$1", color: "$soft", children: say('Show the terminal, commands and each step') })] }), devMode ? _jsx(Check, { size: 14, color: "$blue10" }) : null] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => void copy('id', activeId), children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: copied === 'id' ? say('Copied') : say('Copy session id') }) }), _jsx(DropdownMenuItem, { onSelect: () => {
697
+ const first = shown.find((c) => c.kind === 'said' && c.who === 'person');
698
+ schedule(first && 'text' in first ? first.text : headline(record.title, record.repo), host.go);
699
+ }, children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Schedule this') }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { "aria-label": say('Archive'), onSelect: () => {
700
+ // Kept out of every list of sessions (the sidebar's too, `runmeta.ts`) and still readable under Archived.
701
+ for (const sid of chain)
702
+ mark(sid, { archived: true });
703
+ if (running)
704
+ void stop(t, activeId, 'Archived').catch(() => undefined);
705
+ host.go('');
706
+ }, children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Archive') }), _jsx(DropdownMenuShortcut, { children: "A" })] }), _jsxs(DropdownMenuItem, { "aria-label": say('Delete'), variant: "destructive", onSelect: () => setDeleting(true), children: [_jsx(SizableText, { size: "$2", color: "$red10", flex: 1, children: say('Delete') }), _jsx(DropdownMenuShortcut, { children: "D" })] })] })] })) : (_jsx(DropdownMenu, { trigger: triggerButton, items: manage })) }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, maxW: "100%", children: [state ? say(STATUS[state] ?? state) : detail.loading ? say('reading') : '', record?.repo, devMode ? record?.branch : '', record?.published ? say('shared') : ''].filter(Boolean).join(' · ') })] }), pr.href ? (_jsx(Out, { href: pr.href, label: say('Open pull request {pr}', { pr: pr.label }), children: _jsxs(XStack, { items: "center", gap: "$1.5", px: "$2.5", py: "$1.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsx(GitPullRequest, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: pr.label }), _jsx(ExternalLink, { size: 12, opacity: 0.6 })] }) })) : null, sharing.length ? (_jsx(DropdownMenu, { trigger: _jsxs(XStack, { render: "button", "aria-label": say('Share'), items: "center", gap: "$1.5", px: "$2.5", py: "$1.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsx(Share, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Share') })] }), items: sharing })) : null, wide ? (_jsxs(XStack, { items: "center", gap: "$0.5", children: [_jsx(XStack, { render: "button", "aria-label": say('Toggle environment column'), ...{ title: say('Toggle environment column') }, "aria-pressed": envColumn, onPress: () => {
707
+ if (!desk)
708
+ setDesk(true);
709
+ setEnvColumn((v) => !v);
710
+ }, minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: envColumn ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SlidersHorizontal, { size: 15, opacity: envColumn ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say(devMode ? 'Toggle terminal pane' : 'Toggle activity pane'), ...{ title: say(devMode ? 'Toggle terminal pane' : 'Toggle activity pane') }, "aria-pressed": splitPanes.includes('terminal'), onPress: () => toggleDockPane('terminal', say(devMode ? 'Terminal' : 'Activity')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('terminal') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SquareTerminal, { size: 15, opacity: splitPanes.includes('terminal') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle diff pane'), ...{ title: say('Toggle diff pane') }, "aria-pressed": splitPanes.includes('diff'), onClick: () => toggleDockPane('diff', say('Diff')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('diff') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(FileDiff, { size: 15, opacity: splitPanes.includes('diff') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle browser pane'), ...{ title: say('Toggle browser pane') }, "aria-pressed": splitPanes.includes('preview'), onClick: () => toggleDockPane('preview', say('Preview')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('preview') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(Globe, { size: 15, opacity: splitPanes.includes('preview') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle files pane'), ...{ title: say('Toggle files pane') }, "aria-pressed": splitPanes.includes('files'), onClick: () => toggleDockPane('files', say('Files')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('files') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(Folder, { size: 15, opacity: splitPanes.includes('files') ? 1 : 0.7 }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": say('More workspace options'), ...{ title: say('More workspace options') }, p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 15, opacity: 0.7 }) }) }), _jsxs(DropdownMenuContent, { align: "end", minW: 220, children: [_jsxs(DropdownMenuItem, { onSelect: () => {
711
+ if (!desk)
712
+ setDesk(true);
713
+ setEnvColumn((v) => !v);
714
+ }, children: [_jsx(MessageSquare, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Side chat') }), _jsx(DropdownMenuShortcut, { children: "Ctrl+;" })] }), _jsxs(DropdownMenuItem, { onSelect: () => {
715
+ if (!desk)
716
+ setDesk(true);
717
+ setEnvColumn(true);
718
+ }, children: [_jsx(Layers, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Background tasks') }), _jsx(XStack, { px: "$1.5", py: "$0.5", rounded: 99, bg: "$hover", children: _jsx(SizableText, { size: "$1", color: "$soft", children: String(bgTaskCount) }) })] }), _jsx(DropdownMenuSeparator, {}), _jsx(KeepAwake, { on: keepAwake, onToggle: (on) => void setKeepAwake(on) })] })] })] })) : null, wide ? _jsx(PanelToggle, { open: desk, onToggle: () => setDesk(!desk) }) : null] }), !wide ? (_jsx(XStack, { "data-slot": "mobile-pane-switcher", role: "tablist", "aria-label": say('View'), px: "$3", pb: "$2", gap: "$1.5", items: "center", shrink: 0, minW: 0, children: _jsxs(XStack, { flex: 1, minW: 0, p: 3, gap: 3, rounded: "$3", bg: "$hover", children: [_jsx(XStack, { render: "button", role: "tab", "aria-selected": !desk, onPress: () => setDesk(false), flex: 1, minH: 40, items: "center", justify: "center", rounded: "$2", bg: !desk ? '$raised' : 'transparent', focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$2", fontWeight: !desk ? '600' : '400', color: !desk ? '$ink' : '$soft', children: say('Session') }) }), _jsx(XStack, { render: "button", role: "tab", "aria-selected": desk, onPress: () => setDesk(true), flex: 1, minH: 40, items: "center", justify: "center", rounded: "$2", bg: desk ? '$raised' : 'transparent', focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$2", fontWeight: desk ? '600' : '400', color: desk ? '$ink' : '$soft', children: say('Workspace') }) })] }) })) : null, mobileWorkspaceOpen ? (_jsx(YStack, { "data-slot": "mobile-workspace", flex: 1, minH: 0, minW: 0, overflow: "hidden", borderTopWidth: 1, borderColor: "$borderColor", children: desk_(false, false) })) : (_jsxs(_Fragment, { children: [_jsx(Transcript, { cards: shown, devMode: devMode, view: transcriptView, queued: queued, onSendQueued: sendQueued, onOpen: look, onDiff: () => {
719
+ side.open({ kind: 'diff', title: say('Diff') });
720
+ setDesk(true);
721
+ }, listen: signed ? listen : undefined, end: failed ? (_jsx(Failure, { onRetry: busy ? undefined : () => void ahead(again, 'retry'), children: end.problem
722
+ ? say('This session stopped before it finished.')
723
+ : // Only a session that pushed has work on its branch (turn.ts settled): one that failed before it
724
+ // changed anything left no branch, and Try again starts over from where it began.
725
+ kept.pushed
726
+ ? `${say('This session stopped with an error.')} ${say('Its work so far is on its branch.')}`
727
+ : `${say('This session stopped with an error.')} ${say('It saved nothing to its branch, so Try again starts over.')}` })) : null,
728
+ // A paused session's agent was stopped where it stood; what it was running is cut off.
729
+ live: running && !paused, header: hidden ? (_jsx(SizableText, { size: "$1", color: "$soft", children: `${hidden === 1 ? say('{n} earlier turn is not shown.', { n: hidden }) : say('{n} earlier turns are not shown.', { n: hidden })} ${say('The session’s Git tab has everything it pushed.')}` })) : null, onApprove: planned && earlier ? (p) => void ahead(p, 'approve') : undefined,
730
+ // What dev asks its person while it works (its ask tool), answered here.
731
+ onAnswer: signed ? (q, label) => void act(async () => (await reply(t, activeId, q, label, true), '')) : undefined, approving: busy, onVerdict: (v) => verdict(t, activeId, record?.project ?? '', v), onAddFunds: () => (host.topUp ? host.topUp() : host.go(path({ kind: 'settings', section: 'billing' }))), empty: signed ? (_jsx(SizableText, { size: "$2", color: "$soft", children: detail.error
732
+ ? say(detail.error.message)
733
+ : detail.loading
734
+ ? say('Reading this session…')
735
+ : running
736
+ ? setup
737
+ ? say('Setting up environment')
738
+ : say('Starting…')
739
+ : say('Waiting for the session’s first step…') })) : (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: say('Sign in to follow this session.') }), _jsx(Button, { size: "sm", onPress: () => host.signIn?.(), children: say('Sign in') })] })) }), _jsxs(YStack, { pb: "$3", pt: "$2", gap: "$2", children: [_jsxs(YStack, { ...measure, gap: "$2", children: [end.problem ? (_jsx(SizableText, { size: "$1", color: "$soft", children: say('The branch is pushed, and the pull request could not be opened.') })) : null, note || (signed && refused) ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: cleanErrorText(note || refused) })) : null, plan.length && devMode ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: [_jsxs(XStack, { render: "button", "aria-label": say('Steps · {n}', { n: plan.length }), "aria-expanded": unfolded, onClick: () => setUnfolded(!unfolded), width: "100%", px: "$3", py: "$1.5", minH: 36, gap: "$2", items: "center", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING_INSET, children: [unfolded ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Steps · {n}', { n: plan.length }) }), current && !unfolded ? (_jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, text: "end", children: current.name })) : null] }), unfolded
740
+ ? plan.map((s) => {
741
+ const on = s === current;
742
+ return (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$1.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$2", color: s.done || on ? '$ink' : '$soft', children: s.done ? '✓' : on ? '●' : '○' }), _jsx(SizableText, { size: "$2", color: s.done ? '$soft' : '$ink', numberOfLines: 1, children: s.name })] }, s.name));
743
+ })
744
+ : null] })) : null, setup && running && !seen ? _jsx(Onboarding, { onDone: () => setSeen(true) }) : null, running && !paused ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$1", children: [_jsx(YStack, { width: 6, height: 6, rounded: 99, bg: "var(--state-online)", shrink: 0 }), _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: devMode ? `${elapsedLabel} · ${tokenLabel} · ${say('Thinking')}` : `${elapsedLabel} · ${say('Working…')}` })] })) : null, running ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$2", rounded: "$10", borderWidth: 1, borderColor: "$borderColor", flexWrap: "wrap", rowGap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 160, children: paused
745
+ ? kept.pushed
746
+ ? say('Paused — its work so far is on its branch.')
747
+ : say('Paused.')
748
+ : setup
749
+ ? span
750
+ ? say('Environment setup takes ~{minutes} minutes.', { minutes: span[0] === span[1] ? span[0] : `${span[0]}–${span[1]}` })
751
+ : say('Environment setup takes several minutes.')
752
+ : say('This session is still working.') }), _jsx(Steer, { onCommand: command, withhold: [
753
+ ...(paused ? ['pause'] : ['resume']),
754
+ ...(busy || waiting ? ['pause', 'resume', 'stop'] : []),
755
+ ] }), _jsx(Button, { size: "sm", disabled: Boolean(notify), onPress: () => void ask(), children: notify === 'device' ? say('You will be notified') : notify === 'in-app' ? say('Watching here') : say('Notify me') })] })) : null] }), _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: send, onStop: active && !waiting ? () => command('stop') : undefined, busy: active && !waiting && !draft.trim(), ready: Boolean(draft.trim()), disabled: !signed || busy || waiting || !(running || finished), placeholder: placeholder, label: steering ? say('Steer this session') : say('Follow up on this session'), field: {
756
+ onKeyDown: (e) => {
757
+ if ((e.ctrlKey || e.metaKey) && e.key === 'Enter' && steering && draft.trim()) {
758
+ e.preventDefault?.();
759
+ enqueue();
760
+ }
761
+ },
762
+ }, plus: {
763
+ upload: () => pick(files, setFiles, setNote, say),
764
+ research: { on: tools.gear.gear.research, set: (on) => tools.gear.set({ research: on }) },
765
+ skills: tools.skills,
766
+ design: tools.design,
767
+ plugins,
768
+ memory: { on: tools.gear.gear.memory, set: (on) => tools.gear.set({ memory: on }) },
769
+ }, slash: tools.skills, at: plugins, carried: [...tools.on, ...carrying(files, setFiles)],
770
+ // What a new turn from here is made with; words that steer this session use neither.
771
+ mind: signed && !steering ? mind : null, effort: signed && !steering ? pacing(mind) : null, limits: limits, voice: voice, children: active && !waiting && draft.trim() ? (_jsxs(XStack, { render: "button", "data-slot": "composer-stop", "aria-label": say('Stop session'), ...{ title: say('Stop session') }, onPress: () => command('stop'), items: "center", gap: "$1.5", px: "$2.5", height: 30, "$max-md": { minH: 40 }, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(Square, { size: 10, fill: "currentColor" }), _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: say('Stop') })] })) : null })] })] }))] }), desk && wide ? (_jsxs(YStack, { "data-slot": "desk", ref: split.aside, ...pane,
772
+ // A pane of its own beside the session's, the gutter between them (useSplit reads it as the inline-start margin).
773
+ marginInlineStart: gap, position: "relative", shrink: 0, minH: 0, children: [split.grip ? (_jsx(Gutter, { ...split.grip, label: say('Resize the side panel'), inset: pane.borderWidth })) : null, _jsx(SideProvider, { value: split.side, children: desk_(false, true) })] })) : null, tools.dialog, _jsx(Publish, { source: publishSource, onClose: () => setPublishSource(null), onLive: () => {
774
+ rebuilt();
775
+ setPublishRev((n) => n + 1);
776
+ } }), _jsx(Confirm, { open: deleting, onOpenChange: setDeleting, title: say('Delete this session?'), says: say('“{title}” is deleted for good, with every link it was shared by. To keep it out of the list instead, archive it.', {
777
+ title: headline(record?.title ?? '', record?.repo ?? '') || say('this session'),
778
+ }), act: say('Delete'), run: async () => {
779
+ if (running)
780
+ await stop(t, activeId, 'Deleted').catch(() => undefined);
781
+ for (const sid of chain) {
782
+ await remove(t, sid).catch(() => undefined);
783
+ mark(sid, { deleted: true });
784
+ }
785
+ host.go('');
786
+ } }), _jsx(Dialog, { open: naming, onOpenChange: setNaming, children: _jsxs(DialogContent, { maxW: 480, children: [_jsx(DialogTitle, { children: say('Rename this session') }), _jsx(Input, { autoFocus: true, value: name, onChangeText: setName, "aria-label": say('The session’s name'), maxLength: 512, onKeyDown: (e) => {
787
+ if (e.key === 'Enter')
788
+ save();
789
+ } }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => setNaming(false), children: say('Cancel') }), _jsx(Button, { size: "sm", disabled: busy || !name.trim(), onPress: save, children: say('Save') })] })] }) })] }));
790
+ }
791
+ /** What a setup run does, said once per browser the first time one is watched. */
792
+ function Onboarding({ onDone }) {
793
+ const { t } = useI18n();
794
+ const steps = [
795
+ t('Explore, install and check the codebase'),
796
+ t('Name the secrets it needs — you set their values'),
797
+ t('Propose the environment for you to review and save'),
798
+ ];
799
+ return (_jsxs(YStack, { gap: "$3", p: "$5", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$4", fontWeight: "600", color: "$ink", children: t('Set up a cloud environment') }), _jsx(SizableText, { size: "$2", color: "$soft", children: [
800
+ t('An environment lets every later run install, start, test and check its changes the way an engineer does.'),
801
+ t('Setup is agent-led and takes several minutes.'),
802
+ t('The agent will:'),
803
+ ].join(' ') })] }), _jsx(YStack, { gap: "$1.5", children: steps.map((s, i) => (_jsxs(XStack, { gap: "$2.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", width: 16, fontVariant: ['tabular-nums'], children: String(i + 1) }), _jsx(SizableText, { size: "$2", color: "$ink", children: s })] }, s))) }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Interrupt anytime to steer the agent or ask it questions.') }), _jsx(Button, { size: "sm", onPress: onDone, children: t('Got it') })] }));
804
+ }