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
fix(windows): keep copilot/antigravity session-id and resume grammar identical to the typed line
review4ffd120a30ab
diff --git a/src/core/agent-launch.parity.test.ts b/src/core/agent-launch.parity.test.tsnew file mode 100644index 000000000..e3f554059--- /dev/null+++ b/src/core/agent-launch.parity.test.ts@@ -0,0 +1,76 @@+// The Windows launch channel (`pty:execute-launch`) replaces a typed line with the core planner's+// argv. That is only safe while the two describe the SAME launch, so this pins, for every builtin,+// mode and probe shape, that the planner's POSIX argv equals the words of the legacy typed line+// (`assembleLaunchCommand` / `assembleResumeCommand`). A grammar that drifts on one side — copilot's+// verified `--session-id=<uuid>` spelling did — fails here instead of on a Windows pane.+import { describe, expect, it } from 'vitest'+import { assembleLaunchCommand, assembleResumeCommand } from '../shared/agents/launch'+import { heldLaunchIntentFor } from '../shared/agents/launch-intent'+import { AGENT_CONFIG, ALL_PERMISSION_MODES, canResume, type AgentId } from '../shared/agents/config'+import { prepareAgentLaunch } from './agent-launch'++/** Words of a POSIX line as the shell would split them (quotes and backslash escapes only). */+function shellWords(line: string): string[] {+ const out: string[] = []+ let cur = ''+ let quote: string | null = null+ let started = false+ for (let i = 0; i < line.length; i++) {+ const c = line[i]+ if (quote === "'") { if (c === "'") quote = null; else cur += c; continue }+ if (quote === '"') { if (c === '"') quote = null; else cur += c; continue }+ if (c === "'" || c === '"') { quote = c; started = true; continue }+ if (c === '\\') { cur += line[++i]; started = true; continue }+ if (c === ' ') { if (cur || started) out.push(cur); cur = ''; started = false; continue }+ cur += c+ }+ if (cur || started) out.push(cur)+ return out+}++const SID = '123e4567-e89b-42d3-a456-426614174000'+const CAPS = [{}, { codexApprovalValues: ['untrusted', 'on-request', 'never'], codexNoDaemon: true }]+const MODES = [undefined, ...ALL_PERMISSION_MODES]+const builtins = Object.keys(AGENT_CONFIG) as AgentId[]++function context(agentId: AgentId, caps: (typeof CAPS)[number]) {+ return {+ expectedAgentId: agentId,+ sharedIdentityAvailable: false,+ codexApprovalValues: (caps as { codexApprovalValues?: string[] }).codexApprovalValues ?? null,+ codexNoDaemon: (caps as { codexNoDaemon?: boolean }).codexNoDaemon ?? null+ }+}++describe('planner argv ⇔ legacy typed line', () => {+ it.each(builtins)('%s: a first launch with a prompt', async (agentId) => {+ for (const permissionMode of MODES) {+ for (const caps of CAPS) {+ const typed = assembleLaunchCommand(+ { agentId, initialPrompt: `it's "go"`, permissionMode, sessionId: SID, sessionIdFlagSupported: true, approvalCaps: caps, sharedIdentity: false },+ {}+ ).command+ const held = heldLaunchIntentFor({ agentId, command: typed, remote: false, resume: false, initialPrompt: `it's "go"`, permissionMode, mintedSessionId: SID })+ expect(held, `${agentId} ${permissionMode}`).toBeDefined()+ const plan = await prepareAgentLaunch(held!.intent, 'posix', context(agentId, caps))+ expect(shellWords(plan.command), `${agentId} ${permissionMode} ${JSON.stringify(caps)}`).toEqual(shellWords(typed))+ }+ }+ })++ it.each(builtins.filter((a) => canResume(a)))('%s: a resume', async (agentId) => {+ for (const permissionMode of MODES) {+ for (const caps of CAPS) {+ const typed = assembleResumeCommand({ agentId, sessionId: SID, permissionMode, approvalCaps: caps, sharedIdentity: false }, {}).command+ const plan = await prepareAgentLaunch(+ { kind: 'agent', action: 'resume', agentId, sessionId: SID, ...(permissionMode ? { permissionMode } : {}) } as never,+ 'posix',+ context(agentId, caps)+ ).catch(() => null)+ // A mode the planner refuses for this agent is a pre-delivery refusal (→ typed line), not drift.+ if (!plan) continue+ expect(shellWords(plan.command), `${agentId} ${permissionMode} ${JSON.stringify(caps)}`).toEqual(shellWords(typed))+ }+ }+ })+})diff --git a/src/core/agent-launch.ts b/src/core/agent-launch.tsindex a530aeb54..c24685959 100644--- a/src/core/agent-launch.ts+++ b/src/core/agent-launch.ts@@ -381,19 +381,28 @@ function logicalLaunch(if (intent.action === "resume") {if (!config.builtin || !canResume(config.id)) fail("agent-unavailable");+ // Same grammar as `resumeCommandWith` (shared/agents/config.ts): copilot and antigravity are+ // verified only in their `--flag=<id>` spelling, so they keep it here too.const resumeArgs =config.id === "codex"? ["resume", intent.sessionId]: config.id === "opencode"? ["--session", intent.sessionId]- : ["--resume", intent.sessionId];+ : config.id === "copilot"+ ? [`--resume=${intent.sessionId}`]+ : config.id === "antigravity"+ ? [`--conversation=${intent.sessionId}`]+ : ["--resume", intent.sessionId];return { executable, args: [...baseArgs, ...resumeArgs, ...modeFlags] };}const sessionArgs: string[] = [];if (intent.newSessionId !== undefined) {if (!mintsSessionId(config.id)) fail("invalid-intent");- sessionArgs.push("--session-id", intent.newSessionId);+ // `withSessionId`'s grammar: copilot's verified contract is `--session-id=<uuid>` (1.0.80).+ if (config.id === "copilot")+ sessionArgs.push(`--session-id=${intent.newSessionId}`);+ else sessionArgs.push("--session-id", intent.newSessionId);}const hasPrompt = Object.hasOwn(intent, "prompt");