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(ui): implement shared first-use Welcome and assistant setup (#2015)
Max0d3e44de245e
diff --git a/AGENTS.md b/AGENTS.mdindex e5f7220fe..fa5f77fd6 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -218,6 +218,7 @@ Source-of-truth rule:### PR Delivery+- Codex review is triggered automatically by cyhhao after pushes; never post manual review triggers, and report automation gaps to the orchestrator while retaining the exact-head review gate.- load and follow the `pr-delivery-loop` skill for every implementation task;it owns the detailed procedure, but cannot weaken the baseline below- regardless of Skill resolution, use a task branch/worktree, record the changediff --git a/docs/plans/2026-09-17-issue-2010-first-use.md b/docs/plans/2026-09-17-issue-2010-first-use.mdnew file mode 100644index 000000000..4f0ca91de--- /dev/null+++ b/docs/plans/2026-09-17-issue-2010-first-use.md@@ -0,0 +1,108 @@+# Issue #2010: shared first-use presentation++## Change contract++Welcome and assistant installation use the same React surfaces on Web and Desktop.+The existing logo, platform icons, lifecycle APIs, provider configuration entry,+setup persistence and authorization remain owned by their current components.+No Python, ApiContext, Tauri, Model Hub, Settings shell or Workbench change belongs+in this slice. Issue #2011 owns credential confirmation and the final workspace gate.++Welcome checks the three CLI paths before advancing. A failed check remains on+Welcome with retry/details. The setup rows stay in Claude Code, Codex, OpenCode+order. Each installation and detection updates only that row; failures retain+other results. Runtime updates remain optional through BackendLifecycleChip.+Connection styling is a presentation input only; executable discovery cannot+produce a connected claim.++The existing Configure provider modal stays unchanged. Continue still leads to+platform selection and the existing Summary completion action. Enable controls+and the existing OpenCode permission policy remain available until #2011 replaces+the completion contract. These are intentional intermediate-slice differences+from the final connected setup design, not new readiness rules.++## Design evidence++Read through the installed Pencil MCP on 2026-09-17, using only Get and Export:++- Welcome: `bi8Au`, `J0qaZ`, `P8iLm0`.+- Installation: `i3vw9`, `lm7mN`, `ktRgC`.+- Hover: `mK2JX`, `ZaXoW`, `X7N2Z`.+- Awaiting connection: `ICidc`, `S3mLYc`, `HR3ps`.+- Upgrade: `I9Q8VD`, `pHiuw`, `QPdWU`.+- Connected: `F8RLgR`, `r1IQ0B`, `xNmhX`.++The final document has Chinese Dark/Light and English Dark boards, with no+separate English Light board. Validate English under the same Light tokens.+Native titlebars are omitted on Web. Existing BrandLogo and BackendIcon assets+remain authoritative. Shared semantic palette/glow tokens are reused without+changing the global theme. Card sizes, row sizes, spacing and typography follow+the final frames; small viewports stack cards and wrap row actions.++One 8.9-second clock owns all collaboration states and pulses. Reduced motion+shows all work complete. Pause/replay also pauses access-tile idle emphasis;+hover and keyboard focus suspend idle emphasis without moving the labels.++## Validation plan++- Focused Vitest: handoff boundaries, reduced motion, pause/replay, access tiles,+ detection retry, independent installs, configuration entry and unchanged saves.+- Existing wizard mutation and backend/runtime tests.+- UI build, lint, theme validation and scenario-catalog validation.+- Isolated browser checks for both languages/themes and a narrow viewport.+- Exact-head Codex review, all required CI, zero unresolved review threads.++No real backend login or live credential readiness claim is made in this slice.++## Review circuit-breaker decision (2026-09-17)++PM independently verified the full PR #2015 inventory at `03e1004fb`:+`e1504ffc4` review 5232344841 found premature Back navigation (resolved thread+PRRT_kwDOPbFPYs6jPxPy); `03e1004fb` review 5232430397 found overlapping provider+reconciliation (open PRRT_kwDOPbFPYs6jP88p) and stale installation errors after+successful detection (open PRRT_kwDOPbFPYs6jP88t). Two findings-bearing heads share+the synchronization/navigation class, triggering the breaker. Both lint runs+35192733742 and 35193718025 failed the same dynamic i18n key coverage check.++PM authorized a local repair: admit only one provider configuration/reconciliation+at a time, return the final live rows from both navigation actions without replaying+a pre-detection snapshot, clear only obsolete failed-install evidence after a+current successful detection, and use a literal Claude summary translation key.+Deferred config/probe consumer tests must preserve canonical non-ASCII paths,+provider fields, local enable toggles, other rows and independent installations.+The existing owner remains sufficient; no auth/readiness model rewrite is allowed.+PM must spot-check the concrete diff and tests before the next push.++Keep the original combined Watch/cursor. Owner policy prohibits manual Codex review+triggers: cyhhao triggers automatically after pushes; report any automation gap to+PM. Exact-head review, CI and thread gates remain required. No merge or #2011 work.++PM approved the seven-file repair before push at 15:47 Asia/Shanghai after reading+the working diff, modal/navigation paths, consuming tests and red/green logs.+PM independently ran AssistantSetup and keyCoverage: 2 files / 26 tests passed.+The diagnosed two-head breaker is released for this bounded repair only; any+new repeated-class findings require a fresh independent diagnosis before edits.++## Local evidence++- Breaker repair reproduced Configure admission, Continue replaying a missing+ status/noncanonical path, and obsolete install error projection before fixes.+ Consumer tests cover two deferred configuration cycles through Back and+ Continue, independent installation, unsuccessful probes and stale-token success.+ Focused checks (81 tests including key coverage, wizard mutation, lifecycle and+ authorization consumers), UI build/lint, test typechecks and theme/catalog pass.+- UI build, lint, theme validation, and scenario-catalog validation passed.+- Focused Vitest covers the timeline, Welcome/controller behavior, independent+ row installs, upgrade availability, existing configuration entry and wizard+ config mutations. Existing setup authorization tests are included in the pass.+- Isolated Playwright used the production build, with all API requests fulfilled+ in the browser and all external origins blocked. Eight combinations (en/zh,+ light/dark, 1200/390 pixels) reached Welcome, detected assistants, entered setup+ and returned. No page errors, real writes, or horizontal overflow occurred.+ Desktop rows measured 880 by 88 pixels. Reduced motion completed all three cards.+- Browser screenshots and measurements: `/tmp/issue2010-browser/` in the lane+ environment. Pencil exports: `/tmp/issue2010-design/`. These are local evidence,+ not shipped assets or a claim of completed owner visual acceptance.+- Owner visual acceptance and real isolated runtime installation remain manual.+ PM explicitly authorized API-mocked browser validation for this slice; the+ Incus runner was not used because it writes primary-checkout runtime metadata.diff --git a/docs/plans/2026-09-17-shared-web-desktop-design.md b/docs/plans/2026-09-17-shared-web-desktop-design.mdnew file mode 100644index 000000000..a62a9b775--- /dev/null+++ b/docs/plans/2026-09-17-shared-web-desktop-design.md@@ -0,0 +1,115 @@+# Shared Web and Desktop design implementation++## Issue map (created before implementation)++The owner requested 3–4 clear, independently reviewable GitHub issues. The following four issues are the implementation boundaries; no implementation has started from them:++1. [#2010 — Shared first-use Welcome and assistant setup](https://github.com/avibe-bot/avibe/issues/2010)+2. [#2011 — Shared backend connection and setup readiness](https://github.com/avibe-bot/avibe/issues/2011)+3. [#2012 — Shared Workbench shell and General Settings](https://github.com/avibe-bot/avibe/issues/2012)+4. [#2013 — Desktop integration and native Settings menu](https://github.com/avibe-bot/avibe/issues/2013)++Issues #2010–#2012 are shared React/Python Web/Desktop work and can be accepted one at a time. Issue #2013 starts only after the first three accepted results are in the shared master path and targets the long-lived `desktop` branch. Each issue body records its reuse points, acceptance criteria, and out-of-scope boundary. The issue comments record the dependency order.++## Current status: implementation started for #2010 only++Owner session: `sestqz5wvu5ty`. Active scope confirmed: 2026-09-17 15:36 Asia/Shanghai.++The owner confirmed the complete design set on 2026-09-17 13:14 Asia/Shanghai and requested issue-first delivery. Issue #2010 is now the only active implementation slice. Do not dispatch #2011, #2012, or #2013 until #2010 is accepted by the owner. The source SHA below records the planning baseline; implementation code remains isolated in its assigned worktree.++The implementation agent must inspect the complete final Dark/Light and Chinese/English design set through Pencil before coding. The implementation lanes and technical contracts below describe the active #2010 slice and the later queued slices.++## Owner decisions and delivery boundary++- Implement the common React/Python application from latest `origin/master` first.+- Then bring the shared work into the existing `desktop` integration branch and implement native-only behavior there. The existing Tauri shell is the host; native menus/window controls are not HTML product UI.+- One installed assistant with one successfully applied subscription or API-key connection is sufficient to enter the workspace. Existing valid connections count. The user explicitly clicks Enter workspace; successful authorization alone never completes setup.+- Reuse Settings -> Backends authorization and save semantics. Reuse the existing AgentRoutePicker and DirectoryBrowser interactions.+- Keep existing product logo assets. Logo exploration boards are out of scope.+- The design is shared by Web and Desktop. The owner approved the complete design set on 2026-09-17; implementation must align both themes and languages together, preserve System mode, and use existing i18n ownership.+- Current authorization covers implementation of #2010 only, followed by owner acceptance. Shared master work precedes desktop-specific integration; merging, releasing, or changing the local running service requires its own applicable authorization.++Planning source snapshot: `7c028d74ebc4eb82b39a09991fcb09c8400253b0`.+Design source: `/Users/max/workspace/ai/avibe/avibe-docs/design_desktop.pen`.+Read design via native Pencil MCP (the document is already open); never edit/save the owner's working design. Use shared `design.pen` for referenced existing pickers.+Related handoff: `/Users/max/workspace/ai/avibe/avibe-docs/docs/plans/2026-09-15-desktop-first-task-design.md`. Latest owner decisions and latest Dark root annotations supersede older conflicting onboarding notes.++## User outcome and acceptance invariants++1. A new user reaches a usable workspace through Welcome -> three fixed assistant rows -> Enter workspace, without configuring IM first. Settings remains the optional destination for platform setup.+2. Readiness is based on installed executable plus effective applied authentication, never executable presence, a selected radio, a rendered device code, or a locally optimistic success flag. Preserve existing valid native authentication and all saved product state. One incomplete backend cannot block another ready backend.+3. Every connection stays targeted to its originating backend. OpenCode provider selection uses the installed runtime provider-auth catalog. Active flows lock method changes. Close/Escape/cancel share cancellation and preserve previously saved credentials. Errors preserve editable input. Save success refreshes effective state before rendering connected.+4. Config mutation is narrow and concurrent-safe; setup completion retains the existing `setup_completed` ownership and controller reconciliation. Neither render nor detection writes credentials, enables remote access, or marks setup complete. No second service restart after accepted backend reconciliation.+5. Existing installations, Members, remote sessions, and recovery routes retain their current authorization and setup access rules. Setup is a one-time completion gate, not a new continuing requirement that locks existing users out after credential expiry.+6. Task suggestions populate an editable draft and focus it. Agent and directory selection preserve draft and existing session semantics. No selection sends a message. Directory belongs to the current instance and respects permissions; existing project find-or-create behavior owns directory identity.+7. Ordinary Settings entry opens General; explicit backend/platform/remote links retain destinations. Leaving Settings restores the underlying conversation/project, draft, and selection.+8. Shared UI remains usable at mobile widths and with keyboard/reduced-motion, and in English/Chinese and existing light/dark/system modes. 1200x800 is the desktop design reference, not a fixed browser viewport.+9. Existing project/session/inbox data, authorization gates, Apps, Memory, and permissions remain reachable. Mock-only example data and omitted settings are not product migrations.++## Draft cross-lane contracts for final design reconciliation++### Existing routes and config++- `Wizard` remains exported from `ui/src/components/Wizard.tsx` and mounted at `/setup`; it keeps owning setup orchestration. Shared shell lane does not change AuthGuard logic without an agreed contract amendment.+- Setup producer writes the existing `setup_completed` through current narrow config mutation APIs only on the explicit completion action. The existing AuthGuard is the consumer. Preserve mode/platform migration semantics.+- On successful setup completion, navigate to `/` with React Router state `{ onboardingCompleted: true }`. This field means only that this navigation followed completed setup. It never authorizes access or fabricates backend availability.+- Workbench consumes `onboardingCompleted` for the one-time dismissible readiness banner. Its Agent label comes from actual currently available Agent/default resolution. Ordinary returning-user navigation has no banner. Do not add a global event bus or persistent onboarding database.+- Ordinary settings landing: `/settings/general`. Explicit destinations: `/settings/backends`, `/settings/platforms`, `/settings/remote-access`; backend management `/settings/backends/claude`, `/settings/backends/codex`, `/settings/backends/opencode` (verify existing route spellings before use; a mismatch is an amendment request).+- Existing auth API types and methods in ApiContext remain canonical. No speculative API or persistence schema is preallocated. Onboarding lane owns any necessary additive Python/API field work and reports the exact change before a consumer is added outside its lane.++### Styling and localization++- Reuse existing theme variables. Shell lane owns `ui/src/index.css` and primitives; onboarding lane owns its component-scoped styles and uses existing variables so each lane builds independently.+- No new package dependency is expected; existing framer-motion, Radix, Lucide and React are sufficient.+- Shared i18n JSON files are divided by key ownership: onboarding owns only new `onboarding.*` subtree and necessary existing `welcome.*`/wizard/auth keys; shell owns only new `sharedWorkspace.*` and `settings.general.*` plus necessary workbench/navigation keys. Do not reformat whole JSON or modify sibling keys. These two files are the only permitted file overlap, with disjoint key edits; orchestrator verifies integration by key, not by trusting text merge.+- Existing brand logos remain unchanged. No new generated brand assets.++## Proposed implementation lanes and exclusive file ownership++### O: onboarding and authentication (Codex)++Owns `ui/src/components/Wizard.tsx`, `steps/Welcome.tsx`, `steps/AgentDetection.tsx`, setup-only step/support files, a new `components/onboarding/` subtree, `settings/BackendOAuthPanel.tsx`, `settings/oauth/`, `settings/providers/`, `settings/shared/` auth/runtime helpers, `settings/BackendLifecycleChip.tsx`, `context/ApiContext.tsx` only if necessary, `lib/wizardConfigMutations*`, and directly related tests. Owns necessary minimal Python changes in `vibe/api.py`, `vibe/ui_server.py`, `config/v2_config.py`, existing backend auth/setup owners, focused Python tests and `tests/scenarios/auth_setup/`. Scope expansions are reported before editing.++No-touch: shell lane files, global CSS, App routing/AuthGuard, Workbench/Composer/pickers, native desktop tree, all Model Hub implementation under `settings/models/`, brand assets, sibling i18n keys. Reuse Model Hub icons/utilities read-only only when semantics match, never divert Backends auth into hub storage.++Deliver fixed-order Claude Code/Codex/OpenCode cards with independent install/error/retry states, compact auth dialog family and existing management for connected controls. OpenCode execution-permission policy stays owned by its existing path and may not turn an unrelated backend into a global setup blocker; if this conflicts with the approved enter criterion, report with a smallest scoped recommendation.++### S: shared shell, homepage, General and tokens (Claude)++Owns `ui/src/index.css`, relevant existing primitive/visual presentation except brand assets, `components/AppShell.tsx`, `components/Workbench.tsx`, `components/workbench/WorkbenchSidebar.tsx`, `Composer.tsx`, the existing project/folder presentation glue and `lib/useNewSession.ts` only as needed; new shared-home components; `App.tsx` General route ONLY; `settings/SettingsLayout*`, `SettingsOverlay*`, `SettingsPageShell*`, new General page, `LanguageSwitcher*`, ThemeProvider/presentation helpers, `lib/adminNavigation*`, `lib/settingsRoutes*`, `lib/settingsOverlay*`, relevant keyboard/geometry helpers and directly related tests. Preserve existing picker internals unless a bounded trigger customization is required.++No-touch: onboarding lane files and Python, auth/provider/runtime helpers, ApiContext, Wizard/steps, Model Hub implementation, native desktop tree, brand assets, sibling i18n keys. Report geometry changes needed outside this scope before editing.++Deliver sidebar248 with header search/inbox and actual count; fixed navigation group; bottom Apps/Settings. Workbench has three draft-seeding cards, shared Composer with existing AgentRoutePicker and DirectoryBrowser, real one-time readiness banner, mobile continuation /settings/remote-access and messaging /settings/platforms. General uses existing theme/language ownership and explicit three-choice theme cards. Preserve non-owner language behavior and existing authorization rules.++## Design inventory and implementation guidance++- Welcome `bi8Au`: width1200x800 reference, no fake native titlebar in Web. Content max880; heading and three240x228 collaboration cards. Shared8.9s animation: PM0-1.5, handoff1.5-2.25, Codex2.25-3.75, handoff3.75-4.5, tests4.5-6, return6-7, PM summary7-8.9. Reduced motion shows completed. Six equal access tiles in two rows are descriptive; icon hover/focus1.18/180ms, idle emphasis every2s pauses during interaction/reduced motion. Start performs/reuses detection.+- Setup `i3vw9`, `mK2JX`, `ICidc`, `I9Q8VD`, `F8RLgR`: content max880, fixed three rows88px, radius12, logo well44, actions34. Hover changes border/glow only. Upgrade availability stays usable and is not completion gate. Compare live annotation before assigning any experimental per-frame color; shared semantic tokens remain default.+- Auth boards `V0zHJ`, `OHULW`, `MvT2k`, `oLe1U`, `FwRTK`, `laAX1`, `MtOWg`, `KWKHX`, `JtVGU`, `r2y97O`, `D6uRiy`, `MGCD0`: common568px dialog family, backend-specific fields. Settings->Backends auth/save semantics outrank old Model Hub reuse annotations. Claude auth token supported, Codex device flow, OpenCode device/browser/manual callback only when provider runtime requests that specific mode.+- Workspace `n0PzOn`: sidebar248, desktop padding28/48, heading30/600, task cards Explore project/Research question/Make plan. Composer radius16/padding18; inputs remain editable. Selector reference `uifbM` is reuse guidance, not a new page.+- Sidebar `DkNTK`: icon buttons32, navigation40 with2px gap, selected mint/border/glow, gray hover. Keep authorization-aware visibility. No collapsed capability group on desktop.+- General `r6G6P`: settings sidebar196, main padding30/40, heading27/600, language select190x40, System/Light/Dark previews, autosave, return to prior surface.+- `oc7yB` native application-menu behavior belongs to desktop follow-on only. Handoff boards are references; logo boards are excluded.++## Verification and delivery gates++Each issue uses an isolated worktree and a real non-draft PR targeting `master`, never merges without authorization. Delivery is sequential: #2010 is active from the committed contract baseline; prepare each subsequent issue from current master only after the preceding issue is accepted. Do not dispatch the historical parallel lane plan as an active mandate or stack product PRs.++Load `pr-delivery-loop` and `background-watch-hook`; use exact-head Codex bot pass, zero unresolved threads across all heads, and all expected CI successful. One forever combined PR/CI watch per lane with timeout0; notify orchestrator at first PR creation so it arms its independent gate watch before subsequent pushes. Inventory findings by reviewed head and root-cause class before fixing; repeated class on two reviewed heads or three findings heads after model rewrite stops patching for orchestrator diagnosis.++Run focused behavior tests, auth_setup scenario cases when auth changes, required UI build and theme/i18n validation, and Ruff on changed Python before push. Test state must be isolated from real HOME/config/keychains/services. Never restart local Avibe. For #2010 PM authorized fully API-mocked isolated browser checks; do not use the Incus runner, which writes primary-checkout metadata. At final integration check both actual boundaries together, including non-ASCII draft/directory and Settings return, and record visual evidence against exported Dark frames. Unit/mock success is not a live OAuth/network claim.++## Follow-on and pending inputs++- The complete design set and #2010 start signal were received. #2011–#2013 remain queued until owner acceptance of each preceding issue; #2010 review repairs retain its existing authentication and completion boundaries.+- Stage2 native desktop: after shared work is integrated, update from the shared master result and implement system Settings/menu/window specifics in desktop-based task worktrees. Preserve loopback/capability boundaries and existing lifecycle. No desktop->master wholesale merge is implied.+- Master merge and release: wait for explicit owner instruction after concrete PR gates and acceptance evidence.++## Earlier pause verification++On 2026-09-17, two implementation runs had been dispatched before the owner clarified the design-completion gate. Both were canceled and their session queues were verified empty. Both isolated implementation worktrees remained clean at the contract-only commit `ee14c1ad9`; neither had product-code changes or later implementation commits. The scheduled implementation liveness task was removed and no implementation watch remained armed. These earlier sessions remain canceled. The current #2010-only dispatch supersedes that pause for its assigned worktree; the shared-shell lane remains inactive.++- Onboarding: session `sestvg9hbksrs`, canceled run `2c40a884e87f`, branch `feat/shared-onboarding`.+- Shared shell/home/General: session `seshdfv3uqjxj`, canceled run `54372ae4d030`, branch `feat/shared-workspace-ui`.+- Historical contract baseline: branch `feat/shared-web-design-contract`. Its pause instruction was superseded for #2010 by the active issue-specific plan; it does not authorize starting the other issue lanes.diff --git a/ui/eslint-baseline.json b/ui/eslint-baseline.jsonindex d21082592..991b48d1c 100644--- a/ui/eslint-baseline.json+++ b/ui/eslint-baseline.json@@ -84,9 +84,6 @@"src/components/steps/WeChatConfig.tsx": {"@typescript-eslint/no-explicit-any": 4},- "src/components/steps/Welcome.tsx": {- "@typescript-eslint/no-explicit-any": 1- },"src/components/ui/secret-request-card.tsx": {"react-hooks/set-state-in-effect": 1},diff --git a/ui/src/components/Wizard.tsx b/ui/src/components/Wizard.tsxindex 689b9f5ba..a5c1c6ea6 100644--- a/ui/src/components/Wizard.tsx+++ b/ui/src/components/Wizard.tsx@@ -1,5 +1,5 @@import React, { useEffect, useState } from 'react';-import { motion, AnimatePresence } from 'framer-motion';+import { motion, AnimatePresence, useReducedMotion } from 'framer-motion';import { useTranslation } from 'react-i18next';import { Welcome } from './steps/Welcome';import { PlatformSelection } from './steps/PlatformSelection';@@ -22,11 +22,13 @@ import {collectWizardEnabledPlatformDelta,type WizardEnabledPlatformDelta,} from '../lib/wizardConfigMutations';-import { WizardChrome } from './visual';+import { BrandLogo, WizardChrome } from './visual';+import { LanguageSwitcher } from './LanguageSwitcher';export const Wizard: React.FC = () => {const { t } = useTranslation();const api = useApi();+ const reducedMotion = useReducedMotion();const [currentStep, setCurrentStep] = useState(0);const [data, setData] = useState<any>({show_duration: false,@@ -179,7 +181,8 @@ export const Wizard: React.FC = () => {}};- const back = () => {+ const back = (stepData?: { agents: Record<string, unknown> }) => {+ if (stepData?.agents) setData((current: Record<string, unknown>) => ({ ...current, agents: stepData.agents }));if (currentStep > 0) {setCurrentStep(currentStep - 1);}@@ -239,6 +242,20 @@ export const Wizard: React.FC = () => {const progressTotal = steps.length;const progressIndex = steps.findIndex((step) => step.id === stepId);+ if (isWelcome || stepId === 'agents') {+ return (+ <div className="onboarding-shell">+ <header>+ <div className="flex items-center gap-2.5"><BrandLogo size={32} /><span className="text-sm font-semibold">Avibe</span></div>+ <LanguageSwitcher />+ </header>+ <main className="onboarding-shell-content">+ <CurrentComponent data={data} onNext={next} onBack={back} isFirst={currentStep === 0} isLast={currentStep === steps.length - 1} />+ </main>+ </div>+ );+ }+return (<divclassName={clsx(@@ -263,10 +280,10 @@ export const Wizard: React.FC = () => {<AnimatePresence mode="wait"><motion.divkey={currentStep}- initial={{ opacity: 0, y: 12 }}+ initial={reducedMotion ? false : { opacity: 0, y: 12 }}animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -8 }}- transition={{ duration: 0.18 }}+ exit={reducedMotion ? undefined : { opacity: 0, y: -8 }}+ transition={{ duration: reducedMotion ? 0 : 0.18 }}className="w-full"><CurrentComponentdiff --git a/ui/src/components/onboarding/AccessTiles.tsx b/ui/src/components/onboarding/AccessTiles.tsxnew file mode 100644index 000000000..bc791bcec--- /dev/null+++ b/ui/src/components/onboarding/AccessTiles.tsx@@ -0,0 +1,38 @@+import { useEffect, useState } from 'react';+import { useReducedMotion } from 'framer-motion';+import { useTranslation } from 'react-i18next';+import { PlatformIcon } from '../visual';++const PLATFORMS = ['avibe', 'slack', 'discord', 'telegram', 'lark', 'wechat'];++export function AccessTiles({ paused }: { paused: boolean }) {+ const { t } = useTranslation();+ const reducedMotion = useReducedMotion() === true;+ const [pointerInside, setPointerInside] = useState(false);+ const [focusInside, setFocusInside] = useState(false);+ const [emphasis, setEmphasis] = useState<number | null>(null);+ const automatic = !paused && !reducedMotion && !pointerInside && !focusInside;+ useEffect(() => {+ if (!automatic) return;+ const timer = window.setInterval(() => {+ setEmphasis((previous) => previous === null ? Math.floor(Math.random() * PLATFORMS.length)+ : (previous + 1 + Math.floor(Math.random() * (PLATFORMS.length - 1))) % PLATFORMS.length);+ }, 2000);+ return () => window.clearInterval(timer);+ }, [automatic]);++ return (+ <section className="onboarding-access" aria-label={t('onboarding.access.label')}>+ <p>{t('onboarding.access.description')}</p>+ <ul className="onboarding-access-grid" onPointerEnter={() => setPointerInside(true)} onPointerLeave={() => setPointerInside(false)}+ onFocus={() => setFocusInside(true)} onBlur={(event) => { if (!event.currentTarget.contains(event.relatedTarget)) setFocusInside(false); }}>+ {PLATFORMS.map((platform, index) => (+ <li key={platform} tabIndex={0} className="onboarding-access-tile" data-emphasis={automatic && emphasis === index}>+ <span className="onboarding-access-icon"><PlatformIcon platform={platform} size={22} aria-hidden="true" /></span>+ <span>{t(`onboarding.access.${platform}`)}</span>+ </li>+ ))}+ </ul>+ </section>+ );+}diff --git a/ui/src/components/onboarding/AssistantRow.tsx b/ui/src/components/onboarding/AssistantRow.tsxnew file mode 100644index 000000000..d3e36244d--- /dev/null+++ b/ui/src/components/onboarding/AssistantRow.tsx@@ -0,0 +1,69 @@+import type { ReactNode } from 'react';+import { Check, Download, RefreshCw, Sliders } 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 } from '@/lib/agentBackends';+import type { AssistantId } from './collaborationTimeline';++export interface AssistantRowProps {+ backend: AssistantId;+ status: 'unknown' | 'ok' | 'missing';+ installing: boolean;+ detecting: boolean;+ error?: { message: string; output?: string | null };+ lifecycle: ReactNode;+ enabledControl: ReactNode;+ onInstall: () => void;+ onDetect: () => void;+ onConfigure: () => void;+ configuringDisabled?: boolean;+ /** Presentation only. The connection owner must supply confirmed state. */+ connection?: 'subscription' | 'api_key';+}++export function AssistantRow({ backend, status, installing, detecting, error, lifecycle, enabledControl,+ onInstall, onDetect, onConfigure, configuringDisabled = false, connection }: AssistantRowProps) {+ const { t } = useTranslation();+ const label = getBackendUiMeta(backend).label;+ return (+ <Card className="onboarding-assistant" aria-label={label}>+ <div className="onboarding-assistant-main">+ <div className="onboarding-assistant-logo"><BackendIcon backend={backend} variant="glyph" size={28} aria-hidden="true" /></div>+ <div className="onboarding-assistant-identity">+ <h3>{label}</h3>+ <p title={t(`onboarding.setup.${backend}Description`)}>{t(connection ? `onboarding.setup.${connection}` : `onboarding.setup.${backend}Description`)}</p>+ </div>+ <div className="onboarding-assistant-status">+ {installing || detecting || status === 'unknown' ? (+ <Badge variant="secondary"><RefreshCw size={12} className={installing || detecting ? 'motion-safe:animate-spin' : ''} />+ {t(installing ? 'agentDetection.installing' : detecting ? 'onboarding.welcome.detecting' : 'common.notChecked')}+ </Badge>+ ) : status === 'ok' ? lifecycle : (+ <Badge variant={error ? 'destructive' : 'secondary'}><span className="size-2 rounded-full bg-current" />+ {t(error ? 'onboarding.setup.installFailed' : 'onboarding.setup.notInstalled')}+ </Badge>+ )}+ </div>+ <div className="onboarding-assistant-actions">+ {status === 'missing' && <Button variant="secondary" size="sm" className="h-[34px]" onClick={onInstall} disabled={installing || detecting}>+ {installing ? <RefreshCw size={14} className="motion-safe:animate-spin" /> : <Download size={14} />}+ {t(installing ? 'agentDetection.installing' : error ? 'common.retry' : 'onboarding.setup.install')}+ </Button>}+ {status === 'unknown' && !detecting && <Button variant="secondary" size="sm" onClick={onDetect}><RefreshCw size={14} />{t('common.retry')}</Button>}+ <Button variant="secondary" size="sm" className="h-[34px]" onClick={onConfigure} disabled={configuringDisabled || installing || detecting}>+ {connection ? <Check size={14} className="text-mint-ink" /> : <Sliders size={14} />}+ {t(connection ? `onboarding.setup.${connection}Connected` : 'agentDetection.configureProvider')}+ </Button>+ {enabledControl}+ </div>+ </div>+ {error && <div className="onboarding-assistant-error" role="alert">+ <p>{error.message}</p>+ {error.output && <details><summary>{t('onboarding.details')}</summary><pre>{error.output}</pre></details>}+ </div>}+ </Card>+ );+}diff --git a/ui/src/components/onboarding/AssistantSetup.test.tsx b/ui/src/components/onboarding/AssistantSetup.test.tsxnew file mode 100644index 000000000..053a894f6--- /dev/null+++ b/ui/src/components/onboarding/AssistantSetup.test.tsx@@ -0,0 +1,227 @@+// @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 { AssistantRow } from './AssistantRow';+import en from '../../i18n/en.json';++const mock = vi.hoisted(() => ({ api: {+ detectCli: vi.fn(), installAgent: vi.fn(), getConfig: vi.fn(), getBackendRuntime: vi.fn(),+} }));+vi.mock('../../context/ApiContext', () => ({ useApi: () => mock.api }));+vi.mock('../../context/ToastContext', () => ({ useToast: () => ({ showToast: vi.fn() }) }));+vi.mock('../settings/models/useModelHubCapability', () => ({ useModelHubCapability: () => false }));+vi.mock('../settings/shared/useOpencodePermission', () => ({ useOpencodePermission: () => ({ permissionAllowed: true, statusLoaded: true }) }));+vi.mock('../settings/providers/BackendProviderConfig', () => ({ BackendProviderConfig: ({ backend }: { backend: string }) => <div>Existing provider: {backend}</div> }));+const i18n = createInstance();+await i18n.init({ lng: 'en', resources: { en: { translation: en } }, interpolation: { escapeValue: false } });+const wrap = (node: React.ReactNode) => <MemoryRouter><I18nextProvider i18n={i18n}>{node}</I18nextProvider></MemoryRouter>;+const data = () => ({ __onboardingDetected: true, agents: Object.fromEntries(['claude', 'codex', 'opencode'].map((name) => [name, { enabled: true, cli_path: name, status: 'missing' }])) });+const row = (name: string) => within(screen.getByLabelText(name));+beforeEach(() => {+ vi.resetAllMocks();+ mock.api.getConfig.mockResolvedValue(data());+ mock.api.detectCli.mockResolvedValue({ found: true, path: '/isolated/bin/assistant' });+ mock.api.getBackendRuntime.mockResolvedValue({ installed: true, has_update: false });+});+afterEach(cleanup);++describe('assistant installation presentation', () => {+ it('keeps fixed row order, independent installs and retry details', async () => {+ let finishClaude!: (value: unknown) => void;+ mock.api.installAgent.mockImplementation((name) => name === 'claude'+ ? new Promise((resolve) => { finishClaude = resolve; })+ : Promise.resolve({ ok: true, path: '/isolated/bin/codex' }));+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} />));+ expect(screen.getAllByRole('heading', { level: 3 }).map((node) => node.textContent)).toEqual(['AI assistants', 'Claude Code', 'Codex', 'OpenCode']);+ fireEvent.click(row('Claude Code').getByRole('button', { name: 'Install' }));+ fireEvent.click(row('Codex').getByRole('button', { name: 'Install' }));+ await waitFor(() => expect(row('Codex').getByRole('button', { name: 'Installed' })).toBeTruthy());+ await act(async () => finishClaude({ ok: false, message: 'Network unavailable', output: 'Installer exited 1' }));+ expect(row('Claude Code').getByText('Network unavailable')).toBeTruthy();+ expect(row('Claude Code').getByText('View details')).toBeTruthy();+ expect(row('Codex').getByRole('button', { name: 'Installed' })).toBeTruthy();+ expect(row('OpenCode').getByText('Not installed')).toBeTruthy();+ mock.api.installAgent.mockResolvedValue({ ok: true, path: '/isolated/bin/claude' });+ fireEvent.click(row('Claude Code').getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(row('Claude Code').getByRole('button', { name: 'Installed' })).toBeTruthy());+ expect(mock.api.detectCli).toHaveBeenCalledWith('/isolated/bin/claude');+ expect(row('Codex').getByRole('button', { name: 'Installed' })).toBeTruthy();+ });+ it('keeps existing configure entry and does not claim connection from installation', async () => {+ const saved = data(); saved.agents.claude.status = 'ok';+ render(wrap(<AgentDetection data={saved} onNext={vi.fn()} />));+ expect(screen.queryByText('Subscription connected')).toBeNull();+ expect(screen.queryByText('API Key connected')).toBeNull();+ fireEvent.click(row('Claude Code').getByRole('button', { name: en.agentDetection.configureProvider }));+ expect(await screen.findByText('Existing provider: claude')).toBeTruthy();+ });+ it('an available update keeps Continue and configuration usable', async () => {+ const saved = data(); saved.agents.claude.status = 'ok';+ mock.api.getBackendRuntime.mockResolvedValue({ installed: true, has_update: true, current_version: '1', latest_version: '2' });+ const next = vi.fn();+ render(wrap(<AgentDetection data={saved} onNext={next} />));+ await screen.findByRole('button', { name: en.backendLifecycle.statusUpdateAvailable });+ expect(row('Claude Code').getByRole('button', { name: en.agentDetection.configureProvider }).hasAttribute('disabled')).toBe(false);+ fireEvent.click(screen.getByRole('button', { name: 'Continue' }));+ expect(next).toHaveBeenCalledWith({ agents: saved.agents });+ expect(mock.api.installAgent).not.toHaveBeenCalled();+ });+ it('retains a detection error separately from missing installation', async () => {+ mock.api.detectCli.mockRejectedValue(new Error('Probe failed'));+ render(wrap(<AgentDetection data={{ ...data(), __onboardingDetected: false }} onNext={vi.fn()} />));+ await waitFor(() => expect(screen.getAllByRole('alert')).toHaveLength(3));+ expect(row('Claude Code').queryByRole('button', { name: 'Install' })).toBeNull();+ expect(row('Claude Code').getByRole('button', { name: 'Retry' })).toBeTruthy();+ });+ it('returns current row state to Welcome without saving it', async () => {+ mock.api.installAgent.mockResolvedValue({ ok: true, path: '/isolated/bin/claude' });+ const back = vi.fn();+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onBack={back} />));+ fireEvent.click(row('Claude Code').getByRole('button', { name: 'Install' }));+ await waitFor(() => expect(row('Claude Code').getByRole('button', { name: 'Installed' })).toBeTruthy());+ fireEvent.click(row('Codex').getByRole('checkbox'));+ fireEvent.click(screen.getByRole('button', { name: 'Back' }));+ expect(back).toHaveBeenCalledWith({ agents: expect.objectContaining({+ claude: expect.objectContaining({ status: 'ok', cli_path: '/isolated/bin/assistant' }),+ codex: expect.objectContaining({ enabled: false }),+ }) });+ });+ it.each(['Back', 'Continue'])('serializes provider reconciliation and returns final live rows via %s', async (navigation) => {+ let finishConfig!: (value: unknown) => void;+ let finishDetection!: (value: unknown) => void;+ mock.api.getConfig.mockImplementation(() => new Promise((resolve) => { finishConfig = resolve; }));+ mock.api.detectCli.mockImplementation(() => new Promise((resolve) => { finishDetection = resolve; }));+ const back = vi.fn();+ const next = vi.fn();+ render(wrap(<AgentDetection data={data()} onNext={next} onBack={back} />));+ const assertSyncGates = () => {+ for (const backend of ['Claude Code', 'Codex', 'OpenCode']) {+ const configure = row(backend).getByRole('button', { name: en.agentDetection.configureProvider });+ expect(configure.hasAttribute('disabled')).toBe(true);+ fireEvent.click(configure);+ expect(screen.queryByRole('dialog')).toBeNull();+ }+ for (const name of ['Back', 'Continue']) {+ const button = screen.getByRole('button', { name });+ expect(button.hasAttribute('disabled')).toBe(true);+ fireEvent.click(button);+ }+ expect(back).not.toHaveBeenCalled();+ expect(next).not.toHaveBeenCalled();+ };+ const finalAgents = { ...data().agents };+ for (const [index, [backend, label]] of [['claude', 'Claude Code'], ['codex', 'Codex']].entries()) {+ fireEvent.click(row(label).getByRole('button', { name: en.agentDetection.configureProvider }));+ expect(screen.getByText(`Existing provider: ${backend}`)).toBeTruthy();+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' });+ assertSyncGates();+ expect(mock.api.getConfig).toHaveBeenCalledTimes(index + 1);+ expect(mock.api.detectCli).toHaveBeenCalledTimes(index);+ // Local enablement remains editable while persisted provider fields reload.+ fireEvent.click(row(label).getByRole('checkbox'));+ const savedPath = `/isolated/新的路径/${backend}`;+ const canonicalPath = `/isolated/真实路径/${backend}`;+ const provider = { default_provider: `provider-${backend}`, cli_path: savedPath, enabled: true };+ await act(async () => finishConfig({ agents: { [backend]: provider } }));+ expect(mock.api.detectCli).toHaveBeenLastCalledWith(savedPath);+ assertSyncGates();+ expect(mock.api.getConfig).toHaveBeenCalledTimes(index + 1);+ await act(async () => finishDetection({ found: true, path: canonicalPath }));+ expect(screen.getByRole('button', { name: 'Back' }).hasAttribute('disabled')).toBe(false);+ expect(screen.getByRole('button', { name: 'Continue' }).hasAttribute('disabled')).toBe(false);+ for (const name of ['Claude Code', 'Codex', 'OpenCode']) {+ expect(row(name).getByRole('button', { name: en.agentDetection.configureProvider }).hasAttribute('disabled')).toBe(false);+ }+ finalAgents[backend] = { ...provider, enabled: false, status: 'ok', cli_path: canonicalPath };+ // Consume after each cycle: a settled pre-detection snapshot must not be replayed.+ fireEvent.click(screen.getByRole('button', { name: navigation }));+ await waitFor(() => expect(navigation === 'Back' ? back : next).toHaveBeenCalledWith({ agents: finalAgents }));+ back.mockClear();+ next.mockClear();+ }+ });+ it('clears only obsolete install failures after a successful external rescan', async () => {+ mock.api.installAgent.mockImplementation((name) => Promise.resolve({ ok: false, message: `Failed ${name}`, output: `Details ${name}` }));+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} />));+ for (const label of ['Claude Code', 'Codex', 'OpenCode']) {+ fireEvent.click(row(label).getByRole('button', { name: 'Install' }));+ }+ await waitFor(() => expect(screen.getAllByRole('alert')).toHaveLength(3));+ mock.api.detectCli.mockImplementation((name) => name === 'claude'+ ? Promise.resolve({ found: true, path: '/isolated/external/claude' })+ : name === 'codex' ? Promise.resolve({ found: false }) : Promise.reject(new Error('Probe unavailable')));+ fireEvent.click(screen.getByRole('button', { name: en.agentDetection.rescan }));+ await waitFor(() => expect(row('Claude Code').getByRole('button', { name: 'Installed' })).toBeTruthy());+ expect(row('Claude Code').queryByRole('alert')).toBeNull();+ expect(row('Claude Code').queryByText('Details claude')).toBeNull();+ expect(row('Codex').getByText('Failed codex')).toBeTruthy();+ expect(row('Codex').getByText('Details codex')).toBeTruthy();+ expect(row('OpenCode').getByText('Error: Probe unavailable')).toBeTruthy();+ expect(row('OpenCode').queryByRole('button', { name: 'Installed' })).toBeNull();+ // A rejected probe retains install evidence; a later missing result shows it again.+ mock.api.detectCli.mockResolvedValue({ found: false });+ fireEvent.click(row('OpenCode').getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(row('OpenCode').getByText('Failed opencode')).toBeTruthy());+ expect(row('OpenCode').getByText('Details opencode')).toBeTruthy();+ expect(row('Codex').getByText('Failed codex')).toBeTruthy();+ });+ it('keeps another backend installation independent of provider reconciliation', async () => {+ let finishConfig!: (value: unknown) => void;+ let finishInstall!: (value: unknown) => void;+ mock.api.getConfig.mockImplementation(() => new Promise((resolve) => { finishConfig = resolve; }));+ mock.api.installAgent.mockImplementation(() => new Promise((resolve) => { finishInstall = resolve; }));+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} />));+ fireEvent.click(row('Claude Code').getByRole('button', { name: en.agentDetection.configureProvider }));+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' });+ fireEvent.click(row('Codex').getByRole('button', { name: 'Install' }));+ expect(mock.api.installAgent).toHaveBeenCalledWith('codex');+ await act(async () => finishInstall({ ok: true, path: '/isolated/bin/codex' }));+ expect(row('Codex').getByRole('button', { name: 'Installed' })).toBeTruthy();+ expect(row('Codex').getByRole('button', { name: en.agentDetection.configureProvider }).hasAttribute('disabled')).toBe(true);+ expect(screen.getByRole('button', { name: 'Continue' }).hasAttribute('disabled')).toBe(true);+ await act(async () => finishConfig(data()));+ expect(screen.getByRole('button', { name: 'Continue' }).hasAttribute('disabled')).toBe(false);+ expect(row('Codex').getByRole('button', { name: 'Installed' })).toBeTruthy();+ });+ it('ignores an obsolete successful probe when a newer provider-path probe reports missing', async () => {+ let finishConfig!: (value: unknown) => void;+ let finishOldProbe!: (value: unknown) => void;+ mock.api.installAgent.mockResolvedValue({ ok: false, message: 'Install failed', output: 'Failure details' });+ mock.api.getConfig.mockImplementation(() => new Promise((resolve) => { finishConfig = resolve; }));+ mock.api.detectCli.mockImplementation((path) => path === 'claude'+ ? new Promise((resolve) => { finishOldProbe = resolve; }) : Promise.resolve({ found: false }));+ const back = vi.fn();+ render(wrap(<AgentDetection data={data()} onNext={vi.fn()} onBack={back} />));+ fireEvent.click(row('Claude Code').getByRole('button', { name: 'Install' }));+ await screen.findByText('Install failed');+ fireEvent.click(row('Claude Code').getByRole('button', { name: en.agentDetection.configureProvider }));+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' });+ fireEvent.click(screen.getByRole('button', { name: en.agentDetection.rescan }));+ expect(mock.api.detectCli).toHaveBeenCalledWith('claude');+ await act(async () => finishConfig({ agents: { claude: { cli_path: '/isolated/new/claude' } } }));+ expect(mock.api.detectCli).toHaveBeenCalledWith('/isolated/new/claude');+ await act(async () => finishOldProbe({ found: true, path: '/isolated/old/claude' }));+ expect(row('Claude Code').getByText('Install failed')).toBeTruthy();+ expect(row('Claude Code').getByText('Failure details')).toBeTruthy();+ expect(row('Claude Code').queryByRole('button', { name: 'Installed' })).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Back' }));+ expect(back).toHaveBeenCalledWith({ agents: expect.objectContaining({ claude: expect.objectContaining({+ cli_path: '/isolated/new/claude', status: 'missing',+ }) }) });+ });+ it('renders connected controls only from explicit presentation state', () => {+ const configure = vi.fn();+ const connectedRow = (configuringDisabled: boolean) => wrap(<AssistantRow backend="claude" status="ok" installing={false} detecting={false} lifecycle={<span>Installed</span>}+ enabledControl={null} onInstall={vi.fn()} onDetect={vi.fn()} onConfigure={configure} connection="subscription" configuringDisabled={configuringDisabled} />);+ const { rerender } = render(connectedRow(true));+ fireEvent.click(screen.getByRole('button', { name: 'Subscription connected' }));+ expect(configure).not.toHaveBeenCalled();+ rerender(connectedRow(false));+ fireEvent.click(screen.getByRole('button', { name: 'Subscription connected' }));+ expect(configure).toHaveBeenCalledOnce();+ });+});diff --git a/ui/src/components/onboarding/CollaborationStory.tsx b/ui/src/components/onboarding/CollaborationStory.tsxnew file mode 100644index 000000000..f81e99693--- /dev/null+++ b/ui/src/components/onboarding/CollaborationStory.tsx@@ -0,0 +1,102 @@+import { useEffect, useState } from 'react';+import { CodeXml, FileText, ListChecks, Pause, Play, RotateCcw } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import { useReducedMotion } from 'framer-motion';+import { BackendIcon } from '../visual';+import { Button } from '../ui/button';+import { Card } from '../ui/card';+import { ASSISTANT_ORDER, collaborationFrame } from './collaborationTimeline';++export function CollaborationStory({ paused, onPausedChange }: {+ paused: boolean;+ onPausedChange: (paused: boolean) => void;+}) {+ const { t } = useTranslation();+ const reducedMotion = useReducedMotion() === true;+ const [elapsed, setElapsed] = useState(0);+ useEffect(() => {+ if (paused || reducedMotion) return;+ let previous = performance.now();+ const timer = window.setInterval(() => {+ const now = performance.now();+ const delta = now - previous;+ previous = now;+ setElapsed((value) => value + delta);+ }, 50);+ return () => window.clearInterval(timer);+ }, [paused, reducedMotion]);+ const frame = collaborationFrame(elapsed, reducedMotion);+ const paths = ['M240 112 H320', 'M560 112 H640', 'M760 228 V260 H120 V228'];+ const icons = [FileText, CodeXml, ListChecks];++ return (+ <section className="onboarding-story" aria-label={t('onboarding.story.label')}>+ <p className="sr-only">{t('onboarding.story.description')}</p>+ <div className="onboarding-collaboration" data-reduced-motion={reducedMotion}>+ <svg className="onboarding-wires" viewBox="0 0 880 272" aria-hidden="true">+ {paths.map((path) => <path key={path} d={path} fill="none" stroke="var(--border-strong)" />)}+ {frame.handoff && !reducedMotion && (+ <path data-testid="handoff-pulse" d={paths[frame.handoff.path]} fill="none"+ stroke="var(--mint)" strokeWidth="2" pathLength="1" strokeDasharray="0.06 1"+ strokeDashoffset={-frame.handoff.progress * 0.94} />+ )}+ </svg>+ <div className="onboarding-collaboration-cards">+ {ASSISTANT_ORDER.map((backend, index) => {+ const progress = frame.progress[index];+ const state = progress >= 1 ? 'complete' : progress > 0 ? 'working' : 'waiting';+ const Icon = icons[index];+ const phase = index === 0 && frame.summary ? 'summary' : state;+ return (+ <Card key={backend} className="onboarding-collaboration-card" data-active={frame.active === index}+ data-state={state} aria-label={t(`onboarding.story.${backend}.name`)}>+ <div className="onboarding-story-status" aria-hidden="true">+ <Icon size={13} />+ <span key={phase} className={paused ? '' : 'onboarding-status-copy'}>+ {phase === 'summary' ? t('onboarding.story.claude.summary') : t(`onboarding.story.${backend}.${state}`)}+ </span>+ <svg viewBox="0 0 14 14" className="onboarding-status-glyph">+ <circle cx="7" cy="7" r="2.5" fill="currentColor" opacity={state === 'waiting' ? 0.5 : 0} />+ <circle cx="7" cy="7" r="5.5" fill="none" stroke="var(--mint)" strokeWidth="1.2"+ pathLength="1" strokeDasharray="1" strokeDashoffset={1 - Math.min(1, progress * 1500 / 850)}+ transform="rotate(-90 7 7)" />+ <path d="m4.4 7 1.7 1.8 3.7-3.6" fill="none" stroke="var(--mint)" strokeWidth="1.3"+ pathLength="1" strokeDasharray="1" strokeDashoffset={1 - Math.max(0, Math.min(1, (progress * 1500 - 850) / 300))} />+ </svg>+ </div>+ <div className={`onboarding-skeleton onboarding-skeleton-${backend}`} aria-hidden="true">+ {Array.from({ length: index === 2 ? 4 : 6 }, (_, line) => {+ const revealed = progress >= (line + 1) / (index === 2 ? 4 : 6);+ return (+ <div key={line} className="onboarding-skeleton-row" style={{ opacity: revealed ? 1 : 0.2 }}>+ {index === 1 && <span className="onboarding-code-number">{line + 1}</span>}+ {index === 2 && <span className="onboarding-test-check">{revealed ? '✓' : ''}</span>}+ <span className="onboarding-skeleton-line" style={{ width: `${[90, 75, 84, 62, 80, 68][line]}%` }} />+ </div>+ );+ })}+ </div>+ <div className="onboarding-story-identity">+ <BackendIcon backend={backend} size={28} variant="glyph" aria-hidden="true" />+ <strong>{t(`onboarding.story.${backend}.name`)}</strong>+ <span>{t(`onboarding.story.${backend}.role`)}</span>+ </div>+ </Card>+ );+ })}+ </div>+ <p className="onboarding-story-caption">{t('onboarding.story.caption')}</p>+ </div>+ {!reducedMotion && (+ <div className="onboarding-motion-controls">+ <Button variant="ghost" size="icon" className="size-7" onClick={() => onPausedChange(!paused)}+ aria-label={t(paused ? 'onboarding.story.play' : 'onboarding.story.pause')}>+ {paused ? <Play size={12} /> : <Pause size={12} />}+ </Button>+ <Button variant="ghost" size="icon" className="size-7" onClick={() => { setElapsed(0); onPausedChange(false); }}+ aria-label={t('onboarding.story.replay')}><RotateCcw size={12} /></Button>+ </div>+ )}+ </section>+ );+}diff --git a/ui/src/components/onboarding/Welcome.test.tsx b/ui/src/components/onboarding/Welcome.test.tsxnew file mode 100644index 000000000..62c473e2d--- /dev/null+++ b/ui/src/components/onboarding/Welcome.test.tsx@@ -0,0 +1,95 @@+// @vitest-environment jsdom+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';+import { createInstance } from 'i18next';+import { I18nextProvider } from 'react-i18next';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { Welcome } from '../steps/Welcome';+import { CollaborationStory } from './CollaborationStory';+import { AccessTiles } from './AccessTiles';+import en from '../../i18n/en.json';+import zh from '../../i18n/zh.json';++const mocks = vi.hoisted(() => ({ reduced: false, api: { detectCli: vi.fn() } }));+vi.mock('framer-motion', () => ({ useReducedMotion: () => mocks.reduced }));+vi.mock('../../context/ApiContext', () => ({ useApi: () => mocks.api }));+const i18n = createInstance();+await i18n.init({ lng: 'en', resources: { en: { translation: en }, zh: { translation: zh } }, interpolation: { escapeValue: false } });+const wrap = (element: React.ReactNode) => <I18nextProvider i18n={i18n}>{element}</I18nextProvider>;+beforeEach(() => { mocks.reduced = false; vi.clearAllMocks(); void i18n.changeLanguage('en'); });+afterEach(() => { cleanup(); vi.useRealTimers(); });++describe('Welcome', () => {+ it('checks saved paths before advancing without persisting configuration', async () => {+ mocks.api.detectCli.mockImplementation(async (binary: string) => ({ found: binary !== 'codex', path: `/test/${binary}` }));+ const next = vi.fn();+ render(wrap(<Welcome data={{ agents: { claude: { cli_path: '/custom/claude' } } }} onNext={next} />));+ fireEvent.click(screen.getByRole('button', { name: 'Get started' }));+ await waitFor(() => expect(next).toHaveBeenCalledOnce());+ expect(mocks.api.detectCli.mock.calls.map(([binary]) => binary)).toEqual(['/custom/claude', 'codex', 'opencode']);+ expect(next.mock.calls[0][0]).toMatchObject({ __onboardingDetected: true, agents: { claude: { status: 'ok' }, codex: { status: 'missing' }, opencode: { status: 'ok' } } });+ });+ it('retains a failed detection on Welcome and permits retry', async () => {+ mocks.api.detectCli.mockRejectedValueOnce(new Error('Probe unavailable')).mockResolvedValue({ found: false });+ const next = vi.fn();+ render(wrap(<Welcome onNext={next} />));+ fireEvent.click(screen.getByRole('button', { name: 'Get started' }));+ await screen.findByRole('alert');+ expect(next).not.toHaveBeenCalled();+ expect(screen.getByText('Probe unavailable')).toBeTruthy();+ fireEvent.click(screen.getByRole('button', { name: 'Retry' }));+ await waitFor(() => expect(next).toHaveBeenCalledOnce());+ });+ it('renders the approved Chinese copy', async () => {+ await i18n.changeLanguage('zh');+ render(wrap(<Welcome onNext={vi.fn()} />));+ expect(screen.getByRole('heading', { name: '各有所长,接力完成' })).toBeTruthy();+ expect(screen.getAllByRole('listitem')).toHaveLength(6);+ });+});++describe('collaboration playback and access interaction', () => {+ it('advances the pulse and freezes the entire state on pause', () => {+ vi.useFakeTimers();+ const { container, rerender } = render(wrap(<CollaborationStory paused={false} onPausedChange={vi.fn()} />));+ act(() => vi.advanceTimersByTime(1800));+ expect(screen.getByTestId('handoff-pulse')).toBeTruthy();+ expect(container.querySelectorAll('[data-state="complete"]')).toHaveLength(1);+ rerender(wrap(<CollaborationStory paused onPausedChange={vi.fn()} />));+ const before = container.innerHTML;+ act(() => vi.advanceTimersByTime(3000));+ expect(container.innerHTML).toBe(before);+ });+ it('replays every card and pulse from the same beginning', () => {+ vi.useFakeTimers();+ const resume = vi.fn();+ const { container } = render(wrap(<CollaborationStory paused={false} onPausedChange={resume} />));+ act(() => vi.advanceTimersByTime(5000));+ expect(container.querySelectorAll('[data-state="complete"]')).toHaveLength(2);+ fireEvent.click(screen.getByRole('button', { name: 'Replay animation' }));+ expect(container.querySelectorAll('[data-state="complete"]')).toHaveLength(0);+ expect(screen.queryByTestId('handoff-pulse')).toBeNull();+ expect(resume).toHaveBeenCalledWith(false);+ });+ it('shows completed work and stops all timers for reduced motion', () => {+ vi.useFakeTimers(); mocks.reduced = true;+ const { container } = render(wrap(<Welcome onNext={vi.fn()} />));+ expect(container.querySelectorAll('[data-state="complete"]')).toHaveLength(3);+ expect(screen.queryByTestId('handoff-pulse')).toBeNull();+ expect(screen.queryByRole('button', { name: 'Pause animation' })).toBeNull();+ expect(vi.getTimerCount()).toBe(0);+ });+ it('pauses idle emphasis throughout pointer and keyboard interaction', () => {+ vi.useFakeTimers();+ const { container } = render(wrap(<AccessTiles paused={false} />));+ act(() => vi.advanceTimersByTime(2000));+ expect(container.querySelectorAll('[data-emphasis="true"]')).toHaveLength(1);+ fireEvent.pointerEnter(screen.getByRole('list'));+ expect(container.querySelectorAll('[data-emphasis="true"]')).toHaveLength(0);+ expect(vi.getTimerCount()).toBe(0);+ fireEvent.pointerLeave(screen.getByRole('list'));+ fireEvent.focus(screen.getAllByRole('listitem')[0]);+ expect(vi.getTimerCount()).toBe(0);+ fireEvent.blur(screen.getAllByRole('listitem')[0], { relatedTarget: null });+ expect(vi.getTimerCount()).toBe(1);+ });+});diff --git a/ui/src/components/onboarding/collaborationTimeline.test.ts b/ui/src/components/onboarding/collaborationTimeline.test.tsnew file mode 100644index 000000000..b53b161af--- /dev/null+++ b/ui/src/components/onboarding/collaborationTimeline.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from 'vitest';+import { collaborationFrame } from './collaborationTimeline';++describe('one collaboration clock', () => {+ it('keeps the source active until each pulse arrives', () => {+ for (const [start, end, source, destination, path] of [[1500, 2250, 0, 1, 0], [3750, 4500, 1, 2, 1], [6000, 7000, 2, 0, 2]]) {+ expect(collaborationFrame(start)).toMatchObject({ active: source, handoff: { path, progress: 0 } });+ expect(collaborationFrame(end - 1).active).toBe(source);+ expect(collaborationFrame(end)).toMatchObject({ active: destination, handoff: null });+ expect(collaborationFrame(end).progress[destination]).toBe(0);+ }+ });+ it('finishes each card in 1.5 seconds 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(collaborationFrame(8500)).toMatchObject({ progress: [1, 1, 1], summary: true });+ expect(collaborationFrame(8900)).toEqual(collaborationFrame(0));+ });+ it('shows a completed collaboration with no pulse or active card in reduced motion', () => {+ for (const elapsed of [0, 1750, 4000, 6500, 8900]) {+ expect(collaborationFrame(elapsed, true)).toEqual({ active: null, handoff: null, progress: [1, 1, 1], summary: true });+ }+ });+});diff --git a/ui/src/components/onboarding/collaborationTimeline.ts b/ui/src/components/onboarding/collaborationTimeline.tsnew file mode 100644index 000000000..d80b5c3c8--- /dev/null+++ b/ui/src/components/onboarding/collaborationTimeline.ts@@ -0,0 +1,16 @@+export const COLLABORATION_DURATION = 8900;+export const ASSISTANT_ORDER = ['claude', 'codex', 'opencode'] as const;+export type AssistantId = typeof ASSISTANT_ORDER[number];++/** All cards and traveling pulses are projections of this one clock. */+export function collaborationFrame(elapsed: number, reducedMotion = false) {+ const time = reducedMotion ? COLLABORATION_DURATION : elapsed % COLLABORATION_DURATION;+ const starts = [time >= 7000 ? 7000 : 0, 2250, 4500];+ const progress = starts.map((start) => Math.min(1, Math.max(0, (time - start) / 1500)));+ const active = reducedMotion ? null : time < 2250 ? 0 : time < 4500 ? 1 : time < 7000 ? 2 : 0;+ const handoff = time >= 1500 && time < 2250 ? { path: 0, progress: (time - 1500) / 750 }+ : time >= 3750 && time < 4500 ? { path: 1, progress: (time - 3750) / 750 }+ : time >= 6000 && time < 7000 ? { path: 2, progress: (time - 6000) / 1000 }+ : null;+ return { active, progress, handoff, summary: time >= 7000 };+}diff --git a/ui/src/components/onboarding/onboarding.css b/ui/src/components/onboarding/onboarding.cssnew file mode 100644index 000000000..d5971f80c--- /dev/null+++ b/ui/src/components/onboarding/onboarding.css@@ -0,0 +1,118 @@+.onboarding-shell {+ background: var(--background);+ color: var(--foreground);+ height: var(--app-shell-h);+ overflow-y: auto;+ padding: 20px 24px;+}+.onboarding-shell > header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ max-width: 1104px;+ margin: 0 auto;+}+.onboarding-shell-content {+ display: flex;+ align-items: center;+ min-height: calc(100% - 44px);+ padding: 28px 0;+}+.onboarding-welcome, .onboarding-setup {+ display: flex;+ flex-direction: column;+ align-items: center;+ width: 100%;+ max-width: 880px;+ margin: 0 auto;+ gap: 24px;+}+.onboarding-heading { text-align: center; width: 100%; }+.onboarding-heading h1, .onboarding-heading h2 {+ font-size: 34px;+ font-weight: 600;+ line-height: 1.2;+ letter-spacing: -0.5px;+}+.onboarding-heading p { margin-top: 10px; font-size: 14px; color: var(--muted); }+.onboarding-story { position: relative; width: 100%; }+.onboarding-collaboration { position: relative; padding-bottom: 44px; }+.onboarding-collaboration-cards { display: flex; justify-content: space-between; gap: 24px; }+.onboarding-collaboration-card {+ flex: 0 1 240px;+ min-width: 0;+ height: 228px;+ border-radius: 16px;+ padding: 18px 20px;+ background: linear-gradient(150deg, var(--surface-2), var(--surface));+ transition: border-color 180ms, box-shadow 180ms;+}+.onboarding-collaboration-card[data-active="true"], .onboarding-assistant:hover, .onboarding-assistant:focus-within {+ border-color: color-mix(in srgb, var(--mint) 34%, transparent);+ box-shadow: var(--shadow-glow-lg-mint);+}+.onboarding-wires { position: absolute; inset: 0; width: 100%; height: 272px; pointer-events: none; }+.onboarding-story-status { display: flex; align-items: center; gap: 7px; font-size: 10px; height: 14px; color: var(--muted); }+.onboarding-story-status > span { flex: 1; white-space: nowrap; }+.onboarding-status-glyph { width: 14px; height: 14px; flex-shrink: 0; }+.onboarding-status-copy { animation: onboarding-status-in 250ms ease-out; }+@keyframes onboarding-status-in { from { opacity: 0; } to { opacity: 1; } }+.onboarding-skeleton { height: 134px; padding-top: 22px; display: flex; flex-direction: column; gap: 10px; }+.onboarding-skeleton-row { display: flex; align-items: center; gap: 10px; height: 7px; }+.onboarding-skeleton-line { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--foreground) 12%, transparent); }+.onboarding-skeleton-claude .onboarding-skeleton-row:first-child .onboarding-skeleton-line { height: 9px; width: 55% !important; background: color-mix(in srgb, var(--foreground) 25%, transparent); }+.onboarding-skeleton-codex .onboarding-skeleton-line { background: color-mix(in srgb, var(--cyan) 36%, transparent); }+.onboarding-skeleton-codex .onboarding-skeleton-row:nth-child(even) .onboarding-skeleton-line { background: color-mix(in srgb, var(--violet) 36%, transparent); }+.onboarding-code-number { font: 8px monospace; color: var(--muted); }+.onboarding-skeleton-opencode { gap: 18px; }+.onboarding-test-check { display: flex; width: 12px; height: 12px; border: 1px solid var(--border-strong); border-radius: 3px; color: var(--mint-ink); font-size: 10px; align-items: center; justify-content: center; flex-shrink: 0; }+.onboarding-story-identity { display: flex; align-items: center; gap: 11px; padding-top: 16px; border-top: 1px solid var(--border); }+.onboarding-story-identity strong { font-size: 14px; font-weight: 600; }+.onboarding-story-identity > span:last-child { margin-left: auto; font-size: 11px; color: var(--muted); }+.onboarding-story-caption { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); padding: 0 14px; background: var(--background); color: var(--muted); font-size: 10px; white-space: nowrap; }+.onboarding-motion-controls { position: absolute; right: 0; bottom: -6px; display: flex; color: var(--muted); }+.onboarding-access { max-width: 640px; width: 100%; padding: 16px 0; }+.onboarding-access > p { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 14px; }+.onboarding-access-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; list-style: none; }+.onboarding-access-tile { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 12px; }+.onboarding-access-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; transition: transform 180ms; }+.onboarding-access-tile:hover, .onboarding-access-tile:focus, .onboarding-access-tile[data-emphasis="true"] { background: color-mix(in srgb, var(--border) 50%, var(--surface)); }+.onboarding-access-tile:hover .onboarding-access-icon, .onboarding-access-tile:focus .onboarding-access-icon, .onboarding-access-tile[data-emphasis="true"] .onboarding-access-icon { transform: scale(1.18); }+.onboarding-access-tile:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }+.onboarding-setup { align-self: flex-start; padding-top: 24px; }+.onboarding-assistants { width: 100%; display: flex; flex-direction: column; gap: 12px; }+.onboarding-assistants-header { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }+.onboarding-assistant { transition: border-color 180ms, box-shadow 180ms; }+.onboarding-assistant-main { display: flex; align-items: center; gap: 16px; min-height: 86px; padding: 16px 20px; }+.onboarding-assistant-logo { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--background); border-radius: 10px; flex-shrink: 0; }+.onboarding-assistant-identity { flex: 1; min-width: 0; }+.onboarding-assistant-identity h3 { font-size: 15px; font-weight: 600; }+.onboarding-assistant-identity p { font-size: 12px; margin-top: 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.onboarding-assistant-status, .onboarding-assistant-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }+.onboarding-assistant-error { padding: 0 20px 16px; font-size: 12px; color: var(--destructive-ink); overflow-wrap: anywhere; }+.onboarding-assistant-error pre { margin-top: 8px; max-height: 160px; overflow: auto; white-space: pre-wrap; }+.onboarding-assistant-error summary { margin-top: 8px; cursor: pointer; }+.onboarding-setup-footer { display: flex; flex-direction: column; align-items: center; gap: 10px; }+@media (max-width: 900px) {+ .onboarding-assistant-main { flex-wrap: wrap; }+ .onboarding-assistant-identity p { white-space: normal; }+ .onboarding-assistant-identity { flex-basis: calc(100% - 60px); }+ .onboarding-assistant-actions { margin-left: auto; flex-wrap: wrap; }+}+@media (max-width: 767px) {+ .onboarding-shell { padding: 16px; }+ .onboarding-heading h1, .onboarding-heading h2 { font-size: 28px; }+ .onboarding-collaboration-cards { flex-direction: column; align-items: center; gap: 24px; }+ .onboarding-collaboration-card { width: min(100%, 320px); flex: none; }+ .onboarding-wires { display: none; }+ .onboarding-collaboration-card { position: relative; }+ .onboarding-collaboration-card + .onboarding-collaboration-card::before { content: ''; position: absolute; height: 24px; width: 1px; background: var(--border-strong); top: -25px; left: 50%; }+ .onboarding-access-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }+ .onboarding-assistant-main { gap: 12px; padding: 16px; }+ .onboarding-assistant-actions { margin-left: 0; }+ .onboarding-motion-controls { bottom: -28px; }+}+@media (prefers-reduced-motion: reduce) {+ .onboarding-shell *, .onboarding-shell *::before { animation: none !important; transition: none !important; }+ .onboarding-access-icon { transform: none !important; }+}diff --git a/ui/src/components/settings/BackendLifecycleChip.tsx b/ui/src/components/settings/BackendLifecycleChip.tsxindex b920d4afb..abf831785 100644--- a/ui/src/components/settings/BackendLifecycleChip.tsx+++ b/ui/src/components/settings/BackendLifecycleChip.tsx@@ -30,6 +30,8 @@ interface BackendLifecycleChipProps {name: string;enabled: boolean;cliStatus: CliStatus;+ /** Setup describes executable availability separately from connection readiness. */+ readyLabel?: string;onChanged?: (info?: BackendChipChange) => void | Promise<void>;}@@ -94,6 +96,7 @@ export const BackendLifecycleChip: React.FC<BackendLifecycleChipProps> = ({enabled,cliStatus,onChanged,+ readyLabel,}) => {const { t } = useTranslation();const api = useApi();@@ -208,7 +211,7 @@ export const BackendLifecycleChip: React.FC<BackendLifecycleChipProps> = ({case 'disabled':return t('backendLifecycle.statusDisabled');case 'ready':- return t('backendLifecycle.statusReady');+ return readyLabel || t('backendLifecycle.statusReady');case 'updating':return t('backendLifecycle.statusUpdating');case 'update':diff --git a/ui/src/components/steps/AgentDetection.tsx b/ui/src/components/steps/AgentDetection.tsxindex 780a1ae1c..a6a2ff885 100644--- a/ui/src/components/steps/AgentDetection.tsx+++ b/ui/src/components/steps/AgentDetection.tsx@@ -13,7 +13,10 @@ import { Link } from 'react-router-dom';import { useTranslation } from 'react-i18next';import clsx from 'clsx';import { useApi } from '../../context/ApiContext';-import { BackendIcon, EyebrowBadge, WizardCard } from '../visual';+import { BackendIcon } from '../visual';+import { AssistantRow } from '../onboarding/AssistantRow';+import { ASSISTANT_ORDER } from '../onboarding/collaborationTimeline';+import '../onboarding/onboarding.css';import type { BackendId } from '../visual';import { BackendLifecycleChip } from '../settings/BackendLifecycleChip';import { ToggleSwitch } from '../settings/SettingsPrimitives';@@ -30,7 +33,7 @@ import { DEFAULT_AGENT_STATE, getBackendUiMeta } from '@/lib/agentBackends';interface AgentDetectionProps {data: any;onNext: (data: any) => void;- onBack?: () => void;+ onBack?: (data?: { agents: Record<string, AgentState> }) => void;isPage?: boolean;onSave?: (data: { agents: Record<string, AgentState> }) => Promise<void> | void;}@@ -83,29 +86,53 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onconst [expandedOutputs, setExpandedOutputs] = useState<Record<string, boolean>>({});// Which backend's "Configure provider" modal is open (wizard mode only).const [providerModal, setProviderModal] = useState<string | null>(null);- // True while a provider-modal close is reloading config into ``agents``; the- // promise lets handlePrimaryAction wait for and fold in that reload.+ // One provider modal/reconciliation at a time; Configure and navigation stay+ // disabled until persisted fields and the subsequent detection reach agents.const [syncing, setSyncing] = useState(false);- const syncRef = useRef<Promise<Record<string, AgentState> | null> | null>(null);+ const [detectingAgents, setDetectingAgents] = useState<Record<string, boolean>>({});+ const [detectionErrors, setDetectionErrors] = useState<Record<string, string>>({});+ const pendingInstalls = useRef(new Set<string>());+ const detectionTokens = useRef<Record<string, number>>({});const isMissing = (agent: AgentState) => agent.status === 'missing';const isAnyInstalling = Object.values(installingAgents).some(Boolean);useEffect(() => {- detectAll();+ if (isPage || !data.__onboardingDetected) void detectAll();// eslint-disable-next-line react-hooks/exhaustive-deps}, []);const detect = async (name: string, binary?: string) => {- const result = await api.detectCli(binary || name);- setAgents((prev) => ({- ...prev,- [name]: {- ...prev[name],- cli_path: result.path || prev[name].cli_path,- status: result.found ? 'ok' : 'missing',- },- }));+ const token = (detectionTokens.current[name] || 0) + 1;+ detectionTokens.current[name] = token;+ setDetectingAgents((prev) => ({ ...prev, [name]: true }));+ setDetectionErrors((prev) => ({ ...prev, [name]: '' }));+ try {+ const result = await api.detectCli(binary || name);+ if (detectionTokens.current[name] !== token) return;+ if (result.found) {+ setInstallResults((prev) => {+ if (!prev[name] || prev[name].ok) return prev;+ const next = { ...prev };+ delete next[name];+ return next;+ });+ }+ setAgents((prev) => ({+ ...prev,+ [name]: {+ ...prev[name],+ cli_path: result.path || prev[name].cli_path,+ status: result.found ? 'ok' : 'missing',+ },+ }));+ } catch (error) {+ if (detectionTokens.current[name] !== token) return;+ setDetectionErrors((prev) => ({ ...prev, [name]: String(error) }));+ setAgents((prev) => ({ ...prev, [name]: { ...prev[name], status: 'unknown' } }));+ } finally {+ if (detectionTokens.current[name] === token) setDetectingAgents((prev) => ({ ...prev, [name]: false }));+ }};const detectAll = async () => {@@ -116,10 +143,9 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on// made inside it (enabled / cli_path via useBackendRuntime) flow back into the// wizard's local ``agents`` state — otherwise handlePrimaryAction would save a// stale snapshot and clobber them. Then re-detect to refresh the status pill.- const syncBackendFromConfig = async (name: string): Promise<Record<string, AgentState> | null> => {+ const syncBackendFromConfig = async (name: string) => {setSyncing(true);let cliPath = agents[name]?.cli_path;- let synced: Record<string, AgentState> | null = null;try {const config = await api.getConfig();const saved = config?.agents?.[name];@@ -138,9 +164,8 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on// ``enabled`` is owned by the live card toggle, never this async sync's// snapshot: closing the provider modal kicks off this sync, but the user// may flip the toggle before it resolves. Apply the *live* enable state- // at both consumers — ``prev`` here, and the live ``agents`` in- // handlePrimaryAction — so a just-flipped toggle is never reverted.- synced = { [name]: merged };+ // here so a just-flipped toggle is never reverted. Navigation consumes+ // the live row after detection, never this pre-detection snapshot.setAgents((prev) => ({...prev,[name]: { ...prev[name], ...merged, enabled: prev[name].enabled },@@ -152,7 +177,6 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on} finally {setSyncing(false);}- return synced;};const toggle = (name: string, enabled: boolean) => {@@ -163,7 +187,8 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on};const installAgent = async (name: string) => {- if (isAnyInstalling) return;+ if (pendingInstalls.current.has(name) || (isPage && isAnyInstalling)) return;+ pendingInstalls.current.add(name);setInstallingAgents((prev) => ({ ...prev, [name]: true }));setInstallResults((prev) => ({ ...prev, [name]: { ok: false, message: '', output: null } }));@@ -191,6 +216,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on[name]: { ok: false, message: String(e), output: null },}));} finally {+ pendingInstalls.current.delete(name);setInstallingAgents((prev) => ({ ...prev, [name]: false }));}};@@ -216,31 +242,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onObject.values(agents).some((agent) => agent.enabled) && !opencodeNeedsPermission;const handlePrimaryAction = async () => {- // Wait for an in-flight provider-modal sync and fold its result into the- // snapshot we save, so a quick close-then-continue can't persist a stale- // ``agents`` object that reverts edits made inside the modal.- let mergedAgents = agents;- if (syncRef.current) {- try {- const synced = await syncRef.current;- if (synced) {- // Fold provider edits from the modal into the saved snapshot, but keep- // ``enabled`` from the live ``agents`` state — a toggle flipped after- // the sync started must win over the sync's stale snapshot.- mergedAgents = { ...agents };- for (const [backendName, syncedAgent] of Object.entries(synced)) {- mergedAgents[backendName] = {- ...syncedAgent,- enabled: agents[backendName]?.enabled ?? syncedAgent.enabled,- };- }- }- } catch {- // ignore — fall back to the current snapshot- }- syncRef.current = null;- }- const nextData = { agents: mergedAgents };+ const nextData = { agents };if (isPage && onSave) {await onSave(nextData);return;@@ -248,10 +250,9 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, ononNext(nextData);};- const enabledCount = Object.values(agents).filter((a) => a.enabled && a.status === 'ok').length;// Page mode keeps the existing settings shell — render the inner content only- const Inner = (+ const Inner = isPage ? (<>{/* Setup-wizard migration trigger (spec §5-03): offer to import pre-existingnative CLI configs into the Hub. Wizard-only — the Settings → Backends@@ -342,6 +343,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onvariant="secondary"size="sm"onClick={() => setProviderModal(name)}+ disabled={syncing}><Sliders className="size-3.5" />{t('agentDetection.configureProvider')}@@ -409,7 +411,10 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on);})}</div>+ </>+ ) : null;+ const providerDialog = (<>{/* Wizard-mode provider config modal — reuses the same component tree asthe Settings route. Page mode navigates to the route instead (see theLink above), so the dialog is wizard-only. */}@@ -422,8 +427,8 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, onsetProviderModal(null);// Re-read config + re-detect so runtime edits (enabled / cli_path /// provider defaults) and the status pill reflect whatever changed- // inside the modal. Keep the promise so Continue can await it.- if (name) syncRef.current = syncBackendFromConfig(name);+ // inside the modal before Configure or navigation is available.+ if (name) void syncBackendFromConfig(name);// The Configure-provider modal embeds its OWN useOpencodePermission// instance, so a permission write inside it doesn't touch this// wizard's gate/callout state. Re-read opencode.json so the gate@@ -448,8 +453,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on</DialogContent></Dialog>)}- </>- );+ </>);if (isPage) {return (@@ -465,62 +469,57 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on}return (- <div className="flex w-full justify-center">- <WizardCard className="gap-6">- <div className="flex flex-wrap items-center justify-between gap-4">- <div className="space-y-2">- <EyebrowBadge tone="mint">{t('agentDetection.eyebrow')}</EyebrowBadge>- <h2 className="text-[28px] font-bold leading-tight tracking-[-0.4px] text-foreground">- {t('agentDetection.title')}- </h2>- <p className="max-w-[560px] text-[14px] leading-[1.55] text-muted">- {t('agentDetection.subtitle')}- </p>- </div>- <div className="flex items-center gap-2 rounded-full border border-border bg-foreground/[0.04] px-3 py-1.5">- <span className="font-mono text-[11px] font-bold uppercase tracking-[0.16em] text-mint-ink">- {enabledCount} active- </span>- </div>- </div>-- {Inner}-- <div className="flex items-center justify-between gap-3 border-t border-border pt-4">- {onBack ? (- <Button- type="button"- variant="secondary"- size="default"- onClick={onBack}- className="font-semibold"- >- <ArrowLeft size={14} strokeWidth={2.25} />- {t('common.back')}- </Button>- ) : (- <span />- )}- <div className="flex flex-1 flex-col items-end gap-1.5 sm:flex-none">- {opencodeNeedsPermission && (- <p className="text-right text-[12px] text-gold-ink">- {t('agentDetection.permissionGateHint')}- </p>- )}- <Button- type="button"- variant="brand"- size="default"- onClick={() => void handlePrimaryAction()}- disabled={!canContinue || syncing}- className="w-full sm:w-auto"- >- {t('common.continue')}- <ArrowRight size={14} strokeWidth={2.25} />- </Button>- </div>+ <div className="onboarding-setup">+ <header className="onboarding-heading">+ <h2>{t('onboarding.setup.title')}</h2>+ <p>{t('onboarding.setup.subtitle')}</p>+ </header>+ {modelHubEnabled === true && <MigrationBanner />}+ <div className="onboarding-assistants">+ <div className="onboarding-assistants-header">+ <h3>{t('onboarding.setup.assistants')}</h3>+ <Button type="button" variant="ghost" size="sm" onClick={() => void detectAll()}+ disabled={isAnyInstalling || Object.values(detectingAgents).some(Boolean)}>+ <RefreshCw size={14} />{t('agentDetection.rescan')}+ </Button></div>- </WizardCard>+ {ASSISTANT_ORDER.map((name) => {+ const agent = agents[name];+ const result = installResults[name];+ const error = detectionErrors[name] ? { message: detectionErrors[name] }+ : result && !result.ok && result.message ? result : undefined;+ return <AssistantRow key={name} backend={name} status={agent.status || 'unknown'}+ installing={!!installingAgents[name]} detecting={!!detectingAgents[name]} error={error}+ onInstall={() => void installAgent(name)} onDetect={() => void detect(name, agent.cli_path)}+ onConfigure={() => setProviderModal(name)}+ configuringDisabled={syncing}+ enabledControl={<label className="flex items-center gap-2 text-xs text-muted">+ <input type="checkbox" className="size-3.5 accent-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"+ checked={agent.enabled} onChange={(event) => toggle(name, event.target.checked)} />+ {t('onboarding.setup.enabled')}+ </label>}+ lifecycle={<BackendLifecycleChip name={name} enabled={agent.enabled} cliStatus={agent.status || 'unknown'}+ readyLabel={t('onboarding.setup.installed')}+ onChanged={async (info) => {+ const installedPath = info?.installedPath || agent.cli_path;+ setAgents((previous) => ({ ...previous, [name]: { ...previous[name], cli_path: installedPath } }));+ await detect(name, installedPath);+ }} />}+ />;+ })}+ </div>+ <OpencodePermissionSetup cliReady={opencodeAgent?.status === 'ok'}+ permissionAllowed={permission.permissionAllowed} state={permission.state} message={permission.message}+ onSetup={() => void permission.setupPermission()} className="w-full" />+ {providerDialog}+ <div className="onboarding-setup-footer">+ <Button type="button" variant="brand" className="h-11 min-w-36" onClick={() => void handlePrimaryAction()}+ disabled={!canContinue || syncing}>+ {t('common.continue')}<ArrowRight size={16} />+ </Button>+ {opencodeNeedsPermission && <p className="text-center text-xs text-gold-ink">{t('agentDetection.permissionGateHint')}</p>}+ {onBack && <Button type="button" variant="ghost" size="sm" disabled={syncing} onClick={() => onBack({ agents })}><ArrowLeft size={14} />{t('common.back')}</Button>}+ </div></div>);};diff --git a/ui/src/components/steps/Welcome.tsx b/ui/src/components/steps/Welcome.tsxindex b00771cf0..741478317 100644--- a/ui/src/components/steps/Welcome.tsx+++ b/ui/src/components/steps/Welcome.tsx@@ -1,85 +1,61 @@-import React from 'react';-import { ArrowRight, HardDrive, PlugZap, Radio, Sparkles } from 'lucide-react';+import { useRef, useState } from 'react';+import { ArrowRight, RefreshCw } from 'lucide-react';import { useTranslation } from 'react-i18next';-import { WizardCard } from '../visual';+import { useApi } from '../../context/ApiContext';import { Button } from '../ui/button';+import { CollaborationStory } from '../onboarding/CollaborationStory';+import { AccessTiles } from '../onboarding/AccessTiles';+import { ASSISTANT_ORDER } from '../onboarding/collaborationTimeline';+import { DEFAULT_AGENT_STATE } from '@/lib/agentBackends';+import '../onboarding/onboarding.css';interface WelcomeProps {- onNext: (data: any) => void;+ data?: { agents?: Record<string, { cli_path?: string }> };+ onNext: (data: unknown) => void | Promise<void>;}-// Mirrors design.pen welCard (EYBEx): 920px card, 80×80 mint logo with strong glow,-// 42px title, 16px subtitle (max 680), three accented feature tiles, large mint-// "Get started" button. Card colors: #11111c with 1px white/8 stroke and a soft-// mint shadow (#5BFFA014, blur 64, y32, spread -12).-export const Welcome: React.FC<WelcomeProps> = ({ onNext }) => {+export function Welcome({ data, onNext }: WelcomeProps) {const { t } = useTranslation();-- const features = [- {- Icon: HardDrive,- iconClass: 'text-mint-ink',- title: t('welcome.card1Title'),- body: t('welcome.feature1'),- },- {- Icon: PlugZap,- iconClass: 'text-cyan-ink',- title: t('welcome.card2Title'),- body: t('welcome.feature2'),- },- {- Icon: Sparkles,- iconClass: 'text-violet-ink',- title: t('welcome.card3Title'),- body: t('welcome.feature3'),- },- ];-+ const api = useApi();+ const [paused, setPaused] = useState(false);+ const [pending, setPending] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const busy = useRef(false);+ const start = async () => {+ if (busy.current) return;+ busy.current = true;+ setPending(true);+ setError(null);+ try {+ const results = await Promise.all(ASSISTANT_ORDER.map(async (name) => {+ const agent = { ...DEFAULT_AGENT_STATE[name], ...data?.agents?.[name] };+ const result = await api.detectCli(agent.cli_path || name);+ return [name, { ...agent, cli_path: result.path || agent.cli_path, status: result.found ? 'ok' : 'missing' }];+ }));+ await onNext({ agents: Object.fromEntries(results), __onboardingDetected: true });+ } catch (cause) {+ setError(cause instanceof Error ? cause.message : String(cause));+ } finally {+ busy.current = false;+ setPending(false);+ }+ };return (- <div className="flex w-full justify-center">- <WizardCard- size="hero"- className="items-center text-center gap-8"- >- {/* welBigLogo (A3aTA) */}- <div- className="mx-auto flex size-20 items-center justify-center rounded-[20px] border-2 border-mint/40 bg-mint/[0.16] shadow-glow-xl-mint"- aria-hidden- >- <Radio className="size-10 text-mint-ink" strokeWidth={1.75} />- </div>-- {/* welHead (OpTFX) gap 14 */}- <div className="flex flex-col items-center gap-3.5">- <h1 className="text-[28px] font-bold leading-[1.1] tracking-[-0.4px] text-foreground sm:text-[42px] sm:leading-[1.05] sm:tracking-[-0.8px]">- {t('welcome.title')}- </h1>- <p className="max-w-[680px] text-[16px] leading-[1.55] text-muted">- {t('welcome.subtitle')}- </p>- </div>-- {/* welHilights (QdiUZ) — three feature tiles, gap 16 */}- <div className="grid w-full gap-4 text-left md:grid-cols-3">- {features.map(({ Icon, iconClass, title, body }) => (- <div- key={title}- className="flex flex-col gap-2 rounded-xl border border-foreground/[0.08] bg-background px-4 py-[18px]"- >- <Icon className={`size-5 ${iconClass}`} strokeWidth={1.75} />- <div className="text-[14px] font-semibold leading-tight text-foreground">{title}</div>- <p className="text-[12px] leading-[1.5] text-muted">{body}</p>- </div>- ))}- </div>-- {/* welStart (a95QY) — large mint pill */}- <Button type="button" variant="brand" size="hero" onClick={() => onNext({})} className="group">- {t('welcome.getStarted')}- <ArrowRight className="size-4 transition-transform group-hover:translate-x-0.5" strokeWidth={2.25} />- </Button>- </WizardCard>+ <div className="onboarding-welcome">+ <header className="onboarding-heading">+ <h1>{t('onboarding.welcome.title')}</h1>+ <p>{t('onboarding.welcome.subtitle')}</p>+ </header>+ <CollaborationStory paused={paused} onPausedChange={setPaused} />+ <AccessTiles paused={paused} />+ <Button type="button" variant="brand" className="group h-11 min-w-36" onClick={() => void start()} disabled={pending}>+ {t(pending ? 'onboarding.welcome.detecting' : error ? 'common.retry' : 'onboarding.welcome.getStarted')}+ {pending ? <RefreshCw size={16} className="motion-safe:animate-spin" /> : <ArrowRight size={16} className="motion-safe:transition-transform motion-safe:duration-180 motion-safe:group-hover:translate-x-1" />}+ </Button>+ {error && <div role="alert" className="text-center text-sm text-destructive-ink">+ <p>{t('onboarding.welcome.detectionFailed')}</p>+ <details className="mt-2 max-w-xl break-words"><summary>{t('onboarding.details')}</summary>{error}</details>+ </div>}</div>);-};+}diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 08aaca7e4..9645223d7 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -5196,5 +5196,72 @@"narrowTitle": "Narrow Project access?","narrowBody": "Some people may lose access as soon as this policy is applied."}+ },+ "onboarding": {+ "welcome": {+ "getStarted": "Get started",+ "title": "Great on their own. Better together",+ "subtitle": "Claude Code, Codex, and OpenCode — from planning to delivery",+ "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",+ "pause": "Pause animation",+ "play": "Play animation",+ "replay": "Replay animation",+ "claude": {+ "name": "Claude Code",+ "role": "PM",+ "waiting": "Planning the work",+ "working": "Writing the project brief",+ "complete": "Project brief ready",+ "summary": "Summarizing the delivery"+ },+ "codex": {+ "name": "Codex",+ "role": "Developer",+ "waiting": "Waiting for the brief",+ "working": "Writing code",+ "complete": "Implementation ready"+ },+ "opencode": {+ "name": "OpenCode",+ "role": "Tester",+ "waiting": "Waiting for the code",+ "working": "Writing and running tests",+ "complete": "All tests passed"+ }+ },+ "access": {+ "label": "Work from anywhere",+ "description": "Work on the go with the Avibe app or your favorite chat apps",+ "avibe": "Avibe App",+ "slack": "Slack",+ "discord": "Discord",+ "telegram": "Telegram",+ "lark": "Feishu",+ "wechat": "WeChat"+ },+ "setup": {+ "title": "Connect AI. Get to work",+ "subtitle": "Install an assistant and connect a model to get started",+ "assistants": "AI assistants",+ "claudeDescription": "Anthropic’s coding assistant",+ "codexDescription": "OpenAI’s coding assistant",+ "opencodeDescription": "An open-source coding assistant for multiple models",+ "install": "Install",+ "installed": "Installed",+ "notInstalled": "Not installed",+ "installFailed": "Installation failed",+ "enabled": "Enabled",+ "subscription": "Subscription",+ "api_key": "API Key",+ "subscriptionConnected": "Subscription connected",+ "api_keyConnected": "API Key connected"+ }}}diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex ac01316e6..1fc58c7dd 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -5196,5 +5196,72 @@"narrowTitle": "收紧项目访问权限?","narrowBody": "策略应用后,部分用户可能立即失去访问权限。"}+ },+ "onboarding": {+ "welcome": {+ "getStarted": "开始使用",+ "title": "各有所长,接力完成",+ "subtitle": "让 Claude Code、Codex、OpenCode 一起工作",+ "detecting": "检测中…",+ "detectionFailed": "未能检测助手,请重试。"+ },+ "details": "查看详情",+ "story": {+ "label": "助手接力协作",+ "description": "Claude Code 规划任务,Codex 编写代码,OpenCode 执行测试,最后由 Claude Code 汇总交付。",+ "caption": "规划 · 开发 · 测试 · 交付",+ "pause": "暂停动画",+ "play": "播放动画",+ "replay": "重新播放动画",+ "claude": {+ "name": "Claude Code",+ "role": "PM",+ "waiting": "规划任务",+ "working": "编写需求文档",+ "complete": "需求文档已就绪",+ "summary": "汇总交付结果"+ },+ "codex": {+ "name": "Codex",+ "role": "开发",+ "waiting": "等待需求文档",+ "working": "编写功能代码",+ "complete": "功能代码已就绪"+ },+ "opencode": {+ "name": "OpenCode",+ "role": "测试",+ "waiting": "等待功能代码",+ "working": "编写并执行用例",+ "complete": "测试全部通过"+ }+ },+ "access": {+ "label": "随时随地安排工作",+ "description": "手机 APP 和常用聊天应用,随时随地安排工作",+ "avibe": "Avibe App",+ "slack": "Slack",+ "discord": "Discord",+ "telegram": "Telegram",+ "lark": "飞书",+ "wechat": "微信"+ },+ "setup": {+ "title": "连接AI,开始工作",+ "subtitle": "安装助手,连接模型,即可开始工作",+ "assistants": "AI 助手",+ "claudeDescription": "Anthropic 的 AI 编程助手",+ "codexDescription": "OpenAI 的 AI 编程助手",+ "opencodeDescription": "开源 AI 编程助手,支持多种模型",+ "install": "安装",+ "installed": "已安装",+ "notInstalled": "未安装",+ "installFailed": "安装失败",+ "enabled": "启用",+ "subscription": "订阅",+ "api_key": "API Key",+ "subscriptionConnected": "订阅已连接",+ "api_keyConnected": "API Key 已连接"+ }}}