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
Merge origin/main into feat/terminal-engine
0xken1550ede8ab30da
diff --cc cli/src/cli.tsindex abd392dcc,c73a8284e..b2a3d2e77--- a/cli/src/cli.ts+++ b/cli/src/cli.ts@@@ -64,8 -64,12 +64,12 @@@ import { ensureHarnessGrid, type Ensureimport { passThroughToGridLogout } from './lib/gridLogout.js'import { clearGridMcpUrlCache } from './lib/gridMcpUrl.js'import { warnIfGridSignInRemains } from './lib/gridCredentials.js'+ import { reconcileGridAttach, gridNamesLocal, createGridAttachRunner } from './lib/gridAttach.js'+ import { signedInGridEmail, resetGridDeriveMemo } from './lib/gridDerive.js'+ import { forgetGridModels } from './lib/gridModels.js'+ import { gridAvailable } from './lib/gridExec.js'-import { ENGINE_CLI_COMMANDS, ENGINES, engineBin, enginePathOverride } from './lib/engineBin.js'-import type { AgentEngine } from './engines/types.js'+import { ENGINE_CLI_COMMANDS, ENGINES, PROCESS_ENGINES, engineBin, enginePathOverride } from './lib/engineBin.js'+import { isTerminalEngine, type AgentEngine } from './engines/types.js'import { engineInstallRecipe } from './lib/engineInstall.js'import { buildEngineCommandArgv, buildEngineLaunchArgv, commandAvailableInInteractiveShell, namedAgentArgs } from './lib/engineLaunch.js'import { buildGridEngineLaunch, describeGridLaunch, gridConflictingEnvToClear, gridEnvVarNames, type GridLaunchMachine, type GridWebSearchStatus } from './lib/gridLaunch.js'@@@ -3951,6 -4030,61 +4079,73 @@@ async function runForeground(session: A* pass can miss it — retry `triggerHint` a few times with backoff before giving up.*/+ /**+ * Watch a pane this daemon just opened until its engine process shows up (ready), dies (failed), or+ * ten minutes pass. Shared by create and fork: the two open panes the same way and wait the same way.+ */+ const watchNewPane = async (engine: AgentEngine, pending: RegisteredSession, spawned: { runtime: TmuxRuntimeRef }, command: string[], installIfMissing: ReturnType<typeof engineInstallRecipe> | undefined): Promise<void> => {+ const budgetMs = 10 * 60_000+ const startedAt = Date.now()+ let delayMs = 50+ try {+ while (Date.now() - startedAt < budgetMs) {+ if (!registry.byAgent(pending.agentId)) return+ const processIdentity = await resolvePaneEngineProcess(spawned.runtime.paneId, engine)+ if (processIdentity) {+ registry.updateProcessIdentity(pending.agentId, processIdentity)+ const ready = registry.setLaunch(pending.agentId, { state: 'ready' })+ await clearPaneRemainOnExit(spawned.runtime.paneId)+ if (ready) announceSession(ready)+ void agentReconciler.triggerHint(spawned.runtime, engine).catch((error) => {+ console.warn(`[agent] background bind failed · ${engine} · ${error instanceof Error ? error.message : error}`)+ })+ console.log(`[agent] create ready · ${engine} · agent ${pending.agentId} · ${Date.now() - startedAt}ms`)+ return+ }+ const paneState = await tmuxPaneState(spawned.runtime.paneId)+ if (!paneState) {+ registry.setTerminalAvailable(pending.agentId, false)+ announceSession(pending)+ return+ }+ if (paneState.dead) {+ const installed = await commandAvailableInInteractiveShell(command[0], undefined, installIfMissing)+ const error = installed ? 'ENGINE_DID_NOT_START' : 'ENGINE_NOT_INSTALLED'+ const detail = installed+ ? `${engine} exited before its engine process became ready. See the terminal output for details.`+ : `${engine} is not installed, or its automatic install failed. See the terminal output for details.`+ const failed = registry.setLaunch(pending.agentId, { state: 'failed', error, detail })+ if (failed) announceSession(failed)+ console.warn(`[agent] create failed · ${engine} · ${detail}`)+ return+ }++ // The engine started and was gone again before it was ever seen (a flag it refused, a++ // config it could not read): its wrapper has handed the pane to a shell with the engine's++ // own words on screen. That pane is a terminal, and the row says so — the person reads++ // the error where it was printed and types the command again, rather than being handed a++ // "Start failed" tile they cannot type into.++ if (paneState.engineExit !== null) {++ await clearPaneRemainOnExit(spawned.runtime.paneId)++ const released = registry.releaseEngine(pending.agentId)++ if (released) announceSession(released)++ console.warn(`[agent] create · ${engine} exited (${paneState.engineExit}) before ready · agent ${pending.agentId} kept as a terminal`)++ return++ }+ await new Promise<void>((resolve) => {+ const timer = setTimeout(resolve, delayMs)+ timer.unref?.()+ })+ delayMs = Math.min(delayMs * 2, 750)+ }+ const detail = `${engine} did not expose an engine process within 10 minutes. The terminal remains available.`+ const failed = registry.setLaunch(pending.agentId, { state: 'failed', error: 'START_TIMEOUT', detail })+ if (failed) announceSession(failed)+ console.warn(`[agent] create timed out · ${engine} · agent ${pending.agentId}`)+ } catch (error) {+ console.warn(`[agent] create watch failed · ${engine} · ${error instanceof Error ? error.message : error}`)+ }+ }+backend.onCreateAgent = async ({ engine, cwd, bypassPermission, permissionMode, grid, codexHome, dsh, prompt, name, agent }) => {if (!tmuxBackend) return { ok: false, error: 'TMUX_UNAVAILABLE' }try {diff --cc cli/src/lib/registry.tsindex ef63b38b0,1d034a261..f946ee387--- a/cli/src/lib/registry.ts+++ b/cli/src/lib/registry.ts@@@ -169,14 -169,13 +169,21 @@@ export interface RegisteredSession* existed and on agents Harness did not launch; those relaunch from `bypassPermission`.*/permissionMode?: string+ /**+ * The pane was opened as a terminal (engine `terminal`, the desktop's New Terminal) rather than+ * for an engine. Set once at creation and kept for the row's whole life, whichever engine is+ * running in it now: this is what tells the reconciler that an engine exiting means "back to a+ * shell" (`releaseEngine`) rather than "dormant", and what tells `restoreAgents` to bring back+ * a shell rather than a `claude`. Not a type — `engine` still says what the pane IS right now.+ */+ terminalHost?: boolean+ /**+ * The agent this one was FORKED from (`agent_fork`): a new session opened with the source's whole+ * history, the source left as it was. Recorded once at creation so the pane can say "forked from X"+ * and link back; `name` is the source's name at that moment, kept because the source may be renamed+ * or gone by the time anyone reads it. Absent on every other agent.+ */+ forkedFrom?: { agentId: string; name: string } | null/** Legacy launcher-owned snapshots may still contain this field. New records never write it. */launcherId?: stringtranscriptPath: string | null@@@ -1121,7 -1129,7 +1139,8 @@@ class Registryagent: normalizedAgentName(input.agent),...(input.bypassPermission ? { bypassPermission: true } : {}),...(permissionModeName(input.permissionMode) ? { permissionMode: input.permissionMode } : {}),+ ...(isTerminalEngine(input.engine) ? { terminalHost: true } : {}),+ ...(input.forkedFrom ? { forkedFrom: { agentId: input.forkedFrom.agentId, name: input.forkedFrom.name } } : {}),transcriptPath: null,projectDir: basename(input.cwd ?? '') || agentId,cwd: input.cwd ?? null,diff --cc desktop/lib/widgets/pane_header_actions.dartindex 59697370d,aba057f37..745b1fc02--- a/desktop/lib/widgets/pane_header_actions.dart+++ b/desktop/lib/widgets/pane_header_actions.dart@@@ -25,12 -25,13 +26,17 @@@ class PaneHeaderActions extends Statele});final bool zoomed, composerVisible;++ /// The pane is a shell, not a harness: Restart and Stop say so, because+ /// "Stop Harness" over a terminal reads as a button for something else.+ final bool terminal;final VoidCallback? onShare;- final VoidCallback? onZoom, onRestart, onDelete, onClose, onToggleComposer;+ final VoidCallback? onZoom,+ onRestart,+ onFork,+ onDelete,+ onClose,+ onToggleComposer;/// A harness agent's viewer: show it beside this terminal, or hide it./// Absent for an agent that has no viewer.@@@ -130,17 -131,13 +136,21 @@@onZoom,),const SizedBox(width: 2),- action('Restart Harness', LucideIcons.refreshCw, onRestart),+ action(+ terminal ? 'Restart Terminal' : 'Restart Harness',+ LucideIcons.refreshCw,+ onRestart,+ ),const SizedBox(width: 2),+ if (onFork != null) ...[+ action('Fork Harness', LucideIcons.gitFork, onFork),+ const SizedBox(width: 2),+ ],- action('Stop Harness', Icons.stop_rounded, onDelete),+ action(+ terminal ? 'Stop Terminal' : 'Stop Harness',+ Icons.stop_rounded,+ onDelete,+ ),const SizedBox(width: 2),action('Close Pane', LucideIcons.x, onClose),],diff --cc desktop/lib/widgets/terminal_panel.dartindex 78eb8d7fc,b12fab1ca..b2fbbadc4--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@@ -1747,9 -1755,9 +1760,10 @@@ class _TerminalHeader extends Statelesszoomed: zoomed,onZoom: onToggleZoom,onRestart: onRestart,+ onFork: onFork,onDelete: onDelete,onClose: onClose,+ terminal: isTerminalEngine(session.engineId),onToggleComposer: remoteComposer,composerVisible: composerVisible,// A harness agent's viewer, shown or hidden from the