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(codex): account presentation + Local/SSH provenance pills

Claude Code61c7e374b9fb
diff --git a/src/renderer/components/AccountIdentityPills.test.tsx b/src/renderer/components/AccountIdentityPills.test.tsx
new file mode 100644
index 000000000..a320c099e
--- /dev/null
+++ b/src/renderer/components/AccountIdentityPills.test.tsx
@@ -0,0 +1,33 @@
+import { renderToStaticMarkup } from 'react-dom/server'
+import { describe, expect, it } from 'vitest'
+import { AccountIdentityPills } from './AccountIdentityPills'
+
+describe('AccountIdentityPills', () => {
+ it('renders identity and provenance from the same presentation object', () => {
+ const html = renderToStaticMarkup(
+ <AccountIdentityPills
+ account={{
+ identity: 'Work',
+ provenance: 'SSH · Ubuntu WSL',
+ tooltip: 'Work ([email protected]) · SSH corvin@devbox'
+ }}
+ selected
+ />
+ )
+ expect(html).toContain('Work')
+ expect(html).toContain('SSH · Ubuntu WSL')
+ expect(html).toContain('Selected')
+ // The credential-storage kind must never reach the DOM.
+ expect(html).not.toContain('system')
+ expect(html).not.toContain('managed')
+ })
+
+ it('omits the selected check unless the account is chosen', () => {
+ const html = renderToStaticMarkup(
+ <AccountIdentityPills
+ account={{ identity: 'Home', provenance: 'Local', tooltip: 'Home · This Mac' }}
+ />
+ )
+ expect(html).not.toContain('Selected')
+ })
+})
diff --git a/src/renderer/components/AccountIdentityPills.tsx b/src/renderer/components/AccountIdentityPills.tsx
new file mode 100644
index 000000000..47c141a9f
--- /dev/null
+++ b/src/renderer/components/AccountIdentityPills.tsx
@@ -0,0 +1,38 @@
+// S6 PR 8 — the identity + provenance pills rendered on every Codex account surface (settings,
+// node chrome, create/switch menus). Based on @Corvin's #112 (`AccountIdentityPills.tsx`).
+
+import type { AccountPresentation } from '../lib/accountPresentation'
+
+/**
+ * Renders a presented account as an identity pill + a Local/SSH provenance pill, with an optional
+ * "selected" check. The whole cluster shares one native tooltip (the presentation's `tooltip`), so
+ * the same account reads identically wherever it appears.
+ */
+export function AccountIdentityPills({
+ account,
+ selected = false,
+ warning = false,
+ className = ''
+}: {
+ account: AccountPresentation
+ selected?: boolean
+ warning?: boolean
+ className?: string
+}): React.JSX.Element {
+ return (
+ <span
+ className={`account-identity-pills${warning ? ' account-identity-pills--warning' : ''}${
+ className ? ` ${className}` : ''
+ }`}
+ title={account.tooltip}
+ >
+ <span className="account-identity-pill">{account.identity}</span>
+ <span className="account-provenance-pill">{account.provenance}</span>
+ {selected ? (
+ <span className="account-identity-check" aria-label="Selected">
+ ✓
+ </span>
+ ) : null}
+ </span>
+ )
+}
diff --git a/src/renderer/lib/accountPresentation.test.ts b/src/renderer/lib/accountPresentation.test.ts
new file mode 100644
index 000000000..78d875439
--- /dev/null
+++ b/src/renderer/lib/accountPresentation.test.ts
@@ -0,0 +1,50 @@
+import { describe, expect, it } from 'vitest'
+import { presentAccount } from './accountPresentation'
+
+describe('presentAccount', () => {
+ it('uses a chosen name before the email and identifies a local login', () => {
+ expect(presentAccount({ label: 'Work', email: '[email protected]' })).toEqual({
+ identity: 'Work',
+ provenance: 'Local',
+ tooltip: 'Work ([email protected]) · This Mac'
+ })
+ })
+
+ it('falls back to email and never exposes system or managed storage terminology', () => {
+ expect(
+ presentAccount({
+ label: 'System Codex account',
+ })
+ ).toEqual({
+ identity: '[email protected]',
+ provenance: 'Local',
+ tooltip: '[email protected] · This Mac'
+ })
+ // A row still carrying the generated placeholder collapses to "Default account".
+ expect(presentAccount({ label: 'New Codex account' }).identity).toBe('Default account')
+ // The provenance/tooltip must never leak the credential-storage kind.
+ const t = presentAccount({ label: 'New Codex account' }).tooltip
+ expect(t).not.toMatch(/managed|system/i)
+ })
+
+ it('uses one SSH provenance format with the friendly machine name', () => {
+ expect(
+ presentAccount({
+ email: '[email protected]',
+ host: 'corvin@devbox',
+ machineLabel: 'Ubuntu WSL'
+ })
+ ).toEqual({
+ identity: '[email protected]',
+ provenance: 'SSH · Ubuntu WSL',
+ tooltip: '[email protected] · SSH corvin@devbox'
+ })
+ })
+
+ it('falls back to the raw host when no friendly machine label is saved', () => {
+ // The `host ?` branch is provenance's load-bearing local/SSH split — with the machineLabel
+ // absent the raw `user@host` must still read as SSH, never as Local.
+ expect(presentAccount({ email: 'r@x', host: 'me@box' }).provenance).toBe('SSH · me@box')
+ })
+})
diff --git a/src/renderer/lib/accountPresentation.ts b/src/renderer/lib/accountPresentation.ts
new file mode 100644
index 000000000..9d5c09edc
--- /dev/null
+++ b/src/renderer/lib/accountPresentation.ts
@@ -0,0 +1,66 @@
+// S6 PR 8 — the single account-display contract shared by settings, node chrome, and account
+// menus. Based on @Corvin's #112 (`src/renderer/lib/accountPresentation.ts`).
+//
+// This module is renderer-pure: it imports nothing from `src/core`, so presenting an account
+// never drags the impure core path machinery into the bundle.
+
+export interface AccountPresentation {
+ /** Human identity: a chosen account name, otherwise the login email. */
+ identity: string
+ /** Short origin pill rendered beside the identity on every account surface. */
+ provenance: string
+ /** Full, stable explanation for native tooltips. */
+ tooltip: string
+}
+
+/**
+ * Auto-generated placeholder labels that must NOT be shown as a chosen identity — a row still
+ * carrying one of these has never been named by the user, so we fall through to the email (or
+ * "Default account"). Kept lowercase; matched case-insensitively.
+ */
+const GENERATED_LABELS = new Set([
+ 'new account',
+ 'new codex account',
+ 'system account',
+ 'system codex account'
+])
+
+function chosenLabel(label: string | null | undefined): string | undefined {
+ const value = label?.trim()
+ if (!value || GENERATED_LABELS.has(value.toLowerCase())) return undefined
+ return value
+}
+
+/**
+ * Single account-display contract shared by settings, node chrome, and account menus.
+ *
+ * The *credential storage kind* (system vs managed directory) is deliberately NOT user-facing:
+ * users select a person/login and the machine it lives on, not an implementation directory. The
+ * only origin fact surfaced is machine provenance — `Local` or `SSH · <machineLabel>`.
+ */
+export function presentAccount({
+ label,
+ email,
+ host,
+ machineLabel
+}: {
+ label?: string | null
+ email?: string | null
+ /** Canonical SSH address (`user@host`). Omit for an account on this Mac. */
+ host?: string | null
+ /** Friendly saved SSH-machine name. */
+ machineLabel?: string | null
+}): AccountPresentation {
+ const displayLabel = chosenLabel(label)
+ const cleanEmail = email?.trim() || undefined
+ const identity = displayLabel || cleanEmail || 'Default account'
+ const provenance = host ? `SSH · ${machineLabel?.trim() || host}` : 'Local'
+ const originDetail = host ? `SSH ${host}` : 'This Mac'
+ const identityDetail =
+ cleanEmail && cleanEmail !== identity ? `${identity} (${cleanEmail})` : identity
+ return {
+ identity,
+ provenance,
+ tooltip: `${identityDetail} · ${originDetail}`
+ }
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index dea1a44f2..81830802a 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -10940,3 +10940,51 @@ body,
* {
scrollbar-width: thin;
}
+
+/* S6 — account identity + provenance pills (AccountIdentityPills). One cluster wherever a Codex
+ account is shown (settings, node chrome, create/switch menus) so an account reads identically
+ everywhere. Theme-aware via --tint-rgb / semantic tokens; no new colour language. */
+.account-identity-pills {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ vertical-align: middle;
+}
+.account-identity-pill {
+ max-width: 22ch;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ padding: 1px 8px;
+ border-radius: 999px;
+ font-size: 12px;
+ font-weight: 500;
+ color: var(--text);
+ background: rgba(var(--tint-rgb), 0.08);
+}
+.account-provenance-pill {
+ flex: none;
+ padding: 1px 8px;
+ border-radius: 999px;
+ font-size: 11px;
+ font-weight: 500;
+ color: var(--muted);
+ background: rgba(var(--tint-rgb), 0.05);
+ border: 1px solid var(--border);
+}
+.account-identity-check {
+ flex: none;
+ font-size: 12px;
+ line-height: 1;
+ color: var(--accent);
+}
+/* A managed home that is missing / an account that cannot be operated: the same cluster, warned.
+ Recolour text + outline with the warn token; no tinted fill (there is no --warn-rgb to build
+ a translucent background from, and the theme guard forbids referencing an undefined variable). */
+.account-identity-pills--warning .account-identity-pill,
+.account-identity-pills--warning .account-provenance-pill {
+ color: var(--warn);
+ border: 1px solid var(--warn);
+ background: transparent;
+}