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(cua-spaces): show a create's real stages and download progress, also on another machine (#5198)
ddupont13facfffdd95
diff --git a/apps/cua-spaces-desktop/test/bridge-native.test.ts b/apps/cua-spaces-desktop/test/bridge-native.test.tsindex 0cc5038d2c..fbce07258f 100644--- a/apps/cua-spaces-desktop/test/bridge-native.test.ts+++ b/apps/cua-spaces-desktop/test/bridge-native.test.ts@@ -222,6 +222,29 @@ describe.skipIf(!built)("the bridge on the app core", () => {expect(model.spaces.some((s) => s.id === "pending:1")).toBe(false);});+ it("shows a macOS create on another machine downloading, then each step, in the core's words", async () => {+ const GB = 2 ** 30;+ const step = (phase: string, bytes?: [number, number, number]) => ({+ phase,+ fraction: bytes ? bytes[0] / bytes[1] : undefined,+ detail: "ghcr.io/trycua/macos:26",+ bytesDone: bytes ? BigInt(Math.round(bytes[0])) : undefined,+ bytesTotal: bytes ? BigInt(bytes[1]) : undefined,+ bytesPerSecond: bytes ? bytes[2] : undefined,+ });+ backend.phases = [step("preparing"), step("pulling", [12.4 * GB, 30 * GB, 85 * 2 ** 20]), step("ready")];+ let release = () => {};+ backend.hold = new Promise<void>((r) => (release = r));+ const create = bridge.registry.dispatch({ id: "m", method: "spaces.create", args: { pendingId: "pending:mac", config: { image: "macos", kind: "vm", on: "host:mac-mini" }, os: "macos" } });+ await until(() => model.spaces.some((s) => s.id === "pending:mac" && s.progress?.transfer != null));+ const row = model.spaces.find((s) => s.id === "pending:mac")!;+ expect(row.progress).toMatchObject({ label: "Downloading macOS (first time only)…", transfer: "12.4 of 30.0 GB · 85 MB/s · about 4 min" });+ expect(row.progress!.permille).toBeGreaterThan(10);+ expect(row.detail).toBe("Another machine · Downloading macOS (first time only)…");+ release();+ await create;+ });+it("refuses a create it cannot run", async () => {expect(await code("spaces.create", { pendingId: "nope", config: { image: "x", kind: "container" } })).toBe("bad_args");expect(await code("spaces.create", { pendingId: "pending:2", config: { image: "x", kind: "box" } })).toBe("bad_args");diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateStagesTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateStagesTests.swiftnew file mode 100644index 0000000000..92497bdabd--- /dev/null+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateStagesTests.swift@@ -0,0 +1,48 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import CuaSDK+import CuaSpacesFFI+@testable import CuaSpacesMacKit+import Testing++/// A first macOS Space on another machine says what it is doing (CUA-1635):+/// the detail the SwiftUI cover draws names each step, and while the host+/// downloads macOS it shows the bytes, the rate and the time left, with+/// the ring past its 1% floor.+@Suite("Create stages")+struct CreateStagesTests {+ @Test func aMacOSCreateOnAnotherMachineNamesEachStepWithItsDownload() throws {+ let gb: UInt64 = 1 << 30+ var creates = AppCreatesState(pending: [], deleting: [], powering: [])+ creates = appCreatesReduce(state: creates, action: .start(+ id: "pending:mac", name: "", os: .macos, provider: .relay, now: 1_000, image: "macos",+ kind: nil, hostArch: nil, gpu: false, host: "mac-mini", hostName: "Mac mini"))+ func detail() throws -> AppSpaceDetail {+ let row = try #require(appCreatesCompose(spaces: [], state: creates).first { $0.id == "pending:mac" })+ return appSpaceDetail(space: row)+ }+ #expect(try detail().previewText == "Starting\u{2026}")++ creates = appCreatesReduce(state: creates, action: .progress(+ id: "pending:mac", phase: "pulling", fraction: 12.4 / 30, now: 150_000,+ bytesDone: gb * 124 / 10, bytesTotal: 30 * gb, bytesPerSecond: Double(85 << 20)))+ let pulling = try detail()+ #expect(pulling.previewText == "Downloading macOS (first time only)\u{2026}")+ #expect(pulling.progressText == "12.4 of 30.0 GB \u{00B7} 85 MB/s \u{00B7} about 4 min")+ #expect((pulling.progress ?? 0) > 10, "past the 1% floor")++ for (phase, words) in [+ ("creating", "Preparing the disk\u{2026}"),+ ("booting", "Booting macOS\u{2026}"),+ ("waiting_for_services", "Starting Cua inside the Space\u{2026}"),+ ] {+ creates = appCreatesReduce(state: creates, action: .progress(+ id: "pending:mac", phase: phase, fraction: nil, now: 400_000,+ bytesDone: nil, bytesTotal: nil, bytesPerSecond: nil))+ let d = try detail()+ #expect(d.previewText == words)+ #expect(d.progressText == nil, "no download line after the download")+ }+ }+}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swiftindex 7d5e4bc480..f5fe79c68a 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift@@ -53,6 +53,7 @@ struct ParityTests {@Test("experiments") func experiments() throws { try check("experiments", runExperiments) }@Test("placement-picker") func placementPicker() throws { try check("placement-picker", runPlacementPicker) }@Test("checklist") func checklist() throws { try check("checklist", runChecklist) }+ @Test("create-stages") func createStages() throws { try check("create-stages", runProvisioning) }/// The app's own first run records exactly the golden's events: the/// `OnboardingModel` the window drives, on a recording telemetry.@@ -315,13 +316,23 @@ struct ParityTests {// MARK: - provisioning+ /// A flow's provider word (a create on another machine is `relay`).+ func provider(_ word: String) -> AppSpaceProvider {+ switch word {+ case "cloud": return .cloud+ case "relay": return .relay+ case "direct": return .direct+ default: return .local+ }+ }+func createAction(_ a: [String: Any]) -> AppCreateAction {let id = a["id"] as? String ?? ""switch a["type"] as! String {case "start":let kind = (a["kind"] as? String).flatMap { AppSpaceKind(word: $0) }return .start(id: id, name: a["name"] as! String, os: os(a["os"] as! String),- provider: (a["provider"] as! String) == "cloud" ? .cloud : .local,+ provider: provider(a["provider"] as! String),now: Int64(a["now"] as! Int), image: a["image"] as? String, kind: kind,hostArch: a["hostArch"] as? String, gpu: a["gpu"] as? Bool ?? false,host: a["host"] as? String, hostName: a["hostName"] as? String)diff --git a/apps/cua-spaces-web/e2e/flows.ts b/apps/cua-spaces-web/e2e/flows.tsindex 94db90d164..16aa88c6a4 100644--- a/apps/cua-spaces-web/e2e/flows.ts+++ b/apps/cua-spaces-web/e2e/flows.ts@@ -60,6 +60,7 @@ export const FLOW_PLAN: Record<string, FlowPlan> = {"delete-space": { status: "run", screen: "spaces" },"space-power": { status: "run", screen: "spaces" },"create-progress": { status: "run", screen: "spaces" },+ "create-stages": { status: "run", screen: "spaces" },devices: { status: "run", screen: "settings/devices" },"driver-card": { status: "run", screen: "settings" },"share-sheet": { status: "run", screen: "share" },diff --git a/apps/cua-spaces-web/src/__tests__/create-stages.test.tsx b/apps/cua-spaces-web/src/__tests__/create-stages.test.tsxnew file mode 100644index 0000000000..904c844cde--- /dev/null+++ b/apps/cua-spaces-web/src/__tests__/create-stages.test.tsx@@ -0,0 +1,89 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++// A create says which step it is on and, while it downloads, how far, how+// fast and how long is left: on its tile, in the core's words. The same for+// a macOS Space created on another of your machines, whose host reports+// its download through the daemon (CUA-1635: it used to sit at+// "Starting… 1%").++import { act, cleanup, waitFor } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";+import { stageLabelForTest, transferText } from "@/bridge/derive";+import { wasmBuilt } from "@/bridge/__tests__/testCore";+import { mountApp, stubBrowserApis } from "./app-harness";++afterEach(cleanup);+stubBrowserApis();++const GB = 2 ** 30;++describe.skipIf(!wasmBuilt)("a create's stages (wasm core)", () => {+ it("shows a macOS create on another machine downloading, then each step", async () => {+ let pendingId = "";+ let finish!: () => void;+ const done = new Promise<void>((r) => (finish = r));+ const { hooks, emit } = await mountApp("/spaces", {+ failsCreates: false,+ listsGhost: false,+ intercept: (op, args) => {+ if (op !== "spaces.create") return undefined;+ pendingId = (args as { pendingId: string }).pendingId;+ return done.then(() => {+ throw new Error("cancelled: test over");+ });+ },+ });+ await waitFor(() => expect(hooks.spaces.data?.length).toBeGreaterThan(0));+ act(() => void hooks.spaces.createSpace({ image: "macos", os: "macos", on: "host:mac-mini" }).catch(() => {}));+ await waitFor(() => expect(pendingId).not.toBe(""));+ const progress = (phase: string, bytes?: [number, number, number]) =>+ act(() =>+ emit({+ type: "spaces.createProgress",+ progress: {+ pendingId,+ phase,+ fraction: bytes ? bytes[0] / bytes[1] : null,+ detail: "ghcr.io/trycua/macos:26",+ space: "",+ ...(bytes ? { bytesDone: bytes[0], bytesTotal: bytes[1], bytesPerSecond: bytes[2] } : {}),+ },+ } as never),+ );+ const tile = () => document.querySelector<HTMLElement>(`[data-space-id="${pendingId}"]`);++ progress("pulling", [Math.round(12.4 * GB), 30 * GB, 85 * 2 ** 20]);+ await waitFor(() => expect(tile()?.textContent).toContain("Downloading macOS (first time only)…"));+ expect(tile()!.textContent).toContain("Another machine");+ expect(tile()!.querySelector("[data-create-transfer]")?.textContent).toBe("12.4 of 30.0 GB · 85 MB/s · about 4 min");+ const row = hooks.spaces.data!.find((s) => s.id === pendingId)!;+ expect(row.progress!.permille).toBeGreaterThan(10);++ for (const [phase, words] of [+ ["creating", "Preparing the disk…"],+ ["booting", "Booting macOS…"],+ ["waiting_for_services", "Starting Cua inside the Space…"],+ ] as const) {+ progress(phase);+ await waitFor(() => expect(tile()?.textContent).toContain(words));+ expect(tile()!.querySelector("[data-create-transfer]")).toBeNull();+ }+ finish();+ });+});++describe("a create's stages without the core", () => {+ it("names the steps and the download as the core does", () => {+ const p = { os: "macos", provider: "relay", kind: null } as const;+ expect(stageLabelForTest({ ...p, phase: "pulling" })).toBe("Downloading macOS (first time only)…");+ expect(stageLabelForTest({ ...p, phase: "creating" })).toBe("Preparing the disk…");+ expect(stageLabelForTest({ ...p, phase: "booting" })).toBe("Booting macOS…");+ expect(stageLabelForTest({ ...p, phase: "waiting_for_services" })).toBe("Starting Cua inside the Space…");+ const container = { os: "linux", provider: "local", kind: "container" } as const;+ expect(stageLabelForTest({ ...container, phase: "booting" })).toBe("Starting the container…");+ expect(transferText({ bytesDone: 12.4 * GB, bytesTotal: 30 * GB, bytesPerSecond: 85 * 2 ** 20 })).toBe("12.4 of 30.0 GB · 85 MB/s · about 4 min");+ expect(transferText({ bytesDone: 420 * 2 ** 20, bytesTotal: 900 * 2 ** 20 })).toBe("420 of 900 MB");+ expect(transferText({})).toBeNull();+ });+});diff --git a/apps/cua-spaces-web/src/bridge/derive.ts b/apps/cua-spaces-web/src/bridge/derive.tsindex cb41cf4674..ad016c306b 100644--- a/apps/cua-spaces-web/src/bridge/derive.ts+++ b/apps/cua-spaces-web/src/bridge/derive.ts@@ -104,14 +104,69 @@ export function validateImageRef(core: CoreClient, ref: string): string | null {const PHASES = ["preparing", "pulling", "creating", "booting", "waiting_for_services", "connecting"];const PHASE_LABEL: Record<string, string> = {- preparing: "Preparing…",- pulling: "Downloading…",+ preparing: "Starting…",+ pulling: "Downloading image…",creating: "Creating…",- booting: "Starting…",- waiting_for_services: "Starting…",+ booting: "Booting…",+ waiting_for_services: "Starting Cua inside the Space…",connecting: "Connecting…",};+/** "12.4 of 30.0 GB · 85 MB/s · about 4 min" (`creating::transfer_text`). */+export function transferText(p: Pick<PendingCreate, "bytesDone" | "bytesTotal" | "bytesPerSecond">): string | null {+ if (p.bytesDone == null) return null;+ const unit = (n: number): [number, string] =>+ n >= 2 ** 30 ? [2 ** 30, "GB"] : n >= 2 ** 20 ? [2 ** 20, "MB"] : n >= 1024 ? [1024, "KB"] : [1, "bytes"];+ const scaled = (n: number, [size]: [number, string], below: number) => {+ const v = n / size;+ return size > 1 && v < below ? v.toFixed(1) : Math.round(v).toString();+ };+ const total = p.bytesTotal ?? 0;+ let out: string;+ if (total > 0) {+ const u = unit(total);+ out = `${scaled(Math.min(p.bytesDone, total), u, 100)} of ${scaled(total, u, 100)} ${u[1]}`;+ } else {+ const u = unit(p.bytesDone);+ out = `${scaled(p.bytesDone, u, 100)} ${u[1]}`;+ }+ const rate = p.bytesPerSecond != null && Number.isFinite(p.bytesPerSecond) && p.bytesPerSecond > 0 ? p.bytesPerSecond : null;+ if (rate) {+ const u = unit(Math.floor(rate));+ out += ` · ${scaled(Math.floor(rate), u, 10)} ${u[1]}/s`;+ if (total > 0) {+ const secs = Math.max(0, total - p.bytesDone) / rate;+ const mins = Math.round(secs / 60);+ out +=+ secs < 60+ ? " · less than a minute"+ : mins < 60+ ? ` · about ${mins} min`+ : mins % 60 === 0+ ? ` · about ${mins / 60} h`+ : ` · about ${Math.floor(mins / 60)} h ${mins % 60} min`;+ }+ }+ return out;+}++/** The step a create is on, in its kind of Space's words (`creating::stage_label`). */+function stageLabel(p: Pick<PendingCreate, "os" | "provider" | "kind" | "phase">): string {+ const here = p.provider !== "cloud";+ const vm = p.os === "macos" || p.os === "windows" || p.kind === "vm";+ const container = !vm && p.kind === "container";+ const os = p.os === "macos" ? "macOS" : p.os === "windows" ? "Windows" : p.os === "linux" ? "Linux" : "";+ if (p.phase === "pulling" && p.os === "macos") return "Downloading macOS (first time only)…";+ if (p.phase === "creating" && here && vm) return "Preparing the disk…";+ if (p.phase === "creating" && here && container) return "Creating the container…";+ if (p.phase === "booting" && here && vm && os) return `Booting ${os}…`;+ if (p.phase === "booting" && here && container) return "Starting the container…";+ return PHASE_LABEL[p.phase] ?? "Starting…";+}++/** [`stageLabel`] (the fallback's words), for tests. */+export const stageLabelForTest = stageLabel;+function fallbackReduce(state: CreatesState, a: CreateAction): CreatesState {const pending = [...state.pending];const deleting = [...(state.deleting ?? [])];@@ -132,13 +187,17 @@ function fallbackReduce(state: CreatesState, a: CreateAction): CreatesState {pulled: false,permille: 0,image: a.image ?? null,+ kind: a.kind ?? null,});break;case "progress":patch(a.id, (p) => {const i = Math.max(0, PHASES.indexOf(a.phase));const permille = Math.round(((i + (a.fraction ?? 0)) / PHASES.length) * 1000);- return { ...p, phase: a.phase, fraction: a.fraction, permille: Math.max(p.permille, Math.min(990, permille)) };+ const bytes = a.bytesDone != null+ ? { bytesDone: a.bytesDone, bytesTotal: a.bytesTotal ?? null, bytesPerSecond: a.bytesPerSecond ?? null }+ : a.phase === p.phase ? {} : { bytesDone: null, bytesTotal: null, bytesPerSecond: null };+ return { ...p, ...bytes, phase: a.phase, fraction: a.fraction, permille: Math.max(p.permille, Math.min(990, permille)) };});break;case "finish":@@ -200,7 +259,7 @@ function fallbackCompose(spaces: Space[], state: CreatesState): Space[] {name: p.name,os: p.os,status: "provisioning",- detail: p.error ? "Failed" : (PHASE_LABEL[p.phase] ?? "Creating…"),+ detail: p.error ? "Failed" : stageLabel(p),lastUsedAt: p.startedAt,startedAt: p.startedAt,scene: SCENES[p.os],@@ -208,8 +267,9 @@ function fallbackCompose(spaces: Space[], state: CreatesState): Space[] {progress: {phase: p.phase,permille: p.permille,- label: p.error ? "Failed" : (PHASE_LABEL[p.phase] ?? "Creating…"),+ label: p.error ? "Failed" : stageLabel(p),error: p.error ?? undefined,+ transfer: !p.error && p.phase === "pulling" ? (transferText(p) ?? undefined) : undefined,cancellable: !p.error && !p.cancelling,cancelling: p.cancelling,},diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsxindex fcdddf0011..a28ddf910c 100644--- a/apps/cua-spaces-web/src/routes/spaces/index.tsx+++ b/apps/cua-spaces-web/src/routes/spaces/index.tsx@@ -280,6 +280,12 @@ function SpaceLink({ space, machine, windowOver = false }: { space: Space; machi<div className="mt-0.5 truncate text-xs text-muted-foreground">{spaceState(space) === "creating" && space.detail ? creatingLine(space.detail) : spacePlace(space, machine)}</div>+ {/* Downloading: how far, how fast, how long is left. */}+ {spaceState(space) === "creating" && space.progress?.transfer ? (+ <div data-create-transfer="" className="mt-0.5 truncate text-xs tabular-nums text-muted-foreground">+ {space.progress.transfer}+ </div>+ ) : null}{createError(space) ? (<p data-create-error="" title={createError(space)!} className="mt-1 line-clamp-2 text-xs text-destructive">{createError(space)}diff --git a/apps/cua-spaces/src/model/parity.test.ts b/apps/cua-spaces/src/model/parity.test.tsindex 04343fb68e..41268e8b9a 100644--- a/apps/cua-spaces/src/model/parity.test.ts+++ b/apps/cua-spaces/src/model/parity.test.ts@@ -250,6 +250,7 @@ describe('app core parity flows (webview)', () => {'placement-picker','machines','checklist',+ 'create-stages',]);});diff --git a/docs/content/docs/cua-sdk/reference/protocol/daemon-sandboxes.mdx b/docs/content/docs/cua-sdk/reference/protocol/daemon-sandboxes.mdxindex 4a4199f33d..4992d9d7fa 100644--- a/docs/content/docs/cua-sdk/reference/protocol/daemon-sandboxes.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/daemon-sandboxes.mdx@@ -27,6 +27,7 @@ installed in the guest.| --- | --- | --- | --- || [`ListSandboxes`](#sandboxservicelistsandboxes) | [`ListSandboxesRequest`](#listsandboxesrequest) | [`ListSandboxesResponse`](#listsandboxesresponse) | unary || [`CreateSandbox`](#sandboxservicecreatesandbox) | [`CreateSandboxRequest`](#createsandboxrequest) | [`CreateSandboxResponse`](#createsandboxresponse) | unary |+| [`CreateSandboxStream`](#sandboxservicecreatesandboxstream) | [`CreateSandboxStreamRequest`](#createsandboxstreamrequest) | [`CreateSandboxStreamResponse`](#createsandboxstreamresponse) | server stream || [`CancelCreateSandbox`](#sandboxservicecancelcreatesandbox) | [`CancelCreateSandboxRequest`](#cancelcreatesandboxrequest) | [`CancelCreateSandboxResponse`](#cancelcreatesandboxresponse) | unary || [`GetSandbox`](#sandboxservicegetsandbox) | [`GetSandboxRequest`](#getsandboxrequest) | [`GetSandboxResponse`](#getsandboxresponse) | unary || [`DeleteSandbox`](#sandboxservicedeletesandbox) | [`DeleteSandboxRequest`](#deletesandboxrequest) | [`DeleteSandboxResponse`](#deletesandboxresponse) | unary |@@ -58,6 +59,16 @@ Lists sandboxes known to the daemon.Creates a sandbox where `location` says (local by default), orconnects to an existing machine (`direct:<addr>`).+### SandboxService.CreateSandboxStream++`/cua.daemon.v1.SandboxService/CreateSandboxStream`, server stream: [`CreateSandboxStreamRequest`](#createsandboxstreamrequest) to [`CreateSandboxStreamResponse`](#createsandboxstreamresponse).++`CreateSandbox`, streaming what the create is doing: progress events+(pulling the image with its bytes, creating, booting, waiting for the+probes) in order, then exactly one `result`. A failed create ends the+stream with its status. Closing the stream cancels the create, as for+a `CreateSandbox` whose caller goes away.+### SandboxService.CancelCreateSandbox`/cua.daemon.v1.SandboxService/CancelCreateSandbox`, unary: [`CancelCreateSandboxRequest`](#cancelcreatesandboxrequest) to [`CancelCreateSandboxResponse`](#cancelcreatesandboxresponse).@@ -340,6 +351,23 @@ Response for `SandboxService.CreateSandbox`.| --- | --- | --- | --- || `sandbox` | 1 | [`Sandbox`](#sandbox) | The sandbox. |+### CreateSandboxStreamRequest++Request for `SandboxService.CreateSandboxStream`.++| Field | # | Type | Description |+| --- | --- | --- | --- |+| `create` | 1 | [`CreateSandboxRequest`](#createsandboxrequest) | The create, as for `CreateSandbox`. |++### CreateSandboxStreamResponse++One message of `SandboxService.CreateSandboxStream`.++| Field | # | Type | Description |+| --- | --- | --- | --- |+| `progress` | 1 | [`CreateSpaceProgress`](/cua-sdk/reference/protocol/daemon-spaces#createspaceprogress) (oneof `event`) | What the create is doing now (`space` is empty). |+| `result` | 2 | [`CreateSandboxResponse`](#createsandboxresponse) (oneof `event`) | The created sandbox (the last message). |+### GetSandboxRequestRequest for `SandboxService.GetSandbox`.diff --git a/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx b/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdxindex 05d9ab10cc..7440f4bba8 100644--- a/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/env-host-spaces.mdx@@ -178,6 +178,22 @@ Response for `HostSpacesService.GetHostSpaces`.| `spaces` | 5 | repeated [`HostSpace`](#hostspace) | Spaces this host provides: every one for the owner, the caller's own otherwise. || `audit` | 6 | repeated [`HostSpacesAuditEvent`](#hostspacesauditevent) | The most recent audit events, newest first (the owner only). || `images` | 7 | repeated `string` | Image aliases this host resolves (`macos`, `linux`, ...), for clients to offer. |+| `creating` | 8 | repeated [`HostSpaceCreating`](#hostspacecreating) | The creates this host is running now (`CreateHostSpace` calls that have not returned), each with what it is doing: every one for the owner, the caller's own otherwise. A client polls this while its create runs, to show the download and the boot. Empty from a host that predates it. |++### HostSpaceCreating++A create a host is running, and what it is doing now. The progress+fields are those of `cua.daemon.v1.CreateSpaceProgress`.++| Field | # | Type | Description |+| --- | --- | --- | --- |+| `key` | 1 | `string` | The create's key: `CreateHostSpaceRequest.create_key`, else the relay machine it attaches to (`attach.machine_id`). |+| `phase` | 2 | `string` | "preparing", "pulling", "creating", "booting", "waiting_for_services", "connecting" or "ready", in that order. |+| `fraction` | 3 | optional `double` | How far through the phase, 0.0 to 1.0, when its size is known (an image pull). |+| `detail` | 4 | `string` | One short line, for example the image being pulled. |+| `bytes_done` | 5 | optional `uint64` | Bytes downloaded so far, when the step counts them (an image pull). |+| `bytes_total` | 6 | optional `uint64` | Bytes the download has in all. |+| `bytes_per_second` | 7 | optional `double` | Smoothed download rate, bytes per second. |### CreateHostSpaceRequest@@ -194,6 +210,7 @@ Request for `HostSpacesService.CreateHostSpace`.| `disk_gb` | 7 | `uint32` | Disk in GiB for a VM (0: the image's). || `attach` | 8 | [`AttachRelayRequest`](/cua-sdk/reference/protocol/env-system#attachrelayrequest) | The relay machine the caller registered for this Space: the host attaches the new Space's driver to it (`SystemService.AttachRelay`), so the Space is reached as `relay:<machine_id>` and the host never holds an account credential. Empty when `direct` is set. || `direct` | 9 | `bool` | Create the Space without the relay (a host set up with `--direct`): it is reached at the host's address on `HostSpace.direct_port`, with `HostSpace.direct_token`. `attach` must be empty. |+| `create_key` | 10 | `string` | A key of the caller's for this create, under which `GetHostSpacesResponse.creating` lists its progress (a direct create has no relay machine to name it). Empty: `attach.machine_id`. |### CreateHostSpaceResponsediff --git a/docs/content/docs/cua-sdk/reference/protocol/index.mdx b/docs/content/docs/cua-sdk/reference/protocol/index.mdxindex 302eaccc91..c946b1cf26 100644--- a/docs/content/docs/cua-sdk/reference/protocol/index.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/index.mdx@@ -51,7 +51,7 @@ Tickets go in `?ticket=` or the WebSocket subprotocol `cua.ticket.<ticket>`. Tic| [`TunnelService`](/cua-sdk/reference/protocol/env-teleport-tunnel#tunnelservice) | `cua.env.v1` | [Teleport, tunnels and the volume](/cua-sdk/reference/protocol/env-teleport-tunnel) | 6 || [`VolumeService`](/cua-sdk/reference/protocol/env-teleport-tunnel#volumeservice) | `cua.env.v1` | [Teleport, tunnels and the volume](/cua-sdk/reference/protocol/env-teleport-tunnel) | 3 || [`HostSpacesService`](/cua-sdk/reference/protocol/env-host-spaces#hostspacesservice) | `cua.env.v1` | [Host Spaces](/cua-sdk/reference/protocol/env-host-spaces) | 6 |-| [`SandboxService`](/cua-sdk/reference/protocol/daemon-sandboxes#sandboxservice) | `cua.daemon.v1` | [Daemon: sandboxes](/cua-sdk/reference/protocol/daemon-sandboxes) | 19 |+| [`SandboxService`](/cua-sdk/reference/protocol/daemon-sandboxes#sandboxservice) | `cua.daemon.v1` | [Daemon: sandboxes](/cua-sdk/reference/protocol/daemon-sandboxes) | 20 || [`RuntimeService`](/cua-sdk/reference/protocol/daemon-runtimes#runtimeservice) | `cua.daemon.v1` | [Daemon: local runtimes](/cua-sdk/reference/protocol/daemon-runtimes) | 5 || [`SpaceService`](/cua-sdk/reference/protocol/daemon-spaces#spaceservice) | `cua.daemon.v1` | [Daemon: Spaces](/cua-sdk/reference/protocol/daemon-spaces) | 17 || [`DaemonService`](/cua-sdk/reference/protocol/daemon-service#daemonservice) | `cua.daemon.v1` | [Daemon: service](/cua-sdk/reference/protocol/daemon-service) | 3 |diff --git a/libs/cua/crates/cua-cli/src/host.rs b/libs/cua/crates/cua-cli/src/host.rsindex 2d53df88a0..528162b14c 100644--- a/libs/cua/crates/cua-cli/src/host.rs+++ b/libs/cua/crates/cua-cli/src/host.rs@@ -785,13 +785,21 @@ pub async fn run_spaces_sdk(// What each create is doing, on one updating line of the// terminal (never in --json output).let show = !json && std::io::stderr().is_terminal() && count == 1;+ let steps = Arc::new(crate::util::StepLines::new(+ crate::util::CreateWords::for_image(+ image.as_deref().unwrap_or_default(),+ kind.as_deref().unwrap_or_default(),+ true,+ ),+ ));let creates = names.into_iter().enumerate().map(|(i, n)| {let options = one(i as u32 + 1, n);let spaces = spaces.clone();+ let steps = steps.clone();async move {if show {Box::pin(- spaces.create_with_progress(options, Arc::new(ProgressLine::default())),+ spaces.create_with_progress(options, Arc::new(StepListener(steps))),).await} else {@@ -824,7 +832,7 @@ pub async fn run_spaces_sdk(};crate::util::exit_on_ctrl_c();if show {- eprint!("\r\x1b[2K");+ steps.finish();}let mut failed = 0;let mut rows = Vec::new();@@ -2120,46 +2128,27 @@ pub async fn run_spaces(Ok(0)}-/// Prints a create's progress on one updating line of stderr:-/// "Downloading image 4.2 of 22.1 GB · 85 MB/s · about 4 min".-#[derive(Default)]-struct ProgressLine {- last: std::sync::Mutex<String>,-}+/// Passes a Space create's progress to the terminal's step lines.+struct StepListener(Arc<crate::util::StepLines>);-impl cua_sdk::SpaceCreateListener for ProgressLine {+impl cua_sdk::SpaceCreateListener for StepListener {fn on_progress(&self, p: cua_sdk::SpaceCreateProgress) {- let words = match p.phase.as_str() {- "preparing" => "Preparing",- "pulling" => "Downloading image",- "creating" => "Creating",- "booting" => "Booting",- "waiting_for_services" => "Starting services",- "connecting" => "Connecting",- _ => return,+ use cua_sandbox_core::progress::{Phase, Progress, Transfer};+ let Some(phase) = Phase::parse(&p.phase) else {+ return;};- let detail = match (p.bytes_done, p.bytes_total) {- (Some(done), total) => cua_sandbox_core::progress::Transfer {+ let mut out = Progress::phase(phase).detail(p.detail);+ if let Some(f) = p.fraction {+ out = out.fraction(f);+ }+ if let Some(done) = p.bytes_done {+ out = out.bytes(Transfer {done,- total: total.unwrap_or(0),+ total: p.bytes_total.unwrap_or(0),per_second: p.bytes_per_second,- }- .describe(),- _ => p- .fraction- .map(|f| format!("{:.0}%", f * 100.0))- .unwrap_or_default(),- };- let text = if p.space.is_empty() {- format!("{words} {detail}")- } else {- format!("{}: {words} {detail}", p.space)- };- let mut last = self.last.lock().unwrap_or_else(|e| e.into_inner());- if *last != text {- eprint!("\r\x1b[2K{}", text.trim_end());- *last = text;+ });}+ self.0.show(&out);}}diff --git a/libs/cua/crates/cua-cli/src/sandbox.rs b/libs/cua/crates/cua-cli/src/sandbox.rsindex b1d931ef1e..ed5c4de893 100644--- a/libs/cua/crates/cua-cli/src/sandbox.rs+++ b/libs/cua/crates/cua-cli/src/sandbox.rs@@ -1521,9 +1521,30 @@ async fn create(eprintln!("Starting a cloud sandbox (first start of an image can take a few minutes)");}let requested_name = o.name.clone();+ // Each step of the create on a terminal (never in --json output).+ let steps = {+ use std::io::IsTerminal as _;+ (!json && std::io::stderr().is_terminal()).then(|| {+ let mut words = crate::util::CreateWords::for_image(+ &o.image,+ o.kind.as_deref().unwrap_or_default(),+ false,+ );+ words.macos |= o.os.as_deref() == Some("macos");+ words.vm |= words.macos;+ Arc::new(crate::util::StepLines::new(words))+ })+ };let created = {let sandboxes = cua.sandboxes();- let mut create = Box::pin(sandboxes.create(o));+ let mut create: std::pin::Pin<Box<dyn std::future::Future<Output = _> + Send>> =+ match &steps {+ Some(steps) => {+ let steps = steps.clone();+ Box::pin(sandboxes.create_reporting(o, Arc::new(move |p| steps.show(p))))+ }+ None => Box::pin(sandboxes.create(o)),+ };tokio::select! {r = &mut create => r,_ = tokio::signal::ctrl_c() => {@@ -1542,6 +1563,9 @@ async fn create(}};crate::util::exit_on_ctrl_c();+ if let Some(steps) = &steps {+ steps.finish();+ }if created.is_err()&& a.keep_on_failure&& let Some(n) = &requested_namediff --git a/libs/cua/crates/cua-cli/src/util.rs b/libs/cua/crates/cua-cli/src/util.rsindex 05fa9a2708..5b51298a6c 100644--- a/libs/cua/crates/cua-cli/src/util.rs+++ b/libs/cua/crates/cua-cli/src/util.rs@@ -206,6 +206,121 @@ pub fn write_private(p: &std::path::Path, data: &[u8]) -> Result<(), CuaError> {std::fs::rename(&tmp, p).map_err(internal)}+/// What is being created, for the words of its steps.+#[derive(Debug, Clone, Copy, Default)]+pub struct CreateWords {+ /// A macOS VM (Lume downloads its base image once).+ pub macos: bool,+ /// A VM (it has a disk to prepare and boots).+ pub vm: bool,+ /// A Space (Cua starts inside it), not a bare sandbox.+ pub space: bool,+}++impl CreateWords {+ /// The words for an image reference or alias (`macos`, `ghcr.io/trycua/macos:26`).+ pub fn for_image(image: &str, kind: &str, space: bool) -> Self {+ let image = image.to_ascii_lowercase();+ let macos = image.contains("macos");+ Self {+ macos,+ vm: macos || image.contains("windows") || kind == "vm",+ space,+ }+ }++ /// The step `phase` in words; `None` for `ready` and phases this build+ /// does not know.+ pub fn step(&self, phase: cua_sandbox_core::progress::Phase) -> Option<&'static str> {+ use cua_sandbox_core::progress::Phase;+ Some(match phase {+ Phase::Preparing => "Preparing",+ Phase::Pulling if self.macos => "Downloading macOS (first time only)",+ Phase::Pulling => "Downloading image",+ Phase::Creating if self.vm => "Preparing the disk",+ Phase::Creating => "Creating",+ Phase::Booting if self.macos => "Booting macOS",+ Phase::Booting if self.vm => "Booting",+ Phase::Booting => "Starting",+ Phase::WaitingForServices if self.space => "Starting Cua inside the Space",+ Phase::WaitingForServices => "Waiting for its services",+ Phase::Connecting => "Connecting",+ Phase::Ready => return None,+ })+ }++ /// One report as a line: the step, then the download's bytes, rate and+ /// time left ("4.2 of 22.1 GB · 85 MB/s · about 4 min"), else its+ /// percent.+ pub fn line(&self, p: &cua_sandbox_core::progress::Progress) -> Option<String> {+ let step = self.step(p.phase)?;+ let measure = match (p.bytes, p.fraction) {+ (Some(b), _) => b.describe(),+ (None, Some(f)) => format!("{:.0}%", f * 100.0),+ (None, None) => String::new(),+ };+ Some(format!("{step} {measure}").trim_end().to_string())+ }+}++/// A create's steps on a terminal (stderr): each step keeps a line of its+/// own, and the step running now updates in place with its bytes. Never+/// used for `--json` or when stderr is not a terminal.+#[derive(Default)]+pub struct StepLines {+ words: CreateWords,+ /// The step on the current line, and that line's text.+ shown: std::sync::Mutex<Option<(cua_sandbox_core::progress::Phase, String)>>,+}++impl StepLines {+ /// Lines for a create of this kind.+ pub fn new(words: CreateWords) -> Self {+ Self {+ words,+ shown: Default::default(),+ }+ }++ /// What to write for `p`: `None` when the line would not change.+ pub fn render(&self, p: &cua_sandbox_core::progress::Progress) -> Option<String> {+ let text = self.words.line(p)?;+ let mut shown = self.shown.lock().unwrap_or_else(|e| e.into_inner());+ let out = match shown.as_ref() {+ Some((_, last)) if *last == text => return None,+ // Still the same step: rewrite its line.+ Some((phase, _)) if *phase == p.phase => format!("\r\x1b[2K{text}"),+ // A new step: the last one stays on its line.+ Some(_) => format!("\n{text}"),+ None => text.clone(),+ };+ *shown = Some((p.phase, text));+ Some(out)+ }++ /// Writes `p`'s line to stderr.+ pub fn show(&self, p: &cua_sandbox_core::progress::Progress) {+ if let Some(out) = self.render(p) {+ let mut err = std::io::stderr();+ let _ = write!(err, "{out}");+ let _ = err.flush();+ }+ }++ /// Ends the output: the steps done stay, the running step's line goes.+ pub fn finish(&self) {+ if self+ .shown+ .lock()+ .unwrap_or_else(|e| e.into_inner())+ .take()+ .is_some()+ {+ eprint!("\r\x1b[2K");+ }+ }+}+#[cfg(test)]mod secret_tests {use super::*;@@ -311,3 +426,61 @@ pub fn exit_on_ctrl_c() {}});}++#[cfg(test)]+mod create_step_tests {+ #[test]+ fn create_steps_read_in_words_and_keep_a_line_each() {+ use cua_sandbox_core::progress::{Phase, Progress, Transfer};+ let mac = super::CreateWords::for_image("macos", "", true);+ let lines = super::StepLines::new(mac);+ let gb = 1u64 << 30;+ let pull = |done: u64| {+ Progress::phase(Phase::Pulling).bytes(Transfer {+ done,+ total: 30 * gb,+ per_second: Some((85u64 << 20) as f64),+ })+ };+ let out: Vec<Option<String>> = vec![+ lines.render(&Progress::phase(Phase::Preparing)),+ lines.render(&pull(gb * 124 / 10)),+ lines.render(&pull(gb * 124 / 10)),+ lines.render(&pull(30 * gb)),+ lines.render(&Progress::phase(Phase::Creating)),+ lines.render(&Progress::phase(Phase::Booting)),+ lines.render(&Progress::phase(Phase::WaitingForServices)),+ lines.render(&Progress::phase(Phase::Ready)),+ ];+ assert_eq!(+ out,+ [+ Some("Preparing".to_string()),+ Some(+ "\nDownloading macOS (first time only) 12.4 of 30.0 GB \u{b7} 85 MB/s \u{b7} about 4 min"+ .into()+ ),+ None,+ Some(+ "\r\x1b[2KDownloading macOS (first time only) 30.0 of 30.0 GB \u{b7} 85 MB/s \u{b7} less than a minute"+ .into()+ ),+ Some("\nPreparing the disk".into()),+ Some("\nBooting macOS".into()),+ Some("\nStarting Cua inside the Space".into()),+ None,+ ]+ );+ // A Linux container sandbox.+ let c = super::CreateWords::for_image("ghcr.io/trycua/linux:24.04", "container", false);+ assert_eq!(c.step(Phase::Creating), Some("Creating"));+ assert_eq!(c.step(Phase::Booting), Some("Starting"));+ assert_eq!(+ c.step(Phase::WaitingForServices),+ Some("Waiting for its services")+ );+ let vm = super::CreateWords::for_image("linux", "vm", false);+ assert_eq!(vm.step(Phase::Creating), Some("Preparing the disk"));+ assert_eq!(vm.step(Phase::Booting), Some("Booting"));+ }+}diff --git a/libs/cua/crates/cua-daemon/src/client.rs b/libs/cua/crates/cua-daemon/src/client.rsindex 4600c94a0f..8e1689cef2 100644--- a/libs/cua/crates/cua-daemon/src/client.rs+++ b/libs/cua/crates/cua-daemon/src/client.rs@@ -321,55 +321,8 @@ impl DaemonClient {}/// `CreateSandbox`.- // The deprecated fields still go out for daemons that predate- // `location` / `kind` / `runtime`.- #[allow(deprecated)]pub async fn create(&self, r: CreateRequest) -> Result<SandboxRecord> {- let req = pb::CreateSandboxRequest {- location: r.location.clone().unwrap_or_default(),- kind: r.kind.clone().unwrap_or_default(),- runtime: r.runtime.clone().unwrap_or_default(),- name: r.name.unwrap_or_default(),- provider: r- .provider- .map(|p| provider_to_pb(p) as i32)- .unwrap_or_default(),- image: r.image,- pool: r.pool.unwrap_or_default(),- url: r.url.unwrap_or_default(),- token: r.token.unwrap_or_default(),- labels: r.labels.into_iter().collect(),- os: r.os.unwrap_or_default(),- cpus: r.cpus.unwrap_or_default(),- memory_mb: r.memory_mb.unwrap_or_default(),- ports: r.ports.iter().map(|p| *p as u32).collect(),- services: r.services.into_iter().map(|(k, v)| (k, v as u32)).collect(),- wait_for: r.wait_for.iter().map(probe_to_pb).collect(),- ready_timeout: r.ready_timeout.map(dur),- env: r.env.into_iter().collect(),- command: r.command.unwrap_or_default(),- fleet_runtime: r.fleet_runtime.unwrap_or_default(),- fleet_replicas: r.fleet_replicas.unwrap_or_default(),- fleet_ttl_seconds: r.fleet_ttl_seconds.unwrap_or_default(),- fleet_warm: r.fleet_warm,- fleet_max_pool_size: r.fleet_max_pool_size.unwrap_or_default(),- fleet_apply: r.fleet_apply,- sidecars: r- .sidecars- .iter()- .map(crate::convert::sidecar_to_pb)- .collect(),- registry_secret: r- .registry_credentials- .as_ref()- .map(crate::convert::registry_secret_to_pb),- build: r.build.as_ref().map(crate::convert::build_to_pb),- container_runtime: r.container_runtime.clone().unwrap_or_default(),- network: r.network.clone().unwrap_or_default(),- owner_pid: r.owner_pid.unwrap_or_default(),- keep_on_failure: r.keep_on_failure,- gpu: r.gpu.clone().unwrap_or_default(),- };+ let req = create_pb(r);Self::sandbox_of(self.sandboxes().create_sandbox(req)@@ -380,6 +333,127 @@ impl DaemonClient {)}+ /// `CreateSandboxStream`: [`DaemonClient::create`], passing what the+ /// create does (the image download with its bytes, the boot, the+ /// probes) to `progress` as it happens. A daemon that predates the+ /// stream gets a plain `CreateSandbox`, and `progress` hears nothing.+ pub async fn create_reporting(+ &self,+ r: CreateRequest,+ progress: cua_sandbox_core::progress::Sink,+ ) -> Result<SandboxRecord> {+ use pb::create_sandbox_stream_response::Event;+ let req = create_pb(r);+ let mut stream = match self+ .sandboxes()+ .create_sandbox_stream(pb::CreateSandboxStreamRequest {+ create: Some(req.clone()),+ })+ .await+ {+ Ok(s) => s.into_inner(),+ Err(e) if e.code() == tonic::Code::Unimplemented => {+ return Self::sandbox_of(+ self.sandboxes()+ .create_sandbox(req)+ .await+ .map_err(Self::map)?+ .into_inner()+ .sandbox,+ );+ }+ Err(e) => return Err(Self::map(e)),+ };+ while let Some(msg) = stream.message().await.map_err(Self::map)? {+ match msg.event {+ Some(Event::Progress(p)) => {+ if let Some(p) = progress_from_pb(&p) {+ progress(&p);+ }+ }+ Some(Event::Result(r)) => return Self::sandbox_of(r.sandbox),+ None => {}+ }+ }+ Err(Error::Internal(+ "the daemon ended the create stream without a result".into(),+ ))+ }+}++/// A streamed progress report, back as the runtime's (`None`: a phase this+/// build does not know).+pub fn progress_from_pb(+ p: &pb::CreateSpaceProgress,+) -> Option<cua_sandbox_core::progress::Progress> {+ use cua_sandbox_core::progress::{Phase, Progress, Transfer};+ let mut out = Progress::phase(Phase::parse(&p.phase)?).detail(p.detail.clone());+ if let Some(f) = p.fraction {+ out = out.fraction(f);+ }+ if let Some(done) = p.bytes_done {+ out = out.bytes(Transfer {+ done,+ total: p.bytes_total.unwrap_or(0),+ per_second: p.bytes_per_second,+ });+ }+ out.target = p.space.clone();+ Some(out)+}++/// A create as its `CreateSandboxRequest`. The deprecated fields still go+/// out for daemons that predate `location` / `kind` / `runtime`.+#[allow(deprecated)]+fn create_pb(r: CreateRequest) -> pb::CreateSandboxRequest {+ pb::CreateSandboxRequest {+ location: r.location.clone().unwrap_or_default(),+ kind: r.kind.clone().unwrap_or_default(),+ runtime: r.runtime.clone().unwrap_or_default(),+ name: r.name.unwrap_or_default(),+ provider: r+ .provider+ .map(|p| provider_to_pb(p) as i32)+ .unwrap_or_default(),+ image: r.image,+ pool: r.pool.unwrap_or_default(),+ url: r.url.unwrap_or_default(),+ token: r.token.unwrap_or_default(),+ labels: r.labels.into_iter().collect(),+ os: r.os.unwrap_or_default(),+ cpus: r.cpus.unwrap_or_default(),+ memory_mb: r.memory_mb.unwrap_or_default(),+ ports: r.ports.iter().map(|p| *p as u32).collect(),+ services: r.services.into_iter().map(|(k, v)| (k, v as u32)).collect(),+ wait_for: r.wait_for.iter().map(probe_to_pb).collect(),+ ready_timeout: r.ready_timeout.map(dur),+ env: r.env.into_iter().collect(),+ command: r.command.unwrap_or_default(),+ fleet_runtime: r.fleet_runtime.unwrap_or_default(),+ fleet_replicas: r.fleet_replicas.unwrap_or_default(),+ fleet_ttl_seconds: r.fleet_ttl_seconds.unwrap_or_default(),+ fleet_warm: r.fleet_warm,+ fleet_max_pool_size: r.fleet_max_pool_size.unwrap_or_default(),+ fleet_apply: r.fleet_apply,+ sidecars: r+ .sidecars+ .iter()+ .map(crate::convert::sidecar_to_pb)+ .collect(),+ registry_secret: r+ .registry_credentials+ .as_ref()+ .map(crate::convert::registry_secret_to_pb),+ build: r.build.as_ref().map(crate::convert::build_to_pb),+ container_runtime: r.container_runtime.clone().unwrap_or_default(),+ network: r.network.clone().unwrap_or_default(),+ owner_pid: r.owner_pid.unwrap_or_default(),+ keep_on_failure: r.keep_on_failure,+ gpu: r.gpu.clone().unwrap_or_default(),+ }+}++impl DaemonClient {/// `ConnectSandbox`.pub async fn connect(&self, name: &str) -> Result<SandboxRecord> {Self::sandbox_of(diff --git a/libs/cua/crates/cua-daemon/src/server.rs b/libs/cua/crates/cua-daemon/src/server.rsindex a8b6928100..911f1ad224 100644--- a/libs/cua/crates/cua-daemon/src/server.rs+++ b/libs/cua/crates/cua-daemon/src/server.rs@@ -663,6 +663,74 @@ impl Svc {}}+/// A `CreateSandboxRequest` as the runtime's create. The deprecated request+/// fields still count when `location` / `runtime` are empty (older+/// clients).+#[allow(deprecated)]+fn create_request(r: pb::CreateSandboxRequest) -> std::result::Result<CreateRequest, Status> {+ let non_empty = |s: String| (!s.is_empty()).then_some(s);+ let wait_for = r+ .wait_for+ .iter()+ .map(probe_from_pb)+ .collect::<Result<Vec<_>>>()+ .map_err(st)?;+ let ports = r+ .ports+ .iter()+ .map(|p| u16::try_from(*p).map_err(|_| st(Error::InvalidArgument("port".into()))))+ .collect::<std::result::Result<Vec<_>, _>>()?;+ let create = CreateRequest {+ location: non_empty(r.location),+ kind: non_empty(r.kind),+ runtime: non_empty(r.runtime),+ provider: provider_from_pb(r.provider),+ name: non_empty(r.name),+ image: r.image,+ url: non_empty(r.url),+ token: non_empty(r.token),+ pool: non_empty(r.pool),+ os: non_empty(r.os),+ cpus: Some(r.cpus),+ memory_mb: Some(r.memory_mb),+ ports,+ services: r.services.into_iter().map(|(k, v)| (k, v as u16)).collect(),+ wait_for,+ ready_timeout: r.ready_timeout.as_ref().map(from_dur),+ env: r.env.into_iter().collect(),+ command: (!r.command.is_empty()).then_some(r.command),+ fleet_runtime: non_empty(r.fleet_runtime),+ fleet_replicas: Some(r.fleet_replicas),+ fleet_ttl_seconds: Some(r.fleet_ttl_seconds),+ fleet_warm: r.fleet_warm,+ fleet_max_pool_size: Some(r.fleet_max_pool_size).filter(|m| *m > 0),+ fleet_apply: r.fleet_apply,+ labels: r.labels.into_iter().collect(),+ sidecars: r+ .sidecars+ .into_iter()+ .map(crate::convert::sidecar_from_pb)+ .collect::<Result<Vec<_>>>()+ .map_err(st)?,+ registry_credentials: r+ .registry_secret+ .map(crate::convert::registry_secret_from_pb)+ .transpose()+ .map_err(st)?,+ build: r+ .build+ .map(crate::convert::build_from_pb)+ .transpose()+ .map_err(st)?,+ container_runtime: non_empty(r.container_runtime),+ network: non_empty(r.network),+ owner_pid: (r.owner_pid > 0).then_some(r.owner_pid),+ keep_on_failure: r.keep_on_failure,+ gpu: non_empty(r.gpu),+ };+ Ok(create)+}+pub(crate) fn st(e: Error) -> Status {e.to_status()}@@ -711,80 +779,64 @@ impl SandboxService for Svc {})}- // The deprecated request fields still count when `location` / `runtime`- // are empty (older clients).- #[allow(deprecated)]async fn create_sandbox(&self,req: tonic::Request<pb::CreateSandboxRequest>,) -> R<pb::CreateSandboxResponse> {- let r = req.into_inner();- let non_empty = |s: String| (!s.is_empty()).then_some(s);- let wait_for = r- .wait_for- .iter()- .map(probe_from_pb)- .collect::<Result<Vec<_>>>()- .map_err(st)?;- let ports = r- .ports- .iter()- .map(|p| u16::try_from(*p).map_err(|_| st(Error::InvalidArgument("port".into()))))- .collect::<std::result::Result<Vec<_>, _>>()?;- let create = CreateRequest {- location: non_empty(r.location),- kind: non_empty(r.kind),- runtime: non_empty(r.runtime),- provider: provider_from_pb(r.provider),- name: non_empty(r.name),- image: r.image,- url: non_empty(r.url),- token: non_empty(r.token),- pool: non_empty(r.pool),- os: non_empty(r.os),- cpus: Some(r.cpus),- memory_mb: Some(r.memory_mb),- ports,- services: r.services.into_iter().map(|(k, v)| (k, v as u16)).collect(),- wait_for,- ready_timeout: r.ready_timeout.as_ref().map(from_dur),- env: r.env.into_iter().collect(),- command: (!r.command.is_empty()).then_some(r.command),- fleet_runtime: non_empty(r.fleet_runtime),- fleet_replicas: Some(r.fleet_replicas),- fleet_ttl_seconds: Some(r.fleet_ttl_seconds),- fleet_warm: r.fleet_warm,- fleet_max_pool_size: Some(r.fleet_max_pool_size).filter(|m| *m > 0),- fleet_apply: r.fleet_apply,- labels: r.labels.into_iter().collect(),- sidecars: r- .sidecars- .into_iter()- .map(crate::convert::sidecar_from_pb)- .collect::<Result<Vec<_>>>()- .map_err(st)?,- registry_credentials: r- .registry_secret- .map(crate::convert::registry_secret_from_pb)- .transpose()- .map_err(st)?,- build: r- .build- .map(crate::convert::build_from_pb)- .transpose()- .map_err(st)?,- container_runtime: non_empty(r.container_runtime),- network: non_empty(r.network),- owner_pid: (r.owner_pid > 0).then_some(r.owner_pid),- keep_on_failure: r.keep_on_failure,- gpu: non_empty(r.gpu),- };+ let create = create_request(req.into_inner())?;let rec = self.rt().create(create).await.map_err(st)?;ok(pb::CreateSandboxResponse {sandbox: Some(info_to_pb(&rec)),})}+ type CreateSandboxStreamStream = std::pin::Pin<+ Box<+ dyn tokio_stream::Stream<+ Item = std::result::Result<pb::CreateSandboxStreamResponse, Status>,+ > + Send,+ >,+ >;++ async fn create_sandbox_stream(+ &self,+ req: tonic::Request<pb::CreateSandboxStreamRequest>,+ ) -> R<Self::CreateSandboxStreamStream> {+ use pb::create_sandbox_stream_response::Event;+ let create = create_request(req.into_inner().create.unwrap_or_default())?;+ // Bounded: a slow reader drops progress, never the result (which+ // goes out on the same channel after every report).+ let (tx, rx) = tokio::sync::mpsc::channel(64);+ let progress = tx.clone();+ let sink: cua_sandbox_core::progress::Sink = std::sync::Arc::new(move |p| {+ let _ = progress.try_send(Ok(pb::CreateSandboxStreamResponse {+ event: Some(Event::Progress(crate::spaces_svc::progress_pb(p))),+ }));+ });+ let rt = self.rt().clone();+ tokio::spawn(async move {+ let create = cua_sandbox_core::progress::scope(sink, rt.create(create));+ // A closed stream drops the create: cleaned up as a+ // `CreateSandbox` whose caller went away.+ let result = tokio::select! {+ r = create => r,+ () = tx.closed() => return,+ };+ let _ = tx+ .send(+ result+ .map(|rec| pb::CreateSandboxStreamResponse {+ event: Some(Event::Result(pb::CreateSandboxResponse {+ sandbox: Some(info_to_pb(&rec)),+ })),+ })+ .map_err(st),+ )+ .await;+ });+ ok(Box::pin(tokio_stream::wrappers::ReceiverStream::new(rx)))+ }+async fn get_sandbox(&self,req: tonic::Request<pb::GetSandboxRequest>,diff --git a/libs/cua/crates/cua-daemon/src/spaces_svc.rs b/libs/cua/crates/cua-daemon/src/spaces_svc.rsindex fc33b7b16e..dac0f7f9c1 100644--- a/libs/cua/crates/cua-daemon/src/spaces_svc.rs+++ b/libs/cua/crates/cua-daemon/src/spaces_svc.rs@@ -9,6 +9,20 @@ use crate::{};use cua_proto::daemon::v1::{self as pb, space_service_server::SpaceService};+/// A create's progress report as the daemon streams it (`CreateSpaceStream`,+/// `CreateSandboxStream`).+pub(crate) fn progress_pb(p: &cua_sandbox_core::progress::Progress) -> pb::CreateSpaceProgress {+ pb::CreateSpaceProgress {+ phase: p.phase.as_str().into(),+ fraction: p.fraction,+ detail: p.detail.clone(),+ bytes_done: p.bytes.map(|b| b.done),+ bytes_total: p.bytes.map(|b| b.total).filter(|t| *t > 0),+ bytes_per_second: p.bytes.and_then(|b| b.per_second),+ space: p.target.clone(),+ }+}+#[cfg(feature = "spaces")]mod imp {use super::*;@@ -345,15 +359,7 @@ mod imp {let progress = tx.clone();create.progress = Some(cua_spaces::ProgressSink::new(move |p| {let _ = progress.try_send(Ok(pb::CreateSpaceStreamResponse {- event: Some(Event::Progress(pb::CreateSpaceProgress {- phase: p.phase.as_str().into(),- fraction: p.fraction,- detail: p.detail.clone(),- bytes_done: p.bytes.map(|b| b.done),- bytes_total: p.bytes.map(|b| b.total).filter(|t| *t > 0),- bytes_per_second: p.bytes.and_then(|b| b.per_second),- space: p.target.clone(),- })),+ event: Some(Event::Progress(super::progress_pb(p))),}));}));let spaces = self.spaces().clone();diff --git a/libs/cua/crates/cua-sdk/src/native/sandbox.rs b/libs/cua/crates/cua-sdk/src/native/sandbox.rsindex be9ded0b55..68580b8c09 100644--- a/libs/cua/crates/cua-sdk/src/native/sandbox.rs+++ b/libs/cua/crates/cua-sdk/src/native/sandbox.rs@@ -971,7 +971,11 @@ pub struct Sandboxes {impl Sandboxes {/// Creates without applying overlays.- async fn create_bare(&self, options: SandboxCreateOptions) -> Result<Arc<Sandbox>> {+ async fn create_bare(+ &self,+ options: SandboxCreateOptions,+ progress: Option<cua_sandbox_core::progress::Sink>,+ ) -> Result<Arc<Sandbox>> {let placement = options.placement()?;let mut req = options.to_request()?;let backend = self.backend.clone();@@ -982,9 +986,12 @@ impl Sandboxes {if let Some(s) = secret {req.registry_credentials = Some(s.credentials(&req.image).await?);}- Ok(match &backend {- Backend::Embedded(rt) => rt.create(req).await?,- Backend::Daemon(d) => d.create(req).await?,+ Ok(match (&backend, progress) {+ (Backend::Embedded(rt), progress) => {+ cua_sandbox_core::progress::carry(progress, rt.create(req)).await?+ }+ (Backend::Daemon(d), Some(progress)) => d.create_reporting(req, progress).await?,+ (Backend::Daemon(d), None) => d.create(req).await?,})}).await@@ -1021,6 +1028,28 @@ impl Sandboxes {/// Creates (Fleet, local) or connects (direct) a sandbox and waits for/// the provider and every readiness probe.pub async fn create(&self, options: SandboxCreateOptions) -> Result<Arc<Sandbox>> {+ self.create_reported(options, None).await+ }+}++impl Sandboxes {+ /// Rust hosts: [`Sandboxes::create`], passing what the create does (the+ /// image download with its bytes, creating, booting, the readiness+ /// probes) to `progress` as it happens. Through a daemon that predates+ /// streaming creates, `progress` hears nothing.+ pub async fn create_reporting(+ &self,+ options: SandboxCreateOptions,+ progress: cua_sandbox_core::progress::Sink,+ ) -> Result<Arc<Sandbox>> {+ self.create_reported(options, Some(progress)).await+ }++ async fn create_reported(+ &self,+ options: SandboxCreateOptions,+ progress: Option<cua_sandbox_core::progress::Sink>,+ ) -> Result<Arc<Sandbox>> {let facts = super::telemetry::CreateFacts::of(&options);let mut options = options;// A local sandbox's cua-spacesd reports aggregate health counts only@@ -1031,20 +1060,22 @@ impl Sandboxes {.entry("CUA_SPACESD_TELEMETRY".into()).or_insert_with(|| "1".into());}- let r = self.create_recorded(options).await;+ let r = self.create_recorded(options, progress).await;facts.record(&r);r}-}-impl Sandboxes {- async fn create_recorded(&self, options: SandboxCreateOptions) -> Result<Arc<Sandbox>> {+ async fn create_recorded(+ &self,+ options: SandboxCreateOptions,+ progress: Option<cua_sandbox_core::progress::Sink>,+ ) -> Result<Arc<Sandbox>> {let overlays = options.overlays.clone();for o in &overlays {o.validate()?;}let ready_timeout_ms = options.ready_timeout_ms;- let sandbox = self.create_bare(options).await?;+ let sandbox = self.create_bare(options, progress).await?;if overlays.is_empty() {return Ok(sandbox);}diff --git a/libs/cua/crates/cua-sdk/tests/create_progress.rs b/libs/cua/crates/cua-sdk/tests/create_progress.rsindex de8232b3d6..5d54018e53 100644--- a/libs/cua/crates/cua-sdk/tests/create_progress.rs+++ b/libs/cua/crates/cua-sdk/tests/create_progress.rs@@ -387,3 +387,100 @@ async fn daemon_cancel_stops_the_create() {.await.expect("timed out");}++/// `Sandboxes::create_reporting` (what `cua sandbox create` prints): the+/// runtime's pull with its bytes, then the boot, embedded and through the+/// daemon (`CreateSandboxStream`).+async fn sandbox_create_reports(daemon: bool) {+ let w = world(daemon, false).await;+ let heard: Arc<Mutex<Vec<Progress>>> = Arc::default();+ let h = heard.clone();+ let mut o = cua_sdk::SandboxCreateOptions::new("local", "ghcr.io/trycua/linux:24.04");+ o.kind = Some("container".into());+ o.name = Some("cua-e2e-sandbox-progress".into());+ let sandbox = w+ .cua+ .sandboxes()+ .create_reporting(o, Arc::new(move |p| h.lock().unwrap().push(p.clone())))+ .await+ .unwrap();+ assert_eq!(sandbox.info().name, "cua-e2e-sandbox-progress");+ let heard = heard.lock().unwrap().clone();+ let mut phases: Vec<Phase> = heard.iter().map(|p| p.phase).collect();+ phases.dedup();+ assert!(+ phases+ .windows(2)+ .any(|w| w == [Phase::Pulling, Phase::Booting]),+ "{phases:?}"+ );+ let bytes: Vec<_> = heard.iter().filter_map(|p| p.bytes).collect();+ assert_eq!(bytes.len(), 1, "{heard:?}");+ assert_eq!(+ (bytes[0].done, bytes[0].total, bytes[0].per_second),+ (250, 1000, Some(100.0))+ );+ assert!(+ heard+ .iter()+ .any(|p| p.detail == "ghcr.io/trycua/linux:24.04")+ );+}++#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn embedded_sandbox_create_reports_progress() {+ tokio::time::timeout(Duration::from_secs(60), sandbox_create_reports(false))+ .await+ .expect("timed out");+}++#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn daemon_streams_sandbox_create_progress() {+ tokio::time::timeout(Duration::from_secs(60), sandbox_create_reports(true))+ .await+ .expect("timed out");+}++/// Closing the daemon's create stream (a `cua sandbox create` that went+/// away) cancels the create, as for a unary `CreateSandbox`: nothing is+/// left running.+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn a_closed_sandbox_create_stream_cancels_the_create() {+ tokio::time::timeout(Duration::from_secs(60), async {+ let w = world_with(true, false, true).await;+ let heard: Arc<Mutex<Vec<Progress>>> = Arc::default();+ let h = heard.clone();+ let mut o = cua_sdk::SandboxCreateOptions::new("local", "ghcr.io/trycua/linux:24.04");+ o.kind = Some("container".into());+ o.name = Some("cua-e2e-sandbox-gone".into());+ let sandboxes = w.cua.sandboxes();+ let create = {+ let sandboxes = sandboxes.clone();+ tokio::spawn(async move {+ sandboxes+ .create_reporting(o, Arc::new(move |p| h.lock().unwrap().push(p.clone())))+ .await+ })+ };+ while !heard.lock().unwrap().iter().any(|p| p.bytes.is_some()) {+ tokio::time::sleep(Duration::from_millis(20)).await;+ }+ create.abort();+ let _ = create.await;+ // The daemon notices the closed stream and drops the create.+ let deadline = tokio::time::Instant::now() + Duration::from_secs(20);+ loop {+ let listed = sandboxes.list(Some("local".into())).await.unwrap();+ if !listed.iter().any(|s| s.name == "cua-e2e-sandbox-gone") {+ break;+ }+ assert!(+ tokio::time::Instant::now() < deadline,+ "still listed: {listed:?}"+ );+ tokio::time::sleep(Duration::from_millis(100)).await;+ }+ })+ .await+ .expect("timed out");+}diff --git a/libs/cua/crates/cua-spaces-app-core/parity/create-stages.json b/libs/cua/crates/cua-spaces-app-core/parity/create-stages.jsonnew file mode 100644index 0000000000..0769aa1b17--- /dev/null+++ b/libs/cua/crates/cua-spaces-app-core/parity/create-stages.json@@ -0,0 +1,159 @@+{+ "name": "create-stages",+ "about": "A create names the step it is on in its kind of Space's words, and shows the download's bytes, rate and time left: a first macOS Space on another of your machines (its host downloads the 30 GB base image, then prepares the disk, boots macOS and starts Cua inside it), a Linux VM here, and a container. The row never sits at the 1% floor while the host downloads (CUA-1635).",+ "now": 1800000000000,+ "rows": [],+ "creates": [+ {+ "type": "start",+ "id": "pending:mac",+ "name": "",+ "os": "macos",+ "provider": "relay",+ "now": 1800000001000,+ "image": "macos",+ "host": "mac-mini",+ "hostName": "Mac mini"+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "preparing",+ "fraction": null,+ "now": 1800000001200+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "pulling",+ "fraction": 0.0,+ "now": 1800000003000,+ "bytesDone": 0,+ "bytesTotal": 32212254720+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "pulling",+ "fraction": 0.41333333333333333,+ "now": 1800000150000,+ "bytesDone": 13314398617,+ "bytesTotal": 32212254720,+ "bytesPerSecond": 89128960.0+ },+ {+ "type": "tick",+ "now": 1800000150500+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "pulling",+ "fraction": 1.0,+ "now": 1800000362000,+ "bytesDone": 32212254720,+ "bytesTotal": 32212254720,+ "bytesPerSecond": 89128960.0+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "creating",+ "fraction": null,+ "now": 1800000363000+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "booting",+ "fraction": null,+ "now": 1800000370000+ },+ {+ "type": "tick",+ "now": 1800000385000+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "waiting_for_services",+ "fraction": null,+ "now": 1800000400000+ },+ {+ "type": "progress",+ "id": "pending:mac",+ "phase": "connecting",+ "fraction": null,+ "now": 1800000430000+ },+ {+ "type": "start",+ "id": "pending:vm",+ "name": "",+ "os": "linux",+ "provider": "local",+ "now": 1800000431000,+ "image": "ghcr.io/trycua/linux:24.04-slim-disk",+ "kind": "vm",+ "hostArch": "aarch64"+ },+ {+ "type": "progress",+ "id": "pending:vm",+ "phase": "pulling",+ "fraction": 0.5,+ "now": 1800000432000,+ "bytesDone": 251658240,+ "bytesTotal": 503316480,+ "bytesPerSecond": 25165824.0+ },+ {+ "type": "progress",+ "id": "pending:vm",+ "phase": "creating",+ "fraction": null,+ "now": 1800000445000+ },+ {+ "type": "progress",+ "id": "pending:vm",+ "phase": "booting",+ "fraction": null,+ "now": 1800000446000+ },+ {+ "type": "start",+ "id": "pending:box",+ "name": "box",+ "os": "linux",+ "provider": "local",+ "now": 1800000447000,+ "image": "ghcr.io/trycua/linux:24.04-slim",+ "kind": "container",+ "hostArch": "aarch64"+ },+ {+ "type": "progress",+ "id": "pending:box",+ "phase": "creating",+ "fraction": null,+ "now": 1800000448000+ },+ {+ "type": "progress",+ "id": "pending:box",+ "phase": "booting",+ "fraction": null,+ "now": 1800000448500+ },+ {+ "type": "progress",+ "id": "pending:box",+ "phase": "waiting_for_services",+ "fraction": null,+ "now": 1800000449000+ }+ ],+ "refreshed": []+}diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-cancel.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-cancel.jsonindex e0a5be4f47..3f165c77a3 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-cancel.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-cancel.json@@ -78,12 +78,12 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Downloading image…",+ "Status: Downloading macOS (first time only)…","System: macOS","Kind: Virtual machine"],"id": "pending:1",- "previewText": "Downloading image…",+ "previewText": "Downloading macOS (first time only)…","progress": 160,"progressText": "3.9 of 22.3 GB · 81 MB/s · about 4 min"}@@ -96,7 +96,7 @@"os-macos Mac [Starting] 160 16%"],"tiles": [- "os-macos Mac, macOS, This Mac, Starting 160 Downloading image…"+ "os-macos Mac, macOS, This Mac, Starting 160 Downloading macOS (first time only)…"]}},@@ -120,12 +120,12 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Downloading image…",+ "Status: Downloading macOS (first time only)…","System: macOS","Kind: Virtual machine"],"id": "pending:1",- "previewText": "Downloading image…",+ "previewText": "Downloading macOS (first time only)…","progress": 187,"progressText": "4.7 of 22.3 GB · 80 MB/s · about 4 min"}@@ -138,7 +138,7 @@"os-macos Mac [Starting] 187 18%"],"tiles": [- "os-macos Mac, macOS, This Mac, Starting 187 Downloading image…"+ "os-macos Mac, macOS, This Mac, Starting 187 Downloading macOS (first time only)…"]}},diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-progress.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-progress.jsonindex 2cb486277c..fad41d529a 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-progress.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-progress.json@@ -344,14 +344,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Booting… 36%",+ "Status: Booting Linux… 36%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Booting…",+ "previewText": "Booting Linux…","progress": 360,"progressText": null}@@ -364,7 +364,7 @@"os-omarchy New Space [Starting] 360 36%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 360 Booting…"+ "os-omarchy New Space, Linux, This Mac, Starting 360 Booting Linux…"]}},@@ -388,14 +388,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Booting… 36%",+ "Status: Booting Linux… 36%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Booting…",+ "previewText": "Booting Linux…","progress": 361,"progressText": null}@@ -408,7 +408,7 @@"os-omarchy New Space [Starting] 361 36%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 361 Booting…"+ "os-omarchy New Space, Linux, This Mac, Starting 361 Booting Linux…"]}},@@ -432,14 +432,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 36%",+ "Status: Starting Cua inside the Space… 36%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 362,"progressText": null}@@ -452,7 +452,7 @@"os-omarchy New Space [Starting] 362 36%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 362 Starting services…"+ "os-omarchy New Space, Linux, This Mac, Starting 362 Starting Cua inside the Space…"]}},@@ -476,14 +476,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 52%",+ "Status: Starting Cua inside the Space… 52%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 525,"progressText": null}@@ -496,7 +496,7 @@"os-omarchy New Space [Starting] 525 52%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 525 Starting services…"+ "os-omarchy New Space, Linux, This Mac, Starting 525 Starting Cua inside the Space…"]}},@@ -520,14 +520,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 85%",+ "Status: Starting Cua inside the Space… 85%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 851,"progressText": null}@@ -540,7 +540,7 @@"os-omarchy New Space [Starting] 851 85%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 851 Starting services…"+ "os-omarchy New Space, Linux, This Mac, Starting 851 Starting Cua inside the Space…"]}},@@ -564,14 +564,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 96%",+ "Status: Starting Cua inside the Space… 96%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 963,"progressText": null}@@ -584,7 +584,7 @@"os-omarchy New Space [Starting] 963 96%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 963 Starting services…"+ "os-omarchy New Space, Linux, This Mac, Starting 963 Starting Cua inside the Space…"]}},@@ -608,14 +608,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 96%",+ "Status: Starting Cua inside the Space… 96%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 968,"progressText": null}@@ -628,7 +628,7 @@"os-omarchy New Space [Starting] 968 96%"],"tiles": [- "os-omarchy New Space, Linux, This Mac, Starting 968 Starting services…"+ "os-omarchy New Space, Linux, This Mac, Starting 968 Starting Cua inside the Space…"]}},@@ -674,14 +674,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 96%",+ "Status: Starting Cua inside the Space… 96%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 968,"progressText": null}@@ -697,7 +697,7 @@],"tiles": ["os-ubuntu New Space, Linux, This Mac, Starting 10 Starting…",- "os-omarchy New Space, Linux, This Mac, Starting 968 Starting services…"+ "os-omarchy New Space, Linux, This Mac, Starting 968 Starting Cua inside the Space…"]}},@@ -721,14 +721,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Creating… 5%",+ "Status: Creating the container… 5%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Creating…",+ "previewText": "Creating the container…","progress": 59,"progressText": null},@@ -743,14 +743,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 96%",+ "Status: Starting Cua inside the Space… 96%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 968,"progressText": null}@@ -765,8 +765,8 @@"os-omarchy New Space [Starting] 968 96%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 59 Creating…",- "os-omarchy New Space, Linux, This Mac, Starting 968 Starting services…"+ "os-ubuntu New Space, Linux, This Mac, Starting 59 Creating the container…",+ "os-omarchy New Space, Linux, This Mac, Starting 968 Starting Cua inside the Space…"]}},@@ -790,14 +790,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Creating… 12%",+ "Status: Creating the container… 12%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Creating…",+ "previewText": "Creating the container…","progress": 124,"progressText": null},@@ -812,14 +812,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 96%",+ "Status: Starting Cua inside the Space… 96%","Image: ghcr.io/trycua/omarchy:edge [copy ghcr.io/trycua/omarchy:edge doc.on.doc Copy / checkmark Copied 1500ms]","System: Omarchy","Kind: Virtual machine","Architecture: x64"],"id": "pending:1",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 968,"progressText": null}@@ -834,8 +834,8 @@"os-omarchy New Space [Starting] 968 96%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 124 Creating…",- "os-omarchy New Space, Linux, This Mac, Starting 968 Starting services…"+ "os-ubuntu New Space, Linux, This Mac, Starting 124 Creating the container…",+ "os-omarchy New Space, Linux, This Mac, Starting 968 Starting Cua inside the Space…"]}},@@ -859,14 +859,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Creating… 12%",+ "Status: Creating the container… 12%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Creating…",+ "previewText": "Creating the container…","progress": 124,"progressText": null},@@ -903,7 +903,7 @@"os-omarchy New Space [Starting] 987 98%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 124 Creating…",+ "os-ubuntu New Space, Linux, This Mac, Starting 124 Creating the container…","os-omarchy New Space, Linux, This Mac, Starting 987 Connecting…"]}@@ -928,14 +928,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 17%",+ "Status: Starting Cua inside the Space… 17%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 172,"progressText": null},@@ -972,7 +972,7 @@"os-omarchy New Space [Starting] 987 98%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 172 Starting services…",+ "os-ubuntu New Space, Linux, This Mac, Starting 172 Starting Cua inside the Space…","os-omarchy New Space, Linux, This Mac, Starting 987 Connecting…"]}@@ -997,14 +997,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 83%",+ "Status: Starting Cua inside the Space… 83%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 831,"progressText": null},@@ -1041,7 +1041,7 @@"os-omarchy New Space [Starting] 989 98%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 831 Starting services…",+ "os-ubuntu New Space, Linux, This Mac, Starting 831 Starting Cua inside the Space…","os-omarchy New Space, Linux, This Mac, Starting 989 Connecting…"]}@@ -1066,14 +1066,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 83%",+ "Status: Starting Cua inside the Space… 83%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 831,"progressText": null},@@ -1110,7 +1110,7 @@"os-omarchy New Space [Starting] 989 98%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 831 Starting services…",+ "os-ubuntu New Space, Linux, This Mac, Starting 831 Starting Cua inside the Space…","os-omarchy New Space, Linux, This Mac, Starting 989 Downloading image…"]}@@ -1135,14 +1135,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 83%",+ "Status: Starting Cua inside the Space… 83%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 831,"progressText": null},@@ -1179,7 +1179,7 @@"os-omarchy New Space [Starting] 1000 100%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 831 Starting services…",+ "os-ubuntu New Space, Linux, This Mac, Starting 831 Starting Cua inside the Space…","os-omarchy New Space, Linux, This Mac, Starting 1000 Ready"]}@@ -1204,14 +1204,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 90%",+ "Status: Starting Cua inside the Space… 90%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 900,"progressText": null},@@ -1248,7 +1248,7 @@"os-omarchy New Space [Starting] 1000 100%"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 900 Starting services…",+ "os-ubuntu New Space, Linux, This Mac, Starting 900 Starting Cua inside the Space…","os-omarchy New Space, Linux, This Mac, Starting 1000 Ready"]}@@ -1273,14 +1273,14 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Starting services… 90%",+ "Status: Starting Cua inside the Space… 90%","Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]","System: Ubuntu 24.04","Kind: Container","Architecture: ARM"],"id": "pending:2",- "previewText": "Starting services…",+ "previewText": "Starting Cua inside the Space…","progress": 900,"progressText": null},@@ -1318,7 +1318,7 @@"os-omarchy omarchy [Running] - -"],"tiles": [- "os-ubuntu New Space, Linux, This Mac, Starting 900 Starting services…",+ "os-ubuntu New Space, Linux, This Mac, Starting 900 Starting Cua inside the Space…","os-omarchy omarchy, Linux, This Mac, Running - -"]}diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-stages.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-stages.jsonnew file mode 100644index 0000000000..d3d9275fe7--- /dev/null+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-stages.json@@ -0,0 +1,1230 @@+{+ "flow": "provisioning",+ "frames": [+ {+ "creates": "initial",+ "frame": {+ "activity": {+ "kind": null,+ "label": null,+ "permille": null+ },+ "details": [],+ "ids": [],+ "pending": true,+ "rows": [],+ "tiles": []+ }+ },+ {+ "creates": "start pending:mac",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 10+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting… 1%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Starting…",+ "progress": 10,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 10 1%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 10 Starting…"+ ]+ }+ },+ {+ "creates": "progress pending:mac preparing",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 10+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting… 1%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Starting…",+ "progress": 10,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 10 1%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 10 Starting…"+ ]+ }+ },+ {+ "creates": "progress pending:mac pulling",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 13+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Downloading macOS (first time only)…",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Downloading macOS (first time only)…",+ "progress": 13,+ "progressText": "0.0 of 30.0 GB"+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 13 1%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 13 Downloading macOS (first time only)…"+ ]+ }+ },+ {+ "creates": "progress pending:mac pulling",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 358+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Downloading macOS (first time only)…",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Downloading macOS (first time only)…",+ "progress": 358,+ "progressText": "12.4 of 30.0 GB · 85 MB/s · about 4 min"+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 358 35%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 358 Downloading macOS (first time only)…"+ ]+ }+ },+ {+ "creates": "tick",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 358+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Downloading macOS (first time only)…",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Downloading macOS (first time only)…",+ "progress": 358,+ "progressText": "12.4 of 30.0 GB · 85 MB/s · about 4 min"+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 358 35%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 358 Downloading macOS (first time only)…"+ ]+ }+ },+ {+ "creates": "progress pending:mac pulling",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 847+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Downloading macOS (first time only)…",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Downloading macOS (first time only)…",+ "progress": 847,+ "progressText": "30.0 of 30.0 GB · 85 MB/s · less than a minute"+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 847 84%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 847 Downloading macOS (first time only)…"+ ]+ }+ },+ {+ "creates": "progress pending:mac creating",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 847+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Preparing the disk… 84%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Preparing the disk…",+ "progress": 847,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 847 84%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 847 Preparing the disk…"+ ]+ }+ },+ {+ "creates": "progress pending:mac booting",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 861+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting macOS… 86%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Booting macOS…",+ "progress": 861,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 861 86%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 861 Booting macOS…"+ ]+ }+ },+ {+ "creates": "tick",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 881+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting macOS… 88%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Booting macOS…",+ "progress": 881,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 881 88%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 881 Booting macOS…"+ ]+ }+ },+ {+ "creates": "progress pending:mac waiting_for_services",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 902+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting Cua inside the Space… 90%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Starting Cua inside the Space…",+ "progress": 902,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 902 90%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 902 Starting Cua inside the Space…"+ ]+ }+ },+ {+ "creates": "progress pending:mac connecting",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 1 Space",+ "permille": 986+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "start pending:vm",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 2 Spaces",+ "permille": 10+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting… 1%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Starting…",+ "progress": 10,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu New Space [Starting] 10 1%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu New Space, Linux, This Mac, Starting 10 Starting…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "progress pending:vm pulling",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 2 Spaces",+ "permille": 291+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Downloading image…",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Downloading image…",+ "progress": 291,+ "progressText": "240 of 480 MB · 24 MB/s · less than a minute"+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu New Space [Starting] 291 29%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu New Space, Linux, This Mac, Starting 291 Downloading image…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "progress pending:vm creating",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 2 Spaces",+ "permille": 538+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Preparing the disk… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Preparing the disk…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Preparing the disk…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "progress pending:vm booting",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 2 Spaces",+ "permille": 538+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting Linux… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Booting Linux…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Booting Linux…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "start pending:box",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 3 Spaces",+ "permille": 10+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting… 1%",+ "Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Container",+ "Architecture: ARM"+ ],+ "id": "pending:box",+ "previewText": "Starting…",+ "progress": 10,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting Linux… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Booting Linux…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:box",+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu box [Starting] 10 1%",+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu box, Linux, This Mac, Starting 10 Starting…",+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Booting Linux…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "progress pending:box creating",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 3 Spaces",+ "permille": 59+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Creating the container… 5%",+ "Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Container",+ "Architecture: ARM"+ ],+ "id": "pending:box",+ "previewText": "Creating the container…",+ "progress": 59,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting Linux… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Booting Linux…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:box",+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu box [Starting] 59 5%",+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu box, Linux, This Mac, Starting 59 Creating the container…",+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Booting Linux…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "progress pending:box booting",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 3 Spaces",+ "permille": 127+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting the container… 12%",+ "Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Container",+ "Architecture: ARM"+ ],+ "id": "pending:box",+ "previewText": "Starting the container…",+ "progress": 127,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting Linux… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Booting Linux…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:box",+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu box [Starting] 127 12%",+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu box, Linux, This Mac, Starting 127 Starting the container…",+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Booting Linux…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "progress pending:box waiting_for_services",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 3 Spaces",+ "permille": 172+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting Cua inside the Space… 17%",+ "Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Container",+ "Architecture: ARM"+ ],+ "id": "pending:box",+ "previewText": "Starting Cua inside the Space…",+ "progress": 172,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting Linux… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Booting Linux…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:box",+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu box [Starting] 172 17%",+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu box, Linux, This Mac, Starting 172 Starting Cua inside the Space…",+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Booting Linux…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ },+ {+ "creates": "refreshed",+ "frame": {+ "activity": {+ "kind": "provisioning",+ "label": "Starting 3 Spaces",+ "permille": 172+ },+ "details": [+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Starting Cua inside the Space… 17%",+ "Image: ghcr.io/trycua/linux:24.04-slim [copy ghcr.io/trycua/linux:24.04-slim doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Container",+ "Architecture: ARM"+ ],+ "id": "pending:box",+ "previewText": "Starting Cua inside the Space…",+ "progress": 172,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Booting Linux… 53%",+ "Image: ghcr.io/trycua/linux:24.04-slim-disk [copy ghcr.io/trycua/linux:24.04-slim-disk doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: Ubuntu 24.04",+ "Kind: Virtual machine",+ "Architecture: ARM"+ ],+ "id": "pending:vm",+ "previewText": "Booting Linux…",+ "progress": 538,+ "progressText": null+ },+ {+ "actions": [+ "Teleport an app (off)",+ "Picture in picture (off)",+ "Share (off)",+ "Cancel",+ "Open (off)"+ ],+ "canStream": false,+ "creditNotice": null,+ "facts": [+ "Status: Connecting… 98%",+ "Image: macos [copy macos doc.on.doc Copy / checkmark Copied 1500ms]",+ "System: macOS",+ "Kind: Virtual machine"+ ],+ "id": "pending:mac",+ "previewText": "Connecting…",+ "progress": 986,+ "progressText": null+ }+ ],+ "ids": [+ "pending:box",+ "pending:vm",+ "pending:mac"+ ],+ "pending": true,+ "rows": [+ "os-ubuntu box [Starting] 172 17%",+ "os-ubuntu New Space [Starting] 538 53%",+ "os-macos macOS Space [Starting] 986 98%"+ ],+ "tiles": [+ "os-ubuntu box, Linux, This Mac, Starting 172 Starting Cua inside the Space…",+ "os-ubuntu New Space, Linux, This Mac, Starting 538 Booting Linux…",+ "os-macos macOS Space, macOS, Mac mini, Starting 986 Connecting…"+ ]+ }+ }+ ]+}diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/provisioning.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/provisioning.jsonindex a088b7f3c2..02c792e623 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/provisioning.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/provisioning.json@@ -342,12 +342,12 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Creating… 1%",+ "Status: Preparing the disk… 1%","System: macOS","Kind: Virtual machine"],"id": "pending:2",- "previewText": "Creating…",+ "previewText": "Preparing the disk…","progress": 13,"progressText": null},@@ -403,7 +403,7 @@"os-linux demo [Running] - -"],"tiles": [- "os-macos Mac, macOS, This Mac, Starting 13 Creating…",+ "os-macos Mac, macOS, This Mac, Starting 13 Preparing the disk…","os-linux New Space, Linux, This Mac, Starting 425 Downloading image…","os-linux demo, Linux, This Mac, Running - -"]@@ -429,12 +429,12 @@"canStream": false,"creditNotice": null,"facts": [- "Status: Creating… 1%",+ "Status: Preparing the disk… 1%","System: macOS","Kind: Virtual machine"],"id": "pending:2",- "previewText": "Creating…",+ "previewText": "Preparing the disk…","progress": 13,"progressText": null},@@ -490,7 +490,7 @@"os-linux demo [Running] - -"],"tiles": [- "os-macos Mac, macOS, This Mac, Starting 13 Creating…",+ "os-macos Mac, macOS, This Mac, Starting 13 Preparing the disk…","os-linux New Space, Linux, This Mac, Starting 805 Booting…","os-linux demo, Linux, This Mac, Running - -"]diff --git a/libs/cua/crates/cua-spaces-app-core/src/parity.rs b/libs/cua/crates/cua-spaces-app-core/src/parity.rsindex fe295b8340..a2eaa9de33 100644--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs@@ -207,6 +207,11 @@ pub const FLOWS: &[(&str, &str, &str)] = &[include_str!("../parity/checklist.json"),include_str!("../parity/golden/checklist.json"),),+ (+ "create-stages",+ include_str!("../parity/create-stages.json"),+ include_str!("../parity/golden/create-stages.json"),+ ),];/// The core calls a flow makes, over JSON. A host implements it with its@@ -1884,7 +1889,9 @@ pub fn run(name: &str, flow_json: &str, h: &dyn Host) -> Result<Value, String> {"main-window" => run_main_window(&flow, h),"notch" => run_notch(&flow, h),"notch-drag-trigger" => run_notch_drag_trigger(&flow, h),- "provisioning" | "create-progress" | "create-cancel" => run_provisioning(&flow, h),+ "provisioning" | "create-progress" | "create-cancel" | "create-stages" => {+ run_provisioning(&flow, h)+ }"stream-section" => run_stream_section(&flow, h),"space-facts" => run_space_facts(&flow, h),"picker-grid" => run_picker_grid(&flow, h),diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rsindex 882e8931dd..e233798860 100644--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs@@ -565,6 +565,35 @@ pub fn phase_label(phase: &str) -> &'static str {}}+/// The words for the step a create is on, for its kind of Space (the+/// stages a person sees): a macOS Space says "Downloading macOS (first+/// time only)…", "Preparing the disk…" (its copy-on-write clone), "Booting+/// macOS…", then "Starting Cua inside the Space…"; a Linux or Windows VM+/// the same with its OS, a container "Creating the container…" and+/// "Starting the container…". A step it has no words of its own for+/// (preparing, connecting, a cloud claim) reads as [`phase_label`].+pub fn stage_label(p: &PendingCreate) -> String {+ let here = p.provider != SpaceProvider::Cloud;+ let vm = matches!(p.os, SpaceOs::Macos | SpaceOs::Windows) || p.kind == Some(SpaceKind::Vm);+ let container = !vm && p.kind == Some(SpaceKind::Container);+ let os = match p.os {+ SpaceOs::Macos => "macOS",+ SpaceOs::Windows => "Windows",+ SpaceOs::Linux => "Linux",+ SpaceOs::Unknown => "",+ };+ match p.phase.as_str() {+ // Lume keeps the base image: later macOS Spaces clone it.+ "pulling" if p.os == SpaceOs::Macos => "Downloading macOS (first time only)\u{2026}".into(),+ "creating" if here && vm => "Preparing the disk\u{2026}".into(),+ "creating" if here && container => "Creating the container\u{2026}".into(),+ "booting" if here && vm && !os.is_empty() => format!("Booting {os}\u{2026}"),+ "booting" if here && container => "Starting the container\u{2026}".into(),+ "waiting_for_services" => "Starting Cua inside the Space\u{2026}".into(),+ other => phase_label(other).into(),+ }+}+/// The end of every stall message ([`stall_error`]): progress that arrives/// after it clears the row again. A failure the SDK reported never ends/// with it ([`failure_text`]).@@ -1241,7 +1270,7 @@ pub fn pending_space(p: &PendingCreate) -> Space {_ => "Setting up the runtime\u{2026}".to_string(),}} else {- phase_label(&p.phase).to_string()+ stage_label(p)};// The catalog's distribution: the right icon and System from the start.let distro = p.image.as_deref().and_then(crate::wizard::image_distro);@@ -1427,6 +1456,141 @@ mod tests {}}+ /// A create says which step it is on, in the words of its kind of+ /// Space, with the download's bytes and time left under the bar: the+ /// same on this Mac and on another of your machines.+ #[test]+ fn a_create_names_each_stage_for_its_kind_of_space() {+ let stages = |os: SpaceOs, kind: Option<SpaceKind>, provider: SpaceProvider| {+ let mut s = reduce(+ &CreatesState::default(),+ &CreateAction::Start {+ id: "pending:s".into(),+ name: String::new(),+ os,+ provider,+ now: 1_000,+ image: None,+ kind,+ host_arch: None,+ gpu: false,+ host: (provider == SpaceProvider::Relay).then(|| "mini".into()),+ host_name: (provider == SpaceProvider::Relay).then(|| "Mac mini".into()),+ },+ );+ let mut labels = vec![pending_space(&s.pending[0]).progress.unwrap().label];+ for (i, phase) in PHASES.iter().enumerate().skip(1) {+ s = reduce(+ &s,+ &CreateAction::Progress {+ id: "pending:s".into(),+ phase: (*phase).into(),+ fraction: None,+ now: Some(2_000 + i as i64),+ bytes_done: None,+ bytes_total: None,+ bytes_per_second: None,+ },+ );+ labels.push(pending_space(&s.pending[0]).progress.unwrap().label);+ }+ labels+ };+ let e = |s: &str| s.replace("...", "\u{2026}");+ let want = |v: [&str; 6]| v.map(e).to_vec();+ let macos = want([+ "Starting...",+ "Downloading macOS (first time only)...",+ "Preparing the disk...",+ "Booting macOS...",+ "Starting Cua inside the Space...",+ "Connecting...",+ ]);+ assert_eq!(stages(SpaceOs::Macos, None, SpaceProvider::Local), macos);+ // On another of your machines: the same stages.+ assert_eq!(stages(SpaceOs::Macos, None, SpaceProvider::Relay), macos);+ assert_eq!(+ stages(SpaceOs::Linux, Some(SpaceKind::Vm), SpaceProvider::Local),+ want([+ "Starting...",+ "Downloading image...",+ "Preparing the disk...",+ "Booting Linux...",+ "Starting Cua inside the Space...",+ "Connecting...",+ ])+ );+ assert_eq!(+ stages(+ SpaceOs::Linux,+ Some(SpaceKind::Container),+ SpaceProvider::Local+ ),+ want([+ "Starting...",+ "Downloading image...",+ "Creating the container...",+ "Starting the container...",+ "Starting Cua inside the Space...",+ "Connecting...",+ ])+ );+ // A cloud claim: no disk or boot of its own to name.+ assert_eq!(+ stages(SpaceOs::Linux, Some(SpaceKind::Vm), SpaceProvider::Cloud),+ want([+ "Starting...",+ "Downloading image...",+ "Creating...",+ "Booting...",+ "Starting Cua inside the Space...",+ "Connecting...",+ ])+ );++ // The download: bytes, rate and time left under the bar, on the+ // row of a create on another machine too.+ let s = reduce(+ &CreatesState::default(),+ &CreateAction::Start {+ id: "pending:r".into(),+ name: String::new(),+ os: SpaceOs::Macos,+ provider: SpaceProvider::Relay,+ now: 1_000,+ image: None,+ kind: None,+ host_arch: None,+ gpu: false,+ host: Some("mini".into()),+ host_name: Some("Mac mini".into()),+ },+ );+ let gb = 1u64 << 30;+ let s = reduce(+ &s,+ &bytes_at(+ "pending:r",+ gb * 124 / 10,+ 30 * gb,+ (85u64 << 20) as f64,+ 5_000,+ ),+ );+ let row = pending_space(&s.pending[0]);+ let p = row.progress.unwrap();+ assert_eq!(p.label, e("Downloading macOS (first time only)..."));+ assert_eq!(+ p.transfer.as_deref(),+ Some("12.4 of 30.0 GB \u{b7} 85 MB/s \u{b7} about 4 min")+ );+ assert!(p.permille > 10, "past the 1% floor: {}", p.permille);+ assert_eq!(+ row.detail,+ e("Another machine \u{b7} Downloading macOS (first time only)...")+ );+ }+#[test]fn unknown_os_cannot_start_a_create() {let state = CreatesState::default();@@ -1465,7 +1629,7 @@ mod tests {let s = reduce(&s, &bytes_at("pending:m", 1 << 30, 20 << 30, 5e7, 3_000));assert_eq!(pending_space(&s.pending[0]).progress.unwrap().label,- "Downloading image\u{2026}"+ "Downloading macOS (first time only)\u{2026}");}diff --git a/libs/cua/crates/cua-spaces/src/host_spaces.rs b/libs/cua/crates/cua-spaces/src/host_spaces.rsindex 9ebb9ee42d..8c969fbf55 100644--- a/libs/cua/crates/cua-spaces/src/host_spaces.rs+++ b/libs/cua/crates/cua-spaces/src/host_spaces.rs@@ -265,11 +265,173 @@ impl Drop for Slot<'_> {}}+/// The creates a host runs now, by key ([`pb::HostSpaceCreating::key`]):+/// the caller's account, and what the create is doing.+#[derive(Clone, Default)]+struct Creating(Arc<Mutex<HashMap<String, (String, pb::HostSpaceCreating)>>>);++impl Creating {+ /// Lists the create `key` of `account` until the returned guard drops+ /// (the create ended, failed, or its call was dropped). `None` for an+ /// empty key (a caller that predates keys).+ fn follow(&self, key: &str, account: &str) -> Option<Following> {+ if key.is_empty() {+ return None;+ }+ let entry = pb::HostSpaceCreating {+ key: key.to_string(),+ phase: cua_sandbox_core::progress::Phase::Preparing.as_str().into(),+ ..Default::default()+ };+ self.lock()+ .insert(key.to_string(), (account.to_string(), entry));+ Some(Following {+ creating: self.clone(),+ key: key.to_string(),+ })+ }++ /// The creates `caller` may see: every one for the owner, its own+ /// otherwise.+ fn listed(&self, caller: &HostCaller) -> Vec<pb::HostSpaceCreating> {+ let mut out: Vec<_> = self+ .lock()+ .values()+ .filter(|(account, _)| caller.is_owner() || *account == caller.account)+ .map(|(_, c)| c.clone())+ .collect();+ out.sort_by(|a, b| a.key.cmp(&b.key));+ out+ }++ fn lock(&self) -> std::sync::MutexGuard<'_, HashMap<String, (String, pb::HostSpaceCreating)>> {+ self.0.lock().unwrap_or_else(|e| e.into_inner())+ }+}++/// A create [`Creating`] lists while this lives.+struct Following {+ creating: Creating,+ key: String,+}++impl Following {+ /// The create's progress sink: each report replaces what is listed.+ fn sink(&self) -> crate::ProgressSink {+ let creating = self.creating.clone();+ let key = self.key.clone();+ crate::ProgressSink::new(move |p| {+ if let Some((_, c)) = creating.lock().get_mut(&key) {+ *c = creating_pb(&key, p);+ }+ })+ }+}++impl Drop for Following {+ fn drop(&mut self) {+ self.creating.lock().remove(&self.key);+ }+}++/// A progress report as [`pb::HostSpaceCreating`].+fn creating_pb(key: &str, p: &crate::CreateProgress) -> pb::HostSpaceCreating {+ pb::HostSpaceCreating {+ key: key.to_string(),+ phase: p.phase.as_str().into(),+ fraction: p.fraction,+ detail: p.detail.clone(),+ bytes_done: p.bytes.map(|b| b.done),+ bytes_total: p.bytes.map(|b| b.total).filter(|t| *t > 0),+ bytes_per_second: p.bytes.and_then(|b| b.per_second),+ }+}++/// [`pb::HostSpaceCreating`] as a progress report of the caller's own+/// create. `None` for a phase it does not know, and for `ready`: the host+/// is done, but the caller still connects to the Space and says ready+/// itself.+fn host_progress(c: &pb::HostSpaceCreating) -> Option<crate::CreateProgress> {+ use cua_sandbox_core::progress::{Phase, Progress, Transfer};+ let phase = Phase::parse(&c.phase).filter(|p| *p != Phase::Ready)?;+ let mut p = Progress::phase(phase).detail(c.detail.clone());+ if let Some(f) = c.fraction {+ p = p.fraction(f);+ }+ if let Some(done) = c.bytes_done {+ p = p.bytes(Transfer {+ done,+ total: c.bytes_total.unwrap_or(0),+ per_second: c.bytes_per_second,+ });+ }+ Some(p)+}++/// How often a client asks a host how its create is doing.+const HOST_PROGRESS_POLL: Duration = Duration::from_secs(1);++/// How long a client asks before it decides the host does not list+/// creates (it predates [`pb::GetHostSpacesResponse::creating`]) and stops.+const HOST_PROGRESS_UNLISTED: Duration = Duration::from_secs(20);++/// Runs `call` (the `CreateHostSpace` of the create `key`) and meanwhile+/// reports what the host lists that create doing as this create's own+/// progress, in order: the image download with its bytes, the disk, the+/// boot. A host that predates the listing reports nothing, as before.+async fn following_host<T>(+ host: &cua_spacesd_client::SpacesdClient,+ key: &str,+ call: impl std::future::Future<Output = T>,+) -> T {+ let poll = async {+ let started = tokio::time::Instant::now();+ let mut listed = false;+ let mut last: Option<crate::CreateProgress> = None;+ loop {+ tokio::time::sleep(HOST_PROGRESS_POLL).await;+ if !listed && started.elapsed() >= HOST_PROGRESS_UNLISTED {+ return std::future::pending::<()>().await;+ }+ let Ok(r) = host+ .host_spaces()+ .get_host_spaces(pb::GetHostSpacesRequest {})+ .await+ else {+ continue;+ };+ let Some(c) = r.into_inner().creating.into_iter().find(|c| c.key == key) else {+ continue;+ };+ listed = true;+ let Some(p) = host_progress(&c) else {+ continue;+ };+ // Never back to an earlier phase, never the same report twice.+ if last+ .as_ref()+ .is_some_and(|l| p.phase.rank() < l.phase.rank() || *l == p)+ {+ continue;+ }+ cua_sandbox_core::progress::report(p.clone());+ last = Some(p);+ }+ };+ tokio::pin!(call);+ tokio::select! {+ out = &mut call => out,+ () = poll => unreachable!("the poll never ends"),+ }+}+/// The host half: what this machine's cua daemon does for/// `HostSpacesService` calls.pub struct HostSpacesServer {spaces: Spaces,reserved: Mutex<Reserved>,+ /// The creates running here, with what each is doing now.+ creating: Creating,/// The ports this host forwards to the Spaces it provides directly,/// by the Space's `local:` id.forwards: Mutex<HashMap<String, tokio::task::JoinHandle<()>>>,@@ -292,6 +454,7 @@ impl HostSpacesServer {Arc::new(Self {spaces,reserved: Mutex::default(),+ creating: Creating::default(),forwards: Mutex::default(),})}@@ -586,6 +749,7 @@ impl HostSpacesServer {vec![]},images,+ creating: self.creating.listed(caller),})}@@ -712,9 +876,15 @@ impl HostSpacesServer {let slot = self.reserve(&policy, &provided_now, macos, &host_name).map_err(|e| self.refuse(caller, &label, e))?;+ // Listed in `GetHostSpaces` while it runs, for the caller to follow.+ let key = Some(req.create_key.trim())+ .filter(|k| !k.is_empty())+ .unwrap_or(&attach.machine_id);+ let following = self.creating.follow(key, &caller.account);let created = self.spaces.create(SpaceCreate {+ progress: following.as_ref().map(Following::sink),image: Some(image.clone()),on: Some(On::Local),kind,@@ -1996,14 +2166,17 @@ impl Spaces {owner: reg.machine.owner.id.clone(),owner_email: reg.machine.owner.email.clone().unwrap_or_default(),}),+ create_key: machine.clone(),};let created = async {- space- .spacesd()?- .host_spaces()- .create_host_space(request)- .await- .map_err(|e| from_host(cua_spacesd_client::Error::from(e)))+ let host = space.spacesd()?;+ following_host(+ host,+ &machine,+ host.host_spaces().create_host_space(request),+ )+ .await+ .map_err(|e| from_host(cua_spacesd_client::Error::from(e)))}.await;if let Err(e) = created {@@ -2020,6 +2193,9 @@ impl Spaces {}// Its driver dials out on its own: wait (bounded) until the relay// lists it online.+ cua_sandbox_core::progress::report(cua_sandbox_core::progress::Progress::phase(+ cua_sandbox_core::progress::Phase::Connecting,+ ));let deadline = tokio::time::Instant::now() + ONLINE_WAIT;let mut row = None;while tokio::time::Instant::now() < deadline {@@ -2053,6 +2229,7 @@ impl Spaces {opts: SpaceCreate,) -> Result<SpaceInfo> {let space = self.direct_host_space(&host).await?;+ let key = format!("create-{:016x}", rand::random::<u64>());let request = pb::CreateHostSpaceRequest {image: opts.image.clone().unwrap_or_default(),kind: match opts.kind {@@ -2069,21 +2246,24 @@ impl Spaces {disk_gb: opts.disk_gb.unwrap_or(0),attach: None,direct: true,+ create_key: key.clone(),};- let made = space- .spacesd()?- .host_spaces()- .create_host_space(request)- .await- .map(tonic::Response::into_inner)- .map_err(|e| from_host(cua_spacesd_client::Error::from(e)))?- .space- .ok_or_else(|| {- Error::host(- "host spaces",- format!("{} answered without the Space it created", host.name),- )- })?;+ let host_client = space.spacesd()?;+ let made = following_host(+ host_client,+ &key,+ host_client.host_spaces().create_host_space(request),+ )+ .await+ .map(tonic::Response::into_inner)+ .map_err(|e| from_host(cua_spacesd_client::Error::from(e)))?+ .space+ .ok_or_else(|| {+ Error::host(+ "host spaces",+ format!("{} answered without the Space it created", host.name),+ )+ })?;let SpaceId::Direct { authority } = SpaceId::parse(&host.space)? else {return Err(Error::invalid(format!("{} is not a direct Space",diff --git a/libs/cua/crates/cua-spaces/tests/host_spaces.rs b/libs/cua/crates/cua-spaces/tests/host_spaces.rsindex e98a869aff..ccffd867d5 100644--- a/libs/cua/crates/cua-spaces/tests/host_spaces.rs+++ b/libs/cua/crates/cua-spaces/tests/host_spaces.rs@@ -36,6 +36,9 @@ struct FakeRuntime {hang: std::sync::atomic::AtomicBool,/// Starts fail with this (a container engine that does not answer).fail: Mutex<Option<String>>,+ /// Starts first download an image of this many bytes, slowly,+ /// reporting it as create progress (as Lume's pull does).+ pull_bytes: Mutex<Option<u64>>,}#[async_trait]@@ -47,6 +50,28 @@ impl LocalRuntime for FakeRuntime {if let Some(e) = self.fail.lock().unwrap().clone() {return Err(RuntimeError::Other(e));}+ let pull = *self.pull_bytes.lock().unwrap();+ if let Some(total) = pull {+ use cua_sandbox_core::progress::{Phase, Progress, Transfer, report};+ for i in 0..=30u64 {+ let done = total * i / 30;+ report(+ Progress::phase(Phase::Pulling)+ .detail("ghcr.io/trycua/macos:26")+ .fraction(done as f64 / total as f64)+ .bytes(Transfer {+ done,+ total,+ per_second: Some(total as f64 / 3.0),+ }),+ );+ tokio::time::sleep(std::time::Duration::from_millis(100)).await;+ }+ report(Progress::phase(Phase::Creating));+ report(Progress::phase(Phase::Booting));+ // A boot takes a while (a macOS VM's, a minute or more).+ tokio::time::sleep(std::time::Duration::from_millis(1500)).await;+ }self.started.lock().unwrap().push(spec.clone());self.running.lock().unwrap().insert(spec.name.clone(), true);if self.hang.load(std::sync::atomic::Ordering::SeqCst) {@@ -173,6 +198,7 @@ async fn runtime_fixture(paused: Mutex::default(),hang: Default::default(),fail: Mutex::default(),+ pull_bytes: Mutex::default(),});let spaces = Spaces::builder().home(&home)@@ -993,7 +1019,9 @@ async fn an_offline_machine_set_up_for_spaces_is_listed_by_name() {/// The host fixture's `HostSpacesServer` as the host's daemon serves it/// (every call as ada, the owner: the fake relay does not assert callers).-struct HostSvc(Arc<HostSpacesServer>);+/// The host's `HostSpacesService`; `old`: as a host that predates+/// `GetHostSpacesResponse.creating` answers (it never lists creates).+struct HostSvc(Arc<HostSpacesServer>, bool);#[tonic::async_trait]impl pb::host_spaces_service_server::HostSpacesService for HostSvc {@@ -1001,7 +1029,12 @@ impl pb::host_spaces_service_server::HostSpacesService for HostSvc {&self,_req: tonic::Request<pb::GetHostSpacesRequest>,) -> Result<tonic::Response<pb::GetHostSpacesResponse>, tonic::Status> {- let r = self.0.get(&ada()).await;+ let mut r = self.0.get(&ada()).await;+ if self.1+ && let Ok(r) = &mut r+ {+ r.creating.clear();+ }r.map(tonic::Response::new).map_err(|e| to_status(&e))}async fn create_host_space(@@ -1051,6 +1084,11 @@ impl pb::host_spaces_service_server::HostSpacesService for HostSvc {/// fixture's server, over gRPC-Web), and `spaces` is another of ada's/// devices, signed in to the relay. Returns the host's machine id.async fn client_fixture(f: &Fixture) -> (String, Spaces, tempfile::TempDir) {+ client_fixture_of(f, false).await+}++/// [`client_fixture`] with a host that predates listing its creates.+async fn client_fixture_of(f: &Fixture, old_host: bool) -> (String, Spaces, tempfile::TempDir) {let relay = cua_host::RelayClient::new(&f.relay.url).unwrap();let host = relay.machines("ada-token")@@ -1065,8 +1103,10 @@ async fn client_fixture(f: &Fixture) -> (String, Spaces, tempfile::TempDir) {f.relay.tunnel(&host, &f.env.url());let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();let addr = listener.local_addr().unwrap();- let svc =- pb::host_spaces_service_server::HostSpacesServiceServer::new(HostSvc(f.server.clone()));+ let svc = pb::host_spaces_service_server::HostSpacesServiceServer::new(HostSvc(+ f.server.clone(),+ old_host,+ ));tokio::spawn(tonic::transport::Server::builder().accept_http1(true)@@ -1278,3 +1318,157 @@ async fn a_host_that_stopped_sharing_says_so_and_lists_its_state() {assert_eq!(row.status, "");assert!(serde_json::to_value(&row).unwrap().get("status").is_none());}++/// A create on another machine reports what that machine does while it+/// runs: the image download with its bytes, then the disk and the boot,+/// in order, before the Space is ready. (Before, the call to the host was+/// one silent wait, so the row sat at "Starting… 1%" for the whole+/// download.)+/// Creates a Space on the fixture's host (whose runtime downloads+/// `TOTAL` bytes first) and returns every progress report the client saw.+async fn create_on_host_seeing(f: &Fixture, spaces: &Spaces) -> Vec<cua_spaces::CreateProgress> {+ *f.rt.pull_bytes.lock().unwrap() = Some(TOTAL);+ let seen = Arc::new(Mutex::new(Vec::<cua_spaces::CreateProgress>::new()));+ let s = seen.clone();+ let mut create = on_host("Mac mini (spare)");+ create.progress = Some(cua_spaces::ProgressSink::new(move |p| {+ s.lock().unwrap().push(p.clone())+ }));+ // The new Space's driver comes online on the relay once it is up.+ let relay = f.relay.clone();+ let online = tokio::spawn(async move {+ let client = cua_host::RelayClient::new(&relay.url).unwrap();+ loop {+ for m in client.machines("ada-token").await.unwrap_or_default() {+ if m.host.is_some() && !m.online {+ relay.set_online(&m.id, true, "1.0.0");+ }+ }+ tokio::time::sleep(std::time::Duration::from_millis(100)).await;+ }+ });+ spaces.create(create).await.unwrap();+ online.abort();+ seen.lock().unwrap().clone()+}++const TOTAL: u64 = 30 << 30;++#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn a_create_on_a_host_reports_the_hosts_progress() {+ let f = fixture(HostProfile::Spare).await;+ let (_host, spaces, _other) = client_fixture(&f).await;+ let seen = create_on_host_seeing(&f, &spaces).await;+ let pulls: Vec<_> = seen+ .iter()+ .filter(|p| p.phase == cua_spaces::CreatePhase::Pulling)+ .collect();+ assert!(+ pulls.len() >= 2,+ "the download is reported while it runs: {seen:#?}"+ );+ let bytes = pulls.iter().filter_map(|p| p.bytes).collect::<Vec<_>>();+ assert!(+ bytes.iter().all(|b| b.total == TOTAL),+ "bytes of the host's download: {bytes:?}"+ );+ assert!(+ bytes.windows(2).all(|w| w[0].done <= w[1].done),+ "bytes only go up: {bytes:?}"+ );+ assert!(+ bytes.iter().any(|b| b.per_second.is_some()),+ "with a rate, for the time left"+ );+ assert_eq!(pulls[0].detail, "ghcr.io/trycua/macos:26");+ let ranks: Vec<u8> = seen.iter().map(|p| p.phase.rank()).collect();+ assert!(+ ranks.windows(2).all(|w| w[0] <= w[1]),+ "phases in order: {seen:#?}"+ );+ for phase in [+ cua_spaces::CreatePhase::Booting,+ cua_spaces::CreatePhase::Connecting,+ cua_spaces::CreatePhase::Ready,+ ] {+ assert!(+ seen.iter().any(|p| p.phase == phase),+ "{phase:?} reported: {seen:#?}"+ );+ }+}++/// A host that predates listing its creates still creates the Space; the+/// client reports what it does itself (as before: no download to show).+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn a_create_on_an_older_host_still_works_without_its_progress() {+ let f = fixture(HostProfile::Spare).await;+ let (_host, spaces, _other) = client_fixture_of(&f, true).await;+ let seen = create_on_host_seeing(&f, &spaces).await;+ let phases: Vec<_> = seen.iter().map(|p| p.phase).collect();+ assert_eq!(+ phases,+ [+ cua_spaces::CreatePhase::Preparing,+ cua_spaces::CreatePhase::Connecting,+ cua_spaces::CreatePhase::Ready,+ ]+ );+}++/// While a create runs, the host lists it with what it is doing, to the+/// caller who started it and to the owner only, and stops listing it once+/// it ended.+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]+async fn the_host_lists_a_running_create_to_its_caller_and_owner_only() {+ let f = fixture(HostProfile::Spare).await;+ let attach = f.register("bob-token", "space-b0b00001").await;+ *f.rt.pull_bytes.lock().unwrap() = Some(TOTAL);+ let server = f.server.clone();+ let create = tokio::spawn(async move {+ server+ .create(+ &bob(),+ pb::CreateHostSpaceRequest {+ image: "linux".into(),+ attach: Some(attach),+ ..Default::default()+ },+ )+ .await+ });+ let carol =+ HostCaller::from_metadata(Some(r#"{"account":"carol","role":"shared","via":"relay"}"#))+ .unwrap();+ let mut listed = None;+ for _ in 0..50 {+ tokio::time::sleep(std::time::Duration::from_millis(100)).await;+ let own = f.server.get(&bob()).await.unwrap().creating;+ if let Some(c) = own+ .into_iter()+ .find(|c| c.phase == "pulling" && c.bytes_done > Some(0))+ {+ listed = Some(c);+ break;+ }+ }+ let c = listed.expect("the caller sees its create downloading");+ assert_eq!(c.key, "space-b0b00001", "keyed by the relay machine");+ assert_eq!(c.bytes_total, Some(TOTAL));+ assert!(c.bytes_per_second.is_some());+ assert_eq!(c.detail, "ghcr.io/trycua/macos:26");+ assert_eq!(+ f.server.get(&ada()).await.unwrap().creating.len(),+ 1,+ "the owner sees it"+ );+ assert!(+ f.server.get(&carol).await.unwrap().creating.is_empty(),+ "nobody else does"+ );+ create.await.unwrap().unwrap();+ assert!(+ f.server.get(&ada()).await.unwrap().creating.is_empty(),+ "gone once it ended"+ );+}diff --git a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.tsindex 459e0be826..5788efc056 100644--- a/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts+++ b/libs/cua/crates/cua-spacesd-html5/web/src/gen/cua/env/v1/host_pb.ts@@ -12,7 +12,7 @@ import type { Message } from "@bufbuild/protobuf";* Describes the file cua/env/v1/host.proto.*/export const file_cua_env_v1_host: GenFile = /*@__PURE__*/- fileDesc("ChVjdWEvZW52L3YxL2hvc3QucHJvdG8SCmN1YS5lbnYudjEibgoSSG9zdFNwYWNlc1NldHRpbmdzEhUKDXNoYXJlX2Rlc2t0b3AYASABKAgSFgoOcHJvdmlkZV9zcGFjZXMYAiABKAgSEgoKbWF4X3NwYWNlcxgDIAEoDRIVCg1tYXhfbWFjb3Nfdm1zGAQgASgNIlMKEkhvc3RTcGFjZXNDYXBhY2l0eRIQCghyZXNvdXJjZRgBIAEoCRIMCgR1c2VkGAIgASgNEg0KBWxpbWl0GAMgASgNEg4KBnJlYXNvbhgEIAEoCSLVAQoJSG9zdFNwYWNlEhUKDXJlbGF5X21hY2hpbmUYASABKAkSEwoLbG9jYWxfc3BhY2UYAiABKAkSDAoEbmFtZRgDIAEoCRINCgVpbWFnZRgEIAEoCRIKCgJvcxgFIAEoCRIMCgRraW5kGAYgASgJEg8KB3J1bnRpbWUYByABKAkSEgoKY3JlYXRlZF9ieRgIIAEoCRIVCg1jcmVhdGVkX2F0X21zGAkgASgDEhMKC2RpcmVjdF9wb3J0GAogASgNEhQKDGRpcmVjdF90b2tlbhgLIAEoCSJhChRIb3N0U3BhY2VzQXVkaXRFdmVudBINCgV0c19tcxgBIAEoAxIOCgZhY3Rpb24YAiABKAkSCwoDd2hvGAMgASgJEg0KBXNwYWNlGAQgASgJEg4KBmRldGFpbBgFIAEoCSIWChRHZXRIb3N0U3BhY2VzUmVxdWVzdCL9AQoVR2V0SG9zdFNwYWNlc1Jlc3BvbnNlEgwKBG5hbWUYASABKAkSCgoCb3MYAiABKAkSMAoIc2V0dGluZ3MYAyABKAsyHi5jdWEuZW52LnYxLkhvc3RTcGFjZXNTZXR0aW5ncxIwCghjYXBhY2l0eRgEIAMoCzIeLmN1YS5lbnYudjEuSG9zdFNwYWNlc0NhcGFjaXR5EiUKBnNwYWNlcxgFIAMoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlEi8KBWF1ZGl0GAYgAygLMiAuY3VhLmVudi52MS5Ib3N0U3BhY2VzQXVkaXRFdmVudBIOCgZpbWFnZXMYByADKAkixgEKFkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFaW1hZ2UYASABKAkSDAoEa2luZBgCIAEoCRIPCgdydW50aW1lGAMgASgJEgwKBG5hbWUYBCABKAkSDAoEY3B1cxgFIAEoDRIRCgltZW1vcnlfbWIYBiABKAQSDwoHZGlza19nYhgHIAEoDRIuCgZhdHRhY2gYCCABKAsyHi5jdWEuZW52LnYxLkF0dGFjaFJlbGF5UmVxdWVzdBIOCgZkaXJlY3QYCSABKAgiPwoXQ3JlYXRlSG9zdFNwYWNlUmVzcG9uc2USJAoFc3BhY2UYASABKAsyFS5jdWEuZW52LnYxLkhvc3RTcGFjZSInChZEZWxldGVIb3N0U3BhY2VSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJIioKF0RlbGV0ZUhvc3RTcGFjZVJlc3BvbnNlEg8KB21lc3NhZ2UYASABKAkiKAoXRGVsZXRlQ2xvdWRTcGFjZVJlcXVlc3QSDQoFc3BhY2UYASABKAkiKwoYRGVsZXRlQ2xvdWRTcGFjZVJlc3BvbnNlEg8KB21lc3NhZ2UYASABKAkiJwoWQ2FuY2VsSG9zdFNwYWNlUmVxdWVzdBINCgVzcGFjZRgBIAEoCSIqChdDYW5jZWxIb3N0U3BhY2VSZXNwb25zZRIPCgdtZXNzYWdlGAEgASgJIjUKGFNldEhvc3RTcGFjZVBvd2VyUmVxdWVzdBINCgVzcGFjZRgBIAEoCRIKCgJvbhgCIAEoCCJKChlTZXRIb3N0U3BhY2VQb3dlclJlc3BvbnNlEg0KBXN0YXRlGAEgASgJEg0KBXBvd2VyGAIgASgJEg8KB21lc3NhZ2UYAyABKAkyvgQKEUhvc3RTcGFjZXNTZXJ2aWNlElQKDUdldEhvc3RTcGFjZXMSIC5jdWEuZW52LnYxLkdldEhvc3RTcGFjZXNSZXF1ZXN0GiEuY3VhLmVudi52MS5HZXRIb3N0U3BhY2VzUmVzcG9uc2USWgoPQ3JlYXRlSG9zdFNwYWNlEiIuY3VhLmVudi52MS5DcmVhdGVIb3N0U3BhY2VSZXF1ZXN0GiMuY3VhLmVudi52MS5DcmVhdGVIb3N0U3BhY2VSZXNwb25zZRJaCg9EZWxldGVIb3N0U3BhY2USIi5jdWEuZW52LnYxLkRlbGV0ZUhvc3RTcGFjZVJlcXVlc3QaIy5jdWEuZW52LnYxLkRlbGV0ZUhvc3RTcGFjZVJlc3BvbnNlEloKD0NhbmNlbEhvc3RTcGFjZRIiLmN1YS5lbnYudjEuQ2FuY2VsSG9zdFNwYWNlUmVxdWVzdBojLmN1YS5lbnYudjEuQ2FuY2VsSG9zdFNwYWNlUmVzcG9uc2USYAoRU2V0SG9zdFNwYWNlUG93ZXISJC5jdWEuZW52LnYxLlNldEhvc3RTcGFjZVBvd2VyUmVxdWVzdBolLmN1YS5lbnYudjEuU2V0SG9zdFNwYWNlUG93ZXJSZXNwb25zZRJdChBEZWxldGVDbG91ZFNwYWNlEiMuY3VhLmVudi52MS5EZWxldGVDbG91ZFNwYWNlUmVxdWVzdBokLmN1YS5lbnYudjEuRGVsZXRlQ2xvdWRTcGFjZVJlc3BvbnNlYgZwcm90bzM", [file_cua_env_v1_system]);+ fileDesc("ChVjdWEvZW52L3YxL2hvc3QucHJvdG8SCmN1YS5lbnYudjEibgoSSG9zdFNwYWNlc1NldHRpbmdzEhUKDXNoYXJlX2Rlc2t0b3AYASABKAgSFgoOcHJvdmlkZV9zcGFjZXMYAiABKAgSEgoKbWF4X3NwYWNlcxgDIAEoDRIVCg1tYXhfbWFjb3Nfdm1zGAQgASgNIlMKEkhvc3RTcGFjZXNDYXBhY2l0eRIQCghyZXNvdXJjZRgBIAEoCRIMCgR1c2VkGAIgASgNEg0KBWxpbWl0GAMgASgNEg4KBnJlYXNvbhgEIAEoCSLVAQoJSG9zdFNwYWNlEhUKDXJlbGF5X21hY2hpbmUYASABKAkSEwoLbG9jYWxfc3BhY2UYAiABKAkSDAoEbmFtZRgDIAEoCRINCgVpbWFnZRgEIAEoCRIKCgJvcxgFIAEoCRIMCgRraW5kGAYgASgJEg8KB3J1bnRpbWUYByABKAkSEgoKY3JlYXRlZF9ieRgIIAEoCRIVCg1jcmVhdGVkX2F0X21zGAkgASgDEhMKC2RpcmVjdF9wb3J0GAogASgNEhQKDGRpcmVjdF90b2tlbhgLIAEoCSJhChRIb3N0U3BhY2VzQXVkaXRFdmVudBINCgV0c19tcxgBIAEoAxIOCgZhY3Rpb24YAiABKAkSCwoDd2hvGAMgASgJEg0KBXNwYWNlGAQgASgJEg4KBmRldGFpbBgFIAEoCSIWChRHZXRIb3N0U3BhY2VzUmVxdWVzdCKuAgoVR2V0SG9zdFNwYWNlc1Jlc3BvbnNlEgwKBG5hbWUYASABKAkSCgoCb3MYAiABKAkSMAoIc2V0dGluZ3MYAyABKAsyHi5jdWEuZW52LnYxLkhvc3RTcGFjZXNTZXR0aW5ncxIwCghjYXBhY2l0eRgEIAMoCzIeLmN1YS5lbnYudjEuSG9zdFNwYWNlc0NhcGFjaXR5EiUKBnNwYWNlcxgFIAMoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlEi8KBWF1ZGl0GAYgAygLMiAuY3VhLmVudi52MS5Ib3N0U3BhY2VzQXVkaXRFdmVudBIOCgZpbWFnZXMYByADKAkSLwoIY3JlYXRpbmcYCCADKAsyHS5jdWEuZW52LnYxLkhvc3RTcGFjZUNyZWF0aW5nIukBChFIb3N0U3BhY2VDcmVhdGluZxILCgNrZXkYASABKAkSDQoFcGhhc2UYAiABKAkSFQoIZnJhY3Rpb24YAyABKAFIAIgBARIOCgZkZXRhaWwYBCABKAkSFwoKYnl0ZXNfZG9uZRgFIAEoBEgBiAEBEhgKC2J5dGVzX3RvdGFsGAYgASgESAKIAQESHQoQYnl0ZXNfcGVyX3NlY29uZBgHIAEoAUgDiAEBQgsKCV9mcmFjdGlvbkINCgtfYnl0ZXNfZG9uZUIOCgxfYnl0ZXNfdG90YWxCEwoRX2J5dGVzX3Blcl9zZWNvbmQi2gEKFkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFaW1hZ2UYASABKAkSDAoEa2luZBgCIAEoCRIPCgdydW50aW1lGAMgASgJEgwKBG5hbWUYBCABKAkSDAoEY3B1cxgFIAEoDRIRCgltZW1vcnlfbWIYBiABKAQSDwoHZGlza19nYhgHIAEoDRIuCgZhdHRhY2gYCCABKAsyHi5jdWEuZW52LnYxLkF0dGFjaFJlbGF5UmVxdWVzdBIOCgZkaXJlY3QYCSABKAgSEgoKY3JlYXRlX2tleRgKIAEoCSI/ChdDcmVhdGVIb3N0U3BhY2VSZXNwb25zZRIkCgVzcGFjZRgBIAEoCzIVLmN1YS5lbnYudjEuSG9zdFNwYWNlIicKFkRlbGV0ZUhvc3RTcGFjZVJlcXVlc3QSDQoFc3BhY2UYASABKAkiKgoXRGVsZXRlSG9zdFNwYWNlUmVzcG9uc2USDwoHbWVzc2FnZRgBIAEoCSIoChdEZWxldGVDbG91ZFNwYWNlUmVxdWVzdBINCgVzcGFjZRgBIAEoCSIrChhEZWxldGVDbG91ZFNwYWNlUmVzcG9uc2USDwoHbWVzc2FnZRgBIAEoCSInChZDYW5jZWxIb3N0U3BhY2VSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJIioKF0NhbmNlbEhvc3RTcGFjZVJlc3BvbnNlEg8KB21lc3NhZ2UYASABKAkiNQoYU2V0SG9zdFNwYWNlUG93ZXJSZXF1ZXN0Eg0KBXNwYWNlGAEgASgJEgoKAm9uGAIgASgIIkoKGVNldEhvc3RTcGFjZVBvd2VyUmVzcG9uc2USDQoFc3RhdGUYASABKAkSDQoFcG93ZXIYAiABKAkSDwoHbWVzc2FnZRgDIAEoCTK+BAoRSG9zdFNwYWNlc1NlcnZpY2USVAoNR2V0SG9zdFNwYWNlcxIgLmN1YS5lbnYudjEuR2V0SG9zdFNwYWNlc1JlcXVlc3QaIS5jdWEuZW52LnYxLkdldEhvc3RTcGFjZXNSZXNwb25zZRJaCg9DcmVhdGVIb3N0U3BhY2USIi5jdWEuZW52LnYxLkNyZWF0ZUhvc3RTcGFjZVJlcXVlc3QaIy5jdWEuZW52LnYxLkNyZWF0ZUhvc3RTcGFjZVJlc3BvbnNlEloKD0RlbGV0ZUhvc3RTcGFjZRIiLmN1YS5lbnYudjEuRGVsZXRlSG9zdFNwYWNlUmVxdWVzdBojLmN1YS5lbnYudjEuRGVsZXRlSG9zdFNwYWNlUmVzcG9uc2USWgoPQ2FuY2VsSG9zdFNwYWNlEiIuY3VhLmVudi52MS5DYW5jZWxIb3N0U3BhY2VSZXF1ZXN0GiMuY3VhLmVudi52MS5DYW5jZWxIb3N0U3BhY2VSZXNwb25zZRJgChFTZXRIb3N0U3BhY2VQb3dlchIkLmN1YS5lbnYudjEuU2V0SG9zdFNwYWNlUG93ZXJSZXF1ZXN0GiUuY3VhLmVudi52MS5TZXRIb3N0U3BhY2VQb3dlclJlc3BvbnNlEl0KEERlbGV0ZUNsb3VkU3BhY2USIy5jdWEuZW52LnYxLkRlbGV0ZUNsb3VkU3BhY2VSZXF1ZXN0GiQuY3VhLmVudi52MS5EZWxldGVDbG91ZFNwYWNlUmVzcG9uc2ViBnByb3RvMw", [file_cua_env_v1_system]);/*** The host's two independent settings and its limits.@@ -318,6 +318,17 @@ export type GetHostSpacesResponse = Message<"cua.env.v1.GetHostSpacesResponse">* @generated from field: repeated string images = 7;*/images: string[];++ /**+ * The creates this host is running now (`CreateHostSpace` calls that+ * have not returned), each with what it is doing: every one for the+ * owner, the caller's own otherwise. A client polls this while its+ * create runs, to show the download and the boot. Empty from a host+ * that predates it.+ *+ * @generated from field: repeated cua.env.v1.HostSpaceCreating creating = 8;+ */+ creating: HostSpaceCreating[];};/**@@ -327,6 +338,73 @@ export type GetHostSpacesResponse = Message<"cua.env.v1.GetHostSpacesResponse">export const GetHostSpacesResponseSchema: GenMessage<GetHostSpacesResponse> = /*@__PURE__*/messageDesc(file_cua_env_v1_host, 5);+/**+ * A create a host is running, and what it is doing now. The progress+ * fields are those of `cua.daemon.v1.CreateSpaceProgress`.+ *+ * @generated from message cua.env.v1.HostSpaceCreating+ */+export type HostSpaceCreating = Message<"cua.env.v1.HostSpaceCreating"> & {+ /**+ * The create's key: `CreateHostSpaceRequest.create_key`, else the relay+ * machine it attaches to (`attach.machine_id`).+ *+ * @generated from field: string key = 1;+ */+ key: string;++ /**+ * "preparing", "pulling", "creating", "booting", "waiting_for_services",+ * "connecting" or "ready", in that order.+ *+ * @generated from field: string phase = 2;+ */+ phase: string;++ /**+ * How far through the phase, 0.0 to 1.0, when its size is known (an+ * image pull).+ *+ * @generated from field: optional double fraction = 3;+ */+ fraction?: number | undefined;++ /**+ * One short line, for example the image being pulled.+ *+ * @generated from field: string detail = 4;+ */+ detail: string;++ /**+ * Bytes downloaded so far, when the step counts them (an image pull).+ *+ * @generated from field: optional uint64 bytes_done = 5;+ */+ bytesDone?: bigint | undefined;++ /**+ * Bytes the download has in all.+ *+ * @generated from field: optional uint64 bytes_total = 6;+ */+ bytesTotal?: bigint | undefined;++ /**+ * Smoothed download rate, bytes per second.+ *+ * @generated from field: optional double bytes_per_second = 7;+ */+ bytesPerSecond?: number | undefined;+};++/**+ * Describes the message cua.env.v1.HostSpaceCreating.+ * Use `create(HostSpaceCreatingSchema)` to create a new message.+ */+export const HostSpaceCreatingSchema: GenMessage<HostSpaceCreating> = /*@__PURE__*/+ messageDesc(file_cua_env_v1_host, 6);+/*** Request for `HostSpacesService.CreateHostSpace`.*@@ -402,6 +480,15 @@ export type CreateHostSpaceRequest = Message<"cua.env.v1.CreateHostSpaceRequest"* @generated from field: bool direct = 9;*/direct: boolean;++ /**+ * A key of the caller's for this create, under which+ * `GetHostSpacesResponse.creating` lists its progress (a direct create+ * has no relay machine to name it). Empty: `attach.machine_id`.+ *+ * @generated from field: string create_key = 10;+ */+ createKey: string;};/**@@ -409,7 +496,7 @@ export type CreateHostSpaceRequest = Message<"cua.env.v1.CreateHostSpaceRequest"* Use `create(CreateHostSpaceRequestSchema)` to create a new message.*/export const CreateHostSpaceRequestSchema: GenMessage<CreateHostSpaceRequest> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 6);+ messageDesc(file_cua_env_v1_host, 7);/*** Response for `HostSpacesService.CreateHostSpace`.@@ -430,7 +517,7 @@ export type CreateHostSpaceResponse = Message<"cua.env.v1.CreateHostSpaceRespons* Use `create(CreateHostSpaceResponseSchema)` to create a new message.*/export const CreateHostSpaceResponseSchema: GenMessage<CreateHostSpaceResponse> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 7);+ messageDesc(file_cua_env_v1_host, 8);/*** Request for `HostSpacesService.DeleteHostSpace`.@@ -451,7 +538,7 @@ export type DeleteHostSpaceRequest = Message<"cua.env.v1.DeleteHostSpaceRequest"* Use `create(DeleteHostSpaceRequestSchema)` to create a new message.*/export const DeleteHostSpaceRequestSchema: GenMessage<DeleteHostSpaceRequest> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 8);+ messageDesc(file_cua_env_v1_host, 9);/*** Response for `HostSpacesService.DeleteHostSpace`.@@ -472,7 +559,7 @@ export type DeleteHostSpaceResponse = Message<"cua.env.v1.DeleteHostSpaceRespons* Use `create(DeleteHostSpaceResponseSchema)` to create a new message.*/export const DeleteHostSpaceResponseSchema: GenMessage<DeleteHostSpaceResponse> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 9);+ messageDesc(file_cua_env_v1_host, 10);/*** Request for `HostSpacesService.DeleteCloudSpace`.@@ -493,7 +580,7 @@ export type DeleteCloudSpaceRequest = Message<"cua.env.v1.DeleteCloudSpaceReques* Use `create(DeleteCloudSpaceRequestSchema)` to create a new message.*/export const DeleteCloudSpaceRequestSchema: GenMessage<DeleteCloudSpaceRequest> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 10);+ messageDesc(file_cua_env_v1_host, 11);/*** Response for `HostSpacesService.DeleteCloudSpace`.@@ -514,7 +601,7 @@ export type DeleteCloudSpaceResponse = Message<"cua.env.v1.DeleteCloudSpaceRespo* Use `create(DeleteCloudSpaceResponseSchema)` to create a new message.*/export const DeleteCloudSpaceResponseSchema: GenMessage<DeleteCloudSpaceResponse> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 11);+ messageDesc(file_cua_env_v1_host, 12);/*** Request for `HostSpacesService.CancelHostSpace`.@@ -535,7 +622,7 @@ export type CancelHostSpaceRequest = Message<"cua.env.v1.CancelHostSpaceRequest"* Use `create(CancelHostSpaceRequestSchema)` to create a new message.*/export const CancelHostSpaceRequestSchema: GenMessage<CancelHostSpaceRequest> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 12);+ messageDesc(file_cua_env_v1_host, 13);/*** Response for `HostSpacesService.CancelHostSpace`.@@ -556,7 +643,7 @@ export type CancelHostSpaceResponse = Message<"cua.env.v1.CancelHostSpaceRespons* Use `create(CancelHostSpaceResponseSchema)` to create a new message.*/export const CancelHostSpaceResponseSchema: GenMessage<CancelHostSpaceResponse> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 13);+ messageDesc(file_cua_env_v1_host, 14);/*** Request for `HostSpacesService.SetHostSpacePower`.@@ -584,7 +671,7 @@ export type SetHostSpacePowerRequest = Message<"cua.env.v1.SetHostSpacePowerRequ* Use `create(SetHostSpacePowerRequestSchema)` to create a new message.*/export const SetHostSpacePowerRequestSchema: GenMessage<SetHostSpacePowerRequest> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 14);+ messageDesc(file_cua_env_v1_host, 15);/*** Response for `HostSpacesService.SetHostSpacePower`.@@ -619,7 +706,7 @@ export type SetHostSpacePowerResponse = Message<"cua.env.v1.SetHostSpacePowerRes* Use `create(SetHostSpacePowerResponseSchema)` to create a new message.*/export const SetHostSpacePowerResponseSchema: GenMessage<SetHostSpacePowerResponse> = /*@__PURE__*/- messageDesc(file_cua_env_v1_host, 15);+ messageDesc(file_cua_env_v1_host, 16);/*** Spaces a host provides: a machine set up with `cua host setupdiff --git a/libs/cua/proto/cua/daemon/v1/sandboxes.proto b/libs/cua/proto/cua/daemon/v1/sandboxes.protoindex 9a64312264..666482734a 100644--- a/libs/cua/proto/cua/daemon/v1/sandboxes.proto+++ b/libs/cua/proto/cua/daemon/v1/sandboxes.proto@@ -7,6 +7,7 @@ syntax = "proto3";package cua.daemon.v1;+import "cua/daemon/v1/spaces.proto";import "google/protobuf/duration.proto";import "google/protobuf/timestamp.proto";@@ -20,6 +21,12 @@ service SandboxService {// Creates a sandbox where `location` says (local by default), or// connects to an existing machine (`direct:<addr>`).rpc CreateSandbox(CreateSandboxRequest) returns (CreateSandboxResponse);+ // `CreateSandbox`, streaming what the create is doing: progress events+ // (pulling the image with its bytes, creating, booting, waiting for the+ // probes) in order, then exactly one `result`. A failed create ends the+ // stream with its status. Closing the stream cancels the create, as for+ // a `CreateSandbox` whose caller goes away.+ rpc CreateSandboxStream(CreateSandboxStreamRequest) returns (stream CreateSandboxStreamResponse);// Cancels a `CreateSandbox` of a named sandbox still running: the work// in flight stops (an image download, a boot, a claim) and what the// create made is deleted; a sandbox of that name that existed before is@@ -370,6 +377,23 @@ message CreateSandboxResponse {Sandbox sandbox = 1;}+// Request for `SandboxService.CreateSandboxStream`.+message CreateSandboxStreamRequest {+ // The create, as for `CreateSandbox`.+ CreateSandboxRequest create = 1;+}++// One message of `SandboxService.CreateSandboxStream`.+message CreateSandboxStreamResponse {+ // Progress, or the result.+ oneof event {+ // What the create is doing now (`space` is empty).+ CreateSpaceProgress progress = 1;+ // The created sandbox (the last message).+ CreateSandboxResponse result = 2;+ }+}+// Request for `SandboxService.GetSandbox`.message GetSandboxRequest {// Sandbox ref ("local:<name>", "cloud:<name>", "direct:<host:port>", adiff --git a/libs/cua/proto/cua/env/v1/host.proto b/libs/cua/proto/cua/env/v1/host.protoindex fa06933e3d..82f6fc6c25 100644--- a/libs/cua/proto/cua/env/v1/host.proto+++ b/libs/cua/proto/cua/env/v1/host.proto@@ -154,6 +154,34 @@ message GetHostSpacesResponse {// Image aliases this host resolves (`macos`, `linux`, ...), for clients// to offer.repeated string images = 7;+ // The creates this host is running now (`CreateHostSpace` calls that+ // have not returned), each with what it is doing: every one for the+ // owner, the caller's own otherwise. A client polls this while its+ // create runs, to show the download and the boot. Empty from a host+ // that predates it.+ repeated HostSpaceCreating creating = 8;+}++// A create a host is running, and what it is doing now. The progress+// fields are those of `cua.daemon.v1.CreateSpaceProgress`.+message HostSpaceCreating {+ // The create's key: `CreateHostSpaceRequest.create_key`, else the relay+ // machine it attaches to (`attach.machine_id`).+ string key = 1;+ // "preparing", "pulling", "creating", "booting", "waiting_for_services",+ // "connecting" or "ready", in that order.+ string phase = 2;+ // How far through the phase, 0.0 to 1.0, when its size is known (an+ // image pull).+ optional double fraction = 3;+ // One short line, for example the image being pulled.+ string detail = 4;+ // Bytes downloaded so far, when the step counts them (an image pull).+ optional uint64 bytes_done = 5;+ // Bytes the download has in all.+ optional uint64 bytes_total = 6;+ // Smoothed download rate, bytes per second.+ optional double bytes_per_second = 7;}// Request for `HostSpacesService.CreateHostSpace`.@@ -183,6 +211,10 @@ message CreateHostSpaceRequest {// is reached at the host's address on `HostSpace.direct_port`, with// `HostSpace.direct_token`. `attach` must be empty.bool direct = 9;+ // A key of the caller's for this create, under which+ // `GetHostSpacesResponse.creating` lists its progress (a direct create+ // has no relay machine to name it). Empty: `attach.machine_id`.+ string create_key = 10;}// Response for `HostSpacesService.CreateHostSpace`.