Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(onboarding): v2 per-question questionnaire (source/role/use_case) (#2814)
Jiayuan Zhangc577a29c108b
diff --git a/apps/desktop/src/renderer/src/components/window-overlay.tsx b/apps/desktop/src/renderer/src/components/window-overlay.tsxindex b8d0bb715e..18ac1d835f 100644--- a/apps/desktop/src/renderer/src/components/window-overlay.tsx+++ b/apps/desktop/src/renderer/src/components/window-overlay.tsx@@ -74,6 +74,13 @@ function WindowOverlayInner() {push(paths.root());}}}+ // Restart the bundled daemon when the user hits Refresh on+ // Step 3. The daemon's PATH probe runs once at boot, so a+ // newly-installed CLI (Claude / Codex / Cursor) doesn't show+ // up until the daemon is bounced.+ onRuntimeRefresh={async () => {+ await window.daemonAPI?.restart?.();+ }}/>)}</div>diff --git a/e2e/onboarding-v2-smoke.spec.ts b/e2e/onboarding-v2-smoke.spec.tsnew file mode 100644index 0000000000..2f8a546477--- /dev/null+++ b/e2e/onboarding-v2-smoke.spec.ts@@ -0,0 +1,111 @@+import { test, expect } from "@playwright/test";+import { TestApiClient } from "./fixtures";++// Smoke test for Onboarding V2: verifies the new per-question flow+// renders and captures screenshots for review. Uses a unique email+// per run so the user is always a fresh, un-onboarded user landing+// on /onboarding.++const EMAIL = `onboarding-v2-${Date.now()}@localhost`;+const SHOTS_DIR = "/tmp/onboarding-v2-shots";++test.use({ viewport: { width: 1440, height: 900 } });++test("onboarding v2 — welcome → source → role → use_case (skip path)", async ({ page }) => {+ const api = new TestApiClient();+ await api.login(EMAIL, "OBv2 Tester");+ const token = api.getToken();++ await page.goto("/login");+ await page.evaluate((t) => {+ localStorage.setItem("multica_token", t);+ }, token);+ await page.goto("/onboarding");+ await page.waitForLoadState("networkidle");++ // 1. Welcome screen+ await expect(page.getByRole("button", { name: "Continue on web" })).toBeVisible({ timeout: 15000 });+ await page.screenshot({ path: `${SHOTS_DIR}/01-welcome.png`, fullPage: false });++ // Click Start exploring to advance to Source+ await page.getByRole("button", { name: "Continue on web" }).click();++ // 2. Source step+ await expect(page.getByText("How did you hear about Multica?")).toBeVisible({ timeout: 10000 });+ await expect(page.getByText(`Step 1 of 7`)).toBeVisible();+ await page.waitForTimeout(500);+ await page.screenshot({ path: `${SHOTS_DIR}/02-source.png` });++ // Pick Friends/colleagues then click Continue to advance.+ await page.getByRole("radio", { name: /Friends or colleagues/i }).click();+ await page.getByRole("button", { name: "Continue" }).click();++ // 3. Role step+ await expect(page.getByText("Which best describes you?")).toBeVisible({ timeout: 10000 });+ await expect(page.getByText(`Step 2 of 7`)).toBeVisible();+ await page.waitForTimeout(500);+ await page.screenshot({ path: `${SHOTS_DIR}/03-role.png` });++ // Skip role+ await page.getByRole("button", { name: "Skip" }).click();++ // 4. Use case step+ await expect(page.getByText("What do you want to use Multica for?")).toBeVisible({ timeout: 10000 });+ await expect(page.getByText(`Step 3 of 7`)).toBeVisible();+ await page.waitForTimeout(500);+ await page.screenshot({ path: `${SHOTS_DIR}/04-use-case.png` });++ // Pick ship_code then Continue → workspace step.+ await page.getByRole("radio", { name: /Ship code with AI agents/i }).click();+ await page.getByRole("button", { name: "Continue" }).click();++ // 5. Workspace step (legacy)+ await expect(page.getByRole("heading", { name: /Name your workspace/i })).toBeVisible({ timeout: 10000 });+ await page.screenshot({ path: `${SHOTS_DIR}/05-workspace.png` });+});++test("onboarding v2 — rage-skip all 3 questions", async ({ page }) => {+ const api = new TestApiClient();+ await api.login(`rage-skip-${Date.now()}@localhost`, "Rage Skipper");+ const token = api.getToken();++ await page.goto("/login");+ await page.evaluate((t) => localStorage.setItem("multica_token", t), token);+ await page.goto("/onboarding");+ await page.waitForLoadState("networkidle");++ await page.getByRole("button", { name: "Continue on web" }).click();+ await expect(page.getByText("How did you hear about Multica?")).toBeVisible({ timeout: 10000 });++ // Skip × 3+ await page.getByRole("button", { name: "Skip" }).click();+ await expect(page.getByText("Which best describes you?")).toBeVisible({ timeout: 10000 });+ await page.getByRole("button", { name: "Skip" }).click();+ await expect(page.getByText("What do you want to use Multica for?")).toBeVisible({ timeout: 10000 });+ await page.getByRole("button", { name: "Skip" }).click();++ // Lands on workspace step+ await expect(page.getByRole("heading", { name: /Name your workspace/i })).toBeVisible({ timeout: 10000 });+ await page.screenshot({ path: `${SHOTS_DIR}/06-after-rage-skip.png` });+});++test("onboarding v2 — zh-Hans renders Chinese labels", async ({ page, context }) => {+ await context.addCookies([+ { name: "multica-locale", value: "zh-Hans", url: "http://localhost:13442" },+ ]);+ const api = new TestApiClient();+ await api.login(`zh-${Date.now()}@localhost`, "中文用户");+ const token = api.getToken();++ await page.goto("/login");+ await page.evaluate((t) => localStorage.setItem("multica_token", t), token);+ await page.goto("/onboarding");+ await page.waitForLoadState("networkidle");++ await page.getByRole("button").first().click().catch(() => {});++ // Source screen — Chinese question+ await expect(page.getByText("你是从哪里了解到 Multica 的?")).toBeVisible({ timeout: 10000 });+ await page.waitForTimeout(500);+ await page.screenshot({ path: `${SHOTS_DIR}/07-source-zh.png` });+});diff --git a/packages/core/onboarding/index.ts b/packages/core/onboarding/index.tsindex f1084bd5d0..512eb1a46b 100644--- a/packages/core/onboarding/index.ts+++ b/packages/core/onboarding/index.ts@@ -2,7 +2,7 @@ export type {OnboardingStep,OnboardingCompletionPath,QuestionnaireAnswers,- TeamSize,+ Source,Role,UseCase,} from "./types";diff --git a/packages/core/onboarding/recommend-template.test.ts b/packages/core/onboarding/recommend-template.test.tsindex 8e23f928f0..c32b65ac41 100644--- a/packages/core/onboarding/recommend-template.test.ts+++ b/packages/core/onboarding/recommend-template.test.ts@@ -3,113 +3,145 @@ import { recommendTemplate } from "./recommend-template";import type { Role, UseCase } from "./types";const ALL_USE_CASES: UseCase[] = [- "coding",- "planning",- "writing_research",- "explore",+ "ship_code",+ "manage_team",+ "personal_tasks",+ "plan_research",+ "write_publish",+ "automate_ops",+ "evaluate","other",];-describe("recommendTemplate", () => {- describe("identity fallbacks — role alone decides", () => {- it.each(ALL_USE_CASES)(- "role=other (use_case=%s) → assistant",+const ALL_ROLES: Role[] = [+ "engineer",+ "product",+ "designer",+ "founder",+ "marketing",+ "writer",+ "research",+ "ops",+ "student",+ "other",+];++describe("recommendTemplate (v2)", () => {+ describe("engineer × use_case tiebreaker", () => {+ it.each<UseCase>(["manage_team", "plan_research"])(+ "engineer × %s → planning",(use_case) => {- expect(recommendTemplate({ role: "other", use_case })).toBe(- "assistant",+ expect(recommendTemplate({ role: "engineer", use_case })).toBe(+ "planning",);},);+ it("engineer × write_publish → writing", () => {+ expect(+ recommendTemplate({ role: "engineer", use_case: "write_publish" }),+ ).toBe("writing");+ });+ it.each<UseCase>([+ "ship_code",+ "personal_tasks",+ "automate_ops",+ "evaluate",+ "other",+ ])("engineer × %s → coding", (use_case) => {+ expect(recommendTemplate({ role: "engineer", use_case })).toBe("coding");+ });+ it("engineer × null → coding", () => {+ expect(recommendTemplate({ role: "engineer", use_case: null })).toBe(+ "coding",+ );+ });+ });- it.each(ALL_USE_CASES)(- "role=founder (use_case=%s) → assistant",+ describe("product × use_case", () => {+ it("product × ship_code → coding", () => {+ expect(+ recommendTemplate({ role: "product", use_case: "ship_code" }),+ ).toBe("coding");+ });+ it.each<UseCase>(["manage_team", "plan_research", "evaluate", "other"])(+ "product × %s → planning",(use_case) => {- expect(recommendTemplate({ role: "founder", use_case })).toBe(- "assistant",+ expect(recommendTemplate({ role: "product", use_case })).toBe(+ "planning",);},);+ it("product × null → planning", () => {+ expect(recommendTemplate({ role: "product", use_case: null })).toBe(+ "planning",+ );+ });+ });- it.each(ALL_USE_CASES)(- "role=writer (use_case=%s) → writing",+ describe("marketing × use_case", () => {+ it.each<UseCase>(["write_publish", "plan_research"])(+ "marketing × %s → writing",(use_case) => {- expect(recommendTemplate({ role: "writer", use_case })).toBe(+ expect(recommendTemplate({ role: "marketing", use_case })).toBe("writing",);},);- });-- describe("developer × use_case tiebreaker", () => {- it("developer × planning → planning", () => {+ it("marketing × manage_team → planning", () => {expect(- recommendTemplate({ role: "developer", use_case: "planning" }),+ recommendTemplate({ role: "marketing", use_case: "manage_team" }),).toBe("planning");});+ });- it.each<UseCase>([- "coding",- "writing_research",- "explore",- "other",- ])("developer × %s → coding", (use_case) => {- expect(recommendTemplate({ role: "developer", use_case })).toBe(- "coding",+ describe("single-template roles", () => {+ it.each(ALL_USE_CASES)("writer × %s → writing", (use_case) => {+ expect(recommendTemplate({ role: "writer", use_case })).toBe("writing");+ });+ it.each(ALL_USE_CASES)("designer × %s → assistant", (use_case) => {+ expect(recommendTemplate({ role: "designer", use_case })).toBe(+ "assistant",);});-- it("developer × null use_case → coding (default)", () => {- expect(- recommendTemplate({ role: "developer", use_case: null }),- ).toBe("coding");+ it.each(ALL_USE_CASES)("research × %s → planning", (use_case) => {+ expect(recommendTemplate({ role: "research", use_case })).toBe(+ "planning",+ );});+ it.each<Role>(["founder", "ops", "student", "other"])(+ "%s → assistant",+ (role) => {+ expect(recommendTemplate({ role, use_case: null })).toBe("assistant");+ },+ );});- describe("product_lead × use_case tiebreaker", () => {- it("product_lead × coding → coding", () => {- expect(- recommendTemplate({ role: "product_lead", use_case: "coding" }),- ).toBe("coding");- });-- it.each<UseCase>([- "planning",- "writing_research",- "explore",- "other",- ])("product_lead × %s → planning", (use_case) => {- expect(recommendTemplate({ role: "product_lead", use_case })).toBe(- "planning",+ describe("role skipped — use_case fallback", () => {+ it("null × ship_code → coding", () => {+ expect(recommendTemplate({ role: null, use_case: "ship_code" })).toBe(+ "coding",);});-- it("product_lead × null use_case → planning (default)", () => {+ it("null × write_publish → writing", () => {expect(- recommendTemplate({ role: "product_lead", use_case: null }),- ).toBe("planning");+ recommendTemplate({ role: null, use_case: "write_publish" }),+ ).toBe("writing");});- });-- describe("unanswered questionnaire", () => {- it("null role → assistant regardless of use_case", () => {+ it.each<UseCase>(["manage_team", "plan_research"])(+ "null × %s → planning",+ (use_case) => {+ expect(recommendTemplate({ role: null, use_case })).toBe("planning");+ },+ );+ it("both null → assistant", () => {expect(recommendTemplate({ role: null, use_case: null })).toBe("assistant",);- expect(recommendTemplate({ role: null, use_case: "coding" })).toBe(- "assistant",- );});});describe("exhaustive role coverage", () => {- const roles: Role[] = [- "developer",- "product_lead",- "writer",- "founder",- "other",- ];- it.each(roles)("role=%s returns a valid template id", (role) => {+ it.each(ALL_ROLES)("role=%s returns a valid template id", (role) => {const result = recommendTemplate({ role, use_case: null });expect(["coding", "planning", "writing", "assistant"]).toContain(result);});diff --git a/packages/core/onboarding/recommend-template.ts b/packages/core/onboarding/recommend-template.tsindex 24572c741a..9f787a4462 100644--- a/packages/core/onboarding/recommend-template.ts+++ b/packages/core/onboarding/recommend-template.ts@@ -1,41 +1,69 @@-import type { QuestionnaireAnswers } from "./types";+import type { QuestionnaireAnswers, Role, UseCase } from "./types";/**- * Identifier for the four agent templates offered during onboarding Step 4.- * Keep in sync with the template registry inside StepAgent in- * `packages/views/onboarding/steps/step-agent.tsx`.+ * Identifier for the four agent templates offered during onboarding+ * Step 6 (Agent). Keep in sync with the template registry inside+ * StepAgent in `packages/views/onboarding/steps/step-agent.tsx`.*/export type AgentTemplateId = "coding" | "planning" | "writing" | "assistant";/**- * Pick a recommended agent template for a user based on their- * questionnaire answers. Role is treated as the primary signal (who the- * user is); use_case is only a tiebreaker for roles that legitimately- * split between templates (developer / product_lead).+ * Pick a recommended agent template based on the v2 questionnaire+ * (role × use_case). Role is the primary signal; use_case is a+ * tiebreaker for roles that legitimately split between templates+ * (engineer / product / marketing).*- * `role = other` and `role = founder` both fall back to the generic- * Assistant: "other" means the user declined to claim a role, and- * "founder" means they wear every hat, so a single specialized agent is- * a poor default.+ * Fallback chain when role is skipped or null:+ * 1. Derive from use_case alone.+ * 2. Both unknown → `assistant` (the generic default).** Pure / deterministic — safe to call on every render.*/export function recommendTemplate(answers: Pick<QuestionnaireAnswers, "role" | "use_case">,): AgentTemplateId {- const { role, use_case } = answers;+ const role: Role | null = answers.role;+ const useCase: UseCase | null = answers.use_case;- if (role === "other" || role === "founder") return "assistant";- if (role === "writer") return "writing";+ if (role === null) return fallbackFromUseCase(useCase);- if (role === "developer") {- return use_case === "planning" ? "planning" : "coding";+ switch (role) {+ case "engineer":+ if (useCase === "manage_team" || useCase === "plan_research")+ return "planning";+ if (useCase === "write_publish") return "writing";+ return "coding";+ case "product":+ if (useCase === "ship_code") return "coding";+ return "planning";+ case "designer":+ return "assistant";+ case "writer":+ return "writing";+ case "marketing":+ if (useCase === "write_publish" || useCase === "plan_research")+ return "writing";+ return "planning";+ case "research":+ return "planning";+ case "founder":+ case "ops":+ case "student":+ case "other":+ return "assistant";}+}- if (role === "product_lead") {- return use_case === "coding" ? "coding" : "planning";+function fallbackFromUseCase(useCase: UseCase | null): AgentTemplateId {+ switch (useCase) {+ case "ship_code":+ return "coding";+ case "write_publish":+ return "writing";+ case "manage_team":+ case "plan_research":+ return "planning";+ default:+ return "assistant";}-- // Unknown / null role — user hasn't answered Q2 yet.- return "assistant";}diff --git a/packages/core/onboarding/step-order.ts b/packages/core/onboarding/step-order.tsindex 4e6d9d3b44..7bdac46e12 100644--- a/packages/core/onboarding/step-order.ts+++ b/packages/core/onboarding/step-order.ts@@ -15,7 +15,9 @@ import type { OnboardingStep } from "./types";* as progress toward completing setup.*/export const ONBOARDING_STEP_ORDER: readonly OnboardingStep[] = [- "questionnaire",+ "source",+ "role",+ "use_case","workspace","runtime","agent",diff --git a/packages/core/onboarding/store.ts b/packages/core/onboarding/store.tsindex 9857f14f9d..92a8d6c533 100644--- a/packages/core/onboarding/store.ts+++ b/packages/core/onboarding/store.ts@@ -4,14 +4,16 @@ import { setPersonProperties } from "../analytics";import type { OnboardingCompletionPath, QuestionnaireAnswers } from "./types";/**- * Persist Q1/Q2/Q3 answers and sync the refreshed user into the auth- * store. Source of truth is `user.onboarding_questionnaire` (JSONB on- * the server). No client-side cache here.+ * Persist questionnaire answers (one or more slots at a time — each+ * onboarding step PATCHes its own slot) and sync the refreshed user+ * into the auth store. Source of truth is+ * `user.onboarding_questionnaire` (JSONB on the server). No+ * client-side cache here.** Resume-by-step is intentionally not persisted: every onboarding- * entry starts at Welcome. The questionnaire is the only piece of- * progress that survives a re-entry — it pre-fills Step 1 so the- * user doesn't re-answer.+ * entry starts at Welcome. Answered slots are pre-filled on+ * re-entry; skipped slots are treated as fresh (the user can answer+ * this time).*/export async function saveQuestionnaire(answers: Partial<QuestionnaireAnswers>,@@ -19,12 +21,11 @@ export async function saveQuestionnaire(const user = await api.patchOnboarding({ questionnaire: answers });useAuthStore.getState().setUser(user);// Mirror the three cohort signals into person properties so every- // PostHog event on this user can be broken down by role / use_case /- // team_size without re-joining the DB. Matches the $set block the- // server writes alongside `onboarding_questionnaire_submitted`.- if (answers.team_size || answers.role || answers.use_case) {+ // PostHog event on this user can be broken down by source / role /+ // use_case without re-joining the DB.+ if (answers.source || answers.role || answers.use_case) {setPersonProperties({- ...(answers.team_size ? { team_size: answers.team_size } : {}),+ ...(answers.source ? { source: answers.source } : {}),...(answers.role ? { role: answers.role } : {}),...(answers.use_case ? { use_case: answers.use_case } : {}),});diff --git a/packages/core/onboarding/types.ts b/packages/core/onboarding/types.tsindex 192cc48762..bf6539d5fa 100644--- a/packages/core/onboarding/types.ts+++ b/packages/core/onboarding/types.ts@@ -1,6 +1,8 @@export type OnboardingStep =| "welcome"- | "questionnaire"+ | "source"+ | "role"+ | "use_case"| "workspace"| "runtime"| "agent"@@ -13,33 +15,64 @@ export type OnboardingStep =* `OnboardingPath*` constants in `server/internal/analytics/events.go`.*/export type OnboardingCompletionPath =- | "full" // Reached Step 5 (first_issue) with a runtime connected- | "runtime_skipped" // Step 3 skipped (no runtime) but still completed- | "cloud_waitlist" // Submitted the cloud waitlist form and skipped Step 3- | "skip_existing" // "I've done this before" from Welcome- | "invite_accept"; // Accepted at least one invite from /invitations+ | "full"+ | "runtime_skipped"+ | "cloud_waitlist"+ | "skip_existing"+ | "invite_accept";-export type TeamSize = "solo" | "team" | "other";+export type Source =+ | "friends_colleagues"+ | "search"+ | "social_x"+ | "social_linkedin"+ | "social_youtube"+ | "social_other"+ | "blog_newsletter"+ | "ai_assistant"+ | "from_work"+ | "event_conference"+ | "dont_remember"+ | "other";export type Role =- | "developer"- | "product_lead"- | "writer"+ | "engineer"+ | "product"+ | "designer"| "founder"+ | "marketing"+ | "writer"+ | "research"+ | "ops"+ | "student"| "other";export type UseCase =- | "coding"- | "planning"- | "writing_research"- | "explore"+ | "ship_code"+ | "manage_team"+ | "personal_tasks"+ | "plan_research"+ | "write_publish"+ | "automate_ops"+ | "evaluate"| "other";+/**+ * v2 questionnaire shape. `*_skipped: true` distinguishes an explicit+ * Skip click from a slot the user never reached. Both states are+ * "unknown" for recommendation purposes; the skip marker exists for+ * analytics and so future re-prompts can avoid nagging users who+ * already declined.+ */export interface QuestionnaireAnswers {- team_size: TeamSize | null;- team_size_other: string | null;+ source: Source | null;+ source_other: string | null;+ source_skipped: boolean;role: Role | null;role_other: string | null;+ role_skipped: boolean;use_case: UseCase | null;use_case_other: string | null;+ use_case_skipped: boolean;+ version: 2;}diff --git a/packages/views/locales/en/onboarding.json b/packages/views/locales/en/onboarding.jsonindex 23b97c39d5..e01e509e99 100644--- a/packages/views/locales/en/onboarding.json+++ b/packages/views/locales/en/onboarding.json@@ -38,56 +38,78 @@},"common": {"back": "Back",- "continue": "Continue"+ "continue": "Continue",+ "skip": "Skip",+ "cancel": "Cancel"},- "questionnaire": {- "eyebrow": "Before we start",- "headline": "Three questions to get to know you.",- "q1_question": "Who will use this workspace?",- "q1_solo": "Just me",- "q1_team": "My team (2–10 people)",- "q1_other_placeholder": "e.g. a small community I help run",- "q2_question": "What best describes you?",- "q2_developer": "Software developer",- "q2_product_lead": "Product or project lead",- "q2_writer": "Writer or content creator",- "q2_founder": "Founder or operator",- "q2_other_placeholder": "e.g. researcher, designer, ops lead",- "q3_question": "What do you want to do with Multica?",- "q3_coding": "Write and ship code",- "q3_planning": "Plan and manage projects",- "q3_writing_research": "Research or write",- "q3_explore": "I'm just exploring for now",- "q3_other_placeholder": "e.g. automate my weekly reports",- "answered_progress": "{{count}} of 3 answered",- "why_eyebrow": "Why three questions",- "why_headline": "So you land running.",- "what_eyebrow": "What you get",- "unlock_starter_title": "A starter project, tailored",- "unlock_starter_body": "A Getting Started checklist shaped by your answers.",- "unlock_agents_title": "A head start with agents",- "unlock_agents_body": "Connect a runtime and we'll pick a template for your role — plus write its first task.",- "learn_more": "Learn how agents work →"+ "questions": {+ "eyebrow_about_you": "About you",+ "source": {+ "question": "How did you hear about Multica?",+ "friends_colleagues": "Friends or colleagues",+ "search": "Google / search",+ "social_x": "X / Twitter",+ "social_linkedin": "LinkedIn",+ "social_youtube": "YouTube",+ "social_misc": "Other social",+ "blog_newsletter": "Blog / newsletter",+ "ai_assistant": "ChatGPT / Claude / Cursor",+ "from_work": "At work",+ "event_conference": "Conference / meetup",+ "dont_remember": "Don't remember",+ "other": "Other",+ "other_placeholder": "e.g. a podcast I listen to"+ },+ "role": {+ "question": "Which best describes you?",+ "engineer": "Engineer / developer",+ "product": "Product manager",+ "designer": "Designer",+ "founder": "Founder / exec",+ "marketing": "Marketing / growth",+ "writer": "Writer / content",+ "research": "Researcher / analyst",+ "ops": "Operations / project mgmt",+ "student": "Student / personal use",+ "other": "Other",+ "other_placeholder": "e.g. teacher, support lead"+ },+ "use_case": {+ "question": "What do you want to use Multica for?",+ "ship_code": "Ship code with AI agents",+ "manage_team": "Manage tasks for my team",+ "personal_tasks": "Organize my own tasks",+ "plan_research": "Plan, brainstorm, research",+ "write_publish": "Write, edit, publish",+ "automate_ops": "Automate ops & workflows",+ "evaluate": "Just exploring",+ "other": "Other",+ "other_placeholder": "e.g. study group coordination"+ }},"option_card": {"other_label": "Other","other_aria": "Describe something else"},+ "step_question": {+ "hint_pick": "Pick one to continue — or skip if you'd rather not say.",+ "hint_continue": "Looks good. Hit Continue when you're ready."+ },"runtime_aside": {- "what_eyebrow": "What's a runtime?",- "what_prefix": "A ",- "what_term": "runtime",- "what_suffix": " pairs the daemon (a background process on your machine) with one AI coding tool — Claude Code, Codex, and so on. If you have several tools installed, you'll see one runtime per tool. The runtime is what actually executes the tasks your agents pick up.",+ "what_eyebrow": "What's an agent runtime?",+ "what_prefix": "The \"computer\" you connect is what we internally call an ",+ "what_term": "agent runtime",+ "what_suffix": ": a small background process on the computer paired with one AI coding tool — Claude Code, Codex, and so on. One tool, one agent runtime. The agent runtime is what actually executes the tasks your agent picks up.","good_eyebrow": "Good to know","swap_title": "Swap anytime","swap_body": "Each agent's runtime is just a setting. Change it whenever you want.","add_more_title": "Add more later",- "add_more_body": "You can connect a second runtime on another machine for a team, or a dedicated one per agent.",- "learn_more": "Learn about runtimes →"+ "add_more_body": "You can connect another computer for a teammate, or a dedicated one per agent.",+ "learn_more": "Learn about agent runtimes →"},"cli_install": {"copy_aria": "Copy",- "intro": "You'll need an AI coding tool on this machine (Claude Code, Codex, Cursor, …) for the daemon to do real work. Also works on servers and remote dev boxes.",+ "intro": "You'll need an agent runtime on this computer (Claude Code, Codex, Cursor, …) for it to run your agent. Also works on servers and remote dev boxes.","step1_label": "Install the Multica CLI","step2_label": "Start the daemon"},@@ -209,7 +231,7 @@"perk_chat": "Chat with any agent without creating an issue","perk_invite": "Invite teammates — they see only this workspace","perk_switch": "Switch to other workspaces anytime from the top-left",- "next_runtime": "Connect a runtime so your agents have somewhere to run",+ "next_runtime": "Connect a computer so your agents have somewhere to run","next_agent": "Create your first agent matched to your role","next_starter": "Watch it pick up a starter task and reply","preview": {@@ -232,75 +254,68 @@}},"step_runtime": {- "scanning_headline": "Looking for your tools…",- "scanning_lede_prefix": "Multica drives local AI coding tools like ",- "scanning_lede_suffix": ", and others. We're waiting to hear back from your machine about which ones are installed.",- "found_headline": "We found your runtimes.",- "found_lede": "We scanned your machine for AI coding tools you've already set up. Pick one for your first agent.",- "runtime_count_one": "{{count}} runtime",- "runtime_count_other": "{{count}} runtimes",+ "scanning_headline": "Connecting this computer…",+ "scanning_lede_prefix": "Your agent works through an AI coding tool you already have — like ",+ "scanning_lede_suffix": ", and others. We're checking this computer for ones you've installed.",+ "found_headline": "This computer is connected. Pick an agent runtime.",+ "found_lede": "These are the agent runtimes we found on this computer. Pick one for your first agent — you can switch or add more later.",+ "runtime_count_one": "{{count}} agent runtime",+ "runtime_count_other": "{{count}} agent runtimes","status_all_online": "all online","status_none_online": "none online","status_n_online": "{{count}} online","online_label": "online","offline_label": "offline",- "empty_headline": "No supported tools detected.",- "empty_lede_prefix": "Multica drives local AI coding tools like ",- "empty_lede_suffix": ", and others — we didn't find any on this machine. Install one and come back, or pick a path below.",+ "empty_headline": "No agent runtime found on this computer yet.",+ "empty_lede_prefix": "An agent runtime is an AI coding tool we connect to — like ",+ "empty_lede_suffix": ". Install one and refresh, or pick a path below.","empty_skip_title": "Skip for now",- "empty_skip_subtitle": "Enter your workspace in read-only mode. Agents can't execute tasks until a runtime connects — but you can still browse, plan, and invite teammates.",+ "empty_skip_subtitle": "Enter your workspace in read-only mode. Your agent can't run tasks until an agent runtime is connected on this computer — but you can still browse, plan, and invite teammates.","empty_skip_action": "Skip",- "empty_waitlist_title": "Join the cloud runtime waitlist",- "empty_waitlist_subtitle": "We'll host the runtime for you — no local install, no setup. Not live yet; click to leave your email and get notified.",- "empty_waitlist_action": "Join waitlist",- "empty_waitlist_done": "On the waitlist",- "empty_install_link": "Install an agent runtime →",- "dialog_title": "Join the cloud runtime waitlist",- "dialog_description": "Cloud runtimes aren't live yet. Leave your email and we'll email you when they are.",- "dialog_close": "Close",- "dialog_cancel": "Cancel",+ "empty_waitlist_title": "Use a cloud computer",+ "empty_waitlist_subtitle": "We'll run a computer for you in the cloud. Not live yet.",+ "empty_waitlist_action": "Coming soon","skip": "Skip for now",+ "refresh": "Refresh",+ "refreshing": "Refreshing…","hint_selected": "Selected: {{name}}",- "hint_pick": "Pick a runtime above to continue.",+ "hint_pick": "Pick an agent runtime above to continue.","hint_waiting": "Waiting for the first result…",- "hint_waitlist_done": "You're on the waitlist — skip to keep exploring.",- "hint_skip_or_waitlist": "Skip to enter your workspace, or join the cloud waitlist above."+ "hint_skip_or_refresh": "Refresh after installing one, or skip to enter your workspace."},"step_platform": {- "eyebrow": "Step 3 · Runtime",- "headline": "Pick a runtime source.",- "lede": "A runtime is where your agents' tasks actually execute. Pick how you'd like to install one on this machine.",- "hint_default": "Pick a path above — or skip and configure a runtime later.",+ "eyebrow": "Connect a computer",+ "headline": "Connect a computer to run your agent.",+ "lede": "Your agent runs on a real computer that you connect to Multica. Pick how you want to connect one.",+ "hint_default": "Pick a way to connect — or skip and connect a computer later.","hint_downloaded": "Finish setup on the download page, then come back to this tab.",- "hint_waitlist": "You're on the waitlist — pick Skip to keep exploring.",- "download_title": "Download the desktop app",- "download_title_after": "Continuing on the download page…",- "download_subtitle": "Bundled daemon, zero setup. Pick your platform on the next page.",+ "download_title": "Use this computer",+ "download_title_after": "Opening the download page…",+ "download_subtitle": "Install our desktop app to connect this computer. Zero setup — pick your platform on the next page.","download_subtitle_after": "Opened in a new tab. Pick your installer there, then finish setup on desktop.","download_button": "Download",- "cli_title": "Install the CLI",- "cli_subtitle": "For servers, remote dev boxes, and headless setups. Terminal required.",+ "cli_title": "Connect from the terminal",+ "cli_subtitle": "Connect a server, remote dev box, or any headless computer. Terminal required.","cli_action": "Show steps",- "cloud_title": "Cloud runtime",- "cloud_subtitle": "We host the runtime. Not live yet — join the waitlist.",- "cloud_action": "Join waitlist",- "cloud_action_done": "On the list",- "cli_dialog_title": "Install the CLI",- "cli_dialog_description": "Same daemon as Desktop, installed via terminal. Use it when Desktop doesn't fit — servers, remote dev boxes, or headless setups.",- "cli_dialog_pick_hint": "Pick a runtime above.",+ "cloud_title": "Use a cloud computer",+ "cloud_subtitle": "We'll run a computer for you in the cloud. Not live yet.",+ "cloud_action": "Coming soon",+ "cli_dialog_title": "Connect from the terminal",+ "cli_dialog_description": "Same connection as Desktop, set up from the terminal. Use it for servers, remote dev boxes, or any headless computer.",+ "cli_dialog_pick_hint": "Pick a computer above.","cli_dialog_connect": "Connect & continue",- "runtimes_connected_one": "{{count}} runtime connected",- "runtimes_connected_other": "{{count}} runtimes connected",- "live_listening": "Live · Listening for your daemon",+ "runtimes_connected_one": "{{count}} computer connected",+ "runtimes_connected_other": "{{count}} computers connected",+ "live_listening": "Live · Waiting for your computer","stage_normal_prefix": "Run the command above. As soon as ",- "stage_normal_suffix": " finishes browser sign-in and the daemon starts, your runtime will appear here automatically (usually 10–30 seconds).",+ "stage_normal_suffix": " finishes browser sign-in, your computer will appear here automatically (usually 10–30 seconds).","stage_midway_prefix": "Still listening. Make sure you finished the browser tab that ",- "stage_midway_suffix": " opened — it needs you to approve the sign-in before the daemon can start.",+ "stage_midway_suffix": " opened — it needs you to approve sign-in before your computer can connect.","stage_slow_prefix": "Taking longer than usual. Check the terminal where you ran ","stage_slow_suffix": " for errors.","stage_stalled_prefix": "Nothing coming through yet. If you're not comfortable with the terminal, ","stage_stalled_term": "Desktop",- "stage_stalled_suffix": " is the smoother path — it bundles the daemon. Close this dialog and pick Desktop, or hit Skip to continue."+ "stage_stalled_suffix": " is the smoother path — one click and this computer is connected. Close this dialog and pick Desktop, or hit Skip to continue."},"errors": {"skip_failed": "Failed to finish onboarding"diff --git a/packages/views/locales/zh-Hans/onboarding.json b/packages/views/locales/zh-Hans/onboarding.jsonindex e1c9f94fa1..5bfa907f13 100644--- a/packages/views/locales/zh-Hans/onboarding.json+++ b/packages/views/locales/zh-Hans/onboarding.json@@ -38,56 +38,78 @@},"common": {"back": "返回",- "continue": "继续"+ "continue": "继续",+ "skip": "跳过",+ "cancel": "取消"},- "questionnaire": {- "eyebrow": "开始之前",- "headline": "三个问题,更了解你。",- "q1_question": "谁会用这个工作区?",- "q1_solo": "只有我自己",- "q1_team": "我的团队(2–10 人)",- "q1_other_placeholder": "例如:我维护的一个小社区",- "q2_question": "哪个最贴近你?",- "q2_developer": "软件开发者",- "q2_product_lead": "产品或项目负责人",- "q2_writer": "写作者或内容创作者",- "q2_founder": "创始人或运营",- "q2_other_placeholder": "例如:研究员、设计师、运营负责人",- "q3_question": "你想用 Multica 做什么?",- "q3_coding": "写代码、发版",- "q3_planning": "规划和管理项目",- "q3_writing_research": "研究或写作",- "q3_explore": "暂时只是探索",- "q3_other_placeholder": "例如:自动化每周报告",- "answered_progress": "已回答 {{count}} / 3",- "why_eyebrow": "为什么是三问",- "why_headline": "让你一上手就能跑。",- "what_eyebrow": "你会得到",- "unlock_starter_title": "为你定制的入门项目",- "unlock_starter_body": "根据你的回答生成的\"上手清单\"。",- "unlock_agents_title": "智能体抢跑",- "unlock_agents_body": "连接一个运行时,按你的角色挑选模板 —— 顺手把第一个 task 也写好。",- "learn_more": "了解智能体怎么工作 →"+ "questions": {+ "eyebrow_about_you": "关于你",+ "source": {+ "question": "你是从哪里了解到 Multica 的?",+ "friends_colleagues": "朋友或同事",+ "search": "Google / 搜索",+ "social_x": "X / Twitter",+ "social_linkedin": "LinkedIn",+ "social_youtube": "YouTube",+ "social_misc": "其他社区",+ "blog_newsletter": "博客 / Newsletter",+ "ai_assistant": "ChatGPT / Claude / Cursor 推荐",+ "from_work": "工作场景接触到",+ "event_conference": "线下活动 / Meetup",+ "dont_remember": "想不起来了",+ "other": "其他",+ "other_placeholder": "例如:一档播客"+ },+ "role": {+ "question": "你是什么角色?",+ "engineer": "工程师 / 开发者",+ "product": "产品经理",+ "designer": "设计师",+ "founder": "创始人 / 高管",+ "marketing": "市场 / 增长",+ "writer": "写作 / 内容",+ "research": "研究员 / 分析师",+ "ops": "运营 / 项目管理",+ "student": "学生 / 个人使用",+ "other": "其他",+ "other_placeholder": "例如:教师、支持负责人"+ },+ "use_case": {+ "question": "你打算用 Multica 做什么?",+ "ship_code": "让 AI agent 帮我写代码",+ "manage_team": "给团队做任务管理",+ "personal_tasks": "管理我自己的任务",+ "plan_research": "计划、头脑风暴、调研",+ "write_publish": "写作、编辑、发布",+ "automate_ops": "自动化日常运营",+ "evaluate": "先逛逛看看",+ "other": "其他",+ "other_placeholder": "例如:协调学习小组"+ }},"option_card": {"other_label": "其他","other_aria": "描述其他选项"},+ "step_question": {+ "hint_pick": "选一项继续 —— 不想说也可以跳过。",+ "hint_continue": "可以了。准备好就点继续。"+ },"runtime_aside": {- "what_eyebrow": "什么是运行时?",- "what_prefix": "",- "what_term": "运行时",- "what_suffix": "是守护进程和一款 AI 编程工具(Claude Code、Codex 等)的组合——一台机器装了多款工具就会出现多个运行时。它代替智能体执行接到的 task。",+ "what_eyebrow": "什么是 agent 运行时?",+ "what_prefix": "你连接的「电脑」就是我们内部所说的 ",+ "what_term": "agent 运行时",+ "what_suffix": ":电脑上的一个小型后台进程,配上一款 AI 编程工具(Claude Code、Codex 等)。一款工具对应一个 agent 运行时。它代替你的智能体执行接到的 task。","good_eyebrow": "需要知道","swap_title": "随时切换","swap_body": "每个智能体的运行时只是一个设置。想换就换。","add_more_title": "之后再加",- "add_more_body": "可以在另一台机器上连接第二个运行时给团队用,或每个智能体配一个专用运行时。",- "learn_more": "了解运行时 →"+ "add_more_body": "可以为团队再连接一台电脑,或给每个智能体一台专属电脑。",+ "learn_more": "了解 agent 运行时 →"},"cli_install": {"copy_aria": "复制",- "intro": "守护进程需要本机有一个 AI 编程工具(Claude Code、Codex、Cursor 等)才能执行真实工作。也支持服务器和远程开发机。",+ "intro": "这台电脑上需要装一个 agent 运行时(Claude Code、Codex、Cursor 等)才能运行你的智能体。也支持服务器和远程开发机。","step1_label": "安装 Multica CLI","step2_label": "启动守护进程"},@@ -209,7 +231,7 @@"perk_chat": "无需创建 issue,直接和任意智能体对话","perk_invite": "邀请同事 —— 他们只会看到这个工作区","perk_switch": "随时从左上角切换到其他工作区",- "next_runtime": "连接一个运行时,给智能体一个跑的地方",+ "next_runtime": "连接一台电脑,给智能体一个跑的地方","next_agent": "创建符合你角色的第一个智能体","next_starter": "看它接下入门 task 并回复","preview": {@@ -228,77 +250,70 @@"skills_label": "skill","skills_meta": "可复用的剧本","more_label": "更多",- "more_meta": "and more"+ "more_meta": "等等"}},"step_runtime": {- "scanning_headline": "正在寻找你的工具...",- "scanning_lede_prefix": "Multica 驱动本地的 AI 编程工具,比如 ",- "scanning_lede_suffix": " 等。等待你机器上的反馈中。",- "found_headline": "找到了你的运行时。",- "found_lede": "扫描到你机器上已经设置好的 AI 编码工具。挑一个给你的第一个智能体。",- "runtime_count_other": "{{count}} 个运行时",+ "scanning_headline": "正在连接这台电脑…",+ "scanning_lede_prefix": "你的智能体借助本机已安装的 AI 编程工具运行,例如 ",+ "scanning_lede_suffix": " 等。我们正在检测这台电脑上装了哪些。",+ "found_headline": "这台电脑已连接。选一个 agent 运行时。",+ "found_lede": "以下是在这台电脑上找到的 agent 运行时。挑一个支撑你的第一个智能体 —— 之后可以随时切换或再加。",+ "runtime_count_other": "{{count}} 个 agent 运行时","status_all_online": "全部在线","status_none_online": "全部离线","status_n_online": "{{count}} 个在线","online_label": "在线","offline_label": "离线",- "empty_headline": "未检测到支持的工具。",- "empty_lede_prefix": "Multica 驱动本地的 AI 编程工具,比如 ",- "empty_lede_suffix": " 等 —— 这台机器上没找到。装一个再回来,或在下面挑一条路。",+ "empty_headline": "这台电脑上还没有可用的 agent 运行时。",+ "empty_lede_prefix": "agent 运行时是我们接管的 AI 编程工具,比如 ",+ "empty_lede_suffix": "。装好其中之一后点刷新,或在下面挑一条路。","empty_skip_title": "暂时跳过",- "empty_skip_subtitle": "进入工作区(只读模式)。没有运行时连接前,智能体无法执行 task —— 但你仍可以浏览、规划、邀请同事。",+ "empty_skip_subtitle": "进入工作区(只读模式)。在这台电脑上连接 agent 运行时之前,智能体无法执行 task —— 但你仍可以浏览、规划、邀请同事。","empty_skip_action": "跳过",- "empty_waitlist_title": "加入云运行时候补",- "empty_waitlist_subtitle": "由 Multica 托管运行时 —— 无需本地安装,无需配置。尚未上线,点击留下邮箱。",- "empty_waitlist_action": "加入候补",- "empty_waitlist_done": "已在候补",- "empty_install_link": "安装一个 Agent 运行时 →",- "dialog_title": "加入云运行时候补名单",- "dialog_description": "云运行时尚未上线。留下邮箱,上线时通过邮件通知你。",- "dialog_close": "关闭",- "dialog_cancel": "取消",+ "empty_waitlist_title": "改用云电脑",+ "empty_waitlist_subtitle": "我们会在云上为你运行一台电脑。尚未上线。",+ "empty_waitlist_action": "即将推出","skip": "暂时跳过",+ "refresh": "刷新",+ "refreshing": "正在刷新…","hint_selected": "已选择:{{name}}",- "hint_pick": "在上方选一个运行时继续。",+ "hint_pick": "在上方选一个 agent 运行时继续。","hint_waiting": "等待第一个结果...",- "hint_waitlist_done": "已在候补名单 —— 跳过即可继续探索。",- "hint_skip_or_waitlist": "跳过进入工作区,或在上方加入云候补。"+ "hint_skip_or_refresh": "装好后点刷新,或跳过进入工作区。"},"step_platform": {- "eyebrow": "第 3 步 · 运行时",- "headline": "挑一个运行时来源。",- "lede": "运行时是智能体真正执行 task 的地方。挑一种安装方式让本机出现一个运行时。",- "hint_default": "在上方挑一条路 —— 或跳过,之后再配置运行时。",+ "eyebrow": "连接一台电脑",+ "headline": "连接一台电脑来运行你的智能体。",+ "lede": "你的智能体运行在你连接到 Multica 的一台真实电脑上。选一种你想要的连接方式。",+ "hint_default": "在上方选一种方式 —— 或先跳过,之后再连接电脑。","hint_downloaded": "在下载页完成安装,然后回到此标签页。",- "hint_waitlist": "已在候补名单 —— 选择\"跳过\"继续探索。",- "download_title": "下载桌面端",- "download_title_after": "已在下载页继续...",- "download_subtitle": "内置守护进程,零配置。下一页选你的平台。",+ "download_title": "使用这台电脑",+ "download_title_after": "正在打开下载页...",+ "download_subtitle": "安装我们的桌面端来连接这台电脑。零配置 —— 下一页选你的平台。","download_subtitle_after": "已在新标签页打开。在那里选安装包,然后在桌面端完成设置。","download_button": "下载",- "cli_title": "安装 CLI",- "cli_subtitle": "适合服务器、远程开发机和无头环境。需要终端。",+ "cli_title": "通过终端连接",+ "cli_subtitle": "连接一台服务器、远程开发机或任意无头电脑。需要终端。","cli_action": "查看步骤",- "cloud_title": "云运行时",- "cloud_subtitle": "由 Multica 托管运行时。尚未上线 —— 加入候补。",- "cloud_action": "加入候补",- "cloud_action_done": "已在名单",- "cli_dialog_title": "安装 CLI",- "cli_dialog_description": "和桌面端相同的守护进程,通过终端安装。当桌面端不合适时使用 —— 服务器、远程开发机或无头环境。",- "cli_dialog_pick_hint": "在上方选择一个运行时。",+ "cloud_title": "使用云电脑",+ "cloud_subtitle": "我们会在云上为你运行一台电脑。尚未上线。",+ "cloud_action": "即将推出",+ "cli_dialog_title": "通过终端连接",+ "cli_dialog_description": "和桌面端相同的连接,通过终端配置。适用于服务器、远程开发机或任意无头电脑。",+ "cli_dialog_pick_hint": "在上方选一台电脑。","cli_dialog_connect": "连接并继续",- "runtimes_connected_other": "已连接 {{count}} 个运行时",- "live_listening": "实时 · 正在监听你的守护进程",+ "runtimes_connected_other": "已连接 {{count}} 台电脑",+ "live_listening": "实时 · 正在等待你的电脑","stage_normal_prefix": "运行上面的命令。当 ",- "stage_normal_suffix": " 完成浏览器登录、守护进程启动后,你的运行时会自动出现在这里(通常 10–30 秒)。",+ "stage_normal_suffix": " 完成浏览器登录后,你的电脑会自动出现在这里(通常 10–30 秒)。","stage_midway_prefix": "仍在监听。请确保完成了 ",- "stage_midway_suffix": " 打开的浏览器标签页 —— 必须批准登录才能启动守护进程。",+ "stage_midway_suffix": " 打开的浏览器标签页 —— 需要批准登录后,你的电脑才能连接。","stage_slow_prefix": "比平时慢一些。请检查运行 ","stage_slow_suffix": " 的终端是否有错误。","stage_stalled_prefix": "还没有任何信号传来。如果你不太习惯终端,","stage_stalled_term": "桌面端",- "stage_stalled_suffix": " 更顺手 —— 它内置守护进程。关闭这个对话框选择桌面端,或点跳过继续。"+ "stage_stalled_suffix": " 更顺手 —— 一键搞定,这台电脑就连接好了。关闭这个对话框选择桌面端,或点跳过继续。"},"errors": {"skip_failed": "完成上手引导失败"diff --git a/packages/views/onboarding/components/brand-icons.tsx b/packages/views/onboarding/components/brand-icons.tsxnew file mode 100644index 0000000000..f41a4a410a--- /dev/null+++ b/packages/views/onboarding/components/brand-icons.tsx@@ -0,0 +1,73 @@+"use client";++import type { SVGProps } from "react";++type IconProps = Omit<SVGProps<SVGSVGElement>, "children">;++export function GoogleIcon(props: IconProps) {+ return (+ <svg viewBox="0 0 24 24" aria-hidden {...props}>+ <path+ d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"+ fill="#4285F4"+ />+ <path+ d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.99.66-2.25 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84A11 11 0 0 0 12 23z"+ fill="#34A853"+ />+ <path+ d="M5.84 14.1A6.6 6.6 0 0 1 5.5 12c0-.73.13-1.44.34-2.1V7.07H2.18a11 11 0 0 0 0 9.87l3.66-2.84z"+ fill="#FBBC05"+ />+ <path+ d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84C6.71 7.31 9.14 5.38 12 5.38z"+ fill="#EA4335"+ />+ </svg>+ );+}++export function XIcon(props: IconProps) {+ return (+ <svg viewBox="0 0 24 24" aria-hidden {...props}>+ <path+ d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"+ fill="currentColor"+ />+ </svg>+ );+}++export function LinkedInIcon(props: IconProps) {+ return (+ <svg viewBox="0 0 24 24" aria-hidden {...props}>+ <path+ d="M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.34V9h3.42v1.56h.05A3.75 3.75 0 0 1 16.18 8.7c3.61 0 4.28 2.38 4.28 5.47v6.28zM5.34 7.43a2.07 2.07 0 1 1 0-4.14 2.07 2.07 0 0 1 0 4.14zM7.12 20.45H3.56V9h3.56v11.45zM22.22 0H1.77C.79 0 0 .77 0 1.72v20.56C0 23.23.8 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.72V1.72C24 .77 23.2 0 22.22 0z"+ fill="#0A66C2"+ />+ </svg>+ );+}++export function YouTubeIcon(props: IconProps) {+ return (+ <svg viewBox="0 0 24 24" aria-hidden {...props}>+ <path+ d="M23.5 6.2a3 3 0 0 0-2.12-2.12C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.38.48A3 3 0 0 0 .5 6.2C.02 8.08.02 12 .02 12s0 3.92.48 5.8a3 3 0 0 0 2.12 2.12c1.88.48 9.38.48 9.38.48s7.5 0 9.38-.48a3 3 0 0 0 2.12-2.12c.48-1.88.48-5.8.48-5.8s0-3.92-.48-5.8z"+ fill="#FF0000"+ />+ <path d="M9.6 15.6V8.4l6.24 3.6z" fill="#fff" />+ </svg>+ );+}++export function OpenAIIcon(props: IconProps) {+ return (+ <svg viewBox="0 0 24 24" aria-hidden {...props}>+ <path+ d="M22.28 9.83a5.93 5.93 0 0 0-.51-4.86 6 6 0 0 0-6.46-2.88A6 6 0 0 0 4.98 4.18a5.93 5.93 0 0 0-3.96 2.87 6 6 0 0 0 .74 7.04 5.93 5.93 0 0 0 .51 4.86 6 6 0 0 0 6.46 2.88 5.99 5.99 0 0 0 10.33-2.09 5.93 5.93 0 0 0 3.96-2.87 6 6 0 0 0-.74-7.04zM13.4 21.13a4.45 4.45 0 0 1-2.86-1.03l.14-.08 4.74-2.74a.78.78 0 0 0 .39-.67v-6.68l2 1.16v5.55a4.45 4.45 0 0 1-4.41 4.49zM3.93 17.1a4.43 4.43 0 0 1-.53-2.97l.14.08 4.74 2.74a.78.78 0 0 0 .78 0l5.79-3.34v2.31a.07.07 0 0 1-.03.06l-4.8 2.77a4.46 4.46 0 0 1-6.09-1.65zm-1.25-10.3a4.44 4.44 0 0 1 2.32-1.95v5.66a.77.77 0 0 0 .39.67l5.78 3.33-2 1.16-4.79-2.77a4.46 4.46 0 0 1-1.7-6.1zm16.46 3.83-5.78-3.36 2-1.15 4.78 2.76a4.45 4.45 0 0 1-.67 8.05V11.3a.78.78 0 0 0-.33-.67zm1.99-3-.14-.08-4.73-2.76a.78.78 0 0 0-.78 0L9.68 8.13V5.82a.07.07 0 0 1 .03-.07l4.79-2.76a4.46 4.46 0 0 1 6.63 4.62zM8.59 13.32l-2-1.15V6.62a4.45 4.45 0 0 1 7.31-3.42l-.14.08-4.74 2.74a.78.78 0 0 0-.39.67zm1.09-2.35L12.25 9.5l2.58 1.48v2.97L12.25 15.4l-2.57-1.48z"+ fill="currentColor"+ />+ </svg>+ );+}diff --git a/packages/views/onboarding/components/icon-option-card.tsx b/packages/views/onboarding/components/icon-option-card.tsxnew file mode 100644index 0000000000..89a8a19752--- /dev/null+++ b/packages/views/onboarding/components/icon-option-card.tsx@@ -0,0 +1,124 @@+"use client";++import type { ReactNode } from "react";+import { cn } from "@multica/ui/lib/utils";++const OTHER_INPUT_MAX_LENGTH = 80;++/**+ * Card-grid option used by the per-question questionnaire steps+ * (Source / Role / Use case). One row = icon + label. Clicking the+ * card selects it; the parent step decides when to advance (an+ * explicit Continue button gates the transition so users can change+ * their mind before committing). The `Other` variant swaps its+ * label area for a free-text input when selected.+ */+export function IconOptionCard({+ icon,+ label,+ selected,+ onSelect,+}: {+ icon: ReactNode;+ label: string;+ selected: boolean;+ onSelect: () => void;+}) {+ return (+ <button+ type="button"+ role="radio"+ aria-checked={selected}+ onClick={onSelect}+ className={cn(+ "group flex w-full items-center gap-3 rounded-xl border bg-card px-4 py-3 text-left transition-all",+ selected+ ? "border-foreground shadow-[inset_0_0_0_1px_var(--color-foreground)]"+ : "hover:border-foreground/30 hover:bg-accent/30",+ )}+ >+ <span+ aria-hidden+ className="flex h-7 w-7 shrink-0 items-center justify-center text-[18px] leading-none text-foreground"+ >+ {icon}+ </span>+ <span className="text-[14px] font-medium leading-tight text-foreground">+ {label}+ </span>+ </button>+ );+}++/**+ * "Other" variant — when selected, the label slot is replaced by a+ * borderless text input that inherits the card's typography so the+ * row keeps the same visual weight as the other cards. Auto-focuses+ * on open; Enter triggers the parent's `onConfirm`.+ */+export function IconOtherOptionCard({+ icon,+ label,+ selected,+ onSelect,+ otherValue,+ onOtherChange,+ onConfirm,+ placeholder,+}: {+ icon: ReactNode;+ label: string;+ selected: boolean;+ onSelect: () => void;+ otherValue: string;+ onOtherChange: (value: string) => void;+ onConfirm: () => void;+ placeholder: string;+}) {+ return (+ <div+ role="radio"+ aria-checked={selected}+ onClick={() => {+ if (!selected) onSelect();+ }}+ className={cn(+ "flex w-full items-center gap-3 rounded-xl border bg-card px-4 py-3 text-left transition-all",+ selected+ ? "border-foreground shadow-[inset_0_0_0_1px_var(--color-foreground)]"+ : "cursor-pointer hover:border-foreground/30 hover:bg-accent/30",+ )}+ >+ <span+ aria-hidden+ className="flex h-7 w-7 shrink-0 items-center justify-center text-[18px] leading-none text-foreground"+ >+ {icon}+ </span>+ {selected ? (+ <input+ autoFocus+ type="text"+ value={otherValue}+ onChange={(e) => onOtherChange(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter" && otherValue.trim()) {+ e.preventDefault();+ onConfirm();+ }+ }}+ placeholder={placeholder}+ maxLength={OTHER_INPUT_MAX_LENGTH}+ aria-label={placeholder}+ className="min-w-0 flex-1 border-0 bg-transparent p-0 text-[14px] font-medium leading-tight text-foreground placeholder:text-muted-foreground/60 focus:outline-none"+ />+ ) : (+ <span className="text-[14px] font-medium leading-tight text-foreground">+ {label}+ </span>+ )}+ </div>+ );+}++export { OTHER_INPUT_MAX_LENGTH };diff --git a/packages/views/onboarding/components/runtime-aside-panel.tsx b/packages/views/onboarding/components/runtime-aside-panel.tsxindex 68cb5d3eac..d80afd186b 100644--- a/packages/views/onboarding/components/runtime-aside-panel.tsx+++ b/packages/views/onboarding/components/runtime-aside-panel.tsx@@ -11,7 +11,10 @@ import { useT } from "../../i18n";* editorial shell's `<aside>` column.*/export function RuntimeAsidePanel() {- const { t } = useT("onboarding");+ const { t, i18n } = useT("onboarding");+ const installDocHref = i18n.language?.startsWith("zh")+ ? "https://multica.ai/docs/zh/install-agent-runtime"+ : "https://multica.ai/docs/install-agent-runtime";return (<div className="flex flex-col gap-6"><section>@@ -44,7 +47,7 @@ export function RuntimeAsidePanel() {</section><a- href="https://multica.ai/docs/daemon-runtimes"+ href={installDocHref}target="_blank"rel="noopener noreferrer"className="self-start text-[13px] text-muted-foreground underline underline-offset-4 transition-colors hover:text-foreground"diff --git a/packages/views/onboarding/components/starter-content-prompt.tsx b/packages/views/onboarding/components/starter-content-prompt.tsxindex bef9639a61..2c872ef2b5 100644--- a/packages/views/onboarding/components/starter-content-prompt.tsx+++ b/packages/views/onboarding/components/starter-content-prompt.tsx@@ -214,12 +214,16 @@ function mergeQuestionnaire(raw: Record<string, unknown>,): QuestionnaireAnswers {const empty: QuestionnaireAnswers = {- team_size: null,- team_size_other: null,+ source: null,+ source_other: null,+ source_skipped: false,role: null,role_other: null,+ role_skipped: false,use_case: null,use_case_other: null,+ use_case_skipped: false,+ version: 2,};return { ...empty, ...(raw as Partial<QuestionnaireAnswers>) };}diff --git a/packages/views/onboarding/components/step-header.test.tsx b/packages/views/onboarding/components/step-header.test.tsxindex 7a0076ab79..f73aa46aa3 100644--- a/packages/views/onboarding/components/step-header.test.tsx+++ b/packages/views/onboarding/components/step-header.test.tsx@@ -25,23 +25,23 @@ function render(ui: React.ReactElement, options?: RenderOptions) {describe("StepHeader", () => {it("renders one dot per step in ONBOARDING_STEP_ORDER", () => {- const { container } = render(<StepHeader currentStep="questionnaire" />);+ const { container } = render(<StepHeader currentStep="source" />);const dots = container.querySelectorAll('[aria-hidden="true"]');expect(dots).toHaveLength(ONBOARDING_STEP_ORDER.length);});it("shows 'Step N of M' text matching the current step's position", () => {- // workspace is index 1 (0-indexed) → Step 2 of 5+ // workspace is index 3 (after source/role/use_case) → Step 4 of 7render(<StepHeader currentStep="workspace" />);expect(- screen.getByText(`Step 2 of ${ONBOARDING_STEP_ORDER.length}`),+ screen.getByText(`Step 4 of ${ONBOARDING_STEP_ORDER.length}`),).toBeInTheDocument();});it("sets accessible progressbar attrs", () => {render(<StepHeader currentStep="agent" />);const bar = screen.getByRole("progressbar");- expect(bar).toHaveAttribute("aria-valuenow", "4"); // agent is index 3 → step 4+ expect(bar).toHaveAttribute("aria-valuenow", "6"); // agent is index 5 → step 6expect(bar).toHaveAttribute("aria-valuemax", String(ONBOARDING_STEP_ORDER.length));});diff --git a/packages/views/onboarding/onboarding-flow.tsx b/packages/views/onboarding/onboarding-flow.tsxindex 700dd6429b..d03a81def5 100644--- a/packages/views/onboarding/onboarding-flow.tsx+++ b/packages/views/onboarding/onboarding-flow.tsx@@ -19,7 +19,9 @@ import type { Agent, AgentRuntime, Workspace } from "@multica/core/types";import { DragStrip } from "@multica/views/platform";import { StepHeader } from "./components/step-header";import { StepWelcome } from "./steps/step-welcome";-import { StepQuestionnaire } from "./steps/step-questionnaire";+import { StepSource } from "./steps/step-source";+import { StepRole } from "./steps/step-role";+import { StepUseCase } from "./steps/step-use-case";import { StepWorkspace } from "./steps/step-workspace";import { StepRuntimeConnect } from "./steps/step-runtime-connect";import { StepPlatformFork } from "./steps/step-platform-fork";@@ -28,18 +30,34 @@ import { StepFirstIssue } from "./steps/step-first-issue";import { useT } from "../i18n";const EMPTY_QUESTIONNAIRE: QuestionnaireAnswers = {- team_size: null,- team_size_other: null,+ source: null,+ source_other: null,+ source_skipped: false,role: null,role_other: null,+ role_skipped: false,use_case: null,use_case_other: null,+ use_case_skipped: false,+ version: 2,};+/**+ * Merge persisted answers into the empty default. Re-entry pre-fills+ * answered slots but treats `*_skipped` as fresh (the user can answer+ * this time) — the v1 skip marker is dropped on read, the analytics+ * record of the prior skip stays in the DB.+ */function mergeQuestionnaire(raw: Record<string, unknown>,): QuestionnaireAnswers {- return { ...EMPTY_QUESTIONNAIRE, ...(raw as Partial<QuestionnaireAnswers>) };+ const merged = { ...EMPTY_QUESTIONNAIRE, ...(raw as Partial<QuestionnaireAnswers>) };+ return {+ ...merged,+ source_skipped: false,+ role_skipped: false,+ use_case_skipped: false,+ };}/**@@ -53,9 +71,15 @@ function mergeQuestionnaire(export function OnboardingFlow({onComplete,runtimeInstructions,+ onRuntimeRefresh,}: {onComplete: (workspace?: Workspace) => void;runtimeInstructions?: React.ReactNode;+ /** Desktop wires this to restart the bundled daemon so a freshly+ * installed agent CLI gets picked up on the runtime step. Web omits+ * it — its CLI install flow already runs on the user's machine and+ * the embedded picker reacts to daemon:register events. */+ onRuntimeRefresh?: () => void | Promise<void>;}) {const { t } = useT("onboarding");const user = useAuthStore((s) => s.user);@@ -63,11 +87,12 @@ export function OnboardingFlow({throw new Error("OnboardingFlow requires an authenticated user");}- // Questionnaire answers are server-persisted and pre-fill Step 1- // on re-entry. That's the only piece of onboarding state persisted- // across sessions — which step the user is on is deliberately not- // saved, so every entry starts at Welcome.+ // Questionnaire answers are server-persisted and pre-fill the per-+ // question steps on re-entry. That's the only piece of onboarding+ // state persisted across sessions — which step the user is on is+ // deliberately not saved, so every entry starts at Welcome.const storedQuestionnaire = mergeQuestionnaire(user.onboarding_questionnaire);+ const [answers, setAnswers] = useState<QuestionnaireAnswers>(storedQuestionnaire);const qc = useQueryClient();@@ -75,11 +100,6 @@ export function OnboardingFlow({const [workspace, setWorkspace] = useState<Workspace | null>(null);const [runtime, setRuntime] = useState<AgentRuntime | null>(null);const [, setAgent] = useState<Agent | null>(null);- // Sticky flag: Step 3's cloud-waitlist dialog only lives inside- // StepPlatformFork's local state, so the completion path for- // `runtime=null && waitlist submitted` would be invisible here without- // a shell-level record. One way latch; never cleared once set.- const [waitlistSubmitted, setWaitlistSubmitted] = useState(false);// Fetched at Step 0 + Step 2. Step 2 uses it to detect a pre-existing// workspace from an earlier abandoned onboarding (so StepWorkspace shows@@ -110,10 +130,48 @@ export function OnboardingFlow({// introducing a redundant prop.const isWeb = !!runtimeInstructions;+ // Derive "what comes after `from`" from ONBOARDING_STEP_ORDER so+ // inserting/reordering a persisted step only requires editing the+ // canonical array. Returns null if `from` is the last persisted step+ // or not in the array (callers fall back to bespoke routing).+ const nextStep = useCallback((from: OnboardingStep): OnboardingStep | null => {+ const idx = ONBOARDING_STEP_ORDER.indexOf(from);+ if (idx < 0 || idx >= ONBOARDING_STEP_ORDER.length - 1) return null;+ return ONBOARDING_STEP_ORDER[idx + 1]!;+ }, []);++ const advanceFrom = useCallback(+ (from: OnboardingStep) => {+ const next = nextStep(from);+ if (next) setStep(next);+ },+ [nextStep],+ );+const handleWelcomeNext = useCallback(() => {- setStep("questionnaire");+ // Welcome is intentionally not in ONBOARDING_STEP_ORDER (it's a+ // product intro, not a persisted step), so the first persisted+ // step is hard-coded as the entry point.+ setStep(ONBOARDING_STEP_ORDER[0]!);}, []);+ // Apply an in-memory patch and fire-and-forget a PATCH to persist+ // it. We never block UI on the request — the next step's render is+ // what matters; a transient save failure surfaces as a toast but+ // does not roll the user back.+ const applyAnswers = useCallback(+ (patch: Partial<QuestionnaireAnswers>) => {+ setAnswers((a) => {+ const next = { ...a, ...patch };+ void saveQuestionnaire(next).catch((err) => {+ if (err instanceof Error) toast.error(err.message);+ });+ return next;+ });+ },+ [],+ );+// "I've done this before" path — returning user who already has a// workspace and just wants to land there. Marks onboarding complete// server-side (idempotent via COALESCE on onboarded_at) and navigates@@ -133,25 +191,22 @@ export function OnboardingFlow({onComplete(workspaces[0] ?? undefined);}, [workspaces, onComplete]);- const handleQuestionnaireSubmit = useCallback(- async (answers: QuestionnaireAnswers) => {- await saveQuestionnaire(answers);- setStep("workspace");+ const handleWorkspaceCreated = useCallback(+ (ws: Workspace) => {+ setWorkspace(ws);+ setCurrentWorkspace(ws.slug, ws.id);+ advanceFrom("workspace");},- [],+ [advanceFrom],);- const handleWorkspaceCreated = useCallback((ws: Workspace) => {- setWorkspace(ws);- setCurrentWorkspace(ws.slug, ws.id);- setStep("runtime");- }, []);-const handleRuntimeNext = useCallback((rt: AgentRuntime | null) => {setRuntime(rt);- // No runtime → no agent possible; skip Step 4 and go straight to- // the finalizer. The post-landing StarterContentPrompt will detect- // "no agent in this workspace" and offer the self-serve template.+ // Custom branch — not derived from ONBOARDING_STEP_ORDER because no+ // runtime → no agent possible, so we skip Step 4 ("agent") and go+ // straight to the finalizer. The post-landing StarterContentPrompt+ // will detect "no agent in this workspace" and offer the self-serve+ // template.setStep(rt ? "agent" : "first_issue");}, []);@@ -168,14 +223,18 @@ export function OnboardingFlow({queryKey: workspaceKeys.agents(workspace.id),});}- setStep("first_issue");+ advanceFrom("agent");},- [workspace, qc],+ [workspace, qc, advanceFrom],);const handleBack = useCallback((from: OnboardingStep) => {const idx = ONBOARDING_STEP_ORDER.indexOf(from);- if (idx <= 0) return;+ if (idx <= 0) {+ // Source (the first persisted step) returns to Welcome.+ setStep("welcome");+ return;+ }const prev = ONBOARDING_STEP_ORDER[idx - 1]!;setStep(prev);}, []);@@ -202,11 +261,38 @@ export function OnboardingFlow({);}- if (step === "questionnaire") {+ if (step === "source") {+ return (+ <StepSource+ answers={answers}+ onChange={applyAnswers}+ onAdvance={() => advanceFrom("source")}+ onSkip={() => advanceFrom("source")}+ onBack={() => handleBack("source")}+ />+ );+ }++ if (step === "role") {+ return (+ <StepRole+ answers={answers}+ onChange={applyAnswers}+ onAdvance={() => advanceFrom("role")}+ onSkip={() => advanceFrom("role")}+ onBack={() => handleBack("role")}+ />+ );+ }++ if (step === "use_case") {return (- <StepQuestionnaire- initial={storedQuestionnaire}- onSubmit={handleQuestionnaireSubmit}+ <StepUseCase+ answers={answers}+ onChange={applyAnswers}+ onAdvance={() => advanceFrom("use_case")}+ onSkip={() => advanceFrom("use_case")}+ onBack={() => handleBack("use_case")}/>);}@@ -234,7 +320,7 @@ export function OnboardingFlow({wsId={workspace.id}onNext={handleRuntimeNext}onBack={() => handleBack("runtime")}- onWaitlistSubmitted={() => setWaitlistSubmitted(true)}+ onRefresh={onRuntimeRefresh}/>);}@@ -244,7 +330,6 @@ export function OnboardingFlow({onNext={handleRuntimeNext}onBack={() => handleBack("runtime")}cliInstructions={runtimeInstructions}- onWaitlistSubmitted={() => setWaitlistSubmitted(true)}/>);}@@ -260,24 +345,19 @@ export function OnboardingFlow({return (<StepAgentruntime={runtime}- questionnaire={storedQuestionnaire}+ questionnaire={answers}onCreated={handleAgentCreated}onBack={() => handleBack("agent")}/>);}- // Derive the completion-path label for Step 5 here — runtime +- // waitlist state both live in this shell, StepFirstIssue doesn't- // have the visibility to compute it itself.- // runtime set → "full"- // no runtime + waitlist → "cloud_waitlist"- // no runtime, no waitlist → "runtime_skipped"+ // Derive the completion-path label for Step 5. The cloud-waitlist+ // exit was removed from Step 3 (replaced with a "Coming soon" badge)+ // so this is now a binary: runtime → "full", no runtime → "runtime_skipped".const completionPath: OnboardingCompletionPath = runtime? "full"- : waitlistSubmitted- ? "cloud_waitlist"- : "runtime_skipped";+ : "runtime_skipped";return (<div className="animate-onboarding-enter flex min-h-full flex-col">diff --git a/packages/views/onboarding/steps/step-agent.tsx b/packages/views/onboarding/steps/step-agent.tsxindex ef46362e3e..29ff90f3d8 100644--- a/packages/views/onboarding/steps/step-agent.tsx+++ b/packages/views/onboarding/steps/step-agent.tsx@@ -183,22 +183,22 @@ export function StepAgent({/>))}</div>++ {/* Inline action bar — hint + Create CTA. No skip path:+ reaching Step 4 means a runtime was picked at Step 3,+ so creating the agent IS this step. */}+ <div className="mt-8 flex flex-wrap items-center justify-end gap-x-4 gap-y-2">+ <span className="mr-auto hidden text-xs text-muted-foreground sm:block">+ {t(($) => $.step_agent.footer_hint)}+ </span>+ <Button size="lg" onClick={handleCreate} disabled={creating}>+ {creating && <Loader2 className="h-4 w-4 animate-spin" />}+ {t(($) => $.step_agent.create_action, { name: template.defaultName })}+ <ArrowRight className="h-4 w-4" />+ </Button>+ </div></div></main>-- {/* Fixed footer — hint + Create CTA. No skip path: reaching- Step 4 means a runtime was picked at Step 3, so creating- the agent IS this step. */}- <footer className="flex shrink-0 items-center justify-between gap-4 bg-background px-6 py-4 sm:px-10 md:px-14 lg:px-16">- <span className="hidden text-xs text-muted-foreground sm:block">- {t(($) => $.step_agent.footer_hint)}- </span>- <Button size="lg" onClick={handleCreate} disabled={creating}>- {creating && <Loader2 className="h-4 w-4 animate-spin" />}- {t(($) => $.step_agent.create_action, { name: template.defaultName })}- <ArrowRight className="h-4 w-4" />- </Button>- </footer></div>{/* Right — About agents side panel, independent scroll */}diff --git a/packages/views/onboarding/steps/step-platform-fork.test.tsx b/packages/views/onboarding/steps/step-platform-fork.test.tsxindex 539c6fef08..bd1a08814a 100644--- a/packages/views/onboarding/steps/step-platform-fork.test.tsx+++ b/packages/views/onboarding/steps/step-platform-fork.test.tsx@@ -8,9 +8,7 @@ import enOnboarding from "../../locales/en/onboarding.json";const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };-// Mock the core onboarding module BEFORE the SUT imports it.const mocks = vi.hoisted(() => ({- joinCloudWaitlist: vi.fn(),pickerState: {runtimes: [] as AgentRuntime[],selected: null as AgentRuntime | null,@@ -20,18 +18,6 @@ const mocks = vi.hoisted(() => ({},}));-// Partial mock — preserve ONBOARDING_STEP_ORDER etc. that StepHeader-// (rendered inside the fork) reaches for, while replacing the network-// call we want to assert on.-vi.mock("@multica/core/onboarding", async (importOriginal) => {- const actual =- await importOriginal<typeof import("@multica/core/onboarding")>();- return {- ...actual,- joinCloudWaitlist: mocks.joinCloudWaitlist,- };-});-// Swap out the runtime picker so tests can drive runtimes / selection// without a real TanStack Query + WS stack.vi.mock("../components/use-runtime-picker", () => ({@@ -86,19 +72,22 @@ function resetPicker(patch: Partial<typeof mocks.pickerState> = {}) {describe("StepPlatformFork", () => {beforeEach(() => {- mocks.joinCloudWaitlist.mockReset();resetPicker();vi.restoreAllMocks();});it("renders the three fork options at rest", () => {renderFork();- expect(screen.getByText(/download the desktop app/i)).toBeInTheDocument();- expect(screen.getByText(/^install the cli$/i)).toBeInTheDocument();- expect(screen.getByText(/^cloud runtime$/i)).toBeInTheDocument();- // Dialogs closed at rest → no CLI instructions, no email field.+ expect(screen.getByText(/^use this computer$/i)).toBeInTheDocument();+ expect(screen.getByText(/^connect from the terminal$/i)).toBeInTheDocument();+ expect(screen.getByText(/^use a cloud computer$/i)).toBeInTheDocument();+ // Cloud option is a "Coming soon" preview — not yet wired up.+ expect(screen.getByText(/^coming soon$/i)).toBeInTheDocument();+ expect(+ screen.queryByRole("button", { name: /^coming soon$/i }),+ ).not.toBeInTheDocument();+ // CLI dialog closed at rest → no CLI instructions.expect(screen.queryByTestId("cli-instructions")).not.toBeInTheDocument();- expect(screen.queryByLabelText(/email/i)).not.toBeInTheDocument();});it("footer: Skip only + explanatory hint (no Continue)", () => {@@ -112,7 +101,7 @@ describe("StepPlatformFork", () => {screen.queryByRole("button", { name: /^continue$/i }),).not.toBeInTheDocument();expect(- screen.getByText(/pick a path above — or skip and configure/i),+ screen.getByText(/pick a way to connect — or skip and connect a computer later/i),).toBeInTheDocument();});@@ -129,7 +118,7 @@ describe("StepPlatformFork", () => {const user = userEvent.setup();renderFork();- await user.click(screen.getByText(/download the desktop app/i));+ await user.click(screen.getByText(/^use this computer$/i));// Routes to the new /download page (not GitHub releases) so the// user lands on the OS auto-detect surface.@@ -139,7 +128,7 @@ describe("StepPlatformFork", () => {"noopener,noreferrer",);expect(- screen.getByText(/continuing on the download page/i),+ screen.getByText(/opening the download page/i),).toBeInTheDocument();});@@ -152,7 +141,7 @@ describe("StepPlatformFork", () => {const dialog = await screen.findByRole("dialog");expect(within(dialog).getByTestId("cli-instructions")).toBeInTheDocument();expect(- within(dialog).getByText(/listening for your daemon/i),+ within(dialog).getByText(/waiting for your computer/i),).toBeInTheDocument();// Connect & continue stays disabled while no runtime is selected.expect(@@ -174,7 +163,7 @@ describe("StepPlatformFork", () => {await user.click(screen.getByRole("button", { name: /show steps/i }));const dialog = await screen.findByRole("dialog");- expect(within(dialog).getByText(/1 runtime connected/i)).toBeInTheDocument();+ expect(within(dialog).getByText(/1 computer connected/i)).toBeInTheDocument();expect(within(dialog).getByText(/selected: claude code/i),).toBeInTheDocument();@@ -188,105 +177,4 @@ describe("StepPlatformFork", () => {expect(onNext).toHaveBeenCalledWith(rt);});- it("Cloud dialog submission does NOT advance the flow", async () => {- // Even with runtimes detected in the background, submitting the- // cloud waitlist form must not call onNext — it's pure interest- // capture. The user still has to hit Skip explicitly afterwards.- const rt = makeRuntime();- resetPicker({- runtimes: [rt],- selected: rt,- selectedId: rt.id,- hasRuntimes: true,- });- mocks.joinCloudWaitlist.mockResolvedValue(undefined);- const user = userEvent.setup();- const { onNext } = renderFork();-- await user.click(screen.getByRole("button", { name: /^join waitlist$/i }));- const dialog = await screen.findByRole("dialog");- await user.type(within(dialog).getByLabelText(/email/i), "[email protected]");- await user.click(- within(dialog).getByRole("button", { name: /^join waitlist$/i }),- );-- expect(mocks.joinCloudWaitlist).toHaveBeenCalled();- expect(onNext).not.toHaveBeenCalled();- });-- it("Cloud submit: disables button, shows 'on the list', does NOT navigate", async () => {- mocks.joinCloudWaitlist.mockResolvedValue(undefined);- const user = userEvent.setup();- const { onNext } = renderFork();-- await user.click(screen.getByRole("button", { name: /^join waitlist$/i }));- const dialog = await screen.findByRole("dialog");- await user.type(within(dialog).getByLabelText(/email/i), "[email protected]");- await user.type(- within(dialog).getByLabelText(/why cloud/i),- "running agents overnight",- );- await user.click(- within(dialog).getByRole("button", { name: /^join waitlist$/i }),- );-- expect(mocks.joinCloudWaitlist).toHaveBeenCalledTimes(1);- expect(mocks.joinCloudWaitlist).toHaveBeenCalledWith(- "[email protected]",- "running agents overnight",- );- // Cloud submit is pure side effect — it must NOT advance the flow.- expect(onNext).not.toHaveBeenCalled();- // Form button locks out after submit.- expect(- within(dialog).getByRole("button", { name: /you're on the list/i }),- ).toBeDisabled();- // Footer hint flips to reflect submitted state.- expect(- screen.getByText(/you're on the waitlist — pick skip to keep exploring/i),- ).toBeInTheDocument();- });-- it("Cloud submit: empty reason is allowed, reason forwarded as ''", async () => {- mocks.joinCloudWaitlist.mockResolvedValue(undefined);- const user = userEvent.setup();- renderFork();-- await user.click(screen.getByRole("button", { name: /^join waitlist$/i }));- const dialog = await screen.findByRole("dialog");- await user.type(- within(dialog).getByLabelText(/email/i),- "[email protected]",- );- await user.click(- within(dialog).getByRole("button", { name: /^join waitlist$/i }),- );-- expect(mocks.joinCloudWaitlist).toHaveBeenCalledWith(- "[email protected]",- "",- );- });-- it("Cloud submit stays disabled until email is valid", async () => {- const user = userEvent.setup();- renderFork();-- await user.click(screen.getByRole("button", { name: /^join waitlist$/i }));- const dialog = await screen.findByRole("dialog");- const submit = within(dialog).getByRole("button", {- name: /^join waitlist$/i,- });- expect(submit).toBeDisabled();-- await user.type(within(dialog).getByLabelText(/email/i), "not-an-email");- expect(submit).toBeDisabled();-- await user.clear(within(dialog).getByLabelText(/email/i));- await user.type(- within(dialog).getByLabelText(/email/i),- "[email protected]",- );- expect(submit).toBeEnabled();- });});diff --git a/packages/views/onboarding/steps/step-platform-fork.tsx b/packages/views/onboarding/steps/step-platform-fork.tsxindex 86141ab544..b8afe4daa7 100644--- a/packages/views/onboarding/steps/step-platform-fork.tsx+++ b/packages/views/onboarding/steps/step-platform-fork.tsx@@ -24,7 +24,6 @@ import { StepHeader } from "../components/step-header";import { RuntimeAsidePanel } from "../components/runtime-aside-panel";import { CompactRuntimeRow } from "../components/compact-runtime-row";import { useRuntimePicker } from "../components/use-runtime-picker";-import { CloudWaitlistExpand } from "../components/cloud-waitlist-expand";import { useT } from "../../i18n";/**@@ -41,16 +40,14 @@ import { useT } from "../../i18n";* probe. When a runtime appears and the user selects it, the* dialog's "Connect & continue" button fires `onNext(runtime)`* and advances the flow.- * 3. **Cloud waitlist** — alt card, "Join waitlist" pill → opens a- * dialog with an email + reason form. Submitting is pure interest- * capture; the dialog doesn't advance the flow. The user then- * closes the dialog and can hit Skip in the footer.+ * 3. **Cloud computer** — alt card, "Coming soon" badge. Not yet+ * available; rendered as a static, non-actionable preview.** Footer is simplified — no Continue button, since the CLI dialog* owns that advancement itself. Only Skip remains.*/-type DialogState = "cli" | "cloud" | null;+type DialogState = "cli" | null;// Single canonical download destination — the /download page owns// OS + arch detection, the All-Platforms matrix, release-note links,@@ -63,17 +60,12 @@ export function StepPlatformFork({onNext,onBack,cliInstructions,- onWaitlistSubmitted,}: {wsId: string;onNext: (runtime: AgentRuntime | null) => void | Promise<void>;onBack?: () => void;/** Platform-specific CLI install card, rendered inside the CLI dialog. */cliInstructions?: ReactNode;- /** Parent-level latch used to label the onboarding completion path- * as `cloud_waitlist` when the user ends up skipping Step 3 after- * submitting the waitlist form. */- onWaitlistSubmitted?: () => void;}) {const { t } = useT("onboarding");const mainRef = useRef<HTMLElement>(null);@@ -81,7 +73,6 @@ export function StepPlatformFork({const [dialog, setDialog] = useState<DialogState>(null);const [downloaded, setDownloaded] = useState(false);- const [waitlistSubmitted, setWaitlistSubmitted] = useState(false);// Platform signal retained purely for PostHog dimensions — the UI// no longer branches on it (Windows / Linux desktop installers now@@ -126,17 +117,6 @@ export function StepPlatformFork({setPersonProperties({ platform_preference: "web" });};- const handleOpenCloud = () => {- setDialog("cloud");- captureEvent("onboarding_runtime_path_selected", {- workspace_id: wsId,- path: "cloud_waitlist",- source: "onboarding",- surface: "step3",- is_mac: isMac,- });- };-const handleCliConnect = () => {if (!picker.selected) return;setDialog(null);@@ -144,9 +124,6 @@ export function StepPlatformFork({};const footerHint = (() => {- if (waitlistSubmitted) {- return t(($) => $.step_platform.hint_waitlist);- }if (downloaded) {return t(($) => $.step_platform.hint_downloaded);}@@ -206,31 +183,28 @@ export function StepPlatformFork({<ForkAlttitle={t(($) => $.step_platform.cloud_title)}subtitle={t(($) => $.step_platform.cloud_subtitle)}- actionLabel={- waitlistSubmitted- ? t(($) => $.step_platform.cloud_action_done)- : t(($) => $.step_platform.cloud_action)- }- onAction={handleOpenCloud}+ actionLabel={t(($) => $.step_platform.cloud_action)}+ disabled/></div>++ {/* Inline action bar — hint on the left, Skip on the right.+ Advancement for the CLI path is owned by the CLI+ dialog's own "Connect & continue" button; Skip is the+ self-serve exit. */}+ <div className="mt-8 flex max-w-[560px] flex-wrap items-center justify-between gap-x-4 gap-y-2">+ <span+ aria-live="polite"+ className="text-xs text-muted-foreground"+ >+ {footerHint}+ </span>+ <Button variant="secondary" onClick={() => onNext(null)}>+ {t(($) => $.step_runtime.skip)}+ </Button>+ </div></div></main>-- {/* Footer — hint on the left, Skip on the right. Advancement- for the CLI path is owned by the CLI dialog's own- "Connect & continue" button; Skip is the self-serve exit. */}- <footer className="flex shrink-0 items-center justify-between gap-4 bg-background px-6 py-4 sm:px-10 md:px-14 lg:px-16">- <span- aria-live="polite"- className="text-xs text-muted-foreground"- >- {footerHint}- </span>- <Button variant="secondary" onClick={() => onNext(null)}>- {t(($) => $.step_runtime.skip)}- </Button>- </footer></div>{/* Right — always-visible aside */}@@ -253,16 +227,6 @@ export function StepPlatformFork({selectedName={picker.selected?.name ?? null}cliInstructions={cliInstructions}/>-- <CloudWaitlistDialog- open={dialog === "cloud"}- onClose={() => setDialog(null)}- submitted={waitlistSubmitted}- onSubmitted={() => {- setWaitlistSubmitted(true);- onWaitlistSubmitted?.();- }}- /></div>);}@@ -313,38 +277,51 @@ function ForkPrimary({}/**- * Alt card with an explicit right-side action pill. The whole card is- * clickable (so you can hit the title/subtitle too), but the pill is the- * visual anchor — it's what tells the user "this card is a button".- * Pressing it opens a dialog that owns the real content + action.+ * Alt card with a right-side action. When `disabled`, the action+ * renders as a static badge (used for "Coming soon" paths that aren't+ * yet wired up); otherwise it's an outline button that fires+ * `onAction` and typically opens a dialog.*/function ForkAlt({title,subtitle,actionLabel,onAction,+ disabled = false,}: {title: string;subtitle: ReactNode;actionLabel: ReactNode;- onAction: () => void;+ onAction?: () => void;+ disabled?: boolean;}) {return (- <div className="flex items-center justify-between gap-4 rounded-lg border bg-card px-5 py-4">+ <div+ className={cn(+ "flex items-center justify-between gap-4 rounded-lg border bg-card px-5 py-4",+ disabled && "opacity-70",+ )}+ ><div className="min-w-0"><div className="text-[14.5px] font-medium text-foreground">{title}</div><div className="mt-1 text-[12.5px] leading-[1.5] text-muted-foreground">{subtitle}</div></div>- <Button- variant="outline"- size="sm"- className="shrink-0"- onClick={onAction}- >- {actionLabel}- </Button>+ {disabled ? (+ <span className="shrink-0 rounded-full border bg-muted px-3 py-1 text-[12px] font-medium text-muted-foreground">+ {actionLabel}+ </span>+ ) : (+ <Button+ variant="outline"+ size="sm"+ className="shrink-0"+ onClick={onAction}+ >+ {actionLabel}+ </Button>+ )}</div>);}@@ -438,7 +415,7 @@ function CliInstallDialog({</span><div className="flex items-center gap-2"><Button variant="ghost" onClick={onClose}>- {t(($) => $.step_runtime.dialog_cancel)}+ {t(($) => $.common.cancel)}</Button><Button disabled={!canConnect} onClick={onConnect}>{t(($) => $.step_platform.cli_dialog_connect)}@@ -569,53 +546,3 @@ function CliWaitingStatus({ dialogOpen }: { dialogOpen: boolean }) {);}-// -------------------------------------------------------------// Cloud waitlist dialog-// --------------------------------------------------------------/**- * Modal dialog for the cloud waitlist path. Wraps the shared- * `CloudWaitlistExpand` form. Submitting it records interest — the- * dialog does NOT advance the onboarding flow. After submit, the user- * closes the dialog and can hit Skip in the footer.- */-function CloudWaitlistDialog({- open,- onClose,- submitted,- onSubmitted,-}: {- open: boolean;- onClose: () => void;- submitted: boolean;- onSubmitted: () => void;-}) {- const { t } = useT("onboarding");- return (- <Dialog open={open} onOpenChange={(o) => (o ? null : onClose())}>- <DialogContent className="flex max-h-[85vh] flex-col sm:max-w-[520px]">- <DialogHeader>- <DialogTitle>{t(($) => $.step_runtime.dialog_title)}</DialogTitle>- <DialogDescription>- {t(($) => $.step_runtime.dialog_description)}- </DialogDescription>- </DialogHeader>-- <div className="min-h-0 flex-1 overflow-y-auto pt-2">- <CloudWaitlistExpand- submitted={submitted}- onSubmitted={onSubmitted}- />- </div>-- <DialogFooter>- <Button variant="ghost" onClick={onClose}>- {submitted- ? t(($) => $.step_runtime.dialog_close)- : t(($) => $.step_runtime.dialog_cancel)}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>- );-}diff --git a/packages/views/onboarding/steps/step-question.test.tsx b/packages/views/onboarding/steps/step-question.test.tsxnew file mode 100644index 0000000000..ee92dfb30a--- /dev/null+++ b/packages/views/onboarding/steps/step-question.test.tsx@@ -0,0 +1,125 @@+import { describe, expect, it, vi, beforeEach } from "vitest";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { I18nProvider } from "@multica/core/i18n/react";+import enCommon from "../../locales/en/common.json";+import enOnboarding from "../../locales/en/onboarding.json";+import { StepQuestion, type QuestionOption } from "./step-question";++const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };++const OPTIONS: readonly QuestionOption[] = [+ { slug: "a", icon: <span>A</span>, label: "Alpha" },+ { slug: "b", icon: <span>B</span>, label: "Beta" },+ { slug: "other", icon: <span>O</span>, label: "Other", isOther: true },+];++function renderShell(overrides: Partial<React.ComponentProps<typeof StepQuestion>> = {}) {+ const onAnswer = vi.fn();+ const onAdvance = vi.fn();+ const onSkip = vi.fn();+ const onBack = vi.fn();+ const onOtherChange = vi.fn();+ render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <StepQuestion+ step="source"+ number={1}+ question="Test question"+ options={OPTIONS}+ selectedSlug={null}+ otherValue=""+ onOtherChange={onOtherChange}+ otherPlaceholder="type here"+ onAnswer={onAnswer}+ onAdvance={onAdvance}+ onSkip={onSkip}+ onBack={onBack}+ {...overrides}+ />+ </I18nProvider>,+ );+ return { onAnswer, onAdvance, onSkip, onBack, onOtherChange };+}++describe("StepQuestion", () => {+ beforeEach(() => vi.restoreAllMocks());++ it("Continue is disabled when nothing is selected", () => {+ renderShell();+ const continueBtn = screen.getByRole("button", { name: /continue/i });+ expect(continueBtn).toBeDisabled();+ });++ it("non-Other option: clicking records the slug but does not auto-advance", async () => {+ const user = userEvent.setup();+ const { onAnswer, onAdvance } = renderShell();+ await user.click(screen.getByRole("radio", { name: /alpha/i }));+ expect(onAnswer).toHaveBeenCalledWith("a");+ expect(onAdvance).not.toHaveBeenCalled();+ });++ it("with a non-Other slug selected, Continue is enabled and fires onAdvance", async () => {+ const user = userEvent.setup();+ const { onAdvance } = renderShell({ selectedSlug: "a" });+ const continueBtn = screen.getByRole("button", { name: /continue/i });+ expect(continueBtn).toBeEnabled();+ await user.click(continueBtn);+ expect(onAdvance).toHaveBeenCalledTimes(1);+ });++ it("Other selected with empty input → Continue stays disabled", async () => {+ const user = userEvent.setup();+ renderShell();+ await user.click(screen.getByRole("radio", { name: /^other$/i }));+ // pendingOther is now true; Continue must remain disabled until the+ // free-text input has content.+ expect(screen.getByRole("button", { name: /continue/i })).toBeDisabled();+ });++ it("Other selected with non-blank otherValue → Continue is enabled", async () => {+ const user = userEvent.setup();+ const { onAdvance } = renderShell({+ selectedSlug: "other",+ otherValue: "hello",+ });+ const continueBtn = screen.getByRole("button", { name: /continue/i });+ expect(continueBtn).toBeEnabled();+ await user.click(continueBtn);+ expect(onAdvance).toHaveBeenCalledTimes(1);+ });++ it("Other selected with whitespace-only otherValue → Continue is disabled", () => {+ renderShell({ selectedSlug: "other", otherValue: " " });+ expect(screen.getByRole("button", { name: /continue/i })).toBeDisabled();+ });++ it("Skip is always enabled and fires onSkip", async () => {+ const user = userEvent.setup();+ const { onSkip } = renderShell();+ await user.click(screen.getByRole("button", { name: /^skip$/i }));+ expect(onSkip).toHaveBeenCalledTimes(1);+ });++ it("Back button is rendered only when onBack is provided", () => {+ const { unmount } = render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <StepQuestion+ step="source"+ number={1}+ question="Test"+ options={OPTIONS}+ selectedSlug={null}+ otherValue=""+ onOtherChange={vi.fn()}+ otherPlaceholder="type"+ onAnswer={vi.fn()}+ onAdvance={vi.fn()}+ onSkip={vi.fn()}+ />+ </I18nProvider>,+ );+ expect(screen.queryByRole("button", { name: /^back$/i })).not.toBeInTheDocument();+ unmount();+ });+});diff --git a/packages/views/onboarding/steps/step-question.tsx b/packages/views/onboarding/steps/step-question.tsxnew file mode 100644index 0000000000..4133322c03--- /dev/null+++ b/packages/views/onboarding/steps/step-question.tsx@@ -0,0 +1,193 @@+"use client";++import { type ReactNode, useRef, useState } from "react";+import { ArrowLeft, ArrowRight } from "lucide-react";+import { Button } from "@multica/ui/components/ui/button";+import { useScrollFade } from "@multica/ui/hooks/use-scroll-fade";+import type { OnboardingStep } from "@multica/core/onboarding";+import { DragStrip } from "@multica/views/platform";+import { StepHeader } from "../components/step-header";+import {+ IconOptionCard,+ IconOtherOptionCard,+} from "../components/icon-option-card";+import { useT } from "../../i18n";++/**+ * One option in the card grid. `slug` is the persisted enum value;+ * `icon` is a React node (lucide icon, brand SVG, or emoji span);+ * `label` is the localized string already resolved by the caller.+ * `isOther` flips this card into a free-text input row.+ */+export interface QuestionOption {+ slug: string;+ icon: ReactNode;+ label: string;+ isOther?: boolean;+}++/**+ * Generic per-question step used by Source / Role / Use case. Back+ * lives in the page header next to the step indicator; Skip + Continue+ * sit inline directly below the options grid (with a status hint),+ * not in a sticky bottom footer — the form usually only fills the top+ * third of the viewport, and a footer pinned to the page bottom left a+ * large dead zone between the options and the action buttons.+ */+export function StepQuestion({+ step,+ number,+ eyebrow,+ question,+ options,+ selectedSlug,+ otherValue,+ onOtherChange,+ otherPlaceholder,+ onAnswer,+ onAdvance,+ onSkip,+ onBack,+}: {+ step: OnboardingStep;+ number: number;+ eyebrow?: string;+ question: string;+ options: readonly QuestionOption[];+ selectedSlug: string | null;+ otherValue: string;+ onOtherChange: (value: string) => void;+ otherPlaceholder: string;+ /** Record the selection in the parent — does NOT advance. */+ onAnswer: (slug: string) => void;+ /** Commit the current selection and move to the next step. */+ onAdvance: () => void;+ onSkip: () => void;+ onBack?: () => void;+}) {+ const { t } = useT("onboarding");+ const [pendingOther, setPendingOther] = useState(false);+ const mainRef = useRef<HTMLElement>(null);+ const fadeStyle = useScrollFade(mainRef);++ const handleSelect = (option: QuestionOption) => {+ if (option.isOther) {+ setPendingOther(true);+ onOtherChange(otherValue);+ onAnswer(option.slug);+ return;+ }+ setPendingOther(false);+ onAnswer(option.slug);+ };++ const selectedOption = options.find((o) => o.slug === selectedSlug) ?? null;+ const otherActive = selectedOption?.isOther || pendingOther;+ const otherFilled = (otherValue ?? "").trim().length > 0;+ // Continue is enabled when:+ // - a non-Other option is selected, OR+ // - Other is selected AND the free-text input has content.+ const canContinue = selectedSlug !== null && (!otherActive || otherFilled);++ const confirmAdvance = () => {+ if (canContinue) onAdvance();+ };++ const selectedLabel = selectedOption?.label ?? null;+ const footerHint = canContinue+ ? selectedLabel+ ? t(($) => $.step_runtime.hint_selected, { name: selectedLabel })+ : t(($) => $.step_question.hint_continue)+ : t(($) => $.step_question.hint_pick);++ return (+ <div className="animate-onboarding-enter flex h-full min-h-0 flex-col bg-background">+ <DragStrip />+ <header className="flex shrink-0 items-center gap-4 bg-background px-6 py-3 sm:px-10 md:px-14 lg:px-16">+ {onBack ? (+ <button+ type="button"+ onClick={onBack}+ className="flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground"+ >+ <ArrowLeft className="h-3.5 w-3.5" />+ {t(($) => $.common.back)}+ </button>+ ) : (+ <span aria-hidden className="w-0" />+ )}+ <div className="flex-1">+ <StepHeader currentStep={step} />+ </div>+ </header>++ <main+ ref={mainRef}+ style={fadeStyle}+ className="min-h-0 flex-1 overflow-y-auto"+ >+ <div className="mx-auto w-full max-w-[920px] px-6 py-10 sm:px-10 md:px-14 lg:py-14">+ {eyebrow ? (+ <div className="mb-2 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">+ {eyebrow}+ </div>+ ) : null}+ <div className="mb-1 font-mono text-xs text-muted-foreground">+ {String(number).padStart(2, "0")}+ </div>+ <h1 className="text-balance font-serif text-[34px] font-medium leading-[1.15] tracking-tight text-foreground">+ {question}+ </h1>++ <fieldset+ role="radiogroup"+ aria-label={question}+ className="mt-10 m-0 grid grid-cols-1 gap-3 p-0 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"+ >+ {options.map((option) =>+ option.isOther ? (+ <IconOtherOptionCard+ key={option.slug}+ icon={option.icon}+ label={option.label}+ selected={otherActive}+ onSelect={() => handleSelect(option)}+ otherValue={otherValue}+ onOtherChange={onOtherChange}+ onConfirm={confirmAdvance}+ placeholder={otherPlaceholder}+ />+ ) : (+ <IconOptionCard+ key={option.slug}+ icon={option.icon}+ label={option.label}+ selected={selectedSlug === option.slug && !otherActive}+ onSelect={() => handleSelect(option)}+ />+ ),+ )}+ </fieldset>++ <div className="mt-8 flex flex-wrap items-center justify-end gap-x-4 gap-y-2">+ <span+ aria-live="polite"+ className="mr-auto text-xs text-muted-foreground"+ >+ {footerHint}+ </span>+ <div className="flex items-center gap-2">+ <Button size="lg" variant="secondary" onClick={onSkip}>+ {t(($) => $.common.skip)}+ </Button>+ <Button size="lg" disabled={!canContinue} onClick={confirmAdvance}>+ {t(($) => $.common.continue)}+ <ArrowRight className="h-4 w-4" />+ </Button>+ </div>+ </div>+ </div>+ </main>+ </div>+ );+}diff --git a/packages/views/onboarding/steps/step-questionnaire.test.tsx b/packages/views/onboarding/steps/step-questionnaire.test.tsxdeleted file mode 100644index 0cdaf85345..0000000000--- a/packages/views/onboarding/steps/step-questionnaire.test.tsx+++ /dev/null@@ -1,185 +0,0 @@-import { describe, expect, it, vi } from "vitest";-import { render, screen } from "@testing-library/react";-import userEvent from "@testing-library/user-event";-import type { QuestionnaireAnswers } from "@multica/core/onboarding";-import { StepQuestionnaire } from "./step-questionnaire";-import { I18nProvider } from "@multica/core/i18n/react";-import enCommon from "../../locales/en/common.json";-import enOnboarding from "../../locales/en/onboarding.json";--const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };--const EMPTY_ANSWERS: QuestionnaireAnswers = {- team_size: null,- team_size_other: null,- role: null,- role_other: null,- use_case: null,- use_case_other: null,-};--function renderStep(initial: Partial<QuestionnaireAnswers> = {}) {- const onSubmit = vi.fn();- render(- <I18nProvider locale="en" resources={TEST_RESOURCES}>- <StepQuestionnaire- initial={{ ...EMPTY_ANSWERS, ...initial }}- onSubmit={onSubmit}- />- </I18nProvider>,- );- return { onSubmit };-}--/**- * The Continue button is the product of a strict "all three answered"- * gate — no Skip path. These tests lock down that policy so a future- * refactor can't silently loosen it:- * - Disabled by default (zero answers)- * - Stays disabled with 1 or 2 answers- * - Enabled only when all three have concrete selections- * - Stays disabled when any "Other" selection has empty text- * - Clicking while disabled never calls onSubmit- * - Switching away from Other clears that question's *_other field- */-describe("StepQuestionnaire", () => {- it("Continue is disabled when no questions are answered", () => {- renderStep();- expect(- screen.getByRole("button", { name: /continue/i }),- ).toBeDisabled();- });-- it("Continue stays disabled with only one question answered", async () => {- const user = userEvent.setup();- renderStep();- await user.click(screen.getByRole("radio", { name: /just me/i }));- expect(- screen.getByRole("button", { name: /continue/i }),- ).toBeDisabled();- });-- it("Continue stays disabled with only two questions answered", async () => {- const user = userEvent.setup();- renderStep();- await user.click(screen.getByRole("radio", { name: /just me/i }));- await user.click(- screen.getByRole("radio", { name: /software developer/i }),- );- expect(- screen.getByRole("button", { name: /continue/i }),- ).toBeDisabled();- });-- it("Continue enables when all three questions are answered", async () => {- const user = userEvent.setup();- renderStep();- await user.click(screen.getByRole("radio", { name: /just me/i }));- await user.click(- screen.getByRole("radio", { name: /software developer/i }),- );- await user.click(- screen.getByRole("radio", { name: /write and ship code/i }),- );- expect(- screen.getByRole("button", { name: /continue/i }),- ).toBeEnabled();- });-- it("Continue stays disabled when Other is picked but its text is empty", async () => {- const user = userEvent.setup();- renderStep({- team_size: "solo",- role: "developer",- // Q3 will be set to Other in-test — no text typed yet.- });- const q3Other = screen.getAllByRole("radio", { name: /^other$/i })[2]!;- await user.click(q3Other);- expect(- screen.getByRole("button", { name: /continue/i }),- ).toBeDisabled();- });-- it("Continue re-enables once Other text is filled in", async () => {- const user = userEvent.setup();- renderStep({ team_size: "solo", role: "developer" });- const q3Other = screen.getAllByRole("radio", { name: /^other$/i })[2]!;- await user.click(q3Other);- const input = screen.getByPlaceholderText(/automate my weekly reports/i);- await user.type(input, "Teach me the system");- expect(- screen.getByRole("button", { name: /continue/i }),- ).toBeEnabled();- });-- it("clears Other text when the user switches to a concrete option", async () => {- const user = userEvent.setup();- const { onSubmit } = renderStep({- role: "developer",- use_case: "coding",- });-- // Pick Q1 Other → type → switch to Just me → submit.- // Submitted payload must have team_size_other = null.- const q1Other = screen.getAllByRole("radio", { name: /^other$/i })[0]!;- await user.click(q1Other);- await user.type(- screen.getByPlaceholderText(/small community i help run/i),- "large enterprise",- );- await user.click(screen.getByRole("radio", { name: /just me/i }));- await user.click(screen.getByRole("button", { name: /continue/i }));-- expect(onSubmit).toHaveBeenCalledTimes(1);- expect(onSubmit).toHaveBeenCalledWith(- expect.objectContaining({- team_size: "solo",- team_size_other: null,- }),- );- });-- it("does not call onSubmit when Continue is disabled", async () => {- // Belt-and-suspenders against a future refactor that replaces- // <Button disabled> with a custom element that doesn't honor- // the native disabled semantics — the handler's own- // canContinue short-circuit catches it either way.- const user = userEvent.setup();- const { onSubmit } = renderStep();- await user.click(screen.getByRole("button", { name: /continue/i }));- expect(onSubmit).not.toHaveBeenCalled();- });-- it("respects the initial prop (used for resume-after-back)", () => {- renderStep({ team_size: "team", role: "developer" });- expect(- screen.getByRole("radio", { name: /my team/i }),- ).toHaveAttribute("aria-checked", "true");- expect(- screen.getByRole("radio", { name: /software developer/i }),- ).toHaveAttribute("aria-checked", "true");- });-- it("submits the full answer set including all three questions", async () => {- const user = userEvent.setup();- const { onSubmit } = renderStep();-- await user.click(screen.getByRole("radio", { name: /just me/i }));- await user.click(- screen.getByRole("radio", { name: /software developer/i }),- );- await user.click(- screen.getByRole("radio", { name: /write and ship code/i }),- );- await user.click(screen.getByRole("button", { name: /continue/i }));-- expect(onSubmit).toHaveBeenCalledWith({- team_size: "solo",- team_size_other: null,- role: "developer",- role_other: null,- use_case: "coding",- use_case_other: null,- });- });-});diff --git a/packages/views/onboarding/steps/step-questionnaire.tsx b/packages/views/onboarding/steps/step-questionnaire.tsxdeleted file mode 100644index 2a95e029a7..0000000000--- a/packages/views/onboarding/steps/step-questionnaire.tsx+++ /dev/null@@ -1,372 +0,0 @@-"use client";--import { type ReactNode, useMemo, useRef, useState } from "react";-import {- ArrowLeft,- ArrowRight,- Loader2,- PenLine,- Sparkles,-} from "lucide-react";-import { Button } from "@multica/ui/components/ui/button";-import { useScrollFade } from "@multica/ui/hooks/use-scroll-fade";-import type {- QuestionnaireAnswers,- Role,- TeamSize,- UseCase,-} from "@multica/core/onboarding";-import { DragStrip } from "@multica/views/platform";-import { StepHeader } from "../components/step-header";-import { OptionCard, OtherOptionCard } from "../components/option-card";-import { useT } from "../../i18n";--/**- * Step 1 — three-question user profile.- *- * Classic app-shell layout: the left column is 3-region- * (header / scrollable middle / footer) so the progress indicator- * and the Continue CTA both stay visible regardless of how far the- * user has scrolled into the questions. The right "Why we ask" panel- * is a separate grid column that scrolls independently.- *- * Below lg the right panel hides and the left column fills the- * viewport — 3-region layout still applies.- */-export function StepQuestionnaire({- initial,- onSubmit,- onBack,-}: {- initial: QuestionnaireAnswers;- onSubmit: (answers: QuestionnaireAnswers) => void | Promise<void>;- onBack?: () => void;-}) {- const { t } = useT("onboarding");- const [answers, setAnswers] = useState<QuestionnaireAnswers>(initial);- const [submitting, setSubmitting] = useState(false);- const mainRef = useRef<HTMLElement>(null);- const fadeStyle = useScrollFade(mainRef);-- const setTeamSize = (v: TeamSize) =>- setAnswers((a) => ({- ...a,- team_size: v,- team_size_other: v === "other" ? a.team_size_other : null,- }));- const setRole = (v: Role) =>- setAnswers((a) => ({- ...a,- role: v,- role_other: v === "other" ? a.role_other : null,- }));- const setUseCase = (v: UseCase) =>- setAnswers((a) => ({- ...a,- use_case: v,- use_case_other: v === "other" ? a.use_case_other : null,- }));-- // A question counts as "answered" when it has a concrete selection,- // and — if that selection is "other" — its free-text field is non-empty.- // Same rule that used to drive canContinue; we compute the per-question- // booleans once here and derive both the count (footer indicator) and- // the overall gate from it.- const answeredCount = useMemo(() => {- const q1 =- answers.team_size !== null &&- (answers.team_size !== "other" ||- (answers.team_size_other ?? "").trim() !== "");- const q2 =- answers.role !== null &&- (answers.role !== "other" || (answers.role_other ?? "").trim() !== "");- const q3 =- answers.use_case !== null &&- (answers.use_case !== "other" ||- (answers.use_case_other ?? "").trim() !== "");- return (q1 ? 1 : 0) + (q2 ? 1 : 0) + (q3 ? 1 : 0);- }, [answers]);- const canContinue = answeredCount === 3;-- const submit = async () => {- if (!canContinue || submitting) return;- setSubmitting(true);- try {- await onSubmit(answers);- } finally {- setSubmitting(false);- }- };-- return (- <div className="animate-onboarding-enter grid h-full min-h-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_480px]">- {/* Left column — DragStrip + 3-region app shell */}- <div className="flex min-h-0 flex-col">- <DragStrip />- {/* Fixed header — Back + progress indicator */}- <header className="flex shrink-0 items-center gap-4 bg-background px-6 py-3 sm:px-10 md:px-14 lg:px-16">- {onBack ? (- <button- type="button"- onClick={onBack}- className="flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground"- >- <ArrowLeft className="h-3.5 w-3.5" />- {t(($) => $.common.back)}- </button>- ) : (- <span aria-hidden className="w-0" />- )}- <div className="flex-1">- <StepHeader currentStep="questionnaire" />- </div>- </header>-- {/* Scrollable middle — the only region that scrolls vertically.- `min-h-0` is required on a flex-1 child inside a flex column- so it can shrink below its content height and let- overflow-y-auto activate. `useScrollFade` applies a dynamic- mask-image gradient so content softly fades into the header /- footer at the edges as the user scrolls, replacing the hard- border separator. */}- <main- ref={mainRef}- style={fadeStyle}- className="min-h-0 flex-1 overflow-y-auto"- >- <div className="mx-auto w-full max-w-[620px] px-6 py-10 sm:px-10 md:px-14 lg:px-0 lg:py-14">- <div className="mb-2 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">- {t(($) => $.questionnaire.eyebrow)}- </div>- <h1 className="text-balance font-serif text-[36px] font-medium leading-[1.1] tracking-tight text-foreground">- {t(($) => $.questionnaire.headline)}- </h1>-- <div className="mt-10 flex flex-col gap-7">- <QuestionBlock- num={1}- question={t(($) => $.questionnaire.q1_question)}- ariaLabel={t(($) => $.questionnaire.q1_question)}- >- <OptionCard- selected={answers.team_size === "solo"}- onSelect={() => setTeamSize("solo")}- label={t(($) => $.questionnaire.q1_solo)}- />- <OptionCard- selected={answers.team_size === "team"}- onSelect={() => setTeamSize("team")}- label={t(($) => $.questionnaire.q1_team)}- />- <OtherOptionCard- selected={answers.team_size === "other"}- onSelect={() => setTeamSize("other")}- otherValue={answers.team_size_other ?? ""}- onOtherChange={(v) =>- setAnswers((a) => ({ ...a, team_size_other: v }))- }- placeholder={t(($) => $.questionnaire.q1_other_placeholder)}- />- </QuestionBlock>-- <QuestionBlock- num={2}- question={t(($) => $.questionnaire.q2_question)}- ariaLabel={t(($) => $.questionnaire.q2_question)}- >- <OptionCard- selected={answers.role === "developer"}- onSelect={() => setRole("developer")}- label={t(($) => $.questionnaire.q2_developer)}- />- <OptionCard- selected={answers.role === "product_lead"}- onSelect={() => setRole("product_lead")}- label={t(($) => $.questionnaire.q2_product_lead)}- />- <OptionCard- selected={answers.role === "writer"}- onSelect={() => setRole("writer")}- label={t(($) => $.questionnaire.q2_writer)}- />- <OptionCard- selected={answers.role === "founder"}- onSelect={() => setRole("founder")}- label={t(($) => $.questionnaire.q2_founder)}- />- <OtherOptionCard- selected={answers.role === "other"}- onSelect={() => setRole("other")}- otherValue={answers.role_other ?? ""}- onOtherChange={(v) =>- setAnswers((a) => ({ ...a, role_other: v }))- }- placeholder={t(($) => $.questionnaire.q2_other_placeholder)}- />- </QuestionBlock>-- <QuestionBlock- num={3}- question={t(($) => $.questionnaire.q3_question)}- ariaLabel={t(($) => $.questionnaire.q3_question)}- >- <OptionCard- selected={answers.use_case === "coding"}- onSelect={() => setUseCase("coding")}- label={t(($) => $.questionnaire.q3_coding)}- />- <OptionCard- selected={answers.use_case === "planning"}- onSelect={() => setUseCase("planning")}- label={t(($) => $.questionnaire.q3_planning)}- />- <OptionCard- selected={answers.use_case === "writing_research"}- onSelect={() => setUseCase("writing_research")}- label={t(($) => $.questionnaire.q3_writing_research)}- />- <OptionCard- selected={answers.use_case === "explore"}- onSelect={() => setUseCase("explore")}- label={t(($) => $.questionnaire.q3_explore)}- />- <OtherOptionCard- selected={answers.use_case === "other"}- onSelect={() => setUseCase("other")}- otherValue={answers.use_case_other ?? ""}- onOtherChange={(v) =>- setAnswers((a) => ({ ...a, use_case_other: v }))- }- placeholder={t(($) => $.questionnaire.q3_other_placeholder)}- />- </QuestionBlock>- </div>- </div>- </main>-- {/* Fixed footer — progress counter + Continue */}- <footer className="flex shrink-0 items-center justify-end gap-4 bg-background px-6 py-4 sm:px-10 md:px-14 lg:px-16">- <span- aria-live="polite"- className="text-xs tabular-nums text-muted-foreground"- >- {t(($) => $.questionnaire.answered_progress, { count: answeredCount })}- </span>- <Button- size="lg"- disabled={!canContinue || submitting}- onClick={submit}- >- {submitting && <Loader2 className="h-4 w-4 animate-spin" />}- {t(($) => $.common.continue)}- <ArrowRight className="h-4 w-4" />- </Button>- </footer>- </div>-- {/* Right — DragStrip + "Why we ask" side panel, independent scroll */}- <aside className="hidden min-h-0 border-l bg-muted/40 lg:flex lg:flex-col">- <DragStrip />- <div className="min-h-0 flex-1 overflow-y-auto px-12 py-12">- <WhyWeAsk />- </div>- </aside>- </div>- );-}--function QuestionBlock({- num,- question,- ariaLabel,- children,-}: {- num: number;- question: string;- ariaLabel: string;- children: ReactNode;-}) {- return (- <fieldset role="radiogroup" aria-label={ariaLabel} className="m-0 p-0">- <legend className="mb-3 flex items-baseline gap-3">- <span className="font-mono text-xs text-muted-foreground">- {String(num).padStart(2, "0")}- </span>- <span className="font-serif text-[22px] font-medium leading-tight tracking-tight text-foreground">- {question}- </span>- </legend>- <div className="flex flex-col gap-2">{children}</div>- </fieldset>- );-}--function WhyWeAsk() {- const { t } = useT("onboarding");- return (- <div className="flex max-w-[380px] flex-col gap-8">- <section className="flex flex-col gap-4">- <div className="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">- {t(($) => $.questionnaire.why_eyebrow)}- </div>- <h2 className="font-serif text-[22px] font-medium leading-[1.25] tracking-tight text-foreground">- {t(($) => $.questionnaire.why_headline)}- </h2>- </section>-- <section className="flex flex-col gap-4">- <div className="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">- {t(($) => $.questionnaire.what_eyebrow)}- </div>- <div className="flex flex-col gap-4">- <UnlockItem- icon={<PenLine className="h-4 w-4" />}- title={t(($) => $.questionnaire.unlock_starter_title)}- body={t(($) => $.questionnaire.unlock_starter_body)}- />- <UnlockItem- icon={<Sparkles className="h-4 w-4" />}- title={t(($) => $.questionnaire.unlock_agents_title)}- body={t(($) => $.questionnaire.unlock_agents_body)}- />- </div>- </section>-- <a- href="https://multica.ai/docs/agents"- target="_blank"- rel="noopener noreferrer"- className="self-start text-[13px] text-muted-foreground underline underline-offset-4 transition-colors hover:text-foreground"- >- {t(($) => $.questionnaire.learn_more)}- </a>- </div>- );-}--function UnlockItem({- icon,- title,- body,-}: {- icon: ReactNode;- title: string;- body: string;-}) {- return (- <div className="grid grid-cols-[22px_1fr] gap-3">- <div- aria-hidden- className="flex h-[20px] w-[20px] items-center justify-center text-muted-foreground"- >- {icon}- </div>- <div className="flex flex-col">- <div className="text-[13.5px] font-medium text-foreground">{title}</div>- <div className="mt-1 text-[12.5px] leading-[1.55] text-muted-foreground">- {body}- </div>- </div>- </div>- );-}diff --git a/packages/views/onboarding/steps/step-role.test.tsx b/packages/views/onboarding/steps/step-role.test.tsxnew file mode 100644index 0000000000..8beceb60dd--- /dev/null+++ b/packages/views/onboarding/steps/step-role.test.tsx@@ -0,0 +1,87 @@+import { describe, expect, it, vi, beforeEach } from "vitest";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import type { QuestionnaireAnswers } from "@multica/core/onboarding";+import { I18nProvider } from "@multica/core/i18n/react";+import enCommon from "../../locales/en/common.json";+import enOnboarding from "../../locales/en/onboarding.json";+import { StepRole } from "./step-role";++const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };++const EMPTY: QuestionnaireAnswers = {+ source: null,+ source_other: null,+ source_skipped: false,+ role: null,+ role_other: null,+ role_skipped: false,+ use_case: null,+ use_case_other: null,+ use_case_skipped: false,+ version: 2,+};++function renderStep(answers: QuestionnaireAnswers = EMPTY) {+ const onChange = vi.fn();+ const onAdvance = vi.fn();+ const onSkip = vi.fn();+ render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <StepRole+ answers={answers}+ onChange={onChange}+ onAdvance={onAdvance}+ onSkip={onSkip}+ />+ </I18nProvider>,+ );+ return { onChange, onAdvance, onSkip };+}++describe("StepRole", () => {+ beforeEach(() => vi.restoreAllMocks());++ it("selecting a role patches the slug and clears Other/skip", async () => {+ const user = userEvent.setup();+ const { onChange, onAdvance } = renderStep();++ await user.click(screen.getByRole("radio", { name: /engineer/i }));++ expect(onChange).toHaveBeenCalledWith({+ role: "engineer",+ role_other: null,+ role_skipped: false,+ });+ expect(onAdvance).not.toHaveBeenCalled();+ });++ it("Skip clears slot and marks role_skipped", async () => {+ const user = userEvent.setup();+ const { onChange, onSkip } = renderStep();++ await user.click(screen.getByRole("button", { name: /skip/i }));++ expect(onChange).toHaveBeenCalledWith({+ role: null,+ role_other: null,+ role_skipped: true,+ });+ expect(onSkip).toHaveBeenCalledTimes(1);+ });++ it("Other: selecting + typing writes role_other through onChange", async () => {+ const user = userEvent.setup();+ const { onChange } = renderStep();++ await user.click(screen.getByRole("radio", { name: /^other$/i }));+ expect(onChange).toHaveBeenCalledWith({+ role: "other",+ role_skipped: false,+ });++ const input = await screen.findByPlaceholderText(/teacher/i);+ await user.type(input, "y");+ expect(onChange).toHaveBeenLastCalledWith({ role_other: "y" });+ });+});diff --git a/packages/views/onboarding/steps/step-role.tsx b/packages/views/onboarding/steps/step-role.tsxnew file mode 100644index 0000000000..7bd5ee7b92--- /dev/null+++ b/packages/views/onboarding/steps/step-role.tsx@@ -0,0 +1,83 @@+"use client";++import {+ Briefcase,+ Code2,+ GraduationCap,+ Megaphone,+ MoreHorizontal,+ Palette,+ PenLine,+ Rocket,+ Search,+ Settings2,+} from "lucide-react";+import type { QuestionnaireAnswers, Role } from "@multica/core/onboarding";+import { StepQuestion, type QuestionOption } from "./step-question";+import { useT } from "../../i18n";++/**+ * Step 2 — "Which best describes you?" Primary signal for the+ * agent template recommendation on Step 6.+ */+export function StepRole({+ answers,+ onChange,+ onAdvance,+ onSkip,+ onBack,+}: {+ answers: QuestionnaireAnswers;+ onChange: (patch: Partial<QuestionnaireAnswers>) => void;+ onAdvance: () => void;+ onSkip: () => void;+ onBack?: () => void;+}) {+ const { t } = useT("onboarding");++ const options: QuestionOption[] = [+ { slug: "engineer", icon: <Code2 className="h-4 w-4" />, label: t(($) => $.questions.role.engineer) },+ { slug: "product", icon: <Briefcase className="h-4 w-4" />, label: t(($) => $.questions.role.product) },+ { slug: "designer", icon: <Palette className="h-4 w-4" />, label: t(($) => $.questions.role.designer) },+ { slug: "founder", icon: <Rocket className="h-4 w-4" />, label: t(($) => $.questions.role.founder) },+ { slug: "marketing", icon: <Megaphone className="h-4 w-4" />, label: t(($) => $.questions.role.marketing) },+ { slug: "writer", icon: <PenLine className="h-4 w-4" />, label: t(($) => $.questions.role.writer) },+ { slug: "research", icon: <Search className="h-4 w-4" />, label: t(($) => $.questions.role.research) },+ { slug: "ops", icon: <Settings2 className="h-4 w-4" />, label: t(($) => $.questions.role.ops) },+ { slug: "student", icon: <GraduationCap className="h-4 w-4" />, label: t(($) => $.questions.role.student) },+ { slug: "other", icon: <MoreHorizontal className="h-4 w-4" />, label: t(($) => $.questions.role.other), isOther: true },+ ];++ return (+ <StepQuestion+ step="role"+ number={2}+ eyebrow={t(($) => $.questions.eyebrow_about_you)}+ question={t(($) => $.questions.role.question)}+ options={options}+ selectedSlug={answers.role ?? (answers.role_other ? "other" : null)}+ otherValue={answers.role_other ?? ""}+ onOtherChange={(v) => onChange({ role_other: v })}+ otherPlaceholder={t(($) => $.questions.role.other_placeholder)}+ onAnswer={(slug) => {+ if (slug === "other") {+ onChange({ role: "other", role_skipped: false });+ } else {+ onChange({+ role: slug as Role,+ role_other: null,+ role_skipped: false,+ });+ }+ }}+ onAdvance={onAdvance}+ onSkip={() => {+ onChange({ role: null, role_other: null, role_skipped: true });+ onSkip();+ }}+ onBack={onBack}+ />+ );+}++StepRole.displayName = "StepRole";diff --git a/packages/views/onboarding/steps/step-runtime-connect.test.tsx b/packages/views/onboarding/steps/step-runtime-connect.test.tsxindex 9563e584c1..9b31efa500 100644--- a/packages/views/onboarding/steps/step-runtime-connect.test.tsx+++ b/packages/views/onboarding/steps/step-runtime-connect.test.tsx@@ -1,5 +1,6 @@import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";import { act, render, screen } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import type { AgentRuntime } from "@multica/core/types";import { I18nProvider } from "@multica/core/i18n/react";import enCommon from "../../locales/en/common.json";@@ -64,10 +65,15 @@ function setPicker(patch: Partial<typeof mocks.pickerState> = {}) {function renderStep() {const onNext = vi.fn();const onBack = vi.fn();+ const qc = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });render(- <I18nProvider locale="en" resources={TEST_RESOURCES}>- <StepRuntimeConnect wsId="ws_test" onNext={onNext} onBack={onBack} />- </I18nProvider>,+ <QueryClientProvider client={qc}>+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <StepRuntimeConnect wsId="ws_test" onNext={onNext} onBack={onBack} />+ </I18nProvider>+ </QueryClientProvider>,);return { onNext, onBack };}@@ -222,6 +228,8 @@ describe("StepRuntimeConnect — onboarding_runtime_detected", () => {// shell around the effect.setPicker({ runtimes: [] });renderStep();- expect(screen.getByText(/Looking for your tools/i)).toBeInTheDocument();+ expect(+ screen.getByText(/connecting this computer/i),+ ).toBeInTheDocument();});});diff --git a/packages/views/onboarding/steps/step-runtime-connect.tsx b/packages/views/onboarding/steps/step-runtime-connect.tsxindex 0e78f95038..797216ee49 100644--- a/packages/views/onboarding/steps/step-runtime-connect.tsx+++ b/packages/views/onboarding/steps/step-runtime-connect.tsx@@ -1,25 +1,18 @@"use client";-import { useEffect, useRef, useState } from "react";-import { ArrowLeft, ArrowRight, Loader2 } from "lucide-react";+import { useCallback, useEffect, useRef, useState } from "react";+import { useQueryClient } from "@tanstack/react-query";+import { ArrowLeft, ArrowRight, Loader2, RefreshCw } from "lucide-react";import { captureEvent, setPersonProperties } from "@multica/core/analytics";import { Button } from "@multica/ui/components/ui/button";-import {- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from "@multica/ui/components/ui/dialog";import { cn } from "@multica/ui/lib/utils";import { useScrollFade } from "@multica/ui/hooks/use-scroll-fade";+import { runtimeKeys } from "@multica/core/runtimes/queries";import type { AgentRuntime } from "@multica/core/types";import { DragStrip } from "@multica/views/platform";import { StepHeader } from "../components/step-header";import { RuntimeAsidePanel } from "../components/runtime-aside-panel";import { useRuntimePicker } from "../components/use-runtime-picker";-import { CloudWaitlistExpand } from "../components/cloud-waitlist-expand";import { ProviderLogo } from "../../runtimes/components/provider-logo";import { useT } from "../../i18n";@@ -43,15 +36,15 @@ export function StepRuntimeConnect({wsId,onNext,onBack,- onWaitlistSubmitted,+ onRefresh,}: {wsId: string;onNext: (runtime: AgentRuntime | null) => void | Promise<void>;onBack?: () => void;- /** Parent-level latch used to label the onboarding completion path- * as `cloud_waitlist` when the user ends up skipping this step- * after submitting the waitlist form. */- onWaitlistSubmitted?: () => void;+ /** Platform-level rescan hook. Desktop wires this to restart the+ * bundled daemon so a freshly-installed CLI shows up — otherwise the+ * daemon's PATH probe runs once at boot and never re-probes. */+ onRefresh?: () => void | Promise<void>;}) {const { runtimes, selected, selectedId, setSelectedId } =useRuntimePicker(wsId);@@ -65,7 +58,7 @@ export function StepRuntimeConnect({setSelectedId={setSelectedId}onNext={onNext}onBack={onBack}- onWaitlistSubmitted={onWaitlistSubmitted}+ onRefresh={onRefresh}/>);}@@ -87,7 +80,7 @@ function FancyView({setSelectedId,onNext,onBack,- onWaitlistSubmitted,+ onRefresh,}: {wsId: string;runtimes: AgentRuntime[];@@ -96,22 +89,28 @@ function FancyView({setSelectedId: (id: string) => void;onNext: (runtime: AgentRuntime | null) => void | Promise<void>;onBack?: () => void;- onWaitlistSubmitted?: () => void;+ onRefresh?: () => void | Promise<void>;}) {const { t } = useT("onboarding");+ const qc = useQueryClient();const mainRef = useRef<HTMLElement>(null);const fadeStyle = useScrollFade(mainRef);// Flip to "empty" only after we've waited long enough for the daemon// to report. The 5s budget covers the bundled daemon's typical 1–3s// boot; anything past that is a genuine "no runtime" situation and we- // switch from scanning skeletons to the skip / cloud-waitlist exits.+ // switch from scanning skeletons to the skip / refresh exits.+ // `scanEpoch` resets the timer when the user hits Refresh, so a+ // freshly-installed CLI gets another scanning window before falling+ // back to the empty state.+ const [scanEpoch, setScanEpoch] = useState(0);const [hasTimedOut, setHasTimedOut] = useState(false);useEffect(() => {if (runtimes.length > 0) return;- const t = window.setTimeout(() => setHasTimedOut(true), EMPTY_TIMEOUT_MS);- return () => window.clearTimeout(t);- }, [runtimes.length]);+ setHasTimedOut(false);+ const id = window.setTimeout(() => setHasTimedOut(true), EMPTY_TIMEOUT_MS);+ return () => window.clearTimeout(id);+ }, [runtimes.length, scanEpoch]);const phase: Phase =runtimes.length > 0 ? "found" : hasTimedOut ? "empty" : "scanning";@@ -165,10 +164,27 @@ function FancyView({}, [phase, runtimes, onlineCount]);const [submitting, setSubmitting] = useState(false);- // Cloud waitlist submission state lives here (rather than in EmptyView)- // so it survives phase flips — e.g. a runtime coming online after the- // user has already submitted the waitlist form.- const [waitlistSubmitted, setWaitlistSubmitted] = useState(false);+ const [refreshing, setRefreshing] = useState(false);++ // Refresh triggers a re-scan: restart the daemon (if the platform+ // wired `onRefresh`) so its PATH probe runs again, invalidate the+ // runtime query, and reset the empty-state timeout so the user sees+ // the scanning skeleton instead of the empty exits while the daemon+ // boots back up.+ const handleRefresh = useCallback(async () => {+ if (refreshing) return;+ setRefreshing(true);+ try {+ if (onRefresh) await onRefresh();+ await qc.invalidateQueries({ queryKey: runtimeKeys.all(wsId) });+ detectedEmittedRef.current = false;+ detectStartRef.current =+ typeof performance !== "undefined" ? performance.now() : Date.now();+ setScanEpoch((n) => n + 1);+ } finally {+ setRefreshing(false);+ }+ }, [onRefresh, qc, wsId, refreshing]);// Skip is always available — regardless of phase. Hitting Skip routes// the flow through the self-serve branch (agent=null), which still@@ -202,9 +218,7 @@ function FancyView({? t(($) => $.step_runtime.hint_pick): phase === "scanning"? t(($) => $.step_runtime.hint_waiting)- : waitlistSubmitted- ? t(($) => $.step_runtime.hint_waitlist_done)- : t(($) => $.step_runtime.hint_skip_or_waitlist);+ : t(($) => $.step_runtime.hint_skip_or_refresh);return (<div className="animate-onboarding-enter grid h-full min-h-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_480px]">@@ -233,7 +247,12 @@ function FancyView({{/* Scrollable middle — content changes by phase but always wrapsat max-w-[620px] so the 2-column runtime grid has room to- breathe without stretching into readability territory. */}+ breathe without stretching into readability territory.++ Skip + Continue sit inline directly below the phase view+ (not in a sticky bottom footer) so the action bar stays+ close to the form content and the page doesn't leave a+ large dead zone when the runtime list is short. */}<mainref={mainRef}style={fadeStyle}@@ -254,49 +273,47 @@ function FancyView({selectedId={selectedId}onSelect={setSelectedId}onlineCount={onlineCount}+ onRefresh={handleRefresh}+ refreshing={refreshing}/>)}{phase === "empty" && (<EmptyView- waitlistSubmitted={waitlistSubmitted}- onWaitlistSubmitted={() => {- setWaitlistSubmitted(true);- onWaitlistSubmitted?.();- }}onSkip={() => onNext(null)}+ onRefresh={handleRefresh}+ refreshing={refreshing}/>)}++ <div className="mt-8 flex flex-wrap items-center justify-end gap-x-4 gap-y-2">+ <span+ aria-live="polite"+ className="mr-auto text-xs text-muted-foreground"+ >+ {footerHint}+ </span>+ <div className="flex items-center gap-2">+ <Button+ size="lg"+ variant="secondary"+ disabled={submitting}+ onClick={handleSkip}+ >+ {t(($) => $.step_runtime.skip)}+ </Button>+ <Button+ size="lg"+ disabled={!canContinue || submitting}+ onClick={handleContinue}+ >+ {submitting && <Loader2 className="h-4 w-4 animate-spin" />}+ {t(($) => $.common.continue)}+ <ArrowRight className="h-4 w-4" />+ </Button>+ </div>+ </div></div></main>-- {/* Sticky footer — Skip (always) on the left, hint + Continue- (gated on runtime selection) on the right. Skip is the- self-serve exit: onNext(null) → bootstrap runs the no-agent- branch, onboarding still completes. */}- <footer className="flex shrink-0 items-center justify-end gap-4 bg-background px-6 py-4 sm:px-10 md:px-14 lg:px-16">- <span- aria-live="polite"- className="mr-auto text-xs text-muted-foreground"- >- {footerHint}- </span>- <Button- variant="secondary"- disabled={submitting}- onClick={handleSkip}- >- {t(($) => $.step_runtime.skip)}- </Button>- <Button- size="lg"- disabled={!canContinue || submitting}- onClick={handleContinue}- >- {submitting && <Loader2 className="h-4 w-4 animate-spin" />}- {t(($) => $.common.continue)}- <ArrowRight className="h-4 w-4" />- </Button>- </footer></div>{/* Right — always-visible educational aside. "You picked" subsection@@ -344,11 +361,15 @@ function FoundView({selectedId,onSelect,onlineCount,+ onRefresh,+ refreshing,}: {runtimes: AgentRuntime[];selectedId: string | null;onSelect: (id: string) => void;onlineCount: number;+ onRefresh: () => void;+ refreshing: boolean;}) {const { t } = useT("onboarding");const total = runtimes.length;@@ -385,6 +406,11 @@ function FoundView({/>{statusLabel}</span>+ <RefreshButton+ onClick={onRefresh}+ refreshing={refreshing}+ className="ml-auto"+ /></div><div className="mt-6 grid grid-cols-1 gap-2.5 sm:grid-cols-2">@@ -402,22 +428,28 @@ function FoundView({}function EmptyView({- waitlistSubmitted,- onWaitlistSubmitted,onSkip,+ onRefresh,+ refreshing,}: {- waitlistSubmitted: boolean;- onWaitlistSubmitted: () => void;onSkip: () => void;+ onRefresh: () => void;+ refreshing: boolean;}) {const { t } = useT("onboarding");- const [waitlistOpen, setWaitlistOpen] = useState(false);return (<div>- <h1 className="text-balance font-serif text-[36px] font-medium leading-[1.1] tracking-tight text-foreground">- {t(($) => $.step_runtime.empty_headline)}- </h1>+ <div className="flex items-start justify-between gap-4">+ <h1 className="text-balance font-serif text-[36px] font-medium leading-[1.1] tracking-tight text-foreground">+ {t(($) => $.step_runtime.empty_headline)}+ </h1>+ <RefreshButton+ onClick={onRefresh}+ refreshing={refreshing}+ className="mt-2 shrink-0"+ />+ </div><p className="mt-4 max-w-[560px] text-[15.5px] leading-[1.55] text-muted-foreground">{t(($) => $.step_runtime.empty_lede_prefix)}<span className="font-medium text-foreground">{"Claude Code"}</span>@@ -436,59 +468,82 @@ function EmptyView({onAction={onSkip}/>- <EmptyCard+ <ComingSoonCardtitle={t(($) => $.step_runtime.empty_waitlist_title)}subtitle={t(($) => $.step_runtime.empty_waitlist_subtitle)}- actionLabel={- waitlistSubmitted- ? t(($) => $.step_runtime.empty_waitlist_done)- : t(($) => $.step_runtime.empty_waitlist_action)- }- onAction={() => setWaitlistOpen(true)}+ badgeLabel={t(($) => $.step_runtime.empty_waitlist_action)}/></div>+ </div>+ );+}- <a- href="https://multica.ai/docs/install-agent-runtime"- target="_blank"- rel="noopener noreferrer"- className="mt-5 inline-block self-start text-[13px] text-muted-foreground underline underline-offset-4 transition-colors hover:text-foreground"- >- {t(($) => $.step_runtime.empty_install_link)}- </a>-- <Dialog- open={waitlistOpen}- onOpenChange={(o) => (o ? null : setWaitlistOpen(false))}+/**+ * Static, non-interactive variant of EmptyCard used for the cloud-computer+ * row. The card is dimmed and the pill is rendered as a badge so the user+ * understands the option exists but isn't actionable yet. Mirrors the+ * "Coming soon" treatment on the web platform fork.+ */+function ComingSoonCard({+ title,+ subtitle,+ badgeLabel,+}: {+ title: string;+ subtitle: string;+ badgeLabel: string;+}) {+ return (+ <div+ aria-disabled+ className="flex items-center justify-between gap-4 rounded-lg border border-dashed bg-muted/20 px-5 py-4 opacity-70"+ >+ <div className="min-w-0">+ <div className="text-[14.5px] font-medium text-foreground">{title}</div>+ <p className="mt-1 text-[12.5px] leading-[1.55] text-muted-foreground">+ {subtitle}+ </p>+ </div>+ <span+ aria-hidden+ className="inline-flex shrink-0 items-center rounded-full border bg-background px-3 py-1.5 text-[12px] font-medium uppercase tracking-wide text-muted-foreground">- <DialogContent className="flex max-h-[85vh] flex-col sm:max-w-[520px]">- <DialogHeader>- <DialogTitle>{t(($) => $.step_runtime.dialog_title)}</DialogTitle>- <DialogDescription>- {t(($) => $.step_runtime.dialog_description)}- </DialogDescription>- </DialogHeader>-- <div className="min-h-0 flex-1 overflow-y-auto pt-2">- <CloudWaitlistExpand- submitted={waitlistSubmitted}- onSubmitted={onWaitlistSubmitted}- />- </div>-- <DialogFooter>- <Button variant="ghost" onClick={() => setWaitlistOpen(false)}>- {waitlistSubmitted- ? t(($) => $.step_runtime.dialog_close)- : t(($) => $.step_runtime.dialog_cancel)}- </Button>- </DialogFooter>- </DialogContent>- </Dialog>+ {badgeLabel}+ </span></div>);}+function RefreshButton({+ onClick,+ refreshing,+ className,+}: {+ onClick: () => void;+ refreshing: boolean;+ className?: string;+}) {+ const { t } = useT("onboarding");+ return (+ <Button+ type="button"+ variant="ghost"+ size="sm"+ disabled={refreshing}+ onClick={onClick}+ className={className}+ >+ <RefreshCw+ className={cn("h-3.5 w-3.5", refreshing && "animate-spin")}+ aria-hidden+ />+ {refreshing+ ? t(($) => $.step_runtime.refreshing)+ : t(($) => $.step_runtime.refresh)}+ </Button>+ );+}+/*** Card with a prominent right-side button. Mirrors the ForkAlt pattern* from the web fork step — whole card is clickable, but the pill isdiff --git a/packages/views/onboarding/steps/step-source.test.tsx b/packages/views/onboarding/steps/step-source.test.tsxnew file mode 100644index 0000000000..e347373bd1--- /dev/null+++ b/packages/views/onboarding/steps/step-source.test.tsx@@ -0,0 +1,92 @@+import { describe, expect, it, vi, beforeEach } from "vitest";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import type { QuestionnaireAnswers } from "@multica/core/onboarding";+import { I18nProvider } from "@multica/core/i18n/react";+import enCommon from "../../locales/en/common.json";+import enOnboarding from "../../locales/en/onboarding.json";+import { StepSource } from "./step-source";++const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };++const EMPTY: QuestionnaireAnswers = {+ source: null,+ source_other: null,+ source_skipped: false,+ role: null,+ role_other: null,+ role_skipped: false,+ use_case: null,+ use_case_other: null,+ use_case_skipped: false,+ version: 2,+};++function renderStep(answers: QuestionnaireAnswers = EMPTY) {+ const onChange = vi.fn();+ const onAdvance = vi.fn();+ const onSkip = vi.fn();+ const onBack = vi.fn();+ render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <StepSource+ answers={answers}+ onChange={onChange}+ onAdvance={onAdvance}+ onSkip={onSkip}+ onBack={onBack}+ />+ </I18nProvider>,+ );+ return { onChange, onAdvance, onSkip, onBack };+}++describe("StepSource", () => {+ beforeEach(() => vi.restoreAllMocks());++ it("selecting a non-Other option patches the slug and clears Other/skip", async () => {+ const user = userEvent.setup();+ const { onChange, onAdvance } = renderStep();++ await user.click(screen.getByRole("radio", { name: /linkedin/i }));++ expect(onChange).toHaveBeenCalledWith({+ source: "social_linkedin",+ source_other: null,+ source_skipped: false,+ });+ // A click only records — it must NOT auto-advance.+ expect(onAdvance).not.toHaveBeenCalled();+ });++ it("Skip clears the slug + other and marks the step skipped, then calls onSkip", async () => {+ const user = userEvent.setup();+ const { onChange, onSkip } = renderStep();++ await user.click(screen.getByRole("button", { name: /skip/i }));++ expect(onChange).toHaveBeenCalledWith({+ source: null,+ source_other: null,+ source_skipped: true,+ });+ expect(onSkip).toHaveBeenCalledTimes(1);+ });++ it("Other: clicking marks source='other' and the free-text input writes to source_other", async () => {+ const user = userEvent.setup();+ const { onChange } = renderStep();++ await user.click(screen.getByRole("radio", { name: /^other$/i }));++ expect(onChange).toHaveBeenCalledWith({+ source: "other",+ source_skipped: false,+ });++ const input = await screen.findByPlaceholderText(/podcast/i);+ await user.type(input, "x");+ // The last onChange call from typing routes through onOtherChange:+ expect(onChange).toHaveBeenLastCalledWith({ source_other: "x" });+ });+});diff --git a/packages/views/onboarding/steps/step-source.tsx b/packages/views/onboarding/steps/step-source.tsxnew file mode 100644index 0000000000..7fb34a96c9--- /dev/null+++ b/packages/views/onboarding/steps/step-source.tsx@@ -0,0 +1,89 @@+"use client";++import {+ Briefcase,+ CalendarDays,+ Globe,+ HelpCircle,+ MoreHorizontal,+ Newspaper,+ Users,+} from "lucide-react";+import type { QuestionnaireAnswers, Source } from "@multica/core/onboarding";+import {+ GoogleIcon,+ LinkedInIcon,+ OpenAIIcon,+ XIcon,+ YouTubeIcon,+} from "../components/brand-icons";+import { StepQuestion, type QuestionOption } from "./step-question";+import { useT } from "../../i18n";++/**+ * Step 1 — "How did you hear about Multica?" Pure attribution, does+ * not influence the agent template recommendation.+ */+export function StepSource({+ answers,+ onChange,+ onAdvance,+ onSkip,+ onBack,+}: {+ answers: QuestionnaireAnswers;+ onChange: (patch: Partial<QuestionnaireAnswers>) => void;+ onAdvance: () => void;+ onSkip: () => void;+ onBack?: () => void;+}) {+ const { t } = useT("onboarding");++ const options: QuestionOption[] = [+ { slug: "friends_colleagues", icon: <Users className="h-4 w-4" />, label: t(($) => $.questions.source.friends_colleagues) },+ { slug: "search", icon: <GoogleIcon className="h-[18px] w-[18px]" />, label: t(($) => $.questions.source.search) },+ { slug: "social_x", icon: <XIcon className="h-[15px] w-[15px]" />, label: t(($) => $.questions.source.social_x) },+ { slug: "social_linkedin", icon: <LinkedInIcon className="h-[18px] w-[18px]" />, label: t(($) => $.questions.source.social_linkedin) },+ { slug: "social_youtube", icon: <YouTubeIcon className="h-[18px] w-[18px]" />, label: t(($) => $.questions.source.social_youtube) },+ { slug: "social_other", icon: <Globe className="h-4 w-4" />, label: t(($) => $.questions.source.social_misc) },+ { slug: "blog_newsletter", icon: <Newspaper className="h-4 w-4" />, label: t(($) => $.questions.source.blog_newsletter) },+ { slug: "ai_assistant", icon: <OpenAIIcon className="h-[16px] w-[16px]" />, label: t(($) => $.questions.source.ai_assistant) },+ { slug: "from_work", icon: <Briefcase className="h-4 w-4" />, label: t(($) => $.questions.source.from_work) },+ { slug: "event_conference", icon: <CalendarDays className="h-4 w-4" />, label: t(($) => $.questions.source.event_conference) },+ { slug: "dont_remember", icon: <HelpCircle className="h-4 w-4" />, label: t(($) => $.questions.source.dont_remember) },+ { slug: "other", icon: <MoreHorizontal className="h-4 w-4" />, label: t(($) => $.questions.source.other), isOther: true },+ ];++ return (+ <StepQuestion+ step="source"+ number={1}+ eyebrow={t(($) => $.questions.eyebrow_about_you)}+ question={t(($) => $.questions.source.question)}+ options={options}+ selectedSlug={answers.source ?? (answers.source_other ? "other" : null)}+ otherValue={answers.source_other ?? ""}+ onOtherChange={(v) => onChange({ source_other: v })}+ otherPlaceholder={t(($) => $.questions.source.other_placeholder)}+ onAnswer={(slug) => {+ if (slug === "other") {+ onChange({ source: "other", source_skipped: false });+ } else {+ onChange({+ source: slug as Source,+ source_other: null,+ source_skipped: false,+ });+ }+ }}+ onAdvance={onAdvance}+ onSkip={() => {+ onChange({ source: null, source_other: null, source_skipped: true });+ onSkip();+ }}+ onBack={onBack}+ />+ );+}++StepSource.displayName = "StepSource";diff --git a/packages/views/onboarding/steps/step-use-case.test.tsx b/packages/views/onboarding/steps/step-use-case.test.tsxnew file mode 100644index 0000000000..87af6b0c49--- /dev/null+++ b/packages/views/onboarding/steps/step-use-case.test.tsx@@ -0,0 +1,87 @@+import { describe, expect, it, vi, beforeEach } from "vitest";+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import type { QuestionnaireAnswers } from "@multica/core/onboarding";+import { I18nProvider } from "@multica/core/i18n/react";+import enCommon from "../../locales/en/common.json";+import enOnboarding from "../../locales/en/onboarding.json";+import { StepUseCase } from "./step-use-case";++const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };++const EMPTY: QuestionnaireAnswers = {+ source: null,+ source_other: null,+ source_skipped: false,+ role: null,+ role_other: null,+ role_skipped: false,+ use_case: null,+ use_case_other: null,+ use_case_skipped: false,+ version: 2,+};++function renderStep(answers: QuestionnaireAnswers = EMPTY) {+ const onChange = vi.fn();+ const onAdvance = vi.fn();+ const onSkip = vi.fn();+ render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <StepUseCase+ answers={answers}+ onChange={onChange}+ onAdvance={onAdvance}+ onSkip={onSkip}+ />+ </I18nProvider>,+ );+ return { onChange, onAdvance, onSkip };+}++describe("StepUseCase", () => {+ beforeEach(() => vi.restoreAllMocks());++ it("selecting a use case patches the slug and clears Other/skip", async () => {+ const user = userEvent.setup();+ const { onChange, onAdvance } = renderStep();++ await user.click(screen.getByRole("radio", { name: /ship code/i }));++ expect(onChange).toHaveBeenCalledWith({+ use_case: "ship_code",+ use_case_other: null,+ use_case_skipped: false,+ });+ expect(onAdvance).not.toHaveBeenCalled();+ });++ it("Skip clears slot and marks use_case_skipped", async () => {+ const user = userEvent.setup();+ const { onChange, onSkip } = renderStep();++ await user.click(screen.getByRole("button", { name: /skip/i }));++ expect(onChange).toHaveBeenCalledWith({+ use_case: null,+ use_case_other: null,+ use_case_skipped: true,+ });+ expect(onSkip).toHaveBeenCalledTimes(1);+ });++ it("Other: selecting + typing writes use_case_other through onChange", async () => {+ const user = userEvent.setup();+ const { onChange } = renderStep();++ await user.click(screen.getByRole("radio", { name: /^other$/i }));+ expect(onChange).toHaveBeenCalledWith({+ use_case: "other",+ use_case_skipped: false,+ });++ const input = await screen.findByPlaceholderText(/study group/i);+ await user.type(input, "z");+ expect(onChange).toHaveBeenLastCalledWith({ use_case_other: "z" });+ });+});diff --git a/packages/views/onboarding/steps/step-use-case.tsx b/packages/views/onboarding/steps/step-use-case.tsxnew file mode 100644index 0000000000..c22f0d9fc7--- /dev/null+++ b/packages/views/onboarding/steps/step-use-case.tsx@@ -0,0 +1,79 @@+"use client";++import {+ Brain,+ Code2,+ Compass,+ FileEdit,+ ListChecks,+ MoreHorizontal,+ Settings2,+ User,+} from "lucide-react";+import type { QuestionnaireAnswers, UseCase } from "@multica/core/onboarding";+import { StepQuestion, type QuestionOption } from "./step-question";+import { useT } from "../../i18n";++/**+ * Step 3 — "What do you want to use Multica for?" Tiebreaker for+ * the agent template recommendation when role alone is ambiguous.+ */+export function StepUseCase({+ answers,+ onChange,+ onAdvance,+ onSkip,+ onBack,+}: {+ answers: QuestionnaireAnswers;+ onChange: (patch: Partial<QuestionnaireAnswers>) => void;+ onAdvance: () => void;+ onSkip: () => void;+ onBack?: () => void;+}) {+ const { t } = useT("onboarding");++ const options: QuestionOption[] = [+ { slug: "ship_code", icon: <Code2 className="h-4 w-4" />, label: t(($) => $.questions.use_case.ship_code) },+ { slug: "manage_team", icon: <ListChecks className="h-4 w-4" />, label: t(($) => $.questions.use_case.manage_team) },+ { slug: "personal_tasks", icon: <User className="h-4 w-4" />, label: t(($) => $.questions.use_case.personal_tasks) },+ { slug: "plan_research", icon: <Brain className="h-4 w-4" />, label: t(($) => $.questions.use_case.plan_research) },+ { slug: "write_publish", icon: <FileEdit className="h-4 w-4" />, label: t(($) => $.questions.use_case.write_publish) },+ { slug: "automate_ops", icon: <Settings2 className="h-4 w-4" />, label: t(($) => $.questions.use_case.automate_ops) },+ { slug: "evaluate", icon: <Compass className="h-4 w-4" />, label: t(($) => $.questions.use_case.evaluate) },+ { slug: "other", icon: <MoreHorizontal className="h-4 w-4" />, label: t(($) => $.questions.use_case.other), isOther: true },+ ];++ return (+ <StepQuestion+ step="use_case"+ number={3}+ eyebrow={t(($) => $.questions.eyebrow_about_you)}+ question={t(($) => $.questions.use_case.question)}+ options={options}+ selectedSlug={answers.use_case ?? (answers.use_case_other ? "other" : null)}+ otherValue={answers.use_case_other ?? ""}+ onOtherChange={(v) => onChange({ use_case_other: v })}+ otherPlaceholder={t(($) => $.questions.use_case.other_placeholder)}+ onAnswer={(slug) => {+ if (slug === "other") {+ onChange({ use_case: "other", use_case_skipped: false });+ } else {+ onChange({+ use_case: slug as UseCase,+ use_case_other: null,+ use_case_skipped: false,+ });+ }+ }}+ onAdvance={onAdvance}+ onSkip={() => {+ onChange({ use_case: null, use_case_other: null, use_case_skipped: true });+ onSkip();+ }}+ onBack={onBack}+ />+ );+}++StepUseCase.displayName = "StepUseCase";diff --git a/packages/views/onboarding/steps/step-workspace.tsx b/packages/views/onboarding/steps/step-workspace.tsxindex 3ccd5dec48..2c945b8065 100644--- a/packages/views/onboarding/steps/step-workspace.tsx+++ b/packages/views/onboarding/steps/step-workspace.tsx@@ -321,18 +321,21 @@ export function StepWorkspace({createFields)}</div>++ <div className="mt-8 flex flex-wrap items-center justify-end gap-x-4 gap-y-2">+ <span+ aria-live="polite"+ className="mr-auto text-xs text-muted-foreground"+ >+ {hint}+ </span>+ <Button size="lg" disabled={continueDisabled} onClick={onContinue}>+ {continueLabel}+ <ArrowRight className="h-4 w-4" />+ </Button>+ </div></div></main>-- <footer className="flex shrink-0 items-center justify-end gap-4 bg-background px-6 py-4 sm:px-10 md:px-14 lg:px-16">- <span aria-live="polite" className="text-xs text-muted-foreground">- {hint}- </span>- <Button size="lg" disabled={continueDisabled} onClick={onContinue}>- {continueLabel}- <ArrowRight className="h-4 w-4" />- </Button>- </footer></div>{/* Right — side panel.diff --git a/packages/views/onboarding/utils/starter-content-content-en.ts b/packages/views/onboarding/utils/starter-content-content-en.tsindex db921e446b..70c179c975 100644--- a/packages/views/onboarding/utils/starter-content-content-en.ts+++ b/packages/views/onboarding/utils/starter-content-content-en.ts@@ -63,26 +63,33 @@ export function buildWelcomeIssueText(].join("\n");switch (q.use_case) {- case "coding":+ case "ship_code":return {title: "👋 Welcome to Multica — let's work together",- description: `${header}Hi agent, this is ${name}'s first time using Multica. They plan to use you mostly for **coding work**.\n\n${sharedInstructions}`,+ description: `${header}Hi agent, this is ${name}'s first time using Multica. They plan to use you mostly for **shipping code**.\n\n${sharedInstructions}`,};- case "planning":+ case "manage_team":+ case "plan_research":return {title: "👋 Welcome to Multica — let's work together",description: `${header}Hi agent, this is ${name}'s first time using Multica. They want your help with **planning and breaking down work**.\n\n${sharedInstructions}`,};- case "writing_research":+ case "write_publish":return {title: "👋 Welcome to Multica — let's work together",- description: `${header}Hi agent, this is ${name}'s first time using Multica. They'll use you for **research and writing** — drafting, summarizing, analysis.\n\n${sharedInstructions}`,+ description: `${header}Hi agent, this is ${name}'s first time using Multica. They'll use you for **writing and publishing** — drafting, editing, summarizing.\n\n${sharedInstructions}`,};- case "explore":+ case "evaluate":return {title: "👋 Welcome to Multica — let's work together",description: `${header}Hi agent, this is ${name}'s first time using Multica. They're **exploring** what Multica can do — no specific goal yet.\n\n${exploreInstructions}`,};+ case "personal_tasks":+ case "automate_ops":+ return {+ title: "👋 Welcome to Multica — let's work together",+ description: `${header}Hi agent, this is ${name}'s first time using Multica. They want your help with **day-to-day tasks and automation**.\n\n${sharedInstructions}`,+ };case "other": {const customUseCase = (q.use_case_other ?? "").trim();const contextLine = customUseCase@@ -185,7 +192,7 @@ export function buildAgentGuidedSubIssues(const tier2: ImportStarterIssuePayload[] = [];- if (q.team_size === "team") {+ if (q.use_case === "manage_team") {tier2.push({status: "todo",priority: "medium",@@ -208,7 +215,7 @@ export function buildAgentGuidedSubIssues(});}- if (q.role === "developer" || q.use_case === "coding") {+ if (q.role === "engineer" || q.use_case === "ship_code") {tier2.push({status: "todo",priority: "medium",@@ -489,7 +496,7 @@ export function buildSelfServeSubIssues(},];- if (q.role === "developer" || q.use_case === "coding") {+ if (q.role === "engineer" || q.use_case === "ship_code") {tier3.push({status: "backlog",priority: "low",@@ -508,7 +515,7 @@ export function buildSelfServeSubIssues(});}- if (q.team_size === "team") {+ if (q.use_case === "manage_team") {tier3.push({status: "backlog",priority: "low",diff --git a/packages/views/onboarding/utils/starter-content-content-zh.ts b/packages/views/onboarding/utils/starter-content-content-zh.tsindex e99c9ba4a9..cfe9c576b7 100644--- a/packages/views/onboarding/utils/starter-content-content-zh.ts+++ b/packages/views/onboarding/utils/starter-content-content-zh.ts@@ -66,26 +66,33 @@ export function buildWelcomeIssueText(].join("\n");switch (q.use_case) {- case "coding":+ case "ship_code":return {title: "👋 欢迎来到 Multica —— 一起开工",description: `${header}你好智能体,这是 ${name} 第一次用 Multica。${name} 主要会让你做 **编码相关的工作**。\n\n${sharedInstructions}`,};- case "planning":+ case "manage_team":+ case "plan_research":return {title: "👋 欢迎来到 Multica —— 一起开工",description: `${header}你好智能体,这是 ${name} 第一次用 Multica。${name} 希望你帮忙做 **规划与拆解工作**。\n\n${sharedInstructions}`,};- case "writing_research":+ case "write_publish":return {title: "👋 欢迎来到 Multica —— 一起开工",- description: `${header}你好智能体,这是 ${name} 第一次用 Multica。${name} 会让你做 **调研和写作** —— 起草、摘要、分析。\n\n${sharedInstructions}`,+ description: `${header}你好智能体,这是 ${name} 第一次用 Multica。${name} 会让你做 **写作、编辑、发布** —— 起草、摘要、分析。\n\n${sharedInstructions}`,};- case "explore":+ case "evaluate":return {title: "👋 欢迎来到 Multica —— 一起开工",description: `${header}你好智能体,这是 ${name} 第一次用 Multica。${name} 还在 **探索** Multica 能做什么 —— 暂时没有具体目标。\n\n${exploreInstructions}`,};+ case "personal_tasks":+ case "automate_ops":+ return {+ title: "👋 欢迎来到 Multica —— 一起开工",+ description: `${header}你好智能体,这是 ${name} 第一次用 Multica。${name} 希望你帮忙做 **日常任务和自动化**。\n\n${sharedInstructions}`,+ };case "other": {const customUseCase = (q.use_case_other ?? "").trim();const contextLine = customUseCase@@ -188,7 +195,7 @@ export function buildAgentGuidedSubIssues(const tier2: ImportStarterIssuePayload[] = [];- if (q.team_size === "team") {+ if (q.use_case === "manage_team") {tier2.push({status: "todo",priority: "medium",@@ -211,7 +218,7 @@ export function buildAgentGuidedSubIssues(});}- if (q.role === "developer" || q.use_case === "coding") {+ if (q.role === "engineer" || q.use_case === "ship_code") {tier2.push({status: "todo",priority: "medium",@@ -492,7 +499,7 @@ export function buildSelfServeSubIssues(},];- if (q.role === "developer" || q.use_case === "coding") {+ if (q.role === "engineer" || q.use_case === "ship_code") {tier3.push({status: "backlog",priority: "low",@@ -511,7 +518,7 @@ export function buildSelfServeSubIssues(});}- if (q.team_size === "team") {+ if (q.use_case === "manage_team") {tier3.push({status: "backlog",priority: "low",diff --git a/server/internal/analytics/events.go b/server/internal/analytics/events.goindex 463e8f1e2f..49749f7513 100644--- a/server/internal/analytics/events.go+++ b/server/internal/analytics/events.go@@ -386,37 +386,42 @@ func TeamInviteAccepted(inviteeID, workspaceID string, daysSinceInvite int64) Ev}// OnboardingQuestionnaireSubmitted fires the first time a user's-// `user.onboarding_questionnaire` transitions from empty (or partial) to-// all three answers present. The handler drives this transition — we-// emit from PatchOnboarding so the single emission site stays honest-// even if the frontend retries.+// `user.onboarding_questionnaire` transitions from "at least one slot+// unresolved" to "every slot has either an answer or a skip marker".+// The handler drives this transition — we emit from PatchOnboarding so+// the single emission site stays honest even if the frontend retries.//// The three answers are also mirrored into person properties via $set-// so cohorting by role / use_case / team_size works across every event+// so cohorting by source / role / use_case works across every event// on the same user without re-joining back to the DB.//-// teamSizeOther / roleOther / useCaseOther are presence booleans only —-// the free-text content is kept in the DB for product research but not-// broadcast via analytics (PII risk + low cardinality ask).-func OnboardingQuestionnaireSubmitted(userID, teamSize, role, useCase string, teamSizeOther, roleOther, useCaseOther bool) Event {+// `*Skipped` booleans capture per-question skip intent (the new v2+// signal). `*HasOther` are presence booleans for the free-text "other"+// override; the free-text content is kept in the DB for product+// research but not broadcast via analytics (PII risk + low cardinality+// ask).+func OnboardingQuestionnaireSubmitted(userID, source, role, useCase string, sourceSkipped, roleSkipped, useCaseSkipped, sourceHasOther, roleHasOther, useCaseHasOther bool) Event {return Event{Name: EventOnboardingQuestionnaireSubmit,DistinctID: userID,Properties: withCoreProperties(map[string]any{- "team_size": teamSize,- "role": role,- "use_case": useCase,- "team_size_has_other": teamSizeOther,- "role_has_other": roleOther,- "use_case_has_other": useCaseOther,+ "source": source,+ "role": role,+ "use_case": useCase,+ "source_skipped": sourceSkipped,+ "role_skipped": roleSkipped,+ "use_case_skipped": useCaseSkipped,+ "source_has_other": sourceHasOther,+ "role_has_other": roleHasOther,+ "use_case_has_other": useCaseHasOther,}, CoreProperties{UserID: userID,Source: SourceOnboarding,}),Set: map[string]any{- "team_size": teamSize,- "role": role,- "use_case": useCase,+ "source": source,+ "role": role,+ "use_case": useCase,},}}diff --git a/server/internal/handler/onboarding.go b/server/internal/handler/onboarding.goindex 386bb49854..b428ba54d8 100644--- a/server/internal/handler/onboarding.go+++ b/server/internal/handler/onboarding.go@@ -121,20 +121,44 @@ type patchOnboardingRequest struct {Questionnaire *json.RawMessage `json:"questionnaire,omitempty"`}-// questionnaireAnswers mirrors the frontend's `QuestionnaireAnswers`-// shape. Only the first-time submission — every slot filled — is a-// funnel signal; partial saves are allowed but never emit.+// questionnaireAnswers mirrors the frontend's v2 `QuestionnaireAnswers`+// shape. Each of source / role / use_case has a value, an optional+// free-text "other" override, and a skip marker. The questionnaire is+// "resolved" once every slot has either an answer or a skip marker;+// the funnel event fires on the transition into that state.type questionnaireAnswers struct {- TeamSize string `json:"team_size"`- TeamSizeOther string `json:"team_size_other"`- Role string `json:"role"`- RoleOther string `json:"role_other"`- UseCase string `json:"use_case"`- UseCaseOther string `json:"use_case_other"`+ Source string `json:"source"`+ SourceOther string `json:"source_other"`+ SourceSkipped bool `json:"source_skipped"`+ Role string `json:"role"`+ RoleOther string `json:"role_other"`+ RoleSkipped bool `json:"role_skipped"`+ UseCase string `json:"use_case"`+ UseCaseOther string `json:"use_case_other"`+ UseCaseSkipped bool `json:"use_case_skipped"`+ Version int `json:"version"`}+func (q questionnaireAnswers) sourceResolved() bool {+ return q.Source != "" || q.SourceSkipped+}+func (q questionnaireAnswers) roleResolved() bool {+ return q.Role != "" || q.RoleSkipped+}+func (q questionnaireAnswers) useCaseResolved() bool {+ return q.UseCase != "" || q.UseCaseSkipped+}++// questionnaireSchemaVersion is the schema this handler understands.+// `complete()` and the funnel event are scoped to this version so a+// future v3 row can't be silently mis-counted against v2 semantics.+const questionnaireSchemaVersion = 2+func (q questionnaireAnswers) complete() bool {- return q.TeamSize != "" && q.Role != "" && q.UseCase != ""+ if q.Version != questionnaireSchemaVersion {+ return false+ }+ return q.sourceResolved() && q.roleResolved() && q.useCaseResolved()}// PatchOnboarding persists the user's questionnaire answers. The@@ -185,10 +209,13 @@ func (h *Handler) PatchOnboarding(w http.ResponseWriter, r *http.Request) {if after.complete() && !before.complete() {h.Analytics.Capture(analytics.OnboardingQuestionnaireSubmitted(userID,- after.TeamSize,+ after.Source,after.Role,after.UseCase,- after.TeamSizeOther != "",+ after.SourceSkipped,+ after.RoleSkipped,+ after.UseCaseSkipped,+ after.SourceOther != "",after.RoleOther != "",after.UseCaseOther != "",))diff --git a/server/migrations/094_onboarding_questionnaire_v2.down.sql b/server/migrations/094_onboarding_questionnaire_v2.down.sqlnew file mode 100644index 0000000000..707e240e44--- /dev/null+++ b/server/migrations/094_onboarding_questionnaire_v2.down.sql@@ -0,0 +1,31 @@+-- Inverse of 093_onboarding_questionnaire_v2.up.sql. Lossy: `source`+-- (any value), per-question skip markers, and the v2-specific+-- use_case values (personal_tasks / plan_research / automate_ops)+-- have no v1 equivalent. We map what we can; remaining slots stay+-- null. This is acceptable — we rarely run migrate-down against prod.++UPDATE "user"+SET onboarding_questionnaire = jsonb_strip_nulls(jsonb_build_object(+ 'team_size', NULL,+ 'team_size_other', NULL,+ 'role', CASE onboarding_questionnaire->>'role'+ WHEN 'engineer' THEN 'developer'+ WHEN 'product' THEN 'product_lead'+ WHEN 'writer' THEN 'writer'+ WHEN 'founder' THEN 'founder'+ WHEN 'other' THEN 'other'+ ELSE NULL+ END,+ 'role_other', onboarding_questionnaire->>'role_other',+ 'use_case', CASE onboarding_questionnaire->>'use_case'+ WHEN 'ship_code' THEN 'coding'+ WHEN 'manage_team' THEN 'planning'+ WHEN 'write_publish' THEN 'writing_research'+ WHEN 'evaluate' THEN 'explore'+ WHEN 'other' THEN 'other'+ ELSE NULL+ END,+ 'use_case_other', onboarding_questionnaire->>'use_case_other'+ ))+WHERE onboarding_questionnaire IS NOT NULL+ AND onboarding_questionnaire->>'version' = '2';diff --git a/server/migrations/094_onboarding_questionnaire_v2.up.sql b/server/migrations/094_onboarding_questionnaire_v2.up.sqlnew file mode 100644index 0000000000..fbae09e98e--- /dev/null+++ b/server/migrations/094_onboarding_questionnaire_v2.up.sql@@ -0,0 +1,44 @@+-- Onboarding questionnaire schema v1 → v2 migration.+--+-- v1 shape: { team_size, team_size_other, role, role_other, use_case, use_case_other }+-- v2 shape: { source, source_*, role, role_*, use_case, use_case_*, version: 2 }+--+-- `team_size` is dropped entirely. `role` and `use_case` are remapped+-- to the new enum vocabulary. Historical nulls stay null (NOT marked+-- `*_skipped: true` — the v1 flow forbade skips, so attributing skip+-- intent retroactively would pollute analytics). `source` is null for+-- everyone (we never asked).++UPDATE "user"+SET onboarding_questionnaire = jsonb_strip_nulls(jsonb_build_object(+ 'source', NULL,+ 'source_other', NULL,+ 'source_skipped', false,+ 'role', CASE onboarding_questionnaire->>'role'+ WHEN 'developer' THEN 'engineer'+ WHEN 'product_lead' THEN 'product'+ WHEN 'writer' THEN 'writer'+ WHEN 'founder' THEN 'founder'+ WHEN 'other' THEN 'other'+ ELSE NULL+ END,+ 'role_other', onboarding_questionnaire->>'role_other',+ 'role_skipped', false,+ 'use_case', CASE onboarding_questionnaire->>'use_case'+ WHEN 'coding' THEN 'ship_code'+ WHEN 'planning' THEN 'manage_team'+ WHEN 'writing_research' THEN 'write_publish'+ WHEN 'explore' THEN 'evaluate'+ WHEN 'other' THEN 'other'+ ELSE NULL+ END,+ 'use_case_other', onboarding_questionnaire->>'use_case_other',+ 'use_case_skipped', false,+ 'version', 2+ ))+WHERE onboarding_questionnaire IS NOT NULL+ AND (onboarding_questionnaire ? 'team_size'+ OR onboarding_questionnaire ? 'role'+ OR onboarding_questionnaire ? 'use_case')+ AND (onboarding_questionnaire->>'version' IS NULL+ OR onboarding_questionnaire->>'version' = '1');