@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,16 @@
1
+ export declare const RUNS_KEY = "hanzo.dev.runs.meta";
2
+ export declare const RUNS_EVENT = "hanzo:runs-meta";
3
+ /** One run's own marks; absent means none. */
4
+ export interface RunMark {
5
+ title?: string;
6
+ pinned?: boolean;
7
+ archived?: boolean;
8
+ deleted?: boolean;
9
+ }
10
+ export type RunMarks = Record<string, RunMark>;
11
+ /** Every run's marks. Storage that throws, or holds what is not a record, reads as none. */
12
+ export declare function marks(): RunMarks;
13
+ /** Mark one run: the keys in `patch` replace its own, the rest stay. Said on the window so every list redraws. */
14
+ export declare function mark(id: string, patch: RunMark): void;
15
+ /** The runs' marks, and the way to mark one; the component redraws whenever either place changes them. */
16
+ export declare function useMarks(): [RunMarks, (id: string, patch: RunMark) => void];
@@ -0,0 +1,69 @@
1
+ /**
2
+ * What a person did to a run from their own lists: pinned, archived, deleted, renamed.
3
+ *
4
+ * One store, kept in this browser, for every place that lists or opens a run: the
5
+ * sidebar's Recents (hanzoai/app) and a run's own menu here. A run archived or
6
+ * deleted from either is gone from the other at once, in this window and in any
7
+ * other tab of the browser, because both read and write the same key and say so on
8
+ * the window (`RUNS_EVENT`).
9
+ */
10
+ import { useCallback, useSyncExternalStore } from 'react';
11
+ export const RUNS_KEY = 'hanzo.dev.runs.meta';
12
+ export const RUNS_EVENT = 'hanzo:runs-meta';
13
+ const NONE = {};
14
+ /** What storage held at the last read: the same object until it changes, as a store snapshot must be. */
15
+ let held = { raw: null, marks: NONE };
16
+ /** Every run's marks. Storage that throws, or holds what is not a record, reads as none. */
17
+ export function marks() {
18
+ if (typeof window === 'undefined')
19
+ return NONE;
20
+ let raw = null;
21
+ try {
22
+ raw = window.localStorage.getItem(RUNS_KEY);
23
+ }
24
+ catch {
25
+ return held.marks;
26
+ }
27
+ if (raw === held.raw)
28
+ return held.marks;
29
+ let parsed = null;
30
+ try {
31
+ parsed = raw === null ? null : JSON.parse(raw);
32
+ }
33
+ catch {
34
+ parsed = null;
35
+ }
36
+ held = { raw, marks: parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : NONE };
37
+ return held.marks;
38
+ }
39
+ /** Mark one run: the keys in `patch` replace its own, the rest stay. Said on the window so every list redraws. */
40
+ export function mark(id, patch) {
41
+ if (typeof window === 'undefined')
42
+ return;
43
+ const next = { ...marks(), [id]: { ...marks()[id], ...patch } };
44
+ try {
45
+ window.localStorage.setItem(RUNS_KEY, JSON.stringify(next));
46
+ }
47
+ catch {
48
+ // Kept for this page only: the change still shows, until the page is left.
49
+ held = { raw: held.raw, marks: next };
50
+ }
51
+ window.dispatchEvent(new Event(RUNS_EVENT));
52
+ }
53
+ function subscribe(changed) {
54
+ const other = (e) => {
55
+ if (e.key === RUNS_KEY || e.key === null)
56
+ changed();
57
+ };
58
+ window.addEventListener(RUNS_EVENT, changed);
59
+ window.addEventListener('storage', other);
60
+ return () => {
61
+ window.removeEventListener(RUNS_EVENT, changed);
62
+ window.removeEventListener('storage', other);
63
+ };
64
+ }
65
+ /** The runs' marks, and the way to mark one; the component redraws whenever either place changes them. */
66
+ export function useMarks() {
67
+ const all = useSyncExternalStore(subscribe, marks, () => NONE);
68
+ return [all, useCallback((id, patch) => mark(id, patch), [])];
69
+ }
@@ -0,0 +1,2 @@
1
+ import type { Say } from '@hanzo/i18n/react';
2
+ export declare const english: Say;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `t` where no component is asking: the English, its `{name}` arguments filled.
3
+ * A helper that builds words outside a render (a rail's rows, a formatter)
4
+ * takes the caller's @hanzo/i18n `t` and falls back to this.
5
+ */
6
+ import { translate } from '@hanzo/i18n';
7
+ export const english = ((source, values) => translate({}, source, values));
@@ -0,0 +1,3 @@
1
+ /** Open Scheduled with a new task started from `prompt`: Dev's "Schedule this". */
2
+ export declare function schedule(prompt: string, go: (path: string) => void): void;
3
+ export declare function Scheduled(): import("react").JSX.Element;
@@ -0,0 +1,328 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Scheduled tasks: everything that runs without you watching, in one place —
4
+ * the prompts you scheduled from Chat and Dev, background runs, Studio renders
5
+ * and workflows.
6
+ *
7
+ * -/automations your tasks, then Activity: every run, across products
8
+ * -/automations/<id> one task's editor and runs (automations.tsx)
9
+ *
10
+ * Tasks are /v1/auto/automations and runs are /v1/auto/jobs (api/auto.ts), both
11
+ * the reader's own; /v1/auto/events keeps them live while the page is open, and
12
+ * a read every half minute keeps them right when the stream is down. A new task
13
+ * is said in plain words — "every Monday at 9am" — and the platform says back
14
+ * what it understood before anything is created.
15
+ *
16
+ * Its words are the reader's language (@hanzo/i18n `t`); a task's name and
17
+ * prompt, a run's title, summary and error, and what the platform says back
18
+ * are drawn as given.
19
+ */
20
+ import { SizableText, XStack, YStack } from '@hanzo/gui';
21
+ import { ChevronDown, ChevronRight, Clock, ExternalLink, MoreHorizontal, Pencil, Play, Plus, ScrollText, Trash2 } from '@hanzogui/lucide-icons-2';
22
+ import { useI18n } from '@hanzo/i18n/react';
23
+ import { Button, DropdownMenu, Input, Skeleton, Switch, Textarea, toast } from '@hanzo/ui';
24
+ import { StatusDot } from '@hanzo/ui/chat';
25
+ import { ModelPicker } from '@hanzo/ui/models';
26
+ import { useLimits } from '@hanzo/ui/product/useLimits';
27
+ import { useEffect, useMemo, useRef, useState } from 'react';
28
+ import { RING, RING_INSET } from './pane.js';
29
+ import { automations, create, cron, events, jobs, remove, save, start, words } from './api/auto.js';
30
+ import { Refusal, told } from './api/call.js';
31
+ import { ENSO, limits as readLimits, models } from './api/models.js';
32
+ import { Field, Line, Sheet } from './customize/ui.js';
33
+ import { local, PLAN, shaped, tidy, unplanned, unready, When, zone } from './automations.js';
34
+ import { runNow, switchOn } from './question.js';
35
+ import { useRead } from './data.js';
36
+ import { useHost, useTarget } from './host.js';
37
+ import { useSpend } from './spend.js';
38
+ import { about, dollars, DOTS, lasted, merged, SAID, titled } from './activity.js';
39
+ import { SOURCE } from './api/library.js';
40
+ import { Outputs } from './library.js';
41
+ import { path } from './route.js';
42
+ import { Confirm } from './ask.js';
43
+ /** Where a move into Scheduled leaves the prompt a new task should start from. */
44
+ const ASK = 'hanzo.build.scheduled.ask';
45
+ /** Open Scheduled with a new task started from `prompt`: Dev's "Schedule this". */
46
+ export function schedule(prompt, go) {
47
+ try {
48
+ sessionStorage.setItem(ASK, prompt);
49
+ }
50
+ catch {
51
+ // Without storage the sheet opens empty.
52
+ }
53
+ go(path({ kind: 'screen', screen: 'automations' }));
54
+ }
55
+ function asked() {
56
+ try {
57
+ const s = sessionStorage.getItem(ASK) ?? '';
58
+ sessionStorage.removeItem(ASK);
59
+ return s;
60
+ }
61
+ catch {
62
+ return '';
63
+ }
64
+ }
65
+ /** /v1/auto/events, followed while signed in: each job and task as it changes, again after a drop. */
66
+ function useLive(on) {
67
+ const host = useHost();
68
+ const t = useTarget();
69
+ const signed = Boolean(host.person);
70
+ const heard = useRef(on);
71
+ heard.current = on;
72
+ const [live, setLive] = useState(false);
73
+ useEffect(() => {
74
+ if (!signed)
75
+ return;
76
+ const ctl = new AbortController();
77
+ let wait = 1000;
78
+ void (async () => {
79
+ while (!ctl.signal.aborted) {
80
+ const began = Date.now();
81
+ try {
82
+ await events(t, (h) => heard.current(h.kind === 'job' ? { job: h.job } : { automation: h.automation }), ctl.signal, () => setLive(true));
83
+ // A stream that stayed open a while is the platform's; one that closed at once is waited on longer each time.
84
+ if (Date.now() - began > 5000)
85
+ wait = 1000;
86
+ }
87
+ catch (e) {
88
+ // A stream the platform does not serve here is not asked for again; the half-minute read stands in.
89
+ if (e instanceof Refusal && (e.status === 404 || e.status === 401 || e.status === 403))
90
+ return setLive(false);
91
+ }
92
+ setLive(false);
93
+ if (ctl.signal.aborted)
94
+ return;
95
+ await new Promise((r) => setTimeout(r, wait));
96
+ wait = Math.min(wait * 2, 30_000);
97
+ }
98
+ })();
99
+ return () => ctl.abort();
100
+ }, [t, signed]);
101
+ return live;
102
+ }
103
+ export function Scheduled() {
104
+ const { t } = useI18n();
105
+ const host = useHost();
106
+ const target = useTarget();
107
+ const spend = useSpend();
108
+ const signed = Boolean(host.person);
109
+ const [tick, setTick] = useState(0);
110
+ const tasks = useRead(signed ? () => automations(target) : null, [], [target, signed, tick]);
111
+ const runs = useRead(signed ? () => jobs(target, { limit: 50 }) : null, [], [target, signed, tick]);
112
+ const [shownTasks, setTasks] = useState([]);
113
+ const [shownRuns, setRuns] = useState([]);
114
+ useEffect(() => setTasks(tasks.value), [tasks.value]);
115
+ useEffect(() => setRuns(runs.value), [runs.value]);
116
+ const [problem, setProblem] = useState('');
117
+ const [problemError, setProblemError] = useState(false);
118
+ const [making, setMaking] = useState(null);
119
+ const [deleting, setDeleting] = useState(null);
120
+ const [looking, setLooking] = useState(null);
121
+ const [allActivity, setAllActivity] = useState(false);
122
+ const [now, setNow] = useState(() => Date.now());
123
+ // Dev's "Schedule this" arrives with the prompt the sheet starts from.
124
+ useEffect(() => {
125
+ const prompt = asked();
126
+ if (prompt)
127
+ setMaking(prompt);
128
+ }, []);
129
+ const live = useLive(({ job, automation }) => {
130
+ if (job) {
131
+ setRuns((was) => merged(was, job));
132
+ setLooking((was) => (was && was.id === job.id ? job : was));
133
+ }
134
+ if (automation)
135
+ setTasks((was) => (was.some((a) => a.id === automation.id) ? was.map((a) => (a.id === automation.id ? automation : a)) : [automation, ...was]));
136
+ });
137
+ // Without the stream, a read every half minute; with it, a clock for the running durations.
138
+ useEffect(() => {
139
+ if (!signed)
140
+ return;
141
+ const id = setInterval(() => (live ? setNow(Date.now()) : setTick((n) => n + 1)), live ? 1000 : 30_000);
142
+ return () => clearInterval(id);
143
+ }, [signed, live]);
144
+ const act = async (what, work) => {
145
+ setProblem('');
146
+ setProblemError(false);
147
+ try {
148
+ await work();
149
+ }
150
+ catch (e) {
151
+ setProblem(unplanned(e) ? t(PLAN) : t('{name}: {error}', { name: what, error: told(e, t) }));
152
+ setProblemError(true);
153
+ }
154
+ };
155
+ const flip = async (a, on) => {
156
+ if (on && !(await spend.ask(switchOn(a.name, t))))
157
+ return;
158
+ await act(a.name, async () => {
159
+ const next = await save(target, a.id, { enabled: on });
160
+ setTasks((was) => was.map((x) => (x.id === next.id ? next : x)));
161
+ toast.success(on ? t('{name} turned on', { name: a.name }) : t('{name} paused', { name: a.name }));
162
+ });
163
+ };
164
+ const run = async (a) => {
165
+ if (!(await spend.ask(runNow(a.name, t))))
166
+ return;
167
+ await act(a.name, async () => {
168
+ const r = await start(target, a.id);
169
+ if (r.status === 'skipped') {
170
+ setProblem(t('{name}: not started, the previous run is still going.', { name: a.name }));
171
+ setProblemError(true);
172
+ }
173
+ else {
174
+ toast.success(t('Started {name}', { name: a.name }));
175
+ }
176
+ setTick((n) => n + 1);
177
+ });
178
+ };
179
+ const edit = (id) => host.go(path({ kind: 'automation', id }));
180
+ const activityCap = 10;
181
+ const activityOverflow = shownRuns.length > activityCap;
182
+ const visibleRuns = !allActivity && activityOverflow ? shownRuns.slice(0, activityCap) : shownRuns;
183
+ return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { justify: "space-between", items: "flex-start", gap: "$4", children: [_jsxs(YStack, { gap: "$1", flex: 1, minW: 0, children: [_jsx(SizableText, { render: "h1", size: "$7", fontWeight: "600", color: "$ink", children: t('Scheduled tasks') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('What runs without you watching: prompts on a schedule, background runs, Studio renders and workflows.') })] }), _jsxs(Button, { size: "sm", shrink: 0, disabled: !signed, onPress: () => setMaking(''), children: [_jsx(Plus, { size: 14 }), t('New task')] })] }), problem ? (_jsx(SizableText, { size: "$2", color: problemError ? 'var(--state-error)' : '$soft', role: "status", children: problem })) : null, _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", color: "$ink", fontWeight: "500", children: t('Tasks') }), !signed ? (_jsx(Said, { says: t('Sign in to see your scheduled tasks.'), children: _jsx(Button, { size: "sm", onPress: () => host.signIn?.(), children: t('Sign in') }) })) : tasks.error && !shownTasks.length ? (_jsx(Said, { says: told(tasks.error, t), error: true, children: _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => setTick((n) => n + 1), children: t('Try again') }) })) : tasks.loading && !shownTasks.length ? (_jsxs(YStack, { gap: "$2.5", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading your tasks…') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", overflow: "hidden", children: [0, 1, 2].map((i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$3", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Skeleton, { layout: "block", width: 32, height: 32, rounded: "$3", shrink: 0 }), _jsxs(YStack, { flex: 1, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "42%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "58%", height: 12, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 36, height: 20, rounded: 999, shrink: 0 })] }, i))) })] })) : !shownTasks.length ? (_jsx(Said, { says: t('No scheduled tasks yet. Ask Chat or Dev to do something on a schedule, or start one here.'), children: _jsxs(Button, { size: "sm", variant: "primary", onPress: () => setMaking(''), children: [_jsx(Plus, { size: 14 }), t('New task')] }) })) : (_jsx(YStack, { role: "list", "aria-label": t('Your tasks'), borderWidth: 1, borderColor: "$borderColor", rounded: "$4", overflow: "hidden", children: shownTasks.map((a, i) => (_jsx(Task, { a: a, first: i === 0, onOpen: () => edit(a.id), onSwitch: (on) => void flip(a, on), onRun: () => void run(a), onDelete: () => setDeleting(a) }, a.id))) }))] }), signed ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", color: "$ink", fontWeight: "500", flex: 1, children: t('Activity') }), live ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(YStack, { width: 6, height: 6, rounded: 99, bg: "var(--state-online)" }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Live') })] })) : null] }), runs.error && !shownRuns.length ? (_jsx(Said, { says: told(runs.error, t), error: true, children: _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => setTick((n) => n + 1), children: t('Try again') }) })) : runs.loading && !shownRuns.length ? (_jsxs(YStack, { gap: "$2.5", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading what ran…') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", overflow: "hidden", children: [0, 1, 2, 3].map((i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2.5", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Skeleton, { layout: "block", width: 10, height: 10, rounded: 999, shrink: 0 }), _jsxs(YStack, { flex: 1, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "46%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "34%", height: 12, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 54, height: 12, rounded: "$2", shrink: 0 })] }, i))) })] })) : !shownRuns.length ? (_jsx(Said, { says: t("Nothing has run yet. A task's runs, Dev's background runs and Studio's renders show here as they go.") })) : (_jsxs(YStack, { gap: "$2", children: [_jsx(YStack, { role: "list", "aria-label": t('Activity'), borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", overflow: "hidden", children: visibleRuns.map((j, i) => (_jsx(Ran, { j: j, first: i === 0, now: now, onOpen: () => setLooking(j) }, j.id))) }), activityOverflow ? (_jsx(XStack, { children: _jsx(XStack, { render: "button", "aria-expanded": allActivity, onPress: () => setAllActivity((v) => !v), px: "$2.5", py: "$1.5", minH: 32, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$soft", children: allActivity ? t('Show fewer runs') : t('Show all {n} runs', { n: shownRuns.length }) }) }) })) : null] }))] })) : null] }), _jsx(Make, { prompt: making, onClose: () => setMaking(null), onMade: (a) => {
184
+ setTasks((was) => [a, ...was.filter((x) => x.id !== a.id)]);
185
+ setProblemError(false);
186
+ setProblem(t('Scheduled: {name}.', { name: a.name }));
187
+ } }), _jsx(Detail, { j: looking, onClose: () => setLooking(null), now: now }), spend.dialog, deleting ? (_jsx(Confirm, { title: t('Delete {name}?', { name: deleting.name }), act: t('Delete'), says: t('It stops running, and its schedule and its runs go with it. A run going now is stopped.'), open: true, onOpenChange: (o) => !o && setDeleting(null), run: async () => {
188
+ const dead = deleting;
189
+ await remove(target, dead.id);
190
+ setTasks((was) => was.filter((x) => x.id !== dead.id));
191
+ setDeleting(null);
192
+ toast.success(t('{name} deleted', { name: dead.name }));
193
+ } })) : null] }));
194
+ }
195
+ /** One task: what it is and when it runs next, its switch, and its menu. */
196
+ function Task({ a, first, onOpen, onSwitch, onRun, onDelete }) {
197
+ const { t } = useI18n();
198
+ const when = a.draft
199
+ ? t('Needs instructions')
200
+ : [words(a.schedule, t), a.enabled && a.next ? t('next {when}', { when: local(a.next) }) : a.schedule.kind !== 'manual' && !a.enabled ? t('paused') : ''].filter(Boolean).join(' · ');
201
+ return (_jsxs(XStack, { role: "listitem", items: "center", gap: "$2.5", pr: "$2.5", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { render: "button", "aria-label": t('Open {name}', { name: a.name }), onPress: onOpen, flex: 1, minW: 0, minH: 44, px: "$3", py: "$3", items: "center", gap: "$3", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING_INSET, children: [_jsx(YStack, { width: 32, height: 32, rounded: "$3", bg: "$raised", items: "center", justify: "center", shrink: 0, "aria-hidden": true, children: _jsx(Clock, { size: 16 }) }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, shrink: 1, children: a.name }), _jsx(Badge, { children: t(SOURCE[a.source]) }), a.draft ? _jsx(Badge, { children: t('Draft') }) : null] }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: when })] })] }), _jsxs(XStack, { shrink: 0, items: "center", gap: "$1.5", children: [_jsx(Switch, { checked: a.enabled, disabled: a.draft, onCheckedChange: onSwitch, "aria-label": t('{name} on', { name: a.name }) }), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": t('Actions for {name}', { name: a.name }), width: 32, height: 32, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(MoreHorizontal, { size: 16, color: "$soft" }) }), items: [
202
+ ...(a.draft ? [] : [{ key: 'run', label: t('Run now'), icon: _jsx(Play, { size: 14 }), onSelect: onRun }]),
203
+ { key: 'edit', label: t('Edit'), icon: _jsx(Pencil, { size: 14 }), onSelect: onOpen },
204
+ { type: 'separator' },
205
+ { key: 'delete', label: t('Delete'), icon: _jsx(Trash2, { size: 14 }), destructive: true, onSelect: onDelete },
206
+ ] })] })] }));
207
+ }
208
+ /** One run in Activity. */
209
+ function Ran({ j, first, now, onOpen }) {
210
+ const { t } = useI18n();
211
+ return (_jsx(XStack, { role: "listitem", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { render: "button", "aria-label": t('{title}: {state}', { title: j.title, state: t(SAID[j.state]) }), onPress: onOpen, flex: 1, minW: 0, items: "center", gap: "$3", px: "$3", py: "$2.5", cursor: "pointer", "$platform-web": { textAlign: 'start' }, children: [_jsx(StatusDot, { status: DOTS[j.state] }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: j.title }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: about(j, now, t) })] }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, fontVariant: ['tabular-nums'], children: j.state === 'running' && j.progress !== null ? `${Math.round(j.progress * 100)}%` : t(SAID[j.state]) })] }) }));
212
+ }
213
+ /** One run, opened: how it went, its log, what it made and what it cost. */
214
+ function Detail({ j, onClose, now }) {
215
+ const { t } = useI18n();
216
+ const host = useHost();
217
+ return (_jsx(Sheet, { title: j?.title ?? t('Run'), open: Boolean(j), onOpenChange: (o) => !o && onClose(), width: 520, children: j ? (_jsxs(YStack, { gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(StatusDot, { status: DOTS[j.state] }), _jsx(SizableText, { size: "$2", color: "$ink", children: j.status && j.status !== j.state ? t('{state} ({status})', { state: t(SAID[j.state]), status: j.status }) : t(SAID[j.state]) })] }), _jsx(Facts, { rows: [
218
+ [t('From'), t(SOURCE[j.product])],
219
+ [t('Started'), j.started ? local(j.started) : '—'],
220
+ [t('Took'), lasted(j.started, j.finished, now) || '—'],
221
+ [t('Cost'), j.cost !== null ? dollars(j.cost) : t('Not known yet')],
222
+ ] }), j.error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", "$platform-web": { whiteSpace: 'pre-wrap' }, children: j.error })) : null, j.summary ? (_jsx(SizableText, { size: "$2", color: "$ink", "$platform-web": { whiteSpace: 'pre-wrap' }, children: j.summary })) : null, j.outputs.length ? (_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('What it made') }), _jsx(Outputs, { ids: j.outputs })] })) : null, _jsxs(XStack, { gap: "$2", flexWrap: "wrap", rowGap: "$2", children: [j.session ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.go(j.session), children: [_jsx(ScrollText, { size: 14 }), t('Open its log')] })) : null, j.origin ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.open(j.origin), children: [_jsx(ExternalLink, { size: 14 }), t('Open where it runs')] })) : null, j.automation ? (_jsxs(Button, { size: "sm", variant: "ghost", onPress: () => host.go(path({ kind: 'automation', id: j.automation })), children: [_jsx(Pencil, { size: 14 }), t('Edit the task')] })) : null] })] })) : null }));
223
+ }
224
+ /** A new task: what it does, when in plain words, and the model it thinks with. */
225
+ function Make({ prompt, onClose, onMade }) {
226
+ const { t } = useI18n();
227
+ const host = useHost();
228
+ const target = useTarget();
229
+ const signed = Boolean(host.person);
230
+ const open = prompt !== null;
231
+ const [name, setName] = useState('');
232
+ const [asks, setAsks] = useState('');
233
+ const [said, setSaid] = useState('');
234
+ const [read, setRead] = useState(null);
235
+ const [reading, setReading] = useState(false);
236
+ // Why the platform could not read the words: its refusal, said when drawn.
237
+ const [unread, setUnread] = useState(null);
238
+ const [picking, setPicking] = useState(false);
239
+ const [picked, setPicked] = useState(() => shaped('daily', { kind: 'manual' }));
240
+ const [model, setModel] = useState(null);
241
+ const [advanced, setAdvanced] = useState(false);
242
+ const [busy, setBusy] = useState(false);
243
+ const [note, setNote] = useState('');
244
+ const spend = useSpend();
245
+ const catalog = useRead(signed && open ? () => models(target) : null, [], [target, signed, open]);
246
+ const { limits } = useLimits(signed && open ? (signal) => readLimits(target, signal) : null, target);
247
+ // Each opening starts from what it was handed.
248
+ useEffect(() => {
249
+ if (prompt === null)
250
+ return;
251
+ setAsks(prompt);
252
+ setName(titled(prompt));
253
+ setSaid('');
254
+ setRead(null);
255
+ setUnread(null);
256
+ setPicking(false);
257
+ setAdvanced(false);
258
+ setNote('');
259
+ }, [prompt]);
260
+ // The words are read once the typing settles; the answer is said back before anything is made.
261
+ useEffect(() => {
262
+ const text = said.trim();
263
+ if (!open || !text || picking) {
264
+ setRead(null);
265
+ setUnread(null);
266
+ return;
267
+ }
268
+ const ctl = new AbortController();
269
+ const id = setTimeout(() => {
270
+ setReading(true);
271
+ cron(target, text, zone(), { signal: ctl.signal })
272
+ .then((p) => {
273
+ setRead(p);
274
+ setUnread(null);
275
+ })
276
+ .catch((e) => {
277
+ if (ctl.signal.aborted)
278
+ return;
279
+ setRead(null);
280
+ setUnread(e);
281
+ })
282
+ .finally(() => !ctl.signal.aborted && setReading(false));
283
+ }, 450);
284
+ return () => {
285
+ clearTimeout(id);
286
+ ctl.abort();
287
+ };
288
+ }, [said, open, picking, target]);
289
+ const when = picking ? picked : (read?.schedule ?? null);
290
+ const wrong = when ? t(unready(when)) : '';
291
+ const make = async () => {
292
+ if (!name.trim())
293
+ return setNote(t('Name it first.'));
294
+ if (!asks.trim())
295
+ return setNote(t('Say what it should do.'));
296
+ if (!when)
297
+ return setNote(said.trim() ? t('Say when in other words, or choose instead.') : t('Say when it runs.'));
298
+ if (wrong)
299
+ return setNote(wrong);
300
+ // It is made on, to run and spend by itself: asked first, as switching one on is.
301
+ if (!(await spend.ask(switchOn(name.trim(), t))))
302
+ return;
303
+ setBusy(true);
304
+ setNote('');
305
+ try {
306
+ const d = { name: name.trim(), instructions: asks.trim(), model, schedule: when, permissions: 'ask', notify: true, postTo: [], enabled: true, source: 'dev' };
307
+ onMade(await create(target, tidy(d)));
308
+ onClose();
309
+ }
310
+ catch (e) {
311
+ setNote(unplanned(e) ? t(PLAN) : told(e, t));
312
+ }
313
+ finally {
314
+ setBusy(false);
315
+ }
316
+ };
317
+ const heard = useMemo(() => (read ? [read.says || words(read.schedule, t), read.next ? t('next {when}', { when: local(read.next) }) : ''].filter(Boolean).join(' · ') : ''), [read, t]);
318
+ return (_jsxs(Sheet, { title: t('New task'), open: open, onOpenChange: (o) => !o && !busy && onClose(), width: 560, children: [spend.dialog, _jsxs(YStack, { gap: "$4", children: [_jsx(Field, { label: t('Name'), children: _jsx(Input, { value: name, onChangeText: setName, placeholder: t('Monday summary'), "aria-label": t('Task name') }) }), _jsx(Field, { label: t('What it does'), hint: t('Each run is one Dev run in this organization, as you. It reads and proposes; it changes nothing on its own.'), children: _jsx(Textarea, { value: asks, onChangeText: setAsks, placeholder: t('Summarize what changed in my repositories this week, and what needs me.'), "aria-label": t('What it does'), rows: 5 }) }), _jsx(Field, { label: t('When'), hint: picking ? undefined : t('In your own words: every weekday at 8am, every 5 minutes, first of the month.'), children: picking ? (_jsxs(YStack, { gap: "$2", children: [_jsx(When, { s: picked, onChange: setPicked }), _jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setPicking(false), children: t('Say it instead') }) })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsx(Input, { value: said, onChangeText: setSaid, placeholder: t('Every Monday at 9am'), "aria-label": t('When it runs') }), _jsx(SizableText, { size: "$1", color: unread ? '$soft' : '$ink', role: "status", minH: 18, children: reading ? t('Reading…') : unread ? `${told(unread, t)} ${t('Choose instead, or say it another way.')}` : heard }), _jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setPicking(true), children: t('Choose instead') }) })] })) }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": advanced, onPress: () => setAdvanced((v) => !v), items: "center", gap: "$1.5", self: "flex-start", px: "$2", ml: "$-2", minH: 32, focusVisibleStyle: RING, children: [advanced ? _jsx(ChevronDown, { size: 14, color: "$soft" }) : _jsx(ChevronRight, { size: 14, color: "$soft" }), _jsx(SizableText, { size: "$2", color: "$soft", children: model ? t('Model · {name}', { name: catalog.value.find((m) => m.id === model)?.name ?? model }) : t('Advanced options') })] }), advanced ? (_jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: _jsx(Field, { label: t('Model'), children: _jsx(XStack, { children: _jsx(ModelPicker, { size: "sm", name: t('Model'), models: catalog.value, scope: "chat", limits: limits, value: model ?? ENSO, onChange: (id) => setModel(id === ENSO ? null : id), loading: catalog.loading, error: catalog.error ? told(catalog.error, t) : null }) }) }) })) : null] }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "ghost", disabled: busy, onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: busy || !signed, onPress: () => void make(), children: busy ? t('Creating…') : t('Create') })] })] })] }));
319
+ }
320
+ function Badge({ children }) {
321
+ return (_jsx(SizableText, { size: "$1", color: "$soft", px: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: children }));
322
+ }
323
+ function Facts({ rows }) {
324
+ return (_jsx(YStack, { gap: "$1", children: rows.map(([k, v]) => (_jsxs(XStack, { gap: "$3", children: [_jsx(SizableText, { size: "$1", color: "$soft", width: 72, children: k }), _jsx(SizableText, { size: "$1", color: "$ink", flex: 1, children: v })] }, k))) }));
325
+ }
326
+ function Said({ says, error = false, children }) {
327
+ return (_jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", rounded: "$4", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: error ? 'var(--state-error)' : '$soft', text: "center", children: says }), children] }));
328
+ }
@@ -0,0 +1,27 @@
1
+ import { type SessionStatus } from '@hanzo/ui/chat';
2
+ import { type ReactNode } from 'react';
3
+ import type { Session } from './api/sessions.ts';
4
+ import { type Read } from './data.ts';
5
+ import type { Host } from './host.tsx';
6
+ /** A run's status, as the rail's dot draws it. Anything else is idle. */
7
+ export declare const DOTS: Record<string, SessionStatus>;
8
+ /**
9
+ * The dot a row draws. A conversation rests paused between turns (api/talk.ts):
10
+ * it has answered and waits for the person, which reads as done, not as a run held.
11
+ */
12
+ export declare const dot: (s: Pick<Session, 'status' | 'channel' | 'parent'>) => SessionStatus;
13
+ /** The org's coding runs, newest first, kept live by the org's feed. */
14
+ export declare function useSessions(host: Host): Read<Session[]>;
15
+ /**
16
+ * The builder's places, grouped as every rail groups them (nav.tsx), then the
17
+ * runs. `children` sit between the places and the runs — where a host lists its
18
+ * own. `onPick` fires after a move, so a host that draws its rail as a drawer
19
+ * on a phone can close it.
20
+ */
21
+ export declare function DevSection({ host, onPick, label, children, }: {
22
+ host: Host;
23
+ onPick?: () => void;
24
+ /** The runs' heading; absent, "Runs" in the reader's language. */
25
+ label?: string;
26
+ children?: ReactNode;
27
+ }): import("react").JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * The builder's places and runs, for a host that draws its own rail.
4
+ *
5
+ * A host that mounts `<Builder rail={false}>` keeps ONE left column — its own —
6
+ * and lists the builder in it with these. `useSessions` is the same read and
7
+ * the same org-wide feed the built-in rail uses, so a run started in the pane
8
+ * appears here with its live status. `DevSection` draws the builder's places
9
+ * and runs as rows of the host's sidebar (the `@hanzo/ui/chat` Sidebar the
10
+ * built-in rail is made of), and every row moves the builder through the
11
+ * host's own `go`.
12
+ */
13
+ import { SizableText } from '@hanzo/gui';
14
+ import { useI18n } from '@hanzo/i18n/react';
15
+ import { SidebarItem, SidebarSection, StatusDot } from '@hanzo/ui/chat';
16
+ import { useMemo } from 'react';
17
+ import { talks } from './api/talk.js';
18
+ import { useRecents } from './data.js';
19
+ import { nav } from './nav.js';
20
+ import { route } from './route.js';
21
+ /** A run's status, as the rail's dot draws it. Anything else is idle. */
22
+ export const DOTS = {
23
+ running: 'running',
24
+ paused: 'paused',
25
+ done: 'done',
26
+ stopped: 'stopped',
27
+ error: 'error',
28
+ };
29
+ /**
30
+ * The dot a row draws. A conversation rests paused between turns (api/talk.ts):
31
+ * it has answered and waits for the person, which reads as done, not as a run held.
32
+ */
33
+ export const dot = (s) => talks(s) && s.status === 'paused' ? 'done' : (DOTS[s.status] ?? 'idle');
34
+ /** The org's coding runs, newest first, kept live by the org's feed. */
35
+ export function useSessions(host) {
36
+ const t = useMemo(() => ({ api: host.api, token: host.token, org: host.org }), [host.api, host.token, host.org]);
37
+ return useRecents(t, Boolean(host.person));
38
+ }
39
+ const Note = ({ children }) => (_jsx(SizableText, { size: "$1", color: "$soft", px: "$2", py: "$1", children: children }));
40
+ /**
41
+ * The builder's places, grouped as every rail groups them (nav.tsx), then the
42
+ * runs. `children` sit between the places and the runs — where a host lists its
43
+ * own. `onPick` fires after a move, so a host that draws its rail as a drawer
44
+ * on a phone can close it.
45
+ */
46
+ export function DevSection({ host, onPick, label, children, }) {
47
+ const { t } = useI18n();
48
+ const sessions = useSessions(host);
49
+ const r = route(host.path);
50
+ // Every row, a place or a run, closes a drawer behind it.
51
+ const then = (press) => () => {
52
+ press?.();
53
+ onPick?.();
54
+ };
55
+ return (_jsxs(_Fragment, { children: [nav(host, host.go, t).map((g) => (_jsx(SidebarSection, { label: g.label, children: g.links.map((l) => (_jsx(SidebarItem, { icon: l.icon, active: l.active, onPress: then(l.onPress), children: l.label }, l.id))) }, g.id))), children, _jsx(SidebarSection, { label: label ?? t('Sessions'), children: !host.person ? (_jsx(Note, { children: t('Sign in to see your sessions.') })) : sessions.value.length ? (sessions.value.map((s) => (_jsx(SidebarItem, { icon: _jsx(StatusDot, { status: dot(s) }), active: r.kind === 'run' && r.id === s.id, onPress: then(() => host.go(s.id)), children: s.title || t('Untitled session') }, s.id)))) : (_jsx(Note, { children: sessions.error
56
+ ? t(sessions.error.message)
57
+ : sessions.loading
58
+ ? t('Reading…')
59
+ : `${t('No sessions yet.')} ${t('Say what to build and it lands here.')}` })) })] }));
60
+ }
@@ -0,0 +1 @@
1
+ export declare function Account(): import("react").JSX.Element;