The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge origin/feat/harness-grid into feat/harness-grid
Tim380012952347
diff --cc cli/src/backendSocket.tsindex 05b26133e,a2de22e35..fca197333--- a/cli/src/backendSocket.ts+++ b/cli/src/backendSocket.ts@@@ -27,9 -27,9 +27,10 @@@ import { registry, projectDisplayName,import { ENGINES, type AgentEngine } from './engines/types.js'import { listDir } from './lib/fsBrowse.js'import { linkCodexProfile, listCodexProfiles } from './lib/codexProfiles.js'+ import { gridCliPresence } from './lib/gridExec.js'import { gridCapableEngines, parseGridLaunchOverride, type GridLaunchOverride } from './lib/gridLaunch.js'import { listGridModels, resolveGridTarget } from './lib/gridModels.js'+import { deriveHarnessGridName } from './lib/gridDerive.js'import { AGENT_NAME_RE, FirstPromptUnsupportedError, MAX_FIRST_PROMPT_CHARS, NamedAgentUnsupportedError, supportsFirstPrompt, supportsNamedAgent } from './lib/engineLaunch.js'import { readAccountUsage, type AccountUsageReading } from './lib/accountUsage.js'import { probeEngines } from './lib/engineProbe.js'diff --cc cli/src/lib/gridExec.spec.tsindex 000000000,073c50931..1a21af2bfmode 000000,100644..100644--- a/cli/src/lib/gridExec.spec.ts+++ b/cli/src/lib/gridExec.spec.ts@@@ -1,0 -1,145 +1,148 @@@+ /**+ * Which `grid` this daemon runs, and what every child of it inherits.+ *+ * `gridBinaryPath()` is the one resolver behind every grid call — the daemon's own (`gridExec`), the+ * sign-in hand-off and the sign-out, and the PATH the agent's pane gets (`engineLaunch.ts`). The+ * order is the contract: the developer override, then the managed runtime's pointer, then PATH —+ * with the pointer trusted only when it names something runnable INSIDE the runtime dir.+ */+ import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'+ import { tmpdir } from 'node:os'+ import { join } from 'node:path'+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++ let root = ''+ let runtimeDir = ''-const saved = { PATH: process.env.PATH, HARNESS_GRID_BIN: process.env.HARNESS_GRID_BIN, ADAPTER_RUNTIME_DIR: process.env.ADAPTER_RUNTIME_DIR }++const saved = { PATH: process.env.PATH, HOME: process.env.HOME, HARNESS_GRID_BIN: process.env.HARNESS_GRID_BIN, ADAPTER_RUNTIME_DIR: process.env.ADAPTER_RUNTIME_DIR }++ /** `gridExec.ts` reads `env.ADAPTER_RUNTIME_DIR` at import time, so the module is loaded fresh per case. */+ async function load() {+ vi.resetModules()+ process.env.ADAPTER_RUNTIME_DIR = runtimeDir+ return import('./gridExec.js')+ }++ /** A `grid` that prints what it was given: its argv, then GRID_NO_UPDATE_CHECK. A shell script with+ * builtins only, so an empty PATH cannot fail it for a reason that is not the one under test. */+ function fakeGrid(dir: string): string {+ mkdirSync(dir, { recursive: true })+ const bin = join(dir, 'grid')+ writeFileSync(bin, '#!/bin/sh\nprintf \'%s\\n\' "$@" "update-check=${GRID_NO_UPDATE_CHECK-unset}"\nexit 0\n', { mode: 0o755 })+ return bin+ }++ beforeEach(() => {+ root = mkdtempSync(join(tmpdir(), 'grid-exec-'))+ runtimeDir = join(root, 'runtime')+ mkdirSync(runtimeDir)+ mkdirSync(join(root, 'empty-bin'))+ process.env.PATH = join(root, 'empty-bin')++ // The resolver's last fallback is `$HOME/.local/bin/grid` (grid's own installer's path), so a++ // developer machine that has one must not leak into "nothing to run".++ process.env.HOME = root+ delete process.env.HARNESS_GRID_BIN+ })++ afterEach(() => {+ for (const [key, value] of Object.entries(saved)) {+ if (value === undefined) delete process.env[key]+ else process.env[key] = value+ }+ rmSync(root, { recursive: true, force: true })+ })++ describe('gridBinaryPath', () => {+ it('is the developer override when there is one, whatever else exists', async () => {+ const managed = fakeGrid(join(runtimeDir, 'grid-0.3.47-darwin-arm64'))+ writeFileSync(join(runtimeDir, 'current-grid'), `${managed}\n`)+ const { gridBinaryPath } = await load()++ expect(gridBinaryPath({ HARNESS_GRID_BIN: '/elsewhere/grid' })).toBe('/elsewhere/grid')+ })++ it('is the managed runtime when its pointer names a runnable grid inside the runtime dir', async () => {+ const managed = fakeGrid(join(runtimeDir, 'grid-0.3.47-darwin-arm64'))+ writeFileSync(join(runtimeDir, 'current-grid'), `${managed}\n`)+ const { gridBinaryPath } = await load()++ expect(gridBinaryPath({})).toBe(managed)+ })++ it('falls through to PATH when the pointer names something outside the runtime dir', async () => {+ writeFileSync(join(runtimeDir, 'current-grid'), '/bin/sh\n')+ const { gridBinaryPath } = await load()++ expect(gridBinaryPath({})).toBe('grid')+ })++ it('falls through to PATH when the pointer names something that is not there, or not runnable', async () => {+ const { gridBinaryPath } = await load()++ writeFileSync(join(runtimeDir, 'current-grid'), `${join(runtimeDir, 'grid-gone', 'grid')}\n`)+ expect(gridBinaryPath({})).toBe('grid')++ const unrunnable = fakeGrid(join(runtimeDir, 'grid-0.3.47-darwin-arm64'))+ chmodSync(unrunnable, 0o644)+ writeFileSync(join(runtimeDir, 'current-grid'), `${unrunnable}\n`)+ expect(gridBinaryPath({})).toBe('grid')+ })+ })++ describe('gridCliPresence', () => {+ it('is `managed` when the resolved grid is the runtime this daemon owns', async () => {+ const managed = fakeGrid(join(runtimeDir, 'grid-0.3.47-darwin-arm64'))+ writeFileSync(join(runtimeDir, 'current-grid'), `${managed}\n`)+ const { gridCliPresence } = await load()++ expect(gridCliPresence()).toBe('managed')+ })++ it('is `path` for a grid found on PATH, and for a developer override — neither is the pin', async () => {+ fakeGrid(join(root, 'path-bin'))+ process.env.PATH = join(root, 'path-bin')+ const { gridCliPresence } = await load()+ expect(gridCliPresence()).toBe('path')++ process.env.HARNESS_GRID_BIN = fakeGrid(join(root, 'elsewhere'))+ expect(gridCliPresence()).toBe('path')++ // Wherever the override lives — even under the runtime dir — it is the developer's, not the pin.+ process.env.HARNESS_GRID_BIN = fakeGrid(join(runtimeDir, 'grid-dev-build'))+ expect(gridCliPresence()).toBe('path')+ })++ it('is `missing` when there is nothing to run at all', async () => {+ const { gridCliPresence } = await load()++ expect(gridCliPresence()).toBe('missing')+ })+ })++ describe('gridChildEnv', () => {+ it('turns grid\'s own update check off on top of the environment it is given', async () => {+ const { gridChildEnv } = await load()++ expect(gridChildEnv({ GRID_HOME: '/x/.grid', PATH: '/bin' })).toEqual({ GRID_HOME: '/x/.grid', PATH: '/bin', GRID_NO_UPDATE_CHECK: '1' })+ })+ })++ describe('gridExec', () => {+ it('runs the resolved grid with its update check off, and hands back what it said', async () => {+ process.env.HARNESS_GRID_BIN = fakeGrid(join(root, 'elsewhere'))+ const { gridExec } = await load()++ const result = await gridExec(['--version'])++ expect(result.code).toBe('OK')+ expect(result.stdout).toBe('--version\nupdate-check=1\n')+ })++ it('answers GRID_CLI_MISSING, without spawning, when there is nothing to run', async () => {+ const { gridExec } = await load()++ const result = await gridExec(['--version'])++ expect(result).toMatchObject({ code: 'GRID_CLI_MISSING', exitCode: 1 })+ expect(result.message).toContain('grid')+ })+ })diff --cc cli/src/lib/gridExec.tsindex 4ea21b3a8,46fc19380..921265540--- a/cli/src/lib/gridExec.ts+++ b/cli/src/lib/gridExec.ts@@@ -89,15 -110,16 +110,33 @@@ export function managedGridPath(): strireturn recorded}} catch {- // absent, unreadable, or not executable → fall through to PATH+ // absent, unreadable, or not executable → there is no managed grid}+ return null+ }+-/** The `grid` this daemon should run: the override, the managed runtime, or the name on PATH. */++/**++ * The `grid` this daemon should run: the override, the managed runtime, the name on PATH, or —++ * last — the directory grid's own public installer uses (`lib/gridInstall.ts`), which a daemon++ * started from a launcher with launchd's bare PATH does not have. Named absolutely rather than by++ * extending PATH, so the fallback reaches exactly one known file and never whatever else that++ * directory holds. The managed runtime outranks it: once the pin is published the installer's++ * copy is only ever a fallback for a machine the pin could not reach.++ */+ export function gridBinaryPath(processEnv: NodeJS.ProcessEnv = process.env): string {+ const override = processEnv.HARNESS_GRID_BIN?.trim()+ if (override) return override- return managedGridPath() ?? GRID_BINARY++ const managed = managedGridPath()++ if (managed) return managed+ if (binaryOnPath(GRID_BINARY, processEnv)) return GRID_BINARY- // Where grid's own installer puts it (`lib/gridInstall.ts`), which a daemon started from a launcher- // with launchd's bare PATH does not have. Named absolutely rather than by extending PATH, so the- // fallback reaches exactly one known file and never whatever else that directory holds.- const installed = join(homedir(), '.local', 'bin', GRID_BINARY)- try { accessSync(installed, constants.X_OK); return installed } catch { /* not there either */ }++ // Keyed on the environment's HOME rather than `os.homedir()`, so a caller that hands in an++ // environment (the tests, a deliberately bare one) gets exactly what that environment can see.++ const home = processEnv.HOME?.trim()++ if (home) {++ const installed = join(home, '.local', 'bin', GRID_BINARY)++ try { accessSync(installed, constants.X_OK); return installed } catch { /* not there either */ }++ }+ return GRID_BINARY}/** Is there a `grid` to run at all? Asked by reading rather than by spawning, so a missing binary isdiff --cc cli/src/lib/gridHandoff.spec.tsindex 000000000,3a3c9e4b9..62ebaa575mode 000000,100644..100644--- a/cli/src/lib/gridHandoff.spec.ts+++ b/cli/src/lib/gridHandoff.spec.ts@@@ -1,0 -1,104 +1,107 @@@+ /**+ * Which `grid` the sign-in hand-off runs.+ *+ * The hand-off carries the account token, so it has to run the SAME binary every other grid call+ * resolves to (`gridExec.ts`): the developer override, then the managed runtime, then PATH. A+ * hand-off that asked PATH on its own would sign in with one `grid` while models ran on another —+ * two versions writing one `~/.grid`. The token seam itself (stdin, never argv) is covered end to end+ * in `gridCommand.spec.ts`; this file is only about WHICH child gets it.+ */+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'+ import { tmpdir } from 'node:os'+ import { join } from 'node:path'+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++ let root = ''+ let runtimeDir = ''-const saved = { PATH: process.env.PATH, HARNESS_GRID_BIN: process.env.HARNESS_GRID_BIN, ADAPTER_RUNTIME_DIR: process.env.ADAPTER_RUNTIME_DIR }++const saved = { PATH: process.env.PATH, HOME: process.env.HOME, HARNESS_GRID_BIN: process.env.HARNESS_GRID_BIN, ADAPTER_RUNTIME_DIR: process.env.ADAPTER_RUNTIME_DIR }++ /** `gridExec.ts` reads `env.ADAPTER_RUNTIME_DIR` at import time, so the module is loaded fresh per case. */+ async function load() {+ vi.resetModules()+ process.env.ADAPTER_RUNTIME_DIR = runtimeDir+ return import('./gridHandoff.js')+ }++ /** A `grid` that records its argv and (on `login`) its standard input, under `label`. A shell script+ * rather than a Node one, with `/bin/cat` by absolute path: several cases below run with an EMPTY+ * PATH, where `#!/usr/bin/env node` — or a bare `cat` — would fail for a reason that has nothing to+ * do with the resolution under test. */+ function fakeGrid(dir: string, label: string): string {+ mkdirSync(dir, { recursive: true })+ const bin = join(dir, 'grid')+ writeFileSync(bin, [+ '#!/bin/sh',+ `printf '%s\\n' "$@" > "${join(root, `${label}.args`)}"`,+ `printf '%s' "\${GRID_NO_UPDATE_CHECK-unset}" > "${join(root, `${label}.update-check`)}"`,+ `[ "$1" = login ] && /bin/cat > "${join(root, `${label}.stdin`)}"`,+ 'exit 0',+ '',+ ].join('\n'), { mode: 0o755 })+ return bin+ }++ function ran(label: string): boolean { return existsSync(join(root, `${label}.args`)) }+ function argsOf(label: string): string[] { return readFileSync(join(root, `${label}.args`), 'utf8').trim().split('\n') }+ function updateCheckSeenBy(label: string): string { return readFileSync(join(root, `${label}.update-check`), 'utf8') }++ beforeEach(() => {+ root = mkdtempSync(join(tmpdir(), 'grid-handoff-'))+ runtimeDir = join(root, 'runtime')+ mkdirSync(runtimeDir)+ // Nothing on PATH unless a case puts something there — never this machine's own `grid`.+ mkdirSync(join(root, 'empty-bin'))+ process.env.PATH = join(root, 'empty-bin')++ // The resolver's last fallback is `$HOME/.local/bin/grid` (grid's own installer's path), so a++ // developer machine that has one must not leak into "nothing to run".++ process.env.HOME = root+ delete process.env.HARNESS_GRID_BIN+ })++ afterEach(() => {+ for (const [key, value] of Object.entries(saved)) {+ if (value === undefined) delete process.env[key]+ else process.env[key] = value+ }+ rmSync(root, { recursive: true, force: true })+ })++ describe('handOffToGrid — which grid it runs', () => {+ it('runs the grid HARNESS_GRID_BIN names, with nothing on PATH', async () => {+ const override = fakeGrid(join(root, 'elsewhere'), 'override')+ process.env.HARNESS_GRID_BIN = override+ const { handOffToGrid } = await load()++ const result = await handOffToGrid('tok_1', { json: true })++ expect(result.code).toBe('OK')+ expect(argsOf('override')).toEqual(['login', '--harness', '--json'])+ expect(readFileSync(join(root, 'override.stdin'), 'utf8')).toBe('tok_1\n')+ // grid's own "a newer version is out — run `grid update`" must never reach a binary the+ // harness pins: `update` would overwrite it in place. Off for every child this daemon spawns.+ expect(updateCheckSeenBy('override')).toBe('1')+ })++ it('prefers the managed runtime over a grid on PATH', async () => {+ fakeGrid(join(root, 'path-bin'), 'path')+ process.env.PATH = join(root, 'path-bin')+ const managed = fakeGrid(join(runtimeDir, 'grid-0.3.47-darwin-arm64'), 'managed')+ writeFileSync(join(runtimeDir, 'current-grid'), `${managed}\n`)+ const { handOffToGrid } = await load()++ const result = await handOffToGrid('tok_2', { json: true })++ expect(result.code).toBe('OK')+ expect(argsOf('managed')).toEqual(['login', '--harness', '--json'])+ expect(ran('path')).toBe(false)+ })++ it('reports GRID_CLI_MISSING when neither the managed runtime nor PATH has one', async () => {+ const { handOffToGrid } = await load()++ const result = await handOffToGrid('tok_3', { json: true })++ expect(result).toMatchObject({ code: 'GRID_CLI_MISSING', exitCode: 1 })+ expect(result.message).toContain('grid')+ })+ })diff --cc desktop/lib/widgets/run_local_model_dialog.dartindex 65037e6f8,cfc7de0e7..5055decb2--- a/desktop/lib/widgets/run_local_model_dialog.dart+++ b/desktop/lib/widgets/run_local_model_dialog.dart@@@ -1,13 -1,12 +1,14 @@@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_checkbox.dart';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.///@@@ -39,29 -30,18 +40,29 @@@ Future<({String machineId})?> showRunLo// 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),+ builder: (_) => _RunLocalModelDialog(+ notifier: notifier,+ machineId: machineId,+ chooseMachine: chooseMachine,+ ),);-/// Prerequisites are said only when one is missing, as one sentence in the-/// machine line's place, with Start disabled. Present and satisfied, nothing-/// is said — a checklist of green ticks would make a two-second decision look-/// like a setup screen.-enum _Prerequisite { opencode, gridCli, grid }+/// 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 }++enum _Prerequisite { unlinked, offline, opencode, gridCli }class _RunLocalModelDialog extends StatefulWidget {- const _RunLocalModelDialog({required this.notifier, required this.machineId});+ const _RunLocalModelDialog({+ required this.notifier,+ required this.machineId,+ required this.chooseMachine,+ });final AppNotifier notifier;final String machineId;@@@ -90,216 -79,13 +91,230 @@@ class _RunLocalModelDialogState extend});}- void _read(String machineId) =>- unawaited(widget.notifier.probeEngines(machineId, force: true));- Future<void> _readGrid() async {- final models = await widget.notifier.gridModels(widget.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(() {- _hasGrid = models.gridName != null;- _gridCli = models.gridCli;++ 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.+ Widget _machineRow(MachineState m, {required bool opens}) => Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ _machineMark(m, size: 22),+ const SizedBox(width: 10),+ Flexible(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ m.machine.displayName,+ key: const Key('run-local-model-machine'),+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ fontFamily: grid.AppFont.sans,+ fontSize: 12.5,+ height: 1.2,+ color: grid.AppPalette.textPrimary,+ ),+ ),+ Text(+ _kind(m),+ style: TextStyle(+ fontFamily: grid.AppFont.sans,+ fontSize: 11.5,+ height: 1.2,+ color: grid.AppPalette.textSecondary,+ ),+ ),+ ],+ ),+ ),+ if (opens) ...[+ const SizedBox(width: 6),+ Icon(+ LucideIcons.chevronDown,+ size: 12,+ color: grid.AppPalette.textSecondary,+ ),+ ],+ ],+ );++ /// What a machine is, in two words, beside its name.+ String _kind(MachineState m) => m.isLocalMachine+ ? 'This machine'+ : _online(m)+ ? 'Online'+ : 'Offline';++ /// One machine: the slim row, nothing to choose. More: a row of small chips+ /// — up to three, this computer first, the chosen one filled — and a "…"+ /// that opens the pane menu (the same menu the pane's model picker draws,+ /// the current row filled rather than ticked) with every machine. One row+ /// whatever the count; the chosen machine always among the visible chips.+ 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) {+ return _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: [+ Padding(+ padding: const EdgeInsets.only(bottom: 8),+ child: Text(+ 'Pick the machine it should work on.',+ style: TextStyle(+ fontFamily: grid.AppFont.sans,+ fontSize: 12.5,+ color: grid.AppPalette.textSecondary,+ ),+ ),+ ),+ _chips(visible, machines),+ ],+ );+ }++ 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@@@ -317,6 -98,10 +332,7 @@@return _Prerequisite.opencode;}}- // The machine's own gap before the account's: a sign-in cannot help until- // there is a `grid` on this computer to sign in with.- if (_gridCli == GridCli.missing) return _Prerequisite.gridCli;- if (_hasGrid == false) return _Prerequisite.grid;++ if (_gridCli[_machineId] == GridCli.missing) return _Prerequisite.gridCli;return null;}@@@ -330,19 -115,13 +346,23 @@@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.",- _Prerequisite.grid => 'Sign in to Harness again to set this up.',null => null,};+ final machines = _machines;return AlertDialog(title: const Text('Models that live on your machine'),content: SizedBox(diff --cc desktop/test/run_local_model_dialog_test.dartindex fadfbcdc4,e4471c4f9..c506b565f--- a/desktop/test/run_local_model_dialog_test.dart+++ b/desktop/test/run_local_model_dialog_test.dart@@@ -32,10 -47,10 +32,14 @@@ class _Conn extends WsConnfinal List<Map<String, Object?>> engines;final String? gridName;- /// Which `grid` the machine would run — `managed`, `path` or `missing`; null = an older daemon- /// that does not say.++ /// 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 = 'Local model manager';+/// Every `agent_create` payload, verbatim — the wire is what the plan specifies.final creates = <Map<String, dynamic>>[];@@@ -317,6 -250,6 +326,25 @@@ void main());});++ 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')));