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): three-step setup window and a seven-stop walk through the app

rubenluetke10-beep95432d9500f5
diff --git a/jarvis/setup/onboarding_meta.py b/jarvis/setup/onboarding_meta.py
index 3d9018dffe..cc9db8ef63 100644
--- a/jarvis/setup/onboarding_meta.py
+++ b/jarvis/setup/onboarding_meta.py
@@ -15,27 +15,18 @@ logger = logging.getLogger(__name__)
CURRENT_TERMS_VERSION = "1.0"
# 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 and its
-# Agents tab, 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). Permissions precede voice so the
-# macOS microphone grant exists before the wake-word group's microphone test.
-# "how" (2026-10-01) is an interactive explainer of what the assistant is and
-# how its parts connect, shown before anything is set up — new users went
-# through setup without understanding the product.
+# (components/onboarding/setup/setupSteps.ts). Setup is one window with three
+# steps — the assistant's name (which is its wake word), connecting an AI
+# (subscriptions and an API key), and how the user talks to it — followed by
+# "tour": the user's pet walks the real app and explains each section. The
+# walk is one persisted step; onboarding completes, with its one unconditional
+# fresh restart (onboarding_routes._schedule_fresh_restart), when it ends, so
+# the wake-word and macOS permission changes made during setup take effect.
ONBOARDING_STEPS: list[str] = [
- "welcome",
- "how",
- "keys",
- "subscriptions",
- "permissions",
+ "name",
+ "connect",
"voice",
- "ready",
+ "tour",
]
# Informational only; not exhaustive and possibly out of date (stated in the UI).
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 d3a0d41e4c..aac21c4033 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
@@ -23,28 +23,19 @@ vi.mock("./setup/SetupTour", () => ({
</>
),
}));
-vi.mock("./tour/GuidedTour", () => ({
- GuidedTour: ({ onDone }: { onDone: () => void }) => (
+vi.mock("./setup/SectionWalk", () => ({
+ SectionWalk: ({ onDone }: { onDone: () => void }) => (
<button type="button" data-testid="tour" onClick={onDone}>
tour
</button>
),
}));
-vi.mock("./firstSteps/FirstStepsGuide", () => ({
- FirstStepsGuide: ({ onClose }: { onClose: () => void }) => (
- <button type="button" data-testid="first-steps" onClick={onClose}>
- first steps
- </button>
- ),
-}));
-
import { OnboardingGate } from "./OnboardingGate";
-import { FIRST_STEPS_START_EVENT, SETUP_REPLAY_EVENT, TOUR_START_EVENT } from "./tourEvents";
+import { SETUP_REPLAY_EVENT, TOUR_START_EVENT } from "./tourEvents";
afterEach(() => {
cleanup();
- window.localStorage.clear();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
@@ -55,7 +46,7 @@ const base = {
terms: { accepted: false, accepted_version: null, current_version: "1.0" },
wake_word_acknowledged: false,
legal_references: [],
- steps: ["welcome"],
+ steps: ["name"],
};
function stub(state: object | "error") {
@@ -72,7 +63,7 @@ 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());
- // A first run is real: it completes and restarts once its tour ends.
+ // A first run is real: it completes and restarts once its walk ends.
expect(screen.getByTestId("guide").dataset.preview).toBe("false");
expect(screen.queryByTestId("tour")).toBeNull();
});
@@ -162,7 +153,7 @@ it("replays the setup on a finished install without completing it", async () =>
}
});
-it("replays setup from the explainer on request from Settings", async () => {
+it("replays setup from the first step on request from Settings", async () => {
stub({ ...base, completed: true, tour_completed: true });
render(<OnboardingGate activeSection="profile" />);
await new Promise((r) => setTimeout(r, 20));
@@ -171,21 +162,21 @@ it("replays setup from the explainer on request from Settings", async () => {
window.dispatchEvent(new CustomEvent(SETUP_REPLAY_EVENT));
});
await waitFor(() => expect(screen.getByTestId("guide").dataset.preview).toBe("true"));
- expect(screen.getByTestId("guide").dataset.start).toBe("how");
+ expect(screen.getByTestId("guide").dataset.start).toBe("");
});
-it("goes from setup straight into the tour and completes when the tour ends", async () => {
+it("completes a real first run when its walk ends, the walk recorded first", async () => {
const fetchMock = stub({ ...base, completed: false, tour_completed: false });
render(<OnboardingGate activeSection="chats" />);
const guide = await screen.findByTestId("guide");
- act(() => guide.click());
- const tour = await screen.findByTestId("tour");
const urls = () => fetchMock.mock.calls.map((c) => String(c[0]));
- // Nothing completes (and nothing restarts) while the tour is still showing.
+ // Nothing completes (and nothing restarts) while the guide is still showing.
expect(urls()).not.toContain("/api/onboarding/complete");
- act(() => tour.click());
+ act(() => guide.click());
await waitFor(() => expect(urls()).toContain("/api/onboarding/complete"));
expect(urls().indexOf("/api/onboarding/tour-complete")).toBeLessThan(urls().indexOf("/api/onboarding/complete"));
+ expect(screen.queryByTestId("guide")).toBeNull();
+ expect(screen.queryByTestId("tour")).toBeNull();
});
it("never completes onboarding after a replayed setup", async () => {
@@ -197,53 +188,11 @@ it("never completes onboarding after a replayed setup", async () => {
});
const guide = await screen.findByTestId("guide");
act(() => guide.click());
- const tour = await screen.findByTestId("tour");
- act(() => tour.click());
- await waitFor(() => expect(screen.queryByTestId("tour")).toBeNull());
- await new Promise((r) => setTimeout(r, 20));
- expect(fetchMock.mock.calls.map((c) => String(c[0]))).not.toContain("/api/onboarding/complete");
-});
-
-it("hands the first tour over to the first-steps guide, and keeps it after a reload", async () => {
- stub({ ...base, completed: true, tour_completed: false });
- render(<OnboardingGate activeSection="chats" />);
- const tour = await screen.findByTestId("tour");
- act(() => tour.click());
- await waitFor(() => expect(screen.getByTestId("first-steps")).toBeDefined());
- cleanup();
- // The completion restart reloads the window: the guide comes back from storage.
- stub({ ...base, completed: true, tour_completed: true });
- render(<OnboardingGate activeSection="chats" />);
- await waitFor(() => expect(screen.getByTestId("first-steps")).toBeDefined());
-});
-
-it("does not bring the first-steps guide back once it was closed", async () => {
- stub({ ...base, completed: true, tour_completed: false });
- render(<OnboardingGate activeSection="chats" />);
- const tour = await screen.findByTestId("tour");
- act(() => tour.click());
- const guide = await screen.findByTestId("first-steps");
- act(() => guide.click());
- await waitFor(() => expect(screen.queryByTestId("first-steps")).toBeNull());
- // A later tour replay must not restart a guide the user already met.
- act(() => {
- window.dispatchEvent(new CustomEvent(TOUR_START_EVENT));
- });
- const again = await screen.findByTestId("tour");
- act(() => again.click());
- await new Promise((r) => setTimeout(r, 20));
- expect(screen.queryByTestId("first-steps")).toBeNull();
-});
-
-it("starts the first-steps guide on request from Settings", async () => {
- stub({ ...base, completed: true, tour_completed: true });
- render(<OnboardingGate activeSection="profile" />);
+ await waitFor(() => expect(screen.queryByTestId("guide")).toBeNull());
await new Promise((r) => setTimeout(r, 20));
- expect(screen.queryByTestId("first-steps")).toBeNull();
- act(() => {
- window.dispatchEvent(new CustomEvent(FIRST_STEPS_START_EVENT));
- });
- await waitFor(() => expect(screen.getByTestId("first-steps")).toBeDefined());
+ const urls = fetchMock.mock.calls.map((c) => String(c[0]));
+ expect(urls).not.toContain("/api/onboarding/complete");
+ expect(urls).not.toContain("/api/onboarding/tour-complete");
});
it("skips the whole first run: tour recorded, onboarding completed, no guide left", async () => {
@@ -257,17 +206,3 @@ it("skips the whole first run: tour recorded, onboarding completed, no guide lef
expect(screen.queryByTestId("guide")).toBeNull();
expect(screen.queryByTestId("tour")).toBeNull();
});
-
-it("starts the first-steps guide fresh at the end of a real first run, even if an old one was closed", async () => {
- window.localStorage.setItem(
- "jarvis.firstSteps.v1",
- JSON.stringify({ status: "dismissed", done: [], skipped: [], current: "wake", collapsed: false }),
- );
- stub({ ...base, completed: false, tour_completed: false });
- render(<OnboardingGate activeSection="chats" />);
- const guide = await screen.findByTestId("guide");
- act(() => guide.click());
- const tour = await screen.findByTestId("tour");
- act(() => tour.click());
- await waitFor(() => expect(screen.getByTestId("first-steps")).toBeDefined());
-});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
index 49bf2e6999..5bac859c91 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
@@ -1,21 +1,17 @@
import { lazy, Suspense, useEffect, useMemo, useState } from "react";
import { useOnboarding } from "@/hooks/useOnboarding";
-import { freshState, readFirstSteps, writeFirstSteps, type FirstStepsState } from "./firstSteps/firstSteps";
-import { FIRST_STEPS_START_EVENT, SETUP_REPLAY_EVENT, TOUR_START_EVENT } from "./tourEvents";
+import { SETUP_REPLAY_EVENT, TOUR_START_EVENT } from "./tourEvents";
/**
* Code-split: a finished install renders this gate as `null` forever, so the
- * setup and the tour load only on the boot that shows them — the gate's own
+ * setup and the walk load only on the boot that shows them — the gate's own
* show/hide logic is all that rides in the entry chunk.
*/
const SetupTour = lazy(() =>
import("./setup/SetupTour").then((m) => ({ default: m.SetupTour })),
);
-const GuidedTour = lazy(() =>
- import("./tour/GuidedTour").then((m) => ({ default: m.GuidedTour })),
-);
-const FirstStepsGuide = lazy(() =>
- import("./firstSteps/FirstStepsGuide").then((m) => ({ default: m.FirstStepsGuide })),
+const SectionWalk = lazy(() =>
+ import("./setup/SectionWalk").then((m) => ({ default: m.SectionWalk })),
);
/** Where the IDE keeps working without app-wide setup — no guide over it. */
@@ -26,50 +22,33 @@ function param(name: string): string | null {
}
/**
- * First run, in two acts, both on the real app — there is no setup screen.
- *
- * 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`); `jarvis:tour-start`
- * replays it alone.
+ * First run, in two acts, both over the real app.
*
- * Settings' replay (`jarvis:setup-replay`) walks setup again as a preview,
- * from the "how it works" explainer on, then the tour.
+ * 1. The setup window: three steps — the assistant's name (its wake word),
+ * connecting an AI (subscriptions and an API key), and how the user
+ * talks to it. Fails open: while loading or on a fetch error the gate
+ * renders nothing, so a broken guide never traps anyone.
+ * 2. The walk: the user's pet walks the app's sections and explains each in
+ * place. When it ends, onboarding is completed and the app restarts once.
*
- * 3. First steps: when the tour ends for the first time, a small guide in
- * the corner walks ten real things to do with the assistant and explains
- * each one after it happened. It survives the completion restart
- * (localStorage) and never blocks the app; `jarvis:first-steps-start`
- * (Settings) starts it again.
+ * Settings' replay (`jarvis:setup-replay`) walks both again as a preview,
+ * without completing or restarting anything. `jarvis:tour-start` (and an
+ * install that finished setup but never saw the walk) shows the walk alone.
*
* 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; `?firststeps=force`
- * opens the first-steps guide from the start.
+ * finished install without completing or restarting anything; `?tour=force`
+ * opens the walk alone.
*/
export function OnboardingGate({ activeSection }: { activeSection?: string } = {}) {
const onb = useOnboarding();
- // Set once setup completes (the Start action dispatches
- // jarvis:onboarding-changed) or a replay ends.
+ // Set once setup completes (jarvis:onboarding-changed) or a replay ends.
const [dismissed, setDismissed] = useState(false);
const [tourRequested, setTourRequested] = useState(() => param("tour") === "force");
const [tourDone, setTourDone] = useState(false);
// Bumped by each Settings replay; > 0 means a setup preview is requested,
// and the value remounts the guide so every replay starts fresh.
const [setupReplay, setSetupReplay] = useState(0);
- // A real first run ends setup straight into the tour; onboarding is
- // completed — and the app restarted once — only when that tour ends.
- const [completeAfterTour, setCompleteAfterTour] = useState(false);
const forced = useMemo(() => param("onboarding") === "force", []);
- const [firstSteps, setFirstSteps] = useState<FirstStepsState | null>(() =>
- param("firststeps") === "force" ? freshState() : readFirstSteps(),
- );
- // Remounts the guide on a restart from Settings.
- const [firstStepsRun, setFirstStepsRun] = useState(0);
useEffect(() => {
const onChanged = () => {
@@ -86,18 +65,10 @@ export function OnboardingGate({ activeSection }: { activeSection?: string } = {
setTourRequested(false);
setSetupReplay((n) => n + 1);
};
- const onFirstSteps = () => {
- const fresh = freshState();
- writeFirstSteps(fresh);
- setFirstSteps(fresh);
- setFirstStepsRun((n) => n + 1);
- };
- window.addEventListener(FIRST_STEPS_START_EVENT, onFirstSteps);
window.addEventListener("jarvis:onboarding-changed", onChanged);
window.addEventListener(TOUR_START_EVENT, onTour);
window.addEventListener(SETUP_REPLAY_EVENT, onSetupReplay);
return () => {
- window.removeEventListener(FIRST_STEPS_START_EVENT, onFirstSteps);
window.removeEventListener("jarvis:onboarding-changed", onChanged);
window.removeEventListener(TOUR_START_EVENT, onTour);
window.removeEventListener(SETUP_REPLAY_EVENT, onSetupReplay);
@@ -110,37 +81,41 @@ export function OnboardingGate({ activeSection }: { activeSection?: string } = {
const replaying = setupReplay > 0;
const asked = forced || replaying;
+ const isPreview = asked && onb.state.completed;
const showSetup = (asked || !onb.state.completed) && !dismissed && (asked || !inIde);
+
+ // A real first run is recorded as done (the walk included) and gets its
+ // one completion restart; a replay just closes.
+ const completeFirstRun = (reason: string) => {
+ void (async () => {
+ await onb.completeTour();
+ try {
+ await onb.complete();
+ } catch (e) {
+ // The next start resumes setup at its last step, so nothing is lost.
+ console.warn(`onboarding: completing after ${reason} failed`, e);
+ }
+ })();
+ };
+
if (showSetup) {
return (
<Suspense fallback={null}>
<SetupTour
key={setupReplay}
onb={onb}
- preview={asked && onb.state.completed}
- startAt={replaying && onb.state.completed ? "how" : undefined}
+ preview={isPreview}
onSkipAll={() => {
- // A replay just closes; a real first run is recorded as done
- // (tour included) and gets its one completion restart.
setSetupReplay(0);
setDismissed(true);
- if (asked && onb.state?.completed) return;
- void (async () => {
- await onb.completeTour();
- try {
- await onb.complete();
- } catch (e) {
- // The next start offers the setup again, so nothing is lost.
- console.warn("onboarding: skipping setup failed", e);
- }
- })();
+ if (isPreview) return;
+ completeFirstRun("skipping setup");
}}
onFinished={() => {
- if (!(asked && onb.state?.completed)) setCompleteAfterTour(true);
setSetupReplay(0);
setDismissed(true);
- setTourDone(false);
- setTourRequested(true);
+ if (isPreview) return;
+ completeFirstRun("the walk");
}}
/>
</Suspense>
@@ -148,49 +123,21 @@ export function OnboardingGate({ activeSection }: { activeSection?: string } = {
}
const tourDue = tourRequested || (onb.state.completed && onb.state.tour_completed === false);
- // An automatic tour waits until the user is out of the IDE; a replay they
+ // An automatic walk waits until the user is out of the IDE; a replay they
// asked for starts wherever they are.
if (tourDue && !tourDone && (tourRequested || !inIde)) {
return (
<Suspense fallback={null}>
- <GuidedTour
+ <SectionWalk
onDone={() => {
setTourDone(true);
setTourRequested(false);
- // The first tour hands over to the first-steps guide. Written
- // before the completion restart, so the guide is there after it.
- // A real first run always starts it fresh (an install that was
- // reset to a new user gets it again); a later tour replay only
- // when the guide was never met.
- if (completeAfterTour || readFirstSteps() === null) {
- const fresh = freshState();
- writeFirstSteps(fresh);
- setFirstSteps(fresh);
- }
- void (async () => {
- await onb.completeTour();
- if (!completeAfterTour) return;
- setCompleteAfterTour(false);
- try {
- await onb.complete();
- } catch (e) {
- // The next start resumes setup at its last step, so nothing is lost.
- console.warn("onboarding: completing after the tour failed", e);
- }
- })();
+ void onb.completeTour();
}}
/>
</Suspense>
);
}
- if (firstSteps?.status === "active") {
- return (
- <Suspense fallback={null}>
- <FirstStepsGuide key={firstStepsRun} initial={firstSteps} onClose={() => setFirstSteps(null)} />
- </Suspense>
- );
- }
-
return null;
}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/ProgressDots.tsx b/jarvis/ui/web/frontend/src/components/onboarding/ProgressDots.tsx
deleted file mode 100644
index 85e198f3f0..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/ProgressDots.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { cn } from "@/lib/utils";
-
-const DOT = 6;
-const SLOT = 16;
-const GAP = 6;
-
-/**
- * Where the guide stands: one dot per beat and a pill that SLIDES to the
- * current one rather than a new dot lighting up. Done dots are ink, the ones
- * ahead are hairline — the pill is the only accent on the card's foot.
- */
-export function ProgressDots({ count, index }: { count: number; index: number }) {
- return (
- <div
- aria-hidden
- className="relative flex items-center"
- style={{ gap: GAP, height: DOT }}
- data-testid="onboarding-dots"
- >
- {Array.from({ length: count }, (_, i) => (
- <span key={i} className="flex justify-center" style={{ width: SLOT }}>
- <span
- className={cn(
- "rounded-full transition-colors duration-300",
- i < index ? "bg-muted-foreground" : "bg-border-strong",
- i === index && "opacity-0",
- )}
- style={{ width: DOT, height: DOT }}
- />
- </span>
- ))}
- <span
- className="absolute left-0 top-1/2 rounded-full bg-accent transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
- style={{
- width: SLOT,
- height: DOT,
- transform: `translate(${index * (SLOT + GAP)}px, -50%)`,
- }}
- />
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/FirstStepsGuide.tsx b/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/FirstStepsGuide.tsx
deleted file mode 100644
index 25bff46da5..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/FirstStepsGuide.tsx
+++ /dev/null
@@ -1,342 +0,0 @@
-import { motion, useReducedMotion } from "framer-motion";
-import { Check, ChevronDown, ChevronUp, X } from "lucide-react";
-import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
-import { FOCUS_RING } from "@/components/agentic/controls";
-import { fill, useLocaleChunk, useT } from "@/i18n";
-import { sendChatMessage } from "@/lib/chat";
-import type { PetState } from "@/lib/petStates";
-import { cn } from "@/lib/utils";
-import { useEventStore } from "@/store/events";
-import { useHomeStore } from "@/store/home";
-import { GuidePetFigure, PetSays } from "../pet/GuidePet";
-import { EASE_OUT, QuietAction } from "../ui";
-import {
- nextOpenQuest,
- questDone,
- QUESTS,
- writeFirstSteps,
- type FirstStepsState,
- type Quest,
- type QuestId,
-} from "./firstSteps";
-
-/** How the pet looks while it waits for each quest. */
-const PET: Record<QuestId, PetState> = {
- wake: "listening",
- ask: "idle",
- tool: "thinking",
- screen: "thinking",
- memory: "thinking",
- artifact: "thinking",
- agent: "thinking",
- team: "success",
- plugin: "thinking",
- ide: "thinking",
-};
-
-/** How often the guide re-checks the live state for the current quest. */
-const CHECK_MS = 700;
-
-/**
- * The "first steps" guide: the user's pet in the corner of the real app,
- * speaking in a bubble — never over the app.
- *
- * It walks ten real things to do with the assistant — wake it, ask, let it
- * use a tool, look at the screen, remember something, make an artifact,
- * hand a job to an agent, meet the agents, connect an app, open the coding
- * workspace. Each quest says one concrete example and waits until the app
- * reports it really happened; then the pet explains what went on behind the
- * scenes and where to see the result. The app stays fully usable the whole
- * time: the pet can be tucked into a pill, a quest skipped, or the guide
- * closed.
- */
-export function FirstStepsGuide({
- initial,
- onClose,
-}: {
- initial: FirstStepsState;
- onClose: () => void;
-}) {
- const t = useT();
- const ready = useLocaleChunk("onboarding");
- const reduced = useReducedMotion() ?? false;
- const [state, setState] = useState<FirstStepsState>(initial);
- const [sent, setSent] = useState(false);
- // When the current quest was armed: only what happens after counts.
- const armedAt = useRef(Date.now());
-
- const quest = QUESTS.find((q) => q.id === state.current) ?? QUESTS[0];
- const index = QUESTS.indexOf(quest);
- const isDone = state.done.includes(quest.id);
- const finished = state.status === "finished";
-
- const update = useCallback((next: FirstStepsState) => {
- setState(next);
- writeFirstSteps(next);
- }, []);
-
- const goTo = useCallback(
- (id: QuestId) => {
- armedAt.current = Date.now();
- setSent(false);
- update({ ...state, current: id, collapsed: false });
- },
- [state, update],
- );
-
- // Watch the live app for the current quest.
- useEffect(() => {
- if (isDone || finished) return;
- const check = () => {
- const s = useEventStore.getState();
- const hit = questDone(quest, {
- events: s.events,
- messages: s.messages,
- voiceState: s.voiceState,
- activeSection: s.activeSection,
- since: armedAt.current,
- });
- if (hit) {
- update({
- ...state,
- done: state.done.includes(quest.id) ? state.done : [...state.done, quest.id],
- skipped: state.skipped.filter((q) => q !== quest.id),
- });
- }
- };
- check();
- const timer = window.setInterval(check, CHECK_MS);
- return () => window.clearInterval(timer);
- }, [quest, isDone, finished, state, update]);
-
- const advance = useCallback(
- (skipping: boolean) => {
- const base = skipping
- ? { ...state, skipped: state.skipped.includes(quest.id) ? state.skipped : [...state.skipped, quest.id] }
- : state;
- const next = nextOpenQuest(base, quest.id);
- if (next) {
- armedAt.current = Date.now();
- setSent(false);
- update({ ...base, current: next });
- } else {
- update({ ...base, status: "finished" });
- }
- },
- [state, quest.id, update],
- );
-
- const tryIt = useCallback(
- async (q: Quest) => {
- const nav = useEventStore.getState();
- if (q.action.kind === "open") {
- if (nav.activeSection !== q.action.section) nav.setActiveSection(q.action.section);
- return;
- }
- // Voice and messages both happen on the front page's chat.
- if (nav.activeSection !== "chats") nav.setActiveSection("chats");
- if (q.action.kind === "voice") {
- if (useHomeStore.getState().surface !== "voice") useHomeStore.getState().setSurface("voice");
- return;
- }
- if (useHomeStore.getState().surface !== "chat") useHomeStore.getState().setSurface("chat");
- // The user pressed "send it" for exactly this example: one message, once.
- const ok = await sendChatMessage(t(`first_steps.quests.${q.id}.prompt`));
- setSent(ok);
- },
- [t],
- );
-
- const show = (section: NonNullable<Quest["showSection"]>) => {
- const nav = useEventStore.getState();
- if (nav.activeSection !== section) nav.setActiveSection(section);
- };
-
- const close = () => {
- update({ ...state, status: finished ? "finished" : "dismissed" });
- onClose();
- };
-
- if (!ready) return null;
-
- const doneCount = state.done.length;
- const progress = fill(t("first_steps.progress"), { done: doneCount, total: QUESTS.length });
-
- if (state.collapsed && !finished) {
- return (
- <div className="fixed bottom-4 right-4 z-[100]" data-testid="first-steps-pill">
- <button
- type="button"
- onClick={() => update({ ...state, collapsed: false })}
- className={cn(
- "flex items-center gap-2 rounded-full border border-border bg-popover py-1 pl-1 pr-3 text-sm text-popover-foreground shadow-float transition-colors hover:bg-secondary",
- FOCUS_RING,
- )}
- >
- <GuidePetFigure state="idle" px={48} />
- <span className="font-medium">{t("first_steps.title")}</span>
- <span className="text-xs text-muted-foreground">{progress}</span>
- <ChevronUp aria-hidden className="h-3.5 w-3.5 text-muted-foreground" />
- </button>
- </div>
- );
- }
-
- const line = finished
- ? fill(t("first_steps.finished.body"), { done: doneCount, total: QUESTS.length })
- : isDone
- ? `${t(`first_steps.quests.${quest.id}.explain`)} ${t(`first_steps.quests.${quest.id}.how`)}`
- : t(`first_steps.quests.${quest.id}.ask`);
-
- const heading = (
- <div className="mb-1.5 flex items-center gap-2">
- <span className="inline-flex items-center gap-1.5 text-sm font-semibold text-foreground" id="first-steps-title">
- {!finished && isDone && <Check aria-hidden className="h-4 w-4 text-success" />}
- {finished ? t("first_steps.finished.title") : t(`first_steps.quests.${quest.id}.title`)}
- </span>
- <span className="ml-auto text-xs text-muted-foreground">{progress}</span>
- {!finished && (
- <IconAction label={t("first_steps.collapse")} onClick={() => update({ ...state, collapsed: true })}>
- <ChevronDown aria-hidden className="h-4 w-4" />
- </IconAction>
- )}
- <IconAction label={t("first_steps.close")} onClick={close} testId="first-steps-close">
- <X aria-hidden className="h-4 w-4" />
- </IconAction>
- </div>
- );
-
- return (
- <motion.section
- initial={reduced ? false : { opacity: 0, y: 16 }}
- animate={{ opacity: 1, y: 0 }}
- transition={{ duration: 0.28, ease: EASE_OUT }}
- className="fixed bottom-4 right-4 z-[100] w-[min(460px,calc(100vw-32px))]"
- aria-labelledby="first-steps-title"
- data-testid="first-steps"
- data-quest={finished ? "finished" : quest.id}
- data-state={finished ? "finished" : isDone ? "done" : "open"}
- >
- <PetSays
- key={`${finished ? "finished" : quest.id}-${isDone}`}
- text={line}
- state={finished || isDone ? "success" : PET[quest.id]}
- heading={heading}
- px={96}
- testId="first-steps-say"
- >
- {!finished && !isDone && quest.action.kind === "send" && (
- <p className="mt-2 rounded-lg bg-secondary/70 px-3 py-2 text-sm text-foreground" data-testid="first-steps-prompt">
- “{t(`first_steps.quests.${quest.id}.prompt`)}”
- </p>
- )}
- {!finished && !isDone && sent && (
- <p className="mt-2 text-xs text-muted-foreground" role="status">
- {t("first_steps.waiting")}
- </p>
- )}
- <div className="mt-3 flex items-center gap-3">
- {finished ? (
- <SmallAction onClick={close} testId="first-steps-finish">
- {t("first_steps.finished.close")}
- </SmallAction>
- ) : isDone ? (
- <SmallAction onClick={() => advance(false)} testId="first-steps-next">
- {nextOpenQuest(state, quest.id) ? t("first_steps.next") : t("first_steps.finish")}
- </SmallAction>
- ) : (
- <SmallAction onClick={() => void tryIt(quest)} disabled={sent} testId="first-steps-try">
- {t(`first_steps.try.${quest.action.kind}`)}
- </SmallAction>
- )}
- {!finished && isDone && quest.showSection && (
- <QuietAction onClick={() => show(quest.showSection!)} className="text-xs" testId="first-steps-show">
- {t(`first_steps.show.${quest.id}`)}
- </QuietAction>
- )}
- {!finished && !isDone && (
- <QuietAction onClick={() => advance(true)} className="ml-auto text-xs" testId="first-steps-skip">
- {t("first_steps.skip")}
- </QuietAction>
- )}
- </div>
- {/* One mark per quest: filled when done. Click to jump. */}
- <div className="mt-3 flex gap-1" role="tablist" aria-label={t("first_steps.title")}>
- {QUESTS.map((q, i) => (
- <button
- key={q.id}
- type="button"
- role="tab"
- aria-selected={!finished && i === index}
- aria-label={t(`first_steps.quests.${q.id}.title`)}
- title={t(`first_steps.quests.${q.id}.title`)}
- onClick={() => goTo(q.id)}
- className={cn(
- "h-1 flex-1 rounded-full transition-colors",
- state.done.includes(q.id)
- ? "bg-accent"
- : state.skipped.includes(q.id)
- ? "bg-foreground/25"
- : "bg-border-strong",
- !finished && i === index && "outline outline-2 outline-offset-1 outline-accent/50",
- FOCUS_RING,
- )}
- />
- ))}
- </div>
- </PetSays>
- </motion.section>
- );
-}
-
-function SmallAction({
- children,
- onClick,
- disabled,
- testId,
-}: {
- children: ReactNode;
- onClick: () => void;
- disabled?: boolean;
- testId?: string;
-}) {
- return (
- <button
- type="button"
- onClick={onClick}
- disabled={disabled}
- data-testid={testId}
- className={cn(
- "h-8 rounded-lg bg-accent px-3.5 text-sm font-medium text-accent-foreground transition-opacity hover:opacity-90 disabled:opacity-50",
- FOCUS_RING,
- )}
- >
- {children}
- </button>
- );
-}
-
-function IconAction({
- children,
- label,
- onClick,
- testId,
-}: {
- children: ReactNode;
- label: string;
- onClick: () => void;
- testId?: string;
-}) {
- return (
- <button
- type="button"
- onClick={onClick}
- aria-label={label}
- title={label}
- data-testid={testId}
- className={cn("rounded-md p-0.5 text-muted-foreground hover:bg-secondary hover:text-foreground", FOCUS_RING)}
- >
- {children}
- </button>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/firstSteps.test.ts b/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/firstSteps.test.ts
deleted file mode 100644
index cd8ad07aed..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/firstSteps.test.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { afterEach, describe, expect, it } from "vitest";
-import type { EventItem } from "@/store/events";
-import { freshState, nextOpenQuest, questDone, QUESTS, readFirstSteps, writeFirstSteps, type DetectInput, type QuestId } from "./firstSteps";
-
-const quest = (id: QuestId) => QUESTS.find((q) => q.id === id)!;
-
-function input(over: Partial<DetectInput> = {}): DetectInput {
- return { events: [], messages: [], voiceState: "idle", activeSection: "chats", since: 1_000, ...over };
-}
-
-const ev = (name: string, ts: number, payload?: unknown): EventItem => ({ id: `${name}-${ts}`, name, ts, payload });
-
-afterEach(() => window.localStorage.clear());
-
-describe("first steps", () => {
- it("has ten quests, each with a way to try it", () => {
- expect(QUESTS).toHaveLength(10);
- expect(new Set(QUESTS.map((q) => q.id)).size).toBe(10);
- });
-
- it("counts only what happened after the quest was armed", () => {
- const old = input({ events: [ev("ToolCallStarted", 500)] });
- expect(questDone(quest("tool"), old)).toBe(false);
- const fresh = input({ events: [ev("ToolCallStarted", 1_500)] });
- expect(questDone(quest("tool"), fresh)).toBe(true);
- });
-
- it("needs the right tool, not just any tool", () => {
- const other = input({ events: [ev("ToolCallStarted", 2_000, { tool: "navigate" })] });
- expect(questDone(quest("screen"), other)).toBe(false);
- const screen = input({ events: [ev("ToolCallStarted", 2_000, { tool: "screen-snapshot" })] });
- expect(questDone(quest("screen"), screen)).toBe(true);
- expect(questDone(quest("memory"), input({ events: [ev("WikiPageChanged", 2_000)] }))).toBe(true);
- expect(questDone(quest("agent"), input({ events: [ev("JarvisAgentTaskStarted", 2_000)] }))).toBe(true);
- expect(questDone(quest("artifact"), input({ events: [ev("ToolCallStarted", 2_000, { tool: "create-artifact" })] }))).toBe(true);
- });
-
- it("sees a reply, a woken voice loop and a visited section", () => {
- const reply = input({ messages: [{ id: "m", role: "assistant", content: "hi", ts: 2_000 }] });
- expect(questDone(quest("ask"), reply)).toBe(true);
- expect(questDone(quest("wake"), input({ voiceState: "listening" }))).toBe(true);
- expect(questDone(quest("wake"), input({ voiceState: "idle" }))).toBe(false);
- expect(questDone(quest("ide"), input({ activeSection: "agentic-ide" }))).toBe(true);
- expect(questDone(quest("plugin"), input({ activeSection: "chats" }))).toBe(false);
- });
-
- it("moves on to the next quest that is neither done nor skipped", () => {
- expect(nextOpenQuest({ done: [], skipped: [] }, "wake")).toBe("ask");
- expect(nextOpenQuest({ done: ["ask"], skipped: ["tool"] }, "wake")).toBe("screen");
- expect(nextOpenQuest({ done: [], skipped: [] }, "ide")).toBeNull();
- });
-
- it("keeps its progress across a reload and ignores a broken record", () => {
- expect(readFirstSteps()).toBeNull();
- writeFirstSteps({ ...freshState(), done: ["wake"], current: "ask" });
- expect(readFirstSteps()).toMatchObject({ status: "active", done: ["wake"], current: "ask" });
- window.localStorage.setItem("jarvis.firstSteps.v1", "{not json");
- expect(readFirstSteps()).toBeNull();
- });
-});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/firstSteps.ts b/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/firstSteps.ts
deleted file mode 100644
index ad24bc419e..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/firstSteps/firstSteps.ts
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * "First steps": ten small, real things a new user does with the assistant
- * right after setup, as data.
- *
- * The explainer in setup says what the assistant is; this guide lets the
- * user feel it. Each quest gives one concrete thing to say or open, waits
- * until the app reports that it really happened (a live event, a reply, a
- * visited section), and then explains what just went on behind the scenes.
- *
- * The guide never starts work on its own. "Try it" either navigates, or —
- * for a quest that IS a message — sends the shown example once, because the
- * user pressed the button for exactly that.
- */
-import type { ChatMessage, EventItem, SectionId, VoiceState } from "@/store/events";
-
-export type QuestId =
- | "wake"
- | "ask"
- | "tool"
- | "screen"
- | "memory"
- | "artifact"
- | "agent"
- | "team"
- | "plugin"
- | "ide";
-
-/** What "Try it" does: send the example, open voice mode, or open a section. */
-export type QuestAction = { kind: "send" } | { kind: "voice" } | { kind: "open"; section: SectionId };
-
-export interface EventRule {
- names: readonly string[];
- includes?: readonly string[];
-}
-
-export interface QuestDetect {
- /**
- * Backend events (WS `event_name`) that prove the quest happened. A rule
- * with `includes` also needs one of those words (case-insensitive) in the
- * event's payload — "a tool ran" is not yet "the screen tool ran".
- */
- events?: readonly EventRule[];
- /** An assistant reply after the quest started counts. */
- assistantReply?: boolean;
- /** The voice loop leaving idle counts (the wake word or the voice button). */
- voiceActive?: boolean;
- /** Being on this section counts. */
- section?: SectionId;
-}
-
-export interface Quest {
- id: QuestId;
- action: QuestAction;
- detect: QuestDetect;
- /** Where the result can be seen, offered after the quest is done. */
- showSection?: SectionId;
-}
-
-export const QUESTS: readonly Quest[] = [
- { id: "wake", action: { kind: "voice" }, detect: { voiceActive: true, events: [{ names: ["WakeWordDetected", "VoiceTurnStarted"] }] } },
- { id: "ask", action: { kind: "send" }, detect: { assistantReply: true, events: [{ names: ["BrainTurnCompleted", "VoiceTurnCompleted"] }] } },
- { id: "tool", action: { kind: "send" }, detect: { events: [{ names: ["ToolCallStarted", "ActionExecuted", "CliInvoked"] }] } },
- {
- id: "screen",
- action: { kind: "send" },
- detect: {
- events: [
- { names: ["ScreenCaptureCompleted", "ObservationCaptured", "AppshotTaken"] },
- { names: ["ToolCallStarted"], includes: ["screen", "appshot", "snapshot"] },
- ],
- },
- },
- {
- id: "memory",
- action: { kind: "send" },
- detect: {
- events: [
- { names: ["WikiPageChanged"] },
- { names: ["ToolCallStarted"], includes: ["wiki", "profile", "memory", "remember"] },
- ],
- },
- showSection: "memory",
- },
- {
- id: "artifact",
- action: { kind: "send" },
- detect: { events: [{ names: ["ToolCallStarted", "JarvisAgentTaskStarted"], includes: ["artifact"] }] },
- showSection: "visualization",
- },
- {
- id: "agent",
- action: { kind: "send" },
- detect: {
- events: [
- { names: ["JarvisAgentTaskStarted"] },
- { names: ["ToolCallStarted"], includes: ["spawn-worker", "delegate"] },
- ],
- },
- showSection: "agents",
- },
- { id: "team", action: { kind: "open", section: "agents" }, detect: { section: "agents" } },
- { id: "plugin", action: { kind: "open", section: "plugins" }, detect: { section: "plugins" } },
- { id: "ide", action: { kind: "open", section: "agentic-ide" }, detect: { section: "agentic-ide" } },
-];
-
-export interface DetectInput {
- /** Newest first, as the event store keeps them. */
- events: readonly EventItem[];
- messages: readonly ChatMessage[];
- voiceState: VoiceState;
- activeSection: SectionId;
- /** Wall-clock ms the quest was armed; nothing older counts. */
- since: number;
-}
-
-function payloadText(payload: unknown): string {
- if (payload === undefined || payload === null) return "";
- try {
- return JSON.stringify(payload).toLowerCase();
- } catch {
- // A payload that cannot be serialised simply never matches a keyword.
- return "";
- }
-}
-
-/** True when the app shows the quest really happened after `since`. */
-export function questDone(quest: Quest, input: DetectInput): boolean {
- const d = quest.detect;
- if (d.section && input.activeSection === d.section) return true;
- if (d.voiceActive && input.voiceState !== "idle" && input.voiceState !== "connecting") return true;
- if (d.assistantReply && input.messages.some((m) => m.role === "assistant" && m.ts >= input.since)) return true;
- if (d.events) {
- for (const e of input.events) {
- if (e.ts < input.since) break; // newest first: everything after is older
- for (const rule of d.events) {
- if (!rule.names.includes(e.name)) continue;
- if (!rule.includes) return true;
- const text = payloadText(e.payload);
- if (rule.includes.some((w) => text.includes(w.toLowerCase()))) return true;
- }
- }
- }
- return false;
-}
-
-/* ---------------------------------------------------------------- storage */
-
-export type FirstStepsStatus = "active" | "dismissed" | "finished";
-
-export interface FirstStepsState {
- status: FirstStepsStatus;
- /** Quests the app saw happen. */
- done: QuestId[];
- /** Quests the user skipped. */
- skipped: QuestId[];
- current: QuestId;
- collapsed: boolean;
-}
-
-const STORAGE_KEY = "jarvis.firstSteps.v1";
-
-export function freshState(): FirstStepsState {
- return { status: "active", done: [], skipped: [], current: QUESTS[0].id, collapsed: false };
-}
-
-function isQuestId(value: unknown): value is QuestId {
- return QUESTS.some((q) => q.id === value);
-}
-
-export function readFirstSteps(): FirstStepsState | null {
- try {
- const raw = window.localStorage.getItem(STORAGE_KEY);
- if (!raw) return null;
- const data = JSON.parse(raw) as Partial<FirstStepsState>;
- if (data.status !== "active" && data.status !== "dismissed" && data.status !== "finished") return null;
- return {
- status: data.status,
- done: Array.isArray(data.done) ? data.done.filter(isQuestId) : [],
- skipped: Array.isArray(data.skipped) ? data.skipped.filter(isQuestId) : [],
- current: isQuestId(data.current) ? data.current : QUESTS[0].id,
- collapsed: data.collapsed === true,
- };
- } catch {
- // Blocked or corrupted storage: the guide simply does not resume.
- return null;
- }
-}
-
-export function writeFirstSteps(state: FirstStepsState): void {
- try {
- window.localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
- } catch {
- // Storage may be blocked; the guide then lives for this window only.
- }
-}
-
-/** The quest after `id` that is neither done nor skipped, or null at the end. */
-export function nextOpenQuest(state: Pick<FirstStepsState, "done" | "skipped">, id: QuestId): QuestId | null {
- const start = QUESTS.findIndex((q) => q.id === id);
- for (let i = start + 1; i < QUESTS.length; i++) {
- const q = QUESTS[i].id;
- if (!state.done.includes(q) && !state.skipped.includes(q)) return q;
- }
- return null;
-}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/ConnectStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/ConnectStep.tsx
new file mode 100644
index 0000000000..bbee73bfeb
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/ConnectStep.tsx
@@ -0,0 +1,502 @@
+/**
+ * Setup window, step 2: connect an AI.
+ *
+ * Subscriptions the user already pays for come first, one row each, signed
+ * in with one click — the official CLI opens the browser, and the row polls
+ * until the login lands. An API key sits below as its own row: one key is
+ * all the assistant needs to think and talk, and a key saved here is switched
+ * on right away (a starter plan it completes, or the Brain when none is
+ * active yet).
+ */
+import { Check, ChevronRight, Copy, KeyRound, Loader2, Lock } from "lucide-react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { ApiKeyForm } from "@/components/ApiKeyForm";
+import { ProviderLogo } from "@/components/providers/ProviderLogo";
+import { Button } from "@/components/ui/button";
+import { switchBrainProvider, useProviders, type ProviderDescriptor } from "@/hooks/useProviders";
+import { applyStarterPlan, getStarterPlans, selectStarterPlan, type StarterPlan } from "@/hooks/useStarterPlans";
+import { fill, useT } from "@/i18n";
+import { cn } from "@/lib/utils";
+import { planKeysComplete, primarySlot, slotConfigured, slotEffective, startableProviders } from "../brainPlans";
+
+/** How a subscription row reads its CLI login, and when it counts as signed in. */
+export interface SubscriptionSpec {
+ id: string;
+ /** A provider id ProviderLogo knows, for the brand mark. */
+ logoId: string;
+ label: string;
+ /** The plans that sign in here — product names, the same in every language. */
+ plans: string;
+ statusUrl: string;
+ loginUrl: string;
+ isReady: (status: CliStatus) => boolean;
+}
+
+export interface CliStatus {
+ installed?: boolean;
+ connected?: boolean;
+ mode?: string;
+ user_email?: string | null;
+}
+
+export const SUBSCRIPTIONS: readonly SubscriptionSpec[] = [
+ {
+ id: "claude",
+ logoId: "claude-cli",
+ label: "Claude",
+ plans: "Claude Pro · Max",
+ statusUrl: "/api/claude/status",
+ loginUrl: "/api/claude/login",
+ isReady: (s) => Boolean(s.connected && s.mode === "subscription"),
+ },
+ {
+ id: "codex",
+ logoId: "openai-codex",
+ label: "ChatGPT",
+ plans: "ChatGPT Plus · Pro (Codex)",
+ statusUrl: "/api/codex/status",
+ loginUrl: "/api/codex/login",
+ isReady: (s) => Boolean(s.connected),
+ },
+ {
+ id: "antigravity",
+ logoId: "antigravity",
+ label: "Google",
+ plans: "Google AI Pro · Ultra (Antigravity)",
+ statusUrl: "/api/antigravity/status",
+ loginUrl: "/api/antigravity/login",
+ isReady: (s) => Boolean(s.connected && s.mode !== "api_key"),
+ },
+ {
+ id: "grok",
+ logoId: "grok-build",
+ label: "Grok",
+ plans: "SuperGrok · X Premium+",
+ statusUrl: "/api/grok-build/status",
+ loginUrl: "/api/grok-build/login",
+ isReady: (s) => Boolean(s.connected && s.mode === "subscription"),
+ },
+];
+
+/** How often a row re-reads its login while the browser sign-in runs. */
+const LOGIN_POLL_MS = 2500;
+/** Give up waiting after this long; the row offers Connect again. */
+const LOGIN_POLL_MAX_MS = 180_000;
+
+async function readStatus(url: string): Promise<CliStatus | null> {
+ try {
+ const res = await fetch(url);
+ if (!res.ok) return null;
+ return (await res.json()) as CliStatus;
+ } catch {
+ // A warming backend reads as "not known yet"; the row shows Connect.
+ return null;
+ }
+}
+
+type RowPhase = "checking" | "ready" | "idle" | "starting" | "waiting";
+
+/** Names of the subscriptions signed in right now — read by the setup's other steps. */
+export type ConnectedChange = (id: string, ready: boolean) => void;
+
+function SubscriptionRow({ spec, onReady }: { spec: SubscriptionSpec; onReady: ConnectedChange }) {
+ const t = useT();
+ const [phase, setPhase] = useState<RowPhase>("checking");
+ const [status, setStatus] = useState<CliStatus | null>(null);
+ const [error, setError] = useState<string | null>(null);
+ const [installCommand, setInstallCommand] = useState<string | null>(null);
+ const alive = useRef(true);
+
+ const apply = useCallback(
+ (next: CliStatus | null) => {
+ if (!alive.current) return false;
+ setStatus(next);
+ const ready = Boolean(next && spec.isReady(next));
+ onReady(spec.id, ready);
+ return ready;
+ },
+ [spec, onReady],
+ );
+
+ useEffect(() => {
+ alive.current = true;
+ void readStatus(spec.statusUrl).then((s) => {
+ const ready = apply(s);
+ if (alive.current) setPhase(ready ? "ready" : "idle");
+ });
+ return () => {
+ alive.current = false;
+ };
+ }, [spec.statusUrl, apply]);
+
+ async function connect() {
+ setError(null);
+ setPhase("starting");
+ try {
+ const res = await fetch(spec.loginUrl, { method: "POST" });
+ const body = (await res.json().catch(() => ({}))) as { detail?: unknown };
+ if (!res.ok) {
+ const detail = body.detail;
+ if (detail && typeof detail === "object" && "install_command" in detail) {
+ setInstallCommand(String((detail as { install_command: unknown }).install_command));
+ } else {
+ setError(typeof detail === "string" ? detail : `HTTP ${res.status}`);
+ }
+ if (alive.current) setPhase("idle");
+ return;
+ }
+ } catch (e) {
+ setError((e as Error).message);
+ if (alive.current) setPhase("idle");
+ return;
+ }
+ setInstallCommand(null);
+ setPhase("waiting");
+ // The sign-in finishes in the browser the CLI opened; poll until it lands.
+ const deadline = Date.now() + LOGIN_POLL_MAX_MS;
+ while (alive.current && Date.now() < deadline) {
+ await new Promise((r) => setTimeout(r, LOGIN_POLL_MS));
+ if (apply(await readStatus(spec.statusUrl))) {
+ setPhase("ready");
+ return;
+ }
+ }
+ if (alive.current) setPhase("idle");
+ }
+
+ async function checkAgain() {
+ setPhase("checking");
+ const fresh = await readStatus(spec.statusUrl);
+ const ready = apply(fresh);
+ if (!alive.current) return;
+ if (ready || fresh?.installed) setInstallCommand(null);
+ setPhase(ready ? "ready" : "idle");
+ }
+
+ const ready = phase === "ready";
+ const detail = ready
+ ? status?.user_email
+ ? fill(t("first_run.connect.signed_in_as"), { account: status.user_email })
+ : t("first_run.connect.signed_in")
+ : phase === "waiting"
+ ? t("first_run.connect.finish_in_browser")
+ : status && status.installed === false
+ ? t("first_run.connect.not_installed")
+ : spec.plans;
+
+ return (
+ <div className="rounded-lg border border-border bg-popover px-4 py-3" data-testid={`setup-sub-${spec.id}`} data-state={phase}>
+ <div className="flex items-center gap-3">
+ <ProviderLogo providerId={spec.logoId} label={spec.label} />
+ <div className="min-w-0 flex-1">
+ <p className="text-sm font-medium text-foreground">{spec.label}</p>
+ <p className="mt-0.5 truncate text-xs text-muted-foreground">{detail}</p>
+ </div>
+ <div className="shrink-0">
+ {ready ? (
+ <span className="inline-flex items-center gap-1.5 text-xs font-medium text-success">
+ <Check aria-hidden className="h-3.5 w-3.5" />
+ {t("first_run.connect.ready")}
+ </span>
+ ) : phase === "checking" ? (
+ <span className="text-xs text-muted-foreground">{t("first_run.connect.checking")}</span>
+ ) : phase === "waiting" ? (
+ <span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
+ <Loader2 aria-hidden className="h-3.5 w-3.5 animate-spin" />
+ {t("first_run.connect.waiting")}
+ </span>
+ ) : (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => void connect()}
+ disabled={phase === "starting"}
+ data-testid={`setup-sub-${spec.id}-connect`}
+ >
+ {phase === "starting" && <Loader2 aria-hidden className="animate-spin" />}
+ {t("first_run.connect.connect")}
+ </Button>
+ )}
+ </div>
+ </div>
+ {installCommand && !ready && (
+ <div className="ml-12 mt-3 space-y-2" data-testid={`setup-sub-${spec.id}-install`}>
+ <p className="text-xs text-muted-foreground">{t("first_run.connect.install_first")}</p>
+ <CommandBlock command={installCommand} />
+ <Button size="sm" variant="ghost" onClick={() => void checkAgain()}>
+ {t("first_run.connect.check_again")}
+ </Button>
+ </div>
+ )}
+ {error && !ready && <p className="ml-12 mt-2 text-xs text-destructive">{error}</p>}
+ </div>
+ );
+}
+
+function CommandBlock({ command }: { command: string }) {
+ const t = useT();
+ const [copied, setCopied] = useState(false);
+ async function copy() {
+ try {
+ await navigator.clipboard.writeText(command);
+ setCopied(true);
+ window.setTimeout(() => setCopied(false), 1500);
+ } catch {
+ // No clipboard access: the command stays selectable on screen.
+ }
+ }
+ return (
+ <div className="flex items-center justify-between gap-3 rounded-lg border border-border bg-secondary px-3 py-2 font-mono text-xs">
+ <span className="min-w-0 select-all truncate">
+ <span className="mr-2 text-muted-foreground">$</span>
+ {command}
+ </span>
+ <button
+ type="button"
+ onClick={() => void copy()}
+ aria-label={t("first_run.connect.copy")}
+ className="shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-surface-raised hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {copied ? <Check aria-hidden className="h-3.5 w-3.5" /> : <Copy aria-hidden className="h-3.5 w-3.5" />}
+ </button>
+ </div>
+ );
+}
+
+export interface KeyActivation {
+ /** A key (or a local brain) is there to think with. */
+ hasKey: boolean;
+ connecting: boolean;
+ /** The plan or provider a key saved during setup switched on. */
+ connected: string | null;
+ partial: string | null;
+ /** A saved key runs live voice (a realtime starter plan is complete). */
+ liveVoice: boolean;
+}
+
+/**
+ * A key saved during setup 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.
+ */
+export function useKeyActivation(providers: ProviderDescriptor[]): KeyActivation {
+ 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 startableNow = startableProviders(providers);
+ const liveVoice = plans.some((p) => p.mode === "realtime" && planKeysComplete(p, startableNow));
+ 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);
+ }
+ } 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 { hasKey, connecting, connected, partial, liveVoice };
+}
+
+function ApiKeyRow({ activation }: { activation: KeyActivation }) {
+ const t = useT();
+ const { providers, refetch } = useProviders();
+ const startable = useMemo(() => startableProviders(providers), [providers]);
+ const [open, setOpen] = useState(false);
+ const [picked, setPicked] = useState<string | null>(null);
+ const current = startable.find((p) => p.id === picked) ?? startable.find(slotEffective) ?? startable[0];
+ const keyed = startable.find(slotEffective);
+ const slot = current ? primarySlot(current) : null;
+ const { hasKey, connecting, connected, partial, liveVoice } = activation;
+
+ const summary = connecting
+ ? t("first_run.connect.key_connecting")
+ : connected
+ ? fill(t("first_run.connect.key_connected"), { provider: connected })
+ : keyed
+ ? fill(t("first_run.connect.key_present"), { provider: keyed.label })
+ : t("first_run.connect.key_hint");
+
+ return (
+ <div className="rounded-lg border border-border bg-popover" data-testid="setup-key-row">
+ <button
+ type="button"
+ onClick={() => setOpen((o) => !o)}
+ aria-expanded={open}
+ data-testid="setup-key-toggle"
+ className="flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <span className="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-secondary">
+ <KeyRound aria-hidden className="h-4 w-4 text-muted-foreground" />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="block text-sm font-medium text-foreground">{t("first_run.connect.key_title")}</span>
+ <span className="mt-0.5 block truncate text-xs text-muted-foreground" data-testid="setup-key-summary">
+ {summary}
+ </span>
+ </span>
+ {hasKey && !connecting ? (
+ <span className="inline-flex shrink-0 items-center gap-1.5 text-xs font-medium text-success">
+ <Check aria-hidden className="h-3.5 w-3.5" />
+ {t("first_run.connect.ready")}
+ </span>
+ ) : connecting ? (
+ <Loader2 aria-hidden className="h-4 w-4 shrink-0 animate-spin text-muted-foreground" />
+ ) : null}
+ <ChevronRight
+ aria-hidden
+ className={cn("h-4 w-4 shrink-0 text-muted-foreground transition-transform", open && "rotate-90")}
+ />
+ </button>
+ {open && (
+ <div className="space-y-3 px-4 pb-4" data-testid="setup-key-panel">
+ {startable.length > 0 ? (
+ <div className="flex flex-wrap gap-1.5" role="radiogroup" aria-label={t("first_run.connect.key_provider")}>
+ {startable.map((p) => {
+ const on = p.id === current?.id;
+ return (
+ <button
+ key={p.id}
+ type="button"
+ role="radio"
+ aria-checked={on}
+ onClick={() => setPicked(p.id)}
+ data-testid={`setup-key-provider-${p.id}`}
+ className={cn(
+ "inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ on
+ ? "border-accent bg-accent-soft font-medium text-foreground"
+ : "border-border text-muted-foreground hover:bg-secondary hover:text-foreground",
+ )}
+ >
+ <ProviderLogo providerId={p.id} label={p.label} size="sm" />
+ {p.label}
+ {slotEffective(p) && <Check aria-hidden className="h-3 w-3 text-success" />}
+ </button>
+ );
+ })}
+ </div>
+ ) : (
+ <p className="text-xs text-muted-foreground">{t("first_run.connect.key_none")}</p>
+ )}
+ {current && slot && (
+ <ApiKeyForm
+ key={current.id}
+ secretKey={slot}
+ dashboardUrl={current.dashboard_url}
+ configured={slotConfigured(current)}
+ effectiveConfigured={slotEffective(current)}
+ credentialHelp={current.credential_help}
+ onChanged={() => void refetch()}
+ />
+ )}
+ {partial && (
+ <p className="text-xs text-warning">{fill(t("first_run.connect.key_partial"), { parts: partial })}</p>
+ )}
+ {hasKey && !connecting && (
+ <p className="text-xs text-muted-foreground" data-testid="setup-key-live">
+ {liveVoice ? t("first_run.connect.live_ready") : t("first_run.connect.live_missing")}
+ </p>
+ )}
+ <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.connect.key_security")}
+ </p>
+ </div>
+ )}
+ </div>
+ );
+}
+
+/**
+ * The step's body. `onConnectedChange` reports whether anything is connected
+ * (a subscription or a key), so the window can say what Continue leaves out.
+ */
+export function ConnectStep({ onConnectedChange }: { onConnectedChange: (any: boolean) => void }) {
+ const t = useT();
+ const { providers } = useProviders();
+ const activation = useKeyActivation(providers);
+ const [ready, setReady] = useState<Record<string, boolean>>({});
+ const onReady = useCallback<ConnectedChange>((id, ok) => {
+ setReady((prev) => (prev[id] === ok ? prev : { ...prev, [id]: ok }));
+ }, []);
+ const anySubscription = Object.values(ready).some(Boolean);
+ const anything = anySubscription || activation.hasKey;
+
+ useEffect(() => {
+ onConnectedChange(anything);
+ }, [anything, onConnectedChange]);
+
+ return (
+ <div className="space-y-5">
+ <section className="space-y-1.5" aria-labelledby="setup-subs-label">
+ <h2 id="setup-subs-label" className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
+ {t("first_run.connect.subscriptions")}
+ </h2>
+ {SUBSCRIPTIONS.map((spec) => (
+ <SubscriptionRow key={spec.id} spec={spec} onReady={onReady} />
+ ))}
+ <p className="pt-1 text-xs leading-relaxed text-muted-foreground">{t("first_run.connect.subscriptions_why")}</p>
+ </section>
+ <section className="space-y-1.5" aria-labelledby="setup-key-label">
+ <h2 id="setup-key-label" className="mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
+ {t("first_run.connect.or_key")}
+ </h2>
+ <ApiKeyRow activation={activation} />
+ </section>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/HowWalk.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/HowWalk.tsx
deleted file mode 100644
index 68637921f2..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/setup/HowWalk.tsx
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * "How it works": the first-run explanation of what the assistant is, told
- * by the user's pet while it walks the REAL app.
- *
- * New users went through setup without understanding the product. Before
- * anything is set up, the window dims and the pet moves from place to place
- * in the actual interface — the composer, the sidebar entries for tools,
- * agents, the coding workspace and Artifacts — and says in a speech bubble
- * how each part connects to the one assistant the user talks to. Lines with
- * no single place (memory, safety, the summary) are said from the middle.
- *
- * Purely explanatory: it only navigates, never presses or writes anything.
- */
-import { ArrowLeft } from "lucide-react";
-import { useCallback, useEffect, useState } from "react";
-import { FOCUS_RING } from "@/components/agentic/controls";
-import { fill, useT } from "@/i18n";
-import type { PetState } from "@/lib/petStates";
-import { cn } from "@/lib/utils";
-import type { SectionId } from "@/store/events";
-import { useEventStore } from "@/store/events";
-import { useHomeStore } from "@/store/home";
-import { PetSays, useGuidePet } from "../pet/GuidePet";
-import { Spotlight } from "../tour/Spotlight";
-import type { TourPlacement } from "../tour/tourSteps";
-import { QuietAction } from "../ui";
-import { useAnchorRect } from "./useAnchorRect";
-
-export interface HowBeat {
- /** Also the i18n key: `first_run.how.beats.<id>`. */
- id: string;
- /** The real element the pet stands next to; omitted = said from the middle. */
- anchor?: string;
- /** Where the app goes first, so the anchor is on screen. */
- section?: SectionId;
- placement: TourPlacement;
- /** How the pet looks once the line is said. */
- pet: PetState;
-}
-
-export const HOW_BEATS: readonly HowBeat[] = [
- { id: "hello", placement: "inside", pet: "success" },
- { id: "talk", anchor: "chat-composer", section: "chats", placement: "above", pet: "listening" },
- { id: "brain", anchor: "settings", placement: "right", pet: "thinking" },
- { id: "tools", anchor: "nav-plugins", placement: "right", pet: "thinking" },
- { id: "agents", anchor: "nav-agents", placement: "right", pet: "thinking" },
- { id: "ide", anchor: "nav-agentic-ide", placement: "right", pet: "thinking" },
- { id: "results", anchor: "nav-visualization", placement: "right", pet: "success" },
- { id: "memory", placement: "inside", pet: "thinking" },
- { id: "safety", placement: "inside", pet: "idle" },
- { id: "done", placement: "inside", pet: "success" },
-];
-
-const BUBBLE_W = 500;
-const BEAT_KEY = "jarvis.setup.howBeat";
-
-/** The beat to resume on: a remount (a reload, a late locale load) keeps the place. */
-function readBeat(): number {
- try {
- const n = Number(window.sessionStorage.getItem(BEAT_KEY));
- return Number.isInteger(n) && n > 0 && n < HOW_BEATS.length ? n : 0;
- } catch {
- return 0;
- }
-}
-
-function saveBeat(n: number | null): void {
- try {
- if (n === null) window.sessionStorage.removeItem(BEAT_KEY);
- else window.sessionStorage.setItem(BEAT_KEY, String(n));
- } catch {
- // Storage may be blocked; the walk then starts over after a reload.
- }
-}
-
-export function HowWalk({ onDone }: { onDone: () => void }) {
- const t = useT();
- const pet = useGuidePet();
- const [index, setIndexRaw] = useState(readBeat);
- const setIndex = useCallback((update: (i: number) => number) => {
- setIndexRaw((i) => {
- const n = update(i);
- saveBeat(n);
- return n;
- });
- }, []);
- const beat = HOW_BEATS[index];
- const last = index === HOW_BEATS.length - 1;
-
- // Bring the beat's place on screen first: the composer lives on the chat.
- useEffect(() => {
- if (!beat.section) return;
- const nav = useEventStore.getState();
- if (nav.activeSection !== beat.section) nav.setActiveSection(beat.section);
- if (beat.anchor === "chat-composer" && useHomeStore.getState().surface !== "chat") {
- useHomeStore.getState().setSurface("chat");
- }
- }, [beat]);
-
- const rect = useAnchorRect(beat.anchor, false, beat.id);
-
- const done = useCallback(() => {
- saveBeat(null);
- onDone();
- }, [onDone]);
-
- const next = useCallback(() => {
- if (last) done();
- else setIndex((i) => Math.min(HOW_BEATS.length - 1, i + 1));
- }, [last, done, setIndex]);
-
- // Arrow keys move through the walk.
- useEffect(() => {
- const onKey = (event: KeyboardEvent) => {
- if (event.key === "ArrowRight") next();
- else if (event.key === "ArrowLeft") setIndex((i) => Math.max(0, i - 1));
- };
- window.addEventListener("keydown", onKey);
- return () => window.removeEventListener("keydown", onKey);
- }, [next, setIndex]);
-
- const text = fill(t(`first_run.how.beats.${beat.id}`), { pet: pet?.name ?? "Gigi" });
-
- return (
- <Spotlight rect={rect} placement={beat.placement} blocking cardWidth={BUBBLE_W}>
- <div
- role="dialog"
- aria-modal="true"
- aria-label={t("first_run.how.title")}
- data-testid="setup-card"
- data-step="how"
- data-beat={beat.id}
- >
- <PetSays key={beat.id} text={text} state={beat.pet} testId="how-say">
- <div className="mt-3 flex items-center gap-3">
- <button
- type="button"
- onClick={next}
- data-testid="how-next"
- className={cn(
- "h-8 rounded-lg bg-accent px-3.5 text-sm font-medium text-accent-foreground transition-opacity hover:opacity-90",
- FOCUS_RING,
- )}
- >
- {last ? t("first_run.how.finish") : t("first_run.how.next")}
- </button>
- {index > 0 && (
- <QuietAction
- onClick={() => setIndex((i) => i - 1)}
- className="inline-flex items-center gap-1 text-xs"
- testId="how-prev"
- >
- <ArrowLeft aria-hidden className="h-3 w-3" />
- {t("first_run.how.prev")}
- </QuietAction>
- )}
- {/* Progress inside this one setup step: dots, no second number
- next to the setup's own "2 of 6". */}
- <span
- className="ml-auto flex items-center gap-1"
- role="img"
- aria-label={fill(t("first_run.how.beat_of"), { current: index + 1, total: HOW_BEATS.length })}
- data-testid="how-progress"
- >
- {HOW_BEATS.map((b, i) => (
- <span
- key={b.id}
- className={cn(
- "h-1.5 rounded-full transition-all duration-200",
- i === index ? "w-4 bg-accent" : i < index ? "w-1.5 bg-foreground/50" : "w-1.5 bg-border-strong",
- )}
- />
- ))}
- </span>
- {!last && (
- <QuietAction onClick={done} className="text-xs" testId="how-skip">
- {t("first_run.how.skip")}
- </QuietAction>
- )}
- </div>
- </PetSays>
- </div>
- </Spotlight>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/SectionWalk.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/SectionWalk.tsx
new file mode 100644
index 0000000000..c045a9174a
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/SectionWalk.tsx
@@ -0,0 +1,181 @@
+/**
+ * The walk: after the setup window, the user's pet walks the REAL app and
+ * explains each section in a speech bubble — chat, voice, agents, the Agentic
+ * IDE, plugins and where the wake word lives (on macOS also the permissions).
+ *
+ * Purely explanatory: it only navigates, never presses or writes anything.
+ * The stop survives a remount (a reload, a late locale load) through session
+ * storage. When it ends it leaves the app on the chat, on the home surface the
+ * user had before.
+ */
+import { ArrowLeft } from "lucide-react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { FOCUS_RING } from "@/components/agentic/controls";
+import { fill, useLocaleChunk, useT } from "@/i18n";
+import type { HomeSurface } from "@/lib/homeSurface";
+import { cn } from "@/lib/utils";
+import { useEventStore } from "@/store/events";
+import { useHomeStore } from "@/store/home";
+import { PetSays, useGuidePet } from "../pet/GuidePet";
+import { Spotlight } from "../tour/Spotlight";
+import { QuietAction } from "../ui";
+import { walkStopsFor } from "./setupSteps";
+import { useAnchorRect } from "./useAnchorRect";
+import { usePlatform } from "./usePlatform";
+
+const BUBBLE_W = 500;
+const STOP_KEY = "jarvis.setup.walkStop";
+
+function readStop(count: number): number {
+ try {
+ const n = Number(window.sessionStorage.getItem(STOP_KEY));
+ return Number.isInteger(n) && n > 0 && n < count ? n : 0;
+ } catch {
+ return 0;
+ }
+}
+
+function saveStop(n: number | null): void {
+ try {
+ if (n === null) window.sessionStorage.removeItem(STOP_KEY);
+ else window.sessionStorage.setItem(STOP_KEY, String(n));
+ } catch {
+ // Storage may be blocked; the walk then starts over after a reload.
+ }
+}
+
+export function SectionWalk({ onDone }: { onDone: () => void }) {
+ const t = useT();
+ const ready = useLocaleChunk("onboarding");
+ const pet = useGuidePet();
+ const platform = usePlatform();
+ const stops = useMemo(() => walkStopsFor(platform), [platform]);
+ const [index, setIndexRaw] = useState(() => readStop(stops.length));
+ const originalSurface = useRef<HomeSurface>(useHomeStore.getState().surface);
+ const doneRef = useRef(false);
+ const setIndex = useCallback((update: (i: number) => number) => {
+ setIndexRaw((i) => {
+ const n = update(i);
+ saveStop(n);
+ return n;
+ });
+ }, []);
+ const stop = stops[Math.min(index, stops.length - 1)];
+ const last = index >= stops.length - 1;
+
+ // Bring the stop's place on screen first: the composer and the voice bar
+ // are two surfaces of the chat home.
+ useEffect(() => {
+ if (!ready) return;
+ const nav = useEventStore.getState();
+ if (stop.section && nav.activeSection !== stop.section) nav.setActiveSection(stop.section);
+ if (stop.surface && useHomeStore.getState().surface !== stop.surface) {
+ useHomeStore.getState().setSurface(stop.surface);
+ }
+ }, [ready, stop]);
+
+ const rect = useAnchorRect(ready ? stop.anchor : undefined, Boolean(stop.scrollTo), stop.id);
+
+ const done = useCallback(() => {
+ if (doneRef.current) return;
+ doneRef.current = true;
+ saveStop(null);
+ // Leave the app where a new user expects it: home, on the surface they had.
+ const nav = useEventStore.getState();
+ if (nav.activeSection !== "chats") nav.setActiveSection("chats");
+ if (useHomeStore.getState().surface !== originalSurface.current) {
+ useHomeStore.getState().setSurface(originalSurface.current);
+ }
+ onDone();
+ }, [onDone]);
+
+ const next = useCallback(() => {
+ if (last) done();
+ else setIndex((i) => Math.min(stops.length - 1, i + 1));
+ }, [last, done, setIndex, stops.length]);
+
+ // Arrow keys move through the walk.
+ useEffect(() => {
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === "ArrowRight") next();
+ else if (event.key === "ArrowLeft") setIndex((i) => Math.max(0, i - 1));
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [next, setIndex]);
+
+ if (!ready) return null;
+
+ const text = fill(t(`first_run.tour.stops.${stop.id}`), { pet: pet?.name ?? "Gigi" });
+ const heading = t(`first_run.tour.labels.${stop.id}`);
+
+ return (
+ <Spotlight rect={rect} placement={stop.placement} blocking cardWidth={BUBBLE_W}>
+ <div
+ role="dialog"
+ aria-modal="true"
+ aria-label={t("first_run.tour.title")}
+ data-testid="setup-card"
+ data-step="tour"
+ data-stop={stop.id}
+ >
+ <PetSays
+ key={stop.id}
+ text={text}
+ state={stop.pet}
+ testId="walk-say"
+ heading={
+ <p className="mb-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">
+ {heading}
+ </p>
+ }
+ >
+ <div className="mt-3 flex items-center gap-3">
+ <button
+ type="button"
+ onClick={next}
+ data-testid="walk-next"
+ className={cn(
+ "h-8 rounded-lg bg-accent px-3.5 text-sm font-medium text-accent-foreground transition-opacity hover:opacity-90",
+ FOCUS_RING,
+ )}
+ >
+ {last ? t("first_run.tour.finish") : t("first_run.tour.next")}
+ </button>
+ {index > 0 && (
+ <QuietAction
+ onClick={() => setIndex((i) => i - 1)}
+ className="inline-flex items-center gap-1 text-xs"
+ testId="walk-prev"
+ >
+ <ArrowLeft aria-hidden className="h-3 w-3" />
+ {t("first_run.back")}
+ </QuietAction>
+ )}
+ <span
+ className="ml-auto flex items-center gap-1"
+ role="img"
+ aria-label={fill(t("first_run.step_of"), { current: index + 1, total: stops.length })}
+ data-testid="walk-progress"
+ >
+ {stops.map((s, i) => (
+ <span
+ key={s.id}
+ className={cn(
+ "h-1.5 rounded-full transition-all duration-200",
+ i === index ? "w-4 bg-accent" : i < index ? "w-1.5 bg-foreground/50" : "w-1.5 bg-border-strong",
+ )}
+ />
+ ))}
+ </span>
+ {!last && (
+ <QuietAction onClick={done} className="text-xs" testId="walk-skip">
+ {t("first_run.tour.skip")}
+ </QuietAction>
+ )}
+ </div>
+ </PetSays>
+ </div>
+ </Spotlight>
+ );
+}
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
index 82ac28a27b..4f03488dfb 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.test.tsx
@@ -1,11 +1,9 @@
-import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { act, cleanup, fireEvent, render, screen, waitFor, within } 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 { requestedApiKeysTab } from "@/lib/apiKeysTab";
import { useEventStore } from "@/store/events";
-import { HOW_BEATS } from "./HowWalk";
import { SetupTour } from "./SetupTour";
type Onb = ReturnType<typeof useOnboarding>;
@@ -25,22 +23,11 @@ const openai = {
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 agentRows: Array<{ jarvis: string; label?: string; oauth_connected?: boolean }> = [];
-let wakeWord = { phrase: "", enabled: false };
-let calls: Array<{ url: string; method: string }> = [];
+let wakeWord = { phrase: "", enabled: false, engine: "auto" };
+let cliStatus: Record<string, object> = {};
+let loginReplies: Record<string, { status: number; body: unknown }> = {};
+let calls: Array<{ url: string; method: string; body?: string }> = [];
function stubFetch() {
calls = [];
@@ -48,14 +35,23 @@ function stubFetch() {
"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) });
+ calls.push({ url, method, body: typeof init?.body === "string" ? init.body : undefined });
+ const reply = (body: unknown, status = 200) =>
+ Promise.resolve({ ok: status < 400, status, 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/setup/starter-plans") return reply({ plans: [], selected: null, custom_id: "custom" });
+ if (url === "/api/settings/wake-word" && method === "PUT") {
+ const sent = JSON.parse(String(init?.body)) as { phrase: string };
+ wakeWord = { ...wakeWord, phrase: sent.phrase };
+ return reply({ ok: true, phrase: sent.phrase, engine: "auto", resolved_engine: "auto", degraded: false });
+ }
if (url === "/api/settings/wake-word") return reply(wakeWord);
- if (url === "/api/jarvis-agent/status") return reply({ mapping: agentRows });
+ if (url === "/api/settings/autostart" && method === "PUT") return reply({ ok: true, enabled: true, supported: true });
if (url === "/api/settings/autostart") return reply({ enabled: false, supported: true });
+ if (url.endsWith("/status") && url in cliStatus) return reply(cliStatus[url]);
+ if (url.endsWith("/status")) return reply({ installed: true, connected: false, mode: "unknown" });
+ if (url.endsWith("/login") && url in loginReplies) return reply(loginReplies[url].body, loginReplies[url].status);
return reply({ ok: true });
}),
);
@@ -85,7 +81,7 @@ function fakeOnb(over: Partial<NonNullable<Onb["state"]>> = {}): Onb {
};
}
-const accepted = { terms: { accepted: true, accepted_version: "1.0", current_version: "1.0" } };
+const step = () => screen.getByTestId("setup-card").dataset.step;
beforeAll(async () => {
await loadLocaleChunk("onboarding");
@@ -93,9 +89,11 @@ beforeAll(async () => {
beforeEach(() => {
providers = [{ ...openai, secrets_set: {} }];
- agentRows = [];
- wakeWord = { phrase: "", enabled: false };
+ wakeWord = { phrase: "", enabled: false, engine: "auto" };
+ cliStatus = {};
+ loginReplies = {};
_resetProvidersCacheForTests();
+ window.sessionStorage.clear();
useEventStore.getState().setActiveSection("chats");
stubFetch();
});
@@ -106,208 +104,148 @@ afterEach(() => {
vi.unstubAllGlobals();
});
-it("starts with a welcome and no consent gate, then opens the API Keys page", async () => {
+it("opens the setup window on the name, with three step pills", async () => {
+ render(<SetupTour onb={fakeOnb()} preview={false} onFinished={vi.fn()} />);
+ await screen.findByTestId("setup-name-input");
+ expect(step()).toBe("name");
+ const pills = within(screen.getByTestId("setup-steps")).getAllByRole("button");
+ expect(pills).toHaveLength(3);
+ expect(screen.getByTestId("setup-pill-name").getAttribute("aria-current")).toBe("step");
+});
+
+it("asks for a name, saves it as the wake word and moves on to connecting", async () => {
const onb = fakeOnb();
render(<SetupTour onb={onb} preview={false} onFinished={vi.fn()} />);
- const start = (await screen.findByTestId("onboarding-primary")) as HTMLButtonElement;
- expect(screen.getByTestId("setup-card").dataset.step).toBe("welcome");
- expect(start.disabled).toBe(false);
- expect(screen.queryByTestId("onboarding-accept")).toBeNull();
- expect(screen.queryByTestId("onboarding-decline")).toBeNull();
+ const input = (await screen.findByTestId("setup-name-input")) as HTMLInputElement;
+ const go = screen.getByTestId("onboarding-primary") as HTMLButtonElement;
+ expect(go.disabled).toBe(true);
+ fireEvent.change(input, { target: { value: "Nova" } });
+ expect(screen.getByTestId("setup-name-preview").textContent).toContain("Hey Nova");
await act(async () => {
- fireEvent.click(start);
+ fireEvent.click(go);
});
- expect(onb.acceptTerms).not.toHaveBeenCalled();
- // First the explainer of what the assistant is, then the API Keys page.
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("how"));
- expect(onb.saveStep).toHaveBeenCalledWith("how", []);
- fireEvent.click(await screen.findByTestId("how-skip"));
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("keys"));
- expect(onb.saveStep).toHaveBeenCalledWith("keys", []);
- await waitFor(() => expect(useEventStore.getState().activeSection).toBe("apikeys"));
+ await waitFor(() => expect(step()).toBe("connect"));
+ const put = calls.find((c) => c.url === "/api/settings/wake-word" && c.method === "PUT");
+ expect(JSON.parse(put!.body!)).toMatchObject({ phrase: "Nova", persist: true });
+ expect(onb.saveStep).toHaveBeenCalledWith("connect", []);
});
-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("subscriptions"));
- expect(onb.saveStep).toHaveBeenLastCalledWith("subscriptions", ["keys"]);
+it("keeps a name that did not change without saving it again", async () => {
+ wakeWord = { phrase: "Atlas", enabled: true, engine: "auto" };
+ render(<SetupTour onb={fakeOnb()} preview={false} onFinished={vi.fn()} />);
+ await waitFor(() => expect((screen.getByTestId("setup-name-input") as HTMLInputElement).value).toBe("Atlas"));
+ await act(async () => {
+ fireEvent.click(screen.getByTestId("onboarding-primary"));
+ });
+ await waitFor(() => expect(step()).toBe("connect"));
+ expect(calls.some((c) => c.url === "/api/settings/wake-word" && c.method === "PUT")).toBe(false);
});
-it("opens the Agents tab and waits for a subscription", async () => {
- const onb = fakeOnb({ ...accepted, current_step: "subscriptions" });
+it("lists the subscriptions, marks a signed-in one as ready and records a skipped step", async () => {
+ cliStatus["/api/claude/status"] = { installed: true, connected: true, mode: "subscription", user_email: "[email protected]" };
+ const onb = fakeOnb({ current_step: "connect" });
render(<SetupTour onb={onb} preview={false} onFinished={vi.fn()} />);
- const status = await screen.findByTestId("setup-subscriptions-status");
- expect(useEventStore.getState().activeSection).toBe("apikeys");
- expect(requestedApiKeysTab()).toBe("subagents");
- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);
- expect(status.textContent).not.toContain("Claude");
- fireEvent.click(screen.getByTestId("setup-subscriptions-later"));
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("voice"));
- expect(onb.saveStep).toHaveBeenLastCalledWith("voice", ["subscriptions"]);
- await waitFor(() => expect(useEventStore.getState().activeSection).toBe("settings"));
- expect(requestedApiKeysTab()).toBeNull();
-});
-
-it("lets the user on once a subscription is signed in", async () => {
- agentRows = [{ jarvis: "claude-api", label: "Claude (API-Key)", oauth_connected: true }];
- render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "subscriptions" })} preview={false} onFinished={vi.fn()} />);
- await waitFor(() => expect(screen.getByTestId("setup-subscriptions-status").textContent).toContain("Claude"));
- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false);
+ for (const id of ["claude", "codex", "antigravity", "grok"]) await screen.findByTestId(`setup-sub-${id}`);
+ await waitFor(() => expect(screen.getByTestId("setup-sub-claude").dataset.state).toBe("ready"));
+ expect(screen.getByTestId("setup-sub-claude").textContent).toContain("[email protected]");
+ // Something is connected: Continue moves on without a skip.
+ await act(async () => {
+ fireEvent.click(screen.getByTestId("onboarding-primary"));
+ });
+ await waitFor(() => expect(step()).toBe("voice"));
+ expect(onb.saveStep).toHaveBeenLastCalledWith("voice", []);
});
-it("asks for a wake word before going on, with a way to leave it for later", async () => {
- const onb = fakeOnb({ ...accepted, current_step: "voice" });
+it("lets the user go on with nothing connected, recorded as skipped", async () => {
+ const onb = fakeOnb({ current_step: "connect" });
render(<SetupTour onb={onb} preview={false} onFinished={vi.fn()} />);
- await screen.findByTestId("setup-voice-later");
- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);
- fireEvent.click(screen.getByTestId("setup-voice-later"));
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("ready"));
- expect(onb.saveStep).toHaveBeenLastCalledWith("ready", ["voice"]);
-});
-
-it("goes on from the wake word once one is saved", async () => {
- wakeWord = { phrase: "Hey George", enabled: true };
- render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "voice" })} preview={false} onFinished={vi.fn()} />);
- await waitFor(() => expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false));
- expect(screen.queryByTestId("setup-voice-later")).toBeNull();
-});
-
-it("goes on once a wake word is saved even while always-listen stays off", async () => {
- wakeWord = { phrase: "Hey Jarvis", enabled: false };
- render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "voice" })} preview={false} onFinished={vi.fn()} />);
- await screen.findByTestId("setup-voice-later");
- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(true);
- wakeWord = { phrase: "Hey George", enabled: false };
- window.dispatchEvent(new CustomEvent("jarvis:wake-word-changed"));
- await waitFor(() => expect(screen.getByTestId("setup-voice-status").textContent).toContain("Hey George"));
- expect((screen.getByTestId("onboarding-primary") as HTMLButtonElement).disabled).toBe(false);
- expect(screen.queryByTestId("setup-voice-later")).toBeNull();
-});
-
-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-connect-nothing");
+ await act(async () => {
+ fireEvent.click(screen.getByTestId("onboarding-primary"));
});
- 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);
+ await waitFor(() => expect(step()).toBe("voice"));
+ expect(onb.saveStep).toHaveBeenLastCalledWith("voice", ["connect"]);
});
-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("hands over to the tour from the last step without completing yet", 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");
+it("shows the install command when a subscription's app is missing", async () => {
+ cliStatus["/api/codex/status"] = { installed: false, connected: false, mode: "missing" };
+ loginReplies["/api/codex/login"] = {
+ status: 409,
+ body: { detail: { message: "Codex CLI is not installed", install_command: "npm i -g @openai/codex" } },
+ };
+ render(<SetupTour onb={fakeOnb({ current_step: "connect" })} preview={false} onFinished={vi.fn()} />);
+ const connect = await screen.findByTestId("setup-sub-codex-connect");
await act(async () => {
- fireEvent.click(start);
+ fireEvent.click(connect);
});
- // The gate completes onboarding (and restarts) only once the tour ends.
- expect(onFinished).toHaveBeenCalled();
- expect(onb.complete).not.toHaveBeenCalled();
+ const install = await screen.findByTestId("setup-sub-codex-install");
+ expect(install.textContent).toContain("npm i -g @openai/codex");
+ expect(calls.some((c) => c.url === "/api/codex/login" && c.method === "POST")).toBe(true);
});
-it("keeps the app on the step's page when something else moves it", async () => {
- render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "keys" })} preview={false} onFinished={vi.fn()} />);
- await screen.findByTestId("setup-keys-waiting");
- await waitFor(() => expect(useEventStore.getState().activeSection).toBe("apikeys"));
- act(() => useEventStore.getState().setActiveSection("profile"));
- await waitFor(() => expect(useEventStore.getState().activeSection).toBe("apikeys"));
+it("offers an API key next to the subscriptions", async () => {
+ render(<SetupTour onb={fakeOnb({ current_step: "connect" })} preview={false} onFinished={vi.fn()} />);
+ fireEvent.click(await screen.findByTestId("setup-key-toggle"));
+ await screen.findByTestId("setup-key-panel");
+ await screen.findByTestId("setup-key-provider-openai");
});
-it("walks a replay from the start and never writes, completes or restarts", async () => {
- const onb = fakeOnb({ ...accepted, completed: true, current_step: "voice" });
+it("ends the window on the voice step and walks the app, then finishes", async () => {
+ wakeWord = { phrase: "Nova", enabled: false, engine: "auto" };
+ const onb = fakeOnb({ current_step: "voice" });
const onFinished = vi.fn();
- render(<SetupTour onb={onb} preview onFinished={onFinished} />);
- // A replay from the URL shows every step, the welcome included.
- 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("how"));
- fireEvent.click(await screen.findByTestId("how-skip"));
- 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("subscriptions"));
- fireEvent.click(await screen.findByTestId("setup-subscriptions-later"));
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("voice"));
- fireEvent.click(await screen.findByTestId("setup-voice-later"));
- const start = await screen.findByTestId("onboarding-start");
+ render(<SetupTour onb={onb} preview={false} onFinished={onFinished} />);
+ await waitFor(() => expect(screen.getByTestId("setup-voice-wake").textContent).toContain("Hey Nova"));
+ await screen.findByTestId("onboarding-autostart");
await act(async () => {
- fireEvent.click(start);
+ fireEvent.click(screen.getByTestId("onboarding-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");
-});
-
-it("starts a replay from Settings at the API Keys page, with no way back to the consent", async () => {
- const onb = fakeOnb({ ...accepted, completed: true });
- render(<SetupTour onb={onb} preview startAt="keys" onFinished={vi.fn()} />);
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("keys"));
- expect(screen.queryByTestId("setup-back")).toBeNull();
-});
-
-it("explains the assistant with the pet walking the real app, then goes on to the keys", async () => {
- const onb = fakeOnb({ ...accepted, current_step: "how" });
- render(<SetupTour onb={onb} preview={false} onFinished={vi.fn()} />);
- const card = await screen.findByTestId("setup-card");
- expect(card.dataset.step).toBe("how");
- expect(card.dataset.beat).toBe("hello");
- // The pet says each line in a bubble; the composer beat moves the app home.
- fireEvent.click(screen.getByTestId("how-next"));
- expect(screen.getByTestId("setup-card").dataset.beat).toBe("talk");
- await waitFor(() => expect(useEventStore.getState().activeSection).toBe("chats"));
- fireEvent.click(screen.getByTestId("how-prev"));
- expect(screen.getByTestId("setup-card").dataset.beat).toBe("hello");
- for (let i = 0; i < HOW_BEATS.length - 1; i++) fireEvent.click(screen.getByTestId("how-next"));
- expect(screen.getByTestId("setup-card").dataset.beat).toBe("done");
- // Nothing was written while the pet explained.
- expect(onb.saveStep).not.toHaveBeenCalled();
- fireEvent.click(screen.getByTestId("how-next"));
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("keys"));
- expect(onb.saveStep).toHaveBeenCalledWith("keys", []);
+ await waitFor(() => expect(step()).toBe("tour"));
+ expect(onb.saveStep).toHaveBeenLastCalledWith("tour", []);
+ // The walk: chat first, then on through every stop to the end.
+ expect(screen.getByTestId("setup-card").dataset.stop).toBe("chat");
+ const seen: string[] = [];
+ for (let i = 0; i < 12 && !onFinished.mock.calls.length; i++) {
+ seen.push(screen.getByTestId("setup-card").dataset.stop ?? "");
+ await act(async () => {
+ fireEvent.click(screen.getByTestId("walk-next"));
+ });
+ }
+ expect(seen).toEqual(["chat", "voice", "agents", "ide", "plugins", "wake", "done"]);
+ expect(onFinished).toHaveBeenCalledTimes(1);
+ expect(useEventStore.getState().activeSection).toBe("chats");
+});
+
+it("lets the walk be skipped", async () => {
+ const onFinished = vi.fn();
+ render(<SetupTour onb={fakeOnb({ current_step: "tour" })} preview={false} onFinished={onFinished} />);
+ fireEvent.click(await screen.findByTestId("walk-skip"));
+ expect(onFinished).toHaveBeenCalledTimes(1);
});
-it("starts a replay from Settings at the explainer", async () => {
- const onb = fakeOnb({ ...accepted, completed: true });
- render(<SetupTour onb={onb} preview startAt="how" onFinished={vi.fn()} />);
- await waitFor(() => expect(screen.getByTestId("setup-card").dataset.step).toBe("how"));
- expect(screen.queryByTestId("setup-back")).toBeNull();
+it("goes back to a finished step from its pill", async () => {
+ render(<SetupTour onb={fakeOnb({ current_step: "voice" })} preview={false} onFinished={vi.fn()} />);
+ await screen.findByTestId("onboarding-start");
+ fireEvent.click(screen.getByTestId("setup-pill-name"));
+ await waitFor(() => expect(step()).toBe("name"));
});
-it("lets the welcome skip the whole setup", async () => {
+it("offers to skip the whole setup on the first step", async () => {
const onSkipAll = vi.fn();
render(<SetupTour onb={fakeOnb()} preview={false} onFinished={vi.fn()} onSkipAll={onSkipAll} />);
fireEvent.click(await screen.findByTestId("setup-skip-all"));
- expect(onSkipAll).toHaveBeenCalled();
+ expect(onSkipAll).toHaveBeenCalledTimes(1);
});
-it("says what a key is for: live voice needs OpenAI or Gemini", async () => {
- providers = [{ ...openai, configured: true, secrets_set: { openai_api_key: true } }];
- render(<SetupTour onb={fakeOnb({ ...accepted, current_step: "keys" })} preview={false} onFinished={vi.fn()} />);
- const live = await screen.findByTestId("setup-keys-live");
- await waitFor(() => expect(live.dataset.tone).toBe("ok"));
+it("never writes the onboarding state in a replay", async () => {
+ wakeWord = { phrase: "Nova", enabled: true, engine: "auto" };
+ const onb = fakeOnb({ completed: true, current_step: "tour" });
+ render(<SetupTour onb={onb} preview onFinished={vi.fn()} />);
+ // A replay starts at the beginning, not at the saved step.
+ await waitFor(() => expect((screen.getByTestId("setup-name-input") as HTMLInputElement).value).toBe("Nova"));
+ await act(async () => {
+ fireEvent.click(screen.getByTestId("onboarding-primary"));
+ });
+ await waitFor(() => expect(step()).toBe("connect"));
+ expect(onb.saveStep).not.toHaveBeenCalled();
});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx
index 38c4191c0a..6923f5afcf 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupTour.tsx
@@ -1,56 +1,24 @@
-import { ArrowLeft, Lock } from "lucide-react";
-import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react";
-import { Switch } from "@/components/ui/switch";
+import { useCallback, useState } from "react";
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 { fetchAgentConnections } from "@/lib/agentChatApi";
-import { clearApiKeysTabRequest, requestApiKeysTab } from "@/lib/apiKeysTab";
-import { fill, setUiLanguage, useLocaleChunk, useT, useUiLanguage, type UiLanguage } from "@/i18n";
-import type { PetState } from "@/lib/petStates";
-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 { PrimaryAction, QuietAction, Status } from "../ui";
-import { resumeStep, SETUP_STEPS, stepsFor, type SetupStepId } from "./setupSteps";
-import { GuidePetFigure } from "../pet/GuidePet";
-import { HowWalk } from "./HowWalk";
-import { useAnchorRect } from "./useAnchorRect";
+import { useLocaleChunk } from "@/i18n";
+import { SectionWalk } from "./SectionWalk";
+import { SetupWizard } from "./SetupWizard";
+import { isWizardStep, resumeStep, type SetupStepId } from "./setupSteps";
type Onb = ReturnType<typeof useOnboarding>;
-/** How the guiding pet looks on each step's card. */
-const PET: Record<SetupStepId, PetState> = {
- welcome: "success",
- how: "talking",
- keys: "thinking",
- subscriptions: "thinking",
- voice: "listening",
- permissions: "idle",
- ready: "success",
-};
-
-const LANGS: UiLanguage[] = ["en", "de", "es"];
-
/**
- * First-run setup, done inside the real app.
+ * First-run setup, in two acts.
*
- * 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, its Agents tab for a subscription, 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 has a way on without doing it. There is no
- * consent gate: it is an open-source app, the welcome only picks a language.
+ * First the setup window: three steps in one dialog — the name (which is the
+ * wake word), connecting an AI (subscriptions and an API key), and how the
+ * user talks to it. Then the walk: the user's pet walks the real app and
+ * explains each section in place.
*
- * The last step hands over to the tour of the app straight away; the gate
- * completes onboarding (and restarts the app once) when the tour ends.
- * `preview` (a replay) never writes — it only walks the steps and hands over
- * to the tour. `startAt` lets a replay from Settings begin at the API Keys.
+ * The gate completes onboarding (and restarts the app once) when the walk
+ * ends. `preview` (a replay from Settings) never writes the onboarding state —
+ * the user's own changes on the steps (a name, a key, a sign-in) still save,
+ * because they are the user's actions, not the guide's.
*/
export function SetupTour({
onb,
@@ -62,533 +30,47 @@ export function SetupTour({
onb: Onb;
preview: boolean;
onFinished: () => void;
- /** "Skip setup" on the welcome: ends the whole first-run guide. */
+ /** "Skip setup" on the first step: ends the whole first-run guide. */
onSkipAll?: () => void;
startAt?: SetupStepId;
}) {
- 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).
+ // it left off.
const [stepId, setStepId] = useState<SetupStepId>(() =>
- preview
- ? (startAt ?? "welcome")
- : resumeStep(stepsFor(null), onb.state?.current_step ?? null),
+ preview ? (startAt ?? "name") : resumeStep(onb.state?.current_step ?? null),
);
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 — on the
- // API Keys page also the right tab.
- useEffect(() => {
- if (!ready || !step.section) return;
- if (step.section === "apikeys") requestApiKeysTab(step.apiKeysTab ?? null);
- else clearApiKeysTabRequest();
- const nav = useEventStore.getState();
- if (nav.activeSection !== step.section) nav.setActiveSection(step.section);
- }, [ready, step.section, step.apiKeysTab, stepId]);
-
- // Keep the app on this step's place. The dim blocks every click, so a
- // drift is something else moving the app (a section restored late in
- // boot) — the card would then describe a page that is not on screen.
- useEffect(() => {
- if (!ready || !step.section) return;
- const target = step.section;
- return useEventStore.subscribe((state) => {
- if (state.activeSection !== target) state.setActiveSection(target);
- });
- }, [ready, step.section]);
-
- // Later visits to the API Keys page open on its own default tab again.
- useEffect(() => clearApiKeysTabRequest, []);
-
- 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;
- // Never back to the welcome, nor behind where a replay started.
- const firstId = preview && startAt ? startAt : steps[1];
- const prevId = index > 1 && stepId !== firstId ? steps[index - 1] : null;
-
- 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;
-
- // The explanation is its own walk through the real app, told by the pet.
- if (stepId === "how") return <HowWalk onDone={() => { cheer(); next(); }} />;
-
- 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="max-h-[calc(100vh-24px)] overflow-y-auto 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">
- <GuidePetFigure key={cue} state={PET[stepId]} px={48} />
- <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 onStart={() => { cheer(); next(); }} onSkipAll={onSkipAll} />}
- {stepId === "keys" && <KeysStep next={next} later={later} cheer={cheer} />}
- {stepId === "subscriptions" && <SubscriptionsStep next={next} later={later} />}
- {stepId === "voice" && <VoiceStep next={next} later={later} />}
- {stepId === "permissions" && <PermissionsStep next={next} />}
- {stepId === "ready" && <ReadyStep preview={preview} onFinished={onFinished} />}
- </div>
- {footer}
- </div>
- </Spotlight>
- );
-}
-
-/* ------------------------------------------------------------------ steps */
-
-function WelcomeStep({ onStart, onSkipAll }: { onStart: () => void; onSkipAll?: () => void }) {
- const t = useT();
- const lang = useUiLanguage();
- 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>
- <PrimaryAction onClick={onStart}>{t("first_run.welcome.start")}</PrimaryAction>
- {onSkipAll && (
- <div className="text-center">
- <QuietAction onClick={onSkipAll} testId="setup-skip-all" className="text-xs">
- {t("first_run.welcome.skip_all")}
- </QuietAction>
- </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));
- // Live voice (talk and get an instant answer) needs a key one of the
- // realtime starter plans runs on; any other key still runs chat and the
- // classic voice (speech to text, answer read aloud).
- const startableNow = startableProviders(providers);
- const liveVoice = plans.some((p) => p.mode === "realtime" && planKeysComplete(p, startableNow));
- 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>}
- {hasKey && !connecting && (
- <Status tone={liveVoice ? "ok" : "muted"} testId="setup-keys-live">
- {liveVoice ? t("first_run.keys.live_ready") : t("first_run.keys.live_missing")}
- </Status>
- )}
- {!hasKey && (
- <p className="text-xs leading-relaxed text-muted-foreground" data-testid="setup-keys-nokey">
- {t("first_run.keys.no_key")}
- </p>
- )}
- {hasKey && !connecting && (
- <p className="text-xs leading-relaxed text-muted-foreground">{t("first_run.keys.next_hint")}</p>
- )}
- <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>
- );
-}
-
-/** Poll interval while the subscriptions step waits for a sign-in. */
-const SUBSCRIPTION_POLL_MS = 3000;
-
-/**
- * The Agents tab of the API Keys page is open behind the card. Agents run
- * best on a subscription (Claude, ChatGPT/Codex, …): a flat monthly price
- * instead of paying per call. The step waits for one to be signed in; the
- * sign-in itself happens on the tab.
- */
-function SubscriptionsStep({ next, later }: { next: () => void; later: () => void }) {
- const t = useT();
- const connected = useConnectedSubscriptions(SUBSCRIPTION_POLL_MS);
- const has = connected.length > 0;
- return (
- <div className="space-y-3">
- <Status tone={has ? "ok" : "muted"} testId="setup-subscriptions-status">
- {has
- ? fill(t("first_run.subscriptions.connected"), { names: connected.join(", ") })
- : t("first_run.subscriptions.waiting")}
- </Status>
- <p className="text-xs leading-relaxed text-muted-foreground">{t("first_run.subscriptions.why")}</p>
- <PrimaryAction onClick={next} disabled={!has}>
- {t("first_run.continue")}
- </PrimaryAction>
- {!has && (
- <div className="text-center">
- <QuietAction onClick={later} testId="setup-subscriptions-later" className="text-xs">
- {t("first_run.subscriptions.later")}
- </QuietAction>
- </div>
- )}
- </div>
- );
-}
-
-/**
- * Subscription names for the status rows whose own label names the API side
- * ("Claude (API-Key)") or is missing; anything else shows its own label.
- */
-const SUBSCRIPTION_NAMES: Record<string, string> = {
- "claude-api": "Claude",
- "openai-codex": "ChatGPT (Codex)",
- antigravity: "Antigravity",
- "grok-build": "Grok Build",
-};
-
-/**
- * Names of the agent providers signed in with a subscription. `pollMs`
- * re-reads while a step waits for a sign-in; 0 reads once.
- */
-function useConnectedSubscriptions(pollMs: number): string[] {
- const [names, setNames] = useState<string[]>([]);
- useEffect(() => {
- let cancelled = false;
- let timer = 0;
- const read = async () => {
- try {
- const rows = await fetchAgentConnections();
- if (!cancelled) {
- const found = rows.filter((r) => r.oauth_connected).map((r) => SUBSCRIPTION_NAMES[r.jarvis] ?? (r.label || r.jarvis));
- setNames((prev) => (prev.join("|") === found.join("|") ? prev : found));
- }
- } catch {
- // Best-effort: a warming backend just reads as "nothing connected yet".
- }
- if (!cancelled && pollMs > 0) timer = window.setTimeout(() => void read(), pollMs);
- };
- void read();
- return () => {
- cancelled = true;
- window.clearTimeout(timer);
- };
- }, [pollMs]);
- return names;
-}
-
-/**
- * The wake-word group of Settings is open behind the card. Continue waits
- * for a saved wake word; without one the Call shortcut is the way in, so the
- * step can still be left for later. Saving a word does not flip the
- * always-listen switch (that needs a local model), so a save made during this
- * step counts on its own — otherwise Continue stayed locked after a save.
- */
-function VoiceStep({ next, later }: { next: () => void; later: () => void }) {
- const t = useT();
- const { config } = useWakeWord();
- const [savedHere, setSavedHere] = useState(false);
- useEffect(() => {
- const onChanged = () => setSavedHere(true);
- window.addEventListener("jarvis:wake-word-changed", onChanged);
- return () => window.removeEventListener("jarvis:wake-word-changed", onChanged);
- }, []);
- const phrase = config?.phrase.trim() ?? "";
- const on = Boolean(config?.enabled && phrase);
- const saved = on || (savedHere && Boolean(phrase));
- return (
- <div className="space-y-3">
- <Status tone={saved ? "ok" : "muted"} testId="setup-voice-status">
- {on
- ? fill(t("first_run.voice.on"), { phrase })
- : saved
- ? fill(t("first_run.voice.saved"), { phrase })
- : t("first_run.voice.off")}
- </Status>
- <PrimaryAction onClick={next} disabled={!saved}>
- {t("first_run.continue")}
- </PrimaryAction>
- {!saved && (
- <div className="text-center">
- <QuietAction onClick={later} testId="setup-voice-later" className="text-xs">
- {t("first_run.voice.later")}
- </QuietAction>
- </div>
- )}
- </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>
+ const skipTo = useCallback(
+ (target: SetupStepId) => {
+ const nextSkipped = skipped.includes(stepId) ? skipped : [...skipped, stepId];
+ setSkipped(nextSkipped);
+ goTo(target, nextSkipped);
+ },
+ [skipped, stepId, goTo],
);
-}
-
-/**
- * What is set up, read back from the app itself, then on to the tour. The
- * one restart that switches every choice on comes when the tour ends.
- */
-function ReadyStep({ preview, onFinished }: { preview: boolean; onFinished: () => void }) {
- const t = useT();
- const { providers } = useProviders();
- const { config } = useWakeWord();
- const subscriptions = useConnectedSubscriptions(0);
- const [autostart, setAutostart] = useState<{ enabled: boolean; supported: boolean } | 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.
- }
- }
+ if (!ready) return null;
- 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());
+ if (!isWizardStep(stepId)) return <SectionWalk onDone={onFinished} />;
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_agents")}
- value={subscriptions.length > 0 ? subscriptions.join(", ") : t("first_run.ready.no_subscription")}
- ok={subscriptions.length > 0}
- />
- <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>
- <PrimaryAction onClick={onFinished} testId="onboarding-start">
- {t("first_run.ready.start")}
- </PrimaryAction>
- </div>
+ <SetupWizard
+ step={stepId}
+ preview={preview}
+ onStep={(target) => goTo(target, skipped.filter((id) => id !== stepId))}
+ onSkip={skipTo}
+ onFinish={() => goTo("tour", skipped)}
+ onSkipAll={onSkipAll}
+ />
);
}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupWizard.tsx b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupWizard.tsx
new file mode 100644
index 0000000000..d2a823b143
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/SetupWizard.tsx
@@ -0,0 +1,467 @@
+/**
+ * The setup window: one centred dialog over the dimmed app with three steps
+ * — the assistant's name, connecting an AI, and how the user talks to it.
+ *
+ * A row of numbered step pills sits under the header; finished steps can be
+ * clicked to go back. Each step is a large title, one plain sentence and the
+ * step's own rows, with the way forward at the bottom right. Nothing in the
+ * window blocks: every step can be left for later, and the whole setup can be
+ * skipped from the first step.
+ */
+import { ArrowLeft, ArrowRight, Check, Loader2, Mic, Power } from "lucide-react";
+import { useCallback, useEffect, useId, useState, type ReactNode } from "react";
+import { createPortal } from "react-dom";
+import { Button } from "@/components/ui/button";
+import { Switch } from "@/components/ui/switch";
+import { useAutostart } from "@/hooks/useAutostart";
+import { useWakeWord } from "@/hooks/useWakeWord";
+import { fill, setUiLanguage, useT, useUiLanguage, type UiLanguage } from "@/i18n";
+import { deriveAssistantName } from "@/lib/deriveAssistantName";
+import { cn } from "@/lib/utils";
+import { useEventStore } from "@/store/events";
+import { GuidePetFigure } from "../pet/GuidePet";
+import { TOUR_LAYER_ATTR } from "../tourEvents";
+import { QuietAction } from "../ui";
+import { ConnectStep } from "./ConnectStep";
+import { WIZARD_STEP_IDS, type WizardStepId } from "./setupSteps";
+
+const LANGS: UiLanguage[] = ["en", "de", "es"];
+
+/** One-tap name ideas on the first step — any name works. */
+export const NAME_IDEAS = ["Nova", "Atlas", "Luna", "Milo", "Echo"];
+
+export function SetupWizard({
+ step,
+ preview,
+ onStep,
+ onSkip,
+ onFinish,
+ onSkipAll,
+}: {
+ step: WizardStepId;
+ /** A replay from Settings: nothing restarts at the end. */
+ preview: boolean;
+ /** Move to another step of the window (Back, a finished pill, Continue). */
+ onStep: (target: WizardStepId) => void;
+ /** Continue with nothing done on this step — recorded as skipped. */
+ onSkip: (target: WizardStepId) => void;
+ /** The last step's button: on to the walk through the app. */
+ onFinish: () => void;
+ /** "Skip setup" on the first step: ends the whole first-run guide. */
+ onSkipAll?: () => void;
+}) {
+ const t = useT();
+ const titleId = useId();
+ const index = WIZARD_STEP_IDS.indexOf(step);
+ const next = WIZARD_STEP_IDS[index + 1];
+ const prev = index > 0 ? WIZARD_STEP_IDS[index - 1] : null;
+
+ return createPortal(
+ <div
+ {...{ [TOUR_LAYER_ATTR]: "" }}
+ className="fixed inset-0 z-[110] grid place-items-center overflow-y-auto bg-black/50 p-4 backdrop-blur-[2px]"
+ data-testid="setup-window-backdrop"
+ >
+ <div
+ role="dialog"
+ aria-modal="true"
+ aria-labelledby={titleId}
+ data-testid="setup-card"
+ data-step={step}
+ className="flex max-h-[calc(100vh-32px)] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-popover text-popover-foreground shadow-float"
+ >
+ <header className="shrink-0 space-y-4 px-6 pb-4 pt-5">
+ <div className="flex items-center gap-2.5">
+ <GuidePetFigure state="success" px={34} />
+ <h1 id={titleId} className="text-lg font-semibold tracking-tight text-foreground">
+ {t("first_run.window.title")}
+ </h1>
+ <LanguageSwitch className="ml-auto" />
+ </div>
+ <StepPills current={index} onPick={(i) => onStep(WIZARD_STEP_IDS[i])} />
+ </header>
+ <div className="min-h-0 flex-1 overflow-y-auto border-t border-border bg-background/60 px-6 py-6">
+ {step === "name" && <NameStep onContinue={() => onStep("connect")} onSkipAll={onSkipAll} />}
+ {step === "connect" && (
+ <ConnectStepFrame
+ onBack={() => prev && onStep(prev)}
+ onContinue={(anything) => (anything ? onStep(next ?? "voice") : onSkip(next ?? "voice"))}
+ />
+ )}
+ {step === "voice" && <VoiceStep preview={preview} onBack={() => prev && onStep(prev)} onFinish={onFinish} />}
+ </div>
+ </div>
+ </div>,
+ document.body,
+ );
+}
+
+/* ---------------------------------------------------------------- framing */
+
+function StepPills({ current, onPick }: { current: number; onPick: (index: number) => void }) {
+ const t = useT();
+ return (
+ <ol
+ className="grid auto-cols-fr grid-flow-col gap-1 rounded-xl bg-secondary p-1 ring-1 ring-border"
+ aria-label={t("first_run.window.progress")}
+ data-testid="setup-steps"
+ >
+ {WIZARD_STEP_IDS.map((id, i) => {
+ const done = i < current;
+ const here = i === current;
+ return (
+ <li key={id} className="min-w-0">
+ <button
+ type="button"
+ disabled={!done}
+ onClick={() => onPick(i)}
+ aria-current={here ? "step" : undefined}
+ data-testid={`setup-pill-${id}`}
+ className={cn(
+ "flex w-full min-w-0 items-center gap-2 rounded-lg px-2.5 py-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring max-sm:justify-center",
+ done && "cursor-pointer hover:bg-popover",
+ !done && "cursor-default",
+ here && "bg-popover shadow-sm ring-1 ring-border",
+ )}
+ >
+ <span
+ aria-hidden
+ className={cn(
+ "grid h-5 w-5 shrink-0 place-items-center rounded-full text-xs font-medium ring-1",
+ done
+ ? "bg-accent text-accent-foreground ring-accent"
+ : here
+ ? "bg-accent-soft text-accent ring-accent"
+ : "bg-popover text-muted-foreground ring-border",
+ )}
+ >
+ {done ? <Check className="h-3.5 w-3.5" /> : i + 1}
+ </span>
+ <span
+ className={cn(
+ "min-w-0 truncate text-sm font-medium max-sm:hidden",
+ here ? "text-foreground" : "text-muted-foreground",
+ )}
+ >
+ {t(`first_run.${id}.pill`)}
+ </span>
+ </button>
+ </li>
+ );
+ })}
+ </ol>
+ );
+}
+
+function LanguageSwitch({ className }: { className?: string }) {
+ const t = useT();
+ const lang = useUiLanguage();
+ return (
+ <div
+ className={cn("flex items-center gap-0.5 rounded-full border border-border p-0.5", className)}
+ role="radiogroup"
+ aria-label={t("first_run.window.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-0.5 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",
+ )}
+ >
+ {code.toUpperCase()}
+ </button>
+ ))}
+ </div>
+ );
+}
+
+function StepHead({ title, lede }: { title: string; lede: string }) {
+ return (
+ <>
+ <h2 className="text-2xl font-semibold tracking-tight text-foreground" data-testid="setup-step-title">
+ {title}
+ </h2>
+ <p className="mt-2.5 text-sm leading-relaxed text-muted-foreground">{lede}</p>
+ </>
+ );
+}
+
+function StepFooter({ left, children }: { left?: ReactNode; children: ReactNode }) {
+ return (
+ <div className="mt-6 flex flex-wrap items-center justify-between gap-3">
+ <div>{left}</div>
+ <div className="flex items-center gap-2">{children}</div>
+ </div>
+ );
+}
+
+function BackAction({ onClick }: { onClick: () => void }) {
+ const t = useT();
+ return (
+ <QuietAction onClick={onClick} className="inline-flex items-center gap-1 text-sm" testId="setup-back">
+ <ArrowLeft aria-hidden className="h-3.5 w-3.5" />
+ {t("first_run.back")}
+ </QuietAction>
+ );
+}
+
+/* ------------------------------------------------------------------ steps */
+
+/**
+ * "What would you like to call me?" The name is the wake word: saving it
+ * renames the assistant everywhere (bylines, the voice, the sidebar).
+ */
+function NameStep({ onContinue, onSkipAll }: { onContinue: () => void; onSkipAll?: () => void }) {
+ const t = useT();
+ const { config, saveWakeWord } = useWakeWord();
+ const saved = deriveAssistantName(config?.phrase ?? "");
+ const [typed, setTyped] = useState<string | null>(null);
+ const [saving, setSaving] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const value = typed ?? saved;
+ const name = deriveAssistantName(value);
+
+ async function submit() {
+ if (!name) return;
+ if (name !== saved) {
+ setSaving(true);
+ setError(null);
+ try {
+ // A custom wake model belongs to the old word; a new word starts on auto.
+ const engine = config?.engine && config.engine !== "custom_onnx" ? config.engine : "auto";
+ await saveWakeWord({ phrase: value.trim(), engine });
+ } catch (e) {
+ setError((e as Error).message);
+ setSaving(false);
+ return;
+ }
+ setSaving(false);
+ }
+ onContinue();
+ }
+
+ return (
+ <form
+ onSubmit={(event) => {
+ event.preventDefault();
+ void submit();
+ }}
+ >
+ <StepHead title={t("first_run.name.title")} lede={t("first_run.name.lede")} />
+ <input
+ autoFocus
+ value={value}
+ onChange={(event) => setTyped(event.target.value)}
+ placeholder={t("first_run.name.placeholder")}
+ aria-label={t("first_run.name.label")}
+ maxLength={40}
+ spellCheck={false}
+ autoComplete="off"
+ data-testid="setup-name-input"
+ className="mt-5 h-12 w-full rounded-lg border border-border-strong bg-input px-4 text-lg text-foreground placeholder:text-foreground-faint focus-visible:border-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ />
+ <div className="mt-3 flex flex-wrap items-center gap-1.5">
+ <span className="mr-1 text-xs text-muted-foreground">{t("first_run.name.ideas")}</span>
+ {NAME_IDEAS.map((idea) => (
+ <button
+ key={idea}
+ type="button"
+ onClick={() => setTyped(idea)}
+ className={cn(
+ "rounded-full border px-2.5 py-0.5 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ name === idea
+ ? "border-accent bg-accent-soft text-foreground"
+ : "border-border text-muted-foreground hover:bg-secondary hover:text-foreground",
+ )}
+ >
+ {idea}
+ </button>
+ ))}
+ </div>
+ <p
+ className={cn(
+ "mt-5 flex items-center gap-2 rounded-lg border border-border bg-popover px-3.5 py-2.5 text-sm transition-opacity",
+ name ? "opacity-100" : "opacity-50",
+ )}
+ data-testid="setup-name-preview"
+ >
+ <Mic aria-hidden className="h-4 w-4 shrink-0 text-accent" />
+ <span className="text-muted-foreground">
+ {name ? fill(t("first_run.name.preview"), { phrase: `Hey ${name}` }) : t("first_run.name.preview_empty")}
+ </span>
+ </p>
+ {error && <p className="mt-2 text-xs text-destructive">{error}</p>}
+ <StepFooter
+ left={
+ onSkipAll && (
+ <QuietAction onClick={onSkipAll} testId="setup-skip-all" className="text-sm">
+ {t("first_run.name.skip_all")}
+ </QuietAction>
+ )
+ }
+ >
+ <Button type="submit" disabled={!name || saving} data-testid="onboarding-primary">
+ {saving && <Loader2 aria-hidden className="animate-spin" />}
+ {t("first_run.continue")}
+ <ArrowRight aria-hidden />
+ </Button>
+ </StepFooter>
+ </form>
+ );
+}
+
+function ConnectStepFrame({ onBack, onContinue }: { onBack: () => void; onContinue: (anything: boolean) => void }) {
+ const t = useT();
+ const [anything, setAnything] = useState(false);
+ const onConnectedChange = useCallback((any: boolean) => setAnything(any), []);
+ return (
+ <>
+ <StepHead title={t("first_run.connect.title")} lede={t("first_run.connect.lede")} />
+ <div className="mt-5">
+ <ConnectStep onConnectedChange={onConnectedChange} />
+ </div>
+ {!anything && (
+ <p className="mt-4 text-xs leading-relaxed text-muted-foreground" data-testid="setup-connect-nothing">
+ {t("first_run.connect.nothing_yet")}
+ </p>
+ )}
+ <StepFooter left={<BackAction onClick={onBack} />}>
+ <Button
+ variant={anything ? "default" : "outline"}
+ onClick={() => onContinue(anything)}
+ data-testid="onboarding-primary"
+ >
+ {anything ? t("first_run.continue") : t("first_run.connect.later")}
+ <ArrowRight aria-hidden />
+ </Button>
+ </StepFooter>
+ </>
+ );
+}
+
+function SettingRow({
+ icon,
+ title,
+ detail,
+ control,
+ testId,
+}: {
+ icon: ReactNode;
+ title: string;
+ detail: string;
+ control: ReactNode;
+ testId?: string;
+}) {
+ return (
+ <div className="flex items-center gap-3 rounded-lg border border-border bg-popover px-4 py-3" data-testid={testId}>
+ <span className="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-secondary text-muted-foreground">
+ {icon}
+ </span>
+ <div className="min-w-0 flex-1">
+ <p className="text-sm font-medium text-foreground">{title}</p>
+ <p className="mt-0.5 text-xs leading-relaxed text-muted-foreground">{detail}</p>
+ </div>
+ <div className="shrink-0">{control}</div>
+ </div>
+ );
+}
+
+/**
+ * How the user talks to the assistant: the wake word heard all the time (or
+ * the Call shortcut), and the app starting at login so it is there to hear.
+ */
+function VoiceStep({ preview, onBack, onFinish }: { preview: boolean; onBack: () => void; onFinish: () => void }) {
+ const t = useT();
+ const { config, setWakeActivation } = useWakeWord();
+ const autostart = useAutostart();
+ const assistantName = useEventStore((s) => s.assistantName);
+ const [listening, setListening] = useState<boolean | null>(null);
+ const [wakeNote, setWakeNote] = useState<string | null>(null);
+ const [startAtLogin, setStartAtLogin] = useState<boolean | null>(null);
+ const phrase = config?.phrase.trim() ?? "";
+ const name = deriveAssistantName(phrase) || assistantName;
+ const on = listening ?? Boolean(config?.enabled && phrase);
+ const loginOn = startAtLogin ?? Boolean(autostart.config?.enabled);
+
+ useEffect(() => {
+ if (config) setListening(null);
+ }, [config]);
+
+ async function toggleListening(next: boolean) {
+ setListening(next);
+ setWakeNote(null);
+ try {
+ const result = await setWakeActivation(next);
+ if (!result.persisted && result.message) setWakeNote(result.message);
+ else if (result.restart_required) setWakeNote(t("first_run.voice.after_restart"));
+ } catch (e) {
+ setListening(!next);
+ setWakeNote((e as Error).message);
+ }
+ }
+
+ async function toggleLogin(next: boolean) {
+ setStartAtLogin(next);
+ try {
+ await autostart.setEnabled(next);
+ } catch {
+ setStartAtLogin(!next);
+ }
+ }
+
+ return (
+ <>
+ <StepHead title={t("first_run.voice.title")} lede={t("first_run.voice.lede")} />
+ <div className="mt-5 space-y-1.5">
+ <SettingRow
+ testId="setup-voice-wake"
+ icon={<Mic aria-hidden className="h-4 w-4" />}
+ title={phrase ? `Hey ${name}` : t("first_run.voice.no_word")}
+ detail={on ? t("first_run.voice.wake_on") : t("first_run.voice.wake_off")}
+ control={
+ <Switch
+ checked={on}
+ disabled={!phrase}
+ onCheckedChange={(v) => void toggleListening(v)}
+ aria-label={t("first_run.voice.wake_switch")}
+ data-testid="setup-voice-wake-switch"
+ />
+ }
+ />
+ {wakeNote && <p className="px-1 text-xs text-muted-foreground">{wakeNote}</p>}
+ {autostart.config?.supported && (
+ <SettingRow
+ testId="setup-voice-login"
+ icon={<Power aria-hidden className="h-4 w-4" />}
+ title={t("first_run.voice.login_title")}
+ detail={t("first_run.voice.login_detail")}
+ control={
+ <Switch
+ checked={loginOn}
+ onCheckedChange={(v) => void toggleLogin(v)}
+ aria-label={t("first_run.voice.login_title")}
+ data-testid="onboarding-autostart"
+ />
+ }
+ />
+ )}
+ </div>
+ <p className="mt-4 text-xs leading-relaxed text-muted-foreground">
+ {preview ? t("first_run.voice.preview_note") : t("first_run.voice.restart_note")}
+ </p>
+ <StepFooter left={<BackAction onClick={onBack} />}>
+ <Button onClick={onFinish} data-testid="onboarding-start">
+ {t("first_run.voice.start")}
+ <ArrowRight aria-hidden />
+ </Button>
+ </StepFooter>
+ </>
+ );
+}
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
index 8620ddb985..e153e841ec 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.test.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.test.ts
@@ -1,8 +1,8 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
-import { HOW_BEATS } from "./HowWalk";
-import { resumeStep, SETUP_STEP_IDS, SETUP_STEPS, stepsFor } from "./setupSteps";
+import en from "@/i18n/locales/onboarding/en.json";
+import { resumeStep, SETUP_STEP_IDS, WALK_STOPS, walkStopsFor, WIZARD_STEP_IDS } from "./setupSteps";
const SRC = join(__dirname, "..", "..", "..");
@@ -24,68 +24,68 @@ describe("setup steps", () => {
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("show three steps in the window, then the walk", () => {
+ expect([...WIZARD_STEP_IDS]).toEqual(["name", "connect", "voice"]);
+ expect(SETUP_STEP_IDS[SETUP_STEP_IDS.length - 1]).toBe("tour");
});
+});
- 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");
- });
+describe("the walk", () => {
+ const stops = (en as { first_run: { tour: { stops: Record<string, string>; labels: Record<string, string> } } })
+ .first_run.tour;
- 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;
- // A literal hook, or one handed to a component as its `tourId`.
- const literal = code.includes(`data-tour="${anchor}"`) || code.includes(`tourId="${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("has unique stops, each with a line and a label in the locale", () => {
+ const ids = WALK_STOPS.map((s) => s.id);
+ expect(new Set(ids).size).toBe(ids.length);
+ for (const id of ids) {
+ expect(stops.stops[id], id).toBeTruthy();
+ expect(stops.labels[id], id).toBeTruthy();
}
});
- it("let the pet's walk point only at anchors the app actually sets", () => {
+ it("explains every section the user meets", () => {
+ const ids = WALK_STOPS.map((s) => s.id);
+ for (const id of ["chat", "voice", "agents", "ide", "plugins", "wake"]) expect(ids).toContain(id);
+ });
+
+ it("has six to seven stops on Windows and Linux, one more on macOS", () => {
+ expect(walkStopsFor("win32").length).toBe(7);
+ expect(walkStopsFor("linux").length).toBe(7);
+ expect(walkStopsFor(null).map((s) => s.id)).not.toContain("permissions");
+ expect(walkStopsFor("darwin").map((s) => s.id)).toContain("permissions");
+ });
+
+ it("points 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 beat of HOW_BEATS) {
- if (!beat.anchor) continue;
- const literal = code.includes(`data-tour="${beat.anchor}"`);
- const nav = beat.anchor.startsWith("nav-") && code.includes("data-tour={`nav-${item.id}`}");
- expect(literal || nav, beat.anchor).toBe(true);
+ for (const stop of WALK_STOPS) {
+ if (!stop.anchor) continue;
+ const literal = code.includes(`data-tour="${stop.anchor}"`);
+ // Sidebar rows and Settings groups get theirs from a template.
+ const nav = stop.anchor.startsWith("nav-") && code.includes("data-tour={`nav-${item.id}`}");
+ const group = stop.anchor.startsWith("settings-") && code.includes("data-tour={`settings-${section.id}`}");
+ expect(literal || nav || group, stop.anchor).toBe(true);
}
});
- it("open the app's own place for each job", () => {
- expect(SETUP_STEPS.keys.section).toBe("apikeys");
- expect(SETUP_STEPS.subscriptions.section).toBe("apikeys");
- expect(SETUP_STEPS.subscriptions.apiKeysTab).toBe("subagents");
- expect(SETUP_STEPS.voice.section).toBe("settings");
- expect(SETUP_STEPS.voice.anchor).toBe("settings-wake-word");
- expect(SETUP_STEPS.welcome.anchor).toBeUndefined();
+ it("ends on the chat", () => {
+ const last = WALK_STOPS[WALK_STOPS.length - 1];
+ expect(last.id).toBe("done");
+ expect(last.section).toBe("chats");
});
});
describe("resumeStep", () => {
- const steps = stepsFor("win32");
-
it("returns to the saved step", () => {
- expect(resumeStep(steps, "voice")).toBe("voice");
- expect(resumeStep(steps, "subscriptions")).toBe("subscriptions");
+ expect(resumeStep("connect")).toBe("connect");
+ expect(resumeStep("tour")).toBe("tour");
});
- it("starts at the welcome for a fresh run or an unknown, old step id", () => {
- expect(resumeStep(steps, null)).toBe("welcome");
- expect(resumeStep(steps, "api-keys")).toBe("welcome");
+ it("starts with the name for a fresh run or an unknown, old step id", () => {
+ expect(resumeStep(null)).toBe("name");
+ expect(resumeStep("keys")).toBe("name");
+ expect(resumeStep("welcome")).toBe("name");
});
});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts
index 0e454de337..216b821005 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/setupSteps.ts
@@ -1,85 +1,89 @@
/**
- * 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 and its Agents tab, the wake-word
- * group in Settings) and
- * points at it, so what the user learns on day one is where things live.
+ * First-run setup as data, in two acts.
+ *
+ * 1. The setup window: one centred dialog with three steps — the
+ * assistant's name (which is also its wake word), connecting an AI
+ * (subscriptions and an API key), and how the user talks to it.
+ * 2. The walk: the user's pet walks the REAL app and explains each section
+ * in place — chat, voice, agents, the Agentic IDE, plugins and where the
+ * wake word lives. The walk is one persisted step (`tour`); its stops
+ * resume from session storage.
*/
+import type { PetState } from "@/lib/petStates";
import type { SectionId } from "@/store/events";
+import type { HomeSurface } from "@/lib/homeSurface";
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", "how", "keys", "subscriptions", "permissions", "voice", "ready"] as const;
+export const SETUP_STEP_IDS = ["name", "connect", "voice", "tour"] 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. */
+/** The steps shown inside the setup window, in order. */
+export const WIZARD_STEP_IDS = ["name", "connect", "voice"] as const;
+
+export type WizardStepId = (typeof WIZARD_STEP_IDS)[number];
+
+export function isWizardStep(id: SetupStepId): id is WizardStepId {
+ return (WIZARD_STEP_IDS as readonly string[]).includes(id);
+}
+
+/**
+ * Where a resumed setup starts. The backend remembers the last step, so a
+ * window reload lands where the user was; a fresh start (or an unknown, older
+ * step id) begins with the name.
+ */
+export function resumeStep(saved: string | null): SetupStepId {
+ const hit = SETUP_STEP_IDS.find((id) => id === saved);
+ return hit ?? "name";
+}
+
+export interface WalkStop {
+ /** Also the i18n key: `first_run.tour.stops.<id>`. */
+ id: string;
+ /** The real element the pet stands next to; omitted = said from the middle. */
anchor?: string;
- /** The API Keys tab to show; omitted = the page's default tab. */
- apiKeysTab?: string;
- /** Scroll the anchor to the top of its scrolling page first (a Settings group). */
+ /** Where the app goes first, so the anchor is on screen. */
+ section?: SectionId;
+ /** The home surface the chats section shows (the composer or the voice bar). */
+ surface?: HomeSurface;
+ /** Scroll the anchor to the top of its scrolling page (a Settings group). */
scrollTo?: boolean;
+ /** Only on this platform (`process.platform` names, from the backend). */
+ platform?: string;
placement: TourPlacement;
- /** Card width in px — the consent and the review need more room. */
- width: number;
+ /** How the pet looks once the line is said. */
+ pet: PetState;
}
-export const SETUP_STEPS: Record<SetupStepId, SetupStep> = {
- welcome: { id: "welcome", placement: "inside", width: 420 },
- // The pet's walk through the real app (HowWalk) places itself beat by beat.
- how: { id: "how", placement: "inside", width: 500 },
- keys: { id: "keys", section: "apikeys", anchor: "apikeys-page", placement: "left", width: 320 },
- subscriptions: {
- id: "subscriptions",
- section: "apikeys",
- apiKeysTab: "subagents",
- // The subscription rows themselves (Connect buttons), scrolled into view —
- // the tab opens on model settings further up.
- anchor: "apikeys-subscriptions",
- scrollTo: true,
- placement: "left",
- width: 340,
- },
- voice: {
- id: "voice",
- section: "settings",
- anchor: "settings-wake-word",
- scrollTo: true,
- placement: "left",
- width: 320,
- },
- permissions: {
+/**
+ * The walk's stops. It only navigates — it never presses a control that could
+ * start work or cost money (the voice bar opens a paid call, so the walk
+ * points at it and leaves the click to the user). The Agentic IDE and plugins
+ * are shown at their sidebar entries: opening the IDE starts its terminals.
+ */
+export const WALK_STOPS: readonly WalkStop[] = [
+ { id: "chat", anchor: "chat-composer", section: "chats", surface: "chat", placement: "above", pet: "talking" },
+ { id: "voice", anchor: "voice-bar", section: "chats", surface: "voice", placement: "below", pet: "listening" },
+ { id: "agents", anchor: "nav-agents", section: "chats", placement: "right", pet: "thinking" },
+ { id: "ide", anchor: "nav-agentic-ide", placement: "right", pet: "thinking" },
+ { id: "plugins", anchor: "nav-plugins", placement: "right", pet: "thinking" },
+ { id: "wake", anchor: "settings-wake-word", section: "settings", scrollTo: true, placement: "left", pet: "listening" },
+ // macOS asks for permissions one ability at a time; elsewhere Settings is
+ // simply where they could be granted later.
+ {
id: "permissions",
- section: "settings",
anchor: "settings-permissions",
+ section: "settings",
scrollTo: true,
+ platform: "darwin",
placement: "left",
- width: 320,
+ pet: "idle",
},
- ready: { id: "ready", section: "chats", placement: "inside", width: 400 },
-};
+ { id: "done", section: "chats", surface: "chat", placement: "inside", pet: "success" },
+];
-/**
- * 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; a fresh start (or an unknown, old
- * step id) begins at the welcome.
- */
-export function resumeStep(steps: readonly SetupStepId[], saved: string | null): SetupStepId {
- const hit = steps.find((id) => id === saved);
- return hit ?? "welcome";
+/** The stops this machine walks. A failed platform probe drops platform-only stops. */
+export function walkStopsFor(platform: string | null): WalkStop[] {
+ return WALK_STOPS.filter((stop) => !stop.platform || stop.platform === platform);
}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/setup/usePlatform.ts b/jarvis/ui/web/frontend/src/components/onboarding/setup/usePlatform.ts
new file mode 100644
index 0000000000..41751cd00c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/onboarding/setup/usePlatform.ts
@@ -0,0 +1,27 @@
+import { useEffect, useState } from "react";
+
+/**
+ * The backend's platform name (`darwin`, `win32`, `linux`), read once from
+ * the permissions probe. `null` while loading or when the probe fails — the
+ * callers then leave out anything platform-only.
+ */
+export function usePlatform(): string | null {
+ const [platform, setPlatform] = useState<string | null>(null);
+ 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 platform-only step.
+ }
+ })();
+ return () => {
+ cancelled = true;
+ };
+ }, []);
+ return platform;
+}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/GuidedTour.tsx b/jarvis/ui/web/frontend/src/components/onboarding/tour/GuidedTour.tsx
deleted file mode 100644
index 20bc96d2a8..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/tour/GuidedTour.tsx
+++ /dev/null
@@ -1,246 +0,0 @@
-import { useCallback, useEffect, useRef, useState } from "react";
-import { fill, useLocaleChunk, useT } from "@/i18n";
-import { useEventStore } from "@/store/events";
-import { useHomeStore } from "@/store/home";
-import type { HomeSurface } from "@/lib/homeSurface";
-import { cn } from "@/lib/utils";
-import { FOCUS_RING } from "@/components/agentic/controls";
-import { PetSays } from "../pet/GuidePet";
-import { QuietAction } from "../ui";
-import { Spotlight } from "./Spotlight";
-import { nextStepIndex, TOUR_STEPS, type Rect, type TourEffect } from "./tourSteps";
-
-/** How long a step waits for its element to appear (a section may still be loading). */
-const FIND_TIMEOUT_MS = 2500;
-const FIND_POLL_MS = 100;
-/** Re-measure while shown — cheap, and it catches layout shifts no observer reports. */
-const TRACK_MS = 400;
-const STEP_KEY = "jarvis.tour.step";
-
-function findAnchor(anchor: string): HTMLElement | null {
- const nodes = document.querySelectorAll<HTMLElement>(`[data-tour="${anchor}"]`);
- for (const el of nodes) {
- const r = el.getBoundingClientRect();
- if (r.width > 0 && r.height > 0) return el;
- }
- return null;
-}
-
-function rectOf(el: HTMLElement): Rect {
- const r = el.getBoundingClientRect();
- return { x: r.left, y: r.top, w: r.width, h: r.height };
-}
-
-function sameRect(a: Rect | null, b: Rect | null): boolean {
- if (!a || !b) return a === b;
- return (
- Math.abs(a.x - b.x) < 0.5 &&
- Math.abs(a.y - b.y) < 0.5 &&
- Math.abs(a.w - b.w) < 0.5 &&
- Math.abs(a.h - b.h) < 0.5
- );
-}
-
-function readSavedStep(): number {
- try {
- const raw = Number(window.sessionStorage.getItem(STEP_KEY));
- return Number.isInteger(raw) && raw > 0 && raw < TOUR_STEPS.length ? raw : 0;
- } catch {
- return 0;
- }
-}
-
-function saveStep(index: number | null): void {
- try {
- if (index === null) window.sessionStorage.removeItem(STEP_KEY);
- else window.sessionStorage.setItem(STEP_KEY, String(index));
- } catch {
- // Storage may be blocked; the tour then restarts from the top after a reload.
- }
-}
-
-/**
- * The guided tour of the real app, shown once after first-run setup.
- *
- * It walks the actual interface: dims the window, opens a hole over one
- * control at a time, and explains it in a small card with the mascot. Where
- * a step needs another place in the app, the tour navigates there itself —
- * into the agents' world and back — and when it ends it puts the app back on
- * the home screen. It never presses anything that could start work or cost
- * money; clicking the highlighted element yourself simply moves the tour on.
- *
- * Escape or "Skip tour" ends it at any point. Either way the backend records
- * it as seen, so it does not come back on its own.
- */
-export function GuidedTour({ onDone }: { onDone: () => void }) {
- const t = useT();
- const ready = useLocaleChunk("onboarding");
- const [index, setIndex] = useState(readSavedStep);
- const [rect, setRect] = useState<Rect | null>(null);
- const anchorRef = useRef<HTMLElement | null>(null);
- const originalSurface = useRef<HomeSurface>(useHomeStore.getState().surface);
- const doneRef = useRef(false);
- const nextButton = useRef<HTMLButtonElement>(null);
- const step = TOUR_STEPS[index];
-
- const run = useCallback((effect: TourEffect | undefined) => {
- if (!effect) return;
- const nav = useEventStore.getState();
- if (effect === "home-voice") {
- if (nav.activeSection !== "chats") nav.setActiveSection("chats");
- if (useHomeStore.getState().surface !== "voice") useHomeStore.getState().setSurface("voice");
- } else if (effect === "open-agents") {
- if (nav.activeSection !== "agents") nav.setActiveSection("agents");
- } else if (effect === "back-home") {
- if (nav.activeSection !== "chats") nav.setActiveSection("chats");
- }
- }, []);
-
- const finish = useCallback(() => {
- if (doneRef.current) return;
- doneRef.current = true;
- saveStep(null);
- // Leave the app where a new user expects it: home, on the surface they had.
- const nav = useEventStore.getState();
- if (nav.activeSection !== "chats") nav.setActiveSection("chats");
- if (useHomeStore.getState().surface !== originalSurface.current) {
- useHomeStore.getState().setSurface(originalSurface.current);
- }
- onDone();
- }, [onDone]);
-
- const advance = useCallback(() => {
- run(TOUR_STEPS[index]?.onExit);
- const target = nextStepIndex(index);
- if (target === null) {
- finish();
- return;
- }
- saveStep(target);
- setIndex(target);
- }, [index, run, finish]);
-
- // Enter the step: move the app if the step asks, then wait for its element.
- useEffect(() => {
- if (!ready || !step) return;
- run(step.onEnter);
- anchorRef.current = null;
- let cancelled = false;
- let timer = 0;
- const started = performance.now();
- const poll = () => {
- if (cancelled) return;
- const el = findAnchor(step.anchor);
- if (el) {
- anchorRef.current = el;
- setRect(rectOf(el));
- return;
- }
- if (performance.now() - started < FIND_TIMEOUT_MS) {
- timer = window.setTimeout(poll, FIND_POLL_MS);
- return;
- }
- // The element never showed: a step that is optional goes, any other
- // step explains itself from the middle of the window.
- if (step.skipIfMissing) advance();
- else setRect(null);
- };
- timer = window.setTimeout(poll, 0);
- return () => {
- cancelled = true;
- window.clearTimeout(timer);
- };
- // `advance` changes with the index, which this effect already follows.
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [index, ready]);
-
- // Follow the element while it is shown: its own size changes, the window,
- // any scrolling container, and a slow safety net for layout shifts.
- useEffect(() => {
- if (!ready) return;
- let frame = 0;
- const measure = () => {
- cancelAnimationFrame(frame);
- frame = requestAnimationFrame(() => {
- const el = anchorRef.current;
- if (!el || !el.isConnected) {
- const again = step ? findAnchor(step.anchor) : null;
- if (!again) return;
- anchorRef.current = again;
- }
- const next = rectOf(anchorRef.current!);
- setRect((prev) => (sameRect(prev, next) ? prev : next));
- });
- };
- const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : null;
- if (anchorRef.current && ro) ro.observe(anchorRef.current);
- window.addEventListener("resize", measure);
- window.addEventListener("scroll", measure, true);
- const interval = window.setInterval(measure, TRACK_MS);
- return () => {
- cancelAnimationFrame(frame);
- ro?.disconnect();
- window.removeEventListener("resize", measure);
- window.removeEventListener("scroll", measure, true);
- window.clearInterval(interval);
- };
- }, [ready, rect === null, step]);
-
- // Clicking the highlighted element counts as Next; Escape ends the tour.
- useEffect(() => {
- if (!step) return;
- const onClick = (event: MouseEvent) => {
- const target = event.target as Element | null;
- if (target?.closest?.(`[data-tour="${step.anchor}"]`)) advance();
- };
- const onKey = (event: KeyboardEvent) => {
- if (event.key === "Escape") finish();
- };
- document.addEventListener("click", onClick, true);
- window.addEventListener("keydown", onKey);
- return () => {
- document.removeEventListener("click", onClick, true);
- window.removeEventListener("keydown", onKey);
- };
- }, [step, advance, finish]);
-
- useEffect(() => {
- if (!ready) return;
- const timer = window.setTimeout(() => nextButton.current?.focus({ preventScroll: true }), 360);
- return () => window.clearTimeout(timer);
- }, [index, ready]);
-
- if (!ready || !step) return null;
- const last = nextStepIndex(index) === null;
-
- return (
- <Spotlight rect={rect} placement={step.placement} cardWidth={460}>
- <div role="dialog" aria-live="polite" aria-label={t("app_tour.label")} data-testid="tour-card" data-step={step.id}>
- <PetSays key={step.id} text={t(`app_tour.steps.${step.id}`)} state={step.pet} px={96} testId="tour-text">
- <div className="mt-3 flex items-center gap-3">
- <button
- ref={nextButton}
- type="button"
- onClick={advance}
- data-testid="tour-next"
- className={cn(
- "h-8 rounded-lg bg-accent px-3.5 text-sm font-medium text-accent-foreground transition-opacity hover:opacity-90",
- FOCUS_RING,
- )}
- >
- {last ? t("app_tour.finish") : t("app_tour.next")}
- </button>
- <span className="text-xs text-muted-foreground">
- {fill(t("app_tour.step_of"), { current: index + 1, total: TOUR_STEPS.length })}
- </span>
- {!last && (
- <QuietAction onClick={finish} className="ml-auto text-xs" testId="tour-skip">
- {t("app_tour.skip")}
- </QuietAction>
- )}
- </div>
- </PetSays>
- </div>
- </Spotlight>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.ts b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.ts
index 11ec53a5ca..64fb83eeda 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.test.ts
@@ -1,55 +1,5 @@
-import { readdirSync, readFileSync, statSync } from "node:fs";
-import { join } from "node:path";
import { describe, expect, it } from "vitest";
-import en from "@/i18n/locales/onboarding/en.json";
-import { cutout, fitToView, padded, placeCard, TOUR_STEPS } from "./tourSteps";
-
-const SRC = join(__dirname, "..", "..", "..");
-
-function sources(dir: string): string[] {
- const out: string[] = [];
- for (const name of readdirSync(dir)) {
- const full = join(dir, name);
- if (statSync(full).isDirectory()) out.push(...sources(full));
- else if (/\.tsx?$/.test(name) && !/\.test\.tsx?$/.test(name)) out.push(full);
- }
- return out;
-}
-
-describe("tour steps", () => {
- it("have unique ids and a text in the locale", () => {
- const ids = TOUR_STEPS.map((s) => s.id);
- expect(new Set(ids).size).toBe(ids.length);
- const texts = (en as { app_tour: { steps: Record<string, string> } }).app_tour.steps;
- for (const id of ids) expect(texts[id], id).toBeTruthy();
- });
-
- it("point only at anchors the app actually sets", () => {
- const code = sources(SRC)
- .filter((f) => !f.includes(`${join("onboarding", "tour")}`))
- .map((f) => readFileSync(f, "utf8"))
- .join("\n");
- for (const step of TOUR_STEPS) {
- const literal = code.includes(`data-tour="${step.anchor}"`);
- // Sidebar rows get theirs from a template: data-tour={`nav-${item.id}`}.
- const templated = step.anchor.startsWith("nav-") && code.includes("data-tour={`nav-${item.id}`}");
- expect(literal || templated, step.anchor).toBe(true);
- }
- });
-
- it("never press a control — every effect is navigation", () => {
- for (const step of TOUR_STEPS) {
- for (const effect of [step.onEnter, step.onExit]) {
- if (effect) expect(["home-voice", "open-agents", "back-home"]).toContain(effect);
- }
- }
- });
-
- it("ends where it started, on the voice bar", () => {
- expect(TOUR_STEPS[0].anchor).toBe("voice-bar");
- expect(TOUR_STEPS[TOUR_STEPS.length - 1].anchor).toBe("voice-bar");
- });
-});
+import { cutout, fitToView, padded, placeCard } from "./tourSteps";
describe("cutout", () => {
it("keeps the same number of points for any hole, so it can animate", () => {
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 351c868fa7..bdebbd7f38 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/tour/tourSteps.ts
@@ -1,58 +1,14 @@
/**
- * The guided tour of the real app, as data.
+ * Geometry for the guide's spotlight: the dim with a hole over one real
+ * element, the ring around it, and where the speech bubble or card sits.
*
- * Each step points at one element that carries `data-tour="<anchor>"` — a
+ * Every element the guide points at carries `data-tour="<anchor>"` — a
* stable hook set for this purpose, never a CSS class or a test id (tests
- * rename those freely). A step may move the app before it points (`onEnter`)
- * or after the user moves on (`onExit`); the tour only ever NAVIGATES. It
- * never presses a control that could start something — the voice bar, for
- * one, opens a paid call, so the tour points at it and leaves the click to
- * the user.
+ * rename those freely).
*/
-import type { PetState } from "@/lib/petStates";
-
-/** 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" | "left" | "below" | "above" | "inside";
-export interface TourStep {
- /** Also the i18n key: `app_tour.steps.<id>`. */
- id: string;
- anchor: string;
- placement: TourPlacement;
- onEnter?: TourEffect;
- onExit?: TourEffect;
- /** Drop the step when its anchor never shows (e.g. a section this build lacks). */
- skipIfMissing?: boolean;
- /** How the guiding pet looks on this step. */
- pet: PetState;
-}
-
-// The pet's "how it works" walk in setup already explained tools, agents,
-// the coding workspace and Artifacts; the tour after the restart shows the
-// everyday places around them and does not repeat it.
-export const TOUR_STEPS: readonly TourStep[] = [
- { id: "voice", anchor: "voice-bar", placement: "below", onEnter: "home-voice", pet: "talking" },
- { id: "new_chat", anchor: "new-chat", placement: "right", pet: "idle" },
- {
- id: "agents_world",
- anchor: "agents-page",
- placement: "inside",
- onEnter: "open-agents",
- onExit: "back-home",
- skipIfMissing: true,
- pet: "thinking",
- },
- { id: "voice_hub", anchor: "nav-dictation", placement: "right", onEnter: "back-home", pet: "listening" },
- { id: "settings", anchor: "settings", placement: "right", pet: "thinking" },
- { id: "done", anchor: "voice-bar", placement: "below", onEnter: "home-voice", pet: "success" },
-];
-
-export function nextStepIndex(index: number): number | null {
- return index + 1 < TOUR_STEPS.length ? index + 1 : null;
-}
-
export interface Rect {
x: number;
y: number;
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts b/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts
index 1d9aeb3215..c45252b98a 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts
+++ b/jarvis/ui/web/frontend/src/components/onboarding/tourEvents.ts
@@ -4,18 +4,15 @@
* not import the gate itself — tests mock the gate wholesale.
*/
-/** Window event that asks the onboarding gate to replay the app tour. */
+/** Window event that asks the onboarding gate to show the walk through the app alone. */
export const TOUR_START_EVENT = "jarvis:tour-start";
/**
- * Window event that asks the onboarding gate to replay setup (API keys, agent
- * subscriptions, wake word) as a preview, followed by the app tour.
+ * Window event that asks the onboarding gate to replay setup (name, AI
+ * connections, voice) as a preview, followed by the walk through the app.
*/
export const SETUP_REPLAY_EVENT = "jarvis:setup-replay";
-/** Window event that (re)starts the first-steps guide from its first quest. */
-export const FIRST_STEPS_START_EVENT = "jarvis:first-steps-start";
-
/** Marks the guide's dim and card, so dialogs can tell its clicks apart. */
export const TOUR_LAYER_ATTR = "data-tour-layer";
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 3e59669aca..cb1c482700 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/de.json
@@ -3,203 +3,100 @@
"back": "Zurück",
"continue": "Weiter",
"step_of": "{current} von {total}",
- "welcome": {
- "skip_all": "Einrichtung überspringen, ich kenne mich aus",
- "title": "Willkommen",
- "lede": "Zuerst ein kurzer Blick darauf, was {name} ist und wie es funktioniert. Danach richten wir es direkt hier in der App ein: einen API-Schlüssel, ein Abo für deine Agents und dein Weckwort.",
- "language": "Sprache",
- "lang_en": "English",
- "lang_de": "Deutsch",
- "lang_es": "Español",
- "start": "Los geht's"
+ "window": {
+ "title": "{name} einrichten",
+ "progress": "Fortschritt der Einrichtung",
+ "language": "Sprache"
},
- "how": {
- "title": "So funktioniert {name}",
- "lede": "Dein Pet führt dich durch die App und erklärt, wie {name} funktioniert.",
- "next": "Weiter",
- "prev": "Zurück",
- "skip": "Überspringen",
- "finish": "Jetzt einrichten",
- "beat_of": "Erklärung {current} von {total}",
- "beats": {
- "hello": "Hi, ich bin {pet}! Bevor wir etwas einrichten, zeig ich dir, wie {name} funktioniert. Geht schnell, und du siehst dabei die echte App.",
- "talk": "Hier fängt alles an. Du sprichst mit einem einzigen Assistenten: {name}. Tipp hier oder drück den runden Knopf und sprich einfach. Du wählst nie selbst ein Werkzeug oder Modell; {name} entscheidet, was gebraucht wird.",
- "brain": "Zum Denken braucht {name} ein Gehirn: ein KI-Modell von OpenAI, Google, Anthropic oder einem anderen Anbieter, oder eins auf deinem eigenen Computer. Ein Schlüssel reicht, den fügen wir gleich zusammen hinzu.",
- "tools": "Dann braucht {name} Hände. Es kann deinen Computer und Browser selbst bedienen, dazu jede App, die du hier verbindest: Mail, Kalender, Notizen, Smart Home. Wenn du etwas willst, sucht es sich das passende Werkzeug selbst.",
- "agents": "Große Aufgaben wie eine Recherche, ein Bericht oder eine Webseite gehen an Agents. Das ist das Team von {name}: {name} gibt ihnen die Arbeit, redet weiter mit dir, und ein Prüfer kontrolliert das Ergebnis, bevor es bei dir ankommt.",
- "ide": "Hier arbeiten Coding-Agents wie Claude Code und Codex, in echten Terminals an deinen eigenen Projekten. Tipp ihnen direkt, oder lass {name} sie per Stimme steuern.",
- "results": "Was dabei herauskommt, also Seiten, Berichte oder Bilder, landet in Artifacts. Kurze Antworten kommen direkt im Chat oder laut gesprochen zurück.",
- "memory": "{name} merkt sich auch Dinge. Was du erzählst, landet in seinen Notizen und deinem Profil, gespeichert auf deinem Computer. So musst du dich nie wiederholen.",
- "safety": "Und du behältst die Kontrolle. Harmloses passiert einfach. Alles, was etwas sendet, löscht oder Geld kostet, wartet zuerst auf dein Ja.",
- "done": "Das ist die ganze Idee: Du sprichst, {name} denkt nach, nutzt Werkzeuge, holt Agents dazu und bringt dir das Ergebnis. Später nicht weiter? Frag einfach {name}. Jetzt geben wir ihm ein Gehirn."
- }
- },
- "keys": {
- "next_hint": "Als Nächstes: Verbinde die Abos, die du schon bezahlst, damit deine Agents arbeiten können.",
- "no_key": "Noch kein Schlüssel? Ein kostenloses lokales Modell geht auch (Einstellungen → Lokale Modelle), oder überspring es und füg später einen hinzu. Ganz ohne bleiben Chat und Stimme aus.",
- "live_missing": "Der Chat läuft. Für die Live-Stimme brauchst du einen OpenAI- oder Gemini-Schlüssel; bis dahin spricht {name} auf die klassische Art, etwas langsamer.",
- "live_ready": "Die Live-Stimme ist an: Du sprichst, und {name} antwortet sofort.",
- "title": "Einen API-Schlüssel eintragen",
- "lede": "Das ist die Seite API-Schlüssel. Füg einen Schlüssel in eine Anbieter-Karte ein und speichere ihn; mehr braucht {name} nicht, um zu denken und zu sprechen. Ein OpenAI- (ChatGPT) oder Google-Gemini-Schlüssel bringt zusätzlich die Live-Stimme.",
- "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"
+ "name": {
+ "pill": "Name",
+ "title": "Hey! Wie möchtest du mich nennen?",
+ "lede": "Such dir einen Namen aus. Er ist auch mein Weckwort: Sag ihn laut, und ich höre zu. Du kannst ihn jederzeit in den Einstellungen ändern.",
+ "label": "Name des Assistenten",
+ "placeholder": "Namen eingeben…",
+ "ideas": "Ideen:",
+ "preview": "Du weckst mich mit „{phrase}“.",
+ "preview_empty": "Gib einen Namen ein, dann siehst du, wie du mich weckst.",
+ "skip_all": "Einrichtung überspringen, ich kenne mich aus"
},
- "subscriptions": {
- "title": "Verbinde ein Abo für deine Agents",
- "lede": "Das ist der Tab Agents. Agents laufen am besten mit einem Abo, das du schon bezahlst; wir empfehlen Claude (Pro oder Max) oder ChatGPT (Codex). Klick in seiner Zeile auf Verbinden, dein Browser öffnet sich einmal.",
- "waiting": "Noch kein Abo verbunden…",
- "connected": "Verbunden: {names}.",
- "why": "Ein Abo ist ein fester Monatspreis. Ohne Abo nutzen die Agents deinen API-Schlüssel, und jeder Auftrag wird einzeln abgerechnet.",
- "later": "Ich verbinde später eins"
- },
- "permissions": {
- "title": "Zugriff auf diesem Mac erlauben",
- "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."
+ "connect": {
+ "pill": "Verbinden",
+ "title": "Verbinde deine KI",
+ "lede": "Melde dich mit einem Abo an, das du schon bezahlst – dann arbeiten deine Agents zum Festpreis. Oder füge einen API-Schlüssel hinzu: Ein Schlüssel reicht, damit {name} denken und sprechen kann.",
+ "subscriptions": "Abos",
+ "subscriptions_why": "Ein Abo ist ein fester Monatspreis. Dein Browser öffnet sich einmal zur Anmeldung, und nichts wird pro Nutzung abgerechnet.",
+ "or_key": "Oder ein API-Schlüssel",
+ "connect": "Verbinden",
+ "ready": "Bereit",
+ "checking": "Wird geprüft…",
+ "waiting": "Warte…",
+ "signed_in": "Angemeldet.",
+ "signed_in_as": "Angemeldet als {account}.",
+ "finish_in_browser": "Schließ die Anmeldung in deinem Browser ab.",
+ "not_installed": "Das Programm dafür ist noch nicht installiert.",
+ "install_first": "Installiere es zuerst: Führe das in einem Terminal aus und prüfe dann erneut.",
+ "check_again": "Erneut prüfen",
+ "copy": "Befehl kopieren",
+ "key_title": "API-Schlüssel",
+ "key_hint": "Bezahlt pro Nutzung. Ein OpenAI- oder Google-Gemini-Schlüssel bringt dir zusätzlich Live-Sprache.",
+ "key_provider": "Anbieter",
+ "key_none": "Gerade ist kein Anbieter verfügbar, der einen Schlüssel annimmt.",
+ "key_present": "{provider}-Schlüssel gespeichert.",
+ "key_connecting": "Alles wird eingeschaltet…",
+ "key_connected": "Verbunden: {provider}.",
+ "key_partial": "Einige Teile wurden nicht umgestellt ({parts}). Du kannst das später auf der Seite API-Schlüssel beheben.",
+ "live_ready": "Live-Sprache ist an: Sprich, und {name} antwortet sofort.",
+ "live_missing": "Der Chat funktioniert. Live-Sprache braucht einen OpenAI- oder Gemini-Schlüssel; bis dahin spricht {name} auf die klassische Art, etwas langsamer.",
+ "key_security": "Schlüssel landen im Schlüsselbund deines Systems und gehen nur an den Anbieter, den du gewählt hast.",
+ "nothing_yet": "Noch nichts verbunden. Ohne Abo oder Schlüssel bleiben Chat und Sprache aus. Du kannst später auf der Seite API-Schlüssel etwas verbinden.",
+ "later": "Erst mal überspringen"
},
"voice": {
- "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.",
- "saved": "„{phrase}“ ist gespeichert. Schalte oben „Aktivierungswort einschalten“ an, damit es immer gehört wird; bis dahin funktioniert das Anruf-Kürzel.",
- "off": "Noch kein Weckwort. Bis dahin funktioniert das Anruf-Kürzel.",
- "later": "Überspringen, ich nutze das Anruf-Kürzel"
- },
- "ready": {
- "title": "Alles bereit",
- "lede": "Das ist eingerichtet. Als Nächstes zeigt dir eine kurze Tour die App.",
- "row_brain": "Gehirn",
- "row_agents": "Agents",
- "row_voice": "Aktivierung",
- "no_subscription": "Kein Abo",
- "no_key": "Noch kein Schlüssel",
- "shortcut": "Anruf-Kürzel",
- "autostart": "Bei der Anmeldung starten",
- "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.",
- "restart_note": "Nach der Tour startet die App einmal neu (etwa zehn Sekunden), damit alles eingeschaltet ist.",
- "start": "Zeig mir die App"
- }
- },
- "app_tour": {
- "label": "App-Tour",
- "next": "Weiter",
- "finish": "Fertig",
- "skip": "Tour überspringen",
- "step_of": "{current} von {total}",
- "replay_title": "Onboarding nochmal machen",
- "replay_body": "Erklärt noch einmal, wie {name} funktioniert, führt dich durch die Einrichtung (API-Schlüssel, Abos für Agents, Weckwort) und danach durch den kurzen Rundgang. Nichts startet neu.",
- "replay": "Wiederholen",
- "steps": {
- "voice": "So sprichst du mit {name}. Klick auf die Leiste, sag dein Weckwort oder drück dein Anruf-Kürzel, dann sprich einfach. Die Welle zeigt, wer gerade redet.",
- "new_chat": "Lieber tippen? Hier startest du einen neuen Chat, als Text oder mit Stimme. Jedes Gespräch landet unter Letzte Chats.",
- "agents_world": "Das ist das Verse, deine Agenten bei der Arbeit. Klick einen an, um mit ihm zu chatten oder ihm eine Aufgabe zu geben. Weiter bringt dich zurück.",
- "voice_hub": "Unter Stimme findest du Diktat in jede App, deine eigene Wortliste und gesprochene Kürzel.",
- "settings": "Hier findest du Einstellungen, API-Schlüssel, Kosten und dein Profil. Die Tour kannst du jederzeit unter Einstellungen → App wiederholen.",
- "done": "Das war der Rundgang. Sprich mit {name}, wann immer du willst, und wenn du mal nicht weiterweißt, frag einfach {name}. Unter Einstellungen → App kannst du das Onboarding nochmal machen."
- }
- },
- "first_steps": {
- "title": "Erste Schritte",
- "progress": "{done}/{total}",
- "collapse": "Minimieren",
- "close": "Schließen",
- "quest_of": "Schritt {current} von {total}",
- "how_label": "So funktioniert's:",
- "waiting": "Gesendet. Schau in den Chat: {name} ist dran.",
- "next": "Nächster Schritt",
- "finish": "Abschließen",
- "skip": "Diesen überspringen",
- "try": {
- "send": "Für mich senden",
- "voice": "Sprachmodus öffnen",
- "open": "Hinbringen"
- },
- "show": {
- "memory": "Notizen öffnen",
- "artifact": "Artifacts öffnen",
- "agent": "In Agents ansehen"
+ "pill": "Stimme",
+ "title": "So sprichst du mit {name}",
+ "lede": "Schreib im Chat oder sprich einfach: Sag dein Weckwort oder drück dein Anruf-Tastenkürzel.",
+ "no_word": "Noch kein Weckwort",
+ "wake_on": "Hört immer auf dein Weckwort. Es wird direkt hier auf diesem Computer erkannt.",
+ "wake_off": "Aus: Drück dein Anruf-Tastenkürzel, um zu sprechen. Schalte es ein, damit dein Weckwort immer gehört wird.",
+ "wake_switch": "Immer auf das Weckwort hören",
+ "after_restart": "Das wird mit dem Neustart am Ende eingeschaltet.",
+ "login_title": "Beim Anmelden starten",
+ "login_detail": "Öffnet {name}, wenn dein Computer startet, damit es dich gleich hören kann.",
+ "preview_note": "Das ist eine Wiederholung, es wird nichts neu gestartet.",
+ "restart_note": "Als Nächstes zeigt dir ein kurzer Rundgang die App. Am Ende startet die App einmal neu (etwa zehn Sekunden), um alles einzuschalten.",
+ "start": "Zeig mir alles"
},
- "replay_title": "Erste Schritte mit {name}",
- "replay": "Starten",
- "replay_body": "Zehn kleine, echte Dinge zum Ausprobieren mit {name}: sprechen, Werkzeuge nutzen, sich etwas merken, etwas bauen, an Agents abgeben. Jedes wird erklärt, nachdem es passiert ist.",
- "finished": {
- "title": "Du kennst jetzt die Grundlagen!",
- "body": "Du hast {done} von {total} ersten Schritten geschafft. Ab jetzt sprichst du einfach mit {name}: Es entscheidet selbst, ob es antwortet, ein Werkzeug nutzt oder einen Agent dazuholt. Nicht weiter? Frag {name}.",
- "close": "Schließen"
- },
- "quests": {
- "wake": {
- "title": "Weck {name} auf",
- "ask": "Sag dein Weckwort laut, zum Beispiel „Hey {name}“. Oder öffne den Sprachmodus und drück den runden Knopf in der Chatleiste. Dann frag einfach los.",
- "explain": "{name} hört zu. Mehr braucht es nicht: aufwecken und reden wie mit einem Menschen.",
- "how": "Dein Weckwort wird direkt hier auf deinem Computer erkannt. Erst danach geht deine Sprache an das Gehirn, und die Antwort kommt als Stimme zurück."
- },
- "ask": {
- "title": "Stell deine erste Frage",
- "ask": "Tipp oder sag eine Frage. Probier diese:",
- "prompt": "Was kannst du für mich tun? Nenn mir drei Beispiele aus meinem Alltag.",
- "explain": "Das war der einfachste Weg: Deine Worte gingen an das Gehirn, und es hat direkt geantwortet.",
- "how": "Das Gehirn ist das KI-Modell, das du verbunden hast. Einfache Fragen brauchen keine Werkzeuge, deshalb kommt die Antwort in Sekunden. Jeder Chat wird unter „Letzte Chats“ gespeichert."
- },
- "tool": {
- "title": "Lass es ein Werkzeug benutzen",
- "ask": "Jetzt bitte um etwas, wofür es seine Hände braucht, nicht nur seinen Kopf:",
- "prompt": "Öffne wikipedia.org in meinem Browser.",
- "explain": "Diesmal hat das Gehirn nicht nur geantwortet: Es hat ein Werkzeug benutzt, um an deinem Computer zu handeln.",
- "how": "Werkzeuge sind die Hände von {name}. Das Gehirn wählt eines, der Sicherheitscheck gibt es frei, und es läuft. Unter jeder Antwort kannst du die Schritte aufklappen und jedes benutzte Werkzeug sehen."
- },
- "screen": {
- "title": "Lass es auf deinen Bildschirm schauen",
- "ask": "{name} kann deinen Bildschirm sehen, aber nur, wenn du fragst. Probier:",
- "prompt": "Was ist gerade auf meinem Bildschirm? Beschreib es kurz.",
- "explain": "{name} hat einmal auf deinen Bildschirm geschaut und ihn beschrieben.",
- "how": "Ein Blick auf den Bildschirm ist ein einzelnes Foto, nur dann, wenn eine Anfrage es braucht. Es geht wie ein Bild an das Gehirn. Nichts zeichnet deinen Bildschirm im Hintergrund auf."
- },
- "memory": {
- "title": "Bring ihm etwas bei",
- "ask": "Erzähl {name} etwas, das es sich merken soll:",
- "prompt": "Merk dir, dass meine Lieblingsfarbe Blau ist und dass ich kurze Antworten mag.",
- "explain": "{name} hat das in seinem Gedächtnis gespeichert und nutzt es ab jetzt.",
- "how": "Fakten landen in deinem Wiki und Profil, gespeichert auf deinem Computer. Bevor {name} antwortet, schaut es nach, was es über dich weiß. In den Notizen kannst du alles lesen und bearbeiten."
- },
- "artifact": {
- "title": "Lass es etwas bauen",
- "ask": "{name} kann fertige Dinge bauen: Seiten, Übersichten, kleine Tools. Sag „Artifact“, um eins anzufordern:",
- "prompt": "Erstelle ein Artifact: eine einseitige Übersicht über die Planeten unseres Sonnensystems, mit je einem spannenden Fakt.",
- "explain": "{name} hat angefangen, die Seite zu bauen. Sobald sie fertig ist, erscheint sie in Artifacts.",
- "how": "Ein Artifact ist eine größere Arbeit, deshalb gibt {name} sie an einen Helfer auf einem starken Modell ab. Der baut eine eigenständige Seite, und Artifacts bewahrt sie auf, damit du sie später wieder öffnen kannst."
- },
- "agent": {
- "title": "Gib einem Agent eine große Aufgabe",
- "ask": "Für längere Arbeit holt {name} einen Agent dazu. Du kannst weiterreden, während er arbeitet:",
- "prompt": "Recherchiere die drei besten günstigen Laptops gerade und schreib mir einen kurzen Vergleich.",
- "explain": "{name} hat die Aufgabe an einen Agent abgegeben. Er arbeitet im Hintergrund; das Ergebnis kommt in deinen Chat.",
- "how": "{name} bleibt dein einziger Ansprechpartner. Es plant die Aufgabe und startet einen Agent, und ein Prüfer kontrolliert das Ergebnis, bevor es bei dir ankommt. Den Fortschritt siehst du unter Agents."
- },
- "team": {
- "title": "Lern dein Team kennen",
- "ask": "Agents sind Helfer mit einer eigenen Rolle. Öffne den Bereich Agents, um sie kennenzulernen.",
- "explain": "Hier wohnen und arbeiten deine Agents.",
- "how": "Leg einen eigenen Agent an, mit eigener Rolle, eigenem Modell und eigenen Anweisungen, zum Beispiel einen Rechercheur oder eine Texterin. Klick einen Agent an, um mit ihm zu chatten oder ihm einen Auftrag zu geben. {name} kann ihm auch für dich Arbeit geben."
- },
- "plugin": {
- "title": "Verbinde eine App",
- "ask": "Plugins verbinden {name} mit den Apps, die du nutzt: E-Mail, Kalender, Notizen, Smart Home und mehr.",
- "explain": "Hier verbindest du deine Apps. Wähl eine, die du täglich nutzt, und klick auf Verbinden; dein Browser öffnet sich einmal zum Anmelden.",
- "how": "Jede verbundene App wird ein neues Werkzeug für {name}. Danach fragst du einfach, zum Beispiel „Was steht morgen in meinem Kalender?“. Alles, was etwas sendet oder ändert, fragt dich trotzdem vorher."
+ "tour": {
+ "title": "Ein Rundgang durch {name}",
+ "lede": "Dein Haustier führt dich durch die App und erklärt jeden Bereich.",
+ "next": "Weiter",
+ "finish": "Los geht's",
+ "skip": "Überspringen",
+ "labels": {
+ "chat": "Chat",
+ "voice": "Sprach-Chat",
+ "agents": "Agents",
+ "ide": "Agentic IDE",
+ "plugins": "Plugins",
+ "wake": "Weckwort",
+ "permissions": "Mac-Berechtigungen",
+ "done": "Fertig"
},
- "ide": {
- "title": "Lass Agents programmieren",
- "ask": "Die Agentic IDE lässt Coding-Agents wie Claude Code und Codex in echten Terminals laufen, an deinen eigenen Projekten.",
- "explain": "Das ist die Agentic IDE. Öffne einen Projektordner und starte in einem Fenster einen Coding-Agent.",
- "how": "Jedes Fenster ist ein echtes Terminal mit eigenem Agent. Sprich mit ihnen per Tastatur oder per Stimme über {name}. Mehrere können nebeneinander am selben Projekt arbeiten."
+ "stops": {
+ "chat": "Hi, ich bin {pet}! Ich zeig dir alles. Das ist dein Chat mit {name}. Schreib hier einfach rein: eine Frage, eine Aufgabe, eine Datei zum Anschauen. Du wählst nie selbst ein Werkzeug oder Modell; {name} entscheidet, was gebraucht wird.",
+ "voice": "Lieber reden? Das ist der Sprach-Chat. Klick auf die Leiste, sag dein Weckwort oder drück dein Anruf-Tastenkürzel und sprich einfach los. Die Welle zeigt, wer gerade spricht.",
+ "agents": "Große Aufgaben wie Recherche, ein Bericht oder eine Website gehen an deine Agents. Sie sind das Team von {name}, jeder mit eigener Rolle und eigenem Modell. Unter Agents siehst du ihnen bei der Arbeit zu, chattest mit einem oder erstellst deinen eigenen.",
+ "ide": "Die Agentic IDE lässt Coding-Agents wie Claude Code und Codex in echten Terminals an deinen eigenen Projekten arbeiten. Schreib ihnen direkt, oder lass {name} sie per Stimme steuern.",
+ "plugins": "Plugins verbinden {name} mit den Apps, die du nutzt: Mail, Kalender, Notizen, Smart Home und mehr. Jedes wird zu einem neuen Werkzeug, und alles, was etwas sendet oder ändert, fragt dich vorher.",
+ "wake": "Dein Weckwort findest du hier in den Einstellungen. Sag „Hey {name}“, und {name} hört zu. Ändere das Wort, wähle seine Sprache oder teste es jederzeit.",
+ "permissions": "Auf einem Mac braucht {name} deine Erlaubnis für Mikrofon, Bildschirm und die Steuerung von Apps. Erlaube hier, was du möchtest; jede Zeile aktualisiert sich von selbst.",
+ "done": "Das war der Rundgang! Sprich mit {name}, wann immer du willst, und wenn du mal nicht weiterweißt, frag einfach. Unter Einstellungen → App startest du diese Einführung erneut."
}
}
+ },
+ "app_tour": {
+ "replay_title": "Einführung wiederholen",
+ "replay_body": "Öffnet das Einrichtungsfenster erneut (Name, KI-Verbindungen, Stimme) und danach den Rundgang durch die App. Es wird nichts neu gestartet.",
+ "replay": "Wiederholen"
}
}
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 6c56a4ec58..fe5e51c55c 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/en.json
@@ -3,203 +3,100 @@
"back": "Back",
"continue": "Continue",
"step_of": "{current} of {total}",
- "welcome": {
- "skip_all": "Skip setup, I know my way around",
- "title": "Welcome",
- "lede": "First a short look at what {name} is and how it works. Then we set it up right here in the app: an API key, a subscription for your agents and your wake word.",
- "language": "Language",
- "lang_en": "English",
- "lang_de": "Deutsch",
- "lang_es": "Español",
- "start": "Let's start"
+ "window": {
+ "title": "Set up {name}",
+ "progress": "Setup progress",
+ "language": "Language"
},
- "how": {
- "title": "How {name} works",
- "lede": "Your pet walks you through the app and explains how {name} works.",
- "next": "Next",
- "prev": "Back",
- "skip": "Skip",
- "finish": "Let's set it up",
- "beat_of": "Explanation {current} of {total}",
- "beats": {
- "hello": "Hi, I'm {pet}! Before we set anything up, let me show you how {name} works. It's quick, and you'll see the real app while I explain.",
- "talk": "Everything starts here. You talk to one assistant: {name}. Type here, or press the round button and just speak. You never pick a tool or a model yourself; {name} decides what's needed.",
- "brain": "To think, {name} needs a brain: an AI model from OpenAI, Google, Anthropic or another provider, or one on your own computer. One key is enough, and we'll add it together in a moment.",
- "tools": "Then {name} needs hands. It can use your computer and browser on its own, plus every app you connect here: mail, calendar, notes, smart home. When you ask for something, it picks the right tool itself.",
- "agents": "Big jobs like research, a report or a website go to agents. They're {name}'s team: {name} hands them the work and keeps talking with you, and a reviewer checks the result before it reaches you.",
- "ide": "Coding agents such as Claude Code and Codex work here, in real terminals on your own projects. Type to them directly, or let {name} steer them by voice.",
- "results": "Whatever comes out, like pages, reports or images, lands in Artifacts. Short answers come straight back in the chat or spoken aloud.",
- "memory": "{name} also remembers. What you tell it goes into its notes and your profile, stored on your computer, so you never have to repeat yourself.",
- "safety": "And you stay in control. Harmless things just happen. Anything that sends, deletes or costs money waits for your yes first.",
- "done": "That's the whole idea: you talk, {name} thinks, uses tools, brings in agents and hands you the result. Stuck later? Just ask {name}. Now let's give it a brain."
- }
+ "name": {
+ "pill": "Name",
+ "title": "Hey! What would you like to call me?",
+ "lede": "Pick any name you like. It is also my wake word: say it out loud, and I'm listening. You can change it anytime in Settings.",
+ "label": "Assistant name",
+ "placeholder": "Type a name…",
+ "ideas": "Ideas:",
+ "preview": "You'll wake me with \"{phrase}\".",
+ "preview_empty": "Type a name, and you'll see how to wake me.",
+ "skip_all": "Skip setup, I know my way around"
},
- "keys": {
- "next_hint": "Next: connect the subscriptions you already pay for, so your agents can work.",
- "no_key": "No key yet? A free local model works too (Settings → Local models), or skip and add one later. Without any, chat and voice stay off.",
- "live_missing": "Chat works. Live voice needs an OpenAI or Gemini key; until then {name} speaks the classic way, a little slower.",
+ "connect": {
+ "pill": "Connect",
+ "title": "Connect your AI",
+ "lede": "Sign in with a subscription you already pay for, so your agents work at a flat price. Or add an API key: one key is all {name} needs to think and talk.",
+ "subscriptions": "Subscriptions",
+ "subscriptions_why": "A subscription is a flat monthly price. Your browser opens once to sign in, and nothing is billed per use.",
+ "or_key": "Or an API key",
+ "connect": "Connect",
+ "ready": "Ready",
+ "checking": "Checking…",
+ "waiting": "Waiting…",
+ "signed_in": "Signed in.",
+ "signed_in_as": "Signed in as {account}.",
+ "finish_in_browser": "Finish the sign-in in your browser.",
+ "not_installed": "Its app is not installed yet.",
+ "install_first": "Install it first: run this in a terminal, then check again.",
+ "check_again": "Check again",
+ "copy": "Copy command",
+ "key_title": "API key",
+ "key_hint": "Pay per use. An OpenAI or Google Gemini key also gives you live voice.",
+ "key_provider": "Provider",
+ "key_none": "No provider that takes a key is available right now.",
+ "key_present": "{provider} key saved.",
+ "key_connecting": "Switching everything on…",
+ "key_connected": "Connected: {provider}.",
+ "key_partial": "Some parts did not switch ({parts}). You can fix them later on the API Keys page.",
"live_ready": "Live voice is on: talk, and {name} answers right away.",
- "title": "Add one API key",
- "lede": "This is the API Keys page. Paste one key into a provider card and save it; that is all {name} needs to think and talk. An OpenAI (ChatGPT) or Google Gemini key also gives you live voice.",
- "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"
- },
- "subscriptions": {
- "title": "Connect a subscription for your agents",
- "lede": "This is the Agents tab. Agents run best on a subscription you already pay for; we recommend Claude (Pro or Max) or ChatGPT (Codex). Click Connect on its row, and your browser opens once.",
- "waiting": "No subscription connected yet…",
- "connected": "Connected: {names}.",
- "why": "A subscription is a flat monthly price. Without one, agents use your API key and each job is billed per use.",
- "later": "I'll connect one later"
- },
- "permissions": {
- "title": "Allow access on this Mac",
- "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."
+ "live_missing": "Chat works. Live voice needs an OpenAI or Gemini key; until then {name} speaks the classic way, a little slower.",
+ "key_security": "Keys go into your system's keychain and only ever to the provider you picked.",
+ "nothing_yet": "Nothing connected yet. Without a subscription or a key, chat and voice stay off. You can connect one later on the API Keys page.",
+ "later": "Skip for now"
},
"voice": {
- "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.",
- "saved": "\"{phrase}\" is saved. Turn on \"Activate wake word\" above to have it heard all the time; until then the Call shortcut works.",
- "off": "No wake word yet. The Call shortcut works meanwhile.",
- "later": "Skip, I'll use the Call shortcut"
- },
- "ready": {
- "title": "All set",
- "lede": "Here is what is set up. Next, a short tour shows you around the app.",
- "row_brain": "Brain",
- "row_agents": "Agents",
- "row_voice": "Activation",
- "no_subscription": "No subscription",
- "no_key": "No key yet",
- "shortcut": "Call shortcut",
- "autostart": "Start at login",
- "no_key_note": "Without a key, chat and voice stay off until you add one on the API Keys page.",
+ "pill": "Voice",
+ "title": "How you'll talk to {name}",
+ "lede": "Type in the chat, or just speak: say your wake word, or press your Call shortcut.",
+ "no_word": "No wake word yet",
+ "wake_on": "Always listening for your wake word. It is recognised right here on this computer.",
+ "wake_off": "Off: press your Call shortcut to talk. Turn it on to have your wake word heard all the time.",
+ "wake_switch": "Always listen for the wake word",
+ "after_restart": "This switches on with the restart at the end.",
+ "login_title": "Start at login",
+ "login_detail": "Opens {name} when your computer starts, so it is ready to hear you.",
"preview_note": "This is a replay, so nothing restarts.",
- "restart_note": "When the tour ends, the app restarts once (about ten seconds) to switch everything on.",
+ "restart_note": "Next, a short walk shows you around the app. At the end the app restarts once (about ten seconds) to switch everything on.",
"start": "Show me around"
- }
- },
- "app_tour": {
- "label": "App tour",
- "next": "Next",
- "finish": "Finish",
- "skip": "Skip tour",
- "step_of": "{current} of {total}",
- "replay_title": "Do the onboarding again",
- "replay_body": "Explains again how {name} works, walks you through setup (API keys, agent subscriptions, wake word), then the short tour of the app. Nothing restarts.",
- "replay": "Replay",
- "steps": {
- "voice": "This is how you talk to {name}. Click the bar, say your wake word or press your Call keys, then just speak. The wave shows who is talking.",
- "new_chat": "Rather type? Start a new chat here, as text or voice. Every conversation lands under Recent chats.",
- "agents_world": "This is the Verse, your agents at work. Click one to chat with it or hand it a job. Next brings you back.",
- "voice_hub": "Voice holds dictation into any app, your own word list and spoken shortcuts.",
- "settings": "Settings, API keys, costs and your profile live here. You can replay this tour anytime from Settings → App.",
- "done": "That's the tour. Talk to {name} whenever you like, and if you're ever stuck, just ask {name}. Settings → App runs the onboarding again."
- }
- },
- "first_steps": {
- "title": "First steps",
- "progress": "{done}/{total}",
- "collapse": "Minimise",
- "close": "Close",
- "quest_of": "Step {current} of {total}",
- "how_label": "How it works:",
- "waiting": "Sent. Watch the chat: {name} is on it.",
- "next": "Next step",
- "finish": "Finish",
- "skip": "Skip this one",
- "try": {
- "send": "Send it for me",
- "voice": "Open voice mode",
- "open": "Take me there"
},
- "show": {
- "memory": "Open Notes",
- "artifact": "Open Artifacts",
- "agent": "Watch in Agents"
- },
- "replay_title": "First steps with {name}",
- "replay": "Start",
- "replay_body": "Ten small, real things to try with {name}: talk, use tools, remember, build, hand off to agents. Each one is explained after it happened.",
- "finished": {
- "title": "You've got the basics!",
- "body": "You completed {done} of {total} first steps. From now on, just talk to {name}: it decides whether to answer, use a tool or bring in an agent. Stuck? Ask {name}.",
- "close": "Close"
- },
- "quests": {
- "wake": {
- "title": "Wake {name} up",
- "ask": "Say your wake word out loud, for example \"Hey {name}\". Or open voice mode and press the round button in the chat bar. Then just ask anything.",
- "explain": "{name} is listening. That's all it takes: wake it up and talk like you would to a person.",
- "how": "Your wake word is recognised right here on your computer. Only after it does your speech go to the brain, and the answer comes back as a voice."
- },
- "ask": {
- "title": "Ask your first question",
- "ask": "Type or say a question. Try this one:",
- "prompt": "What can you do for me? Give me three examples from my everyday life.",
- "explain": "That was the simplest path: your words went to the brain, and it answered directly.",
- "how": "The brain is the AI model you connected. Plain questions need no tools, so the answer comes in seconds. Every chat is saved under Recent chats."
- },
- "tool": {
- "title": "Let it use a tool",
- "ask": "Now ask for something that needs its hands, not just its head:",
- "prompt": "Open wikipedia.org in my browser.",
- "explain": "This time the brain did not just answer: it used a tool to act on your computer.",
- "how": "Tools are {name}'s hands. The brain picks one, the safety check approves it, and it runs. Under each reply you can open the steps and see every tool it used."
- },
- "screen": {
- "title": "Let it look at your screen",
- "ask": "{name} can see your screen, but only when you ask. Try:",
- "prompt": "What's on my screen right now? Describe it briefly.",
- "explain": "{name} took one look at your screen and described it.",
- "how": "A screen look is a single snapshot, taken only when a request needs it. It goes to the brain like a photo. Nothing records your screen in the background."
- },
- "memory": {
- "title": "Teach it something",
- "ask": "Tell {name} something worth keeping:",
- "prompt": "Remember that my favourite colour is blue and that I prefer short answers.",
- "explain": "{name} saved this to its memory and will use it from now on.",
- "how": "Facts land in your Wiki and profile, stored on your computer. Before answering, {name} looks up what it knows about you. You can read and edit every note in Notes."
- },
- "artifact": {
- "title": "Have it make something",
- "ask": "{name} can build finished things: pages, overviews, small tools. Say \"artifact\" to ask for one:",
- "prompt": "Create an artifact: a one-page overview of the planets in our solar system, with one fun fact each.",
- "explain": "{name} started building the page. When it is ready, it appears in Artifacts.",
- "how": "An artifact is a bigger piece of work, so {name} hands it to a worker on a strong model. It builds one self-contained page, and Artifacts keeps it for you to open again later."
- },
- "agent": {
- "title": "Hand a big job to an agent",
- "ask": "For longer work, {name} brings in an agent. You can keep talking while it works:",
- "prompt": "Research the three best budget laptops right now and write me a short comparison.",
- "explain": "{name} handed the job to an agent. It works in the background; the result comes back to your chat.",
- "how": "{name} stays your single contact. It plans the job and starts an agent, and a reviewer checks the result before it reaches you. You can watch the progress in Agents."
- },
- "team": {
- "title": "Meet your team",
- "ask": "Agents are helpers with their own role. Open the Agents area to meet them.",
- "explain": "This is where your agents live and work.",
- "how": "Create your own agent with its own role, model and instructions, for example a researcher or a writer. Click an agent to chat with it or give it a job. {name} can also hand work to it for you."
- },
- "plugin": {
- "title": "Connect an app",
- "ask": "Plugins connect {name} to the apps you use: email, calendar, notes, smart home and more.",
- "explain": "Here you connect your apps. Pick one you use every day and click Connect; your browser opens once to sign in.",
- "how": "Each connected app becomes a new tool for {name}. Afterwards just ask, for example \"What's on my calendar tomorrow?\". Anything that sends or changes something still asks you first."
+ "tour": {
+ "title": "A walk through {name}",
+ "lede": "Your pet walks you through the app and explains each section.",
+ "next": "Next",
+ "finish": "Let's go",
+ "skip": "Skip",
+ "labels": {
+ "chat": "Chat",
+ "voice": "Voice chat",
+ "agents": "Agents",
+ "ide": "Agentic IDE",
+ "plugins": "Plugins",
+ "wake": "Wake word",
+ "permissions": "Mac permissions",
+ "done": "All set"
},
- "ide": {
- "title": "Let agents write code",
- "ask": "The Agentic IDE runs coding agents such as Claude Code and Codex in real terminals, on your own projects.",
- "explain": "This is the Agentic IDE. Open a project folder and start a coding agent in a pane.",
- "how": "Each pane is a real terminal with its own agent. Talk to them by typing, or by voice through {name}. Several can work side by side on the same project."
+ "stops": {
+ "chat": "Hi, I'm {pet}! Let me show you around. This is your chat with {name}. Type anything here: a question, a task, a file to look at. You never pick a tool or a model yourself; {name} decides what's needed.",
+ "voice": "Rather talk? This is voice chat. Click the bar, say your wake word or press your Call shortcut, then just speak. The wave shows who is talking.",
+ "agents": "Big jobs like research, a report or a website go to your agents. They're {name}'s team, each with its own role and model. Open Agents to watch them work, chat with one or create your own.",
+ "ide": "The Agentic IDE runs coding agents such as Claude Code and Codex in real terminals, on your own projects. Type to them directly, or let {name} steer them by voice.",
+ "plugins": "Plugins connect {name} to the apps you use: mail, calendar, notes, smart home and more. Each one becomes a new tool, and anything that sends or changes something asks you first.",
+ "wake": "Your wake word lives here in Settings. Say \"Hey {name}\" and {name} listens. Change the word, pick its language or test it anytime.",
+ "permissions": "On a Mac, {name} needs your permission for the microphone, the screen and controlling apps. Allow the ones you want here; each row updates by itself.",
+ "done": "That's the tour! Talk to {name} whenever you like, and if you're ever stuck, just ask. Settings → App runs this guide again."
}
}
+ },
+ "app_tour": {
+ "replay_title": "Do the onboarding again",
+ "replay_body": "Opens the setup window again (name, AI connections, voice), then the walk through the app. Nothing restarts.",
+ "replay": "Replay"
}
}
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 748a7388a2..e9a6974282 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/onboarding/es.json
@@ -3,203 +3,100 @@
"back": "Atrás",
"continue": "Continuar",
"step_of": "{current} de {total}",
- "welcome": {
- "skip_all": "Saltar la configuración, ya me oriento",
- "title": "Bienvenido",
- "lede": "Primero, un vistazo rápido a qué es {name} y cómo funciona. Después lo configuramos aquí mismo, en la aplicación: una clave de API, una suscripción para tus agentes y tu palabra de activación.",
- "language": "Idioma",
- "lang_en": "English",
- "lang_de": "Deutsch",
- "lang_es": "Español",
- "start": "Empezar"
+ "window": {
+ "title": "Configura {name}",
+ "progress": "Progreso de la configuración",
+ "language": "Idioma"
},
- "how": {
- "title": "Cómo funciona {name}",
- "lede": "Tu mascota te guía por la aplicación y te explica cómo funciona {name}.",
- "next": "Siguiente",
- "prev": "Atrás",
- "skip": "Saltar",
- "finish": "A configurarlo",
- "beat_of": "Explicación {current} de {total}",
- "beats": {
- "hello": "¡Hola, soy {pet}! Antes de configurar nada, te enseño cómo funciona {name}. Es rápido, y verás la aplicación real mientras te lo explico.",
- "talk": "Todo empieza aquí. Hablas con un solo asistente: {name}. Escribe aquí, o pulsa el botón redondo y habla. Nunca eliges tú una herramienta o un modelo; {name} decide lo que hace falta.",
- "brain": "Para pensar, {name} necesita un cerebro: un modelo de IA de OpenAI, Google, Anthropic u otro proveedor, o uno en tu propio ordenador. Basta con una clave, y la añadimos juntos en un momento.",
- "tools": "Luego {name} necesita manos. Puede usar tu ordenador y tu navegador por sí mismo, además de cada app que conectes aquí: correo, calendario, notas, hogar inteligente. Cuando pides algo, elige solo la herramienta adecuada.",
- "agents": "Los trabajos grandes, como una investigación, un informe o una web, van a los agentes. Son el equipo de {name}: {name} les pasa el trabajo y sigue hablando contigo, y un revisor comprueba el resultado antes de que te llegue.",
- "ide": "Aquí trabajan agentes de programación como Claude Code y Codex, en terminales reales y en tus propios proyectos. Escríbeles directamente, o deja que {name} los dirija por voz.",
- "results": "Lo que salga, como páginas, informes o imágenes, va a Artifacts. Las respuestas cortas vuelven directamente al chat o en voz alta.",
- "memory": "{name} también recuerda. Lo que le cuentas va a sus notas y a tu perfil, guardados en tu ordenador, para que nunca tengas que repetirte.",
- "safety": "Y tú mantienes el control. Lo inofensivo simplemente ocurre. Todo lo que envía, borra o cuesta dinero espera primero tu sí.",
- "done": "Esa es toda la idea: hablas, {name} piensa, usa herramientas, llama a agentes y te entrega el resultado. ¿Te atascas luego? Pregúntale a {name}. Ahora démosle un cerebro."
- }
- },
- "keys": {
- "next_hint": "Siguiente: conecta las suscripciones que ya pagas para que tus agentes puedan trabajar.",
- "no_key": "¿Aún sin clave? También sirve un modelo local gratuito (Ajustes → Modelos locales), o sáltalo y añade una más tarde. Sin ninguna, el chat y la voz quedan apagados.",
- "live_missing": "El chat funciona. La voz en directo necesita una clave de OpenAI o Gemini; mientras tanto {name} habla de la forma clásica, algo más lenta.",
- "live_ready": "La voz en directo está activa: hablas y {name} responde al instante.",
- "title": "Añade una clave de API",
- "lede": "Esta es la página de claves de API. Pega una clave en la tarjeta de un proveedor y guárdala; es todo lo que {name} necesita para pensar y hablar. Una clave de OpenAI (ChatGPT) o de Google Gemini también te da 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"
+ "name": {
+ "pill": "Nombre",
+ "title": "¡Hola! ¿Cómo quieres llamarme?",
+ "lede": "Elige el nombre que quieras. También es mi palabra de activación: dilo en voz alta y te escucho. Puedes cambiarlo cuando quieras en Ajustes.",
+ "label": "Nombre del asistente",
+ "placeholder": "Escribe un nombre…",
+ "ideas": "Ideas:",
+ "preview": "Me despiertas con «{phrase}».",
+ "preview_empty": "Escribe un nombre y verás cómo despertarme.",
+ "skip_all": "Saltar la configuración, ya conozco la app"
},
- "subscriptions": {
- "title": "Conecta una suscripción para tus agentes",
- "lede": "Esta es la pestaña Agentes. Los agentes funcionan mejor con una suscripción que ya pagas; recomendamos Claude (Pro o Max) o ChatGPT (Codex). Pulsa Conectar en su fila y tu navegador se abre una vez.",
- "waiting": "Aún no hay ninguna suscripción conectada…",
- "connected": "Conectado: {names}.",
- "why": "Una suscripción es un precio mensual fijo. Sin ella, los agentes usan tu clave de API y cada encargo se cobra por uso.",
- "later": "Conectaré una más tarde"
- },
- "permissions": {
- "title": "Permitir acceso en este Mac",
- "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."
+ "connect": {
+ "pill": "Conectar",
+ "title": "Conecta tu IA",
+ "lede": "Inicia sesión con una suscripción que ya pagas, así tus agentes trabajan a precio fijo. O añade una clave de API: con una sola clave {name} ya puede pensar y hablar.",
+ "subscriptions": "Suscripciones",
+ "subscriptions_why": "Una suscripción es un precio mensual fijo. Tu navegador se abre una vez para iniciar sesión y no se cobra nada por uso.",
+ "or_key": "O una clave de API",
+ "connect": "Conectar",
+ "ready": "Listo",
+ "checking": "Comprobando…",
+ "waiting": "Esperando…",
+ "signed_in": "Sesión iniciada.",
+ "signed_in_as": "Sesión iniciada como {account}.",
+ "finish_in_browser": "Termina de iniciar sesión en tu navegador.",
+ "not_installed": "Su programa aún no está instalado.",
+ "install_first": "Instálalo primero: ejecuta esto en una terminal y vuelve a comprobar.",
+ "check_again": "Comprobar de nuevo",
+ "copy": "Copiar comando",
+ "key_title": "Clave de API",
+ "key_hint": "Pagas por uso. Una clave de OpenAI o Google Gemini también te da voz en vivo.",
+ "key_provider": "Proveedor",
+ "key_none": "Ahora mismo no hay ningún proveedor disponible que acepte una clave.",
+ "key_present": "Clave de {provider} guardada.",
+ "key_connecting": "Activando todo…",
+ "key_connected": "Conectado: {provider}.",
+ "key_partial": "Algunas partes no cambiaron ({parts}). Puedes arreglarlo más tarde en la página Claves de API.",
+ "live_ready": "La voz en vivo está activa: habla y {name} responde al instante.",
+ "live_missing": "El chat funciona. La voz en vivo necesita una clave de OpenAI o Gemini; hasta entonces {name} habla de la forma clásica, un poco más lento.",
+ "key_security": "Las claves se guardan en el llavero de tu sistema y solo van al proveedor que elegiste.",
+ "nothing_yet": "Aún no hay nada conectado. Sin suscripción ni clave, el chat y la voz quedan apagados. Puedes conectar algo más tarde en la página Claves de API.",
+ "later": "Saltar por ahora"
},
"voice": {
- "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.",
- "saved": "«{phrase}» está guardada. Enciende «Activar palabra de activación» arriba para que se escuche siempre; mientras tanto funciona el atajo de llamada.",
- "off": "Aún no hay palabra de activación. Mientras tanto funciona el atajo de llamada.",
- "later": "Omitir, usaré el atajo de llamada"
- },
- "ready": {
- "title": "Todo listo",
- "lede": "Esto es lo que está configurado. Ahora, una breve visita te enseña la aplicación.",
- "row_brain": "Cerebro",
- "row_agents": "Agentes",
- "row_voice": "Activación",
- "no_subscription": "Sin suscripción",
- "no_key": "Sin clave todavía",
- "shortcut": "Atajo de llamada",
- "autostart": "Iniciar al entrar en la sesión",
- "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.",
- "restart_note": "Al terminar la visita, la aplicación se reinicia una vez (unos diez segundos) para activarlo todo.",
- "start": "Enséñame la aplicación"
- }
- },
- "app_tour": {
- "label": "Visita guiada",
- "next": "Siguiente",
- "finish": "Terminar",
- "skip": "Saltar visita",
- "step_of": "{current} de {total}",
- "replay_title": "Hacer el onboarding de nuevo",
- "replay_body": "Vuelve a explicar cómo funciona {name}, te guía por la configuración (claves de API, suscripciones de agentes, palabra de activación) y luego por la visita breve de la aplicación. Nada se reinicia.",
- "replay": "Repetir",
- "steps": {
- "voice": "Así hablas con {name}. Haz clic en la barra, di tu palabra de activación o pulsa tu atajo de llamada, y habla. La onda muestra quién está hablando.",
- "new_chat": "¿Prefieres escribir? Empieza aquí un chat nuevo, por texto o por voz. Cada conversación queda en Chats recientes.",
- "agents_world": "Este es el Verse, tus agentes trabajando. Haz clic en uno para chatear con él o darle una tarea. Siguiente te lleva de vuelta.",
- "voice_hub": "En Voz tienes el dictado en cualquier aplicación, tu propia lista de palabras y atajos hablados.",
- "settings": "Aquí están los ajustes, las claves de API, los costes y tu perfil. Puedes repetir esta visita cuando quieras en Ajustes → Aplicación.",
- "done": "Esa fue la visita. Habla con {name} cuando quieras, y si alguna vez te atascas, pregúntale a {name}. En Ajustes → Aplicación puedes repetir el onboarding."
- }
- },
- "first_steps": {
- "title": "Primeros pasos",
- "progress": "{done}/{total}",
- "collapse": "Minimizar",
- "close": "Cerrar",
- "quest_of": "Paso {current} de {total}",
- "how_label": "Cómo funciona:",
- "waiting": "Enviado. Mira el chat: {name} está en ello.",
- "next": "Siguiente paso",
- "finish": "Terminar",
- "skip": "Saltar este",
- "try": {
- "send": "Envíalo por mí",
- "voice": "Abrir el modo de voz",
- "open": "Llévame allí"
- },
- "show": {
- "memory": "Abrir Notas",
- "artifact": "Abrir Artifacts",
- "agent": "Ver en Agentes"
+ "pill": "Voz",
+ "title": "Así hablarás con {name}",
+ "lede": "Escribe en el chat o simplemente habla: di tu palabra de activación o pulsa tu atajo de llamada.",
+ "no_word": "Aún no hay palabra de activación",
+ "wake_on": "Siempre atento a tu palabra de activación. Se reconoce aquí mismo, en este ordenador.",
+ "wake_off": "Apagado: pulsa tu atajo de llamada para hablar. Actívalo para que tu palabra de activación se oiga siempre.",
+ "wake_switch": "Escuchar siempre la palabra de activación",
+ "after_restart": "Se activa con el reinicio del final.",
+ "login_title": "Iniciar al encender",
+ "login_detail": "Abre {name} cuando arranca tu ordenador, para que esté listo para escucharte.",
+ "preview_note": "Esto es una repetición, así que nada se reinicia.",
+ "restart_note": "A continuación, un breve recorrido te enseña la app. Al final la app se reinicia una vez (unos diez segundos) para activarlo todo.",
+ "start": "Enséñame la app"
},
- "replay_title": "Primeros pasos con {name}",
- "replay": "Empezar",
- "replay_body": "Diez cosas pequeñas y reales para probar con {name}: hablar, usar herramientas, recordar, construir, pasar trabajo a agentes. Cada una se explica después de ocurrir.",
- "finished": {
- "title": "¡Ya dominas lo básico!",
- "body": "Completaste {done} de {total} primeros pasos. A partir de ahora, simplemente habla con {name}: decide si responde, usa una herramienta o llama a un agente. ¿Atascado? Pregúntale a {name}.",
- "close": "Cerrar"
- },
- "quests": {
- "wake": {
- "title": "Despierta a {name}",
- "ask": "Di tu palabra de activación en voz alta, por ejemplo «Hey {name}». O abre el modo de voz y pulsa el botón redondo de la barra del chat. Después pregunta lo que quieras.",
- "explain": "{name} te escucha. No hace falta más: despiértalo y habla como con una persona.",
- "how": "Tu palabra de activación se reconoce aquí mismo, en tu ordenador. Solo después tu voz va al cerebro, y la respuesta vuelve hablada."
- },
- "ask": {
- "title": "Haz tu primera pregunta",
- "ask": "Escribe o di una pregunta. Prueba esta:",
- "prompt": "¿Qué puedes hacer por mí? Dame tres ejemplos de mi día a día.",
- "explain": "Ese fue el camino más simple: tus palabras fueron al cerebro y respondió directamente.",
- "how": "El cerebro es el modelo de IA que conectaste. Las preguntas sencillas no necesitan herramientas, así que la respuesta llega en segundos. Cada chat se guarda en Chats recientes."
- },
- "tool": {
- "title": "Deja que use una herramienta",
- "ask": "Ahora pide algo que necesite sus manos, no solo su cabeza:",
- "prompt": "Abre wikipedia.org en mi navegador.",
- "explain": "Esta vez el cerebro no solo respondió: usó una herramienta para actuar en tu ordenador.",
- "how": "Las herramientas son las manos de {name}. El cerebro elige una, el control de seguridad la aprueba y se ejecuta. Bajo cada respuesta puedes abrir los pasos y ver cada herramienta usada."
- },
- "screen": {
- "title": "Deja que mire tu pantalla",
- "ask": "{name} puede ver tu pantalla, pero solo cuando lo pides. Prueba:",
- "prompt": "¿Qué hay ahora mismo en mi pantalla? Descríbelo brevemente.",
- "explain": "{name} miró una vez tu pantalla y la describió.",
- "how": "Mirar la pantalla es una sola captura, tomada solo cuando una petición la necesita. Va al cerebro como una foto. Nada graba tu pantalla en segundo plano."
- },
- "memory": {
- "title": "Enséñale algo",
- "ask": "Cuéntale a {name} algo que valga la pena guardar:",
- "prompt": "Recuerda que mi color favorito es el azul y que prefiero respuestas cortas.",
- "explain": "{name} lo guardó en su memoria y lo usará a partir de ahora.",
- "how": "Los datos van a tu Wiki y a tu perfil, guardados en tu ordenador. Antes de responder, {name} consulta lo que sabe de ti. Puedes leer y editar cada nota en Notas."
- },
- "artifact": {
- "title": "Haz que cree algo",
- "ask": "{name} puede construir cosas terminadas: páginas, resúmenes, pequeñas herramientas. Di «artifact» para pedir uno:",
- "prompt": "Crea un artifact: un resumen de una página sobre los planetas del sistema solar, con un dato curioso de cada uno.",
- "explain": "{name} empezó a construir la página. Cuando esté lista, aparecerá en Artifacts.",
- "how": "Un artifact es un trabajo más grande, así que {name} se lo pasa a un ayudante con un modelo potente. Construye una página independiente, y Artifacts la guarda para que la abras más tarde."
- },
- "agent": {
- "title": "Pasa un trabajo grande a un agente",
- "ask": "Para trabajos largos, {name} llama a un agente. Puedes seguir hablando mientras trabaja:",
- "prompt": "Investiga los tres mejores portátiles baratos ahora mismo y escríbeme una comparación corta.",
- "explain": "{name} pasó el trabajo a un agente. Trabaja en segundo plano; el resultado llega a tu chat.",
- "how": "{name} sigue siendo tu único contacto. Planifica el trabajo y pone en marcha un agente, y un revisor comprueba el resultado antes de que te llegue. Puedes ver el progreso en Agentes."
- },
- "team": {
- "title": "Conoce a tu equipo",
- "ask": "Los agentes son ayudantes con su propio papel. Abre el área Agentes para conocerlos.",
- "explain": "Aquí viven y trabajan tus agentes.",
- "how": "Crea tu propio agente con su papel, modelo e instrucciones, por ejemplo un investigador o una redactora. Haz clic en un agente para chatear con él o darle un encargo. {name} también puede pasarle trabajo por ti."
- },
- "plugin": {
- "title": "Conecta una app",
- "ask": "Los plugins conectan {name} con las apps que usas: correo, calendario, notas, hogar inteligente y más.",
- "explain": "Aquí conectas tus apps. Elige una que uses a diario y pulsa Conectar; tu navegador se abre una vez para iniciar sesión.",
- "how": "Cada app conectada se convierte en una nueva herramienta para {name}. Después solo pregunta, por ejemplo «¿Qué tengo mañana en el calendario?». Todo lo que envía o cambia algo te pregunta antes."
+ "tour": {
+ "title": "Un recorrido por {name}",
+ "lede": "Tu mascota te guía por la app y te explica cada sección.",
+ "next": "Siguiente",
+ "finish": "¡Vamos!",
+ "skip": "Saltar",
+ "labels": {
+ "chat": "Chat",
+ "voice": "Chat de voz",
+ "agents": "Agentes",
+ "ide": "Agentic IDE",
+ "plugins": "Plugins",
+ "wake": "Palabra de activación",
+ "permissions": "Permisos del Mac",
+ "done": "Todo listo"
},
- "ide": {
- "title": "Deja que los agentes programen",
- "ask": "El Agentic IDE ejecuta agentes de programación como Claude Code y Codex en terminales reales, en tus propios proyectos.",
- "explain": "Este es el Agentic IDE. Abre una carpeta de proyecto e inicia un agente de programación en un panel.",
- "how": "Cada panel es una terminal real con su propio agente. Háblales escribiendo, o por voz a través de {name}. Varios pueden trabajar lado a lado en el mismo proyecto."
+ "stops": {
+ "chat": "¡Hola, soy {pet}! Te enseño la app. Este es tu chat con {name}. Escribe aquí lo que quieras: una pregunta, una tarea, un archivo para revisar. Nunca eliges tú una herramienta o un modelo; {name} decide lo que hace falta.",
+ "voice": "¿Prefieres hablar? Este es el chat de voz. Haz clic en la barra, di tu palabra de activación o pulsa tu atajo de llamada y habla. La onda muestra quién está hablando.",
+ "agents": "Los trabajos grandes, como una investigación, un informe o una web, van a tus agentes. Son el equipo de {name}, cada uno con su propio papel y modelo. En Agentes los ves trabajar, chateas con uno o creas el tuyo.",
+ "ide": "La Agentic IDE ejecuta agentes de programación como Claude Code y Codex en terminales reales, sobre tus propios proyectos. Escríbeles directamente o deja que {name} los dirija por voz.",
+ "plugins": "Los plugins conectan {name} con las apps que usas: correo, calendario, notas, hogar inteligente y más. Cada uno se convierte en una herramienta nueva, y todo lo que envía o cambia algo te pregunta antes.",
+ "wake": "Tu palabra de activación está aquí, en Ajustes. Di «Hey {name}» y {name} te escucha. Cambia la palabra, elige su idioma o pruébala cuando quieras.",
+ "permissions": "En un Mac, {name} necesita tu permiso para el micrófono, la pantalla y controlar apps. Permite aquí lo que quieras; cada fila se actualiza sola.",
+ "done": "¡Ese fue el recorrido! Habla con {name} cuando quieras y, si alguna vez te atascas, pregúntale. En Ajustes → App puedes repetir esta guía."
}
}
+ },
+ "app_tour": {
+ "replay_title": "Repetir la bienvenida",
+ "replay_body": "Vuelve a abrir la ventana de configuración (nombre, conexiones de IA, voz) y después el recorrido por la app. Nada se reinicia.",
+ "replay": "Repetir"
}
}
diff --git a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
index 30f9ec19e1..b210e9b3ea 100644
--- a/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
+++ b/jarvis/ui/web/frontend/src/views/settings/AppSettingsGroup.tsx
@@ -1,6 +1,6 @@
import { useState } from "react";
-import { Bot, Compass, Monitor, Moon, Power, Sparkles, Sun, Zap } from "lucide-react";
-import { FIRST_STEPS_START_EVENT, SETUP_REPLAY_EVENT } from "@/components/onboarding/tourEvents";
+import { Bot, Compass, Monitor, Moon, Power, Sun, Zap } from "lucide-react";
+import { SETUP_REPLAY_EVENT } from "@/components/onboarding/tourEvents";
import { Switch } from "@/components/ui/switch";
import { useAutostart } from "@/hooks/useAutostart";
import { useBackgroundAgents, type BackgroundAgentsPatch } from "@/hooks/useBackgroundAgents";
@@ -33,15 +33,14 @@ export function AppSettingsGroup() {
<AutostartRow />
<BackgroundAgentsRow />
<TourRow />
- <FirstStepsRow />
</div>
);
}
/**
- * Replays the guided tour of the app — the spotlight walk that runs once
- * after first-run setup. The strings live in the onboarding locale chunk,
- * which this row loads for itself.
+ * Replays the onboarding — the setup window, then the walk through the app —
+ * as a preview that restarts nothing. The strings live in the onboarding
+ * locale chunk, which this row loads for itself.
*/
function TourRow() {
const t = useT();
@@ -70,37 +69,6 @@ function TourRow() {
);
}
-/**
- * Starts the first-steps guide again: ten small, real things to do with the
- * assistant, each explained after it happened.
- */
-function FirstStepsRow() {
- const t = useT();
- const ready = useLocaleChunk("onboarding");
- if (!ready) return null;
- return (
- <div className="rounded-lg border border-border bg-card p-4">
- <div className="flex items-start gap-3">
- <Sparkles className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center justify-between gap-3">
- <h4 className="font-medium">{t("first_steps.replay_title")}</h4>
- <button
- type="button"
- onClick={() => window.dispatchEvent(new CustomEvent(FIRST_STEPS_START_EVENT))}
- data-testid="settings-first-steps"
- className="inline-flex items-center rounded-md border border-border bg-background px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- >
- {t("first_steps.replay")}
- </button>
- </div>
- <p className="mt-0.5 text-xs text-muted-foreground">{t("first_steps.replay_body")}</p>
- </div>
- </div>
- </div>
- );
-}
-
const THEME_OPTIONS: ReadonlyArray<{
value: ThemePreference;
icon: typeof Sun;
diff --git a/tests/unit/setup/test_onboarding_meta.py b/tests/unit/setup/test_onboarding_meta.py
index 354c54ce4a..9a3018b2d6 100644
--- a/tests/unit/setup/test_onboarding_meta.py
+++ b/tests/unit/setup/test_onboarding_meta.py
@@ -3,20 +3,16 @@ from jarvis.setup import onboarding_meta as m
def test_meta_constants():
assert m.CURRENT_TERMS_VERSION == "1.0"
- # Setup runs inside the real app (2026-09-30): consent, one key on the API
- # Keys page, a subscription for the agents on its Agents tab (2026-10-01),
- # macOS permissions, the wake word in Settings, then the start. The "how"
- # step (2026-10-01) explains the product before anything is set up.
- assert m.ONBOARDING_STEPS == [
- "welcome", "how", "keys", "subscriptions", "permissions", "voice", "ready",
- ]
- assert m.ONBOARDING_STEPS.index("how") < m.ONBOARDING_STEPS.index("keys")
- # Restart batching (2026-07-18): permissions + voice sit LAST before the
- # 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"
+ # Setup is one window with three steps (2026-10-05) — the name (the wake
+ # word), connecting an AI, how the user talks to it — then the walk
+ # through the app, which ends in the single completion restart.
+ assert m.ONBOARDING_STEPS == ["name", "connect", "voice", "tour"]
+ assert m.ONBOARDING_STEPS[-1] == "tour"
# Retired step ids must not come back through a partial revert.
- for retired in ("terms", "language", "api-keys", "wake-word", "finish", "brain", "agents"):
+ for retired in (
+ "terms", "language", "api-keys", "wake-word", "finish", "brain", "agents",
+ "welcome", "how", "keys", "subscriptions", "permissions", "ready",
+ ):
assert retired not in m.ONBOARDING_STEPS
assert len(m.WAKE_WORD_LEGAL_REFERENCES) >= 3
for ref in m.WAKE_WORD_LEGAL_REFERENCES:
diff --git a/tests/unit/ui/test_onboarding_routes.py b/tests/unit/ui/test_onboarding_routes.py
index 3a946fe12f..f93e678b8b 100644
--- a/tests/unit/ui/test_onboarding_routes.py
+++ b/tests/unit/ui/test_onboarding_routes.py
@@ -28,7 +28,7 @@ def test_state_starts_incomplete(client):
assert body["terms"]["current_version"] == "1.0"
assert body["terms"]["accepted"] is False
assert body["terms"]["accepted_version"] is None
- assert body["steps"][0] == "welcome"
+ assert body["steps"][0] == "name"
assert len(body["legal_references"]) >= 3
assert body["wake_word_acknowledged"] is False
assert body["tour_completed"] is False