moi-computer 0.10.1-next.6 → 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 (406) 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/capture-element.ts +13 -1
  99. package/client/features/drawings/useChatAnnotation.ts +17 -17
  100. package/client/features/drawings/useDrawingLayer.ts +7 -9
  101. package/client/features/drawings/useViewBuilderSketch.ts +18 -15
  102. package/client/features/home/HomePage.tsx +8 -7
  103. package/client/features/home/WorkspacePreview.tsx +2 -2
  104. package/client/features/home/workspace-presentation.tsx +1 -11
  105. package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
  106. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
  107. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +2 -4
  108. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
  109. package/client/features/overview/HiddenPanel.tsx +109 -0
  110. package/client/features/overview/Overview.tsx +302 -0
  111. package/client/features/overview/WidgetCanvas.tsx +164 -0
  112. package/client/features/{widgets → overview}/WidgetFrame.tsx +25 -17
  113. package/client/features/overview/WorkspaceName.tsx +60 -0
  114. package/client/features/overview/api.ts +30 -0
  115. package/client/features/overview/default/ViewsWidget.tsx +252 -0
  116. package/client/features/overview/default/registry.tsx +36 -0
  117. package/client/features/{widgets → overview}/grid.ts +36 -0
  118. package/client/features/overview/useGridReconcile.ts +94 -0
  119. package/client/features/scratchpad/Scratchpad.tsx +7 -8
  120. package/client/features/scratchpad/ScratchpadControls.tsx +0 -1
  121. package/client/features/scratchpad/useScratchpadSnapshot.tsx +23 -13
  122. package/client/features/settings/GeneralSettings.tsx +55 -58
  123. package/client/features/settings/SettingsLayout.tsx +2 -2
  124. package/client/features/settings/WorkspaceIconPicker.tsx +318 -0
  125. package/client/features/settings/WorkspaceSettingsDialog.tsx +65 -0
  126. package/client/features/settings/api.ts +48 -24
  127. package/client/features/views/ViewBuilder.tsx +5 -4
  128. package/client/features/views/ViewManager.tsx +28 -22
  129. package/client/features/views/api.ts +36 -2
  130. package/client/features/views/useViewBuilderActions.ts +11 -5
  131. package/client/features/views/useViewBuilderDrafts.ts +23 -21
  132. package/client/features/views/view-presentation.ts +13 -0
  133. package/client/features/workspace/{CustomizePanel.tsx → ThemePanel.tsx} +26 -31
  134. package/client/features/workspace/UnavailablePage.tsx +21 -0
  135. package/client/features/workspace/WorkspaceLayoutContext.tsx +22 -10
  136. package/client/features/workspace/WorkspaceScreen.tsx +228 -172
  137. package/client/features/workspace/WorkspaceSplitLayout.tsx +7 -2
  138. package/client/features/workspace/WorkspaceTabs.tsx +2 -0
  139. package/client/features/workspace/api.ts +5 -31
  140. package/client/features/workspace/layout-save.ts +13 -0
  141. package/client/features/workspace/moi-context.ts +15 -11
  142. package/client/features/workspace/tab-resolution.ts +10 -33
  143. package/client/features/workspace/useWorkspaceNavigation.ts +173 -101
  144. package/client/index.css +23 -30
  145. package/client/index.tsx +4 -3
  146. package/client/lib/app-icon-registry.ts +2 -0
  147. package/client/lib/use-latest-ref.ts +11 -0
  148. package/client/main.tsx +1 -1
  149. package/client/runtime/useWorkspaceEvents.ts +59 -14
  150. package/client/theme.css +5 -5
  151. package/dist/chunk-1ftessc8.js +2 -0
  152. package/dist/chunk-3802vh2p.js +2 -0
  153. package/dist/chunk-542a2m9m.js +1 -0
  154. package/dist/chunk-5745d83v.js +2 -0
  155. package/dist/chunk-5zxdsjym.js +1 -0
  156. package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
  157. package/dist/chunk-7r4z77ry.js +2 -0
  158. package/dist/chunk-9cm0wjah.js +79 -0
  159. package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
  160. package/dist/chunk-cvgdm1hq.js +2 -0
  161. package/dist/chunk-gptm4jpd.js +546 -0
  162. package/dist/chunk-nf2wkvf9.js +14 -0
  163. package/dist/chunk-wnmf38ta.js +5 -0
  164. package/dist/chunk-xaehhr1j.css +1 -0
  165. package/dist/chunk-xpt063fx.js +1 -0
  166. package/dist/index.html +1 -1
  167. package/lib/app-icons.ts +1 -0
  168. package/lib/applet-selector.ts +24 -0
  169. package/lib/chat-title.ts +6 -1
  170. package/lib/collab/colors.ts +24 -0
  171. package/lib/collab/protocol.ts +83 -0
  172. package/lib/collab/types.ts +63 -0
  173. package/lib/default-widgets.ts +32 -0
  174. package/lib/experimental.ts +14 -0
  175. package/lib/format.ts +67 -7
  176. package/lib/message-attachments.ts +40 -0
  177. package/lib/moi-attachments.ts +204 -0
  178. package/lib/moi-context.ts +27 -35
  179. package/lib/navigation.ts +84 -0
  180. package/lib/themes.ts +6 -6
  181. package/lib/types.ts +103 -40
  182. package/lib/workspace-icon.ts +20 -0
  183. package/lib/workspace-layout.ts +22 -2
  184. package/lib/workspace-tabs.ts +9 -33
  185. package/package.json +44 -32
  186. package/registry.json +656 -0
  187. package/server/AGENTS.md +2 -0
  188. package/server/agent.ts +1 -1
  189. package/server/api.ts +162 -68
  190. package/server/app-config.ts +127 -34
  191. package/server/applet-typecheck.ts +100 -0
  192. package/server/applets/applet-css.ts +55 -0
  193. package/server/{bundler → applets}/build-applet.ts +21 -240
  194. package/server/applets/build-worker.ts +178 -0
  195. package/server/applets/config.ts +226 -0
  196. package/server/applets/dependencies.ts +206 -0
  197. package/server/{applets.ts → applets/index.ts} +44 -189
  198. package/server/applets/runtime/base.ts +4 -0
  199. package/server/applets/runtime/moi.ts +42 -0
  200. package/server/applets/runtime/rpc.ts +17 -0
  201. package/server/applets/view-source.ts +67 -0
  202. package/server/attachment-message.ts +95 -0
  203. package/server/chat-selection.ts +23 -0
  204. package/server/cli-ui-components.ts +28 -33
  205. package/server/cli.ts +226 -120
  206. package/server/collab/applet-module.ts +50 -0
  207. package/server/collab/cloudflare-access.ts +77 -0
  208. package/server/collab/config.ts +18 -0
  209. package/server/collab/ipc.ts +10 -0
  210. package/server/collab/manager.ts +407 -0
  211. package/server/collab/service.ts +137 -0
  212. package/server/collab/skill/collab-env.d.ts +92 -0
  213. package/server/collab/skill/index.ts +59 -0
  214. package/server/collab/worker.ts +52 -0
  215. package/server/control.ts +63 -42
  216. package/server/data-dir.ts +1 -1
  217. package/server/harness/README.md +45 -50
  218. package/server/harness/acp/NOTES.md +426 -0
  219. package/server/harness/acp/adapter.ts +7 -21
  220. package/server/harness/acp/discovery.ts +27 -30
  221. package/server/harness/acp/model-state.ts +57 -0
  222. package/server/harness/acp/session.ts +49 -56
  223. package/server/harness/claude-code/NOTES.md +54 -13
  224. package/server/harness/claude-code/adapter.ts +8 -25
  225. package/server/harness/claude-code/cli.ts +40 -0
  226. package/server/harness/claude-code/index.ts +13 -5
  227. package/server/harness/claude-code/models.ts +72 -19
  228. package/server/harness/claude-code/session.ts +447 -343
  229. package/server/harness/claude-code/sessions.ts +9 -4
  230. package/server/harness/codex/NOTES.md +222 -350
  231. package/server/harness/codex/adapter.ts +102 -52
  232. package/server/harness/codex/auth.ts +1 -3
  233. package/server/harness/codex/client.ts +169 -249
  234. package/server/harness/codex/discovery.ts +9 -17
  235. package/server/harness/codex/index.ts +3 -1
  236. package/server/harness/codex/pagination.ts +24 -0
  237. package/server/harness/codex/permissions.ts +32 -8
  238. package/server/harness/codex/probe.ts +10 -13
  239. package/server/harness/codex/session.ts +567 -181
  240. package/server/harness/codex/transport.ts +184 -0
  241. package/server/harness/debug.ts +1 -1
  242. package/server/harness/hermes/NOTES.md +19 -1
  243. package/server/harness/hermes/discovery.ts +20 -0
  244. package/server/harness/hermes/index.ts +13 -0
  245. package/server/harness/hermes/models.ts +28 -8
  246. package/server/harness/openclaw/NOTES.md +1 -1
  247. package/server/harness/openclaw/adapter.ts +22 -4
  248. package/server/harness/openclaw/gateway.ts +5 -3
  249. package/server/harness/openclaw/session.ts +27 -27
  250. package/server/harness/types.ts +9 -5
  251. package/server/layout.ts +24 -16
  252. package/server/moi-scaffold.ts +22 -14
  253. package/server/navigation-relay.ts +110 -0
  254. package/server/preview.ts +3 -1
  255. package/server/registry.ts +71 -41
  256. package/server/scratchpad-executor.ts +79 -56
  257. package/server/scratchpad-shape-defaults.ts +82 -0
  258. package/server/selected-session.ts +24 -4
  259. package/server/skill-update.ts +5 -3
  260. package/server/skill-version.ts +4 -7
  261. package/server/skills-template.ts +60 -9
  262. package/server/tabs.ts +19 -33
  263. package/server/tldraw-package.d.ts +4 -0
  264. package/server/ui-components.ts +101 -434
  265. package/server/uploads.ts +0 -0
  266. package/server/view-builders.ts +20 -2
  267. package/server/views.ts +126 -6
  268. package/server/web.ts +108 -30
  269. package/server/widgets.ts +12 -5
  270. package/server/workspace-config.ts +13 -9
  271. package/server/workspace-env.ts +3 -2
  272. package/tsconfig.json +0 -1
  273. package/ui-components/accordion.tsx +71 -0
  274. package/ui-components/alert-dialog.tsx +165 -0
  275. package/ui-components/alert.tsx +68 -0
  276. package/ui-components/attachment.tsx +195 -0
  277. package/ui-components/avatar.tsx +91 -0
  278. package/ui-components/badge.tsx +49 -0
  279. package/ui-components/button-group.tsx +78 -0
  280. package/ui-components/button.tsx +55 -0
  281. package/ui-components/calendar.tsx +180 -0
  282. package/ui-components/card.tsx +84 -0
  283. package/ui-components/carousel.tsx +235 -0
  284. package/ui-components/chart.tsx +338 -0
  285. package/ui-components/checkbox.tsx +28 -0
  286. package/ui-components/collapsible.tsx +15 -0
  287. package/ui-components/combobox.tsx +267 -0
  288. package/ui-components/context-menu.tsx +244 -0
  289. package/ui-components/dialog.tsx +138 -0
  290. package/ui-components/docs/accordion.md +463 -0
  291. package/ui-components/docs/alert-dialog.md +481 -0
  292. package/ui-components/docs/alert.md +301 -0
  293. package/ui-components/docs/attachment.md +689 -0
  294. package/ui-components/docs/avatar.md +495 -0
  295. package/ui-components/docs/badge.md +258 -0
  296. package/ui-components/docs/button-group.md +879 -0
  297. package/ui-components/docs/button.md +26 -0
  298. package/ui-components/docs/calendar.md +862 -0
  299. package/ui-components/docs/card.md +265 -0
  300. package/ui-components/docs/carousel.md +627 -0
  301. package/ui-components/docs/chart.md +1256 -0
  302. package/ui-components/docs/checkbox.md +477 -0
  303. package/ui-components/docs/collapsible.md +446 -0
  304. package/ui-components/docs/combobox.md +1003 -0
  305. package/ui-components/docs/context-menu.md +860 -0
  306. package/ui-components/docs/data-table.md +1580 -0
  307. package/ui-components/docs/date-picker.md +614 -0
  308. package/ui-components/docs/dialog.md +414 -0
  309. package/ui-components/docs/drawer.md +51 -0
  310. package/ui-components/docs/dropdown-menu.md +1000 -0
  311. package/ui-components/docs/field.md +1192 -0
  312. package/ui-components/docs/hover-card.md +275 -0
  313. package/ui-components/docs/input-group.md +866 -0
  314. package/ui-components/docs/input.md +456 -0
  315. package/ui-components/docs/kbd.md +191 -0
  316. package/ui-components/docs/label.md +295 -0
  317. package/ui-components/docs/pagination.md +416 -0
  318. package/ui-components/docs/popover.md +348 -0
  319. package/ui-components/docs/progress.md +214 -0
  320. package/ui-components/docs/radio-group.md +389 -0
  321. package/ui-components/docs/resizable.md +265 -0
  322. package/ui-components/docs/select.md +616 -0
  323. package/ui-components/docs/separator.md +216 -0
  324. package/ui-components/docs/skeleton.md +205 -0
  325. package/ui-components/docs/slider.md +226 -0
  326. package/ui-components/docs/spinner.md +332 -0
  327. package/ui-components/docs/switch.md +236 -0
  328. package/ui-components/docs/table.md +551 -0
  329. package/ui-components/docs/tabs.md +379 -0
  330. package/ui-components/docs/textarea.md +187 -0
  331. package/ui-components/docs/toggle-group.md +370 -0
  332. package/ui-components/docs/toggle.md +91 -0
  333. package/ui-components/docs/tooltip.md +290 -0
  334. package/ui-components/drawer.tsx +213 -0
  335. package/ui-components/dropdown-menu.tsx +263 -0
  336. package/ui-components/field.tsx +224 -0
  337. package/ui-components/hover-card.tsx +46 -0
  338. package/ui-components/input-group.tsx +146 -0
  339. package/ui-components/input.tsx +20 -0
  340. package/ui-components/kbd.tsx +32 -0
  341. package/ui-components/label.tsx +17 -0
  342. package/ui-components/pagination.tsx +124 -0
  343. package/ui-components/popover.tsx +81 -0
  344. package/ui-components/progress.tsx +63 -0
  345. package/ui-components/radio-group.tsx +38 -0
  346. package/ui-components/resizable.tsx +40 -0
  347. package/ui-components/scoped-portal.tsx +31 -0
  348. package/ui-components/select.tsx +195 -0
  349. package/ui-components/separator.tsx +18 -0
  350. package/ui-components/skeleton.tsx +15 -0
  351. package/ui-components/slider.tsx +75 -0
  352. package/ui-components/spinner.tsx +20 -0
  353. package/ui-components/switch.tsx +27 -0
  354. package/ui-components/table.tsx +86 -0
  355. package/ui-components/tabs.tsx +75 -0
  356. package/ui-components/textarea.tsx +17 -0
  357. package/ui-components/toggle-group.tsx +85 -0
  358. package/ui-components/toggle.tsx +42 -0
  359. package/ui-components/tooltip.tsx +61 -0
  360. package/ui-components/utils.ts +8 -0
  361. package/workspace/.claude/skills/moi-workspace/SKILL.md +295 -248
  362. package/workspace/.claude/skills/moi-workspace/references/COLLABORATIVE.md +151 -0
  363. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +100 -152
  364. package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +156 -0
  365. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
  366. package/client/features/chat/attachment-staging.ts +0 -153
  367. package/client/features/chat/uploads.ts +0 -18
  368. package/client/features/chat/useAppletChatMessage.ts +0 -68
  369. package/client/features/settings/IconPicker.tsx +0 -442
  370. package/client/features/settings/WorkspaceSettings.tsx +0 -92
  371. package/client/features/settings/render-icon.ts +0 -173
  372. package/client/features/widgets/HiddenPanel.tsx +0 -80
  373. package/client/features/widgets/WidgetGrid.tsx +0 -123
  374. package/client/features/widgets/Widgets.tsx +0 -260
  375. package/client/features/widgets/useGridReconcile.ts +0 -73
  376. package/dist/chunk-104m57qw.js +0 -2
  377. package/dist/chunk-7paadv61.js +0 -1
  378. package/dist/chunk-bj3akjs2.js +0 -1
  379. package/dist/chunk-c9pjqx9m.js +0 -14
  380. package/dist/chunk-j2w2vak4.js +0 -546
  381. package/dist/chunk-k2r9c95m.js +0 -10
  382. package/dist/chunk-kmbxhgwv.js +0 -1
  383. package/dist/chunk-pcnahct1.js +0 -5
  384. package/dist/chunk-r8s1b672.css +0 -1
  385. package/dist/chunk-tny85yt2.js +0 -2
  386. package/dist/chunk-v7wr1df4.js +0 -2
  387. package/dist/chunk-vwzshv0d.js +0 -83
  388. package/server/bundler/applet-css.ts +0 -155
  389. /package/client/features/chat/{ChatPromptBubbles.tsx → messages/ChatPromptBubbles.tsx} +0 -0
  390. /package/client/features/chat/{ShimmerText.tsx → messages/ShimmerText.tsx} +0 -0
  391. /package/client/features/chat/{preview-turn.ts → messages/preview-turn.ts} +0 -0
  392. /package/client/features/chat/{tool-group → messages/tool-group}/CodeBlock.tsx +0 -0
  393. /package/client/features/chat/{tool-group → messages/tool-group}/Collapse.tsx +0 -0
  394. /package/client/features/chat/{tool-group → messages/tool-group}/ReadImagePreview.tsx +0 -0
  395. /package/client/features/chat/{tool-group → messages/tool-group}/ToolOutput.tsx +0 -0
  396. /package/client/features/chat/{tool-group → messages/tool-group}/detect.ts +0 -0
  397. /package/client/features/chat/{tool-group → messages/tool-group}/fixtures.ts +0 -0
  398. /package/client/features/chat/{tool-group → messages/tool-group}/format/claude.ts +0 -0
  399. /package/client/features/chat/{tool-group → messages/tool-group}/format/hermes.ts +0 -0
  400. /package/client/features/chat/{tool-group → messages/tool-group}/format/index.ts +0 -0
  401. /package/client/features/chat/{tool-group → messages/tool-group}/format/mcp.ts +0 -0
  402. /package/client/features/chat/{tool-group → messages/tool-group}/format/openclaw.ts +0 -0
  403. /package/client/features/chat/{tool-group → messages/tool-group}/format/shared.ts +0 -0
  404. /package/client/features/chat/{tool-group → messages/tool-group}/format/shell.ts +0 -0
  405. /package/client/features/chat/{tool-group → messages/tool-group}/index.ts +0 -0
  406. /package/client/features/chat/{useStickToBottom.ts → messages/useStickToBottom.ts} +0 -0
@@ -0,0 +1,151 @@
1
+ # Collaborative applets
2
+
3
+ moi workspaces can be shared with multiple users. This guide explains the primitives in
4
+ `moi/collab` that make views and widgets ready for real-time collaboration: user lookup,
5
+ connected users, cursors, focus, and selections.
6
+
7
+ ## Concepts
8
+
9
+ ### User identity
10
+
11
+ Every user has a unique, stable `id` and a `color`. A profile can also include `name`, `email`,
12
+ and `avatar`; these fields are optional, and a name can be empty.
13
+
14
+ **Store only user IDs when writing user references to the server**, such as `authorId` or
15
+ `assigneeIds`. Do not copy names, emails, colors, or avatars into application records. Resolve
16
+ current profiles through the hooks and components below. Applet-specific data, such as a user's
17
+ preferences or role in a project, can be stored separately and keyed by user ID.
18
+
19
+ ```tsx
20
+ import { User, Facepile } from 'moi/collab'
21
+
22
+ <User id={authorId} />
23
+ <Facepile ids={assigneeIds} max={3} />
24
+ ```
25
+
26
+ These components resolve profiles and handle missing names and unknown IDs for you.
27
+
28
+ ### Workspace members and connected users
29
+
30
+ Workspace members are registered users, including people who are offline. Use the full member
31
+ list for assignee pickers and other user references. Query connected users to show who is here
32
+ or working on the same page.
33
+
34
+ | Hook | Returns |
35
+ | ------------------------------------------ | -------------------------------------------------------------------- |
36
+ | `useMe()` | The current user. |
37
+ | `useUser(id)` | A user by ID, including an offline member. |
38
+ | `useWorkspaceUsers()` | All available workspace members, including you. |
39
+ | `useWorkspaceUsers({ status: 'offline' })` | Members who are offline. The filter also accepts `active` or `away`. |
40
+ | `useWorkspaceUsersStatus()` | Whether the member list is `loading`, `ready`, or `unavailable`. |
41
+ | `usePeers()` | Other connected users on the current page. |
42
+ | `usePeers({ scope: 'workspace' })` | Other connected users anywhere in the workspace. |
43
+
44
+ User results include `status`: `active` when at least one workspace connection has a visible
45
+ page, `away` when connected without a visible page, or `offline` when disconnected. A user on
46
+ another page can still be active. `usePeers` excludes your own user, combines multiple tabs
47
+ into one user, and can filter by `status: 'active'` or `'away'`.
48
+
49
+ `useMe()` and `useUser(id)` return `null` when the user cannot be resolved. When the member list
50
+ is unavailable, user enumeration falls back to your identity and connected users; it cannot
51
+ discover offline members.
52
+
53
+ ### Provided by moi
54
+
55
+ moi supplies identity, the user directory, and the connection between applets. You do not need
56
+ to set up transport, sockets, or providers. Use the exports from `moi/collab` directly; applets
57
+ read user profiles rather than creating or updating them.
58
+
59
+ ## Presence
60
+
61
+ Presence is ephemeral state that describes what connected people are doing: where their pointer
62
+ is, which field they are editing, or which item they selected. It is not persisted and only
63
+ works while people are connected. Registrations are removed when their applet becomes inactive,
64
+ the browser tab is hidden, or the publishing component unmounts.
65
+
66
+ Presence does not save or synchronize application content. Continue saving documents, tasks,
67
+ and other durable data through your applet's `.server.ts` functions and storage.
68
+
69
+ ### Built-in presence
70
+
71
+ | Component | Use |
72
+ | ---------------- | ----------------------------------------------------------------------------------------- |
73
+ | `Activity` | Show you and other connected users; use `scope="workspace"` to include other pages. |
74
+ | `Cursors` | Wrap an area to share and display pointers. Give separate areas distinct `surface` names. |
75
+ | `PresenceFrame` | Wrap one element to show an outline and users focused inside it. |
76
+ | `PresenceGutter` | Wrap one element to show focused users beside it. |
77
+ | `PresenceGroup` | Scope descendant frame, gutter, and selection IDs. Adds no DOM element. |
78
+ | `Selection` | Wrap an item with an `id` and controlled `selected` boolean to share its selection. |
79
+
80
+ ```tsx
81
+ import { Cursors, PresenceGroup, PresenceFrame, PresenceGutter } from 'moi/collab'
82
+
83
+ ;<Cursors surface="task-details">
84
+ <PresenceGroup id={task.id}>
85
+ <PresenceFrame id="title">
86
+ <Input defaultValue={task.title} />
87
+ </PresenceFrame>
88
+ <PresenceGutter id="notes">
89
+ <Textarea defaultValue={task.notes} />
90
+ </PresenceGutter>
91
+ </PresenceGroup>
92
+ </Cursors>
93
+ ```
94
+
95
+ Frame and gutter each accept exactly one React element, such as an input, label, or card with
96
+ controls inside it; do not use a fragment. They handle focus and user lookup automatically.
97
+ Use ordinary elements for layout; a group only provides scoping.
98
+
99
+ Use stable record IDs and field names for `id`. Groups can nest: a field `title` inside task
100
+ `42` inside group `tasks` identifies `tasks/42/title`. IDs must be nonblank and unique within
101
+ their group. In lists, give each item a React `key` as well as a presence `id`; use record IDs,
102
+ not array positions. When a dialog switches records, change its group ID.
103
+
104
+ Focus, selections, and cursors are scoped to the current page and applet. Matching IDs in an
105
+ unrelated view or widget do not share presence.
106
+
107
+ ### Custom presence
108
+
109
+ Use a named channel for activity that the built-in components do not cover. Inside a component:
110
+
111
+ ```tsx
112
+ import { usePresence, usePublishPresence } from 'moi/collab'
113
+
114
+ usePublishPresence('editing', { taskId })
115
+ const editors = usePresence<{ taskId: string }>('editing')
116
+ ```
117
+
118
+ `usePublishPresence` publishes the current value and replaces it when it changes. Mount the
119
+ publishing component only while that activity is happening. Values must be JSON and no larger
120
+ than 4 KiB.
121
+
122
+ `usePresence` only reads. It returns `{ connectionId, userId, value }[]` for other connections
123
+ on the same page and applet. Resolve each `userId` with `User` or `useUser`. One user can have
124
+ separate presence values in multiple tabs.
125
+
126
+ Channel names are local to the applet, not to `PresenceGroup`. Include record IDs in your
127
+ values when an activity belongs to a particular record.
128
+
129
+ ## Component props cheat sheet
130
+
131
+ All components accept optional `className: string` except `PresenceGroup`. The last column
132
+ lists optional props, with defaults where applicable.
133
+
134
+ | Component | Required props | Optional props and defaults |
135
+ | ---------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
136
+ | `User` | `id: string` | `size="md"` (`xs`, `sm`, `md`, `lg`); `avatarOnly=false`; `you=false`; `detail: ReactNode`; `showStatus=true`; `label: string` |
137
+ | `Facepile` | `ids: readonly string[]` | `size="sm"` (`xs`, `sm`, `md`); `max=3`; `showStatus=false` |
138
+ | `Activity` | None | `scope="page"` (`page`, `workspace`) |
139
+ | `Cursors` | `children: ReactNode` | `surface="default"` (string) |
140
+ | `PresenceFrame` / `PresenceGutter` | `id: string`; `children`: exactly one React element | None beyond `className` |
141
+ | `PresenceGroup` | `id: string`; `children: ReactNode` | None |
142
+ | `Selection` | `id: string`; `selected: boolean`; `children: ReactNode` | None beyond `className` |
143
+
144
+ - `User`: `avatarOnly` hides the visible name and detail; `you` adds a manual “(you)” suffix;
145
+ `detail` adds secondary content. `label` sets the avatar tooltip and accessible label, not
146
+ the visible user name. `showStatus` shows a dot for active users.
147
+ - `Facepile`: duplicate IDs appear once; users beyond `max` become a `+N` overflow indicator.
148
+ - Only `User` and `Facepile` accept `size`. `Activity` shows all matching users and has no
149
+ `size` or `max` prop.
150
+
151
+ See `.moi/collab-env.d.ts` for the complete public types and component props.
@@ -1,43 +1,58 @@
1
1
  # moi applet design
2
2
 
3
- This visual contract covers widgets and views inside a moi workspace. Applets may be expressive
4
- while staying related to the calm host. This guide owns design decisions, `SKILL.md` owns
5
- implementation, and the host owns fonts and semantic color values.
3
+ Applets should feel useful, clear, and at home in the workspace. Let their content give them character while keeping familiar typography, colors, and interactions.
6
4
 
7
- ## Core principles and visual hierarchy
5
+ This guide is the highest-priority visual contract for widgets and views inside a moi workspace.
6
+ Follow generic design guidance only where it agrees with this guide.
8
7
 
9
- Design around the content and task. Give every applet one clear first reading, then add detail in
10
- proportion to its purpose and space. Dense information needs hierarchy, alignment, and stable lanes.
8
+ ## Content and layout
11
9
 
12
- An applet may have one expressive focal point, such as a visualization, image, strong surface, or
13
- state change. Keep the rest restrained. Avoid decorative clutter and competing effects.
10
+ **Make the purpose clear at a glance.** Lead with the information or activity people came for. Use contrast to create clear levels of emphasis without making the interface feel washed out. Keep the main action easy to find.
14
11
 
15
- Every visible element must explain content, show a real state, or enable an action. Remove repeated
16
- labels, obvious readiness badges, redundant helper copy, decorative status pills, and meaningless
17
- icons. Relate a workspace's applets through typography, palette, spacing, or interaction patterns.
12
+ **Choose content before adding structure.** Include the information and controls the task needs. Add summaries, metrics, filters, and explanations when they help people understand or act. Available space is not a reason to add content. A sparse screen can be complete.
18
13
 
19
- Lead with the main value, message, or task. Quiet supporting content and make tertiary metadata easy
20
- to ignore. A widget may use one large hero value when its footprint supports it. When two elements
21
- compete, reduce one.
14
+ **Consider the screen as a whole.** Individually useful elements can still compete or repeat one another. Consolidate related information and reveal secondary details when needed. Keep essential information and frequent actions readily available.
15
+
16
+ **Give expression a clear focus.** Use typography, composition, color, imagery, texture, or a small content-linked metaphor to give the applet character. A visual detail may support the subject or mood without carrying data or enabling an action. Keep the treatment focused so the content remains easy to scan. Expand a focal region only when added working space helps the task.
17
+
18
+ **Group through spacing and alignment.** Start with an open layout. Prefer spacing and alignment over separators. Add a divider only when adjacent regions need a visible boundary. Use surfaces only for interactive objects, independent scrolling regions, distinct states, or a dedicated work area. Keep ordinary headings, tabs, summaries, metrics, and sections unboxed. Avoid large rounded page frames and decorative rows of cards or nested cards.
19
+
20
+ **Keep a consistent rhythm.** Use a 4 px spacing rhythm, with smaller gaps inside groups and larger gaps between them. Apply outer padding once. Align repeated values and actions so content changes do not move them around. When removing a container, remove its unnecessary padding and radius and realign its contents.
21
+
22
+ **Keep the layout comfortable.** Give content enough room to scan without making it unnecessarily dense or stretching it to fill the frame. Use natural height for simple tasks and extra space for tables, boards, canvases, and other work areas that benefit from it. When everything fits comfortably, keep essential information and actions within one viewport. Adapt to narrow widths, long content, and chat sharing the workspace. Avoid horizontal page scrolling; wide content may scroll within its own bounded region.
23
+
24
+ **Keep layers simple.** Prefer normal document order and bundled overlays with their existing portal and stacking behavior. Custom overlays must preserve applet scope and theme by using the closest `[data-applet]` root. Add minimal local z-index only when document order and a scoped portal cannot resolve the overlap.
22
25
 
23
26
  ## Shared system
24
27
 
28
+ ### Typography
29
+
30
+ **Use a small, consistent set of styles.** Establish clear roles for headings, ordinary content, and supporting information. Text with the same role and importance shares the same typography.
31
+
32
+ Inherit the workspace font and use sentence case. Use regular weight for most text and medium for emphasis, including focal prompts or values when weight helps establish hierarchy. Reserve other weights for explicit user customization.
33
+
34
+ **Choose readable defaults.** Use `text-sm` for controls and general UI, and `text-base` for focused content when space allows. Sizes below `text-sm` should be rare, limited to unusually tight controls. Use larger text for headings or a focal value.
35
+
36
+ Reserve `font-mono` for code, commands, and code-like identifiers. Numeric values, measurements, percentages, timers, timestamps, prices, counts, labels, keyboard shortcuts, and key names use the workspace font. Add `tabular-nums` when stable widths or alignment help.
37
+
38
+ ### Controls
39
+
40
+ **Use familiar controls.** Follow the [UI component guidelines](UI-COMPONENTS.md) and use bundled components with their existing variants, sizes, and shapes. Controls with the same role and importance share component variants. Keep feedback near the action that caused it.
41
+
42
+ ### Icons
43
+
44
+ Use Tabler icons when they clarify meaning, identify a familiar action, or reinforce a focused visual metaphor. Avoid adding an icon to every label or control. Set stroke explicitly: `1.75` at 12–16 px and `1.5` at 20–24 px. Let components control icon size when provided.
45
+
25
46
  ### Color and surfaces
26
47
 
27
- Use `h-full w-full bg-background text-foreground` for most roots. Widgets and views share token
28
- meaning while the host resolves their values differently:
48
+ **Follow the workspace theme.** Use semantic tokens and their matching foregrounds. The default root is `h-full w-full bg-background text-foreground`.
29
49
 
30
- - **Widgets:** `background` is the workspace `primary`, `foreground` is its readable pair, and the
31
- local `primary` pair becomes a derived light action surface. The transparent host frame requires
32
- an opaque root or an opaque fallback behind a full-bleed image or visualization.
33
- - **Views:** tokens inherit the workspace page theme, so the default root matches the page.
34
- - **Floating UI:** menus, tooltips, and popovers use `bg-popover text-popover-foreground` inside
35
- the applet scope.
50
+ For widgets, the host sets the `background` token to the workspace’s `primary`, supplies a readable `foreground`, and derives a light local `primary` action surface. The host wrapper is transparent: each widget must paint its own opaque root, normally with `bg-background`, or provide an opaque fallback behind full-bleed media. Views inherit the page theme.
36
51
 
37
52
  | Intent | Classes and guidance |
38
53
  | --- | --- |
39
- | Main content | `text-foreground` for titles, labels, values, and important icons |
40
- | Supporting content | `text-muted-foreground` for descriptions and secondary information |
54
+ | Main content | `text-foreground` for primary content and controls |
55
+ | Supporting content | `text-muted-foreground` for secondary emphasis |
41
56
  | Inset surface | `bg-card text-card-foreground`, used only for a distinct functional region |
42
57
  | Quiet fill | `bg-muted` for inset regions, skeletons, and disabled structure |
43
58
  | Control state | `bg-accent text-accent-foreground` for hover, active, and selected controls |
@@ -46,164 +61,97 @@ meaning while the host resolves their values differently:
46
61
  | Object edge | `ring-1 ring-border` for complete container and control outlines |
47
62
  | Focus | `focus-visible:ring-2 focus-visible:ring-ring` |
48
63
  | Separator | A one-sided border such as `border-b border-border` between adjacent regions |
64
+ | Floating content | `bg-popover text-popover-foreground` for menus, tooltips, and popovers inside the applet scope |
49
65
 
50
- Use lower foreground opacity only for readable tertiary metadata. Important text needs full
51
- contrast. Saturated surfaces need an explicit readable light or dark foreground. Never rely on
52
- color alone.
53
-
54
- Use rings for complete outlines and one-sided borders for separators; never combine both. Keep
55
- edges subtle and avoid raw high-contrast colors. Derive tonal colors and custom gradients from
56
- local tokens with `color-mix()`. Tailwind palette colors need a content, data, brand, or user reason.
57
- Explain consistent data mappings with labels, legends, shapes, or values. Never use palette colors
58
- for generic decoration or unrelated widget backgrounds. Purple, violet, and fuchsia also need a
59
- reason and never act as a default creativity or technology cue.
66
+ Use `text-foreground` and `text-muted-foreground` together to create clear hierarchy. Keep every level comfortably readable and avoid letting muted text dominate the screen. Communicate meaning through wording, symbols, or shapes as well as color.
60
67
 
61
- Use an open layout. Group with spacing, alignment, type, and occasional separators. Add a surface
62
- only around an interactive object, independent scroller, distinct state, or self-contained work
63
- area. Standard controls keep their surfaces; headers, tabs, summaries, metrics, and ordinary
64
- sections stay unboxed.
68
+ Use additional colors for meaningful data, imagery, brands, a content-linked visual accent, or an explicit user preference. Keep data mappings consistent and understandable. Derive custom tonal treatments from local tokens.
65
69
 
66
- Avoid large rounded page frames, adjacent or nested cards, and structural wrappers. Align content
67
- to shared edges or grid columns. Apply outer padding once, then use gaps. Removing a surface also
68
- means removing its card-like padding and radius and realigning its children.
70
+ **Keep surface treatment restrained.** Use the shared radius scale and existing control shapes. Reserve `rounded-full` for pills, circles, avatars, and status dots; do not turn rectangular controls into capsules. For custom regions, use rings for complete outlines and one-sided borders for separators; avoid doubling them.
69
71
 
70
- ### Stacking and overlays
72
+ **Let texture support readability.** Texture is optional, limited to the root, and backed by an opaque semantic color. Available treatments are `texture-checker`, `texture-grid`, `texture-noise`, `texture-gradient-linear`, and `texture-inset-shadow`.
71
73
 
72
- Use DOM order for normal stacking: later siblings appear above earlier ones. Avoid z-index for
73
- ordinary layout. When floating UI must escape clipping or a local stacking context, portal it into
74
- the closest `[data-applet]` root to preserve applet scope and theme tokens. Never portal applet UI
75
- to `document.body`.
74
+ For dense root content, use plain `bg-background`, `texture-gradient-linear`, or `texture-inset-shadow`. Checker, grid, and noise may surround dense content only when it already needs an opaque work area. Choose a quieter texture before adding containers. Avoid stacking or tuning textures, and omit them behind full-bleed imagery or visualizations. Coordinate related widgets and views.
76
75
 
77
- Add a local, minimal z-index only when DOM order and a scoped portal cannot solve the stacking need.
78
- Several layers or escalating values mean the layout structure needs reconsideration.
76
+ ### Interaction and states
79
77
 
80
- ### Textures
78
+ **Make every action usable.** Controls need clear names, comfortable targets, keyboard support, and visible focus. Charts need understandable labels or equivalent information. Preserve accessibility when simplifying the screen.
81
79
 
82
- Texture is optional and belongs only on the applet root. Choose it after the content layout is
83
- clear, use at most one, and pair it with an opaque semantic base such as
84
- `bg-background text-foreground texture-checker`.
80
+ **Show the states the applet can reach.**
85
81
 
86
- Available treatments are `texture-checker`, `texture-grid`, `texture-noise`,
87
- `texture-gradient-linear`, and `texture-inset-shadow`. They use semantic colors without replacing
88
- the base background color.
82
+ - **Loading:** preserve the expected content shape with a skeleton; use spinners for compact or shapeless work.
83
+ - **Empty:** explain the absence and offer a relevant next step when one exists.
84
+ - **Error:** explain the problem plainly and provide recovery.
85
+ - **Refreshing:** keep existing content visible and show progress near the refresh action.
86
+ - **Stale:** identify outdated information near the affected content.
87
+ - **Disabled:** keep the control recognizable and make its unavailability understandable.
89
88
 
90
- Match treatment to density. Dense root content uses plain `bg-background`,
91
- `texture-gradient-linear`, or `texture-inset-shadow`; sparse content may use any readable texture.
92
- Checker, grid, or noise may surround dense content only when it already needs an opaque or tonal
93
- work surface. Full-bleed images, maps, canvases, and visualizations use no texture.
89
+ Keep the main work surface in the same position and size as states change. Feedback must fit the applet’s available space.
94
90
 
95
- Never add wrappers to rescue a busy texture; choose a quieter root. Do not texture cards, panels,
96
- controls, or text regions, stack textures, or add tuning variables. Check nearby applets: unrelated
97
- applets use different textures, while a widget representing a view shares its texture. Any texture
98
- should become easy to ignore while reading.
91
+ Use brief, interruptible motion to explain changes or acknowledge input. Respect reduced motion, avoid looping decoration and animation on frequently changing numbers, and make audio and video user-initiated.
99
92
 
100
- ### Type
101
-
102
- Inherit the workspace font and use sentence case. Use regular weight for most text and medium for
103
- emphasis; other weights are reserved for owner hand-tuning. `text-sm` (14 px) is the UI default.
104
- Use smaller text for compact metadata and larger text for headings or one display value. Keep at
105
- most two clear type roles and avoid near-identical label styles.
106
-
107
- Reserve `font-mono` for code, commands, and code-like identifiers. Numeric values, measurements,
108
- percentages, timers, timestamps, prices, counts, and labels use the workspace font. Add
109
- `tabular-nums` when stable widths or alignment help.
110
-
111
- ### Icons
112
-
113
- Set `stroke` explicitly on every Tabler icon; the package default of `2` is heavier than the
114
- workspace chrome. Use `1.75` for 12–16 px icons and `1.5` for 20–24 px icons. When a component sets
115
- the icon size, omit `size` and use the stroke that matches its rendered size.
116
-
117
- ### Spacing and shape
118
-
119
- Follow a 4 px spacing rhythm: 4–8 px within a tight group, 12–16 px between groups in a region, and
120
- 24 px or more at section changes in larger applets. Prefer spacing over dividers. Keep repeated
121
- rows, chart labels, status markers, counters, and trailing actions in stable lanes so changing
122
- values do not shift the layout.
123
-
124
- Use the shared radius scale and default control radii. Use `rounded-lg` or `rounded-xl` for
125
- ordinary regions, `rounded-2xl` or `rounded-3xl` for one focal surface, and `rounded-full` only for
126
- real pills, circles, avatars, and status dots. Rectangular controls must not become capsules.
127
-
128
- ### Interaction, motion, and states
93
+ ## Widgets
129
94
 
130
- Controls must be obvious, keyboard-operable, comfortably sized, visibly focused, and accessibly
131
- named. Use Tabler icons with consistent visual weight. Keep charts understandable through labels,
132
- legends, patterns, or direct values as needed.
95
+ **Widgets support a quick glance or immediate action.** Choose the smallest footprint that presents the content clearly. Keep the main information prominent and supporting controls limited to the immediate task. Put tabs, deeper navigation, and multi-step work in a view. Keep hover feedback on controls; leave the widget surface unchanged.
133
96
 
134
- Use short, interruptible motion for meaningful state changes and control feedback. Respect reduced
135
- motion and prefer transform and opacity. Avoid looping decoration and animation on frequently
136
- updating numbers. Audio and video must be user-initiated.
97
+ The host owns the widget’s outer shape, clipping, and elevation. Its wrapper is transparent. Set an opaque background on the widget’s full-size root without adding another outer card.
137
98
 
138
- Design only states the applet can reach. For data-driven applets, handle these when applicable:
99
+ The grid has four columns, 160 px rows, 8 px gaps, and a maximum width of 640 px. Widgets span one to four rows and columns. Width is flexible; height is fixed:
139
100
 
140
- - **Loading:** preserve the final layout and surface with a matching skeleton. Use a spinner only
141
- for compact inline work or work without a meaningful content shape.
142
- - **Error:** explain the problem in one human sentence and offer retry or a clear recovery action.
143
- - **Empty:** explain the absence briefly and provide a useful next step; never leave a data region
144
- blank.
145
- - **Refreshing:** keep current data visible and show progress on the refresh control.
146
- - **Stale:** show a quiet, current timestamp or status near the affected data.
147
- - **Disabled:** preserve the label and structure while making unavailability clear without color
148
- alone.
101
+ `rowSpan × 160 + (rowSpan − 1) × 8`
149
102
 
150
- Keep loading, populated, empty, success, and error layouts stable. A primary surface remains in the
151
- same position and size through those states. Errors and empty states must fit the configured Widget
152
- height or the View's normal content frame.
103
+ Fit content and reachable states within that height without accidental scrolling or clipped controls.
153
104
 
154
- ## Widgets
105
+ ## Views
155
106
 
156
- Widgets are compact dashboard surfaces seen beside other widgets. Their main meaning should be
157
- clear in a quick scan. Larger footprints may add charts, lists, metadata, filters, and direct
158
- actions while preserving one first reading.
107
+ **Views support sustained work.** Each view represents one screen and owns its layout, padding, and scrolling. Establish clear context, a primary work area, and relevant actions. A title is useful when the content does not already establish context.
159
108
 
160
- The host card owns outer radius, border, shadow, clipping, and elevation. Its interior is
161
- transparent. Fill it with an opaque `h-full w-full` root and add no outer card chrome. Use `p-4` as
162
- the compact padding default or `p-5` for larger footprints when content still fits. Use a column
163
- layout when content needs a footer or timestamp and keep lower-priority information at the bottom.
109
+ Prefer one main scroller. Add bounded internal scrolling only when independent scroll positions help the task. Internal tabs, filters, and master-detail layouts may organize the current task. Cross-screen navigation belongs to the workspace; do not add a client-side router.
164
110
 
165
- The grid has four columns, 160 px rows, 8 px gaps, and a maximum width of 640 px. A Widget may span
166
- one to four rows and columns. Width shrinks with the workspace; height remains fixed by row span:
111
+ ## UI copy
167
112
 
168
- `rowSpan × 160 + (rowSpan − 1) × 8`
113
+ Words appear in a design for one reason: to make it easier to understand and use. They are design
114
+ content, not decoration. Bring the same intentionality and minimalism to copywriting that you would
115
+ bring to spacing and color. Before writing anything, ask what the design needs to say, and how it can
116
+ best be said to help the person navigate the experience.
169
117
 
170
- Treat width as flexible and height as the hard constraint. Start with the smallest footprint that
171
- presents the content clearly. Test the narrowest realistic width and longest realistic values.
172
- Clip decorative overflow deliberately, clamp supporting prose, and prevent horizontal page scroll
173
- and accidental inner page scrolling.
118
+ Write from the end user's perspective. Name things in simple language people understand, not by how
119
+ the system is built. Describe what something is or does in plain terms rather than selling it.
120
+ Prefer specific, clear wording over clever wording.
174
121
 
175
- A small Widget has one primary element and at most two supporting groups. Larger footprints may
176
- carry more when hierarchy remains clear. Prefer live information over labels that repeat context.
177
- Limit controls to the immediate task: filters, toggles, refresh actions, and links are appropriate.
178
- Keep feedback on the control and leave the Widget surface unchanged on hover. Tabs, wizards,
179
- multi-step workflows, and deep navigation belong in a View.
122
+ Use active voice by default. An action says exactly what will happen: "Save changes," not "Submit."
123
+ Keep the same action name through the whole flow, so a button labeled "Publish" produces a
124
+ confirmation that says "Published." Interface vocabulary helps people find their way around, and
125
+ consistency helps them learn it.
180
126
 
181
- ## Views
127
+ Treat failure and empty states as moments for direction, not mood. Explain what went wrong and how
128
+ to fix it in the interface's voice. Errors do not apologize, and they are never vague. An empty state
129
+ is an invitation to act.
182
130
 
183
- Views are full app screens for denser information and sustained work. They own page hierarchy,
184
- layout, spacing, chrome, and scrolling. A View must remain complete and usable at the available
185
- width, including when chat shares the workspace.
131
+ Keep the tone conversational: plain verbs, sentence case, no filler. Let each written element do
132
+ exactly one job.
186
133
 
187
- One View represents one screen. Cross-screen navigation belongs to the workspace. Internal tabs,
188
- filters, and master-detail layouts may organize the current task without adding a client-side
189
- router.
134
+ Omit terminal periods in headings, labels, metadata, and short standalone UI lines. Use sentence
135
+ punctuation for paragraphs or multiple complete sentences.
190
136
 
191
- Let content choose the frame. Most Views need clear page context, a primary work area, and an
192
- obvious place for the main action. A title with an optional subtitle or action is a useful default;
193
- a canvas, map, or immersive visualization may establish context another way.
137
+ ## Design slop
194
138
 
195
- Use consistent page padding such as 24 or 32 px. Constrain prose, forms, and narrow task flows to a
196
- readable maximum width. Let tables, boards, maps, and visual workspaces use more of the frame when
197
- the task benefits.
139
+ Design slop is a repeated visual shortcut that makes an interface feel generic or agent-made. Avoid decorative patterns added by habit instead of because they suit the content.
198
140
 
199
- Prefer one main page scroller. Use bounded internal scrolling only where independent position helps,
200
- such as a sticky table body, timeline, or board. Never create horizontal page scroll. Views may use
201
- more sections, controls, and information layers than Widgets while keeping one primary work area;
202
- do not stretch a Widget-like card to fill the page.
141
+ - **Decorative accent lines:** Do not place short colored lines, partial borders, or a single colored edge beside headings, prompts, or values as generic decoration. Choose a visual treatment connected to the content, or leave the area open.
142
+ - **SaaS card kit:** Use repeated cards when they represent a real repeated unit, such as comparable
143
+ metrics, records, or actions. Avoid turning unrelated sections into identical rounded containers
144
+ with the same radius, border, and shadow. Surface treatment should reflect hierarchy and function.
145
+ - **Template chrome:** Avoid stock decoration: all-caps eyebrows, middle-dot metadata,
146
+ `LABEL — fragment` headings, monospace labels, and arrows on every action. Use these patterns only
147
+ when they clarify hierarchy, state, or sequence.
203
148
 
204
149
  ## Final review
205
150
 
206
- Remove elements and wrappers that do not improve understanding, action, or state recognition, then
207
- realign what remains. Confirm the first reading is clear; the visual system stays readable and
208
- purposeful; realistic content and reachable states fit without overflow or jumps; controls are
209
- necessary and accessible; and the applet follows its Widget or View contract.
151
+ - **Focus:** Identify what people notice first and what they can do next. Reduce competing emphasis.
152
+ - **Subtract:** Temporarily remove secondary groups, helper copy, badges, icons, and wrappers. Restore an element when its absence creates a specific problem with the task, a decision, a state, or recovery. A single deliberate visual metaphor may remain when it gives the content recognizable character without adding copy, controls, or containers. Preserve useful content and accessible labels.
153
+ - **Deduplicate:** Read all visible copy together and compare meaning, not wording. When two elements communicate the same context or instruction, keep the clearer one closest to the relevant action.
154
+ - **Character:** Identify the applet’s visual idea. If it relies only on text and standard controls, consider one content-linked accent, metaphor, image, or expressive composition. Keep it subordinate to the main content.
155
+ - **Unify:** Compare text styles and control variants by role, then check their combined emphasis. Merge unnecessary differences in typography, color, spacing, and shape.
156
+ - **Contrast:** Check that contrast creates clear levels of emphasis and the screen does not feel washed out.
157
+ - **Verify:** Check realistic content, narrow widths, reachable states, keyboard use, and whether content that should fit requires scrolling. For widgets, also review how the result sits beside other applets.
@@ -0,0 +1,156 @@
1
+ # Applet intents
2
+
3
+ Intents let an applet act beyond its own UI: open another view, add context to chat, or ask the
4
+ agent to do something. Import these functions from `moi` and call them from user event handlers,
5
+ such as a button click; moi handles the action in the workspace.
6
+
7
+ ## Navigation: `navigate(href)` and `resolveHref(href)`
8
+
9
+ Use the shared [workspace navigation convention](../SKILL.md#workspace-navigation) for addresses
10
+ and query params. Applets navigate through these functions:
11
+
12
+ ```ts
13
+ function navigate(href: string): void
14
+ function resolveHref(href: string): string
15
+ ```
16
+
17
+ ```tsx
18
+ import { navigate, resolveHref } from 'moi'
19
+
20
+ const query = new URLSearchParams({ order: 'o-1024' })
21
+ const href = `moi:/views/orders?${query}`
22
+
23
+ // Prefer anchors for links: copy, middle-click, and new browser tabs work.
24
+ <a href={resolveHref(href)}>Open order</a>
25
+
26
+ // Use the same address from an event handler.
27
+ <button onClick={() => navigate(href)}>Open order</button>
28
+ ```
29
+
30
+ ### View params and history
31
+
32
+ The host passes query values to the view's `params` prop. Missing keys are absent. Decode numbers
33
+ and booleans explicitly, and render sensibly with empty params.
34
+
35
+ ```tsx
36
+ type Params = {
37
+ // Order id to open; omit to show the list.
38
+ order?: string
39
+ }
40
+ type OrdersProps = { params?: Params }
41
+
42
+ export default function Orders({ params = {} }: OrdersProps) {
43
+ const selectedOrder = params.order ?? null
44
+ return <button onClick={() => navigate('moi:/views/orders')}>Close order</button>
45
+ }
46
+ ```
47
+
48
+ See [Views](../SKILL.md#views) for which state belongs in the URL.
49
+
50
+ Normal navigation adds browser history. Back, Forward, reload, and copied links restore the address.
51
+ Tab clicks restore each tab's last address in browser memory. An explicit root link clears params.
52
+ Inactive views keep their own params. Widgets receive no params.
53
+
54
+ ## `addChatAttachment(input)`
55
+
56
+ Use this when the action may need the user's input or modification before sending. It adds
57
+ an attachment to the current draft, opens chat, and focuses the composer, keeping existing
58
+ text intact. The user can revise their message, add or remove attachments, or send attachments
59
+ on their own. Staging works while the agent is busy or unavailable.
60
+
61
+ ### API
62
+
63
+ ```ts
64
+ type AttachmentInput =
65
+ | { type: 'text'; label: string; text: string }
66
+ | { type: 'file'; file: File; path?: never }
67
+ | { type: 'file'; path: string; file?: never }
68
+
69
+ function addChatAttachment(input: AttachmentInput): void
70
+ ```
71
+
72
+ - Text requires a non-empty `label` (up to 120 characters) and non-blank `text` (up to 5,000
73
+ characters). Text is preserved exactly and can contain prose, Markdown, or formatted JSON.
74
+ - Files accept exactly one browser `File` or workspace-root-relative `path`. The filename is
75
+ the label. The existing upload limit is 32 MB; images use the existing image processing.
76
+ - Paths must point to regular files inside the workspace. Absolute paths, traversal, hidden
77
+ path segments, and symlinks escaping the workspace are rejected.
78
+ - A message can contain up to 10 attachments.
79
+
80
+ ### Examples
81
+
82
+ ```tsx
83
+ import { addChatAttachment } from 'moi'
84
+
85
+ // Capture selected applet data as text.
86
+ addChatAttachment({
87
+ type: 'text',
88
+ label: 'Order #1042',
89
+ text: 'Order: 1042\nStatus: delayed'
90
+ })
91
+
92
+ // Attach an existing workspace document.
93
+ addChatAttachment({ type: 'file', path: 'reports/september.pdf' })
94
+
95
+ // Attach a browser-generated file, including an exported drawing.
96
+ addChatAttachment({ type: 'file', file: generatedFile })
97
+ ```
98
+
99
+ ### Limits
100
+
101
+ Call from user event handlers. Text is captured immediately; workspace files are copied when
102
+ the server reads them during staging. Later changes do not update the attachment. Text appears
103
+ as a labelled chip; files use the existing file or image representation.
104
+
105
+ Invalid arguments reject the call without staging anything. File preparation failures remove
106
+ the attachment and show an error toast. File loading blocks sending until it finishes. Errors are recorded in
107
+ `moi debug logs`.
108
+
109
+ Identical text from the same applet with the same label is skipped. Attachments stay with their
110
+ chat in memory and are lost on page reload. Text attachments have no preview or editing UI.
111
+
112
+ ## `sendChatMessage({ message, attachments? })`
113
+
114
+ Use this for a complete, ready-to-run action when the user is not expected to add or change
115
+ anything before it starts. It opens chat, prepares its attachments, and sends automatically.
116
+ The user's draft text and staged attachments stay untouched. Use action copy that makes the
117
+ immediate send clear.
118
+
119
+ ### API
120
+
121
+ ```ts
122
+ function sendChatMessage(input: { message: string; attachments?: AttachmentInput[] }): void
123
+ ```
124
+
125
+ - `message`: required user-visible message, trimmed, non-empty, and at most 1,000 characters.
126
+ - `attachments`: optional list of `AttachmentInput` values, defined above under
127
+ `addChatAttachment`. The same limits and snapshot behavior apply. Supplied order is preserved.
128
+
129
+ ### Example
130
+
131
+ ```tsx
132
+ import { sendChatMessage } from 'moi'
133
+ ;<button
134
+ onClick={() =>
135
+ sendChatMessage({
136
+ message: 'Review this order',
137
+ attachments: [
138
+ { type: 'text', label: 'Order #1042', text: 'Status: delayed' },
139
+ { type: 'file', path: 'reports/order-1042.pdf' }
140
+ ]
141
+ })
142
+ }
143
+ >
144
+ Review order
145
+ </button>
146
+ ```
147
+
148
+ ### Limits
149
+
150
+ Invalid arguments or a failed attachment reject the entire send. File preparation shows a
151
+ loading notice; failures show an error and are recorded in `moi debug logs`. Switching chats
152
+ or workspaces while files are preparing cancels the send, even if the user switches back.
153
+
154
+ Identical messages from the same applet within two seconds are dropped; the workspace allows
155
+ up to 10 applet sends per minute. Calls are dropped when the agent is unavailable, including
156
+ if it becomes unavailable during preparation.