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
fix(spaces): plain message when a Mac cannot run Spaces, and first-run fixes (CUA-3063) (#6323)
Francesco Bonacci7f3b4dd742d1
diff --git a/apps/cua-spaces-macos/README.md b/apps/cua-spaces-macos/README.mdindex 4117972d28..32d41412b5 100644--- a/apps/cua-spaces-macos/README.md+++ b/apps/cua-spaces-macos/README.md@@ -14,7 +14,7 @@ window) and the bridge to the app core.|---|---|| Main window | The shared web UI (`apps/cua-spaces-web`) in a `WKWebView` (below): Spaces, a Space's page, New Space, Machines, Agents, the Keyvault, Cua Volume, Settings. A real window dragged onto a Space tile drops on it || Space window | A Space's desktop in its own native window (video stays native) |-| Onboarding | The shared web onboarding (`/onboarding` in `apps/cua-spaces-web`), in the web UI window; the app draws none of its own. The page asks and finishes it through `onboarding.get` and `onboarding.complete` (the state is `onboarding.json`); a Space it creates posts a "<Space> is ready" notification (`notifyWhenReady`) that opens the Space. A launch (or a window that opens again) while it is not done opens `/onboarding?due=1`: the page goes to Spaces instead when the person chose "Skip for now" (kept in the page's storage), so the welcome does not come back at every launch; Settings → Welcome and the sidebar's "Finish setting up" open it without `due` and always show it |+| Onboarding | The shared web onboarding (`/onboarding` in `apps/cua-spaces-web`), in the web UI window; the app draws none of its own. The page asks and finishes it through `onboarding.get` and `onboarding.complete` (the state is `onboarding.json`); a Space it creates posts a "<Space> is ready" notification (`notifyWhenReady`) that opens the Space. A launch (or a window that opens again) while it is not done opens `/onboarding?due=1`: the page goes to Spaces instead when the person chose "Skip for now" (kept in the page's storage), so the welcome does not come back at every launch. The app's first launch on a Mac (no `onboarding.json` yet) opens `/onboarding?fresh=1` instead, which forgets a "Skip for now" the page kept from an earlier install; Settings → Welcome and the sidebar's "Finish setting up" open it without `due` and always show it || Devices | Settings → Trusted devices: this Mac's enrollment (enrolled until, grace ends, needs enrollment), the account's devices with Rename and Revoke, Recent Access; the Enroll sheet (sign in again, or a one-time code approved from an enrolled device), the approval sheet for a device asking to join (a notification too, which opens this page; Approve asks for Touch ID or the login password), and a banner on every page when this Mac needs enrolling || Menu bar | The Cua mark (template); status line, Open, New Space, Settings, Quit || Launch at login | Settings → General: `SMAppService.mainApp`, showing what macOS reports (on, off, waiting for approval with a button to Login Items, not found); the first run's Done page (the web onboarding's) ticks it. A login launch opens without the main window, and the app's daemon (host Spaces, persistent agents, Cua Volume) starts with it |diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swiftindex 3137f7a0e9..1dfcc86ff5 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/OnboardingModel.swift@@ -17,6 +17,10 @@ public final class OnboardingModel {public private(set) var completed: Bool/// What the first run chose: this Mac as a host, or a client.public private(set) var mode: AppOnboardingMode+ /// No state file yet: the app's very first launch here. The first run+ /// then opens even if the page kept a "Skip for now" from an earlier+ /// install (`markSeen` ends it).+ public private(set) var firstLaunch: Boollet statePath: String?/// Done's "Launch at login" checkbox, applied when the first run/// finishes (the app registers it, or not).@@ -27,6 +31,19 @@ public final class OnboardingModel {let saved = statePath.flatMap { Self.read($0) }self.completed = saved?.completed ?? falseself.mode = saved?.mode ?? .client+ self.firstLaunch = statePath.map { !FileManager.default.fileExists(atPath: $0) } ?? false+ }++ /// The first run was shown at the first launch: saved as not done, so+ /// later launches keep to the page's "Skip for now".+ public func markSeen() {+ guard firstLaunch else { return }+ firstLaunch = false+ guard let statePath, !FileManager.default.fileExists(atPath: statePath) else { return }+ let url = URL(fileURLWithPath: statePath)+ try? FileManager.default.createDirectory(at: url.deletingLastPathComponent(),+ withIntermediateDirectories: true)+ try? Data("{\"completed\":false,\"mode\":\"client\"}".utf8).write(to: url, options: .atomic)}/// "Start using Cua Spaces": saved to the state file.diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swiftindex 769a1932ae..427a641eb4 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift@@ -390,7 +390,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate {// for a start view (`applyStartView` opens its own page). The page// draws the launch (`startup.get`) until the live services are in.if !Self.launchedAtLogin {- if let route = MainUIRouter.launchRoute(onboarded: model.onboarding.completed) {+ if let route = MainUIRouter.launchRoute(onboarded: model.onboarding.completed,+ firstLaunch: model.onboarding.firstLaunch) {+ model.onboarding.markSeen()WebUIWindowController.show(model: model, at: route)} else if DevHooks.value("CUA_SPACES_START_VIEW") == nil {WebUIWindowController.show(model: model)diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swiftindex c568b20768..08cfc396cd 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/MainUIRoute.swift@@ -35,6 +35,10 @@ public enum MainUIRoute: Equatable, Sendable {/// launch. The page keeps that choice, `due` asks it to honour it.static let firstRunDue = MainUIRoute.path("/onboarding?due=1")+ /// The first run at the app's first launch here: the page forgets what+ /// it kept from an earlier install (a "Skip for now", half-done steps).+ static let firstLaunch = MainUIRoute.path("/onboarding?fresh=1")+/// The page's path, query included.var webPath: String {switch self {@@ -93,7 +97,9 @@ struct MainUIRouter {/// The main window as the person left it, or the first run while it is/// due (`launchRoute`): the Dock icon, Open, ⌘⇧Space, the notch's list.func openMain() {- if let route = Self.launchRoute(onboarded: model.onboarding.completed) {+ if let route = Self.launchRoute(onboarded: model.onboarding.completed,+ firstLaunch: model.onboarding.firstLaunch) {+ model.onboarding.markSeen()web(route)} else if WebUIWindowController.shared != nil {// Open already: in front, on the page it shows.@@ -105,9 +111,12 @@ struct MainUIRouter {/// Where a window opens while the first run may be due: its page until it/// is done (`.firstRunDue`, which keeps a "Skip for now"), else nil (the- /// page the window shows, or Spaces).- static func launchRoute(onboarded: Bool) -> MainUIRoute? {- onboarded ? nil : .firstRunDue+ /// page the window shows, or Spaces). The app's first launch here always+ /// shows it (`.firstLaunch`): a "Skip for now" the page kept from an+ /// earlier install must not hide it from a new user (CUA-3063).+ static func launchRoute(onboarded: Bool, firstLaunch: Bool = false) -> MainUIRoute? {+ if onboarded { return nil }+ return firstLaunch ? .firstLaunch : .firstRunDue}/// The page a click on one of the app's notifications opens: a Space thatdiff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swiftindex 39bf148241..b66709994e 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/FirstRunTests.swift@@ -49,6 +49,26 @@ struct FirstRunTests {#expect(MainUIRoute.onboarding.webPath == "/onboarding", "Show again has no due: it always shows")}+ /// The app's first launch here opens the first run whatever the page+ /// kept from an earlier install (a stale "Skip for now" hid it behind+ /// the sidebar's small "Finish setting up", CUA-3063); from the next+ /// launch on, `due` applies again.+ @Test func theFirstLaunchAlwaysShowsTheFirstRun() throws {+ #expect(MainUIRoute.firstLaunch.webPath == "/onboarding?fresh=1")+ #expect(MainUIRouter.launchRoute(onboarded: false, firstLaunch: true) == .firstLaunch)+ #expect(MainUIRouter.launchRoute(onboarded: true, firstLaunch: true) == nil)+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-firstlaunch-\(UUID().uuidString)")+ let path = dir.appendingPathComponent("onboarding.json").path+ let first = OnboardingModel(statePath: path)+ #expect(first.firstLaunch && !first.completed)+ first.markSeen()+ #expect(!first.firstLaunch)+ let next = OnboardingModel(statePath: path)+ #expect(!next.firstLaunch && !next.completed, "seen, not done")+ #expect(MainUIRouter.launchRoute(onboarded: next.completed, firstLaunch: next.firstLaunch) == .firstRunDue)+ try? FileManager.default.removeItem(at: dir)+ }+// MARK: - onboarding.get, onboarding.complete@Test func theFirstRunIsDueUntilItFinishesAndPersists() async throws {diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swiftindex 21f0bce36d..2f6e32316b 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MainUIRouteTests.swift@@ -59,8 +59,10 @@ struct MainUIRouteTests {router.openMain()m.onboarding.finish()router.openMain()- #expect(web == [.firstRunDue, .home])+ // The model's state file does not exist yet: the app's first launch here.+ #expect(web == [.firstLaunch, .home])#expect(MainUIRouter.launchRoute(onboarded: false) == .firstRunDue)+ #expect(MainUIRouter.launchRoute(onboarded: false, firstLaunch: true) == .firstLaunch)#expect(MainUIRouter.launchRoute(onboarded: true) == nil)}diff --git a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx b/apps/cua-spaces-web/src/__tests__/first-run.test.tsxindex b7b9ee7382..73f34987aa 100644--- a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/first-run.test.tsx@@ -128,7 +128,7 @@ const noAgents = (rows: AgentSetupRow[]) => rows.map((r) => ({ ...r, installed:describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("asks once, naming the apps found, and connects nothing until Set up", async () => {const calls = await mount();- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toBe("Let your 6 coding apps use Cua?"));// The apps found here, most preferred first; nothing connected by itself, no per-app buttons or file paths.@@ -153,18 +153,18 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("Not now moves on and sets up nothing, and Cua never sets up later installs on its own", async () => {const calls = await mount();- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));click("[data-first-run-secondary]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));expect(calls.some((c) => c.op === "agents.configure")).toBe(false);expect(connectedAppsState().auto).toBe(false);});it("says plainly which app needs a hand, with Try again and the text to paste", { timeout: 30_000 }, async () => {await mount({ demo: { agentsReadOnly: ["cursor"] }, agents: (rows) => rows.map((r) => ({ ...r, installed: ["codex", "cursor"].includes(r.agent) })) });- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toBe("Let OpenAI Codex and Cursor use Cua?"));click("[data-first-run-set-up]");@@ -187,7 +187,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("walks Welcome, the question, Connect your machines and Try it, connecting only what is asked", async () => {const calls = await mount({ agents: onlyCodex });- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toBe("Let OpenAI Codex use Cua?"));click("[data-first-run-set-up]");@@ -196,8 +196,8 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {expect(readFirstRun().picked).toEqual(["codex"]);expect(calls.filter((c) => c.op === "agents.connect")).toHaveLength(1);click("[data-onboarding-primary]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));- expect(document.querySelector("[data-first-run-devices]")!.textContent).toMatch(/Your other machines.*Your cloud/);+ await waitFor(() => expect(heading()).toBe("Add your other computers."));+ 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."));@@ -224,11 +224,11 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {.flatMap((c) => (c.args as { signals: { type: string; page: string; action: string; choice: string }[] }).signals).filter((s) => s.type === "onboarding-page" && s.action.startsWith("step_")).map((s) => `${s.page} ${s.action}${s.choice === "none" ? "" : ` ${s.choice}`}`);- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));click("[data-first-run-secondary]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));click("[data-first-run-secondary]");await waitFor(() => expect(document.querySelector("[data-step]")?.getAttribute("data-step")).toBe("setup"));click("[data-onboarding-later]");@@ -260,7 +260,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {},answer: (op, out) => (op === "settings.get" ? { ...(out as object), telemetry: { ...(out as { telemetry: object }).telemetry, enabled: false } } : out),});- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));await new Promise((r) => setTimeout(r, 50));@@ -269,7 +269,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("Back works from every step after Welcome, all the way to Welcome, keeping what was picked", async () => {const calls = await mount({ agents: onlyCodex });- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));expect(document.querySelector("[data-first-run-back]")).toBeNull();click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));@@ -277,17 +277,17 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {await waitFor(() => expect(readFirstRun().picked).toEqual(["codex"]));await waitFor(() => expect(heading()).toBe("OpenAI Codex can use Cua."));click("[data-onboarding-primary]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));click("[data-first-run-secondary]");await waitFor(() => expect(heading()).toBe("Try it in OpenAI Codex."));// Try it → Connect your devices → Pick your agent → Welcome.click("[data-first-run-back]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));click("[data-first-run-back]");await waitFor(() => expect(heading()).toMatch(ASK));expect(document.querySelector<HTMLElement>('[data-first-run-agent="codex"]')!.dataset.connected).toBe("true");click("[data-first-run-back]");- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));// Going back only navigates: nothing was connected again or undone.expect(readFirstRun().picked).toEqual(["codex"]);expect(calls.filter((c) => c.op === "agents.connect")).toHaveLength(1);@@ -296,7 +296,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("Back sits above the heading, apart from the choices; Tab goes primary, secondary, Back; Esc goes back", async () => {writeFirstRun({ step: "devices" });await mount();- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));const step = document.querySelector<HTMLElement>('[data-first-run="devices"]')!;const back = step.querySelector<HTMLElement>("[data-first-run-back]")!;// Drawn first (above the heading), but last in the page's order.@@ -310,10 +310,10 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {fireEvent.keyDown(window, { key: "Escape" });await waitFor(() => expect(heading()).toMatch(ASK));fireEvent.keyDown(window, { key: "Escape" });- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));// Welcome has no Back, so Esc stays.fireEvent.keyDown(window, { key: "Escape" });- expect(heading()).toBe("Your machines, shared by your team and its agents.");+ expect(heading()).toBe("Your computers, shared by your team and its agents.");});it("shows no sign-ins or keys: those live in Settings, Connections", async () => {@@ -327,7 +327,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("Sign in starts the one sign-in; Not now skips it", async () => {writeFirstRun({ step: "devices" });const calls = await mount();- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));expect(document.body.textContent).toMatch(/You can sign in later\./);click('[data-first-run-devices-primary="sign-in"]');await waitFor(() => expect(calls.some((c) => c.op === "session.signIn")).toBe(true));@@ -335,7 +335,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("a disk-image install offers the Cua CLI after Pick your agent: the exact file, then Install only when pressed", async () => {const calls = await mount({ cli: "missing" });- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));// The install plan is read: the run has the CLI's screen.@@ -354,7 +354,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {expect(document.querySelector("[data-first-run-cli-done]")!.textContent).toMatch(/cua spaces ls/);await waitFor(() => expect(document.querySelector('[data-first-run-cli-primary="continue"]')!.textContent).toBe("Continue"));click('[data-first-run-cli-primary="continue"]');- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));// Back shows the result again.click("[data-first-run-back]");await waitFor(() => expect(heading()).toBe("Cua is ready in Terminal."));@@ -362,7 +362,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {it("Not now leaves the CLI as it is; with the CLI already installed there is no such screen", async () => {const calls = await mount({ cli: "missing" });- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));// The install plan is read: the run has the CLI's screen.@@ -370,18 +370,18 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {click("[data-first-run-secondary]");await waitFor(() => expect(heading()).toBe("Use Cua from the Terminal."));click("[data-first-run-secondary]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));expect(calls.some((c) => c.op === "cli.install")).toBe(false);cleanup();localStorage.clear();resetSavedOnboardingCache();resetFirstRunCache();await mount();- await waitFor(() => expect(heading()).toBe("Your machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toMatch(ASK));click("[data-first-run-secondary]");- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));});it("a signed-in Mac that shares its screen asks for two permissions in its own words, and Allow opens the guide", async () => {@@ -470,7 +470,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {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 machines, shared by your team and its agents."));+ await waitFor(() => expect(heading()).toBe("Your computers, shared by your team and its agents."));click("[data-onboarding-primary]");await waitFor(() => expect(heading()).toBe("We didn\u2019t find a coding app yet."));expect(agents()).toEqual([]);@@ -480,7 +480,7 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {expect(document.body.textContent).toMatch(/Spaces work without a coding app\./);expect(screen.getByRole("button", { name: "Check again" })).toBeTruthy();fireEvent.click(screen.getByRole("button", { name: "Continue without one" }));- await waitFor(() => expect(heading()).toBe("Add your other machines."));+ await waitFor(() => expect(heading()).toBe("Add your other computers."));click("[data-first-run-secondary]");await waitFor(() => expect(heading()).toBe("Try a first Space."));const linux = await waitFor(() => {diff --git a/apps/cua-spaces-web/src/bridge/first-run.ts b/apps/cua-spaces-web/src/bridge/first-run.tsindex 6bd9eb647e..2d2ca3e9c8 100644--- a/apps/cua-spaces-web/src/bridge/first-run.ts+++ b/apps/cua-spaces-web/src/bridge/first-run.ts@@ -156,7 +156,7 @@ const rank = (id: string) => {/** Without the core: the screens in their plainest state. Not the* product's behaviour; the demo and tests without wasm use it. */function fallbackView(input: FirstRunInput): FirstRunView {- const place = input.hostOs === "macos" ? "this Mac" : input.hostOs === "windows" ? "this PC" : "this machine";+ const place = input.hostOs === "macos" ? "this Mac" : input.hostOs === "windows" ? "this PC" : "this computer";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));@@ -202,7 +202,7 @@ function fallbackView(input: FirstRunInput): FirstRunView {};}case "welcome":- return { ...base, welcome: { title: "Your machines, shared by your team and its agents.", lede: `Run agents in Spaces on ${place}, or on any computer your team connects.`, primary: { id: "start", label: "Get started" } } };+ return { ...base, welcome: { title: "Your computers, shared by your team and its agents.", lede: `Run agents in Spaces on ${place}, or on any computer your team connects.`, primary: { id: "start", label: "Get started" } } };case "connect":return {...base,@@ -225,10 +225,10 @@ function fallbackView(input: FirstRunInput): FirstRunView {return {...base,devices: {- title: input.signedIn ? `${Place} is in your account.` : "Add your other machines.",- lede: `Sign in to Cua here and on your other machines. Then they can all use ${place}'s Spaces.`,+ title: input.signedIn ? `${Place} is in your account.` : "Add your other computers.",+ lede: `Sign in to Cua here and on your other computers. Then they can all use ${place}'s Spaces.`,rows: [- { title: "Your other machines", note: "Sign in on each one" },+ { title: "Your other computers", note: "Sign in on each one" },{ title: "Your cloud", note: "Hetzner, AWS, Google Cloud or Modal" },],status: null,diff --git a/apps/cua-spaces-web/src/components/shell/sidebar.tsx b/apps/cua-spaces-web/src/components/shell/sidebar.tsxindex 1aaaad1c92..a7a2688758 100644--- a/apps/cua-spaces-web/src/components/shell/sidebar.tsx+++ b/apps/cua-spaces-web/src/components/shell/sidebar.tsx@@ -177,7 +177,14 @@ export function AccountFooter({ trailing }: { trailing?: ReactNode }) {return (<div className={cn("mt-auto", footer.state === "signedIn" ? "px-2.5 pt-1 pb-2.5" : "border-t px-3 py-2.5")} data-signin={footer.state}>{unfinished ? (- <Link to="/onboarding" className="mb-2 block text-xs text-muted-foreground hover:text-foreground">+ // A real button, not a small grey line: a new user who skipped the+ // first run has to find it again (CUA-3063).+ <Link+ to="/onboarding"+ data-finish-setup+ className="mb-2 flex items-center gap-2 rounded-lg bg-accent px-2.5 py-2 text-sm font-medium text-foreground hover:bg-accent/70"+ >+ <CuaKey size={18} />Finish setting up</Link>) : null}diff --git a/apps/cua-spaces-web/src/routes/onboarding/index.tsx b/apps/cua-spaces-web/src/routes/onboarding/index.tsxindex 24738c04cb..5f40f0286b 100644--- a/apps/cua-spaces-web/src/routes/onboarding/index.tsx+++ b/apps/cua-spaces-web/src/routes/onboarding/index.tsx@@ -6,7 +6,7 @@ import { ArrowLeftIcon, CheckIcon, CopyIcon, ExternalLinkIcon } from "lucide-reaimport { useEffect, useState, type ReactNode } from "react";import { useAgentKeys, useBridge, useFirstRun, useSpaces, type FirstRunArt, type FirstRunCredential, type FirstRunExtraView, type FirstRunHook, type FirstRunRow, type FirstRunView } from "@/bridge";-import { readSavedOnboarding } from "@/bridge/onboarding";+import { readSavedOnboarding, writeSavedOnboarding } from "@/bridge/onboarding";import { AddAgentSheet } from "@/components/add-agent/add-agent-sheet";import { APP_MARKS, AppMarkImage } from "@/components/agents/harness-mark";import { CuaLogo } from "@/components/cua-logo";@@ -29,9 +29,16 @@ export const Route = createFileRoute("/onboarding/")({// root route does for a host that opens the app at `/`. Every other way in// (the sidebar's "Finish setting up", Settings, the command palette) has// no `due` and always shows the first run.- validateSearch: (s: Record<string, unknown>): { due?: true } => (s.due === 1 || s.due === "1" || s.due === true ? { due: true as const } : {}),+ // `?fresh=1` is the Mac app's first launch on this computer: what the+ // page kept from an earlier install (a "Skip for now", a half-done run) is+ // forgotten, so a new user always sees the first run (CUA-3063).+ validateSearch: (s: Record<string, unknown>): { due?: true; fresh?: true } => {+ const on = (v: unknown) => v === 1 || v === "1" || v === true;+ return { ...(on(s.due) ? { due: true as const } : {}), ...(on(s.fresh) ? { fresh: true as const } : {}) };+ },beforeLoad: ({ search }) => {- if (search.due && readSavedOnboarding().skipped) throw redirect({ to: "/spaces" });+ if (search.fresh) writeSavedOnboarding(null);+ else if (search.due && readSavedOnboarding().skipped) throw redirect({ to: "/spaces" });},component: OnboardingPage,});diff --git a/libs/cua/crates/cua-agent-setup/src/lib.rs b/libs/cua/crates/cua-agent-setup/src/lib.rsindex ea0d7f1d4a..c9986b22dc 100644--- a/libs/cua/crates/cua-agent-setup/src/lib.rs+++ b/libs/cua/crates/cua-agent-setup/src/lib.rs@@ -63,6 +63,31 @@ use std::{path::{Path, PathBuf},};+/// Whether the config file at `path` holds nothing but its servers object+/// (`mcpServers`, `mcp_servers`): what cua writes into a file the agent never+/// created. Unreadable or unparsable (comments, another format): no.+fn holds_only_servers(path: &Path, m: &McpSpec) -> bool {+ let Some(key) = m.key_path.first() else {+ return false;+ };+ let Ok(text) = std::fs::read_to_string(path) else {+ return false;+ };+ if text.trim().is_empty() {+ return true;+ }+ match m.format {+ Format::Json => serde_json::from_str::<Value>(&text)+ .ok()+ .and_then(|v| v.as_object().map(|o| o.keys().all(|k| k == key)))+ .unwrap_or(false),+ Format::Toml => text+ .parse::<toml_edit::DocumentMut>()+ .is_ok_and(|d| d.as_table().iter().all(|(k, _)| k == *key)),+ Format::Yaml => false,+ }+}+/// Errors.#[derive(Debug, thiserror::Error)]pub enum Error {@@ -656,6 +681,40 @@ impl AgentSetup {.unwrap_or_else(|| m.file.resolve(&self.env))}+ /// Whether `marker` (one of `a`'s markers) holds only what cua's own+ /// setup writes there: an MCP config file cua created with nothing but+ /// its servers in it, or a folder with nothing but that file and the+ /// skills folder (an empty folder is not). Cua's setup must not make an agent look installed+ /// (Claude Code "Ready" on a Mac without it, after `~/.claude.json` and+ /// `~/.claude/skills` were written).+ fn only_cua_wrote(&self, marker: &Path, a: ®istry::AgentSpec) -> bool {+ let mcp = a.mcp.as_ref().map(|m| (self.mcp_file(m), m));+ let skills = a.skills.map(|l| l.resolve(&self.env));+ let cua_config = |f: &Path| {+ mcp.as_ref()+ .is_some_and(|(file, m)| file == f && holds_only_servers(f, m))+ };+ if marker.is_file() {+ return cua_config(marker);+ }+ let Ok(entries) = std::fs::read_dir(marker) else {+ return false;+ };+ // An empty folder is the agent's (cua writes something into each).+ let mut cua_only = false;+ for e in entries.flatten() {+ let p = e.path();+ if e.file_name() == ".DS_Store" {+ continue;+ }+ if !(cua_config(&p) || skills.as_ref().is_some_and(|s| s.starts_with(&p))) {+ return false;+ }+ cua_only = true;+ }+ cua_only+ }+/// Detects every registry agent (read-only).pub fn detect(&self) -> Vec<AgentStatus> {let state = State::load(&self.state_path).unwrap_or_default();@@ -742,7 +801,7 @@ impl AgentSetup {}for m in a.markers {let p = m.resolve(&self.env);- if p.exists() {+ if p.exists() && !self.only_cua_wrote(&p, a) {evidence.push(format!("path:{}", p.display()));}}diff --git a/libs/cua/crates/cua-agent-setup/tests/agents.rs b/libs/cua/crates/cua-agent-setup/tests/agents.rsindex de1979761b..3d16059fe1 100644--- a/libs/cua/crates/cua-agent-setup/tests/agents.rs+++ b/libs/cua/crates/cua-agent-setup/tests/agents.rs@@ -1339,3 +1339,35 @@ fn sign_in_runs_the_agents_own_login_and_detect_sees_it() {let a = s.detect().into_iter().find(|a| a.id == "codex").unwrap();assert!(a.installed && a.signed_in, "{a:?}");}++/// Cua's own setup (its entry in a new `~/.claude.json`, its skills under+/// `~/.claude/skills`) is no sign Claude Code is installed: the first run+/// showed "Ready" on a Mac without it (CUA-3063).+#[test]+fn what_cua_writes_does_not_make_an_agent_installed() {+ let t = T::new();+ let s = t.setup();+ let claude = |s: &AgentSetup| {+ s.detect()+ .into_iter()+ .find(|a| a.id == "claude-code")+ .unwrap()+ };+ assert!(!claude(&s).installed);+ s.configure_mcp(&ids(&["claude-code"]), &server()).unwrap();+ s.install_skills(&ids(&["claude-code"]), &[], false)+ .unwrap();+ let after = claude(&s);+ assert!(after.cua_configured, "{after:?}");+ assert!(!after.installed, "{:?}", after.evidence);+ // Codex: cua's config.toml alone is not Codex either.+ s.configure_mcp(&ids(&["codex"]), &server()).unwrap();+ let codex = s.detect().into_iter().find(|a| a.id == "codex").unwrap();+ assert!(!codex.installed, "{:?}", codex.evidence);+ // What the agent writes itself does count.+ t.write(".claude/settings.json", "{}");+ assert!(claude(&s).installed);+ let t = T::new();+ t.write(".claude.json", "{\"numStartups\": 3}");+ assert!(claude(&t.setup()).installed);+}diff --git a/libs/cua/crates/cua-agents/runner/test/helpers.mjs b/libs/cua/crates/cua-agents/runner/test/helpers.mjsindex e2492f9a8a..9eb759a831 100644--- a/libs/cua/crates/cua-agents/runner/test/helpers.mjs+++ b/libs/cua/crates/cua-agents/runner/test/helpers.mjs@@ -18,16 +18,34 @@ export function sdkRoot() {path.join(os.homedir(), ".cua", "tools", "acp-sdk", SDK_VERSION),path.join(os.tmpdir(), `cua-acp-sdk-${SDK_VERSION}`),].filter(Boolean);- // The entry the runner imports, not just package.json: a cache an interrupted- // install or a temp-dir sweep left half-written is installed again.- const has = (d) => fs.existsSync(path.join(d, "node_modules", "@agentclientprotocol", "sdk", "dist", "acp.js"));+ // The entry the runner imports and its zod dependency, not just package.json:+ // a cache an interrupted or racing install or a temp-dir sweep left+ // half-written is installed again.+ const has = (d) =>+ ["@agentclientprotocol/sdk/dist/acp.js", "zod/v4/index.js"].every((f) =>+ fs.existsSync(path.join(d, "node_modules", ...f.split("/"))),+ );for (const c of candidates) if (has(c)) return c;const target = candidates[candidates.length - 1];- // npm takes a half-written package for installed: start that cache over.- fs.rmSync(path.join(target, "node_modules"), { recursive: true, force: true });- fs.mkdirSync(target, { recursive: true });- const r = spawnSync("npm", ["install", "--no-audit", "--no-fund", "--prefix", target, `@agentclientprotocol/sdk@${SDK_VERSION}`], { stdio: "ignore" });- return r.status === 0 && has(target) ? target : null;+ // Install into a private directory, then move it into place, so parallel test+ // processes never see (or delete) each other's half-written node_modules.+ const tmp = fs.mkdtempSync(`${target}-install-`);+ const r = spawnSync("npm", ["install", "--no-audit", "--no-fund", "--prefix", tmp, `@agentclientprotocol/sdk@${SDK_VERSION}`], { stdio: "ignore" });+ if (r.status !== 0 || !has(tmp)) {+ fs.rmSync(tmp, { recursive: true, force: true });+ return has(target) ? target : null;+ }+ if (!has(target)) {+ fs.rmSync(target, { recursive: true, force: true });+ try {+ fs.renameSync(tmp, target);+ return target;+ } catch {+ // another process won the race+ }+ }+ fs.rmSync(tmp, { recursive: true, force: true });+ return has(target) ? target : null;}export class Box {diff --git a/libs/cua/crates/cua-cli/tests/agents_login.rs b/libs/cua/crates/cua-cli/tests/agents_login.rsindex d8586d0f6d..87c79c33e1 100644--- a/libs/cua/crates/cua-cli/tests/agents_login.rs+++ b/libs/cua/crates/cua-cli/tests/agents_login.rs@@ -32,6 +32,14 @@ fn mkdirs(h: &Home, rels: &[&str]) {}}+/// Files only the agent itself writes, so cua's own setup output in the same+/// folder doesn't make the agent look uninstalled.+fn agent_owned(h: &Home, rels: &[&str]) {+ for r in rels {+ std::fs::write(h.dir.path().join(r), "{}").unwrap();+ }+}+#[derive(Default)]struct IssuerLog {challenge: Option<String>,@@ -250,6 +258,7 @@ async fn login_falls_back_to_device_when_loopback_is_not_allowed_and_remote_skipasync fn agents_commands_round_trip_and_protect_malformed_files() {let h = home();mkdirs(&h, &[".codex", ".cursor", ".gemini"]);+ agent_owned(&h, &[".codex/auth.json"]);std::fs::write(h.dir.path().join(".gemini/settings.json"),"{\"mcpServers\": {",@@ -666,6 +675,7 @@ async fn the_local_cli_leaves_cua_driver_alone_even_when_it_registered_it_first(async fn agents_setup_cua_driver_adds_the_driver_skill_and_server() {let h = home();mkdirs(&h, &[".codex", ".claude"]);+ agent_owned(&h, &[".codex/auth.json", ".claude/settings.json"]);std::fs::write(h.dir.path().join(".codex/config.toml"),"[mcp_servers.other]\ncommand = \"o\"\n",@@ -1155,6 +1165,7 @@ async fn interactive_login_onboarding_prompts() {.set("CUA_OIDC_POLL_UNIT_MS", "5").set("CUA_AUTH_FLOW", "device");mkdirs(&h, &[".claude", ".codex"]);+ agent_owned(&h, &[".claude/settings.json", ".codex/auth.json"]);let h = h;tokio::task::spawn_blocking(move || {// Yes to onboarding, default (yes) to skills, no to MCP.diff --git a/libs/cua/crates/cua-create-failure/src/preflight.rs b/libs/cua/crates/cua-create-failure/src/preflight.rsindex 390e8bae13..a6a54fa724 100644--- a/libs/cua/crates/cua-create-failure/src/preflight.rs+++ b/libs/cua/crates/cua-create-failure/src/preflight.rs@@ -106,6 +106,10 @@ pub enum VirtGap {KvmMissing,/// Linux: `/dev/kvm` exists but this user may not open it.KvmPermission,+ /// macOS: this Mac cannot run virtual machines at all (it is itself a+ /// virtual machine, or an Intel Mac without hardware virtualization).+ /// Linux containers need it too, for the built-in Linux runtime.+ MacUnsupported,}/// What the host found, `None` / `NotChecked` for what it did not check.@@ -181,6 +185,7 @@ impl IssueKind {} else if has(DENIED_MARK) || has("find devices on your network") {Some(Self::LocalNetwork)} else if has("hypervisor platform")+ || has(MAC_UNSUPPORTED_MARK)|| has("virtualization is turned off")|| has("isn't allowed to use this computer's virtualization"){@@ -194,6 +199,19 @@ impl IssueKind {/// What [`IssueKind::of_text`] finds in [`local_network_denied`]'s sentence/// (lowercase).const DENIED_MARK: &str = "privacy & security \u{203a} local network";+/// What [`IssueKind::of_text`] finds in [`MAC_UNSUPPORTED`] (lowercase).+const MAC_UNSUPPORTED_MARK: &str = "this mac can't run spaces itself";++/// The sentence for a Mac that cannot run virtual machines+/// ([`VirtGap::MacUnsupported`]): what is wrong, and what to do instead.+pub const MAC_UNSUPPORTED: &str = "This Mac can't run Spaces itself, because it can't run \+ virtual computers. That happens when the Mac is itself a virtual machine, or is an older \+ Intel Mac. Add another computer to your account, or link your own cloud, and create the \+ Space there.";++/// The page that shows how to add another computer.+pub const ADD_A_COMPUTER_URL: &str = "https://cua.ai/docs/spaces/guides/add-a-computer";+/// What [`IssueKind::of_text`] finds in [`LOCAL_NETWORK_VPN`] (lowercase).const VPN_MARK: &str = "a vpn or firewall is blocking this mac's own network";@@ -376,10 +394,20 @@ pub fn evaluate(req: &Request, facts: &Facts) -> Vec<Issue> {}}- if req.runs == Runs::Vm- && let Some(gap) = facts.virtualization+ // A Mac's gap stops a Linux container too (the built-in runtime is a+ // VM); the host only reports it when that runtime would be used.+ if let Some(gap) = facts.virtualization+ && (req.runs == Runs::Vm || gap == VirtGap::MacUnsupported){match (gap, req.host, req.guest) {+ (VirtGap::MacUnsupported, Host::Macos, _) => out.push(Issue::new(+ IssueKind::VirtualizationUnavailable,+ MAC_UNSUPPORTED,+ fix(+ "Add a computer",+ FixAction::OpenUrl(ADD_A_COMPUTER_URL.into()),+ ),+ )),(VirtGap::HypervisorPlatformOff, Host::Windows, _) => out.push(Issue::new(IssueKind::VirtualizationUnavailable,"Turn on the Windows Hypervisor Platform feature so this PC can run virtual \@@ -604,6 +632,34 @@ mod tests {assert!(evaluate(&c, &gap(VirtGap::HypervisorPlatformOff)).is_empty());}+ #[test]+ fn a_mac_that_cannot_run_vms_is_told_before_any_create() {+ let facts = Facts {+ virtualization: Some(VirtGap::MacUnsupported),+ ..Default::default()+ };+ for (guest, runs) in [+ (Guest::Linux, Runs::Container),+ (Guest::Linux, Runs::Vm),+ (Guest::Macos, Runs::Vm),+ ] {+ let i = first(&req(Host::Macos, guest, runs), &facts);+ assert_eq!(i.kind, IssueKind::VirtualizationUnavailable);+ assert_eq!(i.message, MAC_UNSUPPORTED);+ assert_eq!(+ i.fix.unwrap().action,+ FixAction::OpenUrl(ADD_A_COMPUTER_URL.into())+ );+ }+ assert_eq!(+ IssueKind::of_text(MAC_UNSUPPORTED),+ Some(IssueKind::VirtualizationUnavailable)+ );+ // Plain words: no jargon, no em dash.+ let l = MAC_UNSUPPORTED.to_lowercase();+ assert!(!l.contains('\u{2014}') && !l.contains("runtime") && !l.contains("hypervisor"));+ }+#[test]fn every_sentence_is_recognised_again() {let everything = Facts {@@ -672,6 +728,13 @@ mod tests {Engine::Ready,Some(VirtGap::KvmPermission),),+ (+ Host::Macos,+ Guest::Linux,+ Runs::Container,+ Engine::NotChecked,+ Some(VirtGap::MacUnsupported),+ ),] {let facts = Facts {engine,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 44cb52af4e..d19fa75211 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@@ -8,7 +8,7 @@"welcome": {"lede": "Run agents in Spaces on this Mac, or on any computer your team connects.","primary": "start:Get started",- "title": "Your machines, shared by your team and its agents."+ "title": "Your computers, shared by your team and its agents."}},{@@ -122,16 +122,16 @@"art": "hermes on outline","case": "08 connect your other devices","devices": {- "lede": "Sign in to Cua here and on your other machines. Then they can all use this Mac's Spaces.",+ "lede": "Sign in to Cua here and on your other computers. Then they can all use this Mac's Spaces.","note": "Not now keeps Cua on this Mac only. You can sign in later.","primary": "sign-in:Sign in","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "not-now:Not now","status": null,- "title": "Add your other machines."+ "title": "Add your other computers."},"step": "devices"},@@ -139,16 +139,16 @@"art": "hermes on outline","case": "09 connect your other devices, signing in","devices": {- "lede": "Sign in to Cua here and on your other machines. Then they can all use this Mac's Spaces.",+ "lede": "Sign in to Cua here and on your other computers. Then they can all use this Mac's Spaces.","note": "Not now keeps Cua on this Mac only. You can sign in later.","primary": "sign-in:Sign in","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "not-now:Not now","status": "[checking] Signing in — Finish signing in to Cua in your browser.",- "title": "Add your other machines."+ "title": "Add your other computers."},"step": "devices"},@@ -156,11 +156,11 @@"art": "hermes on outline","case": "10 this Mac being added to the account","devices": {- "lede": "Sign in on your other machines to use its Spaces.",+ "lede": "Sign in on your other computers to use its Spaces.","note": null,"primary": "continue:Continue","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "",@@ -173,11 +173,11 @@"art": "hermes on outline","case": "11 this Mac in the account","devices": {- "lede": "Sign in on your other machines to use its Spaces.",+ "lede": "Sign in on your other computers to use its Spaces.","note": null,"primary": "continue:Continue","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "",@@ -218,7 +218,7 @@"[ ] Make this Mac your first Space — After you sign in.","[x] Try your first request — Ask Hermes or Claude Code: “Make a Linux Space on this Mac and show its desktop in a new window.”","[ ] Make a first Space (optional) — A separate computer on this Mac, away from your files and your mouse. (add:Add a Space)",- "[ ] Add your other machines (optional) — Sign in to use this Mac's Spaces from your other machines. (sign-in:Sign in)"+ "[ ] Add your other computers (optional) — Sign in to use this Mac's Spaces from your other computers. (sign-in:Sign in)"],"lede": "One thing is left.","progress": "1 of 5 done"@@ -264,7 +264,7 @@"items": ["[ ] Make this Mac your first Space — After you sign in.","[ ] Make a first Space (optional) — A separate computer on this Mac, away from your files and your mouse. (add:Add a Space)",- "[ ] Add your other machines (optional) — Sign in to use this Mac's Spaces from your other machines. (sign-in:Sign in)"+ "[ ] Add your other computers (optional) — Sign in to use this Mac's Spaces from your other computers. (sign-in:Sign in)"],"lede": "You're all set.","progress": "0 of 3 done"@@ -331,7 +331,7 @@"[ ] 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 show its desktop in a new window.” (copy:Copy)","[ ] Make a first Space (optional) — A separate computer on this Mac, away from your files and your mouse. (add:Add a Space)",- "[x] Add your other machines (optional) — Signed in to Cua."+ "[x] Add your other computers (optional) — Signed in to Cua."],"lede": "A couple of things are left.","progress": "1 of 5 done"@@ -512,11 +512,11 @@"art": "hermes on outline","case": "19 this Mac in the account, Continue goes to permissions","devices": {- "lede": "Sign in on your other machines to use its Spaces.",+ "lede": "Sign in on your other computers to use its Spaces.","note": null,"primary": "continue:Continue","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "",@@ -648,16 +648,16 @@"art": "hermes on outline","case": "25 not signed in: Not now skips permissions","devices": {- "lede": "Sign in to Cua here and on your other machines. Then they can all use this Mac's Spaces.",+ "lede": "Sign in to Cua here and on your other computers. Then they can all use this Mac's Spaces.","note": "Not now keeps Cua on this Mac only. You can sign in later.","primary": "sign-in:Sign in","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "not-now:Not now","status": null,- "title": "Add your other machines."+ "title": "Add your other computers."},"step": "devices","steps": [@@ -690,11 +690,11 @@"art": "hermes on outline","case": "27 a Windows PC: no permissions screen","devices": {- "lede": "Sign in on your other machines to use its Spaces.",+ "lede": "Sign in on your other computers to use its Spaces.","note": null,"primary": "continue:Continue","rows": [- "Your other machines — Sign in with the same account",+ "Your other computers — Sign in with the same account","Your cloud — Hetzner, AWS, Google Cloud or Modal"],"secondary": "",@@ -828,11 +828,11 @@"omarchy Omarchy: 1.7 GB download · about 3 min the first time"],"footnote": null,- "note": "A separate computer on this machine. Pick a system to start it.",+ "note": "A separate computer on this computer. Pick a system to start it.","phase": "choose","title": "Make a first Space"},- "lede": "Spaces run on this machine, away from your files and your mouse.",+ "lede": "Spaces run on this computer, away from your files and your mouse.","primary": "done:Done","prompt": null,"status": null,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 e027407141..5a89986e1f 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@@ -62,14 +62,14 @@ pub const OFFERED: [&str; 5] = PREFERENCE;const AGENT_KEYS: [(&str, &str); 2] = [("claude-code", "anthropic"), ("codex", "openai")];/// Home's to-do request: it works on this computer with nothing else set up.-pub const FIRST_PROMPT: &str = "List my machines and tell me what's on this Mac";-const FIRST_PROMPT_OTHER: &str = "List my machines and tell me what's on this machine";-const FIRST_PROMPT_PC: &str = "List my machines and tell me what's on this PC";+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 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 show its desktop in a new window.";const TRY_PROMPT_OTHER: &str =- "Make a Linux Space on this machine and show its desktop in a new window.";+ "Make a Linux Space on this computer and show its desktop in a new window.";const TRY_PROMPT_PC: &str = "Make a Linux Space on this PC and show its desktop in a new window.";/// The CLI's name when the host did not say (the released app's,@@ -746,7 +746,7 @@ fn this_computer(os: &str) -> &'static str {match os {"macos" => "this Mac","windows" => "this PC",- _ => "this machine",+ _ => "this computer",}}@@ -763,7 +763,7 @@ fn os_name(os: &str) -> &'static str {"linux" => "Linux","omarchy" => "Omarchy","windows" => "Windows",- _ => "a machine",+ _ => "a computer",}}@@ -1062,7 +1062,7 @@ fn default_or(name: &str, id: &str) -> String {fn welcome_view(input: &FirstRunInput) -> WelcomeView {let place = this_computer(&input.host_os);WelcomeView {- title: "Your machines, shared by your team and its agents.".into(),+ title: "Your computers, shared by your team and its agents.".into(),lede: format!("Run agents in Spaces on {place}, or on any computer your team connects."),primary: button("start", "Get started"),}@@ -1217,7 +1217,7 @@ fn devices_view(input: &FirstRunInput) -> DevicesView {let place = this_computer(&input.host_os);let rows = vec![DeviceRow {- title: "Your other machines".into(),+ title: "Your other computers".into(),note: "Sign in with the same account".into(),},DeviceRow {@@ -1234,7 +1234,7 @@ fn devices_view(input: &FirstRunInput) -> DevicesView {} else {format!("Adding {place} to your account.")},- lede: "Sign in on your other machines to use its Spaces.".into(),+ lede: "Sign in on your other computers to use its Spaces.".into(),rows,status,primary: button("continue", "Continue"),@@ -1243,9 +1243,9 @@ fn devices_view(input: &FirstRunInput) -> DevicesView {};}DevicesView {- title: "Add your other machines.".into(),+ title: "Add your other computers.".into(),lede: format!(- "Sign in to Cua here and on your other machines. Then they can all use {place}'s Spaces."+ "Sign in to Cua here and on your other computers. Then they can all use {place}'s Spaces."),rows,status: account_row(input),@@ -1396,7 +1396,7 @@ fn computer_row(input: &FirstRunInput) -> CheckRow {return row(RowState::Fix,"Sign in to Cua".into(),- &format!("So your other machines can reach {place}."),+ &format!("So your other computers can reach {place}."),Some(button("sign-in", "Sign in")),);}@@ -1919,11 +1919,11 @@ pub fn todos(input: &FirstRunInput) -> FirstRunTodos {});items.push(FirstRunTodo {id: "sign-in".into(),- title: "Add your other machines (optional)".into(),+ title: "Add your other computers (optional)".into(),note: if input.signed_in {"Signed in to Cua.".into()} else {- format!("Sign in to use {place}'s Spaces from your other machines.")+ format!("Sign in to use {place}'s Spaces from your other computers.")},done: input.signed_in,optional: true,@@ -2096,7 +2096,7 @@ mod tests {let w = view(&input(FirstRunStep::Welcome, vec![])).welcome.unwrap();assert_eq!(w.title,- "Your machines, shared by your team and its agents."+ "Your computers, shared by your team and its agents.");assert_eq!(w.primary.id, "start");}@@ -2315,13 +2315,13 @@ mod tests {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, "Add your other machines.");+ assert_eq!(d.title, "Add your other computers.");assert_eq!(d.lede,- "Sign in to Cua here and on your other machines. Then they can all use this Mac's Spaces."+ "Sign in to Cua here and on your other computers. Then they can all use this Mac's Spaces.");let rows: Vec<&str> = d.rows.iter().map(|r| r.title.as_str()).collect();- assert_eq!(rows, ["Your other machines", "Your cloud"]);+ assert_eq!(rows, ["Your other computers", "Your cloud"]);assert_eq!((d.primary.id.as_str(), d.primary.label.as_str()),("sign-in", "Sign in")diff --git a/libs/cua/crates/cua-vmm/src/host.rs b/libs/cua/crates/cua-vmm/src/host.rsindex db131de8d0..96d98609c1 100644--- a/libs/cua/crates/cua-vmm/src/host.rs+++ b/libs/cua/crates/cua-vmm/src/host.rs@@ -358,6 +358,35 @@ pub fn kvm_usable() -> std::io::Result<()> {.map(drop)}+/// Whether this Mac can run virtual machines: `kern.hv_support`, the+/// flag Virtualization.framework's `VZVirtualMachineConfiguration.isSupported`+/// rests on. It is 0 on a Mac that is itself a virtual machine (no nested+/// virtualization) and on an Intel Mac without hardware virtualization.+/// `None` off macOS, or when it cannot be read (callers then go ahead).+pub fn mac_virtualization_supported() -> Option<bool> {+ #[cfg(target_os = "macos")]+ {+ let mut buf = [0u8; 4];+ let mut len = buf.len();+ // SAFETY: a NUL-terminated name, an out buffer and its length;+ // sysctlbyname writes at most `len` bytes and updates `len`.+ let r = unsafe {+ libc::sysctlbyname(+ c"kern.hv_support".as_ptr(),+ buf.as_mut_ptr().cast(),+ &mut len,+ std::ptr::null_mut(),+ 0,+ )+ };+ (r == 0 && len == 4).then(|| i32::from_ne_bytes(buf) != 0)+ }+ #[cfg(not(target_os = "macos"))]+ {+ None+ }+}+/// Why `/dev/kvm` could not be opened, and how to fix it.pub fn kvm_hint(e: &std::io::Error) -> String {match e.kind() {diff --git a/libs/cua/crates/cua-vmm/src/managed.rs b/libs/cua/crates/cua-vmm/src/managed.rsindex fd6a1f4b77..4ea44adfc4 100644--- a/libs/cua/crates/cua-vmm/src/managed.rs+++ b/libs/cua/crates/cua-vmm/src/managed.rs@@ -788,6 +788,13 @@ pub async fn ensure() -> Result<String> {"the built-in Linux runtime runs on macOS; install Docker",));}+ // Its VM would never start here: say so now, not after a minute of+ // retries ending in "exit status 1".+ if host::mac_virtualization_supported() == Some(false) {+ return Err(VmmError::other(+ cua_create_failure::preflight::MAC_UNSUPPORTED,+ ));+ }check_path_length()?;let started = std::time::Instant::now();let fresh = !exists();diff --git a/libs/cua/crates/cua-vmm/src/preflight.rs b/libs/cua/crates/cua-vmm/src/preflight.rsindex b714331f6b..a662e8c452 100644--- a/libs/cua/crates/cua-vmm/src/preflight.rs+++ b/libs/cua/crates/cua-vmm/src/preflight.rs@@ -85,6 +85,9 @@ pub async fn gather_waiting(req: &Request, patience: std::time::Duration) -> Fac}if req.runs == Runs::Vm {facts.virtualization = virtualization(req.host);+ } else if req.host == Host::Macos && mac_unsupported() && linux_needs_builtin_runtime().await {+ // A Linux container here runs in the built-in runtime's VM.+ facts.virtualization = Some(VirtGap::MacUnsupported);}if req.host == Host::Macos && req.guest == Guest::Macos {facts.local_network_blocked = local_network_blocked(patience).await;@@ -192,7 +195,24 @@ fn virtualization(host: Host) -> Option<VirtGap> {}Err(_) => Some(VirtGap::KvmMissing),},- Host::Macos => None,+ Host::Macos => mac_unsupported().then_some(VirtGap::MacUnsupported),+ }+}++/// This Mac cannot run virtual machines (it is one itself, or an Intel Mac+/// without hardware virtualization). A Mac that cannot tell counts as able.+fn mac_unsupported() -> bool {+ crate::host::mac_virtualization_supported() == Some(false)+}++/// Whether a Linux container create here would use the built-in runtime+/// (a VM) rather than a container engine already answering on this Mac.+async fn linux_needs_builtin_runtime() -> bool {+ use crate::managed::LinuxSource;+ match LinuxSource::current() {+ LinuxSource::System => false,+ LinuxSource::Builtin => true,+ LinuxSource::Auto => crate::managed::exists() || engine().await != Engine::Ready,}}