moi-computer 0.9.0 → 0.9.1-next.1

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 (120) hide show
  1. package/client/api/app-config.ts +51 -0
  2. package/client/api/workspace-keys.ts +1 -0
  3. package/client/app/routes/WorkspaceRoute.tsx +4 -2
  4. package/client/assets/hermes.png +0 -0
  5. package/client/components/shared/IconGhost.tsx +15 -18
  6. package/client/components/ui/button.tsx +2 -2
  7. package/client/components/ui/hover-card.tsx +1 -1
  8. package/client/components/ui/popover.tsx +3 -1
  9. package/client/features/applets/api.ts +38 -0
  10. package/client/features/applets/applet-thumbnail.ts +208 -0
  11. package/client/features/chat/ChatEmptyState.tsx +30 -10
  12. package/client/features/chat/ChatPanel.tsx +67 -31
  13. package/client/features/chat/ChatPopup.tsx +3 -2
  14. package/client/features/chat/ChatPromptBubbles.tsx +1 -1
  15. package/client/features/chat/ChatSelector.tsx +29 -10
  16. package/client/features/chat/MarkdownContent.tsx +3 -3
  17. package/client/features/chat/attachment-staging.ts +153 -0
  18. package/client/features/chat/chat-send.ts +55 -0
  19. package/client/features/chat/chat-store.ts +32 -8
  20. package/client/features/chat/composer/ChatComposer.tsx +190 -77
  21. package/client/features/chat/{ModelPicker.tsx → composer/ModelPicker.tsx} +29 -25
  22. package/client/features/chat/composer/banners/ComposerBanner.tsx +1 -1
  23. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +4 -13
  24. package/client/features/chat/{model-order.ts → composer/model-order.ts} +16 -0
  25. package/client/features/chat/composer/useWorkspaceComposerState.tsx +9 -4
  26. package/client/features/chat/tool-group/format/claude.ts +48 -0
  27. package/client/features/chat/tool-group/format/codex.ts +126 -0
  28. package/client/features/chat/tool-group/format/hermes.ts +68 -0
  29. package/client/features/chat/tool-group/format/index.ts +34 -0
  30. package/client/features/chat/tool-group/format/mcp.ts +64 -0
  31. package/client/features/chat/tool-group/format/openclaw.ts +116 -0
  32. package/client/features/chat/tool-group/format/shared.ts +49 -0
  33. package/client/features/chat/useChat.ts +5 -10
  34. package/client/features/drawings/DrawingLayer.tsx +49 -0
  35. package/client/features/drawings/DrawingToolbar.tsx +95 -0
  36. package/client/features/drawings/capture-element.ts +45 -0
  37. package/client/features/drawings/useChatAnnotation.ts +222 -0
  38. package/client/features/drawings/useDrawingLayer.ts +758 -0
  39. package/client/features/drawings/useViewBuilderSketch.ts +151 -0
  40. package/client/features/home/HomePage.tsx +13 -0
  41. package/client/features/home/WorkspacePreview.tsx +10 -5
  42. package/client/features/home/workspace-presentation.tsx +6 -2
  43. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +9 -0
  44. package/client/features/home/workspace-setup/InstallMoiDialog.tsx +245 -0
  45. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +13 -7
  46. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +1 -1
  47. package/client/features/scratchpad/ScratchpadControls.tsx +19 -5
  48. package/client/features/views/ViewBuilder.tsx +238 -0
  49. package/client/features/views/ViewManager.tsx +18 -2
  50. package/client/features/views/api.ts +1 -0
  51. package/client/features/views/useViewBuilderActions.ts +24 -3
  52. package/client/features/views/useViewBuilderDrafts.ts +66 -0
  53. package/client/features/widgets/WidgetFrame.tsx +1 -1
  54. package/client/features/widgets/WidgetGrid.tsx +1 -1
  55. package/client/features/widgets/Widgets.tsx +39 -54
  56. package/client/features/workspace/CustomizePanel.tsx +30 -9
  57. package/client/features/workspace/WorkspaceScreen.tsx +158 -64
  58. package/client/features/workspace/WorkspaceTabs.tsx +3 -3
  59. package/client/features/workspace/useFitsSplitLayout.ts +14 -8
  60. package/client/index.css +8 -0
  61. package/client/index.tsx +6 -1
  62. package/client/runtime/useWorkspaceEvents.ts +17 -0
  63. package/client/runtime/workspace-theme.ts +29 -6
  64. package/client/store/ui.ts +19 -0
  65. package/client/theme.css +33 -8
  66. package/dist/chunk-5c19v3zr.js +10 -0
  67. package/dist/chunk-6wx91x8j.js +1 -0
  68. package/dist/chunk-8s41nd3g.js +1 -0
  69. package/dist/{chunk-kkj86722.js → chunk-a7fzp0z0.js} +78 -78
  70. package/dist/{chunk-2vaafjp4.js → chunk-b959mdkj.js} +1 -1
  71. package/dist/chunk-cagtq45k.js +1 -0
  72. package/dist/chunk-cva7jpt4.js +82 -0
  73. package/dist/chunk-sapvd7he.css +1 -0
  74. package/dist/{chunk-35fq49qa.js → chunk-zbeq02yc.js} +1 -1
  75. package/dist/chunk-zbt8emsw.js +2 -0
  76. package/dist/chunk-zfz3b4xg.js +2 -0
  77. package/dist/hermes-pznd63x9.png +0 -0
  78. package/dist/index.html +1 -1
  79. package/lib/format.ts +1 -1
  80. package/lib/themes.ts +8 -8
  81. package/lib/types.ts +68 -42
  82. package/lib/workspace-types.ts +2 -1
  83. package/package.json +2 -1
  84. package/server/api.ts +90 -33
  85. package/server/app-config.ts +144 -0
  86. package/server/applets.ts +17 -0
  87. package/server/cli.ts +235 -14
  88. package/server/harness/README.md +64 -17
  89. package/server/harness/acp/adapter.ts +220 -0
  90. package/server/harness/acp/archived.ts +88 -0
  91. package/server/harness/acp/client.ts +328 -0
  92. package/server/harness/acp/discovery.ts +130 -0
  93. package/server/harness/acp/run-durations.ts +68 -0
  94. package/server/harness/acp/session.ts +788 -0
  95. package/server/harness/acp/wire.ts +132 -0
  96. package/server/harness/executable.ts +15 -1
  97. package/server/harness/hermes/NOTES.md +815 -0
  98. package/server/harness/hermes/discovery.ts +155 -0
  99. package/server/harness/hermes/index.ts +155 -0
  100. package/server/harness/hermes/models.ts +79 -0
  101. package/server/harness/registry.ts +3 -1
  102. package/server/layout.ts +40 -45
  103. package/server/moi-scaffold.ts +37 -1
  104. package/server/thumbnails.ts +197 -0
  105. package/server/view-builders.ts +4 -2
  106. package/server/views.ts +10 -1
  107. package/server/widgets.ts +4 -18
  108. package/server/workspace-import.ts +30 -1
  109. package/workspace/.claude/skills/moi-workspace/SKILL.md +13 -1
  110. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +153 -253
  111. package/client/features/chat/tool-group/format.ts +0 -384
  112. package/client/features/views/ViewBuilderTab.tsx +0 -152
  113. package/client/features/widgets/api.ts +0 -47
  114. package/client/features/widgets/useWidgetThumbnails.ts +0 -107
  115. package/client/features/widgets/widget-snapshot.ts +0 -71
  116. package/dist/chunk-3b3rkjet.js +0 -1
  117. package/dist/chunk-gt7n06ef.js +0 -1
  118. package/dist/chunk-ty1sqbmn.js +0 -80
  119. package/dist/chunk-xeyxk7ep.js +0 -10
  120. package/dist/chunk-yz6wd5vc.css +0 -1
@@ -0,0 +1,151 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react'
2
+
3
+ import { stageDrawing, stageDrawingDraft } from '@/client/features/chat/attachment-staging'
4
+ import { attachmentKey, liveStore } from '@/client/features/chat/chat-store'
5
+ import type { WorkspaceTabId } from '@/lib/types'
6
+
7
+ import { useDrawingLayer } from './useDrawingLayer'
8
+
9
+ type UseViewBuilderSketchOptions = {
10
+ active: boolean
11
+ builderId: string
12
+ sessionId: string
13
+ sourceTab: WorkspaceTabId
14
+ workspaceId: string
15
+ onEditingStart: () => void
16
+ onContinueInChat: () => void
17
+ }
18
+
19
+ export type ViewBuilderSketchController = ReturnType<typeof useViewBuilderSketch>
20
+
21
+ export function useViewBuilderSketch({
22
+ active,
23
+ builderId,
24
+ sessionId,
25
+ sourceTab,
26
+ workspaceId,
27
+ onEditingStart,
28
+ onContinueInChat
29
+ }: UseViewBuilderSketchOptions) {
30
+ const attachmentIdRef = useRef(`sketch:${builderId}`)
31
+ const uploadRevisionRef = useRef(0)
32
+ const uploadedBlobRef = useRef<Blob | null>(null)
33
+ const pendingStageRef = useRef<Promise<void> | null>(null)
34
+ const acceptExportsRef = useRef(true)
35
+ const [continuing, setContinuing] = useState(false)
36
+ const onEditingStartRef = useRef(onEditingStart)
37
+ const onContinueInChatRef = useRef(onContinueInChat)
38
+ onEditingStartRef.current = onEditingStart
39
+ onContinueInChatRef.current = onContinueInChat
40
+
41
+ // While drawing, every commit only refreshes the chip's local preview. The
42
+ // single upload happens when the sketching session ends: prepareForSend
43
+ // (submit) or deactivate (tab switch, continue in chat).
44
+ const change = useCallback(
45
+ (blob: Blob | null) => {
46
+ if (!acceptExportsRef.current) return
47
+ if (!blob) {
48
+ uploadRevisionRef.current += 1
49
+ uploadedBlobRef.current = null
50
+ pendingStageRef.current = null
51
+ liveStore.getState().removeAttachment(workspaceId, sessionId, attachmentIdRef.current)
52
+ return
53
+ }
54
+
55
+ stageDrawingDraft({
56
+ workspaceId,
57
+ sessionId,
58
+ localId: attachmentIdRef.current,
59
+ purpose: 'sketch',
60
+ sourceTab,
61
+ blob
62
+ })
63
+ },
64
+ [sessionId, sourceTab, workspaceId]
65
+ )
66
+
67
+ // Exports are cached per history version, so an unchanged sketch comes back
68
+ // as the same Blob instance — the identity check is what makes repeated
69
+ // deactivations free instead of re-uploading the same image. A failed
70
+ // upload removes the attachment, so "same blob but not staged" retries.
71
+ const uploadIfNeeded = useCallback(
72
+ (blob: Blob | null): Promise<void> => {
73
+ if (!blob) return pendingStageRef.current ?? Promise.resolve()
74
+ if (blob === uploadedBlobRef.current) {
75
+ const staged = liveStore
76
+ .getState()
77
+ .attachments[attachmentKey(workspaceId, sessionId)]?.some(
78
+ attachment =>
79
+ attachment.localId === attachmentIdRef.current &&
80
+ (attachment.status === 'ready' || attachment.status === 'uploading')
81
+ )
82
+ if (staged) return pendingStageRef.current ?? Promise.resolve()
83
+ }
84
+ uploadedBlobRef.current = blob
85
+ const revision = ++uploadRevisionRef.current
86
+ const pending = stageDrawing({
87
+ workspaceId,
88
+ sessionId,
89
+ localId: attachmentIdRef.current,
90
+ purpose: 'sketch',
91
+ sourceTab,
92
+ blob,
93
+ isCurrent: () => uploadRevisionRef.current === revision
94
+ })
95
+ pendingStageRef.current = pending
96
+ return pending
97
+ },
98
+ [sessionId, sourceTab, workspaceId]
99
+ )
100
+
101
+ const drawing = useDrawingLayer({
102
+ mode: 'sketch',
103
+ onChange: change,
104
+ onEditingStart: () => onEditingStartRef.current()
105
+ })
106
+ const { controls } = drawing
107
+
108
+ const prepareForSend = useCallback(async () => {
109
+ await uploadIfNeeded(await controls.flush())
110
+ }, [controls, uploadIfNeeded])
111
+
112
+ const deactivate = useCallback(async () => {
113
+ await uploadIfNeeded(await controls.deactivate())
114
+ }, [controls, uploadIfNeeded])
115
+
116
+ const continueInChat = useCallback(async () => {
117
+ if (continuing) return
118
+ setContinuing(true)
119
+ try {
120
+ await deactivate()
121
+ onContinueInChatRef.current()
122
+ } finally {
123
+ setContinuing(false)
124
+ }
125
+ }, [continuing, deactivate])
126
+
127
+ const resetDocument = useCallback(async () => {
128
+ acceptExportsRef.current = false
129
+ uploadRevisionRef.current += 1
130
+ uploadedBlobRef.current = null
131
+ pendingStageRef.current = null
132
+ liveStore.getState().removeAttachment(workspaceId, sessionId, attachmentIdRef.current)
133
+ try {
134
+ await controls.cancel()
135
+ } finally {
136
+ acceptExportsRef.current = true
137
+ }
138
+ }, [controls, sessionId, workspaceId])
139
+
140
+ useEffect(() => {
141
+ if (!active && controls.active) void deactivate()
142
+ }, [active, controls.active, deactivate])
143
+
144
+ return {
145
+ ...drawing,
146
+ continuing,
147
+ continueInChat,
148
+ prepareForSend,
149
+ resetDocument
150
+ }
151
+ }
@@ -1,3 +1,5 @@
1
+ import { useState } from 'react'
2
+
1
3
  import { IconChevronRight, IconEggCracked, IconLoader2, IconPlus } from '@tabler/icons-react'
2
4
  import { Link, useLocation } from 'wouter'
3
5
 
@@ -9,8 +11,10 @@ import {
9
11
  } from './api'
10
12
  import { CreateWorkspaceDialog } from './workspace-setup/CreateWorkspaceDialog'
11
13
  import { ImportWorkspaceDialog } from './workspace-setup/ImportWorkspaceDialog'
14
+ import { InstallMoiDialog } from './workspace-setup/InstallMoiDialog'
12
15
  import { useWorkspaceImport } from './workspace-setup/useWorkspaceImport'
13
16
  import { HomeLogo } from './HomeLogo'
17
+ import { useAppConfig } from '@/client/api/app-config'
14
18
  import { Button } from '@/client/components/ui/button'
15
19
  import {
16
20
  Collapsible,
@@ -38,6 +42,8 @@ export function HomePage() {
38
42
  const importFlow = useWorkspaceImport({
39
43
  onSuccess: entry => navigate(`/workspace/${entry.id}`)
40
44
  })
45
+ const appConfig = useAppConfig()
46
+ const [installDialogOpen, setInstallDialogOpen] = useState(false)
41
47
  const discoveredWorkspacesOpen = useUiStore(state => state.discoveredWorkspacesOpen)
42
48
  const setDiscoveredWorkspacesOpen = useUiStore(state => state.setDiscoveredWorkspacesOpen)
43
49
 
@@ -62,6 +68,11 @@ export function HomePage() {
62
68
  const count = workspaces.length
63
69
 
64
70
  function handleAdd(suggestion: DiscoveredWorkspace) {
71
+ // Cloud demo: adding workspaces is off — offer the install dialog instead.
72
+ if (appConfig.cloudDemo) {
73
+ setInstallDialogOpen(true)
74
+ return
75
+ }
65
76
  importFlow.startImport(suggestion)
66
77
  }
67
78
 
@@ -149,6 +160,8 @@ export function HomePage() {
149
160
  onReset={importFlow.reset}
150
161
  />
151
162
  )}
163
+
164
+ <InstallMoiDialog open={installDialogOpen} onOpenChange={setInstallDialogOpen} />
152
165
  </div>
153
166
  )
154
167
  }
@@ -1,7 +1,10 @@
1
1
  import { useLayoutEffect, useRef, useState } from 'react'
2
2
 
3
3
  import { cn } from '@/client/lib/cn'
4
- import { getWorkspaceThemeStyle } from '@/client/runtime/workspace-theme'
4
+ import {
5
+ getWorkspaceThemeColorStyle,
6
+ getWorkspaceThemeStyle
7
+ } from '@/client/runtime/workspace-theme'
5
8
 
6
9
  import { useWorkspacePreview } from './api'
7
10
 
@@ -85,7 +88,7 @@ function useFolderRadiusScale() {
85
88
  return { ref, horizontalRadiusScale }
86
89
  }
87
90
 
88
- // Bottom-to-top placement for up to three widget screenshots. Each card peeks
91
+ // Bottom-to-top placement for up to three applet thumbnails. Each card peeks
89
92
  // out of the folder at a slightly different angle and lifts on card hover.
90
93
  const STACK = [
91
94
  cn(
@@ -115,9 +118,10 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
115
118
  const backdropPath = folderBackdropPath(horizontalRadiusScale)
116
119
  const noiseFilterId = `folder-noise-${workspaceId}`
117
120
  const themeStyle = getWorkspaceThemeStyle(theme)
121
+ const folderThemeStyle = getWorkspaceThemeColorStyle(theme)
118
122
 
119
123
  return (
120
- <div ref={ref} style={themeStyle} className="relative h-45 w-full font-sans">
124
+ <div ref={ref} style={folderThemeStyle} className="relative h-45 w-full">
121
125
  <svg
122
126
  viewBox={`0 0 ${FOLDER.width} ${FOLDER.height}`}
123
127
  preserveAspectRatio="none"
@@ -158,7 +162,7 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
158
162
  alt=""
159
163
  loading="lazy"
160
164
  className={cn(
161
- 'absolute top-[12%] left-[14%] aspect-4/3 w-[72%] rounded-lg object-cover object-top shadow-xs',
165
+ 'absolute top-[12%] left-[14%] h-auto max-h-[72%] w-auto max-w-[72%] rounded-[calc(var(--radius-2xl)*0.4)] bg-background object-contain shadow-xs [corner-shape:superellipse(1.2)]',
162
166
  'animate-in transition-transform duration-300 ease-out fade-in',
163
167
  slots[index]
164
168
  )}
@@ -169,8 +173,9 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
169
173
  <div className="absolute inset-x-[12%] top-[22%] flex justify-end">
170
174
  <div
171
175
  aria-hidden="true"
176
+ style={themeStyle}
172
177
  className={cn(
173
- 'w-max max-w-40 origin-center rounded-lg bg-card px-3 py-2 shadow-xs',
178
+ 'w-max max-w-40 origin-center rounded-lg bg-card px-3 py-2 font-sans shadow-xs',
174
179
  'animate-in transition-transform duration-300 ease-out fade-in',
175
180
  STACK[STACK.length - 1],
176
181
  'group-hover:translate-y-0.5 group-focus-visible:translate-y-0.5'
@@ -1,4 +1,5 @@
1
1
  import claudeIcon from '@/client/assets/claude.svg'
2
+ import hermesIcon from '@/client/assets/hermes.png'
2
3
  import openaiIcon from '@/client/assets/openai.svg'
3
4
  import openclawIcon from '@/client/assets/openclaw.svg'
4
5
  import type { DiscoveredWorkspace, WorkspaceEntry, WorkspaceType } from '@/lib/types'
@@ -6,13 +7,15 @@ import type { DiscoveredWorkspace, WorkspaceEntry, WorkspaceType } from '@/lib/t
6
7
  export const workspaceProviderIcon: Record<WorkspaceType, string> = {
7
8
  'claude-code': claudeIcon,
8
9
  openclaw: openclawIcon,
9
- codex: openaiIcon
10
+ codex: openaiIcon,
11
+ hermes: hermesIcon
10
12
  }
11
13
 
12
14
  export const workspaceTypeLabel: Record<WorkspaceType, string> = {
13
15
  'claude-code': 'Claude Code',
14
16
  openclaw: 'OpenClaw',
15
- codex: 'Codex'
17
+ codex: 'Codex',
18
+ hermes: 'Hermes'
16
19
  }
17
20
 
18
21
  type WorkspaceAgentIconsProps = {
@@ -42,5 +45,6 @@ export function workspaceDisplayName(workspace: WorkspaceDisplaySource): string
42
45
  if ('types' in workspace) return workspace.path.split('/').pop() || workspace.path
43
46
  if (workspace.name) return workspace.name
44
47
  if (workspace.type === 'openclaw') return workspace.agentId ?? 'OpenClaw agent'
48
+ if (workspace.type === 'hermes') return workspace.agentId ?? 'Hermes agent'
45
49
  return workspace.path.split('/').pop() || workspace.path
46
50
  }
@@ -3,6 +3,7 @@ import { type FormEvent, type ReactElement, useState } from 'react'
3
3
  import { useLocation } from 'wouter'
4
4
 
5
5
  import { useCreateWorkspace, useWorkspaceSetupInfo } from '../api'
6
+ import { useAppConfig } from '@/client/api/app-config'
6
7
  import { Button } from '@/client/components/ui/button'
7
8
  import {
8
9
  Dialog,
@@ -16,6 +17,7 @@ import { validateWorkspaceFolderName } from '@/lib/workspace-name'
16
17
  import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
17
18
  import type { WorkspaceType } from '@/lib/types'
18
19
 
20
+ import { InstallMoiDialog } from './InstallMoiDialog'
19
21
  import { WorkspaceAgentStep } from './WorkspaceAgentStep'
20
22
  import { WorkspaceDialogContent } from './WorkspaceDialogContent'
21
23
 
@@ -29,6 +31,7 @@ const DEFAULT_WORKSPACE_TYPE = WORKSPACE_TYPE_ORDER[0]
29
31
 
30
32
  export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
31
33
  const [, navigate] = useLocation()
34
+ const appConfig = useAppConfig()
32
35
  const info = useWorkspaceSetupInfo()
33
36
  const createMutation = useCreateWorkspace()
34
37
 
@@ -41,6 +44,12 @@ export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
41
44
  const nameError = trimmedName ? validateWorkspaceFolderName(trimmedName) : null
42
45
  const isCreating = createMutation.isPending
43
46
 
47
+ // Cloud demo: creating workspaces is off — the same trigger opens the
48
+ // install-moi dialog instead. After every hook so the hook order is stable.
49
+ if (appConfig.cloudDemo) {
50
+ return <InstallMoiDialog trigger={trigger} />
51
+ }
52
+
44
53
  function finish(workspaceId: string) {
45
54
  setOpen(false)
46
55
  navigate(`/workspace/${workspaceId}`)
@@ -0,0 +1,245 @@
1
+ import { type ReactElement, useEffect, useState } from 'react'
2
+
3
+ import {
4
+ IconArrowUpRight,
5
+ IconCheck,
6
+ IconCopy,
7
+ IconFolders,
8
+ IconTerminal2,
9
+ IconX
10
+ } from '@tabler/icons-react'
11
+
12
+ import claudeIcon from '@/client/assets/claude.svg'
13
+ import hermesIcon from '@/client/assets/hermes.png'
14
+ import openaiIcon from '@/client/assets/openai.svg'
15
+ import openclawIcon from '@/client/assets/openclaw.svg'
16
+ import { Button } from '@/client/components/ui/button'
17
+ import {
18
+ Dialog,
19
+ DialogClose,
20
+ DialogContent,
21
+ DialogDescription,
22
+ DialogTitle,
23
+ DialogTrigger
24
+ } from '@/client/components/ui/dialog'
25
+ import { useAppConfig } from '@/client/api/app-config'
26
+
27
+ // The canonical setup prompt from moi.computer — pasted into any agent, it
28
+ // fetches INSTALL.md and walks itself through the install.
29
+ const AGENT_COMMAND =
30
+ 'Set up the moi workspace for this project. Fetch https://moi.computer/INSTALL.md, and follow the steps.'
31
+
32
+ type InstallMoiDialogProps = {
33
+ // Trigger-owned (uncontrolled) or controlled via open/onOpenChange — the
34
+ // create-workspace buttons use the former, programmatic opens the latter.
35
+ trigger?: ReactElement
36
+ open?: boolean
37
+ onOpenChange?: (open: boolean) => void
38
+ }
39
+
40
+ // Shown in the cloud demo wherever a workspace would be created: the demo is
41
+ // limited to its built-in workspaces, and the way out is installing moi.
42
+ export function InstallMoiDialog({ trigger, open, onOpenChange }: InstallMoiDialogProps) {
43
+ return (
44
+ <Dialog open={open} onOpenChange={onOpenChange}>
45
+ {trigger && <DialogTrigger render={trigger} />}
46
+ <InstallMoiDialogContent />
47
+ </Dialog>
48
+ )
49
+ }
50
+
51
+ // Hero artwork: a floppy disk cropped by the band, on a soft gradient. The
52
+ // gradient's raw colors are a deliberate owner-approved exception to the
53
+ // semantic-token rule — this block is an illustration (constant across
54
+ // themes), not a UI surface.
55
+ function FloppyHero() {
56
+ return (
57
+ <div className="relative h-44 overflow-hidden rounded-lg bg-[#e6dcc4] bg-[image:radial-gradient(75%_110%_at_0%_0%,#e0742f_0%,rgba(224,116,47,0)_48%),radial-gradient(110%_160%_at_100%_0%,#16352a_0%,rgba(22,53,42,0)_60%),radial-gradient(70%_90%_at_90%_100%,#8fb492_0%,rgba(143,180,146,0)_55%),radial-gradient(60%_80%_at_8%_100%,#dcc294_0%,rgba(220,194,148,0)_52%)]">
58
+ <FloppyDisk className="absolute top-9 left-1/2 w-52 -translate-x-1/2 -rotate-6 drop-shadow-xl" />
59
+ {/* film grain, keeps the flat gradients from banding */}
60
+ <svg
61
+ className="absolute inset-0 size-full opacity-30 mix-blend-soft-light"
62
+ aria-hidden="true"
63
+ >
64
+ <filter id="floppy-grain">
65
+ <feTurbulence
66
+ type="fractalNoise"
67
+ baseFrequency="0.8"
68
+ numOctaves="2"
69
+ stitchTiles="stitch"
70
+ />
71
+ </filter>
72
+ <rect width="100%" height="100%" filter="url(#floppy-grain)" />
73
+ </svg>
74
+ </div>
75
+ )
76
+ }
77
+
78
+ type FloppyDiskProps = {
79
+ className?: string
80
+ }
81
+
82
+ // Front view of a 3.5" floppy: shutter with window, insert arrow, label
83
+ // area, write-protect holes. Drawn inline so it stays crisp and asset-free.
84
+ function FloppyDisk({ className }: FloppyDiskProps) {
85
+ return (
86
+ <svg viewBox="0 0 200 200" aria-hidden="true" className={className}>
87
+ <defs>
88
+ <linearGradient id="floppy-shutter" x1="0" y1="0" x2="0" y2="1">
89
+ <stop offset="0" stopColor="#e3e3e1" />
90
+ <stop offset="0.5" stopColor="#c8c8c6" />
91
+ <stop offset="1" stopColor="#aeaeac" />
92
+ </linearGradient>
93
+ </defs>
94
+ {/* body with clipped top-right corner */}
95
+ <path
96
+ d="M14 2h146l26 26v160a10 10 0 0 1-10 10H14A10 10 0 0 1 4 188V12A10 10 0 0 1 14 2Z"
97
+ fill="#1a1b1d"
98
+ />
99
+ <path
100
+ d="M14 2h146l26 26v160a10 10 0 0 1-10 10H14A10 10 0 0 1 4 188V12A10 10 0 0 1 14 2Z"
101
+ fill="none"
102
+ stroke="#ffffff"
103
+ strokeOpacity="0.08"
104
+ strokeWidth="1.5"
105
+ />
106
+ {/* shutter */}
107
+ <path d="M64 2h96v66a6 6 0 0 1-6 6H70a6 6 0 0 1-6-6V2Z" fill="url(#floppy-shutter)" />
108
+ <rect x="116" y="12" width="28" height="52" rx="3" fill="#191a1c" />
109
+ {/* insert arrow */}
110
+ <path d="M26 30 34 16l8 14h-5v14h-6V30Z" fill="#0e0f10" />
111
+ {/* label area */}
112
+ <rect
113
+ x="22"
114
+ y="92"
115
+ width="156"
116
+ height="106"
117
+ rx="8"
118
+ fill="#202124"
119
+ stroke="#ffffff"
120
+ strokeOpacity="0.05"
121
+ />
122
+ {/* write-protect holes */}
123
+ <rect x="14" y="168" width="13" height="13" rx="2" fill="#0c0d0e" />
124
+ <rect x="172" y="168" width="13" height="13" rx="2" fill="#0c0d0e" />
125
+ <rect x="175" y="171" width="7" height="7" rx="1" fill="#e6e6e4" />
126
+ </svg>
127
+ )
128
+ }
129
+
130
+ function useCopyCommand() {
131
+ const [copied, setCopied] = useState(false)
132
+
133
+ useEffect(() => {
134
+ if (!copied) return
135
+ const t = setTimeout(() => setCopied(false), 1500)
136
+ return () => clearTimeout(t)
137
+ }, [copied])
138
+
139
+ const copy = () => {
140
+ navigator.clipboard
141
+ ?.writeText(AGENT_COMMAND)
142
+ .then(() => setCopied(true))
143
+ .catch(() => {})
144
+ }
145
+
146
+ return { copied, copy }
147
+ }
148
+
149
+ function InstallMoiDialogContent() {
150
+ const { demoInstallUrl } = useAppConfig()
151
+ const { copied, copy } = useCopyCommand()
152
+
153
+ return (
154
+ <DialogContent className="w-[calc(100%-2rem)] max-w-md">
155
+ <div className="p-2">
156
+ <FloppyHero />
157
+ </div>
158
+ <DialogClose
159
+ render={
160
+ <Button
161
+ variant="ghost"
162
+ size="icon-sm"
163
+ aria-label="Close"
164
+ className="absolute top-4 right-4 text-white hover:bg-white/20 hover:text-white"
165
+ >
166
+ <IconX stroke={1.75} />
167
+ </Button>
168
+ }
169
+ />
170
+
171
+ <div className="flex flex-col gap-5 p-6 pt-3">
172
+ <div className="flex flex-col gap-0.5">
173
+ <DialogTitle>Use moi with your projects</DialogTitle>
174
+ <DialogDescription>
175
+ This demo comes with sample workspaces. Connect moi to your agent to unlock all
176
+ features.
177
+ </DialogDescription>
178
+ </div>
179
+
180
+ <ul className="flex flex-col gap-3">
181
+ <li className="flex items-center gap-3">
182
+ <span className="flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted">
183
+ <IconFolders size={20} stroke={1.5} />
184
+ </span>
185
+ <span className="text-sm text-foreground">
186
+ Connect your own data and import existing projects
187
+ </span>
188
+ </li>
189
+ <li className="flex items-center gap-3">
190
+ <span className="flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted">
191
+ <IconTerminal2 size={20} stroke={1.5} />
192
+ </span>
193
+ <span className="flex flex-wrap items-center gap-x-1 gap-y-0.5 text-sm text-foreground">
194
+ <span>Works with</span>
195
+ <span className="inline-flex items-center gap-1 font-medium">
196
+ <img src={claudeIcon} alt="" className="size-4 object-contain" />
197
+ Claude Code,
198
+ </span>
199
+ <span className="inline-flex items-center gap-1 font-medium">
200
+ <img src={openaiIcon} alt="" className="size-4 object-contain" />
201
+ Codex,
202
+ </span>
203
+ <span className="inline-flex items-center gap-1 font-medium">
204
+ <img src={hermesIcon} alt="" className="size-4 object-contain" />
205
+ Hermes,
206
+ </span>
207
+ <span className="inline-flex items-center gap-1 font-medium">
208
+ <img src={openclawIcon} alt="" className="size-4 object-contain" />
209
+ OpenClaw,
210
+ </span>
211
+ <span>and more.</span>
212
+ </span>
213
+ </li>
214
+ </ul>
215
+
216
+ <div className="flex flex-col gap-2">
217
+ <p className="text-sm text-muted-foreground">Paste this prompt into your agent:</p>
218
+ <div className="rounded-lg bg-muted p-3">
219
+ <code className="block font-mono text-sm leading-relaxed text-foreground">
220
+ {AGENT_COMMAND}
221
+ </code>
222
+ <div className="mt-5 flex flex-wrap items-center gap-2">
223
+ <Button type="button" onClick={copy}>
224
+ {copied ? (
225
+ <IconCheck data-icon="inline-start" stroke={1.5} />
226
+ ) : (
227
+ <IconCopy data-icon="inline-start" stroke={1.5} />
228
+ )}
229
+ {copied ? 'Copied' : 'Copy installation prompt'}
230
+ </Button>
231
+ <Button
232
+ variant="secondary"
233
+ nativeButton={false}
234
+ render={<a href={demoInstallUrl} target="_blank" rel="noreferrer" />}
235
+ >
236
+ Learn more
237
+ <IconArrowUpRight data-icon="inline-end" stroke={1.5} />
238
+ </Button>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </div>
243
+ </DialogContent>
244
+ )
245
+ }
@@ -15,13 +15,18 @@ import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
15
15
  import type { HarnessAvailability, WorkspaceType } from '@/lib/types'
16
16
 
17
17
  const WORKSPACE_AGENT_DESCRIPTION = 'Choose which agent moi will use to build your workspace'
18
- const OPENCLAW_LOCKED_DESCRIPTION =
19
- 'Initialize OpenClaw in the folder\nmanually, then import it to moi'
18
+ // Backends whose workspaces belong to an agent installed on the machine: moi
19
+ // imports them (via discovery or `moi <provider> init`) and never creates one.
20
+ const IMPORT_ONLY_DESCRIPTION: Partial<Record<WorkspaceType, string>> = {
21
+ openclaw: 'Initialize OpenClaw in the folder\nmanually, then import it to moi',
22
+ hermes: 'Create a Hermes profile with\nhermes profile create, then import it'
23
+ }
20
24
 
21
25
  const workspaceAgentDescription: Record<WorkspaceType, string> = {
22
26
  'claude-code': 'Anthropic',
23
27
  codex: 'OpenAI',
24
- openclaw: 'Open-source'
28
+ openclaw: 'Open-source',
29
+ hermes: 'Nous Research'
25
30
  }
26
31
 
27
32
  export type WorkspaceAgentOption = {
@@ -43,9 +48,10 @@ export function getWorkspaceAgentOptions({
43
48
  return WORKSPACE_TYPE_ORDER.map(type => {
44
49
  const state = availability?.[type]
45
50
  const unavailableReason = state?.available === false ? state.reason : undefined
46
- const openClawReason =
47
- type === 'openclaw' && !detectedTypes.includes(type) ? OPENCLAW_LOCKED_DESCRIPTION : undefined
48
- const disabledReason = unavailableReason ?? openClawReason
51
+ const importOnlyReason = !detectedTypes.includes(type)
52
+ ? IMPORT_ONLY_DESCRIPTION[type]
53
+ : undefined
54
+ const disabledReason = unavailableReason ?? importOnlyReason
49
55
 
50
56
  return {
51
57
  type,
@@ -156,7 +162,7 @@ function WorkspaceAgentSelector({
156
162
  <div
157
163
  role="group"
158
164
  aria-label="Agent"
159
- className={cn('grid gap-2', options.length > 2 ? 'grid-cols-3' : 'grid-cols-2')}
165
+ className={cn('grid gap-2', options.length > 2 ? 'grid-cols-4' : 'grid-cols-2')}
160
166
  >
161
167
  {options.map(option => (
162
168
  <WorkspaceAgentOptionButton
@@ -15,7 +15,7 @@ export function WorkspaceDialogContent({
15
15
  closeDisabled = false
16
16
  }: WorkspaceDialogContentProps) {
17
17
  return (
18
- <DialogContent className="w-[calc(100%-2rem)] max-w-md p-6">
18
+ <DialogContent className="w-[calc(100%-2rem)] max-w-xl p-6">
19
19
  <DialogClose
20
20
  render={
21
21
  <Button
@@ -24,6 +24,7 @@ import {
24
24
  IconHandStop,
25
25
  IconHighlight,
26
26
  IconLine,
27
+ IconPencil,
27
28
  IconPointer2,
28
29
  IconSketching,
29
30
  IconSquare,
@@ -49,7 +50,7 @@ const TOOL_ENTRIES: ToolEntry[] = [
49
50
  { kind: 'tool', id: 'select', label: 'Select', Icon: IconPointer2 },
50
51
  { kind: 'tool', id: 'hand', label: 'Hand', Icon: IconHandStop },
51
52
  { kind: 'sep' },
52
- { kind: 'tool', id: 'draw', label: 'Pencil', Icon: IconSketching },
53
+ { kind: 'tool', id: 'draw', label: 'Pencil', Icon: IconPencil },
53
54
  { kind: 'geo', label: 'Rectangle', Icon: IconSquare },
54
55
  { kind: 'tool', id: 'note', label: 'Sticker', Icon: IconSticker2 },
55
56
  { kind: 'tool', id: 'text', label: 'Text', Icon: IconTypography },
@@ -123,13 +124,26 @@ function applyToolLocks(editor: Editor, toolId: string) {
123
124
  }
124
125
 
125
126
  // Custom vertical tool bar, rendered as an overlay over the canvas (outside
126
- // tldraw's own UI layout). Tracks the current tool reactively via `react`.
127
+ // tldraw's own UI layout). Tracks the current tool and applies the pencil cursor
128
+ // to tldraw's own container so both affordances change together.
129
+ const pencilCursorClass = '[&_.tl-canvas]:cursor-pencil'
130
+
127
131
  export function ScratchToolbar({ editor }: ScratchToolbarProps) {
128
132
  const [toolId, setToolId] = useState(() => editor.getCurrentToolId())
129
133
 
130
134
  useEffect(() => {
131
- setToolId(editor.getCurrentToolId())
132
- return react('scratch current tool', () => setToolId(editor.getCurrentToolId()))
135
+ const container = editor.getContainer()
136
+ const updateTool = () => {
137
+ const currentToolId = editor.getCurrentToolId()
138
+ setToolId(currentToolId)
139
+ container.classList.toggle(pencilCursorClass, currentToolId === 'draw')
140
+ }
141
+ updateTool()
142
+ const stopTracking = react('scratch current tool', updateTool)
143
+ return () => {
144
+ stopTracking()
145
+ container.classList.remove(pencilCursorClass)
146
+ }
133
147
  }, [editor])
134
148
 
135
149
  const activate = (toolId: string) => {
@@ -442,7 +456,7 @@ export function ScratchStyleBar({ editor }: ScratchStyleBarProps) {
442
456
  )}
443
457
  >
444
458
  {state.sizeGlyph === 'pen' ? (
445
- <IconSketching size={20} stroke={1.5} />
459
+ <IconSketching size={20} stroke={s.value === 'm' ? 1.25 : 2} />
446
460
  ) : state.sizeGlyph === 'letter' ? (
447
461
  <IconTypography size={s.glyph} stroke={s.glyph === 16 ? 1.75 : 1.5} />
448
462
  ) : (