Skip to content

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.

Grid and saved-API launches built by the models service, through the launch port (L1) (#1068)

Dee0c2ec6a06f79
diff --git a/cli/e2e/serviceProcesses.e2e.ts b/cli/e2e/serviceProcesses.e2e.ts
index 67b972908..6c2e71267 100644
--- a/cli/e2e/serviceProcesses.e2e.ts
+++ b/cli/e2e/serviceProcesses.e2e.ts
@@ -9,7 +9,8 @@
* (or parks it, when it keeps crashing), every service in it connected again.
*/
import { execFileSync } from 'node:child_process'
-import { mkdirSync } from 'node:fs'
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it, onTestFailed } from 'vitest'
import { LocalClient, type Frame } from './harness/client.js'
@@ -287,6 +288,17 @@ function modelsPids(d: IsolatedDaemon): number[] {
return table.map((line) => line.trim().match(/^(\d+)\s+(.*)$/)).filter((match): match is RegExpMatchArray => !!match)
.filter(([, pid, command]) => command.trim() === 'harnessd-models' && ours.has(Number(pid))).map(([, pid]) => Number(pid))
}
+/** A create on a grid the desktop already resolved (`grid`), bound to its conversation like any other. */
+async function createOn(daemon: IsolatedDaemon, client: LocalClient, engine: Engine, folder: string, grid: Record<string, unknown>): Promise<Record<string, any>> {
+ const cwd = join(daemon.projectsDir, folder)
+ mkdirSync(cwd, { recursive: true })
+ const created = await client.request('agent_create', { engine, cwd, grid, bypassPermission: true }, 90_000)
+ expect(created.error, `${folder}: ${JSON.stringify(created)}`).toBeUndefined()
+ return until(`${folder} to bind its conversation`, async () => {
+ const agent = await row(client, created.agent.id)
+ return agent?.sessionId && agent.status === 'active' ? agent : null
+ }, 60_000, 500)
+}
/** A create on a grid model: what the models picker sends, a model and the grid serving it. */
const createOnGrid = (client: LocalClient, d: IsolatedDaemon): Promise<Record<string, any>> =>
client.request('agent_create', { engine: 'codex', cwd: join(d.projectsDir, 'on-a-grid'), gridModel: 'Qwen3-Coder-30B', gridName: 'mine', bypassPermission: true }, 30_000)
@@ -365,6 +377,112 @@ describe('models in its own process', () => {
client.close()
})
+ it('down at launch time: Claude Code and Codex on their own login launch as ever, a launch on a grid or a saved API is refused at once, and builds again once models is back', async () => {
+ // Slow to come back, so what is launched meanwhile finds it down.
+ const d = await fresh({ HARNESSD_SERVICE_INITIAL_BACKOFF_MS: '8000', HARNESSD_SERVICE_MAX_BACKOFF_MS: '8000' })
+ const client = await LocalClient.connect(d)
+ // The launch the desktop sends for a grid it already resolved: models builds it (ModelsPort.gridLaunch).
+ const grid = { networkId: 'net-e2e', networkName: 'e2e-grid', baseUrl: 'https://fixture.invalid/g/net-e2e/relay/v1', apiKey: 'fixture-key', model: 'Small-Q4' }
+ const onGrid = await createOn(d, client, 'claude', 'launch-grid-claude', grid)
+ expect(onGrid.grid).toMatchObject({ baseUrl: grid.baseUrl, model: 'Small-Q4' })
+ const before = modelsPids(d)
+ for (const pid of before) process.kill(pid, 'SIGKILL')
+ await until('the core to see models gone', () => d.log().includes('[services] models disconnected') || null, 15_000, 100)
+ // Their own login asks models nothing: both launch, and take a turn, while it is down.
+ const plain = [await create(d, client, 'claude', 'launch-plain-claude'), await create(d, client, 'codex', 'launch-plain-codex')]
+ for (const agent of plain) await turn(client, agent.id, `launched while models was down (${agent.engine})`)
+ // A launch that needs it is refused at once, saying why, and nothing is started or stopped.
+ const asked = Date.now()
+ const down = (engine: string, name: string) => `The models service is not running, so ${engine} cannot be put on ${name}. Try again in a moment.`
+ mkdirSync(join(d.projectsDir, 'launch-grid-refused'), { recursive: true })
+ expect(await client.request('agent_create', { engine: 'codex', cwd: join(d.projectsDir, 'launch-grid-refused'), grid, bypassPermission: true }, 30_000))
+ .toMatchObject({ error: 'GRID_UNAVAILABLE', detail: down('codex', 'e2e-grid') })
+ expect(await client.request('agent_restart', { agentId: onGrid.id }, 30_000)).toMatchObject({ error: 'GRID_UNAVAILABLE', detail: down('claude', 'e2e-grid') })
+ expect(await client.request('agent_retarget', { agentId: plain[0].id, grid }, 30_000)).toMatchObject({ error: 'GRID_UNAVAILABLE', detail: down('claude', 'e2e-grid') })
+ expect(await client.request('agent_retarget', { agentId: plain[1].id, apiConnection: 'openrouter', apiModel: 'z-ai/glm-5' }, 30_000))
+ .toMatchObject({ error: 'API_UNAVAILABLE', detail: 'The models service is not running, so this API cannot be used now. Try again in a moment.' })
+ expect(Date.now() - asked).toBeLessThan(5_000)
+ // The agent on the grid was left running as it was, and every agent goes on.
+ await turn(client, onGrid.id, 'its restart was refused, and it is still here')
+ for (const agent of plain) expect((await row(client, agent.id))?.grid ?? null).toBeNull()
+ expect((await row(client, onGrid.id))?.grid).toMatchObject({ baseUrl: grid.baseUrl })
+ // Back, it builds the launch again.
+ await until('the master to restart models', () => restarts(d) >= 1 || null, 30_000, 200)
+ await until('models to answer again', () => modelsAnswers(client).then((ok) => ok || null), 30_000, 500)
+ expect(await client.request('agent_restart', { agentId: onGrid.id }, 90_000)).not.toHaveProperty('error')
+ await until('the agent on the grid to come back', async () => {
+ const agent = await row(client, onGrid.id)
+ return agent?.status === 'active' && agent.grid?.baseUrl === grid.baseUrl ? agent : null
+ }, 60_000, 500)
+ expect(d.coresStarted()).toBe(1)
+ client.close()
+ })
+
+ /**
+ * Two grid agents, then a reboot with models held off the core (`HARNESSD_TEST_HOLD_CONNECT`): running, and not
+ * there. `meanwhile` does to its process what the test is about. The core comes up ready at once, both agents wait
+ * held in panes that say why, never failed and never archived, and both come back once models is there.
+ */
+ async function heldAtBoot(meanwhile: (d: IsolatedDaemon) => Promise<void>, env: Record<string, string> = {}): Promise<void> {
+ const holdDir = mkdtempSync(join(tmpdir(), 'models-hold-'))
+ const hold = join(holdDir, 'hold')
+ try {
+ const d = await fresh({ HARNESSD_TEST_HOLD_CONNECT: `models:${hold}`, HARNESSD_SERVICE_INITIAL_BACKOFF_MS: '500', HARNESSD_SERVICE_MAX_BACKOFF_MS: '1000', ...env })
+ let client = await LocalClient.connect(d)
+ const grid = { networkId: 'net-e2e', networkName: 'e2e-grid', baseUrl: 'https://fixture.invalid/g/net-e2e/relay/v1', apiKey: 'fixture-key', model: 'Small-Q4' }
+ const agents = [await createOn(d, client, 'claude', 'held-claude', grid), await createOn(d, client, 'codex', 'held-codex', grid)]
+ client.close()
+ // A reboot, with models up but held off the core this time.
+ writeFileSync(hold, '')
+ await d.stop()
+ await d.tmux.run('kill-server')
+ const asked = Date.now()
+ await d.start()
+ // Ready without asking models anything: the old restore waited on it before saying so.
+ expect(Date.now() - asked).toBeLessThan(15_000)
+ client = await LocalClient.connect(d)
+ for (const agent of agents) {
+ const held = await until(`${agent.engine} held`, async () => {
+ const now = await row(client, agent.id)
+ return now?.launch?.state === 'held' ? now : null
+ }, 30_000, 250)
+ expect(held).toMatchObject({ status: 'offline', launch: { state: 'held', service: 'models', detail: expect.stringContaining('Waiting for the models service') } })
+ }
+ await meanwhile(d)
+ // The pass after ready could not ask models (it is not there): both still held, neither failed nor archived.
+ await until('the held pass to give up on models', () => /\[restore\] held · every service · launched 0 of 2 · 2 still waiting/.test(d.log()) || null, 60_000, 250)
+ for (const agent of agents) expect((await row(client, agent.id))?.launch).toMatchObject({ state: 'held' })
+ expect(d.log()).not.toContain('could not build its launch')
+ // Models there at last: both come back, on their grid, with their conversations.
+ rmSync(hold)
+ for (const agent of agents) {
+ await until(`${agent.engine} back on its grid`, async () => {
+ const now = await row(client, agent.id)
+ return now?.status === 'active' && now.sessionId === agent.sessionId && now.launch?.state === 'ready' ? now : null
+ }, 90_000, 500)
+ }
+ await turn(client, agents[0]!.id, 'back once models was there')
+ expect(d.log()).not.toContain('[safe-mode]')
+ client.close()
+ } finally { rmSync(holdDir, { recursive: true, force: true }) }
+ }
+
+ it('killed at boot: the core is ready at once, both grid agents wait held, never failed or archived, and come back once models is up', async () => {
+ await heldAtBoot(async (d) => {
+ const before = await until('models to be running, held off', () => modelsPids(d).length ? modelsPids(d) : null, 30_000, 200)
+ for (const pid of before) process.kill(pid, 'SIGKILL')
+ await until('the master to start models again', () => modelsPids(d).some((pid) => !before.includes(pid)) || null, 30_000, 200)
+ })
+ })
+
+ it('hung at boot: the core is ready within its deadline all the same, and the agents come back once models is', async () => {
+ await heldAtBoot(async (d) => {
+ const before = await until('models to be running, held off', () => modelsPids(d).length ? modelsPids(d) : null, 30_000, 200)
+ for (const pid of before) process.kill(pid, 'SIGSTOP')
+ await until('the master to find models hung and start it again', () => modelsPids(d).some((pid) => !before.includes(pid)) || null, 60_000, 200)
+ }, { HARNESSD_SERVICE_HEARTBEAT_TIMEOUT_MS: '3000' })
+ })
+
it('hung, it is killed by the master\'s heartbeat watch and started again; the core never waits on it', async () => {
const d = await fresh({ HARNESSD_SERVICE_HEARTBEAT_TIMEOUT_MS: '2000' })
const client = await LocalClient.connect(d)
diff --git a/cli/src/architecture.spec.ts b/cli/src/architecture.spec.ts
index 9cae20820..afe00791c 100644
--- a/cli/src/architecture.spec.ts
+++ b/cli/src/architecture.spec.ts
@@ -193,6 +193,10 @@ const EDGE: RegExp[] = [
/^gateway\//, /^lib\/e2ee\//, /^cable\//, /^device\//, /^lib\/autonomous-device\//, /^sharing\//, /^teams\//, /^orchestrator\//, /^services\//,
/^lib\/grid(Attach|Credentials|Derive|Ensure|Envelope|Exec|FleetRpc|Handoff|Install|McpUrl|Models|ModelsPayload|Picture|Presence|Reader|Target|Wake)\.ts$/,
/^lib\/localModels\.ts$/,
+ // The grid and saved-API launch builders are models': the core asks it for a launch (ModelsPort.gridLaunch) and keeps
+ // only the wire it checks one with and the lists every launch reads (lib/gridLaunchWire.ts), so a launch on the
+ // engine's own login loads none of them (docs/design/2026-10-08-launch-port.md, (L1)).
+ /^lib\/(gridLaunch|gridWebMcp|apiModels)\.ts$/,
// The change-agent handoff reads and redacts history and runs git: the edge host owns that work.
/^lib\/agentHandoff\.ts$/,
// The relay's own parts, the gateway's alone: the windows' sessions to other machines, P2P and STUN, the
diff --git a/cli/src/backendSocket.spec.ts b/cli/src/backendSocket.spec.ts
index 1f526322d..3a960bfbe 100644
--- a/cli/src/backendSocket.spec.ts
+++ b/cli/src/backendSocket.spec.ts
@@ -13,6 +13,7 @@ import { wholeHistoryPage } from './core/transcripts/history.js'
import { grokMessagesToEvents } from './engines/grok/normalizer.js'
import { bindAgentList, bindAgentUpdate, bindCancelRequest, bindLaunchRequests, bindCloseRequests, bindMessageRequest, bindPurgeRequest, bindQuestionResponse, bindStopRequest, bindTerminalRequests } from './testing/socketCore.js'
import { emptyPorts, MODELS_FALLBACKS, MODELS_OFF, MONITOR_FALLBACKS, type ModelsPort } from './core/api.js'
+import { classifyGridAssignment } from './lib/gridAssignment.js'
import { createServiceHost, ServiceUnavailableError } from './core/serviceHost.js'
import { MODELS_REQUESTS, startModels } from './services/models.js'
import { SHELL_REQUESTS, startShell } from './services/shell.js'
@@ -3317,10 +3318,10 @@ describe('grid_models_list says whether this machine has a grid CLI', () => {
describe('a move onto a grid model asks models where it goes', () => {
/** A daemon whose models is a stub, asked over a local frame. Where the move goes, grid's set-up before
* it and the prewarm after it are the models service's (services/models.spec.ts). */
- function daemon(moveTarget: ModelsPort['moveTarget'] | null) {
+ function daemon(moveTarget: ModelsPort['moveTarget'] | null, apiTarget: ModelsPort['apiTarget'] = () => Promise.reject(new Error('no APIs'))) {
const socket = relaySocket('token')
const moved = vi.fn()
- if (moveTarget) socket.models = () => ({ annotation: () => null, lists: () => Promise.reject(new Error('no lists')), moveTarget, moved })
+ if (moveTarget) socket.models = () => ({ annotation: () => null, lists: () => Promise.reject(new Error('no lists')), moveTarget, moved, apiTarget })
const retargeted = vi.fn(async (_request: { agentId: string; grid: unknown }) => ({ ok: true as const }))
socket.onRetargetAgent = retargeted
const frames: Array<Record<string, unknown>> = []
@@ -3371,6 +3372,36 @@ describe('a move onto a grid model asks models where it goes', () => {
}
})
+ const API = { networkId: 'api:router', networkName: 'Router', baseUrl: 'https://router.fixture.invalid/v1', apiKey: 'fixture-key', model: 'vendor/model-a' }
+
+ it("a move onto a saved API's model: the launch models read, its endpoint recognised from then on, no grid started", async () => {
+ const apiTarget = vi.fn(async () => ({ target: API, apiBase: API.baseUrl }))
+ const d = daemon(vi.fn(), apiTarget)
+ const env = { ANTHROPIC_BASE_URL: 'https://router.fixture.invalid', ANTHROPIC_MODEL: 'vendor/model-a' }
+ expect(classifyGridAssignment('claude', env)).toBeNull()
+ expect(await d.ask('agent_retarget', { agentId: 'a1', apiConnection: 'router', apiModel: ' vendor/model-a ' })).toMatchObject({ retargeted: true })
+ expect(apiTarget).toHaveBeenCalledWith({ connectionId: 'router', model: 'vendor/model-a' })
+ expect(d.retargeted).toHaveBeenCalledWith({ agentId: 'a1', grid: API })
+ // Read in models' process: only the answer's endpoint can teach the core's grid assignment.
+ expect(classifyGridAssignment('claude', env)).toEqual({ baseUrl: 'https://router.fixture.invalid', model: 'vendor/model-a' })
+ expect(d.moved).not.toHaveBeenCalled()
+ await d.done()
+ })
+
+ it('a saved API that cannot be used says why in models\' words; models down or off says so; nothing moves', async () => {
+ const refused = daemon(vi.fn(), async () => ({ detail: 'This API is not saved. Add it in Models → APIs.' }))
+ expect(await refused.ask('agent_retarget', { agentId: 'a1', apiConnection: 'gone', apiModel: 'vendor/model-a' }))
+ .toMatchObject({ error: 'API_UNAVAILABLE', detail: 'This API is not saved. Add it in Models → APIs.' })
+ expect(refused.retargeted).not.toHaveBeenCalled()
+ await refused.done()
+ for (const d of [daemon(vi.fn(), async () => { throw new Error('models is down') }), daemon(null)]) {
+ expect(await d.ask('agent_retarget', { agentId: 'a1', apiConnection: 'router', apiModel: 'vendor/model-a' }))
+ .toMatchObject({ error: 'API_UNAVAILABLE', detail: 'The models service is not running, so this API cannot be used now. Try again in a moment.' })
+ expect(d.retargeted).not.toHaveBeenCalled()
+ await d.done()
+ }
+ })
+
it('a move onto an API, or back onto the own login, asks models nothing', async () => {
const moveTarget = vi.fn()
const d = daemon(moveTarget)
diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.ts
index a27812378..c05eca38f 100644
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@ -26,9 +26,8 @@ import type { CloseAgentService } from './lib/closeAgentService.js'
import { ENGINES, type AgentEngine } from './engines/types.js'
import { gridCliPresence } from './lib/gridBinary.js'
import { GRID_FLEET_PROTOCOL, GRID_FLEET_MAX_TIMEOUT_MS } from './lib/gridFleetProtocol.js'
-import { ApiConnectionError, ApiConnections } from './lib/apiConnections.js'
-import { resolveApiTarget } from './lib/apiModels.js'
-import { isApiLaunch, parseGridLaunchOverride, type GridLaunchOverride } from './lib/gridLaunch.js'
+import { rememberApiBase } from './lib/gridAssignment.js'
+import { isApiLaunch, parseGridLaunchOverride, type GridLaunchOverride } from './lib/gridLaunchWire.js'
import type { ScmLaunchRecord } from './scm/types.js'
import { probeEngines } from './lib/engineProbe.js'
import { engineInstallRecipe } from './lib/engineInstall.js'
@@ -63,7 +62,6 @@ export class BackendSocket {
/** This machine's name as Harness shows it (Machines), from the backend's `machine_meta`. Null
* until the first one arrives. */
private machineDisplayName: string | null = null
- private readonly apiConnections = new ApiConnections(env.ADAPTER_DATA_DIR)
/** The relay and its E2EE (gateway/gateway.ts): the one way to a remote client. Null in a unit test
* that has none, which then serves this computer alone. */
private gatewayPort: GatewayPort | null = null
@@ -421,7 +419,7 @@ export class BackendSocket {
* can be switched off or run in a process of its own; set by core/main.ts. Unset (tests), it reads as
* models being off.
*/
- models: (() => Pick<ModelsPort, 'annotation' | 'lists' | 'moveTarget' | 'moved'>) | null = null
+ models: (() => Pick<ModelsPort, 'annotation' | 'lists' | 'moveTarget' | 'moved' | 'apiTarget'>) | null = null
/** Set the account's private grid name from the reconcile that just confirmed it, so the RPCs
* answer with it at once rather than waiting for the next `machine_meta` (`lib/gridAttach.ts`). */
@@ -1001,9 +999,10 @@ export class BackendSocket {
// not know. A client that sends the full `grid` object still works unchanged.
const picked = typeof payload.gridModel === 'string' ? payload.gridModel : ''
// `apiConnection` + `apiModel`: a model of an API saved on this machine. Same rule as a grid
- // model — the app names it, and the endpoint and key are read here, from the store — and
- // only for whoever may manage those APIs (`api_connections`): this machine's own app, or
- // its owner's paired session. The key itself never leaves this daemon either way.
+ // model — the app names it, and the endpoint and key are read on this machine, from its store, by
+ // the models service that keeps it (`ModelsPort.apiTarget`) — and only for whoever may manage those
+ // APIs (`api_connections`): this machine's own app, or its owner's paired session. The key itself
+ // never leaves this daemon either way.
const api = typeof payload.apiConnection === 'string' ? payload.apiConnection : ''
if (api && (picked || payload.grid !== undefined || clear)) {
reply(type, requestId, { error: 'INVALID_GRID', detail: 'Choose an API model, a grid model or the own login, not several.' })
@@ -1011,15 +1010,18 @@ export class BackendSocket {
}
if (api) {
if (!owner) { reply(type, requestId, { error: 'OWNER_REQUIRED' }); return }
- try {
- payload.grid = await resolveApiTarget(this.apiConnections, api, typeof payload.apiModel === 'string' ? payload.apiModel.trim() : '')
- } catch (error) {
+ const model = typeof payload.apiModel === 'string' ? payload.apiModel.trim() : ''
+ const resolved = this.models ? await this.models().apiTarget({ connectionId: api, model }).catch(() => null) : null
+ if (!resolved || !('target' in resolved)) {
reply(type, requestId, {
error: 'API_UNAVAILABLE',
- detail: error instanceof ApiConnectionError ? error.message : 'This API could not be used. Try again.',
+ detail: resolved?.detail ?? 'The models service is not running, so this API cannot be used now. Try again in a moment.',
})
return
}
+ // An agent on it from now on reports that API's model, as when the socket read the store itself.
+ rememberApiBase(resolved.apiBase)
+ payload.grid = resolved.target
}
if (picked && payload.grid === undefined && !clear) {
// The grid the model was picked FROM, when the picker says (a shared grid's section); the
diff --git a/cli/src/core/agents/create.spec.ts b/cli/src/core/agents/create.spec.ts
index 27062410a..cfd17cbf7 100644
--- a/cli/src/core/agents/create.spec.ts
+++ b/cli/src/core/agents/create.spec.ts
@@ -11,7 +11,7 @@ import { enginePathOverride } from '../../lib/engineBin.js'
import { buildEngineLaunchArgv, namedAgentArgs, permissionModeFlags, refusePermissionFlagIfUnsupported, supportsFirstPrompt } from '../../lib/engineLaunch.js'
import { setUpWithin } from '../../lib/setUpWithin.js'
import { writeGridConfigDir } from '../../lib/gridConfigDir.js'
-import { buildGridEngineLaunch } from '../../lib/gridLaunch.js'
+import type { GridLaunchAnswer, GridLaunchRequest } from '../../lib/gridLaunchWire.js'
import { engineHooks } from '../../engines/hooks.js'
import { loadEngine } from '../../engines/inProcess.js'
import type { RegisteredSession } from '../../lib/registry.js'
@@ -60,12 +60,15 @@ vi.mock('../../lib/engineLaunch.js', async (real) => ({
}))
vi.mock('../../lib/setUpWithin.js', async (real) => ({ ...await real<object>(), setUpWithin: vi.fn(async (run: () => Promise<unknown>) => { await run(); return 'done' }) }))
vi.mock('../../lib/gridConfigDir.js', () => ({ writeGridConfigDir: vi.fn(async () => '/config/harness-claude') }))
-vi.mock('../../lib/gridLaunch.js', async (real) => ({
+vi.mock('../../lib/gridLaunchWire.js', async (real) => ({
...await real<object>(),
- buildGridEngineLaunch: vi.fn(() => ({ ok: true, launch: { env: { GRID_KEY: 'k' }, args: ['--grid'], webSearch: 'off' } })),
describeGridLaunch: vi.fn(() => '[grid] claude on Home'),
gridConflictingEnvToClear: vi.fn(() => ['ANTHROPIC_API_KEY']),
}))
+// The models service's grid launch (`CreateAgentDeps.buildGridLaunch`), as it answers a launch it can build.
+const buildGridLaunch = vi.fn(async (request: GridLaunchRequest): Promise<GridLaunchAnswer> => ({
+ ok: true, launch: { env: { GRID_KEY: 'k' }, args: ['--grid'], webSearch: 'unsupported' }, override: request.override,
+}))
vi.mock('../../engines/hooks.js', async (real) => {
const actual = await real<typeof import('../../engines/hooks.js')>()
return { ...actual, engineHooks: { ...actual.engineHooks, codex: { ...actual.engineHooks.codex, installIn: vi.fn() } } }
@@ -107,6 +110,7 @@ function setup(over: Partial<CreateAgentDeps> = {}) {
hooksDisabled: false,
installOpencodePlugin: vi.fn(async () => true),
gridLaunchMachine: vi.fn(() => ({}) as never),
+ buildGridLaunch,
terminalHintMachineName: () => 'this-mac',
blocksFolder: vi.fn(() => false),
gridSetup: vi.fn(() => vi.fn(async () => ({}))) as never,
@@ -166,15 +170,26 @@ describe('creating an agent', () => {
vi.mocked(installedDsh).mockReset().mockReturnValue(undefined)
})
+ it('for a harness on a grid models cannot build: asked first, so the folder is left as it was', async () => {
+ vi.mocked(installedDsh).mockReturnValue(installed() as never)
+ const grid = { networkId: 'g1', networkName: 'Home', baseUrl: 'http://g', model: 'm' }
+ const { create } = setup()
+ buildGridLaunch.mockResolvedValueOnce({ ok: false, error: 'GRID_UNAVAILABLE', detail: 'models is down', unavailable: 'models' })
+ expect(await create(request({ dsh: 'blender', grid }))).toEqual({ ok: false, error: 'GRID_UNAVAILABLE', detail: 'models is down' })
+ expect(materializeWorkspace).not.toHaveBeenCalled()
+ expect(preTrustClaudeProject).not.toHaveBeenCalled()
+ vi.mocked(installedDsh).mockReset().mockReturnValue(undefined)
+ })
+
it('for a grid it cannot honour: refused by the launch, a tmux too old, or a config it cannot write', async () => {
const grid = { networkId: 'g1', networkName: 'Home', baseUrl: 'http://g', model: null }
const { create } = setup()
- vi.mocked(buildGridEngineLaunch).mockReturnValueOnce({ ok: false, error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no grid for amp' } as never)
+ buildGridLaunch.mockResolvedValueOnce({ ok: false, error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no grid for amp' })
expect(await create(request({ grid }))).toEqual({ ok: false, error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no grid for amp' })
vi.mocked(tmuxSupportsSessionEnv).mockResolvedValueOnce(false)
expect(await create(request({ grid }))).toMatchObject({ error: 'TMUX_TOO_OLD_FOR_GRID' })
const configured = { ok: true, launch: { env: {}, args: [], webSearch: 'off', configDir: { envVar: 'PI_CONFIG', files: {}, links: [] } } }
- vi.mocked(buildGridEngineLaunch).mockReturnValueOnce(configured as never).mockReturnValueOnce(configured as never)
+ buildGridLaunch.mockResolvedValueOnce(configured as never).mockResolvedValueOnce(configured as never)
vi.mocked(writeGridConfigDir).mockRejectedValueOnce(new Error('read-only')).mockRejectedValueOnce('worse')
expect(await create(request({ grid }))).toMatchObject({ error: 'GRID_CONFIG_FAILED', detail: "could not write claude's grid configuration · read-only" })
expect(await create(request({ grid }))).toMatchObject({ detail: "could not write claude's grid configuration · worse" })
@@ -296,10 +311,10 @@ describe('creating an agent', () => {
const { create } = setup()
await create(request({ grid }))
expect(vi.mocked(createAndRegisterPane).mock.calls[0][0]).toMatchObject({
- grid: { baseUrl: 'http://g', model: 'm1' }, gridLaunchRecord: { override: grid, webSearch: 'off' }, env: expect.objectContaining({ GRID_KEY: 'k' }),
+ grid: { baseUrl: 'http://g', model: 'm1' }, gridLaunchRecord: { override: grid, webSearch: 'unsupported' }, env: expect.objectContaining({ GRID_KEY: 'k' }),
})
const withFile = (pointAt?: string) => ({ ok: true, launch: { env: {}, args: [], webSearch: 'off', configDir: { envVar: 'OPENCODE_CONFIG', files: {}, links: [], pointAt } } })
- vi.mocked(buildGridEngineLaunch).mockReturnValueOnce(withFile('opencode.json') as never).mockReturnValueOnce(withFile() as never)
+ buildGridLaunch.mockResolvedValueOnce(withFile('opencode.json') as never).mockResolvedValueOnce(withFile() as never)
await create(request({ grid: { ...grid, model: undefined } }))
await create(request({ grid }))
expect(vi.mocked(createAndRegisterPane).mock.calls[1][0]).toMatchObject({ grid: { model: null }, env: { OPENCODE_CONFIG: '/config/harness-claude/opencode.json' } })
@@ -341,7 +356,7 @@ describe('creating an agent', () => {
expect(createAndRegisterPane).not.toHaveBeenCalled()
// Any other engine's launch loads nothing, and its machine facts are asked for that engine.
vi.mocked(loadEngine).mockClear()
- vi.mocked(buildGridEngineLaunch).mockReturnValueOnce({ ok: false, error: 'GRID_UNSUPPORTED', detail: 'no' } as never)
+ buildGridLaunch.mockResolvedValueOnce({ ok: false, error: 'GRID_UNSUPPORTED', detail: 'no' })
await t.create(request({ engine: 'claude', agent: 'reviewer', grid: { networkName: 'g' } }))
expect(loadEngine).not.toHaveBeenCalled()
expect(t.deps.gridLaunchMachine).toHaveBeenCalledWith('claude')
diff --git a/cli/src/core/agents/create.ts b/cli/src/core/agents/create.ts
index c7b4fa6d5..8c4b7be8f 100644
--- a/cli/src/core/agents/create.ts
+++ b/cli/src/core/agents/create.ts
@@ -29,7 +29,7 @@ import {
} from '../../lib/engineLaunch.js'
import { setUpWithin } from '../../lib/setUpWithin.js'
import { writeGridConfigDir } from '../../lib/gridConfigDir.js'
-import { buildGridEngineLaunch, describeGridLaunch, gridConflictingEnvToClear, type GridLaunchMachine, type GridWebSearchStatus } from '../../lib/gridLaunch.js'
+import { describeGridLaunch, gridConflictingEnvToClear, type GridLaunchAnswer, type GridLaunchMachine, type GridLaunchRequest, type GridWebSearchStatus } from '../../lib/gridLaunchWire.js'
import { profileEnvironment } from '../../lib/engineHomes.js'
import { DEFAULT_HARNESS_PERMISSION, freshHarnessEnvironment } from '../../lib/harnessDefaults.js'
import { buildHarnessSessionLabel } from '../../lib/harnessSessionLabel.js'
@@ -73,6 +73,9 @@ export interface CreateAgentDeps {
installOpencodePlugin: (port: number) => Promise<boolean>
/** The facts about this machine a launch of `engine` needs (lib/gridLaunch.ts). */
gridLaunchMachine: (engine: AgentEngine) => GridLaunchMachine
+ /** A grid or saved-API launch, built by the models service (core/agents/launch.ts `gridLaunchThrough`): the core
+ * builds none itself, and a create on a grid while models is down is refused (GRID_UNAVAILABLE). */
+ buildGridLaunch: (request: GridLaunchRequest) => Promise<GridLaunchAnswer>
terminalHintMachineName: () => string
/** Whether a folder is being purged (PurgeAgentService.blocksFolder). */
blocksFolder: (cwd: string) => boolean | undefined
@@ -84,8 +87,8 @@ export interface CreateAgentDeps {
export function createAgentCreator({
tmuxBackend, registry, adoptableSession, heldBy, takeOverWhenIdle, watchNewPane, announceSession, attachDsh,
- prepareApiTools, hookPort, hooksDisabled, installOpencodePlugin, gridLaunchMachine, terminalHintMachineName, blocksFolder, gridSetup,
- privateGridName,
+ prepareApiTools, hookPort, hooksDisabled, installOpencodePlugin, gridLaunchMachine, buildGridLaunch, terminalHintMachineName, blocksFolder,
+ gridSetup, privateGridName,
}: CreateAgentDeps) {
const createAgent: CreateAgent = async ({ engine, cwd, bypassPermission, permissionMode, grid, codexHome, dsh, prompt, name, agent, resumeSessionId, takeOver, scmLaunchRecord }) => {
if (!tmuxBackend) return { ok: false, error: 'TMUX_UNAVAILABLE' }
@@ -154,8 +157,8 @@ export function createAgentCreator({
let dshLabel: string | undefined
/** What the harness is told about the signed-in account (its private grid), not left to guess. */
let dshAccount: DshAccount = {}
+ const installed = dsh ? installedDsh(dsh) : undefined
if (dsh) {
- const installed = installedDsh(dsh)
if (!installed) return { ok: false, error: 'INVALID_DSH', detail: `${dsh} is not installed on this machine` }
if (installed.manifest.kind === 'viewer') return { ok: false, error: 'INVALID_DSH', detail: `${dsh} is a viewer package, not an agent` }
const refusal = incompatibleHarnessEngine(dsh, installed.manifest, engine)
@@ -169,10 +172,23 @@ export function createAgentCreator({
console.warn(`[agent] create ${dsh} refused · ${detail}`)
return { ok: false, error: 'TMUX_TOO_OLD_FOR_DSH', detail }
}
+ }
+ // A grid is the user's answer to "where should this run", so every way of not honouring it is a
+ // refusal rather than a fallback — an agent silently started on the engine's own login spends the
+ // wrong account and looks identical to one that worked. Asked of models before a harness's workspace is
+ // laid out or trusted: a create refused here leaves the folder as it was.
+ const built = grid ? await buildGridLaunch({ engine, override: grid, machine: gridLaunchMachine(engine) }) : null
+ if (built && !built.ok) {
+ console.warn(`[agent] create ${engine} refused · ${built.detail}`)
+ return { ok: false, error: built.error, detail: built.detail }
+ }
+ if (dsh) {
+ // Checked above: a harness that is not installed was refused before models was asked.
+ const harness = installed!
// The Model Manager is grid in use, however it was made (the Store, New Harness, `harness new`, the
// models picker): grid is set up before the workspace asks it which grid is this account's.
const ensureGrid = gridSetup()
- if (installed.id === MODEL_MANAGER_ID && ensureGrid) {
+ if (harness.id === MODEL_MANAGER_ID && ensureGrid) {
const setUp = await setUpWithin(() => ensureGrid({ ownGrid: true }), MODEL_MANAGER_GRID_WAIT_MS)
if (setUp === 'pending') console.log(`[dsh] ${dsh} · grid is still being set up; the agent waits for it with \`harness grid setup\``)
}
@@ -182,7 +198,7 @@ export function createAgentCreator({
// Not there yet is empty; unreadable is not — trust is only ever granted on evidence.
const emptyBefore = await readdir(cwd).then((names) => names.length === 0,
(error: NodeJS.ErrnoException) => error.code === 'ENOENT')
- const materialized = await materializeWorkspace(installed, cwd, dshAccount, engine)
+ const materialized = await materializeWorkspace(harness, cwd, dshAccount, engine)
for (const warning of materialized.warnings) console.warn(`[dsh] ${dsh} materialize · ${warning}`)
console.log(`[dsh] ${dsh} materialized ${cwd} · created ${materialized.created.length} · kept ${materialized.kept.length}`)
// The template just went into an EMPTY folder: everything in it is the harness's, and Claude Code
@@ -199,22 +215,14 @@ export function createAgentCreator({
console.warn(`[agent] create ${dsh} refused · ${detail}`)
return { ok: false, error: 'DSH_MATERIALIZE_FAILED', detail }
}
- const prepared = harnessLaunchOrRefusal(() => prepareHarnessLaunch(installed, cwd, engine, label, dshAccount, null))
+ const prepared = harnessLaunchOrRefusal(() => prepareHarnessLaunch(harness, cwd, engine, label, dshAccount, null))
if (!prepared.ok) return prepared
dshEnv = prepared.launch.env
dshArgs = prepared.launch.args
- dshLabel = installed.manifest.name
+ dshLabel = harness.manifest.name
}
- // A grid is the user's answer to "where should this run", so every way of not honouring it is a
- // refusal rather than a fallback — an agent silently started on the engine's own login spends the
- // wrong account and looks identical to one that worked.
let gridLaunch: { env: Record<string, string>; args: string[]; webSearch: GridWebSearchStatus } | undefined
- if (grid) {
- const built = buildGridEngineLaunch(engine, grid, gridLaunchMachine(engine))
- if (!built.ok) {
- console.warn(`[agent] create ${engine} refused · ${built.detail}`)
- return { ok: false, error: built.error, detail: built.detail }
- }
+ if (grid && built?.ok) {
if (!(await tmuxSupportsSessionEnv())) {
const detail = `this machine's tmux is older than `
+ `${TMUX_SESSION_ENV_MIN.major}.${TMUX_SESSION_ENV_MIN.minor}, which is the first version that can `
diff --git a/cli/src/core/agents/heldLaunches.spec.ts b/cli/src/core/agents/heldLaunches.spec.ts
new file mode 100644
index 000000000..637df6cae
--- /dev/null
+++ b/cli/src/core/agents/heldLaunches.spec.ts
@@ -0,0 +1,163 @@
+import { execFileSync } from 'node:child_process'
+import { describe, expect, it, vi } from 'vitest'
+import type { AgentLaunch, RegisteredSession } from '../../lib/registry.js'
+import { heldLaunch, type RestoreSummary } from '../../lib/restoreAgents.js'
+import { createHeldLaunches, heldFor, heldPaneArgv } from './heldLaunches.js'
+
+const HELD = heldLaunch('models')
+const row = (agentId: string, launch: AgentLaunch, over: Partial<RegisteredSession> = {}) =>
+ ({ agentId, sessionId: `s-${agentId}`, launch, ...over }) as RegisteredSession
+const summary = (over: Partial<RestoreSummary> = {}): RestoreSummary => ({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [], ...over })
+
+/** A registry of rows and a restore that does to them what `answer` says, recording what it was asked. */
+function setup(rows: RegisteredSession[], answer: (only: ReadonlySet<string>) => RestoreSummary = (only) => summary({ restored: [...only] })) {
+ const registry = new Map(rows.map((r) => [r.agentId, r]))
+ const asked: string[][] = []
+ const restore = vi.fn(async (only: ReadonlySet<string>) => {
+ asked.push([...only])
+ const result = answer(only)
+ for (const id of result.restored) { const r = registry.get(id); if (r) r.launch = { state: 'starting' } }
+ return result
+ })
+ const log = vi.fn()
+ const held = createHeldLaunches({ registry: { list: () => [...registry.values()], byAgent: (id: string) => registry.get(id) } as never, restore, log })
+ return { registry, asked, restore, log, held }
+}
+
+describe('agents held until a service is ready', () => {
+ it('names the service a row is held for, and none for any other', () => {
+ expect(heldFor(row('a', HELD))).toBe('models')
+ expect(heldFor(row('a', { state: 'ready' }))).toBeNull()
+ expect(heldFor(row('a', { state: 'failed', error: 'X' }))).toBeNull()
+ expect(heldFor(undefined)).toBeNull()
+ })
+
+ it("its pane says why, survives an interrupt, and idles: the agent's launch takes it over", () => {
+ const argv = heldPaneArgv('Waiting for the models service.')
+ expect(argv.slice(0, 2)).toEqual(['/bin/sh', '-c'])
+ expect(argv[2]).toContain('trap "" INT QUIT TSTP')
+ // The script itself, run with its loop cut short: it prints the reason as given, and nothing else.
+ const once = argv[2]!.replace('while :; do sleep 3600; done', 'exit 0')
+ expect(execFileSync('/bin/sh', ['-c', once, argv[3]!, argv[4]!], { encoding: 'utf8' })).toBe('Waiting for the models service.\n')
+ })
+
+ it('runs no pass before the boot has restored, whatever it asked meanwhile', async () => {
+ const { held, asked } = setup([row('a', HELD)])
+ const pass = held.restoreHeld()
+ await Promise.resolve()
+ expect(asked).toEqual([])
+ expect(await held.boot(async () => 'booted')).toBe('booted')
+ expect(await pass).toMatchObject({ restored: ['a'] })
+ // A boot that throws opens them all the same.
+ const failing = setup([row('b', HELD)])
+ const later = failing.held.restoreHeld()
+ await expect(failing.held.boot(async () => { throw new Error('restore broke') })).rejects.toThrow('restore broke')
+ expect(await later).toMatchObject({ restored: ['b'] })
+ })
+
+ it('launches every held agent once the core is ready, or those held for one service when it connects', async () => {
+ const { held, asked, log } = setup([row('a', HELD), row('b', heldLaunch('store')), row('c', { state: 'ready' })])
+ await held.boot(async () => {})
+ expect(await held.restoreHeld('store')).toMatchObject({ restored: ['b'] })
+ expect(await held.restoreHeld()).toMatchObject({ restored: ['a'] })
+ expect(asked).toEqual([['b'], ['a']])
+ // Nothing held: no pass at all.
+ expect(await held.restoreHeld()).toBeNull()
+ expect(asked).toHaveLength(2)
+ expect(log.mock.calls.map(([line]) => line)).toEqual([
+ '[restore] held · store · launched 1 of 1',
+ '[restore] held · every service · launched 1 of 1',
+ ])
+ })
+
+ it('says what is still waiting after a pass that could not ask', async () => {
+ const { held, log } = setup([row('a', HELD), row('b', HELD)], (only) => summary({ held: [...only] }))
+ await held.boot(async () => {})
+ await held.restoreHeld('models')
+ expect(log).toHaveBeenLastCalledWith('[restore] held · models · launched 0 of 2 · 2 still waiting')
+ })
+
+ it('runs one pass at a time, and a pass that fails does not stop the next', async () => {
+ let release!: () => void
+ const order: string[] = []
+ const { held, restore } = setup([row('a', HELD)])
+ restore.mockImplementationOnce(async () => { order.push('first'); await new Promise<void>((done) => { release = done }); throw new Error('models hung up') })
+ await held.boot(async () => {})
+ const first = held.restoreHeld()
+ const second = held.restoreHeld()
+ await vi.waitFor(() => expect(order).toEqual(['first']))
+ expect(restore).toHaveBeenCalledTimes(1)
+ release()
+ await expect(first).rejects.toThrow('models hung up')
+ expect(await second).toMatchObject({ restored: ['a'] })
+ })
+
+ describe("a person's restart of a held agent", () => {
+ it('is not one for an agent that is not held: it restarts as it always has', () => {
+ const { held } = setup([row('a', { state: 'ready' })])
+ expect(held.restartHeld('a')).toBeNull()
+ expect(held.restartHeld('nobody')).toBeNull()
+ })
+
+ it('launches it, and answers it as a restart would', async () => {
+ const { held, log } = setup([row('a', HELD)])
+ await held.boot(async () => {})
+ expect(await held.restartHeld('a')).toMatchObject({ ok: true, session: { agentId: 'a' }, resumed: true })
+ expect(log).toHaveBeenCalledWith('[restart] a launched from held')
+ const fresh = setup([row('b', HELD, { sessionId: '' })])
+ await fresh.held.boot(async () => {})
+ expect(await fresh.held.restartHeld('b')).toMatchObject({ ok: true, resumed: false })
+ })
+
+ it('says it still waits, or why its launch failed, or that it could not be launched', async () => {
+ const waiting = setup([row('a', HELD)], (only) => summary({ held: [...only] }))
+ await waiting.held.boot(async () => {})
+ expect(await waiting.held.restartHeld('a')).toEqual({ ok: false, error: 'SERVICE_UNAVAILABLE', detail: HELD.state === 'held' ? HELD.detail : '' })
+ const refused = setup([row('b', HELD)], (only) => summary({ failed: [...only].map((agentId) => ({ agentId, reason: 'no way there' })) }))
+ refused.restore.mockImplementationOnce(async (only) => {
+ refused.registry.get('b')!.launch = { state: 'failed', error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no way there' }
+ return summary({ failed: [...only].map((agentId) => ({ agentId, reason: 'no way there' })) })
+ })
+ await refused.held.boot(async () => {})
+ expect(await refused.held.restartHeld('b')).toEqual({ ok: false, error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no way there' })
+ const bare = setup([row('c', HELD)])
+ bare.restore.mockImplementationOnce(async () => { bare.registry.get('c')!.launch = { state: 'failed', error: 'START_TIMEOUT' }; return summary() })
+ await bare.held.boot(async () => {})
+ expect(await bare.held.restartHeld('c')).toEqual({ ok: false, error: 'START_TIMEOUT' })
+ const lost = setup([row('d', HELD)], (only) => summary({ failed: [...only].map((agentId) => ({ agentId, reason: 'tmux said no' })) }))
+ lost.restore.mockImplementationOnce(async (only) => { lost.registry.get('d')!.launch = { state: 'ready' }; return summary({ failed: [...only].map((agentId) => ({ agentId, reason: 'tmux said no' })) }) })
+ await lost.held.boot(async () => {})
+ expect(await lost.held.restartHeld('d')).toEqual({ ok: false, error: 'RESTART_FAILED', detail: 'tmux said no' })
+ const none = setup([row('e', HELD)], () => summary())
+ none.restore.mockImplementationOnce(async () => { none.registry.get('e')!.launch = { state: 'ready' }; return summary() })
+ await none.held.boot(async () => {})
+ expect(await none.held.restartHeld('e')).toEqual({ ok: false, error: 'RESTART_FAILED', detail: 'The harness could not be launched.' })
+ })
+
+ it('leaves an agent a pass launched meanwhile, or that was stopped or closed meanwhile, as it is', async () => {
+ const { held, registry, restore } = setup([row('a', HELD), row('b', HELD)])
+ const launchedMeanwhile = held.restartHeld('a')!
+ const closedMeanwhile = held.restartHeld('b')!
+ registry.get('a')!.launch = { state: 'ready' }
+ registry.delete('b')
+ await held.boot(async () => {})
+ expect(await launchedMeanwhile).toMatchObject({ ok: true, session: { agentId: 'a' } })
+ expect(await closedMeanwhile).toEqual({ ok: false, error: 'AGENT_NOT_FOUND' })
+ expect(restore).not.toHaveBeenCalled()
+ // Closed while its own pass ran.
+ const gone = setup([row('c', HELD)])
+ gone.restore.mockImplementationOnce(async () => { gone.registry.delete('c'); return summary({ restored: ['c'] }) })
+ await gone.held.boot(async () => {})
+ expect(await gone.held.restartHeld('c')).toEqual({ ok: false, error: 'AGENT_NOT_FOUND' })
+ })
+ })
+
+ it('restores only rows still held when the pass runs: one stopped or closed since is left alone', async () => {
+ const { held, registry, asked } = setup([row('a', HELD), row('b', HELD)])
+ const pass = held.restoreHeld()
+ registry.delete('b')
+ await held.boot(async () => {})
+ await pass
+ expect(asked).toEqual([['a']])
+ })
+})
diff --git a/cli/src/core/agents/heldLaunches.ts b/cli/src/core/agents/heldLaunches.ts
new file mode 100644
index 000000000..f3c82d5ae
--- /dev/null
+++ b/cli/src/core/agents/heldLaunches.ts
@@ -0,0 +1,100 @@
+/**
+ * Agents held until the service their launch asks is ready (docs/design/2026-10-08-launch-port.md, "Held").
+ *
+ * A launch that asks a service for its part (a grid's or a saved API's, from models) is never waited on before the
+ * core is ready: the boot's restore holds the agent in a pane that says what it waits for (lib/restoreAgents.ts
+ * `defer`), and the pass here launches it into that pane once the core is up. A service that cannot be asked then
+ * keeps it held, and the rest of that pass after it unasked. Held is never failed and never retired: discovery sees
+ * its pane alive, and every later pass tries again. A pass runs:
+ *
+ * - once the core is ready, for every held agent;
+ * - each time a service connects (a restarted one too), for the agents held for it;
+ * - when a person restarts a held agent, for that one.
+ *
+ * One pass at a time, in order, each after the boot's: two passes over one agent would launch it twice. An agent
+ * the person stopped or closed meanwhile is no longer held, and is left alone.
+ */
+import { sid } from '../../lib/log.js'
+import type { registry, RegisteredSession } from '../../lib/registry.js'
+import type { RestoreSummary } from '../../lib/restoreAgents.js'
+
+/** The service a row is held for, or null. */
+export function heldFor(row: Pick<RegisteredSession, 'launch'> | undefined): string | null {
+ return row?.launch?.state === 'held' ? row.launch.service : null
+}
+
+export interface HeldLaunchesDeps {
+ registry: Pick<typeof registry, 'list' | 'byAgent'>
+ /** The boot's restore, of exactly these agents, outside the registry's transaction (lib/restoreAgents.ts `only`). */
+ restore: (only: ReadonlySet<string>) => Promise<RestoreSummary>
+ log: (line: string) => void
+}
+
+export type HeldRestart =
+ | { ok: true; session: RegisteredSession; resumed: boolean }
+ | { ok: false; error: string; detail?: string }
+
+export function createHeldLaunches({ registry, restore, log }: HeldLaunchesDeps) {
+ // Closed until the boot's restore has run: an agent held since the last daemon is that pass's to look at first.
+ let opened!: () => void
+ let queue: Promise<unknown> = new Promise<void>((done) => { opened = done })
+ /** One pass at a time, in the order asked: a pass that fails does not stop the next. */
+ const serial = <T>(run: () => Promise<T>): Promise<T> => {
+ const next = queue.then(run)
+ queue = next.catch(() => {})
+ return next
+ }
+
+ /** The agents held (for `service`, or for any), launched now. */
+ const restoreHeld = (service?: string): Promise<RestoreSummary | null> => serial(async () => {
+ const held = new Set(registry.list().filter((row) => {
+ const holder = heldFor(row)
+ return holder !== null && (service === undefined || holder === service)
+ }).map((row) => row.agentId))
+ if (!held.size) return null
+ const summary = await restore(held)
+ log(`[restore] held · ${service ?? 'every service'} · launched ${summary.restored.length} of ${held.size}`
+ + (summary.held.length ? ` · ${summary.held.length} still waiting` : ''))
+ return summary
+ })
+
+ /** A person's restart of a held agent: launched as a pass would, or why not. Null for an agent that is not held,
+ * which a restart handles as it always has. */
+ const restartHeld = (agentId: string): Promise<HeldRestart> | null => {
+ if (!heldFor(registry.byAgent(agentId))) return null
+ return serial(async () => {
+ // Asked again in turn: a pass before this one may have launched it, or the person closed it.
+ const before = registry.byAgent(agentId)
+ if (!before) return { ok: false, error: 'AGENT_NOT_FOUND' }
+ if (!heldFor(before)) return { ok: true, session: before, resumed: !!before.sessionId }
+ const summary = await restore(new Set([agentId]))
+ const now = registry.byAgent(agentId)
+ if (!now) return { ok: false, error: 'AGENT_NOT_FOUND' }
+ if (summary.restored.includes(agentId)) {
+ log(`[restart] ${sid(agentId)} launched from held`)
+ return { ok: true, session: now, resumed: !!now.sessionId }
+ }
+ const launch = now.launch
+ if (launch?.state === 'held') return { ok: false, error: 'SERVICE_UNAVAILABLE', detail: launch.detail }
+ if (launch?.state === 'failed') return { ok: false, error: launch.error, ...(launch.detail ? { detail: launch.detail } : {}) }
+ return { ok: false, error: 'RESTART_FAILED', detail: summary.failed.find((row) => row.agentId === agentId)?.reason ?? 'The harness could not be launched.' }
+ })
+ }
+
+ return {
+ /** The boot's restore, before any pass here: they wait for it, whether it restores, fails or has nothing to do. */
+ boot: async <T>(run: () => Promise<T>): Promise<T> => {
+ try { return await run() } finally { opened() }
+ },
+ restoreHeld,
+ restartHeld,
+ }
+}
+
+/**
+ * What a held agent's pane runs while it waits: the reason, and nothing to type into. It survives the interrupt a
+ * person might send it, and the agent's launch takes the pane over (`respawn`) once the service is ready.
+ */
+export function heldPaneArgv(detail: string): string[] {
+ return ['/bin/sh', '-c', 'trap "" INT QUIT TSTP; printf "%s\\n" "$1"; while :; do sleep 3600; done', 'harness-held', detail]
+}
diff --git a/cli/src/core/agents/launch.spec.ts b/cli/src/core/agents/launch.spec.ts
index 641d2a3df..9b28bcb60 100644
--- a/cli/src/core/agents/launch.spec.ts
+++ b/cli/src/core/agents/launch.spec.ts
@@ -1,16 +1,16 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { prepareResume } from '../../engines/launchPrep.js'
-import { ApiConnectionError, type ApiConnections } from '../../lib/apiConnections.js'
-import { refreshApiLaunch } from '../../lib/apiModels.js'
+import { rememberApiBase } from '../../lib/gridAssignment.js'
+import type { GridLaunchAnswer, GridLaunchOverride, GridLaunchRequest } from '../../lib/gridLaunchWire.js'
import { dropPermissionFlagIfUnsupported } from '../../lib/engineLaunch.js'
import { buildLaunchOverrides, type LaunchOverrides, type LaunchOverridesDeps } from '../../lib/launchOverrides.js'
import { loadEngine } from '../../engines/inProcess.js'
import { prepareInstructionWrites } from '../../scm/scmProjects.js'
import type { RegisteredSession } from '../../lib/registry.js'
-import { createLaunchHelpers, type LaunchHelperDeps } from './launch.js'
+import { createLaunchHelpers, gridLaunchThrough, type LaunchHelperDeps } from './launch.js'
vi.mock('../../engines/launchPrep.js', async (real) => ({ ...await real<object>(), prepareResume: vi.fn(() => ({ repairedItems: 0 })) }))
-vi.mock('../../lib/apiModels.js', async (real) => ({ ...await real<object>(), refreshApiLaunch: vi.fn((_apis: unknown, launch: object) => ({ ...launch, refreshed: true })) }))
+vi.mock('../../lib/gridAssignment.js', async (real) => ({ ...await real<object>(), rememberApiBase: vi.fn() }))
vi.mock('../../lib/engineLaunch.js', async (real) => ({ ...await real<object>(), dropPermissionFlagIfUnsupported: vi.fn() }))
// OpenCode's version is its own code, loaded for an OpenCode relaunch alone; a test may say it could not be.
vi.mock('../../engines/inProcess.js', async (real) => {
@@ -29,7 +29,6 @@ const session = (over: Partial<RegisteredSession> = {}): RegisteredSession =>
function setup() {
const deps: LaunchHelperDeps = {
prepareApiTools: vi.fn(),
- savedApis: {} as ApiConnections,
launchOverridesDeps: { marker: 'deps' } as unknown as LaunchOverridesDeps,
setGridLaunch: vi.fn(() => true),
setTail: vi.fn(),
@@ -67,21 +66,6 @@ describe('relaunch helpers', () => {
const grid = { networkId: 'grid-1', networkName: 'Home grid' }
await helpers.relaunchOverrides(session({ dsh: undefined, dshRuntime: undefined, agent: undefined } as Partial<RegisteredSession>), { gridLaunch: grid } as never)
expect(buildLaunchOverrides).toHaveBeenLastCalledWith(deps.launchOverridesDeps, 'claude', expect.objectContaining({ dsh: null, agent: null, gridLaunch: grid }), 'a1')
- expect(refreshApiLaunch).not.toHaveBeenCalled()
- })
-
- it('relaunches on a saved API with its key as saved now, and refuses one that is gone', async () => {
- const { deps, helpers } = setup()
- const api = { networkId: 'api:openrouter', networkName: 'OpenRouter' }
- await helpers.relaunchOverrides(session(), { gridLaunch: api } as never)
- expect(refreshApiLaunch).toHaveBeenCalledWith(deps.savedApis, api)
- expect(vi.mocked(buildLaunchOverrides).mock.lastCall?.[2]).toMatchObject({ gridLaunch: { ...api, refreshed: true } })
- vi.mocked(refreshApiLaunch).mockImplementationOnce(() => { throw new ApiConnectionError('OpenRouter was removed.') })
- expect(await helpers.relaunchOverrides(session(), { gridLaunch: api } as never)).toEqual({ ok: false, error: 'API_UNAVAILABLE', detail: 'OpenRouter was removed.' })
- vi.mocked(refreshApiLaunch).mockImplementationOnce(() => { throw new Error('unreadable store') })
- expect(await helpers.relaunchOverrides(session(), { gridLaunch: api } as never)).toEqual({
- ok: false, error: 'API_UNAVAILABLE', detail: 'OpenRouter could not be read from saved APIs.',
- })
})
it('records the web-search decision a relaunch made, when it made one', () => {
@@ -127,3 +111,32 @@ describe('relaunch helpers', () => {
])
})
})
+
+describe('a grid launch, as the core asks the models service for it', () => {
+ afterEach(() => { vi.clearAllMocks() })
+ const grid: GridLaunchOverride = { networkId: 'grid-1', networkName: 'Home grid', baseUrl: 'https://grid.example/v1', apiKey: 'k', model: 'm' }
+ const api: GridLaunchOverride = { networkId: 'api:openrouter', networkName: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1', apiKey: 'k', model: 'q' }
+ const request = (override = grid): GridLaunchRequest => ({ engine: 'claude', override, machine: { hermesSystemManaged: false } })
+
+ it("hands back models' answer as it is, and remembers a saved API's endpoint it read", async () => {
+ const built: GridLaunchAnswer = { ok: true, launch: { env: {}, args: [], webSearch: 'on' }, override: grid }
+ expect(await gridLaunchThrough(() => ({ gridLaunch: async () => built }))(request())).toBe(built)
+ expect(rememberApiBase).not.toHaveBeenCalled()
+ const refused: GridLaunchAnswer = { ok: false, error: 'API_UNAVAILABLE', detail: 'OpenRouter was removed.', apiBase: 'https://openrouter.ai/api/v1' }
+ expect(await gridLaunchThrough(() => ({ gridLaunch: async () => refused }))(request(api))).toBe(refused)
+ expect(rememberApiBase).toHaveBeenCalledWith('https://openrouter.ai/api/v1')
+ })
+
+ it('refuses at once, naming the grid or the API, when models is down or answers nothing usable', async () => {
+ const down = gridLaunchThrough(() => ({ gridLaunch: async () => { throw new Error('SERVICE_UNAVAILABLE') } }))
+ // `unavailable` names the service, so a restore holds the agent for it rather than failing it.
+ expect(await down(request())).toEqual({
+ ok: false, error: 'GRID_UNAVAILABLE', unavailable: 'models',
+ detail: 'The models service is not running, so claude cannot be put on Home grid. Try again in a moment.',
+ })
+ expect(await down(request(api))).toMatchObject({ ok: false, error: 'API_UNAVAILABLE', detail: expect.stringContaining('on OpenRouter') })
+ // A port that is not there at all (models off) is the same refusal, not a throw out of the launch.
+ expect(await gridLaunchThrough(() => { throw new Error('no port') })(request())).toMatchObject({ error: 'GRID_UNAVAILABLE' })
+ expect(rememberApiBase).not.toHaveBeenCalled()
+ })
+})
diff --git a/cli/src/core/agents/launch.ts b/cli/src/core/agents/launch.ts
index 850eae415..17da50286 100644
--- a/cli/src/core/agents/launch.ts
+++ b/cli/src/core/agents/launch.ts
@@ -8,31 +8,46 @@
*/
import { loadEngine } from '../../engines/inProcess.js'
import { prepareResume, repairedItemsName } from '../../engines/launchPrep.js'
-import { ApiConnectionError, type ApiConnections } from '../../lib/apiConnections.js'
-import { refreshApiLaunch } from '../../lib/apiModels.js'
import { dropPermissionFlagIfUnsupported } from '../../lib/engineLaunch.js'
-import { isApiLaunch } from '../../lib/gridLaunch.js'
+import { rememberApiBase } from '../../lib/gridAssignment.js'
+import { gridUnavailable, type GridLaunchAnswer, type GridLaunchRequest } from '../../lib/gridLaunchWire.js'
import { buildLaunchOverrides, type LaunchOverrides, type LaunchOverridesDeps, type LaunchOverridesResult, type LaunchSource } from '../../lib/launchOverrides.js'
+import type { ModelsPort } from '../api.js'
import { sid } from '../../lib/log.js'
import { prepareInstructionWrites } from '../../scm/scmProjects.js'
import type { registry, RegisteredSession } from '../../lib/registry.js'
+/**
+ * The models service's grid launch, as every launch in the core asks it (`ModelsPort.gridLaunch`): its answer, or,
+ * when models is down or answers nothing usable, the refusal that says so (`gridUnavailable`), never a launch on
+ * the engine's own login and never a wait past the call's bound (core/serviceLinks.ts). A saved API's endpoint
+ * the answer read is one the core's grid assignment recognises from then on, as when the core read it itself.
+ */
+export function gridLaunchThrough(models: () => Pick<ModelsPort, 'gridLaunch'>) {
+ return async (request: GridLaunchRequest): Promise<GridLaunchAnswer> => {
+ let answer: GridLaunchAnswer
+ try { answer = await models().gridLaunch(request) } catch { return gridUnavailable(request.engine, request.override) }
+ if (answer.apiBase) rememberApiBase(answer.apiBase)
+ return answer
+ }
+}
+
export interface LaunchHelperDeps {
/** Writes the saved APIs' tool instructions into the agent's folder before it launches. */
prepareApiTools: (cwd: string | null | undefined, engine: string) => void
- savedApis: ApiConnections
launchOverridesDeps: LaunchOverridesDeps
setGridLaunch: typeof registry.setGridLaunch
/** Moves a session's tail to a byte (Watcher.setTail). */
setTail: (sessionId: string, offset: number) => void
}
-export function createLaunchHelpers({ prepareApiTools, savedApis, launchOverridesDeps, setGridLaunch, setTail }: LaunchHelperDeps) {
+export function createLaunchHelpers({ prepareApiTools, launchOverridesDeps, setGridLaunch, setTail }: LaunchHelperDeps) {
// Whatever the source (the row itself, or a grid override the desktop just sent), the agent's DSH,
// workspace and named agent come from the row: a retarget must not silently drop the harness the
// agent is, or bring a pane opened as `harness-compute` back as a general session.
// An agent on a saved API's model relaunches with that API's endpoint and key as saved now, so a key
- // pasted since takes effect, and a removed API is refused rather than kept on its old key.
+ // pasted since takes effect, and a removed API is refused rather than kept on its old key: the models
+ // service reads them as it builds the launch (`buildLaunchOverrides`, `refresh`).
const relaunchOverrides = async (session: RegisteredSession, source: LaunchSource = session): Promise<LaunchOverridesResult> => {
// OpenCode's version decides its relaunch's argv, read by OpenCode's own code (lib/launchOverrides.ts): loaded
// here, before anything is written, and the relaunch refused without it.
@@ -41,19 +56,7 @@ export function createLaunchHelpers({ prepareApiTools, savedApis, launchOverride
}
await prepareInstructionWrites(session.cwd)
prepareApiTools(session.cwd, session.engine)
- let gridLaunch = source.gridLaunch ?? null
- if (gridLaunch && isApiLaunch(gridLaunch)) {
- try {
- gridLaunch = refreshApiLaunch(savedApis, gridLaunch)
- } catch (error) {
- return {
- ok: false,
- error: 'API_UNAVAILABLE',
- detail: error instanceof ApiConnectionError ? error.message : `${gridLaunch.networkName} could not be read from saved APIs.`,
- }
- }
- }
- return buildLaunchOverrides(launchOverridesDeps, session.engine, { dsh: session.dsh ?? null, dshRuntime: session.dshRuntime ?? null, cwd: session.cwd, agent: session.agent ?? null, scmLaunch: session.scmLaunch ?? null, ...source, gridLaunch }, session.agentId)
+ return buildLaunchOverrides(launchOverridesDeps, session.engine, { dsh: session.dsh ?? null, dshRuntime: session.dshRuntime ?? null, cwd: session.cwd, agent: session.agent ?? null, scmLaunch: session.scmLaunch ?? null, ...source, gridLaunch: source.gridLaunch ?? null }, session.agentId)
}
/**
diff --git a/cli/src/core/agents/launches.spec.ts b/cli/src/core/agents/launches.spec.ts
index 4ae431ef2..ae7bb3cc0 100644
--- a/cli/src/core/agents/launches.spec.ts
+++ b/cli/src/core/agents/launches.spec.ts
@@ -9,7 +9,7 @@ import { opencodeMajorVersion } from '../../engines/opencode/version.js'
import { AgentCreationReceiptError, AgentCreationReceipts, type AgentCreationOutcome } from '../../lib/agentCreationReceipt.js'
import type { AgentFrame } from '../../lib/agentFrame.js'
import { MAX_FIRST_PROMPT_CHARS, permissionModeApproves, permissionModeFlags, supportsFirstPrompt, supportsNamedAgent } from '../../lib/engineLaunch.js'
-import { parseGridLaunchOverride } from '../../lib/gridLaunch.js'
+import { parseGridLaunchOverride } from '../../lib/gridLaunchWire.js'
import { parseNewAgentModel } from '../../lib/newAgentModel.js'
import { parseProjectFolder, prepareProjectFolder, ProjectFolderError } from '../../lib/projectFolder.js'
import type { RegisteredSession } from '../../lib/registry.js'
@@ -40,7 +40,7 @@ vi.mock('../../engines/opencode/version.js', async (real) => ({ ...await real<ob
vi.mock('../../lib/newAgentModel.js', async (real) => ({
...await real<object>(), parseNewAgentModel: vi.fn(() => ({ state: 'absent' })),
}))
-vi.mock('../../lib/gridLaunch.js', async (real) => ({ ...await real<object>(), parseGridLaunchOverride: vi.fn(() => ({ state: 'absent' })) }))
+vi.mock('../../lib/gridLaunchWire.js', async (real) => ({ ...await real<object>(), parseGridLaunchOverride: vi.fn(() => ({ state: 'absent' })) }))
vi.mock('../../dsh/installed.js', async (real) => ({ ...await real<object>(), installedDsh: vi.fn(() => undefined) }))
vi.mock('../../dsh/manifest.js', async (real) => ({ ...await real<object>(), dshSupportedEngines: vi.fn(() => ['claude', 'codex']) }))
vi.mock('../../lib/engineLaunch.js', async (real) => ({
diff --git a/cli/src/core/agents/launches.ts b/cli/src/core/agents/launches.ts
index d5d1ed5c0..08a068d2e 100644
--- a/cli/src/core/agents/launches.ts
+++ b/cli/src/core/agents/launches.ts
@@ -24,7 +24,7 @@ import {
AGENT_NAME_RE, FirstPromptUnsupportedError, MAX_FIRST_PROMPT_CHARS, NamedAgentUnsupportedError, permissionModeApproves,
permissionModeFlags, supportsFirstPrompt, supportsNamedAgent,
} from '../../lib/engineLaunch.js'
-import { parseGridLaunchOverride, type GridLaunchOverride } from '../../lib/gridLaunch.js'
+import { parseGridLaunchOverride, type GridLaunchOverride } from '../../lib/gridLaunchWire.js'
import { parseNewAgentModel, type NewAgentModel } from '../../lib/newAgentModel.js'
import { parseProjectFolder, prepareProjectFolder, projectsRoot, ProjectFolderError } from '../../lib/projectFolder.js'
import type { ScmLaunchRecord } from '../../scm/types.js'
diff --git a/cli/src/core/agents/restart.spec.ts b/cli/src/core/agents/restart.spec.ts
index 1967671a8..568272eb9 100644
--- a/cli/src/core/agents/restart.spec.ts
+++ b/cli/src/core/agents/restart.spec.ts
@@ -65,6 +65,7 @@ function setup(row: RegisteredSession | null = agent(), over: Partial<RestartDep
refreshGridWebSearch: vi.fn() as never,
liveBypassPermission: vi.fn(async () => true),
paneSwapDeps: vi.fn(() => ({ swap: true })) as never,
+ restartHeld: vi.fn(() => null),
...over,
}
return { deps, state, tmuxBackend, restart: createAgentRestarter(deps) }
@@ -84,6 +85,15 @@ describe('restarting an agent', () => {
expect(await setup(null).restart('a1')).toEqual({ ok: false, error: 'AGENT_NOT_FOUND' })
})
+ it('for an agent held for a service, its launch, now, with nothing of a swap touched', async () => {
+ const launched = { ok: true as const, session: agent(), resumed: true }
+ const run = setup(agent({ processIdentity: undefined, tmuxPane: '%4' } as Partial<RegisteredSession>), { restartHeld: vi.fn(() => Promise.resolve(launched)) })
+ expect(await run.restart('a1')).toBe(launched)
+ expect(run.deps.restartHeld).toHaveBeenCalledWith('a1')
+ expect(run.deps.relaunchOverrides).not.toHaveBeenCalled()
+ expect(run.tmuxBackend.respawn).not.toHaveBeenCalled()
+ })
+
it('for an agent with no tmux pane, or no tmux at all', async () => {
expect(await setup(agent({ tmuxPane: undefined })).restart('a1')).toEqual({ ok: false, error: 'RESTART_UNSUPPORTED_BACKEND' })
expect(await setup(agent(), { tmuxBackend: null }).restart('a1')).toEqual({ ok: false, error: 'RESTART_UNSUPPORTED_BACKEND' })
diff --git a/cli/src/core/agents/restart.ts b/cli/src/core/agents/restart.ts
index 5150d14a1..0b72780b0 100644
--- a/cli/src/core/agents/restart.ts
+++ b/cli/src/core/agents/restart.ts
@@ -18,6 +18,7 @@ import { terminalRouteKey } from '../../lib/terminalRuntime.js'
import type { TmuxRuntimeRef } from '../../lib/terminalTypes.js'
import { clearPaneRemainOnExit, processArgs } from '../../lib/tmux.js'
import type { TmuxBackend } from '../../lib/tmuxBackend.js'
+import type { HeldRestart } from './heldLaunches.js'
import { workspaceMissing } from '../../lib/workspaceCheck.js'
import type { createLaunchHelpers } from './launch.js'
import type { RestartAgent } from './launches.js'
@@ -64,12 +65,15 @@ export interface RestartDeps {
refreshGridWebSearch: LaunchHelpers['refreshGridWebSearch']
liveBypassPermission: PaneSwap['liveBypassPermission']
paneSwapDeps: PaneSwap['paneSwapDeps']
+ /** A held agent runs no engine to swap: its restart is its launch, now (core/agents/heldLaunches.ts). Null for
+ * any other agent. */
+ restartHeld: (agentId: string) => Promise<HeldRestart> | null
}
export function createAgentRestarter({
restartJobs, registry, purgeBusy, stopJobs, pinnedControls, tmuxBackend, sameRestartTarget, agentReconciler,
terminalHintMachineName, announceSession, relaunchOverrides, downgradedPermission, refreshGridWebSearch,
- liveBypassPermission, paneSwapDeps,
+ liveBypassPermission, paneSwapDeps, restartHeld,
}: RestartDeps) {
/**
* Web or device restarted an agent (`agent_restart`): exit the live engine process and relaunch it in
@@ -94,6 +98,8 @@ export function createAgentRestarter({
if (purgeBusy(agentId) || stopJobs.has(agentId) || pinnedControls.has(agentId)) return { ok: false, error: 'AGENT_BUSY' }
const session = registry.resolve(agentId)
if (!session) return { ok: false, error: 'AGENT_NOT_FOUND' }
+ const held = restartHeld(session.agentId)
+ if (held) return held
if (!session.tmuxPane || !tmuxBackend) return { ok: false, error: 'RESTART_UNSUPPORTED_BACKEND' }
const target = { ...session }
const current = () => operationCurrent() && sameRestartTarget(target)
diff --git a/cli/src/core/agents/retarget.spec.ts b/cli/src/core/agents/retarget.spec.ts
index c1c227590..fcaab558c 100644
--- a/cli/src/core/agents/retarget.spec.ts
+++ b/cli/src/core/agents/retarget.spec.ts
@@ -26,7 +26,7 @@ vi.mock('../../engines/opencode/version.js', () => ({ isOpencodeV2: vi.fn(() =>
vi.mock('../../lib/binaryOnPath.js', () => ({ binaryOnPath: vi.fn(() => true) }))
vi.mock('../../lib/gatewayRuntime.js', async (real) => ({ ...await real<object>(), probeGatewayRuntime: vi.fn(async () => ({ kind: 'none' })) }))
vi.mock('../../lib/gridAssignment.js', async (real) => ({ ...await real<object>(), probeGridAssignment: vi.fn(async () => undefined) }))
-vi.mock('../../lib/gridLaunch.js', async (real) => ({ ...await real<object>(), describeGridLaunch: vi.fn(() => 'claude on Home'), gridEnvVarNames: vi.fn(() => ['ANTHROPIC_BASE_URL']) }))
+vi.mock('../../lib/gridLaunchWire.js', async (real) => ({ ...await real<object>(), describeGridLaunch: vi.fn(() => 'claude on Home'), gridEnvVarNames: vi.fn(() => ['ANTHROPIC_BASE_URL']) }))
vi.mock('../../lib/launchOverrides.js', async (real) => ({ ...await real<object>(), validateLaunchOverrides: vi.fn(async () => ({ ok: true })) }))
vi.mock('../../lib/restartAgent.js', async (real) => ({
...await real<object>(),
diff --git a/cli/src/core/agents/retarget.ts b/cli/src/core/agents/retarget.ts
index ab6a679f0..ff67daf7c 100644
--- a/cli/src/core/agents/retarget.ts
+++ b/cli/src/core/agents/retarget.ts
@@ -16,7 +16,7 @@ import { loadEngine } from '../../engines/inProcess.js'
import { binaryOnPath } from '../../lib/binaryOnPath.js'
import { probeGatewayRuntime } from '../../lib/gatewayRuntime.js'
import { probeGridAssignment } from '../../lib/gridAssignment.js'
-import { describeGridLaunch, gridEnvVarNames } from '../../lib/gridLaunch.js'
+import { describeGridLaunch, gridEnvVarNames } from '../../lib/gridLaunchWire.js'
import { validateLaunchOverrides, type LaunchOverridesDeps, type LaunchSource } from '../../lib/launchOverrides.js'
import { sid } from '../../lib/log.js'
import type { registry, RegisteredSession } from '../../lib/registry.js'
diff --git a/cli/src/core/api.spec.ts b/cli/src/core/api.spec.ts
index 0213acc2c..dbd616942 100644
--- a/cli/src/core/api.spec.ts
+++ b/cli/src/core/api.spec.ts
@@ -263,6 +263,9 @@ describe('the core API services stand on', () => {
await expect(MODELS_OFF.launchTarget({ model: 'm', grid: 'mine' })).rejects.toThrow('the models service is unavailable')
await expect(MODELS_OFF.moveTarget({ gridName: null, model: 'm' })).rejects.toThrow('the models service is unavailable')
await expect(MODELS_OFF.lists()).rejects.toThrow('the models service is unavailable')
+ // A launch on a grid or a saved API is refused while models is off (core/agents/launch.ts `gridLaunchThrough`).
+ await expect(MODELS_OFF.gridLaunch({ engine: 'claude', override: launch, machine: { hermesSystemManaged: false } })).rejects.toThrow('the models service is unavailable')
+ await expect(MODELS_OFF.apiTarget({ connectionId: 'openrouter', model: 'm' })).rejects.toThrow('the models service is unavailable')
expect(await MODELS_OFF.privateGridName()).toBeNull()
expect(MODELS_OFF.annotation(grid)).toBeNull()
expect([MODELS_OFF.prewarm(grid), MODELS_OFF.moved(launch), MODELS_OFF.machines(null, 'here'), MODELS_OFF.signedOut()]).toEqual([undefined, undefined, undefined, undefined])
diff --git a/cli/src/core/api.ts b/cli/src/core/api.ts
index a2acf6390..bf367c914 100644
--- a/cli/src/core/api.ts
+++ b/cli/src/core/api.ts
@@ -23,7 +23,7 @@ import type { createHarnessResourcesReader } from '../lib/harnessResources.js'
import type { createHarnessStorageReader } from '../lib/harnessTelemetry.js'
import type { AgentGridTarget, GridAnnotation } from '../lib/gridAnnotation.js'
import { GRID_FLEET_MAX_TIMEOUT_MS } from '../lib/gridFleetProtocol.js'
-import type { GridLaunchOverride } from '../lib/gridLaunch.js'
+import type { GridLaunchAnswer, GridLaunchOverride, GridLaunchRequest } from '../lib/gridLaunchWire.js'
import type { NewAgentModel } from '../lib/newAgentModel.js'
import type { LastTurnText, LiveEvent } from '../engines/kit/events.js'
import type { SessionRecaps } from '../lib/recapReads.js'
@@ -496,6 +496,10 @@ const MINUTE = 60_000
* a move onto a grid model (`moveTarget`) each wait for it.
* - A launch target, the private grid's name and the lists each run a few `grid` calls of up to 30 s.
* - The Store's install and update set up a harness's toolchain: minutes.
+ *
+ * A grid or saved-API launch (`gridLaunch`) is built from what models has in hand, and a saved API's target
+ * (`apiTarget`) reads its model list for at most 15 s (lib/apiModels.ts): both take the half minute, which bounds
+ * how long a launch on one can wait. A launch on the engine's own login asks models nothing.
*/
export const LONG_ANSWERS: Readonly<Record<string, Readonly<Record<string, number>>>> = {
models: {
@@ -703,6 +707,16 @@ export interface ModelsPort {
moveTarget(request: { gridName: string | null; model: string }): Promise<{ target: GridLaunchOverride } | { detail: string }>
/** An agent was just moved onto a grid model: start that grid while its pane restarts, if it sleeps. */
moved(launch: GridLaunchOverride): void
+ /**
+ * The launch that points `request.engine` at a grid or a saved API (lib/gridLaunch.ts): what its pane starts
+ * with and the config files the core writes for it, with a saved API's endpoint and key as saved now when
+ * `refresh`. An engine that cannot be pointed there is answered with the reason. The core builds no grid launch
+ * itself (docs/design/2026-10-08-launch-port.md).
+ */
+ gridLaunch(request: GridLaunchRequest): Promise<GridLaunchAnswer>
+ /** Where an agent moved onto a saved API's model sends its inference: the key travels only into its launch. The
+ * sentence a person reads when the API cannot be used. */
+ apiTarget(request: { connectionId: string; model: string }): Promise<{ target: GridLaunchOverride; apiBase: string } | { detail: string }>
/** The account's private grid: the backend's word, else what this machine works out; null for none. */
privateGridName(): Promise<string | null>
/** What `grid_models_changed` tells the windows: the list as a window that draws row state reads it,
@@ -716,13 +730,14 @@ export interface ModelsPort {
}
/**
- * What the core gets when models fails: grid set-up and every target answered with an error (a create on
- * a grid model answers GRID_UNAVAILABLE), frames with no note and no prewarm, the private grid as the
- * backend said it or none, and no push of the lists.
+ * What the core gets when models fails: grid set-up, every target and every grid or saved-API launch answered
+ * with an error (a create on a grid model answers GRID_UNAVAILABLE, and so does a relaunch on one), frames with no
+ * note and no prewarm, the private grid as the backend said it or none, and no push of the lists. A launch on the
+ * engine's own login never asks models.
*/
export const MODELS_FALLBACKS: PortFallbacks<ModelsPort> = {
ensure: later(FAIL), annotation: null, prewarm: undefined, launchTarget: later(FAIL), moveTarget: later(FAIL), moved: undefined,
- privateGridName: later(null), lists: later(FAIL), machines: undefined, signedOut: undefined,
+ gridLaunch: later(FAIL), apiTarget: later(FAIL), privateGridName: later(null), lists: later(FAIL), machines: undefined, signedOut: undefined,
}
/** What the core calls while `ports.models` is null (models is off): its fallbacks' answers. */
@@ -733,6 +748,8 @@ export const MODELS_OFF: ModelsPort = {
launchTarget: () => Promise.reject(new ServiceUnavailableError('models')),
moveTarget: () => Promise.reject(new ServiceUnavailableError('models')),
moved: () => {},
+ gridLaunch: () => Promise.reject(new ServiceUnavailableError('models')),
+ apiTarget: () => Promise.reject(new ServiceUnavailableError('models')),
privateGridName: async () => null,
lists: () => Promise.reject(new ServiceUnavailableError('models')),
machines: () => {},
diff --git a/cli/src/core/main.ts b/cli/src/core/main.ts
index 16711a42b..d446a81bb 100644
--- a/cli/src/core/main.ts
+++ b/cli/src/core/main.ts
@@ -53,8 +53,7 @@ import { isTerminalEngine, type AgentEngine } from '../engines/types.js'
import { engineInstallRecipe } from '../lib/engineInstall.js'
import { buildEngineLaunchArgv } from '../lib/engineLaunch.js'
import { workspaceMissing } from '../lib/workspaceCheck.js'
-import { type GridLaunchMachine } from '../lib/gridLaunch.js'
-import { HERMES_SYSTEM_MANAGED_DIR } from '../lib/gridWebMcp.js'
+import { HERMES_SYSTEM_MANAGED_DIR, type GridLaunchMachine } from '../lib/gridLaunchWire.js'
import { writeGridConfigDir } from '../lib/gridConfigDir.js'
import { tmuxSupportsSessionEnv } from '../lib/tmuxVersion.js'
import { clearDeleted, isRecentlyDeleted, markDeleted } from '../lib/deletedSessions.js'
@@ -63,7 +62,7 @@ import { processSessionOf } from '../engines/sessionStores.js'
import { handoffProviderDeps } from '../lib/handoffDiscovery.js'
import { TmuxBackend } from '../lib/tmuxBackend.js'
import { DEFAULT_HOST_THEME, loadHostTheme, saveHostTheme, type HostTheme } from '../lib/hostTheme.js'
-import { restoreAgents, tmuxSurvey } from '../lib/restoreAgents.js'
+import { restoreAgents, tmuxSurvey, type RestoreAgentsDeps, type RestoreSummary } from '../lib/restoreAgents.js'
import { createRetainExitedSession } from '../lib/retainExitedSession.js'
import { createKeepAbandonedConversation } from '../lib/keepAbandonedConversation.js'
import { OpenTabProtection } from '../lib/openTabProtection.js'
@@ -78,7 +77,7 @@ import { adoptLegacyHarnessSessions, listTmuxPanes } from '../lib/tmuxAgentDisco
import { installedDsh, invalidateInstalledDsh } from '../dsh/installed.js'
import { prepareHarnessLaunch } from '../dsh/runtime.js'
import { ApiConnections } from '../lib/apiConnections.js'
-import { rememberSavedApis } from '../lib/apiModels.js'
+import { rememberSavedApis } from '../lib/gridAssignment.js'
import { prepareApiInstructions } from '../lib/apiInstructions.js'
import type { AgentDshContext } from '../lib/agentFrame.js'
import type { AgentGridTarget, GridAnnotation } from '../lib/gridAnnotation.js'
@@ -124,7 +123,8 @@ import { createRelaunchMarks, transcriptSize } from './transcripts/relaunch.js'
import { createForgetSession } from './agents/forget.js'
import { createBinding } from './agents/bind.js'
import { createDiscoveryHandlers } from './agents/discovery.js'
-import { createLaunchHelpers } from './agents/launch.js'
+import { createLaunchHelpers, gridLaunchThrough } from './agents/launch.js'
+import { createHeldLaunches, heldPaneArgv } from './agents/heldLaunches.js'
import { createCancel, createCancelRequest } from './turns/cancel.js'
import { createPaneWatcher } from './agents/newPane.js'
import { createAdoption } from './agents/adopt.js'
@@ -406,6 +406,14 @@ async function runForeground(session: AuthSession | null): Promise<void> {
// move (it tears down two dozen subsystems declared further down). Until it is ready, a staged update is
// applied by `bootHandoff`, which hands the machine over without finishing start-up.
coreLink.onUpdate((version) => { void daemonBoot.applyStagedUpdate(version) })
+ // Agents held until the service their launch asks is ready, and the passes that launch them
+ // (core/agents/heldLaunches.ts): the boot's restore of only those agents, set where tmux is there to restore into.
+ let restoreOnly: ((only: ReadonlySet<string>) => Promise<RestoreSummary>) | null = null
+ const heldLaunches = createHeldLaunches({
+ registry,
+ restore: (only) => restoreOnly?.(only) ?? Promise.resolve({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] }),
+ log: (line) => console.log(line),
+ })
wakeGateway({ outOfProcess: servicesTheMasterRuns(process.env, KNOWN_SERVICES), signedIn: !!session, dataDir: env.ADAPTER_DATA_DIR, want: (service) => coreLink.want(service) })
// …or, under a master too old to run the updater, from the updater this core runs beside itself
// (core/updaterBeside.ts), in a process of its own: the core downloads no build either way.
@@ -1275,6 +1283,8 @@ async function runForeground(session: AuthSession | null): Promise<void> {
if (service === 'devices') devicesLink.connected()
if (service === 'wifi') wifiCore.started(appVoiceFocus ?? null)
devicesWake.connected(service)
+ // A service up again (or up at last): the agents held for it are launched (core/agents/heldLaunches.ts).
+ void heldLaunches.restoreHeld(service)
},
disconnected: (service) => {
engineReaders.disconnected(service)
@@ -1908,8 +1918,12 @@ async function runForeground(session: AuthSession | null): Promise<void> {
* restart read the row; retarget passes the override the desktop just sent. The config directory is
* keyed on the agent, so relaunching the same agent rewrites one directory instead of leaving a trail.
*/
+ // Grid and saved-API launches are built by the models service (core/agents/launch.ts `gridLaunchThrough`): a
+ // launch on one while models is down is refused, and one on the engine's own login never asks it.
+ const gridLaunch = gridLaunchThrough(() => ports.models ?? MODELS_OFF)
const launchOverridesDeps: LaunchOverridesDeps = {
machine: gridLaunchMachine,
+ gridLaunch,
writeGridConfigDir,
tmuxSupportsSessionEnv,
installCodexHooks: (codexHome) => { if (!env.DISABLE_HOOK_INSTALL) engineHookFacets.codex.installIn(hookPort, codexHome) },
@@ -1926,7 +1940,6 @@ async function runForeground(session: AuthSession | null): Promise<void> {
// pass below, which calls these for every pane it rebuilds.
const launchHelpers = createLaunchHelpers({
prepareApiTools,
- savedApis,
launchOverridesDeps,
setGridLaunch: (agentId, launch) => registry.setGridLaunch(agentId, launch),
setTail: (sessionId, offset) => watcher.setTail(sessionId, offset),
@@ -1969,13 +1982,15 @@ async function runForeground(session: AuthSession | null): Promise<void> {
const saved = isTerminalEngine(entry.engine) ? stoppedAgents.get(entry.agentId) : null
if (saved && !isTerminalEngine(saved.engine)) retainExitedSession(entry, true)
}
+ // Later passes over held agents (core/agents/heldLaunches.ts) wait for this one.
+ await heldLaunches.boot(async () => {
if (tmuxBackend) {
// Best effort, like the cwd repair above it: panes that cannot be rebuilt cost this boot its
// tiles, not the daemon. `restoreDegraded` then stops discovery retiring the rows whose panes
// restore never got to, so the next daemon can put them back.
try {
const backend = tmuxBackend
- const summary = await restoreAgents({
+ const restoreDeps: RestoreAgentsDeps = {
retainStopped: retainExitedSession,
keepAbandoned: keepAbandonedConversation,
registry,
@@ -1994,7 +2009,8 @@ async function runForeground(session: AuthSession | null): Promise<void> {
// the same Codex profile with its hooks installed; the install check runs inside the pane's
// own shell.
const built = await relaunchOverrides(entry)
- if (!built.ok) return { error: built.error, detail: built.detail }
+ // Models could not be asked: the agent waits for it, held, never failed (core/agents/heldLaunches.ts).
+ if (!built.ok) return built.unavailable ? { held: built.unavailable } : { error: built.error, detail: built.detail }
if (opts.resumeSessionId) {
try { prepareSessionResume(entry) } catch (error) {
return { error: 'RESUME_PREPARATION_FAILED', detail: error instanceof Error ? error.message : String(error) }
@@ -2045,11 +2061,19 @@ async function runForeground(session: AuthSession | null): Promise<void> {
releaseRoute: (key) => agentReconciler.releaseRoute(key),
triggerHint: async (runtime, engine) => { await agentReconciler.triggerHint(runtime, engine) },
log: (message) => console.log(message),
- })
+ // A grid's or a saved API's launch asks models: not before the core is ready (core/agents/heldLaunches.ts).
+ needs: (entry) => entry.gridLaunch ? 'models' : null,
+ waitingLaunch: (_entry, held) => ({ argv: heldPaneArgv(held.detail) }),
+ killPane: async (runtime) => { await backend.kill(runtime) },
+ }
+ // Later passes launch the held agents, into the panes they wait in, outside this pass's transaction.
+ restoreOnly = (only) => restoreAgents({ ...restoreDeps, only })
+ const summary = await restoreAgents({ ...restoreDeps, defer: true })
// A row restore could not look at keeps its pane for discovery to judge, but not to retire this boot.
for (const agentId of summary.unsurveyed) restoreUnsurveyed.add(agentId)
- if (summary.restored.length || summary.failed.length || registry.rebootedSinceLastRun) {
+ if (summary.restored.length || summary.failed.length || summary.held.length || registry.rebootedSinceLastRun) {
console.log(`[restore] restored ${summary.restored.length} · skipped ${summary.skipped.length} · failed ${summary.failed.length}`
+ + (summary.held.length ? ` · held ${summary.held.length} until the core is ready` : '')
+ (registry.rebootedSinceLastRun ? ' · after reboot' : ''))
}
} catch (error) {
@@ -2058,6 +2082,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {
+ ' · agents keep their rows and come back on the next start')
}
}
+ })
// Every DSH agent the registry kept gets its viewer and verdict watch back — restored or not, an
// agent whose pane is still up is still that harness.
for (const session of registry.list()) if (session.dsh) attachDsh(session)
@@ -2223,6 +2248,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {
hooksDisabled: env.DISABLE_HOOK_INSTALL,
installOpencodePlugin: installOpencodePluginBeforeSpawn,
gridLaunchMachine,
+ buildGridLaunch: gridLaunch,
terminalHintMachineName,
blocksFolder: (cwd) => backend.purgeAgentService?.blocksFolder(cwd),
gridSetup: () => {
@@ -2350,6 +2376,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {
refreshGridWebSearch,
liveBypassPermission,
paneSwapDeps,
+ restartHeld: (agentId) => heldLaunches.restartHeld(agentId),
})
// The requests that start an agent's process, and the receipts of those asked with a creationId
// (core/agents/launches.ts). The orchestrator and the cable create and fork through the socket's slots.
@@ -2551,6 +2578,8 @@ async function runForeground(session: AuthSession | null): Promise<void> {
daemonBoot.openRequests = null
coreLink.ready()
console.log('[cli] ready')
+ // Ready first, never after a service: the agents the boot held for one are launched now, in the background.
+ void heldLaunches.restoreHeld()
}
/**
diff --git a/cli/src/core/modelsLink.spec.ts b/cli/src/core/modelsLink.spec.ts
index 386fea61a..40e9d0894 100644
--- a/cli/src/core/modelsLink.spec.ts
+++ b/cli/src/core/modelsLink.spec.ts
@@ -100,6 +100,46 @@ describe('models in its own process, as the core reaches it', () => {
await expect(setup().port.moveTarget({ gridName: null, model: 'm' })).rejects.toBeInstanceOf(ServiceUnavailableError)
})
+ it("a grid or saved-API launch, as models built it and checked as far as the core hands it on; unavailable when it is not one", async () => {
+ const request = { engine: 'claude' as const, override: LAUNCH, machine: { hermesSystemManaged: false }, refresh: true }
+ const launch = { env: { ANTHROPIC_MODEL: 'Small-Q4' }, args: ['--x'], webSearch: 'on', sessionModel: 'grid/Small-Q4' }
+ const built = { ok: true, launch, override: LAUNCH }
+ const { call, port } = setup({ gridLaunch: built })
+ expect(await port.gridLaunch(request)).toEqual(built)
+ expect(call).toHaveBeenCalledWith('gridLaunch', request)
+ const files = { envVar: 'OPENCODE_CONFIG', files: [{ name: 'opencode.json', content: '{}' }], pointAt: 'opencode.json', links: [{ name: 'auth.json', target: '/a' }] }
+ const withFiles = { ...built, launch: { ...launch, configDir: files }, apiBase: RELAY }
+ expect(await setup({ gridLaunch: withFiles }).port.gridLaunch(request)).toEqual(withFiles)
+ expect(await setup({ gridLaunch: { ...built, launch: { ...launch, configDir: { envVar: 'PI', files: [] } } } }).port.gridLaunch(request)).toMatchObject({ ok: true })
+ const refused = { ok: false, error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no grid for amp', apiBase: RELAY }
+ expect(await setup({ gridLaunch: refused }).port.gridLaunch(request)).toEqual(refused)
+ expect(await setup({ gridLaunch: { ok: false, error: 'API_UNAVAILABLE', detail: 'gone' } }).port.gridLaunch(request)).toEqual({ ok: false, error: 'API_UNAVAILABLE', detail: 'gone' })
+ // Anything else — down, or an answer the core could not start a pane with — is models being unavailable.
+ const unusable: Array<Record<string, unknown>> = [
+ { ok: false, error: 'X' }, { ok: 'yes', launch, override: LAUNCH }, { ...built, override: { networkId: 'n' } },
+ { ...built, launch: null }, { ...built, launch: { ...launch, env: { A: 1 } } }, { ...built, launch: { ...launch, args: [1] } },
+ { ...built, launch: { ...launch, webSearch: 'off' } }, { ...built, launch: { ...launch, sessionModel: 7 } },
+ { ...built, launch: { ...launch, configDir: 'dir' } }, { ...built, launch: { ...launch, configDir: { ...files, envVar: 7 } } },
+ { ...built, launch: { ...launch, configDir: { ...files, files: 'x' } } }, { ...built, launch: { ...launch, configDir: { ...files, files: [{ name: 'a' }] } } },
+ { ...built, launch: { ...launch, configDir: { ...files, files: [null] } } },
+ { ...built, launch: { ...launch, configDir: { ...files, pointAt: 7 } } }, { ...built, launch: { ...launch, configDir: { ...files, links: 'x' } } },
+ { ...built, launch: { ...launch, configDir: { ...files, links: [{ name: 'a' }] } } }, { ...built, launch: { ...launch, configDir: { ...files, links: [null] } } },
+ ]
+ for (const answer of unusable) await expect(setup({ gridLaunch: answer }).port.gridLaunch(request), JSON.stringify(answer)).rejects.toBeInstanceOf(ServiceUnavailableError)
+ await expect(setup().port.gridLaunch(request)).rejects.toBeInstanceOf(ServiceUnavailableError)
+ })
+
+ it("a saved API's target and the endpoint it read, or why not, in models' words or the core's", async () => {
+ const { call, port } = setup({ apiTarget: { target: LAUNCH, apiBase: RELAY } })
+ expect(await port.apiTarget({ connectionId: 'openrouter', model: 'q' })).toEqual({ target: LAUNCH, apiBase: RELAY })
+ expect(call).toHaveBeenCalledWith('apiTarget', { connectionId: 'openrouter', model: 'q' })
+ expect(await setup({ apiTarget: { detail: 'This API is not saved.' } }).port.apiTarget({ connectionId: 'x', model: 'q' })).toEqual({ detail: 'This API is not saved.' })
+ for (const answer of [{}, { detail: '' }, { target: LAUNCH }, { target: { networkId: 'n' }, apiBase: RELAY }]) {
+ expect(await setup({ apiTarget: answer }).port.apiTarget({ connectionId: 'x', model: 'q' })).toEqual({ detail: 'This API could not be used. Try again.' })
+ }
+ await expect(setup().port.apiTarget({ connectionId: 'x', model: 'q' })).rejects.toBeInstanceOf(ServiceUnavailableError)
+ })
+
it('the private grid\'s name, or none while models cannot say', async () => {
expect(await setup({ privateGridName: { name: 'derived-1a2b' } }).port.privateGridName()).toBe('derived-1a2b')
expect(await setup({ privateGridName: { name: null } }).port.privateGridName()).toBeNull()
diff --git a/cli/src/core/modelsLink.ts b/cli/src/core/modelsLink.ts
index b79c0510f..88fd28fc3 100644
--- a/cli/src/core/modelsLink.ts
+++ b/cli/src/core/modelsLink.ts
@@ -13,7 +13,8 @@
* asleep, which is the only time the service would act on it.
*
* Everything else is asked when it is needed (core/serviceLinks.ts `call`): grid's set-up, where an agent
- * on a grid model sends its inference, the private grid's name, the lists the windows are pushed. An
+ * on a grid model sends its inference, the launch that points an engine at a grid or a saved API (the core builds
+ * none itself), the private grid's name, the lists the windows are pushed. An
* answer that does not come (the process is down, or slower than its wait, core/api.ts `LONG_ANSWERS`) is
* what the fallbacks give in the core's process (`MODELS_FALLBACKS`): an error for the one request that
* asked, so a create on a grid model answers GRID_UNAVAILABLE, never a hang. What models is only told (a
@@ -27,7 +28,7 @@
*/
import { annotate, glanceFor, type GridGlance } from '../lib/gridAnnotation.js'
import type { GridAttachResult } from '../lib/gridAttach.js'
-import { parseGridLaunchOverride, type GridLaunchOverride } from '../lib/gridLaunch.js'
+import { parseGridLaunchOverride, type GridEngineLaunch, type GridLaunchAnswer, type GridLaunchOverride } from '../lib/gridLaunchWire.js'
import type { CoreApi, ModelsPort } from './api.js'
import { ServiceUnavailableError } from './serviceHost.js'
import type { ServiceFrame } from './serviceLinks.js'
@@ -64,6 +65,35 @@ const launchIn = (value: unknown): GridLaunchOverride | null => {
return parsed.state === 'ok' ? parsed.override : null
}
+const isText = (value: unknown): value is string => typeof value === 'string'
+const isTexts = (value: unknown): value is string[] => Array.isArray(value) && value.every(isText)
+const isTextRecord = (value: unknown): value is Record<string, string> => isRecord(value) && Object.values(value).every(isText)
+const WEB_SEARCH = new Set(['on', 'unavailable', 'unsupported'])
+
+/** A built launch, as far as the core hands it to a pane and writes its files; null when it is not one. */
+function engineLaunchIn(value: unknown): GridEngineLaunch | null {
+ if (!isRecord(value) || !isTextRecord(value.env) || !isTexts(value.args) || !WEB_SEARCH.has(value.webSearch as string)) return null
+ if (value.sessionModel !== undefined && !isText(value.sessionModel)) return null
+ const dir = value.configDir
+ if (dir !== undefined) {
+ if (!isRecord(dir) || !isText(dir.envVar) || !Array.isArray(dir.files)) return null
+ if (!dir.files.every((file) => isRecord(file) && isText(file.name) && isText(file.content))) return null
+ if (dir.pointAt !== undefined && !isText(dir.pointAt)) return null
+ if (dir.links !== undefined && !(Array.isArray(dir.links) && dir.links.every((link) => isRecord(link) && isText(link.name) && isText(link.target)))) return null
+ }
+ return value as unknown as GridEngineLaunch
+}
+
+/** The process's answer to a grid launch, checked; null when it is not one. */
+export function gridLaunchAnswerIn(value: Record<string, unknown>): GridLaunchAnswer | null {
+ const apiBase = isText(value.apiBase) ? { apiBase: value.apiBase } : {}
+ if (value.ok === false) return isText(value.error) && isText(value.detail) ? { ok: false, error: value.error, detail: value.detail, ...apiBase } : null
+ const launch = engineLaunchIn(value.launch)
+ const override = launchIn(value.override)
+ if (value.ok !== true || !launch || !override) return null
+ return { ok: true, launch, override, ...apiBase }
+}
+
export function createModelsLink(core: Pick<CoreApi, 'agents' | 'account' | 'clients'>, call: CallModels, notify: NotifyModels) {
let glances: GridGlance[] = []
/** What each agent's frame last said of its grid, so only a change sends the frame again. */
@@ -95,6 +125,17 @@ export function createModelsLink(core: Pick<CoreApi, 'agents' | 'account' | 'cli
return { detail: typeof answer.detail === 'string' && answer.detail ? answer.detail : 'Could not read this machine\'s grid endpoint.' }
},
moved: (launch) => tell({ kind: 'moved', launch }),
+ gridLaunch: async (request) => {
+ const answer = gridLaunchAnswerIn(await ask('gridLaunch', { ...request }))
+ if (!answer) throw new ServiceUnavailableError('models')
+ return answer
+ },
+ apiTarget: async (request) => {
+ const answer = await ask('apiTarget', { ...request })
+ const target = launchIn(answer.target)
+ if (target && isText(answer.apiBase)) return { target, apiBase: answer.apiBase }
+ return { detail: isText(answer.detail) && answer.detail ? answer.detail : 'This API could not be used. Try again.' }
+ },
// Its fallback is no name, not an error: the backend's, which the caller reads first, is all there is.
privateGridName: async () => {
const answer = await call('privateGridName', {})
diff --git a/cli/src/dsh/launch.spec.ts b/cli/src/dsh/launch.spec.ts
index 29c449b59..8c3c0ad7b 100644
--- a/cli/src/dsh/launch.spec.ts
+++ b/cli/src/dsh/launch.spec.ts
@@ -3,6 +3,7 @@ import type { InstalledDsh } from './installed.js'
import { dshLaunch, harnessEnvToClear, DSH_SESSION_ENV } from './launch.js'
import { buildLaunchOverrides, type LaunchOverridesDeps } from '../lib/launchOverrides.js'
import { dshFromEnv } from './probe.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
const installed: InstalledDsh = {
id: 'autonomous/circuit', dir: '/home/u/.harness/dsh/autonomous/circuit', realDir: '/src/circuit',
@@ -43,7 +44,7 @@ describe('dshLaunch', () => {
describe('buildLaunchOverrides with a DSH', () => {
const deps: LaunchOverridesDeps = {
// The branch replaced `configDirFor` with the machine facts the grid launch builder reads itself.
- machine: () => ({ hermesSystemManaged: false }),
+ machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async () => '/cfg',
tmuxSupportsSessionEnv: async () => true,
installCodexHooks: () => undefined,
diff --git a/cli/src/dsh/portability.integration.spec.ts b/cli/src/dsh/portability.integration.spec.ts
index 0785ad3bf..6c5c59500 100644
--- a/cli/src/dsh/portability.integration.spec.ts
+++ b/cli/src/dsh/portability.integration.spec.ts
@@ -19,6 +19,7 @@ import { harnessAdapter } from './adapters.js'
import { materializeWorkspace, skillDirsIn } from './materialize.js'
import { prepareHarnessLaunch } from './runtime.js'
import { dshListRows } from './wire.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
const store = fileURLToPath(new URL('../../../store/agents', import.meta.url))
let root: string
@@ -140,7 +141,7 @@ for (const engine of PROCESS_ENGINES) it(`${engine}: prepare → spawn → tool
expect(recorded).toMatchObject({ engine, dsh: pkg.id, dshRuntime: 'created', cwd: workspace })
expect(JSON.parse(readFileSync(join(workspace, '.harness/verdict.json'), 'utf8'))).toEqual({ ready: true, artifact: 'scene.txt' })
expect(readFileSync(join(workspace, 'scene.txt'), 'utf8')).toBe('drawn by test/portable\n')
- const restored = await buildLaunchOverrides({ machine: () => ({ hermesSystemManaged: false }), writeGridConfigDir: async () => '/unused',
+ const restored = await buildLaunchOverrides({ machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(), writeGridConfigDir: async () => '/unused',
tmuxSupportsSessionEnv: async () => true, installCodexHooks: () => {},
dshLaunch: (_id, ws, selected, key) => prepareHarnessLaunch(pkg, ws, selected, key) }, engine,
{ dsh: pkg.id, cwd: workspace, dshRuntime: 'created' }, 'registered')
diff --git a/cli/src/dsh/runtime.spec.ts b/cli/src/dsh/runtime.spec.ts
index f220ce3ad..9676308e2 100644
--- a/cli/src/dsh/runtime.spec.ts
+++ b/cli/src/dsh/runtime.spec.ts
@@ -10,6 +10,7 @@ import type { InstalledDsh } from './installed.js'
import { HARNESS_ADAPTERS, HARNESS_BOOTSTRAP, harnessAdapter } from './adapters.js'
import { compatibleHarnessEngines } from './compatibility.js'
import { forkRuntimeKey, harnessLaunchOrRefusal, harnessRuntimeDir, incompatibleHarnessEngine, migrateHarnessInstructions, prepareHarnessLaunch } from './runtime.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
let root: string
let ws: string
@@ -90,7 +91,7 @@ describe('session isolation and lifecycle', () => {
})
it('does not inherit the previous account private grid on a harness relaunch', async () => {
- const result = await buildLaunchOverrides({ machine: () => ({ hermesSystemManaged: false }),
+ const result = await buildLaunchOverrides({ machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async () => '/unused', tmuxSupportsSessionEnv: async () => true,
installCodexHooks: () => {}, dshLaunch: () => prepareHarnessLaunch(pkg, ws, 'claude', 'new-account'),
}, 'claude', { dsh: pkg.id, cwd: ws }, 'agent')
@@ -134,7 +135,7 @@ describe('session isolation and lifecycle', () => {
pkg.manifest.agent!.args = ['--new-flag']
pkg.manifest.agent!.env = { TOOLCHAIN: 'changed' }
write(join(pkg.realDir, 'AGENTS.md'), '# Updated instructions\n')
- const deps = { machine: () => ({ hermesSystemManaged: false }), writeGridConfigDir: async () => '/cfg',
+ const deps = { machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(), writeGridConfigDir: async () => '/cfg',
tmuxSupportsSessionEnv: async () => true, installCodexHooks: () => {},
dshLaunch: (_id: string, workspace: string, engine: typeof PROCESS_ENGINES[number] | 'terminal', key: string) =>
prepareHarnessLaunch(pkg, workspace, engine, key, { privateGrid: 'new-grid' }) }
@@ -153,7 +154,7 @@ describe('session isolation and lifecycle', () => {
})
it('keeps older rows stable using their agent id and supports package renames', async () => {
- const deps = { machine: () => ({ hermesSystemManaged: false }), writeGridConfigDir: async () => '/cfg',
+ const deps = { machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(), writeGridConfigDir: async () => '/cfg',
tmuxSupportsSessionEnv: async () => true, installCodexHooks: () => {},
dshLaunch: (_id: string, workspace: string, engine: typeof PROCESS_ENGINES[number] | 'terminal', key: string) => prepareHarnessLaunch(pkg, workspace, engine, key) }
const first = await buildLaunchOverrides(deps, 'codex', { dsh: pkg.id, cwd: ws }, 'old-agent')
@@ -164,7 +165,7 @@ describe('session isolation and lifecycle', () => {
})
it('reports preparation failures, missing dependencies, or no resolver before a relaunch', async () => {
- const deps = { machine: () => ({ hermesSystemManaged: false }), writeGridConfigDir: async () => '/cfg',
+ const deps = { machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(), writeGridConfigDir: async () => '/cfg',
tmuxSupportsSessionEnv: async () => true, installCodexHooks: () => {} }
expect(await buildLaunchOverrides(deps, 'codex', { dsh: pkg.id, cwd: ws }, 'key')).toMatchObject({ ok: false, error: 'DSH_NOT_INSTALLED' })
expect(await buildLaunchOverrides({ ...deps, dshLaunch: () => { throw new Error('broken context') } }, 'codex', { dsh: pkg.id, cwd: ws }, 'key'))
diff --git a/cli/src/engines/__fixtures__/launch-shapes.golden.json b/cli/src/engines/__fixtures__/launch-shapes.golden.json
new file mode 100644
index 000000000..58d2f5a8e
--- /dev/null
+++ b/cli/src/engines/__fixtures__/launch-shapes.golden.json
@@ -0,0 +1,241 @@
+{
+"create": {
+ "claude · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w1","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"script":"f0c6dcced54e284a","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]},
+ "codex · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w2","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"script":"ebd80e4e7c536ee5","env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · qwen3-coder · web search on"]},
+ "cursor · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create cursor refused · cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "opencode · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w4","opencode","--standalone"],"script":"52793fbd71a813cc","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
+ "pi · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w5","pi","--model","grid/qwen3-coder"],"script":"68c371f95abe1215","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "hermes · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w6","hermes","-m","qwen3-coder"],"script":"85f5530a91919102","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search on"]},
+ "commandcode · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create commandcode refused · commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "devin · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create devin refused · devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "muse · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"muse cannot run on grid Home: Muse Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create muse refused · muse cannot run on grid Home: Muse Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "amp · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"amp cannot run on grid Home: Amp documents no way to change where it sends inference. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create amp refused · amp cannot run on grid Home: Amp documents no way to change where it sends inference. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "kilo · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"kilo cannot run on grid Home: the Kilo CLI has no OpenAI-compatible provider option yet (its own issues #5840, #6315). It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create kilo refused · kilo cannot run on grid Home: the Kilo CLI has no OpenAI-compatible provider option yet (its own issues #5840, #6315). It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "grok · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w12","grok","-m","qwen3-coder"],"script":"943508615993a9fc","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · qwen3-coder · web search on"]},
+ "agy · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"agy cannot run on grid Home: Antigravity speaks the Gemini API, which this relay does not serve. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create agy refused · agy cannot run on grid Home: Antigravity speaks the Gemini API, which this relay does not serve. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "copilot · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w14","copilot","--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"script":"9cf03823c9a21422","env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Home (net-home) · qwen3-coder · web search on"]},
+ "terminal · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"terminal cannot run on grid Home: a terminal runs no engine to point at a grid — start one inside it and it will use its own login. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create terminal refused · terminal cannot run on grid Home: a terminal runs no engine to point at a grid — start one inside it and it will use its own login. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
+ "claude · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w16","claude","--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead."],"script":"84421bb2029d77b5","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "claude · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w17","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"script":"f0c6dcced54e284a","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]},
+ "claude · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w18","claude","--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead."],"script":"cb146dfa0878a5f0","env":{"ANTHROPIC_BASE_URL":"http://127.0.0.1:<port>","ANTHROPIC_AUTH_TOKEN":"stale-key","ANTHROPIC_MODEL":"vendor/model-a","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"200000"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "codex · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w19","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\""],"script":"3e9ce92055162a4b","env":{"GRID_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "codex · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w20","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"script":"ebd80e4e7c536ee5","env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · qwen3-coder · web search on"]},
+ "codex · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w21","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"http://127.0.0.1:<port>/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-m","vendor/model-a","-c","model_context_window=200000","-c","model_auto_compact_token_limit=180000"],"script":"3e9ce92055162a4b","env":{"GRID_API_KEY":"stale-key"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "opencode · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w22","opencode","--standalone"],"script":"52793fbd71a813cc","env":{"GRID_API_KEY":"grid-key-2","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/Auto\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"Auto\": {\n \"name\": \"Auto\"\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "opencode · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w23","opencode","-m","home/qwen3-coder"],"script":"52793fbd71a813cc","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
+ "opencode · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w24","opencode","--standalone"],"script":"52793fbd71a813cc","env":{"GRID_API_KEY":"stale-key","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"api-router/vendor/model-a\",\n \"provider\": {\n \"api-router\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Router\",\n \"options\": {\n \"baseURL\": \"http://127.0.0.1:<port>/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"vendor/model-a\": {\n \"name\": \"vendor/model-a\",\n \"limit\": {\n \"context\": 200000,\n \"output\": 32000\n }\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "pi · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w25","pi","--model","grid/Auto"],"script":"68c371f95abe1215","env":{"GRID_API_KEY":"grid-key-2","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w26","pi","--model","grid/qwen3-coder"],"script":"68c371f95abe1215","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "pi · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w27","pi","--model","grid/vendor/model-a"],"script":"68c371f95abe1215","env":{"GRID_API_KEY":"stale-key","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)"]},
+ "hermes · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w28","hermes"],"script":"7027f317099a217d","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "hermes · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w29","hermes","-m","qwen3-coder"],"script":"f2dfc7cb1c72b1ef","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search unsupported (/etc/hermes pins this machine's Hermes settings, and the overlay carrying the web tools would replace it)"]},
+ "hermes · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w30","hermes","-m","vendor/model-a"],"script":"f2dfc7cb1c72b1ef","env":{"OPENAI_BASE_URL":"http://127.0.0.1:<port>/v1","OPENAI_API_KEY":"stale-key","HERMES_INFERENCE_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "grok · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w31","grok","-m","Auto"],"script":"943508615993a9fc","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-2","GRID_API_KEY":"grid-key-2","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"Auto\"]\nmodel = \"Auto\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "grok · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w32","grok","-m","qwen3-coder"],"script":"943508615993a9fc","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · qwen3-coder · web search on"]},
+ "grok · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w33","grok","-m","vendor/model-a"],"script":"943508615993a9fc","env":{"GROK_MODELS_BASE_URL":"http://127.0.0.1:<port>/v1","XAI_API_KEY":"stale-key","GRID_API_KEY":"stale-key","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"vendor/model-a\"]\nmodel = \"vendor/model-a\"\nbase_url = \"http://127.0.0.1:<port>/v1\"\nenv_key = \"GRID_API_KEY\"\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "copilot · grid without a model, web tools or window": {"result":{"ok":false,"error":"GRID_MODEL_REQUIRED","detail":"copilot will not start against a grid without a model. Pick one for Home and try again."},"pane":null,"config":null,"folder":{},"logged":["[agent] create copilot refused · copilot will not start against a grid without a model. Pick one for Home and try again."]},
+ "copilot · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w35","copilot","--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"script":"9cf03823c9a21422","env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Home (net-home) · qwen3-coder · web search on"]},
+ "copilot · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w36","copilot"],"script":"6b9f744e75e1feb5","env":{"COPILOT_PROVIDER_BASE_URL":"http://127.0.0.1:<port>/v1","COPILOT_PROVIDER_API_KEY":"stale-key","COPILOT_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "claude · grid · an old tmux": {"result":{"ok":false,"error":"TMUX_TOO_OLD_FOR_GRID","detail":"this machine's tmux is older than 3.2, which is the first version that can give a new session its own environment — so claude could not have been pointed at grid Home. Upgrade tmux, or create this agent without a grid selected."},"pane":null,"config":null,"folder":{},"logged":["[agent] create claude refused · this machine's tmux is older than 3.2, which is the first version that can give a new session its own environment — so claude could not have been pointed at grid Home. Upgrade tmux, or create this agent without a grid selected."]},
+ "claude · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w38","claude"],"script":"b5d0565d20e56ba0","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w39","codex"],"script":"096238a72b8b74cc","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
+},
+"relaunch": {
+ "claude · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] claude -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] codex -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "cursor · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/agent-hermes"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_MCP_AUTHORIZATION","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] hermes -> Home (net-home) · qwen3-coder · web search on","config":{"agent-hermes":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "commandcode · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "devin · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "muse · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"muse cannot run on grid Home: Muse Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "amp · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"amp cannot run on grid Home: Amp documents no way to change where it sends inference. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "kilo · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"kilo cannot run on grid Home: the Kilo CLI has no OpenAI-compatible provider option yet (its own issues #5840, #6315). It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/agent-grok"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] grok -> Home (net-home) · qwen3-coder · web search on","config":{"agent-grok":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "agy · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"agy cannot run on grid Home: Antigravity speaks the Gemini API, which this relay does not serve. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"extraArgs":["--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] copilot -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "terminal · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"terminal cannot run on grid Home: a terminal runs no engine to point at a grid — start one inside it and it will use its own login. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{},"logged":[]},
+ "claude · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-2"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead."],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}}},"retargetLine":"[grid] claude -> Home (net-home) · model chosen by the engine · web search unavailable","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] claude -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"http://127.0.0.1:<port>","ANTHROPIC_AUTH_TOKEN":"fresh-key","ANTHROPIC_MODEL":"vendor/model-a","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"200000"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead."],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}}},"retargetLine":"[grid] claude -> Router (api:router) · vendor/model-a · web search unavailable","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] claude -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_MODEL":"own-model"},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] claude -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-2"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\""],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}}},"retargetLine":"[grid] codex -> Home (net-home) · model chosen by the engine · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] codex -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"fresh-key"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"http://127.0.0.1:<port>/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-m","vendor/model-a","-c","model_context_window=200000","-c","model_auto_compact_token_limit=180000"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}}},"retargetLine":"[grid] codex -> Router (api:router) · vendor/model-a · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] codex -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"openai\"","-m","own-model"],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] codex -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-2","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"},"sessionModel":"home/Auto"}},"retargetLine":"[grid] opencode -> Home (net-home) · model chosen by the engine · web search unavailable","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/Auto\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"Auto\": {\n \"name\": \"Auto\"\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["-m","home/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"fresh-key","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"},"sessionModel":"api-router/vendor/model-a"}},"retargetLine":"[grid] opencode -> Router (api:router) · vendor/model-a · web search unavailable","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"api-router/vendor/model-a\",\n \"provider\": {\n \"api-router\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Router\",\n \"options\": {\n \"baseURL\": \"http://127.0.0.1:<port>/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"vendor/model-a\": {\n \"name\": \"vendor/model-a\",\n \"limit\": {\n \"context\": 200000,\n \"output\": 32000\n }\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-2","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/Auto"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"fresh-key","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/vendor/model-a"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-2"},"extraArgs":[],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}}},"retargetLine":"[grid] hermes -> Home (net-home) · model chosen by the engine · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] hermes -> Home (net-home) · qwen3-coder · web search unsupported (/etc/hermes pins this machine's Hermes settings, and the overlay carrying the web tools would replace it)","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"http://127.0.0.1:<port>/v1","OPENAI_API_KEY":"fresh-key","HERMES_INFERENCE_MODEL":"vendor/model-a"},"extraArgs":["-m","vendor/model-a"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}}},"retargetLine":"[grid] hermes -> Router (api:router) · vendor/model-a · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/agent-hermes"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_MCP_AUTHORIZATION","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] hermes -> Home (net-home) · qwen3-coder · web search on","config":{"agent-hermes":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-m","own-model"],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "hermes · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/agent-hermes"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_MCP_AUTHORIZATION","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] hermes -> Home (net-home) · qwen3-coder · web search on","config":{"agent-hermes":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-2","GRID_API_KEY":"grid-key-2","GROK_HOME":"<root>/data/grid-engine-config/agent-grok"},"extraArgs":["-m","Auto"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}}},"retargetLine":"[grid] grok -> Home (net-home) · model chosen by the engine · web search unavailable","config":{"agent-grok":{"dir":{"config.toml":{"mode":"600","text":"[model.\"Auto\"]\nmodel = \"Auto\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/agent-grok"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] grok -> Home (net-home) · qwen3-coder · web search on","config":{"agent-grok":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"GROK_MODELS_BASE_URL":"http://127.0.0.1:<port>/v1","XAI_API_KEY":"fresh-key","GRID_API_KEY":"fresh-key","GROK_HOME":"<root>/data/grid-engine-config/agent-grok"},"extraArgs":["-m","vendor/model-a"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}}},"retargetLine":"[grid] grok -> Router (api:router) · vendor/model-a · web search unavailable","config":{"agent-grok":{"dir":{"config.toml":{"mode":"600","text":"[model.\"vendor/model-a\"]\nmodel = \"vendor/model-a\"\nbase_url = \"http://127.0.0.1:<port>/v1\"\nenv_key = \"GRID_API_KEY\"\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/agent-grok"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] grok -> Home (net-home) · qwen3-coder · web search on","config":{"agent-grok":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "grok · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/agent-grok"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] grok -> Home (net-home) · qwen3-coder · web search on","config":{"agent-grok":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · restart on a grid without a model": {"result":{"ok":false,"error":"GRID_MODEL_REQUIRED","detail":"copilot will not start against a grid without a model. Pick one for Home and try again."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"extraArgs":["--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] copilot -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"COPILOT_PROVIDER_BASE_URL":"http://127.0.0.1:<port>/v1","COPILOT_PROVIDER_API_KEY":"fresh-key","COPILOT_MODEL":"vendor/model-a"},"extraArgs":[],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","HERMES_INFERENCE_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}}},"retargetLine":"[grid] copilot -> Router (api:router) · vendor/model-a · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"extraArgs":["--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] copilot -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "copilot · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"extraArgs":["--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] copilot -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · restart on a removed API": {"result":{"ok":false,"error":"API_UNAVAILABLE","detail":"This API is not saved. Add it in Models → APIs."},"retargetLine":null,"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart on an API with no Bearer key": {"result":{"ok":false,"error":"API_UNAVAILABLE","detail":"Keyed does not take a Bearer key, so coding agents cannot run on it."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart on a grid · an old tmux": {"result":{"ok":false,"error":"TMUX_TOO_OLD_FOR_GRID","detail":"this machine's tmux is older than 3.2, which is the first version that can give a pane its own environment — so codex could not be pointed at grid Home."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · restart as a named agent on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
+},
+"other": {
+ "validate · claude · grid": {"ok":true},
+ "validate · claude · own login": {"ok":true},
+ "leaving a grid · claude": ["ANTHROPIC_BASE_URL","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_MODEL","CLAUDE_CODE_MAX_CONTEXT_TOKENS","GRID_API_KEY"],
+ "validate · codex · grid": {"ok":true},
+ "validate · codex · own login": {"ok":true},
+ "leaving a grid · codex": ["GRID_API_KEY","GRID_MCP_AUTHORIZATION"],
+ "validate · cursor · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · cursor · own login": {"ok":true},
+ "leaving a grid · cursor": [],
+ "validate · opencode · grid": {"ok":true},
+ "validate · opencode · own login": {"ok":true},
+ "leaving a grid · opencode": ["GRID_API_KEY","OPENCODE_CONFIG"],
+ "validate · pi · grid": {"ok":true},
+ "validate · pi · own login": {"ok":true},
+ "leaving a grid · pi": ["GRID_API_KEY","PI_CODING_AGENT_DIR"],
+ "validate · hermes · grid": {"ok":true},
+ "validate · hermes · own login": {"ok":true},
+ "leaving a grid · hermes": ["OPENAI_BASE_URL","OPENAI_API_KEY","HERMES_INFERENCE_MODEL","GRID_API_KEY","HERMES_MANAGED_DIR"],
+ "validate · commandcode · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · commandcode · own login": {"ok":true},
+ "leaving a grid · commandcode": [],
+ "validate · devin · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · devin · own login": {"ok":true},
+ "leaving a grid · devin": [],
+ "validate · muse · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"muse cannot run on grid Home: Muse Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · muse · own login": {"ok":true},
+ "leaving a grid · muse": [],
+ "validate · amp · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"amp cannot run on grid Home: Amp documents no way to change where it sends inference. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · amp · own login": {"ok":true},
+ "leaving a grid · amp": [],
+ "validate · kilo · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"kilo cannot run on grid Home: the Kilo CLI has no OpenAI-compatible provider option yet (its own issues #5840, #6315). It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · kilo · own login": {"ok":true},
+ "leaving a grid · kilo": [],
+ "validate · grok · grid": {"ok":true},
+ "validate · grok · own login": {"ok":true},
+ "leaving a grid · grok": ["GROK_MODELS_BASE_URL","XAI_API_KEY","GRID_API_KEY","GROK_HOME"],
+ "validate · agy · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"agy cannot run on grid Home: Antigravity speaks the Gemini API, which this relay does not serve. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · agy · own login": {"ok":true},
+ "leaving a grid · agy": [],
+ "validate · copilot · grid": {"ok":true},
+ "validate · copilot · own login": {"ok":true},
+ "leaving a grid · copilot": ["COPILOT_PROVIDER_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_MODEL","GRID_API_KEY"],
+ "validate · terminal · grid": {"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"terminal cannot run on grid Home: a terminal runs no engine to point at a grid — start one inside it and it will use its own login. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},
+ "validate · terminal · own login": {"ok":true},
+ "leaving a grid · terminal": [],
+ "validate · claude · grid · an old tmux": {"ok":false,"error":"TMUX_TOO_OLD_FOR_GRID","detail":"this machine's tmux is older than 3.2, which is the first version that can give a pane its own environment — so claude could not be pointed at grid Home."},
+ "validate · opencode · grid · another machine": {"ok":true},
+ "grid-capable engines": ["claude","codex","opencode","hermes","grok","pi","copilot"],
+ "API target · a listed model": {"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},
+ "API target · a model without details": {"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-b"},
+ "API target · a window too small": {"threw":"Router does not list tiny for coding agents."},
+ "API target · a model without tools": {"threw":"Router does not list no-tools for coding agents."},
+ "API target · an unlisted model": {"threw":"Router does not list missing for coding agents."},
+ "API target · no model": {"threw":"Choose a model."},
+ "API target · an API with no Bearer key": {"threw":"Keyed does not take a Bearer key, so coding agents cannot run on it."},
+ "API target · a removed API": {"threw":"This API is not saved. Add it in Models → APIs."},
+ "API tools · claude": {"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},
+ "API tools · codex": {"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},
+ "API tools · opencode": {"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},
+ "API tools · gemini": {"GEMINI.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},
+ "API tools · terminal": {},
+ "API tools · an existing file, twice": {"AGENTS.md":{"mode":"644","text":"# Ours\n\n<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}}
+},
+"linux": {
+"create": {
+ "claude · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w1","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"script":"1333fd2d68d74ba5","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]},
+ "codex · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w2","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"script":"88c3cf4b9fd4bc7b","env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · qwen3-coder · web search on"]},
+ "opencode · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w4","opencode","--standalone"],"script":"6f3505cebb3ee70f","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
+ "pi · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w5","pi","--model","grid/qwen3-coder"],"script":"58487552b35bae51","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "hermes · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w6","hermes","-m","qwen3-coder"],"script":"dd58c36f3e5ae23d","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search on"]},
+ "grok · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w12","grok","-m","qwen3-coder"],"script":"3f655e7b312baa06","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · qwen3-coder · web search on"]},
+ "copilot · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w14","copilot","--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"script":"8158f949480e16af","env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Home (net-home) · qwen3-coder · web search on"]},
+ "claude · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w16","claude","--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead."],"script":"47188e15b414aeb4","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "claude · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w17","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"script":"1333fd2d68d74ba5","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]},
+ "claude · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w18","claude","--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead."],"script":"6ea6c470f91fd55c","env":{"ANTHROPIC_BASE_URL":"http://127.0.0.1:<port>","ANTHROPIC_AUTH_TOKEN":"stale-key","ANTHROPIC_MODEL":"vendor/model-a","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"200000"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "codex · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w19","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\""],"script":"27e47040ba7cd642","env":{"GRID_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "codex · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w20","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"script":"88c3cf4b9fd4bc7b","env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · qwen3-coder · web search on"]},
+ "codex · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w21","codex","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"http://127.0.0.1:<port>/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-m","vendor/model-a","-c","model_context_window=200000","-c","model_auto_compact_token_limit=180000"],"script":"27e47040ba7cd642","env":{"GRID_API_KEY":"stale-key"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "opencode · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w22","opencode","--standalone"],"script":"6f3505cebb3ee70f","env":{"GRID_API_KEY":"grid-key-2","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/Auto\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"Auto\": {\n \"name\": \"Auto\"\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "opencode · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w23","opencode","-m","home/qwen3-coder"],"script":"6f3505cebb3ee70f","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
+ "opencode · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w24","opencode","--standalone"],"script":"6f3505cebb3ee70f","env":{"GRID_API_KEY":"stale-key","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"api-router/vendor/model-a\",\n \"provider\": {\n \"api-router\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Router\",\n \"options\": {\n \"baseURL\": \"http://127.0.0.1:<port>/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"vendor/model-a\": {\n \"name\": \"vendor/model-a\",\n \"limit\": {\n \"context\": 200000,\n \"output\": 32000\n }\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "pi · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w25","pi","--model","grid/Auto"],"script":"58487552b35bae51","env":{"GRID_API_KEY":"grid-key-2","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w26","pi","--model","grid/qwen3-coder"],"script":"58487552b35bae51","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "pi · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w27","pi","--model","grid/vendor/model-a"],"script":"58487552b35bae51","env":{"GRID_API_KEY":"stale-key","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)"]},
+ "hermes · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w28","hermes"],"script":"2613a62bfcc1fe02","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "hermes · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w29","hermes","-m","qwen3-coder"],"script":"7ccb7ffb2df720a6","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search unsupported (/etc/hermes pins this machine's Hermes settings, and the overlay carrying the web tools would replace it)"]},
+ "hermes · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w30","hermes","-m","vendor/model-a"],"script":"7ccb7ffb2df720a6","env":{"OPENAI_BASE_URL":"http://127.0.0.1:<port>/v1","OPENAI_API_KEY":"stale-key","HERMES_INFERENCE_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "grok · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w31","grok","-m","Auto"],"script":"3f655e7b312baa06","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-2","GRID_API_KEY":"grid-key-2","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"Auto\"]\nmodel = \"Auto\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · model chosen by the engine · web search unavailable"]},
+ "grok · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w32","grok","-m","qwen3-coder"],"script":"3f655e7b312baa06","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · qwen3-coder · web search on"]},
+ "grok · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w33","grok","-m","vendor/model-a"],"script":"3f655e7b312baa06","env":{"GROK_MODELS_BASE_URL":"http://127.0.0.1:<port>/v1","XAI_API_KEY":"stale-key","GRID_API_KEY":"stale-key","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"vendor/model-a\"]\nmodel = \"vendor/model-a\"\nbase_url = \"http://127.0.0.1:<port>/v1\"\nenv_key = \"GRID_API_KEY\"\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "copilot · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w35","copilot","--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"script":"8158f949480e16af","env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Home (net-home) · qwen3-coder · web search on"]},
+ "copilot · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w36","copilot"],"script":"f04b7761a575db39","env":{"COPILOT_PROVIDER_BASE_URL":"http://127.0.0.1:<port>/v1","COPILOT_PROVIDER_API_KEY":"stale-key","COPILOT_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Router (api:router) · vendor/model-a · web search unavailable"]},
+ "claude · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w38","claude"],"script":"3c6d57a7321257f1","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w39","codex"],"script":"128d4b8d74fb47bd","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
+},
+"relaunch": {
+
+},
+"other": {
+
+}
+},
+"scripts": {
+ "096238a72b8b74cc": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:5000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
+ "128d4b8d74fb47bd": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:5000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
+ "1333fd2d68d74ba5": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "2613a62bfcc1fe02": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "27e47040ba7cd642": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:5000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
+ "3c6d57a7321257f1": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "3e9ce92055162a4b": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:5000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
+ "3f655e7b312baa06": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: grok exited ('\"$harness_status\"'). This pane is a shell now — run grok again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'grok' '<root>/home/.grok/bin/grok' '<root>/home/.local/bin/grok'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://x.ai/cli/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://x.ai/cli/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "47188e15b414aeb4": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "52793fbd71a813cc": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: opencode exited ('\"$harness_status\"'). This pane is a shell now — run opencode again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'opencode' '<root>/home/.opencode/bin/opencode' '<root>/home/.local/bin/opencode'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'opencode'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://opencode.ai/install | bash' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "58487552b35bae51": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: pi exited ('\"$harness_status\"'). This pane is a shell now — run pi again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'pi' '<root>/home/.local/bin/pi'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'pi'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g --ignore-scripts @earendil-works/pi-coding-agent' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "68c371f95abe1215": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: pi exited ('\"$harness_status\"'). This pane is a shell now — run pi again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'pi' '<root>/home/.local/bin/pi'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'pi'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g --ignore-scripts @earendil-works/pi-coding-agent' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "6b9f744e75e1feb5": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: copilot exited ('\"$harness_status\"'). This pane is a shell now — run copilot again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'copilot' '<root>/home/.local/bin/copilot'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'copilot'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @github/copilot' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @github/copilot') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "6ea6c470f91fd55c": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "6f3505cebb3ee70f": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: opencode exited ('\"$harness_status\"'). This pane is a shell now — run opencode again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'opencode' '<root>/home/.opencode/bin/opencode' '<root>/home/.local/bin/opencode'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'opencode'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://opencode.ai/install | bash' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "7027f317099a217d": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "7ccb7ffb2df720a6": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "8158f949480e16af": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: copilot exited ('\"$harness_status\"'). This pane is a shell now — run copilot again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'copilot' '<root>/home/.local/bin/copilot'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'copilot'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @github/copilot' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @github/copilot') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "84421bb2029d77b5": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "85f5530a91919102": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL GRID_MCP_AUTHORIZATION GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "88c3cf4b9fd4bc7b": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:5000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
+ "943508615993a9fc": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: grok exited ('\"$harness_status\"'). This pane is a shell now — run grok again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'grok' '<root>/home/.grok/bin/grok' '<root>/home/.local/bin/grok'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://x.ai/cli/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://x.ai/cli/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "9cf03823c9a21422": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: copilot exited ('\"$harness_status\"'). This pane is a shell now — run copilot again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'copilot' '<root>/home/.local/bin/copilot'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'copilot'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @github/copilot' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @github/copilot') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "b5d0565d20e56ba0": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "cb146dfa0878a5f0": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "dd58c36f3e5ae23d": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL GRID_MCP_AUTHORIZATION GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "ebd80e4e7c536ee5": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:5000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
+ "f04b7761a575db39": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: copilot exited ('\"$harness_status\"'). This pane is a shell now — run copilot again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'copilot' '<root>/home/.local/bin/copilot'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'copilot'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @github/copilot' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @github/copilot') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "f0c6dcced54e284a": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "f2dfc7cb1c72b1ef": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nif ! harness_find_engine \"$1\"; then\n printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after"
+}
+}
diff --git a/cli/src/engines/launchArgv.golden.spec.ts b/cli/src/engines/launchArgv.golden.spec.ts
index f0ddac0e4..183781c7f 100644
--- a/cli/src/engines/launchArgv.golden.spec.ts
+++ b/cli/src/engines/launchArgv.golden.spec.ts
@@ -40,6 +40,7 @@ import {
import { GRID_CONFLICTING_ENV_VARS, type GridLaunchOverride } from '../lib/gridLaunch.js'
import { buildLaunchOverrides, type LaunchOverridesDeps, type LaunchSource } from '../lib/launchOverrides.js'
import { ENGINES, type AgentEngine } from './types.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
const GOLDEN = fileURLToPath(new URL('./__fixtures__/launch-argv.golden.json', import.meta.url))
const RECORD = process.env.RECORD_LAUNCH_GOLDEN === '1'
@@ -403,7 +404,7 @@ async function overridesCases(): Promise<Record<string, unknown>> {
const run = async (engine: AgentEngine, source: LaunchSource, config: string | null = null, deps: Partial<LaunchOverridesDeps> = {}) => {
const calls: string[] = []
const result = await buildLaunchOverrides({
- machine: () => ({ hermesSystemManaged: false, opencodeMajor: null }),
+ machine: () => ({ hermesSystemManaged: false, opencodeMajor: null }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async (key, files) => { calls.push(`writeGridConfigDir ${key} ${files.map((file) => file.name).join(',')}`); return `/state/grid-engine-config/${key}` },
tmuxSupportsSessionEnv: async () => true,
installCodexHooks: (home) => { calls.push(`installCodexHooks ${home}`) },
diff --git a/cli/src/engines/launchShapes.golden.spec.ts b/cli/src/engines/launchShapes.golden.spec.ts
new file mode 100644
index 000000000..6f69c7e56
--- /dev/null
+++ b/cli/src/engines/launchShapes.golden.spec.ts
@@ -0,0 +1,345 @@
+/**
+ * Every launch shape that carries a grid model or a saved API, answer for answer: recorded from the code as it stood
+ * before the models service built those launches for the core (docs/design/2026-10-08-launch-port.md, (L1)). For
+ * each engine, it records what a create, a relaunch (restart, resume, restore), a fork and a retarget start the pane
+ * with: the argv, the environment, the variables cleared, the row's launch record. It also records the config files
+ * written for an engine that reads its provider from a file, the saved-API instructions an agent's folder gets, the
+ * log lines and every refusal. It covers what the socket asks of a saved API, the variables a pane leaving a grid
+ * has cleared, and the engines a picker may offer a grid model to.
+ *
+ * Each case runs with `process.platform` pinned to darwin and to linux, and linux's are stored where they differ.
+ * Local time is pinned. The home folder, the data folder and the saved API's address are the spec's own, and no
+ * size depends on their paths.
+ *
+ * `RECORD_LAUNCH_SHAPES_GOLDEN=1` writes the fixture. Record it again only for a change meant to alter a launch,
+ * and say so in that change.
+ */
+import { createHash } from 'node:crypto'
+import { createServer, type Server } from 'node:http'
+import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, readlinkSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs'
+import type { AddressInfo } from 'node:net'
+import { tmpdir } from 'node:os'
+import { dirname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
+import { ENGINES, type AgentEngine } from './types.js'
+import { baseNode } from '../harnessd/baseNode.js'
+import { resolveBinaryOnPath } from '../lib/binaryOnPath.js'
+import type { RegisteredSession } from '../lib/registry.js'
+import type { GridLaunchOverride } from '../lib/gridLaunch.js'
+
+process.env.TZ = 'America/New_York'
+
+// The pane itself, and the probes of this machine's binaries: the launch is what is recorded, never a spawn.
+const pane = vi.hoisted(() => ({ calls: [] as Array<Record<string, unknown>>, tmux: true }))
+vi.mock('../lib/createAgentPane.js', () => ({
+ createAndRegisterPane: vi.fn(async (input: Record<string, unknown>) => {
+ pane.calls.push(input)
+ return { ok: false, error: 'RECORDED', detail: 'the pane is not opened by this spec' }
+ }),
+}))
+vi.mock('../lib/tmuxVersion.js', async (real) => ({ ...await real<object>(), tmuxSupportsSessionEnv: vi.fn(async () => pane.tmux) }))
+vi.mock('../engines/opencode/version.js', async (real) => ({ ...await real<object>(), opencodeMajorVersion: vi.fn(() => 2) }))
+vi.mock('../lib/engineBin.js', async (real) => ({ ...await real<object>(), enginePathOverride: vi.fn(() => null) }))
+
+const GOLDEN = fileURLToPath(new URL('./__fixtures__/launch-shapes.golden.json', import.meta.url))
+const RECORD = process.env.RECORD_LAUNCH_SHAPES_GOLDEN === '1'
+
+let root = ''
+let server: Server
+let apiBase = ''
+let port = ''
+const saved: Record<string, string | undefined> = {}
+/** The variables a launch reads of the daemon's own environment, each pinned (or cleared) for the record. */
+const VARS = ['ADAPTER_DATA_DIR', 'HOME', 'ZDOTDIR', 'SHELL', 'CODEX_HOME', 'CODEX_PATH', 'HARNESS_OS', 'HARNESS_GRID_BIN', 'CLAUDE_PATH', 'CURSOR_PATH',
+ 'OPENCODE_PATH', 'PI_PATH', 'HERMES_PATH', 'COMMANDCODE_PATH', 'DEVIN_PATH', 'MUSE_PATH', 'AMP_PATH', 'KILO_PATH', 'GROK_PATH', 'AGY_PATH', 'COPILOT_PATH'] as const
+/** The launch scripts the cases name, by digest: most shapes share theirs with others. */
+const scripts: Record<string, string> = {}
+type Shapes = ReturnType<typeof import('../testing/launchShapes.js')['launchShapes']>
+let shapes: (machine: { hermesSystemManaged: boolean; opencodeMajor?: number | null }) => Shapes
+
+const GRID: GridLaunchOverride = {
+ networkId: 'net-home', networkName: 'Home', baseUrl: 'https://grid.example/g/home/relay/v1', apiKey: 'grid-key-1', model: 'qwen3-coder',
+ mcpUrl: 'https://control.example/v1/grid/web-mcp/', contextWindow: 131072,
+}
+const BARE: GridLaunchOverride = { networkId: 'net-home', networkName: 'Home', baseUrl: 'https://grid.example/g/home/relay/v1', apiKey: 'grid-key-2' }
+const api = (connection: string, model = 'vendor/model-a'): GridLaunchOverride => ({
+ networkId: `api:${connection}`, networkName: 'Router', baseUrl: apiBase, apiKey: 'stale-key', model, contextWindow: 200000,
+})
+const M1 = { hermesSystemManaged: false, opencodeMajor: 2 }
+const M2 = { hermesSystemManaged: true, opencodeMajor: 1 }
+
+/** The machine's own parts of a text, as placeholders: the spec's folders, the API's port, this node, its tmux. */
+const placeheld = (text: string, label?: string): string => {
+ const node = baseNode(process.execPath)
+ // The daemon's tmux, as a launch finds it on PATH: /opt/homebrew/bin/tmux on a Mac, /usr/bin/tmux on CI's Linux.
+ const tmux = resolveBinaryOnPath('tmux')
+ // Quoted, as every script quotes them: a Node in /usr/bin must not turn `/usr/bin/env` into a placeholder.
+ let out = text.split(`'${node}'`).join("'<daemon-node>'").split(`'${dirname(node)}'`).join("'<daemon-node-dir>'")
+ if (tmux) out = out.split(`'${tmux}'`).join("'<tmux>'")
+ .split(root).join('<root>').split(`127.0.0.1:${port}`).join('127.0.0.1:<port>')
+ .replace(/\/launch\/[0-9a-f-]{36}\.sh/g, '/launch/<script>.sh')
+ if (label) out = out.split(label).join('<label>')
+ return out
+}
+const norm = (value: unknown, label?: string): unknown => value === undefined ? '<undefined>' : JSON.parse(placeheld(JSON.stringify(value), label))
+/** The script a launch's argv sources, kept once by its digest. */
+function scriptOf(argv: unknown, label?: string): string | null {
+ const sourced = Array.isArray(argv) ? argv.map(String).map((arg) => /^\. '(.+\/launch\/[0-9a-f-]{36}\.sh)'$/.exec(arg)?.[1]).find(Boolean) : undefined
+ if (!sourced || !existsSync(sourced)) return null
+ const text = placeheld(readFileSync(sourced, 'utf8'), label)
+ const digest = createHash('sha256').update(text).digest('hex').slice(0, 16)
+ scripts[digest] = text
+ return digest
+}
+async function attempt<T>(run: () => T | Promise<T>): Promise<unknown> {
+ try { return norm(await run()) } catch (error) { return { threw: norm(error instanceof Error ? error.message : String(error)) } }
+}
+
+/** A folder's files: names, bytes and modes, and where each link points. */
+function tree(dir: string): Record<string, unknown> | null {
+ if (!existsSync(dir)) return null
+ const out: Record<string, unknown> = {}
+ for (const name of readdirSync(dir).sort()) {
+ const path = join(dir, name)
+ const info = lstatSync(path)
+ out[name] = info.isSymbolicLink() ? { link: readlinkSync(path) }
+ : info.isDirectory() ? { dir: tree(path) }
+ : { mode: (statSync(path).mode & 0o777).toString(8), text: readFileSync(path, 'utf8') }
+ }
+ return out
+}
+const configRoot = () => join(root, 'data', 'grid-engine-config')
+let folders = 0
+const work = (): string => { const dir = join(root, 'work', `w${++folders}`); mkdirSync(dir, { recursive: true }); return dir }
+
+beforeAll(async () => {
+ root = realpathSync(mkdtempSync(join(tmpdir(), 'launch-shapes-golden-')))
+ for (const name of VARS) saved[name] = process.env[name]
+ for (const name of VARS) delete process.env[name]
+ process.env.ADAPTER_DATA_DIR = join(root, 'data')
+ process.env.HOME = join(root, 'home')
+ process.env.SHELL = '/bin/zsh'
+ process.env.CODEX_HOME = join(root, 'home', '.codex')
+ // A zsh user with a startup file of their own: the plain launch.
+ process.env.ZDOTDIR = join(root, 'zdotdir')
+ for (const dir of ['data', 'zdotdir', 'home/.grok/sessions', 'home/.pi/agent/skills', 'home/.codex']) mkdirSync(join(root, dir), { recursive: true })
+ writeFileSync(join(root, 'zdotdir', '.zshrc'), '')
+ // A saved API's model list, as an OpenAI-compatible API answers it, only for the key saved now.
+ server = createServer((request, response) => {
+ if (request.url !== '/v1/models') { response.statusCode = 404; response.end(); return }
+ if (request.headers.authorization !== 'Bearer fresh-key') { response.statusCode = 401; response.end(); return }
+ response.setHeader('content-type', 'application/json')
+ response.end(JSON.stringify({ data: [
+ { id: 'vendor/model-a', name: 'Vendor: Model A', context_length: 200000, supported_parameters: ['tools'] },
+ { id: 'vendor/model-b' },
+ { id: 'tiny', context_length: 1000 },
+ { id: 'no-tools', supported_parameters: ['temperature'] },
+ ] }))
+ })
+ await new Promise<void>((done) => server.listen(0, '127.0.0.1', done))
+ port = String((server.address() as AddressInfo).port)
+ apiBase = `http://127.0.0.1:${port}/v1`
+ vi.resetModules()
+ const { ApiConnections } = await import('../lib/apiConnections.js')
+ const store = new ApiConnections(join(root, 'data'))
+ store.save({ provider: 'custom', name: 'Router', baseUrl: apiBase, apiKey: 'fresh-key' })
+ store.save({ provider: 'custom', name: 'Keyed', baseUrl: apiBase, apiKey: 'other-key', authHeader: 'x-api-key', authPrefix: '' })
+ const { launchShapes } = await import('../testing/launchShapes.js')
+ shapes = (machine) => launchShapes({
+ dataDir: join(root, 'data'), machine: () => ({ ...machine }), tmuxSupportsSessionEnv: async () => pane.tmux,
+ readCodexConfig: () => null, setGridLaunch: () => {},
+ })
+})
+
+afterAll(async () => {
+ for (const name of VARS) {
+ if (saved[name] === undefined) delete process.env[name]
+ else process.env[name] = saved[name]
+ }
+ await new Promise<void>((done) => server.close(() => done()))
+ rmSync(root, { recursive: true, force: true })
+ vi.resetModules()
+})
+
+/** What was logged while `run` ran, of the lines a launch writes. */
+async function logged<T>(run: () => Promise<T>): Promise<{ value: T; lines: string[] }> {
+ const lines: string[] = []
+ const keep = (...args: unknown[]) => { lines.push(args.map(String).join(' ')) }
+ const log = vi.spyOn(console, 'log').mockImplementation(keep)
+ const warn = vi.spyOn(console, 'warn').mockImplementation(keep)
+ try { return { value: await run(), lines } } finally { log.mockRestore(); warn.mockRestore() }
+}
+
+// ------------------------------------------------------------------------------------------------ create
+
+const pending = { agentId: 'created', sessionId: '', engine: 'claude' } as RegisteredSession
+const rest = () => ({
+ tmuxBackend: {} as never, registry: { setLaunch: () => pending } as never,
+ adoptableSession: async () => ({ ok: false, error: 'UNUSED' }) as never, heldBy: async () => 'none' as const, takeOverWhenIdle: async () => {},
+ watchNewPane: (async () => {}) as never, announceSession: () => {}, attachDsh: () => {}, hookPort: 4242, hooksDisabled: true,
+ installOpencodePlugin: async () => true, terminalHintMachineName: () => 'this-mac', blocksFolder: () => false, gridSetup: () => null,
+ privateGridName: async () => null,
+})
+
+async function createCase(engine: AgentEngine, grid: GridLaunchOverride | null, machine = M1): Promise<unknown> {
+ pane.calls.length = 0
+ rmSync(configRoot(), { recursive: true, force: true })
+ const cwd = work()
+ const { value, lines } = await logged(() => shapes(machine).create(rest() as never)({
+ engine, cwd, bypassPermission: false, permissionMode: null, grid, codexHome: null, dsh: null, prompt: null, name: null, agent: null,
+ resumeSessionId: null, takeOver: null,
+ } as never))
+ const call = pane.calls[0]
+ const label = typeof call?.sessionLabel === 'string' ? call.sessionLabel : undefined
+ return norm({
+ result: value,
+ pane: call ? { argv: call.argv, script: scriptOf(call.argv, label), env: call.env, grid: call.grid, gridLaunchRecord: call.gridLaunchRecord } : null,
+ config: tree(configRoot()),
+ folder: tree(cwd),
+ logged: lines.filter((line) => /grid|refused|\[apis\]/i.test(line)),
+ }, label)
+}
+
+async function createCases(): Promise<Record<string, unknown>> {
+ const cases: Record<string, unknown> = {}
+ for (const engine of ENGINES) cases[`${engine} · grid`] = await createCase(engine, GRID)
+ for (const engine of ['claude', 'codex', 'opencode', 'pi', 'hermes', 'grok', 'copilot'] as const) {
+ cases[`${engine} · grid without a model, web tools or window`] = await createCase(engine, BARE)
+ cases[`${engine} · grid · another machine`] = await createCase(engine, GRID, M2)
+ cases[`${engine} · saved API`] = await createCase(engine, api('router'))
+ }
+ pane.tmux = false
+ cases['claude · grid · an old tmux'] = await createCase('claude', GRID)
+ pane.tmux = true
+ cases['claude · own login'] = await createCase('claude', null)
+ cases['codex · own login'] = await createCase('codex', null)
+ return cases
+}
+
+// ---------------------------------------------------------------------------------------------- relaunch
+
+const session = (engine: AgentEngine, over: Partial<RegisteredSession> = {}): RegisteredSession => ({
+ agentId: `agent-${engine}`, sessionId: 's', engine, cwd: work(), gridLaunch: null, codexHome: null, dsh: null, dshRuntime: null, agent: null,
+ scmLaunch: null, ...over,
+}) as unknown as RegisteredSession
+
+async function relaunchCase(engine: AgentEngine, s: RegisteredSession, source?: Parameters<Shapes['relaunch']>[1], machine = M1): Promise<unknown> {
+ rmSync(configRoot(), { recursive: true, force: true })
+ const { value, lines } = await logged(() => shapes(machine).relaunch(s, source))
+ return norm({
+ result: value,
+ retargetLine: value.ok ? shapes(machine).retargetLine(engine, value.overrides) : null,
+ config: tree(configRoot()),
+ folder: tree(s.cwd!),
+ logged: lines.filter((line) => /grid|refused|\[apis\]/i.test(line)),
+ })
+}
+
+async function relaunchCases(): Promise<Record<string, unknown>> {
+ const cases: Record<string, unknown> = {}
+ for (const engine of ENGINES) {
+ cases[`${engine} · restart on a grid`] = await relaunchCase(engine, session(engine, { gridLaunch: GRID }))
+ }
+ for (const engine of ['claude', 'codex', 'opencode', 'pi', 'hermes', 'grok', 'copilot'] as const) {
+ cases[`${engine} · restart on a grid without a model`] = await relaunchCase(engine, session(engine, { gridLaunch: BARE }))
+ cases[`${engine} · restart on a grid · another machine`] = await relaunchCase(engine, session(engine, { gridLaunch: GRID }), undefined, M2)
+ cases[`${engine} · restart on a saved API, its key as saved now`] = await relaunchCase(engine, session(engine, { gridLaunch: api('router') }))
+ // Retarget hands the override it just resolved; fork drops the harness and the named agent.
+ cases[`${engine} · retarget onto a grid`] = await relaunchCase(engine, session(engine), { gridLaunch: GRID })
+ cases[`${engine} · retarget back to the own login`] = await relaunchCase(engine, session(engine, { gridLaunch: GRID }), { gridLaunch: null, subscriptionModel: 'own-model' })
+ cases[`${engine} · fork on a grid`] = await relaunchCase(engine, session(engine, { gridLaunch: GRID, agent: 'reviewer' }), { gridLaunch: GRID, dsh: null, agent: null })
+ }
+ cases['claude · restart on a removed API'] = await relaunchCase('claude', session('claude', { gridLaunch: api('gone') }))
+ cases['codex · restart on an API with no Bearer key'] = await relaunchCase('codex', session('codex', { gridLaunch: api('keyed') }))
+ pane.tmux = false
+ cases['codex · restart on a grid · an old tmux'] = await relaunchCase('codex', session('codex', { gridLaunch: GRID }))
+ pane.tmux = true
+ cases['opencode · restart as a named agent on a grid'] = await relaunchCase('opencode', session('opencode', { gridLaunch: GRID, agent: 'reviewer' }))
+ return cases
+}
+
+// ------------------------------------------------------------------------- retarget, the socket, the pickers
+
+async function otherCases(): Promise<Record<string, unknown>> {
+ const cases: Record<string, unknown> = {}
+ for (const engine of ENGINES) {
+ cases[`validate · ${engine} · grid`] = await attempt(() => shapes(M1).validate(engine, { gridLaunch: GRID }))
+ cases[`validate · ${engine} · own login`] = await attempt(() => shapes(M1).validate(engine, { gridLaunch: null }))
+ cases[`leaving a grid · ${engine}`] = norm(shapes(M1).leavingGrid(engine))
+ }
+ pane.tmux = false
+ cases['validate · claude · grid · an old tmux'] = await attempt(() => shapes(M1).validate('claude', { gridLaunch: GRID }))
+ pane.tmux = true
+ cases['validate · opencode · grid · another machine'] = await attempt(() => shapes(M2).validate('opencode', { gridLaunch: GRID }))
+ cases['grid-capable engines'] = norm(shapes(M1).gridCapable())
+ for (const [name, connection, model] of [
+ ['a listed model', 'router', 'vendor/model-a'], ['a model without details', 'router', 'vendor/model-b'], ['a window too small', 'router', 'tiny'],
+ ['a model without tools', 'router', 'no-tools'], ['an unlisted model', 'router', 'missing'], ['no model', 'router', ''],
+ ['an API with no Bearer key', 'keyed', 'vendor/model-a'], ['a removed API', 'gone', 'vendor/model-a'],
+ ] as const) {
+ cases[`API target · ${name}`] = await attempt(() => shapes(M1).apiTarget(connection, model))
+ }
+ for (const engine of ['claude', 'codex', 'opencode', 'gemini', 'terminal'] as const) {
+ const cwd = work()
+ shapes(M1).apiTools(cwd, engine)
+ cases[`API tools · ${engine}`] = norm(tree(cwd))
+ }
+ const kept = work()
+ writeFileSync(join(kept, 'AGENTS.md'), '# Ours\n')
+ shapes(M1).apiTools(kept, 'codex')
+ shapes(M1).apiTools(kept, 'codex')
+ cases['API tools · an existing file, twice'] = norm(tree(kept))
+ shapes(M1).apiTools(null, 'codex')
+ return cases
+}
+
+type Sections = Record<string, Record<string, unknown>>
+const PLATFORMS = ['darwin', 'linux'] as const
+
+async function sectionsOn(platform: (typeof PLATFORMS)[number]): Promise<Sections> {
+ const real = Object.getOwnPropertyDescriptor(process, 'platform')!
+ Object.defineProperty(process, 'platform', { ...real, value: platform })
+ rmSync(join(root, 'work'), { recursive: true, force: true })
+ folders = 0
+ try {
+ return { create: await createCases(), relaunch: await relaunchCases(), other: await otherCases() }
+ } finally { Object.defineProperty(process, 'platform', real) }
+}
+
+describe('every launch on a grid model or a saved API starts as it did before the models service built it', () => {
+ it('create, relaunch, fork, retarget, the API target and the pickers match the record, on darwin and linux', async () => {
+ const darwin = await sectionsOn('darwin')
+ const linux = await sectionsOn('linux')
+ const linuxDiffers = Object.fromEntries(Object.entries(linux).map(([section, cases]) => [section,
+ Object.fromEntries(Object.entries(cases).filter(([key, value]) => JSON.stringify(value) !== JSON.stringify(darwin[section]![key])))]))
+ // Both platforms' scripts, by digest: a case names its own, and its digest is its text.
+ const used = Object.fromEntries(Object.entries(scripts).sort(([a], [b]) => a.localeCompare(b)))
+ if (RECORD) {
+ const block = (cases: Record<string, unknown>): string => Object.entries(cases).map(([key, value]) => ` ${JSON.stringify(key)}: ${JSON.stringify(value)}`).join(',\n')
+ const sections = (all: Sections): string => Object.entries(all).map(([section, cases]) => `${JSON.stringify(section)}: {\n${block(cases)}\n}`).join(',\n')
+ writeFileSync(GOLDEN, `{\n${sections(darwin)},\n"linux": {\n${sections(linuxDiffers)}\n},\n"scripts": {\n${block(used)}\n}\n}\n`)
+ return
+ }
+ const { linux: linuxGolden, scripts: scriptsGolden, ...darwinGolden } = JSON.parse(readFileSync(GOLDEN, 'utf8')) as Sections & { linux: Sections; scripts: Record<string, string> }
+ expect(Object.keys(used)).toEqual(Object.keys(scriptsGolden))
+ for (const [digest, text] of Object.entries(scriptsGolden)) expect(used[digest], `script ${digest}`).toEqual(text)
+ for (const [platform, actual, golden] of [
+ ['darwin', darwin, darwinGolden],
+ ['linux', linux, Object.fromEntries(Object.entries(darwinGolden).map(([section, cases]) => [section, { ...cases, ...linuxGolden[section] }]))],
+ ] as const) {
+ expect(Object.keys(actual), platform).toEqual(Object.keys(golden))
+ for (const [section, cases] of Object.entries(golden)) {
+ expect(Object.keys(actual[section]!).sort(), `${platform} · ${section}`).toEqual(Object.keys(cases).sort())
+ for (const [key, value] of Object.entries(cases)) expect(actual[section]![key], `${platform} · ${section} · ${key}`).toEqual(value)
+ }
+ }
+ }, 240_000)
+
+ it('records no machine-specific path', () => {
+ const text = readFileSync(GOLDEN, 'utf8')
+ expect(text).not.toContain('launch-shapes-golden-')
+ expect(text).not.toContain(root)
+ expect(text).not.toMatch(/\/Users\/|\/home\/runner/)
+ })
+})
diff --git a/cli/src/engines/opencode/tuiFlags.spec.ts b/cli/src/engines/opencode/tuiFlags.spec.ts
index 3a2792339..e74f6f6dc 100644
--- a/cli/src/engines/opencode/tuiFlags.spec.ts
+++ b/cli/src/engines/opencode/tuiFlags.spec.ts
@@ -13,6 +13,7 @@ import { buildEngineCommandArgv, namedAgentArgs, supportsNamedAgent } from '../.
import { buildLaunchOverrides, type LaunchOverridesDeps, type LaunchSource } from '../../lib/launchOverrides.js'
import { binaryOnPath } from '../../lib/binaryOnPath.js'
import { opencodeMajorVersion } from './version.js'
+import { gridLaunchInProcess } from '../../testing/gridLaunchInProcess.js'
const installed = binaryOnPath('opencode')
@@ -24,7 +25,7 @@ describe.skipIf(!installed)('the installed opencode TUI accepts every flag we pa
const help = helpResult ? `${helpResult.stdout}\n${helpResult.stderr}` : ''
const major = installed ? opencodeMajorVersion() : null
const deps: LaunchOverridesDeps = {
- machine: () => ({ hermesSystemManaged: false, opencodeMajor: major }),
+ machine: () => ({ hermesSystemManaged: false, opencodeMajor: major }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async (key) => `/state/grid-engine-config/${key}`,
tmuxSupportsSessionEnv: async () => true,
installCodexHooks: () => {},
diff --git a/cli/src/lib/agentFrame.ts b/cli/src/lib/agentFrame.ts
index 3373bfaf8..6c7db818b 100644
--- a/cli/src/lib/agentFrame.ts
+++ b/cli/src/lib/agentFrame.ts
@@ -28,7 +28,7 @@ import { transcriptActivityAt } from './transcriptActivity.js'
import type { AgentTokenUsage } from './agentTokenUsage.js'
import type { AgentOutputStats } from './agentOutputStats.js'
import type { GridAssignment } from './gridAssignment.js'
-import type { GridWebSearchStatus } from './gridLaunch.js'
+import type { GridWebSearchStatus } from './gridLaunchWire.js'
import type { AgentGridTarget, GridAnnotation } from './gridAnnotation.js'
import { projectDisplayName, sessionDisplayTitle, type RegisteredSession } from './registry.js'
import { engineCanFork } from './forkAgent.js'
diff --git a/cli/src/lib/apiModels.spec.ts b/cli/src/lib/apiModels.spec.ts
index 582ba413c..81b6dcdd3 100644
--- a/cli/src/lib/apiModels.spec.ts
+++ b/cli/src/lib/apiModels.spec.ts
@@ -3,9 +3,10 @@ import { mkdtempSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { BackendSocket } from '../backendSocket.js'
+import type { ModelsPort } from '../core/api.js'
import { dispatchDown, gatewayOf, relaySocket } from '../testing/relaySocket.js'
import { ApiConnections } from './apiConnections.js'
-import { apiModelsRequest, chatModels, forgetApiModels, listApiModels, refreshApiLaunch, resolveApiTarget } from './apiModels.js'
+import { apiModelsRequest, apiTargetAnswer, chatModels, forgetApiModels, listApiModels, refreshApiFor, refreshApiLaunch, resolveApiTarget } from './apiModels.js'
import { classifyGridAssignment } from './gridAssignment.js'
import { buildGridEngineLaunch } from './gridLaunch.js'
@@ -130,15 +131,40 @@ describe('an API as a model source', () => {
store.remove(saved.id)
expect(() => refreshApiLaunch(store, launch)).toThrow('This API is not saved. Add it in Models → APIs.')
})
+
+ it('answers the core as models: the launch as saved now and its endpoint, or why it cannot be used', async () => {
+ const saved = store.save({ provider: 'openrouter', apiKey: secret })
+ const target = await apiTargetAnswer(store, saved.id, 'z-ai/glm-5', { fetch: answering(listing) })
+ expect(target).toEqual({ target: expect.objectContaining({ networkId: `api:${saved.id}`, apiKey: secret }), apiBase: 'https://openrouter.ai/api/v1' })
+ expect(await apiTargetAnswer(store, saved.id, 'not/listed', { fetch: answering(listing) })).toEqual({ detail: 'OpenRouter does not list not/listed for coding agents.' })
+ vi.spyOn(store, 'modelAccess').mockImplementationOnce(() => { throw new Error('unreadable') })
+ expect(await apiTargetAnswer(store, saved.id, 'z-ai/glm-5')).toEqual({ detail: 'This API could not be used. Try again.' })
+ const launch = 'target' in target ? target.target : null
+ const refresh = refreshApiFor(store)
+ store.save({ id: saved.id, provider: 'openrouter', apiKey: newSecret })
+ expect(refresh(launch!)).toEqual({ override: { ...launch, apiKey: newSecret }, apiBase: 'https://openrouter.ai/api/v1' })
+ const grid = { networkId: 'grid-1', networkName: 'home', baseUrl: 'https://grid.example.test/relay/v1', apiKey: 'grid-key' }
+ expect(refresh(grid)).toEqual({ override: grid })
+ vi.spyOn(store, 'modelAccess').mockImplementationOnce(() => { throw new Error('unreadable') })
+ expect(refresh(launch!)).toEqual({ error: 'API_UNAVAILABLE', detail: 'OpenRouter could not be read from saved APIs.' })
+ store.remove(saved.id)
+ expect(refresh(launch!)).toEqual({ error: 'API_UNAVAILABLE', detail: 'This API is not saved. Add it in Models → APIs.' })
+ })
})
describe('agent_retarget onto an API model', () => {
function retarget(socket: BackendSocket, payload: Record<string, unknown>, connId = 'local:apis') {
return dispatchDown(socket, { type: 'agent_retarget', payload: { requestId: 'r', agentId: 'agent-1', ...payload } }, connId, connId === 'remote' ? 'relay' : 'local')
}
+ /** A socket whose models service reads this spec's saved APIs, as services/models.ts answers `apiTarget`. */
+ function socketWithModels(apiTarget: ModelsPort['apiTarget'] = async (request) => apiTargetAnswer(store, request.connectionId, request.model)) {
+ const socket = relaySocket('fixture')
+ socket.models = () => ({ apiTarget }) as unknown as ModelsPort
+ return socket
+ }
it('resolves the endpoint and key on this computer and hands the engine launch that override', async () => {
- const socket = relaySocket('fixture')
+ const socket = socketWithModels()
const reply = vi.spyOn(socket as any, 'emitReply').mockImplementation(() => {})
const saved = store.save({ provider: 'openrouter', apiKey: secret })
const access = vi.spyOn(ApiConnections.prototype, 'modelAccess').mockImplementation(() => ({
@@ -185,7 +211,7 @@ describe('agent_retarget onto an API model', () => {
})
it('lets the owner\'s paired session use the API, as it may manage it', async () => {
- const socket = relaySocket('fixture')
+ const socket = socketWithModels()
const reply = vi.spyOn(socket as any, 'emitReply').mockImplementation(() => {})
const saved = store.save({ provider: 'openrouter', apiKey: secret })
vi.spyOn(ApiConnections.prototype, 'modelAccess').mockImplementation(() => ({ connection: saved, apiKey: secret }))
@@ -203,13 +229,38 @@ describe('agent_retarget onto an API model', () => {
})
it('answers why an API cannot be used, without touching the pane', async () => {
- const socket = relaySocket('fixture')
+ const socket = socketWithModels()
const reply = vi.spyOn(socket as any, 'emitReply').mockImplementation(() => {})
const moved = vi.fn(async () => ({ ok: true as const }))
socket.onRetargetAgent = moved
await retarget(socket, { apiConnection: 'never-saved', apiModel: 'z-ai/glm-5' })
- expect(reply).toHaveBeenLastCalledWith('local:apis', 'agent_retarget', 'r', expect.objectContaining({ error: 'API_UNAVAILABLE' }))
+ expect(reply).toHaveBeenLastCalledWith('local:apis', 'agent_retarget', 'r', { error: 'API_UNAVAILABLE', detail: 'This API is not saved. Add it in Models → APIs.' })
expect(moved).not.toHaveBeenCalled()
await socket.stop()
})
+
+ it('refuses at once, and touches no pane, while the models service that keeps the APIs is down', async () => {
+ const down = 'The models service is not running, so this API cannot be used now. Try again in a moment.'
+ for (const socket of [relaySocket('fixture'), socketWithModels(async () => { throw new Error('SERVICE_UNAVAILABLE') })]) {
+ const reply = vi.spyOn(socket as any, 'emitReply').mockImplementation(() => {})
+ const moved = vi.fn(async () => ({ ok: true as const }))
+ socket.onRetargetAgent = moved
+ await retarget(socket, { apiConnection: 'openrouter', apiModel: 'z-ai/glm-5' })
+ expect(reply).toHaveBeenLastCalledWith('local:apis', 'agent_retarget', 'r', { error: 'API_UNAVAILABLE', detail: down })
+ expect(moved).not.toHaveBeenCalled()
+ await socket.stop()
+ }
+ })
+
+ it("recognises an agent on the API's endpoint from then on, as when the socket read the store itself", async () => {
+ // Read in another process: only the answer's endpoint can teach the core's grid assignment.
+ const socket = socketWithModels(async () => ({ target: { networkId: 'api:far', networkName: 'Far', baseUrl: 'https://far.example.test/v1', apiKey: secret, model: 'm' }, apiBase: 'https://far.example.test/v1' }))
+ vi.spyOn(socket as any, 'emitReply').mockImplementation(() => {})
+ socket.onRetargetAgent = vi.fn(async () => ({ ok: true as const }))
+ const env = { ANTHROPIC_BASE_URL: 'https://far.example.test', ANTHROPIC_MODEL: 'm' }
+ expect(classifyGridAssignment('claude', env)).toBeNull()
+ await retarget(socket, { apiConnection: 'far', apiModel: 'm' })
+ expect(classifyGridAssignment('claude', env)).toEqual({ baseUrl: 'https://far.example.test', model: 'm' })
+ await socket.stop()
+ })
})
diff --git a/cli/src/lib/apiModels.ts b/cli/src/lib/apiModels.ts
index 123c629f1..2d30b462c 100644
--- a/cli/src/lib/apiModels.ts
+++ b/cli/src/lib/apiModels.ts
@@ -146,15 +146,35 @@ export function refreshApiLaunch(store: ApiConnections, launch: GridLaunchOverri
return { ...launch, networkName: connection.name, baseUrl: connection.baseUrl, apiKey }
}
-/** Every saved API's endpoint, so agents already running on one are recognised (`gridAssignment.ts`). */
-export function rememberSavedApis(store: ApiConnections): void {
+/**
+ * `refreshApiLaunch` as the models service's grid launch asks it (lib/gridLaunch.ts `answerGridLaunch`): the
+ * launch as saved now and the endpoint it read, or why the API cannot be used, in the words a relaunch always gave.
+ */
+export function refreshApiFor(store: ApiConnections) {
+ return (launch: GridLaunchOverride): { override: GridLaunchOverride; apiBase?: string } | { error: string; detail: string } => {
+ if (!isApiLaunch(launch)) return { override: launch }
+ try {
+ const override = refreshApiLaunch(store, launch)
+ return { override, apiBase: override.baseUrl }
+ } catch (error) {
+ return { error: 'API_UNAVAILABLE', detail: error instanceof ApiConnectionError ? error.message : `${launch.networkName} could not be read from saved APIs.` }
+ }
+ }
+}
+
+/** `resolveApiTarget` as the core asks it (`ModelsPort.apiTarget`): the launch and the endpoint it read, or the
+ * sentence a person reads, as the socket always answered it. */
+export async function apiTargetAnswer(store: ApiConnections, connectionId: string, model: string, deps: ApiModelDeps = {}): Promise<{ target: GridLaunchOverride; apiBase: string } | { detail: string }> {
try {
- for (const connection of store.list()) rememberApiBase(connection.baseUrl)
- } catch {
- // An unreadable store is reported where it is managed; recognising agents is best effort.
+ const target = await resolveApiTarget(store, connectionId, model, deps)
+ return { target, apiBase: target.baseUrl }
+ } catch (error) {
+ return { detail: error instanceof ApiConnectionError ? error.message : 'This API could not be used. Try again.' }
}
}
+export { rememberSavedApis } from './gridAssignment.js'
+
/** `api_connections {action: 'models', id}`: one API's chat models. No key in any reply. */
export async function apiModelsRequest(
store: ApiConnections,
diff --git a/cli/src/lib/createAgentPane.ts b/cli/src/lib/createAgentPane.ts
index 581205826..8877ad365 100644
--- a/cli/src/lib/createAgentPane.ts
+++ b/cli/src/lib/createAgentPane.ts
@@ -13,7 +13,7 @@
*/
import { homedir } from 'node:os'
import type { AgentEngine } from '../engines/types.js'
-import type { GridLaunchRecord } from './gridLaunch.js'
+import type { GridLaunchRecord } from './gridLaunchWire.js'
import type { ScmLaunchRecord } from '../scm/types.js'
import type { ForkOrigin, RegisteredSession } from './registry.js'
import type { TerminalBackend } from './terminalBackend.js'
diff --git a/cli/src/lib/gridAssignment.ts b/cli/src/lib/gridAssignment.ts
index f1374d3e8..27674f653 100644
--- a/cli/src/lib/gridAssignment.ts
+++ b/cli/src/lib/gridAssignment.ts
@@ -22,7 +22,8 @@ import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import type { AgentEngine } from '../engines/types.js'
import { enginesDeclaring } from '../engines/discoveries.js'
-import { anthropicBaseUrl, GRID_ROUTER_MODEL, relayBaseUrl } from './gridLaunch.js'
+import type { ApiConnections } from './apiConnections.js'
+import { anthropicBaseUrl, GRID_ROUTER_MODEL, relayBaseUrl } from './gridLaunchWire.js'
import { readProcessEnv } from './processEnv.js'
import type { ProcessIdentity } from './registry.js'
@@ -87,6 +88,15 @@ export function rememberApiBase(baseUrl: string): void {
for (const form of [relayBaseUrl(baseUrl), anthropicBaseUrl(baseUrl)]) apiBases.add(form)
}
+/** Every saved API's endpoint, so agents already running on one are recognised. */
+export function rememberSavedApis(store: Pick<ApiConnections, 'list'>): void {
+ try {
+ for (const connection of store.list()) rememberApiBase(connection.baseUrl)
+ } catch {
+ // An unreadable store is reported where it is managed; recognising agents is best effort.
+ }
+}
+
/**
* A base URL that is not a grid is not an assignment.
*
diff --git a/cli/src/lib/gridConfigDir.ts b/cli/src/lib/gridConfigDir.ts
index 62359d1d0..02c53e86a 100644
--- a/cli/src/lib/gridConfigDir.ts
+++ b/cli/src/lib/gridConfigDir.ts
@@ -15,7 +15,7 @@
import { lstat, mkdir, readdir, readlink, rm, stat, symlink, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { env } from '../config/env.js'
-import type { GridConfigFile, GridConfigLink } from './gridLaunch.js'
+import type { GridConfigFile, GridConfigLink } from './gridLaunchWire.js'
/** Everything this module owns lives under one root, so pruning can be confident about what it is. */
export function gridConfigRoot(): string {
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.ts
index 71c68f05d..bcb56745b 100644
--- a/cli/src/lib/gridLaunch.spec.ts
+++ b/cli/src/lib/gridLaunch.spec.ts
@@ -1,9 +1,13 @@
import { describe, expect, it, vi } from 'vitest'
import {
anthropicBaseUrl,
+ answerGridLaunch,
buildGridEngineLaunch,
+ contractEngines,
+ contractEnvVarNames,
describeGridLaunch,
gridCapableEngines,
+ GRID_CONFLICTING_ENV_VARS,
gridConflictingEnvToClear,
gridProviderId,
gridEnvVarNames,
@@ -328,10 +332,62 @@ describe('describeGridLaunch', () => {
})
})
+describe("answerGridLaunch: models' answer when the core asks for a launch", () => {
+ const machine: GridLaunchMachine = { hermesSystemManaged: false }
+ const API: GridLaunchOverride = { networkId: 'api:openrouter', networkName: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1', apiKey: 'old', model: 'q' }
+ const asSavedNow = vi.fn((override: GridLaunchOverride) => ({ override: { ...override, apiKey: 'new' }, apiBase: override.baseUrl }))
+
+ it('builds what it was sent on a create or a retarget check', () => {
+ expect(answerGridLaunch({ engine: 'claude', override: WITH_MODEL, machine }, asSavedNow)).toEqual({ ok: true, launch: launchOf('claude', WITH_MODEL), override: WITH_MODEL })
+ expect(asSavedNow).not.toHaveBeenCalled()
+ })
+
+ it('on a relaunch builds from the API as saved now, says the endpoint it read, and refuses one that cannot be read', () => {
+ const answer = answerGridLaunch({ engine: 'claude', override: API, machine, refresh: true }, asSavedNow)
+ expect(answer).toMatchObject({ ok: true, override: { ...API, apiKey: 'new' }, apiBase: API.baseUrl, launch: { env: { ANTHROPIC_AUTH_TOKEN: 'new' } } })
+ // The endpoint was read even when the engine then cannot go there: the core's assignment learns it either way.
+ expect(answerGridLaunch({ engine: 'amp', override: API, machine, refresh: true }, asSavedNow)).toMatchObject({ ok: false, error: 'GRID_ENGINE_UNSUPPORTED', apiBase: API.baseUrl })
+ expect(answerGridLaunch({ engine: 'claude', override: API, machine, refresh: true }, () => ({ error: 'API_UNAVAILABLE', detail: 'gone' })))
+ .toEqual({ ok: false, error: 'API_UNAVAILABLE', detail: 'gone' })
+ // A grid's launch is refreshed to itself, with no endpoint to learn.
+ const grid = answerGridLaunch({ engine: 'claude', override: WITH_MODEL, machine, refresh: true }, (override) => ({ override }))
+ expect(grid).toMatchObject({ ok: true, override: WITH_MODEL })
+ expect(grid).not.toHaveProperty('apiBase')
+ expect(answerGridLaunch({ engine: 'amp', override: WITH_MODEL, machine, refresh: true }, (override) => ({ override }))).not.toHaveProperty('apiBase')
+ })
+})
+
+describe('the lists the core declares for every launch (lib/gridLaunchWire.ts), held to the contracts', () => {
+ // The core reads them with no models service running — an agent leaving a grid has its variables cleared, a
+ // picker offers grid models to the engines that take them — so they are declared there, not built. A declared
+ // list drifts the first time an engine's contract gains a variable, and the symptom would be a "cleared" agent
+ // still running on the grid it was supposedly moved off: this is what keeps them equal.
+ it('names the engines the contracts can point at a grid, in their order', () => {
+ expect([...gridCapableEngines()]).toEqual(contractEngines())
+ })
+
+ it('names, for every engine, the variables its contract sets on the fullest launch it can get', () => {
+ for (const engine of ENGINES) expect(gridEnvVarNames(engine), engine).toEqual(contractEnvVarNames(engine))
+ })
+
+ it('clears every variable a contract points an engine with, and the inherited vendor key no contract sets', () => {
+ // Each exception with its reason: a contract that gains a variable fails here until it is placed.
+ const NOT_A_DESTINATION = {
+ // A window size the launch tells Claude Code, not where it sends anything.
+ CLAUDE_CODE_MAX_CONTEXT_TOKENS: 'a hint',
+ // Each engine's own config pointer, written by that engine's launch into the daemon's own folder.
+ OPENCODE_CONFIG: 'its own config file',
+ PI_CODING_AGENT_DIR: 'its own config folder',
+ }
+ // Set by no contract, and what outranks a grid when inherited (the module doc's first measurement).
+ const INHERITED_ONLY = ['ANTHROPIC_API_KEY']
+ const set = new Set(contractEngines().flatMap((engine) => contractEnvVarNames(engine)))
+ const expected = [...set].filter((name) => !Object.hasOwn(NOT_A_DESTINATION, name)).concat(INHERITED_ONLY)
+ expect([...GRID_CONFLICTING_ENV_VARS].sort()).toEqual(expected.sort())
+ })
+})
+
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', () => {
// GRID_API_KEY among them: the probe asks for a launch with web tools, and moving an agent to
// another grid has to take the old grid's MCP credential out of the pane with everything else.
diff --git a/cli/src/lib/gridLaunch.ts b/cli/src/lib/gridLaunch.ts
index 7c64749e4..ad9072a7f 100644
--- a/cli/src/lib/gridLaunch.ts
+++ b/cli/src/lib/gridLaunch.ts
@@ -46,6 +46,11 @@ import { homedir } from 'node:os'
import { join } from 'node:path'
import type { AgentEngine } from '../engines/types.js'
import { isOpencodeV2 } from '../engines/opencode/contract.js'
+import {
+ anthropicBaseUrl, API_NETWORK_PREFIX, GRID_KEY_VAR, GRID_ROUTER_MODEL, isApiLaunch, relayBaseUrl,
+ type GridEngineLaunch, type GridLaunchAnswer, type GridLaunchMachine, type GridLaunchOverride, type GridLaunchRequest,
+ type GridLaunchResult, type GridWebSearchStatus,
+} from './gridLaunchWire.js'
import {
CLAUDE_ALLOW_WEB_TOOLS_ARG,
CLAUDE_DISALLOW_WEB_TOOLS_ARG,
@@ -66,6 +71,8 @@ import {
} from './gridWebMcp.js'
import { HARNESS_MCP_SERVER_NAME } from './harnessWebTools.js'
+export * from './gridLaunchWire.js'
+
/** Where Pi keeps the skills the user manages, handed back through our own settings.json. */
function userPiSkillsDir(): string {
return join(homedir(), '.pi', 'agent', 'skills')
@@ -84,189 +91,6 @@ function userGrokHome(): string {
return join(homedir(), '.grok')
}
-/** What the desktop sends, once validated. Mirrors `GridAgentOverride` in the desktop app. */
-export interface GridLaunchOverride {
- networkId: string
- /** The grid's display name — for log lines and error text, never for routing. */
- networkName: string
- /**
- * The grid's OpenAI-compatible relay root, as the control plane reports it: `<grid>/relay/v1`.
- * Per-engine forms are derived from this; see [relayBaseUrl] and [anthropicBaseUrl].
- */
- baseUrl: string
- /** Short-lived, minted per launch. Never logged, never placed in argv; persisted only in the registry
- * row (see the module header), so a relaunch can repeat this launch. */
- apiKey: string
- /** Absent means "whatever the engine asks for" — the relay's own default. */
- model?: string
- /**
- * The grid's web-tools MCP endpoint, on the CONTROL PLANE — `…/v1/grid/web-mcp/`, trailing slash
- * included, because without it the mount answers 307 and not every client follows one.
- *
- * Deliberately not derived here from [baseUrl]. That is the RELAY, and grid ADR 0041 D-a takes the
- * relay out of this path on purpose: a relay is per-grid, can be asleep, and for a self-hosted grid
- * is a LAN address a harness may not reach. The control plane's address is also not ours to guess —
- * it is whichever one the user's Grid CLI is signed into, and this machine may have no Grid session
- * at all. The desktop knows; this does not.
- *
- * Absent means no web tools, which is exactly what an older desktop sends.
- */
- mcpUrl?: string
- /**
- * The model's context window in tokens, as the grid's relay reports it (`context_window` on its
- * `/models` row) — the size the engine serving it was actually started with.
- *
- * ⚠️ Every coding agent here assumes a window for a model it does not recognise, and a grid model
- * is never one it recognises: Claude Code assumes 200K, Codex and OpenCode know nothing at all. An
- * agent that does not know the real window never compacts before it — the server rejects the
- * request as too long first, and the session dies where it should have summarised. So each engine
- * is TOLD, in its own dialect ([contextWindowHint] and the contracts below).
- *
- * Absent means the relay did not say, and each engine keeps its own assumption, as before.
- */
- contextWindow?: number
-}
-
-/**
- * The `networkId` of a launch onto a saved API (`apiModels.ts`) rather than a grid: `api:<connection id>`.
- * The same contracts below run it — an OpenAI-compatible API such as OpenRouter is reached exactly the
- * way a grid's relay is — but nothing grid-specific (waking, the grid's picture) applies to it.
- */
-export const API_NETWORK_PREFIX = 'api:'
-
-export function isApiLaunch(launch: Pick<GridLaunchOverride, 'networkId'> | null | undefined): boolean {
- return !!launch?.networkId.startsWith(API_NETWORK_PREFIX)
-}
-
-/** The smallest window believed. Anything below it is not a model a coding agent can run on, and a
- * value that small is likelier a misreport than a real engine — better to say nothing than to have
- * an agent compact every turn. */
-const MIN_CONTEXT_WINDOW = 4096
-/** The largest believed: no engine serves more, and a bigger number is a unit error. */
-const MAX_CONTEXT_WINDOW = 16 * 1024 * 1024
-
-/** A context window worth handing an engine, or undefined. Lenient on purpose, unlike every other
- * field here: this is a hint, and a malformed one must cost only the hint — refusing the whole
- * override would strand a persisted launch that is otherwise fine. */
-export function contextWindowHint(value: unknown): number | undefined {
- return typeof value === 'number' && Number.isSafeInteger(value) && value >= MIN_CONTEXT_WINDOW && value <= MAX_CONTEXT_WINDOW
- ? value : undefined
-}
-
-export type GridOverrideParse =
- | { state: 'absent' }
- | { state: 'ok'; override: GridLaunchOverride }
- | { state: 'invalid'; reason: string }
-
-/**
- * Control characters have no place in a URL, a token or a model id, and every one of these values
- * ends up in a process environment or an argv. Rejecting them keeps a malformed frame from producing
- * an engine whose launch is subtly not what either side thinks it is.
- */
-const CONTROL_CHARS = /[\u0000-\u001F\u007F]/
-
-function requiredString(raw: Record<string, unknown>, key: string): string | null {
- const value = raw[key]
- if (typeof value !== 'string') return null
- const trimmed = value.trim()
- if (!trimmed || CONTROL_CHARS.test(trimmed)) return null
- return trimmed
-}
-
-/**
- * Why [value] is not an address an engine can be handed, or null when it is one.
- *
- * Anything else — a `file:` URL, a bare hostname, a path — would fail inside the engine with an
- * error naming neither the grid nor this frame. Shared by the two URL fields rather than written
- * twice, so they cannot drift into disagreeing about what an address is.
- */
-function urlProblem(field: string, value: string): string | null {
- let parsed: URL
- try {
- parsed = new URL(value)
- } catch {
- return `grid ${field} is not a URL`
- }
- if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
- return `grid ${field} must be http(s), got ${parsed.protocol}`
- }
- return null
-}
-
-/**
- * `payload.grid` as a validated override, or the reason it is not one.
- *
- * Absent is a first-class answer, not a failure: a build with no grid selected sends no `grid` field
- * at all, and must create agents exactly the way it always did.
- */
-export function parseGridLaunchOverride(raw: unknown): GridOverrideParse {
- if (raw === undefined || raw === null) return { state: 'absent' }
- if (typeof raw !== 'object' || Array.isArray(raw)) return { state: 'invalid', reason: 'grid must be an object' }
- const source = raw as Record<string, unknown>
- const networkId = requiredString(source, 'networkId')
- const networkName = requiredString(source, 'networkName')
- const baseUrl = requiredString(source, 'baseUrl')
- const apiKey = requiredString(source, 'apiKey')
- const missing = [
- networkId ? null : 'networkId',
- networkName ? null : 'networkName',
- baseUrl ? null : 'baseUrl',
- apiKey ? null : 'apiKey',
- ].filter((name): name is string => name !== null)
- if (missing.length) return { state: 'invalid', reason: `grid is missing ${missing.join(', ')}` }
- const badBaseUrl = urlProblem('baseUrl', baseUrl as string)
- if (badBaseUrl) return { state: 'invalid', reason: badBaseUrl }
- const hasModel = source.model !== undefined && source.model !== null
- const model = hasModel ? requiredString(source, 'model') : undefined
- if (hasModel && !model) return { state: 'invalid', reason: 'grid model must be a non-empty string' }
- const hasMcpUrl = source.mcpUrl !== undefined && source.mcpUrl !== null
- const mcpUrl = hasMcpUrl ? requiredString(source, 'mcpUrl') : undefined
- if (hasMcpUrl && !mcpUrl) return { state: 'invalid', reason: 'grid mcpUrl must be a non-empty string' }
- const badMcpUrl = mcpUrl ? urlProblem('mcpUrl', mcpUrl) : null
- if (badMcpUrl) return { state: 'invalid', reason: badMcpUrl }
- const contextWindow = contextWindowHint(source.contextWindow)
- return {
- state: 'ok',
- override: {
- networkId: networkId as string,
- networkName: networkName as string,
- baseUrl: baseUrl as string,
- apiKey: apiKey as string,
- ...(model ? { model } : {}),
- ...(mcpUrl ? { mcpUrl } : {}),
- ...(contextWindow ? { contextWindow } : {}),
- },
- }
-}
-
-/** The OpenAI-compatible relay root — what every engine here wants except Claude Code. */
-export function relayBaseUrl(baseUrl: string): string {
- const trimmed = baseUrl.replace(/\/+$/, '')
- return trimmed.endsWith('/v1') ? trimmed : `${trimmed}/v1`
-}
-
-/**
- * The relay root Claude Code wants.
- *
- * The app appends `/v1/messages` itself, so the `/v1` an OpenAI SDK needs would 404 every request
- * here — the same one-character difference that makes `grid launch claude --print-env` a separate
- * command from `grid info --env` in the grid CLI. Idempotent: a base that already lacks `/v1` comes
- * back unchanged.
- */
-export function anthropicBaseUrl(baseUrl: string): string {
- const trimmed = baseUrl.replace(/\/+$/, '')
- return trimmed.endsWith('/v1') ? trimmed.slice(0, -'/v1'.length) : trimmed
-}
-
-/**
- * The relay's routing strategy, used when the user picked no particular model.
- *
- * Not a model: send a request naming it and the grid chooses one. It is `owned_by: grid-router` in
- * the relay's `/models`, and the relay answers it like any other id — which is what lets a provider
- * block that must name SOMETHING name this.
- */
-export const GRID_ROUTER_MODEL = 'Auto'
-
/** The file OpenCode's `OPENCODE_CONFIG` is pointed at. */
const OPENCODE_CONFIG_FILE = 'opencode.json'
@@ -393,122 +217,6 @@ function opencodeGridConfig(
}, null, 2)}\n`
}
-/**
- * One directory the per-agent config directory borrows from elsewhere, as a symlink.
- *
- * For an engine whose variable redirects its WHOLE home rather than just its provider config: the
- * private directory has to hand back the parts the daemon still reads. Grok is the only such engine
- * — see `GROK_GRID_HOME_LINKS` in `gridWebMcp.ts`.
- */
-export interface GridConfigLink {
- /** Name inside the per-agent directory. Never a path. */
- name: string
- /** Absolute path the link points at — the user's real directory. */
- target: string
-}
-
-/** One file to write into the per-agent config directory a launch is given. */
-export interface GridConfigFile {
- /** File name inside the directory. Never a path — this writes one flat directory. */
- name: string
- content: string
-}
-
-/**
- * Whether the agent this launch produces can search the web, in the words the app shows.
- *
- * * `on` — the MCP url was present and the engine's contract wired the server in.
- * * `unavailable` — no url reached the launch: the grid could not be asked for one (an outdated or
- * missing `grid` CLI, no sign-in, an unknown grid — `gridMcpUrl.ts` logs which). Inference still
- * goes to the grid; asking again later can fix it.
- * * `unsupported` — the engine cannot take the server on this machine at all: Pi has no MCP client,
- * and Hermes on a machine whose settings are pinned in [HERMES_SYSTEM_MANAGED_DIR] cannot be handed
- * the overlay without replacing them. Nothing about the grid changes this.
- *
- * Decided HERE, by the same code that decides whether the server is wired, so the two cannot
- * disagree — and stored with the launch rather than re-derived, so a reconnect or a restart reports
- * what the launch actually did. The app reads it as `grid.webSearch` on every agent frame.
- */
-export type GridWebSearchStatus = 'on' | 'unavailable' | 'unsupported'
-
-/**
- * A grid launch as the registry keeps it: the override to repeat it with, and what building it
- * decided about web search. One object so the two are written and cleared together — a status
- * without its launch, or a launch without its status, is a row the app would read wrongly.
- */
-export interface GridLaunchRecord {
- override: GridLaunchOverride
- webSearch: GridWebSearchStatus
-}
-
-/**
- * Facts about THIS machine a contract cannot read for itself.
- *
- * A contract is pure — the module comment on [userGrokHome] says why: one that stats the filesystem
- * answers differently on two machines, and its spec would follow. So the caller reads the machine
- * and hands the answer in, and the contract decides from it. What it decides stays here, where every
- * caller (create, retarget, restore) gets the same answer from the same code.
- */
-export interface GridLaunchMachine {
- /**
- * Whether an administrator pinned Hermes settings in [HERMES_SYSTEM_MANAGED_DIR]. Hermes's web
- * tools ride a managed-scope overlay that REPLACES that directory rather than adding to it, so on
- * such a machine the overlay is dropped and the agent launches without web tools.
- */
- hermesSystemManaged: boolean
- /**
- * The installed OpenCode's major version (`engines/opencode/version.ts`); absent or null reads as
- * v1. v2's TUI rejects `-m`, and only a private server (`--standalone`) reads `OPENCODE_CONFIG`.
- */
- opencodeMajor?: number | null
-}
-
-/** How one engine is launched against a grid. */
-export interface GridEngineLaunch {
- /** Layered over the engine's inherited environment. This is where the key goes, always. */
- env: Record<string, string>
- /** Appended to the engine's argv. Never carries the key — `ps` is world-readable. */
- args: string[]
- /** What this launch gives the agent by way of web search. See [GridWebSearchStatus]. */
- webSearch: GridWebSearchStatus
- /**
- * The `provider/model` a RESUMED session has to be put on before the relaunch, for an engine whose
- * resume restores the session's own stored model whatever argv says. OpenCode only; the caller
- * applies it (`applyOpencodeSessionModel`).
- */
- sessionModel?: string
- /**
- * For an engine that reads its provider out of a config directory rather than an environment
- * variable: files the daemon writes into a directory IT owns, and the variable that points the
- * engine at that directory.
- *
- * This is not "editing the user's dotfiles" — the point of the indirection is that it never
- * touches them. The engine gets a private configuration for this agent, the user's own stays
- * exactly as they left it, and deleting the directory undoes everything. No file written here may
- * contain the key; Pi's provider block references an environment variable instead.
- */
- configDir?: {
- envVar: string
- files: GridConfigFile[]
- /**
- * Point [envVar] at ONE of the written files rather than at the directory holding them.
- *
- * Pi wants the directory (`PI_CODING_AGENT_DIR`); OpenCode's `OPENCODE_CONFIG` wants a config
- * file. Same mechanism — a private directory this daemon owns — differing only in what the
- * engine is handed, so it is a field rather than a second writer.
- */
- pointAt?: string
- /**
- * Directories the private one borrows back from the engine's real home.
- *
- * Only for a variable that redirects a whole home: `GROK_HOME` takes `sessions/` with it, and the
- * daemon reads transcripts from the real one. Empty for every engine whose variable names only a
- * provider config, which is the usual case.
- */
- links?: GridConfigLink[]
- }
-}
-
interface GridEngineContract {
build: (override: GridLaunchOverride, machine: GridLaunchMachine) => GridEngineLaunch
/** The engine cannot start against a grid without being told which model to ask for. */
@@ -521,7 +229,6 @@ interface GridEngineContract {
* Codex names it in `env_key`; Pi's `models.json` writes it as a `$VAR` reference. Both exist so the
* credential can stay in the environment while the configuration that points at it is not secret.
*/
-const GRID_KEY_VAR = 'GRID_API_KEY'
/** The provider id our generated config declares. Pi selects it as `--model <id>/<model>`. */
const GRID_PROVIDER_ID = 'grid'
@@ -533,66 +240,6 @@ const GRID_PROVIDER_ID = 'grid'
const webSearchWhenWired = (override: GridLaunchOverride): GridWebSearchStatus =>
override.mcpUrl ? 'on' : 'unavailable'
-/**
- * Every variable any contract in this file uses to point an engine somewhere.
- *
- * A grid launch has to CLEAR the ones it does not itself set, because setting the right variable is
- * not enough to decide where an engine goes: an engine picks a provider from whatever credentials it
- * can see, and a stray one wins on its own terms. Measured, twice, on one machine:
- *
- * * OpenCode, handed `OPENAI_BASE_URL` for a grid, found an inherited `ANTHROPIC_API_KEY` and chose
- * Claude Sonnet at api.anthropic.com — reporting `invalid x-api-key`, a sentence that names
- * neither the grid nor the variable that redirected it.
- * * Claude Code, on the same machine, had its `ANTHROPIC_BASE_URL` deleted by a line in `.zshrc` and
- * fell back to the same key, with the same unreadable result.
- *
- * The inherited value arrives from further away than a user can reasonably audit. On that machine it
- * came from `.zshrc`, and then — after that was fixed — from a VS Code setting
- * (`claudeCode.environmentVariables`) that seeded the terminal the desktop app was launched from,
- * whose environment the app passed to the daemon, which passed it to the tmux server, which gave it
- * to every pane. Four layers, none visible from the failure.
- *
- * So the launch is the place to settle it: it is the only point that knows the user asked for a grid.
- * Unset here is scoped to the engine's own process and touches nothing on disk — a plain terminal on
- * the same machine keeps every variable it had.
- *
- * The list is deliberately OUR OWN vars rather than a survey of every provider an engine supports.
- * Enumerating those is unbounded and would go stale silently; these are the ones this file uses, so
- * this file can be right about them.
- */
-export const GRID_CONFLICTING_ENV_VARS: readonly string[] = [
- 'ANTHROPIC_API_KEY',
- 'ANTHROPIC_AUTH_TOKEN',
- 'ANTHROPIC_BASE_URL',
- 'ANTHROPIC_MODEL',
- 'OPENAI_API_KEY',
- 'OPENAI_BASE_URL',
- 'XAI_API_KEY',
- 'GROK_MODELS_BASE_URL',
- 'COPILOT_PROVIDER_API_KEY',
- 'COPILOT_PROVIDER_BASE_URL',
- 'COPILOT_MODEL',
- 'HERMES_INFERENCE_MODEL',
- GRID_KEY_VAR,
- GRID_MCP_AUTH_VAR,
- HERMES_MANAGED_DIR_VAR,
- GROK_HOME_VAR,
-]
-
-/**
- * The variables this launch must clear: everything in [GRID_CONFLICTING_ENV_VARS] the launch does not
- * itself set.
- *
- * Set-then-unset would be a bug, so the two sets are computed from one another rather than listed
- * twice — a contract that gains a variable stops clearing it in the same edit.
- */
-export function gridConflictingEnvToClear(launch: Pick<GridEngineLaunch, 'env' | 'configDir'>): string[] {
- const provided = new Set(Object.keys(launch.env))
- if (launch.configDir) provided.add(launch.configDir.envVar)
- return GRID_CONFLICTING_ENV_VARS.filter((name) => !provided.has(name))
-}
-
-
/**
* Pi's provider block, as the Grid app shipped and unit-tested it
* (`autonomous-grid-app`, `pi_grid_config.dart` at 36d00c95, before Pi was dropped from that app for
@@ -1012,15 +659,12 @@ const GRID_ENGINE_REFUSALS: Partial<Record<AgentEngine, string>> = {
terminal: 'a terminal runs no engine to point at a grid — start one inside it and it will use its own login',
}
-/** Engines that can be pointed at a grid today, for error text that names what to pick instead. */
-export function gridCapableEngines(): AgentEngine[] {
+/** Engines that can be pointed at a grid today, for error text that names what to pick instead: the contracts'
+ * own list, which the core's declared one (lib/gridLaunchWire.ts `GRID_CAPABLE_ENGINES`) is held equal to. */
+export function contractEngines(): AgentEngine[] {
return Object.keys(GRID_ENGINE_CONTRACTS) as AgentEngine[]
}
-export type GridLaunchResult =
- | { ok: true; launch: GridEngineLaunch }
- | { ok: false; error: string; detail: string }
-
/**
* How `engine` must be launched to reach `override` on a machine like `machine`, or why it cannot be.
*
@@ -1040,7 +684,7 @@ export function buildGridEngineLaunch(
ok: false,
error: 'GRID_ENGINE_UNSUPPORTED',
detail: `${engine} cannot run on grid ${override.networkName}: ${reason}. `
- + `It would have run on its own login instead. Engines that can: ${gridCapableEngines().join(', ')}.`,
+ + `It would have run on its own login instead. Engines that can: ${contractEngines().join(', ')}.`,
}
}
if (contract.requiresModel && !override.model) {
@@ -1054,35 +698,6 @@ export function buildGridEngineLaunch(
return { ok: true, launch: contract.build(override, machine) }
}
-/**
- * Why a launch has no web search, in the daemon log's words — for the two answers this module
- * decides itself. `unavailable` is decided elsewhere (`gridMcpUrl.ts`), which logs its own reason
- * the moment it gives up, so nothing is repeated here.
- */
-function webSearchReason(engine: AgentEngine, webSearch: GridWebSearchStatus): string | null {
- if (webSearch !== 'unsupported') return null
- if (engine === 'pi') return 'Pi has no MCP client'
- if (engine === 'hermes') {
- return `${HERMES_SYSTEM_MANAGED_DIR} pins this machine's Hermes settings, and the overlay carrying `
- + 'the web tools would replace it'
- }
- return null
-}
-
-/** One log line naming where an agent was sent — grid, model, engine, and whether it got web
- * search (with the reason when this module is the one that took it away). Never the key, never
- * the MCP url. */
-export function describeGridLaunch(
- engine: AgentEngine,
- override: GridLaunchOverride,
- webSearch: GridWebSearchStatus,
-): string {
- const reason = webSearchReason(engine, webSearch)
- return `[grid] ${engine} -> ${override.networkName} (${override.networkId})`
- + ` · ${override.model ?? 'model chosen by the engine'} · web search ${webSearch}`
- + (reason ? ` (${reason})` : '')
-}
-
/** A placeholder override, used only to ask a contract which variables it sets. Never launched. */
const PROBE_OVERRIDE: GridLaunchOverride = {
networkId: 'probe',
@@ -1109,7 +724,7 @@ const PROBE_OVERRIDE: GridLaunchOverride = {
*
* Empty for an engine that has no contract — there is nothing to clear because nothing was set.
*/
-export function gridEnvVarNames(engine: AgentEngine): string[] {
+export function contractEnvVarNames(engine: AgentEngine): string[] {
// No pin, for the same reason the probe carries an MCP url: this asks which variables a launch
// WITH web tools sets, so that clearing them covers the fullest launch this engine can get.
const built = buildGridEngineLaunch(engine, PROBE_OVERRIDE, { hermesSystemManaged: false })
@@ -1118,3 +733,27 @@ export function gridEnvVarNames(engine: AgentEngine): string[] {
if (built.launch.configDir) names.push(built.launch.configDir.envVar)
return names
}
+
+/**
+ * The models service's answer to the core (`ModelsPort.gridLaunch`): the launch `request.engine` takes to reach
+ * `request.override` and the override it was built from. `refresh` repeats a saved API's launch with its endpoint
+ * and key as saved now (`refreshApi`, lib/apiModels.ts), and a removed or unusable API is refused before anything
+ * is built, as a relaunch always refused it.
+ */
+export function answerGridLaunch(
+ request: GridLaunchRequest,
+ refreshApi: (override: GridLaunchOverride) => { override: GridLaunchOverride; apiBase?: string } | { error: string; detail: string },
+): GridLaunchAnswer {
+ let override = request.override
+ let apiBase: string | undefined
+ if (request.refresh) {
+ const refreshed = refreshApi(override)
+ if ('error' in refreshed) return { ok: false, error: refreshed.error, detail: refreshed.detail }
+ override = refreshed.override
+ apiBase = refreshed.apiBase
+ }
+ const built = buildGridEngineLaunch(request.engine, override, request.machine)
+ const base = apiBase ? { apiBase } : {}
+ if (!built.ok) return { ...built, ...base }
+ return { ok: true, launch: built.launch, override, ...base }
+}
diff --git a/cli/src/lib/gridLaunchWire.ts b/cli/src/lib/gridLaunchWire.ts
new file mode 100644
index 000000000..ab7e1d5ec
--- /dev/null
+++ b/cli/src/lib/gridLaunchWire.ts
@@ -0,0 +1,476 @@
+/**
+ * A grid launch as the core holds it: what the desktop sends and the registry keeps (`GridLaunchOverride`),
+ * checked before anything is built from it; what a built launch hands the pane (`GridEngineLaunch`); and the data
+ * every launch reads without asking anyone. That data is the vendor variables a grid launch clears, the variables
+ * each engine's grid launch sets (cleared when an agent leaves a grid), and the engines a grid can run.
+ *
+ * Building a launch is the models service's (lib/gridLaunch.ts, `ModelsPort.gridLaunch`,
+ * docs/design/2026-10-08-launch-port.md): the per-engine contracts and their web-tools wiring never load in the
+ * core. The declared lists here are held equal to what those contracts produce (lib/gridLaunch.spec.ts).
+ */
+import type { AgentEngine } from '../engines/types.js'
+
+/** The variable an engine is told to read the key from, where the engine supports that indirection. Codex names it
+ * in `env_key`; Pi's `models.json` writes it as a `$VAR` reference. */
+export const GRID_KEY_VAR = 'GRID_API_KEY'
+/** The variable the web tools' MCP authorization header rides in (lib/gridWebMcp.ts). */
+export const GRID_MCP_AUTH_VAR = 'GRID_MCP_AUTHORIZATION'
+/** Where Hermes is pointed at the managed scope that carries its web tools (lib/gridWebMcp.ts). */
+export const HERMES_MANAGED_DIR_VAR = 'HERMES_MANAGED_DIR'
+/** Where an administrator pins Hermes's settings: a machine with it gets no overlay (`GridLaunchMachine`). */
+export const HERMES_SYSTEM_MANAGED_DIR = '/etc/hermes'
+/** Grok's whole state directory, which a grid launch redirects (lib/gridWebMcp.ts). */
+export const GROK_HOME_VAR = 'GROK_HOME'
+
+/** What the desktop sends, once validated. Mirrors `GridAgentOverride` in the desktop app. */
+export interface GridLaunchOverride {
+ networkId: string
+ /** The grid's display name — for log lines and error text, never for routing. */
+ networkName: string
+ /**
+ * The grid's OpenAI-compatible relay root, as the control plane reports it: `<grid>/relay/v1`.
+ * Per-engine forms are derived from this; see [relayBaseUrl] and [anthropicBaseUrl].
+ */
+ baseUrl: string
+ /** Short-lived, minted per launch. Never logged, never placed in argv; persisted only in the registry
+ * row (see the module header), so a relaunch can repeat this launch. */
+ apiKey: string
+ /** Absent means "whatever the engine asks for" — the relay's own default. */
+ model?: string
+ /**
+ * The grid's web-tools MCP endpoint, on the CONTROL PLANE — `…/v1/grid/web-mcp/`, trailing slash
+ * included, because without it the mount answers 307 and not every client follows one.
+ *
+ * Deliberately not derived here from [baseUrl]. That is the RELAY, and grid ADR 0041 D-a takes the
+ * relay out of this path on purpose: a relay is per-grid, can be asleep, and for a self-hosted grid
+ * is a LAN address a harness may not reach. The control plane's address is also not ours to guess —
+ * it is whichever one the user's Grid CLI is signed into, and this machine may have no Grid session
+ * at all. The desktop knows; this does not.
+ *
+ * Absent means no web tools, which is exactly what an older desktop sends.
+ */
+ mcpUrl?: string
+ /**
+ * The model's context window in tokens, as the grid's relay reports it (`context_window` on its
+ * `/models` row) — the size the engine serving it was actually started with.
+ *
+ * ⚠️ Every coding agent here assumes a window for a model it does not recognise, and a grid model
+ * is never one it recognises: Claude Code assumes 200K, Codex and OpenCode know nothing at all. An
+ * agent that does not know the real window never compacts before it — the server rejects the
+ * request as too long first, and the session dies where it should have summarised. So each engine
+ * is TOLD, in its own dialect ([contextWindowHint] and the contracts below).
+ *
+ * Absent means the relay did not say, and each engine keeps its own assumption, as before.
+ */
+ contextWindow?: number
+}
+
+/**
+ * The `networkId` of a launch onto a saved API (`apiModels.ts`) rather than a grid: `api:<connection id>`.
+ * The same contracts below run it — an OpenAI-compatible API such as OpenRouter is reached exactly the
+ * way a grid's relay is — but nothing grid-specific (waking, the grid's picture) applies to it.
+ */
+export const API_NETWORK_PREFIX = 'api:'
+
+export function isApiLaunch(launch: Pick<GridLaunchOverride, 'networkId'> | null | undefined): boolean {
+ return !!launch?.networkId.startsWith(API_NETWORK_PREFIX)
+}
+
+/** The smallest window believed. Anything below it is not a model a coding agent can run on, and a
+ * value that small is likelier a misreport than a real engine — better to say nothing than to have
+ * an agent compact every turn. */
+const MIN_CONTEXT_WINDOW = 4096
+/** The largest believed: no engine serves more, and a bigger number is a unit error. */
+const MAX_CONTEXT_WINDOW = 16 * 1024 * 1024
+
+/** A context window worth handing an engine, or undefined. Lenient on purpose, unlike every other
+ * field here: this is a hint, and a malformed one must cost only the hint — refusing the whole
+ * override would strand a persisted launch that is otherwise fine. */
+export function contextWindowHint(value: unknown): number | undefined {
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= MIN_CONTEXT_WINDOW && value <= MAX_CONTEXT_WINDOW
+ ? value : undefined
+}
+
+export type GridOverrideParse =
+ | { state: 'absent' }
+ | { state: 'ok'; override: GridLaunchOverride }
+ | { state: 'invalid'; reason: string }
+
+/**
+ * Control characters have no place in a URL, a token or a model id, and every one of these values
+ * ends up in a process environment or an argv. Rejecting them keeps a malformed frame from producing
+ * an engine whose launch is subtly not what either side thinks it is.
+ */
+const CONTROL_CHARS = /[\u0000-\u001F\u007F]/
+
+function requiredString(raw: Record<string, unknown>, key: string): string | null {
+ const value = raw[key]
+ if (typeof value !== 'string') return null
+ const trimmed = value.trim()
+ if (!trimmed || CONTROL_CHARS.test(trimmed)) return null
+ return trimmed
+}
+
+/**
+ * Why [value] is not an address an engine can be handed, or null when it is one.
+ *
+ * Anything else — a `file:` URL, a bare hostname, a path — would fail inside the engine with an
+ * error naming neither the grid nor this frame. Shared by the two URL fields rather than written
+ * twice, so they cannot drift into disagreeing about what an address is.
+ */
+function urlProblem(field: string, value: string): string | null {
+ let parsed: URL
+ try {
+ parsed = new URL(value)
+ } catch {
+ return `grid ${field} is not a URL`
+ }
+ if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
+ return `grid ${field} must be http(s), got ${parsed.protocol}`
+ }
+ return null
+}
+
+/**
+ * `payload.grid` as a validated override, or the reason it is not one.
+ *
+ * Absent is a first-class answer, not a failure: a build with no grid selected sends no `grid` field
+ * at all, and must create agents exactly the way it always did.
+ */
+export function parseGridLaunchOverride(raw: unknown): GridOverrideParse {
+ if (raw === undefined || raw === null) return { state: 'absent' }
+ if (typeof raw !== 'object' || Array.isArray(raw)) return { state: 'invalid', reason: 'grid must be an object' }
+ const source = raw as Record<string, unknown>
+ const networkId = requiredString(source, 'networkId')
+ const networkName = requiredString(source, 'networkName')
+ const baseUrl = requiredString(source, 'baseUrl')
+ const apiKey = requiredString(source, 'apiKey')
+ const missing = [
+ networkId ? null : 'networkId',
+ networkName ? null : 'networkName',
+ baseUrl ? null : 'baseUrl',
+ apiKey ? null : 'apiKey',
+ ].filter((name): name is string => name !== null)
+ if (missing.length) return { state: 'invalid', reason: `grid is missing ${missing.join(', ')}` }
+ const badBaseUrl = urlProblem('baseUrl', baseUrl as string)
+ if (badBaseUrl) return { state: 'invalid', reason: badBaseUrl }
+ const hasModel = source.model !== undefined && source.model !== null
+ const model = hasModel ? requiredString(source, 'model') : undefined
+ if (hasModel && !model) return { state: 'invalid', reason: 'grid model must be a non-empty string' }
+ const hasMcpUrl = source.mcpUrl !== undefined && source.mcpUrl !== null
+ const mcpUrl = hasMcpUrl ? requiredString(source, 'mcpUrl') : undefined
+ if (hasMcpUrl && !mcpUrl) return { state: 'invalid', reason: 'grid mcpUrl must be a non-empty string' }
+ const badMcpUrl = mcpUrl ? urlProblem('mcpUrl', mcpUrl) : null
+ if (badMcpUrl) return { state: 'invalid', reason: badMcpUrl }
+ const contextWindow = contextWindowHint(source.contextWindow)
+ return {
+ state: 'ok',
+ override: {
+ networkId: networkId as string,
+ networkName: networkName as string,
+ baseUrl: baseUrl as string,
+ apiKey: apiKey as string,
+ ...(model ? { model } : {}),
+ ...(mcpUrl ? { mcpUrl } : {}),
+ ...(contextWindow ? { contextWindow } : {}),
+ },
+ }
+}
+
+/** The OpenAI-compatible relay root — what every engine here wants except Claude Code. */
+export function relayBaseUrl(baseUrl: string): string {
+ const trimmed = baseUrl.replace(/\/+$/, '')
+ return trimmed.endsWith('/v1') ? trimmed : `${trimmed}/v1`
+}
+
+/**
+ * The relay root Claude Code wants.
+ *
+ * The app appends `/v1/messages` itself, so the `/v1` an OpenAI SDK needs would 404 every request
+ * here — the same one-character difference that makes `grid launch claude --print-env` a separate
+ * command from `grid info --env` in the grid CLI. Idempotent: a base that already lacks `/v1` comes
+ * back unchanged.
+ */
+export function anthropicBaseUrl(baseUrl: string): string {
+ const trimmed = baseUrl.replace(/\/+$/, '')
+ return trimmed.endsWith('/v1') ? trimmed.slice(0, -'/v1'.length) : trimmed
+}
+
+/**
+ * The relay's routing strategy, used when the user picked no particular model.
+ *
+ * Not a model: send a request naming it and the grid chooses one. It is `owned_by: grid-router` in
+ * the relay's `/models`, and the relay answers it like any other id — which is what lets a provider
+ * block that must name SOMETHING name this.
+ */
+export const GRID_ROUTER_MODEL = 'Auto'
+
+/**
+ * One directory the per-agent config directory borrows from elsewhere, as a symlink.
+ *
+ * For an engine whose variable redirects its WHOLE home rather than just its provider config: the
+ * private directory has to hand back the parts the daemon still reads. Grok is the only such engine
+ * — see `GROK_GRID_HOME_LINKS` in `gridWebMcp.ts`.
+ */
+export interface GridConfigLink {
+ /** Name inside the per-agent directory. Never a path. */
+ name: string
+ /** Absolute path the link points at — the user's real directory. */
+ target: string
+}
+
+/** One file to write into the per-agent config directory a launch is given. */
+export interface GridConfigFile {
+ /** File name inside the directory. Never a path — this writes one flat directory. */
+ name: string
+ content: string
+}
+
+/**
+ * Whether the agent this launch produces can search the web, in the words the app shows.
+ *
+ * * `on` — the MCP url was present and the engine's contract wired the server in.
+ * * `unavailable` — no url reached the launch: the grid could not be asked for one (an outdated or
+ * missing `grid` CLI, no sign-in, an unknown grid — `gridMcpUrl.ts` logs which). Inference still
+ * goes to the grid; asking again later can fix it.
+ * * `unsupported` — the engine cannot take the server on this machine at all: Pi has no MCP client,
+ * and Hermes on a machine whose settings are pinned in [HERMES_SYSTEM_MANAGED_DIR] cannot be handed
+ * the overlay without replacing them. Nothing about the grid changes this.
+ *
+ * Decided HERE, by the same code that decides whether the server is wired, so the two cannot
+ * disagree — and stored with the launch rather than re-derived, so a reconnect or a restart reports
+ * what the launch actually did. The app reads it as `grid.webSearch` on every agent frame.
+ */
+export type GridWebSearchStatus = 'on' | 'unavailable' | 'unsupported'
+
+/**
+ * A grid launch as the registry keeps it: the override to repeat it with, and what building it
+ * decided about web search. One object so the two are written and cleared together — a status
+ * without its launch, or a launch without its status, is a row the app would read wrongly.
+ */
+export interface GridLaunchRecord {
+ override: GridLaunchOverride
+ webSearch: GridWebSearchStatus
+}
+
+/**
+ * Facts about THIS machine a contract cannot read for itself.
+ *
+ * A contract is pure — the module comment on [userGrokHome] says why: one that stats the filesystem
+ * answers differently on two machines, and its spec would follow. So the caller reads the machine
+ * and hands the answer in, and the contract decides from it. What it decides stays here, where every
+ * caller (create, retarget, restore) gets the same answer from the same code.
+ */
+export interface GridLaunchMachine {
+ /**
+ * Whether an administrator pinned Hermes settings in [HERMES_SYSTEM_MANAGED_DIR]. Hermes's web
+ * tools ride a managed-scope overlay that REPLACES that directory rather than adding to it, so on
+ * such a machine the overlay is dropped and the agent launches without web tools.
+ */
+ hermesSystemManaged: boolean
+ /**
+ * The installed OpenCode's major version (`engines/opencode/version.ts`); absent or null reads as
+ * v1. v2's TUI rejects `-m`, and only a private server (`--standalone`) reads `OPENCODE_CONFIG`.
+ */
+ opencodeMajor?: number | null
+}
+
+/** How one engine is launched against a grid. */
+export interface GridEngineLaunch {
+ /** Layered over the engine's inherited environment. This is where the key goes, always. */
+ env: Record<string, string>
+ /** Appended to the engine's argv. Never carries the key — `ps` is world-readable. */
+ args: string[]
+ /** What this launch gives the agent by way of web search. See [GridWebSearchStatus]. */
+ webSearch: GridWebSearchStatus
+ /**
+ * The `provider/model` a RESUMED session has to be put on before the relaunch, for an engine whose
+ * resume restores the session's own stored model whatever argv says. OpenCode only; the caller
+ * applies it (`applyOpencodeSessionModel`).
+ */
+ sessionModel?: string
+ /**
+ * For an engine that reads its provider out of a config directory rather than an environment
+ * variable: files the daemon writes into a directory IT owns, and the variable that points the
+ * engine at that directory.
+ *
+ * This is not "editing the user's dotfiles" — the point of the indirection is that it never
+ * touches them. The engine gets a private configuration for this agent, the user's own stays
+ * exactly as they left it, and deleting the directory undoes everything. No file written here may
+ * contain the key; Pi's provider block references an environment variable instead.
+ */
+ configDir?: {
+ envVar: string
+ files: GridConfigFile[]
+ /**
+ * Point [envVar] at ONE of the written files rather than at the directory holding them.
+ *
+ * Pi wants the directory (`PI_CODING_AGENT_DIR`); OpenCode's `OPENCODE_CONFIG` wants a config
+ * file. Same mechanism — a private directory this daemon owns — differing only in what the
+ * engine is handed, so it is a field rather than a second writer.
+ */
+ pointAt?: string
+ /**
+ * Directories the private one borrows back from the engine's real home.
+ *
+ * Only for a variable that redirects a whole home: `GROK_HOME` takes `sessions/` with it, and the
+ * daemon reads transcripts from the real one. Empty for every engine whose variable names only a
+ * provider config, which is the usual case.
+ */
+ links?: GridConfigLink[]
+ }
+}
+
+/**
+ * Every variable any grid launch contract (lib/gridLaunch.ts) uses to point an engine somewhere.
+ *
+ * A grid launch has to CLEAR the ones it does not itself set, because setting the right variable is
+ * not enough to decide where an engine goes: an engine picks a provider from whatever credentials it
+ * can see, and a stray one wins on its own terms. Measured, twice, on one machine:
+ *
+ * * OpenCode, handed `OPENAI_BASE_URL` for a grid, found an inherited `ANTHROPIC_API_KEY` and chose
+ * Claude Sonnet at api.anthropic.com — reporting `invalid x-api-key`, a sentence that names
+ * neither the grid nor the variable that redirected it.
+ * * Claude Code, on the same machine, had its `ANTHROPIC_BASE_URL` deleted by a line in `.zshrc` and
+ * fell back to the same key, with the same unreadable result.
+ *
+ * The inherited value arrives from further away than a user can reasonably audit. On that machine it
+ * came from `.zshrc`, and then — after that was fixed — from a VS Code setting
+ * (`claudeCode.environmentVariables`) that seeded the terminal the desktop app was launched from,
+ * whose environment the app passed to the daemon, which passed it to the tmux server, which gave it
+ * to every pane. Four layers, none visible from the failure.
+ *
+ * So the launch is the place to settle it: it is the only point that knows the user asked for a grid.
+ * Unset here is scoped to the engine's own process and touches nothing on disk — a plain terminal on
+ * the same machine keeps every variable it had.
+ *
+ * The list is deliberately OUR OWN vars rather than a survey of every provider an engine supports.
+ * Enumerating those is unbounded and would go stale silently; these are the ones the contracts use, so
+ * this list can be right about them: lib/gridLaunch.spec.ts holds it to what the contracts set, each exception
+ * named.
+ */
+export const GRID_CONFLICTING_ENV_VARS: readonly string[] = [
+ 'ANTHROPIC_API_KEY',
+ 'ANTHROPIC_AUTH_TOKEN',
+ 'ANTHROPIC_BASE_URL',
+ 'ANTHROPIC_MODEL',
+ 'OPENAI_API_KEY',
+ 'OPENAI_BASE_URL',
+ 'XAI_API_KEY',
+ 'GROK_MODELS_BASE_URL',
+ 'COPILOT_PROVIDER_API_KEY',
+ 'COPILOT_PROVIDER_BASE_URL',
+ 'COPILOT_MODEL',
+ 'HERMES_INFERENCE_MODEL',
+ GRID_KEY_VAR,
+ GRID_MCP_AUTH_VAR,
+ HERMES_MANAGED_DIR_VAR,
+ GROK_HOME_VAR,
+]
+
+/**
+ * The variables this launch must clear: everything in [GRID_CONFLICTING_ENV_VARS] the launch does not
+ * itself set.
+ *
+ * Set-then-unset would be a bug, so the two sets are computed from one another rather than listed
+ * twice — a contract that gains a variable stops clearing it in the same edit.
+ */
+export function gridConflictingEnvToClear(launch: Pick<GridEngineLaunch, 'env' | 'configDir'>): string[] {
+ const provided = new Set(Object.keys(launch.env))
+ if (launch.configDir) provided.add(launch.configDir.envVar)
+ return GRID_CONFLICTING_ENV_VARS.filter((name) => !provided.has(name))
+}
+
+
+
+export type GridLaunchResult =
+ | { ok: true; launch: GridEngineLaunch }
+ | { ok: false; error: string; detail: string }
+
+/** What the core asks the models service to build (`ModelsPort.gridLaunch`). `refresh`: a relaunch, which repeats
+ * the row's launch with a saved API's endpoint and key as saved now. */
+export interface GridLaunchRequest {
+ engine: AgentEngine
+ override: GridLaunchOverride
+ machine: GridLaunchMachine
+ refresh?: boolean
+}
+
+/**
+ * What the models service answers: the launch and the override it was built from (refreshed, for a saved API); or
+ * why the engine cannot be pointed there. `apiBase` is a saved API's endpoint the answer read, which the core's
+ * grid assignment recognises from then on (lib/gridAssignment.ts).
+ */
+export type GridLaunchAnswer =
+ | { ok: true; launch: GridEngineLaunch; override: GridLaunchOverride; apiBase?: string }
+ | { ok: false; error: string; detail: string; apiBase?: string; unavailable?: string }
+
+/**
+ * Why a launch has no web search, in the daemon log's words — for the two answers the contracts decide
+ * themselves (lib/gridLaunch.ts). `unavailable` is decided elsewhere (`gridMcpUrl.ts`), which logs its own
+ * reason the moment it gives up, so nothing is repeated here.
+ */
+function webSearchReason(engine: AgentEngine, webSearch: GridWebSearchStatus): string | null {
+ if (webSearch !== 'unsupported') return null
+ if (engine === 'pi') return 'Pi has no MCP client'
+ if (engine === 'hermes') {
+ return `${HERMES_SYSTEM_MANAGED_DIR} pins this machine's Hermes settings, and the overlay carrying `
+ + 'the web tools would replace it'
+ }
+ return null
+}
+
+/** One log line naming where an agent was sent — grid, model, engine, and whether it got web
+ * search (with the reason when the contracts are what took it away). Never the key, never
+ * the MCP url. The core's to say, from a launch it holds (create's, or the record a relaunch built). */
+export function describeGridLaunch(
+ engine: AgentEngine,
+ override: GridLaunchOverride,
+ webSearch: GridWebSearchStatus,
+): string {
+ const reason = webSearchReason(engine, webSearch)
+ return `[grid] ${engine} -> ${override.networkName} (${override.networkId})`
+ + ` · ${override.model ?? 'model chosen by the engine'} · web search ${webSearch}`
+ + (reason ? ` (${reason})` : '')
+}
+
+/** Why a grid launch could not be built when the models service is not there to build it. `unavailable` names
+ * the service, so a restore holds the agent for it rather than failing it (lib/restoreAgents.ts). */
+export function gridUnavailable(engine: AgentEngine, override: GridLaunchOverride): { ok: false; error: string; detail: string; unavailable: 'models' } {
+ return {
+ ok: false,
+ error: isApiLaunch(override) ? 'API_UNAVAILABLE' : 'GRID_UNAVAILABLE',
+ detail: `The models service is not running, so ${engine} cannot be put on ${override.networkName}. Try again in a moment.`,
+ unavailable: 'models',
+ }
+}
+
+/** The engines a grid can run, as the contracts declare them (lib/gridLaunch.ts `GRID_ENGINE_CONTRACTS`), in their
+ * order: what a picker offers a grid model to, and what a refusal names instead. */
+export const GRID_CAPABLE_ENGINES: readonly AgentEngine[] = ['claude', 'codex', 'opencode', 'hermes', 'grok', 'pi', 'copilot']
+
+export function gridCapableEngines(): AgentEngine[] {
+ return [...GRID_CAPABLE_ENGINES]
+}
+
+/**
+ * Which variables pointing each engine at a grid sets: its launch's environment and its config directory's
+ * variable, for the fullest launch it can get (a model, web tools, a context window). Cleared when an agent leaves
+ * a grid for its own login, which asks no service. Declared rather than built here, and held equal to what the
+ * contracts build (lib/gridLaunch.spec.ts): a stale list would leave an agent moved back to its own login still
+ * talking to the grid.
+ */
+export const GRID_ENV_VAR_NAMES: Readonly<Partial<Record<AgentEngine, readonly string[]>>> = {
+ claude: ['ANTHROPIC_BASE_URL', 'ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_MODEL', 'CLAUDE_CODE_MAX_CONTEXT_TOKENS', GRID_KEY_VAR],
+ codex: [GRID_KEY_VAR, GRID_MCP_AUTH_VAR],
+ opencode: [GRID_KEY_VAR, 'OPENCODE_CONFIG'],
+ pi: [GRID_KEY_VAR, 'PI_CODING_AGENT_DIR'],
+ hermes: ['OPENAI_BASE_URL', 'OPENAI_API_KEY', 'HERMES_INFERENCE_MODEL', GRID_KEY_VAR, HERMES_MANAGED_DIR_VAR],
+ grok: ['GROK_MODELS_BASE_URL', 'XAI_API_KEY', GRID_KEY_VAR, GROK_HOME_VAR],
+ copilot: ['COPILOT_PROVIDER_BASE_URL', 'COPILOT_PROVIDER_API_KEY', 'COPILOT_MODEL', GRID_KEY_VAR],
+}
+
+/** The variables a grid launch of `engine` sets; empty for an engine that has no contract. */
+export function gridEnvVarNames(engine: AgentEngine): string[] {
+ return [...(GRID_ENV_VAR_NAMES[engine] ?? [])]
+}
diff --git a/cli/src/lib/gridWebMcp.ts b/cli/src/lib/gridWebMcp.ts
index 9cdb6086e..e1b6ffb6f 100644
--- a/cli/src/lib/gridWebMcp.ts
+++ b/cli/src/lib/gridWebMcp.ts
@@ -43,6 +43,7 @@
* authentication with nothing naming why.
*/
+import { GRID_MCP_AUTH_VAR, GROK_HOME_VAR, HERMES_MANAGED_DIR_VAR, HERMES_SYSTEM_MANAGED_DIR } from './gridLaunchWire.js'
import {
HARNESS_MCP_SERVER_NAME,
HARNESS_MCP_TOOL_NAMES,
@@ -59,7 +60,7 @@ import {
* it is rejected for the reason that ADR gives beside it, that it sends no header at all during
* discovery.
*/
-export const GRID_MCP_AUTH_VAR = 'GRID_MCP_AUTHORIZATION'
+export { GRID_MCP_AUTH_VAR } from './gridLaunchWire.js'
/** The header value [GRID_MCP_AUTH_VAR] carries — the whole of it, not the key. */
export function mcpAuthorizationHeader(apiKey: string): string {
@@ -291,7 +292,7 @@ export function codexMcpArgs(mcpUrl: string): string[] {
* Emitted as JSON, which is a subset of YAML: Hermes parses this file with a YAML loader, and
* hand-rolling YAML quoting for a URL and a `${VAR}` is a way to be subtly wrong for free.
*/
-export const HERMES_MANAGED_DIR_VAR = 'HERMES_MANAGED_DIR'
+export { HERMES_MANAGED_DIR_VAR } from './gridLaunchWire.js'
/**
* Where Hermes looks for a managed scope when [HERMES_MANAGED_DIR_VAR] is unset
@@ -301,7 +302,7 @@ export const HERMES_MANAGED_DIR_VAR = 'HERMES_MANAGED_DIR'
* module: a contract that stats the filesystem answers differently on two machines, and its spec
* would pass or fail depending on which one ran it.
*/
-export const HERMES_SYSTEM_MANAGED_DIR = '/etc/hermes'
+export { HERMES_SYSTEM_MANAGED_DIR } from './gridLaunchWire.js'
/** The one file [HERMES_MANAGED_DIR_VAR] is read for. */
export const HERMES_MANAGED_CONFIG_FILE = 'config.yaml'
@@ -348,7 +349,7 @@ export function hermesManagedConfig(mcpUrl: string, keyVar: string): string {
* with a user-scope server in a private `GROK_HOME`, Grok started it with no trust prompt and sent
* `Authorization: Bearer <the variable's value>` on every request.
*/
-export const GROK_HOME_VAR = 'GROK_HOME'
+export { GROK_HOME_VAR } from './gridLaunchWire.js'
/** The one file [GROK_HOME_VAR] is written for here. */
export const GROK_CONFIG_FILE = 'config.toml'
diff --git a/cli/src/lib/gridWebSearchFrame.spec.ts b/cli/src/lib/gridWebSearchFrame.spec.ts
index c469746b6..65970f959 100644
--- a/cli/src/lib/gridWebSearchFrame.spec.ts
+++ b/cli/src/lib/gridWebSearchFrame.spec.ts
@@ -18,6 +18,7 @@ import { agentFrame } from './agentFrame.js'
import { buildLaunchOverrides, type LaunchOverridesDeps } from './launchOverrides.js'
import { clearGridMcpUrlCache } from './gridMcpUrl.js'
import { resolveGridTarget } from './gridTarget.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
const { gridName: GRID, baseUrl: BASE_URL, mcpUrl: MCP_URL, plan } = fakeGridAnswers()
@@ -42,7 +43,7 @@ async function loadRegistry() {
}
const DEPS: LaunchOverridesDeps = {
- machine: () => ({ hermesSystemManaged: false }),
+ machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async (key) => `/state/grid-engine-config/${key}`,
tmuxSupportsSessionEnv: async () => true,
installCodexHooks: () => {},
diff --git a/cli/src/lib/launchOverrides.spec.ts b/cli/src/lib/launchOverrides.spec.ts
index f02c60171..9b3506abc 100644
--- a/cli/src/lib/launchOverrides.spec.ts
+++ b/cli/src/lib/launchOverrides.spec.ts
@@ -3,6 +3,7 @@ import { loadEngine } from '../engines/inProcess.js'
import { buildLaunchOverrides, validateLaunchOverrides, type LaunchOverridesDeps } from './launchOverrides.js'
import { DSH_SESSION_ENV } from '../dsh/launch.js'
import { GRID_CONFLICTING_ENV_VARS, type GridLaunchOverride } from './gridLaunch.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
const GRID: GridLaunchOverride = {
networkId: 'grid-abc',
@@ -21,7 +22,7 @@ vi.mock('../engines/inProcess.js', async (real) => {
function deps(overrides: Partial<LaunchOverridesDeps> = {}) {
const calls: string[] = []
const d: LaunchOverridesDeps = {
- machine: () => ({ hermesSystemManaged: false }),
+ machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async (key) => { calls.push(`writeConfig:${key}`); return `/state/grid-engine-config/${key}` },
tmuxSupportsSessionEnv: async () => true,
installCodexHooks: (home) => { calls.push(`hooks:${home}`) },
@@ -59,6 +60,14 @@ describe('buildLaunchOverrides — a relaunch comes back where the agent was', (
expect(result.overrides.clearEnv).not.toContain('PI_CODING_AGENT_DIR')
})
+ it('names the service that could not be asked, so a restore holds the agent rather than failing it', async () => {
+ const down = async () => ({ ok: false as const, error: 'GRID_UNAVAILABLE', detail: 'models is down', unavailable: 'models' })
+ expect(await buildLaunchOverrides(deps({ gridLaunch: down }).d, 'claude', { gridLaunch: GRID }, 'a'))
+ .toEqual({ ok: false, error: 'GRID_UNAVAILABLE', detail: 'models is down', unavailable: 'models' })
+ expect(await validateLaunchOverrides(deps({ gridLaunch: down }).d, 'claude', { gridLaunch: GRID }))
+ .toEqual({ ok: false, error: 'GRID_UNAVAILABLE', detail: 'models is down', unavailable: 'models' })
+ })
+
it('refuses rather than falling back when the grid cannot be honoured', async () => {
expect(await buildLaunchOverrides(deps().d, 'cursor', { gridLaunch: GRID }, 'a')).toMatchObject({ ok: false, error: 'GRID_ENGINE_UNSUPPORTED' })
expect(await buildLaunchOverrides(deps({ tmuxSupportsSessionEnv: async () => false }).d, 'claude', { gridLaunch: GRID }, 'a'))
diff --git a/cli/src/lib/launchOverrides.ts b/cli/src/lib/launchOverrides.ts
index 32e0179f5..b70e0e146 100644
--- a/cli/src/lib/launchOverrides.ts
+++ b/cli/src/lib/launchOverrides.ts
@@ -20,13 +20,14 @@ import { ownLoginProviderArgs } from '../engines/launches.js'
import { namedAgentArgs, supportsNamedAgent } from './engineLaunch.js'
import { profileEnvironment } from './engineHomes.js'
import {
- buildGridEngineLaunch,
gridConflictingEnvToClear,
type GridEngineLaunch,
+ type GridLaunchAnswer,
type GridLaunchMachine,
type GridLaunchOverride,
type GridLaunchRecord,
-} from './gridLaunch.js'
+ type GridLaunchRequest,
+} from './gridLaunchWire.js'
import { TMUX_SESSION_ENV_MIN } from './tmuxVersion.js'
import { harnessEnvToClear, type DshLaunch } from '../dsh/launch.js'
import { scmLaunchEnv } from '../scm/scmProjects.js'
@@ -54,13 +55,17 @@ export interface LaunchOverrides {
sessionModel?: string
}
+/** A refusal names the service that could not be asked (`unavailable`) when that is all that stopped it. */
export type LaunchOverridesResult =
| { ok: true; overrides: LaunchOverrides }
- | { ok: false; error: string; detail: string }
+ | { ok: false; error: string; detail: string; unavailable?: string }
export interface LaunchOverridesDeps {
/** The facts about THIS machine a contract needs and cannot read for itself — see `GridLaunchMachine`. */
machine: (engine: AgentEngine) => GridLaunchMachine
+ /** A grid or saved-API launch, built by the models service (core/agents/launch.ts `gridLaunchThrough`): the core
+ * builds none itself. */
+ gridLaunch: (request: GridLaunchRequest) => Promise<GridLaunchAnswer>
writeGridConfigDir: (
key: string,
files: NonNullable<GridEngineLaunch['configDir']>['files'],
@@ -132,27 +137,37 @@ const noOverrides = (): LaunchOverrides => ({ env: {}, extraArgs: [], clearEnv:
* builds — config directory included — once it holds the pane).
*/
export async function validateLaunchOverrides(
- deps: Pick<LaunchOverridesDeps, 'tmuxSupportsSessionEnv' | 'machine'>,
+ deps: Pick<LaunchOverridesDeps, 'tmuxSupportsSessionEnv' | 'machine' | 'gridLaunch'>,
engine: AgentEngine,
source: LaunchSource,
-): Promise<{ ok: true } | { ok: false; error: string; detail: string }> {
- // Which OpenCode is installed decides its argv (`machine`), read by OpenCode's own probe: loaded here for an
- // OpenCode launch alone (engines/inProcess.ts), and the launch refused without it rather than given a guess.
- if (engine === 'opencode' && !await loadEngine('opencode')) return { ok: false, error: 'ENGINE_UNAVAILABLE', detail: 'OpenCode\'s code could not be loaded' }
+): Promise<{ ok: true } | { ok: false; error: string; detail: string; unavailable?: string }> {
+ const unloaded = await opencodeUnloaded(engine)
+ if (unloaded) return unloaded
if (!source.gridLaunch) return { ok: true }
- const built = buildGridEngineLaunch(engine, source.gridLaunch, deps.machine(engine))
- if (!built.ok) return { ok: false, error: built.error, detail: built.detail }
- // Only a launch that SETS variables needs the tmux that can set them.
- if (!(await deps.tmuxSupportsSessionEnv())) {
- return {
- ok: false,
- error: 'TMUX_TOO_OLD_FOR_GRID',
- detail: `this machine's tmux is older than ${TMUX_SESSION_ENV_MIN.major}.${TMUX_SESSION_ENV_MIN.minor}, `
- + `which is the first version that can give a pane its own environment — so ${engine} could not be `
- + `pointed at grid ${source.gridLaunch.networkName}.`,
- }
+ const built = await deps.gridLaunch({ engine, override: source.gridLaunch, machine: deps.machine(engine) })
+ if (!built.ok) return { ok: false, error: built.error, detail: built.detail, ...(built.unavailable ? { unavailable: built.unavailable } : {}) }
+ return tmuxRefusal(deps, engine, source.gridLaunch)
+}
+
+/** Which OpenCode is installed decides its argv (`machine`), read by OpenCode's own probe: loaded for an OpenCode
+ * launch alone (engines/inProcess.ts), and the launch refused without it rather than given a guess. */
+async function opencodeUnloaded(engine: AgentEngine): Promise<{ ok: false; error: string; detail: string } | null> {
+ if (engine !== 'opencode' || await loadEngine('opencode')) return null
+ return { ok: false, error: 'ENGINE_UNAVAILABLE', detail: 'OpenCode\'s code could not be loaded' }
+}
+
+/** Only a launch that SETS variables needs the tmux that can set them. */
+async function tmuxRefusal(
+ deps: Pick<LaunchOverridesDeps, 'tmuxSupportsSessionEnv'>, engine: AgentEngine, override: GridLaunchOverride,
+): Promise<{ ok: true } | { ok: false; error: string; detail: string }> {
+ if (await deps.tmuxSupportsSessionEnv()) return { ok: true }
+ return {
+ ok: false,
+ error: 'TMUX_TOO_OLD_FOR_GRID',
+ detail: `this machine's tmux is older than ${TMUX_SESSION_ENV_MIN.major}.${TMUX_SESSION_ENV_MIN.minor}, `
+ + `which is the first version that can give a pane its own environment — so ${engine} could not be `
+ + `pointed at grid ${override.networkName}.`,
}
- return { ok: true }
}
export async function buildLaunchOverrides(
@@ -205,8 +220,9 @@ async function buildBaseLaunchOverrides(
source: LaunchSource,
configKey: string,
): Promise<LaunchOverridesResult> {
- const valid = await validateLaunchOverrides(deps, engine, source)
- if (!valid.ok) return valid
+ // Checked first, as every relaunch was before its grid launch moved to models (validateLaunchOverrides).
+ const unloaded = await opencodeUnloaded(engine)
+ if (unloaded) return unloaded
// Coming back to the engine's own login undoes TWO things the grid launch set, and they are
// undone separately because the engine remembers them differently.
//
@@ -236,8 +252,12 @@ async function buildBaseLaunchOverrides(
}
}
if (source.gridLaunch) {
- const built = buildGridEngineLaunch(engine, source.gridLaunch, deps.machine(engine))
- if (!built.ok) return { ok: false, error: built.error, detail: built.detail }
+ // Built once, by the models service, with a saved API's endpoint and key as saved now: a removed API is
+ // refused first, then an engine that cannot be pointed there, then a tmux that cannot set the variables.
+ const built = await deps.gridLaunch({ engine, override: source.gridLaunch, machine: deps.machine(engine), refresh: true })
+ if (!built.ok) return { ok: false, error: built.error, detail: built.detail, ...(built.unavailable ? { unavailable: built.unavailable } : {}) }
+ const tmux = await tmuxRefusal(deps, engine, built.override)
+ if (!tmux.ok) return tmux
const env: Record<string, string> = { ...built.launch.env }
if (built.launch.configDir) {
const { envVar, files, pointAt, links } = built.launch.configDir
@@ -258,7 +278,7 @@ async function buildBaseLaunchOverrides(
env,
extraArgs: [...built.launch.args],
clearEnv: gridConflictingEnvToClear({ env }),
- gridLaunchRecord: { override: source.gridLaunch, webSearch: built.launch.webSearch },
+ gridLaunchRecord: { override: built.override, webSearch: built.launch.webSearch },
...(built.launch.sessionModel ? { sessionModel: built.launch.sessionModel } : {}),
},
}
diff --git a/cli/src/lib/newAgentModel.ts b/cli/src/lib/newAgentModel.ts
index a11d6d940..22c1888ef 100644
--- a/cli/src/lib/newAgentModel.ts
+++ b/cli/src/lib/newAgentModel.ts
@@ -1,5 +1,5 @@
import type { AgentEngine } from '../engines/types.js'
-import { gridCapableEngines } from './gridLaunch.js'
+import { gridCapableEngines } from './gridLaunchWire.js'
/** A model picked for a new agent, and the grid serving it. Where its inference goes is the models
* service's to resolve (services/models.ts `launchTarget`), on the machine the agent runs on. */
diff --git a/cli/src/lib/registry.spec.ts b/cli/src/lib/registry.spec.ts
index 321c7d26f..fd5c1399f 100644
--- a/cli/src/lib/registry.spec.ts
+++ b/cli/src/lib/registry.spec.ts
@@ -1362,6 +1362,24 @@ describe('agent identity: the process owns the agent, the session is bound to it
})
})
+ it('persists a held launch: inactive, with the service it waits for and why, never a failure', async () => {
+ const { registry } = await loadRegistryModule()
+ registry.load()
+ const pending = registry.openPendingAgent({ engine: 'claude', runtimes: [{ backend: 'tmux', paneId: '%11' }], cwd: '/tmp/demo' })!
+ registry.setLaunch(pending.agentId, { state: 'held', service: 'models', detail: `Waiting for the models service.${'.'.repeat(600)}` })
+ expect(registry.byAgent(pending.agentId)).toMatchObject({ active: false, launch: { state: 'held', service: 'models' } })
+ const { registry: reloaded } = await loadRegistryModule()
+ reloaded.load()
+ const kept = reloaded.byAgent(pending.agentId)!
+ expect(kept).toMatchObject({ active: false, launch: { state: 'held', service: 'models' }, tmuxPane: '%11' })
+ expect(kept.launch?.state === 'held' && kept.launch.detail.length).toBe(500)
+ // A held launch that does not say which service, or why, is no launch at all.
+ for (const odd of [{ service: 'Models!', detail: 'x' }, { service: 7, detail: 'x' }, { service: 'models', detail: 7 }]) {
+ reloaded.setLaunch(pending.agentId, { state: 'held', ...odd } as never)
+ expect(reloaded.byAgent(pending.agentId)!.launch).toBeUndefined()
+ }
+ })
+
// lib/engineHomes.ts: CLAUDE_CONFIG_DIR or CODEX_HOME in the person's profile put the engine's
// transcripts where no root reached, and no agent bound there.
it('takes a transcript beneath a home the person moved as the engine\'s own, and nothing beside it', async () => {
diff --git a/cli/src/lib/registry.ts b/cli/src/lib/registry.ts
index cda39ebd4..bf71ca3fb 100644
--- a/cli/src/lib/registry.ts
+++ b/cli/src/lib/registry.ts
@@ -46,7 +46,7 @@ import { isSessionStoreEngine, sessionStoreContracts, sessionStoreOf } from '../
import { admitHook } from '../engines/hooks.js'
import { ENGINES, isTerminalEngine, type AgentEngine } from '../engines/types.js'
import type { GridAssignment } from './gridAssignment.js'
-import { parseGridLaunchOverride, type GridLaunchOverride, type GridLaunchRecord, type GridWebSearchStatus } from './gridLaunch.js'
+import { parseGridLaunchOverride, type GridLaunchOverride, type GridLaunchRecord, type GridWebSearchStatus } from './gridLaunchWire.js'
import { parseScmLaunchRecord, type ScmLaunchRecord } from '../scm/types.js'
import { commandcodeTranscriptPath } from '../engines/commandcode/contract.js'
import { agyTranscriptPath } from '../engines/agy/contract.js'
@@ -63,6 +63,12 @@ export type AgentLaunch =
| { state: 'starting' }
| { state: 'ready' }
| { state: 'failed'; error: string; detail?: string }
+ /**
+ * Not launched yet because the service its launch asks could not be asked (core/agents/heldLaunches.ts): a
+ * grid or saved-API agent while models is not running. Nothing about the agent is wrong. It waits in a pane
+ * that says why, and is launched once the service is ready. Never a failure: a restore tries it again.
+ */
+ | { state: 'held'; service: string; detail: string }
/** Claude Code's hooks report `model` as {id, display_name}; Codex/Cursor report a plain string. This is
* the boundary where hook JSON becomes persisted state, so anything else is dropped rather than stored —
@@ -655,6 +661,11 @@ function normalizedLaunch(value: unknown): AgentLaunch | undefined {
if (!value || typeof value !== 'object') return undefined
const launch = value as { state?: unknown; error?: unknown; detail?: unknown }
if (launch.state === 'starting' || launch.state === 'ready') return { state: launch.state }
+ if (launch.state === 'held') {
+ const held = value as { service?: unknown; detail?: unknown }
+ if (typeof held.service !== 'string' || !/^[a-z][a-z-]{0,39}$/.test(held.service) || typeof held.detail !== 'string') return undefined
+ return { state: 'held', service: held.service, detail: held.detail.slice(0, 500) }
+ }
if (launch.state !== 'failed' || typeof launch.error !== 'string' || !launch.error) return undefined
const error = launch.error.slice(0, 80)
const detail = typeof launch.detail === 'string' && launch.detail
@@ -2006,7 +2017,8 @@ class Registry {
if (!entry) return null
const before = entry.launch
entry.launch = normalizedLaunch(launch)
- entry.active = launch.state !== 'failed'
+ // A held agent runs no engine yet: it is not active until its launch is.
+ entry.active = launch.state !== 'failed' && launch.state !== 'held'
entry.touchedAt = Date.now()
this.traceLaunch(agentId, before, entry.launch, `setLaunch${launch.state === 'failed' ? ` (${launch.error})` : ''}`)
this.save()
diff --git a/cli/src/lib/restoreAgents.spec.ts b/cli/src/lib/restoreAgents.spec.ts
index 566c1a9a1..334328ce5 100644
--- a/cli/src/lib/restoreAgents.spec.ts
+++ b/cli/src/lib/restoreAgents.spec.ts
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import type { AgentLaunch, ProcessIdentity, RegisteredSession } from './registry.js'
import type { TerminalRuntimeRef, TmuxRuntimeRef } from './terminalTypes.js'
-import { GRID_CREDENTIAL_REQUIRED, restoreAgents, tmuxSurvey, type RestoreAgentsDeps, type RestoreLaunch } from './restoreAgents.js'
+import { GRID_CREDENTIAL_REQUIRED, heldLaunch, restoreAgents, tmuxSurvey, type RestoreAgentsDeps, type RestoreLaunch, type RestoreLaunchResult } from './restoreAgents.js'
import type { GridLaunchOverride } from './gridLaunch.js'
const GRID: GridLaunchOverride = {
@@ -167,7 +167,7 @@ describe('restoreAgents — a survey that could not tell', () => {
h.deps.liveProcess = async () => { asked.push('engine'); return engines.shift()! }
const summary = await restoreAgents(h.deps)
// Its engine is still running: left alone, re-identified, and no second pane opened beside it.
- expect(summary).toEqual({ restored: [], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(asked).toEqual(['pane', 'pane', 'pane', 'engine', 'engine'])
expect(h.paneCreates).toBe(0)
expect(h.calls).toContain('updateIdentity:agent-a:7')
@@ -217,7 +217,7 @@ describe('restoreAgents — which agents get a pane back', () => {
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: ['agent-a'], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: ['agent-a'], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.launches).toEqual([{ agentId: 'agent-a', resumeSessionId: 'session-a' }])
// Every registry write of phase 1 happens inside the one transaction, in this order.
expect(h.calls.slice(0, 5)).toEqual([
@@ -267,7 +267,7 @@ describe('restoreAgents — which agents get a pane back', () => {
it('leaves a pane that still runs its engine alone, re-identifying a row that lost its pid', async () => {
const h = harness([row()], { livePanes: ['%3'] })
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: [], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.paneCreates).toBe(0)
// No identity on the row (a misread reboot, a tmux server that outlived the daemon): the live
// pid is written back so discovery adopts by process rather than by route.
@@ -295,7 +295,7 @@ describe('restoreAgents — which agents get a pane back', () => {
const h = harness([row({ agentId: 'gridded', grid: { baseUrl: GRID.baseUrl, model: null }, gridLaunch: GRID })])
h.probes.set('%0', [identity(7)])
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: ['gridded'], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: ['gridded'], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.launched).toEqual([{ agentId: 'gridded', launch: { argv: ['claude', '--resume', 'session-a', '--grid', 'grid-abc'], env: { GRID_API_KEY: 'gridkey-abc123' } } }])
await settled(h, 1, 1)
})
@@ -357,6 +357,157 @@ describe('restoreAgents — which agents get a pane back', () => {
})
})
+describe('restoreAgents — held until the service a launch asks is ready', () => {
+ /** A grid agent's launch asks models; `answers` is what each ask of it gets, in turn (a launch, by default). */
+ const withModels = (h: Harness, answers: Array<'held' | 'refused'> = []) => {
+ const build = h.deps.buildLaunch
+ h.deps.needs = (entry) => entry.gridLaunch ? 'models' : null
+ h.deps.waitingLaunch = (_entry, held) => ({ argv: ['wait', held.detail] })
+ h.deps.killPane = async (runtime) => { h.calls.push(`kill:${runtime.paneId}`) }
+ h.deps.buildLaunch = async (entry, o): Promise<RestoreLaunchResult> => {
+ const answer = entry.gridLaunch ? answers.shift() : undefined
+ if (answer === 'held') { h.launches.push({ agentId: entry.agentId }); return { held: 'models' } }
+ if (answer === 'refused') { h.launches.push({ agentId: entry.agentId }); return { error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no way there' } }
+ return build(entry, o)
+ }
+ }
+ const HELD = heldLaunch('models')
+ const gridRow = (agentId: string, over: Partial<RegisteredSession> = {}) => row({
+ agentId, sessionId: `session-${agentId}`, grid: { baseUrl: GRID.baseUrl, model: null }, gridLaunch: GRID,
+ runtimes: [{ backend: 'tmux', paneId: `%${agentId.length + 40}` }], primaryRuntimeKey: '', tmuxPane: '', ...over,
+ })
+
+ it('says what a held agent waits for, in the words its pane shows', () => {
+ expect(HELD).toEqual({ state: 'held', service: 'models', detail: 'Waiting for the models service. This harness starts by itself once the models service is running.' })
+ expect(heldLaunch('store')).toMatchObject({ detail: expect.stringContaining('Waiting for the Store.') })
+ expect(heldLaunch('search')).toMatchObject({ detail: expect.stringContaining('Waiting for search.') })
+ })
+
+ it('at boot asks no service: an agent whose launch needs one waits in a pane of its own, held, and the rest come back as ever', async () => {
+ const h = harness([row(), gridRow('gridded')])
+ withModels(h)
+ h.deps.defer = true
+ h.probes.set('%0', [identity(5)])
+ const summary = await restoreAgents(h.deps)
+ await settled(h, 1, 1)
+ expect(summary).toEqual({ restored: ['agent-a'], skipped: [], failed: [], held: ['gridded'], unsurveyed: [] })
+ // Only the agent on its own login was built; the grid agent's pane runs the reason, nothing else.
+ expect(h.launches).toEqual([{ agentId: 'agent-a', resumeSessionId: 'session-a' }])
+ expect(h.launched.find((l) => l.agentId === 'gridded')?.launch).toEqual({ argv: ['wait', HELD.state === 'held' ? HELD.detail : ''] })
+ expect(h.rows.get('gridded')).toMatchObject({ launch: HELD, runtimes: [{ backend: 'tmux', paneId: '%1' }] })
+ // In the boot's one transaction with every other pane, so no pane id it reuses is left on a stale row.
+ expect(h.calls).toContain('updateRuntimes:gridded:%1@tx')
+ expect(h.calls).toContain('setLaunch:gridded:held@tx')
+ })
+
+ it('launches a held agent into the pane it waits in, outside any transaction, once the service can be asked', async () => {
+ const h = harness([gridRow('gridded', { launch: HELD })], { alivePanes: ['%47'] })
+ withModels(h)
+ h.deps.only = new Set(['gridded'])
+ h.probes.set('%47', [identity(8)])
+ const summary = await restoreAgents(h.deps)
+ expect(summary).toEqual({ restored: ['gridded'], skipped: [], failed: [], held: [], unsurveyed: [] })
+ expect(h.paneCreates).toBe(0)
+ expect(h.calls.filter((call) => call.endsWith('@tx'))).toEqual([])
+ expect(h.calls).toContain('respawn:%47:claude --resume session-gridded --grid grid-abc')
+ expect(h.rows.get('gridded')?.launch).toEqual({ state: 'starting' })
+ await settled(h, 1, 1)
+ })
+
+ it('asks a service that cannot be asked once a pass: every agent after it that needs it is held unasked', async () => {
+ const h = harness([gridRow('first', { launch: HELD }), gridRow('second', { launch: HELD }), row({ agentId: 'own', sessionId: 'session-own' })], { alivePanes: ['%45'] })
+ withModels(h, ['held', 'held'])
+ h.probes.set('%1', [identity(6)])
+ const summary = await restoreAgents(h.deps)
+ await settled(h, 1, 1)
+ expect(summary.held).toEqual(['first', 'second'])
+ expect(summary.restored).toEqual(['own'])
+ // One ask of models, for the first; the second waits without one, in a new pane since its own went.
+ expect(h.launches.filter((l) => l.agentId !== 'own')).toEqual([{ agentId: 'first' }])
+ expect(h.launched.find((l) => l.agentId === 'second')?.launch.argv[0]).toBe('wait')
+ expect(h.rows.get('first')?.launch).toEqual(HELD)
+ expect(h.rows.get('second')?.launch).toEqual(HELD)
+ })
+
+ it('never fails or skips a held agent: the next restore holds it again, its pane gone with a reboot', async () => {
+ const h = harness([gridRow('gridded', { launch: HELD, resumeOnly: true })])
+ withModels(h)
+ h.deps.defer = true
+ h.deps.retainStopped = vi.fn()
+ const summary = await restoreAgents(h.deps)
+ expect(summary.held).toEqual(['gridded'])
+ expect(summary.skipped).toEqual([])
+ // A confirmed conversation it held: not sent back to the archive like an unconfirmed one.
+ expect(h.deps.retainStopped).not.toHaveBeenCalled()
+ expect(h.rows.get('gridded')?.launch).toEqual(HELD)
+ })
+
+ it('closes the pane of a held agent whose launch then fails, or whose conversation is gone', async () => {
+ const h = harness([gridRow('refused', { launch: HELD }), gridRow('lost', { launch: HELD, resumeOnly: true, sessionId: '' })], { alivePanes: ['%47', '%44'] })
+ withModels(h, ['refused'])
+ const summary = await restoreAgents(h.deps)
+ expect(summary.failed.map((f) => f.agentId)).toEqual(['refused', 'lost'])
+ expect(h.calls).toContain('kill:%47')
+ expect(h.calls).toContain('kill:%44')
+ expect(h.rows.get('refused')?.launch).toMatchObject({ state: 'failed', error: 'GRID_ENGINE_UNSUPPORTED' })
+ })
+
+ it('reports a held agent no pane could be opened for, and opens none without a waiting launch to give it', async () => {
+ const h = harness([gridRow('gridded')], { failCreate: true })
+ withModels(h)
+ h.deps.defer = true
+ expect((await restoreAgents(h.deps)).failed).toEqual([{ agentId: 'gridded', reason: 'tmux said no' }])
+ const bare = harness([gridRow('gridded')])
+ bare.deps.needs = () => 'models'
+ bare.deps.defer = true
+ expect((await restoreAgents(bare.deps)).held).toEqual(['gridded'])
+ expect(bare.launched).toEqual([{ agentId: 'gridded', launch: { argv: [] } }])
+ })
+
+ it('leaves every agent a pass was not asked about as it is', async () => {
+ const h = harness([row(), gridRow('gridded', { launch: HELD })], { alivePanes: ['%47'] })
+ withModels(h, ['held'])
+ h.deps.only = new Set(['gridded'])
+ const summary = await restoreAgents(h.deps)
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: ['gridded'], unsurveyed: [] })
+ expect(h.launches).toEqual([{ agentId: 'gridded' }])
+ })
+
+ it('holds an agent whose fresh relaunch needs a service that cannot be asked, in its pane, never failed', async () => {
+ const h = harness([gridRow('gridded')])
+ withModels(h, [undefined as never, 'held'])
+ h.probes.set('%0', [null, null])
+ h.states.set('%0', [{ dead: true }])
+ await restoreAgents(h.deps)
+ await settled(h, 1)
+ expect(h.calls).toContain(`respawn:%0:wait ${HELD.state === 'held' ? HELD.detail : ''}`)
+ expect(h.rows.get('gridded')?.launch).toEqual(HELD)
+ // A waiting pane that cannot be had is the one failure left.
+ const stuck = harness([gridRow('gridded')])
+ withModels(stuck, [undefined as never, 'held'])
+ stuck.deps.respawn = async () => ({ ok: false })
+ stuck.probes.set('%0', [null, null])
+ stuck.states.set('%0', [{ dead: true }])
+ await restoreAgents(stuck.deps)
+ await settled(stuck, 1)
+ expect(stuck.rows.get('gridded')?.launch).toMatchObject({ state: 'failed', error: 'ENGINE_DID_NOT_START', detail: expect.stringContaining('unknown reason') })
+ })
+
+ it('holds a terminal whose adopted engine needs a service to come back, too', async () => {
+ const h = harness([row({ terminalHost: true, engine: 'claude', gridLaunch: GRID })])
+ h.deps.needs = () => null
+ h.deps.waitingLaunch = (_entry, held) => ({ argv: ['wait', held.detail] })
+ const build = h.deps.buildLaunch
+ let asks = 0
+ h.deps.buildLaunch = async (entry, o) => (++asks === 2 ? { held: 'models' } : build(entry, o))
+ h.probes.set('%0', [null, null])
+ h.states.set('%0', [{ dead: true }])
+ await restoreAgents(h.deps)
+ await settled(h, 1)
+ expect(h.rows.get('agent-a')?.launch).toEqual(HELD)
+ })
+})
+
describe('restoreAgents — waiting for the engine', () => {
it('keeps an explicit resume failure instead of silently starting fresh after a daemon restart', async () => {
const h = harness([row({ resumeOnly: true })])
@@ -517,7 +668,7 @@ describe('restoreAgents — terminals', () => {
it('leaves a terminal whose pane is still there alone — a shell has no engine process to look for', async () => {
const h = harness([terminal()], { alivePanes: ['%3'] })
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: [], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.paneCreates).toBe(0)
expect(h.calls).toEqual([])
})
@@ -525,7 +676,7 @@ describe('restoreAgents — terminals', () => {
it('recreates a terminal whose pane is gone as a ready shell: no hold, no engine watch', async () => {
const h = harness([terminal()])
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: ['term-1'], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: ['term-1'], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.launches).toEqual([{ agentId: 'term-1' }])
expect(h.calls).toEqual([
'clearIdentity:term-1@tx',
@@ -540,7 +691,7 @@ describe('restoreAgents — terminals', () => {
it('puts a terminal whose adopted engine exited while the daemon was down back to a shell, pane kept', async () => {
const h = harness([terminal({ engine: 'claude', sessionId: 'session-t', boundAt: 1, processIdentity: identity(7) })], { alivePanes: ['%3'] })
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: [], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.calls).toEqual(['releaseEngine:term-1'])
expect(h.rows.get('term-1')).toMatchObject({ engine: 'terminal', sessionId: '' })
})
@@ -548,7 +699,7 @@ describe('restoreAgents — terminals', () => {
it('keeps a terminal whose adopted engine is still running exactly as an agent', async () => {
const h = harness([terminal({ engine: 'claude', sessionId: 'session-t', boundAt: 1 })], { alivePanes: ['%3'], livePanes: ['%3'] })
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: [], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.calls).toEqual(['updateIdentity:term-1:1003'])
expect(h.rows.get('term-1')?.engine).toBe('claude')
})
@@ -557,7 +708,7 @@ describe('restoreAgents — terminals', () => {
const h = harness([row({ agentId: 'agent-a', terminalHost: true })], { alivePanes: ['%3'] })
// `terminalHost` is what releaseEngine's stub keys on; the real registry sets it for any row.
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: [], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: [], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.paneCreates).toBe(0)
expect(h.calls).toEqual(['releaseEngine:agent-a'])
expect(h.rows.get('agent-a')).toMatchObject({ engine: 'terminal', sessionId: '' })
@@ -576,7 +727,7 @@ describe('restoreAgents — terminals', () => {
it('brings a terminal whose adopted engine left no conversation id back as a shell', async () => {
const h = harness([terminal({ engine: 'claude', sessionId: '', boundAt: 1 })])
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: ['term-1'], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: ['term-1'], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.calls[0]).toBe('releaseEngine:term-1')
expect(h.launches).toEqual([{ agentId: 'term-1' }])
expect(h.launched[0].launch.argv[0]).toBe('terminal')
@@ -588,7 +739,7 @@ describe('restoreAgents — terminals', () => {
const h = harness([terminal({ engine, sessionId: 'ses_kept', boundAt: 1 })])
h.probes.set('%0', [identity(9)])
const summary = await restoreAgents(h.deps)
- expect(summary).toEqual({ restored: ['term-1'], skipped: [], failed: [], unsurveyed: [] })
+ expect(summary).toEqual({ restored: ['term-1'], skipped: [], failed: [], held: [], unsurveyed: [] })
expect(h.calls).not.toContain('releaseEngine:term-1')
expect(h.launches).toEqual([{ agentId: 'term-1', resumeSessionId: 'ses_kept' }])
expect(h.launched[0].launch.argv).toEqual([engine, '--resume', 'ses_kept'])
diff --git a/cli/src/lib/restoreAgents.ts b/cli/src/lib/restoreAgents.ts
index 6032c3225..9b6f6e2f9 100644
--- a/cli/src/lib/restoreAgents.ts
+++ b/cli/src/lib/restoreAgents.ts
@@ -25,6 +25,13 @@
* argv `agent_create` used. A row that only knows WHERE it pointed (`grid` without `gridLaunch`,
* written before the credential was persisted) is not relaunched — on the engine's own login it would
* spend the wrong account while looking identical — and is marked so the app can say why.
+ *
+ * A launch that asks a service for its part (`needs`: a grid's or a saved API's, from models) is never waited
+ * on at boot (`defer`): the agent is HELD, in a pane of its own that says what it waits for, and a later pass
+ * (`only`, core/agents/heldLaunches.ts) launches it there once the core is up and the service can be asked. A
+ * service that cannot be asked holds the agent the same way, and every agent after it in that pass that
+ * needs the same service, unasked: one pass waits on a service at most once. Held is never failed: the next
+ * restore tries again, and discovery keeps the agent, whose pane is alive.
*/
import { isTerminalEngine, type AgentEngine } from '../engines/types.js'
@@ -38,7 +45,13 @@ export interface RestoreLaunch {
env?: Record<string, string>
}
-export type RestoreLaunchResult = RestoreLaunch | { error: string; detail: string }
+/** The launch, why there is none, or the service its launch asks that could not be asked (`held`). */
+export type RestoreLaunchResult = RestoreLaunch | { error: string; detail: string } | { held: string }
+
+/** What a held agent's row says: the service it waits for, and why, in the words its pane shows. */
+export function heldLaunch(service: string, label = service === 'models' ? 'the models service' : service === 'store' ? 'the Store' : service): AgentLaunch {
+ return { state: 'held', service, detail: `Waiting for ${label}. This harness starts by itself once ${label} is running.` }
+}
/** The row knows it was on a grid but not how to get back there. */
export const GRID_CREDENTIAL_REQUIRED = 'GRID_CREDENTIAL_REQUIRED'
@@ -95,6 +108,16 @@ export interface RestoreAgentsDeps {
releaseRoute: (routeKey: string) => void
triggerHint: (runtime: TmuxRuntimeRef, engine: AgentEngine) => Promise<void>
log: (message: string) => void
+ /** The service a launch of this row asks for its part (a grid's or a saved API's: `models`), or null. */
+ needs?: (entry: RegisteredSession) => string | null
+ /** Boot: hold every row whose launch asks a service rather than ask it now (`heldLaunch`). */
+ defer?: boolean
+ /** Restore only these agents, every other row as it is: a pass over the held ones. */
+ only?: ReadonlySet<string>
+ /** What a held agent's pane runs while it waits: the reason, and nothing else. */
+ waitingLaunch?: (entry: RegisteredSession, launch: Extract<AgentLaunch, { state: 'held' }>) => RestoreLaunch
+ /** Close a held agent's pane whose launch then failed: it would otherwise go on saying it waits. */
+ killPane?: (runtime: TmuxRuntimeRef) => Promise<void>
/** How long a restored pane may take to show an engine process. Default matches `agent_create`. */
budgetMs?: number
/** How long the engine must stay up after appearing before the pane is handed over. */
@@ -109,6 +132,8 @@ export interface RestoreSummary {
restored: string[]
skipped: Array<{ agentId: string; reason: string }>
failed: Array<{ agentId: string; reason: string }>
+ /** Agents held for a service their launch asks (`heldLaunch`), each in a pane that says so. */
+ held: string[]
/** Agents left as they were because tmux or `ps` could not say whether their pane or engine lives.
* Discovery must not retire them this boot: a pane restore never looked at is not one that closed. */
unsurveyed: string[]
@@ -207,18 +232,27 @@ async function waitForSettle(deps: RestoreAgentsDeps, runtime: TmuxRuntimeRef, s
* background; the summary says which agents that is happening for.
*/
export async function restoreAgents(deps: RestoreAgentsDeps): Promise<RestoreSummary> {
- const summary: RestoreSummary = { restored: [], skipped: [], failed: [], unsurveyed: [] }
+ const summary: RestoreSummary = { restored: [], skipped: [], failed: [], held: [], unsurveyed: [] }
const patience = { left: true }
- const missing: Array<{ entry: RegisteredSession; runtime: TmuxRuntimeRef }> = []
+ /** `alive`: a held agent's waiting pane, which its launch goes into rather than a new one. */
+ const missing: Array<{ entry: RegisteredSession; runtime: TmuxRuntimeRef; alive?: true }> = []
// Per row, because a survey that gives up on the first bad one gives up on every row behind it —
// one pane whose `tmux list-panes` timed out, or one archive that could not be written, and the
// whole desk comes back empty. A row that cannot be surveyed is reported and the rest go on.
for (const entry of deps.registry.list()) {
+ if (deps.only && !deps.only.has(entry.agentId)) continue
try {
const runtime = tmuxRuntime(entry)
if (!runtime) { summary.skipped.push({ agentId: entry.agentId, reason: 'no tmux pane' }); continue }
if (entry.launch?.state === 'failed') { summary.skipped.push({ agentId: entry.agentId, reason: 'last launch failed' }); continue }
+ // Held: its pane, alive, runs no engine on purpose, so it is neither a stopped engine nor a terminal. Its
+ // launch goes into that pane, or a new one if the pane went (a reboot).
+ if (entry.launch?.state === 'held') {
+ const alive = deps.livePane ? await surveyed(deps, patience, () => deps.livePane!(runtime)) : false
+ missing.push({ entry, runtime, ...(alive ? { alive: true as const } : {}) })
+ continue
+ }
// A pane is alive as long as tmux has it, whatever runs in it: every pane is a shell with the
// engine inside, so an engine that exited while the daemon was down left a shell at its prompt
// — exactly the exit the reconciler would have caught — and the row is put back to a terminal
@@ -299,8 +333,32 @@ export async function restoreAgents(deps: RestoreAgentsDeps): Promise<RestoreSum
const budgetMs = deps.budgetMs ?? DEFAULT_BUDGET_MS
const watches: Array<() => Promise<void>> = []
- await deps.registry.transaction(async () => {
- for (const { entry, runtime: dead } of missing) {
+ /** The services this pass could not ask: every later agent that needs one is held without asking. */
+ const unavailable = new Set<string>()
+ /** Held in its waiting pane: the one it has, or a new one. False when no pane could be opened for it. */
+ const hold = async (entry: RegisteredSession, runtime: TmuxRuntimeRef, alive: boolean, service: string): Promise<boolean> => {
+ const launch = heldLaunch(service) as Extract<AgentLaunch, { state: 'held' }>
+ let pane = runtime
+ if (!alive) {
+ const created = await deps.createPane(entry, deps.waitingLaunch?.(entry, launch) ?? { argv: [] })
+ if (!created.ok) {
+ summary.failed.push({ agentId: entry.agentId, reason: created.reason })
+ deps.log(`[restore] ${entry.engine} · agent ${entry.agentId} · could not open a pane to wait in · ${created.reason}`)
+ return false
+ }
+ pane = created.runtime
+ deps.registry.updateRuntimes(entry.agentId, [pane], terminalRouteKey(pane))
+ }
+ deps.registry.setLaunch(entry.agentId, launch)
+ summary.held.push(entry.agentId)
+ deps.log(`[restore] ${entry.engine} · agent ${entry.agentId} · held in pane ${pane.paneId} · waiting for ${service}`)
+ return true
+ }
+ // Every missing pane at once, in one transaction (see the module doc). A pass over held agents opens no
+ // pane but the ones they wait in, which are theirs already: it holds no saves back while it asks a service.
+ const inPass = (apply: () => Promise<void>): Promise<void> => deps.only ? apply() : deps.registry.transaction(apply)
+ await inPass(async () => {
+ for (const { entry, runtime: dead, alive } of missing) {
// No process survives its pane; clear it now or discovery would refuse to adopt the new one
// into this agent (route adoption requires either no identity or a matching pid).
deps.registry.clearProcessIdentity(entry.agentId)
@@ -309,16 +367,32 @@ export async function restoreAgents(deps: RestoreAgentsDeps): Promise<RestoreSum
const reason = 'The saved conversation is no longer available. Start a new conversation separately.'
summary.failed.push({ agentId: entry.agentId, reason })
deps.registry.setLaunch(entry.agentId, { state: 'failed', error: 'RESUME_UNAVAILABLE', detail: reason })
+ if (alive) await deps.killPane?.(dead)
+ continue
+ }
+ // Never asked at boot, and asked at most once a pass: the core's readiness never waits on a service.
+ const needed = deps.needs?.(entry) ?? null
+ if (needed && (deps.defer || unavailable.has(needed))) {
+ await hold(entry, dead, !!alive, needed)
continue
}
const launch = await deps.buildLaunch(entry, resumeSessionId ? { resumeSessionId } : {})
+ if ('held' in launch) {
+ unavailable.add(launch.held)
+ await hold(entry, dead, !!alive, launch.held)
+ continue
+ }
if ('error' in launch) {
summary.failed.push({ agentId: entry.agentId, reason: launch.detail })
deps.registry.setLaunch(entry.agentId, { state: 'failed', error: launch.error, detail: launch.detail })
deps.log(`[restore] ${entry.engine} · agent ${entry.agentId} · could not build its launch · ${launch.detail}`)
+ if (alive) await deps.killPane?.(dead)
continue
}
- const created = await deps.createPane(entry, launch)
+ // A held agent's launch goes into the pane it waited in.
+ const created: { ok: true; runtime: TmuxRuntimeRef } | { ok: false; reason: string } = alive
+ ? await deps.respawn(dead, launch).then((spawned) => spawned.ok ? { ok: true as const, runtime: dead } : { ok: false as const, reason: spawned.reason ?? 'the pane could not be reused' })
+ : await deps.createPane(entry, launch)
if (!created.ok) {
summary.failed.push({ agentId: entry.agentId, reason: created.reason })
deps.log(`[restore] ${entry.engine} · agent ${entry.agentId} · could not open a pane · ${created.reason}`)
@@ -366,6 +440,18 @@ async function watchRestoredPane(
deps.registry.setLaunch(agentId, { state: 'failed', error, detail })
deps.log(`[restore] ${engine} · agent ${agentId} · failed · ${detail}`)
}
+ /** Its fresh launch asks a service that could not be asked: held in this pane, never failed. */
+ const holdHere = async (service: string): Promise<false> => {
+ const launch = heldLaunch(service) as Extract<AgentLaunch, { state: 'held' }>
+ const spawned = await deps.respawn(runtime, deps.waitingLaunch?.(entry, launch) ?? { argv: [] })
+ if (!spawned.ok) {
+ fail('ENGINE_DID_NOT_START', `${engine} could not wait for ${service} in its pane: ${spawned.reason ?? 'unknown reason'}`)
+ return false
+ }
+ deps.registry.setLaunch(agentId, launch)
+ deps.log(`[restore] ${engine} · agent ${agentId} · held · waiting for ${service}`)
+ return false
+ }
const settleMs = deps.settleMs ?? DEFAULT_SETTLE_MS
let mayRetryFresh = resuming
/** The pane's engine is gone. True when a fresh relaunch is now under way, false when this is the end. */
@@ -386,6 +472,7 @@ async function watchRestoredPane(
deps.keepAbandoned?.({ ...entry })
deps.registry.releaseEngine(agentId)
const launch = await deps.buildLaunch(deps.registry.byAgent(agentId) ?? { ...entry, engine: 'terminal' }, {})
+ if ('held' in launch) return holdHere(launch.held)
if ('error' in launch) {
fail(launch.error, launch.detail)
return false
@@ -409,6 +496,7 @@ async function watchRestoredPane(
deps.registry.inheritName(entry.sessionId, agentId)
deps.registry.unbindSession(entry.sessionId)
const launch = await deps.buildLaunch(entry, {})
+ if ('held' in launch) return holdHere(launch.held)
if ('error' in launch) {
fail(launch.error, launch.detail)
return false
diff --git a/cli/src/scm/scmLaunch.spec.ts b/cli/src/scm/scmLaunch.spec.ts
index 7dfd525d8..7941dd8b9 100644
--- a/cli/src/scm/scmLaunch.spec.ts
+++ b/cli/src/scm/scmLaunch.spec.ts
@@ -7,6 +7,7 @@ import { buildLaunchOverrides, type LaunchOverridesDeps } from '../lib/launchOve
import type { TerminalCreateResult, TmuxRuntimeRef } from '../lib/terminalTypes.js'
import * as scmProjects from './scmProjects.js'
import type { ScmLaunchRecord } from './types.js'
+import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
let dataDir = ''
@@ -26,7 +27,7 @@ const GIT: ScmLaunchRecord = { kind: 'git' }
function deps(): LaunchOverridesDeps {
return {
- machine: () => ({ hermesSystemManaged: false }),
+ machine: () => ({ hermesSystemManaged: false }), gridLaunch: gridLaunchInProcess(),
writeGridConfigDir: async (key) => `/state/grid-engine-config/${key}`,
tmuxSupportsSessionEnv: async () => true,
installCodexHooks: () => {},
diff --git a/cli/src/services/models.spec.ts b/cli/src/services/models.spec.ts
index 71c12cab3..ee9de545e 100644
--- a/cli/src/services/models.spec.ts
+++ b/cli/src/services/models.spec.ts
@@ -21,8 +21,8 @@ import { resolveGridTarget } from '../lib/gridTarget.js'
import type { RegisteredSession } from '../lib/registry.js'
import type { RuntimeModelOption } from '../lib/runtimeProfile.js'
import { ensureManagedGrid, startGridPinRecheck } from '../lib/runtimeInstall.js'
-import { apiConnectionsRequest } from '../lib/apiConnections.js'
-import { apiModelsRequest, rememberSavedApis } from '../lib/apiModels.js'
+import { ApiConnections, apiConnectionsRequest } from '../lib/apiConnections.js'
+import { apiModelsRequest, apiTargetAnswer, refreshApiFor, rememberSavedApis } from '../lib/apiModels.js'
import { linkCodexProfile, listCodexProfiles } from '../lib/codexProfiles.js'
import { fakeCore } from '../testing/fakeCore.js'
import { compactRuntimePickerModels, launchTarget, MODELS_REQUESTS, startModels } from './models.js'
@@ -69,6 +69,8 @@ vi.mock('../lib/apiConnections.js', () => ({
vi.mock('../lib/apiModels.js', () => ({
apiModelsRequest: vi.fn(async (_store: unknown, payload: Record<string, unknown>) => ({ id: payload.id, models: ['m1'] })),
rememberSavedApis: vi.fn(),
+ refreshApiFor: vi.fn(() => (override: unknown) => ({ override, apiBase: 'https://api.example.test/v1' })),
+ apiTargetAnswer: vi.fn(async () => ({ detail: 'This API is not saved. Add it in Models → APIs.' })),
}))
vi.mock('../lib/codexProfiles.js', () => ({
listCodexProfiles: vi.fn((observed: string[]) => observed.map((path) => ({ path, label: 'Codex' }))),
@@ -686,6 +688,19 @@ describe('the models service', () => {
expect(rememberSavedApis).toHaveBeenCalledOnce()
})
+ it("builds the core's launches on a grid or a saved API, reading the saved APIs in the data folder as they are now", async () => {
+ const { port } = setup([], { dataDir: '/data/launch' })
+ const store = apis.stores.indexOf('/data/launch')
+ expect(store).toBeGreaterThanOrEqual(0)
+ const override = { networkId: 'api:a', networkName: 'Home API', baseUrl: 'https://api.example.test/v1', apiKey: 'k', model: 'm' }
+ expect(await port.gridLaunch({ engine: 'claude', override, machine: { hermesSystemManaged: false }, refresh: true })).toMatchObject({
+ ok: true, override, apiBase: 'https://api.example.test/v1', launch: { env: { ANTHROPIC_MODEL: 'm' } },
+ })
+ expect(vi.mocked(refreshApiFor).mock.calls.at(-1)![0]).toBeInstanceOf(ApiConnections)
+ expect(await port.apiTarget({ connectionId: 'a', model: 'm' })).toEqual({ detail: 'This API is not saved. Add it in Models → APIs.' })
+ expect(vi.mocked(apiTargetAnswer).mock.calls.at(-1)!.slice(1)).toEqual(['a', 'm'])
+ })
+
it('codex_profiles_list: the folders this machine offers, with the ones the asker has seen; a failed scan is said', async () => {
const { ask } = setup()
expect(await ask('codex_profiles_list', { observedPaths: ['/home/me/.codex-work', 7] })).toEqual({ profiles: [{ path: '/home/me/.codex-work', label: 'Codex' }] })
diff --git a/cli/src/services/models.ts b/cli/src/services/models.ts
index 70cc167b0..1c9f74cea 100644
--- a/cli/src/services/models.ts
+++ b/cli/src/services/models.ts
@@ -16,7 +16,7 @@ import type { CoreApi, CorePorts, ModelsPort, ServiceRequest, ServiceRequests }
import { MODEL_MANAGER_ID } from '../dsh/builtinIds.js'
import { installedDsh } from '../dsh/installed.js'
import { ApiConnections, apiConnectionsRequest } from '../lib/apiConnections.js'
-import { apiModelsRequest, rememberSavedApis } from '../lib/apiModels.js'
+import { apiModelsRequest, apiTargetAnswer, refreshApiFor, rememberSavedApis } from '../lib/apiModels.js'
import { appEngineOps, scanAppModels } from '../lib/appModels.js'
import { linkCodexProfile, listCodexProfiles } from '../lib/codexProfiles.js'
import { createGridAccess, gridNamesLocal, reconcileGridAttach } from '../lib/gridAttach.js'
@@ -26,7 +26,7 @@ import { gridAvailable, managedGridPath } from '../lib/gridExec.js'
import { GridFleetRpc, parseGridFleetRequest } from '../lib/gridFleetRpc.js'
import { handOffToGrid } from '../lib/gridHandoff.js'
import { ensureGridInstalled } from '../lib/gridInstall.js'
-import type { GridLaunchOverride } from '../lib/gridLaunch.js'
+import { answerGridLaunch, type GridLaunchOverride } from '../lib/gridLaunch.js'
import { clearGridMcpUrlCache } from '../lib/gridMcpUrl.js'
import {
forgetGridModels, gridAnnotation, gridInventory, keystrokePrewarm, listAllGridModels, listGridModels, observeMachineList, onGridModelsChanged,
@@ -138,6 +138,8 @@ export function startModels(core: CoreApi, ports: CorePorts): ServiceRequests {
// for the list (after a self-update, a phone may be the only one typing).
void warmGridModels().catch(() => {})
+ // The saved APIs, a file in the data folder (lib/apiConnections.ts), read afresh by every launch on one.
+ const savedApis = new ApiConnections(core.dataDir)
ports.models = {
ensure: grid.ensure,
annotation: (target) => gridAnnotation(target),
@@ -150,6 +152,10 @@ export function startModels(core: CoreApi, ports: CorePorts): ServiceRequests {
// so the first message rarely waits on a boot (issue 03). It decides for itself whether a wake is
// worth it.
moved: (launch) => { void retargetPrewarm(launch).catch(() => {}) },
+ // The launch that points an engine at a grid or a saved API, built here for the core, which builds none
+ // (docs/design/2026-10-08-launch-port.md): a relaunch's saved API with its endpoint and key as saved now.
+ gridLaunch: async (request) => answerGridLaunch(request, refreshApiFor(savedApis)),
+ apiTarget: (request) => apiTargetAnswer(savedApis, request.connectionId, request.model),
privateGridName,
// `grid_models_changed` to the windows: the same payload `grid_models_list` answers, built from the
// pictures as they stand — no read is started to build it, so a push never causes one. Each window
diff --git a/cli/src/services/modelsProcess.spec.ts b/cli/src/services/modelsProcess.spec.ts
index 5194f0cc1..aa5428bb0 100644
--- a/cli/src/services/modelsProcess.spec.ts
+++ b/cli/src/services/modelsProcess.spec.ts
@@ -2,7 +2,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
import type { CoreApi, CorePorts, ModelsPort, ServiceRequests } from '../core/api.js'
import type { GridGlance } from '../lib/gridAnnotation.js'
import type { CoreConnection, ServiceProcessOptions } from './process.js'
-import { modelsCoreApi, runModelsService } from './modelsProcess.js'
+import type { GridLaunchAnswer, GridLaunchRequest } from '../lib/gridLaunchWire.js'
+import { gridLaunchRequestIn, modelsCoreApi, runModelsService } from './modelsProcess.js'
// The real default reaches a real socket and this process's own channel: never in a test.
vi.mock('./process.js', () => ({ runServiceProcess: vi.fn(() => ({ stop: vi.fn() })) }))
@@ -11,6 +12,7 @@ vi.mock('./models.js', () => ({ startModels: vi.fn((_core: CoreApi, ports: CoreP
const RELAY = 'https://fixture.invalid/g/net-own/relay/v1'
const LAUNCH = { networkId: 'net-own', networkName: 'mine', baseUrl: RELAY, apiKey: 'fixture-key', model: 'Small-Q4' }
+const BUILT = { env: { ANTHROPIC_BASE_URL: RELAY }, args: ['--grid'], webSearch: 'on' as const }
const glance = (state: 'awake' | 'asleep'): GridGlance => ({ id: 'net-own', view: { state, models: [{ id: 'Small-Q4' }] }, listed: true, asleep: state === 'asleep' })
/** Models that read no grid: its port, every member a fake, and the apps' requests it answers. */
@@ -22,6 +24,8 @@ function fakeModels() {
launchTarget: vi.fn(async () => LAUNCH),
moveTarget: vi.fn(async (): Promise<{ target: typeof LAUNCH } | { detail: string }> => ({ target: LAUNCH })),
moved: vi.fn(),
+ gridLaunch: vi.fn(async (request: GridLaunchRequest): Promise<GridLaunchAnswer> => ({ ok: true, launch: BUILT, override: request.override })),
+ apiTarget: vi.fn(async (): Promise<{ target: typeof LAUNCH; apiBase: string } | { detail: string }> => ({ target: LAUNCH, apiBase: RELAY })),
privateGridName: vi.fn(async () => 'mine'),
lists: vi.fn(async () => ({ plain: { gridName: 'mine' }, rowState: { gridName: 'mine', grids: [] } })),
machines: vi.fn(),
@@ -65,7 +69,7 @@ describe('models in its own process', () => {
it('reaches the core as `models`, answering the apps\' requests and the core\'s port calls, and stops with its link', () => {
const { models, options, handle, service } = setup()
expect(options).toMatchObject({ name: 'models', socketPath: '/data/daemon-1.sock', machineId: 'm', token: 't' })
- expect(Object.keys(options.requests).sort()).toEqual(['ensure', 'grid_models_list', 'launchTarget', 'lists', 'moveTarget', 'privateGridName'])
+ expect(Object.keys(options.requests).sort()).toEqual(['apiTarget', 'ensure', 'gridLaunch', 'grid_models_list', 'launchTarget', 'lists', 'moveTarget', 'privateGridName'])
expect(options.requests.grid_models_list).toBe(models.requests.grid_models_list)
handle.stop()
expect(service.stop).toHaveBeenCalled()
@@ -93,6 +97,22 @@ describe('models in its own process', () => {
expect(await options.requests.lists!({}, asker)).toEqual({ plain: { gridName: 'mine' }, rowState: { gridName: 'mine', grids: [] } })
})
+ it("builds the core's grid launches and API targets through the port, and refuses a launch it cannot read", async () => {
+ const { models, options } = setup()
+ const asker = { local: true, owner: true }
+ const machine = { hermesSystemManaged: false, opencodeMajor: 2 }
+ expect(await options.requests.gridLaunch!({ engine: 'claude', override: LAUNCH, machine, refresh: true }, asker))
+ .toEqual({ ok: true, launch: BUILT, override: LAUNCH })
+ expect(models.port.gridLaunch.mock.calls).toEqual([[{ engine: 'claude', override: LAUNCH, machine, refresh: true }]])
+ expect(await options.requests.gridLaunch!({ engine: 'claude', override: 'nope', machine }, asker))
+ .toEqual({ ok: false, error: 'INVALID_GRID', detail: 'This launch could not be read.' })
+ expect(models.port.gridLaunch).toHaveBeenCalledOnce()
+ expect(await options.requests.apiTarget!({ connectionId: 'openrouter', model: 'q' }, asker)).toEqual({ target: LAUNCH, apiBase: RELAY })
+ models.port.apiTarget.mockResolvedValueOnce({ detail: 'gone' })
+ expect(await options.requests.apiTarget!({ connectionId: 7 }, asker)).toEqual({ detail: 'gone' })
+ expect(models.port.apiTarget.mock.calls).toEqual([[{ connectionId: 'openrouter', model: 'q' }], [{ connectionId: '', model: '' }]])
+ })
+
it('does what the core tells it, and passes over what it cannot read', () => {
const { models, options } = setup()
options.onEvent!({ kind: 'prewarm', grid: { baseUrl: RELAY, model: 'Small-Q4' } })
@@ -291,3 +311,26 @@ describe('models in its own process, before it is ever connected', () => {
expect(core.query).toHaveBeenCalledWith('account', {})
})
})
+
+describe('a grid launch the core asks models to build, as models reads it', () => {
+ const machine = { hermesSystemManaged: true }
+
+ it('takes the engine, the launch, the machine and a relaunch as the core sent them', () => {
+ expect(gridLaunchRequestIn({ engine: 'codex', override: LAUNCH, machine })).toEqual({ engine: 'codex', override: LAUNCH, machine })
+ expect(gridLaunchRequestIn({ engine: 'opencode', override: LAUNCH, machine: { ...machine, opencodeMajor: null }, refresh: true }))
+ .toEqual({ engine: 'opencode', override: LAUNCH, machine: { ...machine, opencodeMajor: null }, refresh: true })
+ expect(gridLaunchRequestIn({ engine: 'opencode', override: LAUNCH, machine: { ...machine, opencodeMajor: 1 }, refresh: 'yes' }))
+ .toEqual({ engine: 'opencode', override: LAUNCH, machine: { ...machine, opencodeMajor: 1 } })
+ })
+
+ it('reads nothing it cannot trust: an unknown engine, an unreadable launch, or machine facts of the wrong shape', () => {
+ expect(gridLaunchRequestIn({ engine: 'vim', override: LAUNCH, machine })).toBeNull()
+ expect(gridLaunchRequestIn({ override: LAUNCH, machine })).toBeNull()
+ expect(gridLaunchRequestIn({ engine: 'claude', override: { networkId: 'n' }, machine })).toBeNull()
+ expect(gridLaunchRequestIn({ engine: 'claude', override: LAUNCH })).toBeNull()
+ expect(gridLaunchRequestIn({ engine: 'claude', override: LAUNCH, machine: 'here' })).toBeNull()
+ expect(gridLaunchRequestIn({ engine: 'claude', override: LAUNCH, machine: {} })).toBeNull()
+ expect(gridLaunchRequestIn({ engine: 'claude', override: LAUNCH, machine: { ...machine, opencodeMajor: 1.5 } })).toBeNull()
+ expect(gridLaunchRequestIn({ engine: 'claude', override: LAUNCH, machine: { ...machine, opencodeMajor: '2' } })).toBeNull()
+ })
+})
diff --git a/cli/src/services/modelsProcess.ts b/cli/src/services/modelsProcess.ts
index 3b274d149..f749ca59f 100644
--- a/cli/src/services/modelsProcess.ts
+++ b/cli/src/services/modelsProcess.ts
@@ -17,7 +17,8 @@
import type { CoreApi, ServiceRequests } from '../core/api.js'
import { ACCOUNT_BACKEND_OFF, CONVERSATIONS_OFF, AGENT_ACTIONS_OFF, DAEMON_UNKNOWN, DELIVERIES_OFF, emptyPorts, LANE_OFF, TERMINALS_OFF } from '../core/api.js'
import type { AgentGridTarget, GridGlance } from '../lib/gridAnnotation.js'
-import { parseGridLaunchOverride } from '../lib/gridLaunch.js'
+import { parseGridLaunchOverride, type GridLaunchRequest } from '../lib/gridLaunch.js'
+import { ENGINES, type AgentEngine } from '../engines/types.js'
import { gridGlances, onGridModelsChanged } from '../lib/gridModels.js'
import type { RuntimeModelOption } from '../lib/runtimeProfile.js'
import { startModels } from './models.js'
@@ -43,6 +44,23 @@ export interface ModelsServiceOptions {
const isRecord = (value: unknown): value is Payload => !!value && typeof value === 'object' && !Array.isArray(value)
const text = (value: unknown): string => (typeof value === 'string' ? value : '')
+/** A grid launch the core asked to have built, checked as the core checks one: the engine, the launch it sends,
+ * this machine's facts and whether it is a relaunch; null when it is not one. */
+export function gridLaunchRequestIn(payload: Record<string, unknown>): GridLaunchRequest | null {
+ const parsed = parseGridLaunchOverride(payload.override)
+ const machine = payload.machine as Record<string, unknown> | null | undefined
+ if (parsed.state !== 'ok' || !(ENGINES as readonly string[]).includes(text(payload.engine))) return null
+ if (!machine || typeof machine !== 'object' || typeof machine.hermesSystemManaged !== 'boolean') return null
+ const major = machine.opencodeMajor
+ if (major !== undefined && major !== null && !Number.isSafeInteger(major)) return null
+ return {
+ engine: payload.engine as AgentEngine,
+ override: parsed.override,
+ machine: { hermesSystemManaged: machine.hermesSystemManaged, ...(major !== undefined ? { opencodeMajor: major as number | null } : {}) },
+ ...(payload.refresh === true ? { refresh: true } : {}),
+ }
+}
+
/**
* The core API models runs on in its own process: the sign-in, the account's grid and this machine's name
* asked of the core as they are needed, an agent's Model/Effort choices likewise, and the two pushes to
@@ -157,6 +175,11 @@ export function runModelsService(options: ModelsServiceOptions): ServiceProcess
ensure: async (payload) => ({ ...await models.ensure({ ownGrid: payload.ownGrid === true }) }),
launchTarget: async (payload) => ({ target: await models.launchTarget({ model: text(payload.model), grid: text(payload.grid) }) }),
moveTarget: async (payload) => ({ ...await models.moveTarget({ gridName: text(payload.gridName) || null, model: text(payload.model) }) }),
+ gridLaunch: async (payload) => {
+ const request = gridLaunchRequestIn(payload)
+ return request ? { ...await models.gridLaunch(request) } : { ok: false, error: 'INVALID_GRID', detail: 'This launch could not be read.' }
+ },
+ apiTarget: async (payload) => ({ ...await models.apiTarget({ connectionId: text(payload.connectionId), model: text(payload.model) }) }),
privateGridName: async () => ({ name: await models.privateGridName() }),
lists: async () => ({ ...await models.lists() }),
}
diff --git a/cli/src/services/process.spec.ts b/cli/src/services/process.spec.ts
index 44b49b4e5..b1fcdabc3 100644
--- a/cli/src/services/process.spec.ts
+++ b/cli/src/services/process.spec.ts
@@ -1,8 +1,11 @@
import { EventEmitter } from 'node:events'
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import WebSocket from 'ws'
import type { MasterChannel } from '../harnessd/coreLink.js'
-import { hostServices, LEAVE_GRACE_MS, REFUSED, runServiceProcess, serviceFaults, type ServiceHostOptions, type ServiceProcessOptions } from './process.js'
+import { heldOffFile, hostServices, LEAVE_GRACE_MS, REFUSED, runServiceProcess, serviceFaults, type ServiceHostOptions, type ServiceProcessOptions } from './process.js'
/** A socket that records what it is sent, and is told what the core says. */
class FakeSocket extends EventEmitter {
@@ -407,6 +410,30 @@ describe('a service in its own process', () => {
expect(serviceFaults({}, 'search')).toEqual({ start: false, crash: false, leak: false, calls: new Set() })
})
+ it('waits to go to the core while the file a test names exists, its own only, and goes once it is gone', () => {
+ expect(heldOffFile({ HARNESSD_TEST_HOLD_CONNECT: 'models:/tmp/a:b' }, 'models')).toBe('/tmp/a:b')
+ expect(heldOffFile({ HARNESSD_TEST_HOLD_CONNECT: 'models:/tmp/a' }, 'search')).toBeNull()
+ expect(heldOffFile({ HARNESSD_TEST_HOLD_CONNECT: 'models' }, 'models')).toBeNull()
+ expect(heldOffFile({}, 'models')).toBeNull()
+ const dir = mkdtempSync(join(tmpdir(), 'held-off-'))
+ try {
+ const file = join(dir, 'hold')
+ writeFileSync(file, '')
+ const service = run({ env: { HARNESSD_TEST_HOLD_CONNECT: `search:${file}` } })
+ vi.advanceTimersByTime(1_000)
+ expect(sockets).toHaveLength(0)
+ rmSync(file)
+ vi.advanceTimersByTime(200)
+ expect(sockets).toHaveLength(1)
+ service.stop()
+ // Stopped while held: it never goes.
+ writeFileSync(file, '')
+ run({ env: { HARNESSD_TEST_HOLD_CONNECT: `search:${file}` } }).stop()
+ vi.advanceTimersByTime(1_000)
+ expect(sockets).toHaveLength(1)
+ } finally { rmSync(dir, { recursive: true, force: true }) }
+ })
+
it('fails its start when a test asks it to, before it connects, as a service whose start throws', () => {
expect(() => run({ env: { HARNESSD_TEST_FAULTS: 'search' } })).toThrow('injected fault: search')
expect(sockets).toEqual([])
diff --git a/cli/src/services/process.ts b/cli/src/services/process.ts
index 3e70b5711..8b3431556 100644
--- a/cli/src/services/process.ts
+++ b/cli/src/services/process.ts
@@ -11,6 +11,7 @@
* its own state meanwhile. It answers the requests the core routes to it, hears what the core tells it,
* and asks the core what it needs to know.
*/
+import { existsSync } from 'node:fs'
import WebSocket from 'ws'
import type { Asker, ServiceRequests } from '../core/api.js'
import { heartbeatInterval, processLoopDelay, type LoopDelay, type MasterChannel } from '../harnessd/coreLink.js'
@@ -165,6 +166,19 @@ export function hostServices(options: ServiceHostOptions): ServiceHost {
return { add: (service) => { services.push(service) }, leave }
}
+/**
+ * `HARNESSD_TEST_HOLD_CONNECT=<service>:<file>`, for the end-to-end suite: the file this service waits on before it
+ * goes to the core, for as long as it exists. A service that is running and not there yet, held exactly as long as
+ * a test needs (e2e/serviceProcesses.e2e.ts, models at boot); unset, nothing waits.
+ */
+export function heldOffFile(env: NodeJS.ProcessEnv, name: string): string | null {
+ const [service, file] = (env.HARNESSD_TEST_HOLD_CONNECT ?? '').split(/:(.*)/s)
+ return service === name && file ? file : null
+}
+
+/** How often a held-off service looks again (`heldOffFile`). */
+const HELD_OFF_POLL_MS = 200
+
/** One service in its process: its own link to the core, answering what the core routes to it. */
export function runServiceProcess(options: ServiceProcessOptions): ServiceProcess {
const env = options.env ?? process.env
@@ -278,8 +292,13 @@ export function runServiceProcess(options: ServiceProcessOptions): ServiceProces
})
}
+ const heldOff = heldOffFile(env, options.name)
// Only ever run at start and from the reconnect timer, which `stop` clears.
const dial = (): void => {
+ if (heldOff && existsSync(heldOff)) {
+ reconnectTimer = setTimeout(() => { reconnectTimer = null; dial() }, HELD_OFF_POLL_MS)
+ return
+ }
const ws = connect(`ws+unix://${options.socketPath}:/api/local-ws`)
socket = ws
ws.on('open', () => {
diff --git a/cli/src/startupOrder.spec.ts b/cli/src/startupOrder.spec.ts
index 50219aca3..6efb813c1 100644
--- a/cli/src/startupOrder.spec.ts
+++ b/cli/src/startupOrder.spec.ts
@@ -234,11 +234,14 @@ describe('the core\'s request gate (core/main.ts)', () => {
expect(yields, 'bind the relay callbacks before connect() first').toEqual([])
})
- it('opens the gate, tells the master it is ready, then says so — last', () => {
+ it('opens the gate, tells the master it is ready, says so, and only then launches what waits for a service', () => {
const ready = at('coreLink.ready()', opened)
const logged = at("console.log('[cli] ready')", ready)
const tail = source.slice(opened, from + text.length).split('\n').map((line) => line.trim()).filter(Boolean)
- expect(tail).toEqual(['backend.openRequests()', 'daemonBoot.openRequests = null', 'coreLink.ready()', "console.log('[cli] ready')"])
+ // Readiness never waits on a service: the agents the boot held for one are launched after it, in the background
+ // (core/agents/heldLaunches.ts).
+ expect(tail).toEqual(['backend.openRequests()', 'daemonBoot.openRequests = null', 'coreLink.ready()', "console.log('[cli] ready')",
+ 'void heldLaunches.restoreHeld()'])
expect(logged).toBeGreaterThan(ready)
})
})
diff --git a/cli/src/testing/gridLaunchInProcess.ts b/cli/src/testing/gridLaunchInProcess.ts
new file mode 100644
index 000000000..226f8c7b0
--- /dev/null
+++ b/cli/src/testing/gridLaunchInProcess.ts
@@ -0,0 +1,15 @@
+/**
+ * The models service's grid launch, answered in this process, for specs that build a launch with no models process
+ * running: what `services/models.ts` answers `ModelsPort.gridLaunch` with. Without saved APIs a saved-API launch is
+ * built as the spec wrote it, as `buildLaunchOverrides` built it before the launch port, so those specs pin the
+ * same launches they always did.
+ */
+import type { ApiConnections } from '../lib/apiConnections.js'
+import { refreshApiFor } from '../lib/apiModels.js'
+import { answerGridLaunch } from '../lib/gridLaunch.js'
+import type { GridLaunchAnswer, GridLaunchOverride, GridLaunchRequest } from '../lib/gridLaunchWire.js'
+
+export function gridLaunchInProcess(savedApis?: ApiConnections): (request: GridLaunchRequest) => Promise<GridLaunchAnswer> {
+ const refresh = savedApis ? refreshApiFor(savedApis) : (override: GridLaunchOverride) => ({ override })
+ return async (request) => answerGridLaunch(request, refresh)
+}
diff --git a/cli/src/testing/launchShapes.ts b/cli/src/testing/launchShapes.ts
new file mode 100644
index 000000000..c051f51b9
--- /dev/null
+++ b/cli/src/testing/launchShapes.ts
@@ -0,0 +1,89 @@
+/**
+ * The core's launch paths, wired as core/main.ts wires them, over a machine a spec chooses: create, every relaunch
+ * (restart, resume, restore and fork share `relaunchOverrides`), retarget's check before it touches a pane and the
+ * line it logs after, the socket's saved-API target, the variables a pane leaving a grid has cleared, and the
+ * engines a model picker may offer a grid model to. For engines/launchShapes.golden.spec.ts, which pins what each
+ * launch shape starts with and writes. The composition, not the spec, follows where each part of a launch is built
+ * (docs/design/2026-10-08-launch-port.md).
+ */
+import { createLaunchHelpers, gridLaunchThrough } from '../core/agents/launch.js'
+import { createAgentCreator, type CreateAgentDeps } from '../core/agents/create.js'
+import { gridLaunchAnswerIn } from '../core/modelsLink.js'
+import { ApiConnections } from '../lib/apiConnections.js'
+import { prepareApiInstructions } from '../lib/apiInstructions.js'
+import { apiTargetAnswer } from '../lib/apiModels.js'
+import { writeGridConfigDir } from '../lib/gridConfigDir.js'
+import { describeGridLaunch, gridCapableEngines, gridEnvVarNames, type GridLaunchMachine } from '../lib/gridLaunchWire.js'
+import { validateLaunchOverrides, type LaunchOverrides, type LaunchOverridesDeps, type LaunchSource } from '../lib/launchOverrides.js'
+import type { RegisteredSession } from '../lib/registry.js'
+import type { AgentEngine } from '../engines/types.js'
+import { gridLaunchRequestIn } from '../services/modelsProcess.js'
+import { gridLaunchInProcess } from './gridLaunchInProcess.js'
+
+export interface LaunchWorld {
+ /** The data folder: saved APIs, and the config directories written for file-configured engines. */
+ dataDir: string
+ machine: () => GridLaunchMachine
+ tmuxSupportsSessionEnv: () => Promise<boolean>
+ /** A Codex `config.toml`, as the own-login provider reads it. */
+ readCodexConfig: (path: string) => string | null
+ /** What a launch records on its row once built. */
+ setGridLaunch: (agentId: string, record: unknown) => void
+}
+
+/** What `create` needs besides the launch: the spec's stubs for the pane, the registry and the rest. */
+export type CreateRest = Omit<CreateAgentDeps, 'gridLaunchMachine' | 'prepareApiTools' | 'buildGridLaunch'>
+
+export function launchShapes(world: LaunchWorld) {
+ const savedApis = new ApiConnections(world.dataDir)
+ const prepareApiTools = (cwd: string | null | undefined, engine: string): void => {
+ if (!cwd) return
+ try { prepareApiInstructions(savedApis, cwd, engine) }
+ catch { console.warn('[apis] Tool instructions could not be added. Saved connections remain available through harness api.') }
+ }
+ // The models service's side of the launch port: what its port answers the core with (services/models.ts), across
+ // the process boundary as models in its own process is asked (core/modelsLink.ts → services/modelsProcess.ts),
+ // the request and the answer each crossing as JSON and checked as the far side checks it, behind what the core
+ // asks it through (core/agents/launch.ts `gridLaunchThrough`).
+ const models = gridLaunchInProcess(savedApis)
+ const wire = (value: unknown): Record<string, unknown> => JSON.parse(JSON.stringify(value)) as Record<string, unknown>
+ const gridLaunch = gridLaunchThrough(() => ({
+ gridLaunch: async (request) => {
+ const asked = gridLaunchRequestIn(wire(request))
+ if (!asked) throw new Error('models could not read the launch it was asked for')
+ const answer = gridLaunchAnswerIn(wire(await models(asked)))
+ if (!answer) throw new Error('the core could not read the launch models built')
+ return answer
+ },
+ }))
+ const launchOverridesDeps: LaunchOverridesDeps = {
+ machine: world.machine,
+ gridLaunch,
+ writeGridConfigDir,
+ tmuxSupportsSessionEnv: world.tmuxSupportsSessionEnv,
+ installCodexHooks: () => {},
+ readCodexConfig: world.readCodexConfig,
+ }
+ const helpers = createLaunchHelpers({
+ prepareApiTools, launchOverridesDeps,
+ setGridLaunch: world.setGridLaunch as never, setTail: () => {},
+ })
+ return {
+ create: (rest: CreateRest) => createAgentCreator({ ...rest, gridLaunchMachine: world.machine, buildGridLaunch: gridLaunch, prepareApiTools }),
+ relaunch: (session: RegisteredSession, source?: LaunchSource) => helpers.relaunchOverrides(session, source),
+ validate: (engine: AgentEngine, source: LaunchSource) => validateLaunchOverrides(launchOverridesDeps, engine, source),
+ /** The line retarget logs once a move onto a grid succeeded. */
+ retargetLine: (engine: AgentEngine, overrides: LaunchOverrides): string | null => overrides.gridLaunchRecord
+ ? describeGridLaunch(engine, overrides.gridLaunchRecord.override, overrides.gridLaunchRecord.webSearch)
+ : null,
+ /** The socket's saved-API target: the launch, or the sentence the person reads. */
+ apiTarget: async (connectionId: string, model: string) => {
+ const answer = await apiTargetAnswer(savedApis, connectionId, model)
+ if ('detail' in answer) throw new Error(answer.detail)
+ return answer.target
+ },
+ leavingGrid: (engine: AgentEngine) => gridEnvVarNames(engine),
+ gridCapable: () => gridCapableEngines(),
+ apiTools: prepareApiTools,
+ }
+}
diff --git a/docs/design/2026-10-08-launch-port.md b/docs/design/2026-10-08-launch-port.md
new file mode 100644
index 000000000..6eab6916d
--- /dev/null
+++ b/docs/design/2026-10-08-launch-port.md
@@ -0,0 +1,217 @@
+# The launch port
+
+The owner's item 4. The features a launch can carry — a grid model, a saved API, a harness package (DSH) — take
+their own code out of the core and hand their part of a launch to it through one port. The core still owns
+spawning the pane, assembling the argv and the session record. The service that owns a feature contributes that
+feature's launch settings before the spawn: env, args, files to write, MCP configuration. A launch that needs a
+service that is down fails at once, with a clear error. A launch that does not need it never asks it.
+
+At `9f8435573` the core loads about 3,300 lines of this:
+
+| | Files | Lines |
+| --- | --- | --- |
+| Grid | `lib/gridLaunch.ts`, `lib/gridWebMcp.ts`, `lib/gridAssignment.ts` | 1,854 |
+| API connections | `lib/apiConnections.ts`, `lib/apiModels.ts`, `lib/apiInstructions.ts` | 377 |
+| DSH | `dsh/runtime.ts`, `manifest.ts`, `materialize.ts`, `shell.ts`, `installed.ts` | 872 |
+
+## What stays in the core
+
+- **Spawning and assembling.** The pane, the argv (`lib/engineLaunch.ts`), the order of the parts (grid or own
+ login, then DSH, then SCM, then the named agent), and the session record (`gridLaunch`, `dsh`, `dshRuntime`).
+- **The checks that need nothing from a service.** Whether this tmux can give a pane its own environment, and
+ whether the engine can be pointed at a grid at all.
+- **Writing what a service hands it.** A file-configured engine's directory in the core's data folder
+ (`lib/gridConfigDir.ts`), keyed on the agent as today. Services return files, and the core writes them.
+- **The wire.** Parsing and checking a grid launch the desktop sends or the registry kept (`parseGridLaunchOverride`,
+ its types, `isApiLaunch`). These are small and are what the core validates its input with.
+- **Data that every launch reads.** The vendor variables a grid launch clears, the variables each engine's grid
+ launch sets (cleared when an agent leaves a grid, which needs no service), and the engines a grid can run. Each
+ is declared in the core. A spec pins it equal to what the service's builders produce.
+
+## The port
+
+Each owner adds launch methods to its existing port in `core/api.ts`, so the transport, waits and fallbacks are
+the ones every service call already uses (`core/serviceLinks.ts` `call`, `LONG_ANSWERS`, `PortFallbacks`):
+
+| Owner | Already owns | Contributes |
+| --- | --- | --- |
+| Models (`services/models.ts`, its own process) | grid, the saved APIs | **Grid launch:** an engine's settings for a grid or API launch (env, args, config files, web-search MCP wiring, session model), with an API's key as saved now. **API target:** where an agent moved onto a saved API's model sends its inference. **Grid assignment:** which grid each running agent is on, and the saved APIs' endpoints that say so. |
+| Store (`services/store.ts`, its own process) | installing and updating harness packages | **DSH launch:** the workspace materialized at create, and the package's env and args at every launch. |
+
+**A launch never hangs on a service.** A call waits at most its declared bound, and a service that is down
+answers `SERVICE_UNAVAILABLE` at once. The launch then fails with the feature's error:
+
+- `GRID_UNAVAILABLE`: "The models service is not running, so this agent cannot be put on grid `<name>`. Try again in a
+ moment.";
+- `API_UNAVAILABLE` for a saved API;
+- `DSH_UNAVAILABLE` for a harness package.
+
+An agent on its own login, with no package, asks no service. A grid assignment that cannot be read is unknown,
+and the row keeps what it had, as a failed process read does today.
+
+A launch someone is waiting on (create, retarget, restart, fork, the socket's API selection) is refused at once.
+A launch nobody asked for, a restore, is never refused for a service: the agent is **held** until the service is
+ready (next section).
+
+## Held until the service is ready
+
+The owner's bar is safe, reliable and dependable. A restore after a reboot must bring every agent back, and the core
+must report ready on time whatever a service does. Built once, generically (`core/agents/heldLaunches.ts`,
+`lib/restoreAgents.ts`). (L3) reuses it for the Store.
+
+- **(a) Readiness never waits on a service.** The boot's restore launches agents on their own login as before. An
+ agent whose launch asks a service (`needs`: a grid or a saved API asks `models`) is not launched then: it is put in
+ a pane of its own, in the boot's one registry transaction, running only a line that says what it waits for
+ (`heldPaneArgv`), and its row's launch is `{ state: 'held', service, detail }`. After `coreLink.ready()` a second
+ pass launches the held agents into those panes (`respawn`), outside any registry transaction.
+- **(b) A service that cannot be asked never fails an agent.** A launch that answers `unavailable: 'models'` (core
+ `gridLaunchThrough`, via `launchOverrides.ts`) holds the agent instead of failing it. Held is never `failed`, never
+ skipped by the next restore, and never archived by discovery: its pane is alive and runs no engine, and the row is
+ inactive. It is launched when the service connects (serviceLinks `connected` → `restoreHeld(service)`), unless the
+ person stopped or closed it meanwhile (the row is then gone or no longer held). A person's restart of a held agent
+ launches it now (`restart.ts` → `restartHeld`).
+- **(c) One pass, one deadline.** After the first unavailable answer in a pass, every later agent that needs the
+ same service is held without asking. A pass waits on a service at most once, for that call's bound.
+- **Why a pane, not no pane.** Every registry row must keep a pane (`strictPersistedRow`), and an older release reads
+ the same file after a rollback. A held row that kept its dead pane id could collide with a pane the new tmux server
+ hands out (`%0` again), and the registry would refuse to save. A waiting pane opened in the boot's transaction
+ cannot collide, keeps discovery from retiring the row, and shows the person the reason.
+- **What an older app shows.** It reads an unknown launch state as ready, so a held agent shows offline with its
+ waiting pane. The reason is in the pane and in the row (`launch.detail`).
+- **Proof.** `lib/restoreAgents.spec.ts` (held at boot without asking, launched into its pane outside a transaction,
+ one ask per pass, never skipped or archived, a fresh relaunch held), `core/agents/heldLaunches.spec.ts` (the boot
+ gate, passes by service, one at a time, restart, stopped or closed meanwhile), and end to end
+ (`e2e/serviceProcesses.e2e.ts`): two grid agents across a reboot with models killed, and with models hung. The core
+ reports ready within 15 s, both agents are held, never failed or archived, and both come back with their
+ conversations once models is there. `HARNESSD_TEST_HOLD_CONNECT` holds a service off the core while a file
+ exists, for those tests.
+
+## Sub-batches
+
+| | Scope | Leaves the core |
+| --- | --- | --- |
+| **(L1) Grid and API launches** | `ModelsPort` gains the grid launch and the API target. Callers: create, every relaunch (restart, resume, restore, fork), retarget's check before it touches the pane, and the socket's `api` selection. | the grid launch builders, `gridWebMcp.ts`, `apiModels.ts`: about 1,750 lines |
+| **(L2) Grid assignment** | Discovery, restart and retarget ask models for the assignments of the processes that carry grid-launch markers, in one call a pass. The saved APIs' endpoints are models'. The saved-API instructions stay in the core. | most of `gridAssignment.ts`: about 290 lines |
+| **(L3) DSH launches** | `StorePort` gains the DSH launch. Callers: create (materialize, then the env and args), every relaunch, fork. The core keeps the installed index and its checks. | `dsh/runtime.ts`, `materialize.ts`, `shell.ts`: about 500 lines |
+
+Each sub-batch is its own PR, stacked, each green on its own.
+
+## Proof, for each
+
+- **A golden record first, in its own commit, from the former code.** It covers every launch shape that uses the
+ feature: create, restart, resume, restore, fork and retarget, on each engine that takes it. Each records the
+ argv, the env, the cleared variables, the files written with their bytes, the log lines, and every refusal. It
+ runs on darwin and on linux, also under `TZ=UTC TMPDIR=/tmp`, through a composition that stays fixed across the
+ move. Mutations of the moved code must fail it.
+- **The models service down at launch, end to end.** A plain Claude Code and Codex launch works. A grid launch
+ fails at once with `GRID_UNAVAILABLE`, and the agents already running go on.
+- **The core's closure, before and after**, with `architecture.spec.ts` listing the moved files as edge files.
+
+## Coordination
+
+(o6) moves OpenCode's version check and the other engines' launch data out of `core/agents/{launches,create}.ts`
+and `engines/launches.ts`. The grid block in `create.ts` sits beside them, so small conflicts are expected. Both
+sides keep their lines.
+
+## (L1) as built
+
+- **The wire stays, the builders go.** `lib/gridLaunchWire.ts` (473 lines) is what the core checks a launch with
+ and reads at every launch: `GridLaunchOverride` and its parser, `isApiLaunch`, the vendor variables a grid
+ launch clears, the variables each engine's grid launch sets, the engines a grid can run, and the line a grid
+ launch is logged with (the core logs it from the launch it holds: create's, or the record a relaunch built).
+ `lib/gridLaunch.ts` keeps the contracts and builds; `contractEnvVarNames` and `contractEngines` are what the
+ declared lists are held equal to (`lib/gridLaunch.spec.ts`).
+- **One question, one answer.** `ModelsPort.gridLaunch({ engine, override, machine, refresh })` answers the launch,
+ the override it was built from (a relaunch's saved API as saved now) and the endpoint of a saved API it read;
+ or the refusal. `ModelsPort.apiTarget({ connectionId, model })` answers the socket's `api` selection. Both take
+ the half-minute bound every service call has (`LONG_ANSWERS` lists neither).
+- **Down is a refusal.** `core/agents/launch.ts` `gridLaunchThrough` turns anything but an answer into
+ `GRID_UNAVAILABLE` (`API_UNAVAILABLE` for a saved API): "The models service is not running, so claude cannot be
+ put on Home grid. Try again in a moment." The socket's `api` selection answers `API_UNAVAILABLE` likewise. A
+ launch with no grid never asks, so it never starts models (on demand) either. The refusal names the service
+ (`unavailable: 'models'`), which a restore reads to hold the agent instead (above).
+- **From the review.**
+ - A create of a harness on a grid asks models before the workspace is laid out or trusted, so a refused create
+ leaves the folder as it was.
+ - `GRID_CONFLICTING_ENV_VARS` is pinned to what the contracts set, with each exception named.
+ - A socket spec fails if the API selection loses the target or the endpoint it remembers.
+- **What the core still remembers.** A saved API's endpoint an answer carries is added to the core's grid
+ assignment (`rememberApiBase`), as when the core read the store itself. The store stays in the core until (L2).
+- **Proof.** The golden (`engines/launchShapes.golden.spec.ts`, recorded first from the former code) passes
+ unchanged on darwin and linux, also under `TZ=UTC TMPDIR=/tmp`, with every grid launch crossing the process
+ boundary as JSON and checked as each side checks it (`testing/launchShapes.ts`); so does the earlier launch
+ argv golden. Sixteen mutations of the moved wiring each fail a golden or a spec. End to end, models killed:
+ Claude Code and Codex on their own login launch and take turns; a create, a restart and a retarget on a grid,
+ and a retarget onto a saved API, are refused at once; the agent on the grid keeps running; and its restart
+ works once models is back (`e2e/serviceProcesses.e2e.ts`).
+- **Closure** (`core/main.ts`): 67,045 lines in 370 files before, 65,858 in 367 after. `gridLaunch.ts` (1,121),
+ `gridWebMcp.ts` (446), `apiModels.ts` (171) and `codingContext.ts` (12) left; `gridLaunchWire.ts` (473) came
+ in. `architecture.spec.ts` lists the three as edge files.
+
+## (L2) and (L3): decisions, and where the work stands
+
+The owner's decisions, through the coordinator. Line count is "just a number"; what matters is a good
+architecture: safe, reliable, dependable.
+
+### (L3) Harness packages (DSH): next
+
+- **Decided.**
+ - A restore of a harness agent goes through the held mechanism above with `service: 'store'`. The core never
+ waits for the Store before it is ready. An agent the Store cannot prepare is never launched unprepared: it is
+ held, with the reason, and launched once the Store says it is ready (the Store's `prepared` notice,
+ core/storeLink.ts, or its `connected`), unless the person stopped or closed it. A manual restart works too.
+ - The coordinator's earlier "wait up to 30 s for the Store at boot" is superseded by rule (a): the wait moves to the
+ pass after ready.
+ - Pin the never-launched-unprepared rule with a spec, and add an e2e with the Store killed.
+- **Recorded.** The golden, from the code as it stood after (L1), is on branch `claude-recovery/launch-port-dsh`
+ (pushed, no PR): `engines/dshLaunchShapes.golden.spec.ts` and its fixture. It has 61 cases (create 27, relaunch 25,
+ fork 9) across the harness adapters, with the workspace files and their bytes, folder trust, the init asked for,
+ logs and refusals. It gives the same result run after run and under `TZ=UTC TMPDIR=/tmp`.
+ - **Re-record it before L3's move.** Its commit came before two changes on this PR: `create.ts` now asks models
+ before it lays a workspace out, and restore defers service launches. Rebase that branch on this PR's head, run
+ `RECORD_DSH_LAUNCH_SHAPES_GOLDEN=1`, and check that the only differences are those two (the DSH + grid create's
+ log order).
+- **Design for the move, already drafted.** It is not on any branch; rebuild it from this list.
+ - `dsh/launchWire.ts` (core): `DshMaterializeRequest/Answer`, `DshLaunchRequest/Answer` (with `forkOf` and `thrown`,
+ the text a relaunch always gave), and `dshUnavailable(name)`. Make that refusal carry `unavailable: 'store'`, as
+ `gridUnavailable` carries `'models'`.
+ - `StorePort { dshMaterialize, dshLaunch }`, `STORE_FALLBACKS` (`later(FAIL)`), `STORE_OFF`, and `store` in
+ `CorePorts`. `LONG_ANSWERS.store.dshMaterialize = 6 min`: the init is given 5.
+ - `services/storeLaunch.ts` (`storeLaunchPort`, built on `materializeWorkspace`, `forkRuntimeKey` and
+ `prepareHarnessLaunch`). `services/storeProcess.ts` answers it as port calls (`dshMaterializeRequestIn`,
+ `dshLaunchRequestIn`). `startStoreInCore(core, ports)` fills `ports.store` in-process. `core/storeLink.ts` gains
+ `port` (`dshMaterializeAnswerIn`, `dshLaunchAnswerIn`) and `onReady`.
+ - `core/agents/dshThrough.ts`: `materialize` and `launch` (unavailable → `DSH_UNAVAILABLE`), and `relaunch` for
+ `launchOverrides.ts`, whose `dshLaunch` dep becomes async. A refusal ends the launch. Keep the
+ not-installed log line in the core.
+ - `create.ts`, `fork.ts` and `main.ts` ask through it. `incompatibleHarnessEngine` moves to `dsh/compatibility.ts`.
+ `harnessLaunchOrRefusal` goes. `adapters.ts` stays in the core: `scm/scmProjects.ts` reads
+ `PROJECT_INSTRUCTION_FILES`.
+ - Restore: `needs: (entry) => entry.gridLaunch ? 'models' : entry.dsh ? 'store' : null`. A grid harness needs both:
+ hold for `models` first. Then wire `storeLink.onReady` → `restoreHeld('store')`.
+ - Proof: the golden passes unchanged, with every Store answer crossing the wire as JSON. Mutations; 100% core; the
+ e2e with the Store killed (its process is the viewers', `harnessd-viewers`).
+
+### (L2) Grid assignment: after (L3)
+
+- **Decided.**
+ - **No cache.** Keep today's recognition exactly: every pass classifies again. Models staying up while a grid agent
+ exists is fine, because those agents need it anyway.
+ - **Ask models only for processes that carry grid-launch markers.** These are the engine's endpoint variable
+ (`ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL` for Hermes, `GROK_MODELS_BASE_URL`, `COPILOT_PROVIDER_BASE_URL`), Pi's
+ `PI_CODING_AGENT_DIR`, OpenCode's `OPENCODE_CONFIG`, or a `model_providers.….base_url` argument. Any other
+ process is on no grid, which is what the classifier answers today. Declare the markers in the wire and pin them
+ to the classifier with a spec. Send only the variables the classifier reads, never a key.
+ - **Never wait, never clear.** If models is down or slow, discovery and binding go ahead without waiting. The
+ assignment shows as unknown (`undefined`) or keeps its last known value; it is never cleared. Spec both.
+ - **The saved-API instructions stay in the core,** which reads the list of saved APIs (no keys). A launch never
+ depends on models for them and gains no new silent failure. Nothing changes there beyond what the port needs.
+- **Next steps.**
+ - `ModelsPort.gridAssignments(processes)`, one call a discovery pass, restart and retarget (`probeGridAssignment`
+ callers: `lib/terminalAgentDiscovery.ts`, `core/agents/restart.ts`, `core/agents/retarget.ts`), bounded by the call's
+ wait.
+ - The saved APIs' endpoints (`rememberApiBase`, `rememberSavedApis`, the socket's and `gridLaunchThrough`'s
+ `apiBase`) move to models with the classifier.
+ - A golden of every assignment shape first, from the former code (env, argv, Pi's and OpenCode's config files, a
+ saved API's endpoint, the router id), then the move. Specs for down and slow models, and an e2e with models
+ killed during discovery.