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
Merge branch 'main' into feat/claude-account-tracking
freshjuicezb069977a1639
diff --cc src/core/claude-accounts-core.test.tsindex 1976d8122,05eb14e73..7f69dffdc--- a/src/core/claude-accounts-core.test.ts+++ b/src/core/claude-accounts-core.test.ts@@@ -257,297 -253,3 +257,305 @@@ describe('isSafeRemoteTranscriptPath',expect(isSafeRemoteTranscriptPath('/home/enes/.claude/projects/x.jsonl', undefined)).toBe(false)})})++// ---- Observed accounts (design D1/D2) --------------------------------------------------------+//+// The whole feature turns on these three pure functions, so each is driven with BOTH path+// dialects: the desktop that classifies an SSH node's POSIX `transcript_path` may itself be+// running on Windows, and the config dir a Windows user posts is `C:\Users\x\.claude`.++describe('configDirFromTranscriptPath', () => {+ it('walks up to the projects root and names its parent (POSIX)', () => {+ expect(+ configDirFromTranscriptPath('/home/u/.claude/projects/-home-u-repo/abc-123.jsonl')+ ).toBe('/home/u/.claude')+ expect(+ configDirFromTranscriptPath('/home/u/.claude-2/projects/-home-u-repo/abc-123.jsonl')+ ).toBe('/home/u/.claude-2')+ })++ it('handles a Windows-shaped path', () => {+ expect(+ configDirFromTranscriptPath('C:\\Users\\x\\.claude\\projects\\slug\\id.jsonl')+ ).toBe('C:\\Users\\x\\.claude')+ // Forward slashes are separators on Windows too, and a drive letter is what says so.+ expect(configDirFromTranscriptPath('C:/Users/x/.claude-2/projects/slug/id.jsonl')).toBe(+ 'C:\\Users\\x\\.claude-2'+ )+ expect(+ configDirFromTranscriptPath('\\\\srv\\share\\.claude\\projects\\slug\\id.jsonl')+ ).toBe('\\\\srv\\share\\.claude')+ })++ it('resolves a SUBAGENT transcript nested deeper under the same projects root', () => {+ expect(+ configDirFromTranscriptPath('/home/u/.claude-2/projects/-repo/parent/sub/agent.jsonl')+ ).toBe('/home/u/.claude-2')+ })++ it('takes the NEAREST projects walking up, not the first one in the path', () => {+ // Someone who keeps their checkouts in ~/projects: taking the FIRST match would answer+ // `/home/u` — i.e. hand the jail a $HOME-wide root.+ expect(+ configDirFromTranscriptPath('/home/u/projects/.claude/projects/-repo/s.jsonl')+ ).toBe('/home/u/projects/.claude')+ })++ it('normalizes the answer (redundant separators, `.`, a resolved `..`)', () => {+ expect(configDirFromTranscriptPath('/home/u//.claude/./projects/slug/s.jsonl')).toBe(+ '/home/u/.claude'+ )+ expect(configDirFromTranscriptPath('/home/u/x/../.claude/projects/slug/s.jsonl')).toBe(+ '/home/u/.claude'+ )+ })++ it('is null when there is no projects segment to walk up to', () => {+ expect(configDirFromTranscriptPath('/home/u/.claude/settings.json')).toBeNull()+ expect(configDirFromTranscriptPath('/home/u/projects')).toBeNull() // no parent-of-projects file+ expect(configDirFromTranscriptPath('')).toBeNull()+ expect(configDirFromTranscriptPath(' ')).toBeNull()+ expect(configDirFromTranscriptPath(undefined as unknown as string)).toBeNull()+ // A sibling-prefix segment is not a `projects` segment.+ expect(configDirFromTranscriptPath('/home/u/.claude/projects-evil/s.jsonl')).toBeNull()+ })++ it('takes an explicit dialect when the caller knows the owning filesystem', () => {+ // A relative Windows path has no drive letter to detect, so the caller must say.+ expect(configDirFromTranscriptPath('x\\.claude\\projects\\s\\id.jsonl', 'win32')).toBe(+ 'x\\.claude'+ )+ // …and the same string read as POSIX is one segment with backslashes IN ITS NAME.+ expect(configDirFromTranscriptPath('x\\.claude\\projects\\s\\id.jsonl', 'posix')).toBeNull()+ })+})++describe('normalizeLinkedConfigDir', () => {+ it('accepts an absolute path and normalizes it', () => {+ expect(normalizeLinkedConfigDir('/home/u/.claude-2')).toBe('/home/u/.claude-2')+ expect(normalizeLinkedConfigDir('/home/u/.claude-2/')).toBe('/home/u/.claude-2')+ expect(normalizeLinkedConfigDir(' /home/u//./.claude-2 ')).toBe('/home/u/.claude-2')+ expect(normalizeLinkedConfigDir('C:\\Users\\x\\.claude-2\\')).toBe('C:\\Users\\x\\.claude-2')+ expect(normalizeLinkedConfigDir('C:/Users/x/.claude-2')).toBe('C:\\Users\\x\\.claude-2')+ })++ it('never strips a path down INTO its root', () => {+ expect(normalizeLinkedConfigDir('/')).toBe('/')+ expect(normalizeLinkedConfigDir('C:\\')).toBe('C:\\')+ })++ it('refuses anything that is not an absolute, `..`-free string', () => {+ expect(normalizeLinkedConfigDir('.claude-2')).toBeNull()+ expect(normalizeLinkedConfigDir('~/.claude-2')).toBeNull() // `~` is the caller's to expand+ expect(normalizeLinkedConfigDir('../.claude-2')).toBeNull()+ expect(normalizeLinkedConfigDir('')).toBeNull()+ expect(normalizeLinkedConfigDir(' ')).toBeNull()+ expect(normalizeLinkedConfigDir(undefined)).toBeNull()+ expect(normalizeLinkedConfigDir(null)).toBeNull()+ expect(normalizeLinkedConfigDir(42)).toBeNull()+ expect(normalizeLinkedConfigDir({ configDir: '/x' })).toBeNull()+ })++ it('resolves a `..` that normalize can absorb rather than refusing it', () => {+ expect(normalizeLinkedConfigDir('/home/u/x/../.claude-2')).toBe('/home/u/.claude-2')+ // …and one that walks past the root is clamped by normalize, never left as `..`.+ expect(normalizeLinkedConfigDir('/../../etc')).toBe('/etc')+ })+})++describe('classifyClaudeConfigDir', () => {+ const homeDir = '/home/u'+ const userDataDir = '/home/u/.config/nodeterm'+ const linked: ClaudeAccount = {+ id: 'linked-1',+ label: 'second',+ configDir: '/home/u/.claude-2',+ createdAt: 0+ }+ const at = (dir: string, accounts: ClaudeAccount[] = [linked]) =>+ classifyClaudeConfigDir(dir, { homeDir, userDataDir, accounts })++ it('names a MANAGED local dir by its id, without consulting settings', () => {+ // The path IS nodeterm's own root, so the id in it is the id nodeterm minted — including for+ // an account still `pending` its login, whose login node is the session posting from there.+ expect(at(`${userDataDir}/claude-accounts/abc-1`, [])).toEqual({+ configDir: `${userDataDir}/claude-accounts/abc-1`,+ accountId: 'abc-1',+ known: true+ })+ })++ it('names a MANAGED REMOTE dir by its id (an SSH node posts the host path)', () => {+ expect(at('/home/enes/.nodeterm/claude-accounts/xyz_2', [])).toEqual({+ configDir: '/home/enes/.nodeterm/claude-accounts/xyz_2',+ accountId: 'xyz_2',+ known: true+ })+ })++ it('names a LINKED dir by its account id, trailing slash and `.`-segments included', () => {+ for (const p of ['/home/u/.claude-2', '/home/u/.claude-2/', '/home/u/./.claude-2']) {+ expect(at(p)).toEqual({ configDir: '/home/u/.claude-2', accountId: 'linked-1', known: true })+ }+ })++ it('ignores a linked row that is pending, host-scoped, or holds an unusable path', () => {+ const unusable: ClaudeAccount[] = [+ { ...linked, id: 'p', pending: true },+ { ...linked, id: 'h', host: 'u@example' },+ { ...linked, id: 'rel', configDir: '.claude-2' },+ { ...linked, id: 'dots', configDir: '/home/u/../u/.claude-2' } // normalizes to the same dir+ ]+ // The first three contribute nothing; the fourth normalizes onto the observed dir and wins.+ expect(at('/home/u/.claude-2', unusable).accountId).toBe('dots')+ expect(at('/home/u/.claude-2', unusable.slice(0, 3))).toEqual({+ configDir: '/home/u/.claude-2',+ accountId: null,+ known: false+ })+ })++ it('calls the system dir system — this machine`s and a remote host`s alike', () => {+ expect(at('/home/u/.claude')).toEqual({+ configDir: '/home/u/.claude',+ accountId: null,+ known: true+ })+ // D2 is host-agnostic on purpose: an SSH node's `<remoteHome>/.claude` is that host's system+ // account, and the observed dir is a label — nothing branches on it for permission.+ expect(at('/home/enes/.claude')).toEqual({+ configDir: '/home/enes/.claude',+ accountId: null,+ known: true+ })+ })++ it('prefers a LINKED match over the `.claude` basename rule', () => {+ const odd: ClaudeAccount = { id: 'odd', label: 'o', configDir: '/opt/profiles/.claude', createdAt: 0 }+ expect(at('/opt/profiles/.claude', [odd]).accountId).toBe('odd')+ })++ it('leaves an unrecorded dir unknown — and never reads it', () => {+ // The real motivating case BEFORE the user links it: the chip labels it `.claude-3` by path.+ expect(at('/home/u/.claude-3', [])).toEqual({+ configDir: '/home/u/.claude-3',+ accountId: null,+ known: false+ })+ // A forged POST aiming at a credential tree is unknown too — a label, and nothing is opened.+ expect(at('/home/u/.ssh', [])).toEqual({+ configDir: '/home/u/.ssh',+ accountId: null,+ known: false+ })+ // A bad id segment under the managed root is NOT a managed account.+ expect(at(`${userDataDir}/claude-accounts/a.b`, [])).toEqual({+ configDir: `${userDataDir}/claude-accounts/a.b`,+ accountId: null,+ known: false+ })+ // …nor is a dir two levels down inside one.+ expect(at(`${userDataDir}/claude-accounts/a1/projects`, []).known).toBe(false)+ })++ it('classifies Windows-shaped dirs, case-insensitively as that filesystem is', () => {+ const win = (dir: string, accounts: ClaudeAccount[] = []) =>+ classifyClaudeConfigDir(dir, {+ homeDir: 'C:\\Users\\x',+ userDataDir: 'C:\\Users\\x\\AppData\\Roaming\\nodeterm',+ accounts+ })+ expect(win('C:\\Users\\x\\.claude')).toEqual({+ configDir: 'C:\\Users\\x\\.claude',+ accountId: null,+ known: true+ })+ expect(win('C:\\Users\\x\\AppData\\Roaming\\nodeterm\\claude-accounts\\a1').accountId).toBe('a1')+ expect(+ win('c:\\users\\X\\.claude-2\\', [+ { id: 'w1', label: 'w', configDir: 'C:\\Users\\x\\.claude-2', createdAt: 0 }+ ]).accountId+ ).toBe('w1')+ })++ it('does not match a POSIX dir against a WINDOWS local root (or the reverse)', () => {+ // A Windows desktop classifying an SSH node's POSIX path must not confuse the two trees —+ // and `/home/u/.claude` still reads as a system dir through the host-agnostic basename rule.+ const onWindows = classifyClaudeConfigDir('/home/u/.claude-2', {+ homeDir: 'C:\\Users\\x',+ userDataDir: 'C:\\Users\\x\\AppData\\Roaming\\nodeterm',+ accounts: [{ id: 'w1', label: 'w', configDir: 'C:\\Users\\x\\.claude-2', createdAt: 0 }]+ })+ expect(onWindows).toEqual({ configDir: '/home/u/.claude-2', accountId: null, known: false })+ })+})++describe('transcriptRootFor — linked accounts', () => {+ it('uses the linked config dir`s projects when one is given', () => {+ expect(transcriptRootFor('/Users/x', '/ud', 'a1', '/Users/x/.claude-2')).toBe(+ '/Users/x/.claude-2/projects'+ )+ // A linked root does not need the account id to be resolvable as a managed one.+ expect(transcriptRootFor('/Users/x', null, undefined, '/Users/x/.claude-2')).toBe(+ '/Users/x/.claude-2/projects'+ )+ })+ it('degrades to the managed/system root when the linked value is unusable', () => {+ // "Never something more destructive than the default" — a hand-edited relative path must not+ // resolve against the process cwd.+ expect(transcriptRootFor('/Users/x', '/ud', 'a1', '.claude-2')).toBe(+ '/ud/claude-accounts/a1/projects'+ )+ expect(transcriptRootFor('/Users/x', '/ud', undefined, '')).toBe('/Users/x/.claude/projects')+ })+})++describe('isSafeLocalTranscriptPath — linked config dirs', () => {+ const home = '/home/u'+ const ud = '/home/u/.config/nodeterm'+ const linkedDirs = ['/home/u/.claude-2']++ it('accepts <linkedDir>/projects and everything under it', () => {- expect(isSafeLocalTranscriptPath(`${home}/.claude-2/projects`, home, ud, undefined, linkedDirs)).toBe(true)+ expect(- isSafeLocalTranscriptPath(`${home}/.claude-2/projects/-repo/s.jsonl`, home, ud, undefined, linkedDirs)++ isSafeLocalTranscriptPath(`${home}/.claude-2/projects`, home, ud, undefined, undefined, linkedDirs)++ ).toBe(true)++ expect(++ isSafeLocalTranscriptPath(`${home}/.claude-2/projects/-repo/s.jsonl`, home, ud, undefined, undefined, linkedDirs)+ ).toBe(true)+ })++ it('still refuses everything ELSE in that dir — the `.ssh` case §3 names', () => {- expect(isSafeLocalTranscriptPath(`${home}/.claude-2/.ssh`, home, ud, undefined, linkedDirs)).toBe(false)++ expect(isSafeLocalTranscriptPath(`${home}/.claude-2/.ssh`, home, ud, undefined, undefined, linkedDirs)).toBe(false)+ expect(- isSafeLocalTranscriptPath(`${home}/.claude-2/.credentials.json`, home, ud, undefined, linkedDirs)++ isSafeLocalTranscriptPath(`${home}/.claude-2/.credentials.json`, home, ud, undefined, undefined, linkedDirs)+ ).toBe(false)- expect(isSafeLocalTranscriptPath(`${home}/.claude-2`, home, ud, undefined, linkedDirs)).toBe(false)++ expect(isSafeLocalTranscriptPath(`${home}/.claude-2`, home, ud, undefined, undefined, linkedDirs)).toBe(false)+ // A sibling-prefix root, as for every other allowed root.+ expect(- isSafeLocalTranscriptPath(`${home}/.claude-2/projects-evil/x`, home, ud, undefined, linkedDirs)++ isSafeLocalTranscriptPath(`${home}/.claude-2/projects-evil/x`, home, ud, undefined, undefined, linkedDirs)+ ).toBe(false)+ // The PARENT of a linked dir is not opened up by linking the child.- expect(isSafeLocalTranscriptPath(`${home}/projects/x.jsonl`, home, ud, undefined, linkedDirs)).toBe(false)++ expect(++ isSafeLocalTranscriptPath(`${home}/projects/x.jsonl`, home, ud, undefined, undefined, linkedDirs)++ ).toBe(false)+ })++ it('contributes no root for a value that fails re-validation at the point of use', () => {+ // Hand-editable settings JSON: a relative or `..`-bearing dir is ignored, not resolved.- expect(isSafeLocalTranscriptPath(`${home}/.claude-2/projects/s.jsonl`, home, ud, undefined, ['.claude-2'])).toBe(- false- )- expect(isSafeLocalTranscriptPath('/etc/projects/x', home, ud, undefined, ['/etc/../etc'])).toBe(true)- expect(isSafeLocalTranscriptPath(`${home}/.ssh/id_rsa`, home, ud, undefined, ['/'])).toBe(false)++ expect(++ isSafeLocalTranscriptPath(`${home}/.claude-2/projects/s.jsonl`, home, ud, undefined, undefined, ['.claude-2'])++ ).toBe(false)++ expect(isSafeLocalTranscriptPath('/etc/projects/x', home, ud, undefined, undefined, ['/etc/../etc'])).toBe(true)++ expect(isSafeLocalTranscriptPath(`${home}/.ssh/id_rsa`, home, ud, undefined, undefined, ['/'])).toBe(false)+ })++ it('is bit-for-bit the old predicate when no linked dirs are passed', () => {+ expect(isSafeLocalTranscriptPath(`${home}/.claude-2/projects/s.jsonl`, home, ud)).toBe(false)- expect(isSafeLocalTranscriptPath(`${home}/.claude-2/projects/s.jsonl`, home, ud, undefined, [])).toBe(false)- expect(isSafeLocalTranscriptPath(`${home}/.claude/projects/s.jsonl`, home, ud, undefined, linkedDirs)).toBe(true)++ expect(++ isSafeLocalTranscriptPath(`${home}/.claude-2/projects/s.jsonl`, home, ud, undefined, undefined, [])++ ).toBe(false)++ expect(++ isSafeLocalTranscriptPath(`${home}/.claude/projects/s.jsonl`, home, ud, undefined, undefined, linkedDirs)++ ).toBe(true)+ })+})diff --cc src/core/claude-accounts-core.tsindex dc459d6ad,2a052b9ca..311e9fdda--- a/src/core/claude-accounts-core.ts+++ b/src/core/claude-accounts-core.ts@@@ -282,7 -89,7 +282,8 @@@ export function isSafeLocalTranscriptPahomeDir: string,userDataPath: string,codexHomeDir?: string,- grokHomeDir?: string++ grokHomeDir?: string,+ linkedDirs?: readonly string[]): boolean {const legacyRoot = path.join(homeDir, '.claude', 'projects')if (abs === legacyRoot || abs.startsWith(legacyRoot + path.sep)) return true@@@ -295,14 -102,14 +296,24 @@@if (abs === geminiRoot || abs.startsWith(geminiRoot + path.sep)) return trueconst codexRoot = path.join(codexHomeDir || path.join(homeDir, '.codex'), 'sessions')if (abs === codexRoot || abs.startsWith(codexRoot + path.sep)) return true- // Linked accounts (D4). `<dir>/projects` and below only — the `+ path.sep` is what keeps a- // sibling-prefix root (`…/projects-evil`) out, exactly as for the two roots above.+ // grok: `$GROK_HOME/sessions/<url-encoded cwd>/<sessionId>/`. `sessions` and not `$GROK_HOME`,+ // because the same tree holds `auth.json` — a home-wide allowance would put the user's bearer+ // token inside the jail this predicate exists to keep it out of. Same parameter discipline as+ // codex: the shells own the env (`grokHomeDir()` in `agents/grok-paths.ts` resolves $GROK_HOME),+ // this module stays pure path math, and getting it wrong fails CLOSED — a relocated grok home+ // means the context link silently never resolves, never a widened read.+ const grokRoot = path.join(grokHomeDir || path.join(homeDir, '.grok'), 'sessions')+ if (abs === grokRoot || abs.startsWith(grokRoot + path.sep)) return true++ // Linked accounts: a config dir the USER already drives (`CLAUDE_CONFIG_DIR=~/.claude-2 claude`)++ // that they adopted in Settings. `<dir>/projects` and below only — the `+ path.sep` is what keeps++ // a sibling-prefix root (`…/projects-evil`) out, exactly as for the roots above. The dirs come++ // from SETTINGS and never from the POST, so a forged payload cannot name its own jail root.+ for (const raw of linkedDirs ?? []) {+ const dir = normalizeLinkedConfigDir(raw)+ if (!dir) continue+ const root = path.join(dir, 'projects')+ if (abs === root || abs.startsWith(root + path.sep)) return true+ }const accountsRoot = path.join(userDataPath, 'claude-accounts')if (abs !== accountsRoot && !abs.startsWith(accountsRoot + path.sep)) return false// Relative to the accounts root: expect `<accountId>/projects[/…]`. Because `abs` is normalizeddiff --cc src/main/index.tsindex 6ed272225,c6e097060..a6b4e773e--- a/src/main/index.ts+++ b/src/main/index.ts@@@ -2591,16 -2649,11 +2662,21 @@@ app.whenReady().then(async () =>const abs = resolve(tp)// codexHome() honors $CODEX_HOME — a relocated codex (the snap-codex case this project has hit// before) would otherwise fail the jail and its meter would silently never fill.+ // grokHomeDir() honors $GROK_HOME for the same reason and with the same failure shape: closed,+ // so a relocated grok home would silently never resolve a context link. BOTH shells pass it+ // (invariant 11) — a jail widened in one shell only is a feature the Server Edition lacks with+ // nothing to say so.- return isSafeLocalTranscriptPath(abs, homedir(), app.getPath('userData'), codexHome(), grokHomeDir())+ // Linked accounts' dirs come from SETTINGS, never from the POST — `<dir>/projects/**` only,+ // so `~/.claude-2/.ssh` is as refused as it ever was. Without them the meter and the subagent+ // cards silently never fill for a pane running the user's own CLAUDE_CONFIG_DIR.+ return isSafeLocalTranscriptPath(+ abs,+ homedir(),+ app.getPath('userData'),+ codexHome(),++ grokHomeDir(),+ linkedClaudeConfigDirs()+ )? abs: undefined}diff --cc src/renderer/canvas/Canvas.tsxindex b26ad5e1f,50ff0f590..207f98c7c--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@@ -1994,9 -2152,7 +2152,10 @@@ export function Canvas()title: n.data.title ?? n.id,color: n.data.color ?? '#888',agentId: n.data.agentId,+ // The node's creation-time account, for the sidebar row's account chip (the+ // serialized nodes of inactive projects carry it already).+ accountId: n.data.accountId,+ icon: n.data.icon as NodeIcon | undefined,cwd: n.data.cwd,ssh: n.data.ssh,parentId: n.parentIddiff --cc src/renderer/components/SessionRow.tsxindex 12613dd40,d141a8d90..2b4f8e3d5--- a/src/renderer/components/SessionRow.tsx+++ b/src/renderer/components/SessionRow.tsx@@@ -1,6 -1,6 +1,7 @@@import { useState } from 'react'+import { AccountChip, useAccountChip } from './AccountChip'import { IconBellFilled, IconCircleCheck } from './icons'+ import { NodeIconView } from './NodeIcon'import { ProjectGlyph } from './ProjectGlyph'import type { SessionRowVM } from '../lib/sessionList'import { useContextWindow } from '../state/contextWindow'diff --cc src/renderer/components/kanban/CardModal.tsxindex e34cacdea,283a2bc63..88a37aced--- a/src/renderer/components/kanban/CardModal.tsx+++ b/src/renderer/components/kanban/CardModal.tsx@@@ -1,9 -1,12 +1,13 @@@import { useEffect, useRef, useState } from 'react'import { createPortal } from 'react-dom'import { isTopDialog, nextDialogId, popDialog, pushDialog } from '../dialog-stack'- import { IconChat, IconMic, IconSearch } from '../icons'+ import { IconChat, IconMic, IconSearch, IconSmiley } from '../icons'+ import { NodeIconView } from '../NodeIcon'+ import { nodeIconDialog } from '../NodeIconPicker'+ import { applyIconChoice } from '../../lib/nodeIconChoice'+ import type { NodeIcon } from '@shared/node-icon'import { ContextMeter } from '../ContextMeter'+import { AccountChip, useAccountChip } from '../AccountChip'import { useAgentStatus } from '../../state/agentStatus'import { useCardPanel } from '../../state/cardPanel'import {diff --cc src/renderer/components/kanban/SessionCard.tsxindex ed9fda17b,3502b90db..ea8e0e097--- a/src/renderer/components/kanban/SessionCard.tsx+++ b/src/renderer/components/kanban/SessionCard.tsx@@@ -1,8 -1,8 +1,9 @@@import { memo, useState } from 'react'import type { KanbanCardMeta, KanbanLabel, KanbanPriority } from '@shared/types'import { useAgentStatus } from '../../state/agentStatus'+import { AccountChip, useAccountChip } from '../AccountChip'import { ContextMeter } from '../ContextMeter'+ import { NodeIconView } from '../NodeIcon'import { LabelChips } from './LabelChips'import type { KanbanSession } from './KanbanView'diff --cc src/renderer/lib/accountPresentation.tsindex 5eea31119,e13c6003b..4290e5db5--- a/src/renderer/lib/accountPresentation.ts+++ b/src/renderer/lib/accountPresentation.ts@@@ -66,13 -56,8 +68,16 @@@ export function presentAccount(const displayLabel = chosenLabel(label)const cleanEmail = email?.trim() || undefinedconst identity = displayLabel || cleanEmail || 'Default account'- const provenance = host ? `SSH · ${machineLabel?.trim() || host}` : 'Local'- const originDetail = host ? `SSH ${host}` : thisMachineCap()+ const isLinked = !host && !!linked+ const provenance = host ? `SSH · ${machineLabel?.trim() || host}` : isLinked ? 'Linked' : 'Local'++ // `thisMachineCap()` and not a hardcoded "This Mac": the local machine is not necessarily a Mac,++ // and a browser tab gets the neutral word because the account lives on the SERVER. The LINKED++ // branch names the dir instead — the path is the useful fact there, and it names no machine.+ const originDetail = host+ ? `SSH ${host}`+ : isLinked+ ? `Linked ${configDir?.trim() || 'config dir'}`- : 'This Mac'++ : thisMachineCap()const identityDetail =cleanEmail && cleanEmail !== identity ? `${identity} (${cleanEmail})` : identityreturn {diff --cc src/renderer/lib/sessionList.tsindex 0edef64c0,e0cd4a03a..94a03be6d--- a/src/renderer/lib/sessionList.ts+++ b/src/renderer/lib/sessionList.ts@@@ -1,6 -1,7 +1,7 @@@import type { AgentNodeStatus } from '../state/agentStatus'import type { AgentId } from '@shared/agents/config'-import type { NodeKind } from '@shared/types'+import type { NodeKind, ObservedClaudeAccount } from '@shared/types'+ import type { NodeIcon } from '@shared/node-icon'import { hasUsage } from '@shared/agents/config'import type { SshConnection } from '@shared/ssh'import type { ProjectIcon } from '@shared/project-icon'diff --cc src/renderer/nodes/TerminalNode.tsxindex 83d8cb4f5,238b79bd5..d9cffe70e--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@@ -5107,9 -5267,8 +5297,12 @@@ export function TerminalNode(nodeId={id}sessionId={status?.sessionId}cwd={data.cwd as string | undefined}- // A READER (the ⌘M transcript view): the account the session RUNS as (D5), so a- // plain terminal on ~/.claude-2 reads ITS transcript instead of an empty system one.- accountId={data.accountId}++ // A READER (the ⌘M transcript view) takes the account the session actually RUNS++ // as, never the creation-time one, so a plain terminal launched under++ // `CLAUDE_CONFIG_DIR=~/.claude-2` reads ITS transcript instead of an empty++ // system-root one. Spawn/env identity is unaffected — that stays creation-time.+ accountId={accountForReads}+ agentId={agentId}/></Suspense>) : (diff --cc src/server/agent-status.tsindex f5a172b68,ef25359a5..60ab24706--- a/src/server/agent-status.ts+++ b/src/server/agent-status.ts@@@ -163,16 -171,11 +172,21 @@@ export function wireAgentStatusconst abs = resolve(tp)// codexHome() honors $CODEX_HOME — a relocated codex (the snap-codex case this project has hit// before) would otherwise fail the jail and its meter would silently never fill.+ // grokHomeDir() honors $GROK_HOME for the same reason and with the same failure shape: closed,+ // so a relocated grok home would silently never resolve a context link. BOTH shells pass it+ // (invariant 11) — a jail widened in one shell only is a feature the Server Edition lacks with+ // nothing to say so.- return isSafeLocalTranscriptPath(abs, homedir(), platform.userDataDir, codexHome(), grokHomeDir())+ // Linked accounts' dirs come from SETTINGS, never from the POST — `<dir>/projects/**` only,+ // so `~/.claude-2/.ssh` is as refused as it ever was. Without them the meter and the subagent+ // cards silently never fill for a pane running the user's own CLAUDE_CONFIG_DIR.+ return isSafeLocalTranscriptPath(+ abs,+ homedir(),+ platform.userDataDir,+ codexHome(),++ grokHomeDir(),+ linkedClaudeConfigDirs()+ )? abs: undefined}