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
A terminal opens on a tmux that arrived after the daemon started
bitcoinbuilder62ab33e011b0
diff --git a/cli/src/core/main.ts b/cli/src/core/main.tsindex 41eadd88a..56518feec 100644--- a/cli/src/core/main.ts+++ b/cli/src/core/main.ts@@ -891,7 +891,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {superTabRequest: (payload) => superTabCards.ask(payload),cloudRows: () => (cloudAgents?.dialRows() ?? []) as unknown as RegisteredSession[],// Agents' terminals: a literal-argv launch, and a read-only view for Share's observers (core/terminalWatch.ts).- terminals: { ...TERMINALS_OFF, ...createTerminalOpener({ createBackend, registry, announceSession, blocksFolder: (cwd) => !!backendRef?.purgeAgentService?.blocksFolder(cwd), noBackendCode: createUnavailable }), watch: terminalWatch.watch },+ terminals: { ...TERMINALS_OFF, ...createTerminalOpener({ createBackend, recoverBackend, registry, announceSession, blocksFolder: (cwd) => !!backendRef?.purgeAgentService?.blocksFolder(cwd), noBackendCode: createUnavailable }), watch: terminalWatch.watch },dataDir: env.ADAPTER_DATA_DIR,registry,stoppedAgents,diff --git a/cli/src/core/terminals/open.spec.ts b/cli/src/core/terminals/open.spec.tsindex 7f4368da7..48f3fccec 100644--- a/cli/src/core/terminals/open.spec.ts+++ b/cli/src/core/terminals/open.spec.ts@@ -39,6 +39,18 @@ describe('the core terminal launch call', () => {expect(await setup({ blocksFolder: () => true }).open({ argv: ['/bin/sh'], cwd: '/work' })).toEqual({ ok: false, error: 'WORKTREE_BUSY' })expect(createAndRegisterPane).not.toHaveBeenCalled()})+ it('opens on a backend recovered after boot, as an agent\'s create does, and keeps refusing while there is none', async () => {+ const backend = { create: vi.fn(), kill: vi.fn(), releaseHold: vi.fn(async () => {}) }+ const recoverBackend = vi.fn(async () => backend)+ const { open } = setup({ createBackend: null, recoverBackend })+ expect(await open({ argv: ['/bin/sh'], cwd: '/work' })).toEqual({ ok: true, agentId: 'shell' })+ expect(vi.mocked(createAndRegisterPane).mock.calls[0]![0].tmuxBackend).toBe(backend)+ // Recovered once: the next terminal uses it without asking again.+ await open({ argv: ['/bin/sh'], cwd: '/work' })+ expect(recoverBackend).toHaveBeenCalledOnce()+ const none = setup({ createBackend: null, recoverBackend: async () => null })+ expect(await none.open({ argv: ['/bin/sh'], cwd: '/work' })).toEqual({ ok: false, error: 'TMUX_UNAVAILABLE' })+ })it('preserves a failed launch and never announces it', async () => {const { deps, open } = setup()vi.mocked(createAndRegisterPane).mockResolvedValueOnce({ ok: false, error: 'SPAWN_FAILED', detail: 'gone' })diff --git a/cli/src/core/terminals/open.ts b/cli/src/core/terminals/open.tsindex 4c36bd880..b9c885a86 100644--- a/cli/src/core/terminals/open.ts+++ b/cli/src/core/terminals/open.ts@@ -14,10 +14,15 @@ export interface TerminalOpenerDeps {/** What it answers when no backend is ready: the configured backend's own code (terminalBackend.ts* `noBackendCode`); `TMUX_UNAVAILABLE`, as before, by default. */noBackendCode?: string+ /** Rechecks a backend missing at boot, as an agent's create does (core/agents/create.ts): a terminal asked for after+ * tmux was installed while the daemon ran (a Harness Team account installs its own, team/tmux.ts) was refused until+ * the daemon restarted, while an agent created at the same moment started. */+ recoverBackend?: () => Promise<TerminalOpenerDeps['createBackend']>}-export function createTerminalOpener({ createBackend, registry, announceSession, blocksFolder, noBackendCode = 'TMUX_UNAVAILABLE' }: TerminalOpenerDeps): Pick<TerminalsPort, 'open'> {+export function createTerminalOpener({ createBackend, recoverBackend, registry, announceSession, blocksFolder, noBackendCode = 'TMUX_UNAVAILABLE' }: TerminalOpenerDeps): Pick<TerminalsPort, 'open'> {return { open: async ({ argv, cwd }) => {+ createBackend ??= await recoverBackend?.() ?? nullif (!createBackend) return { ok: false, error: noBackendCode }if (blocksFolder(cwd)) return { ok: false, error: 'WORKTREE_BUSY' }const result = await createAndRegisterPane({