moi-computer 0.3.0-next.2 → 0.3.0-next.3

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 (125) hide show
  1. package/README.md +1 -1
  2. package/client/AGENTS.md +2 -2
  3. package/client/api/http.ts +1 -1
  4. package/client/api/workspace-keys.ts +1 -0
  5. package/client/app/AppRouter.tsx +14 -5
  6. package/client/app/routes/HomeRoute.tsx +1 -1
  7. package/client/app/routes/WorkspaceRoute.tsx +8 -2
  8. package/client/app/shell/SidebarLayout.tsx +10 -5
  9. package/client/assets/openai.svg +3 -0
  10. package/client/components/shared/BottomPanel.tsx +2 -2
  11. package/client/components/ui/button.tsx +3 -2
  12. package/client/components/ui/input.tsx +1 -1
  13. package/client/features/applets/AppletMount.tsx +44 -0
  14. package/client/features/applets/WidgetShell.tsx +4 -1
  15. package/client/features/applets/applet-cache.ts +8 -0
  16. package/client/features/applets/applet-styles.ts +61 -0
  17. package/client/features/chat/ChatComposer.tsx +2 -2
  18. package/client/features/chat/ChatPanel.tsx +8 -25
  19. package/client/features/chat/ChatPopup.tsx +3 -3
  20. package/client/features/chat/{ThreadSelector.tsx → ChatSelector.tsx} +4 -4
  21. package/client/features/chat/TurnView.tsx +8 -9
  22. package/client/features/chat/api.ts +1 -1
  23. package/client/features/chat/chat-send.ts +57 -0
  24. package/client/features/chat/tool-group/ToolCallGroup.tsx +2 -1
  25. package/client/features/chat/tool-group/format.ts +117 -0
  26. package/client/features/chat/useChat.ts +10 -34
  27. package/client/features/connectors/McpMenu.tsx +4 -21
  28. package/client/features/dev/DevRoutes.tsx +18 -0
  29. package/client/features/dev/HarnessDebugPage.tsx +468 -0
  30. package/client/{components/playground → features/dev}/PlaygroundPage.tsx +1 -1
  31. package/client/features/home/CreateWorkspaceDialog.tsx +64 -158
  32. package/client/features/home/CreateWorkspaceDialogSteps.tsx +234 -0
  33. package/client/features/home/HomeLogo.tsx +344 -0
  34. package/client/features/home/HomePage.tsx +15 -21
  35. package/client/features/home/WorkspacePreview.tsx +2 -2
  36. package/client/features/home/api.ts +11 -3
  37. package/client/features/home/workspace-presentation.tsx +4 -4
  38. package/client/features/settings/GeneralSettings.tsx +3 -3
  39. package/client/features/settings/IconPicker.tsx +4 -3
  40. package/client/features/settings/icon-picker-options.ts +0 -131
  41. package/client/features/views/ViewBuilderTab.tsx +153 -0
  42. package/client/features/views/api.ts +124 -0
  43. package/client/features/views/useViewBuilderActions.ts +72 -0
  44. package/client/features/widgets/WidgetGrid.tsx +36 -20
  45. package/client/features/widgets/Widgets.tsx +140 -90
  46. package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -9
  47. package/client/features/workspace/WorkspaceScreen.tsx +179 -40
  48. package/client/features/workspace/WorkspaceTabs.tsx +4 -4
  49. package/client/index.css +0 -35
  50. package/client/index.html +1 -1
  51. package/client/lib/app-icon-registry.ts +145 -0
  52. package/client/runtime/useWorkspaceEvents.ts +3 -1
  53. package/client/theme.css +1 -1
  54. package/dist/chunk-4vf1t6v1.js +10 -0
  55. package/dist/chunk-6c24yndg.js +61 -0
  56. package/dist/chunk-6c8cwpzc.js +1 -0
  57. package/dist/chunk-b4b276wx.js +15 -0
  58. package/dist/{chunk-c4j722at.js → chunk-cs8vbert.js} +2 -2
  59. package/dist/chunk-cwqmay73.css +1 -0
  60. package/dist/chunk-kxmvv1ax.js +48 -0
  61. package/dist/chunk-rq0ar7vp.js +1 -0
  62. package/dist/{chunk-p68fnz3q.js → chunk-vkvb3hjm.js} +1 -1
  63. package/dist/chunk-zpxrb1ce.js +2 -0
  64. package/dist/index.html +2 -2
  65. package/dist/openai-h13pza4b.svg +3 -0
  66. package/lib/format.ts +2 -2
  67. package/lib/types.ts +38 -2
  68. package/lib/view-builder-meta.ts +35 -0
  69. package/lib/workspace-layout.ts +14 -0
  70. package/package.json +2 -1
  71. package/server/AGENTS.md +3 -3
  72. package/server/api.ts +165 -51
  73. package/server/applets.ts +1 -1
  74. package/server/bundle-queue.ts +19 -0
  75. package/server/bundler/applet-css.ts +50 -0
  76. package/server/{build-applet.ts → bundler/build-applet.ts} +36 -26
  77. package/server/cli.ts +79 -2
  78. package/server/control.ts +106 -8
  79. package/server/env-apply.ts +2 -2
  80. package/server/harness/README.md +228 -0
  81. package/server/harness/claude-code/NOTES.md +578 -0
  82. package/{lib/claude-adapter.ts → server/harness/claude-code/adapter.ts} +67 -5
  83. package/server/harness/claude-code/index.ts +124 -0
  84. package/server/{mcp.ts → harness/claude-code/mcp.ts} +1 -1
  85. package/server/{cc-session.ts → harness/claude-code/session.ts} +42 -14
  86. package/server/harness/claude-code/sessions.ts +42 -0
  87. package/server/harness/codex/NOTES.md +239 -0
  88. package/server/harness/codex/adapter.ts +414 -0
  89. package/server/harness/codex/client.ts +343 -0
  90. package/server/harness/codex/index.ts +68 -0
  91. package/server/harness/codex/probe.ts +186 -0
  92. package/server/harness/codex/session.ts +617 -0
  93. package/server/harness/debug.ts +57 -0
  94. package/server/harness/openclaw/NOTES.md +316 -0
  95. package/server/{openclaw-adapter.ts → harness/openclaw/adapter.ts} +2 -2
  96. package/server/harness/openclaw/index.ts +93 -0
  97. package/server/{openclaw-session.ts → harness/openclaw/session.ts} +44 -9
  98. package/server/{openclaw-strip.ts → harness/openclaw/strip.ts} +3 -1
  99. package/server/harness/registry.ts +36 -0
  100. package/server/harness/types.ts +87 -0
  101. package/server/layout.ts +6 -12
  102. package/server/moi-scaffold.ts +1 -1
  103. package/server/registry.ts +14 -52
  104. package/server/state.ts +5 -38
  105. package/server/status.ts +7 -46
  106. package/server/vendor.ts +1 -1
  107. package/server/view-builders.ts +428 -0
  108. package/server/views.ts +0 -0
  109. package/server/web.ts +18 -40
  110. package/server/workspace-init.ts +6 -6
  111. package/workspace/.claude/skills/moi-workspace/DESIGN.md +1 -0
  112. package/workspace/.claude/skills/moi-workspace/SKILL.md +28 -7
  113. package/client/assets/hermes-nous.png +0 -0
  114. package/client/hooks/useScrollFade.ts +0 -38
  115. package/dist/chunk-23cgr1tz.css +0 -1
  116. package/dist/chunk-3hy3qy6d.js +0 -10
  117. package/dist/chunk-dyfaffyz.js +0 -119
  118. package/dist/chunk-kpe40hm8.js +0 -1
  119. package/dist/chunk-ty6dvda0.js +0 -1
  120. package/dist/hermes-nous-pznd63x9.png +0 -0
  121. /package/client/{components/playground → features/dev}/PixelPainter.tsx +0 -0
  122. /package/client/{components/playground → features/dev}/ToolCallsPage.tsx +0 -0
  123. /package/server/{agent.ts → harness/claude-code/models.ts} +0 -0
  124. /package/server/{openclaw.ts → harness/openclaw/discovery.ts} +0 -0
  125. /package/server/{openclaw-gateway.ts → harness/openclaw/gateway.ts} +0 -0
@@ -3,17 +3,19 @@ import { lazy, Suspense, useEffect, useRef, useState } from 'react'
3
3
  import { AnimatePresence, motion } from 'motion/react'
4
4
 
5
5
  import {
6
- IconAppWindow,
7
- IconArtboard,
8
- IconLayoutGrid,
6
+ IconArticle,
7
+ IconBrowserPlus,
8
+ IconGhost,
9
+ IconLayout2,
9
10
  IconLayoutSidebarRight,
10
11
  IconPalette,
11
- IconRobotFace
12
+ IconSketching
12
13
  } from '@tabler/icons-react'
13
14
  import { ChatPanel } from '@/client/features/chat/ChatPanel'
14
15
  import { ChatPopup } from '@/client/features/chat/ChatPopup'
15
16
  import { CustomizePanel } from '@/client/features/workspace/CustomizePanel'
16
17
  import { McpMenu } from '@/client/features/connectors/McpMenu'
18
+ import { AppletMount } from '@/client/features/applets/AppletMount'
17
19
  import { WidgetErrorBoundary } from '@/client/features/applets/WidgetErrorBoundary'
18
20
  import { Widgets } from '@/client/features/widgets/Widgets'
19
21
  import { PanelHeader } from '@/client/components/shared/PanelHeader'
@@ -23,9 +25,12 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/
23
25
  import { WorkspaceSettings } from '@/client/features/settings/WorkspaceSettings'
24
26
  import { useChat } from '@/client/features/chat/useChat'
25
27
  import { useView } from '@/client/features/applets/useApplet'
28
+ import { ViewBuilderTab } from '@/client/features/views/ViewBuilderTab'
29
+ import { useViewBuilderActions } from '@/client/features/views/useViewBuilderActions'
26
30
  import { useFitsSplitLayout } from '@/client/features/workspace/useFitsSplitLayout'
27
31
  import { useWorkspaceTheme } from '@/client/features/workspace/useWorkspaceTheme'
28
32
  import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
33
+ import { resolveAppIcon } from '@/client/lib/app-icon-registry'
29
34
  import { cn } from '@/client/lib/cn'
30
35
  import { liveStore } from '@/client/features/chat/chat-store'
31
36
  import {
@@ -35,11 +40,13 @@ import {
35
40
  } from '@/client/features/workspace/WorkspaceTabs'
36
41
  import type {
37
42
  LayoutMode,
43
+ ViewBuilder,
38
44
  ViewInfo,
39
45
  WidgetInfo,
40
46
  WorkspaceTabId,
41
47
  WorkspaceTabsState
42
48
  } from '@/lib/types'
49
+ import { createDefaultWorkspaceTabs } from '@/lib/workspace-layout'
43
50
 
44
51
  const Scratchpad = lazy(() =>
45
52
  import('@/client/features/scratchpad/Scratchpad').then(module => ({
@@ -50,10 +57,20 @@ const Scratchpad = lazy(() =>
50
57
  // Tab label for a view: its configured title, or the file-name id as fallback.
51
58
  const viewLabel = (v: ViewInfo) => v.config.title || v.id
52
59
 
53
- const DEFAULT_TABS: WorkspaceTabsState = { open: ['agent'], active: 'agent' }
60
+ const viewBuilderIcon = (builder: ViewBuilder) => resolveAppIcon(builder.icon) ?? IconArticle
61
+
62
+ function viewIcon(view: ViewInfo, builders: ViewBuilder[]) {
63
+ const builder = builders.find(candidate => candidate.viewId === view.id)
64
+ return resolveAppIcon(view.config.icon) ?? resolveAppIcon(builder?.icon) ?? IconArticle
65
+ }
66
+
67
+ const DEFAULT_TABS = createDefaultWorkspaceTabs()
54
68
 
55
69
  const viewTabId = (id: string): WorkspaceTabId => `view:${id}`
56
70
  const viewIdFromTab = (tab: WorkspaceTabId) => (tab.startsWith('view:') ? tab.slice(5) : null)
71
+ const viewBuilderTabId = (id: string): WorkspaceTabId => `view-builder:${id}`
72
+ const viewBuilderIdFromTab = (tab: WorkspaceTabId) =>
73
+ tab.startsWith('view-builder:') ? tab.slice('view-builder:'.length) : null
57
74
 
58
75
  type SectionControlsProps = {
59
76
  mode: LayoutMode
@@ -89,18 +106,25 @@ function ViewApp({ view }: ViewAppProps) {
89
106
  <div className="relative min-h-0 flex-1 overflow-hidden">
90
107
  <AnimatePresence mode="wait" initial={false}>
91
108
  {bundle.status === 'ready' && (
92
- <motion.div
109
+ <AppletMount
110
+ asChild
111
+ segment="views"
112
+ name={view.id}
113
+ version={bundle.version}
93
114
  key={bundle.version}
94
- className="absolute inset-0 overflow-auto"
95
- initial={{ opacity: 0, filter: 'blur(4px)' }}
96
- animate={{ opacity: 1, filter: 'blur(0px)' }}
97
- exit={{ opacity: 0, filter: 'blur(4px)' }}
98
- transition={{ duration: 0.3, ease: 'easeInOut' }}
99
115
  >
100
- <WidgetErrorBoundary name={view.id} resetKey={bundle.version}>
101
- <bundle.Component />
102
- </WidgetErrorBoundary>
103
- </motion.div>
116
+ <motion.div
117
+ className="absolute inset-0 overflow-auto"
118
+ initial={{ opacity: 0, filter: 'blur(4px)' }}
119
+ animate={{ opacity: 1, filter: 'blur(0px)' }}
120
+ exit={{ opacity: 0, filter: 'blur(4px)' }}
121
+ transition={{ duration: 0.3, ease: 'easeInOut' }}
122
+ >
123
+ <WidgetErrorBoundary name={view.id} resetKey={bundle.version}>
124
+ <bundle.Component />
125
+ </WidgetErrorBoundary>
126
+ </motion.div>
127
+ </AppletMount>
104
128
  )}
105
129
  {bundle.status === 'error' && (
106
130
  <motion.p
@@ -148,6 +172,7 @@ function WorkspaceCustomizeAction({ active, onToggle }: WorkspaceCustomizeAction
148
172
  type WorkspaceScreenProps = {
149
173
  widgets: WidgetInfo[]
150
174
  views: ViewInfo[]
175
+ builders: ViewBuilder[]
151
176
  }
152
177
 
153
178
  type WidgetMode = 'idle' | 'editing' | 'customizing'
@@ -159,8 +184,10 @@ function normalizeTabsState(tabs: WorkspaceTabsState | undefined): WorkspaceTabs
159
184
  return { open, active: open.includes(tabs.active) ? tabs.active : open[0] }
160
185
  }
161
186
 
162
- function tabAvailable(tab: WorkspaceTabId, views: ViewInfo[]) {
187
+ function tabAvailable(tab: WorkspaceTabId, views: ViewInfo[], builders: ViewBuilder[]) {
163
188
  if (tab === 'agent' || tab === 'widgets' || tab === 'scratchpad') return true
189
+ const builderId = viewBuilderIdFromTab(tab)
190
+ if (builderId) return builders.some(builder => builder.id === builderId)
164
191
  const viewId = viewIdFromTab(tab)
165
192
  return viewId ? views.some(v => v.id === viewId) : false
166
193
  }
@@ -168,12 +195,13 @@ function tabAvailable(tab: WorkspaceTabId, views: ViewInfo[]) {
168
195
  function tabItemFor(
169
196
  tab: WorkspaceTabId,
170
197
  views: ViewInfo[],
198
+ builders: ViewBuilder[],
171
199
  closable: boolean
172
200
  ): WorkspaceTabItem | null {
173
201
  if (tab === 'agent') {
174
202
  return {
175
203
  key: tab,
176
- Icon: IconRobotFace,
204
+ Icon: IconGhost,
177
205
  label: 'Agent',
178
206
  closable
179
207
  }
@@ -181,7 +209,7 @@ function tabItemFor(
181
209
  if (tab === 'widgets') {
182
210
  return {
183
211
  key: tab,
184
- Icon: IconLayoutGrid,
212
+ Icon: IconLayout2,
185
213
  label: 'Widgets',
186
214
  closable
187
215
  }
@@ -189,17 +217,27 @@ function tabItemFor(
189
217
  if (tab === 'scratchpad') {
190
218
  return {
191
219
  key: tab,
192
- Icon: IconArtboard,
220
+ Icon: IconSketching,
193
221
  label: 'Scratchpad',
194
222
  closable
195
223
  }
196
224
  }
225
+ const builderId = viewBuilderIdFromTab(tab)
226
+ const builder = builderId ? builders.find(candidate => candidate.id === builderId) : null
227
+ if (builder) {
228
+ return {
229
+ key: tab,
230
+ Icon: viewBuilderIcon(builder),
231
+ label: builder.title || builder.viewId || 'New view',
232
+ closable
233
+ }
234
+ }
197
235
  const viewId = viewIdFromTab(tab)
198
236
  const view = viewId ? views.find(v => v.id === viewId) : null
199
237
  return view
200
238
  ? {
201
239
  key: tab,
202
- Icon: IconAppWindow,
240
+ Icon: viewIcon(view, builders),
203
241
  label: viewLabel(view),
204
242
  closable
205
243
  }
@@ -216,7 +254,7 @@ function applyVisibleTabOrder(
216
254
  return open.map(tab => (visibleSet.has(tab) ? orderedVisible[cursor++] : tab))
217
255
  }
218
256
 
219
- export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
257
+ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenProps) {
220
258
  const {
221
259
  view,
222
260
  previewTurn,
@@ -229,6 +267,7 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
229
267
  dismissError
230
268
  } = useChat()
231
269
  const { layout, setLayout, name, icon, provider, workspaceId } = useWorkspaceLayoutCtx()
270
+ const builderActions = useViewBuilderActions()
232
271
  const { ref: rowRef, fits: canUseSplit } = useFitsSplitLayout<HTMLDivElement>()
233
272
  const [widgetMode, setWidgetMode] = useState<WidgetMode>('idle')
234
273
  const [floatingChatOpen, setFloatingChatOpen] = useState(false)
@@ -240,7 +279,9 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
240
279
  useWorkspaceTheme(layout.theme, themeRef)
241
280
 
242
281
  const tabsState = normalizeTabsState(layout.tabs)
243
- const availableOpenTabs = tabsState.open.filter(tab => tabAvailable(tab, views))
282
+ const tabsStateRef = useRef(tabsState)
283
+ tabsStateRef.current = tabsState
284
+ const availableOpenTabs = tabsState.open.filter(tab => tabAvailable(tab, views, builders))
244
285
  const effectiveOpenTabs = availableOpenTabs.length > 0 ? availableOpenTabs : DEFAULT_TABS.open
245
286
  const openSet = new Set(tabsState.open)
246
287
  const nonAgentOpenTabs = effectiveOpenTabs.filter(tab => tab !== 'agent')
@@ -272,10 +313,64 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
272
313
  : (visibleTabIds[0] ?? 'agent')
273
314
  const canCloseTabs = effectiveOpenTabs.length > 1
274
315
  const tabItems = visibleTabIds
275
- .map(tab => tabItemFor(tab, views, canCloseTabs))
316
+ .map(tab =>
317
+ tabItemFor(tab, views, builders, canCloseTabs || viewBuilderIdFromTab(tab) !== null)
318
+ )
276
319
  .filter((tab): tab is WorkspaceTabItem => Boolean(tab))
277
320
  const activeViewId = viewIdFromTab(activeTab)
278
321
  const activeView = activeViewId ? views.find(v => v.id === activeViewId) : undefined
322
+ const activeBuilderId = viewBuilderIdFromTab(activeTab)
323
+ const activeBuilder = activeBuilderId
324
+ ? builders.find(builder => builder.id === activeBuilderId)
325
+ : undefined
326
+
327
+ useEffect(() => {
328
+ const open = tabsState.open.filter(tab => tabAvailable(tab, views, builders))
329
+ if (open.length === tabsState.open.length) return
330
+ const nextOpen = open.length > 0 ? open : DEFAULT_TABS.open
331
+ setLayout({
332
+ tabs: {
333
+ open: nextOpen,
334
+ active: nextOpen.includes(tabsState.active) ? tabsState.active : nextOpen[0]
335
+ }
336
+ })
337
+ }, [builders, setLayout, tabsState.active, tabsState.open, views])
338
+
339
+ useEffect(() => {
340
+ const replacements = new Map<WorkspaceTabId, WorkspaceTabId>()
341
+ for (const builder of builders) {
342
+ if (builder.status !== 'ready' || !builder.viewId) continue
343
+ if (!views.some(view => view.id === builder.viewId)) continue
344
+ replacements.set(viewBuilderTabId(builder.id), viewTabId(builder.viewId))
345
+ }
346
+ if (replacements.size === 0) return
347
+
348
+ const replacementViews = new Set(replacements.values())
349
+ const sourceForView = new Map(
350
+ [...replacements].map(([builderTab, viewTab]) => [viewTab, builderTab])
351
+ )
352
+ const open: WorkspaceTabId[] = []
353
+ let changed = false
354
+ for (const tab of tabsState.open) {
355
+ const source = sourceForView.get(tab)
356
+ if (replacementViews.has(tab) && source && tabsState.open.includes(source)) {
357
+ changed = true
358
+ continue
359
+ }
360
+ const replacement = replacements.get(tab)
361
+ const next = replacement ?? tab
362
+ if (replacement) changed = true
363
+ if (!open.includes(next)) open.push(next)
364
+ }
365
+ if (!changed) return
366
+ const active = replacements.get(tabsState.active) ?? tabsState.active
367
+ setLayout({ tabs: { open: open.length > 0 ? open : ['agent'], active } })
368
+ }, [builders, setLayout, tabsState.active, tabsState.open, views])
369
+
370
+ useEffect(() => {
371
+ const linked = activeBuilder ?? builders.find(builder => builder.viewId === activeViewId)
372
+ if (linked) liveStore.getState().setActive(workspaceId, linked.sessionId)
373
+ }, [activeBuilder, activeViewId, builders, workspaceId])
279
374
 
280
375
  useEffect(() => {
281
376
  if (mode !== 'fullscreen' || activeTab === 'agent') {
@@ -283,10 +378,14 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
283
378
  }
284
379
  }, [activeTab, mode])
285
380
 
286
- const setTabs = (tabs: WorkspaceTabsState) => setLayout({ tabs })
381
+ const setTabs = (tabs: WorkspaceTabsState) => {
382
+ tabsStateRef.current = tabs
383
+ setLayout({ tabs })
384
+ }
287
385
 
288
386
  const openTab = (tab: WorkspaceTabId) => {
289
- const open = openSet.has(tab) ? tabsState.open : [...tabsState.open, tab]
387
+ const current = tabsStateRef.current
388
+ const open = current.open.includes(tab) ? current.open : [...current.open, tab]
290
389
  setTabs({ open, active: tab })
291
390
  if (tab === 'agent') {
292
391
  setFloatingChatOpen(false)
@@ -295,18 +394,32 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
295
394
  }
296
395
 
297
396
  const closeTab = (tab: WorkspaceTabId) => {
298
- if (!canCloseTabs || !openSet.has(tab)) return
299
- const open = tabsState.open.filter(t => t !== tab)
397
+ const builderId = viewBuilderIdFromTab(tab)
398
+ const builder = builderId ? builders.find(candidate => candidate.id === builderId) : undefined
399
+ if ((!canCloseTabs && !builder) || !openSet.has(tab)) return
400
+ let open = tabsState.open.filter(t => t !== tab)
401
+ if (open.length === 0) open = ['agent']
300
402
  let active = tabsState.active
301
403
  if (active === tab || !open.includes(active)) {
302
404
  const visibleIndex = visibleTabIds.indexOf(tab)
303
405
  active =
304
406
  visibleTabIds[visibleIndex + 1] ??
305
407
  visibleTabIds[visibleIndex - 1] ??
306
- open.find(t => tabAvailable(t, views)) ??
408
+ open.find(t => tabAvailable(t, views, builders)) ??
307
409
  'agent'
308
410
  }
309
411
  setTabs({ open, active })
412
+ if (builder?.status === 'draft') void builderActions.discard(builder.id)
413
+ }
414
+
415
+ const discardBuilder = (builder: ViewBuilder) => {
416
+ const tab = viewBuilderTabId(builder.id)
417
+ if (openSet.has(tab)) {
418
+ let open = tabsState.open.filter(item => item !== tab)
419
+ if (open.length === 0) open = ['agent']
420
+ setTabs({ open, active: tabsState.active === tab ? open[0] : tabsState.active })
421
+ }
422
+ void builderActions.discard(builder.id)
310
423
  }
311
424
 
312
425
  const reorderTabs = (orderedVisibleTabs: WorkspaceTabId[]) => {
@@ -334,7 +447,7 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
334
447
  ? ([
335
448
  {
336
449
  key: 'agent',
337
- Icon: IconRobotFace,
450
+ Icon: IconGhost,
338
451
  label: 'Agent',
339
452
  onClick: () => openTab('agent')
340
453
  }
@@ -344,7 +457,7 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
344
457
  ? ([
345
458
  {
346
459
  key: 'widgets',
347
- Icon: IconLayoutGrid,
460
+ Icon: IconLayout2,
348
461
  label: 'Widgets',
349
462
  onClick: () => openTab('widgets')
350
463
  }
@@ -354,7 +467,7 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
354
467
  ? ([
355
468
  {
356
469
  key: 'scratchpad',
357
- Icon: IconArtboard,
470
+ Icon: IconSketching,
358
471
  label: 'Scratchpad',
359
472
  onClick: () => openTab('scratchpad')
360
473
  }
@@ -366,16 +479,30 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
366
479
  .map(
367
480
  ({ view, tab }): CreateWorkspaceTabItem => ({
368
481
  key: tab,
369
- Icon: IconAppWindow,
482
+ Icon: viewIcon(view, builders),
370
483
  label: viewLabel(view),
371
484
  onClick: () => openTab(tab)
372
485
  })
373
486
  ),
487
+ ...builders
488
+ .filter(builder => builder.status !== 'ready')
489
+ .map(builder => ({ builder, tab: viewBuilderTabId(builder.id) }))
490
+ .filter(({ tab }) => !openSet.has(tab))
491
+ .map(
492
+ ({ builder, tab }): CreateWorkspaceTabItem => ({
493
+ key: tab,
494
+ Icon: viewBuilderIcon(builder),
495
+ label: builder.title || builder.viewId || 'New view',
496
+ onClick: () => openTab(tab)
497
+ })
498
+ ),
374
499
  {
375
500
  key: 'create-view',
376
- Icon: IconAppWindow,
377
- label: 'View',
378
- onClick: () => openChat('Create view')
501
+ Icon: IconBrowserPlus,
502
+ label: 'New view',
503
+ onClick: () => {
504
+ void builderActions.create().then(builder => openTab(viewBuilderTabId(builder.id)))
505
+ }
379
506
  }
380
507
  ]
381
508
 
@@ -424,10 +551,7 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
424
551
  {/* Full-screen: whole panel. Split: the left content column. */}
425
552
  {(mode === 'fullscreen' || hasWorkspaceContent) && (
426
553
  <div
427
- className={cn(
428
- 'flex min-h-0 flex-1 flex-col',
429
- mode === 'split' && 'min-w-[var(--column-w)]'
430
- )}
554
+ className={cn('flex min-h-0 flex-1 flex-col', mode === 'split' && 'min-w-(--column-w)')}
431
555
  >
432
556
  <PanelHeader>
433
557
  <div className="flex min-w-0 flex-1 items-center gap-4">
@@ -481,6 +605,21 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
481
605
  <Suspense fallback={null}>
482
606
  <Scratchpad />
483
607
  </Suspense>
608
+ ) : activeBuilder ? (
609
+ <ViewBuilderTab
610
+ key={activeBuilder.id}
611
+ builder={activeBuilder}
612
+ onSave={requirements => builderActions.save(activeBuilder.id, requirements)}
613
+ onSubmit={requirements => {
614
+ if (mode === 'fullscreen') setFloatingChatOpen(true)
615
+ return builderActions.submit(activeBuilder, requirements)
616
+ }}
617
+ onOpenChat={() => {
618
+ liveStore.getState().setActive(workspaceId, activeBuilder.sessionId)
619
+ openChat()
620
+ }}
621
+ onDiscard={() => discardBuilder(activeBuilder)}
622
+ />
484
623
  ) : activeView ? (
485
624
  <ViewApp view={activeView} />
486
625
  ) : null}
@@ -492,7 +631,7 @@ export function WorkspaceScreen({ widgets, views }: WorkspaceScreenProps) {
492
631
  {mode === 'split' && (
493
632
  <div
494
633
  className={cn(
495
- 'flex min-h-0 min-w-[var(--chat-min)] flex-[0_1_var(--chat-max)] flex-col overflow-hidden border-l border-border'
634
+ 'flex min-h-0 min-w-(--chat-min) flex-[0_1_var(--chat-max)] flex-col overflow-hidden border-l border-border'
496
635
  )}
497
636
  >
498
637
  {dockedChat}
@@ -74,8 +74,8 @@ function CreateTabMenu({ items }: { items: CreateWorkspaceTabItem[] }) {
74
74
  <DropdownMenuContent align="start" className="min-w-48">
75
75
  <DropdownMenuGroup>
76
76
  {items.map(({ key, Icon, label, onClick }) => (
77
- <DropdownMenuItem key={key} onClick={onClick}>
78
- <Icon stroke={1.75} />
77
+ <DropdownMenuItem key={key} onClick={onClick} className="font-medium">
78
+ <Icon stroke={2} />
79
79
  {label}
80
80
  </DropdownMenuItem>
81
81
  ))}
@@ -131,7 +131,7 @@ function WorkspaceTab(props: WorkspaceTabProps) {
131
131
  tab.closable && 'group-hover/tab:mr-3'
132
132
  )}
133
133
  >
134
- <tab.Icon data-icon="inline-start" stroke={1.75} />
134
+ <tab.Icon data-icon="inline-start" stroke={2} />
135
135
  <span
136
136
  className={cn(
137
137
  'truncate',
@@ -176,7 +176,7 @@ export function WorkspaceTabs({
176
176
  }: WorkspaceTabsProps) {
177
177
  return (
178
178
  <div className="flex min-w-0 flex-1 items-center gap-1">
179
- <div className="scrollbar-none min-w-0 scroll-fade-x overflow-x-auto overflow-y-hidden [--scroll-fade-reveal:16px]">
179
+ <div className="no-scrollbar min-w-0 scroll-fade-x overflow-x-auto overflow-y-hidden [--scroll-fade-reveal:16px]">
180
180
  <ReorderableList
181
181
  items={tabs}
182
182
  getId={tab => tab.key}
package/client/index.css CHANGED
@@ -153,41 +153,6 @@
153
153
  --tw-prose-bullets: inherit;
154
154
  }
155
155
 
156
- @utility mask-fade-bottom {
157
- mask-image: linear-gradient(black 0px, black calc(100% - 24px), transparent 100%);
158
- mask-size: 100% 100%;
159
- mask-position: 0px 0px;
160
- mask-repeat: no-repeat;
161
- }
162
-
163
- @utility mask-fade-top {
164
- mask-image: linear-gradient(transparent 0%, black 24px);
165
- mask-size: 100% 100%;
166
- mask-position: 0px 0px;
167
- mask-repeat: no-repeat;
168
- }
169
-
170
- @utility mask-fade-y {
171
- mask-image: linear-gradient(
172
- transparent 0%,
173
- black 24px,
174
- black calc(100% - 24px),
175
- transparent 100%
176
- );
177
- mask-size: 100% 100%;
178
- mask-position: 0px 0px;
179
- mask-repeat: no-repeat;
180
- }
181
-
182
- /* Hide the scrollbar entirely (e.g. the MCP hover card, which signals overflow
183
- with top/bottom mask fades instead — see useScrollFade + mask-fade-*). */
184
- @utility scrollbar-none {
185
- scrollbar-width: none;
186
- &::-webkit-scrollbar {
187
- display: none;
188
- }
189
- }
190
-
191
156
  /* Slim, unobtrusive scrollbar — keeps a clear scroll affordance while taming
192
157
  the chunky macOS "always show" scrollbar (a transparent border insets the
193
158
  thumb into a thin floating pill). */
package/client/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>moi</title>
7
7
  <link rel="icon" type="image/png" href="./assets/favicon.png" />
8
8
  <!-- React is vendored locally (client/vendor/react, generated by
9
- scripts/build-vendor.ts) and served by the /vendor/react route, so Moi
9
+ scripts/build-vendor.ts) and served by the /vendor/react route, so moi
10
10
  runs fully offline — no CDN fetch. The server picks the development or
11
11
  production build per environment behind these stable URLs. -->
12
12
  <script type="importmap">
@@ -0,0 +1,145 @@
1
+ import type { TablerIcon } from '@tabler/icons-react'
2
+ import {
3
+ IconActivity,
4
+ IconApi,
5
+ IconAtom,
6
+ IconBell,
7
+ IconBolt,
8
+ IconBook,
9
+ IconBrain,
10
+ IconBriefcase,
11
+ IconBug,
12
+ IconBulb,
13
+ IconCalendar,
14
+ IconCamera,
15
+ IconChartBar,
16
+ IconChefHat,
17
+ IconCloud,
18
+ IconCode,
19
+ IconCompass,
20
+ IconCpu,
21
+ IconCube,
22
+ IconDatabase,
23
+ IconDeviceGamepad2,
24
+ IconDiamond,
25
+ IconFeather,
26
+ IconFile,
27
+ IconFlame,
28
+ IconFlask,
29
+ IconFolder,
30
+ IconGhost,
31
+ IconGift,
32
+ IconGlobe,
33
+ IconHeart,
34
+ IconHexagon,
35
+ IconHome,
36
+ IconKey,
37
+ IconLeaf,
38
+ IconMail,
39
+ IconMap,
40
+ IconMessage,
41
+ IconMoon,
42
+ IconMountain,
43
+ IconMusic,
44
+ IconPalette,
45
+ IconPaperclip,
46
+ IconPhoto,
47
+ IconPlanet,
48
+ IconPlug,
49
+ IconRobot,
50
+ IconRocket,
51
+ IconSettings,
52
+ IconShield,
53
+ IconShoppingCart,
54
+ IconSnowflake,
55
+ IconSparkles,
56
+ IconStar,
57
+ IconSun,
58
+ IconTarget,
59
+ IconTerminal2,
60
+ IconTool,
61
+ IconTrophy,
62
+ IconUser,
63
+ IconWand,
64
+ IconWorld
65
+ } from '@tabler/icons-react'
66
+
67
+ export type AppIconChoice = {
68
+ id: string
69
+ Icon: TablerIcon
70
+ }
71
+
72
+ // Shared by the workspace icon picker and view tabs. Add new app-level icon
73
+ // choices here so both surfaces and the view-builder prompt stay in sync.
74
+ export const APP_ICON_CHOICES: AppIconChoice[] = [
75
+ { id: 'rocket', Icon: IconRocket },
76
+ { id: 'sparkles', Icon: IconSparkles },
77
+ { id: 'bolt', Icon: IconBolt },
78
+ { id: 'flame', Icon: IconFlame },
79
+ { id: 'star', Icon: IconStar },
80
+ { id: 'heart', Icon: IconHeart },
81
+ { id: 'diamond', Icon: IconDiamond },
82
+ { id: 'trophy', Icon: IconTrophy },
83
+ { id: 'target', Icon: IconTarget },
84
+ { id: 'bulb', Icon: IconBulb },
85
+ { id: 'brain', Icon: IconBrain },
86
+ { id: 'robot', Icon: IconRobot },
87
+ { id: 'wand', Icon: IconWand },
88
+ { id: 'atom', Icon: IconAtom },
89
+ { id: 'flask', Icon: IconFlask },
90
+ { id: 'cpu', Icon: IconCpu },
91
+ { id: 'code', Icon: IconCode },
92
+ { id: 'terminal', Icon: IconTerminal2 },
93
+ { id: 'api', Icon: IconApi },
94
+ { id: 'database', Icon: IconDatabase },
95
+ { id: 'cube', Icon: IconCube },
96
+ { id: 'hexagon', Icon: IconHexagon },
97
+ { id: 'plug', Icon: IconPlug },
98
+ { id: 'tool', Icon: IconTool },
99
+ { id: 'settings', Icon: IconSettings },
100
+ { id: 'bug', Icon: IconBug },
101
+ { id: 'activity', Icon: IconActivity },
102
+ { id: 'chart', Icon: IconChartBar },
103
+ { id: 'briefcase', Icon: IconBriefcase },
104
+ { id: 'folder', Icon: IconFolder },
105
+ { id: 'file', Icon: IconFile },
106
+ { id: 'book', Icon: IconBook },
107
+ { id: 'message', Icon: IconMessage },
108
+ { id: 'mail', Icon: IconMail },
109
+ { id: 'bell', Icon: IconBell },
110
+ { id: 'paperclip', Icon: IconPaperclip },
111
+ { id: 'key', Icon: IconKey },
112
+ { id: 'shield', Icon: IconShield },
113
+ { id: 'user', Icon: IconUser },
114
+ { id: 'home', Icon: IconHome },
115
+ { id: 'globe', Icon: IconGlobe },
116
+ { id: 'world', Icon: IconWorld },
117
+ { id: 'planet', Icon: IconPlanet },
118
+ { id: 'compass', Icon: IconCompass },
119
+ { id: 'map', Icon: IconMap },
120
+ { id: 'calendar', Icon: IconCalendar },
121
+ { id: 'cloud', Icon: IconCloud },
122
+ { id: 'sun', Icon: IconSun },
123
+ { id: 'moon', Icon: IconMoon },
124
+ { id: 'snowflake', Icon: IconSnowflake },
125
+ { id: 'leaf', Icon: IconLeaf },
126
+ { id: 'mountain', Icon: IconMountain },
127
+ { id: 'feather', Icon: IconFeather },
128
+ { id: 'ghost', Icon: IconGhost },
129
+ { id: 'music', Icon: IconMusic },
130
+ { id: 'camera', Icon: IconCamera },
131
+ { id: 'photo', Icon: IconPhoto },
132
+ { id: 'palette', Icon: IconPalette },
133
+ { id: 'gamepad', Icon: IconDeviceGamepad2 },
134
+ { id: 'gift', Icon: IconGift },
135
+ { id: 'cart', Icon: IconShoppingCart },
136
+ { id: 'chef', Icon: IconChefHat }
137
+ ]
138
+
139
+ export const APP_ICON_IDS = APP_ICON_CHOICES.map(choice => choice.id)
140
+
141
+ const appIconById = new Map(APP_ICON_CHOICES.map(choice => [choice.id, choice.Icon]))
142
+
143
+ export function resolveAppIcon(id: string | undefined): TablerIcon | null {
144
+ return id ? (appIconById.get(id) ?? null) : null
145
+ }
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef } from 'react'
2
2
 
3
3
  import { wsUrl } from '@/client/lib/ws-url'
4
- import type { ViewInfo, WidgetInfo } from '@/lib/types'
4
+ import type { ViewBuilder, ViewInfo, WidgetInfo } from '@/lib/types'
5
5
 
6
6
  export type WorkspaceEvent =
7
7
  | { type: 'widget:updated'; name: string }
@@ -9,6 +9,8 @@ export type WorkspaceEvent =
9
9
  | { type: 'widgets:refresh' }
10
10
  | { type: 'view:updated'; name: string }
11
11
  | { type: 'view-layout:updated'; views: ViewInfo[] }
12
+ | { type: 'view-builder:updated'; workspaceId: string; builder: ViewBuilder }
13
+ | { type: 'view-builder:deleted'; workspaceId: string; builderId: string }
12
14
  | { type: 'theme:updated' }
13
15
  | { type: 'workspace:updated' }
14
16
  // The registry list changed (reorder, create) without touching any open
package/client/theme.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Shared design-token map for both the host app (client/index.css) and
3
- * applet bundles (server/build-applet.ts emits an `@import` to this file
3
+ * applet bundles (server/bundler/build-applet.ts emits an `@import` to this file
4
4
  * into the applet's synthetic CSS).
5
5
  *
6
6
  * The actual CSS variables (`--background`, `--foreground`, `--card`, etc.)