moi-computer 0.3.0-next.2 → 0.3.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 +1 -1
- package/client/AGENTS.md +2 -2
- package/client/api/http.ts +1 -1
- package/client/api/workspace-keys.ts +1 -0
- package/client/app/AppRouter.tsx +14 -5
- package/client/app/routes/HomeRoute.tsx +1 -1
- package/client/app/routes/WorkspaceRoute.tsx +8 -2
- package/client/app/shell/SidebarLayout.tsx +10 -5
- package/client/assets/openai.svg +3 -0
- package/client/components/shared/BottomPanel.tsx +2 -2
- package/client/components/ui/button.tsx +3 -2
- package/client/components/ui/input.tsx +1 -1
- package/client/features/applets/AppletMount.tsx +44 -0
- package/client/features/applets/WidgetShell.tsx +4 -1
- package/client/features/applets/applet-cache.ts +8 -0
- package/client/features/applets/applet-styles.ts +61 -0
- package/client/features/chat/ChatComposer.tsx +2 -2
- package/client/features/chat/ChatPanel.tsx +8 -25
- package/client/features/chat/ChatPopup.tsx +3 -3
- package/client/features/chat/{ThreadSelector.tsx → ChatSelector.tsx} +4 -4
- package/client/features/chat/TurnView.tsx +8 -9
- package/client/features/chat/api.ts +1 -1
- package/client/features/chat/chat-send.ts +57 -0
- package/client/features/chat/tool-group/ToolCallGroup.tsx +2 -1
- package/client/features/chat/tool-group/format.ts +117 -0
- package/client/features/chat/useChat.ts +10 -34
- package/client/features/connectors/McpMenu.tsx +4 -21
- package/client/features/dev/DevRoutes.tsx +18 -0
- package/client/features/dev/HarnessDebugPage.tsx +468 -0
- package/client/{components/playground → features/dev}/PlaygroundPage.tsx +1 -1
- package/client/features/home/CreateWorkspaceDialog.tsx +64 -158
- package/client/features/home/CreateWorkspaceDialogSteps.tsx +234 -0
- package/client/features/home/HomeLogo.tsx +344 -0
- package/client/features/home/HomePage.tsx +15 -21
- package/client/features/home/WorkspacePreview.tsx +12 -5
- package/client/features/home/api.ts +11 -3
- package/client/features/home/workspace-presentation.tsx +4 -4
- package/client/features/settings/GeneralSettings.tsx +3 -3
- package/client/features/settings/IconPicker.tsx +4 -3
- package/client/features/settings/icon-picker-options.ts +0 -131
- package/client/features/views/ViewBuilderTab.tsx +153 -0
- package/client/features/views/api.ts +124 -0
- package/client/features/views/useViewBuilderActions.ts +72 -0
- package/client/features/widgets/WidgetGrid.tsx +36 -20
- package/client/features/widgets/Widgets.tsx +140 -90
- package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -9
- package/client/features/workspace/WorkspaceScreen.tsx +179 -40
- package/client/features/workspace/WorkspaceTabs.tsx +4 -4
- package/client/index.css +0 -35
- package/client/index.html +1 -1
- package/client/lib/app-icon-registry.ts +145 -0
- package/client/runtime/useWorkspaceEvents.ts +3 -1
- package/client/theme.css +1 -1
- package/dist/chunk-4vf1t6v1.js +10 -0
- package/dist/chunk-4z52b2av.css +1 -0
- package/dist/chunk-6c8cwpzc.js +1 -0
- package/dist/chunk-b4b276wx.js +15 -0
- package/dist/{chunk-c4j722at.js → chunk-cs8vbert.js} +2 -2
- package/dist/chunk-fjksw6xf.js +1 -0
- package/dist/chunk-kxmvv1ax.js +48 -0
- package/dist/{chunk-p68fnz3q.js → chunk-vkvb3hjm.js} +1 -1
- package/dist/chunk-y82s1jxm.js +61 -0
- package/dist/chunk-zpxrb1ce.js +2 -0
- package/dist/index.html +2 -2
- package/dist/openai-h13pza4b.svg +3 -0
- package/lib/format.ts +2 -2
- package/lib/types.ts +38 -2
- package/lib/view-builder-meta.ts +35 -0
- package/lib/workspace-layout.ts +14 -0
- package/package.json +2 -1
- package/server/AGENTS.md +3 -3
- package/server/api.ts +165 -51
- package/server/applets.ts +1 -1
- package/server/bundle-queue.ts +19 -0
- package/server/bundler/applet-css.ts +50 -0
- package/server/{build-applet.ts → bundler/build-applet.ts} +36 -26
- package/server/cli.ts +79 -2
- package/server/control.ts +106 -8
- package/server/env-apply.ts +2 -2
- package/server/harness/README.md +228 -0
- package/server/harness/claude-code/NOTES.md +578 -0
- package/{lib/claude-adapter.ts → server/harness/claude-code/adapter.ts} +67 -5
- package/server/harness/claude-code/index.ts +124 -0
- package/server/{mcp.ts → harness/claude-code/mcp.ts} +1 -1
- package/server/{cc-session.ts → harness/claude-code/session.ts} +42 -14
- package/server/harness/claude-code/sessions.ts +42 -0
- package/server/harness/codex/NOTES.md +326 -0
- package/server/harness/codex/adapter.ts +414 -0
- package/server/harness/codex/client.ts +343 -0
- package/server/harness/codex/index.ts +68 -0
- package/server/harness/codex/probe.ts +186 -0
- package/server/harness/codex/session.ts +617 -0
- package/server/harness/debug.ts +57 -0
- package/server/harness/openclaw/NOTES.md +316 -0
- package/server/{openclaw-adapter.ts → harness/openclaw/adapter.ts} +2 -2
- package/server/harness/openclaw/index.ts +93 -0
- package/server/{openclaw-session.ts → harness/openclaw/session.ts} +44 -9
- package/server/{openclaw-strip.ts → harness/openclaw/strip.ts} +3 -1
- package/server/harness/registry.ts +36 -0
- package/server/harness/types.ts +87 -0
- package/server/layout.ts +6 -12
- package/server/moi-scaffold.ts +1 -1
- package/server/registry.ts +14 -52
- package/server/state.ts +5 -38
- package/server/status.ts +7 -46
- package/server/vendor.ts +1 -1
- package/server/view-builders.ts +428 -0
- package/server/views.ts +0 -0
- package/server/web.ts +18 -40
- package/server/workspace-init.ts +6 -6
- package/workspace/.claude/skills/moi-workspace/DESIGN.md +1 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +28 -7
- package/client/assets/hermes-nous.png +0 -0
- package/client/hooks/useScrollFade.ts +0 -38
- package/dist/chunk-23cgr1tz.css +0 -1
- package/dist/chunk-3hy3qy6d.js +0 -10
- package/dist/chunk-dyfaffyz.js +0 -119
- package/dist/chunk-kpe40hm8.js +0 -1
- package/dist/chunk-ty6dvda0.js +0 -1
- package/dist/hermes-nous-pznd63x9.png +0 -0
- /package/client/{components/playground → features/dev}/PixelPainter.tsx +0 -0
- /package/client/{components/playground → features/dev}/ToolCallsPage.tsx +0 -0
- /package/server/{agent.ts → harness/claude-code/models.ts} +0 -0
- /package/server/{openclaw.ts → harness/openclaw/discovery.ts} +0 -0
- /package/server/{openclaw-gateway.ts → harness/openclaw/gateway.ts} +0 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@/client/components/ui/button'
|
|
4
|
+
import { cn } from '@/client/lib/cn'
|
|
5
|
+
import { wsUrl } from '@/client/lib/ws-url'
|
|
6
|
+
import type { Model, WorkspaceEntry, WorkspaceModels } from '@/lib/types'
|
|
7
|
+
|
|
8
|
+
// Scratch route for driving any harness end to end: pick a workspace, fire
|
|
9
|
+
// canned scenarios (or your own prompt), and watch three synchronized logs —
|
|
10
|
+
// the backend's native wire (Codex: app-server JSON-RPC; Claude Code: raw SDK
|
|
11
|
+
// messages), the frames the server pushes to chat clients, and the durable
|
|
12
|
+
// events REST replay. See server/harness/README.md.
|
|
13
|
+
|
|
14
|
+
type WireFrame = { seq: number; ts: number; dir: 'send' | 'recv'; frame: unknown }
|
|
15
|
+
type BroadcastFrame = { seq: number; ts: number; frame: unknown }
|
|
16
|
+
type ProcessInfo = { running: boolean; pid?: number; binary: string | null }
|
|
17
|
+
|
|
18
|
+
type DebugPayload = {
|
|
19
|
+
provider: string
|
|
20
|
+
process: ProcessInfo | null
|
|
21
|
+
wire: WireFrame[]
|
|
22
|
+
broadcasts: BroadcastFrame[]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const SCENARIOS: { label: string; prompt: string }[] = [
|
|
26
|
+
{
|
|
27
|
+
label: 'Trivial',
|
|
28
|
+
prompt: 'Reply with exactly: pong'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: 'Reasoning',
|
|
32
|
+
prompt:
|
|
33
|
+
'Think carefully: a farmer has 17 sheep, all but 9 run away, then he buys twice as many as remain. How many sheep now? Reason it out before answering.'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Command',
|
|
37
|
+
prompt: 'Run `ls -la` and summarize what you see in one sentence.'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'File edit',
|
|
41
|
+
prompt: 'Create or overwrite scratch.txt with three random words, one per line.'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Plan',
|
|
45
|
+
prompt:
|
|
46
|
+
'Make a 3-step plan (use your plan tool) for adding a README to this folder, then execute it.'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: 'Subagent',
|
|
50
|
+
prompt:
|
|
51
|
+
'Spawn a subagent (collab/agent tool) to count the files in this directory and report back its answer.'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'Web search',
|
|
55
|
+
prompt: 'Search the web for the current Bun version and tell me what you find.'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: 'Slow (interrupt me)',
|
|
59
|
+
prompt: 'Run this exact command: sleep 30 && echo done. Nothing else.'
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
function shortJson(value: unknown, max = 110): string {
|
|
64
|
+
const s = JSON.stringify(value)
|
|
65
|
+
if (!s) return ''
|
|
66
|
+
return s.length > max ? s.slice(0, max) + '…' : s
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function frameLabel(frame: unknown): string {
|
|
70
|
+
const f = frame as Record<string, unknown>
|
|
71
|
+
if (typeof f?.method === 'string') {
|
|
72
|
+
return 'id' in f ? `${f.method} #${f.id}` : f.method
|
|
73
|
+
}
|
|
74
|
+
if ('id' in (f ?? {})) return `response #${f.id}`
|
|
75
|
+
if (typeof f?.kind === 'string') return `${f.kind}`
|
|
76
|
+
if (typeof f?.type === 'string') return `${f.type}`
|
|
77
|
+
return '?'
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function ts(t: number): string {
|
|
81
|
+
return (
|
|
82
|
+
new Date(t).toLocaleTimeString('en-GB', { hour12: false }) +
|
|
83
|
+
'.' +
|
|
84
|
+
String(t % 1000).padStart(3, '0')
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type LogRowProps = {
|
|
89
|
+
time: number
|
|
90
|
+
badge: string
|
|
91
|
+
badgeClass: string
|
|
92
|
+
label: string
|
|
93
|
+
body: unknown
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function LogRow({ time, badge, badgeClass, label, body }: LogRowProps) {
|
|
97
|
+
return (
|
|
98
|
+
<details className="group border-b border-border/40 px-2 py-1 text-[11px] leading-tight">
|
|
99
|
+
<summary className="flex cursor-pointer items-baseline gap-2 font-mono whitespace-nowrap">
|
|
100
|
+
<span className="text-muted-foreground/60 tabular-nums">{ts(time)}</span>
|
|
101
|
+
<span className={cn('rounded px-1 font-semibold', badgeClass)}>{badge}</span>
|
|
102
|
+
<span className="shrink-0 font-semibold">{label}</span>
|
|
103
|
+
<span className="truncate text-muted-foreground">{shortJson(body)}</span>
|
|
104
|
+
</summary>
|
|
105
|
+
<pre className="mt-1 max-h-80 overflow-auto rounded bg-muted p-2 text-[10px] whitespace-pre-wrap">
|
|
106
|
+
{JSON.stringify(body, null, 2)}
|
|
107
|
+
</pre>
|
|
108
|
+
</details>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type PaneProps = {
|
|
113
|
+
title: string
|
|
114
|
+
hint?: string
|
|
115
|
+
onClear?: () => void
|
|
116
|
+
children: React.ReactNode
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function Pane({ title, hint, onClear, children }: PaneProps) {
|
|
120
|
+
const scroller = useRef<HTMLDivElement>(null)
|
|
121
|
+
const [follow, setFollow] = useState(true)
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (follow && scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight
|
|
124
|
+
})
|
|
125
|
+
return (
|
|
126
|
+
<div className="flex min-h-0 flex-1 flex-col rounded-lg border border-border bg-background">
|
|
127
|
+
<div className="flex items-center gap-2 border-b border-border px-2 py-1">
|
|
128
|
+
<span className="text-xs font-semibold">{title}</span>
|
|
129
|
+
{hint && <span className="truncate text-[10px] text-muted-foreground">{hint}</span>}
|
|
130
|
+
<span className="grow" />
|
|
131
|
+
<label className="flex items-center gap-1 text-[10px] text-muted-foreground">
|
|
132
|
+
<input type="checkbox" checked={follow} onChange={e => setFollow(e.target.checked)} />
|
|
133
|
+
follow
|
|
134
|
+
</label>
|
|
135
|
+
{onClear && (
|
|
136
|
+
<Button type="button" variant="ghost" size="sm" onClick={onClear}>
|
|
137
|
+
Clear
|
|
138
|
+
</Button>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
<div ref={scroller} className="min-h-0 flex-1 overflow-y-auto">
|
|
142
|
+
{children}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function HarnessDebugPage() {
|
|
149
|
+
const [workspaces, setWorkspaces] = useState<WorkspaceEntry[]>([])
|
|
150
|
+
const [workspaceId, setWorkspaceId] = useState('')
|
|
151
|
+
const [models, setModels] = useState<Model[]>([])
|
|
152
|
+
const [model, setModel] = useState('')
|
|
153
|
+
const [effort, setEffort] = useState('')
|
|
154
|
+
const [stream, setStream] = useState(true)
|
|
155
|
+
const [sessionId, setSessionId] = useState<string>(() => crypto.randomUUID())
|
|
156
|
+
const [isNew, setIsNew] = useState(true)
|
|
157
|
+
const [prompt, setPrompt] = useState('')
|
|
158
|
+
const [proc, setProc] = useState<ProcessInfo | null>(null)
|
|
159
|
+
const [wire, setWire] = useState<WireFrame[]>([])
|
|
160
|
+
const [clientFrames, setClientFrames] = useState<BroadcastFrame[]>([])
|
|
161
|
+
const [events, setEvents] = useState<unknown[] | null>(null)
|
|
162
|
+
const [hidePreviews, setHidePreviews] = useState(false)
|
|
163
|
+
|
|
164
|
+
const wireCursor = useRef(0)
|
|
165
|
+
const wsRef = useRef<WebSocket | null>(null)
|
|
166
|
+
const localSeq = useRef(0)
|
|
167
|
+
const sessionRef = useRef(sessionId)
|
|
168
|
+
sessionRef.current = sessionId
|
|
169
|
+
|
|
170
|
+
// Every workspace is drivable — the panes adapt to its harness type.
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
fetch('/api/workspaces')
|
|
173
|
+
.then(r => r.json())
|
|
174
|
+
.then((list: WorkspaceEntry[]) => {
|
|
175
|
+
setWorkspaces(list)
|
|
176
|
+
setWorkspaceId(id => id || (list[0]?.id ?? ''))
|
|
177
|
+
})
|
|
178
|
+
.catch(() => {})
|
|
179
|
+
}, [])
|
|
180
|
+
|
|
181
|
+
const provider = workspaces.find(w => w.id === workspaceId)?.type ?? 'claude-code'
|
|
182
|
+
|
|
183
|
+
// Model list for the selected workspace.
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!workspaceId) return
|
|
186
|
+
fetch(`/api/workspaces/${workspaceId}/models`)
|
|
187
|
+
.then(r => r.json())
|
|
188
|
+
.then((m: WorkspaceModels) => setModels(m.models))
|
|
189
|
+
.catch(() => setModels([]))
|
|
190
|
+
}, [workspaceId])
|
|
191
|
+
|
|
192
|
+
// Switching workspace targets a different harness — the old thread id is
|
|
193
|
+
// meaningless there (a codex resume of a Claude session id just errors),
|
|
194
|
+
// so start a fresh thread.
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
setSessionId(crypto.randomUUID())
|
|
197
|
+
setIsNew(true)
|
|
198
|
+
setEvents(null)
|
|
199
|
+
}, [workspaceId])
|
|
200
|
+
|
|
201
|
+
// Poll the wire tap (the backend's native frames) once a second.
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (!workspaceId) return
|
|
204
|
+
wireCursor.current = 0
|
|
205
|
+
setWire([])
|
|
206
|
+
const timer = setInterval(async () => {
|
|
207
|
+
try {
|
|
208
|
+
const r = await fetch(
|
|
209
|
+
`/api/workspaces/${workspaceId}/harness/debug?sinceWire=${wireCursor.current}&sinceBroadcast=-1`
|
|
210
|
+
)
|
|
211
|
+
if (!r.ok) return
|
|
212
|
+
const d = (await r.json()) as DebugPayload
|
|
213
|
+
setProc(d.process)
|
|
214
|
+
if (d.wire.length) {
|
|
215
|
+
wireCursor.current = d.wire[d.wire.length - 1].seq
|
|
216
|
+
setWire(prev => [...prev, ...d.wire].slice(-1000))
|
|
217
|
+
}
|
|
218
|
+
} catch {}
|
|
219
|
+
}, 1000)
|
|
220
|
+
return () => clearInterval(timer)
|
|
221
|
+
}, [workspaceId])
|
|
222
|
+
|
|
223
|
+
// Live client frames: our own chat socket, same protocol as the real UI.
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
if (!workspaceId) return
|
|
226
|
+
const sock = new WebSocket(wsUrl('/ws'))
|
|
227
|
+
wsRef.current = sock
|
|
228
|
+
sock.onmessage = e => {
|
|
229
|
+
try {
|
|
230
|
+
const frame = JSON.parse(String(e.data)) as Record<string, unknown>
|
|
231
|
+
if (frame.workspaceId && frame.workspaceId !== workspaceId) return
|
|
232
|
+
if (frame.type === 'session_renamed' && frame.from === sessionRef.current) {
|
|
233
|
+
setSessionId(frame.to as string)
|
|
234
|
+
setIsNew(false)
|
|
235
|
+
}
|
|
236
|
+
setClientFrames(prev =>
|
|
237
|
+
[...prev, { seq: ++localSeq.current, ts: Date.now(), frame }].slice(-1000)
|
|
238
|
+
)
|
|
239
|
+
} catch {}
|
|
240
|
+
}
|
|
241
|
+
return () => {
|
|
242
|
+
wsRef.current = null
|
|
243
|
+
sock.close()
|
|
244
|
+
}
|
|
245
|
+
}, [workspaceId])
|
|
246
|
+
|
|
247
|
+
const send = useCallback(
|
|
248
|
+
(content: string) => {
|
|
249
|
+
if (!content.trim() || !wsRef.current || wsRef.current.readyState !== WebSocket.OPEN) return
|
|
250
|
+
wsRef.current.send(
|
|
251
|
+
JSON.stringify({
|
|
252
|
+
type: 'chat',
|
|
253
|
+
workspaceId,
|
|
254
|
+
sessionId: sessionRef.current,
|
|
255
|
+
isNew,
|
|
256
|
+
content,
|
|
257
|
+
optimisticId: crypto.randomUUID(),
|
|
258
|
+
...(model ? { model } : {}),
|
|
259
|
+
...(effort ? { effort } : {}),
|
|
260
|
+
stream
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
setIsNew(false)
|
|
264
|
+
},
|
|
265
|
+
[workspaceId, isNew, model, effort, stream]
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
const stop = useCallback(() => {
|
|
269
|
+
wsRef.current?.send(
|
|
270
|
+
JSON.stringify({ type: 'stop', workspaceId, sessionId: sessionRef.current })
|
|
271
|
+
)
|
|
272
|
+
}, [workspaceId])
|
|
273
|
+
|
|
274
|
+
const newThread = useCallback(() => {
|
|
275
|
+
setSessionId(crypto.randomUUID())
|
|
276
|
+
setIsNew(true)
|
|
277
|
+
setEvents(null)
|
|
278
|
+
}, [])
|
|
279
|
+
|
|
280
|
+
const fetchEvents = useCallback(async () => {
|
|
281
|
+
const r = await fetch(`/api/workspaces/${workspaceId}/sessions/${sessionRef.current}/events`)
|
|
282
|
+
setEvents(r.ok ? ((await r.json()) as unknown[]) : [])
|
|
283
|
+
}, [workspaceId])
|
|
284
|
+
|
|
285
|
+
const effortLevels = useMemo(
|
|
286
|
+
() => models.find(m => m.value === model)?.supportedEffortLevels ?? [],
|
|
287
|
+
[models, model]
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
const visibleClientFrames = useMemo(
|
|
291
|
+
() =>
|
|
292
|
+
hidePreviews
|
|
293
|
+
? clientFrames.filter(f => (f.frame as { type?: string }).type !== 'preview')
|
|
294
|
+
: clientFrames,
|
|
295
|
+
[clientFrames, hidePreviews]
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
return (
|
|
299
|
+
<div className="flex h-dvh flex-col gap-2 bg-muted p-2">
|
|
300
|
+
<div className="flex flex-wrap items-center gap-2 rounded-lg border border-border bg-background px-2 py-1.5 text-xs">
|
|
301
|
+
<span className="font-semibold tracking-widest text-muted-foreground uppercase">
|
|
302
|
+
Harness debug
|
|
303
|
+
</span>
|
|
304
|
+
<select
|
|
305
|
+
className="rounded border border-border bg-background px-1 py-0.5"
|
|
306
|
+
value={workspaceId}
|
|
307
|
+
onChange={e => setWorkspaceId(e.target.value)}
|
|
308
|
+
>
|
|
309
|
+
{workspaces.length === 0 && <option value="">no workspaces</option>}
|
|
310
|
+
{workspaces.map(w => (
|
|
311
|
+
<option key={w.id} value={w.id}>
|
|
312
|
+
{`${w.name ?? w.displayPath ?? w.path} · ${w.type ?? 'claude-code'}`}
|
|
313
|
+
</option>
|
|
314
|
+
))}
|
|
315
|
+
</select>
|
|
316
|
+
<select
|
|
317
|
+
className="rounded border border-border bg-background px-1 py-0.5"
|
|
318
|
+
value={model}
|
|
319
|
+
onChange={e => setModel(e.target.value)}
|
|
320
|
+
>
|
|
321
|
+
<option value="">default model</option>
|
|
322
|
+
{models.map(m => (
|
|
323
|
+
<option key={m.value} value={m.value}>
|
|
324
|
+
{m.displayName}
|
|
325
|
+
</option>
|
|
326
|
+
))}
|
|
327
|
+
</select>
|
|
328
|
+
<select
|
|
329
|
+
className="rounded border border-border bg-background px-1 py-0.5"
|
|
330
|
+
value={effort}
|
|
331
|
+
onChange={e => setEffort(e.target.value)}
|
|
332
|
+
>
|
|
333
|
+
<option value="">default effort</option>
|
|
334
|
+
{effortLevels.map(l => (
|
|
335
|
+
<option key={l} value={l}>
|
|
336
|
+
{l}
|
|
337
|
+
</option>
|
|
338
|
+
))}
|
|
339
|
+
</select>
|
|
340
|
+
<label className="flex items-center gap-1">
|
|
341
|
+
<input type="checkbox" checked={stream} onChange={e => setStream(e.target.checked)} />
|
|
342
|
+
stream
|
|
343
|
+
</label>
|
|
344
|
+
<span className="grow" />
|
|
345
|
+
{provider === 'codex' && (
|
|
346
|
+
<span
|
|
347
|
+
className={cn(
|
|
348
|
+
'rounded px-1.5 py-0.5 font-mono text-[10px]',
|
|
349
|
+
proc?.running ? 'bg-green-500/15 text-green-600' : 'bg-muted text-muted-foreground'
|
|
350
|
+
)}
|
|
351
|
+
>
|
|
352
|
+
{proc?.running ? `app-server pid ${proc.pid}` : 'app-server not running'}
|
|
353
|
+
</span>
|
|
354
|
+
)}
|
|
355
|
+
<span className="max-w-56 truncate font-mono text-[10px] text-muted-foreground">
|
|
356
|
+
thread {sessionId}
|
|
357
|
+
</span>
|
|
358
|
+
<Button type="button" size="sm" variant="outline" onClick={newThread}>
|
|
359
|
+
New thread
|
|
360
|
+
</Button>
|
|
361
|
+
<Button type="button" size="sm" variant="outline" onClick={stop}>
|
|
362
|
+
Stop
|
|
363
|
+
</Button>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<div className="flex flex-wrap items-center gap-1.5 rounded-lg border border-border bg-background px-2 py-1.5">
|
|
367
|
+
{SCENARIOS.map(s => (
|
|
368
|
+
<Button
|
|
369
|
+
key={s.label}
|
|
370
|
+
type="button"
|
|
371
|
+
size="sm"
|
|
372
|
+
variant="secondary"
|
|
373
|
+
onClick={() => send(s.prompt)}
|
|
374
|
+
>
|
|
375
|
+
{s.label}
|
|
376
|
+
</Button>
|
|
377
|
+
))}
|
|
378
|
+
<input
|
|
379
|
+
className="min-w-48 grow rounded border border-border bg-background px-2 py-1 text-xs"
|
|
380
|
+
placeholder="or type a custom prompt and hit Enter…"
|
|
381
|
+
value={prompt}
|
|
382
|
+
onChange={e => setPrompt(e.target.value)}
|
|
383
|
+
onKeyDown={e => {
|
|
384
|
+
if (e.key === 'Enter') {
|
|
385
|
+
send(prompt)
|
|
386
|
+
setPrompt('')
|
|
387
|
+
}
|
|
388
|
+
}}
|
|
389
|
+
/>
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<div className="flex min-h-0 flex-1 gap-2">
|
|
393
|
+
<Pane
|
|
394
|
+
title={provider === 'codex' ? 'App-server wire' : 'Harness wire'}
|
|
395
|
+
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'
|
|
401
|
+
}
|
|
402
|
+
onClear={() => setWire([])}
|
|
403
|
+
>
|
|
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>
|
|
463
|
+
)}
|
|
464
|
+
</Pane>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
)
|
|
468
|
+
}
|
|
@@ -7,7 +7,7 @@ import { PixelPainter } from './PixelPainter'
|
|
|
7
7
|
|
|
8
8
|
const SPRITES: { value: Sprite; label: string }[] = [
|
|
9
9
|
{ value: 'moi', label: 'M' },
|
|
10
|
-
{ value: 'moi-full', label: '
|
|
10
|
+
{ value: 'moi-full', label: 'moi' }
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
const EFFECTS: { value: Effect | 'none'; label: string }[] = [
|