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(ui): passphrase dialog, SSH connect polish and tab affordances

parsa222397cadd2a7a6
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index e06909ab3..e7110d4f5 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -119,6 +119,7 @@ import {
} from '../lib/nodeFocus'
import { RemoteAccessDialog } from '../components/RemoteAccessDialog'
import { SshProjectDialog } from '../components/SshProjectDialog'
+import { SshPassphrasePrompt } from '../components/SshPassphrasePrompt'
import { transport } from '../terminal/local-transport'
import { sshFs } from '../terminal/ssh-fs'
import {
@@ -206,7 +207,14 @@ import { useSystemAccount } from '../state/systemAccount'
import { useEntitlement } from '../state/entitlement'
import type { SshServer, SshConnection } from '@shared/ssh'
import { sshHostKey } from '@shared/ssh'
-import type { CanvasNodeState, Project, ProjectKanban, SshProjectStatus, TranscriptHit } from '@shared/types'
+import type {
+ CanvasNodeState,
+ Project,
+ ProjectKanban,
+ SshPassphraseRequest,
+ SshProjectStatus,
+ TranscriptHit
+} from '@shared/types'
import { KanbanView, type KanbanCreateChoice, type KanbanSession } from '../components/kanban/KanbanView'
import { assignNode, defaultKanban } from '../lib/kanban'
import { isHidden } from '../lib/ui-visibility'
@@ -646,6 +654,17 @@ export function Canvas() {
const [cloneDialogOpen, setCloneDialogOpen] = useState(false)
// Live SSH ControlMaster status per project id (drives the thin connection banner).
const [sshStatus, setSshStatus] = useState<Record<string, SshProjectStatus>>({})
+ // The cause that came with an `error` status. Kept beside the status because the banner used to
+ // render a bare "SSH connection error", throwing away the one line ssh gave us (permission
+ // denied, host unreachable, host key mismatch) that tells the user what to actually fix.
+ const [sshError, setSshError] = useState<Record<string, string | undefined>>({})
+ // Pending SSH_ASKPASS passphrase prompts (see ssh-askpass.ts). A QUEUE rather than one slot:
+ // main serializes dialogs today, so this normally holds at most one, but a single slot would
+ // SILENTLY DROP a second request if that ever changed, and the dropped requestId has no other
+ // path to an answer, so its ssh master would stall until the prompt expiry fires minutes later.
+ // Queueing keeps every request answerable; the head is the one on screen.
+ const [sshPassphraseQueue, setSshPassphraseQueue] = useState<SshPassphraseRequest[]>([])
+ const sshPassphraseRequest = sshPassphraseQueue[0] ?? null
// A client has finished the handshake and is awaiting this host's approval (carries the SAS).
const [pendingPeer, setPendingPeerState] = useState<PendingPeerState | null>(null)
const [confirm, setConfirmState] = useState<ConfirmState | null>(null)
@@ -6512,6 +6531,9 @@ export function Canvas() {
useEffect(() => {
return window.nodeTerminal.sshProject.onStatus((e) => {
setSshStatus((prev) => ({ ...prev, [e.projectId]: e.status }))
+ // Keep the cause for the banner. Cleared on any non-error status so a stale reason can
+ // never be shown next to a healthy connection.
+ setSshError((prev) => ({ ...prev, [e.projectId]: e.status === 'error' ? e.error : undefined }))
// Feed the auto-reconnect coordinator: ANY successful connect (its own loop, the
// active-project effect on a tab switch) respawns that project's dropped terminals.
if (e.status === 'connected') sshReconnectorRef.current?.onConnected(e.projectId)
@@ -6533,6 +6555,22 @@ export function Canvas() {
})
}, [])
+ // Passphrase prompt for a ControlMaster's encrypted identity file. It can fire well after the
+ // connect dialog closed (watchdog re-establish, powerMonitor resume), so it's a standalone
+ // overlay rather than a step inside SshProjectDialog. Main serializes prompts (one at a time),
+ // so a single state slot cannot drop a concurrent request. The dismiss event closes a dialog
+ // whose request expired main-side, so a late answer cannot land in a dead request.
+ useEffect(() => {
+ return window.nodeTerminal.sshProject.onPassphraseRequest((e) =>
+ setSshPassphraseQueue((prev) => (prev.some((r) => r.requestId === e.requestId) ? prev : [...prev, e]))
+ )
+ }, [])
+ useEffect(() => {
+ return window.nodeTerminal.sshProject.onPassphraseDismiss((e) => {
+ setSshPassphraseQueue((prev) => prev.filter((r) => r.requestId !== e.requestId))
+ })
+ }, [])
+
// Create an SSH project from the dialog: commit the current canvas, then open-or-reuse the
// project for that server folder (its master is opened by the active-project effect on switch),
// persist. openSshProject dedupes by endpoint+remoteCwd — re-adding a folder must reuse its
@@ -7079,6 +7117,9 @@ export function Canvas() {
(() => {
const st = sshStatus[activeProjectId]
const isError = st === 'error' || st === 'disconnected'
+ // The reason ssh gave, already trimmed to one line by lastSshErrorLine in main. Shown
+ // inline: a bare "SSH connection error" leaves the user with nothing to act on.
+ const cause = sshError[activeProjectId]
const text =
st === 'connecting'
? `Connecting to ${activeSshServer.label}…`
@@ -7086,7 +7127,9 @@ export function Canvas() {
? `Reconnecting to ${activeSshServer.label}…`
: st === 'disconnected'
? `Disconnected from ${activeSshServer.label}`
- : `SSH connection error — ${activeSshServer.label}`
+ : cause
+ ? `${activeSshServer.label}: ${cause}`
+ : `SSH connection error: ${activeSshServer.label}`
return (
<div
title={`${activeSshServer.user}@${activeSshServer.host}`}
@@ -7368,6 +7411,23 @@ export function Canvas() {
/>
)}
+ {sshPassphraseRequest && (
+ <SshPassphrasePrompt
+ key={sshPassphraseRequest.requestId}
+ identityFile={sshPassphraseRequest.identityFile}
+ retry={sshPassphraseRequest.retry}
+ target={sshPassphraseRequest.target}
+ onSubmit={(value) => {
+ void window.nodeTerminal.sshProject.submitPassphrase(sshPassphraseRequest.requestId, value)
+ setSshPassphraseQueue((prev) => prev.filter((r) => r.requestId !== sshPassphraseRequest.requestId))
+ }}
+ onCancel={() => {
+ void window.nodeTerminal.sshProject.submitPassphrase(sshPassphraseRequest.requestId, null)
+ setSshPassphraseQueue((prev) => prev.filter((r) => r.requestId !== sshPassphraseRequest.requestId))
+ }}
+ />
+ )}
+
{menu && (
<ContextMenu x={menu.x} y={menu.y} items={menu.items} onClose={() => setMenu(null)} />
)}
diff --git a/src/renderer/components/SshPassphrasePrompt.tsx b/src/renderer/components/SshPassphrasePrompt.tsx
new file mode 100644
index 000000000..b4c40375c
--- /dev/null
+++ b/src/renderer/components/SshPassphrasePrompt.tsx
@@ -0,0 +1,85 @@
+import { useCallback, useState } from 'react'
+import { createPortal } from 'react-dom'
+import { useDialogStack } from './dialog-stack'
+import { Button } from '@renderer/ui/Button'
+import { Input } from '@renderer/ui/Input'
+
+interface SshPassphrasePromptProps {
+ identityFile: string
+ retry: boolean
+ /** `user@host` this unlock is for, when main could name it (see SshPassphraseRequest). */
+ target?: string
+ onSubmit: (value: string) => void
+ onCancel: () => void
+}
+
+/** Basename of a local identity file path, for the prompt message. */
+function baseName(p: string): string {
+ const trimmed = p.replace(/\/+$/, '')
+ return trimmed.split('/').filter(Boolean).pop() || trimmed
+}
+
+/**
+ * Passphrase prompt for an SSH ControlMaster's encrypted identity file (the SSH_ASKPASS relay in
+ * ssh-project.ts / ssh-askpass.ts). Mounted once at the Canvas level, not inside
+ * SshProjectDialog: the ControlMaster watchdog and the powerMonitor resume-reconnect path can
+ * trigger a prompt long after the "Connect over SSH…" dialog has closed.
+ */
+export function SshPassphrasePrompt({ identityFile, retry, target, onSubmit, onCancel }: SshPassphrasePromptProps) {
+ const [value, setValue] = useState('')
+
+ const submit = useCallback(() => {
+ if (!value) return
+ onSubmit(value)
+ }, [value, onSubmit])
+
+ // Registered in the modal stack so a dialog underneath does not ALSO answer the Enter / Escape
+ // typed here (its listener is on `window`). Keys are handled on the input itself, which is
+ // autoFocused, so this needs no window listener of its own — one had both firing, cancelling
+ // twice on a single Escape. Same contract as InputDialog.
+ useDialogStack()
+
+ return createPortal(
+ <div className="confirm-overlay" onClick={onCancel}>
+ <div className="confirm" style={{ width: 380 }} onClick={(e) => e.stopPropagation()}>
+ <p className="confirm__msg" style={{ fontWeight: 600 }}>
+ {retry ? "That passphrase didn't work" : 'Passphrase required'}
+ </p>
+ <p className="confirm__msg" style={{ opacity: 0.8 }}>
+ {retry ? `Try again for ${baseName(identityFile)}.` : `${baseName(identityFile)} is passphrase-protected.`}
+ {target ? ` Unlocking for ${target}.` : ''}
+ </p>
+ <Input
+ autoFocus
+ type="password"
+ autoComplete="off"
+ spellCheck={false}
+ // Named so a password manager can offer the right entry, and so the field is not
+ // mistaken for a login form: this unlocks a local key file, it is not a server credential.
+ aria-label={`Passphrase for ${baseName(identityFile)}`}
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ onKeyDown={(e) => {
+ // preventDefault so the key is consumed here rather than bubbling to a sibling modal's
+ // window listener (InputDialog:53-59 does the same).
+ if (e.key === 'Enter') {
+ e.preventDefault()
+ submit()
+ } else if (e.key === 'Escape') {
+ e.preventDefault()
+ onCancel()
+ }
+ }}
+ className="my-2 mb-3.5 w-full"
+ />
+ <div className="confirm__actions">
+ <Button onClick={onCancel}>Cancel</Button>
+ <Button variant="primary" onClick={submit} disabled={!value}>
+ Unlock
+ </Button>
+ </div>
+ </div>
+ </div>,
+ document.body
+ )
+}
diff --git a/src/renderer/components/SshProjectDialog.tsx b/src/renderer/components/SshProjectDialog.tsx
index c85244041..4630802fe 100644
--- a/src/renderer/components/SshProjectDialog.tsx
+++ b/src/renderer/components/SshProjectDialog.tsx
@@ -2,6 +2,8 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { useDialogStack } from './dialog-stack'
import { useSshServers } from '../state/sshServers'
+import { Button } from '@renderer/ui/Button'
+import { Input } from '@renderer/ui/Input'
import type { SshServer } from '@shared/ssh'
interface SshProjectDialogProps {
@@ -185,18 +187,16 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
)}
</div>
<div className="confirm__actions">
- <button className="confirm__btn" onClick={close}>
- Cancel
- </button>
- <button
- className="confirm__btn primary"
+ <Button onClick={close}>Cancel</Button>
+ <Button
+ variant="primary"
onClick={() => {
onManage()
close()
}}
>
Add server…
- </button>
+ </Button>
</div>
</>
)
@@ -204,16 +204,20 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
if (step === 'connecting') {
return (
<>
- <p className="confirm__msg" style={{ fontWeight: 600 }}>
+ {/* The spinner is the app's shared `.ui-spinner`, the same one the Accounts section
+ uses for a mid-setup button, so a connecting SSH project reads like every other
+ "working" state rather than a one-off. This step can sit here for a while: if the
+ key needs a passphrase the prompt arrives as a separate dialog on top, and a human
+ can take a minute to answer, so a static line looked hung. */}
+ <p className="confirm__msg" style={{ fontWeight: 600, display: 'flex', alignItems: 'center', gap: 8 }}>
+ <span className="ui-spinner" aria-hidden />
Connecting to {server?.label}…
</p>
<p className="confirm__msg" style={{ opacity: 0.7 }}>
- Establishing the SSH connection.
+ {server ? `Establishing the SSH connection to ${server.user}@${server.host}.` : 'Establishing the SSH connection.'}
</p>
<div className="confirm__actions">
- <button className="confirm__btn" onClick={close}>
- Cancel
- </button>
+ <Button onClick={close}>Cancel</Button>
</div>
</>
)
@@ -228,15 +232,10 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
{error}
</p>
<div className="confirm__actions">
- <button className="confirm__btn" onClick={close}>
- Close
- </button>
- <button
- className="confirm__btn primary"
- onClick={() => server && void connect(server)}
- >
+ <Button onClick={close}>Close</Button>
+ <Button variant="primary" onClick={() => server && void connect(server)}>
Retry
- </button>
+ </Button>
</div>
</>
)
@@ -258,17 +257,11 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
color: 'var(--muted)'
}}
>
- <button
- className="confirm__btn"
- style={{ padding: '3px 9px' }}
- disabled={atRoot}
- onClick={() => void list(parentDir(path))}
- >
+ <Button className="px-2.5 py-0.5" disabled={atRoot} onClick={() => void list(parentDir(path))}>
↑ Up
- </button>
- <button
- className="confirm__btn"
- style={{ padding: '3px 9px' }}
+ </Button>
+ <Button
+ className="px-2.5 py-0.5"
onClick={() => {
setMkdirErr('')
setNewName('')
@@ -276,7 +269,7 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
}}
>
+ New folder
- </button>
+ </Button>
<span
title={path}
style={{
@@ -292,7 +285,7 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
</div>
{creating && (
<div style={{ display: 'flex', gap: 8, margin: '0 0 8px' }}>
- <input
+ <Input
autoFocus
value={newName}
placeholder="Folder name"
@@ -305,14 +298,13 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
setMkdirErr('')
}
}}
- style={{ flex: 1, minWidth: 0 }}
+ className="min-w-0 flex-1"
/>
- <button className="confirm__btn primary" style={{ padding: '3px 9px' }} onClick={() => void createFolder()}>
+ <Button variant="primary" className="px-2.5 py-0.5" onClick={() => void createFolder()}>
Create
- </button>
- <button
- className="confirm__btn"
- style={{ padding: '3px 9px' }}
+ </Button>
+ <Button
+ className="px-2.5 py-0.5"
onClick={() => {
setCreating(false)
setNewName('')
@@ -320,7 +312,7 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
}}
>
Cancel
- </button>
+ </Button>
</div>
)}
{mkdirErr && (
@@ -354,12 +346,10 @@ export function SshProjectDialog({ onCreate, onManage, onClose }: SshProjectDial
)}
</div>
<div className="confirm__actions">
- <button className="confirm__btn" onClick={close}>
- Cancel
- </button>
- <button className="confirm__btn primary" onClick={useThisFolder}>
+ <Button onClick={close}>Cancel</Button>
+ <Button variant="primary" onClick={useThisFolder}>
Use this folder
- </button>
+ </Button>
</div>
</>
)
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx
index f2f204b6d..58889c704 100644
--- a/src/renderer/components/TabBar.tsx
+++ b/src/renderer/components/TabBar.tsx
@@ -26,11 +26,11 @@ interface TabBarProps {
/** Reorder a project to sit before another (null = to the end). Shared with the sessions
* sidebar: both surfaces render the projects array, so one drag updates both. */
onReorder: (draggedId: string, beforeId: string | null) => void
- /** Open the start screen (New project / Open folder / Clone repo) — what "+" now shows. */
+ /** Open the start screen (New project / Open folder / Clone repo), what "+" now shows. */
onOpenWelcome: () => void
onRename: (id: string, name: string) => void
onSetFolder: (id: string) => void
- /** Close (hide) the project without destroying it — reopenable from the start screen. */
+ /** Close (hide) the project without destroying it, reopenable from the start screen. */
onCloseProject: (id: string) => void
/** Open the Remote access dialog (host/share + connect). Shown for every project. */
onRemoteAccess: () => void
@@ -42,7 +42,7 @@ interface TabBarProps {
/**
* The runtime session dimension of a tab (which core the project lives on). Rendered ONLY when
- * more than one session exists — `sessionCount()` is 1 for a solo user today, so this never
+ * more than one session exists, `sessionCount()` is 1 for a solo user today, so this never
* mounts and the solo tab bar is pixel-identical. Its own component because
* `useProjectSession` is a hook and the tabs render in a `.map()`. Nothing here is persisted:
* the project → session binding is resolved at runtime by `sessionForProject`.
@@ -57,7 +57,7 @@ function TabSessionLabel({ projectId }: { projectId: string }) {
}
/**
- * Top tab bar — one tab per project. Click to switch, "+" to add. The active tab
+ * Top tab bar, one tab per project. Click to switch, "+" to add. The active tab
* exposes a caret menu (Rename / Set folder / Delete). The menu is rendered in a body
* portal with fixed positioning so it is never clipped by the tab strip's overflow nor
* hidden behind the canvas.
@@ -74,14 +74,14 @@ export function TabBar({
onSetDefaultAccount,
onSetDefaultPermissionMode
}: TabBarProps) {
- // Select the raw array and filter in a memo — a `.filter()` inside the selector returns a
+ // Select the raw array and filter in a memo, a `.filter()` inside the selector returns a
// fresh array every store snapshot, which re-rendered the TabBar on EVERY projects change.
const allProjects = useProjects((s) => s.projects)
// Closed projects are hidden here (reopen them from the start screen's "Recently closed").
const projects = useMemo(() => allProjects.filter((p) => !p.closed), [allProjects])
const activeId = useProjects((s) => s.activeProjectId)
const kanbanActive = useViewMode((s) => !!activeId && !!s.viewByProject[activeId])
- // Unread dots need only the unread id set — subscribing to the whole status map re-rendered
+ // Unread dots need only the unread id set, subscribing to the whole status map re-rendered
// the TabBar on every working/waiting flip of any agent. Primitive signature → rare updates.
const unreadIds = useAgentStatus((s) => {
let ids = ''
@@ -105,7 +105,7 @@ export function TabBar({
// Whether the caret menu's "Default permission mode" group is expanded (same idiom as acctOpen).
const [modeOpen, setModeOpen] = useState(false)
const claudeAccounts = useSettings((s) => s.settings.claudeAccounts)
- // The mode a project without an override falls back to — shown in the "Use global (…)" entry.
+ // The mode a project without an override falls back to, shown in the "Use global (…)" entry.
const globalMode = useSettings((s) => s.settings.claudePermissionMode)
const systemLabelSetting = useSettings((s) => s.settings.systemAccountLabel)
const systemEmail = useSystemAccount((s) => s.email)
@@ -113,7 +113,7 @@ export function TabBar({
// Session labels appear only once a second session exists (4c: remote tabs). For a solo user
// this is always false, so the tab strip renders exactly as before. Plain call, not a
- // subscription: sessions are registered at boot (and, in 4c, on connect — which re-renders
+ // subscription: sessions are registered at boot (and, in 4c, on connect, which re-renders
// through its own state), so no store is needed here.
const multiSession = sessionCount() > 1
@@ -154,7 +154,7 @@ export function TabBar({
setMenuPos({ top: r.bottom + 4, left: r.left, flipBase: r.top - 4 })
}
- // Viewport-edge flip for the caret menu — same behavior as the right-click ContextMenu. The
+ // Viewport-edge flip for the caret menu, same behavior as the right-click ContextMenu. The
// hook runs unconditionally (menuPos may be null while closed; the ref is simply unattached
// then) and re-measures on size changes, so EXPANDING the account/permission sub-lists near
// the bottom edge lifts the menu instead of growing it off-screen.
@@ -289,14 +289,24 @@ export function TabBar({
p.unavailable
? sessionForProject(p.id).source === 'local'
? `${p.cwd ?? 'project'} is unavailable (folder missing or unreachable)`
- : `${p.name} disconnected — click to reconnect`
- : p.cwd || undefined
+ : `${p.name} disconnected, click to reconnect`
+ : p.ssh
+ ? `${p.ssh.server.user}@${p.ssh.server.host}:${p.ssh.remoteCwd}`
+ : p.cwd || undefined
}
>
<span
className="tab__dot"
style={active ? { background: p.color } : undefined}
/>
+ {/* An SSH project looks identical to a local one once it is named, and the
+ difference matters: its terminals, git and file ops all run on another
+ machine. The chip says so at a glance; the tab title carries user@host. */}
+ {p.ssh && (
+ <span className="tab__ssh" title={`${p.ssh.server.user}@${p.ssh.server.host}`}>
+ SSH
+ </span>
+ )}
{editingId === p.id ? (
<input
className="tab__edit"
@@ -328,7 +338,7 @@ export function TabBar({
className="tab__board-toggle"
title={kanbanActive ? 'Canvas view (⌘⇧B)' : 'Kanban view (⌘⇧B)'}
onClick={(e) => {
- e.stopPropagation() // a tab click switches projects — this only flips the view
+ e.stopPropagation() // a tab click switches projects, this only flips the view
useViewMode.getState().toggle(p.id)
}}
>
@@ -442,7 +452,7 @@ export function TabBar({
<div className="tab-menu__sub">
<button
// On an SSH project the global Auto only applies once the REMOTE CLI is
- // confirmed — surface why it may currently do nothing (see menuAutoHint).
+ // confirmed, surface why it may currently do nothing (see menuAutoHint).
title={globalMode === 'auto' ? (menuAutoHint ?? undefined) : undefined}
onClick={() => {
onSetDefaultPermissionMode(menuProject.id, undefined)
@@ -459,10 +469,10 @@ export function TabBar({
<button
key={m}
// A project override is written to <cwd>/.nodeterm/project.json, which is
- // git-shared and mirrored to SSH servers — spell out for "Bypass all" that
+ // git-shared and mirrored to SSH servers, spell out for "Bypass all" that
// the choice travels to everyone who clones the repo. The Auto row instead
// explains when it will NOT apply on this SSH project's host (remote CLI too
- // old / not found / not probed yet) — still selectable: the setting is kept
+ // old / not found / not probed yet), still selectable: the setting is kept
// and applies the moment the host's CLI qualifies.
title={
m === 'bypassPermissions'
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index f62a463ba..26b753fde 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -151,6 +151,22 @@ body,
text-decoration: line-through;
}
+/* Marks a project whose terminals run on another machine. Deliberately a text chip rather than
+ an icon: the only remote-ish glyph in icons.tsx (IconRemote) already means "web view" on this
+ canvas, and reusing it would conflate a browser node with an SSH host. */
+.tab__ssh {
+ flex-shrink: 0;
+ font-size: 9px;
+ font-weight: 600;
+ letter-spacing: 0.06em;
+ line-height: 1;
+ padding: 2px 4px;
+ border: 1px solid var(--border);
+ border-radius: 4px;
+ color: var(--muted);
+ opacity: 0.85;
+}
+
.tab__dot {
width: 9px;
height: 9px;