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(agents): put the agy install dir on an Antigravity session's PATH on Windows
Fabricio Casali7524f60b65d1
diff --git a/CLAUDE.md b/CLAUDE.mdindex 08e753dcd..3ec258ff7 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1571,6 +1571,14 @@ else, and its context links must keep classifying across restarts).values (`reg query`, absence decided by listing the parent key — reg's errors are localized)and installs NOTHING — and withdraws a bundle an earlier launch wrote — if one is set or theregistry cannot be read.+ **The vendor-location fallback also owns launch reachability.** Measured on Windows 11 with agy+ 1.2.7: the vendor installer wrote `%LOCALAPPDATA%\agy\bin` into the user PATH as `REG_SZ`, so the+ process inherited the percent expression literally and both `where agy` and `cmd /c agy` failed+ while `%LOCALAPPDATA%\agy\bin\agy.exe` existed and ran. `PtyManager` therefore prepends the+ directory returned by `findAgy()` to the PATH of a LOCAL Antigravity session. The gate uses+ `capabilityAgentId`, so an Antigravity-based custom agent inherits it; plain terminals and SSH+ sessions do not. Detecting the binary only for hook installation recreates the original split:+ a configured badge for an agent the pane cannot launch.**Installed only where `agy` exists** (a file lookup — PATH, then the vendor's install dirs —never a spawn), in two passes per launch: the boot pass may only see the inherited PATH, so a missthere does NOTHING; after the login-shell PATH probe settles, a final pass repeats the lookup anddiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 1040ecf7e..c7c90b6b2 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -134,6 +134,13 @@ lane unaffected.cannot read) and test Windows dispatch WITHOUT `windowsVerbatimArguments`; keep the `AutoRun`refusal. Deep version: `docs/antigravity-agent.md` and CLAUDE.md § Agent support.+- **Finding `agy` for hook installation is not enough to launch it.** The measured Windows+ installer wrote `%LOCALAPPDATA%\agy\bin` into a `REG_SZ` user PATH, so command lookup kept the+ percent expression literal and `agy` was not found even though its executable existed. Local+ Antigravity PTYs therefore prepend the directory returned by the same vendor-location lookup the+ hook installer uses. Keep that correction scoped to Antigravity sessions; do not change plain+ terminals or inject a local path into SSH sessions.+- **Every loosening of a security gate must be a SETTING the user can see and revoke.** A "don'task again" that lives only in a dialog is a permission granted once and never findable again. Thecanvas-control destructive confirm is the pattern to copy (`@shared/control-confirm`): a CANCELdiff --git a/docs/antigravity-agent.md b/docs/antigravity-agent.mdindex 45159ad40..e5a4ae48b 100644--- a/docs/antigravity-agent.md+++ b/docs/antigravity-agent.md@@ -8,6 +8,12 @@ capability list, `AGENT_HOOK_TARGETS`: the RUNNING / NEEDS YOU badge, the unreadnotifications, `--after` dependencies and trigger targets come from that. Everything else is a leafthat does not exist yet (§7).+On Windows, launch reachability uses the same vendor-location lookup as hook installation. The+measured agy 1.2.7 installer wrote `%LOCALAPPDATA%\agy\bin` into the user PATH as `REG_SZ`; Windows+kept the percent expression literal, so `where agy` failed while the executable at that location+ran normally. A local Antigravity PTY prepends the detected executable's directory to its own PATH.+Plain terminals and SSH sessions remain untouched.+> Sibling documents: `docs/grok-agent.md`, `docs/gemini-agent.md`, `docs/copilot-agent.md`. The> distilled rules are **Adding a new agent** in `CLAUDE.md`.diff --git a/src/core/pty-manager.ts b/src/core/pty-manager.tsindex 66cfde794..375e428d7 100644--- a/src/core/pty-manager.ts+++ b/src/core/pty-manager.ts@@ -19,6 +19,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 {probeSaysAbsent,remoteHookEnvArgs,@@ -105,7 +106,13 @@ import {} from './codex-identity-proxy'import { ensureNodeToken, ensureRemoteNodeToken, sweepNodeToken } from './agents/node-token-service'import { clearNode as clearNodeAgentStatus } from './agent-status-mirror'-import { hasSharedIdentity, setCustomAgentBaseResolver, vanillaEnvStripPattern, type AgentId } from '../shared/agents/config'+import {+ capabilityAgentId,+ hasSharedIdentity,+ setCustomAgentBaseResolver,+ vanillaEnvStripPattern,+ type AgentId+} from '../shared/agents/config'import { findCustomAgent } from '../shared/agents/custom-agent'import { applyCustomAgentEnv, customAgentEnvArgs } from './custom-agent-env'import {@@ -2761,6 +2768,16 @@ export class PtyManager {// advertise it — without this, zsh themes and TUIs quietly clamp to the 256 palette and// the canvas terminals never match the user's real terminal colors (issue #78).const env = { ...process.env, TERM: 'xterm-256color', COLORTERM: 'truecolor' } as Record<string, string>+ if (process.platform === 'win32') {+ // `process.env` commonly exposes this as `Path`. The copied object is case-sensitive, so a+ // later `env.PATH = ...` would leave BOTH names in node-pty's environment block. ConPTY uses+ // the first case-insensitive match, which is then the stale `Path` value. Canonicalise once+ // before any PATH layer is applied so every downstream writer replaces the same entry.+ const pathKeys = Object.keys(env).filter((key) => key.toUpperCase() === 'PATH')+ const inheritedPath = env.PATH ?? (pathKeys.length ? env[pathKeys[0]] : undefined)+ for (const key of pathKeys) delete env[key]+ if (inheritedPath !== undefined) env.PATH = inheritedPath+ }// The Server Edition may receive a first-boot password through its own environment. That// bootstrap credential belongs to the server process, never to the interactive shells and// agent CLIs it launches; inheriting it here would expose it to every terminal node.@@ -2777,6 +2794,20 @@ export class PtyManager {const shellPath = shellPathNow() ?? nullif (shellPath) env.PATH = shellPath+ // 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.+ 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 ?? ''}`+ }+// Same GUI-launch gap for the locale: with no LANG/LC_* the shell's `locale` is "C" (non-UTF-8),// so Claude Code and other TUIs fall back to ASCII box-drawing (rounded borders render as `_`/`|`).// Force a UTF-8 locale when the inherited env doesn't already declare one.diff --git a/src/core/pty-project-settings.test.ts b/src/core/pty-project-settings.test.tsindex 801338b94..3b0aaa953 100644--- a/src/core/pty-project-settings.test.ts+++ b/src/core/pty-project-settings.test.ts@@ -8,6 +8,7 @@// - and every miss path (no ownerProjectId, no reader, a reader that throws, a reader that HANGS)// spawns exactly the session it spawned before this feature existed.import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import path from 'path'import { initPlatform, resetPlatformForTests } from './platform'import { fakePlatform, type FakePlatform } from './platform-fake'import { setRemoteSessionEnvWriter } from './remote-ssh/session-env'@@ -62,6 +63,14 @@ vi.mock('./exec-path', async (importOriginal) => ({resolveShellPath: async () => '/usr/bin:/bin'}))+const fakeAgy = vi.hoisted(() =>+ process.platform === 'win32' ? 'C:\\vendor\\agy\\bin\\agy.exe' : '/vendor/agy/bin/agy'+)+vi.mock('./agents/hooks/antigravity', async (importOriginal) => ({+ ...(await importOriginal<typeof import('./agents/hooks/antigravity')>()),+ findAgy: () => fakeAgy+}))+// Every tmux/ssh side-call (the freshness probe, `set-option`) answers "fine" without a subprocess.vi.mock('child_process', () => {type Cb = (err: Error | null, res?: { stdout: string; stderr: string }) => void@@ -116,6 +125,16 @@ describe('project settings at the spawn — LOCAL leg', () => {expect(spawns[0].env.PROJECT_TOKEN).toBe('abc')})+ it('puts the detected agy directory on only an Antigravity session PATH', async () => {+ await manager(null)+ 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))+ expect(Object.keys(spawns[0].env).filter((key) => key.toUpperCase() === 'PATH')).toEqual(['PATH'])+ expect(spawns[1].env.PATH).toBe('/usr/bin:/bin')+ })+it('asks the reader with the OWNING project id, once per spawn', async () => {const seen: string[] = []await manager(async (id) => {