@hanzo/dev 4.0.1 → 4.1.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 (369) 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 +31 -0
  61. package/dist/builder/api/git.js +47 -0
  62. package/dist/builder/api/github.d.ts +176 -0
  63. package/dist/builder/api/github.js +271 -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 +570 -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/gutter.d.ts +17 -0
  185. package/dist/builder/gutter.js +25 -0
  186. package/dist/builder/handoff.d.ts +8 -0
  187. package/dist/builder/handoff.js +22 -0
  188. package/dist/builder/host.d.ts +189 -0
  189. package/dist/builder/host.js +46 -0
  190. package/dist/builder/index.d.ts +108 -0
  191. package/dist/builder/index.js +99 -0
  192. package/dist/builder/landing.d.ts +34 -0
  193. package/dist/builder/landing.js +725 -0
  194. package/dist/builder/library.d.ts +21 -0
  195. package/dist/builder/library.js +526 -0
  196. package/dist/builder/local.d.ts +80 -0
  197. package/dist/builder/local.js +124 -0
  198. package/dist/builder/make.d.ts +10 -0
  199. package/dist/builder/make.js +120 -0
  200. package/dist/builder/markdown.d.ts +49 -0
  201. package/dist/builder/markdown.js +125 -0
  202. package/dist/builder/marks.d.ts +15 -0
  203. package/dist/builder/marks.js +18 -0
  204. package/dist/builder/merge.d.ts +223 -0
  205. package/dist/builder/merge.js +380 -0
  206. package/dist/builder/meter.d.ts +31 -0
  207. package/dist/builder/meter.js +54 -0
  208. package/dist/builder/mind.d.ts +107 -0
  209. package/dist/builder/mind.js +335 -0
  210. package/dist/builder/names.d.ts +40 -0
  211. package/dist/builder/names.js +189 -0
  212. package/dist/builder/nav.d.ts +28 -0
  213. package/dist/builder/nav.js +218 -0
  214. package/dist/builder/out.d.ts +16 -0
  215. package/dist/builder/out.js +24 -0
  216. package/dist/builder/page.d.ts +55 -0
  217. package/dist/builder/page.js +217 -0
  218. package/dist/builder/pane.d.ts +30 -0
  219. package/dist/builder/pane.js +21 -0
  220. package/dist/builder/panel.d.ts +101 -0
  221. package/dist/builder/panel.js +408 -0
  222. package/dist/builder/pdf.d.ts +139 -0
  223. package/dist/builder/pdf.js +847 -0
  224. package/dist/builder/pick.d.ts +10 -0
  225. package/dist/builder/pick.js +38 -0
  226. package/dist/builder/plain.d.ts +59 -0
  227. package/dist/builder/plain.js +209 -0
  228. package/dist/builder/plan.d.ts +63 -0
  229. package/dist/builder/plan.js +155 -0
  230. package/dist/builder/plans.d.ts +1 -0
  231. package/dist/builder/plans.js +157 -0
  232. package/dist/builder/plugin.d.ts +60 -0
  233. package/dist/builder/plugin.js +1 -0
  234. package/dist/builder/plugins/design.d.ts +8 -0
  235. package/dist/builder/plugins/design.js +71 -0
  236. package/dist/builder/plugins/index.d.ts +46 -0
  237. package/dist/builder/plugins/index.js +117 -0
  238. package/dist/builder/plugins/pdf.d.ts +18 -0
  239. package/dist/builder/plugins/pdf.js +83 -0
  240. package/dist/builder/plugins/project.d.ts +5 -0
  241. package/dist/builder/plugins/project.js +68 -0
  242. package/dist/builder/plugins/research.d.ts +24 -0
  243. package/dist/builder/plugins/research.js +147 -0
  244. package/dist/builder/plugins/sketch.d.ts +9 -0
  245. package/dist/builder/plugins/sketch.js +101 -0
  246. package/dist/builder/plugins/slides.d.ts +14 -0
  247. package/dist/builder/plugins/slides.js +55 -0
  248. package/dist/builder/plugins/template.d.ts +13 -0
  249. package/dist/builder/plugins/template.js +95 -0
  250. package/dist/builder/prefs.d.ts +29 -0
  251. package/dist/builder/prefs.js +91 -0
  252. package/dist/builder/preview-url.d.ts +47 -0
  253. package/dist/builder/preview-url.js +107 -0
  254. package/dist/builder/project.d.ts +18 -0
  255. package/dist/builder/project.js +591 -0
  256. package/dist/builder/prose.d.ts +4 -0
  257. package/dist/builder/prose.js +57 -0
  258. package/dist/builder/publish.d.ts +18 -0
  259. package/dist/builder/publish.js +141 -0
  260. package/dist/builder/question.d.ts +33 -0
  261. package/dist/builder/question.js +64 -0
  262. package/dist/builder/redesign.d.ts +32 -0
  263. package/dist/builder/redesign.js +117 -0
  264. package/dist/builder/removal.d.ts +71 -0
  265. package/dist/builder/removal.js +73 -0
  266. package/dist/builder/reply.d.ts +50 -0
  267. package/dist/builder/reply.js +196 -0
  268. package/dist/builder/roles.d.ts +10 -0
  269. package/dist/builder/roles.js +28 -0
  270. package/dist/builder/route.d.ts +85 -0
  271. package/dist/builder/route.js +126 -0
  272. package/dist/builder/run.d.ts +4 -0
  273. package/dist/builder/run.js +804 -0
  274. package/dist/builder/runmeta.d.ts +16 -0
  275. package/dist/builder/runmeta.js +69 -0
  276. package/dist/builder/say.d.ts +2 -0
  277. package/dist/builder/say.js +7 -0
  278. package/dist/builder/scheduled.d.ts +3 -0
  279. package/dist/builder/scheduled.js +328 -0
  280. package/dist/builder/section.d.ts +27 -0
  281. package/dist/builder/section.js +60 -0
  282. package/dist/builder/settings/account.d.ts +1 -0
  283. package/dist/builder/settings/account.js +111 -0
  284. package/dist/builder/settings/billing.d.ts +1 -0
  285. package/dist/builder/settings/billing.js +210 -0
  286. package/dist/builder/settings/capabilities.d.ts +1 -0
  287. package/dist/builder/settings/capabilities.js +66 -0
  288. package/dist/builder/settings/card.d.ts +31 -0
  289. package/dist/builder/settings/card.js +140 -0
  290. package/dist/builder/settings/code.d.ts +1 -0
  291. package/dist/builder/settings/code.js +70 -0
  292. package/dist/builder/settings/credits.d.ts +10 -0
  293. package/dist/builder/settings/credits.js +123 -0
  294. package/dist/builder/settings/environments.d.ts +1 -0
  295. package/dist/builder/settings/environments.js +60 -0
  296. package/dist/builder/settings/general.d.ts +1 -0
  297. package/dist/builder/settings/general.js +58 -0
  298. package/dist/builder/settings/index.d.ts +4 -0
  299. package/dist/builder/settings/index.js +25 -0
  300. package/dist/builder/settings/integrations.d.ts +8 -0
  301. package/dist/builder/settings/integrations.js +138 -0
  302. package/dist/builder/settings/keys.d.ts +1 -0
  303. package/dist/builder/settings/keys.js +114 -0
  304. package/dist/builder/settings/list.d.ts +10 -0
  305. package/dist/builder/settings/list.js +28 -0
  306. package/dist/builder/settings/machines.d.ts +4 -0
  307. package/dist/builder/settings/machines.js +243 -0
  308. package/dist/builder/settings/members.d.ts +1 -0
  309. package/dist/builder/settings/members.js +77 -0
  310. package/dist/builder/settings/memory.d.ts +1 -0
  311. package/dist/builder/settings/memory.js +62 -0
  312. package/dist/builder/settings/notifications.d.ts +1 -0
  313. package/dist/builder/settings/notifications.js +111 -0
  314. package/dist/builder/settings/plan.d.ts +17 -0
  315. package/dist/builder/settings/plan.js +131 -0
  316. package/dist/builder/settings/privacy.d.ts +1 -0
  317. package/dist/builder/settings/privacy.js +76 -0
  318. package/dist/builder/settings/sections.d.ts +16 -0
  319. package/dist/builder/settings/sections.js +34 -0
  320. package/dist/builder/settings/shared.d.ts +6 -0
  321. package/dist/builder/settings/shared.js +58 -0
  322. package/dist/builder/settings/ui.d.ts +50 -0
  323. package/dist/builder/settings/ui.js +53 -0
  324. package/dist/builder/settings/usage.d.ts +1 -0
  325. package/dist/builder/settings/usage.js +24 -0
  326. package/dist/builder/shared.d.ts +26 -0
  327. package/dist/builder/shared.js +15 -0
  328. package/dist/builder/shelf.d.ts +16 -0
  329. package/dist/builder/shelf.js +219 -0
  330. package/dist/builder/side.d.ts +40 -0
  331. package/dist/builder/side.js +208 -0
  332. package/dist/builder/site.d.ts +75 -0
  333. package/dist/builder/site.js +138 -0
  334. package/dist/builder/spend.d.ts +21 -0
  335. package/dist/builder/spend.js +80 -0
  336. package/dist/builder/standing.d.ts +36 -0
  337. package/dist/builder/standing.js +66 -0
  338. package/dist/builder/suggest.d.ts +238 -0
  339. package/dist/builder/suggest.js +463 -0
  340. package/dist/builder/suggestions.d.ts +49 -0
  341. package/dist/builder/suggestions.js +260 -0
  342. package/dist/builder/summary.d.ts +60 -0
  343. package/dist/builder/summary.js +81 -0
  344. package/dist/builder/sync.d.ts +1 -0
  345. package/dist/builder/sync.js +164 -0
  346. package/dist/builder/tabs.d.ts +85 -0
  347. package/dist/builder/tabs.js +288 -0
  348. package/dist/builder/talk.d.ts +5 -0
  349. package/dist/builder/talk.js +108 -0
  350. package/dist/builder/thread.d.ts +60 -0
  351. package/dist/builder/thread.js +302 -0
  352. package/dist/builder/tools.d.ts +22 -0
  353. package/dist/builder/tools.js +52 -0
  354. package/dist/builder/transcript.d.ts +47 -0
  355. package/dist/builder/transcript.js +108 -0
  356. package/dist/builder/voice.d.ts +8 -0
  357. package/dist/builder/voice.js +24 -0
  358. package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
  359. package/dist/core.js +1 -0
  360. package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
  361. package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
  362. package/dist/index.d.ts +2 -0
  363. package/dist/index.js +2 -1
  364. package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
  365. package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
  366. package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
  367. package/package.json +101 -11
  368. /package/{index.d.ts → dist/core.d.ts} +0 -0
  369. /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
@@ -0,0 +1,591 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A project's workspace, in the same window: the chat on the left, what it
4
+ * built on the right.
5
+ *
6
+ * A project is a repository on the forge, addressed `<org>/<repo>`; the site it
7
+ * publishes to, when it has one, is the org's project row on that repository
8
+ * (or of the same name). A deployed site with no repository on the forge is
9
+ * opened by its slug (Artifacts), and works the same way.
10
+ *
11
+ * bar mark · project · history · chat toggle | Preview Files Code Layers |
12
+ * Share · Publish; on a phone the views (with Chat) are a row under it
13
+ * left the project's runs as a conversation, suggestions, and the ask
14
+ * right the deployed page, framed under its own bar (reload · page · device
15
+ * · open), and kept loaded while another view is open; the repository
16
+ * at the run's branch as a tree and as read-only code; the element a
17
+ * person picked
18
+ * dock the run's console — its steps and its log, as they stream
19
+ *
20
+ * The edge between left and right is dragged, or moved with the arrow keys, to
21
+ * size the chat, and the width is kept per browser; the right side keeps room
22
+ * for a page whatever the chat asked for.
23
+ *
24
+ * A chat turn IS a coding run: `POST /v1/agent/coding` with the project, the
25
+ * mode, and the previous run as `after`, so the next ask builds on the branch
26
+ * the last one pushed. Files and Code read native git at that branch. The
27
+ * preview is the project's own deployed address; a run's sandbox serves no
28
+ * address the platform publishes, and nothing here invents one.
29
+ *
30
+ * A project in a workspace the platform made is published by the platform: a
31
+ * template taken there reads `building` until its copy is `live` or failed, and
32
+ * is read again until then; a run that publishes what it pushed says so on its
33
+ * final status, which reads the project again and loads the preview again. Its
34
+ * pull request is merged from beside its link. A build that failed, or that has
35
+ * run past STALL, says so in the preview with the platform's reason and offers
36
+ * Publish again, which builds the project's repository at its branch.
37
+ *
38
+ * Derived from the Hanzo App v2 editor (github.com/hanzoai/build-v2), itself
39
+ * derived from OSW Studio and DeepSite (MIT). See NOTICE.
40
+ *
41
+ * Its words are the reader's language (@hanzo/i18n `t`, the target is
42
+ * `target`); a project's and a run's names, branches, paths and the
43
+ * platform's reasons are drawn as given.
44
+ */
45
+ import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
46
+ import { useI18n } from '@hanzo/i18n/react';
47
+ import { AlertCircle, Check, Clock, ExternalLink, Globe, MousePointerClick, PanelLeft, RefreshCcw, Search, Share2, Square, Upload, } from '@hanzogui/lucide-icons-2';
48
+ import { Attachments, CHAT, Console, DEVICES, Feedback, FileTabs, FileTree, PageSelect, PreviewFrame, ProjectChip, VIEWS, Views, Workspace, fold, } from '@hanzo/ui/agents';
49
+ import { Composer, Message } from '@hanzo/ui/chat';
50
+ import { Button, Dialog, DialogContent, DialogTitle, Input, Skeleton, toast } from '@hanzo/ui';
51
+ import { HanzoMark } from '@hanzo/ui/product';
52
+ import { useLimits } from '@hanzo/ui/product/useLimits';
53
+ import { useDictation, useVoice } from '@hanzo/voice';
54
+ import { useEffect, useMemo, useRef, useState } from 'react';
55
+ import { copy as toClipboard } from './clipboard.js';
56
+ import { RING } from './pane.js';
57
+ import { read as pushed } from './api/changes.js';
58
+ import { codebases, one } from './api/codebases.js';
59
+ import { start, steer as steerCoding } from './api/coding.js';
60
+ import { blob, tree } from './api/git.js';
61
+ import { limits as readLimits } from './api/models.js';
62
+ import { declare } from './api/platform.js';
63
+ import { address, deployments, name as repoName, ours, templates } from './api/projects.js';
64
+ import { ports as listening, preview as sandboxPreview, stay } from './api/sandbox.js';
65
+ import { list, message, stop } from './api/sessions.js';
66
+ import { decode, followed, outcome, pull, said, scrub, who } from './api/turn.js';
67
+ import { verdict as record } from './api/verdict.js';
68
+ import { useKept, useProjects, useRead, useRun } from './data.js';
69
+ import { Merge } from './git.js';
70
+ import { Gutter } from './gutter.js';
71
+ import { useHost, useTarget } from './host.js';
72
+ import { cacheBustUrl, previewRevision, resolvePreviewSource } from './preview-url.js';
73
+ import { republish } from './question.js';
74
+ import { useSpend } from './spend.js';
75
+ import { MODES } from './gear.js';
76
+ import { level, pacing, useMind } from './mind.js';
77
+ import { Out } from './out.js';
78
+ import { useEar, useSpoken } from './voice.js';
79
+ import { Publish } from './publish.js';
80
+ import { path } from './route.js';
81
+ import { cleanErrorText, isAlreadyRunningError, isSessionActive, isSessionLive, linkThread, resolveSessionState } from './thread.js';
82
+ import { carrying, compose, pick } from './tools.js';
83
+ /** How often a project being published is read again, ms. */
84
+ const AGAIN = 5000;
85
+ /** How long a build may run before the builder offers to publish again, s. A template's build takes a few minutes. */
86
+ const STALL = 10 * 60;
87
+ /** The chat's width beside the work, px: its default, and the two it is kept between. */
88
+ const CHAT_WIDTH = 360;
89
+ const CHAT_FLOOR = 300;
90
+ const CHAT_CEIL = 640;
91
+ /** The Workspace's gutter between the chat and the work, and its margin right of the work, px ($3). */
92
+ const GUTTER = 12;
93
+ /** What the work keeps beside the chat however wide the chat was asked to be, px. */
94
+ const WORK = 400 + 2 * GUTTER;
95
+ /** Whether the site `p` is the repository `r`'s: built from it, or named as it is. */
96
+ export function siteOf(p, r) {
97
+ const want = `${r.org}/${r.name}`.toLowerCase();
98
+ return (p.repo !== '' && address(p.repo).toLowerCase() === want) || p.slug === r.name.toLowerCase();
99
+ }
100
+ /** A site's slug for a repository's name: lowercase letters, digits and hyphens, at most 40. */
101
+ export function slugOf(name) {
102
+ return name
103
+ .toLowerCase()
104
+ .replace(/[^a-z0-9]+/g, '-')
105
+ .replace(/^-+|-+$/g, '')
106
+ .slice(0, 40)
107
+ .replace(/-+$/, '');
108
+ }
109
+ /** One run in the conversation: what was asked, and what it came to. */
110
+ function Turn({ run, open, onOpen, project }) {
111
+ const target = useTarget();
112
+ const { t } = useI18n();
113
+ const [v, setV] = useState(null);
114
+ const [note, setNote] = useState('');
115
+ return (_jsxs(YStack, { gap: "$2", children: [_jsx(Message, { role: "user", children: _jsx(SizableText, { size: "$2", color: "$ink", children: run.title || t('Untitled session') }) }), _jsx(Message, { role: "assistant", busy: isSessionActive(run.status), actions: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Feedback, { text: run.title, verdict: v, onVerdict: (next) => {
116
+ setV(next);
117
+ record(target, run.id, project, next).catch((e) => {
118
+ setV(null);
119
+ setNote(e.message);
120
+ });
121
+ } }), note ? (_jsx(SizableText, { size: "$1", color: "$soft", children: note })) : null, !open ? (_jsx(XStack, { render: "button", onPress: onOpen, px: "$1.5", py: "$1", minH: 28, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: "$soft", textDecorationLine: "underline", children: t('Show steps') }) })) : null] }), children: _jsx(SizableText, { size: "$2", color: "$ink", children: run.status === 'done' || run.status === 'completed'
122
+ ? t('Done.')
123
+ : run.status === 'error'
124
+ ? t('This session hit an error.')
125
+ : run.status === 'stopped'
126
+ ? t('Stopped.')
127
+ : t('Working…') }) })] }));
128
+ }
129
+ export function Project({ at }) {
130
+ const host = useHost();
131
+ const target = useTarget();
132
+ const { t } = useI18n();
133
+ const spend = useSpend();
134
+ const signed = Boolean(host.person);
135
+ const all = useProjects(target, signed);
136
+ // The repository the address names, and the forge's record of it.
137
+ const named = 'slug' in at ? null : at;
138
+ const forge = useRead(named && signed ? () => one(target, named.name) : null, null, [target, signed, named?.name]);
139
+ const project = all.value.find((p) => (named ? siteOf(p, named) : 'slug' in at && p.slug === at.slug)) ?? null;
140
+ // The site this workspace publishes to: the project's, or the repository's name as one.
141
+ const slug = project?.slug ?? ('slug' in at ? at.slug : slugOf(named?.name ?? ''));
142
+ const title = project?.name ?? named?.name ?? slug;
143
+ // A project that has never served reads `building` while it is published, and
144
+ // is read again until it is live or its build failed.
145
+ const building = project?.status === 'building';
146
+ const failed = project?.status === 'error';
147
+ const { reload: again } = all;
148
+ // The clock a build is measured against, moved each time the project is read again.
149
+ const [now, setNow] = useState(() => Date.now());
150
+ useEffect(() => {
151
+ if (!building)
152
+ return;
153
+ const every = setInterval(() => {
154
+ again();
155
+ setNow(Date.now());
156
+ }, AGAIN);
157
+ return () => clearInterval(every);
158
+ }, [building, again]);
159
+ // When the build began, and why it failed, are its latest deployment's to say.
160
+ const failure = useRead(building || failed ? () => deployments(target, slug) : null, [], [target, slug, building, failed, project?.updated]);
161
+ const latest = failure.value[0];
162
+ const began = latest?.status === 'building' ? latest.created : 0;
163
+ const ran = began ? Math.max(0, Math.floor(now / 1000) - began) : 0;
164
+ const stalled = building && ran > STALL;
165
+ // Publish again: the project's repository, built at its branch, the way Publish builds it.
166
+ const [redo, setRedo] = useState({ busy: false, error: '' });
167
+ // The repository's clone address: the forge's for a repository, the site's own otherwise.
168
+ const clone = named ? (forge.value?.clone ?? '') : (project?.repo ?? '');
169
+ const home = named ? (forge.value?.branch ?? 'main') : project?.branch || 'main';
170
+ const retry = async () => {
171
+ if (!clone || redo.busy)
172
+ return;
173
+ // Built again in a cloud sandbox: asked first.
174
+ if (!(await spend.ask(republish(title, t))))
175
+ return;
176
+ setRedo({ busy: true, error: '' });
177
+ try {
178
+ await declare(target, { repo: clone, ref: home, name: slug, project: slug, mode: 'branch' });
179
+ setNow(Date.now());
180
+ again();
181
+ setRedo({ busy: false, error: '' });
182
+ toast.success(t('Publish queued for {name}', { name: title }));
183
+ }
184
+ catch (e) {
185
+ setRedo({ busy: false, error: e.message });
186
+ }
187
+ };
188
+ // The site's runs, or the org's when the repository has no site yet.
189
+ const sited = !named || Boolean(project);
190
+ const listed = useRead(signed ? () => list(target, sited ? { kind: 'coding', project: slug, limit: 50 } : { kind: 'coding', limit: 50 }) : null, [], [target, signed, slug, sited]);
191
+ // Only the runs on this project's own repository: a record can be moved into
192
+ // any project, and a run's branch is what Files, Code and Publish read.
193
+ const mine = (r) => (named ? ours(r.repo, `${named.org}/${named.name}`) && Boolean(r.repo) : ours(r.repo, project?.repo ?? ''));
194
+ const runs = { ...listed, value: listed.value.filter(mine) };
195
+ const ordered = useMemo(() => [...runs.value].reverse(), [listed.value, project?.repo, named?.org, named?.name]);
196
+ const [chosen, setChosen] = useState(null);
197
+ const current = chosen ?? runs.value[0]?.id ?? null;
198
+ const run = useRun(target, current);
199
+ const end = outcome(run.events);
200
+ const nextSession = useMemo(() => followed(run.events), [run.events]);
201
+ const pr = pull(run.record?.pr ?? '', run.record?.repo ?? '');
202
+ const runState = resolveSessionState(run.status, end.status);
203
+ const running = Boolean(current) && isSessionLive(runState);
204
+ const active = Boolean(current) && isSessionActive(runState);
205
+ const sandboxId = run.record?.sandbox ?? '';
206
+ // Follow a steered turn seamlessly into its continuation session.
207
+ useEffect(() => {
208
+ if (!current || !nextSession || nextSession === current)
209
+ return;
210
+ linkThread(current, nextSession);
211
+ setChosen(nextSession);
212
+ runs.reload();
213
+ // eslint-disable-next-line react-hooks/exhaustive-deps
214
+ }, [current, nextSession]);
215
+ const [view, setView] = useKept(`hanzo.build.view.${slug}`, 'preview');
216
+ const [device, setDevice] = useState('desktop');
217
+ const [collapsed, setCollapsed] = useKept('hanzo.build.chat', false);
218
+ const [split, setSplit] = useKept('hanzo.build.split', CHAT_WIDTH);
219
+ // The workspace's width, which bounds the chat so the work keeps its room.
220
+ const [room, setRoom] = useState(0);
221
+ const most = room ? Math.max(CHAT_FLOOR, Math.min(CHAT_CEIL, room - WORK)) : CHAT_CEIL;
222
+ const across = Math.min(most, Math.max(CHAT_FLOOR, split));
223
+ // Below md the chat and the work take turns, and Chat is one more view to switch back to.
224
+ const [pane, setPane] = useState('chat');
225
+ const wide = useMedia().md;
226
+ // A workspace too narrow for the chat at its floor and the work at its room
227
+ // (a tablet beside the host's column) shows the work, and the chat when asked:
228
+ // never both cut. Asked here is for this visit; the kept choice is the wide one's.
229
+ const cramped = wide && room > 0 && room < CHAT_FLOOR + WORK;
230
+ const [asked, setAsked] = useState(false);
231
+ const shut = cramped ? !asked : collapsed;
232
+ const [dock, setDock] = useKept('hanzo.build.dock', 36);
233
+ const [mode, setMode] = useKept('hanzo.build.mode', 'build');
234
+ const [page, setPage] = useState('/');
235
+ const [draft, setDraft] = useState('');
236
+ const [busy, setBusy] = useState(false);
237
+ const [note, setNote] = useState('');
238
+ const [picked, setPicked] = useState([]);
239
+ const [attached, setAttached] = useState([]);
240
+ // The model and effort Chat and New share, and dictation into the ask.
241
+ const { limits } = useLimits(signed ? (signal) => readLimits(target, signal) : null, target);
242
+ const mind = useMind(target, limits?.plan, host.topUp);
243
+ const voice = useVoice({ speech: useEar(target), language: useSpoken(), ...useDictation(draft, setDraft) });
244
+ const [bridge, setBridge] = useState(false);
245
+ const [editing, setEditing] = useState(false);
246
+ const [pageLines, setPageLines] = useState([]);
247
+ const [history, setHistory] = useState(false);
248
+ const [publish, setPublish] = useState(null);
249
+ const [switcher, setSwitcher] = useState(false);
250
+ const [switchQ, setSwitchQ] = useState('');
251
+ const repos = useRead(switcher && signed ? () => codebases(target) : null, [], [target, switcher, signed]);
252
+ const filteredRepos = useMemo(() => {
253
+ const needle = switchQ.trim().toLowerCase();
254
+ return needle ? repos.value.filter((c) => `${c.org}/${c.name}`.toLowerCase().includes(needle)) : repos.value;
255
+ }, [repos.value, switchQ]);
256
+ const frame = useRef(null);
257
+ const [previewRev, setPreviewRev] = useState(0);
258
+ const [preferLive, setPreferLive] = useState(false);
259
+ const [sandboxPort, setSandboxPort] = useState(0);
260
+ const [sandboxUrl, setSandboxUrl] = useState('');
261
+ // What was published or edited may be new files at the same address: re-read the
262
+ // project, re-poll sandbox ports, and cache-bust reload the preview frame.
263
+ const fresh = () => {
264
+ again();
265
+ setPreviewRev((n) => n + 1);
266
+ frame.current?.reload();
267
+ };
268
+ // Poll the active session's sandbox for a live dev-server port so Preview prefers
269
+ // live edits in the sandbox over the pre-edit deployed site.
270
+ useEffect(() => {
271
+ if (!signed || !sandboxId) {
272
+ setSandboxPort(0);
273
+ setSandboxUrl('');
274
+ return;
275
+ }
276
+ let gone = false;
277
+ const poll = () => listening(target, sandboxId).then((ps) => {
278
+ if (gone)
279
+ return;
280
+ setSandboxPort((p) => (ps.some((x) => x.port === p) ? p : (ps[0]?.port ?? 0)));
281
+ }, () => undefined);
282
+ void poll();
283
+ const every = setInterval(poll, 5000);
284
+ return () => {
285
+ gone = true;
286
+ clearInterval(every);
287
+ };
288
+ }, [target, signed, sandboxId, previewRev]);
289
+ useEffect(() => {
290
+ setSandboxUrl('');
291
+ if (!signed || !sandboxId || !sandboxPort)
292
+ return;
293
+ let gone = false;
294
+ sandboxPreview(target, sandboxId, sandboxPort, stay).then((u) => !gone && setSandboxUrl(u), () => undefined);
295
+ return () => {
296
+ gone = true;
297
+ };
298
+ }, [target, signed, sandboxId, sandboxPort, previewRev]);
299
+ // Auto-refresh Preview whenever a turn finishes, edits/pushes land, or a publish completes.
300
+ const revKey = useMemo(() => previewRevision(run.events, runState, end.published), [run.events, runState, end.published]);
301
+ const lastRev = useRef({ run: null, key: '', wasActive: false });
302
+ useEffect(() => {
303
+ if (!run.record)
304
+ return;
305
+ if (lastRev.current.run !== current) {
306
+ lastRev.current = { run: current, key: revKey, wasActive: active };
307
+ return;
308
+ }
309
+ const finishedTurn = lastRev.current.wasActive && !active;
310
+ const advanced = lastRev.current.key !== revKey;
311
+ lastRev.current = { run: current, key: revKey, wasActive: active };
312
+ if (advanced || finishedTurn)
313
+ fresh();
314
+ // eslint-disable-next-line react-hooks/exhaustive-deps
315
+ }, [current, run.record, revKey, active]);
316
+ // Where the open run's pull request stands on the forge: Merge is offered while it is open.
317
+ const proposal = useRead(signed && current && pr.href ? () => pushed(target, current).then((c) => ({ run: current, pull: c.pull })) : null, null, [target, signed, current, pr.href]);
318
+ const proposing = proposal.value?.run === current && proposal.value.pull?.state === 'open';
319
+ // Files is drawn again after a merge, from what the forge holds now.
320
+ const [round, setRound] = useState(0);
321
+ // Files and Code: native git, at the branch the open run pushed (or the project's own).
322
+ const repo = named ? named.name : project?.repo ? repoName(project.repo) : '';
323
+ const ref = run.record?.branch || home;
324
+ const [files, setFiles] = useState([]);
325
+ const [file, setFile] = useState(null);
326
+ useEffect(() => {
327
+ setFiles([]);
328
+ setFile(null);
329
+ }, [repo, ref]);
330
+ const openFile = async (path) => {
331
+ setFile(path);
332
+ setView('code');
333
+ if (files.some((f) => f.path === path))
334
+ return;
335
+ setFiles((was) => [...was, { path, readOnly: true }]);
336
+ try {
337
+ const b = await blob(target, repo, ref, path);
338
+ const content = b.binary ? '' : b.truncated ? '' : b.text;
339
+ const error = b.binary ? t('A binary file — nothing to show as text.') : b.truncated ? t('Past the 1 MiB view cap — clone the repository to read it.') : undefined;
340
+ setFiles((was) => was.map((f) => (f.path === path ? { ...f, content, error } : f)));
341
+ }
342
+ catch (e) {
343
+ setFiles((was) => was.map((f) => (f.path === path ? { ...f, error: e.message } : f)));
344
+ }
345
+ };
346
+ // Pages: the HTML files at the repository's root, as the page picker's list.
347
+ const root = useRead(repo ? () => tree(target, repo, ref, '') : null, [], [target, repo, ref]);
348
+ const pages = useMemo(() => [
349
+ { id: '/', label: t('Homepage') },
350
+ ...root.value
351
+ .filter((e) => !e.dir && /\.html?$/i.test(e.name) && !/^index\.html?$/i.test(e.name))
352
+ .map((e) => ({ id: `/${e.path}`, label: e.name.replace(/\.html?$/i, '') })),
353
+ ], [root.value, t]);
354
+ // Prefer the live sandbox preview when available; fall back to deployed live site or starter demo.
355
+ const forked = project && !project.live && !building && !failed ? project.forked : '';
356
+ const starters = useRead(forked ? () => templates(target) : null, [], [target.api, forked]);
357
+ const starter = forked ? starters.value.find((s) => s.slug === forked && s.demo) : undefined;
358
+ const resolvedPreview = resolvePreviewSource({
359
+ sandboxUrl,
360
+ liveUrl: project?.live,
361
+ starterUrl: starter?.demo,
362
+ preferLive,
363
+ });
364
+ const rawSrc = resolvedPreview.url
365
+ ? resolvedPreview.kind === 'sandbox'
366
+ ? resolvedPreview.url
367
+ : new URL(page, resolvedPreview.url).toString()
368
+ : null;
369
+ const src = rawSrc ? cacheBustUrl(rawSrc, previewRev) : null;
370
+ const why = failure.value[0]?.message || failure.error?.message || (failure.loading ? '' : t('Its build ended without saying why.'));
371
+ const merged = () => {
372
+ proposal.reload();
373
+ root.reload();
374
+ setRound((n) => n + 1);
375
+ };
376
+ const lines = useMemo(() => [
377
+ ...run.events
378
+ .filter((e) => e.kind === 'log' || e.kind === 'tool-call' || e.kind === 'status')
379
+ .map((e) => {
380
+ // The console is where a run's error is read whole; the chat says it in one plain line.
381
+ const body = decode(e.payload);
382
+ const error = e.kind === 'status' && body && typeof body === 'object' && typeof body.error === 'string' ? scrub(body.error, t) : '';
383
+ return {
384
+ id: `r${e.seq || e.id}`,
385
+ level: error || (e.kind === 'status' && /error/.test(said(e, run.record?.mode).toLowerCase())) ? 'error' : e.kind === 'tool-call' ? 'info' : 'log',
386
+ text: error || said(e, run.record?.mode, t),
387
+ source: e.kind === 'status' ? 'run' : who(e.actor),
388
+ };
389
+ })
390
+ .filter((l) => l.text),
391
+ ...pageLines,
392
+ ], [run.events, run.record?.mode, pageLines]);
393
+ const onBridge = (e) => {
394
+ if (e.type === 'preview:ready') {
395
+ setBridge(true);
396
+ // A new document starts closed to picking; open it again if the person had.
397
+ if (editing)
398
+ frame.current?.post({ type: 'preview:editable', active: true });
399
+ }
400
+ else if (e.type === 'preview:select')
401
+ // The whole selector, as it will ride the next ask — never a shortened name
402
+ // that hides what the page sent.
403
+ setPicked([{ id: e.info.selector, kind: 'element', label: e.info.selector }]);
404
+ else if (e.type === 'preview:navigate') {
405
+ // The bridge admits only a path on the framed site's own origin; kept as its path and query.
406
+ const to = new URL(e.path, window.location.origin);
407
+ setPage(`${to.pathname}${to.search}`);
408
+ }
409
+ else if (e.type === 'preview:console')
410
+ setPageLines((was) => [...was.slice(-400), { id: `p${was.length}-${Date.now()}`, level: e.level, text: e.text, source: 'page' }]);
411
+ };
412
+ // Steer an active session: sandbox sessions use POST /v1/agent/coding/{id}/steer, machines use /message.
413
+ const steer = async (id, wordsOverride) => {
414
+ const words = (wordsOverride ?? draft).trim();
415
+ if (!words)
416
+ return;
417
+ const isSandbox = (run.record?.environment || 'sandbox') === 'sandbox';
418
+ try {
419
+ if (isSandbox) {
420
+ await steerCoding(target, id, words);
421
+ setDraft('');
422
+ setPicked([]);
423
+ setAttached([]);
424
+ setNote(t('Redirecting session — keeping current work and continuing here'));
425
+ }
426
+ else {
427
+ await message(target, id, words);
428
+ setDraft('');
429
+ setPicked([]);
430
+ setAttached([]);
431
+ setNote(t('Sent — recorded on this session'));
432
+ }
433
+ }
434
+ catch (e) {
435
+ setNote(cleanErrorText(e.message));
436
+ }
437
+ };
438
+ // A suggestion sends its own words; the composer, a draft with words in it.
439
+ const send = async (text) => {
440
+ const ask = (text ?? draft).trim();
441
+ if (busy || !ask)
442
+ return;
443
+ setBusy(true);
444
+ setNote('');
445
+ try {
446
+ // The page's own strings ride as quoted data, never as prose, and the page
447
+ // is named only when the person chose it from the picker.
448
+ const where = pages.find((p) => p.id === page)?.label;
449
+ const context = picked.length
450
+ ? `\n\nThe person picked an element in the preview${where ? ` of the ${where} page` : ''}. Its CSS selector, as data: ${JSON.stringify(picked[0].id)}`
451
+ : '';
452
+ const prompt = compose(`${ask}${context}`, attached);
453
+ // A project with no repository yet sends neither, and its first session makes one.
454
+ let next;
455
+ try {
456
+ next = await start(target, {
457
+ prompt,
458
+ // A repository with no site yet runs on the repository alone.
459
+ project: project?.slug,
460
+ repo,
461
+ base: named ? forge.value?.branch : project?.branch,
462
+ after: current ?? undefined,
463
+ mode,
464
+ // Enso named as itself: a turn that names none takes the person's saved coding default.
465
+ model: mind.model,
466
+ effort: level(mind.effort),
467
+ });
468
+ }
469
+ catch (e) {
470
+ if (current && isAlreadyRunningError(e)) {
471
+ await steer(current, prompt);
472
+ return;
473
+ }
474
+ throw e;
475
+ }
476
+ if (current)
477
+ linkThread(current, next.session);
478
+ setDraft('');
479
+ setPicked([]);
480
+ setAttached([]);
481
+ setChosen(next.session);
482
+ runs.reload();
483
+ }
484
+ catch (e) {
485
+ setNote(cleanErrorText(e.message));
486
+ }
487
+ finally {
488
+ setBusy(false);
489
+ }
490
+ };
491
+ const share = async () => {
492
+ const link = project?.live || `${window.location.origin}${window.location.pathname}`;
493
+ setNote((await toClipboard(link)) ? t('Copied {link}', { link }) : link);
494
+ };
495
+ if (!signed) {
496
+ return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 440, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: t('Sign in to open this project.') }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.signIn?.(), children: t('Sign in') })] }) }));
497
+ }
498
+ // A repository of another organization is opened in that one.
499
+ if (named && host.org && named.org.toLowerCase() !== host.org.toLowerCase()) {
500
+ const member = host.memberships?.some((m) => m.toLowerCase() === named.org.toLowerCase()) && host.chooseOrg;
501
+ return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 480, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: t('{repo} is in {org}, and you are working in {current}.', { repo: `${named.org}/${named.name}`, org: named.org, current: host.org }) }), member ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.chooseOrg?.(named.org), children: t('Switch to {org}', { org: named.org }) })) : (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(path({ kind: 'screen', screen: 'projects' })), children: t('See this organization’s projects') }))] }) }));
502
+ }
503
+ if (named ? !forge.loading && !forge.value : !all.loading && !project && !all.error) {
504
+ return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 480, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: named
505
+ ? forge.error && !/not found|404/i.test(forge.error.message)
506
+ ? forge.error.message
507
+ : t('{org} has no repository named {name}.', { org: named.org, name: named.name })
508
+ : host.org
509
+ ? t('{org} has no project named {name}.', { org: host.org, name: slug })
510
+ : t('There is no project named {name}.', { name: slug }) }), _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(path({ kind: 'screen', screen: named ? 'projects' : 'artifacts' })), children: named ? t('See this organization’s projects') : t('See what this organization has built') })] }) }));
511
+ }
512
+ const chat = (_jsxs(YStack, { "data-slot": "project-chat", flex: 1, minH: 0, position: "relative", children: [_jsx(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$3", pt: "$2", pb: "$4", gap: "$4", $md: { pr: 0 }, children: ordered.length === 0 ? (runs.loading ? (_jsxs(YStack, { gap: "$3", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading this project’s sessions…') }), _jsx(Skeleton, { layout: "block", width: "84%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "66%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "92%", height: 56, rounded: "$3" })] })) : (_jsx(SizableText, { size: "$2", color: "$ink", children: project?.live
513
+ ? t('{name} is loaded — it is in the preview, and every run on it is under the clock above. Say what to change and it gets built.', { name: project.name })
514
+ : stalled
515
+ ? t('{name} has been publishing for {minutes} minutes without finishing. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '', minutes: Math.floor(ran / 60) })
516
+ : failed
517
+ ? t('{name} could not be published. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '' })
518
+ : building
519
+ ? t('{name} is being published — it appears in the preview when its build finishes. Say what to change and it gets built.', { name: project?.name ?? '' })
520
+ : starter
521
+ ? t('{name} is loaded — the preview shows the {starter} starter until your copy is published. Say what to change and it gets built.', { name: project?.name ?? '', starter: starter.title })
522
+ : project
523
+ ? t('{name} is loaded and nothing is published yet. Say what to change and it gets built.', { name: project.name })
524
+ : named
525
+ ? t('{repo} is open on {branch}. Say what to change and it gets built there.', { repo: `${named.org}/${named.name}`, branch: home })
526
+ : t('{name} is loaded. Say what to change and it gets built.', { name: slug }) }))) : (ordered.map((r) => (_jsxs(YStack, { gap: "$2", children: [_jsx(Turn, { run: r, open: r.id === current, onOpen: () => setChosen(r.id), project: slug }), r.id === current ? (_jsxs(YStack, { gap: "$1", paddingInlineStart: "$2", borderInlineStartWidth: 1, borderColor: "$borderColor", children: [fold(run.events.map((e) => ({ kind: e.kind, actor: who(e.actor), seq: e.seq, id: e.id, text: said(e, run.record?.mode, t) })).filter((b) => b.text)).map((b) => (_jsx(SizableText, { size: "$1", color: "$soft", children: b.text }, b.key))), pr.href ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsxs(Out, { href: pr.href, label: t('Open pull request {pr}', { pr: pr.label }), children: [_jsx(SizableText, { size: "$1", color: "$ink", textDecorationLine: "underline", children: t('Pull request {pr}', { pr: pr.label }) }), _jsx(ExternalLink, { size: 11 })] }), _jsx(Merge, { session: r.id, open: proposing, onMerged: merged })] })) : null] })) : null] }, r.id)))) }), _jsxs(YStack, { "data-slot": "project-ask", px: "$3", pb: "$3", gap: "$2", minW: 0, $md: { pr: 0 }, children: [note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note })) : null, picked.length ? _jsx(Attachments, { items: picked, onRemove: () => setPicked([]) }) : null, _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: () => void (current && running ? steer(current) : send()), onStop: current && active
527
+ ? () => void stop(target, current).then(() => setNote(t('Stop requested — the session keeps its work on its branch')), (e) => setNote(cleanErrorText(e.message)))
528
+ : undefined, busy: busy || (active && !draft.trim()), placeholder: running ? t('Steer or redirect this session…') : t('Ask Hanzo for edits'), label: t('Ask Hanzo for edits'), plus: { upload: () => pick(attached, setAttached, setNote, t) }, carried: carrying(attached, setAttached), mode: running ? null : { value: mode === 'plan' ? 'plan' : 'auto', set: (m) => setMode(m === 'plan' ? 'plan' : 'build'), items: MODES.filter((m) => m.id !== 'manual') }, mind: running ? null : mind, effort: running ? null : pacing(mind), voice: voice, children: current && active && draft.trim() ? (_jsxs(XStack, { render: "button", "data-slot": "composer-stop", "aria-label": t('Stop session'), ...{ title: t('Stop session') }, onPress: () => void stop(target, current).then(() => setNote(t('Stop requested — the session keeps its work on its branch')), (e) => setNote(cleanErrorText(e.message))), 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: t('Stop') })] })) : null })] }), wide && !shut ? (_jsx(Gutter, { side: "left", span: across, floor: CHAT_FLOOR, ceil: most, reset: CHAT_WIDTH, onSpan: setSplit, label: t('Resize the chat'), gap: GUTTER })) : null] }));
529
+ // The preview stays loaded while another view is open, so coming back to it
530
+ // is the page as it was left.
531
+ const preview = (_jsxs(YStack, { "data-slot": "preview", flex: 1, minH: 0, minW: 0, gap: "$2", display: view === 'preview' ? 'flex' : 'none', children: [_jsxs(XStack, { "data-slot": "preview-bar", items: "center", gap: "$1.5", minW: 0, shrink: 0, "$max-md": { px: '$2' }, children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the preview'), ...{ title: t('Reload the preview') }, onPress: fresh, p: "$1.5", "$max-md": { minW: 40, minH: 40, items: 'center', justify: 'center' }, rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 16 }) }), resolvedPreview.kind === 'sandbox' || resolvedPreview.kind === 'live' ? (_jsxs(XStack, { render: sandboxUrl && project?.live ? 'button' : undefined, onPress: sandboxUrl && project?.live ? () => setPreferLive((v) => !v) : undefined, "data-slot": "preview-mode", "data-kind": resolvedPreview.kind, items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 999, bg: "$edge", borderWidth: 1, borderColor: "$borderColor", shrink: 0, hoverStyle: sandboxUrl && project?.live ? { bg: '$hover' } : undefined, children: [resolvedPreview.kind === 'sandbox' ? _jsx(YStack, { width: 6, height: 6, rounded: 99, bg: "var(--state-online)", shrink: 0 }) : _jsx(Globe, { size: 11, opacity: 0.75 }), _jsx(SizableText, { size: "$1", color: "$ink", numberOfLines: 1, children: resolvedPreview.kind === 'sandbox' ? t('Sandbox preview') : t('Live site') })] })) : null, _jsx(PageSelect, { pages: pages, value: page, onChange: setPage, shrink: 1 }), _jsx(XStack, { flex: 1 }), _jsx(Views, { views: DEVICES, value: device, onChange: (d) => setDevice(d), label: t('Device'), labels: "none" }), rawSrc ? (_jsx(Out, { href: rawSrc, label: t('Open in a new tab'), children: _jsxs(XStack, { items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", hoverStyle: { bg: '$hover' }, children: [_jsx(SizableText, { size: "$1", color: "$soft", "$max-md": { display: 'none' }, children: t('Preview') }), _jsx(ExternalLink, { size: 15 })] }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: src, title: t('{title} preview', { title }), device: device, onBridge: onBridge, empty: _jsx(YStack, { items: "center", justify: "center", p: "$6", width: "100%", children: _jsxs(YStack, { items: "center", gap: "$2.5", px: "$5", py: "$6", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", width: "100%", maxW: 420, children: [_jsx(YStack, { width: 36, height: 36, rounded: "$3", bg: "$raised", items: "center", justify: "center", "aria-hidden": true, children: stalled || failed ? _jsx(AlertCircle, { size: 18, color: "var(--state-error)" }) : _jsx(Globe, { size: 18, color: "$soft" }) }), _jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", text: "center", children: stalled
532
+ ? t('Publishing is taking too long')
533
+ : building
534
+ ? project?.forked
535
+ ? t('Publishing your copy…')
536
+ : t('Publishing…')
537
+ : failed
538
+ ? t('Publishing failed')
539
+ : t('Nothing deployed yet') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: stalled
540
+ ? t('Its build started {minutes} minutes ago and has not finished.', { minutes: Math.floor(ran / 60) })
541
+ : building
542
+ ? t('Its page appears here when the build finishes.')
543
+ : failed
544
+ ? why
545
+ : t('Publish this project and its page appears here.') }), spend.dialog, (stalled || failed) && clone ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: redo.busy, onPress: () => void retry(), children: redo.busy ? t('Publishing…') : t('Publish again') })) : null, redo.error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", text: "center", role: "alert", children: redo.error })) : null] }) }), toolbar: bridge ? (_jsx(XStack, { render: "button", "aria-pressed": editing, "aria-label": editing ? t('Stop picking elements') : t('Pick an element to edit'), ...{ title: editing ? t('Stop picking elements') : t('Pick an element to edit') }, onPress: () => {
546
+ const next = !editing;
547
+ setEditing(next);
548
+ frame.current?.post({ type: 'preview:editable', active: next });
549
+ }, minW: 36, minH: 36, items: "center", justify: "center", rounded: "$10", focusVisibleStyle: RING, children: _jsx(MousePointerClick, { size: 16 }) })) : undefined })] }));
550
+ const body = view === 'preview' ? null : view === 'files' ? (repo && root.error ? (_jsx(YStack, { p: "$4", children: _jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "status", children: t('Nothing to show for {repo} at {ref}: the forge answered “{reason}”.', { repo, ref, reason: root.error.message }) }) })) : repo ? (_jsx(FileTree, { load: async (dir) => (await tree(target, repo, ref, dir)).map((e) => ({ path: e.path, kind: e.dir ? 'dir' : 'file' })), value: file, onSelect: (p) => void openFile(p), label: t('{repo} at {ref}', { repo, ref }) }, round)) : (_jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('This project has no repository yet. Its first run creates one.') }))) : view === 'code' ? (_jsx(FileTabs, { files: files, value: file, onSelect: setFile, onClose: (p) => {
551
+ setFiles((was) => was.filter((f) => f.path !== p));
552
+ if (file === p)
553
+ setFile(null);
554
+ }, empty: _jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('Open a file from Files. Code here is read at {ref}; ask in the chat to change it.', { ref }) }) })) : (_jsx(YStack, { p: "$4", gap: "$2", children: picked.length ? (picked.map((p) => (_jsxs(XStack, { items: "center", gap: "$2.5", px: "$3", py: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsx(MousePointerClick, { size: 14, color: "$soft" }), _jsxs(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", flex: 1, minW: 0, children: [p.label, " \u2014 ", p.id] })] }, p.id)))) : (_jsx(YStack, { p: "$5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", items: "center", gap: "$2", children: _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: bridge
555
+ ? t('Pick an element in the preview to see it here and attach it to your next ask.')
556
+ : t('Layers are read through the preview bridge, and this page does not run it. Its elements cannot be listed from here.') }) })) }));
557
+ const views = (_jsx(Views, { views: [CHAT, ...VIEWS], value: pane === 'chat' && !wide ? 'chat' : view, onChange: (v) => {
558
+ if (v === 'chat')
559
+ return setPane('chat');
560
+ setView(v);
561
+ setPane('view');
562
+ }, label: t('View') }));
563
+ // On a phone the bar has no room for the views beside the project: there
564
+ // they were a scroller of the bar's leftovers, 49px at 375 beside a project
565
+ // named "Instrument", showing part of Chat and none of Code (hanzo-inc/app#305).
566
+ // So below md they take a row of their own under the bar, in whichever pane
567
+ // shows (one pane at a time there, so one row).
568
+ const row = wide ? null : (_jsx(XStack, { "data-slot": "views-row", justify: "center", px: "$3", pb: "$2", shrink: 0, minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: 'none' }, children: views }));
569
+ return (_jsxs(_Fragment, { children: [_jsxs(Workspace, { start: _jsxs(XStack, { items: "center", gap: "$2", minW: 0, shrink: 1, children: [_jsx(XStack, { render: "button", "aria-label": t('All sessions'), ...{ title: t('All sessions') }, onPress: () => host.go(''), p: "$1", "$max-md": { minW: 40, minH: 40, items: 'center', justify: 'center' }, shrink: 0, children: _jsx(HanzoMark, { size: 20 }) }), _jsx(ProjectChip, { name: title, onPress: () => setSwitcher(true) }), _jsx(XStack, { render: "button", "aria-label": t('History'), ...{ title: t('History') }, onPress: () => setHistory(true), p: "$1.5", "$max-md": { minW: 40, minH: 40, items: 'center', justify: 'center' }, rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(Clock, { size: 16 }) }), _jsx(XStack, { render: "button", "aria-label": shut ? t('Show the chat') : t('Hide the chat'), ...{ title: shut ? t('Show the chat') : t('Hide the chat') }, "aria-pressed": !shut, onClick: () => (cramped ? setAsked(!asked) : setCollapsed(!collapsed)), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, "$max-md": { display: 'none' }, children: _jsx(PanelLeft, { size: 16 }) })] }), middle: wide ? views : undefined, end: _jsxs(XStack, { "data-slot": "project-header-actions", items: "center", gap: "$2", shrink: 0, style: { paddingInlineEnd: 'var(--hanzo-shell-top-right-inset, 0px)' }, children: [_jsx(XStack, { display: "none", $md: { display: 'flex' }, shrink: 0, children: _jsxs(Button, { variant: "outline", size: "sm", onPress: () => void share(), children: [_jsx(Share2, { size: 14 }), " ", t('Share')] }) }), _jsxs(Button, { size: "sm", variant: "primary", "aria-label": t('Publish'), disabled: !clone || !slug, onPress: () => setPublish({ repo: clone, title, ref, name: slug, project: slug, preview: project?.live || undefined }), shrink: 0, children: [_jsx(Upload, { size: 14 }), _jsx(SizableText, { size: "$2", color: "inherit", "$max-md": { display: 'none' }, children: t('Publish') })] })] }), chat: _jsxs(_Fragment, { children: [row, chat] }), dock: _jsx(Console, { lines: lines, height: dock, onHeight: setDock, onClear: () => setPageLines([]), status: run.status || end.status || undefined, label: t('Console') }), collapsed: shut, pane: pane, width: across, onLayout: (e) => setRoom(e.nativeEvent.layout.width), children: [row, preview, body] }), _jsx(Dialog, { open: history, onOpenChange: setHistory, children: _jsxs(DialogContent, { maxW: 480, children: [_jsx(DialogTitle, { children: t('Sessions on {title}', { title }) }), _jsx(YStack, { gap: "$1", children: runs.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: t('No sessions yet.') })) : (runs.value.map((r) => {
570
+ const active = r.id === current;
571
+ return (_jsxs(XStack, { render: "button", "aria-current": active ? 'true' : undefined, onPress: () => {
572
+ setChosen(r.id);
573
+ setHistory(false);
574
+ }, justify: "space-between", items: "center", gap: "$2", px: "$2.5", py: "$2", minH: 40, "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: active ? '500' : '400', numberOfLines: 1, flex: 1, children: r.title || t('Untitled session') }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, children: r.status })] }, r.id));
575
+ })) })] }) }), _jsx(Dialog, { open: switcher, onOpenChange: (o) => {
576
+ setSwitcher(o);
577
+ if (!o)
578
+ setSwitchQ('');
579
+ }, children: _jsxs(DialogContent, { maxW: 420, gap: "$3", children: [_jsx(DialogTitle, { children: t('Projects') }), repos.value.length > 6 ? (_jsx(Input, { value: switchQ, onChangeText: setSwitchQ, placeholder: t('Find a project…'), "aria-label": t('Find a project'), startAdornment: _jsx(Search, { size: 14, color: "$soft" }) })) : null, _jsx(YStack, { gap: "$1", maxH: 420, overflow: "scroll", children: repos.error ? (_jsx(SizableText, { size: "$2", color: "$soft", children: repos.error.message })) : repos.loading && repos.value.length === 0 ? (_jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading the forge…') }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" })] })) : filteredRepos.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", py: "$2", children: t('Nothing matches.') })) : (filteredRepos.map((c) => {
580
+ const here = Boolean(named) && c.name === named?.name;
581
+ return (_jsxs(XStack, { render: "button", "aria-label": t('Open {repo}', { repo: `${c.org}/${c.name}` }), "aria-current": here ? 'page' : undefined, onPress: () => {
582
+ setSwitcher(false);
583
+ setSwitchQ('');
584
+ host.go(path({ kind: 'repo', org: c.org || host.org || '', name: c.name }));
585
+ }, px: "$2.5", py: "$2", minH: 40, items: "center", justify: "space-between", gap: "$2", rounded: "$3", hoverStyle: { bg: '$hover' }, "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: c.name }), here ? _jsx(Check, { size: 14, color: "$ink" }) : null] }, `${c.org}/${c.name}`));
586
+ })) }), _jsx(Button, { variant: "outline", size: "sm", onPress: () => {
587
+ setSwitcher(false);
588
+ setSwitchQ('');
589
+ host.go(path({ kind: 'screen', screen: 'projects' }));
590
+ }, children: t('All projects') })] }) }), _jsx(Publish, { source: publish, onClose: () => setPublish(null), onLive: fresh })] }));
591
+ }
@@ -0,0 +1,4 @@
1
+ /** A markdown text, drawn. */
2
+ export declare function Prose({ text }: {
3
+ text: string;
4
+ }): import("react").JSX.Element;