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(terminal): preserve plain shell credentials
Darren Kattan1bf6fadb2e98
diff --git a/src/core/pty-manager.ts b/src/core/pty-manager.tsindex 27e627782..3b325f845 100644--- a/src/core/pty-manager.ts+++ b/src/core/pty-manager.ts@@ -2776,7 +2776,9 @@ export class PtyManager {// already-running session — only the next fresh launch.const stripRe =options.clearEnv || this.getSettings().vanillaLaunchDefault- ? vanillaEnvStripPattern((options.agentId ?? 'claude') as AgentId)+ ? options.agentId+ ? vanillaEnvStripPattern(options.agentId)+ : null: nullconst gatewayEnv =options.agentId && !stripRediff --git a/src/core/pty-single-user.test.ts b/src/core/pty-single-user.test.tsindex d0d880722..fdd17a8e5 100644--- a/src/core/pty-single-user.test.ts+++ b/src/core/pty-single-user.test.ts@@ -392,6 +392,41 @@ describe('SINGLE-USER REGRESSION: co-attach must not change the solo path', () =}})+ it.each([+ { vanillaLaunchDefault: true, clearEnv: undefined },+ { vanillaLaunchDefault: false, clearEnv: true }+ ])('preserves a plain terminal environment in subscription mode: %j', async (mode) => {+ const inherited = {+ ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,+ ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL+ }+ process.env.ANTHROPIC_API_KEY = 'plain-terminal-key'+ process.env.ANTHROPIC_BASE_URL = 'https://plain-terminal-provider.example.test'+ try {+ const { PtyManager } = await import('./pty-manager')+ const m = new PtyManager()+ m.init(() => ({+ ...DEFAULT_SETTINGS,+ vanillaLaunchDefault: mode.vanillaLaunchDefault,+ modelGateway: { baseUrl: 'https://bifrost.example.test', apiKey: 'vk-gateway' }+ }))+ m.registerIpc()++ await create(80, 24, 'subscription-plain-terminal', { clearEnv: mode.clearEnv })++ expect(spawnArgs[0].env.ANTHROPIC_API_KEY).toBe('plain-terminal-key')+ expect(spawnArgs[0].env.ANTHROPIC_BASE_URL).toBe(+ 'https://plain-terminal-provider.example.test'+ )+ expect(spawnArgs[0].args.join(' ')).not.toContain('vk-gateway')+ } finally {+ for (const [key, value] of Object.entries(inherited)) {+ if (value === undefined) delete process.env[key]+ else process.env[key] = value+ }+ }+ })+// "Restart on subscription": clearEnv spawns the session VANILLA — skip the gateway AND strip// inherited provider vars (a LaunchAgent/zshrc export a GUI launch still inherits) so the agent// falls back to its OWN default provider. Both moves are gated on the agent's vanillaEnvPattern