Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

fix(ui): align backend order and model hub identity (#2451)

Call Whited137cb92c5e5
diff --git a/ui/e2e/workbench-general/geometry.spec.ts b/ui/e2e/workbench-general/geometry.spec.ts
index f8ccb2244..32d43f0ed 100644
--- a/ui/e2e/workbench-general/geometry.spec.ts
+++ b/ui/e2e/workbench-general/geometry.spec.ts
@@ -1,4 +1,4 @@
-import { expect, test, type Page } from '@playwright/test';
+import { expect, test, type Locator, type Page } from '@playwright/test';
import { DESKTOP, NARROW, ORIGIN, WIDE, config, open, serveProduct } from './support';
@@ -580,6 +580,71 @@ test.describe('general settings geometry', () => {
});
}
+ // Class-based component tests cannot see a scoped Hub stylesheet overriding
+ // a shared token. Compare the actual marks and computed ink/tile in both themes.
+ for (const theme of ['light', 'dark'] as const) {
+ for (const viewport of [DESKTOP, NARROW]) {
+ test(`matches backend identity across Settings and Model Hub in ${theme} at ${viewport.width}px`, async ({ page }) => {
+ const { denied, unexpectedModelReads } = await serveModelHub(page);
+ const backends = ['vibey', 'claude', 'codex', 'opencode'];
+ const labels = ['Vibey', 'Claude Code', 'Codex', 'OpenCode'];
+ let direct = false;
+ await page.route('**/api/models/agents/*/chains', (route) => {
+ expect(route.request().method()).toBe('GET');
+ return route.fulfill({ json: { chains: [] } });
+ });
+ // This mount-time scan is answered entirely by the test, never the host.
+ await page.route('**/api/models/migration/scan', (route) => {
+ expect(route.request().method()).toBe('POST');
+ return route.fulfill({ json: { items: [] } });
+ });
+ await page.route(/\/api\/models\/agents(?:\?.*)?$/, (route) => {
+ expect(route.request().method()).toBe('GET');
+ return route.fulfill({ json: { agents: [...backends].reverse()
+ .filter((backend) => !direct || backend !== 'vibey')
+ .map((backend) => ({
+ backend, cli_present: backend !== 'vibey', mode: direct ? 'direct' : 'hub',
+ menu_kind: 'fixed', catalog_models: [], named_agents: [],
+ })) } });
+ });
+ const identity = (icon: Locator) => icon.evaluate((svg) => ({
+ mark: svg.innerHTML,
+ ink: getComputedStyle(svg).color,
+ tile: getComputedStyle(svg.parentElement!).backgroundColor,
+ }));
+ await page.setViewportSize(viewport);
+ await open(page, '/settings/backends', { theme });
+ const settingsIdentities = [];
+ for (const label of labels) {
+ const row = page.locator('.rounded-xl').filter({ has: page.getByText(label, { exact: true }) });
+ await expect(row).toBeVisible();
+ settingsIdentities.push(await identity(row.locator('svg').first()));
+ }
+ await page.screenshot({ path: `e2e/.artifacts/workbench-general/backends-${theme}-${viewport.width}.png`, fullPage: true });
+
+ await open(page, '/settings/models', { theme });
+ const cards = page.locator('[data-agent-backend]');
+ await expect(cards.locator('h2')).toHaveText(labels);
+ for (let index = 0; index < backends.length; index += 1) {
+ const icon = cards.nth(index).locator('.model-hub-agent-head-summary svg').first();
+ await expect.poll(() => identity(icon)).toEqual(settingsIdentities[index]);
+ }
+ await page.screenshot({ path: `e2e/.artifacts/workbench-general/hub-${theme}-${viewport.width}.png`, fullPage: true });
+
+ direct = true;
+ await open(page, '/settings/models', { theme });
+ const nativeRows = page.locator('.model-hub-direct-row--backend');
+ await expect(nativeRows.locator('.model-hub-direct-backend-name')).toHaveText(labels.slice(1));
+ for (let index = 0; index < 3; index += 1) {
+ await expect.poll(() => identity(nativeRows.nth(index).locator('svg').first()))
+ .toEqual(settingsIdentities[index + 1]);
+ }
+ expect(denied).toEqual([]);
+ expect(unexpectedModelReads).toEqual([]);
+ });
+ }
+ }
+
test('draws the preference card, the selector and the selected choice to spec', async ({ page }) => {
await serveProduct(page);
await page.setViewportSize(DESKTOP);
diff --git a/ui/src/components/settings/SettingsBackendsPage.test.tsx b/ui/src/components/settings/SettingsBackendsPage.test.tsx
index 0f0c2d72a..c49aa13b2 100644
--- a/ui/src/components/settings/SettingsBackendsPage.test.tsx
+++ b/ui/src/components/settings/SettingsBackendsPage.test.tsx
@@ -63,13 +63,13 @@ const rowOf = async (name: string) => (await screen.findByText(name)).closest('.
describe('built-in backend settings', () => {
// The built-in Vibey is part of the platform: listed first, always on,
// and marked Built-in where every other backend has its enable switch.
- it('lists Avibe first as Built-in with no switch, and its page has no switch or native actions', async () => {
+ it('uses the shared display order, with Vibey Built-in and no switch or native actions', async () => {
renderBackends();
const vibey = await rowOf('Vibey');
const rows = [...document.querySelectorAll('.rounded-xl')];
expect(rows.map((row) => row.querySelector('span.font-semibold')?.textContent)).toEqual([
- 'Vibey', 'OpenCode', 'Claude Code', 'Codex',
+ 'Vibey', 'Claude Code', 'Codex', 'OpenCode',
]);
expect(within(vibey).getByText('Built-in')).toBeTruthy();
expect(within(vibey).queryByRole('switch')).toBeNull();
diff --git a/ui/src/components/settings/SettingsBackendsPage.tsx b/ui/src/components/settings/SettingsBackendsPage.tsx
index f381fc35a..5615f98f1 100644
--- a/ui/src/components/settings/SettingsBackendsPage.tsx
+++ b/ui/src/components/settings/SettingsBackendsPage.tsx
@@ -18,7 +18,7 @@ import { configChanges } from '@/lib/configMutations';
import { errorMessage } from '@/lib/errorMessage';
// Mirrors design.pen qVHh4 (VR/CM/Backends): one horizontal card per backend,
-// in catalog order with the built-in backend first. Each card
+// in shared display order: built-in first, then native setup order. Each card
// surfaces icon + name/description + status chip + enable toggle (a
// "Built-in" badge instead for the always-enabled backend) + a
// "Configure" link that drills into the level-2 provider page. CLI path,
diff --git a/ui/src/components/settings/models/AgentCard.test.tsx b/ui/src/components/settings/models/AgentCard.test.tsx
index c40c6c8e0..17d740c46 100644
--- a/ui/src/components/settings/models/AgentCard.test.tsx
+++ b/ui/src/components/settings/models/AgentCard.test.tsx
@@ -7,6 +7,7 @@ import { I18nextProvider, initReactI18next } from 'react-i18next';
import { afterEach, describe, expect, it, vi } from 'vitest';
import i18n from '@/i18n';
+import { BACKEND_BRAND_MARKS } from '@/components/visual/backendBrandMarks';
import en from '../../../i18n/en.json';
import zh from '../../../i18n/zh.json';
import { AgentCard as RuntimeAgentCard } from './AgentCard';
@@ -73,26 +74,39 @@ afterEach(cleanup);
describe('backend brand ownership', () => {
// Card headings previously came from a second i18n brand table. Existing
// fixtures used identical translations, masking divergence from the catalog.
- it.each(['en', 'zh'] as const)('keeps every backend brand catalog-owned in %s', (language) => {
+ // The API's enumeration and the Hub's separate palette used to leak into the
+ // cards. Render the consumer: comparing palette entries to themselves missed it.
+ it.each(['en', 'zh'] as const)('uses the Settings backend order, marks and tile colors in %s', (language) => {
const locale = localeInstance(language);
const rows = [
- { backend: 'claude', label: 'Claude Code' },
- { backend: 'codex', label: 'Codex' },
- { backend: 'opencode', label: 'OpenCode' },
- { backend: 'vibey', label: 'Vibey' },
+ { backend: 'vibey', label: 'Vibey', tile: 'bg-mint-soft', ink: 'text-mint-ink', glyph: null },
+ { backend: 'claude', label: 'Claude Code', tile: 'bg-cyan-soft', ink: 'text-cyan-ink', glyph: 'lucide-sparkles' },
+ { backend: 'codex', label: 'Codex', tile: 'bg-gold', ink: 'text-gold-foreground', glyph: 'lucide-bot' },
+ { backend: 'opencode', label: 'OpenCode', tile: 'bg-violet-soft', ink: 'text-violet-ink', glyph: 'lucide-terminal' },
] as const;
+ const agents = [...rows].reverse().map(({ backend }) => ({ ...hubAgent, backend }));
+ const originalOrder = agents.map(({ backend }) => backend);
for (const { backend } of rows) {
locale.addResource(language, 'translation', `settings.models.backends.${backend}`, 'Obsolete localized brand');
}
render(<I18nextProvider i18n={locale}><AgentCard
- agents={rows.map(({ backend }) => ({ ...hubAgent, backend }))}
+ agents={agents}
sources={[]} chains={{}} pendingBackends={new Set()} switchFailures={new Set()}
connectingBackend={null} onConnectHub={vi.fn()} onSwitchDirect={vi.fn()}
onOpenOrder={vi.fn()} onOpenRoute={vi.fn()} onProbeSettled={vi.fn()}
/></I18nextProvider>);
- expect(screen.getAllByRole('heading', { level: 2 }).map((heading) => heading.textContent))
+ expect.soft(screen.getAllByRole('heading', { level: 2 }).map((heading) => heading.textContent))
.toEqual(rows.map(({ label }) => label));
expect(screen.queryByText('Obsolete localized brand')).toBeNull();
+ expect(agents.map(({ backend }) => backend)).toEqual(originalOrder);
+ for (const { label, tile, ink, glyph } of rows) {
+ const iconTile = screen.getByRole('heading', { level: 2, name: label }).previousElementSibling!;
+ expect.soft(iconTile.classList.contains(tile)).toBe(true);
+ const svg = iconTile.querySelector('svg')!;
+ expect.soft(svg.classList.contains(ink)).toBe(true);
+ if (glyph) expect(svg.classList.contains(glyph)).toBe(true);
+ else expect(svg.querySelector('path')?.getAttribute('d')).toBe(BACKEND_BRAND_MARKS.vibey.path);
+ }
});
});
diff --git a/ui/src/components/settings/models/AgentCard.tsx b/ui/src/components/settings/models/AgentCard.tsx
index 278d55b1c..02b4f03f8 100644
--- a/ui/src/components/settings/models/AgentCard.tsx
+++ b/ui/src/components/settings/models/AgentCard.tsx
@@ -14,8 +14,7 @@ import { foldRegionRead, regionFailed } from './regionRead';
import { gatewayRouteStatus } from './supply';
import { agentHasLiveChainProjection, type FreshRuntimeProjection } from './runtimeLifecycle';
import { currentChainLink, isTakeoverChain } from './takeover';
-import { ACCENT_ICON, ACCENT_TILE, backendVisual } from './vendorMeta';
-import { getBackendUiMeta } from '@/lib/agentBackends';
+import { backendDisplayOrder, getBackendUiMeta } from '@/lib/agentBackends';
import type { AgentSupply, Source } from './types';
const sourceName = (sources: Source[], id: string): string => sources.find((source) => source.id === id)?.display_name ?? id;
@@ -200,7 +199,7 @@ const AgentModelCard: React.FC<{
onOpenAgent?: (name: string) => void;
}> = ({ agent, runtime, sources, chains, pending, connecting, switchFailed, activeOriginHelp, onOriginHelpChange, onConnectHub, onSwitchDirect, onOpenModels, onOpenOrder, onOpenRoute, onProbeSettled, onOpenAgent }) => {
const { t } = useTranslation();
- const { Icon, accent } = backendVisual(agent.backend);
+ const { Icon, tileCls, iconCls, label } = getBackendUiMeta(agent.backend);
const [expanded, setExpanded] = React.useState(false);
const [modeMenuOpen, setModeMenuOpen] = React.useState(false);
const allModels = React.useMemo(() => catalogModelIds(agent), [agent]);
@@ -261,8 +260,8 @@ const AgentModelCard: React.FC<{
>
<div className="model-hub-agent-head-summary flex min-w-0 items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-[9px]">
- <span className={cn('flex size-[30px] shrink-0 items-center justify-center rounded-[9px]', ACCENT_TILE[accent])}><Icon className={cn('size-[15px]', ACCENT_ICON[accent])} /></span>
- <h2 className="truncate text-[14px] font-bold leading-[17px] text-foreground">{getBackendUiMeta(agent.backend).label}</h2>
+ <span className={cn('flex size-[30px] shrink-0 items-center justify-center rounded-[9px]', tileCls)}><Icon className={cn('size-[15px]', iconCls)} /></span>
+ <h2 className="truncate text-[14px] font-bold leading-[17px] text-foreground">{label}</h2>
</div>
{agent.mode === 'hub' && (
<ResponsiveMenu
@@ -360,5 +359,6 @@ export const AgentCard: React.FC<{
// Late blur, leave timers and row cleanup can dismiss only their own help.
setActiveOriginHelp((current) => open ? key : current === key ? null : current);
}, []);
- return <div className="flex flex-col gap-2.5">{agents.map((agent) => <AgentModelCard key={agent.backend} agent={agent} {...props} activeOriginHelp={activeOriginHelp} onOriginHelpChange={onOriginHelpChange} pending={pendingBackends.has(agent.backend)} switchFailed={switchFailures.has(agent.backend)} connecting={connectingBackend === agent.backend} />)}</div>;
+ const orderedAgents = [...agents].sort((left, right) => backendDisplayOrder(left.backend) - backendDisplayOrder(right.backend));
+ return <div className="flex flex-col gap-2.5">{orderedAgents.map((agent) => <AgentModelCard key={agent.backend} agent={agent} {...props} activeOriginHelp={activeOriginHelp} onOriginHelpChange={onOriginHelpChange} pending={pendingBackends.has(agent.backend)} switchFailed={switchFailures.has(agent.backend)} connecting={connectingBackend === agent.backend} />)}</div>;
};
diff --git a/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx b/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx
index 213c28c8c..85b5d4a6e 100644
--- a/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx
+++ b/ui/src/components/settings/models/SettingsModelsPage.render.test.tsx
@@ -304,6 +304,27 @@ afterEach(() => {
});
describe('SettingsModelsPage surface branches', () => {
+ // DirectHome is a separate render path from gateway cards; its neutral tile
+ // and API order previously hid backend identity even when the cards were right.
+ it('keeps direct-only backends in Settings order and colors', async () => {
+ renderPage([], [directAgent('opencode'), directAgent('codex'), directAgent('claude')]);
+ await screen.findByText('Claude Code');
+ const rows = [...document.querySelectorAll('.model-hub-direct-row--backend')];
+ expect.soft(rows.map((row) => row.querySelector('.model-hub-direct-backend-name')?.textContent))
+ .toEqual(['Claude Code', 'Codex', 'OpenCode']);
+ for (const [label, tile, ink, glyph] of [
+ ['Claude Code', 'bg-cyan-soft', 'text-cyan-ink', 'lucide-sparkles'],
+ ['Codex', 'bg-gold', 'text-gold-foreground', 'lucide-bot'],
+ ['OpenCode', 'bg-violet-soft', 'text-violet-ink', 'lucide-terminal'],
+ ]) {
+ const row = screen.getByText(label).closest('.model-hub-direct-row--backend')!;
+ const svg = row.querySelector('svg')!;
+ expect.soft(svg.parentElement?.classList.contains(tile)).toBe(true);
+ expect.soft(svg.classList.contains(ink)).toBe(true);
+ expect(svg.classList.contains(glyph)).toBe(true);
+ }
+ });
+
it.each([
['right away', false],
['after a refused takeover', true],
diff --git a/ui/src/components/settings/models/SettingsModelsPage.tsx b/ui/src/components/settings/models/SettingsModelsPage.tsx
index 786e2117e..4a112e322 100644
--- a/ui/src/components/settings/models/SettingsModelsPage.tsx
+++ b/ui/src/components/settings/models/SettingsModelsPage.tsx
@@ -72,9 +72,8 @@ import { resumeGatewayAdoption } from './gatewayAdoption';
import { groupMigrationCandidates } from './migrationGrouping';
import { SUBSCRIPTION_MENU_ROWS } from './subscriptionOptions';
import { VendorGlyph } from './vendorGlyph';
-import { backendVisual } from './vendorMeta';
import { USAGE_DEFAULT_WINDOW, type AgentBackend, type AgentMode, type AgentSupply, type ResolutionEvent, type QuotaSummary, type RuntimeDependency, type Source, type UsageReport, type UsageWindowKey } from './types';
-import { getBackendUiMeta, isNativeCliBackend, type NativeCliBackend } from '@/lib/agentBackends';
+import { backendDisplayOrder, getBackendUiMeta, isNativeCliBackend, type NativeCliBackend } from '@/lib/agentBackends';
const CHAIN_READ_CONCURRENCY = 6;
const EVENT_PAGE = 20;
@@ -364,15 +363,15 @@ const DirectHome: React.FC<{
<div><h2 className="text-[16px] font-bold text-foreground">{t('settings.models.direct.card.current')}</h2><p className="mt-1 text-[11.5px] text-muted">{t('settings.models.direct.card.current.sub')}</p></div>
</div>
<div className="model-hub-direct-content flex flex-col">
- {agents.map((agent) => {
- const { Icon } = backendVisual(agent.backend);
+ {[...agents].sort((left, right) => backendDisplayOrder(left.backend) - backendDisplayOrder(right.backend)).map((agent) => {
+ const { Icon, tileCls, iconCls, label } = getBackendUiMeta(agent.backend);
const switchFailed = switchFailures.has(agent.backend);
return (
<div key={agent.backend} className="model-hub-direct-row model-hub-direct-row--backend flex flex-wrap items-center gap-2.5 bg-background px-3 sm:flex-nowrap">
- <span className="model-hub-direct-tile flex size-[34px] shrink-0 items-center justify-center rounded-[9px]"><Icon className="size-[17px]" /></span>
+ <span className={cn('flex size-[34px] shrink-0 items-center justify-center rounded-[9px]', tileCls)}><Icon className={cn('size-[17px]', iconCls)} /></span>
<span className="model-hub-direct-backend-copy">
<span className="flex min-w-0 items-center gap-1.5">
- <span className="model-hub-direct-backend-name truncate text-foreground">{getBackendUiMeta(agent.backend).label}</span>
+ <span className="model-hub-direct-backend-name truncate text-foreground">{label}</span>
<span className="model-hub-pill model-hub-direct-kind-pill border">{t('settings.models.direct.pill.direct')}</span>
</span>
{switchFailed
diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.css
index 297371045..7a41d81da 100644
--- a/ui/src/components/settings/models/modelHubSurface.css
+++ b/ui/src/components/settings/models/modelHubSurface.css
@@ -1806,7 +1806,6 @@
background: var(--model-hub-wash-0a);
color: var(--muted);
}
-.model-hub-direct-tile { background: var(--model-hub-wash-0a); color: var(--muted); }
.model-hub-direct-switch { border-color: var(--model-hub-wash-24); background: var(--model-hub-wash-0a); }
.model-hub-direct-empty {
diff --git a/ui/src/components/settings/models/vendorMeta.test.ts b/ui/src/components/settings/models/vendorMeta.test.ts
index 86a145485..cafe61fab 100644
--- a/ui/src/components/settings/models/vendorMeta.test.ts
+++ b/ui/src/components/settings/models/vendorMeta.test.ts
@@ -1,8 +1,6 @@
import { describe, expect, it } from 'vitest';
import {
- BACKEND_IDENTITY_ACCENT,
- backendVisual,
SOURCE_IDENTITY_ACCENT,
sourceAccent,
} from './vendorMeta';
@@ -16,10 +14,4 @@ describe('Model Hub semantic identity palette', () => {
expect(sourceAccent(source)).toBe(accent);
}
});
-
- it('keeps every backend authority row connected to the backend consumer', () => {
- for (const [backend, accent] of Object.entries(BACKEND_IDENTITY_ACCENT)) {
- expect(backendVisual(backend as keyof typeof BACKEND_IDENTITY_ACCENT).accent).toBe(accent);
- }
- });
});
diff --git a/ui/src/components/settings/models/vendorMeta.ts b/ui/src/components/settings/models/vendorMeta.ts
index 2b9653b25..96c0b3f36 100644
--- a/ui/src/components/settings/models/vendorMeta.ts
+++ b/ui/src/components/settings/models/vendorMeta.ts
@@ -1,10 +1,9 @@
-// Model Hub identity colors are semantic, not vendor branding: channel/kind
-// owns source color, while backend identity owns Agent color.
+// Model Hub source identity colors are semantic, not vendor branding:
+// channel/kind owns source color. Backend visuals live in lib/agentBackends.
import type React from 'react';
import { KeyRound, Sparkles } from 'lucide-react';
-import { getBackendUiMeta } from '@/lib/agentBackends';
-import type { AgentBackend, Source } from './types';
+import type { Source } from './types';
export type Accent = 'mint' | 'gold' | 'cyan' | 'violet' | 'muted';
@@ -67,21 +66,6 @@ export function sourceVisual(source: Pick<Source, 'kind' | 'supply_channel'>): S
};
}
-// ── Agent backends (Agent card rows) ────────────────────────────────────
-export type BackendVisual = { Icon: IconType; accent: Accent };
-
-export const BACKEND_IDENTITY_ACCENT = {
- claude: 'cyan',
- codex: 'mint',
- opencode: 'violet',
- vibey: 'muted',
-} as const satisfies Record<AgentBackend, Accent>;
-
-// The icon is the backend's own, from the one backend visuals table.
-export function backendVisual(backend: AgentBackend): BackendVisual {
- return { Icon: getBackendUiMeta(backend).Icon, accent: BACKEND_IDENTITY_ACCENT[backend] ?? 'muted' };
-}
-
// Official endpoints classify existing Sources and provide their display identity.
// Add API key accepts a Base URL directly and intentionally has no vendor picker.
const OFFICIAL_BASE_URLS: Record<string, string> = {
diff --git a/ui/src/components/visual/BackendIcon.test.tsx b/ui/src/components/visual/BackendIcon.test.tsx
index 1179f217f..6178f2f99 100644
--- a/ui/src/components/visual/BackendIcon.test.tsx
+++ b/ui/src/components/visual/BackendIcon.test.tsx
@@ -2,7 +2,6 @@
import { cleanup, render } from '@testing-library/react';
import { afterEach, describe, expect, it } from 'vitest';
import { getBackendUiMeta } from '@/lib/agentBackends';
-import { backendVisual } from '../settings/models/vendorMeta';
import { BACKEND_BRAND_MARKS } from './backendBrandMarks';
import { BackendAvatar, BackendIcon } from './BackendIcon';
@@ -20,8 +19,6 @@ describe('Vibey mark', () => {
expect(markPath(render(<Avatar size={16} />).container)).toBe(vibey);
expect(markPath(render(<BackendAvatar backend="vibey" />).container)).toBe(vibey);
expect(markPath(render(<BackendIcon backend="vibey" variant="brand" size={28} />).container)).toBe(vibey);
- // The Models route card reads the same table.
- expect(backendVisual('vibey').Icon).toBe(Icon);
});
it('follows the text color so it reads on dark and light themes', () => {
diff --git a/ui/src/components/workbench/GlobalPromptsDialog.test.tsx b/ui/src/components/workbench/GlobalPromptsDialog.test.tsx
index 575649f4b..abe40bc9e 100644
--- a/ui/src/components/workbench/GlobalPromptsDialog.test.tsx
+++ b/ui/src/components/workbench/GlobalPromptsDialog.test.tsx
@@ -31,11 +31,11 @@ describe('native global prompts', () => {
vi.spyOn(window, 'confirm').mockReturnValue(true);
render(<GlobalPromptsDialog open onClose={vi.fn()} />);
await screen.findByRole('tab', { name: 'Claude Code' });
- expect(screen.getAllByRole('tab').map((tab) => tab.textContent)).toEqual(['OpenCode', 'Claude Code', 'Codex']);
+ expect(screen.getAllByRole('tab').map((tab) => tab.textContent)).toEqual(['Claude Code', 'Codex', 'OpenCode']);
expect(screen.queryByRole('tab', { name: 'Vibey' })).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'globalPrompts.sync' }));
await waitFor(() => expect(mocks.saveGlobalPrompts).toHaveBeenCalledWith({
- content: 'Instructions', backends: ['opencode', 'claude', 'codex'],
+ content: 'Instructions', backends: ['claude', 'codex', 'opencode'],
}));
});
});
diff --git a/ui/src/components/workbench/NewAgentDialog.test.tsx b/ui/src/components/workbench/NewAgentDialog.test.tsx
index 4dbe03832..4e1d3fa1e 100644
--- a/ui/src/components/workbench/NewAgentDialog.test.tsx
+++ b/ui/src/components/workbench/NewAgentDialog.test.tsx
@@ -99,10 +99,10 @@ afterEach(() => {
describe('NewAgentDialog', () => {
// The picker used a second label table, so its Claude label disagreed with
// Settings and Model Hub. All backend choices share the catalog brands, and
- // they follow catalog order, the built-in Vibey first.
- it('uses the catalog brand names and order for every backend choice', () => {
+ // they follow the shared display order, the built-in Vibey first.
+ it('uses the catalog brand names and shared display order for every backend choice', () => {
renderDialog();
- const labels = ['Vibey', 'OpenCode', 'Claude Code', 'Codex'];
+ const labels = ['Vibey', 'Claude Code', 'Codex', 'OpenCode'];
for (const label of labels) {
expect(screen.getByRole('button', { name: new RegExp(label) }).textContent).toContain(label);
}
diff --git a/ui/src/lib/agentBackends.ts b/ui/src/lib/agentBackends.ts
index 366a2ac65..a1b10c23f 100644
--- a/ui/src/lib/agentBackends.ts
+++ b/ui/src/lib/agentBackends.ts
@@ -101,7 +101,13 @@ export const AGENT_BACKENDS = BACKEND_CATALOG.map((backend) => ({
settingsRoute: backend.settings_route,
descriptionKey: backend.description_key,
capabilities: backend.capabilities,
-}));
+})).sort((left, right) => Number(right.builtin) - Number(left.builtin) || left.nativeOrder - right.nativeOrder);
+
+/** Display only: built-in first, then the native setup order, with unknowns last. */
+export function backendDisplayOrder(id: BackendId): number {
+ const index = AGENT_BACKENDS.findIndex((backend) => backend.id === id);
+ return index < 0 ? AGENT_BACKENDS.length : index;
+}
export const NATIVE_CLI_BACKENDS = BACKEND_CATALOG
.filter((backend): backend is Extract<BackendDescriptor, { capabilities: { supports_cli: true } }> =>