moi-computer 0.8.1-next.0 → 0.9.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/client/assets/hermes.png +0 -0
  2. package/client/components/shared/IconGhost.tsx +15 -18
  3. package/client/components/ui/button.tsx +2 -2
  4. package/client/components/ui/hover-card.tsx +1 -1
  5. package/client/components/ui/popover.tsx +3 -1
  6. package/client/features/chat/ChatEmptyState.tsx +25 -7
  7. package/client/features/chat/ChatPanel.tsx +70 -28
  8. package/client/features/chat/ChatPopup.tsx +3 -2
  9. package/client/features/chat/ChatPromptBubbles.tsx +1 -1
  10. package/client/features/chat/MarkdownContent.tsx +1 -1
  11. package/client/features/chat/attachment-staging.ts +153 -0
  12. package/client/features/chat/chat-send.ts +55 -0
  13. package/client/features/chat/chat-store.ts +32 -8
  14. package/client/features/chat/composer/ChatComposer.tsx +190 -77
  15. package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
  16. package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
  17. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
  18. package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
  19. package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
  20. package/client/features/chat/tool-group/format/claude.ts +48 -0
  21. package/client/features/chat/tool-group/format/codex.ts +126 -0
  22. package/client/features/chat/tool-group/format/hermes.ts +68 -0
  23. package/client/features/chat/tool-group/format/index.ts +34 -0
  24. package/client/features/chat/tool-group/format/mcp.ts +64 -0
  25. package/client/features/chat/tool-group/format/openclaw.ts +116 -0
  26. package/client/features/chat/tool-group/format/shared.ts +49 -0
  27. package/client/features/chat/useChat.ts +5 -10
  28. package/client/features/dev/ChatStatesPage.tsx +40 -2
  29. package/client/features/drawings/DrawingLayer.tsx +49 -0
  30. package/client/features/drawings/DrawingToolbar.tsx +95 -0
  31. package/client/features/drawings/annotation-availability.ts +10 -0
  32. package/client/features/drawings/capture-element.ts +45 -0
  33. package/client/features/drawings/useChatAnnotation.ts +222 -0
  34. package/client/features/drawings/useDrawingLayer.ts +758 -0
  35. package/client/features/drawings/useViewBuilderSketch.ts +151 -0
  36. package/client/features/home/workspace-presentation.tsx +6 -2
  37. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +12 -6
  38. package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
  39. package/client/features/views/ViewBuilder.tsx +224 -0
  40. package/client/features/views/api.ts +1 -0
  41. package/client/features/views/useViewBuilderActions.ts +24 -3
  42. package/client/features/views/useViewBuilderDrafts.ts +66 -0
  43. package/client/features/widgets/Widgets.tsx +23 -39
  44. package/client/features/workspace/CustomizePanel.tsx +1 -1
  45. package/client/features/workspace/WorkspaceScreen.tsx +157 -57
  46. package/client/features/workspace/WorkspaceTabs.tsx +3 -3
  47. package/client/features/workspace/useFitsSplitLayout.ts +14 -8
  48. package/client/index.css +8 -0
  49. package/client/store/ui.ts +19 -0
  50. package/client/theme.css +33 -8
  51. package/dist/chunk-3becmq75.js +81 -0
  52. package/dist/{chunk-kkj86722.js → chunk-6w6j9g4b.js} +78 -78
  53. package/dist/{chunk-xeyxk7ep.js → chunk-8ew39cvq.js} +4 -4
  54. package/dist/chunk-c8gtrjwp.js +1 -0
  55. package/dist/{chunk-2vaafjp4.js → chunk-pp62fnxh.js} +1 -1
  56. package/dist/{chunk-35fq49qa.js → chunk-sxc24vfp.js} +1 -1
  57. package/dist/{chunk-xzx7c9hq.js → chunk-v964b5g7.js} +1 -1
  58. package/dist/chunk-zx33ts9d.css +1 -0
  59. package/dist/hermes-pznd63x9.png +0 -0
  60. package/dist/index.html +1 -1
  61. package/lib/format.ts +21 -7
  62. package/lib/themes.ts +8 -8
  63. package/lib/types.ts +8 -1
  64. package/lib/workspace-types.ts +2 -1
  65. package/package.json +6 -4
  66. package/server/api.ts +21 -2
  67. package/server/bundler/build-applet.ts +35 -44
  68. package/server/cli-env.ts +2 -2
  69. package/server/cli.ts +227 -56
  70. package/server/constants.ts +8 -0
  71. package/server/control-client.ts +124 -0
  72. package/server/control.ts +2 -2
  73. package/server/harness/README.md +74 -23
  74. package/server/harness/acp/adapter.ts +220 -0
  75. package/server/harness/acp/archived.ts +88 -0
  76. package/server/harness/acp/client.ts +328 -0
  77. package/server/harness/acp/discovery.ts +130 -0
  78. package/server/harness/acp/run-durations.ts +68 -0
  79. package/server/harness/acp/session.ts +788 -0
  80. package/server/harness/acp/wire.ts +132 -0
  81. package/server/harness/executable.ts +15 -1
  82. package/server/harness/hermes/NOTES.md +815 -0
  83. package/server/harness/hermes/discovery.ts +155 -0
  84. package/server/harness/hermes/index.ts +155 -0
  85. package/server/harness/hermes/models.ts +79 -0
  86. package/server/harness/openclaw/NOTES.md +196 -94
  87. package/server/harness/openclaw/adapter.ts +28 -55
  88. package/server/harness/openclaw/compat.ts +4 -8
  89. package/server/harness/openclaw/session.ts +257 -238
  90. package/server/harness/openclaw/strip.ts +10 -34
  91. package/server/harness/openclaw/thinking.ts +5 -53
  92. package/server/harness/registry.ts +3 -1
  93. package/server/service.ts +2 -2
  94. package/server/view-builders.ts +4 -2
  95. package/server/workspace-import.ts +30 -1
  96. package/workspace/.claude/skills/moi-workspace/SKILL.md +6 -6
  97. package/client/features/chat/tool-group/format.ts +0 -359
  98. package/client/features/views/ViewBuilderTab.tsx +0 -152
  99. package/dist/chunk-gny990qx.css +0 -1
  100. package/dist/chunk-gt7n06ef.js +0 -1
  101. package/dist/chunk-n7pga5x3.js +0 -80
  102. /package/workspace/.claude/skills/moi-workspace/{DESIGN.md → references/DESIGN.md} +0 -0
  103. /package/workspace/.claude/skills/moi-workspace/{SCRATCHPAD.md → references/SCRATCHPAD.md} +0 -0
@@ -85,46 +85,30 @@ function WidgetActions({ editing, onCreateWidget, onEditingChange }: WidgetActio
85
85
  </Button>
86
86
  )}
87
87
  <AnimatePresence mode="popLayout" initial={false}>
88
- {editing ? (
89
- <motion.div
90
- key="done"
91
- variants={{
92
- from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
93
- to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
94
- }}
95
- initial="from"
96
- animate="to"
97
- exit="from"
98
- transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
99
- >
100
- <Button type="button" size="sm" onClick={() => onEditingChange(false)}>
101
- Done
102
- </Button>
103
- </motion.div>
104
- ) : (
105
- <motion.div
106
- key="actions"
107
- className="flex items-center gap-1"
108
- variants={{
109
- from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
110
- to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
111
- }}
112
- initial="from"
113
- animate="to"
114
- exit="from"
115
- transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
88
+ <motion.div
89
+ key={editing ? 'done' : 'edit'}
90
+ variants={{
91
+ from: { opacity: 0, scale: 0.8, filter: 'blur(4px)' },
92
+ to: { opacity: 1, scale: 1, filter: 'blur(0px)' }
93
+ }}
94
+ initial="from"
95
+ animate="to"
96
+ exit="from"
97
+ transition={{ type: 'spring', duration: 0.3, bounce: 0 }}
98
+ >
99
+ <Button
100
+ type="button"
101
+ variant={editing ? 'default' : 'ghost'}
102
+ size="sm"
103
+ className={cn(
104
+ !editing &&
105
+ 'text-muted-foreground group-hover/widgets:opacity-100 [@media(hover:hover)]:opacity-0'
106
+ )}
107
+ onClick={() => onEditingChange(!editing)}
116
108
  >
117
- <Button
118
- type="button"
119
- variant="ghost"
120
- size="sm"
121
- className="text-muted-foreground group-hover/widgets:opacity-100 [@media(hover:hover)]:opacity-0"
122
- onClick={() => onEditingChange(true)}
123
- >
124
- Edit widgets
125
- </Button>
126
- </motion.div>
127
- )}
109
+ {editing ? 'Done' : 'Edit widgets'}
110
+ </Button>
111
+ </motion.div>
128
112
  </AnimatePresence>
129
113
  </div>
130
114
  )
@@ -132,7 +132,7 @@ export function CustomizePanel({ onClose, ref }: CustomizePanelProps) {
132
132
  >
133
133
  <div className="flex items-center gap-2">
134
134
  <span
135
- className="size-5 shrink-0 rounded-sm bg-card texture-checker-[10px] shadow-xs"
135
+ className="size-5 shrink-0 rounded-sm bg-card texture-checker-2.5 shadow-xs"
136
136
  aria-hidden="true"
137
137
  />
138
138
  <span className="text-sm font-medium">{preset.label}</span>
@@ -1,4 +1,4 @@
1
- import { lazy, Suspense, useEffect, useState } from 'react'
1
+ import { lazy, Suspense, useEffect, useRef, useState } from 'react'
2
2
 
3
3
  import { AnimatePresence } from 'motion/react'
4
4
 
@@ -12,6 +12,10 @@ import {
12
12
  } from '@tabler/icons-react'
13
13
 
14
14
  import { IconGhost } from '@/client/components/shared/IconGhost'
15
+ import { canAnnotateWorkspaceContent } from '@/client/features/drawings/annotation-availability'
16
+ import { DrawingLayer } from '@/client/features/drawings/DrawingLayer'
17
+ import { DrawingToolbar } from '@/client/features/drawings/DrawingToolbar'
18
+ import { useChatAnnotation } from '@/client/features/drawings/useChatAnnotation'
15
19
  import { ChatPanel } from '@/client/features/chat/ChatPanel'
16
20
  import { ChatPopup } from '@/client/features/chat/ChatPopup'
17
21
  import { CustomizePanel } from '@/client/features/workspace/CustomizePanel'
@@ -24,9 +28,10 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/
24
28
  import { WorkspaceSettings } from '@/client/features/settings/WorkspaceSettings'
25
29
  import { useAppletChatMessage } from '@/client/features/chat/useAppletChatMessage'
26
30
  import { useChat } from '@/client/features/chat/useChat'
27
- import { ViewBuilderTab } from '@/client/features/views/ViewBuilderTab'
31
+ import { ViewBuilder, type ViewBuilderHandle } from '@/client/features/views/ViewBuilder'
28
32
  import { ViewManager } from '@/client/features/views/ViewManager'
29
33
  import { useViewBuilderActions } from '@/client/features/views/useViewBuilderActions'
34
+ import { useViewBuilderDrafts } from '@/client/features/views/useViewBuilderDrafts'
30
35
  import { useFitsSplitLayout } from '@/client/features/workspace/useFitsSplitLayout'
31
36
  import { useWorkspaceComposerState } from '@/client/features/chat/composer/useWorkspaceComposerState'
32
37
  import { useWorkspaceTheme } from '@/client/runtime/workspace-theme'
@@ -51,7 +56,13 @@ import {
51
56
  type WorkspaceTabItem,
52
57
  WorkspaceTabs
53
58
  } from '@/client/features/workspace/WorkspaceTabs'
54
- import type { LayoutMode, ViewBuilder, ViewInfo, WidgetInfo, WorkspaceTabId } from '@/lib/types'
59
+ import type {
60
+ LayoutMode,
61
+ ViewBuilder as ViewBuilderData,
62
+ ViewInfo,
63
+ WidgetInfo,
64
+ WorkspaceTabId
65
+ } from '@/lib/types'
55
66
  import {
56
67
  viewBuilderIdFromTab,
57
68
  viewBuilderTabId,
@@ -70,9 +81,9 @@ const Scratchpad = lazy(() =>
70
81
  // Tab label for a view: its configured title, or the file-name id as fallback.
71
82
  const viewLabel = (v: ViewInfo) => v.config.title || v.id
72
83
 
73
- const viewBuilderIcon = (builder: ViewBuilder) => resolveAppIcon(builder.icon) ?? IconArticle
84
+ const viewBuilderIcon = (builder: ViewBuilderData) => resolveAppIcon(builder.icon) ?? IconArticle
74
85
 
75
- function viewIcon(view: ViewInfo, builders: ViewBuilder[]) {
86
+ function viewIcon(view: ViewInfo, builders: ViewBuilderData[]) {
76
87
  const builder = builders.find(candidate => candidate.viewId === view.id)
77
88
  return resolveAppIcon(view.config.icon) ?? resolveAppIcon(builder?.icon) ?? IconArticle
78
89
  }
@@ -108,11 +119,12 @@ function WorkspaceCustomizeAction({ active, onToggle }: WorkspaceCustomizeAction
108
119
  <TooltipTrigger
109
120
  render={
110
121
  <Button
111
- variant={active ? 'secondary' : 'ghost'}
122
+ variant="ghost"
112
123
  size="icon-sm"
113
124
  aria-label="Customize"
114
125
  aria-pressed={active}
115
126
  onClick={onToggle}
127
+ className={cn(active && 'bg-accent')}
116
128
  >
117
129
  <IconLetterCase stroke={1.75} />
118
130
  </Button>
@@ -126,7 +138,7 @@ function WorkspaceCustomizeAction({ active, onToggle }: WorkspaceCustomizeAction
126
138
  type WorkspaceScreenProps = {
127
139
  widgets: WidgetInfo[]
128
140
  views: ViewInfo[]
129
- builders: ViewBuilder[]
141
+ builders: ViewBuilderData[]
130
142
  }
131
143
 
132
144
  type WidgetMode = 'idle' | 'editing' | 'customizing'
@@ -134,7 +146,7 @@ type WidgetMode = 'idle' | 'editing' | 'customizing'
134
146
  function tabItemFor(
135
147
  tab: WorkspaceTabId,
136
148
  views: ViewInfo[],
137
- builders: ViewBuilder[],
149
+ builders: ViewBuilderData[],
138
150
  closable: boolean,
139
151
  agentRunning: boolean,
140
152
  builderRunning: (sessionId: string) => boolean
@@ -208,10 +220,15 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
208
220
  const [widgetMode, setWidgetMode] = useState<WidgetMode>('idle')
209
221
  const [floatingChatOpen, setFloatingChatOpen] = useState(false)
210
222
  const [chatFocusRequest, setChatFocusRequest] = useState(0)
223
+ const builderRefs = useRef(new Map<string, ViewBuilderHandle>())
211
224
  const dockedChatWidth = useUiStore(state => state.dockedChatWidth)
212
225
  const setDockedChatWidth = useUiStore(state => state.setDockedChatWidth)
213
226
  const sessionActivity = useLive(state => state.activity)
214
227
  const hasRunningSession = hasRunningWorkspaceActivity(sessionActivity, workspaceId)
228
+ const builderDrafts = useViewBuilderDrafts({
229
+ builders,
230
+ onSave: (builderId, requirements) => builderActions.save(builderId, requirements)
231
+ })
215
232
 
216
233
  useWorkspaceTheme(layout.theme)
217
234
 
@@ -251,10 +268,13 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
251
268
  selectSession,
252
269
  dismissError
253
270
  } = useChat({ activeTab, appletParams })
254
- const { composerBanner, composerAvailability } = useWorkspaceComposerState(workspaceId, {
255
- chatError: error,
256
- onDismissChatError: dismissError
257
- })
271
+ const { composerBanner, builderComposerBanner, composerAvailability } = useWorkspaceComposerState(
272
+ workspaceId,
273
+ {
274
+ chatError: error,
275
+ onDismissChatError: dismissError
276
+ }
277
+ )
258
278
 
259
279
  const openSet = new Set(tabsState.open)
260
280
 
@@ -285,6 +305,26 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
285
305
  const activeBuilder = activeBuilderId
286
306
  ? builders.find(builder => builder.id === activeBuilderId)
287
307
  : undefined
308
+ const activeDraftBuilder =
309
+ activeBuilder?.status === 'draft' &&
310
+ !isSessionRunning(sessionActivity, workspaceId, activeBuilder.sessionId)
311
+ ? activeBuilder
312
+ : undefined
313
+ const activeDraftBuilderId = activeDraftBuilder?.id
314
+ const canAnnotate = canAnnotateWorkspaceContent(
315
+ activeTab,
316
+ widgetMode === 'idle',
317
+ activeView !== undefined
318
+ )
319
+ const annotation = useChatAnnotation({
320
+ workspaceId,
321
+ sessionId,
322
+ activeTab,
323
+ mode,
324
+ available: canAnnotate,
325
+ closePopup: () => setFloatingChatOpen(false),
326
+ openPopup: () => setFloatingChatOpen(true)
327
+ })
288
328
 
289
329
  useEffect(() => {
290
330
  const open = tabsState.open.filter(tab => tabAvailable(tab, views, builders))
@@ -339,6 +379,12 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
339
379
  }
340
380
  }, [activeTab, mode])
341
381
 
382
+ useEffect(() => {
383
+ if (!activeDraftBuilderId) return
384
+ if (mode === 'fullscreen') setFloatingChatOpen(true)
385
+ setChatFocusRequest(request => request + 1)
386
+ }, [activeDraftBuilderId, mode])
387
+
342
388
  // Tab switching is navigation; the saved default and the open set follow via
343
389
  // the navigation hook. Only the chat side effects belong to the screen.
344
390
  const openTab = (tab: WorkspaceTabId, params?: Record<string, unknown>) => {
@@ -382,10 +428,14 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
382
428
  // tabsStateRef) can't resurrect the closed tab.
383
429
  setTabs({ open, active })
384
430
  if (activeTab === tab) navigateToTab(nextTab)
385
- if (builder?.status === 'draft') void builderActions.discard(builder.id)
431
+ if (builder?.status === 'draft') {
432
+ void builderRefs.current.get(builder.id)?.resetSketch()
433
+ builderDrafts.clear(builder.id)
434
+ void builderActions.discard(builder.id)
435
+ }
386
436
  }
387
437
 
388
- const discardBuilder = (builder: ViewBuilder) => {
438
+ const discardBuilder = (builder: ViewBuilderData) => {
389
439
  const tab = viewBuilderTabId(builder.id)
390
440
  if (openSet.has(tab)) {
391
441
  let open = tabsState.open.filter(item => item !== tab)
@@ -393,6 +443,8 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
393
443
  setTabs({ open, active: tabsState.active === tab ? open[0] : tabsState.active })
394
444
  if (activeTab === tab) navigateToTab(open[0])
395
445
  }
446
+ void builderRefs.current.get(builder.id)?.resetSketch()
447
+ builderDrafts.clear(builder.id)
396
448
  void builderActions.discard(builder.id)
397
449
  }
398
450
 
@@ -489,6 +541,25 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
489
541
  }
490
542
  ]
491
543
 
544
+ const builderChatDraft = activeDraftBuilder
545
+ ? {
546
+ sessionId: activeDraftBuilder.sessionId,
547
+ builderId: activeDraftBuilder.id,
548
+ initialValue: activeDraftBuilder.input.requirements,
549
+ onChange: (value: string) => builderDrafts.change(activeDraftBuilder.id, value),
550
+ onRemoveDrawing: () => {
551
+ void builderRefs.current.get(activeDraftBuilder.id)?.resetSketch()
552
+ },
553
+ onSubmit: async (value: string) => {
554
+ const builderView = builderRefs.current.get(activeDraftBuilder.id)
555
+ await builderView?.prepareSketchForSend()
556
+ await builderActions.submit(activeDraftBuilder, value)
557
+ // Submit clears the sent attachment. Keep the canvas until the built view replaces it.
558
+ builderDrafts.clear(activeDraftBuilder.id)
559
+ }
560
+ }
561
+ : undefined
562
+
492
563
  // The docked split chat. Full-screen Agent uses the tabbed chat below.
493
564
  const dockedChat = (
494
565
  <ChatPanel
@@ -499,12 +570,14 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
499
570
  previewTurn={previewTurn}
500
571
  sessionId={sessionId}
501
572
  processing={processing}
502
- composerBanner={composerBanner}
573
+ composerBanner={builderChatDraft ? builderComposerBanner : composerBanner}
503
574
  composerAvailability={composerAvailability}
504
575
  send={send}
505
576
  stop={stop}
506
577
  onSelectSession={selectSession}
507
578
  onClose={() => setMode('fullscreen')}
579
+ annotation={annotation.docked}
580
+ builderDraft={builderChatDraft}
508
581
  docked
509
582
  />
510
583
  )
@@ -525,54 +598,79 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
525
598
  onSelectSession={selectSession}
526
599
  />
527
600
  )
528
-
529
601
  const workspacePanel = (
530
602
  <div
531
603
  className={cn(
532
- 'flex h-full min-h-0 min-w-0 flex-1 flex-col-reverse overflow-hidden bg-background shadow-xs transition-[border-radius]',
604
+ 'flex h-full min-h-0 min-w-0 flex-1 flex-col-reverse overflow-hidden bg-background shadow-md transition-[border-radius]',
533
605
  mode === 'split' && 'rounded-xl'
534
606
  )}
535
607
  >
536
- {activeTab === 'agent' ? (
537
- tabbedChat
538
- ) : activeTab === 'widgets' ? (
539
- <Widgets
540
- editing={widgetMode === 'editing'}
541
- onEditingChange={editing => setWidgetMode(editing ? 'editing' : 'idle')}
542
- widgets={widgets}
543
- onCreateWidget={() => {
544
- selectSession(null)
545
- openChat('Create widget')
546
- }}
547
- />
548
- ) : activeTab === 'scratchpad' ? (
549
- <Suspense fallback={null}>
550
- <Scratchpad />
551
- </Suspense>
552
- ) : activeBuilder ? (
553
- <ViewBuilderTab
554
- key={activeBuilder.id}
555
- builder={activeBuilder}
556
- composerAvailability={composerAvailability}
557
- onSave={requirements => builderActions.save(activeBuilder.id, requirements)}
558
- onSubmit={requirements => {
559
- if (mode === 'fullscreen') setFloatingChatOpen(true)
560
- return builderActions.submit(activeBuilder, requirements)
561
- }}
562
- onOpenChat={() => {
563
- selectSession(activeBuilder.sessionId)
564
- openChat()
565
- }}
566
- onDiscard={() => discardBuilder(activeBuilder)}
567
- />
568
- ) : null}
608
+ <div className="relative flex min-h-0 flex-1">
609
+ <div
610
+ ref={annotation.targetRef}
611
+ inert={annotation.controls.active || undefined}
612
+ aria-hidden={annotation.controls.active || undefined}
613
+ className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background"
614
+ >
615
+ {activeTab === 'agent' ? (
616
+ tabbedChat
617
+ ) : activeTab === 'widgets' ? (
618
+ <Widgets
619
+ editing={widgetMode === 'editing'}
620
+ onEditingChange={editing => setWidgetMode(editing ? 'editing' : 'idle')}
621
+ widgets={widgets}
622
+ onCreateWidget={() => {
623
+ selectSession(null)
624
+ openChat('Create widget')
625
+ }}
626
+ />
627
+ ) : activeTab === 'scratchpad' ? (
628
+ <Suspense fallback={null}>
629
+ <Scratchpad />
630
+ </Suspense>
631
+ ) : null}
632
+
633
+ {builders
634
+ .filter(builder => builder.status !== 'ready')
635
+ .map(builder => (
636
+ <ViewBuilder
637
+ key={builder.id}
638
+ ref={handle => {
639
+ if (handle) builderRefs.current.set(builder.id, handle)
640
+ else builderRefs.current.delete(builder.id)
641
+ }}
642
+ active={activeBuilder?.id === builder.id}
643
+ builder={builder}
644
+ chatDocked={mode === 'split'}
645
+ workspaceId={workspaceId}
646
+ onEditingStart={() => {
647
+ if (mode === 'fullscreen') setFloatingChatOpen(false)
648
+ }}
649
+ onContinueInChat={openChat}
650
+ onOpenChat={() => {
651
+ selectSession(builder.sessionId)
652
+ openChat()
653
+ }}
654
+ onDiscard={() => discardBuilder(builder)}
655
+ />
656
+ ))}
657
+
658
+ {/* Views are not part of the chain above: ViewManager keeps them
659
+ mounted across tab switches (and collapses to nothing while
660
+ another tab is on screen), which is what makes a switch back
661
+ instant. */}
662
+ <ViewManager views={views} activeViewId={activeView?.id ?? null} params={appletParams} />
663
+ </div>
569
664
 
570
- {/* Views are not part of the chain above: ViewManager keeps them
571
- mounted across tab switches (and collapses to nothing while
572
- another tab is on screen), which is what makes a switch back
573
- instant. It stays with the content, so the header below it in
574
- the DOM keeps painting over both. */}
575
- <ViewManager views={views} activeViewId={activeView?.id ?? null} params={appletParams} />
665
+ <DrawingLayer {...annotation.layerProps}>
666
+ <DrawingToolbar
667
+ controls={annotation.controls}
668
+ title="Draw annotation"
669
+ busy={annotation.controls.finishing}
670
+ onComplete={() => void annotation.controls.finish()}
671
+ />
672
+ </DrawingLayer>
673
+ </div>
576
674
 
577
675
  <PanelHeader>
578
676
  <div className="flex min-w-0 flex-1 items-center gap-4">
@@ -649,12 +747,14 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
649
747
  previewTurn={previewTurn}
650
748
  sessionId={sessionId}
651
749
  processing={processing}
652
- composerBanner={composerBanner}
750
+ composerBanner={builderChatDraft ? builderComposerBanner : composerBanner}
653
751
  composerAvailability={composerAvailability}
654
752
  send={send}
655
753
  stop={stop}
656
754
  onSelectSession={selectSession}
657
755
  onClose={onClose}
756
+ annotation={annotation.popup}
757
+ builderDraft={builderChatDraft}
658
758
  />
659
759
  )}
660
760
  </ChatPopup>
@@ -1,4 +1,4 @@
1
- import { IconPlus, IconX, type TablerIcon } from '@tabler/icons-react'
1
+ import { IconPlus, IconX, type Icon as TabIcon } from '@tabler/icons-react'
2
2
  import { cva } from 'class-variance-authority'
3
3
 
4
4
  import { IconGhost } from '@/client/components/shared/IconGhost'
@@ -18,7 +18,7 @@ import type { WorkspaceTabId } from '@/lib/types'
18
18
 
19
19
  export type WorkspaceTabItem = {
20
20
  key: WorkspaceTabId
21
- Icon: TablerIcon
21
+ Icon: TabIcon
22
22
  label: string
23
23
  closable?: boolean
24
24
  loading?: boolean
@@ -26,7 +26,7 @@ export type WorkspaceTabItem = {
26
26
 
27
27
  export type CreateWorkspaceTabItem = {
28
28
  key: string
29
- Icon: TablerIcon
29
+ Icon: TabIcon
30
30
  label: string
31
31
  onClick: () => void
32
32
  }
@@ -18,7 +18,7 @@ function tokenPx(name: string): number {
18
18
  return raw.endsWith('rem') ? value * Number.parseFloat(getComputedStyle(root).fontSize) : value
19
19
  }
20
20
 
21
- // Observe the full workspace row, not either pane, so split-fit measurement does
21
+ // Measure the full workspace row, not either pane, so split-fit measurement does
22
22
  // not oscillate when the chat column appears or disappears.
23
23
  export function useFitsSplitLayout<T extends HTMLElement>() {
24
24
  const ref = useRef<T>(null)
@@ -32,21 +32,27 @@ export function useFitsSplitLayout<T extends HTMLElement>() {
32
32
  const workspaceMinWidth = tokenPx('--column-w')
33
33
  const chatMinWidth = tokenPx('--chat-min')
34
34
  const chatMaxWidth = tokenPx('--chat-max')
35
- setState({
35
+ const next = {
36
36
  fits: width - chatMinWidth >= workspaceMinWidth,
37
37
  workspaceMinWidth,
38
38
  chatMinWidth,
39
39
  chatMaxWidth
40
- })
40
+ }
41
+ setState(current =>
42
+ current?.fits === next.fits &&
43
+ current.workspaceMinWidth === next.workspaceMinWidth &&
44
+ current.chatMinWidth === next.chatMinWidth &&
45
+ current.chatMaxWidth === next.chatMaxWidth
46
+ ? current
47
+ : next
48
+ )
41
49
  }
42
50
 
43
51
  update(el.getBoundingClientRect().width)
44
52
 
45
- const ro = new ResizeObserver(([entry]) => {
46
- if (entry) update(entry.contentRect.width)
47
- })
48
- ro.observe(el)
49
- return () => ro.disconnect()
53
+ const onResize = () => update(el.getBoundingClientRect().width)
54
+ window.addEventListener('resize', onResize)
55
+ return () => window.removeEventListener('resize', onResize)
50
56
  }, [])
51
57
 
52
58
  return {
package/client/index.css CHANGED
@@ -15,6 +15,10 @@
15
15
  @custom-variant dark-or-widget (&:is(.dark *, [data-widget-chrome] *));
16
16
 
17
17
  :root {
18
+ --cursor-pencil:
19
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='white' stroke='%23171717' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cdefs%3E%3Cfilter id='s' x='-20%25' y='-20%25' width='140%25' height='150%25'%3E%3CfeDropShadow dx='0' dy='1' stdDeviation='.65' flood-color='%23000' flood-opacity='.14'/%3E%3C/filter%3E%3C/defs%3E%3Cg filter='url(%23s)'%3E%3Cpath d='M4 20h4l10.5-10.5a2.828 2.828 0 1 0-4-4L4 16v4'/%3E%3Cpath d='m13.5 6.5 4 4'/%3E%3C/g%3E%3C/svg%3E")
20
+ 3 17,
21
+ crosshair;
18
22
  --background: oklch(1 0 0);
19
23
  --foreground: oklch(0.145 0 0);
20
24
  --card: oklch(1 0 0);
@@ -172,6 +176,10 @@
172
176
  }
173
177
  }
174
178
 
179
+ @utility cursor-pencil {
180
+ cursor: var(--cursor-pencil);
181
+ }
182
+
175
183
  /* Tool details toggle */
176
184
  details > summary {
177
185
  list-style: none;
@@ -9,11 +9,13 @@ type UiStore = {
9
9
  hasSentMessageFromMoi: boolean
10
10
  workspaceIdsPendingAnalysis: string[]
11
11
  composerDrafts: Record<string, string>
12
+ viewBuilderDrafts: Record<string, string>
12
13
  dockedChatWidth: number
13
14
  setDiscoveredWorkspacesOpen: (open: boolean) => void
14
15
  markWorkspacePendingAnalysis: (workspaceId: string) => void
15
16
  markMessageSentFromMoi: (workspaceId: string) => void
16
17
  setComposerDraft: (workspaceId: string, value: string) => void
18
+ setViewBuilderDraft: (builderId: string, value: string | null) => void
17
19
  setDockedChatWidth: (width: number) => void
18
20
  }
19
21
 
@@ -25,6 +27,7 @@ export const createUiStore = (storage?: StateStorage) =>
25
27
  hasSentMessageFromMoi: false,
26
28
  workspaceIdsPendingAnalysis: [],
27
29
  composerDrafts: {},
30
+ viewBuilderDrafts: {},
28
31
  dockedChatWidth: 360,
29
32
  setDiscoveredWorkspacesOpen: open => set({ discoveredWorkspacesOpen: open }),
30
33
  markWorkspacePendingAnalysis: workspaceId =>
@@ -50,6 +53,22 @@ export const createUiStore = (storage?: StateStorage) =>
50
53
  else delete composerDrafts[workspaceId]
51
54
  return { composerDrafts }
52
55
  }),
56
+ // Unlike composer drafts, an empty string stays stored: the composer
57
+ // falls back to the builder's server-saved requirements when no draft
58
+ // exists, and deleting all text must not resurrect them. Pass null to
59
+ // drop the draft (submit, discard).
60
+ setViewBuilderDraft: (builderId, value) =>
61
+ set(state => {
62
+ const current = state.viewBuilderDrafts ?? {}
63
+ if (value === null) {
64
+ if (!(builderId in current)) return state
65
+ const viewBuilderDrafts = { ...current }
66
+ delete viewBuilderDrafts[builderId]
67
+ return { viewBuilderDrafts }
68
+ }
69
+ if (current[builderId] === value) return state
70
+ return { viewBuilderDrafts: { ...current, [builderId]: value } }
71
+ }),
53
72
  setDockedChatWidth: width => set({ dockedChatWidth: width })
54
73
  }),
55
74
  storage
package/client/theme.css CHANGED
@@ -69,27 +69,42 @@
69
69
  0px 24px 48px -8px rgba(0, 0, 0, 0.12);
70
70
  }
71
71
 
72
+ @theme {
73
+ --animate-glow: glow 5s ease-in-out infinite;
74
+
75
+ @keyframes glow {
76
+ 0%,
77
+ 100% {
78
+ opacity: 1;
79
+ }
80
+
81
+ 50% {
82
+ opacity: 0.85;
83
+ }
84
+ }
85
+ }
86
+
72
87
  /* Texture utilities leave background-color untouched so components keep an
73
88
  * opaque semantic base underneath them. */
74
89
 
75
90
  @utility texture-checker {
76
91
  background-image: repeating-conic-gradient(
77
- color-mix(in oklch, var(--primary) 1%, var(--foreground) 1%) 0 25%,
78
- color-mix(in oklch, var(--primary) 3%, var(--foreground) 3%) 0 50%
92
+ transparent 0 25%,
93
+ color-mix(in oklch, var(--primary) 2%, var(--foreground) 4%) 0 50%
79
94
  );
80
- background-position: 0 0;
95
+ background-position: 50% 50%;
81
96
  background-repeat: repeat;
82
97
  background-size: 32px 32px;
83
98
  }
84
99
 
85
100
  @utility texture-checker-* {
86
101
  background-image: repeating-conic-gradient(
87
- color-mix(in oklch, var(--primary) 1%, var(--foreground) 1%) 0 25%,
88
- color-mix(in oklch, var(--primary) 3%, var(--foreground) 3%) 0 50%
102
+ transparent 0 25%,
103
+ color-mix(in oklch, var(--primary) 2%, var(--foreground) 4%) 0 50%
89
104
  );
90
- background-position: 0 0;
105
+ background-position: 50% 50%;
91
106
  background-repeat: repeat;
92
- background-size: --value([length]) --value([length]);
107
+ background-size: calc(--value(number) * var(--spacing)) calc(--value(number) * var(--spacing));
93
108
  }
94
109
 
95
110
  @utility texture-grid {
@@ -104,7 +119,7 @@
104
119
  color-mix(in oklch, var(--primary) 3%, var(--foreground) 3%) 1px,
105
120
  transparent 1px
106
121
  );
107
- background-position: -12px -12px;
122
+ background-position: 50% 50%;
108
123
  background-repeat: repeat;
109
124
  background-size: 24px 24px;
110
125
  }
@@ -157,3 +172,13 @@
157
172
  }
158
173
  }
159
174
  }
175
+
176
+ @utility texture-inset-shadow-* {
177
+ box-shadow: inset 0 0 32px 24px
178
+ color-mix(in oklch, var(--primary) --value(percentage), transparent);
179
+
180
+ @media (width < 48rem) {
181
+ box-shadow: inset 0 0 16px 16px
182
+ color-mix(in oklch, var(--primary) --value(percentage), transparent);
183
+ }
184
+ }