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(grok): honor the permission-mode setting, and keep claude's version gate claude's
enes16fa68b9def6
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 46a0f6fbb..ba75879c8 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -3087,7 +3087,7 @@ export function Canvas() {undefined,project?.ssh,account,- activePermissionMode()+ activePermissionMode(agentId))return [...ns, groupId ? parentInto(node, groupId) : node]})@@ -4360,7 +4360,9 @@ export function Canvas() {// Inherit the source's Claude account (dropped by the factory unless the target is claude),// so a claude→claude transfer resumes the transcript from the right account dir.source.data.accountId,- activePermissionMode()+ // The mode belongs to the node being OPENED, so it is gated on the TARGET agent — a+ // handoff into grok must not inherit claude's version gate.+ activePermissionMode(targetAgentId))node.selected = trueconst placed = placeSpawned(node, at ?? besideNode(source))@@ -5223,7 +5225,7 @@ export function Canvas() {project,useSettings.getState().settings.claudeAccounts),- activePermissionMode()+ activePermissionMode(choice.agentId))setNodes((ns) => [...ns, node])const board = project?.kanban ?? seedBoard@@ -5701,7 +5703,7 @@ export function Canvas() {args.prompt,sshFor(agentCwd),account,- activePermissionMode()+ activePermissionMode(agentId)),after ?? [])@@ -5936,7 +5938,9 @@ export function Canvas() {vStore.getProject(vStore.activeProjectId ?? ''),useSettings.getState().settings.claudeAccounts)- const vMode = activePermissionMode()+ // Every node in the panel (reviewers + judge) runs `reviewAgent`, so one resolution+ // serves them all — gated on that agent, not on the caller's.+ const vMode = activePermissionMode(reviewAgent)const reviewers = lenses.map((lens, i) => {const node = createAgentNode(reviewAgent,@@ -6049,15 +6053,18 @@ export function Canvas() {)// Build members; fixed role titles pin the node name (titleAuto off).const members = roles.map((r, i) => {+ // Roles may name different agents, so the mode is resolved PER member: claude's+ // `auto` version gate must not decide what a grok teammate launches with.+ const memberAgent = (r.agent ?? 'claude') as AgentIdconst node = createAgentNode(- r.agent ?? 'claude',+ memberAgent,live.length + i,srcCwd,placeBelow(i),r.prompt,sshFor(srcCwd),teamAccount,- activePermissionMode()+ activePermissionMode(memberAgent))return r.title ? { ...node, data: { ...node.data, title: r.title, titleAuto: false } } : node})diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsxindex fbf39d304..4172be737 100644--- a/src/renderer/components/TabBar.tsx+++ b/src/renderer/components/TabBar.tsx@@ -476,7 +476,7 @@ export function TabBar({// and applies the moment the host's CLI qualifies.title={m === 'bypassPermissions'- ? 'Skips every permission prompt. This override is saved in the project file (.nodeterm/project.json), so if you commit it, everyone who clones the repo runs Claude without permission checks too.'+ ? 'Skips every permission prompt. This override is saved in the project file (.nodeterm/project.json), so if you commit it, everyone who clones the repo runs their Claude and Grok sessions without permission checks too.': m === 'auto'? (menuAutoHint ?? undefined): undefineddiff --git a/src/renderer/components/settings/sections/AgentsSection.tsx b/src/renderer/components/settings/sections/AgentsSection.tsxindex 7b16243f5..4affa2e4f 100644--- a/src/renderer/components/settings/sections/AgentsSection.tsx+++ b/src/renderer/components/settings/sections/AgentsSection.tsx@@ -44,6 +44,7 @@ const ROWS = {'approve','ask','claude',+ 'grok','shift tab']},@@ -80,7 +81,7 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.El// evidence of an old CLI, and guessing would be its own kind of wrong.const autoNote =settings.claudePermissionMode === 'auto' && cliCaps?.version && !cliCaps.autoPermissionMode- ? `Your Claude CLI (${cliCaps.version.split(/\s+/)[0]}) doesn't support Auto — sessions start in "${PERMISSION_MODE_LABELS.manual}". Requires Claude Code ${AUTO_PERMISSION_MODE_MIN_VERSION} or newer.`+ ? `Your Claude CLI (${cliCaps.version.split(/\s+/)[0]}) doesn't support Auto — Claude sessions start in "${PERMISSION_MODE_LABELS.manual}". Requires Claude Code ${AUTO_PERMISSION_MODE_MIN_VERSION} or newer. Grok is unaffected.`: undefinedreturn (@@ -127,10 +128,10 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.El<FieldRowlabel="Permission mode"note={autoNote}- description="The mode Claude terminal sessions start in (chat nodes are not affected). Shift+Tab still switches modes at any time. Projects can override this from the tab ⌄ menu."+ description="The mode Claude and Grok terminal sessions start in; other agents ignore it. Shift+Tab still switches modes at any time. Projects can override this from the tab ⌄ menu."control={<Select- aria-label="Claude permission mode"+ aria-label="Agent permission mode"value={settings.claudePermissionMode}onChange={(e) =>update({ claudePermissionMode: e.target.value as AgentPermissionMode })diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 84f955497..46b70f82b 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -2163,7 +2163,10 @@ export function TerminalNode({// it can never end up double-flagged. Awaited (not the sync `activePermissionMode`)// because this fires on mount: right after a machine reboot it can beat the CLI version// probe, and an unanswered probe would conservatively drop `auto`.- const cmd = base && withPermissionMode(base, agentId, await ensureActivePermissionMode())+ // Gated on THIS node's agent: claude's `auto` version gate must not decide what a grok+ // (or any other permission-mode-capable agent's) relaunch is flagged with.+ const cmd =+ base && withPermissionMode(base, agentId, await ensureActivePermissionMode(agentId))if (cmd) writeWhenShellReady(cmd) // same shell-startup race as initialCommand}})@@ -2228,7 +2231,7 @@ export function TerminalNode({// session is launched, not of the node.const base = resumeCommand(agentId, agentSessionId)const command = base- ? withPermissionMode(base, agentId, await ensureActivePermissionMode())+ ? withPermissionMode(base, agentId, await ensureActivePermissionMode(agentId)): undefinedreturn performRestartResume({agentId,diff --git a/src/renderer/state/permissionMode.ts b/src/renderer/state/permissionMode.tsindex 467a565d4..63da7941d 100644--- a/src/renderer/state/permissionMode.ts+++ b/src/renderer/state/permissionMode.ts@@ -2,6 +2,7 @@ import {AUTO_PERMISSION_MODE_MIN_VERSION,gatePermissionMode,resolvePermissionMode,+ type AgentId,type AgentPermissionMode} from '@shared/agents/config'import { UNKNOWN_CLAUDE_CLI_CAPS, type ClaudeCliCaps, type Project } from '@shared/types'@@ -77,14 +78,24 @@ function autoSupportedFor(project: Project | undefined): boolean {* when the CLI that will run it is too old to know the value (Claude Code < 2.1.71, which exits 1* on it) or hasn't been probed yet. The other four modes are never touched by the gate.*+ * `agentId` defaults to `'claude'`, so every call site written before a second agent had a+ * permission mode keeps its exact behavior.+ ** Lives in its own module rather than in workspace.ts because projects.ts imports workspace.ts* (createProject) — importing the projects store from workspace.ts would close that cycle.*/-export function activePermissionMode(): AgentPermissionMode {+export function activePermissionMode(agentId: AgentId = 'claude'): AgentPermissionMode {const { settings } = useSettings.getState()const { getProject, activeProjectId } = useProjects.getState()const project = getProject(activeProjectId)- return gatePermissionMode(resolvePermissionMode(project, settings), autoSupportedFor(project))+ const mode = resolvePermissionMode(project, settings)+ // The version gate is CLAUDE-specific BY CONSTRUCTION: it exists because Claude Code < 2.1.71+ // exits 1 on `--permission-mode auto`, and it is fed by a `claude --version` probe (local, or the+ // SSH host's). grok has accepted every mode we emit since 1.0.0, its first release, so applying+ // the gate to it would downgrade a grok session to `default` on a machine whose CLAUDE is old —+ // or absent entirely. An agent that needs its own gate adds it here, beside this one, rather than+ // inheriting claude's.+ return agentId === 'claude' ? gatePermissionMode(mode, autoSupportedFor(project)) : mode}/** How long a launch on an SSH project may wait for the REMOTE probe's first answer. The probe@@ -122,8 +133,15 @@ function waitForSshAutoAnswer(projectId: string, ms: number): Promise<void> {* after connect, through a slow login shell) — so when the resolved mode is `auto`, this also* waits (bounded) for that probe's first answer. Any other mode never waits: the gate only ever* touches `auto`.+ *+ * BOTH waits are for claude's gate, and nothing else — so a non-claude agent waits on neither:+ * blocking a grok launch on a `claude --version` probe (or on an SSH host's claude probe, which on+ * a host without claude never answers at all) would be a delay bought for no decision.*/-export async function ensureActivePermissionMode(): Promise<AgentPermissionMode> {+export async function ensureActivePermissionMode(+ agentId: AgentId = 'claude'+): Promise<AgentPermissionMode> {+ if (agentId !== 'claude') return activePermissionMode(agentId)await ensureClaudeCliCaps()const { settings } = useSettings.getState()const { getProject, activeProjectId } = useProjects.getState()@@ -131,13 +149,17 @@ export async function ensureActivePermissionMode(): Promise<AgentPermissionMode>if (project?.ssh && resolvePermissionMode(project, settings) === 'auto') {await waitForSshAutoAnswer(project.id, SSH_AUTO_PROBE_WAIT_MS)}- return activePermissionMode()+ return activePermissionMode('claude')}/*** Why `auto` may not apply on this SSH project, for the tab menu's Auto rows — null when the* remote CLI is confirmed and Auto works as chosen. The silent fail-open degrade is correct for* launches but indistinguishable from "the dropdown is broken" without this.+ *+ * Every sentence names CLAUDE explicitly: the gate this describes is claude's alone (grok accepts+ * `auto` on every version), so an unprefixed warning on a project that also runs grok sessions+ * would read as a limitation of the mode itself.*/export function sshAutoModeHint(answer: SshAutoPermAnswer,@@ -147,8 +169,8 @@ export function sshAutoModeHint(if (answer === 'no') {const v = version?.match(/\d+\.\d+\.\d+/)?.[0]return v- ? `The server's Claude CLI is ${v} — Auto needs ${AUTO_PERMISSION_MODE_MIN_VERSION} or newer, so sessions start without a mode flag until it is upgraded.`- : 'Claude CLI was not found on the server, so Auto cannot apply — sessions start without a mode flag.'+ ? `The server's Claude CLI is ${v} — Auto needs ${AUTO_PERMISSION_MODE_MIN_VERSION} or newer, so Claude sessions start without a mode flag until it is upgraded.`+ : 'Claude CLI was not found on the server, so Auto cannot apply to Claude sessions — they start without a mode flag.'}- return `Not verified on this server yet — Auto applies once the server's Claude CLI (≥ ${AUTO_PERMISSION_MODE_MIN_VERSION}) is confirmed.`+ return `Claude sessions: not verified on this server yet — Auto applies to them once the server's Claude CLI (≥ ${AUTO_PERMISSION_MODE_MIN_VERSION}) is confirmed.`}diff --git a/src/shared/agents/config.ts b/src/shared/agents/config.tsindex d5ddf5872..0b049acca 100644--- a/src/shared/agents/config.ts+++ b/src/shared/agents/config.ts@@ -110,9 +110,15 @@ export const RENAME_CAPABLE = ['claude', 'grok'] as const// ~/.config/opencode/AGENTS.md (see canvas-control.ts).export const CANVAS_CONTROL_CAPABLE = ['claude', 'codex', 'gemini', 'opencode'] as const// Agents whose session start-up permission mode we can set (see AgentPermissionMode below).-// Only claude's flag surface is verified. codex (--ask-for-approval) and gemini+// claude and grok share the flag SPELLING and the value vocabulary+// (`--permission-mode auto|plan|acceptEdits|bypassPermissions`; our `manual` = no flag = grok's own+// `default`), which is the whole requirement for membership. codex (--ask-for-approval) and gemini// (--approval-mode) join by being added here with their own flag mapping.-export const PERMISSION_MODE_CAPABLE = ['claude'] as const+//+// NOTE: the `auto` VERSION GATE is claude's alone — see activePermissionMode in+// renderer/state/permissionMode.ts. grok has accepted every mode we emit since 1.0.0, its first+// release, so it must never inherit a gate fed by a `claude --version` probe.+export const PERMISSION_MODE_CAPABLE = ['claude', 'grok'] as constconst includes = (list: readonly string[], id: AgentId): boolean => list.includes(id)diff --git a/src/shared/agents/permission-mode.test.ts b/src/shared/agents/permission-mode.test.tsindex 3096a994c..634797a05 100644--- a/src/shared/agents/permission-mode.test.ts+++ b/src/shared/agents/permission-mode.test.ts@@ -10,8 +10,12 @@ import {} from './config'describe('hasPermissionMode', () => {- it('is claude-only', () => {+ // claude and grok share the flag SPELLING and the value vocabulary, which is the whole+ // requirement for membership. codex (--ask-for-approval) and gemini (--approval-mode) spell it+ // differently, so they stay out until their own mapping exists.+ it('covers claude and grok, and no one else', () => {expect(hasPermissionMode('claude')).toBe(true)+ expect(hasPermissionMode('grok')).toBe(true)expect(hasPermissionMode('codex')).toBe(false)expect(hasPermissionMode('gemini')).toBe(false)expect(hasPermissionMode('custom:abc')).toBe(false)@@ -74,6 +78,23 @@ describe('withPermissionMode', () => {})})+describe('withPermissionMode — grok', () => {+ it('emits the same flag it emits for claude, because grok spells it the same way', () => {+ expect(withPermissionMode('grok', 'grok', 'plan')).toBe('grok --permission-mode plan')+ expect(withPermissionMode('grok', 'grok', 'auto')).toBe('grok --permission-mode auto')+ expect(withPermissionMode('grok', 'grok', 'acceptEdits')).toBe(+ 'grok --permission-mode acceptEdits'+ )+ expect(withPermissionMode('grok', 'grok', 'bypassPermissions')).toBe(+ 'grok --permission-mode bypassPermissions'+ )+ })++ it("`manual` emits NO flag — which is exactly grok's own `default`", () => {+ expect(withPermissionMode('grok', 'grok', 'manual')).toBe('grok')+ })+})+describe('resolvePermissionMode', () => {const settings = { claudePermissionMode: 'auto' as AgentPermissionMode }