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
feat(setup): add Vibey to the setup wizard as the built-in coordinator (#2385)
Call White1ad290505d6f
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex c2335755a..fd2321000 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -84,7 +84,7 @@ jobs:npx playwright install --with-deps chromium webkitnpm run test:model-catalognpm run test:model-provider- npm run test:onboarding-fidelity -- hub-ownership.spec.ts provider-gate.spec.ts+ npm run test:onboarding-fidelity -- hub-ownership.spec.ts provider-gate.spec.ts lineup.spec.tsnpm run test:project-ordernpm run test:inbox-returnnpm run test:badge-triggersdiff --git a/docs/plans/avibe-agent-always-on.md b/docs/plans/avibe-agent-always-on.mdindex dc5c10420..988a173ec 100644--- a/docs/plans/avibe-agent-always-on.md+++ b/docs/plans/avibe-agent-always-on.md@@ -54,11 +54,13 @@ backend list, it is always enabled, and it cannot be turned off.## Known by design-- The setup wizard lists only native CLIs here. Its Vibey card (built-in, model picker, providers destination)- is a follow-up owner decision, delivered separately as `feat/avibe-agent-setup-wizard`.-- The setup wizard keeps its own native setup sequence (Claude Code, Codex, OpenCode: `nativeOrder`). It is an- ordered onboarding flow, not a backend list: its intro geometry is indexed and its first ready backend decides the- default Agent after setup, which this lane leaves unchanged.+- The setup wizard draws Vibey first, as the coordinator, ahead of the native setup sequence (Claude Code, Codex,+ OpenCode: `nativeOrder`), and Vibey alone can complete setup. That is the owner's follow-up decision, delivered by+ `feat/vibey-setup-wizard`; see `setup-three-screen/contracts.md` §C4 (D3). The default Agent after setup still+ follows `implicit_default_rank`, so Vibey becomes it only when no native assistant can run.+- Setup onboarding is therefore not CLI-only (owner override, 2026-10-07, of the registration contract's "native setup+ onboarding remains CLI-only"): the built-in backend is a setup card with no CLI to detect, install or enable. Native+ import and the global native prompt files remain CLI-only.- The Agents page detail panel mirrors `is_builtin_default_agent` from the Agent's `source` and markers;`setupTargets.isBuiltinAgent` reads the markers, which callers can no longer write.- Making Vibey the default for new chats is a separate owner decision.diff --git a/docs/plans/setup-three-screen/contracts.md b/docs/plans/setup-three-screen/contracts.mdindex c1c6d2d0f..c4ff08a98 100644--- a/docs/plans/setup-three-screen/contracts.md+++ b/docs/plans/setup-three-screen/contracts.md@@ -234,6 +234,20 @@ literal colors anywhere: values come from the `index.css` token scale or from `-`var(--ob-active-shadow)`, already backed by `--shadow-glow-onboarding-mint`; its theme-specificvalues stay in the shared tokens. Hover has no translate or scale.+**Lineup.** The story cards, the provider destinations and the assistant cards are one+row of the setup lineup (`SETUP_LINEUP`): the built-in backend first, then the CLI+assistants in C6 order. Each takes one equal track `--ob-track-gap` (24 of 1040) apart in a+`clamp(1040px, 62.5vw, 1200px)` column, so the count comes from the markup and the story's+wires are drawn in the same 1040 space. Below 1024 the story and the assistants fold into+two columns without wires; below 760 they stack. The intro card states its role under the+name, inside the same `--ob-card-h` box as the assistant card, so both steps keep one card+box. The built-in card on screen 3 may grow to offer models while the others keep+`--ob-card-h`, top-aligned. Every band's stage floor reserves that card at its worst+reading (`--ob-offer-h`), so opening the offer cannot move the action; while it is open,+the shell's aside hangs under the action pair instead of resting on the band the card+reaches into. The action and the gateway card are+299 of 1040, centred.+**Motion bail-out.** Under `prefers-reduced-motion`, a hidden page, or an explicit pause thehandoff is skipped and the screen changes instantly; on phones the view scrolls to topbefore the change. The primary action stays disabled and unmoved for the whole transition.@@ -256,7 +270,7 @@ and Agent name** to backend connection/CLI reads and `AgentSupply.named_agents`.| Condition for the same candidate | Authoritative read / rule || --- | --- |-| installed and backend enabled | `api.detectCli(cli_path)`, freshly corroborated `AgentSupply.cli_present` through `createAgentCollectionReadAuthority.refresh()` and `getBackendConnection(backend).enabled`; stale/failed refresh or read cannot prove readiness |+| installed and backend enabled | `api.detectCli(cli_path)`, freshly corroborated `AgentSupply.cli_present` through `createAgentCollectionReadAuthority.refresh()` and `getBackendConnection(backend).enabled`; stale/failed refresh or read cannot prove readiness. A built-in backend has no CLI: for it this row is `getBackendConnection(backend).enabled` and a current supply row alone (D3) || Hub runtime running | `getRuntimeStatus()` with health `ok` or `degraded`; mode alone is not runtime readiness || model and route runnable | backend mode `hub`; that candidate's `named_agents` row has nonempty `effective_model_id`, `supply_status` in `ok` / `degraded`, and no `route_unconfigured` reason. `waiting`, `interrupted`, null or absent rows do not pass || application and custody | `getBackendConnection.ready === true` (including permission and matching credential ownership) and `application === 'applied'` are required alongside this candidate's route. Confirmed `stopped` permits bootstrap/recovery, never workspace readiness; draining/failed/unknown cannot enable entry |@@ -289,17 +303,22 @@ ensure/start. Startuphas no assistant/source readiness prerequisite. Do not restart after an enable/config write.Preserve `default_agent_name` if it remains in the available set, including a usable custom-Agent outside the cards' designated builtin Agents. Otherwise prefer a runnable designated-builtin Agent in card order, then an available named Agent in stable backend/name order; call-`setDefaultVibeAgent` and verify a fresh Agent read. Write `setup_completed` last through+Agent outside the cards' designated builtin Agents. Otherwise take the first rank that can run —+the CLI assistants before a built-in backend, the server's `implicit_default_rank` — and+within it prefer a runnable designated builtin Agent in card order, then an available named+Agent in stable backend/name order. The built-in assistant therefore becomes the default+only when no CLI assistant's Agent, its own or a custom one, can run (D3). Call `setDefaultVibeAgent` and verify a fresh Agent read. Write `setup_completed` last through`api.mutateConfig` with an explicit field mutation, then validate a fresh uncached`apiFetch('/api/config', {cache:'no-store'})` readback before navigating. Use that sameread/parse path after an unknown/failed write; cached pre-write data cannot settle it.Unknown writes are reconciled by reads, not treated as success or blindly retried. Existinginvalid IM configuration remains saved for later repair in Settings and does not gate ModelHub setup completion. `SetupModelRecovery` is the shipped **Direct OpenCode**-recovery; it does not repair Hub models. A missing Hub Agent model is repaired in existing-Agent/Model Hub settings, not chosen or written by Setup.+recovery; it does not repair Hub models. A missing Hub Agent model on a CLI assistant is+repaired in existing Agent/Model Hub settings, not chosen or written by Setup. The built-in+backend's own Agent is the exception (owner override, 2026-10-07): Setup offers the models it+can run on and writes the pick, because that assistant has no other setup path and Setup may+finish on it alone. See **Owner override — the built-in assistant (D3)** below.The new Hub route predicate replaces credential readiness / `entry_eligible` as the *route*criterion, not the confirmed application-state or backend permission guard. Today's `Wizard.complete()` only@@ -307,6 +326,25 @@ filters OpenCode routes; the all-backend named-Agent join is new L3 orchestratiohelper that already exists. Cards with a confirmed Hub model can edit its route even whenthe chain is empty; cards without a model show a hint instead of creating a route target.+**Owner override — the built-in assistant (D3), 2026-10-07.** The built-in backend (Vibey)+is one of the setup cards and can complete setup alone. It is usable with an applied+connection and a runnable route; no CLI is detected, installed or enabled for it, and it has+no switch because it is always on. Its gate row is the table above with the CLI conditions+removed. When its designated builtin Agent has no model, its card reads+`GET /api/models/agents/{backend}/models/candidates` and offers the supplied candidates+inline, with the existing `BackendModelPickerDialog` in its single-choice mode for the rest. A pick that is not in the+backend's catalog yet is added through `PUT /api/models/agents/{backend}/models` with the+`expected_suppliers` the card displayed (a `candidate_suppliers_changed` refusal re-reads+and asks again), and then becomes the Agent's `model` through `PATCH /api/agents/{name}`.+The server's own reconciliation fills an Agent that has no model with the list's first row,+so a failure between the two writes can leave the Agent on a model nobody chose. The choice+is therefore settled by an uncached read of the Agent, not by the writes' answers: until+that read shows the chosen model with an effort it takes, and the reads the choice sets off+have settled, the card keeps the offer open with Retry and the screen+holds the whole entry on it, even when a CLI assistant is ready. One hook (`useBuiltinModelChoice`) owns the offer's read, its freshness+per screen showing, the conflict re-read and this write. Nothing else about another+backend's route or Agent changes.+**Known by design — setup requires Model Hub.** Owner decision, 2026-09-21 12:56 +08:“setup的契约是默认使用模型网关”; users who later need to disable it do so in Settings.Unsupported installation without a usable running Hub cannot complete setup, even with@@ -603,10 +641,11 @@ the default journey. Read failures authorize neither lifecycle writes nor comple| install | explicit `api.installAgent(name)` then detect the returned/configured path and await the collection authority refresh/current result. Path/agent-config changes have the same refresh requirement. Pending/stale/failed refresh holds completion and exposes Retry; retain install output and one loading indicator || enabled | existing Switch config write, followed by `getBackendConnection` and Agent reads. Saved config reconciles live backends; no second restart || upgrade | `BackendLifecycleChip.onVisual` still owns probe/write, activity-gated; update coexists with enabled state |-| route control | Confirmed Hub cards with a designated builtin Agent model show that model's first chain hop and backup count. Enabled cards open `RouteChainDialog` for only `(backend, menu model)`; disabled cards preview the same route but cannot edit it. A current successful route read is required to open the editor; pending or failed reads do not infer an empty model or authorize editing. Route-read failure has its own Retry. A Hub card with no model shows a hint to repair it later in Agent/Model Hub settings; Setup does not choose or write an Agent model. Direct cards retain native connection actions, but Direct cannot satisfy setup completion. Unknown or conflicting Hub/Direct ownership disables configuration until a fresh read. A disabled Hub configuration retains C2 recovery, never a Direct setup-completion bypass |+| route control | Confirmed Hub cards with a designated builtin Agent model show that model's first chain hop and backup count. Enabled cards open `RouteChainDialog` for only `(backend, menu model)`; disabled cards preview the same route but cannot edit it. A current successful route read is required to open the editor; pending or failed reads do not infer an empty model or authorize editing. Route-read failure has its own Retry. A CLI assistant's Hub card with no model shows a hint to repair it later in Agent/Model Hub settings; Setup does not choose or write that Agent's model. The built-in card is the D3 exception (C4). Direct cards retain native connection actions, but Direct cannot satisfy setup completion. Unknown or conflicting Hub/Direct ownership disables configuration until a fresh read. A disabled Hub configuration retains C2 recovery, never a Direct setup-completion bypass || candidate identity | for each backend, read its current designated builtin Agent, including disabled Agents, and use its saved menu model; custom Agents or the global default do not substitute as that card's route target. C4 may preserve a runnable custom default independently || route close | close/commit refreshes the card's server-backed route and connection; `RouteChainDialog` owns the edit draft and save lifecycle, not `SetupFlowState` |-| all uninstalled | three install actions, workspace entry disabled, Back still available |+| built-in card | first in the lineup, no switch and no lifecycle: an always-on badge, its route as above once its Agent has a model, otherwise the inline model offer of C4's D3 override. A Hub supply block (`agent_supply_blocks`: gateway off, Hub disabled) is stated on the card and holds its model row still; the shell keeps its own gateway alert and Retry |+| all uninstalled | one install action per CLI assistant, Back still available; workspace entry stays disabled unless the built-in card is ready |### Per-assistant Model Hub route mapping@@ -614,7 +653,7 @@ Each card reads its designated builtin Agent's saved menu model, including whenis disabled, and the matching chain from `GET /api/models/agents/{backend}/chains`. Readthe backend supply and sources once per refresh, not once per card. The card displays thatchain's actual first upstream model (display name when available, otherwise ID) and the-remaining hop count. The three cards may legitimately show different routes. A route on+remaining hop count. The cards may legitimately show different routes. A route onanother menu model, another backend, or an unrelated custom Agent is not substituted.Only a current, successful read for the active screen may supply an editor selection. A@@ -624,8 +663,9 @@ route inventory. A confirmed Hub card with a saved menu model opens the existing`RouteChainDialog` for exactly that `(backend, menu model)`, including when its chain isempty. The dialog owns its own draft, preview, save guards, unknown-write reconciliationand readback; Setup refreshes the card after commit or close. It does not write other-backends' chains. If the Agent has no model, Setup shows a hint and leaves model selection-and catalog repair to existing Agent/Model Hub settings.+backends' chains. If a CLI assistant's Agent has no model, Setup shows a hint and leaves model+selection and catalog repair to existing Agent/Model Hub settings; the built-in Agent is the+D3 exception in C4.Installing or enabling an assistant never adopts another assistant's route or changes itsAgent model. An install offers automatic enablement only when the click-time action promiseddiff --git a/tests/scenarios/auth_setup/catalog.yaml b/tests/scenarios/auth_setup/catalog.yamlindex 4b8c00367..c4410f009 100644--- a/tests/scenarios/auth_setup/catalog.yaml+++ b/tests/scenarios/auth_setup/catalog.yaml@@ -472,4 +472,21 @@ scenarios:- ui/src/components/onboarding/WizardCompletion.test.tsx- ui/src/components/onboarding/AssistantSetup.test.tsx- ui/e2e/onboarding-fidelity/provider-gate.spec.ts+ - id: AUTH-SETUP-127+ name: Built-in Vibey takes its first model in setup and completes setup without a CLI+ status: covered+ kind: happy_path+ layer: scenario+ backend: vibey+ test: tests/scenarios/auth_setup/test_auth_setup_scenarios.py::test_builtin_vibey_model_pick_completes_setup_without_a_cli+ # The scenario owns the server boundary the setup card calls: the candidates read, the+ # catalog write that refuses a moved supplier projection and commits nothing, the+ # built-in Agent's model, the runnable named route, the default and completion. The+ # browser side — which candidates the card offers, the order of the two writes, and+ # the entry gate ranking the built-in backend after any runnable CLI assistant — is+ # the supporting tests below, against controlled responses.+ supporting_tests:+ - ui/src/components/onboarding/BuiltinAssistant.test.tsx+ - ui/src/components/onboarding/entryGate.test.ts+ - ui/e2e/onboarding-fidelity/lineup.spec.tsnext_priority: []diff --git a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py b/tests/scenarios/auth_setup/test_auth_setup_scenarios.pyindex 889f6a8ec..0adbe5b40 100644--- a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py+++ b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py@@ -4376,6 +4376,107 @@ def test_explicit_opencode_model_recovery_preserves_agent_and_completes(monkeypastore.close()+def test_builtin_vibey_model_pick_completes_setup_without_a_cli(monkeypatch, tmp_path):+ """AUTH-SETUP-127: Vibey candidates -> catalog write -> Agent model -> runnable route -> completion.++ The setup card for the built-in backend reads its candidates, adds a pick its catalog+ lacks with the suppliers it displayed, names it as the built-in Agent's model and then+ lets setup finish on that Agent alone. Every step here is the HTTP route the card+ calls; the Hub service is wired to the real Agent store the way the controller wires it.+ """+ from core.vibe_agents import VibeAgentStore+ from tests.test_model_hub_api import _service++ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "1")+ V2Config.default().save()+ service, store, _adapter = _service(tmp_path / "hub")+ agents = VibeAgentStore()+ service.named_agents_override = lambda backend: [+ (agent.name, agent.model)+ for agent in agents.list_agents(include_disabled=False)+ if agent.backend == backend+ ]+ monkeypatch.setattr(ui_server, "_model_hub_service", lambda: service)+ source = ModelHubSourceConfig(+ id="src_vibey001",+ kind="api_key",+ vendor="custom",+ display_name="Mock Lab",+ protocol="openai_chat",+ supply_channel="hub",+ billing="metered",+ state=ModelHubSourceStateConfig(status="standby"),+ models=[ModelHubModelConfig(id=model, provenance="discovered") for model in ("mock-large", "mock-mini")],+ credential_ref="cred_vibey001",+ )+ store.config.sources = [source]+ store.config.agents["vibey"].sources.order = [source.id]+ client = app.test_client()+ headers = csrf_headers(client)+ try:+ listed = client.get("/api/agents").get_json()+ vibey = next(row for row in listed["agents"] if row["backend"] == "vibey")+ assert vibey["model"] is None++ candidates = client.get("/api/models/agents/vibey/models/candidates").get_json()["candidates"]+ pick = next(row for row in candidates["providers"] if row["id"] == "mock-mini")+ suppliers = [{"source_id": row["source_id"], "model_id": row["model_id"]} for row in pick["suppliers"]]+ assert suppliers == [{"source_id": source.id, "model_id": "mock-mini"}]++ def vibey_supply():+ rows = client.get("/api/models/agents").get_json()["agents"]+ return next(row for row in rows if row["backend"] == "vibey")++ baseline = vibey_supply()["catalog_models"]+ assert baseline == []+ # The row the card builds for a candidate: what the candidate states, nothing more.+ added = {+ "id": pick["id"], "display_name": pick["display_name"], "origin": pick["origin"],+ "models_dev_id": None, "context_window": None, "max_output_tokens": None,+ "input_modalities": [], "output_modalities": [], "supports_tools": None,+ "supports_reasoning": None, "reasoning_efforts": list(pick["reasoning_efforts"]),+ "locked": False, "routeable": True,+ }+ before = store.config.to_payload()+ stale = client.put(+ "/api/models/agents/vibey/models",+ json={"baseline": baseline, "models": [*baseline, added], "expected_suppliers": {"mock-mini": []}},+ headers=headers,+ )+ # A pick whose suppliers moved after the card showed them commits nothing.+ assert stale.status_code == 409, stale.get_json()+ assert stale.get_json()["error"] == "candidate_suppliers_changed"+ assert store.config.to_payload() == before++ written = client.put(+ "/api/models/agents/vibey/models",+ json={"baseline": baseline, "models": [*baseline, added], "expected_suppliers": {"mock-mini": suppliers}},+ headers=headers,+ )+ assert written.status_code == 200, written.get_json()+ assert [row["id"] for row in vibey_supply()["catalog_models"]] == ["mock-mini"]++ named = client.patch(f"/api/agents/{vibey['name']}", json={"model": "mock-mini"}, headers=headers)+ assert named.status_code == 200, named.get_json()+ assert agents.require(vibey["name"]).model == "mock-mini"+ supply = vibey_supply()+ assert supply["cli_present"] is False+ route = next(row for row in supply["named_agents"] if row["name"] == vibey["name"])+ assert route["effective_model_id"] == "mock-mini"+ assert route["supply_status"] in {"ok", "degraded"}+ assert route["route_reason"] != "route_unconfigured"++ # With no CLI assistant able to run, setup enters on the built-in Agent.+ chosen = client.post("/api/agents/default", json={"name": vibey["name"]}, headers=headers)+ assert chosen.status_code == 200, chosen.get_json()+ completed = client.post("/api/config", json={"setup_completed": True}, headers=headers)+ assert completed.status_code == 200, completed.get_json()+ assert V2Config.load().setup_completed+ assert agents.get_default_agent().name == vibey["name"]+ finally:+ agents.close()++@pytest.mark.parametrize("setup_host", ["192.0.2.5", "fd00::1", "2001:db8::5", "[2001:db8::5]"])async def test_cloud_pairing_origin_reaches_effective_ui_listener(monkeypatch, setup_host):"""Scenario: AUTH-SETUP-907 — every origin consumer reaches the widened UI bind."""diff --git a/ui/e2e/onboarding-fidelity/geometry.spec.ts b/ui/e2e/onboarding-fidelity/geometry.spec.tsindex 3ee23a938..ccfaff2f1 100644--- a/ui/e2e/onboarding-fidelity/geometry.spec.ts+++ b/ui/e2e/onboarding-fidelity/geometry.spec.ts@@ -16,11 +16,11 @@ import {* frame against (DESIGN_FRAME below).** What is asserted is the RULE, not a row of copied numbers. The composition is one- * content column whose width is `clamp(976px, 62.5vw, 1200px)` inside the shell's gutter,+ * content column whose width is `clamp(1040px, 62.5vw, 1200px)` inside the shell's gutter,* and one card height taken from the window; everything else is a ratio of those two. So* the helpers below re-derive the column and the card from what the browser reports, and* the tests check that every dependent box is the share of them the design draws. A test- * that hard-coded 976 and 299 would pass on a layout that had stopped deriving them.+ * that hard-coded 1040 and 242 would pass on a layout that had stopped deriving them.*/const DESIGN_FRAME = { width: 1200, height: 756 };/**@@ -33,9 +33,12 @@ const DESIGN_FRAME = { width: 1200, height: 756 };const CAPTURE_PHASE = 'codex-working';const CAPTURE_STATES = ['complete', 'working', 'waiting'];-/** The card's share of the content column: three 299s and two 39.5 gaps in 976, which is- * the same fraction as three 367s in 1200. One percentage, both authored rows. */-const CARD_SHARE = 0.306352;+/** The setup lineup: the built-in coordinator first, then the three CLI assistants. */+const LINEUP = ['Vibey', 'Claude Code', 'Codex', 'OpenCode'];+/** The gap's and the card's shares of the content column: four 242s and three 24 gaps in+ * 1040. One percentage, every authored row. */+const GAP_SHARE = 24 / 1040;+const CARD_SHARE = (1 - GAP_SHARE * (LINEUP.length - 1)) / LINEUP.length;/** The wire box is the card times the reference's own 350/300, so the handoffs stay on* the cards' midline at every tier. */const WIRE_RATIO = 350 / 300;@@ -111,12 +114,14 @@ async function frame(page: Page) {available: step ? step.getBoundingClientRect().width : content.getBoundingClientRect().width,};});- const clamp = Math.min(Math.max(976, 0.625 * window.vw), 1200);+ const clamp = Math.min(Math.max(1040, 0.625 * window.vw), 1200);// The card height is the tier the design authored for this window: 232 under an// 800px-tall one, 262 under 900, 300 above 1000, 330 at the large 1920x1080 reading.- // Stacked, the three cards ARE the composition, so the phone band gives them the- // height the reference draws rather than a share of a window that should scroll.+ // Stacked, the cards ARE the composition, so the phone band gives them the height the+ // reference draws rather than a share of a window that should scroll. Between the+ // phone and 1024 the lineup folds into two columns of two.const stacked = window.vw < 760;+ const folded = !stacked && window.vw < 1024;const card = stacked ? 258: window.vw >= 1600 && window.vh >= 950 ? 330: window.vh <= 800 ? 232@@ -126,37 +131,38 @@ async function frame(page: Page) {column: Math.min(clamp, window.available),card,stacked,+ folded,};}test.describe('desktop reference geometry', () => {test.use({ viewport: { width: 1200, height: 800 } });- test('the welcome draws the content column, its three card tracks and their handoff gaps', async ({ page }, info) => {+ test('the welcome draws the content column, its card tracks and their handoff gaps', async ({ page }, info) => {const denied = await serveProduct(page);await openOnboarding(page);await freezeAt(page, PHASES['codex-working']);const reference = await frame(page);- // The reference's own numbers, reached by the rule at its own frame size: a 976- // column of three 299 cards with 39.5 between them. Stated once, here, so a reader- // can see that the ratios below are the design and not an arbitrary proportion.- expect(round(reference.column)).toBe(976);+ // The reference's own numbers, reached by the rule at its own frame size: a 1040+ // column of four 242 cards with 24 between them. Stated once, here, so a reader can+ // see that the ratios below are the design and not an arbitrary proportion.+ expect(round(reference.column)).toBe(1040);expect(round(reference.card)).toBe(232);const welcome = await box(page, '.onboarding-welcome');expect(welcome.width).toBeCloseTo(reference.column, 1);const cards = await boxes(page, '.onboarding-collaboration-card');- expect(cards).toHaveLength(3);+ expect(cards).toHaveLength(LINEUP.length);for (const card of cards) {expect(card.width).toBeCloseTo(reference.column * CARD_SHARE, 1);expect(card.height).toBeCloseTo(reference.card, 1);}- const gaps = [1, 2].map((index) => cards[index].x - (cards[index - 1].x + cards[index - 1].width));- for (const gap of gaps) expect(gap).toBeCloseTo((reference.column - 3 * cards[0].width) / 2, 1);- // 39.5, to the tenth: the track is a percentage, so the browser's own rounding of it+ const gaps = cards.slice(1).map((card, index) => card.x - (cards[index].x + cards[index].width));+ for (const gap of gaps) expect(gap).toBeCloseTo(reference.column * GAP_SHARE, 1);+ // 24, to the tenth: the gap is a percentage, so the browser's own rounding of it// lands a hundredth away and a stricter claim would only be testing that.- expect(gaps[0]).toBeCloseTo(39.5, 1);+ expect(gaps[0]).toBeCloseTo(24, 1);// The diagram is the card plus the return band the stage floors, and the wire box// inside it takes its own height from the card — which is what keeps the handoff@@ -172,12 +178,12 @@ test.describe('desktop reference geometry', () => {// the pixel — a card sized by a percentage has edges on halves, so a tighter claim// would be about which way the browser rounded rather than about where the wire is.const ports = await boxes(page, '.onboarding-port');- expect(ports).toHaveLength(4);+ expect(ports).toHaveLength((LINEUP.length - 1) * 2);const onPixel = (value: number, target: number) => expect(Math.abs(value - target)).toBeLessThanOrEqual(1);- onPixel(ports[0].x + ports[0].width / 2, cards[0].x + cards[0].width);- onPixel(ports[1].x + ports[1].width / 2, cards[1].x);- onPixel(ports[2].x + ports[2].width / 2, cards[1].x + cards[1].width);- onPixel(ports[3].x + ports[3].width / 2, cards[2].x);+ for (let wire = 0; wire < LINEUP.length - 1; wire += 1) {+ onPixel(ports[wire * 2].x + ports[wire * 2].width / 2, cards[wire].x + cards[wire].width);+ onPixel(ports[wire * 2 + 1].x + ports[wire * 2 + 1].width / 2, cards[wire + 1].x);+ }// The story's caption is authored per tier like the rest of the card's type —// 12 on the standard desktops, 15 at the large reading — so a fixed 10 that// reads small against the frame is caught here.@@ -196,7 +202,7 @@ test.describe('desktop reference geometry', () => {expect(logo.height).toBeCloseTo(logoSize, 0);}- // In the band that still draws three columns on a narrow window, the identity+ // In a band that draws the cards side by side on a narrow window, the identity// row has less room than its logo, switch and label want; the name yields// before anything spills through the card edge.if (reference.column <= 768 + 1) {@@ -254,15 +260,15 @@ test.describe('desktop reference geometry', () => {});/**- * "Align Get started and Enter Workbench at identical coordinates and dimensions,- * centered under the Codex column on desktop and as wide as its card."+ * "Align Get started and Enter Workbench at identical coordinates and dimensions",+ * centred on the composition at the reference's 299 of 1040.*- * Three claims, each measured: the action is the middle card's column, the cards are the- * same boxes in both steps, and the action does not move between them. The last one is+ * Three claims, each measured: the action is centred at that share of the column, the+ * cards are the same boxes in both steps, and the action does not move between them. The last one is* what a person actually feels — a button that shifts under a pointer when the screen* changes — so it is asserted as exact box equality, not as a tolerance.*/- test('both steps put the same action under the same middle card', async ({ page }, info) => {+ test('both steps put the same action on the same centre line', async ({ page }, info) => {const denied = await serveProduct(page);await openOnboarding(page);await freezeAt(page, PHASES['codex-working']);@@ -271,12 +277,13 @@ test.describe('desktop reference geometry', () => {const introIdentities = await boxes(page, '.onboarding-card-identity');const introAction = await box(page, '.onboarding-primary-action');const introHeader = await box(page, '.onboarding-shell > header');- // Centred on the middle card, and exactly its width.- expect(introAction.x).toBeCloseTo(introCards[1].x, 1);- expect(introAction.width).toBeCloseTo(introCards[1].width, 1);+ // Centred on the column the cards span, at 299 of its 1040.+ const span = introCards.at(-1)!.x + introCards.at(-1)!.width - introCards[0].x;+ expect(introAction.x + introAction.width / 2).toBeCloseTo(introCards[0].x + span / 2, 1);+ expect(introAction.width).toBeCloseTo(span * 299 / 1040, 1);expect(round(introAction.height)).toBe(52);- // The introduction's trailing slot is the assistant's role.- await expect(page.locator('.onboarding-card-role')).toHaveCount(3);+ // The introduction states each assistant's role under its name.+ await expect(page.locator('.onboarding-card-role')).toHaveCount(LINEUP.length);await openSetup(page, 'en');const setupCards = await boxes(page, '.onboarding-assistant');@@ -289,8 +296,8 @@ test.describe('desktop reference geometry', () => {for (const key of ['x', 'y', 'width', 'height'] as const) {expect(round(setupAction[key])).toBeCloseTo(round(introAction[key]), 1);}- // Same three columns, so the cards read as taking on work rather than being replaced.- for (let index = 0; index < 3; index += 1) {+ // Same columns, so the cards read as taking on work rather than being replaced.+ for (let index = 0; index < LINEUP.length; index += 1) {expect(setupCards[index].x).toBeCloseTo(introCards[index].x, 1);expect(setupCards[index].width).toBeCloseTo(introCards[index].width, 1);expect(setupCards[index].y).toBeCloseTo(introCards[index].y, 1);@@ -303,8 +310,9 @@ test.describe('desktop reference geometry', () => {.toBeCloseTo(introIdentities[index].y - introCards[index].y, 1);expect(setupIdentities[index].x).toBeCloseTo(introIdentities[index].x, 1);}- // …and the trailing slot is now the enable switch, in the header rather than below it.- await expect(page.locator('.onboarding-card-identity .onboarding-assistant-enable')).toHaveCount(3);+ // …and the trailing slot is now the enable switch, in the header rather than below it —+ // on every card but the built-in one, which is always on.+ await expect(page.locator('.onboarding-card-identity .onboarding-assistant-enable')).toHaveCount(LINEUP.length - 1);expect(spread(setupIdentities.map((one) => one.y))).toBeLessThanOrEqual(1);// The way back is the same object one row down, per the reference.@@ -418,7 +426,7 @@ test.describe('desktop reference geometry', () => {for (const [name, elapsed] of Object.entries(PHASES)) {await freezeAt(page, elapsed - clock);clock = elapsed;- const travelling = name.startsWith('handoff') || name === 'return-to-pm';+ const travelling = name.startsWith('handoff') || name === 'return-to-coordinator';await expect(page.getByTestId('handoff-pulse')).toHaveCount(travelling ? 1 : 0);await settleEffects(page);await page.locator('.onboarding-story').screenshot({ path: info.outputPath(`phase-${name}.png`) });@@ -447,6 +455,12 @@ test.describe('capped fluid width', () => {// Stacked: one column, and each card the height the reference draws.expect(spread(cards.map((card) => card.x))).toBeLessThanOrEqual(1);for (const card of cards) expect(card.height).toBeGreaterThanOrEqual(reference.card - 1);+ } else if (reference.folded) {+ // Folded: two columns of two, each card the tier's height, and no wires to draw+ // across the fold.+ expect(new Set(cards.map((card) => Math.round(card.x))).size).toBe(2);+ for (const card of cards) expect(card.height).toBeCloseTo(reference.card, 1);+ await expect(page.locator('.onboarding-wires')).toBeHidden();} else {const collaboration = await box(page, '.onboarding-collaboration');for (const card of cards) {@@ -994,8 +1008,8 @@ test.describe('completion recovery in the slot', () => {* Narrow widths are where a card stops being a scaled copy of the design and becomes an* adaptation, so the thing to check is that the adaptation is ONE arrangement rather than* whichever one each label's length happens to produce. Every assertion here reads real- * bounding boxes: three identity headers that start and end together, three status rows- * that do, and no label clipped or truncated to make that true.+ * bounding boxes: identity headers that start and end together, status rows that do, and+ * no label clipped or truncated to make that true.*/test.describe('narrow identity alignment', () => {for (const viewport of [@@ -1006,7 +1020,7 @@ test.describe('narrow identity alignment', () => {{ width: 768, height: 1024 },]) {for (const lang of ['en', 'zh'] as const) {- test(`${size(viewport)} ${lang} keeps the three cards on one grid`, async ({ page }, info) => {+ test(`${size(viewport)} ${lang} keeps the lineup on one grid`, async ({ page }, info) => {await page.setViewportSize(viewport);const denied = await serveProduct(page);await openOnboarding(page, { lang });@@ -1021,17 +1035,21 @@ test.describe('narrow identity alignment', () => {const statuses = await boxes(page, '.onboarding-story-status');const skeletons = await boxes(page, '.onboarding-skeleton');const cards = await boxes(page, '.onboarding-collaboration-card');- expect([identities.length, statuses.length, skeletons.length]).toEqual([3, 3, 3]);+ expect([identities.length, statuses.length, skeletons.length]).toEqual([LINEUP.length, LINEUP.length, LINEUP.length]);// The header and status boundaries belong to the arrangement, not to whichever- // caption happens to be short enough at this point in the animation. Below 760- // the three cards stack, so the boundary they share is the offset INSIDE the+ // caption happens to be short enough at this point in the animation. Folded or+ // stacked, the cards are not one row, so the boundary they share is the offset INSIDE the// card: the same claim, and on one row the same measurement.for (const row of [identities, statuses, skeletons]) {expect(spread(row.map((one, index) => one.y - cards[index].y))).toBeLessThanOrEqual(1);expect(spread(row.map((one) => one.height))).toBeLessThanOrEqual(1);}- // Side by side, that offset is also one screen row; stacked, it cannot be.- expect(spread(cards.map((card) => card.y)) <= 1).toBe(viewport.width >= 760);+ // Side by side, that offset is also one screen row: the whole lineup on a+ // desktop, each pair of the fold, and each card alone when stacked.+ const perRow = viewport.width >= 1024 ? cards.length : viewport.width >= 760 ? 2 : 1;+ for (let start = 0; start < cards.length; start += perRow) {+ expect(spread(cards.slice(start, start + perRow).map((card) => card.y))).toBeLessThanOrEqual(1);+ }for (let index = 0; index < cards.length; index++) {for (const row of [identities, statuses, skeletons]) {expect(row[index].x).toBeGreaterThanOrEqual(cards[index].x);@@ -1066,7 +1084,7 @@ test.describe('narrow identity alignment', () => {}// …and the labels are still the product's own words at a readable size.const names = await page.locator('.onboarding-card-name').filter({ visible: true }).allInnerTexts();- expect(names.map((name) => name.replace(/\s+/g, ' ').trim())).toEqual(['Claude Code', 'Codex', 'OpenCode']);+ expect(names.map((name) => name.replace(/\s+/g, ' ').trim())).toEqual(LINEUP);const smallest = await page.locator('.onboarding-card-role').evaluateAll((nodes) => Math.min(...nodes.map((node) => parseFloat(getComputedStyle(node).fontSize))));expect(smallest).toBeGreaterThanOrEqual(10);@@ -1141,7 +1159,7 @@ test.describe('motion lifecycle', () => {expect(resumed.some((effect) => effect.state === 'running')).toBe(true);// And it is genuinely running again, rather than merely unpaused.- await freezeAt(page, PHASES['pm-summary'] - PHASES['codex-working']);+ await freezeAt(page, PHASES['coordinator-summary'] - PHASES['codex-working']);expect(await renderedPhase(page)).not.toEqual(before);});diff --git a/ui/e2e/onboarding-fidelity/lineup.spec.ts b/ui/e2e/onboarding-fidelity/lineup.spec.tsnew file mode 100644index 000000000..e2bfd0c8a--- /dev/null+++ b/ui/e2e/onboarding-fidelity/lineup.spec.ts@@ -0,0 +1,120 @@+// The setup lineup in a real browser: the built-in assistant stands first in every+// screen's row, the row keeps the reference's tracks, and the built-in card offering its+// models never has the shell's aside drawn over it while the action stays where every+// screen puts it. Hermetic: every read is answered here and every write is refused.+import { expect, test, type Page } from '@playwright/test';+import { PHASES, freezeAt, openOnboarding, openSetup, serveProduct } from './support';+import { CONTRACT_VERSION } from '../../src/components/settings/models/types';++const LINEUP = ['vibey', 'claude', 'codex', 'opencode'];+const NATIVE_MODELS: Record<string, string> = { claude: 'claude-opus-5-5', codex: 'gpt-5.6-sol', opencode: 'openai/gpt-5.6-sol' };++/** Every backend on the Hub with a runnable route, except the built-in one: it has no model yet. */+async function serveLineup(page: Page, { permitted = true } = {}) {+ const models = NATIVE_MODELS;+ const supply = (backend: string) => ({+ backend, cli_present: backend !== 'vibey', mode: 'hub', menu_kind: 'fixed',+ named_agents: [{ name: backend, effective_model_id: models[backend] ?? null, supply_status: models[backend] ? 'ok' : null }],+ catalog_models: models[backend] ? [{ id: models[backend] }] : [],+ });+ const agent = (backend: string) => ({+ id: `${backend}-${backend}`, name: backend, display_name: backend, description: null, backend, model: models[backend] ?? null,+ reasoning_effort: null, enabled: true, archived: false, archived_at: null, source: 'builtin', updated_at: '',+ system_prompt: null, created_at: '', metadata: { builtin_default: true },+ });+ await page.route('**/api/models/agents', (route) => route.fulfill({ json: { ok: true, agents: LINEUP.map(supply) } }));+ await page.route('**/api/models/agents?**', (route) => route.fulfill({ json: { ok: true, agents: LINEUP.map(supply) } }));+ await page.route(/\/api\/agents(\?.*)?$/, (route) => route.fulfill({ json: { ok: true, agents: LINEUP.map(agent), default_agent_name: 'claude' } }));+ await page.route(/\/api\/agents\/[a-z]+$/, (route) => {+ const name = new URL(route.request().url()).pathname.split('/').at(-1)!;+ return route.fulfill({ json: { ok: true, agent: agent(name), default_agent_name: 'claude' } });+ });+ await page.route('**/api/models/agents/*/chains', (route) => {+ const backend = new URL(route.request().url()).pathname.split('/')[4];+ const model = models[backend];+ return route.fulfill({ json: { chains: model ? [{+ contract_version: CONTRACT_VERSION, backend, model_id: model, manual_override: null, route_origin: 'automatic',+ current: { source_id: 'src_setup_fixture', model_id: model },+ chain: [{ source_id: 'src_setup_fixture', model_id: model, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }],+ supply_state: 'ok',+ }] : [] } });+ });+ const candidate = (id: string) => ({ id, display_name: null, reasoning_efforts: [], origin: 'provider',+ suppliers: [{ source_id: 'src_setup_fixture', source_name: 'OpenAI', model_id: id }] });+ await page.route('**/api/models/agents/vibey/models/candidates', (route) => route.fulfill({ json: { candidates: {+ builtin: [], providers: ['gpt-5.6-sol', 'gpt-5.6-mini', 'gpt-5.6-nano', 'gpt-5.6-pro'].map(candidate), in_list: [],+ } } }));+ await page.route('**/api/backend/*/connection', (route) => route.fulfill({ json: {+ ok: true, backend: new URL(route.request().url()).pathname.split('/').at(-2), installed: true, enabled: true,+ auth: 'api_key', application: 'applied', ready: true, entry_eligible: true, supply_mode: 'hub',+ } }));+ await page.route('**/api/opencode/permission-status', (route) => route.fulfill({ json: { ok: true, permission_allowed: permitted } }));+}++type Box = { x: number; y: number; width: number; height: number };+const boxes = (page: Page, selector: string): Promise<Box[]> => page.locator(selector).evaluateAll((nodes) =>+ nodes.map((node) => { const { x, y, width, height } = node.getBoundingClientRect(); return { x, y, width, height }; }));+const overlaps = (a: Box, b: Box) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;++test('the lineup stands the built-in assistant first, on the reference tracks of every screen', async ({ page }) => {+ await page.setViewportSize({ width: 1200, height: 800 });+ await serveProduct(page);+ await serveLineup(page);+ await openOnboarding(page);+ await freezeAt(page, PHASES['codex-working']);+ const intro = await boxes(page, '.onboarding-collaboration-card');+ expect(await page.locator('.onboarding-collaboration-card').evaluateAll((nodes) => nodes.map((node) => node.getAttribute('data-backend'))))+ .toEqual(LINEUP);+ // 242-wide cards with 24 between them, in the 1040 column from 80 to 1120.+ expect(intro.map((box) => Math.round(box.x))).toEqual([80, 346, 612, 878]);+ for (const box of intro) expect(box.width).toBeCloseTo(242, 0);+ const action = (await boxes(page, '.onboarding-primary-action'))[0];+ expect(action.width).toBeCloseTo(299, 0);+ expect(action.x + action.width / 2).toBeCloseTo(600, 0);++ await openSetup(page, 'en');+ await page.clock.runFor(2000);+ // The built-in card grows to offer its models; the others keep the card's own height.+ const vibey = page.locator('.onboarding-assistant[data-backend="vibey"]');+ await expect(vibey.getByRole('button', { name: /gpt-5\.6-sol/ })).toBeVisible();+ const assistants = await boxes(page, '[data-setup-screen="assistants"] .onboarding-assistant');+ expect(assistants.map((box) => Math.round(box.x))).toEqual(intro.map((box) => Math.round(box.x)));+ expect(assistants[0].height).toBeGreaterThan(assistants[1].height);+ expect(new Set(assistants.slice(1).map((box) => Math.round(box.height))).size).toBe(1);+ expect(new Set(assistants.map((box) => Math.round(box.y))).size).toBe(1);++ // The providers screen's destinations are the same row, the built-in one tagged.+ await page.getByRole('button', { name: 'Back to providers' }).click();+ await page.clock.runFor(950);+ const destinations = await boxes(page, '[data-setup-screen="providers"] .setup-destination');+ expect(destinations.map((box) => Math.round(box.x))).toEqual(intro.map((box) => Math.round(box.x)));+ await expect(page.locator('.setup-destination').first()).toContainText('Built-in');+});++/**+ * Every band reserves the offer at its worst reading, so opening it moves nothing: the+ * aside is never drawn over a card and the action keeps the introduction's y.+ */+for (const [width, height] of [[1200, 800], [1440, 900], [1920, 1080], [1024, 768], [800, 1000], [390, 844]] as const) {+ test(`${width}x${height}: the built-in offer is never drawn under the aside, and the action holds still`, async ({ page }) => {+ await page.setViewportSize({ width, height });+ await serveProduct(page);+ await serveLineup(page, { permitted: false });+ await openOnboarding(page);+ await freezeAt(page, PHASES['codex-working']);+ const introAction = (await boxes(page, '.onboarding-primary-action'))[0];+ await openSetup(page, 'en');+ await page.clock.runFor(2000);+ await expect(page.locator('.onboarding-assistant[data-backend="vibey"] .onboarding-model-offer')).toBeVisible();+ const aside = page.locator('[data-setup-screen="assistants"] .onboarding-action-aside');+ await expect(aside).not.toBeEmpty();+ const asideBox = (await boxes(page, '[data-setup-screen="assistants"] .onboarding-action-aside'))[0];+ const footer = (await boxes(page, '.onboarding-setup-footer'))[0];+ for (const card of await boxes(page, '[data-setup-screen="assistants"] .onboarding-assistant')) {+ expect(overlaps(card, asideBox)).toBe(false);+ }+ expect(overlaps(footer, asideBox)).toBe(false);+ const action = (await boxes(page, '.onboarding-primary-action'))[0];+ expect(action.y).toBeCloseTo(introAction.y, 0);+ });+}diff --git a/ui/e2e/onboarding-fidelity/support.ts b/ui/e2e/onboarding-fidelity/support.tsindex df3fceac7..f86edd8e3 100644--- a/ui/e2e/onboarding-fidelity/support.ts+++ b/ui/e2e/onboarding-fidelity/support.ts@@ -4,22 +4,25 @@ export const ORIGIN = 'http://127.0.0.1:5212';export const isRetiredMemoryPath = (pathname: string) => pathname === '/api/memory' || pathname.startsWith('/api/memory/');-/** Every phase of the authored 8.9s loop, addressed by the elapsed time it freezes at. */+/** Every phase of the authored 11.15s loop, addressed by the elapsed time it freezes at. */export const PHASES = {- 'pm-working': 600,- 'handoff-to-codex': 1875,- 'codex-working': 3000,- 'handoff-to-opencode': 4125,- 'tests-running': 5200,- 'return-to-pm': 6500,- 'pm-summary': 8000,+ 'coordinator-planning': 600,+ 'handoff-to-claude': 1875,+ 'claude-building': 3000,+ 'handoff-to-codex': 4125,+ 'codex-working': 5200,+ 'handoff-to-opencode': 6375,+ 'tests-running': 7400,+ 'return-to-coordinator': 8750,+ 'coordinator-summary': 10000,} as const;/*** The accepted responsive matrix, plus the two widths between its rows that the* composition actually changes at. 1920 and 1440 are the wide desktop that takes the- * 1200 content box; 1366 and 1200 are the standard desktop on 976; 1024 and 768 are- * where the diagram stops following its proportion; 390, 375 and 320 are the phones.+ * 1200 content box; 1366 and 1200 are the standard desktop on 1040; 1024 is the last+ * width the lineup stands in one row, 768 folds it into two; 390, 375 and 320 are the+ * phones.*/export const VIEWPORTS = [{ width: 1920, height: 1080 },diff --git a/ui/src/components/Wizard.tsx b/ui/src/components/Wizard.tsxindex e414b1b85..4ce916285 100644--- a/ui/src/components/Wizard.tsx+++ b/ui/src/components/Wizard.tsx@@ -1,6 +1,6 @@import { desktopDragRegion } from '../lib/desktopShell';import { DesktopDragRegion } from './DesktopDragRegion';-import { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactElement, type Ref } from 'react';+import { forwardRef, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactElement, type Ref } from 'react';import { ArrowLeft, ArrowRight, LoaderCircle, RefreshCw } from 'lucide-react';import { Button } from './ui/button';import { AccessTiles } from './onboarding/AccessTiles';@@ -30,7 +30,7 @@ import { LanguageSwitcher } from './LanguageSwitcher';import { useApi } from '../context/ApiContext';import { useStatus } from '../context/StatusContext';import { setConfigField } from '../lib/configMutations';-import { ASSISTANT_ORDER } from './onboarding/collaborationTimeline';+import { ASSISTANT_ORDER, SETUP_LINEUP } from './onboarding/collaborationTimeline';import { createAgentCollectionReadAuthority } from './settings/models/collectionReadAuthority';import { admitEntry, chooseEntryDefault, readEntryEvidence, type EntryGateDeps, type EntryRefusal } from './onboarding/entryGate';@@ -548,7 +548,10 @@ export function Wizard() {navigate('/', { state: { onboardingCompleted: true } });} finally { completing.current = false; }};- return <div className="onboarding-shell">+ // The stylesheet's stacked and folded reservations count the cards; the lineup is+ // the one place that count lives.+ return <div className="onboarding-shell"+ style={{ '--ob-cards': SETUP_LINEUP.length, '--ob-fold-rows': Math.ceil(SETUP_LINEUP.length / 2) } as CSSProperties}><SetupHeader /><main className="onboarding-shell-content"><SetupFlowShell sequence={SETUP_REGISTERED_SCREENS} capability={capability} gatewayEnabled={gatewayEnabled}diff --git a/ui/src/components/onboarding/AssistantRow.tsx b/ui/src/components/onboarding/AssistantRow.tsxindex 9b4e1965a..86ed5b9d8 100644--- a/ui/src/components/onboarding/AssistantRow.tsx+++ b/ui/src/components/onboarding/AssistantRow.tsx@@ -49,6 +49,45 @@ export interface AssistantRowProps {route?: AssistantRouteView;}+/**+ * The model a card's route resolves to: a label over the model, and — when `live` — the+ * way into that route, with the chevron that says a dialog is behind it.+ *+ * Off, a card still shows the model the assistant would call, so switching it on has no+ * surprise in it. It is a statement then, not a control: no chevron, nothing to press.+ */+export function RouteChoice({ name, route, live, disabled = false, pending = false, onOpen }: {+ name: string;+ route?: AssistantRouteView;+ live: boolean;+ disabled?: boolean;+ pending?: boolean;+ onOpen: () => void;+}) {+ const { t } = useTranslation();+ const model = route?.kind === 'route' ? route.model : null;+ const unknown = route?.kind === 'pending' || route?.kind === 'failed';+ const lead = route?.kind === 'route' && route.backups+ ? t('onboarding.setup.defaultModelWithBackups', { count: route.backups })+ : t('onboarding.setup.defaultModel');+ return (+ <button type="button" className="onboarding-model-choice" onClick={live ? onOpen : undefined}+ aria-label={t('onboarding.setup.defaultModelNamed', { name })}+ aria-disabled={live ? undefined : true}+ disabled={!live || disabled}>+ <span>+ <small>{unknown ? t('onboarding.setup.defaultModel') : lead}</small>+ {unknown+ ? <strong className="onboarding-model-choice-pending" aria-hidden="true" />+ : <strong>{model}</strong>}+ </span>+ {live && !unknown && (pending+ ? <RefreshCw size={17} className="motion-safe:animate-spin" />+ : <ChevronRight size={17} />)}+ </button>+ );+}+/*** One assistant, drawn as the card the welcome already showed it in.*@@ -78,34 +117,18 @@ export function AssistantRow({ backend, status, installing, detecting, error, li: 'checking';const routeModel = route?.kind === 'route' ? route.model : null;const routeUnknown = route?.kind === 'pending' || route?.kind === 'failed';- const routeLead = () => (route?.kind === 'route' && route.backups ? t('onboarding.setup.defaultModelWithBackups', { count: route.backups })- : t('onboarding.setup.defaultModel'));- // Off, the card still shows the model the assistant would call, so switching it on- // has no surprise in it. It is a statement then, not a control: no chevron, nothing- // to press, and the switch above is the only thing that changes it.+ // Switched off, the switch above is the only thing that changes the model shown.const routeChoice = (live: boolean) => (- <button type="button" className="onboarding-model-choice" onClick={live ? onConfigure : undefined}- aria-label={t('onboarding.setup.defaultModelNamed', { name: label })}- aria-disabled={live ? undefined : true}- disabled={!live || configuringDisabled || installing || detecting || !!connectionPending}>- <span>- <small>{routeUnknown ? t('onboarding.setup.defaultModel') : routeLead()}</small>- {routeUnknown- ? <strong className="onboarding-model-choice-pending" aria-hidden="true" />- : <strong>{routeModel}</strong>}- </span>- {live && !routeUnknown && (connectionPending- ? <RefreshCw size={17} className="motion-safe:animate-spin" />- : <ChevronRight size={17} />)}- </button>+ <RouteChoice name={label} route={route} live={live} onOpen={onConfigure} pending={!!connectionPending}+ disabled={configuringDisabled || installing || detecting || !!connectionPending} />);return (- <Card className="onboarding-assistant" aria-label={label}>+ <Card className="onboarding-assistant" data-backend={backend} aria-label={label}><div className="onboarding-card-identity"><span className="onboarding-card-logo"><BackendIcon backend={backend} size={28} variant="brand" aria-hidden="true" /></span>- {/* A heading here and a `strong` on the welcome: the setup's three cards are- a real document structure a person navigates, the welcome's are an- illustration the card already labels. Same class, so same geometry. */}+ {/* A heading here and a `strong` on the welcome: the setup's cards are a real+ document structure a person navigates, the welcome's are an illustration+ the card already labels. Same class, so same geometry. */}<h3 className="onboarding-card-name">{label}</h3><div className="onboarding-assistant-enable">{enabledControl}</div></div>diff --git a/ui/src/components/onboarding/AssistantSetup.test.tsx b/ui/src/components/onboarding/AssistantSetup.test.tsxindex e50b42723..4e7aeae80 100644--- a/ui/src/components/onboarding/AssistantSetup.test.tsx+++ b/ui/src/components/onboarding/AssistantSetup.test.tsx@@ -13,6 +13,7 @@ import type { Source } from '../settings/models/types';import { RouteSurfaceActiveContext } from '../../lib/routeSurfaceActivity';import type { SetupAction, SetupScreenHandle } from './setupFlow';import { INITIAL_SETUP_FLOW_STATE } from './setupFlow';+import { SETUP_LINEUP } from './collaborationTimeline';const mock = vi.hoisted(() => ({ api: {detectCli: vi.fn(), installAgent: vi.fn(), getConfig: vi.fn(), getBackendRuntime: vi.fn(), getBackendConnection: vi.fn(), mutateConfig: vi.fn(), getClaudeAuth: vi.fn(), getCodexAuth: vi.fn(), getOpencodeProviders: vi.fn(), saveClaudeAuth: vi.fn(),@@ -107,7 +108,7 @@ describe('assistant installation presentation', () => {const install = pending<{ ok: boolean; path: string; message: string }>();mock.api.installAgent.mockReturnValue(install.promise);render(wrap(<AgentDetection data={saved} onNext={vi.fn()} />));- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(3));+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length));fireEvent.click(row('Codex').getByRole('button', { name: 'Install' }));await act(async () => install.resolve({ ok: true, path: '/isolated/bin/codex', message: '' }));expect(row('Codex').getByRole('switch').getAttribute('aria-checked')).toBe('false');@@ -125,7 +126,7 @@ describe('assistant installation presentation', () => {const install = pending<{ ok: boolean; path: string; message: string }>();mock.api.installAgent.mockReturnValue(install.promise);render(wrap(<AgentDetection data={saved} onNext={vi.fn()} />));- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(3));+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length));expect(row('Codex').queryByRole('button', { name: 'Install and enable' })).toBeNull();fireEvent.click(row('Codex').getByRole('button', { name: 'Install' }));await act(async () => install.resolve({ ok: true, path: '/isolated/bin/codex', message: '' }));@@ -209,9 +210,12 @@ describe('assistant installation presentation', () => {? new Promise((resolve) => { finishClaude = resolve; }): Promise.resolve({ ok: true, path: '/isolated/bin/codex' }));render(wrap(<AgentDetection data={data()} onNext={vi.fn()} />));- // The three cards are the whole section: the design keeps each assistant's name at- // the top of its own card and gives the section no heading of its own.- expect(screen.getAllByRole('heading', { level: 3 }).map((node) => node.textContent)).toEqual(['Claude Code', 'Codex', 'OpenCode']);+ // The cards are the whole section: the design keeps each assistant's name at the top+ // of its own card and gives the section no heading of its own. The built-in one+ // stands first, with no switch: it is always on.+ expect(screen.getAllByRole('heading', { level: 3 }).map((node) => node.textContent)).toEqual(['Vibey', 'Claude Code', 'Codex', 'OpenCode']);+ expect(within(row('Vibey').getByRole('heading', { name: 'Vibey' }).closest('.onboarding-card-identity') as HTMLElement)+ .queryByRole('switch')).toBeNull();// "Connection state replaces roles with enable switches": the switch belongs to the// same identity header as the name, not to a separate strip.for (const name of ['Claude Code', 'Codex', 'OpenCode']) {@@ -260,11 +264,14 @@ describe('assistant installation presentation', () => {it('a failed install settlement refreshes connection state without admitting stale readiness', async () => {mock.api.getBackendConnection.mockImplementation(async (backend) => ({ ok: true, backend, installed: false, enabled: true, auth: 'none', application: 'applied', ready: false, entry_eligible: false }));render(wrap(<AgentDetection data={data()} onNext={vi.fn()} />));- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(3));+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length));mock.api.installAgent.mockResolvedValue({ ok: false, path: '/fixture/new-cli', message: 'fixture apply failed' });mock.api.getBackendConnection.mockImplementation(async (backend) => ({ ok: true, backend, installed: true, enabled: true, auth: 'api_key', application: 'failed', ready: false, entry_eligible: false }));fireEvent.click(row('Claude Code').getByRole('button', { name: 'Install' }));- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(4));+ // The settlement reads the installed backend's connection once more, and the failed+ // application it reports is what keeps entry closed.+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length + 1));+ expect(mock.api.getBackendConnection).toHaveBeenLastCalledWith('claude');expect(screen.getByRole('button', { name: 'Enter workspace' }).hasAttribute('disabled')).toBe(true);expect(mock.api.installAgent).toHaveBeenCalledOnce(); expect(mock.api.mutateConfig).not.toHaveBeenCalled();});@@ -292,7 +299,7 @@ describe('assistant installation presentation', () => {entry_eligible: false,}));const view = render(wrap(<AgentDetection data={saved} onNext={vi.fn()} />, false));- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(3));+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length));mock.api.getBackendConnection.mockImplementation(async (backend) => ({ok: true,backend,@@ -304,7 +311,7 @@ describe('assistant installation presentation', () => {entry_eligible: true,}));view.rerender(wrap(<AgentDetection data={saved} onNext={vi.fn()} />, true));- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(6));+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length * 2));expect(await row('Claude Code').findByRole('button', { name: 'API Key connected' })).toBeTruthy();expect(screen.getByRole('button', { name: 'Enter workspace' }).hasAttribute('disabled')).toBe(false);});@@ -673,7 +680,7 @@ describe('Hub route refresh', () => {const view = render(wrap(<AgentDetection {...props} />));await waitFor(() => expect(mock.models.listSources).toHaveBeenCalled());expect(screen.queryByRole('button', { name: 'Add model source' })).toBeNull();- await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(3));+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(SETUP_LINEUP.length));const pendingEntry = screen.getByRole<HTMLButtonElement>('button', { name: 'Enter workspace' });expect(pendingEntry.disabled).toBe(true);fireEvent.click(pendingEntry);diff --git a/ui/src/components/onboarding/BuiltinAssistant.test.tsx b/ui/src/components/onboarding/BuiltinAssistant.test.tsxnew file mode 100644index 000000000..29d4a3c6f--- /dev/null+++ b/ui/src/components/onboarding/BuiltinAssistant.test.tsx@@ -0,0 +1,274 @@+// @vitest-environment jsdom+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';+import { createInstance } from 'i18next';+import { I18nextProvider } from 'react-i18next';+import { MemoryRouter } from 'react-router-dom';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { AgentDetection } from '../steps/AgentDetection';+import en from '../../i18n/en.json';+import { RouteSurfaceActiveContext } from '../../lib/routeSurfaceActivity';+import type { AgentSupply, BackendModelCandidates, ModelCandidate, Source } from '../settings/models/types';+import { inlineCandidates } from './builtinModelOffer';++const mock = vi.hoisted(() => ({ api: {+ detectCli: vi.fn(), installAgent: vi.fn(), getConfig: vi.fn(), getBackendRuntime: vi.fn(), getBackendConnection: vi.fn(),+ mutateConfig: vi.fn(), listVibeAgents: vi.fn(), getVibeAgent: vi.fn(), updateVibeAgent: vi.fn(),+}, showToast: vi.fn(), models: {+ getAgentChains: vi.fn(), listSources: vi.fn(), getAgentModelCandidates: vi.fn(), putAgentModels: vi.fn(),+} }));+vi.mock('../../context/ApiContext', () => ({ useApi: () => mock.api }));+vi.mock('../settings/models/modelsApi', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../settings/models/modelsApi')>();+ return { ...actual, modelsApi: { ...actual.modelsApi, ...mock.models } };+});+vi.mock('../../context/ToastContext', () => ({ useToast: () => ({ showToast: mock.showToast }) }));+vi.mock('../settings/shared/useOpencodePermission', () => ({ useOpencodePermission: () => ({ permissionAllowed: true, statusLoaded: true }) }));++const i18n = createInstance();+await i18n.init({ lng: 'en', resources: { en: { translation: en } }, interpolation: { escapeValue: false } });+const wrap = (node: React.ReactNode) => (+ <MemoryRouter><I18nextProvider i18n={i18n}><RouteSurfaceActiveContext.Provider value>{node}</RouteSurfaceActiveContext.Provider></I18nextProvider></MemoryRouter>+);+const card = () => within(screen.getByLabelText('Vibey'));+const enter = () => screen.getByRole<HTMLButtonElement>('button', { name: 'Enter workspace' });++/** No CLI on this machine: the built-in assistant is the only one that can run. */+const data = (extra: Record<string, unknown> = {}) => ({+ __onboardingDetected: true,+ capabilities: { model_hub: { enabled: true } },+ agents: Object.fromEntries(['claude', 'codex', 'opencode'].map((name) => [name, { enabled: true, cli_path: name, status: 'missing' }])),+ ...extra,+});+const source: Source = {+ id: 'src_openai', vendor: 'openai', display_name: 'OpenAI', kind: 'api_key', protocol: 'openai', supply_channel: 'hub',+ billing: 'metered', state: { status: 'active' }, models: [], last_discovered_at: null,+};+const candidate = (id: string, supplied = true): ModelCandidate => ({+ id, display_name: null, reasoning_efforts: [], origin: 'provider',+ suppliers: supplied ? [{ source_id: 'src_openai', source_name: 'OpenAI', model_id: id }] : [],+});+const candidates = (): BackendModelCandidates => ({+ builtin: [],+ providers: [candidate('gpt-5.6-unsupplied', false), candidate('gpt-5.6-sol'), candidate('gpt-5.6-mini'), candidate('gpt-5.6-nano'), candidate('gpt-5.6-pro')],+ in_list: [],+});+/** Vibey's supply: its catalog, and the model its built-in Agent is pinned to. */+const vibeySupply = (models: string[] = [], pinned: string | null = models[0] ?? null): AgentSupply => ({+ backend: 'vibey', cli_present: false, mode: 'hub', menu_kind: 'fixed',+ named_agents: [{ name: 'vibey', effective_model_id: pinned, supply_status: pinned ? 'ok' : null }],+ catalog_models: models.map((id) => ({ id, reasoning_efforts: [] } as never)),+});+let effort: string | null = null;+const vibeyAgent = (model: string | null) => ({+ id: 'vibey-vibey', name: 'vibey', display_name: 'vibey', description: null, backend: 'vibey' as const, model,+ reasoning_effort: effort, enabled: true, archived: false, archived_at: null, source: 'builtin', updated_at: '',+ system_prompt: null, created_at: '', metadata: { builtin_default: true, lock_delete: true },+});+const chain = (modelId: string) => ({+ contract_version: 11, backend: 'vibey', model_id: modelId,+ manual_override: null, route_origin: 'automatic', current: { source_id: 'src_openai', model_id: modelId },+ chain: [{ source_id: 'src_openai', model_id: modelId, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null }],+ supply_state: 'ok',+});++let model: string | null = null;+const reads = {+ read: async () => ({ kind: 'current' as const, value: [vibeySupply(model ? [model] : [])] }),+ refresh: async () => ({ kind: 'current' as const, value: [vibeySupply(model ? [model] : [])] }),+ readValue: async () => [vibeySupply(model ? [model] : [])],+ invalidate: () => undefined,+};++beforeEach(() => {+ vi.resetAllMocks();+ model = null;+ effort = null;+ mock.api.getConfig.mockResolvedValue(data());+ mock.api.detectCli.mockResolvedValue({ found: false });+ mock.api.getBackendRuntime.mockResolvedValue({ installed: false, has_update: false });+ mock.api.getBackendConnection.mockImplementation(async (backend: string) => backend === 'vibey'+ ? { ok: true, backend, installed: true, enabled: true, auth: 'api_key', application: 'applied', ready: true, entry_eligible: true, supply_mode: 'hub' }+ : { ok: true, backend, installed: false, enabled: true, auth: 'none', application: 'applied', ready: false, entry_eligible: false, supply_mode: 'hub' });+ mock.api.listVibeAgents.mockImplementation(async () => ({ ok: true, agents: [vibeyAgent(model)], default_agent_name: 'claude' }));+ mock.api.getVibeAgent.mockImplementation(async () => ({ ok: true, agent: vibeyAgent(model), default_agent_name: 'claude' }));+ mock.api.updateVibeAgent.mockImplementation(async (_name: string, payload: { model: string; reasoning_effort?: string | null }) => {+ model = payload.model;+ if ('reasoning_effort' in payload) effort = payload.reasoning_effort ?? null;+ return { ok: true, agent: vibeyAgent(model) };+ });+ mock.models.listSources.mockResolvedValue([source]);+ mock.models.getAgentChains.mockImplementation(async () => (model ? [chain(model)] : []));+ mock.models.getAgentModelCandidates.mockImplementation(async () => candidates());+ mock.models.putAgentModels.mockImplementation(async () => vibeySupply());+});+afterEach(cleanup);++describe('the built-in assistant card', () => {+ it('offers the first supplied candidates inline, in the picker order', () => {+ expect(inlineCandidates(candidates()).map((row) => row.id)).toEqual(['gpt-5.6-sol', 'gpt-5.6-mini', 'gpt-5.6-nano']);+ const listed = { ...candidates(), in_list: [candidate('gpt-5.6-pro')] };+ expect(inlineCandidates(listed).map((row) => row.id)).toEqual(['gpt-5.6-pro', 'gpt-5.6-sol', 'gpt-5.6-mini']);+ });++ it('is always on, picks its first model inline, and lets setup finish on it alone', async () => {+ const onNext = vi.fn();+ render(wrap(<AgentDetection data={data()} onNext={onNext} onNavigate={vi.fn()} agentReads={reads} />));+ expect(card().getByText(en.onboarding.setup.builtinAlwaysOn)).toBeTruthy();+ expect(card().queryByRole('switch')).toBeNull();+ expect(await card().findByText(en.onboarding.setup.noteBuiltinUnset)).toBeTruthy();+ const pick = await card().findByRole('button', { name: /gpt-5\.6-mini/ });+ expect(card().getAllByRole('button').map((node) => node.textContent)).toEqual([+ 'gpt-5.6-solOpenAI', 'gpt-5.6-miniOpenAI', 'gpt-5.6-nanoOpenAI', en.onboarding.setup.allModels,+ ]);+ expect(enter().disabled).toBe(true);+ expect(screen.getByText(en.onboarding.connection.builtinModelHint.replace('{{name}}', 'Vibey'))).toBeTruthy();++ fireEvent.click(pick);+ await waitFor(() => expect(mock.api.updateVibeAgent).toHaveBeenCalledWith('vibey', { model: 'gpt-5.6-mini' }));+ expect(mock.models.putAgentModels).toHaveBeenCalledWith('vibey', expect.objectContaining({+ baseline: [],+ models: [expect.objectContaining({ id: 'gpt-5.6-mini', origin: 'provider' })],+ expected_suppliers: { 'gpt-5.6-mini': [{ source_id: 'src_openai', model_id: 'gpt-5.6-mini' }] },+ }));+ // The catalog write lands before the Agent names the model it adds.+ expect(mock.models.putAgentModels.mock.invocationCallOrder[0]).toBeLessThan(mock.api.updateVibeAgent.mock.invocationCallOrder[0]);+ expect(await card().findByText('gpt-5.6-mini')).toBeTruthy();+ expect(card().getByText(en.onboarding.setup.noteEnabled)).toBeTruthy();+ await waitFor(() => expect(enter().disabled).toBe(false));+ fireEvent.click(enter());+ await waitFor(() => expect(onNext).toHaveBeenCalledWith(expect.objectContaining({ readyBackends: ['vibey'] })));+ });++ it('keeps a choice that did not stand open, and holds entry on it, until Retry applies it', async () => {+ // Naming the pick fails after the list took it; the server has meanwhile filled the+ // Agent with another model, so the Agent reads as configured with one nobody chose.+ mock.api.updateVibeAgent.mockRejectedValueOnce(new Error('offline'));+ mock.models.putAgentModels.mockImplementationOnce(async () => { model = 'gpt-5.6-large'; return vibeySupply(); });+ const onNext = vi.fn();+ render(wrap(<AgentDetection data={data()} onNext={onNext} onNavigate={vi.fn()} agentReads={reads} />));+ fireEvent.click(await card().findByRole('button', { name: /gpt-5\.6-mini/ }));+ const alert = await card().findByRole('alert');+ expect(alert.textContent).toContain(en.onboarding.setup.modelPickFailed);+ expect(card().getByRole('button', { name: /gpt-5\.6-sol/ })).toBeTruthy();+ await act(async () => undefined);+ expect(enter().disabled).toBe(true);+ fireEvent.click(within(alert).getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(model).toBe('gpt-5.6-mini'));+ await waitFor(() => expect(enter().disabled).toBe(false));+ });++ it('holds the whole entry on a choice that did not stand, even with a CLI assistant ready', async () => {+ mock.api.detectCli.mockResolvedValue({ found: true, path: '/isolated/bin/claude' });+ mock.api.getBackendConnection.mockImplementation(async (backend: string) => ({+ ok: true, backend, installed: true, enabled: true, auth: 'api_key', application: 'applied', ready: true, entry_eligible: true, supply_mode: 'hub',+ }));+ mock.api.updateVibeAgent.mockRejectedValueOnce(new Error('offline'));+ mock.models.putAgentModels.mockImplementationOnce(async () => { model = 'gpt-5.6-large'; return vibeySupply(); });+ const ready = { ...data(), agents: { ...data().agents, claude: { enabled: true, cli_path: 'claude', status: 'ok' } } };+ render(wrap(<AgentDetection data={ready} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ const pick = await card().findByRole('button', { name: /gpt-5\.6-mini/ });+ await waitFor(() => expect(enter().disabled).toBe(false));+ fireEvent.click(pick);+ await card().findByRole('alert');+ await act(async () => undefined);+ expect(enter().disabled).toBe(true);+ expect(screen.getByText(en.onboarding.connection.builtinChoiceHint.replace('{{name}}', 'Vibey'))).toBeTruthy();+ fireEvent.click(within(card().getByRole('alert')).getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(model).toBe('gpt-5.6-mini'));+ await waitFor(() => expect(enter().disabled).toBe(false));+ });++ it('lets setup finish on another runnable Agent of the built-in backend', async () => {+ const supply = (): AgentSupply[] => [{+ ...vibeySupply(['gpt-5.6-pro'], null),+ named_agents: [+ { name: 'vibey', effective_model_id: null, supply_status: null },+ { name: 'vibey-writer', effective_model_id: 'gpt-5.6-pro', supply_status: 'ok' },+ ],+ }];+ const runnable = { ...reads, read: async () => ({ kind: 'current' as const, value: supply() }), readValue: async () => supply() };+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={runnable} />));+ expect(await card().findByText(en.onboarding.setup.noteBuiltinUnset)).toBeTruthy();+ await waitFor(() => expect(enter().disabled).toBe(false));+ });++ it('never detects a CLI for the built-in backend, on Rescan or on return', async () => {+ const view = render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ await card().findByText(en.onboarding.setup.noteBuiltinUnset);+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledWith('vibey'));+ // A retained screen coming back detects whatever it holds as assistants, and Rescan+ // does too: three CLIs, and never the built-in backend.+ view.rerender(wrap(<AgentDetection data={{ ...data(), __onboardingDetected: false }} active={false} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ view.rerender(wrap(<AgentDetection data={{ ...data(), __onboardingDetected: false }} active onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ await waitFor(() => expect(mock.api.detectCli).toHaveBeenCalledTimes(3));+ fireEvent.click(screen.getByRole('button', { name: en.agentDetection.rescan }));+ await waitFor(() => expect(mock.api.detectCli).toHaveBeenCalledTimes(6));+ expect(mock.api.detectCli.mock.calls.map(([binary]) => binary)).not.toContain('vibey');+ });++ it('opens every candidate behind All models as one choice, and uses the model chosen', async () => {+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ fireEvent.click(await card().findByRole('button', { name: en.onboarding.setup.allModels }));+ const dialog = within(await screen.findByRole('dialog', { name: 'Choose a Vibey model' }));+ expect(dialog.queryByRole('button', { name: en.settings.models.gateway.picker.custom })).toBeNull();+ const pro = await dialog.findByRole('radio', { name: /gpt-5\.6-pro/ });+ const nano = dialog.getByRole('radio', { name: /gpt-5\.6-nano/ });+ fireEvent.click(pro);+ fireEvent.click(nano);+ // A second pick replaces the first: one model is chosen, and it is the last one clicked.+ expect(pro.getAttribute('aria-checked')).toBe('false');+ expect(nano.getAttribute('aria-checked')).toBe('true');+ fireEvent.click(dialog.getByRole('button', { name: en.settings.models.gateway.picker.use }));+ await waitFor(() => expect(mock.api.updateVibeAgent).toHaveBeenCalledWith('vibey', { model: 'gpt-5.6-nano' }));+ expect(mock.models.putAgentModels).toHaveBeenCalledOnce();+ expect(mock.models.putAgentModels.mock.calls[0][1].models.map((row: { id: string }) => row.id)).toEqual(['gpt-5.6-nano']);+ expect(screen.queryByRole('dialog')).toBeNull();+ });++ it('lets All models choose a model the list already holds, without adding it again', async () => {+ const listedRow = { ...candidate('gpt-5.6-pro'), group_if_removed: 'providers' as const };+ mock.models.getAgentModelCandidates.mockImplementation(async () => ({ ...candidates(), in_list: [listedRow] }));+ // Listed, and the Agent still has no model: the server's own fill has not run yet.+ const supply = () => [vibeySupply(['gpt-5.6-pro'], null)];+ const listed = { ...reads, read: async () => ({ kind: 'current' as const, value: supply() }), readValue: async () => supply() };+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={listed} />));+ fireEvent.click(await card().findByRole('button', { name: en.onboarding.setup.allModels }));+ const dialog = within(await screen.findByRole('dialog'));+ const row = await dialog.findByRole('radio', { name: /gpt-5\.6-pro/ });+ expect(row.getAttribute('aria-disabled')).not.toBe('true');+ fireEvent.click(row);+ fireEvent.click(dialog.getByRole('button', { name: en.settings.models.gateway.picker.use }));+ await waitFor(() => expect(mock.api.updateVibeAgent).toHaveBeenCalledWith('vibey', { model: 'gpt-5.6-pro' }));+ expect(mock.models.putAgentModels).not.toHaveBeenCalled();+ });++ it('reads as an enabled assistant once it has a model, and opens its route', async () => {+ model = 'gpt-5.6-sol';+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ const choice = await card().findByRole('button', { name: 'Model route for Vibey, review and reorder' });+ await waitFor(() => expect(within(choice).getByText('gpt-5.6-sol')).toBeTruthy());+ expect(card().getByText(en.onboarding.setup.noteEnabled)).toBeTruthy();+ expect(mock.models.getAgentModelCandidates).not.toHaveBeenCalled();+ await waitFor(() => expect(enter().disabled).toBe(false));+ });++ it('says the gateway is off and holds its model still', async () => {+ model = 'gpt-5.6-sol';+ render(wrap(<AgentDetection data={data({ agent_supply_blocks: { vibey: 'gateway_off' } })} onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ expect(await card().findByText(en.onboarding.setup.noteGatewayOff.replace('{{name}}', 'Vibey'))).toBeTruthy();+ const choice = await card().findByRole('button', { name: 'Model route for Vibey, review and reorder' });+ await waitFor(() => expect(within(choice).getByText('gpt-5.6-sol')).toBeTruthy());+ expect(choice.getAttribute('aria-disabled')).toBe('true');+ await act(async () => undefined);+ expect(enter().disabled).toBe(true);+ });++ it('says the Hub is disabled on this instance', async () => {+ render(wrap(<AgentDetection data={data({ capabilities: { model_hub: { enabled: false } }, agent_supply_blocks: { vibey: 'hub_disabled' } })}+ onNext={vi.fn()} onNavigate={vi.fn()} agentReads={reads} />));+ expect(await card().findByText(en.onboarding.setup.noteHubDisabled.replace('{{name}}', 'Vibey'))).toBeTruthy();+ expect(card().queryByRole('group')).toBeNull();+ await act(async () => undefined);+ expect(enter().disabled).toBe(true);+ });+});diff --git a/ui/src/components/onboarding/BuiltinAssistantRow.tsx b/ui/src/components/onboarding/BuiltinAssistantRow.tsxnew file mode 100644index 000000000..b65b3de24--- /dev/null+++ b/ui/src/components/onboarding/BuiltinAssistantRow.tsx@@ -0,0 +1,140 @@+import { ChevronRight, RefreshCw, SlidersHorizontal } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import { BackendIcon } from '../visual';+import { Button } from '../ui/button';+import { Badge } from '../ui/badge';+import { Card } from '../ui/card';+import { getBackendUiMeta, type BuiltinBackend } from '@/lib/agentBackends';+import type { HubSupplyBlock } from '../settings/models/featureFlags';+import type { ModelCandidate } from '../settings/models/types';+import { RouteChoice, type AssistantRouteView } from './AssistantRow';+import { INLINE_CANDIDATES, inlineCandidates, type BuiltinModelOffer } from './builtinModelOffer';+import type { BuiltinChoiceFailure } from './useBuiltinModelChoice';++export interface BuiltinAssistantRowProps {+ backend: BuiltinBackend;+ route?: AssistantRouteView;+ /** Why the Model Hub cannot supply this backend now, as the server states it. */+ block?: HubSupplyBlock;+ /** Read only while the backend's own Agent has no model. */+ offer?: BuiltinModelOffer;+ /** The candidate whose pick is being written, if any. */+ picking?: string | null;+ /** Why the last choice did not stand, if it did not. */+ failure?: BuiltinChoiceFailure | null;+ onRetryChoice?: () => void;+ connectionPending?: boolean;+ connectionError?: string;+ routeError?: string;+ configuringDisabled?: boolean;+ onConfigure: () => void;+ onPick: (candidate: ModelCandidate) => void;+ onAllModels: () => void;+ onRetryOffer?: () => void;+ onRefreshConnection?: () => void;+ onRetryRoute?: () => void;+}++/**+ * A built-in assistant, drawn in the same card frame as the CLI assistants beside it.+ *+ * It is part of the platform: there is nothing to install and no switch, so the state+ * row says so instead of showing a lifecycle. What it needs is a model. With one, the+ * card reads as an enabled assistant does — its route and the model it resolves to.+ * Without one, the card offers the models it could run on right now and writes the+ * pick, so setup can finish on this assistant alone (D3).+ */+export function BuiltinAssistantRow({ backend, route, block, offer, picking = null, failure = null, onRetryChoice,+ connectionPending, connectionError, routeError, configuringDisabled = false, onConfigure, onPick, onAllModels,+ onRetryOffer, onRefreshConnection, onRetryRoute }: BuiltinAssistantRowProps) {+ const { t } = useTranslation();+ const label = getBackendUiMeta(backend).label;+ // A choice that did not stand keeps the offer open whatever the Agent reads as now:+ // the server may have filled it with a model nobody chose.+ const unconfirmed = failure?.kind === 'failed';+ const unset = !block && (route?.kind === 'no-agent-model' || unconfirmed);+ const routeModel = route?.kind === 'route' ? route.model : null;+ const routeUnknown = route?.kind === 'pending' || route?.kind === 'failed';+ const note = block === 'gateway_off' ? t('onboarding.setup.noteGatewayOff', { name: label })+ : block === 'hub_disabled' ? t('onboarding.setup.noteHubDisabled', { name: label })+ : unset ? t('onboarding.setup.noteBuiltinUnset')+ : route?.kind === 'route' && !routeModel ? t('onboarding.setup.noteNoModels')+ : t('onboarding.setup.noteEnabled');+ const busy = !!picking || !!connectionPending;+ const candidates = offer?.kind === 'ready' ? inlineCandidates(offer.read) : [];+ return (+ <Card className="onboarding-assistant" data-backend={backend} aria-label={label}>+ <div className="onboarding-card-identity">+ <span className="onboarding-card-logo"><BackendIcon backend={backend} size={28} variant="brand" aria-hidden="true" /></span>+ <h3 className="onboarding-card-name">{label}</h3>+ </div>+ <div className="onboarding-assistant-state">+ <Badge variant="success" className="font-medium tracking-normal">+ <span className="size-2 rounded-full bg-mint" />{t('onboarding.setup.builtinAlwaysOn')}+ </Badge>+ </div>+ <div className="onboarding-assistant-body">+ <p className="onboarding-assistant-note" data-tone={block ? 'error' : undefined}>{note}</p>+ <div className="onboarding-assistant-actions">+ {unset ? (+ <div className="onboarding-model-offer" role="group" aria-label={t('onboarding.setup.pickModelNamed', { name: label })}+ aria-busy={offer?.kind === 'loading' || !!picking}>+ {offer?.kind === 'failed' ? (+ <p className="onboarding-model-offer-empty">+ {t('onboarding.setup.modelsUnreadable')}+ {onRetryOffer && <Button variant="link" size="xs" onClick={onRetryOffer}>{t('common.retry')}</Button>}+ </p>+ ) : offer?.kind === 'ready' ? (+ candidates.length === 0+ ? <p className="onboarding-model-offer-empty">{t('onboarding.setup.noModelsToPick')}</p>+ : candidates.map((candidate) => (+ <button key={candidate.id} type="button" className="onboarding-model-offer-row"+ disabled={busy || configuringDisabled} onClick={() => onPick(candidate)}>+ <span className="onboarding-model-offer-id">{candidate.display_name?.trim() || candidate.id}</span>+ {picking === candidate.id+ ? <RefreshCw size={14} className="motion-safe:animate-spin" aria-hidden="true" />+ : <span className="onboarding-model-offer-supplier">{candidate.suppliers[0].source_name}</span>}+ </button>+ ))+ ) : (+ // Pending keeps the rows' box, so the card does not grow when the read lands.+ Array.from({ length: INLINE_CANDIDATES }, (_, index) => (+ <span key={index} className="onboarding-model-offer-row" aria-hidden="true">+ <strong className="onboarding-model-choice-pending" />+ </span>+ ))+ )}+ <button type="button" className="onboarding-model-offer-row onboarding-model-offer-all"+ disabled={busy || configuringDisabled} onClick={onAllModels}>+ <span>{t('onboarding.setup.allModels')}</span>+ <ChevronRight size={15} aria-hidden="true" />+ </button>+ </div>+ ) : routeModel || routeUnknown ? (+ <RouteChoice name={label} route={route} live={!block && !routeUnknown} onOpen={onConfigure}+ pending={!!connectionPending} disabled={configuringDisabled || busy} />+ ) : route?.kind === 'route' && !block ? (+ <button type="button" className="onboarding-method-connected" onClick={onConfigure}+ disabled={configuringDisabled || busy}>+ {connectionPending ? <RefreshCw size={16} className="motion-safe:animate-spin" /> : <SlidersHorizontal size={16} />}+ {t('onboarding.setup.configureRoute')}+ </button>+ ) : null}+ </div>+ {/* A failed pick belongs to the offer it was made from. */}+ {unset && failure && <div className="onboarding-assistant-error" role="alert">+ {t(unconfirmed ? 'onboarding.setup.modelPickFailed' : 'onboarding.setup.suppliersChanged')}+ {unconfirmed && onRetryChoice && <Button variant="link" size="xs" disabled={busy} onClick={onRetryChoice}>{t('common.retry')}</Button>}+ </div>}+ {connectionError && <div className="onboarding-assistant-error" role="alert">+ {connectionError}+ {onRefreshConnection && <Button variant="link" size="xs" onClick={onRefreshConnection}>{t('common.retry')}</Button>}+ </div>}+ {routeError && <div className="onboarding-assistant-error" role="alert">+ {routeError}+ {onRetryRoute && <Button variant="link" size="xs" onClick={onRetryRoute}>{t('common.retry')}</Button>}+ </div>}+ </div>+ </Card>+ );+}diff --git a/ui/src/components/onboarding/CollaborationStory.tsx b/ui/src/components/onboarding/CollaborationStory.tsxindex 45bd6ef35..2a7a9721f 100644--- a/ui/src/components/onboarding/CollaborationStory.tsx+++ b/ui/src/components/onboarding/CollaborationStory.tsx@@ -1,39 +1,43 @@import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';-import { Check, CodeXml, FileText, ListChecks } from 'lucide-react';+import { ArrowRight, Check, CodeXml, ListChecks, ScanEye, Split, type LucideIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';import { getBackendUiMeta } from '@/lib/agentBackends';import { BackendIcon } from '../visual';import { Card } from '../ui/card';-import { ASSISTANT_ORDER, WORK_LINES, collaborationFrame } from './collaborationTimeline';+import { ASSISTANT_ORDER, RETURN_WIRE, SETUP_LINEUP, WORK_LINES, collaborationFrame } from './collaborationTimeline';import { useOnboardingMotion } from './motion';/**- * Handoff geometry in the 976x350 wire box, which the stylesheet sizes at the card's- * height times 350/300 — the reference's own proportion (271 around 232, 306 around- * 262, 385 around 330 all read that way). Taking the box's height from the card and- * putting the handoffs at y=150 of 350 is what keeps them on the cards' shared- * midline at every tier rather than only at the authored one. The x coordinates are- * the card tracks' own edges in 976 space, so the stretched viewBox keeps every port- * on a card edge at every width. The return loop is not in this box: see `ReturnWire`.+ * Handoff geometry in the 1040x350 wire box, which the stylesheet sizes at the card's+ * height times 350/300 — the reference's own proportion. Taking the box's height+ * from the card and putting the handoffs at y=150 of 350 is what keeps them on the+ * cards' shared midline at every tier rather than only at the authored one. The x+ * coordinates are the card tracks' own edges in 1040 space — 242-wide cards with 24+ * between them, which is `--ob-track-gap` in onboarding.css — so the stretched viewBox+ * keeps every port on a card edge at every width, for however many cards the lineup+ * holds. The return loop is not in this box: see `ReturnWire`.*/-const WIRES = ['M299 150H339', 'M637 150H677'];-/** The wire index the timeline gives the return from the third card to the first. */-const RETURN_WIRE = 2;-/** The return loop's legs and corner radius, in the same 976 space as the handoffs. */-const RETURN_LEGS = { from: 826, to: 149, radius: 16 };-/** Only the four handoff ends are drawn: the return loop leaves its cards unmarked. */-const PORTS: [number, number][] = [[299, 150], [339, 150], [637, 150], [677, 150]];-const ICONS = [FileText, CodeXml, ListChecks];-// Every skeleton line as its share of the block it is measured in, so the three cards-// draw the widths design_desktop.pen draws at any scale. The card's content box is 198-// wide; a document line is a share of that, a test line too (the checkbox and its gap-// are laid beside it, not out of it), and a code line is a share of the bar column that-// starts after the line number — which is why those two sets have different bases.-const DOCUMENT_BARS = [55.1, 94.9, 79.3, 36.9, 89.4, 65.7];-const CODE_INDENT = [0, 10, 20, 20, 10, 0];-const CODE_BARS: [number, number][] = [[24.3, 30.4], [18.1, 43.3], [29.2, 23], [21.7, 33.5], [31.6, 14.6], [14.4, 0]];-const TEST_BARS = [73.2, 61.6, 82.3, 54.5];+const BOX = 1040;+const GAP = 24;+const TRACK = (BOX - GAP * (SETUP_LINEUP.length - 1)) / SETUP_LINEUP.length;+const left = (index: number) => index * (TRACK + GAP);+const right = (index: number) => left(index) + TRACK;+const middle = (index: number) => left(index) + TRACK / 2;+const WIRES = SETUP_LINEUP.slice(1).map((_, index) => `M${right(index)} 150H${left(index + 1)}`);+/** The return loop's legs and corner radius, in the same 1040 space as the handoffs. */+const RETURN_LEGS = { from: middle(SETUP_LINEUP.length - 1), to: middle(0), radius: 16 };+/** Only the handoff ends are drawn: the return loop leaves its cards unmarked. */+const PORTS: [number, number][] = SETUP_LINEUP.slice(1).flatMap((_, index) => [[right(index), 150], [left(index + 1), 150]]);+type StoryWork = 'handoffs' | 'code' | 'review' | 'tests';+/** What each assistant is shown doing: the coordinator hands the work out, then it is+ * built, reviewed and tested. A backend the story has no part for draws nothing. */+const STORY: Partial<Record<string, { icon: LucideIcon; work: StoryWork }>> = {+ vibey: { icon: Split, work: 'handoffs' },+ claude: { icon: CodeXml, work: 'code' },+ codex: { icon: ScanEye, work: 'review' },+ opencode: { icon: ListChecks, work: 'tests' },+};function Bar({ width, tone, revealed }: { width: number; tone?: string; revealed?: boolean }) {const reveal = revealed === undefined ? '': `onboarding-write-line ${revealed ? 'onboarding-write-visible' : ''}`;@@ -63,34 +67,57 @@ function WorkStatus({ active, done, progress }: { active: boolean; done: boolean);}-function Skeleton({ backend, done, written }: { backend: string; done: boolean; written: number }) {- if (backend === 'claude') {- return (- <div className="onboarding-skeleton onboarding-skeleton-document">- <Bar width={DOCUMENT_BARS[0]} tone="onboarding-bar-heading" revealed={written > 0} />- <Bar width={DOCUMENT_BARS[1]} revealed={written > 1} />- <Bar width={DOCUMENT_BARS[2]} revealed={written > 2} />- <div className="onboarding-skeleton-paragraph">- <Bar width={DOCUMENT_BARS[3]} tone="onboarding-bar-subheading" revealed={written > 3} />- <Bar width={DOCUMENT_BARS[4]} revealed={written > 4} />- <Bar width={DOCUMENT_BARS[5]} revealed={written > 5} />+// Every skeleton line as its share of the block it is measured in, so the cards draw+// the widths design_desktop.pen draws at any scale. A code line is a share of the bar+// column that starts after the line number, a test line a share of the content box+// (the checkbox and its gap are laid beside it, not out of it).+const CODE_INDENT = [0, 10, 20, 20, 10, 0];+const CODE_BARS: [number, number][] = [[24.3, 30.4], [18.1, 43.3], [29.2, 23], [21.7, 33.5], [31.6, 14.6], [14.4, 0]];+/** The review reads a diff: the second line removed, the two after it added. */+const REVIEW_DIFF: Partial<Record<number, 'removed' | 'added'>> = { 1: 'removed', 2: 'added', 3: 'added' };+const TEST_BARS = [73.2, 61.6, 82.3, 54.5];++function CodeRows({ written, diff }: { written: number; diff?: typeof REVIEW_DIFF }) {+ return (+ <>+ {CODE_BARS.map(([first, second], line) => (+ <div key={line} data-diff={diff?.[line]}+ className={`onboarding-code-row onboarding-write-line ${written > line ? 'onboarding-write-visible' : ''}`}>+ <span className="onboarding-code-number">{line + 1}</span>+ {/* The indent is geometry, not type, so it scales with the diagram. */}+ <div className="onboarding-code-bars" style={{ paddingLeft: `calc(${CODE_INDENT[line]} * var(--ob-u))` }}>+ <Bar width={first} tone={line % 2 ? 'onboarding-bar-violet' : 'onboarding-bar-cyan'} />+ <Bar width={second} />+ </div></div>+ ))}+ </>+ );+}++function Skeleton({ work, active, done, written }: { work: StoryWork; active: boolean; done: boolean; written: number }) {+ const { t } = useTranslation();+ if (work === 'handoffs') {+ // One row per assistant the coordinator hands a part to, revealed as it plans.+ return (+ <div className="onboarding-skeleton onboarding-skeleton-handoffs">+ {ASSISTANT_ORDER.map((backend, index) => (+ <div key={backend} className={`onboarding-handoff-row onboarding-write-line ${written > index * 2 ? 'onboarding-write-visible' : ''}`}>+ <span className="onboarding-handoff-step">{t(`onboarding.story.${backend}.step`)}</span>+ <ArrowRight size={12} strokeWidth={1.8} className="onboarding-handoff-arrow" />+ <span className="onboarding-handoff-name">{getBackendUiMeta(backend).label}</span>+ </div>+ ))}</div>);}- if (backend === 'codex') {+ if (work === 'code' || work === 'review') {return (- <div className="onboarding-skeleton onboarding-skeleton-code">- {CODE_BARS.map(([first, second], line) => (- <div key={line} className={`onboarding-code-row onboarding-write-line ${written > line ? 'onboarding-write-visible' : ''}`}>- <span className="onboarding-code-number">{line + 1}</span>- {/* The indent is geometry, not type, so it scales with the diagram. */}- <div className="onboarding-code-bars" style={{ paddingLeft: `calc(${CODE_INDENT[line]} * var(--ob-u))` }}>- <Bar width={first} tone={line % 2 ? 'onboarding-bar-violet' : 'onboarding-bar-cyan'} />- <Bar width={second} />- </div>- </div>- ))}+ <div className={`onboarding-skeleton onboarding-skeleton-code ${work === 'review' ? 'onboarding-skeleton-review' : ''}`}>+ {/* The reviewer is handed finished code: it arrives whole with the work, and the+ sweep across it is the review. */}+ <CodeRows written={work === 'review' ? (active || done ? WORK_LINES : 0) : written}+ diff={work === 'review' ? REVIEW_DIFF : undefined} /></div>);}@@ -130,7 +157,7 @@ function Glow({ id }: { id: string }) {function Circuit({ handoff }: { handoff: Handoff }) {const glowId = useId();return (- <svg className="onboarding-wires" viewBox="0 0 976 350" fill="none" preserveAspectRatio="none" aria-hidden="true">+ <svg className="onboarding-wires" viewBox={`0 0 ${BOX} 350`} fill="none" preserveAspectRatio="none" aria-hidden="true"><Glow id={glowId} />{WIRES.map((d, index) => (<g key={d}>@@ -148,7 +175,7 @@ function Circuit({ handoff }: { handoff: Handoff }) {* cards' floor down to the line the other setup screens set their summary on, which is* the stage's floor rather than the diagram's — so its height is whatever the window* leaves, and a stretched viewBox would bend the corners differently at every size.- * The path is drawn in the box's own pixels instead: the legs keep their 976-space+ * The path is drawn in the box's own pixels instead: the legs keep their 1040-space* tracks and the corners stay round.*/function ReturnWire({ handoff, returning, caption }: { handoff: Handoff; returning: boolean; caption: string }) {@@ -169,7 +196,7 @@ function ReturnWire({ handoff, returning, caption }: { handoff: Handoff; returnireturn () => observer.disconnect();}, []);const { width, height } = size;- const scale = width / 976;+ const scale = width / BOX;const from = RETURN_LEGS.from * scale;const to = RETURN_LEGS.to * scale;const radius = Math.min(RETURN_LEGS.radius * scale, height);@@ -217,33 +244,39 @@ export function CollaborationStory({ active = true }: { active?: boolean }) {data-motion={running ? 'running' : 'paused'}><Circuit handoff={frame.handoff} /><div className="onboarding-collaboration-cards">- {ASSISTANT_ORDER.map((backend, index) => {+ {SETUP_LINEUP.map((backend, index) => {const done = frame.done[index];const active = frame.active === index;const state = done ? 'complete' : active ? 'working' : 'waiting';const summary = index === 0 && frame.summary;- const caption = summary ? t('onboarding.story.claude.summary')- : t(`onboarding.story.${backend}.${done ? 'complete' : 'working'}`);- const Icon = ICONS[index];+ const handedOff = { count: ASSISTANT_ORDER.length };+ const caption = summary ? t('onboarding.story.summary')+ : t(`onboarding.story.${backend}.${done ? 'complete' : 'working'}`, handedOff);+ const part = STORY[backend];+ const Icon = part?.icon;return (<Card key={backend} className="onboarding-collaboration-card" data-active={active}- data-state={state} aria-label={getBackendUiMeta(backend).label}>+ data-state={state} data-backend={backend} aria-label={getBackendUiMeta(backend).label}>{/* The same identity header the connection step wears, in the same- place: logo, name, and the trailing slot this step fills with the- assistant's role and the next one with its enable switch. */}+ place: logo, then the name — with the assistant's role under it+ here, and the next step's enable switch beside it there. Four+ cards leave no room for a name and a role on one line. */}<div className="onboarding-card-identity"><span className="onboarding-card-logo"><BackendIcon backend={backend} size={28} variant="brand" aria-hidden="true" /></span>- <strong className="onboarding-card-name">{getBackendUiMeta(backend).label}</strong>- <span className="onboarding-card-role">{t(`onboarding.story.${backend}.role`)}</span>+ <span className="onboarding-card-title">+ <strong className="onboarding-card-name">{getBackendUiMeta(backend).label}</strong>+ <span className="onboarding-card-role">{t(`onboarding.story.${backend}.role`)}</span>+ </span></div><div className="onboarding-story-status" aria-hidden="true">- <Icon size={13} strokeWidth={1.7} className="onboarding-status-icon" />+ {Icon && <Icon size={13} strokeWidth={1.7} className="onboarding-status-icon" />}<span key={caption} className="onboarding-status-text onboarding-status-enter">{caption}</span><WorkStatus active={active} done={done} progress={frame.progress[index]} /></div>- <Skeleton backend={backend} done={done} written={reducedMotion ? WORK_LINES : frame.written[index]} />+ {part && <Skeleton work={part.work} active={active} done={done}+ written={reducedMotion ? WORK_LINES : frame.written[index]} />}</Card>);})}diff --git a/ui/src/components/onboarding/Welcome.test.tsx b/ui/src/components/onboarding/Welcome.test.tsxindex 6086185dc..79cded6af 100644--- a/ui/src/components/onboarding/Welcome.test.tsx+++ b/ui/src/components/onboarding/Welcome.test.tsx@@ -10,7 +10,7 @@ import { useRef, useState, type ComponentProps } from 'react';import { useTranslation } from 'react-i18next';import { SETUP_SCREENS, type SetupAction, type SetupScreenHandle } from './setupFlow';import { SETUP_REGISTERED_SCREENS } from './setupScreenRegistry';-import { ASSISTANT_ORDER } from './collaborationTimeline';+import { ASSISTANT_ORDER, SETUP_LINEUP } from './collaborationTimeline';import { RouteSurfaceActiveContext } from '@/lib/routeSurfaceActivity';import { CollaborationStory } from './CollaborationStory';import { AccessTiles } from './AccessTiles';@@ -238,7 +238,7 @@ describe('collaboration lifecycle and access interaction', () => {it('shows completed work and stops all timers for reduced motion', () => {vi.useFakeTimers(); mocks.reduced = true;const { container } = render(wrap(<Intro onNext={vi.fn()} />));- expect(container.querySelectorAll('[data-state="complete"]')).toHaveLength(3);+ expect(container.querySelectorAll('[data-state="complete"]')).toHaveLength(SETUP_LINEUP.length);expect(screen.queryByTestId('handoff-pulse')).toBeNull();// Get started is the only button on the screen.expect(screen.getAllByRole('button').map((node) => node.textContent?.trim())).toEqual(['Get started']);diff --git a/ui/src/components/onboarding/builtinModelOffer.ts b/ui/src/components/onboarding/builtinModelOffer.tsnew file mode 100644index 000000000..7c416d9b7--- /dev/null+++ b/ui/src/components/onboarding/builtinModelOffer.ts@@ -0,0 +1,23 @@+import { pickerGroups } from '../settings/models/backendCatalog';+import type { BackendModelCandidates, ModelCandidate } from '../settings/models/types';++/** The candidates read behind a built-in card that has no model yet. */+export type BuiltinModelOffer =+ | { kind: 'loading' }+ | { kind: 'failed' }+ | { kind: 'ready'; read: BackendModelCandidates };++/** How many candidates the card offers inline; the rest are behind "All models…". */+export const INLINE_CANDIDATES = 3;++/**+ * The candidates worth offering on the card, in the picker's own order: the ones+ * already in the backend's list, then its built-in and provider candidates. A candidate+ * nothing supplies would start an empty route, so only the dialog offers those.+ */+export const inlineCandidates = (read: BackendModelCandidates): ModelCandidate[] => {+ const groups = pickerGroups(read, new Set(read.in_list.map((candidate) => candidate.id)));+ return [...groups.listed, ...groups.builtin, ...groups.providers]+ .filter((candidate) => candidate.suppliers.length > 0)+ .slice(0, INLINE_CANDIDATES);+};diff --git a/ui/src/components/onboarding/collaborationTimeline.test.ts b/ui/src/components/onboarding/collaborationTimeline.test.tsindex c73fb5c42..aab82a9da 100644--- a/ui/src/components/onboarding/collaborationTimeline.test.ts+++ b/ui/src/components/onboarding/collaborationTimeline.test.ts@@ -1,9 +1,19 @@import { describe, expect, it } from 'vitest';-import { COLLABORATION_DURATION, WORK_LINES, collaborationFrame } from './collaborationTimeline';+import {+ COLLABORATION_DURATION, RETURN_WIRE, SETUP_LINEUP, WORK_LINES, collaborationFrame,+} from './collaborationTimeline';++const all = <T,>(value: T) => SETUP_LINEUP.map(() => value);describe('one collaboration clock', () => {+ it('stands the built-in coordinator before the assistants it hands work to', () => {+ expect(SETUP_LINEUP).toEqual(['vibey', 'claude', 'codex', 'opencode']);+ expect(RETURN_WIRE).toBe(3);+ });it('keeps the source active until each pulse arrives', () => {- for (const [start, end, source, destination, wire] of [[1500, 2250, 0, 1, 0], [3750, 4500, 1, 2, 1]]) {+ for (const [start, end, source, destination, wire] of [+ [1500, 2250, 0, 1, 0], [3750, 4500, 1, 2, 1], [6000, 6750, 2, 3, 2],+ ]) {expect(collaborationFrame(start)).toMatchObject({ active: source, handoff: { wire, progress: 0 } });expect(collaborationFrame(end - 1).active).toBe(source);expect(collaborationFrame(end)).toMatchObject({ active: destination, handoff: null });@@ -13,34 +23,34 @@ describe('one collaboration clock', () => {it('travels one wire at a time and shows no pulse while a card works', () => {expect(collaborationFrame(2600).handoff).toBeNull();expect(collaborationFrame(1875).handoff).toEqual({ wire: 0, progress: 0.5 });- expect(collaborationFrame(6500).handoff).toEqual({ wire: 2, progress: 0.5 });+ expect(collaborationFrame(8750).handoff).toEqual({ wire: RETURN_WIRE, progress: 0.5 });});it('writes the skeleton line by line before the card reports complete', () => {expect(collaborationFrame(2250).written[1]).toBe(0);expect(collaborationFrame(2400).written[1]).toBe(2);expect(collaborationFrame(2900).written[1]).toBe(WORK_LINES);expect(collaborationFrame(2900).done[1]).toBe(false);- expect(collaborationFrame(3100)).toMatchObject({ active: 1, done: [true, true, false] });+ expect(collaborationFrame(3100)).toMatchObject({ active: 1, done: [true, true, false, false] });});- it('keeps finished work on screen while the result returns to the PM', () => {- expect(collaborationFrame(6500)).toMatchObject({ done: [true, true, true], written: [WORK_LINES, WORK_LINES, WORK_LINES], returning: true, summary: false });- expect(collaborationFrame(8500)).toMatchObject({ active: 0, progress: [1, 1, 1], written: [WORK_LINES, WORK_LINES, WORK_LINES], summary: true, returning: true });+ it('keeps finished work on screen while the result returns to the coordinator', () => {+ expect(collaborationFrame(8750)).toMatchObject({ done: all(true), written: all(WORK_LINES), returning: true, summary: false });+ expect(collaborationFrame(10000)).toMatchObject({ active: 0, progress: all(1), written: all(WORK_LINES), summary: true, returning: true });});it('finishes each card inside its own step and repeats the entire story together', () => {expect(collaborationFrame(1500).progress[0]).toBe(1);expect(collaborationFrame(3750).progress[1]).toBe(1);- expect(collaborationFrame(6000).progress).toEqual([1, 1, 1]);- expect(COLLABORATION_DURATION).toBe(8900);- expect(collaborationFrame(8900)).toEqual(collaborationFrame(0));+ expect(collaborationFrame(8250).progress).toEqual(all(1));+ expect(COLLABORATION_DURATION).toBe(11150);+ expect(collaborationFrame(11150)).toEqual(collaborationFrame(0));});it('shows the completed collaboration with no pulse in reduced motion', () => {- for (const elapsed of [0, 1750, 4000, 6500, 8900]) {+ for (const elapsed of [0, 1750, 4000, 8750, 11150]) {expect(collaborationFrame(elapsed, true)).toEqual({active: 0,handoff: null,- progress: [1, 1, 1],- done: [true, true, true],- written: [WORK_LINES, WORK_LINES, WORK_LINES],+ progress: all(1),+ done: all(true),+ written: all(WORK_LINES),summary: true,returning: true,});diff --git a/ui/src/components/onboarding/collaborationTimeline.ts b/ui/src/components/onboarding/collaborationTimeline.tsindex 5459a70a6..984ea1855 100644--- a/ui/src/components/onboarding/collaborationTimeline.ts+++ b/ui/src/components/onboarding/collaborationTimeline.ts@@ -1,23 +1,43 @@-import { NATIVE_SETUP_BACKENDS, type NativeCliBackend } from '@/lib/agentBackends';+import {+ BUILTIN_BACKENDS, NATIVE_SETUP_BACKENDS, type AgentBackendId, type NativeCliBackend,+} from '@/lib/agentBackends';+/** The CLI assistants setup detects, installs and enables, in C6's order. */export const ASSISTANT_ORDER = NATIVE_SETUP_BACKENDS;export type AssistantId = NativeCliBackend;+/**+ * Every assistant setup draws a card for, in the order the cards stand: the built-in+ * coordinator first, then the CLI assistants it hands the work to. The intro, the+ * provider destinations and the assistants screen are one row of these, so the count+ * is read from here and never restated.+ */+export const SETUP_LINEUP: readonly AgentBackendId[] = [...BUILTIN_BACKENDS, ...ASSISTANT_ORDER];++const WORK = 1500;+const HANDOFF = 750;+const RETURN = 1000;+const SUMMARY = 1900;+/*** The authored relay from the approved Welcome design: each assistant works for- * 1500ms, each handoff travels its wire, and the closing summary returns to the PM.- * A step keeps its SOURCE active while the pulse is in transit; the destination- * only activates once the pulse lands.+ * 1500ms, each handoff travels its wire, and the closing summary returns to the+ * coordinator. A step keeps its SOURCE active while the pulse is in transit; the+ * destination only activates once the pulse lands. The last card's wire is the return.*/-const RELAY = [- { id: 'claude', active: 0, duration: 1500 },- { id: 'to-codex', active: 0, duration: 750, wire: 0 },- { id: 'codex', active: 1, duration: 1500 },- { id: 'to-opencode', active: 1, duration: 750, wire: 1 },- { id: 'opencode', active: 2, duration: 1500 },- { id: 'to-claude', active: 2, duration: 1000, wire: 2 },- { id: 'summary', active: 0, duration: 1900 },-] as const;+type RelayStep = { id: string; active: number; duration: number; wire?: number };+const RELAY: RelayStep[] = [+ ...SETUP_LINEUP.flatMap((id, index): RelayStep[] => [+ { id, active: index, duration: WORK },+ index < SETUP_LINEUP.length - 1+ ? { id: `to-${SETUP_LINEUP[index + 1]}`, active: index, duration: HANDOFF, wire: index }+ : { id: 'return', active: index, duration: RETURN, wire: index },+ ]),+ { id: 'summary', active: 0, duration: SUMMARY },+];++/** The wire index the timeline gives the return from the last card to the first. */+export const RETURN_WIRE = SETUP_LINEUP.length - 1;export const COLLABORATION_STEPS = RELAY.map((step, index) => {const start = RELAY.slice(0, index).reduce((total, previous) => total + previous.duration, 0);@@ -29,7 +49,7 @@ export const COLLABORATION_DURATION = COLLABORATION_STEPS[COLLABORATION_STEPS.leexport const WORK_CONTENT_DURATION = 850;/** Both the document and the code skeleton reveal six lines, 110ms apart. */export const WORK_LINES = 6;-const WORK_STARTS = ASSISTANT_ORDER.map((_, index) => COLLABORATION_STEPS[index * 2].start);+const WORK_STARTS = SETUP_LINEUP.map((_, index) => COLLABORATION_STEPS[index * 2].start);const clamp = (value: number) => Math.max(0, Math.min(1, value));@@ -44,9 +64,9 @@ export interface CollaborationFrame {done: boolean[];/** Revealed skeleton lines per card. */written: number[];- /** The closing phase, where the PM summarizes instead of restating its own work. */+ /** The closing phase, where the coordinator summarizes instead of restating its own work. */summary: boolean;- /** True while the result is travelling back to, or being summarized by, the PM. */+ /** True while the result is travelling back to, or being summarized by, the coordinator. */returning: boolean;}@@ -59,7 +79,7 @@ export function collaborationFrame(elapsed: number, reducedMotion = false): Collconst done = worked.map((value) => reducedMotion || value >= WORK_CONTENT_DURATION);return {active: step.active,- handoff: 'wire' in step && !reducedMotion+ handoff: step.wire !== undefined && !reducedMotion? { wire: step.wire, progress: clamp((time - step.start) / step.duration) }: null,progress: worked.map((value, index) => (done[index] ? 1 : clamp(value / WORK_CONTENT_DURATION))),@@ -68,6 +88,6 @@ export function collaborationFrame(elapsed: number, reducedMotion = false): Coll: step.active === index ? Math.max(0, Math.min(WORK_LINES, Math.floor((value - 40) / 110) + 1)): 0)),summary: step.id === 'summary',- returning: step.id === 'to-claude' || step.id === 'summary',+ returning: step.id === 'return' || step.id === 'summary',};}diff --git a/ui/src/components/onboarding/entryGate.test.ts b/ui/src/components/onboarding/entryGate.test.tsindex 7901d6896..9ee183787 100644--- a/ui/src/components/onboarding/entryGate.test.ts+++ b/ui/src/components/onboarding/entryGate.test.ts@@ -3,13 +3,15 @@ import type { BackendConnectionState, VibeAgentBrief } from '../../context/ApiCoimport { CONTRACT_VERSION, type AgentSupply, type RuntimeDependency } from '../settings/models/types';import {admitEntry,+ chooseEntryDefault,configuredCliPath,entryCandidates,readEntryEvidence,type EntryEvidence,type EntryGateDeps,} from './entryGate';-import type { AssistantId } from './collaborationTimeline';+import type { AgentBackendId } from '@/lib/agentBackends';+import { SETUP_LINEUP } from './collaborationTimeline';const RUNTIME_OK: RuntimeDependency = {contract_version: CONTRACT_VERSION,@@ -30,7 +32,7 @@ const claudeSupply = (overrides: Partial<AgentSupply> = {}): AgentSupply => ({});const connection = (- backend: AssistantId,+ backend: AgentBackendId,overrides: Partial<BackendConnectionState> = {},): BackendConnectionState => ({ok: true, backend, enabled: true, installed: true, auth: 'none', ready: false,@@ -76,7 +78,7 @@ describe('B2 stopped recovery independent of IPC', () => {expect(read).not.toBeNull();expect(read!.suppliesRead).toBe(false);expect(read!.runtime).toBeNull();- expect(read!.connections).toHaveLength(3);+ expect(read!.connections).toHaveLength(SETUP_LINEUP.length);expect(admitEntry(read!)).toMatchObject({ kind: 'refused', startable: true });expect(entryCandidates(read!)).toEqual([]);});@@ -175,3 +177,73 @@ describe('C4 configured-path CLI evidence', () => {expect(await readEntryEvidence(gate, { config: { agents: { claude: { cli_path: '/opt/custom/claude' } } } })).toBeNull();});});++describe('D3 a built-in assistant completes setup on its own', () => {+ const VIBEY: VibeAgentBrief = { ...CLAUDE, id: 'vb-1', name: 'vibey', backend: 'vibey', display_name: 'vibey' };+ const vibeySupply = (overrides: Partial<AgentSupply> = {}): AgentSupply => ({+ backend: 'vibey', cli_present: false, mode: 'hub', menu_kind: 'fixed',+ named_agents: [{ name: 'vibey', effective_model_id: 'gpt-5.6-sol', supply_status: 'ok' }],+ ...overrides,+ });+ const applied = (backend: AgentBackendId) => connection(backend, { ready: true, entry_eligible: true, application: 'applied' });+ const vibeyOnly = (overrides: Partial<EntryEvidence> = {}) => evidence({+ agents: [CLAUDE, VIBEY],+ connections: [applied('vibey')],+ supplies: [vibeySupply()],+ cliFound: { claude: false, codex: false, opencode: false },+ ...overrides,+ });++ it('admits the built-in Agent with no CLI on disk', () => {+ expect(entryCandidates(vibeyOnly())).toEqual([{ agent: VIBEY, backend: 'vibey', modelId: 'gpt-5.6-sol' }]);+ expect(admitEntry(vibeyOnly())).toMatchObject({ kind: 'admitted' });+ });++ it('still needs its applied connection and a runnable route', () => {+ expect(entryCandidates(vibeyOnly({ connections: [connection('vibey', { ready: false, entry_eligible: true, application: 'applied' })] }))).toEqual([]);+ expect(entryCandidates(vibeyOnly({ supplies: [vibeySupply({ named_agents: [{ name: 'vibey', effective_model_id: null, supply_status: null }] })] }))).toEqual([]);+ expect(entryCandidates(vibeyOnly({ supplies: [vibeySupply({ named_agents: [{ name: 'vibey', effective_model_id: 'gpt-5.6-sol', supply_status: 'interrupted' }] })] }))).toEqual([]);+ });++ it('reads the built-in connection with the others and detects only CLIs', async () => {+ const getBackendConnection = vi.fn(async (backend: AgentBackendId) => applied(backend));+ const detectCli = vi.fn(async (binary: string) => ({ found: true, path: binary }));+ await readEntryEvidence(deps({ getBackendConnection, detectCli }));+ expect(getBackendConnection.mock.calls.map(([backend]) => backend).sort()).toEqual([...SETUP_LINEUP].sort());+ expect(detectCli.mock.calls.map(([binary]) => binary)).not.toContain('vibey');+ });++ it('ranks the built-in assistant last, so a runnable CLI assistant stays the default', () => {+ const both = evidence({+ agents: [CLAUDE, VIBEY],+ connections: [applied('claude'), applied('vibey')],+ supplies: [claudeSupply(), vibeySupply()],+ targets: [VIBEY, CLAUDE],+ });+ expect(entryCandidates(both).map((candidate) => candidate.backend)).toEqual(['claude', 'vibey']);+ expect(chooseEntryDefault(entryCandidates(both), both)?.agent.name).toBe('claude-agent');+ const alone = vibeyOnly({ targets: [VIBEY], defaultAgentName: 'claude-agent' });+ expect(chooseEntryDefault(entryCandidates(alone), alone)?.agent.name).toBe('vibey');+ });++ it('prefers a runnable custom CLI Agent over the built-in one, whose own Agent is a target', () => {+ // Claude Code's own Agent cannot run; a custom Agent on it can, and so can Vibey's own.+ const custom = evidence({+ agents: [CLAUDE, VIBEY],+ connections: [applied('claude'), applied('vibey')],+ supplies: [claudeSupply(), vibeySupply()],+ targets: [VIBEY, { ...CLAUDE, name: 'claude' }],+ });+ expect(chooseEntryDefault(entryCandidates(custom), custom)?.agent.name).toBe('claude-agent');+ });++ it('keeps a saved built-in default that can run', () => {+ const saved = evidence({+ agents: [CLAUDE, VIBEY],+ connections: [applied('claude'), applied('vibey')],+ supplies: [claudeSupply(), vibeySupply()],+ defaultAgentName: 'vibey',+ });+ expect(chooseEntryDefault(entryCandidates(saved), saved)).toBeNull();+ });+});diff --git a/ui/src/components/onboarding/entryGate.ts b/ui/src/components/onboarding/entryGate.tsindex f3ebfd8cf..43ef2b73f 100644--- a/ui/src/components/onboarding/entryGate.ts+++ b/ui/src/components/onboarding/entryGate.ts@@ -2,6 +2,7 @@ import type { BackendConnectionState, VibeAgentBrief, VibeAgentFull } from '../.import type { CollectionReadAuthority } from '../settings/models/collectionReadAuthority';import { runtimeIsRunning } from '../settings/models/runtimeLifecycle';import type { AgentSupply, RuntimeDependency, SupplyStatus } from '../settings/models/types';+import { BUILTIN_BACKENDS, isBuiltinBackend, type AgentBackendId } from '@/lib/agentBackends';import { ASSISTANT_ORDER, type AssistantId } from './collaborationTimeline';import { readSetupTargets } from './setupTargets';@@ -23,10 +24,18 @@ import { readSetupTargets } from './setupTargets';/** One named Agent that satisfies the gate, with the model the server resolved for it. */export type EntryCandidate = {agent: VibeAgentBrief;- backend: AssistantId;+ backend: AgentBackendId;modelId: string;};+/**+ * The order the gate offers candidates in, which is the order setup picks a default+ * from: the CLI assistants first and a built-in backend last. That is the server's+ * `implicit_default_rank` — making the built-in assistant the default is its own+ * decision, so setup only falls back to it when no CLI assistant can run (D3).+ */+const ENTRY_ORDER: readonly AgentBackendId[] = [...ASSISTANT_ORDER, ...BUILTIN_BACKENDS];+export type EntryEvidence = {/** False when the Agent listing itself failed. An empty list and an unread list are* different facts, and only one of them is something the person can act on. */@@ -88,20 +97,25 @@ export function configuredCliPath(config: Record<string, unknown> | undefined, b* `getBackendConnection.enabled`. A failed detector, a not-found binary, or a stale* refresh cannot be replaced by the connection's own installed bit.*+ * A built-in backend has no CLI to be on disk (D3): it is part of the platform, so+ * its applied connection and the runnable route below are the whole of its gate.+ ** `ready` carries permission and credential ownership; `applied` is the only* application state that means the configuration is live. A confirmed `stopped` is* something to recover from, never something to enter on.*/const backendUsable = (+ backend: AgentBackendId,connection: BackendConnectionState | undefined,supply: AgentSupply | undefined,- cliFound: boolean,+ cliFound: Readonly<Record<AssistantId, boolean>>,): boolean =>connection !== undefined && connection.ok&& connection.enabled&& connection.ready && connection.application === 'applied'- && supply !== undefined && supply.cli_present === true- && cliFound;+ && supply !== undefined+ && (isBuiltinBackend(backend)+ || (supply.cli_present === true && cliFound[backend as AssistantId] === true));/*** Whether the server can route THIS named Agent to a model right now.@@ -111,7 +125,7 @@ const backendUsable = (* another's. The runnable-hop owner is the server resolver, and its per-Agent answer* is the `named_agents` row — an absent row is a backend that never routed this name.*/-const routeRunnable = (supply: AgentSupply | undefined, name: string): string | null => {+export const routeRunnable = (supply: AgentSupply | undefined, name: string): string | null => {if (!supply || supply.mode !== 'hub') return null;const row = supply.named_agents?.find((named) => named.name === name);if (!row || row.route_reason === 'route_unconfigured') return null;@@ -119,7 +133,7 @@ const routeRunnable = (supply: AgentSupply | undefined, name: string): string |return row.effective_model_id;};-/** Every Agent that passes the whole gate, in C6's backend order and then by name. */+/** Every Agent that passes the whole gate, in `ENTRY_ORDER` and then by name. */export function entryCandidates(evidence: EntryEvidence): EntryCandidate[] {// Mode alone is not runtime readiness: a backend can be in hub mode while the Hub// that would serve it is down, and then no route on this machine is runnable.@@ -127,8 +141,8 @@ export function entryCandidates(evidence: EntryEvidence): EntryCandidate[] {if (!evidence.runtime || !runtimeIsRunning(evidence.runtime) || !evidence.suppliesRead) return [];const connectionOf = new Map(evidence.connections.map((connection) => [connection.backend, connection]));const supplyOf = new Map(evidence.supplies.map((supply) => [supply.backend, supply]));- return ASSISTANT_ORDER.flatMap((backend) => {- if (!backendUsable(connectionOf.get(backend), supplyOf.get(backend), evidence.cliFound[backend] === true)) return [];+ return ENTRY_ORDER.flatMap((backend) => {+ if (!backendUsable(backend, connectionOf.get(backend), supplyOf.get(backend), evidence.cliFound)) return [];return evidence.agents.filter((agent) => agent.backend === backend && usableAgent(agent)).flatMap((agent) => {@@ -172,20 +186,27 @@ export function admitEntry(evidence: EntryEvidence): EntryAdmission {* Agent no card represents — setup is finishing a machine, not imposing its own* preference on one. Only when the saved name cannot run does setup pick, and then it* prefers the assistant's own Agent so the first workspace turn matches the card the- * person was just looking at.+ * person was just looking at. That preference applies within the first rank that can run+ * — the CLI assistants before the built-in backend, as `ENTRY_ORDER` ranks them — so any+ * runnable CLI assistant's Agent, its own or a custom one, wins over the built-in one.*/export function chooseEntryDefault(candidates: readonly EntryCandidate[],evidence: EntryEvidence,): EntryCandidate | null {if (candidates.some((candidate) => candidate.agent.name === evidence.defaultAgentName)) return null;+ // The preference for an assistant's own Agent applies within the first rank that can+ // run: a runnable CLI assistant's custom Agent still wins over the built-in one.+ const rank = (candidate: EntryCandidate) => (isBuiltinBackend(candidate.backend) ? 1 : 0);+ const best = Math.min(...candidates.map(rank));+ const pool = candidates.filter((candidate) => rank(candidate) === best);const targets = evidence.targets.map((target) => target.name);- return candidates.find((candidate) => targets.includes(candidate.agent.name)) ?? candidates[0] ?? null;+ return pool.find((candidate) => targets.includes(candidate.agent.name)) ?? pool[0] ?? null;}export type EntryGateDeps = {listAgents: () => Promise<{ ok: boolean; agents: VibeAgentBrief[]; default_agent_name: string | null }>;- getBackendConnection: (backend: AssistantId) => Promise<BackendConnectionState>;+ getBackendConnection: (backend: AgentBackendId) => Promise<BackendConnectionState>;agentReads: CollectionReadAuthority<AgentSupply[]>;getRuntimeStatus: () => Promise<RuntimeDependency>;getVibeAgent: (@@ -232,7 +253,7 @@ export async function readEntryEvidence(const [supplyOutcome, runtimeOutcome, connectionResults, agentsOutcome, cliResults] = await Promise.all([asSettled(deps.agentReads.refresh()),asSettled(deps.getRuntimeStatus()),- Promise.allSettled(ASSISTANT_ORDER.map((backend) => deps.getBackendConnection(backend))),+ Promise.allSettled(ENTRY_ORDER.map((backend) => deps.getBackendConnection(backend))),asSettled(deps.listAgents()),Promise.allSettled(ASSISTANT_ORDER.map(async (backend) => {const path = configuredCliPath(options.config, backend);diff --git a/ui/src/components/onboarding/onboarding-providers.css b/ui/src/components/onboarding/onboarding-providers.cssindex e345d1b10..93bfe9c37 100644--- a/ui/src/components/onboarding/onboarding-providers.css+++ b/ui/src/components/onboarding/onboarding-providers.css@@ -77,13 +77,13 @@/* ---- Provider sources ---------------------------------------------------- */-/* The same three tracks the story's cards use, so the diagram's columns and the- composition's columns are one set: 299-wide cards with 39.5 gaps in a 976 box,- written as the fraction rather than the pixels so it holds at every width. */+/* The reference's three source cards across the composition: 320-wide with 40 between+ them in the 1040 box, written as the fraction rather than the pixels so it holds at+ every width. */.setup-provider-grid {display: grid;- grid-template-columns: repeat(3, minmax(0, 30.6352%));- justify-content: space-between;+ grid-template-columns: repeat(3, minmax(0, 1fr));+ column-gap: calc(100% * 40 / 1040);height: var(--obp-card-h);}@@ -280,9 +280,10 @@/* ---- Gateway ------------------------------------------------------------- */-/* One track wide and centred, which puts it on the column the middle card sits on. */+/* The action's width and centred, which puts it on the composition's centre line,+ right above the action it leads to: 299 of 1040. */.setup-gateway {- width: 30.6352%;+ width: calc(100% * 299 / 1040);min-width: 0;margin: 0 auto;height: var(--obp-gateway-h);@@ -355,13 +356,10 @@/* ---- Assistant destinations ---------------------------------------------- */-/* The row the introduction's three cards shrink into. Same tracks, same logo and- name tokens, so the handoff has nothing to interpolate but position and size of- the frame itself. */+/* The row the introduction's cards shrink into. The story's own tracks (see+ onboarding.css), the same logo and name tokens, so the handoff has nothing to+ interpolate but position and size of the frame itself. */.setup-destinations {- display: grid;- grid-template-columns: repeat(3, minmax(0, 30.6352%));- justify-content: space-between;height: var(--obp-destination-h);}.setup-destination {@@ -383,6 +381,18 @@text-overflow: ellipsis;white-space: nowrap;}+/* A built-in assistant is part of the platform; the tag says so where the others say+ nothing, because there is nothing to install or enable for it. */+.setup-destination-tag {+ flex-shrink: 0;+ padding: 2px calc(8 * var(--ob-u));+ border: 1px solid var(--border-strong);+ border-radius: 999px;+ font-size: var(--obp-card-key);+ line-height: 1.45;+ color: var(--muted);+ white-space: nowrap;+}/* ---- Summary ------------------------------------------------------------- */@@ -626,23 +636,20 @@/* ---- Bands --------------------------------------------------------------- *//* Only the two stacked bands `onboarding.css` already declares, restated for this- root. Nothing new is introduced: below 1024 the composition loses its third- column, and below 760 the diagram is a single column with the wires removed,- because a vertical wire between two stacked boxes describes nothing. */+ root. Nothing new is introduced: below 1024 the columns close up, and below 760+ the diagram is a single column with the wires removed, because a vertical wire+ between two stacked boxes describes nothing. */@media (max-width: 1023px) {.setup-provider-grid,- .setup-destinations {- grid-template-columns: repeat(3, minmax(0, 1fr));- gap: calc(12 * var(--ob-u));- justify-content: stretch;- }+ .setup-destinations { column-gap: calc(12 * var(--ob-u)); }.setup-gateway { width: 100%; }}@media (max-width: 759px) {.setup-provider-stage { gap: 10px; }+ .setup-provider-grid { grid-template-columns: minmax(0, 1fr); }+ .setup-destinations { grid-auto-flow: row; }.setup-provider-grid,.setup-destinations {- grid-template-columns: minmax(0, 1fr);height: auto;gap: 10px;}diff --git a/ui/src/components/onboarding/onboarding.css b/ui/src/components/onboarding/onboarding.cssindex 11fad1cc6..569a4af5e 100644--- a/ui/src/components/onboarding/onboarding.css+++ b/ui/src/components/onboarding/onboarding.css@@ -10,11 +10,11 @@* at 1920x1080 and 258 stacked on a phone — each with its own header height, heading* type, card interior and action size. The bands below are exactly those readings:* nothing interpolates between them because the design never does. One content column- * of `clamp(976px, 62.5vw, 1200px)` still caps the width between the gutters and the+ * of `clamp(1040px, 62.5vw, 1200px)` still caps the width between the gutters and the* cap, and the card tracks, handoff gaps and stretched wire viewBox stay percentages of* it, so the horizontal composition is fluid while the vertical rhythm is authored.*- * The welcome and the setup are one composition seen twice. The three cards keep the+ * The welcome and the setup are one composition seen twice. The cards keep the* same frame, the same tracks and the same identity header in both — logo, name, and* a right-hand slot the introduction fills with a role and the connection with an* enable switch — so moving between them changes what a card holds and never where it@@ -43,6 +43,10 @@--ob-line-number: #585c71;--ob-code-violet: #a496e15c;--ob-code-cyan: #67c2b75c;+ /* The review's diff tints, taken from the theme's own destructive and mint so each+ theme draws its own pair without a second set of literals. */+ --ob-diff-removed: color-mix(in srgb, var(--destructive) 8%, transparent);+ --ob-diff-added: color-mix(in srgb, var(--mint) 6%, transparent);--ob-check-bg: #ffffff05;--ob-check-border: #5bffa044;--ob-check-done: #5bffa012;@@ -108,14 +112,18 @@type: 12 on the standard desktops, 15 at the large reading, 13 stacked. */--ob-cap-fs: 12px;- /* One content width for the story and the assistant cards, written as the- rule the reference's four rows describe rather than as four numbers: 976 on- a standard desktop, growing only once the window can spend 62.5% of itself- on it, and stopping at 1200. That reaches exactly 976 at both 1366 and 1440- and exactly 1200 at 1920 — the three authored desktop rows — with no- breakpoint between them. The header is full-bleed instead: its logo and- language button sit at the window's own gutter, not at the column's edge. */- --ob-content-w: clamp(976px, 62.5vw, 1200px);+ /* One content width for the story and the assistant cards, written as a rule+ rather than as a number per window: 1040 on a standard desktop — the four+ 242-wide cards and their 24 gaps the reference draws at 1200x800 — growing+ only once the window can spend 62.5% of itself on it, and stopping at 1200.+ The header is full-bleed instead: its logo and language button sit at the+ window's own gutter, not at the column's edge. */+ --ob-content-w: clamp(1040px, 62.5vw, 1200px);+ /* The gap between two card tracks, as the reference's 24 of 1040. One track per+ card, however many the lineup holds, so the share is the only number the+ story, the destinations and the assistants agree on — and `CollaborationStory`+ draws its wires in the same 1040 space. */+ --ob-track-gap: calc(100% * 24 / 1040);--ob-gutter: 48px;/* One design unit for the story's interior, taken from the card it is drawnin: the skeletons, wires and status glyph scale with the card while the@@ -137,20 +145,25 @@this tier's numbers: its frame, its padding, the identity row, the state row,the note at its clamp, and the two method rows. A tier that restates itspadding or its rows restates this with them. */- --ob-assistant-wrap: 0px;--ob-assistant-h: calc(2px + var(--ob-card-pv) + var(--ob-card-ph) + var(--ob-id-h) + var(--ob-card-gap) * 2+ var(--ob-life-h) + var(--ob-note-lh) * 2 + var(--ob-spacer-2)- + var(--ob-method-h) * 2 + var(--ob-method-gap) + var(--ob-assistant-wrap));+ + var(--ob-method-h) * 2 + var(--ob-method-gap));+ /* The built-in card offering its models: the same card with the two method rows+ replaced by the offer — three candidates and "All models" two short of a method+ row each, its 4 inset and 1 border on both sides, and the hairline above the last.+ Every band reserves it at its worst reading — the note at its two-line clamp —+ because whether the note wraps is the platform's fonts' answer, not the design's. */+ --ob-offer-h: calc(var(--ob-assistant-h) + var(--ob-method-h) * 2 - var(--ob-method-gap) + 3px);/* One floor under the cards, so a card that grows while its step is read — a- sentence that wraps in one language, a state row that arrives with detection —- cannot move the action. It reserves the cards only; whatever a step draws under- them adds its own height on top, and the shared cell (see `.onboarding-screens`)- is what then holds the three steps level. */- --ob-stage-h: max(var(--ob-diagram-h), var(--ob-assistant-h));+ sentence that wraps in one language, a state row that arrives with detection, the+ built-in card opening its model offer — cannot move the action. It reserves the+ cards only; whatever a step draws under them adds its own height on top, and the+ shared cell (see `.onboarding-screens`) is what then holds the three steps level. */+ --ob-stage-h: max(var(--ob-diagram-h), var(--ob-assistant-h), var(--ob-offer-h));/* The diagram keeps the box the reference draws it in: the story's card plus the- band the return wire needs under it — 296 around a 232-tall card, 326 around a- 262, 394 around a 330, the card plus 64 at every reading. A reservation that- has to hold a wrapped sentence on another step does not redraw the story. */+ band the return wire needs under it — the card plus 64 at every reading. A+ reservation that has to hold a wrapped sentence on another step does not+ redraw the story. */--ob-story-band: 64px;--ob-diagram-h: calc(var(--ob-card-h) + var(--ob-story-band));@@ -535,13 +548,15 @@height: var(--ob-diagram-h);container-type: inline-size;}-/* Three 299-wide cards in a 976 box, which is the same fraction as three 367 in 1200 —- so one percentage draws the reference's own tracks and its own 39.5 / 49.5 handoff- gaps without either being typed in. */-.onboarding-collaboration-cards {+/* One equal track per card, `--ob-track-gap` apart: four 242-wide cards in the 1040+ box, the same fractions at every width, and the count is the markup's own. */+.onboarding-collaboration-cards, .onboarding-assistants-list, .setup-destinations {display: grid;- grid-template-columns: repeat(3, minmax(0, 30.6352%));- justify-content: space-between;+ grid-auto-flow: column;+ grid-auto-columns: minmax(0, 1fr);+ column-gap: var(--ob-track-gap);+}+.onboarding-collaboration-cards {height: var(--ob-card-h);position: relative;z-index: 1;@@ -567,8 +582,8 @@}/* The story's cards are cut from a box whose height the diagram already fixed; theconnection's take that height as a floor, because an error or a wrapped action has- to be readable rather than clipped. Growing is a grid row, so the three grow as one- and their identity headers stay level. */+ to be readable rather than clipped. The cards stand top-aligned, so one that grows+ keeps its identity header level with the others. */.onboarding-collaboration-card { height: 100%; overflow: hidden; }.onboarding-assistant { min-height: var(--ob-card-h); }.onboarding-collaboration-card[data-active="true"],@@ -579,8 +594,8 @@/* The card's identity, at its head — "the assistant logo and name stay at the top inboth states; connection state replaces roles with enable switches", which is the onerule the whole intro/connection invariant rests on. Both steps draw this from the same- class and the same three slots: logo, name, and a trailing slot the introduction fills- with a role and the connection with an enable switch. There is one identity header in+ class: logo, then the name — with the role under it in the introduction, and the+ enable switch in a trailing slot in the connection. There is one identity header inthe stylesheet, so the two steps cannot place it differently, and the body underneathtakes every difference between them.The reference rules this header off from the body with a hairline in both steps, so@@ -614,23 +629,33 @@font-weight: 550;letter-spacing: -0.3px;line-height: 1.5;- /* At the tall tier's still-three-column band a card can be narrower than its+ /* At the tall tier's narrow side-by-side band a card can be narrower than itslogo, switch and an unbreakable name; the name yields first — wrapping orellipsising — before the row spills through the card edge. */min-width: 0;overflow-wrap: anywhere;}-/* The trailing slot. The role is text; the connection puts its switch here instead, and- both are pushed to the card's inner edge by the same rule. */-.onboarding-card-role, .onboarding-card-identity > .onboarding-assistant-enable {+/* The trailing slot: the connection puts its switch here, pushed to the card's inner+ edge. The story has no trailing slot — its role sits under the name instead. */+.onboarding-card-identity > .onboarding-assistant-enable {margin-left: auto;font-size: 11px;color: var(--muted);white-space: nowrap;}+.onboarding-card-title { display: flex; flex-direction: column; min-width: 0; }+.onboarding-card-title > .onboarding-card-name { line-height: 1.4; }/* The reference sets the role in bold (`.flow-role`, 700): at 11px on a muted grey it- is the one label on the card that has to read as a tag rather than as running text. */-.onboarding-card-role { font-weight: 700; }+ is the one label on the card that has to read as a tag rather than as running text.+ It sits under the name — four cards leave no room for both on one line — and the two+ lines fit the identity row's own height. */+.onboarding-card-role {+ font-size: 11px;+ line-height: 16px;+ font-weight: 700;+ color: var(--muted);+ white-space: nowrap;+}.onboarding-assistant-enable { display: flex; align-items: center; }/* The enable switch: a real `role="switch"` in the reference's own geometry — a 42x24track, a 2px border and a 16px thumb that travels 18px. The invisible ring around it@@ -672,7 +697,7 @@.onboarding-enable-switch:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }/* The story's status line keeps its authored share of the card in design units, which- keeps the three cards' status lines level even when one caption is longer than+ keeps the cards' status lines level even when one caption is longer thananother, and leaves the skeleton as the flexible row. */.onboarding-story-status {display: flex;@@ -738,16 +763,6 @@background: var(--ob-skeleton);flex-shrink: 0;}-/* h5qtNn's own rhythm inside its 119 box: 17 above the heading, then 12 / 8 / 14 / 7 / 7- between the six lines, leaving 14 below the last one. The heading is excluded here- rather than left to lose: a class selector cannot outrank a child selector, so the- generic 8 silently ate the 12 this rule is the reason for. 14 is written as the- paragraph's own margin because it collapses with the 8 above it — the larger wins,- which is the gap the design draws between the two blocks. */-.onboarding-skeleton-document > .onboarding-bar:not(.onboarding-bar-heading) { margin-bottom: calc(8 * var(--ob-u)); }-.onboarding-bar-heading { height: calc(9 * var(--ob-u)); margin-bottom: calc(12 * var(--ob-u)); background: var(--ob-skeleton-strong); }-.onboarding-skeleton-paragraph { display: flex; flex-direction: column; gap: calc(7 * var(--ob-u)); margin-top: calc(14 * var(--ob-u)); }-.onboarding-bar-subheading { height: calc(7 * var(--ob-u)); background: var(--ob-card-border); }.onboarding-collaboration-card[data-state="working"] .onboarding-skeleton::after {content: "";position: absolute;@@ -760,6 +775,25 @@}@keyframes onboarding-shimmer { to { transform: translateX(110%); } }+/* The coordinator's plan: one row per assistant it hands a part to — the step, an+ arrow, and the assistant's name — 26 tall on a 6 gap, 10 below the status line. */+.onboarding-skeleton-handoffs { display: flex; flex-direction: column; gap: calc(6 * var(--ob-u)); padding-top: calc(10 * var(--ob-u)); }+.onboarding-handoff-row {+ display: flex;+ align-items: center;+ gap: calc(8 * var(--ob-u));+ min-height: calc(26 * var(--ob-u));+ padding: 0 calc(10 * var(--ob-u));+ border-radius: 8px;+ background: var(--ob-well);+ border: 1px solid var(--ob-divider);+ font-size: var(--ob-cap-fs);+ white-space: nowrap;+}+.onboarding-handoff-step { min-width: calc(48 * var(--ob-u)); color: var(--muted); }+.onboarding-handoff-arrow { flex-shrink: 0; color: var(--mint-ink); }+.onboarding-handoff-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--foreground); }+/* u3bGM: six 11-tall rows on a 16 pitch, 14 below the box top — and, like the document,14 left under the last one. The row is 11 because that is what its line numberoccupies; the bars inside it are 6 and centre against that. */@@ -769,6 +803,12 @@.onboarding-code-bars { display: flex; align-items: center; gap: calc(6 * var(--ob-u)); flex: 1; min-width: 0; }.onboarding-bar-cyan { background: var(--ob-code-cyan); }.onboarding-bar-violet { background: var(--ob-code-violet); }+/* The reviewer reads a diff rather than writing one: the code is there from the start,+ a removed line and two added ones are tinted across the row, and the working card's+ sweep is what reads as the review passing over it. */+.onboarding-skeleton-review .onboarding-code-row { margin: 0 calc(-4 * var(--ob-u)); padding: 0 calc(4 * var(--ob-u)); border-radius: 3px; }+.onboarding-code-row[data-diff="removed"] { background: var(--ob-diff-removed); }+.onboarding-code-row[data-diff="added"] { background: var(--ob-diff-added); }/* xyNG1: four 12-tall rows on a 23 pitch, 17 below the box top. Fewer rows than theother two, so this skeleton ends higher — the design's own asymmetry, not slack. */@@ -845,7 +885,7 @@92%, 100% { stroke-dashoffset: -100; opacity: 0; }}-/* The return loop runs from the third card's floor to the first's along the line the+/* The return loop runs from the last card's floor to the first's along the line theother setup screens set their bottom text on: half a summary row above the stage'sfloor. The diagram is centred in the story, so the cards' floor is the story's middleless half the diagram plus a card; the box spans the diagram's width, and its bottom@@ -963,16 +1003,15 @@/* ---- Primary action ------------------------------------------------------ */-/* Both steps put their action under the middle column of the composition above, and at- exactly that column's width: 299 of 976, which is the same fraction as the 367 of- 1200 the reference draws on a large screen. Expressing it as that fraction — not a- fixed 299px — is what keeps the intro's "Get started" and the connection step's- "Enter Workbench" on the same coordinates at every width, since both live in the same- capped box and take the same percentage of it. The 144 floor still applies once the- fraction falls under a comfortable target. Height, type and arrow follow the tier:- 52 under an 800px window, 56 above it, 54 on a phone. */+/* Every step puts its action on the composition's centre line at the reference's 299 of+ 1040. Expressing it as that fraction — not a fixed 299px — is what keeps the intro's+ "Get started" and the connection step's "Enter Workbench" on the same coordinates at+ every width, since both live in the same capped box and take the same percentage of+ it. The 144 floor still applies once the fraction falls under a comfortable target.+ Height, type and arrow follow the tier: 52 under an 800px window, 56 above it, 54 on+ a phone. */.onboarding-action-w {- width: calc(100% * 299 / 976);+ width: calc(100% * 299 / 1040);max-width: 100%;min-width: 144px;height: var(--ob-action-h);@@ -1010,17 +1049,17 @@/* ---- Assistant setup ----------------------------------------------------- *//* The connection step has no section bar above its cards: the page heading already- names what the three are, and the reference draws them directly under it. */+ names what the cards are, and the reference draws them directly under it. */.onboarding-assistants { width: 100%; display: flex; flex-direction: column; }-/* The three assistants keep the identity the intro gave them: this is the story's own- grid, track for track, so Claude/Codex/OpenCode occupy the same x and the same width- on both steps and the transition between them reads as the cards staying put while- their contents change. The container makes `--ob-card-h`'s width guard resolve- against this box, exactly as the story's resolves against the diagram. */+/* The assistants keep the identity the intro gave them: this is the story's own grid,+ track for track, so every assistant occupies the same x and the same width on both+ steps and the transition between them reads as the cards staying put while their+ contents change. The container makes `--ob-card-h`'s width guard resolve against+ this box, exactly as the story's resolves against the diagram.+ Top-aligned rather than stretched: the built-in card grows to offer its models while+ the others keep the card's own height, as the reference draws it. */.onboarding-assistants-list {- display: grid;- grid-template-columns: repeat(3, minmax(0, 30.6352%));- justify-content: space-between;+ align-items: start;container-type: inline-size;}/* The state row is where the story puts its caption: the lifecycle pill on the left@@ -1087,14 +1126,14 @@cursor: pointer;}/* The label is the only visible description of a settled connection, so in the- narrow band that still draws three columns it wraps rather than truncates; the+ narrow band that still draws the cards side by side it wraps rather than truncates; thecard's min-height absorbs the extra line the way it absorbs an error line. */.onboarding-method-row > span, .onboarding-method-connected > span { min-width: 0; }.onboarding-method-connected > svg { color: var(--mint-ink); flex-shrink: 0; }/* The shared route, drawn on the card: a label over the model it currently resolvesto, and the chevron that says the dialog is behind it. Two lines of type where themethod rows carry one, so it takes the method row's height plus a line — still- inside the two rows the card's floor reserves, which is what keeps the three cards+ inside the two rows the card's floor reserves, which is what keeps the cardsand the action below them where they were. */.onboarding-model-choice {display: flex;@@ -1148,6 +1187,48 @@text-overflow: ellipsis;}.onboarding-model-choice > svg { flex-shrink: 0; color: var(--muted); }+/* A built-in assistant with no model yet offers the first models it could run on, in+ one framed list with the way to the rest under a hairline. Each row is a method row's+ height: the model on the left, who supplies it on the right. */+.onboarding-model-offer {+ display: flex;+ flex-direction: column;+ padding: 4px;+ border: 1px solid var(--border-strong);+ border-radius: 8px;+ background: var(--ob-card);+}+.onboarding-model-offer-row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+ min-height: calc(var(--ob-method-h) - 2px);+ padding: 0 8px;+ border-radius: 6px;+ background: transparent;+ color: var(--foreground);+ font-family: inherit;+ font-size: var(--ob-method-fs);+ font-weight: 500;+ text-align: left;+ cursor: pointer;+}+span.onboarding-model-offer-row { cursor: default; }+.onboarding-model-offer-row:hover:not(:disabled), .onboarding-model-offer-row:focus-visible { background: var(--ob-tile-hover); }+.onboarding-model-offer-row:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }+.onboarding-model-offer-row:disabled { cursor: default; }+.onboarding-model-offer-row > svg { flex-shrink: 0; color: var(--muted); }+.onboarding-model-offer-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+.onboarding-model-offer-supplier { flex-shrink: 0; font-size: 11px; font-weight: 400; color: var(--muted); }+.onboarding-model-offer-all {+ border-top: 1px solid var(--ob-divider);+ border-radius: 0 0 6px 6px;+ color: var(--muted);+}+.onboarding-model-offer-empty { padding: 8px; font-size: 12px; line-height: 1.5; color: var(--muted); }+/* A note that says why the assistant cannot run is the card's one error line. */+.onboarding-assistant-note[data-tone="error"] { color: var(--destructive-ink); }/* Installed but off: a line, not a control. The switch above is the only thing topress, and this says the binary is already there. */.onboarding-method-receipt {@@ -1161,7 +1242,7 @@.onboarding-method-receipt > svg { color: var(--mint-ink); flex-shrink: 0; }/* The card's body reads top to bottom the way the story's does: the identity header,then the state line, then the note and the work. The body is the flexible one, so an- error or a wrapped action grows downward and the three identity headers stay level+ error or a wrapped action grows downward and the identity headers stay levelwith each other and with the intro's. */.onboarding-assistant-body {flex: 1;@@ -1189,7 +1270,7 @@chips competing for one line. *//* On the card's bottom edge, which is where the reference draws them: the note aboveis what varies in length — one line in Chinese, two in English — and letting that- decide where the methods start leaves three cards with three different floors. */+ decide where the methods start leaves the cards with different floors. */.onboarding-assistant-actions {margin-top: auto;display: flex;@@ -1208,7 +1289,7 @@gap: 8px;justify-content: flex-start;text-align: left;- /* The shared button base forbids wrapping; in the narrow three-column band the+ /* The shared button base forbids wrapping; in the narrow side-by-side band thelabel is the only description of the method, so wrapping wins over clipping. */white-space: normal !important;}@@ -1228,20 +1309,31 @@reference's desktop rows to adapt: the content box stops growing on its own, and thecard answers to the window rather than to a breakpoint, so 1366, 1440 and 1920 arethree readings of one rule rather than three layouts. */+/* Below 1024 the cards cannot stand side by side without breaking an assistant's name+ mid-word, so the story and the assistants fold into two columns of two. The wires go+ with the single row — a handoff drawn across a fold describes nothing — exactly as+ they go on a phone, and the cards keep the frame they have on a desktop. The phone+ band below folds them once more, into one column. */@media (max-width: 1023px) {.onboarding-shell {--ob-gutter: 24px;- /* Three columns in this much window is the narrowest reading the composition has,- and the connection card answers for it twice: "Claude Code" takes a second line- in the identity header, and the first method label takes one in its row. Two- line boxes of the card's own type — 24 for the name, 11 for the row — so the- step that has to draw them and the step that does not still end at the same- action. */- --ob-assistant-wrap: 35px;+ --ob-stack-gap: 16px;+ /* The fold's rows, the first holding the built-in card at its tallest. The shell+ states the row count from the lineup. */+ --ob-stage-h: calc(max(var(--ob-card-h), var(--ob-offer-h))+ + (max(var(--ob-card-h), var(--ob-assistant-h)) + var(--ob-stack-gap)) * (var(--ob-fold-rows) - 1));+ }+ .onboarding-collaboration-cards, .onboarding-assistants-list {+ grid-auto-flow: row;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: var(--ob-stack-gap);}+ .onboarding-collaboration { height: auto; }+ .onboarding-collaboration-cards { height: auto; grid-auto-rows: var(--ob-card-h); }+ .onboarding-wires, .onboarding-return { display: none; }}-/* "Stack the three assistant cards below 760px and allow natural scrolling."+/* "Stack the assistant cards below 760px and allow natural scrolling."Both steps stack, not only the connection's. That is the same rule the rest of thissheet is built on — the two steps are one composition seen twice — and it is alsowhat lets the shared reservation keep working here: the reference reaches the same@@ -1254,7 +1346,7 @@--ob-header-h: 82px;--ob-header-pad: 22px;/* A stacked card is as tall as the reference draws it, not a share of the window:- stacked, the three cards ARE the composition, and a short phone should scroll+ stacked, the cards ARE the composition, and a short phone should scrollthem rather than compress them. */--ob-card-h: 258px;--ob-card-pv: 21px;@@ -1280,14 +1372,12 @@--ob-h1-min: calc(2 * var(--ob-h1-lh));--ob-p-min: var(--ob-sub-lh);--ob-band-gap: 27px;- /* Stacked, the cards are one above another and nothing is narrow enough to- wrap a name or a method row: the card's own composition answers for the- tier again. */- --ob-assistant-wrap: 0px;--ob-stack-gap: 16px;- /* The same reservation as the desktop rows, re-derived from the stack: three- of the taller card and the two gaps between them. */- --ob-stage-h: calc(max(var(--ob-card-h), var(--ob-assistant-h)) * 3 + var(--ob-stack-gap) * 2);+ /* The same reservation as the desktop rows, re-derived from the stack: the built-in+ card at its tallest, then one of the taller card per other assistant, and the+ gaps between them. `--ob-cards` is the lineup's own count, which the shell states. */+ --ob-stage-h: calc(max(var(--ob-card-h), var(--ob-offer-h))+ + (max(var(--ob-card-h), var(--ob-assistant-h)) + var(--ob-stack-gap)) * (var(--ob-cards) - 1));--ob-main-top: 0px;--ob-access-w: 100%;--ob-access-pad: 24px;@@ -1304,22 +1394,17 @@size here is a tier variable rather than a number. The block's own reserve givesway to these, which are the ones that can wrap. */- /* The story becomes the stack the connection already is. The wires go with the- columns — there is no handoff to draw between cards that are above one another —- and so do the return loop and the caption it carries.- The cards take the rest of the reserved height in three equal rows, which is how- the introduction reaches the same floor as the connection. */+ /* The story becomes the stack the connection already is, one card per row. The wires+ and the return loop are already gone with the side-by-side row (the 1023 band).+ The cards take the rest of the reserved height in equal rows, which is how the+ introduction reaches the same floor as the connection. */.onboarding-story { flex: 1; align-items: stretch; }.onboarding-collaboration { height: auto; display: flex; flex-direction: column; gap: 16px; }+ .onboarding-collaboration-cards, .onboarding-assistants-list { grid-template-columns: minmax(0, 1fr); }.onboarding-collaboration-cards {- grid-template-columns: minmax(0, 1fr);- grid-template-rows: repeat(3, minmax(0, 1fr));- gap: var(--ob-stack-gap);- height: auto;+ grid-auto-rows: minmax(0, 1fr);flex: 1;}- .onboarding-wires, .onboarding-return { display: none; }- .onboarding-assistants-list { grid-template-columns: minmax(0, 1fr); gap: var(--ob-stack-gap); }/* Six 52px logos cannot sit on one 350px row, so the row folds into two of three —the reference's own mobile arrangement — and gives up the fixed 560 span with it. */.onboarding-access-grid { width: min(300px, 100%); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }@@ -1382,6 +1467,11 @@.onboarding-screens > [data-setup-screen-root][hidden] { display: block !important; }}.onboarding-screens > [data-setup-screen-root][hidden] { visibility: hidden; pointer-events: none; }+/* A screen nobody is reading draws nothing, so nothing in it plays either — a pending+ read's pulse included. It resumes with the screen. */+.onboarding-screens > [data-setup-screen-root][hidden] *,+.onboarding-screens > [data-setup-screen-root][hidden] *::before,+.onboarding-screens > [data-setup-screen-root][hidden] *::after { animation-play-state: paused !important; }.onboarding-screens [hidden]:not([data-setup-screen-root]), .onboarding-access[hidden] { display: none !important; }.onboarding-handoff-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }.onboarding-handoff-layer * { animation-play-state: paused !important; }@@ -1439,6 +1529,23 @@@media (max-width: 759px) {.onboarding-step[data-setup-screen="assistants"] { --ob-aside-max: 48px; }}+/* The built-in card offering its models is taller than any card the band above was+ measured for, and it reaches into it. While it does, the aside hangs under the pair+ instead — out of flow, so the action stays where every screen puts it and nothing+ it says is drawn over a card. Picking a model closes the offer, and the aside goes+ back to its band. */+/* Positioned from the cell it lives in: the pair under the cell is two action rows+ and the footer's 10 between them. */+.onboarding-step[data-setup-screen="assistants"]:has(.onboarding-model-offer) > .onboarding-screens > .onboarding-action-aside:not(:empty) {+ position: absolute;+ top: calc(100% + var(--ob-action-h) * 2 + 10px + 16px);+ left: 0;+ right: 0;+ margin: 0;+ min-height: 0;+ max-height: none;+ overflow: visible;+}.onboarding-setup-hint { width: 100%; text-align: center; }/* Sentence centred on the action's axis, rescan beside it: equal flanking columns putthe middle one in the middle of the slot whatever the link costs, and the link startsdiff --git a/ui/src/components/onboarding/providers/DestinationRow.tsx b/ui/src/components/onboarding/providers/DestinationRow.tsxindex 62a9a0844..c14fd8c40 100644--- a/ui/src/components/onboarding/providers/DestinationRow.tsx+++ b/ui/src/components/onboarding/providers/DestinationRow.tsx@@ -1,24 +1,30 @@-// The three assistants, as the shape the introduction's cards shrink into.+// The assistants, as the shape the introduction's cards shrink into.//// This row is the handoff's landing target (C3), which is why it carries no state of// its own: an enabled/disabled mark here would be a second, staler answer to a// question screen 3 owns, and the handoff would have to animate it appearing. The-// row says who the routing is for and nothing else.+// row says who the routing is for and nothing else — including that the built-in one+// is part of the platform rather than something to install.import type { FC } from 'react';+import { useTranslation } from 'react-i18next';import { getBackendUiMeta } from '@/lib/agentBackends';-import { ASSISTANT_ORDER } from '../collaborationTimeline';+import { SETUP_LINEUP } from '../collaborationTimeline';import { BackendIcon } from '../../visual';export const DestinationRow: FC = () => {+ const { t } = useTranslation();return (<div className="setup-destinations">- {ASSISTANT_ORDER.map((backend) => (+ {SETUP_LINEUP.map((backend) => (<div key={backend} className="setup-destination" data-backend={backend}><span className="setup-destination-logo"><BackendIcon backend={backend} size={28} variant="brand" aria-hidden="true" /></span><span className="setup-destination-name">{getBackendUiMeta(backend).label}</span>+ {getBackendUiMeta(backend).builtin && (+ <span className="setup-destination-tag">{t('settings.backends.builtinBadge')}</span>+ )}</div>))}</div>diff --git a/ui/src/components/onboarding/setupTargets.ts b/ui/src/components/onboarding/setupTargets.tsindex d2d7c2624..3641c5b5e 100644--- a/ui/src/components/onboarding/setupTargets.ts+++ b/ui/src/components/onboarding/setupTargets.ts@@ -1,5 +1,6 @@import type { VibeAgentBrief, VibeAgentFull } from '../../context/ApiContext';-import { ASSISTANT_ORDER, type AssistantId } from './collaborationTimeline';+import type { AgentBackendId } from '@/lib/agentBackends';+import { SETUP_LINEUP } from './collaborationTimeline';/*** Which Agent a setup card speaks for.@@ -33,7 +34,7 @@ const byName = (left: { name: string }, right: { name: string }): number =>export function setupTargetFor<T extends SetupTargetAgent>(agents: readonly T[],- backend: AssistantId,+ backend: AgentBackendId,): T | null {const pool = agents.filter((agent) =>agent.backend === backend && agent.enabled && !agent.archived && isBuiltinAgent(agent));@@ -43,9 +44,9 @@ export function setupTargetFor<T extends SetupTargetAgent>(?? null;}-/** Every assistant's own Agent, in C6's stable order, skipping the ones that have none. */+/** Every card's own Agent, in the setup lineup's stable order, skipping the ones that have none. */export function setupTargets<T extends SetupTargetAgent>(agents: readonly T[]): T[] {- return ASSISTANT_ORDER.flatMap((backend) => {+ return SETUP_LINEUP.flatMap((backend) => {const target = setupTargetFor(agents, backend);return target ? [target] : [];});@@ -77,7 +78,7 @@ export async function readSetupTargets(const seen = new Set<string>();const relevant = briefs.filter((agent) => {if (!agent.enabled || agent.archived) return false;- if (!ASSISTANT_ORDER.includes(agent.backend as AssistantId)) return false;+ if (!SETUP_LINEUP.includes(agent.backend as AgentBackendId)) return false;if (seen.has(agent.name)) return false;seen.add(agent.name);return true;diff --git a/ui/src/components/onboarding/useBuiltinModelChoice.test.ts b/ui/src/components/onboarding/useBuiltinModelChoice.test.tsnew file mode 100644index 000000000..d1cc63285--- /dev/null+++ b/ui/src/components/onboarding/useBuiltinModelChoice.test.ts@@ -0,0 +1,243 @@+// @vitest-environment jsdom+import { act, renderHook, waitFor } from '@testing-library/react';+import { describe, expect, it, vi } from 'vitest';+import { chosenCandidate } from '../settings/models/backendCatalog';+import { ApiCallError } from '../settings/models/modelsApi';+import type { AgentSupply, BackendModel, BackendModelCandidates, ModelCandidate } from '../settings/models/types';+import { useBuiltinModelChoice, type BuiltinModelChoiceDeps } from './useBuiltinModelChoice';++const candidate = (id: string, reasoning_efforts: string[] = []): ModelCandidate => ({+ id, display_name: null, reasoning_efforts, origin: 'provider',+ suppliers: [{ source_id: 'src_lab', source_name: 'Lab', model_id: id }],+});+const read = (...ids: string[]): BackendModelCandidates => ({ builtin: [], providers: ids.map((id) => candidate(id)), in_list: [] });+const deferred = <T,>() => {+ let resolve!: (value: T) => void;+ let reject!: (error: unknown) => void;+ const promise = new Promise<T>((yes, no) => { resolve = yes; reject = no; });+ return { promise, resolve, reject };+};++/**+ * A server with the one behaviour this hook exists for: committing a model to the list+ * of a backend whose Agent has none fills that Agent with the list's first row, as the+ * controller's catalog reconciliation does.+ */+function server(initial: { catalog?: string[]; model?: string | null; effort?: string | null } = {}) {+ const state = {+ catalog: (initial.catalog ?? []).map((id) => ({ id, reasoning_efforts: [] }) as unknown as BackendModel),+ model: initial.model ?? null,+ effort: initial.effort ?? null,+ };+ const agent = () => ({ ok: true, agent: { name: 'vibey', model: state.model, reasoning_effort: state.effort }, default_agent_name: null });+ const api = {+ getVibeAgent: vi.fn(async () => agent()),+ updateVibeAgent: vi.fn(async (_name: string, payload: { model?: string; reasoning_effort?: string | null }) => {+ state.model = payload.model ?? state.model;+ if ('reasoning_effort' in payload) state.effort = payload.reasoning_effort ?? null;+ return agent();+ }),+ };+ const models = {+ getAgentModelCandidates: vi.fn(async () => read('lab-large', 'lab-mini')),+ putAgentModels: vi.fn(async (_backend: string, body: { models: BackendModel[] }) => {+ state.catalog = body.models;+ if (!state.model && state.catalog.length) state.model = state.catalog[0].id;+ return {} as AgentSupply;+ }),+ };+ const supply = (): AgentSupply[] => [{ backend: 'vibey', mode: 'hub', menu_kind: 'fixed', catalog_models: state.catalog } as AgentSupply];+ const agentReads = {+ read: async () => ({ kind: 'current' as const, value: supply() }),+ refresh: vi.fn(async () => ({ kind: 'current' as const, value: supply() })),+ readValue: async () => supply(),+ invalidate: () => undefined,+ };+ return { state, api, models, agentReads };+}++function mount(fixture: ReturnType<typeof server>, overrides: Partial<BuiltinModelChoiceDeps> = {}) {+ let epoch = 1;+ const onSettled = vi.fn();+ const props = (): BuiltinModelChoiceDeps => ({+ api: fixture.api as unknown as BuiltinModelChoiceDeps['api'],+ models: fixture.models as unknown as BuiltinModelChoiceDeps['models'],+ agentReads: fixture.agentReads,+ epoch: () => epoch,+ target: () => 'vibey',+ onSettled,+ ...overrides,+ });+ const view = renderHook(() => useBuiltinModelChoice(props()));+ return {+ view, onSettled,+ leaveAndReturn: () => { epoch += 1; view.rerender(); },+ leave: () => { epoch += 1; },+ returnTo: () => view.rerender(),+ };+}++describe('the built-in model choice', () => {+ it('writes a pick the list lacks, names it, and stands once a read shows it', async () => {+ const fixture = server();+ const { view, onSettled } = mount(fixture);+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))));+ expect(fixture.models.putAgentModels).toHaveBeenCalledWith('vibey', expect.objectContaining({+ baseline: [], expected_suppliers: { 'lab-mini': [{ source_id: 'src_lab', model_id: 'lab-mini' }] },+ }));+ expect(fixture.state.model).toBe('lab-mini');+ expect(view.result.current.holds('vibey')).toBe(false);+ expect(view.result.current.failure('vibey')).toBeNull();+ expect(onSettled).toHaveBeenCalledWith('vibey');+ });++ it('only names a model the list already holds', async () => {+ const fixture = server({ catalog: ['lab-mini'] });+ const { view } = mount(fixture);+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))));+ expect(fixture.models.putAgentModels).not.toHaveBeenCalled();+ expect(fixture.state.model).toBe('lab-mini');+ });++ it('holds a choice the server filled with another model until Retry applies it', async () => {+ // The list already holds another row, so committing the pick lets the server fill+ // the Agent with that row — and then naming the pick fails.+ const fixture = server({ catalog: ['lab-large'] });+ fixture.api.updateVibeAgent.mockRejectedValueOnce(new Error('offline'));+ const { view } = mount(fixture);+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))));+ expect(fixture.state.model).toBe('lab-large');+ expect(view.result.current.failure('vibey')).toEqual({ model: 'lab-mini', kind: 'failed' });+ expect(view.result.current.holds('vibey')).toBe(true);++ await act(async () => view.result.current.retry('vibey'));+ expect(fixture.models.putAgentModels).toHaveBeenCalledOnce();+ expect(fixture.state.model).toBe('lab-mini');+ expect(view.result.current.holds('vibey')).toBe(false);+ });++ it('settles a lost reply by the read: a write that landed stands', async () => {+ const fixture = server();+ fixture.api.updateVibeAgent.mockImplementationOnce(async (_name, payload) => {+ fixture.state.model = payload.model ?? null;+ throw new Error('reply lost');+ });+ const { view } = mount(fixture);+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))));+ expect(view.result.current.holds('vibey')).toBe(false);+ expect(view.result.current.failure('vibey')).toBeNull();+ });++ it('settles on the whole choice: a fill that names the model but keeps an effort it does not take holds', async () => {+ // The list write lands and the server fills the unset Agent with the pick, but the+ // reply is lost, so the write that moves the effort never runs.+ const fixture = server({ effort: 'xhigh' });+ const commit = fixture.models.putAgentModels.getMockImplementation()!;+ fixture.models.putAgentModels.mockImplementationOnce(async (backend, body) => {+ await commit(backend, body);+ throw new Error('reply lost');+ });+ const { view } = mount(fixture);+ const pick = chosenCandidate(candidate('lab-mini', ['low', 'medium', 'high']));+ await act(async () => view.result.current.choose('vibey', pick));+ expect(fixture.state).toMatchObject({ model: 'lab-mini', effort: 'xhigh' });+ expect(view.result.current.holds('vibey')).toBe(true);+ await act(async () => view.result.current.retry('vibey'));+ expect(fixture.state).toMatchObject({ model: 'lab-mini', effort: 'medium' });+ expect(view.result.current.holds('vibey')).toBe(false);+ });++ it('keeps writing until the reads it set off have settled', async () => {+ const fixture = server();+ const settled = deferred<void>();+ const { view } = mount(fixture, { onSettled: () => settled.promise });+ let done!: Promise<void>;+ act(() => { done = view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))); });+ await waitFor(() => expect(fixture.state.model).toBe('lab-mini'));+ await waitFor(() => expect(fixture.agentReads.refresh).toHaveBeenCalled());+ expect(view.result.current.picking('vibey')).toBe('lab-mini');+ expect(view.result.current.holds('vibey')).toBe(true);+ await act(async () => { settled.resolve(); await done; });+ expect(view.result.current.picking('vibey')).toBeNull();+ expect(view.result.current.holds('vibey')).toBe(false);+ });++ it('drops the rows a refusal was about and reads today\'s, without naming anything', async () => {+ const fixture = server();+ const { view } = mount(fixture);+ await act(async () => view.result.current.read('vibey'));+ expect(view.result.current.offer('vibey')?.kind).toBe('ready');+ fixture.models.putAgentModels.mockRejectedValueOnce(new ApiCallError('candidate_suppliers_changed', undefined, true, [], [], [], 409));+ const today = deferred<BackendModelCandidates>();+ fixture.models.getAgentModelCandidates.mockReturnValueOnce(today.promise);+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))));+ expect(fixture.api.updateVibeAgent).not.toHaveBeenCalled();+ expect(view.result.current.failure('vibey')).toEqual({ model: 'lab-mini', kind: 'suppliersChanged' });+ // The refusal ends the choice; nothing is held, and no refused row is offered.+ expect(view.result.current.holds('vibey')).toBe(false);+ expect(view.result.current.offer('vibey')?.kind).toBe('loading');+ await act(async () => today.resolve(read('lab-pro')));+ const offer = view.result.current.offer('vibey');+ expect(offer?.kind === 'ready' && offer.read.providers.map((row) => row.id)).toEqual(['lab-pro']);+ });++ it('moves the Agent\'s effort with its model by the editor\'s rule', async () => {+ for (const [efforts, before, after] of [+ [['low', 'medium', 'high'], 'xhigh', 'medium'],+ [[], 'high', null],+ [['low', 'high'], 'high', 'high'],+ ] as const) {+ const fixture = server({ effort: before });+ const { view } = mount(fixture);+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini', [...efforts]))));+ expect(fixture.state.effort).toBe(after);+ const payload = fixture.api.updateVibeAgent.mock.calls[0][1];+ expect('reasoning_effort' in payload).toBe(after !== before);+ view.unmount();+ }+ });++ it('writes one choice at a time', async () => {+ const fixture = server();+ const put = deferred<AgentSupply>();+ fixture.models.putAgentModels.mockReturnValueOnce(put.promise);+ const { view } = mount(fixture);+ let first!: Promise<void>;+ act(() => { first = view.result.current.choose('vibey', chosenCandidate(candidate('lab-mini'))); });+ await waitFor(() => expect(view.result.current.picking('vibey')).toBe('lab-mini'));+ await act(async () => view.result.current.choose('vibey', chosenCandidate(candidate('lab-large'))));+ expect(fixture.models.putAgentModels).toHaveBeenCalledOnce();+ await act(async () => { put.resolve({} as AgentSupply); await first; });+ expect(fixture.api.updateVibeAgent).toHaveBeenCalledOnce();+ });++ it('offers only what this showing of the screen read', async () => {+ const fixture = server();+ const first = deferred<BackendModelCandidates>();+ const second = deferred<BackendModelCandidates>();+ fixture.models.getAgentModelCandidates.mockReturnValueOnce(first.promise).mockReturnValueOnce(second.promise);+ const { view, leave, returnTo } = mount(fixture);+ act(() => { void view.result.current.read('vibey'); });+ leave();+ // The first read lands after the person left: it answers a showing that is over.+ await act(async () => first.resolve(read('lab-old')));+ returnTo();+ expect(view.result.current.offer('vibey')).toBeUndefined();+ act(() => { void view.result.current.read('vibey'); });+ expect(view.result.current.offer('vibey')?.kind).toBe('loading');+ await act(async () => second.resolve(read('lab-new')));+ const offer = view.result.current.offer('vibey');+ expect(offer?.kind === 'ready' && offer.read.providers.map((row) => row.id)).toEqual(['lab-new']);+ });++ it('keeps the rows it shows across a re-read within one showing', async () => {+ const fixture = server();+ const { view } = mount(fixture);+ await act(async () => view.result.current.read('vibey'));+ const again = deferred<BackendModelCandidates>();+ fixture.models.getAgentModelCandidates.mockReturnValueOnce(again.promise);+ act(() => { void view.result.current.read('vibey'); });+ expect(view.result.current.offer('vibey')?.kind).toBe('ready');+ await act(async () => again.resolve(read('lab-large')));+ });+});diff --git a/ui/src/components/onboarding/useBuiltinModelChoice.ts b/ui/src/components/onboarding/useBuiltinModelChoice.tsnew file mode 100644index 000000000..88f67cde3--- /dev/null+++ b/ui/src/components/onboarding/useBuiltinModelChoice.ts@@ -0,0 +1,162 @@+import { useCallback, useRef, useState } from 'react';+import type { ApiContextType } from '../../context/ApiContext';+import type { BuiltinBackend } from '@/lib/agentBackends';+import { compatibleEffort } from '@/lib/effortOptions';+import { useLatestRef } from '@/lib/useLatestRef';+import { draftRowFor, type ChosenCandidate } from '../settings/models/backendCatalog';+import type { CollectionReadAuthority } from '../settings/models/collectionReadAuthority';+import { apiFailure, type ModelsApi } from '../settings/models/modelsApi';+import type { AgentSupply } from '../settings/models/types';+import type { BuiltinModelOffer } from './builtinModelOffer';++/** The server's refusal of a pick whose suppliers moved after the card showed them. */+const CANDIDATES_CHANGED = 'candidate_suppliers_changed';++/**+ * Why a choice did not stand. `suppliersChanged` ends the choice: the rows it was made+ * from are gone and today's are read. `failed` keeps it: the model the person chose is+ * still the one they asked for, and Retry applies it again.+ */+export type BuiltinChoiceFailure = { model: string; kind: 'suppliersChanged' | 'failed' };++type Choice = { pick: ChosenCandidate; writing: boolean; failure: BuiltinChoiceFailure | null };+type ShownOffer = BuiltinModelOffer & { epoch: number };++export type BuiltinModelChoiceDeps = {+ api: Pick<ApiContextType, 'getVibeAgent' | 'updateVibeAgent'>;+ models: Pick<ModelsApi, 'getAgentModelCandidates' | 'putAgentModels'>;+ agentReads?: CollectionReadAuthority<AgentSupply[]>;+ /** The showing of the screen: it moves every time the screen is activated. */+ epoch: () => number;+ /** The card's own Agent, by name, from the current route read. */+ target: (backend: BuiltinBackend) => string | null | undefined;+ /** Redraw the card from the server once a choice has settled either way. */+ onSettled: (backend: BuiltinBackend) => unknown;+};++/**+ * A built-in assistant's one setup decision — which model it runs on — owned end to end:+ * reading the models it could run on, writing the person's choice, and the ways either+ * goes stale or half-done.+ *+ * - **Freshness.** An offer belongs to the showing of the screen that read it. A read+ * that lands after the person left answers nothing, and a returning screen reads again+ * rather than offering rows from before.+ * - **Conflict.** A pick refused because its suppliers moved takes its rows with it until+ * today's read replaces them, so the refused question is not asked again.+ * - **The write.** A choice is up to two writes: the backend's model list, when it lacks+ * the pick, then the Agent's model, with its effort moved by the Agent editor's rule.+ * Between them the server fills an Agent that has no model with the list's first row,+ * so a failure after the first can leave the Agent on a model nobody chose. The choice+ * is therefore settled by a read of the Agent, not by the writes' answers: until that+ * read shows the chosen model the choice is held, entry waits on it, and Retry applies+ * it again. A lost reply to a write that did land settles the same way.+ */+export function useBuiltinModelChoice(deps: BuiltinModelChoiceDeps) {+ const latest = useLatestRef(deps);+ const [offers, setOffers] = useState<Partial<Record<BuiltinBackend, ShownOffer>>>({});+ const [choices, setChoices] = useState<Partial<Record<BuiltinBackend, Choice>>>({});+ const tokens = useRef<Partial<Record<BuiltinBackend, number>>>({});+ const writing = useRef<Partial<Record<BuiltinBackend, boolean>>>({});++ const read = useCallback(async (backend: BuiltinBackend) => {+ const token = (tokens.current[backend] ?? 0) + 1;+ tokens.current[backend] = token;+ const showing = latest.current.epoch();+ const owns = () => tokens.current[backend] === token && latest.current.epoch() === showing;+ // A re-read within the same showing keeps the rows it already shows, so refreshing+ // the routes does not blank the list under the person's pointer.+ setOffers((current) => (current[backend]?.kind === 'ready' && current[backend].epoch === showing+ ? current : { ...current, [backend]: { kind: 'loading', epoch: showing } }));+ try {+ const value = await latest.current.models.getAgentModelCandidates(backend);+ if (owns()) setOffers((current) => ({ ...current, [backend]: { kind: 'ready', read: value, epoch: showing } }));+ } catch {+ if (owns()) setOffers((current) => ({ ...current, [backend]: { kind: 'failed', epoch: showing } }));+ }+ }, [latest]);++ const choose = useCallback(async (backend: BuiltinBackend, pick: ChosenCandidate) => {+ const { api, models, agentReads, target: targetOf } = latest.current;+ const target = targetOf(backend);+ if (!target || !agentReads || writing.current[backend]) return;+ writing.current[backend] = true;+ const model = pick.candidate.id;+ setChoices((current) => ({ ...current, [backend]: { pick, writing: true, failure: null } }));+ let refused = false;+ // The efforts the chosen model takes: what the list holds for it, else what the+ // candidate states — the row the write would add.+ let efforts: readonly string[] = pick.candidate.reasoning_efforts;+ try {+ const supply = (await agentReads.readValue()).find((row) => row.backend === backend);+ if (!supply) throw new Error('supply_unread');+ const baseline = supply.catalog_models ?? [];+ const row = draftRowFor(pick.candidate, [], baseline);+ efforts = row.reasoning_efforts;+ if (!baseline.some((held) => held.id === model)) {+ await models.putAgentModels(backend, {+ baseline, models: [...baseline, row], expected_suppliers: { [model]: pick.expected_suppliers },+ });+ }+ const current = await api.getVibeAgent(target, { cache: false });+ if (!current?.ok) throw new Error('agent_unread');+ const effort = compatibleEffort(current.agent.reasoning_effort, row.reasoning_efforts);+ const updated = await api.updateVibeAgent(target, effort === (current.agent.reasoning_effort ?? null)+ ? { model } : { model, reasoning_effort: effort });+ if (!updated?.ok) throw new Error('agent_update_failed');+ } catch (error) {+ // A refusal committed nothing, which is the one answer a write can be trusted for.+ refused = apiFailure(error)?.code === CANDIDATES_CHANGED;+ }+ // The choice stands when the Agent reads as the whole of it: the chosen model, with+ // an effort that model takes. The server's own fill can name the model without the+ // write that moves the effort ever landing.+ const confirmed = !refused && await api.getVibeAgent(target, { cache: false })+ .then((result) => !!result?.ok && result.agent.model === model+ && compatibleEffort(result.agent.reasoning_effort, efforts) === (result.agent.reasoning_effort ?? null), () => false);+ const failure: BuiltinChoiceFailure | null = refused ? { model, kind: 'suppliersChanged' }+ : confirmed ? null : { model, kind: 'failed' };+ if (refused) {+ setOffers((current) => ({ ...current, [backend]: { kind: 'loading', epoch: latest.current.epoch() } }));+ void read(backend);+ }+ // Still writing until the reads it set off have settled: entry acts on the same+ // shared reads, and a click in between would race them.+ if (confirmed) {+ try { await agentReads.refresh(); } catch { /* The redraw below reports what it cannot read. */ }+ }+ try { await latest.current.onSettled(backend); } finally {+ writing.current[backend] = false;+ setChoices((current) => {+ const next = { ...current };+ if (failure) next[backend] = { pick, writing: false, failure };+ else delete next[backend];+ return next;+ });+ }+ }, [latest, read]);++ const shown = (backend: BuiltinBackend) => {+ const offer = offers[backend];+ return offer && offer.epoch === deps.epoch() ? offer : undefined;+ };+ return {+ read,+ choose,+ /** Apply a choice that did not stand once more. */+ retry: (backend: BuiltinBackend) => {+ const choice = choices[backend];+ if (choice?.failure?.kind === 'failed') void choose(backend, choice.pick);+ },+ /** The candidates this showing of the screen read. */+ offer: (backend: BuiltinBackend): BuiltinModelOffer | undefined => shown(backend),+ /** The model being written, if a choice is in flight. */+ picking: (backend: BuiltinBackend) => (choices[backend]?.writing ? choices[backend].pick.candidate.id : null),+ failure: (backend: BuiltinBackend) => (choices[backend]?.writing ? null : choices[backend]?.failure ?? null),+ /** A choice is in flight or has not stood yet: entry waits on it. */+ holds: (backend: BuiltinBackend) => {+ const choice = choices[backend];+ return !!choice && (choice.writing || choice.failure?.kind === 'failed');+ },+ };+}diff --git a/ui/src/components/settings/models/BackendModelPickerDialog.tsx b/ui/src/components/settings/models/BackendModelPickerDialog.tsxindex 0a7a7c606..e8a2b7044 100644--- a/ui/src/components/settings/models/BackendModelPickerDialog.tsx+++ b/ui/src/components/settings/models/BackendModelPickerDialog.tsx@@ -75,9 +75,14 @@ export const BackendModelPickerDialog: React.FC<{/** The picks, each carrying the projection its row displayed. */onAdd: (chosen: ChosenCandidate[]) => void;/** Hand off to the custom-model editor, seeding the id with the query when the- * action the user pressed named it. */- onCustom: (seedId: string) => void;-}> = ({ open, backend, listedIds, seedPicked, onCancel, onAdd, onCustom }) => {+ * action the user pressed named it. A host with no editor to hand off to — setup+ * picking a built-in assistant's first model — omits it, and the action is not+ * offered. */+ onCustom?: (seedId: string) => void;+ /** `one` asks for a single model — setup choosing a built-in assistant's model —+ * so picking a row replaces the pick instead of adding to it. */+ choose?: 'many' | 'one';+}> = ({ open, backend, listedIds, seedPicked, onCancel, onAdd, onCustom, choose = 'many' }) => {const { t } = useTranslation();const [readState, setReadState] = React.useState<ReadState>('loading');const [candidates, setCandidates] = React.useState<BackendModelCandidates | null>(null);@@ -129,8 +134,9 @@ export const BackendModelPickerDialog: React.FC<{* promise something about a model the user just took off the list. */const toggle = (candidate: ModelCandidate) => {setChosen((current) => {- const next = new Map(current);- if (!next.delete(candidate.id)) next.set(candidate.id, chosenCandidate(candidate));+ const next = new Map(choose === 'one' ? [] : current);+ if (!current.has(candidate.id)) next.set(candidate.id, chosenCandidate(candidate));+ else if (choose === 'many') next.delete(candidate.id);return next;});};@@ -158,6 +164,7 @@ export const BackendModelPickerDialog: React.FC<{candidate={candidate}picked={chosen.has(candidate.id)}listed={key === 'listed'}+ single={choose === 'one'}onToggle={() => toggle(candidate)}/>))}@@ -174,9 +181,13 @@ export const BackendModelPickerDialog: React.FC<{><DialogHeader className="model-hub-catalog-head shrink-0 justify-center border-b border-border"><DialogTitle className="model-hub-catalog-title">- {t('settings.models.gateway.picker.title', { backend: getBackendUiMeta(backend).label })}+ {choose === 'one'+ ? t('settings.models.gateway.picker.chooseTitle', { backend: getBackendUiMeta(backend).label })+ : t('settings.models.gateway.picker.title', { backend: getBackendUiMeta(backend).label })}</DialogTitle>- <DialogDescription className="sr-only">{t('settings.models.gateway.picker.description')}</DialogDescription>+ <DialogDescription className="sr-only">+ {t(choose === 'one' ? 'settings.models.gateway.picker.chooseDescription' : 'settings.models.gateway.picker.description')}+ </DialogDescription></DialogHeader><div className="model-hub-catalog-body flex min-h-0 flex-1 flex-col">@@ -211,7 +222,7 @@ export const BackendModelPickerDialog: React.FC<{{/* Only when the query is the thing the action would name. With anempty one the footer already offers the same editor, and thelabel would quote nothing. */}- {filtering && (+ {filtering && onCustom && (<Buttontype="button"variant="ghost"@@ -241,16 +252,19 @@ export const BackendModelPickerDialog: React.FC<{order — ghost row first, then Cancel/Confirm at the very bottom —and the `sm:` half of the primitive still owns the one-row desktoplayout. */}- <DialogFooter className="model-hub-catalog-foot shrink-0 items-center border-t border-border max-sm:flex-col sm:justify-between">- <Button- type="button"- variant="ghost"- className="model-hub-catalog-control shrink-0 rounded-md px-2.5 text-[12.5px] font-semibold text-muted-foreground max-sm:w-full"- onClick={() => onCustom('')}- >- <Plus aria-hidden="true" />- {t('settings.models.gateway.picker.custom')}- </Button>+ <DialogFooter className={cn('model-hub-catalog-foot shrink-0 items-center border-t border-border max-sm:flex-col',+ onCustom ? 'sm:justify-between' : 'sm:justify-end')}>+ {onCustom && (+ <Button+ type="button"+ variant="ghost"+ className="model-hub-catalog-control shrink-0 rounded-md px-2.5 text-[12.5px] font-semibold text-muted-foreground max-sm:w-full"+ onClick={() => onCustom('')}+ >+ <Plus aria-hidden="true" />+ {t('settings.models.gateway.picker.custom')}+ </Button>+ )}<div className="flex w-full gap-2 sm:w-auto"><Buttontype="button"@@ -270,9 +284,11 @@ export const BackendModelPickerDialog: React.FC<{{/* The empty state borrows the catalog's own action label ratherthan a count of zero, so the footer keeps its width and thebutton keeps naming what it does. */}- {picks.length === 0- ? t('settings.models.gateway.catalog.add')- : t('settings.models.gateway.picker.confirm', { count: picks.length })}+ {choose === 'one'+ ? t('settings.models.gateway.picker.use')+ : picks.length === 0+ ? t('settings.models.gateway.catalog.add')+ : t('settings.models.gateway.picker.confirm', { count: picks.length })}</Button></div></DialogFooter>@@ -293,14 +309,16 @@ const PickerRow: React.FC<{candidate: ModelCandidate;picked: boolean;listed: boolean;+ /** One of a single choice: the row is a radio rather than a checkbox. */+ single?: boolean;onToggle: () => void;-}> = ({ candidate, picked, listed, onToggle }) => {+}> = ({ candidate, picked, listed, single = false, onToggle }) => {const checked = picked || listed;const supplied = candidate.suppliers.length > 0;return (<buttontype="button"- role="checkbox"+ role={single ? 'radio' : 'checkbox'}aria-checked={checked}disabled={listed}onClick={onToggle}diff --git a/ui/src/components/steps/AgentDetection.tsx b/ui/src/components/steps/AgentDetection.tsxindex 0928bbd68..64b73c5f5 100644--- a/ui/src/components/steps/AgentDetection.tsx+++ b/ui/src/components/steps/AgentDetection.tsx@@ -16,7 +16,9 @@ import { useToast } from '../../context/ToastContext';import { BackendIcon } from '../visual';import { InstallOutcome, type InstallOutcomeResult } from '../shared/InstallOutcome';import { AssistantRow } from '../onboarding/AssistantRow';-import { ASSISTANT_ORDER } from '../onboarding/collaborationTimeline';+import { BuiltinAssistantRow } from '../onboarding/BuiltinAssistantRow';+import { useBuiltinModelChoice } from '../onboarding/useBuiltinModelChoice';+import { ASSISTANT_ORDER, SETUP_LINEUP } from '../onboarding/collaborationTimeline';import '../onboarding/onboarding.css';import type { BackendId } from '../visual';import { BackendLifecycleChip, type BackendLifecycleVisual } from '../settings/BackendLifecycleChip';@@ -25,9 +27,11 @@ import { BackendConnectionDialog } from '../onboarding/BackendConnectionDialog';import type { BackendConnectionState } from '@/context/ApiContext';import { setConfigField } from '@/lib/configMutations';import { OpencodePermissionSetup } from '../settings/shared/OpencodePermissionSetup';-import { modelHubEnabledFromConfig } from '../settings/models/featureFlags';+import { hubSupplyBlocks, modelHubEnabledFromConfig } from '../settings/models/featureFlags';import type { SetupAction, SetupFlowState, SetupScreenHandle, SetupScreenId } from '../onboarding/setupFlow';-import type { NativeCliBackend as RuntimeBackendId } from '@/lib/agentBackends';+import {+ BUILTIN_BACKENDS, isBuiltinBackend, isNativeCliBackend, type AgentBackendId, type BuiltinBackend, type NativeCliBackend as RuntimeBackendId,+} from '@/lib/agentBackends';import { useOpencodePermission } from '../settings/shared/useOpencodePermission';import { Button } from '../ui/button';import { DEFAULT_NATIVE_AGENT_STATE, NATIVE_CLI_BACKENDS, getBackendUiMeta } from '@/lib/agentBackends';@@ -35,7 +39,10 @@ import { useRouteSurfaceActive } from '@/lib/routeSurfaceActivity';import { MODEL_HUB_SETTINGS_PATH } from '../settings/models/modelHubRoutes';import { RouteChainDialog, type RouteChainSelection } from '../settings/models/RouteChainDialog';import type { CollectionReadAuthority } from '../settings/models/collectionReadAuthority';-import type { AgentChain, AgentSupply, Source } from '../settings/models/types';+import type { AgentChain, AgentSupply, ModelCandidate, Source } from '../settings/models/types';+import { BackendModelPickerDialog } from '../settings/models/BackendModelPickerDialog';+import { chosenCandidate } from '../settings/models/backendCatalog';+import { routeRunnable } from '../onboarding/entryGate';import type { AssistantRouteView } from '../onboarding/AssistantRow';import { isBuiltinAgent } from '../onboarding/setupTargets';import { readyRegion } from '../settings/models/regionRead';@@ -63,9 +70,10 @@ type AgentState = {status?: 'unknown' | 'ok' | 'missing';};-type NativeRouteChainSelection = RouteChainSelection & {- agent: AgentSupply & { backend: RuntimeBackendId };-};+/** Choosing a built-in assistant's model, a model its list already holds is as much a+ * choice as one it does not: the pick only adds what is missing. So the picker is+ * told nothing is listed, and every supplied model stays selectable. */+const NOTHING_LISTED: ReadonlySet<string> = new Set();/*** The verdict of the latest settled enable write, and the intent that earned it.@@ -141,7 +149,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onsetInstallResults((prev) => (prev[name] ? { ...prev, [name]: undefined } : prev));// Which backend's "Configure provider" modal is open (wizard mode only).const [providerModal, setProviderModal] = useState<{ backend: RuntimeBackendId; method: 'oauth' | 'api_key' } | null>(null);- const [routeSelection, setRouteSelection] = useState<NativeRouteChainSelection | null>(null);+ const [routeSelection, setRouteSelection] = useState<RouteChainSelection | null>(null);const committedRouteRefresh = useRef(false);const canEditSetupRoute = Boolean(onNavigate && agentReads);const [routeRead, setRouteRead] = useState<{@@ -149,12 +157,14 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onfailed: boolean;confirmed: { epoch: number; token: number } | null;failure: { epoch: number; token: number } | null;- chains: Partial<Record<RuntimeBackendId, AgentChain | null>>;- models: Partial<Record<RuntimeBackendId, string | null>>;- backendReads: Partial<Record<RuntimeBackendId, 'ready' | 'failed'>>;+ chains: Partial<Record<AgentBackendId, AgentChain | null>>;+ models: Partial<Record<AgentBackendId, string | null>>;+ /** The card's own Agent, by name, where the store has one. */+ targets: Partial<Record<AgentBackendId, string | null>>;+ backendReads: Partial<Record<AgentBackendId, 'ready' | 'failed'>>;sources: Source[];supplies: AgentSupply[];- }>({ done: false, failed: false, confirmed: null, failure: null, chains: {}, models: {}, backendReads: {}, sources: [], supplies: [] });+ }>({ done: false, failed: false, confirmed: null, failure: null, chains: {}, models: {}, targets: {}, backendReads: {}, sources: [], supplies: [] });const routeReadToken = useRef(0);const sharedRouteReady = () => active && activeRef.current && routeRead.done && !routeRead.failed&& routeRead.confirmed?.epoch === activation.current@@ -162,11 +172,20 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onconst sharedRouteFailed = () => active && activeRef.current && routeRead.failed&& routeRead.failure?.epoch === activation.current&& routeRead.failure?.token === routeReadToken.current;- const routeTargetReady = (backend: RuntimeBackendId) => sharedRouteReady() && routeRead.backendReads[backend] === 'ready';- const routeFailureCurrent = (backend: RuntimeBackendId) => active && activeRef.current && (+ const routeTargetReady = (backend: AgentBackendId) => sharedRouteReady() && routeRead.backendReads[backend] === 'ready';+ const routeFailureCurrent = (backend: AgentBackendId) => active && activeRef.current && (sharedRouteFailed()|| (sharedRouteReady() && routeRead.backendReads[backend] === 'failed'));- const readCardRoutes = useCallback(async (target?: RuntimeBackendId) => {+ // The built-in card's model choice — its candidates, the write and both ways they go+ // stale or half-done — has one owner; see `useBuiltinModelChoice`.+ const choice = useBuiltinModelChoice({+ api, models: modelsApi, agentReads,+ epoch: () => activation.current,+ target: (backend) => routeRead.targets[backend],+ onSettled: (backend) => refreshRouteOwnership(backend),+ });+ const readOffer = choice.read;+ const readCardRoutes = useCallback(async (target?: AgentBackendId) => {if (!agentReads) return false;const token = ++routeReadToken.current;const epoch = activation.current;@@ -181,8 +200,8 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onconst supplies = supplyRead.value;if (token !== routeReadToken.current || epoch !== activation.current) return false;setRouteRead({ done: true, failed: false, confirmed: { epoch, token }, failure: null,- chains: {}, models: {}, backendReads: {}, sources: listed, supplies });- const backendPromises = ASSISTANT_ORDER.map(async (backend) => {+ chains: {}, models: {}, targets: {}, backendReads: {}, sources: listed, supplies });+ const backendPromises = SETUP_LINEUP.map(async (backend) => {try {const candidates = vibeAgents.agents.filter((row) => !row.archived && row.backend === backend).sort((left, right) => {@@ -212,8 +231,10 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onsetRouteRead((current) => ({ ...current,models: { ...current.models, [backend]: model },chains: { ...current.chains, [backend]: chain },+ targets: { ...current.targets, [backend]: selected?.name ?? null },backendReads: { ...current.backendReads, [backend]: 'ready' },}));+ if (isBuiltinBackend(backend) && selected && !model) void readOffer(backend);return true;} catch {if (token !== routeReadToken.current || epoch !== activation.current) return false;@@ -223,14 +244,14 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onreturn false;}});- return target ? backendPromises[ASSISTANT_ORDER.indexOf(target)]+ return target ? backendPromises[SETUP_LINEUP.indexOf(target)]: Promise.all(backendPromises).then(() => true);} catch {if (token !== routeReadToken.current || epoch !== activation.current) return false;setRouteRead((current) => ({ ...current, done: true, failed: true, confirmed: null, failure: { epoch, token } }));return false;}- }, [agentReads, api]);+ }, [agentReads, api, readOffer]);useEffect(() => {if (!active || !modelHubEnabled || !canEditSetupRoute) return;void readCardRoutes();@@ -240,7 +261,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onconst model = source?.models?.find((row) => row.id === hop.model_id);return model?.display_name?.trim() || hop.model_id;};- const routeViewFor = (backend: RuntimeBackendId): AssistantRouteView => {+ const routeViewFor = (backend: AgentBackendId): AssistantRouteView => {if (!canEditSetupRoute || !modelHubEnabled) return { kind: 'unavailable' };if (!routeTargetReady(backend)) return { kind: routeFailureCurrent(backend) ? 'failed' : 'pending' };if (!routeRead.models[backend]) return { kind: 'no-agent-model' };@@ -252,28 +273,28 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onbackups: Math.max(0, (chain?.chain.length ?? 0) - 1),};};- const [connections, setConnections] = useState<Partial<Record<RuntimeBackendId, BackendConnectionState>>>({});- const [connectionConfirmed, setConnectionConfirmed] = useState<Partial<Record<RuntimeBackendId, { epoch: number; token: number }>>>({});- const [connectionPending, setConnectionPending] = useState<Partial<Record<RuntimeBackendId, boolean>>>({});- const [connectionErrors, setConnectionErrors] = useState<Partial<Record<RuntimeBackendId, string>>>({});- const [pendingWrites, setPendingWrites] = useState<Partial<Record<RuntimeBackendId, boolean>>>({});+ const [connections, setConnections] = useState<Partial<Record<AgentBackendId, BackendConnectionState>>>({});+ const [connectionConfirmed, setConnectionConfirmed] = useState<Partial<Record<AgentBackendId, { epoch: number; token: number }>>>({});+ const [connectionPending, setConnectionPending] = useState<Partial<Record<AgentBackendId, boolean>>>({});+ const [connectionErrors, setConnectionErrors] = useState<Partial<Record<AgentBackendId, string>>>({});+ const [pendingWrites, setPendingWrites] = useState<Partial<Record<AgentBackendId, boolean>>>({});const [entering, setEntering] = useState(false);const [entryError, setEntryError] = useState('');- const connectionTokens = useRef<Partial<Record<RuntimeBackendId, number>>>({});+ const connectionTokens = useRef<Partial<Record<AgentBackendId, number>>>({});const previousRouteSurfaceActive = useRef(routeSurfaceActive);const enableQueue = useRef(Promise.resolve());- const enableIntent = useRef<Partial<Record<RuntimeBackendId, number>>>({});- const pendingEnable = useRef<Partial<Record<RuntimeBackendId, number>>>({});+ const enableIntent = useRef<Partial<Record<AgentBackendId, number>>>({});+ const pendingEnable = useRef<Partial<Record<AgentBackendId, number>>>({});// What the latest settled write still owes this screen, held until someone who can// answer for it reports it — see EnableReceipt.- const enableReceipt = useRef<Partial<Record<RuntimeBackendId, EnableReceipt>>>({});- const confirmedConnectionMode = (backend: RuntimeBackendId) => {+ const enableReceipt = useRef<Partial<Record<AgentBackendId, EnableReceipt>>>({});+ const confirmedConnectionMode = (backend: AgentBackendId) => {const confirmed = connectionConfirmed[backend];if (!active || !activeRef.current || connections[backend]?.ok !== true || connectionPending[backend]|| confirmed?.epoch !== activation.current || confirmed.token !== connectionTokens.current[backend]) return undefined;return connections[backend]?.supply_mode ?? (!modelHubEnabled ? 'direct' : undefined);};- const confirmedSupplyMode = (backend: RuntimeBackendId) => sharedRouteReady()+ const confirmedSupplyMode = (backend: AgentBackendId) => sharedRouteReady()? routeRead.supplies.find((row) => row.backend === backend)?.mode: undefined;const installMode = (backend: RuntimeBackendId) => {@@ -295,7 +316,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onconst detectionTokens = useRef<Record<string, number>>({});const isMissing = (agent: AgentState) => agent.status === 'missing';- const refreshConnection = useCallback(async (name: RuntimeBackendId, { acknowledge = false }: ConnectionRefresh = {}) => {+ const refreshConnection = useCallback(async (name: AgentBackendId, { acknowledge = false }: ConnectionRefresh = {}) => {if (!activeRef.current || pendingEnable.current[name] !== undefined) return;const epoch = activation.current;const intent = enableIntent.current[name];@@ -317,7 +338,11 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onif (!result.ok) throw new Error(result.message || t('onboarding.connection.readFailed'));setConnections((current) => ({ ...current, [name]: result }));setConnectionConfirmed((current) => ({ ...current, [name]: { epoch, token } }));- setAgents((current) => ({ ...current, [name]: { ...current[name], enabled: result.enabled } }));+ // Only a CLI assistant is detected, installed and switched; a built-in one is+ // always on and never enters that state.+ if (isNativeCliBackend(name)) {+ setAgents((current) => ({ ...current, [name]: { ...current[name], enabled: result.enabled } }));+ }// Spending the verdict takes all three: this read still owns the screen, the// caller is an operation that actually answers for it, and the verdict in hand// is the one that was there when the read began. A newer write that landed@@ -339,7 +364,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onif (connectionTokens.current[name] === token) setConnectionPending((current) => ({ ...current, [name]: false }));}}, [api, t]);- const refreshRouteOwnership = (name: RuntimeBackendId) => Promise.all([+ const refreshRouteOwnership = (name: AgentBackendId) => Promise.all([readCardRoutes(name), refreshConnection(name),]).then(([routeReady]) => routeReady);// Being read again is one event with one owner, however it arrives: the shell@@ -350,13 +375,13 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onconst leftSurface = previousRouteSurfaceActive.current && !routeSurfaceActive;previousRouteSurfaceActive.current = routeSurfaceActive;// Returning also collects what a write settled while there was nobody to tell.- if (!isPage && active && !leftSurface) for (const name of ASSISTANT_ORDER) {+ if (!isPage && active && !leftSurface) for (const name of SETUP_LINEUP) {void refreshConnection(name);}// Leaving drops in-flight READS only. A queued enable intent is a write the person// already asked for; invalidating it here would strand `pendingEnable` behind a// completion whose intent check can never pass again.- return () => { for (const name of ASSISTANT_ORDER) {+ return () => { for (const name of SETUP_LINEUP) {connectionTokens.current[name] = (connectionTokens.current[name] || 0) + 1;} };}, [refreshConnection, isPage, active, routeSurfaceActive]);@@ -602,18 +627,48 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on}};+ const [pickerFor, setPickerFor] = useState<BuiltinBackend | null>(null);+ const supplyBlocks = hubSupplyBlocks(data);+ /** Opens the card's route in the route editor, once the read that names it is current. */+ const openRoute = (name: AgentBackendId) => {+ if (!routeTargetReady(name)) return;+ const supply = routeRead.supplies.find((row) => row.backend === name);+ const modelId = routeRead.models[name];+ if (supply?.mode === 'hub' && modelId) {+ setRouteSelection({ agent: supply, modelId,+ read: routeRead.chains[name] ? readyRegion(routeRead.chains[name]) : undefined });+ }+ };+ // A built-in backend is ready when the server can route one of its Agents now — the+ // entry gate's own rule, read from the same named-Agent rows — so the card's Agent+ // and any other runnable Agent on it are judged alike.+ const builtinReady = (backend: BuiltinBackend) => {+ const supply = sharedRouteReady() ? routeRead.supplies.find((row) => row.backend === backend) : undefined;+ return !!supply?.named_agents?.some((row) => routeRunnable(supply, row.name) !== null)+ && !supplyBlocks.get(backend) && !choice.holds(backend)+ && !connectionPending[backend] && !connectionErrors[backend] && !!connections[backend]?.entry_eligible;+ };+ const builtinUnset = BUILTIN_BACKENDS.some((backend) => routeViewFor(backend).kind === 'no-agent-model');+ // A model choice that has not stood holds the whole entry, not only its own backend:+ // entering on another assistant would leave Vibey on a model nobody chose.+ const choiceHeld = BUILTIN_BACKENDS.some((backend) => choice.holds(backend));+const opencodeAgent = agents['opencode'];const requiresSource = canEditSetupRoute && modelHubEnabled;const hasSource = sharedRouteReady() && routeRead.sources.some(usableSource);const needsSource = requiresSource && sharedRouteReady() && !hasSource;const sourceReadFailed = requiresSource && sharedRouteFailed();const sourceReadPending = requiresSource && !sharedRouteReady() && !sourceReadFailed;- const readyBackends = ASSISTANT_ORDER.filter((name) => agents[name].enabled && agents[name].status === 'ok'- && !installingAgents[name] && !detectingAgents[name] && !connectionPending[name]- && !pendingWrites[name] && !refreshingAgents[name] && !connectionErrors[name] && connections[name]?.entry_eligible);+ const readyBackends: AgentBackendId[] = [+ ...ASSISTANT_ORDER.filter((name) => agents[name].enabled && agents[name].status === 'ok'+ && !installingAgents[name] && !detectingAgents[name] && !connectionPending[name]+ && !pendingWrites[name] && !refreshingAgents[name] && !connectionErrors[name] && connections[name]?.entry_eligible),+ ...(isPage ? [] : BUILTIN_BACKENDS.filter(builtinReady)),+ ];const canContinue = isPage ? Object.values(agents).some((agent) => agent.enabled)- : (!requiresSource || hasSource) && readyBackends.length > 0;- const actionBusy = syncing || entering || isAnyInstalling || Object.values(pendingWrites).some(Boolean) || Object.values(refreshingAgents).some(Boolean);+ : (!requiresSource || hasSource) && readyBackends.length > 0 && !choiceHeld;+ const actionBusy = syncing || entering || isAnyInstalling || BUILTIN_BACKENDS.some((backend) => !!choice.picking(backend))+ || Object.values(pendingWrites).some(Boolean) || Object.values(refreshingAgents).some(Boolean);const primaryPending = useRef(false);const handlePrimaryAction = async () => {if (!active || !canContinue || actionBusy || primaryPending.current) return;@@ -677,7 +732,10 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on<p className="onboarding-setup-hint-line text-muted"><span>{t(sourceReadPending ? 'onboarding.providers.actionChecking': sourceReadFailed ? 'onboarding.connection.readFailed'- : needsSource ? 'onboarding.connection.sourceRequired' : 'onboarding.connection.entryHint')}</span>+ : needsSource ? 'onboarding.connection.sourceRequired'+ : choiceHeld ? 'onboarding.connection.builtinChoiceHint'+ : builtinUnset ? 'onboarding.connection.builtinModelHint' : 'onboarding.connection.entryHint',+ { name: getBackendUiMeta(BUILTIN_BACKENDS[0]).label })}</span>{needsSource ? (<Button type="button" variant="link" size="xs" className="h-auto p-0"disabled={actionBusy} onClick={() => onNavigate?.('providers')}>@@ -903,13 +961,30 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, oncoordinates as the intro's — see `.onboarding-stage` in onboarding.css. */}<div className="onboarding-stage"><div className="onboarding-assistants">- {/* No section bar above the cards: the page heading already names the three,- and a second title here pushed them below the line the intro left them on.+ {/* No section bar above the cards: the page heading already names them, and a+ second title here pushed them below the line the intro left them on.Rescanning moved to the footer hint, which is where a person looks once thecards have not told them what they expected. */}- {/* The intro's three tracks, reused rather than restated — see- `.onboarding-assistants-list` in onboarding.css. */}+ {/* The intro's tracks, reused rather than restated — see+ `.onboarding-assistants-list` in onboarding.css — in the lineup's order:+ the built-in assistant first, then the CLI assistants. */}<div className="onboarding-assistants-list">+ {BUILTIN_BACKENDS.map((name) => (+ <BuiltinAssistantRow key={name} backend={name} route={routeViewFor(name)}+ block={supplyBlocks.get(name)} offer={choice.offer(name)}+ picking={choice.picking(name)} failure={choice.failure(name)} onRetryChoice={() => choice.retry(name)}+ connectionPending={connectionPending[name]}+ connectionError={connectionErrors[name] || connections[name]?.message}+ onRefreshConnection={() => void refreshConnection(name, { acknowledge: true })}+ routeError={canEditSetupRoute && modelHubEnabled && routeFailureCurrent(name)+ ? t('settings.models.routeDialog.fail.reconcileRead') : undefined}+ onRetryRoute={() => void readCardRoutes(name)}+ configuringDisabled={syncing || !canEditSetupRoute || !routeTargetReady(name)}+ onConfigure={() => openRoute(name)}+ onPick={(candidate: ModelCandidate) => void choice.choose(name, chosenCandidate(candidate))}+ onAllModels={() => setPickerFor(name)}+ onRetryOffer={() => void readOffer(name)} />+ ))}{ASSISTANT_ORDER.map((name) => {const agent = agents[name];const result = installResults[name];@@ -922,24 +997,13 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on: ownershipConflict ? undefined: connectionMode ?? supplyMode;const hubRoute = mode === 'hub';- const openRoute = () => {- if (mode !== 'hub' || !routeTargetReady(name)) return;- const supply = routeRead.supplies.find(- (row): row is NativeRouteChainSelection['agent'] => row.backend === name,- );- const modelId = routeRead.models[name];- if (supply?.mode === 'hub' && modelId) {- setRouteSelection({ agent: supply, modelId,- read: routeRead.chains[name] ? readyRegion(routeRead.chains[name]) : undefined });- }- };return <AssistantRow key={name} backend={name} status={agent.status || 'unknown'}installing={!!installingAgents[name]} detecting={!!detectingAgents[name]} error={error}onInstall={() => void installAgent(name, mode === 'hub')} onDetect={() => void detect(name, agent.cli_path)}onConfigure={() => {if (!mode) return;if (hubRoute) {- if (canEditSetupRoute) { openRoute(); return; }+ if (canEditSetupRoute) { openRoute(name); return; }navigate(MODEL_HUB_SETTINGS_PATH);return;}@@ -948,7 +1012,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, ononAddKey={() => {if (!mode) return;if (hubRoute) {- if (canEditSetupRoute) { openRoute(); return; }+ if (canEditSetupRoute) { openRoute(name); return; }navigate(MODEL_HUB_SETTINGS_PATH);return;}@@ -1013,6 +1077,15 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on{!onActionChange && permissionNode}</div>{providerDialog}+ {pickerFor && (+ <BackendModelPickerDialog open backend={pickerFor} listedIds={NOTHING_LISTED} choose="one"+ onCancel={() => setPickerFor(null)}+ onAdd={(chosen) => {+ const backend = pickerFor;+ setPickerFor(null);+ if (chosen[0]) void choice.choose(backend, chosen[0]);+ }} />+ )}{canEditSetupRoute && agentReads && (<RouteChainDialog selection={routeSelection} sources={routeRead.sources}onClose={() => {diff --git a/ui/src/components/workbench/AgentsPage.tsx b/ui/src/components/workbench/AgentsPage.tsxindex 056523523..2564c9d80 100644--- a/ui/src/components/workbench/AgentsPage.tsx+++ b/ui/src/components/workbench/AgentsPage.tsx@@ -51,7 +51,7 @@ import { onPageReactivated } from '../../lib/pageActivity';import { useRouteSurfaceActive } from '../../lib/routeSurfaceActivity';import { estimateTokens } from '../../lib/tokenEstimate';import { loadBackendModelsWithRefresh, modelOptionLabel, useAddModelExit } from '../../lib/backendModels';-import { resolveEffortOptions } from '../../lib/effortOptions';+import { compatibleEffort, resolveEffortOptions } from '../../lib/effortOptions';import { WorkbenchPageHeader } from './WorkbenchPageHeader';import { CapabilityTabs } from './CapabilityTabs';// Backend order / labels / accent classes live in lib/backendAccent, shared@@ -2444,10 +2444,7 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, canEdit, ca// keeps an effort the model can't run (Codex P2).const opts = resolveEffortOptions(agent.backend, value, reasoningOptions);if (effort && !opts.includes(effort)) {- // No valid option is itself a valid answer: a model whose catalog- // row states no efforts must clear the field, not keep the old- // value because there was nothing to replace it with.- const fallback = opts.includes('medium') ? 'medium' : opts[0] ?? null;+ const fallback = compatibleEffort(effort, opts);markFieldEdit('effort');markFieldSubmitted('effort');setEffort(fallback);diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex b4dcfa2c3..350b4d360 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -1094,6 +1094,9 @@"picker": {"title": "Add {{backend}} models","description": "Pick the models to add to this backend's list.",+ "chooseTitle": "Choose a {{backend}} model",+ "chooseDescription": "Pick the model to use.",+ "use": "Use this model","search": "Search models or providers","groupBuiltin": "{{backend}} built-in","groupProviders": "From your providers",@@ -5194,30 +5197,38 @@"welcome": {"getStarted": "Get started","title": "Different capabilities. One team.",- "subtitle": "Bring Claude Code, Codex, and OpenCode together",+ "subtitle": "Vibey coordinates Claude Code, Codex, and OpenCode","detecting": "Checking…","detectionFailed": "Could not check your assistants. Try again."},"details": "View details","story": {"label": "Assistants working together",- "description": "Claude Code plans the work, Codex builds it, OpenCode tests it, and Claude Code summarizes the result",- "caption": "Plan · Build · Test · Deliver",- "returnCaption": "Tests passed · back to the PM",- "claude": {- "role": "PM",- "working": "Writing the project brief",- "complete": "Project brief ready",- "summary": "Summarizing the delivery"+ "description": "Vibey plans the work and hands its parts to other agents through the Harness: Claude Code builds it, Codex reviews it, OpenCode tests it, and Vibey summarizes the result",+ "caption": "Plan · Build · Review · Test · Deliver",+ "returnCaption": "Tests passed · back to Vibey",+ "summary": "Summarizing the delivery",+ "vibey": {+ "role": "Coordinator",+ "working": "Planning the work",+ "complete": "{{count}} tasks handed off"},- "codex": {+ "claude": {"role": "Developer",+ "step": "Build","working": "Writing code","complete": "Implementation ready"},+ "codex": {+ "role": "Reviewer",+ "step": "Review",+ "working": "Reviewing the change",+ "complete": "Review passed"+ },"opencode": {"role": "Tester",- "working": "Writing and running tests",+ "step": "Test",+ "working": "Running tests","complete": "All tests passed"}},@@ -5263,7 +5274,17 @@"defaultModelWithBackups_other": "Default model · {{count}} backups","noteNoModels": "No usable model yet","ownershipChanged": "Connection changed. Refresh to continue",- "noteModelUnset": "No model set yet; you can set one later in Model Hub"+ "noteModelUnset": "No model set yet; you can set one later in Model Hub",+ "builtinAlwaysOn": "Built-in · always on",+ "noteBuiltinUnset": "No model yet. Pick one to start.",+ "noteGatewayOff": "Model gateway is off. {{name}} needs it to run.",+ "noteHubDisabled": "Model Hub is disabled on this instance. {{name}} needs it to run.",+ "pickModelNamed": "Pick a model for {{name}}",+ "allModels": "All models…",+ "modelsUnreadable": "Could not read the models.",+ "noModelsToPick": "No provider supplies a model yet.",+ "suppliersChanged": "This model's providers changed. Pick it again.",+ "modelPickFailed": "Could not save the model. Try again."},"connection": {"method": "Connection method",@@ -5345,7 +5366,9 @@"modelUnavailable": "No assistant can reach a model yet. Check your connections and try again.","credentialType": "Credential type","apiKeyLabel": "API Key",- "authTokenLabel": "Auth Token"+ "authTokenLabel": "Auth Token",+ "builtinModelHint": "Pick a model for {{name}}, or enable an assistant, to enter the workspace",+ "builtinChoiceHint": "Finish choosing {{name}}'s model to enter the workspace"},"brand": {"name": "Avibe",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 9a97d4767..36b076761 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -1094,6 +1094,9 @@"picker": {"title": "添加 {{backend}} 模型","description": "挑选要加入这个后端模型列表的模型。",+ "chooseTitle": "选择 {{backend}} 的模型",+ "chooseDescription": "选择要使用的模型。",+ "use": "使用此模型","search": "搜索模型或供应商","groupBuiltin": "{{backend}} 内置","groupProviders": "来自你的供应商",@@ -5194,30 +5197,38 @@"welcome": {"getStarted": "立即开始","title": "各有所长,接力完成",- "subtitle": "让 Claude Code、Codex、OpenCode 一起工作",+ "subtitle": "由 Vibey 统筹,Claude Code、Codex、OpenCode 接力完成","detecting": "检测中…","detectionFailed": "未能检测助手,请重试"},"details": "查看详情","story": {"label": "助手接力协作",- "description": "Claude Code 规划任务,Codex 编写代码,OpenCode 执行测试,最后由 Claude Code 汇总交付",- "caption": "规划 · 开发 · 测试 · 交付",- "returnCaption": "测试通过,回传 PM",- "claude": {- "role": "PM",- "working": "编写需求文档",- "complete": "需求文档已就绪",- "summary": "汇总结果,完成交付"+ "description": "Vibey 规划任务,并通过 Harness 把各部分交给其他助手:Claude Code 编写代码,Codex 评审改动,OpenCode 执行测试,最后由 Vibey 汇总交付",+ "caption": "规划 · 开发 · 评审 · 测试 · 交付",+ "returnCaption": "测试通过,回传 Vibey",+ "summary": "汇总结果,完成交付",+ "vibey": {+ "role": "统筹",+ "working": "规划任务",+ "complete": "已分派 {{count}} 项任务"},- "codex": {+ "claude": {"role": "开发",+ "step": "开发","working": "编写功能代码","complete": "功能代码已就绪"},+ "codex": {+ "role": "评审",+ "step": "评审",+ "working": "评审代码改动",+ "complete": "评审通过"+ },"opencode": {"role": "测试",- "working": "编写并执行用例",+ "step": "测试",+ "working": "执行测试用例","complete": "测试全部通过"}},@@ -5263,7 +5274,17 @@"defaultModelWithBackups_other": "默认模型 · 另有 {{count}} 个备选","noteNoModels": "还没有可用的模型","ownershipChanged": "连接状态已变化,请刷新后继续",- "noteModelUnset": "尚未设置模型,可稍后在模型网关中设置"+ "noteModelUnset": "尚未设置模型,可稍后在模型网关中设置",+ "builtinAlwaysOn": "内置 · 始终开启",+ "noteBuiltinUnset": "还没有模型,选一个即可开始",+ "noteGatewayOff": "模型网关已关闭,{{name}} 需要它才能运行",+ "noteHubDisabled": "本实例已停用模型网关,{{name}} 需要它才能运行",+ "pickModelNamed": "为 {{name}} 选择模型",+ "allModels": "全部模型…",+ "modelsUnreadable": "未能读取模型",+ "noModelsToPick": "还没有供应商提供模型",+ "suppliersChanged": "该模型的供应商已变化,请重新选择",+ "modelPickFailed": "未能保存模型,请重试"},"connection": {"method": "连接方式",@@ -5345,7 +5366,9 @@"modelUnavailable": "还没有助手能用上模型,请检查连接后重试","credentialType": "凭据类型","apiKeyLabel": "API Key",- "authTokenLabel": "Auth Token"+ "authTokenLabel": "Auth Token",+ "builtinModelHint": "为 {{name}} 选择模型或启用一个助手,即可进入工作台",+ "builtinChoiceHint": "完成 {{name}} 的模型选择后即可进入工作台"},"brand": {"name": "Avibe",diff --git a/ui/src/lib/agentBackends.ts b/ui/src/lib/agentBackends.tsindex 9f9bb6a2b..366a2ac65 100644--- a/ui/src/lib/agentBackends.ts+++ b/ui/src/lib/agentBackends.ts@@ -8,6 +8,7 @@ type BackendDescriptor = (typeof BACKEND_CATALOG)[number];export type AgentBackendId = BackendDescriptor['id'];export type NativeCliBackend = Extract<BackendDescriptor, { capabilities: { supports_cli: true } }>['id'];export type WebOAuthBackend = Extract<BackendDescriptor, { capabilities: { supports_web_oauth: true } }>['id'];+export type BuiltinBackend = Extract<BackendDescriptor, { builtin: true }>['id'];export type BackendId = string;type BackendCapabilities = { [K in keyof BackendDescriptor['capabilities']]: boolean };@@ -110,6 +111,15 @@ export const NATIVE_CLI_BACKENDS = BACKEND_CATALOGexport const NATIVE_SETUP_BACKENDS = [...NATIVE_CLI_BACKENDS].sort((left, right) => BACKEND_VISUALS[left].nativeOrder - BACKEND_VISUALS[right].nativeOrder);+/** Backends that are part of the platform: no CLI to install, always enabled. */+export const BUILTIN_BACKENDS = BACKEND_CATALOG+ .filter((backend): backend is Extract<BackendDescriptor, { builtin: true }> => backend.builtin)+ .map((backend) => backend.id);++export function isBuiltinBackend(id: string): id is BuiltinBackend {+ return (BUILTIN_BACKENDS as readonly string[]).includes(id);+}+export function isNativeCliBackend(id: string): id is NativeCliBackend {return (NATIVE_CLI_BACKENDS as readonly string[]).includes(id);}diff --git a/ui/src/lib/effortOptions.ts b/ui/src/lib/effortOptions.tsindex 5b59b7afc..e1dc1c0b4 100644--- a/ui/src/lib/effortOptions.ts+++ b/ui/src/lib/effortOptions.ts@@ -104,6 +104,17 @@ export function resolveEffortOptions(return values.length ? values : effortOptionsFor(backend);}+/**+ * The effort to keep when an Agent moves to a model offering `options`: the current one+ * if the model takes it, otherwise medium where offered, otherwise the first option.+ * No option is itself an answer — a model that states no efforts clears the field+ * rather than keeping a value it cannot run.+ */+export function compatibleEffort(effort: string | null | undefined, options: readonly string[]): string | null {+ if (!effort || options.includes(effort)) return effort ?? null;+ return options.includes('medium') ? 'medium' : options[0] ?? null;+}+export function isEffortSupported(backend: string,model: string | null | undefined,