The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Keep the daemon-level DSH checks in the repo; record what the first full run found
dee795b78e22899
diff --git a/docs/plans/2026-09-14-003-domain-specific-harness-mvp-plan.md b/docs/plans/2026-09-14-003-domain-specific-harness-mvp-plan.mdindex 822d959d6..571056f44 100644--- a/docs/plans/2026-09-14-003-domain-specific-harness-mvp-plan.md+++ b/docs/plans/2026-09-14-003-domain-specific-harness-mvp-plan.md@@ -205,3 +205,31 @@ Done on 2026-09-14, on this Mac:Still to see with eyes: the desktop's Create Harness → Circuit → prompt → board-in-pane loop, andthe WKWebView pane on both the Skia and Impeller builds. The app was built and launched from theworktree, but the screen was locked for the session that would have clicked through it.++## What the first full run found (2026-09-15, overnight)++All three harnesses ran end to end in the app on this Mac, driven by computer use: Circuit to a+fab-ready board, Marp to a ten-slide deck, Workshop to a printable phone stand, each in a tab of its+own with the viewer left, the terminal right, the chip and the phase strip moving in the viewer's+header. Fixed on the way: WKWebView's missing background-colour call on macOS (a red pane), the+harness tab's target when the dialog passes the current tab, the strip gated on a non-compact+header, the search preview drawing the base engine. Left for a decision:++- **Remote machines.** The viewer is a loopback server where the agent runs; the webview loads+ `127.0.0.1`. A remote harness needs the daemon to forward that port through the relay — an HTTP+ (plus SSE/WebSocket) tunnel over the machine WS, terminated by a local proxy in the app. Not+ started; the MVP is local-only by construction.+- **Daemon restart with the app open.** Once, the previous app instance dropped the three harness+ agents' panes when the daemon restarted (the user's own agents survived); a second restart kept+ them but added the last-selected harness agent to the active tab as a second pane. Both look like+ main's offline auto-reattach (`pendingOfflineAgentId`) meeting multi-tab; not touched here.+- **Circuit's vendored runtime.** `skills/circuitcode/scripts/packages/circuitpy` is an untracked+ copy refreshed by `scripts/build/build-skill-runtimes.sh`; a linked checkout goes stale after a+ rebase until it is rerun (the agent hit missing `repair.checkpoint`). `setup.sh` runs it, so a+ git-URL install is fine; `harness dsh install --link` could run setup on every daemon start.+- **Clickable phases.** A done phase with an artifact could swap the viewer to it; the URL+ template lives in the daemon, so it is a `dsh_view { agentId, artifact }` request, not a desktop+ change alone.+- **Marp's repo** is local only (`/Users/ab/code/autonomous-marp`, branch `harness-dsh`); the+ registry entry names `github.com/autonomous-ai/autonomous-marp`, which must exist before a+ git-URL install can work.diff --git a/dsh/tools/README.md b/dsh/tools/README.mdnew file mode 100644index 000000000..67a13cdb8--- /dev/null+++ b/dsh/tools/README.md@@ -0,0 +1,13 @@+# DSH tools++Daemon-level checks over the same loopback WebSocket the desktop uses (`ws://127.0.0.1:18473/api/local-ws`).+They need a running daemon with the harness installed on this machine, and `cli/node_modules` (for `ws`).++```sh+node dsh/tools/dsh-e2e.mjs <machineId> <dshId> <engine> <workspace> [--keep] [--restart] [--bypass] [--no-verdict]+ # create → materialize → viewer up → HARNESS_DSH on the pane → (verdict) → delete+node dsh/tools/dsh-discover.mjs ... # a pane started by hand with HARNESS_DSH is discovered as its harness+node dsh/tools/dsh-delete.mjs <agentId> <machineId>+```++`<machineId>` is this machine's id from `harness status` / `~/.harness/cli/data/machines.json`.diff --git a/dsh/tools/dsh-delete.mjs b/dsh/tools/dsh-delete.mjsnew file mode 100644index 000000000..5c9c79861--- /dev/null+++ b/dsh/tools/dsh-delete.mjs@@ -0,0 +1,16 @@+// Delete an agent over the daemon's loopback WebSocket. Usage: node dsh-delete.mjs <agentId>+import ws_ from '../../cli/node_modules/ws/index.js'+const { WebSocket } = ws_+const [agentId] = process.argv.slice(2)+const machineId = process.argv[3] ?? (() => { console.error('usage: node dsh-delete.mjs <agentId> <machineId>'); process.exit(2) })()+const ws = new WebSocket('ws://127.0.0.1:18473/api/local-ws')+ws.on('open', () => {+ ws.send(JSON.stringify({ type: 'machine_select', payload: { machineId, localProtocolVersion: 1 } }))+ ws.once('message', (raw) => {+ const f = JSON.parse(raw.toString()); console.log('handshake', f.type)+ ws.send(JSON.stringify({ type: 'agent_delete', payload: { agentId } }))+ setTimeout(() => { ws.close(); process.exit(0) }, 4000)+ })+})+ws.on('message', (raw) => { const f = JSON.parse(raw.toString()); if (f.type === 'agent_deleted' || f.type === 'agent_delete_result') console.log(f.type, JSON.stringify(f.payload).slice(0, 120)) })+ws.on('error', (e) => { console.error(e.message); process.exit(1) })diff --git a/dsh/tools/dsh-discover.mjs b/dsh/tools/dsh-discover.mjsnew file mode 100644index 000000000..ca317c532--- /dev/null+++ b/dsh/tools/dsh-discover.mjs@@ -0,0 +1,33 @@+// Does the daemon label a pane it did NOT create, from HARNESS_DSH alone? Polls agents_list.+import ws_ from '../../cli/node_modules/ws/index.js'+const { WebSocket } = ws_+import { randomBytes } from 'node:crypto'+const [machineId, workspace, action] = process.argv.slice(2)+const ws = new WebSocket('ws://127.0.0.1:18473/api/local-ws')+const pending = new Map()+const send = (type, payload) => ws.send(JSON.stringify({ type, payload }))+const request = (type, payload = {}) => new Promise((resolve, reject) => {+ const requestId = randomBytes(8).toString('hex')+ const timer = setTimeout(() => reject(new Error(`${type} timed out`)), 20000)+ pending.set(requestId, (p) => { clearTimeout(timer); resolve(p) })+ send(type, { requestId, ...payload })+})+ws.on('message', (raw) => {+ const f = JSON.parse(raw.toString())+ if (f.type?.endsWith('_result') && pending.has(f.payload?.requestId)) { pending.get(f.payload.requestId)(f.payload); pending.delete(f.payload.requestId) }+})+ws.on('open', async () => {+ send('machine_select', { machineId, localProtocolVersion: 1 })+ await new Promise((r) => setTimeout(r, 300))+ const deadline = Date.now() + 40000+ let hit = null+ while (Date.now() < deadline) {+ const list = await request('agents_list')+ hit = (list.agents ?? []).find((a) => a.project?.directory === workspace || a.project?.cwd === workspace || JSON.stringify(a).includes(workspace))+ if (hit && (action === 'find' ? hit.dsh && hit.viewerUrl : true)) break+ await new Promise((r) => setTimeout(r, 1000))+ }+ console.log(hit ? JSON.stringify({ id: hit.id, engine: hit.engine, dsh: hit.dsh, dshName: hit.dshName, viewerUrl: hit.viewerUrl, verdict: hit.verdict, launch: hit.launch, tmuxPane: hit.tmuxPane }) : 'NOT FOUND')+ if (hit && action === 'delete') { send('agent_delete', { agentId: hit.id }); await new Promise((r) => setTimeout(r, 3000)); console.log('deleted') }+ ws.close(); process.exit(hit ? 0 : 1)+})diff --git a/dsh/tools/dsh-e2e.mjs b/dsh/tools/dsh-e2e.mjsnew file mode 100644index 000000000..001efff27--- /dev/null+++ b/dsh/tools/dsh-e2e.mjs@@ -0,0 +1,120 @@+// Daemon-level end-to-end check for a DSH agent, over the same loopback WebSocket the desktop uses.+// Usage: node dsh-e2e.mjs <machineId> <dshId> <engine> <workspace> [--keep]+import ws_ from '../../cli/node_modules/ws/index.js'+const { WebSocket } = ws_+import { randomBytes } from 'node:crypto'+import { execFileSync } from 'node:child_process'++const [machineId, dshId, engine, workspace] = process.argv.slice(2)+const keep = process.argv.includes('--keep')+if (!machineId || !dshId || !engine || !workspace) {+ console.error('usage: node dsh-e2e.mjs <machineId> <dshId> <engine> <workspace> [--keep]')+ process.exit(2)+}++const ws = new WebSocket('ws://127.0.0.1:18473/api/local-ws')+const pending = new Map()+const agentFrames = []+let agentId = null++const send = (type, payload) => ws.send(JSON.stringify({ type, payload }))+const request = (type, payload, timeoutMs = 20_000) => new Promise((resolve, reject) => {+ const requestId = randomBytes(8).toString('hex')+ const timer = setTimeout(() => { pending.delete(requestId); reject(new Error(`${type} timed out`)) }, timeoutMs)+ pending.set(requestId, (p) => { clearTimeout(timer); resolve(p) })+ send(type, { requestId, ...payload })+})+const waitFor = (label, predicate, timeoutMs) => new Promise((resolve, reject) => {+ const started = Date.now()+ const tick = () => {+ const hit = agentFrames.find(predicate)+ if (hit) return resolve(hit)+ if (Date.now() - started > timeoutMs) return reject(new Error(`timed out waiting for ${label}`))+ setTimeout(tick, 250)+ }+ tick()+})+const log = (...args) => console.log(new Date().toISOString().slice(11, 19), ...args)++ws.on('message', (raw) => {+ let frame+ try { frame = JSON.parse(raw.toString()) } catch { return }+ const { type, payload } = frame+ if (type?.endsWith('_result') && payload?.requestId && pending.has(payload.requestId)) {+ pending.get(payload.requestId)(payload); pending.delete(payload.requestId); return+ }+ if (type === 'agent_synced' && payload?.agent) {+ const a = payload.agent+ if (agentId && a.id !== agentId) return+ agentFrames.push(a)+ log(`agent_synced · ${a.id.slice(0, 8)} · engine=${a.engine} dsh=${a.dsh} dshName=${a.dshName} launch=${a.launch?.state} viewerUrl=${a.viewerUrl} verdict=${a.verdict ? JSON.stringify(a.verdict) : null}`)+ }+})++ws.on('open', async () => {+ try {+ send('machine_select', { machineId, localProtocolVersion: 1 })+ await new Promise((resolve, reject) => {+ const t = setTimeout(() => reject(new Error('no connected frame')), 5000)+ ws.once('message', (raw) => { clearTimeout(t); const f = JSON.parse(raw.toString()); log('handshake:', f.type, JSON.stringify(f.payload)); f.type === 'connected' ? resolve() : reject(new Error(`handshake ${f.type}`)) })+ })++ const list = await request('dsh_list', {})+ log('dsh_list:', JSON.stringify(list.dsh))+ const entry = (list.dsh ?? []).find((d) => d.id === dshId)+ if (!entry?.installed) throw new Error(`${dshId} not installed on this machine`)++ const creationId = randomBytes(12).toString('hex')+ const created = await request('agent_create', { engine, cwd: workspace, dsh: dshId, creationId, bypassPermission: process.argv.includes('--bypass') }, 60_000)+ log('agent_create_result:', JSON.stringify({ state: created.state, error: created.error, failure: created.failure, agent: created.agent && { id: created.agent.id, dsh: created.agent.dsh, dshName: created.agent.dshName, viewerUrl: created.agent.viewerUrl, launch: created.agent.launch } }))+ if (created.state !== 'created') throw new Error('create did not succeed')+ agentId = created.agent.id+ agentFrames.push(created.agent)++ const withViewer = await waitFor('viewerUrl', (a) => a.id === agentId && a.viewerUrl, 90_000)+ log('viewer url:', withViewer.viewerUrl)+ const status = execFileSync('curl', ['-s', '-o', '/dev/null', '-w', '%{http_code} %{content_type}', withViewer.viewerUrl]).toString()+ log('viewer GET /:', status)++ const ready = await waitFor('launch ready', (a) => a.id === agentId && a.launch?.state === 'ready', 120_000)+ log('launch ready; pane:', ready.tmuxPane)+ // The engine process must carry the DSH marker in its environment.+ const env = execFileSync('sh', ['-c', `ps eww -o command= -p $(tmux list-panes -a -F '#{pane_id} #{pane_pid}' | awk -v p='${ready.tmuxPane}' '$1==p{print $2}') | tr ' ' '\\n' | grep -E '^HARNESS_(DSH|WORKSPACE)=' | sort -u`]).toString().trim()+ log('pane shell env:', env.replace(/\n/g, ' · ') || '(none on the shell; engine child may hold it)')++ if (process.argv.includes('--restart')) {+ log('restarting agent in place')+ const restarted = await request('agent_restart', { agentId }, 120_000)+ log('agent_restart_result:', JSON.stringify({ error: restarted.error, resumed: restarted.resumed, agent: restarted.agent && { dsh: restarted.agent.dsh, viewerUrl: restarted.agent.viewerUrl, launch: restarted.agent.launch } }))+ if (restarted.error) throw new Error(`restart failed: ${restarted.error}`)+ await new Promise((r) => setTimeout(r, 2500))+ const env2 = execFileSync('sh', ['-c', `ps eww -o command= -p $(tmux list-panes -a -F '#{pane_id} #{pane_pid}' | awk -v p='${ready.tmuxPane}' '$1==p{print $2}') | tr ' ' '\\n' | grep -E '^HARNESS_(DSH|WORKSPACE)=' | sort -u`]).toString().trim()+ log('pane shell env after restart:', env2.replace(/\n/g, ' · ') || '(none)')+ if (!env2.includes('HARNESS_DSH=')) throw new Error('HARNESS_DSH lost on restart')+ const latest = agentFrames.filter((a) => a.id === agentId).at(-1)+ log('latest frame after restart:', JSON.stringify({ dsh: latest?.dsh, viewerUrl: latest?.viewerUrl, launch: latest?.launch }))+ }+ if (process.argv.includes('--no-verdict')) {+ if (!keep) { log('deleting agent'); send('agent_delete', { agentId }); await new Promise((r) => setTimeout(r, 4000)) }+ log('done'); ws.close(); process.exit(0)+ }++ console.log('\nNow run the DSH pipeline in the workspace to produce a verdict; waiting up to 15 minutes for a verdict frame…')+ const withVerdict = await waitFor('verdict', (a) => a.id === agentId && a.verdict, 15 * 60_000)+ log('verdict:', JSON.stringify(withVerdict.verdict))++ if (!keep) {+ log('deleting agent')+ send('agent_delete', { agentId })+ await new Promise((r) => setTimeout(r, 4000))+ }+ log('done')+ ws.close()+ process.exit(0)+ } catch (error) {+ log('FAILED:', error.message)+ ws.close()+ process.exit(1)+ }+})+ws.on('error', (e) => { log('ws error', e.message); process.exit(1) })