moi-computer 0.11.0 → 0.11.1-dev.1c52199

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 (405) hide show
  1. package/README.md +2 -2
  2. package/client/AGENTS.md +2 -2
  3. package/client/api/app-config.ts +2 -1
  4. package/client/app/AppRouter.tsx +2 -2
  5. package/client/app/routes/WorkspaceRoute.tsx +33 -27
  6. package/client/app/shell/SidebarLayout.tsx +18 -15
  7. package/client/components/shared/BottomPanel.tsx +26 -14
  8. package/client/components/shared/PanelHeader.tsx +1 -1
  9. package/client/components/shared/ReorderableList.tsx +7 -2
  10. package/client/components/shared/WorkspaceIcon.tsx +92 -0
  11. package/client/components/ui/alert-dialog.tsx +1 -0
  12. package/client/components/ui/button.tsx +1 -53
  13. package/client/components/ui/checkbox.tsx +1 -0
  14. package/client/components/ui/collapsible.tsx +1 -15
  15. package/client/components/ui/dialog.tsx +1 -58
  16. package/client/components/ui/dropdown-menu.tsx +1 -254
  17. package/client/components/ui/hover-card.tsx +1 -44
  18. package/client/components/ui/inline-input.tsx +84 -0
  19. package/client/components/ui/input.tsx +1 -21
  20. package/client/components/ui/popover.tsx +1 -88
  21. package/client/components/ui/resizable.tsx +1 -40
  22. package/client/components/ui/skeleton.tsx +1 -13
  23. package/client/components/ui/slider.tsx +1 -70
  24. package/client/components/ui/spinner.tsx +1 -18
  25. package/client/components/ui/switch.tsx +1 -23
  26. package/client/components/ui/tabs.tsx +1 -0
  27. package/client/components/ui/textarea.tsx +1 -18
  28. package/client/components/ui/toast.tsx +2 -2
  29. package/client/components/ui/tooltip.tsx +1 -51
  30. package/client/features/applets/AppletMount.tsx +5 -2
  31. package/client/features/applets/applet-cache.ts +3 -3
  32. package/client/features/applets/applet-runtime.ts +158 -108
  33. package/client/features/applets/applet-styles.ts +2 -2
  34. package/client/features/applets/applet-thumbnail.ts +6 -8
  35. package/client/features/applets/useApplet.ts +10 -9
  36. package/client/features/chat/ChatPanel.tsx +24 -15
  37. package/client/features/chat/ChatPopup.tsx +9 -5
  38. package/client/features/chat/applet-chat-intents.ts +179 -0
  39. package/client/features/chat/chat-send.ts +116 -64
  40. package/client/features/chat/chat-store.ts +51 -62
  41. package/client/features/chat/composer/ChatComposer.tsx +43 -128
  42. package/client/features/chat/composer/ModelPicker.tsx +47 -60
  43. package/client/features/chat/composer/attachments/AttachmentChip.tsx +99 -0
  44. package/client/features/chat/composer/attachments/DrawingAttachmentChip.tsx +37 -0
  45. package/client/features/chat/composer/attachments/FileAttachmentChip.tsx +22 -0
  46. package/client/features/chat/composer/attachments/TextAttachmentChip.tsx +11 -0
  47. package/client/features/chat/composer/attachments/draft-attachments.ts +168 -0
  48. package/client/features/chat/composer/attachments/types.ts +25 -0
  49. package/client/features/chat/composer/attachments/uploads.ts +26 -0
  50. package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
  51. package/client/features/chat/composer/model-order.ts +15 -0
  52. package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
  53. package/client/features/chat/{chat-connection.ts → connection/chat-connection.ts} +1 -1
  54. package/client/features/chat/{chat-frames.ts → connection/chat-frames.ts} +10 -8
  55. package/client/features/chat/{ChatEmptyState.tsx → messages/ChatEmptyState.tsx} +16 -11
  56. package/client/features/chat/{MarkdownContent.tsx → messages/MarkdownContent.tsx} +16 -1
  57. package/client/features/chat/{TurnView.tsx → messages/TurnView.tsx} +27 -19
  58. package/client/features/chat/{group-turns.ts → messages/group-turns.ts} +12 -0
  59. package/client/features/chat/{interleave-notices.ts → messages/interleave-notices.ts} +7 -11
  60. package/client/features/chat/{tool-group → messages/tool-group}/SubagentCard.tsx +1 -1
  61. package/client/features/chat/{tool-group → messages/tool-group}/TimelineRow.tsx +2 -2
  62. package/client/features/chat/{tool-group → messages/tool-group}/ToolCallGroup.tsx +2 -5
  63. package/client/features/chat/{tool-group → messages/tool-group}/format/codex.ts +4 -1
  64. package/client/features/chat/{ChatSelector.tsx → sessions/ChatSelector.tsx} +3 -3
  65. package/client/features/chat/{api.ts → sessions/api.ts} +5 -14
  66. package/client/features/chat/sessions/session-view.ts +53 -0
  67. package/client/features/chat/{useSelectedSession.ts → sessions/useSelectedSession.ts} +64 -20
  68. package/client/features/chat/useChat.ts +46 -24
  69. package/client/features/collab/DevCollabIdentity.tsx +170 -0
  70. package/client/features/collab/DevCollabKit.tsx +501 -0
  71. package/client/features/collab/DevCollabPage.tsx +25 -0
  72. package/client/features/collab/WorkspaceCollabControls.tsx +313 -0
  73. package/client/features/collab/client.ts +146 -0
  74. package/client/features/collab/components.tsx +307 -0
  75. package/client/features/collab/dev-persona.ts +66 -0
  76. package/client/features/collab/engine.ts +96 -0
  77. package/client/features/collab/entry.tsx +35 -0
  78. package/client/features/collab/facehash-avatar.ts +132 -0
  79. package/client/features/collab/fake-engine.ts +130 -0
  80. package/client/features/collab/hooks.tsx +253 -0
  81. package/client/features/collab/identity.ts +305 -0
  82. package/client/features/collab/index.ts +45 -0
  83. package/client/features/collab/people.ts +102 -0
  84. package/client/features/collab/personal-state.ts +61 -0
  85. package/client/features/collab/presence-publisher.ts +29 -0
  86. package/client/features/collab/presence-target.ts +10 -0
  87. package/client/features/collab/primitives.tsx +398 -0
  88. package/client/features/collab/proxy-identity.ts +24 -0
  89. package/client/features/collab/store.ts +156 -0
  90. package/client/features/dev/ChatStatesPage.tsx +8 -7
  91. package/client/features/dev/DevIndexPage.tsx +10 -0
  92. package/client/features/dev/DevRoutes.tsx +16 -1
  93. package/client/features/dev/HarnessDebugPage.tsx +11 -8
  94. package/client/features/dev/ToolCallsPage.tsx +1 -1
  95. package/client/features/dev/UiComponentPreviews.tsx +855 -0
  96. package/client/features/dev/UiComponentsPage.tsx +60 -0
  97. package/client/features/dev/chat-states-fixtures.ts +13 -2
  98. package/client/features/drawings/useChatAnnotation.ts +17 -17
  99. package/client/features/drawings/useDrawingLayer.ts +7 -9
  100. package/client/features/drawings/useViewBuilderSketch.ts +18 -15
  101. package/client/features/home/HomePage.tsx +8 -7
  102. package/client/features/home/WorkspacePreview.tsx +2 -2
  103. package/client/features/home/workspace-presentation.tsx +1 -11
  104. package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
  105. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
  106. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +2 -4
  107. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
  108. package/client/features/overview/HiddenPanel.tsx +109 -0
  109. package/client/features/overview/Overview.tsx +302 -0
  110. package/client/features/overview/WidgetCanvas.tsx +164 -0
  111. package/client/features/{widgets → overview}/WidgetFrame.tsx +25 -17
  112. package/client/features/overview/WorkspaceName.tsx +60 -0
  113. package/client/features/overview/api.ts +30 -0
  114. package/client/features/overview/default/ViewsWidget.tsx +252 -0
  115. package/client/features/overview/default/registry.tsx +36 -0
  116. package/client/features/{widgets → overview}/grid.ts +36 -0
  117. package/client/features/overview/useGridReconcile.ts +94 -0
  118. package/client/features/scratchpad/Scratchpad.tsx +7 -8
  119. package/client/features/scratchpad/ScratchpadControls.tsx +0 -1
  120. package/client/features/scratchpad/useScratchpadSnapshot.tsx +23 -13
  121. package/client/features/settings/GeneralSettings.tsx +55 -58
  122. package/client/features/settings/SettingsLayout.tsx +2 -2
  123. package/client/features/settings/WorkspaceIconPicker.tsx +318 -0
  124. package/client/features/settings/WorkspaceSettingsDialog.tsx +65 -0
  125. package/client/features/settings/api.ts +48 -24
  126. package/client/features/views/ViewBuilder.tsx +5 -4
  127. package/client/features/views/ViewManager.tsx +28 -22
  128. package/client/features/views/api.ts +36 -2
  129. package/client/features/views/useViewBuilderActions.ts +11 -5
  130. package/client/features/views/useViewBuilderDrafts.ts +23 -21
  131. package/client/features/views/view-presentation.ts +13 -0
  132. package/client/features/workspace/{CustomizePanel.tsx → ThemePanel.tsx} +26 -31
  133. package/client/features/workspace/UnavailablePage.tsx +21 -0
  134. package/client/features/workspace/WorkspaceLayoutContext.tsx +22 -10
  135. package/client/features/workspace/WorkspaceScreen.tsx +228 -172
  136. package/client/features/workspace/WorkspaceSplitLayout.tsx +7 -2
  137. package/client/features/workspace/WorkspaceTabs.tsx +2 -0
  138. package/client/features/workspace/api.ts +5 -31
  139. package/client/features/workspace/layout-save.ts +13 -0
  140. package/client/features/workspace/moi-context.ts +15 -11
  141. package/client/features/workspace/tab-resolution.ts +10 -33
  142. package/client/features/workspace/useWorkspaceNavigation.ts +173 -101
  143. package/client/index.css +23 -30
  144. package/client/index.tsx +4 -3
  145. package/client/lib/app-icon-registry.ts +2 -0
  146. package/client/lib/use-latest-ref.ts +11 -0
  147. package/client/main.tsx +1 -1
  148. package/client/runtime/useWorkspaceEvents.ts +59 -14
  149. package/client/theme.css +5 -5
  150. package/dist/chunk-1ftessc8.js +2 -0
  151. package/dist/chunk-3802vh2p.js +2 -0
  152. package/dist/chunk-542a2m9m.js +1 -0
  153. package/dist/chunk-5745d83v.js +2 -0
  154. package/dist/chunk-5zxdsjym.js +1 -0
  155. package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
  156. package/dist/chunk-7r4z77ry.js +2 -0
  157. package/dist/chunk-9cm0wjah.js +79 -0
  158. package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
  159. package/dist/chunk-cvgdm1hq.js +2 -0
  160. package/dist/chunk-gptm4jpd.js +546 -0
  161. package/dist/chunk-nf2wkvf9.js +14 -0
  162. package/dist/chunk-wnmf38ta.js +5 -0
  163. package/dist/chunk-xaehhr1j.css +1 -0
  164. package/dist/chunk-xpt063fx.js +1 -0
  165. package/dist/index.html +1 -1
  166. package/lib/app-icons.ts +1 -0
  167. package/lib/applet-selector.ts +24 -0
  168. package/lib/chat-title.ts +6 -1
  169. package/lib/collab/colors.ts +24 -0
  170. package/lib/collab/protocol.ts +83 -0
  171. package/lib/collab/types.ts +63 -0
  172. package/lib/default-widgets.ts +32 -0
  173. package/lib/experimental.ts +14 -0
  174. package/lib/format.ts +67 -7
  175. package/lib/message-attachments.ts +40 -0
  176. package/lib/moi-attachments.ts +204 -0
  177. package/lib/moi-context.ts +27 -35
  178. package/lib/navigation.ts +84 -0
  179. package/lib/themes.ts +6 -6
  180. package/lib/types.ts +103 -40
  181. package/lib/workspace-icon.ts +20 -0
  182. package/lib/workspace-layout.ts +22 -2
  183. package/lib/workspace-tabs.ts +9 -33
  184. package/package.json +44 -32
  185. package/registry.json +656 -0
  186. package/server/AGENTS.md +2 -0
  187. package/server/agent.ts +1 -1
  188. package/server/api.ts +162 -68
  189. package/server/app-config.ts +127 -34
  190. package/server/applet-typecheck.ts +100 -0
  191. package/server/applets/applet-css.ts +55 -0
  192. package/server/{bundler → applets}/build-applet.ts +21 -240
  193. package/server/applets/build-worker.ts +178 -0
  194. package/server/applets/config.ts +226 -0
  195. package/server/applets/dependencies.ts +206 -0
  196. package/server/{applets.ts → applets/index.ts} +44 -189
  197. package/server/applets/runtime/base.ts +4 -0
  198. package/server/applets/runtime/moi.ts +42 -0
  199. package/server/applets/runtime/rpc.ts +17 -0
  200. package/server/applets/view-source.ts +67 -0
  201. package/server/attachment-message.ts +95 -0
  202. package/server/chat-selection.ts +23 -0
  203. package/server/cli-ui-components.ts +28 -33
  204. package/server/cli.ts +226 -120
  205. package/server/collab/applet-module.ts +50 -0
  206. package/server/collab/cloudflare-access.ts +77 -0
  207. package/server/collab/config.ts +18 -0
  208. package/server/collab/ipc.ts +10 -0
  209. package/server/collab/manager.ts +407 -0
  210. package/server/collab/service.ts +137 -0
  211. package/server/collab/skill/collab-env.d.ts +92 -0
  212. package/server/collab/skill/index.ts +59 -0
  213. package/server/collab/worker.ts +52 -0
  214. package/server/control.ts +63 -42
  215. package/server/data-dir.ts +1 -1
  216. package/server/harness/README.md +45 -50
  217. package/server/harness/acp/NOTES.md +426 -0
  218. package/server/harness/acp/adapter.ts +7 -21
  219. package/server/harness/acp/discovery.ts +27 -30
  220. package/server/harness/acp/model-state.ts +57 -0
  221. package/server/harness/acp/session.ts +49 -56
  222. package/server/harness/claude-code/NOTES.md +54 -13
  223. package/server/harness/claude-code/adapter.ts +8 -25
  224. package/server/harness/claude-code/cli.ts +40 -0
  225. package/server/harness/claude-code/index.ts +13 -5
  226. package/server/harness/claude-code/models.ts +72 -19
  227. package/server/harness/claude-code/session.ts +447 -343
  228. package/server/harness/claude-code/sessions.ts +9 -4
  229. package/server/harness/codex/NOTES.md +222 -350
  230. package/server/harness/codex/adapter.ts +102 -52
  231. package/server/harness/codex/auth.ts +1 -3
  232. package/server/harness/codex/client.ts +169 -249
  233. package/server/harness/codex/discovery.ts +9 -17
  234. package/server/harness/codex/index.ts +3 -1
  235. package/server/harness/codex/pagination.ts +24 -0
  236. package/server/harness/codex/permissions.ts +32 -8
  237. package/server/harness/codex/probe.ts +10 -13
  238. package/server/harness/codex/session.ts +567 -181
  239. package/server/harness/codex/transport.ts +184 -0
  240. package/server/harness/debug.ts +1 -1
  241. package/server/harness/hermes/NOTES.md +19 -1
  242. package/server/harness/hermes/discovery.ts +20 -0
  243. package/server/harness/hermes/index.ts +13 -0
  244. package/server/harness/hermes/models.ts +28 -8
  245. package/server/harness/openclaw/NOTES.md +1 -1
  246. package/server/harness/openclaw/adapter.ts +22 -4
  247. package/server/harness/openclaw/gateway.ts +5 -3
  248. package/server/harness/openclaw/session.ts +27 -27
  249. package/server/harness/types.ts +9 -5
  250. package/server/layout.ts +24 -16
  251. package/server/moi-scaffold.ts +22 -14
  252. package/server/navigation-relay.ts +110 -0
  253. package/server/preview.ts +3 -1
  254. package/server/registry.ts +71 -41
  255. package/server/scratchpad-executor.ts +79 -56
  256. package/server/scratchpad-shape-defaults.ts +82 -0
  257. package/server/selected-session.ts +24 -4
  258. package/server/skill-update.ts +5 -3
  259. package/server/skill-version.ts +4 -7
  260. package/server/skills-template.ts +60 -9
  261. package/server/tabs.ts +19 -33
  262. package/server/tldraw-package.d.ts +4 -0
  263. package/server/ui-components.ts +101 -434
  264. package/server/uploads.ts +0 -0
  265. package/server/view-builders.ts +20 -2
  266. package/server/views.ts +126 -6
  267. package/server/web.ts +108 -30
  268. package/server/widgets.ts +12 -5
  269. package/server/workspace-config.ts +13 -9
  270. package/server/workspace-env.ts +3 -2
  271. package/tsconfig.json +0 -1
  272. package/ui-components/accordion.tsx +71 -0
  273. package/ui-components/alert-dialog.tsx +165 -0
  274. package/ui-components/alert.tsx +68 -0
  275. package/ui-components/attachment.tsx +195 -0
  276. package/ui-components/avatar.tsx +91 -0
  277. package/ui-components/badge.tsx +49 -0
  278. package/ui-components/button-group.tsx +78 -0
  279. package/ui-components/button.tsx +55 -0
  280. package/ui-components/calendar.tsx +180 -0
  281. package/ui-components/card.tsx +84 -0
  282. package/ui-components/carousel.tsx +235 -0
  283. package/ui-components/chart.tsx +338 -0
  284. package/ui-components/checkbox.tsx +28 -0
  285. package/ui-components/collapsible.tsx +15 -0
  286. package/ui-components/combobox.tsx +267 -0
  287. package/ui-components/context-menu.tsx +244 -0
  288. package/ui-components/dialog.tsx +138 -0
  289. package/ui-components/docs/accordion.md +463 -0
  290. package/ui-components/docs/alert-dialog.md +481 -0
  291. package/ui-components/docs/alert.md +301 -0
  292. package/ui-components/docs/attachment.md +689 -0
  293. package/ui-components/docs/avatar.md +495 -0
  294. package/ui-components/docs/badge.md +258 -0
  295. package/ui-components/docs/button-group.md +879 -0
  296. package/ui-components/docs/button.md +26 -0
  297. package/ui-components/docs/calendar.md +862 -0
  298. package/ui-components/docs/card.md +265 -0
  299. package/ui-components/docs/carousel.md +627 -0
  300. package/ui-components/docs/chart.md +1256 -0
  301. package/ui-components/docs/checkbox.md +477 -0
  302. package/ui-components/docs/collapsible.md +446 -0
  303. package/ui-components/docs/combobox.md +1003 -0
  304. package/ui-components/docs/context-menu.md +860 -0
  305. package/ui-components/docs/data-table.md +1580 -0
  306. package/ui-components/docs/date-picker.md +614 -0
  307. package/ui-components/docs/dialog.md +414 -0
  308. package/ui-components/docs/drawer.md +51 -0
  309. package/ui-components/docs/dropdown-menu.md +1000 -0
  310. package/ui-components/docs/field.md +1192 -0
  311. package/ui-components/docs/hover-card.md +275 -0
  312. package/ui-components/docs/input-group.md +866 -0
  313. package/ui-components/docs/input.md +456 -0
  314. package/ui-components/docs/kbd.md +191 -0
  315. package/ui-components/docs/label.md +295 -0
  316. package/ui-components/docs/pagination.md +416 -0
  317. package/ui-components/docs/popover.md +348 -0
  318. package/ui-components/docs/progress.md +214 -0
  319. package/ui-components/docs/radio-group.md +389 -0
  320. package/ui-components/docs/resizable.md +265 -0
  321. package/ui-components/docs/select.md +616 -0
  322. package/ui-components/docs/separator.md +216 -0
  323. package/ui-components/docs/skeleton.md +205 -0
  324. package/ui-components/docs/slider.md +226 -0
  325. package/ui-components/docs/spinner.md +332 -0
  326. package/ui-components/docs/switch.md +236 -0
  327. package/ui-components/docs/table.md +551 -0
  328. package/ui-components/docs/tabs.md +379 -0
  329. package/ui-components/docs/textarea.md +187 -0
  330. package/ui-components/docs/toggle-group.md +370 -0
  331. package/ui-components/docs/toggle.md +91 -0
  332. package/ui-components/docs/tooltip.md +290 -0
  333. package/ui-components/drawer.tsx +213 -0
  334. package/ui-components/dropdown-menu.tsx +263 -0
  335. package/ui-components/field.tsx +224 -0
  336. package/ui-components/hover-card.tsx +46 -0
  337. package/ui-components/input-group.tsx +146 -0
  338. package/ui-components/input.tsx +20 -0
  339. package/ui-components/kbd.tsx +32 -0
  340. package/ui-components/label.tsx +17 -0
  341. package/ui-components/pagination.tsx +124 -0
  342. package/ui-components/popover.tsx +81 -0
  343. package/ui-components/progress.tsx +63 -0
  344. package/ui-components/radio-group.tsx +38 -0
  345. package/ui-components/resizable.tsx +40 -0
  346. package/ui-components/scoped-portal.tsx +31 -0
  347. package/ui-components/select.tsx +195 -0
  348. package/ui-components/separator.tsx +18 -0
  349. package/ui-components/skeleton.tsx +15 -0
  350. package/ui-components/slider.tsx +75 -0
  351. package/ui-components/spinner.tsx +20 -0
  352. package/ui-components/switch.tsx +27 -0
  353. package/ui-components/table.tsx +86 -0
  354. package/ui-components/tabs.tsx +75 -0
  355. package/ui-components/textarea.tsx +17 -0
  356. package/ui-components/toggle-group.tsx +85 -0
  357. package/ui-components/toggle.tsx +42 -0
  358. package/ui-components/tooltip.tsx +61 -0
  359. package/ui-components/utils.ts +8 -0
  360. package/workspace/.claude/skills/moi-workspace/SKILL.md +295 -248
  361. package/workspace/.claude/skills/moi-workspace/references/COLLABORATIVE.md +151 -0
  362. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +100 -152
  363. package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +156 -0
  364. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
  365. package/client/features/chat/attachment-staging.ts +0 -153
  366. package/client/features/chat/uploads.ts +0 -18
  367. package/client/features/chat/useAppletChatMessage.ts +0 -68
  368. package/client/features/settings/IconPicker.tsx +0 -442
  369. package/client/features/settings/WorkspaceSettings.tsx +0 -92
  370. package/client/features/settings/render-icon.ts +0 -173
  371. package/client/features/widgets/HiddenPanel.tsx +0 -80
  372. package/client/features/widgets/WidgetGrid.tsx +0 -123
  373. package/client/features/widgets/Widgets.tsx +0 -264
  374. package/client/features/widgets/useGridReconcile.ts +0 -73
  375. package/dist/chunk-104m57qw.js +0 -2
  376. package/dist/chunk-59zf0m6n.js +0 -1
  377. package/dist/chunk-bj3akjs2.js +0 -1
  378. package/dist/chunk-c9pjqx9m.js +0 -14
  379. package/dist/chunk-j2w2vak4.js +0 -546
  380. package/dist/chunk-k2r9c95m.js +0 -10
  381. package/dist/chunk-kmbxhgwv.js +0 -1
  382. package/dist/chunk-p1yqa71k.js +0 -83
  383. package/dist/chunk-pcnahct1.js +0 -5
  384. package/dist/chunk-r5xrenjy.css +0 -1
  385. package/dist/chunk-tny85yt2.js +0 -2
  386. package/dist/chunk-v7wr1df4.js +0 -2
  387. package/server/bundler/applet-css.ts +0 -155
  388. /package/client/features/chat/{ChatPromptBubbles.tsx → messages/ChatPromptBubbles.tsx} +0 -0
  389. /package/client/features/chat/{ShimmerText.tsx → messages/ShimmerText.tsx} +0 -0
  390. /package/client/features/chat/{preview-turn.ts → messages/preview-turn.ts} +0 -0
  391. /package/client/features/chat/{tool-group → messages/tool-group}/CodeBlock.tsx +0 -0
  392. /package/client/features/chat/{tool-group → messages/tool-group}/Collapse.tsx +0 -0
  393. /package/client/features/chat/{tool-group → messages/tool-group}/ReadImagePreview.tsx +0 -0
  394. /package/client/features/chat/{tool-group → messages/tool-group}/ToolOutput.tsx +0 -0
  395. /package/client/features/chat/{tool-group → messages/tool-group}/detect.ts +0 -0
  396. /package/client/features/chat/{tool-group → messages/tool-group}/fixtures.ts +0 -0
  397. /package/client/features/chat/{tool-group → messages/tool-group}/format/claude.ts +0 -0
  398. /package/client/features/chat/{tool-group → messages/tool-group}/format/hermes.ts +0 -0
  399. /package/client/features/chat/{tool-group → messages/tool-group}/format/index.ts +0 -0
  400. /package/client/features/chat/{tool-group → messages/tool-group}/format/mcp.ts +0 -0
  401. /package/client/features/chat/{tool-group → messages/tool-group}/format/openclaw.ts +0 -0
  402. /package/client/features/chat/{tool-group → messages/tool-group}/format/shared.ts +0 -0
  403. /package/client/features/chat/{tool-group → messages/tool-group}/format/shell.ts +0 -0
  404. /package/client/features/chat/{tool-group → messages/tool-group}/index.ts +0 -0
  405. /package/client/features/chat/{useStickToBottom.ts → messages/useStickToBottom.ts} +0 -0
@@ -39,27 +39,25 @@ const SYSTEM_REMINDER_CLOSE = '</system-reminder>'
39
39
  // claim to be another one.
40
40
  export type MoiAppletMessage = {
41
41
  source: string
42
- // The structured payload the applet attached to the call. JSON-plain, and
43
- // dropped entirely when it doesn't survive serialization.
44
- context?: Record<string, unknown>
45
42
  }
46
43
 
47
44
  // The structured form built at send time — by the client for chat sends, by
48
45
  // the server for programmatic sends (the view builder). Extend this (and
49
46
  // `renderMoiContext`) when new ambient fields land.
50
47
  export type MoiContext = {
48
+ collabReference?: string
51
49
  // The workspace tab the user is on when they hit send — for a view-builder
52
- // request that's the builder's own tab (`view-builder:<id>`).
50
+ // request that's the builder's own tab (`view-builders/<id>`).
53
51
  activeTab: WorkspaceTabId
54
52
  // UI label of the active tab when it differs from the id — a view's
55
- // configured title (e.g. "Grading review" for `view:color-studio`), or a
53
+ // configured title (e.g. "Grading review" for `views/color-studio`), or a
56
54
  // view builder's claimed title while the build runs. The tab bar falls
57
55
  // back to the id when unset; so does the envelope.
58
56
  tabTitle?: string
59
57
  // The params the active view is rendering with right now, straight from
60
- // navigation state. The emitter side of the same contract (`focusTab`) sets
58
+ // URL query strings. The emitter side of the same contract (`navigate`) sets
61
59
  // them, so the agent sees a view's addressable state in both directions.
62
- // Absent for tabs that take no params (widgets, scratchpad, agent).
60
+ // Absent for tabs that take no params (overview, scratchpad, agent).
63
61
  tabParams?: Record<string, unknown>
64
62
  // Set when this message came from applet UI instead of the composer.
65
63
  applet?: MoiAppletMessage
@@ -68,14 +66,10 @@ export type MoiContext = {
68
66
  directives?: string[]
69
67
  }
70
68
 
71
- // Cap on applet-authored JSON rendered into the envelope. Shared with the
72
- // client applet runtime, which drops an oversized `context` at the trust
73
- // boundary rather than letting it ride the wire — the renderer's truncation is
74
- // the backstop for anything that still gets through (e.g. a server-built
75
- // context).
76
- export const MAX_APPLET_CONTEXT_CHARS = 2000
69
+ // Cap on ambient view params rendered into the workspace envelope.
70
+ const MAX_TAB_PARAMS_CHARS = 2000
77
71
 
78
- // Applet-authored strings (view titles, applet names, attached context) get
72
+ // Applet-authored strings (view titles, applet names, view params) get
79
73
  // interpolated into the envelope, and applet code is agent-authored — a
80
74
  // crafted value containing `</moi-context>` would otherwise close the envelope
81
75
  // early and forge sections the host never wrote. Escaping `<` defuses every
@@ -88,7 +82,7 @@ function escapeTags(text: string): string {
88
82
  // Render an applet-authored record for the envelope, or null when there's
89
83
  // nothing worth printing. Non-serializable values (cycles, BigInt) drop rather
90
84
  // than throw mid-send.
91
- function renderAppletJson(value: Record<string, unknown>): string | null {
85
+ function renderTabParams(value: Record<string, unknown>): string | null {
92
86
  let json: string
93
87
  try {
94
88
  json = JSON.stringify(value)
@@ -97,8 +91,8 @@ function renderAppletJson(value: Record<string, unknown>): string | null {
97
91
  }
98
92
  if (!json || json === '{}') return null
99
93
  const capped =
100
- json.length > MAX_APPLET_CONTEXT_CHARS
101
- ? `${json.slice(0, MAX_APPLET_CONTEXT_CHARS)}… (truncated)`
94
+ json.length > MAX_TAB_PARAMS_CHARS
95
+ ? `${json.slice(0, MAX_TAB_PARAMS_CHARS)}… (truncated)`
102
96
  : json
103
97
  return escapeTags(capped)
104
98
  }
@@ -128,16 +122,16 @@ function describeTab(tab: WorkspaceTabId, rawTitle?: string): string {
128
122
  // other applet-authored string in here.
129
123
  const title = rawTitle === undefined ? undefined : escapeTags(rawTitle)
130
124
  if (tab === 'agent') return 'The user is on the "Agent" tab (full page chat).'
131
- if (tab === 'widgets') return 'The user is on the "Widgets" tab.'
125
+ if (tab === 'overview') return 'The user is on the "Overview" tab.'
132
126
  if (tab === 'scratchpad') return 'The user is on the "Scratchpad" tab.'
133
- if (tab.startsWith('view-builder:')) {
134
- const id = tab.slice('view-builder:'.length)
127
+ if (tab.startsWith('view-builders/')) {
128
+ const id = tab.slice('view-builders/'.length)
135
129
  return title
136
130
  ? `The user is building a new view "${title}". Builder id "${id}".`
137
131
  : `The user is building a new view. Builder id "${id}".`
138
132
  }
139
- if (tab.startsWith('view:')) {
140
- const id = tab.slice('view:'.length)
133
+ if (tab.startsWith('views/')) {
134
+ const id = tab.slice('views/'.length)
141
135
  return `The user is on the "${title ?? id}" view tab (.moi/views/${id}.tsx).`
142
136
  }
143
137
  return `The user is on the "${tab}" tab.`
@@ -155,16 +149,17 @@ export function renderMoiContextBody(ctx: MoiContext): string {
155
149
  'Read the **`moi-workspace` skill** before responding — even to a simple question — unless you already read it in this chat.'
156
150
  ].join('\n')
157
151
  const tabLines = [describeTab(ctx.activeTab, ctx.tabTitle)]
158
- const tabParams = ctx.tabParams ? renderAppletJson(ctx.tabParams) : null
152
+ const tabParams = ctx.tabParams ? renderTabParams(ctx.tabParams) : null
159
153
  if (tabParams) tabLines.push(`Params it is rendering with right now: ${tabParams}`)
160
154
  const sections = [`# Active tab\n${tabLines.join('\n')}`]
155
+ if (ctx.collabReference)
156
+ sections.push(
157
+ `# Collab\nThe collab runtime is available. Before writing collaborative applets, read ${escapeTags(ctx.collabReference)}.`
158
+ )
161
159
  if (ctx.applet) {
162
- const appletLines = [
163
- `The message above was not typed by the user — the ${describeAppletSource(ctx.applet.source)} sent it when the user acted in its UI.`
164
- ]
165
- const context = ctx.applet.context ? renderAppletJson(ctx.applet.context) : null
166
- if (context) appletLines.push(`It attached this context: ${context}`)
167
- sections.push(`# Applet message\n${appletLines.join('\n')}`)
160
+ sections.push(
161
+ `# Applet message\nThe message above was not typed by the user — the ${describeAppletSource(ctx.applet.source)} sent it when the user acted in its UI.`
162
+ )
168
163
  }
169
164
  if (ctx.directives?.length) {
170
165
  sections.push(`# This message only\n${ctx.directives.join('\n')}`)
@@ -184,6 +179,7 @@ export function renderMoiContext(ctx: MoiContext): string {
184
179
  export function isMoiContext(value: unknown): value is MoiContext {
185
180
  if (typeof value !== 'object' || value === null) return false
186
181
  const v = value as {
182
+ collabReference?: unknown
187
183
  activeTab?: unknown
188
184
  tabTitle?: unknown
189
185
  tabParams?: unknown
@@ -192,6 +188,7 @@ export function isMoiContext(value: unknown): value is MoiContext {
192
188
  }
193
189
  return (
194
190
  typeof v.activeTab === 'string' &&
191
+ (v.collabReference === undefined || typeof v.collabReference === 'string') &&
195
192
  (v.tabTitle === undefined || typeof v.tabTitle === 'string') &&
196
193
  (v.tabParams === undefined || isParamsRecord(v.tabParams)) &&
197
194
  (v.applet === undefined || isMoiAppletMessage(v.applet)) &&
@@ -202,12 +199,7 @@ export function isMoiContext(value: unknown): value is MoiContext {
202
199
 
203
200
  function isMoiAppletMessage(value: unknown): value is MoiAppletMessage {
204
201
  if (!isParamsRecord(value)) return false
205
- const v = value as { source?: unknown; context?: unknown }
206
- return (
207
- typeof v.source === 'string' &&
208
- v.source.length > 0 &&
209
- (v.context === undefined || isParamsRecord(v.context))
210
- )
202
+ return typeof value.source === 'string' && value.source.length > 0
211
203
  }
212
204
 
213
205
  // Claude Code: the envelope rides as its OWN text block wrapped in
@@ -0,0 +1,84 @@
1
+ import type { WorkspaceTabId } from './types'
2
+ import { isWorkspaceTabId } from './workspace-tabs'
3
+
4
+ export type ViewParams = Record<string, string>
5
+ export type WorkspaceAddress = { tab: WorkspaceTabId; search: string }
6
+
7
+ // Public destinations deliberately exclude the current singleton chat and
8
+ // transient builders.
9
+ export function parseMoiHref(href: unknown): WorkspaceAddress {
10
+ if (typeof href !== 'string' || !href.startsWith('moi:/') || href.startsWith('moi://')) {
11
+ throw new Error('Expected a workspace address such as moi:/views/events?eventId=123')
12
+ }
13
+ const path = href.slice(5).split(/[?#]/, 1)[0]
14
+ if (href.includes('#') || /[\s\\]/.test(path)) throw new Error('Invalid workspace address')
15
+ const tab = tabFromPath(path)
16
+ if (!tab || tab === 'agent' || tab.startsWith('view-builders/')) {
17
+ throw new Error(`Unsupported workspace destination: ${path}`)
18
+ }
19
+ const query = href.indexOf('?')
20
+ const search = query < 0 ? '' : canonicalSearch(href.slice(query + 1))
21
+ return { tab, search }
22
+ }
23
+
24
+ export function canonicalSearch(search: string): string {
25
+ // Sorting makes equivalent addresses a no-op instead of adding history entries.
26
+ const params = new URLSearchParams(search)
27
+ params.sort()
28
+ const result = params.toString()
29
+ return result ? `?${result}` : ''
30
+ }
31
+
32
+ export function readViewParams(search: string): ViewParams {
33
+ const params = new URLSearchParams(search)
34
+ return Object.fromEntries(Array.from(params.keys(), key => [key, params.get(key)!]))
35
+ }
36
+
37
+ export function tabFromPath(path: string): WorkspaceTabId | null {
38
+ try {
39
+ const tab = decodeURIComponent(path)
40
+ return isWorkspaceTabId(tab) ? tab : null
41
+ } catch {
42
+ return null
43
+ }
44
+ }
45
+
46
+ // Compatibility for old browser bookmarks only; saved tab state uses paths.
47
+ export function legacyTabFromPath(path: string): WorkspaceTabId | null {
48
+ const match = /^(view|view-builder):(.+)$/.exec(path)
49
+ return match ? tabFromPath(`${match[1]}s/${match[2]}`) : null
50
+ }
51
+
52
+ export function moiHref(tab: WorkspaceTabId, search = ''): string {
53
+ return `moi:/${tab}${canonicalSearch(search)}`
54
+ }
55
+
56
+ // Deployment-specific addressing is confined to this host adapter. Callers
57
+ // may supply the router base; portable links never contain it.
58
+ export function workspacePath(workspaceId: string, base = ''): string {
59
+ return `${base.replace(/\/$/, '')}/workspace/${encodeURIComponent(workspaceId)}`
60
+ }
61
+
62
+ export function addressPath(workspaceId: string, address: WorkspaceAddress, base = ''): string {
63
+ return `${workspacePath(workspaceId, base)}/${address.tab}${address.search}`
64
+ }
65
+
66
+ export function workspaceTabPath(workspaceId: string, tab: WorkspaceTabId): string {
67
+ return addressPath(workspaceId, { tab, search: '' })
68
+ }
69
+
70
+ export function resolveWorkspaceHref(workspaceId: string, href: string, base = ''): string {
71
+ if (href.startsWith('moi:')) return addressPath(workspaceId, parseMoiHref(href), base)
72
+ // Only explicit ordinary web addresses may leave the workspace through the
73
+ // imperative API. Native anchors keep their existing protocol policy.
74
+ const url = new URL(href)
75
+ if (url.protocol !== 'https:' && url.protocol !== 'http:') throw new Error('Unsupported URL')
76
+ return url.href
77
+ }
78
+
79
+ export type NavigationRequest = {
80
+ type: 'navigation:request'
81
+ requestId: string
82
+ workspaceId: string
83
+ href: string
84
+ }
package/lib/themes.ts CHANGED
@@ -119,11 +119,11 @@ const THEME_COLOR_DERIVATIONS = {
119
119
  workspace: {
120
120
  primary: primary => primary,
121
121
  primaryForeground: primary => foregroundForPrimary(primary),
122
- background: () => 'color-mix(in srgb, var(--primary) 3%, oklch(1 0 0) 97%)',
122
+ background: () => 'color-mix(in srgb, var(--primary) 2%, oklch(1 0 0) 98%)',
123
123
  foreground: () => 'color-mix(in srgb, var(--primary) 20%, oklch(0 0 0) 80%)',
124
- muted: () => 'color-mix(in srgb, var(--background) 97%, var(--foreground) 3%)',
124
+ muted: () => 'color-mix(in srgb, var(--background) 95%, var(--foreground) 5%)',
125
125
  mutedForeground: () => 'color-mix(in srgb, var(--background) 50%, var(--foreground) 50%)',
126
- accent: () => 'color-mix(in srgb, var(--primary) 4%, var(--foreground) 4%)',
126
+ accent: () => 'color-mix(in srgb, var(--primary) 3%, var(--foreground) 4%)',
127
127
  accentForeground: () => 'var(--foreground)',
128
128
  border: () => 'color-mix(in srgb, var(--foreground) 7%, transparent)',
129
129
  ring: () => 'color-mix(in srgb, var(--background) 50%, var(--primary) 50%)'
@@ -131,11 +131,11 @@ const THEME_COLOR_DERIVATIONS = {
131
131
  widget: {
132
132
  background: primary => primary,
133
133
  foreground: primary => foregroundForPrimary(primary),
134
- primary: () => 'color-mix(in srgb, var(--background) 3%, oklch(1 0 0) 97%)',
134
+ primary: () => 'color-mix(in srgb, var(--background) 2%, oklch(1 0 0) 98%)',
135
135
  primaryForeground: () => 'color-mix(in srgb, var(--background) 20%, oklch(0 0 0) 80%)',
136
- muted: () => 'color-mix(in srgb, var(--background) 97%, var(--foreground) 3%)',
136
+ muted: () => 'color-mix(in srgb, var(--background) 95%, var(--foreground) 5%)',
137
137
  mutedForeground: () => 'color-mix(in srgb, var(--background) 50%, var(--foreground) 50%)',
138
- accent: () => 'color-mix(in srgb, var(--primary) 4%, var(--foreground) 4%)',
138
+ accent: () => 'color-mix(in srgb, var(--primary) 3%, var(--foreground) 4%)',
139
139
  accentForeground: () => 'var(--foreground)',
140
140
  border: () => 'color-mix(in srgb, var(--foreground) 15%, transparent)',
141
141
  ring: () => 'color-mix(in srgb, var(--background) 50%, var(--primary) 50%)'
package/lib/types.ts CHANGED
@@ -1,8 +1,21 @@
1
1
  import type { PreviewBlock, StreamEvent } from './format'
2
+ import type { AppIconId } from './app-icons'
3
+ import type { ExperimentalFeatures } from './experimental'
4
+ import type { MoiContext } from './moi-context'
5
+ import type { WorkspaceTheme } from './themes'
2
6
 
3
7
  // A custom UI unit embedded in a workspace.
4
8
  export type AppletKind = 'view' | 'widget'
5
9
 
10
+ // What a bundled applet's `moi` module may call on its host-attached bridge.
11
+ // Inputs stay unknown at this trust boundary; the browser host narrows them.
12
+ export type AppletBridge = {
13
+ addChatAttachment: (input: unknown) => void
14
+ navigate: (href: unknown) => void
15
+ resolveHref: (href: unknown) => string
16
+ sendChatMessage: (input: unknown, context?: unknown) => void
17
+ }
18
+
6
19
  export type AppletInfo = {
7
20
  id: string
8
21
  // Content revision of the built bundle (`<size>-<mtime>` of index.js).
@@ -68,7 +81,7 @@ export type ViewBuilder = {
68
81
  // server-side (bundle pipeline, RPC route); `load`/`render`/`window`/`runtime`
69
82
  // are browser-side and reach the journal via POST
70
83
  // /api/workspaces/:id/applet-log. `runtime` is the applet API refusing a
71
- // request rather than code throwing — a `focusTab` at a tab that no longer
84
+ // request rather than code throwing — a `navigate` to a view that no longer
72
85
  // exists, a `sendChatMessage` dropped by the rate limit — which the applet's
73
86
  // own code never sees.
74
87
  export type AppletLogSource = 'build' | 'load' | 'render' | 'window' | 'rpc' | 'runtime'
@@ -184,11 +197,45 @@ export type ScratchOpResult = { name: string } | { image: string } | { ok: true
184
197
  // the snapshot can name the version it needs (see lib/scratchpad-skew.ts).
185
198
  export type ScratchpadWriter = { moi: string; tldraw: string }
186
199
 
187
- // An attachment uploaded ahead of a chat message. The bytes live server-side in
188
- // an in-memory upload store (see server/uploads.ts); a chat frame references it
189
- // by `id`. `kind` splits the two delivery paths: an `image` is inlined as a
190
- // base64 vision block in the agent message, a `file` is written to a temp path
191
- // the agent can `Read`. Returned by POST /api/workspaces/:id/uploads.
200
+ // Attachments: caller input → upload receipt → send reference → resolved data.
201
+ // Text skips uploading. Origin and drawing purpose follow the attachment.
202
+ export type DrawingPurpose = 'annotation' | 'sketch'
203
+
204
+ // Host-stamped ID of the applet or workspace tab that created the attachment.
205
+ export type AttachmentOrigin = { source: string }
206
+
207
+ export type TextAttachment = Partial<AttachmentOrigin> & { label: string; text: string }
208
+
209
+ type FileAttachment = Partial<AttachmentOrigin> & {
210
+ mediaType: string
211
+ path: string
212
+ // Only set when the file contains a drawing image.
213
+ purpose?: DrawingPurpose
214
+ }
215
+
216
+ type ImageAttachment = Partial<AttachmentOrigin> & {
217
+ mediaType: string
218
+ label: string
219
+ purpose?: DrawingPurpose
220
+ }
221
+
222
+ // Resolved payloads: JSON-safe data shared by prompts and transcript replay.
223
+ export type Attachment =
224
+ | ({ type: 'text' } & TextAttachment)
225
+ | ({ type: 'file' } & FileAttachment)
226
+ | ({ type: 'image' } & ImageAttachment)
227
+
228
+ // Caller input: text or a browser file / workspace-relative path.
229
+ export type TextAttachmentInput = Pick<TextAttachment, 'label' | 'text'>
230
+
231
+ type FileAttachmentInput = { file: File; path?: never } | { path: string; file?: never }
232
+
233
+ export type AttachmentInput =
234
+ | ({ type: 'text' } & TextAttachmentInput)
235
+ | ({ type: 'file' } & FileAttachmentInput)
236
+
237
+ // Upload receipt: returned by the upload API before sending the message.
238
+ // Bytes or an absolute file path live in the server's workspace-scoped store.
192
239
  export type UploadKind = 'image' | 'file'
193
240
  export type UploadInfo = {
194
241
  id: string
@@ -202,9 +249,13 @@ export type UploadInfo = {
202
249
  height?: number
203
250
  }
204
251
 
205
- // Client → Server messages.
206
- // The chat WebSocket is app-wide (one socket for the whole client, not scoped to
207
- // a workspace), so every message carries the `workspaceId` it targets.
252
+ // Send reference: inline text or an upload ID for the server to resolve.
253
+ // Drawing purpose belongs to this message's use of the uploaded image.
254
+ export type MessageAttachment =
255
+ | ({ type: 'text' } & TextAttachment)
256
+ | ({ type: 'upload'; uploadId: string; purpose?: DrawingPurpose } & Partial<AttachmentOrigin>)
257
+
258
+ // Client → server messages, routed by workspaceId over the shared WebSocket.
208
259
  export type ClientMessage =
209
260
  | {
210
261
  type: 'chat'
@@ -212,10 +263,12 @@ export type ClientMessage =
212
263
  content: string
213
264
  sessionId: string
214
265
  isNew: boolean
215
- // Upload ids (from POST .../uploads) to attach to this turn. The server
216
- // resolves each from its upload store and turns it into a vision block
217
- // (image) or a temp-file path reference (other files). Order is preserved.
218
- attachments?: string[]
266
+ // The browser owns its selected session; creating this chat must not
267
+ // update the installation's shared selection or switch other tabs.
268
+ personalSelection?: boolean
269
+ // Text and upload references for this turn. The server resolves uploads
270
+ // and describes all attachments together, preserving their order.
271
+ attachments?: MessageAttachment[]
219
272
  // Client-chosen stable id for the user's turn. The server tells the
220
273
  // adapter to use this id when the SDK echoes the user input back, so
221
274
  // the optimistic bubble the client rendered gets upserted in place.
@@ -240,7 +293,7 @@ export type ClientMessage =
240
293
  // snapshotted at send time, assembled by
241
294
  // client/features/workspace/moi-context.ts. The server renders it per
242
295
  // harness; display paths strip the rendered envelope from bubbles.
243
- context?: import('./moi-context').MoiContext
296
+ context?: MoiContext
244
297
  }
245
298
  | { type: 'stop'; workspaceId: string; sessionId: string }
246
299
  // Reply to a relayed Scratchpad op (see ScratchpadOpMessage). Carries the
@@ -285,20 +338,20 @@ export type AppSettings = {
285
338
  autoUpdateSkills: boolean
286
339
  }
287
340
 
288
- // Client-safe subset of the startup config (`config.json` in the data dir +
289
- // `MOI_*` env overrides), served by GET /api/config. Frozen for the process
290
- // lifetime — changing it requires a server restart, so clients may cache it
291
- // forever. See server/app-config.ts.
341
+ // Client-safe startup config, served by GET /api/config. Deployment settings
342
+ // come from config.json and MOI_* env overrides; experimental flags come from
343
+ // explicit CLI options. See server/app-config.ts.
292
344
  export type ClientAppConfig = {
293
345
  // Cloud demo deployment: workspace creation is blocked; the UI offers the
294
346
  // cloud-demo promo dialog instead.
295
347
  cloudDemo: boolean
296
- // Enabled experimental features, checked by slug.
297
- experiments: string[]
348
+ experimental: ExperimentalFeatures
298
349
  // Link target for the cloud-demo promo dialog.
299
350
  demoInstallUrl: string
300
351
  }
301
352
 
353
+ export type { ExperimentalFeatures } from './experimental'
354
+
302
355
  export type UpdateStatus = {
303
356
  runningVersion: string
304
357
  availableVersion: string | null
@@ -436,6 +489,11 @@ export type AgentLoginState =
436
489
  | { state: 'pending'; url?: string }
437
490
  | { state: 'failed'; reason: string }
438
491
 
492
+ export type WorkspaceIcon =
493
+ | { type: 'emoji'; value: string; background?: 'theme' }
494
+ | { type: 'glyph'; value: AppIconId; background?: 'theme' }
495
+ | { type: 'upload'; value: string }
496
+
439
497
  // One MCP server's connection status, as surfaced by GET /api/workspaces/:id/mcp
440
498
  // (a subset of the agent SDK's McpServerStatus — only what the UI renders).
441
499
  export type McpServerState = 'connected' | 'failed' | 'needs-auth' | 'pending' | 'disabled'
@@ -454,9 +512,11 @@ export type WorkspaceEntry = {
454
512
  // basename). Persisted so we don't re-probe the gateway for each listing.
455
513
  // The list endpoint overrides this with the live layout `name` when set.
456
514
  name?: string
457
- // Workspace icon override (base64 data URL), merged in from the layout by the
458
- // list endpoint. Undefined → the sidebar uses the provider icon.
459
- icon?: string
515
+ // Workspace icon override. Undefined uses the provider icon.
516
+ icon?: WorkspaceIcon
517
+ // Merged in from the layout so app-wide workspace lists can paint a themed
518
+ // icon without inheriting the active workspace's color.
519
+ theme?: WorkspaceTheme
460
520
  // Home-relative rendering of `path` (e.g. "~/.openclaw/workspace"). Set by
461
521
  // the server on the wire — clients render it as-is.
462
522
  displayPath?: string
@@ -492,6 +552,9 @@ export type ErrorFrame = {
492
552
  workspaceId: string
493
553
  sessionId: string
494
554
  content: string
555
+ // A failed steer or interrupt leaves the current run active. Older senders
556
+ // omit this field and retain terminal-error behavior.
557
+ terminal?: boolean
495
558
  }
496
559
 
497
560
  export type StoppedFrame = {
@@ -504,8 +567,8 @@ export type StoppedFrame = {
504
567
  // lifecycle signal (CC `session_state_changed`, Codex `turn/*`, OpenClaw run
505
568
  // lifecycle) rather than derived by counting messages:
506
569
  // running — the agent is working; the client shows the loader/Stop
507
- // requires-action — the agent is blocked on user input (permission prompt,
508
- // MCP elicitation). Not rendered yet: no loader, no Stop.
570
+ // requires-action — waiting for user input; no loader/Stop. Input notices
571
+ // provide the answer form independently of this state.
509
572
  // idle — everything else, including interrupted/failed turns
510
573
  export type SessionActivity = 'idle' | 'running' | 'requires-action'
511
574
 
@@ -526,10 +589,10 @@ export type LayoutMode = 'fullscreen' | 'split'
526
589
 
527
590
  export type WorkspaceTabId =
528
591
  | 'agent'
529
- | 'widgets'
592
+ | 'overview'
530
593
  | 'scratchpad'
531
- | `view:${string}`
532
- | `view-builder:${string}`
594
+ | `views/${string}`
595
+ | `view-builders/${string}`
533
596
 
534
597
  // Open tabs plus the workspace's saved DEFAULT tab. `active` is not live focus
535
598
  // state — the live active tab is each browser tab's URL (`/workspace/:id/<tab>`).
@@ -543,6 +606,8 @@ export type WorkspaceTabsState = {
543
606
 
544
607
  export type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes'
545
608
 
609
+ export type WorkspaceLayoutSave = Omit<WorkspaceLayout, 'tabs'> & { tabs?: WorkspaceTabsState }
610
+
546
611
  export type WorkspaceLayout = {
547
612
  version: 1
548
613
  widgetGrid: LayoutGridItem[]
@@ -553,9 +618,8 @@ export type WorkspaceLayout = {
553
618
  // User-set display-name override. When empty/undefined the API falls back to
554
619
  // the workspace folder name, so the resolved name always comes from the API.
555
620
  name?: string
556
- // Workspace icon override — a base64 data URL (128×128 transparent WebP,
557
- // produced by the server). Undefined falls back to the provider icon.
558
- icon?: string
621
+ // Workspace icon override. Emoji and glyphs may use a themed background.
622
+ icon?: WorkspaceIcon
559
623
  // Model id chosen in the composer picker (`supportedModels()` `value`, an
560
624
  // alias like `sonnet`). Persisted so the choice survives a reload. Sent with
561
625
  // each chat frame; undefined means the agent runs on the SDK default. Note
@@ -571,7 +635,7 @@ export type WorkspaceLayout = {
571
635
  selectedEffort?: string
572
636
  // Fast-mode default for new sessions. Undefined inherits the provider setting.
573
637
  selectedFastMode?: boolean
574
- theme?: import('./themes').WorkspaceTheme
638
+ theme?: WorkspaceTheme
575
639
  }
576
640
 
577
641
  // One applet's thumbnail freshness record. Image bytes live as files in the
@@ -648,12 +712,14 @@ export type Model = {
648
712
  // Id used to select the model (Claude `value`; OpenClaw catalog id).
649
713
  value: string
650
714
  // Canonical wire model id this row resolves to (Claude, e.g. 'default' and
651
- // 'opus[1m]' both → 'claude-opus-4-8[1m]'). Lets the picker map the synthetic
652
- // "default" entry onto the concrete model it points at.
715
+ // 'opus[1m]' both → 'claude-opus-4-8[1m]'; Hermes maps its structured ACP
716
+ // default the same way). Lets the picker map a synthetic "default" entry
717
+ // onto the concrete model it points at.
653
718
  resolvedModel?: string
654
719
  // Human-readable label (Claude `displayName`; OpenClaw `name`).
655
720
  displayName: string
656
- // " · "-joined blurb (Claude): "<headline> · <tagline> · …". Absent for OpenClaw.
721
+ // One-line blurb (Claude: "Most efficient for everyday tasks"). Not shown by
722
+ // the picker. Absent for OpenClaw.
657
723
  description?: string
658
724
  // Heading this model sits under in the picker (Hermes: the upstream provider,
659
725
  // e.g. 'Ollama'). Absent when the backend serves one flat catalog.
@@ -677,11 +743,8 @@ export type Model = {
677
743
  supportsAutoMode?: boolean
678
744
  }
679
745
 
680
- // GET /api/workspaces/:id/agent payload — everything the client needs to know
681
- // about the workspace's agent backend in one request at workspace open.
682
- // `models` and capabilities are stable per process; `availability` and `login`
683
- // are the volatile part, kept fresh after load by `agent:updated` events
684
- // instead of refetches.
746
+ // GET /api/workspaces/:id/agent. Model changes arrive on refetch;
747
+ // `agent:updated` events refresh availability and login state.
685
748
  export type WorkspaceAgent = {
686
749
  // The agent backend that produced this snapshot — matches the workspace
687
750
  // provider.
@@ -0,0 +1,20 @@
1
+ import { isAppIconId } from './app-icons'
2
+ import type { WorkspaceIcon } from './types'
3
+
4
+ export function isWorkspaceIcon(value: unknown): value is WorkspaceIcon {
5
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return false
6
+ const icon = value as Record<string, unknown>
7
+ if (typeof icon.value !== 'string') return false
8
+ if (icon.background !== undefined && icon.background !== 'theme') return false
9
+
10
+ switch (icon.type) {
11
+ case 'emoji':
12
+ return icon.value.length > 0 && icon.value.length <= 64
13
+ case 'glyph':
14
+ return isAppIconId(icon.value)
15
+ case 'upload':
16
+ return icon.background === undefined
17
+ default:
18
+ return false
19
+ }
20
+ }
@@ -1,13 +1,33 @@
1
+ import { createDefaultWidgetGrid } from './default-widgets'
1
2
  import type { WorkspaceLayout, WorkspaceTabsState } from './types'
3
+ import { isWorkspaceTabId } from './workspace-tabs'
2
4
 
3
5
  export function createDefaultWorkspaceTabs(): WorkspaceTabsState {
4
- return { open: ['agent', 'widgets', 'scratchpad'], active: 'agent' }
6
+ return { open: ['overview', 'agent', 'scratchpad'], active: 'overview' }
7
+ }
8
+
9
+ export function normalizeWorkspaceTabs(value: unknown): WorkspaceTabsState {
10
+ const defaults = createDefaultWorkspaceTabs()
11
+ if (!value || typeof value !== 'object') return defaults
12
+
13
+ const raw = value as Record<string, unknown>
14
+ const savedOpen = Array.isArray(raw.open)
15
+ ? raw.open.filter(isWorkspaceTabId).filter((tab, index, all) => all.indexOf(tab) === index)
16
+ : []
17
+ if (savedOpen.length === 0) return defaults
18
+
19
+ const open = [
20
+ 'overview',
21
+ ...savedOpen.filter(tab => tab !== 'overview')
22
+ ] satisfies WorkspaceTabsState['open']
23
+ const active = isWorkspaceTabId(raw.active) && open.includes(raw.active) ? raw.active : 'overview'
24
+ return { open, active }
5
25
  }
6
26
 
7
27
  export function createDefaultWorkspaceLayout(): WorkspaceLayout {
8
28
  return {
9
29
  version: 1,
10
- widgetGrid: [],
30
+ widgetGrid: createDefaultWidgetGrid(),
11
31
  layoutMode: 'split',
12
32
  tabs: createDefaultWorkspaceTabs()
13
33
  }
@@ -1,48 +1,24 @@
1
- // Workspace tab addressing, shared by the client router, the control server,
2
- // and the CLI. A tab id doubles as the URL suffix of `/workspace/:id/<tab>` —
3
- // ids are URL-safe as-is (`:` is a legal path character), so building a path
4
- // is plain concatenation and parsing is plain validation.
1
+ // Tab IDs are workspace-relative paths without query strings.
5
2
  import type { WorkspaceTabId } from './types'
6
3
 
7
4
  export function isWorkspaceTabId(value: unknown): value is WorkspaceTabId {
8
5
  return (
9
6
  value === 'agent' ||
10
- value === 'widgets' ||
7
+ value === 'overview' ||
11
8
  value === 'scratchpad' ||
12
- // One path segment: a URL wildcard can span segments, a tab id never does.
13
- (typeof value === 'string' &&
14
- (/^view:[^/]+$/.test(value) || /^view-builder:[^/]+$/.test(value)))
9
+ // Match the applet IDs accepted by the server's module routes.
10
+ (typeof value === 'string' && /^(views|view-builders)\/[a-zA-Z0-9_-]+$/.test(value))
15
11
  )
16
12
  }
17
13
 
18
- // The tab id carried by a URL's wildcard segment, or null when the segment is
19
- // missing or isn't a tab id (bare `/workspace/:id`, stale or mangled links).
20
- export function parseWorkspaceTab(segment: string | null | undefined): WorkspaceTabId | null {
21
- return isWorkspaceTabId(segment) ? segment : null
22
- }
23
-
24
- export function workspaceTabPath(workspaceId: string, tab: WorkspaceTabId): string {
25
- return `/workspace/${workspaceId}/${tab}`
26
- }
27
-
28
- export const viewTabId = (viewId: string): WorkspaceTabId => `view:${viewId}`
14
+ export const viewTabId = (viewId: string): WorkspaceTabId => `views/${viewId}`
29
15
  export const viewIdFromTab = (tab: WorkspaceTabId): string | null =>
30
- tab.startsWith('view:') ? tab.slice('view:'.length) : null
31
- export const viewBuilderTabId = (builderId: string): WorkspaceTabId => `view-builder:${builderId}`
16
+ tab.startsWith('views/') ? tab.slice('views/'.length) : null
17
+ export const viewBuilderTabId = (builderId: string): WorkspaceTabId => `view-builders/${builderId}`
32
18
  export const viewBuilderIdFromTab = (tab: WorkspaceTabId): string | null =>
33
- tab.startsWith('view-builder:') ? tab.slice('view-builder:'.length) : null
19
+ tab.startsWith('view-builders/') ? tab.slice('view-builders/'.length) : null
34
20
 
35
- // The only params shape focusTab / `moi tab focus` carry: one JSON-plain
36
- // object. Arrays and null are valid JSON but not a params record.
21
+ // A record check shared by JSON boundary validators.
37
22
  export function isParamsRecord(value: unknown): value is Record<string, unknown> {
38
23
  return typeof value === 'object' && value !== null && !Array.isArray(value)
39
24
  }
40
-
41
- // Applet params as read back from navigation state (`state.appletParams`).
42
- // Anything malformed degrades to `{}` — a view must render with empty params
43
- // anyway (fresh mount, new browser tab, plain tab-bar click).
44
- export function readAppletParams(state: unknown): Record<string, unknown> {
45
- if (!isParamsRecord(state)) return {}
46
- const params = (state as { appletParams?: unknown }).appletParams
47
- return isParamsRecord(params) ? params : {}
48
- }