Files
orca/src/shared/agent-model-probe-spec.ts
T
Jinwoo Hong 7bc9ff947c fix(grok): add Grok 4.7 to the fallback model catalog (#25976)
grok 1.0.41's `grok models` now reports `Default model: grok-4.7` and its
model cache advertises low/medium/high/xhigh effort for grok-4.7. Seed it as
the CLI default with an xhigh ceiling, keep grok-4.6 and grok-4.5, and move
the probe spec default in step with the seed.

Fixes STA-9652
2026-10-06 18:47:30 -04:00

59 lines
2.0 KiB
TypeScript

import { getCommitMessageAgentSpec, type CommitMessageAgentSpec } from './commit-message-agent-spec'
import { GROK_MODEL_LIST_ARGS, parseGrokModelList } from './grok-model-list-probe'
import { OMP_MODEL_LIST_ARGS, parseOmpModelList } from './omp-model-list-probe'
import type { TuiAgent } from './tui-agent'
/** Why: model discovery reads only these fields; excluding the prompt-delivery
* half is what keeps a probe-only agent out of the commit-message registry. */
export type AgentModelProbeSpec = Omit<CommitMessageAgentSpec, 'promptDelivery' | 'buildArgs'>
/** Agents that support model discovery but are not commit-message agents. */
const MODEL_DISCOVERY_ONLY_SPECS: Partial<Record<TuiAgent, AgentModelProbeSpec>> = {
grok: {
id: 'grok',
label: 'Grok',
binary: 'grok',
modelSource: 'dynamic',
modelDiscovery: {
binary: 'grok',
args: GROK_MODEL_LIST_ARGS,
parse: parseGrokModelList
},
// Why: empty so a failed probe degrades to the catalog seed instead of a
// second model list here that can drift from it.
models: [],
defaultModelId: 'grok-4.7'
},
omp: {
id: 'omp',
label: 'OMP',
binary: 'omp',
modelSource: 'dynamic',
modelDiscovery: {
binary: 'omp',
args: OMP_MODEL_LIST_ARGS,
parse: parseOmpModelList
},
// Why: nothing is available on every OMP install, so there is no seed and no
// default to name; discovery's first row stands in when a default is required.
models: [],
defaultModelId: ''
}
}
export function getAgentModelProbeSpec(agentId: TuiAgent): AgentModelProbeSpec | undefined {
const spec = getCommitMessageAgentSpec(agentId) ?? MODEL_DISCOVERY_ONLY_SPECS[agentId]
if (!spec) {
return undefined
}
// OMP's `default` means the provider configured in its own settings, not a selectable model.
if (agentId !== 'omp') {
return spec
}
return {
...spec,
models: spec.models.filter((model) => model.id !== 'default'),
defaultModelId: spec.defaultModelId === 'default' ? '' : spec.defaultModelId
}
}