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.

Model picker + native Models menu shared grids

Timceb7104e3a61
diff --git a/cli/build-bundle.mjs b/cli/build-bundle.mjs
index e9825ad0c..717afc76a 100644
--- a/cli/build-bundle.mjs
+++ b/cli/build-bundle.mjs
@@ -20,15 +20,6 @@ const version =
// The bundled registry (the store/ folders and store/registry at the repo root) — see src/dsh/registry.ts.
const dshRegistry = JSON.stringify(readDshRegistry(new URL('../store', import.meta.url)))
-// The Harness Compute skill and its opencode agent definition, embedded the same way — see
-// src/lib/harnessComputeSkill.ts. INSIDE cli.js, not beside it: this build ships one file (plus
-// notify.mjs), and a `dist/skills/` laid down next to it reached no machine — upload-cli.sh,
-// install.sh and the self-updater all move cli.js and notify.mjs and nothing else.
-const harnessSkills = JSON.stringify(Object.fromEntries(
- ['harness-compute.md', 'harness-compute.agent.md']
- .map((name) => [name, readFileSync(new URL(`../docs/skills/${name}`, import.meta.url), 'utf8')]),
-))
-
// Start clean so no stale per-file `dist/*.js` / sourcemaps leak into the release artifact.
rmSync('dist', { recursive: true, force: true })
@@ -43,7 +34,6 @@ await esbuild.build({
define: {
__ADAPTER_VERSION__: JSON.stringify(version),
__DSH_REGISTRY__: JSON.stringify(dshRegistry),
- __HARNESS_SKILLS__: JSON.stringify(harnessSkills),
},
// The copyright line is MIT's one condition — it has to travel with the copy the user actually
// receives, and the published bundle IS that copy (upload-cli.sh ships `cli.js` and `notify.mjs`,
@@ -61,4 +51,4 @@ await esbuild.build({
copyFileSync('hook/notify.mjs', 'dist/notify.mjs')
-console.log(`✓ Bundled dist/cli.js (v${version}, Harness Compute skill embedded) + dist/notify.mjs`)
+console.log(`✓ Bundled dist/cli.js (v${version}) + dist/notify.mjs`)
diff --git a/cli/build.mjs b/cli/build.mjs
index 9d01bc4a1..2d42cc4a2 100644
--- a/cli/build.mjs
+++ b/cli/build.mjs
@@ -8,11 +8,6 @@ import { readDshRegistry } from './scripts/lib/dshRegistry.mjs'
const version = JSON.parse(readFileSync('package.json', 'utf8')).version
// The bundled registry (the store/ folders and store/registry at the repo root) — see src/dsh/registry.ts.
const dshRegistry = JSON.stringify(readDshRegistry(join('..', 'store')))
-// The Harness Compute skill docs, embedded as build-bundle.mjs embeds them — see src/lib/harnessComputeSkill.ts.
-const harnessSkills = JSON.stringify(Object.fromEntries(
- ['harness-compute.md', 'harness-compute.agent.md']
- .map((name) => [name, readFileSync(join('..', 'docs', 'skills', name), 'utf8')]),
-))
function getAllTsFiles(dir, fileList = []) {
const files = readdirSync(dir)
@@ -44,7 +39,6 @@ try {
define: {
__ADAPTER_VERSION__: JSON.stringify(version),
__DSH_REGISTRY__: JSON.stringify(dshRegistry),
- __HARNESS_SKILLS__: JSON.stringify(harnessSkills),
},
logLevel: 'info',
})
diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.ts
index e6ace3d02..6c7b80c7e 100644
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@ -32,7 +32,7 @@ import { linkCodexProfile, listCodexProfiles } from './lib/codexProfiles.js'
import { gridCliPresence } from './lib/gridExec.js'
import { GridFleetRpc, GRID_FLEET_PROTOCOL, GRID_FLEET_MAX_TIMEOUT_MS, parseGridFleetRequest } from './lib/gridFleetRpc.js'
import { gridCapableEngines, parseGridLaunchOverride, type GridLaunchOverride } from './lib/gridLaunch.js'
-import { listGridModels, resolveGridTarget } from './lib/gridModels.js'
+import { listAllGridModels, resolveGridTarget } from './lib/gridModels.js'
import { deriveHarnessGridName } from './lib/gridDerive.js'
import { AGENT_NAME_RE, FirstPromptUnsupportedError, MAX_FIRST_PROMPT_CHARS, NamedAgentUnsupportedError, permissionModeApproves, permissionModeFlags, supportsFirstPrompt, supportsNamedAgent } from './lib/engineLaunch.js'
import { readAccountUsage, type AccountUsageReading } from './lib/accountUsage.js'
@@ -1783,12 +1783,14 @@ export class BackendSocket {
}
case 'grid_models_list': {
- // Only the account's OWN private grid: the picker is "models my machines serve", not a
- // catalogue of every grid this computer's `grid` CLI happens to be signed into.
+ // Every grid this computer is signed into, in sections, the account's own first. `gridName`
+ // and `models` keep naming the own grid alone, for an app that predates `grids`.
const gridName = await this.resolveGridName()
+ const grids = await listAllGridModels(gridName)
reply(type, requestId, {
gridName,
- models: await listGridModels(gridName),
+ models: grids.find((g) => g.own)?.models ?? [],
+ grids,
// Which engines a Local model can be offered to at all. Static per CLI version — it is
// the set of launch contracts in `gridLaunch.ts` — and answered here, beside the list,
// so the picker can say "Cursor runs only on its own login" instead of offering a row
@@ -2190,7 +2192,12 @@ export class BackendSocket {
// not know. A client that sends the full `grid` object still works unchanged.
const picked = typeof payload.gridModel === 'string' ? payload.gridModel : ''
if (picked && payload.grid === undefined && !clear) {
- const resolved = await resolveGridTarget(await this.resolveGridName(), picked)
+ // The grid the model was picked FROM, when the picker says (a shared grid's section);
+ // the account's own grid otherwise, as before.
+ const pickedGrid = typeof payload.gridName === 'string' && payload.gridName.trim()
+ ? payload.gridName.trim()
+ : await this.resolveGridName()
+ const resolved = await resolveGridTarget(pickedGrid, picked)
if (!resolved) {
reply(type, requestId, { error: 'GRID_UNAVAILABLE', detail: 'Could not read this machine\'s grid endpoint.' })
return
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 79c2aa086..c11827538 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -46,7 +46,6 @@ import { DeviceFleet } from './device/deviceFleet.js'
import { registry, projectDisplayName, type RegisteredSession } from './lib/registry.js'
import { engineSessionTitle } from './lib/sessionTitle.js'
import { installAmpPlugin, installCodexHooks, installCommandCodeHooks, installCursorHooks, installDevinHooks, installGrokHooks, installAgyHooks, installCopilotHooks, installHermesHooks, installKiloPlugin, installOpencodePlugin, installPiExtension, installSessionHooks } from './lib/hooks.js'
-import { installOpencodeHarnessComputeSkill } from './lib/harnessComputeSkill.js'
import { PID_FILE, daemonPort, isAlive, isDaemonRunning, readPid } from './lib/daemonState.js'
import {
BIND_WAIT_MS, connectFailure, defaultLaunchDeps, removePidFileIf, waitForBind, waitForReady,
@@ -3730,9 +3729,8 @@ async function runForeground(session: AuthSession): Promise<void> {
installCodexHooks(hookPort)
installCursorHooks(hookPort)
installOpencodePlugin(hookPort)
- installOpencodeHarnessComputeSkill()
- // The `grid` CLI the Harness Compute skill shells out to, for a machine that signed in before
- // this existed or whose sign-in could not fetch it. In the background: a download must not hold
+ // The `grid` CLI the Grid harness shells out to, for a machine that signed in before this
+ // existed or whose sign-in could not fetch it. In the background: a download must not hold
// the daemon's own start, and nothing here waits on it.
void ensureGridInstalled().then((result) => {
if (result.status !== 'present') console.log(`[grid] ${result.message}`)
diff --git a/cli/src/config/env.ts b/cli/src/config/env.ts
index 696cb45e7..0bf2f2999 100644
--- a/cli/src/config/env.ts
+++ b/cli/src/config/env.ts
@@ -168,17 +168,6 @@ const envSchema = z.object({
OPENCODE_PLUGIN_DIR: z
.string()
.default(join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'opencode', 'plugin')),
- // OpenCode skills dir (honors XDG_CONFIG_HOME) — where the adapter drops the Harness Compute
- // skill, so any opencode session can help start/use a local model without being told what the
- // underlying CLI it shells out to is called.
- OPENCODE_SKILL_DIR: z
- .string()
- .default(join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'opencode', 'skills')),
- // OpenCode agents dir (honors XDG_CONFIG_HOME) — where the adapter drops the `harness-compute` agent
- // definition, so `opencode --agent harness-compute` opens a pane AS the agent that starts a local model.
- OPENCODE_AGENT_DIR: z
- .string()
- .default(join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'opencode', 'agents')),
// Kilo state root — the SQLite store lives at <KILO_DATA_DIR>/kilo.db. Kilo is an opencode fork and
// keeps the same layout, but NOT the same overrides: measured on 7.4.20 via `kilo debug paths`, it
// honours XDG_DATA_HOME and ignores both `KILO_DATA_DIR` and `OPENCODE_DATA_DIR`. So this variable
diff --git a/cli/src/lib/gridDerive.ts b/cli/src/lib/gridDerive.ts
index 2964ff5bc..c29b33998 100644
--- a/cli/src/lib/gridDerive.ts
+++ b/cli/src/lib/gridDerive.ts
@@ -5,8 +5,8 @@
* `backendSocket.ts`); that is the source of truth. But a backend that predates the route pushes
* nothing, and then every picker on every pane was empty while `grid models <name>` listed the
* model fine — the daemon knew how to ask, just not what to ask about. The name is recognisable
- * without asking anyone, by the same rule the Harness Compute skill gives its agents
- * (`docs/skills/harness-compute.md`, "Which grid"): the signed-in email's local part, lowercased,
+ * without asking anyone, by the same rule the Grid harness gives its agent
+ * (`store/agents/autonomous-grid`, "Which grid"): the signed-in email's local part, lowercased,
* runs of non-alphanumerics folded to `-`, followed by `-` and eight hex digits, of type
* `permissioned-public`. Exactly one grid this computer is signed into matches, or the answer is
* null — never a guess, because names are global and a wrong one is someone else's grid.
diff --git a/cli/src/lib/gridInstall.ts b/cli/src/lib/gridInstall.ts
index 6a553d96f..07c0a6e25 100644
--- a/cli/src/lib/gridInstall.ts
+++ b/cli/src/lib/gridInstall.ts
@@ -3,8 +3,8 @@
*
* `harness login` used to CHECK for `grid` and, finding none, print "install the grid CLI yourself"
* and skip the grid half of sign-in. Every fresh install — a new machine, a colleague's laptop —
- * landed there, and everything the Harness Compute skill does shells out to `grid`, so on those
- * machines the Model manager could only report that nothing was installed. The plan's answer
+ * landed there, and everything the Grid harness does shells out to `grid`, so on those
+ * machines the Grid harness could only report that nothing was installed. The plan's answer
* (`docs/plans/2026-09-14-004-harness-grid-plan.md`, Change 2c) is a signed, pinned managed
* runtime, which is release-pipeline work nobody has done. This is the interim that closes the gap
* today: run the installer grid itself publishes and maintains, `https://grid.autonomous.ai/install.sh`
diff --git a/cli/src/lib/gridModels.ts b/cli/src/lib/gridModels.ts
index 53ab8103d..a18151326 100644
--- a/cli/src/lib/gridModels.ts
+++ b/cli/src/lib/gridModels.ts
@@ -83,6 +83,45 @@ export async function listGridModels(gridName: string | null): Promise<GridModel
return models
}
+/** One grid this computer is signed into, with what it serves — the picker's section. */
+export interface GridSection {
+ /** The grid's name as `grid ls` prints it. */
+ name: string
+ /** `permissioned-public` is the account's own private grid; the others are shared. */
+ type: string
+ /** True for the account's private grid — the picker labels that one "Local". */
+ own: boolean
+ models: GridModel[]
+}
+
+/**
+ * Every grid this computer is signed into, each with its live models, own grid first.
+ *
+ * The picker used to ask only the private grid ("models my machines serve"). A person in a
+ * shared grid (a team's, a company's) has models there they can switch an agent to just the
+ * same, and had to leave the app to find out. So all of them, in sections, the private one first
+ * and marked so the app can call it Local. Listed concurrently: each grid costs a `grid models`
+ * spawn and a relay round trip, and three of them one after another was the whole of what a
+ * person waited through. A grid that fails to answer is an empty section, not a missing one.
+ */
+export async function listAllGridModels(ownGridName: string | null): Promise<GridSection[]> {
+ const { value: rows } = await gridJson<Array<{ grid?: unknown; type?: unknown }>>(['--remote', 'ls'])
+ if (!Array.isArray(rows)) {
+ return ownGridName ? [{ name: ownGridName, type: 'permissioned-public', own: true, models: await listGridModels(ownGridName) }] : []
+ }
+ const grids = rows
+ .filter((row): row is { grid: string; type?: unknown } => typeof row.grid === 'string' && row.grid.trim().length > 0)
+ .map((row) => ({ name: row.grid.trim(), type: typeof row.type === 'string' ? row.type : '' }))
+ const sections = await Promise.all(grids.map(async (grid) => ({
+ name: grid.name,
+ type: grid.type,
+ own: grid.name === ownGridName,
+ models: await listGridModels(grid.name),
+ })))
+ sections.sort((a, b) => Number(b.own) - Number(a.own))
+ return sections
+}
+
/**
* The last answer for a grid, for a few seconds.
*
diff --git a/cli/src/lib/harnessComputeSkill.spec.ts b/cli/src/lib/harnessComputeSkill.spec.ts
deleted file mode 100644
index 946b2f484..000000000
--- a/cli/src/lib/harnessComputeSkill.spec.ts
+++ /dev/null
@@ -1,141 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'fs'
-import { join } from 'path'
-import { tmpdir } from 'os'
-
-/**
- * `harness start` drops two files for opencode: the Harness Compute skill (frontmatter + the doc)
- * and the `harness-compute` agent definition (the doc verbatim — its frontmatter is the agent's). Both
- * land under XDG_CONFIG_HOME, both are idempotent, and neither may fail the start.
- */
-describe('installOpencodeHarnessComputeSkill', () => {
- let configHome = ''
- const docs = join(__dirname, '..', '..', '..', 'docs', 'skills')
-
- async function load() {
- vi.resetModules()
- process.env.XDG_CONFIG_HOME = configHome
- delete process.env.OPENCODE_SKILL_DIR
- delete process.env.OPENCODE_AGENT_DIR
- return import('./harnessComputeSkill.js')
- }
-
- beforeEach(() => {
- configHome = mkdtempSync(join(tmpdir(), 'adapter-opencode-skill-'))
- vi.spyOn(console, 'log').mockImplementation(() => {})
- vi.spyOn(console, 'error').mockImplementation(() => {})
- })
-
- afterEach(() => {
- rmSync(configHome, { recursive: true, force: true })
- delete process.env.XDG_CONFIG_HOME
- vi.restoreAllMocks()
- })
-
- it('installs the skill with its frontmatter and the agent definition verbatim, under XDG_CONFIG_HOME', async () => {
- const { installOpencodeHarnessComputeSkill } = await load()
- installOpencodeHarnessComputeSkill()
-
- const skill = readFileSync(join(configHome, 'opencode', 'skills', 'harness-compute', 'SKILL.md'), 'utf-8')
- expect(skill.startsWith('---\nname: harness-compute\n')).toBe(true)
- expect(skill).toContain(readFileSync(join(docs, 'harness-compute.md'), 'utf-8').trimEnd())
-
- const agent = readFileSync(join(configHome, 'opencode', 'agents', 'harness-compute.md'), 'utf-8')
- // Byte-for-byte: the source file carries the exact frontmatter opencode reads, nothing is added.
- expect(agent).toBe(readFileSync(join(docs, 'harness-compute.agent.md'), 'utf-8'))
- expect(agent.startsWith("---\nname: 'harness-compute'\n")).toBe(true)
- expect(agent).toContain('mode: primary')
- expect(agent).toContain('question: allow')
- expect(console.error).not.toHaveBeenCalled()
- })
-
- it('is a no-op the second time: nothing rewritten, no temp file left behind', async () => {
- const { installOpencodeHarnessComputeSkill } = await load()
- installOpencodeHarnessComputeSkill()
- const skillPath = join(configHome, 'opencode', 'skills', 'harness-compute', 'SKILL.md')
- const agentPath = join(configHome, 'opencode', 'agents', 'harness-compute.md')
- const before = [statSync(skillPath).mtimeMs, statSync(agentPath).mtimeMs]
- vi.mocked(console.log).mockClear()
-
- await new Promise((resolve) => setTimeout(resolve, 20))
- installOpencodeHarnessComputeSkill()
-
- expect([statSync(skillPath).mtimeMs, statSync(agentPath).mtimeMs]).toEqual(before)
- expect(vi.mocked(console.log).mock.calls.map(([line]) => String(line))).toEqual([
- '[hooks] Harness Compute opencode skill already installed',
- '[hooks] harness-compute opencode agent already installed',
- ])
- expect(readdirSync(join(configHome, 'opencode', 'agents'))).toEqual(['harness-compute.md'])
- expect(readdirSync(join(configHome, 'opencode', 'skills', 'harness-compute'))).toEqual(['SKILL.md'])
- })
-
- it('rewrites a file that drifted from the source', async () => {
- const { installOpencodeHarnessComputeSkill } = await load()
- installOpencodeHarnessComputeSkill()
- const agentPath = join(configHome, 'opencode', 'agents', 'harness-compute.md')
- writeFileSync(agentPath, '---\nname: harness-compute\n---\nedited by hand\n')
-
- installOpencodeHarnessComputeSkill()
-
- expect(readFileSync(agentPath, 'utf-8')).toBe(readFileSync(join(docs, 'harness-compute.agent.md'), 'utf-8'))
- })
-
- /**
- * The release bundle is ONE file — upload-cli.sh, install.sh and the self-updater all move `cli.js`
- * and `notify.mjs` and nothing else — so the docs cannot travel as files beside it. The bundle
- * build embeds them (esbuild `define`, the way the dsh registry travels), and a bundled daemon
- * installs from that, never from a `docs/skills/` it does not have.
- */
- it('installs from the sources the build embedded, reading nothing from docs/skills', async () => {
- vi.stubGlobal('__HARNESS_SKILLS__', JSON.stringify({
- 'harness-compute.md': '# EMBEDDED SKILL\n\nfrom the bundle\n',
- 'harness-compute.agent.md': "---\nname: 'harness-compute'\nmode: primary\n---\nEMBEDDED AGENT\n",
- }))
- try {
- const { installOpencodeHarnessComputeSkill } = await load()
- installOpencodeHarnessComputeSkill()
-
- const skill = readFileSync(join(configHome, 'opencode', 'skills', 'harness-compute', 'SKILL.md'), 'utf-8')
- expect(skill.startsWith('---\nname: harness-compute\n')).toBe(true)
- expect(skill.endsWith('# EMBEDDED SKILL\n\nfrom the bundle\n')).toBe(true)
- expect(skill).not.toContain('HOW TO OPERATE HARNESS COMPUTE')
- const agent = readFileSync(join(configHome, 'opencode', 'agents', 'harness-compute.md'), 'utf-8')
- expect(agent).toBe("---\nname: 'harness-compute'\nmode: primary\n---\nEMBEDDED AGENT\n")
- expect(console.error).not.toHaveBeenCalled()
- } finally {
- vi.unstubAllGlobals()
- }
- })
-
- it('is what both builds embed: the two docs, by name, in build.mjs and build-bundle.mjs', () => {
- const cliRoot = join(__dirname, '..', '..')
- for (const script of ['build.mjs', 'build-bundle.mjs']) {
- const source = readFileSync(join(cliRoot, script), 'utf-8')
- expect(source, script).toContain('__HARNESS_SKILLS__')
- expect(source, script).toContain("'harness-compute.md'")
- expect(source, script).toContain("'harness-compute.agent.md'")
- }
- // The copy beside cli.js is gone with the lookup that read it: a directory nobody ships is a
- // promise nobody keeps. (The comment explaining why may still name it; the calls may not.)
- const bundle = readFileSync(join(cliRoot, 'build-bundle.mjs'), 'utf-8')
- expect(bundle).not.toMatch(/mkdirSync\(['"]dist\/skills/)
- expect(bundle).not.toMatch(/copyFileSync\([^)]*dist\/skills/)
- })
-
- it('honours OPENCODE_AGENT_DIR and OPENCODE_SKILL_DIR over the XDG default', async () => {
- vi.resetModules()
- process.env.XDG_CONFIG_HOME = configHome
- process.env.OPENCODE_SKILL_DIR = join(configHome, 'custom-skills')
- process.env.OPENCODE_AGENT_DIR = join(configHome, 'custom-agents')
- try {
- const { installOpencodeHarnessComputeSkill } = await import('./harnessComputeSkill.js')
- installOpencodeHarnessComputeSkill()
- expect(existsSync(join(configHome, 'custom-skills', 'harness-compute', 'SKILL.md'))).toBe(true)
- expect(existsSync(join(configHome, 'custom-agents', 'harness-compute.md'))).toBe(true)
- expect(existsSync(join(configHome, 'opencode'))).toBe(false)
- } finally {
- delete process.env.OPENCODE_SKILL_DIR
- delete process.env.OPENCODE_AGENT_DIR
- }
- })
-})
diff --git a/cli/src/lib/harnessComputeSkill.ts b/cli/src/lib/harnessComputeSkill.ts
deleted file mode 100644
index 153acd8ec..000000000
--- a/cli/src/lib/harnessComputeSkill.ts
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Idempotently install the Harness Compute opencode skill into
- * ~/.config/opencode/skills/harness-compute/SKILL.md, so any opencode session — including one
- * running inside a Harness swarm pane — can help the user start or use a local model without
- * ever being told what the underlying CLI it shells out to is called.
- *
- * The skill's own prose is not duplicated here: it lives in `docs/skills/harness-compute.md`,
- * one file for every agent — it starts the model and then points the user at the app's model
- * picker, which is what actually switches an agent (agent_retarget); the skill never touches an
- * agent's own config. This just adds the frontmatter opencode's skill loader requires.
- *
- * Beside the skill goes the `harness-compute` AGENT definition (`docs/skills/harness-compute.agent.md` →
- * ~/.config/opencode/agents/harness-compute.md): the thing `opencode --agent harness-compute` opens a pane
- * AS, whose whole job is to load that skill and follow it. The source file already carries the exact
- * frontmatter opencode reads (`name`, `mode: primary`, `permission: question: allow`), so it is
- * installed verbatim.
- */
-import { readFileSync, writeFileSync, mkdirSync, existsSync, renameSync } from 'fs'
-import { join, dirname } from 'path'
-import { fileURLToPath } from 'url'
-import { env } from '../config/env.js'
-
-const cliDir = dirname(fileURLToPath(import.meta.url))
-
-/**
- * The docs as the build embedded them — a JSON object of file name → text, injected by esbuild
- * `define` in build-bundle.mjs and build.mjs the way `__DSH_REGISTRY__` is (dsh/registry.ts).
- *
- * INSIDE cli.js rather than shipped as files beside it, because nothing ships files beside cli.js:
- * upload-cli.sh publishes `cli.js` and `notify.mjs` and nothing else, install.sh fetches those two,
- * the self-updater swaps those two. The `dist/skills/` the bundle used to lay down reached no
- * machine — a daemon installed from the CDN logged "failed to read Harness Compute skill sources"
- * and installed nothing, silently, while a working tree that happened to have a `skills/` beside its
- * cli.js looked fine. Embedded, the docs travel wherever cli.js does and can never be a version
- * behind the code that installs them.
- */
-declare const __HARNESS_SKILLS__: string | undefined
-
-function embeddedSkill(name: string): string | null {
- if (typeof __HARNESS_SKILLS__ === 'undefined') return null
- const skills = JSON.parse(__HARNESS_SKILLS__) as Record<string, unknown>
- const text = skills[name]
- return typeof text === 'string' ? text : null
-}
-
-/** Dev, per-file (tsx, vitest): this file runs from <appRoot>/cli/src/lib/, and the docs are three
- * levels up, at <appRoot>/docs/skills/. Nothing is embedded there, and nothing needs to be. */
-function devSkillPath(name: string): string {
- return join(cliDir, '..', '..', '..', 'docs', 'skills', name)
-}
-
-const SKILL_PATH = join(env.OPENCODE_SKILL_DIR, 'harness-compute', 'SKILL.md')
-const AGENT_PATH = join(env.OPENCODE_AGENT_DIR, 'harness-compute.md')
-
-const FRONTMATTER = `---
-name: harness-compute
-description: Run AI models on the user's own machines under their Harness account, so any agent can switch to them from its model picker. Use when the user asks to start or serve a local model, run a model on this machine, stop one, or check what their machines are currently serving.
-license: MIT
-compatibility: opencode
-metadata:
- source: autonomous-harness (docs/skills/harness-compute.md)
----
-
-`
-
-/**
- * Write `source` to `target` unless it is already there byte-for-byte. Atomic (temp + rename), so a
- * session that reads the file mid-install sees the old one or the new one, never half of either.
- * Best-effort: a failure is logged and skipped, never thrown — nothing here may fail `harness start`.
- */
-function installFile(label: string, target: string, source: string): void {
- try {
- if (existsSync(target) && readFileSync(target, 'utf-8') === source) {
- console.log(`[hooks] ${label} already installed`)
- return
- }
- } catch { /* unreadable — rewrite it */ }
- try {
- mkdirSync(dirname(target), { recursive: true })
- const tmp = `${target}.${process.pid}.tmp`
- writeFileSync(tmp, source)
- renameSync(tmp, target)
- console.log(`[hooks] installed ${label} → ${target}`)
- console.log('[hooks] (a NEW opencode session picks this up automatically)')
- } catch (err) {
- console.error(`[hooks] failed to write ${label}:`, err)
- }
-}
-
-/** The doc `name`: what the build embedded, else the file under docs/skills/ (dev), else null (logged). */
-function readSkillSource(label: string, name: string): string | null {
- const embedded = embeddedSkill(name)
- if (embedded !== null) return embedded
- try {
- return readFileSync(devSkillPath(name), 'utf-8')
- } catch (err) {
- // Best-effort, same posture as every other engine install in hooks.ts: a missing or unreadable
- // source must never fail `harness start`, only skip this one file.
- console.error(`[hooks] failed to read ${label} sources:`, err)
- return null
- }
-}
-
-/** Idempotently drop the assembled Harness Compute skill into ~/.config/opencode/skills/, and the
- * `harness-compute` agent that follows it into ~/.config/opencode/agents/. */
-export function installOpencodeHarnessComputeSkill(): void {
- const core = readSkillSource('Harness Compute skill', 'harness-compute.md')
- if (core !== null) installFile('Harness Compute opencode skill', SKILL_PATH, FRONTMATTER + core.trimEnd() + '\n')
- // Verbatim: the source file IS the agent definition, frontmatter included.
- const agent = readSkillSource('harness-compute agent', 'harness-compute.agent.md')
- if (agent !== null) installFile('harness-compute opencode agent', AGENT_PATH, agent)
-}
diff --git a/desktop/lib/core/models.dart b/desktop/lib/core/models.dart
index a637dab2d..db1c67d85 100644
--- a/desktop/lib/core/models.dart
+++ b/desktop/lib/core/models.dart
@@ -777,7 +777,11 @@ class GridModel {
/// grid this is one of the user's own computers, which is the useful part of the answer.
final String node;
- const GridModel({required this.id, required this.node});
+ /// The grid it is served on — the section it was listed under. Null on an older daemon that
+ /// sends only the own grid's list, which the retarget then targets as it always did.
+ final String? grid;
+
+ const GridModel({required this.id, required this.node, this.grid});
}
/// Which `grid` a machine would run, as its daemon reports beside the model list (`gridCli`).
@@ -801,12 +805,31 @@ enum GridCli {
/// The picker's whole answer: which grid was asked, and what it offers.
///
+/// One grid the machine is signed into, with what it serves. [own] marks the account's private
+/// grid — the picker calls that one "Local"; a shared grid goes by its name.
+class GridSection {
+ final String name;
+ final bool own;
+ final List<GridModel> models;
+
+ const GridSection({
+ required this.name,
+ required this.own,
+ required this.models,
+ });
+}
+
/// `gridName` is null when the machine has no grid yet — told apart from "a grid with nothing on
/// it", because the two need different sentences in front of a person.
class GridModels {
final String? gridName;
final List<GridModel> models;
+ /// Every grid the machine is signed into, own grid first, each with its live models — the
+ /// picker's sections. Empty on an older daemon, which sends only [models] for the own grid; the
+ /// picker then draws that one section as it always did.
+ final List<GridSection> grids;
+
/// The engines a Local model can be offered to at all, as the daemon on that machine names them
/// (`localModelEngines`; the set of launch contracts in its `gridLaunch.ts`). Null when the
/// daemon is older and sends no such list — read as "offer everything", the behaviour before.
@@ -827,16 +850,26 @@ class GridModels {
const GridModels({
required this.gridName,
required this.models,
+ this.grids = const [],
this.localModelEngines,
this.gridCli,
this.reachable = true,
});
+ /// The sections to draw: [grids] when the daemon sent them, else the own grid alone.
+ List<GridSection> get sections => grids.isNotEmpty
+ ? grids
+ : [
+ if (gridName != null)
+ GridSection(name: gridName!, own: true, models: models),
+ ];
+
/// The machine could not be asked. Says nothing about the account, because nothing is known —
/// including which engines it would have offered, or whether it has a `grid`.
const GridModels.unreachable()
: gridName = null,
models = const [],
+ grids = const [],
localModelEngines = null,
gridCli = null,
reachable = false;
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 54c6bd0b1..c21632b4d 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -485,11 +485,22 @@ class _SwarmScreenState extends State<SwarmScreen> {
void _syncModels() {
final payload = {
'subscriptions': _modelsMenu?.rows ?? [],
- // The Local section used to be two hardcoded names. A menu that names a model nobody is
- // serving is worse than one admitting it has none, so this carries what the account's own
- // grid actually answers with — refreshed below, and empty until the first read lands.
+ // Back-compat: the own grid's models, as the native menu understood them before sections.
'local': [
- for (final m in _localModels) {'id': m.id, 'node': m.node},
+ for (final s in _localSections)
+ if (s.own)
+ for (final m in s.models) {'id': m.id, 'node': m.node},
+ ],
+ // The picker's sections, own grid first then each shared grid — what the native menu draws.
+ 'sections': [
+ for (final s in _localSections)
+ {
+ 'name': s.name,
+ 'own': s.own,
+ 'models': [
+ for (final m in s.models) {'id': m.id, 'node': m.node},
+ ],
+ },
],
};
final encoded = jsonEncode(payload);
@@ -498,12 +509,12 @@ class _SwarmScreenState extends State<SwarmScreen> {
unawaited(_channel.invokeMethod<void>('modelsState', payload));
}
- /// What the account's private grid is serving, for the native Models menu.
+ /// What the picker's sections answer for the native Models menu.
///
/// Read from a machine this window is connected to — the grid is per ACCOUNT, so any of them
/// answers the same, and the local one is asked first because its daemon is a loopback away.
/// Never throws and never blocks the menu: a machine that cannot answer leaves the list as it was.
- List<GridModel> _localModels = const [];
+ List<GridSection> _localSections = const [];
DateTime? _localModelsAt;
@@ -527,17 +538,38 @@ class _SwarmScreenState extends State<SwarmScreen> {
);
final answer = await app.gridModels(preferred.machineId);
if (!mounted) return;
- final same =
- answer.models.length == _localModels.length &&
- [
- for (var i = 0; i < answer.models.length; i++)
- answer.models[i].id == _localModels[i].id,
- ].every((x) => x);
- if (same) return;
- _localModels = answer.models;
+ final sections = _sectionsForModelMenu(answer);
+ if (_sameSections(sections, _localSections)) return;
+ _localSections = sections;
_syncModels();
}
+ /// The sections the Models menu draws, matching the pane picker's own: the account's own grid
+ /// first as "Local", then each shared grid that serves something. A shared grid with nothing
+ /// running is not a menu a person can pick from, so it is not drawn.
+ List<GridSection> _sectionsForModelMenu(GridModels answer) {
+ final sections = answer.sections
+ .where((s) => s.own || s.models.isNotEmpty)
+ .toList();
+ if (sections.any((s) => s.own)) return sections;
+ return [
+ GridSection(name: answer.gridName ?? '', own: true, models: answer.models),
+ ...sections,
+ ];
+ }
+
+ static bool _sameSections(List<GridSection> a, List<GridSection> b) {
+ if (a.length != b.length) return false;
+ for (var i = 0; i < a.length; i++) {
+ if (a[i].name != b[i].name || a[i].own != b[i].own) return false;
+ if (a[i].models.length != b[i].models.length) return false;
+ for (var j = 0; j < a[i].models.length; j++) {
+ if (a[i].models[j].id != b[i].models[j].id) return false;
+ }
+ }
+ return true;
+ }
+
Future<void> _onNative(MethodCall call) async {
if (mounted && call.method == 'keymapPending') {
final keys = (call.arguments as Map?)?['keys'];
@@ -669,11 +701,11 @@ class _SwarmScreenState extends State<SwarmScreen> {
case 'newTerminal':
unawaited(_newTerminal());
case 'runLocalModel':
- // The native Models menu's one command. Wrapped like Link Machine…
- // because the notifier may open its dialog here, and the pane it then
- // creates takes focus the same way a New Agent does. With more than one
- // machine linked the menu lists them and names the chosen one here;
- // with one, or none, the notifier picks.
+ // The native Models menu's one command: open Grid. Wrapped like Link
+ // Machine… because the notifier opens New Agent here, and the tab it
+ // then creates takes focus. With more than one machine linked the menu
+ // lists them and names the chosen one here; with one, or none, the
+ // notifier picks.
await _dialog(
() => app.runLocalModel(
context,
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 3d7896a42..9feddbf09 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1,5 +1,5 @@
import 'dart:async';
-import 'dart:io' show Platform, exit, pid;
+import 'dart:io' show exit, pid;
import 'dart:math' show Random;
import 'package:dio/dio.dart';
@@ -44,7 +44,7 @@ import '../shared/theme/app_theme.dart' as grid;
import '../terminal/remote_media_download.dart';
import '../widgets/engine_identity.dart'
show allEngines, engineIdentity, isTerminalEngine;
-import '../widgets/run_local_model_dialog.dart' show showRunLocalModelDialog;
+import '../store/store_screen.dart' show openStoreAgent;
import 'dial_status.dart';
import 'pane_layout_store.dart';
import 'terminal_pane.dart';
@@ -670,9 +670,18 @@ class AppNotifier extends ChangeNotifier {
/// over a New Tab. One store tab per window, like one New Tab: when it is
/// already open somewhere, that one is selected. From a tab with panes it
/// gets a tab of its own.
- void openStore() {
+ ///
+ /// [harness] opens the Store straight on that harness's page — the model
+ /// picker's door when Grid is not installed yet. Held until the Store tab
+ /// reads it ([takePendingStoreHarness]): the tab may exist already, or be
+ /// about to be built, and either way the page turns exactly once.
+ void openStore({String? harness}) {
+ if (harness != null) _pendingStoreHarness = harness;
final current = activeSwarm;
- if (current.isStore) return;
+ if (current.isStore) {
+ if (harness != null) notifyListeners();
+ return;
+ }
final existing = swarms.where((swarm) => swarm.isStore).firstOrNull;
if (existing != null) {
selectSwarm(existing.id);
@@ -699,6 +708,16 @@ class AppNotifier extends ChangeNotifier {
selectSwarm(swarm.id);
}
+ String? _pendingStoreHarness;
+
+ /// The harness page [openStore] was asked for, handed over once. The Store
+ /// tab reads it when it is built and on every change while it is open.
+ String? takePendingStoreHarness() {
+ final id = _pendingStoreHarness;
+ _pendingStoreHarness = null;
+ return id;
+ }
+
void selectSwarm(String id, {bool attachPending = true}) {
if (!swarms.any((s) => s.id == id)) return;
if (id != activeSwarmId && isDraftSwarm(activeSwarmId)) {
@@ -3612,15 +3631,22 @@ class AppNotifier extends ChangeNotifier {
/// credential from its own signed-in `grid`, so neither travels over the relay and the app never
/// holds a grid key. Moving an agent re-execs its pane, which is why this is an explicit choice in
/// a menu rather than something that can happen by hovering.
+ /// [gridName] is the grid the model was picked from — a shared grid's section in the picker.
+ /// Absent, the daemon uses the account's own grid, as it always did.
Future<void> retargetAgentToGridModel(
String machineId,
String agentId,
- String modelId,
- ) async {
+ String modelId, {
+ String? gridName,
+ }) async {
try {
await _conn(machineId).request(
'agent_retarget',
- payload: {'agentId': agentId, 'gridModel': modelId},
+ payload: {
+ 'agentId': agentId,
+ 'gridModel': modelId,
+ if (gridName != null) 'gridName': gridName,
+ },
timeout: const Duration(seconds: 30),
);
} on WsRequestFailure catch (failure) {
@@ -3653,9 +3679,34 @@ class AppNotifier extends ChangeNotifier {
.where((m) => m.id.isNotEmpty)
.toList();
final capable = response['localModelEngines'];
+ List<GridModel> parseModels(Object? raw) => (raw as List<dynamic>? ?? [])
+ .whereType<Map<String, dynamic>>()
+ .map(
+ (m) => GridModel(
+ id: (m['id'] as String?) ?? '',
+ node: (m['node'] as String?) ?? '',
+ ),
+ )
+ .where((m) => m.id.isNotEmpty)
+ .toList();
+ final grids = (response['grids'] as List<dynamic>? ?? [])
+ .whereType<Map<String, dynamic>>()
+ .where((g) => (g['name'] as String?)?.isNotEmpty == true)
+ .map(
+ (g) => GridSection(
+ name: g['name'] as String,
+ own: g['own'] == true,
+ models: [
+ for (final m in parseModels(g['models']))
+ GridModel(id: m.id, node: m.node, grid: g['name'] as String),
+ ],
+ ),
+ )
+ .toList();
return GridModels(
gridName: response['gridName'] as String?,
models: models,
+ grids: grids,
localModelEngines: capable is List
? capable.whereType<String>().map((e) => e.toLowerCase()).toSet()
: null,
@@ -3669,78 +3720,56 @@ class AppNotifier extends ChangeNotifier {
}
}
- /// The opencode agent the pane is opened AS (`opencode --agent harness-compute`):
- /// the definition `harness start` installs beside the harness-compute skill,
- /// whose whole job is that skill. Not a first prompt — the person opens the
- /// conversation, and the agent's identity is what makes the pane read as
- /// "the thing that starts a local model" rather than a terminal that happens
- /// to be running opencode.
- static const localModelAgent = 'harness-compute';
-
- /// What the pane is called before, and if never, the engine names its
- /// session.
- static const localModelAgentName = 'Model manager';
+ /// The Store harness every "Open Grid" door opens: Grid, the agent that
+ /// manages the models on a machine or a fleet, with its live viewer.
+ static const gridHarness = 'autonomous/autonomous-grid';
- /// The one action behind every "Talk to Model manager" entry: explain once,
- /// then open opencode as the agent that starts one.
+ /// The one action behind every "Open Grid" entry — the pane picker's button
+ /// and the Models menu — and it is exactly what the Store's Open button
+ /// does: a draft tab of its own, then New Agent with Grid already chosen on
+ /// [machineId]. Not a dialog of this feature's own: a second way to open a
+ /// harness would be a second definition of what opening one means.
///
- /// The dialog decides, and Start is what creates. Nothing here reports
- /// progress: the pane appearing is the confirmation, and a refusal lands in
- /// [lastError] like any other create.
+ /// Grid not installed on that machine → the Store, open on Grid's page,
+ /// whose Install is the way in. Nothing here reports progress: the tab
+ /// appearing is the confirmation.
///
- /// Takes the caller's [context] because the dialog needs one and this
+ /// Takes the caller's [context] because New Agent needs one and this
/// notifier holds none — the same shape as every other dialog a door opens.
///
- /// [machineId] is the computer the manager opens on — the pane's own machine
- /// from a pane's picker, the one chosen from the Models menu's list. Absent
- /// (a menu with one machine, or none named), it is this computer's own when
- /// the app has one, else whatever the person is looking at. Never guessed
- /// past a named machine: a picker on a remote pane that opened the manager
- /// on this computer was the bug this argument exists to end.
- ///
- /// [chooseMachine] is whether the dialog offers the other machines. A pane's
- /// picker is a question about THAT pane's computer, so it does not (the
- /// machine is named, not offered); the Models menu is about the account, so
- /// it does.
- Future<void> runLocalModel(
- BuildContext context, {
- String? machineId,
- bool chooseMachine = true,
- }) async {
+ /// [machineId] is the computer Grid opens on — the pane's own machine from a
+ /// pane's picker, the one chosen from the Models menu's list. Absent (a menu
+ /// with one machine, or none named), it is this computer's own when the app
+ /// has one, else whatever the person is looking at. Never guessed past a
+ /// named machine: a picker on a remote pane that opened on this computer was
+ /// the bug this argument exists to end.
+ Future<void> runLocalModel(BuildContext context, {String? machineId}) async {
final machine = machineId != null
? machineStates[machineId]
: _localModelMachine();
if (machine == null) {
_lastError = machineId != null
? 'That machine is no longer linked.'
- : 'Connect a machine before starting a local model.';
+ : 'Connect a machine before opening Grid.';
_lastErrorRetryable = false;
notifyListeners();
return;
}
machineId = machine.machine.machineId;
- final decision = await showRunLocalModelDialog(
- context,
- this,
- machineId,
- chooseMachine: chooseMachine,
- );
- if (decision == null) return;
- // The dialog may list the machines, and the person may have moved the choice.
- machineId = decision.machineId;
- final error = await _startLocalModelAgent(
- machineId,
- prompt: decision.prompt,
- );
- if (error != null) {
- _lastError = error;
- _lastErrorRetryable = false;
- notifyListeners();
+ // Whether Grid is installed THERE, from the machine's own list — a stored
+ // answer is fine here, since an install this app started is pushed into
+ // it as it lands.
+ await probeDsh(machineId);
+ if (machine.dsh[gridHarness]?.installed != true) {
+ openStore(harness: gridHarness);
+ return;
}
+ if (!context.mounted) return;
+ await openStoreAgent(context, this, gridHarness, machineId);
}
- /// The machine a local model belongs on: this computer's own when the app
- /// has one, else whatever the person is looking at.
+ /// The machine Grid belongs on when no door named one: this computer's own
+ /// when the app has one, else whatever the person is looking at.
MachineState? _localModelMachine() {
final local = machineStates.values
.where((state) => state.isLocalMachine)
@@ -3751,67 +3780,6 @@ class AppNotifier extends ChangeNotifier {
machineStates.values.firstOrNull;
}
- /// What a start stands for: opencode, in the user's home, opened as the
- /// `harness-compute` agent. Home rather than a project because the model is
- /// not about any one repo.
- ///
- /// [prompt] is the opening move the dialog's button stood for, handed to
- /// opencode's own `--prompt`: the pane opens with that message already
- /// submitted, so the first thing in it is the manager's answer rather than an
- /// empty composer. Null is the third option — the plain door, for a person who
- /// would rather word it themselves — and then nothing is sent, exactly as
- /// before this dialog had buttons.
- ///
- /// Null on success, else the sentence for the person.
- Future<String?> _startLocalModelAgent(
- String machineId, {
- String? prompt,
- }) async {
- final machine = machineStates[machineId];
- if (machine == null) return 'Machine not found';
- final home = await _homeFolderOf(machine);
- if (home == null) {
- return 'Could not find the home folder on ${machine.machine.displayName}.';
- }
- final error = await createAgent(
- machineId,
- engine: 'opencode',
- folder: home,
- agent: localModelAgent,
- name: localModelAgentName,
- prompt: prompt,
- );
- if (error != null) return error;
- // A daemon that predates `agent`/`name` does not refuse them — it ignores
- // them, opens a plain opencode pane and names it itself. The pane exists,
- // so the person is told what it is rather than left to notice that the
- // manager never introduces itself: the name coming back is the tell.
- final created = machine.agents
- .where((a) => a.name == localModelAgentName)
- .isNotEmpty;
- if (!created) {
- return 'Harness on ${machine.machine.displayName} is too old to open '
- 'Model manager: it opened a plain opencode pane instead. '
- 'Update Harness there and try again.';
- }
- return null;
- }
-
- /// The user's home on [machine]. This computer's is in the environment; a
- /// remote machine's is known only to that machine, which is what
- /// `fs_list_dir` with no path answers from (its `listDir` defaults to the
- /// home directory).
- Future<String?> _homeFolderOf(MachineState machine) async {
- if (machine.isLocalMachine) {
- final home =
- Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'];
- if (home != null && home.isNotEmpty) return home;
- }
- final listing = await listRemoteFolder(machine.machine.machineId, null);
- final path = listing['path'];
- return path is String && path.isNotEmpty ? path : null;
- }
-
WsConn _conn(String machineId) {
if (machineStates[machineId]?.machine.isShared == true) {
throw StateError('This harness is shared with view-only access.');
diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dart
index f54c64cb1..45bec8098 100644
--- a/desktop/lib/store/store_screen.dart
+++ b/desktop/lib/store/store_screen.dart
@@ -114,7 +114,10 @@ class _StoreTabState extends State<StoreTab> {
late _Shelf _shelf = widget.initialHarness == null
? _place.shelf
: const _Discover();
- late String? _selected = widget.initialHarness ?? _place.selected;
+ late String? _selected =
+ widget.initialHarness ??
+ widget.notifier.takePendingStoreHarness() ??
+ _place.selected;
late final _search = TextEditingController(
text: widget.initialHarness == null ? _place.query : '',
);
@@ -183,6 +186,10 @@ class _StoreTabState extends State<StoreTab> {
}
void _onAppChanged() {
+ // A door asked for a harness page while this tab was already open: the
+ // constructor's read is too late for that, so the page turns here.
+ final pending = widget.notifier.takePendingStoreHarness();
+ if (pending != null && pending != _selected) _openPage(pending);
final connecting = <MachineState>[];
for (final machine in [?widget.notifier.localMachineState]) {
final id = machine.machine.machineId;
@@ -301,7 +308,12 @@ class _StoreTabState extends State<StoreTab> {
return;
}
unawaited(
- _openStoreAgent(context, widget.notifier, entry, local.machine.machineId),
+ openStoreAgent(
+ context,
+ widget.notifier,
+ entry.id,
+ local.machine.machineId,
+ ),
);
}
@@ -676,10 +688,16 @@ bool _canGetOnMachine(MachineState machine, DshEntry entry) {
machine.dsh.runs[entry.id]?.inProgress != true;
}
-Future<void> _openStoreAgent(
+/// Open a Store harness on [machineId] the way the Store's Open button does: a
+/// draft tab of its own, then New Agent with the harness already chosen.
+///
+/// Public because it is the ONE way a harness is opened from anywhere — the
+/// Store page, and the model picker's "Open Grid" — so the two cannot drift
+/// into two definitions of what opening a harness means.
+Future<void> openStoreAgent(
BuildContext context,
AppNotifier notifier,
- DshEntry entry,
+ String harnessId,
String machineId, {
String? prompt,
}) async {
@@ -691,7 +709,7 @@ Future<void> _openStoreAgent(
notifier,
machineId,
source: 'store',
- initialEngine: entry.id,
+ initialEngine: harnessId,
initialPrompt: prompt,
swarmId: target,
);
@@ -814,10 +832,10 @@ class _ProductPageState extends State<_ProductPage> {
if (widget.notifier.localMachineState?.machine.machineId != machineId) {
return;
}
- await _openStoreAgent(
+ await openStoreAgent(
context,
widget.notifier,
- widget.entry,
+ widget.entry.id,
machineId,
prompt: prompt,
);
diff --git a/desktop/lib/widgets/grid_model_picker.dart b/desktop/lib/widgets/grid_model_picker.dart
index 872a9f392..8cecc1a71 100644
--- a/desktop/lib/widgets/grid_model_picker.dart
+++ b/desktop/lib/widgets/grid_model_picker.dart
@@ -54,10 +54,11 @@ class GridModelPicker extends StatefulWidget {
/// have to know a command for.
final VoidCallback? onUseOwnLogin;
- /// Called when the last row under Local — "Talk to Model manager" — is chosen. An action, not a
- /// destination: it opens the flow that puts a model on the user's own computer, which is the
- /// answer to the empty section this menu otherwise stops at. Always offered, whether or not
- /// anything is being served yet: a person with no Local models is exactly who needs the door.
+ /// Called when the Local section's action — "Open Grid" — is chosen. An action, not a
+ /// destination: it opens the Grid harness, the agent that puts models on the user's machines,
+ /// which is the answer to the empty section this menu otherwise stops at. Always offered,
+ /// whether or not anything is being served yet: a person with no Local models is exactly who
+ /// needs the door.
final VoidCallback? onRunLocalModel;
/// The grid model this agent is on right now, or null when it is on its own login. Drives the
@@ -231,35 +232,51 @@ class _GridModelPickerState extends State<GridModelPicker> {
),
),
Divider(height: 9, thickness: 1, color: AppColors.border),
- paneMenuHeader('Local'),
- // An engine with no way onto a Local model (Cursor talks only to its own API; the daemon
- // refuses the move) is told so here, instead of being offered rows whose click would do
- // nothing. The daemon names the capable engines beside the list; an older daemon names
- // none, and then every row is offered as before.
- if (!_shown!.canRunLocally(widget.engineLabel))
- paneMenuEmpty(
- '${engineIdentity(widget.engineLabel).label} can only run on its own login.',
- )
- // Two different facts, two sentences. "We could not ask" and "this account has no grid"
- // send a person to two different places, and the one that used to cover both told a
- // signed-in user to sign in again. "The grid is serving nothing" is NOT a sentence here:
- // the "Talk to Model manager" row that ends this section is the answer, and a line saying the
- // list is empty above an empty list is noise.
- else if (_shown!.models.isEmpty && _emptySentence(_shown!) != null)
- paneMenuEmpty(_emptySentence(_shown!)!),
- if (_shown!.canRunLocally(widget.engineLabel))
- for (final model in _shown!.models)
- paneMenuItem(
- onTap: () => close(_Choice.model(model)),
- child: PaneMenuRow(
- selected: widget.currentModel == model.id,
- title: model.id,
- // Which of the user's machines answers it — the part that makes a private grid
- // legible, and the reason `node` is carried through at all.
- status: model.node.isEmpty ? null : model.node,
- subtitle: _subtitleFor(model),
+ // One section per grid with something to offer, the account's own first as "Local"
+ // (its rows are the user's own computers), the shared ones by name — the same shape as
+ // Subscription above, so a model on a team's grid is one row away like any other.
+ // With no grid at all there is still a "Local" heading, so the sentence under it has a
+ // place to be. Each heading carries a few words saying what the group is: a grid's name
+ // alone ("autonomous.ai") over a model's id read as two entries of the same kind.
+ for (final (index, section) in _sectionsToDraw(_shown!).indexed) ...[
+ if (index > 0) const SizedBox(height: 4),
+ // Own: one plain sentence, nothing under it — "your machines" was a second half of the
+ // same fact and read oddly split onto its own clause. Shared: the general fact as the
+ // heading, the specific grid as the name under it — the two are different kinds of
+ // information (why the rows are here vs. which fleet they are), not one sentence.
+ section.own
+ ? paneMenuHeader('Local models on your machines')
+ : paneMenuHeader('Models shared with you', caption: section.name),
+ // An engine with no way onto a Local model (Cursor talks only to its own API; the
+ // daemon refuses the move) is told so here, instead of being offered rows whose click
+ // would do nothing. The daemon names the capable engines beside the list; an older
+ // daemon names none, and then every row is offered as before.
+ if (!_shown!.canRunLocally(widget.engineLabel))
+ paneMenuEmpty(
+ '${engineIdentity(widget.engineLabel).label} can only run on its own login.',
+ )
+ // Two different facts, two sentences. "We could not ask" and "this account has no
+ // grid" send a person to two different places, and the one that used to cover both
+ // told a signed-in user to sign in again. "The grid is serving nothing" is NOT a
+ // sentence here: the "Open Grid" row that ends the menu is the answer, and a line
+ // saying the list is empty above an empty list is noise.
+ else if (section.models.isEmpty &&
+ _emptySentence(_shown!, section) != null)
+ paneMenuEmpty(_emptySentence(_shown!, section)!),
+ if (_shown!.canRunLocally(widget.engineLabel))
+ for (final model in section.models)
+ paneMenuItem(
+ onTap: () => close(_Choice.model(model)),
+ child: PaneMenuRow(
+ selected: widget.currentModel == model.id,
+ title: model.id,
+ // Which machine answers it — on the own grid one of the user's own computers,
+ // which is the useful part of the answer.
+ status: model.node.isEmpty ? null : model.node,
+ subtitle: _subtitleFor(model),
+ ),
),
- ),
+ ],
// The way to GET a Local model, under the ones there are and behind a rule of its own.
//
// Not a row among the models: those are places this agent can go, and this starts something
@@ -293,19 +310,44 @@ class _GridModelPickerState extends State<GridModelPicker> {
/// Two sentences, because they are two different situations and only one of them is about the
/// account. Folding them together is what put "sign in again to set them up" in front of a
/// signed-in user whose daemon happened to be offline — advice that was wrong, and that would
- /// not have helped even if the diagnosis had been right. A reachable grid serving nothing says
- /// nothing (null): the "Talk to Model manager" row under it is what a person does about that.
- String? _emptySentence(GridModels answer) {
+ /// not have helped even if the diagnosis had been right. A reachable own grid serving nothing
+ /// still answers the sentence below, so "Local models on your machines" is never left to end
+ /// at an empty list that reads as a rendering gap.
+ String? _emptySentence(GridModels answer, GridSection section) {
if (!answer.reachable) return 'Could not reach this machine.';
// The machine's gap before the account's: with no `grid` on this computer there is nothing a
// sign-in could set up here, and the feature's name is the only word for it a person knows.
if (answer.gridCli == GridCli.missing) {
return "Harness Compute isn't installed on this machine.";
}
- if (answer.gridName == null) return 'No local models on this account yet.';
+ // The account's rest are the models on the user's own machines; an empty list there needs a
+ // sentence under the heading. Shared grids are never drawn empty (see _sectionsToDraw), so
+ // this branch only ever fires for the own grid.
+ if (section.own) {
+ return 'No local models on this account yet.';
+ }
return null;
}
+ /// The sections worth a heading: "Local" always (so the empty-state sentence has a place),
+ /// and a shared grid only while it serves something. A team grid with nothing running is not
+ /// a choice this menu can offer, and a heading over "nothing here" was a line to read for no
+ /// gain — the menu is for picking a model, not for surveying grids.
+ List<GridSection> _sectionsToDraw(GridModels answer) {
+ final sections = answer.sections
+ .where((s) => s.own || s.models.isNotEmpty)
+ .toList();
+ if (sections.any((s) => s.own)) return sections;
+ return [
+ GridSection(
+ name: answer.gridName ?? '',
+ own: true,
+ models: answer.models,
+ ),
+ ...sections,
+ ];
+ }
+
/// The pane menu ([showPaneMenu]), with this picker's two hooks: the entry, so a refresh that
/// lands while the menu is open can redraw it, and the closer, so a pane going away under an
/// open menu can take the menu with it.
@@ -459,7 +501,7 @@ class _ManagerInvitationState extends State<_ManagerInvitation> {
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
- 'Want to manage local models?',
+ 'Manage the models on your machines',
style: TextStyle(
fontSize: 10.5,
letterSpacing: .2,
@@ -488,7 +530,7 @@ class _ManagerInvitationState extends State<_ManagerInvitation> {
borderRadius: BorderRadius.circular(6),
),
child: Text(
- 'Talk to Model manager',
+ 'Open Grid',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
diff --git a/desktop/lib/widgets/pane_menu.dart b/desktop/lib/widgets/pane_menu.dart
index f8b91afc1..90ab60aac 100644
--- a/desktop/lib/widgets/pane_menu.dart
+++ b/desktop/lib/widgets/pane_menu.dart
@@ -8,9 +8,9 @@ import 'transient_menus.dart';
/// The pane header's menu, as one shape for every list that wants to look like it.
///
-/// Born in the model picker and shared from here so a second list (the machine chooser in the
-/// Model manager dialog) is the same menu rather than a second drawing of it: the same
-/// overlay, the same rows, the same quiet fill on the current row instead of a tick.
+/// Born in the model picker and shared from here so any second list that wants this shape is
+/// the same menu rather than a second drawing of it: the same overlay, the same rows, the same
+/// quiet fill on the current row instead of a tick.
///
/// Shown in an OVERLAY rather than as a modal route. `showMenu` puts a full-screen modal barrier
/// under its menu, and that barrier EATS the click that dismisses it: closing the menu and then
@@ -143,21 +143,42 @@ Widget paneMenuEmpty(String text) => Padding(
/// A section label. Non-interactive and short, so the groups read as groups rather than as
/// entries someone failed to make clickable.
-Widget paneMenuHeader(String label) => Padding(
- padding: const EdgeInsets.only(top: 3, bottom: 3),
- child: Padding(
- // The row's margin plus its internal padding, so a header sits directly above the text it
- // heads rather than a few pixels to either side of it.
- padding: const EdgeInsets.only(left: kPaneMenuInset + kPaneMenuRowPadding),
- child: Text(
- label,
- style: TextStyle(
- fontSize: 10.5,
- fontWeight: FontWeight.w600,
- letterSpacing: .3,
- color: AppColors.mutedStrong,
+///
+/// A rule used to run from the label to the menu's edge to make a heading read as a line that
+/// divides. [caption], when given, is a second line UNDER the label — a specific name under a
+/// heading that is a plain sentence ("Models shared with you" / "autonomous.ai"). It used to sit
+/// on the same line as the label, joined by a middot ("Local · your machines"), which read as two
+/// half-sentences forced together rather than as one heading and one detail under it.
+Widget paneMenuHeader(String label, {String? caption}) => Padding(
+ // The row's margin plus its internal padding, so a header sits directly above the text it
+ // heads rather than a few pixels to either side of it.
+ padding: const EdgeInsets.fromLTRB(
+ kPaneMenuInset + kPaneMenuRowPadding,
+ 6,
+ kPaneMenuInset + kPaneMenuRowPadding,
+ 3,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ label,
+ style: TextStyle(
+ fontSize: 10.5,
+ fontWeight: FontWeight.w600,
+ letterSpacing: .3,
+ color: AppColors.mutedStrong,
+ ),
),
- ),
+ if (caption != null)
+ Padding(
+ padding: const EdgeInsets.only(top: 2),
+ child: Text(
+ caption,
+ style: TextStyle(fontSize: 10.5, color: AppColors.textSoft),
+ ),
+ ),
+ ],
),
);
diff --git a/desktop/lib/widgets/run_local_model_dialog.dart b/desktop/lib/widgets/run_local_model_dialog.dart
deleted file mode 100644
index 829a1bc11..000000000
--- a/desktop/lib/widgets/run_local_model_dialog.dart
+++ /dev/null
@@ -1,652 +0,0 @@
-import 'dart:async';
-
-import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import '../core/models.dart';
-import '../shared/theme/app_theme.dart' as grid;
-import '../shared/widgets/app_dialog.dart';
-import '../state/app_state.dart';
-import '../theme/app_theme.dart';
-import 'pane_menu.dart';
-
-/// The one place the "Run a local model" flow is explained.
-///
-/// Both doors — the pane picker's last row and the window's Models menu — go
-/// through [AppNotifier.runLocalModel], which opens this and creates the agent
-/// on Start. The dialog itself creates nothing: it answers with what the
-/// person decided, and the notifier does the rest, so the two doors cannot
-/// drift into two definitions of what Start means.
-///
-/// Null is Cancel (or Escape, or a click outside). A record is a start: the
-/// machine the manager opens on, and the message it opens with — null for
-/// "open it and let me talk", which is the third option and the plain door.
-///
-/// [machineId] is the door's own answer to "which computer" — the pane's
-/// machine, or the one the menu named — and is what the dialog starts on. With
-/// [chooseMachine] and more than one machine linked, the dialog shows the
-/// others and lets the person move the choice; otherwise the machine is named
-/// and that is that. There is deliberately no "don't show this again": the
-/// dialog is where the machine is chosen, and a dialog that could be waved
-/// off would take the choice with it.
-Future<({String machineId, String? prompt})?> showRunLocalModelDialog(
- BuildContext context,
- AppNotifier notifier,
- String machineId, {
- bool chooseMachine = true,
-}) => showAppDialog<({String machineId, String? prompt})>(
- context: context,
- // Lighter than the app's default veil: this is a two-second yes/no in front
- // of the swarm the person was just looking at, not a screen of its own, and
- // the 90% default read as the window going dark. The blur stays, so what is
- // behind is felt rather than read. Same weight the swarm rename uses.
- veilTint: const Color(0x99000000),
- builder: (_) => _RunLocalModelDialog(
- notifier: notifier,
- machineId: machineId,
- chooseMachine: chooseMachine,
- ),
-);
-
-/// Two prerequisites, said only when one is missing, as one sentence with
-/// Start disabled: the machine is reachable (a pane cannot open on a computer
-/// that is not answering — Start used to fail afterwards with "could not find
-/// the home folder", which is the same fact said too late), and it has
-/// opencode, because the manager IS an opencode pane. Whether the account has
-/// local models set up is NOT checked here — the manager itself says so, in
-/// conversation, if it finds nothing; the dialog's job is to let the person
-/// pick a machine and go.
-enum _Prerequisite { unlinked, offline, opencode, gridCli }
-
-class _RunLocalModelDialog extends StatefulWidget {
- const _RunLocalModelDialog({
- required this.notifier,
- required this.machineId,
- required this.chooseMachine,
- });
-
- final AppNotifier notifier;
- final String machineId;
- final bool chooseMachine;
-
- @override
- State<_RunLocalModelDialog> createState() => _RunLocalModelDialogState();
-}
-
-class _RunLocalModelDialogState extends State<_RunLocalModelDialog> {
- /// The machine the manager will open on. Starts as the door's answer and
- /// moves when the person picks another; every read below is about THIS one.
- late String _machineId = widget.machineId;
-
- @override
- void initState() {
- super.initState();
- // One read, fired on open and not waited for: the dialog is readable at
- // once, and a missing opencode appears as it is found. Deferred a frame
- // so a probe's first notifyListeners() does not land mid-build. `force`
- // for the reason New Agent gives — opencode arrives and leaves through a
- // terminal this app never sees, and a stored answer is worth nothing here.
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (!mounted) return;
- _read(_machineId);
- });
- }
-
- /// What the daemon said about the machine's `grid` binary, per machine —
- /// a `missing` here is the one account-independent fact worth stopping on:
- /// the manager's second step runs it, and an agent with no binary to run
- /// dies there.
- final _gridCli = <String, GridCli?>{};
-
- void _read(String machineId) {
- unawaited(widget.notifier.probeEngines(machineId, force: true));
- unawaited(_readGridCli(machineId));
- }
-
- Future<void> _readGridCli(String machineId) async {
- final models = await widget.notifier.gridModels(machineId);
- if (!mounted) return;
- setState(() => _gridCli[machineId] = models.gridCli);
- }
-
- void _pickMachine(String machineId) {
- if (machineId == _machineId) return;
- setState(() => _machineId = machineId);
- _read(machineId);
- }
-
- /// The machines the manager could open on: this computer first, then the
- /// online ones, then the rest — New Agent's order, for the same tiles.
- List<MachineState> get _machines {
- final all = widget.notifier.machines
- .map((m) => widget.notifier.stateOf(m.machineId))
- .whereType<MachineState>()
- .toList();
- int rank(MachineState m) => m.isLocalMachine
- ? 0
- : _online(m)
- ? 1
- : 2;
- final index = {for (var i = 0; i < all.length; i++) all[i]: i};
- all.sort((a, b) {
- final byRank = rank(a).compareTo(rank(b));
- return byRank != 0 ? byRank : index[a]!.compareTo(index[b]!);
- });
- return all;
- }
-
- bool _online(MachineState m) =>
- m.isLocalMachine || (m.nodeOnline == true && !m.needsLink);
-
- Widget _machineMark(MachineState m, {double size = 14}) => Icon(
- _online(m)
- ? (m.isLocalMachine ? LucideIcons.laptop : LucideIcons.monitor)
- : LucideIcons.monitorOff,
- size: size,
- color: _online(m)
- ? grid.AppPalette.textSecondary
- : grid.AppPalette.textFaint,
- semanticLabel: _online(m) ? 'Online' : 'Offline',
- );
-
- /// The machine, as one slim two-line row: the mark on the left spanning both
- /// lines, the name above, what it is below ("This machine", or online /
- /// offline for another). The row is the select's own trigger when there is
- /// more than one machine — same row, plus a chevron — and plain otherwise.
- /// The machine, as one line under its label: "This machine (name)" or the
- /// name — which one the person is sitting at is the fact a hostname alone
- /// does not carry. The row is the select's own
- /// trigger when there is more than one machine (plus a chevron), and plain
- /// otherwise.
- Widget _machineRow(MachineState m, {required bool opens}) => Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- _machineMark(m, size: 16),
- const SizedBox(width: 8),
- Flexible(
- child: Text(
- m.isLocalMachine
- ? 'This machine (${m.machine.displayName})'
- : m.machine.displayName,
- key: const Key('run-local-model-machine'),
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 12.5,
- color: grid.AppPalette.textPrimary,
- ),
- ),
- ),
- if (opens) ...[
- const SizedBox(width: 6),
- Icon(
- LucideIcons.chevronDown,
- size: 12,
- color: grid.AppPalette.textSecondary,
- ),
- ],
- ],
- );
-
- Widget _machineLine(List<MachineState> machines) {
- final current = widget.notifier.stateOf(_machineId) ?? machines.firstOrNull;
- if (current == null) return const SizedBox.shrink();
- if (!widget.chooseMachine || machines.length < 2) {
- // The same shape as the chooser below — a label, then the machine — so
- // the two doors read as one dialog; only the verb differs, because here
- // nothing is chosen.
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- _label('Runs on'),
- _machineRow(current, opens: false),
- ],
- );
- }
- final visible = machines.take(3).toList();
- if (!visible.any((m) => m.machine.machineId == _machineId)) {
- visible[visible.length - 1] = current;
- }
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- _label('Runs on'),
- _chips(visible, machines),
- ],
- );
- }
-
- /// What a machine is, in two words, beside its name.
- String _kind(MachineState m) => m.isLocalMachine
- ? 'This machine'
- : _online(m)
- ? 'Online'
- : 'Offline';
-
- Widget _label(String text) => Padding(
- padding: const EdgeInsets.only(bottom: 8),
- child: Text(
- text,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 12.5,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- );
-
- Widget _chips(List<MachineState> visible, List<MachineState> machines) => Row(
- children: [
- for (final m in visible) ...[
- Flexible(child: _chip(m)),
- const SizedBox(width: 8),
- ],
- if (machines.length > visible.length)
- _MoreMachines(
- key: const Key('run-local-model-machine-more'),
- onOpen: (context, position) =>
- _openMachineMenu(context, position, machines),
- ),
- ],
- );
-
- Widget _chip(MachineState m) {
- final selected = m.machine.machineId == _machineId;
- return InkWell(
- key: ValueKey('run-local-model-machine-${m.machine.machineId}'),
- onTap: () => _pickMachine(m.machine.machineId),
- borderRadius: BorderRadius.circular(6),
- child: Container(
- height: 30,
- padding: const EdgeInsets.symmetric(horizontal: 10),
- decoration: BoxDecoration(
- color: selected ? AppColors.selected : grid.AppSurface.recess,
- borderRadius: BorderRadius.circular(6),
- border: Border.all(
- color: selected ? AppColors.accent : Colors.transparent,
- ),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- _machineMark(m),
- const SizedBox(width: 6),
- Flexible(
- child: Text(
- m.machine.displayName,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 12.5,
- color: grid.AppPalette.textPrimary,
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
-
- Future<void> _openMachineMenu(
- BuildContext anchor,
- RelativeRect position,
- List<MachineState> machines,
- ) async {
- final picked = await showPaneMenu<String>(
- context: anchor,
- position: position,
- minWidth: 260,
- children: (close) => [
- paneMenuHeader('Machines'),
- for (final m in machines)
- paneMenuItem(
- onTap: () => close(m.machine.machineId),
- child: PaneMenuRow(
- selected: m.machine.machineId == _machineId,
- leading: _machineMark(m),
- title: m.machine.displayName,
- status: _kind(m),
- ),
- ),
- ],
- );
- if (picked != null && mounted) _pickMachine(picked);
- }
-
- /// The first missing prerequisite, or null when nothing has been found
- /// missing — which includes "not answered yet".
- _Prerequisite? get _missing {
- final machine = widget.notifier.stateOf(_machineId);
- // Two different facts, two sentences: a machine this computer has no
- // link to is refused by the relay however alive it is, and "offline"
- // would send the person to wake a computer that is already awake.
- if (machine != null && machine.needsLink) return _Prerequisite.unlinked;
- if (machine != null && !_online(machine)) return _Prerequisite.offline;
- if (machine != null && machine.engines.loaded) {
- final opencode = machine.engines['opencode'];
- if (opencode != null && !opencode.installed) {
- return _Prerequisite.opencode;
- }
- }
- if (_gridCli[_machineId] == GridCli.missing) return _Prerequisite.gridCli;
- return null;
- }
-
- @override
- Widget build(BuildContext context) {
- // Lives in an Overlay, so a theme flip never reaches it top-down.
- grid.AppTheme.watch(context);
- return ListenableBuilder(
- listenable: widget.notifier,
- builder: (context, _) {
- final missing = _missing;
- // Said only when something is missing. Satisfied, the dialog says
- // nothing about the machine: the body is the whole message.
- final name =
- widget.notifier.stateOf(_machineId)?.machine.displayName ??
- 'That machine';
- final status = switch (missing) {
- _Prerequisite.unlinked =>
- '$name isn’t linked to this computer yet. Link it from the '
- 'Machines menu, then come back.',
- _Prerequisite.offline =>
- '$name is offline right now. Wake it up, or pick another machine.',
- _Prerequisite.opencode => 'Needs opencode on this machine first.',
- // The feature's name, never the binary's; the daemon installs it on
- // start, so this is a machine whose install did not land.
- _Prerequisite.gridCli =>
- "Harness Compute isn't installed on this machine.",
- null => null,
- };
- final machines = _machines;
- return AlertDialog(
- title: const Text('Run a model on this machine'),
- content: SizedBox(
- // Wider than the app's small dialogs: the machine row below wants
- // three names across before it folds the rest behind "…".
- width: 520,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text.rich(
- TextSpan(
- children: [
- const TextSpan(
- text: 'Model manager',
- style: TextStyle(fontWeight: FontWeight.w600),
- ),
- const TextSpan(
- text:
- " is an agent that finds a model to fit this "
- "computer, downloads it, and keeps it running. "
- "Once it is up, any agent on any of your machines "
- "can switch to it.",
- ),
- ],
- ),
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 13.5,
- height: 1.5,
- color: grid.AppPalette.textPrimary,
- ),
- ),
- const SizedBox(height: 16),
- // Which computer, first: the manager looks after ONE machine's
- // models, and with more than one linked the answer changes what
- // is worth asking it. Never a control unless there is a choice.
- _machineLine(machines),
- if (status != null) ...[
- const SizedBox(height: 16),
- Text(
- status,
- key: const Key('run-local-model-status'),
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 12.5,
- color: grid.AppPalette.textPrimary,
- ),
- ),
- ],
- const SizedBox(height: 18),
- Divider(height: 1, thickness: 1, color: grid.AppPalette.divider),
- const SizedBox(height: 16),
- // The three ways to begin, and the dialog's only action: two
- // openers that start the conversation for you, and a plain door
- // for a person who would rather word it themselves. Pressing one
- // IS the start — there is no Start button left, because there is
- // nothing for it to do that these do not.
- _StartOptions(
- key: const Key('run-local-model-options'),
- enabled: missing == null,
- onChosen: (prompt) => Navigator.of(context).pop((
- machineId: _machineId,
- prompt: prompt,
- )),
- ),
- ],
- ),
- ),
- // Cancel alone: the three options above are the action, and a Start
- // beside them would be a fourth way to begin that means the same as
- // one of them.
- actions: [
- TextButton(
- key: const Key('run-local-model-not-now'),
- onPressed: () => Navigator.of(context).pop(),
- child: const Text('Cancel'),
- ),
- ],
- );
- },
- );
- }
-}
-
-/// The "…" beside the chips: a small recessed square that opens the machine menu anchored under
-/// itself. Its own widget so it has a context to measure from — the menu is positioned from the
-/// button's box, exactly as the pane's picker positions from its control.
-class _MoreMachines extends StatelessWidget {
- const _MoreMachines({super.key, required this.onOpen});
-
- final void Function(BuildContext context, RelativeRect position) onOpen;
-
- @override
- Widget build(BuildContext context) => Tooltip(
- message: 'More machines',
- child: InkWell(
- onTap: () {
- final box = context.findRenderObject() as RenderBox?;
- final overlay =
- Overlay.of(context).context.findRenderObject() as RenderBox?;
- if (box == null || overlay == null) return;
- final origin = box.localToGlobal(Offset.zero, ancestor: overlay);
- onOpen(
- context,
- RelativeRect.fromLTRB(
- origin.dx,
- origin.dy + box.size.height + 6,
- overlay.size.width - origin.dx - box.size.width,
- 0,
- ),
- );
- },
- borderRadius: BorderRadius.circular(6),
- child: Container(
- width: 30,
- height: 30,
- decoration: BoxDecoration(
- color: grid.AppSurface.recess,
- borderRadius: BorderRadius.circular(6),
- ),
- child: Icon(
- Icons.more_horiz,
- size: 18,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- ),
- );
-}
-/// The three ways to begin, and the dialog's only action.
-///
-/// Two openers and a plain door. Pressing one closes the dialog and starts the
-/// manager with that message already submitted — opencode's own `--prompt`, so
-/// the pane's first line is the manager's answer rather than an empty composer.
-///
-/// They used to be example sentences with a copy button each, which was the
-/// best a dialog could do when the pane did not exist yet: copy, open, paste,
-/// send. The pane is created from what this returns, so the button can carry
-/// the message itself and the other three steps disappear.
-///
-/// The third sends nothing, and says why it is there in a second line —
-/// "Open Model manager" alone does not explain why a person would take it over
-/// the two above. It is in the same stack rather than off to one side, because
-/// it is the same kind of choice: a way to begin.
-class _StartOptions extends StatelessWidget {
- const _StartOptions({super.key, required this.enabled, required this.onChosen});
-
- /// False while a prerequisite is missing — the machine is offline, or has no
- /// opencode. Every option leads to the same pane, so they fail together.
- final bool enabled;
-
- /// The message to open with, or null for the plain door.
- final void Function(String? prompt) onChosen;
-
- static const openers = [
- (
- label: 'A model for coding',
- prompt: 'Set up a model for my coding work on this machine.',
- ),
- (
- label: 'A model for chat and writing',
- prompt:
- 'I want a model for chat and writing. What fits this machine, and '
- 'can you set it up?',
- ),
- ];
-
- @override
- Widget build(BuildContext context) => Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Padding(
- padding: const EdgeInsets.only(bottom: 8),
- child: Text(
- 'Start with',
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 12,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- ),
- // One card with dividers rather than separate boxes: three ways to do the
- // same thing are a set, and three loose rectangles read as three features.
- DecoratedBox(
- decoration: BoxDecoration(
- border: Border.all(color: grid.AppPalette.divider),
- borderRadius: BorderRadius.circular(8),
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- for (final opener in openers) ...[
- _Option(
- label: opener.label,
- enabled: enabled,
- onTap: () => onChosen(opener.prompt),
- ),
- Divider(height: 1, thickness: 1, color: grid.AppPalette.divider),
- ],
- _Option(
- label: 'Open Model manager',
- detail: 'Decide what you need in the conversation',
- enabled: enabled,
- onTap: () => onChosen(null),
- ),
- ],
- ),
- ),
- ],
- );
-}
-
-/// One row of the stack: a label, an optional second line, and an arrow that
-/// says this leads somewhere rather than toggling something.
-class _Option extends StatelessWidget {
- const _Option({
- required this.label,
- required this.enabled,
- required this.onTap,
- this.detail,
- });
-
- final String label;
- final String? detail;
- final bool enabled;
- final VoidCallback onTap;
-
- @override
- Widget build(BuildContext context) {
- final ink = enabled
- ? grid.AppPalette.textPrimary
- : grid.AppPalette.textFaint;
- return MouseRegion(
- cursor: enabled ? SystemMouseCursors.click : SystemMouseCursors.basic,
- child: InkWell(
- onTap: enabled ? onTap : null,
- mouseCursor: enabled
- ? SystemMouseCursors.click
- : SystemMouseCursors.basic,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
- child: Row(
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- label,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 13.5,
- color: ink,
- ),
- ),
- if (detail != null) ...[
- const SizedBox(height: 3),
- Text(
- detail!,
- style: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 11.5,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- ],
- ],
- ),
- ),
- const SizedBox(width: 10),
- Icon(
- LucideIcons.arrowRight,
- size: 15,
- color: enabled
- ? grid.AppPalette.textSecondary
- : grid.AppPalette.textFaint,
- ),
- ],
- ),
- ),
- ),
- );
- }
-}
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index b2fbbadc4..b5d1324e3 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -1721,6 +1721,7 @@ class _TerminalHeader extends StatelessWidget {
session.machineId,
session.agentId,
model.id,
+ gridName: model.grid,
),
),
onUseOwnLogin: () => unawaited(
@@ -1729,15 +1730,13 @@ class _TerminalHeader extends StatelessWidget {
session.agentId,
),
),
- // The pane's own context, because the flow opens a dialog before it
- // opens a pane — and the pane's own MACHINE, because a picker on a
- // remote agent's pane is asking about the models that computer can
- // serve, not this one's.
+ // The pane's own context, because the door opens New Agent — and
+ // the pane's own MACHINE, because a picker on a remote agent's pane
+ // is asking about the models that computer can serve, not this one's.
onRunLocalModel: () => unawaited(
notifier.runLocalModel(
context,
machineId: session.machineId,
- chooseMachine: false,
),
),
)
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index 67662fc6a..19763eb63 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -82,6 +82,9 @@ class _WebPanePanelState extends State<WebPanePanel> {
bool _loading = false;
String? _failure;
+ /// The appearance last stamped on the page, so a rebuild that changed nothing runs no script.
+ Brightness? _stampedBrightness;
+
@override
void initState() {
super.initState();
@@ -107,7 +110,12 @@ class _WebPanePanelState extends State<WebPanePanel> {
_loading = true;
_failure = null;
}),
- onPageFinished: (_) => _set(() => _loading = false),
+ onPageFinished: (_) {
+ _set(() => _loading = false);
+ // A fresh document has no stamp; give it the app's appearance before it is looked at.
+ _stampedBrightness = null;
+ _stampTheme();
+ },
onWebResourceError: (error) {
// Only the page itself: a harness's viewer pulls fonts, models
// and images of its own, and one of those failing is its business
@@ -148,6 +156,25 @@ class _WebPanePanelState extends State<WebPanePanel> {
controller.loadRequest(uri);
}
+ /// Tell the page which appearance the app is in.
+ ///
+ /// The web view follows the SYSTEM's light/dark setting on its own (`prefers-color-scheme`),
+ /// not the app's — so an app set to dark on a light Mac showed a light viewer inside a dark
+ /// window, and the two disagreed. The stamp is the same `data-theme` on the document root that
+ /// the app's own artifact pages honour; a viewer that styles for it follows the app, and one
+ /// that does not is unaffected. Runs on every load and whenever the app's theme changes.
+ void _stampTheme() {
+ final controller = _controller;
+ if (controller == null || _loadedUrl == null) return;
+ final brightness = grid.AppTheme.brightness.value;
+ if (brightness == _stampedBrightness) return;
+ _stampedBrightness = brightness;
+ final theme = brightness == Brightness.dark ? 'dark' : 'light';
+ controller
+ .runJavaScript("document.documentElement.setAttribute('data-theme','$theme')")
+ .catchError((_) {});
+ }
+
void _reload() {
if (_controller == null) return;
if (_loadedUrl != widget.pane.url) {
@@ -170,6 +197,8 @@ class _WebPanePanelState extends State<WebPanePanel> {
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
+ // The theme is a dependency of this build; a change here reaches the page too.
+ _stampTheme();
return ColoredBox(
color: grid.AppPalette.windowBg,
child: Column(
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 377a6a316..406f8a823 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -64,7 +64,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
let state = call.arguments as? [String: Any] ?? [:]
self.updateModels(
state["subscriptions"] as? [[String: Any]] ?? [],
- local: state["local"] as? [[String: Any]] ?? []
+ local: state["local"] as? [[String: Any]] ?? [],
+ sections: state["sections"] as? [[String: Any]] ?? []
)
result(nil)
case "keymapState":
@@ -415,22 +416,56 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
}
- private func updateModels(_ rows: [[String: Any]], local: [[String: Any]] = []) {
+ /// One heading's worth of the picker: the account's own grid ("Local") or a shared grid, with
+ /// the models it is serving. `own` picks the heading word; `name` names a shared grid under the
+ /// "Models shared with you" header, or is empty for the account's own grid.
+ private struct MenuGridSection {
+ let name: String
+ let own: Bool
+ let models: [(String, String)] // (model id, node)
+ }
+
+ private func updateModels(_ rows: [[String: Any]], local: [[String: Any]] = [],
+ sections: [[String: Any]] = []) {
let entries = rows.prefix(32).compactMap(SwarmSubscriptionEntry.init)
- // What the account's own grid is serving RIGHT NOW, read off the machines that answer for it.
+ // What the picker is actually serving RIGHT NOW, read off the machines that answer for it.
// Placeholder names lived here before and read as real ones — a menu naming a model nobody is
// serving is worse than a menu admitting it has none.
- let locals: [(String, String)] = local.prefix(32).compactMap {
- guard let id = $0["id"] as? String, !id.isEmpty else { return nil }
- return (id, $0["node"] as? String ?? "")
+ func paired(_ models: [[String: Any]]) -> [(String, String)] {
+ models.prefix(32).compactMap {
+ guard let id = $0["id"] as? String, !id.isEmpty else { return nil }
+ return (id, $0["node"] as? String ?? "")
+ }
+ }
+ let parsed: [MenuGridSection]
+ if sections.isEmpty {
+ // Older Flutter pushes only `local` (the account's own grid). Fall back to one own section.
+ let own = paired(local)
+ parsed = own.isEmpty ? [] : [MenuGridSection(name: "", own: true, models: own)]
+ } else {
+ parsed = sections.prefix(16).compactMap { dict -> MenuGridSection? in
+ guard let name = dict["name"] as? String,
+ let own = dict["own"] as? Bool,
+ let models = dict["models"] as? [[String: Any]] else { return nil }
+ return MenuGridSection(name: name, own: own, models: paired(models))
+ }
}
- guard entries != subscriptions || locals.map({ $0.0 }) != localModels.map({ $0.0 })
- || locals.map({ $0.1 }) != localModels.map({ $0.1 }) else { return }
+ guard entries != subscriptions || !sectionsEqual(parsed, localSections) else { return }
subscriptions = entries
- localModels = locals
+ localSections = parsed
rebuildModelsMenu()
}
+ private func sectionsEqual(_ a: [MenuGridSection], _ b: [MenuGridSection]) -> Bool {
+ guard a.count == b.count else { return false }
+ for (x, y) in zip(a, b) {
+ guard x.name == y.name, x.own == y.own,
+ x.models.map({ $0.0 }) == y.models.map({ $0.0 }),
+ x.models.map({ $0.1 }) == y.models.map({ $0.1 }) else { return false }
+ }
+ return true
+ }
+
/// The mark for a locally served model. Built once: `NSImage(systemSymbolName:)` re-renders the
/// glyph on every call, and this menu rebuilds on each usage refresh.
private static let localModelIcon: NSImage? = {
@@ -438,8 +473,9 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
return image?.withSymbolConfiguration(.init(pointSize: 14, weight: .regular))
}()
- /// `(model id, node)` for every model the account's private grid is serving.
- private var localModels: [(String, String)] = []
+ /// `(model id, node)` for every model the account's private grid is serving, grouped by the
+ /// grid that serves it — the sections the picker draws (own first as "Local", then shared).
+ private var localSections: [MenuGridSection] = []
private func rebuildModelsMenu() {
modelsMenu.removeAllItems()
@@ -458,9 +494,10 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
section("Subscription")
// One width across both sections. Measuring them separately let the menu's two halves size
// independently, so the trailing column stepped in or out at the section break.
+ let allModels = localSections.flatMap { $0.models }
let rowWidth = max(
subscriptions.map(SwarmSubscriptionView.preferredWidth).max() ?? 352,
- localModels.map { SwarmSubscriptionView.preferredWidth(title: $0.0, account: "", status: $0.1) }.max() ?? 352)
+ allModels.map { SwarmSubscriptionView.preferredWidth(title: $0.0, account: "", status: $0.1) }.max() ?? 352)
for entry in subscriptions {
let item = NSMenuItem(title: entry.accessibilityLabel, action: nil, keyEquivalent: "")
let icon = historyIcons.image(engine: entry.engine, asset: entry.iconAsset)
@@ -476,18 +513,30 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
// menu naming providers this app cannot reach reads as a list of things you could pick. The
// section returns when there is a real source for it, not before.
modelsMenu.addItem(.separator())
- section("Local")
- // Nothing served is not said: the "Talk to Model manager" row that ends this section is the
- // answer, and an empty-list sentence above an empty list is noise.
- do {
- for (id, node) in localModels {
+ // One section per grid the picker draws, own first as "Local". The account's own grid carries
+ // the Local header; a shared grid lists under "Models shared with you" with its grid name as
+ // a line under the heading — the same shape the pane picker gives them. With nothing pushed
+ // yet (an older Flutter, or a machine not answering) the menu keeps the legacy Local heading
+ // so it does not collapse to just the run row.
+ if localSections.isEmpty {
+ section("Local")
+ }
+ for gridSection in localSections {
+ if gridSection.own {
+ section("Local models on your machines")
+ } else {
+ section("Models shared with you")
+ let name = NSMenuItem(title: gridSection.name, action: nil, keyEquivalent: "")
+ name.isEnabled = false
+ modelsMenu.addItem(name)
+ }
+ for (id, node) in gridSection.models {
// Same row view as the subscriptions above: the model id reads at full strength where an
- // account name would, and the node — which of the user's own machines answers, the detail
- // that makes a private grid legible — takes the trailing column the usage figures use.
- // The mark is a chip rather than a vendor logo, because what distinguishes these rows is
- // where they run, not who supplies them. Tinted to match the model id beside it: at a
- // secondary weight the glyph sat a shade under the vivid brand artwork above and read as
- // smudge rather than icon.
+ // account name would, and the node — which machine answers, the detail that makes a grid
+ // legible — takes the trailing column the usage figures use. The mark is a chip rather
+ // than a vendor logo, because what distinguishes these rows is where they run, not who
+ // supplies them. Tinted to match the model id beside it: at a secondary weight the glyph
+ // sat a shade under the vivid brand artwork above and read as smudge rather than icon.
let item = NSMenuItem(title: [id, node].filter { !$0.isEmpty }.joined(separator: ", "),
action: nil, keyEquivalent: "")
item.view = SwarmSubscriptionView(title: id, account: "", status: node,
@@ -513,7 +562,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
caption.view = SwarmMenuCaptionView(text: caption.title, width: rowWidth)
caption.isEnabled = false
modelsMenu.addItem(caption)
- let run = NSMenuItem(title: "Talk to Model manager", action: nil, keyEquivalent: "")
+ let run = NSMenuItem(title: "Open Grid", action: nil, keyEquivalent: "")
run.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + "runLocalModel")
if machines.filter({ !$0.shared }).count > 1 {
let pick = NSMenu(title: run.title)
diff --git a/desktop/test/grid_model_picker_test.dart b/desktop/test/grid_model_picker_test.dart
index bc0725095..e20f59191 100644
--- a/desktop/test/grid_model_picker_test.dart
+++ b/desktop/test/grid_model_picker_test.dart
@@ -18,6 +18,7 @@ class _Conn extends WsConn {
this.localModelEngines,
this.gridName,
this.gridCli,
+ this.grids,
this.fails = false,
}) : super(
wsBaseUrl: 'ws://fixture.invalid',
@@ -43,6 +44,10 @@ class _Conn extends WsConn {
/// that does not say.
final String? gridCli;
+ /// Every grid the machine is signed into, in sections (`grids`); null = an older daemon that
+ /// sends only the own grid's `models`.
+ final List<Map<String, Object?>>? grids;
+
/// Make the request FAIL, the way an offline machine or a daemon too old for the call does.
final bool fails;
@@ -58,6 +63,7 @@ class _Conn extends WsConn {
'models': models,
if (localModelEngines != null) 'localModelEngines': localModelEngines,
if (gridCli != null) 'gridCli': gridCli,
+ if (grids != null) 'grids': grids,
};
}
}
@@ -70,6 +76,7 @@ void main() {
List<String>? localModelEngines,
String? gridName,
String? gridCli,
+ List<Map<String, Object?>>? grids,
bool fails = false,
}) {
notifier = AppNotifier(
@@ -81,6 +88,7 @@ void main() {
localModelEngines: localModelEngines,
gridName: gridName,
gridCli: gridCli,
+ grids: grids,
fails: fails,
),
);
@@ -133,7 +141,7 @@ void main() {
// carries — this control cannot put an agent on an API provider, so offering one would be a
// choice that goes nowhere.
expect(find.text('Subscription'), findsOneWidget);
- expect(find.text('Local'), findsOneWidget);
+ expect(find.text('Local models on your machines'), findsOneWidget);
expect(find.text('API'), findsNothing);
// A picker that can only move an agent ONTO a grid is a one-way door, so the engine's own login
@@ -194,7 +202,7 @@ void main() {
await open(tester);
expect(find.text('Nothing is being served yet.'), findsNothing);
expect(find.text('Could not reach this machine.'), findsNothing);
- expect(find.text('Talk to Model manager'), findsOneWidget);
+ expect(find.text('Open Grid'), findsOneWidget);
},
);
@@ -232,9 +240,72 @@ void main() {
expect(find.text('Qwen3.5-4B'), findsOneWidget);
expect(find.text('LFM2.5-8B'), findsOneWidget);
// Still one menu, redrawn — not a second one over the first.
- expect(find.text('Local'), findsOneWidget);
+ expect(find.text('Local models on your machines'), findsOneWidget);
});
+ testWidgets(
+ 'every grid the machine is in gets a section, own first as Local',
+ (tester) async {
+ // A person in a team's grid has models there they can switch to just the same; the daemon
+ // now lists every grid, and the picker draws one section each — the account's own as
+ // "Local", the shared ones by name — and a pick carries the grid it came from.
+ GridModel? picked;
+ build(
+ gridName: 'someone-7f3a91c4',
+ models: const [
+ {'id': 'Qwen3.5-4B', 'node': 'macbook'},
+ ],
+ grids: const [
+ {
+ 'name': 'someone-7f3a91c4',
+ 'own': true,
+ 'models': [
+ {'id': 'Qwen3.5-4B', 'node': 'macbook'},
+ ],
+ },
+ {
+ 'name': 'autonomous.ai',
+ 'own': false,
+ 'models': [
+ {'id': 'DeepSeek-V4-Flash', 'node': 'scholes-60001'},
+ ],
+ },
+ {'name': 'BBB', 'own': false, 'models': <Object?>[]},
+ ],
+ );
+ await open(tester, onSelected: (m) => picked = m);
+
+ expect(find.text('Local models on your machines'), findsOneWidget);
+ expect(find.text('Models shared with you'), findsOneWidget);
+ expect(find.text('autonomous.ai'), findsOneWidget);
+ expect(find.text('Qwen3.5-4B'), findsOneWidget);
+ expect(find.text('DeepSeek-V4-Flash'), findsOneWidget);
+ // Own first: Local sits above the shared grids.
+ expect(
+ tester.getTopLeft(find.text('Local models on your machines')).dy <
+ tester.getTopLeft(find.text('Models shared with you')).dy,
+ isTrue,
+ );
+ // The general fact is the heading; the specific grid is the name under it, not the same
+ // line — "Models shared with you" reads once, "autonomous.ai" reads as which one.
+ expect(
+ tester.getTopLeft(find.text('Models shared with you')).dy <
+ tester.getTopLeft(find.text('autonomous.ai')).dy,
+ isTrue,
+ );
+ // A shared grid serving nothing is not listed: nothing on it can be picked.
+ expect(find.text('BBB'), findsNothing);
+ expect(find.textContaining('BBB'), findsNothing);
+ // Never the word "grid" for the person.
+ expect(find.textContaining('grid'), findsNothing);
+
+ await tester.tap(find.text('DeepSeek-V4-Flash'));
+ await tester.pumpAndSettle();
+ expect(picked?.id, 'DeepSeek-V4-Flash');
+ expect(picked?.grid, 'autonomous.ai');
+ },
+ );
+
testWidgets('a short menu is not as wide as the widest menu could be', (
tester,
) async {
@@ -481,9 +552,11 @@ void main() {
// whatever the surface underneath asked for — an arrow over the rows that are the whole point of
// the menu. The subscription row and each Local model are choices; they should look like it
// before they are clicked.
- build(models: [
- {'id': 'Qwen-Test', 'node': 'macbook-m1max'},
- ]);
+ build(
+ models: [
+ {'id': 'Qwen-Test', 'node': 'macbook-m1max'},
+ ],
+ );
await open(tester);
for (final row in ['Anthropic', 'Qwen-Test']) {
@@ -499,7 +572,10 @@ void main() {
// could be set to `basic` and this test still passed. Two carrying it is what proves both.
final asking = tester
.widgetList<MouseRegion>(
- find.ancestor(of: find.text(row), matching: find.byType(MouseRegion)),
+ find.ancestor(
+ of: find.text(row),
+ matching: find.byType(MouseRegion),
+ ),
)
.where((region) => region.cursor == SystemMouseCursors.click)
.length;
@@ -562,9 +638,9 @@ void main() {
build(models: served);
await open(tester);
final caption = tester.getTopLeft(
- find.text('Want to manage local models?'),
+ find.text('Manage the models on your machines'),
);
- final button = tester.getTopLeft(find.text('Talk to Model manager'));
+ final button = tester.getTopLeft(find.text('Open Grid'));
final model = tester.getBottomLeft(find.text('Qwen-Test'));
// Under the list, not among it: the models are places this agent can go and this starts
@@ -588,12 +664,12 @@ void main() {
await open(tester);
final model = tester.getBottomLeft(find.text('Qwen-Test'));
final caption = tester.getTopLeft(
- find.text('Want to manage local models?'),
+ find.text('Manage the models on your machines'),
);
final captionBottom = tester.getBottomLeft(
- find.text('Want to manage local models?'),
+ find.text('Manage the models on your machines'),
);
- final button = tester.getTopLeft(find.text('Talk to Model manager'));
+ final button = tester.getTopLeft(find.text('Open Grid'));
expect(caption.dy - model.dy, greaterThan(8));
expect(button.dy - captionBottom.dy, greaterThan(8));
});
@@ -607,7 +683,7 @@ void main() {
final box = tester.getSize(
find
.ancestor(
- of: find.text('Talk to Model manager'),
+ of: find.text('Open Grid'),
matching: find.byType(Container),
)
.first,
@@ -621,7 +697,7 @@ void main() {
(tester) async {
// A person with no Local models is exactly who needs it, so it does not wait for a list.
await open(tester);
- expect(find.text('Talk to Model manager'), findsOneWidget);
+ expect(find.text('Open Grid'), findsOneWidget);
// Never the plumbing's name, in this block as in the rest of the menu.
expect(find.textContaining('grid'), findsNothing);
},
@@ -646,7 +722,7 @@ void main() {
final button = tester.widget<Container>(
find
.ancestor(
- of: find.text('Talk to Model manager'),
+ of: find.text('Open Grid'),
matching: find.byType(Container),
)
.first,
@@ -669,7 +745,7 @@ void main() {
onOwnLogin: () => logins++,
onSelected: (m) => picked = m,
);
- await tester.tap(find.text('Talk to Model manager'));
+ await tester.tap(find.text('Open Grid'));
await tester.pumpAndSettle();
expect(runs, 1);
// Not a move: the agent stays where it was. `currentModel` is set so a stray own-login call
@@ -677,7 +753,7 @@ void main() {
expect(logins, 0);
expect(picked, isNull);
// The menu closed on the press, as it does on any choice.
- expect(find.text('Talk to Model manager'), findsNothing);
+ expect(find.text('Open Grid'), findsNothing);
});
});
diff --git a/desktop/test/models_menu_test.dart b/desktop/test/models_menu_test.dart
index 8fe0899c8..f2f7b5085 100644
--- a/desktop/test/models_menu_test.dart
+++ b/desktop/test/models_menu_test.dart
@@ -4,6 +4,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
+import 'package:harness/core/dsh_catalog.dart';
+import 'package:harness/widgets/agent_picker.dart';
+import 'package:harness/shared/widgets/app_choice_picker.dart';
+import 'package:harness/store/store_screen.dart';
+import 'package:harness/core/config.dart';
+import 'package:harness/auth/auth_session.dart';
import 'package:harness/screens/swarm_screen.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/state/swarm_catalog.dart';
@@ -12,64 +18,80 @@ import 'package:harness/usage/usage_accounts.dart';
import 'package:harness/usage/usage_controller.dart';
import 'package:harness/usage/usage_source.dart';
import 'package:harness/usage/usage_window.dart';
-import 'package:harness/ws/ws_conn.dart';
import 'swarm_state_test.dart' show createApp;
-/// Answers what the Talk to Model manager dialog reads on opening and records the
-/// create it sends on Start. Anything else asked (the terminal the new pane
-/// opens, say) is left pending, which is what a machine that has not answered
-/// yet looks like — the same shape as the dialog's own test.
-class _LocalModelConn extends WsConn {
- _LocalModelConn([String machineId = 'm'])
+/// Stands in for the machine behind the Open Grid door: the probes New Agent
+/// makes answer at once, and the harness list says whether Grid is installed
+/// there. Nothing is created — the door's job ends when New Agent is open on
+/// the right machine with Grid chosen, or the Store is open on Grid's page.
+class _GridApp extends AppNotifier {
+ _GridApp({required this.grid})
: super(
- wsBaseUrl: 'ws://fixture.invalid',
- autonomousEnv: 'test',
- machineId: machineId,
- accessTokenProvider: (_, _) async => '',
- onAuthFailure: (_) {},
- onEvent: (_) {},
- onStatus: (_) {},
- );
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ ) {
+ hasNavigationRail = false;
+ }
+
+ /// Per machine: true = Grid installed, false = listed but not installed,
+ /// absent = the machine never heard of it.
+ final Map<String, bool> grid;
- final creates = <Map<String, dynamic>>[];
+ @override
+ Future<void> probeEngines(String machineId, {bool force = false}) async {}
@override
- Future<Map<String, dynamic>> request(
- String type, {
- Map<String, dynamic> payload = const {},
- Duration timeout = const Duration(seconds: 20),
- }) {
- switch (type) {
- case 'engines_probe':
- return Future.value({
- 'engines': [
- {'engine': 'opencode', 'installed': true},
- ],
- });
- case 'grid_models_list':
- return Future.value({'gridName': 'someone-7f3a91c4', 'models': []});
- case 'fs_list_dir':
- return Future.value({
- 'path': '/home/remote',
- 'entries': [],
- 'truncated': false,
- });
- case 'agent_create':
- creates.add(Map.of(payload));
- return Future.value({
- 'creationId': payload['creationId'],
- 'state': 'created',
- 'agent': {
- 'id': 'lm1',
- 'name': 'Model manager',
- 'engine': 'opencode',
- },
- });
- default:
- return Completer<Map<String, dynamic>>().future;
- }
+ Future<void> probeDsh(String machineId, {bool force = false}) async {
+ final installed = grid[machineId];
+ machineStates[machineId]!.dsh.replace([
+ if (installed != null)
+ DshEntry(
+ id: AppNotifier.gridHarness,
+ name: 'Grid',
+ engine: 'codex',
+ description: 'Talk to your fleet.',
+ installed: installed,
+ ),
+ ]);
+ notifyListeners();
+ }
+
+ @override
+ Future<Map<String, dynamic>> listCodexProfiles(
+ String machineId, {
+ Set<String> observedPaths = const {},
+ }) async => {'profiles': <dynamic>[]};
+}
+
+_GridApp _gridApp({
+ required Map<String, bool> grid,
+ bool secondMachine = false,
+}) {
+ final app = _GridApp(grid: grid);
+ const machine = Machine(
+ machineId: 'm',
+ authMode: MachineAuthMode.remote,
+ name: 'Test host',
+ );
+ app.machines = [machine];
+ app.machineStates['m'] = MachineState(machine)
+ ..localOnly = true
+ ..nodeOnline = true
+ ..agentLoadStatus = AgentLoadStatus.loaded;
+ if (secondMachine) {
+ const other = Machine(
+ machineId: 'other',
+ authMode: MachineAuthMode.remote,
+ name: 'Studio',
+ );
+ app.machines = [machine, other];
+ app.machineStates['other'] = MachineState(other)
+ ..nodeOnline = true
+ ..agentLoadStatus = AgentLoadStatus.loaded;
}
+ return app;
}
class _Source implements UsageSource {
@@ -315,76 +337,13 @@ void main() {
},
);
- testWidgets(
- 'native runLocalModel opens the dialog, and Start creates the agent',
- (tester) async {
- // The Models menu's one command arrives as a bare method call with no
- // arguments, the way Link Machine… does. It must reach the notifier's
- // action through this screen's context — the dialog is the proof the
- // door is wired, and the create is the proof it leads somewhere.
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- const channel = MethodChannel('harness/swarm_tabs');
- final messenger = tester.binding.defaultBinaryMessenger;
- messenger.setMockMethodCallHandler(channel, (call) async => true);
- addTearDown(() => messenger.setMockMethodCallHandler(channel, null));
- final conn = _LocalModelConn();
- final app = createApp(connectionForTest: (_) => conn);
- // A create on a machine the app believes offline parks the agent and
- // polls for the node — a timer that never lets the frame settle. The
- // fixture host is answering, so say so.
- app.machineStates['m']!.nodeOnline = true;
- final projects = SwarmProjectStore();
- await tester.pumpWidget(
- MaterialApp(
- home: SwarmScreen(
- notifier: app,
- nativeTabs: true,
- projectStore: projects,
- ),
- ),
- );
- final reply = Completer<void>();
- messenger.handlePlatformMessage(
- channel.name,
- const StandardMethodCodec().encodeMethodCall(
- const MethodCall('runLocalModel'),
- ),
- (_) => reply.complete(),
- );
- await tester.pumpAndSettle();
- expect(find.text('Run a model on this machine'), findsOneWidget);
- // Nothing is missing on this machine, so nothing about it is said.
- expect(find.byKey(const Key('run-local-model-status')), findsNothing);
- expect(conn.creates, isEmpty);
-
- await tester.tap(find.text('Open Model manager'));
- await tester.pumpAndSettle();
- // The handler answers only once the dialog is done, the way every
- // dialog door does, so native focus is not handed back mid-dialog.
- await reply.future;
- expect(find.text('Run a model on this machine'), findsNothing);
- final create = conn.creates.single;
- expect(create['engine'], 'opencode');
- expect(create['agent'], AppNotifier.localModelAgent);
- expect(create['name'], AppNotifier.localModelAgentName);
- expect(create.containsKey('prompt'), isFalse);
- expect(create['cwd'], '/home/remote');
-
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- projects.dispose();
- },
- );
-
- testWidgets('native runLocalModel with a machineId opens on THAT machine', (
- tester,
- ) async {
- // With two machines linked the native menu lists them and names the chosen
- // one. The create — and the dialog's own reads — must go to that machine's
- // connection, not to this computer's: the manager manages the models of
- // the computer it runs on.
+ /// Mount the swarm screen on [app] and send the native Models menu's
+ /// `runLocalModel` command, with or without a machine.
+ Future<void> openGridDoor(
+ WidgetTester tester,
+ _GridApp app, {
+ String? machineId,
+ }) async {
tester.view.physicalSize = const Size(1200, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
@@ -392,22 +351,8 @@ void main() {
final messenger = tester.binding.defaultBinaryMessenger;
messenger.setMockMethodCallHandler(channel, (call) async => true);
addTearDown(() => messenger.setMockMethodCallHandler(channel, null));
- final conns = {
- 'm': _LocalModelConn('m'),
- 'other': _LocalModelConn('other'),
- };
- final app = createApp(connectionForTest: (id) => conns[id]!);
- const other = Machine(
- machineId: 'other',
- authMode: MachineAuthMode.remote,
- name: 'Studio',
- );
- app.machines = [...app.machines, other];
- app.machineStates['other'] = MachineState(other)
- ..nodeOnline = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- app.machineStates['m']!.nodeOnline = true;
final projects = SwarmProjectStore();
+ addTearDown(projects.dispose);
await tester.pumpWidget(
MaterialApp(
home: SwarmScreen(
@@ -421,22 +366,73 @@ void main() {
messenger.handlePlatformMessage(
channel.name,
const StandardMethodCodec().encodeMethodCall(
- const MethodCall('runLocalModel', {'machineId': 'other'}),
+ MethodCall(
+ 'runLocalModel',
+ machineId == null ? null : {'machineId': machineId},
+ ),
),
(_) => reply.complete(),
);
await tester.pumpAndSettle();
- await tester.tap(find.text('Open Model manager'));
- await tester.pumpAndSettle();
- await reply.future;
+ }
+
+ testWidgets('native runLocalModel opens New Agent with Grid chosen', (
+ tester,
+ ) async {
+ // The Models menu's command arrives as a bare method call, the way Link
+ // Machine… does. Grid is installed here, so the door is the Store's Open
+ // button in another place: a draft tab, New Agent, Grid already chosen.
+ final app = _gridApp(grid: {'m': true});
+ await openGridDoor(tester, app);
+
+ // The dialog is open (its title also names the tab and the start card).
+ expect(find.byType(AgentPicker), findsOneWidget);
+ final picker = tester.widget<AgentPicker>(find.byType(AgentPicker));
+ expect(picker.value, AppNotifier.gridHarness);
+ expect(app.activeSwarm.isStore, isFalse);
+ expect(app.panes, isEmpty);
+
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+
+ testWidgets('native runLocalModel with a machineId opens on THAT machine', (
+ tester,
+ ) async {
+ // With two machines linked the native menu lists them and names the chosen
+ // one: New Harness opens with that machine selected, so Grid manages the
+ // models of the computer it runs on.
+ final app = _gridApp(grid: {'m': true, 'other': true}, secondMachine: true);
+ await openGridDoor(tester, app, machineId: 'other');
+
+ expect(find.byType(AgentPicker), findsOneWidget);
+ expect(
+ tester.widget<AgentPicker>(find.byType(AgentPicker)).value,
+ AppNotifier.gridHarness,
+ );
+ final machines = tester.widget<AppChoicePicker<String>>(
+ find.byKey(const Key('new-agent-machine-field')),
+ );
+ expect(machines.value, 'other');
+
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+
+ testWidgets("without Grid installed, the door is the Store on Grid's page", (
+ tester,
+ ) async {
+ // No harness to open yet: the Store's page for Grid has Install, and that
+ // is the way in. No New Harness, no pane.
+ final app = _gridApp(grid: {'m': false});
+ await openGridDoor(tester, app);
- expect(conns['m']!.creates, isEmpty);
- final create = conns['other']!.creates.single;
- expect(create['agent'], AppNotifier.localModelAgent);
- expect(app.panes.single.machineId, 'other');
+ expect(find.byType(AgentPicker), findsNothing);
+ expect(app.activeSwarm.isStore, isTrue);
+ expect(find.byType(StoreTab), findsOneWidget);
+ expect(app.panes, isEmpty);
await tester.pumpWidget(const SizedBox());
app.dispose();
- projects.dispose();
});
}
diff --git a/desktop/test/run_local_model_dialog_test.dart b/desktop/test/run_local_model_dialog_test.dart
deleted file mode 100644
index 57f1215fb..000000000
--- a/desktop/test/run_local_model_dialog_test.dart
+++ /dev/null
@@ -1,761 +0,0 @@
-// The Talk to Model manager dialog and the one action behind it: the copy, the machine line, the
-// prerequisites that replace it, and what Start actually sends.
-import 'dart:async';
-import 'dart:io' show Platform;
-
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-import 'package:harness/auth/auth_session.dart';
-import 'package:harness/core/config.dart';
-import 'package:harness/core/models.dart';
-import 'package:harness/settings/config_store.dart';
-import 'package:harness/state/app_state.dart';
-import 'package:harness/widgets/pane_menu.dart';
-import 'package:harness/ws/ws_conn.dart';
-
-/// A connection that answers the dialog's three reads and the create at once. Without it the
-/// dialog would wait out each request's own timeout, and `pumpAndSettle` would be measuring those
-/// rather than the dialog. Anything else asked of it (a terminal open after the create, say) is
-/// left pending, which is what a machine that has not answered yet looks like.
-class _Conn extends WsConn {
- _Conn({required this.engines, required this.gridName, this.gridCli})
- : super(
- wsBaseUrl: 'ws://fixture.invalid',
- autonomousEnv: 'test',
- machineId: 'local',
- accessTokenProvider: (_, _) async => '',
- onAuthFailure: (_) {},
- onEvent: (_) {},
- onStatus: (_) {},
- );
-
- final List<Map<String, Object?>> engines;
- final String? gridName;
-
- /// The daemon's word on the machine's `grid` binary (`managed`/`path`/`missing`); null = an
- /// older daemon that sends no such field.
- final String? gridCli;
-
- /// What the daemon names the created agent. A daemon that knows `name` echoes it; one that
- /// predates the field names the pane itself — the shape of an old Harness on that machine.
- String replyName = 'Model manager';
-
- /// Every `agent_create` payload, verbatim — the wire is what the plan specifies.
- final creates = <Map<String, dynamic>>[];
-
- @override
- Future<Map<String, dynamic>> request(
- String type, {
- Map<String, dynamic> payload = const {},
- Duration timeout = const Duration(seconds: 20),
- }) {
- switch (type) {
- case 'engines_probe':
- return Future.value({'engines': engines});
- case 'grid_models_list':
- return Future.value({
- 'gridName': gridName,
- 'models': <Object?>[],
- if (gridCli != null) 'gridCli': gridCli,
- });
- case 'fs_list_dir':
- return Future.value({
- 'path': '/home/remote',
- 'entries': <Object?>[],
- 'truncated': false,
- });
- case 'agent_create':
- creates.add(Map.of(payload));
- return Future.value({
- 'creationId': payload['creationId'],
- 'state': 'created',
- 'agent': {'id': 'lm1', 'name': replyName, 'engine': 'opencode'},
- });
- default:
- return Completer<Map<String, dynamic>>().future;
- }
- }
-}
-
-const _installed = [
- {'engine': 'opencode', 'installed': true},
-];
-
-void main() {
- late AppNotifier notifier;
- late _Conn conn;
-
- void build({
- List<Map<String, Object?>> engines = _installed,
- String? gridName = 'someone-7f3a91c4',
- String? gridCli,
- ConfigStore? configStore,
- bool local = true,
- }) {
- conn = _Conn(engines: engines, gridName: gridName, gridCli: gridCli);
- notifier = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: configStore,
- connectionForTest: (_) => conn,
- )..hasNavigationRail = false;
- const machine = Machine(
- machineId: 'local',
- authMode: MachineAuthMode.remote,
- name: 'studio-7',
- );
- notifier.machines = [machine];
- notifier.machineStates['local'] = MachineState(machine)
- ..localOnly = local
- // A remote fixture is answering: the dialog now refuses an offline machine before Start.
- ..nodeOnline = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- if (!local) notifier.selectedMachineId = 'local';
- }
-
- setUp(() => build());
- tearDown(() => notifier.dispose());
-
- /// Mounts a door — one button that calls the action every real door calls — and presses it.
- Future<void> open(WidgetTester tester) async {
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Builder(
- builder: (context) => Center(
- child: TextButton(
- key: const Key('door'),
- onPressed: () => notifier.runLocalModel(context),
- child: const Text('Talk to Model manager'),
- ),
- ),
- ),
- ),
- ),
- );
- await tester.tap(find.byKey(const Key('door')));
- await tester.pumpAndSettle();
- }
-
- // The three ways to begin ARE the action now, so "is Start enabled" became "does an option
- // lead anywhere". They fail together — every one opens the same pane.
- final start = find.text('Open Model manager');
- final coding = find.text('A model for coding');
- final status = find.byKey(const Key('run-local-model-status'));
- String statusText(WidgetTester tester) => tester.widget<Text>(status).data!;
- bool startEnabled(WidgetTester tester) => tester
- .widget<InkWell>(find.ancestor(of: start, matching: find.byType(InkWell)).first)
- .onTap != null;
-
- testWidgets('the copy is the plan\'s, and names no plumbing', (tester) async {
- await open(tester);
-
- expect(find.text('Run a model on this machine'), findsOneWidget);
- expect(
- find.text(
- "Model manager is an agent that finds a model to fit this computer, downloads it, and "
- "keeps it running. Once it is up, any agent on any of your machines can switch to it.",
- ),
- findsOneWidget,
- );
- // No "Don't show this again": the dialog is where the machine is chosen, and a dialog that
- // could be waved off would take the choice with it.
- expect(find.text("Don't show this again"), findsNothing);
- expect(find.text('Cancel'), findsOneWidget);
- // No Start beside the options: it would be a fourth way to begin that means the same as one
- // of them. Pressing an option IS the start.
- expect(find.text('Start'), findsNothing);
- expect(start, findsOneWidget);
- // The product's two rules for this dialog: never the CLI's name, never one vendor's noun for
- // a computer. The app runs on Linux too.
- expect(find.textContaining('grid'), findsNothing);
- expect(find.textContaining('this Mac'), findsNothing);
- // The body introduces the agent by name and never says the product's: the person is meeting
- // Model manager, not being told to go talk to Harness.
- expect(find.textContaining('Harness'), findsNothing);
- expect(find.textContaining('!'), findsNothing);
- // No dashes of any kind in the copy: the owner's rule for this dialog.
- expect(find.textContaining('—'), findsNothing);
- expect(find.textContaining('–'), findsNothing);
- // Nothing about prerequisites when nothing is missing — but WHICH machine is always said,
- // this computer marked as such, so nobody has to guess where the manager will open.
- expect(status, findsNothing);
- // One slim row, not a control: with one machine there is nothing to choose.
- expect(find.byKey(const Key('run-local-model-machine')), findsOneWidget);
- expect(find.text('This machine (studio-7)'), findsOneWidget);
- // No chips and no "…": one machine is a statement, not a choice. The LABEL is the same either
- // way — "Runs on" reads right for both — so the chips are what say which of the two this is.
- expect(
- find.byKey(const ValueKey('run-local-model-machine-local')),
- findsNothing,
- );
- expect(find.byKey(const Key('run-local-model-machine-more')), findsNothing);
- expect(find.textContaining('(this computer)'), findsNothing);
- });
-
- testWidgets('an opener starts the manager WITH its message', (tester) async {
- // These were example sentences with a copy button each — the best a dialog could do when the
- // pane did not exist yet: copy, open, paste, send. The pane is created from what this dialog
- // returns, so the button carries the message itself and the other three steps disappear.
- await open(tester);
-
- expect(find.text('Start with'), findsOneWidget);
- expect(coding, findsOneWidget);
- expect(find.text('A model for chat and writing'), findsOneWidget);
- // Nothing to copy any more, so nothing claims there is.
- expect(find.text('Try saying'), findsNothing);
- expect(find.byIcon(LucideIcons.copy), findsNothing);
-
- await tester.tap(coding);
- await tester.pumpAndSettle();
-
- expect(conn.creates, hasLength(1));
- expect(
- conn.creates.single['prompt'],
- 'Set up a model for my coding work on this machine.',
- );
- });
-
- testWidgets('the plain door sends nothing', (tester) async {
- // The third option is for a person who would rather word it themselves, so it must not put
- // words in their mouth — `prompt` absent, exactly as before this dialog had buttons.
- await open(tester);
-
- expect(find.text('Decide what you need in the conversation'), findsOneWidget);
- await tester.tap(start);
- await tester.pumpAndSettle();
-
- expect(conn.creates, hasLength(1));
- expect(conn.creates.single.containsKey('prompt'), isFalse);
- });
-
- testWidgets('missing opencode is said, and disables Start', (tester) async {
- build(
- engines: const [
- {'engine': 'opencode', 'installed': false},
- ],
- );
- await open(tester);
-
- expect(statusText(tester), 'Needs opencode on this machine first.');
- // The machine is still named: the sentence is about it.
- expect(find.text('This machine (studio-7)'), findsOneWidget);
- expect(startEnabled(tester), isFalse);
- await tester.tap(start, warnIfMissed: false);
- await tester.pumpAndSettle();
- expect(start, findsOneWidget);
- expect(conn.creates, isEmpty);
- });
-
- testWidgets('no private grid is NOT the dialog\'s business', (tester) async {
- // `gridName: null` used to disable Start with a sentence about the account. The dialog now
- // only picks a machine and goes; whether local models are set up there is the manager's own
- // first finding, said in conversation. A connected person is never stopped here.
- build(gridName: null);
- await open(tester);
-
- expect(status, findsNothing);
- expect(startEnabled(tester), isTrue);
- expect(find.textContaining('grid'), findsNothing);
- expect(find.textContaining('set up'), findsNothing);
- });
-
- testWidgets('an offline machine is said before Start, not after', (
- tester,
- ) async {
- // A remote machine whose daemon is not answering. Start used to go ahead and fail on the
- // home-folder read — the same fact, discovered after the click. Now the dialog says it and
- // Start waits, and picking a machine that IS online clears it.
- final conns = {
- 'local': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- 'studio': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- };
- notifier.dispose();
- notifier = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: null,
- connectionForTest: (id) => conns[id]!,
- )..hasNavigationRail = false;
- const local = Machine(
- machineId: 'local',
- authMode: MachineAuthMode.remote,
- name: 'this one',
- );
- const studio = Machine(
- machineId: 'studio',
- authMode: MachineAuthMode.remote,
- name: 'studio-7',
- );
- notifier.machines = [local, studio];
- notifier.machineStates['local'] = MachineState(local)
- ..localOnly = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- notifier.machineStates['studio'] = MachineState(studio)
- ..nodeOnline = false
- ..agentLoadStatus = AgentLoadStatus.loaded;
-
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Builder(
- builder: (context) => TextButton(
- key: const Key('door'),
- onPressed: () =>
- notifier.runLocalModel(context, machineId: 'studio'),
- child: const Text('door'),
- ),
- ),
- ),
- ),
- );
- await tester.tap(find.byKey(const Key('door')));
- await tester.pumpAndSettle();
-
- expect(
- statusText(tester),
- 'studio-7 is offline right now. Wake it up, or pick another machine.',
- );
- expect(startEnabled(tester), isFalse);
-
- // A machine that is up but not LINKED to this computer is a different sentence: the relay
- // refuses it (4404), and telling the person to wake it would send them to a computer that is
- // already awake.
- notifier.machineStates['studio']!
- ..nodeOnline = true
- ..needsLink = true;
- notifier.notifyListeners();
- await tester.pumpAndSettle();
- expect(
- statusText(tester),
- 'studio-7 isn’t linked to this computer yet. Link it from the Machines menu, then come back.',
- );
- expect(startEnabled(tester), isFalse);
- notifier.machineStates['studio']!.needsLink = false;
-
- await tester.tap(
- find.byKey(const ValueKey('run-local-model-machine-local')),
- );
- await tester.pumpAndSettle();
- expect(status, findsNothing);
- expect(startEnabled(tester), isTrue);
- });
-
- testWidgets('an old daemon that ignores the agent is named as the cause', (
- tester,
- ) async {
- // A Harness that predates `agent`/`name` opens a plain opencode pane and names it itself.
- // The pane exists, so the person is told what happened instead of watching a manager that
- // never introduces itself.
- build();
- conn.replyName = 'harness-2';
- await open(tester);
- await tester.tap(start);
- await tester.pumpAndSettle();
-
- expect(conn.creates, hasLength(1));
- expect(
- notifier.lastError,
- 'Harness on studio-7 is too old to open Model manager: it opened a plain opencode '
- 'pane instead. Update Harness there and try again.',
- );
- });
-
- testWidgets(
- 'a machine with no Harness Compute binary is said, and disables Start',
- (tester) async {
- // `gridCli: missing` is the daemon saying there is no `grid` on this computer to serve with —
- // the daemon installs one on start, so this is a machine whose install did not land. Said as
- // the feature's name, never the binary's; the account's grid is not the dialog's business.
- build(gridCli: 'missing', gridName: null);
- await open(tester);
-
- expect(
- statusText(tester),
- "Harness Compute isn't installed on this machine.",
- );
- expect(find.textContaining('grid'), findsNothing);
- expect(find.textContaining('sign in'), findsNothing);
- expect(startEnabled(tester), isFalse);
- },
- );
-
- testWidgets('Not now creates nothing', (tester) async {
- await open(tester);
- await tester.tap(find.byKey(const Key('run-local-model-not-now')));
- await tester.pumpAndSettle();
-
- expect(find.text('Models that live on your machine'), findsNothing);
- expect(conn.creates, isEmpty);
- expect(notifier.panes, isEmpty);
- });
-
- testWidgets(
- 'Start opens opencode in the home folder as the harness-compute agent, named',
- (tester) async {
- await open(tester);
- await tester.tap(start);
- await tester.pumpAndSettle();
-
- expect(find.text('Models that live on your machine'), findsNothing);
- final payload = conn.creates.single;
- expect(payload['engine'], 'opencode');
- // The pane IS the agent (`opencode --agent harness-compute`), and is titled before opencode
- // reports a session title.
- expect(payload['agent'], 'harness-compute');
- expect(payload['name'], 'Model manager');
- // No first message: the person opens the conversation, and the dialog says so.
- expect(payload.containsKey('prompt'), isFalse);
- // Home, not a project: a local model is not about any one repo.
- expect(payload['cwd'], Platform.environment['HOME']);
- expect(payload.containsKey('dsh'), isFalse);
- // The pane appearing IS the confirmation — created, placed and focused the way New Agent does.
- expect(notifier.panes.single.agentId, 'lm1');
- expect(notifier.focusedPane?.agentId, 'lm1');
- },
- );
-
- testWidgets('an ordinary create sends neither prompt, name nor agent', (
- tester,
- ) async {
- // A daemon that knows the fields refuses a prompt or an agent for an engine with no way to
- // take one, so the fields must be ABSENT — not empty — on every create that did not ask.
- await notifier.createAgent('local', engine: 'claude', folder: '/work');
- final payload = conn.creates.single;
- expect(payload.containsKey('prompt'), isFalse);
- expect(payload.containsKey('name'), isFalse);
- expect(payload.containsKey('agent'), isFalse);
- });
-
- testWidgets('a named machine wins over this computer\'s own', (tester) async {
- // The pane picker names its pane's machine. This computer has a local machine of its own
- // here, and it must NOT be preferred: a picker on a remote agent's pane is asking about the
- // models THAT computer can serve.
- final conns = {
- 'local': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- 'studio': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- };
- notifier.dispose();
- notifier = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: null,
- connectionForTest: (id) => conns[id]!,
- )..hasNavigationRail = false;
- const local = Machine(
- machineId: 'local',
- authMode: MachineAuthMode.remote,
- name: 'this one',
- );
- const studio = Machine(
- machineId: 'studio',
- authMode: MachineAuthMode.remote,
- name: 'studio-7',
- );
- notifier.machines = [local, studio];
- notifier.machineStates['local'] = MachineState(local)
- ..localOnly = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- notifier.machineStates['studio'] = MachineState(studio)
- ..nodeOnline = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
-
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Builder(
- builder: (context) => TextButton(
- key: const Key('door'),
- onPressed: () =>
- notifier.runLocalModel(context, machineId: 'studio'),
- child: const Text('door'),
- ),
- ),
- ),
- ),
- );
- await tester.tap(find.byKey(const Key('door')));
- await tester.pumpAndSettle();
- await tester.tap(start);
- await tester.pumpAndSettle();
-
- expect(conns['local']!.creates, isEmpty);
- // That machine's own home, as it reports it — never this computer's `$HOME`.
- expect(conns['studio']!.creates.single['cwd'], '/home/remote');
- expect(notifier.panes.single.machineId, 'studio');
- });
-
- testWidgets('from a pane, the machine is named, not offered', (tester) async {
- // A pane's picker asks about THAT pane's computer. Two machines linked, the door names the
- // remote one and says not to offer the other: the dialog shows one plain row, no chips, and
- // Start opens there.
- final conns = {
- 'local': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- 'studio': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- };
- notifier.dispose();
- notifier = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: null,
- connectionForTest: (id) => conns[id]!,
- )..hasNavigationRail = false;
- const local = Machine(
- machineId: 'local',
- authMode: MachineAuthMode.remote,
- name: 'this one',
- );
- const studio = Machine(
- machineId: 'studio',
- authMode: MachineAuthMode.remote,
- name: 'studio-7',
- );
- notifier.machines = [local, studio];
- notifier.machineStates['local'] = MachineState(local)
- ..localOnly = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- notifier.machineStates['studio'] = MachineState(studio)
- ..nodeOnline = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
-
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Builder(
- builder: (context) => TextButton(
- key: const Key('door'),
- onPressed: () => notifier.runLocalModel(
- context,
- machineId: 'studio',
- chooseMachine: false,
- ),
- child: const Text('door'),
- ),
- ),
- ),
- ),
- );
- await tester.tap(find.byKey(const Key('door')));
- await tester.pumpAndSettle();
-
- // Named plainly, under the same label the chooser wears, and NOT called this machine.
- expect(find.text('Runs on'), findsOneWidget);
- expect(find.text('studio-7'), findsOneWidget);
- expect(find.textContaining('This machine'), findsNothing);
- expect(
- find.byKey(const ValueKey('run-local-model-machine-local')),
- findsNothing,
- );
- expect(
- find.byKey(const ValueKey('run-local-model-machine-studio')),
- findsNothing,
- );
-
- await tester.tap(start);
- await tester.pumpAndSettle();
- expect(conns['local']!.creates, isEmpty);
- expect(conns['studio']!.creates, hasLength(1));
- });
-
- testWidgets('with two machines the dialog lists them, and the pick wins', (
- tester,
- ) async {
- // The door's machine is where the dialog STARTS; the person can move it. Two machines, the
- // door names the remote one, the person picks this computer: the create lands here.
- final conns = {
- 'local': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- 'studio': _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- };
- notifier.dispose();
- notifier = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: null,
- connectionForTest: (id) => conns[id]!,
- )..hasNavigationRail = false;
- const local = Machine(
- machineId: 'local',
- authMode: MachineAuthMode.remote,
- name: 'this one',
- );
- const studio = Machine(
- machineId: 'studio',
- authMode: MachineAuthMode.remote,
- name: 'studio-7',
- );
- notifier.machines = [local, studio];
- notifier.machineStates['local'] = MachineState(local)
- ..localOnly = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- notifier.machineStates['studio'] = MachineState(studio)
- ..nodeOnline = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
-
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Builder(
- builder: (context) => TextButton(
- key: const Key('door'),
- onPressed: () =>
- notifier.runLocalModel(context, machineId: 'studio'),
- child: const Text('door'),
- ),
- ),
- ),
- ),
- );
- await tester.tap(find.byKey(const Key('door')));
- await tester.pumpAndSettle();
- // Both machines as chips on one row, this computer first, the door's machine chosen — and
- // one sentence saying what the chips are for.
- expect(find.text('Runs on'), findsOneWidget);
- final localChip = find.byKey(
- const ValueKey('run-local-model-machine-local'),
- );
- final remoteChip = find.byKey(
- const ValueKey('run-local-model-machine-studio'),
- );
- expect(localChip, findsOneWidget);
- expect(remoteChip, findsOneWidget);
- expect(
- tester.getTopLeft(localChip).dx < tester.getTopLeft(remoteChip).dx,
- isTrue,
- );
- expect(tester.getTopLeft(localChip).dy, tester.getTopLeft(remoteChip).dy);
- // Two machines fit; nothing is folded behind "…".
- expect(find.byKey(const Key('run-local-model-machine-more')), findsNothing);
-
- await tester.tap(localChip);
- await tester.pumpAndSettle();
- await tester.tap(start);
- await tester.pumpAndSettle();
-
- expect(conns['studio']!.creates, isEmpty);
- expect(conns['local']!.creates, hasLength(1));
- expect(notifier.panes.single.machineId, 'local');
- });
-
- testWidgets('five machines stay on one row: three chips and a "…" list', (
- tester,
- ) async {
- // The row never grows with the account. Past three, the rest fold behind the more button,
- // which opens the full list — and a machine chosen from there takes a visible slot.
- final ids = ['local', 'b', 'c', 'd', 'e'];
- final conns = {
- for (final id in ids)
- id: _Conn(engines: _installed, gridName: 'someone-7f3a91c4'),
- };
- notifier.dispose();
- notifier = AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: null,
- connectionForTest: (id) => conns[id]!,
- )..hasNavigationRail = false;
- notifier.machines = [
- for (final id in ids)
- Machine(
- machineId: id,
- authMode: MachineAuthMode.remote,
- name: 'box-$id',
- ),
- ];
- for (final m in notifier.machines) {
- notifier.machineStates[m.machineId] = MachineState(m)
- ..localOnly = m.machineId == 'local'
- ..nodeOnline = true
- ..agentLoadStatus = AgentLoadStatus.loaded;
- }
- tester.view.physicalSize = const Size(1200, 900);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Builder(
- builder: (context) => TextButton(
- key: const Key('door'),
- onPressed: () =>
- notifier.runLocalModel(context, machineId: 'local'),
- child: const Text('door'),
- ),
- ),
- ),
- ),
- );
- await tester.tap(find.byKey(const Key('door')));
- await tester.pumpAndSettle();
-
- final chips = [
- for (final id in ids) find.byKey(ValueKey('run-local-model-machine-$id')),
- ];
- expect(chips[0], findsOneWidget);
- expect(chips[1], findsOneWidget);
- expect(chips[2], findsOneWidget);
- expect(chips[3], findsNothing);
- expect(chips[4], findsNothing);
- final more = find.byKey(const Key('run-local-model-machine-more'));
- expect(more, findsOneWidget);
- // All on one line.
- final tops = {for (final c in chips.take(3)) tester.getTopLeft(c).dy};
- expect(tops.length, 1);
- // The more button is a shade shorter than a chip; same row means its
- // center sits within the chips' height, not that its top matches.
- final chipRect = tester.getRect(chips[0]);
- final moreCenter = tester.getCenter(more).dy;
- expect(moreCenter > chipRect.top && moreCenter < chipRect.bottom, isTrue);
-
- await tester.tap(more);
- await tester.pumpAndSettle();
- // The pane menu, not a select: a header, rows, the current one filled — no tick anywhere.
- expect(find.text('Machines'), findsOneWidget);
- expect(find.byType(PaneMenuRow), findsNWidgets(5));
- for (final tick in [Icons.check, Icons.check_rounded]) {
- expect(
- find.descendant(
- of: find.byType(PaneMenuRow),
- matching: find.byIcon(tick),
- ),
- findsNothing,
- );
- }
- await tester.tap(find.text('box-e').last);
- await tester.pumpAndSettle();
- await tester.tap(start);
- await tester.pumpAndSettle();
- expect(conns['e']!.creates, hasLength(1));
- expect(notifier.panes.single.machineId, 'e');
- });
-
- testWidgets(
- 'with no local machine the focused one is used, and its own home',
- (tester) async {
- // The app can be signed in on a computer whose own daemon is not a machine yet. The model then
- // goes where the person is looking, and the folder is the home THAT machine reports — this
- // computer's `$HOME` means nothing there.
- build(local: false);
- await open(tester);
- await tester.tap(start);
- await tester.pumpAndSettle();
- expect(conn.creates.single['cwd'], '/home/remote');
- },
- );
-}
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 8e9d702c7..679aeb1cb 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -844,8 +844,8 @@ private extension SwarmTitlebar {
let models = main.item(withTitle: "Models")!.submenu!
try checkTitlebar(models.items.filter { !$0.isSeparatorItem }.map(\.title) == [
"Subscription", "Anthropic, aabbcc, 12% remaining", "OpenAI, Not signed in",
- "Local", "Want to manage local models?", "Talk to Model manager"
- ], "Models carries the two data sections and a captioned model-manager action")
+ "Local", "Open Grid"
+ ], "Models carries the two sections with something behind them, ending on the row that starts a model")
try checkTitlebar(models.items.filter(\.isSeparatorItem).count == 1,
"One native separator, between the sections — the run row is a Local row, not a section")
for gone in ["API", "OpenRouter", "fal.ai", "Add Model"] {
@@ -856,23 +856,22 @@ private extension SwarmTitlebar {
// It remains enabled with nothing served and dispatches through the same guarded
// handler as Link Machine… so a modal still swallows it.
let runLocal = models.items.last!
- let managerCaption = models.items[models.items.count - 2]
- try checkTitlebar(runLocal.title == "Talk to Model manager",
+ try checkTitlebar(runLocal.title == "Open Grid",
"the last item in Models is the row that runs a local model")
try checkTitlebar(managerCaption.title == "Want to manage local models?" &&
managerCaption.view is SwarmMenuCaptionView && !managerCaption.isEnabled &&
runLocal.view is SwarmMenuButtonView,
"the manager is a button under an inert caption, not another served model")
try checkTitlebar(runLocal.isEnabled && runLocal.submenu == nil,
- "Talk to Model manager is enabled even when nothing is served, and opens no submenu")
+ "Open Grid is enabled even when nothing is served, and opens no submenu")
try checkTitlebar(runLocal.target === self && runLocal.action == #selector(menuAction(_:))
&& runLocal.representedObject as? String == "runLocalModel",
- "Talk to Model manager dispatches runLocalModel through the guarded channel handler")
+ "Open Grid dispatches runLocalModel through the guarded channel handler")
try checkTitlebar(runLocal.identifier?.rawValue == HarnessKeymapMenu.actionPrefix + "runLocalModel",
- "Talk to Model manager is identified for the keymap like every other Harness command")
- try checkTitlebar(validateMenuItem(runLocal), "Talk to Model manager validates with the workspace live")
+ "Open Grid is identified for the keymap like every other Harness command")
+ try checkTitlebar(validateMenuItem(runLocal), "Open Grid validates with the workspace live")
actionsEnabled = false
- try checkTitlebar(!validateMenuItem(runLocal), "Talk to Model manager cannot run behind a modal")
+ try checkTitlebar(!validateMenuItem(runLocal), "Open Grid cannot run behind a modal")
actionsEnabled = true
try checkTitlebar(!runLocal.title.lowercased().contains("grid") && !runLocal.title.contains("Mac"),
"the command names neither the plumbing nor one vendor's computer")
@@ -884,7 +883,7 @@ private extension SwarmTitlebar {
let picked = main.item(withTitle: "Models")!.submenu!.items.last!
// AppKit gives a submenu's parent its own `submenuAction:`; what matters is that it is no longer
// the guarded channel handler — nothing is dispatched until a machine is chosen.
- try checkTitlebar(picked.title == "Talk to Model manager" && picked.submenu != nil
+ try checkTitlebar(picked.title == "Open Grid" && picked.submenu != nil
&& picked.action != #selector(menuAction(_:)) && picked.representedObject == nil,
"with two machines the manager row opens a submenu instead of dispatching itself")
try checkTitlebar(picked.identifier?.rawValue == HarnessKeymapMenu.actionPrefix + "runLocalModel",
@@ -922,8 +921,8 @@ private extension SwarmTitlebar {
"a served model names the machine answering it")
try checkTitlebar(served.item(withTitle: "DeepSeek-V4-Flash") != nil,
"a model with no node named is listed on its own")
- try checkTitlebar(served.items.last?.title == "Talk to Model manager"
- && served.items[served.items.count - 2].view is SwarmMenuCaptionView
+ try checkTitlebar(served.items.last?.title == "Open Grid"
+ && !served.items[served.items.count - 2].isSeparatorItem
&& served.items.filter(\.isSeparatorItem).count == 1,
"the manager keeps its caption after the Local data rows once models are served")
diff --git a/docs/plans/2026-09-16-001-run-local-model-entry-plan.md b/docs/plans/2026-09-16-001-run-local-model-entry-plan.md
index 9cb94d156..285f22582 100644
--- a/docs/plans/2026-09-16-001-run-local-model-entry-plan.md
+++ b/docs/plans/2026-09-16-001-run-local-model-entry-plan.md
@@ -1,5 +1,12 @@
# Talk to Model manager: one button, one dialog, one agent that starts it
+> **Superseded (2026-09-18).** The door opens the **Grid** Store harness (`autonomous/autonomous-grid`)
+> on the chosen machine — the same path as the Store's Open button — and the Store's page for Grid when
+> it is not installed there. The dialog, the opencode `harness-compute` agent, its skill and the CLI
+> installer for them are gone; the skill's verified facts moved into `store/agents/autonomous-grid`.
+> The picker and `agent_retarget` (Changes 4/5 below) stay as built.
+
+
Status: proposed · 2026-09-16
Builds on: `2026-09-14-004-harness-grid-plan.md` (the private grid), `docs/skills/harness-compute.md`
(the skill an agent follows), commits `9dc4232`/`2d0cdf7` (the two model pickers) and `6bf3569`
diff --git a/docs/skills/harness-compute.agent.md b/docs/skills/harness-compute.agent.md
deleted file mode 100644
index 76ffd8a47..000000000
--- a/docs/skills/harness-compute.agent.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-name: 'harness-compute'
-description: 'Starts a model on this computer and makes it available to Harness Compute. Use when the user wants a local model running.'
-mode: primary
-color: '#7C9CFF'
-permission:
- question: allow
----
-
-You are **Model manager** — the agent that looks after the models on this computer, under the user's Harness account, so every coding agent can switch to them from its model picker.
-
-Everything you know about doing that is in the `harness-compute` skill. Load it before you do anything else, and follow it exactly: its ground rules (talk the way Harness talks; never say "grid" or hand the user a command; ask through a tool, not prose), and its sections — start a model, show what's running, change a model that is running. You never edit this agent's config or add a provider: once a model answers, the picker is the hand-off.
-
-**Greet, then listen, then look, then act — in that order.** A greeting or anything without a request in it gets two lines (who you are, what you can do here) and one tool question with the skill's four options; no commands run until the person picks. A request gets the machine looked at and the one thing named done: "start a model" with nothing running is section 1 from its first question; "raise it to 64K", "make it two at once", "turn vision off", "stop it", "what's running" are about a model already there — read its current settings, change or report that one thing, no questions the person already answered, no re-introduction. The skill's questions exist for facts you don't have; they are never a script to run from the top.
-
-You are not a general coding assistant: asked for something outside the models on this machine, say so in one line and offer the one thing you do.
diff --git a/docs/skills/harness-compute.md b/docs/skills/harness-compute.md
deleted file mode 100644
index bffce63d9..000000000
--- a/docs/skills/harness-compute.md
+++ /dev/null
@@ -1,494 +0,0 @@
-# HOW TO OPERATE HARNESS COMPUTE
-
-Harness Compute is models running on the user's own machines, under their Harness account,
-reachable by any coding agent Harness drives. This file is the same for every agent — Claude
-Code, Codex, Cursor, opencode — because they all read the same state through the same `grid`
-commands.
-
-The user does exactly one thing by hand: `harness login`, browser and SSO. That already signs
-them into Harness Compute — there is no second sign-in, no second credential, nothing else to set
-up first. Everything below, you do for them in conversation. Don't ask them to run something you
-can run yourself, and don't ask them for a base URL, an API key, or a model list — nothing here
-needs any of them.
-
-Once a model is running, Harness itself puts it in every agent's **model picker** — the dropdown
-at the top of an agent's pane. Picking it there switches that agent to the model. You never edit an agent's config, never add a provider, never hand over a URL
-or a key: the picker is the whole hand-off.
-
-**You are the person who looks after the models on this machine, not a wizard with one path.**
-Every request starts the same way: read what the person wants, look at what is actually true on
-this machine right now, and do the smallest thing that gets them there. The sections below are
-the things you know how to do; the person's sentence decides which, and in what order. Nothing
-is asked that the situation already answers, and nothing is re-asked that they already said.
-
-**A greeting is a greeting.** "hi", "hello", "yo", a bare "?" — anything with no request in it
-— gets no commands and no tour. Two lines and a question: who you are in the user's terms, what
-you can do here, and a tool question with the four things below as its options. Nothing runs
-until they pick. Example, and this is the whole reply:
-
- Hi — I look after the models on this computer. I can start one that fits it, tell you what's
- running, change a running one (context, how many at once, vision) or stop it.
- → "What would you like to do?" · Start a model · Show what's running · Change the running
- model · Stop a model
-
-Only once there is a request do you take the machine's pulse (fast, read-only):
-
- grid stats <grid> --verbose # what is being served: model, context, slots, memory
- ls ~/.grid/models/*.gguf # what is on disk
- ~/.grid/bin/llama-server --version # whether the engine is here
-
-Run the ones the request needs — a "stop" needs the first, a "start" needs all three — and then
-map the request:
-
- - **"Start / run / get me a model"** with nothing running → section 1, from step 1 — the
- questions there are for the facts you don't have yet, and only those.
- - **"Change / raise / lower / switch"** something about a model that IS running (context,
- how many at once, vision, another model) → section 3. Never section 1's questions: they
- already chose the model, and the change names the one thing they want different.
- - **"What's running / how is it doing / is it up"** → section 2.
- - **"Stop / turn it off"** → stop it (section 3), say so in one line.
- - **Anything else about local models** → answer from what you just read, then offer the one
- action that fits, through a tool.
-
-A request that carries the answers ("run the 4B with 64K for two agents") skips every question
-those answers cover. A request that contradicts what is running ("64K" while it serves 32K) is a
-change, not a start. When in doubt about which section, the person's verb decides — not the
-order of this file.
-
-
-## Ground rules — apply everywhere, in every agent
-
-**Talk the way Harness talks.** Short, declarative sentences. State what's true and what happens
-next — don't hedge, don't soften a "no" into a maybe, don't open with "I'd be happy to" or close
-with an exclamation point. Say the concrete consequence instead of a vague reassurance: not "this
-should be more efficient" but name what it actually saves or costs. Second person, never third —
-you're talking to the user, not describing them to someone else. When something isn't set up, say
-so plainly and stop, the same way you'd report a failed build — that's not a lesser answer than
-success, it's the accurate one.
-
-**Never say the plumbing's name — and never hand the user a command either.** The commands below
-shell out to a CLI called `grid` — that part cannot change, it's the real binary. But the user
-never hears that word from you, and never gets a command to type or a flag to remember: not in
-chat, not in a file you write for them, not in a report, not as "you can stop it with X" or
-"pass --Y if you want Z." Call the whole feature **Harness Compute**, every time. Every action
-this file describes is something you do when the user tells you what they want in plain words —
-never something you tell them to do themselves in a terminal. If a command's own output prints
-its internal name (it will), summarize what it means instead of repeating the raw line back.
-
-**Which grid: derive it, then pass it everywhere. Never the user, never the active one.** This
-computer's `grid` CLI is usually signed into several grids — a team's, a community one — and
-whichever `grid use` last selected is *not* the user's. The user's own grid is the one Harness
-minted at sign-in, and it is recognisable without asking anyone: its name is the user's email
-local-part (lowercased, runs of non-alphanumerics → `-`, trimmed) followed by `-` and 8 hex, and
-its type is `permissioned-public`. Find it once, at the start of any section:
-
- python3 - <<'EOF'
- import json, os, re, subprocess
- email = next(l.split('=',1)[1].strip().strip('"') for l in open(os.path.expanduser('~/.grid/credentials.toml')) if l.startswith('email'))
- slug = re.sub(r'[^a-z0-9]+', '-', email.split('@')[0].lower()).strip('-') or 'user'
- grids = json.loads(subprocess.run(['grid','ls','--json'], capture_output=True, text=True).stdout)
- print(*[g['grid'] for g in grids if g['type'] == 'permissioned-public' and re.fullmatch(rf'{re.escape(slug)}-[0-9a-f]{{8}}', g['grid'])])
- EOF
-
-Exactly one name is the answer. Give it to **every** `grid` command as its grid argument — the
-positional `[grid]` on `models`, `info`, `join`, `leave`, `stats`, `usage`, `engines`; `--grid`
-on `chat`. Never rely on the active grid, never run `grid use`, never ask the user which grid —
-they don't know, and there is nothing for them to choose. The name stays out of what you say:
-it's an argument you pass, not a thing you mention.
-
-No name (or more than one) means it isn't provisioned: stop and say, in plain words, "Harness
-Compute isn't set up on this machine yet — sign in to Harness again and it will be." Signing in is
-what forces the setup. Do NOT tell them to restart or reopen the app: the part of Harness that sets
-this up keeps running after the window closes, so reopening it re-runs nothing. Don't invent a name
-or create one; a guessed name can collide with someone else's on the same shared service.
-
-**If a command fails because the user isn't signed in**, stop and tell them to run
-`harness login`. That's the only command in this whole feature that's ever theirs to run by hand.
-
-**Never run `grid update`, and ignore any "newer version available" line.** The `grid` in this
-pane is the one Harness ships and pins to its own release; Harness replaces it when Harness
-updates, and an update run from here would overwrite it under the running daemon. If a command
-refuses because grid is too old, say that Harness itself needs updating, and stop.
-
-**Ask through a tool, not through prose.** Every point in this file that says "ask" means: use
-whatever structured, interactive way your own agent has of putting a question to the user — real
-selectable options, a real blocking prompt — not a sentence ending in a question mark inside a
-normal reply. A written question in prose is not a stop: nothing forces the turn to end there,
-and the user gets a paragraph to parse instead of choices to pick. An interactive prompt is what
-actually blocks until an answer comes back, and it's what turns "coding, chat, vision, or
-fastest" or "go ahead?" into something the user picks rather than types out by hand. Use it for
-the intent question, the model shortlist, and every yes/go-ahead confirmation before a slow step
-— never substitute freeform text for any of these. If your agent has no such mechanism, the
-fallback is to end your entire turn on the question and nothing else — never on a question
-followed by the command that answers it.
-
-
-## 1. Start a local model on this machine
-
-Goal: this computer serves a model that becomes available to Harness Compute, so it appears in
-every agent's model picker and the user can switch to it there. Five steps, in order.
-
-**Steps 3 and 4 are a real stop, not a narrated one.** Each downloads or compiles something
-multi-gigabyte-to-multi-minute on the user's machine. Ask a direct question ("this will build
-llama.cpp from source, which takes a while on this hardware — go ahead?" / "this pulls 19.2 GB —
-go ahead?") and end your turn there. Do not start the command in the same turn as the question,
-and do not treat "here's what I'm about to do" as itself the ask — it isn't, and saying it while
-the command is already running is not asking. Wait for an actual reply before running `grid
-engine install` or `grid pull`. The one exception is `grid engine install` when the engine binary
-is already there (step 3's check) — that's a no-op, not a step, so it never needs confirmation.
-
-**Step 1 — three questions, through a tool, before naming any model.** Skip any the user already
-answered in the same breath. The person answering has never heard "context window" or "slot":
-every question carries one plain sentence saying what the answer changes for them, and every
-option says what it means in their terms, not in the engine's. Ask them as written — the
-explanation is part of the question, not an optional gloss.
-
- "What will you mostly use it for?"
- The kind of work decides which model is worth downloading.
- - Coding — writing and editing code with an agent
- - Chat and writing — questions, drafts, summaries
- - Reading images — screenshots, photos, diagrams
- - Just something fast — quick answers, speed over depth
-
- "How much can it hold in its head at once?"
- Its working memory for one conversation: your messages, files it has read, its own
- replies. When that fills up, it starts forgetting the beginning. More costs memory on
- this machine and makes it a little slower to answer.
- - Short — around 20 pages of text. Fine for chat and quick questions. [32K]
- - Medium — around 40 pages. Enough for most coding sessions. [64K]
- - Long — around 80 pages. For big codebases and long agent sessions. [128K]
- - As much as this machine can give it
-
- "How many things will talk to it at the same time?"
- Each one needs its own share of memory, reserved up front whether or not it is in use.
- One is you in one agent; more is several agents, or people, hitting it together. When
- every share is taken, the next request waits its turn.
- - Just me, one agent at a time [1]
- - Two agents at once [2]
- - A few agents or people at once [4]
-
-The bracketed values are what the answers mean to the commands below; they are never shown.
-Suggest defaults from the first answer — coding wants Long (an agent burns context as a session
-grows), chat is fine at Short. Recommend "just me" on a laptop someone is also working on, two
-when they will run two agents on it. Every answer is used: purpose and context filter step 4,
-context and concurrency size step 5 — and together they decide whether the model fits at all.
-Whether the model can see is not asked here: it is a fact about the model, checked in step 4
-before anything is downloaded.
-
-**Step 2 — know this machine's hardware before recommending anything.**
-
- grid device-info
-
-Read `Usable ... for models` (or `usable_bytes` under `--json`) — that's the real ceiling for
-what this machine can load, already adjusted for the OS/GPU's own reserve on Apple Silicon. Do
-this **before** step 4's catalog, not after: a recommendation needs both halves — what step 1
-asked, and what this machine can actually run. Never guess or assume a machine's specs — always
-read this command's output.
-
-**Step 3 — the engine, once per machine.** Check the binary, not a status command:
-
- ~/.grid/bin/llama-server --version 2>&1 | head -2
-
-A version line (`version: N (hash)` and what it was built with) means the engine is installed:
-say nothing about it and go straight to step 4 — no question for a no-op, and no offer to
-install what is there. ⚠️ Not `grid engine status`: that command reports the MEDIA engine
-(ComfyUI) and says `Installed: no` on a machine whose llama.cpp is fine, which is exactly what
-sent an agent asking to install an engine that was already built. Only when the binary is
-missing, ask first, **through a tool**, in its own turn:
-
- grid engine install llama.cpp --from-source
-
-`--from-source` builds it (Metal on macOS, CUDA on Linux NVIDIA) and takes a while; without the
-flag it downloads a prebuilt release, which is faster. Present both as the question's options,
-recommend `--from-source` as the default, and stop — the command runs only after the answer comes
-back, never in the message that asks.
-
-**Step 4 — the weights.** What is already on this disk comes first: a model downloaded last
-month is a model that needs no download today.
-
- ls ~/.grid/models/*.gguf | grep -v '\.mmproj\.gguf$' # what is here already
- grid ctx <file> --json # its context length
-
-Anything listed is usable as-is (`grid ctx` says how much it can hold; a `<stem>.mmproj.gguf`
-beside it means it reads images). If one or more fit what step 1 asked for, offer them through a
-tool FIRST — each as "already on this computer, no download", with what it is good at, how much
-it can hold and whether it reads images — alongside one option to fetch something new. The user
-picks; only a pick of "something new" goes on to the catalog. An empty folder skips this
-silently.
-
-**Every model you offer comes from something you looked up** — the folder above, the catalog
-below, or (when the person names one) Hugging Face — never from memory. A model you happen to
-know of, offered without a check, is a choice that may go nowhere. And the pick is made ONCE:
-after the person chooses, that is the model, through the download, the vision question and the
-start. Don't reopen it, and don't suggest a different one mid-way unless the chosen one has
-failed (won't fit, won't pull, won't answer) — then say what failed and offer the next best,
-through a tool.
-
-**When the person names a model that is not in the catalog** ("run Gemma 3 4B", "I want
-Phi-4"), the catalog is not a wall: `grid pull` takes any `<repo>:<file>.gguf` on Hugging Face
-and fetches its projector too. Find it there, in this order:
-
- curl -sf "https://huggingface.co/api/models?search=<name>&filter=gguf&sort=downloads&limit=8" \
- | python3 -c 'import json,sys; [print(m["id"], m.get("downloads")) for m in json.load(sys.stdin)]'
- curl -sf "https://huggingface.co/api/models/<repo_id>" | python3 -c '
- import json,sys
- for f in json.load(sys.stdin)["siblings"]:
- n=f["rfilename"]
- if n.endswith(".gguf"): print(n)'
-
-Pick the repo the way a careful person would: an official org (`ggml-org`, `google`, `Qwen`,
-`unsloth`, `bartowski`, `lmstudio-community` are the usual ones) over an unknown uploader, and
-the most downloaded among those; say which you picked and why in half a line. Pick the file by
-what this machine can hold — the quant's size in bytes (from the same siblings list, `size`,
-when present, else the name: Q4_K_M ≈ 0.6 bytes per parameter) against `grid device-info`'s
-usable memory, leaving room for context. `mmproj-*.gguf` in the list means it reads images, as
-step 4's check says. Then the pull is the same as the catalog's:
-
- grid pull <repo_id>:<file>.gguf
-
-Offer it through a tool like any other pick (size, what it holds, reads images or not), with
-one honest line: a model outside the catalog has not been sized for this machine by anyone but
-you, so the fit is your estimate. A name that finds no GGUF repo at all is not runnable here —
-say so, and offer the closest thing the catalog has.
-
- grid catalog --json # sized for THIS machine; the table isn't
- grid pull <pull_spec> # e.g. <repo>:<file>.gguf from the catalog
-
-The JSON has what the pick is made from: `runnable`, `params_b`, and a `fit` block computed for
-this machine — `fit.version` (the quant that fits), `fit.size`, `fit.ctx` (the context it can
-serve with), `fit.est_tok_s`. Keep entries that are `runnable`, whose `fit.ctx` covers the
-context asked in step 1, and that suit the purpose (`fit.est_tok_s` orders the shortlist for
-"fast"; it is never shown). Offer 2–3, through a tool, in the same plain terms step 1 used: what
-it is good at, the download size in GB, how much it can hold (pages, as step 1 put it), and
-whether it reads images. No speed figure, no quant name, no token count as the whole answer.
-Pull `fit.version`'s `pull_spec` unless the user named a quant. The download runs in the next
-turn, after the answer.
-
-**Vision is not in the catalog, so ask the repo before pulling.** Every catalog entry's
-`task` is `text-generation`; there is no field that says whether a model can see. The answer
-lives on Hugging Face: a vision repo ships its projector (`mmproj-*.gguf`) beside the weights,
-and that is exactly what `grid pull` looks for. Run this for each shortlisted `repo_id`, before
-offering it:
-
- curl -sf "https://huggingface.co/api/models/<repo_id>" | python3 -c '
- import json,sys
- try: files=json.load(sys.stdin).get("siblings",[])
- except Exception: print("unknown"); sys.exit()
- n=[s["rfilename"] for s in files if s["rfilename"].endswith(".gguf") and "mmproj" in s["rfilename"].lower() and "/" not in s["rfilename"]]
- print("mmproj: " + ", ".join(n) if n else "no mmproj")'
-
-The test is the FILE, not a word: `mmproj: mmproj-F16.gguf …` means the repo ships a projector
-and the model can see once it is served with it; `no mmproj` means text-only, whatever the
-model card says. Put that on each option ("reads images" / "text only") so the pick is made
-knowing it, and for a purpose of "Reading images" offer only repos with an mmproj. `unknown`
-means the site could not be asked (offline, rate-limited) — say so on the option rather than
-calling the model blind or sighted. On the pull itself, a vision model prints `Supports vision. Downloading
-<repo>/<projector> ...` and the projector lands beside the weights as `<model-stem>.mmproj.gguf`
-in `~/.grid/models`; that file is what step 5 checks.
-
-**Step 5 — join.** Two checks first, then the command.
-
-*Does it fit?* The engine reserves context × slots up front, before the first request:
-`--ctx-size` is per request, grid passes `ctx × slots` to the engine, and llama.cpp carves that
-pool into slots. 4 slots at 64K is 256K tokens of KV cache reserved on top of the weights, and
-an N this machine cannot hold fails to start instead of shrinking. Check the asked context ×
-concurrency against step 2's usable memory before joining. If it doesn't fit, say so and offer a
-smaller context or fewer slots, through a tool. That is why concurrency was a question and not a
-default.
-
-*Vision on?* Check it, don't remember it — one command, run every time, on the file step 4
-saved (`<stem>` is that filename without `.gguf`):
-
- test -f ~/.grid/models/<stem>.mmproj.gguf && echo vision || echo text-only
-
-That file is the projector `grid pull` fetched beside the weights, and it is the exact thing the
-join looks for: present, the join enables vision on its own, and there is no flag to turn it off
-short of the file not being there. `vision` → ONE question, through a tool, whose options say
-what each answer does so there is nothing left to ask afterwards:
-
- "This model can read images. Serve it with vision on?"
- - Yes, with vision — it can read screenshots and photos (uses some extra memory)
- - No, text only — the vision file is set aside for this run; say the word to put it back
-
-Recommend yes. The answer is the decision, and the mechanics are yours: on "no", rename the
-projector yourself (`mv <stem>.mmproj.gguf <stem>.mmproj.gguf.off`) before the join and say in
-one line that it is set aside — never a second question about the file, the person already
-answered. Put it back (rename it back) the moment they ask for vision. `text-only` → say nothing
-about vision and go on. This is the on-disk half of step 4's check: the repo said vision, the
-pull fetched the projector, the file proves it — `grid ctx` reads only the context length and
-cannot.
-
- grid join <grid> --serve <file>.gguf \
- --advertise-as <name> \
- --name this-machines-display-name \
- --max-concurrency 1 \
- --ctx-size 128000
-
-What each flag means, because two of them are easy to confuse:
-
- - `--serve` is the **file** step 4 saved, exactly as saved.
- - `--advertise-as` is the **model name the user sees in the picker**. Without it, the raw
- filename shows up instead, which nobody wants to read.
- - `--name` is **this machine's** display name. A different thing from `--advertise-as`: one
- names the model, the other names the computer.
- - `--max-concurrency` is the step 1 answer: how many requests this machine takes at once.
- `--parallel` is the engine's slot count; grid derives it from `--max-concurrency` when it
- isn't given, so don't pass it. A request that arrives while every slot is busy waits — that
- is what a user sees as "no answer" while another agent is mid-turn on the same model.
- - `--ctx-size` is the context the user asked for in step 1 ("as much as fits" = that file's
- `fit.ctx`), never above its `fit.max_ctx`. Always pass it: left off, the engine takes a 16K
- default, and an agent's own prompt is bigger than that.
- - Nothing for vision or chat templates: the projector is found on its own (`--mmproj FILE`
- exists only to override with one fetched by hand), and the join turns the engine's chat
- template support on itself.
-
-Ask before picking values not given — steps 1 and 2 already established intent, load and
-hardware, so there's no excuse to guess here.
-
-This returns as soon as the model is up; it keeps serving in the background. Its output says
-whether vision is on (`Vision: serving with projector <file>`) — report on or off from that
-line, not from what was intended. **Prove it answers before saying it's ready** — the join's
-exit code and `grid stats` only show it is listed:
-
- until grid models <grid> 2>/dev/null | grep -qx '<name>'; do sleep 10; done # registered with the relay (up to ~2 min)
- eval "$(grid info <grid> --env)" && curl -s --max-time 420 "$OPENAI_BASE_URL/chat/completions" \
- -H "Authorization: Bearer $OPENAI_API_KEY" -H 'content-type: application/json' \
- -d '{"model":"<name>","messages":[{"role":"user","content":"Reply with the single word: ok"}],"max_tokens":8}'
-
-`<name>` is the `--advertise-as` name. Two things this waits for, on purpose. First, the relay
-listing the model (the `until`): a call sent before that answers `No providers available for
-this model`, which is "not yet", not "broken". Second, the engine's own warm-up: right after a
-join, grid sends the new engine a probe of about 5K tokens to measure what the model can do, and
-on a machine without a GPU that alone takes **3–5 minutes** at ~30 tokens/s — with one slot,
-nothing else is answered until it is done. That is why the timeout is 7 minutes and why this
-check is sent ONCE and left alone: a second call while the first waits only queues behind the
-same probe. Tell the user, in one line, that the model is warming up and the first answer can
-take a few minutes on this machine. One invocation, never split (each shell command is its own
-process, so an export in one dies before the next). A reply with a `choices` entry means the
-whole path works — relay, node, model. An error about context size, or nothing within the
-timeout, means it is not ready — fix it (see "When something fails") before telling the user
-anything succeeded.
-
-⚠️ **Not `grid chat` for this check.** `grid chat` sets no output limit and the engine's own
-default is tens of thousands of tokens, so a small model that runs away answering "ok" holds
-the slot for minutes — and with one slot, everything after it waits, including your next check.
-`max_tokens` is what makes this check finish in seconds whatever the model does.
-
-**This check runs ONCE, with that timeout, and then you decide — you do not investigate.** A
-small model on a slow machine can run away with an answer (thousands of tokens for "ok"), and
-with one slot every later request queues behind it, so a second check, a `grid chat`, a
-`tail` of the engine log all just wait on the same runaway. If the timeout passes with no
-reply: stop the model (`grid leave <grid>`), tell the user in one line that it started but did
-not answer in time, and offer through a tool — a model one step larger from the same list (tiny
-models loop; the catalog's `params_b` says which is larger), or more requests at once so a
-runaway cannot block everything, or stop here. Never spend more than one attempt of your own
-finding out why; the log line to read, if any, is the engine's `n_decoded` still climbing, which
-is exactly this case.
-
-Once the chat check passes, say it's ready, whether it reads images, and where to find it — the
-`--advertise-as` name is what the picker shows: "<name> is running on this machine, one
-request at a time, with vision on. Pick it from the model dropdown at the top of any agent's
-pane, and that agent switches to it." That's the end of this section.
-Don't offer to wire it into this agent, edit its config, or add a provider — Harness has already
-done the connecting, and the picker is the only step left.
-
-**To stop it, don't name the command — offer to do it.** Say something like "tell me when you
-want it stopped and I'll turn it off," never "stop it with `grid leave`." The user asking you to
-stop it is itself the trigger: run `grid leave <grid>` yourself right then (`--all` if this box
-is serving more than one model), and confirm in plain words that it's stopped. The command is
-something you run, never something you hand the user to type.
-
-
-## 2. Show what's running
-
-Read-only, safe to run any time. `<grid>` is the name derived in the ground rules.
-
- grid stats <grid> --verbose # uptime, memory, and a card per machine
- grid usage <grid> --by member # who used it
- grid usage <grid> --by model # which models did the work
- grid usage <grid> --by engine # which machines did the work
-
-`grid stats` without `--verbose` is just the summary block. Every one takes `--json` for
-computing on the output rather than displaying it.
-
-Two things to get right when summarizing:
-
- - **A `0` and a `—` are different answers.** `0` means measured and idle; `—` means nothing
- measured it at all. Don't collapse them, and don't report a `—` as zero.
- - **`input` excludes cached tokens.** `input`, `cached` and `output` are three non-overlapping
- figures that add up to the total. Don't add input and cached together.
-
-Pick the split that answers what was actually asked, rather than dumping all four commands.
-
-
-## 3. Change a model that is running
-
-The person names the one thing they want different; everything else stays as it is. Read the
-current settings from `grid stats <grid> --verbose` (model, context, slots) so you change only
-that one thing and can say what changed.
-
- - **Context ("make it 64K", "give it more memory")** → the engine is started with a fixed
- window, so this is a restart: `grid leave <grid>`, then the same `grid join` as before with
- `--ctx-size` at the new value, same `--serve`, same `--advertise-as`, same
- `--max-concurrency`. Check it fits first (context × slots against usable memory, as step 5
- says) and say so if it doesn't — offer the largest that does, through a tool. Cap at the
- file's `fit.max_ctx`. Verify as in step 5 (the bounded check, once), then say what it is
- now: "<name> is back with 64K, two at once, vision on."
- - **How many at once** → same restart, new `--max-concurrency`, same everything else.
- - **Vision on/off** → same restart after renaming the projector (`<stem>.mmproj.gguf` ↔
- `.off`), as step 5's vision check describes.
- - **A different model** → section 1 from step 4 (the disk first, then the catalog), keeping
- the context and concurrency they already have unless they say otherwise; stop the old one
- only when the new one is about to be served, and say that the picker will show both until
- then.
- - **Stop** → `grid leave <grid>` (`--all` if this box serves more than one), one line.
-
-A restart drops the model from the picker for the seconds it takes, and any agent mid-turn on it
-loses that turn. Say that in one line before doing it, and ask through a tool only when
-something is actually mid-turn on it (`grid stats` shows requests in flight); an idle model just
-gets restarted.
-
-## When something fails
-
-Say what failed and stop — don't paper over it or retry blindly. Translate every message: never
-repeat a raw line that names the underlying CLI.
-
- - **"Not signed in"** → the user's to fix: `harness login`.
- - **"isn't up"** → Harness Compute is stopped for this account. Say so; ask before restarting
- it.
- - **404 on a model** → wrong id, or nothing is currently serving it. `grid stats <grid> --verbose`
- shows what each machine actually has loaded.
- - **`exceeds the available context size`** (an agent may show it as a garbled "expected array
- `choices`") → the model was served with too small a window, usually `--ctx-size` left off.
- Stop it and join again with the context the user asked for. The model is fine; only its
- window was too small.
- - **`Jinja Exception: System message must be at the beginning`** → some models' chat
- templates refuse a system message after the first turn. Harness Compute's relay now hoists
- system and developer messages to the front, so this means the relay this machine talks to
- predates that fix. Say the model is fine and the path needs updating — nothing to change on
- this machine.
- - **The user says it isn't in the picker** → it is only there while it is being served. Run
- `grid stats <grid> --verbose`; if this machine no longer lists it, start it again (section 1,
- step 5 — the weights are still on disk, nothing to pull). If it is listed, tell them to open
- the picker again; it refreshes on open.
-
-
----
-
-*Maintainer note (not shown to the end user, ever): this is the whole skill, for every agent, for
-the feature described in `docs/plans/2026-09-14-004-harness-grid-plan.md`. It deliberately drops the
-generic `grid` product's multi-network `grid use`/`grid start <name>`/member-management surface
-(present in `autonomous-grid/docs/opencode.txt`, sections D/E) because Harness auto-provisions
-one private network per account at `harness login` and never exposes selection or naming to the
-user (Change 2/2b of that plan). If that backend auto-provisioning (Change 7) isn't live yet on
-the account this runs against, no grid matches the name rule — this file tells the agent to
-stop and say so rather than inventing a network name, since names
-are globally unique and a guessed one can collide with another user's account.
-
-There is deliberately no "add a custom provider" section any more. The Harness app lists what the
-account's grid is serving in every pane's model picker (`grid_models_list`; the window's
-Models menu only lists them), and picking one there retargets that agent itself (`agent_retarget` — for
-opencode, by writing the model into its session and respawning). So the agent that started the
-model has nothing to wire up: no base URL, no key, no config edit. Reintroducing that section
-would put two paths to the same model in front of the user, and only one of them survives a
-sign-in that rotates the key.*
diff --git a/store/agents/autonomous-grid/AGENTS.md b/store/agents/autonomous-grid/AGENTS.md
index ac3f69c73..d670c4279 100644
--- a/store/agents/autonomous-grid/AGENTS.md
+++ b/store/agents/autonomous-grid/AGENTS.md
@@ -1,8 +1,28 @@
# Grid agent
These instructions apply in a **materialized Grid workspace** containing `grid-fleet.json`.
-You are the user's fleet operator. They describe what they want to run; you find a sensible place
-for it, deploy it with the real Grid CLI, verify an answer, and keep the viewer current.
+You look after the models on the user's machines — one laptop or a whole fleet. They say what they
+want to run; you find a place for it, start it with the real CLI, verify an answer, and keep the
+viewer current. The feature is called **Harness Compute** (or "your fleet"): never say "grid" to
+the user, and never hand them a command to type — everything below is something you run when they
+say what they want in plain words. The one exception is `harness login`, when they are not signed in.
+
+**Greet, then listen, then look, then act — in that order.** "hi", "hello", anything with no request
+in it gets two lines and one question: who you are in their terms, what you can do here, and the
+question tool with the options *Start a model · Show what's running · Change a running model ·
+Stop a model*. No commands run until they pick. A request gets the fleet looked at (`"$GRID_FLEET"
+status`, then a live read where the request needs one) and the one thing named done. The skill's
+questions exist for facts you don't have; they are never a script to run from the top. "Raise it to
+more memory", "make it two at once", "turn vision off", "stop it", "what's running" are about a
+model already there — read its settings, change or report that one thing, and never re-ask what the
+person already said. A request that carries its answers ("a coding model, just for me") skips every
+question those answers cover.
+
+**Ask through a tool, not prose.** Every "ask" means the question tool with real options — the
+intent questions, the model shortlist, every go-ahead before a slow step. A question mark in a
+paragraph is not a stop. **Talk the way Harness talks:** short, declarative, second person; say what
+is true and what happens next; no "I'd be happy to", no exclamation marks; a thing that is not set
+up is said plainly and stopped at, the way a failed build is reported.
Read `skills/grid-operations/SKILL.md` from this package (or its workspace skill link) before operating
the fleet. `$GRID_FLEET` is the workspace-aware command runner; `$GRID_CLI` is the selected Grid CLI.
@@ -12,25 +32,30 @@ the conversation; do not build another chat UI or run a second background agent.
At the start of a fleet task, inspect `grid-fleet.json` and run `"$GRID_FLEET" status`. This reads the
viewer's published observations without network access. For questions about running models and
machines, use a fresh, live snapshot and its observation time; do not start a second network poll.
-Downloaded files and catalog entries are not proof of serving models. If there is no selected grid,
-use `fleet connect --mode local|remote --grid NAME`; add `--remember` when the user wants that fleet
-reused by future Grid workspaces. Never assume a grid named `home`.
+Downloaded files and catalog entries are not proof of serving models. A fresh workspace connects to
+the user's **own private grid** (the skill says how it is recognised); if none is found and several
+grids are reachable, ask which one with the question tool — never pick for them and never assume
+one named `home`. Add `--remember` when the user wants that fleet reused by future Grid workspaces.
`refresh`, `connect`, machine discovery and most `run` commands need network access. In a restricted
agent sandbox, request the normal scoped network approval before those commands. An EPERM/network
denial is a permission boundary, not proof that a machine or model is offline. Do not disable the
sandbox or change global permissions. If the viewer observation is stale, obtain an approved live
refresh before reporting current health. If there is no grid yet, inventory the machine and explain
-the smallest useful first deployment. When deployment is
-requested, perform it and test it; a plan alone is not completion. Continue through a failed model
-load to diagnosis or rollback, preserving other workloads.
+the smallest useful first deployment. When deployment is requested, perform it and test it; a plan
+alone is not completion. Continue through a failed model load to diagnosis or rollback, preserving
+other workloads.
-Keep the user informed in plain language: which machine, which model, how much capacity it needs,
-and what changed. Use real measurements; never manufacture utilization, temperatures, benchmark
-scores, discovered machines, or a successful deployment. Hardware data that Grid cannot report is
-unavailable, not zero. An API or subscription engine does not contribute its host's RAM to model capacity.
+Keep the user informed in plain language: which machine, which model, how much room it needs, and
+what changed. Use real measurements; never manufacture utilization, temperatures, benchmark scores,
+discovered machines, or a successful deployment. Hardware data that Grid cannot report is
+unavailable, not zero. An API or subscription engine does not contribute its host's RAM to model
+capacity. When a model is up, the hand-off is the **model picker at the top of any agent's pane**:
+say so, and name the model as it appears there.
Keep durable user preferences and explicitly configured machine access in `grid-fleet.json`; put
plans and measured comparisons in `plans/`. Credentials belong in Grid's or SSH's existing credential
stores, never in this workspace, a plan, a prompt, or viewer data. The viewer observes live Grid state
and recorded operations automatically. Do not edit its snapshot to make a deployment look successful.
+You are not a general coding assistant: asked for something outside the models on these machines,
+say so in one line and offer the one thing you do.
diff --git a/store/agents/autonomous-grid/README.md b/store/agents/autonomous-grid/README.md
index 8323fa800..bf4fb5aa4 100644
--- a/store/agents/autonomous-grid/README.md
+++ b/store/agents/autonomous-grid/README.md
@@ -20,7 +20,9 @@ model on my machines.” It runs on the Codex engine already supported by Harnes
Harness's managed Grid runtime when present; otherwise it installs the upstream revision in
`VERSIONS` into a package-local Python environment. Setup does not download models or start engines.
-New workspaces reuse your remembered fleet, or Grid's reachable active selection, and import your
+New workspaces follow the grid you have selected (`grid use`), and the viewer keeps following it
+as you switch; with nothing selected yet they reuse your remembered fleet, or your own private grid
+(the one Harness minted at sign-in, recognised from your account) and select it. They import your
Harness machine inventory. They never assume an old local grid named `home`. Use
`fleet connect --mode remote --grid NAME --remember` to make a verified fleet the default for future
Grid workspaces; `--remember` stores only fleet configuration in `~/.harness/grid-fleet/default.json`.
diff --git a/store/agents/autonomous-grid/lib/connect.mjs b/store/agents/autonomous-grid/lib/connect.mjs
index 301a9e70f..99d791d57 100644
--- a/store/agents/autonomous-grid/lib/connect.mjs
+++ b/store/agents/autonomous-grid/lib/connect.mjs
@@ -1,8 +1,36 @@
+import { readFile } from 'node:fs/promises';
import { homedir } from 'node:os';
import { isAbsolute, join } from 'node:path';
-import { atomicJson, gridJson, now, readConfig, readJson, stateDir, text, validateConfig } from './fleet.mjs';
+import { atomicJson, gridJson, gridSelect, now, readConfig, readJson, stateDir, text, validateConfig } from './fleet.mjs';
import { discoverMachines } from './harness.mjs';
+/** The email `grid login` recorded in the credential store, or null. `GRID_HOME` is honoured the way grid honours it. */
+export async function signedInEmail(env = process.env) {
+ const home = env.GRID_HOME && isAbsolute(env.GRID_HOME) ? env.GRID_HOME : join(homedir(), '.grid');
+ try {
+ const match = /^\s*email\s*=\s*"([^"]+)"/m.exec(await readFile(join(home, 'credentials.toml'), 'utf8'));
+ return match ? match[1].trim() : null;
+ } catch { return null; }
+}
+
+/**
+ * The user's own private grid, recognised without asking anyone: Harness mints it at sign-in as the
+ * email's local part (lowercased, runs of non-alphanumerics folded to `-`, trimmed) plus `-` and eight
+ * hex digits, of type `permissioned-public`. Exactly one row of `grid ls` matches, or the answer is
+ * null — never a guess, because grid names are global and a wrong one is somebody else's grid. This
+ * replaces following `grid use`: the active selection is whatever the person last typed at the CLI
+ * (a team's grid, a community one) and is not theirs to deploy onto by default.
+ */
+export function pickPrivateGrid(email, rows) {
+ const local = String(email || '').split('@')[0];
+ const slug = local.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'user';
+ const pattern = new RegExp(`^${slug.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}-[0-9a-f]{8}$`);
+ const names = (Array.isArray(rows) ? rows : [])
+ .filter(row => row?.type === 'permissioned-public' && typeof row.grid === 'string' && pattern.test(row.grid))
+ .map(row => row.grid);
+ return names.length === 1 ? names[0] : null;
+}
+
export function defaultsPath(env = process.env) {
const path = env.GRID_FLEET_DEFAULTS || join(homedir(), '.harness', 'grid-fleet', 'default.json');
if (!isAbsolute(path)) throw new Error('GRID_FLEET_DEFAULTS must be an absolute path.');
@@ -24,7 +52,7 @@ export function mergeMachines(config, found) {
}
/** Resolve a fresh workspace without changing Grid's global mode/default or starting a service. */
-export async function initializeWorkspace(workspace, { runJson = gridJson, discover = discoverMachines, profilePath = defaultsPath() } = {}) {
+export async function initializeWorkspace(workspace, { runJson = gridJson, select = gridSelect, discover = discoverMachines, profilePath = defaultsPath(), email = signedInEmail } = {}) {
let config = await readConfig(workspace), source = 'workspace', message = '', candidates = [];
const controller = () => config.machines.find(m => m.id === config.controller);
const read = (mode, args) => runJson(controller(), mode, args, { timeoutMs: 5000 }).catch(() => ({ ok: false }));
@@ -39,16 +67,28 @@ export async function initializeWorkspace(workspace, { runJson = gridJson, disco
const mode = await read(config.mode, ['mode']);
const preferred = ['local','remote'].includes(mode.value?.mode) ? mode.value.mode : config.mode;
config.mode = preferred;
- const active = await read(preferred, ['use']);
- const selected = text(active.value?.active);
- if (selected && !selected.startsWith('-')) {
- const engines = await read(preferred, ['engines', selected]);
+ const listings = await Promise.all(['local','remote'].map(async mode => ({mode,result:await read(mode,['ls'])})));
+ // ONE source of truth for "which grid": the CLI's active selection (`grid use`). The viewer
+ // follows it on every poll (telemetry.mjs), so what the person selected in a terminal, or
+ // asked the agent to select, is what the screen shows. A fresh sign-in has no selection yet;
+ // then the person's own private grid is derived from the sign-in and SELECTED, so the CLI
+ // and the viewer agree from the first minute — never a team's or a community grid by guess.
+ const active = text((await read(preferred, ['use'])).value?.active);
+ if (active && !active.startsWith('-')) {
+ const engines = await read(preferred, ['engines', active]);
+ if (engines.ok && Array.isArray(engines.value)) { config.grid = active; source = 'Grid selection'; }
+ }
+ const remote = listings.find(l => l.mode === 'remote')?.result;
+ const own = config.grid ? null : pickPrivateGrid(await email(), remote?.value);
+ if (own) {
+ const engines = await read('remote', ['engines', own]);
if (engines.ok && Array.isArray(engines.value)) {
- config.grid = selected; source = 'Grid selection';
+ config.mode = 'remote'; config.grid = own; source = 'your private grid';
+ // The write form of `use` answers in prose, not JSON (lib/fleet.mjs gridSelect).
+ await select(controller(), 'remote', own, { timeoutMs: 5000 }).catch(() => ({ ok: false }));
}
}
if (!config.grid) {
- const listings = await Promise.all(['local','remote'].map(async mode => ({mode,result:await read(mode,['ls'])})));
for (const {mode,result} of listings) for (const row of Array.isArray(result.value) ? result.value.slice(0,16) : []) {
const grid = text(row.grid || row.name || row.id);
if (grid && !grid.startsWith('-') && !candidates.some(c => c.mode === mode && c.grid === grid)) candidates.push({mode,grid});
@@ -61,7 +101,7 @@ export async function initializeWorkspace(workspace, { runJson = gridJson, disco
config.mode = candidate.mode; config.grid = candidate.grid; source = 'only reachable grid';
}
}
- if (!config.grid) message = 'Choose a grid with fleet connect --mode local|remote --grid NAME. The existing default was not reachable or the selection is ambiguous.';
+ if (!config.grid) message = candidates.length ? `Ask the user which fleet to use — ${candidates.map(c => c.grid).join(', ')} — then fleet connect --mode local|remote --grid NAME. No private grid of theirs was found, so nothing is chosen for them.` : 'No grid is reachable from this machine. The user signs in to Harness first; then fleet connect --mode local|remote --grid NAME.';
}
if (config.grid) message = `Connected this workspace to ${config.mode} grid ${config.grid}.`;
}
@@ -73,7 +113,7 @@ export async function initializeWorkspace(workspace, { runJson = gridJson, disco
return {config,connection};
}
-export async function connectWorkspace(workspace, {mode,grid,remember=false}, {runJson=gridJson,discover=discoverMachines,profilePath=defaultsPath()} = {}) {
+export async function connectWorkspace(workspace, {mode,grid,remember=false}, {runJson=gridJson,select=gridSelect,discover=discoverMachines,profilePath=defaultsPath()} = {}) {
let config = validateConfig({...await readConfig(workspace),mode,grid});
if (!grid) throw new Error('Choose an explicit grid name, ID or URL.');
const controller = config.machines.find(m => m.id === config.controller);
@@ -82,6 +122,9 @@ export async function connectWorkspace(workspace, {mode,grid,remember=false}, {r
config = mergeMachines(config,await discover().catch(() => []));
await atomicJson(join(workspace,'grid-fleet.json'),config);
if (remember) await atomicJson(profilePath,config);
+ // The CLI's selection follows the workspace's, so a later `grid use` read (the viewer's poll,
+ // the person's terminal) agrees with what was just connected.
+ await select(controller,mode,grid,{timeoutMs:5000}).catch(() => ({ok:false}));
await atomicJson(join(stateDir(workspace),'connection.json'),{source:'explicit selection',mode,grid,remembered:remember,observedAt:now()});
return config;
}
diff --git a/store/agents/autonomous-grid/lib/fleet.mjs b/store/agents/autonomous-grid/lib/fleet.mjs
index b650752ea..ed64702cc 100644
--- a/store/agents/autonomous-grid/lib/fleet.mjs
+++ b/store/agents/autonomous-grid/lib/fleet.mjs
@@ -124,6 +124,24 @@ export async function gridJson(machine, mode, args, options) {
} catch { return { ok: false, error: `grid ${args[0]} did not return valid JSON.` }; }
}
+/**
+ * Make [grid] the CLI's active selection for [mode] (`grid use <name>`), and confirm it took.
+ *
+ * ⚠️ Not through gridJson: the WRITE form of `use` ignores `--json` and prints a sentence
+ * (`active grid for remote mode: autonomous.ai`, exit 0). Parsing that as JSON failed every
+ * time, so every switch from the viewer's dropdown reported "grid use did not return valid
+ * JSON" over a switch that had in fact happened. Only the READ form (`grid use --json`, no name)
+ * answers in JSON — so that is what confirms the write here.
+ */
+export async function gridSelect(machine, mode, grid, options, { run = execute, readJson = gridJson } = {}) {
+ const written = await run(machine, [`--${mode}`, 'use', grid], options);
+ if (!written.ok) return { ok: false, error: written.code === 127 ? written.error : `grid use failed (${written.code}). Run it in the agent terminal for details.` };
+ const read = await readJson(machine, mode, ['use'], options);
+ const active = typeof read.value?.active === 'string' ? read.value.active : null;
+ if (read.ok && active !== null && active !== grid) return { ok: false, error: `grid use answered, but the active grid is ${active}, not ${grid}.` };
+ return { ok: true, active: active ?? grid };
+}
+
export async function operations(workspace) {
const folder = join(stateDir(workspace), 'operations');
const names = await readdir(folder).catch(() => []);
diff --git a/store/agents/autonomous-grid/lib/telemetry.mjs b/store/agents/autonomous-grid/lib/telemetry.mjs
index 7f968a768..fde6d4127 100644
--- a/store/agents/autonomous-grid/lib/telemetry.mjs
+++ b/store/agents/autonomous-grid/lib/telemetry.mjs
@@ -121,8 +121,26 @@ export function assemble(config, reads, previous = null, observedAt = now()) {
export function createCollector(workspace, { runJson = gridJson, intervalMs = 8000 } = {}) {
let inFlight, deviceCache = new Map(), previous;
+ async function followSelection(config) {
+ // Only a workspace that HAS a grid follows the selection; one with none waits for `connect`
+ // (initialization already consulted the selection once) and contacts nothing meanwhile.
+ if (config.mode !== 'remote' || !config.grid) return null;
+ const controller = config.machines.find(m => m.id === config.controller);
+ const active = await runJson(controller, 'remote', ['use'], { timeoutMs: 5000 }).catch(() => null);
+ const selected = typeof active?.value?.active === 'string' ? active.value.active.trim() : '';
+ if (!selected || selected.startsWith('-') || selected === config.grid) return null;
+ const next = { ...config, grid: selected };
+ await atomicJson(join(workspace, 'grid-fleet.json'), next);
+ return next;
+ }
async function collect() {
- const config = await readConfig(workspace);
+ let config = await readConfig(workspace);
+ // Follow the CLI's selection: `grid use` is the one place a grid is chosen, and a workspace
+ // that kept its own copy showed a team's grid for the rest of the day after the person had
+ // switched to their own in a terminal. Read every poll (a local file, no network); a change
+ // is written back so the next poll, and the agent, read the same grid.
+ const followed = await followSelection(config);
+ if (followed) config = followed;
if (!config.grid) {
const observedAt=now(),message='Choose a grid with fleet connect --mode local|remote --grid NAME. No fleet has been selected for this workspace.';
const snapshot={spec:1,scope:JSON.stringify([config.mode,config.grid,config.controller]),observedAt,mode:config.mode,grid:'Choose your grid',status:'unconfigured',nodes:[],models:[],machines:[],history:{},events:[],operations:[],sources:{configuration:{ok:false,error:message,observedAt}},summary:{},preferences:config.preferences,pollIntervalMs:intervalMs};
@@ -133,11 +151,18 @@ export function createCollector(workspace, { runJson = gridJson, intervalMs = 80
const controller = config.machines.find(m => m.id === config.controller);
const selector = config.grid ? [config.grid] : [];
const names = ['info', 'engines', 'models', ...(config.mode === 'remote' ? ['stats'] : [])];
- const results = await Promise.allSettled(names.map(command => runJson(controller, config.mode, [command, ...selector])));
- const reads = Object.fromEntries(results.map((result,i) => [names[i], result.status === 'fulfilled' ? result.value : { ok: false, error: `grid ${names[i]} could not be read.` }]));
+ // `ls` beside the per-grid reads: the viewer's grid dropdown is every grid this account is in,
+ // read fresh each poll so a grid joined a minute ago is offered without a restart.
+ const results = await Promise.allSettled([...names.map(command => runJson(controller, config.mode, [command, ...selector])), runJson(controller, config.mode, ['ls'])]);
+ const reads = Object.fromEntries(results.slice(0, names.length).map((result,i) => [names[i], result.status === 'fulfilled' ? result.value : { ok: false, error: `grid ${names[i]} could not be read.` }]));
+ const listed = results[names.length];
+ const grids = listed.status === 'fulfilled' && Array.isArray(listed.value?.value)
+ ? listed.value.value.map(row => ({ name: text(row.grid || row.name || row.id), type: text(row.type) })).filter(g => g.name && !g.name.startsWith('-'))
+ : previous?.grids || [];
previous ||= await readJson(join(stateDir(workspace), 'snapshot.json'), null).catch(() => null);
const observedAt = now();
const snapshot = assemble(config, reads, previous, observedAt);
+ snapshot.grids = grids;
snapshot.machines = await Promise.all(config.machines.map(async machine => {
const cacheKey = JSON.stringify(machine);
let cached = deviceCache.get(cacheKey);
diff --git a/store/agents/autonomous-grid/skills/grid-operations/SKILL.md b/store/agents/autonomous-grid/skills/grid-operations/SKILL.md
index ab63b60e2..59e024fba 100644
--- a/store/agents/autonomous-grid/skills/grid-operations/SKILL.md
+++ b/store/agents/autonomous-grid/skills/grid-operations/SKILL.md
@@ -1,6 +1,6 @@
---
name: grid-operations
-description: "Operate a Grid fleet from this harness workspace: discover capacity, deploy and undeploy open-weight models, compare placement and performance, and use Grid routing, usage, media and training commands."
+description: "Look after the models on the user's machines — one laptop or a fleet: recognise their private grid, ask what they need in plain words, pick a model that fits from disk, catalog or Hugging Face, start it with vision and context that fit, prove it answers with one bounded call, change or stop a running one, and use Grid routing, usage, media and training commands."
---
# Grid operations
@@ -22,8 +22,18 @@ offline; use fresh viewer observations or an approved live check.
`grid-fleet.json` holds the mode (`local` or `remote`), grid selector, controller machine, managed
machines and user preferences. A null grid means the workspace is not connected; the viewer must not
-fall through to an old CLI default. Fresh workspaces reuse the remembered fleet, then a reachable
-active Grid selection; ambiguous choices remain explicit. Connect with
+fall through to an old CLI default. **The CLI's selection (`use`) is the one source of truth for
+which grid this is.** The viewer reads it on every poll and follows a change, so what the person
+selected — in a terminal, or by asking you — is what the screen shows; `connect` selects too, so
+the two never disagree. A fresh sign-in has no selection yet: then the workspace reuses the
+remembered fleet, else the **user's own private grid**, recognised rather than asked for — Harness
+mints it at sign-in as the email's local part from `~/.grid/credentials.toml` (lowercased, runs of
+non-alphanumerics → `-`, trimmed), then `-` and eight hex, of type `permissioned-public`; exactly
+one row of `ls --json` matches — and selects it, so the CLI agrees from the first minute. A person
+who asks to "switch to", "use" or "work on" another grid they are in (`ls`) gets `connect` with
+that name: it verifies the grid answers, then selects it. Pass the selected grid to every command
+that takes one. With no private grid and several reachable, ask which with the question tool.
+Connect with
`"$GRID_FLEET" connect --mode remote --grid NAME --remember` to select a verified grid and reuse it
in future workspaces. `--remember` writes this controller's `~/.harness/grid-fleet/default.json`;
existing workspace selections remain independent. Changing this workspace's mode never requires
@@ -51,18 +61,91 @@ input; Harness transport is noninteractive, so sign-in prompts belong in that ma
the default execution machine. Model files and `join`/`leave` operations belong on the machine
that runs the engine; listing, routing and requests can run on the controller.
-## Deploy and verify
+## Start a model
-1. Inspect capacity and current workloads on the intended host. Use **per-machine available memory**,
- Grid's usable model budget, disk space, model size/quantization, context/KV cache, and the user's
- `keepFreeMemoryGb`. Do not add multiple machines' memory to claim a model fits. Prefer a smaller
- model or supported quantization when headroom is tight.
-2. Use the installed CLI's `--help` for current flags. Discover weights through `catalog --json`, or
- verify an exact Hugging Face repository/file. Check the model card's license and capabilities when
- selecting a new model. Describe downloads and intended placement within the user's stated scope.
-3. Install an engine if needed, pull an explicit file, then join the intended grid. Give each served
- instance a unique, recognizable `--name` and `--advertise-as`. Use explicit ports when several
- instances share a host. Local hosts join using the controller's reachable grid URL.
+Slow steps are a real stop: a download or an engine build is asked about through the question tool
+and runs in the **next** turn, never in the message that asks. Every model you offer comes from
+something you looked up — the host's disk, the catalog, or Hugging Face — never from memory. The
+pick is made once; after the person chooses, that is the model through the download, the vision
+question and the start, unless it fails (won't fit, won't pull, won't answer).
+
+**1. What they need — three questions, in plain words, through the question tool.** Skip any the
+person already answered. The engine numbers in brackets are yours; they are never shown.
+
+ "What will you mostly use it for?" — the work decides which model is worth downloading
+ Coding · Chat and writing · Reading images · Just something fast
+ "How much can it hold in its head at once?" — its working memory for one conversation; when it
+ fills, it forgets the beginning; more costs memory on the machine
+ Short, about 20 pages [32K] · Medium, about 40 pages [64K] · Long, about 80 pages [128K] ·
+ As much as this machine can give it
+ "How many things will talk to it at the same time?" — each one reserves its own share of memory
+ up front; when every share is taken, the next request waits
+ Just me, one agent at a time [1] · Two agents at once [2] · A few agents or people at once [4]
+
+Coding wants Long (an agent burns context as a session grows); chat is fine at Short; "just me" on
+a laptop someone is also working on.
+
+**2. What the host has.** `device-info --json` on the intended host first: `usable_bytes` is the
+real ceiling for weights plus context. Per-machine, never summed across hosts. The engine check is
+the binary, not a status command: `~/.grid/bin/llama-server --version` printing a version line means
+llama.cpp is installed — go on without a word. ⚠️ `engine status` reports the **media** engine
+(ComfyUI) and says `Installed: no` on a host whose llama.cpp is fine; it sent an agent asking to
+install what was already built. Only when the binary is missing, ask (build from source or prebuilt)
+and run `engine install llama.cpp [--from-source]` in the next turn.
+
+**3. What is already on the host's disk comes first.** `ls ~/.grid/models/*.gguf` minus the
+`.mmproj.gguf` sidecars; `ctx FILE --json` says how much each can hold; a `<stem>.mmproj.gguf`
+beside a file means it reads images. Anything that fits the answers is offered first as "already on
+this computer, no download", beside one option to fetch something new. Only that option goes on.
+
+**4. The catalog, then Hugging Face.** `catalog --json` is sized for the host: keep entries that are
+`runnable`, whose `fit.ctx` covers the context asked, and that suit the purpose; pull
+`fit.version`'s `pull_spec`. Offer 2–3 in the same plain terms as step 1 — what it is good at, the
+download size in GB, how much it can hold in pages, whether it reads images. No speed figure
+(`fit.est_tok_s` only orders the list for "fast"), no quant name, no token count as the whole answer.
+When the person names a model the catalog lacks, the catalog is not a wall — `pull` takes any
+`<repo>:<file>.gguf` on Hugging Face and fetches its projector too:
+
+ curl -sf "https://huggingface.co/api/models?search=<name>&filter=gguf&sort=downloads&limit=8" \
+ | python3 -c 'import json,sys; [print(m["id"], m.get("downloads")) for m in json.load(sys.stdin)]'
+ curl -sf "https://huggingface.co/api/models/<repo_id>" | python3 -c '
+ import json,sys
+ for f in json.load(sys.stdin)["siblings"]:
+ if f["rfilename"].endswith(".gguf"): print(f["rfilename"], f.get("size"))'
+
+Prefer an official org (`ggml-org`, `Qwen`, `google`, `unsloth`, `bartowski`, `lmstudio-community`)
+over an unknown uploader, then downloads; say which in half a line. Pick the quant by size against
+`usable_bytes` (or ≈0.6 bytes per parameter for Q4_K_M), leaving room for context. A model outside
+the catalog has been sized by nobody but you — say the fit is your estimate.
+
+**Vision is not in the catalog** (every entry's `task` is `text-generation`). Before pulling, the
+same `siblings` list answers it: any top-level `mmproj*.gguf` means the model reads images — print
+the file names, and put "reads images" or "text only" on each option; for "Reading images" offer
+only repos with an mmproj. After the pull, the disk proves it:
+`test -f ~/.grid/models/<stem>.mmproj.gguf`.
+
+**5. Two checks, then the start.** *Fit:* `--ctx-size` is per request and the engine reserves
+context × slots up front (grid passes `ctx × slots` to llama.cpp; 4 slots at 64K is 256K tokens of
+KV cache before the first request, and a size the host cannot hold fails to start rather than
+shrinking). Check context × the asked concurrency against `usable_bytes` minus the weights and
+`keepFreeMemoryGb`; if it doesn't fit, offer a smaller context or fewer slots through a tool.
+*Vision:* when the projector is on disk, ONE question whose options say what each does —
+"Serve it with vision on?" · *Yes, with vision — it reads screenshots and photos (some extra
+memory)* · *No, text only — the vision file is set aside for this run; say the word to put it back*.
+On "no", rename the projector yourself (`mv <stem>.mmproj.gguf <stem>.mmproj.gguf.off`) before the
+join and say so in one line — never a second question about the file.
+
+ "$GRID_FLEET" run --machine MACHINE -- pull OWNER/REPO:EXACT_FILE.gguf
+ "$GRID_FLEET" run --machine MACHINE -- join GRID --serve EXACT_FILE.gguf --advertise-as MODEL_ALIAS \
+ --name MACHINE-MODEL --max-concurrency N --ctx-size CTX --endpoint-port PORT
+
+`--advertise-as` is the name the person will see in their model picker; `--name` is the machine's
+display name — different things. `--max-concurrency N` is the step-1 answer; don't pass
+`--parallel` (grid derives the slot count from it) and don't pass `--jinja` (on by default in the
+engine grid ships). `--ctx-size` always, capped at the file's `fit.max_ctx` ("as much as fits" =
+`fit.ctx`): left off, the engine takes a 16K default, smaller than an agent's own prompt. Use
+explicit ports when several instances share a host. An existing Ollama, vLLM, MLX or LM Studio
+engine can join with `--at URL -m MODEL --name NAME`; do not install a second engine needlessly.
Choose a reasoning budget deliberately. Grid's GPU default can spend more tokens thinking than a
small output limit permits, yielding no final answer. For an everyday low-latency assistant, start
@@ -70,29 +153,47 @@ with `fleet run --thinking off -- join ... --reasoning-budget 0`. `--thinking of
`enable_thinking:false` template parameter for the newly started engine; it is needed on builds
where a zero token budget alone still produces reasoning. Use `--thinking on` to enable a supported
model's thinking explicitly. These switches configure startup, not an already running instance.
-For a reasoning model, reserve an explicit budget smaller than
-`--n-predict`, leaving room for the answer. Verify `message.content` contains the requested result;
-reasoning text alone, a length-limited completion, or a successful HTTP status is not acceptance.
+For a reasoning model, reserve an explicit budget smaller than `--n-predict`, leaving room for the
+answer.
-```sh
-"$GRID_FLEET" run --machine MACHINE -- engine install llama.cpp
-"$GRID_FLEET" run --machine MACHINE -- pull OWNER/REPO:EXACT_FILE.gguf
-"$GRID_FLEET" run --machine MACHINE -- join GRID_URL_OR_ID --serve EXACT_FILE.gguf --name MACHINE-MODEL --advertise-as MODEL_ALIAS --endpoint-port PORT
-"$GRID_FLEET" run -- models GRID --json
-"$GRID_FLEET" run -- chat --grid GRID -m MODEL_ALIAS "A short representative test" --json
-"$GRID_FLEET" refresh
-```
+**6. Prove it answers — once, bounded.** A successful `join` means *starting*, not ready. First wait
+for the relay to list it (a call before that answers `No providers available for this model`, which
+is "not yet", not "broken"):
+
+ until "$GRID_FLEET" run -- models GRID 2>/dev/null | grep -qx 'MODEL_ALIAS'; do sleep 10; done
+ eval "$("$GRID_FLEET" run -- info GRID --env)" && curl -s --max-time 420 "$OPENAI_BASE_URL/chat/completions" \
+ -H "Authorization: Bearer $OPENAI_API_KEY" -H 'content-type: application/json' \
+ -d '{"model":"MODEL_ALIAS","messages":[{"role":"user","content":"Reply with the single word: ok"}],"max_tokens":8}'
-An existing Ollama, vLLM, MLX or LM Studio engine can join with `--at URL -m MODEL --name NAME`.
-Use `join --help` to choose the appropriate engine flags. Do not install a second engine needlessly.
-A successful `join` may mean **starting**, not ready: poll `models` and send a real request before
-reporting that the model works. For a bounded retry, wait up to the loading deadline warranted by
-the model's size, inspect Grid's named logs on failure, and report the concrete blocker.
+⚠️ Not `chat` for this check. `chat` sets no output limit and the engine's default is tens of
+thousands of tokens, so a small model that runs away answering "ok" holds the slot for minutes — and
+with one slot everything after it waits, including a second check. `max_tokens` is what makes this
+finish in seconds whatever the model does. The timeout is long on purpose: right after a join, grid
+sends the new engine a probe of about 5K tokens to measure what it can do, and on a host without a
+GPU that alone takes 3–5 minutes at ~30 tokens/s while holding the single slot. Tell the user the
+model is warming up and the first answer can take a few minutes on that machine. Send the check
+ONCE and leave it alone — a second call, a `chat`, a log tail all queue behind the same probe. A
+reply with a `choices` entry means the whole path works. Nothing within the timeout: stop the model
+(`leave`), say in one line it started but did not answer in time, and offer through a tool a model
+one step larger from the same list (tiny models loop), or more requests at once, or stop. Verify
+`message.content` contains the requested result; reasoning text alone or a successful HTTP status is
+not acceptance. Then `"$GRID_FLEET" refresh`.
-For remote Grid, `--parallel N` reserves llama.cpp slots, while `--max-concurrency N` separately
-controls how many requests Grid dispatches. Set both deliberately for concurrent service, and verify
-the advertised concurrency. `--ctx-size` is per request, so reserved context memory grows with the
-slot count. Raising concurrency needs a new serving process and a representative concurrent test.
+**7. Say where it is.** "<alias> is running on <machine>, N at a time, vision on/off. Pick it from
+the model dropdown at the top of any agent's pane, and that agent switches to it." The window's
+Models menu only lists Local models; it does not switch. Don't offer to wire it into an agent's
+config or add a provider — the picker is the whole hand-off.
+
+## Change a running model
+
+The person names the one thing they want different; everything else stays. Read the current
+settings from the viewer or `stats GRID --verbose --json` (model, context, slots) so you change only
+that and can say what changed. Context, concurrency and vision all mean a restart — `leave` that
+instance, then the same `join` with the one flag (or the projector file) changed; check the fit
+first as in step 5. A different model is step 3 onward, keeping the context and concurrency they
+already have; stop the old one only when the new one is about to serve. Stop is `leave` and one
+line. A restart drops the model from the picker for the seconds it takes and any agent mid-turn on
+it loses that turn: say so in one line, and ask first only when `stats` shows requests in flight.
## Undeploy and move
@@ -128,6 +229,24 @@ the user's explicit standing policy (`allowAutomaticChanges` plus a concrete sco
does not authorize an unrequested fleet-wide upgrade. Existing authorization for a deployment or
move is enough to carry it through without asking again.
+## When something fails
+
+Say what failed and stop; translate every message, never repeat a raw line that names the CLI.
+
+ - **Not signed in** → the user's to fix: `harness login`, the only command ever theirs.
+ - **`No providers available for this model`** right after a join → not registered yet; wait as
+ step 6 says.
+ - **`exceeds the available context size`** (an agent may show it as a garbled "expected array
+ `choices`") → served with too small a window, usually `--ctx-size` left off: leave, join again
+ with the asked context.
+ - **`Jinja Exception: System message must be at the beginning`** → the model's template refuses a
+ system message after the first turn; the relay now hoists system/developer messages to the
+ front, so the relay this machine talks to predates that fix. The model is fine; nothing to
+ change here.
+ - **The user says it isn't in the picker** → it is there only while served: `stats GRID --verbose`;
+ not listed → start it again (the weights are still on disk); listed → the picker refreshes on
+ open.
+
## The rest of Grid
Use `"$GRID_FLEET" run -- --help`, then a command's `--help`, to discover the installed surface.
diff --git a/store/agents/autonomous-grid/skills/grid-operations/references/commands.md b/store/agents/autonomous-grid/skills/grid-operations/references/commands.md
index d0504e015..b46c804e6 100644
--- a/store/agents/autonomous-grid/skills/grid-operations/references/commands.md
+++ b/store/agents/autonomous-grid/skills/grid-operations/references/commands.md
@@ -6,12 +6,12 @@ https://github.com/autonomous-ai/autonomous-grid/blob/main/docs/cli.md.
| Need | Grid commands |
|---|---|
-| Lifecycle and selection | `start`, `stop`, `delete`, `ls`, `info`, `use`, `mode` |
+| Lifecycle and selection | `start`, `stop`, `delete`, `ls`, `info`, `mode`, `use` — `use` is the one source of truth for which grid; the viewer follows it, and `connect` sets it (SKILL.md, "Targets and access"). Change grids through `connect`, which verifies first |
| Host inventory | `device-info --json` |
-| Model discovery and weights | `catalog --json`, `pull REPO:FILE`, `ctx FILE --json`, `rm FILE` |
-| Engine provisioning | `engine install`, `engine pull`, `engine start`, `engine status`, `engine stop` |
+| Model discovery and weights | `~/.grid/models/*.gguf` on disk first, then `catalog --json`, then Hugging Face; `pull REPO:FILE`, `ctx FILE --json`, `rm FILE` |
+| Engine provisioning | `engine install llama.cpp [--from-source]`; the install check is `~/.grid/bin/llama-server --version` — `engine status`/`start`/`stop` are the media engine (ComfyUI) |
| Serving and removal | `join`, `leave --engine SELECTOR`, `engines --json`, `models --json` |
-| Inference checks | `chat`, `image`, `edit`, `video`, `stt` |
+| Inference checks | a bounded relay call with `max_tokens` (SKILL.md step 6), never `chat` for verification (no output limit); `image`, `edit`, `video`, `stt` for media |
| Remote telemetry | `stats --verbose --json`, `usage --by model|member|engine --json` |
| Remote request routing | `router --help` (inspect before changing policies or advisors) |
| Training and evaluation | `train --help`, `train doctor`, `train packs`, `train eval`, `train deploy` |
diff --git a/store/agents/autonomous-grid/test/connect.test.mjs b/store/agents/autonomous-grid/test/connect.test.mjs
index 95bc4e654..865619938 100644
--- a/store/agents/autonomous-grid/test/connect.test.mjs
+++ b/store/agents/autonomous-grid/test/connect.test.mjs
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
-import { connectWorkspace, initializeWorkspace, readStatus } from '../lib/connect.mjs';
+import { connectWorkspace, initializeWorkspace, pickPrivateGrid, readStatus } from '../lib/connect.mjs';
import { atomicJson, DEFAULT_CONFIG, gridJson, readConfig } from '../lib/fleet.mjs';
import { createCollector } from '../lib/telemetry.mjs';
@@ -21,18 +21,52 @@ test('a fresh workspace reuses the remembered remote fleet and imports machines'
assert.equal(result.config.controller,'local');assert.equal(result.config.machines[0].name,'This computer');
assert.equal(result.connection.source,'remembered fleet');
});
-test('fresh initialization follows a reachable active remote selection, not the template local mode',async t=>{
+test('the private grid is recognised from the sign-in: email slug, eight hex, permissioned-public, exactly one',()=>{
+ const rows=[{grid:'autonomous.ai',type:'private-domain'},{grid:'tuan-dev-991371e4',type:'permissioned-public'},{grid:'tuan-dev-11111111',type:'domain-restricted'},{grid:'BBB',type:'domain-restricted'}];
+ assert.equal(pickPrivateGrid('[email protected]',rows),'tuan-dev-991371e4');
+ assert.equal(pickPrivateGrid('[email protected]',rows),null);
+ assert.equal(pickPrivateGrid('[email protected]',[...rows,{grid:'tuan-dev-aaaaaaaa',type:'permissioned-public'}]),null,'two matches are nobody\'s answer');
+});
+test('fresh initialization follows the CLI\'s active selection when there is one',async t=>{
+ const {dir,profilePath}=await setup(t),calls=[];
+ const ls={remote:[{grid:'autonomous.ai',type:'private-domain'},{grid:'tuan-dev-991371e4',type:'permissioned-public'}],local:[{grid:'home'}]};
+ const runJson=async(_host,mode,args)=>{calls.push([mode,...args]);return {ok:true,value:args[0]==='mode'?{mode:'remote'}:args[0]==='use'?{mode:'remote',active:'autonomous.ai'}:args[0]==='ls'?ls[mode]:[]};};
+ const selected=[];const select=async(_host,mode,grid)=>{selected.push([mode,grid]);return {ok:true,active:grid};};
+ const {config,connection}=await initializeWorkspace(dir,{profilePath,discover,runJson,select,email:async()=>'[email protected]'});
+ assert.equal(config.grid,'autonomous.ai');assert.equal(connection.source,'Grid selection');
+ assert.deepEqual(calls.filter(c=>c[1]==='engines'),[['remote','engines','autonomous.ai']]);
+ assert.deepEqual(selected,[],'an existing selection is never rewritten');
+});
+test('with no selection yet, the signed-in user\'s own private grid is chosen AND selected, so the CLI agrees',async t=>{
const {dir,profilePath}=await setup(t),calls=[];
- const runJson=async(_host,mode,args)=>{calls.push([mode,...args]);return {ok:true,value:args[0]==='mode'?{mode:'remote'}:args[0]==='use'?{active:'my-fleet'}:[]};};
- const {config}=await initializeWorkspace(dir,{profilePath,discover,runJson});
- assert.equal(config.mode,'remote');assert.equal(config.grid,'my-fleet');
- assert.deepEqual(calls,[['local','mode'],['remote','use'],['remote','engines','my-fleet']]);
+ const ls={remote:[{grid:'autonomous.ai',type:'private-domain'},{grid:'tuan-dev-991371e4',type:'permissioned-public'}],local:[{grid:'home'}]};
+ const runJson=async(_host,mode,args)=>{calls.push([mode,...args]);return {ok:true,value:args[0]==='mode'?{mode:'remote'}:args[0]==='use'?{mode:'remote',active:null}:args[0]==='ls'?ls[mode]:[]};};
+ const selected=[];const select=async(_host,mode,grid)=>{selected.push([mode,grid]);return {ok:true,active:grid};};
+ const {config,connection}=await initializeWorkspace(dir,{profilePath,discover,runJson,select,email:async()=>'[email protected]'});
+ assert.equal(config.mode,'remote');assert.equal(config.grid,'tuan-dev-991371e4');assert.equal(connection.source,'your private grid');
+ // Selected through the WRITE path (`grid use <name>`, prose answer), never through the JSON
+ // reader — that call form printed a sentence, and parsing it as JSON was what reported every
+ // successful switch as a failure.
+ assert.deepEqual(selected,[['remote','tuan-dev-991371e4']]);
+ assert.ok(!calls.some(c=>c[1]==='use'&&c.length===3),'the JSON reader never runs the write form of use');
+});
+test('the collector follows a changed selection on its next poll',async t=>{
+ const {dir}=await setup(t);
+ await writeFile(join(dir,'grid-fleet.json'),JSON.stringify({spec:1,mode:'remote',grid:'autonomous.ai',controller:'this',machines:[{id:'this',name:'here',transport:'local'}]}));
+ let active='autonomous.ai';const asked=[];
+ const runJson=async(_host,_mode,args)=>{asked.push(args);if(args[0]==='use')return {ok:true,value:{mode:'remote',active}};return {ok:true,value:[]};};
+ const collect=createCollector(dir,{runJson});
+ assert.equal((await collect()).grid,'autonomous.ai');
+ active='tuan-dev-991371e4';
+ assert.equal((await collect()).grid,'tuan-dev-991371e4');
+ assert.equal((await readConfig(dir)).grid,'tuan-dev-991371e4');
+ assert.ok(asked.some(a=>a[0]==='engines'&&a[1]==='tuan-dev-991371e4'),'the new grid is what gets polled');
});
-test('an unreachable active grid and ambiguous inventory never silently select old home',async t=>{
+test('no private grid and an ambiguous inventory selects nothing and tells the agent to ask',async t=>{
const {dir,profilePath}=await setup(t);
- const runJson=async(_host,mode,args)=>args[0]==='mode'?{ok:true,value:{mode:'remote'}}:args[0]==='use'?{ok:true,value:{active:'broken'}}:args[0]==='engines'?{ok:false,error:'unreachable'}:{ok:true,value:mode==='local'?[{grid:'home'}]:[{grid:'working'},{grid:'other'}]};
- const result=await initializeWorkspace(dir,{profilePath,discover,runJson});
- assert.equal(result.config.grid,null);assert.equal(result.connection.candidates.length,3);
+ const runJson=async(_host,mode,args)=>args[0]==='mode'?{ok:true,value:{mode:'remote'}}:args[0]==='engines'?{ok:false,error:'unreachable'}:{ok:true,value:mode==='local'?[{grid:'home'}]:[{grid:'working'},{grid:'other'}]};
+ const result=await initializeWorkspace(dir,{profilePath,discover,runJson,email:async()=>'[email protected]'});
+ assert.equal(result.config.grid,null);assert.equal(result.connection.candidates.length,3);assert.match(result.connection.message,/Ask the user which fleet/);
let calls=0;const snapshot=await createCollector(dir,{runJson:async()=>{calls++;throw new Error('do not contact a default grid');}})();
assert.equal(calls,0);assert.equal(snapshot.status,'unconfigured');assert.deepEqual(snapshot.nodes,[]);
});
@@ -44,7 +78,8 @@ test('an existing explicit workspace keeps its selection and preferences',async
});
test('connect verifies service before changing workspace or remembered defaults',async t=>{
const {dir,profilePath}=await setup(t);
- const fail={profilePath,discover,runJson:async()=>({ok:false,error:'Grid unreachable'})};
+ // `select` stubbed: the real one runs `grid use` on this machine, which a test must never do.
+ const fail={profilePath,discover,runJson:async()=>({ok:false,error:'Grid unreachable'}),select:async(_h,_m,grid)=>({ok:true,active:grid})};
await assert.rejects(connectWorkspace(dir,{mode:'remote',grid:'broken',remember:true},fail),/unreachable/);
assert.equal((await readConfig(dir)).grid,null);await assert.rejects(readFile(profilePath),{code:'ENOENT'});
const ok={...fail,runJson:async()=>({ok:true,value:[{name:'node',api_key:'must-not-save'}]})};
diff --git a/store/agents/autonomous-grid/test/fleet.test.mjs b/store/agents/autonomous-grid/test/fleet.test.mjs
index e9c75eee6..2771338b5 100644
--- a/store/agents/autonomous-grid/test/fleet.test.mjs
+++ b/store/agents/autonomous-grid/test/fleet.test.mjs
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-import { atomicJson, DEFAULT_CONFIG, execute, invocation, operations, runTracked, validateConfig } from '../lib/fleet.mjs';
+import { atomicJson, DEFAULT_CONFIG, execute, gridSelect, invocation, operations, runTracked, validateConfig } from '../lib/fleet.mjs';
const temporary = async t => { const dir=await mkdtemp(join(tmpdir(),'grid-harness-test-'));t.after(()=>rm(dir,{recursive:true,force:true}));return dir; };
test('inventory accepts explicit targets and refuses duplicates, SSH options and malformed paths',()=>{
@@ -49,3 +49,19 @@ test('invalid and abandoned operation files cannot crash the viewer',async t=>{
await atomicJson(join(dir,'.harness/grid/operations/b.json'),{unrelated:true});
const rows=await operations(dir);assert.equal(rows.length,1);assert.equal(rows[0].phase,'interrupted');
});
+
+test('gridSelect runs the write form of use as a plain command and confirms it by reading the selection back',async()=>{
+ // `grid use <name> --json` prints a sentence, not JSON — parsed as JSON, every successful switch
+ // from the viewer read as "did not return valid JSON". The write is plain; the read confirms.
+ const machine={id:'local',transport:'local'},ran=[];
+ const run=async(_m,args)=>{ran.push(args);return {ok:true,code:0,stdout:'active grid for remote mode: autonomous.ai\n',stderr:''};};
+ const readJson=async(_m,_mode,args)=>{ran.push(['json',...args]);return {ok:true,value:{mode:'remote',active:'autonomous.ai'}};};
+ assert.deepEqual(await gridSelect(machine,'remote','autonomous.ai',{},{run,readJson}),{ok:true,active:'autonomous.ai'});
+ assert.deepEqual(ran,[['--remote','use','autonomous.ai'],['json','use']]);
+ // The CLI accepted the name but ended up somewhere else: said, not hidden.
+ const elsewhere=await gridSelect(machine,'remote','other',{},{run,readJson});
+ assert.equal(elsewhere.ok,false);assert.match(elsewhere.error,/active grid is autonomous\.ai, not other/);
+ // A failed write is a failure, with the exit code, before any read.
+ const failed=await gridSelect(machine,'remote','x',{},{run:async()=>({ok:false,code:2,stdout:'',stderr:'no such grid'}),readJson:async()=>{throw new Error('must not read');}});
+ assert.equal(failed.ok,false);assert.match(failed.error,/grid use failed \(2\)/);
+});
diff --git a/store/agents/autonomous-grid/test/telemetry.test.mjs b/store/agents/autonomous-grid/test/telemetry.test.mjs
index e7c902b3a..6213293a6 100644
--- a/store/agents/autonomous-grid/test/telemetry.test.mjs
+++ b/store/agents/autonomous-grid/test/telemetry.test.mjs
@@ -63,7 +63,8 @@ test('collector coalesces concurrent refreshes, caches hardware and writes a tru
await atomicJson(join(dir,'grid-fleet.json'),config);
const calls=[];
const collect=createCollector(dir,{runJson:async(_machine,mode,args)=>{calls.push(args[0]);await new Promise(r=>setTimeout(r,2));return args[0]==='device-info'?{ok:true,value:device}:reads[args[0]];}});
- const [a,b]=await Promise.all([collect(),collect()]);assert.equal(a,b);assert.equal(calls.length,5);
+ // Five reads, plus the selection check (`use`) before them and the grid list (`ls`) beside them.
+ const [a,b]=await Promise.all([collect(),collect()]);assert.equal(a,b);assert.equal(calls.length,7);
await collect();assert.equal(calls.filter(c=>c==='device-info').length,1);
const verdict=JSON.parse(await readFile(join(dir,'.harness/verdict.json'),'utf8'));assert.equal(verdict.ready,true);assert.match(verdict.summary,/7 engines/);
});
diff --git a/store/agents/autonomous-grid/viewer.mjs b/store/agents/autonomous-grid/viewer.mjs
index 2e011cc3d..f71f5a5d1 100644
--- a/store/agents/autonomous-grid/viewer.mjs
+++ b/store/agents/autonomous-grid/viewer.mjs
@@ -2,10 +2,10 @@ import { createServer } from 'node:http';
import { readFile } from 'node:fs/promises';
import { join, resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
-import { atomicJson, now, operations, PACKAGE } from './lib/fleet.mjs';
+import { atomicJson, gridSelect, now, operations, PACKAGE, readConfig } from './lib/fleet.mjs';
import { createCollector } from './lib/telemetry.mjs';
-export function createViewer({ workspace, port = 0, intervalMs = 8000, collect = createCollector(workspace, { intervalMs }) }) {
+export function createViewer({ workspace, port = 0, intervalMs = 8000, collect = createCollector(workspace, { intervalMs }), select = gridSelect }) {
const clients = new Set();
let snapshot = { spec: 1, status: 'connecting', grid: 'Your grid', nodes: [], machines: [], models: [], events: [], operations: [], history: {}, sources: {}, summary: {}, observedAt: null, pollIntervalMs: intervalMs };
let stopped = false, pollTimer, opTimer, heartbeat;
@@ -23,10 +23,20 @@ export function createViewer({ workspace, port = 0, intervalMs = 8000, collect =
const address = server.address();
const hosts = new Set([`127.0.0.1:${address?.port}`, `localhost:${address?.port}`, `[::1]:${address?.port}`]);
if (!hosts.has(req.headers.host)) { json(res, 403, { error: 'Loopback requests only.' }); return; }
- if (!['GET', 'HEAD'].includes(req.method)) { res.setHeader('allow', 'GET, HEAD'); json(res, 405, { error: 'This viewer is read-only. Talk to the Grid agent to make changes.' }); return; }
const url = new URL(req.url, `http://${req.headers.host}`);
const origin = req.headers.origin;
if (origin && origin !== url.origin) { json(res, 403, { error: 'Cross-origin requests are not allowed.' }); return; }
+ // The one write the viewer takes: which grid to look at. It is the CLI's own selection
+ // (`grid use`), so the agent and a terminal see the same choice, and the next poll is run at
+ // once so the screen changes with the click rather than up to a poll later.
+ if (req.method === 'POST' && url.pathname === '/api/select') {
+ let body = ''; for await (const chunk of req) { body += chunk; if (body.length > 4096) { json(res, 413, { error: 'Too large.' }); return; } }
+ let grid = ''; try { grid = String(JSON.parse(body || '{}').grid || '').trim(); } catch { /* not json */ }
+ if (!grid || grid.startsWith('-') || !/^[A-Za-z0-9._-]{1,128}$/.test(grid)) { json(res, 400, { error: 'Name a grid.' }); return; }
+ try { await selectGrid(grid); json(res, 200, { ok: true, grid }); } catch (err) { json(res, 409, { error: err.message }); }
+ return;
+ }
+ if (!['GET', 'HEAD'].includes(req.method)) { res.setHeader('allow', 'GET, HEAD, POST'); json(res, 405, { error: 'This viewer is read-only. Talk to the Grid agent to make changes.' }); return; }
if (url.pathname === '/health') { json(res, 200, { ok: true }); return; }
if (url.pathname === '/api/snapshot') { json(res, 200, snapshot); return; }
if (url.pathname === '/events') {
@@ -44,6 +54,24 @@ export function createViewer({ workspace, port = 0, intervalMs = 8000, collect =
res.end(req.method === 'HEAD' ? undefined : content);
} catch { if (!res.headersSent) json(res, 500, { error: 'The viewer could not serve this request.' }); else res.end(); }
});
+ async function selectGrid(grid) {
+ const config = await readConfig(workspace);
+ const controller = config.machines.find(m => m.id === config.controller);
+ const mode = config.mode === 'local' ? 'local' : 'remote';
+ const chosen = await select(controller, mode, grid, { timeoutMs: 10_000 });
+ if (!chosen.ok) throw new Error(chosen.error || `Could not select ${grid}.`);
+ await atomicJson(join(workspace, 'grid-fleet.json'), { ...config, mode, grid });
+ // The click answers here, the moment the switch itself is done — not after a full collect(),
+ // which chains several `grid` subprocess calls and can run for seconds on a fleet nobody has
+ // looked at yet. That used to hold the button disabled long enough to read as broken. The name
+ // changes at once (published now, over the same connection the map already listens on); the
+ // map's numbers catch up a moment later when the poll below lands.
+ snapshot = { ...snapshot, status: 'connecting', grid, nodes: [], machines: [], models: [], summary: {}, history: {}, observedAt: null };
+ publish();
+ clearTimeout(pollTimer);
+ poll(); // not awaited — its own errors are already caught inside poll()
+ }
+
async function poll() {
try { snapshot = await collect(); }
catch {
diff --git a/store/agents/autonomous-grid/viewer/app.css b/store/agents/autonomous-grid/viewer/app.css
index 24429a99e..d321dc287 100644
--- a/store/agents/autonomous-grid/viewer/app.css
+++ b/store/agents/autonomous-grid/viewer/app.css
@@ -1,9 +1,241 @@
-:root{color-scheme:dark;--bg:#080b0f;--surface:#10151b;--surface-2:#161c23;--stroke:#232a31;--text:#e7e9ec;--muted:#89929f;--gold:#dfb465;--gold-dim:#8b7145;--green:#78bb98;--red:#e98576;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-size:14px;background:var(--bg);color:var(--text)}
-*{box-sizing:border-box}body{margin:0}button,select{font:inherit}button{cursor:pointer;color:inherit}button:disabled{cursor:default;opacity:.5}[hidden]{display:none!important}button:focus-visible,select:focus-visible{outline:2px solid var(--gold);outline-offset:4px}button{touch-action:manipulation}h1,h2,h3,p{margin:0}#grid-app{min-width:320px;max-width:2200px;margin:auto}.chrome{height:74px;border-bottom:1px solid #ffffff0b;display:flex;align-items:center;justify-content:space-between;padding:0 32px;gap:16px}.brand{display:flex;align-items:center;gap:13px;font-size:15px;letter-spacing:3px}.brand-mark{display:grid;grid-template-columns:5px 5px;gap:4px;transform:rotate(-8deg)}.brand-mark i{width:5px;height:5px;background:var(--gold);border-radius:1px;box-shadow:0 0 14px #dfb46540}.brand-divider{height:20px;width:1px;background:var(--stroke);margin:0 3px}.grid-name{font-size:13px;color:var(--muted);letter-spacing:0;overflow:hidden;text-overflow:ellipsis;max-width:330px;white-space:nowrap}.connection{display:flex;align-items:center;gap:8px;font-size:12px;white-space:nowrap}.status-dot,.footer-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 10px #78bb9830}.status-dot.pending{background:var(--gold)}.status-dot.offline{background:var(--red)}.mode{color:var(--muted);border-left:1px solid var(--stroke);padding-left:10px;margin-left:4px;text-transform:uppercase;font-size:10px;letter-spacing:1px}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 304px}.main-column{min-width:0}.view-toolbar{display:flex;align-items:center;justify-content:space-between;padding:22px 30px 4px;gap:16px}.segmented{display:flex;gap:4px;background:#11161c;padding:3px;border-radius:7px}.segmented button{background:transparent;border:0;border-radius:5px;padding:7px 13px;font-size:12px;color:var(--muted)}.segmented button[aria-pressed=true]{background:#222a33;color:#eef0f2;box-shadow:0 1px 3px #0005}.metric-select{display:flex;align-items:center;gap:9px;color:var(--muted);font-size:11px}.metric-select select{background:transparent;color:#c0c7cf;border:0;font-size:12px;max-width:155px;cursor:pointer}.metric-select option{background:var(--surface)}.topology{height:560px;position:relative;isolation:isolate;overflow:hidden;background:radial-gradient(ellipse at 52% 49%,#6d4c1712,transparent 48%),radial-gradient(ellipse at 97% 50%,#16395110,transparent 55%)}#connections{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.map-heading{position:absolute;left:32px;top:25px;display:flex;flex-direction:column;gap:8px;pointer-events:none}.eyebrow{font-size:10px;letter-spacing:1.7px;font-weight:500;color:#acb3bd}.map-subtitle{font-size:12px;color:#677382}.node-layer{position:absolute;inset:0;pointer-events:none}.node{position:absolute;transform:translate(-50%,-50%);min-width:140px;max-width:196px;text-align:left;padding:13px 14px 11px;background:linear-gradient(145deg,#191f26,#11161c);border:1px solid #343940;border-radius:10px;box-shadow:0 8px 24px #0003;pointer-events:auto;touch-action:none;user-select:none;transition:border-color .2s,box-shadow .2s,opacity .2s}.node:hover{border-color:#877046;box-shadow:0 8px 28px #0006,0 0 20px #ac7d1720}.node[aria-pressed=true]{border-color:var(--gold);box-shadow:0 0 30px #d8a34016}.node.offline{opacity:.55;border-style:dashed}.node.stale{border-style:dashed}.node-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.node-name{font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-dot{width:5px;height:5px;border-radius:50%;background:var(--green);flex-shrink:0;box-shadow:0 0 8px #78bb9840}.node.offline .node-dot{background:#74808b;box-shadow:none}.node.stale .node-dot{background:var(--gold)}.node-model{font-size:10px;color:#87929f;margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-reading{display:flex;align-items:baseline;gap:4px;margin-top:11px;font-size:17px;font-weight:400;letter-spacing:-.4px;color:var(--gold);font-variant-numeric:tabular-nums}.node-reading small{color:#818b97;font-size:10px;letter-spacing:0}.node-reading .unmeasured{font-size:11px;letter-spacing:0;color:#687685}.node-bar{height:2px;margin-top:9px;background:#ffffff08;border-radius:2px;overflow:hidden}.node-bar span{display:block;height:100%;background:var(--gold);opacity:.55}.node-hardware{position:absolute;left:50%;bottom:-22px;transform:translateX(-50%);color:#727e8b;font-size:10px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;pointer-events:none}.hub{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);border:1px solid #9c772e;background:linear-gradient(130deg,#282111,#161711);box-shadow:0 0 45px #c3932720,inset 0 0 24px #cb9c2110;border-radius:13px;width:126px;padding:14px 10px 13px;text-align:center;color:var(--gold);z-index:2}.hub-kicker{display:block;font-size:8px;letter-spacing:2px;color:#9f864f}.hub-name{display:block;font-size:22px;letter-spacing:-.8px;margin:6px 0}.hub-status{display:block;font-size:9px;letter-spacing:.4px;color:#a89c7e}.map-controls{position:absolute;bottom:18px;left:32px;right:28px;display:flex;justify-content:space-between;align-items:center;gap:16px;font-size:10px;color:#657181}.map-controls button{background:none;border:0;color:#98a2ae;font-size:11px;padding:7px 0}.map-empty{position:absolute;inset:80px 26px 50px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px;pointer-events:none}.empty-orbit{font-size:86px;font-weight:200;color:var(--gold);opacity:.7}.map-empty h1{font-size:26px;letter-spacing:-.7px;font-weight:400}.map-empty p{font-size:13px;color:var(--muted);line-height:1.7;max-width:370px}.fleet-totals{display:flex;justify-content:center;gap:clamp(22px,6vw,90px);padding:4px 25px 30px}.fleet-totals>div{display:flex;flex-direction:column;gap:7px}.total-label{font-size:9px;letter-spacing:1.6px;color:#84909f}.fleet-totals strong{font-size:32px;line-height:1.1;letter-spacing:-1px;font-weight:400;font-variant-numeric:tabular-nums}.fleet-totals>div>span:last-child{font-size:10px;color:#657181}.activity{padding:20px 30px 26px;border-top:1px solid #ffffff0b}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:15px}.section-heading h2{font-weight:500;font-size:12px}.section-heading>span{font-size:10px;color:#6d7a89}.activity-row{display:grid;grid-template-columns:7px minmax(0,1fr) auto;align-items:center;gap:11px;margin-top:13px;font-size:11px;color:#b6bec7}.activity-row .pip{width:5px;height:5px;border-radius:50%;background:#80704e}.activity-row.running .pip{background:var(--gold);box-shadow:0 0 10px #dfb46555}.activity-row.failed .pip{background:var(--red)}.activity-row .activity-time{font-size:10px;color:#627080}.activity-row .message{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.quiet{font-size:12px;line-height:1.65;color:#728090}.inspector{border-left:1px solid #ffffff0b;padding:28px 24px;background:#0b0f14;min-width:0}.inspector-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:20px}.inspector-head h2{font-size:23px;font-weight:400;letter-spacing:-.8px;overflow-wrap:anywhere;margin-top:8px}.inspector-head .close{background:none;border:0;color:var(--muted);font-size:22px;padding:0 1px}.subline{color:var(--muted);font-size:11px;line-height:1.7;overflow-wrap:anywhere;margin-top:8px}.detail-status{display:flex;align-items:center;gap:7px;margin:16px 0 22px;font-size:11px;color:#aeb7c1}.detail-section{padding-top:21px;margin-top:22px;border-top:1px solid #ffffff0d}.detail-section h3{font-weight:500;font-size:11px;color:#9aa5b3;margin-bottom:13px}.detail-metrics{display:grid;grid-template-columns:1fr 1fr;gap:24px 15px}.detail-metric{min-width:0}.detail-metric .label{font-size:10px;color:#8190a1;display:block;margin-bottom:7px}.detail-metric .value{font-size:23px;font-weight:400;letter-spacing:-.7px;font-variant-numeric:tabular-nums}.detail-metric .value small{font-size:11px;color:#929ca8;letter-spacing:0}.detail-metric .hint{display:block;color:#657385;font-size:10px;margin-top:5px;line-height:1.5}.memory-track{height:4px;border-radius:3px;background:#ffffff0a;overflow:hidden;margin:11px 0 9px}.memory-track span{display:block;height:100%;background:linear-gradient(90deg,#95702e,var(--gold));border-radius:3px}.memory-labels{display:flex;justify-content:space-between;gap:10px;font-size:10px;color:#7c8c9b}.model-entry{display:flex;align-items:center;gap:10px;padding:10px 0}.model-glyph{width:24px;height:24px;border-radius:6px;color:#c9aa70;background:#b2853213;display:grid;place-items:center;font-size:15px;flex-shrink:0}.model-entry .model-title{font-size:11px;line-height:1.55;overflow-wrap:anywhere;flex:1}.model-entry .model-caption{display:block;font-size:10px;color:#6e7d8d;margin-top:2px}.host-row{display:flex;align-items:center;gap:9px;margin:13px 0;font-size:11px;color:#b3bcc8}.host-row button{border:0;background:transparent;padding:0;text-align:left;flex:1}.host-row small{display:block;font-size:10px;color:#67798b;line-height:1.5;margin-top:3px}.host-row .host-dot{width:5px;height:5px;border-radius:50%;background:var(--green)}.host-row.offline .host-dot{background:var(--red)}.detail-pair{display:flex;justify-content:space-between;gap:12px;font-size:11px;line-height:1.7;padding:5px 0}.detail-pair span{color:#7e8b9a}.detail-pair strong{font-weight:400;text-align:right;overflow-wrap:anywhere;max-width:65%;font-variant-numeric:tabular-nums}.endpoint{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:#92a0af;overflow-wrap:anywhere;line-height:1.7}.source-error{padding:11px 12px;margin-top:12px;background:#bb86330c;border-left:2px solid #9c7137;color:#baac8e;font-size:11px;line-height:1.65}.ask-prompt{padding:14px;border:1px solid #dfb46524;border-radius:9px;margin-top:19px;background:#c59b4108}.ask-prompt p{font-size:12px;line-height:1.7;color:#c0b59e}.ask-prompt span{display:block;font-size:10px;color:#857651;margin-bottom:7px}.copy-prompt{background:transparent;color:var(--gold);border:0;padding:10px 0 0;font-size:11px}.spark{width:100%;height:73px;display:block}.spark-labels{display:flex;justify-content:space-between;font-size:9px;color:#627385;margin-top:5px}.spark-empty{height:73px;display:grid;place-items:center;font-size:10px;color:#657585;background:repeating-linear-gradient(0deg,transparent,transparent 23px,#ffffff04 24px)}.rack{padding:30px;display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px;min-height:500px;align-content:start}.rack-engine{background:linear-gradient(120deg,#141b22,#10151b);border:1px solid #2b3540;border-radius:9px;text-align:left;position:relative;padding:19px;min-width:0}.rack-engine[aria-pressed=true]{border-color:var(--gold)}.rack-engine.offline{opacity:.55}.rack-engine h3{font-size:14px;font-weight:500;overflow-wrap:anywhere}.rack-engine .rack-hardware{font-size:10px;color:var(--muted);margin-top:6px}.rack-engine .rack-models{font-size:11px;color:#a2adba;margin-top:16px;overflow-wrap:anywhere;line-height:1.5;min-height:30px}.rack-metrics{display:flex;flex-wrap:wrap;gap:18px;margin-top:18px}.rack-metrics>div{font-size:18px;letter-spacing:-.5px;font-variant-numeric:tabular-nums}.rack-metrics small{font-size:10px;letter-spacing:0;color:#7d8d9e}.rack-metrics label{display:block;font-size:9px;letter-spacing:0;color:#607387;margin-top:4px}.rack-strip{position:absolute;width:3px;left:0;top:20px;bottom:20px;background:#997b41;border-radius:2px}.footer{padding:16px 30px;border-top:1px solid #ffffff0b;display:flex;align-items:center;justify-content:space-between;gap:16px;font-size:10px;color:#677789}.footer>span:first-child{display:flex;align-items:center;gap:8px}.footer-dot{background:#806b42;width:4px;height:4px;box-shadow:none}.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);padding:12px 18px;border:1px solid #4e442b;background:#211c12;color:#dfc894;border-radius:9px;font-size:12px;z-index:10;max-width:90%;box-shadow:0 6px 32px #0008}
+/* The Grid pane's chrome. Light is the default palette; dark only redefines the tokens below it —
+ the same contract the app's other DSH viewers use (store/agents/excalidraw/viewer/app.css) — so
+ the page follows the appearance the app is in (or the system's, when the app has not said)
+ instead of always rendering dark. Every color in the rules below is one of these tokens;
+ nothing is hardcoded past this block. */
+:root {
+ color-scheme: light;
+ --bg: #ffffff;
+ --panel: #f9f9f8; /* menu surfaces, the view-toggle's track */
+ --card: #f3f3f2; /* small filled chips: the model glyph */
+ --overlay-hover: rgba(0, 0, 0, .05); /* a button or row under the pointer */
+ --overlay-selected: rgba(0, 0, 0, .08); /* the view toggle's current button, a menu row's current one */
+ --overlay-border: rgba(0, 0, 0, .10); /* menu borders, a hovered button's outline */
+ --line: rgba(0, 0, 0, .08); /* hairline dividers between blocks */
+ --ink: #1a1a18; /* primary text */
+ --ink-2: #5b5a54; /* secondary text — labels, values, most captions */
+ --ink-3: #8b8a83; /* the faintest text — eyebrows, footnotes */
+ --gold: #a3711c; /* the one accent: live readings, the hub, running work */
+ --green: #1f8a5f;
+ --red: #b8402f;
+ /* A NEUTRAL ring for "this is the one I picked" — kept apart from --gold, which means "this is
+ what the machine is doing" (a reading, an active pulse). The two used to share one color, so
+ picking a node also painted it as if it were the busy one, and the pick read as louder than a
+ click deserves. */
+ --selected-ring: rgba(0, 0, 0, .38);
+ --selected-glow: rgba(0, 0, 0, .10);
+ --shadow-card: 0 6px 16px rgba(0, 0, 0, .07);
+ --shadow-menu: 0 14px 34px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .06);
+ --scrim: rgba(0, 0, 0, .18);
+ --node-bg-1: #fdfdfc; --node-bg-2: #f4f3f1; --node-border: #e2e0db; --node-border-hover: #cbb27e;
+ --hub-border: #c9a355; --hub-bg-1: #fbf3e2; --hub-bg-2: #f5e9d1; --hub-glow: rgba(163, 113, 28, .10);
+ --rack-bg-1: #fdfdfc; --rack-bg-2: #f5f4f2; --rack-border: #e4e2dd;
+ --rack-strip: #c9a355;
+ --nebula-1: rgba(163, 113, 28, .05); --nebula-2: rgba(47, 91, 234, .04);
+ --notice-bg: rgba(163, 113, 28, .05); --notice-border: rgba(163, 113, 28, .22); --notice-ink: #6b4e17; --notice-label: #8a6420;
+ --toast-bg: #2a2016; --toast-border: #4e442b; --toast-ink: #f0dfb8;
+ font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+ font-size: 14px;
+ background: var(--bg);
+ color: var(--ink);
+}
+/* Dark: the system says so and the app has not said otherwise, OR the app says so. The app stamps
+ data-theme on the root (desktop/lib/widgets/web_pane_panel.dart) with its own light/dark choice,
+ which need not match the system's — without it the page followed macOS while the app around it
+ followed its own setting, and the two disagreed. */
+@media (prefers-color-scheme: dark) {
+ :root:not([data-theme="light"]) {
+ color-scheme: dark;
+ --bg: #080b0f;
+ --panel: #141a21;
+ --card: #161c23;
+ --overlay-hover: #ffffff0d;
+ --overlay-selected: #ffffff14;
+ --overlay-border: #ffffff10;
+ --line: #ffffff0b;
+ --ink: #e7e9ec;
+ --ink-2: #89929f;
+ --ink-3: #6d7a89;
+ --gold: #dfb465;
+ --green: #78bb98;
+ --red: #e98576;
+ --selected-ring: rgba(255, 255, 255, .40);
+ --selected-glow: rgba(255, 255, 255, .10);
+ --shadow-card: 0 8px 24px rgba(0, 0, 0, .35);
+ --shadow-menu: 0 10px 30px #0009, 0 2px 6px #0006;
+ --scrim: rgba(0, 0, 0, .5);
+ --node-bg-1: #191f26; --node-bg-2: #11161c; --node-border: #343940; --node-border-hover: #877046;
+ --hub-border: #9c772e; --hub-bg-1: #282111; --hub-bg-2: #161711; --hub-glow: rgba(185, 134, 36, .13);
+ --rack-bg-1: #141b22; --rack-bg-2: #10151b; --rack-border: #2b3540;
+ --rack-strip: #997b41;
+ --nebula-1: #6d4c1712; --nebula-2: #16395110;
+ --notice-bg: #c59b4108; --notice-border: #dfb46524; --notice-ink: #c0b59e; --notice-label: #857651;
+ --toast-bg: #211c12; --toast-border: #4e442b; --toast-ink: #dfc894;
+ }
+}
+:root[data-theme="dark"] {
+ color-scheme: dark;
+ --bg: #080b0f;
+ --panel: #141a21;
+ --card: #161c23;
+ --overlay-hover: #ffffff0d;
+ --overlay-selected: #ffffff14;
+ --overlay-border: #ffffff10;
+ --line: #ffffff0b;
+ --ink: #e7e9ec;
+ --ink-2: #89929f;
+ --ink-3: #6d7a89;
+ --gold: #dfb465;
+ --green: #78bb98;
+ --red: #e98576;
+ --selected-ring: rgba(255, 255, 255, .40);
+ --selected-glow: rgba(255, 255, 255, .10);
+ --shadow-card: 0 8px 24px rgba(0, 0, 0, .35);
+ --shadow-menu: 0 10px 30px #0009, 0 2px 6px #0006;
+ --scrim: rgba(0, 0, 0, .5);
+ --node-bg-1: #191f26; --node-bg-2: #11161c; --node-border: #343940; --node-border-hover: #877046;
+ --hub-border: #9c772e; --hub-bg-1: #282111; --hub-bg-2: #161711; --hub-glow: rgba(185, 134, 36, .13);
+ --rack-bg-1: #141b22; --rack-bg-2: #10151b; --rack-border: #2b3540;
+ --rack-strip: #997b41;
+ --nebula-1: #6d4c1712; --nebula-2: #16395110;
+ --notice-bg: #c59b4108; --notice-border: #dfb46524; --notice-ink: #c0b59e; --notice-label: #857651;
+ --toast-bg: #211c12; --toast-border: #4e442b; --toast-ink: #dfc894;
+}
+*{box-sizing:border-box}html,body{height:100%;margin:0;overflow:hidden}button,select{font:inherit}button{cursor:pointer;color:inherit}button:disabled{cursor:default;opacity:.5}[hidden]{display:none!important}button:focus-visible,select:focus-visible{outline:2px solid var(--gold);outline-offset:4px}button{touch-action:manipulation}h1,h2,h3,p{margin:0}
+#grid-app{min-width:320px;max-width:2200px;margin:auto;height:100%;display:flex;flex-direction:column;overflow:hidden}
+.status-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 10px var(--green)}
+.status-dot.pending{background:var(--gold)}
+.status-dot.offline{background:var(--red)}
+.workspace{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) 304px}
+.main-column{min-width:0;min-height:0;display:flex;flex-direction:column}
+.scrolls{overflow-y:auto;scrollbar-width:none}
+.scrolls::-webkit-scrollbar{display:none}
+.view-toolbar{display:flex;align-items:center;justify-content:space-between;padding:12px 26px 2px;gap:16px}
+.segmented{display:flex;gap:4px;background:var(--panel);padding:3px;border-radius:7px}
+.segmented button{background:transparent;border:0;border-radius:5px;padding:7px 13px;font-size:12px;color:var(--ink-2)}
+.segmented button[aria-pressed=true]{background:var(--overlay-selected);color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.08)}
+.toolbar-selects{display:flex;align-items:center;gap:10px}
+.menu{position:relative}
+.menu-button{display:flex;align-items:center;gap:7px;background:transparent;border:1px solid transparent;border-radius:6px;padding:5px 9px;font-size:12px;color:var(--ink-2);max-width:260px}
+.menu-button:hover,.menu-button[aria-expanded=true]{background:var(--overlay-hover);border-color:var(--overlay-border)}
+.menu-kicker{font-size:11px;color:var(--ink-2)}
+.menu-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:170px;color:var(--ink)}
+.menu-chevron{font-size:9px;color:var(--ink-2)}
+.menu-list{position:absolute;top:calc(100% + 6px);left:0;z-index:20;min-width:200px;max-width:min(420px,calc(100vw - 32px));padding:6px 0;background:var(--panel);border:1px solid var(--overlay-border);border-radius:8px;box-shadow:var(--shadow-menu);max-height:min(420px,60vh);overflow-y:auto;scrollbar-width:none}
+.menu-list::-webkit-scrollbar{display:none}
+.menu:last-child .menu-list{left:auto;right:0}
+.menu-heading{display:flex;align-items:center;gap:10px;padding:6px 14px 4px;font-size:10.5px;font-weight:600;letter-spacing:.3px;color:var(--ink-2);white-space:nowrap}
+.menu-heading small{font-weight:400;color:var(--ink-3);margin-left:-6px}
+.menu-row{display:flex;align-items:center;gap:12px;width:calc(100% - 12px);margin:0 6px;padding:5px 8px;border:0;border-radius:5px;background:transparent;text-align:left;font-size:12.5px;color:var(--ink)}
+.menu-row:hover{background:var(--overlay-hover)}
+.menu-row[aria-selected=true]{background:var(--overlay-selected)}
+.menu-row .row-title{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.menu-row .row-detail{font-size:11px;color:var(--ink-2);white-space:nowrap}
+.menu-empty{padding:5px 14px 6px;font-size:11px;color:var(--ink-3)}
+.topology{flex:1;min-height:0;position:relative;isolation:isolate;overflow:hidden;background:radial-gradient(ellipse at 52% 49%,var(--nebula-1),transparent 48%),radial-gradient(ellipse at 97% 50%,var(--nebula-2),transparent 55%)}
+#connections{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
+.map-heading{position:absolute;left:26px;top:14px;display:flex;flex-direction:column;gap:5px;pointer-events:none}
+.eyebrow{font-size:10px;letter-spacing:1.7px;font-weight:500;color:var(--ink-2)}
+.map-subtitle{font-size:12px;color:var(--ink-3)}
+.node-layer{position:absolute;inset:0;pointer-events:none}
+.node{position:absolute;transform:translate(-50%,-50%);min-width:132px;max-width:184px;text-align:left;padding:10px 12px 9px;background:linear-gradient(145deg,var(--node-bg-1),var(--node-bg-2));border:1px solid var(--node-border);border-radius:10px;box-shadow:var(--shadow-card);pointer-events:auto;touch-action:none;user-select:none;transition:border-color .2s,box-shadow .2s,opacity .2s}
+.node:hover{border-color:var(--node-border-hover)}
+.node[aria-pressed=true]{border-color:var(--selected-ring);box-shadow:0 0 0 3px var(--selected-glow)}
+.node.offline{opacity:.55;border-style:dashed}
+.node.stale{border-style:dashed}
+.node-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
+.node-name{font-size:12px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.node-dot{width:5px;height:5px;border-radius:50%;background:var(--green);flex-shrink:0;box-shadow:0 0 8px var(--green)}
+.node.offline .node-dot{background:var(--ink-3);box-shadow:none}
+.node.stale .node-dot{background:var(--gold)}
+.node-model{font-size:10px;color:var(--ink-2);margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
+.node-reading{display:flex;align-items:baseline;gap:4px;margin-top:7px;font-size:15px;font-weight:400;letter-spacing:-.4px;color:var(--gold);font-variant-numeric:tabular-nums}
+.node-reading small{color:var(--ink-2);font-size:10px;letter-spacing:0}
+.node-reading .unmeasured{font-size:11px;letter-spacing:0;color:var(--ink-3)}
+.node-bar{height:2px;margin-top:7px;background:var(--line);border-radius:2px;overflow:hidden}
+.node-bar span{display:block;height:100%;background:var(--gold);opacity:.55}
+.node-hardware{position:absolute;left:50%;bottom:-19px;transform:translateX(-50%);color:var(--ink-2);font-size:10px;white-space:nowrap;max-width:180px;overflow:hidden;text-overflow:ellipsis;pointer-events:none}
+.hub{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);border:1px solid var(--hub-border);background:linear-gradient(130deg,var(--hub-bg-1),var(--hub-bg-2));box-shadow:0 0 45px var(--hub-glow);border-radius:12px;width:112px;padding:11px 9px 10px;text-align:center;color:var(--gold);z-index:2}
+.hub-kicker{display:block;font-size:8px;letter-spacing:2px;color:var(--ink-2)}
+.hub-name{display:block;font-size:19px;letter-spacing:-.6px;margin:5px 0}
+.hub-status{display:block;font-size:9px;letter-spacing:.4px;color:var(--ink-2)}
+.map-controls{position:absolute;bottom:8px;left:26px;right:26px;display:flex;justify-content:space-between;align-items:center;gap:16px;font-size:10px;color:var(--ink-3)}
+.map-controls button{background:none;border:0;color:var(--ink-2);font-size:11px;padding:4px 0}
+.map-empty{position:absolute;inset:50px 26px 36px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:10px;pointer-events:none}
+.empty-orbit{font-size:64px;font-weight:200;color:var(--gold);opacity:.7}
+.map-empty h1{font-size:22px;letter-spacing:-.7px;font-weight:400}
+.map-empty p{font-size:13px;color:var(--ink-2);line-height:1.7;max-width:370px}
+.fleet-totals{display:flex;justify-content:center;gap:clamp(22px,6vw,90px);padding:6px 25px 10px}
+.fleet-totals>div{display:flex;flex-direction:column;gap:3px}
+.total-label{font-size:9px;letter-spacing:1.6px;color:var(--ink-3)}
+.fleet-totals strong{font-size:22px;line-height:1.1;letter-spacing:-1px;font-weight:400;font-variant-numeric:tabular-nums}
+.fleet-totals>div>span:last-child{font-size:10px;color:var(--ink-3)}
+.activity{padding:10px 26px 12px;border-top:1px solid var(--line)}
+.section-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:6px}
+.section-heading h2{font-weight:500;font-size:12px}
+.section-heading>span{font-size:10px;color:var(--ink-3)}
+.activity-row{display:grid;grid-template-columns:7px minmax(0,1fr) auto;align-items:center;gap:11px;margin-top:6px;font-size:11px;color:var(--ink-2)}
+.activity-row .pip{width:5px;height:5px;border-radius:50%;background:var(--ink-3)}
+.activity-row.running .pip{background:var(--gold);box-shadow:0 0 10px var(--gold)}
+.activity-row.failed .pip{background:var(--red)}
+.activity-row .activity-time{font-size:10px;color:var(--ink-3)}
+.activity-row .message{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+.quiet{font-size:12px;line-height:1.65;color:var(--ink-2)}
+.inspector{border-left:1px solid var(--line);padding:18px 20px;background:var(--panel);min-width:0;min-height:0}
+.inspector-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:20px}
+.inspector-head h2{font-size:23px;font-weight:400;letter-spacing:-.8px;overflow-wrap:anywhere;margin-top:8px}
+.inspector-head .close{background:none;border:0;color:var(--ink-2);font-size:22px;padding:0 1px}
+.subline{color:var(--ink-2);font-size:11px;line-height:1.7;overflow-wrap:anywhere;margin-top:8px}
+.detail-status{display:flex;align-items:center;gap:7px;margin:16px 0 22px;font-size:11px;color:var(--ink-2)}
+.detail-section{padding-top:21px;margin-top:22px;border-top:1px solid var(--line)}
+.detail-section h3{font-weight:500;font-size:11px;color:var(--ink-2);margin-bottom:13px}
+.detail-metrics{display:grid;grid-template-columns:1fr 1fr;gap:24px 15px}
+.detail-metric{min-width:0}
+.detail-metric .label{font-size:10px;color:var(--ink-2);display:block;margin-bottom:7px}
+.detail-metric .value{font-size:23px;font-weight:400;letter-spacing:-.7px;font-variant-numeric:tabular-nums}
+.detail-metric .value small{font-size:11px;color:var(--ink-2);letter-spacing:0}
+.detail-metric .hint{display:block;color:var(--ink-3);font-size:10px;margin-top:5px;line-height:1.5}
+.memory-track{height:4px;border-radius:3px;background:var(--line);overflow:hidden;margin:11px 0 9px}
+.memory-track span{display:block;height:100%;background:var(--gold);border-radius:3px}
+.memory-labels{display:flex;justify-content:space-between;gap:10px;font-size:10px;color:var(--ink-2)}
+.model-entry{display:flex;align-items:center;gap:10px;padding:10px 0}
+.model-glyph{width:24px;height:24px;border-radius:6px;color:var(--gold);background:var(--card);display:grid;place-items:center;font-size:15px;flex-shrink:0}
+.model-entry .model-title{font-size:11px;line-height:1.55;overflow-wrap:anywhere;flex:1}
+.model-entry .model-caption{display:block;font-size:10px;color:var(--ink-2);margin-top:2px}
+.host-row{display:flex;align-items:center;gap:9px;margin:13px 0;font-size:11px;color:var(--ink-2)}
+.host-row button{border:0;background:transparent;padding:0;text-align:left;flex:1}
+.host-row small{display:block;font-size:10px;color:var(--ink-3);line-height:1.5;margin-top:3px}
+.host-row .host-dot{width:5px;height:5px;border-radius:50%;background:var(--green)}
+.host-row.offline .host-dot{background:var(--red)}
+.detail-pair{display:flex;justify-content:space-between;gap:12px;font-size:11px;line-height:1.7;padding:5px 0}
+.detail-pair span{color:var(--ink-2)}
+.detail-pair strong{font-weight:400;text-align:right;overflow-wrap:anywhere;max-width:65%;font-variant-numeric:tabular-nums}
+.endpoint{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;color:var(--ink-2);overflow-wrap:anywhere;line-height:1.7}
+.source-error{padding:11px 12px;margin-top:12px;background:var(--notice-bg);border-left:2px solid var(--notice-border);color:var(--notice-ink);font-size:11px;line-height:1.65}
+.ask-prompt{padding:14px;border:1px solid var(--notice-border);border-radius:9px;margin-top:19px;background:var(--notice-bg)}
+.ask-prompt p{font-size:12px;line-height:1.7;color:var(--notice-ink)}
+.ask-prompt span{display:block;font-size:10px;color:var(--notice-label);margin-bottom:7px}
+.copy-prompt{background:transparent;color:var(--gold);border:0;padding:10px 0 0;font-size:11px}
+.spark{width:100%;height:73px;display:block}
+.spark-labels{display:flex;justify-content:space-between;font-size:9px;color:var(--ink-3);margin-top:5px}
+.spark-empty{height:73px;display:grid;place-items:center;font-size:10px;color:var(--ink-3);background:repeating-linear-gradient(0deg,transparent,transparent 23px,var(--line) 24px)}
+.rack{flex:1;min-height:0;padding:14px 26px;display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;align-content:start}
+.rack-engine{background:linear-gradient(120deg,var(--rack-bg-1),var(--rack-bg-2));border:1px solid var(--rack-border);border-radius:9px;text-align:left;position:relative;padding:19px;min-width:0}
+.rack-engine[aria-pressed=true]{border-color:var(--selected-ring);box-shadow:0 0 0 3px var(--selected-glow)}
+.rack-engine.offline{opacity:.55}
+.rack-engine h3{font-size:14px;font-weight:500;overflow-wrap:anywhere}
+.rack-engine .rack-hardware{font-size:10px;color:var(--ink-2);margin-top:6px}
+.rack-engine .rack-models{font-size:11px;color:var(--ink-2);margin-top:16px;overflow-wrap:anywhere;line-height:1.5;min-height:30px}
+.rack-metrics{display:flex;flex-wrap:wrap;gap:18px;margin-top:18px}
+.rack-metrics>div{font-size:18px;letter-spacing:-.5px;font-variant-numeric:tabular-nums}
+.rack-metrics small{font-size:10px;letter-spacing:0;color:var(--ink-2)}
+.rack-metrics label{display:block;font-size:9px;letter-spacing:0;color:var(--ink-3);margin-top:4px}
+.rack-strip{position:absolute;width:3px;left:0;top:20px;bottom:20px;background:var(--rack-strip);border-radius:2px}
+.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);padding:12px 18px;border:1px solid var(--toast-border);background:var(--toast-bg);color:var(--toast-ink);border-radius:9px;font-size:12px;z-index:10;max-width:90%;box-shadow:var(--shadow-menu)}
.gpu-detail+.gpu-detail{margin-top:18px}
@media(min-width:1051px){.topology[data-density=spacious] .node{min-width:210px;max-width:250px}}
-@media(min-width:1500px){.workspace{grid-template-columns:minmax(0,1fr) 340px}.topology{height:660px}.inspector{padding:32px}.node{min-width:166px;padding:16px}.node-name{font-size:14px}.node-model{font-size:11px}}
-@media(max-width:1050px){.workspace{grid-template-columns:minmax(0,1fr) 270px}.inspector{padding:24px 19px}.topology{height:600px}.node{min-width:126px;max-width:158px;padding:11px}.node-hardware{max-width:140px}.view-toolbar{padding-left:23px;padding-right:23px}.map-heading{left:23px}.map-controls{left:23px;right:23px}.fleet-totals{gap:30px}.total-label{letter-spacing:1px}.fleet-totals strong{font-size:28px}}
-@media(max-width:820px){.workspace{display:block}.inspector{border-left:0;border-top:1px solid #ffffff0b;padding:25px 28px}.inspector .detail-metrics{grid-template-columns:repeat(4,1fr)}.topology{height:560px}.inspector-head{margin-bottom:12px}.inspector .detail-section{margin-top:19px;padding-top:19px}.chrome{padding:0 24px}.node{min-width:134px}.spark{height:90px}}
-@media(max-width:540px){.chrome{height:auto;min-height:70px;padding:18px;flex-wrap:wrap;gap:12px}.brand{font-size:13px;gap:10px}.brand-divider{margin:0}.grid-name{max-width:150px}.connection{font-size:10px}.view-toolbar{padding:19px 16px 0;gap:8px}.metric-select{font-size:0;gap:0}.metric-select select{font-size:11px;max-width:126px}.segmented button{padding:7px 10px;font-size:11px}.map-heading{left:18px;top:23px}.map-subtitle{font-size:10px}.eyebrow{font-size:9px}.topology{height:665px}.node{min-width:111px;max-width:142px;padding:10px;border-radius:8px}.node-name{font-size:11px}.node-model{font-size:9px}.node-reading{font-size:16px;margin-top:8px}.node-reading small,.node-hardware{font-size:9px}.node-hardware{max-width:127px;bottom:-18px}.hub{width:110px;padding:11px 5px}.hub-name{font-size:20px}.hub-kicker{font-size:7px}.map-controls{left:18px;right:18px;font-size:9px;gap:8px}.map-controls button{font-size:10px}.fleet-totals{gap:20px;padding:8px 18px 25px;justify-content:space-between}.total-label{font-size:8px;letter-spacing:.7px}.fleet-totals strong{font-size:27px}.fleet-totals>div>span:last-child{font-size:9px;max-width:94px;line-height:1.5}.activity{padding:20px 18px}.inspector{padding:24px 20px}.inspector .detail-metrics{grid-template-columns:repeat(2,1fr)}.rack{padding:25px 18px}.footer{padding:16px 18px;font-size:9px;align-items:flex-start}.footer>span{max-width:50%;line-height:1.6}}
+@media(min-width:1500px){.workspace{grid-template-columns:minmax(0,1fr) 340px}.inspector{padding:24px 28px}.node{min-width:166px;padding:16px}.node-name{font-size:14px}.node-model{font-size:11px}}
+@media(max-width:1050px){.workspace{grid-template-columns:minmax(0,1fr) 270px}.inspector{padding:16px 18px}.node{min-width:126px;max-width:158px;padding:10px}.node-hardware{max-width:140px}.view-toolbar{padding-left:23px;padding-right:23px}.map-heading{left:23px}.map-controls{left:23px;right:23px}.fleet-totals{gap:30px}.total-label{letter-spacing:1px}.fleet-totals strong{font-size:20px}}
+@media(max-width:820px){.workspace{position:relative;grid-template-columns:minmax(0,1fr)}.inspector{position:absolute;top:0;right:0;bottom:0;width:min(300px,92%);padding:18px 20px;box-shadow:-12px 0 32px var(--scrim);display:none}.inspector.open{display:block}.inspector-head{margin-bottom:12px}.inspector .detail-section{margin-top:19px;padding-top:19px}.node{min-width:134px}}
+@media(max-width:540px){.view-toolbar{padding:10px 16px 0;gap:8px}.menu-button{gap:5px;padding:5px 7px}.menu-value{max-width:96px}.segmented button{padding:7px 10px;font-size:11px}.map-heading{left:18px;top:23px}.map-subtitle{font-size:10px}.eyebrow{font-size:9px}.node{min-width:111px;max-width:142px;padding:10px;border-radius:8px}.node-name{font-size:11px}.node-model{font-size:9px}.node-reading{font-size:16px;margin-top:8px}.node-reading small,.node-hardware{font-size:9px}.node-hardware{max-width:127px;bottom:-18px}.hub{width:110px;padding:11px 5px}.hub-name{font-size:20px}.hub-kicker{font-size:7px}.map-controls{left:18px;right:18px;font-size:9px;gap:8px}.map-controls button{font-size:10px}.fleet-totals{gap:20px;padding:6px 18px 8px;justify-content:space-between}.total-label{font-size:8px;letter-spacing:.7px}.fleet-totals strong{font-size:20px}.fleet-totals>div>span:last-child{font-size:9px;max-width:94px;line-height:1.5}.activity{padding:10px 18px}.rack{padding:12px 18px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
diff --git a/store/agents/autonomous-grid/viewer/app.js b/store/agents/autonomous-grid/viewer/app.js
index 11dcaf05c..71c4c33e4 100644
--- a/store/agents/autonomous-grid/viewer/app.js
+++ b/store/agents/autonomous-grid/viewer/app.js
@@ -23,10 +23,12 @@
const late = lastReceived && Date.now() - lastReceived > Math.max(30_000, (snapshot.pollIntervalMs || 8000)*3);
const state = transportLost || late ? 'disconnected' : snapshot.status;
const labels={live:'Grid connected',partial:'Partial telemetry',unavailable:'Grid unavailable',unconfigured:'Choose a grid',connecting:'Connecting',disconnected:'Connection lost'};
- $('connection-label').textContent=labels[state] || 'Waiting for Grid';
- $('connection-dot').className='status-dot'+(['unavailable','disconnected'].includes(state)?' offline':state==='live'?'':' pending');
- $('observed').textContent=snapshot.observedAt?`Observed ${age(snapshot.observedAt)}`:'Waiting for Grid';
- $('footer-status').textContent=['unavailable','disconnected'].includes(state)?'Last observations remain visible. Ask Grid to reconnect.':'Talk to Grid in the agent pane.';
+ // The connection state rides on the grid dropdown's title: the header that carried a dot and a
+ // label is gone, and the dropdown is where the grid is named now.
+ $('grid-select').title=labels[state] || 'Waiting for Grid';
+ // The footer that used to say "ask Grid to reconnect" is gone (it cost a row of height for a
+ // sentence nobody needed while things worked); the activity heading says it when it matters.
+ $('observed').textContent=['unavailable','disconnected'].includes(state)?`${labels[state]} · ask Grid to reconnect`:snapshot.observedAt?`Observed ${age(snapshot.observedAt)}`:'Waiting for Grid';
}
function consume(data) {
if (!data || data.spec!==1 || !Array.isArray(data.nodes)) return;
@@ -39,8 +41,7 @@
}
function render() {
if (!snapshot) return;
- $('grid-name').textContent=snapshot.grid;
- $('mode').textContent=snapshot.mode || '';
+ renderGridSelect();
const available=!['connecting','unavailable','unconfigured'].includes(snapshot.status);
$('total-engines').textContent=available?fmt(snapshot.summary.enginesOnline,0):'—';
$('total-known').textContent=snapshot.nodes.length?`${snapshot.nodes.length} known to this grid`:'waiting for engines';
@@ -98,6 +99,8 @@
if(!snapshot)return;
const node=snapshot.nodes.find(n=>n.id===selected), machine=snapshot.machines?.find(m=>'machine:'+m.id===selected);
const panel=$('inspector');
+ // In a narrow pane the inspector is a drawer over the map (CSS), open while something is chosen.
+ panel.classList.toggle('open',Boolean(node||machine));
if(machine){
panel.innerHTML=`<div class="inspector-head"><div><span class="eyebrow">MANAGED MACHINE</span><h2>${escape(machine.name)}</h2><p class="subline">${escape(machine.hardware || machine.error || '')}</p></div><button class="close" type="button" data-close aria-label="Close machine details">×</button></div><div class="detail-status"><span class="status-dot${machine.reachable?'':' offline'}"></span>${machine.reachable?'Reachable':'Unreachable'} · ${escape(machine.transport)}</div><div class="detail-metrics">${detailMetric('System memory',machine.memoryTotalGb,'GB')}${detailMetric('Grid RAM estimate',machine.memoryAvailableGb,'GB','Inventory, not live usage')}${detailMetric('Grid model budget',machine.usableModelGb,'GB')}${detailMetric('Free disk',machine.diskFreeGb,'GB')}</div><div class="detail-section">${pair('Platform',machine.platform || '—')}${pair('Backend',machine.backend || '—')}${pair('CPU cores',fmt(machine.cpuCores,0))}${pair('Observed',age(machine.observedAt))}</div><div class="detail-section"><h3>Graphics</h3>${machine.gpus?.map(gpuDetails).join('')||'<p class="quiet">No GPU reported. CPU models can still be useful.</p>'}</div>${prompt(`Find an open-weight model that fits ${machine.name}, keeping enough memory free for my other work. Explain the tradeoff before deploying it.`)}`;
return;
@@ -126,25 +129,31 @@
}
function resize() {
if(view==='rack')return;
- width=stage.clientWidth||800;
- const small=width<620;
- const expanded=small?230+Math.ceil(graphNodes.length/2)*144:graphNodes.length>8?Math.max(680,200+Math.ceil(graphNodes.length/4)*150):560;
- stage.style.height=Math.max(width<540?600:560,expanded)+'px';height=stage.clientHeight;
+ // The map takes whatever height the pane leaves it (CSS: the main column is a flex column and
+ // the map is its stretching row) — never a height of its own. A fixed 560px map on a pane
+ // shorter than that pushed the totals, activity and footer below the fold, and the page grew a
+ // scrollbar for a screen whose whole point is to be taken in at a glance. Nodes are laid out
+ // within the height there is (see position()).
+ width=stage.clientWidth||800;height=stage.clientHeight||420;
const dpr=Math.min(window.devicePixelRatio||1,2);canvas.width=Math.round(width*dpr);canvas.height=Math.round(height*dpr);ctx?.setTransform(dpr,0,0,dpr,0,0);
position();draw();
}
function position() {
const small=width<620,count=graphNodes.length;
- hub={x:width*.5,y:small?150:height*.49};
+ hub={x:width*.5,y:height*.49};
$('hub').style.left=hub.x+'px';$('hub').style.top=hub.y+'px';
const anchors=[[.14,.31],[.36,.18],[.15,.63],[.36,.83],[.69,.17],[.85,.40],[.85,.73],[.64,.88]];
const smallFleet={1:[[.22,.49]],2:[[.22,.35],[.78,.65]],3:[[.20,.34],[.80,.34],[.50,.85]],4:[[.20,.32],[.80,.32],[.20,.76],[.80,.76]]};
+ // Two columns, spread over the height there is: a narrow pane, or more nodes than the
+ // eight anchors. Rows are shared out between the top and bottom margins rather than stacked
+ // at a fixed pitch, so the map never needs more height than it has.
+ const column=(k,rows,fraction)=>({x:width*fraction,y:rows<=1?height*.5:105+k*(height-200)/(rows-1)});
graphNodes.forEach((n,i)=>{
const b=nodeButtons.get(n.id);if(!b)return;
let base;
- if(small)base={x:width*(i%2===0?.25:.75),y:275+Math.floor(i/2)*144};
+ if(small)base=column(Math.floor(i/2),Math.ceil(count/2),i%2===0?.25:.75);
else if(count<=8){const a=(smallFleet[count]||anchors)[i];base={x:width*a[0],y:height*a[1]};}
- else {const half=Math.ceil(count/2),left=i<half;const k=left?i:i-half;base={x:width*(left?.18:.82),y:115+k*(height-190)/(half-1)};}
+ else {const half=Math.ceil(count/2),left=i<half;base=column(left?i:i-half,half,left?.18:.82);}
const stored=drags[n.id];if(stored&&finite(stored.x)&&finite(stored.y))base={x:stored.x*width,y:stored.y*height};
const inset=(b.offsetWidth||140)/2+12;
const x=Math.max(inset,Math.min(width-inset,base.x+(dragging?.id===n.id?0:Math.sin(t*.20+i*.78)*3)));
@@ -152,20 +161,46 @@
positions.set(n.id,{x,y});b.style.left=x+'px';b.style.top=y+'px';
});
}
+ // The map is a <canvas>: none of its color is CSS, so it does not follow the stylesheet's own
+ // light/dark tokens. This is its own small palette, one for each system appearance, read fresh
+ // every frame (matchMedia is cheap) so a live appearance change repaints it at once rather than
+ // needing a reopen. "Chosen" (the node someone picked) is drawn in a NEUTRAL tone, apart from the
+ // warm accent that means "this one is online, working" — a click used to paint its line and
+ // pulses gold too, the same color as "busy", which made picking a node look like it had also
+ // started something on it.
+ const darkQuery=matchMedia('(prefers-color-scheme: dark)');
+ // The app's own choice (data-theme on the root, stamped by the pane that hosts this page) wins
+ // over the system's, exactly as the stylesheet resolves it — so the map and the chrome around
+ // it never disagree.
+ const isDark=()=>{const stamp=document.documentElement.dataset.theme;return stamp==='dark'||(stamp!=='light'&&darkQuery.matches);};
+ function canvasPalette(){
+ return isDark()?{
+ hub0:'rgba(185,134,36,.13)',hub1:'rgba(170,117,27,0)',star:'rgba(171,159,130,',starStrong:.16,starFaint:.06,
+ linkChosen:'rgba(226,228,232,.60)',linkOnline:'rgba(173,140,74,.31)',linkOffline:'rgba(115,126,141,.17)',
+ pulseStroke:'rgba(232,183,78,.27)',dotChosen:'#e7e9ec',dot:'#c4a25e',glowChosen:'#d7dade',glow:'#d5ab52',
+ ring0:'rgba(211,165,72,.63)',ring1:'rgba(190,146,55,.12)',ring2:'rgba(190,146,55,.05)',
+ }:{
+ hub0:'rgba(163,113,28,.10)',hub1:'rgba(163,113,28,0)',star:'rgba(120,104,68,',starStrong:.11,starFaint:.045,
+ linkChosen:'rgba(58,57,53,.55)',linkOnline:'rgba(163,113,28,.26)',linkOffline:'rgba(150,150,146,.28)',
+ pulseStroke:'rgba(163,113,28,.30)',dotChosen:'#3a3935',dot:'#a3711c',glowChosen:'#3a3935',glow:'#a3711c',
+ ring0:'rgba(163,113,28,.55)',ring1:'rgba(163,113,28,.14)',ring2:'rgba(163,113,28,.07)',
+ };
+ }
function draw() {
if(!ctx||view!=='topology')return;
ctx.clearRect(0,0,width,height);
if(!graphNodes.length)return;
- const glow=ctx.createRadialGradient(hub.x,hub.y,10,hub.x,hub.y,180);glow.addColorStop(0,'rgba(185,134,36,.13)');glow.addColorStop(1,'rgba(170,117,27,0)');ctx.fillStyle=glow;ctx.fillRect(0,0,width,height);
- for(let i=0;i<70;i++){ctx.fillStyle=`rgba(171,159,130,${i%6===0?.16:.06})`;ctx.beginPath();ctx.arc(((i*173.87+42)%991)/991*width,((i*131.2+31)%587)/587*height,i%5===0?1:.55,0,Math.PI*2);ctx.fill();}
+ const P=canvasPalette();
+ const glow=ctx.createRadialGradient(hub.x,hub.y,10,hub.x,hub.y,180);glow.addColorStop(0,P.hub0);glow.addColorStop(1,P.hub1);ctx.fillStyle=glow;ctx.fillRect(0,0,width,height);
+ for(let i=0;i<70;i++){ctx.fillStyle=`${P.star}${i%6===0?P.starStrong:P.starFaint})`;ctx.beginPath();ctx.arc(((i*173.87+42)%991)/991*width,((i*131.2+31)%587)/587*height,i%5===0?1:.55,0,Math.PI*2);ctx.fill();}
for(let i=0;i<graphNodes.length;i++){
const node=graphNodes[i],p=positions.get(node.id);if(!p)continue;
const online=node.online===true&&!node.stale&&!transportLost&&Date.now()-lastReceived<30000,active=finite(node.activeRequests)?node.activeRequests:0,chosen=selected===node.id;
- ctx.beginPath();ctx.strokeStyle=chosen?'rgba(237,188,85,.70)':online?'rgba(173,140,74,.31)':'rgba(115,126,141,.17)';ctx.lineWidth=chosen?1.35:.75;ctx.setLineDash(online?[]:[3,7]);ctx.moveTo(hub.x,hub.y);ctx.lineTo(p.x,p.y);ctx.stroke();ctx.setLineDash([]);
+ ctx.beginPath();ctx.strokeStyle=chosen?P.linkChosen:online?P.linkOnline:P.linkOffline;ctx.lineWidth=chosen?1.35:.75;ctx.setLineDash(online?[]:[3,7]);ctx.moveTo(hub.x,hub.y);ctx.lineTo(p.x,p.y);ctx.stroke();ctx.setLineDash([]);
// Connection pulses express online membership. Only measured active requests add extra pulses.
- if(online){const pulses=1+Math.min(3,active);for(let j=0;j<pulses;j++){const progress=(t*(.045+Math.min(active,4)*.008)+i*.137+j/pulses)%1;const x=hub.x+(p.x-hub.x)*progress,y=hub.y+(p.y-hub.y)*progress;ctx.beginPath();ctx.strokeStyle='rgba(232,183,78,.27)';ctx.moveTo(x-(p.x-hub.x)*.026,y-(p.y-hub.y)*.026);ctx.lineTo(x,y);ctx.stroke();ctx.fillStyle=chosen?'#f4d795':'#c4a25e';ctx.shadowColor='#d5ab52';ctx.shadowBlur=6;ctx.beginPath();ctx.arc(x,y,chosen?1.8:1.25,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;}}
+ if(online){const pulses=1+Math.min(3,active);for(let j=0;j<pulses;j++){const progress=(t*(.045+Math.min(active,4)*.008)+i*.137+j/pulses)%1;const x=hub.x+(p.x-hub.x)*progress,y=hub.y+(p.y-hub.y)*progress;ctx.beginPath();ctx.strokeStyle=P.pulseStroke;ctx.moveTo(x-(p.x-hub.x)*.026,y-(p.y-hub.y)*.026);ctx.lineTo(x,y);ctx.stroke();ctx.fillStyle=chosen?P.dotChosen:P.dot;ctx.shadowColor=chosen?P.glowChosen:P.glow;ctx.shadowBlur=6;ctx.beginPath();ctx.arc(x,y,chosen?1.8:1.25,0,Math.PI*2);ctx.fill();ctx.shadowBlur=0;}}
}
- for(let ring=0;ring<3;ring++){ctx.beginPath();ctx.strokeStyle=ring===0?'rgba(211,165,72,.63)':`rgba(190,146,55,${ring===1?.12:.05})`;ctx.lineWidth=ring===0?1.7:1;const angle=t*.075*(ring%2?-1:1);ctx.arc(hub.x,hub.y,88+ring*13,angle,angle+Math.PI*(ring===0?1.85:1.4));ctx.stroke();}
+ for(let ring=0;ring<3;ring++){ctx.beginPath();ctx.strokeStyle=ring===0?P.ring0:ring===1?P.ring1:P.ring2;ctx.lineWidth=ring===0?1.7:1;const angle=t*.075*(ring%2?-1:1);ctx.arc(hub.x,hub.y,88+ring*13,angle,angle+Math.PI*(ring===0?1.85:1.4));ctx.stroke();}
}
function frame(time) {
if(!paused&&!document.hidden&&view==='topology') {t+=Math.min((time-previousFrame)/1000,.08)||0;position();draw();}
@@ -174,7 +209,66 @@
function setView(value) {view=value;$('topology').hidden=value!=='topology';$('rack').hidden=value!=='rack';$('topology-button').setAttribute('aria-pressed',String(value==='topology'));$('rack-button').setAttribute('aria-pressed',String(value==='rack'));resize();}
$('topology-button').addEventListener('click',()=>setView('topology'));
$('rack-button').addEventListener('click',()=>setView('rack'));
- $('metric').addEventListener('change',event=>{metric=event.target.value;render();});
+ // The two pickers are menus of this page's own, drawn the way the app's pane menu is
+ // (desktop/lib/widgets/pane_menu.dart): a heading over a rule, then rows, the current one on
+ // a soft fill. A native <select> opened the platform's list, which looked like nothing else in
+ // the app. One menu is open at a time; a click anywhere else, or Escape, closes it.
+ const menus=[];
+ function menu(buttonId,listId,valueId,{heading,items,current,pick}){
+ const button=$(buttonId),list=$(listId),value=$(valueId);
+ const close=()=>{list.hidden=true;button.setAttribute('aria-expanded','false');};
+ const open=()=>{
+ menus.forEach(m=>m.close());
+ const rows=items(),now=current();
+ list.innerHTML=(heading?`<div class="menu-heading">${escape(heading.label)}${heading.caption?`<small>· ${escape(heading.caption)}</small>`:''}</div>`:'')+
+ (rows.length?rows.map(row=>`<button type="button" class="menu-row" role="option" data-value="${escape(row.value)}" aria-selected="${row.value===now}"><span class="row-title">${escape(row.label)}</span>${row.detail?`<span class="row-detail">${escape(row.detail)}</span>`:''}</button>`).join(''):'<div class="menu-empty">Nothing to choose yet.</div>');
+ list.hidden=false;button.setAttribute('aria-expanded','true');
+ };
+ button.addEventListener('click',event=>{event.stopPropagation();if(list.hidden)open();else close();});
+ list.addEventListener('click',event=>{
+ event.stopPropagation();const row=event.target.closest('[data-value]');if(!row)return;
+ close();if(row.dataset.value!==current())pick(row.dataset.value);
+ });
+ const draw=()=>{const now=current(),row=items().find(r=>r.value===now);value.textContent=row?row.label:(now||'Choose your grid');};
+ menus.push({close,draw});draw();
+ return {draw};
+ }
+ document.addEventListener('click',()=>menus.forEach(m=>m.close()));
+ document.addEventListener('keydown',event=>{if(event.key==='Escape')menus.forEach(m=>m.close());});
+ const metricLabels={tokS:'Decode speed',temperatureC:'Temperature',utilizationPct:'GPU load',memoryUsedGb:'Memory used',powerW:'Power'};
+ menu('metric','metric-list','metric-value',{
+ heading:{label:'Show on each machine'},
+ items:()=>Object.entries(metricLabels).map(([value,label])=>({value,label,detail:metricInfo[value][1]})),
+ current:()=>metric,
+ pick:value=>{metric=value;render();},
+ });
+ let selecting=false;
+ function gridChoices(){
+ const current=currentGrid();
+ const grids=(snapshot?.grids||[]).map(g=>({value:g.name,label:g.name,detail:g.type==='permissioned-public'?'private':g.type==='domain-restricted'?'domain':''}));
+ if(current&&!grids.some(g=>g.value===current))grids.unshift({value:current,label:current,detail:''});
+ return grids;
+ }
+ function currentGrid(){return snapshot?.grid&&!['Your grid','Choose your grid'].includes(snapshot.grid)?snapshot.grid:'';}
+ const gridMenu=menu('grid-select','grid-list','grid-value',{
+ heading:{label:'Grid'},
+ items:gridChoices,
+ current:currentGrid,
+ pick:async grid=>{
+ // The button's own label changes on the click, not on the network round trip: the server
+ // now answers as soon as the switch itself is done (not after a full telemetry refresh),
+ // but even that round trip is a moment a person can feel. Saying it here, first, is what
+ // makes the pick feel instant; render() below corrects it back if the switch failed.
+ selecting=true;$('grid-select').disabled=true;$('grid-value').textContent=grid;
+ toast(`Looking at ${grid}`);
+ try{
+ const r=await fetch('api/select',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({grid}),signal:AbortSignal.timeout(30_000)});
+ if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.error||'Could not switch grid');}
+ }catch(err){toast(err.message||'Could not switch grid');}
+ finally{selecting=false;$('grid-select').disabled=false;render();}
+ },
+ });
+ function renderGridSelect(){if(!selecting)gridMenu.draw();}
$('motion').addEventListener('click',()=>{paused=!paused;$('motion').textContent=paused?'Resume motion':'Pause motion';$('motion').setAttribute('aria-pressed',String(paused));});
$('motion').textContent=paused?'Resume motion':'Pause motion';$('motion').setAttribute('aria-pressed',String(paused));
$('hub').addEventListener('click',()=>{selected=null;render();});
diff --git a/store/agents/autonomous-grid/viewer/index.html b/store/agents/autonomous-grid/viewer/index.html
index 844f456b4..e4e1aee75 100644
--- a/store/agents/autonomous-grid/viewer/index.html
+++ b/store/agents/autonomous-grid/viewer/index.html
@@ -10,15 +10,11 @@
</head>
<body>
<main id="grid-app">
- <header class="chrome">
- <div class="brand"><span class="brand-mark" aria-hidden="true"><i></i><i></i><i></i><i></i></span><span>GRID</span><span class="brand-divider"></span><span class="grid-name" id="grid-name">Your grid</span></div>
- <div class="connection"><span id="connection-dot" class="status-dot pending"></span><span id="connection-label">Connecting</span><span id="mode" class="mode"></span></div>
- </header>
<section class="workspace">
<div class="main-column">
<div class="view-toolbar">
<div class="segmented" aria-label="Fleet view"><button id="topology-button" type="button" aria-pressed="true">Topology</button><button id="rack-button" type="button" aria-pressed="false">Rack</button></div>
- <label class="metric-select">Show <select id="metric"><option value="tokS">Decode speed</option><option value="temperatureC">Temperature</option><option value="utilizationPct">GPU load</option><option value="memoryUsedGb">Memory used</option><option value="powerW">Power</option></select></label>
+ <div class="toolbar-selects"><div class="menu"><button type="button" class="menu-button" id="grid-select" aria-haspopup="listbox" aria-expanded="false"><span class="menu-kicker">Grid</span><span class="menu-value" id="grid-value">Choose your grid</span><span class="menu-chevron" aria-hidden="true">▾</span></button><div class="menu-list" id="grid-list" role="listbox" aria-label="Grid" hidden></div></div><div class="menu"><button type="button" class="menu-button" id="metric" aria-haspopup="listbox" aria-expanded="false"><span class="menu-kicker">Show</span><span class="menu-value" id="metric-value">Decode speed</span><span class="menu-chevron" aria-hidden="true">▾</span></button><div class="menu-list" id="metric-list" role="listbox" aria-label="Show" hidden></div></div></div>
</div>
<div class="topology" id="topology">
<canvas id="connections" aria-hidden="true"></canvas>
@@ -28,7 +24,7 @@
<div class="map-empty" id="map-empty" hidden><span class="empty-orbit" aria-hidden="true">◎</span><h1>Your fleet starts here.</h1><p id="empty-message">Ask the Grid agent to discover this machine and connect your first model.</p></div>
<div class="map-controls"><span id="map-legend">Links show Grid membership</span><button type="button" id="motion" aria-pressed="false">Pause motion</button></div>
</div>
- <section class="rack" id="rack" aria-label="Engine rack" hidden></section>
+ <section class="rack scrolls" id="rack" aria-label="Engine rack" hidden></section>
<div class="fleet-totals">
<div><span class="total-label">ENGINES ONLINE</span><strong id="total-engines">—</strong><span id="total-known"></span></div>
<div><span class="total-label">MODELS SERVING</span><strong id="total-models">—</strong><span>across your grid</span></div>
@@ -36,9 +32,8 @@
</div>
<section class="activity"><div class="section-heading"><h2>Activity</h2><span id="observed">Waiting for Grid</span></div><div id="activity-list" aria-live="polite"><div class="quiet">Listening for your fleet.</div></div></section>
</div>
- <aside class="inspector" id="inspector" aria-label="Fleet details"></aside>
+ <aside class="inspector scrolls" id="inspector" aria-label="Fleet details"></aside>
</section>
- <footer class="footer"><span><span class="footer-dot"></span> Your machines. Your models.</span><span id="footer-status">Talk to Grid in the agent pane.</span></footer>
<div class="toast" id="toast" role="status" hidden></div>
</main>
</body>