Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui): populate OpenCode model dropdown across agent surfaces (#373)
Call White36982032f940
diff --git a/ui/src/components/workbench/AgentsPage.tsx b/ui/src/components/workbench/AgentsPage.tsxindex 8ff4cfd2d..354d76ed4 100644--- a/ui/src/components/workbench/AgentsPage.tsx+++ b/ui/src/components/workbench/AgentsPage.tsx@@ -32,6 +32,7 @@ import { Textarea } from '../ui/textarea';import { EditorDialog } from '../ui/editor-dialog';import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';import { estimateTokens } from '../../lib/tokenEstimate';+import { fetchBackendModels } from '../../lib/backendModels';import { WorkbenchPageHeader } from './WorkbenchPageHeader';// Backend order / labels / accent classes live in lib/backendAccent, shared// with the Skills surface (BACKEND_TEXT is this page's old BACKEND_ICON_CLASS).@@ -512,14 +513,7 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, onChange, olet cancelled = false;async function loadModels() {try {- let models: string[] = [];- if (agent.backend === 'claude') {- const result = await api.claudeModels();- if (result.ok && result.models) models = result.models;- } else if (agent.backend === 'codex') {- const result = await api.codexModels();- if (result.ok && result.models) models = result.models;- }+ const { models } = await fetchBackendModels(api, agent.backend);if (!cancelled) setModelOptions(models.map((m) => ({ value: m, label: m })));} catch {if (!cancelled) setModelOptions([]);diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsxindex 0e848e26e..c95466a14 100644--- a/ui/src/components/workbench/ChatPage.tsx+++ b/ui/src/components/workbench/ChatPage.tsx@@ -9,6 +9,7 @@ import { useWorkbenchInbox } from '../../context/WorkbenchInboxContext';import type { VibeAgentBrief, WorkbenchMessage, WorkbenchSession } from '../../context/ApiContext';import { apiFetch } from '../../lib/apiFetch';import { formatLocalDateTime } from '../../lib/relativeTime';+import { fetchBackendModels } from '../../lib/backendModels';import { Button } from '../ui/button';import { Input } from '../ui/input';import { Markdown } from '../ui/markdown';@@ -965,27 +966,16 @@ const AgentRoutePicker: React.FC<AgentRoutePickerProps> = ({ session, agents, onsetLoadingModels(true);(async () => {try {- let models: string[] = [];- if (backend === 'claude') {- const res = await api.claudeModels();- models = res.models ?? [];- // Capture the per-model effort sets so Column 3 can offer xhigh/max- // only for the models that actually support them.- if (!cancelled && res.reasoning_options) setClaudeReasoning(res.reasoning_options);- } else if (backend === 'codex') models = (await api.codexModels()).models ?? [];- else if (backend === 'opencode')- // The providers endpoint returns RAW model ids per provider (never- // provider-prefixed), and the OpenCode adapter resolves the override- // by splitting the selected value on the FIRST "/" into- // {providerID, modelID}. So ALWAYS prepend the provider id — even- // when the raw id itself contains "/" (e.g. OpenRouter's- // ``anthropic/claude-*`` must become ``openrouter/anthropic/claude-*``,- // not be misread as provider ``anthropic``). The first-slash split- // keeps the remainder (``anthropic/claude-*``) intact as the model.- models = ((await api.getOpencodeProviders()).providers ?? []).flatMap((p) =>- (p.models ?? []).map((m) => `${p.id}/${m}`),- );- if (!cancelled) setModelsByBackend((prev) => ({ ...prev, [backend]: models }));+ // Shared resolver (lib/backendModels) — OpenCode's provider-prefixing+ // and the per-backend fetch live there so every model picker stays+ // consistent (Agents detail panel, New Agent dialog, this menu).+ const { models, reasoningOptions } = await fetchBackendModels(api, backend);+ if (!cancelled) {+ // Claude returns per-model effort sets so Column 3 can offer+ // xhigh/max only for the models that actually support them.+ if (reasoningOptions) setClaudeReasoning(reasoningOptions);+ setModelsByBackend((prev) => ({ ...prev, [backend]: models }));+ }} catch {if (!cancelled) setModelsByBackend((prev) => ({ ...prev, [backend]: [] }));} finally {diff --git a/ui/src/components/workbench/NewAgentDialog.tsx b/ui/src/components/workbench/NewAgentDialog.tsxindex 4b2856f6e..03648d6c2 100644--- a/ui/src/components/workbench/NewAgentDialog.tsx+++ b/ui/src/components/workbench/NewAgentDialog.tsx@@ -5,6 +5,7 @@ import clsx from 'clsx';import { useApi } from '../../context/ApiContext';import type { VibeAgentFull } from '../../context/ApiContext';+import { fetchBackendModels } from '../../lib/backendModels';import { Combobox } from '../ui/combobox';import type { ComboboxOption } from '../ui/combobox';import { Input } from '../ui/input';@@ -74,14 +75,7 @@ export const NewAgentDialog: React.FC<NewAgentDialogProps> = ({ open, onClose, olet cancelled = false;async function loadModels() {try {- let models: string[] = [];- if (backend === 'claude') {- const result = await api.claudeModels();- if (result.ok && result.models) models = result.models;- } else if (backend === 'codex') {- const result = await api.codexModels();- if (result.ok && result.models) models = result.models;- }+ const { models } = await fetchBackendModels(api, backend);if (!cancelled) {setModelOptions(models.map((m) => ({ value: m, label: m })));// Clear model when the backend changes if the previous choicediff --git a/ui/src/lib/backendModels.ts b/ui/src/lib/backendModels.tsnew file mode 100644index 000000000..1d7c020da--- /dev/null+++ b/ui/src/lib/backendModels.ts@@ -0,0 +1,46 @@+import type { ApiContextType } from '../context/ApiContext';++export interface BackendModels {+ /** Selectable model identifiers for the backend. */+ models: string[];+ /** Per-model reasoning-effort option sets (Claude only); undefined elsewhere. */+ reasoningOptions?: Record<string, { value: string; label: string }[]>;+}++// Single source of truth for "list the selectable models for a backend",+// shared by ChatPage, the Agents detail panel, and the New Agent dialog so a+// new backend (or a fix like OpenCode's provider-prefixing) lands in one place.+//+// claude / codex expose flat model arrays. OpenCode's catalog is per-provider+// and the provider endpoint returns RAW model ids (never provider-prefixed), so+// we flatten it into ``providerId/modelId`` keys — ALWAYS provider-prefixed,+// even when the raw id itself contains "/" (e.g. OpenRouter's+// ``anthropic/claude-*`` must become ``openrouter/anthropic/claude-*``). The+// OpenCode adapter resolves the override by splitting on the FIRST "/" into+// {providerID, modelID}, so the prefix is required for the selection to bind to+// the right provider. Callers keep ``allowCustomValue`` so a model the catalog+// doesn't know yet can still be typed.+export async function fetchBackendModels(+ api: ApiContextType,+ backend: string,+): Promise<BackendModels> {+ if (backend === 'claude') {+ const res = await api.claudeModels();+ return {+ models: res.ok && res.models ? res.models : [],+ reasoningOptions: res.reasoning_options,+ };+ }+ if (backend === 'codex') {+ const res = await api.codexModels();+ return { models: res.ok && res.models ? res.models : [] };+ }+ if (backend === 'opencode') {+ const res = await api.getOpencodeProviders();+ const models = (res.providers ?? []).flatMap((p) =>+ (p.models ?? []).map((m) => `${p.id}/${m}`),+ );+ return { models };+ }+ return { models: [] };+}