moi-computer 0.9.1-next.4 → 0.10.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 (62) hide show
  1. package/README.md +124 -58
  2. package/client/app/shell/SidebarLayout.tsx +114 -69
  3. package/client/assets/floppy-disk.webp +0 -0
  4. package/client/assets.d.ts +5 -0
  5. package/client/components/ui/button.tsx +2 -1
  6. package/client/features/chat/ChatEmptyState.tsx +70 -34
  7. package/client/features/chat/ChatPanel.tsx +8 -1
  8. package/client/features/chat/chat-store.ts +4 -0
  9. package/client/features/chat/tool-group/format/claude.ts +2 -1
  10. package/client/features/chat/tool-group/format/codex.ts +2 -1
  11. package/client/features/chat/tool-group/format/hermes.ts +2 -1
  12. package/client/features/chat/tool-group/format/mcp.ts +7 -3
  13. package/client/features/chat/tool-group/format/openclaw.ts +6 -2
  14. package/client/features/chat/tool-group/format/shell.ts +162 -0
  15. package/client/features/dev/DevIndexPage.tsx +5 -0
  16. package/client/features/dev/DevRoutes.tsx +2 -0
  17. package/client/features/dev/TextureLabPage.tsx +149 -0
  18. package/client/features/home/HomePage.tsx +5 -5
  19. package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +3 -3
  20. package/client/features/home/workspace-setup/DemoDialog.tsx +239 -0
  21. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +22 -5
  22. package/client/features/settings/GeneralSettings.tsx +27 -23
  23. package/client/features/update/Update.tsx +78 -0
  24. package/client/features/update/api.ts +35 -0
  25. package/client/features/widgets/WidgetFrame.tsx +1 -0
  26. package/client/features/workspace/WorkspaceScreen.tsx +15 -0
  27. package/client/index.css +2 -2
  28. package/client/runtime/workspace-theme.ts +12 -4
  29. package/client/theme.css +26 -22
  30. package/dist/{chunk-zbt8emsw.js → chunk-0set7tmf.js} +2 -2
  31. package/dist/chunk-4057kxht.css +1 -0
  32. package/dist/{chunk-zcyvyebg.js → chunk-5t06zksf.js} +2 -2
  33. package/dist/{chunk-zbeq02yc.js → chunk-97eg9mjn.js} +1 -1
  34. package/dist/chunk-b5c62p8h.js +1 -0
  35. package/dist/chunk-dfe7qnrp.js +1 -0
  36. package/dist/{chunk-b959mdkj.js → chunk-efdyz6xp.js} +1 -1
  37. package/dist/chunk-f6xmz3tn.js +83 -0
  38. package/dist/chunk-h2kj1ysj.js +1 -0
  39. package/dist/{chunk-zfz3b4xg.js → chunk-ht1f95h9.js} +2 -2
  40. package/dist/chunk-qtc5a8qa.js +10 -0
  41. package/dist/floppy-disk-wmjs0n85.webp +0 -0
  42. package/dist/index.html +1 -1
  43. package/lib/ids.ts +27 -0
  44. package/lib/themes.ts +12 -12
  45. package/lib/types.ts +11 -2
  46. package/lib/update.ts +2 -0
  47. package/package.json +2 -1
  48. package/server/api.ts +47 -1
  49. package/server/app-config.ts +2 -2
  50. package/server/bundler/build-applet.ts +2 -3
  51. package/server/cli.ts +30 -7
  52. package/server/constants.ts +4 -2
  53. package/server/registry.ts +37 -2
  54. package/server/update.ts +293 -5
  55. package/server/web.ts +1 -1
  56. package/client/features/home/workspace-setup/InstallMoiDialog.tsx +0 -245
  57. package/dist/chunk-87q78504.js +0 -1
  58. package/dist/chunk-8s41nd3g.js +0 -1
  59. package/dist/chunk-cagtq45k.js +0 -1
  60. package/dist/chunk-ek6zde7t.js +0 -10
  61. package/dist/chunk-n8tq2494.js +0 -82
  62. package/dist/chunk-v82nefjq.css +0 -1
@@ -0,0 +1,149 @@
1
+ import { Fragment } from 'react'
2
+ import { Link } from 'wouter'
3
+
4
+ import { cn } from '@/client/lib/cn'
5
+ import { getWorkspaceThemeStyle } from '@/client/runtime/workspace-theme'
6
+ import { COLOR_THEMES, DEFAULT_WORKSPACE_THEME } from '@/lib/themes'
7
+ import type { ColorTheme, WorkspaceTheme } from '@/lib/themes'
8
+
9
+ const TEXTURES = [
10
+ { label: 'Checker', className: 'texture-checker' },
11
+ { label: 'Grid', className: 'texture-grid' },
12
+ { label: 'Noise', className: 'texture-noise' },
13
+ { label: 'Linear gradient', className: 'texture-gradient-linear' },
14
+ { label: 'Inset shadow', className: 'texture-inset-shadow' }
15
+ ] as const
16
+
17
+ type SurfaceMode = 'base' | 'dark' | 'widget' | 'vivid'
18
+
19
+ type SurfaceConfig = {
20
+ mode: SurfaceMode
21
+ label: string
22
+ description: string
23
+ }
24
+
25
+ const SURFACES: SurfaceConfig[] = [
26
+ { mode: 'base', label: 'Base', description: 'Workspace tokens' },
27
+ { mode: 'dark', label: 'Dark', description: 'Dark variant' },
28
+ { mode: 'widget', label: 'Widget', description: 'Redefined tokens' },
29
+ { mode: 'vivid', label: 'Vivid', description: 'data-vivid' }
30
+ ]
31
+
32
+ const COLOR_THEME_KEYS = Object.keys(COLOR_THEMES) as ColorTheme[]
33
+
34
+ type TexturePreviewProps = {
35
+ color: ColorTheme
36
+ mode: SurfaceMode
37
+ textureClassName: string
38
+ textureLabel: string
39
+ }
40
+
41
+ function TexturePreview({ color, mode, textureClassName, textureLabel }: TexturePreviewProps) {
42
+ const theme: WorkspaceTheme = { ...DEFAULT_WORKSPACE_THEME, color }
43
+ const style = getWorkspaceThemeStyle(theme, mode === 'widget' ? 'widget' : 'workspace')
44
+ const isVivid = mode === 'vivid'
45
+
46
+ return (
47
+ <div className={cn('h-full', mode === 'dark' && 'dark')} style={style}>
48
+ <div
49
+ data-vivid={isVivid ? true : undefined}
50
+ aria-label={`${COLOR_THEMES[color].label}, ${textureLabel}, ${mode}`}
51
+ className={cn(
52
+ 'relative h-28 overflow-hidden rounded-lg border p-3',
53
+ isVivid ? 'bg-primary text-primary-foreground' : 'bg-background text-foreground',
54
+ textureClassName
55
+ )}
56
+ >
57
+ <div className="flex items-start justify-between gap-2">
58
+ <span className="text-xs font-medium">Aa 123</span>
59
+ <span
60
+ className={cn(
61
+ 'rounded-md px-2 py-1 text-[10px] font-medium',
62
+ isVivid ? 'bg-background text-foreground' : 'bg-primary text-primary-foreground'
63
+ )}
64
+ >
65
+ Primary
66
+ </span>
67
+ </div>
68
+ <div className="absolute right-3 bottom-3 left-3 flex items-center gap-2">
69
+ <span className="h-2 flex-1 rounded-full bg-muted" />
70
+ <span className="size-4 rounded-full border bg-accent" />
71
+ <span className="size-4 rounded-full border bg-primary" />
72
+ </div>
73
+ </div>
74
+ </div>
75
+ )
76
+ }
77
+
78
+ export function TextureLabPage() {
79
+ return (
80
+ <main className="mx-auto w-full max-w-[96rem] px-6 py-10">
81
+ <Link href="/dev" className="text-sm text-muted-foreground hover:text-foreground">
82
+ ← Dev pages
83
+ </Link>
84
+
85
+ <div className="mt-5 max-w-2xl">
86
+ <p className="text-[11px] font-medium tracking-widest text-muted-foreground uppercase">
87
+ Playground
88
+ </p>
89
+ <h1 className="mt-2 text-3xl font-semibold tracking-tight">Texture lab</h1>
90
+ <p className="mt-2 text-sm leading-6 text-muted-foreground">
91
+ Every texture across every color theme. Each row compares the base surface, dark variant,
92
+ widget token derivation, and a vivid container.
93
+ </p>
94
+ </div>
95
+
96
+ <div className="mt-10 flex flex-col gap-10">
97
+ {COLOR_THEME_KEYS.map(color => (
98
+ <section key={color}>
99
+ <div className="mb-3 flex items-center gap-2">
100
+ <span
101
+ style={getWorkspaceThemeStyle({ ...DEFAULT_WORKSPACE_THEME, color })}
102
+ className="size-3 rounded-full bg-primary"
103
+ />
104
+ <h2 className="text-lg font-medium">{COLOR_THEMES[color].label}</h2>
105
+ <span className="font-mono text-xs text-muted-foreground">{color}</span>
106
+ </div>
107
+
108
+ <div className="overflow-x-auto rounded-xl border">
109
+ <div className="grid min-w-[56rem] grid-cols-[9rem_repeat(4,minmax(10rem,1fr))] gap-px bg-border">
110
+ <div className="bg-muted px-3 py-2 text-xs font-medium text-muted-foreground">
111
+ Texture
112
+ </div>
113
+ {SURFACES.map(surface => (
114
+ <div key={surface.mode} className="bg-muted px-3 py-2">
115
+ <p className="text-xs font-medium">{surface.label}</p>
116
+ <p className="mt-0.5 text-[10px] text-muted-foreground">
117
+ {surface.description}
118
+ </p>
119
+ </div>
120
+ ))}
121
+
122
+ {TEXTURES.map(texture => (
123
+ <Fragment key={texture.className}>
124
+ <div className="bg-background px-3 py-3">
125
+ <p className="text-sm font-medium">{texture.label}</p>
126
+ <p className="mt-1 font-mono text-[10px] leading-4 break-all text-muted-foreground">
127
+ {texture.className}
128
+ </p>
129
+ </div>
130
+ {SURFACES.map(surface => (
131
+ <div key={surface.mode} className="bg-background p-2">
132
+ <TexturePreview
133
+ color={color}
134
+ mode={surface.mode}
135
+ textureClassName={texture.className}
136
+ textureLabel={texture.label}
137
+ />
138
+ </div>
139
+ ))}
140
+ </Fragment>
141
+ ))}
142
+ </div>
143
+ </div>
144
+ </section>
145
+ ))}
146
+ </div>
147
+ </main>
148
+ )
149
+ }
@@ -11,7 +11,7 @@ import {
11
11
  } from './api'
12
12
  import { CreateWorkspaceDialog } from './workspace-setup/CreateWorkspaceDialog'
13
13
  import { ImportWorkspaceDialog } from './workspace-setup/ImportWorkspaceDialog'
14
- import { InstallMoiDialog } from './workspace-setup/InstallMoiDialog'
14
+ import { DemoDialog } from './workspace-setup/DemoDialog'
15
15
  import { useWorkspaceImport } from './workspace-setup/useWorkspaceImport'
16
16
  import { HomeLogo } from './HomeLogo'
17
17
  import { useAppConfig } from '@/client/api/app-config'
@@ -43,7 +43,7 @@ export function HomePage() {
43
43
  onSuccess: entry => navigate(`/workspace/${entry.id}`)
44
44
  })
45
45
  const appConfig = useAppConfig()
46
- const [installDialogOpen, setInstallDialogOpen] = useState(false)
46
+ const [promoDialogOpen, setPromoDialogOpen] = useState(false)
47
47
  const discoveredWorkspacesOpen = useUiStore(state => state.discoveredWorkspacesOpen)
48
48
  const setDiscoveredWorkspacesOpen = useUiStore(state => state.setDiscoveredWorkspacesOpen)
49
49
 
@@ -68,9 +68,9 @@ export function HomePage() {
68
68
  const count = workspaces.length
69
69
 
70
70
  function handleAdd(suggestion: DiscoveredWorkspace) {
71
- // Cloud demo: adding workspaces is off — offer the install dialog instead.
71
+ // Cloud demo: adding workspaces is off — offer the promo dialog instead.
72
72
  if (appConfig.cloudDemo) {
73
- setInstallDialogOpen(true)
73
+ setPromoDialogOpen(true)
74
74
  return
75
75
  }
76
76
  importFlow.startImport(suggestion)
@@ -161,7 +161,7 @@ export function HomePage() {
161
161
  />
162
162
  )}
163
163
 
164
- <InstallMoiDialog open={installDialogOpen} onOpenChange={setInstallDialogOpen} />
164
+ <DemoDialog open={promoDialogOpen} onOpenChange={setPromoDialogOpen} />
165
165
  </div>
166
166
  )
167
167
  }
@@ -17,7 +17,7 @@ import { validateWorkspaceFolderName } from '@/lib/workspace-name'
17
17
  import { WORKSPACE_TYPE_ORDER } from '@/lib/workspace-types'
18
18
  import type { WorkspaceType } from '@/lib/types'
19
19
 
20
- import { InstallMoiDialog } from './InstallMoiDialog'
20
+ import { DemoDialog } from './DemoDialog'
21
21
  import { WorkspaceAgentStep } from './WorkspaceAgentStep'
22
22
  import { WorkspaceDialogContent } from './WorkspaceDialogContent'
23
23
 
@@ -45,9 +45,9 @@ export function CreateWorkspaceDialog({ trigger }: CreateWorkspaceDialogProps) {
45
45
  const isCreating = createMutation.isPending
46
46
 
47
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.
48
+ // cloud-demo promo dialog instead. After every hook so the hook order is stable.
49
49
  if (appConfig.cloudDemo) {
50
- return <InstallMoiDialog trigger={trigger} />
50
+ return <DemoDialog trigger={trigger} />
51
51
  }
52
52
 
53
53
  function finish(workspaceId: string) {
@@ -0,0 +1,239 @@
1
+ import {
2
+ type MouseEvent as ReactMouseEvent,
3
+ type ReactElement,
4
+ useEffect,
5
+ useRef,
6
+ useState
7
+ } from 'react'
8
+
9
+ import {
10
+ IconArrowUpRight,
11
+ IconCheck,
12
+ IconCopy,
13
+ IconFolderOpen,
14
+ IconMessageChatbot,
15
+ IconX
16
+ } from '@tabler/icons-react'
17
+
18
+ import claudeIcon from '@/client/assets/claude.svg'
19
+ import floppyDisk from '@/client/assets/floppy-disk.webp'
20
+ import hermesIcon from '@/client/assets/hermes.png'
21
+ import openaiIcon from '@/client/assets/openai.svg'
22
+ import openclawIcon from '@/client/assets/openclaw.svg'
23
+ import { Button, buttonVariants } from '@/client/components/ui/button'
24
+ import {
25
+ Dialog,
26
+ DialogClose,
27
+ DialogContent,
28
+ DialogDescription,
29
+ DialogTitle,
30
+ DialogTrigger
31
+ } from '@/client/components/ui/dialog'
32
+ import { useAppConfig } from '@/client/api/app-config'
33
+
34
+ // The canonical setup prompt from moi.computer — pasted into any agent, it
35
+ // fetches INSTALL.md and walks itself through the install.
36
+ const AGENT_COMMAND =
37
+ 'Set up the moi workspace for this project. Fetch https://moi.computer/INSTALL.md, and follow the steps.'
38
+
39
+ type DemoDialogProps = {
40
+ // Trigger-owned (uncontrolled) or controlled via open/onOpenChange — the
41
+ // create-workspace buttons use the former, programmatic opens the latter.
42
+ trigger?: ReactElement
43
+ open?: boolean
44
+ onOpenChange?: (open: boolean) => void
45
+ }
46
+
47
+ // Shown in the cloud demo wherever a workspace would be created: the demo is
48
+ // limited to its built-in workspaces, and the way out is installing moi.
49
+ export function DemoDialog({ trigger, open, onOpenChange }: DemoDialogProps) {
50
+ return (
51
+ <Dialog open={open} onOpenChange={onOpenChange}>
52
+ {trigger && <DialogTrigger render={trigger} />}
53
+ <DemoDialogContent />
54
+ </Dialog>
55
+ )
56
+ }
57
+
58
+ type FloppyArtworkProps = {
59
+ demoInstallUrl: string
60
+ }
61
+
62
+ const FLOPPY_POINTER_TRAVEL = 2
63
+
64
+ function FloppyArtwork({ demoInstallUrl }: FloppyArtworkProps) {
65
+ const floppyRef = useRef<HTMLAnchorElement>(null)
66
+
67
+ const moveFloppyOppositePointer = (event: ReactMouseEvent<HTMLDivElement>) => {
68
+ if (!floppyRef.current) return
69
+
70
+ const bounds = event.currentTarget.getBoundingClientRect()
71
+ const x = (event.clientX - bounds.left) / bounds.width - 0.5
72
+ const y = (event.clientY - bounds.top) / bounds.height - 0.5
73
+
74
+ floppyRef.current.style.setProperty('--floppy-x', `${x * -2 * FLOPPY_POINTER_TRAVEL}px`)
75
+ floppyRef.current.style.setProperty('--floppy-y', `${y * -2 * FLOPPY_POINTER_TRAVEL}px`)
76
+ }
77
+
78
+ const resetFloppyPosition = () => {
79
+ floppyRef.current?.style.removeProperty('--floppy-x')
80
+ floppyRef.current?.style.removeProperty('--floppy-y')
81
+ }
82
+
83
+ return (
84
+ <div
85
+ className="relative min-h-56 overflow-hidden md:min-h-full"
86
+ onMouseMove={moveFloppyOppositePointer}
87
+ onMouseLeave={resetFloppyPosition}
88
+ >
89
+ <a
90
+ ref={floppyRef}
91
+ href={demoInstallUrl}
92
+ target="_blank"
93
+ rel="noreferrer"
94
+ className="group absolute top-1/2 left-1/2 w-44 -translate-x-1/2 -translate-y-1/2 rotate-4 [transform:translate3d(var(--floppy-x,0px),var(--floppy-y,0px),0)] rounded-lg transition-transform duration-150 ease-out will-change-transform outline-none focus-visible:ring-3 focus-visible:ring-ring/50 motion-reduce:transform-none motion-reduce:transition-none md:w-40"
95
+ >
96
+ <img src={floppyDisk} alt="" className="w-full drop-shadow-xl" />
97
+ <div
98
+ className={buttonVariants({
99
+ variant: 'outline',
100
+ className: 'absolute -right-3 -bottom-2 -rotate-8'
101
+ })}
102
+ >
103
+ About moi
104
+ <IconArrowUpRight data-icon="inline-end" stroke={1.5} />
105
+ </div>
106
+ </a>
107
+ </div>
108
+ )
109
+ }
110
+
111
+ function useCopyCommand() {
112
+ const [copied, setCopied] = useState(false)
113
+
114
+ useEffect(() => {
115
+ if (!copied) return
116
+ const t = setTimeout(() => setCopied(false), 1500)
117
+ return () => clearTimeout(t)
118
+ }, [copied])
119
+
120
+ const copy = () => {
121
+ navigator.clipboard
122
+ ?.writeText(AGENT_COMMAND)
123
+ .then(() => setCopied(true))
124
+ .catch(() => {})
125
+ }
126
+
127
+ return { copied, copy }
128
+ }
129
+
130
+ function DemoDialogContent() {
131
+ const { demoInstallUrl } = useAppConfig()
132
+ const { copied, copy } = useCopyCommand()
133
+
134
+ return (
135
+ <DialogContent
136
+ data-vivid
137
+ className="w-full max-w-md rounded-2xl bg-primary texture-checker-16 p-2 text-primary-foreground md:max-w-2xl"
138
+ >
139
+ <div className="absolute inset-0 bg-[linear-gradient(to_right,color-mix(in_oklch,var(--background)_14%,transparent),color-mix(in_oklch,var(--background)_6%,transparent))]" />
140
+ {/* Film grain keeps the illustration gradient from banding. */}
141
+ <svg
142
+ className="pointer-events-none absolute inset-0 size-full opacity-30 mix-blend-soft-light"
143
+ aria-hidden="true"
144
+ >
145
+ <filter id="floppy-grain">
146
+ <feTurbulence
147
+ type="fractalNoise"
148
+ baseFrequency="0.8"
149
+ numOctaves="2"
150
+ stitchTiles="stitch"
151
+ />
152
+ </filter>
153
+ <rect width="100%" height="100%" filter="url(#floppy-grain)" />
154
+ </svg>
155
+
156
+ <div className="relative grid max-h-[calc(100dvh-2rem)] overflow-y-auto md:grid-cols-[3fr_2fr] md:overflow-visible">
157
+ <div className="rounded-xl bg-card p-6 text-card-foreground shadow-sm md:p-8">
158
+ <div className="flex flex-col gap-0.5">
159
+ <DialogTitle>Unlock all features</DialogTitle>
160
+ <DialogDescription className="mt-1">
161
+ This is a demo version with sample workspaces. Install moi locally and connect to your
162
+ agent.
163
+ </DialogDescription>
164
+ </div>
165
+
166
+ <ul className="mt-4 flex flex-col gap-3">
167
+ <li className="flex items-center gap-3">
168
+ <IconFolderOpen
169
+ stroke={0.75}
170
+ className="mt-0.5 size-8 shrink-0 text-muted-foreground"
171
+ />
172
+ <span className="text-sm text-foreground">
173
+ Connect your own data sources and work on existing projects
174
+ </span>
175
+ </li>
176
+ <li className="flex items-center gap-3">
177
+ <IconMessageChatbot
178
+ stroke={0.75}
179
+ className="mt-0.5 size-8 shrink-0 text-muted-foreground"
180
+ />
181
+ <span className="flex flex-wrap items-center gap-x-1 gap-y-0.5 text-sm text-foreground">
182
+ <span>Build with</span>
183
+ <span className="inline-flex items-center gap-1 font-medium">
184
+ <img src={claudeIcon} alt="" className="size-3.5 object-contain" />
185
+ Claude Code,
186
+ </span>
187
+ <span className="inline-flex items-center gap-1 font-medium">
188
+ <img src={openaiIcon} alt="" className="size-3.5 object-contain" />
189
+ Codex,
190
+ </span>
191
+ <span className="inline-flex items-center gap-1 font-medium">
192
+ <img src={hermesIcon} alt="" className="size-3.5 object-contain" />
193
+ Hermes,
194
+ </span>
195
+ <span className="inline-flex items-center gap-1 font-medium">
196
+ <img src={openclawIcon} alt="" className="size-3.5 object-contain" />
197
+ OpenClaw,
198
+ </span>
199
+ <span>and more</span>
200
+ </span>
201
+ </li>
202
+ </ul>
203
+
204
+ <div className="mt-8 flex flex-col gap-3 pb-4">
205
+ <p className="text-sm text-muted-foreground">Give this prompt to your agent:</p>
206
+ <div className="relative rounded-lg bg-muted p-4 pb-8 ring-1 ring-border">
207
+ <code className="block font-mono text-sm leading-relaxed text-foreground">
208
+ {AGENT_COMMAND}
209
+ </code>
210
+ <Button type="button" onClick={copy} className="absolute right-4 -bottom-4">
211
+ {copied ? (
212
+ <IconCheck data-icon="inline-start" stroke={1.5} />
213
+ ) : (
214
+ <IconCopy data-icon="inline-start" stroke={1.5} />
215
+ )}
216
+ {copied ? 'Copied' : 'Copy prompt'}
217
+ </Button>
218
+ </div>
219
+ </div>
220
+ </div>
221
+
222
+ <FloppyArtwork demoInstallUrl={demoInstallUrl} />
223
+ </div>
224
+
225
+ <DialogClose
226
+ render={
227
+ <Button
228
+ variant="outline"
229
+ size="icon"
230
+ aria-label="Close"
231
+ className="absolute top-4 right-4"
232
+ >
233
+ <IconX stroke={1.5} />
234
+ </Button>
235
+ }
236
+ />
237
+ </DialogContent>
238
+ )
239
+ }
@@ -18,8 +18,12 @@ const WORKSPACE_AGENT_DESCRIPTION = 'Choose which agent moi will use to build yo
18
18
  // Backends whose workspaces belong to an agent installed on the machine: moi
19
19
  // imports them (via discovery or `moi <provider> init`) and never creates one.
20
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'
21
+ openclaw: 'To connect an OpenClaw agent, run',
22
+ hermes: 'To connect a Hermes agent, run'
23
+ }
24
+ const IMPORT_ONLY_COMMAND: Partial<Record<WorkspaceType, string>> = {
25
+ openclaw: 'moi openclaw init',
26
+ hermes: 'moi hermes init'
23
27
  }
24
28
 
25
29
  const workspaceAgentDescription: Record<WorkspaceType, string> = {
@@ -34,6 +38,7 @@ export type WorkspaceAgentOption = {
34
38
  description: string
35
39
  disabled: boolean
36
40
  disabledReason?: string
41
+ disabledCommand?: string
37
42
  }
38
43
 
39
44
  type WorkspaceAgentOptionsInput = {
@@ -51,13 +56,15 @@ export function getWorkspaceAgentOptions({
51
56
  const importOnlyReason = !detectedTypes.includes(type)
52
57
  ? IMPORT_ONLY_DESCRIPTION[type]
53
58
  : undefined
59
+ const importOnlyCommand = !detectedTypes.includes(type) ? IMPORT_ONLY_COMMAND[type] : undefined
54
60
  const disabledReason = unavailableReason ?? importOnlyReason
55
61
 
56
62
  return {
57
63
  type,
58
64
  description: workspaceAgentDescription[type],
59
65
  disabled: Boolean(disabledReason),
60
- ...(disabledReason ? { disabledReason } : {})
66
+ ...(disabledReason ? { disabledReason } : {}),
67
+ ...(!unavailableReason && importOnlyCommand ? { disabledCommand: importOnlyCommand } : {})
61
68
  }
62
69
  })
63
70
  }
@@ -233,8 +240,18 @@ function WorkspaceAgentOptionButton({
233
240
  return (
234
241
  <Tooltip>
235
242
  <TooltipTrigger render={button} />
236
- <TooltipContent className="max-w-64 text-center whitespace-pre-line">
237
- {option.disabledReason}
243
+ <TooltipContent className={cn('max-w-64', option.disabledCommand && 'max-w-none leading-5')}>
244
+ <span className="text-center">
245
+ {option.disabledReason}
246
+ {option.disabledCommand && (
247
+ <>
248
+ <br />
249
+ <code className="rounded-xs bg-accent px-1 py-0.5 font-mono whitespace-nowrap">
250
+ {option.disabledCommand}
251
+ </code>
252
+ </>
253
+ )}
254
+ </span>
238
255
  </TooltipContent>
239
256
  </Tooltip>
240
257
  )
@@ -3,6 +3,7 @@ import { useState } from 'react'
3
3
  import { IconLoader2 } from '@tabler/icons-react'
4
4
  import { useLocation } from 'wouter'
5
5
 
6
+ import { useAppConfig } from '@/client/api/app-config'
6
7
  import { Button } from '@/client/components/ui/button'
7
8
  import { Input } from '@/client/components/ui/input'
8
9
  import { useWorkspaceLayoutCtx } from '@/client/features/workspace/WorkspaceLayoutContext'
@@ -13,6 +14,7 @@ import { IconPicker } from './IconPicker'
13
14
  import { SettingsPage, SettingsRow, SettingsSection } from './SettingsLayout'
14
15
 
15
16
  export function GeneralSettings() {
17
+ const { cloudDemo } = useAppConfig()
16
18
  const { name, icon, cwd, workspaceId } = useWorkspaceLayoutCtx()
17
19
  const [, navigate] = useLocation()
18
20
  const saveName = useSaveWorkspaceName(workspaceId)
@@ -74,29 +76,31 @@ export function GeneralSettings() {
74
76
  </div>
75
77
  </SettingsSection>
76
78
 
77
- <SettingsSection label="Danger zone">
78
- <SettingsRow
79
- title="Remove space"
80
- description="Remove this space from moi. Its folder and sessions stay on disk."
81
- control={
82
- <Button
83
- type="button"
84
- variant="destructive"
85
- size="sm"
86
- onClick={remove}
87
- disabled={removeWorkspace.isPending}
88
- >
89
- {removeWorkspace.isPending && (
90
- <IconLoader2 data-icon="inline-start" stroke={1.75} className="animate-spin" />
91
- )}
92
- Remove
93
- </Button>
94
- }
95
- />
96
- {removeWorkspace.isError && (
97
- <p className="px-3.5 py-3 text-xs text-destructive">{removeWorkspace.error.message}</p>
98
- )}
99
- </SettingsSection>
79
+ {!cloudDemo && (
80
+ <SettingsSection label="Danger zone">
81
+ <SettingsRow
82
+ title="Remove space"
83
+ description="Remove this space from moi. Its folder and sessions stay on disk."
84
+ control={
85
+ <Button
86
+ type="button"
87
+ variant="destructive"
88
+ size="sm"
89
+ onClick={remove}
90
+ disabled={removeWorkspace.isPending}
91
+ >
92
+ {removeWorkspace.isPending && (
93
+ <IconLoader2 data-icon="inline-start" stroke={1.75} className="animate-spin" />
94
+ )}
95
+ Remove
96
+ </Button>
97
+ }
98
+ />
99
+ {removeWorkspace.isError && (
100
+ <p className="px-3.5 py-3 text-xs text-destructive">{removeWorkspace.error.message}</p>
101
+ )}
102
+ </SettingsSection>
103
+ )}
100
104
  </SettingsPage>
101
105
  )
102
106
  }
@@ -0,0 +1,78 @@
1
+ import { useEffect } from 'react'
2
+
3
+ import { IconDownload } from '@tabler/icons-react'
4
+
5
+ import { Button } from '@/client/components/ui/button'
6
+ import { Spinner } from '@/client/components/ui/spinner'
7
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
8
+ import { hasRunningActivity, useLive } from '@/client/features/chat/chat-store'
9
+ import { UPDATE_ACTIVE_AGENT_MESSAGE } from '@/lib/update'
10
+ import type { UpdateStatus } from '@/lib/types'
11
+
12
+ import { useUpdate, useUpdateStatus } from './api'
13
+
14
+ export function shouldReloadAfterUpdate(
15
+ status: UpdateStatus | undefined,
16
+ targetVersion: string | null
17
+ ): boolean {
18
+ return !!targetVersion && status?.runningVersion === targetVersion
19
+ }
20
+
21
+ export function getUpdateButtonState(
22
+ agentRunning: boolean,
23
+ updating: boolean,
24
+ restarting: boolean
25
+ ) {
26
+ const busy = updating || restarting
27
+ const blocked = agentRunning && !busy
28
+ const label = updating
29
+ ? 'Updating'
30
+ : restarting
31
+ ? 'Restarting'
32
+ : blocked
33
+ ? UPDATE_ACTIVE_AGENT_MESSAGE
34
+ : 'Update'
35
+ return { busy, blocked, label }
36
+ }
37
+
38
+ export function Update() {
39
+ const update = useUpdate()
40
+ const statusQuery = useUpdateStatus(update.isSuccess)
41
+ const agentRunning = useLive(state => hasRunningActivity(state.activity))
42
+ const status = statusQuery.data
43
+ const restartTarget = update.data?.installedVersion ?? null
44
+
45
+ useEffect(() => {
46
+ if (shouldReloadAfterUpdate(status, restartTarget)) window.location.reload()
47
+ }, [restartTarget, status])
48
+
49
+ if (!status?.availableVersion) return null
50
+
51
+ const restarting = update.isSuccess
52
+ const button = getUpdateButtonState(agentRunning, update.isPending, restarting)
53
+
54
+ // The div gives TooltipTrigger an enabled event target when the button is disabled.
55
+ return (
56
+ <Tooltip>
57
+ <TooltipTrigger
58
+ render={
59
+ <div>
60
+ <Button
61
+ type="button"
62
+ size="icon"
63
+ variant={button.busy ? 'ghost' : 'default'}
64
+ aria-label={button.label}
65
+ disabled={button.blocked || button.busy}
66
+ onClick={() => update.mutate()}
67
+ >
68
+ {button.busy ? <Spinner stroke={1.5} /> : <IconDownload stroke={1.5} />}
69
+ </Button>
70
+ </div>
71
+ }
72
+ />
73
+ <TooltipContent side="right" className={button.blocked ? 'max-w-56' : undefined}>
74
+ {button.blocked ? UPDATE_ACTIVE_AGENT_MESSAGE : (update.error?.message ?? button.label)}
75
+ </TooltipContent>
76
+ </Tooltip>
77
+ )
78
+ }