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
harness new works without signing in, as the app does (#1183)
Dee81c401015f04
diff --git a/cli/e2e/agentClient.e2e.ts b/cli/e2e/agentClient.e2e.tsindex 1544c1ae8..5b3b7193f 100644--- a/cli/e2e/agentClient.e2e.ts+++ b/cli/e2e/agentClient.e2e.ts@@ -118,4 +118,29 @@ describe('Harness for agents, end to end', () => {expect(JSON.parse(after.out).harnesses).toEqual(expect.arrayContaining([expect.objectContaining({ name: 'kid', state: 'stopped', startedBy: 'you' })]))client.close()})++ it('signed out, the person starts, waits for, reads and closes a harness from a terminal', async () => {+ // Never signed in: the daemon runs as this computer (core/main.ts), and the app made harnesses while `harness new`+ // refused with "This computer is not signed in to Harness".+ const d = await IsolatedDaemon.create()+ daemon = d+ onTestFailed(() => { console.log(`---- daemon log\n${d.log().split('\n').slice(-150).join('\n')}`) })+ await d.start()+ const dir = join(d.projectsDir, 'solo')+ mkdirSync(dir, { recursive: true })+ const run = (...args: string[]) => harness(d, '', args)++ const started = await run('new', 'claude', dir, '--name', 'solo', '--', 'hello solo')+ expect(started.code, started.out + started.err).toBe(0)+ expect(started.out).toContain('Created solo on this computer')+ const waited = await run('wait', 'solo', '--timeout', '2m')+ expect(waited.code, waited.out + waited.err).toBe(0)+ const shown = await run('show', 'solo')+ expect(shown.code, shown.err).toBe(0)+ expect(shown.out).toContain('hello solo')+ // The person's task, as they typed it: no header.+ expect(shown.out).not.toContain('[from')+ const closed = await run('close', 'solo')+ expect(closed.code, closed.err).toBe(0)+ })})diff --git a/cli/src/agentClient/daemon.ts b/cli/src/agentClient/daemon.tsindex c212ef52c..d9ff1fcfc 100644--- a/cli/src/agentClient/daemon.ts+++ b/cli/src/agentClient/daemon.ts@@ -6,10 +6,11 @@* the paired relay (`machine_select` naming it).*/import { randomUUID } from 'node:crypto'-import { existsSync, readFileSync } from 'node:fs'+import { existsSync } from 'node:fs'import { WebSocket } from 'ws'import { env } from '../config/env.js'import { readAuthSession } from '../lib/authSession.js'+import { computerId } from '../lib/daemonState.js'import { localSocketPath } from '../lib/localSocket.js'import { paneOwner } from '../messages/command.js'@@ -48,8 +49,9 @@ export type Connect = (where: Where) => ClientSocket/** The daemon that made [pane], else the one this CLI's settings name. */export function whereFor(pane: string | undefined, owner: typeof paneOwner = paneOwner): Where {const found = pane ? owner(pane) : null- let machineId = readAuthSession()?.machineId ?? env.ADAPTER_COMPUTER_ID ?? ''- if (!machineId) try { machineId = readFileSync(env.ADAPTER_COMPUTER_ID_FILE, 'utf8').trim() } catch { /* refused below */ }+ // What the daemon runs as (`wantedDaemonIdentity` in cli.ts): signed out, this computer's id. Signed out, the app made+ // harnesses and `harness new` refused to.+ const machineId = readAuthSession()?.machineId || computerId()return { port: found?.port ?? env.PORT, dataDir: found?.dataDir ?? env.ADAPTER_DATA_DIR, machineId, harnessPane: !!found }}diff --git a/cli/src/cli.ts b/cli/src/cli.tsindex bd815c102..28cad60e2 100644--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@ -2565,7 +2565,7 @@ switch (cmd) {else if (args[0] === 'setup') {gridSetupCommand({port: daemonPort(),- localMachineId: readAuthSession()?.machineId ?? null,+ localMachineId: wantedDaemonIdentity(),daemonRunning: isDaemonRunning,connect: (url) => new NewCommandSocket(url),output: (line) => console.log(line),@@ -2599,7 +2599,7 @@ switch (cmd) {cwd: process.cwd(),home: homedir(),port: daemonPort(),- localMachineId: readAuthSession()?.machineId ?? null,+ localMachineId: wantedDaemonIdentity(),daemonRunning: isDaemonRunning,listMachines: async () => {const { session, headers } = await controlPlaneAuth()@@ -2625,7 +2625,7 @@ switch (cmd) {case 'remote':remoteCommand({tmuxPane: process.env.TMUX_PANE,- localMachineId: readAuthSession()?.machineId ?? null,+ localMachineId: wantedDaemonIdentity(),port: daemonPort(),daemonRunning: isDaemonRunning,listMachines: async () => {