Skip to content

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.

feat(onboarding): run first-run setup inside the real app

rubenluetke10-beep383cf01ab05e
diff --git a/docs/authoring/public-docs-manifest.yaml b/docs/authoring/public-docs-manifest.yaml
index c27eef170d..0a924969d2 100644
--- a/docs/authoring/public-docs-manifest.yaml
+++ b/docs/authoring/public-docs-manifest.yaml
@@ -65,12 +65,10 @@ pages:
file: docs/product/start-here/first-run-setup.md
title: Complete First-Run Setup
diataxis: tutorial
- summary: Agree to the terms, connect one Brain, find your coding agents, choose how voice starts, then take the tour of the app.
+ summary: Setup runs inside the app. Agree to the terms, add one key on the API Keys page, pick a wake word in Settings, then take the tour.
authoritative_sources:
- - 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/setup/SetupTour.tsx
+ - jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts
- jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts
- jarvis/ui/web/onboarding_routes.py
related:
diff --git a/docs/product/start-here/first-run-setup.md b/docs/product/start-here/first-run-setup.md
index 149d3cae83..657de31523 100644
--- a/docs/product/start-here/first-run-setup.md
+++ b/docs/product/start-here/first-run-setup.md
@@ -1,7 +1,7 @@
---
title: "Complete First-Run Setup"
slug: first-run-setup
-summary: "Agree to the terms, connect one Brain, find your coding agents, choose how voice starts, then take the tour of the app."
+summary: "Setup runs inside the app. Agree to the terms, add one key on the API Keys page, pick a wake word in Settings, then take the tour."
section: "Start here"
section_order: 1
order: 3
@@ -15,10 +15,10 @@ tags: [setup, onboarding, tour, language, permissions, microphone, wake-word, pr
related: [providers-and-api-keys, audio-and-wake-word, permissions, start-your-first-chat]
---
-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.
+First-run setup happens inside the real app. There is no separate setup
+screen: the window dims and a small card with the mascot walks you to the
+places where each thing is really set, and waits there. Everything else is
+explained afterwards by a short tour of the app.
## Before You Start
@@ -28,15 +28,15 @@ afterwards by a short tour of the real app.
- On macOS, launch the signed app from its application bundle before granting
access; permissions belong to that exact app identity.
-> [!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.
+> [!warning] Paste a provider credential only into the masked key field on the
+> **API Keys** page. 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
-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
+While setup runs, only the highlighted part of the app and the card can be
+used. The dots on the card show where you are. **Back** returns to the
+previous step, never behind the agreement. If the window reloads, setup
reopens on the step you were on.
### 1. Agree to the terms
@@ -45,66 +45,45 @@ 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.
-1. Pick **English**, **Deutsch** or **Español** in the card's corner if you want
+1. Pick **English**, **Deutsch** or **Español** on the card 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.
+ closes the app without saving anything; setup asks again next time.
-### 2. Give it a brain
+### 2. Add one API key
-Choose one way to think and talk:
+Setup opens the **API Keys** page and highlights it. Paste one key into a
+provider card and save it:
-- **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.
+- An **OpenAI** or **Gemini** key is enough on its own: setup points live voice
+ and its thinking model at it and confirms **Connected**.
+- Any other provider's key becomes the Brain when none is active yet.
+- For a keyless start, turn on **Local Mode** on the same page and use Ollama.
-**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.
+**Continue** unlocks once a key is saved. **I'll add a key later** moves on;
+chat and voice then stay off until a key exists.
-### 3. Hand off the big jobs
+### 3. Allow access on this Mac (macOS only)
-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.
+Setup opens **Settings > Privacy permissions**. Use **Allow** or **Open
+Settings** on each row you want, return, and wait for the row to update. The
+restart at the end applies the grants. Windows and Linux skip this step.
-### 4. Allow access on this Mac (macOS only)
+### 4. Choose your wake word
-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.
+Setup opens **Settings** at the **Wake Word** group. **Hey** is fixed; type
+your own word after it and save. The word also becomes the assistant's name,
+for example **Hey Nova** makes an assistant called Nova. The card confirms when
+the wake word is on. Without a wake word, the Call keyboard shortcut starts a
+conversation.
-Windows and Linux do not show this step.
+### 5. All set
-### 5. Choose how you call it
-
-- **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**).
-
-**Test microphone** listens for three seconds and fills the level meter. It
-reports a clear, quiet, missing or blocked input and never blocks saving.
-
-### 6. All set
-
-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.
+The last card reads back the active Brain and how voice starts, and offers
+**Start at login** if your system supports it. **Start** saves the setup and
+restarts the app once so every choice takes effect together.
## Take the Tour
@@ -122,7 +101,7 @@ the Agentic IDE, Plugins and the Marketplace, and Settings.
## Recover a Skipped or Deferred Choice
- Change the interface and reply languages under **Settings > Languages**.
-- Connect and test models under **API Keys**; the same place connects coding
+- Connect and test models under **API Keys**; the same page 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
@@ -133,9 +112,10 @@ the Agentic IDE, Plugins and the Marketplace, and Settings.
## How It Fits Together
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
+2. Setup never has its own screens: each step uses the page you will use
+ later, so what you learn on day one is where things live.
+3. One key 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.
5. Permissions allow an operating-system capability; they do not approve a
@@ -157,9 +137,8 @@ Desktop-only features report their limits rather than prevent startup.
| What you see | What it usually means | What to do |
|---|---|---|
-| **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** |
+| **Continue** stays disabled on the key step | No key was saved yet, or saving failed | Read the line under the key field, fix the key, or choose **I'll add a key later** |
+| A card on the API Keys page reports a failing key | The provider refused the key or the account has no credit | Fix the account at the provider, or save a key from another provider |
| 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** |
diff --git a/jarvis/setup/onboarding_meta.py b/jarvis/setup/onboarding_meta.py
index 0ff3544bac..a34059e714 100644
--- a/jarvis/setup/onboarding_meta.py
+++ b/jarvis/setup/onboarding_meta.py
@@ -14,20 +14,20 @@ logger = logging.getLogger(__name__)
CURRENT_TERMS_VERSION = "1.0"
-# 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).
+# Canonical step order — must match SETUP_STEP_IDS in the frontend
+# (components/onboarding/setup/setupSteps.ts). Setup runs INSIDE the real app:
+# each step opens the app's own place for the job (the API Keys page, the
+# wake-word group in Settings) and points at it. The tour of the 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. Permissions precede voice
-# so the macOS microphone grant exists before the voice step's mic check.
+# (onboarding_routes._schedule_fresh_restart). Permissions precede voice so the
+# macOS microphone grant exists before the wake-word group's microphone test.
ONBOARDING_STEPS: list[str] = [
"welcome",
- "brain",
- "agents",
+ "keys",
"permissions",
"voice",
"ready",
diff --git a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.local-mode.test.tsx b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.local-mode.test.tsx
index 2181fa5048..41aaffc64d 100644
--- a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.local-mode.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.local-mode.test.tsx
@@ -156,15 +156,4 @@ describe("JarvisAgentSection — Local Mode", () => {
expect(screen.getAllByText("openai card").length).toBeGreaterThan(0);
expect(screen.queryAllByText("gemini card")).toHaveLength(0);
});
-
- it("shows subscription sign-ins in onboarding even when Local Mode is on", async () => {
- setLocalMode(true);
- vi.stubGlobal("fetch", mockFetch());
- render(<JarvisAgentSection hideHeader subscriptionsOnly />);
-
- await screen.findByTestId("onboarding-subscription-list");
- expect(screen.getByTestId("agent-group-clis")).toBeTruthy();
- expect(screen.queryByTestId("agent-group-api")).toBeNull();
- expect(screen.queryByTestId("local-mode-notice")).toBeNull();
- });
});
diff --git a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
index 0a86b58e38..578f7cfcca 100644
--- a/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
+++ b/jarvis/ui/web/frontend/src/components/JarvisAgentSection.tsx
@@ -175,13 +175,10 @@ async function pollStatusUntilConnected(
export function JarvisAgentSection({
hideHeader = false,
- subscriptionsOnly = false,
}: {
/** Suppress the section header — used inside the API-Keys "Subagents" tab,
* whose category hero already shows the title (avoids a double label). */
hideHeader?: boolean;
- /** First-run setup shows subscription sign-ins without the full provider console. */
- subscriptionsOnly?: boolean;
} = {}) {
const t = useT();
const [bridge, setBridge] = useState<SubagentStatus | null>(null);
@@ -279,9 +276,8 @@ export function JarvisAgentSection({
// Same rule as the provider tiers: own-hardware cards stay, plus whichever
// card is the ACTIVE worker, so the tab can always show what is running.
const isActiveRow = (r: SubagentMappingRow) => r.is_active_brain;
- const { visible: localVisibleRows, hiddenCount: hiddenByLocalMode } = subscriptionsOnly
- ? { visible: bridge.mapping, hiddenCount: 0 }
- : filterForLocalMode(bridge.mapping, localMode, isActiveRow);
+ const { visible: localVisibleRows, hiddenCount: hiddenByLocalMode } =
+ filterForLocalMode(bridge.mapping, localMode, isActiveRow);
const shown = new Set(localVisibleRows.map((r) => r.jarvis));
const inLocalMode = (r: SubagentMappingRow | undefined) =>
r && shown.has(r.jarvis) ? r : undefined;
@@ -333,39 +329,6 @@ export function JarvisAgentSection({
onToggle: () => toggleRow(id),
});
- if (subscriptionsOnly) {
- return (
- <section className="space-y-3" data-testid="onboarding-subscription-list">
- {hasSubscriptionColumn ? (
- <AgentGroup
- icon={Terminal}
- title={t("first_run.agents.subscriptions_label")}
- hint={t("first_run.agents.subscriptions_hint")}
- testId="agent-group-clis"
- >
- {codexRow && (
- <CodexConnectionCard status={codexStatus} row={codexRow} onChanged={reload} {...disclosure("openai-codex")} />
- )}
- {antigravityRow && (
- <AntigravityConnectionCard status={antigravityStatus} row={antigravityRow} onChanged={reload} {...disclosure("antigravity")} />
- )}
- {claudeRow && (
- <ClaudeConnectionCard status={claudeStatus} row={claudeRow} onChanged={reload} {...disclosure("claude-api:sub")} />
- )}
- {grokBuildRow && (
- <GrokBuildConnectionCard status={grokBuildStatus} row={grokBuildRow} onChanged={reload} {...disclosure("grok-build")} />
- )}
- {subProviderRows.map((row) => (
- <SubagentProviderCard key={row.jarvis} row={row} onSwitched={reload} {...disclosure(row.jarvis)} />
- ))}
- </AgentGroup>
- ) : (
- <p className="text-sm text-muted-foreground">{t("first_run.agents.unavailable")}</p>
- )}
- </section>
- );
- }
-
return (
<section className="space-y-4">
{!hideHeader && <SectionHeader label={t("apikeys_view.tier_subagent")} />}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
index bab26952bd..6057d71346 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
@@ -1,7 +1,9 @@
import { act, cleanup, render, screen, waitFor } from "@testing-library/react";
import { afterEach, expect, it, vi } from "vitest";
-vi.mock("./WelcomeFlow", () => ({ WelcomeStage: () => <div data-testid="guide" /> }));
+vi.mock("./setup/SetupTour", () => ({
+ SetupTour: ({ preview }: { preview: boolean }) => <div data-testid="guide" data-preview={String(preview)} />,
+}));
vi.mock("./tour/GuidedTour", () => ({
GuidedTour: ({ onDone }: { onDone: () => void }) => (
<button type="button" data-testid="tour" onClick={onDone}>
@@ -42,23 +44,24 @@ it("shows the guide while setup is not complete", async () => {
stub({ ...base, completed: false, tour_completed: false });
render(<OnboardingGate />);
await waitFor(() => expect(screen.getByTestId("guide")).toBeDefined());
- expect(screen.getByRole("dialog")).toBeDefined();
+ // A first run is real: it completes and restarts at its end.
+ expect(screen.getByTestId("guide").dataset.preview).toBe("false");
expect(screen.queryByTestId("tour")).toBeNull();
});
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());
+ await waitFor(() => expect(screen.queryByTestId("guide")).toBeNull());
rerender(<OnboardingGate activeSection="chats" />);
- await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());
+ await waitFor(() => expect(screen.getByTestId("guide")).toBeDefined());
});
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();
+ expect(screen.queryByTestId("guide")).toBeNull();
});
it("records the tour and closes it when it ends", async () => {
@@ -81,7 +84,7 @@ it("renders nothing when setup and tour are done", async () => {
stub({ ...base, completed: true, tour_completed: true });
render(<OnboardingGate />);
await new Promise((r) => setTimeout(r, 20));
- expect(screen.queryByRole("dialog")).toBeNull();
+ expect(screen.queryByTestId("guide")).toBeNull();
expect(screen.queryByTestId("tour")).toBeNull();
});
@@ -107,15 +110,26 @@ it("replays the tour on request from Settings", async () => {
it("fails open (renders nothing) on a fetch error", async () => {
stub("error");
render(<OnboardingGate />);
- await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull(), { timeout: 500 });
+ await waitFor(() => expect(screen.queryByTestId("guide")).toBeNull(), { timeout: 500 });
});
it("closes the guide when setup completes", async () => {
stub({ ...base, completed: false, tour_completed: false });
render(<OnboardingGate />);
- await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());
+ await waitFor(() => expect(screen.getByTestId("guide")).toBeDefined());
act(() => {
window.dispatchEvent(new CustomEvent("jarvis:onboarding-changed"));
});
- await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ await waitFor(() => expect(screen.queryByTestId("guide")).toBeNull());
+});
+
+it("replays the setup on a finished install without completing it", async () => {
+ stub({ ...base, completed: true, tour_completed: true });
+ window.history.replaceState(null, "", "/?onboarding=force");
+ try {
+ render(<OnboardingGate activeSection="chats" />);
+ await waitFor(() => expect(screen.getByTestId("guide").dataset.preview).toBe("true"));
+ } finally {
+ window.history.replaceState(null, "", "/");
+ }
});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
index 02e1e91ab9..ae145960fc 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
@@ -4,11 +4,11 @@ import { TOUR_START_EVENT } from "./tourEvents";
/**
* 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
+ * setup 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 WelcomeStage = lazy(() =>
- import("./WelcomeFlow").then((m) => ({ default: m.WelcomeStage })),
+const SetupTour = lazy(() =>
+ import("./setup/SetupTour").then((m) => ({ default: m.SetupTour })),
);
const GuidedTour = lazy(() =>
import("./tour/GuidedTour").then((m) => ({ default: m.GuidedTour })),
@@ -22,22 +22,25 @@ function param(name: string): string | null {
}
/**
- * First run, in two acts.
+ * First run, in two acts, both on the real app — there is no setup screen.
*
- * 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
+ * 1. Setup: the window dims and a guide walks the user to the app's own
+ * places — consent, the API Keys page, the wake word in Settings (and the
+ * macOS permissions) — until onboarding 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, a spotlight explains the app
* one control at a time. Shown once (`tour_completed`), replayable from
* Settings via `jarvis:tour-start`.
*
- * Dev replay, both non-destructive until the final action: `?onboarding=force`
- * opens the guide, `?tour=force` the tour.
+ * Replay, never destructive: `?onboarding=force` walks the setup on a
+ * finished install without completing or restarting anything, then hands
+ * over to the tour; `?tour=force` opens the tour alone.
*/
export function OnboardingGate({ activeSection }: { activeSection?: string } = {}) {
const onb = useOnboarding();
- // Set once the guide completes (the Start action dispatches
- // jarvis:onboarding-changed). Closes the stage even under ?onboarding=force.
+ // Set once setup completes (the Start action dispatches
+ // jarvis:onboarding-changed) or a replay ends.
const [dismissed, setDismissed] = useState(false);
const [tourRequested, setTourRequested] = useState(() => param("tour") === "force");
const [tourDone, setTourDone] = useState(false);
@@ -64,20 +67,20 @@ export function OnboardingGate({ activeSection }: { activeSection?: string } = {
if (onb.loading || onb.error || !onb.state) return null;
- const showGuide = (forced || !onb.state.completed) && !dismissed && (forced || !inIde);
- if (showGuide) {
+ const showSetup = (forced || !onb.state.completed) && !dismissed && (forced || !inIde);
+ if (showSetup) {
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>
+ <Suspense fallback={null}>
+ <SetupTour
+ onb={onb}
+ preview={forced && onb.state.completed}
+ onFinished={() => {
+ setDismissed(true);
+ setTourDone(false);
+ setTourRequested(true);
+ }}
+ />
+ </Suspense>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.test.tsx
deleted file mode 100644
index 7f56cad1bb..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.test.tsx
+++ /dev/null
@@ -1,182 +0,0 @@
-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.tsx
deleted file mode 100644
index 66ab94a966..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/WelcomeFlow.tsx
+++ /dev/null
@@ -1,320 +0,0 @@
-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-10"
- 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-1 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 ? 76 : 40}
- reactToVoice={false}
- enableComments={false}
- cue={cue}
- />
- </motion.div>
- <motion.div layout="position" className={cn("min-w-0", first ? "mt-3" : "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-5"
- >
- {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-6 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.ts
deleted file mode 100644
index f9f1a5bbed..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats.test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-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.ts
deleted file mode 100644
index 6ccb95336c..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.tsx
deleted file mode 100644
index d4c7baec04..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/AgentsBeat.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-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.tsx
deleted file mode 100644
index 186a7f7e11..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/BrainBeat.tsx
+++ /dev/null
@@ -1,420 +0,0 @@
-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.tsx
deleted file mode 100644
index b0bbef1c38..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/HelloBeat.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-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-1.5 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.tsx
deleted file mode 100644
index d358357df9..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/PermissionsBeat.tsx
+++ /dev/null
@@ -1,88 +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 { 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.tsx
deleted file mode 100644
index 2e1cc8be7f..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/ReadyBeat.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-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.tsx
deleted file mode 100644
index 3be22eef72..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.test.tsx
+++ /dev/null
@@ -1,181 +0,0 @@
-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.tsx
deleted file mode 100644
index d51d47efc6..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/beats/VoiceBeat.tsx
+++ /dev/null
@@ -1,375 +0,0 @@
-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.ts
index 071932f07d..e0300dc976 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.test.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import type { ProviderDescriptor } from "@/hooks/useProviders";
import type { StarterPlan } from "@/hooks/useStarterPlans";
-import { cardForPlan, planKeysComplete, startableProviders } from "./brainPlans";
+import { planKeysComplete, startableProviders } from "./brainPlans";
function provider(over: Partial<ProviderDescriptor> & { id: string }): ProviderDescriptor {
return {
@@ -57,10 +57,6 @@ describe("startableProviders", () => {
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 } })];
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.ts b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.ts
index b0dd5bd92a..7e7bef3fc9 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/brainPlans.ts
@@ -47,23 +47,6 @@ export function startableProviders(providers: ProviderDescriptor[]): ProviderDes
});
}
-/**
- * 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 (
@@ -73,14 +56,3 @@ export function planKeysComplete(plan: StarterPlan, startable: ProviderDescripto
)
);
}
-
-/** 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/setup/SetupTour.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.test.tsx
new file mode 100644
index 0000000000..2c8c62d0f0
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.test.tsx
@@ -0,0 +1,188 @@
+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, beforeAll, beforeEach, expect, it, vi } from "vitest";
+import { _resetProvidersCacheForTests } from "@/hooks/useProviders";
+import type { useOnboarding } from "@/hooks/useOnboarding";
+import { loadLocaleChunk } from "@/i18n";
+import { useEventStore } from "@/store/events";
+import { SetupTour } from "./SetupTour";
+
+type Onb = ReturnType<typeof useOnboarding>;
+
+const openai = {
+ id: "openai",
+ label: "OpenAI",
+ tier: "brain",
+ auth_mode: "api_key",
+ secret_keys: ["openai_api_key"],
+ secrets_set: {} as Record<string, boolean>,
+ dashboard_url: null,
+ login_cli: null,
+ install_hint: null,
+ credential_path_hint: null,
+ configured: false,
+ active: false,
+};
+
+const plan = {
+ id: "openai-live",
+ label: "OpenAI GPT-Live",
+ summary: "",
+ mode: "realtime",
+ recommended: true,
+ assignments: { brain: "openai" },
+ key_slots: [{ family: "openai", slot: "openai_api_key", label: "OpenAI", present: false }],
+ keys_complete: false,
+ ready_sections: [],
+};
+
+let providers = [openai];
+let calls: Array<{ url: string; method: string }> = [];
+
+function stubFetch() {
+ calls = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn().mockImplementation((url: string, init?: RequestInit) => {
+ const method = init?.method ?? "GET";
+ calls.push({ url, method });
+ const reply = (body: unknown) => Promise.resolve({ ok: true, status: 200, json: () => Promise.resolve(body) });
+ if (url === "/api/permissions/status") return reply({ platform: "win32" });
+ if (url === "/api/providers") return reply({ providers });
+ if (url === "/api/setup/starter-plans") return reply({ plans: [plan], selected: null, custom_id: "custom" });
+ if (url === "/api/settings/wake-word") return reply({ phrase: "", enabled: false });
+ if (url === "/api/settings/autostart") return reply({ enabled: false, supported: true });
+ return reply({ ok: true });
+ }),
+ );
+}
+
+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),
+ };
+}
+
+const accepted = { terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" } };
+
+beforeAll(async () => {
+ await loadLocaleChunk("onboarding");
+});
+
+beforeEach(() => {
+ providers = [{ ...openai, secrets_set: {} }];
+ _resetProvidersCacheForTests();
+ useEventStore.getState().setActiveSection("chats");
+ stubFetch();
+});
+
+afterEach(() => {
+ cleanup();
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+});
+
+it("asks for the consent first and opens the API Keys page after it", async () => {
+ const onb = fakeOnb();
+ render(<SetupTour onb={onb} preview={false} onFinished={vi.fn()} />);
+ const start = (await screen.findByTestId("onboarding-primary")) as HTMLButtonElement;
+ expect(start.disabled).toBe(true);
+ fireEvent.click(screen.getByTestId("onboarding-accept"));
+ await act(async () => {
+ fireEvent.click(start);
+ });
+ expect(onb.acceptTerms).toHaveBeenCalled();
+ await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("keys"));
+ expect(onb.saveStep).toHaveBeenCalledWith("keys", []);
+ await waitFor(() => expect(useEventStore.getState().activeSection).toBe("apikeys"));
+});
+
+it("waits for a key, and lets the user go on later", async () => {
+ const onb = fakeOnb({ ...accepted, current_step: "keys" });
+ render(<SetupTour onb={onb} preview={false} onFinished={vi.fn()} />);
+ await screen.findByTestId("setup-keys-waiting");
+ expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);
+ fireEvent.click(screen.getByTestId("setup-keys-later"));
+ await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("voice"));
+ expect(onb.saveStep).toHaveBeenLastCalledWith("voice", ["keys"]);
+ await waitFor(() => expect(useEventStore.getState().activeSection).toBe("settings"));
+});
+
+it("switches on the plan a key saved during the step completes", async () => {
+ render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "keys" })} preview={false} onFinished={vi.fn()} />);
+ await screen.findByTestId("setup-keys-waiting");
+ providers = [{ ...openai, secrets_set: { openai_api_key: true } }];
+ act(() => {
+ window.dispatchEvent(new CustomEvent("jarvis:secret-configured", { detail: { key: "openai_api_key", action: "set" } }));
+ });
+ await screen.findByTestId("setup-keys-connected");
+ expect(calls.some((c) => c.url === "/api/brain/switch" && c.method === "POST")).toBe(true);
+ expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false);
+});
+
+it("leaves a key that was already there exactly as it is", async () => {
+ providers = [{ ...openai, secrets_set: { openai_api_key: true } }];
+ render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "keys" })} preview={false} onFinished={vi.fn()} />);
+ await screen.findByTestId("setup-keys-present");
+ expect(calls.some((c) => c.url.includes("/switch"))).toBe(false);
+});
+
+it("completes onboarding from the last step", async () => {
+ const onb = fakeOnb({ ...accepted, current_step: "ready" });
+ const onFinished = vi.fn();
+ render(<SetupTour onb={onb} preview={false} onFinished={onFinished} />);
+ const start = await screen.findByTestId("onboarding-start");
+ await act(async () => {
+ fireEvent.click(start);
+ });
+ expect(onb.complete).toHaveBeenCalled();
+ expect(onFinished).not.toHaveBeenCalled();
+});
+
+it("walks a replay from the start and never writes, completes or restarts", async () => {
+ const onb = fakeOnb({ ...accepted, completed: true, current_step: "voice" });
+ const onFinished = vi.fn();
+ render(<SetupTour onb={onb} preview onFinished={onFinished} />);
+ // A replay shows every step, the consent included (already ticked).
+ await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("welcome"));
+ await act(async () => {
+ fireEvent.click(screen.getByTestId("onboarding-primary"));
+ });
+ await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("keys"));
+ fireEvent.click(await screen.findByTestId("setup-keys-later"));
+ await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("voice"));
+ fireEvent.click(screen.getByTestId("onboarding-primary"));
+ const start = await screen.findByTestId("onboarding-start");
+ await act(async () => {
+ fireEvent.click(start);
+ });
+ expect(onFinished).toHaveBeenCalled();
+ expect(onb.acceptTerms).not.toHaveBeenCalled();
+ expect(onb.saveStep).not.toHaveBeenCalled();
+ expect(onb.complete).not.toHaveBeenCalled();
+});
+
+it("dims the app and keeps its card above every dialog", async () => {
+ render(<SetupTour onb={fakeOnb()} preview={false} onFinished={vi.fn()} />);
+ await screen.findByTestId("setup-card");
+ const layer = screen.getByTestId("tour-layer");
+ expect(layer.hasAttribute("data-tour-layer")).toBe(true);
+ expect(screen.getByTestId("tour-dim").className).toContain("pointer-events-auto");
+});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx
new file mode 100644
index 0000000000..98a3a5023f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx
@@ -0,0 +1,537 @@
+import { AlertTriangle, ArrowLeft, Cloud, CreditCard, Lock, Monitor, Terminal } from "lucide-react";
+import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
+import { MascotGigi, type MascotAction } from "@/components/MascotGigi";
+import { Switch } from "@/components/ui/switch";
+import type { useOnboarding } from "@/hooks/useOnboarding";
+import { switchBrainProvider, useProviders } from "@/hooks/useProviders";
+import { applyStarterPlan, getStarterPlans, selectStarterPlan, type StarterPlan } from "@/hooks/useStarterPlans";
+import { useWakeWord } from "@/hooks/useWakeWord";
+import { fill, setUiLanguage, useLocaleChunk, useT, useUiLanguage, type UiLanguage } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { useEventStore } from "@/store/events";
+import { planKeysComplete, slotEffective, startableProviders } from "../brainPlans";
+import { ProgressDots } from "../ProgressDots";
+import { Spotlight } from "../tour/Spotlight";
+import { CheckLine, PrimaryAction, QuietAction, Status } from "../ui";
+import { resumeStep, SETUP_STEPS, stepsFor, type SetupStepId } from "./setupSteps";
+import { useAnchorRect } from "./useAnchorRect";
+
+type Onb = ReturnType<typeof useOnboarding>;
+
+const MASCOT: Record<SetupStepId, MascotAction> = {
+ welcome: "wave",
+ keys: "look-left",
+ voice: "look-right",
+ permissions: "look-left",
+ ready: "jump",
+};
+
+const LANGS: UiLanguage[] = ["en", "de", "es"];
+
+/**
+ * First-run setup, done inside the real app.
+ *
+ * There is no setup screen of its own: the window dims, and the guide walks
+ * the user to the places where each thing is really set — the API Keys page
+ * for one key, the wake-word group in Settings, on macOS the permissions —
+ * and waits there with a small card. The dim takes clicks, the hole does
+ * not: only the part being set up can be used, so nothing else starts before
+ * setup is done. Every step but the consent has a way on without doing it.
+ *
+ * The last step completes onboarding; the backend then restarts the app once
+ * and the tour of the app follows. `preview` (a replay) never completes and
+ * never restarts — it only walks the steps and hands over to the tour.
+ */
+export function SetupTour({
+ onb,
+ preview,
+ onFinished,
+}: {
+ onb: Onb;
+ preview: boolean;
+ onFinished: () => void;
+}) {
+ const t = useT();
+ const ready = useLocaleChunk("onboarding");
+ const [platform, setPlatform] = useState<string | null>(null);
+ const steps = useMemo(() => stepsFor(platform), [platform]);
+ // A replay shows every step from the start; a real first run resumes where
+ // it left off (never past the consent).
+ const [stepId, setStepId] = useState<SetupStepId>(() =>
+ preview
+ ? "welcome"
+ : resumeStep(stepsFor(null), onb.state?.current_step ?? null, Boolean(onb.state?.terms.accepted)),
+ );
+ const [skipped, setSkipped] = useState<string[]>(() => onb.state?.skipped_steps ?? []);
+ const [cue, setCue] = useState(0);
+ const step = SETUP_STEPS[stepId];
+
+ 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 {
+ // Best-effort: without the probe there is simply no permissions step.
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, []);
+
+ // Open the app's own place for this step before pointing at it.
+ useEffect(() => {
+ if (!ready || !step.section) return;
+ const nav = useEventStore.getState();
+ if (nav.activeSection !== step.section) nav.setActiveSection(step.section);
+ }, [ready, step.section, stepId]);
+
+ const rect = useAnchorRect(ready ? step.anchor : undefined, Boolean(step.scrollTo), stepId);
+
+ const cheer = useCallback(() => setCue((c) => c + 1), []);
+
+ const goTo = useCallback(
+ (target: SetupStepId, nextSkipped: string[]) => {
+ setStepId(target);
+ setCue((c) => c + 1);
+ if (!preview) void onb.saveStep(target, nextSkipped);
+ },
+ [onb, preview],
+ );
+
+ const index = Math.max(0, steps.indexOf(stepId));
+ const nextId = steps[index + 1] ?? null;
+ const prevId = index > 1 ? steps[index - 1] : null; // never back behind the consent
+
+ const next = useCallback(() => {
+ if (nextId) goTo(nextId, skipped);
+ }, [nextId, goTo, skipped]);
+
+ const later = useCallback(() => {
+ const nextSkipped = skipped.includes(stepId) ? skipped : [...skipped, stepId];
+ setSkipped(nextSkipped);
+ if (nextId) goTo(nextId, nextSkipped);
+ }, [skipped, stepId, nextId, goTo]);
+
+ if (!ready) return null;
+
+ const footer = (
+ <div className="mt-4 grid grid-cols-[1fr_auto_1fr] items-center gap-2">
+ <div>
+ {prevId && (
+ <QuietAction
+ onClick={() => goTo(prevId, skipped)}
+ className="inline-flex items-center gap-1 text-xs"
+ testId="setup-back"
+ >
+ <ArrowLeft aria-hidden className="h-3 w-3" />
+ {t("first_run.back")}
+ </QuietAction>
+ )}
+ </div>
+ <ProgressDots count={steps.length} index={index} />
+ <p className="text-right text-xs text-muted-foreground">
+ {fill(t("first_run.step_of"), { current: index + 1, total: steps.length })}
+ </p>
+ </div>
+ );
+
+ return (
+ <Spotlight rect={rect} placement={step.placement} blocking cardWidth={step.width}>
+ <div
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby="setup-title"
+ className="rounded-2xl border border-border bg-popover p-5 text-popover-foreground shadow-float"
+ data-testid="setup-card"
+ data-step={stepId}
+ >
+ <div className="flex items-start gap-3">
+ <MascotGigi size={40} reactToVoice={false} enableComments={false} cue={{ action: MASCOT[stepId], key: cue }} />
+ <div className="min-w-0 flex-1">
+ <h2 id="setup-title" className="text-base font-semibold tracking-tight text-foreground">
+ {t(`first_run.${stepId}.title`)}
+ </h2>
+ <p className="mt-1 text-sm leading-relaxed text-muted-foreground">{t(`first_run.${stepId}.lede`)}</p>
+ </div>
+ </div>
+ <div className="mt-4">
+ {stepId === "welcome" && <WelcomeStep onb={onb} preview={preview} onAccepted={() => { cheer(); next(); }} />}
+ {stepId === "keys" && <KeysStep next={next} later={later} cheer={cheer} />}
+ {stepId === "voice" && <VoiceStep next={next} />}
+ {stepId === "permissions" && <PermissionsStep next={next} />}
+ {stepId === "ready" && <ReadyStep onb={onb} preview={preview} onFinished={onFinished} />}
+ </div>
+ {footer}
+ </div>
+ </Spotlight>
+ );
+}
+
+/* ------------------------------------------------------------------ steps */
+
+function WelcomeStep({ onb, preview, onAccepted }: { onb: Onb; preview: boolean; onAccepted: () => void }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ 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);
+
+ async function toggleTerms() {
+ 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("");
+ }
+ }
+
+ async function proceed() {
+ if (!accepted || busy) return;
+ setBusy(true);
+ setError(null);
+ try {
+ if (!preview) await onb.acceptTerms();
+ onAccepted();
+ } catch {
+ setError(t("first_run.welcome.accept_failed"));
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ async function decline() {
+ // The goodbye shows first: the backend ends the process right after it answers.
+ setDeclined(true);
+ if (preview) return;
+ try {
+ await fetch("/api/onboarding/decline-terms", { method: "POST" });
+ } catch {
+ // A warming backend cannot hold the goodbye back; the window closes either way.
+ }
+ }
+
+ if (declined) {
+ return (
+ <div className="space-y-1" data-testid="onboarding-declined">
+ <p className="text-sm 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: string; Icon: typeof Terminal }[] = [
+ { key: "commands", Icon: Terminal },
+ { key: "screen", Icon: Monitor },
+ { key: "cloud", Icon: Cloud },
+ { key: "costs", Icon: CreditCard },
+ { key: "mistakes", Icon: AlertTriangle },
+ ];
+
+ return (
+ <div className="space-y-4">
+ <div className="flex items-center gap-0.5 self-start 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(
+ "flex-1 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>
+
+ <ul className="space-y-1.5 rounded-xl border border-border bg-background px-3.5 py-3" data-testid="onboarding-facts">
+ {facts.map(({ key, Icon }) => (
+ <li key={key} className="flex items-start gap-2.5 text-sm leading-snug text-foreground">
+ <Icon aria-hidden className="mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" />
+ <span>{t(`first_run.welcome.fact_${key}`)}</span>
+ </li>
+ ))}
+ </ul>
+
+ <div className="space-y-1.5">
+ <CheckLine checked={accepted} onChange={setAccepted} testId="onboarding-accept">
+ {t("first_run.welcome.accept")}
+ </CheckLine>
+ <QuietAction onClick={() => void toggleTerms()} className="ml-7 text-xs 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-32 overflow-y-auto whitespace-pre-wrap rounded-lg border border-border bg-background p-2.5 font-sans text-xs leading-relaxed text-muted-foreground scrollbar-jarvis">
+ {terms || t("first_run.welcome.terms_loading")}
+ </pre>
+ )}
+ </div>
+
+ {error && <Status tone="error">{error}</Status>}
+
+ <div className="space-y-2">
+ <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" className="text-xs">
+ {t("first_run.welcome.decline")}
+ </QuietAction>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+/**
+ * The API Keys page is open behind the card. The step waits for a key to
+ * land in any card there. A key saved during this step is also switched on:
+ * a starter plan that key completes points live voice and its thinking model
+ * at it; any other Brain key becomes the Brain when none is active yet. A key
+ * that was already there is left exactly as it is.
+ */
+function KeysStep({ next, later, cheer }: { next: () => void; later: () => void; cheer: () => void }) {
+ const t = useT();
+ const { providers } = useProviders();
+ const [plans, setPlans] = useState<StarterPlan[]>([]);
+ const [savedSlot, setSavedSlot] = useState<string | null>(null);
+ const [connecting, setConnecting] = useState(false);
+ const [connected, setConnected] = useState<string | null>(null);
+ const [partial, setPartial] = useState<string | null>(null);
+
+ useEffect(() => {
+ let cancelled = false;
+ getStarterPlans()
+ .then((res) => {
+ if (!cancelled) setPlans(res.plans);
+ })
+ .catch(() => {
+ // No plans (older backend): a saved key still becomes the Brain.
+ });
+ const onSaved = (event: Event) => {
+ const detail = (event as CustomEvent<{ key?: string; action?: string }>).detail;
+ if (detail?.action === "set" && typeof detail.key === "string") setSavedSlot(detail.key);
+ };
+ window.addEventListener("jarvis:secret-configured", onSaved);
+ return () => {
+ cancelled = true;
+ window.removeEventListener("jarvis:secret-configured", onSaved);
+ };
+ }, []);
+
+ const withKey = providers.filter((p) => (p.secret_keys?.length ?? 0) > 0 && slotEffective(p));
+ const localBrain = providers.some((p) => p.tier === "brain" && p.active && (p.secret_keys?.length ?? 0) === 0);
+ const hasKey = withKey.length > 0 || localBrain;
+
+ useEffect(() => {
+ if (!savedSlot || connecting || connected) return;
+ // Wait until the provider list reflects the key that was just saved.
+ const landed = providers.some((p) => p.secret_keys?.includes(savedSlot) && slotEffective(p));
+ if (!landed) return;
+ const startable = startableProviders(providers);
+ const plan = plans.find((p) => p.key_slots.some((s) => s.slot === savedSlot) && planKeysComplete(p, startable));
+ let cancelled = false;
+ setConnecting(true);
+ void (async () => {
+ try {
+ if (plan) {
+ await selectStarterPlan(plan.id).catch(() => undefined);
+ const outcome = await applyStarterPlan(plan);
+ if (cancelled) return;
+ if (outcome.failed.length > 0) setPartial(outcome.failed.map((f) => f.surface).join(", "));
+ setConnected(plan.label);
+ } else {
+ const brain = startable.find((p) => p.secret_keys.includes(savedSlot) && slotEffective(p));
+ if (brain && !startable.some((p) => p.active)) await switchBrainProvider(brain.id);
+ if (cancelled) return;
+ setConnected(brain?.label ?? withKey.find((p) => p.secret_keys.includes(savedSlot))?.label ?? savedSlot);
+ }
+ cheer();
+ } catch (e) {
+ if (!cancelled) setPartial(e instanceof Error ? e.message : String(e));
+ } finally {
+ if (!cancelled) setConnecting(false);
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [savedSlot, providers, plans]);
+
+ return (
+ <div className="space-y-3">
+ {connecting ? (
+ <Status tone="muted" testId="setup-keys-connecting">{t("first_run.keys.connecting")}</Status>
+ ) : connected ? (
+ <Status tone="ok" testId="setup-keys-connected">{fill(t("first_run.keys.connected"), { provider: connected })}</Status>
+ ) : hasKey ? (
+ <Status tone="ok" testId="setup-keys-present">{t("first_run.keys.present")}</Status>
+ ) : (
+ <Status tone="muted" testId="setup-keys-waiting">{t("first_run.keys.waiting")}</Status>
+ )}
+ {partial && <Status tone="warning">{fill(t("first_run.keys.partial"), { parts: partial })}</Status>}
+ <p className="flex items-start gap-1.5 text-xs leading-relaxed text-muted-foreground">
+ <Lock aria-hidden className="mt-0.5 h-3 w-3 shrink-0" />
+ {t("first_run.keys.security")}
+ </p>
+ <PrimaryAction onClick={next} disabled={!hasKey || connecting}>
+ {t("first_run.continue")}
+ </PrimaryAction>
+ {!hasKey && (
+ <div className="text-center">
+ <QuietAction onClick={later} testId="setup-keys-later" className="text-xs">
+ {t("first_run.keys.later")}
+ </QuietAction>
+ </div>
+ )}
+ </div>
+ );
+}
+
+/** The wake-word group of Settings is open behind the card; the step only says what is set. */
+function VoiceStep({ next }: { next: () => void }) {
+ const t = useT();
+ const { config } = useWakeWord();
+ const on = Boolean(config?.enabled && config.phrase.trim());
+ return (
+ <div className="space-y-3">
+ <Status tone={on ? "ok" : "muted"} testId="setup-voice-status">
+ {on ? fill(t("first_run.voice.on"), { phrase: config!.phrase }) : t("first_run.voice.off")}
+ </Status>
+ <PrimaryAction onClick={next}>{t("first_run.continue")}</PrimaryAction>
+ </div>
+ );
+}
+
+/** macOS only: the permission rows of Settings are open behind the card. */
+function PermissionsStep({ next }: { next: () => void }) {
+ const t = useT();
+ return (
+ <div className="space-y-3">
+ <p className="text-xs leading-relaxed text-muted-foreground">{t("first_run.permissions.note")}</p>
+ <PrimaryAction onClick={next}>{t("first_run.continue")}</PrimaryAction>
+ </div>
+ );
+}
+
+function ReviewRow({ label, value, ok }: { label: string; value: ReactNode; ok: boolean }) {
+ return (
+ <div className="flex items-center justify-between gap-3 border-b border-border px-3.5 py-2.5 last:border-b-0">
+ <dt className="text-sm text-muted-foreground">{label}</dt>
+ <dd className={cn("flex min-w-0 items-center gap-2 text-right text-sm", ok ? "font-medium text-foreground" : "text-muted-foreground")}>
+ <span className="truncate">{value}</span>
+ <span aria-hidden className={cn("h-1.5 w-1.5 shrink-0 rounded-full", ok ? "bg-success" : "bg-border-strong")} />
+ </dd>
+ </div>
+ );
+}
+
+/**
+ * What is set up, read back from the app itself, then the start. Completing
+ * restarts the app once so every choice takes effect together; the tour of
+ * the app follows the restart.
+ */
+function ReadyStep({ onb, preview, onFinished }: { onb: Onb; preview: boolean; onFinished: () => void }) {
+ const t = useT();
+ const { providers } = useProviders();
+ const { config } = useWakeWord();
+ const [autostart, setAutostart] = useState<{ enabled: boolean; supported: boolean } | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ let cancelled = false;
+ void (async () => {
+ try {
+ const res = await fetch("/api/settings/autostart");
+ if (res.ok && !cancelled) setAutostart((await res.json()) as { enabled: boolean; supported: boolean });
+ } catch {
+ // Best-effort; without the probe the switch is not shown.
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, []);
+
+ async function toggleAutostart(enabled: boolean) {
+ setAutostart((s) => (s ? { ...s, enabled } : s));
+ if (preview) return;
+ 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;
+ if (preview) {
+ onFinished();
+ return;
+ }
+ setBusy(true);
+ setError(null);
+ try {
+ await onb.complete();
+ } catch {
+ setError(t("first_run.ready.start_failed"));
+ setBusy(false);
+ }
+ }
+
+ const brain = providers.find((p) => p.tier === "brain" && p.active);
+ const brainOk = Boolean(brain && ((brain.secret_keys?.length ?? 0) === 0 || slotEffective(brain)));
+ const wakeOn = Boolean(config?.enabled && config.phrase.trim());
+
+ return (
+ <div className="space-y-3">
+ <dl className="overflow-hidden rounded-xl border border-border bg-background" data-testid="onboarding-review">
+ <ReviewRow label={t("first_run.ready.row_brain")} value={brainOk ? brain!.label : t("first_run.ready.no_key")} ok={brainOk} />
+ <ReviewRow
+ label={t("first_run.ready.row_voice")}
+ value={wakeOn ? config!.phrase : t("first_run.ready.shortcut")}
+ ok={wakeOn}
+ />
+ {autostart?.supported && (
+ <div className="flex items-center justify-between gap-3 px-3.5 py-2.5">
+ <span className="text-sm text-muted-foreground">{t("first_run.ready.autostart")}</span>
+ <Switch
+ checked={autostart.enabled}
+ onCheckedChange={(v) => void toggleAutostart(v)}
+ aria-label={t("first_run.ready.autostart")}
+ data-testid="onboarding-autostart"
+ />
+ </div>
+ )}
+ </dl>
+ {!brainOk && <Status tone="muted">{t("first_run.ready.no_key_note")}</Status>}
+ <p className="text-xs leading-relaxed text-muted-foreground">
+ {preview ? t("first_run.ready.preview_note") : t("first_run.ready.restart_note")}
+ </p>
+ {error && <Status tone="error">{error}</Status>}
+ <PrimaryAction onClick={() => void start()} busy={busy} testId="onboarding-start">
+ {busy ? t("first_run.ready.starting") : t("first_run.ready.start")}
+ </PrimaryAction>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.test.ts b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.test.ts
new file mode 100644
index 0000000000..8c112fada2
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.test.ts
@@ -0,0 +1,78 @@
+import { readdirSync, readFileSync, statSync } from "node:fs";
+import { join } from "node:path";
+import { describe, expect, it } from "vitest";
+import { resumeStep, SETUP_STEP_IDS, SETUP_STEPS, stepsFor } from "./setupSteps";
+
+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("setup steps", () => {
+ it("match ONBOARDING_STEPS in the backend", () => {
+ const py = readFileSync(join(SRC, "..", "..", "..", "..", "setup", "onboarding_meta.py"), "utf8");
+ const block = /ONBOARDING_STEPS: list\[str\] = \[([\s\S]*?)\]/.exec(py);
+ expect(block).not.toBeNull();
+ expect([...block![1].matchAll(/"([a-z-]+)"/g)].map((m) => m[1])).toEqual([...SETUP_STEP_IDS]);
+ });
+
+ it("ask for permissions on macOS only", () => {
+ expect(stepsFor("darwin")).toContain("permissions");
+ expect(stepsFor("win32")).not.toContain("permissions");
+ expect(stepsFor("linux")).not.toContain("permissions");
+ expect(stepsFor(null)).not.toContain("permissions");
+ });
+
+ it("start with the consent and end with the start", () => {
+ const steps = stepsFor("darwin");
+ expect(steps[0]).toBe("welcome");
+ expect(steps[steps.length - 1]).toBe("ready");
+ });
+
+ it("point only at anchors the app actually sets", () => {
+ const code = sources(SRC)
+ .filter((f) => !f.includes(join("components", "onboarding")))
+ .map((f) => readFileSync(f, "utf8"))
+ .join("\n");
+ for (const id of SETUP_STEP_IDS) {
+ const anchor = SETUP_STEPS[id].anchor;
+ if (!anchor) continue;
+ const literal = code.includes(`data-tour="${anchor}"`);
+ // Settings groups get theirs from a template: data-tour={`settings-${section.id}`}.
+ const group = anchor.startsWith("settings-") && code.includes("data-tour={`settings-${section.id}`}");
+ expect(literal || group, anchor).toBe(true);
+ }
+ });
+
+ it("open the app's own place for each job", () => {
+ expect(SETUP_STEPS.keys.section).toBe("apikeys");
+ expect(SETUP_STEPS.voice.section).toBe("settings");
+ expect(SETUP_STEPS.voice.anchor).toBe("settings-wake-word");
+ expect(SETUP_STEPS.welcome.anchor).toBeUndefined();
+ });
+});
+
+describe("resumeStep", () => {
+ const steps = stepsFor("win32");
+
+ it("never skips the consent", () => {
+ expect(resumeStep(steps, "voice", false)).toBe("welcome");
+ });
+
+ it("returns to the saved step once consent exists", () => {
+ expect(resumeStep(steps, "voice", true)).toBe("voice");
+ });
+
+ it("starts after the consent for an unknown or old step id", () => {
+ expect(resumeStep(steps, "api-keys", true)).toBe("keys");
+ expect(resumeStep(steps, null, true)).toBe("keys");
+ expect(resumeStep(steps, "welcome", true)).toBe("keys");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts
new file mode 100644
index 0000000000..af3b2882b9
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts
@@ -0,0 +1,73 @@
+/**
+ * First-run setup as data: the steps the guide walks through INSIDE the real
+ * app. There is no separate setup screen — each step opens the app's own
+ * place for the job (the API Keys page, the wake-word group in Settings) and
+ * points at it, so what the user learns on day one is where things live.
+ */
+import type { SectionId } from "@/store/events";
+import type { TourPlacement } from "../tour/tourSteps";
+
+/** Must match `ONBOARDING_STEPS` in jarvis/setup/onboarding_meta.py. */
+// Permissions precede voice so the macOS microphone grant exists before the
+// wake-word group's own microphone test.
+export const SETUP_STEP_IDS = ["welcome", "keys", "permissions", "voice", "ready"] as const;
+
+export type SetupStepId = (typeof SETUP_STEP_IDS)[number];
+
+export interface SetupStep {
+ id: SetupStepId;
+ /** Where the app goes before the step points; omitted = stay where it is. */
+ section?: SectionId;
+ /** The `data-tour` element the step points at; omitted = a centred card. */
+ anchor?: string;
+ /** Scroll the anchor to the top of its scrolling page first (a Settings group). */
+ scrollTo?: boolean;
+ placement: TourPlacement;
+ /** Card width in px — the consent and the review need more room. */
+ width: number;
+}
+
+export const SETUP_STEPS: Record<SetupStepId, SetupStep> = {
+ welcome: { id: "welcome", placement: "inside", width: 420 },
+ keys: { id: "keys", section: "apikeys", anchor: "apikeys-page", placement: "left", width: 320 },
+ voice: {
+ id: "voice",
+ section: "settings",
+ anchor: "settings-wake-word",
+ scrollTo: true,
+ placement: "left",
+ width: 320,
+ },
+ permissions: {
+ id: "permissions",
+ section: "settings",
+ anchor: "settings-permissions",
+ scrollTo: true,
+ placement: "left",
+ width: 320,
+ },
+ ready: { id: "ready", section: "chats", placement: "inside", width: 400 },
+};
+
+/**
+ * The steps this machine walks. Only macOS asks for permissions one ability
+ * at a time; Windows, Linux and a failed platform probe leave that step out
+ * (Settings stays the way to grant them later).
+ */
+export function stepsFor(platform: string | null): SetupStepId[] {
+ return SETUP_STEP_IDS.filter((id) => id !== "permissions" || platform === "darwin");
+}
+
+/**
+ * Where a resumed setup starts. The backend remembers the last step, so a
+ * window reload lands where the user was — never past the consent.
+ */
+export function resumeStep(
+ steps: readonly SetupStepId[],
+ saved: string | null,
+ termsAccepted: boolean,
+): SetupStepId {
+ if (!termsAccepted) return "welcome";
+ const hit = steps.find((id) => id === saved);
+ return hit && hit !== "welcome" ? hit : (steps[1] ?? "welcome");
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/useAnchorRect.ts b/jarvis/ui/web/frontend/src/components/onboarding/setup/useAnchorRect.ts
new file mode 100644
index 0000000000..c19dad4d6b
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/useAnchorRect.ts
@@ -0,0 +1,93 @@
+import { useEffect, useState } from "react";
+import type { Rect } from "../tour/tourSteps";
+
+/** How long a step waits for its element — the Settings page loads lazily. */
+const FIND_TIMEOUT_MS = 5000;
+const FIND_POLL_MS = 120;
+/** Re-measure while shown: cheap, and it catches layout shifts no observer reports. */
+const TRACK_MS = 400;
+
+function visibleAnchor(anchor: string): HTMLElement | null {
+ for (const el of document.querySelectorAll<HTMLElement>(`[data-tour="${anchor}"]`)) {
+ const r = el.getBoundingClientRect();
+ if (r.width > 0 && r.height > 0) return el;
+ }
+ return null;
+}
+
+/**
+ * The on-screen box of the element `anchor` names, clipped to the window,
+ * followed while it moves. `null` while it is not (yet) there, or when the
+ * step has no anchor at all. `scrollTo` brings the element to the top of its
+ * scrolling page once it appears — a Settings group further down the page.
+ */
+export function useAnchorRect(anchor: string | undefined, scrollTo: boolean, key: string): Rect | null {
+ const [rect, setRect] = useState<Rect | null>(null);
+
+ useEffect(() => {
+ setRect(null);
+ if (!anchor) return;
+ let cancelled = false;
+ let el: HTMLElement | null = null;
+ let findTimer = 0;
+ let trackTimer = 0;
+ let frame = 0;
+ let observer: ResizeObserver | null = null;
+ const started = performance.now();
+
+ const measure = () => {
+ cancelAnimationFrame(frame);
+ frame = requestAnimationFrame(() => {
+ if (cancelled) return;
+ if (!el || !el.isConnected) el = visibleAnchor(anchor);
+ if (!el) return;
+ const r = el.getBoundingClientRect();
+ // Clip to the window: a tall Settings group must not push the hole
+ // (and the card placed beside it) off screen.
+ const top = Math.max(r.top, 0);
+ const bottom = Math.min(r.bottom, window.innerHeight);
+ const next = { x: r.left, y: top, w: r.width, h: Math.max(0, bottom - top) };
+ setRect((prev) =>
+ prev &&
+ Math.abs(prev.x - next.x) < 0.5 &&
+ Math.abs(prev.y - next.y) < 0.5 &&
+ Math.abs(prev.w - next.w) < 0.5 &&
+ Math.abs(prev.h - next.h) < 0.5
+ ? prev
+ : next,
+ );
+ });
+ };
+
+ const find = () => {
+ if (cancelled) return;
+ el = visibleAnchor(anchor);
+ if (!el) {
+ if (performance.now() - started < FIND_TIMEOUT_MS) findTimer = window.setTimeout(find, FIND_POLL_MS);
+ return;
+ }
+ if (scrollTo) el.scrollIntoView({ block: "start" });
+ if (typeof ResizeObserver !== "undefined") {
+ observer = new ResizeObserver(measure);
+ observer.observe(el);
+ }
+ window.addEventListener("resize", measure);
+ window.addEventListener("scroll", measure, true);
+ trackTimer = window.setInterval(measure, TRACK_MS);
+ measure();
+ };
+ findTimer = window.setTimeout(find, 0);
+
+ return () => {
+ cancelled = true;
+ window.clearTimeout(findTimer);
+ window.clearInterval(trackTimer);
+ cancelAnimationFrame(frame);
+ observer?.disconnect();
+ window.removeEventListener("resize", measure);
+ window.removeEventListener("scroll", measure, true);
+ };
+ }, [anchor, scrollTo, key]);
+
+ return rect;
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsx b/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsx
index e48fa8af8d..088a95a2ec 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/Spotlight.tsx
@@ -1,6 +1,7 @@
import { motion, useReducedMotion } from "framer-motion";
import { useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";
import { createPortal } from "react-dom";
+import { TOUR_LAYER_ATTR } from "../tourEvents";
import { EASE_OUT } from "../ui";
import { cutout, padded, placeCard, type Rect, type TourPlacement } from "./tourSteps";
@@ -33,10 +34,19 @@ export function Spotlight({
rect,
placement,
children,
+ blocking = false,
+ cardWidth = CARD_W,
}: {
rect: Rect | null;
placement: TourPlacement;
children: ReactNode;
+ /**
+ * The dim takes clicks: only the hole (the element being set up) and the
+ * card stay usable. The setup steps use it so nothing else in the app can
+ * be pressed before the step is done; the app tour leaves the app free.
+ */
+ blocking?: boolean;
+ cardWidth?: number;
}) {
const view = useViewport();
const reduced = useReducedMotion() ?? false;
@@ -73,17 +83,18 @@ export function Spotlight({
// 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 width = Math.min(cardWidth, view.w - 24);
+ const pos = placeCard(hole, placement, { w: width, 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 className="pointer-events-none fixed inset-0 z-[110]" data-testid="tour-layer" {...{ [TOUR_LAYER_ATTR]: "" }}>
<div
aria-hidden
- className="absolute inset-0 bg-scrim/55"
+ className={blocking ? "pointer-events-auto absolute inset-0 bg-scrim/70" : "absolute inset-0 bg-scrim/60"}
style={{ clipPath: clip, WebkitClipPath: clip, transition: glide }}
data-testid="tour-dim"
/>
@@ -105,7 +116,7 @@ export function Spotlight({
<motion.div
ref={cardRef}
className="pointer-events-auto absolute left-0 top-0"
- style={{ width: Math.min(CARD_W, view.w - 24) }}
+ style={{ width }}
initial={false}
animate={{ x: pos.x, y: pos.y }}
transition={reduced ? { duration: 0 } : { duration: 0.32, ease: EASE_OUT }}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts
index 536ebe284f..eb7bcf70e1 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts
@@ -14,7 +14,7 @@ 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 type TourPlacement = "right" | "left" | "below" | "above" | "inside";
export interface TourStep {
/** Also the i18n key: `app_tour.steps.<id>`. */
@@ -107,6 +107,11 @@ export function placeCard(
}
return { x: clampX(x), y: clampY(rect.y + rect.h / 2 - card.h / 2) };
}
+ case "left": {
+ const x = rect.x - gap - card.w;
+ // No room on the left: lie over the element's left edge instead.
+ return { x: clampX(x < margin ? rect.x + 16 : x), y: clampY(rect.y + 24) };
+ }
case "below": {
const y = rect.y + rect.h + gap;
if (y + card.h + margin > view.h) {
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts b/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts
index 5f12b4d269..26ad88eed5 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts
@@ -1,6 +1,24 @@
/**
- * 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.
+ * The small, dependency-free contract between the first-run guide and the
+ * rest of the app. Its own module so callers (Settings, the Settings hub) do
+ * not import the gate itself — tests mock the gate wholesale.
*/
+
+/** Window event that asks the onboarding gate to replay the app tour. */
export const TOUR_START_EVENT = "jarvis:tour-start";
+
+/** Marks the guide's dim and card, so dialogs can tell its clicks apart. */
+export const TOUR_LAYER_ATTR = "data-tour-layer";
+
+/**
+ * True when an outside-interaction event of a dialog came from the guide's
+ * layer. A modal the guide points into must not close on a click on the
+ * guide's own card or dim.
+ */
+export function isTourEvent(event: {
+ target?: EventTarget | null;
+ detail?: { originalEvent?: Event };
+}): boolean {
+ const node = event.detail?.originalEvent?.target ?? event.target;
+ return node instanceof Element && node.closest(`[${TOUR_LAYER_ATTR}]`) !== null;
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/ui.tsx b/jarvis/ui/web/frontend/src/components/onboarding/ui.tsx
index e15f84e621..6c6dbd4e47 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/ui.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/ui.tsx
@@ -1,13 +1,12 @@
/**
- * The handful of pieces every beat of the first-run card is built from.
+ * The handful of pieces the first-run guide's cards are built from.
*
- * One rule runs through all of them: a beat has exactly ONE way forward that
+ * One rule runs through all of them: a card 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 { Loader2 } from "lucide-react";
import type { ReactNode } from "react";
import { FOCUS_RING } from "@/components/agentic/controls";
import { cn } from "@/lib/utils";
@@ -15,34 +14,7 @@ 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. */
+/** The card's one way forward: full width, ink on the room colour. */
export function PrimaryAction({
children,
onClick,
@@ -111,7 +83,7 @@ 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)
+ * Every step that checks something (a key, the wake word)
* answers with one of these, in place, instead of a toast somewhere else.
*/
export function Status({
@@ -173,78 +145,3 @@ export function CheckLine({
</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/i18n/locales/onboarding/de.json b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json
index 28fdf28216..3b5bef5624 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json
@@ -2,15 +2,14 @@
"first_run": {
"back": "Zurück",
"continue": "Weiter",
- "step_of": "Schritt {current} von {total}",
+ "step_of": "{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.",
+ "title": "Willkommen",
+ "lede": "Wir richten deinen Assistenten direkt hier in der App ein. Das dauert 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.",
@@ -26,116 +25,42 @@
"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."
+ "keys": {
+ "title": "Einen API-Schlüssel eintragen",
+ "lede": "Das ist die Seite API-Keys. Füge einen Schlüssel in eine Anbieter-Karte ein und speichere ihn. Mit OpenAI oder Gemini reicht ein einziger Schlüssel für Live-Sprache.",
+ "waiting": "Warte auf einen Schlüssel…",
+ "connecting": "Alles wird eingeschaltet…",
+ "connected": "Verbunden: {provider}.",
+ "present": "Ein Schlüssel ist gespeichert. Du kannst weiter.",
+ "partial": "Einige Teile wurden nicht umgestellt ({parts}). Du kannst das später auf dieser Seite beheben.",
+ "security": "Schlüssel liegen im Schlüsselbund deines Systems und gehen nur an den Anbieter, den du gewählt hast.",
+ "later": "Ich trage später einen Schlüssel ein"
},
"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."
+ "lede": "Das sind die Mac-Berechtigungen. Erlaube die, die du möchtest; jede Zeile aktualisiert sich selbst.",
+ "note": "Du kannst jederzeit in den Einstellungen zurückkommen. Der Neustart am Ende wendet sie an."
},
"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."
+ "title": "Wähle dein Weckwort",
+ "lede": "Tippe hier dein Wort nach „Hey“ ein und speichere es. Das Wort wird auch der Name deines Assistenten. Kein Weckwort? Das Anruf-Kürzel funktioniert immer.",
+ "on": "„{phrase}“ ist an. Sag es jederzeit.",
+ "off": "Noch kein Weckwort. Bis dahin funktioniert das Anruf-Kürzel."
},
"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.",
+ "lede": "Die App startet einmal neu, damit alles eingeschaltet ist. Danach zeigt dir eine kurze Tour die App.",
"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.",
+ "no_key": "Noch kein Schlüssel",
+ "shortcut": "Anruf-Kürzel",
"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.",
+ "no_key_note": "Ohne Schlüssel bleiben Chat und Sprache aus, bis du auf der Seite API-Keys einen einträgst.",
+ "preview_note": "Das ist eine Wiederholung, deshalb startet nichts neu. Starten öffnet die Tour.",
+ "restart_note": "Der Neustart dauert etwa zehn Sekunden.",
"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"
+ "start": "Starten"
}
},
"app_tour": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json
index f44fc57ff5..3ed2a8210a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json
@@ -2,15 +2,14 @@
"first_run": {
"back": "Back",
"continue": "Continue",
- "step_of": "Step {current} of {total}",
+ "step_of": "{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.",
+ "title": "Welcome",
+ "lede": "Let's set up your assistant right here in the app. It takes 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.",
@@ -26,116 +25,42 @@
"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."
+ "keys": {
+ "title": "Add one API key",
+ "lede": "This is the API Keys page. Paste one key into a provider card and save it. OpenAI or Gemini gives you live voice with a single key.",
+ "waiting": "Waiting for a key…",
+ "connecting": "Switching everything on…",
+ "connected": "Connected: {provider}.",
+ "present": "A key is saved. You can continue.",
+ "partial": "Some parts did not switch ({parts}). You can fix them later on this page.",
+ "security": "Keys go into your system's keychain and only ever to the provider you picked.",
+ "later": "I'll add a key later"
},
"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."
+ "lede": "These are the Mac permissions. Allow the ones you want; each row updates by itself.",
+ "note": "You can come back to them anytime in Settings. The restart at the end applies them."
},
"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."
+ "title": "Choose your wake word",
+ "lede": "Type your word after \"Hey\" here and save it. The word also becomes the assistant's name. No wake word? The Call shortcut works anytime.",
+ "on": "\"{phrase}\" is on. Say it anytime.",
+ "off": "No wake word yet. The Call shortcut works meanwhile."
},
"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.",
+ "lede": "The app restarts once to switch everything on. Then a short tour shows you around.",
"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.",
+ "no_key": "No key yet",
+ "shortcut": "Call shortcut",
"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.",
+ "no_key_note": "Without a key, chat and voice stay off until you add one on the API Keys page.",
+ "preview_note": "This is a replay, so nothing restarts. Start opens the tour.",
+ "restart_note": "The restart takes about ten seconds.",
"start_failed": "Setup could not be finished. Check that the app is running, then try again.",
"starting": "Starting…",
- "start": "Start",
- "start_named": "Start {assistant}"
+ "start": "Start"
}
},
"app_tour": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json
index 09304d81bb..bdf72b4abe 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json
@@ -2,15 +2,14 @@
"first_run": {
"back": "Atrás",
"continue": "Continuar",
- "step_of": "Paso {current} de {total}",
+ "step_of": "{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.",
+ "title": "Bienvenido",
+ "lede": "Configuramos tu asistente aquí mismo, en la aplicación. Tarda 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.",
@@ -26,116 +25,42 @@
"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."
+ "keys": {
+ "title": "Añade una clave de API",
+ "lede": "Esta es la página Claves API. Pega una clave en la tarjeta de un proveedor y guárdala. Con OpenAI o Gemini basta una sola clave para la voz en directo.",
+ "waiting": "Esperando una clave…",
+ "connecting": "Activando todo…",
+ "connected": "Conectado: {provider}.",
+ "present": "Hay una clave guardada. Puedes continuar.",
+ "partial": "Algunas partes no cambiaron ({parts}). Puedes arreglarlo más tarde en esta página.",
+ "security": "Las claves se guardan en el llavero de tu sistema y solo van al proveedor que elegiste.",
+ "later": "Añadiré una clave más tarde"
},
"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."
+ "lede": "Estos son los permisos del Mac. Permite los que quieras; cada fila se actualiza sola.",
+ "note": "Puedes volver a ellos cuando quieras en Ajustes. El reinicio final los aplica."
},
"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."
+ "title": "Elige tu palabra de activación",
+ "lede": "Escribe aquí tu palabra después de «Hey» y guárdala. La palabra también será el nombre de tu asistente. ¿Sin palabra? El atajo de llamada funciona siempre.",
+ "on": "«{phrase}» está activada. Dila cuando quieras.",
+ "off": "Aún no hay palabra de activación. Mientras tanto funciona el atajo de llamada."
},
"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.",
+ "lede": "La aplicación se reinicia una vez para activarlo todo. Después, una breve visita te enseña la aplicación.",
"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.",
+ "no_key": "Sin clave todavía",
+ "shortcut": "Atajo de llamada",
"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.",
+ "no_key_note": "Sin clave, el chat y la voz siguen apagados hasta que añadas una en la página Claves API.",
+ "preview_note": "Esto es una repetición, así que no se reinicia nada. Empezar abre la visita.",
+ "restart_note": "El reinicio tarda unos diez segundos.",
"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}"
+ "start": "Empezar"
}
},
"app_tour": {
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.ts
index 313844d951..9d64e2e86b 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
@@ -6,7 +6,7 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
-import { BEAT_IDS } from "@/components/onboarding/beats";
+import { SETUP_STEP_IDS } from "@/components/onboarding/setup/setupSteps";
import en from "./locales/onboarding/en.json";
import de from "./locales/onboarding/de.json";
import es from "./locales/onboarding/es.json";
@@ -62,14 +62,10 @@ describe("onboarding locale chunk", () => {
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("gives every setup step its title and lede", () => {
+ for (const step of SETUP_STEP_IDS) {
+ expect(enKeys.has(`first_run.${step}.title`), step).toBe(true);
+ expect(enKeys.has(`first_run.${step}.lede`), step).toBe(true);
}
});
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
index 10ba76238b..6ebbb478da 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
@@ -107,7 +107,7 @@ export function ApiKeysView() {
const modeTabs = engineMode === "realtime" ? REALTIME_TABS : PIPELINE_TABS;
return (
- <div className="flex h-full min-h-0 flex-col">
+ <div className="flex h-full min-h-0 flex-col" data-tour="apikeys-page">
<ViewHeader
icon={<KeyRound className="h-4 w-4 text-muted-foreground" />}
title={t("apikeys_view.title")}
diff --git a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx
index 84ca739131..77a185a279 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsHubView.tsx
@@ -1,4 +1,5 @@
import * as Dialog from "@radix-ui/react-dialog";
+import { isTourEvent } from "@/components/onboarding/tourEvents";
import { lazy, Suspense, useMemo, useRef, useState, type ComponentType, type LazyExoticComponent } from "react";
import { Loader2, Search, X } from "lucide-react";
import {
@@ -431,8 +432,13 @@ export function SettingsHubDialog({ onClose }: { onClose: () => void }) {
const opener = useRef(document.activeElement);
// A nested modal inside a tab (credential dialogs, pickers) owns outside
// clicks and Escape while it is open; so does an open combobox panel.
+ // The first-run guide dims the window over this dialog and points into it;
+ // a click on its card or its dim must not read as "outside" and close the
+ // very page it is pointing at.
const nestedOwnsEvent = (event: Event) =>
- isComboboxPanelEvent(event) || content.current?.querySelector('[aria-modal="true"]') != null;
+ isComboboxPanelEvent(event) ||
+ content.current?.querySelector('[aria-modal="true"]') != null ||
+ isTourEvent(event);
return (
<Dialog.Root open onOpenChange={(open) => { if (!open) onClose(); }}>
<Dialog.Portal>
diff --git a/jarvis/ui/web/frontend/src/views/SettingsView.tsx b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
index cda8e6ca3c..86c41c6054 100644
--- a/jarvis/ui/web/frontend/src/views/SettingsView.tsx
+++ b/jarvis/ui/web/frontend/src/views/SettingsView.tsx
@@ -141,6 +141,7 @@ export function SettingsView({ searchTarget, onSearchTargetHandled }: {
key={section.id}
id={`settings-${section.id}`}
data-settings-section={section.id}
+ data-tour={`settings-${section.id}`}
className="scroll-mt-4"
>
<SettingsGroupBoundary group={section.id}>
diff --git a/tests/unit/setup/test_onboarding_meta.py b/tests/unit/setup/test_onboarding_meta.py
index 2af8464527..b232d05f2a 100644
--- a/tests/unit/setup/test_onboarding_meta.py
+++ b/tests/unit/setup/test_onboarding_meta.py
@@ -3,23 +3,15 @@ from jarvis.setup import onboarding_meta as m
def test_meta_constants():
assert m.CURRENT_TERMS_VERSION == "1.0"
- # 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",
- ]
+ # Setup runs inside the real app (2026-09-30): consent, one key on the API
+ # Keys page, macOS permissions, the wake word in Settings, then the start.
+ assert m.ONBOARDING_STEPS == ["welcome", "keys", "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.
+ # final step so the single unconditional completion restart covers both.
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"):
+ for retired in ("terms", "language", "api-keys", "wake-word", "finish", "brain", "agents"):
assert retired not in m.ONBOARDING_STEPS
assert len(m.WAKE_WORD_LEGAL_REFERENCES) >= 3
for ref in m.WAKE_WORD_LEGAL_REFERENCES: