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(antigravity): append agy's directory to an Antigravity session's PATH only when absent
reviewc87a2b42cbf6
diff --git a/src/core/agents/hooks/antigravity.test.ts b/src/core/agents/hooks/antigravity.test.tsindex 958e3ccb1..09aaa2797 100644--- a/src/core/agents/hooks/antigravity.test.ts+++ b/src/core/agents/hooks/antigravity.test.ts@@ -34,6 +34,7 @@ import {installAntigravityHooks,installAntigravityHooksWithProbe,isAntigravityManagedCommand,+ pathWithAgyDir,removeAntigravityHooks} from './antigravity'import {@@ -77,6 +78,37 @@ const read = (f: string): Record<string, unknown> => JSON.parse(readFileSync(f,const install = (hooksJson: string, platform = 'linux') =>installAntigravityHooks({ findAgy: HAS_AGY, hooksJson, platform, scriptPath: POSIX_SCRIPT, writeScript: false })+describe('pathWithAgyDir (an Antigravity session\'s PATH)', () => {+ it('APPENDS the directory — never ahead of the user\'s own entries', () => {+ expect(pathWithAgyDir('/home/u/.nvm/bin:/usr/bin', '/usr/local/bin', 'linux')).toBe(+ '/home/u/.nvm/bin:/usr/bin:/usr/local/bin'+ )+ })++ it('leaves a PATH that already lists the directory byte-for-byte', () => {+ expect(pathWithAgyDir('/usr/local/bin:/usr/bin', '/usr/local/bin', 'darwin')).toBe('/usr/local/bin:/usr/bin')+ expect(pathWithAgyDir('/home/u/.local/bin/:/usr/bin', '/home/u/.local/bin', 'linux')).toBe(+ '/home/u/.local/bin/:/usr/bin'+ )+ })++ it('on win32 compares case-insensitively; the literal %LOCALAPPDATA% entry does NOT count', () => {+ const dir = 'C:\\Users\\U\\AppData\\Local\\agy\\bin'+ expect(pathWithAgyDir('c:\\users\\u\\appdata\\local\\agy\\bin\\;C:\\Windows', dir, 'win32')).toBe(+ 'c:\\users\\u\\appdata\\local\\agy\\bin\\;C:\\Windows'+ )+ // The measured 1.2.7 failure: the entry is the unexpanded expression, so agy is not on PATH.+ expect(pathWithAgyDir('%LOCALAPPDATA%\\agy\\bin;C:\\Windows', dir, 'win32')).toBe(+ `%LOCALAPPDATA%\\agy\\bin;C:\\Windows;${dir}`+ )+ })++ it('an empty or missing PATH becomes just the directory', () => {+ expect(pathWithAgyDir(undefined, '/opt/agy', 'linux')).toBe('/opt/agy')+ expect(pathWithAgyDir('', '/opt/agy', 'linux')).toBe('/opt/agy')+ })+})+describe('where it writes', () => {it('targets ~/.gemini/config/hooks.json — never settings.json or GEMINI.md', () => {expect(antigravityHooksJsonPath('/h')).toBe(join('/h', '.gemini', 'config', 'hooks.json'))diff --git a/src/core/agents/hooks/antigravity.ts b/src/core/agents/hooks/antigravity.tsindex 4ec319f51..1d8763362 100644--- a/src/core/agents/hooks/antigravity.ts+++ b/src/core/agents/hooks/antigravity.ts@@ -68,6 +68,36 @@ export function agyFallbackPaths(return [path.posix.join(home, '.local', 'bin', 'agy')]}+/**+ * `pathValue` with agy's directory APPENDED, unless an entry already names it — the one PATH+ * change an Antigravity session gets (`PtyManager`, local sessions only).+ *+ * Why it exists: measured on Windows 11 with agy 1.2.7, the vendor installer writes+ * `%LOCALAPPDATA%\agy\bin` into the user PATH as REG_SZ, so the percent expression stays literal+ * and `agy` does not resolve while `findAgy`'s vendor-location fallback finds the executable.+ * Why APPEND, not prepend: on macOS/Linux the directory is typically `/usr/local/bin`,+ * `~/.local/bin` or `/snap/bin`, and moving it AHEAD of the user's own entries would shadow their+ * nvm/pyenv/Homebrew tools for the life of the pane — every command agy runs included. Appending+ * only fills the gap; a PATH that already resolves agy (or already lists the dir) is untouched.+ * Entries compare case-insensitively on win32, ignoring a trailing separator.+ */+export function pathWithAgyDir(+ pathValue: string | undefined,+ dir: string,+ platform: NodeJS.Platform | string = process.platform+): string {+ const win = platform === 'win32'+ const delim = win ? ';' : ':'+ const norm = (p: string): string => {+ const t = p.replace(win ? /[\\/]+$/ : /\/+$/, '')+ return win ? t.toLowerCase() : t+ }+ const current = pathValue ?? ''+ const entries = current.split(delim).filter(Boolean)+ if (entries.some((e) => norm(e) === norm(dir))) return current+ return current ? `${current}${delim}${dir}` : dir+}+/*** Is `agy` installed on this machine? A file lookup only — PATH (with PATHEXT on Windows) through* the shared `findExecutableSync`, then the vendor's install locations. It NEVER runs `agy`: this isdiff --git a/src/core/pty-manager.ts b/src/core/pty-manager.tsindex fc3aaf32f..7d615e2d6 100644--- a/src/core/pty-manager.ts+++ b/src/core/pty-manager.ts@@ -20,7 +20,7 @@ import {} from '../shared/types'import { bundledTmuxPath, findCommand, findFixedTmux, tmuxInstall } from './tmux-hint'import { hookServer, PERM_WAIT_SECS_DEFAULT } from './agents/hook-server'-import { findAgy } from './agents/hooks/antigravity'+import { findAgy, pathWithAgyDir } from './agents/hooks/antigravity'import {probeSaysAbsent,remoteHookEnvArgs,@@ -2934,16 +2934,18 @@ export class PtyManager {// The agy installer writes `%LOCALAPPDATA%\agy\bin` into a REG_SZ user PATH on Windows.// Windows does not expand that nested variable during command lookup, so `agy` is absent even- // though our hook installer finds the executable through its vendor-location fallback. Put the- // directory that same lookup proved onto this agent session's PATH. Keep plain terminals and- // remote sessions untouched; on SSH the executable and PATH belong to the host.+ // though our hook installer finds the executable through its vendor-location fallback. APPEND+ // the directory that same lookup proved, and only when no entry already names it+ // (`pathWithAgyDir`): prepending shadowed the user's own tools on macOS/Linux, where agy sits in+ // a shared directory. Keep plain terminals and remote sessions untouched; on SSH the executable+ // and PATH belong to the host.if (options.agentId &&capabilityAgentId(options.agentId as AgentId) === 'antigravity' &&!options.sshRemote) {const agy = findAgy()- if (agy) env.PATH = `${path.dirname(agy)}${path.delimiter}${env.PATH ?? ''}`+ if (agy) env.PATH = pathWithAgyDir(env.PATH, path.dirname(agy))}// Same GUI-launch gap for the locale: with no LANG/LC_* the shell's `locale` is "C" (non-UTF-8),diff --git a/src/core/pty-project-settings.test.ts b/src/core/pty-project-settings.test.tsindex 91b74e76e..349477c26 100644--- a/src/core/pty-project-settings.test.ts+++ b/src/core/pty-project-settings.test.ts@@ -132,7 +132,9 @@ describe('project settings at the spawn — LOCAL leg', () => {await create({ persistKey: 'antigravity-node', agentId: 'antigravity' })await create({ persistKey: 'plain-node' })- expect(spawns[0].env.PATH?.split(path.delimiter)[0]).toBe(path.dirname(fakeAgy))+ // APPENDED, never ahead of the user's own entries (see pathWithAgyDir).+ expect(spawns[0].env.PATH?.split(path.delimiter).at(-1)).toBe(path.dirname(fakeAgy))+ expect(spawns[0].env.PATH?.split(path.delimiter)[0]).toBe('/usr/bin')expect(Object.keys(spawns[0].env).filter((key) => key.toUpperCase() === 'PATH')).toEqual(['PATH'])expect(spawns[1].env.PATH).toBe('/usr/bin:/bin')})diff --git a/src/shared/agents/config.capabilities.test.ts b/src/shared/agents/config.capabilities.test.tsindex 0a07d024a..aebbf4062 100644--- a/src/shared/agents/config.capabilities.test.ts+++ b/src/shared/agents/config.capabilities.test.ts@@ -25,6 +25,8 @@ import {hasSharedIdentity,agentLaunchProgram,resumeCommand,+ hasHooksOverSsh,+ LOCAL_ONLY_HOOK_AGENTS,reportsSessionEnd} from './config'@@ -281,6 +283,16 @@ describe('grok capabilities', () => {* exclusion below says which leaf is missing — measured facts (`agy` 1.2.3, Windows 11).*/describe('antigravity capabilities', () => {+ it('reports status on THIS machine only — an SSH host has no agy hook installer yet', () => {+ // `--after` asks this before accepting a dependency in an SSH project: a node that can never+ // report "done" there would hold its dependant QUEUED forever.+ expect(hasHooksOverSsh('antigravity')).toBe(false)+ expect(LOCAL_ONLY_HOOK_AGENTS as readonly string[]).toEqual(['antigravity'])+ for (const id of BUILTIN_AGENT_IDS.filter((a) => a !== 'antigravity')) {+ expect(hasHooksOverSsh(id), id).toBe(hasHooks(id))+ }+ })+it('is a builtin that launches `agy`, prompt through --prompt-interactive', () => {expect(BUILTIN_AGENT_IDS).toContain('antigravity')expect(AGENT_CONFIG.antigravity.launchCmd).toBe('agy')