moi-computer 0.3.1-next.1 → 0.4.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 CHANGED
@@ -2,36 +2,73 @@
2
2
  ██████████ ██████ ██
3
3
  ██░░██░░██ ██░░██ ██
4
4
  ██░░██░░██ ██████ ██
5
+
6
+ THE UI FOR YOUR AI
5
7
  ```
6
8
 
7
- A local workspace where AI agents build their own UI.
9
+ A visual workspace where your AI agents build their own UI.
8
10
  See [moi.computer](https://moi.computer) for what it is and how it works.
9
11
 
10
- Needs [Bun](https://bun.sh). The npm package is `moi-computer`, the command is `moi`:
12
+ Works with the harness you already use:
13
+
14
+ | [Claude Code](https://github.com/anthropics/claude-code) | [Codex](https://github.com/openai/codex) |
15
+ | :------------------------------------------------------- | :--------------------------------------- |
16
+ | [OpenClaw](https://github.com/openclaw/openclaw) | Hermes _(coming soon)_ |
17
+
18
+ # Quick start
19
+
20
+ Using Claude Code or Codex? Paste this prompt into an existing session and the
21
+ agent will set everything up for you:
22
+
23
+ ```
24
+ Set up the moi workspace for this project. Fetch https://moi.computer/CC-INSTALL.md, and follow the steps.
25
+ ```
26
+
27
+ For OpenClaw or a manual setup, read on.
28
+
29
+ ## Manual install
30
+
31
+ Make sure [Bun](https://bun.sh) is installed. moi uses it to run the web server and bundle the dynamic UI.
32
+
33
+ Install the `moi-computer` package from npm and start the web UI:
11
34
 
12
35
  ```sh
13
36
  bun i -g moi-computer
14
37
  moi start # http://localhost:13337
15
38
  ```
16
39
 
17
- Or paste this into Claude Code and it will set everything up for you:
40
+ Then bring in your project, either way works:
41
+
42
+ - open [http://localhost:13337](http://localhost:13337) and create a workspace
43
+ (or import an existing folder) right from the web UI;
44
+ - or run `moi init` inside a folder to turn it into a workspace.
45
+
46
+ ## OpenClaw
47
+
48
+ In OpenClaw, moi is installed per _agent workspace_. First, list the agents
49
+ you have:
18
50
 
19
51
  ```
20
- Set up the moi workspace for this project. Fetch https://moi.computer/CC-INSTALL.md, and follow the steps.
52
+ > openclaw agents
53
+
54
+ 🦞 OpenClaw 2026.7.1
55
+
56
+ Agents:
57
+ - main (default) <-- the agent name you'll pass to moi
58
+ Identity: Assistant (IDENTITY.md)
59
+ Workspace: ~/.openclaw/workspace
60
+ Agent dir: ~/.openclaw/agents/main/agent
61
+ Model: openai/gpt-5.6-sol
21
62
  ```
22
63
 
23
- Hacking on it:
64
+ Then install the moi skill into an agent's workspace and start the web UI:
24
65
 
25
66
  ```sh
26
- bun install
27
- bun run dev
67
+ moi openclaw init <agent-name>
68
+ moi start
28
69
  ```
29
70
 
30
- ## OpenClaw (experimental)
31
-
32
- moi also works with OpenClaw agents — `moi openclaw init` installs the moi
33
- skills into an OpenClaw agent workspace. Integration notes live in
34
- [server/harness/openclaw/NOTES.md](server/harness/openclaw/NOTES.md).
71
+ Your agent's workspace will show up at `http://localhost:13337`.
35
72
 
36
73
  ## No crypto token
37
74
 
@@ -173,6 +173,15 @@ function codexExecAction(input: unknown): CodexCommandAction | null {
173
173
  return first
174
174
  }
175
175
 
176
+ // Codex collab tool actions (`input.action` on the `subagent` card). `wait`
177
+ // never reaches the UI — the adapter drops it.
178
+ const CODEX_SUBAGENT_ACTION_LABELS: Record<string, string> = {
179
+ spawn_agent: 'Run sub-agent',
180
+ send_input: 'Message the agent',
181
+ resume_agent: 'Resume the agent',
182
+ close_agent: 'Stopping the agent'
183
+ }
184
+
176
185
  export function getToolDisplayName(call: ToolCall): string {
177
186
  if (call.provider === 'openclaw') return OPENCLAW_TOOL_LABELS[call.name] ?? call.name
178
187
  if (call.provider === 'codex') {
@@ -180,6 +189,12 @@ export function getToolDisplayName(call: ToolCall): string {
180
189
  const action = codexExecAction(call.input)
181
190
  if (action?.type) return CODEX_ACTION_LABELS[action.type]
182
191
  }
192
+ if (call.name === 'subagent') {
193
+ const action = (call.input as { action?: unknown } | null)?.action
194
+ if (typeof action === 'string' && action in CODEX_SUBAGENT_ACTION_LABELS) {
195
+ return CODEX_SUBAGENT_ACTION_LABELS[action]
196
+ }
197
+ }
183
198
  return CODEX_TOOL_LABELS[call.name] ?? call.name
184
199
  }
185
200
  return CLAUDE_TOOL_LABELS[call.name] ?? call.name
@@ -244,7 +259,13 @@ function formatCodexBrief(
244
259
  const plan = input.plan
245
260
  return typeof plan === 'string' ? plan.split('\n')[0] : ''
246
261
  }
247
- if (tool === 'subagent') return getInputValue(input, 'prompt') || getInputValue(input, 'action')
262
+ if (tool === 'subagent') {
263
+ // The label already names the action; the brief carries the text being
264
+ // sent (spawn prompt, send_input/resume_agent message). close_agent has
265
+ // none — the label alone reads fine.
266
+ if (getInputValue(input, 'action') === 'close_agent') return ''
267
+ return getInputValue(input, 'prompt')
268
+ }
248
269
  if (tool === 'subagent_activity') return getInputValue(input, 'kind')
249
270
  if (tool === 'generate_image') return getInputValue(input, 'prompt').split('\n')[0]
250
271
  if (tool === 'read_mcp_resource') return getInputValue(input, 'uri')
@@ -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'
@@ -110,28 +113,54 @@ function LogRow({ time, badge, badgeClass, label, body }: LogRowProps) {
110
113
  }
111
114
 
112
115
  type PaneProps = {
113
- title: string
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-lg border border-border bg-background">
138
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col rounded-lg 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
- const [workspaceId, setWorkspaceId] = useState('')
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
- setWorkspaceId(id => id || (list[0]?.id ?? ''))
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,6 +353,24 @@ 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
376
  <div className="flex flex-wrap items-center gap-2 rounded-lg border border-border bg-background px-2 py-1.5 text-xs">
@@ -304,7 +380,7 @@ export function HarnessDebugPage() {
304
380
  <select
305
381
  className="rounded border border-border bg-background px-1 py-0.5"
306
382
  value={workspaceId}
307
- onChange={e => setWorkspaceId(e.target.value)}
383
+ onChange={e => selectWorkspace(e.target.value)}
308
384
  >
309
385
  {workspaces.length === 0 && <option value="">no workspaces</option>}
310
386
  {workspaces.map(w => (
@@ -389,77 +465,137 @@ export function HarnessDebugPage() {
389
465
  />
390
466
  </div>
391
467
 
392
- <div className="flex min-h-0 flex-1 gap-2">
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={provider === 'codex' ? 'App-server wire' : 'Harness wire'}
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
- provider === 'codex'
397
- ? 'raw JSON-RPC, both directions'
398
- : provider === 'openclaw'
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
- onClear={() => setWire([])}
552
+ onCopy={copyRight}
553
+ onClear={rightTab === 'frames' ? () => setClientFrames([]) : undefined}
403
554
  >
404
- {wire.map(f => (
405
- <LogRow
406
- key={f.seq}
407
- time={f.ts}
408
- badge={f.dir === 'send' ? '→' : '←'}
409
- badgeClass={
410
- f.dir === 'send' ? 'bg-blue-500/15 text-blue-600' : 'bg-amber-500/15 text-amber-600'
411
- }
412
- label={frameLabel(f.frame)}
413
- body={f.frame}
414
- />
415
- ))}
416
- </Pane>
417
-
418
- <Pane
419
- title="Client frames"
420
- hint="what the browser receives on /ws"
421
- onClear={() => setClientFrames([])}
422
- >
423
- <div className="border-b border-border/40 px-2 py-1">
424
- <label className="flex items-center gap-1 text-[10px] text-muted-foreground">
425
- <input
426
- type="checkbox"
427
- checked={hidePreviews}
428
- onChange={e => setHidePreviews(e.target.checked)}
429
- />
430
- hide preview frames
431
- </label>
432
- </div>
433
- {visibleClientFrames.map(f => (
434
- <LogRow
435
- key={f.seq}
436
- time={f.ts}
437
- badge="ws"
438
- badgeClass="bg-purple-500/15 text-purple-600"
439
- label={frameLabel(f.frame)}
440
- body={f.frame}
441
- />
442
- ))}
443
- </Pane>
444
-
445
- <Pane title="Durable events" hint="GET /sessions/:id/events replay">
446
- <div className="border-b border-border/40 px-2 py-1">
447
- <Button type="button" size="sm" variant="secondary" onClick={fetchEvents}>
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>
package/client/main.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
2
2
  import { Agentation } from 'agentation'
3
3
  import { createRoot } from 'react-dom/client'
4
- import { Router } from 'wouter'
4
+ import { Router, useRoute } from 'wouter'
5
5
 
6
6
  import { TooltipProvider } from '@/client/components/ui/tooltip'
7
7
  import { installAppletErrorHook } from '@/client/features/applets/applet-log'
@@ -10,6 +10,14 @@ import { AppRouter } from './app/AppRouter'
10
10
 
11
11
  const queryClient = new QueryClient()
12
12
 
13
+ // Agentation has no built-in route filter (checked v2.3.3 props), so gate the
14
+ // mount ourselves: the harness debug page is a raw log surface where the
15
+ // annotation toolbar just overlaps the panes.
16
+ function DevAgentation() {
17
+ const [onHarnessDebug] = useRoute('/dev/harness')
18
+ return onHarnessDebug ? null : <Agentation />
19
+ }
20
+
13
21
  // Open the single app-wide chat WebSocket once and hand it the query client so
14
22
  // live frames fold into the RQ transcript cache. Lives for the page's lifetime.
15
23
  initConnection(queryClient)
@@ -27,7 +35,7 @@ export function mount(el: HTMLElement) {
27
35
  <Router>
28
36
  <AppRouter />
29
37
  </Router>
30
- {process.env.NODE_ENV === 'development' && <Agentation />}
38
+ {process.env.NODE_ENV === 'development' && <DevAgentation />}
31
39
  </TooltipProvider>
32
40
  </QueryClientProvider>
33
41
  )