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
hn 0.1.28: on Omarchy, run a local model on Omagrid and see what this computer serves (#1297)
lingrd608750753f62
diff --git a/cli/src/lib/gridModels.ts b/cli/src/lib/gridModels.tsindex 56c80b6da..6531b37fd 100644--- a/cli/src/lib/gridModels.ts+++ b/cli/src/lib/gridModels.ts@@ -313,6 +313,20 @@ export class GridModelsService {}}+ /** Another grid's nodes, for what this computer serves on it — never waking it, and never taking it for+ * the account's own (only [inventory] says that). Answered from its picture at once, as [sections] answers:+ * an aged one is read again in the background, so a model list never waits on another grid's network+ * (an unreachable one held it 10 s a grid). */+ async servingNodes(gridName: string): Promise<GridInventoryAnswer> {+ const tracked = await this.track(await this.rowFor(gridName))+ if (this.due(tracked)) void this.refresh(tracked).catch(() => {})+ return {+ state: tracked.picture.state,+ nodes: tracked.picture.state === 'awake' ? tracked.rawNodes : [],+ status: tracked.info?.value?.status ?? null,+ }+ }+private async rowFor(gridName: string): Promise<GridRow> {return (await this.gridRows(null)).find((row) => row.name === gridName) ?? nameOnlyRow(gridName)}@@ -785,6 +799,11 @@ export function gridInventory(gridName: string, force: boolean): Promise<GridInvreturn service.inventory(gridName, force)}+/** Another grid's nodes, for what this computer serves there (`LocalModels`' injected `servingNodes`). */+export function gridServingNodes(gridName: string): Promise<GridInventoryAnswer> {+ return service.servingNodes(gridName)+}+/** Make every read due again — for a caller that has just changed what a grid serves. */export function forgetGridModels(): void {service.forget()diff --git a/cli/src/lib/gridReads.spec.ts b/cli/src/lib/gridReads.spec.tsindex eb5f129b5..6a3510df1 100644--- a/cli/src/lib/gridReads.spec.ts+++ b/cli/src/lib/gridReads.spec.ts@@ -13,7 +13,7 @@ import { createServer, type IncomingHttpHeaders, type Server } from 'node:http'import { tmpdir } from 'node:os'import { join } from 'node:path'import { installFakeGrid, type FakeGrid, type FakeGridPlan, type FakeGridTurn } from './__fixtures__/fakeGrid.js'-import { forgetGridModels, gridInventory, listAllGridModels, listGridModels, resetGridModels, type GridModelsService, type GridSection } from './gridModels.js'+import { forgetGridModels, gridInventory, gridServingNodes, listAllGridModels, listGridModels, resetGridModels, type GridModelsService, type GridSection } from './gridModels.js'// Every look starts the fake `grid`, a node process, for its list and each grid's info: the seam under test is// that subprocess. The longest test here looks 13 times, about 26 starts: 2.7 s under 12 busy loops on a@@ -529,6 +529,28 @@ describe('a picture an older build saved', () => {})})+describe('another grid read for what this computer serves there', () => {+ it('answers its nodes as a picker reads them, never taking it for the own grid', async () => {+ answer(TEAM_ID, OVERVIEW, awake([node('rig', ['qwen'])]))+ // Answered at once from what is known — nothing yet — and read in the background: never waited for.+ expect(await gridServingNodes(TEAM)).toMatchObject({ nodes: [] })+ await service.settled()+ const read = await gridServingNodes(TEAM)+ expect(read.state).toBe('awake')+ expect(read.nodes.map((n) => n.name)).toEqual(['rig'])+ expect((await look()).map((s) => [s.name, s.own])).toEqual([[OWN, true], [TEAM, false]])+ })++ it('answers a sleeping grid asleep, with no nodes, and does not wake it', async () => {+ answer(TEAM_ID, OVERVIEW, asleep())+ await gridServingNodes(TEAM)+ await service.settled()+ const read = await gridServingNodes(TEAM)+ expect(read).toMatchObject({ state: 'asleep', nodes: [] })+ expect(grid.calls().some((argv) => argv.includes('wake'))).toBe(false)+ })+})+describe('what an older desktop reads', () => {it('every section stays a valid {name, own, models:[{id,node}]}, and a sleeping one keeps its models', async () => {answer(OWN_ID, OVERVIEW, asleep(record(60, [{ name: 'mac', models: ['small-q4'] }])))diff --git a/cli/src/lib/localModels.spec.ts b/cli/src/lib/localModels.spec.tsindex d516750d1..8d2ee68a3 100644--- a/cli/src/lib/localModels.spec.ts+++ b/cli/src/lib/localModels.spec.ts@@ -1993,3 +1993,116 @@ describe('models other apps downloaded, started in their own app', () => {})})++describe('the grids this computer serves a model on', () => {+ /** Omagrid beside the own grid: `grid ls` lists both, and this computer's engine for Small-Q4 has a run+ * record there too (as `grid join` on Omagrid writes it). */+ const onOmagrid = async (record: Record<string, unknown> = {}) => {+ const folder = join(home, 'run', 'engines', 'grid-oma')+ await mkdir(folder, { recursive: true })+ await writeFile(join(folder, 'remote.json'), JSON.stringify({ node_id: 'oma-node', engines: [{ endpoint_url: null, models: ['Small-Q4.gguf'] }], advertise_as: ['Small-Q4'], ...record }))+ await writeFile(join(folder, 'remote.heartbeat'), '')+ const original = run.getMockImplementation()!+ run.mockImplementation(async (args, output) => args.includes('ls')+ ? ok([{ grid: 'home', id: 'grid-home' }, { grid: 'Omagrid', id: 'grid-oma' }]) : original(args, output))+ }+ /** Omagrid's overview: a stranger's node serving the same model, and this computer's. */+ const omagrid = (): GridInventory => ({ state: 'awake', status: null, nodes: [+ { node_id: 'stranger', online: true, models: ['small-q4'], answered: { window_seconds: 86400, requests: 900, by_model: [{ model: 'small-q4', requests: 900, tokens_out: 9_000_000 }] } },+ { node_id: 'oma-node', online: true, models: ['small-q4'], answered: { window_seconds: 86400, requests: 268, by_model: [{ model: 'small-q4', requests: 268, tokens_out: 1_100_000, tokens_in: 2_400_000, tokens_cached: 1_800_000 }] } },+ ] })+ const withServingNodes = (servingNodes: (grid: string) => Promise<GridInventory>, extra: Partial<ConstructorParameters<typeof LocalModels>[0]> = {}) =>+ modelFixture({ stateDir, processEnv: { GRID_HOME: home }, run, request: request as typeof fetch, inventory, servingNodes, ...extra })++ it('names the own grid and every other grid it serves on, with only its own engine’s figures there', async () => {+ const servingNodes = vi.fn(async () => omagrid())+ service = withServingNodes(servingNodes)+ await service.act('home', 'org/Small-GGUF', 'start'); await service.settled()+ await onOmagrid()+ expect((await service.list('home', true)).models[0].servedOn).toEqual([+ // Each with the name that grid lists it under — what a harness moves onto it there by.+ { grid: 'home', servedAs: ['Small-Q4'], requests: 4, windowSeconds: 3600 },+ { grid: 'Omagrid', servedAs: ['Small-Q4'], requests: 268, tokensOut: 1_100_000, tokensIn: 2_400_000, tokensCached: 1_800_000, windowSeconds: 86400 },+ ])+ // Read as another grid's nodes, never through the own grid's inventory, which takes a grid for the account's own.+ expect(servingNodes.mock.calls).toEqual([['Omagrid']])+ expect(inventory.mock.calls.every(([grid]) => grid === 'home')).toBe(true)+ })++ it('names no grid for a model it serves nowhere, and reads no other grid without a run record here', async () => {+ const servingNodes = vi.fn(async () => omagrid())+ service = withServingNodes(servingNodes)+ const original = run.getMockImplementation()!+ run.mockImplementation(async (args, output) => args.includes('ls')+ ? ok([{ grid: 'home', id: 'grid-home' }, { grid: 'Omagrid', id: 'grid-oma' }]) : original(args, output))+ expect((await service.list('home')).models[0]).not.toHaveProperty('servedOn')+ expect(servingNodes).not.toHaveBeenCalled()+ })++ it('names a grid that sleeps while its engine here is alive, with no figures; not one whose engine is gone', async () => {+ service = withServingNodes(async () => ({ state: 'asleep', status: 'asleep', nodes: [] }))+ await onOmagrid({ pid: process.pid })+ expect((await service.list('home', true)).models[0].servedOn).toEqual([{ grid: 'Omagrid', servedAs: ['Small-Q4'] }])+ await onOmagrid({ pid: 0 })+ expect((await service.list('home', true)).models[0]).not.toHaveProperty('servedOn')+ })++ it('names a grid whose overview does not list this computer’s engine yet, or could not be read, while its process is alive', async () => {+ // No process for its record (gone, or mid-spawn): not serving there.+ service = withServingNodes(async () => ({ state: 'awake', status: null, nodes: [omagrid().nodes[0]] }))+ await onOmagrid()+ expect((await service.list('home', true)).models[0]).not.toHaveProperty('servedOn')+ service = withServingNodes(async () => { throw new Error('unreachable') })+ expect((await service.list('home', true)).models[0]).not.toHaveProperty('servedOn')+ // Its process alive: serving there, figures unknown — so the own grid never starts a second engine of it.+ await onOmagrid({ pid: process.pid })+ expect((await service.list('home', true)).models[0].servedOn).toEqual([{ grid: 'Omagrid', servedAs: ['Small-Q4'] }])+ service = withServingNodes(async () => ({ state: 'awake', status: null, nodes: [omagrid().nodes[0]] }))+ expect((await service.list('home', true)).models[0].servedOn).toEqual([{ grid: 'Omagrid', servedAs: ['Small-Q4'] }])+ })++ it('starts a model this computer knows from another grid’s list on the community grid by the same id', async () => {+ // Small-Q4 served on the own grid, then its run record gone: known there as `local:Small-Q4.gguf` only.+ catalogCards = []+ await writeFile(join(home, 'models', 'Small-Q4.gguf'), Buffer.alloc(64))+ await writeFile(join(records, 'remote.json'), JSON.stringify({ node_id: 'local-node', engines: [{ endpoint_url: null, models: ['Small-Q4.gguf'] }], advertise_as: [] }))+ expect((await service.list('home', true)).models.map(m => m.id)).toContain('local:Small-Q4.gguf')+ await rm(join(records, 'remote.json'))+ await service.act('Omagrid', 'local:Small-Q4.gguf', 'start'); await service.settled()+ expect(calls.find(args => args.includes('join'))?.slice(0, 5)).toEqual(['--remote', 'join', 'Omagrid', '--serve', 'Small-Q4.gguf'])+ })++ it('reads only the own grid for a caller that gives no other grid’s reader (as before)', async () => {+ await service.act('home', 'org/Small-GGUF', 'start'); await service.settled()+ await onOmagrid()+ expect((await service.list('home', true)).models[0].servedOn).toEqual([{ grid: 'home', servedAs: ['Small-Q4'], requests: 4, windowSeconds: 3600 }])+ })++ it('says which OS grid this computer claims, and nothing for none', async () => {+ expect((await withServingNodes(async () => omagrid(), { os: () => 'omarchy' }).list('home')).os).toBe('omarchy')+ expect(await withServingNodes(async () => omagrid(), { os: () => undefined }).list('home')).not.toHaveProperty('os')+ })++ it('names the community grid of this computer’s OS that the account is in, for a start there', async () => {+ const original = run.getMockImplementation()!+ run.mockImplementation(async (args, output) => args.includes('ls') ? ok([+ { grid: 'home', id: 'grid-home', type: 'permissioned-public' }, { grid: '--flag', id: 'x', type: 'os-community' },+ { grid: 'Omagrid', id: 'grid-oma', type: 'os-community' },+ ]) : original(args, output))+ expect((await service.list('home')).osGrid).toBe('Omagrid')+ expect(await service.communityGrid()).toBe('Omagrid')+ run.mockImplementation(original)+ expect(await service.communityGrid()).toBeNull()+ expect(await service.list('home', true)).not.toHaveProperty('osGrid')+ })++ it('a list of the own grid says how a start on the community grid goes, and how it ended', async () => {+ const ack = await service.act('Omagrid', 'org/Small-GGUF', 'start')+ expect((await service.list('home', true)).models[0].operation).toMatchObject({ id: ack.operation!.id, phase: 'running' })+ await service.settled()+ expect((await service.list('home', true)).models[0].operation).toMatchObject({ id: ack.operation!.id, phase: 'done' })+ // An operation on the own grid after it: its own receipt again.+ const own = await service.act('home', 'org/Small-GGUF', 'stop'); await service.settled()+ expect((await service.list('home', true)).models[0].operation).toMatchObject({ id: own.operation!.id, action: 'stop' })+ })+})diff --git a/cli/src/lib/localModels.ts b/cli/src/lib/localModels.tsindex 9e4b6861f..1dad1f9e1 100644--- a/cli/src/lib/localModels.ts+++ b/cli/src/lib/localModels.ts@@ -14,6 +14,7 @@ import { readEnvExports } from './gridWake.js'import { MIN_CODING_CONTEXT } from './codingContext.js'import type { GpuProcess } from './gpuProcesses.js'import { APP_LABEL, AppStartError, GRID_LABEL, appContext, readAppRecords, writeAppRecords, type AppEngine, type AppEngineOps, type AppEngineRecord, type AppModel } from './appModels.js'+import { osToken, type OsToken } from './osToken.js'// Its own module, so the API launches the core keeps need not load this one (codingContext.ts).export { MIN_CODING_CONTEXT }@@ -88,7 +89,15 @@ export interface LocalModel {* (`Qwen3.8-27B`): matched by name alone, the apps listed it twice, the second time as the grid's,* and could not move a harness onto it from its own row. */servedAs?: string[]+ /** Every grid this computer serves it on, with what this computer's engine answered there over the+ * grid's window (grid's `answered.by_model`, the figures `grid stats` reads). A grid that sleeps, or+ * whose node is not in its listing yet, is named with no figures. Absent: served on no grid. */+ servedOn?: ServedOn[]}+/** [servedAs]: the names that grid lists it under — what a harness moves onto it there by, as+ * [LocalModel.servedAs] is on the own grid. [tokensOut]: what the engine wrote; [tokensIn]: what was sent+ * to it; [tokensCached]: the part of [tokensIn] its prompt cache served (grid's `read_answered` figures). */+export interface ServedOn { grid: string; servedAs: string[]; requests?: number; tokensOut?: number; tokensIn?: number; tokensCached?: number; windowSeconds?: number }export interface ModelOperation {id: string; modelId: string; action: 'download' | 'start' | 'stop'; phase: 'running' | 'done' | 'failed'stage: 'checking' | 'downloading' | 'updating' | 'starting' | 'verifying' | 'stopping'@@ -111,6 +120,11 @@ export interface LocalModelsSnapshot {supportsDownload?: boolean/** Free space where downloads land, so a download's size can be read against it. */freeDiskBytes?: number+ /** The OS grid this computer claims, by grid's own rule ([osToken]); absent for no OS grid. */+ os?: OsToken+ /** The community grid of that OS this account is in (`grid ls`'s `os-community` grid, `Omagrid`):+ * where a start with `community` runs a model. Absent: in none. */+ osGrid?: string}export interface Candidate {id: string; name: string; pull: string; file: string; files: string[]; size: number; quant: string@@ -145,6 +159,11 @@ interface Options {/** Injected, never a `grid engines` call: that read carries the grid credential, and a signed-in read* of a sleeping grid WAKES it — once a tick, for as long as the panel is open. */inventory: (grid: string, force: boolean) => Promise<GridInventory>+ /** Another grid's nodes, read the same way without taking it for the own grid (`gridModels.gridServingNodes`):+ * what this computer serves on the account's other grids. Absent: only the own grid is read. */+ servingNodes?: (grid: string) => Promise<GridInventory>+ /** The OS grid this computer claims ([osToken]); a test names one. */+ os?: () => OsToken | undefined/** Told when a start or stop has finished, so the model lists are read again. */onChanged?: () => void/** Models other apps downloaded here ([scanAppModels]), and the engines that start them. Absent: none. */@@ -346,6 +365,11 @@ export class LocalModels {private blockers = new Map<string, string>()private appsRead?: { at: number; value: AppModel[] }private appsPending?: Promise<AppModel[]>+ /** Read once: a computer does not change its OS while the daemon runs. */+ private osRead?: { value: OsToken | undefined }+ /** The last operation finished, and its grid: a list of another grid (the own one, after a start on the+ * community grid) still says how it ended. */+ private elsewhere?: { grid: string; operation: ModelOperation }constructor(private readonly options: Options) {this.processEnv = options.processEnv ?? process.env@@ -465,15 +489,24 @@ export class LocalModels {/** Grid's non-secret run records distinguish locally owned --serve processes* from external endpoints. Stop delegates identity checks and teardown to Grid. */- private async owned(grid: string): Promise<Owned[]> {+ private async owned(grid: string, grids?: Record<string, any>[]): Promise<Owned[]> {this.blockers.delete(grid)if (!validArg(grid)) return []- const grids = rows(await this.json(['--remote', 'ls', '--json']))+ grids ??= rows(await this.json(['--remote', 'ls', '--json']))const gridId = str(grids.find(g => g.grid === grid)?.id)- if (!gridId || basename(gridId) !== gridId) return []+ const { owned, blocker } = await this.engineRecords(gridId)+ if (blocker) this.blockers.set(grid, blocker)+ return owned+ }++ /** The engines this computer runs on the grid [gridId] (`grid ls`'s `id`), from Grid's run records,+ * and why another local model cannot start beside them (the last record's reason). */+ private async engineRecords(gridId: string): Promise<{ owned: Owned[]; blocker?: string }> {+ if (!gridId || basename(gridId) !== gridId) return { owned: [] }const folder = join(this.home, 'run', 'engines', gridId)const names = await readdir(folder).catch(() => [])const result: Owned[] = []+ let blocker: string | undefinedfor (const name of names.filter(n => n.endsWith('.json'))) {let record: Record<string, any>try { record = obj(JSON.parse(await readFile(join(folder, name), 'utf8'))) } catch { continue }@@ -487,7 +520,7 @@ export class LocalModels {const pid = recordPid(record)const pidAlive = pid !== null && processExists(pid)const dead = pid !== null && !pidAlive- if ((specs.length || record.media) && !dead) this.blockers.set(grid, 'Open Model Manager to add a model alongside those already running.')+ if ((specs.length || record.media) && !dead) blocker = 'Open Model Manager to add a model alongside those already running.'for (const spec of specs) {if (spec.endpoint_url || spec.api_kind || !Array.isArray(spec.models) || spec.models.length !== 1) continueconst file = str(spec.models[0])@@ -500,10 +533,10 @@ export class LocalModels {const aliases: string[] = advertised.length ? advertised : [file]result.push({ file: basename(file), selector: file, aliases, nodeId: str(record.node_id), name: str(record.meta_name), live,pidAlive, dead, siblings: specs.length + (record.media ? 1 : 0) })- if (!dead) this.blockers.set(grid, `Stop ${cleanName(aliases[0])} first to start another local model.`)+ if (!dead) blocker = `Stop ${cleanName(aliases[0])} first to start another local model.`}}- return result+ return { owned: result, blocker }}/** Keep models imported from an existing Grid setup after Stop removes its@@ -732,9 +765,15 @@ export class LocalModels {private async readList(grid: string, force: boolean): Promise<LocalModelsSnapshot> {await Promise.all([this.loadCatalog(force), this.readReceipt(grid)])let owned: Owned[] = [], nodes: Record<string, any>[] = [], inventoryError: string | undefined, asleep = false+ // `grid ls` once: the own grid's records, and every other grid this computer may serve on.+ let grids: Record<string, any>[] = []+ const ownedHere = async () => {+ grids = validArg(grid) ? rows(await this.json(['--remote', 'ls', '--json'])) : []+ return this.owned(grid, grids)+ }try {let inventory: GridInventory- [owned, inventory] = await Promise.all([this.owned(grid), this.options.inventory(grid, force)])+ [owned, inventory] = await Promise.all([ownedHere(), this.options.inventory(grid, force)])// A grid that is down — its owner status says stopped or asleep (DOWN) — runs nothing: an answer,// not a gap, so Start stays enabled (and brings it back up). Asleep says so even to a member, in// the grid's own answer. Only a read that failed some other way is "could not be checked".@@ -744,7 +783,11 @@ export class LocalModels {} catch { inventoryError = 'Running models could not be checked. Try again.' }// (A dead engine's record holds nothing: its model reads as downloaded, and starts.)owned = owned.filter(instance => !instance.dead)- const operation = this.active?.grid === grid ? this.active.operation : this.receipt?.grid === grid ? this.receipt.operation : undefined+ // The operation under way, on whichever grid (a model started on the community grid shows its progress+ // here too), else the last one finished when that was on another grid — the latest there is — else+ // this grid's receipt.+ const elsewhere = this.elsewhere?.grid !== grid ? this.elsewhere?.operation : undefined+ const operation = this.active?.operation ?? elsewhere ?? (this.receipt?.grid === grid ? this.receipt.operation : undefined)const apps = await this.apps(force)const records = (await this.records()).filter(record => record.grid === grid)// An engine this daemon started is read from its record, whatever a later scan makes of the model: a@@ -764,18 +807,16 @@ export class LocalModels {const owners = new Map(owned.map(instance => [instance.file,choices.find((candidate, index) => candidate.file === instance.file && downloaded[index])?? choices.find(candidate => candidate.file === instance.file)]))- const servingNode = (instance?: Owned): Record<string, any> | undefined => {- const matches = instance?.live ? nodes.filter(n => n.online === true &&- (str(n.node_id || n.id) ? str(n.node_id || n.id) === instance.nodeId :- !!instance.name && str(n.name) === instance.name) &&- instance.aliases.every(alias => (Array.isArray(n.models) ? n.models : []).some((m: unknown) =>- modelKey(str(typeof m === 'string' ? m : obj(m).model)) === modelKey(alias)))) : []- return matches.length === 1 ? matches[0] : undefined- }+ const servingNode = (instance?: Owned) => nodeServing(nodes, instance)// A parked engine: its grid sleeps, so the grid lists nothing, but the process that serves it is alive// here and rejoins the moment the grid wakes. Liveness is the record's pid — never the heartbeat// sidecar, which goes stale while a healthy provider is parked.const parked = (instance?: Owned): boolean => asleep && !!instance?.pidAlive+ // Every grid each file is served on here, given to the one row its engine is attributed to (as [owners]).+ const served = await this.servedOn(grid, grids, inventoryError ? undefined : { owned, nodes, asleep })+ const fileOwner = (file: string) => choices.find((candidate, index) => candidate.file === file && downloaded[index])+ ?? choices.find(candidate => candidate.file === file)+ const servedOn = (file: string): Partial<LocalModel> => served.has(file) ? { servedOn: served.get(file) } : {}const models = choices.map((candidate, index): LocalModel => {const instance = owned.find(o => owners.get(o.file) === candidate)const node = servingNode(instance)@@ -798,14 +839,15 @@ export class LocalModels {operation: operation?.modelId === candidate.id ? operation : undefined,...(!node && parked(instance) ? { gridAsleep: true } : {}),// Grid serves it — its own download, or another app's file linked in because that app is not here.- ...(running || available ? { app: GRID_LABEL } : {}) }+ ...(running || available ? { app: GRID_LABEL } : {}),+ ...(fileOwner(candidate.file) === candidate ? servedOn(candidate.file) : {}) }})for (const instance of owned.filter(o => !choices.some(c => c.file === o.file))) {const serving = !!servingNode(instance)models.push({ id: `local:${instance.file}`, name: cleanName(instance.aliases[0]), servedAs: instance.aliases.map(displayModelName),state: serving || parked(instance) ? 'running' : 'available', canStart: false, canStop: !inventoryError,operation: operation?.modelId === `local:${instance.file}` ? operation : undefined,- ...(!serving && parked(instance) ? { gridAsleep: true } : {}), app: GRID_LABEL })+ ...(!serving && parked(instance) ? { gridAsleep: true } : {}), app: GRID_LABEL, ...servedOn(instance.file) })}// Models in their own apps, started there: running when that engine is up and the grid lists it (or// the grid sleeps — parked, as above). A record whose model has since gone keeps a row to stop it by.@@ -832,12 +874,60 @@ export class LocalModels {...fitOf(this.device),hardware: str(obj(this.device.machine).model || obj(this.device.cpu).brand), notice: inventoryError || this.catalogError,observedAt: new Date().toISOString(), busy: !!this.active, supportsDownload: true,- ...(freeDiskBytes === undefined ? {} : { freeDiskBytes }) }+ ...(freeDiskBytes === undefined ? {} : { freeDiskBytes }), ...this.osField(), ...communityOf(grids) }this.cached = { grid, at: Date.now(), value }this.runningAtLastRead.set(grid, new Set(models.filter(model => model.state === 'running').map(model => model.id)))return value}+ /** Every grid this computer serves each file on (by file), with what its engine answered there: the own+ * grid [grid] from what [readList] already read ([own]; absent when that read failed), every other grid+ * in `grid ls` with a run record here from [Options.servingNodes]. A node that is not listed while its+ * grid sleeps is named with no figures; a record with no node and no sleep is not serving. On another+ * grid, an engine whose process is alive is named with no figures too, its grid's read or not: before+ * that grid lists it, or while its read fails, it still serves there — and a second engine of the same+ * model must not start on the own grid for want of seeing it (review, 2026-10-13). */+ private async servedOn(grid: string, grids: Record<string, any>[],+ own: { owned: Owned[]; nodes: Record<string, any>[]; asleep: boolean } | undefined): Promise<Map<string, ServedOn[]>> {+ const served = new Map<string, ServedOn[]>()+ const add = (name: string, owned: Owned[], nodes: Record<string, any>[], asleep: boolean, elsewhere = false) => {+ for (const instance of owned) {+ const node = nodeServing(nodes, instance)+ if (!node && !((asleep || elsewhere) && instance.pidAlive)) continue+ const answered = obj(node?.answered)+ const perModel = rows(answered.by_model).find(a => instance.aliases.some(alias => modelKey(alias) === modelKey(str(a.model))))+ const figures = node ? { requests: num(perModel?.requests), tokensOut: num(perModel?.tokens_out), tokensIn: num(perModel?.tokens_in),+ tokensCached: num(perModel?.tokens_cached), windowSeconds: num(answered.window_seconds) } : {}+ const entry: ServedOn = { grid: name, servedAs: instance.aliases.map(displayModelName),+ ...Object.fromEntries(Object.entries(figures).filter(([, v]) => v !== undefined)) }+ served.set(instance.file, [...(served.get(instance.file) ?? []), entry])+ }+ }+ if (own) add(grid, own.owned, own.nodes, own.asleep)+ const read = this.options.servingNodes+ if (!read) return served+ for (const row of grids) {+ const name = str(row.grid)+ if (!validArg(name) || name === grid) continue+ const { owned } = await this.engineRecords(str(row.id))+ if (!owned.length) continue+ const inventory = await read(name).catch(() => undefined)+ add(name, owned, inventory?.state === 'awake' ? rows(inventory.nodes) : [], inventory?.state === 'asleep' || inventory?.status === 'asleep', true)+ }+ return served+ }++ private osField(): { os?: OsToken } {+ this.osRead ??= { value: (this.options.os ?? osToken)() }+ return this.osRead.value ? { os: this.osRead.value } : {}+ }++ /** The community grid of this computer's OS that the account is in (`grid ls`), for a start or stop+ * with `community`; null in none. */+ async communityGrid(): Promise<string | null> {+ return communityOf(rows(await this.json(['--remote', 'ls', '--json']))).osGrid ?? null+ }+/** What `grid info` says of [grid]: `running`, `stopped`, `asleep`. */private async gridStatus(grid: string): Promise<string> {return str(obj(await this.json(['--remote', 'info', grid, '--json'])).status)@@ -858,7 +948,7 @@ export class LocalModels {operation.phase = 'failed'operation.error = error instanceof ModelError ? error.message : 'The model could not finish. Start again to retry.'await this.save(grid, operation).catch(() => {})- }).finally(() => { this.active = undefined; this.cached = undefined; this.options.onChanged?.() })+ }).finally(() => { this.active = undefined; this.elsewhere = { grid, operation }; this.cached = undefined; this.options.onChanged?.() })return { operation }}@@ -895,7 +985,10 @@ export class LocalModels {}const owned = (await this.owned(grid)).filter(instance => !instance.dead)const appServed = this.appCandidates(apps)- const candidate = [...this.candidates, ...await this.known(grid, owned, appServed), ...appServed].find(c => c.id === operation.modelId)+ // A model this computer knows from another grid's list too: a file imported on the own grid starts on the+ // community grid by the same id (each grid keeps its own `known`).+ const elsewhere = [...this.knownByGrid].filter(([other]) => other !== grid).flatMap(([, known]) => known)+ const candidate = [...this.candidates, ...await this.known(grid, owned, appServed), ...appServed, ...elsewhere].find(c => c.id === operation.modelId)if (candidate?.appPath && operation.action === 'start') await this.linkApp(candidate)const instance = owned.find(o => candidate ? o.file === candidate.file : operation.modelId === `local:${o.file}`)if (operation.action === 'stop') {@@ -1117,6 +1210,24 @@ class ModelError extends Error {}/** More names than any one engine advertises: a record past it is cut, never trusted to be small. */const MAX_RECORD_IDS = 64+/** The `os-community` grid among [grids] (`grid ls`): the one grid of this computer's OS the account is in+ * (grid admits a machine to its own OS's grid alone, ADR 0039). */+function communityOf(grids: Record<string, any>[]): { osGrid?: string } {+ const name = str(grids.find(g => g.type === 'os-community' && validArg(str(g.grid)))?.grid)+ return name ? { osGrid: name } : {}+}++/** The one online node in [nodes] that is [instance]'s engine — its record's node id (or, with no ids,+ * its name) and every name it serves under; none while its heartbeat is stale or two nodes would match. */+function nodeServing(nodes: Record<string, any>[], instance?: Owned): Record<string, any> | undefined {+ const matches = instance?.live ? nodes.filter(n => n.online === true &&+ (str(n.node_id || n.id) ? str(n.node_id || n.id) === instance.nodeId :+ !!instance.name && str(n.name) === instance.name) &&+ instance.aliases.every(alias => (Array.isArray(n.models) ? n.models : []).some((m: unknown) =>+ modelKey(str(typeof m === 'string' ? m : obj(m).model)) === modelKey(alias)))) : []+ return matches.length === 1 ? matches[0] : undefined+}+/** A run record's pid while a process holds it; null while a join is mid-spawn (`grid join` writes 0). */function recordPid(record: Record<string, any>): number | null {return Number.isSafeInteger(record.pid) && record.pid > 0 ? record.pid : nulldiff --git a/cli/src/lib/osToken.spec.ts b/cli/src/lib/osToken.spec.tsnew file mode 100644index 000000000..a7acc2911--- /dev/null+++ b/cli/src/lib/osToken.spec.ts@@ -0,0 +1,32 @@+import { describe, expect, it } from 'vitest'+import { distroId, osToken } from './osToken.js'++const linux = (osRelease: string, marker = false) => osToken({ platform: 'linux', readOsRelease: () => osRelease, markerExists: () => marker })++describe('osToken (grid os_grid.py, ADR 0039 D-c)', () => {+ it('names macOS and Linux, and no OS grid for anything else', () => {+ expect(osToken({ platform: 'darwin' })).toBe('macos')+ expect(linux('ID=fedora\n')).toBe('linux')+ expect(linux('')).toBe('linux')+ expect(osToken({ platform: 'win32' })).toBeUndefined()+ expect(osToken({ platform: 'freebsd' })).toBeUndefined()+ })++ it('reads Omarchy from ID= alone, never from ID_LIKE=', () => {+ expect(linux('NAME="Omarchy"\nID=omarchy\nID_LIKE=arch\n')).toBe('omarchy')+ expect(linux('ID="Omarchy"\n')).toBe('omarchy')+ // EndeavourOS, CachyOS and Manjaro share ID_LIKE=arch with Omarchy: Linux, not Omarchy.+ expect(linux('ID=endeavouros\nID_LIKE=arch\n')).toBe('linux')+ expect(linux('ID_LIKE=omarchy\n')).toBe('linux')+ })++ it('reads Omarchy from its install where os-release stays Arch Linux ARM (an Apple Silicon Mac)', () => {+ expect(linux('ID=archarm\n', true)).toBe('omarchy')+ })++ it('takes the first line that starts with ID=, as grid does', () => {+ expect(distroId('VERSION_ID=3\nID=omarchy\nID=arch\n')).toBe('omarchy')+ expect(distroId(' ID=omarchy\n')).toBe('')+ expect(distroId('ID=\'arch\'\r\n')).toBe('arch')+ })+})diff --git a/cli/src/lib/osToken.ts b/cli/src/lib/osToken.tsnew file mode 100644index 000000000..0925fbef0--- /dev/null+++ b/cli/src/lib/osToken.ts@@ -0,0 +1,45 @@+/** Which OS community this machine claims, by grid's own rule (autonomous-grid+ * `shared/system/os_grid.py`, ADR 0039 D-c), so a feature offered "on Omarchy" reaches exactly the+ * machines the Omarchy grid admits. Grid has no command that prints it; this reads what grid reads.+ *+ * The set is closed: macOS, Linux, Omarchy. Anything else — Windows included — is no OS grid.+ * Omarchy reports `Linux` like every distribution: it is `ID=omarchy` in `/etc/os-release` (`ID=`,+ * never `ID_LIKE=`, which every Arch derivative shares), or, where Omarchy leaves that file as Arch+ * Linux ARM's (an Apple Silicon Mac), the install's own `/usr/share/omarchy/version`. */+import { readFileSync, statSync } from 'node:fs'++export type OsToken = 'macos' | 'linux' | 'omarchy'++const OS_RELEASE = '/etc/os-release'+const OMARCHY_MARKER = '/usr/share/omarchy/version'+/** Grid's bound on the file it reads: a real one is a few hundred bytes. */+const MAX_OS_RELEASE_BYTES = 64 * 1024++/** `ID=` of [text], unquoted and lower-cased, exactly as grid's `_distro_id` reads it: the first+ * line that starts with `ID=`; '' when there is none. */+export function distroId(text: string): string {+ for (const line of text.split(/\r\n|\r|\n/)) {+ if (line.startsWith('ID=')) return line.slice(3).trim().replace(/^["']+|["']+$/g, '').trim().toLowerCase()+ }+ return ''+}++/** A file, never a directory: `pacman -R omarchy` can leave `/usr/share/omarchy` behind (grid's `is_file`). */+const isFile = (path: string): boolean => { try { return statSync(path).isFile() } catch { return false } }++export interface OsProbe {+ platform?: NodeJS.Platform+ readOsRelease?: () => string+ markerExists?: () => boolean+}++export function osToken(probe: OsProbe = {}): OsToken | undefined {+ const platform = probe.platform ?? process.platform+ if (platform === 'darwin') return 'macos'+ if (platform !== 'linux') return undefined+ const read = probe.readOsRelease ?? (() => {+ try { return readFileSync(OS_RELEASE, 'utf8').slice(0, MAX_OS_RELEASE_BYTES) } catch { return '' }+ })+ if (distroId(read()) === 'omarchy') return 'omarchy'+ return (probe.markerExists ?? (() => isFile(OMARCHY_MARKER)))() ? 'omarchy' : 'linux'+}diff --git a/cli/src/services/models.spec.ts b/cli/src/services/models.spec.tsindex f64cce782..860adffad 100644--- a/cli/src/services/models.spec.ts+++ b/cli/src/services/models.spec.ts@@ -14,7 +14,7 @@ import { gridCapableEngines } from '../lib/gridLaunch.js'import { ensureGridInstalled } from '../lib/gridInstall.js'import { clearGridMcpUrlCache } from '../lib/gridMcpUrl.js'import {- forgetGridModels, gridAnnotation, gridInventory, keystrokePrewarm, listAllGridModels, listGridModels, observeMachineList, onGridModelsChanged,+ forgetGridModels, gridAnnotation, gridInventory, gridServingNodes, keystrokePrewarm, listAllGridModels, listGridModels, observeMachineList, onGridModelsChanged,presentGridSections, retargetPrewarm, warmGridModels, type GridSection,} from '../lib/gridModels.js'import { resolveGridTarget } from '../lib/gridTarget.js'@@ -50,6 +50,7 @@ vi.mock('../lib/gridModels.js', () => ({forgetGridModels: vi.fn(),gridAnnotation: vi.fn((grid: { state: string }) => ({ state: grid.state })),gridInventory: vi.fn(),+ gridServingNodes: vi.fn(),keystrokePrewarm: vi.fn(async () => 'started'),listAllGridModels: vi.fn(async () => []),listGridModels: vi.fn(async () => []),@@ -86,12 +87,14 @@ const local = vi.hoisted(() => ({options: {} as Record<string, any>,list: vi.fn(async (_grid: string | null, _force?: boolean): Promise<Record<string, unknown>> => ({ models: [], busy: false, observedAt: 'now' })),act: vi.fn(async (_grid: string | null, _modelId: unknown, _action: string): Promise<Record<string, unknown>> => ({})),+ communityGrid: vi.fn(async (): Promise<string | null> => 'Omagrid'),}))vi.mock('../lib/localModels.js', () => ({LocalModels: class {constructor(options: Record<string, unknown>) { local.options = options }list = local.listact = local.act+ communityGrid = local.communityGrid},}))@@ -585,6 +588,24 @@ describe('the models service', () => {access.ensure.mockReset()})+ it('a start or stop with `community` runs on the community grid of this computer’s OS, not the account’s', async () => {+ const { ask } = setup([], named)+ local.act.mockClear()+ await ask('grid_fleet_model_start', { modelId: 'org/Model-GGUF', community: true })+ await ask('grid_fleet_model_stop', { modelId: 'org/Model-GGUF', community: true })+ // A download is the same file wherever it runs: on the account's grid, `community` or not.+ await ask('grid_fleet_model_download', { modelId: 'org/Model-GGUF', community: true })+ await ask('grid_fleet_model_start', { modelId: 'org/Model-GGUF', community: 'yes' })+ expect(local.act.mock.calls).toEqual([+ ['Omagrid', 'org/Model-GGUF', 'start'], ['Omagrid', 'org/Model-GGUF', 'stop'],+ ['kelvin-1a2b3c4d', 'org/Model-GGUF', 'download'], ['kelvin-1a2b3c4d', 'org/Model-GGUF', 'start'],+ ])+ local.communityGrid.mockResolvedValueOnce(null)+ local.act.mockClear()+ expect(await ask('grid_fleet_model_start', { modelId: 'org/Model-GGUF', community: true })).toEqual({ error: 'This computer is in no community grid.' })+ expect(local.act).not.toHaveBeenCalled()+ })+it('answers what the act answers, as it is', async () => {local.act.mockResolvedValueOnce({ operation: { action: 'start', modelId: 'org/Model-GGUF' } })local.act.mockResolvedValueOnce({ error: 'fixture refusal' })@@ -651,6 +672,8 @@ describe('the models service', () => {expect(local.options.machineName()).toBe('Studio')expect(core.account.machineName).toHaveBeenCalled()expect(local.options.inventory).toBe(gridInventory)+ // Another grid's nodes are read without taking it for the own grid.+ expect(local.options.servingNodes).toBe(gridServingNodes)expect(appEngineOps).toHaveBeenCalledWith(process.env)expect(local.options.appEngines).toEqual({ engines: 'app' })await local.options.appModels()diff --git a/cli/src/services/models.ts b/cli/src/services/models.tsindex 349424e7c..16c1d2bf2 100644--- a/cli/src/services/models.ts+++ b/cli/src/services/models.ts@@ -30,7 +30,7 @@ import { ensureGridInstalled } from '../lib/gridInstall.js'import { answerGridLaunch, type GridLaunchOverride } from '../lib/gridLaunch.js'import { clearGridMcpUrlCache } from '../lib/gridMcpUrl.js'import {- forgetGridModels, gridAnnotation, gridInventory, keystrokePrewarm, listAllGridModels, listGridModels, observeMachineList, onGridModelsChanged,+ forgetGridModels, gridAnnotation, gridInventory, gridServingNodes, keystrokePrewarm, listAllGridModels, listGridModels, observeMachineList, onGridModelsChanged,retargetPrewarm, warmGridModels, type GridSection,} from '../lib/gridModels.js'import { gridModelsPayload } from '../lib/gridModelsPayload.js'@@ -243,6 +243,7 @@ function modelsRequests(core: CoreApi, grid: GridSetUp, privateGridName: () => PstateDir: join(core.dataDir, 'local-models'),machineName: () => core.account.machineName(),inventory: gridInventory,+ servingNodes: gridServingNodes,onChanged: () => { forgetGridModels(); core.clients.gridModelsChanged() },// Models Ollama, LM Studio and llama.cpp downloaded here, found by the Model Manager's own scan (the// bundled harness), so the picker and that harness agree on what is here and what starts it.@@ -274,7 +275,11 @@ function modelsRequests(core: CoreApi, grid: GridSetUp, privateGridName: () => Preturn { ...snapshot, ...(needed ? { gridSetupNeeded: true } : {}), ...(unready ? { gridSetupError: unready } : {}) }}if (unready) return { error: unready }- return { ...await localModels.act(gridName, payload.modelId, type === 'grid_fleet_model_download' ? 'download' : type === 'grid_fleet_model_start' ? 'start' : 'stop') }+ // A start or stop for the community grid of this computer's OS (`osGrid`): run there, for its members.+ const community = payload.community === true && type !== 'grid_fleet_model_download'+ const target = community ? await localModels.communityGrid() : gridName+ if (community && !target) return { error: 'This computer is in no community grid.' }+ return { ...await localModels.act(target, payload.modelId, type === 'grid_fleet_model_download' ? 'download' : type === 'grid_fleet_model_start' ? 'start' : 'stop') }} catch {return { error: 'Models are unavailable. Try again.' }}diff --git a/tui/Cargo.lock b/tui/Cargo.lockindex 5c1076c33..ea94602fa 100644--- a/tui/Cargo.lock+++ b/tui/Cargo.lock@@ -654,7 +654,7 @@ dependencies = [[[package]]name = "harness-tui"-version = "0.1.27"+version = "0.1.28"dependencies = ["alacritty_terminal","base64",diff --git a/tui/Cargo.toml b/tui/Cargo.tomlindex d1e0feead..f20fca464 100644--- a/tui/Cargo.toml+++ b/tui/Cargo.toml@@ -1,6 +1,6 @@[package]name = "harness-tui"-version = "0.1.27"+version = "0.1.28"edition = "2024"[dependencies]diff --git a/tui/README.md b/tui/README.mdindex 969db73e8..fdb31e1e1 100644--- a/tui/README.md+++ b/tui/README.md@@ -657,6 +657,16 @@ notify = true # OS notifications through the terminal`hn --keys` lists every binding, tmux-style, and reports problems in either file.+## Models on Omarchy++On an Omarchy computer in Omagrid, a local model that is not running yet offers+`[ Personal grid ] [ Omarchy community ]` in its Models preview: `←` and `→` choose (with nothing+searched), Enter runs it there. On the community grid it serves anyone in Omagrid and your harness+stays on its model; pick it under Shared with you to use it. A model that serves shows a+`Grid │ Requests Out In Cached` table of what this computer answered on each grid.+Other computers see none of this: `set -g @hn-models-serving-os omarchy` is the default, and+it takes `macos`, `linux` or `all` too.+## Environment| Variable | |diff --git a/tui/src/input.rs b/tui/src/input.rsindex b35fac591..13ccdaaa9 100644--- a/tui/src/input.rs+++ b/tui/src/input.rs@@ -878,6 +878,8 @@ fn fill_rows(app: &App, kind: &PickerKind, picker: &mut Picker) {}picker.right_half = true;picker.hints = vec![("enter", "use · get"), ("C-s", "stop a local model")];+ // Where a local model runs, its preview's Run on buttons (on a computer that offers them).+ if crate::models::community_label(app).is_some() { picker.hints.push(("←→", "choose")) }picker.empty = if crate::models::target(app).is_none() { crate::models::no_target_why(app) } else { "Loading its models…".into() };picker.status = crate::models::target(app).and_then(|t| app.fleet.agent(&t.machine, &t.agent)).map(|a| a.name.clone()).unwrap_or_default();}@@ -2416,6 +2418,15 @@ fn picker_key(app: &mut App, key: KeyEvent, kind: PickerKind, picker: Picker) {End::Stay => {}}} else {+ // Models: → chooses where a local model runs as its community, ← as Personal grid (its preview's+ // Run on buttons; ← on Personal grid stays there) — a plain arrow with nothing searched, on a row+ // that offers the choice. Anywhere else the arrows are the list's, as before.+ if matches!(kind, PickerKind::Models) && !ctrl && !alt && !shift && matches!(key.code, KeyCode::Left | KeyCode::Right)+ && crate::models::searched(&picker).is_empty() {+ if let Some(id) = picker.current_id() {+ if crate::models::choose_run_on(app, &id, key.code == KeyCode::Right) { picker.armed = None; app.modal = Some(Modal::Picker { kind, picker }); return }+ }+ }// The look/theme picker: right on a section opens it, left/Esc steps out one level (a plain// arrow with an empty query — with a query they edit the query, as fzf's do).if matches!(kind, PickerKind::Theme) {diff --git a/tui/src/models.rs b/tui/src/models.rsindex cf5798f01..501fc276f 100644--- a/tui/src/models.rs+++ b/tui/src/models.rs@@ -77,6 +77,26 @@ pub struct LocalModel {pub app: Option<String>,/// The names the grid lists it under while it runs here (`servedAs`; absent from an older daemon).pub served_as: Vec<String>,+ /// Every grid this computer serves it on, with what its engine answered there (`servedOn`; absent+ /// from an older daemon).+ pub served_on: Vec<ServedOn>,+}++/// A grid this computer serves a model on, and what this computer's engine answered there over the+/// grid's window — none of the other machines' figures. No figures: its grid sleeps.+#[derive(Clone, Debug, Default, PartialEq)]+pub struct ServedOn { pub grid: String, pub requests: Option<f64>,+ /// Tokens its engine wrote, was sent, and reused from its prompt cache (part of [tokens_in]).+ pub tokens_out: Option<f64>, pub tokens_in: Option<f64>, pub tokens_cached: Option<f64>, pub window_secs: Option<f64>,+ /// The names that grid lists it under: what a harness moves onto it there by (`servedAs`).+ pub served_as: Vec<String> }++impl ServedOn {+ fn from(v: &Value) -> Option<ServedOn> {+ Some(ServedOn { grid: text(&v["grid"])?, requests: num(&v["requests"]), tokens_out: num(&v["tokensOut"]), tokens_in: num(&v["tokensIn"]),+ tokens_cached: num(&v["tokensCached"]), window_secs: num(&v["windowSeconds"]),+ served_as: v["servedAs"].as_array().map(|a| a.iter().filter_map(|s| s.as_str().map(str::to_string)).collect()).unwrap_or_default() })+ }}impl LocalModel {@@ -88,7 +108,8 @@ impl LocalModel {tok_s: num(&v["tokensPerSecond"]), requests: num(&v["requests"]), window_secs: num(&v["windowSeconds"]),context: num(&v["contextWindow"]), est_tok_s: num(&v["estTokS"]), params_b: num(&v["paramsB"]),operation: Operation::parse(&v["operation"]), asleep: v["gridAsleep"] == true, app: text(&v["app"]),- served_as: v["servedAs"].as_array().map(|a| a.iter().filter_map(|s| s.as_str().map(str::to_string)).collect()).unwrap_or_default(), id,+ served_as: v["servedAs"].as_array().map(|a| a.iter().filter_map(|s| s.as_str().map(str::to_string)).collect()).unwrap_or_default(),+ served_on: v["servedOn"].as_array().map(|a| a.iter().filter_map(ServedOn::from).collect()).unwrap_or_default(), id,})}pub fn running(&self) -> bool { self.state == "running" }@@ -99,7 +120,8 @@ impl LocalModel {pub fn answers_to(&self, id: &str) -> bool {self.id.eq_ignore_ascii_case(id) || self.name.eq_ignore_ascii_case(id) || self.served_as.iter().any(|s| s.eq_ignore_ascii_case(id))}- /// Its name as shown: without the quantization a file name ends in, which the Quant line says.+ /// Its name as shown: without the quantization a file name ends in, which the Quant line says+ /// where two downloads of one model need it./// [name] stays whole — it is what the grid serves it as, and what a harness is matched to it by.pub fn shown(&self) -> String { without_quant(&self.name).to_string() }pub fn downloaded(&self) -> bool { self.state == "downloaded" || self.running() }@@ -143,7 +165,13 @@ pub struct Snapshot { pub models: Vec<LocalModel>, pub memory: Option<f64>, pub/// What the catalog fits models to, and whether that is an NVIDIA card's VRAM (`fitMemory: vram`)/// with its cards' VRAM in all: [memory] is the machine's RAM, not what such a model runs in.pub fit: Option<f64>, pub fit_vram: bool, pub gpu_memory: Option<f64>,- pub grid_setup_needed: bool, pub grid_setup_error: Option<String> }+ pub grid_setup_needed: bool, pub grid_setup_error: Option<String>,+ /// The OS grid this computer claims, as grid names it: `macos`, `linux`, `omarchy` (absent from an+ /// older daemon, and for no OS grid).+ pub os: Option<String>,+ /// The community grid of that OS this account is in (`osGrid`: `Omagrid`), where the Run on+ /// community button runs a model. None: in none, or an older daemon.+ pub os_grid: Option<String> }/// None when there is no list — a daemon too old for it, or a reply that failed.pub fn parse_local(reply: &Value) -> Option<Snapshot> {@@ -154,6 +182,7 @@ pub fn parse_local(reply: &Value) -> Option<Snapshot> {notice: text(&reply["notice"]), busy: reply["busy"] == true, supports_download: reply["supportsDownload"] == true,grid_setup_needed: reply["gridSetupNeeded"] == true, grid_setup_error: text(&reply["gridSetupError"]),fit: num(&reply["fitBytes"]).filter(|m| *m > 0.0), fit_vram: reply["fitMemory"] == "vram", gpu_memory: num(&reply["gpuMemoryBytes"]).filter(|m| *m > 0.0),+ os: text(&reply["os"]), os_grid: text(&reply["osGrid"]),})}@@ -355,6 +384,9 @@ pub struct Use {/// that one answers until this one can start.pub stops: Option<(String, String)>,pub identity: Option<crate::session_close::Identity>,+ /// Run on the community grid of this computer's OS (its button's label, `Omarchy community`), for its+ /// members: started and served there, no harness moved — one picks it under Shared with you.+ pub community: Option<String>,}/// An `agent_retarget` sent: the harness, the model it goes to (empty: its own login), and when —@@ -368,13 +400,20 @@ const SWITCH_FOR: Duration = Duration::from_secs(60);/// A Use over: its row, its model's name, the step it reached, and why it failed (None: ready);/// [seen]: the cursor has been on its row since (leaving the row then ends it).#[derive(Clone, Debug)]-pub struct Ended { pub row: String, pub name: String, pub step: Step, pub failed: Option<String>, pub seen: bool, pub stops: Option<String> }+pub struct Ended { pub row: String, pub name: String, pub step: Step, pub failed: Option<String>, pub seen: bool, pub stops: Option<String>,+ /// A run on the community grid ([Use::community]).+ pub community: Option<String> }-/// A Use's steps, as its preview lists them: a stop of the model running here only when it makes one.-pub fn steps(stops: Option<&str>) -> Vec<String> {+/// A Use's steps, as its preview lists them: a stop of the model running here only when it makes one;+/// a run on [community] ends serving there, with no harness to switch.+pub fn steps(stops: Option<&str>, community: Option<&str>) -> Vec<String> {let mut out = vec!["Download".to_string()];out.extend(stops.map(|name| format!("Stop {name}")));- out.extend(["Start", "Serve", "Switch harness"].map(String::from));+ out.push("Start".into());+ match community {+ Some(label) => out.push(format!("Serve on {label}")),+ None => out.extend(["Serve", "Switch harness"].map(String::from)),+ }out}@@ -470,6 +509,10 @@ pub struct Models {/// The first Enter's question on a row (row id, words), in its preview until Enter, Esc or the/// cursor leaves the row.pub confirm: Option<(String, String)>,+ /// The row whose preview has its other Run on button chosen (→): the community button on a model not+ /// running yet, Enter runs it there; the Personal grid button on one running on the community grid,+ /// Enter also runs it on the personal grid. None (←, and where every row starts): Enter's Use.+ pub run_other: Option<String>,/// How the last Use ended: its preview's checklist and ✓ / ✗ stay until the cursor leaves its/// row or another action starts.pub ended: Option<Ended>,@@ -592,6 +635,8 @@ fn served_in(grids: Option<&Grids>, m: &LocalModel) -> Option<(String, String)>/// The model running on this computer besides [m]: the one a Use of [m] stops first.fn other_running(app: &App, m: &LocalModel) -> Option<LocalModel> {+ // (One running on the community grid does not count: one local model runs at a time on the personal+ // grid; a computer may serve its community beside it — owner, 2026-10-13.)app.models_view.local.get(&app.fleet.local_id)?.models.iter().find(|o| o.can_stop && o.id != m.id).cloned()}@@ -659,10 +704,13 @@ pub fn facts(app: &App, m: &LocalModel, t: Option<&Target>) -> Facts {let other = other_running(app, m).map(|o| o.shown());let runs = t.is_some_and(|t| can_run(app, &t.engine));let served = served_in(v.grids.get(machine), m);- let in_use = t.is_some_and(|t| m.running() && !t.grid_model.is_empty()- && (served.as_ref().is_some_and(|(_, id)| id.eq_ignore_ascii_case(&t.grid_model)) || m.answers_to(&t.grid_model)));+ // Running on the community grid alone: the name it is listed under there is it too.+ let community = if m.running() || !on_community(app, m) { None } else { community_served(app, m).map(|(_, name)| name) };+ let on_community_as = |id: &str| community.as_ref().is_some_and(|n| n.eq_ignore_ascii_case(id));+ let in_use = t.is_some_and(|t| !t.grid_model.is_empty() && (on_community_as(&t.grid_model) || m.running()+ && (served.as_ref().is_some_and(|(_, id)| id.eq_ignore_ascii_case(&t.grid_model)) || m.answers_to(&t.grid_model))));let get = !m.downloaded() && m.can_start && !busy && online;- let names = |id: &str| m.answers_to(id) || served.as_ref().is_some_and(|(_, s)| s.eq_ignore_ascii_case(id));+ let names = |id: &str| m.answers_to(id) || served.as_ref().is_some_and(|(_, s)| s.eq_ignore_ascii_case(id)) || on_community_as(id);Facts {switching: switching_for(app, t).is_some_and(|to| !to.is_empty() && names(to)),failed: op.as_ref().is_some_and(Operation::failed),@@ -768,6 +816,9 @@ fn local_row(app: &App, m: &LocalModel, t: Option<&Target>, group: &str) -> Row// No mark before the name (owner, 2026-10-13: "remove these silly icons"): the word on the right// says it — ✓ In use, Running, Downloaded, Get, Failed, a download's progress.let word = f.word(m);+ // Run on the community grid alone: Shared (the own grid's list calls it downloaded) — a word of its own+ // still wins: under way, failed, in use.+ let word = if !m.running() && on_community(app, m) && matches!(word.as_str(), "Use" | "Get" | "Downloaded" | "") { "Shared".to_string() } else { word };// As the desktop's row: the name alone, then its size and speed (or the app it runs in) in// columns that line up, then the word — the word alone where the list is narrow. Its// quantization and app are in the preview, and found by a search.@@ -1008,6 +1059,11 @@ pub enum Plan {Use { model: String, download: bool },/// A download, start or stop alone (no harness to move).Act { model: String, action: &'static str },+ /// A local model run on the community grid of this computer's OS: got, started and served there, no+ /// harness moved ([start_community]).+ Community { model: String, download: bool },+ /// A local model stopped on the community grid.+ StopCommunity(String),Wake(String),More,Api(String),@@ -1051,7 +1107,11 @@ fn api_payload(app: &App, api: &Api, model: &str, t: Option<&Target>) -> Result<}/// What Enter does on row [id].-pub fn plan_enter(app: &App, id: &str) -> Plan {+pub fn plan_enter(app: &App, id: &str) -> Plan { plan_enter_on(app, id, false) }++/// [plan_enter]; [personal]: on a model Shared on the community grid, its Personal grid button chosen — run+/// it on the personal grid too (a Use, the harness moved there), not onto it on the community grid.+fn plan_enter_on(app: &App, id: &str, personal: bool) -> Plan {let t = target(app);let t = t.as_ref();let v = &app.models_view;@@ -1100,6 +1160,17 @@ pub fn plan_enter(app: &App, id: &str) -> Plan {if let (true, Some(t), Some((grid, served))) = (f.use_running, t, f.served.clone()) {return Plan::Retarget { machine: t.machine.clone(), payload: json!({ "agentId": t.agent, "gridModel": served, "gridName": grid }), name: m.shown() };}+ // Running on the community grid alone (Shared): Enter moves this harness onto it there, as its Shared with+ // you row does — no second engine on the personal grid unless its Personal grid button asks for one+ // ([personal]; owner, 2026-10-13).+ if !personal && !m.running() && on_community(app, &m) {+ return match (t, community_served(app, &m)) {+ (None, _) => say("Running on its community grid — ^S stops it"),+ (Some(t), _) if !can_run(app, &t.engine) => Plan::Say(format!("{} runs only on its own login", engine_label(&t.engine))),+ (Some(t), Some((grid, served))) => Plan::Retarget { machine: t.machine.clone(), payload: json!({ "agentId": t.agent, "gridModel": served, "gridName": grid }), name: m.shown() },+ (Some(_), None) => say("Not serving yet — try again in a moment"),+ };+ }if m.running() {return match t {None => say("Running — ^S stops it"),@@ -1146,6 +1217,11 @@ pub fn plan_stop(app: &App, id: &str) -> Plan {let Some(m) = id.strip_prefix("mv:local:").and_then(|model| local_model(app, model)) else { return Plan::Nothing };let f = facts(app, &m, None);if f.busy { return Plan::Say("Wait for the current model operation to finish.".into()) }+ // Run on the community grid alone: stopped there.+ if !m.can_stop && on_community(app, &m) {+ let label = community_label(app).unwrap_or_else(|| "the community grid".into());+ return Plan::Arm(format!("^S again stops {} on {label} — the download is kept", m.shown()), Box::new(Plan::StopCommunity(m.id.clone())));+ }if !m.can_stop { return Plan::Say(if m.running() { "Other models share its engine — stop it from the desktop's Model Manager".into() } else { "It is not running".into() }) }Plan::Arm(format!("^S again stops {} — the download is kept", m.shown()), Box::new(Plan::Act { model: m.id.clone(), action: "stop" }))}@@ -1157,7 +1233,13 @@ pub fn choose(app: &mut App, picker: &mut Picker, id: &str, stop: bool) {picker.say(no_target_why(app)); return;}let key = format!("{id}\u{1f}{}", if stop { "stop" } else { "enter" });- let plan = if stop { plan_stop(app, id) } else { plan_enter(app, id) };+ // (Its other button chosen — → on its preview — Enter runs it on the community grid, or, on one Shared+ // there, on the personal grid too.)+ let other = app.models_view.run_other.as_deref() == Some(id);+ let plan = if stop { plan_stop(app, id) }+ else if other && run_on_choice(app, id).is_some() { plan_community(app, id) }+ else if other && personal_choice(app, id) { plan_enter_on(app, id, true) }+ else { plan_enter(app, id) };run(app, picker, plan, &key);}@@ -1201,6 +1283,9 @@ fn run(app: &mut App, picker: &mut Picker, plan: Plan, key: &str) {// (Its steps are the preview's checklist.)Plan::Use { model, download } => start_use(app, &model, download),Plan::Act { model, action } => { picker.say(format!("{}…", pending_word(action))); act(app, &model, action) }+ // (Its steps are the preview's checklist, as a Use's.)+ Plan::Community { model, download } => start_community(app, &model, download),+ Plan::StopCommunity(model) => { picker.say("Stopping…"); act_on(app, &model, "stop", true) }Plan::Wake(name) => { wake(app, &name); picker.say(STARTING_UP_WAIT) }Plan::More => {let before: std::collections::HashSet<String> = rows(app, "").into_iter().map(|r| r.id).collect();@@ -1730,13 +1815,18 @@ pub fn on_api_models(app: &mut App, id: &str, reply: Result<Value, RpcError>) {}/// A download, start or stop of this computer's [model].-fn act(app: &mut App, model: &str, action: &'static str) {+fn act(app: &mut App, model: &str, action: &'static str) { act_on(app, model, action, false) }++/// [act], on the community grid of this computer's OS when [community] (a start or stop; the daemon's+/// `community`).+fn act_on(app: &mut App, model: &str, action: &'static str, community: bool) {let machine = app.fleet.local_id.clone();app.models_view.pending = Some((machine.clone(), model.to_string(), action));app.models_view.use_error = None;let ty = match action { "download" => "grid_fleet_model_download", "start" => "grid_fleet_model_start", _ => "grid_fleet_model_stop" };let m = machine.clone();- if !read_rpc(app, &machine, "act", ty, json!({ "modelId": model }), Duration::from_secs(30), move |app, r| on_act(app, &m, r)) {+ let payload = if community { json!({ "modelId": model, "community": true }) } else { json!({ "modelId": model }) };+ if !read_rpc(app, &machine, "act", ty, payload, Duration::from_secs(30), move |app, r| on_act(app, &m, r)) {app.models_view.pending = None;app.say("This computer is not connected", theme::WARN);}@@ -1800,7 +1890,7 @@ fn on_retarget_for(app: &mut App, name: &str, job: bool, reply: Result<Value, Rplet used = if job { app.models_view.using.take() } else { None };let who = app.models_view.switching.as_ref().and_then(|s| app.fleet.agent(&s.machine, &s.agent)).map(|a| a.name.clone()).unwrap_or_else(|| "the harness".into());// (A Use's last step: its end, and the one toast that says it.)- let end = |app: &mut App, failed: Option<String>| if let Some(u) = &used { app.models_view.ended = Some(Ended { row: format!("mv:local:{}", u.model), name: u.name.clone(), step: Step::Switch, failed, seen: false, stops: u.stops.as_ref().map(|(_, n)| n.clone()) }) };+ let end = |app: &mut App, failed: Option<String>| if let Some(u) = &used { app.models_view.ended = Some(Ended { row: format!("mv:local:{}", u.model), name: u.name.clone(), step: Step::Switch, failed, seen: false, stops: u.stops.as_ref().map(|(_, n)| n.clone()), community: None }) };match reply {// Moved: the list has done its job — it closes, and the status line says so.Ok(_) if used.is_some() => { end(app, None); if same_panel { close(app); } app.say(format!("✓ {name} is ready · {who} is on it"), theme::ONLINE) }@@ -1824,7 +1914,14 @@ pub fn close(app: &mut App) {/// What a Use does next, from what the daemon last said.#[derive(Clone, Debug, PartialEq)]-pub enum Next { Wait, Stop, Start, Serve, Retarget { grid: String, model: String }, Fail(String) }+pub enum Next { Wait, Stop, Start, Serve, Retarget { grid: String, model: String },+ /// A run on the community grid serves there: over, no harness to move.+ Shared, Fail(String) }++/// Whether [m] serves on the community grid [snap] names (its `servedOn`): [on_community] from a snapshot.+fn on_grid(snap: Option<&Snapshot>, m: &LocalModel) -> bool {+ snap.and_then(|s| s.os_grid.as_deref()).is_some_and(|g| m.served_on.iter().any(|r| r.grid == g))+}/// The model [job] stops first, still able to stop in [snap]: it runs here yet.fn still_running(job: &Use, snap: Option<&Snapshot>) -> bool {@@ -1857,7 +1954,16 @@ pub fn next(job: &Use, snap: Option<&Snapshot>, op: Option<&Operation>, pending:}Step::Start => {if let Some(o) = op.filter(|o| o.failed()) { return Next::Fail(o.error.clone().unwrap_or_else(|| "Could not start this model. Try again.".into())) }- if m.is_some_and(|m| m.running()) && !active { return Next::Serve }+ // (On the community grid: started once the daemon's start is done — its own start, not an older+ // operation on the row — or it serves there; the own grid does not list it.)+ let started = if job.community.is_some() { op.is_some_and(|o| !o.active() && o.action == "start") || m.is_some_and(|m| on_grid(snap, m)) } else { m.is_some_and(|m| m.running()) };+ if started && !active { return Next::Serve }+ if late { Next::Fail(STILL.into()) } else { Next::Wait }+ }+ Step::Serve if job.community.is_some() => {+ // (A start that failed late says why, not that it is still starting.)+ if let Some(o) = op.filter(|o| o.failed() && o.action == "start") { return Next::Fail(o.error.clone().unwrap_or_else(|| "Could not start this model. Try again.".into())) }+ if m.is_some_and(|m| on_grid(snap, m)) { return Next::Shared }if late { Next::Fail(STILL.into()) } else { Next::Wait }}Step::Serve => {@@ -1878,20 +1984,31 @@ fn start_use(app: &mut App, model: &str, download: bool) {let stops = other_running(app, &m).map(|o| { let shown = o.shown(); (o.id, shown) });let step = match (&stops, download && supports) { (_, true) => Step::Get, (Some(_), false) => Step::Stop, (None, false) => if download { Step::Get } else { Step::Start } };let identity = app.fleet.agent(&t.machine, &t.agent).map(|a| crate::session_close::Identity::capture(app, a));- app.models_view.using = Some(Use { model: m.id.clone(), name: m.shown(), machine: t.machine, agent: t.agent, step, stops: stops.clone(), since: Instant::now(), identity });+ app.models_view.using = Some(Use { model: m.id.clone(), name: m.shown(), machine: t.machine, agent: t.agent, step, stops: stops.clone(), since: Instant::now(), identity, community: None });app.models_view.ended = None;+ // (A run begun, its button choice is spent: the row comes back as Use.)+ app.models_view.run_other = None;match (step, stops) {(Step::Stop, Some((other, _))) => act(app, &other, "stop"),_ => act(app, &m.id, if download && supports { "download" } else { "start" }),}}+/// A run on the community grid serves there: over — its preview says so, with one toast.+fn shared(app: &mut App) {+ let Some(job) = app.models_view.using.take() else { return };+ let label = job.community.clone().unwrap_or_default();+ app.models_view.ended = Some(Ended { row: format!("mv:local:{}", job.model), name: job.name.clone(), step: Step::Serve, failed: None, seen: false,+ stops: job.stops.as_ref().map(|(_, n)| n.clone()), community: job.community.clone() });+ app.say(format!("✓ {} runs on {label}", job.name), theme::ONLINE);+}+/// The Use stops at its step: its row's preview says why (✗) and how to try again, and one toast.fn fail(app: &mut App, why: &str) {let Some(job) = app.models_view.using.take() else { return };let row = format!("mv:local:{}", job.model);app.models_view.use_error = Some((row.clone(), why.to_string()));- app.models_view.ended = Some(Ended { row, name: job.name.clone(), step: job.step, failed: Some(why.to_string()), seen: false, stops: job.stops.as_ref().map(|(_, n)| n.clone()) });+ app.models_view.ended = Some(Ended { row, name: job.name.clone(), step: job.step, failed: Some(why.to_string()), seen: false, stops: job.stops.as_ref().map(|(_, n)| n.clone()), community: job.community.clone() });app.say(format!("✗ {}: {why}", job.name), theme::DANGER);}@@ -1913,12 +2030,14 @@ pub fn advance(app: &mut App) {match next(&job, snap, op.as_ref(), pending, v.grids.get(&machine), Instant::now()) {Next::Wait => {}Next::Stop => { step(app, Step::Stop); if let Some((other, _)) = &job.stops { act(app, other, "stop") } }- Next::Start => { step(app, Step::Start); act(app, &job.model, "start") }- Next::Serve => { step(app, Step::Serve); read_grids(app, &machine) }+ Next::Start => { step(app, Step::Start); act_on(app, &job.model, "start", job.community.is_some()) }+ // (On the community grid, this computer's list says when it serves there: read it again.)+ Next::Serve => { step(app, Step::Serve); if job.community.is_some() { read_local(app, &machine) } else { read_grids(app, &machine) } }Next::Retarget { grid, model } => {step(app, Step::Switch);retarget(app, &job.machine, json!({ "agentId": job.agent, "gridModel": model, "gridName": grid }), &job.name, true);}+ Next::Shared => shared(app),Next::Fail(why) => fail(app, &why),}}@@ -2025,20 +2144,179 @@ fn bold(t: impl Into<String>) -> Line<'static> { Line::from(span(t, Style::defaufn warn(t: impl Into<String>) -> Line<'static> { Line::from(span(t, fg(theme::WARN))) }fn dim(t: impl Into<String>) -> Line<'static> { Line::from(span(t, Style::default().add_modifier(Modifier::DIM))) }+/// The OS grids whose computers show a local model's "Serving on" table, as grid names them+/// (`macos`, `linux`, `omarchy`; `all` for every computer), separated by commas or spaces.+pub const SERVING_OS: &str = "@hn-models-serving-os";+/// Omarchy's alone, for now (Omagrid): another computer shows them only when the option names it.+const SERVING_OS_DEFAULT: &str = "omarchy";++/// Whether this computer shows the "Serving on" table and the Run on buttons: its OS is one+/// [SERVING_OS] names.+fn serving_shown(app: &App) -> bool {+ let shown = app.options.get(SERVING_OS, "", None).unwrap_or_else(|| SERVING_OS_DEFAULT.into()).to_ascii_lowercase();+ let shown: Vec<&str> = shown.split([',', ' ', '\t']).filter(|w| !w.is_empty()).collect();+ let os = app.models_view.local.get(&app.fleet.local_id).and_then(|s| s.os.clone());+ shown.contains(&"all") || os.is_some_and(|os| shown.contains(&os.as_str()))+}++/// The rows of [m]'s "Serving on" table, where this computer shows one: the grids it served [m] on,+/// with what its own engine answered there — only a grid it has answered something on (owner,+/// 2026-10-13: no empty values). None: not shown here, or nothing to list.+fn serving_rows(app: &App, m: &LocalModel) -> Option<Vec<ServedOn>> {+ if !serving_shown(app) { return None }+ let answered = |n: Option<f64>| n.is_some_and(|n| n > 0.0);+ // The community grid by its button's name (`macOS community`), not grid's (`macOS`).+ let community = app.models_view.local.get(&app.fleet.local_id).and_then(|s| s.os_grid.clone()).zip(community_label(app));+ let rows: Vec<ServedOn> = m.served_on.iter().filter(|r| answered(r.requests) || answered(r.tokens_out)).map(|r| match &community {+ Some((grid, label)) if *grid == r.grid => ServedOn { grid: label.clone(), ..r.clone() },+ _ => r.clone(),+ }).collect();+ (!rows.is_empty()).then_some(rows)+}++/// The second Run on button's label, `Omarchy community` (`macOS community`): a computer that shows+/// the buttons, in the community grid of its OS. None: no such button here.+pub fn community_label(app: &App) -> Option<String> {+ let snap = app.models_view.local.get(&app.fleet.local_id)?;+ snap.os_grid.as_ref()?;+ let os = match snap.os.as_deref()? { "macos" => "macOS", "linux" => "Linux", "omarchy" => "Omarchy", _ => return None };+ serving_shown(app).then(|| format!("{os} community"))+}++/// Whether [m] runs on the community grid of this computer's OS now (its `servedOn` names that grid) —+/// said only on a computer that shows these ([serving_shown]): elsewhere its row and ^S are as before.+fn on_community(app: &App, m: &LocalModel) -> bool { serving_shown(app) && on_grid(app.models_view.local.get(&app.fleet.local_id), m) }++/// The community grid [m] runs on and the name it lists it under (grid, model): what a harness moves onto+/// it there by. None: not listed under a name yet.+fn community_served(app: &App, m: &LocalModel) -> Option<(String, String)> {+ let grid = app.models_view.local.get(&app.fleet.local_id)?.os_grid.clone()?;+ let name = m.served_on.iter().find(|r| r.grid == grid)?.served_as.first()?.clone();+ Some((grid, name))+}++/// Row [id]'s Run on choice — its community button's label — where its preview offers one: a local model+/// not running anywhere yet that this computer can run (owner: where it runs is chosen before it runs, on+/// the preview's buttons — not a dialog).+pub fn run_on_choice(app: &App, id: &str) -> Option<String> {+ let label = community_label(app)?;+ let m = local_model(app, id.strip_prefix("mv:local:")?)?;+ let machine = &app.fleet.local_id;+ if m.running() || on_community(app, &m) || app.models_view.busy(machine) || app.models_view.using.is_some() { return None }+ // Grid's own models alone (another app's — Ollama, LM Studio — runs in that app, on the own grid), and+ // only one this computer can start now: as the Personal grid button would.+ let grids_own = m.app.as_deref().is_none_or(|app| app == GRID_APP);+ (grids_own && m.can_start).then_some(label)+}++/// What a model Grid's own engine runs says it runs in (`app`), as the daemon names it.+const GRID_APP: &str = "Grid";++/// Whether row [id] — a model running on the community grid alone (Shared) — offers to run it on the+/// personal grid too: its one `[ Personal grid ]` button, not chosen until → (owner, 2026-10-13: Enter+/// stays Use, moving the harness onto it on the community grid).+pub fn personal_choice(app: &App, id: &str) -> bool {+ let Some(m) = id.strip_prefix("mv:local:").and_then(|model| local_model(app, model)) else { return false };+ let machine = &app.fleet.local_id;+ !m.running() && on_community(app, &m) && m.app.as_deref().is_none_or(|app| app == GRID_APP) && m.can_start+ && !app.models_view.busy(machine) && app.models_view.using.is_none()+}++/// → on row [id] chooses its other Run on button — the community on a model not running yet, Personal grid+/// on one running on the community grid — and ← leaves it, back to Enter's Use; never round (owner: "left+/// on personal does not choose it"). False: the row offers no choice, and the arrow is the list's as before.+pub fn choose_run_on(app: &mut App, id: &str, other: bool) -> bool {+ if run_on_choice(app, id).is_none() && !personal_choice(app, id) { return false }+ let v = &mut app.models_view;+ v.run_other = other.then(|| id.to_string());+ v.confirm = None;+ true+}++/// Enter on row [id] with its community button chosen: run it there, beside whatever runs on the personal+/// grid (owner: a computer runs its own models and serves its community). A download is gigabytes: asked+/// first, as Get asks.+fn plan_community(app: &App, id: &str) -> Plan {+ let Some(label) = run_on_choice(app, id) else { return Plan::Nothing };+ let Some(m) = id.strip_prefix("mv:local:").and_then(|model| local_model(app, model)) else { return Plan::Nothing };+ let go = Plan::Community { model: m.id.clone(), download: !m.downloaded() };+ if m.downloaded() { return go }+ let size = m.size.map(gb).map(|s| format!(" ({s})")).unwrap_or_default();+ Plan::Arm(format!("Get {}{size}, run it on {label}? Enter · Esc", m.shown()), Box::new(go))+}++/// Run [model] on the community grid: got (when [download]), started+/// there and waited for until it serves — the Use's steps, with no harness to move.+fn start_community(app: &mut App, model: &str, download: bool) {+ let Some(label) = community_label(app) else { return };+ let Some(m) = local_model(app, model) else { return };+ let supports = app.models_view.local.get(&app.fleet.local_id).is_some_and(|s| s.supports_download);+ // (Beside the model running on the personal grid, which it leaves running: owner, 2026-10-13.)+ let step = if download && supports { Step::Get } else { Step::Start };+ app.models_view.using = Some(Use { model: m.id.clone(), name: m.shown(), machine: app.fleet.local_id.clone(), agent: String::new(), step,+ stops: None, since: Instant::now(), identity: None, community: Some(label) });+ app.models_view.ended = None;+ // (Its community button choice spent: Shared there next, its Personal grid button is not chosen.)+ app.models_view.run_other = None;+ if step == Step::Get { act(app, &m.id, "download") } else { act_on(app, &m.id, "start", true) }+}++/// A grid's name in the table: at most this many characters, an ellipsis past it.+const SERVING_NAME_MAX: usize = 18;++/// A count as the table says it: `950`, `12.3k`, `180k`, `1.1M`, `2.4B` — cut, never rounded up, so it+/// never claims more than was counted, nor reads `1000k` (owner: thousands k, millions M, billions B).+pub fn count_label(n: u64) -> String {+ let cut = |n: u64, unit: u64, suffix: &str| {+ let tenths = n / (unit / 10);+ if tenths >= 1000 { format!("{}{suffix}", tenths / 10) } else { format!("{}.{}{suffix}", tenths / 10, tenths % 10).replace(&format!(".0{suffix}"), suffix) }+ };+ match n {+ 0..=999 => n.to_string(),+ 1_000..=999_999 => cut(n, 1_000, "k"),+ 1_000_000..=999_999_999 => cut(n, 1_000_000, "M"),+ _ => cut(n, 1_000_000_000, "B"),+ }+}++/// Columns between two of the table's columns.+const SERVING_GAP: &str = " ";++/// [rows] as the preview shows them: a dim header with one rule under it, no box (owner, 2026-10-13: "no+/// table, just a border under it") — each grid, then its requests and the tokens its engine wrote, was+/// sent and reused, centred in their columns (`—`: none counted); no legend under it (owner).+fn serving_table(rows: &[ServedOn]) -> Vec<Line<'static>> {+ let name = |g: &str| if g.chars().count() > SERVING_NAME_MAX { format!("{}…", g.chars().take(SERVING_NAME_MAX - 1).collect::<String>()) } else { g.to_string() };+ let figure = |n: Option<f64>| n.map_or_else(|| "—".to_string(), |n| count_label(n.round() as u64));+ let head = ["Grid", "Requests", "Out", "In", "Cached"];+ let cells: Vec<[String; 5]> = rows.iter().map(|r| [name(&r.grid), figure(r.requests), figure(r.tokens_out), figure(r.tokens_in), figure(r.tokens_cached)]).collect();+ let widths: Vec<usize> = (0..5).map(|i| cells.iter().map(|c| c[i].chars().count()).chain([head[i].len()]).max().unwrap_or(0)).collect();+ // A row of [texts]: the grid's name left-aligned, a dim rule down after it (owner: the grid column+ // ruled off), then its figures centred under their headers.+ let figures = |texts: &[&str]| texts.iter().zip(&widths[1..]).map(|(t, &w)| format!("{t:^w$}")).collect::<Vec<_>>().join(SERVING_GAP).trim_end().to_string();+ let w = widths[0];+ let rule_dim = Style::default().add_modifier(Modifier::DIM);+ let row = |texts: [&str; 5], style: Style| Line::from(vec![span(format!("{:<w$}", texts[0]), style), span(" │ ", rule_dim), span(figures(&texts[1..]), style)]);+ let across = widths[1..].iter().sum::<usize>() + SERVING_GAP.len() * (widths.len() - 2);+ let mut out = vec![row(head, rule_dim), dim(format!("{}┼{}", "─".repeat(w + 1), "─".repeat(across + 1)))];+ out.extend(cells.iter().map(|c| row([&c[0], &c[1], &c[2], &c[3], &c[4]], Style::default())));+ out+}+/// A local row's first-Enter question, or its Use's checklist — Download · Start · Serve · Switch/// harness — and how it ended: what its preview says under its status.fn use_lines(app: &App, m: &LocalModel, id: &str) -> Vec<Line<'static>> {let v = &app.models_view;if let Some((_, words)) = v.confirm.as_ref().filter(|(row, _)| row == id) { return vec![Line::raw(""), Line::from(span(words.clone(), theme::bold(theme::accent())))] }let ended = v.ended.as_ref().filter(|e| e.row == id);- let (step, op, since, stops) = match (v.using.as_ref().filter(|u| u.model == m.id), ended) {- (Some(u), _) => (u.step, v.op_for(&app.fleet.local_id, m).cloned(), Some(u.since), u.stops.as_ref().map(|(_, n)| n.clone())),- (None, Some(e)) => (e.step, None, None, e.stops.clone()),+ let (step, op, since, stops, community) = match (v.using.as_ref().filter(|u| u.model == m.id), ended) {+ (Some(u), _) => (u.step, v.op_for(&app.fleet.local_id, m).cloned(), Some(u.since), u.stops.as_ref().map(|(_, n)| n.clone()), u.community.clone()),+ (None, Some(e)) => (e.step, None, None, e.stops.clone(), e.community.clone()),_ => return vec![],};let ended = ended.filter(|_| since.is_none());let mut out = vec![Line::raw("")];- for (name, mark) in steps(stops.as_deref()).iter().zip(checklist(step, stops.is_some(), op.as_ref(), ended.map(|e| e.failed.is_none()))) {+ for (name, mark) in steps(stops.as_deref(), community.as_deref()).iter().zip(checklist(step, stops.is_some(), op.as_ref(), ended.map(|e| e.failed.is_none()))) {out.push(match mark {Mark::Done => Line::from(span(format!("✓ {name}"), fg(theme::ONLINE))),Mark::Now(Some(p)) => Line::from(span(format!("↻ {name} {} {}%", bar(p), percent(p)), fg(theme::accent()))),@@ -2048,7 +2326,14 @@ fn use_lines(app: &App, m: &LocalModel, id: &str) -> Vec<Line<'static>> {});}match ended.map(|e| (e.failed.as_ref(), &e.name)) {- Some((None, name)) => { out.push(Line::raw("")); out.push(Line::from(span(format!("✓ Ready · this harness is on {name}"), theme::bold(theme::ONLINE)))) }+ Some((None, name)) => {+ out.push(Line::raw(""));+ match &community {+ // (No harness moved: one picks it under Shared with you.)+ Some(label) => { out.push(Line::from(span(format!("✓ Ready · {name} runs on {label}"), theme::bold(theme::ONLINE)))); out.push(dim("Shared with you lists it.")) }+ None => out.push(Line::from(span(format!("✓ Ready · this harness is on {name}"), theme::bold(theme::ONLINE)))),+ }+ }Some((Some(why), _)) => { out.push(Line::raw("")); out.push(Line::from(span(format!("✗ Failed · {why}"), fg(theme::DANGER)))); out.push(Line::from(span("Enter tries again.", fg(theme::accent())))) }None => {}}@@ -2078,6 +2363,9 @@ pub fn preview(app: &App, id: &str) -> Vec<Line<'static>> {let status = if let Some(o) = f.op.as_ref().filter(|o| o.active()) { o.word() } else if let Some(p) = f.pending { p.to_string() } else if f.failed { "Failed · try again".into() }else if m.running() { "Running".into() } else if m.downloaded() { "Downloaded".into() } else { "Not downloaded".into() };let status = if f.switching { format!("{SWITCHING} this harness is moving onto it") } else if f.in_use { format!("{status} · this harness is on it") } else { status };+ // Run on the community grid alone: said where (the own grid's list calls it downloaded).+ let community = community_label(app).filter(|_| !m.running() && !active && f.pending.is_none() && on_community(app, &m));+ let status = match &community { Some(label) => format!("Running on {label}"), None => status };let mut out = vec![bold(m.shown()), Line::raw(status)];// (A Use's end says why it failed itself.)if !v.ended.as_ref().is_some_and(|e| e.row == id) { out.extend(failed) }@@ -2102,15 +2390,49 @@ pub fn preview(app: &App, id: &str) -> Vec<Line<'static>> {}if let Some(w) = m.context { out.push(kv("Context", format!("{} window", context_label(w as u64)))) }if let Some(p) = m.params_b { out.push(kv("Params", format!("{p}B"))) }- out.push(kv("Quant", m.quantization().unwrap_or_else(|| "—".into())));+ // Where these show ([serving_shown]): the quant only where it tells two downloads of one model apart+ // (the desktop's twins), their rows reading the same name. Elsewhere, as before: always.+ let twin = snap.is_some_and(|s| s.models.iter().any(|o| o.id != m.id && o.shown().eq_ignore_ascii_case(&m.shown())));+ if twin || !serving_shown(app) { out.push(kv("Quant", m.quantization().unwrap_or_else(|| "—".into()))) }out.push(kv("Machine", capital(here)));- if let (true, Some(r), Some(w)) = (m.running(), m.requests, m.window_secs) { out.push(kv("Window", format!("{} req / {}", r as u64, window_label(w)))) }+ // Where it serves, as a table (the own grid's requests among them), else the own grid's requests alone.+ let table = serving_rows(app, &m).map(|rows| serving_table(&rows));+ if let (None, true, Some(r), Some(w)) = (&table, m.running(), m.requests, m.window_secs) { out.push(kv("Window", format!("{} req / {}", r as u64, window_label(w)))) }if m.resting() { out.push(kv("State", "Resting until your next message")) }+ // Where it runs, chosen on its buttons (owner: Personal grid, or the community of this computer's OS),+ // the chosen one in the panel's chosen style — over the serving table (owner). Not running yet: both,+ // Personal grid chosen until →. Shared on the community grid: Personal grid alone, chosen only by →+ // (Enter's Use until then).+ let run_on = run_on_choice(app, id);+ let personal = personal_choice(app, id);+ let other_chosen = (run_on.is_some() || personal) && v.run_other.as_deref() == Some(id);+ let chosen = crate::settings::chrome().selected;+ let style = |on: bool| if on { chosen } else { Style::default() };+ let key = || span(format!("{:<9}", "Run on"), Style::default().add_modifier(Modifier::DIM));+ if let Some(label) = &run_on {+ out.push(Line::raw(""));+ out.push(Line::from(vec![key(), span("[ Personal grid ]", style(!other_chosen)), Span::raw(" "), span(format!("[ {label} ]"), style(other_chosen))]));+ } else if personal {+ out.push(Line::raw(""));+ out.push(Line::from(vec![key(), span("[ Personal grid ]", style(other_chosen))]));+ }+ if let Some(table) = table { out.push(Line::raw("")); out.extend(table) }let short = !m.downloaded() && f.pending.is_none() && !active && m.size.zip(snap.and_then(|s| s.free_disk)).is_some_and(|(s, d)| s + GIB > d);if short { out.push(warn(format!("Free up disk space on {here} to get it."))) }else if !m.downloaded() && !snap.is_some_and(|s| s.supports_download) && m.can_start && f.pending.is_none() && !active { out.push(warn(format!("Downloads and starts on {here}."))) }let mut said = Vec::new();- if !f.in_use {+ if let (true, Some(label)) = (other_chosen, &run_on) {+ // (Beside what runs on the personal grid: a community run stops nothing.)+ said.push(format!("Enter runs it on {label}: anyone in the {label} can call it. This harness stays on its model."));+ } else if other_chosen && personal {+ said.push(match &f.other {+ None => "Enter also runs it on your Personal grid, and moves this harness onto it there.".to_string(),+ Some(o) => format!("Enter stops {o}, also runs it on your Personal grid, and moves this harness onto it there."),+ });+ } else if let (Some(label), Some(_), false) = (&community, t, f.in_use) {+ // (Running there alone: Enter moves this harness onto it there — [plan_enter].)+ said.push(format!("Enter moves this harness onto it on {label}."));+ } else if !f.in_use {if f.get_use { said.push(match &f.other { None => "Enter gets it: downloads it, starts it, and moves this harness onto it.".to_string(), Some(o) => format!("Enter gets it: downloads it, stops {o}, starts it, and moves this harness onto it.") }) }else if f.get { said.push(match &f.other { None => "Enter downloads it.".into(), Some(o) => format!("Enter downloads it. Stop {o} to run it: one local model runs at a time.") }) }else if f.use_running { said.push("Enter moves this harness onto it.".into()) }@@ -2118,6 +2440,7 @@ pub fn preview(app: &App, id: &str) -> Vec<Line<'static>> {else if t.is_none() && m.downloaded() && !m.running() && m.can_start { said.push("Enter starts it.".into()) }}if m.can_stop { said.push("^S stops it and frees its memory. The download is kept.".into()) }+ else if let Some(label) = &community { said.push(format!("^S stops it on {label}. The download is kept.")) }if !said.is_empty() { out.push(Line::raw("")); out.extend(said.into_iter().map(|s| Line::from(span(s, fg(theme::accent()))))) }if let Some(e) = f.op.as_ref().and_then(|o| o.error.clone()) { out.push(warn(e)) }if let Some(e) = snap.and_then(|s| s.notice.clone()).or_else(|| v.local_error.get(&machine).cloned()) { out.push(warn(e)) }@@ -2666,7 +2989,7 @@ mod tests {assert!(text(&preview(&app, "mv:local:gemma-12b")).contains("✗ Failed · Stop a running model to make room"));// A download the daemon reports failed.- let job = Use { identity: None, model: "qwen-35b".into(), name: "Qwen".into(), machine: "local".into(), agent: "a1".into(), step: Step::Get, since: Instant::now(), stops: None };+ let job = Use { identity: None, model: "qwen-35b".into(), name: "Qwen".into(), machine: "local".into(), agent: "a1".into(), step: Step::Get, since: Instant::now(), stops: None, community: None };let failed = Operation::parse(&op("download", "downloading", "failed", None)).map(|mut o| { o.error = Some("The download stopped. Start again to resume.".into()); o });assert_eq!(next(&job, None, failed.as_ref(), false, None, Instant::now()), Next::Fail("The download stopped. Start again to resume.".into()));// Started, but never listed as served: after three minutes it says so.@@ -2696,8 +3019,10 @@ mod tests {assert_eq!(checklist(Step::Switch, false, None, Some(true)), [Done, Done, Done, Done]);assert_eq!(checklist(Step::Start, false, o("start", "starting", "failed", None).as_ref(), Some(false)), [Done, Failed, Later, Later]);assert_eq!(checklist(Step::Get, false, None, Some(false)), [Failed, Later, Later, Later]);- assert_eq!(steps(None), ["Download", "Start", "Serve", "Switch harness"]);- assert_eq!(steps(Some("Phi")), ["Download", "Stop Phi", "Start", "Serve", "Switch harness"]);+ assert_eq!(steps(None, None), ["Download", "Start", "Serve", "Switch harness"]);+ assert_eq!(steps(Some("Phi"), None), ["Download", "Stop Phi", "Start", "Serve", "Switch harness"]);+ // A run on the community grid ends serving there: no harness to switch.+ assert_eq!(steps(Some("Phi"), Some("macOS community")), ["Download", "Stop Phi", "Start", "Serve on macOS community"]);assert_eq!(checklist(Step::Stop, true, None, None), [Done, Now(None), Later, Later, Later]);assert_eq!(checklist(Step::Start, true, None, None), [Done, Done, Now(None), Later, Later]);assert_eq!(checklist(Step::Stop, true, None, Some(false)), [Done, Failed, Later, Later, Later]);@@ -2877,7 +3202,7 @@ mod tests {on_local(&mut app, "local", Ok(with_phi(gemma("downloaded", Value::Null), qwen("downloaded", Value::Null), phi("downloaded", op_on("phi", "stop", "stopping", "done")))));assert_eq!(last_sent(&app), ("local".into(), "grid_fleet_model_start".into(), json!({ "modelId": "qwen-35b" })));// Phi stopped already by the time the download ends: straight to the start.- let job = Use { identity: None, model: "qwen-35b".into(), name: "Qwen".into(), machine: "local".into(), agent: "a1".into(), step: Step::Get, since: Instant::now(), stops: Some(("phi".into(), "Phi".into())) };+ let job = Use { identity: None, model: "qwen-35b".into(), name: "Qwen".into(), machine: "local".into(), agent: "a1".into(), step: Step::Get, since: Instant::now(), stops: Some(("phi".into(), "Phi".into())), community: None };let snap = parse_local(&with_phi(gemma("downloaded", Value::Null), qwen("downloaded", Value::Null), phi("downloaded", Value::Null))).unwrap();assert_eq!(next(&job, Some(&snap), None, false, None, Instant::now()), Next::Start);// A stop that never ends says so after three minutes.@@ -3124,6 +3449,12 @@ mod tests {"Context 128K window", "Params 35B", "Quant Q4_K_M", "Machine This", "Enter gets it: downloads it, starts it, and moves this harness onto it."] {assert!(s.contains(want), "{want:?} missing:\n{s}");}+ // On Omarchy (where the serving table shows): its quant tells nothing apart, no other download of it.+ let mut omarchy = loaded();+ let mut reply = local_reply(qwen("available", Value::Null), false);+ reply["os"] = json!("omarchy");+ on_local(&mut omarchy, "local", Ok(reply));+ assert!(!text(&preview(&omarchy, "mv:local:qwen-35b")).contains("Quant"));// Not room on the disk for it: said before Get.on_local(&mut app, "local", Ok({ let mut r = local_reply(qwen("available", Value::Null), false); r["freeDiskBytes"] = json!(10.0 * GIB); r }));assert!(text(&preview(&app, "mv:local:qwen-35b")).contains(&format!("Free up disk space on {here} to get it.")));@@ -3654,20 +3985,403 @@ mod tests {assert!(app.models_view.sent.iter().all(|s| s.1 != "grid_fleet_model_stop"));}+ /// The daemon's list on an Omarchy computer serving Qwen on its own grid and on Omagrid — `servedOn`+ /// and `os` as `LocalModels.servedOn` answers them — and the global option [name] set to [value].+ fn serving(os: &str, options: &[(&str, &str)]) -> App {+ let mut app = loaded();+ let mut q = qwen("running", Value::Null);+ q["requests"] = json!(42); q["windowSeconds"] = json!(86400);+ q["servedOn"] = json!([+ { "grid": "own-grid", "requests": 42, "tokensOut": 180_000, "tokensIn": 400_000, "tokensCached": 300_000, "windowSeconds": 86400 },+ { "grid": "Omagrid", "requests": 268, "tokensOut": 1_100_000, "tokensIn": 2_400_000_000u64, "tokensCached": 1_800_000, "windowSeconds": 86400 },+ ]);+ let mut reply = local_reply(q, false);+ if !os.is_empty() { reply["os"] = json!(os) }+ on_local(&mut app, "local", Ok(reply));+ let global = crate::options::SetFlags { global: true, ..Default::default() };+ for (name, value) in options { app.options.set(name, Some(value), &global, "", 0).unwrap(); }+ app+ }++ /// A local model's preview lists the grids this computer serves it on, with only its own figures,+ /// as a table — on Omarchy, until [SERVING_OS] names more — in place of the own grid's Window line.+ #[test]+ fn a_served_model_says_which_grids_it_serves_on_and_what_it_answered_there() {+ let s = text(&preview(&serving("omarchy", &[]), "mv:local:qwen-35b"));+ // Every figure this computer's engine answered — requests, and tokens written, sent, reused — under a+ // dim header and one rule, centred in their columns, the grid column ruled off; no box, no legend.+ let table = [+ "Grid │ Requests Out In Cached",+ "─────────┼─────────────────────────────",+ "own-grid │ 42 180k 400k 300k",+ "Omagrid │ 268 1.1M 2.4B 1.8M",+ ];+ assert!(s.contains(&(table.join("\n") + "\n\n")), "{s}");+ assert!(!s.contains('┌') && !s.contains("Tokens ·"), "{s}");+ // No window line, nor the own grid's Window line beside the table.+ assert!(!s.contains("last ") && !s.contains("Window"), "{s}");+ // Not an Omarchy computer: the own grid's requests, as before, and no table.+ const TABLE: &str = "Requests Out";+ for os in ["macos", "linux", ""] {+ let s = text(&preview(&serving(os, &[]), "mv:local:qwen-35b"));+ assert!(s.contains("Window 42 req / 1d") && !s.contains(TABLE), "{os}: {s}");+ }+ // The option names the computers that show it.+ assert!(text(&preview(&serving("macos", &[(SERVING_OS, "all")]), "mv:local:qwen-35b")).contains(TABLE));+ assert!(text(&preview(&serving("linux", &[(SERVING_OS, "macos, linux")]), "mv:local:qwen-35b")).contains(TABLE));+ assert!(!text(&preview(&serving("omarchy", &[(SERVING_OS, "macos")]), "mv:local:qwen-35b")).contains(TABLE));+ }++ /// Counts read thousands k, millions M, billions B — cut, never rounded up past what was counted.+ #[test]+ fn counts_read_k_m_and_b() {+ for (n, want) in [(0, "0"), (950, "950"), (1_000, "1k"), (1_500, "1.5k"), (12_345, "12.3k"), (180_000, "180k"), (999_999, "999k"),+ (1_000_000, "1M"), (1_100_000, "1.1M"), (12_345_678, "12.3M"), (999_999_999, "999M"),+ (1_000_000_000, "1B"), (2_400_000_000, "2.4B"), (1_234_567_890_123, "1234B")] {+ assert_eq!(count_label(n), want, "{n}");+ }+ }++ /// Only a grid this computer answered something on is a row (owner: no empty values): not one that+ /// sleeps, nor one it answered nothing on yet; none such, no table. A long name is cut.+ #[test]+ fn only_a_grid_it_answered_on_is_a_row() {+ let mut app = serving("omarchy", &[]);+ let mut q = qwen("running", Value::Null);+ q["servedOn"] = json!([+ { "grid": "a-grid-with-a-very-long-name", "requests": 3, "tokensOut": 72, "tokensIn": 30, "tokensCached": 23, "windowSeconds": 3600 },+ { "grid": "sleeping" }, { "grid": "quiet", "requests": 0, "tokensOut": 0, "windowSeconds": 3600 },+ ]);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("omarchy");+ on_local(&mut app, "local", Ok(reply));+ let s = text(&preview(&app, "mv:local:qwen-35b"));+ assert!(s.contains("\na-grid-with-a-ver… │ 3 72 30 23\n"), "{s}");+ assert!(!s.contains("sleeping") && !s.contains("quiet") && !s.contains('—'), "{s}");+ let mut q = qwen("running", Value::Null);+ q["servedOn"] = json!([{ "grid": "sleeping" }, { "grid": "quiet", "requests": 0 }]);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("omarchy");+ on_local(&mut app, "local", Ok(reply));+ assert!(!text(&preview(&app, "mv:local:qwen-35b")).contains("Requests Out"));+ // An older daemon sends neither `servedOn`, `os` nor `osGrid`.+ let snap = parse_local(&local_reply(qwen("running", Value::Null), false)).unwrap();+ assert!(snap.os.is_none() && snap.os_grid.is_none() && snap.models[0].served_on.is_empty());+ }++ /// The daemon's list on a computer of [os] in the community grid Omagrid, Qwen [state] and nothing+ /// running; [options] set as in [serving].+ fn community(os: &str, state: &str, options: &[(&str, &str)]) -> App {+ let mut app = loaded();+ let mut reply = local_reply(qwen(state, Value::Null), false);+ reply["os"] = json!(os); reply["osGrid"] = json!("Omagrid");+ on_local(&mut app, "local", Ok(reply));+ let global = crate::options::SetFlags { global: true, ..Default::default() };+ for (name, value) in options { app.options.set(name, Some(value), &global, "", 0).unwrap(); }+ app+ }++ /// A local model not running yet offers where to run it on its preview — Personal grid, or the+ /// community of this computer's OS — on Omarchy (until [SERVING_OS] names more). → chooses the+ /// community, ← Personal grid, never round: ← on Personal grid stays there, → on the community too.+ #[test]+ fn a_model_not_running_offers_where_to_run_it() {+ let id = "mv:local:qwen-35b";+ let chosen = |app: &App| app.models_view.run_other.as_deref() == Some(id);+ let mut app = community("omarchy", "downloaded", &[]);+ let s = text(&preview(&app, id));+ assert!(s.contains("Run on [ Personal grid ] [ Omarchy community ]"), "{s}");+ // (The arrows are said on the list's keys line, at its foot: ←→ choose.)+ assert!(s.contains("Enter starts it and moves this harness onto it.") && !s.contains("←"), "{s}");+ // ← on Personal grid: it stays chosen.+ assert!(choose_run_on(&mut app, id, false) && !chosen(&app));+ assert!(choose_run_on(&mut app, id, true) && chosen(&app));+ let s = text(&preview(&app, id));+ assert!(s.contains("Enter runs it on Omarchy community: anyone in the Omarchy community can call it. This harness stays on its model."), "{s}");+ assert!(!s.contains("moves this harness"), "{s}");+ // → on the community: it stays chosen; ← back to Personal grid.+ assert!(choose_run_on(&mut app, id, true) && chosen(&app));+ assert!(choose_run_on(&mut app, id, false) && !chosen(&app));+ assert!(text(&preview(&app, id)).contains("Enter starts it and moves this harness onto it."));+ // Not downloaded yet: offered too (got, then run where chosen).+ assert!(text(&preview(&community("omarchy", "available", &[]), id)).contains("[ Omarchy community ]"));+ // A Mac: only when the option names it, and called by its own OS.+ assert!(!text(&preview(&community("macos", "downloaded", &[]), id)).contains("Run on"));+ assert!(text(&preview(&community("macos", "downloaded", &[(SERVING_OS, "macos")]), id)).contains("[ Personal grid ] [ macOS community ]"));+ // Running already, in no community grid, or another row: no choice — the arrows are the list's.+ let mut running = community("omarchy", "running", &[]);+ assert!(!text(&preview(&running, id)).contains("Run on") && !choose_run_on(&mut running, id, true));+ let mut none = loaded();+ let mut reply = local_reply(qwen("downloaded", Value::Null), false);+ reply["os"] = json!("omarchy");+ on_local(&mut none, "local", Ok(reply));+ assert!(!text(&preview(&none, id)).contains("Run on") && !choose_run_on(&mut none, id, true));+ assert!(!choose_run_on(&mut app, "mv:sub:claude\t7f0c", true));+ }++ /// Enter on the community button runs the model there — started with `community`, served there — and+ /// moves no harness: one picks it under Shared with you. It then reads Shared, and ^S stops it there.+ #[test]+ fn enter_on_the_community_button_runs_it_there_and_moves_no_harness() {+ let id = "mv:local:qwen-35b";+ let mut app = community("omarchy", "downloaded", &[]);+ open(&mut app);+ let mut picker = Picker::new("models", "");+ assert!(choose_run_on(&mut app, id, true));+ choose(&mut app, &mut picker, id, false);+ assert_eq!(last_sent(&app), ("local".into(), "grid_fleet_model_start".into(), json!({ "modelId": "qwen-35b", "community": true })));+ assert_eq!(app.models_view.using.as_ref().and_then(|u| u.community.clone()).as_deref(), Some("Omarchy community"));+ assert!(text(&preview(&app, id)).contains("Serve on Omarchy community"));+ on_act(&mut app, "local", Ok(json!({ "operation": op("start", "starting", "running", None) })));+ // Started (the own grid's list still calls it downloaded), then served on Omagrid: over.+ let mut q = qwen("downloaded", op("start", "verifying", "done", None));+ q["servedOn"] = json!([{ "grid": "Omagrid", "windowSeconds": 86400 }]);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ on_local(&mut app, "local", Ok(reply.clone()));+ on_local(&mut app, "local", Ok(reply));+ assert!(app.models_view.using.is_none());+ let s = text(&preview(&app, id));+ assert!(s.starts_with("Qwen3.6-35B-A3B\nRunning on Omarchy community"), "{s}");+ assert!(s.contains("✓ Ready · Qwen3.6-35B-A3B runs on Omarchy community\nShared with you lists it."), "{s}");+ assert!(s.contains("^S stops it on Omarchy community. The download is kept."), "{s}");+ // Shared there now: its Personal grid button, the community choice spent — not chosen, Enter is Use.+ assert!(s.contains("Run on [ Personal grid ]\n") && app.models_view.run_other.is_none(), "{s}");+ assert!(toast(&app).contains("Qwen3.6-35B-A3B runs on Omarchy community"));+ assert!(app.models_view.sent.iter().all(|s| s.1 != "agent_retarget"));+ assert_eq!(row(&rows_of(&app), id).right_narrow.as_deref(), Some("Shared"));+ match plan_stop(&app, id) {+ Plan::Arm(words, then) => { assert!(words.contains("on Omarchy community")); assert_eq!(*then, Plan::StopCommunity("qwen-35b".into())) }+ other => panic!("{other:?}"),+ }+ choose(&mut app, &mut picker, id, true);+ choose(&mut app, &mut picker, id, true);+ assert_eq!(last_sent(&app), ("local".into(), "grid_fleet_model_stop".into(), json!({ "modelId": "qwen-35b", "community": true })));+ }++ /// A model running on the community grid alone (Shared): Enter on its Your models row moves this harness+ /// onto it there, as its Shared with you row does — never a second engine on the personal grid (owner,+ /// 2026-10-13: "it inferences another instance for the personal grid instead of using it").+ #[test]+ fn enter_on_a_shared_model_moves_this_harness_onto_it_on_the_community_grid() {+ let id = "mv:local:qwen-35b";+ let mut q = qwen("downloaded", Value::Null);+ q["servedOn"] = json!([{ "grid": "Omagrid", "servedAs": ["Qwen3.6-35B-A3B-Q4_K_M"] }]);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ let mut app = loaded();+ on_local(&mut app, "local", Ok(reply));+ assert_eq!(row(&rows_of(&app), id).right_narrow.as_deref(), Some("Shared"));+ assert!(text(&preview(&app, id)).contains("Enter moves this harness onto it on Omarchy community."));+ match plan_enter(&app, id) {+ Plan::Retarget { payload, name, .. } => {+ assert_eq!((payload["gridName"].as_str(), payload["gridModel"].as_str()), (Some("Omagrid"), Some("Qwen3.6-35B-A3B-Q4_K_M")));+ assert_eq!(name, "Qwen3.6-35B-A3B");+ }+ other => panic!("{other:?}"),+ }+ open(&mut app);+ let mut picker = Picker::new("models", "");+ choose(&mut app, &mut picker, id, false);+ assert!(app.models_view.sent.iter().all(|s| !s.1.starts_with("grid_fleet_model_")), "no second engine");+ assert_eq!(last_sent(&app).1, "agent_retarget");+ // On it there now: In use, and Enter says so rather than moving it again.+ app.fleet.agents.get_mut(&("local".into(), "a1".into())).unwrap().grid_model = "Qwen3.6-35B-A3B-Q4_K_M".into();+ assert_eq!(row(&rows_of(&app), id).right_narrow.as_deref(), Some("✓ In use"));+ assert_eq!(plan_enter(&app, id), Plan::Say(IN_USE.into()));+ }++ /// The choice only where the community run can work: not for another app's model (Ollama, LM Studio run it+ /// in that app, on the own grid), nor one this computer cannot start now.+ #[test]+ fn the_choice_is_offered_only_for_grids_models_this_computer_can_start() {+ let id = "mv:local:qwen-35b";+ let with = |patch: &dyn Fn(&mut Value)| {+ let mut q = qwen("downloaded", Value::Null);+ patch(&mut q);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ let mut app = loaded();+ on_local(&mut app, "local", Ok(reply));+ app+ };+ assert!(run_on_choice(&with(&|q| q["app"] = json!("Grid")), id).is_some());+ assert!(run_on_choice(&with(&|q| q["app"] = json!("Ollama")), id).is_none());+ assert!(run_on_choice(&with(&|q| q["app"] = json!("LM Studio")), id).is_none());+ assert!(run_on_choice(&with(&|q| q["canStart"] = json!(false)), id).is_none());+ assert!(run_on_choice(&with(&|q| { q["state"] = json!("available"); q["canStart"] = json!(false) }), id).is_none());+ }++ /// A model running on the community grid does not count as the one running here: a Use of another on the+ /// personal grid starts it beside it, stopping nothing (owner, 2026-10-13).+ #[test]+ fn a_model_on_the_community_grid_leaves_the_personal_grid_free() {+ let mut gemma = json!({ "id": "gemma-12b", "name": "gemma-12b", "state": "downloaded", "sizeBytes": 7.5 * GIB, "canStart": true, "canStop": false, "estTokS": 40 });+ gemma["servedOn"] = json!([{ "grid": "Omagrid", "servedAs": ["gemma-12b"] }]);+ let mut reply = local_reply(qwen("downloaded", Value::Null), false);+ reply["models"][1] = gemma;+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ let mut app = loaded();+ on_local(&mut app, "local", Ok(reply));+ let qwen_m = local_model(&app, "qwen-35b").unwrap();+ assert!(other_running(&app, &qwen_m).is_none());+ assert_eq!(plan_enter(&app, "mv:local:qwen-35b"), Plan::Use { model: "qwen-35b".into(), download: false });+ }++ /// On a model Shared on the community grid: one `[ Personal grid ]` button, not chosen — Enter stays Use,+ /// moving the harness onto it there. → chooses it: Enter also runs it on the personal grid (a Use, the+ /// harness moved there). ← leaves it: Use again.+ #[test]+ fn a_shared_model_offers_the_personal_grid_too() {+ let id = "mv:local:qwen-35b";+ let mut q = qwen("downloaded", Value::Null);+ q["servedOn"] = json!([{ "grid": "Omagrid", "servedAs": ["Qwen3.6-35B-A3B-Q4_K_M"], "requests": 3, "tokensOut": 72 }]);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ let mut app = loaded();+ on_local(&mut app, "local", Ok(reply));+ assert!(personal_choice(&app, id) && run_on_choice(&app, id).is_none());+ let s = text(&preview(&app, id));+ assert!(s.contains("Run on [ Personal grid ]\n") && !s.contains("community ]"), "{s}");+ // Its buttons over the serving table (owner).+ assert!(s.find("Run on").zip(s.find("Grid ")).is_some_and(|(run, table)| run < table), "{s}");+ assert!(s.contains("Enter moves this harness onto it on Omarchy community."), "{s}");+ // ← on it: nothing chosen, still Use.+ assert!(choose_run_on(&mut app, id, false) && app.models_view.run_other.is_none());+ assert!(choose_run_on(&mut app, id, true));+ assert!(text(&preview(&app, id)).contains("Enter also runs it on your Personal grid, and moves this harness onto it there."));+ open(&mut app);+ let mut picker = Picker::new("models", "");+ choose(&mut app, &mut picker, id, false);+ assert_eq!(last_sent(&app), ("local".into(), "grid_fleet_model_start".into(), json!({ "modelId": "qwen-35b" })));+ assert!(app.models_view.using.as_ref().is_some_and(|u| u.community.is_none() && u.agent == "a1"), "a Use: the harness moves to the personal grid");+ // ← back: Enter is Use onto it on the community grid again.+ let mut app2 = loaded();+ let mut reply = local_reply({ let mut q = qwen("downloaded", Value::Null); q["servedOn"] = json!([{ "grid": "Omagrid", "servedAs": ["Qwen3.6-35B-A3B-Q4_K_M"] }]); q }, false);+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ on_local(&mut app2, "local", Ok(reply));+ choose_run_on(&mut app2, id, true);+ choose_run_on(&mut app2, id, false);+ open(&mut app2);+ let mut picker = Picker::new("models", "");+ choose(&mut app2, &mut picker, id, false);+ assert_eq!(last_sent(&app2).1, "agent_retarget");+ }++ /// Off Omarchy (no [SERVING_OS] naming it), nothing of this shows: a model this computer serves on its+ /// OS's community grid — `grid join` by hand — reads and stops as it did, no Shared, no Run on, no table,+ /// and the Quant line as before.+ #[test]+ fn nothing_of_it_shows_off_omarchy() {+ let id = "mv:local:qwen-35b";+ let mut q = qwen("downloaded", Value::Null);+ q["servedOn"] = json!([{ "grid": "macOS", "requests": 3, "tokensOut": 72 }]);+ let mut reply = local_reply(q, false);+ reply["os"] = json!("macos"); reply["osGrid"] = json!("macOS");+ let mut app = loaded();+ on_local(&mut app, "local", Ok(reply));+ let s = text(&preview(&app, id));+ assert!(s.starts_with("Qwen3.6-35B-A3B\nDownloaded"), "{s}");+ assert!(!s.contains("Run on") && !s.contains("Requests Out") && !s.contains("community") && s.contains("Quant Q4_K_M"), "{s}");+ assert_ne!(row(&rows_of(&app), id).right_narrow.as_deref(), Some("Shared"));+ assert!(!matches!(plan_stop(&app, id), Plan::Arm(_, ref then) if matches!(**then, Plan::StopCommunity(_))));+ assert!(!choose_run_on(&mut app, id, true));+ }++ /// The arrows through the picker's own key handling: on a row that offers the choice, with nothing+ /// searched, → chooses the community and ← Personal grid; with a search typed they move in it as before.+ #[test]+ fn the_arrows_choose_where_it_runs_only_with_nothing_searched() {+ use crossterm::event::{Event as CEvent, KeyCode, KeyEvent, KeyModifiers};+ let id = "mv:local:qwen-35b";+ let key = |app: &mut App, code: KeyCode| crate::input::handle(app, CEvent::Key(KeyEvent::new(code, KeyModifiers::NONE)));+ let mut app = community("omarchy", "downloaded", &[]);+ app.size = (160, 50);+ back_to_models(&mut app, Some(id.to_string()));+ let picker = |app: &App| match &app.modal { Some(crate::modal::Modal::Picker { picker, .. }) => (picker.current_id(), picker.query.clone(), picker.qcursor), _ => panic!("Models closed") };+ assert_eq!(picker(&app).0.as_deref(), Some(id));+ // The list's keys line, at its foot, says the arrows (here, where the buttons are offered).+ let hints = |app: &App| match &app.modal { Some(crate::modal::Modal::Picker { picker, .. }) => picker.hints.clone(), _ => vec![] };+ assert!(hints(&app).contains(&("←→", "choose")), "{:?}", hints(&app));+ let mut mac = community("macos", "downloaded", &[]);+ mac.size = (160, 50);+ back_to_models(&mut mac, Some(id.to_string()));+ assert!(!hints(&mac).iter().any(|h| h.0 == "←→"), "not offered on a Mac by default");+ key(&mut app, KeyCode::Left);+ assert!(app.models_view.run_other.is_none(), "← on Personal grid stays there");+ key(&mut app, KeyCode::Right);+ assert_eq!(app.models_view.run_other.as_deref(), Some(id));+ key(&mut app, KeyCode::Right);+ assert_eq!(app.models_view.run_other.as_deref(), Some(id), "→ on the community stays there");+ key(&mut app, KeyCode::Left);+ assert!(app.models_view.run_other.is_none());+ assert_eq!(picker(&app).0.as_deref(), Some(id), "the cursor stays on the row");+ // A search typed: the arrows move in it, and choose nothing.+ key(&mut app, KeyCode::Char('q'));+ let (_, query, at) = picker(&app);+ key(&mut app, KeyCode::Left);+ assert!(app.models_view.run_other.is_none());+ assert_eq!((picker(&app).1, picker(&app).2), (query, at - 1));+ }++ /// Not downloaded yet: got first (asked first), then started there. A model running on the personal grid+ /// is left running: a computer serves its community beside its own model (owner, 2026-10-13).+ #[test]+ fn a_community_run_gets_the_model_and_leaves_the_personal_one_running() {+ let id = "mv:local:qwen-35b";+ let mut app = community("omarchy", "available", &[]);+ open(&mut app);+ let mut picker = Picker::new("models", "");+ choose_run_on(&mut app, id, true);+ // A download is gigabytes: the first Enter asks, in the preview, as the Personal grid's Get asks.+ choose(&mut app, &mut picker, id, false);+ assert_eq!(app.models_view.confirm.as_ref().map(|c| c.1.as_str()), Some("Get Qwen3.6-35B-A3B (20 GB), run it on Omarchy community? Enter · Esc"));+ assert!(app.models_view.sent.iter().all(|s| !s.1.starts_with("grid_fleet_model_")), "asked first");+ choose(&mut app, &mut picker, id, false);+ assert_eq!(last_sent(&app), ("local".into(), "grid_fleet_model_download".into(), json!({ "modelId": "qwen-35b" })));+ assert_eq!(app.models_view.using.as_ref().map(|u| (u.step, u.community.clone())), Some((Step::Get, Some("Omarchy community".into()))));+ let mut app = community("omarchy", "downloaded", &[]);+ let mut reply = local_reply(qwen("downloaded", Value::Null), false);+ reply["models"][1]["state"] = json!("running"); reply["models"][1]["canStop"] = json!(true);+ reply["os"] = json!("omarchy"); reply["osGrid"] = json!("Omagrid");+ on_local(&mut app, "local", Ok(reply));+ open(&mut app);+ choose_run_on(&mut app, id, true);+ assert!(text(&preview(&app, id)).contains("Enter runs it on Omarchy community: anyone in the Omarchy community can call it. This harness stays on its model."));+ let mut picker = Picker::new("models", "");+ choose(&mut app, &mut picker, id, false);+ assert_eq!(last_sent(&app), ("local".into(), "grid_fleet_model_start".into(), json!({ "modelId": "qwen-35b", "community": true })));+ assert!(app.models_view.sent.iter().all(|s| s.1 != "grid_fleet_model_stop"), "gemma keeps running");+ assert_eq!(app.models_view.using.as_ref().map(|u| (u.step, u.stops.clone())), Some((Step::Start, None)));+ }+/// A model a Grid setup left running, which the catalog does not list: grid serves it under its- /// file's name, quant and all. It is shown without the quant (the Quant line says it), and a- /// harness still moves onto it by the name grid serves.+ /// file's name, quant and all. It is shown without the quant (the Quant line says it — on Omarchy,+ /// only beside another download of the model), and a harness still moves onto it by the name grid serves.#[test]fn a_running_model_is_shown_without_its_quant_and_still_switched_onto_by_its_served_name() {let mut app = app();let file = json!({ "id": "local:Qwen3.8-27B-UD-Q4_K_M.gguf", "name": "Qwen3.8-27B-UD-Q4_K_M", "state": "running", "quant": "", "canStart": false, "canStop": true, "app": "Grid" });- on_local(&mut app, "local", Ok(local_reply(file, false)));+ on_local(&mut app, "local", Ok(local_reply(file.clone(), false)));on_grids(&mut app, "local", Ok(grids_reply(&["Qwen3.8-27B-UD-Q4_K_M"])));let id = "mv:local:local:Qwen3.8-27B-UD-Q4_K_M.gguf";assert_eq!(row(&rows_of(&app), id).label, "Qwen3.8-27B");let panel = text(&preview(&app, id));assert!(panel.starts_with("Qwen3.8-27B\n"), "{panel}");assert!(panel.contains("Quant Q4_K_M"), "{panel}");+ // On Omarchy: no Quant line for a model with no other download — beside one, the quant is what+ // tells the two apart.+ let mut alone = local_reply(file.clone(), false);+ alone["os"] = json!("omarchy");+ on_local(&mut app, "local", Ok(alone));+ assert!(!text(&preview(&app, id)).contains("Quant"));+ let q8 = json!({ "id": "local:Qwen3.8-27B-Q8_0.gguf", "name": "Qwen3.8-27B-Q8_0", "state": "downloaded", "canStart": true, "app": "Grid" });+ let mut both = local_reply(file.clone(), false);+ both["models"].as_array_mut().unwrap().push(q8);+ both["os"] = json!("omarchy");+ on_local(&mut app, "local", Ok(both));+ assert!(text(&preview(&app, id)).contains("Quant Q4_K_M"));+ assert!(text(&preview(&app, "mv:local:local:Qwen3.8-27B-Q8_0.gguf")).contains("Quant Q8_0"));match plan_enter(&app, id) {Plan::Retarget { payload, name, .. } => {assert_eq!(payload["gridModel"], "Qwen3.8-27B-UD-Q4_K_M");diff --git a/tui/tests/mock-daemon.mjs b/tui/tests/mock-daemon.mjsindex 318f68771..fd1750722 100644--- a/tui/tests/mock-daemon.mjs+++ b/tui/tests/mock-daemon.mjs@@ -415,7 +415,27 @@ wss.on('connection', (ws) => {}case 'grid_models_list': return reply({ supportsModelLaunch: true, localModelEngines: ['codex', 'claude'], grids: [{ name: 'studio', own: true, models: [{ id: 'demo-model', node: 'studio' }] },+ ...(process.env.MOCK_SERVING ? [+ { name: 'Omagrid', own: false, state: 'awake', models: [{ id: 'Qwen3.8-27B-UD-Q4_K_M', node: 'Omarchy machine' }] },+ { name: 'team', own: false, state: 'awake', models: [] },+ ] : []),] })+ // MOCK_SERVING=<os>: this computer, on that OS grid and in its community grid Omagrid, serves Qwen on its+ // own grid and on Omagrid — `servedOn`, `os` and `osGrid` as `LocalModels` answers them — for the Models+ // view's serving table and its Run on dialog (Enter on gemma, downloaded, not running). MOCK_SERVING_IDLE:+ // Qwen stopped too, so Enter on gemma runs it with no other model to stop first.+ case 'grid_fleet_models_list': if (!process.env.MOCK_SERVING) return+ return reply({ os: process.env.MOCK_SERVING, osGrid: 'Omagrid', busy: false, supportsDownload: true, memoryBytes: 64 * 1024 ** 3,+ freeDiskBytes: 120 * 1024 ** 3, observedAt: now, models: [+ { id: 'local:Qwen3.8-27B-UD-Q4_K_M.gguf', name: 'Qwen3.8-27B-UD-Q4_K_M', state: process.env.MOCK_SERVING_IDLE ? 'downloaded' : 'running',+ sizeBytes: 17 * 1024 ** 3, canStart: !!process.env.MOCK_SERVING_IDLE, canStop: !process.env.MOCK_SERVING_IDLE,+ app: 'Grid', servedAs: ['Qwen3.8-27B-UD-Q4_K_M'], tokensPerSecond: 41.8, contextWindow: 131072, requests: 42, windowSeconds: 86400,+ servedOn: [+ { grid: 'studio', requests: 42, tokensOut: 180000, tokensIn: 400000, tokensCached: 300000, windowSeconds: 86400 },+ { grid: 'Omagrid', requests: 268, tokensOut: 1100000, tokensIn: 2400000000, tokensCached: 1800000, windowSeconds: 86400 },+ ] },+ { id: 'org/gemma-4-12b', name: 'gemma-4-12b', state: 'downloaded', sizeBytes: 8 * 1024 ** 3, canStart: true, canStop: false, estTokS: 70, app: 'Grid' },+ ] })case 'codex_profiles_list': return reply({ profiles: [{ path: '/home/demo/.codex-work', label: 'Work' }] })case 'dsh_list': return reply({ dsh: process.env.MOCK_NEW_UI ? [{ id: 'example/blender', name: 'Blender', engine: 'codex', engines: ['codex', 'claude'], installed: true }] : [] })// The agent accounts' limits, as the vendors answer (MOCK_USAGE: Claude's 5-hour window, %).