Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

fix(byoa): report each computer's engines from its own daemon

yetone072d45dad297
diff --git a/electron/main.cjs b/electron/main.cjs
index 82b345b..8d76769 100644
--- a/electron/main.cjs
+++ b/electron/main.cjs
@@ -2,14 +2,10 @@
const { app, BrowserWindow, Tray, Menu, nativeImage, shell, nativeTheme, screen, ipcMain, globalShortcut, protocol, net } = require('electron')
const path = require('node:path')
const fs = require('node:fs')
-const os = require('node:os')
-const { spawn } = require('node:child_process')
const http = require('node:http')
-const https = require('node:https')
const crypto = require('node:crypto')
const { pathToFileURL } = require('node:url')
const autoUpdater = require('./autoUpdater.cjs')
-const { findWindowsCommand, windowsCommandInvocation } = require('./cli-path.cjs')
const isDev = !app.isPackaged
const DEV_URL = process.env.ELECTRON_RENDERER_URL || 'http://localhost:5180'
@@ -1393,288 +1389,6 @@ ipcMain.handle('app:is-focused', () => {
return !!(mainWindow && !mainWindow.isDestroyed() && mainWindow.isFocused())
})
-// Keep in sync with src/lib/engines.ts. Official daemon detectEngines() only
-// probes engines with adapters (claude/cursor/codex/grok/opencode/pi/gemini). The rest
-// are listed so the Me page can diagnose what is installed on THIS machine.
-const LOCAL_CLIS = [
- {
- id: 'claude', bin: 'claude', versionArgs: ['--version'],
- npm: '@anthropic-ai/claude-code', brew: 'claude-code',
- selfUpdate: 'claude update',
- },
- {
- id: 'cursor', bin: 'cursor-agent', versionArgs: ['--version'], latestVia: 'cursor-about',
- selfUpdate: 'cursor-agent update',
- },
- {
- id: 'codex', bin: 'codex', versionArgs: ['--version'],
- npm: '@openai/codex',
- },
- {
- id: 'grok', bin: 'grok', versionArgs: ['--version'], latestVia: 'grok-check',
- npm: '@xai-official/grok',
- selfUpdate: 'grok update',
- },
- {
- id: 'opencode', bin: 'opencode', versionArgs: ['--version'],
- npm: 'opencode-ai',
- selfUpdate: 'opencode upgrade',
- },
- {
- id: 'pi', bin: 'pi', versionArgs: ['--version'],
- npm: '@earendil-works/pi-coding-agent', npmFlags: '--ignore-scripts',
- selfUpdate: 'pi update',
- },
- {
- id: 'gemini', bin: 'gemini', versionArgs: ['--version'],
- npm: '@google/gemini-cli', brew: 'gemini-cli',
- },
- {
- id: 'qwen', bin: 'qwen', versionArgs: ['--version'],
- npm: '@qwen-code/qwen-code',
- },
- {
- id: 'hermes', bin: 'hermes', versionArgs: ['version'],
- selfUpdate: 'hermes update',
- },
-]
-
-const NPM_LATEST_TTL_MS = 30 * 60 * 1000
-const npmLatestCache = new Map()
-
-function realpathOf(binPath) {
- try {
- return fs.realpathSync(binPath)
- } catch {
- return binPath
- }
-}
-
-function isHomebrewInstall(binPath, real) {
- const hay = `${binPath}\n${real}`
- return /(^|[/\\])(Homebrew|homebrew|linuxbrew|Cellar)([/\\]|$)/i.test(hay)
- || binPath.startsWith('/opt/homebrew/')
-}
-
-function npmUpdateCommand(spec) {
- if (!spec.npm) return null
- const flags = spec.npmFlags ? `${spec.npmFlags} ` : ''
- return `npm install -g ${flags}${spec.npm}@latest`
-}
-
-// Prefer the CLI's own updater when it has one (`pi update`, `claude update`).
-// That path is what vendors document, and it works the same on Windows.
-// Only fall back to brew/npm when the binary has no self-update command.
-function inferUpdateCommand(spec, binPath) {
- if (spec.selfUpdate) return spec.selfUpdate
- const real = realpathOf(binPath)
- if (spec.brew && isHomebrewInstall(binPath, real)) {
- return `brew upgrade ${spec.brew}`
- }
- return npmUpdateCommand(spec)
-}
-
-function detectSearchPath() {
- const home = os.homedir()
- const extra = [
- path.join(home, '.local', 'bin'),
- path.join(home, 'bin'),
- '/opt/homebrew/bin',
- '/usr/local/bin',
- path.join(home, '.npm-global', 'bin'),
- path.join(home, '.volta', 'bin'),
- path.join(home, '.asdf', 'shims'),
- ]
- const parts = (process.env.PATH ?? '').split(path.delimiter).filter(Boolean)
- for (const dir of extra) {
- if (!parts.includes(dir)) parts.unshift(dir)
- }
- return parts.join(path.delimiter)
-}
-
-function spawnText(cmd, args, envPath, timeoutMs = 8000) {
- return new Promise((resolve) => {
- let settled = false
- const invocation = process.platform === 'win32'
- ? windowsCommandInvocation(cmd, args)
- : { command: cmd, args }
- const child = spawn(invocation.command, invocation.args, {
- stdio: ['ignore', 'pipe', 'pipe'],
- env: { ...process.env, PATH: envPath ?? process.env.PATH },
- windowsVerbatimArguments: invocation.windowsVerbatimArguments === true,
- })
- let out = ''
- const onChunk = (buf) => { out += buf.toString('utf8') }
- child.stdout?.on('data', onChunk)
- child.stderr?.on('data', onChunk)
- const finish = (value) => {
- if (settled) return
- settled = true
- clearTimeout(timer)
- resolve(value)
- }
- const timer = setTimeout(() => { try { child.kill() } catch { /* ignore */ }; finish(out.trim()) }, timeoutMs)
- child.on('error', () => finish(''))
- child.on('close', () => finish(out.trim()))
- })
-}
-
-function parseCliVersion(text) {
- if (!text) return null
- const m = text.match(/v?(\d{4}\.\d{2}\.\d{2}(?:-[\w.]+)?|\d+\.\d+\.\d+(?:[-+][\w.]+)?)/i)
- return m ? m[1] : null
-}
-
-function versionParts(v) {
- const main = String(v).replace(/^v/i, '').split(/[-+]/)[0]
- return main.split('.').map((n) => Number.parseInt(n, 10) || 0)
-}
-
-function isCliOutdated(current, latest) {
- if (!current || !latest) return false
- if (current === latest) return false
- const a = versionParts(current)
- const b = versionParts(latest)
- const n = Math.max(a.length, b.length)
- for (let i = 0; i < n; i++) {
- const x = a[i] ?? 0
- const y = b[i] ?? 0
- if (y > x) return true
- if (y < x) return false
- }
- return false
-}
-
-function fetchJson(url, timeoutMs = 5000) {
- return new Promise((resolve) => {
- const req = https.get(url, {
- headers: { 'User-Agent': 'cumora-desktop', Accept: 'application/json' },
- }, (res) => {
- if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
- res.resume()
- fetchJson(res.headers.location, timeoutMs).then(resolve)
- return
- }
- let body = ''
- res.on('data', (chunk) => { body += chunk })
- res.on('end', () => {
- try { resolve(JSON.parse(body)) } catch { resolve(null) }
- })
- })
- req.on('error', () => resolve(null))
- req.setTimeout(timeoutMs, () => { req.destroy(); resolve(null) })
- })
-}
-
-async function npmLatest(pkg) {
- const cached = npmLatestCache.get(pkg)
- if (cached && Date.now() - cached.at < NPM_LATEST_TTL_MS) return cached.version
- const data = await fetchJson(`https://registry.npmjs.org/${encodeURIComponent(pkg)}/latest`)
- const version = typeof data?.version === 'string' ? data.version : null
- if (version) npmLatestCache.set(pkg, { at: Date.now(), version })
- return version
-}
-
-function parseCursorAbout(text) {
- const latestLine = text.split(/\r?\n/).find((line) => /^\s*Latest\b/i.test(line))
- if (!latestLine) return null
- return parseCliVersion(latestLine)
-}
-
-function parseGrokCheck(text) {
- try {
- const data = JSON.parse(text)
- return typeof data.latestVersion === 'string' ? data.latestVersion : null
- } catch {
- return parseCliVersion(text)
- }
-}
-
-async function detectCliLatest(spec, resolved, envPath) {
- try {
- if (spec.latestVia === 'cursor-about') {
- const about = await spawnText(resolved, ['about'], envPath, 10000)
- return parseCursorAbout(about) || parseCliVersion(about)
- }
- if (spec.latestVia === 'grok-check') {
- const check = await spawnText(resolved, ['update', '--check', '--json'], envPath, 12000)
- const fromCheck = parseGrokCheck(check)
- if (fromCheck) return fromCheck
- }
- if (spec.npm) return await npmLatest(spec.npm)
- } catch { /* keep local-only */ }
- return null
-}
-
-async function resolveCliPath(bin, envPath) {
- if (process.platform === 'win32') {
- const fromPath = await findWindowsCommand(bin, envPath ?? process.env.PATH ?? '')
- if (fromPath) return fromPath
- } else {
- const fromWhich = (await spawnText('which', [bin], envPath)).split(/\r?\n/)[0]?.trim()
- if (fromWhich) return fromWhich
- }
- const home = os.homedir()
- const names = process.platform === 'win32' ? [`${bin}.cmd`, `${bin}.exe`, bin] : [bin]
- const dirs = [
- path.join(home, '.local', 'bin'),
- path.join(home, 'bin'),
- '/opt/homebrew/bin',
- '/usr/local/bin',
- ]
- for (const dir of dirs) {
- for (const name of names) {
- const candidate = path.join(dir, name)
- try {
- await fs.promises.access(candidate)
- return candidate
- } catch { /* next */ }
- }
- }
- return null
-}
-
-async function detectLocalHostNames() {
- const names = new Set()
- try {
- const host = os.hostname()
- if (host) names.add(host)
- } catch { /* ignore */ }
- if (process.platform === 'darwin') {
- for (const key of ['ComputerName', 'LocalHostName']) {
- const name = await spawnText('scutil', ['--get', key])
- if (name) names.add(name)
- }
- }
- return [...names]
-}
-
-ipcMain.handle('detect:local-clis', async () => {
- const envPath = detectSearchPath()
- const hostNames = await detectLocalHostNames()
- const found = []
- for (const spec of LOCAL_CLIS) {
- const resolved = await resolveCliPath(spec.bin, envPath)
- if (resolved) found.push({ spec, path: resolved })
- }
- const clis = await Promise.all(found.map(async ({ spec, path: resolved }) => {
- const rawVersion = await spawnText(resolved, spec.versionArgs, envPath, 6000)
- const version = parseCliVersion(rawVersion)
- const latest = await detectCliLatest(spec, resolved, envPath)
- const outdated = isCliOutdated(version, latest)
- return {
- id: spec.id,
- bin: spec.bin,
- path: resolved,
- version,
- latest,
- outdated,
- updateCommand: outdated ? inferUpdateCommand(spec, resolved) : null,
- }
- }))
- return { hostNames, clis }
-})
-
ipcMain.on('theme:set', (_event, source) => {
if (source !== 'system' && source !== 'light' && source !== 'dark') return
nativeTheme.themeSource = source
diff --git a/electron/preload.cjs b/electron/preload.cjs
index e5658cc..67e5d7c 100644
--- a/electron/preload.cjs
+++ b/electron/preload.cjs
@@ -102,16 +102,6 @@ contextBridge.exposeInMainWorld('cumora', {
set: (source) => ipcRenderer.send('theme:set', source),
},
- /**
- * Local CLI scan on THIS machine (main process `which` + common bin
- * dirs). The renderer must not probe PATH itself — notebook App vs
- * VPS daemon would mix. Official pairing only reports the five
- * runnable engines; this surface also lists Pi / Gemini / etc.
- */
- detect: {
- localClis: () => ipcRenderer.invoke('detect:local-clis'),
- },
-
/**
* Auto-update bridge. Mirrors alma's pattern:
* - getAppInfo() — current version + autoupdate capability flag
diff --git a/server/src/__tests__/agents-computer-engine-detect.test.ts b/server/src/__tests__/agents-computer-engine-detect.test.ts
index 95ed09b..0e5faf9 100644
--- a/server/src/__tests__/agents-computer-engine-detect.test.ts
+++ b/server/src/__tests__/agents-computer-engine-detect.test.ts
@@ -47,10 +47,13 @@ test('sanitizeDetectedEngines drops unknown ids and fills missing bins', () => {
[{ id: 'claude', bin: 'claude', path: '/usr/bin/claude' }, { id: 'bogus', bin: 'x', path: null }],
['claude', 'codex', 'gemini', 'bogus'],
)
+ // Version fields come back on every row — null here, since a daemon this old
+ // reports paths only. See agents-computer-engine-version.test.ts.
+ const noVersion = { version: null, latest: null, outdated: false, updateCommand: null }
assert.deepEqual(out, [
- { id: 'claude', bin: 'claude', path: '/usr/bin/claude' },
- { id: 'codex', bin: 'codex', path: null },
- { id: 'gemini', bin: 'gemini', path: null },
+ { id: 'claude', bin: 'claude', path: '/usr/bin/claude', ...noVersion },
+ { id: 'codex', bin: 'codex', path: null, ...noVersion },
+ { id: 'gemini', bin: 'gemini', path: null, ...noVersion },
])
})
diff --git a/server/src/__tests__/agents-computer-engine-version.test.ts b/server/src/__tests__/agents-computer-engine-version.test.ts
new file mode 100644
index 0000000..31e8160
--- /dev/null
+++ b/server/src/__tests__/agents-computer-engine-version.test.ts
@@ -0,0 +1,141 @@
+/**
+ * Per-engine version reporting for BYOA computers.
+ *
+ * The Computers card shows what is installed on the *paired* machine, so the
+ * numbers have to come from that machine's daemon. These cover the parsing and
+ * update-command inference the daemon does locally, plus the server-side
+ * validation that stands between a daemon's claim and what the app renders.
+ *
+ * Run: node --import tsx --test server/src/__tests__/agents-computer-engine-version.test.ts
+ */
+import { test } from 'node:test'
+import assert from 'node:assert/strict'
+
+process.env.CUMORA_RUNTIME_CLIENT = 'http'
+process.env.OPENAI_API_KEY ??= 'test-key'
+
+const {
+ parseCliVersion, isCliOutdated, inferUpdateCommand,
+ parseCursorAbout, parseGrokCheck, ENGINE_VERSION_SPECS,
+} = await import('../agents/computer/cli-version.js')
+const { sanitizeDetectedEngines } = await import('../agents/computer/registry.js')
+
+test('parseCliVersion reads the shapes real CLIs print', () => {
+ assert.equal(parseCliVersion('1.2.3'), '1.2.3')
+ assert.equal(parseCliVersion('claude 1.0.88 (Claude Code)'), '1.0.88')
+ assert.equal(parseCliVersion('v2.10.0'), '2.10.0')
+ assert.equal(parseCliVersion('codex-cli 0.5.1-alpha.2'), '0.5.1-alpha.2')
+ // Some vendors ship CalVer rather than semver.
+ assert.equal(parseCliVersion('2026.08.30'), '2026.08.30')
+ assert.equal(parseCliVersion('no version here'), null)
+ assert.equal(parseCliVersion(''), null)
+ assert.equal(parseCliVersion(null), null)
+})
+
+test('isCliOutdated only fires when upstream is strictly newer', () => {
+ assert.equal(isCliOutdated('1.2.3', '1.2.4'), true)
+ assert.equal(isCliOutdated('1.2.3', '1.3.0'), true)
+ assert.equal(isCliOutdated('1.9.0', '1.10.0'), true, 'compares numerically, not lexically')
+ assert.equal(isCliOutdated('1.2.3', '1.2.3'), false)
+ assert.equal(isCliOutdated('1.2.4', '1.2.3'), false, 'ahead of the registry is not outdated')
+ // Unknown on either side must stay silent rather than nag.
+ assert.equal(isCliOutdated(null, '1.2.3'), false)
+ assert.equal(isCliOutdated('1.2.3', null), false)
+})
+
+test('inferUpdateCommand prefers the vendor updater, then brew, then npm', () => {
+ // claude has a self-updater, so brew/npm never win even from a brew path.
+ assert.equal(
+ inferUpdateCommand(ENGINE_VERSION_SPECS.claude, '/opt/homebrew/bin/claude'),
+ 'claude update',
+ )
+ // gemini has no self-updater: brew only when it actually came from brew.
+ assert.equal(
+ inferUpdateCommand(ENGINE_VERSION_SPECS.gemini, '/opt/homebrew/bin/gemini'),
+ 'brew upgrade gemini-cli',
+ )
+ assert.equal(
+ inferUpdateCommand(ENGINE_VERSION_SPECS.gemini, '/usr/local/bin/gemini'),
+ 'npm install -g @google/gemini-cli@latest',
+ )
+ // codex is npm-only.
+ assert.equal(
+ inferUpdateCommand(ENGINE_VERSION_SPECS.codex, '/usr/local/bin/codex'),
+ 'npm install -g @openai/codex@latest',
+ )
+ // pi needs the vendor's documented flag when it falls through to npm.
+ assert.equal(inferUpdateCommand({ versionArgs: ['--version'], npm: '@earendil-works/pi-coding-agent', npmFlags: '--ignore-scripts' }, '/usr/local/bin/pi'),
+ 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent@latest')
+})
+
+test('parseCursorAbout / parseGrokCheck read their vendor formats', () => {
+ assert.equal(parseCursorAbout('Version 1.0.0\nLatest 1.2.0\n'), '1.2.0')
+ assert.equal(parseCursorAbout('Version 1.0.0\n'), null)
+ assert.equal(parseGrokCheck('{"latestVersion":"0.4.2"}'), '0.4.2')
+ // Not JSON — fall back to scraping a version out of the text.
+ assert.equal(parseGrokCheck('grok 0.4.2 available'), '0.4.2')
+})
+
+test('sanitizeDetectedEngines carries version fields through', () => {
+ const rows = sanitizeDetectedEngines([
+ {
+ id: 'codex', bin: 'codex', path: '/usr/local/bin/codex',
+ version: '0.5.0', latest: '0.6.0', outdated: true,
+ updateCommand: 'npm install -g @openai/codex@latest',
+ },
+ ], ['codex'])
+ assert.deepEqual(rows, [{
+ id: 'codex', bin: 'codex', path: '/usr/local/bin/codex',
+ version: '0.5.0', latest: '0.6.0', outdated: true,
+ updateCommand: 'npm install -g @openai/codex@latest',
+ }])
+})
+
+test('sanitizeDetectedEngines does not trust a stale outdated flag', () => {
+ // A daemon claiming "outdated" while both versions read the same would nag
+ // forever; the server can check that itself, so it does.
+ const [row] = sanitizeDetectedEngines(
+ [{ id: 'codex', bin: 'codex', path: '/x/codex', version: '1.0.0', latest: '1.0.0', outdated: true }],
+ ['codex'],
+ )
+ assert.equal(row?.outdated, false)
+
+ // Same when one side is missing entirely.
+ const [noLatest] = sanitizeDetectedEngines(
+ [{ id: 'codex', bin: 'codex', path: '/x/codex', version: '1.0.0', outdated: true }],
+ ['codex'],
+ )
+ assert.equal(noLatest?.outdated, false)
+ assert.equal(noLatest?.latest, null)
+})
+
+test('sanitizeDetectedEngines strips control characters and bounds length', () => {
+ const [row] = sanitizeDetectedEngines([{
+ id: 'codex', bin: 'codex', path: '/x/codex',
+ version: '1.0.0', latest: '2.0.0',
+ outdated: true,
+ // A newline here would turn a copyable one-liner into a two-command script.
+ updateCommand: 'npm i -g @openai/codex\nrm -rf /',
+ }], ['codex'])
+ assert.ok(!row?.updateCommand?.includes('\n'))
+ assert.equal(row?.updateCommand, 'npm i -g @openai/codex rm -rf /')
+
+ const [long] = sanitizeDetectedEngines(
+ [{ id: 'codex', bin: 'codex', path: '/x/codex', version: 'v'.repeat(500) }],
+ ['codex'],
+ )
+ assert.equal(long?.version?.length, 64)
+})
+
+test('sanitizeDetectedEngines tolerates a daemon too old to report versions', () => {
+ // Pre-probe daemons send {id,bin,path}. Rendering the path alone is correct;
+ // inventing a version would be worse than showing none.
+ const [row] = sanitizeDetectedEngines(
+ [{ id: 'codex', bin: 'codex', path: '/usr/local/bin/codex' }],
+ ['codex'],
+ )
+ assert.equal(row?.version, null)
+ assert.equal(row?.latest, null)
+ assert.equal(row?.outdated, false)
+ assert.equal(row?.updateCommand, null)
+})
diff --git a/server/src/agents/computer/cli-version.ts b/server/src/agents/computer/cli-version.ts
new file mode 100644
index 0000000..9d1e76a
--- /dev/null
+++ b/server/src/agents/computer/cli-version.ts
@@ -0,0 +1,262 @@
+/** Engine version probing, run on the daemon's own machine.
+ *
+ * The Computers tab shows, per engine, the version installed on *that*
+ * computer. Only the daemon can answer that — the desktop app can scan its own
+ * PATH, but that is a different machine whenever you are not sitting at the one
+ * you paired. So the probe lives here and rides the heartbeat's engine rescan.
+ *
+ * Local versions are re-probed on every rescan (cheap: one spawn per engine,
+ * against an already-resolved absolute path). Upstream "latest" lookups hit the
+ * network — or a slow `about` / `update --check` subcommand — so they are cached
+ * well past the rescan interval.
+ */
+
+import { spawn } from 'node:child_process'
+import fs from 'node:fs'
+
+/** How to ask an engine its version, and how to find out what the newest one is. */
+export interface EngineVersionSpec {
+ /** Args that make the binary print its version (`--version` for all but hermes). */
+ versionArgs: string[]
+ /** npm package, when the CLI ships on the public registry. */
+ npm?: string
+ /** Extra flags the vendor documents for a global install (pi needs --ignore-scripts). */
+ npmFlags?: string
+ /** Homebrew formula, when the CLI is also brewable. */
+ brew?: string
+ /** The vendor's own updater, preferred over brew/npm when it exists. */
+ selfUpdate?: string
+ /** CLIs that report upstream themselves instead of via the npm registry. */
+ latestVia?: 'cursor-about' | 'grok-check'
+}
+
+/** Keep in sync with electron/main.cjs LOCAL_CLIS and src/lib/engines.ts. */
+export const ENGINE_VERSION_SPECS: Record<string, EngineVersionSpec> = {
+ claude: {
+ versionArgs: ['--version'],
+ npm: '@anthropic-ai/claude-code',
+ brew: 'claude-code',
+ selfUpdate: 'claude update',
+ },
+ cursor: {
+ versionArgs: ['--version'],
+ latestVia: 'cursor-about',
+ selfUpdate: 'cursor-agent update',
+ },
+ codex: {
+ versionArgs: ['--version'],
+ npm: '@openai/codex',
+ },
+ grok: {
+ versionArgs: ['--version'],
+ latestVia: 'grok-check',
+ npm: '@xai-official/grok',
+ selfUpdate: 'grok update',
+ },
+ opencode: {
+ versionArgs: ['--version'],
+ npm: 'opencode-ai',
+ selfUpdate: 'opencode upgrade',
+ },
+ pi: {
+ versionArgs: ['--version'],
+ npm: '@earendil-works/pi-coding-agent',
+ npmFlags: '--ignore-scripts',
+ selfUpdate: 'pi update',
+ },
+ gemini: {
+ versionArgs: ['--version'],
+ npm: '@google/gemini-cli',
+ brew: 'gemini-cli',
+ },
+ qwen: {
+ versionArgs: ['--version'],
+ npm: '@qwen-code/qwen-code',
+ },
+ hermes: {
+ versionArgs: ['version'],
+ selfUpdate: 'hermes update',
+ },
+}
+
+/** Upstream versions change on the vendor's release cadence, not ours, and the
+ * rescan runs every 5 minutes. Cache far longer than the rescan so a paired
+ * machine is not making the same registry call all day. A stale `latest` only
+ * delays noticing a new release; it never produces a wrong "outdated" badge,
+ * because the *local* side of the comparison is always freshly probed. */
+const LATEST_TTL_MS = 6 * 60 * 60 * 1000
+
+const latestCache = new Map<string, { at: number; version: string | null }>()
+
+/** Test seam: drop memoized upstream versions. */
+export function clearLatestCache(): void {
+ latestCache.clear()
+}
+
+/** Pull the first version-looking token out of CLI output. Accepts both semver
+ * and the CalVer some vendors print (`2026.08.30`). */
+export function parseCliVersion(text: string | null | undefined): string | null {
+ if (!text) return null
+ const m = text.match(/v?(\d{4}\.\d{2}\.\d{2}(?:-[\w.]+)?|\d+\.\d+\.\d+(?:[-+][\w.]+)?)/i)
+ return m ? m[1] : null
+}
+
+function versionParts(v: string): number[] {
+ const main = String(v).replace(/^v/i, '').split(/[-+]/)[0] ?? ''
+ return main.split('.').map((n) => Number.parseInt(n, 10) || 0)
+}
+
+/** True only when `latest` is strictly newer. Unknown on either side means we
+ * say nothing rather than nag. */
+export function isCliOutdated(current: string | null, latest: string | null): boolean {
+ if (!current || !latest) return false
+ if (current === latest) return false
+ const a = versionParts(current)
+ const b = versionParts(latest)
+ const n = Math.max(a.length, b.length)
+ for (let i = 0; i < n; i++) {
+ const x = a[i] ?? 0
+ const y = b[i] ?? 0
+ if (y > x) return true
+ if (y < x) return false
+ }
+ return false
+}
+
+function realpathOf(binPath: string): string {
+ try {
+ return fs.realpathSync(binPath)
+ } catch {
+ return binPath
+ }
+}
+
+export function isHomebrewInstall(binPath: string, real: string): boolean {
+ const hay = `${binPath}\n${real}`
+ return /(^|[/\\])(Homebrew|homebrew|linuxbrew|Cellar)([/\\]|$)/i.test(hay)
+ || binPath.startsWith('/opt/homebrew/')
+}
+
+function npmUpdateCommand(spec: EngineVersionSpec): string | null {
+ if (!spec.npm) return null
+ const flags = spec.npmFlags ? `${spec.npmFlags} ` : ''
+ return `npm install -g ${flags}${spec.npm}@latest`
+}
+
+/** Prefer the CLI's own updater when it has one (`pi update`, `claude update`):
+ * that is the path vendors document, and it behaves the same on Windows. Fall
+ * back to brew only when the binary actually came from brew, else npm. */
+export function inferUpdateCommand(spec: EngineVersionSpec, binPath: string | null): string | null {
+ if (spec.selfUpdate) return spec.selfUpdate
+ if (spec.brew && binPath && isHomebrewInstall(binPath, realpathOf(binPath))) {
+ return `brew upgrade ${spec.brew}`
+ }
+ return npmUpdateCommand(spec)
+}
+
+export function parseCursorAbout(text: string): string | null {
+ const latestLine = text.split(/\r?\n/).find((line) => /^\s*Latest\b/i.test(line))
+ if (!latestLine) return null
+ return parseCliVersion(latestLine)
+}
+
+export function parseGrokCheck(text: string): string | null {
+ try {
+ const data = JSON.parse(text) as Record<string, unknown>
+ return typeof data.latestVersion === 'string' ? data.latestVersion : null
+ } catch {
+ return parseCliVersion(text)
+ }
+}
+
+/** Run a command and return its combined output, or '' on any failure. Never
+ * rejects: a missing or wedged CLI must not take down the rescan. */
+function spawnText(cmd: string, args: string[], timeoutMs: number): Promise<string> {
+ return new Promise((resolve) => {
+ let settled = false
+ let child: ReturnType<typeof spawn>
+ try {
+ child = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'] })
+ } catch {
+ resolve('')
+ return
+ }
+ let out = ''
+ const onChunk = (buf: Buffer) => { out += buf.toString('utf8') }
+ child.stdout?.on('data', onChunk)
+ child.stderr?.on('data', onChunk)
+ const finish = (value: string) => {
+ if (settled) return
+ settled = true
+ clearTimeout(timer)
+ resolve(value)
+ }
+ const timer = setTimeout(() => {
+ try { child.kill() } catch { /* already gone */ }
+ finish(out.trim())
+ }, timeoutMs)
+ child.on('error', () => finish(''))
+ child.on('close', () => finish(out.trim()))
+ })
+}
+
+async function npmLatest(pkg: string): Promise<string | null> {
+ try {
+ const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}/latest`, {
+ headers: { 'User-Agent': 'cumora-daemon', Accept: 'application/json' },
+ signal: AbortSignal.timeout(5000),
+ })
+ if (!res.ok) return null
+ const data = await res.json() as Record<string, unknown>
+ return typeof data.version === 'string' ? data.version : null
+ } catch {
+ return null
+ }
+}
+
+async function probeLatest(id: string, spec: EngineVersionSpec, binPath: string | null): Promise<string | null> {
+ const cached = latestCache.get(id)
+ if (cached && Date.now() - cached.at < LATEST_TTL_MS) return cached.version
+
+ let version: string | null = null
+ try {
+ if (spec.latestVia === 'cursor-about' && binPath) {
+ const about = await spawnText(binPath, ['about'], 10_000)
+ version = parseCursorAbout(about) || parseCliVersion(about)
+ } else if (spec.latestVia === 'grok-check' && binPath) {
+ const check = await spawnText(binPath, ['update', '--check', '--json'], 12_000)
+ version = parseGrokCheck(check)
+ }
+ if (!version && spec.npm) version = await npmLatest(spec.npm)
+ } catch {
+ version = null
+ }
+ latestCache.set(id, { at: Date.now(), version })
+ return version
+}
+
+/** What the daemon reports per engine, beyond the bin path. */
+export interface EngineVersionInfo {
+ version: string | null
+ latest: string | null
+ outdated: boolean
+ updateCommand: string | null
+}
+
+/** Probe one engine on this machine. `binPath` is the already-resolved absolute
+ * path, so this never depends on the daemon's PATH being as rich as a shell's. */
+export async function probeEngineVersion(id: string, binPath: string | null): Promise<EngineVersionInfo> {
+ const spec = ENGINE_VERSION_SPECS[id]
+ const empty: EngineVersionInfo = { version: null, latest: null, outdated: false, updateCommand: null }
+ if (!spec || !binPath) return empty
+
+ const version = parseCliVersion(await spawnText(binPath, spec.versionArgs, 6000))
+ const latest = await probeLatest(id, spec, binPath)
+ const outdated = isCliOutdated(version, latest)
+ return {
+ version,
+ latest,
+ outdated,
+ updateCommand: outdated ? inferUpdateCommand(spec, binPath) : null,
+ }
+}
diff --git a/server/src/agents/computer/daemon.ts b/server/src/agents/computer/daemon.ts
index 6c6c652..a2fe5ad 100644
--- a/server/src/agents/computer/daemon.ts
+++ b/server/src/agents/computer/daemon.ts
@@ -33,7 +33,7 @@ import {
wakeHasActionableInput,
type WakeBackgroundBrief,
} from '../runtime/wake-options.js'
-import { detectEnginesWithStatus, snapshotDetectedEngines, getAdapter, ENGINE_IDS, runEngineDoctor, type EngineId, type EngineSession, type EngineRunResult, type EngineUsage, type EngineHopReport } from './engine.js'
+import { detectEnginesWithStatus, snapshotDetectedEngines, enrichDetectedEngines, getAdapter, ENGINE_IDS, runEngineDoctor, type EngineId, type EngineSession, type EngineRunResult, type EngineUsage, type EngineHopReport } from './engine.js'
import { usageFromClaude, type TokenUsage } from '../cost.js'
import { parseTriage, finalizeTriage, isRateLimited } from '../triage-core.js'
import { GLANCE_YIELD_RULES } from '../glance-protocol.js'
@@ -2584,6 +2584,9 @@ async function doRun(serverOverride?: string): Promise<void> {
}
}
+ // Last snapshot we successfully described to the server, as a JSON fingerprint.
+ let lastEngineSnapshot = ''
+
// Engines this machine can currently run, re-scanned on a slow timer. Reported
// on every heartbeat so installing another supported CLI takes effect without
// re-pairing — the daemon is already online and can see PATH itself, so there
@@ -2597,10 +2600,20 @@ async function doRun(serverOverride?: string): Promise<void> {
const changed = replaceEngineInventory(engineInventory, next)
if (changed) {
console.log(`[computer] engines on PATH changed: ${previous.join(', ') || 'none'} → ${next.join(', ') || 'none'}`)
- // Heartbeat already advertises the live inventory. This snapshot is
- // only the PATH display the app reads — pairable engines, never the
- // detect-only bins Electron lists on the Me page.
- const snapshot = await snapshotDetectedEngines(next)
+ }
+ // Heartbeat already advertises the live inventory. This snapshot is
+ // only the PATH display the app reads — pairable engines, never the
+ // detect-only bins Electron lists on the Me page. It carries each
+ // engine's version *as installed on this machine*: the app renders it
+ // verbatim and never probes its own PATH, because whoever is looking at
+ // the card is usually not sitting at the machine it describes.
+ const snapshot = await enrichDetectedEngines(await snapshotDetectedEngines(next))
+ // Report on version drift too, not just install/uninstall — upgrading an
+ // engine in place leaves the engine *list* identical, and that is exactly
+ // when the card's version line goes stale.
+ const fingerprint = JSON.stringify(snapshot)
+ if (fingerprint !== lastEngineSnapshot) {
+ lastEngineSnapshot = fingerprint
await api(cfg.serverUrl, '/api/computers/me/engines', {
method: 'POST',
headers: { Authorization: `Bearer ${cfg.deviceToken}` },
@@ -2640,6 +2653,10 @@ async function doRun(serverOverride?: string): Promise<void> {
const beat = setInterval(() => { void heartbeat() }, HEARTBEAT_MS)
const rescan = setInterval(() => { void rescanEngines() }, ENGINE_RESCAN_MS)
rescan.unref?.()
+ // Pairing reports a cheap paths-only snapshot so the user is not kept waiting
+ // on CLI spawns. Fill in the versions right after startup instead of leaving
+ // the card blank until the first 5-minute tick.
+ void rescanEngines()
// Keep the service log from filling the disk: rotate at boot, then periodically.
void rotateLogsIfNeeded()
const logrot = setInterval(() => { void rotateLogsIfNeeded() }, LOG_ROTATE_MS)
diff --git a/server/src/agents/computer/engine.ts b/server/src/agents/computer/engine.ts
index 1ed0ff2..919980b 100644
--- a/server/src/agents/computer/engine.ts
+++ b/server/src/agents/computer/engine.ts
@@ -28,6 +28,7 @@ import { homedir, tmpdir } from 'node:os'
import { join, delimiter as PATH_DELIMITER } from 'node:path'
import { StringDecoder } from 'node:string_decoder'
import { stripLoneSurrogates } from '../text-safety.js'
+import { probeEngineVersion } from './cli-version.js'
const IS_WIN = process.platform === 'win32'
@@ -3835,6 +3836,12 @@ export interface DetectedEngineSnapshot {
id: EngineId
bin: string
path: string | null
+ /** Version fields are absent from the cheap pairing snapshot and filled in by
+ * enrichDetectedEngines() on the rescan, which is allowed to spawn CLIs. */
+ version?: string | null
+ latest?: string | null
+ outdated?: boolean
+ updateCommand?: string | null
}
/** Snapshot the installed engines, optionally in a caller-supplied order
@@ -3850,6 +3857,19 @@ export async function snapshotDetectedEngines(ids?: EngineId[]): Promise<Detecte
}))
}
+/** Add each engine's installed version, the newest one upstream, and how to
+ * update — measured on *this* machine. Spawns one `--version` per engine, so
+ * it rides the 5-minute rescan rather than the pairing path, which the user is
+ * sitting and waiting on. */
+export async function enrichDetectedEngines(
+ snapshot: DetectedEngineSnapshot[],
+): Promise<DetectedEngineSnapshot[]> {
+ return Promise.all(snapshot.map(async (entry) => ({
+ ...entry,
+ ...await probeEngineVersion(entry.id, entry.path),
+ })))
+}
+
/** Resolve a bin's absolute path on PATH (the first hit), or null if absent. */
export async function resolveBinPath(bin: string): Promise<string | null> {
return new Promise((resolve) => {
diff --git a/server/src/agents/computer/registry.ts b/server/src/agents/computer/registry.ts
index a31551a..2d96c42 100644
--- a/server/src/agents/computer/registry.ts
+++ b/server/src/agents/computer/registry.ts
@@ -93,13 +93,50 @@ export interface DetectedEngine {
id: string
bin: string
path: string | null
+ /** Version of this engine as installed on the reporting computer, the newest
+ * one upstream, and how to update it there. Absent when reported by a daemon
+ * older than the version probe, or when the probe could not read a version —
+ * the app renders the path alone rather than guessing. */
+ version?: string | null
+ latest?: string | null
+ outdated?: boolean
+ updateCommand?: string | null
+}
+
+/** Trim a daemon-reported display string, or drop it. Control characters are
+ * stripped so a version line can never smuggle newlines into the update
+ * command the Me page offers the user to copy and run. */
+function displayString(value: unknown, max: number): string | null {
+ if (typeof value !== 'string') return null
+ const clean = value.replace(/[\u0000-\u001f\u007f]/g, ' ').trim()
+ return clean ? clean.slice(0, max) : null
+}
+
+function sanitizeVersionFields(rec: Record<string, unknown>): Partial<DetectedEngine> {
+ const version = displayString(rec.version, 64)
+ const latest = displayString(rec.latest, 64)
+ const updateCommand = displayString(rec.updateCommand, 200)
+ return {
+ version,
+ latest,
+ // Never take the daemon's word for it over data we can check ourselves: a
+ // stale `outdated: true` with both versions equal would nag forever.
+ outdated: rec.outdated === true && !!version && !!latest && version !== latest,
+ updateCommand,
+ }
+}
+
+/** An engine we know is advertised but have no PATH/version report for. */
+function unreportedEngine(id: string): DetectedEngine {
+ return {
+ id, bin: ENGINE_BINS[id] ?? id, path: null,
+ version: null, latest: null, outdated: false, updateCommand: null,
+ }
}
export function sanitizeDetectedEngines(raw: unknown, engineIds: string[]): DetectedEngine[] {
const allowed = engineIds.filter((id) => PAIRABLE_ENGINES.has(id))
- if (!Array.isArray(raw)) {
- return allowed.map((id) => ({ id, bin: ENGINE_BINS[id] ?? id, path: null }))
- }
+ if (!Array.isArray(raw)) return allowed.map(unreportedEngine)
const byId = new Map<string, DetectedEngine>()
for (const item of raw) {
if (!item || typeof item !== 'object') continue
@@ -108,9 +145,11 @@ export function sanitizeDetectedEngines(raw: unknown, engineIds: string[]): Dete
if (!PAIRABLE_ENGINES.has(id) || !allowed.includes(id)) continue
const bin = typeof rec.bin === 'string' && rec.bin.trim() ? rec.bin.trim() : (ENGINE_BINS[id] ?? id)
const path = typeof rec.path === 'string' && rec.path.trim() ? rec.path.trim() : null
- byId.set(id, { id, bin, path })
+ byId.set(id, { id, bin, path, ...sanitizeVersionFields(rec) })
}
- return allowed.map((id) => byId.get(id) ?? { id, bin: ENGINE_BINS[id] ?? id, path: null })
+ // Every row carries the same keys, reported or not, so the app never has to
+ // distinguish "field absent" from "nothing installed to report".
+ return allowed.map((id) => byId.get(id) ?? unreportedEngine(id))
}
export interface ComputerRow {
diff --git a/src/desktop/MeView.tsx b/src/desktop/MeView.tsx
index cb06eff..480f7c8 100644
--- a/src/desktop/MeView.tsx
+++ b/src/desktop/MeView.tsx
@@ -792,44 +792,21 @@ const COMPUTER_STATUS_KEY: Record<string, MessageKey> = {
offline: 'me.computerStatus.offline',
}
+/** The engines installed on `computer`, as that computer's own daemon reported
+ * them — paths and versions included.
+ *
+ * This deliberately does NOT consult the machine the app happens to be running
+ * on. The card describes a remote host; the only process that can see that
+ * host's PATH is the daemon on it. An earlier version overlaid a local PATH
+ * scan whenever it guessed the card was "this machine", which painted the
+ * desktop's own engine versions onto whichever computer it guessed wrong about. */
function pairedRows(computer: Computer): AgentRow[] {
- if (computer.detectedEngines && computer.detectedEngines.length > 0) return computer.detectedEngines
- return (computer.availableEngines ?? []).map((id) => ({
- id, bin: ENGINE_BIN[id] ?? id, path: null as string | null,
- }))
-}
-
-function namesMatch(computerName: string, hostNames: string[]): boolean {
- const n = computerName.trim().toLowerCase().replace(/\.local$/, '')
- if (!n) return false
- return hostNames.some((h) => h.trim().toLowerCase().replace(/\.local$/, '') === n)
-}
-
-function isThisMachine(computer: Computer, hostNames: string[], localComputerCount: number): boolean {
- if (computer.kind !== 'local') return false
- if (namesMatch(computer.name, hostNames)) return true
- return localComputerCount === 1 && hostNames.length > 0
-}
-
-function mergeAgentRows(
- computer: Computer,
- localClis: Array<{
- id: string
- bin: string
- path: string
- version?: string | null
- latest?: string | null
- outdated?: boolean
- updateCommand?: string | null
- }> | null,
- thisMachine: boolean,
-): AgentRow[] {
- const byId = new Map<string, AgentRow>()
- for (const row of pairedRows(computer)) byId.set(row.id, row)
- if (thisMachine && localClis) {
- for (const hit of localClis) byId.set(hit.id, hit)
- }
- return [...byId.values()].sort((a, b) => {
+ const rows: AgentRow[] = computer.detectedEngines && computer.detectedEngines.length > 0
+ ? computer.detectedEngines
+ : (computer.availableEngines ?? []).map((id) => ({
+ id, bin: ENGINE_BIN[id] ?? id, path: null as string | null,
+ }))
+ return [...rows].sort((a, b) => {
const ia = CLI_ORDER.indexOf(a.id)
const ib = CLI_ORDER.indexOf(b.id)
return (ia === -1 ? 99 : ia) - (ib === -1 ? 99 : ib)
@@ -875,38 +852,8 @@ function ComputersTab() {
const [repairCopied, setRepairCopied] = useState(false)
const [busyId, setBusyId] = useState<string | null>(null)
const [copiedCli, setCopiedCli] = useState<string | null>(null)
- const [localDetect, setLocalDetect] = useState<{
- hostNames: string[]
- clis: Array<{
- id: string
- bin: string
- path: string
- version?: string | null
- latest?: string | null
- outdated?: boolean
- updateCommand?: string | null
- }>
- } | null>(null)
- const canDetectLocal = typeof window !== 'undefined' && typeof window.cumora?.detect?.localClis === 'function'
- const [cliScanning, setCliScanning] = useState(canDetectLocal)
-
- async function scanLocal() {
- const fn = typeof window !== 'undefined' ? window.cumora?.detect?.localClis : undefined
- if (!fn) {
- setCliScanning(false)
- return
- }
- setCliScanning(true)
- try {
- setLocalDetect(await fn())
- } catch { /* keep previous */ } finally {
- setCliScanning(false)
- }
- }
-
useEffect(() => {
void useComputers.getState().refresh()
- void scanLocal()
}, [])
useEffect(() => { if (!repairCopied) return; const id = window.setTimeout(() => setRepairCopied(false), 1600); return () => window.clearTimeout(id) }, [repairCopied])
useEffect(() => { if (!copiedCli) return; const id = window.setTimeout(() => setCopiedCli(null), 1600); return () => window.clearTimeout(id) }, [copiedCli])
@@ -935,7 +882,6 @@ function ComputersTab() {
const pairCommand = code ? `npx cumora@latest agent computer --pair ${code}${serverFlag}${engineFlag}${asService ? ' --install-service' : ''}` : ''
const list = Object.values(byId).sort((a, b) =>
(a.kind === 'cloud' ? 0 : 1) - (b.kind === 'cloud' ? 0 : 1) || a.name.localeCompare(b.name))
- const localComputerCount = list.filter((c) => c.kind === 'local').length
function agentCount(computerId: string, isCloud: boolean): number {
return Object.values(participants).filter((p) =>
@@ -969,7 +915,7 @@ function ComputersTab() {
setErr(null)
setBusyId(id)
try {
- await Promise.all([useComputers.getState().refresh(), scanLocal()])
+ await useComputers.getState().refresh()
} catch (e) {
setErr(e instanceof Error ? e.message : String(e))
} finally {
@@ -994,12 +940,8 @@ function ComputersTab() {
const expanded = repairFor === c.id
const enginesShown = enginesOpen.has(c.id)
const repairCmd = repairCode ? `npx cumora@latest agent computer --pair ${repairCode}${serverFlag}` : ''
- const thisMachine = isThisMachine(c, localDetect?.hostNames ?? [], localComputerCount)
- const awaitingCli = repairable && c.kind === 'local' && cliScanning
- const rows = repairable && !awaitingCli
- ? mergeAgentRows(c, thisMachine ? (localDetect?.clis ?? null) : null, thisMachine)
- : []
- const detecting = busyId === c.id || awaitingCli
+ const rows = repairable ? pairedRows(c) : []
+ const detecting = busyId === c.id
return (
<div key={c.id} className="bg-cloud rounded-[14px]" style={{ border: '1px solid var(--ink-100)' }}>
<div
@@ -1028,11 +970,9 @@ function ComputersTab() {
? (
<>
<span>
- {awaitingCli
- ? t('me.agentsDiagnosing')
- : rows.length > 0
- ? (rows.length === 1 ? t('me.agentsCliDetectedOne', { n: rows.length }) : t('me.agentsCliDetectedOther', { n: rows.length }))
- : (n === 1 ? t('me.agentsCountOne', { n }) : t('me.agentsCountOther', { n }))}
+ {rows.length > 0
+ ? (rows.length === 1 ? t('me.agentsCliDetectedOne', { n: rows.length }) : t('me.agentsCliDetectedOther', { n: rows.length }))
+ : (n === 1 ? t('me.agentsCountOne', { n }) : t('me.agentsCountOther', { n }))}
</span>
{c.daemonVersion && (
<>
@@ -1077,21 +1017,7 @@ function ComputersTab() {
)}
</div>
{repairable && enginesShown && (
- awaitingCli ? (
- <div className="px-4 pb-4 space-y-2" aria-busy="true">
- <div className="text-[12px] text-ink-500">{t('me.agentsDiagnosing')}</div>
- {[0, 1, 2].map((i) => (
- <div
- key={i}
- className="rounded-[12px] px-3 py-2.5 bg-paper"
- style={{ border: '1px solid var(--ink-200)' }}
- >
- <div className="h-3.5 w-24 rounded-md bg-ink-200" />
- <div className="mt-2 h-2.5 w-[70%] rounded-md bg-ink-200/80" />
- </div>
- ))}
- </div>
- ) : rows.length === 0 ? (
+ rows.length === 0 ? (
<div className="px-4 pb-4 text-[12px] text-ink-400">{t('me.agentsNoEngines')}</div>
) : (
<div className="px-4 pb-4 space-y-2">
@@ -1127,7 +1053,7 @@ function ComputersTab() {
</div>
{(row.version || row.latest) && (
<div className="mt-1 flex items-center text-[12px] text-ink-500">
- <span>{row.version ? t('me.agentsCliLocal', { version: row.version }) : t('me.agentsCliUnknown')}</span>
+ <span>{row.version ? t('me.agentsCliInstalled', { version: row.version }) : t('me.agentsCliUnknown')}</span>
{row.latest && (
<>
<span className="shrink-0 text-ink-300" style={{ marginLeft: 10, marginRight: 10 }}>·</span>
@@ -1145,7 +1071,14 @@ function ComputersTab() {
</div>
</div>
{row.updateCommand && (
- <div className="mt-2 flex items-center gap-2">
+ <div className="mt-2">
+ {/* The card describes another machine, so say where the
+ command has to run — copying it here and pasting it
+ into a local shell would update the wrong computer. */}
+ <div className="text-[11px] text-ink-400 mb-1">
+ {t('me.agentsRunOnComputer', { name: c.name })}
+ </div>
+ <div className="flex items-center gap-2">
<pre className="flex-1 min-w-0 font-mono text-[11px] truncate bg-ink-900 text-cloud rounded-[8px] px-2 py-1.5 select-all">{row.updateCommand}</pre>
<button
type="button"
@@ -1158,6 +1091,7 @@ function ComputersTab() {
>
{copiedCli === copyKey ? t('me.copied') : t('me.agentsCopyUpdate')}
</button>
+ </div>
</div>
)}
</div>
diff --git a/src/lib/runtime.ts b/src/lib/runtime.ts
index 637995a..10634e9 100644
--- a/src/lib/runtime.ts
+++ b/src/lib/runtime.ts
@@ -85,21 +85,6 @@ interface CumoraBridge {
theme?: {
set: (source: 'system' | 'light' | 'dark') => void
}
- /** Main-process PATH scan of CLIs on this machine. Electron only. */
- detect?: {
- localClis: () => Promise<{
- hostNames: string[]
- clis: Array<{
- id: string
- bin: string
- path: string
- version?: string | null
- latest?: string | null
- outdated?: boolean
- updateCommand?: string | null
- }>
- }>
- }
/** Auto-update bridge — ported from alma's pattern. Surfaces
* electron-updater status to the renderer so the React side can
* render the upgrade UI without polling. Unavailable in browser /
diff --git a/src/locales/en.ts b/src/locales/en.ts
index fa47fe7..eba0eca 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -1267,18 +1267,18 @@ export const en = {
'me.agentsCliDetectedOther': '{n} engines detected',
'me.agentsRefresh': 'Refresh',
'me.agentsRefreshing': 'Refreshing…',
- 'me.agentsDiagnosing': 'Checking local engines…',
'me.agentsIsDefault': 'Default',
'me.agentsOffline': 'This computer is offline. The list is still the last pairing report.',
'me.agentsNoEngines': 'The daemon reported no engines at pairing. Re-run the pairing command on that computer to scan PATH again.',
'me.agentsNotRunnable': 'Detected only — Cumora cannot run this yet',
'me.agentsNeedPair': 'Re-pair to use',
'me.agentsCliUnknown': 'version unknown',
- 'me.agentsCliLocal': 'local {version}',
+ 'me.agentsCliInstalled': 'installed {version}',
'me.agentsCliLatest': 'latest {latest}',
'me.agentsCliCurrent': 'up to date',
'me.agentsCliUpdateAvailable': 'update available',
'me.agentsCopyUpdate': 'Copy command',
+ 'me.agentsRunOnComputer': 'Run this on {name}',
'me.computerStatus.online': 'online',
'me.computerStatus.busy': 'busy',
'me.computerStatus.offline': 'offline',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 58f7017..d216881 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -1269,18 +1269,18 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {
'me.agentsCliDetectedOther': '{n} 个引擎已被检测',
'me.agentsRefresh': '刷新',
'me.agentsRefreshing': '刷新中…',
- 'me.agentsDiagnosing': '正在检测本机引擎…',
'me.agentsIsDefault': '默认',
'me.agentsOffline': '这台计算机离线。列表仍是上次配对时的检测结果。',
'me.agentsNoEngines': '配对时 daemon 没有报任何引擎。要重新扫 PATH,请在那台机器上再跑一次配对命令。',
'me.agentsNotRunnable': '仅识别,Cumora 还不能当引擎跑',
'me.agentsNeedPair': '重新配对后使用',
'me.agentsCliUnknown': '版本未知',
- 'me.agentsCliLocal': '本地 {version}',
+ 'me.agentsCliInstalled': '已安装 {version}',
'me.agentsCliLatest': '官方 {latest}',
'me.agentsCliCurrent': '已是最新',
'me.agentsCliUpdateAvailable': '有更新',
'me.agentsCopyUpdate': '复制命令',
+ 'me.agentsRunOnComputer': '在 {name} 上运行此命令',
'me.computerStatus.online': '在线',
'me.computerStatus.busy': '忙碌',
'me.computerStatus.offline': '离线',
diff --git a/src/types.ts b/src/types.ts
index e9ba3e0..763e1fa 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -16,7 +16,21 @@ export interface Computer {
status: ComputerStatus
availableEngines: EngineId[]
/** Last PATH snapshot from the daemon (bin + resolved path). */
- detectedEngines?: Array<{ id: EngineId; bin: string; path: string | null }>
+ /** Engines installed on THIS computer, as reported by the daemon running on
+ * it. Never a scan of whichever machine is displaying the card — see
+ * server/src/agents/computer/cli-version.ts. */
+ detectedEngines?: Array<{
+ id: EngineId
+ bin: string
+ path: string | null
+ /** Installed version on that computer, and the newest one upstream. Null
+ * when the probe found nothing or the daemon predates version reporting. */
+ version?: string | null
+ latest?: string | null
+ outdated?: boolean
+ /** How to update this engine on that computer (vendor updater, brew, or npm). */
+ updateCommand?: string | null
+ }>
enginesDetectedAt?: string | null
lastSeenAt?: string | null
pairedAt?: string | null