Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(pty): tmux banner bootstraps Homebrew on Macs that lack it
enesba5f3e216907
diff --git a/src/core/pty-manager.ts b/src/core/pty-manager.tsindex 1c0575f71..b84021cb7 100644--- a/src/core/pty-manager.ts+++ b/src/core/pty-manager.ts@@ -15,7 +15,7 @@ import {type Settings,type TmuxStatus} from '../shared/types'-import { findCommand, tmuxInstallCommand } from './tmux-hint'+import { findCommand, tmuxInstall } from './tmux-hint'import { hookServer } from './agents/hook-server'import {remoteHookEnvArgs,@@ -631,11 +631,13 @@ export class PtyManager {* manager is present (run in a terminal node, gh-sign-in style). */tmuxStatus(): TmuxStatus {const available = !!this.tmuxPath+ const hint = available+ ? null+ : tmuxInstall(process.platform, (cmd) => findCommand(cmd, process.env, fs.existsSync))return {available,- installCommand: available- ? null- : tmuxInstallCommand(process.platform, (cmd) => findCommand(cmd, process.env, fs.existsSync)),+ installCommand: hint?.command ?? null,+ installLabel: hint?.label ?? null,platform: process.platform}}diff --git a/src/core/tmux-hint.test.ts b/src/core/tmux-hint.test.tsindex 123f00740..4871eefbe 100644--- a/src/core/tmux-hint.test.ts+++ b/src/core/tmux-hint.test.ts@@ -1,24 +1,38 @@import { describe, it, expect } from 'vitest'-import { findCommand, tmuxInstallCommand } from './tmux-hint'+import { findCommand, tmuxInstall } from './tmux-hint'-describe('tmuxInstallCommand', () => {- it('darwin: brew when present, else no one-click command (text-only banner)', () => {- expect(tmuxInstallCommand('darwin', (c) => c === 'brew')).toBe('brew install tmux')- expect(tmuxInstallCommand('darwin', () => false)).toBeNull()+describe('tmuxInstall', () => {+ it('darwin with brew: one-click brew install', () => {+ expect(tmuxInstall('darwin', (c) => c === 'brew')).toEqual({+ command: 'brew install tmux',+ label: 'Install tmux'+ })+ })++ it('darwin WITHOUT brew: bootstraps Homebrew first (official installer), then tmux — never text-only', () => {+ const hint = tmuxInstall('darwin', () => false)+ expect(hint?.label).toBe('Install Homebrew + tmux')+ expect(hint?.command).toContain('https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh')+ // The fresh brew is not on this shell's PATH — the chain must call it by absolute path+ // (Apple Silicon first, Intel fallback) or the second step dies right after the first.+ expect(hint?.command).toContain('/opt/homebrew/bin/brew')+ expect(hint?.command).toContain('/usr/local/bin/brew')+ expect(hint?.command).toContain('install tmux')})it('linux: picks the first known package manager, in order', () => {- expect(tmuxInstallCommand('linux', (c) => c === 'apt-get')).toContain('apt-get install -y tmux')- expect(tmuxInstallCommand('linux', (c) => c === 'dnf')).toBe('sudo dnf install -y tmux')- expect(tmuxInstallCommand('linux', (c) => c === 'pacman')).toBe('sudo pacman -S --needed tmux')- expect(tmuxInstallCommand('linux', (c) => c === 'apk')).toBe('sudo apk add tmux')+ expect(tmuxInstall('linux', (c) => c === 'apt-get')?.command).toContain('apt-get install -y tmux')+ expect(tmuxInstall('linux', (c) => c === 'dnf')?.command).toBe('sudo dnf install -y tmux')+ expect(tmuxInstall('linux', (c) => c === 'pacman')?.command).toBe('sudo pacman -S --needed tmux')+ expect(tmuxInstall('linux', (c) => c === 'apk')?.command).toBe('sudo apk add tmux')// apt-get outranks dnf when both exist (Debian-family first, matching the server docs' target).- expect(tmuxInstallCommand('linux', () => true)).toContain('apt-get')- expect(tmuxInstallCommand('linux', () => false)).toBeNull()+ expect(tmuxInstall('linux', () => true)?.command).toContain('apt-get')+ expect(tmuxInstall('linux', () => true)?.label).toBe('Install tmux')+ expect(tmuxInstall('linux', () => false)).toBeNull()})it('win32 (no native tmux): never suggests a command', () => {- expect(tmuxInstallCommand('win32', () => true)).toBeNull()+ expect(tmuxInstall('win32', () => true)).toBeNull()})})diff --git a/src/core/tmux-hint.ts b/src/core/tmux-hint.tsindex 904d370b7..487893c7f 100644--- a/src/core/tmux-hint.ts+++ b/src/core/tmux-hint.ts@@ -3,23 +3,49 @@// can't attach — which users never discover on their own; the banner makes it visible and offers// a one-click install (run in a terminal node, gh-sign-in style).-/** Suggested one-shot install command for the host, or null when no known package manager is- * present (the banner then shows text-only guidance). Order within linux is Debian-family first- * (the Server Edition's documented target), then the other majors. */-export function tmuxInstallCommand(+export interface TmuxInstallHint {+ command: string+ /** Button caption — tells the user up front when more than tmux is being installed. */+ label: string+}++/** Suggested one-shot install for the host, or null when there is nothing sensible to run+ * (win32; a linux with no known package manager). Order within linux is Debian-family first+ * (the Server Edition's documented target), then the other majors.+ *+ * darwin WITHOUT brew is never text-only: macOS has no built-in package manager, so the button+ * chains the OFFICIAL Homebrew installer (which itself prompts for confirmation + password —+ * the user watches it run in the terminal node) and then calls the fresh brew BY ABSOLUTE PATH+ * (Apple Silicon /opt/homebrew, Intel /usr/local): the just-installed brew is not on the+ * launching shell's PATH, so a bare `brew install tmux` would fail right after succeeding. */+export function tmuxInstall(platform: NodeJS.Platform | string,hasCommand: (cmd: string) => boolean-): string | null {+): TmuxInstallHint | null {if (platform === 'darwin') {- return hasCommand('brew') ? 'brew install tmux' : null+ if (hasCommand('brew')) return { command: 'brew install tmux', label: 'Install tmux' }+ return {+ command:+ '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' ++ ' && { b=/opt/homebrew/bin/brew; [ -x "$b" ] || b=/usr/local/bin/brew; "$b" install tmux; }',+ label: 'Install Homebrew + tmux'+ }}if (platform === 'linux') {- if (hasCommand('apt-get')) return 'sudo apt-get update && sudo apt-get install -y tmux'- if (hasCommand('dnf')) return 'sudo dnf install -y tmux'- if (hasCommand('yum')) return 'sudo yum install -y tmux'- if (hasCommand('pacman')) return 'sudo pacman -S --needed tmux'- if (hasCommand('zypper')) return 'sudo zypper install -y tmux'- if (hasCommand('apk')) return 'sudo apk add tmux'+ const command = hasCommand('apt-get')+ ? 'sudo apt-get update && sudo apt-get install -y tmux'+ : hasCommand('dnf')+ ? 'sudo dnf install -y tmux'+ : hasCommand('yum')+ ? 'sudo yum install -y tmux'+ : hasCommand('pacman')+ ? 'sudo pacman -S --needed tmux'+ : hasCommand('zypper')+ ? 'sudo zypper install -y tmux'+ : hasCommand('apk')+ ? 'sudo apk add tmux'+ : null+ return command ? { command, label: 'Install tmux' } : null}return null}diff --git a/src/renderer/bridge/ws-bridge.ts b/src/renderer/bridge/ws-bridge.tsindex 020b6b924..c70298c97 100644--- a/src/renderer/bridge/ws-bridge.ts+++ b/src/renderer/bridge/ws-bridge.ts@@ -210,7 +210,7 @@ export function buildRealApi(tmuxStatus: () =>client.request(IPC.ptyTmuxStatus)- .catch(() => ({ available: true, installCommand: null, platform: 'linux' })) as Promise<TmuxStatus>,+ .catch(() => ({ available: true, installCommand: null, installLabel: null, platform: 'linux' })) as Promise<TmuxStatus>,// No server handler — the session-name poll degrades to no adopted name.readSessionName: () => Promise.resolve(''),onData: (sessionId, listener) =>diff --git a/src/renderer/components/TmuxBanner.tsx b/src/renderer/components/TmuxBanner.tsxindex 7a522bc0d..e98bb18f5 100644--- a/src/renderer/components/TmuxBanner.tsx+++ b/src/renderer/components/TmuxBanner.tsx@@ -50,7 +50,7 @@ export function TmuxBanner({ onInstall }: { onInstall: (command: string) => voidsetDismissed(true)}}>- Install tmux+ {status.installLabel ?? 'Install tmux'}</button>)}<button className="announce-banner__close" title="Dismiss" onClick={() => setDismissed(true)}>diff --git a/src/shared/types.ts b/src/shared/types.tsindex f01ee146c..d60550d1d 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -263,6 +263,8 @@ export interface TmuxStatus {available: boolean/** One-shot install command for a terminal node; null = no known installer (text-only banner). */installCommand: string | null+ /** Button caption for installCommand (e.g. "Install Homebrew + tmux" when brew must come first). */+ installLabel: string | nullplatform: string}