moi-computer 0.10.1-next.3 → 0.10.1-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/client/app/shell/SidebarLayout.tsx +53 -14
  2. package/client/components/shared/AgentBlobatar.tsx +3 -3
  3. package/client/components/shared/Composer.tsx +4 -10
  4. package/client/features/chat/ChatEmptyState.tsx +2 -9
  5. package/client/features/chat/ChatPanel.tsx +21 -23
  6. package/client/features/chat/ChatPopup.tsx +1 -2
  7. package/client/features/chat/composer/ChatComposer.tsx +2 -2
  8. package/client/features/chat/composer/banners/AgentAvailabilityBanner.tsx +101 -0
  9. package/client/features/chat/composer/banners/{ChatErrorBanner.tsx → ErrorBanner.tsx} +2 -2
  10. package/client/features/chat/composer/banners/{WorkspaceSkillUpdateBanner.tsx → SkillUpdateBanner.tsx} +3 -3
  11. package/client/features/chat/composer/useWorkspaceComposerState.tsx +14 -24
  12. package/client/features/chat/composer/useWorkspaceSkillUpdates.ts +6 -6
  13. package/client/features/chat/useAppletChatMessage.ts +9 -5
  14. package/client/features/dev/BlobatarShapesPage.tsx +344 -0
  15. package/client/features/dev/ChatStatesPage.tsx +3 -4
  16. package/client/features/dev/DevIndexPage.tsx +5 -0
  17. package/client/features/dev/DevRoutes.tsx +2 -0
  18. package/client/features/home/HomePage.tsx +47 -5
  19. package/client/features/home/WorkspacePreview.tsx +4 -4
  20. package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +1 -1
  21. package/client/features/update/{Update.tsx → UpdateControl.tsx} +33 -9
  22. package/client/features/workspace/CustomizePanel.tsx +1 -1
  23. package/client/features/workspace/WorkspaceScreen.tsx +5 -5
  24. package/client/features/workspace/api.ts +10 -1
  25. package/client/lib/agent-availability.ts +19 -0
  26. package/client/runtime/useWorkspaceEvents.ts +16 -2
  27. package/client/runtime/workspace-theme.ts +2 -8
  28. package/dist/chunk-104m57qw.js +2 -0
  29. package/dist/chunk-4vyggdzq.css +1 -0
  30. package/dist/chunk-bj3akjs2.js +1 -0
  31. package/dist/{chunk-0pcdwjkp.js → chunk-c9pjqx9m.js} +1 -1
  32. package/dist/chunk-gbp4m9p2.js +1 -0
  33. package/dist/{chunk-8jh75pjg.js → chunk-j2w2vak4.js} +2 -2
  34. package/dist/chunk-jpdn7nx7.js +83 -0
  35. package/dist/chunk-k2r9c95m.js +10 -0
  36. package/dist/chunk-kmbxhgwv.js +1 -0
  37. package/dist/{chunk-yt2qjn3m.js → chunk-tny85yt2.js} +2 -2
  38. package/dist/{chunk-9y2zbzqz.js → chunk-v7wr1df4.js} +1 -1
  39. package/dist/index.html +1 -1
  40. package/lib/themes.ts +31 -7
  41. package/lib/types.ts +9 -8
  42. package/package.json +1 -1
  43. package/server/AGENTS.md +1 -1
  44. package/server/agent.ts +46 -22
  45. package/server/api.ts +6 -6
  46. package/server/cli-ui-components.ts +63 -22
  47. package/server/harness/README.md +21 -12
  48. package/server/harness/claude-code/auth.ts +38 -23
  49. package/server/harness/claude-code/index.ts +1 -1
  50. package/server/harness/claude-code/permissions.ts +34 -0
  51. package/server/harness/claude-code/session.ts +7 -15
  52. package/server/harness/codex/auth.ts +31 -21
  53. package/server/harness/codex/client.ts +5 -14
  54. package/server/harness/codex/index.ts +1 -1
  55. package/server/harness/codex/permissions.ts +56 -0
  56. package/server/harness/codex/session.ts +25 -20
  57. package/server/harness/executable.ts +2 -2
  58. package/server/harness/hermes/index.ts +4 -5
  59. package/server/ui-components.ts +29 -0
  60. package/workspace/.claude/skills/moi-workspace/SKILL.md +9 -7
  61. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +24 -12
  62. package/client/features/chat/composer/banners/WorkspaceAgentAvailabilityBanner.tsx +0 -82
  63. package/dist/chunk-4xmcsjjv.js +0 -1
  64. package/dist/chunk-76j95afs.css +0 -1
  65. package/dist/chunk-dfs36zgc.js +0 -1
  66. package/dist/chunk-e4e993yf.js +0 -83
  67. package/dist/chunk-vq8ga42s.js +0 -1
  68. package/dist/chunk-yhj9bg1s.js +0 -2
  69. package/dist/chunk-yz743a75.js +0 -10
@@ -0,0 +1,344 @@
1
+ import { useMemo, useState } from 'react'
2
+
3
+ import { Blobatar } from '@blobatar/react'
4
+ import { IconCopy } from '@tabler/icons-react'
5
+ import { traits as createTraits } from 'blobatar'
6
+ import type { Palette, TraitOverrides } from 'blobatar'
7
+ import { Link } from 'wouter'
8
+
9
+ import { Button } from '@/client/components/ui/button'
10
+ import { Input } from '@/client/components/ui/input'
11
+ import { Slider } from '@/client/components/ui/slider'
12
+
13
+ const AGENT_SEED = 'moi-agent'
14
+
15
+ const AGENT_PALETTE = {
16
+ head: 'var(--primary)',
17
+ eye: 'var(--primary-foreground)'
18
+ } satisfies Palette
19
+
20
+ // Static Blobatars render as images, where app CSS variables are unavailable.
21
+ const STATIC_AGENT_PALETTE = {
22
+ head: '#171717',
23
+ eye: '#fafafa'
24
+ } satisfies Palette
25
+
26
+ const SHAPE_FAMILIES = [
27
+ { name: 'round', value: 0.11, from: 0, to: 0.22 },
28
+ { name: 'organic', value: 0.35, from: 0.22, to: 0.48 },
29
+ { name: 'boxy', value: 0.54, from: 0.48, to: 0.6 },
30
+ { name: 'capsule', value: 0.65, from: 0.6, to: 0.7 },
31
+ { name: 'nub', value: 0.745, from: 0.7, to: 0.79 },
32
+ { name: 'cloud', value: 0.825, from: 0.79, to: 0.86 },
33
+ { name: 'droplet', value: 0.887, from: 0.86, to: 0.915 },
34
+ { name: 'hexagon', value: 0.932, from: 0.915, to: 0.95 },
35
+ { name: 'sun', value: 0.965, from: 0.95, to: 0.98 },
36
+ { name: 'triangle', value: 0.99, from: 0.98, to: 1 }
37
+ ] as const
38
+
39
+ type ShapeFamily = (typeof SHAPE_FAMILIES)[number]
40
+ type ShapeName = ShapeFamily['name']
41
+
42
+ type TraitControl = {
43
+ key: string
44
+ label: string
45
+ range: string
46
+ }
47
+
48
+ const BASE_TRAITS: readonly TraitControl[] = [
49
+ { key: 'body.r', label: 'Body size', range: '31–38 px before family scaling' },
50
+ { key: 'body.ratio', label: 'Aspect ratio', range: '0.92–1.08× height' }
51
+ ]
52
+
53
+ const ORGANIC_TRAITS: readonly TraitControl[] = [
54
+ { key: 'body.pts', label: 'Outline points', range: '6–8 points' },
55
+ ...Array.from({ length: 8 }, (_, index) => ({
56
+ key: `body.r${index}`,
57
+ label: `Point ${index + 1} radius`,
58
+ range: '0.84–1.16× radius'
59
+ }))
60
+ ]
61
+
62
+ const FAMILY_TRAITS = {
63
+ round: [{ key: 'body.n', label: 'Roundness', range: '1.9–2.5 superellipse' }],
64
+ organic: ORGANIC_TRAITS,
65
+ boxy: [
66
+ { key: 'body.n', label: 'Boxiness', range: '3.4–6 superellipse' },
67
+ { key: 'body.rot', label: 'Rotation', range: '−20–20°' }
68
+ ],
69
+ capsule: [{ key: 'capsule.squat', label: 'Squat', range: '0.55–0.68× height' }],
70
+ nub: [
71
+ { key: 'body.n', label: 'Roundness', range: '1.9–2.5 superellipse' },
72
+ { key: 'nub.n', label: 'Nub count', range: '1–2 nubs' },
73
+ { key: 'nub.a0', label: 'Nub 1 angle', range: '0–360°' },
74
+ { key: 'nub.r0', label: 'Nub 1 size', range: '0.24–0.4× radius' },
75
+ { key: 'nub.a1', label: 'Nub 2 angle', range: '0–360°' },
76
+ { key: 'nub.r1', label: 'Nub 2 size', range: '0.24–0.4× radius' }
77
+ ],
78
+ cloud: [
79
+ ...ORGANIC_TRAITS,
80
+ { key: 'cloud.n', label: 'Lobe count', range: '4–6 lobes' },
81
+ ...Array.from({ length: 6 }, (_, index) => ({
82
+ key: `cloud.r${index}`,
83
+ label: `Lobe ${index + 1} size`,
84
+ range: '0.44–0.62× radius'
85
+ }))
86
+ ],
87
+ droplet: [{ key: 'droplet.tip', label: 'Tip length', range: '1.4–1.65× radius' }],
88
+ hexagon: [
89
+ { key: 'body.rot', label: 'Rotation', range: '−12–12°' },
90
+ { key: 'poly.round', label: 'Corner roundness', range: '0.24–0.5' }
91
+ ],
92
+ sun: [
93
+ { key: 'body.n', label: 'Center roundness', range: '1.9–2.5 superellipse' },
94
+ { key: 'sun.n', label: 'Ray count', range: '6–9 rays' },
95
+ { key: 'sun.dist', label: 'Ray distance', range: '1–1.08× radius' },
96
+ { key: 'sun.r', label: 'Ray size', range: '0.2–0.26× radius' },
97
+ { key: 'sun.rot', label: 'Ray rotation', range: '0–360°' }
98
+ ],
99
+ triangle: [
100
+ { key: 'body.rot', label: 'Rotation', range: '−5–5°' },
101
+ { key: 'poly.round', label: 'Corner roundness', range: '0.24–0.5' }
102
+ ]
103
+ } satisfies Record<ShapeName, readonly TraitControl[]>
104
+
105
+ function clampTrait(value: number): number {
106
+ return Math.min(0.999, Math.max(0, Math.round(value * 1000) / 1000))
107
+ }
108
+
109
+ function formatTrait(value: number): string {
110
+ return value.toFixed(3)
111
+ }
112
+
113
+ function singleSliderValue(value: number | readonly number[]): number {
114
+ return typeof value === 'number' ? value : (value[0] ?? 0)
115
+ }
116
+
117
+ type ShapePreviewProps = {
118
+ animated?: boolean
119
+ geometry?: TraitOverrides
120
+ seed: string
121
+ size: number
122
+ shape: number
123
+ }
124
+
125
+ function ShapePreview({ animated = false, geometry, seed, size, shape }: ShapePreviewProps) {
126
+ return (
127
+ <Blobatar
128
+ name={seed}
129
+ size={size}
130
+ animate={animated ? 'hover' : undefined}
131
+ palette={animated ? AGENT_PALETTE : STATIC_AGENT_PALETTE}
132
+ traits={{ ...geometry, shape }}
133
+ />
134
+ )
135
+ }
136
+
137
+ type TraitSliderProps = {
138
+ control: TraitControl
139
+ overridden: boolean
140
+ value: number
141
+ onChange: (value: number) => void
142
+ }
143
+
144
+ function TraitSlider({ control, overridden, value, onChange }: TraitSliderProps) {
145
+ const inputId = `trait-${control.key.replaceAll('.', '-')}`
146
+
147
+ return (
148
+ <div className="grid gap-2 rounded-lg border border-border p-3">
149
+ <div className="flex items-center justify-between gap-3">
150
+ <label htmlFor={inputId} className="text-sm font-medium">
151
+ {control.label}
152
+ </label>
153
+ <Input
154
+ id={inputId}
155
+ type="number"
156
+ min={0}
157
+ max={0.999}
158
+ step={0.001}
159
+ value={formatTrait(value)}
160
+ onChange={event => {
161
+ const next = event.currentTarget.valueAsNumber
162
+ if (!Number.isNaN(next)) onChange(clampTrait(next))
163
+ }}
164
+ className="w-24 font-mono tabular-nums"
165
+ />
166
+ </div>
167
+ <Slider
168
+ aria-label={control.label}
169
+ min={0}
170
+ max={0.999}
171
+ step={0.001}
172
+ value={[value]}
173
+ onValueChange={next => onChange(clampTrait(singleSliderValue(next)))}
174
+ />
175
+ <span className="text-xs text-muted-foreground">
176
+ {control.range}
177
+ {overridden && ' · overridden'}
178
+ </span>
179
+ </div>
180
+ )
181
+ }
182
+
183
+ export function BlobatarShapesPage() {
184
+ const [seed, setSeed] = useState(AGENT_SEED)
185
+ const [shapeName, setShapeName] = useState<ShapeName>('boxy')
186
+ const [geometry, setGeometry] = useState<Record<string, number>>({})
187
+ const seededTraits = useMemo(() => createTraits(seed), [seed])
188
+ const family = SHAPE_FAMILIES.find(candidate => candidate.name === shapeName) ?? SHAPE_FAMILIES[2]
189
+ const shape = family.value
190
+ const familyControls = FAMILY_TRAITS[family.name]
191
+ const activeKeys = new Set([...BASE_TRAITS, ...familyControls].map(control => control.key))
192
+ const activeGeometry = Object.fromEntries(
193
+ Object.entries(geometry).filter(([key]) => activeKeys.has(key))
194
+ )
195
+ const configText = JSON.stringify(
196
+ {
197
+ name: seed,
198
+ traits: { shape, ...activeGeometry }
199
+ },
200
+ null,
201
+ 2
202
+ )
203
+
204
+ const traitValue = (key: string) => geometry[key] ?? seededTraits(key)
205
+ const setTrait = (key: string, value: number) => {
206
+ setGeometry(current => ({ ...current, [key]: value }))
207
+ }
208
+
209
+ return (
210
+ <main className="mx-auto w-full max-w-[96rem] px-6 py-10">
211
+ <Link href="/dev" className="text-sm text-muted-foreground hover:text-foreground">
212
+ ← Dev pages
213
+ </Link>
214
+
215
+ <header className="mt-5 max-w-3xl">
216
+ <p className="text-[11px] font-medium tracking-widest text-muted-foreground uppercase">
217
+ Playground
218
+ </p>
219
+ <h1 className="mt-2 text-3xl font-medium tracking-tight">Blobatar shape builder</h1>
220
+ <p className="mt-2 text-sm leading-6 text-muted-foreground">
221
+ Blobatar has 10 silhouette families. The seed generates every geometry trait you leave
222
+ alone, which is why different names produce so many variations. Pick a family and tune its
223
+ normalized 0–1 traits here.
224
+ </p>
225
+ </header>
226
+
227
+ <div className="mt-8 grid items-start gap-8 lg:grid-cols-[22rem_minmax(0,1fr)]">
228
+ <aside className="flex flex-col gap-4 lg:sticky lg:top-6">
229
+ <section className="flex flex-col gap-5 rounded-xl bg-card p-5 shadow-sm">
230
+ <div className="flex min-h-64 items-center justify-center rounded-xl bg-accent">
231
+ <ShapePreview
232
+ animated
233
+ geometry={activeGeometry}
234
+ seed={seed}
235
+ shape={shape}
236
+ size={208}
237
+ />
238
+ </div>
239
+
240
+ <div>
241
+ <p className="text-sm text-muted-foreground">Selected family</p>
242
+ <div className="mt-1 flex items-baseline justify-between gap-3">
243
+ <p className="text-lg font-medium capitalize">{family.name}</p>
244
+ <p className="font-mono text-sm tabular-nums">shape: {formatTrait(shape)}</p>
245
+ </div>
246
+ <p className="mt-1 font-mono text-xs text-muted-foreground">
247
+ {formatTrait(family.from)}–&lt;{formatTrait(family.to)}
248
+ </p>
249
+ </div>
250
+
251
+ <label className="grid gap-2 text-sm">
252
+ <span>Variant seed</span>
253
+ <Input value={seed} onChange={event => setSeed(event.currentTarget.value)} />
254
+ </label>
255
+
256
+ <div className="grid grid-cols-2 gap-2">
257
+ <Button type="button" onClick={() => void navigator.clipboard.writeText(configText)}>
258
+ <IconCopy data-icon="inline-start" stroke={1.5} />
259
+ Copy config
260
+ </Button>
261
+ <Button
262
+ type="button"
263
+ variant="outline"
264
+ disabled={Object.keys(geometry).length === 0}
265
+ onClick={() => setGeometry({})}
266
+ >
267
+ Reset traits
268
+ </Button>
269
+ </div>
270
+
271
+ <pre className="max-h-48 overflow-auto rounded-lg bg-muted p-3 font-mono text-xs leading-5">
272
+ {configText}
273
+ </pre>
274
+ </section>
275
+ </aside>
276
+
277
+ <div className="flex min-w-0 flex-col gap-6">
278
+ <section className="rounded-xl bg-card p-5 shadow-sm">
279
+ <h2 className="text-lg font-medium">Shape family</h2>
280
+ <p className="mt-1 text-sm text-muted-foreground">
281
+ Values within one family band select the same silhouette. These are stable
282
+ representative values for each family.
283
+ </p>
284
+ <div className="mt-4 grid grid-cols-2 gap-2 sm:grid-cols-5">
285
+ {SHAPE_FAMILIES.map(candidate => (
286
+ <Button
287
+ key={candidate.name}
288
+ type="button"
289
+ variant={shapeName === candidate.name ? 'secondary' : 'outline'}
290
+ aria-pressed={shapeName === candidate.name}
291
+ onClick={() => setShapeName(candidate.name)}
292
+ className="h-auto flex-col gap-2 py-3"
293
+ >
294
+ <ShapePreview geometry={geometry} seed={seed} shape={candidate.value} size={48} />
295
+ <span className="capitalize">{candidate.name}</span>
296
+ <span className="font-mono text-xs text-muted-foreground tabular-nums">
297
+ {formatTrait(candidate.value)}
298
+ </span>
299
+ </Button>
300
+ ))}
301
+ </div>
302
+ </section>
303
+
304
+ <section className="rounded-xl bg-card p-5 shadow-sm">
305
+ <h2 className="text-lg font-medium">Base geometry</h2>
306
+ <p className="mt-1 text-sm text-muted-foreground">
307
+ Sliders start at values generated by the seed. Moving one creates an explicit trait
308
+ override.
309
+ </p>
310
+ <div className="mt-4 grid gap-3 md:grid-cols-2">
311
+ {BASE_TRAITS.map(control => (
312
+ <TraitSlider
313
+ key={control.key}
314
+ control={control}
315
+ value={traitValue(control.key)}
316
+ overridden={geometry[control.key] !== undefined}
317
+ onChange={value => setTrait(control.key, value)}
318
+ />
319
+ ))}
320
+ </div>
321
+ </section>
322
+
323
+ <section className="rounded-xl bg-card p-5 shadow-sm">
324
+ <h2 className="text-lg font-medium capitalize">{family.name} geometry</h2>
325
+ <p className="mt-1 text-sm text-muted-foreground">
326
+ These controls only affect the selected family.
327
+ </p>
328
+ <div className="mt-4 grid gap-3 md:grid-cols-2">
329
+ {familyControls.map(control => (
330
+ <TraitSlider
331
+ key={control.key}
332
+ control={control}
333
+ value={traitValue(control.key)}
334
+ overridden={geometry[control.key] !== undefined}
335
+ onChange={value => setTrait(control.key, value)}
336
+ />
337
+ ))}
338
+ </div>
339
+ </section>
340
+ </div>
341
+ </div>
342
+ </main>
343
+ )
344
+ }
@@ -23,7 +23,7 @@ import {
23
23
  } from '@/client/components/ui/dropdown-menu'
24
24
  import { Switch } from '@/client/components/ui/switch'
25
25
  import { ChatNoticeRow } from '@/client/features/chat/ChatPanel'
26
- import { ChatErrorBanner } from '@/client/features/chat/composer/banners/ChatErrorBanner'
26
+ import { ErrorBanner } from '@/client/features/chat/composer/banners/ErrorBanner'
27
27
  import { ChatSessionItem } from '@/client/features/chat/ChatSelector'
28
28
  import { TurnView } from '@/client/features/chat/TurnView'
29
29
  import { isSessionRunning, liveStore } from '@/client/features/chat/chat-store'
@@ -135,7 +135,6 @@ function Transcript({
135
135
  <div className="-ml-3 pt-2">
136
136
  <AgentBlobatar
137
137
  color="primary"
138
- size={64}
139
138
  animated={processing}
140
139
  expression={processing ? 'thinking' : undefined}
141
140
  />
@@ -331,7 +330,7 @@ export function ChatStatesPage() {
331
330
 
332
331
  {showError && (
333
332
  <div className="mt-6 flex w-full flex-col gap-2 rounded-t-xl rounded-b-2xl bg-destructive/10 p-2">
334
- <ChatErrorBanner error={chatError} onDismiss={() => setShowError(false)} />
333
+ <ErrorBanner error={chatError} onDismiss={() => setShowError(false)} />
335
334
  </div>
336
335
  )}
337
336
  </div>
@@ -445,7 +444,7 @@ export function ChatStatesPage() {
445
444
  <code>SessionSnapshot</code> —{' '}
446
445
  <code>
447
446
  {
448
- "{ sessionId, model: 'claude-sonnet-4-6', cwd, permissionMode: 'bypassPermissions', tools: ['Bash', 'Read', …], mcpServers: [{ name: 'github', status: 'connected' }], skills: ['moi-workspace'], … }"
447
+ "{ sessionId, model: 'claude-sonnet-4-6', cwd, permissionMode: 'auto', tools: ['Bash', 'Read', …], mcpServers: [{ name: 'github', status: 'connected' }], skills: ['moi-workspace'], … }"
449
448
  }
450
449
  </code>
451
450
  </li>
@@ -7,6 +7,11 @@ type DevRouteEntry = {
7
7
  }
8
8
 
9
9
  const DEV_ROUTES: DevRouteEntry[] = [
10
+ {
11
+ path: '/dev/blobatar-shapes',
12
+ title: 'Blobatar shape builder',
13
+ description: 'Tune all 10 shape families and their geometry traits for the agent.'
14
+ },
10
15
  {
11
16
  path: '/dev/chat-states',
12
17
  title: 'Chat states',
@@ -1,6 +1,7 @@
1
1
  import { Route, Switch } from 'wouter'
2
2
 
3
3
  import { ChatStatesPage } from './ChatStatesPage'
4
+ import { BlobatarShapesPage } from './BlobatarShapesPage'
4
5
  import { DevIndexPage } from './DevIndexPage'
5
6
  import { HarnessDebugPage } from './HarnessDebugPage'
6
7
  import { TextureLabPage } from './TextureLabPage'
@@ -14,6 +15,7 @@ export default function DevRoutes() {
14
15
  return (
15
16
  <Switch>
16
17
  <Route path="/dev/harness" component={HarnessDebugPage} />
18
+ <Route path="/dev/blobatar-shapes" component={BlobatarShapesPage} />
17
19
  <Route path="/dev/chat-states" component={ChatStatesPage} />
18
20
  <Route path="/dev/tool-calls" component={ToolCallsPage} />
19
21
  <Route path="/dev/textures" component={TextureLabPage} />
@@ -15,12 +15,15 @@ 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'
18
+ import { AgentBlobatar } from '@/client/components/shared/AgentBlobatar'
18
19
  import { Button } from '@/client/components/ui/button'
19
20
  import {
20
21
  Collapsible,
21
22
  CollapsibleContent,
22
23
  CollapsibleTrigger
23
24
  } from '@/client/components/ui/collapsible'
25
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@/client/components/ui/tooltip'
26
+ import { hasRunningWorkspaceActivity, useLive } from '@/client/features/chat/chat-store'
24
27
  import { cn } from '@/client/lib/cn'
25
28
  import { getWorkspaceThemeStyle, usePreloadWorkspaceFonts } from '@/client/runtime/workspace-theme'
26
29
  import { useUiStore } from '@/client/store/ui'
@@ -29,7 +32,9 @@ import {
29
32
  workspaceDisplayName,
30
33
  workspaceProviderIcon
31
34
  } from '@/client/features/home/workspace-presentation'
35
+ import { resolveWorkspaceTheme } from '@/lib/themes'
32
36
  import type { DiscoveredWorkspace, WorkspaceEntry } from '@/lib/types'
37
+ import { workspaceTabPath } from '@/lib/workspace-tabs'
33
38
 
34
39
  import { WorkspacePreview } from './WorkspacePreview'
35
40
 
@@ -174,12 +179,49 @@ function WorkspaceCard({ workspace }: WorkspaceCardProps) {
174
179
  const name = workspaceDisplayName(workspace)
175
180
  const previewQuery = useWorkspacePreview(workspace.id)
176
181
  const theme = previewQuery.data?.theme
182
+ const agent = resolveWorkspaceTheme(theme).agent
183
+ const running = useLive(state => hasRunningWorkspaceActivity(state.activity, workspace.id))
177
184
  const updatedAt = previewQuery.data?.updatedAt ?? new Date(workspace.addedAt).getTime()
185
+ const workspaceHref = `/workspace/${workspace.id}`
178
186
 
179
187
  return (
180
- <Link href={`/workspace/${workspace.id}`} className="group flex min-w-0 flex-col gap-3">
181
- <WorkspacePreview workspaceId={workspace.id} />
182
- <div className="flex min-w-0 flex-col gap-2 px-2">
188
+ <div className="group flex min-w-0 flex-col gap-3">
189
+ <div className="relative">
190
+ <WorkspacePreview workspaceId={workspace.id} />
191
+ <Link
192
+ href={workspaceHref}
193
+ aria-label={`Open ${name}`}
194
+ className="absolute inset-0 rounded-2xl outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
195
+ />
196
+ {previewQuery.data && (
197
+ <Tooltip>
198
+ <TooltipTrigger
199
+ render={
200
+ <Link
201
+ href={workspaceTabPath(workspace.id, 'agent')}
202
+ aria-label={`Chat in ${name}`}
203
+ style={getWorkspaceThemeStyle(theme)}
204
+ className="absolute right-3 bottom-3 rounded-lg outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
205
+ >
206
+ <AgentBlobatar
207
+ preset={agent}
208
+ color="primary"
209
+ animated={running}
210
+ expression={running ? 'thinking' : undefined}
211
+ size={48}
212
+ className="drop-shadow-sm drop-shadow-primary/20"
213
+ />
214
+ </Link>
215
+ }
216
+ />
217
+ <TooltipContent>Chat</TooltipContent>
218
+ </Tooltip>
219
+ )}
220
+ </div>
221
+ <Link
222
+ href={workspaceHref}
223
+ className="flex min-w-0 flex-col gap-2 rounded-lg px-2 outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
224
+ >
183
225
  <div
184
226
  className="flex min-w-0 items-center gap-1.5 font-sans"
185
227
  style={getWorkspaceThemeStyle(theme)}
@@ -192,8 +234,8 @@ function WorkspaceCard({ workspace }: WorkspaceCardProps) {
192
234
  <span className="truncate text-sm font-medium text-foreground">{name}</span>
193
235
  </div>
194
236
  <span className="text-xs text-muted-foreground">{formatUpdatedAt(updatedAt)}</span>
195
- </div>
196
- </Link>
237
+ </Link>
238
+ </div>
197
239
  )
198
240
  }
199
241
 
@@ -94,21 +94,21 @@ const THUMBNAIL_STYLES = [
94
94
  {
95
95
  frame: cn(
96
96
  '-translate-x-3 translate-y-3 -rotate-6',
97
- 'group-hover:translate-y-2 group-focus-visible:translate-y-2'
97
+ 'group-focus-within:translate-y-2 group-hover:translate-y-2'
98
98
  ),
99
99
  img: 'opacity-40'
100
100
  },
101
101
  {
102
102
  frame: cn(
103
103
  'translate-x-3 translate-y-2 rotate-5',
104
- 'group-hover:translate-y-1 group-focus-visible:translate-y-1'
104
+ 'group-focus-within:translate-y-1 group-hover:translate-y-1'
105
105
  ),
106
106
  img: 'opacity-50'
107
107
  },
108
108
  {
109
109
  frame: cn(
110
110
  '-translate-x-1 translate-y-1 -rotate-2',
111
- 'group-hover:-translate-y-2 group-focus-visible:-translate-y-2'
111
+ 'group-focus-within:-translate-y-2 group-hover:-translate-y-2'
112
112
  ),
113
113
  img: 'opacity-100'
114
114
  }
@@ -191,7 +191,7 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
191
191
  'w-max max-w-40 origin-center rounded-lg bg-card px-3 py-2 font-sans shadow-xs',
192
192
  'animate-in transition-transform duration-300 ease-out fade-in',
193
193
  '-translate-x-1 translate-y-1 -rotate-2',
194
- 'group-hover:translate-y-0.5 group-focus-visible:translate-y-0.5'
194
+ 'group-focus-within:translate-y-0.5 group-hover:translate-y-0.5'
195
195
  )}
196
196
  >
197
197
  <p className="line-clamp-3 text-sm leading-normal whitespace-normal">
@@ -52,7 +52,7 @@ export function getWorkspaceAgentOptions({
52
52
  }: WorkspaceAgentOptionsInput): WorkspaceAgentOption[] {
53
53
  return WORKSPACE_TYPE_ORDER.map(type => {
54
54
  const state = availability?.[type]
55
- const unavailableReason = state?.available === false ? state.reason : undefined
55
+ const unavailableReason = state && state.status !== 'available' ? state.reason : undefined
56
56
  const importOnlyReason = !detectedTypes.includes(type)
57
57
  ? IMPORT_ONLY_DESCRIPTION[type]
58
58
  : undefined
@@ -35,7 +35,19 @@ export function getUpdateButtonState(
35
35
  return { busy, blocked, label }
36
36
  }
37
37
 
38
- export function Update() {
38
+ type UpdateButtonProps = {
39
+ busy: boolean
40
+ blocked: boolean
41
+ label: string
42
+ errorMessage: string | null
43
+ onClick: () => void
44
+ }
45
+
46
+ export type UpdateControl =
47
+ | { status: 'loading' | 'unavailable' }
48
+ | { status: 'available'; button: UpdateButtonProps }
49
+
50
+ export function useUpdateControl(): UpdateControl {
39
51
  const update = useUpdate()
40
52
  const statusQuery = useUpdateStatus(update.isSuccess)
41
53
  const agentRunning = useLive(state => hasRunningActivity(state.activity))
@@ -46,11 +58,23 @@ export function Update() {
46
58
  if (shouldReloadAfterUpdate(status, restartTarget)) window.location.reload()
47
59
  }, [restartTarget, status])
48
60
 
49
- if (!status?.availableVersion) return null
61
+ if (statusQuery.isPending) return { status: 'loading' }
62
+ if (!status?.availableVersion && !update.isSuccess) return { status: 'unavailable' }
50
63
 
51
64
  const restarting = update.isSuccess
52
65
  const button = getUpdateButtonState(agentRunning, update.isPending, restarting)
53
66
 
67
+ return {
68
+ status: 'available',
69
+ button: {
70
+ ...button,
71
+ errorMessage: update.error?.message ?? null,
72
+ onClick: () => update.mutate()
73
+ }
74
+ }
75
+ }
76
+
77
+ export function UpdateButton({ busy, blocked, label, errorMessage, onClick }: UpdateButtonProps) {
54
78
  // The div gives TooltipTrigger an enabled event target when the button is disabled.
55
79
  return (
56
80
  <Tooltip>
@@ -60,18 +84,18 @@ export function Update() {
60
84
  <Button
61
85
  type="button"
62
86
  size="icon"
63
- variant={button.busy ? 'ghost' : 'default'}
64
- aria-label={button.label}
65
- disabled={button.blocked || button.busy}
66
- onClick={() => update.mutate()}
87
+ variant={busy ? 'ghost' : 'default'}
88
+ aria-label={label}
89
+ disabled={blocked || busy}
90
+ onClick={onClick}
67
91
  >
68
- {button.busy ? <Spinner stroke={1.5} /> : <IconDownload stroke={1.5} />}
92
+ {busy ? <Spinner stroke={1.5} /> : <IconDownload stroke={1.5} />}
69
93
  </Button>
70
94
  </div>
71
95
  }
72
96
  />
73
- <TooltipContent side="right" className={button.blocked ? 'max-w-56' : undefined}>
74
- {button.blocked ? UPDATE_ACTIVE_AGENT_MESSAGE : (update.error?.message ?? button.label)}
97
+ <TooltipContent side="right" className={blocked ? 'max-w-56' : undefined}>
98
+ {blocked ? UPDATE_ACTIVE_AGENT_MESSAGE : (errorMessage ?? label)}
75
99
  </TooltipContent>
76
100
  </Tooltip>
77
101
  )
@@ -183,7 +183,7 @@ export function CustomizePanel({ onClose, ref }: CustomizePanelProps) {
183
183
  >
184
184
  <div className="flex items-center gap-2">
185
185
  <span className="flex size-5 shrink-0 items-center justify-center">
186
- <AgentBlobatar preset={key} color="primary" size={32} />
186
+ <AgentBlobatar preset={key} color="primary" size={28} />
187
187
  </span>
188
188
  <span className="text-sm font-medium">{preset.label}</span>
189
189
  </div>
@@ -271,7 +271,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
271
271
  selectSession,
272
272
  dismissError
273
273
  } = useChat({ activeTab, appletParams })
274
- const { composerBanner, builderComposerBanner, composerAvailability } = useWorkspaceComposerState(
274
+ const { composerBanner, builderComposerBanner, agentAvailability } = useWorkspaceComposerState(
275
275
  workspaceId,
276
276
  {
277
277
  chatError: error,
@@ -483,7 +483,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
483
483
  // Chat messages fired from applet UI. `openChat` is the reveal: on a view tab
484
484
  // in full-screen mode the chat is a closed popover, and a run the user can't
485
485
  // see is worse than a panel that opens itself.
486
- useAppletChatMessage({ send, revealChat: openChat, composerAvailability })
486
+ useAppletChatMessage({ send, revealChat: openChat, agentAvailability })
487
487
 
488
488
  const createItems: CreateWorkspaceTabItem[] = [
489
489
  ...(!dockedSplit && !openSet.has('agent')
@@ -585,7 +585,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
585
585
  sessionId={sessionId}
586
586
  processing={processing}
587
587
  composerBanner={builderChatDraft ? builderComposerBanner : composerBanner}
588
- composerAvailability={composerAvailability}
588
+ agentAvailability={agentAvailability}
589
589
  send={send}
590
590
  stop={stop}
591
591
  onNavigateFromWelcome={navigateFromWelcome}
@@ -608,7 +608,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
608
608
  sessionId={sessionId}
609
609
  processing={processing}
610
610
  composerBanner={composerBanner}
611
- composerAvailability={composerAvailability}
611
+ agentAvailability={agentAvailability}
612
612
  send={send}
613
613
  stop={stop}
614
614
  onNavigateFromWelcome={navigateFromWelcome}
@@ -767,7 +767,7 @@ export function WorkspaceScreen({ widgets, views, builders }: WorkspaceScreenPro
767
767
  sessionId={sessionId}
768
768
  processing={processing}
769
769
  composerBanner={builderChatDraft ? builderComposerBanner : composerBanner}
770
- composerAvailability={composerAvailability}
770
+ agentAvailability={agentAvailability}
771
771
  send={send}
772
772
  stop={stop}
773
773
  onNavigateFromWelcome={navigateFromWelcome}