Skip to content

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.

feat(pty): "tmux not found" banner with one-click install

enes2bc6c3434860
diff --git a/src/core/pty-manager.ts b/src/core/pty-manager.ts
index bb1d57c76..1c0575f71 100644
--- a/src/core/pty-manager.ts
+++ b/src/core/pty-manager.ts
@@ -12,8 +12,10 @@ import {
DEFAULT_SETTINGS,
type PtyCreateOptions,
type PtyCreateResult,
- type Settings
+ type Settings,
+ type TmuxStatus
} from '../shared/types'
+import { findCommand, tmuxInstallCommand } from './tmux-hint'
import { hookServer } from './agents/hook-server'
import {
remoteHookEnvArgs,
@@ -620,6 +622,22 @@ export class PtyManager {
platform().handle(IPC.ptySendText, (persistKey: string, text: string) =>
this.sendText(persistKey, text)
)
+ platform().handle(IPC.ptyTmuxStatus, () => this.tmuxStatus())
+ }
+
+ /** Feeds the renderer's "tmux not found" banner. Without tmux the app silently degrades to a
+ * plain shell (no cross-restart continuity, no mobile attach) — users never discover that on
+ * their own, so the banner surfaces it with a one-click install command when a known package
+ * manager is present (run in a terminal node, gh-sign-in style). */
+ tmuxStatus(): TmuxStatus {
+ const available = !!this.tmuxPath
+ return {
+ available,
+ installCommand: available
+ ? null
+ : tmuxInstallCommand(process.platform, (cmd) => findCommand(cmd, process.env, fs.existsSync)),
+ platform: process.platform
+ }
}
/**
diff --git a/src/core/tmux-hint.test.ts b/src/core/tmux-hint.test.ts
new file mode 100644
index 000000000..123f00740
--- /dev/null
+++ b/src/core/tmux-hint.test.ts
@@ -0,0 +1,38 @@
+import { describe, it, expect } from 'vitest'
+import { findCommand, tmuxInstallCommand } 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()
+ })
+
+ 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')
+ // 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()
+ })
+
+ it('win32 (no native tmux): never suggests a command', () => {
+ expect(tmuxInstallCommand('win32', () => true)).toBeNull()
+ })
+})
+
+describe('findCommand', () => {
+ it('scans PATH entries and the common GUI-blind dirs (apps do not inherit the shell PATH)', () => {
+ const seen: string[] = []
+ const exists = (p: string) => (seen.push(p), p === '/opt/homebrew/bin/brew')
+ expect(findCommand('brew', { PATH: '/usr/bin:/bin' }, exists)).toBe(true)
+ expect(seen).toContain('/usr/bin/brew') // PATH first
+ expect(seen).toContain('/opt/homebrew/bin/brew') // then the common dirs
+ expect(findCommand('brew', { PATH: '/usr/bin' }, () => false)).toBe(false)
+ })
+
+ it('tolerates a missing PATH', () => {
+ expect(findCommand('brew', {}, (p) => p === '/usr/local/bin/brew')).toBe(true)
+ })
+})
diff --git a/src/core/tmux-hint.ts b/src/core/tmux-hint.ts
new file mode 100644
index 000000000..904d370b7
--- /dev/null
+++ b/src/core/tmux-hint.ts
@@ -0,0 +1,41 @@
+// Pure helpers behind the "tmux not found" banner (pty:tmux-status). Without tmux the app runs in
+// the silent plain-shell fallback — terminals don't survive restarts and the mobile companion
+// 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(
+ platform: NodeJS.Platform | string,
+ hasCommand: (cmd: string) => boolean
+): string | null {
+ if (platform === 'darwin') {
+ return hasCommand('brew') ? 'brew install tmux' : null
+ }
+ 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'
+ }
+ return null
+}
+
+/** Dirs GUI apps routinely miss (they don't inherit the shell PATH) — same reasoning as
+ * findTmux in pty-manager. Checked after the process PATH. */
+const COMMON_BIN_DIRS = ['/opt/homebrew/bin', '/usr/local/bin', '/opt/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin']
+
+/** Is `name` on the process PATH or in the common bin dirs? `exists` is injected (fs.existsSync
+ * in production) so the lookup stays pure and testable. */
+export function findCommand(
+ name: string,
+ env: Record<string, string | undefined>,
+ exists: (path: string) => boolean
+): boolean {
+ const dirs = [...(env.PATH ? env.PATH.split(':') : []), ...COMMON_BIN_DIRS]
+ return dirs.some((d) => d && exists(`${d}/${name}`))
+}
+
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 51387b0bd..7bcbc081d 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -65,6 +65,7 @@ const api: NodeTerminalApi = {
capture: (persistKey, full) => ipcRenderer.invoke(IPC.ptyCapture, persistKey, full),
readScrollback: (persistKey) => ipcRenderer.invoke(IPC.ptyReadScrollback, persistKey),
sendText: (persistKey, text) => ipcRenderer.invoke(IPC.ptySendText, persistKey, text),
+ tmuxStatus: () => ipcRenderer.invoke(IPC.ptyTmuxStatus),
readSessionName: (sessionId, accountId) =>
ipcRenderer.invoke(IPC.ptyReadSessionName, sessionId, accountId),
onData: (sessionId, listener) => {
diff --git a/src/renderer/bridge/ws-bridge.ts b/src/renderer/bridge/ws-bridge.ts
index c1e8e8ced..bfc4a9dd0 100644
--- a/src/renderer/bridge/ws-bridge.ts
+++ b/src/renderer/bridge/ws-bridge.ts
@@ -28,6 +28,7 @@ import {
type PtyCreateOptions,
type SettingsApi,
type Settings,
+ type TmuxStatus,
type Workspace,
type WorkspaceApi
} from '../../shared/types'
@@ -205,6 +206,11 @@ export function buildRealApi(
client.request(IPC.ptyReadScrollback, persistKey) as Promise<string>,
sendText: (persistKey, text) =>
client.request(IPC.ptySendText, persistKey, text) as Promise<boolean>,
+ // Fail-open: an errored status must not raise the banner in the browser.
+ tmuxStatus: () =>
+ client
+ .request(IPC.ptyTmuxStatus)
+ .catch(() => ({ available: true, installCommand: 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/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 922cc2fa7..7dd16396e 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -70,6 +70,7 @@ import { CloneRepoDialog } from '../components/CloneRepoDialog'
import { ShortcutsPanel } from '../components/ShortcutsPanel'
import { UpdateCard } from '../components/UpdateCard'
import { AnnouncementBanner } from '../components/AnnouncementBanner'
+import { TmuxBanner } from '../components/TmuxBanner'
import { ConflictBar } from '../components/ConflictBar'
import { ConfirmDialog } from '../components/ConfirmDialog'
import { ConsentNotice } from '../remote/ConsentNotice'
@@ -5376,6 +5377,7 @@ export function Canvas() {
<div className="top-banners">
<AnnouncementBanner />
+ <TmuxBanner onInstall={runInTerminal} />
{migrationNote && (
<div className="announce-banner announce-banner--info">
<span className="announce-banner__dot" />
diff --git a/src/renderer/components/TmuxBanner.tsx b/src/renderer/components/TmuxBanner.tsx
new file mode 100644
index 000000000..7a522bc0d
--- /dev/null
+++ b/src/renderer/components/TmuxBanner.tsx
@@ -0,0 +1,61 @@
+import { useEffect, useState } from 'react'
+import type { TmuxStatus } from '@shared/types'
+import { localSession } from '../session/localSession'
+
+// "tmux not found" strip: without tmux the app silently degrades to a plain shell — terminals
+// don't survive restarts and the mobile companion can't attach — and nothing used to say so
+// (one field report ran degraded for months without anyone noticing). Shown every launch until
+// tmux is installed; the ✕ hides it for this session only. The install button runs the suggested
+// package-manager command in a new terminal node (the gh-sign-in pattern), so the user watches it
+// happen. No known package manager → text-only guidance. Hidden on win32 (no native tmux to
+// install) and on any fetch error (fail-open, like the ws-bridge stub).
+export function TmuxBanner({ onInstall }: { onInstall: (command: string) => void }): JSX.Element | null {
+ const [status, setStatus] = useState<TmuxStatus | null>(null)
+ const [dismissed, setDismissed] = useState(false)
+
+ useEffect(() => {
+ let cancelled = false
+ // Deliberately the LOCAL session, not useSession(): this banner is about THIS machine's tmux
+ // (the host whose terminals lose continuity), never a relay tab's remote host.
+ localSession.api.pty
+ .tmuxStatus()
+ .then((s) => {
+ if (!cancelled) setStatus(s)
+ })
+ .catch(() => {})
+ return () => {
+ cancelled = true
+ }
+ }, [])
+
+ if (!status || status.available || dismissed || status.platform === 'win32') return null
+
+ return (
+ <div className="announce-banner announce-banner--warning">
+ <span className="announce-banner__dot" />
+ <div className="announce-banner__content">
+ <span className="announce-banner__title">tmux not found</span>
+ <span className="announce-banner__body">
+ {status.installCommand
+ ? 'Terminals won’t survive restarts and the mobile app can’t attach until tmux is installed.'
+ : 'Terminals won’t survive restarts and the mobile app can’t attach. Install tmux with your package manager (e.g. brew install tmux), then restart nodeterm.'}
+ </span>
+ </div>
+ {status.installCommand && (
+ <button
+ className="announce-banner__btn"
+ title={status.installCommand}
+ onClick={() => {
+ onInstall(status.installCommand!)
+ setDismissed(true)
+ }}
+ >
+ Install tmux
+ </button>
+ )}
+ <button className="announce-banner__close" title="Dismiss" onClick={() => setDismissed(true)}>
+ ✕
+ </button>
+ </div>
+ )
+}
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index fbb6f9f02..a1510d195 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -17,6 +17,7 @@ export const IPC = {
ptyCapture: 'pty:capture',
ptyReadScrollback: 'pty:read-scrollback',
ptySendText: 'pty:send-text',
+ ptyTmuxStatus: 'pty:tmux-status',
ptyReadSessionName: 'pty:read-session-name',
claudeReadTranscript: 'claude:read-transcript',
chatReadTranscript: 'chat:read-transcript',
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 996bfbf87..27dd9c02e 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -258,6 +258,14 @@ export const EMPTY_WORKSPACE: Workspace = {
// ---- Contract for the API exposed to the renderer via preload ----
+/** Wire shape of pty:tmux-status — behind the "tmux not found" banner. */
+export interface TmuxStatus {
+ available: boolean
+ /** One-shot install command for a terminal node; null = no known installer (text-only banner). */
+ installCommand: string | null
+ platform: string
+}
+
export interface PtyApi {
/** Starts a new PTY session; returns its sessionId and whether the session was freshly
* created (cold start) vs reattached to a still-running tmux session (warm). */
@@ -290,6 +298,9 @@ export interface PtyApi {
readScrollback(persistKey: string): Promise<string>
/** Send literal text + Enter into a session (e.g. a slash command). Returns false if unavailable. */
sendText(persistKey: string, text: string): Promise<boolean>
+ /** Is tmux available on this host (else the silent plain-shell fallback), plus a suggested
+ * install command for the "tmux not found" banner. */
+ tmuxStatus(): Promise<TmuxStatus>
/** The agent session's display name (`/rename` name, else auto name) read from its transcript,
* resolved strictly by sessionId; null if unknown. Keeps a node title in sync with the
* `/resume` name (e.g. after resume) without cross-contaminating same-folder sessions.