Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(spaces): getting-started checklist in the shared web UI (CUA-1359) (#4999)
Francesco Bonacci9ad6a396cd19
diff --git a/apps/cua-spaces-desktop/src/main.ts b/apps/cua-spaces-desktop/src/main.tsindex 525a9eba97..43566f2041 100644--- a/apps/cua-spaces-desktop/src/main.ts+++ b/apps/cua-spaces-desktop/src/main.ts@@ -237,13 +237,14 @@ if (!app.requestSingleInstanceLock()) {// The page's New Space wizard; Settings (the page's own route, without reloading it).const newSpace = () => tellMain("spaces.newRequested", { on: null });const openSettings = () => tellMain("settings.openRequested");+ const gettingStarted = () => tellMain("checklist.openRequested");app.on("second-instance", showMain);app.whenReady().then(async () => {migrateSwiftApp();initTheme();- installMenu({ newSpace, settings: openSettings });+ installMenu({ newSpace, settings: openSettings, gettingStarted });handleViewerKeyboard();if (process.platform !== "darwin") handleOverlayDim();const { webRoot } = handleAppProtocol();diff --git a/apps/cua-spaces-desktop/src/menu.ts b/apps/cua-spaces-desktop/src/menu.tsindex 593207357c..3ff837d588 100644--- a/apps/cua-spaces-desktop/src/menu.ts+++ b/apps/cua-spaces-desktop/src/menu.ts@@ -6,7 +6,8 @@// Services, Hide and Quit; File with New Space (⌘N) and Close; Edit; View// with Enter Full Screen only (no reload or zoom: the Swift app has none;// a development build keeps Reload and the developer tools); Window; and-// Help with "Cua Spaces Help", which opens the docs. Windows and Linux get+// Help with Getting Started (the page's checklist) and "Cua Spaces Help",+// which opens the docs. Windows and Linux get// the same items in their own places: New Space, Settings… and Exit in// File, the help item in Help.//@@ -23,6 +24,8 @@ export interface MenuActions {newSpace(): void;/** Settings in the main window. */settings(): void;+ /** The getting-started checklist in the main window, shown again. */+ gettingStarted(): void;}/** The menu for `platform`; `dev` (an unpackaged build) adds Reload and the developer tools. */@@ -64,7 +67,10 @@ export function menuTemplate(platform: NodeJS.Platform, actions: MenuActions, {{ role: "windowMenu" },{role: "help",- submenu: [{ label: `${appName} Help`, click: () => void shell.openExternal(HELP_URL) }],+ submenu: [+ { label: "Getting Started", click: () => actions.gettingStarted() },+ { label: `${appName} Help`, click: () => void shell.openExternal(HELP_URL) },+ ],},];}diff --git a/apps/cua-spaces-desktop/test/menu.test.ts b/apps/cua-spaces-desktop/test/menu.test.tsindex ae3da5ee3e..be596323f0 100644--- a/apps/cua-spaces-desktop/test/menu.test.ts+++ b/apps/cua-spaces-desktop/test/menu.test.ts@@ -3,7 +3,7 @@// The application menu (menu.ts), as the SwiftUI app's: Settings… (⌘,) in// the app menu, New Space (⌘N) in File, Enter Full Screen only in View (no-// reload or zoom outside development), "Cua Spaces Help" opening the docs,+// reload or zoom outside development), Getting Started and "Cua Spaces Help" (the docs) in Help,// and no "Quit and Keep Windows"; Windows and Linux carry the same items.import { describe, expect, it, vi } from "vitest";import type { MenuItemConstructorOptions } from "electron";@@ -26,7 +26,7 @@ const names = (items: Item[]) => items.map((i) => (i.type === "separator" ? "---function actions() {const log: string[] = [];- return { log, actions: { newSpace: () => log.push("new"), settings: () => log.push("settings") } };+ return { log, actions: { newSpace: () => log.push("new"), settings: () => log.push("settings"), gettingStarted: () => log.push("getting-started") } };}describe("the macOS menu", () => {@@ -57,8 +57,10 @@ describe("the macOS menu", () => {expect(log).toEqual(["new"]);expect(names(sub(t, "View"))).toEqual(["togglefullscreen"]);const help = sub(t, "help");- expect(names(help)).toEqual(["Cua Spaces Help"]);+ expect(names(help)).toEqual(["Getting Started", "Cua Spaces Help"]);(help[0]!.click as () => void)();+ expect(log).toEqual(["new", "getting-started"]);+ (help[1]!.click as () => void)();expect(openExternal).toHaveBeenCalledWith(HELP_URL);});@@ -91,7 +93,7 @@ describe("the Windows and Linux menu", () => {for (const i of file) (i.click as (() => void) | undefined)?.();expect(log).toEqual(["new", "settings"]);expect(names(sub(t, "View"))).toEqual(["togglefullscreen"]);- expect(names(sub(t, "help"))).toEqual(["Cua Spaces Help"]);+ expect(names(sub(t, "help"))).toEqual(["Getting Started", "Cua Spaces Help"]);}});});diff --git a/apps/cua-spaces-web/e2e/parity.spec.ts b/apps/cua-spaces-web/e2e/parity.spec.tsindex c830257737..871295ca91 100644--- a/apps/cua-spaces-web/e2e/parity.spec.ts+++ b/apps/cua-spaces-web/e2e/parity.spec.ts@@ -355,7 +355,9 @@ async function checkTelemetry(page: Page, cps: Of<"telemetry">[]): Promise<numbeawait expect.poll(() => tracked(page)).toContainEqual({ type: "launched", onboardingEligible: false });const before = (await tracked(page)).length;for (const cp of cps) await track(page, cp.signals);- expect((await tracked(page)).slice(before), "the host recorded the core's events").toEqual(cps.flatMap((c) => c.signals));+ // The getting-started checklist records its own steps as the page loads; they are not this flow's.+ const ours = (await tracked(page)).slice(before).filter((s) => !(s.type === "step" && s.step.startsWith("checklist_")));+ expect(ours, "the host recorded the core's events").toEqual(cps.flatMap((c) => c.signals));await page.evaluate(() => window.__cuaParity!.setTelemetry(false));const off = (await tracked(page)).length;diff --git a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.tsnew file mode 100644index 0000000000..a24c55c7c6--- /dev/null+++ b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts@@ -0,0 +1,64 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { beforeEach, describe, expect, it } from "vitest";++import { CHECKLIST_STEPS, checklistDone, readChecklist, resetChecklistCache, telemetryChecklist } from "../checklist";+import type { BridgeStore } from "../store";+import { sanitizeSignals, type TelemetrySignal } from "../ops/telemetry";+import { testCore, wasmBuilt } from "./testCore";++const KEY = "cua-spaces:checklist";++async function fakeStore(): Promise<{ store: BridgeStore; sent: TelemetrySignal[] }> {+ const sent: TelemetrySignal[] = [];+ const core = await testCore();+ const store = { core, telemetry: { track: async (s: readonly unknown[]) => void sent.push(...sanitizeSignals(s)) } } as unknown as BridgeStore;+ return { store, sent };+}++beforeEach(() => {+ localStorage.clear();+ resetChecklistCache();+});++describe("the getting-started checklist", () => {+ it("keeps each step done between launches", async () => {+ const { store } = await fakeStore();+ checklistDone(store, "create_space");+ resetChecklistCache();+ expect(readChecklist().done).toEqual({ create_space: true });+ expect(JSON.parse(localStorage.getItem(KEY)!)).toMatchObject({ done: { create_space: true }, dismissed: false });+ });++ it("reads only known steps and flags from storage", () => {+ localStorage.setItem(KEY, JSON.stringify({ done: { share: true, "[email protected]": true }, dismissed: "yes", shown: true }));+ expect(readChecklist()).toEqual({ done: { share: true }, dismissed: false, shown: true });+ resetChecklistCache();+ localStorage.setItem(KEY, "{not json");+ expect(readChecklist()).toEqual({ done: {}, dismissed: false, shown: false });+ });++ it.skipIf(!wasmBuilt)("records each step once, then completed with the last", async () => {+ const { store, sent } = await fakeStore();+ for (const step of CHECKLIST_STEPS) {+ checklistDone(store, step);+ checklistDone(store, step);+ }+ const steps = sent.map((s) => (s.type === "step" ? `${s.step} ${s.ok}` : s.type));+ expect(steps).toEqual([+ "checklist_add_machine true",+ "checklist_create_space true",+ "checklist_teleport true",+ "checklist_share true",+ "checklist_run_agent true",+ "checklist_completed true",+ ]);+ });++ it.skipIf(!wasmBuilt)("sends nothing for a word the core doesn't know", async () => {+ const core = await testCore();+ expect(telemetryChecklist(core, "shown")).toEqual([{ type: "step", step: "checklist_shown", ok: true }]);+ expect(telemetryChecklist(core, "[email protected]" as never)).toEqual([]);+ });+});diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.tsindex 57d7a28469..b345b6bc38 100644--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts@@ -58,6 +58,7 @@ import type { SpaceRow } from "../contracts/spaces";import {isWebkitResponse,WEBKIT_EVENT,+ WEBKIT_OPEN_CHECKLIST_EVENT,WEBKIT_OPEN_SETTINGS_EVENT,type HostMethod,type WebkitEventDetail,@@ -586,10 +587,10 @@ export function createWebkitAdapter(requestNewSpace(typeof on === "string" && on ? on : null);return;}- // The Electron menu's Settings… (⌘,): the same window event the SwiftUI+ // The Electron menu's Settings… (⌘,) and Help > Getting Started: the same window event the SwiftUI// host sends, which the page's key bindings answer (the SwiftUI host's// already arrives as one).- if (detail?.event === WEBKIT_OPEN_SETTINGS_EVENT) {+ if (detail?.event === WEBKIT_OPEN_SETTINGS_EVENT || detail?.event === WEBKIT_OPEN_CHECKLIST_EVENT) {if (electron) (win as unknown as Partial<Window>).dispatchEvent?.(new CustomEvent(WEBKIT_EVENT, { detail }));return;}diff --git a/apps/cua-spaces-web/src/bridge/checklist.ts b/apps/cua-spaces-web/src/bridge/checklist.tsnew file mode 100644index 0000000000..22605268b3--- /dev/null+++ b/apps/cua-spaces-web/src/bridge/checklist.ts@@ -0,0 +1,181 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++/**+ * The getting-started checklist: the first things worth doing in Cua+ * Spaces, ticked off as they happen and kept between launches (this+ * page's storage, like the first run's progress).+ *+ * Usage events are the core's (`telemetry.checklist`): `cua_onboarding_step`+ * with step `checklist_shown`, `checklist_<step>` (once per step),+ * `checklist_completed`, `checklist_dismissed` or `checklist_reopened`.+ */++import { useContext, useEffect, useSyncExternalStore } from "react";++import { BridgeContext } from "./BridgeProvider";+import type { CoreClient } from "./core";+import type { TelemetrySignal } from "./ops/telemetry";+import type { BridgeStore } from "./store";++/** The steps in order (`telemetry::CHECKLIST_STEPS`). */+export const CHECKLIST_STEPS = ["add_machine", "create_space", "teleport", "share", "run_agent"] as const;+export type ChecklistStep = (typeof CHECKLIST_STEPS)[number];++/** What happens to the checklist itself. */+export type ChecklistEvent = ChecklistStep | "shown" | "completed" | "dismissed" | "reopened";++export interface ChecklistState {+ /** Steps done, each once. */+ done: Partial<Record<ChecklistStep, true>>;+ /** Closed with ×; the menu's "Getting started" opens it again. */+ dismissed: boolean;+ /** It was on screen once (`checklist_shown` was recorded). */+ shown: boolean;+}++const STORAGE_KEY = "cua-spaces:checklist";+const EMPTY: ChecklistState = { done: {}, dismissed: false, shown: false };+let saved: ChecklistState | undefined;+const listeners = new Set<() => void>();++function storage(): Storage | undefined {+ try {+ return globalThis.localStorage;+ } catch {+ return undefined;+ }+}++function parse(raw: string | null | undefined): ChecklistState {+ const v = raw ? (JSON.parse(raw) as Partial<ChecklistState> | null) : null;+ if (!v || typeof v !== "object") return EMPTY;+ const done: ChecklistState["done"] = {};+ for (const s of CHECKLIST_STEPS) if (v.done?.[s] === true) done[s] = true;+ return { done, dismissed: v.dismissed === true, shown: v.shown === true };+}++export function readChecklist(): ChecklistState {+ if (saved) return saved;+ try {+ saved = parse(storage()?.getItem(STORAGE_KEY));+ } catch {+ saved = EMPTY;+ }+ return saved;+}++function write(next: ChecklistState): void {+ // Another window may have ticked steps since this one read them: keep those.+ try {+ const stored = parse(storage()?.getItem(STORAGE_KEY));+ next = { ...next, done: { ...stored.done, ...next.done } };+ } catch {+ // Unreadable: this window's copy wins.+ }+ saved = next;+ try {+ storage()?.setItem(STORAGE_KEY, JSON.stringify(next));+ } catch {+ // Private mode or a full disk: it still works until the app quits.+ }+ for (const l of [...listeners]) l();+}++function onStorage(e: StorageEvent): void {+ if (e.key !== STORAGE_KEY && e.key !== null) return;+ saved = undefined;+ for (const l of [...listeners]) l();+}++export function subscribeChecklist(listener: () => void): () => void {+ if (listeners.size === 0) globalThis.addEventListener?.("storage", onStorage);+ listeners.add(listener);+ return () => {+ listeners.delete(listener);+ if (listeners.size === 0) globalThis.removeEventListener?.("storage", onStorage);+ };+}++export const checklistComplete = (s: ChecklistState) => CHECKLIST_STEPS.every((step) => s.done[step]);++/** The core's usage events for one checklist event. */+export function telemetryChecklist(core: CoreClient, event: ChecklistEvent): TelemetrySignal[] {+ return core.tryCall<TelemetrySignal[]>("telemetry.checklist", { event }) ?? [];+}++function track(store: BridgeStore | null, events: ChecklistEvent[]): void {+ if (!store) return;+ for (const e of events) void store.telemetry.track(telemetryChecklist(store.core, e));+}++/** Events waiting for the bridge store. */+const pending: ChecklistEvent[] = [];++/* Each change is saved at once and answers with the events it means. */++function markDone(step: ChecklistStep): ChecklistEvent[] {+ const s = readChecklist();+ if (s.done[step]) return [];+ const next = { ...s, done: { ...s.done, [step]: true as const } };+ write(next);+ return checklistComplete(next) ? [step, "completed"] : [step];+}++function markShown(): ChecklistEvent[] {+ const s = readChecklist();+ if (s.shown) return [];+ write({ ...s, shown: true });+ return ["shown"];+}++function markDismissed(dismissed: boolean): ChecklistEvent[] {+ const s = readChecklist();+ if (s.dismissed === dismissed) return [];+ write({ ...s, dismissed });+ return [dismissed ? "dismissed" : "reopened"];+}++/** Ticks off `step` (once): records it, and `completed` with the last one. */+export function checklistDone(store: BridgeStore | null, step: ChecklistStep): void {+ track(store, markDone(step));+}++export interface ChecklistHook {+ state: ChecklistState;+ done(step: ChecklistStep): void;+ shown(): void;+ dismiss(): void;+ reopen(): void;+}++/** The checklist, and its actions with their usage events. */+export function useChecklist(): ChecklistHook {+ const ctx = useContext(BridgeContext);+ if (!ctx) throw new Error("useChecklist needs a <BridgeProvider> above it");+ const state = useSyncExternalStore(subscribeChecklist, readChecklist, readChecklist);+ const { store } = ctx;+ // Events from before the store exists wait for it (the first `ready`+ // promise can be replaced before it resolves).+ useEffect(() => {+ if (store && pending.length) track(store, pending.splice(0));+ }, [store]);+ const later = (events: ChecklistEvent[]) => {+ if (!events.length) return;+ if (store) track(store, events);+ else pending.push(...events);+ };+ return {+ state,+ done: (step) => later(markDone(step)),+ shown: () => later(markShown()),+ dismiss: () => later(markDismissed(true)),+ reopen: () => later(markDismissed(false)),+ };+}++/** Tests: forget the cached copy. */+export function resetChecklistCache(): void {+ saved = undefined;+ pending.length = 0;+}diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.tsindex 70ad39b979..52b37cd705 100644--- a/apps/cua-spaces-web/src/bridge/index.ts+++ b/apps/cua-spaces-web/src/bridge/index.ts@@ -104,3 +104,11 @@ export type { HostFormAction, HostSetupRequest } from "./ops/host-setup";export type { TelemetrySignal } from "./ops/telemetry";export { useStartup, type StartupHook } from "./startup";export { READY_STARTUP, type StartupAction, type StartupPhase, type StartupState } from "./ops/startup";+export {+ CHECKLIST_STEPS,+ checklistComplete,+ useChecklist,+ type ChecklistHook,+ type ChecklistState,+ type ChecklistStep,+} from "./checklist";diff --git a/apps/cua-spaces-web/src/bridge/share.ts b/apps/cua-spaces-web/src/bridge/share.tsindex 828158cacd..cf5104e940 100644--- a/apps/cua-spaces-web/src/bridge/share.ts+++ b/apps/cua-spaces-web/src/bridge/share.ts@@ -12,6 +12,7 @@import { useContext, useSyncExternalStore } from "react";import type { DataAdapter } from "./adapter";import { BridgeContext } from "./BridgeProvider";+import { checklistDone } from "./checklist";import type { CoreClient } from "./core";import type { ShareEntry, ShareInput, ShareSheetAction, ShareSheetState, ShareSheetView } from "./contracts/share";import type { Space } from "./contracts/spaces";@@ -48,6 +49,8 @@ export class ShareStore {/** Where usage events go (`BridgeStore.telemetry`): shared, unshared or* a role changed, view-only or not; never who. */private readonly track: (signals: TelemetrySignal[]) => void = () => {},+ /** A Space was shared with someone (the getting-started checklist). */+ private readonly onShared: () => void = () => {},) {}subscribe = (l: () => void) => {@@ -110,6 +113,7 @@ export class ShareStore {: await this.adapter.call("sharing.unshare", { spaceId: request.space, who: request.who });this.setShares(spaceId, shares);outcome = { type: "done" };+ if (request.kind === "share") this.onShared();} catch (e) {outcome = { type: "failed", error: words(e) };}@@ -134,7 +138,12 @@ const stores = new WeakMap<BridgeStore, ShareStore>();export function shareStore(store: BridgeStore): ShareStore {let s = stores.get(store);if (!s) {- s = new ShareStore(store.adapter, store.core, (signals) => void store.telemetry.track(signals));+ s = new ShareStore(+ store.adapter,+ store.core,+ (signals) => void store.telemetry.track(signals),+ () => checklistDone(store, "share"),+ );stores.set(store, s);}return s;diff --git a/apps/cua-spaces-web/src/bridge/teleport.ts b/apps/cua-spaces-web/src/bridge/teleport.tsindex 9edc51f686..e7faa58c46 100644--- a/apps/cua-spaces-web/src/bridge/teleport.ts+++ b/apps/cua-spaces-web/src/bridge/teleport.ts@@ -17,6 +17,7 @@import { useContext, useSyncExternalStore } from "react";import type { DataAdapter } from "./adapter";import { BridgeContext } from "./BridgeProvider";+import { checklistDone } from "./checklist";import type { CoreClient } from "./core";import type { KeyvaultOverview, VaultAction, VaultSource, VaultState, VaultView } from "./contracts/keyvault";import type {@@ -173,6 +174,8 @@ export class TeleportStore {constructor(readonly adapter: DataAdapter,readonly core: CoreClient,+ /** An app was teleported (the getting-started checklist). */+ private readonly onTeleported: () => void = () => {},) {this.off = adapter.subscribe((e) => this.onEvent(e));}@@ -464,6 +467,7 @@ export class TeleportStore {this.send({ type: "confirm" });try {const report = await this.adapter.call("teleport.run", { spaceId: s.spaceId, plan, consent, runId });+ this.onTeleported();if (this.session?.runId === runId) this.send({ type: "finished", report });} catch (e) {if (this.session?.runId === runId) this.send({ type: "failed", message: words(e) });@@ -578,7 +582,7 @@ const stores = new WeakMap<BridgeStore, TeleportStore>();export function teleportStore(store: BridgeStore): TeleportStore {let t = stores.get(store);if (!t) {- t = new TeleportStore(store.adapter, store.core);+ t = new TeleportStore(store.adapter, store.core, () => checklistDone(store, "teleport"));stores.set(store, t);}return t;diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.tsindex d0456d34b8..96f03e7800 100644--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts@@ -160,6 +160,8 @@ export type HostMethod = WebkitMethod | (typeof ELECTRON_HOST_METHODS)[number];/** The app menu's Settings command (⌘,) while the SwiftUI app's New UI window is in front: go to Settings. */export const WEBKIT_OPEN_SETTINGS_EVENT = "settings.openRequested";+/** The app menu's Help > Getting Started: show the getting-started checklist again. */+export const WEBKIT_OPEN_CHECKLIST_EVENT = "checklist.openRequested";export const WEBKIT_EVENTS = ["spaces.changed",diff --git a/apps/cua-spaces-web/src/components/getting-started.tsx b/apps/cua-spaces-web/src/components/getting-started.tsxnew file mode 100644index 0000000000..e985c1f980--- /dev/null+++ b/apps/cua-spaces-web/src/components/getting-started.tsx@@ -0,0 +1,217 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++/**+ * The getting-started checklist on the Spaces page: five first steps,+ * ticked off as they happen (`bridge/checklist.ts` keeps them), closable,+ * and back from the command palette or Help > Getting Started.+ */++import { useNavigate } from "@tanstack/react-router";+import { CheckIcon, XIcon } from "lucide-react";+import { useEffect } from "react";++import {+ CHECKLIST_STEPS,+ checklistComplete,+ useAgents,+ useBridge,+ useChecklist,+ useExperiments,+ useMachines,+ useSession,+ useShareSheet,+ useSpaces,+ useTeleport,+ type ChecklistStep,+ type Space,+} from "@/bridge";+import { spaceDetail } from "@/bridge/space-detail";+import { WEBKIT_EVENT, WEBKIT_OPEN_CHECKLIST_EVENT, type WebkitEventDetail } from "@/bridge/webkit-protocol";+import { Button } from "@/components/ui/button";+import { toast, toastError } from "@/components/ui/toast";+import { useNewSpace } from "@/hooks/use-new-space";+import { realSpaces, spaceState } from "@/lib/spaces";+import { cn } from "@/lib/utils";++/**+ * Where "Add a machine" goes. One place, so a new add-machine flow (a link+ * or QR code, a team invite) only has to change this.+ */+export const ADD_MACHINE_HREF = "/machines?add=1";++const COPY: Record<ChecklistStep, { title: string; detail: string; action: string }> = {+ add_machine: { title: "Add a machine", detail: "Connect a Mac, Linux or Windows computer you own.", action: "Add machine" },+ create_space: { title: "Create a Space", detail: "A computer for one task, on one of your machines.", action: "Create" },+ teleport: { title: "Teleport an app", detail: "Move a signed-in app into a Space.", action: "Teleport" },+ share: { title: "Share a Space", detail: "Let a teammate watch or work in it.", action: "Share" },+ run_agent: { title: "Run an agent", detail: "Give an agent a Space to work in.", action: "Open Agents" },+};++/** The first Space whose own page offers `action` now (the core's detail+ * actions: Share follows Settings, Experiments; both need it running). */+function spaceFor(spaces: Space[], offers: (space: Space) => boolean | undefined): { space?: Space; offered: boolean } {+ const real = realSpaces(spaces).filter((s) => spaceState(s) === "running" || spaceState(s) === "stopped");+ let offered = false;+ for (const space of real) {+ const on = offers(space);+ if (on === undefined) continue;+ offered = true;+ if (on) return { space, offered };+ }+ return { offered };+}++export function GettingStarted() {+ const { state, shown, dismiss } = useChecklist();+ const navigate = useNavigate();+ const newSpace = useNewSpace();+ const { data: spaces = [], isLoading: spacesLoading } = useSpaces();+ const { data: session } = useSession();+ const teleport = useTeleport();+ const share = useShareSheet();+ const visible = !state.dismissed;+ const complete = checklistComplete(state);+ const count = CHECKLIST_STEPS.filter((s) => state.done[s]).length;++ useEffect(() => {+ if (visible) shown();+ }, [visible, shown]);++ const { core } = useBridge();+ const exp = useExperiments();+ const experiments = exp.unsupported ? undefined : (exp.data?.experiments ?? {});+ const { data: machines = [] } = useMachines();+ const thisMachine = machines.find((m) => m.current);+ const offers = (id: string) => (space: Space) => {+ const a = spaceDetail(core, space, null, thisMachine?.arch ?? null, experiments, thisMachine?.accessNotice ?? null).actions.find((x) => x.id === id);+ return a ? a.enabled : undefined;+ };+ /** Opens `open` on a Space that offers it, or says what is missing. */+ const onSpace = (id: string, open: (space: Space) => Promise<void>, what: string) => {+ if (spacesLoading) return;+ if (realSpaces(spaces).length === 0) return newSpace();+ const { space, offered } = spaceFor(spaces, offers(id));+ if (space) return void open(space).catch(toastError(`Couldn't open ${what}`));+ if (!offered && id === "share") {+ toast("Sharing is off", { description: "Turn it on in Settings, Experiments." });+ return void navigate({ to: "/settings/experiments" });+ }+ toast("Start a Space first", { description: `${what} works on a running Space.` });+ };++ if (!visible) return null;++ const go = (step: ChecklistStep) => {+ switch (step) {+ case "add_machine":+ return void navigate({ href: ADD_MACHINE_HREF });+ case "create_space":+ return newSpace();+ case "teleport":+ return onSpace("teleport", (space) => teleport.open(space), "Teleport");+ case "share":+ return onSpace("share", (space) => share.open(space, session?.signedIn ?? false), "Share");+ case "run_agent":+ return void navigate({ to: "/agents" });+ }+ };++ return (+ <section data-checklist="" aria-labelledby="checklist-title" className="mb-6 rounded-xl border bg-card shadow-xs">+ <header className="flex items-start gap-3 px-4 pt-3.5 pb-2">+ <div className="min-w-0 flex-1">+ <h2 id="checklist-title" className="text-[14px] font-semibold">+ {complete ? "You're set up" : "Get started"}+ </h2>+ <p className="mt-0.5 text-xs text-muted-foreground">+ {complete+ ? "Your team and its agents can now share computers you own."+ : "Shared computers for your team and its agents, on machines you own."}+ </p>+ </div>+ <span className="mt-0.5 text-xs tabular-nums text-muted-foreground" data-checklist-count="">+ {count} of {CHECKLIST_STEPS.length}+ </span>+ <Button variant="ghost" size="icon-sm" aria-label="Close getting started" onClick={() => dismiss()}>+ <XIcon className="size-3.5 text-muted-foreground" />+ </Button>+ </header>+ <ol className="divide-y border-t">+ {CHECKLIST_STEPS.map((step) => {+ const done = state.done[step] === true;+ const copy = COPY[step];+ return (+ <li key={step} data-checklist-step={step} data-done={done || undefined} className="flex items-center gap-3 px-4 py-2.5">+ <span+ aria-hidden+ className={cn(+ "flex size-5 shrink-0 items-center justify-center rounded-full border",+ done ? "border-brand bg-brand text-white" : "border-foreground/20",+ )}+ >+ {done ? <CheckIcon className="size-3" strokeWidth={3} /> : null}+ </span>+ <div className="min-w-0 flex-1">+ <div className={cn("text-[13px] font-medium", done && "text-muted-foreground line-through decoration-foreground/30")}>+ {copy.title}+ <span className="sr-only">{done ? " (done)" : ""}</span>+ </div>+ <div className="truncate text-xs text-muted-foreground">{copy.detail}</div>+ </div>+ {done ? null : (+ <Button variant="outline" size="sm" onClick={() => go(step)}>+ {copy.action}+ </Button>+ )}+ </li>+ );+ })}+ </ol>+ </section>+ );+}++/**+ * Ticks steps off from what the app already shows (another machine, a+ * Space, an agent's run) and answers Help > Getting Started. Teleport and+ * Share tick themselves off where they finish (`bridge/teleport.ts`,+ * `bridge/share.ts`). Mounted once, under the main layout.+ */+export function ChecklistTracker() {+ const { state, done, reopen } = useChecklist();+ const navigate = useNavigate();+ const { data: machines } = useMachines();+ const { data: spaces } = useSpaces();++ const otherMachine = machines?.some((m) => !m.current) ?? false;+ const hasSpace = spaces ? realSpaces(spaces).some((s) => ["running", "stopped"].includes(spaceState(s))) : false;+ useEffect(() => {+ if (otherMachine && !state.done.add_machine) done("add_machine");+ }, [otherMachine, state.done.add_machine, done]);+ useEffect(() => {+ if (hasSpace && !state.done.create_space) done("create_space");+ }, [hasSpace, state.done.create_space, done]);++ useEffect(() => {+ const onHostEvent = (event: Event) => {+ if ((event as CustomEvent<WebkitEventDetail>).detail?.event !== WEBKIT_OPEN_CHECKLIST_EVENT) return;+ reopen();+ void navigate({ to: "/spaces" });+ };+ window.addEventListener(WEBKIT_EVENT, onHostEvent);+ return () => window.removeEventListener(WEBKIT_EVENT, onHostEvent);+ }, [reopen, navigate]);++ // Agents are only read while this step is open.+ return state.done.run_agent ? null : <AgentProgress onRun={() => done("run_agent")} />;+}++function AgentProgress({ onRun }: { onRun: () => void }) {+ const { data } = useAgents();+ const ran = (data?.runs.length ?? 0) > 0 || (data?.agents.length ?? 0) > 0;+ useEffect(() => {+ if (ran) onRun();+ }, [ran, onRun]);+ return null;+}diff --git a/apps/cua-spaces-web/src/components/shell/command-palette.tsx b/apps/cua-spaces-web/src/components/shell/command-palette.tsxindex 1fefa92a11..ad18ca936e 100644--- a/apps/cua-spaces-web/src/components/shell/command-palette.tsx+++ b/apps/cua-spaces-web/src/components/shell/command-palette.tsx@@ -4,6 +4,7 @@import { useNavigate, useRouter } from "@tanstack/react-router";import {CornerDownLeftIcon,+ ListChecksIcon,LockIcon,LogInIcon,LogOutIcon,@@ -18,7 +19,7 @@ import {} from "lucide-react";import { useState, type KeyboardEvent } from "react";-import { useKeyvault, useSession, useSpaces } from "@/bridge";+import { useChecklist, useKeyvault, useSession, useSpaces } from "@/bridge";import { OsIcon } from "@/components/os-icon";import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";import { Kbd, Shortcut } from "@/components/ui/kbd";@@ -58,6 +59,7 @@ function PaletteBody({ onClose }: { onClose: () => void }) {const { data: session, signIn, signOut } = useSession();const { preference, resolved, setPreference } = useTheme();const toggleSidebar = useUiStore((s) => s.toggleSidebar);+ const checklist = useChecklist();const [query, setQuery] = useState("");const [active, setActive] = useState(0);@@ -131,6 +133,17 @@ function PaletteBody({ onClose }: { onClose: () => void }) {run: () => void navigate({ to: n.to }),})),{ id: "nav:onboarding", group: "Go to", label: "Onboarding", keywords: "welcome setup", icon: icon(SparklesIcon), run: () => void navigate({ to: "/onboarding" }) },+ {+ id: "nav:checklist",+ group: "Go to",+ label: "Getting started",+ keywords: "checklist steps tour help first",+ icon: icon(ListChecksIcon),+ run: () => {+ checklist.reopen();+ void navigate({ to: "/spaces" });+ },+ },...realSpaces(spaces).flatMap((s): Command[] => {const state = spaceState(s);const meta = { group: "Spaces", hint: osLabel(s), keywords: `${s.os} ${state}`, icon: <OsIcon os={s.os} className="size-3.5 text-muted-foreground" /> };diff --git a/apps/cua-spaces-web/src/routes/__root.tsx b/apps/cua-spaces-web/src/routes/__root.tsxindex 0f0fdcb501..44d632e7ae 100644--- a/apps/cua-spaces-web/src/routes/__root.tsx+++ b/apps/cua-spaces-web/src/routes/__root.tsx@@ -6,6 +6,7 @@ import { lazy, Suspense, useEffect, useRef } from "react";import { useBridge, useSavedOnboarding, useSession, useStartup } from "@/bridge";+import { ChecklistTracker } from "@/components/getting-started";import { NewSpace } from "@/components/new-space";import { CommandPalette } from "@/components/shell/command-palette";import { Sidebar } from "@/components/shell/sidebar";@@ -68,6 +69,7 @@ function RootLayout() {</main></div><CommandPalette />+ <ChecklistTracker /><NewSpace /><SpaceSheets /></div>diff --git a/apps/cua-spaces-web/src/routes/machines/index.tsx b/apps/cua-spaces-web/src/routes/machines/index.tsxindex da3332466e..da8055ea87 100644--- a/apps/cua-spaces-web/src/routes/machines/index.tsx+++ b/apps/cua-spaces-web/src/routes/machines/index.tsx@@ -3,7 +3,7 @@import { createFileRoute } from "@tanstack/react-router";import { LaptopIcon, PlusIcon, ServerIcon, Trash2Icon } from "lucide-react";-import { useState, type ReactNode } from "react";+import { useEffect, useState, type ReactNode } from "react";import { useBridge, useExperiments, useMachines, useSpaces, type Machine, type Space, type SpaceDetailView } from "@/bridge";import { spaceDetail } from "@/bridge/space-detail";@@ -19,7 +19,11 @@ import { connectionLabel, machineOs, machinesSummary, machineSubtitle, osName, pimport { osLabel, realSpaces, spaceState } from "@/lib/spaces";import { cn, relativeTime } from "@/lib/utils";-export const Route = createFileRoute("/machines/")({ component: MachinesPage });+export const Route = createFileRoute("/machines/")({+ component: MachinesPage,+ // `?add=1` opens "Add a machine" (the getting-started checklist links here).+ validateSearch: (s: Record<string, unknown>): { add?: true } => (s.add === 1 || s.add === "1" || s.add === true ? { add: true } : {}),+});function MachinesPage() {const { data: machines = [], isLoading, error, setupGuide } = useMachines();@@ -28,7 +32,16 @@ function MachinesPage() {const exp = useExperiments();const experiments = exp.unsupported ? undefined : (exp.data?.experiments ?? {});const [selectedId, setSelectedId] = useState<string | null>(null);- const [adding, setAdding] = useState(false);+ const { add } = Route.useSearch();+ const navigate = Route.useNavigate();+ const [adding, setAddingState] = useState(add === true);+ const setAdding = (open: boolean) => {+ setAddingState(open);+ if (!open && add) void navigate({ search: {}, replace: true });+ };+ useEffect(() => {+ if (add) setAddingState(true);+ }, [add]);const selected = selectedMachine(machines, selectedId);// Reachable from here: a machine whose owner stopped sharing it is not.const online = machines.filter(reachable).length;diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsxindex 8461c25ef1..8152d66b5e 100644--- a/apps/cua-spaces-web/src/routes/spaces/index.tsx+++ b/apps/cua-spaces-web/src/routes/spaces/index.tsx@@ -7,6 +7,7 @@ import { useRef, useState } from "react";import { emptyHome, useBridge, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaces, useSpaceThumbnail, type Space } from "@/bridge";import { EmptyHome } from "@/components/empty-home";+import { GettingStarted } from "@/components/getting-started";import { OsIcon } from "@/components/os-icon";import { EmptyState, Page, PageHeader } from "@/components/page";import { SpaceCanvas } from "@/components/space-canvas";@@ -56,6 +57,7 @@ function SpacesPage() {</Button>}/>+ <GettingStarted /><div className="mb-4"><Segmented aria-label="Filter by state" value={filter} options={FILTERS} onValueChange={setFilter} /></div>diff --git a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdxindex 0ea2a81840..71666c3553 100644--- a/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx+++ b/docs/content/docs/cua-sdk/concepts/telemetry-events.mdx@@ -26,7 +26,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`| `cua_keyvault_consent` | `decision` (`requested`, `approved`, `denied`, `expired`) | Consent counts only; nothing about the request. || `cua_spaces_feature_used` | `feature` (a fixed Spaces app feature) | Spaces app feature adoption. || `cua_stream_stats` | `transport`, `codec`, `decode` (`hw` or `sw`), `fps_bucket`, `latency_bucket`, `resolution`, `duration_bucket` | Streaming performance (50% sampled). |-| `cua_onboarding_step` | `step`, `outcome`, `onboarding_eligible` (`yes` or `no` on the Spaces app's `app_launched`: its first run was still to finish at that launch; `unknown` otherwise), `error_kind` (a failed `signed_in`: `timeout`, `cancelled`, `permission_denied`, `transport`, `unauthenticated` or `other`, never the message; `none` otherwise) | Install and onboarding funnel. |+| `cua_onboarding_step` | `step`, `outcome`, `onboarding_eligible` (`yes` or `no` on the Spaces app's `app_launched`: its first run was still due; `unknown` otherwise), `error_kind` (a failed `signed_in`: `timeout`, `cancelled`, `permission_denied`, `transport`, `unauthenticated` or `other`, never the message; `none` otherwise) | Install and onboarding funnel, and the Spaces checklist: `checklist_shown`, `checklist_<step>` (`add_machine`, `create_space`, `teleport`, `share`, `run_agent`), `checklist_completed`, `checklist_dismissed`, `checklist_reopened`. || `cua_agent_run_started` | `harness` (cua-agents id or `other`), `location`, `entry` (`spaces_tool`, `cli`, `sdk`, `persistent`, `routine`), `outcome`, `error_kind` | Agent runs started, and failed starts. || `cua_agent_run_completed` | `harness`, `location`, `entry`, `outcome`, `error_kind`, `duration_bucket` | First agent run, and how reliably runs finish. Once per run. || `cua_bench_run_completed` | `taskset` (cua-bench dataset or `custom`), `score_bucket`, `task_count`, `outcome` | Benchmark use and coarse scores. |@@ -34,7 +34,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`| `cua_daemon_health` | `uptime_bucket`, `sandboxes` | Hourly aggregate health. || `cua_spacesd_health` | `uptime_bucket`, `imports_failed` | In-sandbox health, hourly. || `cua_spacesd_session_deliveries` | `delivery_grant` (`present` or `absent`), `count` | Session deliveries with and without a Keyvault grant. |-| `cua_app_active` | `experiments_on` (the Cua Spaces experiments turned on in Settings, Experiments: `cua_volume`, `your_cloud`, `sharing` joined with `+`, or `none`) | Daily and weekly active installs, and retention: at most one per install per UTC day, on a day Cua is used. Also how many installs use each experiment. |+| `cua_app_active` | `experiments_on` (the Cua Spaces experiments turned on in Settings, Experiments: `cua_volume`, `your_cloud`, `sharing` joined with `+`, or `none`) | Daily and weekly active installs and retention: at most one per install per UTC day. Also how many installs use each experiment. || `cua_onboarding_page` | `page` (`welcome`, `signin`, `agents`, `presentation`, `volume`, `this_machine`, `done`), `action` (`shown`, `completed`, `skipped`, `back`), `choice` (a fixed word such as `signed_in`, `menu_bar_only`, `s3`, `host`, or `none`) | Which first-run page people leave on, and what they pick. || `cua_space_wizard` | `action` (`opened`, `cancelled`, `submitted`) | How often a New Space is started and abandoned. || `cua_space_create_started` | `location`, `guest_os`, `kind`, `gpu` (GPU acceleration turned on) | Which Spaces are started, and how often with GPU acceleration. |@@ -48,7 +48,7 @@ Every event carries: `telemetry_schema_version`, `event_version`, `product`| `cua_presence_session` | `outcome`, `participants` (bucketed), `duration_bucket` | Multiplayer sessions, their size and length. || `cua_app_update` | `action` (`checked`, `found`, `not_found`, `installed`, `failed`), `channel` (`stable` or `beta`), `trigger` (`user` or `background`) | Whether people update. || `cua_device_enroll` | `method` (`sign_in`, `approval`, `rekey`), `outcome` | How devices join your account's relay. |-| `cua_experiment` | `action` (`experiment_on` or `experiment_off`), `experiment` (`cua_volume`, `your_cloud`, `sharing`) | Which Cua Spaces experiments people try, and which they turn off again. |+| `cua_experiment` | `action` (`experiment_on` or `experiment_off`), `experiment` (`cua_volume`, `your_cloud`, `sharing`) | Which experiments people try, and turn off again. |## Teleport caller kindsdiff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rsindex 23643304af..cf76e89be9 100644--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs@@ -271,6 +271,7 @@ pub const METHODS: &[&str] = &["telemetry.storage","telemetry.share","telemetry.enroll",+ "telemetry.checklist","telemetry.experimentsChanged","telemetry.experimentsOn","settings.withStorage",@@ -1018,6 +1019,7 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {&a.get("action")?,)),"telemetry.enroll" => out(telemetry::enroll(&a.get("state")?, &a.get("action")?)),+ "telemetry.checklist" => out(telemetry::checklist(&a.get::<String>("event")?)),"telemetry.experimentsChanged" => out(telemetry::experiments_changed(&a.get::<Option<experiments::Experiments>>("before")?.unwrap_or_default(),diff --git a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rsindex 4ede2d52cb..14c0e58431 100644--- a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs@@ -202,6 +202,32 @@ pub fn feature_used(name: &str) -> Vec<TelemetrySignal> {vec![feature(name)]}+// ---- Getting started -----------------------------------------------------------++/// The getting-started checklist's steps, in the order it lists them.+pub const CHECKLIST_STEPS: &[&str] = &[+ "add_machine",+ "create_space",+ "teleport",+ "share",+ "run_agent",+];++/// What happens to the checklist itself.+const CHECKLIST_EVENTS: &[&str] = &["shown", "completed", "dismissed", "reopened"];++/// One getting-started checklist event as `cua_onboarding_step`+/// `checklist_<event>`: `shown` (first time on screen), one of+/// [`CHECKLIST_STEPS`] (that step done, once per install), `completed`+/// (every step done), `dismissed` or `reopened`. Anything else: nothing.+pub fn checklist(event: &str) -> Vec<TelemetrySignal> {+ if CHECKLIST_STEPS.contains(&event) || CHECKLIST_EVENTS.contains(&event) {+ vec![step(&format!("checklist_{event}"), true)]+ } else {+ vec![]+ }+}+// ---- First run ---------------------------------------------------------------/// A page's telemetry name.@@ -861,6 +887,34 @@ pub fn welcome_left(t: &cua_telemetry::Telemetry, on: bool) -> std::io::Result<(#[cfg(test)]mod tests {use super::*;++ #[test]+ fn checklist_events_are_fixed_steps_in_the_schema() {+ let all: Vec<&str> = CHECKLIST_STEPS+ .iter()+ .chain(CHECKLIST_EVENTS)+ .copied()+ .collect();+ for e in &all {+ assert_eq!(steps_of(&checklist(e)), [format!("checklist_{e}")]);+ #[cfg(feature = "telemetry")]+ assert!(+ cua_telemetry::schema::ONBOARDING_STEPS+ .contains(&format!("checklist_{e}").as_str()),+ "checklist_{e} is not in cua-telemetry's step vocabulary"+ );+ }+ for bad in [+ "",+ "Share",+ "checklist_share",+ "[email protected]",+ "/Users/x",+ "share ",+ ] {+ assert!(checklist(bad).is_empty(), "{bad:?} accepted");+ }+ }use crate::drive_settings::DriveMountInput;use crate::model::{SpaceOs, SpaceProvider};use crate::onboarding::{initial, reduce};diff --git a/libs/cua/crates/cua-telemetry/src/schema.rs b/libs/cua/crates/cua-telemetry/src/schema.rsindex c30e014483..50213c6088 100644--- a/libs/cua/crates/cua-telemetry/src/schema.rs+++ b/libs/cua/crates/cua-telemetry/src/schema.rs@@ -281,6 +281,18 @@ pub const ONBOARDING_STEPS: &[&str] = &["first_stream","first_space_ready","first_agent_run",+ // The Spaces app's getting-started checklist (`cua-spaces-app-core`+ // `telemetry::checklist`): shown, a step done, every step done,+ // dismissed, reopened from the menu.+ "checklist_shown",+ "checklist_add_machine",+ "checklist_create_space",+ "checklist_teleport",+ "checklist_share",+ "checklist_run_agent",+ "checklist_completed",+ "checklist_dismissed",+ "checklist_reopened",];/// Whether an `app_launched` opens the first run (`unknown` elsewhere).pub const ONBOARDING_ELIGIBLE: &[&str] = &["yes", "no", "unknown"];diff --git a/libs/cua/crates/cua-telemetry/tests/privacy.rs b/libs/cua/crates/cua-telemetry/tests/privacy.rsindex 6076a6d681..9d7097c119 100644--- a/libs/cua/crates/cua-telemetry/tests/privacy.rs+++ b/libs/cua/crates/cua-telemetry/tests/privacy.rs@@ -205,6 +205,7 @@ fn all_builders(s: &str) -> Vec<Event> {v.push(events::api_used("sandbox.connect", Outcome::Ok, Some(s), d).unwrap());v.push(events::spaces_feature_used("teleport_drop").unwrap());v.push(events::onboarding_step("signed_in", Outcome::Ok).unwrap());+ v.push(events::onboarding_step("checklist_share", Outcome::Ok).unwrap());v.push(events::app_launched(Some(true)));v.push(events::app_launched(None));v.push(events::sign_in_failed("timeout"));