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
feat(byoa): add account-specific model selection (#175)
LILAC972bc2cb743b
diff --git a/server/src/__tests__/agents-computer-engine-detect.test.ts b/server/src/__tests__/agents-computer-engine-detect.test.tsindex d806b60..86dfaad 100644--- a/server/src/__tests__/agents-computer-engine-detect.test.ts+++ b/server/src/__tests__/agents-computer-engine-detect.test.ts@@ -169,3 +169,40 @@ test('assignAgentToComputer pins when an engine is named and inherits when it is})assert.deepEqual(inherited, { kind: 'local', engine: 'claude', inherit: true })})++test('assignAgentToComputer rejects an unavailable explicit pin before mutating the agent', async () => {+ const calls = installPoolMock(({ sql }) => {+ if (/SELECT kind, available_engines/.test(sql)) {+ return { rows: [{ kind: 'local', available_engines: ['claude'] }] }+ }+ if (/UPDATE participants SET computer_id/.test(sql)) return { rowCount: 1 }+ return { rows: [] }+ })+ const out = await registry.assignAgentToComputer({+ agentId: 'bram', companyId: 'co-1', computerId: 'comp-1', engine: 'codex', inherit: false,+ model: null, fastModel: null,+ })+ assert.equal(out, null)+ assert.equal(calls.some((call) => /UPDATE participants SET computer_id/.test(call.sql)), false)+})++test('assignAgentToComputer persists model pins in the host assignment update', async () => {+ const calls = installPoolMock(({ sql }) => {+ if (/SELECT kind, available_engines/.test(sql)) {+ return { rows: [{ kind: 'local', available_engines: ['claude', 'codex'] }] }+ }+ if (/UPDATE participants SET computer_id/.test(sql)) return { rowCount: 1 }+ return { rows: [] }+ })+ const out = await registry.assignAgentToComputer({+ agentId: 'bram', companyId: 'co-1', computerId: 'comp-1', engine: 'codex', inherit: false,+ model: 'gpt-5.6-sol', fastModel: null,+ })+ assert.deepEqual(out, { kind: 'local', engine: 'codex', inherit: false })+ const update = calls.find((call) => /UPDATE participants SET computer_id/.test(call.sql))+ assert.match(update?.sql ?? '', /model = \$4/)+ assert.match(update?.sql ?? '', /fast_model = \$5/)+ assert.deepEqual(update?.params, [+ 'comp-1', 'codex', false, 'gpt-5.6-sol', null, 'bram', 'co-1',+ ])+})diff --git a/server/src/__tests__/agents-computer-engine-model.test.ts b/server/src/__tests__/agents-computer-engine-model.test.tsindex 3e69d8e..01d99eb 100644--- a/server/src/__tests__/agents-computer-engine-model.test.ts+++ b/server/src/__tests__/agents-computer-engine-model.test.ts@@ -14,7 +14,7 @@*/import { test } from 'node:test'import assert from 'node:assert/strict'-import { resolveEngineModel, resolveEngineFastModel } from '../agents/computer/daemon.js'+import { resolveEngineModel, resolveEngineFastModel, resolveTriageModel } from '../agents/computer/daemon.js'test('with no override, the model Cumora pinned is used', () => {assert.equal(resolveEngineModel('claude-opus-4-7', undefined), 'claude-opus-4-7')@@ -58,3 +58,16 @@ test('an empty or whitespace-only override is ignored, not treated as `local`',assert.equal(resolveEngineModel('claude-opus-4-7', ''), 'claude-opus-4-7')assert.equal(resolveEngineModel('claude-opus-4-7', ' '), 'claude-opus-4-7')})++test('per-agent small brain wins over the computer-wide triage model', () => {+ assert.equal(resolveTriageModel('gpt-5.4-mini', 'gpt-5.6-luna', undefined), 'gpt-5.4-mini')+})++test('computer-wide triage model remains the fallback for an unpinned agent', () => {+ assert.equal(resolveTriageModel(null, 'gpt-5.6-luna', undefined), 'gpt-5.6-luna')+ assert.equal(resolveTriageModel(null, undefined, undefined), undefined)+})++test('local engine override suppresses the agent fast pin but keeps the explicit triage fallback', () => {+ assert.equal(resolveTriageModel('claude-haiku-4-5', 'local-provider/fast', 'local'), 'local-provider/fast')+})diff --git a/server/src/__tests__/agents-computer-engine-version.test.ts b/server/src/__tests__/agents-computer-engine-version.test.tsindex 7402e7b..ae9bade 100644--- a/server/src/__tests__/agents-computer-engine-version.test.ts+++ b/server/src/__tests__/agents-computer-engine-version.test.ts@@ -174,3 +174,25 @@ test('sanitizeDetectedEngines tolerates a daemon too old to report versions', ()assert.equal(row?.outdated, false)assert.equal(row?.updateCommand, null)})++test('sanitizeDetectedEngines bounds and cleans account-specific model catalogs', () => {+ const [row] = sanitizeDetectedEngines([{+ id: 'codex', bin: 'codex', path: '/usr/local/bin/codex',+ modelCatalog: {+ source: 'protocol', supportsCustom: true, fastModelScope: 'agent',+ defaultModel: 'gpt-5.6-sol', defaultFastModel: 'gpt-5.4-mini',+ models: [+ { id: 'gpt-5.6-sol', label: 'GPT-5.6-Sol\nspoof', recommendedFor: ['big', 'bogus'] },+ { id: 'gpt-5.6-sol', label: 'duplicate' },+ { id: '', label: 'empty' },+ ],+ },+ }], ['codex'])+ assert.deepEqual(row?.modelCatalog, {+ source: 'protocol', supportsCustom: true, fastModelScope: 'agent',+ defaultModel: 'gpt-5.6-sol', defaultFastModel: 'gpt-5.4-mini',+ models: [{+ id: 'gpt-5.6-sol', label: 'GPT-5.6-Sol spoof', description: null, recommendedFor: ['big'],+ }],+ })+})diff --git a/server/src/__tests__/agents-computer-model-catalog.test.ts b/server/src/__tests__/agents-computer-model-catalog.test.tsnew file mode 100644index 0000000..9ea6559--- /dev/null+++ b/server/src/__tests__/agents-computer-model-catalog.test.ts@@ -0,0 +1,34 @@+/**+ * Generic BYOA model-catalog parsing.+ *+ * Run: node --import tsx --test server/src/__tests__/agents-computer-model-catalog.test.ts+ */+import { test } from 'node:test'+import assert from 'node:assert/strict'+import { parseListedModels } from '../agents/computer/model-catalog.js'++test('OpenCode catalog keeps provider-qualified model ids and deduplicates them', () => {+ assert.deepEqual(+ parseListedModels('anthropic/claude-sonnet-4-6\nopenai/gpt-5.5\nanthropic/claude-sonnet-4-6\n', 'provider'),+ [+ { id: 'anthropic/claude-sonnet-4-6', label: 'anthropic/claude-sonnet-4-6', description: null, recommendedFor: undefined },+ { id: 'openai/gpt-5.5', label: 'openai/gpt-5.5', description: null, recommendedFor: undefined },+ ],+ )+})++test('pi catalog accepts provider/model output and a provider plus model table', () => {+ const out = parseListedModels(+ 'Provider Model Context\nanthropic claude-sonnet-4-6 200k\nopenai/gpt-5.5:high\n',+ 'pi',+ )+ assert.deepEqual(out.map((model) => model.id), [+ 'anthropic/claude-sonnet-4-6',+ 'openai/gpt-5.5:high',+ ])+})++test('Cursor catalog accepts bullets and ignores headings', () => {+ const out = parseListedModels('Available models\n* auto\n- claude-4.6-sonnet\n gpt-5.5\n', 'cursor')+ assert.deepEqual(out.map((model) => model.id), ['auto', 'claude-4.6-sonnet', 'gpt-5.5'])+})diff --git a/server/src/agents/computer/daemon.ts b/server/src/agents/computer/daemon.tsindex 6755e00..3c28d1e 100644--- a/server/src/agents/computer/daemon.ts+++ b/server/src/agents/computer/daemon.ts@@ -1557,6 +1557,17 @@ export function resolveEngineFastModel(return override?.trim().toLowerCase() === ENGINE_MODEL_LOCAL ? null : (configured ?? null)}+/** Resolve the actual classifier model. A member-specific small brain is more+ * precise than the legacy computer-wide knob; `local` can still suppress the+ * member pin through resolveEngineFastModel(). Exported for regression tests. */+export function resolveTriageModel(+ configured: string | null | undefined,+ computerDefault: string | undefined,+ engineOverride: string | undefined,+): string | undefined {+ return resolveEngineFastModel(configured, engineOverride)?.trim() || computerDefault?.trim() || undefined+}+class AgentRunner {/** Aborted once in stop(). Handed to every one-shot `adapter.run(...)` so the* engine child dies with its runner, the way the persistent session already@@ -1922,6 +1933,14 @@ class AgentRunner {return resolveEngineFastModel(this.agent.fastModel, process.env.CUMORA_ENGINE_MODEL)}+ /** Per-agent small brain wins over the computer-wide compatibility knob.+ * This makes participants.fast_model real for every adapter whose classify()+ * already accepts a model, while preserving CUMORA_TRIAGE_MODEL as a fallback+ * for old deployments and engines left on their default. */+ private triageModelPin(): string | undefined {+ return resolveTriageModel(this.agent.fastModel, process.env.CUMORA_TRIAGE_MODEL, process.env.CUMORA_ENGINE_MODEL)+ }+private engineEnv(): NodeJS.ProcessEnv {return {...process.env,@@ -2076,8 +2095,9 @@ class AgentRunner {cwd: TRIAGE_DIR,prompt: `${payload.instructions}\n\n${payload.input}`,env: this.engineEnv(),- // Engine picks its own cheap default; CUMORA_TRIAGE_MODEL overrides it.- model: process.env.CUMORA_TRIAGE_MODEL,+ // Agent-specific small brain first; computer-wide override second; then+ // the adapter chooses its own cheap/default model.+ model: this.triageModelPin(),signal: controller.signal,})} catch (err) {@@ -2160,11 +2180,12 @@ class AgentRunner {}}- /** Triage model id for pricing, honoring CUMORA_TRIAGE_MODEL. Cursor,+ /** Triage model id for pricing, honoring the agent pin then CUMORA_TRIAGE_MODEL. Cursor,* OpenCode, pi and Antigravity have no universal cheap alias, so a reported/pinned stream* model wins and the agent model is only a fallback. */private triageModel(): string {- if (process.env.CUMORA_TRIAGE_MODEL) return process.env.CUMORA_TRIAGE_MODEL+ const pinned = this.triageModelPin()+ if (pinned) return pinnedif (this.adapter.id === 'claude') return 'haiku'if (this.adapter.id === 'grok') return 'grok-4.5'if (this.adapter.id === 'codex') return 'gpt-5.4-mini'@@ -3336,7 +3357,7 @@ async function doRun(serverOverride?: string): Promise<void> {const snapshot = await enrichDetectedEngines([...await snapshotDetectedEngines(next),...await blockedSnapshotRows(evaluated.blocked),- ])+ ], forceReport)// 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. The blocked reasons are partdiff --git a/server/src/agents/computer/engine.ts b/server/src/agents/computer/engine.tsindex 4624124..42b3bf4 100644--- a/server/src/agents/computer/engine.ts+++ b/server/src/agents/computer/engine.ts@@ -31,6 +31,7 @@ import { basename, dirname, join, delimiter as PATH_DELIMITER } from 'node:path'import { StringDecoder } from 'node:string_decoder'import { stripLoneSurrogates } from '../text-safety.js'import { isCliVersionAtLeast, probeEngineVersion, probeLocalEngineVersion } from './cli-version.js'+import { discoverEngineModelCatalog, type EngineModelCatalog } from './model-catalog.js'const IS_WIN = process.platform === 'win32'@@ -525,13 +526,12 @@ export interface EngineClassifyResult {model?: string | null}-/** A `doctor` liveness probe for ONE brain tier of an engine: spawn it on the- * big (default reasoning) model or the small (cheap fast) model with a one-token- * prompt. Verifies the binary runs AND its auth/quota is good for that tier,- * without doing any real work. Reuses the same one-shot spawn path as triage. */+/** A `doctor` liveness probe for ONE brain tier of an engine. Doctor has no+ * agent/DB context, so its small tier checks only the computer-level fallback,+ * not a member-specific fastModel pin. */export interface EngineProbeArgs {- /** 'big' → engine default model (main brain); 'small' → cheap fast model (the- * cerebellum, e.g. Claude haiku) — the SAME model triage runs on. */+ /** 'big' → engine default model; 'small' → computer-level cheap/fast+ * fallback. Member-specific pins are validated only during real triage. */tier: 'big' | 'small'/** Neutral temp cwd (no persona). */cwd: string@@ -1049,9 +1049,7 @@ function spawnCapture(})}-/** The small/fast model the triage path actually runs on. `probe` must use the- * SAME one or `doctor` reports a red small-brain for an operator whose custom- * provider has no `haiku` — even though their triage is configured correctly. */+/** The computer-level small/fast model used by standalone probes. */function triageModel(fallback: string): string {return process.env.CUMORA_TRIAGE_MODEL?.trim() || fallback}@@ -5130,6 +5128,9 @@ export interface DetectedEngineSnapshot {/** Why this installed engine will NOT be driven — the reason* evaluateRunnableEngines() produced. Absent on runnable engines. */blockedReason?: string+ /** Account/config-specific model choices discovered by the daemon that owns+ * this CLI login. Absent on the cheap pairing snapshot and older daemons. */+ modelCatalog?: EngineModelCatalog}/** Snapshot the installed engines, optionally in a caller-supplied order@@ -5151,11 +5152,15 @@ export async function snapshotDetectedEngines(ids?: EngineId[]): Promise<Detecte* sitting and waiting on. */export async function enrichDetectedEngines(snapshot: DetectedEngineSnapshot[],+ refreshModelCatalog = false,): Promise<DetectedEngineSnapshot[]> {- return Promise.all(snapshot.map(async (entry) => ({- ...entry,- ...await probeEngineVersion(entry.id, entry.path),- })))+ return Promise.all(snapshot.map(async (entry) => {+ const [version, modelCatalog] = await Promise.all([+ probeEngineVersion(entry.id, entry.path),+ discoverEngineModelCatalog(entry.id, entry.path, refreshModelCatalog),+ ])+ return { ...entry, ...version, modelCatalog }+ }))}/** Resolve a bin's absolute path on PATH (the first hit), or null if absent. */diff --git a/server/src/agents/computer/model-catalog.ts b/server/src/agents/computer/model-catalog.tsnew file mode 100644index 0000000..2cfc4ad--- /dev/null+++ b/server/src/agents/computer/model-catalog.ts@@ -0,0 +1,337 @@+import { spawn } from 'node:child_process'+import type { EngineId } from './engine.js'+import { versionCommandInvocation } from './cli-version.js'++export type ModelCatalogSource = 'protocol' | 'cli' | 'presets'+export type FastModelScope = 'agent' | 'computer' | 'unsupported'++export interface EngineModelOption {+ id: string+ label: string+ description?: string | null+ recommendedFor?: Array<'big' | 'small'>+}++/** Model choices advertised by the daemon that actually owns the CLI login.+ * The browser must not guess from a global vendor list: Cursor plans, OpenCode+ * providers, pi extensions, and Codex accounts can all expose different models. */+export interface EngineModelCatalog {+ models: EngineModelOption[]+ defaultModel: string | null+ defaultFastModel: string | null+ supportsCustom: boolean+ fastModelScope: FastModelScope+ source: ModelCatalogSource+}++const PRESETS: Record<EngineId, EngineModelCatalog> = {+ claude: {+ models: [+ { id: 'opus', label: 'Opus', recommendedFor: ['big'] },+ { id: 'sonnet', label: 'Sonnet', recommendedFor: ['big'] },+ { id: 'haiku', label: 'Haiku', recommendedFor: ['small'] },+ ],+ defaultModel: null,+ defaultFastModel: 'haiku',+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ codex: {+ models: [+ { id: 'gpt-5.4-mini', label: 'GPT-5.4 Mini', recommendedFor: ['small'] },+ ],+ defaultModel: null,+ defaultFastModel: 'gpt-5.4-mini',+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ grok: {+ models: [+ { id: 'grok-4.6', label: 'Grok 4.6', recommendedFor: ['big'] },+ { id: 'grok-4.5', label: 'Grok 4.5', recommendedFor: ['small'] },+ ],+ defaultModel: null,+ defaultFastModel: 'grok-4.5',+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ cursor: {+ models: [],+ defaultModel: null,+ defaultFastModel: null,+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ opencode: {+ models: [],+ defaultModel: null,+ defaultFastModel: null,+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ pi: {+ models: [],+ defaultModel: null,+ defaultFastModel: null,+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ gemini: {+ models: [+ { id: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro', recommendedFor: ['big'] },+ { id: 'gemini-2.5-flash-lite', label: 'Gemini 2.5 Flash Lite', recommendedFor: ['small'] },+ ],+ defaultModel: null,+ defaultFastModel: 'gemini-2.5-flash-lite',+ supportsCustom: true,+ fastModelScope: 'agent',+ source: 'presets',+ },+ qwen: {+ models: [],+ defaultModel: null,+ defaultFastModel: null,+ supportsCustom: true,+ fastModelScope: 'computer',+ source: 'presets',+ },+ antigravity: {+ models: [],+ defaultModel: null,+ defaultFastModel: null,+ supportsCustom: true,+ fastModelScope: 'computer',+ source: 'presets',+ },+}++const MODEL_PROBE_TIMEOUT_MS = 10_000+const MODEL_OUTPUT_LIMIT = 2 * 1024 * 1024+const MODEL_CACHE_TTL_MS = 15 * 60 * 1000+const catalogCache = new Map<string, { at: number; catalog: EngineModelCatalog }>()++export function clearModelCatalogCache(): void {+ catalogCache.clear()+}++function clonePreset(id: EngineId): EngineModelCatalog {+ const preset = PRESETS[id]+ return { ...preset, models: preset.models.map((model) => ({ ...model, recommendedFor: model.recommendedFor?.slice() })) }+}++function clean(value: unknown, max = 240): string | null {+ if (typeof value !== 'string') return null+ const text = value.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '').replace(/[\u0000-\u001f\u007f]/g, ' ').trim()+ return text ? text.slice(0, max) : null+}++function mergeModels(discovered: EngineModelOption[], fallback: EngineModelOption[]): EngineModelOption[] {+ const out: EngineModelOption[] = []+ const seen = new Set<string>()+ for (const model of [...discovered, ...fallback]) {+ const id = clean(model.id, 160)+ if (!id || seen.has(id)) continue+ seen.add(id)+ out.push({+ id,+ label: clean(model.label, 160) ?? id,+ description: clean(model.description, 320),+ recommendedFor: model.recommendedFor?.filter((tier): tier is 'big' | 'small' => tier === 'big' || tier === 'small'),+ })+ if (out.length >= 128) break+ }+ return out+}++function withPreset(id: EngineId, discovered: EngineModelOption[], source: 'protocol' | 'cli', defaultModel: string | null): EngineModelCatalog {+ const preset = clonePreset(id)+ return {+ ...preset,+ models: mergeModels(discovered, preset.models),+ defaultModel: clean(defaultModel, 160),+ source,+ }+}++function stopChild(child: ReturnType<typeof spawn>): void {+ try { child.stdin?.end() } catch { /* already closed */ }+ const timer = setTimeout(() => {+ try { child.kill() } catch { /* already gone */ }+ }, 250)+ timer.unref?.()+ child.once('close', () => clearTimeout(timer))+}++function runText(command: string, args: string[]): Promise<string> {+ return new Promise((resolve) => {+ const invocation = versionCommandInvocation(command, args)+ let child: ReturnType<typeof spawn>+ try {+ child = spawn(invocation.command, invocation.args, {+ stdio: ['ignore', 'pipe', 'pipe'],+ windowsHide: true,+ windowsVerbatimArguments: invocation.windowsVerbatimArguments === true,+ })+ } catch {+ resolve('')+ return+ }+ let output = ''+ const append = (chunk: Buffer) => {+ if (output.length < MODEL_OUTPUT_LIMIT) output += chunk.toString('utf8').slice(0, MODEL_OUTPUT_LIMIT - output.length)+ }+ child.stdout?.on('data', append)+ child.stderr?.on('data', append)+ let settled = false+ const finish = () => {+ if (settled) return+ settled = true+ clearTimeout(timer)+ resolve(output.trim())+ }+ const timer = setTimeout(() => { stopChild(child); finish() }, MODEL_PROBE_TIMEOUT_MS)+ timer.unref?.()+ child.once('error', finish)+ child.once('close', finish)+ })+}++/** Parse model-list output shared by OpenCode, pi and Cursor. Exported so new+ * adapters can add fixtures without spawning a real account-bound CLI. */+export function parseListedModels(text: string, style: 'provider' | 'pi' | 'cursor'): EngineModelOption[] {+ const models: EngineModelOption[] = []+ for (const raw of text.split(/\r?\n/)) {+ const line = raw.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, '').trim()+ if (!line || /^(available\s+)?models?\b/i.test(line) || /^provider\s+model\b/i.test(line)) continue+ let id: string | null = null+ if (style === 'provider') {+ id = line.match(/(?:^|\s)([a-z0-9][\w.-]*\/[\w./:@+-]+)/i)?.[1] ?? null+ } else if (style === 'pi') {+ id = line.match(/(?:^|\s)([a-z0-9][\w.-]*\/[\w./:@+-]+)/i)?.[1] ?? null+ if (!id) {+ const pair = line.replace(/^[*✓>•-]+\s*/, '').split(/\s+/)+ if (pair.length >= 2 && /^[a-z0-9][\w.-]*$/i.test(pair[0]) && /^[a-z0-9][\w.:@/+-]*[-.:/][\w.:@/+-]*$/i.test(pair[1])) {+ id = `${pair[0]}/${pair[1]}`+ }+ }+ } else {+ const candidate = line.replace(/^[*✓>•-]+\s*/, '').match(/^([a-z0-9][\w./:@+-]*)/i)?.[1] ?? null+ if (candidate && !/^(available|current|default|name|model)$/i.test(candidate)) id = candidate+ }+ const normalized = clean(id, 160)+ if (normalized) models.push({ id: normalized, label: normalized })+ }+ return mergeModels(models, [])+}++interface CodexListItem {+ id?: unknown+ model?: unknown+ displayName?: unknown+ description?: unknown+ isDefault?: unknown+}++function discoverCodex(command: string): Promise<{ models: EngineModelOption[]; defaultModel: string | null } | null> {+ return new Promise((resolve) => {+ const invocation = versionCommandInvocation(command, ['app-server', '--listen', 'stdio://'])+ let child: ReturnType<typeof spawn>+ try {+ child = spawn(invocation.command, invocation.args, {+ stdio: ['pipe', 'pipe', 'ignore'],+ windowsHide: true,+ windowsVerbatimArguments: invocation.windowsVerbatimArguments === true,+ })+ } catch {+ resolve(null)+ return+ }+ child.stdin?.on('error', () => { /* close/error below owns the result */ })+ let settled = false+ let buffer = ''+ const finish = (value: { models: EngineModelOption[]; defaultModel: string | null } | null) => {+ if (settled) return+ settled = true+ clearTimeout(timer)+ stopChild(child)+ resolve(value)+ }+ const send = (message: object) => {+ try { child.stdin?.write(`${JSON.stringify(message)}\n`) } catch { finish(null) }+ }+ const timer = setTimeout(() => finish(null), MODEL_PROBE_TIMEOUT_MS)+ timer.unref?.()+ child.once('error', () => finish(null))+ child.once('close', () => finish(null))+ child.stdout?.on('data', (chunk: Buffer) => {+ buffer += chunk.toString('utf8')+ for (;;) {+ const newline = buffer.indexOf('\n')+ if (newline < 0) break+ const line = buffer.slice(0, newline).trim()+ buffer = buffer.slice(newline + 1)+ if (!line.startsWith('{')) continue+ let message: { id?: unknown; result?: { data?: unknown } }+ try { message = JSON.parse(line) as typeof message } catch { continue }+ if (message.id === 1) {+ send({ jsonrpc: '2.0', method: 'initialized', params: {} })+ send({ jsonrpc: '2.0', id: 2, method: 'model/list', params: { includeHidden: false, limit: 128 } })+ continue+ }+ if (message.id !== 2 || !Array.isArray(message.result?.data)) continue+ const rows = message.result.data as CodexListItem[]+ const models = rows.map((row): EngineModelOption | null => {+ const id = clean(row.model, 160) ?? clean(row.id, 160)+ if (!id) return null+ return {+ id,+ label: clean(row.displayName, 160) ?? id,+ description: clean(row.description, 320),+ recommendedFor: row.isDefault === true ? ['big'] : undefined,+ }+ }).filter((row): row is EngineModelOption => row !== null)+ const defaultModel = rows.find((row) => row.isDefault === true)+ finish({ models, defaultModel: clean(defaultModel?.model, 160) ?? clean(defaultModel?.id, 160) })+ }+ })+ send({+ jsonrpc: '2.0', id: 1, method: 'initialize',+ params: { clientInfo: { name: 'cumora-daemon', version: '1.0.0' }, capabilities: { experimentalApi: true } },+ })+ })+}++/** Discover the account/config-specific catalog without making a model call.+ * Failure is deliberately soft: a compact preset catalog plus custom entry is+ * still more useful than hiding the selector or blocking an engine rescan. */+export async function discoverEngineModelCatalog(id: EngineId, binPath: string | null, refresh = false): Promise<EngineModelCatalog> {+ const preset = clonePreset(id)+ if (!binPath) return preset+ const cacheKey = `${id}\u0000${binPath}`+ const cached = catalogCache.get(cacheKey)+ if (!refresh && cached && Date.now() - cached.at < MODEL_CACHE_TTL_MS) return cached.catalog++ let catalog: EngineModelCatalog | null = null+ if (id === 'codex') {+ const result = await discoverCodex(binPath)+ if (result?.models.length) catalog = withPreset(id, result.models, 'protocol', result.defaultModel)+ } else if (id === 'cursor') {+ const models = parseListedModels(await runText(binPath, ['models']), 'cursor')+ if (models.length) catalog = withPreset(id, models, 'cli', null)+ } else if (id === 'opencode') {+ const models = parseListedModels(await runText(binPath, ['models']), 'provider')+ if (models.length) catalog = withPreset(id, models, 'cli', null)+ } else if (id === 'pi') {+ const models = parseListedModels(await runText(binPath, ['--list-models']), 'pi')+ if (models.length) catalog = withPreset(id, models, 'cli', null)+ }++ if (catalog) catalogCache.set(cacheKey, { at: Date.now(), catalog })+ return catalog ?? preset+}diff --git a/server/src/agents/computer/registry.ts b/server/src/agents/computer/registry.tsindex 9ddc031..90a408f 100644--- a/server/src/agents/computer/registry.ts+++ b/server/src/agents/computer/registry.ts@@ -19,6 +19,7 @@ import { pool } from '../../db/pool.js'import { CH_STATUS, publish } from '../../redis.js'import { normalizeTier, type Tier } from '../../tier.js'import { signAgentToken } from '../runtime/jwt.js'+import type { EngineModelCatalog, EngineModelOption, FastModelScope, ModelCatalogSource } from './model-catalog.js'export type ComputerKind = 'cloud' | 'local' | 'vps'export type EngineId = 'managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity'@@ -137,6 +138,7 @@ export interface DetectedEngine {* an engine could vanish from a computer with no explanation anywhere the* operator was looking. */blockedReason?: string | null+ modelCatalog?: EngineModelCatalog}/** Trim a daemon-reported display string, or drop it. Control characters are@@ -162,6 +164,45 @@ function sanitizeVersionFields(rec: Record<string, unknown>): Partial<DetectedEn}}+function sanitizeModelCatalog(raw: unknown): EngineModelCatalog | undefined {+ if (!raw || typeof raw !== 'object') return undefined+ const rec = raw as Record<string, unknown>+ const source: ModelCatalogSource = rec.source === 'protocol' || rec.source === 'cli' || rec.source === 'presets'+ ? rec.source+ : 'presets'+ const fastModelScope: FastModelScope = rec.fastModelScope === 'computer' || rec.fastModelScope === 'unsupported'+ ? rec.fastModelScope+ : 'agent'+ const models: EngineModelOption[] = []+ const seen = new Set<string>()+ if (Array.isArray(rec.models)) {+ for (const rawModel of rec.models.slice(0, 128)) {+ if (!rawModel || typeof rawModel !== 'object') continue+ const model = rawModel as Record<string, unknown>+ const id = displayString(model.id, 160)+ if (!id || seen.has(id)) continue+ seen.add(id)+ const recommendedFor = Array.isArray(model.recommendedFor)+ ? model.recommendedFor.filter((tier): tier is 'big' | 'small' => tier === 'big' || tier === 'small').slice(0, 2)+ : undefined+ models.push({+ id,+ label: displayString(model.label, 160) ?? id,+ description: displayString(model.description, 320),+ ...(recommendedFor?.length ? { recommendedFor } : {}),+ })+ }+ }+ return {+ models,+ defaultModel: displayString(rec.defaultModel, 160),+ defaultFastModel: displayString(rec.defaultFastModel, 160),+ supportsCustom: rec.supportsCustom !== false,+ fastModelScope,+ source,+ }+}+/** An engine we know is advertised but have no PATH/version report for. */function unreportedEngine(id: string): DetectedEngine {return {@@ -201,7 +242,11 @@ export function sanitizeDetectedEngines(// A reason is only meaningful on an engine we actually refused. Accepting// one on a runnable engine would let a daemon mark a working engine broken.const blockedReason = blocked.includes(id) ? displayString(rec.blockedReason, 200) : null- byId.set(id, { id, bin, path, ...sanitizeVersionFields(rec), blockedReason })+ const modelCatalog = sanitizeModelCatalog(rec.modelCatalog)+ byId.set(id, {+ id, bin, path, ...sanitizeVersionFields(rec), blockedReason,+ ...(modelCatalog ? { modelCatalog } : {}),+ })}// Every row carries the same keys, reported or not, so the app never has to// distinguish "field absent" from "nothing installed to report".@@ -891,14 +936,29 @@ export async function assignAgentToComputer(args: {engine?: string/** When true (or when no engine is named), follow the computer default. */inherit?: boolean+ /** Optional model pins to persist in the same participant UPDATE as the+ * host/engine assignment. undefined leaves the value untouched; null clears it. */+ model?: string | null+ fastModel?: string | null}): Promise<{ kind: ComputerKind; engine: EngineId; inherit: boolean } | null> {- const placement = await resolveComputerAssignment(args)+ const placement = await resolveComputerAssignment({ ...args, strictEngine: true })if (!placement) return null+ const sets = ['computer_id = $1', 'engine = $2', 'engine_inherit = $3']+ const params: unknown[] = [args.computerId, placement.engine, placement.inherit]+ if (args.model !== undefined) {+ params.push(args.model)+ sets.push(`model = $${params.length}`)+ }+ if (args.fastModel !== undefined) {+ params.push(args.fastModel)+ sets.push(`fast_model = $${params.length}`)+ }+ params.push(args.agentId, args.companyId)const { rowCount } = await pool.query(- `UPDATE participants SET computer_id = $1, engine = $2, engine_inherit = $3- WHERE id = $4 AND company_id = $5 AND kind = 'agent'`,- [args.computerId, placement.engine, placement.inherit, args.agentId, args.companyId],+ `UPDATE participants SET ${sets.join(', ')}+ WHERE id = $${params.length - 1} AND company_id = $${params.length} AND kind = 'agent'`,+ params,)if (!rowCount) return nullreturn placementdiff --git a/server/src/api/router.ts b/server/src/api/router.tsindex 72de8c9..68365af 100644--- a/server/src/api/router.ts+++ b/server/src/api/router.ts@@ -1212,8 +1212,10 @@ api.post('/agents/:id/computer', safe(async (req, res) => {}const engine = typeof req.body?.engine === 'string' ? req.body.engine : undefinedconst inherit = req.body?.inherit === true+ const modelPins = readAgentBody(req.body ?? {})const out = await assignAgentToComputer({agentId: String(req.params.id), companyId, computerId, engine, inherit: inherit || !engine,+ model: modelPins.model, fastModel: modelPins.fastModel,})if (!out) throw new HttpError(400, 'invalid computer, agent, or engine for this company')res.json({ ok: true, ...out })diff --git a/src/api/client.ts b/src/api/client.tsindex f9c9ce6..a5dc9c1 100644--- a/src/api/client.ts+++ b/src/api/client.ts@@ -2,7 +2,7 @@ import type {Message, Status,BoardSummary, BoardSnapshot, BoardCardComment, BoardCardLookup,CalendarEvent, CalendarEventKind, CalendarEventStatus, CalendarDispatch, RecurrenceRule,- CalendarReminderChannel,ComputerStatus, ComputerKind, EngineId,+ CalendarReminderChannel,ComputerStatus, ComputerKind, EngineId, DetectedEngine,} from '@/types'import { getAuthToken, getActiveCompanyId, useAuth } from '@/stores/auth'@@ -236,7 +236,7 @@ export interface ApiComputer {name: stringkind: ComputerKindavailable_engines: EngineId[]- detected_engines?: Array<{ id: EngineId; bin: string; path: string | null }>+ detected_engines?: DetectedEngine[]engines_detected_at?: string | nullstatus: ComputerStatuslast_seen_at: string | null@@ -965,10 +965,17 @@ export const api = {http<{ ok: boolean }>(`/computers/${encodeURIComponent(id)}/detect`, { method: 'POST', body: '{}' }),/** Move an agent to a computer, choosing its engine (Cumora Cloud = managed). */- assignAgentComputer: (agentId: string, computerId: string, engine?: EngineId, inherit?: boolean) =>+ assignAgentComputer: (+ agentId: string,+ computerId: string,+ engine?: EngineId,+ inherit?: boolean,+ model?: string | null,+ fastModel?: string | null,+ ) =>http<{ ok: boolean; kind: ComputerKind; engine: EngineId; inherit?: boolean }>(`/agents/${encodeURIComponent(agentId)}/computer`,- { method: 'POST', body: JSON.stringify({ computerId, engine, inherit }) }),+ { method: 'POST', body: JSON.stringify({ computerId, engine, inherit, model, fastModel }) }),createAgent: (input: AgentCreateInput) =>http<{id: stringdiff --git a/src/components/AgentEditor.tsx b/src/components/AgentEditor.tsxindex 77ac0ba..ae4bf56 100644--- a/src/components/AgentEditor.tsx+++ b/src/components/AgentEditor.tsx@@ -8,6 +8,7 @@ import { useAuth } from '@/stores/auth'import { Input } from '@/components/Input'import { TextArea } from '@/components/TextArea'import { Select } from '@/components/Select'+import { Combobox, type ComboboxOption } from '@/components/Combobox'import type { Participant, EngineId } from '@/types'import { useT } from '@/lib/i18n'import { engineLabel } from '@/lib/engines'@@ -93,6 +94,39 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {: (selectedComputer?.availableEngines[0] ?? 'claude')) as EngineIdconst selectedComputerOffline = isByoa && selectedComputer.status !== 'online'+ const modelCatalog = selectedComputer?.detectedEngines+ ?.find((engine) => engine.id === selectedEngineId)+ ?.modelCatalog+ const modelOptions: Array<ComboboxOption<string>> = [+ {+ value: '',+ label: t('agent.followEngineDefault'),+ hint: modelCatalog?.defaultModel ?? undefined,+ },+ ...(modelCatalog?.models ?? []).map((option) => ({+ value: option.id,+ label: option.label,+ hint: [+ option.label !== option.id ? option.id : null,+ option.recommendedFor?.includes('big') ? t('agent.recommended') : null,+ ].filter(Boolean).join(' · ') || undefined,+ })),+ ]+ const fastModelOptions: Array<ComboboxOption<string>> = [+ {+ value: '',+ label: t('agent.followSmallBrainDefault'),+ hint: modelCatalog?.defaultFastModel ?? undefined,+ },+ ...(modelCatalog?.models ?? []).map((option) => ({+ value: option.id,+ label: option.label,+ hint: [+ option.label !== option.id ? option.id : null,+ option.recommendedFor?.includes('small') ? t('agent.recommended') : null,+ ].filter(Boolean).join(' · ') || undefined,+ })),+ ]const origin = getPairingServerOrigin()const repairCommand = repairCode? `npx cumora@latest agent computer --pair ${repairCode}${origin ? ` --server ${origin}` : ''}`@@ -132,10 +166,19 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {else if (!isFreeTier && cloud) { setComputerId(cloud.id); setEngineChoice(INHERIT_ENGINE) }}, [cloud, firstByoa, computerId, isFreeTier])+ // Model ids belong to the selected local engine/account. Do not carry a pin+ // across a host or engine switch where the new CLI may reject it.+ const clearModelPins = (): void => {+ setModel('')+ setFastModel('')+ }+const changeComputer = (id: string): void => {+ if (id === computerId) returnengineTouched.current = truesetComputerId(id)setEngineChoice(INHERIT_ENGINE)+ clearModelPins()}// Esc to close@@ -155,16 +198,25 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {const isByoaTarget = !!targetComputer && targetComputer.kind !== 'cloud'const inherit = engineChoice === INHERIT_ENGINEconst pinned = inherit ? undefined : (engineChoice as EngineId)+ const savedChoice = initialEngineChoice(agent, targetComputer)+ const inheritChanged = isByoaTarget && inherit !== (savedChoice === INHERIT_ENGINE)+ const engineChanged = isByoaTarget && !inherit && pinned !== ((agent?.engine as EngineId) ?? null)+ const assignmentChanged = Boolean(target && (target !== current || inheritChanged || engineChanged))const payload: AgentInput = {name, role, systemPrompt, bio, avatarBg,model: model.trim() || null,fastModel: fastModel.trim() || null,}+ // A host/engine change persists these pins in the assignment's single+ // SQL UPDATE. Do not clear them earlier if that assignment may fail.+ const profilePayload = assignmentChanged+ ? { ...payload, model: undefined, fastModel: undefined }+ : payloadlet agentId = agent?.idif (editing) {// Only send avatarUrl on change so we don't clobber it on no-op edits.- if ((agent!.avatarUrl ?? null) !== avatarUrl) payload.avatarUrl = avatarUrl- await api.updateAgent(agent!.id, payload)+ if ((agent!.avatarUrl ?? null) !== avatarUrl) profilePayload.avatarUrl = avatarUrl+ await api.updateAgent(agent!.id, profilePayload)} else {// Creation + initial host/engine assignment is one transaction. The// stable request id makes retry-after-timeout return that same Agent.@@ -184,11 +236,15 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {// (Engine lives in the same assign call; gating only on the computer// would silently drop a Claude→Codex switch on the same machine.) Still// skipped on a plain style edit to avoid the owner/admin-gated call.- const savedChoice = initialEngineChoice(agent, targetComputer)- const inheritChanged = isByoaTarget && inherit !== (savedChoice === INHERIT_ENGINE)- const engineChanged = isByoaTarget && !inherit && pinned !== ((agent?.engine as EngineId) ?? null)- if (editing && agentId && target && (target !== current || inheritChanged || engineChanged)) {- const out = await api.assignAgentComputer(agentId, target, isByoaTarget ? pinned : undefined, isByoaTarget ? inherit : false)+ if (editing && agentId && target && assignmentChanged) {+ const out = await api.assignAgentComputer(+ agentId,+ target,+ isByoaTarget ? pinned : undefined,+ isByoaTarget ? inherit : false,+ model.trim() || null,+ fastModel.trim() || null,+ )if (isByoaTarget && pinned && out.engine !== pinned) {throw new Error(t('agent.enginePinRejected', { engine: engineLabel(pinned) }))}@@ -303,48 +359,43 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {<Fieldlabel={isByoa ? t('agent.modelLabelByoa') : t('agent.modelLabel')}- hint={isByoa- ? `${t('agent.modelHintByoaPrefix')} ${selectedEngineId === 'codex' ? t('agent.modelHintByoaCodex') : selectedEngineId === 'grok' ? t('agent.modelHintByoaGrok') : selectedEngineId === 'cursor' ? t('agent.modelHintByoaCursor') : selectedEngineId === 'opencode' ? t('agent.modelHintByoaOpenCode') : selectedEngineId === 'pi' ? t('agent.modelHintByoaPi') : selectedEngineId === 'gemini' ? t('agent.modelHintByoaGemini') : selectedEngineId === 'qwen' ? t('agent.modelHintByoaQwen') : selectedEngineId === 'antigravity' ? t('agent.modelHintByoaAntigravity') : t('agent.modelHintByoaClaude')} ${t('agent.modelHintByoaSuffix')}`- : t('agent.modelHintCloud')}+ hint={isByoa ? t('agent.modelHintByoaCatalog') : t('agent.modelHintCloud')}>- <Input- type="text"- value={model}- onChange={(e) => setModel(e.target.value)}- placeholder={t('agent.defaultPh')}- className="font-mono"- spellCheck={false}- />+ {isByoa ? (+ <Combobox+ ariaLabel={t('agent.modelLabelByoa')}+ value={model}+ onValueChange={setModel}+ options={modelOptions}+ searchPlaceholder={t('agent.searchModels')}+ allowCustom={modelCatalog?.supportsCustom !== false}+ customLabel={(value) => t('agent.useCustomModel', { model: value })}+ />+ ) : (+ <Input+ type="text"+ value={model}+ onChange={(e) => setModel(e.target.value)}+ placeholder={t('agent.defaultPh')}+ className="font-mono"+ spellCheck={false}+ />+ )}</Field>- {isByoa && (+ {isByoa && (!modelCatalog || modelCatalog.fastModelScope === 'agent') && (<Fieldlabel={t('agent.fastLabelByoa')}- hint={selectedEngineId === 'codex'- ? t('agent.fastHintByoaCodex')- : selectedEngineId === 'grok'- ? t('agent.fastHintByoaGrok')- : selectedEngineId === 'cursor'- ? t('agent.fastHintByoaCursor')- : selectedEngineId === 'opencode'- ? t('agent.fastHintByoaOpenCode')- : selectedEngineId === 'pi'- ? t('agent.fastHintByoaPi')- : selectedEngineId === 'gemini'- ? t('agent.fastHintByoaGemini')- : selectedEngineId === 'qwen'- ? t('agent.fastHintByoaQwen')- : selectedEngineId === 'antigravity'- ? t('agent.fastHintByoaAntigravity')- : t('agent.fastHintByoaClaude')}+ hint={t('agent.fastHintByoaCatalog')}>- <Input- type="text"+ <Combobox+ ariaLabel={t('agent.fastLabelByoa')}value={fastModel}- onChange={(e) => setFastModel(e.target.value)}- placeholder={t('agent.defaultPh')}- className="font-mono"- spellCheck={false}+ onValueChange={setFastModel}+ options={fastModelOptions}+ searchPlaceholder={t('agent.searchModels')}+ allowCustom={modelCatalog?.supportsCustom !== false}+ customLabel={(value) => t('agent.useCustomModel', { model: value })}/></Field>)}@@ -380,7 +431,12 @@ export function AgentEditor({ agent, onClose, onSaved }: Props) {<SelectariaLabel={t('agent.engineLabel')}value={engineChoice}- onValueChange={(value) => { engineTouched.current = true; setEngineChoice(value) }}+ onValueChange={(value) => {+ if (value === engineChoice) return+ engineTouched.current = true+ setEngineChoice(value)+ clearModelPins()+ }}options={(() => {const advertised = selectedComputer.availableEngines.length? selectedComputer.availableEnginesdiff --git a/src/components/Combobox.tsx b/src/components/Combobox.tsxindex 67bdc0b..8184528 100644--- a/src/components/Combobox.tsx+++ b/src/components/Combobox.tsx@@ -31,6 +31,10 @@ interface ComboboxProps<T extends string = string> {ariaLabel?: stringclassName?: stringemptyText?: string+ /** Allow committing a value that is not present in options. Useful for model+ * ids whose provider/account catalog cannot be enumerated reliably. */+ allowCustom?: boolean+ customLabel?: (value: string) => string}export function Combobox<T extends string = string>({@@ -42,6 +46,8 @@ export function Combobox<T extends string = string>({ariaLabel,className,emptyText: emptyTextProp,+ allowCustom = false,+ customLabel = (customValue) => customValue,}: ComboboxProps<T>) {const t = useT()// Defaults resolve through t() so they follow the active locale;@@ -65,13 +71,18 @@ export function Combobox<T extends string = string>({o.label.toLowerCase().includes(needle) || (o.hint?.toLowerCase().includes(needle) ?? false),)}, [options, query])+ const customValue = allowCustom && query.trim()+ && !options.some((option) => option.value.toLowerCase() === query.trim().toLowerCase())+ ? query.trim()+ : ''+ const resultCount = filtered.length + (customValue ? 1 : 0)// Keep the highlight on the current value when the menu (re)opens, else top.useEffect(() => {if (!open) returnconst idx = filtered.findIndex((o) => o.value === value)setActiveIndex(idx >= 0 ? idx : 0)- }, [open, filtered, value])+ }, [open, filtered, value, customValue])// Close on outside click.useEffect(() => {@@ -91,9 +102,14 @@ export function Combobox<T extends string = string>({onValueChange(o.value)setOpen(false); setQuery(''); inputRef.current?.blur()}+ const commitCustom = () => {+ if (!customValue) return+ onValueChange(customValue as T)+ setOpen(false); setQuery(''); inputRef.current?.blur()+ }// Closed: show the selected label (or placeholder). Open: show the live query.- const displayValue = open ? query : (selected?.label ?? placeholder)+ const displayValue = open ? query : (selected?.label ?? value ?? placeholder)return (<div ref={rootRef} className={cn('relative', className)}>@@ -114,7 +130,7 @@ export function Combobox<T extends string = string>({aria-autocomplete="list"aria-expanded={open}aria-controls={`${id}-listbox`}- aria-activedescendant={open && filtered[activeIndex] ? `${id}-option-${activeIndex}` : undefined}+ aria-activedescendant={open && activeIndex >= 0 && activeIndex < resultCount ? `${id}-option-${activeIndex}` : undefined}value={displayValue}placeholder={open ? searchPlaceholder : placeholder}onFocus={openMenu}@@ -122,9 +138,9 @@ export function Combobox<T extends string = string>({onChange={(e) => { if (!open) setOpen(true); setQuery(e.target.value) }}onKeyDown={(e) => {if (e.nativeEvent.isComposing) return- if (e.key === 'ArrowDown') { e.preventDefault(); if (!open) { openMenu(); return } setActiveIndex((i) => Math.min(filtered.length - 1, i + 1)); return }+ if (e.key === 'ArrowDown') { e.preventDefault(); if (!open) { openMenu(); return } setActiveIndex((i) => Math.min(resultCount - 1, i + 1)); return }if (e.key === 'ArrowUp') { e.preventDefault(); if (!open) { openMenu(); return } setActiveIndex((i) => Math.max(0, i - 1)); return }- if (e.key === 'Enter') { e.preventDefault(); commit(filtered[activeIndex]); return }+ if (e.key === 'Enter') { e.preventDefault(); if (activeIndex < filtered.length) commit(filtered[activeIndex]); else commitCustom(); return }if (e.key === 'Escape') { e.preventDefault(); setOpen(false); setQuery('') }}}className="h-full min-w-0 flex-1 rounded-[14px] bg-transparent px-3.5 pr-10 text-[13px] font-semibold text-ink-900 outline-none placeholder:text-ink-300"@@ -189,7 +205,26 @@ export function Combobox<T extends string = string>({</button>)})}- {filtered.length === 0 && (+ {customValue && (+ <button+ id={`${id}-option-${filtered.length}`}+ type="button"+ role="option"+ aria-selected={false}+ onMouseDown={(e) => e.preventDefault()}+ onMouseEnter={() => setActiveIndex(filtered.length)}+ onClick={commitCustom}+ className={cn(+ 'flex h-9 w-full items-center gap-2.5 rounded-[10px] px-3 text-left text-[12.5px] font-semibold transition',+ activeIndex === filtered.length+ ? 'bg-sky2-50 text-skype-deep'+ : 'text-ink-700 hover:bg-sky2-50 hover:text-skype-deep',+ )}+ >+ <span className="min-w-0 flex-1 truncate">{customLabel(customValue)}</span>+ </button>+ )}+ {filtered.length === 0 && !customValue && (<div className="px-3 py-3 text-[12.5px] font-semibold text-ink-400">{emptyText}</div>)}</div>diff --git a/src/locales/en.ts b/src/locales/en.tsindex bc505d4..274205a 100644--- a/src/locales/en.ts+++ b/src/locales/en.ts@@ -453,6 +453,13 @@ export const en = {'agent.bioPh': "A one-line description of what they're best at.",'agent.modelLabel': 'Model','agent.modelLabelByoa': 'Big-brain model (大脑)',+ 'agent.modelHintByoaCatalog': 'Choose a model available to this computer\'s engine, or search and enter a custom model id.',+ 'agent.fastHintByoaCatalog': 'Per-agent model for lightweight decisions such as inbox triage. Blank uses the engine\'s small-brain default.',+ 'agent.followEngineDefault': 'Follow engine default',+ 'agent.followSmallBrainDefault': 'Follow small-brain default',+ 'agent.searchModels': 'Search models or enter a model id…',+ 'agent.useCustomModel': 'Use custom model: {model}',+ 'agent.recommended': 'Recommended','agent.modelHintByoaPrefix': 'Main reasoning model passed to the engine as --model.','agent.modelHintByoaCodex': 'A model name (e.g. gpt-5.5, o3).','agent.modelHintByoaGrok': 'A Grok model (e.g. grok-4.6).',diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.tsindex 148228d..2727d47 100644--- a/src/locales/zh-CN.ts+++ b/src/locales/zh-CN.ts@@ -455,6 +455,13 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {'agent.bioPh': '一行简介,说明它最擅长什么。','agent.modelLabel': '模型','agent.modelLabelByoa': '主力模型(大脑)',+ 'agent.modelHintByoaCatalog': '从这台计算机上的引擎实际可用模型中选择;也可以搜索并输入自定义模型 ID。',+ 'agent.fastHintByoaCatalog': '用于收件箱分流等轻量判断的成员级模型。留空时使用该引擎的小脑默认值。',+ 'agent.followEngineDefault': '跟随引擎默认',+ 'agent.followSmallBrainDefault': '跟随小脑默认',+ 'agent.searchModels': '搜索模型或输入模型 ID…',+ 'agent.useCustomModel': '使用自定义模型:{model}',+ 'agent.recommended': '推荐','agent.modelHintByoaPrefix': '主推理模型,会作为 --model 参数传给引擎。','agent.modelHintByoaCodex': '模型名称(例如 gpt-5.5、o3)。','agent.modelHintByoaGrok': 'Grok 模型(例如 grok-4.6)。',diff --git a/src/types.ts b/src/types.tsindex 328bb71..66b5dc1 100644--- a/src/types.ts+++ b/src/types.ts@@ -9,6 +9,39 @@ export type ComputerStatus = 'online' | 'offline' | 'busy'/** Engine an agent's host runs it on. 'managed' = Cumora's server-side loop. */export type EngineId = 'managed' | 'claude' | 'codex' | 'grok' | 'cursor' | 'opencode' | 'pi' | 'gemini' | 'qwen' | 'antigravity'+export interface EngineModelOption {+ id: string+ label: string+ description?: string | null+ recommendedFor?: Array<'big' | 'small'>+}++export interface EngineModelCatalog {+ models: EngineModelOption[]+ defaultModel: string | null+ defaultFastModel: string | null+ supportsCustom: boolean+ fastModelScope: 'agent' | 'computer' | 'unsupported'+ source: 'protocol' | 'cli' | 'presets'+}++export interface DetectedEngine {+ 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+ /** Set when Cumora refuses to drive an installed engine. */+ blockedReason?: string | null+ /** Models visible to the CLI login/config on this specific computer. */+ modelCatalog?: EngineModelCatalog+}+export interface Computer {id: stringname: string@@ -19,22 +52,7 @@ export interface Computer {/** 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- /** Set when the engine is installed there but Cumora refuses to drive it —- * an old CLI, or a missing sandbox dependency. The daemon knows this and- * now says so, instead of the engine merely going absent. */- blockedReason?: string | null- }>+ detectedEngines?: DetectedEngine[]enginesDetectedAt?: string | nulllastSeenAt?: string | nullpairedAt?: string | null