moi-computer 0.3.1-next.1 → 0.4.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.
- package/README.md +85 -12
- package/bin/moi.mjs +11 -0
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/AppRouter.tsx +5 -1
- package/client/app/routes/WorkspaceRoute.tsx +9 -5
- package/client/app/shell/SidebarLayout.tsx +9 -7
- package/client/components/shared/BottomPanel.tsx +24 -5
- package/client/components/shared/Composer.tsx +1 -1
- package/client/components/shared/PanelHeader.tsx +1 -1
- package/client/components/ui/button.tsx +5 -5
- package/client/components/ui/dropdown-menu.tsx +6 -6
- package/client/components/ui/hover-card.tsx +1 -1
- package/client/components/ui/input.tsx +1 -1
- package/client/components/ui/popover.tsx +1 -1
- package/client/components/ui/skeleton.tsx +1 -1
- package/client/components/ui/textarea.tsx +1 -1
- package/client/components/ui/tooltip.tsx +1 -1
- package/client/features/applets/applet-cache.ts +20 -1
- package/client/features/applets/applet-log.ts +10 -30
- package/client/features/applets/applet-runtime.ts +272 -0
- package/client/features/applets/useApplet.ts +36 -10
- package/client/features/chat/ChatComposer.tsx +1 -1
- package/client/features/chat/ChatEmptyState.tsx +186 -0
- package/client/features/chat/ChatPanel.tsx +95 -54
- package/client/features/chat/ChatPopup.tsx +3 -13
- package/client/features/chat/ChatPromptBubbles.tsx +74 -0
- package/client/features/chat/MarkdownContent.tsx +15 -3
- package/client/features/chat/ModelPicker.tsx +1 -1
- package/client/features/chat/TurnView.tsx +6 -17
- package/client/features/chat/chat-send.ts +26 -1
- package/client/features/chat/tool-group/CodeBlock.tsx +1 -1
- package/client/features/chat/tool-group/ReadImagePreview.tsx +1 -1
- package/client/features/chat/tool-group/SubagentCard.tsx +1 -1
- package/client/features/chat/tool-group/TimelineRow.tsx +4 -4
- package/client/features/chat/tool-group/ToolCallGroup.tsx +12 -5
- package/client/features/chat/tool-group/ToolOutput.tsx +2 -2
- package/client/features/chat/tool-group/format.ts +25 -4
- package/client/features/chat/useAppletChatMessage.ts +69 -0
- package/client/features/chat/useChat.ts +49 -14
- package/client/features/chat/useStickToBottom.ts +11 -1
- package/client/features/connectors/McpServerCards.tsx +3 -3
- package/client/features/dev/HarnessDebugPage.tsx +213 -77
- package/client/features/dev/PixelPainter.tsx +1 -1
- package/client/features/dev/PlaygroundPage.tsx +1 -1
- package/client/features/dev/ToolCallsPage.tsx +2 -2
- package/client/features/home/HomePage.tsx +17 -14
- package/client/features/home/WorkspacePreview.tsx +12 -13
- package/client/features/home/api.ts +8 -5
- package/client/features/home/workspace-presentation.tsx +1 -1
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +1 -1
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +21 -8
- package/client/features/scratchpad/Scratchpad.tsx +41 -2
- package/client/features/scratchpad/ScratchpadControls.tsx +13 -13
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +1 -1
- package/client/features/settings/EnvironmentSettings.tsx +1 -1
- package/client/features/settings/IconPicker.tsx +11 -11
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +2 -2
- package/client/features/settings/api.ts +33 -1
- package/client/features/widgets/HiddenPanel.tsx +4 -3
- package/client/features/widgets/Widgets.tsx +1 -0
- package/client/features/workspace/CustomizePanel.tsx +96 -82
- package/client/features/workspace/WorkspaceScreen.tsx +129 -107
- package/client/features/workspace/WorkspaceSkillUpdateBanner.tsx +91 -0
- package/client/features/workspace/WorkspaceTabs.tsx +1 -1
- package/client/features/workspace/api.ts +52 -0
- package/client/features/workspace/moi-context.ts +63 -17
- package/client/features/workspace/tab-resolution.ts +75 -0
- package/client/features/workspace/useWorkspaceNavigation.ts +128 -0
- package/client/features/workspace/useWorkspaceSkillUpdates.ts +160 -0
- package/client/index.css +10 -15
- package/client/lib/app-icon-registry.ts +77 -70
- package/client/lib/rate-limit.ts +77 -0
- package/client/main.tsx +10 -2
- package/client/runtime/useWorkspaceEvents.ts +15 -2
- package/client/runtime/workspace-theme.ts +115 -0
- package/client/store/ui.ts +42 -17
- package/client/theme.css +20 -15
- package/dist/{chunk-1dfbr7n2.js → chunk-3m1xe1j3.js} +94 -94
- package/dist/chunk-5vaevt8z.js +2 -0
- package/dist/chunk-7bzpmtxp.js +50 -0
- package/dist/chunk-h0hk61pm.js +9 -0
- package/dist/{chunk-vkvb3hjm.js → chunk-h3evrtyp.js} +1 -1
- package/dist/chunk-k5sjx9s5.js +1 -0
- package/dist/{chunk-jen6xcm1.js → chunk-m9qja0nx.js} +1 -1
- package/dist/chunk-s7za1qsv.css +1 -0
- package/dist/{chunk-sxbfh73c.js → chunk-tcfa3vt3.js} +1 -1
- package/dist/chunk-v797g6ap.js +51 -0
- package/dist/chunk-xyrw8318.js +27 -0
- package/dist/index.html +1 -1
- package/lib/app-icons.ts +73 -0
- package/lib/moi-context.ts +104 -3
- package/lib/themes.ts +83 -45
- package/lib/types.ts +44 -9
- package/lib/workspace-tabs.ts +48 -0
- package/package.json +4 -1
- package/server/api.ts +57 -5
- package/server/app-settings.ts +65 -0
- package/server/applets.ts +132 -22
- package/server/bundler/build-applet.ts +74 -16
- package/server/cli.ts +144 -17
- package/server/control.ts +53 -7
- package/server/data-dir.ts +1 -1
- package/server/events.ts +1 -1
- package/server/functions-worker.ts +15 -1
- package/server/functions.ts +51 -6
- package/server/harness/claude-code/index.ts +2 -1
- package/server/harness/codex/adapter.ts +100 -9
- package/server/harness/codex/client.ts +34 -1
- package/server/harness/codex/index.ts +2 -1
- package/server/harness/codex/session.ts +32 -8
- package/server/layout.ts +9 -14
- package/server/moi-scaffold.ts +37 -3
- package/server/registry.ts +1 -1
- package/server/skill-update.ts +47 -0
- package/server/skill-version.ts +2 -11
- package/server/tabs.ts +59 -0
- package/server/theme.ts +8 -14
- package/server/view-builders.ts +6 -2
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +265 -107
- package/workspace/.claude/skills/moi-workspace/SKILL.md +85 -11
- package/client/features/workspace/useWorkspaceTheme.ts +0 -82
- package/dist/chunk-339jds4x.js +0 -15
- package/dist/chunk-3xsvsnhr.css +0 -1
- package/dist/chunk-6c8cwpzc.js +0 -1
- package/dist/chunk-anqmsbjt.js +0 -2
- package/dist/chunk-hbvfb6sk.js +0 -63
- package/dist/chunk-qwm5f6qk.js +0 -48
- package/dist/chunk-yp4srgqt.js +0 -10
- package/workspace/.claude/skills/moi-workspace/VIEW-DESIGN.md +0 -22
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
|
+
import { IconCheck, IconCopy } from '@tabler/icons-react'
|
|
4
|
+
import { useSearchParams } from 'wouter'
|
|
5
|
+
|
|
3
6
|
import { Button } from '@/client/components/ui/button'
|
|
4
7
|
import { cn } from '@/client/lib/cn'
|
|
5
8
|
import { wsUrl } from '@/client/lib/ws-url'
|
|
@@ -102,7 +105,7 @@ function LogRow({ time, badge, badgeClass, label, body }: LogRowProps) {
|
|
|
102
105
|
<span className="shrink-0 font-semibold">{label}</span>
|
|
103
106
|
<span className="truncate text-muted-foreground">{shortJson(body)}</span>
|
|
104
107
|
</summary>
|
|
105
|
-
<pre className="mt-1 max-h-80 overflow-auto rounded bg-muted p-2 text-[10px] whitespace-pre-wrap">
|
|
108
|
+
<pre className="mt-1 max-h-80 overflow-auto rounded bg-muted p-2 font-mono text-[10px] whitespace-pre-wrap">
|
|
106
109
|
{JSON.stringify(body, null, 2)}
|
|
107
110
|
</pre>
|
|
108
111
|
</details>
|
|
@@ -110,28 +113,54 @@ function LogRow({ time, badge, badgeClass, label, body }: LogRowProps) {
|
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
type PaneProps = {
|
|
113
|
-
title:
|
|
116
|
+
title: React.ReactNode
|
|
114
117
|
hint?: string
|
|
118
|
+
// Extra header widgets (e.g. a filter input), rendered before the follow toggle.
|
|
119
|
+
controls?: React.ReactNode
|
|
120
|
+
onCopy?: () => void
|
|
115
121
|
onClear?: () => void
|
|
116
122
|
children: React.ReactNode
|
|
117
123
|
}
|
|
118
124
|
|
|
119
|
-
function Pane({ title, hint, onClear, children }: PaneProps) {
|
|
125
|
+
function Pane({ title, hint, controls, onCopy, onClear, children }: PaneProps) {
|
|
120
126
|
const scroller = useRef<HTMLDivElement>(null)
|
|
121
127
|
const [follow, setFollow] = useState(true)
|
|
128
|
+
const [copied, setCopied] = useState(false)
|
|
129
|
+
const handleCopy = useCallback(() => {
|
|
130
|
+
onCopy?.()
|
|
131
|
+
setCopied(true)
|
|
132
|
+
setTimeout(() => setCopied(false), 1500)
|
|
133
|
+
}, [onCopy])
|
|
122
134
|
useEffect(() => {
|
|
123
135
|
if (follow && scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight
|
|
124
136
|
})
|
|
125
137
|
return (
|
|
126
|
-
<div className="flex min-h-0 flex-1 flex-col rounded-
|
|
138
|
+
<div className="flex min-h-0 min-w-0 flex-1 flex-col rounded-xl border border-border bg-background">
|
|
127
139
|
<div className="flex items-center gap-2 border-b border-border px-2 py-1">
|
|
128
|
-
<span className="text-xs font-semibold">{title}</span>
|
|
140
|
+
{typeof title === 'string' ? <span className="text-xs font-semibold">{title}</span> : title}
|
|
129
141
|
{hint && <span className="truncate text-[10px] text-muted-foreground">{hint}</span>}
|
|
130
142
|
<span className="grow" />
|
|
143
|
+
{controls}
|
|
131
144
|
<label className="flex items-center gap-1 text-[10px] text-muted-foreground">
|
|
132
145
|
<input type="checkbox" checked={follow} onChange={e => setFollow(e.target.checked)} />
|
|
133
146
|
follow
|
|
134
147
|
</label>
|
|
148
|
+
{onCopy && (
|
|
149
|
+
<Button
|
|
150
|
+
type="button"
|
|
151
|
+
variant="ghost"
|
|
152
|
+
size="icon-sm"
|
|
153
|
+
onClick={handleCopy}
|
|
154
|
+
aria-label="Copy log"
|
|
155
|
+
title="Copy log"
|
|
156
|
+
>
|
|
157
|
+
{copied ? (
|
|
158
|
+
<IconCheck stroke={1.75} className="text-muted-foreground" />
|
|
159
|
+
) : (
|
|
160
|
+
<IconCopy stroke={1.75} />
|
|
161
|
+
)}
|
|
162
|
+
</Button>
|
|
163
|
+
)}
|
|
135
164
|
{onClear && (
|
|
136
165
|
<Button type="button" variant="ghost" size="sm" onClick={onClear}>
|
|
137
166
|
Clear
|
|
@@ -146,8 +175,10 @@ function Pane({ title, hint, onClear, children }: PaneProps) {
|
|
|
146
175
|
}
|
|
147
176
|
|
|
148
177
|
export function HarnessDebugPage() {
|
|
178
|
+
const [searchParams, setSearchParams] = useSearchParams()
|
|
149
179
|
const [workspaces, setWorkspaces] = useState<WorkspaceEntry[]>([])
|
|
150
|
-
|
|
180
|
+
// Seeded from ?workspace= so the selection survives reloads / can be shared.
|
|
181
|
+
const [workspaceId, setWorkspaceId] = useState(() => searchParams.get('workspace') ?? '')
|
|
151
182
|
const [models, setModels] = useState<Model[]>([])
|
|
152
183
|
const [model, setModel] = useState('')
|
|
153
184
|
const [effort, setEffort] = useState('')
|
|
@@ -160,6 +191,12 @@ export function HarnessDebugPage() {
|
|
|
160
191
|
const [clientFrames, setClientFrames] = useState<BroadcastFrame[]>([])
|
|
161
192
|
const [events, setEvents] = useState<unknown[] | null>(null)
|
|
162
193
|
const [hidePreviews, setHidePreviews] = useState(false)
|
|
194
|
+
const [rightTab, setRightTab] = useState<'frames' | 'events'>('frames')
|
|
195
|
+
// Split position of the wire pane, as % of the row. Wire frames are the
|
|
196
|
+
// denser log, so it gets more room by default; the handle between the panes
|
|
197
|
+
// drags it between 20% and 80%.
|
|
198
|
+
const [leftPct, setLeftPct] = useState(60)
|
|
199
|
+
const rowRef = useRef<HTMLDivElement>(null)
|
|
163
200
|
|
|
164
201
|
const wireCursor = useRef(0)
|
|
165
202
|
const wsRef = useRef<WebSocket | null>(null)
|
|
@@ -173,11 +210,26 @@ export function HarnessDebugPage() {
|
|
|
173
210
|
.then(r => r.json())
|
|
174
211
|
.then((list: WorkspaceEntry[]) => {
|
|
175
212
|
setWorkspaces(list)
|
|
176
|
-
|
|
213
|
+
// Keep the URL-seeded id only if it's a real workspace.
|
|
214
|
+
setWorkspaceId(id => (id && list.some(w => w.id === id) ? id : (list[0]?.id ?? '')))
|
|
177
215
|
})
|
|
178
216
|
.catch(() => {})
|
|
179
217
|
}, [])
|
|
180
218
|
|
|
219
|
+
const selectWorkspace = useCallback(
|
|
220
|
+
(id: string) => {
|
|
221
|
+
setWorkspaceId(id)
|
|
222
|
+
setSearchParams(
|
|
223
|
+
prev => {
|
|
224
|
+
prev.set('workspace', id)
|
|
225
|
+
return prev
|
|
226
|
+
},
|
|
227
|
+
{ replace: true }
|
|
228
|
+
)
|
|
229
|
+
},
|
|
230
|
+
[setSearchParams]
|
|
231
|
+
)
|
|
232
|
+
|
|
181
233
|
const provider = workspaces.find(w => w.id === workspaceId)?.type ?? 'claude-code'
|
|
182
234
|
|
|
183
235
|
// Model list for the selected workspace.
|
|
@@ -287,6 +339,12 @@ export function HarnessDebugPage() {
|
|
|
287
339
|
[models, model]
|
|
288
340
|
)
|
|
289
341
|
|
|
342
|
+
const [wireFilter, setWireFilter] = useState('')
|
|
343
|
+
const visibleWire = useMemo(() => {
|
|
344
|
+
const q = wireFilter.trim().toLowerCase()
|
|
345
|
+
return q ? wire.filter(f => frameLabel(f.frame).toLowerCase().includes(q)) : wire
|
|
346
|
+
}, [wire, wireFilter])
|
|
347
|
+
|
|
290
348
|
const visibleClientFrames = useMemo(
|
|
291
349
|
() =>
|
|
292
350
|
hidePreviews
|
|
@@ -295,16 +353,34 @@ export function HarnessDebugPage() {
|
|
|
295
353
|
[clientFrames, hidePreviews]
|
|
296
354
|
)
|
|
297
355
|
|
|
356
|
+
// Copy the displayed frames (respecting any active filter) as timestamped
|
|
357
|
+
// JSONL — the same shape the panes render, so a paste reads like the
|
|
358
|
+
// on-screen log.
|
|
359
|
+
const copyWire = useCallback(() => {
|
|
360
|
+
navigator.clipboard.writeText(
|
|
361
|
+
visibleWire
|
|
362
|
+
.map(f => `${ts(f.ts)} ${f.dir === 'send' ? '→' : '←'} ${JSON.stringify(f.frame)}`)
|
|
363
|
+
.join('\n')
|
|
364
|
+
)
|
|
365
|
+
}, [visibleWire])
|
|
366
|
+
const copyRight = useCallback(() => {
|
|
367
|
+
navigator.clipboard.writeText(
|
|
368
|
+
rightTab === 'frames'
|
|
369
|
+
? visibleClientFrames.map(f => `${ts(f.ts)} ws ${JSON.stringify(f.frame)}`).join('\n')
|
|
370
|
+
: JSON.stringify(events ?? [], null, 2)
|
|
371
|
+
)
|
|
372
|
+
}, [rightTab, visibleClientFrames, events])
|
|
373
|
+
|
|
298
374
|
return (
|
|
299
375
|
<div className="flex h-dvh flex-col gap-2 bg-muted p-2">
|
|
300
|
-
<div className="flex flex-wrap items-center gap-2 rounded-
|
|
376
|
+
<div className="flex flex-wrap items-center gap-2 rounded-xl border border-border bg-background px-2 py-1.5 text-xs">
|
|
301
377
|
<span className="font-semibold tracking-widest text-muted-foreground uppercase">
|
|
302
378
|
Harness debug
|
|
303
379
|
</span>
|
|
304
380
|
<select
|
|
305
381
|
className="rounded border border-border bg-background px-1 py-0.5"
|
|
306
382
|
value={workspaceId}
|
|
307
|
-
onChange={e =>
|
|
383
|
+
onChange={e => selectWorkspace(e.target.value)}
|
|
308
384
|
>
|
|
309
385
|
{workspaces.length === 0 && <option value="">no workspaces</option>}
|
|
310
386
|
{workspaces.map(w => (
|
|
@@ -363,7 +439,7 @@ export function HarnessDebugPage() {
|
|
|
363
439
|
</Button>
|
|
364
440
|
</div>
|
|
365
441
|
|
|
366
|
-
<div className="flex flex-wrap items-center gap-1.5 rounded-
|
|
442
|
+
<div className="flex flex-wrap items-center gap-1.5 rounded-xl border border-border bg-background px-2 py-1.5">
|
|
367
443
|
{SCENARIOS.map(s => (
|
|
368
444
|
<Button
|
|
369
445
|
key={s.label}
|
|
@@ -389,77 +465,137 @@ export function HarnessDebugPage() {
|
|
|
389
465
|
/>
|
|
390
466
|
</div>
|
|
391
467
|
|
|
392
|
-
<div className="flex min-h-0 flex-1 gap-
|
|
468
|
+
<div ref={rowRef} className="flex min-h-0 flex-1 gap-1">
|
|
469
|
+
{/* Dynamic drag geometry can't be a static Tailwind class */}
|
|
470
|
+
<div className="flex min-w-0" style={{ width: `${leftPct}%` }}>
|
|
471
|
+
<Pane
|
|
472
|
+
title={provider === 'codex' ? 'App-server wire' : 'Harness wire'}
|
|
473
|
+
hint={
|
|
474
|
+
provider === 'codex'
|
|
475
|
+
? 'raw JSON-RPC, both directions'
|
|
476
|
+
: provider === 'openclaw'
|
|
477
|
+
? 'no wire tap for OpenClaw yet'
|
|
478
|
+
: 'raw Agent SDK messages + enqueued inputs'
|
|
479
|
+
}
|
|
480
|
+
controls={
|
|
481
|
+
<input
|
|
482
|
+
className="w-36 rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px]"
|
|
483
|
+
placeholder="filter types…"
|
|
484
|
+
value={wireFilter}
|
|
485
|
+
onChange={e => setWireFilter(e.target.value)}
|
|
486
|
+
/>
|
|
487
|
+
}
|
|
488
|
+
onCopy={copyWire}
|
|
489
|
+
onClear={() => setWire([])}
|
|
490
|
+
>
|
|
491
|
+
{visibleWire.map(f => (
|
|
492
|
+
<LogRow
|
|
493
|
+
key={f.seq}
|
|
494
|
+
time={f.ts}
|
|
495
|
+
badge={f.dir === 'send' ? '→' : '←'}
|
|
496
|
+
badgeClass={
|
|
497
|
+
f.dir === 'send'
|
|
498
|
+
? 'bg-blue-500/15 text-blue-600'
|
|
499
|
+
: 'bg-amber-500/15 text-amber-600'
|
|
500
|
+
}
|
|
501
|
+
label={frameLabel(f.frame)}
|
|
502
|
+
body={f.frame}
|
|
503
|
+
/>
|
|
504
|
+
))}
|
|
505
|
+
</Pane>
|
|
506
|
+
</div>
|
|
507
|
+
|
|
508
|
+
<div
|
|
509
|
+
className="w-1.5 shrink-0 cursor-col-resize touch-none rounded-full hover:bg-border active:bg-border"
|
|
510
|
+
onPointerDown={e => {
|
|
511
|
+
e.preventDefault()
|
|
512
|
+
e.currentTarget.setPointerCapture(e.pointerId)
|
|
513
|
+
}}
|
|
514
|
+
onPointerMove={e => {
|
|
515
|
+
if (!e.currentTarget.hasPointerCapture(e.pointerId) || !rowRef.current) return
|
|
516
|
+
const rect = rowRef.current.getBoundingClientRect()
|
|
517
|
+
const pct = ((e.clientX - rect.left) / rect.width) * 100
|
|
518
|
+
setLeftPct(Math.min(80, Math.max(20, pct)))
|
|
519
|
+
}}
|
|
520
|
+
/>
|
|
521
|
+
|
|
393
522
|
<Pane
|
|
394
|
-
title={
|
|
523
|
+
title={
|
|
524
|
+
<span className="flex items-center gap-1">
|
|
525
|
+
<button
|
|
526
|
+
type="button"
|
|
527
|
+
className={cn(
|
|
528
|
+
'rounded px-1.5 py-0.5 text-xs',
|
|
529
|
+
rightTab === 'frames' ? 'bg-muted font-medium' : 'text-muted-foreground'
|
|
530
|
+
)}
|
|
531
|
+
onClick={() => setRightTab('frames')}
|
|
532
|
+
>
|
|
533
|
+
Client frames
|
|
534
|
+
</button>
|
|
535
|
+
<button
|
|
536
|
+
type="button"
|
|
537
|
+
className={cn(
|
|
538
|
+
'rounded px-1.5 py-0.5 text-xs',
|
|
539
|
+
rightTab === 'events' ? 'bg-muted font-medium' : 'text-muted-foreground'
|
|
540
|
+
)}
|
|
541
|
+
onClick={() => setRightTab('events')}
|
|
542
|
+
>
|
|
543
|
+
Durable events
|
|
544
|
+
</button>
|
|
545
|
+
</span>
|
|
546
|
+
}
|
|
395
547
|
hint={
|
|
396
|
-
|
|
397
|
-
? '
|
|
398
|
-
:
|
|
399
|
-
? 'no wire tap for OpenClaw yet'
|
|
400
|
-
: 'raw Agent SDK messages + enqueued inputs'
|
|
548
|
+
rightTab === 'frames'
|
|
549
|
+
? 'what the browser receives on /ws'
|
|
550
|
+
: 'GET /sessions/:id/events replay'
|
|
401
551
|
}
|
|
402
|
-
|
|
552
|
+
onCopy={copyRight}
|
|
553
|
+
onClear={rightTab === 'frames' ? () => setClientFrames([]) : undefined}
|
|
403
554
|
>
|
|
404
|
-
{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
Fetch events
|
|
449
|
-
</Button>
|
|
450
|
-
</div>
|
|
451
|
-
{events?.map((ev, i) => (
|
|
452
|
-
<LogRow
|
|
453
|
-
key={i}
|
|
454
|
-
time={Date.now()}
|
|
455
|
-
badge="ev"
|
|
456
|
-
badgeClass="bg-teal-500/15 text-teal-600"
|
|
457
|
-
label={frameLabel(ev)}
|
|
458
|
-
body={ev}
|
|
459
|
-
/>
|
|
460
|
-
))}
|
|
461
|
-
{events?.length === 0 && (
|
|
462
|
-
<div className="p-2 text-[11px] text-muted-foreground">no events</div>
|
|
555
|
+
{rightTab === 'frames' ? (
|
|
556
|
+
<>
|
|
557
|
+
<div className="border-b border-border/40 px-2 py-1">
|
|
558
|
+
<label className="flex items-center gap-1 text-[10px] text-muted-foreground">
|
|
559
|
+
<input
|
|
560
|
+
type="checkbox"
|
|
561
|
+
checked={hidePreviews}
|
|
562
|
+
onChange={e => setHidePreviews(e.target.checked)}
|
|
563
|
+
/>
|
|
564
|
+
hide preview frames
|
|
565
|
+
</label>
|
|
566
|
+
</div>
|
|
567
|
+
{visibleClientFrames.map(f => (
|
|
568
|
+
<LogRow
|
|
569
|
+
key={f.seq}
|
|
570
|
+
time={f.ts}
|
|
571
|
+
badge="ws"
|
|
572
|
+
badgeClass="bg-purple-500/15 text-purple-600"
|
|
573
|
+
label={frameLabel(f.frame)}
|
|
574
|
+
body={f.frame}
|
|
575
|
+
/>
|
|
576
|
+
))}
|
|
577
|
+
</>
|
|
578
|
+
) : (
|
|
579
|
+
<>
|
|
580
|
+
<div className="border-b border-border/40 px-2 py-1">
|
|
581
|
+
<Button type="button" size="sm" variant="secondary" onClick={fetchEvents}>
|
|
582
|
+
Fetch events
|
|
583
|
+
</Button>
|
|
584
|
+
</div>
|
|
585
|
+
{events?.map((ev, i) => (
|
|
586
|
+
<LogRow
|
|
587
|
+
key={i}
|
|
588
|
+
time={Date.now()}
|
|
589
|
+
badge="ev"
|
|
590
|
+
badgeClass="bg-teal-500/15 text-teal-600"
|
|
591
|
+
label={frameLabel(ev)}
|
|
592
|
+
body={ev}
|
|
593
|
+
/>
|
|
594
|
+
))}
|
|
595
|
+
{events?.length === 0 && (
|
|
596
|
+
<div className="p-2 text-[11px] text-muted-foreground">no events</div>
|
|
597
|
+
)}
|
|
598
|
+
</>
|
|
463
599
|
)}
|
|
464
600
|
</Pane>
|
|
465
601
|
</div>
|
|
@@ -74,7 +74,7 @@ export function PixelPainter() {
|
|
|
74
74
|
)}
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
|
-
<pre className="rounded-
|
|
77
|
+
<pre className="rounded-lg border border-border bg-card px-3 py-2 text-center font-mono text-sm leading-snug text-card-foreground">
|
|
78
78
|
{ascii}
|
|
79
79
|
</pre>
|
|
80
80
|
|
|
@@ -24,7 +24,7 @@ type SegmentedProps<T extends string | number> = {
|
|
|
24
24
|
|
|
25
25
|
function Segmented<T extends string | number>({ options, value, onChange }: SegmentedProps<T>) {
|
|
26
26
|
return (
|
|
27
|
-
<div className="flex gap-1 rounded-
|
|
27
|
+
<div className="flex gap-1 rounded-xl bg-accent p-1">
|
|
28
28
|
{options.map(o => (
|
|
29
29
|
<Button
|
|
30
30
|
key={String(o.value)}
|
|
@@ -28,7 +28,7 @@ type SegmentedProps = {
|
|
|
28
28
|
|
|
29
29
|
function Segmented({ value, onChange }: SegmentedProps) {
|
|
30
30
|
return (
|
|
31
|
-
<div className="flex gap-1 rounded-
|
|
31
|
+
<div className="flex gap-1 rounded-xl bg-accent p-1">
|
|
32
32
|
{VARIANTS.map(o => (
|
|
33
33
|
<Button
|
|
34
34
|
key={o.value}
|
|
@@ -65,7 +65,7 @@ export function ToolCallsPage() {
|
|
|
65
65
|
|
|
66
66
|
<Segmented value={variant} onChange={setVariant} />
|
|
67
67
|
|
|
68
|
-
<div className="w-full max-w-
|
|
68
|
+
<div className="w-full max-w-(--column-w) rounded-xl border border-border bg-background p-5 font-sans text-foreground shadow-sm">
|
|
69
69
|
{/* `processing` only matters for the live variant — it turns the trailing
|
|
70
70
|
reasoning into "Thinking" and shows the live running tool spinning. */}
|
|
71
71
|
<ToolCallGroup
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
CollapsibleTrigger
|
|
19
19
|
} from '@/client/components/ui/collapsible'
|
|
20
20
|
import { cn } from '@/client/lib/cn'
|
|
21
|
+
import { getWorkspaceThemeStyle, usePreloadWorkspaceFonts } from '@/client/runtime/workspace-theme'
|
|
21
22
|
import { useUiStore } from '@/client/store/ui'
|
|
22
23
|
import {
|
|
23
24
|
WorkspaceAgentIcons,
|
|
@@ -29,6 +30,7 @@ import type { DiscoveredWorkspace, WorkspaceEntry } from '@/lib/types'
|
|
|
29
30
|
import { WorkspacePreview } from './WorkspacePreview'
|
|
30
31
|
|
|
31
32
|
export function HomePage() {
|
|
33
|
+
usePreloadWorkspaceFonts()
|
|
32
34
|
const [, navigate] = useLocation()
|
|
33
35
|
const workspacesQuery = useWorkspaces()
|
|
34
36
|
const discoveredQuery = useDiscoveredWorkspaces()
|
|
@@ -65,11 +67,11 @@ export function HomePage() {
|
|
|
65
67
|
|
|
66
68
|
return (
|
|
67
69
|
<div className="mx-auto w-full max-w-3xl px-8 pt-14 pb-16">
|
|
68
|
-
<HomeLogo className="mb-
|
|
70
|
+
<HomeLogo className="mb-10" />
|
|
69
71
|
|
|
70
72
|
{count > 0 ? (
|
|
71
|
-
<section className="mb-
|
|
72
|
-
<div className="mb-
|
|
73
|
+
<section className="mb-12">
|
|
74
|
+
<div className="mb-4 flex items-center justify-between gap-2">
|
|
73
75
|
<h1 className="text-sm font-medium text-foreground">My workspaces</h1>
|
|
74
76
|
<CreateWorkspaceDialog
|
|
75
77
|
trigger={
|
|
@@ -81,14 +83,14 @@ export function HomePage() {
|
|
|
81
83
|
/>
|
|
82
84
|
</div>
|
|
83
85
|
|
|
84
|
-
<div className="grid grid-cols-1 gap-
|
|
85
|
-
{workspaces.map(
|
|
86
|
-
<WorkspaceCard key={
|
|
86
|
+
<div className="grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2 md:grid-cols-3">
|
|
87
|
+
{workspaces.map(workspace => (
|
|
88
|
+
<WorkspaceCard key={workspace.id} workspace={workspace} />
|
|
87
89
|
))}
|
|
88
90
|
</div>
|
|
89
91
|
</section>
|
|
90
92
|
) : (
|
|
91
|
-
<div className="mb-10 flex flex-col items-center gap-4 px-8 pt-
|
|
93
|
+
<div className="mb-10 flex flex-col items-center gap-4 px-8 pt-8 pb-16 text-center">
|
|
92
94
|
<IconEggCracked size={32} stroke={1.5} className="text-muted-foreground" />
|
|
93
95
|
<div className="flex flex-col gap-1.5">
|
|
94
96
|
<h2 className="font-medium">Let’s start with creating your first workspace</h2>
|
|
@@ -158,20 +160,21 @@ type WorkspaceCardProps = {
|
|
|
158
160
|
function WorkspaceCard({ workspace }: WorkspaceCardProps) {
|
|
159
161
|
const name = workspaceDisplayName(workspace)
|
|
160
162
|
const previewQuery = useWorkspacePreview(workspace.id)
|
|
163
|
+
const theme = previewQuery.data?.theme
|
|
161
164
|
const updatedAt = previewQuery.data?.updatedAt ?? new Date(workspace.addedAt).getTime()
|
|
162
165
|
|
|
163
166
|
return (
|
|
164
|
-
<Link
|
|
165
|
-
href={`/workspace/${workspace.id}`}
|
|
166
|
-
className="group flex min-w-0 flex-col gap-4 rounded-xl bg-card p-2 shadow-xs transition-shadow hover:shadow-sm"
|
|
167
|
-
>
|
|
167
|
+
<Link href={`/workspace/${workspace.id}`} className="group flex min-w-0 flex-col gap-3">
|
|
168
168
|
<WorkspacePreview workspaceId={workspace.id} />
|
|
169
|
-
<div className="flex min-w-0 flex-col gap-2 px-2
|
|
170
|
-
<div
|
|
169
|
+
<div className="flex min-w-0 flex-col gap-2 px-2">
|
|
170
|
+
<div
|
|
171
|
+
className="flex min-w-0 items-center gap-1.5 font-sans"
|
|
172
|
+
style={getWorkspaceThemeStyle(theme)}
|
|
173
|
+
>
|
|
171
174
|
<img
|
|
172
175
|
src={workspace.icon ?? workspaceProviderIcon[workspace.type ?? 'claude-code']}
|
|
173
176
|
alt=""
|
|
174
|
-
className="size-4 shrink-0 rounded-
|
|
177
|
+
className="size-4 shrink-0 rounded-xs"
|
|
175
178
|
/>
|
|
176
179
|
<span className="truncate text-sm font-medium text-foreground">{name}</span>
|
|
177
180
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
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
5
|
|
|
5
6
|
import { useWorkspacePreview } from './api'
|
|
6
7
|
|
|
@@ -10,9 +11,9 @@ type WorkspacePreviewProps = {
|
|
|
10
11
|
|
|
11
12
|
const FOLDER = {
|
|
12
13
|
width: 320,
|
|
13
|
-
height:
|
|
14
|
-
radius:
|
|
15
|
-
topLeftRadius:
|
|
14
|
+
height: 180,
|
|
15
|
+
radius: 32,
|
|
16
|
+
topLeftRadius: 18,
|
|
16
17
|
bodyTop: 24,
|
|
17
18
|
tabEnd: 124,
|
|
18
19
|
shoulder: {
|
|
@@ -109,12 +110,14 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
109
110
|
const thumbnails = query.data ? [...query.data.thumbnails].reverse() : []
|
|
110
111
|
const slots = STACK.slice(STACK.length - thumbnails.length)
|
|
111
112
|
const firstUserMessage = query.data?.firstUserMessage
|
|
113
|
+
const theme = query.data?.theme
|
|
112
114
|
const { ref, horizontalRadiusScale } = useFolderRadiusScale()
|
|
113
115
|
const backdropPath = folderBackdropPath(horizontalRadiusScale)
|
|
114
116
|
const noiseFilterId = `folder-noise-${workspaceId}`
|
|
117
|
+
const themeStyle = getWorkspaceThemeStyle(theme)
|
|
115
118
|
|
|
116
119
|
return (
|
|
117
|
-
<div ref={ref} className="relative h-
|
|
120
|
+
<div ref={ref} style={themeStyle} className="relative h-45 w-full font-sans">
|
|
118
121
|
<svg
|
|
119
122
|
viewBox={`0 0 ${FOLDER.width} ${FOLDER.height}`}
|
|
120
123
|
preserveAspectRatio="none"
|
|
@@ -145,11 +148,7 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
145
148
|
<feBlend in="SourceGraphic" in2="clippedNoise" mode="soft-light" />
|
|
146
149
|
</filter>
|
|
147
150
|
</defs>
|
|
148
|
-
<path
|
|
149
|
-
d={backdropPath}
|
|
150
|
-
filter={`url(#${noiseFilterId})`}
|
|
151
|
-
className="mask-[linear-gradient(to_bottom,rgba(0,0,0,0.5),black_40%)] fill-accent"
|
|
152
|
-
/>
|
|
151
|
+
<path d={backdropPath} filter={`url(#${noiseFilterId})`} className="fill-accent" />
|
|
153
152
|
</svg>
|
|
154
153
|
|
|
155
154
|
{thumbnails.map((src, index) => (
|
|
@@ -159,7 +158,7 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
159
158
|
alt=""
|
|
160
159
|
loading="lazy"
|
|
161
160
|
className={cn(
|
|
162
|
-
'absolute top-[12%] left-[14%] aspect-4/3 w-[72%] rounded-
|
|
161
|
+
'absolute top-[12%] left-[14%] aspect-4/3 w-[72%] rounded-lg object-cover object-top shadow-xs',
|
|
163
162
|
'animate-in transition-transform duration-300 ease-out fade-in',
|
|
164
163
|
slots[index]
|
|
165
164
|
)}
|
|
@@ -167,11 +166,11 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
167
166
|
))}
|
|
168
167
|
|
|
169
168
|
{thumbnails.length === 0 && firstUserMessage && (
|
|
170
|
-
<div className="absolute inset-x-[12%] top-[
|
|
169
|
+
<div className="absolute inset-x-[12%] top-[22%] flex justify-end">
|
|
171
170
|
<div
|
|
172
171
|
aria-hidden="true"
|
|
173
172
|
className={cn(
|
|
174
|
-
'w-max max-w-40 origin-center rounded-
|
|
173
|
+
'w-max max-w-40 origin-center rounded-lg bg-card px-3 py-2 shadow-xs',
|
|
175
174
|
'animate-in transition-transform duration-300 ease-out fade-in',
|
|
176
175
|
STACK[STACK.length - 1],
|
|
177
176
|
'group-hover:translate-y-0.5 group-focus-visible:translate-y-0.5'
|
|
@@ -186,7 +185,7 @@ export function WorkspacePreview({ workspaceId }: WorkspacePreviewProps) {
|
|
|
186
185
|
|
|
187
186
|
<div
|
|
188
187
|
className={cn(
|
|
189
|
-
'absolute inset-x-2 top-[40%] bottom-2 rounded-
|
|
188
|
+
'absolute inset-x-2 top-[40%] bottom-2 rounded-2xl bg-[color-mix(in_oklch,var(--accent),var(--foreground)_5%)]',
|
|
190
189
|
'mask-[linear-gradient(to_bottom,rgba(0,0,0,0.9)_0%,black_50%)] backdrop-blur-lg',
|
|
191
190
|
'inset-shadow-[0_0_12px_color-mix(in_oklab,var(--background)_20%,transparent)]'
|
|
192
191
|
)}
|
|
@@ -2,6 +2,8 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|
|
2
2
|
|
|
3
3
|
import { jsonRequest, requestJson, requestVoid } from '@/client/api/http'
|
|
4
4
|
import { workspaceKeys } from '@/client/api/workspace-keys'
|
|
5
|
+
import { liveStore } from '@/client/features/chat/chat-store'
|
|
6
|
+
import { useUiStore } from '@/client/store/ui'
|
|
5
7
|
import type {
|
|
6
8
|
DiscoveredWorkspace,
|
|
7
9
|
HarnessAvailability,
|
|
@@ -16,7 +18,7 @@ export function upsertWorkspaceEntry(
|
|
|
16
18
|
): WorkspaceEntry[] {
|
|
17
19
|
const current = entries ?? []
|
|
18
20
|
const existing = current.findIndex(item => item.id === entry.id || item.path === entry.path)
|
|
19
|
-
if (existing === -1) return [...current
|
|
21
|
+
if (existing === -1) return [entry, ...current]
|
|
20
22
|
return current.map((item, index) => (index === existing ? { ...item, ...entry } : item))
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -50,6 +52,8 @@ export function useImportWorkspace() {
|
|
|
50
52
|
mutationFn: input =>
|
|
51
53
|
requestJson('/api/workspaces', jsonRequest('POST', input), 'Failed to add workspace'),
|
|
52
54
|
onSuccess: (entry, input) => {
|
|
55
|
+
liveStore.getState().setActive(entry.id, null)
|
|
56
|
+
useUiStore.getState().markWorkspacePendingAnalysis(entry.id)
|
|
53
57
|
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
54
58
|
upsertWorkspaceEntry(previous, entry)
|
|
55
59
|
)
|
|
@@ -109,10 +113,9 @@ export function useCreateWorkspace() {
|
|
|
109
113
|
'Failed to create workspace'
|
|
110
114
|
),
|
|
111
115
|
onSuccess: entry => {
|
|
112
|
-
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
])
|
|
116
|
+
queryClient.setQueryData<WorkspaceEntry[]>(workspaceKeys.all, previous =>
|
|
117
|
+
upsertWorkspaceEntry(previous, entry)
|
|
118
|
+
)
|
|
116
119
|
}
|
|
117
120
|
})
|
|
118
121
|
}
|
|
@@ -235,7 +235,7 @@ function ExistingFolderButton({ available, disabled, onClick }: ExistingFolderBu
|
|
|
235
235
|
<Tooltip>
|
|
236
236
|
<TooltipTrigger render={button} />
|
|
237
237
|
<TooltipContent>
|
|
238
|
-
Run <code className="rounded-
|
|
238
|
+
Run <code className="rounded-xs bg-accent px-1 py-0.5 font-mono">moi init</code> in the
|
|
239
239
|
folder to add it manually
|
|
240
240
|
</TooltipContent>
|
|
241
241
|
</Tooltip>
|