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): agent-first onboarding and a quieter Home (#5869)
ddupontbe2dad3345b5
diff --git a/apps/cua-spaces-desktop/src/bridge/checklist.ts b/apps/cua-spaces-desktop/src/bridge/checklist.tsindex edffe56b0f..2b01f57c16 100644--- a/apps/cua-spaces-desktop/src/bridge/checklist.ts+++ b/apps/cua-spaces-desktop/src/bridge/checklist.ts@@ -24,6 +24,11 @@ export function checklistAction(model: AppModel, raw: unknown): AppChecklistActiif (step === undefined) throw Failure.badArgs("step: one of the checklist's steps");return new A.Done({ step });}+ case "skip": {+ const step = c.fromStored({ done: [String(a.step)] }).done[0];+ if (step === undefined) throw Failure.badArgs("step: one of the checklist's steps");+ return new A.Skip({ step });+ }case "shown":return new A.Shown();case "dismiss":@@ -32,11 +37,11 @@ export function checklistAction(model: AppModel, raw: unknown): AppChecklistActireturn new A.Reopen();case "merge": {const s = a.state;- if (!s || typeof s !== "object" || Array.isArray(s)) throw Failure.badArgs("state: {done, dismissed, shown}");+ if (!s || typeof s !== "object" || Array.isArray(s)) throw Failure.badArgs("state: {done, dismissed, shown, skipped}");return new A.Merge({ state: c.fromStored(s as Partial<StoredChecklist>) });}default:- throw Failure.badArgs("action: done, shown, dismiss, reopen or merge");+ throw Failure.badArgs("action: done, skip, shown, dismiss, reopen or merge");}}diff --git a/apps/cua-spaces-desktop/src/model/checklist.ts b/apps/cua-spaces-desktop/src/model/checklist.tsindex 953c5f9abf..af97209f6e 100644--- a/apps/cua-spaces-desktop/src/model/checklist.ts+++ b/apps/cua-spaces-desktop/src/model/checklist.ts@@ -19,6 +19,8 @@ export interface StoredChecklist {done: string[];dismissed: boolean;shown: boolean;+ /** Steps skipped ("Skip"); an older file has none. */+ skipped: string[];}/** Each step and its word (`checklist::ChecklistStep::word`), in checklist order. */@@ -49,25 +51,31 @@ export class ChecklistModel {) {this.words = checklistWords(native);const read = (f: string | null) => (f ? this.read(f) : null);- this.state = read(file) ?? read(seed) ?? { done: [], dismissed: false, shown: false };+ this.state = read(file) ?? read(seed) ?? { done: [], dismissed: false, shown: false, skipped: [] };}/** The state with steps as words. */get stored(): StoredChecklist {+ const words = (steps: AppChecklistStep[]) => steps.map((s) => this.words.find(([step]) => step === s)?.[1]).filter((w): w is string => Boolean(w));return {- done: this.state.done.map((s) => this.words.find(([step]) => step === s)?.[1]).filter((w): w is string => Boolean(w)),+ done: words(this.state.done),dismissed: this.state.dismissed,shown: this.state.shown,+ skipped: words(this.state.skipped),};}/** The core's state from steps as words (unknown words are dropped). */fromStored(s: Partial<StoredChecklist>): AppChecklistState {- const done = Array.isArray(s.done) ? s.done : [];+ const steps = (list: unknown) => {+ const words = Array.isArray(list) ? list : [];+ return this.words.filter(([, w]) => words.includes(w)).map(([step]) => step);+ };return {- done: this.words.filter(([, w]) => done.includes(w)).map(([step]) => step),+ done: steps(s.done),dismissed: s.dismissed === true,shown: s.shown === true,+ skipped: steps(s.skipped),};}diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.tsindex e77594b1dc..1a630bedf4 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts@@ -10922,7 +10922,11 @@ export type AppChecklistRow = {/*** Done (ticked, struck through).*/- done: boolean+ done: boolean,+ /**+ * Skipped (struck through, not ticked); never with `done`.+ */+ skipped: boolean}/**@@ -10950,7 +10954,8 @@ const FfiConverterTypeAppChecklistRow = (() => {title: FfiConverterString.read(from),detail: FfiConverterString.read(from),action: FfiConverterString.read(from),- done: FfiConverterBool.read(from)+ done: FfiConverterBool.read(from),+ skipped: FfiConverterBool.read(from)};}write(value: TypeName, into: RustBuffer): void {@@ -10959,13 +10964,15 @@ const FfiConverterTypeAppChecklistRow = (() => {FfiConverterString.write(value.detail, into);FfiConverterString.write(value.action, into);FfiConverterBool.write(value.done, into);+ FfiConverterBool.write(value.skipped, into);}allocationSize(value: TypeName): number {return FfiConverterTypeAppChecklistStep.allocationSize(value.step) +FfiConverterString.allocationSize(value.title) +FfiConverterString.allocationSize(value.detail) +FfiConverterString.allocationSize(value.action) +- FfiConverterBool.allocationSize(value.done);+ FfiConverterBool.allocationSize(value.done) ++ FfiConverterBool.allocationSize(value.skipped);}};@@ -12045,7 +12052,13 @@ export type AppChecklistState = {/*** It was on screen once (`checklist_shown` was recorded).*/- shown: boolean+ shown: boolean,+ /**+ * Steps skipped ("Skip"), each once, in checklist order: they count as+ * done for the progress and for `complete`, and a skipped step done+ * later shows as done.+ */+ skipped: Array<AppChecklistStep>}/**@@ -12071,18 +12084,21 @@ const FfiConverterTypeAppChecklistState = (() => {return {done: FfiConverterSequenceTypeAppChecklistStep.read(from),dismissed: FfiConverterBool.read(from),- shown: FfiConverterBool.read(from)+ shown: FfiConverterBool.read(from),+ skipped: FfiConverterSequenceTypeAppChecklistStep.read(from)};}write(value: TypeName, into: RustBuffer): void {FfiConverterSequenceTypeAppChecklistStep.write(value.done, into);FfiConverterBool.write(value.dismissed, into);FfiConverterBool.write(value.shown, into);+ FfiConverterSequenceTypeAppChecklistStep.write(value.skipped, into);}allocationSize(value: TypeName): number {return FfiConverterSequenceTypeAppChecklistStep.allocationSize(value.done) +FfiConverterBool.allocationSize(value.dismissed) +- FfiConverterBool.allocationSize(value.shown);+ FfiConverterBool.allocationSize(value.shown) ++ FfiConverterSequenceTypeAppChecklistStep.allocationSize(value.skipped);}};@@ -12955,6 +12971,14 @@ export type AppChecklistView = {* The close button's accessibility label.*/closeLabel: string,+ /**+ * "Skip", on each step not done or skipped.+ */+ skipLabel: string,+ /**+ * "Hide", or "Done" once complete: closes the checklist.+ */+ hideLabel: string,/*** The steps in order.*/@@ -12988,6 +13012,8 @@ const FfiConverterTypeAppChecklistView = (() => {detail: FfiConverterString.read(from),progress: FfiConverterString.read(from),closeLabel: FfiConverterString.read(from),+ skipLabel: FfiConverterString.read(from),+ hideLabel: FfiConverterString.read(from),rows: FfiConverterSequenceTypeAppChecklistRow.read(from)};}@@ -12998,6 +13024,8 @@ const FfiConverterTypeAppChecklistView = (() => {FfiConverterString.write(value.detail, into);FfiConverterString.write(value.progress, into);FfiConverterString.write(value.closeLabel, into);+ FfiConverterString.write(value.skipLabel, into);+ FfiConverterString.write(value.hideLabel, into);FfiConverterSequenceTypeAppChecklistRow.write(value.rows, into);}allocationSize(value: TypeName): number {@@ -13007,6 +13035,8 @@ const FfiConverterTypeAppChecklistView = (() => {FfiConverterString.allocationSize(value.detail) +FfiConverterString.allocationSize(value.progress) +FfiConverterString.allocationSize(value.closeLabel) ++ FfiConverterString.allocationSize(value.skipLabel) ++ FfiConverterString.allocationSize(value.hideLabel) +FfiConverterSequenceTypeAppChecklistRow.allocationSize(value.rows);}@@ -50603,6 +50633,7 @@ const FfiConverterTypeAppApproveSheetAction = (() => {export enum AppChecklistAction_Tags {Done = "Done",Shown = "Shown",+ Skip = "Skip",Dismiss = "Dismiss",Reopen = "Reopen",Observe = "Observe",@@ -50671,11 +50702,45 @@ inner: {step: AppChecklistStep }): Done_ {}+ type Skip__interface = {+ tag: AppChecklistAction_Tags.Skip;+ inner:+Readonly<{step: AppChecklistStep}>+ };+ /**+ * "Skip" on a step: not for this person; it counts as done.+ */+ class Skip_ extends UniffiEnum implements Skip__interface {+ /**+ * @private+ * This field is private and should not be used, use `tag` instead.+ */+ readonly [uniffiTypeNameSymbol] = "AppChecklistAction";+ readonly tag = AppChecklistAction_Tags.Skip;+ readonly inner:+Readonly<{step: AppChecklistStep}>;+ constructor(+inner: {step: AppChecklistStep }) {+ super("AppChecklistAction", "Skip");++ this.inner = Object.freeze(inner);+ }+ static new(+inner: {step: AppChecklistStep }): Skip_ {+ return new Skip_(inner);+ }++ static instanceOf(obj: any): obj is Skip_ {+ return obj.tag === AppChecklistAction_Tags.Skip;+ }++ }+type Dismiss__interface = {tag: AppChecklistAction_Tags.Dismiss};/**- * Closed with ×.+ * Closed with × ("Hide", or "Done" once complete).*/class Dismiss_ extends UniffiEnum implements Dismiss__interface {/**@@ -50804,6 +50869,7 @@ inner: {state: AppChecklistState }): Merge_ {instanceOf,Done: Done_,Shown: Shown_,+ Skip: Skip_,Dismiss: Dismiss_,Reopen: Reopen_,Observe: Observe_,@@ -50812,7 +50878,7 @@ inner: {state: AppChecklistState }): Merge_ {})();export type AppChecklistAction = InstanceType<- typeof AppChecklistAction['Done' | 'Shown' | 'Dismiss' | 'Reopen' | 'Observe' | 'Merge']+ typeof AppChecklistAction['Done' | 'Shown' | 'Skip' | 'Dismiss' | 'Reopen' | 'Observe' | 'Merge']>;// FfiConverter for enum AppChecklistAction@@ -50824,10 +50890,11 @@ const FfiConverterTypeAppChecklistAction = (() => {switch (ordinalConverter.read(from)) {case 1: return new AppChecklistAction.Done({step: FfiConverterTypeAppChecklistStep.read(from) });case 2: return new AppChecklistAction.Shown();- case 3: return new AppChecklistAction.Dismiss();- case 4: return new AppChecklistAction.Reopen();- case 5: return new AppChecklistAction.Observe({otherMachine: FfiConverterBool.read(from), hasSpace: FfiConverterBool.read(from), agentRan: FfiConverterBool.read(from) });- case 6: return new AppChecklistAction.Merge({state: FfiConverterTypeAppChecklistState.read(from) });+ case 3: return new AppChecklistAction.Skip({step: FfiConverterTypeAppChecklistStep.read(from) });+ case 4: return new AppChecklistAction.Dismiss();+ case 5: return new AppChecklistAction.Reopen();+ case 6: return new AppChecklistAction.Observe({otherMachine: FfiConverterBool.read(from), hasSpace: FfiConverterBool.read(from), agentRan: FfiConverterBool.read(from) });+ case 7: return new AppChecklistAction.Merge({state: FfiConverterTypeAppChecklistState.read(from) });default: throw new UniffiInternalError.UnexpectedEnumCase();}}@@ -50843,16 +50910,22 @@ const FfiConverterTypeAppChecklistAction = (() => {ordinalConverter.write(2, into);return;}- case AppChecklistAction_Tags.Dismiss: {+ case AppChecklistAction_Tags.Skip: {ordinalConverter.write(3, into);+ const inner = value.inner;+ FfiConverterTypeAppChecklistStep.write(inner.step, into);return;}- case AppChecklistAction_Tags.Reopen: {+ case AppChecklistAction_Tags.Dismiss: {ordinalConverter.write(4, into);return;}- case AppChecklistAction_Tags.Observe: {+ case AppChecklistAction_Tags.Reopen: {ordinalConverter.write(5, into);+ return;+ }+ case AppChecklistAction_Tags.Observe: {+ ordinalConverter.write(6, into);const inner = value.inner;FfiConverterBool.write(inner.otherMachine, into);FfiConverterBool.write(inner.hasSpace, into);@@ -50860,7 +50933,7 @@ const FfiConverterTypeAppChecklistAction = (() => {return;}case AppChecklistAction_Tags.Merge: {- ordinalConverter.write(6, into);+ ordinalConverter.write(7, into);const inner = value.inner;FfiConverterTypeAppChecklistState.write(inner.state, into);return;@@ -50881,15 +50954,21 @@ const FfiConverterTypeAppChecklistAction = (() => {case AppChecklistAction_Tags.Shown: {return ordinalConverter.allocationSize(2);}+ case AppChecklistAction_Tags.Skip: {+ const inner = value.inner;+ let size = ordinalConverter.allocationSize(3);+ size += FfiConverterTypeAppChecklistStep.allocationSize(inner.step);+ return size;+ }case AppChecklistAction_Tags.Dismiss: {- return ordinalConverter.allocationSize(3);+ return ordinalConverter.allocationSize(4);}case AppChecklistAction_Tags.Reopen: {- return ordinalConverter.allocationSize(4);+ return ordinalConverter.allocationSize(5);}case AppChecklistAction_Tags.Observe: {const inner = value.inner;- let size = ordinalConverter.allocationSize(5);+ let size = ordinalConverter.allocationSize(6);size += FfiConverterBool.allocationSize(inner.otherMachine);size += FfiConverterBool.allocationSize(inner.hasSpace);size += FfiConverterBool.allocationSize(inner.agentRan);@@ -50897,7 +50976,7 @@ const FfiConverterTypeAppChecklistAction = (() => {}case AppChecklistAction_Tags.Merge: {const inner = value.inner;- let size = ordinalConverter.allocationSize(6);+ let size = ordinalConverter.allocationSize(7);size += FfiConverterTypeAppChecklistState.allocationSize(inner.state);return size;}diff --git a/apps/cua-spaces-desktop/test/checklist-machines.test.ts b/apps/cua-spaces-desktop/test/checklist-machines.test.tsindex b2bc704d80..c4e9dcf9c9 100644--- a/apps/cua-spaces-desktop/test/checklist-machines.test.ts+++ b/apps/cua-spaces-desktop/test/checklist-machines.test.ts@@ -107,6 +107,19 @@ describe.skipIf(!built)("the checklist and the Machines rows on the app core", (expect(await done()).toContain("run_agent");});+ it("keeps a skipped step between launches", async () => {+ make();+ const state = () => (call("checklist.get") as unknown as Promise<{ state: { done: string[]; skipped: string[] } }>).then((r) => r.state);+ expect((await state()).skipped).toEqual([]);+ await call("checklist.send", { action: { type: "skip", step: "share" } });+ expect((await state()).skipped).toEqual(["share"]);+ expect(JSON.parse(readFileSync(path.join(appDir, "checklist.json"), "utf8")).skipped).toEqual(["share"]);+ await expect(call("checklist.send", { action: { type: "skip", step: "nope" } })).rejects.toMatchObject({ code: "bad_args" });+ // Read back on the next launch.+ make();+ expect((await state()).skipped).toEqual(["share"]);+ });+it("merges what the page kept before without its events again", async () => {make();const before = telemetry.recorded.length;@@ -123,6 +136,7 @@ describe.skipIf(!built)("the checklist and the Machines rows on the app core", (mkdirSync(swift, { recursive: true });writeFileSync(path.join(swift, "checklist.json"), JSON.stringify({ done: ["add_machine", "teleport"], dismissed: false, shown: true }));make(path.join(swift, "checklist.json"));- expect(model.checklist.stored).toEqual({ done: ["add_machine", "teleport"], dismissed: false, shown: true });+ // A file from an older app has no skips.+ expect(model.checklist.stored).toEqual({ done: ["add_machine", "teleport"], dismissed: false, shown: true, skipped: [] });});});diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swiftindex 68734be1d8..d31680ea11 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/ChecklistModel.swift@@ -19,7 +19,7 @@ public final class ChecklistModel {/// `path`: the file it is kept in; nil keeps it in memory (tests).public init(path: String?) {self.path = path- state = path.flatMap(Self.read) ?? AppChecklistState(done: [], dismissed: false, shown: false)+ state = path.flatMap(Self.read) ?? AppChecklistState(done: [], dismissed: false, shown: false, skipped: [])}public var view: AppChecklistView { appChecklistView(state: state) }@@ -44,6 +44,8 @@ public final class ChecklistModel {var done: [String]var dismissed: Boolvar shown: Bool+ /// Steps skipped ("Skip"); a file from an older app has none.+ var skipped: [String]?}static let words: [(AppChecklistStep, String)] = [@@ -54,24 +56,32 @@ public final class ChecklistModel {private static func read(_ path: String) -> AppChecklistState? {guard let data = FileManager.default.contents(atPath: path),let s = try? JSONDecoder().decode(Stored.self, from: data) else { return nil }- return state(done: s.done, dismissed: s.dismissed, shown: s.shown)+ return state(done: s.done, dismissed: s.dismissed, shown: s.shown, skipped: s.skipped ?? [])}/// The core's state from steps as words (unknown words are dropped).- static func state(done: [String], dismissed: Bool, shown: Bool) -> AppChecklistState {- AppChecklistState(done: words.filter { done.contains($0.1) }.map(\.0), dismissed: dismissed, shown: shown)+ static func state(done: [String], dismissed: Bool, shown: Bool, skipped: [String] = []) -> AppChecklistState {+ AppChecklistState(done: steps(done), dismissed: dismissed, shown: shown, skipped: steps(skipped))+ }++ private static func steps(_ list: [String]) -> [AppChecklistStep] {+ words.filter { list.contains($0.1) }.map(\.0)+ }++ private static func names(_ steps: [AppChecklistStep]) -> [String] {+ steps.compactMap { step in words.first { $0.0 == step }?.1 }}/// The state as the file and the web UI keep it (steps as words).var stored: [String: Any] {- ["done": state.done.compactMap { step in Self.words.first { $0.0 == step }?.1 },- "dismissed": state.dismissed, "shown": state.shown]+ ["done": Self.names(state.done), "dismissed": state.dismissed, "shown": state.shown,+ "skipped": Self.names(state.skipped)]}private func save() {guard let path else { return }- let done = state.done.compactMap { step in Self.words.first { $0.0 == step }?.1 }- guard let data = try? JSONEncoder().encode(Stored(done: done, dismissed: state.dismissed, shown: state.shown))+ guard let data = try? JSONEncoder().encode(Stored(done: Self.names(state.done), dismissed: state.dismissed,+ shown: state.shown, skipped: Self.names(state.skipped)))else { return }let url = URL(fileURLWithPath: path)try? FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swiftindex a35a1e9422..1f5f1936ca 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift@@ -987,7 +987,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {// MARK: - The checklist- /// A page's checklist action: a step done, shown, closed, opened again,+ /// A page's checklist action: a step done or skipped, shown, closed, opened again,/// or progress the page kept itself before (merged once). What the app/// shows ticks steps off here, not in the page (`AppModel.followChecklist`).func checklistAction(_ raw: Any?) throws -> AppChecklistAction {@@ -1000,16 +1000,22 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {let step = ChecklistModel.words.first(where: { $0.1 == word })?.0else { throw Failure.badArgs("step: one of the checklist's steps") }return .done(step: step)+ case "skip":+ guard let word = a["step"] as? String,+ let step = ChecklistModel.words.first(where: { $0.1 == word })?.0+ else { throw Failure.badArgs("step: one of the checklist's steps") }+ return .skip(step: step)case "shown": return .showncase "dismiss": return .dismisscase "reopen": return .reopencase "merge":- guard let s = a["state"] as? [String: Any] else { throw Failure.badArgs("state: {done, dismissed, shown}") }+ guard let s = a["state"] as? [String: Any] else { throw Failure.badArgs("state: {done, dismissed, shown, skipped}") }return .merge(state: ChecklistModel.state(done: s["done"] as? [String] ?? [],dismissed: s["dismissed"] as? Bool ?? false,- shown: s["shown"] as? Bool ?? false))+ shown: s["shown"] as? Bool ?? false,+ skipped: s["skipped"] as? [String] ?? []))default:- throw Failure.badArgs("action: done, shown, dismiss, reopen or merge")+ throw Failure.badArgs("action: done, skip, shown, dismiss, reopen or merge")}}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swiftindex 5e40a7d8d1..00f600a40f 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ChecklistPaletteTests.swift@@ -41,6 +41,25 @@ struct ChecklistPaletteTests {#expect(!ChecklistModel(path: path).view.visible)}+ @Test func aSkippedStepIsKeptAndCountsAsDone() throws {+ let path = FileManager.default.temporaryDirectory+ .appendingPathComponent("cua-checklist-\(UUID().uuidString)/checklist.json").path+ let checklist = ChecklistModel(path: path)+ checklist.send(.skip(step: .teleport))+ #expect(checklist.view.progress == "1 of 5")+ #expect(checklist.stored["skipped"] as? [String] == ["teleport"])+ let again = ChecklistModel(path: path)+ #expect(again.state.skipped == [.teleport])+ #expect(again.view.rows.first { $0.step == .teleport }?.skipped == true)+ // A file from an older app has no skips.+ let old = FileManager.default.temporaryDirectory+ .appendingPathComponent("cua-checklist-\(UUID().uuidString).json")+ try Data(#"{"done":["share"],"dismissed":false,"shown":true}"#.utf8).write(to: old)+ let read = ChecklistModel(path: old.path)+ #expect(read.state.done == [.share])+ #expect(read.state.skipped.isEmpty)+ }+@Test func theLastStepCompletesIt() {let telemetry = FixtureTelemetry()let checklist = ChecklistModel(path: nil)diff --git a/apps/cua-spaces-web/src/__tests__/app-harness.tsx b/apps/cua-spaces-web/src/__tests__/app-harness.tsxindex 52c09ac60a..274374e893 100644--- a/apps/cua-spaces-web/src/__tests__/app-harness.tsx+++ b/apps/cua-spaces-web/src/__tests__/app-harness.tsx@@ -12,7 +12,7 @@ import { afterEach, beforeEach } from "vitest";import type { DataAdapter } from "@/bridge/adapter";import type { MachinesView } from "@/bridge/contracts/host";import type { HostEvent } from "@/bridge/protocol";-import { createDemoAdapter } from "@/bridge/adapters/demo";+import { createDemoAdapter, type DemoOptions } from "@/bridge/adapters/demo";import { BridgeProvider, useBridge, useMachines, useSpaces, type SpacesHook } from "@/bridge";import { testCore } from "@/bridge/__tests__/testCore";import { ToastProvider } from "@/components/ui/toast";@@ -50,6 +50,8 @@ export interface TestHost {intercept?: (op: string, args: unknown) => unknown;/** The Machines page as the host's core drew it (`machinesView`). */machinesView?: () => MachinesView | null;+ /** The demo host's own options (signed out, a first run). */+ demo?: DemoOptions;}/** The routers mounted by the running test: a navigation the app started (a@@ -65,7 +67,7 @@ afterEach(async () => {});export async function mountApp(path: string, host: TestHost = { failsCreates: true, listsGhost: true }) {- const demo = createDemoAdapter({ latencyMs: 1, stepMs: 4 });+ const demo = createDemoAdapter({ latencyMs: 1, stepMs: 4, ...host.demo });// The page's listeners, so a test can push what the host would (`emit`).const listeners = new Set<(event: HostEvent) => void>();const adapter: DataAdapter = {diff --git a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx b/apps/cua-spaces-web/src/__tests__/first-run.test.tsxindex c1961c694d..93f69fb250 100644--- a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/first-run.test.tsx@@ -1,11 +1,11 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.-// The 0.10.0 first run on its real route with the wasm core: pick any-// agents (or none), then "Your agent can use this ..." with This computer as the first-// Space; the extra Space never blocks Done and asks the host to notify when-// it is ready; a fix left turns Done into Finish later and Home keeps the-// to-do list.+// The agent-first first run on its real route with the wasm core: Welcome,+// Pick your agent (the agents found here, most preferred first, one Connect+// each and none connected by itself), Connect your other devices (an+// optional sign-in), then Try it in the lead agent. With no agent, a+// one-click first Space that never blocks Done and asks the host to notify.import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it } from "vitest";@@ -35,19 +35,19 @@ type Calls = { op: string; args: unknown }[];async function mount(opts: { host?: (h: HostStatus) => HostStatus; local?: (l: NonNullable<NewSpaceOptions["local"]>) => NewSpaceOptions["local"]; agents?: (rows: AgentSetupRow[]) => AgentSetupRow[] } = {}) {await testCore();const calls: Calls = [];- let configured = false;await mountApp("/onboarding", {failsCreates: false,listsGhost: false,+ // A first run: signed out, and Cua in no agent's settings yet.+ demo: { signedIn: false, onboarded: false },intercept: (op, args) => {calls.push({ op, args });return undefined;},answer: (op, out) => {if (op === "host.status" && opts.host) return opts.host(out as HostStatus);- // The agents as the test sets them up, until Continue adds Cua to them.- if (op === "agents.configure") configured = true;- if ((op === "agents.setup" || op === "agents.signIn") && opts.agents && !configured) return opts.agents(out as AgentSetupRow[]);+ // The agents found here as the test sets them up (Connect still adds Cua to them).+ if ((op === "agents.setup" || op === "agents.signIn" || op === "agents.configure") && opts.agents) return opts.agents(out as AgentSetupRow[]);if (op === "spaces.createOptions" && opts.local) {const o = out as NewSpaceOptions;return { ...o, local: o.local ? opts.local(o.local) : o.local };@@ -97,90 +97,89 @@ describe("first-run detection on window focus", () => {});});+const agents = () => [...document.querySelectorAll<HTMLElement>("[data-first-run-agent]")].map((e) => e.dataset.firstRunAgent);+const click = (sel: string) => fireEvent.click(document.querySelector<HTMLElement>(sel)!);+/** No agent on this computer. */+const noAgents = (rows: AgentSetupRow[]) => rows.map((r) => ({ ...r, installed: false, configured: false }));+describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {- it("connects the ticked agents, then says they can use this computer, with Done on", async () => {- // Nothing set up yet: every installed agent is ticked.- const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, configured: false })) });- await waitFor(() => expect(heading()).toBe("A shared Space for every agent."));- expect(document.querySelector("[data-first-run-intro]")!.textContent).toBe("Pick any, or none.");- const go = await waitFor(() => {- const b = document.querySelector<HTMLButtonElement>("[data-first-run-continue]");- expect(b?.dataset.firstRunContinue).toBeTruthy();- return b!;- });- const ticked = go.dataset.firstRunContinue!.split(",");- expect(ticked.length).toBeGreaterThan(1);- fireEvent.click(go);- await waitFor(() => expect(calls.find((c) => c.op === "agents.configure")).toBeTruthy());- expect((calls.find((c) => c.op === "agents.configure")!.args as { agents: string[] }).agents).toEqual(ticked);- await waitFor(() => expect(heading()).toMatch(/^Your agents can use this (Mac|PC|computer)\.$/), { timeout: 5000 });- expect(primary()!.disabled).toBe(false);+ it("walks Welcome, Pick your agent, Connect your devices and Try it, connecting only what is clicked", async () => {+ const calls = await mount();+ await waitFor(() => expect(heading()).toBe("Your agents get their own computer."));+ click("[data-onboarding-primary]");+ await waitFor(() => expect(heading()).toBe("Pick your agent."));+ // The agents found here, most preferred first; nothing connected by itself.+ await waitFor(() => expect(agents()).toEqual(["hermes", "claude-code", "codex", "cursor", "openclaw"]));+ expect([...document.querySelectorAll<HTMLElement>("[data-first-run-agent]")].every((e) => e.dataset.connected === "false")).toBe(true);+ expect(calls.some((c) => c.op === "agents.configure")).toBe(false);+ // Each row names the file Connect changes.+ expect(document.querySelector('[data-first-run-agent="hermes"]')!.textContent).toMatch(/~\/\.hermes\/config\.yaml/);+ click('[data-first-run-connect="codex"]');+ await waitFor(() => expect(calls.find((c) => c.op === "agents.configure")?.args).toEqual({ agents: ["codex"] }));+ await waitFor(() => expect(document.querySelector<HTMLElement>('[data-first-run-agent="codex"]')!.dataset.connected).toBe("true"));+ expect(readFirstRun().picked).toEqual(["codex"]);+ expect(calls.filter((c) => c.op === "agents.configure")).toHaveLength(1);+ click("[data-onboarding-primary]");+ await waitFor(() => expect(heading()).toBe("Connect your other devices."));+ expect(document.querySelector("[data-first-run-devices]")!.textContent).toMatch(/Your other computers.*Your cloud/);+ expect(document.body.textContent).not.toMatch(/phone/i);+ click("[data-first-run-secondary]");+ await waitFor(() => expect(heading()).toBe("Try it in OpenAI Codex."));+ expect(calls.some((c) => c.op === "session.signIn")).toBe(false);+ const prompt = document.querySelector<HTMLTextAreaElement>("textarea[data-first-run-prompt]")!;+ expect(prompt.readOnly).toBe(true);+ expect(prompt.value).toMatch(/^Make a Linux Space on this (Mac|PC|computer) and run my tests there\.$/);+ expect(document.querySelector("[data-first-run-copy]")).toBeTruthy();+ // A Codex user never sees Claude or its key first.+ expect(document.body.textContent).not.toMatch(/Claude|Anthropic/);+ expect(document.body.textContent).not.toMatch(/\bVM\b|virtual machine|container|daemon|MCP|\$|Pro\b/i);expect(primary()!.textContent).toBe("Done");- expect(document.querySelector('[data-first-run-row="computer"]')!.textContent).toMatch(/is your first Space/);- // Nothing in the app's own words calls a computer a VM or a container.- expect(document.body.textContent).not.toMatch(/\bVM\b|virtual machine|container|daemon|MCP/i);+ expect(primary()!.disabled).toBe(false);+ fireEvent.click(primary()!);+ await waitFor(() => expect(calls.find((c) => c.op === "session.completeOnboarding")).toBeTruthy());});- it("takes none: nothing is configured and step 2 has no agent row or request", async () => {- const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, configured: false })) });- await waitFor(() => expect(document.querySelectorAll('[data-first-run-pick][data-checked="true"]').length).toBeGreaterThan(0));- for (const row of document.querySelectorAll<HTMLElement>('[data-first-run-pick][data-checked="true"]')) {- fireEvent.click(row.querySelector('[data-slot="checkbox"]')!);- }- await waitFor(() => expect(document.querySelector('[data-first-run-pick][data-checked="true"]')).toBeNull());+ it("Codex: its ChatGPT sign-in and OpenAI key follow it, and the sign-in starts on this computer", async () => {+ writeFirstRun({ step: "connect" });+ const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, installed: r.agent === "codex" })) });+ await waitFor(() => expect(agents()).toEqual(["codex"]));expect(document.querySelector("[data-first-run-credentials]")).toBeNull();- fireEvent.click(document.querySelector<HTMLButtonElement>("[data-first-run-continue]")!);- await waitFor(() => expect(heading()).toMatch(/^This (Mac|PC|computer) is ready\.$|^Checking your setup\.$/), { timeout: 5000 });- await waitFor(() => expect(heading()).toMatch(/^This (Mac|PC|computer) is ready\.$/), { timeout: 5000 });- expect(calls.some((c) => c.op === "agents.configure")).toBe(false);- expect(document.querySelector('[data-first-run-row="agent"]')).toBeNull();- expect(document.querySelector("[data-first-run-copy]")).toBeNull();- expect(readFirstRun().picked).toEqual([]);- });-- it("Codex only: adds Cua to Codex, and its ChatGPT sign-in starts on this computer", async () => {- const calls = await mount({ agents: (rows) => rows.map((r) => ({ ...r, configured: false })) });- await waitFor(() => expect(document.querySelector('[data-first-run-pick="codex"][data-checked="true"]')).toBeTruthy());- for (const row of document.querySelectorAll<HTMLElement>('[data-first-run-pick][data-checked="true"]')) {- if (row.dataset.firstRunPick !== "codex") fireEvent.click(row.querySelector('[data-slot="checkbox"]')!);- }- await waitFor(() => expect(document.querySelector<HTMLElement>("[data-first-run-continue]")!.dataset.firstRunContinue).toBe("codex"));- // The sign-in Codex uses, and where it stays.- const signIn = document.querySelector('[data-first-run-credential="sign-in:codex"]')!;+ click('[data-first-run-connect="codex"]');+ const signIn = await waitFor(() => {+ const r = document.querySelector('[data-first-run-credential="sign-in:codex"]');+ expect(r).toBeTruthy();+ return r!;+ });expect(signIn.textContent).toMatch(/ChatGPT sign-in/);expect(signIn.textContent).toMatch(/uses it on this (Mac|PC|computer)/);- expect(document.querySelector("[data-first-run-credentials-note]")!.textContent).toMatch(/^They stay on this (Mac|PC|computer)\. Other computers keep their own\.$/);+ expect(document.querySelector("[data-first-run-credentials-note]")!.textContent).toMatch(/^They stay on this (Mac|PC|computer)\.$/);expect(document.querySelector('[data-first-run-credential="key:anthropic"]')).toBeNull();fireEvent.click(signIn.querySelector('[data-first-run-credential-action="agent-sign-in"]')!);await waitFor(() => expect(calls.find((c) => c.op === "agents.signIn")?.args).toEqual({ agent: "codex" }));- await waitFor(() => expect(signIn.querySelector("[data-first-run-credential-status]")?.textContent).toBe("Signed in"), { timeout: 8000 });- fireEvent.click(document.querySelector<HTMLButtonElement>("[data-first-run-continue]")!);- await waitFor(() => expect((calls.find((c) => c.op === "agents.configure")?.args as { agents: string[] } | undefined)?.agents).toEqual(["codex"]));- await waitFor(() => expect(readFirstRun().step).toBe("setup"));- expect(readFirstRun().picked).toEqual(["codex"]);});- it("says in plain words that usage data is on and linked to the account, and turns it off with one tap", async () => {+ it("Sign in to connect starts the one sign-in; Not now skips it", async () => {+ writeFirstRun({ step: "devices" });const calls = await mount();- await waitFor(() => expect(heading()).toBe("A shared Space for every agent."));- const note = await waitFor(() => {- const n = document.querySelector("[data-first-run-usage]");- expect(n).toBeTruthy();- return n!;- });- expect(note.textContent).toMatch(/linked to your account through a random ID/);- expect(note.textContent).toMatch(/Never your files, what you type or your screen/);- expect(note.textContent).not.toMatch(/SPACES_CP_LINK_USAGE|telemetry|opaque/i);- expect(note.textContent).toMatch(/Share usage data to help improve Cua/);- const sw = note.querySelector<HTMLElement>('[role="switch"]')!;- expect(sw.getAttribute("aria-checked")).toBe("true");- fireEvent.click(sw);- await waitFor(() => expect(calls.some((c) => /telemetry|settings/.test(c.op))).toBe(true));+ await waitFor(() => expect(heading()).toBe("Connect your other devices."));+ expect(document.body.textContent).toMatch(/works without it\./);+ click('[data-first-run-devices-primary="sign-in"]');+ await waitFor(() => expect(calls.some((c) => c.op === "session.signIn")).toBe(true));});- it("makes the extra Space in the background, asks the host to notify, and keeps Done on", async () => {- writeFirstRun({ step: "setup", agent: "claude-code", setupStartedMs: Date.now() });- const calls = await mount({ local: (l) => ({ ...l, backends: ["docker"], macosImage: null, hostArch: "amd64" }) });+ it("with no agent: install one or use the CLI, then a one-click first Space", async () => {+ const calls = await mount({ agents: noAgents, local: (l) => ({ ...l, backends: ["docker"], macosImage: null, hostArch: "amd64" }) });+ await waitFor(() => expect(heading()).toBe("Your agents get their own computer."));+ click("[data-onboarding-primary]");+ await waitFor(() => expect(heading()).toBe("Connect an agent."));+ expect(agents()).toEqual([]);+ const alts = [...document.querySelectorAll<HTMLElement>("[data-first-run-alternative]")].map((e) => e.dataset.firstRunAlternative);+ expect(alts).toEqual(["install", "cli"]);+ expect(document.querySelector('[data-first-run-alternative="cli"]')!.textContent).toMatch(/cua spaces create linux/);+ click("[data-onboarding-primary]");+ await waitFor(() => expect(heading()).toBe("Connect your other devices."));+ click("[data-first-run-secondary]");+ await waitFor(() => expect(heading()).toBe("Try a first Space."));const linux = await waitFor(() => {const b = document.querySelector<HTMLButtonElement>('[data-first-run-extra-choice="linux"]');expect(b && !b.disabled).toBe(true);@@ -188,6 +187,8 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {}, { timeout: 8000 });// An Intel Mac or a PC can't run macOS: it isn't offered.expect(document.querySelector('[data-first-run-extra-choice="macos"]')).toBeNull();+ // Nothing starts before the click.+ expect(calls.some((c) => c.op === "spaces.create")).toBe(false);fireEvent.click(linux);await waitFor(() => expect(calls.find((c) => c.op === "spaces.create")).toBeTruthy());const create = calls.find((c) => c.op === "spaces.create")!.args as { config: { kind: string }; notifyWhenReady?: boolean };@@ -197,26 +198,27 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {await waitFor(() => expect(primary()!.disabled).toBe(false));});- it("names the fix, turns Done into Finish later, and keeps a to-do list on Home", async () => {- writeFirstRun({ step: "setup", agent: "claude-code", setupStartedMs: Date.now() });- const calls = await mount({- host: (h) => ({ ...h, permissions: [{ id: "accessibility", label: "Accessibility", granted: false, settingsUrl: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" }] }),+ it("says in plain words that usage data is on, and turns it off with one tap", async () => {+ writeFirstRun({ step: "connect" });+ const calls = await mount();+ await waitFor(() => expect(heading()).toBe("Pick your agent."));+ const note = await waitFor(() => {+ const n = document.querySelector("[data-first-run-usage]");+ expect(n).toBeTruthy();+ return n!;});- await waitFor(() => expect(heading()).toBe("One step left."), { timeout: 5000 });- await waitFor(() => expect(document.querySelector('[data-first-run-row="computer"]')!.textContent).toMatch(/^Let Cua control this/), { timeout: 5000 });- fireEvent.click(document.querySelector('[data-first-run-action="open-settings"]')!);- await waitFor(() => expect(calls.find((c) => c.op === "host.openSettings")).toBeTruthy());- expect(primary()!.textContent).toBe("Finish later");- fireEvent.click(primary()!);- await waitFor(() => expect(calls.find((c) => c.op === "session.completeOnboarding")).toBeTruthy());- await waitFor(() => expect(document.querySelector("[data-first-run-todos]")).toBeTruthy(), { timeout: 5000 });- // The row says "Checking…" until the host's permissions arrive: wait for the fix to be named.- await waitFor(() => expect(document.querySelector('[data-first-run-todo="computer"]')!.textContent).toMatch(/Let Cua control/), { timeout: 5000 });+ expect(note.textContent).toMatch(/Share usage data to help improve Cua/);+ expect(note.textContent).not.toMatch(/SPACES_CP_LINK_USAGE|telemetry|opaque/i);+ const sw = note.querySelector<HTMLElement>('[role="switch"]')!;+ expect(sw.getAttribute("aria-checked")).toBe("true");+ fireEvent.click(sw);+ await waitFor(() => expect(calls.some((c) => /telemetry|settings/.test(c.op))).toBe(true));});it("offers the host's runtime fix when nothing can be made here", async () => {- writeFirstRun({ step: "setup", agent: "claude-code", setupStartedMs: Date.now() });+ writeFirstRun({ step: "setup", setupStartedMs: Date.now() });await mount({+ agents: noAgents,local: (l) => ({...l,available: false,@@ -226,7 +228,13 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {}),});expect(await screen.findByRole("button", { name: "Install Docker Desktop" }, { timeout: 8000 })).toBeTruthy();- // Done never waits for an extra Space.+ // Done never waits for a first Space.await waitFor(() => expect(primary()!.disabled).toBe(false));});++ it("an older saved run resumes on the matching screen", async () => {+ writeFirstRun({ step: "setup", agent: "claude-code", setupStartedMs: Date.now() });+ await mount();+ await waitFor(() => expect(heading()).toBe("Try it in Claude Code."));+ });});diff --git a/apps/cua-spaces-web/src/__tests__/resources.test.tsx b/apps/cua-spaces-web/src/__tests__/resources.test.tsxindex ada334614f..ba3f47f4be 100644--- a/apps/cua-spaces-web/src/__tests__/resources.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/resources.test.tsx@@ -95,35 +95,27 @@ describe("the resources store", () => {});describe.skipIf(!wasmBuilt)("resources on Home and a Space's page", () => {- it("Home: This Mac's strip, the Mac mini's summary, and each Space's meters; no warning with room", async () => {+ it("Home: no computer strips and no per-Space meters; nothing while there is room", async () => {await mountApp("/spaces", { failsCreates: false, listsGhost: false });- const mac = await waitFor(() => {- const el = document.querySelector<HTMLElement>('[data-computer-resources="this-mac"]');- if (!el) throw new Error("no This Mac strip");- return el;- });- expect(mac.textContent).toContain("Processor");- expect(mac.textContent).toContain("12 cores");- expect(mac.textContent).toContain("Space for files");- expect(mac.textContent).toContain("Your extra Spaces use 6 cores, 12 GB of memory and about 25 GB for files.");- expect(document.querySelector('[data-computer-resources="mac-mini"]')?.textContent).toMatch(/Updated .* ago\. Your extra Spaces there use/);- // The Linux box sent no summary.- expect(document.querySelector('[data-computer-resources="linux-box"]')).toBeNull();- expect(document.querySelector("[data-low-disk]")).toBeNull();- const tile = document.querySelector('[data-space-id="local:agent-sandbox"]')!;- await waitFor(() => expect(tile.querySelector("[data-space-meters]")?.textContent).toBe("StoppedOffAbout 6 GB"));- // Other computers' Spaces have no per-Space numbers.- expect(document.querySelector('[data-space-id="relay:mac-mini/qa-windows"] [data-space-meters]')).toBeNull();+ await waitFor(() => expect(document.querySelector('[data-space-id="local:agent-sandbox"]')).not.toBeNull());+ // Give the resources a moment to arrive: still nothing to say.+ await act(() => new Promise((r) => setTimeout(r, 100)));+ expect(document.querySelector("[data-computer-resources]")).toBeNull();+ expect(document.querySelector("[data-computer-warnings]")).toBeNull();+ expect(document.querySelector("[data-space-meters]")).toBeNull();+ // A computer that is just offline is not a warning.+ expect(document.body.textContent).not.toMatch(/is offline/);});- it("low disk: the warning on This Mac, and See what's using space lists the Spaces biggest first", async () => {+ it("low disk: one quiet line for This Mac, and See what's using space lists the Spaces biggest first", async () => {const { router } = await mountApp("/spaces", { failsCreates: false, listsGhost: false, answer: lowDisk });const warning = await waitFor(() => {- const el = document.querySelector<HTMLElement>('[data-computer-resources="this-mac"] [data-low-disk="low"]');+ const el = document.querySelector<HTMLElement>('[data-computer-warnings] [data-low-disk="low"]');if (!el) throw new Error("no warning");return el;});- expect(warning.textContent).toContain("This Mac is almost out of space. Delete old Spaces or snapshots.");+ expect(warning.textContent).toMatch(/^Disk almost full on This Mac \(41 GB left\)/);+ expect(document.querySelectorAll("[data-computer-warning]")).toHaveLength(1);fireEvent.click(warning.querySelector("[data-see-space-use]")!);await waitFor(() => expect(router.state.location.search).toEqual({ sort: "size" }));await waitFor(() => expect(document.querySelector("[data-sorted-by-size]")).not.toBeNull());diff --git a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.tsindex 29814d12de..5bcb40f151 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/checklist.test.ts@@ -1,9 +1,14 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.+import { act, renderHook } from "@testing-library/react";+import { createElement, type ReactNode } from "react";import { beforeEach, describe, expect, it } from "vitest";-import { CHECKLIST_STEPS, checklistDone, checklistView, readChecklist, resetChecklistCache } from "../checklist";+import { createDemoAdapter } from "../adapters/demo";+import { BridgeProvider } from "../BridgeProvider";++import { CHECKLIST_STEPS, checklistDone, checklistView, readChecklist, resetChecklistCache, useChecklist } from "../checklist";import type { DataAdapter } from "../adapter";import type { HostEvent } from "../protocol";import type { BridgeStore } from "../store";@@ -37,10 +42,10 @@ describe("the getting-started checklist", () => {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 });+ expect(readChecklist()).toEqual({ done: { share: true }, dismissed: false, shown: true, skipped: {} });resetChecklistCache();localStorage.setItem(KEY, "{not json");- expect(readChecklist()).toEqual({ done: {}, dismissed: false, shown: false });+ expect(readChecklist()).toEqual({ done: {}, dismissed: false, shown: false, skipped: {} });});it.skipIf(!wasmBuilt)("records each step once, then completed with the last", async () => {@@ -62,7 +67,7 @@ describe("the getting-started checklist", () => {it.skipIf(!wasmBuilt)("draws the core's rows and progress", async () => {const core = await testCore();- const view = checklistView(core, { done: { teleport: true }, dismissed: false, shown: true })!;+ const view = checklistView(core, { done: { teleport: true }, dismissed: false, shown: true, skipped: {} })!;expect(view).toMatchObject({ visible: true, complete: false, title: "Get started", progress: "1 of 5" });expect(view.rows.map((r) => [r.step, r.action, r.done])).toEqual([["add_machine", "Add computer", false],@@ -71,7 +76,23 @@ describe("the getting-started checklist", () => {["share", "Share", false],["run_agent", "Open Agents", false],]);- expect(checklistView(core, { done: {}, dismissed: true, shown: true })?.visible).toBe(false);+ expect(checklistView(core, { done: {}, dismissed: true, shown: true, skipped: {} })?.visible).toBe(false);+ });++ it.skipIf(!wasmBuilt)("a skipped step counts as done and is kept, without an event of its own", async () => {+ const core = await testCore();+ const adapter = createDemoAdapter({ latencyMs: 0 });+ const { result } = renderHook(() => useChecklist(), { wrapper: ({ children }: { children: ReactNode }) => createElement(BridgeProvider, { adapter, core }, children) });+ act(() => result.current.skip("teleport"));+ expect(readChecklist().skipped).toEqual({ teleport: true });+ expect(JSON.parse(localStorage.getItem(KEY)!).skipped).toEqual({ teleport: true });+ resetChecklistCache();+ expect(readChecklist().skipped).toEqual({ teleport: true });+ const view = checklistView(core, readChecklist())!;+ expect(view.progress).toBe("1 of 5");+ expect(view.rows.find((r) => r.step === "teleport")).toMatchObject({ done: false, skipped: true });+ expect(view.hideLabel).toBe("Hide");+ adapter.dispose?.();});it("without the core: not drawn, and nothing changes", async () => {@@ -132,7 +153,7 @@ describe("the host's copy (the Mac app and Electron)", () => {await settle();await settle();expect(host.sent).toHaveLength(2);- expect(host.sent).toContainEqual({ type: "merge", state: { done: ["add_machine", "teleport"], dismissed: false, shown: true } });+ expect(host.sent).toContainEqual({ type: "merge", state: { done: ["add_machine", "teleport"], dismissed: false, shown: true, skipped: [] } });expect(host.sent).toContainEqual({ type: "done", step: "share" });expect(localStorage.getItem(KEY)).toBeNull();expect(sent).toEqual([]);diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts b/apps/cua-spaces-web/src/bridge/adapters/demo-agents.tsindex edfcc2d483..e41cd9e907 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo-agents.ts@@ -30,7 +30,10 @@ export function demoPersistentAgents(now: number): PersistentAgent[] {];}-export function demoAgentSetup(): AgentSetupRow[] {+/** `fresh`: a first run, so Cua isn't in any agent's settings yet. `only`:+ * just these agents installed (`[]`: none, `?demo=agents-none`; `codex`:+ * `?demo=agents-codex`). */+export function demoAgentSetup(fresh = false, only: string[] | null = null): AgentSetupRow[] {const row = (agent: string, name: string, installed: boolean, configured: boolean, mcpConfig: string | null, skillsDir: string | null): AgentSetupRow => ({agent,name,@@ -45,7 +48,7 @@ export function demoAgentSetup(): AgentSetupRow[] {signIn: agent === "codex" ? "ChatGPT" : null,signedIn: false,});- return [+ const rows = [row("claude-code", "Claude Code", true, true, "~/.claude.json", "~/.claude/skills"),row("codex", "OpenAI Codex", true, true, "~/.codex/config.toml", "~/.agents/skills"),row("hermes", "Hermes", true, false, "~/.hermes/config.yaml", "~/.hermes/skills"),@@ -53,6 +56,11 @@ export function demoAgentSetup(): AgentSetupRow[] {row("cursor", "Cursor", true, true, "~/.cursor/mcp.json", "~/.cursor/skills"),row("gemini-cli", "Gemini CLI", false, false, "~/.gemini/settings.json", "~/.gemini/skills"),];+ return rows.map((r) => {+ const installed = only ? only.includes(r.agent) : r.installed;+ const configured = fresh ? false : installed && r.configured;+ return { ...r, installed, configured, skillsInstalled: configured ? r.skillsTotal : 0, detail: !installed ? "Not installed" : configured ? r.detail : "Not set up" };+ });}/* ---- Event scripts ---------------------------------------------------------- */diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.tsindex 0aaeedb29a..bc557e9259 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts@@ -80,6 +80,8 @@ export interface DemoOptions {/** The relay allowance: `idle` (free, no live session, so prompts can show),* `warn` (80% of the hours), `limit` (used up), `pro` or `teams`. */usage?: "idle" | "warn" | "limit" | "pro" | "teams";+ /** Which agents are on this computer (`?demo=agents-none`, `?demo=agents-codex`); all of them by default. */+ agents?: "none" | "codex";/** This Mac's free disk: `low` (`?demo=low-disk`) or `full` (`?demo=disk-full`). */disk?: "low" | "full";/** The machine the demo runs on: a Mac on Apple silicon unless set (the@@ -124,6 +126,7 @@ export function demoOptionsFromSearch(search: string): DemoOptions {macHost: flags.has("mac-host"),unenrolled: flags.has("unenrolled"),usage: (["idle", "warn", "limit", "pro", "teams"] as const).find((u) => flags.has(`usage-${u}`)),+ agents: (["none", "codex"] as const).find((a) => flags.has(`agents-${a}`)),nudge: (["second-agent", "risky"] as const).find((n) => flags.has(`nudge-${n}`)),disk: flags.has("disk-full") ? "full" : flags.has("low-disk") ? "low" : undefined,failCreates: flags.has("create-fail-runtime") ? "runtime-once" : flags.has("create-fail-disk") ? "disk" : undefined,@@ -178,7 +181,7 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { reagents: demoPersistentAgents(now()),// A named allowance is for showing the prompts, which wait for no agent run.runs: options.usage ? [] : demoRunRecords(now()),- agentSetup: demoAgentSetup(),+ agentSetup: demoAgentSetup(options.onboarded === false, options.agents === "none" ? [] : options.agents === "codex" ? ["codex"] : null),platform: options.platform ?? MAC_DEMO_PLATFORM,paired: [],renamed: {},diff --git a/apps/cua-spaces-web/src/bridge/checklist.ts b/apps/cua-spaces-web/src/bridge/checklist.tsindex bb3d4d9808..701a82cebb 100644--- a/apps/cua-spaces-web/src/bridge/checklist.ts+++ b/apps/cua-spaces-web/src/bridge/checklist.ts@@ -42,11 +42,14 @@ export interface ChecklistState {dismissed: boolean;/** It was on screen once (`checklist_shown` was recorded). */shown: boolean;+ /** Steps skipped ("Skip"): they count as done. */+ skipped: Partial<Record<ChecklistStep, true>>;}/** `checklist::ChecklistAction`. */export type ChecklistAction =| { type: "done"; step: ChecklistStep }+ | { type: "skip"; step: ChecklistStep }| { type: "shown" }| { type: "dismiss" }| { type: "reopen" }@@ -60,6 +63,8 @@ export interface ChecklistRow {/** The button that does it; hidden once done. */action: string;done: boolean;+ /** Skipped (never with `done`). */+ skipped: boolean;}/** `checklist::ChecklistView`. */@@ -71,6 +76,10 @@ export interface ChecklistView {/** "2 of 5". */progress: string;closeLabel: string;+ /** "Skip", on each step not done or skipped. */+ skipLabel: string;+ /** "Hide", or "Done" once complete. */+ hideLabel: string;rows: ChecklistRow[];}@@ -79,22 +88,29 @@ interface CoreChecklistState {done: ChecklistStep[];dismissed: boolean;shown: boolean;+ skipped: ChecklistStep[];}const toCore = (s: ChecklistState): CoreChecklistState => ({done: CHECKLIST_STEPS.filter((step) => s.done[step]),dismissed: s.dismissed,shown: s.shown,+ skipped: CHECKLIST_STEPS.filter((step) => s.skipped[step]),});+function steps(list: readonly string[] | undefined): Partial<Record<ChecklistStep, true>> {+ const out: Partial<Record<ChecklistStep, true>> = {};+ for (const step of list ?? []) if ((CHECKLIST_STEPS as readonly string[]).includes(step)) out[step as ChecklistStep] = true;+ return out;+}+function fromCore(c: CoreChecklistState | HostChecklistState): ChecklistState {- const done: ChecklistState["done"] = {};- for (const step of c.done) if ((CHECKLIST_STEPS as readonly string[]).includes(step)) done[step as ChecklistStep] = true;- return { done, dismissed: c.dismissed === true, shown: c.shown === true };+ // An older host answers without `skipped`.+ return { done: steps(c.done), dismissed: c.dismissed === true, shown: c.shown === true, skipped: steps(c.skipped) };}const STORAGE_KEY = "cua-spaces:checklist";-const EMPTY: ChecklistState = { done: {}, dismissed: false, shown: false };+const EMPTY: ChecklistState = { done: {}, dismissed: false, shown: false, skipped: {} };let saved: ChecklistState | undefined;const listeners = new Set<() => void>();@@ -110,8 +126,12 @@ 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 };+ const skipped: ChecklistState["skipped"] = {};+ for (const s of CHECKLIST_STEPS) {+ if (v.done?.[s] === true) done[s] = true;+ if (v.skipped?.[s] === true) skipped[s] = true;+ }+ return { done, dismissed: v.dismissed === true, shown: v.shown === true, skipped };}export function readChecklist(): ChecklistState {@@ -128,7 +148,7 @@ 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 } };+ next = { ...next, done: { ...stored.done, ...next.done }, skipped: { ...stored.skipped, ...next.skipped } };} catch {// Unreadable: this window's copy wins.}@@ -209,7 +229,7 @@ class HostChecklist {} catch {return;}- if (!kept.dismissed && !kept.shown && Object.keys(kept.done).length === 0) return;+ if (!kept.dismissed && !kept.shown && Object.keys(kept.done).length === 0 && Object.keys(kept.skipped).length === 0) return;try {await this.send({ type: "merge", state: toCore(kept) });storage()?.removeItem(STORAGE_KEY);@@ -241,7 +261,7 @@ function forHost(action: ChecklistAction): HostChecklistAction | null {return action.type === "observe" ? null : action;}-const LOADING: ChecklistState = { done: {}, dismissed: true, shown: true };+const LOADING: ChecklistState = { done: {}, dismissed: true, shown: true, skipped: {} };/** The checklist as drawn, or null without the core. */export function checklistView(core: CoreClient, state: ChecklistState): ChecklistView | null {@@ -255,8 +275,10 @@ function apply(core: CoreClient, action: ChecklistAction): TelemetrySignal[] {state: toCore(readChecklist()),action,});- if (!t || t.signals.length === 0) return [];- write(fromCore(t.state));+ if (!t) return [];+ // A skip changes the state without an event of its own.+ const next = fromCore(t.state);+ if (t.signals.length || JSON.stringify(toCore(next)) !== JSON.stringify(toCore(readChecklist()))) write(next);return t.signals;}@@ -282,6 +304,8 @@ export interface ChecklistHook {view: ChecklistView | null;send(action: ChecklistAction): void;done(step: ChecklistStep): void;+ /** "Skip" on a step: it counts as done. */+ skip(step: ChecklistStep): void;shown(): void;dismiss(): void;reopen(): void;@@ -319,6 +343,7 @@ export function useChecklist(): ChecklistHook {view: loading ? null : checklistView(core, state),send,done: (step) => send({ type: "done", step }),+ skip: (step) => send({ type: "skip", step }),shown: () => send({ type: "shown" }),dismiss: () => send({ type: "dismiss" }),reopen: () => send({ type: "reopen" }),diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.jsonindex 0becf0517f..b1bd1282d9 100644--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json@@ -5251,12 +5251,19 @@},"shown": {"type": "boolean"+ },+ "skipped": {+ "type": "array",+ "items": {+ "type": "string"+ }}},"required": ["done","dismissed",- "shown"+ "shown",+ "skipped"]}},@@ -5281,12 +5288,19 @@},"shown": {"type": "boolean"+ },+ "skipped": {+ "type": "array",+ "items": {+ "type": "string"+ }}},"required": ["done","dismissed",- "shown"+ "shown",+ "skipped"]}},@@ -7006,12 +7020,19 @@},"shown": {"type": "boolean"+ },+ "skipped": {+ "type": "array",+ "items": {+ "type": "string"+ }}},"required": ["done","dismissed",- "shown"+ "shown",+ "skipped"]}},@@ -7036,12 +7057,19 @@},"shown": {"type": "boolean"+ },+ "skipped": {+ "type": "array",+ "items": {+ "type": "string"+ }}},"required": ["done","dismissed",- "shown"+ "shown",+ "skipped"]}},diff --git a/apps/cua-spaces-web/src/bridge/contracts/first-run.ts b/apps/cua-spaces-web/src/bridge/contracts/first-run.tsindex 09f1f41ae6..594c79b55a 100644--- a/apps/cua-spaces-web/src/bridge/contracts/first-run.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/first-run.ts@@ -7,7 +7,8 @@* Rust is the source of truth.*/-export type FirstRunStep = "connect" | "setup";+/** Welcome, Pick your agent (`connect`), Connect your other devices, Try it (`setup`). */+export type FirstRunStep = "welcome" | "connect" | "devices" | "setup";export interface FirstRunAgent {agent: string;@@ -17,6 +18,8 @@ export interface FirstRunAgent {/** The account it signs in with on its own (`ChatGPT` for Codex). */signIn?: string | null;signedIn?: boolean;+ /** The settings file Cua adds itself to. */+ mcpConfig?: string | null;}export interface FirstRunPermission {@@ -66,7 +69,7 @@ export interface FirstRunInput {hostOs: string;agents: FirstRunAgent[] | null;agent: string | null;- /** Step 1: the ticks (null: not changed, so the installed ones). Step 2: the agents connected. */+ /** The agents connected on Pick your agent (an agent the setup reports configured counts either way). */picked: string[] | null;/** The provider keys saved on this computer (null: not read, or this app can't). */keys: { keys: { provider: string; env: string; last4: string; addedMs: number }[]; unavailable?: string | null; error?: string | null } | null;@@ -74,6 +77,8 @@ export interface FirstRunInput {agentSigningIn: string | null;agentSignInError: string | null;connecting: boolean;+ /** The agent being connected. */+ connectingAgent?: string | null;connectError: string | null;agentOpenBeforeSetup: boolean | null;agentUsedAt: string | null;@@ -95,14 +100,25 @@ export interface FirstRunButton {export interface FirstRunAgentPick {agent: string;name: string;- checked: boolean;- installed: boolean;- /** Cua is in its settings already: it stays ticked. */- locked: boolean;+ /** The file Connect changes (`~/.claude.json`). */+ file: string | null;+ /** Cua is in its settings. */+ connected: boolean;+ /** "Connect" (`connect`), none once connected or while it runs. */+ action: FirstRunButton | null;+ /** "Connected", "Adding Cua…". */note: string | null;}-/** A sign-in or a provider key on step 1. */+/** No agent found: install one, or use the CLI. */+export interface FirstRunAlternative {+ id: "install" | "cli";+ title: string;+ note: string;+ url: string | null;+ command: string | null;+}+export interface FirstRunCredential {/** `sign-in:codex`, `key:anthropic`, `key:openai`. */id: string;@@ -118,30 +134,44 @@ export interface FirstRunCredential {error: string | null;}+export interface FirstRunWelcomeView {+ title: string;+ lede: string;+ primary: FirstRunButton;+}+export interface FirstRunConnectView {title: string;- accent: string;lede: string;- intro: string;- agentsLabel: string;+ /** The agents found here, most preferred first. */agents: FirstRunAgentPick[];- moreLabel: string;- more: FirstRunAgentPick[];- agentsNote: string;- credentialsLabel: string;- credentialsNote: string;+ alternatives: FirstRunAlternative[];+ /** The connected agents' sign-ins and keys, in the agents' order. */credentials: FirstRunCredential[];+ credentialsNote: string;primary: FirstRunButton;- /** The agents Continue connects. */- connects: string[];- busy: string | null;+ /** "Skip", until an agent is connected. */+ secondary: FirstRunButton | null;error: string | null;}+export interface FirstRunDevicesView {+ title: string;+ lede: string;+ rows: { title: string; note: string }[];+ /** The sign-in waiting, or this computer being added to the account. */+ status: FirstRunRow | null;+ /** "Sign in to connect" (`sign-in`), or "Continue" once signed in. */+ primary: FirstRunButton;+ /** "Not now" (`not-now`). */+ secondary: FirstRunButton | null;+ note: string | null;+}+export type FirstRunRowState = "checking" | "ok" | "fix";export interface FirstRunRow {- id: "agent" | "computer";+ id: "agent" | "computer" | "account";state: FirstRunRowState;title: string;note: string;@@ -174,30 +204,23 @@ export interface FirstRunExtraView {footnote: string | null;}-export interface FirstRunUpsell {- plan: "pro" | "teams";- title: string;- lines: string[];- price: string;- cta: FirstRunButton;- url: string;- dismiss: string;-}-export interface FirstRunPrimary {- id: "done" | "finish-later";+ id: "done";label: string;enabled: boolean;note: string | null;}export interface FirstRunSetupView {+ /** "Try it in Hermes.", "Try a first Space." */title: string;- rows: FirstRunRow[];- /** None when no agent was picked. */+ lede: string;+ /** None with no connected agent. */prompt: FirstRunPromptView | null;- extra: FirstRunExtraView;- upsell: FirstRunUpsell | null;+ /** "Waiting for Hermes…", then "Hermes used Cua at 18:12." */+ status: FirstRunRow | null;+ /** The one-click first Space, with no connected agent. */+ extra: FirstRunExtraView | null;primary: FirstRunPrimary;}@@ -210,7 +233,9 @@ export interface FirstRunArt {export interface FirstRunView {step: FirstRunStep;later: string;+ welcome: FirstRunWelcomeView | null;connect: FirstRunConnectView | null;+ devices: FirstRunDevicesView | null;setup: FirstRunSetupView | null;art: FirstRunArt;dots: number;diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.tsindex 348430c195..7d99750779 100644--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts@@ -713,7 +713,7 @@ const PresenceCursorShape = ref(/** The host's copy of the checklist (`ops/checklist.ts`). */const ChecklistAnswerShape = object({- state: obj<HostChecklistState>()({ done: strings, dismissed: bool, shown: bool }),+ state: obj<HostChecklistState>()({ done: strings, dismissed: bool, shown: bool, skipped: strings }),});/** A link to something you run (`ops/links.ts`). */diff --git a/apps/cua-spaces-web/src/bridge/first-run.ts b/apps/cua-spaces-web/src/bridge/first-run.tsindex ed4c68b603..4ac9d5936c 100644--- a/apps/cua-spaces-web/src/bridge/first-run.ts+++ b/apps/cua-spaces-web/src/bridge/first-run.ts@@ -2,27 +2,28 @@// Copyright (c) 2026 Cua AI, Inc./**- * The first run every host shows (0.10.0): pick any agents (or none), then- * "Your agent can use this Mac". The words, the rows, when Done is on and the- * to-do list on Home are the app core's (`firstRun.view`, `firstRun.todos`,- * `cua-spaces-app-core/src/first_run.rs`); this module gathers what the- * core reads (the agent setup, `host.status`, the sign-in, the extra- * Space's create) and runs the buttons.+ * The first run every host shows: Welcome, Pick your agent, Connect your+ * other devices (an optional sign-in), then Try it in your agent. The words,+ * the agents' order, which button does what and the to-do list on Home are+ * the app core's (`firstRun.view`, `firstRun.todos`,+ * `cua-spaces-app-core/src/first_run.rs`); this module gathers what the core+ * reads (the agent setup, `host.status`, the sign-in, the first Space's+ * create) and runs the buttons.*- * Step 1's ticks, the agents' own sign-ins (`agents.signIn` starts- * `codex login` on this computer; `agents.setup` reports `signedIn`) and the- * provider keys (`agentKeys.list`) are all per computer, and the page says so.+ * Nothing starts or connects by itself: each agent is connected by its own+ * Connect (`agents.configure` for that one agent), the sign-in only on "Sign+ * in to connect", and the first Space only on a click. The agents' own+ * sign-ins (`agents.signIn` starts `codex login` on this computer) and the+ * provider keys (`agentKeys.list`) stay on this computer, and the page says so.** What is real and what isn't (see `first_run.rs` for the detail):* - "Cua is in the agent's settings": `agents.setup`'s `configured`. Real.- * - "The open session reloaded": no process check exists yet, so the row- * only says to restart the agent if it was open, until the agent uses Cua.* - "The agent used Cua": a connection in this computer's access log- * (`host.status` `recentAccess`) since the setup screen opened. Partly+ * (`host.status` `recentAccess`) since the try screen opened. Partly* real: only some calls are logged, and an agent names itself.- * - This computer: `host.status` and the sign-in. Real.+ * - This computer in the account: `host.status` and the sign-in. Real.*- * The extra Space's create runs in the host (the store's create), so it+ * The first Space's create runs in the host (the store's create), so it* keeps going when the window closes; the host also posts a system* notification when it is ready (`notifyWhenReady`).*/@@ -72,7 +73,7 @@ function withoutFix(extra: FirstRunExtra & { fix?: CreateFix | null }): FirstRun* Try again, as the Space's own page does. */function withExtraFix(view: FirstRunView, fix: CreateFix | null): FirstRunView {const card = view.setup?.extra;- if (!fix || !view.setup || card?.phase !== "failed") return view;+ if (!fix || !view.setup || !card || card.phase !== "failed") return view;return { ...view, setup: { ...view.setup, extra: { ...card, note: `${card.note} ${fix.text}`, action: { id: "fix", label: fix.label } } } };}import { spaceState } from "../lib/spaces";@@ -104,64 +105,92 @@ export function clockTime(ms: number): string {return new Date(ms).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });}-/** Without the core: the two screens in their plainest state. Not the+/** The order the core leads with (`first_run::PREFERENCE`). */+const PREFERENCE = ["hermes", "claude-code", "codex", "cursor", "openclaw"];+const rank = (id: string) => {+ const i = PREFERENCE.indexOf(id);+ return i < 0 ? PREFERENCE.length : i;+};++/** Without the core: the four screens in their plainest state. Not the* product's behaviour; the demo and tests without wasm use it. */function fallbackView(input: FirstRunInput): FirstRunView {- const name = input.agents?.find((a) => a.agent === input.agent)?.name ?? "Claude Code";const place = input.hostOs === "macos" ? "this Mac" : input.hostOs === "windows" ? "this PC" : "this computer";- const art = { agent: input.agent ?? "claude-code", computer: "on" as const, extra: "outline" as const };- if (input.step === "connect") {- const picked = input.picked ?? (input.agents ?? []).filter((a) => a.installed).map((a) => a.agent);- const agents = (input.agents ?? []).map((a) => ({ agent: a.agent, name: a.name, checked: picked.includes(a.agent), installed: a.installed, locked: a.configured, note: null }));- return {- step: "connect",- later: "Skip for now",- connect: {- title: "A shared Space for every agent.",- accent: "agent",- lede: `Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on ${place}.`,- intro: "Pick any, or none.",- agentsLabel: `On ${place}`,- agents,- moreLabel: "More agents",- more: [],- agentsNote: `Cua adds its skills and MCP server to each one you pick, on ${place} only. Your other computers set up their own.`,- credentialsLabel: "Sign-ins and keys",- credentialsNote: `They stay on ${place}. Other computers keep their own.`,- credentials: [],- primary: { id: "continue", label: "Continue" },- connects: picked,- busy: input.connecting ? `Adding Cua to ${name}…` : null,- error: input.connectError,- },- setup: null,- art: { ...art, extra: "none" },- dots: 2,- current: 0,- };- }- const ok = input.signedIn && Boolean(input.host?.configured);- return {- step: "setup",+ const Place = `${place[0]!.toUpperCase()}${place.slice(1)}`;+ const found = (input.agents ?? []).filter((a) => a.installed || a.configured).sort((a, b) => rank(a.agent) - rank(b.agent));+ const connected = found.filter((a) => a.configured || (input.picked ?? []).includes(a.agent));+ const lead = connected[0] ?? null;+ const steps = ["welcome", "connect", "devices", "setup"] as const;+ const base: FirstRunView = {+ step: input.step,later: "Skip for now",+ welcome: null,connect: null,- setup: {- title: ok ? `Your agent can use ${place}.` : "Checking your setup.",- rows: [- { id: "agent", state: "ok", title: `${name} can use Cua`, note: `We added Cua to ${name}'s settings.`, action: null, settingsUrl: null },- ok- ? { id: "computer", state: "ok", title: `${place[0]!.toUpperCase()}${place.slice(1)} is your first Space`, note: "Ready now. Your agent can see the screen, click and type.", action: null, settingsUrl: null }- : { id: "computer", state: "fix", title: "Sign in to Cua", note: `So your agent can find ${place} and your other computers.`, action: { id: "sign-in", label: "Sign in" }, settingsUrl: null },- ],- prompt: { heading: `Try this in ${name}`, text: "List my computers and tell me what's on this Mac", note: `This works now, on ${place}.`, copy: "Copy" },- extra: { phase: "not-now", title: "No extra Space for now", tag: null, note: "Add one from Home whenever you like.", choices: [], action: { id: "add", label: "Add a Space" }, fraction: null, footnote: null },- upsell: null,- primary: ok ? { id: "done", label: "Done", enabled: true, note: null } : { id: "finish-later", label: "Finish later", enabled: true, note: "We'll keep a to-do list on Home." },- },- art,- dots: 2,- current: 1,+ devices: null,+ setup: null,+ art: { agent: lead?.agent ?? found[0]?.agent ?? "other", computer: "on", extra: input.step === "welcome" ? "none" : "outline" },+ dots: 4,+ current: steps.indexOf(input.step),};+ switch (input.step) {+ case "welcome":+ return { ...base, welcome: { title: "Your agents get their own computer.", lede: `Spaces on ${place}, away from your files and your mouse.`, primary: { id: "start", label: "Get started" } } };+ case "connect":+ return {+ ...base,+ connect: {+ title: "Pick your agent.",+ lede: `Found on ${place}. You can add more later.`,+ agents: found.map((a) => {+ const on = connected.includes(a);+ return { agent: a.agent, name: a.name, file: a.mcpConfig ?? null, connected: on, action: on ? null : { id: "connect", label: "Connect" }, note: on ? "Connected" : null };+ }),+ alternatives: [],+ credentials: [],+ credentialsNote: `They stay on ${place}.`,+ primary: { id: "continue", label: "Continue" },+ secondary: connected.length ? null : { id: "skip", label: "Skip" },+ error: input.connectError,+ },+ };+ case "devices":+ return {+ ...base,+ devices: {+ title: input.signedIn ? `${Place} is in your account.` : "Connect your other devices.",+ lede: `Sign in once, and your other computers reach ${place}'s Spaces.`,+ rows: [+ { title: "Your other computers", note: `They join ${place}'s pool` },+ { title: "Your cloud", note: "Hetzner, AWS, Google Cloud or Modal" },+ ],+ status: null,+ primary: input.signedIn ? { id: "continue", label: "Continue" } : { id: "sign-in", label: "Sign in to connect" },+ secondary: input.signedIn ? null : { id: "not-now", label: "Not now" },+ note: input.signedIn ? null : `${Place} works without it.`,+ },+ };+ case "setup":+ return {+ ...base,+ setup: lead+ ? {+ title: `Try it in ${lead.name}.`,+ lede: `Paste this. ${lead.name} makes the Space itself.`,+ prompt: { heading: `Paste this in ${lead.name}`, text: `Make a Linux Space on ${place} and run my tests there.`, note: `It runs on ${place}.`, copy: "Copy" },+ status: { id: "agent", state: input.agentUsedAt ? "ok" : "checking", title: input.agentUsedAt ? `${lead.name} used Cua at ${input.agentUsedAt}.` : `Waiting for ${lead.name}…`, note: "", action: null, settingsUrl: null },+ extra: null,+ primary: { id: "done", label: "Done", enabled: true, note: null },+ }+ : {+ title: "Try a first Space.",+ lede: `Spaces run on ${place}, away from your files and your mouse.`,+ prompt: null,+ status: null,+ extra: { phase: "not-now", title: "No Space for now", tag: null, note: "Add one from Home whenever you like.", choices: [], action: { id: "add", label: "Add a Space" }, fraction: null, footnote: null },+ primary: { id: "done", label: "Done", enabled: true, note: null },+ },+ };+ }}/* ---- What the page keeps between launches ----------------------------------------- */@@ -170,20 +199,20 @@ function fallbackView(input: FirstRunInput): FirstRunView {* to-do list after Finish later). */export interface FirstRunSaved {step: FirstRunStep;- /** The agent the first request names: the first one connected (setup id). */+ /** An older saved run's one connected agent (setup id). */agent: string | null;- /** Step 1: the ticks (null: not changed). Step 2: the agents connected. */+ /** The agents connected on Pick your agent. */picked: string[] | null;- /** When the setup screen first showed (the access log counts from here). */+ /** When the try screen first showed (the access log counts from here). */setupStartedMs: number | null;/** When the agent was first seen using Cua. */usedAtMs: number | null;- /** The extra Space's create (its pending row id). */+ /** The first Space's create (its pending row id). */extraPendingId: string | null;extraOs: string | null;- /** "Not now" on the extra Space card. */+ /** "Not now" on the first Space card. */extraNotNow: boolean;- /** Finish later: Home shows the to-do list until it is done or closed. */+ /** Skip for now: the sidebar offers the first run again. */finishedLater: boolean;/** The to-do list was closed. */todosClosed: boolean;@@ -191,7 +220,7 @@ export interface FirstRunSaved {const KEY = "cua-spaces:first-run";const EMPTY: FirstRunSaved = {- step: "connect",+ step: "welcome",agent: null,picked: null,setupStartedMs: null,@@ -202,7 +231,7 @@ const EMPTY: FirstRunSaved = {finishedLater: false,todosClosed: false,};-/** "Not now" on the plan card: never again. */+/** "Not now" on the plan card: never again (no plan shows in the first run now). */export const UPSELL_DISMISSED_KEY = "cua.upsell.dismissed.onboarding";/** The user entered teammates' emails (a share with other people). */export const TEAMMATES_KEY = "cua.firstRun.teammates";@@ -287,11 +316,11 @@ function track(send: () => void): void {/* ---- The hook ---------------------------------------------------------------------- */-/** How often the setup screen reads the agent setup and this computer. */+/** How often the first run reads the agent setup and this computer. */export const FIRST_RUN_POLL_MS = 2_500;-/** The usage-data note and switch on the first page: the words are the app core's- * (the old Welcome's), on by default, off with one tap. */+/** The usage-data note and switch on Pick your agent: the words are the app+ * core's (the old Welcome's), on by default, off with one tap. */export interface FirstRunUsage {notice: string;linkLabel: string;@@ -302,9 +331,11 @@ export interface FirstRunUsage {help: string | null;}+const STEPS: FirstRunStep[] = ["welcome", "connect", "devices", "setup"];+export interface FirstRunHook {view: FirstRunView;- /** The usage-data note and switch (first page only; none until the host says what the setting is). */+ /** The usage-data note and switch (Pick your agent only; none until the host says what the setting is). */usage: FirstRunUsage | null;setUsage(on: boolean): Promise<void>;/** "What is collected". */@@ -313,26 +344,26 @@ export interface FirstRunHook {saved: FirstRunSaved;/** Every agent the setup knows. */agents: AgentSetupRow[];- /** Step 1: tick or untick an agent. */- toggle(agent: string, on: boolean): void;- /** Step 1's Continue: adds Cua to the ticked agents not set up yet (none: nothing to add), then step 2. */- connect(): Promise<void>;+ /** Pick your agent: adds Cua to this one agent's settings on this computer. */+ connect(agent: string): Promise<void>;/** Starts an agent's own sign-in on this computer (`codex login`). */signIn(agent: string): Promise<void>;- /** A row's or a to-do's button (`sign-in`, `set-up`, `open-settings`, `restart-check`, `connect`). */+ /** A screen's button: `start`, `continue`, `skip`, `not-now` (next screen), `sign-in`, `set-up`, `open-settings`, `copy`, `add`. */act(id: string, settingsUrl?: string | null): Promise<void>;copyPrompt(): Promise<void>;- /** The extra Space card: `macos`/`linux` start it; `cancel`, `not-now`, `add`, `retry`. */+ /** Opens a page in the browser (installing an agent). */+ openUrl(url: string): Promise<void>;+ /** The first Space card: `macos`/`linux` start it; `cancel`, `not-now`, `add`, `retry`, `fix`. */extra(id: string): Promise<void>;- upsell(action: "shown" | "click" | "dismiss"): void;- /** Done or Finish later. */+ /** Done. */finish(): Promise<void>;- /** "Set up later": leave for now (the sidebar offers it again). */+ /** "Skip for now": leave for now (the sidebar offers it again). */later(): void;+ /** The screen before. */back(): void;}-/** Live readings while `active` (the first run, or Home's to-do list). */+/** Live readings while `active` (the first run, or what reads its state). */export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunHook {const ctx = useContext(BridgeContext);if (!ctx) throw new Error("bridge hooks need a <BridgeProvider> above them");@@ -346,7 +377,7 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunconst flags = useSyncExternalStore(subscribe, () => `${flag(UPSELL_DISMISSED_KEY)}:${flag(TEAMMATES_KEY)}`, () => "false:false");const [agents, setAgents] = useState<AgentSetupRow[] | null>(null);const [host, setHost] = useState<HostStatus | null>(null);- const [connecting, setConnecting] = useState(false);+ const [connecting, setConnecting] = useState<string | null>(null);const [connectError, setConnectError] = useState<string | null>(null);const [settingUp, setSettingUp] = useState(false);const [setupError, setSetupError] = useState<string | null>(null);@@ -359,11 +390,11 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunconst keysInput = agentKeys.unsupported || agentKeys.isLoading ? null : agentKeys.input;const [tick, setTick] = useState(0);const shownRef = useRef(false);- const agentsRef = useRef(agents);- agentsRef.current = agents;const signedIn = Boolean(session.data?.signedIn);const signingIn = session.data?.signIn.kind === "starting" || session.data?.signIn.kind === "waiting";+ // An older saved run may say any step; an unknown one starts over.+ const step: FirstRunStep = STEPS.includes(s.step) ? s.step : "welcome";// The agent setup and this computer, now and every few seconds.useEffect(() => {@@ -371,25 +402,22 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunlet live = true;let n = 0;const read = (forceAgents = false) => {- // The agent setup runs a command on the host: once connected, it's read now and then- // (every time while an agent's own sign-in waits for the browser).- const saved = readFirstRun();- const want = saved.picked ?? (saved.agent ? [saved.agent] : []);- const connected = saved.step === "setup" && Boolean(agentsRef.current) && want.every((id) => agentsRef.current!.some((a) => a.agent === id && a.configured));- if (forceAgents || signingRef.current || !connected || n++ % 6 === 0) {+ // The agent setup runs a command on the host: read every time on Pick+ // your agent (and while an agent's own sign-in waits), now and then after.+ if (forceAgents || signingRef.current || step === "connect" || n++ % 6 === 0) {void adapter.call("agents.setup", {}).then((rows) => live && setAgents(rows)).catch(() => live && setAgents((a) => a ?? []));}- if (s.step === "setup" || s.finishedLater) {+ if (step === "devices" || step === "setup" || s.finishedLater) {void adapter.call("host.status", {}).then((h) => live && setHost(h)).catch(() => {});}};- read();+ read(true);const focus = () => read(true);window.addEventListener("focus", focus);const timer = setInterval(() => read(), pollMs);@@ -398,31 +426,11 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunclearInterval(timer);window.removeEventListener("focus", focus);};- }, [active, adapter, s.step, s.finishedLater, tick, pollMs]);+ }, [active, adapter, step, s.finishedLater, tick, pollMs]);const rows: FirstRunAgent[] | null = agents- ? agents.map((a) => ({ agent: a.agent, name: a.name, installed: a.installed, configured: a.configured, signIn: a.signIn ?? null, signedIn: Boolean(a.signedIn) }))+ ? agents.map((a) => ({ agent: a.agent, name: a.name, installed: a.installed, configured: a.configured, signIn: a.signIn ?? null, signedIn: Boolean(a.signedIn), mcpConfig: a.mcpConfig ?? null })): null;- const lead = core.tryCall<string>("firstRun.leadAgent", { agents: rows ?? [] }) ?? rows?.find((a) => a.installed)?.agent ?? "claude-code";- // Step 2: the agents connected (an older saved run connected one, `agent`).- const connectedIds = s.step === "setup" ? (s.picked ?? (s.agent ? [s.agent] : [lead])) : [];- const agentId = s.step === "setup" ? (connectedIds[0] ?? null) : (s.agent ?? lead);- const agentNames = connectedIds.map((id) => rows?.find((a) => a.agent === id)?.name).filter((n): n is string => Boolean(n));-- // The first time a connected agent uses Cua since the setup screen opened.- const usedMs =- s.usedAtMs ??- (s.setupStartedMs && agentNames.length- ? agentNames.map((n) => agentUsedMs(core, host, s.setupStartedMs!, n)).reduce<number | null>((a, b) => (b !== null && (a === null || b > a) ? b : a), null)- : null);-- // An agent's own sign-in finished (its file is there): stop waiting.- useEffect(() => {- if (signingAgent && agents?.some((a) => a.agent === signingAgent && a.signedIn)) setSigningAgent(null);- }, [signingAgent, agents]);- useEffect(() => {- if (usedMs && !s.usedAtMs) writeFirstRun({ usedAtMs: usedMs });- }, [usedMs, s.usedAtMs]);// The extra Space, as the Spaces list shows its create.const extra = useMemo<FirstRunExtra & { fix?: CreateFix | null }>(() => {@@ -463,20 +471,21 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun}: null;- const input: FirstRunInput = {- step: s.step,+ const baseInput: FirstRunInput = {+ step,hostOs: hostOs(),agents: rows,- agent: agentId,+ agent: s.agent,picked: s.picked,keys: keysInput,agentSigningIn: signingAgent,agentSignInError: signInError,- connecting,+ connecting: connecting !== null,+ connectingAgent: connecting,connectError,// No process check yet (see the module comment).agentOpenBeforeSetup: null,- agentUsedAt: usedMs ? clockTime(usedMs) : null,+ agentUsedAt: null,signedIn,signingIn,host: host@@ -490,16 +499,34 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun: null,hostSettingUp: settingUp,offers,- extra,+ extra: withoutFix(extra),plan,};- const view = withExtraFix(firstRunView(core, { ...input, extra: withoutFix(extra) }), extra.fix ?? null);++ // The lead connected agent (the core's order), for the try screen's access log.+ const leadName = (() => {+ const v = firstRunView(core, { ...baseInput, step: "setup" });+ const t = v.setup?.prompt ? v.setup.title.replace(/^Try it in /, "").replace(/\.$/, "") : null;+ return t;+ })();+ // The first time the lead agent uses Cua since the try screen opened.+ const usedMs = s.usedAtMs ?? (s.setupStartedMs && leadName ? agentUsedMs(core, host, s.setupStartedMs, leadName) : null);+ useEffect(() => {+ if (usedMs && !s.usedAtMs) writeFirstRun({ usedAtMs: usedMs });+ }, [usedMs, s.usedAtMs]);+ // An agent's own sign-in finished (its file is there): stop waiting.+ useEffect(() => {+ if (signingAgent && agents?.some((a) => a.agent === signingAgent && a.signedIn)) setSigningAgent(null);+ }, [signingAgent, agents]);++ const input: FirstRunInput = { ...baseInput, agentUsedAt: usedMs ? clockTime(usedMs) : null };+ const view = withExtraFix(firstRunView(core, input), extra.fix ?? null);const welcome = settings.data?.telemetry? onboardingView(core, { ...onboardingInitial(core, null), step: "welcome", telemetry: onboardingTelemetry(settings.data.telemetry) }): null;const usageNote: FirstRunUsage | null =- s.step === "connect" && welcome?.usage && welcome.notice && welcome.noticeLinkLabel && welcome.noticeLinkUrl+ step === "connect" && welcome?.usage && welcome.notice && welcome.noticeLinkLabel && welcome.noticeLinkUrl? {notice: welcome.notice,linkLabel: welcome.noticeLinkLabel,@@ -519,16 +546,21 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRuntrack(() => store.trackOnboarding({ ...onboardingInitial(core, null), telemetry: onboardingTelemetry(t) }, { type: "start" }));}, [active, store, settings.data?.telemetry]);- // The funnel's events, in the old flow's shape: started on step 1, left on step 2.+ // The funnel's events, in the old flow's shape: started on the first two screens, left on the last two.const telemetryState = (): OnboardingFlowState => ({...onboardingInitial(core, session.data?.identity ?? null),- step: s.step === "connect" ? "welcome" : "agents",+ step: step === "welcome" || step === "connect" ? "welcome" : "agents",runCounted: true,telemetry: settings.data?.telemetry ? onboardingTelemetry(settings.data.telemetry) : null,});const refresh = () => setTick((n) => n + 1);+ const go = (next: FirstRunStep) => {+ writeFirstRun(next === "setup" ? { step: next, setupStartedMs: readFirstRun().setupStartedMs ?? Date.now() } : { step: next });+ };+ const forward = () => go(STEPS[Math.min(STEPS.indexOf(step) + 1, STEPS.length - 1)]!);+const setUpThisComputer = async () => {if (!store || settingUp) return;setSettingUp(true);@@ -542,40 +574,27 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun}};- // Signed in on a computer that isn't set up yet: set it up, once.+ // Signed in on a computer that isn't in the account yet: add it, once.const autoSetUp = useRef(false);useEffect(() => {- if (!active || s.step !== "setup" || !signedIn || !host || host.configured || autoSetUp.current) return;+ if (!active || (step !== "devices" && step !== "setup") || !signedIn || !host || host.configured || autoSetUp.current) return;autoSetUp.current = true;void setUpThisComputer();// eslint-disable-next-line react-hooks/exhaustive-deps- }, [active, s.step, signedIn, host?.configured]);-- // Step 1's ticks as the core decided them (the installed ones until the user changes one).- const ticked = (): string[] => {- const c = view.connect;- return c ? [...c.agents, ...c.more].filter((p) => p.checked).map((p) => p.agent) : (s.picked ?? []);- };-- const toggle = (agent: string, on: boolean) => {- const now = ticked().filter((id) => id !== agent);- writeFirstRun({ picked: on ? [...now, agent] : now });- };+ }, [active, step, signedIn, host?.configured]);- const connect = async () => {+ const connect = async (agent: string) => {if (!adapter || connecting) return;- // Step 1: the ticked ones; step 2's Connect: the connected ones still without Cua.- const picked = s.step === "connect" ? ticked() : connectedIds;- const ids = s.step === "connect" ? (view.connect?.connects ?? picked) : picked.filter((id) => !agents?.some((a) => a.agent === id && a.configured));- setConnecting(true);+ setConnecting(agent);setConnectError(null);try {- if (ids.length) setAgents(await adapter.call("agents.configure", { agents: ids }));- writeFirstRun({ step: "setup", picked, agent: picked[0] ?? null, setupStartedMs: readFirstRun().setupStartedMs ?? Date.now() });+ setAgents(await adapter.call("agents.configure", { agents: [agent] }));+ const was = readFirstRun().picked ?? [];+ writeFirstRun({ picked: was.includes(agent) ? was : [...was, agent] });} catch (e) {setConnectError(e instanceof Error ? e.message : String(e));} finally {- setConnecting(false);+ setConnecting(null);}};@@ -597,33 +616,33 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun};const extraAct = async (id: string) => {- if (id === "macos" || id === "linux") {- const offer = offersHook.offers.find((o) => o.os === id);- if (!offer || offer.blocked) return;- const pendingId = newPendingId();- writeFirstRun({ extraPendingId: pendingId, extraOs: id, extraNotNow: false });- spaces.createSpace({ ...offer.args, name: extraName(id, spaces.data ?? []), os: offer.os, notifyWhenReady: true }, pendingId).catch(() => {- // The row shows the failure; the card reads it from there.- });- } else if (id === "cancel" && s.extraPendingId) {- await spaces.cancelCreate(s.extraPendingId).catch(() => {});- writeFirstRun({ extraPendingId: null, extraOs: null });- } else if (id === "not-now") {- writeFirstRun({ extraNotNow: true });- } else if (id === "add") {- writeFirstRun({ extraNotNow: false, extraPendingId: null, extraOs: null });- } else if (id === "retry" && s.extraPendingId) {- const next = spaces.retryCreate(s.extraPendingId);- writeFirstRun({ extraPendingId: next ?? null });- } else if (id === "fix" && extra.fix) {- // It failed the same way twice: that cause's fix (the core's).- await runCreateFix(extra.fix, {- copy: (text) => navigator.clipboard?.writeText(text),- openExternal: (url) => session.openExternal(url),- // No review sheet here: the help page says what each reason means.- details: () => void session.openExternal(TROUBLESHOOT_URL).catch(() => {}),- }).catch(() => {});- }+ if (id === "macos" || id === "linux") {+ const offer = offersHook.offers.find((o) => o.os === id);+ if (!offer || offer.blocked) return;+ const pendingId = newPendingId();+ writeFirstRun({ extraPendingId: pendingId, extraOs: id, extraNotNow: false });+ spaces.createSpace({ ...offer.args, name: extraName(id, spaces.data ?? []), os: offer.os, notifyWhenReady: true }, pendingId).catch(() => {+ // The row shows the failure; the card reads it from there.+ });+ } else if (id === "cancel" && s.extraPendingId) {+ await spaces.cancelCreate(s.extraPendingId).catch(() => {});+ writeFirstRun({ extraPendingId: null, extraOs: null });+ } else if (id === "not-now") {+ writeFirstRun({ extraNotNow: true });+ } else if (id === "add") {+ writeFirstRun({ extraNotNow: false, extraPendingId: null, extraOs: null });+ } else if (id === "retry" && s.extraPendingId) {+ const next = spaces.retryCreate(s.extraPendingId);+ writeFirstRun({ extraPendingId: next ?? null });+ } else if (id === "fix" && extra.fix) {+ // It failed the same way twice: that cause's fix (the core's).+ await runCreateFix(extra.fix, {+ copy: (text) => navigator.clipboard?.writeText(text),+ openExternal: (url) => session.openExternal(url),+ // No review sheet here: the help page says what each reason means.+ details: () => void session.openExternal(TROUBLESHOOT_URL).catch(() => {}),+ }).catch(() => {});+ }};return {@@ -636,13 +655,19 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRuninput,saved: s,agents: agents ?? [],- toggle,connect,signIn,copyPrompt,+ openUrl: (url) => session.openExternal(url).catch(() => {}),extra: extraAct,async act(id, settingsUrl) {switch (id) {+ case "start":+ case "continue":+ case "skip":+ case "not-now":+ forward();+ break;case "sign-in":await session.signIn().catch(() => {});break;@@ -658,9 +683,6 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun).catch(() => {});}break;- case "connect":- await connect();- break;case "copy":await copyPrompt();break;@@ -670,23 +692,10 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun}refresh();},- upsell(action) {- const card = view.setup?.upsell;- if (!card) return;- try {- const signals = core.tryCall<unknown[]>("telemetry.upsell", { surface: "onboarding", action });- if (signals?.length && store) void store.telemetry.track(signals);- } catch {- // An older core without the surface: no event.- }- if (action === "click") void session.openExternal(card.url).catch(() => {});- else if (action === "dismiss") setFlag(UPSELL_DISMISSED_KEY);- },async finish() {- const later = view.setup?.primary.id === "finish-later";if (store) track(() => store.trackOnboardingFinished(telemetryState()));await session.completeOnboarding(host?.configured ? "host" : "client");- writeFirstRun({ finishedLater: later, todosClosed: false });+ writeFirstRun({ finishedLater: false, todosClosed: false });},later() {if (store) track(() => store.trackOnboardingSkipped(telemetryState()));@@ -696,7 +705,7 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunwriteFirstRun({ finishedLater: true });},back() {- writeFirstRun({ step: "connect" });+ go(STEPS[Math.max(STEPS.indexOf(step) - 1, 0)]!);},};}diff --git a/apps/cua-spaces-web/src/bridge/ops/checklist.ts b/apps/cua-spaces-web/src/bridge/ops/checklist.tsindex f8b759256f..3aabdd2a32 100644--- a/apps/cua-spaces-web/src/bridge/ops/checklist.ts+++ b/apps/cua-spaces-web/src/bridge/ops/checklist.ts@@ -11,7 +11,7 @@* | `checklist.get` | the host method `checklist.get` | the host method `checklist.get` | unsupported |* | `checklist.send` | the host method `checklist.send` | the host method `checklist.send` | unsupported |*- * `checklist.send` takes a step done, `shown`, `dismiss`, `reopen`, or+ * `checklist.send` takes a step done or skipped, `shown`, `dismiss`, `reopen`, or* `merge` (progress this page kept itself before, merged once). The host* runs the core's `checklist.reduce`, saves it and records its usage* events; it ticks steps off from what it shows itself@@ -28,11 +28,14 @@ export interface HostChecklistState {done: string[];dismissed: boolean;shown: boolean;+ /** Steps skipped ("Skip"). */+ skipped: string[];}/** What `checklist.send` takes (`checklist::ChecklistAction`, without `observe`). */export type HostChecklistAction =| { type: "done"; step: string }+ | { type: "skip"; step: string }| { type: "shown" }| { type: "dismiss" }| { type: "reopen" }diff --git a/apps/cua-spaces-web/src/components/first-run-todos.tsx b/apps/cua-spaces-web/src/components/first-run-todos.tsxdeleted file mode 100644index 10a1e2c257..0000000000--- a/apps/cua-spaces-web/src/components/first-run-todos.tsx+++ /dev/null@@ -1,101 +0,0 @@-// SPDX-License-Identifier: FSL-1.1-MIT-// Copyright (c) 2026 Cua AI, Inc.--import { useNavigate } from "@tanstack/react-router";-import { CheckIcon, XIcon } from "lucide-react";-import { useEffect, useState } from "react";--import { firstRunTodos, useBridge, useFirstRun, useFirstRunSaved, writeFirstRun } from "@/bridge";-import { Button } from "@/components/ui/button";-import { cn } from "@/lib/utils";--/** Whether Home shows the first run's to-do list (after Finish later). */-export function useFirstRunTodosShown(): boolean {- const saved = useFirstRunSaved();- return saved.finishedLater && !saved.todosClosed;-}--/**- * "Finish setting up" on Home after the first run's Finish later: the same- * checks, kept, each with its fix (the core's `firstRun.todos`). It goes- * away once everything required is done, or when closed.- */-export function FirstRunTodosCard() {- const shown = useFirstRunTodosShown();- return shown ? <TodosCard /> : null;-}--function TodosCard() {- // Home reads more slowly than the first run.- const fr = useFirstRun(true, 10_000);- const { core } = useBridge();- const todos = firstRunTodos(core, { ...fr.input, step: "setup" });- const [copied, setCopied] = useState(false);- const navigate = useNavigate();- useEffect(() => {- if (todos?.complete) writeFirstRun({ todosClosed: true });- }, [todos?.complete]);- if (!todos) return null;- return (- <section className="mb-6 overflow-hidden rounded-xl border bg-card" aria-labelledby="first-run-todos" data-first-run-todos="">- <header className="flex items-start justify-between gap-4 border-b px-5 py-3.5">- <div>- <h2 id="first-run-todos" className="text-[14px] font-semibold">- {todos.title}- </h2>- <p className="text-[13px] text-muted-foreground">{todos.lede}</p>- </div>- <div className="flex items-center gap-2">- <span className="text-[13px] text-muted-foreground">{todos.progress}</span>- <Button variant="ghost" size="icon-sm" aria-label="Close" onClick={() => writeFirstRun({ todosClosed: true })}>- <XIcon className="size-3.5" />- </Button>- </div>- </header>- <ul className="divide-y">- {todos.items.map((t) => (- <li key={t.id} className="flex items-center gap-3.5 px-5 py-2.5" data-first-run-todo={t.id} data-done={t.done ? "" : undefined}>- <span- aria-hidden- className={cn(- "flex size-5 shrink-0 items-center justify-center rounded-full border",- t.done ? "border-brand bg-brand text-white" : "border-foreground/25",- )}- >- {t.done ? <CheckIcon className="size-3" strokeWidth={3} /> : null}- </span>- <div className="min-w-0 flex-1">- <p className={cn("text-[13px] font-medium", t.done && "text-muted-foreground")}>- {t.title}- <span className="sr-only">{t.done ? " (done)" : ""}</span>- </p>- <p className="truncate text-xs text-muted-foreground">{t.note}</p>- </div>- {t.action ? (- <Button- variant="outline"- size="sm"- className="shrink-0"- onClick={() => {- if (t.action!.id === "copy") {- void fr.copyPrompt().then(() => {- setCopied(true);- setTimeout(() => setCopied(false), 1500);- });- } else if (t.action!.id === "add") {- // Back to the first run's choice of system (macOS or Linux).- void fr.extra("add").then(() => navigate({ to: "/onboarding" }));- } else {- void fr.act(t.action!.id, t.settingsUrl);- }- }}- >- {t.action.id === "copy" && copied ? "Copied" : t.action.label}- </Button>- ) : null}- </li>- ))}- </ul>- </section>- );-}diff --git a/apps/cua-spaces-web/src/components/getting-started.tsx b/apps/cua-spaces-web/src/components/getting-started.tsxindex 1b1c42dabe..30f453e7c9 100644--- a/apps/cua-spaces-web/src/components/getting-started.tsx+++ b/apps/cua-spaces-web/src/components/getting-started.tsx@@ -2,15 +2,15 @@// Copyright (c) 2026 Cua AI, Inc./**- * The getting-started checklist on the Spaces page: five first steps,- * ticked off as they happen, closable, and back from the command palette- * or Help > Getting Started. Its steps, words and progress are the core's- * (`bridge/checklist.ts`); this draws them and runs each step's button.+ * The getting-started checklist in the sidebar: five first steps, ticked+ * off as they happen, each skippable, closable, and back from the command+ * palette or Help > Getting Started. Its steps, words and progress are the+ * core's (`bridge/checklist.ts`); this draws them and runs each step.*/import { useNavigate } from "@tanstack/react-router";-import { CheckIcon, XIcon } from "lucide-react";-import { useEffect } from "react";+import { CheckIcon, ChevronDownIcon } from "lucide-react";+import { useEffect, useSyncExternalStore } from "react";import {useAgents,@@ -27,7 +27,6 @@ import {} 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";@@ -53,24 +52,32 @@ function spaceFor(spaces: Space[], offers: (space: Space) => boolean | undefinedreturn { offered };}-/** With a Space ready, the order that leads somewhere: run an agent in it first; Add computer and Share last. */-const READY_ORDER: ChecklistStep[] = ["run_agent", "create_space", "teleport", "add_machine", "share"];+/** Whether the sidebar's checklist is open (Help > Getting Started opens it). */+let expanded = false;+const expandListeners = new Set<() => void>();+export function setExpanded(on: boolean): void {+ expanded = on;+ for (const l of [...expandListeners]) l();+}+function useExpanded(): boolean {+ return useSyncExternalStore(+ (l) => {+ expandListeners.add(l);+ return () => void expandListeners.delete(l);+ },+ () => expanded,+ () => false,+ );+}-/** `onRunAgent`: the Space is ready, so Run an agent opens "Run an agent here" and leads the list. */-export function GettingStarted({ onRunAgent }: { onRunAgent?: () => void } = {}) {- const { view, shown, dismiss } = useChecklist();+/** What each step's row does when clicked. */+function useChecklistGo(): (step: ChecklistStep) => void {const navigate = useNavigate();const newSpace = useNewSpace();const { data: spaces = [], isLoading: spacesLoading } = useSpaces();const { data: session } = useSession();const teleport = useTeleport();const share = useShareSheet();- const visible = view?.visible ?? false;-- useEffect(() => {- if (visible) shown();- }, [visible, shown]);-const { core } = useBridge();const exp = useExperiments();const experiments = exp.unsupported ? undefined : (exp.data?.experiments ?? {});@@ -92,10 +99,7 @@ export function GettingStarted({ onRunAgent }: { onRunAgent?: () => void } = {})}toast("Start a Space first", { description: `${what} works on a running Space.` });};-- if (!view || !visible) return null;-- const go = (step: ChecklistStep) => {+ return (step) => {switch (step) {case "add_machine":return void navigate({ href: ADD_MACHINE_HREF });@@ -106,54 +110,85 @@ export function GettingStarted({ onRunAgent }: { onRunAgent?: () => void } = {})case "share":return onSpace("share", (space) => share.open(space, session?.signedIn ?? false), "Share");case "run_agent":- return onRunAgent ? onRunAgent() : void navigate({ to: "/agents" });+ return void navigate({ to: "/agents" });}};- const rows = onRunAgent ? [...view.rows].sort((a, b) => READY_ORDER.indexOf(a.step) - READY_ORDER.indexOf(b.step)) : view.rows;+}+/**+ * "Get started 2/5" at the bottom of the sidebar. Its steps open in place,+ * above it: each does its thing when clicked, and has a quiet Skip (a+ * skipped step counts as done). Hide closes it ("Done" once complete); Help+ * > Getting Started brings it back, open. The steps, words and progress are+ * the core's (`bridge/checklist.ts`).+ */+export function SidebarGetStarted() {+ const { view, shown, dismiss, skip } = useChecklist();+ const open = useExpanded();+ const go = useChecklistGo();+ const visible = view?.visible ?? false;++ useEffect(() => {+ if (visible) shown();+ }, [visible, shown]);++ if (!view || !visible) return null;+ const settled = view.rows.filter((r) => r.done || r.skipped).length;+ const share = settled / view.rows.length;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">- {view.title}- </h2>- <p className="mt-0.5 text-xs text-muted-foreground">{view.detail}</p>- </div>- <span className="mt-0.5 text-xs tabular-nums text-muted-foreground" data-checklist-count="">- {view.progress} done- </span>- <Button variant="ghost" size="icon-sm" aria-label={view.closeLabel} onClick={() => dismiss()}>- <XIcon className="size-3.5 text-muted-foreground" />- </Button>- </header>- <ol className="divide-y border-t">- {rows.map(({ step, title, detail, action, done }) => (- <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")}>+ <section data-checklist="" data-open={open || undefined} aria-label={view.title} className="mx-2 mb-1">+ {open ? (+ <ol className="mb-1 border-t border-foreground/10 pt-1" data-checklist-steps="">+ {view.rows.map(({ step, title, detail, done, skipped }) => (+ <li key={step} data-checklist-step={step} data-done={done || undefined} data-skipped={skipped || undefined} className="group flex h-7 items-center gap-2 rounded-md px-2 text-[12.5px] hover:bg-foreground/5">+ <span+ aria-hidden+ className={cn(+ "flex size-3.5 shrink-0 items-center justify-center rounded-full border",+ done ? "border-brand bg-brand text-white" : skipped ? "border-foreground/25 bg-foreground/10" : "border-foreground/25",+ )}+ >+ {done ? <CheckIcon className="size-2" strokeWidth={3.5} /> : null}+ </span>+ <button+ type="button"+ title={detail}+ disabled={done || skipped}+ onClick={() => go(step)}+ className={cn("min-w-0 flex-1 truncate text-left outline-none disabled:cursor-default", done || skipped ? "text-muted-foreground line-through decoration-foreground/30" : "text-foreground")}+ >{title}- <span className="sr-only">{done ? " (done)" : ""}</span>- </div>- <div className="truncate text-xs text-muted-foreground">{detail}</div>- </div>- {done ? null : (- <Button variant="outline" size="sm" onClick={() => go(step)}>- {action}- </Button>- )}- </li>- ))}- </ol>+ <span className="sr-only">{done ? " (done)" : skipped ? " (skipped)" : ""}</span>+ </button>+ {done ? null : skipped ? (+ <span className="text-[11px] text-muted-foreground">Skipped</span>+ ) : (+ <button type="button" className="text-[11px] text-muted-foreground opacity-70 hover:text-foreground hover:opacity-100" onClick={() => skip(step)} data-checklist-skip={step}>+ {view.skipLabel}+ </button>+ )}+ </li>+ ))}+ </ol>+ ) : null}+ <div className="flex h-7 items-center gap-2 rounded-md px-2 text-[13px] text-muted-foreground hover:bg-foreground/5">+ <button type="button" className="flex min-w-0 flex-1 items-center gap-2 text-left outline-none hover:text-foreground" onClick={() => setExpanded(!open)} aria-expanded={open} data-checklist-toggle="">+ <svg viewBox="0 0 16 16" aria-hidden className="size-3.5 shrink-0 -rotate-90">+ <circle cx="8" cy="8" r="6.5" fill="none" stroke="currentColor" strokeOpacity=".25" strokeWidth="2" />+ <circle cx="8" cy="8" r="6.5" fill="none" stroke="currentColor" strokeWidth="2" strokeDasharray={`${share * 40.8} 40.8`} />+ </svg>+ <span className="flex-1 truncate">{view.title}</span>+ <span className="tabular-nums" data-checklist-count="">+ {settled}/{view.rows.length}+ </span>+ <ChevronDownIcon aria-hidden className={cn("size-3.5 transition-transform", open ? "" : "rotate-180")} />+ </button>+ {open || view.complete ? (+ <button type="button" className="text-[11px] hover:text-foreground" onClick={() => dismiss()} aria-label={view.closeLabel} data-checklist-hide="">+ {view.hideLabel}+ </button>+ ) : null}+ </div></section>);}@@ -169,7 +204,6 @@ export function GettingStarted({ onRunAgent }: { onRunAgent?: () => void } = {})*/export function ChecklistTracker() {const { state, send, reopen } = useChecklist();- const navigate = useNavigate();const { data: machines } = useMachines();const { data: spaces } = useSpaces();@@ -183,11 +217,11 @@ export function ChecklistTracker() {const onHostEvent = (event: Event) => {if ((event as CustomEvent<WebkitEventDetail>).detail?.event !== WEBKIT_OPEN_CHECKLIST_EVENT) return;reopen();- void navigate({ to: "/spaces" });+ setExpanded(true);};window.addEventListener(WEBKIT_EVENT, onHostEvent);return () => window.removeEventListener(WEBKIT_EVENT, onHostEvent);- }, [reopen, navigate]);+ }, [reopen]);// Agents are only read while this step is open.return state.done.run_agent ? null : <AgentProgress onRun={() => send({ type: "observe", otherMachine: false, hasSpace: false, agentRan: true })} />;diff --git a/apps/cua-spaces-web/src/components/resources/computer-resources.tsx b/apps/cua-spaces-web/src/components/resources/computer-resources.tsxindex 831a1442ef..206948c016 100644--- a/apps/cua-spaces-web/src/components/resources/computer-resources.tsx+++ b/apps/cua-spaces-web/src/components/resources/computer-resources.tsx@@ -1,45 +1,68 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.+import { Link } from "@tanstack/react-router";+import { hostResources, type Machine, type ResourcesSnapshot } from "@/bridge";-import { thisComputerLabel, thisComputerText } from "@/lib/host-labels";-import { extraSpacesLine, hostMeters, lowDiskWarning, updatedAgo } from "@/lib/resources";+import { thisComputerLabel } from "@/lib/host-labels";+import { lowDiskWarning, size } from "@/lib/resources";-import { LowDiskWarning, MeterRow } from "./meters";+/** One thing on a computer that needs action, as Home says it. */+export interface ComputerWarning {+ /** `disk`; the same line takes permissions, updates and the budget once+ * the app reports them per computer. */+ kind: "disk";+ machineId: string;+ text: string;+ level: "low" | "critical";+ /** This computer: its Spaces can be sorted by what they use. */+ local: boolean;+}/**- * Home's strip for each computer that sent numbers: This Mac first (with- * the low-disk warning on top when it's short of space), then your other- * computers' summaries with how old they are. Nothing when no computer- * sent any.+ * What needs action on your computers, nothing else: today a disk nearly or+ * completely full ("Disk almost full on This Mac (12 GB left)"). A computer+ * that is just offline is not a warning, and nothing shows while all is well.+ *+ * TODO: permissions needed, an update required and a budget+ * reached go through this same line once the app reports them per computer.*/-export function ComputersResources({ snapshot, machines, now = Date.now() }: { snapshot: ResourcesSnapshot | null; machines: readonly Machine[]; now?: number }) {- const shown = machines.map((m) => ({ machine: m, host: hostResources(snapshot, m) })).filter((x) => x.host);- if (!shown.length) return null;+export function computerWarnings(snapshot: ResourcesSnapshot | null, machines: readonly Machine[]): ComputerWarning[] {+ const out: ComputerWarning[] = [];+ for (const m of machines) {+ const host = hostResources(snapshot, m);+ if (!host) continue;+ const name = m.current ? thisComputerLabel() : m.name;+ const disk = lowDiskWarning(host, name);+ if (!disk) continue;+ out.push({+ kind: "disk",+ machineId: m.id,+ level: disk.level,+ local: Boolean(m.current),+ text: disk.level === "critical" ? `Disk full on ${name} (${size(host.diskFree)} left)` : `Disk almost full on ${name} (${size(host.diskFree)} left)`,+ });+ }+ return out;+}++/** Home's warning lines: one quiet row each, only while there is one. */+export function ComputerWarnings({ snapshot, machines }: { snapshot: ResourcesSnapshot | null; machines: readonly Machine[] }) {+ const warnings = computerWarnings(snapshot, machines);+ if (!warnings.length) return null;return (- <section data-computers-resources="" aria-label="Computers" className="mb-6 space-y-3">- {shown.map(({ machine, host }) => {- const here = machine.current;- const name = here ? thisComputerLabel() : machine.name;- const warning = lowDiskWarning(host!, name);- const extra = extraSpacesLine(host!, here ? "here" : "there");- const line = here ? extra : [`Updated ${updatedAgo(host!.sampledAtMs, now)}.`, extra].filter(Boolean).join(" ");- return (- <div key={machine.id} data-computer-resources={machine.id} className="overflow-hidden rounded-xl border bg-card shadow-xs">- <div className="flex items-baseline justify-between gap-3 px-4 pt-3">- <h2 className="truncate text-[13px] font-semibold">{here && machine.name !== name ? `${machine.name} (${thisComputerText()})` : machine.name}</h2>- <span className="shrink-0 text-xs text-muted-foreground">{machine.online ? "Online" : "Offline"}</span>- </div>- {warning ? <LowDiskWarning warning={warning} className="mt-3 border-y" /> : null}- <div className="grid gap-x-8 gap-y-3 px-4 pt-3 sm:grid-cols-3">- {hostMeters(host!).map((m) => (- <MeterRow key={m.label} meter={m} />- ))}- </div>- {line ? <p className="px-4 pt-2.5 pb-3 text-xs text-muted-foreground">{line}</p> : <div className="pb-3" />}- </div>- );- })}+ <section data-computer-warnings="" aria-label="Needs attention" className="mb-4 divide-y divide-foreground/10 border-y border-foreground/10">+ {warnings.map((w) => (+ <p key={`${w.kind}:${w.machineId}`} role="status" data-computer-warning={w.kind} data-low-disk={w.level} className="flex items-center gap-2.5 py-2 text-[13px] text-muted-foreground">+ <span aria-hidden className={w.level === "critical" ? "size-1.5 shrink-0 rounded-full bg-destructive" : "size-1.5 shrink-0 rounded-full bg-[#d18a12]"} />+ <span className="min-w-0 flex-1">{w.text}</span>+ {w.local ? (+ <Link to="/spaces" search={{ sort: "size" }} data-see-space-use="" className="shrink-0 text-[13px] text-muted-foreground underline decoration-foreground/30 underline-offset-2 hover:text-foreground">+ See what’s using space+ </Link>+ ) : null}+ </p>+ ))}</section>);}diff --git a/apps/cua-spaces-web/src/components/shell/command-palette.tsx b/apps/cua-spaces-web/src/components/shell/command-palette.tsxindex a8fa71d34b..41b24bae6a 100644--- a/apps/cua-spaces-web/src/components/shell/command-palette.tsx+++ b/apps/cua-spaces-web/src/components/shell/command-palette.tsx@@ -1,6 +1,7 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.+import { setExpanded } from "@/components/getting-started";import { useNavigate, useRouter } from "@tanstack/react-router";import {CornerDownLeftIcon,@@ -143,7 +144,7 @@ function PaletteBody({ onClose }: { onClose: () => void }) {icon: icon(ListChecksIcon),run: () => {checklist.reopen();- void navigate({ to: "/spaces" });+ setExpanded(true);},},...realSpaces(spaces).flatMap((s): Command[] => {diff --git a/apps/cua-spaces-web/src/components/shell/sidebar.tsx b/apps/cua-spaces-web/src/components/shell/sidebar.tsxindex 3b25fcdd48..e22628c3ff 100644--- a/apps/cua-spaces-web/src/components/shell/sidebar.tsx+++ b/apps/cua-spaces-web/src/components/shell/sidebar.tsx@@ -22,6 +22,7 @@ import { Shortcut } from "@/components/ui/kbd";import { SignInLink } from "@/components/sign-in-link";import { useNavItems } from "./nav";import { SidebarUpdateIndicator } from "./update-indicator";+import { SidebarGetStarted } from "@/components/getting-started";export function Sidebar() {const width = useUiStore((s) => s.sidebarWidth);@@ -75,6 +76,7 @@ export function Sidebar() {<div className="mt-auto"><SidebarCreating spaces={spaces ?? []} /><SidebarUpdateIndicator />+ <SidebarGetStarted /><AccountFooter /></div><ResizeHandle />diff --git a/apps/cua-spaces-web/src/routes/onboarding/index.tsx b/apps/cua-spaces-web/src/routes/onboarding/index.tsxindex 87f35b774c..dc028389e1 100644--- a/apps/cua-spaces-web/src/routes/onboarding/index.tsx+++ b/apps/cua-spaces-web/src/routes/onboarding/index.tsx@@ -2,13 +2,11 @@// Copyright (c) 2026 Cua AI, Inc.import { createFileRoute, useNavigate } from "@tanstack/react-router";-import { CheckIcon, ChevronRightIcon, CopyIcon } from "lucide-react";+import { CheckIcon, CopyIcon } from "lucide-react";import { useEffect, useState, type ReactNode } from "react";-import { useAgentKeys, useFirstRun, type FirstRunAgentPick, type FirstRunArt, type FirstRunCredential, type FirstRunExtraView, type FirstRunHook, type FirstRunRow, type FirstRunUpsell, type FirstRunView } from "@/bridge";+import { useAgentKeys, useFirstRun, type FirstRunArt, type FirstRunCredential, type FirstRunExtraView, type FirstRunHook, type FirstRunRow, type FirstRunView } from "@/bridge";import { KeySheet } from "@/components/agents/key-sheet";-import { Checkbox } from "@/components/ui/checkbox";-import { CuaKey } from "@/components/cua-key";import { CuaLogo } from "@/components/cua-logo";import { OsIcon } from "@/components/os-icon";import { Button } from "@/components/ui/button";@@ -20,10 +18,11 @@ import { cn } from "@/lib/utils";export const Route = createFileRoute("/onboarding/")({ component: OnboardingPage });/**- * The first run, the same on macOS, Windows and Linux: pick any agents (or- * none), then "Your agent can use this Mac". Every word and state is the app- * core's (`firstRun.view`, through `useFirstRun`); this file places them- * beside the keycap art.+ * The first run, the same on macOS, Windows and Linux: Welcome, Pick your+ * agent, Connect your other devices (optional), Try it in your agent. Every+ * word, the agents' order and which button does what are the app core's+ * (`firstRun.view`, through `useFirstRun`); this file places them beside the+ * keycap art, as plain rows.*/function OnboardingPage() {const fr = useFirstRun();@@ -59,8 +58,12 @@ function OnboardingPage() {</button></header><div className="relative z-10 flex min-h-0 flex-1 flex-col overflow-y-auto px-10 pb-6 [@media(min-width:1000px)]:pr-[42%]">- {view.connect ? <Connect fr={fr} view={view} /> : null}- {view.setup ? <Setup fr={fr} view={view} onFinish={() => void finish()} /> : null}+ <div className="my-auto flex max-w-[600px] flex-col py-6">+ {view.welcome ? <Welcome fr={fr} view={view} /> : null}+ {view.connect ? <Connect fr={fr} view={view} /> : null}+ {view.devices ? <Devices fr={fr} view={view} /> : null}+ {view.setup ? <Setup fr={fr} view={view} onFinish={() => void finish()} /> : null}+ </div></div><Dots view={view} /></div>@@ -76,7 +79,79 @@ function CuaWordmark() {);}-/* ---- Step 1: connect your agent --------------------------------------------------- */+/* ---- Pieces every screen uses ------------------------------------------------------ */++function Heading({ children }: { children: ReactNode }) {+ return (+ <h1 tabIndex={-1} data-onboarding-heading="" className="font-display text-[clamp(32px,4.4vw,48px)] leading-[1.05] font-semibold tracking-[-0.03em] text-balance outline-none">+ {children}+ </h1>+ );+}++function Lede({ children }: { children: ReactNode }) {+ return <p className="mt-3 text-[15px] leading-relaxed text-muted-foreground">{children}</p>;+}++/** Plain rows between hairlines: no boxes, no filled panels. */+function Rows({ children, className, ...rest }: { children: ReactNode; className?: string } & Record<`data-${string}`, string | undefined>) {+ return (+ <div className={cn("flex flex-col divide-y divide-foreground/10 border-y border-foreground/10", className)} {...rest}>+ {children}+ </div>+ );+}++function Primary({ label, onClick, ...rest }: { label: string; onClick: () => void } & Record<`data-${string}`, string | undefined>) {+ return (+ <Button size="lg" className="h-11 min-w-28 rounded-full px-6 text-[15px]" data-onboarding-primary="" onClick={onClick} {...rest}>+ {label}+ </Button>+ );+}++function Quiet({ label, onClick, ...rest }: { label: string; onClick: () => void } & Record<`data-${string}`, string | undefined>) {+ return (+ <button type="button" className="text-[13px] text-muted-foreground hover:text-foreground" onClick={onClick} {...rest}>+ {label}+ </button>+ );+}++/** A line with a state: a check, a spinner, or a fix with its button. */+function StatusLine({ row, onAct }: { row: FirstRunRow; onAct?: () => void }) {+ return (+ <div className="flex items-center gap-3 py-2.5" data-first-run-status={row.id} data-state={row.state}>+ <StateIcon state={row.state} />+ <div className="min-w-0 flex-1">+ <div className="text-[14px]">{row.title}</div>+ {row.note ? <div className="text-[13px] text-muted-foreground">{row.note}</div> : null}+ </div>+ {row.action && onAct ? (+ <Button size="sm" variant="outline" className="shrink-0 rounded-full" onClick={onAct} data-first-run-action={row.action.id}>+ {row.action.label}+ </Button>+ ) : null}+ </div>+ );+}++/* ---- 1 · Welcome ------------------------------------------------------------------ */++function Welcome({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {+ const w = view.welcome!;+ return (+ <div data-first-run="welcome">+ <Heading>{w.title}</Heading>+ <Lede>{w.lede}</Lede>+ <div className="mt-8">+ <Primary label={w.primary.label} onClick={() => void fr.act(w.primary.id)} />+ </div>+ </div>+ );+}++/* ---- 2 · Pick your agent ------------------------------------------------------------ */const MARKS: Record<string, string> = {"claude-code": "/onboarding/marks/mark-claude.svg",@@ -99,149 +174,111 @@ function AgentMark({ agent, name, className }: { agent: string; name?: string; cfunction Connect({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {const c = view.connect!;const keys = useAgentKeys();- const [moreOpen, setMoreOpen] = useState(false);- const [before, after] = c.title.split(c.accent);- const busy = Boolean(c.busy);- // A ticked agent from "More agents" stays in view.- const more = moreOpen ? c.more : [];- // The picker draws once the agents and keys are read, all at once, so nothing on the page moves while- // they load (and the page isn't centred vertically: a growing block would move the heading).- const ready = fr.input.agents !== null && !keys.isLoading;+ const [copied, setCopied] = useState(false);return (- <div className="flex max-w-[560px] flex-col py-8" data-first-run="connect">- <h1- tabIndex={-1}- data-onboarding-heading=""- className="font-display text-[clamp(36px,5vw,56px)] leading-[1.02] font-semibold tracking-[-0.03em] text-balance outline-none"- >- {before}- {after !== undefined ? (- <>- <span className="font-accent font-normal tracking-normal italic">{c.accent}</span>- {after}- </>- ) : null}- </h1>- <p className="mt-4 max-w-[520px] text-[15px] leading-relaxed text-muted-foreground">{c.lede}</p>- {ready ? (- <>- <p className="mt-7 text-[14px] font-medium" data-first-run-intro="">- {c.intro}- </p>-- <section className="mt-3" data-first-run-agents="">- <h2 className="mb-1.5 px-1 text-xs font-semibold text-muted-foreground">{c.agentsLabel}</h2>- <Card className="p-1.5">- {[...c.agents, ...more].map((p) => (- <AgentPickRow key={p.agent} pick={p} disabled={busy} onChange={(on) => fr.toggle(p.agent, on)} />- ))}- {c.more.length ? (- <button- type="button"- className="flex w-full items-center gap-1.5 rounded-lg px-3 py-1.5 text-left text-[13px] text-muted-foreground hover:text-foreground"- aria-expanded={moreOpen}- data-first-run-more=""- onClick={() => setMoreOpen((v) => !v)}+ <div data-first-run="connect">+ <Heading>{c.title}</Heading>+ <Lede>{c.lede}</Lede>+ {c.agents.length ? (+ <Rows className="mt-6" data-first-run-agents="">+ {c.agents.map((a) => (+ <div key={a.agent} className="flex min-h-11 items-center gap-3 py-2" data-first-run-agent={a.agent} data-connected={String(a.connected)}>+ <AgentMark agent={a.agent} name={a.name} />+ <div className="min-w-0 flex-1">+ <span className="text-[14px]">{a.name}</span>+ {a.file ? <span className="ml-2 font-mono text-[12px] text-muted-foreground">{a.file}</span> : null}+ </div>+ {a.note ? (+ <span className={cn("shrink-0 text-[13px]", a.connected ? "text-[#1f9d55]" : "text-muted-foreground")}>{a.note}</span>+ ) : null}+ {a.action ? (+ <Button size="sm" variant="outline" className="shrink-0 rounded-full" onClick={() => void fr.connect(a.agent)} data-first-run-connect={a.agent}>+ {a.action.label}+ </Button>+ ) : null}+ </div>+ ))}+ </Rows>+ ) : null}+ {c.alternatives.length ? (+ <Rows className="mt-6" data-first-run-alternatives="">+ {c.alternatives.map((alt) => (+ <div key={alt.id} className="flex items-center gap-3 py-2.5" data-first-run-alternative={alt.id}>+ <div className="min-w-0 flex-1">+ <div className="text-[14px]">{alt.title}</div>+ <div className="text-[13px] text-muted-foreground">{alt.note}</div>+ {alt.command ? <code className="mt-1 block font-mono text-[12.5px]">{alt.command}</code> : null}+ </div>+ {alt.url ? (+ <Button size="sm" variant="outline" className="shrink-0 rounded-full" onClick={() => void fr.openUrl(alt.url!)}>+ Open+ </Button>+ ) : alt.command ? (+ <Button+ size="sm"+ variant="outline"+ className="shrink-0 gap-1.5 rounded-full"+ onClick={() => {+ void navigator.clipboard?.writeText(alt.command!).catch(() => {});+ setCopied(true);+ setTimeout(() => setCopied(false), 1500);+ }}>- <ChevronRightIcon className={cn("size-3.5 transition-transform", moreOpen && "rotate-90")} aria-hidden />- {c.moreLabel} ({c.more.length})- </button>+ {copied ? <CheckIcon className="size-3.5" /> : <CopyIcon className="size-3.5" />}+ {copied ? "Copied" : "Copy"}+ </Button>) : null}- </Card>- <p className="mt-2 px-1 text-xs text-muted-foreground" data-first-run-agents-note="">- {c.agentsNote}- </p>- </section>-- {c.credentials.length ? (- <section className="mt-6" data-first-run-credentials="">- <h2 className="mb-1.5 px-1 text-xs font-semibold text-muted-foreground">{c.credentialsLabel}</h2>- <Card className="divide-y p-0">- {c.credentials.map((r) => (- <CredentialRowView- key={r.id}- row={r}- onAct={() => {- if (r.action?.id === "agent-sign-in" && r.agent) void fr.signIn(r.agent);- else if (r.action?.id === "add-key" && (r.provider === "anthropic" || r.provider === "openai")) keys.openSheet(r.provider);- }}- />- ))}- </Card>- <p className="mt-2 px-1 text-xs text-muted-foreground" data-first-run-credentials-note="">- {c.credentialsNote}- </p>- </section>- ) : null}-- <div className="mt-8 flex items-center gap-4">- <Button- size="lg"- className="h-11 min-w-28 rounded-full px-6 text-[15px]"- data-onboarding-primary=""- data-first-run-continue={c.connects.join(",")}- disabled={busy}- autoFocus- onClick={() => void fr.connect()}- >- {c.busy ?? c.primary.label}- </Button>- </div>- {c.error ? (- <p role="alert" className="mt-3 text-[13px] text-destructive">- {c.error}- </p>- ) : null}- {fr.usage ? (- <div className="mt-8 flex max-w-[520px] flex-col gap-3 text-[13px] text-muted-foreground" data-first-run-usage="">- <p>- {fr.usage.notice}{" "}- <button type="button" className="underline hover:text-foreground" onClick={fr.openUsageLink}>- {fr.usage.linkLabel}- </button>- </p>- <label className="flex items-center gap-2.5 text-foreground">- <Switch- checked={fr.usage.on}- disabled={!fr.usage.enabled}- onCheckedChange={(on) => void fr.setUsage(on).catch(() => {})}- aria-label={fr.usage.label}- />- <span>{fr.usage.label}</span>- {fr.usage.help ? <span className="text-muted-foreground">{fr.usage.help}</span> : null}- </label></div>- ) : null}+ ))}+ </Rows>+ ) : null}+ {c.credentials.length ? (+ <>+ <Rows className="mt-4" data-first-run-credentials="">+ {c.credentials.map((r) => (+ <CredentialRowView+ key={r.id}+ row={r}+ onAct={() => {+ if (r.action?.id === "agent-sign-in" && r.agent) void fr.signIn(r.agent);+ else if (r.action?.id === "add-key" && (r.provider === "anthropic" || r.provider === "openai")) keys.openSheet(r.provider);+ }}+ />+ ))}+ </Rows>+ <p className="mt-2 text-xs text-muted-foreground" data-first-run-credentials-note="">+ {c.credentialsNote}+ </p></>) : null}+ {c.error ? (+ <p role="alert" className="mt-3 text-[13px] text-destructive">+ {c.error}+ </p>+ ) : null}+ <div className="mt-6 flex items-center gap-4">+ <Primary label={c.primary.label} onClick={() => void fr.act(c.primary.id)} />+ {c.secondary ? <Quiet label={c.secondary.label} onClick={() => void fr.act(c.secondary!.id)} data-first-run-secondary="" /> : null}+ </div>+ {fr.usage ? (+ <label className="mt-5 flex items-center gap-2.5 text-[13px] text-muted-foreground" data-first-run-usage="">+ <Switch checked={fr.usage.on} disabled={!fr.usage.enabled} onCheckedChange={(on) => void fr.setUsage(on).catch(() => {})} aria-label={fr.usage.label} />+ <span>+ {fr.usage.label}.{" "}+ <button type="button" className="underline hover:text-foreground" onClick={fr.openUsageLink}>+ {fr.usage.linkLabel}+ </button>+ </span>+ </label>+ ) : null}{keys.sheet ? <KeySheet key={keys.sheet.provider} keys={keys} provider={keys.sheet.provider} env={keys.sheet.env} /> : null}</div>);}-/** One agent: the box toggles, and so does a click anywhere on the row. */-function AgentPickRow({ pick: p, disabled, onChange }: { pick: FirstRunAgentPick; disabled: boolean; onChange: (on: boolean) => void }) {- const off = p.locked || disabled;- return (- <div- className={cn("flex min-h-9 items-center gap-3 rounded-lg px-3 py-1.5", !off && "cursor-default hover:bg-foreground/[0.03]")}- data-first-run-pick={p.agent}- data-checked={String(p.checked)}- onClick={(e) => {- if (!off && !(e.target as HTMLElement).closest('[data-slot="checkbox"]')) onChange(!p.checked);- }}- >- <Checkbox checked={p.checked} disabled={off} aria-label={p.name} onCheckedChange={(on) => onChange(Boolean(on))} />- <AgentMark agent={p.agent} name={p.name} />- <span className="min-w-0 flex-1 text-[14px] select-none">{p.name}</span>- {p.note ? <span className="shrink-0 text-xs text-muted-foreground">{p.note}</span> : null}- </div>- );-}-function CredentialRowView({ row: r, onAct }: { row: FirstRunCredential; onAct: () => void }) {return (- <div className="flex items-center gap-3 px-4 py-2.5" data-first-run-credential={r.id}>+ <div className="flex items-center gap-3 py-2.5" data-first-run-credential={r.id}><div className="min-w-0 flex-1"><div className="text-[14px]">{r.title}</div><div className="text-xs text-muted-foreground">{r.note}</div>@@ -252,7 +289,7 @@ function CredentialRowView({ row: r, onAct }: { row: FirstRunCredential; onAct:) : null}</div>{r.status ? (- <span className={cn("shrink-0 text-xs", r.ok ? "rounded-full bg-[#1f9d55]/10 px-2 py-0.5 font-medium text-[#1f9d55]" : "text-muted-foreground")} data-first-run-credential-status="">+ <span className={cn("shrink-0 text-[13px]", r.ok ? "text-[#1f9d55]" : "text-muted-foreground")} data-first-run-credential-status="">{r.status}</span>) : null}@@ -265,7 +302,33 @@ function CredentialRowView({ row: r, onAct }: { row: FirstRunCredential; onAct:);}-/* ---- Step 2: your agent can use this Mac ------------------------------------------- */+/* ---- 3 · Connect your other devices -------------------------------------------------- */++function Devices({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {+ const d = view.devices!;+ return (+ <div data-first-run="devices">+ <Heading>{d.title}</Heading>+ <Lede>{d.lede}</Lede>+ <Rows className="mt-6" data-first-run-devices="">+ {d.rows.map((r) => (+ <div key={r.title} className="flex items-baseline gap-3 py-2.5 text-[14px]">+ <span className="w-48 shrink-0">{r.title}</span>+ <span className="text-[13px] text-muted-foreground">{r.note}</span>+ </div>+ ))}+ {d.status ? <StatusLine row={d.status} onAct={() => void fr.act(d.status!.action?.id ?? "")} /> : null}+ </Rows>+ <div className="mt-7 flex items-center gap-4">+ <Primary label={d.primary.label} onClick={() => void fr.act(d.primary.id)} data-first-run-devices-primary={d.primary.id} />+ {d.secondary ? <Quiet label={d.secondary.label} onClick={() => void fr.act(d.secondary!.id)} data-first-run-secondary="" /> : null}+ </div>+ {d.note ? <p className="mt-4 text-[13px] text-muted-foreground">{d.note}</p> : null}+ </div>+ );+}++/* ---- 4 · Try it ---------------------------------------------------------------------- */function Setup({ fr, view, onFinish }: { fr: FirstRunHook; view: FirstRunView; onFinish: () => void }) {const s = view.setup!;@@ -276,64 +339,40 @@ function Setup({ fr, view, onFinish }: { fr: FirstRunHook; view: FirstRunView; osetTimeout(() => setCopied(false), 1500);};return (- <div className="my-auto flex max-w-[600px] flex-col py-6" data-first-run="setup">- <h1 tabIndex={-1} data-onboarding-heading="" className="font-display text-[clamp(32px,4.4vw,48px)] leading-[1.05] font-semibold tracking-[-0.03em] outline-none" role="status">- {s.title}- </h1>- <Card className="mt-7 divide-y p-0">- {s.rows.map((r) => (- <Row key={r.id} row={r} onAct={() => void fr.act(r.action!.id, r.settingsUrl)} />- ))}- </Card>-+ <div data-first-run="setup">+ <Heading>{s.title}</Heading>+ <Lede>{s.lede}</Lede>{s.prompt ? (- <>- <h2 className="mt-7 text-[14px] font-semibold">{s.prompt.heading}</h2>+ <div className="mt-6 flex items-start gap-3">+ <textarea+ readOnly+ rows={2}+ value={s.prompt.text}+ aria-label={s.prompt.heading}+ onFocus={(e) => e.currentTarget.select()}+ className="min-w-0 flex-1 resize-none rounded-lg border border-foreground/15 bg-transparent px-3 py-2 font-mono text-[13px] leading-relaxed outline-none select-text focus-visible:ring-2 focus-visible:ring-ring/60"+ data-first-run-prompt=""+ />{s.prompt.copy ? (- <Card className="mt-2 flex items-center justify-between gap-3 py-2.5 pr-2.5">- <span className="min-w-0 text-[14px] select-text">“{s.prompt.text}”</span>- <Button variant="outline" size="sm" className="shrink-0 gap-1.5 rounded-full" onClick={() => void copy()} data-first-run-copy="">- {copied ? <CheckIcon className="size-3.5" /> : <CopyIcon className="size-3.5" />}- {copied ? "Copied" : s.prompt.copy}- </Button>- </Card>- ) : (- <p className="mt-1.5 text-[14px] select-text">“{s.prompt.text}”</p>- )}- <p className="mt-2 text-[13px] text-muted-foreground">{s.prompt.note}</p>- </>+ <Button variant="outline" size="sm" className="shrink-0 gap-1.5 rounded-full" onClick={() => void copy()} data-first-run-copy="">+ {copied ? <CheckIcon className="size-3.5" /> : <CopyIcon className="size-3.5" />}+ {copied ? "Copied" : s.prompt.copy}+ </Button>+ ) : null}+ </div>) : null}-- <ExtraCard extra={s.extra} fr={fr} />- {s.upsell ? <UpsellCard card={s.upsell} fr={fr} /> : null}-+ {s.status ? (+ <div className="mt-3">+ <StatusLine row={s.status} />+ </div>+ ) : null}+ {s.extra ? <ExtraCard extra={s.extra} fr={fr} /> : null}<div className="mt-8 flex items-center gap-4">- <Button- size="lg"- variant={s.primary.id === "done" ? "default" : "outline"}- className="h-11 min-w-28 rounded-full px-6 text-[15px]"- disabled={!s.primary.enabled}- data-onboarding-primary=""- data-first-run-primary={s.primary.id}- onClick={onFinish}- >+ <Button size="lg" className="h-11 min-w-28 rounded-full px-6 text-[15px]" disabled={!s.primary.enabled} data-onboarding-primary="" data-first-run-primary={s.primary.id} onClick={onFinish}>{s.primary.label}</Button>- {s.primary.note ? <span className="text-[13px] text-muted-foreground">{s.primary.note}</span> : null}+ <Quiet label="Back" onClick={fr.back} data-first-run-back="" /></div>- {view.setup && !fr.saved.usedAtMs ? (- <button type="button" onClick={fr.back} className="mt-5 self-start text-xs text-muted-foreground hover:text-foreground">- Change agents- </button>- ) : null}- </div>- );-}--function Card({ children, className, ...rest }: { children: ReactNode; className?: string } & Record<`data-${string}`, string | undefined>) {- return (- <div className={cn("rounded-2xl border bg-card px-5 py-4 shadow-xs", className)} {...rest}>- {children}</div>);}@@ -350,28 +389,11 @@ function StateIcon({ state }: { state: FirstRunRow["state"] | "later" }) {return <span className="size-5 shrink-0 animate-spin rounded-full border-2 border-foreground/15 border-t-foreground/60" aria-label="Checking" />;}-function Row({ row, onAct }: { row: FirstRunRow; onAct: () => void }) {- return (- <div className="flex items-center gap-3.5 px-5 py-3.5" data-first-run-row={row.id} data-state={row.state}>- <StateIcon state={row.state} />- <div className="min-w-0 flex-1">- <div className="text-[14px] font-medium">{row.title}</div>- <div className="text-[13px] text-muted-foreground">{row.note}</div>- </div>- {row.action ? (- <Button size="sm" variant={row.action.id === "restart-check" ? "outline" : "default"} className="shrink-0 rounded-full" onClick={onAct} data-first-run-action={row.action.id}>- {row.action.label}- </Button>- ) : null}- </div>- );-}-function ExtraCard({ extra, fr }: { extra: FirstRunExtraView; fr: FirstRunHook }) {const act = (id: string) => void fr.extra(id);if (extra.phase === "choose") {return (- <Card className="mt-6 border-dashed bg-card/60" data-first-run-extra="choose">+ <div className="mt-6" data-first-run-extra="choose"><div className="flex items-baseline gap-2"><h2 className="text-[15px] font-semibold">{extra.title}</h2>{extra.tag ? <span className="text-[13px] text-muted-foreground">{extra.tag}</span> : null}@@ -403,12 +425,12 @@ function ExtraCard({ extra, fr }: { extra: FirstRunExtraView; fr: FirstRunHook }</div>{/* Windows without Docker Desktop: install or start it from here, and the choices follow. */}{extra.choices.some((c) => c.blocked !== null) ? <RuntimeFixRow /> : null}- </Card>+ </div>);}const icon = extra.phase === "ready" ? "ok" : extra.phase === "failed" ? "fix" : extra.phase === "not-now" ? "later" : "checking";return (- <Card className="mt-6" data-first-run-extra={extra.phase}>+ <div className="mt-6 border-y border-foreground/10 py-3" data-first-run-extra={extra.phase}><div className="flex items-start gap-3.5"><span className="mt-0.5 flex"><StateIcon state={icon} />@@ -434,39 +456,7 @@ function ExtraCard({ extra, fr }: { extra: FirstRunExtraView; fr: FirstRunHook }</Button>) : null}</div>- </Card>- );-}--function UpsellCard({ card, fr }: { card: FirstRunUpsell; fr: FirstRunHook }) {- useEffect(() => {- // Counted once per showing.- fr.upsell("shown");- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [card.plan]);- return (- <Card className="mt-4" data-first-run-upsell={card.plan}>- <div className="flex items-start gap-3">- <CuaKey size={20} className="mt-0.5" />- <div className="min-w-0 flex-1">- <h2 className="text-[15px] font-semibold">{card.title}</h2>- {card.lines.map((l) => (- <p key={l} className="text-[13px] text-muted-foreground">- {l}- </p>- ))}- <div className="mt-3 flex items-center gap-2">- <span className="flex-1 text-[14px] font-medium">{card.price}</span>- <Button size="sm" className="rounded-full" onClick={() => fr.upsell("click")} data-first-run-upsell-cta="">- {card.cta.label}- </Button>- <Button variant="outline" size="sm" className="rounded-full" onClick={() => fr.upsell("dismiss")} data-first-run-upsell-dismiss="">- {card.dismiss}- </Button>- </div>- </div>- </div>- </Card>+ </div>);}diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsxindex f9b180d86a..1d4aa9558e 100644--- a/apps/cua-spaces-web/src/routes/spaces/index.tsx+++ b/apps/cua-spaces-web/src/routes/spaces/index.tsx@@ -5,18 +5,15 @@ import { createFileRoute, Link } from "@tanstack/react-router";import { ArrowDownCircleIcon, KeyRoundIcon, LoaderCircleIcon, MonitorIcon, PlusIcon, PowerIcon, SearchIcon } from "lucide-react";import { useEffect, useRef, useState, type DragEvent } from "react";-import { emptyHome, spaceResources, useAgents, useBridge, useChecklist, useResources, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaceFiles, useSpaces, useSpaceThumbnail, useWindowDropTarget, type Space, type SpaceResources } from "@/bridge";+import { emptyHome, spaceResources, useAgents, useBridge, useChecklist, useResources, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaceFiles, useSpaces, useSpaceThumbnail, useWindowDropTarget, type Space } from "@/bridge";import { EmptyHome } from "@/components/empty-home";import { ConnectAgentDialog } from "@/components/agents/connect-dialog";import { RunAgentDialog } from "@/components/agents/run-agent-dialog";-import { GettingStarted } from "@/components/getting-started";import { SpaceReadyCard, useAgentOffer } from "@/components/space-ready-card";import { useFirstRunStep, useFirstSpaceMilestones } from "@/components/first-run-guide";-import { FirstRunTodosCard, useFirstRunTodosShown } from "@/components/first-run-todos";import { OsIcon } from "@/components/os-icon";import { EmptyState, Page, PageHeader } from "@/components/page";-import { ComputersResources } from "@/components/resources/computer-resources";-import { CompactMeters } from "@/components/resources/meters";+import { ComputerWarnings } from "@/components/resources/computer-resources";import { SpaceCanvas } from "@/components/space-canvas";import { StateLabel } from "@/components/state-dot";import { useTileVideo } from "@/components/video/tile-video";@@ -28,7 +25,6 @@ import { Segmented } from "@/components/ui/segmented";import { toast, toastError } from "@/components/ui/toast";import { creatingLine, thisComputerText } from "@/lib/host-labels";import { plural } from "@/lib/plural";-import { spaceMeters } from "@/lib/resources";import { cn } from "@/lib/utils";import { createError, createProgress, machineName, matchesQuery, powerButton, powerError, realSpaces, spacePlace, spaceState, visibleSpaces, type SpaceFilter } from "@/lib/spaces";@@ -67,7 +63,6 @@ function SpacesPage() {const access = useSpaceAccess(spaces);const running = spaces.filter((s) => spaceState(s) === "running").length;// After the first run's Finish later, its to-do list stands in for the checklist.- const firstRunTodos = useFirstRunTodosShown();// The first Space is ready and no agent has worked in it yet: one action, "Run an agent here".const { state: checklist } = useChecklist();const { data: agents, isLoading: agentsLoading } = useAgents();@@ -106,7 +101,6 @@ function SpacesPage() {<>{/* No Spaces yet: the guided first run comes first, above the checklist and computers (CUA-2062). */}{guide ? <EmptyHome home={guide} unread={Boolean(listNotice)} /> : null}- <FirstRunTodosCard />{runHere ? <SpaceReadyCardspace={runHere}onRun={(task) => {@@ -117,14 +111,13 @@ function SpacesPage() {}}onDismiss={offer.dismiss}/> : null}- {firstRunTodos ? null : <GettingStarted onRunAgent={runHere ? () => { setRunPrompt(undefined); setRunOpen(true); } : undefined} />}{readySpace ? (<><RunAgentDialog open={runOpen} space={readySpace} prompt={runPrompt} onOpenChange={setRunOpen} onManual={() => setConnectOpen(true)} onConnected={offer.completed} /><ConnectAgentDialog open={connectOpen} onOpenChange={setConnectOpen} /></>) : null}- <ComputersResources snapshot={resources} machines={machines} />+ <ComputerWarnings snapshot={resources} machines={machines} />{sort === "size" ? (<p data-sorted-by-size="" className="mb-3 flex items-center gap-2 px-1 text-xs text-muted-foreground">Biggest first, by how much space each one uses on its computer.@@ -183,7 +176,7 @@ function SpacesPage() {<ul className="grid grid-cols-[repeat(auto-fill,minmax(232px,1fr))] gap-4">{shown.map((space) => (<li key={space.id}>- <SpaceTile space={space} machine={machineName(machines, space)} resources={spaceResources(resources, space.id)} accessKey={access.signedIn.has(space.id) ? access.accessKey(space.id) : undefined} />+ <SpaceTile space={space} machine={machineName(machines, space)} accessKey={access.signedIn.has(space.id) ? access.accessKey(space.id) : undefined} /></li>))}</ul>@@ -194,7 +187,7 @@ function SpacesPage() {);}-function SpaceTile({ space, machine, resources, accessKey }: { space: Space; machine: string; resources: SpaceResources | null; accessKey?: string | null }) {+function SpaceTile({ space, machine, accessKey }: { space: Space; machine: string; accessKey?: string | null }) {const drop = useTileDrop(space);// A real window dragged over this tile (the host hit-tests the tiles' boxes and says which; macOS only).const windowOver = useWindowDropTarget() === space.id;@@ -207,7 +200,7 @@ function SpaceTile({ space, machine, resources, accessKey }: { space: Space; macdata-window-over={windowOver || undefined}{...drop.handlers}>- <SpaceLink space={space} machine={machine} resources={resources} windowOver={windowOver} />+ <SpaceLink space={space} machine={machine} windowOver={windowOver} />{drop.over ? <DropOverlay space={space} accepts={drop.over === "accept"} /> : null}{/* A drop on the tile still going in: the core's "Sending …" line. */}{drop.status?.kind === "working" && !drop.over ? (@@ -328,7 +321,7 @@ function TilePower({ space }: { space: Space }) {);}-function SpaceLink({ space, machine, resources = null, windowOver = false }: { space: Space; machine: string; resources?: SpaceResources | null; windowOver?: boolean }) {+function SpaceLink({ space, machine, windowOver = false }: { space: Space; machine: string; windowOver?: boolean }) {return (<Linkto="/spaces/$spaceId"@@ -369,7 +362,6 @@ function SpaceLink({ space, machine, resources = null, windowOver = false }: { s<StateLabel state={spaceState(space)} space={space} className="mt-px shrink-0" /></div>{/* What it was given and uses now, when its computer says. */}- {resources && (spaceState(space) === "running" || spaceState(space) === "stopped") ? <CompactMeters meters={spaceMeters(resources)} className="px-1.5 pt-1 pb-1.5" /> : null}</Link>);}diff --git a/docs/content/docs/spaces/guides/connect-your-agent.mdx b/docs/content/docs/spaces/guides/connect-your-agent.mdxindex 87f10e2a49..d4478d88eb 100644--- a/docs/content/docs/spaces/guides/connect-your-agent.mdx+++ b/docs/content/docs/spaces/guides/connect-your-agent.mdx@@ -20,12 +20,13 @@ desktop and share a Space whenever you ask.## Connect from the app-On first run, the first screen says **Pick any, or none**. Tick the agents you-use on this computer (the ones installed here are ticked already; the rest are-under **More agents**) and press **Continue**. The app adds the Cua skills and-MCP server to each ticked agent's settings and checks that it can use them. If-an agent was already open, close it and open it again. Ticking none is fine:-connect agents later in **Settings, AI agents**.+On first run, **Pick your agent** lists the agents found on this computer,+most used first: Hermes, Claude Code, Codex, Cursor, then the rest. Each row+names the settings file Cua changes. Press **Connect** on each agent you want:+the app adds the Cua skills and MCP server to that agent's settings. Nothing is+connected until you press it. If an agent was already open, close it and open+it again. Connecting none is fine: connect agents later in **Settings, AI+agents**.### Per computer@@ -39,14 +40,14 @@ Everything on this screen belongs to this computer only:### Codex and ChatGPTCodex signs in with your ChatGPT account on its own, with `codex login`. When-Codex is ticked, the first screen shows **ChatGPT sign-in**: press **Sign in**+Codex is connected, the screen shows **ChatGPT sign-in**: press **Sign in**and finish in the browser that opens. Codex keeps the sign-in on this computer,and Cua never reads or copies it. On another computer, sign in to Codex there(press **Sign in** in its first run, or run `codex login`).An agent that Cua runs in a Space uses the provider keys saved on the computerthat hosts the Space: the **OpenAI key** for Codex and the **Anthropic key** for-Claude Code. Add them on the first screen or in **Settings, Agents**. They stay+Claude Code. Add them on **Pick your agent** or in **Settings, Agents**. They stayin this computer's Keychain (Credential Manager on Windows).To connect an agent later, or to remove one, open **Settings, AI agents**:@@ -87,12 +88,12 @@ this computer shares the same Spaces, sandboxes and streams.3. If your agent asks permission to use a `cua` tool, allow it. Agents ask intheir own window or terminal.-Then try the request the app offers at the end of its first run. It works-right away, on this computer:+Then try the request the app offers at the end of its first run. The agent makes+a Space on this computer:-> List my computers and tell me what's on this Mac+> Make a Linux Space on this Mac and run my tests there.-On Windows the request ends "on this PC", and on Linux "on this computer". When+On Windows the request says "this PC", and on Linux "this computer". Whenthat works, try a bigger task:| Ask your agent | What it does |diff --git a/docs/content/docs/spaces/guides/install.mdx b/docs/content/docs/spaces/guides/install.mdxindex 9dead8ce87..e584677594 100644--- a/docs/content/docs/spaces/guides/install.mdx+++ b/docs/content/docs/spaces/guides/install.mdx@@ -62,12 +62,12 @@ The first time you open the app, it walks you through a short setup. The| Step | What it does ||---|---|-| A shared Space for every agent | Connects the agents you pick on this computer: any of Claude Code, Codex, Hermes, Cursor, OpenClaw and the others, or none. See [Connect your agent](/spaces/guides/connect-your-agent). |-| Checking your setup | Signs you in to Cua and asks for the two settings your agent needs: to control this computer and to see its screen. Then this computer is your first Space. |-| Try your first request | A request to copy into your agent. It works right away. |-| Give your agent its own Space | Optional: a fresh Linux or macOS computer inside this one, away from your files. |+| Your agents get their own computer | The welcome. |+| Pick your agent | The agents found on this computer, most used first (Hermes, Claude Code, Codex, Cursor, then the rest). Press **Connect** on each one you want; nothing is connected until you do. See [Connect your agent](/spaces/guides/connect-your-agent). |+| Connect your other devices | Optional. Signing in lets your other computers and your cloud reach this computer's Spaces. **Not now** skips it; this computer works without an account. |+| Try it in your agent | A request to paste into the agent you connected, which makes a Space on this computer. With no agent, a first Space in one click: Linux, or macOS on a Mac with Apple silicon. |-If you stop before every step is done, Home keeps a **Finish setting up** list.+If you skip the setup, **Finish setting up** at the bottom of the sidebar opens it again.Cua Spaces launches at login by default, so the Spaces this computer providesand your persistent agents come back after a restart. Turn it off in **Settings,diff --git a/docs/content/docs/spaces/quickstart.mdx b/docs/content/docs/spaces/quickstart.mdxindex c4897a6521..262afd51c6 100644--- a/docs/content/docs/spaces/quickstart.mdx+++ b/docs/content/docs/spaces/quickstart.mdx@@ -22,7 +22,8 @@ this computer your first Space and ask your agent to use it while you watch.- A Mac (macOS 26 or later), a Windows PC (preview) or a Linux PC (Ubuntu 24.04).- An AI coding agent, such as Claude Code, Codex or Cursor. See the[supported agents](/cua-cli/guides/mcp-server#supported-agents).-- A free Cua account. The app asks you to sign in during setup.+- A free Cua account, only to reach this computer from your other computers.+ Everything on this computer works without one.Your computer is your first Space, so there is nothing big to download. An extraSpace is optional: a Linux Space needs a container engine such as Docker, and a@@ -57,58 +58,52 @@ The command installs the `cua` command and the app. You can also download theapp from the [download page](https://cua.ai/download). [Install](/spaces/guides/install)has the details for each system.-## 2. Connect your agent+## 2. Pick your agent-Open Cua Spaces. The first screen says "A shared Space for every agent."+Open Cua Spaces. The first screen says "Your agents get their own computer."+Press **Get started**.-Under **Pick any, or none**, tick the agents you use on this computer: Claude-Code, Codex, Hermes, Cursor, OpenClaw or any other under **More agents**. The-ones installed here are ticked already. Press **Continue**, and the app adds-Cua to each ticked agent's settings. You can also tick none and connect agents-later.+**Pick your agent** lists the agents found on this computer, such as Hermes,+Claude Code, Codex, Cursor or OpenClaw, each with the settings file Cua adds+itself to. Press **Connect** on each one you want to use. Nothing is connected+until you press it, and you can connect more later. Codex also shows its+**ChatGPT sign-in**, and Claude Code and Codex show the provider key they use+in a Space; these stay on this computer.-If your agent was already open, close it and open it again so it loads the new-tools. To connect more agents later, see [Connect your agent](/spaces/guides/connect-your-agent).+No agent found? The screen offers to install one, or to use the `cua` command+in a terminal instead. If your agent was already open, close it and open it+again so it loads the new tools. See [Connect your agent](/spaces/guides/connect-your-agent).-## 3. Make this computer your first Space+## 3. Connect your other devices (optional)-The app checks your setup and shows what's left. These steps use the Mac-wording; on Windows and Linux the app says "this PC" or "this computer". Press the button on each row:+**Sign in to connect** lets your other computers and your cloud reach this+computer's Spaces, after you sign in on them too. The app then adds this+computer to your account by itself. **Not now** skips it: this computer works+without an account, and **Sign in** at the bottom of the sidebar does it later.-1. **Sign in**, then finish signing in to Cua in your browser. The app then- adds this Mac to your account by itself.-2. **Let Cua control this Mac**, so your agent can click and type.-3. **Let Cua see this screen**, so your agent can see what's on it.+## 4. Try it in your agent-Each of the last two opens System Settings. Turn Cua on there; macOS asks you-only once. When every row is done, the app says "Your agent can use this Mac."-This Mac is now your first Space.+The app names the agent you connected and gives you a request to paste into it:-## 4. Try your first request+> Make a Linux Space on this Mac and run my tests there.-Under **Try this in Claude Code**, press **Copy** and paste the request into-your agent:+Press **Copy**, paste it into your agent, and the agent makes the Space itself.+The line under it turns green when your agent has used Cua. On Windows and+Linux the request says "this PC" or "this computer".-> List my computers and tell me what's on this Mac--It works right away, on this Mac. Open Cua Spaces to watch your agent work, and-use the desktop yourself whenever you want to take over.--## 5. Add a Linux Space (optional)--**Give your agent its own Space** offers a fresh computer inside this Mac, away-from your files and your mouse. Choose **Linux** for the quickest one (a Mac can-also make a macOS Space), or choose **No extra Space for now**. The card shows-how long it takes and how much it downloads.--Press **Done** whenever you like. The new Space keeps getting made after the-window closes, shows its progress in the sidebar, and you get a notice when it's+With no agent connected, the screen offers a first Space instead: choose+**Linux** for the quickest one (a Mac with Apple silicon can also make a macOS+Space). The card shows how long it takes and how much it downloads. The Space+keeps getting made after the window closes, and you get a notice when it'sready.+Press **Done** whenever you like. To let your agent control this Mac itself,+open **Computers, This Mac**: it lists the two settings macOS asks for once.+<Callout type="info">- If a step is still open, the button says **Finish later**. Home then keeps a- **Finish setting up** list with the same steps. A Space that fails to create- shows the reason and a **Try again** button. See+ Home's sidebar keeps a **Get started** list (for example "Get started 2/5").+ Open it to see what's left, **Skip** what you don't need, or **Hide** it. A+ Space that fails to create shows the reason and a **Try again** button. See[Troubleshoot](/spaces/guides/troubleshoot).</Callout>diff --git a/libs/cua/crates/cua-spaces-app-core/parity/first-run.json b/libs/cua/crates/cua-spaces-app-core/parity/first-run.jsonindex fcc30909d8..605363cac0 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/first-run.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/first-run.json@@ -1,16 +1,18 @@{"name": "first-run",- "about": "The 0.10.0 first run, one screen state per storyboard frame (v2-01 to v2-09, 16, 17): step 1 picks any agents or none (every agent the setup knows; what is installed per computer, and the agents' own sign-ins and keys, which stay on this computer), then the agent and this computer checked, a first request that works on this computer, the optional extra Space (macOS first, never blocking Done), the plan card after the first success, and Home's to-do list after Finish later. Each case patches the base input; every app draws firstRun.view's words and must say the same.",+ "about": "The agent-first first run, one screen state per storyboard frame: Welcome; Pick your agent (only the agents found here, most preferred first: Hermes, Claude Code, Codex, Cursor, then the rest; one Connect each, none connected by itself, each naming the file it changes; the connected agents' own sign-ins and keys in the same order; nothing found: install an agent or use the CLI); Connect your other devices (optional sign-in: your other computers and your cloud, Not now); and Try it in the lead agent (a request to paste, waiting until the agent used Cua; no agent: a one-click first Space, Linux first, then Omarchy and macOS only where they run and fit). No plan is shown. Home's to-do list after Skip for now treats signing in as optional. Each case patches the base input; every app draws firstRun.view's words and must say the same.","base": {- "step": "setup",+ "step": "welcome","hostOs": "macos","agents": [- { "agent": "claude-code", "name": "Claude Code", "installed": true, "configured": true },- { "agent": "codex", "name": "Codex", "installed": true, "configured": false }+ { "agent": "claude-code", "name": "Claude Code", "installed": true, "configured": false, "mcpConfig": "/Users/ada/.claude.json" },+ { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT", "mcpConfig": "/Users/ada/.codex/config.toml" },+ { "agent": "hermes", "name": "Hermes", "installed": true, "configured": false, "mcpConfig": "/Users/ada/.hermes/config.yaml" },+ { "agent": "cursor", "name": "Cursor", "installed": false, "configured": false, "mcpConfig": "/Users/ada/.cursor/mcp.json" }],- "agent": "claude-code",- "signedIn": true,- "host": { "configured": true, "running": true, "online": true, "permissions": [{ "id": "accessibility", "granted": true }, { "id": "screen-recording", "granted": true }] },+ "keys": { "keys": [{ "provider": "anthropic", "env": "ANTHROPIC_API_KEY", "last4": "1234", "addedMs": 1 }] },+ "signedIn": false,+ "host": null,"offers": [{ "os": "linux", "time": "about 2 min", "size": "1.2 GB download" },{ "os": "macos", "time": "10 to 30 min the first time", "size": "22 GB download" }@@ -19,24 +21,23 @@"plan": { "metered": true, "plan": "free", "sessionsLimit": 2, "hoursLimit": 20, "accountApp": "https://app.cua.ai" }},"cases": [- { "name": "01 agents, nothing changed: the installed ones ticked", "patch": { "step": "connect", "agent": null, "keys": { "keys": [{ "provider": "anthropic", "env": "ANTHROPIC_API_KEY", "last4": "1234", "addedMs": 1 }] } } },- { "name": "01 agents, only Codex installed", "patch": { "step": "connect", "agent": null, "agents": [{ "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT" }] } },- { "name": "01 agents, none picked", "patch": { "step": "connect", "agent": null, "picked": [] } },- { "name": "01 agents, Codex only, signing in", "patch": { "step": "connect", "agent": null, "picked": ["codex"], "agentSigningIn": "codex", "keys": { "keys": [] }, "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": true, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT" }, { "agent": "goose", "name": "Goose", "installed": false, "configured": false }] } },- { "name": "01 agents, several, Claude Code already set up", "patch": { "step": "connect", "agent": null, "picked": ["codex", "hermes"], "connecting": true, "keys": { "keys": [{ "provider": "anthropic", "env": "ANTHROPIC_API_KEY", "last4": "1234", "addedMs": 1 }] }, "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": true, "configured": true }, { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": false, "signIn": "ChatGPT", "signedIn": true }, { "agent": "hermes", "name": "Hermes", "installed": true, "configured": false }] } },- { "name": "02 checking", "patch": { "agents": null, "host": null } },- { "name": "03 ready, choose", "patch": {} },- { "name": "04 ready, creating macOS", "patch": { "extra": { "phase": "creating", "name": "macOS 1", "os": "macos", "detail": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min", "fraction": 0.19 } } },- { "name": "05 restart the agent", "patch": { "agentOpenBeforeSetup": true, "extra": { "phase": "creating", "name": "macOS 1", "os": "macos", "detail": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min", "fraction": 0.19 } }, "todos": true },- { "name": "06 let Cua control this Mac", "patch": { "host": { "configured": true, "running": true, "online": true, "permissions": [{ "id": "accessibility", "granted": false, "settingsUrl": "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" }] } }, "todos": true },- { "name": "07 sign in", "patch": { "signedIn": false, "host": { "configured": false, "running": false, "permissions": [] } }, "todos": true },- { "name": "08 first success, not now", "patch": { "agentUsedAt": "18:12", "extra": { "phase": "not-now" }, "plan": { "metered": true, "plan": "free", "dismissed": true } } },- { "name": "16 first success, Pro card", "patch": { "agentUsedAt": "18:12", "extra": { "phase": "not-now" } } },- { "name": "17 first success, Teams card", "patch": { "agentUsedAt": "18:12", "extra": { "phase": "not-now" }, "plan": { "metered": true, "plan": "free", "teammates": true, "accountApp": "https://app.cua.ai" } } },- { "name": "macOS made, ready", "patch": { "agentUsedAt": "18:12", "extra": { "phase": "ready", "name": "macOS 1", "os": "macos" }, "plan": { "metered": true, "plan": "pro" } }, "todos": true },- { "name": "an Intel Mac: Linux only", "patch": { "offers": [{ "os": "linux", "time": "about 2 min" }, { "os": "macos", "time": "10 to 30 min the first time", "blocked": "This Mac can't run macOS Spaces: they need Apple silicon." }] } },- { "name": "a Windows PC", "patch": { "hostOs": "windows", "host": { "configured": true, "running": true, "online": true, "permissions": [] }, "offers": [{ "os": "linux", "time": "about 2 min" }] } },- { "name": "no agent picked, ready", "patch": { "picked": [] }, "todos": true },- { "name": "two agents picked, one not set up", "patch": { "picked": ["claude-code", "codex"] }, "todos": true }+ { "name": "01 welcome", "patch": {} },+ { "name": "02 pick your agent, nothing connected", "patch": { "step": "connect" } },+ { "name": "03 pick your agent, connecting Hermes", "patch": { "step": "connect", "connecting": true, "connectingAgent": "hermes" } },+ { "name": "04 pick your agent, Codex only, connected, signing in", "patch": { "step": "connect", "picked": ["codex"], "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": false, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": true, "signIn": "ChatGPT", "mcpConfig": "/Users/ada/.codex/config.toml" }], "agentSigningIn": "codex", "keys": { "keys": [] } } },+ { "name": "05 pick your agent, Claude Code and Hermes connected", "patch": { "step": "connect", "picked": ["hermes", "claude-code"] } },+ { "name": "06 pick your agent, none found", "patch": { "step": "connect", "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": false, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": false, "configured": false }] } },+ { "name": "07 pick your agent, still looking", "patch": { "step": "connect", "agents": null } },+ { "name": "08 connect your other devices", "patch": { "step": "devices" } },+ { "name": "09 connect your other devices, signing in", "patch": { "step": "devices", "signingIn": true } },+ { "name": "10 this Mac being added to the account", "patch": { "step": "devices", "signedIn": true, "hostSettingUp": true, "host": { "configured": false, "running": false, "permissions": [] } } },+ { "name": "11 this Mac in the account", "patch": { "step": "devices", "signedIn": true, "host": { "configured": true, "running": true, "online": true, "permissions": [{ "id": "accessibility", "granted": false }] } } },+ { "name": "12 try it in Hermes, waiting", "patch": { "step": "setup", "picked": ["hermes", "claude-code"] } },+ { "name": "13 try it in Hermes, used", "patch": { "step": "setup", "picked": ["hermes", "claude-code"], "agentUsedAt": "18:12" }, "todos": true },+ { "name": "14 try it in Codex on a Windows PC", "patch": { "step": "setup", "hostOs": "windows", "picked": ["codex"], "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": false, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": true, "configured": true, "signIn": "ChatGPT", "mcpConfig": "/Users/ada/.codex/config.toml" }] } },+ { "name": "15 no agent: a first Space", "patch": { "step": "setup", "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": false, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": false, "configured": false }] }, "todos": true },+ { "name": "16 no agent: making macOS", "patch": { "step": "setup", "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": false, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": false, "configured": false }], "extra": { "phase": "creating", "name": "macOS 1", "os": "macos", "detail": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min", "fraction": 0.19 } } },+ { "name": "17 no agent: an Intel Mac, Linux only", "patch": { "step": "setup", "agents": [{ "agent": "claude-code", "name": "Claude Code", "installed": false, "configured": false }, { "agent": "codex", "name": "OpenAI Codex", "installed": false, "configured": false }], "offers": [{ "os": "linux", "time": "about 2 min" }, { "os": "macos", "time": "10 to 30 min the first time", "blocked": "This Mac can't run macOS Spaces: they need Apple silicon." }] } },+ { "name": "18 to-do list, signed in, a permission missing", "patch": { "step": "setup", "picked": ["claude-code"], "signedIn": true, "host": { "configured": true, "running": true, "online": true, "permissions": [{ "id": "accessibility", "granted": false, "settingsUrl": "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" }] } }, "todos": true }]}diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.jsonindex 99692c0a45..fd7c435921 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/first-run.json@@ -2,501 +2,339 @@"flow": "first-run","frames": [{- "art": "claude-code on none",- "case": "01 agents, nothing changed: the installed ones ticked",+ "art": "hermes on none",+ "case": "01 welcome",+ "step": "welcome",+ "welcome": {+ "lede": "Spaces on this Mac, away from your files and your mouse.",+ "primary": "start:Get started",+ "title": "Your agents get their own computer."+ }+ },+ {+ "art": "hermes on outline",+ "case": "02 pick your agent, nothing connected","connect": {- "agents": "On this Mac: [=] Claude Code (Already uses Cua), [x] Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",- "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",- "busy": null,- "connects": "codex",- "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): Anthropic key — For Claude Code in your Spaces [Saved] / OpenAI key — For Codex in your Spaces (add-key:Add key)",- "intro": "Pick any, or none.",- "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",- "more": "More agents: ",+ "agents": [+ "Hermes (~/.hermes/config.yaml) connect:Connect",+ "Claude Code (~/.claude.json) connect:Connect",+ "OpenAI Codex (~/.codex/config.toml) connect:Connect"+ ],+ "alternatives": [],+ "credentials": null,+ "error": null,+ "lede": "Found on this Mac. You can add more later.","primary": "continue:Continue",- "title": "A shared Space for every agent."+ "secondary": "skip:Skip",+ "title": "Pick your agent."},"step": "connect"},{- "art": "codex on none",- "case": "01 agents, only Codex installed",+ "art": "hermes on outline",+ "case": "03 pick your agent, connecting Hermes","connect": {- "agents": "On this Mac: [ ] Claude Code, [x] OpenAI Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",- "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",- "busy": null,- "connects": "codex",- "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): ChatGPT sign-in — OpenAI Codex uses it on this Mac (agent-sign-in:Sign in)",- "intro": "Pick any, or none.",- "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",- "more": "More agents: ",+ "agents": [+ "Hermes (~/.hermes/config.yaml) [Adding Cua…]",+ "Claude Code (~/.claude.json) connect:Connect",+ "OpenAI Codex (~/.codex/config.toml) connect:Connect"+ ],+ "alternatives": [],+ "credentials": null,+ "error": null,+ "lede": "Found on this Mac. You can add more later.","primary": "continue:Continue",- "title": "A shared Space for every agent."+ "secondary": "skip:Skip",+ "title": "Pick your agent."},"step": "connect"},{- "art": "claude-code on none",- "case": "01 agents, none picked",+ "art": "codex on outline",+ "case": "04 pick your agent, Codex only, connected, signing in","connect": {- "agents": "On this Mac: [=] Claude Code (Already uses Cua), [ ] Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",- "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",- "busy": null,- "connects": "",- "credentials": null,- "intro": "Pick any, or none.",- "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",- "more": "More agents: ",+ "agents": [+ "OpenAI Codex (~/.codex/config.toml) [Connected]"+ ],+ "alternatives": [],+ "credentials": "They stay on this Mac.: ChatGPT sign-in — OpenAI Codex uses it on this Mac [Finish in your browser…] / OpenAI key — For OpenAI Codex in your Spaces (add-key:Add key)",+ "error": null,+ "lede": "Found on this Mac. You can add more later.","primary": "continue:Continue",- "title": "A shared Space for every agent."+ "secondary": "",+ "title": "Pick your agent."},"step": "connect"},{- "art": "codex on none",- "case": "01 agents, Codex only, signing in",+ "art": "hermes on outline",+ "case": "05 pick your agent, Claude Code and Hermes connected","connect": {- "agents": "On this Mac: [ ] Claude Code, [x] OpenAI Codex, [ ] Hermes, [ ] Cursor, [ ] OpenClaw",- "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",- "busy": null,- "connects": "codex",- "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): ChatGPT sign-in — OpenAI Codex uses it on this Mac [Finish in your browser…] / OpenAI key — For OpenAI Codex in your Spaces (add-key:Add key)",- "intro": "Pick any, or none.",- "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",- "more": "More agents: [ ] Goose (Not found on this Mac)",+ "agents": [+ "Hermes (~/.hermes/config.yaml) [Connected]",+ "Claude Code (~/.claude.json) [Connected]",+ "OpenAI Codex (~/.codex/config.toml) connect:Connect"+ ],+ "alternatives": [],+ "credentials": "They stay on this Mac.: Anthropic key — For Claude Code in your Spaces [Saved]",+ "error": null,+ "lede": "Found on this Mac. You can add more later.","primary": "continue:Continue",- "title": "A shared Space for every agent."+ "secondary": "",+ "title": "Pick your agent."},"step": "connect"},{- "art": "codex on none",- "case": "01 agents, several, Claude Code already set up",+ "art": "other on outline",+ "case": "06 pick your agent, none found","connect": {- "agents": "On this Mac: [=] Claude Code (Already uses Cua), [x] OpenAI Codex, [x] Hermes, [ ] Cursor, [ ] OpenClaw",- "agentsNote": "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own.",- "busy": "Adding Cua to OpenAI Codex and Hermes…",- "connects": "codex, hermes",- "credentials": "Sign-ins and keys (They stay on this Mac. Other computers keep their own.): ChatGPT sign-in — OpenAI Codex uses it on this Mac [Signed in] / Anthropic key — For Claude Code in your Spaces [Saved] / OpenAI key — For OpenAI Codex in your Spaces (add-key:Add key)",- "intro": "Pick any, or none.",- "lede": "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on this Mac.",- "more": "More agents: ",+ "agents": [],+ "alternatives": [+ "install: Install an agent — Hermes, Claude Code, OpenAI Codex or Cursor, then come back here. <https://cua.ai/docs/spaces/guides/connect-your-agent>",+ "cli: Use the CLI — Make a Space on this Mac from a terminal. `cua spaces create linux`"+ ],+ "credentials": null,+ "error": null,+ "lede": "No agents found on this Mac.","primary": "continue:Continue",- "title": "A shared Space for every agent."+ "secondary": "skip:Skip",+ "title": "Connect an agent."},"step": "connect"},{- "art": "claude-code faded outline",- "case": "02 checking",- "setup": {- "extra": {- "action": "not-now:Not now",- "choices": [- "macOS: 22 GB download · 10 to 30 min the first time",- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"- },- "primary": "done:Done (off)",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",+ "art": "other on outline",+ "case": "07 pick your agent, still looking",+ "connect": {+ "agents": [],+ "alternatives": [],+ "credentials": null,+ "error": null,+ "lede": "Looking for agents on this Mac…",+ "primary": "continue:Continue",+ "secondary": "skip:Skip",+ "title": "Pick your agent."+ },+ "step": "connect"+ },+ {+ "art": "hermes on outline",+ "case": "08 connect your other devices",+ "devices": {+ "lede": "Sign in once, and your other computers reach this Mac's Spaces.",+ "note": "This Mac works without it.",+ "primary": "sign-in:Sign in to connect","rows": [- "[checking] Claude Code — Checking that it can use Cua…",- "[checking] This Mac — Checking that your agent can use it…"+ "Your other computers — They join this Mac's pool",+ "Your cloud — Hetzner, AWS, Google Cloud or Modal"],- "title": "Checking your setup.",- "upsell": null+ "secondary": "not-now:Not now",+ "status": null,+ "title": "Connect your other devices."},- "step": "setup"+ "step": "devices"},{- "art": "claude-code on outline",- "case": "03 ready, choose",- "setup": {- "extra": {- "action": "not-now:Not now",- "choices": [- "macOS: 22 GB download · 10 to 30 min the first time",- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"- },- "primary": "done:Done",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",+ "art": "hermes on outline",+ "case": "09 connect your other devices, signing in",+ "devices": {+ "lede": "Sign in once, and your other computers reach this Mac's Spaces.",+ "note": "This Mac works without it.",+ "primary": "sign-in:Sign in to connect","rows": [- "[ok] Claude Code can use Cua — We added Cua to Claude Code's settings. If Claude Code was already open, restart it.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."+ "Your other computers — They join this Mac's pool",+ "Your cloud — Hetzner, AWS, Google Cloud or Modal"],- "title": "Your agent can use this Mac.",- "upsell": null+ "secondary": "not-now:Not now",+ "status": "[checking] Signing in — Finish signing in to Cua in your browser.",+ "title": "Connect your other devices."},- "step": "setup"+ "step": "devices"},{- "art": "claude-code on filling",- "case": "04 ready, creating macOS",- "setup": {- "extra": {- "action": "cancel:Cancel",- "choices": [],- "footnote": "You can press Done now. We'll let you know when it's ready.",- "note": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min",- "phase": "creating",- "title": "Making macOS 1 in the background"- },- "primary": "done:Done",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",+ "art": "hermes on outline",+ "case": "10 this Mac being added to the account",+ "devices": {+ "lede": "Sign in on your other computers, and they reach its Spaces.",+ "note": null,+ "primary": "continue:Continue","rows": [- "[ok] Claude Code can use Cua — We added Cua to Claude Code's settings. If Claude Code was already open, restart it.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."+ "Your other computers — They join this Mac's pool",+ "Your cloud — Hetzner, AWS, Google Cloud or Modal"],- "title": "Your agent can use this Mac.",- "upsell": null+ "secondary": "",+ "status": "[checking] Adding this Mac — It takes a few seconds.",+ "title": "Adding this Mac to your account."},- "step": "setup"+ "step": "devices"},{- "art": "claude-code on filling",- "case": "05 restart the agent",- "setup": {- "extra": {- "action": "cancel:Cancel",- "choices": [],- "footnote": "You can press Done now. We'll let you know when it's ready.",- "note": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min",- "phase": "creating",- "title": "Making macOS 1 in the background"- },- "primary": "finish-later:Finish later",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",+ "art": "hermes on outline",+ "case": "11 this Mac in the account",+ "devices": {+ "lede": "Sign in on your other computers, and they reach its Spaces.",+ "note": null,+ "primary": "continue:Continue","rows": [- "[fix] Restart Claude Code — It was open when we added Cua. Close it, then open it again. (restart-check:Check again)",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."+ "Your other computers — They join this Mac's pool",+ "Your cloud — Hetzner, AWS, Google Cloud or Modal"],- "title": "One step left.",- "upsell": null+ "secondary": "",+ "status": "[ok] This Mac is in your account — Your other computers can reach its Spaces.",+ "title": "This Mac is in your account."},- "step": "setup",- "todos": {- "complete": false,- "items": [- "[ ] Restart Claude Code — It was open when we added Cua. Close it, then open it again. (restart-check:Check again)",- "[x] Make this Mac your first Space — Ready now. Your agent can see the screen, click and type.",- "[ ] Try your first request — Ask Claude Code: “List my computers and tell me what's on this Mac” (copy:Copy)",- "[x] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse.",- "[x] Sign in — Signed in to Cua."- ],- "lede": "A couple of things are left.",- "progress": "3 of 5 done"- }+ "step": "devices"},{- "art": "claude-code faded outline",- "case": "06 let Cua control this Mac",+ "art": "hermes on outline",+ "case": "12 try it in Hermes, waiting","setup": {- "extra": {- "action": "not-now:Not now",- "choices": [- "macOS: 22 GB download · 10 to 30 min the first time",- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"- },- "primary": "finish-later:Finish later",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",- "rows": [- "[ok] Claude Code can use Cua — We added Cua to Claude Code's settings. If Claude Code was already open, restart it.",- "[fix] Let Cua control this Mac — So your agent can click and type. macOS asks you once. (open-settings:Open Settings)"- ],- "title": "One step left.",- "upsell": null+ "extra": null,+ "lede": "Paste this. Hermes makes the Space itself.",+ "primary": "done:Done",+ "prompt": "Paste this in Hermes: Make a Linux Space on this Mac and run my tests there. / It runs on this Mac.",+ "status": "[checking] Waiting for Hermes… — If Hermes was already open, restart it.",+ "title": "Try it in Hermes."},- "step": "setup",- "todos": {- "complete": false,- "items": [- "[x] Connect Claude Code — Claude Code can use Cua.",- "[ ] Let Cua control this Mac — So your agent can click and type. macOS asks you once. (open-settings:Open Settings)",- "[ ] Try your first request — Ask Claude Code: “List my computers and tell me what's on this Mac” (copy:Copy)",- "[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",- "[x] Sign in — Signed in to Cua."- ],- "lede": "Claude Code is connected. A couple of things are left.",- "progress": "2 of 5 done"- }+ "step": "setup"},{- "art": "claude-code faded outline",- "case": "07 sign in",+ "art": "hermes on on",+ "case": "13 try it in Hermes, used","setup": {- "extra": {- "action": "not-now:Not now",- "choices": [- "macOS: 22 GB download · 10 to 30 min the first time",- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"- },- "primary": "finish-later:Finish later",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",- "rows": [- "[ok] Claude Code can use Cua — We added Cua to Claude Code's settings. If Claude Code was already open, restart it.",- "[fix] Sign in to Cua — So your agent can find this Mac and your other computers. (sign-in:Sign in)"- ],- "title": "One step left.",- "upsell": null+ "extra": null,+ "lede": "Paste this. Hermes makes the Space itself.",+ "primary": "done:Done",+ "prompt": "Paste this in Hermes: Make a Linux Space on this Mac and run my tests there. / It runs on this Mac.",+ "status": "[ok] Hermes used Cua at 18:12. — Ask it anything else.",+ "title": "Try it in Hermes."},"step": "setup","todos": {"complete": false,"items": [- "[x] Connect Claude Code — Claude Code can use Cua.",+ "[ ] Connect Hermes and Claude Code — Cua isn't in Hermes and Claude Code's settings yet. (connect:Connect)","[ ] Make this Mac your first Space — After you sign in.",- "[ ] Try your first request — Ask Claude Code: “List my computers and tell me what's on this Mac” (copy:Copy)",+ "[x] Try your first request — Ask Hermes or Claude Code: “Make a Linux Space on this Mac and run my tests there.”","[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",- "[ ] Sign in — So your agent can find this Mac and your other computers. (sign-in:Sign in)"+ "[ ] Connect your other devices (optional) — Sign in, and your other computers reach this Mac's Spaces. (sign-in:Sign in)"],- "lede": "Claude Code is connected. A couple of things are left.",+ "lede": "One thing is left.","progress": "1 of 5 done"}},{- "art": "claude-code on none",- "case": "08 first success, not now",+ "art": "codex on outline",+ "case": "14 try it in Codex on a Windows PC","setup": {- "extra": {- "action": "add:Add a Space",- "choices": [],- "footnote": null,- "note": "Add one from Home whenever you like.",- "phase": "not-now",- "title": "No extra Space for now"- },+ "extra": null,+ "lede": "Paste this. OpenAI Codex makes the Space itself.","primary": "done:Done",- "prompt": "You asked Claude Code: List my computers and tell me what's on this Mac / It answered in Claude Code. Ask it anything else.",- "rows": [- "[ok] Claude Code can use Cua — It used Cua at 18:12.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "Your agent can use this Mac.",- "upsell": null+ "prompt": "Paste this in OpenAI Codex: Make a Linux Space on this PC and run my tests there. / It runs on this PC.",+ "status": "[checking] Waiting for OpenAI Codex… — If OpenAI Codex was already open, restart it.",+ "title": "Try it in OpenAI Codex."},"step": "setup"},{- "art": "claude-code on none",- "case": "16 first success, Pro card",- "setup": {- "extra": {- "action": "add:Add a Space",- "choices": [],- "footnote": null,- "note": "Add one from Home whenever you like.",- "phase": "not-now",- "title": "No extra Space for now"- },- "primary": "done:Done",- "prompt": "You asked Claude Code: List my computers and tell me what's on this Mac / It answered in Claude Code. Ask it anything else.",- "rows": [- "[ok] Claude Code can use Cua — It used Cua at 18:12.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "Your agent can use this Mac.",- "upsell": "pro | More remote hours with Pro | Free: 20 remote hours a month · 2 connections at once / Pro: 200 remote hours a month · 5 connections at once | $18 a month | upsell:Try Pro"- },- "step": "setup"- },- {- "art": "claude-code on none",- "case": "17 first success, Teams card",- "setup": {- "extra": {- "action": "add:Add a Space",- "choices": [],- "footnote": null,- "note": "Add one from Home whenever you like.",- "phase": "not-now",- "title": "No extra Space for now"- },- "primary": "done:Done",- "prompt": "You asked Claude Code: List my computers and tell me what's on this Mac / It answered in Claude Code. Ask it anything else.",- "rows": [- "[ok] Claude Code can use Cua — It used Cua at 18:12.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "Your agent can use this Mac.",- "upsell": "teams | Working with others? | Teams gives your team computers you share, with roles and device approval. | $30 per person a month, starting at 1 | upsell:Start Teams"- },- "step": "setup"- },- {- "art": "claude-code on on",- "case": "macOS made, ready",+ "art": "other on outline",+ "case": "15 no agent: a first Space","setup": {"extra": {- "action": "",- "choices": [],+ "action": "not-now:Not now",+ "choices": [+ "linux Linux: Ready in about 2 min",+ "macos macOS: 22 GB download · 10 to 30 min the first time"+ ],"footnote": null,- "note": "A fresh macOS computer inside this Mac. Your agent can use it now.",- "phase": "ready",- "title": "macOS 1 is ready"+ "note": "A fresh computer inside this Mac. One click starts it.",+ "phase": "choose",+ "title": "Make a first Space"},+ "lede": "Spaces run on this Mac, away from your files and your mouse.","primary": "done:Done",- "prompt": "You asked Claude Code: List my computers and tell me what's on this Mac / It answered in Claude Code. Ask it anything else.",- "rows": [- "[ok] Claude Code can use Cua — It used Cua at 18:12.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "Your agent can use this Mac.",- "upsell": null+ "prompt": null,+ "status": null,+ "title": "Try a first Space."},"step": "setup","todos": {"complete": true,"items": [- "[x] Connect Claude Code — Claude Code can use Cua.",- "[x] Make this Mac your first Space — Ready now. Your agent can see the screen, click and type.",- "[x] Try your first request — Ask Claude Code: “List my computers and tell me what's on this Mac”",- "[x] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse.",- "[x] Sign in — Signed in to Cua."+ "[ ] Make this Mac your first Space — After you sign in.",+ "[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",+ "[ ] Connect your other devices (optional) — Sign in, and your other computers reach this Mac's Spaces. (sign-in:Sign in)"],- "lede": "Claude Code is connected. You're all set.",- "progress": "5 of 5 done"+ "lede": "You're all set.",+ "progress": "0 of 3 done"}},{- "art": "claude-code on outline",- "case": "an Intel Mac: Linux only",+ "art": "other on filling",+ "case": "16 no agent: making macOS","setup": {"extra": {- "action": "not-now:Not now",- "choices": [- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"- },- "primary": "done:Done",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this Mac / This works now, on this Mac.",- "rows": [- "[ok] Claude Code can use Cua — We added Cua to Claude Code's settings. If Claude Code was already open, restart it.",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "Your agent can use this Mac.",- "upsell": null- },- "step": "setup"- },- {- "art": "claude-code on outline",- "case": "a Windows PC",- "setup": {- "extra": {- "action": "not-now:Not now",- "choices": [- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this PC, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"+ "action": "cancel:Cancel",+ "choices": [],+ "footnote": "You can press Done now. We'll let you know when it's ready.",+ "note": "Downloading macOS · 4.2 of 22.3 GB · 85 MB/s · about 4 min",+ "phase": "creating",+ "title": "Making macOS 1 in the background"},+ "lede": "Spaces run on this Mac, away from your files and your mouse.","primary": "done:Done",- "prompt": "Try this in Claude Code: List my computers and tell me what's on this PC / This works now, on this PC.",- "rows": [- "[ok] Claude Code can use Cua — We added Cua to Claude Code's settings. If Claude Code was already open, restart it.",- "[ok] This PC is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "Your agent can use this PC.",- "upsell": null+ "prompt": null,+ "status": null,+ "title": "Try a first Space."},"step": "setup"},{"art": "other on outline",- "case": "no agent picked, ready",+ "case": "17 no agent: an Intel Mac, Linux only","setup": {"extra": {"action": "not-now:Not now","choices": [- "macOS: 22 GB download · 10 to 30 min the first time",- "Linux: Ready in about 2 min"+ "linux Linux: Ready in about 2 min"],"footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",+ "note": "A fresh computer inside this Mac. One click starts it.","phase": "choose",- "title": "Give your agent its own Space"+ "title": "Make a first Space"},+ "lede": "Spaces run on this Mac, away from your files and your mouse.","primary": "done:Done","prompt": null,- "rows": [- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "This Mac is ready.",- "upsell": null+ "status": null,+ "title": "Try a first Space."},- "step": "setup",- "todos": {- "complete": true,- "items": [- "[x] Make this Mac your first Space — Ready now. Your agent can see the screen, click and type.",- "[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",- "[x] Sign in — Signed in to Cua."- ],- "lede": "You're all set.",- "progress": "2 of 3 done"- }+ "step": "setup"},{"art": "claude-code on outline",- "case": "two agents picked, one not set up",+ "case": "18 to-do list, signed in, a permission missing","setup": {- "extra": {- "action": "not-now:Not now",- "choices": [- "macOS: 22 GB download · 10 to 30 min the first time",- "Linux: Ready in about 2 min"- ],- "footnote": null,- "note": "A fresh computer inside this Mac, so your agent can't touch your files or your mouse.",- "phase": "choose",- "title": "Give your agent its own Space"- },- "primary": "finish-later:Finish later",- "prompt": "Try this in Claude Code or Codex: List my computers and tell me what's on this Mac / This works now, on this Mac.",- "rows": [- "[fix] Connect Codex — Cua isn't in Codex's settings yet. (connect:Connect)",- "[ok] This Mac is your first Space — Ready now. Your agent can see the screen, click and type."- ],- "title": "One step left.",- "upsell": null+ "extra": null,+ "lede": "Paste this. Claude Code makes the Space itself.",+ "primary": "done:Done",+ "prompt": "Paste this in Claude Code: Make a Linux Space on this Mac and run my tests there. / It runs on this Mac.",+ "status": "[checking] Waiting for Claude Code… — If Claude Code was already open, restart it.",+ "title": "Try it in Claude Code."},"step": "setup","todos": {"complete": false,"items": [- "[ ] Connect Codex — Cua isn't in Codex's settings yet. (connect:Connect)",- "[x] Make this Mac your first Space — Ready now. Your agent can see the screen, click and type.",- "[ ] Try your first request — Ask Claude Code or Codex: “List my computers and tell me what's on this Mac” (copy:Copy)",+ "[ ] Connect Claude Code — Cua isn't in Claude Code's settings yet. (connect:Connect)",+ "[ ] Let Cua control this Mac — So your agent can click and type. macOS asks you once. (open-settings:Open Settings)",+ "[ ] Try your first request — Ask Claude Code: “Make a Linux Space on this Mac and run my tests there.” (copy:Copy)","[ ] Give your agent its own Space (optional) — A fresh computer inside this Mac, away from your files and your mouse. (add:Add a Space)",- "[x] Sign in — Signed in to Cua."+ "[x] Connect your other devices (optional) — Signed in to Cua."],"lede": "A couple of things are left.",- "progress": "2 of 5 done"+ "progress": "1 of 5 done"}}]diff --git a/libs/cua/crates/cua-spaces-app-core/src/checklist.rs b/libs/cua/crates/cua-spaces-app-core/src/checklist.rsindex 7f28901090..532d06e479 100644--- a/libs/cua/crates/cua-spaces-app-core/src/checklist.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/checklist.rs@@ -105,6 +105,11 @@ pub struct ChecklistState {/// It was on screen once (`checklist_shown` was recorded).#[serde(default)]pub shown: bool,+ /// Steps skipped ("Skip"), each once, in checklist order: they count as+ /// done for the progress and for `complete`, and a skipped step done+ /// later shows as done.+ #[serde(default)]+ pub skipped: Vec<ChecklistStep>,}/// Something that happened to the checklist.@@ -122,7 +127,12 @@ pub enum ChecklistAction {},/// The checklist is on screen.Shown,- /// Closed with ×.+ /// "Skip" on a step: not for this person; it counts as done.+ Skip {+ /// The step.+ step: ChecklistStep,+ },+ /// Closed with × ("Hide", or "Done" once complete).Dismiss,/// Getting Started (the palette, the Help menu): open it again.Reopen,@@ -211,6 +221,8 @@ pub struct ChecklistRow {pub action: String,/// Done (ticked, struck through).pub done: bool,+ /// Skipped (struck through, not ticked); never with `done`.+ pub skipped: bool,}/// The checklist as drawn.@@ -229,6 +241,10 @@ pub struct ChecklistView {pub progress: String,/// The close button's accessibility label.pub close_label: String,+ /// "Skip", on each step not done or skipped.+ pub skip_label: String,+ /// "Hide", or "Done" once complete: closes the checklist.+ pub hide_label: String,/// The steps in order.pub rows: Vec<ChecklistRow>,}@@ -237,9 +253,18 @@ fn is_done(state: &ChecklistState, step: ChecklistStep) -> bool {state.done.contains(&step)}-/// Every step done.+fn is_skipped(state: &ChecklistState, step: ChecklistStep) -> bool {+ state.skipped.contains(&step)+}++/// Done or skipped: what the progress counts.+fn is_settled(state: &ChecklistState, step: ChecklistStep) -> bool {+ is_done(state, step) || is_skipped(state, step)+}++/// Every step done or skipped.pub fn complete(state: &ChecklistState) -> bool {- STEPS.iter().all(|s| is_done(state, *s))+ STEPS.iter().all(|s| is_settled(state, *s))}fn signals(events: &[&str]) -> Vec<TelemetrySignal> {@@ -311,9 +336,36 @@ pub fn reduce(state: &ChecklistState, action: &ChecklistAction) -> ChecklistTran.collect(),dismissed: state.dismissed || other.dismissed,shown: state.shown || other.shown,+ skipped: STEPS+ .iter()+ .copied()+ .filter(|s| is_skipped(state, *s) || is_skipped(other, *s))+ .collect(),},signals: vec![],},+ ChecklistAction::Skip { step } => {+ if is_settled(state, *step) {+ return same();+ }+ let mut next = state.clone();+ next.skipped = STEPS+ .iter()+ .copied()+ .filter(|s| is_skipped(state, *s) || s == step)+ .collect();+ // A skip records no step of its own; the last one to settle+ // still completes the checklist.+ let signals = if complete(&next) {+ signals(&["completed"])+ } else {+ vec![]+ };+ ChecklistTransition {+ state: next,+ signals,+ }+ }ChecklistAction::Shown if !state.shown => ChecklistTransition {state: ChecklistState {shown: true,@@ -341,7 +393,7 @@ pub fn reduce(state: &ChecklistState, action: &ChecklistAction) -> ChecklistTran/// The checklist as drawn.pub fn view(state: &ChecklistState) -> ChecklistView {let complete = complete(state);- let count = STEPS.iter().filter(|s| is_done(state, **s)).count();+ let count = STEPS.iter().filter(|s| is_settled(state, **s)).count();ChecklistView {visible: !state.dismissed,complete,@@ -359,6 +411,8 @@ pub fn view(state: &ChecklistState) -> ChecklistView {.into(),progress: format!("{count} of {}", STEPS.len()),close_label: "Close getting started".into(),+ skip_label: "Skip".into(),+ hide_label: if complete { "Done" } else { "Hide" }.into(),rows: STEPS.iter().map(|&step| {@@ -369,6 +423,7 @@ pub fn view(state: &ChecklistState) -> ChecklistView {detail: detail.into(),action: action.into(),done: is_done(state, step),+ skipped: is_skipped(state, step) && !is_done(state, step),}}).collect(),@@ -638,7 +693,8 @@ mod tests {ChecklistState {done: vec![ChecklistStep::Share, ChecklistStep::AddMachine],dismissed: true,- shown: false+ shown: false,+ skipped: vec![],});let a: ChecklistAction = serde_json::from_str(@@ -654,4 +710,93 @@ mod tests {});}++ #[test]+ fn a_skipped_step_counts_as_done_and_is_kept() {+ let skip = |s: &ChecklistState, step| reduce(s, &ChecklistAction::Skip { step });+ let mut state = ChecklistState {+ done: vec![ChecklistStep::AddMachine, ChecklistStep::CreateSpace],+ ..Default::default()+ };+ let t = skip(&state, ChecklistStep::Teleport);+ assert!(t.signals.is_empty(), "a skip records no step");+ state = t.state;+ assert_eq!(state.skipped, [ChecklistStep::Teleport]);+ let v = view(&state);+ assert_eq!(v.progress, "3 of 5");+ let teleport = v+ .rows+ .iter()+ .find(|r| r.step == ChecklistStep::Teleport)+ .unwrap();+ assert!(teleport.skipped && !teleport.done);+ assert_eq!(+ (v.skip_label.as_str(), v.hide_label.as_str()),+ ("Skip", "Hide")+ );+ // Skipping again, or skipping a done step, changes nothing.+ assert_eq!(skip(&state, ChecklistStep::Teleport).state, state);+ assert_eq!(skip(&state, ChecklistStep::AddMachine).state, state);+ // Kept as the hosts store it, and read back.+ let json = serde_json::to_value(&state).unwrap();+ assert_eq!(json["skipped"], serde_json::json!(["teleport"]));+ assert_eq!(+ serde_json::from_value::<ChecklistState>(json).unwrap(),+ state+ );+ // The last one settled completes it, whether done or skipped.+ state = skip(&state, ChecklistStep::Share).state;+ let t = reduce(+ &state,+ &ChecklistAction::Done {+ step: ChecklistStep::RunAgent,+ },+ );+ assert_eq!(events(&t), ["checklist_run_agent", "checklist_completed"]);+ let v = view(&t.state);+ assert!(v.complete);+ assert_eq!(+ (v.progress.as_str(), v.hide_label.as_str()),+ ("5 of 5", "Done")+ );+ // A skipped step done later shows as done.+ let t = reduce(+ &t.state,+ &ChecklistAction::Done {+ step: ChecklistStep::Teleport,+ },+ );+ let row = view(&t.state)+ .rows+ .into_iter()+ .find(|r| r.step == ChecklistStep::Teleport)+ .unwrap();+ assert!(row.done && !row.skipped);+ }++ #[test]+ fn merging_keeps_both_copies_skips() {+ let here = ChecklistState {+ skipped: vec![ChecklistStep::Share],+ ..Default::default()+ };+ let there = ChecklistState {+ skipped: vec![ChecklistStep::Teleport],+ ..Default::default()+ };+ let t = reduce(&here, &ChecklistAction::Merge { state: there });+ assert_eq!(+ t.state.skipped,+ [ChecklistStep::Teleport, ChecklistStep::Share]+ );+ // An older copy without skips keeps this one's.+ let old: ChecklistState = serde_json::from_str(r#"{"done":["share"]}"#).unwrap();+ assert!(old.skipped.is_empty());+ assert_eq!(+ reduce(&here, &ChecklistAction::Merge { state: old })+ .state+ .skipped,+ [ChecklistStep::Share]+ );+ }}diff --git a/libs/cua/crates/cua-spaces-app-core/src/first_run.rs b/libs/cua/crates/cua-spaces-app-core/src/first_run.rsindex 65b097a87a..f3cf1f76db 100644--- a/libs/cua/crates/cua-spaces-app-core/src/first_run.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/first_run.rs@@ -1,75 +1,96 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.-//! The first run every app shows (0.10.0): two screens.+//! The first run every app shows: four short screens, agent first.//!-//! 1. **Agents.** Pick any, or none: a checkbox for every agent the setup-//! knows (the common ones and the ones on this computer first, the rest-//! under "More agents"), ticked for the ones installed here. Under it,-//! the agents' own sign-ins and keys. Both are per computer, and the page-//! says so: Cua's skills and MCP server go into each picked agent's-//! settings on this computer only, the ChatGPT sign-in Codex uses is-//! Codex's own file on this computer (`codex login`), and provider keys-//! stay in this computer's credential vault (`agent_keys`). Nothing here-//! follows the Cua account to another computer.-//! 2. **Your agent can use this Mac.** Two checked rows, the agent and this-//! computer, then a first request that works on this computer now. This-//! computer is the user's first Space and is ready at once; an extra-//! Space (a fresh macOS or Linux computer inside this one) is an-//! optional card that never blocks Done. A fix that is left moves to the-//! to-do list on Home ("Finish later").+//! 1. **Welcome.** "Your agents get their own computer." One button.+//! 2. **Pick your agent.** The agents found on this computer, in the order+//! [`PREFERENCE`] gives (Hermes, Claude Code, Codex, Cursor, then the+//! rest), one Connect each. Nothing is connected until its button is+//! pressed, and each row names the file Cua changes. The connected+//! agents' own sign-ins and keys follow, in the same order. Nothing+//! found: install an agent, or use the CLI.+//! 3. **Connect your other devices** (optional). Signing in lets your other+//! computers and your cloud reach this computer's Spaces. "Not now" skips+//! it: this computer works without an account.+//! 4. **Try it in your agent.** A first request for the lead connected agent+//! (read-only, with Copy) that makes a Space on this computer, and a line+//! that turns green when the agent used Cua. No agent: a one-click first+//! Space instead.//!-//! The words, which row needs what, and when Done is on are decided here, so-//! every app says the same thing. The page gathers the readings (the agent-//! setup, `host.status`, the sign-in, the create progress) and draws what-//! [`view`] returns; it decides nothing.+//! Nothing starts or connects by itself, permissions are asked where a task+//! needs them (not here), and no plan is shown. The words, the order and+//! which button does what are decided here, so every app says the same+//! thing; the page gathers the readings and draws what [`view`] returns.//!//! What each reading is, and how real it is://!//! * **"Cua is in the agent's settings"**: the agent setup reports the//! agent `configured` (its MCP config and skills are in place). Real.-//! * **"The open agent session reloaded"**: an agent session that was open-//! when its settings changed only sees Cua after a restart. No process-//! check exists yet, so [`FirstRunInput::agent_open_before_setup`] is-//! `None` today and the row only tells the user to restart it if it was-//! open. Once the agent *uses* Cua (the next point), the session has-//! reloaded for certain and the advice goes away.//! * **"The agent used Cua"**: a connection in this computer's access log-//! since the setup screen opened ([`agent_used`]). Partly real: the-//! host logs only some calls, and an agent names itself.-//! * **This computer**: `host.status` (`configured`, the service running,-//! online, every permission granted) and the app's sign-in. Real.+//! since the try screen opened ([`agent_used`]). Partly real: the host+//! logs only some calls, and an agent names itself.+//! * **This computer in your account**: the app's sign-in and `host.status`.+//! Real.use serde::{Deserialize, Serialize};use crate::relay_usage::{BUY_PRO_PATH, BUY_TEAMS_PATH, PRO_HOURS, PRO_SESSIONS, buy, plan_kind};-/// The agents the access log tells apart by name (setup ids).-pub const OFFERED: [&str; 4] = ["claude-code", "codex", "hermes", "openclaw"];+/// The agents the first run leads with, most preferred first (setup ids).+/// The first one found on this computer names the first request and the+/// art; any other agent the setup knows comes after these, in its order.+pub const PREFERENCE: [&str; 5] = ["hermes", "claude-code", "codex", "cursor", "openclaw"];-/// The agents step 1 always lists first, in order (setup ids). Any other-/// agent the setup knows is listed too: beside these when it is installed-/// or ticked, else under "More agents".-pub const FEATURED: [&str; 5] = ["claude-code", "codex", "hermes", "cursor", "openclaw"];+/// The agents the access log tells apart by name (setup ids).+pub const OFFERED: [&str; 5] = PREFERENCE;/// The provider key each agent's runs in a Space read (`agent_keys`'-/// providers), for the keys step 1 lists under the picked agents.+/// providers), for the keys listed under the connected agents.const AGENT_KEYS: [(&str, &str); 2] = [("claude-code", "anthropic"), ("codex", "openai")];-/// The first request: it works on this computer with nothing else set up.+/// Home's to-do request: it works on this computer with nothing else set up.pub const FIRST_PROMPT: &str = "List my computers and tell me what's on this Mac";const FIRST_PROMPT_OTHER: &str = "List my computers and tell me what's on this computer";const FIRST_PROMPT_PC: &str = "List my computers and tell me what's on this PC";-/// The two screens.+/// The try screen's request: the agent makes a Space on this computer.+pub const TRY_PROMPT: &str = "Make a Linux Space on this Mac and run my tests there.";+const TRY_PROMPT_OTHER: &str = "Make a Linux Space on this computer and run my tests there.";+const TRY_PROMPT_PC: &str = "Make a Linux Space on this PC and run my tests there.";++/// The same first Space from a terminal (no agent found).+pub const CLI_FIRST_SPACE: &str = "cua spaces create linux";++/// Where to get an agent (none found).+pub const AGENTS_GUIDE_URL: &str = "https://cua.ai/docs/spaces/guides/connect-your-agent";++/// The four screens. `connect` and `setup` keep their old names, so a run+/// saved by an older app resumes on the matching screen.#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "kebab-case")]pub enum FirstRunStep {#[default]+ Welcome,+ /// Pick your agent.Connect,+ /// Connect your other devices.+ Devices,+ /// Try it in your agent.Setup,}+impl FirstRunStep {+ fn index(self) -> u8 {+ match self {+ FirstRunStep::Welcome => 0,+ FirstRunStep::Connect => 1,+ FirstRunStep::Devices => 2,+ FirstRunStep::Setup => 3,+ }+ }+}+/// An agent the setup knows (`agents.setup`'s row, trimmed).#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase", default)]@@ -84,6 +105,9 @@ pub struct FirstRunAgent {pub sign_in: Option<String>,/// That sign-in is on this computer.pub signed_in: bool,+ /// The settings file Cua adds itself to (`~/.claude.json`), when the+ /// agent has one.+ pub mcp_config: Option<String>,}/// A permission this computer still needs (`host.status`'s hint).@@ -111,12 +135,15 @@ pub struct FirstRunHost {pub error: Option<String>,}-/// An extra Space this computer can make in one click (the Spaces page's+/// A first Space this computer can make in one click (the Spaces page's/// one-click offer, `firstSpaceOffers`).#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase", default)]pub struct FirstRunOffer {- /// `macos` or `linux`.+ /// What the person picks (`linux`, `omarchy`, `macos`; the+ /// wizard's `firstSpaceOffers` ids). Empty: `os`.+ pub id: String,+ /// The guest system, `macos` or `linux`.pub os: String,/// "about 2 min", "10 to 30 min the first time".pub time: Option<String>,@@ -126,7 +153,7 @@ pub struct FirstRunOffer {pub blocked: Option<String>,}-/// The extra Space, as far as it got.+/// The one-click first Space, as far as it got.#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]#[serde(rename_all = "camelCase", default)]pub struct FirstRunExtra {@@ -144,7 +171,7 @@ pub struct FirstRunExtra {pub error: Option<String>,}-/// The plan, for the card after the first success.+/// The plan, for [`upsell`] (not shown in the first run).#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase", default)]pub struct FirstRunPlan {@@ -173,11 +200,10 @@ pub struct FirstRunInput {pub host_os: String,/// What the agent setup found (none yet: still looking).pub agents: Option<Vec<FirstRunAgent>>,- /// The agent the first request names (setup id): the first one- /// connected. Older saved runs connected only this one.+ /// An older saved run's one connected agent (setup id).pub agent: Option<String>,- /// Step 1: the ticked agents (none: not changed yet, so the ones- /// installed here). Step 2: the agents connected (empty: none).+ /// The agents connected on this screen (setup ids). An agent the setup+ /// reports `configured` counts as connected either way.pub picked: Option<Vec<String>>,/// The provider keys saved on this computer (none: not read, or this/// app can't read them).@@ -186,8 +212,10 @@ pub struct FirstRunInput {pub agent_signing_in: Option<String>,/// Starting an agent's own sign-in failed with this.pub agent_sign_in_error: Option<String>,- /// Adding Cua to the agent's settings is running.+ /// Adding Cua to an agent's settings is running.pub connecting: bool,+ /// The agent being connected (none with `connecting`: every one asked).+ pub connecting_agent: Option<String>,/// Adding Cua to the agent's settings failed with this.pub connect_error: Option<String>,/// The agent was running when its settings changed (none: not known;@@ -202,7 +230,8 @@ pub struct FirstRunInput {pub host: Option<FirstRunHost>,/// The host setup is running (after sign-in).pub host_setting_up: bool,- /// The extra Space offers, macOS first.+ /// The first Space offers, in the order the wizard's+ /// `firstSpaceOffers` gives them (Linux, Omarchy, macOS).pub offers: Vec<FirstRunOffer>,pub extra: FirstRunExtra,pub plan: Option<FirstRunPlan>,@@ -223,21 +252,49 @@ fn button(id: &str, label: &str) -> FirstRunButton {}}-/// An agent on step 1.+/// Screen 1.+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct WelcomeView {+ /// "Your agents get their own computer."+ pub title: String,+ pub lede: String,+ /// "Get started" (`start`).+ pub primary: FirstRunButton,+}++/// An agent found on this computer (screen 2).#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct AgentPick {pub agent: String,pub name: String,- pub checked: bool,- pub installed: bool,- /// Cua is in its settings already: it stays ticked.- pub locked: bool,- /// "Already uses Cua", "Not found on this Mac".+ /// The file Connect changes, as the page shows it (`~/.claude.json`).+ pub file: Option<String>,+ /// Cua is in its settings.+ pub connected: bool,+ /// "Connect" (`connect`, with `agent`), none once connected or while+ /// it runs.+ pub action: Option<FirstRunButton>,+ /// "Connected", "Adding Cua…".pub note: Option<String>,}-/// A sign-in or key on step 1.+/// Something to do when no agent was found (screen 2).+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct AgentAlternative {+ /// `install` or `cli`.+ pub id: String,+ pub title: String,+ pub note: String,+ /// `install` opens this page.+ pub url: Option<String>,+ /// `cli`: the command, shown read-only with Copy.+ pub command: Option<String>,+}++/// A sign-in or key of a connected agent (screen 2).#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct CredentialRow {@@ -259,43 +316,56 @@ pub struct CredentialRow {pub error: Option<String>,}-/// Step 1.+/// Screen 2.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct ConnectView {- /// "A shared Space for every agent." (the one serif accent word is- /// `accent`, the only one in the app).+ /// "Pick your agent."pub title: String,- pub accent: String,pub lede: String,- /// "Pick any, or none."- pub intro: String,- /// "On this Mac".- pub agents_label: String,- /// The common agents, and any installed or ticked here.+ /// The agents found here, most preferred first (none: still looking,+ /// or nothing found: `alternatives`).pub agents: Vec<AgentPick>,- /// "More agents".- pub more_label: String,- /// Every other agent the setup knows.- pub more: Vec<AgentPick>,- /// What picking does, and that it is this computer only.- pub agents_note: String,- /// "Sign-ins and keys".- pub credentials_label: String,- /// "They stay on this Mac. Other computers keep their own."- pub credentials_note: String,- /// The picked agents' own sign-ins and provider keys (empty: the- /// section is not drawn).+ /// Nothing found: install an agent, or use the CLI.+ pub alternatives: Vec<AgentAlternative>,+ /// The connected agents' own sign-ins and provider keys, in the+ /// agents' order (empty: the section is not drawn).pub credentials: Vec<CredentialRow>,+ /// "They stay on this Mac."+ pub credentials_note: String,/// "Continue".pub primary: FirstRunButton,- /// The agents Continue connects (setup ids, ticked and not set up yet).- pub connects: Vec<String>,- /// "Adding Cua to Claude Code and Codex…" while it runs.- pub busy: Option<String>,+ /// "Skip" (none once an agent is connected).+ pub secondary: Option<FirstRunButton>,pub error: Option<String>,}+/// A row of screen 3 (what signing in connects).+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct DeviceRow {+ pub title: String,+ pub note: String,+}++/// Screen 3.+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct DevicesView {+ /// "Connect your other devices.", "This Mac is in your account."+ pub title: String,+ pub lede: String,+ pub rows: Vec<DeviceRow>,+ /// The sign-in waiting, or this computer being added to the account.+ pub status: Option<CheckRow>,+ /// "Sign in to connect" (`sign-in`), or "Continue" once signed in.+ pub primary: FirstRunButton,+ /// "Not now" (`not-now`) before sign-in.+ pub secondary: Option<FirstRunButton>,+ /// "This Mac works without it."+ pub note: Option<String>,+}+/// A checked row's state.#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "kebab-case")]@@ -305,11 +375,11 @@ pub enum RowState {Fix,}-/// One of the two checked rows.+/// A line with a state.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct CheckRow {- /// `agent` or `computer`.+ /// `agent`, `computer`, `account`.pub id: String,pub state: RowState,pub title: String,@@ -325,21 +395,24 @@ pub struct CheckRow {#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct PromptView {- /// "Try this in Claude Code", then "You asked Claude Code".+ /// "Paste this in Hermes."pub heading: String,+ /// Shown read-only, with Copy.pub text: String,- /// "This works now, on this Mac."pub note: String,- /// "Copy", until the agent used Cua.+ /// "Copy".pub copy: Option<String>,}-/// A choice on the extra Space card.+/// A choice on the first Space card.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct ExtraChoice {+ /// What picking it sends (`linux`, `omarchy`, `macos`).+ pub id: String,+ /// The guest system, for its icon (`linux` for Omarchy).pub os: String,- /// "macOS", "Linux".+ /// "Linux", "Omarchy", "macOS".pub label: String,/// "Ready in about 2 min", "22 GB download · 10 to 30 min the first time".pub detail: String,@@ -347,7 +420,7 @@ pub struct ExtraChoice {pub blocked: Option<String>,}-/// The optional extra Space card.+/// The one-click first Space (screen 4 with no agent).#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct ExtraView {@@ -365,8 +438,8 @@ pub struct ExtraView {pub footnote: Option<String>,}-/// The plan card after the first success (Pro, or Teams for someone who-/// shares with teammates). Only what the plans really include.+/// The plan card [`upsell`] makes (Pro, or Teams for someone who shares+/// with teammates). Only what the plans really include.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct UpsellCard {@@ -386,17 +459,16 @@ pub struct UpsellCard {#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct PrimaryView {- /// `done` or `finish-later`.+ /// `done`.pub id: String,pub label: String,pub enabled: bool,- /// "We'll keep a to-do list on Home." beside Finish later.pub note: Option<String>,}/// The art beside the page: which keys show. `agent` is the agent key's-/// mark (setup id). `computer`: `on`, `faded`. `extra`: `none`, `outline`,-/// `filling`.+/// mark (setup id, `other` for none). `computer`: `on`, `faded`. `extra`:+/// `none`, `outline`, `filling`, `on`.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct ArtView {@@ -405,17 +477,19 @@ pub struct ArtView {pub extra: String,}-/// Step 2.+/// Screen 4.#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct SetupView {- /// "Checking your setup.", "Your agent can use this Mac.", "One step left."+ /// "Try it in Hermes.", "Try a first Space."pub title: String,- pub rows: Vec<CheckRow>,- /// None when no agent was picked.+ pub lede: String,+ /// None with no connected agent.pub prompt: Option<PromptView>,- pub extra: ExtraView,- pub upsell: Option<UpsellCard>,+ /// "Waiting for Hermes…", then "Hermes used Cua at 18:12."+ pub status: Option<CheckRow>,+ /// The one-click first Space, with no connected agent.+ pub extra: Option<ExtraView>,pub primary: PrimaryView,}@@ -424,17 +498,19 @@ pub struct SetupView {#[serde(rename_all = "camelCase")]pub struct FirstRunView {pub step: FirstRunStep,- /// "Skip for now" (top right, both screens).+ /// "Skip for now" (top right, every screen).pub later: String,+ pub welcome: Option<WelcomeView>,pub connect: Option<ConnectView>,+ pub devices: Option<DevicesView>,pub setup: Option<SetupView>,pub art: ArtView,- /// Two page marks.+ /// Four page marks.pub dots: u8,pub current: u8,}-/// A line of Home's "Finish setting up" list (frame 9), after Finish later.+/// A line of Home's "Finish setting up" list.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct FirstRunTodo {@@ -448,7 +524,7 @@ pub struct FirstRunTodo {pub settings_url: Option<String>,}-/// Home's "Finish setting up" card.+/// Home's "Finish setting up" list.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct FirstRunTodos {@@ -457,7 +533,7 @@ pub struct FirstRunTodos {/// "2 of 5 done".pub progress: String,pub items: Vec<FirstRunTodo>,- /// Every required line is done (the card can go).+ /// Every required line is done (the list can go).pub complete: bool,}@@ -480,12 +556,13 @@ fn os_name(os: &str) -> &'static str {match os {"macos" => "macOS","linux" => "Linux",+ "omarchy" => "Omarchy","windows" => "Windows",_ => "a computer",}}-/// The first request's words on this system.+/// Home's to-do request on this system.pub fn first_prompt(os: &str) -> &'static str {match os {"macos" => FIRST_PROMPT,@@ -494,6 +571,15 @@ pub fn first_prompt(os: &str) -> &'static str {}}+/// The try screen's request on this system.+pub fn try_prompt(os: &str) -> &'static str {+ match os {+ "macos" => TRY_PROMPT,+ "windows" => TRY_PROMPT_PC,+ _ => TRY_PROMPT_OTHER,+ }+}+fn default_name(agent: &str) -> &'static str {match agent {"claude-code" => "Claude Code",@@ -514,18 +600,53 @@ fn name_of(agents: &[FirstRunAgent], id: &str) -> String {.unwrap_or_else(|| default_name(id).into())}-/// The agent a single-agent screen leads with: the first offered one-/// installed here, else Claude Code.+/// Where `id` sorts: its place in [`PREFERENCE`], else after all of them+/// in the setup's own order.+fn rank(agents: &[FirstRunAgent], id: &str) -> usize {+ PREFERENCE.iter().position(|p| *p == id).unwrap_or_else(|| {+ PREFERENCE.len()+ + agents+ .iter()+ .position(|a| a.agent == id)+ .unwrap_or(agents.len())+ })+}++/// `ids` in preference order (each once).+fn ordered(agents: &[FirstRunAgent], ids: impl IntoIterator<Item = String>) -> Vec<String> {+ let mut out: Vec<String> = Vec::new();+ for id in ids {+ if !out.contains(&id) {+ out.push(id);+ }+ }+ out.sort_by_key(|id| rank(agents, id));+ out+}++/// The agents found on this computer (installed, or with Cua in their+/// settings), most preferred first.+pub fn detected(agents: &[FirstRunAgent]) -> Vec<String> {+ ordered(+ agents,+ agents+ .iter()+ .filter(|a| a.installed || a.configured)+ .map(|a| a.agent.clone()),+ )+}++/// The agent a single-agent line leads with: the most preferred one found+/// on this computer, else `other` (never a default agent).pub fn lead_agent(agents: &[FirstRunAgent]) -> String {- OFFERED- .iter()- .find(|id| agents.iter().any(|a| a.agent == **id && a.installed))- .unwrap_or(&OFFERED[0])- .to_string()+ detected(agents)+ .into_iter()+ .next()+ .unwrap_or_else(|| "other".into())}-/// "Claude Code", "Claude Code and Codex", "Claude Code, Codex and Hermes"-/// (`or` for the first request: "Claude Code or Codex").+/// "Hermes", "Hermes and Codex", "Hermes, Claude Code and Codex"+/// (`or` for a request: "Hermes or Codex").fn names(agents: &[FirstRunAgent], ids: &[String], and: &str) -> String {let n: Vec<String> = ids.iter().map(|id| name_of(agents, id)).collect();match n.as_slice() {@@ -535,96 +656,87 @@ fn names(agents: &[FirstRunAgent], ids: &[String], and: &str) -> String {}}-/// Step 1's ticks: the user's, else every agent installed here (one Cua-/// is in already counts as installed).+/// The connected agents, most preferred first: each one the setup reports+/// with Cua in its settings, and each one connected on screen 2 (or an+/// older run's one agent).pub fn picked(input: &FirstRunInput) -> Vec<String> {let agents = input.agents.as_deref().unwrap_or(&[]);- let mut out: Vec<String> = match &input.picked {- Some(p) => p.clone(),- None => agents- .iter()- .filter(|a| a.installed || a.configured)- .map(|a| a.agent.clone())- .collect(),- };- // One Cua is already in can't be unticked here (Settings removes it).- for a in agents.iter().filter(|a| a.configured) {- if !out.contains(&a.agent) {- out.push(a.agent.clone());- }- }- out-}--/// The agents connected on step 2: what step 1 connected, or the one an-/// older run connected.-fn connected(input: &FirstRunInput) -> Vec<String> {- match &input.picked {+ let mut ids: Vec<String> = match &input.picked {Some(p) => p.clone(),None => input.agent.clone().into_iter().collect(),- }+ };+ ids.extend(+ agents+ .iter()+ .filter(|a| a.configured)+ .map(|a| a.agent.clone()),+ );+ ordered(agents, ids)}-/// The agent the first request names: the first connected.+/// The agent the first request names: the most preferred connected one.fn lead_of(input: &FirstRunInput) -> Option<String> {- connected(input).into_iter().next()+ picked(input).into_iter().next()}-fn agent_name(input: &FirstRunInput) -> String {- let agents = input.agents.as_deref().unwrap_or(&[]);- lead_of(input)- .map(|id| name_of(agents, &id))- .unwrap_or_else(|| "your agent".into())-}--/// Every agent step 1 lists, in order: [`FEATURED`], then each other one-/// the setup knows (`more` when it isn't installed or ticked here).-fn agent_picks(input: &FirstRunInput) -> (Vec<AgentPick>, Vec<AgentPick>) {- let agents = input.agents.as_deref().unwrap_or(&[]);- let ticked = picked(input);- let place = this_computer(&input.host_os);- let pick = |id: &str| {- let row = agents.iter().find(|a| a.agent == id);- let installed = row.is_some_and(|a| a.installed);- let locked = row.is_some_and(|a| a.configured);- AgentPick {- agent: id.into(),- name: name_of(agents, id),- checked: ticked.iter().any(|t| t == id),- installed,- locked,- note: if locked {- Some("Already uses Cua".into())- } else if row.is_some() && !installed {- Some(format!("Not found on {place}"))- } else {- None- },+/// `/Users/ada/.claude.json` as `~/.claude.json` (a path already under+/// `~` stays).+fn tilde(path: &str) -> String {+ for home in ["/Users/", "/home/"] {+ if let Some(rest) = path.strip_prefix(home)+ && let Some((_, after)) = rest.split_once('/')+ {+ return format!("~/{after}");}- };- let mut main: Vec<AgentPick> = FEATURED.iter().map(|id| pick(id)).collect();- let mut more = Vec::new();- for a in agents- .iter()- .filter(|a| !FEATURED.contains(&a.agent.as_str()))+ }+ if let Some(rest) = path.strip_prefix("C:\\Users\\")+ && let Some((_, after)) = rest.split_once('\\'){- let p = pick(&a.agent);- if p.installed || p.checked {- main.push(p);- } else {- more.push(p);- }+ return format!("~\\{after}");}- (main, more)+ path.into()+}++fn agent_picks(input: &FirstRunInput) -> Vec<AgentPick> {+ let agents = input.agents.as_deref().unwrap_or(&[]);+ let connected = picked(input);+ detected(agents)+ .into_iter()+ .map(|id| {+ let row = agents.iter().find(|a| a.agent == id);+ // Connected here: Cua is in its settings. A run that pressed+ // Connect and is waiting for the setup to say so counts too.+ let is_connected = row.is_some_and(|a| a.configured)+ || (connected.contains(&id) && input.agents.is_some() && !input.connecting);+ let busy = input.connecting+ && input.connecting_agent.as_deref().is_none_or(|a| a == id)+ && !row.is_some_and(|a| a.configured);+ AgentPick {+ name: name_of(agents, &id),+ file: row.and_then(|a| a.mcp_config.as_deref()).map(tilde),+ connected: is_connected,+ action: (!is_connected && !busy).then(|| button("connect", "Connect")),+ note: if busy {+ Some("Adding Cua…".into())+ } else if is_connected {+ Some("Connected".into())+ } else {+ None+ },+ agent: id,+ }+ })+ .collect()}-/// The picked agents' own sign-ins (Codex's ChatGPT sign-in), then the-/// provider keys their runs in a Space read, when this app can read keys.-fn credentials(input: &FirstRunInput, ticked: &[String]) -> Vec<CredentialRow> {+/// The connected agents' own sign-ins (Codex's ChatGPT sign-in), then the+/// provider keys their runs in a Space read, when this app can read keys;+/// both in the agents' order.+fn credentials(input: &FirstRunInput, connected: &[String]) -> Vec<CredentialRow> {let agents = input.agents.as_deref().unwrap_or(&[]);let place = this_computer(&input.host_os);let mut out = Vec::new();- for id in ticked {+ for id in connected {let Some(a) = agents.iter().find(|a| &a.agent == id) else {continue;};@@ -661,26 +773,23 @@ fn credentials(input: &FirstRunInput, ticked: &[String]) -> Vec<CredentialRow> {else {return out;};- for (agent, provider) in AGENT_KEYS {- if !ticked.iter().any(|t| t == agent) {+ let rows = crate::agent_keys::view(keys).rows;+ for id in connected {+ let Some((_, provider)) = AGENT_KEYS.iter().find(|(a, _)| a == id) else {continue;- }- let Some(row) = crate::agent_keys::view(keys)- .rows- .into_iter()- .find(|r| r.provider == provider)- else {+ };+ let Some(row) = rows.iter().find(|r| r.provider == *provider) else {continue;};out.push(CredentialRow {id: format!("key:{provider}"),title: format!("{} key", row.title),- note: format!("For {} in your Spaces", name_of(agents, agent)),+ note: format!("For {} in your Spaces", name_of(agents, id)),status: row.set.then(|| "Saved".into()),ok: row.set,action: (!row.set).then(|| button("add-key", "Add key")),agent: None,- provider: Some(provider.into()),+ provider: Some((*provider).into()),error: None,});}@@ -695,37 +804,72 @@ fn default_or(name: &str, id: &str) -> String {}}+fn welcome_view(input: &FirstRunInput) -> WelcomeView {+ let place = this_computer(&input.host_os);+ WelcomeView {+ title: "Your agents get their own computer.".into(),+ lede: format!("Spaces on {place}, away from your files and your mouse."),+ primary: button("start", "Get started"),+ }+}+fn connect_view(input: &FirstRunInput) -> ConnectView {let agents = input.agents.as_deref().unwrap_or(&[]);let place = this_computer(&input.host_os);- let (list, more) = agent_picks(input);- let ticked = picked(input);- let connects: Vec<String> = ticked+ let list = agent_picks(input);+ let connected: Vec<String> = list.iter()- .filter(|id| !agents.iter().any(|a| &a.agent == *id && a.configured))- .cloned()+ .filter(|p| p.connected)+ .map(|p| p.agent.clone()).collect();+ let none = input.agents.is_some() && list.is_empty();+ // Nothing found: the agents Cua sets up, in the same order.+ let names_all = names(+ agents,+ &PREFERENCE[..4]+ .iter()+ .map(|s| s.to_string())+ .collect::<Vec<_>>(),+ "or",+ );ConnectView {- title: "A shared Space for every agent.".into(),- accent: "agent".into(),- lede: format!(- "Connect your agents and give them computers to work on: macOS, Linux or Windows, right here on {place}."- ),- intro: "Pick any, or none.".into(),- agents_label: format!("On {place}"),+ title: if none {+ "Connect an agent.".into()+ } else {+ "Pick your agent.".into()+ },+ lede: if input.agents.is_none() {+ format!("Looking for agents on {place}…")+ } else if none {+ format!("No agents found on {place}.")+ } else {+ format!("Found on {place}. You can add more later.")+ },agents: list,- more_label: "More agents".into(),- more,- agents_note: format!(- "Cua adds its skills and MCP server to each one you pick, on {place} only. Your other computers set up their own."- ),- credentials_label: "Sign-ins and keys".into(),- credentials_note: format!("They stay on {place}. Other computers keep their own."),- credentials: credentials(input, &ticked),+ alternatives: if none {+ vec![+ AgentAlternative {+ id: "install".into(),+ title: "Install an agent".into(),+ note: format!("{names_all}, then come back here."),+ url: Some(AGENTS_GUIDE_URL.into()),+ command: None,+ },+ AgentAlternative {+ id: "cli".into(),+ title: "Use the CLI".into(),+ note: format!("Make a Space on {place} from a terminal."),+ url: None,+ command: Some(CLI_FIRST_SPACE.into()),+ },+ ]+ } else {+ vec![]+ },+ credentials: credentials(input, &connected),+ credentials_note: format!("They stay on {place}."),primary: button("continue", "Continue"),- busy: (input.connecting && !connects.is_empty())- .then(|| format!("Adding Cua to {}…", names(agents, &connects, "and"))),- connects,+ secondary: connected.is_empty().then(|| button("skip", "Skip")),error: input.connect_error.as_ref()@@ -733,102 +877,110 @@ fn connect_view(input: &FirstRunInput) -> ConnectView {}}-/// Step 2's agent row (none when no agent was picked).-fn agent_row(input: &FirstRunInput) -> Option<CheckRow> {- let ids = connected(input);- if ids.is_empty() {- return None;- }- let all = input.agents.as_deref().unwrap_or(&[]);- let name = names(all, &ids, "and");- let many = ids.len() > 1;+/// This computer in the account, once signed in (screen 3): added, being+/// added, or the reason it wasn't. Permissions are not asked here.+fn account_row(input: &FirstRunInput) -> Option<CheckRow> {+ let place = this_computer(&input.host_os);let row = |state, title: String, note: String, action: Option<FirstRunButton>| CheckRow {- id: "agent".into(),+ id: "account".into(),state,title,note,action,settings_url: None,};- let Some(agents) = &input.agents else {+ if !input.signed_in {+ return input.signing_in.then(|| {+ row(+ RowState::Checking,+ "Signing in".into(),+ "Finish signing in to Cua in your browser.".into(),+ None,+ )+ });+ }+ let Some(host) = &input.host else {return Some(row(RowState::Checking,- name,- format!(- "Checking that {} can use Cua…",- if many { "they" } else { "it" }- ),+ format!("Adding {place}"),+ "Checking your account…".into(),None,));};- let missing: Vec<String> = ids- .iter()- .filter(|id| !agents.iter().any(|a| &a.agent == *id && a.configured))- .cloned()- .collect();- if !missing.is_empty() {- let them = names(all, &missing, "and");- if input.connecting {- return Some(row(- RowState::Checking,- name,- format!("Adding Cua to {them}…"),- None,- ));- }- return Some(row(- RowState::Fix,- format!("Connect {them}"),- input.connect_error.clone().map_or_else(- || {- if missing.len() > 1 {- "Cua isn't in their settings yet.".into()- } else {- format!("Cua isn't in {them}'s settings yet.")- }- },- |e| format!("Couldn't add Cua: {e}"),- ),- Some(button("connect", "Connect")),- ));- }- let can = format!("{name} can use Cua");- if let Some(at) = &input.agent_used_at {+ if input.host_setting_up {return Some(row(- RowState::Ok,- can,- format!(- "{} used Cua at {at}.",- if many { "Your agent" } else { "It" }- ),+ RowState::Checking,+ format!("Adding {place}"),+ "It takes a few seconds.".into(),None,));}- if input.agent_open_before_setup == Some(true) {+ if !host.configured {return Some(row(RowState::Fix,- format!("Restart {name}"),- format!(- "{} open when we added Cua. Close {}, then open {} again.",- if many { "They were" } else { "It was" },- if many { "them" } else { "it" },- if many { "them" } else { "it" }+ format!("Add {place} to your account"),+ host.error.as_ref().map_or_else(+ || "It takes a few seconds.".into(),+ |e| format!("It didn't work: {e}"),),- Some(button("restart-check", "Check again")),+ Some(button(+ "set-up",+ if host.error.is_some() {+ "Try again"+ } else {+ "Add"+ },+ )),));}Some(row(RowState::Ok,- can,- if many {- "We added Cua to their settings. If any was already open, restart it.".into()- } else {- format!("We added Cua to {name}'s settings. If {name} was already open, restart it.")- },+ format!("{} is in your account", cap(place)),+ "Your other computers can reach its Spaces.".into(),None,))}+fn devices_view(input: &FirstRunInput) -> DevicesView {+ let place = this_computer(&input.host_os);+ let rows = vec![+ DeviceRow {+ title: "Your other computers".into(),+ note: format!("They join {place}'s pool"),+ },+ DeviceRow {+ title: "Your cloud".into(),+ note: "Hetzner, AWS, Google Cloud or Modal".into(),+ },+ ];+ if input.signed_in {+ let status = account_row(input);+ let added = status.as_ref().is_some_and(|r| r.state == RowState::Ok);+ return DevicesView {+ title: if added {+ format!("{} is in your account.", cap(place))+ } else {+ format!("Adding {place} to your account.")+ },+ lede: "Sign in on your other computers, and they reach its Spaces.".into(),+ rows,+ status,+ primary: button("continue", "Continue"),+ secondary: None,+ note: None,+ };+ }+ DevicesView {+ title: "Connect your other devices.".into(),+ lede: format!("Sign in once, and your other computers reach {place}'s Spaces."),+ rows,+ status: account_row(input),+ primary: button("sign-in", "Sign in to connect"),+ secondary: Some(button("not-now", "Not now")),+ note: Some(format!("{} works without it.", cap(place))),+ }+}+fn missing_permission(host: &FirstRunHost, id: &str) -> Option<FirstRunPermission> {host.permissions.iter()@@ -836,6 +988,8 @@ fn missing_permission(host: &FirstRunHost, id: &str) -> Option<FirstRunPermissio.cloned()}+/// This computer for Home's to-do list: signed in, set up, running, the+/// permissions an agent needs to use it, online.fn computer_row(input: &FirstRunInput) -> CheckRow {let place = this_computer(&input.host_os);let row = |state, title: String, note: &str, action: Option<FirstRunButton>| CheckRow {@@ -854,7 +1008,7 @@ fn computer_row(input: &FirstRunInput) -> CheckRow {return row(RowState::Fix,"Sign in to Cua".into(),- &format!("So your agent can find {place} and your other computers."),+ &format!("So your other computers can reach {place}."),Some(button("sign-in", "Sign in")),);}@@ -956,10 +1110,15 @@ fn os_label(os: &str) -> String {os_name(os).into()}+fn offer_id(o: &FirstRunOffer) -> &str {+ if o.id.is_empty() { &o.os } else { &o.id }+}+fn offer_detail(o: &FirstRunOffer) -> String {let time = o.time.as_deref().map(|t| format!("Ready in {t}"));- match o.os.as_str() {- "macos" => [o.size.clone(), o.time.clone()]+ match offer_id(o) {+ // A download worth saying: its size, then the time.+ "macos" | "omarchy" => [o.size.clone(), o.time.clone()].into_iter().flatten().collect::<Vec<_>>()@@ -1000,7 +1159,7 @@ fn extra_view(input: &FirstRunInput) -> ExtraView {"ready",format!("{name} is ready"),format!(- "A fresh {} computer inside {place}. Your agent can use it now.",+ "A fresh {} computer inside {place}.",os_label(e.os.as_deref().unwrap_or(""))),),@@ -1018,48 +1177,98 @@ fn extra_view(input: &FirstRunInput) -> ExtraView {action: Some(button("add", "Add a Space")),..base("not-now",- "No extra Space for now".into(),+ "No Space for now".into(),"Add one from Home whenever you like.".into(),)},_ => {- // macOS first, then Linux; nothing else.- let mut choices: Vec<ExtraChoice> = ["macos", "linux"]+ // Linux first, then Omarchy and macOS where they run here;+ // nothing else. Only Linux shows when it can't be made (with+ // why): Omarchy or macOS this computer can't run, or has no+ // room for, isn't a choice at all.+ let choices: Vec<ExtraChoice> = ["linux", "omarchy", "macos"].iter()- .filter_map(|os| input.offers.iter().find(|o| o.os == *os))+ .filter_map(|id| input.offers.iter().find(|o| offer_id(o) == *id))+ .filter(|o| offer_id(o) == "linux" || o.blocked.is_none()).map(|o| ExtraChoice {+ id: offer_id(o).to_string(),os: o.os.clone(),- label: os_label(&o.os),+ label: os_label(offer_id(o)),detail: offer_detail(o),blocked: o.blocked.clone(),}).collect();- // A system this computer can't run at all isn't a choice.- if choices.iter().any(|c| c.blocked.is_none()) {- choices.retain(|c| !(c.os == "macos" && c.blocked.is_some()));- }ExtraView {- tag: Some("(optional)".into()),+ tag: None,choices,action: Some(button("not-now", "Not now")),..base("choose",- "Give your agent its own Space".into(),- format!(- "A fresh computer inside {place}, so your agent can't touch your files or your mouse."- ),+ "Make a first Space".into(),+ format!("A fresh computer inside {place}. One click starts it."),)}}}}-/// The plan card after the first success: Teams for someone who entered-/// teammates' emails and isn't on Teams, else Pro for Free. Never after-/// "Not now", never before the agent used Cua, never on an unmetered-/// account. Only what the plans include: Pro is more remote hours and more-/// connections at once; Teams is computers a team shares, roles and device-/// approval.+fn setup_view(input: &FirstRunInput) -> SetupView {+ let place = this_computer(&input.host_os);+ let all = input.agents.as_deref().unwrap_or(&[]);+ let done = PrimaryView {+ id: "done".into(),+ label: "Done".into(),+ enabled: true,+ note: None,+ };+ let Some(lead) = lead_of(input) else {+ return SetupView {+ title: "Try a first Space.".into(),+ lede: format!("Spaces run on {place}, away from your files and your mouse."),+ prompt: None,+ status: None,+ extra: Some(extra_view(input)),+ primary: done,+ };+ };+ let name = name_of(all, &lead);+ let status = match &input.agent_used_at {+ Some(at) => CheckRow {+ id: "agent".into(),+ state: RowState::Ok,+ title: format!("{name} used Cua at {at}."),+ note: "Ask it anything else.".into(),+ action: None,+ settings_url: None,+ },+ None => CheckRow {+ id: "agent".into(),+ state: RowState::Checking,+ title: format!("Waiting for {name}…"),+ note: format!("If {name} was already open, restart it."),+ action: None,+ settings_url: None,+ },+ };+ SetupView {+ title: format!("Try it in {name}."),+ lede: format!("Paste this. {name} makes the Space itself."),+ prompt: Some(PromptView {+ heading: format!("Paste this in {name}"),+ text: try_prompt(&input.host_os).into(),+ note: format!("It runs on {place}."),+ copy: Some("Copy".into()),+ }),+ status: Some(status),+ extra: None,+ primary: done,+ }+}++/// The plan card for a moment after the first success: Teams for someone+/// who entered teammates' emails and isn't on Teams, else Pro for Free.+/// Never after "Not now", never before the agent used Cua, never on an+/// unmetered account. The first run itself shows no plan.pub fn upsell(plan: &FirstRunPlan, agent_used: bool) -> Option<UpsellCard> {if !agent_used || plan.dismissed || !plan.metered {return None;@@ -1102,34 +1311,20 @@ pub fn upsell(plan: &FirstRunPlan, agent_used: bool) -> Option<UpsellCard> {})}-/// The art for step 2: the computer key fades while its row is checked or-/// needs a fix; an extra Space is a dashed outline, filled faintly while-/// it is made.-fn art(input: &FirstRunInput, computer: &CheckRow) -> ArtView {+/// The keys beside the page: the lead agent's key (the most preferred+/// connected one, else found one, else `other`), this computer's key, and+/// on the try screen the Space being made.+fn art(input: &FirstRunInput) -> ArtView {let agents = input.agents.as_deref().unwrap_or(&[]);- let agent = match input.step {- FirstRunStep::Connect => picked(input).into_iter().next(),- FirstRunStep::Setup => lead_of(input),- };ArtView {- agent: agent.unwrap_or_else(|| {- if input.step == FirstRunStep::Connect && input.agents.is_none() {- lead_agent(agents)- } else {- "other".into()- }- }),- computer: if input.step == FirstRunStep::Setup && computer.state != RowState::Ok {- "faded"- } else {- "on"- }- .into(),+ agent: lead_of(input).unwrap_or_else(|| lead_agent(agents)),+ computer: "on".into(),extra: match (input.step, input.extra.phase.as_str()) {- (FirstRunStep::Connect, _) => "none",- (_, "creating") => "filling",- (_, "ready") => "on",- (_, "not-now") => "none",+ (FirstRunStep::Setup, "creating") => "filling",+ (FirstRunStep::Setup, "ready") => "on",+ (FirstRunStep::Setup, "not-now") => "none",+ (FirstRunStep::Setup, _) if input.agent_used_at.is_some() => "on",+ (FirstRunStep::Welcome, _) => "none",_ => "outline",}.into(),@@ -1138,125 +1333,50 @@ fn art(input: &FirstRunInput, computer: &CheckRow) -> ArtView {/// The first run as drawn.pub fn view(input: &FirstRunInput) -> FirstRunView {- let agent = agent_row(input);- let computer = computer_row(input);- let art = art(input, &computer);- let later = "Skip for now".to_string();- if input.step == FirstRunStep::Connect {- return FirstRunView {- step: FirstRunStep::Connect,- later,- connect: Some(connect_view(input)),- setup: None,- art,- dots: 2,- current: 0,- };- }- let place = this_computer(&input.host_os);- let ids = connected(input);- let all = input.agents.as_deref().unwrap_or(&[]);- let rows: Vec<CheckRow> = agent.into_iter().chain([computer]).collect();- let checking = rows.iter().any(|r| r.state == RowState::Checking);- let fixes = rows.iter().filter(|r| r.state == RowState::Fix).count();- let ready = rows.iter().all(|r| r.state == RowState::Ok);- let title = if ready {- match ids.len() {- 0 => format!("{} is ready.", cap(place)),- 1 => format!("Your agent can use {place}."),- _ => format!("Your agents can use {place}."),- }- } else if fixes == 1 && !checking {- "One step left.".into()- } else if fixes > 1 && !checking {- format!("{fixes} steps left.")- } else {- "Checking your setup.".into()- };- let used = input.agent_used_at.is_some();- let prompt = (!ids.is_empty()).then(|| {- if used {- let name = agent_name(input);- PromptView {- heading: format!("You asked {name}"),- text: first_prompt(&input.host_os).into(),- note: format!("It answered in {name}. Ask it anything else."),- copy: None,- }- } else {- PromptView {- heading: format!("Try this in {}", names(all, &ids, "or")),- text: first_prompt(&input.host_os).into(),- note: format!("This works now, on {place}."),- copy: Some("Copy".into()),- }- }- });- let finish_later = fixes > 0 && !checking;+ let step = input.step;FirstRunView {- step: FirstRunStep::Setup,- later,- connect: None,- setup: Some(SetupView {- title,- rows,- prompt,- extra: extra_view(input),- upsell: input.plan.as_ref().and_then(|p| upsell(p, used)),- primary: if finish_later {- PrimaryView {- id: "finish-later".into(),- label: "Finish later".into(),- enabled: true,- note: Some("We'll keep a to-do list on Home.".into()),- }- } else {- PrimaryView {- id: "done".into(),- label: "Done".into(),- enabled: ready,- note: None,- }- },- }),- art,- dots: 2,- current: 1,+ step,+ later: "Skip for now".into(),+ welcome: (step == FirstRunStep::Welcome).then(|| welcome_view(input)),+ connect: (step == FirstRunStep::Connect).then(|| connect_view(input)),+ devices: (step == FirstRunStep::Devices).then(|| devices_view(input)),+ setup: (step == FirstRunStep::Setup).then(|| setup_view(input)),+ art: art(input),+ dots: 4,+ current: step.index(),}}-/// Home's "Finish setting up" list after Finish later: the same checks,-/// kept (frame 9). Nothing left that is required: `complete`.+/// Home's "Finish setting up" list after Skip for now: the connected+/// agents, this computer, the first request, a first Space and the+/// sign-in. Signing in is optional, so is everything that needs it.pub fn todos(input: &FirstRunInput) -> FirstRunTodos {let place = this_computer(&input.host_os);- let ids = connected(input);+ let ids = picked(input);let all = input.agents.as_deref().unwrap_or(&[]);let name = names(all, &ids, "and");- let agent = agent_row(input);let computer = computer_row(input);let used = input.agent_used_at.is_some();- // No agent picked: no agent line and no first request.- let mut items: Vec<FirstRunTodo> = agent- .iter()- .map(|agent| FirstRunTodo {+ let agent_ok = !ids.is_empty()+ && ids+ .iter()+ .all(|id| all.iter().any(|a| &a.agent == id && a.configured));+ let mut items: Vec<FirstRunTodo> = Vec::new();+ if !ids.is_empty() {+ items.push(FirstRunTodo {id: "agent".into(),- done: agent.state == RowState::Ok,- title: if agent.state == RowState::Fix {- agent.title.clone()- } else {- format!("Connect {name}")- },- note: if agent.state == RowState::Ok {+ title: format!("Connect {name}"),+ note: if agent_ok {format!("{name} can use Cua.")} else {- agent.note.clone()+ format!("Cua isn't in {name}'s settings yet.")},+ done: agent_ok,optional: false,- action: agent.action.clone(),+ action: (!agent_ok).then(|| button("connect", "Connect")),settings_url: None,- })- .collect();- // Sign-in is its own line; the computer line is what is left after it.+ });+ }items.push(FirstRunTodo {id: "computer".into(),done: computer.state == RowState::Ok,@@ -1272,7 +1392,7 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {} else {computer.note.clone()},- optional: false,+ optional: !input.signed_in,action: if input.signed_in {computer.action.clone()} else {@@ -1287,7 +1407,7 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {note: format!("Ask {}: \u{201c}{}\u{201d}",names(all, &ids, "or"),- first_prompt(&input.host_os)+ try_prompt(&input.host_os)),done: used,optional: false,@@ -1307,14 +1427,14 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {});items.push(FirstRunTodo {id: "sign-in".into(),- title: "Sign in".into(),+ title: "Connect your other devices (optional)".into(),note: if input.signed_in {"Signed in to Cua.".into()} else {- format!("So your agent can find {place} and your other computers.")+ format!("Sign in, and your other computers reach {place}'s Spaces.")},done: input.signed_in,- optional: false,+ optional: true,action: (!input.signed_in).then(|| button("sign-in", "Sign in")),settings_url: None,});@@ -1326,10 +1446,10 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {1 => "One thing is left.",_ => "A couple of things are left.",};- let lede = match &agent {- Some(a) if a.state == RowState::Ok => format!("{name} is connected. {rest}"),- Some(_) => "A couple of things are left.".into(),- None => rest.into(),+ let lede = if agent_ok {+ format!("{name} is connected. {rest}")+ } else {+ rest.into()};FirstRunTodos {title: "Finish setting up".into(),@@ -1389,16 +1509,6 @@ fn cua_host_access_is_connection(who: &str, what: &str) -> bool {mod tests {use super::*;- fn claude(configured: bool) -> FirstRunAgent {- FirstRunAgent {- agent: "claude-code".into(),- name: "Claude Code".into(),- installed: true,- configured,- ..Default::default()- }- }-fn agent(id: &str, name: &str, installed: bool) -> FirstRunAgent {FirstRunAgent {agent: id.into(),@@ -1408,14 +1518,30 @@ mod tests {}}+ fn claude(configured: bool) -> FirstRunAgent {+ FirstRunAgent {+ configured,+ mcp_config: Some("/Users/ada/.claude.json".into()),+ ..agent("claude-code", "Claude Code", true)+ }+ }+fn codex(installed: bool, signed_in: bool) -> FirstRunAgent {FirstRunAgent {sign_in: Some("ChatGPT".into()),signed_in,+ mcp_config: Some("/Users/ada/.codex/config.toml".into()),..agent("codex", "OpenAI Codex", installed)}}+ fn hermes() -> FirstRunAgent {+ FirstRunAgent {+ mcp_config: Some("/Users/ada/.hermes/config.yaml".into()),+ ..agent("hermes", "Hermes", true)+ }+ }+fn keys(saved: &[&str]) -> crate::agent_keys::AgentKeysInput {crate::agent_keys::AgentKeysInput {keys: saved@@ -1431,63 +1557,210 @@ mod tests {}}- fn connect(agents: Vec<FirstRunAgent>, picked: Option<&[&str]>) -> ConnectView {- view(&FirstRunInput {+ fn input(step: FirstRunStep, agents: Vec<FirstRunAgent>) -> FirstRunInput {+ FirstRunInput {+ step,host_os: "macos".into(),agents: Some(agents),- picked: picked.map(|p| p.iter().map(|x| x.to_string()).collect()),- keys: Some(keys(&["ANTHROPIC_API_KEY"])),+ keys: Some(keys(&[])),..Default::default()- })- .connect- .unwrap()+ }}- fn ids(p: &[AgentPick], f: impl Fn(&AgentPick) -> bool) -> Vec<String> {- p.iter().filter(|x| f(x)).map(|x| x.agent.clone()).collect()+ fn connect(i: &FirstRunInput) -> ConnectView {+ view(i).connect.unwrap()}- fn ready_host() -> FirstRunHost {- FirstRunHost {- configured: true,- running: true,- online: Some(true),- permissions: vec![FirstRunPermission {- id: "accessibility".into(),- granted: true,- settings_url: None,- }],- error: None,+ fn agents_of(c: &ConnectView) -> Vec<String> {+ c.agents.iter().map(|a| a.agent.clone()).collect()+ }++ #[test]+ fn four_screens_in_order_and_a_fresh_run_starts_on_welcome() {+ assert_eq!(FirstRunInput::default().step, FirstRunStep::Welcome);+ let mut i = input(FirstRunStep::Welcome, vec![claude(false)]);+ for (step, n) in [+ (FirstRunStep::Welcome, 0),+ (FirstRunStep::Connect, 1),+ (FirstRunStep::Devices, 2),+ (FirstRunStep::Setup, 3),+ ] {+ i.step = step;+ let v = view(&i);+ assert_eq!((v.dots, v.current), (4, n));+ let drawn = [+ v.welcome.is_some(),+ v.connect.is_some(),+ v.devices.is_some(),+ v.setup.is_some(),+ ];+ assert_eq!(drawn.iter().filter(|d| **d).count(), 1, "{step:?}");+ assert!(drawn[n as usize]);}+ let w = view(&input(FirstRunStep::Welcome, vec![])).welcome.unwrap();+ assert_eq!(w.title, "Your agents get their own computer.");+ assert_eq!(w.primary.id, "start");}- fn setup() -> FirstRunInput {- FirstRunInput {- step: FirstRunStep::Setup,- host_os: "macos".into(),- agents: Some(vec![claude(true)]),- agent: Some("claude-code".into()),- signed_in: true,- host: Some(ready_host()),- offers: vec![- FirstRunOffer {- os: "linux".into(),- time: Some("about 2 min".into()),- ..Default::default()- },- FirstRunOffer {- os: "macos".into(),- time: Some("10 to 30 min the first time".into()),- size: Some("22 GB download".into()),- ..Default::default()- },+ #[test]+ fn a_run_saved_by_an_older_app_resumes() {+ for (word, step) in [+ ("connect", FirstRunStep::Connect),+ ("setup", FirstRunStep::Setup),+ ] {+ let i: FirstRunInput =+ serde_json::from_value(serde_json::json!({ "step": word })).unwrap();+ assert_eq!(i.step, step);+ }+ }++ #[test]+ fn agents_are_ordered_by_preference_and_nothing_is_connected_by_itself() {+ let i = input(+ FirstRunStep::Connect,+ vec![+ agent("openclaw", "OpenClaw", true),+ codex(true, false),+ claude(false),+ agent("goose", "Goose", true),+ agent("cursor", "Cursor", false),+ hermes(),],- ..Default::default()+ );+ let c = connect(&i);+ // Only what's on this computer, most preferred first, the rest after.+ assert_eq!(+ agents_of(&c),+ ["hermes", "claude-code", "codex", "openclaw", "goose"]+ );+ for a in &c.agents {+ assert!(!a.connected, "{}", a.agent);+ assert_eq!(a.action.as_ref().unwrap().id, "connect");}+ let files: Vec<Option<String>> = c.agents.iter().map(|a| a.file.clone()).collect();+ assert_eq!(files[0].as_deref(), Some("~/.hermes/config.yaml"));+ assert_eq!(files[1].as_deref(), Some("~/.claude.json"));+ assert_eq!(files[2].as_deref(), Some("~/.codex/config.toml"));+ assert_eq!(c.secondary.as_ref().unwrap().id, "skip");+ assert_eq!(lead_agent(i.agents.as_deref().unwrap()), "hermes");+ assert_eq!(view(&i).art.agent, "hermes");}- fn s(v: &FirstRunView) -> &SetupView {- v.setup.as_ref().unwrap()+ #[test]+ fn a_codex_user_never_sees_claude_first() {+ let i = FirstRunInput {+ picked: Some(vec!["codex".into()]),+ keys: Some(keys(&[])),+ ..input(+ FirstRunStep::Connect,+ vec![+ codex(true, false),+ agent("claude-code", "Claude Code", false),+ ],+ )+ };+ let c = connect(&i);+ assert_eq!(agents_of(&c), ["codex"]);+ let creds: Vec<&str> = c.credentials.iter().map(|r| r.id.as_str()).collect();+ assert_eq!(creds, ["sign-in:codex", "key:openai"]);+ let mut s = i.clone();+ s.step = FirstRunStep::Setup;+ let v = view(&s).setup.unwrap();+ assert_eq!(v.title, "Try it in OpenAI Codex.");+ let all = serde_json::to_string(&view(&s)).unwrap();+ assert!(!all.contains("Claude"), "{all}");+ assert!(!all.contains("Anthropic"), "{all}");+ assert_eq!(view(&s).art.agent, "codex");+ }++ #[test]+ fn connected_agents_lead_in_preference_order_with_their_sign_ins_and_keys() {+ let i = FirstRunInput {+ picked: Some(vec!["codex".into(), "claude-code".into()]),+ keys: Some(keys(&["ANTHROPIC_API_KEY"])),+ ..input(+ FirstRunStep::Connect,+ vec![codex(true, true), claude(true), hermes()],+ )+ };+ let c = connect(&i);+ let connected: Vec<&str> = c+ .agents+ .iter()+ .filter(|a| a.connected)+ .map(|a| a.agent.as_str())+ .collect();+ assert_eq!(connected, ["claude-code", "codex"]);+ assert!(c.secondary.is_none());+ let creds: Vec<(&str, Option<&str>)> = c+ .credentials+ .iter()+ .map(|r| (r.id.as_str(), r.status.as_deref()))+ .collect();+ assert_eq!(+ creds,+ [+ ("sign-in:codex", Some("Signed in")),+ ("key:anthropic", Some("Saved")),+ ("key:openai", None),+ ]+ );+ assert_eq!(c.credentials[2].action.as_ref().unwrap().id, "add-key");+ let hermes = c.agents.iter().find(|a| a.agent == "hermes").unwrap();+ assert_eq!(hermes.action.as_ref().unwrap().label, "Connect");+ assert_eq!(picked(&i), ["claude-code", "codex"]);+ }++ #[test]+ fn connecting_one_agent_shows_on_its_row_only() {+ let i = FirstRunInput {+ connecting: true,+ connecting_agent: Some("codex".into()),+ ..input(FirstRunStep::Connect, vec![codex(true, false), hermes()])+ };+ let c = connect(&i);+ let codex = c.agents.iter().find(|a| a.agent == "codex").unwrap();+ assert_eq!(codex.note.as_deref(), Some("Adding Cua…"));+ assert!(codex.action.is_none());+ let hermes = c.agents.iter().find(|a| a.agent == "hermes").unwrap();+ assert!(hermes.action.is_some());+ let failed = FirstRunInput {+ connect_error: Some("no write access".into()),+ ..input(FirstRunStep::Connect, vec![hermes_row()])+ };+ assert_eq!(+ connect(&failed).error.as_deref(),+ Some("Couldn't add Cua: no write access")+ );+ }++ fn hermes_row() -> FirstRunAgent {+ hermes()+ }++ #[test]+ fn no_agent_found_offers_an_install_or_the_cli() {+ let c = connect(&input(+ FirstRunStep::Connect,+ vec![agent("claude-code", "Claude Code", false)],+ ));+ assert!(c.agents.is_empty());+ assert_eq!(c.title, "Connect an agent.");+ let alts: Vec<&str> = c.alternatives.iter().map(|a| a.id.as_str()).collect();+ assert_eq!(alts, ["install", "cli"]);+ assert_eq!(+ c.alternatives[0].note,+ "Hermes, Claude Code, Codex or Cursor, then come back here."+ );+ assert_eq!(c.alternatives[1].command.as_deref(), Some(CLI_FIRST_SPACE));+ // Still looking: no alternatives yet.+ let looking = connect(&FirstRunInput {+ agents: None,+ ..input(FirstRunStep::Connect, vec![])+ });+ assert!(looking.alternatives.is_empty());+ assert_eq!(looking.lede, "Looking for agents on this Mac…");+ assert_eq!(lead_agent(&[]), "other");}#[test]@@ -1506,415 +1779,162 @@ mod tests {},1,);- let agent = FirstRunAgent {+ let a = FirstRunAgent {agent: row.agent,name: row.name,installed: row.installed,configured: row.configured,..Default::default()};- let c = connect(vec![agent.clone()], None);- let pick = c.agents.iter().find(|a| a.agent == "claude-code").unwrap();- assert_eq!(pick.checked, configured);- assert_eq!(pick.locked, configured);- if configured {- let v = view(&FirstRunInput {- agents: Some(vec![agent]),- ..setup()- });- let row = s(&v).rows.iter().find(|r| r.id == "agent").unwrap();- assert_eq!(row.state, RowState::Ok);- assert_eq!(row.title, "Claude Code can use Cua");- } else {- assert_eq!(pick.note.as_deref(), Some("Not found on this Mac"));- }+ let c = connect(&input(FirstRunStep::Connect, vec![a]));+ let found = c.agents.iter().find(|a| a.agent == "claude-code");+ assert_eq!(found.map(|a| a.connected), configured.then_some(true));}}#[test]- fn every_agent_is_listed_once_and_installed_ones_are_ticked() {- let all = vec![- claude(false),- codex(true, false),- agent("cursor", "Cursor", false),- agent("goose", "Goose", true),- agent("zed", "Zed", false),- ];- let c = connect(all.clone(), None);- assert_eq!(c.intro, "Pick any, or none.");- assert_eq!(c.agents_label, "On this Mac");- // The common ones first, then an installed other one; the rest under More.+ fn signing_in_is_optional_and_says_what_it_connects() {+ let mut i = input(FirstRunStep::Devices, vec![]);+ let d = view(&i).devices.unwrap();+ assert_eq!(d.title, "Connect your other devices.");assert_eq!(- ids(&c.agents, |_| true),- [- "claude-code",- "codex",- "hermes",- "cursor",- "openclaw",- "goose"- ]+ d.lede,+ "Sign in once, and your other computers reach this Mac's Spaces.");- assert_eq!(ids(&c.more, |_| true), ["zed"]);- assert_eq!(c.more_label, "More agents");- // Ticked by default: what is installed here.+ let rows: Vec<&str> = d.rows.iter().map(|r| r.title.as_str()).collect();+ assert_eq!(rows, ["Your other computers", "Your cloud"]);assert_eq!(- ids(&c.agents, |p| p.checked),- ["claude-code", "codex", "goose"]+ (d.primary.id.as_str(), d.primary.label.as_str()),+ ("sign-in", "Sign in to connect"));- assert_eq!(c.connects, ["claude-code", "codex", "goose"]);- assert_eq!(c.primary.id, "continue");- let cursor = c.agents.iter().find(|p| p.agent == "cursor").unwrap();- assert_eq!(cursor.note.as_deref(), Some("Not found on this Mac"));- // Nothing read yet: the common ones, none ticked.- let none_yet = view(&FirstRunInput::default()).connect.unwrap();- assert_eq!(ids(&none_yet.agents, |_| true), FEATURED);- assert!(none_yet.agents.iter().all(|p| !p.checked) && none_yet.more.is_empty());- }-- /// Drift guard: every agent the setup's registry knows is on step 1- /// exactly once, so a newly supported agent shows up without an edit- /// here; and every agent this file names is one the registry knows.- #[test]- fn every_registry_agent_is_on_step_one() {- let registry: Vec<FirstRunAgent> = cua_agent_setup::AGENTS- .iter()- .map(|a| agent(a.id, a.name, false))- .collect();- let c = connect(registry.clone(), None);- let mut listed = ids(&c.agents, |_| true);- listed.extend(ids(&c.more, |_| true));- let mut want: Vec<String> = registry.iter().map(|a| a.agent.clone()).collect();- listed.sort();- want.sort();- assert_eq!(listed, want);- let known = |id: &str| cua_agent_setup::registry::find(id).is_some_and(|a| a.id == id);- for id in FEATURED- .iter()- .chain(OFFERED.iter())- .chain(AGENT_KEYS.iter().map(|(a, _)| a))- {- assert!(known(id), "{id} is not a registry id");- }- // The agents with a sign-in the setup can start get a row for it.- for a in cua_agent_setup::AGENTS.iter().filter(|a| a.login.is_some()) {- let mut row = agent(a.id, a.name, true);- row.sign_in = a.login.map(|l| l.label.to_string());- let c = connect(vec![row], Some(&[a.id]));- assert!(- c.credentials- .iter()- .any(|r| r.id == format!("sign-in:{}", a.id)),- "{}",- a.id- );- }- }-- #[test]- fn none_is_a_choice() {- let c = connect(vec![claude(false), codex(true, false)], Some(&[]));- assert!(c.agents.iter().all(|p| !p.checked));- assert!(c.connects.is_empty() && c.credentials.is_empty());- assert_eq!(c.primary.label, "Continue");- // Step 2 with none: no agent row and no first request; done once this Mac is.- let mut i = setup();- i.picked = Some(vec![]);- let v = view(&i);- let st = s(&v);- assert_eq!(st.rows.len(), 1);- assert_eq!(st.rows[0].id, "computer");- assert!(st.prompt.is_none());- assert_eq!(st.title, "This Mac is ready.");- assert!(st.primary.enabled);- assert_eq!(v.art.agent, "other");- let t = todos(&i);- assert!(t.items.iter().all(|x| x.id != "agent" && x.id != "prompt"));- assert!(t.complete);- assert_eq!(t.lede, "You're all set.");- }+ assert_eq!(d.secondary.as_ref().unwrap().id, "not-now");+ assert_eq!(d.note.as_deref(), Some("This Mac works without it."));+ assert!(d.status.is_none());- #[test]- fn one_or_several_and_set_up_ones_stay_ticked() {- // Codex only.- let c = connect(vec![claude(false), codex(true, false)], Some(&["codex"]));- assert_eq!(ids(&c.agents, |p| p.checked), ["codex"]);- assert_eq!(c.connects, ["codex"]);- // Several, with one that already uses Cua: it can't be unticked here.- let c = connect(- vec![- claude(true),- codex(true, false),- agent("hermes", "Hermes", true),- ],- Some(&["codex", "hermes"]),- );+ i.signing_in = true;assert_eq!(- ids(&c.agents, |p| p.checked),- ["claude-code", "codex", "hermes"]+ view(&i).devices.unwrap().status.unwrap().state,+ RowState::Checking);- assert_eq!(ids(&c.agents, |p| p.locked), ["claude-code"]);- assert_eq!(c.connects, ["codex", "hermes"]);- let mut i = FirstRunInput {- agents: Some(vec![- claude(true),- codex(true, false),- agent("hermes", "Hermes", true),- ]),- picked: Some(vec!["codex".into(), "hermes".into()]),- connecting: true,- ..Default::default()- };- assert_eq!(- view(&i).connect.unwrap().busy.as_deref(),- Some("Adding Cua to OpenAI Codex and Hermes…")- );- // Step 2 names them all.- i.step = FirstRunStep::Setup;- i.connecting = false;- i.picked = Some(vec!["claude-code".into(), "codex".into()]);- i.agents = Some(vec![- claude(true),- FirstRunAgent {- configured: true,- ..codex(true, false)- },- ]);- i.signed_in = true;- i.host = Some(ready_host());- i.host_os = "macos".into();- let v = view(&i);- let st = s(&v);- assert_eq!(st.title, "Your agents can use this Mac.");- assert_eq!(st.rows[0].title, "Claude Code and OpenAI Codex can use Cua");- assert_eq!(- st.prompt.as_ref().unwrap().heading,- "Try this in Claude Code or OpenAI Codex"- );- // One not set up yet: the fix names only it.- i.agents = Some(vec![claude(true), codex(true, false)]);- let v = view(&i);- assert_eq!(s(&v).rows[0].title, "Connect OpenAI Codex");- assert_eq!(- s(&v).rows[0].note,- "Cua isn't in OpenAI Codex's settings yet."- );- }- #[test]- fn codex_signs_in_on_this_computer_and_keys_stay_here() {- // Codex only: its ChatGPT sign-in and the OpenAI key, never the Anthropic one.- let c = connect(vec![claude(false), codex(true, false)], Some(&["codex"]));- let rows: Vec<_> = c.credentials.iter().map(|r| r.id.as_str()).collect();- assert_eq!(rows, ["sign-in:codex", "key:openai"]);- let chatgpt = &c.credentials[0];- assert_eq!(chatgpt.title, "ChatGPT sign-in");- assert_eq!(chatgpt.note, "OpenAI Codex uses it on this Mac");- assert_eq!(chatgpt.action.as_ref().unwrap().id, "agent-sign-in");- assert_eq!(chatgpt.agent.as_deref(), Some("codex"));- let openai = &c.credentials[1];- assert_eq!(- (openai.title.as_str(), openai.status.as_deref()),- ("OpenAI key", None)- );- assert_eq!(openai.action.as_ref().unwrap().id, "add-key");- // Both: the Anthropic key is saved, so it says so and asks nothing.- let c = connect(- vec![claude(false), codex(true, true)],- Some(&["claude-code", "codex"]),- );- let rows: Vec<_> = c- .credentials- .iter()- .map(|r| (r.id.as_str(), r.status.as_deref(), r.action.is_some()))- .collect();- assert_eq!(- rows,- [- ("sign-in:codex", Some("Signed in"), false),- ("key:anthropic", Some("Saved"), false),- ("key:openai", None, true),- ]- );- assert!(c.credentials.iter().all(|r| r.ok == r.status.is_some()));- // Waiting for the browser, then a failure to start.- let mut i = FirstRunInput {- agents: Some(vec![codex(true, false)]),- picked: Some(vec!["codex".into()]),- agent_signing_in: Some("codex".into()),- ..Default::default()- };- let row = view(&i).connect.unwrap().credentials[0].clone();- assert_eq!(row.status.as_deref(), Some("Finish in your browser…"));- assert!(!row.ok, "a wait is not a done status");- assert!(row.action.is_none());- i.agent_signing_in = None;- i.agent_sign_in_error = Some("codex: not found".into());- let row = view(&i).connect.unwrap().credentials[0].clone();- assert_eq!(- row.error.as_deref(),- Some("Couldn't start the sign-in: codex: not found")- );- // Codex not installed here: nothing to start yet.- i.agents = Some(vec![codex(false, false)]);- assert!(view(&i).connect.unwrap().credentials[0].action.is_none());- // Keys this app can't read: only the sign-in.- i.keys = Some(crate::agent_keys::AgentKeysInput {- unavailable: Some("no vault".into()),+ i.signing_in = false;+ i.signed_in = true;+ i.host_setting_up = true;+ i.host = Some(FirstRunHost::default());+ let d = view(&i).devices.unwrap();+ assert_eq!(d.title, "Adding this Mac to your account.");+ assert_eq!(d.primary.id, "continue");+ assert!(d.secondary.is_none());+ assert_eq!(d.status.as_ref().unwrap().state, RowState::Checking);++ i.host_setting_up = false;+ i.host = Some(FirstRunHost {+ configured: true,+ running: true,..Default::default()});- assert_eq!(view(&i).connect.unwrap().credentials.len(), 1);- }-- #[test]- fn step_one_says_what_stays_on_this_computer() {- let c = connect(- vec![claude(false), codex(true, false)],- Some(&["claude-code", "codex"]),- );- assert_eq!(- c.agents_note,- "Cua adds its skills and MCP server to each one you pick, on this Mac only. Your other computers set up their own."- );- assert_eq!(c.credentials_label, "Sign-ins and keys");- assert_eq!(- c.credentials_note,- "They stay on this Mac. Other computers keep their own."- );- // Nothing follows the Cua account: the page never says it does.- let all = serde_json::to_string(&c).unwrap().to_lowercase();- for claim in ["account", "everywhere", "any computer", "sync"] {- assert!(!all.contains(claim), "{claim}");- }- let pc = view(&FirstRunInput {- host_os: "windows".into(),- ..Default::default()- })- .connect- .unwrap();- assert_eq!(pc.agents_label, "On this PC");- assert!(pc.agents_note.contains("on this PC only"));- // Linux (and anything else): "this computer"; never "Mac" off a Mac.- let mut linux_in = FirstRunInput {- host_os: "linux".into(),- agents: Some(vec![codex(true, false)]),- picked: Some(vec!["codex".into()]),- ..Default::default()- };- let linux = view(&linux_in).connect.unwrap();- assert_eq!(linux.agents_label, "On this computer");+ let d = view(&i).devices.unwrap();+ assert_eq!(d.title, "This Mac is in your account.");+ let ok = d.status.unwrap();assert_eq!(- linux.credentials_note,- "They stay on this computer. Other computers keep their own."+ (ok.state, ok.title.as_str()),+ (RowState::Ok, "This Mac is in your account"));++ // No permission is asked here, even when one is missing.+ i.host.as_mut().unwrap().permissions = vec![FirstRunPermission {+ id: "accessibility".into(),+ granted: false,+ settings_url: None,+ }];assert_eq!(- linux.credentials[0].note,- "OpenAI Codex uses it on this computer"+ view(&i).devices.unwrap().status.unwrap().state,+ RowState::Ok);- for os in ["linux", "windows"] {- linux_in.host_os = os.into();- let all = serde_json::to_string(&view(&linux_in)).unwrap();- assert!(!all.contains("Mac"), "{os}: {all}");- }}#[test]- fn ready_when_both_rows_pass() {- let v = view(&setup());- let s = s(&v);- assert_eq!(s.title, "Your agent can use this Mac.");- assert_eq!(s.rows[1].title, "This Mac is your first Space");+ fn the_try_screen_waits_for_the_lead_agent_and_done_is_never_blocked() {+ let mut i = FirstRunInput {+ picked: Some(vec!["codex".into(), "hermes".into()]),+ ..input(FirstRunStep::Setup, vec![codex(true, false), hermes()])+ };+ let s = view(&i).setup.unwrap();+ assert_eq!(s.title, "Try it in Hermes.");+ assert_eq!(s.lede, "Paste this. Hermes makes the Space itself.");+ let p = s.prompt.unwrap();+ assert_eq!(p.text, TRY_PROMPT);+ assert_eq!(p.copy.as_deref(), Some("Copy"));+ assert_eq!(s.status.as_ref().unwrap().title, "Waiting for Hermes…");assert!(s.primary.enabled);- assert_eq!(s.primary.label, "Done");- // macOS first, then Linux.- assert_eq!(s.extra.choices[0].os, "macos");- assert_eq!(s.extra.choices[1].detail, "Ready in about 2 min");- assert!(s.upsell.is_none());- }-- #[test]- fn checking_keeps_done_off() {- let mut i = setup();- i.host = None;- let v = view(&i);- assert_eq!(s(&v).title, "Checking your setup.");- assert!(!s(&v).primary.enabled);- assert_eq!(v.art.computer, "faded");- }-- #[test]- fn fixes_turn_done_into_finish_later() {- let mut i = setup();- i.host.as_mut().unwrap().permissions[0].granted = false;- i.host.as_mut().unwrap().permissions[0].settings_url =- Some("x-apple.systempreferences:a".into());- let v = view(&i);- let s = s(&v);- assert_eq!(s.title, "One step left.");- assert_eq!(s.rows[1].title, "Let Cua control this Mac");- assert_eq!(- s.rows[1].settings_url.as_deref(),- Some("x-apple.systempreferences:a")- );- assert_eq!(s.primary.id, "finish-later");-- let mut i = setup();- i.signed_in = false;- assert_eq!(s_title(&i), "One step left.");+ i.agent_used_at = Some("18:12".into());+ let s = view(&i).setup.unwrap();+ let st = s.status.unwrap();assert_eq!(- view(&i).setup.unwrap().rows[1].action.as_ref().unwrap().id,- "sign-in"+ (st.state, st.title.as_str()),+ (RowState::Ok, "Hermes used Cua at 18:12."));-- let mut i = setup();- i.agent_open_before_setup = Some(true);- assert_eq!(view(&i).setup.unwrap().rows[0].title, "Restart Claude Code");- }-- fn s_title(i: &FirstRunInput) -> String {- view(i).setup.unwrap().title+ assert_eq!(view(&i).art.extra, "on");+ i.host_os = "windows".into();+ assert_eq!(view(&i).setup.unwrap().prompt.unwrap().text, TRY_PROMPT_PC);}#[test]- fn creating_never_blocks_done() {- let mut i = setup();- i.extra = FirstRunExtra {- phase: "creating".into(),- name: Some("macOS 1".into()),- os: Some("macos".into()),- detail: Some("Downloading macOS · 4.2 of 22.3 GB".into()),- fraction: Some(0.19),- error: None,+ fn with_no_agent_the_try_screen_offers_a_first_space() {+ let mut i = FirstRunInput {+ offers: vec![+ FirstRunOffer {+ os: "linux".into(),+ time: Some("about 2 min".into()),+ ..Default::default()+ },+ FirstRunOffer {+ os: "macos".into(),+ time: Some("10 to 30 min the first time".into()),+ size: Some("22 GB download".into()),+ blocked: Some("Needs Apple silicon".into()),+ ..Default::default()+ },+ ],+ ..input(FirstRunStep::Setup, vec![])};- let v = view(&i);- assert_eq!(s(&v).extra.title, "Making macOS 1 in the background");- assert!(s(&v).primary.enabled);- assert_eq!(v.art.extra, "filling");+ let s = view(&i).setup.unwrap();+ assert_eq!(s.title, "Try a first Space.");+ assert!(s.prompt.is_none());+ let x = s.extra.unwrap();+ let ids: Vec<&str> = x.choices.iter().map(|c| c.id.as_str()).collect();+ assert_eq!(ids, ["linux"]);+ assert_eq!(x.choices[0].detail, "Ready in about 2 min");+ i.extra.phase = "creating".into();+ let x = view(&i).setup.unwrap().extra.unwrap();+ assert_eq!(x.action.unwrap().id, "cancel");+ assert!(view(&i).setup.unwrap().primary.enabled);+ assert_eq!(view(&i).art.extra, "filling");}#[test]- fn the_card_shows_only_after_the_first_success() {- let mut i = setup();+ fn no_plan_in_the_first_run() {+ let mut i = input(FirstRunStep::Setup, vec![claude(true)]);+ i.agent_used_at = Some("18:12".into());i.plan = Some(FirstRunPlan {metered: true,plan: "free".into(),+ account_app: "https://app.cua.ai".into(),..Default::default()});- assert!(s(&view(&i)).upsell.is_none());- i.agent_used_at = Some("18:12".into());- let v = view(&i);- let u = s(&v).upsell.clone().unwrap();- assert_eq!(u.plan, "pro");- assert_eq!(- u.lines[1],- "Pro: 200 remote hours a month · 5 connections at once"- );- assert!(!u.title.to_lowercase().contains("sleep"));- assert_eq!(s(&v).rows[0].note, "It used Cua at 18:12.");- i.plan.as_mut().unwrap().teammates = true;- assert_eq!(s(&view(&i)).upsell.clone().unwrap().plan, "teams");- i.plan.as_mut().unwrap().dismissed = true;- assert!(s(&view(&i)).upsell.is_none());+ for step in [+ FirstRunStep::Welcome,+ FirstRunStep::Connect,+ FirstRunStep::Devices,+ FirstRunStep::Setup,+ ] {+ i.step = step;+ let all = serde_json::to_string(&view(&i)).unwrap();+ assert!(!all.contains("Pro"), "{step:?}: {all}");+ assert!(!all.contains("$"), "{step:?}: {all}");+ }+ // The card itself still answers for the moments after.+ assert_eq!(upsell(i.plan.as_ref().unwrap(), true).unwrap().plan, "pro");}#[test]@@ -1940,33 +1960,63 @@ mod tests {}#[test]- fn todos_after_finish_later() {- let mut i = setup();- i.host.as_mut().unwrap().permissions[0].granted = false;+ fn todos_treat_sign_in_as_optional() {+ let mut i = FirstRunInput {+ picked: Some(vec!["claude-code".into()]),+ ..input(FirstRunStep::Setup, vec![claude(true)])+ };let t = todos(&i);- assert_eq!(t.progress, "2 of 5 done");- assert!(!t.complete);- assert_eq!(t.items[1].title, "Let Cua control this Mac");- i.host = Some(ready_host());+ let sign_in = t.items.iter().find(|x| x.id == "sign-in").unwrap();+ assert!(sign_in.optional && !sign_in.done);+ let computer = t.items.iter().find(|x| x.id == "computer").unwrap();+ assert!(computer.optional);+ assert!(!t.complete, "the first request is still to do");i.agent_used_at = Some("18:12".into());- assert!(todos(&i).complete);+ assert!(todos(&i).complete, "complete without signing in");+ i.signed_in = true;+ i.host = Some(FirstRunHost {+ configured: true,+ running: true,+ permissions: vec![FirstRunPermission {+ id: "accessibility".into(),+ granted: false,+ settings_url: None,+ }],+ ..Default::default()+ });+ let t = todos(&i);+ assert!(!t.complete, "signed in, a permission is still missing");+ assert_eq!(+ t.items.iter().find(|x| x.id == "computer").unwrap().title,+ "Let Cua control this Mac"+ );}#[test]fn plain_words() {- let mut i = setup();- i.extra.phase = "creating".into();- let all = serde_json::to_string(&view(&i)).unwrap().to_lowercase();- for word in [- "vm",- "virtual machine",- "container",- "mcp",- "daemon",- "host",- "your space is ready",+ let mut i = FirstRunInput {+ picked: Some(vec!["codex".into()]),+ ..input(FirstRunStep::Welcome, vec![codex(true, false), hermes()])+ };+ for step in [+ FirstRunStep::Welcome,+ FirstRunStep::Connect,+ FirstRunStep::Devices,+ FirstRunStep::Setup,] {- assert!(!all.contains(&format!(" {word}")), "{word}");+ i.step = step;+ let all = serde_json::to_string(&view(&i)).unwrap().to_lowercase();+ for word in [+ "vm",+ "virtual machine",+ "container",+ "mcp",+ "daemon",+ "host",+ "your space is ready",+ ] {+ assert!(!all.contains(&format!(" {word}")), "{step:?}: {word}");+ }}}}diff --git a/libs/cua/crates/cua-spaces-app-core/src/parity.rs b/libs/cua/crates/cua-spaces-app-core/src/parity.rsindex 56e954d2f6..d1b94dec5d 100644--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs@@ -3323,9 +3323,9 @@ fn patched(base: &Value, patch: &Value) -> Value {}/// Each case's first-run screen (`firstRun.view`) as small frames: the-/// headline, the rows, the first request, the extra Space card, the plan-/// card, the main button and the art; with Home's to-do list-/// (`firstRun.todos`) where the case asks.+/// screen's headline and lines (the agents, what signing in connects, the+/// first request and its status, the first Space card), its buttons and the+/// art; with Home's to-do list (`firstRun.todos`) where the case asks.fn run_first_run(f: &Value, h: &dyn Host) -> Result<Value, String> {let mut frames = Vec::new();for case in f["cases"].as_array().into_iter().flatten() {@@ -3344,31 +3344,73 @@ fn run_first_run(f: &Value, h: &dyn Host) -> Result<Value, String> {"step": v["step"],"art": format!("{} {} {}", s(&v["art"]["agent"]), s(&v["art"]["computer"]), s(&v["art"]["extra"])),});+ let row = |r: &Value| {+ format!(+ "[{}] {} — {}{}",+ s(&r["state"]),+ s(&r["title"]),+ s(&r["note"]),+ if r["action"].is_object() {+ format!(" ({})", btn(&r["action"]))+ } else {+ String::new()+ }+ )+ };+ if v["welcome"].is_object() {+ let k = &v["welcome"];+ frame["welcome"] =+ json!({ "title": k["title"], "lede": k["lede"], "primary": btn(&k["primary"]) });+ }if v["connect"].is_object() {let k = &v["connect"];- // "[x] Claude Code", "[ ] Cursor (Not found on this Mac)", "[=] ..." locked.- let picks = |key: &str| -> Vec<String> {- k[key]- .as_array()- .into_iter()- .flatten()- .map(|p| {- let mark = if p["locked"].as_bool() == Some(true) {- "="- } else if p["checked"].as_bool() == Some(true) {- "x"+ // "Hermes (~/.hermes/config.yaml) connect:Connect", "Codex (…) [Connected]".+ let agents: Vec<String> = k["agents"]+ .as_array()+ .into_iter()+ .flatten()+ .map(|p| {+ format!(+ "{}{}{}{}",+ s(&p["name"]),+ if p["file"].is_string() {+ format!(" ({})", s(&p["file"]))} else {- " "- };- let note = if p["note"].is_string() {- format!(" ({})", s(&p["note"]))+ String::new()+ },+ if p["note"].is_string() {+ format!(" [{}]", s(&p["note"]))} else {String::new()- };- format!("[{mark}] {}{note}", s(&p["name"]))- })- .collect()- };+ },+ if p["action"].is_object() {+ format!(" {}", btn(&p["action"]))+ } else {+ String::new()+ },+ )+ })+ .collect();+ let alternatives: Vec<String> = k["alternatives"]+ .as_array()+ .into_iter()+ .flatten()+ .map(|a| {+ format!(+ "{}: {} — {}{}",+ s(&a["id"]),+ s(&a["title"]),+ s(&a["note"]),+ if a["command"].is_string() {+ format!(" `{}`", s(&a["command"]))+ } else if a["url"].is_string() {+ format!(" <{}>", s(&a["url"]))+ } else {+ String::new()+ }+ )+ })+ .collect();let creds: Vec<String> = k["credentials"].as_array().into_iter()@@ -3396,84 +3438,78 @@ fn run_first_run(f: &Value, h: &dyn Host) -> Result<Value, String> {)}).collect();- let connects: Vec<String> = k["connects"]- .as_array()- .into_iter()- .flatten()- .map(&s)- .collect();frame["connect"] = json!({"title": k["title"],"lede": k["lede"],- "intro": k["intro"],- "agents": format!("{}: {}", s(&k["agentsLabel"]), picks("agents").join(", ")),- "more": format!("{}: {}", s(&k["moreLabel"]), picks("more").join(", ")),- "agentsNote": k["agentsNote"],+ "agents": agents,+ "alternatives": alternatives,"credentials": if creds.is_empty() { Value::Null } else {- json!(format!("{} ({}): {}", s(&k["credentialsLabel"]), s(&k["credentialsNote"]), creds.join(" / ")))+ json!(format!("{}: {}", s(&k["credentialsNote"]), creds.join(" / ")))},"primary": btn(&k["primary"]),- "connects": connects.join(", "),- "busy": k["busy"],+ "secondary": btn(&k["secondary"]),+ "error": k["error"],});}- if v["setup"].is_object() {- let k = &v["setup"];+ if v["devices"].is_object() {+ let k = &v["devices"];let rows: Vec<String> = k["rows"].as_array().into_iter().flatten()- .map(|r| {- format!(- "[{}] {} — {}{}",- s(&r["state"]),- s(&r["title"]),- s(&r["note"]),- if r["action"].is_object() {- format!(" ({})", btn(&r["action"]))- } else {- String::new()- }- )- })- .collect();- let x = &k["extra"];- let choices: Vec<String> = x["choices"]- .as_array()- .into_iter()- .flatten()- .map(|o| {- format!(- "{}: {}{}",- s(&o["label"]),- s(&o["detail"]),- if o["blocked"].is_string() {- format!(" (blocked: {})", s(&o["blocked"]))- } else {- String::new()- }- )- })+ .map(|r| format!("{} — {}", s(&r["title"]), s(&r["note"]))).collect();- frame["setup"] = json!({+ frame["devices"] = json!({"title": k["title"],+ "lede": k["lede"],"rows": rows,- "prompt": if k["prompt"].is_object() {- json!(format!("{}: {} / {}", s(&k["prompt"]["heading"]), s(&k["prompt"]["text"]), s(&k["prompt"]["note"])))- } else { Value::Null },- "extra": {+ "status": if k["status"].is_object() { json!(row(&k["status"])) } else { Value::Null },+ "primary": btn(&k["primary"]),+ "secondary": btn(&k["secondary"]),+ "note": k["note"],+ });+ }+ if v["setup"].is_object() {+ let k = &v["setup"];+ let extra = if k["extra"].is_object() {+ let x = &k["extra"];+ let choices: Vec<String> = x["choices"]+ .as_array()+ .into_iter()+ .flatten()+ .map(|o| {+ format!(+ "{} {}: {}{}",+ s(&o["id"]),+ s(&o["label"]),+ s(&o["detail"]),+ if o["blocked"].is_string() {+ format!(" (blocked: {})", s(&o["blocked"]))+ } else {+ String::new()+ }+ )+ })+ .collect();+ json!({"phase": x["phase"],"title": x["title"],"note": x["note"],"choices": choices,"action": btn(&x["action"]),"footnote": x["footnote"],- },- "upsell": if k["upsell"].is_object() {- let u = &k["upsell"];- let lines: Vec<String> = u["lines"].as_array().into_iter().flatten().map(&s).collect();- json!(format!("{} | {} | {} | {} | {}", s(&u["plan"]), s(&u["title"]), lines.join(" / "), s(&u["price"]), btn(&u["cta"])))+ })+ } else {+ Value::Null+ };+ frame["setup"] = json!({+ "title": k["title"],+ "lede": k["lede"],+ "prompt": if k["prompt"].is_object() {+ json!(format!("{}: {} / {}", s(&k["prompt"]["heading"]), s(&k["prompt"]["text"]), s(&k["prompt"]["note"])))} else { Value::Null },+ "status": if k["status"].is_object() { json!(row(&k["status"])) } else { Value::Null },+ "extra": extra,"primary": format!("{}{}", btn(&k["primary"]), if k["primary"]["enabled"].as_bool() == Some(true) { "" } else { " (off)" }),});}diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rsindex 8466ebc2ba..3b75439082 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs@@ -10140,6 +10140,10 @@ pub struct AppChecklistState {pub dismissed: bool,/// It was on screen once (`checklist_shown` was recorded).pub shown: bool,+ /// Steps skipped ("Skip"), each once, in checklist order: they count as+ /// done for the progress and for `complete`, and a skipped step done+ /// later shows as done.+ pub skipped: Vec<AppChecklistStep>,}/// `checklist::ChecklistAction`.@@ -10153,7 +10157,12 @@ pub enum AppChecklistAction {},/// The checklist is on screen.Shown,- /// Closed with ×.+ /// "Skip" on a step: not for this person; it counts as done.+ Skip {+ /// The step.+ step: AppChecklistStep,+ },+ /// Closed with × ("Hide", or "Done" once complete).Dismiss,/// Getting Started (the palette, the Help menu): open it again.Reopen,@@ -10214,6 +10223,8 @@ pub struct AppChecklistRow {pub action: String,/// Done (ticked, struck through).pub done: bool,+ /// Skipped (struck through, not ticked); never with `done`.+ pub skipped: bool,}/// The checklist as drawn.@@ -10232,6 +10243,10 @@ pub struct AppChecklistView {pub progress: String,/// The close button's accessibility label.pub close_label: String,+ /// "Skip", on each step not done or skipped.+ pub skip_label: String,+ /// "Hide", or "Done" once complete: closes the checklist.+ pub hide_label: String,/// The steps in order.pub rows: Vec<AppChecklistRow>,}diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 2a2c2dd6cc..c99a632e17 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -6619,6 +6619,10 @@ public struct AppChecklistRow: Equatable, Hashable {* Done (ticked, struck through).*/public var done: Bool+ /**+ * Skipped (struck through, not ticked); never with `done`.+ */+ public var skipped: Bool// Default memberwise initializers are never public by default, so we// declare one manually.@@ -6637,12 +6641,16 @@ public struct AppChecklistRow: Equatable, Hashable {*/action: String,/*** Done (ticked, struck through).- */done: Bool) {+ */done: Bool,+ /**+ * Skipped (struck through, not ticked); never with `done`.+ */skipped: Bool) {self.step = stepself.title = titleself.detail = detailself.action = actionself.done = done+ self.skipped = skipped}@@ -6665,7 +6673,8 @@ public struct FfiConverterTypeAppChecklistRow: FfiConverterRustBuffer {title: FfiConverterString.read(from: &buf),detail: FfiConverterString.read(from: &buf),action: FfiConverterString.read(from: &buf),- done: FfiConverterBool.read(from: &buf)+ done: FfiConverterBool.read(from: &buf),+ skipped: FfiConverterBool.read(from: &buf))}@@ -6675,6 +6684,7 @@ public struct FfiConverterTypeAppChecklistRow: FfiConverterRustBuffer {FfiConverterString.write(value.detail, into: &buf)FfiConverterString.write(value.action, into: &buf)FfiConverterBool.write(value.done, into: &buf)+ FfiConverterBool.write(value.skipped, into: &buf)}}@@ -6793,6 +6803,12 @@ public struct AppChecklistState: Equatable, Hashable {* It was on screen once (`checklist_shown` was recorded).*/public var shown: Bool+ /**+ * Steps skipped ("Skip"), each once, in checklist order: they count as+ * done for the progress and for `complete`, and a skipped step done+ * later shows as done.+ */+ public var skipped: [AppChecklistStep]// Default memberwise initializers are never public by default, so we// declare one manually.@@ -6805,10 +6821,16 @@ public struct AppChecklistState: Equatable, Hashable {*/dismissed: Bool,/*** It was on screen once (`checklist_shown` was recorded).- */shown: Bool) {+ */shown: Bool,+ /**+ * Steps skipped ("Skip"), each once, in checklist order: they count as+ * done for the progress and for `complete`, and a skipped step done+ * later shows as done.+ */skipped: [AppChecklistStep]) {self.done = doneself.dismissed = dismissedself.shown = shown+ self.skipped = skipped}@@ -6829,7 +6851,8 @@ public struct FfiConverterTypeAppChecklistState: FfiConverterRustBuffer {try AppChecklistState(done: FfiConverterSequenceTypeAppChecklistStep.read(from: &buf),dismissed: FfiConverterBool.read(from: &buf),- shown: FfiConverterBool.read(from: &buf)+ shown: FfiConverterBool.read(from: &buf),+ skipped: FfiConverterSequenceTypeAppChecklistStep.read(from: &buf))}@@ -6837,6 +6860,7 @@ public struct FfiConverterTypeAppChecklistState: FfiConverterRustBuffer {FfiConverterSequenceTypeAppChecklistStep.write(value.done, into: &buf)FfiConverterBool.write(value.dismissed, into: &buf)FfiConverterBool.write(value.shown, into: &buf)+ FfiConverterSequenceTypeAppChecklistStep.write(value.skipped, into: &buf)}}@@ -6947,6 +6971,14 @@ public struct AppChecklistView: Equatable, Hashable {* The close button's accessibility label.*/public var closeLabel: String+ /**+ * "Skip", on each step not done or skipped.+ */+ public var skipLabel: String+ /**+ * "Hide", or "Done" once complete: closes the checklist.+ */+ public var hideLabel: String/*** The steps in order.*/@@ -6973,6 +7005,12 @@ public struct AppChecklistView: Equatable, Hashable {/*** The close button's accessibility label.*/closeLabel: String,+ /**+ * "Skip", on each step not done or skipped.+ */skipLabel: String,+ /**+ * "Hide", or "Done" once complete: closes the checklist.+ */hideLabel: String,/*** The steps in order.*/rows: [AppChecklistRow]) {@@ -6982,6 +7020,8 @@ public struct AppChecklistView: Equatable, Hashable {self.detail = detailself.progress = progressself.closeLabel = closeLabel+ self.skipLabel = skipLabel+ self.hideLabel = hideLabelself.rows = rows}@@ -7007,6 +7047,8 @@ public struct FfiConverterTypeAppChecklistView: FfiConverterRustBuffer {detail: FfiConverterString.read(from: &buf),progress: FfiConverterString.read(from: &buf),closeLabel: FfiConverterString.read(from: &buf),+ skipLabel: FfiConverterString.read(from: &buf),+ hideLabel: FfiConverterString.read(from: &buf),rows: FfiConverterSequenceTypeAppChecklistRow.read(from: &buf))}@@ -7018,6 +7060,8 @@ public struct FfiConverterTypeAppChecklistView: FfiConverterRustBuffer {FfiConverterString.write(value.detail, into: &buf)FfiConverterString.write(value.progress, into: &buf)FfiConverterString.write(value.closeLabel, into: &buf)+ FfiConverterString.write(value.skipLabel, into: &buf)+ FfiConverterString.write(value.hideLabel, into: &buf)FfiConverterSequenceTypeAppChecklistRow.write(value.rows, into: &buf)}}@@ -49099,7 +49143,15 @@ public enum AppChecklistAction: Equatable, Hashable {*/case shown/**- * Closed with ×.+ * "Skip" on a step: not for this person; it counts as done.+ */+ case skip(+ /**+ * The step.+ */step: AppChecklistStep+ )+ /**+ * Closed with × ("Hide", or "Done" once complete).*/case dismiss/**@@ -49157,14 +49209,17 @@ public struct FfiConverterTypeAppChecklistAction: FfiConverterRustBuffer {case 2: return .shown- case 3: return .dismiss+ case 3: return .skip(step: try FfiConverterTypeAppChecklistStep.read(from: &buf)+ )++ case 4: return .dismiss- case 4: return .reopen+ case 5: return .reopen- case 5: return .observe(otherMachine: try FfiConverterBool.read(from: &buf), hasSpace: try FfiConverterBool.read(from: &buf), agentRan: try FfiConverterBool.read(from: &buf)+ case 6: return .observe(otherMachine: try FfiConverterBool.read(from: &buf), hasSpace: try FfiConverterBool.read(from: &buf), agentRan: try FfiConverterBool.read(from: &buf))- case 6: return .merge(state: try FfiConverterTypeAppChecklistState.read(from: &buf)+ case 7: return .merge(state: try FfiConverterTypeAppChecklistState.read(from: &buf))default: throw UniffiInternalError.unexpectedEnumCase@@ -49184,23 +49239,28 @@ public struct FfiConverterTypeAppChecklistAction: FfiConverterRustBuffer {writeInt(&buf, Int32(2))- case .dismiss:+ case let .skip(step):writeInt(&buf, Int32(3))+ FfiConverterTypeAppChecklistStep.write(step, into: &buf)- case .reopen:+ case .dismiss:writeInt(&buf, Int32(4))- case let .observe(otherMachine,hasSpace,agentRan):+ case .reopen:writeInt(&buf, Int32(5))+++ case let .observe(otherMachine,hasSpace,agentRan):+ writeInt(&buf, Int32(6))FfiConverterBool.write(otherMachine, into: &buf)FfiConverterBool.write(hasSpace, into: &buf)FfiConverterBool.write(agentRan, into: &buf)case let .merge(state):- writeInt(&buf, Int32(6))+ writeInt(&buf, Int32(7))FfiConverterTypeAppChecklistState.write(state, into: &buf)}