moi-computer 0.11.1-next.2 → 0.11.1-next.4

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 (222) hide show
  1. package/README.md +2 -2
  2. package/client/app/AppRouter.tsx +2 -2
  3. package/client/app/routes/WorkspaceRoute.tsx +7 -9
  4. package/client/app/shell/SidebarLayout.tsx +18 -15
  5. package/client/components/shared/BottomPanel.tsx +26 -14
  6. package/client/components/shared/PanelHeader.tsx +1 -1
  7. package/client/components/shared/ReorderableList.tsx +7 -2
  8. package/client/components/shared/WorkspaceIcon.tsx +92 -0
  9. package/client/components/ui/alert-dialog.tsx +1 -0
  10. package/client/components/ui/checkbox.tsx +1 -0
  11. package/client/components/ui/inline-input.tsx +84 -0
  12. package/client/components/ui/toast.tsx +2 -2
  13. package/client/features/applets/AppletMount.tsx +1 -1
  14. package/client/features/applets/applet-cache.ts +3 -3
  15. package/client/features/applets/applet-runtime.ts +147 -108
  16. package/client/features/applets/applet-styles.ts +2 -2
  17. package/client/features/applets/applet-thumbnail.ts +6 -8
  18. package/client/features/applets/useApplet.ts +10 -9
  19. package/client/features/chat/ChatPanel.tsx +19 -10
  20. package/client/features/chat/ChatPopup.tsx +7 -2
  21. package/client/features/chat/applet-chat-intents.ts +170 -0
  22. package/client/features/chat/chat-send.ts +103 -62
  23. package/client/features/chat/chat-store.ts +50 -59
  24. package/client/features/chat/composer/ChatComposer.tsx +43 -132
  25. package/client/features/chat/composer/ModelPicker.tsx +3 -16
  26. package/client/features/chat/composer/attachments/AttachmentChip.tsx +99 -0
  27. package/client/features/chat/composer/attachments/DrawingAttachmentChip.tsx +37 -0
  28. package/client/features/chat/composer/attachments/FileAttachmentChip.tsx +22 -0
  29. package/client/features/chat/composer/attachments/TextAttachmentChip.tsx +11 -0
  30. package/client/features/chat/composer/attachments/draft-attachments.ts +168 -0
  31. package/client/features/chat/composer/attachments/types.ts +25 -0
  32. package/client/features/chat/composer/attachments/uploads.ts +26 -0
  33. package/client/features/chat/{chat-connection.ts → connection/chat-connection.ts} +1 -1
  34. package/client/features/chat/{chat-frames.ts → connection/chat-frames.ts} +2 -2
  35. package/client/features/chat/{ChatEmptyState.tsx → messages/ChatEmptyState.tsx} +16 -11
  36. package/client/features/chat/{MarkdownContent.tsx → messages/MarkdownContent.tsx} +16 -1
  37. package/client/features/chat/{TurnView.tsx → messages/TurnView.tsx} +22 -15
  38. package/client/features/chat/{tool-group → messages/tool-group}/SubagentCard.tsx +1 -1
  39. package/client/features/chat/{tool-group → messages/tool-group}/TimelineRow.tsx +2 -2
  40. package/client/features/chat/{tool-group → messages/tool-group}/ToolCallGroup.tsx +1 -1
  41. package/client/features/chat/{ChatSelector.tsx → sessions/ChatSelector.tsx} +3 -3
  42. package/client/features/chat/{api.ts → sessions/api.ts} +1 -1
  43. package/client/features/chat/useChat.ts +32 -15
  44. package/client/features/dev/ChatStatesPage.tsx +5 -6
  45. package/client/features/dev/HarnessDebugPage.tsx +10 -7
  46. package/client/features/dev/ToolCallsPage.tsx +1 -1
  47. package/client/features/dev/UiComponentPreviews.tsx +21 -0
  48. package/client/features/dev/chat-states-fixtures.ts +13 -2
  49. package/client/features/drawings/useChatAnnotation.ts +17 -17
  50. package/client/features/drawings/useDrawingLayer.ts +7 -9
  51. package/client/features/drawings/useViewBuilderSketch.ts +18 -15
  52. package/client/features/home/HomePage.tsx +8 -7
  53. package/client/features/home/WorkspacePreview.tsx +1 -1
  54. package/client/features/home/workspace-presentation.tsx +1 -11
  55. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +2 -4
  56. package/client/features/overview/HiddenPanel.tsx +109 -0
  57. package/client/features/overview/Overview.tsx +302 -0
  58. package/client/features/overview/WidgetCanvas.tsx +164 -0
  59. package/client/features/{widgets → overview}/WidgetFrame.tsx +24 -16
  60. package/client/features/overview/WorkspaceName.tsx +60 -0
  61. package/client/features/overview/api.ts +30 -0
  62. package/client/features/overview/default/ViewsWidget.tsx +252 -0
  63. package/client/features/overview/default/registry.tsx +36 -0
  64. package/client/features/{widgets → overview}/grid.ts +36 -0
  65. package/client/features/overview/useGridReconcile.ts +94 -0
  66. package/client/features/scratchpad/Scratchpad.tsx +7 -8
  67. package/client/features/scratchpad/ScratchpadControls.tsx +0 -1
  68. package/client/features/scratchpad/useScratchpadSnapshot.tsx +23 -13
  69. package/client/features/settings/GeneralSettings.tsx +55 -58
  70. package/client/features/settings/SettingsLayout.tsx +2 -2
  71. package/client/features/settings/WorkspaceIconPicker.tsx +318 -0
  72. package/client/features/settings/WorkspaceSettingsDialog.tsx +65 -0
  73. package/client/features/settings/api.ts +48 -24
  74. package/client/features/views/ViewBuilder.tsx +5 -4
  75. package/client/features/views/ViewManager.tsx +11 -13
  76. package/client/features/views/api.ts +36 -2
  77. package/client/features/views/useViewBuilderActions.ts +8 -5
  78. package/client/features/views/useViewBuilderDrafts.ts +23 -21
  79. package/client/features/views/view-presentation.ts +13 -0
  80. package/client/features/workspace/{CustomizePanel.tsx → ThemePanel.tsx} +26 -31
  81. package/client/features/workspace/UnavailablePage.tsx +21 -0
  82. package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -7
  83. package/client/features/workspace/WorkspaceScreen.tsx +205 -161
  84. package/client/features/workspace/WorkspaceSplitLayout.tsx +1 -1
  85. package/client/features/workspace/WorkspaceTabs.tsx +2 -0
  86. package/client/features/workspace/api.ts +0 -26
  87. package/client/features/workspace/moi-context.ts +8 -9
  88. package/client/features/workspace/tab-resolution.ts +10 -33
  89. package/client/features/workspace/useWorkspaceNavigation.ts +164 -101
  90. package/client/index.css +1 -1
  91. package/client/lib/app-icon-registry.ts +2 -0
  92. package/client/lib/use-latest-ref.ts +11 -0
  93. package/client/main.tsx +1 -1
  94. package/client/runtime/useWorkspaceEvents.ts +59 -14
  95. package/client/theme.css +5 -5
  96. package/dist/chunk-2gs8jjx4.css +1 -0
  97. package/dist/chunk-7vvg5fyz.js +68 -0
  98. package/dist/chunk-94m3q9ce.js +1 -0
  99. package/dist/{chunk-w482ew2c.js → chunk-brr0zbeh.js} +73 -73
  100. package/dist/chunk-by2wqgak.js +1 -0
  101. package/dist/chunk-m1fvqssh.js +2 -0
  102. package/dist/chunk-p34hvqt3.js +1 -0
  103. package/dist/{chunk-4s15axjs.js → chunk-p83f0jnj.js} +2 -2
  104. package/dist/{chunk-j3wvxjr7.js → chunk-tzz101ea.js} +1 -1
  105. package/dist/chunk-xg01f6pn.js +10 -0
  106. package/dist/{chunk-53a7pxcz.js → chunk-zs4mte79.js} +1 -1
  107. package/dist/index.html +1 -1
  108. package/lib/app-icons.ts +1 -0
  109. package/lib/applet-selector.ts +24 -0
  110. package/lib/chat-title.ts +6 -1
  111. package/lib/default-widgets.ts +32 -0
  112. package/lib/format.ts +12 -1
  113. package/lib/message-attachments.ts +40 -0
  114. package/lib/moi-attachments.ts +204 -0
  115. package/lib/moi-context.ts +20 -35
  116. package/lib/navigation.ts +84 -0
  117. package/lib/types.ts +81 -25
  118. package/lib/workspace-icon.ts +20 -0
  119. package/lib/workspace-layout.ts +22 -2
  120. package/lib/workspace-tabs.ts +9 -33
  121. package/package.json +27 -27
  122. package/registry.json +13 -0
  123. package/server/AGENTS.md +1 -0
  124. package/server/api.ts +114 -37
  125. package/server/applet-typecheck.ts +95 -0
  126. package/server/{bundler → applets}/build-applet.ts +13 -246
  127. package/server/applets/config.ts +226 -0
  128. package/server/applets/dependencies.ts +206 -0
  129. package/server/{applets.ts → applets/index.ts} +15 -161
  130. package/server/applets/runtime/base.ts +4 -0
  131. package/server/applets/runtime/moi.ts +42 -0
  132. package/server/applets/runtime/rpc.ts +17 -0
  133. package/server/applets/view-source.ts +67 -0
  134. package/server/attachment-message.ts +95 -0
  135. package/server/cli.ts +163 -97
  136. package/server/control.ts +63 -42
  137. package/server/harness/README.md +4 -2
  138. package/server/harness/acp/adapter.ts +7 -21
  139. package/server/harness/acp/session.ts +31 -50
  140. package/server/harness/claude-code/NOTES.md +8 -2
  141. package/server/harness/claude-code/adapter.ts +8 -25
  142. package/server/harness/claude-code/index.ts +2 -0
  143. package/server/harness/claude-code/session.ts +42 -47
  144. package/server/harness/claude-code/sessions.ts +9 -4
  145. package/server/harness/codex/adapter.ts +8 -7
  146. package/server/harness/codex/index.ts +1 -0
  147. package/server/harness/codex/permissions.ts +1 -1
  148. package/server/harness/codex/session.ts +20 -47
  149. package/server/harness/hermes/NOTES.md +1 -1
  150. package/server/harness/hermes/index.ts +4 -0
  151. package/server/harness/openclaw/NOTES.md +1 -1
  152. package/server/harness/openclaw/adapter.ts +22 -4
  153. package/server/harness/openclaw/gateway.ts +5 -3
  154. package/server/harness/openclaw/session.ts +27 -27
  155. package/server/harness/types.ts +5 -3
  156. package/server/layout.ts +9 -14
  157. package/server/moi-scaffold.ts +21 -13
  158. package/server/navigation-relay.ts +110 -0
  159. package/server/registry.ts +8 -0
  160. package/server/selected-session.ts +24 -4
  161. package/server/skill-update.ts +5 -3
  162. package/server/skill-version.ts +4 -7
  163. package/server/skills-template.ts +48 -9
  164. package/server/tabs.ts +19 -33
  165. package/server/uploads.ts +0 -0
  166. package/server/view-builders.ts +18 -1
  167. package/server/views.ts +126 -6
  168. package/server/web.ts +35 -9
  169. package/server/widgets.ts +12 -5
  170. package/server/workspace-config.ts +13 -9
  171. package/ui-components/button.tsx +2 -2
  172. package/ui-components/docs/kbd.md +191 -0
  173. package/ui-components/dropdown-menu.tsx +1 -1
  174. package/ui-components/kbd.tsx +32 -0
  175. package/ui-components/slider.tsx +1 -1
  176. package/ui-components/switch.tsx +1 -1
  177. package/ui-components/tabs.tsx +1 -1
  178. package/workspace/.claude/skills/moi-workspace/SKILL.md +284 -228
  179. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +100 -153
  180. package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +156 -0
  181. package/client/features/chat/attachment-staging.ts +0 -153
  182. package/client/features/chat/uploads.ts +0 -18
  183. package/client/features/chat/useAppletChatMessage.ts +0 -68
  184. package/client/features/settings/IconPicker.tsx +0 -442
  185. package/client/features/settings/WorkspaceSettings.tsx +0 -95
  186. package/client/features/settings/render-icon.ts +0 -173
  187. package/client/features/widgets/HiddenPanel.tsx +0 -80
  188. package/client/features/widgets/WidgetGrid.tsx +0 -123
  189. package/client/features/widgets/Widgets.tsx +0 -262
  190. package/client/features/widgets/useGridReconcile.ts +0 -73
  191. package/dist/chunk-245wt82v.css +0 -1
  192. package/dist/chunk-87thzbtw.js +0 -2
  193. package/dist/chunk-a6jad1a6.js +0 -1
  194. package/dist/chunk-dghwstd2.js +0 -9
  195. package/dist/chunk-eg120aca.js +0 -1
  196. package/dist/chunk-j7hh2ab4.js +0 -70
  197. package/dist/chunk-y8eyahwx.js +0 -1
  198. /package/client/features/chat/{ChatPromptBubbles.tsx → messages/ChatPromptBubbles.tsx} +0 -0
  199. /package/client/features/chat/{ShimmerText.tsx → messages/ShimmerText.tsx} +0 -0
  200. /package/client/features/chat/{group-turns.ts → messages/group-turns.ts} +0 -0
  201. /package/client/features/chat/{interleave-notices.ts → messages/interleave-notices.ts} +0 -0
  202. /package/client/features/chat/{preview-turn.ts → messages/preview-turn.ts} +0 -0
  203. /package/client/features/chat/{tool-group → messages/tool-group}/CodeBlock.tsx +0 -0
  204. /package/client/features/chat/{tool-group → messages/tool-group}/Collapse.tsx +0 -0
  205. /package/client/features/chat/{tool-group → messages/tool-group}/ReadImagePreview.tsx +0 -0
  206. /package/client/features/chat/{tool-group → messages/tool-group}/ToolOutput.tsx +0 -0
  207. /package/client/features/chat/{tool-group → messages/tool-group}/detect.ts +0 -0
  208. /package/client/features/chat/{tool-group → messages/tool-group}/fixtures.ts +0 -0
  209. /package/client/features/chat/{tool-group → messages/tool-group}/format/claude.ts +0 -0
  210. /package/client/features/chat/{tool-group → messages/tool-group}/format/codex.ts +0 -0
  211. /package/client/features/chat/{tool-group → messages/tool-group}/format/hermes.ts +0 -0
  212. /package/client/features/chat/{tool-group → messages/tool-group}/format/index.ts +0 -0
  213. /package/client/features/chat/{tool-group → messages/tool-group}/format/mcp.ts +0 -0
  214. /package/client/features/chat/{tool-group → messages/tool-group}/format/openclaw.ts +0 -0
  215. /package/client/features/chat/{tool-group → messages/tool-group}/format/shared.ts +0 -0
  216. /package/client/features/chat/{tool-group → messages/tool-group}/format/shell.ts +0 -0
  217. /package/client/features/chat/{tool-group → messages/tool-group}/index.ts +0 -0
  218. /package/client/features/chat/{useStickToBottom.ts → messages/useStickToBottom.ts} +0 -0
  219. /package/client/features/chat/{session-view.ts → sessions/session-view.ts} +0 -0
  220. /package/client/features/chat/{useSelectedSession.ts → sessions/useSelectedSession.ts} +0 -0
  221. /package/server/{bundler → applets}/applet-css.ts +0 -0
  222. /package/server/{bundler → applets}/build-worker.ts +0 -0
package/lib/types.ts CHANGED
@@ -1,8 +1,20 @@
1
1
  import type { PreviewBlock, StreamEvent } from './format'
2
+ import type { AppIconId } from './app-icons'
3
+ import type { MoiContext } from './moi-context'
4
+ import type { WorkspaceTheme } from './themes'
2
5
 
3
6
  // A custom UI unit embedded in a workspace.
4
7
  export type AppletKind = 'view' | 'widget'
5
8
 
9
+ // What a bundled applet's `moi` module may call on its host-attached bridge.
10
+ // Inputs stay unknown at this trust boundary; the browser host narrows them.
11
+ export type AppletBridge = {
12
+ addChatAttachment: (input: unknown) => void
13
+ navigate: (href: unknown) => void
14
+ resolveHref: (href: unknown) => string
15
+ sendChatMessage: (input: unknown, context?: unknown) => void
16
+ }
17
+
6
18
  export type AppletInfo = {
7
19
  id: string
8
20
  // Content revision of the built bundle (`<size>-<mtime>` of index.js).
@@ -68,7 +80,7 @@ export type ViewBuilder = {
68
80
  // server-side (bundle pipeline, RPC route); `load`/`render`/`window`/`runtime`
69
81
  // are browser-side and reach the journal via POST
70
82
  // /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
83
+ // request rather than code throwing — a `navigate` to a view that no longer
72
84
  // exists, a `sendChatMessage` dropped by the rate limit — which the applet's
73
85
  // own code never sees.
74
86
  export type AppletLogSource = 'build' | 'load' | 'render' | 'window' | 'rpc' | 'runtime'
@@ -184,11 +196,45 @@ export type ScratchOpResult = { name: string } | { image: string } | { ok: true
184
196
  // the snapshot can name the version it needs (see lib/scratchpad-skew.ts).
185
197
  export type ScratchpadWriter = { moi: string; tldraw: string }
186
198
 
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.
199
+ // Attachments: caller input → upload receipt → send reference → resolved data.
200
+ // Text skips uploading. Origin and drawing purpose follow the attachment.
201
+ export type DrawingPurpose = 'annotation' | 'sketch'
202
+
203
+ // Host-stamped ID of the applet or workspace tab that created the attachment.
204
+ export type AttachmentOrigin = { source: string }
205
+
206
+ export type TextAttachment = Partial<AttachmentOrigin> & { label: string; text: string }
207
+
208
+ type FileAttachment = Partial<AttachmentOrigin> & {
209
+ mediaType: string
210
+ path: string
211
+ // Only set when the file contains a drawing image.
212
+ purpose?: DrawingPurpose
213
+ }
214
+
215
+ type ImageAttachment = Partial<AttachmentOrigin> & {
216
+ mediaType: string
217
+ label: string
218
+ purpose?: DrawingPurpose
219
+ }
220
+
221
+ // Resolved payloads: JSON-safe data shared by prompts and transcript replay.
222
+ export type Attachment =
223
+ | ({ type: 'text' } & TextAttachment)
224
+ | ({ type: 'file' } & FileAttachment)
225
+ | ({ type: 'image' } & ImageAttachment)
226
+
227
+ // Caller input: text or a browser file / workspace-relative path.
228
+ export type TextAttachmentInput = Pick<TextAttachment, 'label' | 'text'>
229
+
230
+ type FileAttachmentInput = { file: File; path?: never } | { path: string; file?: never }
231
+
232
+ export type AttachmentInput =
233
+ | ({ type: 'text' } & TextAttachmentInput)
234
+ | ({ type: 'file' } & FileAttachmentInput)
235
+
236
+ // Upload receipt: returned by the upload API before sending the message.
237
+ // Bytes or an absolute file path live in the server's workspace-scoped store.
192
238
  export type UploadKind = 'image' | 'file'
193
239
  export type UploadInfo = {
194
240
  id: string
@@ -202,9 +248,13 @@ export type UploadInfo = {
202
248
  height?: number
203
249
  }
204
250
 
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.
251
+ // Send reference: inline text or an upload ID for the server to resolve.
252
+ // Drawing purpose belongs to this message's use of the uploaded image.
253
+ export type MessageAttachment =
254
+ | ({ type: 'text' } & TextAttachment)
255
+ | ({ type: 'upload'; uploadId: string; purpose?: DrawingPurpose } & Partial<AttachmentOrigin>)
256
+
257
+ // Client → server messages, routed by workspaceId over the shared WebSocket.
208
258
  export type ClientMessage =
209
259
  | {
210
260
  type: 'chat'
@@ -212,10 +262,9 @@ export type ClientMessage =
212
262
  content: string
213
263
  sessionId: string
214
264
  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[]
265
+ // Text and upload references for this turn. The server resolves uploads
266
+ // and describes all attachments together, preserving their order.
267
+ attachments?: MessageAttachment[]
219
268
  // Client-chosen stable id for the user's turn. The server tells the
220
269
  // adapter to use this id when the SDK echoes the user input back, so
221
270
  // the optimistic bubble the client rendered gets upserted in place.
@@ -240,7 +289,7 @@ export type ClientMessage =
240
289
  // snapshotted at send time, assembled by
241
290
  // client/features/workspace/moi-context.ts. The server renders it per
242
291
  // harness; display paths strip the rendered envelope from bubbles.
243
- context?: import('./moi-context').MoiContext
292
+ context?: MoiContext
244
293
  }
245
294
  | { type: 'stop'; workspaceId: string; sessionId: string }
246
295
  // Reply to a relayed Scratchpad op (see ScratchpadOpMessage). Carries the
@@ -436,6 +485,11 @@ export type AgentLoginState =
436
485
  | { state: 'pending'; url?: string }
437
486
  | { state: 'failed'; reason: string }
438
487
 
488
+ export type WorkspaceIcon =
489
+ | { type: 'emoji'; value: string; background?: 'theme' }
490
+ | { type: 'glyph'; value: AppIconId; background?: 'theme' }
491
+ | { type: 'upload'; value: string }
492
+
439
493
  // One MCP server's connection status, as surfaced by GET /api/workspaces/:id/mcp
440
494
  // (a subset of the agent SDK's McpServerStatus — only what the UI renders).
441
495
  export type McpServerState = 'connected' | 'failed' | 'needs-auth' | 'pending' | 'disabled'
@@ -454,9 +508,11 @@ export type WorkspaceEntry = {
454
508
  // basename). Persisted so we don't re-probe the gateway for each listing.
455
509
  // The list endpoint overrides this with the live layout `name` when set.
456
510
  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
511
+ // Workspace icon override. Undefined uses the provider icon.
512
+ icon?: WorkspaceIcon
513
+ // Merged in from the layout so app-wide workspace lists can paint a themed
514
+ // icon without inheriting the active workspace's color.
515
+ theme?: WorkspaceTheme
460
516
  // Home-relative rendering of `path` (e.g. "~/.openclaw/workspace"). Set by
461
517
  // the server on the wire — clients render it as-is.
462
518
  displayPath?: string
@@ -529,10 +585,10 @@ export type LayoutMode = 'fullscreen' | 'split'
529
585
 
530
586
  export type WorkspaceTabId =
531
587
  | 'agent'
532
- | 'widgets'
588
+ | 'overview'
533
589
  | 'scratchpad'
534
- | `view:${string}`
535
- | `view-builder:${string}`
590
+ | `views/${string}`
591
+ | `view-builders/${string}`
536
592
 
537
593
  // Open tabs plus the workspace's saved DEFAULT tab. `active` is not live focus
538
594
  // state — the live active tab is each browser tab's URL (`/workspace/:id/<tab>`).
@@ -556,9 +612,8 @@ export type WorkspaceLayout = {
556
612
  // User-set display-name override. When empty/undefined the API falls back to
557
613
  // the workspace folder name, so the resolved name always comes from the API.
558
614
  name?: string
559
- // Workspace icon override — a base64 data URL (128×128 transparent WebP,
560
- // produced by the server). Undefined falls back to the provider icon.
561
- icon?: string
615
+ // Workspace icon override. Emoji and glyphs may use a themed background.
616
+ icon?: WorkspaceIcon
562
617
  // Model id chosen in the composer picker (`supportedModels()` `value`, an
563
618
  // alias like `sonnet`). Persisted so the choice survives a reload. Sent with
564
619
  // each chat frame; undefined means the agent runs on the SDK default. Note
@@ -574,7 +629,7 @@ export type WorkspaceLayout = {
574
629
  selectedEffort?: string
575
630
  // Fast-mode default for new sessions. Undefined inherits the provider setting.
576
631
  selectedFastMode?: boolean
577
- theme?: import('./themes').WorkspaceTheme
632
+ theme?: WorkspaceTheme
578
633
  }
579
634
 
580
635
  // One applet's thumbnail freshness record. Image bytes live as files in the
@@ -657,7 +712,8 @@ export type Model = {
657
712
  resolvedModel?: string
658
713
  // Human-readable label (Claude `displayName`; OpenClaw `name`).
659
714
  displayName: string
660
- // " · "-joined blurb (Claude): "<headline> · <tagline> · …". Absent for OpenClaw.
715
+ // One-line blurb (Claude: "Most efficient for everyday tasks"). Not shown by
716
+ // the picker. Absent for OpenClaw.
661
717
  description?: string
662
718
  // Heading this model sits under in the picker (Hermes: the upstream provider,
663
719
  // e.g. 'Ollama'). Absent when the backend serves one flat catalog.
@@ -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
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moi-computer",
3
- "version": "0.11.1-next.2",
3
+ "version": "0.11.1-next.4",
4
4
  "description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
@@ -63,71 +63,71 @@
63
63
  "@anthropic-ai/sdk": "^0.109.1",
64
64
  "@babel/parser": "^7.29.8",
65
65
  "@base-ui/react": "^1.8.0",
66
- "@blobatar/react": "^2.2.0",
66
+ "@blobatar/react": "^2.7.0",
67
67
  "@dnd-kit/core": "^6.3.1",
68
- "@tabler/icons-react": "^3.44.0",
69
- "@tailwindcss/typography": "^0.5.19",
70
- "@tanstack/react-query": "^5.100.1",
68
+ "@tabler/icons-react": "^3.46.0",
69
+ "@tailwindcss/typography": "^0.5.20",
70
+ "@tanstack/react-query": "^5.102.8",
71
71
  "@tldraw/store": "5.2.3",
72
72
  "@tldraw/tlschema": "5.2.3",
73
73
  "@tldraw/utils": "5.2.3",
74
+ "@types/bun": "1.3.10",
74
75
  "agentation": "^2.3.3",
75
- "blobatar": "^2.2.0",
76
+ "blobatar": "^2.7.0",
76
77
  "bun-plugin-tailwind": "^0.1.2",
77
- "citty": "^0.2.1",
78
+ "citty": "^0.2.2",
78
79
  "class-variance-authority": "^0.7.1",
79
80
  "clsx": "^2.1.1",
80
81
  "conf": "^15.1.0",
81
82
  "culori": "^4.0.2",
82
- "devalue": "^5.6.4",
83
+ "devalue": "^5.9.2",
83
84
  "env-paths": "^4.0.0",
84
85
  "frimousse": "^0.3.0",
85
86
  "highlight.js": "^10.7.3",
86
- "hono": "^4.12.26",
87
- "lru-cache": "^11.3.5",
87
+ "hono": "^4.13.7",
88
+ "lru-cache": "^11.5.2",
88
89
  "modern-screenshot": "^4.7.0",
89
- "motion": "^12.35.1",
90
+ "motion": "^12.43.0",
90
91
  "nanoevents": "^10.0.0",
91
- "nanoid": "^6.0.0",
92
+ "nanoid": "^6.0.1",
92
93
  "pathe": "^2.0.3",
93
94
  "picocolors": "^1.1.1",
94
- "postcss": "^8.5.19",
95
+ "postcss": "^8.5.28",
95
96
  "react": "19.2.4",
96
97
  "react-dom": "19.2.4",
97
- "react-grid-layout": "^2.2.3",
98
+ "react-grid-layout": "^2.2.4",
98
99
  "react-markdown": "^10.1.0",
99
- "react-resizable": "^3.1.3",
100
- "react-resizable-panels": "^4.12.2",
100
+ "react-resizable": "^3.2.0",
101
+ "react-resizable-panels": "^4.12.4",
101
102
  "rehype-highlight": "^7.0.2",
102
103
  "remark-gfm": "^4.0.1",
103
104
  "shadcn": "4.21.0",
104
- "sharp": "^0.35.1",
105
+ "sharp": "^0.35.4",
105
106
  "shell-quote": "^1.10.0",
106
- "sugar-high": "^1.2.1",
107
+ "sugar-high": "^1.3.0",
107
108
  "tailwind-merge": "^3.6.0",
108
109
  "tailwindcss": "^4.3.3",
109
110
  "tldraw": "5.2.3",
110
111
  "tw-animate-css": "^1.4.0",
111
- "wouter": "^3.9.0",
112
- "zustand": "^5.0.12"
112
+ "typescript": "^5.9.3",
113
+ "wouter": "^3.11.0",
114
+ "zustand": "^5.0.15"
113
115
  },
114
116
  "optionalDependencies": {
115
117
  "openclaw": "2026.7.1"
116
118
  },
117
119
  "devDependencies": {
118
- "@agentclientprotocol/sdk": "^1.3.0",
120
+ "@agentclientprotocol/sdk": "^1.4.0",
119
121
  "@babel/types": "^7.29.8",
120
- "@types/bun": "latest",
121
122
  "@types/culori": "^4.0.1",
122
- "@types/react": "^19",
123
- "@types/react-dom": "^19",
123
+ "@types/react": "^19.2.18",
124
+ "@types/react-dom": "^19.2.7",
124
125
  "@types/react-grid-layout": "^2.1.0",
125
126
  "date-fns": "^4.4.0",
126
127
  "embla-carousel-react": "^8.6.0",
127
128
  "oxfmt": "^0.54.0",
128
- "oxlint": "^1.69.0",
129
+ "oxlint": "^1.82.0",
129
130
  "react-day-picker": "^10.0.1",
130
- "recharts": "3.8.0",
131
- "typescript": "^5.9.3"
131
+ "recharts": "3.8.0"
132
132
  }
133
133
  }
package/registry.json CHANGED
@@ -377,6 +377,19 @@
377
377
  "title": "Input Group",
378
378
  "description": "Input with attached addons, buttons, or icons"
379
379
  },
380
+ {
381
+ "name": "kbd",
382
+ "type": "registry:ui",
383
+ "registryDependencies": ["molefrog/moi/utils"],
384
+ "files": [
385
+ {
386
+ "path": "ui-components/kbd.tsx",
387
+ "type": "registry:ui"
388
+ }
389
+ ],
390
+ "title": "Kbd",
391
+ "description": "Keyboard keys and shortcut combinations"
392
+ },
380
393
  {
381
394
  "name": "label",
382
395
  "type": "registry:ui",
package/server/AGENTS.md CHANGED
@@ -4,6 +4,7 @@ Bun server on port 13337. Serves the client at `/`, upgrades `/ws` to WebSocket.
4
4
  - `api.ts` is the Hono REST API (all `/api/*` routes). `withWorkspace` middleware resolves `:id` → workspace (404 if missing) and stashes it on the context, so handlers read `c.get('ws')`. Its catch-all serves the prebuilt client from `dist/` in prod via Hono's `serveStatic` (cached, traversal-safe).
5
5
  - `static.ts` exposes the `dist/` location (`DIST_DIR`), the `prebuilt` flag, and the prod SPA `distShell`. `events.ts` holds `publishEvent` (server→client live-event broadcast over `/api/workspaces/ws`) decoupled from `web.ts` to avoid an import cycle; `web.ts` wires it via `setEventServer`.
6
6
  - `state.ts` holds the connected chat clients and `broadcast()` (which also feeds the harness debug tap).
7
+ - `applets/` owns shared view/widget machinery: dependency analysis, compilation, CSS scoping, bundle serving, and view source edits/cleanup. `views.ts` and `widgets.ts` own each kind's manifests and events.
7
8
  - `harness/` holds every agent backend (Claude Code, OpenClaw, Codex): per-harness adapter + session + transport + protocol NOTES, colocated. Read `harness/README.md` for the message-type layers, the adapter contract, and the folder conventions before touching agent-backend code.
8
9
  - WebSocket protocol: server sends `ServerMessage`, client sends `ClientMessage` — both defined in `lib/types.ts`.
9
10
  - Never import `react`, `react-dom`, or the `tldraw` package from `server/` or `lib/` — the server must not evaluate React (a global install can pair mismatched `react`/`react-dom` copies, and `react-dom` then throws at load). The scratchpad writer uses `@tldraw/store` + `@tldraw/tlschema` instead; `server/test/server-react-free.test.ts` enforces this. See `docs/moi-scratchpad.md`.