The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(grid): name the variables a grid launch sets
Dev jacob93d930a7f63a
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.tsindex face5c80d..0d3b762ed 100644--- a/cli/src/lib/gridLaunch.spec.ts+++ b/cli/src/lib/gridLaunch.spec.ts@@ -4,6 +4,7 @@ import {buildGridEngineLaunch,describeGridLaunch,gridCapableEngines,+ gridEnvVarNames,parseGridLaunchOverride,relayBaseUrl,type GridLaunchOverride,@@ -226,3 +227,21 @@ describe('describeGridLaunch', () => {expect(describeGridLaunch('claude', OVERRIDE)).not.toContain(WIRE.apiKey)})})++describe('gridEnvVarNames', () => {+ // Derived from the contract rather than listed by hand: a second list would drift the first time+ // an engine's contract gained a variable, and the symptom would be a "cleared" agent still running+ // on the grid it was supposedly moved off.+ it('names every variable claude is launched with', () => {+ expect(gridEnvVarNames('claude').sort())+ .toEqual(['ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_BASE_URL', 'ANTHROPIC_MODEL'])+ })++ it('includes the config-dir pointer for an engine that uses one', () => {+ expect(gridEnvVarNames('pi')).toContain('PI_CODING_AGENT_DIR')+ })++ it('is empty for an engine that cannot be pointed at a grid', () => {+ expect(gridEnvVarNames('amp')).toEqual([])+ })+})diff --git a/cli/src/lib/gridLaunch.ts b/cli/src/lib/gridLaunch.tsindex 78272912f..f803f7874 100644--- a/cli/src/lib/gridLaunch.ts+++ b/cli/src/lib/gridLaunch.ts@@ -422,3 +422,30 @@ export function describeGridLaunch(engine: AgentEngine, override: GridLaunchOverreturn `[grid] ${engine} -> ${override.networkName} (${override.networkId})`+ ` · ${override.model ?? 'model chosen by the engine'}`}++/** A placeholder override, used only to ask a contract which variables it sets. Never launched. */+const PROBE_OVERRIDE: GridLaunchOverride = {+ networkId: 'probe',+ networkName: 'probe',+ baseUrl: 'https://example.invalid/probe/relay/v1',+ apiKey: 'probe',+ model: 'probe',+}++/**+ * Which environment variables pointing [engine] at a grid sets.+ *+ * Asked of the contract by building one, rather than kept as a second list beside it. A hand-written+ * list would be correct exactly until an engine's contract gained a variable, and the symptom of it+ * being stale is the worst kind: an agent moved back to its own login that quietly keeps talking to+ * the grid, reporting success the whole way.+ *+ * Empty for an engine that has no contract — there is nothing to clear because nothing was set.+ */+export function gridEnvVarNames(engine: AgentEngine): string[] {+ const built = buildGridEngineLaunch(engine, PROBE_OVERRIDE)+ if (!built.ok) return []+ const names = Object.keys(built.launch.env)+ if (built.launch.configDir) names.push(built.launch.configDir.envVar)+ return names+}