Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(onboarding): rebuild first run as one morphing card plus a guided app tour
rubenluetke10-beep9d1edaf7676b
diff --git a/docs/authoring/public-docs-manifest.yaml b/docs/authoring/public-docs-manifest.yamlindex edf98bf76b..5e5e8cc3a8 100644--- a/docs/authoring/public-docs-manifest.yaml+++ b/docs/authoring/public-docs-manifest.yaml@@ -65,12 +65,13 @@ pages:file: docs/product/start-here/first-run-setup.mdtitle: Complete First-Run Setupdiataxis: tutorial- summary: Choose languages, a local or connected Brain, permissions, and voice activation without exposing credentials.+ summary: Agree to the terms, connect one Brain, find your coding agents, choose how voice starts, then take the tour of the app.authoritative_sources:- - jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.tsx- - jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.tsx- - jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx- - jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.tsx+ - jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.tsx+ - jarvis/ui/web/frontend/src/components/onboarding/beats/BrainBeat.tsx+ - jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.tsx+ - jarvis/ui/web/frontend/src/components/onboarding/beats/PermissionsBeat.tsx+ - jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts- jarvis/ui/web/onboarding_routes.pyrelated:- providers-and-api-keysdiff --git a/docs/product/privacy-safety-and-support/permissions.md b/docs/product/privacy-safety-and-support/permissions.mdindex 6aedd7f7f9..77289dd14c 100644--- a/docs/product/privacy-safety-and-support/permissions.md+++ b/docs/product/privacy-safety-and-support/permissions.md@@ -39,7 +39,7 @@ approvals remain separate.During first-run setup, an interactive Mac shows all seven rows. **Continue** isenabled when every row is ready or is waiting for the final setup restart.-Choose **Continue with text only** to skip the remaining grants. Completing+Choose **Skip for now, text only** to skip the remaining grants. Completingsetup restarts the installed desktop app when that restart is available.## Check Your Platformdiff --git a/docs/product/start-here/first-run-setup.md b/docs/product/start-here/first-run-setup.mdindex 79814c1e66..149d3cae83 100644--- a/docs/product/start-here/first-run-setup.md+++ b/docs/product/start-here/first-run-setup.md@@ -1,185 +1,170 @@---title: "Complete First-Run Setup"slug: first-run-setup-summary: "Choose languages, a local or connected Brain, permissions, and voice activation without exposing credentials."+summary: "Agree to the terms, connect one Brain, find your coding agents, choose how voice starts, then take the tour of the app."section: "Start here"section_order: 1order: 3diataxis: tutorialstatus: activeowner: maintainers-last_reviewed: 2026-07-30+last_reviewed: 2026-09-30phase: "-"audience: end-user-tags: [setup, onboarding, language, permissions, microphone, wake-word, providers]+tags: [setup, onboarding, tour, language, permissions, microphone, wake-word, providers]related: [providers-and-api-keys, audio-and-wake-word, permissions, start-your-first-chat]----First-run setup accepts the Terms, introduces model choices, checks system-access, and sets voice activation. You can finish without a cloud account or-microphone, but chat needs a ready local or connected Brain.+First-run setup is one card that changes shape from step to step. It asks only+what the assistant needs before it can work: your agreement, one Brain, how+voice starts, and (on macOS) system access. Everything else is explained+afterwards by a short tour of the real app.## Before You Start- Open the installed desktop app. The first launch may take several seconds.-- For a keyless Brain, start Ollama with one installed model. Connect a- microphone only if testing a wake word.+- Have one API key ready (OpenAI or Google Gemini is the shortest path), or run+ Ollama with one installed model for a keyless Brain.- On macOS, launch the signed app from its application bundle before grantingaccess; permissions belong to that exact app identity.-> [!warning] Enter a provider credential only under **API Keys & Providers**-> after onboarding. Never paste one into chat, speak it, put it in a wake word,-> add it to configuration, or include it in a screenshot.+> [!warning] Paste a provider credential only into the masked key field of the+> setup card or of **API Keys**. Never paste one into chat, speak it, put it in+> a wake word, add it to configuration, or include it in a screenshot.## Complete the Setup-### 1. Accept the risk notice and view the tour+The dots at the bottom of the card show where you are, and **Step X of Y**+counts the steps this computer needs (macOS has one more). **Back** returns to+the previous step, never behind the agreement. If the window reloads, the card+reopens on the step you were on.-1. On **Before you continue**, read the summary and use **View the full Terms of- Use** for the complete text.-2. Accept the risk checkbox, then select **I understand — continue**. **Decline- & quit** closes the app; the notice returns next time.-3. Play or skip **Watch the 2-minute tour**, then select **Get started** on the- welcome screen.+### 1. Agree to the terms-**Skip setup for now** skips only the welcome step and continues to language.-It does not dismiss the remaining first-run guide.+The first card lists what the assistant does on this computer: it runs+commands and changes files, can see your screen when asked, sends what you say+to the provider you choose, is billed by that provider, and can make mistakes.-### 2. Choose interface and reply languages+1. Pick **English**, **Deutsch** or **Español** in the card's corner if you want+ another interface language. You can change it later under **Settings >+ Languages**.+2. Optionally open **Read the full Terms of Use**.+3. Tick the agreement, then select **Agree and continue**. **Decline and quit**+ closes the app without saving anything; the card asks again next time.-On **Choose your language**, select **Interface language** and **Reply-language**, then **Next**. English, German, and Spanish are supported.+### 2. Give it a brain-Interface language changes menus. Reply language controls answers; **Auto**-follows the conversation without switching for short interjections. Wake-word-pronunciation is separate and can be pinned under **Settings > Wake Word**.+Choose one way to think and talk:-### 3. Choose a Brain path and learn the voice modes+- **OpenAI GPT-Live** (recommended) or **Gemini Live**: paste that provider's+ key into the field. The key is tested as soon as it is saved, and live voice+ plus its thinking model are pointed at it. The card confirms **Connected**.+- **Another provider**: opens the full list of Brain providers; saving the first+ key makes that provider the active Brain.+- **Run on this computer**: uses Ollama with no key. The link reads **Ollama+ found** when a local server answers; **Use the local model** switches the+ Brain to it and voice to the listen-think-speak pipeline.-**Set up API keys after onboarding** previews **API Keys & Providers**. It does-not accept a key, choose a cloud provider, or test an account.+**Continue** unlocks once one path works. **I'll add a key later** moves on;+the last step then says that chat and voice stay off until a key exists.-| Voice mode | What the onboarding screen offers |-|---|---|-| **Realtime (recommended, research preview)** | One compatible OpenAI or Gemini credential handles listening, reasoning, and speech in one live connection |-| **Pipeline (not recommended)** | Separate choices handle **Brain**, **Voice Input**, and **Voice Output** |+### 3. Hand off the big jobs-The same step checks this machine for Ollama:+The card shows the coding agents this computer is already signed in to (for+example a subscription you use in a terminal). Connect one with its own+browser sign-in, or select **Check again** after signing in elsewhere. This+step is optional: **Continue** is always available.-- **Use local model** appears when Ollama is reachable with a model; it makes- Ollama the active Brain without a key.-- If Ollama is empty, install a model there first. The wizard does not download- one.-- **Get Ollama** appears when no server is detected; you may choose another- Brain later.+### 4. Allow access on this Mac (macOS only)-This button changes only the Brain, not voice, vision, or other model features.-Select **Continue onboarding** when ready.+The rows are the same as under **Settings > Privacy permissions**: Microphone,+Screen Recording, Accessibility, Input Monitoring, Input control, Automation+and Keychain. Use **Allow** or **Open Settings**, return, and wait for the row+to update. A grant that only reads back after a restart counts as ready; the+final restart applies it. **Skip for now, text only** defers all of them.-### 4. Review operating-system permissions+Windows and Linux do not show this step.-On macOS, **Allow access on this Mac** shows **Microphone**, **Screen-Recording**, **Accessibility**, **Input Monitoring**, **Input control**, and-**Keychain (API keys)**. Grant only what you need:+### 5. Choose how you call it-- Microphone supports voice input; Screen Recording, Accessibility, and Input- control support Computer Use; Input Monitoring supports global shortcuts;- Keychain stores credentials encrypted.+- **A wake word**: **Hey** is fixed, you type the rest (at least two letters).+ The word also becomes the assistant's name; the card shows it as you type,+ for example **Your assistant will be called Nova**. Tick that you are+ responsible for the word, then select **Save and continue**. If no local+ engine can hear that word yet, the card offers the local speech pack, or+ **Continue with the shortcut for now**.+- **A keyboard shortcut**: nothing listens until you press the Call keys the+ card shows (for example **F3 + F4**).-Use **Allow** or **Open Settings**, return, and wait for the status. **Allowed**,-**Not required**, and **Restart pending** are ready. Pending access applies-during the final restart. To defer access, select **Continue with text only**.+**Test microphone** listens for three seconds and fills the level meter. It+reports a clear, quiet, missing or blocked input and never blocks saving.-Windows and Linux show **No extra desktop privacy permissions are required on-this operating system**. This does not prove that a microphone, display,-shortcut, or platform backend is available.+### 6. All set-### 5. Choose how voice starts and name the assistant+The last card lists what each step set up and, in plain lines, what is still+missing. Turn on **Start at login** if the switch appears. **Start** (or+**Start Nova** with a wake word) saves the setup and restarts the app once so+every choice takes effect together.-On the activation screen, choose one path:+## Take the Tour-- **Keyboard shortcut** disables always-listening activation. Use the Call- shortcut later. With no wake phrase, the neutral name is **Assistant**.-- **Wake word** keeps a local listener ready for your phrase. **Hey** is fixed;- enter at least two characters for the rest. The phrase also defines the- assistant's display name. For example, entering **Nova** shows **Your- assistant will be called: Nova**.+After the restart the app opens with a short guided tour. It dims the window,+lights up one part of the real interface at a time, and explains it in a small+card: the voice bar, a new chat, the agents and their world, Voice, Artifacts,+the Agentic IDE, Plugins and the Marketplace, and Settings.-Accept responsibility for the name, then optionally select **Test your-microphone** or **Say your wake word once**. Both check the input level and-report good, quiet, missing, blocked, or temporarily unavailable input. The-check does not block saving.--Select **Save wake word**. If no local engine supports it, choose **Enable any-wake word** to install the optional local wake speech pack, then save again.-This repairs wake detection, not the full Pipeline voice stack. **Continue-anyway** leaves the Call shortcut as the reliable path until wake is healthy.--### 6. Finish and restart once--On **You're all set!**, review skipped entries. Enable **Start Jarvis-automatically at login** only if the supported switch appears.--Select **Get started**. Setup is saved before one fresh restart initializes the-new choices. If it does not restart, reopen the app manually.--## Connect and Test Providers After Setup--Open **API Keys**. Under **Brain**, use Ollama or connect one provider you have.-For voice, choose **Realtime** or **Pipeline** and connect only its required-categories. Each card shows its supported sign-in method.--Save credentials only in the masked card, then select **Test**. **Works** proves-the account, model, quota, and service answered. The app prefers the OS-credential store; its user-local fallback is not OS-encrypted.+- **Next** moves on; clicking the highlighted part yourself does the same.+- The tour navigates by itself where needed (into the agents' world and back)+ and ends on the home screen. It never starts a call or any work for you.+- **Skip tour** or **Escape** ends it at any point.+- Replay it anytime under **Settings > App > App tour**.## Recover a Skipped or Deferred Choice-- Change interface and reply languages under **Settings > Languages**.+- Change the interface and reply languages under **Settings > Languages**.+- Connect and test models under **API Keys**; the same place connects coding+ agents by key or subscription.- Repair macOS access under **Settings > Privacy permissions**.- Change the phrase, spoken wake language, activation switch, or local wake- pack under **Settings > Wake Word**.-- Record or change the Call shortcut under **Settings > Voice Keybinds**.-- Connect and test models under **API Keys & Providers**; change login startup- under **Settings > App settings** where supported.+ pack under **Settings > Wake Word**, and the Call shortcut under **Settings >+ Voice Keybinds**.+- Change login startup under **Settings > App** where supported.## How It Fits Together-1. Interface language controls menus; reply language controls answers.-2. The wake phrase supplies both local activation and the assistant's name.+1. The agreement is the only consent moment; the installer asks nothing.+2. One Brain is enough to start. A starter plan points live voice and its+ thinking model at the same key; any other single Brain key works too.+3. Coding agents are optional helpers for longer jobs and connect separately.+4. The wake phrase supplies both local activation and the assistant's name.The Call shortcut starts voice without an always-listening wake engine.-3. Permissions allow an operating-system capability; they do not approve a+5. Permissions allow an operating-system capability; they do not approve alater Computer Use action or bypass its safety check.-4. The Brain handles chat reasoning. Pipeline adds separate voice input and- output; Realtime combines the live voice path.-5. Ready compatible providers can act as fallbacks; otherwise the affected- feature reports that setup is needed.+6. One restart at the end applies every choice; the tour runs once after it.## Check That It Works-1. After **Get started**, confirm the app returns to the main sidebar and the- first-run guide stays closed.+1. After **Start**, confirm the app reopens and the tour begins.2. Open **API Keys**, select **Test** on the active Brain card, and look for**Works**.-3. Open **Chats** and send a harmless message. Confirm a reply arrives in the- selected reply language.-4. For voice, verify **Settings > Audio devices** and try the Call shortcut. If- wake is enabled, run **Test wake word** and try the phrase after restart.+3. Start a new chat and send a harmless message. Confirm a reply arrives.+4. For voice, press the Call shortcut or say your wake word.-On a headless system, verify text chat or the Control API; desktop-only features-should report their limits rather than prevent startup.+On a headless system there is no restart; verify text chat or the Control API.+Desktop-only features report their limits rather than prevent startup.## Troubleshooting| What you see | What it usually means | What to do ||---|---|---|-| **Use local model** does not appear | Ollama was unreachable or empty | Continue, prepare Ollama, then use its Brain card under **API Keys** |-| **Continue** is disabled on macOS | A permission or stable app-identity check is unresolved | Use **Allow** or **Open Settings**, return and wait for refresh, or choose **Continue with text only** |-| Microphone check reports quiet, missing, or blocked | The input has no usable signal | Check OS access and **Settings > Audio devices** |-| Saved wake word does not respond | Its local model, spoken-language pin, microphone, or activation switch is not ready | Use the Call shortcut; under **Settings > Wake Word**, choose the language you speak, install the offered model, and run **Test wake word** |-| Provider card is active but chat cannot answer | Active does not guarantee a successful live request | Select **Test**, follow the visible error, or configure another compatible provider family |+| **Continue** stays disabled on the brain step | The key was not saved or its test failed | Read the line under the key field, fix the key, or choose **I'll add a key later** |+| **Ollama found** does not appear | Ollama was unreachable or has no model | Continue, prepare Ollama, then use its card under **API Keys** |+| **Continue** is disabled on macOS | A permission or stable app-identity check is unresolved | Use **Allow** or **Open Settings**, return and wait, or choose **Skip for now, text only** |+| Microphone test reports quiet, missing, or blocked | The input has no usable signal | Check OS access and **Settings > Audio devices** |+| Saved wake word does not respond | Its local model, language, microphone, or activation switch is not ready | Use the Call shortcut; under **Settings > Wake Word**, install the offered model and run **Test wake word** |+| The tour does not appear after the restart | The app opened in the Agentic IDE, or the tour was already seen | Leave the IDE, or replay it under **Settings > App** || App does not reopen | The restart could not start a fresh process | Open the app; setup was already saved |-| First-run setup returns every launch | The completion state is not being read from the same writable data location | Stop repeating setup and follow [Troubleshooting](troubleshooting) for data-directory and version checks |+| First-run setup returns every launch | The completion state is not read from the same writable data location | Follow [Troubleshooting](troubleshooting) for data-directory and version checks |## Next Stepsdiff --git a/jarvis/setup/onboarding_fastpath.py b/jarvis/setup/onboarding_fastpath.pyindex 364a4fe0bb..c7e6919d2f 100644--- a/jarvis/setup/onboarding_fastpath.py+++ b/jarvis/setup/onboarding_fastpath.py@@ -55,7 +55,7 @@ def state_payload(path: Path | None = None) -> dict:s = {"completed_at": None, "current_step": None, "skipped_steps": [],"terms_accepted_at": None, "terms_version": None,- "wake_word_acknowledged_at": None,+ "wake_word_acknowledged_at": None, "tour_completed_at": None,}legacy_done = False@@ -78,6 +78,9 @@ def state_payload(path: Path | None = None) -> dict:"current_version": CURRENT_TERMS_VERSION,},"wake_word_acknowledged": s["wake_word_acknowledged_at"] is not None,+ # The guided tour of the real app runs once, after the completion+ # restart; the frontend shows it while completed and not yet toured.+ "tour_completed": s.get("tour_completed_at") is not None,"legal_references": WAKE_WORD_LEGAL_REFERENCES,"steps": ONBOARDING_STEPS,}@@ -158,6 +161,10 @@ async def handle(scope: dict, receive: Any, send: Any) -> bool:st.mark_onboarding_complete(_path())await _send_json(send, {"ok": True})return True+ if method == "POST" and sub == "/tour-complete":+ st.mark_tour_complete(_path())+ await _send_json(send, {"ok": True})+ return Trueawait _send_json(send, {"ok": False, "error": "unknown onboarding route"}, status=404)return Truediff --git a/jarvis/setup/onboarding_meta.py b/jarvis/setup/onboarding_meta.pyindex 5cd0e812e0..0ff3544bac 100644--- a/jarvis/setup/onboarding_meta.py+++ b/jarvis/setup/onboarding_meta.py@@ -14,23 +14,23 @@ logger = logging.getLogger(__name__)CURRENT_TERMS_VERSION = "1.0"-# Canonical step order — must match the frontend step REGISTRY keys.-# The standalone Terms & Disclaimer step was removed (2026-07-03): the legal-# posture now rests on the up-front risk gate + the MIT-license disclaimer, so-# first-run stays short. The /terms + /accept-terms routes remain for back-compat-# but are no longer part of the guided flow.-# Restart batching (maintainer mandate 2026-07-18): permissions and wake-word-# sit LAST, directly before finish, because both only take full effect after a+# Canonical step order — must match the frontend beat list+# (components/onboarding/beats.ts). The guide is one card that changes shape+# per step; the tour of the real app runs AFTER the completion restart and is+# tracked separately (``tour_completed_at`` in jarvis.setup.state).+# Restart batching (maintainer mandate 2026-07-18): permissions and voice sit+# LAST, directly before ready, because both only take full effect after a# relaunch — and onboarding already ends with one unconditional fresh restart# (onboarding_routes._schedule_fresh_restart). One restart covers everything;-# the guide must never demand a second one mid-flow.+# the guide must never demand a second one mid-flow. Permissions precede voice+# so the macOS microphone grant exists before the voice step's mic check.ONBOARDING_STEPS: list[str] = ["welcome",- "language",- "api-keys",+ "brain",+ "agents","permissions",- "wake-word",- "finish",+ "voice",+ "ready",]# Informational only; not exhaustive and possibly out of date (stated in the UI).diff --git a/jarvis/setup/state.py b/jarvis/setup/state.pyindex ba9a5f5999..22bd8e3b60 100644--- a/jarvis/setup/state.py+++ b/jarvis/setup/state.py@@ -219,6 +219,9 @@ _ONBOARDING_KEYS = (# belong to the first run, so an onboarding reset clears them too."starter_plan","ready_celebrated_at",+ # The guided tour of the real app, shown once after the completion+ # restart. Reset with the rest so a replayed first run tours again.+ "tour_completed_at",)@@ -271,6 +274,7 @@ def get_onboarding_state(path: Path | None = None) -> dict[str, Any]:"terms_accepted_at": s.get("terms_accepted_at") or None,"terms_version": s.get("terms_version") or None,"wake_word_acknowledged_at": s.get("wake_word_acknowledged_at") or None,+ "tour_completed_at": s.get("tour_completed_at") or None,}@@ -300,6 +304,11 @@ def mark_onboarding_complete(path: Path | None = None) -> None:_merge_state({"onboarding_completed_at": _now_iso()}, path)+def mark_tour_complete(path: Path | None = None) -> None:+ """Record that the guided app tour was finished or skipped."""+ _merge_state({"tour_completed_at": _now_iso()}, path)++def set_starter_plan(plan_id: str, path: Path | None = None) -> None:_merge_state({"starter_plan": plan_id}, path)@@ -358,6 +367,7 @@ __all__ = ["mark_obsidian_seen","get_onboarding_state","is_onboarding_complete",+ "mark_tour_complete","set_onboarding_step","accept_terms","acknowledge_wake_word",diff --git a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsxindex 55fd830d71..0a86b58e38 100644--- a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx+++ b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx@@ -339,8 +339,8 @@ export function JarvisAgentSection({{hasSubscriptionColumn ? (<AgentGroupicon={Terminal}- title={t("onboarding.api_keys.agents_subscriptions_label")}- hint={t("onboarding.api_keys.agents_subscriptions_hint")}+ title={t("first_run.agents.subscriptions_label")}+ hint={t("first_run.agents.subscriptions_hint")}testId="agent-group-clis">{codexRow && (@@ -360,7 +360,7 @@ export function JarvisAgentSection({))}</AgentGroup>) : (- <p className="text-sm text-muted-foreground">{t("onboarding.api_keys.agents_unavailable")}</p>+ <p className="text-sm text-muted-foreground">{t("first_run.agents.unavailable")}</p>)}</section>);diff --git a/jarvis/ui/web/frontend/src/components/MascotGigi.tsx b/jarvis/ui/web/frontend/src/components/MascotGigi.tsxindex 405c4c1f3e..903fc21859 100644--- a/jarvis/ui/web/frontend/src/components/MascotGigi.tsx+++ b/jarvis/ui/web/frontend/src/components/MascotGigi.tsx@@ -3,7 +3,7 @@ import { cn } from "@/lib/utils";import { translate, useT } from "@/i18n";import { useEventStore, type VoiceState, type SectionId } from "@/store/events";-type MascotAction =+export type MascotAction =| "idle"| "blink"| "wave"@@ -44,6 +44,11 @@ type Props = {className?: string;reactToVoice?: boolean;enableComments?: boolean;+ /**+ * A one-shot move asked for by the parent — the first-run guide greets each+ * step with one. A new `key` replays the move even when the action repeats.+ */+ cue?: { action: MascotAction; key: string | number };};export function MascotGigi({@@ -51,6 +56,7 @@ export function MascotGigi({className,reactToVoice = true,enableComments = true,+ cue,}: Props) {const t = useT();const uid = `gigi${useId().replace(/:/g, "")}`;@@ -88,6 +94,15 @@ export function MascotGigi({};}, []);+ const cueAction = cue?.action;+ const cueKey = cue?.key;+ useEffect(() => {+ if (!cueAction || cueAction === "idle") return;+ setAction(cueAction);+ const back = setTimeout(() => setAction("idle"), ACTION_DURATION_MS[cueAction]);+ return () => clearTimeout(back);+ }, [cueAction, cueKey]);+const voiceClass = reactToVoice ? voiceClassFor(voiceState) : "";// Below ~80px blur-halos turn into a muddy disc. The mark is then just// ink: black body, white eyes and outline, no plate behind it.diff --git a/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsx b/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsxindex 2f31097de0..759fe17dd9 100644--- a/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsx+++ b/jarvis/ui/web/frontend/src/components/home/JarvisBar.tsx@@ -109,6 +109,7 @@ export function JarvisBar({ phase, hint }: { phase: WaveformPhase; hint: stringonClick={onCardClick}onKeyDown={onCardKey}data-testid="jarvis-bar"+ data-tour="voice-bar"data-phase={phase}data-active={callActive || undefined}className={cn(diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsxindex bd26df5883..d475466aa9 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx@@ -499,7 +499,7 @@ export function Sidebar({</nav> : <nav aria-label={t("sidebar.sections")} className="space-y-1 px-2 py-2"><ul className="space-y-1"><li><Dialog.Root open={newChatOpen} onOpenChange={(open) => { if (!startingVoiceRef.current) setNewChatOpen(open); }}>- <Dialog.Trigger asChild><button type="button" data-testid="sidebar-new-chat"+ <Dialog.Trigger asChild><button type="button" data-testid="sidebar-new-chat" data-tour="new-chat"aria-label={t("sidebar.new_chat")} title={t("sidebar.new_chat")} className={rowClass}><Plus aria-hidden className="h-4 w-4 shrink-0" />{!railed && <span>{t("sidebar.new_chat")}</span>}@@ -550,6 +550,7 @@ export function Sidebar({<div className={cn("flex items-center gap-1", railed && "flex-col")}><button type="button" onClick={() => setActive("profile")} title={t("nav.profile")}data-testid="sidebar-profile-toggle"+ data-tour="settings"className={cn(rowClass, "min-w-0 flex-1", hubActive && "jarvis-nav-active bg-secondary text-foreground")}><span className="relative shrink-0"><UserCircle2 aria-hidden className="h-7 w-7" />@@ -639,6 +640,7 @@ function NavRow({<buttontype="button"data-testid={`nav-row-${item.id}`}+ data-tour={`nav-${item.id}`}onClick={onClick}title={compact ? `${label}${hint ? ` — ${hint}` : ""}` : hint}aria-label={compact ? label : undefined}diff --git a/jarvis/ui/web/frontend/src/components/local-models/SetupProposalCard.tsx b/jarvis/ui/web/frontend/src/components/local-models/SetupProposalCard.tsxindex bf46fd431c..7c33f74799 100644--- a/jarvis/ui/web/frontend/src/components/local-models/SetupProposalCard.tsx+++ b/jarvis/ui/web/frontend/src/components/local-models/SetupProposalCard.tsx@@ -18,7 +18,7 @@ import { useCallback, useMemo, useState, type ReactNode } from "react";import { Button } from "@/components/agentic/controls";import { Panel, StatusDot } from "@/components/extensions/primitives";-import { Register, StepFooter, StepSection } from "@/components/onboarding/primitives";+import { Register, StepFooter, StepSection } from "@/components/ui/editorial";import { switchBrainProvider } from "@/hooks/useProviders";import { fill, useT } from "@/i18n";import { cn } from "@/lib/utils";diff --git a/jarvis/ui/web/frontend/src/components/onboarding/AgentAccessList.tsx b/jarvis/ui/web/frontend/src/components/onboarding/AgentAccessList.tsxdeleted file mode 100644index 3337fa9d6a..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/AgentAccessList.tsx+++ /dev/null@@ -1,124 +0,0 @@-import { useState } from "react";-import { KeyRound } from "lucide-react";-import { ApiKeyForm } from "@/components/ApiKeyForm";-import { Button, FOCUS_RING } from "@/components/agentic/controls";-import { JarvisAgentSection } from "@/components/JarvisAgentSection";-import { switchSubagentProvider } from "@/hooks/useProviders";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import { StatusLine } from "./primitives";--export interface AgentAccessRow {- jarvis: string;- label?: string | null;- billing?: string;- secret_key?: string | null;- dashboard_url?: string | null;- credential_help?: string | null;- dedicated_key_set?: boolean;- oauth_connected?: boolean;- is_active_brain?: boolean;- keyless?: boolean;-}--/** Keep the API key choices visible during onboarding; only the selected form expands. */-export function AgentAccessList({- rows,- onChanged,-}: {- rows: AgentAccessRow[] | null;- onChanged: () => void | Promise<void>;-}) {- const t = useT();- const [selectedId, setSelectedId] = useState<string | null>(null);- const [switching, setSwitching] = useState(false);- const [error, setError] = useState<string | null>(null);- const keyRows = (rows ?? []).filter((row) =>- row.secret_key && (row.billing === "api" || row.billing === "subscription_or_api"),- );- const selected = keyRows.find((row) => row.jarvis === selectedId) ??- keyRows.find((row) => row.is_active_brain) ?? keyRows[0];-- async function activate(row: AgentAccessRow) {- if (switching) return;- setSwitching(true);- setError(null);- try {- await switchSubagentProvider(row.jarvis);- window.dispatchEvent(new CustomEvent("jarvis:agent-switched"));- await onChanged();- } catch (cause) {- setError(cause instanceof Error ? cause.message : String(cause));- } finally {- setSwitching(false);- }- }-- return (- <div className="space-y-6" data-testid="onboarding-agent-access">- <div data-testid="onboarding-agent-subscriptions">- <JarvisAgentSection hideHeader subscriptionsOnly />- </div>- <div className="space-y-4 border-t border-border pt-5">- <div>- <p className="flex items-center gap-2 text-sm font-semibold text-foreground">- <KeyRound className="h-4 w-4 text-primary" />- {t("onboarding.api_keys.agents_api_title")}- </p>- <p className="mt-1 text-sm text-muted-foreground">{t("onboarding.api_keys.agents_api_hint")}</p>- </div>- {rows === null ? (- <p className="text-sm text-muted-foreground">{t("onboarding.api_keys.agents_loading")}</p>- ) : keyRows.length === 0 ? (- <StatusLine tone="warning">{t("onboarding.api_keys.agents_unavailable")}</StatusLine>- ) : (- <div className="overflow-hidden rounded-xl border border-border bg-card" data-testid="onboarding-agent-key-list">- {keyRows.map((row) => (- <button- key={row.jarvis}- type="button"- aria-pressed={selected?.jarvis === row.jarvis}- data-testid={`onboarding-agent-key-${row.jarvis}`}- onClick={() => setSelectedId(row.jarvis)}- className={cn(- "flex w-full items-center justify-between gap-3 border-b border-border/60 px-4 py-3 text-left last:border-b-0 hover:bg-secondary/50",- selected?.jarvis === row.jarvis && "bg-secondary/40",- FOCUS_RING,- )}- >- <span className="text-sm font-medium text-foreground">{row.label || row.jarvis}</span>- <span className="text-xs text-muted-foreground">- {row.dedicated_key_set- ? row.is_active_brain- ? t("onboarding.api_keys.agents_active")- : t("onboarding.api_keys.configured")- : t("onboarding.api_keys.not_configured")}- </span>- </button>- ))}- </div>- )}- {selected?.secret_key && (- <div className="rounded-xl border border-border bg-card p-4" data-testid="onboarding-agent-key-form">- <p className="mb-3 text-sm font-semibold text-foreground">{selected.label || selected.jarvis}</p>- <ApiKeyForm- key={selected.secret_key}- secretKey={selected.secret_key}- dashboardUrl={selected.dashboard_url ?? null}- configured={Boolean(selected.dedicated_key_set)}- credentialHelp={selected.credential_help}- onChanged={onChanged}- onSavedActivate={() => void activate(selected)}- />- {selected.dedicated_key_set && !selected.is_active_brain && (- <Button variant="quiet" disabled={switching} onClick={() => void activate(selected)}>- {t("onboarding.api_keys.agents_use_key")}- </Button>- )}- </div>- )}- {error && <StatusLine tone="error">{error}</StatusLine>}- </div>- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/IntroSequence.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/IntroSequence.test.tsxdeleted file mode 100644index 30750047f6..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/IntroSequence.test.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { act, cleanup, render, screen } from "@testing-library/react";-import { afterEach, expect, it, vi } from "vitest";--vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));-vi.mock("@/components/MascotGigi", () => ({ MascotGigi: () => <div data-testid="gigi" /> }));--import { IntroSequence } from "./IntroSequence";--afterEach(() => {- cleanup();- vi.useRealTimers();- vi.unstubAllGlobals();-});--it("renders Gigi, the first caption, and 4 progress dots", () => {- render(<IntroSequence />);- expect(screen.getByTestId("gigi")).toBeDefined();- expect(screen.getByText("onboarding.intro.scene_1")).toBeDefined();-});--it("auto-advances through the scenes over time", () => {- vi.useFakeTimers();- render(<IntroSequence />);- expect(screen.getByText("onboarding.intro.scene_1")).toBeDefined();- act(() => {- vi.advanceTimersByTime(2800);- });- expect(screen.getByText("onboarding.intro.scene_2")).toBeDefined();- act(() => {- vi.advanceTimersByTime(2800 * 5);- });- // Clamps at the last scene (does not loop past scene_4).- expect(screen.getByText("onboarding.intro.scene_4")).toBeDefined();-});--it("respects prefers-reduced-motion (renders the final scene, no timer)", () => {- vi.stubGlobal("matchMedia", (q: string) => ({- matches: q.includes("reduce"),- media: q,- addEventListener: () => {},- removeEventListener: () => {},- }));- render(<IntroSequence />);- expect(screen.getByText("onboarding.intro.scene_4")).toBeDefined();-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/IntroSequence.tsx b/jarvis/ui/web/frontend/src/components/onboarding/IntroSequence.tsxdeleted file mode 100644index 69dc8e5fd0..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/IntroSequence.tsx+++ /dev/null@@ -1,72 +0,0 @@-import { useEffect, useState } from "react";-import { MascotGigi } from "@/components/MascotGigi";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";--const SCENE_KEYS = [- "onboarding.intro.scene_1",- "onboarding.intro.scene_2",- "onboarding.intro.scene_3",- "onboarding.intro.scene_4",-] as const;--const SCENE_MS = 2800;--function prefersReducedMotion(): boolean {- try {- return window.matchMedia("(prefers-reduced-motion: reduce)").matches;- } catch {- // jsdom / older browsers without matchMedia — treat as "motion ok".- return false;- }-}--/**- * Auto-advancing, captioned brand intro on the first step. The mascot and one- * line of copy on the stage's own ground, framed by a hairline — not a boxed- * video placeholder. Stops on the last scene; renders the final scene- * immediately (no motion) when the user prefers reduced motion. Decorative —- * the step owns the CTA below it.- */-export function IntroSequence({ className }: { className?: string }) {- const t = useT();- const reduced = prefersReducedMotion();- const [scene, setScene] = useState(reduced ? SCENE_KEYS.length - 1 : 0);-- useEffect(() => {- if (reduced) return;- const id = setInterval(() => {- setScene((s) => (s < SCENE_KEYS.length - 1 ? s + 1 : s));- }, SCENE_MS);- return () => clearInterval(id);- }, [reduced]);-- return (- <div- className={cn(- "relative flex flex-col items-center justify-center gap-5 border-y border-border/70 px-6 py-8",- className,- )}- aria-live="polite"- >- <MascotGigi size={104} reactToVoice={false} enableComments={false} />- <p- key={scene}- className="animate-in fade-in text-center text-lg font-medium leading-snug tracking-tight text-foreground [text-wrap:balance] motion-reduce:animate-none"- >- {t(SCENE_KEYS[scene])}- </p>- <div className="flex gap-1.5" aria-hidden>- {SCENE_KEYS.map((k, i) => (- <span- key={k}- className={cn(- "h-1 w-5 rounded-full transition-colors",- i <= scene ? "bg-foreground/70" : "bg-muted",- )}- />- ))}- </div>- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsxdeleted file mode 100644index e45a22a79e..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsx+++ /dev/null@@ -1,122 +0,0 @@-import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";-import { afterEach, beforeEach, expect, it, vi } from "vitest";--vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));-vi.mock("@/components/MascotGigi", () => ({ MascotGigi: () => <div data-testid="gigi" /> }));--type P = { goNext: () => void; skip: () => void; setSummary: (s: string | null) => void };-const { dbl } = vi.hoisted(() => {- const dbl = (testid: string) => (p: P) => (- <div data-testid={testid}>- <button onClick={p.goNext}>next</button>- <button onClick={p.skip}>skip</button>- <button onClick={() => p.setSummary(`sum:${testid}`)}>summarize</button>- </div>- );- return { dbl };-});-vi.mock("./steps/WelcomeStep", () => ({ WelcomeStep: dbl("step-welcome") }));-vi.mock("./steps/LanguageStep", () => ({ LanguageStep: dbl("step-language") }));-vi.mock("./steps/PermissionsStep", () => ({ PermissionsStep: dbl("step-permissions") }));-vi.mock("./steps/WakeWordStep", () => ({ WakeWordStep: dbl("step-wake-word") }));-vi.mock("./steps/ApiKeysStep", () => ({ ApiKeysStep: dbl("step-api-keys") }));-vi.mock("./steps/FinishStep", () => ({ FinishStep: dbl("step-finish") }));--import { OnboardingFlow, STEP_KEYS, visibleSteps } from "./OnboardingFlow";--function stubPlatform(platform: string | "error") {- vi.stubGlobal(- "fetch",- vi.fn(() =>- platform === "error"- ? Promise.reject(new Error("net"))- : Promise.resolve({ ok: true, json: () => Promise.resolve({ platform }) }),- ),- );-}--beforeEach(() => stubPlatform("darwin"));-afterEach(() => {- cleanup();- vi.unstubAllGlobals();-});--function makeOnb(stateOverrides: Record<string, unknown> = {}) {- return {- state: {- completed: false,- current_step: null,- skipped_steps: [],- terms: { accepted: false, accepted_version: null, current_version: "1.0" },- wake_word_acknowledged: false,- legal_references: [],- steps: ["welcome", "language", "finish"],- ...stateOverrides,- },- loading: false,- error: null,- refetch: vi.fn(),- saveStep: vi.fn(),- acceptTerms: vi.fn(),- acknowledgeWakeWord: vi.fn(),- complete: vi.fn(),- } as never;-}--it("renders the Gigi host, the register and the first step", () => {- render(<OnboardingFlow onb={makeOnb()} />);- expect(screen.getByTestId("gigi")).toBeDefined();- expect(screen.getByTestId("step-welcome")).toBeDefined();- expect(screen.getByTestId("onboarding-step-welcome").getAttribute("aria-current")).toBe("step");- // Steps not yet visited cannot be jumped to from the register.- expect((screen.getByTestId("onboarding-step-finish") as HTMLButtonElement).disabled).toBe(true);-});--it("advancing persists the next step, shows it, and lets the register go back to a visited step", () => {- const onb = makeOnb();- render(<OnboardingFlow onb={onb} />);- fireEvent.click(within(screen.getByTestId("step-welcome")).getByText("next"));- expect((onb as never as { saveStep: ReturnType<typeof vi.fn> }).saveStep)- .toHaveBeenCalledWith("language", []);- expect(screen.getByTestId("step-language")).toBeDefined();- fireEvent.click(screen.getByTestId("onboarding-step-welcome"));- expect(screen.getByTestId("step-welcome")).toBeDefined();-});--it("a step's summary shows under its register entry", () => {- render(<OnboardingFlow onb={makeOnb()} />);- fireEvent.click(within(screen.getByTestId("step-welcome")).getByText("summarize"));- expect(screen.getByTestId("onboarding-step-welcome").textContent).toContain("sum:step-welcome");-});--it("always starts at the first step, ignoring a saved current_step", () => {- render(<OnboardingFlow onb={makeOnb({ current_step: "finish" })} />);- expect(screen.getByTestId("step-welcome")).toBeDefined();-});--it("skip accumulates the skipped step", () => {- const onb = makeOnb();- render(<OnboardingFlow onb={onb} />);- fireEvent.click(within(screen.getByTestId("step-welcome")).getByText("skip"));- expect((onb as never as { saveStep: ReturnType<typeof vi.fn> }).saveStep)- .toHaveBeenCalledWith("language", ["welcome"]);-});--it("hides the macOS permissions step on Windows and Linux, keeps it on macOS and when unknown", async () => {- const all = ["welcome", "permissions", "finish"];- expect(visibleSteps(all, "win32")).toEqual(["welcome", "finish"]);- expect(visibleSteps(all, "linux")).toEqual(["welcome", "finish"]);- expect(visibleSteps(all, "darwin")).toEqual(all);- expect(visibleSteps(all, null)).toEqual(all);-- stubPlatform("win32");- render(<OnboardingFlow onb={makeOnb({ steps: all })} />);- await waitFor(() => expect(screen.queryByTestId("onboarding-step-permissions")).toBeNull());- expect(screen.getByTestId("onboarding-step-finish")).toBeDefined();-});--it("REGISTRY covers exactly the canonical backend steps", () => {- expect(new Set(STEP_KEYS)).toEqual(- new Set(["welcome", "language", "permissions", "wake-word", "api-keys", "finish"]),- );-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.tsxdeleted file mode 100644index 0022e72fab..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.tsx+++ /dev/null@@ -1,260 +0,0 @@-import { useCallback, useEffect, useMemo, useState } from "react";-import { MascotGigi } from "@/components/MascotGigi";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import type { useOnboarding } from "@/hooks/useOnboarding";-import { WelcomeStep } from "./steps/WelcomeStep";-import { LanguageStep } from "./steps/LanguageStep";-import { PermissionsStep } from "./steps/PermissionsStep";-import { WakeWordStep } from "./steps/WakeWordStep";-import { ApiKeysStep } from "./steps/ApiKeysStep";-import { FinishStep } from "./steps/FinishStep";--export interface StepProps {- onb: ReturnType<typeof useOnboarding>;- goNext: () => void;- goBack: () => void;- skip: () => void;- isFirst: boolean;- isLast: boolean;- /**- * The one line the register shows under this step's name once it is done —- * "Deutsch · replies Auto", "OpenRouter", "Hey Nova". Steps report it as- * soon as they know it; the register is the progress indicator.- */- setSummary: (text: string | null) => void;- /** Every step's current summary, keyed by step id (the finish step reads it). */- summaries: Record<string, string | null>;- /**- * What this step leaves UNDONE, in one plain sentence — "no key yet, chat- * stays off", "wake word off until the local model is installed". The- * finish step lists every gap and asks for one acknowledgement before the- * assistant starts; a step with nothing missing reports null.- */- setGap: (text: string | null) => void;- gaps: Record<string, string | null>;-}--// Restart batching (2026-07-18): permissions + wake-word sit LAST before-// finish — both only fully apply after a relaunch, and onboarding already-// ends with ONE unconditional fresh restart. Never demand a second one.-const REGISTRY: Record<string, (p: StepProps) => JSX.Element> = {- welcome: WelcomeStep,- language: LanguageStep,- "api-keys": ApiKeysStep,- permissions: PermissionsStep,- "wake-word": WakeWordStep,- finish: FinishStep,-};--// Exported for the cross-layer parity test: these must equal the backend's-// ONBOARDING_STEPS (jarvis/setup/onboarding_meta.py). A typo here would render-// the silent fallback div instead of a real step.-export const STEP_KEYS = Object.keys(REGISTRY);--/**- * Which backend steps this machine actually needs. The permissions step is- * macOS TCC only — on Windows and Linux it used to render a "nothing to do- * here" card the user had to click through. Now it is not in the register at- * all. Unknown platform (probe failed, still warming) keeps the step: showing- * an unnecessary screen is a small cost, hiding a necessary one is not.- */-export function visibleSteps(steps: string[], platform: string | null): string[] {- if (platform === "win32" || platform === "linux") {- return steps.filter((s) => s !== "permissions");- }- return steps;-}--function usePlatform(): string | null {- const [platform, setPlatform] = useState<string | null>(null);- useEffect(() => {- let cancelled = false;- (async () => {- try {- const res = await fetch("/api/permissions/status");- if (!res.ok) return;- const data = (await res.json()) as { platform?: string };- if (!cancelled && typeof data?.platform === "string") setPlatform(data.platform);- } catch {- // Best-effort: an unreachable probe keeps every step visible.- }- })();- return () => {- cancelled = true;- };- }, []);- return platform;-}--/**- * The first-run guide as a full-window stage in the workspace launcher's- * editorial language: a header with an eyebrow step counter, a numbered- * register on the left that doubles as the progress indicator (each entry- * carries a live one-line summary of what was chosen), and the step's own- * content on the right, separated by rules rather than nested cards.- */-export function OnboardingFlow({- onb,-}: {- onb: ReturnType<typeof useOnboarding>;-}) {- const t = useT();- const platform = usePlatform();- const allSteps = onb.state?.steps ?? ["welcome", "finish"];- const steps = useMemo(() => visibleSteps(allSteps, platform), [allSteps, platform]);- // Always begin at the first step so every run walks each step in order. We do- // NOT resume to a saved current_step: a user who already finished once would- // otherwise be auto-jumped to the last step, which feels like the flow skipped- // itself.- const [idx, setIdx] = useState(0);- const [maxVisited, setMaxVisited] = useState(0);- const [skipped, setSkipped] = useState<string[]>(onb.state?.skipped_steps ?? []);- const [summaries, setSummaries] = useState<Record<string, string | null>>({});- const [gaps, setGaps] = useState<Record<string, string | null>>({});-- const safeIdx = Math.min(idx, steps.length - 1);- const stepKey = steps[safeIdx];- const StepComp = REGISTRY[stepKey] ?? ((_: StepProps) => <div>{stepKey}</div>);-- const advance = (next: number, nextSkipped = skipped) => {- if (next >= steps.length) {- void onb.complete();- return;- }- setSkipped(nextSkipped);- setIdx(next);- setMaxVisited((m) => Math.max(m, next));- void onb.saveStep(steps[next], nextSkipped);- };-- const setSummary = useCallback(- (text: string | null) => {- setSummaries((s) => (s[stepKey] === text ? s : { ...s, [stepKey]: text }));- },- [stepKey],- );-- const setGap = useCallback(- (text: string | null) => {- setGaps((g) => (g[stepKey] === text ? g : { ...g, [stepKey]: text }));- },- [stepKey],- );-- const props: StepProps = {- onb,- goNext: () => advance(safeIdx + 1),- goBack: () => setIdx((i) => Math.max(0, i - 1)),- skip: () => advance(safeIdx + 1, [...new Set([...skipped, stepKey])]),- isFirst: safeIdx === 0,- isLast: safeIdx === steps.length - 1,- setSummary,- summaries,- setGap,- gaps,- };-- const title = t(`onboarding.steps.${stepKey}.title`);- const hint = t(`onboarding.steps.${stepKey}.hint`);-- return (- <div- data-testid="onboarding-flow"- className="flex h-full min-h-0 flex-col font-display text-lg"- >- <header className="shrink-0 border-b border-border/70 px-6 py-6 sm:px-12 xl:py-8">- <div className="mx-auto flex w-full max-w-[1400px] items-start justify-between gap-6">- <div className="min-w-0">- <p className="text-xs font-semibold uppercase tracking-[0.16em] text-primary/80">- {t("onboarding.eyebrow")}- <span className="px-2 text-muted-foreground/50">/</span>- <span- role="progressbar"- aria-label={t("onboarding.progress_label")}- aria-valuemin={1}- aria-valuemax={steps.length}- aria-valuenow={safeIdx + 1}- className="font-mono tabular-nums"- >- {t("onboarding.step_progress")- .replace("{0}", String(safeIdx + 1).padStart(2, "0"))- .replace("{1}", String(steps.length).padStart(2, "0"))}- </span>- </p>- <h1 className="mt-2 text-2xl tracking-tight text-foreground [text-wrap:balance] sm:text-3xl xl:text-4xl">- {title}- </h1>- <p className="mt-2 max-w-3xl text-lg leading-relaxed text-muted-foreground xl:text-base">- {hint}- </p>- </div>- <div className="shrink-0 pt-0.5">- <MascotGigi size={56} reactToVoice={false} enableComments={false} />- </div>- </div>- </header>-- <div className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis">- <div className="mx-auto grid w-full max-w-[1400px] gap-x-14 gap-y-4 px-6 pb-12 pt-6 sm:px-12 lg:grid-cols-[260px_minmax(0,1fr)] xl:pt-8">- <nav aria-label={t("onboarding.progress_label")} className="min-w-0">- <ol- className="grid border-b border-border/70 lg:flex lg:flex-col lg:border-b-0 lg:border-r lg:pr-6"- style={{ gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }}- >- {steps.map((key, index) => {- const selected = index === safeIdx;- const enabled = index <= maxVisited;- const summary = summaries[key];- return (- <li key={key}>- <button- type="button"- data-testid={`onboarding-step-${key}`}- aria-current={selected ? "step" : undefined}- disabled={!enabled}- onClick={() => setIdx(index)}- className={cn(- "group relative w-full min-w-0 px-2 py-3 text-left transition-colors lg:px-0 lg:py-4",- "disabled:cursor-not-allowed disabled:opacity-35",- selected ? "text-foreground" : "text-muted-foreground",- )}- >- <span- aria-hidden- className={cn(- "absolute bottom-[-1px] left-0 right-0 h-0.5 lg:bottom-0 lg:left-auto lg:right-[-25px] lg:top-0 lg:h-auto lg:w-0.5",- selected ? "bg-foreground/70" : "bg-transparent",- )}- />- <span className="block font-mono text-xs tabular-nums text-muted-foreground/70">- {(index + 1).toString().padStart(2, "0")}- </span>- <span className="mt-1 block truncate text-lg font-medium">- {t(`onboarding.steps.${key}.label`)}- </span>- <span className="mt-0.5 hidden truncate text-xs text-muted-foreground lg:block">- {summary ?? " "}- </span>- </button>- </li>- );- })}- </ol>- </nav>-- <section- key={stepKey}- className="profile-rise min-w-0 max-w-[920px] pt-2"- aria-labelledby="onboarding-step-title"- >- <h2 id="onboarding-step-title" className="sr-only">- {title}- </h2>- <StepComp {...props} />- </section>- </div>- </div>- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsxindex df7075481b..bab26952bd 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx@@ -1,11 +1,23 @@import { act, cleanup, render, screen, waitFor } from "@testing-library/react";import { afterEach, expect, it, vi } from "vitest";-vi.mock("./OnboardingFlow", () => ({ OnboardingFlow: () => <div data-testid="flow" /> }));+vi.mock("./WelcomeFlow", () => ({ WelcomeStage: () => <div data-testid="guide" /> }));+vi.mock("./tour/GuidedTour", () => ({+ GuidedTour: ({ onDone }: { onDone: () => void }) => (+ <button type="button" data-testid="tour" onClick={onDone}>+ tour+ </button>+ ),+}));import { OnboardingGate } from "./OnboardingGate";+import { TOUR_START_EVENT } from "./tourEvents";-afterEach(() => { cleanup(); vi.restoreAllMocks(); });+afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+ vi.unstubAllGlobals();+});const base = {current_step: null,@@ -17,67 +29,93 @@ const base = {};function stub(state: object | "error") {- vi.stubGlobal(- "fetch",- vi.fn().mockImplementation(() =>- state === "error"- ? Promise.reject(new Error("net"))- : Promise.resolve({ ok: true, json: () => Promise.resolve(state) }),- ),+ const fetchMock = vi.fn().mockImplementation(() =>+ state === "error"+ ? Promise.reject(new Error("net"))+ : Promise.resolve({ ok: true, json: () => Promise.resolve(state) }),);+ vi.stubGlobal("fetch", fetchMock);+ return fetchMock;}-it("shows the overlay when not completed", async () => {- stub({ ...base, completed: false });+it("shows the guide while setup is not complete", async () => {+ stub({ ...base, completed: false, tour_completed: false });render(<OnboardingGate />);- await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());+ await waitFor(() => expect(screen.getByTestId("guide")).toBeDefined());+ expect(screen.getByRole("dialog")).toBeDefined();+ expect(screen.queryByTestId("tour")).toBeNull();});-it("keeps a fresh install's IDE accessible without app-wide onboarding", async () => {- stub({ ...base, completed: false });+it("keeps a fresh install's IDE free of the guide", async () => {+ stub({ ...base, completed: false, tour_completed: false });const { rerender } = render(<OnboardingGate activeSection="agentic-ide" />);await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());rerender(<OnboardingGate activeSection="chats" />);await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());});-it("renders nothing when completed", async () => {- stub({ ...base, completed: true });+it("tours the app once setup is complete and the tour is not seen", async () => {+ stub({ ...base, completed: true, tour_completed: false });+ render(<OnboardingGate activeSection="chats" />);+ await waitFor(() => expect(screen.getByTestId("tour")).toBeDefined());+ expect(screen.queryByRole("dialog")).toBeNull();+});++it("records the tour and closes it when it ends", async () => {+ const fetchMock = stub({ ...base, completed: true, tour_completed: false });+ render(<OnboardingGate activeSection="chats" />);+ const tour = await screen.findByTestId("tour");+ act(() => tour.click());+ await waitFor(() => expect(screen.queryByTestId("tour")).toBeNull());+ expect(fetchMock).toHaveBeenCalledWith("/api/onboarding/tour-complete", expect.objectContaining({ method: "POST" }));+});++it("does not start the automatic tour inside the IDE", async () => {+ stub({ ...base, completed: true, tour_completed: false });+ render(<OnboardingGate activeSection="agentic-ide" />);+ await new Promise((r) => setTimeout(r, 20));+ expect(screen.queryByTestId("tour")).toBeNull();+});++it("renders nothing when setup and tour are done", async () => {+ stub({ ...base, completed: true, tour_completed: true });render(<OnboardingGate />);- await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());+ await new Promise((r) => setTimeout(r, 20));+ expect(screen.queryByRole("dialog")).toBeNull();+ expect(screen.queryByTestId("tour")).toBeNull();});-it("fails open (renders nothing) on a fetch error", async () => {- stub("error");+it("never tours on a backend that does not report the tour", async () => {+ // An older backend: `tour_completed` is absent, not false.+ stub({ ...base, completed: true });render(<OnboardingGate />);- await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull(), { timeout: 500 });+ await new Promise((r) => setTimeout(r, 20));+ expect(screen.queryByTestId("tour")).toBeNull();});-it("stays hidden when completed, even with an outdated accepted terms version", async () => {- // The update contract: a version bump (app or terms) must never re-open the- // gate — `completed` is the only signal it reads.- stub({- ...base,- completed: true,- terms: { accepted: true, accepted_version: "0.1", current_version: "9.9" },+it("replays the tour on request from Settings", async () => {+ stub({ ...base, completed: true, tour_completed: true });+ render(<OnboardingGate activeSection="profile" />);+ await new Promise((r) => setTimeout(r, 20));+ expect(screen.queryByTestId("tour")).toBeNull();+ act(() => {+ window.dispatchEvent(new CustomEvent(TOUR_START_EVENT));});- render(<OnboardingGate />);- await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());+ await waitFor(() => expect(screen.getByTestId("tour")).toBeDefined());});-it("renders the step flow directly — no separate risk or video screens", async () => {- stub({ ...base, completed: false });+it("fails open (renders nothing) on a fetch error", async () => {+ stub("error");render(<OnboardingGate />);- await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());- // The flow is a lazy chunk; nothing else stands between the gate and it.- expect(await screen.findByTestId("flow")).toBeDefined();- expect(document.querySelector("iframe")).toBeNull();+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull(), { timeout: 500 });});-it("closes when the flow reports completion", async () => {- stub({ ...base, completed: false });+it("closes the guide when setup completes", async () => {+ stub({ ...base, completed: false, tour_completed: false });render(<OnboardingGate />);- await screen.findByTestId("flow");- act(() => window.dispatchEvent(new CustomEvent("jarvis:onboarding-changed")));+ await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());+ act(() => {+ window.dispatchEvent(new CustomEvent("jarvis:onboarding-changed"));+ });await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsxindex ba2b1d5352..02e1e91ab9 100644--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx@@ -1,76 +1,102 @@import { lazy, Suspense, useEffect, useMemo, useState } from "react";import { useOnboarding } from "@/hooks/useOnboarding";+import { TOUR_START_EVENT } from "./tourEvents";/**- * Code-split: a completed install renders this gate exactly once per mount —- * a no-op `null` return, forever — yet the full six-step flow (with its own- * step components) used to travel in the entry chunk anyway, on every boot,- * for every returning user. Split the same way MainView.tsx splits section- * views: only the gate's own show/hide logic stays static, the flow loads on- * the one boot that actually shows it.+ * Code-split: a finished install renders this gate as `null` forever, so the+ * guide and the tour load only on the boot that shows them — the gate's own+ * show/hide logic is all that rides in the entry chunk.*/-const OnboardingFlow = lazy(() =>- import("./OnboardingFlow").then((m) => ({ default: m.OnboardingFlow })),+const WelcomeStage = lazy(() =>+ import("./WelcomeFlow").then((m) => ({ default: m.WelcomeStage })),);+const GuidedTour = lazy(() =>+ import("./tour/GuidedTour").then((m) => ({ default: m.GuidedTour })),+);++/** Where the IDE keeps working without app-wide setup — no guide over it. */+const IDE_SECTIONS = ["agentic-ide", "chat-workspace", "agentic-ide-classic"];++function param(name: string): string | null {+ return new URLSearchParams(window.location.search).get(name);+}/**- * The first-run stage. It covers the whole window on the app's own ground —- * no scrim, no blur, no floating card: on a fresh install there is nothing- * behind it worth hinting at, and a dialog over a half-built app looked- * exactly like what it was. Fails open (renders nothing) while loading or on- * a fetch error so a broken guide never traps the user. `?onboarding=force`- * forces the flow for non-destructive dev replay.+ * First run, in two acts.+ *+ * 1. The guide: one card on the app's own ground (the caption bar stays free)+ * until setup is complete. Fails open — while loading or on a fetch error+ * it renders nothing, so a broken guide never traps anyone.+ * 2. The tour: after the completion restart, the real app with a spotlight on+ * one control at a time. Shown once (`tour_completed`), replayable from+ * Settings via `jarvis:tour-start`.*- * The risk acknowledgement lives INSIDE the flow's first step now (it used to- * be a separate screen before a separate video screen before the wizard).- * Its acceptance is awaited and persisted there; nothing about- * onboarding/completed state changes until the final step, so the- * restart-loop bug cannot come back through this path.+ * Dev replay, both non-destructive until the final action: `?onboarding=force`+ * opens the guide, `?tour=force` the tour.*/export function OnboardingGate({ activeSection }: { activeSection?: string } = {}) {const onb = useOnboarding();- // Set once the user completes the guide (the "Start" / complete() path- // dispatches jarvis:onboarding-changed). It dismisses the stage even under- // ?onboarding=force, so a dev replay closes on finish exactly like a real- // first run instead of staying stuck open.+ // Set once the guide completes (the Start action dispatches+ // jarvis:onboarding-changed). Closes the stage even under ?onboarding=force.const [dismissed, setDismissed] = useState(false);+ const [tourRequested, setTourRequested] = useState(() => param("tour") === "force");+ const [tourDone, setTourDone] = useState(false);+ const forced = useMemo(() => param("onboarding") === "force", []);useEffect(() => {const onChanged = () => {void onb.refetch();setDismissed(true);};+ const onTour = () => {+ setTourDone(false);+ setTourRequested(true);+ };window.addEventListener("jarvis:onboarding-changed", onChanged);- return () => window.removeEventListener("jarvis:onboarding-changed", onChanged);+ window.addEventListener(TOUR_START_EVENT, onTour);+ return () => {+ window.removeEventListener("jarvis:onboarding-changed", onChanged);+ window.removeEventListener(TOUR_START_EVENT, onTour);+ };}, [onb]);- const forced = useMemo(- () => new URLSearchParams(window.location.search).get("onboarding") === "force",- [],- );+ const inIde = IDE_SECTIONS.includes(activeSection ?? "");- // The IDE can connect a folder and launch agents without completing app-wide- // voice setup. An explicit onboarding preview still opens when requested.- if (!forced && ["agentic-ide", "chat-workspace", "agentic-ide-classic"].includes(activeSection ?? "")) return null;+ if (onb.loading || onb.error || !onb.state) return null;- if (onb.loading) return null;- if (onb.error) return null; // fail open — never trap the user- if (!onb.state) return null;+ const showGuide = (forced || !onb.state.completed) && !dismissed && (forced || !inIde);+ if (showGuide) {+ return (+ <div+ role="dialog"+ aria-modal="true"+ aria-labelledby="onboarding-title"+ className="fixed inset-x-0 bottom-0 top-8 z-50 overflow-y-auto bg-background text-foreground scrollbar-jarvis"+ >+ {/* No fallback: the ground is already painted while the chunk loads. */}+ <Suspense fallback={null}>+ <WelcomeStage onb={onb} />+ </Suspense>+ </div>+ );+ }- const show = (forced || !onb.state.completed) && !dismissed;- if (!show) return null;-- return (- <div- role="dialog"- aria-modal="true"- className="fixed inset-x-0 bottom-0 top-8 z-50 bg-background text-foreground"- >- {/* Fallback is empty: the stage ground is already painted while the- first-run chunk fetches. */}+ const tourDue = tourRequested || (onb.state.completed && onb.state.tour_completed === false);+ // An automatic tour waits until the user is out of the IDE; a replay they+ // asked for starts wherever they are.+ if (tourDue && !tourDone && (tourRequested || !inIde)) {+ return (<Suspense fallback={null}>- <OnboardingFlow onb={onb} />+ <GuidedTour+ onDone={() => {+ setTourDone(true);+ setTourRequested(false);+ void onb.completeTour();+ }}+ /></Suspense>- </div>- );+ );+ }++ return null;}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/ProgressDots.tsx b/jarvis/ui/web/frontend/src/components/onboarding/ProgressDots.tsxnew file mode 100644index 0000000000..85e198f3f0--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/ProgressDots.tsx@@ -0,0 +1,42 @@+import { cn } from "@/lib/utils";++const DOT = 6;+const SLOT = 16;+const GAP = 6;++/**+ * Where the guide stands: one dot per beat and a pill that SLIDES to the+ * current one rather than a new dot lighting up. Done dots are ink, the ones+ * ahead are hairline — the pill is the only accent on the card's foot.+ */+export function ProgressDots({ count, index }: { count: number; index: number }) {+ return (+ <div+ aria-hidden+ className="relative flex items-center"+ style={{ gap: GAP, height: DOT }}+ data-testid="onboarding-dots"+ >+ {Array.from({ length: count }, (_, i) => (+ <span key={i} className="flex justify-center" style={{ width: SLOT }}>+ <span+ className={cn(+ "rounded-full transition-colors duration-300",+ i < index ? "bg-muted-foreground" : "bg-border-strong",+ i === index && "opacity-0",+ )}+ style={{ width: DOT, height: DOT }}+ />+ </span>+ ))}+ <span+ className="absolute left-0 top-1/2 rounded-full bg-accent transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"+ style={{+ width: SLOT,+ height: DOT,+ transform: `translate(${index * (SLOT + GAP)}px, -50%)`,+ }}+ />+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.test.tsxnew file mode 100644index 0000000000..7f56cad1bb--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.test.tsx@@ -0,0 +1,182 @@+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeAll, expect, it, vi } from "vitest";+import { loadLocaleChunk } from "@/i18n";+import type { useOnboarding } from "@/hooks/useOnboarding";+import type { BeatProps } from "./WelcomeFlow";++// Every beat after the consent is a stub with the two ways on, so these tests+// cover the card's own job: order, progress, skipping and resuming.+function stubBeat(id: string) {+ return function Stub({ next, skip, report }: BeatProps) {+ return (+ <div data-testid={`beat-${id}`}>+ <button type="button" onClick={() => { report({ summary: `${id} done`, gap: null }); next(); }}>+ next-{id}+ </button>+ <button type="button" onClick={skip}>skip-{id}</button>+ </div>+ );+ };+}+vi.mock("./beats/BrainBeat", () => ({ BrainBeat: stubBeat("brain") }));+vi.mock("./beats/AgentsBeat", () => ({ AgentsBeat: stubBeat("agents") }));+vi.mock("./beats/PermissionsBeat", () => ({ PermissionsBeat: stubBeat("permissions") }));+vi.mock("./beats/VoiceBeat", () => ({ VoiceBeat: stubBeat("voice") }));++import { WelcomeFlow } from "./WelcomeFlow";++beforeAll(async () => {+ await loadLocaleChunk("onboarding");+});++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+ vi.unstubAllGlobals();+});++type Onb = ReturnType<typeof useOnboarding>;++function fakeOnb(over: Partial<NonNullable<Onb["state"]>> = {}): Onb {+ return {+ state: {+ completed: false,+ current_step: null,+ skipped_steps: [],+ terms: { accepted: false, accepted_version: null, current_version: "1.0" },+ wake_word_acknowledged: false,+ tour_completed: false,+ legal_references: [],+ steps: [],+ ...over,+ },+ loading: false,+ error: null,+ refetch: vi.fn(async () => undefined),+ saveStep: vi.fn(async () => undefined),+ acceptTerms: vi.fn(async () => undefined),+ acknowledgeWakeWord: vi.fn(async () => undefined),+ complete: vi.fn(async () => undefined),+ completeTour: vi.fn(async () => undefined),+ };+}++function stubFetch(platform = "win32") {+ vi.stubGlobal(+ "fetch",+ vi.fn().mockImplementation((url: string) => {+ if (url === "/api/permissions/status") {+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ platform }) });+ }+ if (url === "/api/settings/autostart") {+ return Promise.resolve({ ok: true, json: () => Promise.resolve({ enabled: false, supported: true }) });+ }+ return Promise.resolve({ ok: true, json: () => Promise.resolve({}) });+ }),+ );+}++it("holds the way on until the consent is ticked", async () => {+ stubFetch();+ const onb = fakeOnb();+ render(<WelcomeFlow onb={onb} />);+ const start = screen.getByTestId("onboarding-primary") as HTMLButtonElement;+ expect(start.disabled).toBe(true);+ fireEvent.click(screen.getByTestId("onboarding-accept"));+ expect(start.disabled).toBe(false);+ await act(async () => {+ fireEvent.click(start);+ });+ expect(onb.acceptTerms).toHaveBeenCalled();+ await waitFor(() => expect(screen.getByTestId("beat-brain")).toBeDefined());+ expect(onb.saveStep).toHaveBeenCalledWith("brain", []);+});++it("stays on the consent when saving it fails", async () => {+ stubFetch();+ const onb = fakeOnb();+ onb.acceptTerms = vi.fn(async () => {+ throw new Error("down");+ });+ render(<WelcomeFlow onb={onb} />);+ fireEvent.click(screen.getByTestId("onboarding-accept"));+ await act(async () => {+ fireEvent.click(screen.getByTestId("onboarding-primary"));+ });+ expect(screen.queryByTestId("beat-brain")).toBeNull();+ expect(screen.getByRole("status").textContent).toMatch(/could not be saved/i);+});++it("says goodbye on decline", async () => {+ stubFetch();+ render(<WelcomeFlow onb={fakeOnb()} />);+ await act(async () => {+ fireEvent.click(screen.getByTestId("onboarding-decline"));+ });+ expect(screen.getByTestId("onboarding-declined")).toBeDefined();+});++it("walks every beat, records skips and ends on the review", async () => {+ stubFetch("win32");+ const onb = fakeOnb({ terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" } });+ render(<WelcomeFlow onb={onb} />);+ // Consent already given: the guide resumes after it.+ await screen.findByTestId("beat-brain");+ fireEvent.click(screen.getByText("next-brain"));+ await screen.findByTestId("beat-agents");+ fireEvent.click(screen.getByText("skip-agents"));+ await screen.findByTestId("beat-voice");+ expect(onb.saveStep).toHaveBeenLastCalledWith("voice", ["agents"]);+ fireEvent.click(screen.getByText("next-voice"));+ await screen.findByTestId("onboarding-review");+ expect(screen.getByTestId("onboarding-review").textContent).toContain("brain done");+ expect(screen.getByTestId("onboarding-review").textContent).toContain("voice done");+ // Windows: no permissions beat anywhere.+ expect(screen.queryByTestId("beat-permissions")).toBeNull();+});++it("goes back, but never behind the consent", async () => {+ stubFetch();+ const onb = fakeOnb({ terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" }, current_step: "agents" });+ render(<WelcomeFlow onb={onb} />);+ await screen.findByTestId("beat-agents");+ fireEvent.click(screen.getByTestId("onboarding-back"));+ await screen.findByTestId("beat-brain");+ expect(screen.queryByTestId("onboarding-back")).toBeNull();+});++it("adds the permissions beat on macOS", async () => {+ stubFetch("darwin");+ const onb = fakeOnb({ terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" }, current_step: "agents" });+ render(<WelcomeFlow onb={onb} />);+ await screen.findByTestId("beat-agents");+ await waitFor(() => expect(screen.getByText(/of 6/)).toBeDefined());+ fireEvent.click(screen.getByText("next-agents"));+ await screen.findByTestId("beat-permissions");+});++it("starts the assistant from the review", async () => {+ stubFetch();+ const onb = fakeOnb({ terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" }, current_step: "ready" });+ render(<WelcomeFlow onb={onb} />);+ const start = await screen.findByTestId("onboarding-start");+ await act(async () => {+ fireEvent.click(start);+ });+ expect(onb.complete).toHaveBeenCalled();+});++it("keeps the start live and explains a failed completion", async () => {+ stubFetch();+ const onb = fakeOnb({ terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" }, current_step: "ready" });+ onb.complete = vi.fn(async () => {+ throw new Error("down");+ });+ render(<WelcomeFlow onb={onb} />);+ const start = (await screen.findByTestId("onboarding-start")) as HTMLButtonElement;+ await act(async () => {+ fireEvent.click(start);+ });+ expect(screen.getByText(/could not be finished/i)).toBeDefined();+ expect(start.disabled).toBe(false);+});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.tsx b/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.tsxnew file mode 100644index 0000000000..779f4eac54--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.tsx@@ -0,0 +1,320 @@+import { AnimatePresence, LayoutGroup, MotionConfig, motion } from "framer-motion";+import { ArrowLeft } from "lucide-react";+import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { MascotGigi, type MascotAction } from "@/components/MascotGigi";+import type { useOnboarding } from "@/hooks/useOnboarding";+import { fill, setUiLanguage, useLocaleChunk, useT, useUiLanguage, type UiLanguage } from "@/i18n";+import { cn } from "@/lib/utils";+import {+ beatsFor,+ CARD_WIDTH,+ MASCOT_CUE,+ nextBeat,+ previousBeat,+ resumeBeat,+ type BeatId,+} from "./beats";+import { AgentsBeat } from "./beats/AgentsBeat";+import { BrainBeat } from "./beats/BrainBeat";+import { HelloBeat } from "./beats/HelloBeat";+import { PermissionsBeat } from "./beats/PermissionsBeat";+import { ReadyBeat } from "./beats/ReadyBeat";+import { VoiceBeat } from "./beats/VoiceBeat";+import { ProgressDots } from "./ProgressDots";+import { EASE_OUT, QuietAction } from "./ui";++/** What a beat hands the ready beat: one line of what was set up, one of what was not. */+export interface BeatResult {+ summary: string | null;+ gap: string | null;+}++export interface BeatProps {+ onb: ReturnType<typeof useOnboarding>;+ /** Go on to the next beat. */+ next: () => void;+ /** Go on and record the beat as skipped. */+ skip: () => void;+ /** Report this beat's outcome for the ready beat's review. */+ report: (result: BeatResult | null) => void;+ /** Everything the beats before reported, keyed by beat. */+ results: Partial<Record<BeatId, BeatResult>>;+ /** Ask the mascot for a one-shot move — a success deserves a jump. */+ cheer: (action?: MascotAction) => void;+ /** The assistant's name as chosen on the voice beat, if one was. */+ chosenName: string | null;+ setChosenName: (name: string | null) => void;+}++const LANGS: UiLanguage[] = ["en", "de", "es"];++/** The guide once its strings are resident — they live in a lazy locale chunk. */+export function WelcomeStage({ onb }: { onb: ReturnType<typeof useOnboarding> }) {+ const ready = useLocaleChunk("onboarding");+ return ready ? <WelcomeFlow onb={onb} /> : null;+}++/**+ * The first-run guide: ONE card on the app's own ground that changes shape+ * from beat to beat instead of a stack of screens.+ *+ * The card keeps its frame — mascot, title, the dots, Back — and only its+ * width and body change. On the first beat the mascot sits large above a+ * centred title; from the second on it glides into a small badge beside the+ * title. The one way forward is always the full-width action at the foot of+ * the beat; everything else is quiet text.+ *+ * Progress is persisted on every beat (`POST /api/onboarding/step`) and a+ * reload resumes on the beat it left — but never past the consent.+ */+export function WelcomeFlow({ onb }: { onb: ReturnType<typeof useOnboarding> }) {+ const t = useT();+ const lang = useUiLanguage();+ const [platform, setPlatform] = useState<string | null>(null);+ const beats = useMemo(() => beatsFor(platform), [platform]);+ const [beat, setBeat] = useState<BeatId>(() =>+ resumeBeat(beatsFor(null), onb.state?.current_step ?? null, Boolean(onb.state?.terms.accepted)),+ );+ const [skipped, setSkipped] = useState<string[]>(() => onb.state?.skipped_steps ?? []);+ const [results, setResults] = useState<Partial<Record<BeatId, BeatResult>>>({});+ const [chosenName, setChosenName] = useState<string | null>(null);+ const [cue, setCue] = useState<{ action: MascotAction; key: number }>({+ action: MASCOT_CUE[beat],+ key: 0,+ });+ const cardRef = useRef<HTMLDivElement>(null);++ // Which beats exist depends on the platform (macOS asks for permissions).+ // A failed probe keeps the permissions beat out — Settings stays the+ // recovery path for it.+ useEffect(() => {+ let cancelled = false;+ void (async () => {+ try {+ const res = await fetch("/api/permissions/status");+ if (!res.ok) return;+ const data = (await res.json()) as { platform?: string };+ if (!cancelled && typeof data.platform === "string") setPlatform(data.platform);+ } catch {+ // Probe is best-effort: without it the beat list simply has no permissions beat.+ }+ })();+ return () => {+ cancelled = true;+ };+ }, []);++ const cheer = useCallback((action: MascotAction = "jump") => {+ setCue((c) => ({ action, key: c.key + 1 }));+ }, []);++ const goTo = useCallback(+ (target: BeatId, nextSkipped: string[]) => {+ setBeat(target);+ setCue((c) => ({ action: MASCOT_CUE[target], key: c.key + 1 }));+ void onb.saveStep(target, nextSkipped);+ },+ [onb],+ );++ const next = useCallback(() => {+ const target = nextBeat(beats, beat);+ if (target) goTo(target, skipped);+ }, [beats, beat, goTo, skipped]);++ const skip = useCallback(() => {+ const nextSkipped = skipped.includes(beat) ? skipped : [...skipped, beat];+ setSkipped(nextSkipped);+ const target = nextBeat(beats, beat);+ if (target) goTo(target, nextSkipped);+ }, [beats, beat, goTo, skipped]);++ const back = useMemo(() => {+ const target = previousBeat(beats, beat);+ // The consent is not a place to go back to once it is given.+ if (!target || target === "welcome") return null;+ return () => goTo(target, skipped);+ }, [beats, beat, goTo, skipped]);++ const report = useCallback(+ (result: BeatResult | null) => {+ setResults((prev) => {+ const current = prev[beat];+ if (+ (current?.summary ?? null) === (result?.summary ?? null) &&+ (current?.gap ?? null) === (result?.gap ?? null)+ ) {+ return prev;+ }+ return { ...prev, [beat]: result ?? undefined };+ });+ },+ [beat],+ );++ // Land the keyboard in the beat: the first text field, else the primary+ // action — never the card itself, never a quiet link.+ useEffect(() => {+ const timer = window.setTimeout(() => {+ const root = cardRef.current;+ if (!root || root.contains(document.activeElement)) return;+ const target =+ root.querySelector<HTMLElement>("input[type='text']:not([disabled]), input[type='password']:not([disabled])") ??+ root.querySelector<HTMLElement>("[data-testid='onboarding-primary']:not([disabled])");+ target?.focus({ preventScroll: true });+ }, 380);+ return () => window.clearTimeout(timer);+ }, [beat]);++ const index = Math.max(0, beats.indexOf(beat));+ const first = beat === "welcome";+ const props: BeatProps = {+ onb,+ next,+ skip,+ report,+ results,+ cheer,+ chosenName,+ setChosenName,+ };++ const title = t(`first_run.${beat}.title`);+ const lede = t(`first_run.${beat}.lede`);++ return (+ <MotionConfig reducedMotion="user">+ <div+ className="relative flex min-h-full w-full items-start justify-center px-4 py-8 sm:items-center sm:px-8 sm:py-12"+ data-testid="onboarding-flow"+ data-beat={beat}+ >+ {/* The room behind the card: a faint signal-blue light from above, so+ the stage reads as a place and not as a blank page. Built from the+ accent channels, so it follows the theme. */}+ <div+ aria-hidden+ className="pointer-events-none absolute inset-0"+ style={{+ background:+ "radial-gradient(90% 60% at 50% 0%, rgb(var(--accent-rgb) / 0.08), transparent 70%)",+ }}+ />+ <LayoutGroup>+ <motion.div+ ref={cardRef}+ layout+ transition={{ layout: { duration: 0.42, ease: EASE_OUT } }}+ className="relative w-full rounded-2xl border border-border bg-card p-6 shadow-float sm:p-8"+ style={{ maxWidth: CARD_WIDTH[beat] }}+ data-testid={`onboarding-step-${beat}`}+ >+ {first && (+ <div+ className="absolute right-4 top-4 flex items-center gap-0.5 rounded-full border border-border p-0.5"+ role="radiogroup"+ aria-label={t("first_run.welcome.language")}+ >+ {LANGS.map((code) => (+ <button+ key={code}+ type="button"+ role="radio"+ aria-checked={lang === code}+ onClick={() => setUiLanguage(code)}+ data-testid={`onboarding-lang-${code}`}+ className={cn(+ "rounded-full px-2.5 py-1 text-xs transition-colors",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",+ lang === code+ ? "bg-secondary font-medium text-foreground"+ : "text-muted-foreground hover:text-foreground",+ )}+ >+ {t(`first_run.welcome.lang_${code}`)}+ </button>+ ))}+ </div>+ )}++ {/* Every direct child of the resizing card carries `layout`, so+ framer corrects the card's scale for it and text never squashes+ while the width glides to the next beat. */}+ <motion.header+ layout+ transition={{ layout: { duration: 0.42, ease: EASE_OUT } }}+ className={cn(first ? "flex flex-col items-center pt-4 text-center" : "flex items-start gap-3 pr-2")}+ >+ <motion.div layoutId="onboarding-mascot" className="shrink-0" transition={{ duration: 0.42, ease: EASE_OUT }}>+ <MascotGigi+ size={first ? 96 : 40}+ reactToVoice={false}+ enableComments={false}+ cue={cue}+ />+ </motion.div>+ <motion.div layout="position" className={cn("min-w-0", first ? "mt-4" : "pt-0.5")}>+ <h2+ className={cn(+ "font-semibold tracking-tight text-foreground",+ first ? "text-2xl" : "text-lg",+ )}+ id="onboarding-title"+ data-testid="onboarding-title"+ >+ {title}+ </h2>+ <p+ className={cn(+ "mt-1 text-sm leading-relaxed text-muted-foreground",+ first && "mx-auto max-w-sm",+ )}+ >+ {lede}+ </p>+ </motion.div>+ </motion.header>++ <AnimatePresence mode="wait" initial={false}>+ <motion.div+ key={beat}+ layout="position"+ initial={{ opacity: 0, x: 12 }}+ animate={{ opacity: 1, x: 0 }}+ exit={{ opacity: 0, x: -12 }}+ transition={{ duration: 0.24, ease: EASE_OUT }}+ className="mt-6"+ >+ {beat === "welcome" && <HelloBeat {...props} />}+ {beat === "brain" && <BrainBeat {...props} />}+ {beat === "agents" && <AgentsBeat {...props} />}+ {beat === "permissions" && <PermissionsBeat {...props} />}+ {beat === "voice" && <VoiceBeat {...props} />}+ {beat === "ready" && <ReadyBeat {...props} />}+ </motion.div>+ </AnimatePresence>++ <motion.footer+ layout+ transition={{ layout: { duration: 0.42, ease: EASE_OUT } }}+ className="mt-8 grid grid-cols-[1fr_auto_1fr] items-center gap-3"+ >+ <div>+ {back && (+ <QuietAction onClick={back} testId="onboarding-back" className="inline-flex items-center gap-1.5">+ <ArrowLeft aria-hidden className="h-3.5 w-3.5" />+ {t("first_run.back")}+ </QuietAction>+ )}+ </div>+ <ProgressDots count={beats.length} index={index} />+ <p className="text-right text-xs text-muted-foreground" aria-live="polite">+ {fill(t("first_run.step_of"), { current: index + 1, total: beats.length })}+ </p>+ </motion.footer>+ </motion.div>+ </LayoutGroup>+ </div>+ </MotionConfig>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats.test.ts b/jarvis/ui/web/frontend/src/components/onboarding/beats.test.tsnew file mode 100644index 0000000000..f9f1a5bbed--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats.test.ts@@ -0,0 +1,59 @@+import { readFileSync } from "node:fs";+import { join } from "node:path";+import { describe, expect, it } from "vitest";+import { BEAT_IDS, beatsFor, CARD_WIDTH, MASCOT_CUE, nextBeat, previousBeat, resumeBeat } from "./beats";++describe("beat order", () => {+ it("matches ONBOARDING_STEPS in the backend", () => {+ const py = readFileSync(+ join(__dirname, "..", "..", "..", "..", "..", "..", "setup", "onboarding_meta.py"),+ "utf8",+ );+ const block = /ONBOARDING_STEPS: list\[str\] = \[([\s\S]*?)\]/.exec(py);+ expect(block).not.toBeNull();+ const backend = [...block![1].matchAll(/"([a-z-]+)"/g)].map((m) => m[1]);+ expect(backend).toEqual([...BEAT_IDS]);+ });++ it("asks for permissions on macOS only", () => {+ expect(beatsFor("darwin")).toContain("permissions");+ expect(beatsFor("win32")).not.toContain("permissions");+ expect(beatsFor("linux")).not.toContain("permissions");+ // A failed platform probe leaves it out — Settings is the recovery path.+ expect(beatsFor(null)).not.toContain("permissions");+ });++ it("walks forward and back", () => {+ const beats = beatsFor("win32");+ expect(nextBeat(beats, "welcome")).toBe("brain");+ expect(nextBeat(beats, "agents")).toBe("voice");+ expect(nextBeat(beats, "ready")).toBeNull();+ expect(previousBeat(beats, "brain")).toBe("welcome");+ expect(previousBeat(beats, "welcome")).toBeNull();+ });++ it("gives every beat a width and a mascot cue", () => {+ for (const beat of BEAT_IDS) {+ expect(CARD_WIDTH[beat]).toBeGreaterThan(400);+ expect(MASCOT_CUE[beat]).toBeTruthy();+ }+ });+});++describe("resumeBeat", () => {+ const beats = beatsFor("win32");++ it("never skips the consent", () => {+ expect(resumeBeat(beats, "voice", false)).toBe("welcome");+ });++ it("returns to the saved beat once consent exists", () => {+ expect(resumeBeat(beats, "voice", true)).toBe("voice");+ });++ it("starts after the consent when the saved beat is unknown", () => {+ // e.g. a step id from the previous guide (`api-keys`, `wake-word`).+ expect(resumeBeat(beats, "api-keys", true)).toBe("brain");+ expect(resumeBeat(beats, null, true)).toBe("brain");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats.ts b/jarvis/ui/web/frontend/src/components/onboarding/beats.tsnew file mode 100644index 0000000000..6ccb95336c--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats.ts@@ -0,0 +1,75 @@+/**+ * The first-run guide as data: which steps ("beats") exist, in which order,+ * how wide the card is on each, and how the mascot greets each one.+ *+ * The guide is ONE card that changes shape between beats instead of a stack+ * of screens. Everything a beat needs to know about its neighbours lives here,+ * so the card itself stays a dumb frame and the order can be tested without+ * rendering anything.+ */++/** Must match `ONBOARDING_STEPS` in jarvis/setup/onboarding_meta.py. */+export const BEAT_IDS = ["welcome", "brain", "agents", "permissions", "voice", "ready"] as const;++export type BeatId = (typeof BEAT_IDS)[number];++/**+ * The beats this machine shows. macOS is the only platform that asks for+ * permissions one capability at a time; Windows and Linux never see that beat.+ * An unknown platform (the probe failed) keeps it out too — the Settings panel+ * stays the recovery path, and a guide that shows seven rows of "unknown" is+ * worse than one that skips them.+ */+export function beatsFor(platform: string | null): BeatId[] {+ return BEAT_IDS.filter((beat) => beat !== "permissions" || platform === "darwin");+}++export function nextBeat(beats: readonly BeatId[], current: BeatId): BeatId | null {+ const i = beats.indexOf(current);+ return i >= 0 && i < beats.length - 1 ? beats[i + 1] : null;+}++export function previousBeat(beats: readonly BeatId[], current: BeatId): BeatId | null {+ const i = beats.indexOf(current);+ return i > 0 ? beats[i - 1] : null;+}++/**+ * Where a resumed guide starts. The backend remembers the last beat reached,+ * so a window reload (a frontend build reloads open windows by itself) lands+ * where the user was instead of back at the consent. Consent must exist+ * before anything after it, so without accepted terms it is always welcome.+ */+export function resumeBeat(+ beats: readonly BeatId[],+ saved: string | null,+ termsAccepted: boolean,+): BeatId {+ if (!termsAccepted) return "welcome";+ const hit = beats.find((b) => b === saved);+ return hit ?? (beats[1] ?? "welcome");+}++/**+ * The card's maximum width per beat, in px. The width is the one thing that+ * visibly changes between beats; title and mascot glide to their new places.+ * Provider lists and agent cards need room, a consent does not.+ */+export const CARD_WIDTH: Record<BeatId, number> = {+ welcome: 520,+ brain: 640,+ agents: 640,+ permissions: 560,+ voice: 560,+ ready: 520,+};++/** The one-shot mascot move each beat opens with. */+export const MASCOT_CUE: Record<BeatId, "wave" | "look-left" | "look-right" | "jump" | "spin"> = {+ welcome: "wave",+ brain: "look-right",+ agents: "look-left",+ permissions: "look-right",+ voice: "look-left",+ ready: "jump",+};diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/AgentsBeat.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/AgentsBeat.tsxnew file mode 100644index 0000000000..d4c7baec04--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/AgentsBeat.tsx@@ -0,0 +1,120 @@+import { RefreshCw } from "lucide-react";+import { useCallback, useEffect, useState } from "react";+import { JarvisAgentSection } from "@/components/JarvisAgentSection";+import { fill, useT } from "@/i18n";+import { cn } from "@/lib/utils";+import type { BeatProps } from "../WelcomeFlow";+import { PrimaryAction, QuietAction, Rise, Status } from "../ui";++/** One row of `GET /api/jarvis-agent/status` → `mapping`. */+interface AgentRow {+ jarvis: string;+ label?: string | null;+ dedicated_key_set?: boolean;+ oauth_connected?: boolean;+ is_active_brain?: boolean;+ keyless?: boolean;+}++/** The agent that currently takes the big jobs, if one can actually run. */+export function readyAgent(rows: AgentRow[] | null): AgentRow | null {+ return (+ rows?.find(+ (row) => row.is_active_brain && (row.dedicated_key_set || row.oauth_connected || row.keyless),+ ) ?? null+ );+}++/**+ * Detect instead of ask: the coding agents this computer is already signed+ * in to (subscriptions), each one a card that connects in the browser.+ *+ * Entirely optional — the assistant talks, answers and uses its tools+ * without one — so Continue is always live. The status is read once, then+ * again whenever a connection changes (the cards announce it) or the user+ * presses "Check again"; there is no timer (AP-33).+ */+export function AgentsBeat({ next, report, cheer }: BeatProps) {+ const t = useT();+ const [rows, setRows] = useState<AgentRow[] | null>(null);+ const [checking, setChecking] = useState(false);++ const refresh = useCallback(async () => {+ setChecking(true);+ try {+ const res = await fetch("/api/jarvis-agent/status", { cache: "no-store" });+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const status = (await res.json()) as { mapping?: AgentRow[] };+ setRows(Array.isArray(status.mapping) ? status.mapping : []);+ } catch {+ setRows([]);+ } finally {+ setChecking(false);+ }+ }, []);++ useEffect(() => {+ void refresh();+ const onChange = () => void refresh();+ window.addEventListener("jarvis:agent-switched", onChange);+ window.addEventListener("jarvis:secret-configured", onChange);+ return () => {+ window.removeEventListener("jarvis:agent-switched", onChange);+ window.removeEventListener("jarvis:secret-configured", onChange);+ };+ }, [refresh]);++ const agent = readyAgent(rows);+ const agentLabel = agent ? agent.label || agent.jarvis : null;++ useEffect(() => {+ if (agentLabel) {+ report({ summary: agentLabel, gap: null });+ cheer("jump");+ } else {+ report({ summary: null, gap: t("first_run.agents.gap") });+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [agentLabel, t]);++ return (+ <div className="space-y-5">+ <Rise index={0}>+ <div className="max-h-[46vh] overflow-y-auto rounded-xl border border-border bg-background p-4 scrollbar-jarvis" data-testid="onboarding-agent-subscriptions">+ <JarvisAgentSection hideHeader subscriptionsOnly />+ </div>+ </Rise>++ <Rise index={1} className="flex flex-wrap items-center justify-between gap-3">+ {rows === null ? (+ <Status tone="muted">{t("first_run.agents.checking")}</Status>+ ) : agentLabel ? (+ <Status tone="ok" testId="onboarding-agent-ready">+ {fill(t("first_run.agents.ready"), { agent: agentLabel })}+ </Status>+ ) : (+ <Status tone="muted" testId="onboarding-agent-optional">+ {t("first_run.agents.optional")}+ </Status>+ )}+ <QuietAction+ onClick={() => void refresh()}+ disabled={checking}+ className="inline-flex items-center gap-1.5"+ testId="onboarding-agent-recheck"+ >+ <RefreshCw aria-hidden className={cn("h-3.5 w-3.5", checking && "animate-spin")} />+ {t("first_run.agents.check_again")}+ </QuietAction>+ </Rise>++ <Rise index={2}>+ <p className="text-xs leading-relaxed text-muted-foreground">{t("first_run.agents.api_key_hint")}</p>+ </Rise>++ <Rise index={3}>+ <PrimaryAction onClick={next}>{t("first_run.continue")}</PrimaryAction>+ </Rise>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/BrainBeat.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/BrainBeat.tsxnew file mode 100644index 0000000000..186a7f7e11--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/BrainBeat.tsx@@ -0,0 +1,420 @@+import { ChevronDown, ExternalLink, Lock } from "lucide-react";+import { useEffect, useMemo, useState } from "react";+import { ApiKeyForm } from "@/components/ApiKeyForm";+import { FOCUS_RING } from "@/components/agentic/controls";+import { switchBrainProvider, useProviders, type ProviderDescriptor } from "@/hooks/useProviders";+import {+ applyStarterPlan,+ getStarterPlans,+ selectStarterPlan,+ type ApplyPlanOutcome,+ type StarterPlan,+} from "@/hooks/useStarterPlans";+import { fill, useT } from "@/i18n";+import { setLocalMode } from "@/lib/localMode";+import { cn } from "@/lib/utils";+import { putVoiceMode } from "@/lib/voiceEngineMode";+import {+ cardForPlan,+ planKeysComplete,+ planText,+ primarySlot,+ slotConfigured,+ slotEffective,+ startableProviders,+} from "../brainPlans";+import type { BeatProps } from "../WelcomeFlow";+import { Option, PrimaryAction, QuietAction, Rise, Status } from "../ui";++/** The "I'll pick the provider myself" choice; mirrors the backend's custom id. */+const CUSTOM = "custom";+const LOCAL = "local";++type Probe = "checking" | "ready" | "empty" | "missing";++/**+ * One key and the assistant can think and talk.+ *+ * The recommended way is a starter plan: pick OpenAI or Gemini, paste the one+ * key, and the plan points live voice and its thinking model at it — the key+ * form is the same one the API Keys view uses, and it tests the key the moment+ * it is saved. "Another provider" opens the whole brain catalog instead (any+ * single key must work, AP-21), and a machine that already runs Ollama can+ * start with no key at all.+ *+ * Nothing blocks: "Later" moves on and the ready beat says what stays off.+ */+export function BrainBeat({ next, skip, report, cheer }: BeatProps) {+ const t = useT();+ const { providers, loading, error, refetch } = useProviders();+ const [plans, setPlans] = useState<StarterPlan[]>([]);+ const [choice, setChoice] = useState<string | null>(null);+ const [applying, setApplying] = useState(false);+ const [applied, setApplied] = useState<{ id: string; outcome: ApplyPlanOutcome } | null>(null);+ const [openRow, setOpenRow] = useState<string | null>(null);+ const [probe, setProbe] = useState<Probe>("checking");+ const [localActive, setLocalActive] = useState(false);+ const [localBusy, setLocalBusy] = useState(false);+ const [localError, setLocalError] = useState<string | null>(null);++ useEffect(() => {+ let cancelled = false;+ void (async () => {+ try {+ const res = await getStarterPlans();+ if (cancelled) return;+ setPlans(res.plans);+ setChoice(+ (current) =>+ current ??+ (res.plans.some((p) => p.id === res.selected) ? res.selected : null) ??+ res.plans.find((p) => p.recommended)?.id ??+ CUSTOM,+ );+ } catch {+ // An older backend without plans: the full provider list still works.+ if (!cancelled) setChoice((current) => current ?? CUSTOM);+ }+ })();+ return () => {+ cancelled = true;+ };+ }, []);++ // Is Ollama running here? Asked once, through the backend (a direct+ // browser call to localhost:11434 would be blocked anyway).+ useEffect(() => {+ let cancelled = false;+ void (async () => {+ try {+ const res = await fetch("/api/providers/ollama/models");+ const data = res.ok ? await res.json() : null;+ const live = data?.source === "live" || data?.source === "cache";+ const count = Array.isArray(data?.models) ? data.models.length : 0;+ if (!cancelled) setProbe(live ? (count > 0 ? "ready" : "empty") : "missing");+ } catch {+ if (!cancelled) setProbe("missing");+ }+ })();+ return () => {+ cancelled = true;+ };+ }, []);++ const plan = useMemo(() => plans.find((p) => p.id === choice) ?? null, [plans, choice]);+ const startable = useMemo(() => startableProviders(providers), [providers]);+ const planCard = plan ? cardForPlan(plan, startable) : null;+ const planComplete = plan ? planKeysComplete(plan, startable) : false;+ const planApplied = Boolean(+ plan && applied?.id === plan.id && applied.outcome.modeSet && applied.outcome.failed.length === 0,+ );+ const configured = startable.filter(slotEffective);++ // The moment the plan's key is in, point live voice and its thinking model+ // at it. Once per plan; a re-render never re-applies.+ useEffect(() => {+ if (!plan || !planComplete || applying || applied?.id === plan.id) return;+ let cancelled = false;+ setApplying(true);+ void (async () => {+ try {+ await selectStarterPlan(plan.id).catch(() => undefined);+ const outcome = await applyStarterPlan(plan);+ if (cancelled) return;+ setApplied({ id: plan.id, outcome });+ if (outcome.failed.length === 0) cheer("jump");+ } finally {+ if (!cancelled) setApplying(false);+ void refetch();+ }+ })();+ return () => {+ cancelled = true;+ };+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [plan?.id, planComplete]);++ const ready =+ choice === LOCAL+ ? localActive+ : plan+ ? planApplied+ : configured.length > 0;++ useEffect(() => {+ if (ready) {+ const summary =+ choice === LOCAL+ ? t("first_run.brain.summary_local")+ : plan+ ? planText(t, plan, "label")+ : configured.map((p) => p.label).join(" · ");+ report({ summary, gap: null });+ } else if (plan && applied?.id === plan.id && applied.outcome.failed.length > 0) {+ report({+ summary: planText(t, plan, "label"),+ gap: fill(t("first_run.brain.gap_partial"), {+ parts: applied.outcome.failed.map((f) => f.surface).join(", "),+ }),+ });+ } else {+ report({ summary: null, gap: t("first_run.brain.gap_none") });+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [ready, choice, plan?.id, applied, configured.map((p) => p.id).join(","), t]);++ // "Another provider" opens on the first card, so the list shows an input+ // and not a row of closed doors.+ useEffect(() => {+ if (choice === CUSTOM && openRow === null && startable.length > 0 && configured.length === 0) {+ setOpenRow(startable[0].id);+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [choice, startable.length]);++ async function choose(id: string) {+ setChoice(id);+ if (id !== LOCAL) await selectStarterPlan(id).catch(() => undefined);+ }++ function activateIfNone(p: ProviderDescriptor) {+ if (startable.some((q) => q.active)) return;+ void switchBrainProvider(p.id)+ .then(() => {+ cheer("jump");+ return refetch();+ })+ .catch(() => {+ // The key is saved either way; API Keys stays the place to pick the brain.+ });+ }++ async function activateLocal() {+ setLocalBusy(true);+ setLocalError(null);+ try {+ await switchBrainProvider("ollama");+ // Realtime replaces listen-think-speak with one cloud model and never+ // asks the brain, so a local brain needs the pipeline mode as well.+ // Persisted, because the guide ends in a restart.+ await putVoiceMode("pipeline");+ // The provider console opens on the cards that need no key.+ setLocalMode(true);+ setLocalActive(true);+ cheer("jump");+ } catch (e) {+ setLocalError(e instanceof Error ? e.message : String(e));+ } finally {+ setLocalBusy(false);+ }+ }++ const keyForm = (p: ProviderDescriptor, onSaved?: () => void) => {+ const slot = primarySlot(p);+ if (!slot) return null;+ return (+ <ApiKeyForm+ secretKey={slot}+ dashboardUrl={p.dashboard_url}+ configured={slotConfigured(p)}+ effectiveConfigured={slotEffective(p)}+ credentialHelp={p.credential_help}+ coveredNote={p.credential_note ?? null}+ sharedWith={p.secret_shared_with?.[slot] ?? []}+ testAfterSave={{ id: p.id, label: p.label, section: p.tier, active: p.active }}+ onChanged={() => void refetch()}+ onSavedActivate={onSaved}+ />+ );+ };++ return (+ <div className="space-y-5">+ {plans.length > 0 && (+ <Rise index={0}>+ <div className="grid gap-2 sm:grid-cols-2" role="radiogroup" aria-label={t("first_run.brain.title")} data-testid="onboarding-plan-picker">+ {plans.map((p) => (+ <Option+ key={p.id}+ selected={choice === p.id}+ onSelect={() => void choose(p.id)}+ title={planText(t, p, "label")}+ body={planText(t, p, "summary")}+ badge={p.recommended ? t("first_run.brain.recommended") : null}+ testId={`onboarding-plan-${p.id}`}+ />+ ))}+ </div>+ <div className="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm">+ <QuietAction+ onClick={() => void choose(CUSTOM)}+ testId="onboarding-plan-custom"+ className={cn(choice === CUSTOM && "text-foreground underline underline-offset-4")}+ >+ {t("first_run.brain.other_provider")}+ </QuietAction>+ <QuietAction+ onClick={() => void choose(LOCAL)}+ testId="onboarding-plan-local"+ className={cn(choice === LOCAL && "text-foreground underline underline-offset-4")}+ >+ {probe === "ready" || probe === "empty"+ ? t("first_run.brain.local_found")+ : t("first_run.brain.local")}+ </QuietAction>+ </div>+ </Rise>+ )}++ {loading && startable.length === 0 && choice !== LOCAL ? (+ <Status tone="muted">{t("first_run.brain.loading")}</Status>+ ) : error && startable.length === 0 && choice !== LOCAL ? (+ <Status tone="warning">{t("first_run.brain.load_failed")}</Status>+ ) : null}++ {plan && planCard && (+ <Rise index={1}>+ <div className="rounded-xl border border-border bg-background p-4" data-testid="onboarding-live-key">+ <div className="mb-3 flex items-baseline justify-between gap-3">+ <span className="text-sm font-medium text-foreground">+ {fill(t("first_run.brain.key_for"), { provider: planCard.label })}+ </span>+ <span className="text-xs text-muted-foreground">+ {slotEffective(planCard) ? t("first_run.brain.key_saved") : t("first_run.brain.key_missing")}+ </span>+ </div>+ {keyForm(planCard)}+ </div>+ </Rise>+ )}++ {choice === CUSTOM && startable.length > 0 && (+ <Rise index={1}>+ <ol className="overflow-hidden rounded-xl border border-border bg-background" data-testid="onboarding-provider-list">+ {startable.map((p) => {+ const open = openRow === p.id;+ const effective = slotEffective(p);+ return (+ <li key={p.id} className="border-b border-border last:border-b-0">+ <button+ type="button"+ aria-expanded={open}+ data-testid={`onboarding-provider-${p.id}`}+ onClick={() => setOpenRow(open ? null : p.id)}+ className={cn(+ "flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary",+ FOCUS_RING,+ )}+ >+ <span className="min-w-0 flex-1 text-sm font-medium text-foreground">{p.label}</span>+ {p.recommended && (+ <span className="text-micro font-medium text-accent">{t("first_run.brain.recommended")}</span>+ )}+ <span className="flex items-center gap-1.5 text-xs text-muted-foreground">+ <span+ aria-hidden+ className={cn("h-1.5 w-1.5 rounded-full", effective ? "bg-success" : "bg-border-strong")}+ />+ {p.active+ ? t("first_run.brain.active")+ : effective+ ? t("first_run.brain.key_saved")+ : t("first_run.brain.key_missing")}+ </span>+ <ChevronDown+ aria-hidden+ className={cn("h-3.5 w-3.5 text-muted-foreground transition-transform", open && "rotate-180")}+ />+ </button>+ {open && <div className="px-4 pb-4">{keyForm(p, () => activateIfNone(p))}</div>}+ </li>+ );+ })}+ </ol>+ </Rise>+ )}++ {choice === LOCAL && (+ <Rise index={1}>+ <div className="space-y-3 rounded-xl border border-border bg-background p-4" data-testid="onboarding-local">+ <p className="text-sm font-medium text-foreground">{t("first_run.brain.local_title")}</p>+ {probe === "checking" && <Status tone="muted">{t("first_run.brain.local_checking")}</Status>}+ {probe === "ready" && !localActive && (+ <p className="text-sm leading-relaxed text-muted-foreground">{t("first_run.brain.local_ready")}</p>+ )}+ {probe === "empty" && (+ <p className="text-sm leading-relaxed text-muted-foreground">{t("first_run.brain.local_empty")}</p>+ )}+ {probe === "missing" && (+ <p className="text-sm leading-relaxed text-muted-foreground">+ {t("first_run.brain.local_missing")}{" "}+ <a+ href="https://ollama.com/download"+ target="_blank"+ rel="noreferrer"+ className="inline-flex items-center gap-1 text-accent underline-offset-4 hover:underline"+ >+ {t("first_run.brain.local_get")}+ <ExternalLink aria-hidden className="h-3 w-3" />+ </a>+ </p>+ )}+ {probe === "ready" && !localActive && (+ <button+ type="button"+ onClick={() => void activateLocal()}+ disabled={localBusy}+ className={cn(+ "h-9 rounded-lg border border-border-strong bg-card px-4 text-sm font-medium text-foreground transition-colors hover:bg-secondary disabled:opacity-40",+ FOCUS_RING,+ )}+ >+ {t("first_run.brain.local_use")}+ </button>+ )}+ {localActive && <Status tone="ok">{t("first_run.brain.local_active")}</Status>}+ {localError && <Status tone="error">{localError}</Status>}+ </div>+ </Rise>+ )}++ {plan && applying && (+ <Status tone="muted" testId="onboarding-plan-applying">+ {fill(t("first_run.brain.applying"), { plan: planText(t, plan, "label") })}+ </Status>+ )}+ {plan && planApplied && (+ <Status tone="ok" testId="onboarding-plan-applied">+ {fill(t("first_run.brain.applied"), { plan: planText(t, plan, "label") })}+ </Status>+ )}+ {plan && applied?.id === plan.id && applied.outcome.failed.length > 0 && (+ <Status tone="warning" testId="onboarding-plan-partial">+ {fill(t("first_run.brain.partial"), {+ parts: applied.outcome.failed.map((f) => `${f.surface}: ${f.error}`).join(" · "),+ })}+ </Status>+ )}++ <Rise index={2}>+ <p className="flex items-start gap-2 text-xs leading-relaxed text-muted-foreground">+ <Lock aria-hidden className="mt-0.5 h-3.5 w-3.5 shrink-0" />+ {t("first_run.brain.security")}+ </p>+ </Rise>++ <Rise index={3} className="space-y-3">+ <PrimaryAction onClick={next} disabled={!ready}>+ {t("first_run.continue")}+ </PrimaryAction>+ {!ready && (+ <div className="text-center">+ <QuietAction onClick={skip} testId="onboarding-brain-later">+ {t("first_run.brain.later")}+ </QuietAction>+ </div>+ )}+ </Rise>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/HelloBeat.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/HelloBeat.tsxnew file mode 100644index 0000000000..1c9fe9cbed--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/HelloBeat.tsx@@ -0,0 +1,123 @@+import { AlertTriangle, Cloud, CreditCard, Monitor, Terminal } from "lucide-react";+import { useState } from "react";+import { useT } from "@/i18n";+import type { BeatProps } from "../WelcomeFlow";+import { CheckLine, PrimaryAction, QuietAction, Rise, Status } from "../ui";++/**+ * The welcome beat is the consent moment — the ONLY one: the installer asks+ * nothing. It says in five short lines what the assistant does on this+ * machine, then one checkbox and one button.+ *+ * Acceptance is awaited: the Terms record must exist before the guide goes+ * on. Declining is real and quits the app (the backend ends the process+ * moments after answering); nothing is saved, so the next start asks again.+ */+export function HelloBeat({ onb, next, cheer }: BeatProps) {+ const t = useT();+ const [accepted, setAccepted] = useState(Boolean(onb.state?.terms.accepted));+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const [declined, setDeclined] = useState(false);+ const [terms, setTerms] = useState<string | null>(null);+ const [showTerms, setShowTerms] = useState(false);++ const toggleTerms = async () => {+ setShowTerms((v) => !v);+ if (terms !== null) return;+ try {+ const res = await fetch("/api/onboarding/terms");+ setTerms(res.ok ? ((await res.json()) as { text: string }).text : "");+ } catch {+ setTerms("");+ }+ };++ const proceed = async () => {+ if (!accepted || busy) return;+ setBusy(true);+ setError(null);+ try {+ await onb.acceptTerms();+ cheer("jump");+ next();+ } catch {+ setError(t("first_run.welcome.accept_failed"));+ } finally {+ setBusy(false);+ }+ };++ const decline = async () => {+ // The goodbye shows first: the backend ends the process right after it+ // answers, so this is the last thing the window paints.+ setDeclined(true);+ try {+ await fetch("/api/onboarding/decline-terms", { method: "POST" });+ } catch {+ // A warming backend cannot hold the goodbye back; the user closes the window either way.+ }+ };++ if (declined) {+ return (+ <div className="space-y-2 text-center" data-testid="onboarding-declined">+ <p className="text-base font-medium text-foreground">{t("first_run.welcome.declined_title")}</p>+ <p className="text-sm leading-relaxed text-muted-foreground">{t("first_run.welcome.declined_body")}</p>+ </div>+ );+ }++ const facts = [+ { key: "commands", Icon: Terminal },+ { key: "screen", Icon: Monitor },+ { key: "cloud", Icon: Cloud },+ { key: "costs", Icon: CreditCard },+ { key: "mistakes", Icon: AlertTriangle },+ ] as const;++ return (+ <div className="space-y-5">+ <Rise index={0}>+ <p className="mb-2 text-xs font-medium uppercase tracking-[0.14em] text-muted-foreground">+ {t("first_run.welcome.facts_label")}+ </p>+ <ul className="space-y-2 rounded-xl border border-border bg-background px-4 py-3" data-testid="onboarding-facts">+ {facts.map(({ key, Icon }) => (+ <li key={key} className="flex items-start gap-3 text-sm leading-snug text-foreground">+ <Icon aria-hidden className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />+ <span>{t(`first_run.welcome.fact_${key}`)}</span>+ </li>+ ))}+ </ul>+ </Rise>++ <Rise index={1} className="space-y-2">+ <CheckLine checked={accepted} onChange={setAccepted} testId="onboarding-accept">+ {t("first_run.welcome.accept")}+ </CheckLine>+ <QuietAction onClick={() => void toggleTerms()} className="ml-7 underline underline-offset-4">+ {showTerms ? t("first_run.welcome.hide_terms") : t("first_run.welcome.read_terms")}+ </QuietAction>+ {showTerms && (+ <pre className="ml-7 max-h-40 overflow-y-auto whitespace-pre-wrap rounded-lg border border-border bg-background p-3 font-sans text-xs leading-relaxed text-muted-foreground scrollbar-jarvis">+ {terms || t("first_run.welcome.terms_loading")}+ </pre>+ )}+ </Rise>++ {error && <Status tone="error">{error}</Status>}++ <Rise index={2} className="space-y-3 pt-1">+ <PrimaryAction onClick={() => void proceed()} disabled={!accepted} busy={busy}>+ {t("first_run.welcome.start")}+ </PrimaryAction>+ <div className="text-center">+ <QuietAction onClick={() => void decline()} testId="onboarding-decline">+ {t("first_run.welcome.decline")}+ </QuietAction>+ </div>+ </Rise>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/PermissionsBeat.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/PermissionsBeat.tsxnew file mode 100644index 0000000000..d358357df9--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/PermissionsBeat.tsx@@ -0,0 +1,88 @@+import { useCallback, useEffect, useState } from "react";+import type { PermissionId, PermissionSnapshot } from "@/hooks/usePermissions";+import { useT } from "@/i18n";+import { PermissionRows } from "@/views/settings/PermissionsPanel";+import type { BeatProps } from "../WelcomeFlow";+import { PrimaryAction, QuietAction, Rise } from "../ui";++const EXPECTED_MACOS_PERMISSIONS = new Set<PermissionId>([+ "microphone",+ "screen_recording",+ "accessibility",+ "input_monitoring",+ "event_posting",+ "automation",+ "credential_store",+]);++/**+ * Every macOS capability is granted — or granted and only waiting for the+ * restart that ends the guide anyway. macOS freezes some probes per process,+ * so a fresh grant can read back only after a relaunch; blocking on that used+ * to force a mid-flow restart that threw people back to the start.+ */+export function permissionSnapshotReady(snapshot: PermissionSnapshot | null): boolean {+ if (!snapshot) return false;+ if (snapshot.platform === "linux" || snapshot.platform === "win32") return true;+ if (snapshot.platform !== "darwin") return false;+ if (snapshot.app_identity.stable !== true) return false;+ if (snapshot.permissions.length !== EXPECTED_MACOS_PERMISSIONS.size) return false;+ const observed = new Set(snapshot.permissions.map((item) => item.id));+ if (+ observed.size !== EXPECTED_MACOS_PERMISSIONS.size ||+ [...EXPECTED_MACOS_PERMISSIONS].some((id) => !observed.has(id))+ ) {+ return false;+ }+ return snapshot.permissions.every(+ (item) => ["granted", "not_required"].includes(item.status) || item.restart_required === true,+ );+}++/**+ * macOS only — `beatsFor` leaves this beat out everywhere else. The rows are+ * the Settings panel's own, so what is granted here is exactly what Settings+ * shows later; they refresh themselves while the user is in System Settings.+ */+export function PermissionsBeat({ next, skip, report, cheer }: BeatProps) {+ const t = useT();+ const [allReady, setAllReady] = useState(false);+ const onSnapshot = useCallback((snapshot: PermissionSnapshot | null) => {+ setAllReady(permissionSnapshotReady(snapshot));+ }, []);++ useEffect(() => {+ if (allReady) cheer("jump");+ report(+ allReady+ ? { summary: t("first_run.permissions.summary"), gap: null }+ : { summary: null, gap: t("first_run.permissions.gap") },+ );+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [allReady, t]);++ return (+ <div className="space-y-5">+ <Rise index={0}>+ <div className="rounded-xl border border-border bg-background px-4 py-2">+ <PermissionRows compact deferRestartNote onSnapshot={onSnapshot} />+ </div>+ </Rise>+ <Rise index={1}>+ <p className="text-xs leading-relaxed text-muted-foreground">{t("first_run.permissions.privacy")}</p>+ </Rise>+ <Rise index={2} className="space-y-3">+ <PrimaryAction onClick={next} disabled={!allReady}>+ {t("first_run.continue")}+ </PrimaryAction>+ {!allReady && (+ <div className="text-center">+ <QuietAction onClick={skip} testId="onboarding-permissions-skip">+ {t("first_run.permissions.later")}+ </QuietAction>+ </div>+ )}+ </Rise>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/ReadyBeat.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/ReadyBeat.tsxnew file mode 100644index 0000000000..2e1cc8be7f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/ReadyBeat.tsx@@ -0,0 +1,153 @@+import { useEffect, useState } from "react";+import { Switch } from "@/components/ui/switch";+import { fill, useT } from "@/i18n";+import { cn } from "@/lib/utils";+import type { BeatId } from "../beats";+import type { BeatProps } from "../WelcomeFlow";+import { PrimaryAction, Rise, Status } from "../ui";++interface Autostart {+ enabled: boolean;+ supported: boolean;+}++/** The beats whose outcome the review reads back, in the order they ran. */+const REVIEWED: BeatId[] = ["brain", "agents", "permissions", "voice"];++/**+ * The review and the start. What each beat reported sits in one list — set+ * up, or honestly not — and the one action starts the assistant: the backend+ * writes the completion marker and restarts the app once, so everything+ * chosen here takes effect together. The tour of the real app follows that+ * restart.+ */+export function ReadyBeat({ onb, results, chosenName }: BeatProps) {+ const t = useT();+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const [autostart, setAutostart] = useState<Autostart | null>(null);+ const skipped = new Set(onb.state?.skipped_steps ?? []);++ // Start at login — only offered where the host supports it (a headless+ // Linux server does not); a failed probe hides it, Settings stays the way.+ useEffect(() => {+ let cancelled = false;+ void (async () => {+ try {+ const res = await fetch("/api/settings/autostart");+ if (res.ok && !cancelled) setAutostart((await res.json()) as Autostart);+ } catch {+ // Probe is best-effort; without it the switch is simply not shown.+ }+ })();+ return () => {+ cancelled = true;+ };+ }, []);++ async function toggleAutostart(enabled: boolean) {+ setAutostart((s) => (s ? { ...s, enabled } : s));+ try {+ await fetch("/api/settings/autostart", {+ method: "PUT",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ enabled }),+ });+ } catch {+ // The optimistic value stays; Settings is where it can be fixed.+ }+ }++ async function start() {+ if (busy) return;+ setBusy(true);+ setError(null);+ try {+ await onb.complete();+ } catch {+ setError(t("first_run.ready.start_failed"));+ setBusy(false);+ }+ }++ const rows = REVIEWED.filter((beat) => beat in results || skipped.has(beat)).map((beat) => {+ const result = results[beat];+ return {+ beat,+ label: t(`first_run.ready.row_${beat}`),+ value: result?.summary ?? t("first_run.ready.not_set"),+ ok: Boolean(result?.summary),+ gap: result?.gap ?? (skipped.has(beat) && !result ? t(`first_run.ready.skipped_${beat}`) : null),+ };+ });+ const gaps = rows.filter((row) => row.gap);+ const voice = results.voice?.summary ?? null;++ return (+ <div className="space-y-5">+ {chosenName && voice && (+ <Rise index={0}>+ <p className="rounded-xl bg-accent-soft px-4 py-3 text-center text-base text-foreground" data-testid="onboarding-say-hello">+ {fill(t("first_run.ready.say"), { phrase: voice, assistant: chosenName })}+ </p>+ </Rise>+ )}++ <Rise index={1}>+ <dl className="overflow-hidden rounded-xl border border-border bg-background" data-testid="onboarding-review">+ {rows.map((row) => (+ <div key={row.beat} className="flex items-center justify-between gap-4 border-b border-border px-4 py-3 last:border-b-0">+ <dt className="text-sm text-muted-foreground">{row.label}</dt>+ <dd className={cn("flex min-w-0 items-center gap-2 text-right text-sm", row.ok ? "font-medium text-foreground" : "text-muted-foreground")}>+ <span className="truncate">{row.value}</span>+ <span aria-hidden className={cn("h-1.5 w-1.5 shrink-0 rounded-full", row.ok ? "bg-success" : "bg-border-strong")} />+ </dd>+ </div>+ ))}+ {autostart?.supported && (+ <div className="flex items-center justify-between gap-4 px-4 py-3">+ <div className="min-w-0">+ <span className="block text-sm text-foreground">{t("first_run.ready.autostart")}</span>+ <span className="block text-xs text-muted-foreground">{t("first_run.ready.autostart_hint")}</span>+ </div>+ <Switch+ checked={autostart.enabled}+ onCheckedChange={(v) => void toggleAutostart(v)}+ aria-label={t("first_run.ready.autostart")}+ data-testid="onboarding-autostart"+ />+ </div>+ )}+ </dl>+ </Rise>++ {gaps.length > 0 && (+ <Rise index={2}>+ <div data-testid="onboarding-gaps" className="space-y-1.5">+ {gaps.map((row) => (+ <Status key={row.beat} tone="muted">+ {row.gap}+ </Status>+ ))}+ </div>+ </Rise>+ )}++ <Rise index={3}>+ <p className="text-xs leading-relaxed text-muted-foreground">{t("first_run.ready.restart_note")}</p>+ </Rise>++ {error && <Status tone="error">{error}</Status>}++ <Rise index={4}>+ <PrimaryAction onClick={() => void start()} busy={busy} testId="onboarding-start">+ {busy+ ? t("first_run.ready.starting")+ : chosenName+ ? fill(t("first_run.ready.start_named"), { assistant: chosenName })+ : t("first_run.ready.start")}+ </PrimaryAction>+ </Rise>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.test.tsxnew file mode 100644index 0000000000..3be22eef72--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.test.tsx@@ -0,0 +1,181 @@+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";+import { loadLocaleChunk } from "@/i18n";+import type { BeatProps } from "../WelcomeFlow";+import { meterFill, VoiceBeat } from "./VoiceBeat";++beforeAll(async () => {+ await loadLocaleChunk("onboarding");+});++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+ vi.unstubAllGlobals();+});++interface Route {+ save?: { status: number; body: object };+ activation?: { status: number; body: object };+}++function stubFetch(route: Route = {}) {+ const calls: Array<{ url: string; method: string; body?: string }> = [];+ const reply = (status: number, body: object) =>+ Promise.resolve({ ok: status < 400, status, json: () => Promise.resolve(body) });+ vi.stubGlobal(+ "fetch",+ vi.fn().mockImplementation((url: string, init?: RequestInit) => {+ const method = init?.method ?? "GET";+ calls.push({ url, method, body: init?.body as string | undefined });+ if (url === "/api/settings/keybinds") return reply(200, { keybinds: { call: "f3+f4" }, defaults: {} });+ if (url === "/api/settings/wake-word" && method === "PUT") {+ const r = route.save ?? { status: 200, body: { ok: true, degraded: false, persisted: true } };+ return reply(r.status, r.body);+ }+ if (url === "/api/settings/wake-word/activation") {+ const r = route.activation ?? { status: 200, body: { ok: true, enabled: true, persisted: true } };+ return reply(r.status, r.body);+ }+ if (url === "/api/settings/wake-word/mic-level") {+ return reply(200, { max_dbfs: -18, no_device: false, too_quiet: false });+ }+ return reply(200, {});+ }),+ );+ return calls;+}++function props(over: Partial<BeatProps> = {}): BeatProps {+ return {+ onb: {+ state: {+ completed: false,+ current_step: "voice",+ skipped_steps: [],+ terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" },+ wake_word_acknowledged: false,+ legal_references: [{ label: "EUIPO", url: "https://euipo.europa.eu/eSearch/" }],+ steps: [],+ },+ loading: false,+ error: null,+ refetch: vi.fn(async () => undefined),+ saveStep: vi.fn(async () => undefined),+ acceptTerms: vi.fn(async () => undefined),+ acknowledgeWakeWord: vi.fn(async () => undefined),+ complete: vi.fn(async () => undefined),+ completeTour: vi.fn(async () => undefined),+ },+ next: vi.fn(),+ skip: vi.fn(),+ report: vi.fn(),+ results: {},+ cheer: vi.fn(),+ chosenName: null,+ setChosenName: vi.fn(),+ ...over,+ };+}++describe("meterFill", () => {+ it("maps dBFS onto 0..1 and clamps", () => {+ expect(meterFill(-60)).toBe(0);+ expect(meterFill(0)).toBe(1);+ expect(meterFill(-30)).toBeCloseTo(0.5);+ expect(meterFill(-90)).toBe(0);+ expect(meterFill(Number.NaN)).toBe(0);+ });+});++describe("VoiceBeat", () => {+ it("names the assistant after the wake word while typing", async () => {+ stubFetch();+ render(<VoiceBeat {...props()} />);+ fireEvent.change(screen.getByTestId("wake-word-input"), { target: { value: "Nova" } });+ expect(screen.getByTestId("wake-derived-name").textContent).toContain("Nova");+ });++ it("saves the word only after the responsibility is ticked", async () => {+ const calls = stubFetch();+ const p = props();+ render(<VoiceBeat {...p} />);+ fireEvent.change(screen.getByTestId("wake-word-input"), { target: { value: "Nova" } });+ const save = screen.getByTestId("onboarding-primary") as HTMLButtonElement;+ expect(save.disabled).toBe(true);+ fireEvent.click(screen.getByTestId("wake-ack"));+ await act(async () => {+ fireEvent.click(save);+ });+ expect(p.onb.acknowledgeWakeWord).toHaveBeenCalled();+ const put = calls.find((c) => c.url === "/api/settings/wake-word" && c.method === "PUT");+ expect(JSON.parse(put!.body!).phrase).toBe("Hey Nova");+ expect(p.setChosenName).toHaveBeenCalledWith("Nova");+ expect(p.report).toHaveBeenCalledWith({ summary: "Hey Nova", gap: null });+ expect(p.next).toHaveBeenCalled();+ });++ it("does not pretend a word nothing can hear is working", async () => {+ stubFetch({ save: { status: 200, body: { ok: true, degraded: true, persisted: true } } });+ const p = props();+ render(<VoiceBeat {...p} />);+ fireEvent.change(screen.getByTestId("wake-word-input"), { target: { value: "Nova" } });+ fireEvent.click(screen.getByTestId("wake-ack"));+ await act(async () => {+ fireEvent.click(screen.getByTestId("onboarding-primary"));+ });+ expect(screen.getByTestId("wake-degraded")).toBeDefined();+ expect(p.next).not.toHaveBeenCalled();+ await act(async () => {+ fireEvent.click(screen.getByTestId("wake-continue-anyway"));+ });+ expect(p.next).toHaveBeenCalled();+ const report = (p.report as ReturnType<typeof vi.fn>).mock.calls.at(-1)![0];+ expect(report.gap).toContain("Hey Nova");+ });++ it("always leaves a way on after a failed call (BUG-209)", async () => {+ stubFetch({ save: { status: 500, body: { detail: "config file is locked" } } });+ const p = props();+ render(<VoiceBeat {...p} />);+ fireEvent.change(screen.getByTestId("wake-word-input"), { target: { value: "Nova" } });+ fireEvent.click(screen.getByTestId("wake-ack"));+ await act(async () => {+ fireEvent.click(screen.getByTestId("onboarding-primary"));+ });+ expect(screen.getByText("config file is locked")).toBeDefined();+ fireEvent.click(screen.getByTestId("wake-skip-after-error"));+ expect(p.skip).toHaveBeenCalled();+ });++ it("reports a switch that did not persist", async () => {+ stubFetch({ activation: { status: 200, body: { ok: true, enabled: false, persisted: false } } });+ const p = props();+ render(<VoiceBeat {...p} />);+ fireEvent.click(screen.getByTestId("wake-mode-shortcut"));+ await act(async () => {+ fireEvent.click(screen.getByTestId("onboarding-primary"));+ });+ const report = (p.report as ReturnType<typeof vi.fn>).mock.calls.at(-1)![0];+ expect(report.gap).toMatch(/gone after the restart/);+ expect(p.setChosenName).toHaveBeenCalledWith(null);+ expect(p.next).toHaveBeenCalled();+ });++ it("shows the Call keys on the shortcut choice", async () => {+ stubFetch();+ render(<VoiceBeat {...props()} />);+ await waitFor(() => expect(screen.getAllByText("f3").length).toBeGreaterThan(0));+ });++ it("answers the microphone test in place", async () => {+ stubFetch();+ const p = props();+ render(<VoiceBeat {...p} />);+ await act(async () => {+ fireEvent.click(screen.getByTestId("wake-mic-test"));+ });+ await waitFor(() => expect(screen.getByText(/came through clearly/)).toBeDefined());+ expect(p.cheer).toHaveBeenCalled();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.tsx b/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.tsxnew file mode 100644index 0000000000..d51d47efc6--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.tsx@@ -0,0 +1,375 @@+import { Mic } from "lucide-react";+import { useEffect, useState } from "react";+import { FOCUS_RING } from "@/components/agentic/controls";+import { useLocalSpeechInstall, useWakeWord, type WakeActivationResult } from "@/hooks/useWakeWord";+import { fill, useT } from "@/i18n";+import { deriveAssistantName } from "@/lib/deriveAssistantName";+import { cn } from "@/lib/utils";+import type { BeatProps } from "../WelcomeFlow";+import { CheckLine, Keycaps, Option, PrimaryAction, QuietAction, Rise, Status } from "../ui";++type Mode = "wake" | "shortcut";++/** GET /api/settings/wake-word/mic-level. */+interface MicLevel {+ max_dbfs: number;+ no_device: boolean;+ too_quiet: boolean;+ permission_required?: boolean;+}++type MicCheck =+ | { state: "idle" }+ | { state: "listening" }+ | { state: "done"; level: MicLevel }+ | { state: "failed" };++/** -60 dBFS reads as silence, 0 dBFS as the loudest a microphone gets. */+export function meterFill(maxDbfs: number): number {+ if (!Number.isFinite(maxDbfs)) return 0;+ return Math.min(1, Math.max(0, (maxDbfs + 60) / 60));+}++const METER_SEGMENTS = 16;++/**+ * How the user calls the assistant — and, through the wake word, what it is+ * called: "Hey Nova" makes an assistant named Nova. That is the guide's one+ * moment of making it your own, so the name answers live under the field.+ *+ * Two honest paths, no branded default (the wake word is always the user's+ * own word, never a trademark):+ * - wake word: only counts as working once a local model can hear that exact+ * word; a `degraded` save says so and offers the one-click local speech+ * install, or going on with the shortcut meanwhile;+ * - shortcut: nothing listens until the Call keys are pressed.+ * A failed call always leaves a way on (BUG-209).+ */+export function VoiceBeat({ onb, next, skip, report, cheer, setChosenName }: BeatProps) {+ const t = useT();+ const { saveWakeWord, setWakeActivation } = useWakeWord();+ const [mode, setMode] = useState<Mode>("wake");+ const [word, setWord] = useState("");+ const [ack, setAck] = useState(false);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);+ const [degraded, setDegraded] = useState(false);+ const [showRefs, setShowRefs] = useState(false);+ const [callCombo, setCallCombo] = useState<string | null>(null);+ const [mic, setMic] = useState<MicCheck>({ state: "idle" });+ const { status: install, install: startInstall } = useLocalSpeechInstall(() => {+ // The pack is in: the stale degraded verdict goes, and the normal action+ // re-checks and switches the word on.+ setDegraded(false);+ setError(null);+ });++ const trimmed = word.trim();+ const phrase = `Hey ${trimmed}`;+ const derived = trimmed.length >= 2 ? deriveAssistantName(phrase) : "";+ const refs = onb.state?.legal_references ?? [];++ useEffect(() => {+ let cancelled = false;+ void (async () => {+ try {+ const res = await fetch("/api/settings/keybinds");+ if (!res.ok) return;+ const data = (await res.json()) as {+ keybinds?: Record<string, string>;+ defaults?: Record<string, string>;+ };+ const combo = data.keybinds?.call || data.defaults?.call || null;+ if (!cancelled) setCallCombo(combo);+ } catch {+ // Without the binding the copy names "the Call shortcut" instead of its keys.+ }+ })();+ return () => {+ cancelled = true;+ };+ }, []);++ // A live-applied switch the config writer could not persist works now but+ // is gone after the restart — the ready beat must say so.+ function persistGap(result: WakeActivationResult, fallback: string | null): string | null {+ if (result.persisted) return fallback;+ const lost = t("first_run.voice.gap_not_persisted");+ return fallback ? `${fallback} ${lost}` : lost;+ }++ function edit(value: string) {+ setWord(value);+ if (degraded) setDegraded(false);+ if (error) setError(null);+ }++ async function checkMic() {+ setMic({ state: "listening" });+ try {+ const res = await fetch("/api/settings/wake-word/mic-level");+ if (!res.ok) throw new Error(`HTTP ${res.status}`);+ const level = (await res.json()) as MicLevel;+ setMic({ state: "done", level });+ if (!level.no_device && !level.too_quiet && !level.permission_required) cheer("jump");+ } catch {+ setMic({ state: "failed" });+ }+ }++ async function saveWake() {+ if (trimmed.length < 2 || !ack || busy) return;+ setBusy(true);+ setError(null);+ try {+ await onb.acknowledgeWakeWord();+ const result = await saveWakeWord({ phrase, engine: "auto", persist: true });+ if (result.degraded) {+ // Nothing can hear this word yet — say so instead of pretending.+ setDegraded(true);+ return;+ }+ const activation = await setWakeActivation(true);+ setChosenName(derived || null);+ report({ summary: phrase, gap: persistGap(activation, null) });+ cheer("jump");+ next();+ } catch (e) {+ setError((e as Error).message);+ } finally {+ setBusy(false);+ }+ }++ async function continueDegraded() {+ setBusy(true);+ setError(null);+ try {+ const activation = await setWakeActivation(true);+ setChosenName(derived || null);+ report({+ summary: phrase,+ gap: persistGap(activation, fill(t("first_run.voice.gap_degraded"), { phrase })),+ });+ next();+ } catch (e) {+ setError((e as Error).message);+ } finally {+ setBusy(false);+ }+ }++ async function chooseShortcut() {+ setBusy(true);+ setError(null);+ try {+ const activation = await setWakeActivation(false);+ setChosenName(null);+ report({+ summary: callCombo+ ? fill(t("first_run.voice.summary_shortcut_keys"), { keys: callCombo.toUpperCase() })+ : t("first_run.voice.summary_shortcut"),+ gap: persistGap(activation, null),+ });+ next();+ } catch (e) {+ setError((e as Error).message);+ } finally {+ setBusy(false);+ }+ }++ function skipAfterError() {+ report({ summary: null, gap: t("first_run.voice.gap_skipped") });+ skip();+ }++ const micStatus = (() => {+ if (mic.state === "listening") return <Status tone="muted">{t("first_run.voice.mic_listening")}</Status>;+ if (mic.state === "failed") return <Status tone="warning">{t("first_run.voice.mic_failed")}</Status>;+ if (mic.state !== "done") return null;+ const l = mic.level;+ if (l.permission_required) return <Status tone="warning">{t("first_run.voice.mic_permission")}</Status>;+ if (l.no_device) return <Status tone="muted">{t("first_run.voice.mic_no_device")}</Status>;+ if (l.too_quiet) return <Status tone="warning">{t("first_run.voice.mic_quiet")}</Status>;+ return <Status tone="ok">{t("first_run.voice.mic_good")}</Status>;+ })();++ const level = mic.state === "done" ? meterFill(mic.level.max_dbfs) : 0;+ const lit = Math.round(level * METER_SEGMENTS);++ return (+ <div className="space-y-5">+ <Rise index={0}>+ <div className="grid gap-2 sm:grid-cols-2" role="radiogroup" aria-label={t("first_run.voice.title")}>+ <Option+ selected={mode === "wake"}+ onSelect={() => setMode("wake")}+ title={t("first_run.voice.wake_title")}+ body={t("first_run.voice.wake_body")}+ testId="wake-mode-wake"+ />+ <Option+ selected={mode === "shortcut"}+ onSelect={() => setMode("shortcut")}+ title={t("first_run.voice.shortcut_title")}+ body={+ callCombo ? (+ <span className="inline-flex flex-wrap items-center gap-1.5">+ {t("first_run.voice.shortcut_body_keys")} <Keycaps combo={callCombo} />+ </span>+ ) : (+ t("first_run.voice.shortcut_body")+ )+ }+ testId="wake-mode-shortcut"+ />+ </div>+ </Rise>++ {mode === "wake" && (+ <Rise index={1} className="space-y-3">+ <div className="flex items-center gap-2 rounded-xl border border-border bg-background p-2 focus-within:border-accent">+ <span className="rounded-lg bg-secondary px-3 py-1.5 text-base font-medium text-foreground">+ {t("first_run.voice.prefix")}+ </span>+ <input+ type="text"+ value={word}+ maxLength={56}+ onChange={(e) => edit(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") void saveWake();+ }}+ aria-label={t("first_run.voice.word_label")}+ placeholder={t("first_run.voice.placeholder")}+ className="min-w-0 flex-1 bg-transparent px-1 text-lg text-foreground placeholder:text-muted-foreground/70 focus:outline-none"+ data-testid="wake-word-input"+ />+ </div>+ <p className="min-h-5 text-sm text-muted-foreground" aria-live="polite" data-testid="wake-derived-name">+ {derived ? (+ <>+ {t("first_run.voice.name_intro")}{" "}+ <span className="rounded-md bg-accent-soft px-1.5 py-0.5 font-medium text-accent">{derived}</span>+ </>+ ) : (+ t("first_run.voice.name_hint")+ )}+ </p>+ <p className="text-xs leading-relaxed text-muted-foreground">+ {t("first_run.voice.trademark")}{" "}+ <button+ type="button"+ onClick={() => setShowRefs((v) => !v)}+ className={cn("rounded-sm text-accent underline-offset-4 hover:underline", FOCUS_RING)}+ >+ {t("first_run.voice.how_to_check")}+ </button>+ </p>+ {showRefs && refs.length > 0 && (+ <ul className="space-y-0.5 rounded-lg border border-border bg-background px-3 py-2 text-xs">+ {refs.map((r) => (+ <li key={r.url}>+ <a href={r.url} target="_blank" rel="noreferrer" className="text-accent underline-offset-4 hover:underline">+ {r.label}+ </a>+ </li>+ ))}+ <li className="pt-1 text-muted-foreground">{t("first_run.voice.refs_caveat")}</li>+ </ul>+ )}+ <CheckLine checked={ack} onChange={setAck} testId="wake-ack">+ {t("first_run.voice.ack")}+ </CheckLine>+ </Rise>+ )}++ <Rise index={2}>+ <div className="flex flex-wrap items-center gap-3 rounded-xl border border-border bg-background px-4 py-3">+ <button+ type="button"+ onClick={() => void checkMic()}+ disabled={mic.state === "listening"}+ data-testid="wake-mic-test"+ className={cn(+ "inline-flex h-8 items-center gap-1.5 rounded-lg border border-border-strong bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-secondary disabled:opacity-60",+ FOCUS_RING,+ )}+ >+ <Mic aria-hidden className={cn("h-3.5 w-3.5", mic.state === "listening" && "animate-pulse text-accent")} />+ {t("first_run.voice.mic_test")}+ </button>+ <div className="flex h-3 flex-1 items-end gap-[3px]" aria-hidden data-testid="wake-mic-meter">+ {Array.from({ length: METER_SEGMENTS }, (_, i) => (+ <span+ key={i}+ className={cn(+ "flex-1 rounded-[2px] transition-colors duration-200",+ mic.state === "listening"+ ? "animate-pulse bg-border-strong"+ : i < lit+ ? "bg-accent"+ : "bg-border",+ )}+ style={{ height: `${40 + (i / METER_SEGMENTS) * 60}%`, animationDelay: `${i * 45}ms` }}+ />+ ))}+ </div>+ <div className="w-full">{micStatus}</div>+ </div>+ </Rise>++ {error && (+ <div className="space-y-2">+ <Status tone="error">{error}</Status>+ <QuietAction onClick={skipAfterError} testId="wake-skip-after-error">+ {t("first_run.voice.skip_after_error")}+ </QuietAction>+ </div>+ )}++ {degraded && (+ <div className="space-y-2" data-testid="wake-degraded">+ <Status tone="warning">{t("settings_view.wake_word.needs_whisper_hint")}</Status>+ {install.state === "running" && <Status tone="muted">{t("settings_view.wake_word.enable_local_installing")}</Status>}+ {install.state === "done" && <Status tone="ok">{t("settings_view.wake_word.enable_local_done")}</Status>}+ {install.state === "error" && <Status tone="warning">{t("settings_view.wake_word.enable_local_error")}</Status>}+ </div>+ )}++ <Rise index={3} className="space-y-3">+ {mode === "shortcut" ? (+ <PrimaryAction onClick={() => void chooseShortcut()} busy={busy}>+ {t("first_run.continue")}+ </PrimaryAction>+ ) : degraded ? (+ <>+ {install.state !== "done" && (+ <PrimaryAction onClick={() => void startInstall()} busy={install.state === "running"} testId="wake-install-local">+ {install.state === "error"+ ? t("settings_view.wake_word.enable_local_retry")+ : t("settings_view.wake_word.enable_local_button")}+ </PrimaryAction>+ )}+ {install.state === "done" ? (+ <PrimaryAction onClick={() => void saveWake()} busy={busy}>+ {t("first_run.voice.save")}+ </PrimaryAction>+ ) : (+ <div className="text-center">+ <QuietAction onClick={() => void continueDegraded()} disabled={busy} testId="wake-continue-anyway">+ {t("first_run.voice.continue_anyway")}+ </QuietAction>+ </div>+ )}+ </>+ ) : (+ <PrimaryAction onClick={() => void saveWake()} disabled={trimmed.length < 2 || !ack} busy={busy}>+ {t("first_run.voice.save")}+ </PrimaryAction>+ )}+ </Rise>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.test.ts b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.test.tsnew file mode 100644index 0000000000..071932f07d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.test.ts@@ -0,0 +1,73 @@+import { describe, expect, it } from "vitest";+import type { ProviderDescriptor } from "@/hooks/useProviders";+import type { StarterPlan } from "@/hooks/useStarterPlans";+import { cardForPlan, planKeysComplete, startableProviders } from "./brainPlans";++function provider(over: Partial<ProviderDescriptor> & { id: string }): ProviderDescriptor {+ return {+ label: over.id,+ tier: "brain",+ auth_mode: "api_key",+ secret_keys: [`${over.id}_api_key`],+ secrets_set: {},+ dashboard_url: null,+ login_cli: null,+ install_hint: null,+ credential_path_hint: null,+ configured: false,+ active: false,+ ...over,+ } as ProviderDescriptor;+}++const plan: StarterPlan = {+ id: "openai-live",+ label: "OpenAI GPT-Live",+ summary: "",+ mode: "realtime",+ recommended: true,+ assignments: {},+ key_slots: [{ family: "openai", slot: "openai_api_key", label: "OpenAI", present: false }],+ keys_complete: false,+ ready_sections: [],+};++describe("startableProviders", () => {+ it("keeps only brain providers that take a pasted key", () => {+ const list = startableProviders([+ provider({ id: "openai" }),+ provider({ id: "tts-only", tier: "tts" as ProviderDescriptor["tier"] }),+ provider({ id: "oauth", auth_mode: "oauth" as ProviderDescriptor["auth_mode"] }),+ provider({ id: "fixed", brain_switchable: false }),+ provider({ id: "keyless", secret_keys: [] }),+ ]);+ expect(list.map((p) => p.id)).toEqual(["openai"]);+ });++ it("puts recommended first, then ones that already have a key", () => {+ const list = startableProviders([+ provider({ id: "a" }),+ provider({ id: "b", secrets_set: { b_api_key: true } }),+ provider({ id: "c", recommended: true }),+ ]);+ expect(list.map((p) => p.id)).toEqual(["c", "b", "a"]);+ });+});++describe("plans", () => {+ const cards = [provider({ id: "gemini" }), provider({ id: "openai" })];++ it("finds the one card whose slot the plan needs", () => {+ expect(cardForPlan(plan, cards)?.id).toBe("openai");+ });++ it("is complete once the plan's key reaches its card, own or shared", () => {+ expect(planKeysComplete(plan, cards)).toBe(false);+ const shared = [provider({ id: "openai", secrets_effective: { openai_api_key: true } })];+ expect(planKeysComplete(plan, shared)).toBe(true);+ });++ it("is never complete for a plan without key slots", () => {+ expect(planKeysComplete({ ...plan, key_slots: [] }, cards)).toBe(false);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.ts b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.tsnew file mode 100644index 0000000000..b0dd5bd92a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.ts@@ -0,0 +1,86 @@+/**+ * Which provider cards the brain beat shows, and when a choice is complete.+ *+ * Pure functions over the backend catalog (`GET /api/providers`) and the+ * starter plans (`GET /api/setup/starter-plans`), so the beat never decides+ * anything by a provider NAME: a catalog with one provider renders one card,+ * and any single key that can be the brain works (AP-21).+ */+import type { ProviderDescriptor } from "@/hooks/useProviders";+import type { StarterPlan } from "@/hooks/useStarterPlans";++/** The one slot a card asks for; providers with several keys expose the first. */+export function primarySlot(p: ProviderDescriptor): string | null {+ return p.secret_keys[0] ?? null;+}++/** A key is stored for this card's own slot. */+export function slotConfigured(p: ProviderDescriptor): boolean {+ const slot = primarySlot(p);+ if (!slot) return p.configured;+ return Boolean(p.secrets_set[slot]);+}++/** A key reaches this card — its own, or the family key that covers it. */+export function slotEffective(p: ProviderDescriptor): boolean {+ const slot = primarySlot(p);+ if (!slot) return p.configured;+ return Boolean(p.secrets_effective?.[slot] ?? p.secrets_set[slot]);+}++/**+ * Brain providers a first-run user can start with: anything that takes a+ * pasted key and can be the primary brain. Recommended first, then whatever+ * already has a key, then catalog order.+ */+export function startableProviders(providers: ProviderDescriptor[]): ProviderDescriptor[] {+ return providers+ .filter((p) => p.tier === "brain" && p.auth_mode === "api_key" && p.brain_switchable !== false)+ .filter((p) => (p.secret_keys?.length ?? 0) > 0)+ .sort((a, b) => {+ const ra = a.recommended ? 0 : 1;+ const rb = b.recommended ? 0 : 1;+ if (ra !== rb) return ra - rb;+ const ca = slotConfigured(a) ? 0 : 1;+ const cb = slotConfigured(b) ? 0 : 1;+ return ca - cb;+ });+}++/**+ * The card a plan asks a key for: the brain card whose primary slot is the+ * plan's family slot. One key per provider family, so one card per plan.+ */+export function cardForPlan(+ plan: StarterPlan,+ startable: ProviderDescriptor[],+): ProviderDescriptor | null {+ const slots = new Set(plan.key_slots.map((s) => s.slot));+ return (+ startable.find((p) => {+ const slot = primarySlot(p);+ return slot !== null && slots.has(slot);+ }) ?? null+ );+}++/** Every key the plan needs is saved (dedicated or covered by the family). */+export function planKeysComplete(plan: StarterPlan, startable: ProviderDescriptor[]): boolean {+ return (+ plan.key_slots.length > 0 &&+ plan.key_slots.every((s) =>+ startable.some((p) => primarySlot(p) === s.slot && slotEffective(p)),+ )+ );+}++/** A plan's label in the UI language, falling back to the catalog's own. */+export function planText(+ t: (key: string) => string,+ plan: StarterPlan,+ field: "label" | "summary",+): string {+ const key = `first_run.brain.plans.${plan.id.replace(/-/g, "_")}_${field}`;+ const translated = t(key);+ return translated === key ? plan[field] : translated;+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/primitives.tsx b/jarvis/ui/web/frontend/src/components/onboarding/primitives.tsxdeleted file mode 100644index 92bac70bf5..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/primitives.tsx+++ /dev/null@@ -1,254 +0,0 @@-import { ArrowLeft, ArrowRight, Loader2 } from "lucide-react";-import type { ReactNode } from "react";-import { Button, FOCUS_RING, SectionLabel } from "@/components/agentic/controls";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";--/**- * The first-run guide speaks the workspace launcher's language: hairlines and- * type do the structuring, numbers sit in a mono register, and yellow is- * reserved for the choice you made and the one action that moves you on.- * These are the handful of shapes every step is built from, so the six- * screens read as one document rather than six dialogs.- */--/** A labelled block: eyebrow on top, hairline-separated content below. */-export function StepSection({- label,- children,- className,-}: {- label: string;- children: ReactNode;- className?: string;-}) {- return (- <section className={cn("space-y-3", className)}>- <SectionLabel>{label}</SectionLabel>- {children}- </section>- );-}--/**- * A numbered register — the same `01 / 02` list the launcher uses for its- * terminal plan. Rows are separated by rules, never boxed.- */-export function Register({- items,- className,-}: {- items: { key: string; icon?: ReactNode; children: ReactNode }[];- className?: string;-}) {- return (- <ol className={cn("border-y border-border/70", className)}>- {items.map((item, index) => (- <li- key={item.key}- className="grid grid-cols-[2.25rem_minmax(0,1fr)] items-baseline gap-2 border-b border-border/50 py-3 text-lg last:border-b-0"- >- <span className="font-mono text-xs tabular-nums text-muted-foreground/70">- {(index + 1).toString().padStart(2, "0")}- </span>- <span className="flex min-w-0 items-start gap-2.5">- {item.icon ? (- <span className="mt-0.5 shrink-0 text-muted-foreground" aria-hidden>- {item.icon}- </span>- ) : null}- <span className="min-w-0 leading-relaxed">{item.children}</span>- </span>- </li>- ))}- </ol>- );-}--/**- * A selectable row. Selection is a gold edge and a faint gold wash plus a- * small "SELECTED" tag — the launcher's card-selection idiom — so the state- * is legible without filling the whole row.- */-export function ChoiceRow({- selected,- title,- body,- onSelect,- testId,- badge,- meta,-}: {- selected: boolean;- title: string;- body: string;- onSelect: () => void;- testId?: string;- /** A short gold tag after the title ("Recommended"). */- badge?: string | null;- /** Small mono facts on the right ("1 key · Pipeline"). */- meta?: ReactNode;-}) {- const t = useT();- return (- <button- type="button"- role="radio"- aria-checked={selected}- data-testid={testId}- onClick={onSelect}- className={cn(- "flex w-full items-start justify-between gap-4 rounded-control border px-5 py-4 text-left transition-colors",- FOCUS_RING,- selected- ? "border-primary/70 bg-primary/[0.04]"- : "border-border/70 hover:border-border hover:bg-secondary/40",- )}- >- <span className="min-w-0">- <span className="flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5">- <span className="text-base font-medium text-foreground">{title}</span>- {badge ? (- <span className="text-micro font-semibold uppercase tracking-[0.14em] text-primary">- {badge}- </span>- ) : null}- </span>- <span className="mt-1 block text-sm leading-relaxed text-muted-foreground">{body}</span>- </span>- <span className="flex shrink-0 flex-col items-end gap-1.5 pt-0.5">- {selected ? (- <span className="text-micro font-semibold uppercase tracking-[0.14em] text-primary">- {t("onboarding.wake_word.selected")}- </span>- ) : null}- {meta ? (- <span className="font-mono text-xs uppercase tracking-[0.12em] text-muted-foreground">- {meta}- </span>- ) : null}- </span>- </button>- );-}--/** A checkbox that reads as one line of a document, not a form control. */-export function ConsentLine({- checked,- onChange,- children,- testId,-}: {- checked: boolean;- onChange: (next: boolean) => void;- children: ReactNode;- testId?: string;-}) {- return (- <label className="flex cursor-pointer items-start gap-3 py-1 text-lg leading-relaxed">- <input- type="checkbox"- data-testid={testId}- className={cn("mt-1 h-4 w-4 shrink-0 accent-primary", FOCUS_RING)}- checked={checked}- onChange={(e) => onChange(e.target.checked)}- />- <span>{children}</span>- </label>- );-}--/**- * One tone-carrying line: a coloured left edge, no fill, no icon — the- * launcher's `Notice`, with a success tone added because a saved key or a- * clear microphone are things the guide wants to confirm in place.- */-export function StatusLine({- tone,- children,- testId,-}: {- tone: "ok" | "warning" | "error" | "muted";- children: ReactNode;- testId?: string;-}) {- return (- <p- data-testid={testId}- className={cn(- "border-l-2 py-1 pl-3 text-sm leading-relaxed",- tone === "ok" && "border-muted-foreground/70 text-muted-foreground",- tone === "warning" && "border-foreground/70 text-foreground",- tone === "error" && "border-destructive/70 text-destructive",- tone === "muted" && "border-border text-muted-foreground",- )}- >- {children}- </p>- );-}--export interface FooterAction {- label: string;- onClick: () => void;- disabled?: boolean;- busy?: boolean;- testId?: string;-}--/**- * The step footer: a rule, Back on the left, the one primary action on the- * right, with an optional quiet secondary beside it. Every step ends here so- * the eye always knows where "go on" lives.- */-export function StepFooter({- onBack,- primary,- secondary,- backLabel,- hidePrimaryArrow,-}: {- onBack?: (() => void) | null;- primary: FooterAction;- secondary?: FooterAction | null;- backLabel?: string;- hidePrimaryArrow?: boolean;-}) {- const t = useT();- return (- <footer className="mt-10 flex min-h-10 flex-wrap items-center justify-between gap-3 border-t border-border/70 pt-6">- {onBack ? (- <Button variant="subtle" onClick={onBack} data-testid="onboarding-back">- <ArrowLeft className="h-3.5 w-3.5" />- {backLabel ?? t("onboarding.nav.back")}- </Button>- ) : (- <span />- )}- <div className="flex flex-wrap items-center gap-2">- {secondary ? (- <Button- variant="subtle"- onClick={secondary.onClick}- disabled={secondary.disabled || secondary.busy}- data-testid={secondary.testId}- >- {secondary.busy && <Loader2 className="h-3.5 w-3.5 animate-spin" />}- {secondary.label}- </Button>- ) : null}- <Button- variant="primary"- className="h-10 min-w-40 px-5 text-lg"- onClick={primary.onClick}- disabled={primary.disabled || primary.busy}- data-testid={primary.testId ?? "onboarding-primary"}- >- {primary.busy && <Loader2 className="h-3.5 w-3.5 animate-spin" />}- {primary.label}- {!primary.busy && !hidePrimaryArrow && <ArrowRight className="h-3.5 w-3.5" />}- </Button>- </div>- </footer>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.test.tsxdeleted file mode 100644index 0f49dc2d91..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.test.tsx+++ /dev/null@@ -1,364 +0,0 @@-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { afterEach, expect, it, vi } from "vitest";-import type { ProviderDescriptor } from "@/hooks/useProviders";--vi.mock("@/i18n", () => ({ useT: () => (key: string) => key }));--const providersState = vi.hoisted(() => ({- providers: [] as unknown[],- loading: false,- error: null as string | null,- refetch: vi.fn(),- // Mirrors the real helper's wire shape so the local-path test can assert- // the request the backend would see.- switchBrainProvider: vi.fn(async (provider: string) => {- await fetch("/api/brain/switch", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ provider }),- });- }),- switchSubagentProvider: vi.fn(async (provider: string) => {- await fetch("/api/jarvis-agent/switch", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ provider, persist: true }),- });- }),-}));-vi.mock("@/hooks/useProviders", () => ({- useProviders: () => ({- providers: providersState.providers,- loading: providersState.loading,- error: providersState.error,- refetch: providersState.refetch,- }),- switchBrainProvider: providersState.switchBrainProvider,- switchSubagentProvider: providersState.switchSubagentProvider,-}));-// The real form is exercised by its own tests; here it is a probe that-// reports which slot it was mounted for and lets a test "save" a key.-vi.mock("@/components/ApiKeyForm", () => ({- ApiKeyForm: (p: { secretKey: string; onSavedActivate?: () => void }) => (- <div data-testid={`form-${p.secretKey}`}>- <button onClick={() => p.onSavedActivate?.()}>saved</button>- </div>- ),-}));-// Starter plans: the catalog a test hands in, plus spies on select/apply.-const plansState = vi.hoisted(() => ({- plans: [] as unknown[],- selected: null as string | null,- fail: false,- selectStarterPlan: vi.fn(async () => undefined),- applyStarterPlan: vi.fn(async () => ({ applied: ["brain"], failed: [] as { surface: string; error: string }[], modeSet: true })),-}));-vi.mock("@/hooks/useStarterPlans", () => ({- getStarterPlans: async () => {- if (plansState.fail) throw new Error("HTTP 404");- return { plans: plansState.plans, selected: plansState.selected, custom_id: "custom" };- },- selectStarterPlan: plansState.selectStarterPlan,- applyStarterPlan: plansState.applyStarterPlan,-}));-vi.mock("@/components/ReadyCelebration", () => ({- ReadyCelebration: () => <div data-testid="ready-celebration-stub" />,-}));-vi.mock("@/components/JarvisAgentSection", () => ({- JarvisAgentSection: () => <div data-testid="agent-connection-options" />,-}));--import { ApiKeysStep, planKeysComplete, providersForPlan, startableProviders } from "./ApiKeysStep";--const GEMINI_PLAN = {- id: "gemini-live",- label: "Gemini Live",- summary: "One key.",- mode: "realtime" as const,- recommended: true,- assignments: { brain: "gemini", realtime: "gemini-live" },- key_slots: [{ family: "gemini", slot: "gemini_api_key", label: "Google Gemini", present: false }],- keys_complete: false,- ready_sections: ["realtime", "computer-use", "subagents"],-};--afterEach(() => {- cleanup();- vi.unstubAllGlobals();- providersState.providers = [];- providersState.loading = false;- providersState.error = null;- providersState.refetch.mockClear();- providersState.switchBrainProvider.mockClear();- providersState.switchSubagentProvider.mockClear();- plansState.plans = [];- plansState.selected = null;- plansState.fail = true;- plansState.selectStarterPlan.mockClear();- plansState.applyStarterPlan.mockClear();-});--// The legacy tests below describe the "custom" path: no plan catalog.-plansState.fail = true;--function provider(overrides: Partial<ProviderDescriptor>): ProviderDescriptor {- return {- id: "x",- label: "X",- tier: "brain",- auth_mode: "api_key",- secret_keys: ["X_API_KEY"],- secrets_set: { X_API_KEY: false },- dashboard_url: "https://x.example/keys",- login_cli: null,- install_hint: null,- credential_path_hint: null,- configured: false,- active: false,- cli_installed: null,- credential_help: null,- signup_url: null,- billing: "api",- ...overrides,- } as ProviderDescriptor;-}--type ProbeShape = { source: string; models: { id: string }[] } | null;--/** Stub fetch for the local-path probe (+ the brain switch and the engine pin). */-function stubFetch(probe: ProbeShape, agentReady = false) {- const calls: { url: string; init?: RequestInit }[] = [];- vi.stubGlobal(- "fetch",- vi.fn(async (url: string, init?: RequestInit) => {- calls.push({ url, init });- if (url === "/api/providers/ollama/models") {- if (probe === null) throw new Error("network down");- return { ok: true, json: async () => probe } as Response;- }- if (url === "/api/jarvis-agent/status") {- return { ok: true, json: async () => ({ mapping: [- { jarvis: "gemini", label: "Google Gemini", billing: "api", secret_key: "agent_gemini_key", is_active_brain: true, dedicated_key_set: agentReady },- { jarvis: "openai", label: "OpenAI", billing: "api", secret_key: "agent_openai_key", is_active_brain: false, dedicated_key_set: false },- ] }) } as Response;- }- if (url === "/api/brain/switch" || url === "/api/settings/voice-mode" || url === "/api/jarvis-agent/switch") {- return { ok: true, json: async () => ({ ok: true }) } as Response;- }- throw new Error(`unexpected fetch: ${url}`);- }),- );- return calls;-}--function renderStep(overrides: Record<string, unknown> = {}) {- const props = {- onb: {} as never,- goNext: vi.fn(),- goBack: vi.fn(),- skip: vi.fn(),- isFirst: false,- isLast: false,- setSummary: vi.fn(),- setGap: vi.fn(),- gaps: {},- summaries: {},- ...overrides,- };- render(<ApiKeysStep {...props} />);- return props;-}--it("startableProviders keeps key-based brain providers, recommended first", () => {- const list = startableProviders([- provider({ id: "b", label: "B" }),- provider({ id: "tts", tier: "tts" }),- provider({ id: "cli", auth_mode: "codex" }),- provider({ id: "a", label: "A", recommended: true }),- provider({ id: "nokey", secret_keys: [] }),- ]);- expect(list.map((p) => p.id)).toEqual(["a", "b"]);-});--it("renders the catalog as a register, opens the first row's form, and lets a saved key continue", async () => {- providersState.providers = [- provider({ id: "openrouter", label: "OpenRouter", recommended: true, secret_keys: ["OPENROUTER_API_KEY"], secrets_set: { OPENROUTER_API_KEY: false } }),- provider({ id: "b", label: "B" }),- ];- stubFetch(null);- const props = renderStep();-- expect(screen.getByTestId("onboarding-provider-openrouter")).toBeDefined();- expect(screen.getByTestId("form-OPENROUTER_API_KEY")).toBeDefined();- expect(screen.queryByTestId("form-X_API_KEY")).toBeNull();- const next = screen.getByTestId("onboarding-primary") as HTMLButtonElement;- expect(next.disabled).toBe(true);- expect(screen.getByTestId("onboarding-keys-later")).toBeDefined();-- // Saving through the form makes that provider the active brain when none is.- fireEvent.click(screen.getByText("saved"));- await waitFor(() =>- expect(providersState.switchBrainProvider).toHaveBeenCalledWith("openrouter"),- );-- // The catalog refresh now reports the key — Continue opens up.- providersState.providers = [- provider({ id: "openrouter", label: "OpenRouter", recommended: true, secret_keys: ["OPENROUTER_API_KEY"], secrets_set: { OPENROUTER_API_KEY: true }, configured: true }),- ];- cleanup();- const again = renderStep();- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false);- expect(again.setSummary).toHaveBeenLastCalledWith("OpenRouter");- expect(props.skip).not.toHaveBeenCalled();-});--it("'later' skips honestly, and the summary stays empty", async () => {- providersState.providers = [provider({ id: "b", label: "B" })];- stubFetch(null);- const props = renderStep();- await screen.findByText("onboarding.api_keys.local_missing");- fireEvent.click(screen.getByTestId("onboarding-keys-later"));- expect(props.skip).toHaveBeenCalledTimes(1);- expect(props.setSummary).toHaveBeenLastCalledWith(null);-});--it("a failed catalog load says so and still offers the local path", async () => {- providersState.error = "HTTP 503";- stubFetch(null);- renderStep();- expect(screen.getByText("onboarding.api_keys.load_failed")).toBeDefined();- await screen.findByText("onboarding.api_keys.local_missing");-});--it("probes through the backend, activates local, pins pipeline, and unlocks Continue", async () => {- const calls = stubFetch({ source: "live", models: [{ id: "qwen3.5:9b" }] });- const props = renderStep();-- await screen.findByText("onboarding.api_keys.local_detected");- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);- fireEvent.click(screen.getByRole("button", { name: "onboarding.api_keys.local_use_button" }));-- await screen.findByTestId("local-active");- const switchCall = calls.find((c) => c.url === "/api/brain/switch");- expect(JSON.parse(String(switchCall?.init?.body))).toMatchObject({ provider: "ollama" });- const modeCall = calls.find((c) => c.url === "/api/settings/voice-mode");- expect(modeCall?.init?.method).toBe("PUT");- expect(JSON.parse(String(modeCall?.init?.body))).toMatchObject({ mode: "pipeline" });- // The probe went through the backend catalog route — never a- // browser-direct localhost:11434 call.- expect(calls[0].url).toBe("/api/providers/ollama/models");- expect(window.localStorage.getItem("jarvis.providers.localMode")).toBe("1");-- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false);- expect(props.setSummary).toHaveBeenLastCalledWith("onboarding.api_keys.summary_local");-});--it("providersForPlan keeps only the cards whose primary slot the plan needs", () => {- const gemini = provider({ id: "gemini", label: "Google Gemini", secret_keys: ["gemini_api_key"], secrets_set: { gemini_api_key: false } });- const other = provider({ id: "b", label: "B" });- expect(providersForPlan(GEMINI_PLAN, [gemini, other]).map((p) => p.id)).toEqual(["gemini"]);- expect(providersForPlan(null, [gemini, other]).map((p) => p.id)).toEqual(["gemini", "b"]);- expect(planKeysComplete(GEMINI_PLAN, [gemini, other])).toBe(false);- const saved = { ...gemini, secrets_set: { gemini_api_key: true } };- expect(planKeysComplete(GEMINI_PLAN, [saved, other])).toBe(true);-});--it("preselects the recommended plan, filters the list to its key, and applies the plan once the key is in", async () => {- plansState.fail = false;- plansState.plans = [GEMINI_PLAN];- providersState.providers = [- provider({ id: "gemini", label: "Google Gemini", secret_keys: ["gemini_api_key"], secrets_set: { gemini_api_key: false } }),- provider({ id: "b", label: "B" }),- ];- stubFetch(null, true);- renderStep();-- const row = await screen.findByTestId("onboarding-plan-gemini-live");- expect(row.getAttribute("aria-checked")).toBe("true");- await waitFor(() => expect(screen.getByTestId("form-gemini_api_key")).toBeDefined());- expect(screen.queryByTestId("form-X_API_KEY")).toBeNull();- expect(plansState.applyStarterPlan).not.toHaveBeenCalled();-- // The catalog refresh reports the key — the plan is applied without any- // further click, and the brain auto-switch stays out of the plan's way.- providersState.providers = [- provider({ id: "gemini", label: "Google Gemini", secret_keys: ["gemini_api_key"], secrets_set: { gemini_api_key: true }, configured: true }),- ];- cleanup();- const props = renderStep();- await screen.findByTestId("onboarding-plan-applied");- expect(plansState.applyStarterPlan).toHaveBeenCalledTimes(1);- expect(plansState.selectStarterPlan).toHaveBeenCalledWith("gemini-live");- expect(screen.getByTestId("ready-celebration-stub")).toBeDefined();- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false);- // The i18n mock echoes keys, so the plan label falls back to the catalog text.- expect(props.setSummary).toHaveBeenLastCalledWith("Gemini Live · Google Gemini");-});--it("'pick everything myself' restores the full list and the local path", async () => {- plansState.fail = false;- plansState.plans = [GEMINI_PLAN];- providersState.providers = [- provider({ id: "gemini", label: "Google Gemini", secret_keys: ["gemini_api_key"], secrets_set: { gemini_api_key: false } }),- provider({ id: "b", label: "B" }),- ];- stubFetch(null);- renderStep();- await screen.findByTestId("onboarding-plan-custom");- expect(screen.queryByText("onboarding.api_keys.local_title")).toBeNull();- fireEvent.click(screen.getByTestId("onboarding-plan-custom"));- await waitFor(() => expect(screen.getByTestId("onboarding-provider-b")).toBeDefined());- expect(screen.getByText("onboarding.api_keys.local_title")).toBeDefined();- expect(plansState.selectStarterPlan).toHaveBeenCalledWith("custom");-});--it("with Ollama running but empty, explains the missing model and shows no activate button", async () => {- stubFetch({ source: "live", models: [] });- renderStep();- await screen.findByText("onboarding.api_keys.local_detected_empty");- expect(screen.queryByRole("button", { name: "onboarding.api_keys.local_use_button" })).toBeNull();-});--it("shows subscription and API-key choices together for Jarvis Agents", async () => {- plansState.fail = false;- plansState.plans = [GEMINI_PLAN];- providersState.providers = [- provider({ id: "gemini", label: "Google Gemini", secret_keys: ["gemini_api_key"], secrets_set: { gemini_api_key: true }, configured: true }),- ];- stubFetch(null);- const p = renderStep();- await screen.findByTestId("onboarding-plan-gemini-live");- await waitFor(() => expect(p.setGap).toHaveBeenLastCalledWith("onboarding.api_keys.gap_agents"));- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);- expect(screen.getByTestId("onboarding-agent-subscriptions")).toBeDefined();- expect(screen.getByTestId("agent-connection-options")).toBeDefined();- expect(screen.getByTestId("onboarding-agent-key-gemini")).toBeDefined();- expect(screen.getByTestId("onboarding-agent-key-openai")).toBeDefined();- expect(screen.getByTestId("form-agent_gemini_key")).toBeDefined();- fireEvent.click(screen.getByTestId("onboarding-agent-key-openai"));- expect(screen.getByTestId("form-agent_openai_key")).toBeDefined();- fireEvent.click(screen.getByTestId("form-agent_openai_key").querySelector("button")!);- await waitFor(() => expect(providersState.switchSubagentProvider).toHaveBeenCalledWith("openai"));-- cleanup();- stubFetch(null, true);- const again = renderStep();- await waitFor(() => expect(again.setGap).toHaveBeenLastCalledWith(null));- await waitFor(() => expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false));-});--it("does not mark a failed live activation ready", async () => {- plansState.fail = false;- plansState.plans = [GEMINI_PLAN];- plansState.applyStarterPlan.mockResolvedValueOnce({- applied: ["brain"], failed: [{ surface: "realtime", error: "unavailable" }], modeSet: false,- });- providersState.providers = [- provider({ id: "gemini", label: "Google Gemini", secret_keys: ["gemini_api_key"], secrets_set: { gemini_api_key: true }, configured: true }),- ];- stubFetch(null, true);- renderStep();- await screen.findByTestId("onboarding-plan-partial");- expect(screen.queryByTestId("ready-celebration-stub")).toBeNull();- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.tsxdeleted file mode 100644index 9f99fe6741..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/ApiKeysStep.tsx+++ /dev/null@@ -1,636 +0,0 @@-import { useCallback, useEffect, useMemo, useState } from "react";-import { ChevronDown, ExternalLink, Radio, Bot } from "lucide-react";-import { ApiKeyForm } from "@/components/ApiKeyForm";-import { Button, FOCUS_RING } from "@/components/agentic/controls";-import {- switchBrainProvider,- useProviders,- type ProviderDescriptor,-} from "@/hooks/useProviders";-import {- applyStarterPlan,- getStarterPlans,- selectStarterPlan,- type ApplyPlanOutcome,- type StarterPlan,-} from "@/hooks/useStarterPlans";-import { ReadyCelebration } from "@/components/ReadyCelebration";-import { setLocalMode } from "@/lib/localMode";-import { putVoiceMode } from "@/lib/voiceEngineMode";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import type { StepProps } from "../OnboardingFlow";-import { ChoiceRow, StatusLine, StepFooter, StepSection } from "../primitives";-import { AgentAccessList, type AgentAccessRow } from "../AgentAccessList";--/** The "I'll pick everything myself" choice; mirrors the backend's custom id. */-const CUSTOM_PLAN = "custom";--/**- * The providers a plan asks a key for: the brain card whose primary slot is- * the plan's family slot. One key per family (2026-08-24), so one card per- * family is all the plan ever needs to show. Exported for tests.- */-export function providersForPlan(- plan: StarterPlan | null,- startable: ProviderDescriptor[],-): ProviderDescriptor[] {- if (!plan) return startable;- const slots = new Set(plan.key_slots.map((s) => s.slot));- return startable.filter((p) => {- const slot = primarySlot(p);- return slot !== null && slots.has(slot);- });-}--/** Every key the plan needs is saved (dedicated or covered by the family). */-export function planKeysComplete(plan: StarterPlan, startable: ProviderDescriptor[]): boolean {- const cards = providersForPlan(plan, startable);- return (- plan.key_slots.length > 0 &&- plan.key_slots.every((s) => cards.some((p) => primarySlot(p) === s.slot && slotEffective(p)))- );-}--/** How many providers are open before the "show more" fold. */-const FOLD_AFTER = 4;--/** The one slot a card asks for; providers with several keys expose the first. */-function primarySlot(p: ProviderDescriptor): string | null {- return p.secret_keys[0] ?? null;-}--function slotConfigured(p: ProviderDescriptor): boolean {- const slot = primarySlot(p);- if (!slot) return p.configured;- return Boolean(p.secrets_set[slot]);-}--function slotEffective(p: ProviderDescriptor): boolean {- const slot = primarySlot(p);- if (!slot) return p.configured;- return Boolean(p.secrets_effective?.[slot] ?? p.secrets_set[slot]);-}--/**- * The brain providers a first-run user can start with: anything that takes a- * pasted key and can be the primary brain. Recommended ones first, then- * whatever already has a key, then the rest in catalog order. Exported for- * tests.- */-export function startableProviders(providers: ProviderDescriptor[]): ProviderDescriptor[] {- return providers- .filter((p) => p.tier === "brain" && p.auth_mode === "api_key" && p.brain_switchable !== false)- .filter((p) => (p.secret_keys?.length ?? 0) > 0)- .sort((a, b) => {- const ra = a.recommended ? 0 : 1;- const rb = b.recommended ? 0 : 1;- if (ra !== rb) return ra - rb;- const ca = slotConfigured(a) ? 0 : 1;- const cb = slotConfigured(b) ? 0 : 1;- return ca - cb;- });-}--/**- * First-sixty-seconds local path (maintainer amendment 2026-07-25): a- * zero-key user with Ollama running must SEE the local option during- * onboarding, not discover it later in settings. The probe goes through the- * backend catalog route (never a browser-direct localhost:11434 call, which- * CORS would block anyway) and runs once on step mount only (AP-26).- */-function LocalPath({ onActivated }: { onActivated: () => void }) {- const t = useT();- const [probe, setProbe] = useState<"checking" | "reachable" | "empty" | "unreachable">(- "checking",- );- const [activating, setActivating] = useState(false);- const [active, setActive] = useState(false);- const [error, setError] = useState<string | null>(null);-- useEffect(() => {- let cancelled = false;- (async () => {- try {- const res = await fetch("/api/providers/ollama/models");- const data = res.ok ? await res.json() : null;- const live = data?.source === "live" || data?.source === "cache";- const models = Array.isArray(data?.models) ? data.models.length : 0;- if (!cancelled) {- setProbe(live ? (models > 0 ? "reachable" : "empty") : "unreachable");- }- } catch {- if (!cancelled) setProbe("unreachable");- }- })();- return () => {- cancelled = true;- };- }, []);-- async function useLocal() {- setActivating(true);- setError(null);- try {- await switchBrainProvider("ollama");- // Picking the local brain has to pin the PIPELINE engine as well.- // Realtime replaces STT + Brain + TTS with one full-duplex cloud model- // and never consults `[brain].primary`, and `[voice].mode` defaults to- // realtime — so activating the local brain alone left the user on the- // realtime cards with their choice having changed nothing audible.- // Persisted, because onboarding ends in a restart.- await putVoiceMode("pipeline");- // Somebody who picks the local path here lands in a provider console- // whose cards are almost entirely hosted accounts they just declined.- // Local Mode opens it on the handful that need no key. A view preference,- // reversible with one click on the switch in that view's header.- setLocalMode(true);- setActive(true);- onActivated();- } catch (e) {- setError(e instanceof Error ? e.message : String(e));- } finally {- setActivating(false);- }- }-- return (- <StepSection label={t("onboarding.api_keys.local_label")}>- <div className="flex flex-wrap items-start justify-between gap-3 border-y border-border/70 py-3">- <div className="min-w-0 space-y-1">- <p className="text-sm font-medium text-foreground">- {t("onboarding.api_keys.local_title")}- </p>- {probe === "checking" && (- <p className="text-sm text-muted-foreground">- {t("onboarding.api_keys.local_checking")}- </p>- )}- {probe === "reachable" && !active && (- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.api_keys.local_detected")}- </p>- )}- {probe === "reachable" && active && (- <StatusLine tone="ok" testId="local-active">- {t("onboarding.api_keys.local_active")}- </StatusLine>- )}- {probe === "empty" && (- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.api_keys.local_detected_empty")}- </p>- )}- {probe === "unreachable" && (- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.api_keys.local_missing")}{" "}- <a- href="https://ollama.com/download"- target="_blank"- rel="noreferrer"- className="inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline"- >- {t("onboarding.api_keys.local_missing_link")}- <ExternalLink className="h-3 w-3" />- </a>- </p>- )}- {error && <StatusLine tone="error">{error}</StatusLine>}- </div>- {probe === "reachable" && !active && (- <Button variant="quiet" onClick={() => void useLocal()} disabled={activating}>- {t("onboarding.api_keys.local_use_button")}- </Button>- )}- </div>- </StepSection>- );-}--/**- * Real key entry on the first run. Each provider is a row of a hairline- * register — number, name, a "Recommended" tag where the catalog says so, and- * a status word. Opening a row reveals the same `ApiKeyForm` the API Keys- * view uses (format recognition, saved state, dashboard link), so what the- * user learns here is exactly what they will find later. Saving the first- * key also makes that provider the active brain when none is yet — the- * point of this step is that chat works the moment the guide ends.- *- * The list is driven by the backend catalog, so a catalog with one provider- * renders one row and nothing here changes.- */-export function ApiKeysStep({ goNext, goBack, skip, setSummary, setGap }: StepProps) {- const t = useT();- const { providers, loading, error, refetch } = useProviders();- const [open, setOpen] = useState<string | null>(null);- const [expanded, setExpanded] = useState(false);- const [localActive, setLocalActive] = useState(false);- const [agentRows, setAgentRows] = useState<AgentAccessRow[] | null>(null);-- // Starter plans: "one key and you are done". The recommended plan is- // preselected; "custom" shows the whole catalog exactly as before.- const [plans, setPlans] = useState<StarterPlan[]>([]);- const [planId, setPlanId] = useState<string | null>(null);- const [applying, setApplying] = useState(false);- const [applied, setApplied] = useState<{ id: string; outcome: ApplyPlanOutcome } | null>(null);-- useEffect(() => {- let cancelled = false;- (async () => {- try {- const res = await getStarterPlans();- if (cancelled) return;- setPlans(res.plans);- setPlanId(- (current) =>- current ?? (res.plans.some((p) => p.id === res.selected) ? res.selected : null) ??- res.plans.find((p) => p.recommended)?.id ?? CUSTOM_PLAN,- );- } catch {- // No plan catalog (older backend) — the full list still works.- if (!cancelled) setPlanId((current) => current ?? CUSTOM_PLAN);- }- })();- return () => {- cancelled = true;- };- }, []);-- const plan = useMemo(- () => (planId && planId !== CUSTOM_PLAN ? (plans.find((p) => p.id === planId) ?? null) : null),- [plans, planId],- );-- const allStartable = useMemo(() => startableProviders(providers), [providers]);- const startable = useMemo(() => providersForPlan(plan, allStartable), [plan, allStartable]);- const visible = expanded || plan ? startable : startable.slice(0, FOLD_AFTER);- const hidden = startable.length - visible.length;-- const configured = startable.filter(slotEffective);- const hasKey = configured.length > 0;- const planComplete = plan ? planKeysComplete(plan, allStartable) : false;- const planApplied = Boolean(plan && applied?.id === plan.id && applied.outcome.modeSet && applied.outcome.failed.length === 0);-- const refreshAgentRows = useCallback(async () => {- try {- const response = await fetch("/api/jarvis-agent/status", { cache: "no-store" });- if (!response.ok) throw new Error(`HTTP ${response.status}`);- const status = await response.json() as { mapping?: AgentAccessRow[] };- setAgentRows(Array.isArray(status.mapping) ? status.mapping : []);- } catch {- setAgentRows([]);- }- }, []);- const agentReady = Boolean(agentRows?.some((row) =>- row.is_active_brain && (row.dedicated_key_set || row.oauth_connected || row.keyless),- ));-- useEffect(() => {- void refreshAgentRows();- const timer = window.setInterval(() => void refreshAgentRows(), 3000);- window.addEventListener("jarvis:agent-switched", refreshAgentRows);- window.addEventListener("jarvis:secret-configured", refreshAgentRows);- return () => {- window.clearInterval(timer);- window.removeEventListener("jarvis:agent-switched", refreshAgentRows);- window.removeEventListener("jarvis:secret-configured", refreshAgentRows);- };- }, [refreshAgentRows]);-- // Once the live key is saved, point voice and its thinking model at it. Agent- // access remains a separate choice below. Runs- // once per plan; a re-render never re-applies.- useEffect(() => {- if (!plan || !planComplete || applying || applied?.id === plan.id) return;- let cancelled = false;- setApplying(true);- (async () => {- try {- await selectStarterPlan(plan.id).catch(() => undefined);- const outcome = await applyStarterPlan(plan);- if (!cancelled) setApplied({ id: plan.id, outcome });- } finally {- if (!cancelled) setApplying(false);- void refetch();- }- })();- return () => {- cancelled = true;- };- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [plan?.id, planComplete]);-- useEffect(() => {- if (plan && planApplied) {- setSummary(`${planLabel(plan)} · ${configured.map((p) => p.label).join(" · ")}`);- } else if (hasKey) {- setSummary(configured.map((p) => p.label).join(" · "));- } else if (localActive) {- setSummary(t("onboarding.api_keys.summary_local"));- } else {- setSummary(null);- }- // configured is derived from startable; its labels are what we render.- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [hasKey, localActive, planApplied, configured.map((p) => p.id).join(","), setSummary, t]);-- // Report missing live and agent credentials separately to the finish step.- useEffect(() => {- if (plan && !planComplete) {- const missing = plan.key_slots- .filter((s) => !allStartable.some((p) => primarySlot(p) === s.slot && slotEffective(p)))- .map((s) => s.label);- if (missing.length === plan.key_slots.length) {- setGap(t("onboarding.api_keys.gap_none"));- } else {- setGap(- t("onboarding.api_keys.gap_plan_partial")- .replace("{0}", planLabel(plan))- .replace("{1}", missing.join(", ")),- );- }- } else if (plan && applied?.id === plan.id && applied.outcome.failed.length > 0) {- setGap(t("onboarding.api_keys.plan_partial").replace("{0}", applied.outcome.failed.map((f) => f.surface).join(", ")));- } else if (plan && !agentReady) {- setGap(t("onboarding.api_keys.gap_agents"));- } else if (!hasKey && !localActive) {- setGap(t("onboarding.api_keys.gap_none"));- } else if (!plan && hasKey) {- setGap(t("onboarding.api_keys.gap_custom"));- } else {- setGap(null);- }- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [plan?.id, planComplete, applied, hasKey, agentReady, localActive, configured.map((p) => p.id).join(","), setGap, t]);-- // Open the first row by default so a fresh install shows an input, not a- // list of closed doors. Once anything is configured, everything stays shut.- useEffect(() => {- if (open === null && startable.length > 0 && !hasKey) setOpen(startable[0].id);- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [startable.length, hasKey]);-- function planLabel(p: StarterPlan): string {- const key = `onboarding.plans.${p.id.replace(/-/g, "_")}_label`;- const translated = t(key);- return translated === key ? p.label : translated;- }- function planSummary(p: StarterPlan): string {- const key = `onboarding.plans.${p.id.replace(/-/g, "_")}_summary`;- const translated = t(key);- return translated === key ? p.summary : translated;- }-- async function choosePlan(id: string) {- setPlanId(id);- setOpen(null);- await selectStarterPlan(id).catch(() => undefined);- }-- const activateIfNone = (p: ProviderDescriptor) => {- const anyActive = startable.some((q) => q.active);- if (anyActive) return;- void switchBrainProvider(p.id)- .then(() => refetch())- .catch(() => {- // The key is saved either way; the provider console remains the- // recovery path for choosing the active brain.- });- };-- const canContinue = (plan ? planComplete && agentReady && planApplied && applied?.outcome.failed.length === 0 : hasKey) || localActive;-- return (- <div className="space-y-6">- {plans.length > 0 && (- <StepSection label={t("onboarding.api_keys.voice_label")}>- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.api_keys.plan_explainer")}- </p>- <div className="mt-3 grid gap-2 sm:grid-cols-2" role="radiogroup" data-testid="onboarding-plan-picker">- {plans.map((p) => {- return (- <ChoiceRow- key={p.id}- selected={planId === p.id}- title={planLabel(p)}- badge={p.recommended ? t("onboarding.api_keys.recommended") : null}- body={planSummary(p)}- meta={t("onboarding.api_keys.mode_realtime")}- onSelect={() => void choosePlan(p.id)}- testId={`onboarding-plan-${p.id}`}- />- );- })}- </div>- </StepSection>- )}-- <StepSection- label={- plan- ? t("onboarding.api_keys.voice_key_label")- : t("onboarding.api_keys.providers_label")- }- >- {plan && <p className="mb-2 flex items-center gap-2 text-sm text-muted-foreground"><Radio className="h-4 w-4" />{t("onboarding.api_keys.voice_key_hint")}</p>}- {loading && startable.length === 0 ? (- <p className="text-sm text-muted-foreground">{t("onboarding.api_keys.loading")}</p>- ) : error && startable.length === 0 ? (- <StatusLine tone="warning">{t("onboarding.api_keys.load_failed")}</StatusLine>- ) : (- <>- {plan && startable[0] && (() => {- const p = startable[0];- const slot = primarySlot(p);- return slot ? (- <div className="rounded-xl border border-border bg-card p-4" data-testid="onboarding-live-key">- <div className="mb-3 flex items-center justify-between gap-3">- <span className="text-sm font-semibold text-foreground">{p.label}</span>- <span className="text-xs text-muted-foreground">{slotEffective(p) ? t("onboarding.api_keys.configured") : t("onboarding.api_keys.not_configured")}</span>- </div>- <ApiKeyForm- secretKey={slot}- dashboardUrl={p.dashboard_url}- configured={slotConfigured(p)}- effectiveConfigured={slotEffective(p)}- credentialHelp={p.credential_help}- coveredNote={p.credential_note ?? null}- sharedWith={p.secret_shared_with?.[slot] ?? []}- testAfterSave={{ id: p.id, label: p.label, section: p.tier, active: p.active }}- onChanged={() => void refetch()}- />- </div>- ) : null;- })()}- {!plan && <ol className="border-y border-border/70" data-testid="onboarding-provider-list">- {visible.map((p, index) => {- const isOpen = open === p.id;- const slot = primarySlot(p);- const saved = slotConfigured(p);- const effective = slotEffective(p);- return (- <li key={p.id} className="border-b border-border/50 last:border-b-0">- <button- type="button"- aria-expanded={isOpen}- data-testid={`onboarding-provider-${p.id}`}- onClick={() => setOpen(isOpen ? null : p.id)}- className={cn(- "grid w-full grid-cols-[2rem_minmax(0,1fr)_auto_1rem] items-center gap-2 py-3 text-left",- FOCUS_RING,- )}- >- <span className="font-mono text-micro tabular-nums text-muted-foreground/70">- {(index + 1).toString().padStart(2, "0")}- </span>- <span className="flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-0.5">- <span className="text-sm font-medium text-foreground">{p.label}</span>- {p.recommended && (- <span className="text-micro font-semibold uppercase tracking-[0.14em] text-primary">- {t("onboarding.api_keys.recommended")}- </span>- )}- </span>- <span className="flex items-center gap-2 font-mono text-micro uppercase tracking-[0.12em] text-muted-foreground">- <span- aria-hidden- className={cn(- "h-[7px] w-[7px] rounded-full",- effective ? "bg-muted-foreground" : "bg-muted-foreground/40",- )}- />- {p.active- ? t("onboarding.api_keys.active")- : effective- ? t("onboarding.api_keys.configured")- : t("onboarding.api_keys.not_configured")}- </span>- <ChevronDown- aria-hidden- className={cn(- "h-3.5 w-3.5 text-muted-foreground transition-transform",- isOpen && "rotate-180",- )}- />- </button>- {isOpen && slot && (- <div className="space-y-2 pb-4 pl-10 pr-2">- <ApiKeyForm- secretKey={slot}- dashboardUrl={p.dashboard_url}- configured={saved}- effectiveConfigured={effective}- credentialHelp={p.credential_help}- coveredNote={p.credential_note ?? null}- sharedWith={p.secret_shared_with?.[slot] ?? []}- testAfterSave={{- id: p.id,- label: p.label,- section: p.tier,- active: p.active,- }}- onChanged={() => void refetch()}- onSavedActivate={() => {- // A plan takes over activation for every surface.- if (!plan) activateIfNone(p);- }}- />- </div>- )}- </li>- );- })}- </ol>}- </>- )}- {hidden > 0 && !expanded && (- <button- type="button"- className="text-sm text-muted-foreground underline underline-offset-4 hover:text-foreground"- onClick={() => setExpanded(true)}- >- {t("onboarding.api_keys.show_more").replace("{0}", String(hidden))}- </button>- )}- {expanded && startable.length > FOLD_AFTER && (- <button- type="button"- className="text-sm text-muted-foreground underline underline-offset-4 hover:text-foreground"- onClick={() => setExpanded(false)}- >- {t("onboarding.api_keys.show_less")}- </button>- )}- {plan && applying && (- <StatusLine tone="muted" testId="onboarding-plan-applying">- {t("onboarding.api_keys.plan_applying").replace("{0}", planLabel(plan))}- </StatusLine>- )}- {plan && planApplied && applied && applied.outcome.failed.length === 0 && (- <StatusLine tone="ok" testId="onboarding-plan-applied">- {t("onboarding.api_keys.plan_applied").replace("{0}", planLabel(plan))}- </StatusLine>- )}- {plan && applied?.id === plan.id && applied.outcome.failed.length > 0 && (- <StatusLine tone="warning" testId="onboarding-plan-partial">- {t("onboarding.api_keys.plan_partial").replace(- "{0}",- applied.outcome.failed.map((f) => `${f.surface}: ${f.error}`).join(" · "),- )}- </StatusLine>- )}- {plan && planApplied && <ReadyCelebration inline />}- </StepSection>-- {plan && (- <StepSection label={t("onboarding.api_keys.agents_label")}>- <div className="space-y-4">- <div className="flex items-start gap-3">- <Bot className="mt-0.5 h-5 w-5 shrink-0 text-primary" />- <div>- <p className="text-sm font-semibold text-foreground">{t("onboarding.api_keys.agents_title")}</p>- <p className="mt-1 text-sm leading-relaxed text-muted-foreground">{t("onboarding.api_keys.agents_hint")}</p>- <p className="mt-2 text-xs text-muted-foreground" data-testid="onboarding-agent-status">- {agentReady ? t("onboarding.api_keys.agents_ready") : t("onboarding.api_keys.agents_missing")}- </p>- </div>- </div>- <AgentAccessList rows={agentRows} onChanged={refreshAgentRows} />- </div>- </StepSection>- )}-- {plans.length > 0 && <button type="button" data-testid="onboarding-plan-custom" className="text-xs text-muted-foreground underline underline-offset-4 hover:text-foreground" onClick={() => void choosePlan(CUSTOM_PLAN)}>{t("onboarding.api_keys.plan_custom_title")}</button>}-- {!plan && <LocalPath onActivated={() => setLocalActive(true)} />}-- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.api_keys.security_note")}- </p>-- <StepFooter- onBack={goBack}- primary={{- label: t("onboarding.nav.next"),- onClick: goNext,- disabled: !canContinue,- }}- secondary={- canContinue- ? null- : {- label: t("onboarding.api_keys.later"),- onClick: skip,- testId: "onboarding-keys-later",- }- }- />- {!canContinue && (- <p className="mt-2 text-right text-xs text-muted-foreground">- {t("onboarding.api_keys.later_hint")}- </p>- )}- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsxdeleted file mode 100644index 821fab8938..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.test.tsx+++ /dev/null@@ -1,156 +0,0 @@-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { afterEach, beforeEach, expect, it, vi } from "vitest";-vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));-import { FinishStep } from "./FinishStep";--// Default stub: capability probe answers "unsupported" so the tests exercise-// the step without the autostart toggle.-beforeEach(() => {- vi.stubGlobal(- "fetch",- vi.fn().mockResolvedValue({- ok: true,- json: () => Promise.resolve({ enabled: false, supported: false }),- }),- );-});-afterEach(() => {- cleanup();- vi.restoreAllMocks();-});--const STEPS = ["welcome", "language", "api-keys", "permissions", "wake-word", "finish"];--function props(overrides: Record<string, unknown> = {}) {- return {- onb: {- state: { skipped_steps: [], steps: STEPS },- complete: vi.fn().mockResolvedValue(undefined),- } as never,- goNext: vi.fn(),- goBack: vi.fn(),- skip: vi.fn(),- isFirst: false,- isLast: true,- setSummary: vi.fn(),- setGap: vi.fn(),- gaps: {},- summaries: { language: "Deutsch · Auto", "api-keys": "OpenRouter", "wake-word": "Hey Nova" },- ...overrides,- };-}--it("awaits complete() on the start CTA", async () => {- const p = props();- render(<FinishStep {...p} />);- fireEvent.click(screen.getByTestId("onboarding-start"));- await waitFor(() =>- expect((p.onb as never as { complete: ReturnType<typeof vi.fn> }).complete).toHaveBeenCalled(),- );-});--it("a failed completion shows the error and re-enables the button", async () => {- const p = props({- onb: {- state: { skipped_steps: [], steps: STEPS },- complete: vi.fn().mockRejectedValue(new Error("HTTP 500")),- } as never,- });- render(<FinishStep {...p} />);- fireEvent.click(screen.getByTestId("onboarding-start"));- await waitFor(() => expect(screen.getByText("onboarding.finish.start_failed")).toBeDefined());- expect((screen.getByTestId("onboarding-start") as HTMLButtonElement).disabled).toBe(false);-});--it("reads back the register summaries and marks skipped steps", () => {- const p = props({- onb: {- state: { skipped_steps: ["api-keys"], steps: STEPS },- complete: vi.fn(),- } as never,- summaries: { language: "Deutsch · Auto", "wake-word": "Hey Nova" },- });- render(<FinishStep {...p} />);- const review = screen.getByTestId("onboarding-review");- expect(review.textContent).toContain("Deutsch · Auto");- expect(review.textContent).toContain("Hey Nova");- expect(review.textContent).toContain("onboarding.finish.skipped");-});--it("shows the autostart switch when supported and PUTs on change", async () => {- const calls: Array<[string, RequestInit | undefined]> = [];- vi.stubGlobal(- "fetch",- vi.fn().mockImplementation((url: string, init?: RequestInit) => {- calls.push([url, init]);- if (init?.method === "PUT") {- return Promise.resolve({ ok: true, json: () => Promise.resolve({ ok: true }) });- }- return Promise.resolve({- ok: true,- json: () => Promise.resolve({ enabled: true, supported: true }),- });- }),- );- render(<FinishStep {...props()} />);- const toggle = await screen.findByTestId("onboarding-autostart");- expect(toggle.getAttribute("aria-checked")).toBe("true");-- fireEvent.click(toggle);- await waitFor(() =>- expect(- calls.some(- ([url, init]) =>- url === "/api/settings/autostart" &&- init?.method === "PUT" &&- JSON.parse(init.body as string).enabled === false,- ),- ).toBe(true),- );-});--it("hides the switch when autostart is unsupported (headless) or the probe fails", async () => {- render(<FinishStep {...props()} />);- await waitFor(() => expect(screen.queryByTestId("onboarding-autostart")).toBeNull());- cleanup();- vi.stubGlobal("fetch", vi.fn().mockRejectedValue(new Error("net")));- render(<FinishStep {...props()} />);- await waitFor(() => expect(screen.queryByTestId("onboarding-autostart")).toBeNull());-});--it("the tour is an external link, not an embedded player", () => {- render(<FinishStep {...props()} />);- const link = screen.getByRole("link", { name: /tour_title/ }) as HTMLAnchorElement;- expect(link.href).toContain("youtube.com");- expect(link.target).toBe("_blank");- expect(document.querySelector("iframe")).toBeNull();-});--it("with nothing missing there is no disclaimer and Start is live", () => {- render(<FinishStep {...props()} />);- expect(screen.queryByTestId("onboarding-gaps")).toBeNull();- expect(screen.queryByTestId("onboarding-gaps-ack")).toBeNull();- expect((screen.getByTestId("onboarding-start") as HTMLButtonElement).disabled).toBe(false);-});--it("lists every reported gap and every skipped step, and Start waits for the acknowledgement", () => {- const p = props({- onb: {- state: { skipped_steps: ["wake-word"], steps: STEPS },- complete: vi.fn(),- } as never,- summaries: { language: "Deutsch · Auto", "api-keys": "Gemini + OpenAI · Google Gemini" },- gaps: { "api-keys": "OpenAI key missing — live voice stays off." },- });- render(<FinishStep {...p} />);- const gaps = screen.getByTestId("onboarding-gaps");- expect(gaps.textContent).toContain("OpenAI key missing");- expect(gaps.textContent).toContain("onboarding.finish.gap_skipped_wake_word");- // A step that reported nothing and was not skipped is not listed.- expect(gaps.textContent).not.toContain("gap_skipped_language");-- const start = screen.getByTestId("onboarding-start") as HTMLButtonElement;- expect(start.disabled).toBe(true);- fireEvent.click(screen.getByTestId("onboarding-gaps-ack"));- expect(start.disabled).toBe(false);-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsxdeleted file mode 100644index 85a1bebdbe..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/FinishStep.tsx+++ /dev/null@@ -1,217 +0,0 @@-import { useEffect, useState } from "react";-import { ExternalLink, Play } from "lucide-react";-import { Switch } from "@/components/ui/switch";-import { useT } from "@/i18n";-import type { StepProps } from "../OnboardingFlow";-import { ConsentLine, StatusLine, StepFooter, StepSection } from "../primitives";--interface AutostartState {- enabled: boolean;- supported: boolean;-}--// The public onboarding walkthrough on YouTube. It used to be a full screen-// of its own between the risk gate and the wizard; now it is one line on the-// last step that opens in the user's browser, so nobody is asked to sit-// through a video before they may type a key.-const TOUR_URL = "https://www.youtube.com/watch?v=FXz1HclXL1g";--/** The steps whose summary the review reads back, in register order. */-const REVIEW_STEPS = ["language", "api-keys", "permissions", "wake-word"] as const;--/**- * The review: what was set up, as a definition list of the register's own- * summaries, plus the autostart switch and the one gold action that starts- * the assistant. Completion is awaited — the backend restarts the app once- * the marker is written — and a failure shows in place instead of leaving- * the button dead.- */-export function FinishStep({ onb, goBack, summaries, gaps }: StepProps) {- const t = useT();- const skipped = new Set(onb.state?.skipped_steps ?? []);- const steps = onb.state?.steps ?? [];- const [busy, setBusy] = useState(false);- const [error, setError] = useState<string | null>(null);- // The disclaimer: every gap a step reported, plus a generic line for any- // step that was skipped without reporting one. Nothing missing → no list,- // no checkbox, Start is live. Something missing → the user ticks that they- // have read what stays off before the assistant starts.- const [gapsAcknowledged, setGapsAcknowledged] = useState(false);- const gapList = REVIEW_STEPS.filter((key) => steps.includes(key)).flatMap((key) => {- const text = gaps[key];- if (text) return [{ key, text }];- if (skipped.has(key) && !summaries[key]) {- return [{ key, text: t(`onboarding.finish.gap_skipped_${key.replace("-", "_")}`) }];- }- return [];- });- const hasGaps = gapList.length > 0;-- // "Start at login" toggle (formerly a terminal-wizard question).- // Capability-gated: hidden on hosts where autostart is unsupported- // (headless Linux) or when the probe fails — Settings stays the recovery- // path either way.- const [autostart, setAutostart] = useState<AutostartState | null>(null);-- useEffect(() => {- void (async () => {- try {- const res = await fetch("/api/settings/autostart");- if (res.ok) setAutostart((await res.json()) as AutostartState);- } catch {- // capability probe is best-effort — hide the toggle on failure- }- })();- }, []);-- const toggleAutostart = async (enabled: boolean) => {- setAutostart((s) => (s ? { ...s, enabled } : s));- try {- await fetch("/api/settings/autostart", {- method: "PUT",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ enabled }),- });- } catch {- // keep the optimistic value; the Settings view remains the recovery path- }- };-- const start = async () => {- if (busy) return;- setBusy(true);- setError(null);- try {- // Awaited through the hook (which dispatches jarvis:onboarding-changed- // on success) so a failed POST is visible here instead of a dead button.- await onb.complete();- } catch {- setError(t("onboarding.finish.start_failed"));- setBusy(false);- }- };-- const review = REVIEW_STEPS.filter((key) => steps.includes(key)).map((key) => ({- key,- label: t(`onboarding.steps.${key}.label`),- value: summaries[key] ?? (skipped.has(key) ? t("onboarding.finish.skipped") : "—"),- muted: !summaries[key],- }));-- return (- <div className="space-y-8">- <StepSection label={t("onboarding.finish.summary_label")}>- <dl className="border-y border-border/70" data-testid="onboarding-review">- {review.map((row) => (- <div- key={row.key}- className="grid grid-cols-[minmax(0,1fr)_auto] items-baseline gap-4 border-b border-border/50 py-3 text-sm last:border-b-0"- >- <dt className="text-muted-foreground">{row.label}</dt>- <dd- className={- row.muted- ? "text-right text-sm text-muted-foreground/80"- : "text-right font-medium text-foreground"- }- >- {row.value}- </dd>- </div>- ))}- {autostart?.supported && (- <div className="flex items-center justify-between gap-4 border-b border-border/50 py-3 last:border-b-0">- <div className="min-w-0">- <span className="block text-sm font-medium text-foreground">- {t("onboarding.finish.autostart_label")}- </span>- <span className="mt-0.5 block text-sm text-muted-foreground">- {t("onboarding.finish.autostart_hint")}- </span>- </div>- <Switch- checked={autostart.enabled}- onCheckedChange={(v) => void toggleAutostart(v)}- aria-label={t("onboarding.finish.autostart_label")}- data-testid="onboarding-autostart"- />- </div>- )}- </dl>- </StepSection>-- <StepSection label={t("onboarding.finish.tour_label")}>- <a- href={TOUR_URL}- target="_blank"- rel="noreferrer"- className="group flex items-center gap-3 border-y border-border/70 py-3 text-sm"- >- <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-control border border-border bg-card/60 text-foreground transition-colors group-hover:border-primary/60 group-hover:text-primary">- <Play className="h-3.5 w-3.5 translate-x-px fill-current" />- </span>- <span className="min-w-0">- <span className="block font-medium text-foreground">- {t("onboarding.finish.tour_title")}- </span>- <span className="block text-sm text-muted-foreground">- {t("onboarding.finish.tour_body")}- </span>- </span>- <ExternalLink className="ml-auto h-3.5 w-3.5 shrink-0 text-muted-foreground" />- </a>- </StepSection>-- {hasGaps && (- <StepSection label={t("onboarding.finish.gaps_label")}>- <div- data-testid="onboarding-gaps"- className="space-y-3 border-l-2 border-foreground/70 py-1 pl-4"- >- <p className="text-lg font-medium text-foreground">- {t("onboarding.finish.gaps_intro")}- </p>- <ul className="space-y-2">- {gapList.map((g) => (- <li key={g.key} className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 text-sm">- <span className="pt-0.5 font-mono text-xs uppercase tracking-[0.12em] text-muted-foreground">- {t(`onboarding.steps.${g.key}.label`)}- </span>- <span className="leading-relaxed text-foreground">{g.text}</span>- </li>- ))}- </ul>- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.finish.gaps_outro")}- </p>- </div>- <ConsentLine- checked={gapsAcknowledged}- onChange={setGapsAcknowledged}- testId="onboarding-gaps-ack"- >- {t("onboarding.finish.gaps_ack")}- </ConsentLine>- </StepSection>- )}-- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.finish.boot_notice")}- </p>-- {error && <StatusLine tone="error">{error}</StatusLine>}-- <StepFooter- onBack={goBack}- primary={{- label: busy ? t("onboarding.finish.starting") : t("onboarding.finish.start_cta"),- onClick: () => void start(),- busy,- disabled: hasGaps && !gapsAcknowledged,- testId: "onboarding-start",- }}- hidePrimaryArrow- />- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsxdeleted file mode 100644index 778230a375..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.test.tsx+++ /dev/null@@ -1,40 +0,0 @@-import { cleanup, fireEvent, render, screen } from "@testing-library/react";-import { afterEach, expect, it, vi } from "vitest";-const { setUiLanguage } = vi.hoisted(() => ({ setUiLanguage: vi.fn() }));-vi.mock("@/i18n", () => ({- useT: () => (k: string) => k,- useUiLanguage: () => "en",- useReplyLanguage: () => "auto",- setUiLanguage,- setReplyLanguage: vi.fn(),-}));-import { LanguageStep } from "./LanguageStep";-afterEach(() => {- cleanup();- setUiLanguage.mockClear();-});--it("changes UI language, reports the summary, and advances", async () => {- const goNext = vi.fn();- const setSummary = vi.fn();- render(- <LanguageStep- onb={{} as never}- goNext={goNext}- goBack={vi.fn()}- skip={vi.fn()}- isFirst={false}- isLast={false}- setSummary={setSummary}- setGap={vi.fn()}- gaps={{}}- summaries={{}}- />,- );- expect(setSummary).toHaveBeenCalledWith("onboarding.language.summary");- fireEvent.click(screen.getByLabelText("onboarding.language.ui_label"));- fireEvent.click(await screen.findByText("Deutsch"));- expect(setUiLanguage).toHaveBeenCalledWith("de");- fireEvent.click(screen.getByTestId("onboarding-primary"));- expect(goNext).toHaveBeenCalled();-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsxdeleted file mode 100644index ac98f2527d..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/LanguageStep.tsx+++ /dev/null@@ -1,103 +0,0 @@-import { useEffect } from "react";-import { BrandedSelect } from "@/components/ui/select";-import {- useT,- useUiLanguage,- setUiLanguage,- useReplyLanguage,- setReplyLanguage,- type UiLanguage,- type ReplyLanguage,-} from "@/i18n";-import type { StepProps } from "../OnboardingFlow";-import { StepFooter } from "../primitives";--const LANGUAGE_LABELS: Record<string, string> = {- en: "English",- de: "Deutsch",- es: "Español",-};--/**- * Two settings as two rows of a definition list: label and hint on the left,- * the control on the right, a rule between them. The register summary reads- * "Deutsch · replies Auto" as soon as either changes.- */-export function LanguageStep({ goNext, goBack, setSummary }: StepProps) {- const t = useT();- const ui = useUiLanguage();- const reply = useReplyLanguage();-- useEffect(() => {- const replyLabel = reply === "auto" ? "Auto" : (LANGUAGE_LABELS[reply] ?? reply);- setSummary(- t("onboarding.language.summary")- .replace("{0}", LANGUAGE_LABELS[ui] ?? ui)- .replace("{1}", replyLabel),- );- }, [ui, reply, setSummary, t]);-- const rows = [- {- key: "ui",- label: t("onboarding.language.ui_label"),- hint: t("onboarding.language.ui_hint"),- control: (- <BrandedSelect- ariaLabel={t("onboarding.language.ui_label")}- value={ui}- onValueChange={(value) => setUiLanguage(value as UiLanguage)}- options={[- { value: "en", label: "English" },- { value: "de", label: "Deutsch" },- { value: "es", label: "Español" },- ]}- />- ),- },- {- key: "reply",- label: t("onboarding.language.reply_label"),- hint: t("onboarding.language.reply_hint"),- control: (- <BrandedSelect- ariaLabel={t("onboarding.language.reply_label")}- value={reply}- onValueChange={(value) => setReplyLanguage(value as ReplyLanguage)}- options={[- { value: "auto", label: t("onboarding.language.auto") },- { value: "en", label: "English" },- { value: "de", label: "Deutsch" },- { value: "es", label: "Español" },- ]}- />- ),- },- ];-- return (- <div>- <dl className="border-y border-border/70">- {rows.map((row) => (- <div- key={row.key}- className="grid gap-3 border-b border-border/50 py-4 last:border-b-0 sm:grid-cols-[minmax(0,1fr)_240px] sm:items-center"- >- <dt>- <span className="block text-sm font-medium text-foreground">{row.label}</span>- <span className="mt-0.5 block text-sm leading-relaxed text-muted-foreground">- {row.hint}- </span>- </dt>- <dd className="min-w-0">{row.control}</dd>- </div>- ))}- </dl>-- <StepFooter- onBack={goBack}- primary={{ label: t("onboarding.nav.next"), onClick: goNext }}- />- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.test.tsxdeleted file mode 100644index f7e1f97bbf..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.test.tsx+++ /dev/null@@ -1,57 +0,0 @@-import { expect, it } from "vitest";-import type { PermissionSnapshot } from "@/hooks/usePermissions";-import { permissionSnapshotReady } from "./PermissionsStep";--const IDS = [- "microphone",- "screen_recording",- "accessibility",- "input_monitoring",- "event_posting",- "automation",- "credential_store",-] as const;--function macSnapshot(overrides: Partial<PermissionSnapshot> = {}): PermissionSnapshot {- return {- platform: "darwin",- supported: true,- headless: false,- app_identity: { stable: true },- permissions: IDS.map((id) => ({- id,- status: "granted",- required: [],- can_request: false,- can_open_settings: true,- can_reset: false,- restart_required: false,- })),- features: {},- restart_required: false,- ...overrides,- };-}--it("accepts a complete stable macOS permission snapshot", () => {- expect(permissionSnapshotReady(macSnapshot())).toBe(true);-});--it("fails closed for an unstable macOS app identity", () => {- expect(- permissionSnapshotReady(macSnapshot({ app_identity: { stable: false } })),- ).toBe(false);-});--it("fails closed for an empty or incomplete macOS permission list", () => {- expect(permissionSnapshotReady(macSnapshot({ permissions: [] }))).toBe(false);- expect(- permissionSnapshotReady(macSnapshot({ permissions: macSnapshot().permissions.slice(1) })),- ).toBe(false);-});--it("accepts supported non-macOS platforms without TCC grants", () => {- expect(permissionSnapshotReady(macSnapshot({ platform: "linux", permissions: [] }))).toBe(true);- expect(permissionSnapshotReady(macSnapshot({ platform: "win32", permissions: [] }))).toBe(true);- expect(permissionSnapshotReady(macSnapshot({ platform: "unknown", permissions: [] }))).toBe(false);-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.tsxdeleted file mode 100644index 4e4dc43cd1..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/PermissionsStep.tsx+++ /dev/null@@ -1,94 +0,0 @@-import { useCallback, useEffect, useState } from "react";-import type { PermissionId, PermissionSnapshot } from "@/hooks/usePermissions";-import { useT } from "@/i18n";-import { PermissionRows } from "@/views/settings/PermissionsPanel";-import type { StepProps } from "../OnboardingFlow";-import { StepFooter } from "../primitives";--const EXPECTED_MACOS_PERMISSIONS = new Set<PermissionId>([- "microphone",- "screen_recording",- "accessibility",- "input_monitoring",- "event_posting",- "automation",- "credential_store",-]);--export function permissionSnapshotReady(snapshot: PermissionSnapshot | null): boolean {- if (!snapshot) return false;- if (snapshot.platform === "linux" || snapshot.platform === "win32") return true;- if (snapshot.platform !== "darwin") return false;- if (snapshot.app_identity.stable !== true) return false;- if (snapshot.permissions.length !== EXPECTED_MACOS_PERMISSIONS.size) return false;-- const observed = new Set(snapshot.permissions.map((item) => item.id));- if (- observed.size !== EXPECTED_MACOS_PERMISSIONS.size ||- [...EXPECTED_MACOS_PERMISSIONS].some((id) => !observed.has(id))- ) {- return false;- }- // Restart batching (2026-07-18): a granted-but-stale row (macOS freezes- // some TCC probes per process, so the grant only reads back after a- // relaunch) counts as satisfied here — onboarding ends with ONE- // unconditional fresh restart that applies it. Blocking Continue on- // restart_required forced a mid-flow restart that threw users back to- // step 1 and doubled the total restarts.- return snapshot.permissions.every(- (item) =>- ["granted", "not_required"].includes(item.status) ||- item.restart_required === true,- );-}--/**- * macOS only — the flow hides this step on Windows and Linux (see- * `visibleSteps`). The rows are the Settings panel's own, so what the user- * grants here is exactly what they will see there.- */-export function PermissionsStep({ goNext, goBack, skip, setSummary, setGap }: StepProps) {- const t = useT();- const [allReady, setAllReady] = useState(false);- const onSnapshot = useCallback((snapshot: PermissionSnapshot | null) => {- setAllReady(permissionSnapshotReady(snapshot));- }, []);-- useEffect(() => {- setSummary(allReady ? t("onboarding.permissions.summary_ready") : null);- setGap(allReady ? null : t("onboarding.permissions.gap"));- }, [allReady, setSummary, setGap, t]);-- return (- <div className="space-y-6">- <div className="border-y border-border/70 py-3">- <PermissionRows compact deferRestartNote onSnapshot={onSnapshot} />- </div>-- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.permissions.privacy_note")}- </p>-- <StepFooter- onBack={goBack}- primary={{- label: t("onboarding.permissions.continue"),- onClick: goNext,- disabled: !allReady,- }}- secondary={- allReady- ? null- : {- label: t("onboarding.permissions.text_only"),- onClick: () => {- setSummary(t("onboarding.permissions.summary_skipped"));- skip();- },- testId: "onboarding-permissions-skip",- }- }- />- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsxdeleted file mode 100644index 8991086022..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx+++ /dev/null@@ -1,262 +0,0 @@-import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { afterEach, expect, it, vi } from "vitest";-vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));-const localSpeech = vi.hoisted(() => ({- onInstalled: undefined as (() => void) | undefined,- startInstall: vi.fn(),-}));-const saveWakeWord = vi.fn().mockResolvedValue({ ok: true, degraded: false });-const ACTIVATION_OK = {- ok: true,- enabled: true,- applied_live: true,- restart_required: false,- persisted: true,- message: "",-};-const setWakeActivation = vi.fn().mockResolvedValue(ACTIVATION_OK);-vi.mock("@/hooks/useWakeWord", () => ({- useWakeWord: () => ({ saveWakeWord, setWakeActivation }),- useLocalSpeechInstall: (onInstalled?: () => void) => {- localSpeech.onInstalled = onInstalled;- return {- status: { state: "idle", message: "", available: true },- install: localSpeech.startInstall,- };- },-}));-import { WakeWordStep } from "./WakeWordStep";-afterEach(() => {- cleanup();- vi.unstubAllGlobals();- saveWakeWord.mockClear();- saveWakeWord.mockResolvedValue({ ok: true, degraded: false });- setWakeActivation.mockClear();- setWakeActivation.mockResolvedValue(ACTIVATION_OK);- localSpeech.startInstall.mockClear();- localSpeech.onInstalled = undefined;-});--const onb = {- state: { legal_references: [{ label: "EUIPO", url: "https://euipo.europa.eu/eSearch/" }] },- acknowledgeWakeWord: vi.fn().mockResolvedValue(undefined),-} as never;--function renderStep(goNext = vi.fn(), setSummary = vi.fn(), skip = vi.fn(), setGap = vi.fn()) {- render(- <WakeWordStep- onb={onb}- goNext={goNext}- goBack={vi.fn()}- skip={skip}- isFirst={false}- isLast={false}- setSummary={setSummary}- setGap={setGap}- gaps={{}}- summaries={{}}- />,- );- return { goNext, setSummary, skip, setGap };-}--const primary = () => screen.getByTestId("onboarding-primary") as HTMLButtonElement;--it("offers both activation paths on one screen, wake word preselected with its input open", () => {- renderStep();- expect(screen.getByTestId("wake-mode-wake").getAttribute("aria-checked")).toBe("true");- expect(screen.getByTestId("wake-mode-shortcut").getAttribute("aria-checked")).toBe("false");- expect(screen.getByRole("textbox")).toBeDefined();-});--it("keyboard-shortcut path: turns the wake word off and advances, no phrase required", async () => {- const { goNext, setSummary } = renderStep();- fireEvent.click(screen.getByTestId("wake-mode-shortcut"));- expect(screen.queryByRole("textbox")).toBeNull();- expect(setSummary).toHaveBeenLastCalledWith("onboarding.wake_word.summary_shortcut");- fireEvent.click(primary());- await waitFor(() => expect(setWakeActivation).toHaveBeenCalledWith(false));- expect(goNext).toHaveBeenCalled();- expect(saveWakeWord).not.toHaveBeenCalled();-});--it("wake-word path: shows the derived-name preview and reports 'Hey <word>' as the summary", () => {- const { setSummary } = renderStep();- expect(screen.queryByText("onboarding.wake_word.derived_name")).toBeNull();- fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });- expect(screen.queryByText("onboarding.wake_word.derived_name")).not.toBeNull();- expect(setSummary).toHaveBeenLastCalledWith("Hey Nova");-});--it("wake-word path: requires word + ack, saves 'Hey <word>', activates, and advances", async () => {- const { goNext } = renderStep();-- fireEvent.click(screen.getByRole("button", { name: "onboarding.wake_word.learn_more" }));- expect(screen.getByRole("link", { name: "EUIPO" })).toBeDefined();-- expect(primary().disabled).toBe(true);- fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });- expect(primary().disabled).toBe(true); // checkbox still unticked- fireEvent.click(screen.getByTestId("wake-ack"));- expect(primary().disabled).toBe(false);-- fireEvent.click(primary());- await waitFor(() => expect(saveWakeWord).toHaveBeenCalled());- expect(saveWakeWord.mock.calls[0][0].phrase).toBe("Hey Nova");- expect(- (onb as never as { acknowledgeWakeWord: ReturnType<typeof vi.fn> }).acknowledgeWakeWord,- ).toHaveBeenCalled();- await waitFor(() => expect(setWakeActivation).toHaveBeenCalledWith(true));- expect(goNext).toHaveBeenCalled();-});--it("wake-word path: a degraded save does NOT advance and offers the local-speech install", async () => {- saveWakeWord.mockResolvedValue({ ok: true, degraded: true });- const { goNext } = renderStep();-- fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });- fireEvent.click(screen.getByTestId("wake-ack"));- fireEvent.click(primary());-- await waitFor(() =>- expect(screen.getByText("settings_view.wake_word.needs_whisper_hint")).toBeDefined(),- );- expect(goNext).not.toHaveBeenCalled();- expect(setWakeActivation).not.toHaveBeenCalled();-- fireEvent.click(screen.getByRole("button", { name: "onboarding.wake_word.continue_anyway" }));- await waitFor(() => expect(setWakeActivation).toHaveBeenCalledWith(true));- expect(goNext).toHaveBeenCalled();-});--it("wake-word path: completed local install clears the stale degraded warning", async () => {- saveWakeWord- .mockResolvedValueOnce({ ok: true, degraded: true })- .mockResolvedValue({ ok: true, degraded: false });- const { goNext } = renderStep();-- fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });- fireEvent.click(screen.getByTestId("wake-ack"));- fireEvent.click(primary());-- await screen.findByText("settings_view.wake_word.needs_whisper_hint");- fireEvent.click(- screen.getByRole("button", { name: "settings_view.wake_word.enable_local_button" }),- );- expect(localSpeech.startInstall).toHaveBeenCalledOnce();-- act(() => localSpeech.onInstalled?.());-- await waitFor(() =>- expect(screen.queryByText("settings_view.wake_word.needs_whisper_hint")).toBeNull(),- );- expect(- screen.queryByRole("button", { name: "onboarding.wake_word.continue_anyway" }),- ).toBeNull();-- // The normal CTA re-validates the already-persisted phrase and activates it.- fireEvent.click(primary());- await waitFor(() => expect(saveWakeWord).toHaveBeenCalledTimes(2));- await waitFor(() => expect(setWakeActivation).toHaveBeenCalledWith(true));- expect(goNext).toHaveBeenCalled();-});--it("renders ONE mic-check control that reports a good level", async () => {- const fetchSpy = vi.fn(() =>- Promise.resolve({- ok: true,- status: 200,- json: () => Promise.resolve({ max_dbfs: -15.0, no_device: false, too_quiet: false }),- }),- );- vi.stubGlobal("fetch", fetchSpy);- renderStep();-- expect(screen.getAllByTestId("wake-mic-test")).toHaveLength(1);- fireEvent.click(screen.getByTestId("wake-mic-test"));- await waitFor(() =>- expect(fetchSpy).toHaveBeenCalledWith("/api/settings/wake-word/mic-level"),- );- await waitFor(() => expect(screen.getByText("onboarding.wake_word.mic_check.good")).toBeDefined());-});--it("mic-check shows the too-quiet warning without blocking the save CTA", async () => {- vi.stubGlobal(- "fetch",- vi.fn(() =>- Promise.resolve({- ok: true,- status: 200,- json: () => Promise.resolve({ max_dbfs: -55.0, no_device: false, too_quiet: true }),- }),- ),- );- renderStep();- fireEvent.click(screen.getByTestId("wake-mic-test"));- await waitFor(() =>- expect(screen.getByText("onboarding.wake_word.mic_check.too_quiet")).toBeDefined(),- );- fireEvent.change(screen.getByRole("textbox"), { target: { value: "Nova" } });- fireEvent.click(screen.getByTestId("wake-ack"));- expect(primary().disabled).toBe(false);-});--it("mic-check surfaces permission_required and a probe failure honestly", async () => {- vi.stubGlobal(- "fetch",- vi.fn(() =>- Promise.resolve({- ok: true,- status: 200,- json: () =>- Promise.resolve({- max_dbfs: -90,- no_device: false,- too_quiet: true,- permission_required: true,- }),- }),- ),- );- renderStep();- fireEvent.click(screen.getByTestId("wake-mic-test"));- await waitFor(() =>- expect(- screen.getByText("onboarding.wake_word.mic_check.permission_required"),- ).toBeDefined(),- );- cleanup();- vi.stubGlobal("fetch", vi.fn(() => Promise.reject(new Error("down"))));- renderStep();- fireEvent.click(screen.getByTestId("wake-mic-test"));- await waitFor(() =>- expect(screen.getByText("onboarding.wake_word.mic_check.error")).toBeDefined(),- );-});--it("a failed activation offers a way out instead of trapping first run (BUG-209)", async () => {- // The guide covers the whole window and this step had no Skip, so one failing- // request ended setup for good — the reported "HTTP 500 on 04 of 05".- setWakeActivation.mockRejectedValue(new Error("HTTP 500"));- const { goNext, skip } = renderStep();-- fireEvent.click(screen.getByTestId("wake-mode-shortcut"));- fireEvent.click(primary());-- await screen.findByText("HTTP 500");- expect(goNext).not.toHaveBeenCalled();-- fireEvent.click(screen.getByTestId("wake-skip-after-error"));- expect(skip).toHaveBeenCalled();-});--it("an activation that could not be persisted advances but reports the gap", async () => {- setWakeActivation.mockResolvedValue({ ...ACTIVATION_OK, persisted: false, message: "boom" });- const { goNext, setGap } = renderStep();-- fireEvent.click(screen.getByTestId("wake-mode-shortcut"));- fireEvent.click(primary());-- await waitFor(() => expect(goNext).toHaveBeenCalled());- expect(setGap).toHaveBeenLastCalledWith("onboarding.wake_word.gap_not_persisted");-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsxdeleted file mode 100644index a91f4e5dac..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.tsx+++ /dev/null@@ -1,402 +0,0 @@-import { useEffect, useState } from "react";-import { Mic } from "lucide-react";-import { Button, Field } from "@/components/agentic/controls";-import { useWakeWord, useLocalSpeechInstall } from "@/hooks/useWakeWord";-import type { WakeActivationResult } from "@/hooks/useWakeWord";-import { useT } from "@/i18n";-import { deriveAssistantName } from "@/lib/deriveAssistantName";-import type { StepProps } from "../OnboardingFlow";-import {- ChoiceRow,- ConsentLine,- StatusLine,- StepFooter,- StepSection,-} from "../primitives";--type Mode = "wake" | "shortcut";--/** GET /api/settings/wake-word/mic-level response shape. */-interface MicLevelResult {- max_dbfs: number;- no_device: boolean;- too_quiet: boolean;- permission_required?: boolean;-}--type MicCheckState = "idle" | "checking" | "done";--/**- * Two honest activation paths — no branded default (Marvel owns "Jarvis" as a- * trademark, so recommending "Hey Jarvis" out of the box is off the table):- *- * - "wake": the user picks their OWN word. It only actually fires once a local- * model exists for that exact word — if the save comes back `degraded` we do- * NOT silently advance, we offer the one-click local-speech install or an- * honest "continue anyway" (wake word off until the pack lands).- * - "shortcut": no wake word at all — the Call keyboard shortcut starts a- * normal voice session and remains editable later in Settings.- *- * Both paths sit on one screen as two selectable rows; the wake-word row- * unfolds its input in place. One microphone check (the old step had two- * buttons wired to the same probe).- */-export function WakeWordStep({ onb, goNext, goBack, skip, setSummary, setGap }: StepProps) {- const t = useT();- const { saveWakeWord, setWakeActivation } = useWakeWord();- const [mode, setMode] = useState<Mode>("wake");- const [word, setWord] = useState("");- const [ack, setAck] = useState(false);- const [busy, setBusy] = useState(false);- const [err, setErr] = useState<string | null>(null);- const [showRefs, setShowRefs] = useState(false);- // Set when a save resolved to a degraded engine (no local model matches the- // user's own word). We DON'T advance silently in that case — we tell the- // user and offer the one-click local-speech install, or an honest opt-out.- const [degraded, setDegraded] = useState(false);- const { status: install, install: startInstall } = useLocalSpeechInstall(() => {- // The first save already persisted the phrase. Once the recovery installer- // has both the engine and its model, discard that stale degraded verdict and- // let the normal CTA re-check + activate it. This prevents the contradictory- // "model installed" plus "continue anyway" state from lingering on screen.- setDegraded(false);- setErr(null);- });- // Mic verification: a live dBFS read from the desktop app's own capture- // path (the same one the wake-word detector listens on) — never blocks the- // save/acknowledge below, it just surfaces an honest signal so a quiet mic- // or a headless/no-mic host is visible before the user commits.- const [micCheck, setMicCheck] = useState<{- state: MicCheckState;- result: MicLevelResult | null;- error: string | null;- }>({ state: "idle", result: null, error: null });-- const trimmed = word.trim();- const canSave = trimmed.length >= 2 && ack && !busy;- const derivedName = deriveAssistantName(`Hey ${trimmed}`);- const refs = onb.state?.legal_references ?? [];-- useEffect(() => {- if (mode === "shortcut") setSummary(t("onboarding.wake_word.summary_shortcut"));- else setSummary(trimmed.length >= 2 ? `Hey ${trimmed}` : null);- }, [mode, trimmed, setSummary, t]);-- /**- * The gap this step reports after activating. A live-applied switch that the- * config writer could not persist still works right now but is gone after a- * restart — the finish step must say so rather than let the user believe the- * choice stuck. `fallback` is the gap the calling path would report anyway.- */- function activationGap(result: WakeActivationResult, fallback: string | null): string | null {- if (result.persisted) return fallback;- const notPersisted = t("onboarding.wake_word.gap_not_persisted");- return fallback ? `${fallback} ${notPersisted}` : notPersisted;- }-- /**- * Leave the step without activating anything. Only offered once a call has- * actually failed: the guide covers the whole window and this step used to- * have no way past a backend error, so a single failing request ended first- * run for good (BUG-209). Skipping is recorded, and the finish step lists it.- */- function skipAfterError() {- setGap(null);- skip();- }-- function setWordReset(next: string) {- // Any edit invalidates a previous degraded verdict — back to the normal CTA.- setWord(next);- if (degraded) setDegraded(false);- if (err) setErr(null);- }-- async function runMicCheck() {- setMicCheck({ state: "checking", result: null, error: null });- try {- const res = await fetch("/api/settings/wake-word/mic-level");- if (!res.ok) throw new Error(`HTTP ${res.status}`);- const data: MicLevelResult = await res.json();- setMicCheck({ state: "done", result: data, error: null });- } catch (e) {- setMicCheck({ state: "done", result: null, error: (e as Error).message });- }- }-- async function onSaveWake() {- if (!canSave) return;- setBusy(true);- setErr(null);- try {- await onb.acknowledgeWakeWord();- const result = await saveWakeWord({ phrase: `Hey ${trimmed}`, engine: "auto", persist: true });- // Honesty gate: only advance when the phrase will actually be heard. A- // degraded result means no local model matches the user's own word — the- // wake word would effectively be off — so surface that instead of- // pretending it worked.- if (result.degraded) {- setDegraded(true);- return;- }- setGap(activationGap(await setWakeActivation(true), null));- goNext();- } catch (e) {- setErr((e as Error).message);- } finally {- setBusy(false);- }- }-- async function onContinueDegraded() {- setBusy(true);- setErr(null);- try {- const result = await setWakeActivation(true);- // The phrase is saved but nothing can hear it yet — the finish step- // must say so before the user expects "Hey X" to work.- const degradedGap = t("onboarding.wake_word.gap_degraded").replace(- "{0}",- `Hey ${trimmed}`,- );- setGap(activationGap(result, degradedGap));- goNext();- } catch (e) {- setErr((e as Error).message);- } finally {- setBusy(false);- }- }-- async function onChooseShortcut() {- setBusy(true);- setErr(null);- try {- setGap(activationGap(await setWakeActivation(false), null));- goNext();- } catch (e) {- setErr((e as Error).message);- } finally {- setBusy(false);- }- }-- const micLine = (() => {- if (micCheck.state === "checking") {- return <StatusLine tone="muted">{t("onboarding.wake_word.mic_check.listening")}</StatusLine>;- }- if (micCheck.state !== "done") return null;- if (micCheck.error) {- return <StatusLine tone="warning">{t("onboarding.wake_word.mic_check.error")}</StatusLine>;- }- const r = micCheck.result;- if (!r) return null;- if (r.permission_required) {- return (- <StatusLine tone="warning">- {t("onboarding.wake_word.mic_check.permission_required")}- </StatusLine>- );- }- if (r.no_device) {- return <StatusLine tone="muted">{t("onboarding.wake_word.mic_check.no_device")}</StatusLine>;- }- if (r.too_quiet) {- return <StatusLine tone="warning">{t("onboarding.wake_word.mic_check.too_quiet")}</StatusLine>;- }- return <StatusLine tone="ok">{t("onboarding.wake_word.mic_check.good")}</StatusLine>;- })();-- // A failed call must never be the end of first run. The raw message stays- // (it is the only clue the user has), but it now comes with the way out this- // step was missing: skip activation and finish the guide (BUG-209).- const errorBlock = err ? (- <div className="space-y-2">- <StatusLine tone="error">{err}</StatusLine>- <div className="flex flex-wrap items-center gap-3">- <Button variant="quiet" onClick={skipAfterError} data-testid="wake-skip-after-error">- {t("onboarding.nav.skip")}- </Button>- <p className="text-sm text-muted-foreground">- {t("onboarding.wake_word.error_skip_hint")}- </p>- </div>- </div>- ) : null;-- return (- <div className="space-y-8">- <StepSection label={t("onboarding.wake_word.mode_label")}>- <div role="radiogroup" aria-label={t("onboarding.wake_word.mode_label")} className="space-y-2">- <ChoiceRow- selected={mode === "wake"}- onSelect={() => setMode("wake")}- title={t("onboarding.wake_word.mode_wake_title")}- body={t("onboarding.wake_word.mode_wake_body")}- testId="wake-mode-wake"- />- <ChoiceRow- selected={mode === "shortcut"}- onSelect={() => setMode("shortcut")}- title={t("onboarding.wake_word.mode_shortcut_title")}- body={t("onboarding.wake_word.mode_shortcut_body")}- testId="wake-mode-shortcut"- />- </div>- </StepSection>-- {mode === "shortcut" ? (- <>- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.wake_word.shortcut_note")}- </p>- {errorBlock}- <StepFooter- onBack={goBack}- primary={{- label: busy ? t("onboarding.wake_word.saving") : t("onboarding.nav.next"),- onClick: () => void onChooseShortcut(),- busy,- }}- />- </>- ) : (- <>- <StepSection label={t("onboarding.wake_word.word_label")}>- <div className="space-y-3 border-y border-border/70 py-4">- <p className="text-sm text-muted-foreground">{t("onboarding.wake_word.body")}</p>- <div className="flex items-center gap-2">- <span className="inline-flex h-8 items-center rounded-control bg-secondary px-3 text-sm font-medium text-foreground">- {t("onboarding.wake_word.prefix")}- </span>- <Field- aria-label={t("onboarding.wake_word.input_label")}- type="text"- value={word}- maxLength={56}- autoFocus- onChange={(e) => setWordReset(e.target.value)}- placeholder={t("onboarding.wake_word.placeholder")}- className="max-w-xs"- />- </div>- {trimmed.length >= 2 && derivedName ? (- <p className="text-sm text-muted-foreground">- {t("onboarding.wake_word.derived_name").replace("{0}", derivedName)}- </p>- ) : null}- <p className="text-sm text-muted-foreground">- {t("onboarding.wake_word.notice")}{" "}- <button- type="button"- onClick={() => setShowRefs((v) => !v)}- className="text-primary underline-offset-4 hover:underline"- >- {t("onboarding.wake_word.learn_more")}- </button>- </p>- {showRefs && refs.length > 0 && (- <div className="border-l-2 border-border pl-3 text-sm">- <div className="font-medium">{t("onboarding.wake_word.references_title")}</div>- <ul className="mt-1 space-y-0.5">- {refs.map((r) => (- <li key={r.url}>- <a- href={r.url}- target="_blank"- rel="noreferrer"- className="text-primary underline-offset-4 hover:underline"- >- {r.label}- </a>- </li>- ))}- </ul>- <p className="mt-1 text-muted-foreground">- {t("onboarding.wake_word.references_caveat")}- </p>- </div>- )}- </div>- </StepSection>-- <StepSection label={t("onboarding.wake_word.mic_check.title")}>- <div className="flex flex-wrap items-center gap-3">- <Button- variant="quiet"- disabled={micCheck.state === "checking"}- onClick={() => void runMicCheck()}- data-testid="wake-mic-test"- >- <Mic className="h-3.5 w-3.5" />- {micCheck.state === "checking"- ? t("onboarding.wake_word.mic_check.checking")- : t("onboarding.wake_word.mic_check.test_button")}- </Button>- <div className="min-w-0 flex-1">{micLine}</div>- </div>- </StepSection>-- <ConsentLine checked={ack} onChange={setAck} testId="wake-ack">- {t("onboarding.wake_word.ack_label")}- </ConsentLine>-- {errorBlock}-- {degraded ? (- // The chosen word has no pretrained model and local Whisper is- // absent. Offer the one-click local-speech install, or continue- // with the honest knowledge that the wake word stays off until- // the pack lands.- <div className="space-y-3">- <StatusLine tone="warning">{t("settings_view.wake_word.needs_whisper_hint")}</StatusLine>- {install.state === "running" && (- <StatusLine tone="muted">- {t("settings_view.wake_word.enable_local_installing")}- </StatusLine>- )}- {install.state === "done" && (- <StatusLine tone="ok">{t("settings_view.wake_word.enable_local_done")}</StatusLine>- )}- {install.state === "error" && (- <StatusLine tone="warning">- {t("settings_view.wake_word.enable_local_error")}- </StatusLine>- )}- <StepFooter- onBack={goBack}- primary={{- label: t("onboarding.wake_word.continue_anyway"),- onClick: () => void onContinueDegraded(),- busy,- }}- secondary={- install.state !== "done"- ? {- label:- install.state === "error"- ? t("settings_view.wake_word.enable_local_retry")- : t("settings_view.wake_word.enable_local_button"),- onClick: () => void startInstall(),- busy: install.state === "running",- }- : null- }- />- </div>- ) : (- <StepFooter- onBack={goBack}- primary={{- label: busy ? t("onboarding.wake_word.saving") : t("onboarding.wake_word.cta"),- onClick: () => void onSaveWake(),- disabled: !canSave,- busy,- }}- />- )}- </>- )}- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WelcomeStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WelcomeStep.test.tsxdeleted file mode 100644index f7fe7f183c..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WelcomeStep.test.tsx+++ /dev/null@@ -1,109 +0,0 @@-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { afterEach, expect, it, vi } from "vitest";-vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));-vi.mock("../IntroSequence", () => ({ IntroSequence: () => <div data-testid="intro" /> }));-import { WelcomeStep } from "./WelcomeStep";-afterEach(() => {- cleanup();- vi.unstubAllGlobals();-});--const base = {- goBack: vi.fn(),- skip: vi.fn(),- isFirst: true,- isLast: false,- summaries: {},-};--it("renders the intro and the capability register; continue stays disabled until accepted", () => {- render(- <WelcomeStep- {...base}- onb={{ acceptTerms: vi.fn() } as never}- goNext={vi.fn()}- setSummary={vi.fn()}- setGap={vi.fn()}- gaps={{}}- />,- );- expect(screen.getByTestId("intro")).toBeDefined();- expect(screen.getByText("onboarding.welcome.cap_commands")).toBeDefined();- expect(screen.getByText("onboarding.welcome.cap_mistakes")).toBeDefined();- const cta = screen.getByTestId("onboarding-primary") as HTMLButtonElement;- expect(cta.disabled).toBe(true);-});--it("AWAITS the terms record before advancing and reports the summary", async () => {- const goNext = vi.fn();- const setSummary = vi.fn();- let resolveAccept: () => void = () => undefined;- const acceptTerms = vi.fn(- () =>- new Promise<void>((resolve) => {- resolveAccept = resolve;- }),- );- render(- <WelcomeStep- {...base}- onb={{ acceptTerms } as never}- goNext={goNext}- setSummary={setSummary}- setGap={vi.fn()}- gaps={{}}- />,- );- fireEvent.click(screen.getByTestId("onboarding-accept"));- expect(setSummary).toHaveBeenLastCalledWith("onboarding.welcome.summary_accepted");- fireEvent.click(screen.getByTestId("onboarding-primary"));- expect(acceptTerms).toHaveBeenCalled();- // Not yet: the POST is still in flight.- expect(goNext).not.toHaveBeenCalled();- resolveAccept();- await waitFor(() => expect(goNext).toHaveBeenCalled());-});--it("a failed acceptance stays on the step and says so", async () => {- const goNext = vi.fn();- render(- <WelcomeStep- {...base}- onb={{ acceptTerms: vi.fn().mockRejectedValue(new Error("HTTP 503")) } as never}- goNext={goNext}- setSummary={vi.fn()}- setGap={vi.fn()}- gaps={{}}- />,- );- fireEvent.click(screen.getByTestId("onboarding-accept"));- fireEvent.click(screen.getByTestId("onboarding-primary"));- await waitFor(() =>- expect(screen.getByText("onboarding.welcome.accept_failed")).toBeDefined(),- );- expect(goNext).not.toHaveBeenCalled();-});--it("decline posts decline-terms and renders the goodbye state", async () => {- const calls: string[] = [];- vi.stubGlobal(- "fetch",- vi.fn((url: string) => {- calls.push(url);- return Promise.resolve({ ok: true, json: () => Promise.resolve({}) });- }),- );- render(- <WelcomeStep- {...base}- onb={{ acceptTerms: vi.fn() } as never}- goNext={vi.fn()}- setSummary={vi.fn()}- setGap={vi.fn()}- gaps={{}}- />,- );- fireEvent.click(screen.getByTestId("onboarding-decline"));- expect(screen.getByTestId("onboarding-declined")).toBeDefined();- await waitFor(() => expect(calls).toContain("/api/onboarding/decline-terms"));-});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WelcomeStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WelcomeStep.tsxdeleted file mode 100644index aa1fe77e92..0000000000--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WelcomeStep.tsx+++ /dev/null@@ -1,143 +0,0 @@-import { useEffect, useState } from "react";-import { AlertTriangle, Cloud, CreditCard, Monitor, Terminal } from "lucide-react";-import { useT } from "@/i18n";-import type { StepProps } from "../OnboardingFlow";-import { IntroSequence } from "../IntroSequence";-import { ConsentLine, Register, StatusLine, StepFooter, StepSection } from "../primitives";--/**- * The first step is the consent moment. It replaced a separate "I understand- * the risks" card (a checkbox and a warning emoji) with the plain list of- * what the assistant actually does on this machine, then the one line of- * acceptance the legal posture needs.- *- * Acceptance is AWAITED: the Terms record must exist before the guide goes- * on. A warming backend answers this route from the fast-boot path, so the- * wait is normally invisible; a real failure shows in place and the step- * stays. Declining is a real, equal-weight choice: it asks the backend to- * quit the whole app and renders a terminal goodbye state (the desktop- * window disappears with the process). Nothing is persisted on decline —- * the next start shows this step again.- */-export function WelcomeStep({ onb, goNext, setSummary }: StepProps) {- const t = useT();- const [accepted, setAccepted] = useState(false);- const [busy, setBusy] = useState(false);- const [error, setError] = useState<string | null>(null);- const [declined, setDeclined] = useState(false);- const [terms, setTerms] = useState<string | null>(null);- const [showTerms, setShowTerms] = useState(false);-- useEffect(() => {- setSummary(accepted ? t("onboarding.welcome.summary_accepted") : null);- }, [accepted, setSummary, t]);-- const toggleTerms = async () => {- setShowTerms((v) => !v);- if (terms === null) {- try {- const res = await fetch("/api/onboarding/terms");- setTerms(res.ok ? ((await res.json()) as { text: string }).text : "");- } catch {- setTerms("");- }- }- };-- const proceed = async () => {- if (!accepted || busy) return;- setBusy(true);- setError(null);- try {- await onb.acceptTerms();- goNext();- } catch {- setError(t("onboarding.welcome.accept_failed"));- } finally {- setBusy(false);- }- };-- const decline = async () => {- // Show the goodbye state first — the backend kills the process moments- // after answering, so this screen is the last thing the browser renders.- setDeclined(true);- try {- await fetch("/api/onboarding/decline-terms", { method: "POST" });- } catch {- // Best-effort: a warming/erroring backend cannot block the goodbye- // screen; the user closes the window either way.- }- };-- if (declined) {- return (- <div className="max-w-xl space-y-3 pt-6" data-testid="onboarding-declined">- <h3 className="text-lg font-semibold tracking-tight">- {t("onboarding.welcome.declined_title")}- </h3>- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.welcome.declined_body")}- </p>- </div>- );- }-- const capabilities = [- { key: "commands", icon: <Terminal className="h-4 w-4" />, text: t("onboarding.welcome.cap_commands") },- { key: "screen", icon: <Monitor className="h-4 w-4" />, text: t("onboarding.welcome.cap_screen") },- { key: "cloud", icon: <Cloud className="h-4 w-4" />, text: t("onboarding.welcome.cap_cloud") },- { key: "costs", icon: <CreditCard className="h-4 w-4" />, text: t("onboarding.welcome.cap_costs") },- { key: "mistakes", icon: <AlertTriangle className="h-4 w-4" />, text: t("onboarding.welcome.cap_mistakes") },- ];-- return (- <div className="space-y-8">- <IntroSequence />-- <StepSection label={t("onboarding.welcome.capabilities_label")}>- <Register- items={capabilities.map((c) => ({ key: c.key, icon: c.icon, children: c.text }))}- />- </StepSection>-- <div className="space-y-3">- <p className="text-sm leading-relaxed text-muted-foreground">- {t("onboarding.welcome.liability")}- </p>- <button- type="button"- className="text-sm text-muted-foreground underline underline-offset-4 hover:text-foreground"- onClick={() => void toggleTerms()}- >- {showTerms ? t("onboarding.welcome.hide_terms") : t("onboarding.welcome.view_terms")}- </button>- {showTerms && (- <pre className="max-h-48 overflow-y-auto whitespace-pre-wrap border-l-2 border-border py-1 pl-3 font-sans text-xs leading-relaxed text-muted-foreground scrollbar-jarvis">- {terms ?? t("onboarding.welcome.terms_loading")}- </pre>- )}- </div>-- <ConsentLine checked={accepted} onChange={setAccepted} testId="onboarding-accept">- {t("onboarding.welcome.accept_label")}- </ConsentLine>-- {error && <StatusLine tone="error">{error}</StatusLine>}-- <StepFooter- primary={{- label: t("onboarding.welcome.proceed"),- onClick: () => void proceed(),- disabled: !accepted,- busy,- }}- secondary={{- label: t("onboarding.welcome.decline"),- onClick: () => void decline(),- testId: "onboarding-decline",- }}- />- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/GuidedTour.tsx b/jarvis/ui/web/frontend/src/components/onboarding/tour/GuidedTour.tsxnew file mode 100644index 0000000000..5ff732d931--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/GuidedTour.tsx@@ -0,0 +1,264 @@+import { useCallback, useEffect, useRef, useState } from "react";+import { MascotGigi } from "@/components/MascotGigi";+import { fill, useLocaleChunk, useT } from "@/i18n";+import { useEventStore } from "@/store/events";+import { useHomeStore } from "@/store/home";+import type { HomeSurface } from "@/lib/homeSurface";+import { cn } from "@/lib/utils";+import { FOCUS_RING } from "@/components/agentic/controls";+import { QuietAction } from "../ui";+import { Spotlight } from "./Spotlight";+import { nextStepIndex, TOUR_STEPS, type Rect, type TourEffect } from "./tourSteps";++/** How long a step waits for its element to appear (a section may still be loading). */+const FIND_TIMEOUT_MS = 2500;+const FIND_POLL_MS = 100;+/** Re-measure while shown — cheap, and it catches layout shifts no observer reports. */+const TRACK_MS = 400;+const STEP_KEY = "jarvis.tour.step";++function findAnchor(anchor: string): HTMLElement | null {+ const nodes = document.querySelectorAll<HTMLElement>(`[data-tour="${anchor}"]`);+ for (const el of nodes) {+ const r = el.getBoundingClientRect();+ if (r.width > 0 && r.height > 0) return el;+ }+ return null;+}++function rectOf(el: HTMLElement): Rect {+ const r = el.getBoundingClientRect();+ return { x: r.left, y: r.top, w: r.width, h: r.height };+}++function sameRect(a: Rect | null, b: Rect | null): boolean {+ if (!a || !b) return a === b;+ return (+ Math.abs(a.x - b.x) < 0.5 &&+ Math.abs(a.y - b.y) < 0.5 &&+ Math.abs(a.w - b.w) < 0.5 &&+ Math.abs(a.h - b.h) < 0.5+ );+}++function readSavedStep(): number {+ try {+ const raw = Number(window.sessionStorage.getItem(STEP_KEY));+ return Number.isInteger(raw) && raw > 0 && raw < TOUR_STEPS.length ? raw : 0;+ } catch {+ return 0;+ }+}++function saveStep(index: number | null): void {+ try {+ if (index === null) window.sessionStorage.removeItem(STEP_KEY);+ else window.sessionStorage.setItem(STEP_KEY, String(index));+ } catch {+ // Storage may be blocked; the tour then restarts from the top after a reload.+ }+}++/**+ * The guided tour of the real app, shown once after first-run setup.+ *+ * It walks the actual interface: dims the window, opens a hole over one+ * control at a time, and explains it in a small card with the mascot. Where+ * a step needs another place in the app, the tour navigates there itself —+ * into the agents' world and back — and when it ends it puts the app back on+ * the home screen. It never presses anything that could start work or cost+ * money; clicking the highlighted element yourself simply moves the tour on.+ *+ * Escape or "Skip tour" ends it at any point. Either way the backend records+ * it as seen, so it does not come back on its own.+ */+export function GuidedTour({ onDone }: { onDone: () => void }) {+ const t = useT();+ const ready = useLocaleChunk("onboarding");+ const [index, setIndex] = useState(readSavedStep);+ const [rect, setRect] = useState<Rect | null>(null);+ const [cue, setCue] = useState(0);+ const anchorRef = useRef<HTMLElement | null>(null);+ const originalSurface = useRef<HomeSurface>(useHomeStore.getState().surface);+ const doneRef = useRef(false);+ const nextButton = useRef<HTMLButtonElement>(null);+ const step = TOUR_STEPS[index];++ const run = useCallback((effect: TourEffect | undefined) => {+ if (!effect) return;+ const nav = useEventStore.getState();+ if (effect === "home-voice") {+ if (nav.activeSection !== "chats") nav.setActiveSection("chats");+ if (useHomeStore.getState().surface !== "voice") useHomeStore.getState().setSurface("voice");+ } else if (effect === "open-agents") {+ if (nav.activeSection !== "agents") nav.setActiveSection("agents");+ } else if (effect === "back-home") {+ if (nav.activeSection !== "chats") nav.setActiveSection("chats");+ }+ }, []);++ const finish = useCallback(() => {+ if (doneRef.current) return;+ doneRef.current = true;+ saveStep(null);+ // Leave the app where a new user expects it: home, on the surface they had.+ const nav = useEventStore.getState();+ if (nav.activeSection !== "chats") nav.setActiveSection("chats");+ if (useHomeStore.getState().surface !== originalSurface.current) {+ useHomeStore.getState().setSurface(originalSurface.current);+ }+ onDone();+ }, [onDone]);++ const advance = useCallback(() => {+ run(TOUR_STEPS[index]?.onExit);+ const target = nextStepIndex(index);+ if (target === null) {+ finish();+ return;+ }+ saveStep(target);+ setIndex(target);+ setCue((c) => c + 1);+ }, [index, run, finish]);++ // Enter the step: move the app if the step asks, then wait for its element.+ useEffect(() => {+ if (!ready || !step) return;+ run(step.onEnter);+ anchorRef.current = null;+ let cancelled = false;+ let timer = 0;+ const started = performance.now();+ const poll = () => {+ if (cancelled) return;+ const el = findAnchor(step.anchor);+ if (el) {+ anchorRef.current = el;+ setRect(rectOf(el));+ return;+ }+ if (performance.now() - started < FIND_TIMEOUT_MS) {+ timer = window.setTimeout(poll, FIND_POLL_MS);+ return;+ }+ // The element never showed: a step that is optional goes, any other+ // step explains itself from the middle of the window.+ if (step.skipIfMissing) advance();+ else setRect(null);+ };+ timer = window.setTimeout(poll, 0);+ return () => {+ cancelled = true;+ window.clearTimeout(timer);+ };+ // `advance` changes with the index, which this effect already follows.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [index, ready]);++ // Follow the element while it is shown: its own size changes, the window,+ // any scrolling container, and a slow safety net for layout shifts.+ useEffect(() => {+ if (!ready) return;+ let frame = 0;+ const measure = () => {+ cancelAnimationFrame(frame);+ frame = requestAnimationFrame(() => {+ const el = anchorRef.current;+ if (!el || !el.isConnected) {+ const again = step ? findAnchor(step.anchor) : null;+ if (!again) return;+ anchorRef.current = again;+ }+ const next = rectOf(anchorRef.current!);+ setRect((prev) => (sameRect(prev, next) ? prev : next));+ });+ };+ const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : null;+ if (anchorRef.current && ro) ro.observe(anchorRef.current);+ window.addEventListener("resize", measure);+ window.addEventListener("scroll", measure, true);+ const interval = window.setInterval(measure, TRACK_MS);+ return () => {+ cancelAnimationFrame(frame);+ ro?.disconnect();+ window.removeEventListener("resize", measure);+ window.removeEventListener("scroll", measure, true);+ window.clearInterval(interval);+ };+ }, [ready, rect === null, step]);++ // Clicking the highlighted element counts as Next; Escape ends the tour.+ useEffect(() => {+ if (!step) return;+ const onClick = (event: MouseEvent) => {+ const target = event.target as Element | null;+ if (target?.closest?.(`[data-tour="${step.anchor}"]`)) advance();+ };+ const onKey = (event: KeyboardEvent) => {+ if (event.key === "Escape") finish();+ };+ document.addEventListener("click", onClick, true);+ window.addEventListener("keydown", onKey);+ return () => {+ document.removeEventListener("click", onClick, true);+ window.removeEventListener("keydown", onKey);+ };+ }, [step, advance, finish]);++ useEffect(() => {+ if (!ready) return;+ const timer = window.setTimeout(() => nextButton.current?.focus({ preventScroll: true }), 360);+ return () => window.clearTimeout(timer);+ }, [index, ready]);++ if (!ready || !step) return null;+ const last = nextStepIndex(index) === null;++ return (+ <Spotlight rect={rect} placement={step.placement}>+ <div+ role="dialog"+ aria-live="polite"+ aria-label={t("app_tour.label")}+ className="rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-float"+ data-testid="tour-card"+ data-step={step.id}+ >+ <div className="flex items-start gap-3">+ <MascotGigi+ size={36}+ reactToVoice={false}+ enableComments={false}+ cue={{ action: step.mascot, key: cue }}+ />+ <p className="min-w-0 flex-1 text-sm leading-relaxed text-foreground" data-testid="tour-text">+ {t(`app_tour.steps.${step.id}`)}+ </p>+ </div>+ <div className="mt-4 flex items-center gap-3">+ <button+ ref={nextButton}+ type="button"+ onClick={advance}+ data-testid="tour-next"+ className={cn(+ "h-8 rounded-lg bg-accent px-3.5 text-sm font-medium text-accent-foreground transition-opacity hover:opacity-90",+ FOCUS_RING,+ )}+ >+ {last ? t("app_tour.finish") : t("app_tour.next")}+ </button>+ <span className="text-xs text-muted-foreground">+ {fill(t("app_tour.step_of"), { current: index + 1, total: TOUR_STEPS.length })}+ </span>+ {!last && (+ <QuietAction onClick={finish} className="ml-auto text-xs" testId="tour-skip">+ {t("app_tour.skip")}+ </QuietAction>+ )}+ </div>+ </div>+ </Spotlight>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsx b/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsxnew file mode 100644index 0000000000..e48fa8af8d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsx@@ -0,0 +1,125 @@+import { motion, useReducedMotion } from "framer-motion";+import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";+import { createPortal } from "react-dom";+import { EASE_OUT } from "../ui";+import { cutout, padded, placeCard, type Rect, type TourPlacement } from "./tourSteps";++const CARD_W = 320;++function useViewport(): { w: number; h: number } {+ const [view, setView] = useState(() => ({ w: window.innerWidth, h: window.innerHeight }));+ useEffect(() => {+ const onResize = () => setView({ w: window.innerWidth, h: window.innerHeight });+ window.addEventListener("resize", onResize);+ return () => window.removeEventListener("resize", onResize);+ }, []);+ return view;+}++/**+ * The tour's stage: the window dimmed, a hole over the element being shown,+ * a glowing ring around that hole, and the tour card beside it.+ *+ * On the first frame the hole is the whole window and then shrinks onto the+ * element, so the dark visibly closes in; between steps hole, ring and card+ * all GLIDE to the next place instead of popping. The dim never takes a+ * click (`pointer-events: none`) — the app stays usable, and clicking the+ * highlighted element is the same as pressing Next. Only the card is live.+ *+ * Sits at z-110: over every section, dock and dialog, under the window's+ * caption bar (z-120) so the frameless window can still be moved and closed.+ */+export function Spotlight({+ rect,+ placement,+ children,+}: {+ rect: Rect | null;+ placement: TourPlacement;+ children: ReactNode;+}) {+ const view = useViewport();+ const reduced = useReducedMotion() ?? false;+ const [settled, setSettled] = useState(reduced);+ const cardRef = useRef<HTMLDivElement>(null);+ const [cardH, setCardH] = useState(160);++ useEffect(() => {+ if (settled) return;+ let inner = 0;+ const outer = requestAnimationFrame(() => {+ inner = requestAnimationFrame(() => setSettled(true));+ });+ return () => {+ cancelAnimationFrame(outer);+ cancelAnimationFrame(inner);+ };+ }, [settled]);++ useLayoutEffect(() => {+ const el = cardRef.current;+ if (!el) return;+ const measure = () => setCardH(el.offsetHeight || 160);+ measure();+ if (typeof ResizeObserver === "undefined") return;+ const ro = new ResizeObserver(measure);+ ro.observe(el);+ return () => ro.disconnect();+ }, []);++ const hole = rect ? padded(rect) : null;+ const whole: Rect = { x: 0, y: 0, w: view.w, h: view.h };+ // No element (centred card): the hole collapses to a point in the middle,+ // so the same clip-path shape still animates.+ const point: Rect = { x: view.w / 2, y: view.h / 2, w: 0, h: 0 };+ const clip = cutout(!settled ? whole : hole ?? point);+ const pos = placeCard(hole, placement, { w: Math.min(CARD_W, view.w - 24), h: cardH }, view);+ const glide = reduced ? "none" : "clip-path 320ms cubic-bezier(0.22,1,0.36,1)";+ const ringGlide = reduced+ ? "none"+ : "transform 320ms cubic-bezier(0.22,1,0.36,1), width 320ms cubic-bezier(0.22,1,0.36,1), height 320ms cubic-bezier(0.22,1,0.36,1)";++ return createPortal(+ <div className="pointer-events-none fixed inset-0 z-[110]" data-testid="tour-layer">+ <div+ aria-hidden+ className="absolute inset-0 bg-scrim/55"+ style={{ clipPath: clip, WebkitClipPath: clip, transition: glide }}+ data-testid="tour-dim"+ />+ {hole && settled && (+ <div+ aria-hidden+ className="absolute left-0 top-0 rounded-[14px]"+ data-testid="tour-ring"+ style={{+ width: hole.w,+ height: hole.h,+ transform: `translate(${hole.x}px, ${hole.y}px)`,+ transition: ringGlide,+ boxShadow:+ "0 0 0 2px hsl(var(--accent)), 0 0 0 6px rgb(var(--accent-rgb) / 0.22), 0 0 36px 6px rgb(var(--accent-rgb) / 0.28)",+ }}+ />+ )}+ <motion.div+ ref={cardRef}+ className="pointer-events-auto absolute left-0 top-0"+ style={{ width: Math.min(CARD_W, view.w - 24) }}+ initial={false}+ animate={{ x: pos.x, y: pos.y }}+ transition={reduced ? { duration: 0 } : { duration: 0.32, ease: EASE_OUT }}+ data-tour-card=""+ >+ <motion.div+ initial={reduced ? false : { opacity: 0, scale: 0.94 }}+ animate={{ opacity: 1, scale: 1 }}+ transition={{ duration: 0.24, ease: EASE_OUT, delay: reduced ? 0 : 0.12 }}+ >+ {children}+ </motion.div>+ </motion.div>+ </div>,+ document.body,+ );+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.ts b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.tsnew file mode 100644index 0000000000..8161ddc5be--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.ts@@ -0,0 +1,88 @@+import { readdirSync, readFileSync, statSync } from "node:fs";+import { join } from "node:path";+import { describe, expect, it } from "vitest";+import en from "@/i18n/locales/onboarding/en.json";+import { cutout, placeCard, TOUR_STEPS } from "./tourSteps";++const SRC = join(__dirname, "..", "..", "..");++function sources(dir: string): string[] {+ const out: string[] = [];+ for (const name of readdirSync(dir)) {+ const full = join(dir, name);+ if (statSync(full).isDirectory()) out.push(...sources(full));+ else if (/\.tsx?$/.test(name) && !/\.test\.tsx?$/.test(name)) out.push(full);+ }+ return out;+}++describe("tour steps", () => {+ it("have unique ids and a text in the locale", () => {+ const ids = TOUR_STEPS.map((s) => s.id);+ expect(new Set(ids).size).toBe(ids.length);+ const texts = (en as { app_tour: { steps: Record<string, string> } }).app_tour.steps;+ for (const id of ids) expect(texts[id], id).toBeTruthy();+ });++ it("point only at anchors the app actually sets", () => {+ const code = sources(SRC)+ .filter((f) => !f.includes(`${join("onboarding", "tour")}`))+ .map((f) => readFileSync(f, "utf8"))+ .join("\n");+ for (const step of TOUR_STEPS) {+ const literal = code.includes(`data-tour="${step.anchor}"`);+ // Sidebar rows get theirs from a template: data-tour={`nav-${item.id}`}.+ const templated = step.anchor.startsWith("nav-") && code.includes("data-tour={`nav-${item.id}`}");+ expect(literal || templated, step.anchor).toBe(true);+ }+ });++ it("never press a control — every effect is navigation", () => {+ for (const step of TOUR_STEPS) {+ for (const effect of [step.onEnter, step.onExit]) {+ if (effect) expect(["home-voice", "open-agents", "back-home"]).toContain(effect);+ }+ }+ });++ it("ends where it started, on the voice bar", () => {+ expect(TOUR_STEPS[0].anchor).toBe("voice-bar");+ expect(TOUR_STEPS[TOUR_STEPS.length - 1].anchor).toBe("voice-bar");+ });+});++describe("cutout", () => {+ it("keeps the same number of points for any hole, so it can animate", () => {+ const a = cutout({ x: 0, y: 0, w: 1200, h: 800 });+ const b = cutout({ x: 40, y: 60, w: 200, h: 36 });+ expect(a.split(",").length).toBe(b.split(",").length);+ expect(b).toContain("40px 60px");+ expect(b).toContain("240px 96px");+ expect(b.startsWith("polygon(evenodd,")).toBe(true);+ });+});++describe("placeCard", () => {+ const view = { w: 1280, h: 800 };+ const card = { w: 320, h: 160 };++ it("sits to the right of a sidebar row", () => {+ const pos = placeCard({ x: 8, y: 200, w: 220, h: 36 }, "right", card, view);+ expect(pos.x).toBe(8 + 220 + 14);+ expect(pos.y).toBe(200 + 18 - 80);+ });++ it("stays inside the window near an edge", () => {+ const pos = placeCard({ x: 8, y: 770, w: 220, h: 20 }, "right", card, view);+ expect(pos.y + card.h).toBeLessThanOrEqual(view.h - 12);+ });++ it("flips above when there is no room below", () => {+ const pos = placeCard({ x: 400, y: 700, w: 400, h: 60 }, "below", card, view);+ expect(pos.y).toBe(700 - 14 - 160);+ });++ it("centres the card without an element", () => {+ expect(placeCard(null, "below", card, view)).toEqual({ x: 480, y: 320 });+ });+});diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.tsnew file mode 100644index 0000000000..536ebe284f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts@@ -0,0 +1,122 @@+/**+ * The guided tour of the real app, as data.+ *+ * Each step points at one element that carries `data-tour="<anchor>"` — a+ * stable hook set for this purpose, never a CSS class or a test id (tests+ * rename those freely). A step may move the app before it points (`onEnter`)+ * or after the user moves on (`onExit`); the tour only ever NAVIGATES. It+ * never presses a control that could start something — the voice bar, for+ * one, opens a paid call, so the tour points at it and leaves the click to+ * the user.+ */+import type { MascotAction } from "@/components/MascotGigi";++/** What a step may do to the app. Every effect is plain navigation. */+export type TourEffect = "home-voice" | "open-agents" | "back-home";++export type TourPlacement = "right" | "below" | "above" | "inside";++export interface TourStep {+ /** Also the i18n key: `app_tour.steps.<id>`. */+ id: string;+ anchor: string;+ placement: TourPlacement;+ onEnter?: TourEffect;+ onExit?: TourEffect;+ /** Drop the step when its anchor never shows (e.g. a section this build lacks). */+ skipIfMissing?: boolean;+ mascot: MascotAction;+}++export const TOUR_STEPS: readonly TourStep[] = [+ { id: "voice", anchor: "voice-bar", placement: "below", onEnter: "home-voice", mascot: "wave" },+ { id: "new_chat", anchor: "new-chat", placement: "right", mascot: "look-right" },+ { id: "agents", anchor: "nav-agents", placement: "right", onExit: "open-agents", mascot: "look-left" },+ {+ id: "agents_world",+ anchor: "agents-page",+ placement: "inside",+ onEnter: "open-agents",+ onExit: "back-home",+ skipIfMissing: true,+ mascot: "jump",+ },+ { id: "voice_hub", anchor: "nav-dictation", placement: "right", onEnter: "back-home", mascot: "look-right" },+ { id: "artifacts", anchor: "nav-visualization", placement: "right", skipIfMissing: true, mascot: "look-left" },+ { id: "ide", anchor: "nav-agentic-ide", placement: "right", skipIfMissing: true, mascot: "spin" },+ { id: "plugins", anchor: "nav-plugins", placement: "right", skipIfMissing: true, mascot: "look-right" },+ { id: "settings", anchor: "settings", placement: "right", mascot: "look-left" },+ { id: "done", anchor: "voice-bar", placement: "below", onEnter: "home-voice", mascot: "jump" },+];++export function nextStepIndex(index: number): number | null {+ return index + 1 < TOUR_STEPS.length ? index + 1 : null;+}++export interface Rect {+ x: number;+ y: number;+ w: number;+ h: number;+}++/** Space kept between the highlighted element and the ring around it. */+export const PAD = 8;++/**+ * The dim layer's clip path: the whole window minus a hole over `r`. Both+ * shapes have the same number of points, so a hole that starts as the whole+ * window and shrinks onto the element is a smooth transition — the dark+ * closes in on what is being shown.+ */+export function cutout(r: Rect): string {+ const x1 = Math.round(r.x);+ const y1 = Math.round(r.y);+ const x2 = Math.round(r.x + r.w);+ const y2 = Math.round(r.y + r.h);+ return `polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, ${x1}px ${y1}px, ${x1}px ${y2}px, ${x2}px ${y2}px, ${x2}px ${y1}px, ${x1}px ${y1}px)`;+}++/** The anchor's rect grown by the ring padding. */+export function padded(r: Rect, pad = PAD): Rect {+ return { x: r.x - pad, y: r.y - pad, w: r.w + pad * 2, h: r.h + pad * 2 };+}++/**+ * Where the tour card goes for a highlighted rect, kept fully inside the+ * window (`margin` from every edge). `inside` sits in the element's top-right+ * corner — for a whole page. With no rect the card is centred.+ */+export function placeCard(+ rect: Rect | null,+ placement: TourPlacement,+ card: { w: number; h: number },+ view: { w: number; h: number },+ gap = 14,+ margin = 12,+): { x: number; y: number } {+ const clampX = (x: number) => Math.min(Math.max(x, margin), Math.max(margin, view.w - card.w - margin));+ const clampY = (y: number) => Math.min(Math.max(y, margin), Math.max(margin, view.h - card.h - margin));+ if (!rect) return { x: clampX((view.w - card.w) / 2), y: clampY((view.h - card.h) / 2) };+ switch (placement) {+ case "right": {+ const x = rect.x + rect.w + gap;+ // No room on the right: fall back below the element.+ if (x + card.w + margin > view.w) {+ return { x: clampX(rect.x), y: clampY(rect.y + rect.h + gap) };+ }+ return { x: clampX(x), y: clampY(rect.y + rect.h / 2 - card.h / 2) };+ }+ case "below": {+ const y = rect.y + rect.h + gap;+ if (y + card.h + margin > view.h) {+ return { x: clampX(rect.x + rect.w / 2 - card.w / 2), y: clampY(rect.y - gap - card.h) };+ }+ return { x: clampX(rect.x + rect.w / 2 - card.w / 2), y: clampY(y) };+ }+ case "above":+ return { x: clampX(rect.x + rect.w / 2 - card.w / 2), y: clampY(rect.y - gap - card.h) };+ case "inside":+ return { x: clampX(rect.x + rect.w - card.w - 24), y: clampY(rect.y + 24) };+ }+}diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts b/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.tsnew file mode 100644index 0000000000..5f12b4d269--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts@@ -0,0 +1,6 @@+/**+ * Window event that asks the onboarding gate to replay the app tour. Its own+ * module so a caller (Settings) does not import the gate itself — tests mock+ * the gate wholesale.+ */+export const TOUR_START_EVENT = "jarvis:tour-start";diff --git a/jarvis/ui/web/frontend/src/components/onboarding/ui.tsx b/jarvis/ui/web/frontend/src/components/onboarding/ui.tsxnew file mode 100644index 0000000000..e15f84e621--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/onboarding/ui.tsx@@ -0,0 +1,250 @@+/**+ * The handful of pieces every beat of the first-run card is built from.+ *+ * One rule runs through all of them: a beat has exactly ONE way forward that+ * looks like a button — the full-width ink action at its foot. Everything else+ * (later, back, decline, the terms) is quiet text, so the eye never has to+ * choose between two equal buttons.+ */+import { motion, useReducedMotion } from "framer-motion";+import { Check, Loader2 } from "lucide-react";+import type { ReactNode } from "react";+import { FOCUS_RING } from "@/components/agentic/controls";+import { cn } from "@/lib/utils";++/** The guide's one easing curve: quick out, soft landing. */+export const EASE_OUT = [0.22, 1, 0.36, 1] as const;++/**+ * Children rise into place one after another — 10 px up and in, 40 ms apart.+ * Nothing grows out of nothing; with reduced motion everything is simply there.+ */+export function Rise({+ index = 0,+ className,+ children,+}: {+ index?: number;+ className?: string;+ children: ReactNode;+}) {+ const reduced = useReducedMotion() ?? false;+ if (reduced) return <div className={className}>{children}</div>;+ return (+ <motion.div+ className={className}+ initial={{ opacity: 0, y: 10 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.32, ease: EASE_OUT, delay: 0.06 + index * 0.04 }}+ >+ {children}+ </motion.div>+ );+}++/** The beat's one way forward: full width, ink on the room colour. */+export function PrimaryAction({+ children,+ onClick,+ disabled,+ busy,+ testId,+}: {+ children: ReactNode;+ onClick: () => void;+ disabled?: boolean;+ busy?: boolean;+ testId?: string;+}) {+ return (+ <button+ type="button"+ onClick={onClick}+ disabled={disabled || busy}+ data-testid={testId ?? "onboarding-primary"}+ className={cn(+ "flex h-11 w-full items-center justify-center gap-2 rounded-lg bg-foreground px-4",+ "text-base font-medium text-background transition-[transform,opacity] duration-150",+ "hover:opacity-90 active:scale-[0.98] disabled:cursor-not-allowed disabled:opacity-40",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card",+ )}+ >+ {busy && <Loader2 aria-hidden className="h-4 w-4 animate-spin" />}+ {children}+ </button>+ );+}++/** Every other action: small, muted text that brightens on hover. */+export function QuietAction({+ children,+ onClick,+ disabled,+ testId,+ className,+}: {+ children: ReactNode;+ onClick: () => void;+ disabled?: boolean;+ testId?: string;+ className?: string;+}) {+ return (+ <button+ type="button"+ onClick={onClick}+ disabled={disabled}+ data-testid={testId}+ className={cn(+ "rounded-sm text-sm text-muted-foreground transition-colors hover:text-foreground",+ "disabled:cursor-not-allowed disabled:opacity-40",+ FOCUS_RING,+ className,+ )}+ >+ {children}+ </button>+ );+}++export type StatusTone = "ok" | "warning" | "error" | "muted";++/**+ * A live result, said in one line: a dot in the status hue and the sentence.+ * Every beat that checks something (a key, the microphone, a permission)+ * answers with one of these, in place, instead of a toast somewhere else.+ */+export function Status({+ tone,+ children,+ testId,+}: {+ tone: StatusTone;+ children: ReactNode;+ testId?: string;+}) {+ return (+ <p+ role="status"+ data-testid={testId}+ data-tone={tone}+ className={cn(+ "flex items-start gap-2 text-sm leading-relaxed",+ tone === "error" ? "text-destructive" : tone === "muted" ? "text-muted-foreground" : "text-foreground",+ )}+ >+ <span+ aria-hidden+ className={cn(+ "mt-[7px] h-1.5 w-1.5 shrink-0 rounded-full",+ tone === "ok" && "bg-success",+ tone === "warning" && "bg-warning",+ tone === "error" && "bg-destructive",+ tone === "muted" && "bg-muted-foreground/60",+ )}+ />+ <span className="min-w-0">{children}</span>+ </p>+ );+}++/** A checkbox sentence — the consent and the wake-word responsibility. */+export function CheckLine({+ checked,+ onChange,+ children,+ testId,+}: {+ checked: boolean;+ onChange: (next: boolean) => void;+ children: ReactNode;+ testId?: string;+}) {+ return (+ <label className="flex cursor-pointer items-start gap-3 text-sm leading-relaxed text-foreground">+ <input+ type="checkbox"+ data-testid={testId}+ className={cn("mt-0.5 h-4 w-4 shrink-0 accent-[hsl(var(--accent))]", FOCUS_RING)}+ checked={checked}+ onChange={(e) => onChange(e.target.checked)}+ />+ <span>{children}</span>+ </label>+ );+}++/**+ * One selectable tile of a choice (radio semantics). The selected tile takes+ * the accent edge and a small check; the others stay on the card ground.+ */+export function Option({+ selected,+ onSelect,+ title,+ body,+ badge,+ testId,+}: {+ selected: boolean;+ onSelect: () => void;+ title: string;+ body?: ReactNode;+ badge?: string | null;+ testId?: string;+}) {+ return (+ <button+ type="button"+ role="radio"+ aria-checked={selected}+ onClick={onSelect}+ data-testid={testId}+ className={cn(+ "relative flex w-full flex-col items-start gap-1 rounded-xl border px-4 py-3 text-left transition-colors",+ selected+ ? "border-accent bg-accent-soft"+ : "border-border bg-background hover:border-border-strong hover:bg-secondary",+ FOCUS_RING,+ )}+ >+ <span className="flex w-full items-center gap-2 pr-6">+ <span className="text-sm font-medium text-foreground">{title}</span>+ {badge && (+ <span className="rounded-full bg-accent-soft px-2 py-0.5 text-micro font-medium text-accent">+ {badge}+ </span>+ )}+ </span>+ {body && <span className="text-sm leading-snug text-muted-foreground">{body}</span>}+ {selected && (+ <span+ aria-hidden+ className="absolute right-3 top-3 flex h-4 w-4 items-center justify-center rounded-full bg-accent text-accent-foreground"+ >+ <Check className="h-3 w-3" strokeWidth={3} />+ </span>+ )}+ </button>+ );+}++/** A key combo from the backend ("f3+f4") drawn as keycaps. */+export function Keycaps({ combo }: { combo: string }) {+ const keys = combo+ .split("+")+ .map((k) => k.trim())+ .filter(Boolean);+ return (+ <span className="inline-flex items-center gap-1 align-middle">+ {keys.map((k, i) => (+ <kbd+ key={`${k}-${i}`}+ className="inline-flex h-6 min-w-6 items-center justify-center rounded-md border border-border-strong bg-background px-1.5 font-mono text-xs uppercase text-foreground"+ >+ {k.replace(/_/g, " ")}+ </kbd>+ ))}+ </span>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/ui/editorial.tsx b/jarvis/ui/web/frontend/src/components/ui/editorial.tsxnew file mode 100644index 0000000000..a632681c1e--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/ui/editorial.tsx@@ -0,0 +1,130 @@+import { ArrowLeft, ArrowRight, Loader2 } from "lucide-react";+import type { ReactNode } from "react";+import { Button, SectionLabel } from "@/components/agentic/controls";+import { useT } from "@/i18n";+import { cn } from "@/lib/utils";++/**+ * Editorial building blocks in the workspace launcher's language: hairlines+ * and type do the structuring, numbers sit in a mono register, and there is+ * one primary action at the foot. Used by setup cards that read as a short+ * document rather than a dialog (the local-models setup proposal).+ */++/** A labelled block: eyebrow on top, hairline-separated content below. */+export function StepSection({+ label,+ children,+ className,+}: {+ label: string;+ children: ReactNode;+ className?: string;+}) {+ return (+ <section className={cn("space-y-3", className)}>+ <SectionLabel>{label}</SectionLabel>+ {children}+ </section>+ );+}++/**+ * A numbered register — the same `01 / 02` list the launcher uses for its+ * terminal plan. Rows are separated by rules, never boxed.+ */+export function Register({+ items,+ className,+}: {+ items: { key: string; icon?: ReactNode; children: ReactNode }[];+ className?: string;+}) {+ return (+ <ol className={cn("border-y border-border/70", className)}>+ {items.map((item, index) => (+ <li+ key={item.key}+ className="grid grid-cols-[2.25rem_minmax(0,1fr)] items-baseline gap-2 border-b border-border/50 py-3 text-lg last:border-b-0"+ >+ <span className="font-mono text-xs tabular-nums text-muted-foreground/70">+ {(index + 1).toString().padStart(2, "0")}+ </span>+ <span className="flex min-w-0 items-start gap-2.5">+ {item.icon ? (+ <span className="mt-0.5 shrink-0 text-muted-foreground" aria-hidden>+ {item.icon}+ </span>+ ) : null}+ <span className="min-w-0 leading-relaxed">{item.children}</span>+ </span>+ </li>+ ))}+ </ol>+ );+}++export interface FooterAction {+ label: string;+ onClick: () => void;+ disabled?: boolean;+ busy?: boolean;+ testId?: string;+}++/**+ * The step footer: a rule, Back on the left, the one primary action on the+ * right, with an optional quiet secondary beside it. Every step ends here so+ * the eye always knows where "go on" lives.+ */+export function StepFooter({+ onBack,+ primary,+ secondary,+ backLabel,+ hidePrimaryArrow,+}: {+ onBack?: (() => void) | null;+ primary: FooterAction;+ secondary?: FooterAction | null;+ backLabel?: string;+ hidePrimaryArrow?: boolean;+}) {+ const t = useT();+ return (+ <footer className="mt-10 flex min-h-10 flex-wrap items-center justify-between gap-3 border-t border-border/70 pt-6">+ {onBack ? (+ <Button variant="subtle" onClick={onBack} data-testid="editorial-back">+ <ArrowLeft className="h-3.5 w-3.5" />+ {backLabel ?? t("common.back")}+ </Button>+ ) : (+ <span />+ )}+ <div className="flex flex-wrap items-center gap-2">+ {secondary ? (+ <Button+ variant="subtle"+ onClick={secondary.onClick}+ disabled={secondary.disabled || secondary.busy}+ data-testid={secondary.testId}+ >+ {secondary.busy && <Loader2 className="h-3.5 w-3.5 animate-spin" />}+ {secondary.label}+ </Button>+ ) : null}+ <Button+ variant="primary"+ className="h-10 min-w-40 px-5 text-lg"+ onClick={primary.onClick}+ disabled={primary.disabled || primary.busy}+ data-testid={primary.testId ?? "editorial-primary"}+ >+ {primary.busy && <Loader2 className="h-3.5 w-3.5 animate-spin" />}+ {primary.label}+ {!primary.busy && !hidePrimaryArrow && <ArrowRight className="h-3.5 w-3.5" />}+ </Button>+ </div>+ </footer>+ );+}diff --git a/jarvis/ui/web/frontend/src/hooks/useOnboarding.test.ts b/jarvis/ui/web/frontend/src/hooks/useOnboarding.test.tsindex 5cdc119070..e93fec4de6 100644--- a/jarvis/ui/web/frontend/src/hooks/useOnboarding.test.ts+++ b/jarvis/ui/web/frontend/src/hooks/useOnboarding.test.ts@@ -83,3 +83,21 @@ it("complete() surfaces a failed completion (throws, no event)", async () => {window.removeEventListener("jarvis:onboarding-changed", onChanged);});++it("records the finished tour and never throws on failure", async () => {+ const calls: string[] = [];+ vi.stubGlobal(+ "fetch",+ vi.fn().mockImplementation((url: string) => {+ calls.push(url);+ if (url === "/api/onboarding/tour-complete") return Promise.reject(new Error("down"));+ return Promise.resolve({ ok: true, json: () => Promise.resolve(STATE) });+ }),+ );+ const { result } = renderHook(() => useOnboarding());+ await waitFor(() => expect(result.current.state).not.toBeNull());+ await act(async () => {+ await result.current.completeTour();+ });+ expect(calls).toContain("/api/onboarding/tour-complete");+});diff --git a/jarvis/ui/web/frontend/src/hooks/useOnboarding.ts b/jarvis/ui/web/frontend/src/hooks/useOnboarding.tsindex d80d2d2859..42c02f176f 100644--- a/jarvis/ui/web/frontend/src/hooks/useOnboarding.ts+++ b/jarvis/ui/web/frontend/src/hooks/useOnboarding.ts@@ -11,6 +11,8 @@ export interface OnboardingState {skipped_steps: string[];terms: { accepted: boolean; accepted_version: string | null; current_version: string };wake_word_acknowledged: boolean;+ /** The guided tour of the real app was finished or skipped (runs after the completion restart). */+ tour_completed?: boolean;legal_references: LegalReference[];steps: string[];}@@ -33,7 +35,7 @@ const RETRY_DELAYS_MS = [500, 1000, 1500, 2000, 3000, 3000, 4000, 5000, 5000, 50/*** Loads /api/onboarding/state and exposes the onboarding mutation actions.- * `saveStep` is best-effort (progress persistence — never blocks navigation);+ * `saveStep` and `completeTour` are best-effort (progress — never block anything);* `acceptTerms`/`acknowledgeWakeWord`/`complete` propagate failures so the* calling step can surface an error. `complete` dispatches* `jarvis:onboarding-changed` only after a successful POST.@@ -101,5 +103,23 @@ export function useOnboarding(opts?: { retryDelaysMs?: number[] }) {window.dispatchEvent(new CustomEvent("jarvis:onboarding-changed"));}, []);- return { state, loading, error, refetch, saveStep, acceptTerms, acknowledgeWakeWord, complete };+ const completeTour = useCallback(async () => {+ try {+ await post("/api/onboarding/tour-complete");+ } catch {+ // Best-effort: a missed record only means the tour offers itself once more.+ }+ }, []);++ return {+ state,+ loading,+ error,+ refetch,+ saveStep,+ acceptTerms,+ acknowledgeWakeWord,+ complete,+ completeTour,+ };}diff --git a/jarvis/ui/web/frontend/src/i18n/index.ts b/jarvis/ui/web/frontend/src/i18n/index.tsindex b4174c0bca..237c5502de 100644--- a/jarvis/ui/web/frontend/src/i18n/index.ts+++ b/jarvis/ui/web/frontend/src/i18n/index.ts@@ -98,7 +98,7 @@ export function loadUiLocale(lang: UiLanguage): Promise<void> {* it mounts. Until the chunk has arrived, `t()` returns the key, so a view* that cares waits for `ready` before it paints.*/-export type LocaleChunk = "marketplace" | "local_models" | "society" | "computers";+export type LocaleChunk = "marketplace" | "local_models" | "society" | "computers" | "onboarding";const CHUNK_LOADERS: Record<LocaleChunk, Record<UiLanguage, () => Promise<unknown>>> = {marketplace: {@@ -121,6 +121,12 @@ const CHUNK_LOADERS: Record<LocaleChunk, Record<UiLanguage, () => Promise<unknowde: () => import("./locales/computers/de.json"),es: () => import("./locales/computers/es.json"),},+ // First-run guide and app tour: read on one boot, then only on a replay.+ onboarding: {+ en: () => import("./locales/onboarding/en.json"),+ de: () => import("./locales/onboarding/de.json"),+ es: () => import("./locales/onboarding/es.json"),+ },};const EXTRA: Record<UiLanguage, Record<string, unknown>[]> = { en: [], de: [], es: [] };diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 96f2e94b30..ddaab769a4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -2933,220 +2933,6 @@"install_no_binary": "{0}: Install lief durch (exit 0) aber Binary wurde nicht gefunden. PATH evtl. nicht aktualisiert.","install_failed": "{0}: Install fehlgeschlagen (exit {1}). Versuch eine andere Methode."},- "onboarding": {- "progress_label": "Einrichtungsfortschritt",- "eyebrow": "Erster Start",- "step_progress": "{0} von {1}",- "nav": {- "next": "Weiter",- "back": "Zurück",- "skip": "Überspringen"- },- "steps": {- "welcome": {- "label": "Bevor wir starten",- "title": "Bevor wir starten",- "hint": "{name} handelt auf deinem Computer. Lies, was das bedeutet, und entscheide dann."- },- "language": {- "label": "Sprache",- "title": "Welche Sprache soll {name} sprechen?",- "hint": "Oberfläche und Antworten dürfen sich unterscheiden. Beides lässt sich später in den Einstellungen ändern."- },- "api-keys": {- "label": "Verbindungen",- "title": "Live-Sprache und Jarvis-Agenten einrichten",- "hint": "Wähle den Anbieter für Live-Sprache und verbinde danach einen API-Key oder ein Abo für Jarvis-Agenten."- },- "permissions": {- "label": "Berechtigungen",- "title": "Zugriff auf diesem Mac erlauben",- "hint": "macOS fragt jede Fähigkeit einzeln ab. Erteile sie und komm zurück — die Liste aktualisiert sich selbst."- },- "wake-word": {- "label": "Aktivierung",- "title": "Wie möchtest du {name} rufen?",- "hint": "Ein eigenes Aktivierungswort oder ein Tastenkürzel. Beides lässt sich später ändern."- },- "finish": {- "label": "Bereit",- "title": "{name} ist bereit",- "hint": "Das hast du eingerichtet. Ein Neustart übernimmt alles."- }- },- "welcome": {- "capabilities_label": "Was {name} kann",- "cap_commands": "Befehle ausführen, Apps öffnen und Dateien in deinem Namen ändern",- "cap_screen": "Deinen Bildschirm sehen und auf Wunsch darauf handeln",- "cap_cloud": "Was du sagst an den KI-Anbieter senden, den du wählst",- "cap_costs": "Dein Anbieterkonto nutzen — abgerechnet wird dort, vom Anbieter",- "cap_mistakes": "Fehler machen — auch ungewollte oder zerstörerische",- "liability": "Die Nutzung erfolgt vollständig auf eigenes Risiko. Die Entwickler übernehmen keine Haftung für Schäden, Datenverlust oder andere Folgen.",- "accept_label": "Ich verstehe die Risiken und nutze {name} auf eigenes Risiko.",- "view_terms": "Die vollständigen Nutzungsbedingungen lesen",- "hide_terms": "Nutzungsbedingungen ausblenden",- "terms_loading": "Bedingungen werden geladen…",- "proceed": "Verstanden — weiter",- "decline": "Ablehnen und beenden",- "accept_failed": "Deine Zustimmung konnte nicht gespeichert werden. Prüfe, ob die App läuft, und versuche es erneut.",- "declined_title": "{name} wird beendet",- "declined_body": "Du hast die Bedingungen abgelehnt — nichts wurde eingerichtet und nichts gespeichert. Starte die App jederzeit neu; dieser Bildschirm fragt dann erneut.",- "summary_accepted": "Bedingungen akzeptiert"- },- "intro": {- "scene_1": "Dein sprachgesteuerter Assistent.",- "scene_2": "Einfach sprechen — er hört zu und handelt.",- "scene_3": "Er arbeitet im Hintergrund weiter, während du es nicht tust.",- "scene_4": "Deine Schlüssel, deine Daten, deine Regeln."- },- "language": {- "ui_label": "Sprache der Oberfläche",- "ui_hint": "Menüs, Schaltflächen und Einstellungen",- "reply_label": "Antwortsprache",- "reply_hint": "Worin {name} antwortet — Auto folgt der Sprache, in der du sprichst",- "auto": "Auto — folgt mir",- "summary": "{0} · Antworten {1}"- },- "api_keys": {- "voice_label": "01 · Real-Time-Sprache",- "voice_key_label": "Live-API-Key",- "voice_key_hint": "Ein Key für Live-Gespräche. OpenAI ist empfohlen; Gemini Live funktioniert ebenfalls.",- "agents_label": "02 · Jarvis-Agenten",- "agents_title": "Jarvis-Agenten verbinden",- "agents_hint": "Verbinde ein Abo oder nutze einen API-Key für Hintergrundaufgaben.",- "agents_ready": "Jarvis-Agenten verbunden",- "agents_missing": "Für Jarvis-Agenten fehlt noch ein API-Key oder Abo",- "agents_api_title": "API-Keys",- "agents_api_hint": "Du möchtest einen API-Key nutzen? Wähle einen Anbieter; das Key-Feld öffnet sich darunter.",- "agents_loading": "Agenten-Anbieter werden geladen…",- "agents_unavailable": "Agenten-Anbieter sind gerade nicht verfügbar.",- "agents_active": "Aktiv",- "agents_use_key": "Für Jarvis-Agenten nutzen",- "agents_subscriptions_label": "Abonnements",- "agents_subscriptions_hint": "Mit einem bestehenden Abo anmelden",- "gap_agents": "Live-Sprache ist eingerichtet, aber Jarvis-Agenten brauchen noch einen API-Key oder ein Abo.",- "providers_label": "Anbieter",- "loading": "Anbieter werden geladen…",- "load_failed": "Die Anbieterliste konnte nicht geladen werden. Du kannst später unter API-Schlüssel einen Schlüssel hinzufügen.",- "recommended": "Empfohlen",- "configured": "Schlüssel gespeichert",- "not_configured": "Kein Schlüssel",- "active": "Aktiv",- "show_more": "{0} weitere anzeigen",- "show_less": "Weniger anzeigen",- "local_label": "Kein Schlüssel zur Hand?",- "local_title": "Komplett lokal mit Ollama",- "local_checking": "Suche nach einem lokalen Ollama…",- "local_detected": "Ollama läuft auf diesem Rechner — {name} kann komplett lokal denken, ganz ohne Schlüssel.",- "local_detected_empty": "Ollama läuft, hat aber noch kein Modell — lade zuerst eines (z. B. ollama pull qwen3.5).",- "local_use_button": "Lokales Modell nutzen",- "local_active": "Lokales Gehirn aktiv — Ollama antwortet von diesem Rechner.",- "local_missing": "Installiere Ollama, und {name} läuft komplett lokal — ohne Cloud-Konto.",- "local_missing_link": "Ollama holen",- "security_note": "Schlüssel liegen im Schlüsselbund deines Systems und gehen nur an den Anbieter, den du gewählt hast — nie in Chat oder Sprache.",- "later": "Später — Schlüssel in den Einstellungen hinzufügen",- "later_hint": "Live-Sprache braucht einen Key; Jarvis-Agenten brauchen einen separaten Key oder ein Abo.",- "summary_none": "Noch kein Schlüssel",- "summary_local": "Lokal · Ollama",- "plan_label": "Wie willst du starten?",- "plan_custom_title": "Erweitert: Anbieter selbst wählen oder ein lokales Modell nutzen",- "plan_custom_body": "Die komplette Provider-Liste — jeden Teil einzeln wählen.",- "plan_applying": "Richte alles für {0} ein…",- "plan_applied": "{0} ist für Live-Sprache eingerichtet. Verbinde unten die Jarvis-Agenten.",- "plan_partial": "Das meiste ist eingerichtet; das hier hat nicht geklappt: {0}. Du kannst es später unter API-Keys nachholen.",- "plan_explainer": "Real-Time wird automatisch eingerichtet. Wähle den Anbieter für deine Live-Gespräche.",- "keys_one": "1 Schlüssel",- "keys_n": "{0} Schlüssel",- "keys_several": "Mehrere Schlüssel",- "mode_pipeline": "Pipeline",- "mode_realtime": "Realtime · Live-Stimme",- "plan_keys_from": "Schlüssel: {0}.",- "mode_explainer": "Pipeline = zuhören, denken, sprechen in drei Schritten; läuft mit jedem Anbieter. Realtime = ein Live-Sprachmodell, das antwortet, während du sprichst; das bieten nur Google Gemini und OpenAI — ein Claude- oder OpenRouter-Schlüssel allein kann kein Realtime.",- "plan_progress": "Schlüssel für diesen Plan · {0} von {1} gespeichert",- "gap_none": "Kein Live-API-Key gespeichert — Live-Sprache bleibt aus, bis du ihn unter API-Schlüssel hinzufügst.",- "gap_plan_partial": "Bei {0} fehlt der Schlüssel für {1} — die Teile, die ihn brauchen (zum Beispiel die Live-Stimme), bleiben aus, bis du ihn unter API-Schlüssel einträgst.",- "gap_custom": "Du hast die Anbieter selbst gewählt — Spracheingabe, Sprachausgabe und die Agenten brauchen eventuell eigene Schlüssel. Prüfe das unter API-Schlüssel."- },- "permissions": {- "privacy_note": "Diese Abfragen kommen von macOS. Der Installer kann sie nicht still genehmigen, und {name} umgeht die Systemeinstellungen nie. Die Schlüsselbund-Abfrage beim App-Start bedeutet nur, dass deine API-Schlüssel verschlüsselt im macOS-Schlüsselbund gespeichert werden — sie verlassen deinen Mac nie.",- "continue": "Weiter",- "text_only": "Nur mit Text weitermachen",- "summary_ready": "Erteilt",- "summary_skipped": "Nur Text",- "gap": "Nicht alle macOS-Berechtigungen sind erteilt — Sprach-, Bildschirm- und Tastaturfunktionen bleiben aus, bis du sie unter Einstellungen → Berechtigungen erlaubst."- },- "wake_word": {- "mode_label": "Aktivierung",- "mode_wake_title": "Aktivierungswort",- "mode_wake_body": "Sag jederzeit dein eigenes Wort — hört immer zu. Braucht ein kleines lokales Modell für genau dein Wort.",- "mode_shortcut_title": "Tastenkürzel",- "mode_shortcut_body": "Kein Aktivierungswort — drücke das Anruf-Kürzel, um eine Sprachsitzung zu starten.",- "selected": "Gewählt",- "shortcut_note": "Du aktivierst {name} mit dem Anruf-Kürzel statt mit einem Aktivierungswort. Du kannst es jederzeit unter Einstellungen → Sprach-Tastenkürzel anpassen.",- "word_label": "Dein Wort",- "body": "„Hey“ bleibt fest — den Rest wählst du.",- "prefix": "Hey",- "input_label": "Dein Aktivierungswort",- "placeholder": "z. B. Nova",- "notice": "Wähle ein beliebiges Wort — achte nur darauf, dass es keine fremde Marke ist.",- "learn_more": "So prüfst du das",- "references_title": "Wo du geschützte Namen prüfen kannst",- "references_caveat": "Diese Verweise sind informativ und können unvollständig oder veraltet sein — sie ersetzen deine eigene Prüfung nicht.",- "ack_label": "Ich bin für das gewählte Aktivierungswort verantwortlich.",- "cta": "Speichern und weiter",- "saving": "Wird gespeichert…",- "derived_name": "Dein Assistent heißt dann {0}",- "continue_anyway": "Trotzdem weiter",- "summary_shortcut": "Tastenkürzel",- "mic_check": {- "title": "Mikrofon",- "test_button": "Mikrofon testen",- "checking": "Höre zu…",- "listening": "Höre zu — sag jetzt dein Wort.",- "good": "Klingt gut — dein Mikrofon hat deine Stimme klar aufgenommen.",- "too_quiet": "Das war sehr leise. Dreh das Mikrofon lauter oder geh näher heran und versuche es erneut.",- "no_device": "Kein Mikrofon erkannt — du kannst die Einrichtung trotzdem abschließen und das später in den Einstellungen beheben.",- "permission_required": "Erteile unter Berechtigungen zuerst den Mikrofonzugriff, bevor du diesen Test startest.",- "error": "Das Mikrofon konnte gerade nicht geprüft werden."- },- "gap_degraded": "„{0}“ ist gespeichert, aber noch kann es niemand hören — das Aktivierungswort bleibt aus, bis das lokale Sprachmodell unter Einstellungen → Aktivierungswort installiert ist. Das Anruf-Kürzel funktioniert solange.",- "gap_not_persisted": "Die Aktivierung konnte nicht in die Konfigurationsdatei geschrieben werden und ist nach einem Neustart wieder weg — öffne Einstellungen → Aktivierungswort erneut, sobald die Datei wieder beschreibbar ist.",- "error_skip_hint": "Du kannst die Aktivierung überspringen und die Einrichtung abschließen — ein Aktivierungswort lässt sich jederzeit in den Einstellungen festlegen."- },- "finish": {- "summary_label": "Deine Einrichtung",- "skipped": "Übersprungen — jederzeit in den Einstellungen nachholbar",- "autostart_label": "{name} beim Anmelden starten",- "autostart_hint": "Läuft nach der Anmeldung leise im Hintergrund.",- "tour_label": "Neu hier?",- "tour_title": "Die 2-Minuten-Tour ansehen",- "tour_body": "Öffnet YouTube in deinem Browser.",- "boot_notice": "Der erste Start dauert etwa 10 Sekunden, während {name} aufwärmt — das ist normal.",- "start_cta": "{name} starten",- "starting": "Startet…",- "start_failed": "Die Einrichtung konnte nicht abgeschlossen werden. Prüfe, ob die App läuft, und versuche es erneut.",- "gaps_label": "Bevor du startest",- "gaps_intro": "Einige Dinge sind noch nicht eingerichtet. {name} startet, aber diese Teile bleiben aus:",- "gaps_outro": "Jeden Punkt kannst du später in den Einstellungen nachholen — nichts geht verloren.",- "gaps_ack": "Ich habe gelesen, was noch fehlt, und möchte trotzdem starten.",- "gap_skipped_language": "Sprache wurde übersprungen — {name} nutzt Englisch, bis du es in den Einstellungen änderst.",- "gap_skipped_api_keys": "Kein API-Schlüssel gespeichert — Chat und Sprache bleiben aus, bis du unter API-Schlüssel einen einträgst.",- "gap_skipped_permissions": "macOS-Berechtigungen wurden übersprungen — Sprach-, Bildschirm- und Tastaturfunktionen bleiben aus, bis du sie unter Einstellungen → Berechtigungen erlaubst.",- "gap_skipped_wake_word": "Die Aktivierung wurde übersprungen — nutze das Anruf-Kürzel oder lege in den Einstellungen ein Aktivierungswort fest."- },- "plans": {- "openai_live_label": "OpenAI GPT-Live",- "openai_live_summary": "Live-Sprache und Denken mit einem OpenAI-API-Key.",- "gemini_live_label": "Gemini Live",- "gemini_live_summary": "Live-Sprache mit einem Google-Gemini-API-Key.",- "gemini_pipeline_label": "Pipeline mit Gemini",- "gemini_pipeline_summary": "Ein Google-Gemini-Schlüssel für alles: Denken, Tool-Modell, Agenten, Stimme rein und raus.",- "gemini_realtime_label": "Realtime mit Gemini",- "gemini_realtime_summary": "Ein Google-Gemini-Schlüssel, live gesprochen: Gemini Live antwortet in Echtzeit; Tool-Modell und Agenten laufen über denselben Schlüssel.",- "gemini_openai_realtime_label": "Gemini + OpenAI",- "gemini_openai_realtime_summary": "Zwei Schlüssel, beide Engines abgedeckt: OpenAI Realtime spricht live, Gemini denkt, plant und steuert die Agenten — und die Pipeline bleibt als Reserve bereit."- }- },"language_select": {"search": "Sprache suchen","empty": "Keine Sprache passt zu deiner Suche.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex c9710e9d19..831331ec7e 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -2966,220 +2966,6 @@"install_no_binary": "{0}: install completed (exit 0) but binary not found. PATH may not be refreshed.","install_failed": "{0}: install failed (exit {1}). Try a different method."},- "onboarding": {- "progress_label": "Setup progress",- "eyebrow": "First run",- "step_progress": "{0} of {1}",- "nav": {- "next": "Continue",- "back": "Back",- "skip": "Skip"- },- "steps": {- "welcome": {- "label": "Before we start",- "title": "Before we start",- "hint": "{name} acts on your computer. Read what that means, then decide."- },- "language": {- "label": "Language",- "title": "Which language should {name} speak?",- "hint": "Interface and replies can differ. Both can be changed later in Settings."- },- "api-keys": {- "label": "Connections",- "title": "Set up live voice and Jarvis Agents",- "hint": "Choose your live voice provider, then connect an API key or subscription for Jarvis Agents."- },- "permissions": {- "label": "Permissions",- "title": "Allow access on this Mac",- "hint": "macOS asks for each capability separately. Grant them, then come back — the list updates itself."- },- "wake-word": {- "label": "Activation",- "title": "How do you want to call {name}?",- "hint": "A wake word of your own, or a keyboard shortcut. Either can be changed later."- },- "finish": {- "label": "Ready",- "title": "{name} is ready",- "hint": "Here is what you set up. One restart applies everything."- }- },- "welcome": {- "capabilities_label": "What {name} can do",- "cap_commands": "Run commands, open apps and change files on your behalf",- "cap_screen": "See your screen and act on it when you ask",- "cap_cloud": "Send what you say to the AI provider you choose",- "cap_costs": "Use your provider account — usage is billed there, by them",- "cap_mistakes": "Make mistakes — including unintended or destructive ones",- "liability": "You use it entirely at your own risk. The developers accept no liability for damage, data loss or other consequences.",- "accept_label": "I understand the risks and use {name} at my own risk.",- "view_terms": "Read the full Terms of Use",- "hide_terms": "Hide the Terms",- "terms_loading": "Loading terms…",- "proceed": "I understand — continue",- "decline": "Decline and quit",- "accept_failed": "Your acceptance could not be saved. Check that the app is running, then try again.",- "declined_title": "{name} is closing",- "declined_body": "You declined the Terms, so nothing was set up and nothing was saved. Start the app again anytime — this screen will ask again.",- "summary_accepted": "Terms accepted"- },- "intro": {- "scene_1": "Meet your voice-first assistant.",- "scene_2": "Just talk — it listens and acts.",- "scene_3": "It keeps working in the background while you don't.",- "scene_4": "Your keys, your data, your rules."- },- "language": {- "ui_label": "Interface language",- "ui_hint": "Menus, buttons and settings",- "reply_label": "Reply language",- "reply_hint": "What {name} answers in — Auto follows the language you speak",- "auto": "Auto — follow me",- "summary": "{0} · replies {1}"- },- "api_keys": {- "voice_label": "01 · Real-Time voice",- "voice_key_label": "Live API key",- "voice_key_hint": "One key for live conversation. OpenAI is recommended; Gemini Live works too.",- "agents_label": "02 · Jarvis Agents",- "agents_title": "Connect Jarvis Agents",- "agents_hint": "Connect a subscription or use an API key for background work.",- "agents_ready": "Jarvis Agents connected",- "agents_missing": "Jarvis Agents still need an API key or subscription",- "agents_api_title": "API keys",- "agents_api_hint": "Prefer an API key? Choose a provider; its key field opens below.",- "agents_loading": "Loading agent providers…",- "agents_unavailable": "Agent providers are unavailable right now.",- "agents_active": "Active",- "agents_use_key": "Use for Jarvis Agents",- "agents_subscriptions_label": "Subscriptions",- "agents_subscriptions_hint": "Sign in with an existing plan",- "gap_agents": "Live voice is set up, but Jarvis Agents still need an API key or subscription.",- "providers_label": "Providers",- "loading": "Loading providers…",- "load_failed": "The provider list could not be loaded. You can add a key later under API Keys.",- "recommended": "Recommended",- "configured": "Key saved",- "not_configured": "No key",- "active": "Active",- "show_more": "Show {0} more",- "show_less": "Show fewer",- "local_label": "No key at hand?",- "local_title": "Run fully local with Ollama",- "local_checking": "Checking for a local Ollama…",- "local_detected": "Ollama is running on this machine — {name} can think fully local, no key needed.",- "local_detected_empty": "Ollama is running but has no model yet — pull one first (e.g. ollama pull qwen3.5).",- "local_use_button": "Use local model",- "local_active": "Local brain active — Ollama answers from this machine.",- "local_missing": "Install Ollama and {name} runs fully local — no cloud account needed.",- "local_missing_link": "Get Ollama",- "security_note": "Keys are stored in your system keychain and only ever sent to the provider you chose — never into chat or voice.",- "later": "Later — add a key in Settings",- "later_hint": "Live voice needs a key; Jarvis Agents need a separate key or subscription.",- "summary_none": "No key yet",- "summary_local": "Local · Ollama",- "plan_label": "How do you want to start?",- "plan_custom_title": "Advanced: configure providers myself or use a local model",- "plan_custom_body": "The full provider list — choose each part on its own.",- "plan_applying": "Setting everything up for {0}…",- "plan_applied": "{0} is set up for live voice. Connect Jarvis Agents below.",- "plan_partial": "Most of it is set; this did not apply: {0}. You can fix it later under API Keys.",- "plan_explainer": "Real-Time is set automatically. Choose the provider for your live conversation.",- "keys_one": "1 key",- "keys_n": "{0} keys",- "keys_several": "Several keys",- "mode_pipeline": "Pipeline",- "mode_realtime": "Realtime · live voice",- "plan_keys_from": "Keys: {0}.",- "mode_explainer": "Pipeline = listen, think, speak in three steps; works with any provider. Realtime = one live voice model that answers while you speak; only Google Gemini and OpenAI offer one — a Claude or OpenRouter key alone cannot run Realtime.",- "plan_progress": "Keys for this plan · {0} of {1} saved",- "gap_none": "No live API key saved — live voice stays off until you add one under API Keys.",- "gap_plan_partial": "{0} is missing the {1} key — the parts that need it (live voice, for one) stay off until you add it under API Keys.",- "gap_custom": "You picked providers yourself — voice in, voice out and the agents may still need their own keys. Check under API Keys."- },- "permissions": {- "privacy_note": "These prompts come from macOS. The installer cannot silently approve them, and {name} never bypasses System Settings. The Keychain prompt at app start only means your API keys are being saved encrypted in the macOS Keychain — they never leave your Mac.",- "continue": "Continue",- "text_only": "Continue with text only",- "summary_ready": "Granted",- "summary_skipped": "Text only",- "gap": "Not every macOS permission is granted — voice, screen and keyboard features stay off until you allow them under Settings → Permissions."- },- "wake_word": {- "mode_label": "Activation",- "mode_wake_title": "Wake word",- "mode_wake_body": "Say your own word any time — always listening. Needs a small local model for your exact word.",- "mode_shortcut_title": "Keyboard shortcut",- "mode_shortcut_body": "No wake word — press the Call shortcut to start a voice session.",- "selected": "Selected",- "shortcut_note": "You'll activate {name} with the Call shortcut instead of a wake word. You can configure it anytime in Settings → Voice Keybinds.",- "word_label": "Your word",- "body": "\"Hey\" stays fixed — you pick the rest.",- "prefix": "Hey",- "input_label": "Your wake word",- "placeholder": "e.g. Nova",- "notice": "Pick any word — just make sure it isn't someone else's trademark.",- "learn_more": "How to check",- "references_title": "Where to check protected names",- "references_caveat": "These references are informational and may be incomplete or out of date — they are not a substitute for your own check.",- "ack_label": "I'm responsible for the wake word I choose.",- "cta": "Save and continue",- "saving": "Saving…",- "derived_name": "Your assistant will be called {0}",- "continue_anyway": "Continue anyway",- "summary_shortcut": "Keyboard shortcut",- "mic_check": {- "title": "Microphone",- "test_button": "Test your microphone",- "checking": "Listening…",- "listening": "Listening — say your word now.",- "good": "Sounds good — your microphone picked up your voice clearly.",- "too_quiet": "That was very quiet. Turn up your microphone or move closer, then try again.",- "no_device": "No microphone detected — you can still finish setup and fix this later in Settings.",- "permission_required": "Grant Microphone access in Permissions before running this check.",- "error": "Could not check the microphone right now."- },- "gap_degraded": "\"{0}\" is saved but nothing can hear it yet — the wake word stays off until the local speech model is installed under Settings → Wake word. The Call shortcut works meanwhile.",- "gap_not_persisted": "The activation could not be written to the configuration file, so it will be gone after a restart — reopen Settings → Wake word once the file is writable again.",- "error_skip_hint": "You can skip activation and finish setup — a wake word can be set anytime in Settings."- },- "finish": {- "summary_label": "Your setup",- "skipped": "Skipped — set up anytime in Settings",- "autostart_label": "Start {name} at login",- "autostart_hint": "Runs quietly in the background after you sign in.",- "tour_label": "New here?",- "tour_title": "Watch the 2-minute tour",- "tour_body": "Opens on YouTube in your browser.",- "boot_notice": "The first launch takes about 10 seconds while {name} warms up — that's normal.",- "start_cta": "Start {name}",- "starting": "Starting…",- "start_failed": "Could not finish setup. Check that the app is running, then try again.",- "gaps_label": "Before you start",- "gaps_intro": "Some things are not set up yet. {name} will start, but these parts stay off:",- "gaps_outro": "You can finish each of them later in Settings — nothing here is lost.",- "gaps_ack": "I have read what is still missing and want to start anyway.",- "gap_skipped_language": "Language was skipped — {name} uses English until you change it under Settings.",- "gap_skipped_api_keys": "No API key saved — chat and voice stay off until you add one under API Keys.",- "gap_skipped_permissions": "macOS permissions were skipped — voice, screen and keyboard features stay off until you allow them under Settings → Permissions.",- "gap_skipped_wake_word": "Activation was skipped — use the Call shortcut, or set a wake word under Settings."- },- "plans": {- "openai_live_label": "OpenAI GPT-Live",- "openai_live_summary": "Live voice and thinking with one OpenAI API key.",- "gemini_live_label": "Gemini Live",- "gemini_live_summary": "Live voice with one Google Gemini API key.",- "gemini_pipeline_label": "Pipeline with Gemini",- "gemini_pipeline_summary": "One Google Gemini key runs everything: thinking, the tool model, the agents, voice in and voice out.",- "gemini_realtime_label": "Realtime with Gemini",- "gemini_realtime_summary": "One Google Gemini key, spoken live: Gemini Live answers in real time; tool model and agents run on the same key.",- "gemini_openai_realtime_label": "Gemini + OpenAI",- "gemini_openai_realtime_summary": "Two keys, both engines covered: OpenAI Realtime speaks live, Gemini thinks, plans and runs the agents — and the Pipeline engine stays ready as a fallback."- }- },"language_select": {"search": "Search languages","empty": "No language matches your search.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex c6447aaca1..33ee9631c2 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -2933,220 +2933,6 @@"install_no_binary": "{0}: instalación completada (exit 0) pero binario no encontrado. PATH puede no estar actualizado.","install_failed": "{0}: instalación fallida (exit {1}). Prueba otro método."},- "onboarding": {- "progress_label": "Progreso de la configuración",- "eyebrow": "Primer inicio",- "step_progress": "{0} de {1}",- "nav": {- "next": "Continuar",- "back": "Atrás",- "skip": "Omitir"- },- "steps": {- "welcome": {- "label": "Antes de empezar",- "title": "Antes de empezar",- "hint": "{name} actúa en tu ordenador. Lee lo que eso significa y luego decide."- },- "language": {- "label": "Idioma",- "title": "¿En qué idioma debe hablar {name}?",- "hint": "La interfaz y las respuestas pueden diferir. Ambos se pueden cambiar después en Ajustes."- },- "api-keys": {- "label": "Conexiones",- "title": "Configura la voz en directo y los agentes de Jarvis",- "hint": "Elige el proveedor de voz y conecta una clave API o suscripción para los agentes de Jarvis."- },- "permissions": {- "label": "Permisos",- "title": "Permitir el acceso en este Mac",- "hint": "macOS pide cada capacidad por separado. Concédelas y vuelve — la lista se actualiza sola."- },- "wake-word": {- "label": "Activación",- "title": "¿Cómo quieres llamar a {name}?",- "hint": "Una palabra de activación propia o un atajo de teclado. Ambos se pueden cambiar después."- },- "finish": {- "label": "Listo",- "title": "{name} está listo",- "hint": "Esto es lo que has configurado. Un reinicio lo aplica todo."- }- },- "welcome": {- "capabilities_label": "Qué puede hacer {name}",- "cap_commands": "Ejecutar comandos, abrir aplicaciones y modificar archivos en tu nombre",- "cap_screen": "Ver tu pantalla y actuar sobre ella cuando se lo pidas",- "cap_cloud": "Enviar lo que dices al proveedor de IA que elijas",- "cap_costs": "Usar tu cuenta del proveedor — el uso se factura allí, por ellos",- "cap_mistakes": "Cometer errores — incluidos no deseados o destructivos",- "liability": "Lo usas completamente bajo tu propia responsabilidad. Los desarrolladores no aceptan responsabilidad alguna por daños, pérdida de datos u otras consecuencias.",- "accept_label": "Entiendo los riesgos y uso {name} bajo mi propia responsabilidad.",- "view_terms": "Leer las Condiciones de uso completas",- "hide_terms": "Ocultar las Condiciones",- "terms_loading": "Cargando condiciones…",- "proceed": "Entendido — continuar",- "decline": "Rechazar y salir",- "accept_failed": "No se pudo guardar tu aceptación. Comprueba que la aplicación esté en marcha e inténtalo de nuevo.",- "declined_title": "{name} se está cerrando",- "declined_body": "Has rechazado las Condiciones, así que no se configuró ni se guardó nada. Vuelve a abrir la aplicación cuando quieras; esta pantalla preguntará de nuevo.",- "summary_accepted": "Condiciones aceptadas"- },- "intro": {- "scene_1": "Conoce a tu asistente por voz.",- "scene_2": "Solo habla — escucha y actúa.",- "scene_3": "Sigue trabajando en segundo plano mientras tú no.",- "scene_4": "Tus claves, tus datos, tus reglas."- },- "language": {- "ui_label": "Idioma de la interfaz",- "ui_hint": "Menús, botones y ajustes",- "reply_label": "Idioma de respuesta",- "reply_hint": "En qué responde {name} — Auto sigue el idioma en el que hablas",- "auto": "Auto — sígueme",- "summary": "{0} · respuestas {1}"- },- "api_keys": {- "voice_label": "01 · Voz en tiempo real",- "voice_key_label": "Clave API de voz",- "voice_key_hint": "Una clave para hablar en directo. Se recomienda OpenAI; Gemini Live también funciona.",- "agents_label": "02 · Agentes de Jarvis",- "agents_title": "Conecta los agentes de Jarvis",- "agents_hint": "Conecta una suscripción o usa una clave API para tareas en segundo plano.",- "agents_ready": "Agentes de Jarvis conectados",- "agents_missing": "Los agentes de Jarvis aún necesitan una clave API o suscripción",- "agents_api_title": "Claves API",- "agents_api_hint": "¿Prefieres una clave API? Elige un proveedor; su campo se abre debajo.",- "agents_loading": "Cargando proveedores de agentes…",- "agents_unavailable": "Los proveedores de agentes no están disponibles ahora.",- "agents_active": "Activo",- "agents_use_key": "Usar para agentes de Jarvis",- "agents_subscriptions_label": "Suscripciones",- "agents_subscriptions_hint": "Inicia sesión con un plan existente",- "gap_agents": "La voz en directo está configurada, pero los agentes de Jarvis aún necesitan una clave API o suscripción.",- "providers_label": "Proveedores",- "loading": "Cargando proveedores…",- "load_failed": "No se pudo cargar la lista de proveedores. Puedes añadir una clave después en Claves API.",- "recommended": "Recomendado",- "configured": "Clave guardada",- "not_configured": "Sin clave",- "active": "Activo",- "show_more": "Mostrar {0} más",- "show_less": "Mostrar menos",- "local_label": "¿Sin clave a mano?",- "local_title": "Totalmente local con Ollama",- "local_checking": "Buscando un Ollama local…",- "local_detected": "Ollama está en marcha en este equipo — {name} puede pensar totalmente en local, sin clave.",- "local_detected_empty": "Ollama está en marcha pero aún no tiene ningún modelo — descarga uno primero (p. ej. ollama pull qwen3.5).",- "local_use_button": "Usar modelo local",- "local_active": "Cerebro local activo — Ollama responde desde este equipo.",- "local_missing": "Instala Ollama y {name} funcionará totalmente en local — sin cuenta en la nube.",- "local_missing_link": "Obtener Ollama",- "security_note": "Las claves se guardan en el llavero de tu sistema y solo se envían al proveedor que elegiste — nunca al chat ni a la voz.",- "later": "Más tarde — añadir una clave en Ajustes",- "later_hint": "La voz en directo necesita una clave; los agentes de Jarvis necesitan otra clave o una suscripción.",- "summary_none": "Aún sin clave",- "summary_local": "Local · Ollama",- "plan_label": "¿Cómo quieres empezar?",- "plan_custom_title": "Avanzado: elegir proveedores o usar un modelo local",- "plan_custom_body": "La lista completa de proveedores — elige cada parte por separado.",- "plan_applying": "Configurando todo para {0}…",- "plan_applied": "{0} está configurado para voz en directo. Conecta los agentes de Jarvis abajo.",- "plan_partial": "Casi todo está listo; esto no se aplicó: {0}. Puedes arreglarlo después en Claves API.",- "plan_explainer": "El modo en tiempo real se configura automáticamente. Elige el proveedor para tus conversaciones en directo.",- "keys_one": "1 clave",- "keys_n": "{0} claves",- "keys_several": "Varias claves",- "mode_pipeline": "Pipeline",- "mode_realtime": "Realtime · voz en directo",- "plan_keys_from": "Claves: {0}.",- "mode_explainer": "Pipeline = escuchar, pensar, hablar en tres pasos; funciona con cualquier proveedor. Realtime = un modelo de voz en directo que responde mientras hablas; solo Google Gemini y OpenAI lo ofrecen — una clave de Claude u OpenRouter por sí sola no puede ejecutar Realtime.",- "plan_progress": "Claves para este plan · {0} de {1} guardadas",- "gap_none": "No hay ninguna clave API de voz guardada — la voz en directo seguirá desactivada hasta que la añadas en Claves API.",- "gap_plan_partial": "A {0} le falta la clave de {1} — las partes que la necesitan (por ejemplo la voz en directo) permanecen desactivadas hasta que la añadas en Claves API.",- "gap_custom": "Elegiste los proveedores tú mismo — la entrada de voz, la salida de voz y los agentes pueden necesitar sus propias claves. Compruébalo en Claves API."- },- "permissions": {- "privacy_note": "Estas solicitudes vienen de macOS. El instalador no puede aprobarlas en silencio y {name} nunca se salta los Ajustes del Sistema. La solicitud del Llavero al iniciar solo significa que tus claves API se guardan cifradas en el Llavero de macOS — nunca salen de tu Mac.",- "continue": "Continuar",- "text_only": "Continuar solo con texto",- "summary_ready": "Concedidos",- "summary_skipped": "Solo texto",- "gap": "No todos los permisos de macOS están concedidos — las funciones de voz, pantalla y teclado permanecen desactivadas hasta que los permitas en Ajustes → Permisos."- },- "wake_word": {- "mode_label": "Activación",- "mode_wake_title": "Palabra de activación",- "mode_wake_body": "Di tu propia palabra en cualquier momento — siempre escucha. Necesita un pequeño modelo local para tu palabra exacta.",- "mode_shortcut_title": "Atajo de teclado",- "mode_shortcut_body": "Sin palabra de activación — pulsa el atajo de Llamada para iniciar una sesión de voz.",- "selected": "Seleccionado",- "shortcut_note": "Activarás {name} con el atajo de Llamada en lugar de una palabra de activación. Puedes configurarlo en Ajustes → Atajos de voz.",- "word_label": "Tu palabra",- "body": "«Hey» se mantiene fijo — tú eliges el resto.",- "prefix": "Hey",- "input_label": "Tu palabra de activación",- "placeholder": "p. ej. Nova",- "notice": "Elige cualquier palabra — solo asegúrate de que no sea una marca registrada de otra persona.",- "learn_more": "Cómo comprobarlo",- "references_title": "Dónde comprobar nombres protegidos",- "references_caveat": "Estas referencias son informativas y pueden estar incompletas o desactualizadas — no sustituyen tu propia comprobación.",- "ack_label": "Soy responsable de la palabra de activación que elijo.",- "cta": "Guardar y continuar",- "saving": "Guardando…",- "derived_name": "Tu asistente se llamará {0}",- "continue_anyway": "Continuar de todos modos",- "summary_shortcut": "Atajo de teclado",- "mic_check": {- "title": "Micrófono",- "test_button": "Probar el micrófono",- "checking": "Escuchando…",- "listening": "Escuchando — di tu palabra ahora.",- "good": "Suena bien — tu micrófono captó tu voz con claridad.",- "too_quiet": "Eso fue muy bajo. Sube el volumen del micrófono o acércate e inténtalo de nuevo.",- "no_device": "No se detectó ningún micrófono — puedes terminar la configuración y arreglarlo después en Ajustes.",- "permission_required": "Concede acceso al Micrófono en Permisos antes de ejecutar esta prueba.",- "error": "No se pudo comprobar el micrófono en este momento."- },- "gap_degraded": "«{0}» está guardada, pero todavía nadie puede oírla — la palabra de activación permanece desactivada hasta que se instale el modelo de voz local en Ajustes → Palabra de activación. Mientras tanto funciona el atajo de Llamada.",- "gap_not_persisted": "La activación no se pudo escribir en el archivo de configuración, así que desaparecerá tras reiniciar — vuelve a abrir Ajustes → Palabra de activación cuando el archivo vuelva a admitir escritura.",- "error_skip_hint": "Puedes omitir la activación y terminar la configuración — una palabra de activación se puede definir en cualquier momento en Ajustes."- },- "finish": {- "summary_label": "Tu configuración",- "skipped": "Omitido — configúralo cuando quieras en Ajustes",- "autostart_label": "Iniciar {name} al iniciar sesión",- "autostart_hint": "Se ejecuta en silencio en segundo plano tras iniciar sesión.",- "tour_label": "¿Nuevo por aquí?",- "tour_title": "Ver el recorrido de 2 minutos",- "tour_body": "Se abre en YouTube en tu navegador.",- "boot_notice": "El primer inicio tarda unos 10 segundos mientras {name} se prepara — es normal.",- "start_cta": "Iniciar {name}",- "starting": "Iniciando…",- "start_failed": "No se pudo terminar la configuración. Comprueba que la aplicación esté en marcha e inténtalo de nuevo.",- "gaps_label": "Antes de empezar",- "gaps_intro": "Algunas cosas aún no están configuradas. {name} se iniciará, pero estas partes permanecen desactivadas:",- "gaps_outro": "Puedes terminar cada una más tarde en Ajustes — nada se pierde.",- "gaps_ack": "He leído lo que todavía falta y quiero empezar de todos modos.",- "gap_skipped_language": "Se omitió el idioma — {name} usa inglés hasta que lo cambies en Ajustes.",- "gap_skipped_api_keys": "No hay ninguna clave API guardada — el chat y la voz permanecen desactivados hasta que añadas una en Claves API.",- "gap_skipped_permissions": "Se omitieron los permisos de macOS — las funciones de voz, pantalla y teclado permanecen desactivadas hasta que los permitas en Ajustes → Permisos.",- "gap_skipped_wake_word": "Se omitió la activación — usa el atajo de Llamada o define una palabra de activación en Ajustes."- },- "plans": {- "openai_live_label": "OpenAI GPT-Live",- "openai_live_summary": "Voz en directo y razonamiento con una clave API de OpenAI.",- "gemini_live_label": "Gemini Live",- "gemini_live_summary": "Voz en directo con una clave API de Google Gemini.",- "gemini_pipeline_label": "Pipeline con Gemini",- "gemini_pipeline_summary": "Una clave de Google Gemini lo hace todo: pensar, el modelo de herramientas, los agentes, voz de entrada y salida.",- "gemini_realtime_label": "Realtime con Gemini",- "gemini_realtime_summary": "Una clave de Google Gemini, hablada en vivo: Gemini Live responde en tiempo real; el modelo de herramientas y los agentes usan la misma clave.",- "gemini_openai_realtime_label": "Gemini + OpenAI",- "gemini_openai_realtime_summary": "Dos claves, ambos motores cubiertos: OpenAI Realtime habla en vivo, Gemini piensa, planifica y dirige los agentes — y el Pipeline queda listo como reserva."- }- },"language_select": {"search": "Buscar idioma","empty": "Ningún idioma coincide con tu búsqueda.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.jsonnew file mode 100644index 0000000000..28fdf28216--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json@@ -0,0 +1,163 @@+{+ "first_run": {+ "back": "Zurück",+ "continue": "Weiter",+ "step_of": "Schritt {current} von {total}",+ "welcome": {+ "title": "Lass uns deinen Assistenten einrichten",+ "lede": "Er hört zu, antwortet und erledigt echte Arbeit auf diesem Computer. Ein paar kurze Schritte, etwa zwei Minuten.",+ "language": "Sprache",+ "lang_en": "English",+ "lang_de": "Deutsch",+ "lang_es": "Español",+ "facts_label": "Gut zu wissen vorab",+ "fact_commands": "Er führt Befehle aus, öffnet Apps und ändert Dateien für dich.",+ "fact_screen": "Er kann deinen Bildschirm sehen und darauf handeln, wenn du ihn bittest.",+ "fact_cloud": "Was du sagst, geht an den KI-Anbieter, den du wählst.",+ "fact_costs": "Die Nutzung rechnet dieser Anbieter über dein Konto ab.",+ "fact_mistakes": "Er kann Fehler machen, auch solche, die schwer rückgängig zu machen sind.",+ "accept": "Ich habe das verstanden und nutze ihn auf eigenes Risiko.",+ "read_terms": "Die vollständigen Nutzungsbedingungen lesen",+ "hide_terms": "Nutzungsbedingungen ausblenden",+ "terms_loading": "Nutzungsbedingungen werden geladen…",+ "start": "Zustimmen und weiter",+ "decline": "Ablehnen und beenden",+ "accept_failed": "Deine Zustimmung konnte nicht gespeichert werden. Prüfe, ob die App läuft, und versuche es noch einmal.",+ "declined_title": "Die App wird geschlossen",+ "declined_body": "Du hast abgelehnt, also wurde nichts eingerichtet und nichts gespeichert. Starte die App jederzeit neu, dann fragt sie wieder."+ },+ "brain": {+ "title": "Gib ihm ein Gehirn",+ "lede": "Dein Assistent denkt und spricht über einen KI-Anbieter. Ein API-Schlüssel reicht für den Start.",+ "recommended": "Empfohlen",+ "other_provider": "Anderer Anbieter",+ "local": "Auf diesem Computer ausführen",+ "local_found": "Auf diesem Computer ausführen · Ollama gefunden",+ "loading": "Anbieter werden geladen…",+ "load_failed": "Die Anbieterliste konnte nicht geladen werden. Du kannst später unter Einstellungen → API-Keys einen Schlüssel eintragen.",+ "key_for": "Dein {provider}-API-Schlüssel",+ "key_saved": "Schlüssel gespeichert",+ "key_missing": "Noch kein Schlüssel",+ "active": "Aktiv",+ "local_title": "Komplett auf diesem Computer mit Ollama",+ "local_checking": "Suche nach Ollama…",+ "local_ready": "Ollama läuft hier. Dein Assistent kann ganz ohne Cloud-Konto denken.",+ "local_empty": "Ollama läuft, hat aber noch kein Modell. Lade zuerst eins, zum Beispiel: ollama pull qwen3.5",+ "local_missing": "Installiere Ollama, dann läuft dein Assistent komplett auf diesem Computer, ohne Konto und ohne Schlüssel.",+ "local_get": "Ollama holen",+ "local_use": "Lokales Modell nutzen",+ "local_active": "Fertig. Das lokale Modell antwortet von diesem Computer aus.",+ "applying": "{plan} wird verbunden…",+ "applied": "Verbunden. Live-Sprache und Denken laufen jetzt über {plan}.",+ "partial": "Fast alles verbunden. Diese Teile wurden nicht umgestellt: {parts}. Du kannst das später unter Einstellungen → API-Keys beheben.",+ "security": "Schlüssel liegen im Schlüsselbund deines Systems und gehen nur an den Anbieter, den du gewählt hast, nie in einen Chat.",+ "later": "Ich trage später einen Schlüssel ein",+ "summary_local": "Lokal · Ollama",+ "gap_none": "Noch kein API-Schlüssel. Chat und Sprache bleiben aus, bis du unter Einstellungen → API-Keys einen einträgst.",+ "gap_partial": "Einige Teile wurden nicht umgestellt ({parts}). Prüfe sie unter Einstellungen → API-Keys.",+ "plans": {+ "openai_live_label": "OpenAI GPT-Live",+ "openai_live_summary": "Live-Sprache und Denken mit einem OpenAI-Schlüssel.",+ "gemini_live_label": "Gemini Live",+ "gemini_live_summary": "Live-Sprache und Denken mit einem Gemini-Schlüssel."+ }+ },+ "agents": {+ "title": "Große Aufgaben abgeben",+ "lede": "Für längere Aufgaben kann dein Assistent Arbeit an einen Coding-Agenten weitergeben, den du schon nutzt. Das hat dieser Computer:",+ "subscriptions_label": "Abos",+ "subscriptions_hint": "Mit einem Abo anmelden, das du schon hast",+ "unavailable": "Gerade sind keine Agenten-Anbieter verfügbar.",+ "checking": "Deine Agenten werden geprüft…",+ "ready": "{agent} ist verbunden und übernimmt die großen Aufgaben.",+ "optional": "Optional. Auch ohne Agenten spricht, antwortet und nutzt dein Assistent seine Werkzeuge.",+ "check_again": "Erneut prüfen",+ "api_key_hint": "Lieber einen API-Schlüssel? Den kannst du jederzeit unter Einstellungen → API-Keys eintragen.",+ "gap": "Noch kein Coding-Agent. Größere Hintergrundaufgaben bleiben aus, bis du unter Einstellungen → API-Keys einen verbindest."+ },+ "permissions": {+ "title": "Zugriff auf diesem Mac erlauben",+ "lede": "macOS fragt jede Fähigkeit einzeln ab. Erlaube sie und komm zurück; die Liste aktualisiert sich selbst.",+ "privacy": "Jede Berechtigung nutzt nur die Funktion, die sie braucht. Der letzte Neustart wendet alle an.",+ "later": "Erst mal überspringen, nur Text",+ "summary": "Alle erlaubt",+ "gap": "Einige macOS-Berechtigungen fehlen. Sprache, Bildschirm und Tastatur bleiben aus, bis du sie unter Einstellungen → Berechtigungen erlaubst."+ },+ "voice": {+ "title": "Wie rufst du ihn?",+ "lede": "Sag ein eigenes Wort oder drück ein Tastenkürzel. Das Wort wird auch sein Name.",+ "wake_title": "Ein Weckwort",+ "wake_body": "Sag jederzeit „Hey …“. Er hört auf diesem Computer auf dein Wort.",+ "shortcut_title": "Ein Tastenkürzel",+ "shortcut_body": "Drück das Anruf-Kürzel, um zu sprechen. Bis dahin hört nichts zu.",+ "shortcut_body_keys": "Nichts hört zu, bis du drückst:",+ "prefix": "Hey",+ "word_label": "Dein Weckwort",+ "placeholder": "Nova",+ "name_intro": "Dein Assistent heißt dann",+ "name_hint": "Wähle ein beliebiges Wort mit mindestens zwei Buchstaben.",+ "trademark": "Wähle ein Wort, das keine fremde Marke ist.",+ "how_to_check": "So prüfst du das",+ "refs_caveat": "Diese Links dienen nur zur Information und sind vielleicht unvollständig.",+ "ack": "Ich bin für das Wort verantwortlich, das ich wähle.",+ "mic_test": "Mikrofon testen",+ "mic_listening": "Ich höre zu. Sag jetzt etwas.",+ "mic_failed": "Der Mikrofontest hat nicht geantwortet. Du kannst es später in den Einstellungen noch einmal versuchen.",+ "mic_permission": "Die App darf das Mikrofon noch nicht nutzen. Erlaube es in den Systemeinstellungen und teste dann noch einmal.",+ "mic_no_device": "Kein Mikrofon gefunden. Du kannst trotzdem tippen und später eins anschließen.",+ "mic_quiet": "Sehr leise. Geh näher ran oder dreh die Eingangslautstärke hoch und teste noch einmal.",+ "mic_good": "Klingt gut. Deine Stimme kam deutlich an.",+ "skip_after_error": "Diesen Schritt überspringen und später in den Einstellungen einrichten",+ "continue_anyway": "Erst mal mit dem Tastenkürzel weiter",+ "save": "Speichern und weiter",+ "summary_shortcut": "Tastenkürzel",+ "summary_shortcut_keys": "Kürzel {keys}",+ "gap_not_persisted": "Die Auswahl konnte nicht in die Einstellungsdatei geschrieben werden und ist nach dem Neustart weg. Stell sie unter Einstellungen → Weckwort noch einmal ein.",+ "gap_degraded": "„{phrase}“ ist gespeichert, aber noch kann es nichts hören. Installiere die lokale Spracherkennung unter Einstellungen → Weckwort; bis dahin funktioniert das Anruf-Kürzel.",+ "gap_skipped": "Keine Aktivierung eingestellt. Nutze das Anruf-Kürzel oder wähle unter Einstellungen ein Weckwort."+ },+ "ready": {+ "title": "Alles bereit",+ "lede": "Das hast du eingerichtet. Ein Neustart übernimmt alles, danach zeigt dir eine kurze Tour die App.",+ "say": "Sag „{phrase}“ und {assistant} antwortet.",+ "row_brain": "Gehirn",+ "row_agents": "Agenten",+ "row_permissions": "Berechtigungen",+ "row_voice": "Aktivierung",+ "not_set": "Nicht eingerichtet",+ "skipped_brain": "Noch kein API-Schlüssel. Chat und Sprache bleiben aus, bis du unter Einstellungen → API-Keys einen einträgst.",+ "skipped_agents": "Noch kein Coding-Agent. Verbinde jederzeit einen unter Einstellungen → API-Keys.",+ "skipped_permissions": "Die macOS-Berechtigungen wurden übersprungen. Erlaube sie unter Einstellungen → Berechtigungen.",+ "skipped_voice": "Keine Aktivierung eingestellt. Nutze das Anruf-Kürzel oder wähle unter Einstellungen ein Weckwort.",+ "autostart": "Bei der Anmeldung starten",+ "autostart_hint": "Läuft nach der Anmeldung leise im Hintergrund.",+ "restart_note": "Die App startet einmal neu und braucht etwa zehn Sekunden zum Aufwärmen. Das ist normal.",+ "start_failed": "Die Einrichtung konnte nicht abgeschlossen werden. Prüfe, ob die App läuft, und versuche es noch einmal.",+ "starting": "Startet…",+ "start": "Starten",+ "start_named": "{assistant} starten"+ }+ },+ "app_tour": {+ "label": "App-Tour",+ "next": "Weiter",+ "finish": "Fertig",+ "skip": "Tour überspringen",+ "step_of": "{current} von {total}",+ "replay_title": "App-Tour",+ "replay_body": "Ein kurzer Rundgang durch die App mit dem Scheinwerfer, derselbe wie nach der Einrichtung.",+ "replay": "Tour wiederholen",+ "steps": {+ "voice": "So sprichst du mit {name}. Klick auf die Leiste, sag dein Weckwort oder drück dein Anruf-Kürzel, dann sprich einfach. Die Welle zeigt, wer gerade redet.",+ "new_chat": "Lieber tippen? Hier startest du einen neuen Chat, als Text oder mit Stimme. Jedes Gespräch landet unter Letzte Chats.",+ "agents": "Agenten sind dein Team: Helfer, die größere Aufgaben im Hintergrund übernehmen. Schauen wir rein.",+ "agents_world": "Das ist das Verse, deine Agenten bei der Arbeit. Klick einen an, um mit ihm zu chatten oder ihm eine Aufgabe zu geben. Weiter bringt dich zurück.",+ "voice_hub": "Unter Stimme findest du Diktat in jede App, deine eigene Wortliste und gesprochene Kürzel.",+ "artifacts": "Alles, was {name} erstellt, von Seiten über Bilder bis zu Berichten, liegt unter Artefakte.",+ "ide": "Die Agentic IDE lässt Coding-Agenten nebeneinander in echten Terminals an deinen Projekten arbeiten.",+ "plugins": "Plugins, Skills und MCP verbinden {name} mit deinen Apps. Das Laden-Symbol unten öffnet den Marketplace.",+ "settings": "Hier findest du Einstellungen, API-Schlüssel, Kosten und dein Profil. Die Tour kannst du jederzeit unter Einstellungen → App wiederholen.",+ "done": "Das war die Tour. Du bist startklar: Sprich mit {name}, wann immer du willst."+ }+ }+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.jsonnew file mode 100644index 0000000000..f44fc57ff5--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json@@ -0,0 +1,163 @@+{+ "first_run": {+ "back": "Back",+ "continue": "Continue",+ "step_of": "Step {current} of {total}",+ "welcome": {+ "title": "Let's set up your assistant",+ "lede": "It listens, talks back and gets real work done on this computer. A few short steps, about two minutes.",+ "language": "Language",+ "lang_en": "English",+ "lang_de": "Deutsch",+ "lang_es": "Español",+ "facts_label": "Good to know first",+ "fact_commands": "It runs commands, opens apps and changes files for you.",+ "fact_screen": "It can see your screen and act on it when you ask.",+ "fact_cloud": "What you say goes to the AI provider you choose.",+ "fact_costs": "Usage is billed by that provider, on your account.",+ "fact_mistakes": "It can make mistakes, including ones that are hard to undo.",+ "accept": "I understand this and use it at my own risk.",+ "read_terms": "Read the full Terms of Use",+ "hide_terms": "Hide the Terms",+ "terms_loading": "Loading the Terms…",+ "start": "Agree and continue",+ "decline": "Decline and quit",+ "accept_failed": "Your agreement could not be saved. Check that the app is running, then try again.",+ "declined_title": "Closing the app",+ "declined_body": "You declined, so nothing was set up and nothing was saved. Start the app again anytime and it will ask again."+ },+ "brain": {+ "title": "Give it a brain",+ "lede": "Your assistant thinks and talks through an AI provider. One API key is enough to start.",+ "recommended": "Recommended",+ "other_provider": "Another provider",+ "local": "Run on this computer",+ "local_found": "Run on this computer · Ollama found",+ "loading": "Loading providers…",+ "load_failed": "The provider list could not be loaded. You can add a key later under Settings → API Keys.",+ "key_for": "Your {provider} API key",+ "key_saved": "Key saved",+ "key_missing": "No key yet",+ "active": "Active",+ "local_title": "Run fully on this computer with Ollama",+ "local_checking": "Looking for Ollama…",+ "local_ready": "Ollama is running here. Your assistant can think without any cloud account.",+ "local_empty": "Ollama is running but has no model yet. Pull one first, for example: ollama pull qwen3.5",+ "local_missing": "Install Ollama and your assistant runs fully on this computer, with no account and no key.",+ "local_get": "Get Ollama",+ "local_use": "Use the local model",+ "local_active": "Done. The local model answers from this computer.",+ "applying": "Connecting {plan}…",+ "applied": "Connected. Live voice and thinking now run on {plan}.",+ "partial": "Mostly connected. These parts did not switch: {parts}. You can fix them later under Settings → API Keys.",+ "security": "Keys go into your system's keychain and only ever to the provider you picked, never into a chat.",+ "later": "I'll add a key later",+ "summary_local": "Local · Ollama",+ "gap_none": "No API key yet. Chat and voice stay off until you add one under Settings → API Keys.",+ "gap_partial": "Some parts did not switch ({parts}). Check them under Settings → API Keys.",+ "plans": {+ "openai_live_label": "OpenAI GPT-Live",+ "openai_live_summary": "Live voice and thinking on one OpenAI key.",+ "gemini_live_label": "Gemini Live",+ "gemini_live_summary": "Live voice and thinking on one Gemini key."+ }+ },+ "agents": {+ "title": "Hand off the big jobs",+ "lede": "For longer tasks your assistant can pass work to a coding agent you already use. Here is what this computer has.",+ "subscriptions_label": "Subscriptions",+ "subscriptions_hint": "Sign in with a plan you already have",+ "unavailable": "No agent providers are available right now.",+ "checking": "Checking your agents…",+ "ready": "{agent} is connected and takes the big jobs.",+ "optional": "Optional. Without an agent your assistant still talks, answers and uses its tools.",+ "check_again": "Check again",+ "api_key_hint": "Prefer an API key? Add one anytime under Settings → API Keys.",+ "gap": "No coding agent yet. Bigger background jobs stay off until you connect one under Settings → API Keys."+ },+ "permissions": {+ "title": "Allow access on this Mac",+ "lede": "macOS asks for each ability on its own. Grant them and come back; the list updates itself.",+ "privacy": "Each permission is only used by the feature that needs it. The final restart applies them all.",+ "later": "Skip for now, text only",+ "summary": "All granted",+ "gap": "Some macOS permissions are missing. Voice, screen and keyboard features stay off until you allow them under Settings → Permissions."+ },+ "voice": {+ "title": "How do you call it?",+ "lede": "Say a word of your own, or press a shortcut. The word also becomes its name.",+ "wake_title": "A wake word",+ "wake_body": "Say \"Hey …\" anytime. It listens for your word on this computer.",+ "shortcut_title": "A keyboard shortcut",+ "shortcut_body": "Press the Call shortcut to talk. Nothing listens until you do.",+ "shortcut_body_keys": "Nothing listens until you press",+ "prefix": "Hey",+ "word_label": "Your wake word",+ "placeholder": "Nova",+ "name_intro": "Your assistant will be called",+ "name_hint": "Pick any word with at least two letters.",+ "trademark": "Choose a word that isn't someone else's trademark.",+ "how_to_check": "How to check",+ "refs_caveat": "These links are for information only and may be incomplete.",+ "ack": "I'm responsible for the word I choose.",+ "mic_test": "Test microphone",+ "mic_listening": "Listening. Say something now.",+ "mic_failed": "The microphone check did not answer. You can try again later in Settings.",+ "mic_permission": "The app may not use the microphone yet. Allow it in your system settings, then test again.",+ "mic_no_device": "No microphone found. You can still type, and connect one later.",+ "mic_quiet": "Very quiet. Move closer or raise the input volume, then test again.",+ "mic_good": "Sounds good. Your voice came through clearly.",+ "skip_after_error": "Skip this step and set it up later in Settings",+ "continue_anyway": "Continue with the shortcut for now",+ "save": "Save and continue",+ "summary_shortcut": "Keyboard shortcut",+ "summary_shortcut_keys": "Shortcut {keys}",+ "gap_not_persisted": "The choice could not be written to the settings file, so it is gone after the restart. Set it again under Settings → Wake word.",+ "gap_degraded": "\"{phrase}\" is saved, but nothing can hear it yet. Install local speech under Settings → Wake word; the Call shortcut works meanwhile.",+ "gap_skipped": "No activation set. Use the Call shortcut, or pick a wake word under Settings."+ },+ "ready": {+ "title": "All set",+ "lede": "Here is what you set up. One restart applies everything, then a short tour shows you around.",+ "say": "Say \"{phrase}\" and {assistant} answers.",+ "row_brain": "Brain",+ "row_agents": "Agents",+ "row_permissions": "Permissions",+ "row_voice": "Activation",+ "not_set": "Not set up",+ "skipped_brain": "No API key yet. Chat and voice stay off until you add one under Settings → API Keys.",+ "skipped_agents": "No coding agent yet. Connect one anytime under Settings → API Keys.",+ "skipped_permissions": "macOS permissions were skipped. Allow them under Settings → Permissions.",+ "skipped_voice": "No activation set. Use the Call shortcut, or pick a wake word under Settings.",+ "autostart": "Start at login",+ "autostart_hint": "Runs quietly in the background after you sign in.",+ "restart_note": "The app restarts once and takes about ten seconds to warm up. That's normal.",+ "start_failed": "Setup could not be finished. Check that the app is running, then try again.",+ "starting": "Starting…",+ "start": "Start",+ "start_named": "Start {assistant}"+ }+ },+ "app_tour": {+ "label": "App tour",+ "next": "Next",+ "finish": "Finish",+ "skip": "Skip tour",+ "step_of": "{current} of {total}",+ "replay_title": "App tour",+ "replay_body": "A short walk through the app with the spotlight, the same one you saw after setup.",+ "replay": "Replay tour",+ "steps": {+ "voice": "This is how you talk to {name}. Click the bar, say your wake word or press your Call keys, then just speak. The wave shows who is talking.",+ "new_chat": "Rather type? Start a new chat here, as text or voice. Every conversation lands under Recent chats.",+ "agents": "Agents are your team: helpers that take on bigger jobs in the background. Let's look inside.",+ "agents_world": "This is the Verse, your agents at work. Click one to chat with it or hand it a job. Next brings you back.",+ "voice_hub": "Voice holds dictation into any app, your own word list and spoken shortcuts.",+ "artifacts": "Everything {name} makes, from pages to images to reports, is kept in Artifacts.",+ "ide": "The Agentic IDE runs coding agents side by side in real terminals, on your own projects.",+ "plugins": "Plugins, skills and MCP connect {name} to your apps. The store icon at the bottom opens the Marketplace.",+ "settings": "Settings, API keys, costs and your profile live here. You can replay this tour anytime from Settings → App.",+ "done": "That's the tour. You're ready: talk to {name} whenever you like."+ }+ }+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.jsonnew file mode 100644index 0000000000..09304d81bb--- /dev/null+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json@@ -0,0 +1,163 @@+{+ "first_run": {+ "back": "Atrás",+ "continue": "Continuar",+ "step_of": "Paso {current} de {total}",+ "welcome": {+ "title": "Vamos a configurar tu asistente",+ "lede": "Escucha, responde y hace trabajo real en este ordenador. Unos pocos pasos, unos dos minutos.",+ "language": "Idioma",+ "lang_en": "English",+ "lang_de": "Deutsch",+ "lang_es": "Español",+ "facts_label": "Conviene saber antes",+ "fact_commands": "Ejecuta comandos, abre aplicaciones y cambia archivos por ti.",+ "fact_screen": "Puede ver tu pantalla y actuar sobre ella cuando se lo pidas.",+ "fact_cloud": "Lo que dices va al proveedor de IA que elijas.",+ "fact_costs": "Ese proveedor cobra el uso en tu cuenta.",+ "fact_mistakes": "Puede equivocarse, también de formas difíciles de deshacer.",+ "accept": "Lo entiendo y lo uso bajo mi propia responsabilidad.",+ "read_terms": "Leer las condiciones de uso completas",+ "hide_terms": "Ocultar las condiciones",+ "terms_loading": "Cargando las condiciones…",+ "start": "Aceptar y continuar",+ "decline": "Rechazar y salir",+ "accept_failed": "No se pudo guardar tu aceptación. Comprueba que la aplicación está en marcha y vuelve a intentarlo.",+ "declined_title": "Cerrando la aplicación",+ "declined_body": "Has rechazado, así que no se configuró ni se guardó nada. Abre la aplicación cuando quieras y volverá a preguntar."+ },+ "brain": {+ "title": "Dale un cerebro",+ "lede": "Tu asistente piensa y habla a través de un proveedor de IA. Una clave de API basta para empezar.",+ "recommended": "Recomendado",+ "other_provider": "Otro proveedor",+ "local": "Ejecutar en este ordenador",+ "local_found": "Ejecutar en este ordenador · Ollama encontrado",+ "loading": "Cargando proveedores…",+ "load_failed": "No se pudo cargar la lista de proveedores. Puedes añadir una clave más tarde en Ajustes → Claves API.",+ "key_for": "Tu clave de API de {provider}",+ "key_saved": "Clave guardada",+ "key_missing": "Sin clave todavía",+ "active": "Activo",+ "local_title": "Todo en este ordenador con Ollama",+ "local_checking": "Buscando Ollama…",+ "local_ready": "Ollama está en marcha aquí. Tu asistente puede pensar sin ninguna cuenta en la nube.",+ "local_empty": "Ollama está en marcha pero aún no tiene modelo. Descarga uno primero, por ejemplo: ollama pull qwen3.5",+ "local_missing": "Instala Ollama y tu asistente funcionará por completo en este ordenador, sin cuenta ni clave.",+ "local_get": "Descargar Ollama",+ "local_use": "Usar el modelo local",+ "local_active": "Listo. El modelo local responde desde este ordenador.",+ "applying": "Conectando {plan}…",+ "applied": "Conectado. La voz en directo y el razonamiento funcionan ahora con {plan}.",+ "partial": "Casi todo conectado. Estas partes no cambiaron: {parts}. Puedes arreglarlo más tarde en Ajustes → Claves API.",+ "security": "Las claves se guardan en el llavero de tu sistema y solo van al proveedor que elegiste, nunca a un chat.",+ "later": "Añadiré una clave más tarde",+ "summary_local": "Local · Ollama",+ "gap_none": "Aún no hay clave de API. El chat y la voz siguen apagados hasta que añadas una en Ajustes → Claves API.",+ "gap_partial": "Algunas partes no cambiaron ({parts}). Revísalas en Ajustes → Claves API.",+ "plans": {+ "openai_live_label": "OpenAI GPT-Live",+ "openai_live_summary": "Voz en directo y razonamiento con una sola clave de OpenAI.",+ "gemini_live_label": "Gemini Live",+ "gemini_live_summary": "Voz en directo y razonamiento con una sola clave de Gemini."+ }+ },+ "agents": {+ "title": "Delega los trabajos grandes",+ "lede": "Para tareas largas, tu asistente puede pasar trabajo a un agente de programación que ya usas. Esto es lo que tiene este ordenador:",+ "subscriptions_label": "Suscripciones",+ "subscriptions_hint": "Inicia sesión con un plan que ya tienes",+ "unavailable": "Ahora mismo no hay proveedores de agentes disponibles.",+ "checking": "Comprobando tus agentes…",+ "ready": "{agent} está conectado y se encarga de los trabajos grandes.",+ "optional": "Opcional. Sin un agente, tu asistente sigue hablando, respondiendo y usando sus herramientas.",+ "check_again": "Comprobar de nuevo",+ "api_key_hint": "¿Prefieres una clave de API? Añádela cuando quieras en Ajustes → Claves API.",+ "gap": "Aún no hay agente de programación. Los trabajos grandes en segundo plano siguen apagados hasta que conectes uno en Ajustes → Claves API."+ },+ "permissions": {+ "title": "Permitir acceso en este Mac",+ "lede": "macOS pide cada capacidad por separado. Concédelas y vuelve; la lista se actualiza sola.",+ "privacy": "Cada permiso solo lo usa la función que lo necesita. El reinicio final los aplica todos.",+ "later": "Omitir por ahora, solo texto",+ "summary": "Todos concedidos",+ "gap": "Faltan algunos permisos de macOS. La voz, la pantalla y el teclado siguen apagados hasta que los permitas en Ajustes → Permisos."+ },+ "voice": {+ "title": "¿Cómo lo llamas?",+ "lede": "Di una palabra propia o pulsa un atajo. La palabra también será su nombre.",+ "wake_title": "Una palabra de activación",+ "wake_body": "Di «Hey …» cuando quieras. Escucha tu palabra en este ordenador.",+ "shortcut_title": "Un atajo de teclado",+ "shortcut_body": "Pulsa el atajo de llamada para hablar. Nada escucha hasta entonces.",+ "shortcut_body_keys": "Nada escucha hasta que pulses",+ "prefix": "Hey",+ "word_label": "Tu palabra de activación",+ "placeholder": "Nova",+ "name_intro": "Tu asistente se llamará",+ "name_hint": "Elige cualquier palabra de al menos dos letras.",+ "trademark": "Elige una palabra que no sea una marca de otra persona.",+ "how_to_check": "Cómo comprobarlo",+ "refs_caveat": "Estos enlaces son solo informativos y pueden estar incompletos.",+ "ack": "Soy responsable de la palabra que elijo.",+ "mic_test": "Probar micrófono",+ "mic_listening": "Escuchando. Di algo ahora.",+ "mic_failed": "La prueba del micrófono no respondió. Puedes volver a intentarlo más tarde en Ajustes.",+ "mic_permission": "La aplicación aún no puede usar el micrófono. Permítelo en los ajustes del sistema y vuelve a probar.",+ "mic_no_device": "No se encontró ningún micrófono. Puedes escribir igualmente y conectar uno más tarde.",+ "mic_quiet": "Muy bajo. Acércate o sube el volumen de entrada y vuelve a probar.",+ "mic_good": "Suena bien. Tu voz llegó con claridad.",+ "skip_after_error": "Omitir este paso y configurarlo más tarde en Ajustes",+ "continue_anyway": "Seguir con el atajo por ahora",+ "save": "Guardar y continuar",+ "summary_shortcut": "Atajo de teclado",+ "summary_shortcut_keys": "Atajo {keys}",+ "gap_not_persisted": "No se pudo escribir la elección en el archivo de ajustes, así que desaparecerá tras el reinicio. Vuelve a elegirla en Ajustes → Palabra de activación.",+ "gap_degraded": "«{phrase}» está guardada, pero todavía nada puede oírla. Instala el reconocimiento de voz local en Ajustes → Palabra de activación; mientras tanto funciona el atajo de llamada.",+ "gap_skipped": "No hay activación configurada. Usa el atajo de llamada o elige una palabra de activación en Ajustes."+ },+ "ready": {+ "title": "Todo listo",+ "lede": "Esto es lo que configuraste. Un reinicio lo aplica todo y después una breve visita te enseña la aplicación.",+ "say": "Di «{phrase}» y {assistant} responde.",+ "row_brain": "Cerebro",+ "row_agents": "Agentes",+ "row_permissions": "Permisos",+ "row_voice": "Activación",+ "not_set": "Sin configurar",+ "skipped_brain": "Aún no hay clave de API. El chat y la voz siguen apagados hasta que añadas una en Ajustes → Claves API.",+ "skipped_agents": "Aún no hay agente de programación. Conecta uno cuando quieras en Ajustes → Claves API.",+ "skipped_permissions": "Se omitieron los permisos de macOS. Permítelos en Ajustes → Permisos.",+ "skipped_voice": "No hay activación configurada. Usa el atajo de llamada o elige una palabra de activación en Ajustes.",+ "autostart": "Iniciar al entrar en la sesión",+ "autostart_hint": "Funciona en segundo plano después de iniciar sesión.",+ "restart_note": "La aplicación se reinicia una vez y tarda unos diez segundos en prepararse. Es normal.",+ "start_failed": "No se pudo terminar la configuración. Comprueba que la aplicación está en marcha y vuelve a intentarlo.",+ "starting": "Iniciando…",+ "start": "Empezar",+ "start_named": "Iniciar {assistant}"+ }+ },+ "app_tour": {+ "label": "Visita guiada",+ "next": "Siguiente",+ "finish": "Terminar",+ "skip": "Saltar visita",+ "step_of": "{current} de {total}",+ "replay_title": "Visita guiada",+ "replay_body": "Un recorrido breve por la aplicación con el foco, el mismo que viste tras la configuración.",+ "replay": "Repetir visita",+ "steps": {+ "voice": "Así hablas con {name}. Haz clic en la barra, di tu palabra de activación o pulsa tu atajo de llamada, y habla. La onda muestra quién está hablando.",+ "new_chat": "¿Prefieres escribir? Empieza aquí un chat nuevo, por texto o por voz. Cada conversación queda en Chats recientes.",+ "agents": "Los agentes son tu equipo: ayudantes que se encargan de trabajos grandes en segundo plano. Echemos un vistazo.",+ "agents_world": "Este es el Verse, tus agentes trabajando. Haz clic en uno para chatear con él o darle una tarea. Siguiente te lleva de vuelta.",+ "voice_hub": "En Voz tienes el dictado en cualquier aplicación, tu propia lista de palabras y atajos hablados.",+ "artifacts": "Todo lo que {name} crea, desde páginas hasta imágenes e informes, se guarda en Artefactos.",+ "ide": "El Agentic IDE ejecuta agentes de programación uno al lado del otro en terminales reales, sobre tus proyectos.",+ "plugins": "Plugins, skills y MCP conectan a {name} con tus aplicaciones. El icono de la tienda, abajo, abre el Marketplace.",+ "settings": "Aquí están los ajustes, las claves de API, los costes y tu perfil. Puedes repetir esta visita cuando quieras en Ajustes → Aplicación.",+ "done": "Esa es la visita. Ya está todo listo: habla con {name} cuando quieras."+ }+ }+}diff --git a/jarvis/ui/web/frontend/src/i18n/onboarding-i18n-parity.test.ts b/jarvis/ui/web/frontend/src/i18n/onboarding-i18n-parity.test.tsindex 60cd95e40b..313844d951 100644--- a/jarvis/ui/web/frontend/src/i18n/onboarding-i18n-parity.test.ts+++ b/jarvis/ui/web/frontend/src/i18n/onboarding-i18n-parity.test.ts@@ -1,7 +1,16 @@+/**+ * The first-run guide and the app tour keep their strings in the lazy+ * `onboarding` locale chunk. Every key the code asks for must exist in+ * English, and German and Spanish must carry exactly the keys English does.+ */+import { readdirSync, readFileSync, statSync } from "node:fs";+import { join } from "node:path";import { describe, expect, it } from "vitest";-import en from "./locales/en.json";-import de from "./locales/de.json";-import es from "./locales/es.json";+import { BEAT_IDS } from "@/components/onboarding/beats";+import en from "./locales/onboarding/en.json";+import de from "./locales/onboarding/de.json";+import es from "./locales/onboarding/es.json";+import mainEn from "./locales/en.json";function flatten(obj: Record<string, unknown>, prefix = ""): string[] {const out: string[] = [];@@ -16,21 +25,65 @@ function flatten(obj: Record<string, unknown>, prefix = ""): string[] {return out;}-const keysFor = (loc: Record<string, unknown>): Set<string> =>- new Set(flatten((loc.onboarding ?? {}) as Record<string, unknown>));+const keysOf = (loc: unknown) => new Set(flatten(loc as Record<string, unknown>));-describe("onboarding i18n parity", () => {- it("en defines a non-trivial onboarding key set", () => {- expect(keysFor(en as Record<string, unknown>).size).toBeGreaterThan(20);- });+const SRC = join(__dirname, "..");++function sources(dir: string): string[] {+ const out: string[] = [];+ for (const name of readdirSync(dir)) {+ const full = join(dir, name);+ if (statSync(full).isDirectory()) out.push(...sources(full));+ else if (/\.tsx?$/.test(name) && !/\.test\.tsx?$/.test(name)) out.push(full);+ }+ return out;+}++describe("onboarding locale chunk", () => {+ const enKeys = keysOf(en);for (const [lang, loc] of [["de", de], ["es", es]] as const) {- it(`${lang} has the same onboarding keys as en`, () => {- const enKeys = keysFor(en as Record<string, unknown>);- const langKeys = keysFor(loc as Record<string, unknown>);+ it(`${lang} has exactly the keys en has`, () => {+ const langKeys = keysOf(loc);const missing = [...enKeys].filter((k) => !langKeys.has(k));const extra = [...langKeys].filter((k) => !enKeys.has(k));expect({ missing, extra }).toEqual({ missing: [], extra: [] });});}++ it("defines every literal key the code asks for", () => {+ const used = new Set<string>();+ for (const file of sources(SRC)) {+ const text = readFileSync(file, "utf8");+ for (const m of text.matchAll(/"((?:first_run|app_tour)\.[a-z0-9_.]+)"/g)) used.add(m[1]);+ }+ expect(used.size).toBeGreaterThan(40);+ const missing = [...used].filter((k) => !enKeys.has(k));+ expect(missing).toEqual([]);+ });++ it("gives every beat its title, lede and review row", () => {+ for (const beat of BEAT_IDS) {+ expect(enKeys.has(`first_run.${beat}.title`), beat).toBe(true);+ expect(enKeys.has(`first_run.${beat}.lede`), beat).toBe(true);+ }+ for (const beat of ["brain", "agents", "permissions", "voice"]) {+ expect(enKeys.has(`first_run.ready.row_${beat}`), beat).toBe(true);+ expect(enKeys.has(`first_run.ready.skipped_${beat}`), beat).toBe(true);+ }+ });++ it("does not collide with the startup dictionary", () => {+ // The resolver reads the startup dictionary first, so a namespace there+ // would silently shadow the chunk.+ const main = mainEn as Record<string, unknown>;+ expect(main.first_run).toBeUndefined();+ expect(main.app_tour).toBeUndefined();+ expect(main.onboarding).toBeUndefined();+ });++ it("never names the assistant with a trademark — only the {name} token", () => {+ const text = JSON.stringify(en) + JSON.stringify(de) + JSON.stringify(es);+ expect(text).not.toMatch(/\bJarvis\b/);+ });});diff --git a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsxindex 092042ad4e..f02074aafd 100644--- a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx+++ b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx@@ -1,10 +1,11 @@import { useState } from "react";-import { Monitor, Moon, Power, Sun, Zap } from "lucide-react";+import { Compass, Monitor, Moon, Power, Sun, Zap } from "lucide-react";+import { TOUR_START_EVENT } from "@/components/onboarding/tourEvents";import { Switch } from "@/components/ui/switch";import { useAutostart } from "@/hooks/useAutostart";import { useTheme, type ThemePreference } from "@/hooks/useTheme";import { useEventStore } from "@/store/events";-import { useT } from "@/i18n";+import { useLocaleChunk, useT } from "@/i18n";/*** "App settings" group inside the Settings view. Currently hosts the@@ -29,6 +30,39 @@ export function AppSettingsGroup() {</h3><AppearanceRow /><AutostartRow />+ <TourRow />+ </div>+ );+}++/**+ * Replays the guided tour of the app — the spotlight walk that runs once+ * after first-run setup. The strings live in the onboarding locale chunk,+ * which this row loads for itself.+ */+function TourRow() {+ const t = useT();+ const ready = useLocaleChunk("onboarding");+ if (!ready) return null;+ return (+ <div className="rounded-lg border border-border bg-card p-4">+ <div className="flex items-start gap-3">+ <Compass className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />+ <div className="min-w-0 flex-1">+ <div className="flex flex-wrap items-center justify-between gap-3">+ <h4 className="font-medium">{t("app_tour.replay_title")}</h4>+ <button+ type="button"+ onClick={() => window.dispatchEvent(new CustomEvent(TOUR_START_EVENT))}+ data-testid="settings-replay-tour"+ className="inline-flex items-center rounded-md border border-border bg-background px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ {t("app_tour.replay")}+ </button>+ </div>+ <p className="mt-0.5 text-xs text-muted-foreground">{t("app_tour.replay_body")}</p>+ </div>+ </div></div>);}diff --git a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsxindex 8b080085a9..023f39c2fb 100644--- a/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx+++ b/jarvis/ui/web/frontend/src/views/society/SocietyView.tsx@@ -166,7 +166,7 @@ export function SocietyView() {);return (- <div className={mode === "world" ? "fixed inset-x-0 bottom-0 top-8 z-30 flex flex-col bg-background" : "relative flex h-full min-h-0 w-full flex-col"} data-testid="society-view">+ <div className={mode === "world" ? "fixed inset-x-0 bottom-0 top-8 z-30 flex flex-col bg-background" : "relative flex h-full min-h-0 w-full flex-col"} data-testid="society-view" data-tour="agents-page"><div className="flex min-h-0 min-w-0 flex-1 flex-col">{/* Map mode takes the native window fullscreen, so the switch cannotlive inside the map HUD: it would shrink into the corner and stranddiff --git a/jarvis/ui/web/onboarding_routes.py b/jarvis/ui/web/onboarding_routes.pyindex 1acad12920..2ea51e072b 100644--- a/jarvis/ui/web/onboarding_routes.py+++ b/jarvis/ui/web/onboarding_routes.py@@ -154,4 +154,15 @@ def post_complete(request: Request) -> dict:return {"ok": True, "restarting": restarting}[email protected]("/tour-complete")+def post_tour_complete() -> dict:+ """The guided tour of the real app was finished or skipped.++ No restart and no desktop guard: it only records that the one-time tour+ has been seen, exactly like the step progress route.+ """+ st.mark_tour_complete(_path())+ return {"ok": True}++__all__ = ["router"]diff --git a/scripts/ci/test-baseline-linux.json b/scripts/ci/test-baseline-linux.jsonindex b88511d669..fe45591cfa 100644--- a/scripts/ci/test-baseline-linux.json+++ b/scripts/ci/test-baseline-linux.json@@ -151,9 +151,6 @@"tests.unit.test_tts_defaults_parity::test_all_tts_providers_have_defaults_entry","tests.unit.ui.jarvisbar.test_qt_overlay::test_full_frame_paint_clears_black_backing_and_previous_pixels","tests.unit.ui.test_icon_identity::test_bundled_app_icon_png_is_white_rounded_tile",- "tests.unit.ui.test_overlay_style_parity::test_onboarding_labels_and_captions_cover_every_style[de]",- "tests.unit.ui.test_overlay_style_parity::test_onboarding_labels_and_captions_cover_every_style[en]",- "tests.unit.ui.test_overlay_style_parity::test_onboarding_labels_and_captions_cover_every_style[es]","tests.unit.ui.test_relauncher::test_main_spawns_branded_exe_with_the_loop_guard","tests.unit.ui.web.test_skills_routes::test_creator_author_writes_a_draft_skill_with_a_brain","tests.unit.ui.web.test_society_figure_routes::test_a_contract_figure_is_accepted_stored_and_served",diff --git a/scripts/ci/test-baseline-windows.json b/scripts/ci/test-baseline-windows.jsonindex bfcfd09afe..a0bb8049d3 100644--- a/scripts/ci/test-baseline-windows.json+++ b/scripts/ci/test-baseline-windows.json@@ -161,9 +161,6 @@"tests.unit.test_router_delegator_policy.TestDelegatorPolicyInPrompt::test_default_on_uncertainty_is_self_serve","tests.unit.test_tts_defaults_parity::test_all_tts_providers_have_defaults_entry","tests.unit.ui.test_icon_identity::test_bundled_app_icon_png_is_white_rounded_tile",- "tests.unit.ui.test_overlay_style_parity::test_onboarding_labels_and_captions_cover_every_style[de]",- "tests.unit.ui.test_overlay_style_parity::test_onboarding_labels_and_captions_cover_every_style[en]",- "tests.unit.ui.test_overlay_style_parity::test_onboarding_labels_and_captions_cover_every_style[es]","tests.unit.ui.test_relaunch_properties::test_relaunch_properties_stick_on_a_real_window","tests.unit.ui.web.test_skills_routes::test_creator_author_writes_a_draft_skill_with_a_brain","tests.unit.ui.web.test_society_figure_routes::test_a_contract_figure_is_accepted_stored_and_served",diff --git a/tests/unit/setup/test_onboarding_fastpath.py b/tests/unit/setup/test_onboarding_fastpath.pyindex 5eedaa198c..c425a29cab 100644--- a/tests/unit/setup/test_onboarding_fastpath.py+++ b/tests/unit/setup/test_onboarding_fastpath.py@@ -66,6 +66,22 @@ async def test_accept_terms_persists(tmp_path: Path) -> None:fp._STATE_PATH_OVERRIDE = None+async def test_tour_complete_persists(tmp_path: Path) -> None:+ fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"+ try:+ sent, send = _collector()+ await fp.handle(_scope("GET", "/api/onboarding/state"), _receive_empty, send)+ assert _body_json(sent)["tour_completed"] is False+ sent2, send2 = _collector()+ await fp.handle(_scope("POST", "/api/onboarding/tour-complete"), _receive_empty, send2)+ assert sent2[0]["status"] == 200+ sent3, send3 = _collector()+ await fp.handle(_scope("GET", "/api/onboarding/state"), _receive_empty, send3)+ assert _body_json(sent3)["tour_completed"] is True+ finally:+ fp._STATE_PATH_OVERRIDE = None++async def test_complete_persists_and_next_state_is_completed(tmp_path: Path) -> None:fp._STATE_PATH_OVERRIDE = tmp_path / "setup_state.json"try:diff --git a/tests/unit/setup/test_onboarding_meta.py b/tests/unit/setup/test_onboarding_meta.pyindex 409771eb8f..2af8464527 100644--- a/tests/unit/setup/test_onboarding_meta.py+++ b/tests/unit/setup/test_onboarding_meta.py@@ -3,25 +3,24 @@ from jarvis.setup import onboarding_meta as mdef test_meta_constants():assert m.CURRENT_TERMS_VERSION == "1.0"- assert m.ONBOARDING_STEPS[0] == "welcome"- # The standalone Terms & Disclaimer step was removed (2026-07-03); the risk- # gate + MIT-license disclaimer carry the legal posture now.- assert "terms" not in m.ONBOARDING_STEPS- assert m.ONBOARDING_STEPS[1] == "language"- # Restart batching (2026-07-18): permissions + wake-word sit LAST before- # finish so the single unconditional completion restart covers both — the- # guide must never force a second mid-flow restart.- assert m.ONBOARDING_STEPS[2] == "api-keys"- assert m.ONBOARDING_STEPS.index("permissions") < m.ONBOARDING_STEPS.index("wake-word")- assert m.ONBOARDING_STEPS[-1] == "finish"- assert "wake-word" in m.ONBOARDING_STEPS- assert "persona-theme" not in m.ONBOARDING_STEPS- # Persona-name, overlay-style and the mic check were moved out of onboarding- # to keep first-run short (removed 2026-06-20).- assert "system-style" not in m.ONBOARDING_STEPS- assert "mic-test" not in m.ONBOARDING_STEPS- assert m.ONBOARDING_STEPS[-2] == "wake-word"- assert len(m.ONBOARDING_STEPS) == 6+ # The guide is one morphing card (rebuilt 2026-09-30): consent inside the+ # welcome step, one key, the detected agents, voice, then the start.+ assert m.ONBOARDING_STEPS == [+ "welcome",+ "brain",+ "agents",+ "permissions",+ "voice",+ "ready",+ ]+ # Restart batching (2026-07-18): permissions + voice sit LAST before the+ # final step so the single unconditional completion restart covers both;+ # permissions first so the macOS mic grant exists for the mic check.+ assert m.ONBOARDING_STEPS.index("permissions") < m.ONBOARDING_STEPS.index("voice")+ assert m.ONBOARDING_STEPS[-2] == "voice"+ # Retired step ids must not come back through a partial revert.+ for retired in ("terms", "language", "api-keys", "wake-word", "finish", "mic-test"):+ assert retired not in m.ONBOARDING_STEPSassert len(m.WAKE_WORD_LEGAL_REFERENCES) >= 3for ref in m.WAKE_WORD_LEGAL_REFERENCES:assert ref["label"] and ref["url"].startswith("https://")diff --git a/tests/unit/setup/test_reset_onboarding_cli.py b/tests/unit/setup/test_reset_onboarding_cli.pyindex 328576d070..c3103be317 100644--- a/tests/unit/setup/test_reset_onboarding_cli.py+++ b/tests/unit/setup/test_reset_onboarding_cli.py@@ -10,6 +10,7 @@ def test_reset_onboarding_clears_markers_and_keeps_foreign(tmp_path, monkeypatch# A foreign (non-onboarding) flag that must survive the reset.st._merge_state({"obsidian_setup_seen_at": "2026-01-01T00:00:00+00:00"}, state_file)st.mark_onboarding_complete(state_file)+ st.mark_tour_complete(state_file)assert st.is_onboarding_complete(state_file) is Truemonkeypatch.setattr(m.cfg, "DATA_DIR", tmp_path, raising=False)@@ -19,6 +20,8 @@ def test_reset_onboarding_clears_markers_and_keeps_foreign(tmp_path, monkeypatchassert rc == 0assert st.is_onboarding_complete(state_file) is False+ # A replayed first run tours the app again.+ assert st.get_onboarding_state(state_file)["tour_completed_at"] is Noneassert not setup_complete.exists()# Foreign key preserved.assert st.load_setup_state(state_file)["obsidian_setup_seen_at"] == "2026-01-01T00:00:00+00:00"diff --git a/tests/unit/ui/test_onboarding_routes.py b/tests/unit/ui/test_onboarding_routes.pyindex 99bcd370f7..3a946fe12f 100644--- a/tests/unit/ui/test_onboarding_routes.py+++ b/tests/unit/ui/test_onboarding_routes.py@@ -31,6 +31,15 @@ def test_state_starts_incomplete(client):assert body["steps"][0] == "welcome"assert len(body["legal_references"]) >= 3assert body["wake_word_acknowledged"] is False+ assert body["tour_completed"] is False+++def test_tour_complete_is_recorded_without_restart(client, monkeypatch):+ calls: list[int] = []+ monkeypatch.setattr(onboarding_routes, "_schedule_fresh_restart", lambda req: calls.append(1))+ assert client.post("/api/onboarding/tour-complete").json() == {"ok": True}+ assert client.get("/api/onboarding/state").json()["tour_completed"] is True+ assert calls == []def test_terms_endpoint(client):@@ -84,6 +93,7 @@ def test_router_registers_all_paths():"/api/onboarding/decline-terms","/api/onboarding/acknowledge-wake-word","/api/onboarding/complete",+ "/api/onboarding/tour-complete",}diff --git a/tests/unit/ui/test_overlay_style_parity.py b/tests/unit/ui/test_overlay_style_parity.pyindex f6781c9649..ea97440efd 100644--- a/tests/unit/ui/test_overlay_style_parity.py+++ b/tests/unit/ui/test_overlay_style_parity.py@@ -67,14 +67,6 @@ def test_settings_labels_cover_every_style(locale: str) -> None:assert all(str(label).strip() for label in options.values())[email protected]("locale", _locale_names())-def test_onboarding_labels_and_captions_cover_every_style(locale: str) -> None:- step = _locale(locale)["onboarding"]["system_style"]- assert sorted(step["options"]) == sorted(OVERLAY_STYLES)- assert sorted(step["captions"]) == sorted(OVERLAY_STYLES)- assert all(str(text).strip() for text in step["captions"].values())--def test_every_style_has_its_own_preview_graphic() -> None:# StylePreview falls THROUGH to the "hidden" thumbnail, so a style nobody# taught it renders as a crossed-out box that claims the overlay is off.