Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(spaces): show a Space another computer is still creating (CUA-2349) (#6010)

cua-agents[bot]7b24a2c61546
diff --git a/apps/cua-spaces-desktop/src/bridge/spaces.ts b/apps/cua-spaces-desktop/src/bridge/spaces.ts
index 0a09701b90..3aaaf77a3c 100644
--- a/apps/cua-spaces-desktop/src/bridge/spaces.ts
+++ b/apps/cua-spaces-desktop/src/bridge/spaces.ts
@@ -34,6 +34,8 @@ export function spacesState(model: AppModel) {
reaching: model.listReaching,
// Your other computers' rows are the last known ones, not yet confirmed.
stale: model.listStale,
+ // Spaces your other computers are creating now: "Creating macOS on Mac mini… 40%".
+ creatingElsewhere: model.creatingElsewhere,
};
}
diff --git a/apps/cua-spaces-desktop/src/model/app-model.ts b/apps/cua-spaces-desktop/src/model/app-model.ts
index 66c00c0a60..81400de21c 100644
--- a/apps/cua-spaces-desktop/src/model/app-model.ts
+++ b/apps/cua-spaces-desktop/src/model/app-model.ts
@@ -36,7 +36,7 @@ import type {
LocalStorage,
SpaceCreateProgress,
} from "../native/generated/index";
-import type { ListRead, LocalRuntimes, SpacesBackend } from "./backend";
+import type { CreatingElsewhereRow, ListRead, LocalRuntimes, SpacesBackend } from "./backend";
import { AgentsModel, type AgentSetupRunning, type ToolRunner } from "./agents";
import { ChecklistModel } from "./checklist";
import type { CloudModel } from "./cloud";
@@ -579,6 +579,8 @@ export class AppModel {
listReaching = 0;
/** Your other computers' rows are the last known ones, not yet confirmed. */
listStale = false;
+ /** What your other computers are creating now (CUA-2349), less what the list already has a row for. */
+ creatingElsewhere: CreatingElsewhereRow[] = [];
private incompleteFollow: ReturnType<typeof setTimeout> | null = null;
/** While some of your computers have not answered, the list is read again
@@ -603,6 +605,8 @@ export class AppModel {
this.listIncomplete = list.incomplete;
this.listReaching = list.reaching;
this.listStale = list.stale;
+ // A create this app asked another computer for already has its own pending row.
+ this.creatingElsewhere = (list.creating ?? []).filter((c) => !this.spaces.some((s) => s.name === c.name && (s.host === c.machineId || this.native.appCreatesIsPending(s.id))));
// Your other computers could not be read: their rows are the last known ones.
this.rosterError = list.notice ? "Could not reach your other computers. Their Spaces may be out of date." : null;
if (this.selectedSpaceId === null) {
diff --git a/apps/cua-spaces-desktop/src/model/backend.ts b/apps/cua-spaces-desktop/src/model/backend.ts
index b5888958f3..acd2926dfa 100644
--- a/apps/cua-spaces-desktop/src/model/backend.ts
+++ b/apps/cua-spaces-desktop/src/model/backend.ts
@@ -84,6 +84,18 @@ export interface ListRead {
stale: boolean;
/** Why your other computers could not be read, when they could not. */
notice: string;
+ /** Spaces your other computers are creating now (the SDK's `SpaceList.creating`). */
+ creating?: CreatingElsewhereRow[];
+}
+
+/** A Space another of your computers is creating, as the page reads it (`spaces.list`'s `creatingElsewhere`). */
+export interface CreatingElsewhereRow {
+ machineId: string;
+ machineName: string;
+ name: string;
+ os: string;
+ phase: string;
+ percent: number;
}
export interface SpacesBackend {
@@ -317,7 +329,8 @@ export class LiveSpacesBackend implements SpacesBackend {
/** This machine's Spaces at once, your other computers as far as they answered (`Spaces.list_known`). */
async listRead(): Promise<ListRead> {
const list = await this.cua.spaces().listKnown();
- return { rows: await this.probe(list.spaces), incomplete: list.incomplete, reaching: list.reaching, stale: list.stale, notice: list.notice };
+ const creating = (list.creating ?? []).map((c) => ({ machineId: c.machineId, machineName: c.machineName, name: c.name, os: c.os, phase: c.phase, percent: c.percent }));
+ return { rows: await this.probe(list.spaces), incomplete: list.incomplete, reaching: list.reaching, stale: list.stale, notice: list.notice, creating };
}
/** The rows of `infos`, each with a bounded reachability probe. */
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
index 018664d3ac..df859e41ed 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
@@ -18690,6 +18690,93 @@ const FfiConverterTypeSpaceCreateResult = (() => {
return new FFIConverter();
})();
+/**
+ * A Space another of your computers is creating ([`SpaceList::creating`]).
+ */
+export type SpaceCreatingElsewhere = {
+ /**
+ * The computer's relay machine id.
+ */
+ machineId: string,
+ /**
+ * The computer's name.
+ */
+ machineName: string,
+ /**
+ * The Space's name.
+ */
+ name: string,
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */
+ os: string,
+ /**
+ * The create's phase (`preparing`, `pulling`, `booting`, ...).
+ */
+ phase: string,
+ /**
+ * How far along the whole create is, 0 to 100.
+ */
+ percent: number,
+ /**
+ * When the computer published it, unix ms.
+ */
+ updatedAtMs: bigint
+}
+
+/**
+ * Generated factory for {@link SpaceCreatingElsewhere} record objects.
+ */
+export const SpaceCreatingElsewhere = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<SpaceCreatingElsewhere, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<SpaceCreatingElsewhere>,
+ });
+})();
+
+const FfiConverterTypeSpaceCreatingElsewhere = (() => {
+ type TypeName = SpaceCreatingElsewhere;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ machineId: FfiConverterString.read(from),
+ machineName: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ os: FfiConverterString.read(from),
+ phase: FfiConverterString.read(from),
+ percent: FfiConverterUInt32.read(from),
+ updatedAtMs: FfiConverterUInt64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.machineId, into);
+ FfiConverterString.write(value.machineName, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterString.write(value.phase, into);
+ FfiConverterUInt32.write(value.percent, into);
+ FfiConverterUInt64.write(value.updatedAtMs, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.machineId) +
+ FfiConverterString.allocationSize(value.machineName) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterString.allocationSize(value.phase) +
+ FfiConverterUInt32.allocationSize(value.percent) +
+ FfiConverterUInt64.allocationSize(value.updatedAtMs);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
/**
* One of a Space's displays ([`Space::displays`]).
*/
@@ -18891,7 +18978,12 @@ export type SpaceList = {
/**
* Why the account's computers could not be read, when they could not.
*/
- notice: string
+ notice: string,
+ /**
+ * Spaces your other computers are creating now, from what each
+ * published through the relay (empty from a daemon that predates it).
+ */
+ creating: Array<SpaceCreatingElsewhere>
}
/**
@@ -18919,7 +19011,8 @@ const FfiConverterTypeSpaceList = (() => {
incomplete: FfiConverterBool.read(from),
reaching: FfiConverterUInt32.read(from),
stale: FfiConverterBool.read(from),
- notice: FfiConverterString.read(from)
+ notice: FfiConverterString.read(from),
+ creating: FfiConverterSequenceTypeSpaceCreatingElsewhere.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -18928,13 +19021,15 @@ const FfiConverterTypeSpaceList = (() => {
FfiConverterUInt32.write(value.reaching, into);
FfiConverterBool.write(value.stale, into);
FfiConverterString.write(value.notice, into);
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.write(value.creating, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeSpaceInfo.allocationSize(value.spaces) +
FfiConverterBool.allocationSize(value.incomplete) +
FfiConverterUInt32.allocationSize(value.reaching) +
FfiConverterBool.allocationSize(value.stale) +
- FfiConverterString.allocationSize(value.notice);
+ FfiConverterString.allocationSize(value.notice) +
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.allocationSize(value.creating);
}
};
@@ -44327,6 +44422,9 @@ const FfiConverterOptionalTypeSpaceInfo = new FfiConverterOptional(FfiConverterT
// FfiConverter for Array<SpaceInfo>
const FfiConverterSequenceTypeSpaceInfo = new FfiConverterArray(FfiConverterTypeSpaceInfo);
+// FfiConverter for Array<SpaceCreatingElsewhere>
+const FfiConverterSequenceTypeSpaceCreatingElsewhere = new FfiConverterArray(FfiConverterTypeSpaceCreatingElsewhere);
+
// FfiConverter for Array<SpaceSentFile>
const FfiConverterSequenceTypeSpaceSentFile = new FfiConverterArray(FfiConverterTypeSpaceSentFile);
@@ -46256,6 +46354,7 @@ export default Object.freeze({
FfiConverterTypeSpaceCreateOptions,
FfiConverterTypeSpaceCreateProgress,
FfiConverterTypeSpaceCreateResult,
+ FfiConverterTypeSpaceCreatingElsewhere,
FfiConverterTypeSpaceDisplay,
FfiConverterTypeSpaceHotspotStatus,
FfiConverterTypeSpaceInfo,
diff --git a/apps/cua-spaces-web/src/__tests__/app-harness.tsx b/apps/cua-spaces-web/src/__tests__/app-harness.tsx
index 3cfc165bca..38ced58c25 100644
--- a/apps/cua-spaces-web/src/__tests__/app-harness.tsx
+++ b/apps/cua-spaces-web/src/__tests__/app-harness.tsx
@@ -11,7 +11,7 @@ import { render } from "@testing-library/react";
import { afterEach, beforeEach } from "vitest";
import type { DataAdapter } from "@/bridge/adapter";
import type { MachinesView } from "@/bridge/contracts/host";
-import type { ListStatus } from "@/bridge/contracts/spaces";
+import type { CreatingElsewhere, ListStatus } from "@/bridge/contracts/spaces";
import type { HostEvent } from "@/bridge/protocol";
import { createDemoAdapter, type DemoOptions } from "@/bridge/adapters/demo";
import { BridgeProvider, useBridge, useMachines, useSpaces, type SpacesHook } from "@/bridge";
@@ -53,6 +53,8 @@ export interface TestHost {
machinesView?: () => MachinesView | null;
/** How far the host's list read got (`listStatus`); undefined: complete. */
listStatus?: () => ListStatus;
+ /** What the host's other computers are creating (`creatingElsewhere`). */
+ creatingElsewhere?: () => CreatingElsewhere[];
/** The demo host's own options (signed out, a first run). */
demo?: DemoOptions;
}
@@ -77,6 +79,7 @@ export async function mountApp(path: string, host: TestHost = { failsCreates: tr
mode: demo.mode,
...(host.machinesView ? { machinesView: host.machinesView } : {}),
...(host.listStatus ? { listStatus: host.listStatus } : {}),
+ ...(host.creatingElsewhere ? { creatingElsewhere: host.creatingElsewhere } : {}),
subscribe: (l) => {
listeners.add(l);
const off = demo.subscribe(l);
diff --git a/apps/cua-spaces-web/src/__tests__/spaces-creating-elsewhere.test.tsx b/apps/cua-spaces-web/src/__tests__/spaces-creating-elsewhere.test.tsx
new file mode 100644
index 0000000000..866460252f
--- /dev/null
+++ b/apps/cua-spaces-web/src/__tests__/spaces-creating-elsewhere.test.tsx
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+// A Space another of your computers is creating (CUA-2349): the Mac mini
+// publishes it through the relay, and this computer's Spaces page shows
+// "Creating macOS on Mac mini… 40%" until it is ready.
+
+import { act, cleanup, screen, waitFor } from "@testing-library/react";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { DEMO_CREATING_ELSEWHERE } from "@/bridge/adapters/demo";
+import type { CreatingElsewhere } from "@/bridge/contracts/spaces";
+import { creatingElsewhereLine } from "@/lib/spaces";
+import { mountApp, stubBrowserApis } from "./app-harness";
+
+stubBrowserApis();
+afterEach(cleanup);
+
+const WAIT = { timeout: 8000 };
+
+const tile = () => document.querySelector("[data-creating-elsewhere]");
+
+async function mount(creating: { current: CreatingElsewhere[] }, noSpaces = false) {
+ return mountApp("/spaces", { failsCreates: false, listsGhost: false, demo: { noSpaces }, creatingElsewhere: () => creating.current });
+}
+
+describe("a Space another computer is creating", { timeout: 30_000 }, () => {
+ it("shows under that computer's name with how far it got, and goes once it is done", async () => {
+ const creating = { current: [...DEMO_CREATING_ELSEWHERE] };
+ const { emit } = await mount(creating);
+ await waitFor(() => expect(tile()).not.toBeNull(), WAIT);
+ expect(tile()!.getAttribute("data-creating-elsewhere")).toBe("mac-mini");
+ expect(tile()!.textContent).toContain("browser-qa");
+ expect(tile()!.getAttribute("aria-label")).toBe("browser-qa: Creating macOS on Mac mini… 40%");
+ expect(screen.getByText("Creating macOS on Mac mini…")).toBeTruthy();
+ expect(tile()!.querySelector("[data-state-label]")!.textContent).toBe("40%");
+ // Nothing to open yet: not a link.
+ expect(tile()!.closest("a")).toBeNull();
+
+ creating.current = [{ ...DEMO_CREATING_ELSEWHERE[0]!, phase: "booting", percent: 70 }];
+ act(() => emit({ type: "spaces.changed" }));
+ await waitFor(() => expect(tile()!.querySelector("[data-state-label]")!.textContent).toBe("70%"), WAIT);
+
+ creating.current = [];
+ act(() => emit({ type: "spaces.changed" }));
+ await waitFor(() => expect(tile()).toBeNull(), WAIT);
+ });
+
+ it("is not the empty home when this computer has no Space yet", async () => {
+ await mount({ current: [...DEMO_CREATING_ELSEWHERE] }, true);
+ await waitFor(() => expect(tile()).not.toBeNull(), WAIT);
+ expect(document.querySelector("[data-empty-home]")).toBeNull();
+ expect(screen.queryByText("No Spaces yet")).toBeNull();
+ });
+});
+
+describe("creatingElsewhereLine", () => {
+ it("says what, where and how far in plain words", () => {
+ expect(creatingElsewhereLine({ os: "macos", machineName: "Mac mini", percent: 40 })).toBe("Creating macOS on Mac mini… 40%");
+ expect(creatingElsewhereLine({ os: "linux", machineName: "Studio", percent: 99.6 })).toBe("Creating Linux on Studio… 100%");
+ expect(creatingElsewhereLine({ os: "", machineName: " ", percent: -3 })).toBe("Creating a Space on another computer… 0%");
+ });
+});
diff --git a/apps/cua-spaces-web/src/bridge/adapter.ts b/apps/cua-spaces-web/src/bridge/adapter.ts
index 03c7692d36..95b73b6cb7 100644
--- a/apps/cua-spaces-web/src/bridge/adapter.ts
+++ b/apps/cua-spaces-web/src/bridge/adapter.ts
@@ -2,7 +2,7 @@
// Copyright (c) 2026 Cua AI, Inc.
import type { MachinesView } from "./contracts/host";
-import type { ListStatus } from "./contracts/spaces";
+import type { CreatingElsewhere, ListStatus } from "./contracts/spaces";
import type { HostEvent, OpArgs, OpName, OpResult } from "./protocol";
export type BridgeMode = "tauri" | "electron" | "webkit" | "demo";
@@ -41,6 +41,11 @@ export interface DataAdapter {
* lists complete lists only.
*/
listStatus?(): ListStatus;
+ /**
+ * The Spaces your other computers are creating now, read with
+ * `spaces.list` (CUA-2349). Undefined: the host does not read them.
+ */
+ creatingElsewhere?(): CreatingElsewhere[];
/**
* The host's standing notice, read with `spaces.list`: null, or a line to
* show above every page while it lasts (another app keeps its own daemon
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo.ts b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
index 997399fa6e..0754864dd1 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo.ts
@@ -13,7 +13,7 @@ import type { AgentSetupRow, PersistentAgent } from "../contracts/agents";
import type { MachineRow, OnboardingState } from "../contracts/host";
import type { KvItem } from "../contracts/keyvault";
import type { UpdateState } from "../contracts/settings";
-import type { SpaceOs, SpaceRow } from "../contracts/spaces";
+import type { CreatingElsewhere, SpaceOs, SpaceRow } from "../contracts/spaces";
import {
DEFAULT_SETTINGS,
type HostEvent,
@@ -107,8 +107,16 @@ export interface DemoOptions {
* set; `local` is a Local build's (`?demo=cli-local`), `missing` one
* not installed (`?demo=cli-missing`). */
cli?: "local" | "missing";
+ /** Another of your computers is creating a Space (`?demo=creating-elsewhere`):
+ * the Mac mini, a macOS Space 40% of the way (CUA-2349). */
+ creatingElsewhere?: boolean;
}
+/** What the Mac mini is creating (`?demo=creating-elsewhere`). */
+export const DEMO_CREATING_ELSEWHERE: CreatingElsewhere[] = [
+ { machineId: "mac-mini", machineName: "Mac mini", name: "browser-qa", os: "macos", phase: "pulling", percent: 40 },
+];
+
/** The SDK's words for the failures `failCreates` plays. */
export const DEMO_CREATE_FAILURES = {
runtime: "local runtime: the built-in Linux runtime did not start: exiting, status 1",
@@ -123,7 +131,8 @@ const DEMO_NOTES = "https://github.com/trycua/cua/releases/tag/cua-spaces-v0.9.3
* SwiftUI host's shape), `?demo=unenrolled` (this device not enrolled),
* `?demo=agents-readonly` (Cua can't write Hermes's config),
* `?demo=update-ready` (an update is downloaded), `?demo=update-downloading`, `?demo=update-error`,
- * and `?demo=low-disk` / `?demo=disk-full` (This Mac almost out of space). */
+ * `?demo=low-disk` / `?demo=disk-full` (This Mac almost out of space), and
+ * `?demo=creating-elsewhere` (the Mac mini is creating a Space). */
export function demoOptionsFromSearch(search: string): DemoOptions {
const flags = new Set((new URLSearchParams(search).get("demo") ?? "").split(",").filter(Boolean));
return {
@@ -146,6 +155,7 @@ export function demoOptionsFromSearch(search: string): DemoOptions {
nudge: (["second-agent", "risky"] as const).find((n) => flags.has(`nudge-${n}`)),
disk: flags.has("disk-full") ? "full" : flags.has("low-disk") ? "low" : undefined,
cli: flags.has("cli-local") ? "local" : flags.has("cli-missing") ? "missing" : undefined,
+ creatingElsewhere: flags.has("creating-elsewhere"),
failCreates: flags.has("create-fail-runtime") ? "runtime-once" : flags.has("create-fail-disk") ? "disk" : undefined,
...(flags.has("update-ready")
? { update: { status: "downloaded" as const, version: "0.9.3", percent: 100, notesUrl: DEMO_NOTES } }
@@ -681,6 +691,7 @@ export function createDemoAdapter(options: DemoOptions = {}): DataAdapter & { re
return handler(args);
},
subscribe: (l) => events.subscribe(l),
+ ...(options.creatingElsewhere ? { creatingElsewhere: () => DEMO_CREATING_ELSEWHERE } : {}),
dispose() {
for (const t of timers) clearTimeout(t);
timers.clear();
diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
index 97f8adec7b..6eb67665da 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts
@@ -66,7 +66,7 @@ import type { LinkCreate, ShareLink } from "../ops/links";
import { unsupportedPresenceOps, type PresenceJoinInfo } from "../ops/presence";
import { unsupportedRuntimeFixOps } from "../ops/runtime-fix";
import type { CliInstallPlan } from "../contracts/first-run";
-import type { ListStatus, SpaceRow } from "../contracts/spaces";
+import type { CreatingElsewhere, ListStatus, SpaceRow } from "../contracts/spaces";
import {
isWebkitResponse,
WEBKIT_EVENT,
@@ -531,6 +531,8 @@ export function createWebkitAdapter(
let daemonNotice: string | null = null;
// How far the host's last list read got (`listStatus`).
let listStatus: ListStatus = { loaded: false, incomplete: false, reaching: 0, stale: false };
+ // What your other computers are creating (`creatingElsewhere`).
+ let creatingElsewhere: CreatingElsewhere[] = [];
// The Machines page the host's core drew (`machinesView`).
let machinesView: MachinesView | null = null;
const listSpaces = async () => {
@@ -540,6 +542,7 @@ export function createWebkitAdapter(
// Until the host's first read answers its list is no list at all (an
// app just updated, its daemon starting): never "no Spaces".
listStatus = { loaded: answer.loaded !== false, incomplete: answer.incomplete === true, reaching: answer.reaching ?? 0, stale: answer.stale === true };
+ creatingElsewhere = answer.creatingElsewhere ?? [];
return answer;
};
@@ -775,6 +778,7 @@ export function createWebkitAdapter(
subscribe: (l) => events.subscribe(l),
listNotice: () => rosterError,
listStatus: () => listStatus,
+ creatingElsewhere: () => creatingElsewhere,
hostNotice: () => daemonNotice,
machinesView: () => machinesView,
dispose() {
diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
index 8e6251a239..73698d7a90 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
@@ -775,6 +775,37 @@
"action"
]
},
+ "CreatingElsewhere": {
+ "type": "object",
+ "properties": {
+ "machineId": {
+ "type": "string"
+ },
+ "machineName": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "os": {
+ "type": "string"
+ },
+ "phase": {
+ "type": "string"
+ },
+ "percent": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "machineId",
+ "machineName",
+ "name",
+ "os",
+ "phase",
+ "percent"
+ ]
+ },
"DevicesInput": {
"type": "object",
"properties": {
@@ -5053,6 +5084,12 @@
},
"stale": {
"type": "boolean"
+ },
+ "creatingElsewhere": {
+ "type": "array",
+ "items": {
+ "$ref": "#/$defs/CreatingElsewhere"
+ }
}
},
"required": [
diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
index 362a9e7142..36c1ae97fe 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
@@ -54,7 +54,7 @@ import type {
import type { NotificationInput } from "./notifications";
import type { AboutInput, DriveCheckInput, DriveStorageInput, LoginItemReport, StorageInput, UpdateState } from "./settings";
import type { ShareEntry, ShareRemoval } from "./share";
-import type { CreateFix, SpaceProgress, SpaceRow } from "./spaces";
+import type { CreateFix, CreatingElsewhere, SpaceProgress, SpaceRow } from "./spaces";
import type { CatalogEntry, ConsentItem, KvDomainCount, KvInventory, OpenWindow, PlanStep, RemoteWindow, RunReport, TeleportPlan } from "./teleport";
import type { AgentSetupOutcome, DriveGrantInput, DriveMountInput, DriveRequestInput, Experiments, VolumeOverview } from "./volume";
import type { AgentKeysReport } from "../ops/agent-keys";
@@ -1178,6 +1178,12 @@ const WkHostShape = ref(
}),
);
+/** `spaces.list`'s Spaces your other computers are creating (CUA-2349). */
+const CreatingElsewhereShape = ref(
+ "CreatingElsewhere",
+ obj<CreatingElsewhere>()({ machineId: str, machineName: str, name: str, os: str, phase: str, percent: num }),
+);
+
const WkSpaceShape = ref(
"WkSpace",
obj<WkSpace>()({
@@ -1208,7 +1214,7 @@ const WkSpaceShape = ref(
const WkSpacesShape = ref(
"WkSpaces",
- obj<WkSpaces>()({ loaded: bool, selectedId: nullable(str), spaces: list(object({ space: WkSpaceShape, deleting: bool })), rosterError: optNull(str), daemonNotice: optNull(str), incomplete: opt(bool), reaching: opt(num), stale: opt(bool) }),
+ obj<WkSpaces>()({ loaded: bool, selectedId: nullable(str), spaces: list(object({ space: WkSpaceShape, deleting: bool })), rosterError: optNull(str), daemonNotice: optNull(str), incomplete: opt(bool), reaching: opt(num), stale: opt(bool), creatingElsewhere: opt(list(CreatingElsewhereShape)) }),
);
const WkSessionShape = ref(
diff --git a/apps/cua-spaces-web/src/bridge/contracts/spaces.ts b/apps/cua-spaces-web/src/bridge/contracts/spaces.ts
index f0dbe282de..2717abc681 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/spaces.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/spaces.ts
@@ -370,6 +370,27 @@ export interface ListStatus {
stale: boolean;
}
+/**
+ * A Space another of your computers is creating (`spaces.list`'s
+ * `creatingElsewhere`, the SDK's `SpaceList.creating`, CUA-2349). That
+ * computer publishes it through the relay while it creates it, so a few
+ * seconds late; once it is ready it is a Space like any other.
+ */
+export interface CreatingElsewhere {
+ /** The computer's relay machine id. */
+ machineId: string;
+ /** "Mac mini". */
+ machineName: string;
+ /** The Space's name. */
+ name: string;
+ /** `macos`, `linux`, `windows`, or empty when unknown. */
+ os: string;
+ /** `preparing`, `pulling`, `creating`, `booting`, `waiting_for_services`, `connecting`. */
+ phase: string;
+ /** How far along, 0 to 100. */
+ percent: number;
+}
+
/** What the Spaces page shows besides the Spaces (`spaces::ListView`). */
export interface ListView {
/** "Create your first Space": a complete list with no Space only. */
diff --git a/apps/cua-spaces-web/src/bridge/hooks.ts b/apps/cua-spaces-web/src/bridge/hooks.ts
index 755bd6966a..c6275e5cb0 100644
--- a/apps/cua-spaces-web/src/bridge/hooks.ts
+++ b/apps/cua-spaces-web/src/bridge/hooks.ts
@@ -20,7 +20,7 @@ import type {
import { NO_EXPERIMENTS, type Experiments } from "./contracts/volume";
import type { KvGrant, KvListView, KvSelection, VaultAction } from "./contracts/keyvault";
import type { KvAccessCommand } from "./ops/keyvault-manage";
-import { LIST_COMPLETE, type ListStatus, type Space } from "./contracts/spaces";
+import { LIST_COMPLETE, type CreatingElsewhere, type ListStatus, type Space } from "./contracts/spaces";
import { hostSetupGuide, type HostSetupGuide, type Machine } from "./derive";
import {
firstSpaceImages,
@@ -148,10 +148,14 @@ export interface SpacesHook extends Resource<Space[]> {
/** How far the list got: while some of the account's computers have not
* answered (or nothing was read yet) it is not "no Spaces" (`listView`). */
listStatus: ListStatus;
+ /** Spaces your other computers are creating now ("Creating macOS on Mac mini… 40%"). */
+ creatingElsewhere: CreatingElsewhere[];
/** The host's standing notice (another app keeps its own daemon). Null when none. */
hostNotice: string | null;
}
+const NONE_ELSEWHERE: CreatingElsewhere[] = [];
+
/** Nothing read yet (no store). */
const NOT_LOADED: ListStatus = { ...LIST_COMPLETE, loaded: false };
@@ -163,6 +167,7 @@ export function useSpaces(): SpacesHook {
const store = ctx.store;
const listStatus = useSyncExternalStore(store ? store.subscribe : noopSubscribe, () => store?.listStatus ?? NOT_LOADED, () => NOT_LOADED);
const listNotice = useSyncExternalStore(store ? store.subscribe : noopSubscribe, () => store?.listNotice ?? null, () => null);
+ const creatingElsewhere = useSyncExternalStore(store ? store.subscribe : noopSubscribe, () => store?.creatingElsewhere ?? NONE_ELSEWHERE, () => NONE_ELSEWHERE);
const run = useAction();
return {
...r,
@@ -180,6 +185,7 @@ export function useSpaces(): SpacesHook {
createdId: (id) => ctx.store?.createdId(id),
listNotice,
listStatus,
+ creatingElsewhere,
hostNotice: ctx.store?.hostNotice ?? null,
};
}
diff --git a/apps/cua-spaces-web/src/bridge/store.ts b/apps/cua-spaces-web/src/bridge/store.ts
index 9dc01b11e0..2e7d1b9e99 100644
--- a/apps/cua-spaces-web/src/bridge/store.ts
+++ b/apps/cua-spaces-web/src/bridge/store.ts
@@ -23,7 +23,7 @@ import type { MachineRow, MachinesView, OnboardingMode, SettingsPage, SignInFail
import type { OnboardingAction, OnboardingFlowState } from "./contracts/onboarding";
import type { KeyvaultOverview, KvGrant, KvListView, KvSelection, VaultAction, VaultState } from "./contracts/keyvault";
import type { KvAccessCommand } from "./ops/keyvault-manage";
-import { LIST_COMPLETE, type CreateAction, type CreatesState, type ListStatus, type Space, type SpaceOs, type SpaceRow } from "./contracts/spaces";
+import { LIST_COMPLETE, type CreateAction, type CreatingElsewhere, type CreatesState, type ListStatus, type Space, type SpaceOs, type SpaceRow } from "./contracts/spaces";
import {
INITIAL_VAULT_STATE,
agentRows,
@@ -252,6 +252,8 @@ export class BridgeStore {
/** How far the host's last registry read got (`DataAdapter.listStatus`):
* not read yet until the first answer. */
private listStatusValue: ListStatus = { loaded: false, incomplete: false, reaching: 0, stale: false };
+ /** What your other computers are creating (`DataAdapter.creatingElsewhere`). */
+ private creatingElsewhereValue: CreatingElsewhere[] = [];
/** The host's standing notice (`DataAdapter.hostNotice`). */
private hostNoticeText: string | null = null;
private creates: CreatesState = { ...NO_CREATES, streaks: loadCreateStreaks() };
@@ -410,6 +412,11 @@ export class BridgeStore {
return this.listStatusValue;
}
+ /** The Spaces your other computers are creating now. */
+ get creatingElsewhere(): CreatingElsewhere[] {
+ return this.creatingElsewhereValue;
+ }
+
get listNotice(): string | null {
return this.listNoticeText;
}
@@ -458,6 +465,7 @@ export class BridgeStore {
const rows = await this.adapter.call("spaces.list", {});
this.listNoticeText = this.adapter.listNotice?.() ?? null;
this.listStatusValue = this.adapter.listStatus?.() ?? LIST_COMPLETE;
+ this.creatingElsewhereValue = this.adapter.creatingElsewhere?.() ?? [];
this.hostNoticeText = this.adapter.hostNotice?.() ?? null;
this.applyRows(rows);
break;
diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
index 59deeb6864..6c974b3363 100644
--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts
@@ -284,6 +284,9 @@ export interface WkSpaces {
/** Your other computers' rows are the last known ones (kept across a
* daemon restart), not yet confirmed by the relay. */
stale?: boolean;
+ /** Spaces your other computers are creating now (CUA-2349). Absent from
+ * a host that does not read them. */
+ creatingElsewhere?: import("./contracts/spaces").CreatingElsewhere[];
}
/** `machines.list`: the sidebar and the account's devices. */
diff --git a/apps/cua-spaces-web/src/lib/spaces.ts b/apps/cua-spaces-web/src/lib/spaces.ts
index 67d3a1cd33..266750da1c 100644
--- a/apps/cua-spaces-web/src/lib/spaces.ts
+++ b/apps/cua-spaces-web/src/lib/spaces.ts
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: FSL-1.1-MIT
// Copyright (c) 2026 Cua AI, Inc.
-import type { CoreClient, Machine, Space } from "@/bridge";
+import type { CoreClient, CreatingElsewhere, Machine, Space, SpaceOs } from "@/bridge";
import { OS_NAME } from "@/components/os-icon";
import { thisComputerLabel } from "@/lib/host-labels";
import { messageText } from "@/lib/messages";
@@ -93,6 +93,26 @@ export function spacePlace(space: Pick<Space, "os" | "osPrettyName">, machine: s
return os ? `${os} on ${machine}` : machine;
}
+/** A Space another computer is creating: its OS as an icon takes (`unknown` when it did not say). */
+export function elsewhereOs(c: Pick<CreatingElsewhere, "os">): SpaceOs {
+ return c.os === "macos" || c.os === "linux" || c.os === "windows" ? c.os : "unknown";
+}
+
+/** "Creating macOS on Mac mini…" (CUA-2349): what another computer is making, from its own report. */
+export function creatingElsewherePlace(c: Pick<CreatingElsewhere, "os" | "machineName">): string {
+ const os = elsewhereOs(c);
+ const what = os === "unknown" ? "a Space" : OS_NAME[os];
+ return `Creating ${what} on ${c.machineName.trim() || "another computer"}…`;
+}
+
+/** How far it got: "40%". */
+export const creatingElsewherePercent = (c: Pick<CreatingElsewhere, "percent">): string => `${Math.min(100, Math.max(0, Math.round(c.percent)))}%`;
+
+/** "Creating macOS on Mac mini… 40%". */
+export function creatingElsewhereLine(c: Pick<CreatingElsewhere, "os" | "machineName" | "percent">): string {
+ return `${creatingElsewherePlace(c)} ${creatingElsewherePercent(c)}`;
+}
+
/** The machine a Space runs on, by the machines' `spaceIds`. */
export function machineName(machines: readonly Machine[], space: Pick<Space, "id" | "provider" | "hostName">): string {
const machine = machines.find((m) => m.spaceIds.includes(space.id));
diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsx
index 1cad8329fa..e1076f52ef 100644
--- a/apps/cua-spaces-web/src/routes/spaces/index.tsx
+++ b/apps/cua-spaces-web/src/routes/spaces/index.tsx
@@ -5,7 +5,7 @@ import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
import { ArrowDownCircleIcon, KeyRoundIcon, LoaderCircleIcon, MonitorIcon, PlusIcon, PowerIcon, SearchIcon } from "lucide-react";
import { useEffect, useRef, useState, type DragEvent } from "react";
-import { emptyHome, listView, spaceResources, useAgents, useBridge, useChecklist, useResources, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaceFiles, useSpaces, useSpaceThumbnail, useWindowDropTarget, type Space } from "@/bridge";
+import { emptyHome, listView, spaceResources, type CreatingElsewhere, useAgents, useBridge, useChecklist, useResources, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaceFiles, useSpaces, useSpaceThumbnail, useWindowDropTarget, type Space } from "@/bridge";
import { EmptyHome } from "@/components/empty-home";
import { RunAgentDialog } from "@/components/agents/run-agent-dialog";
import { SpaceReadyCard, useAgentOffer } from "@/components/space-ready-card";
@@ -26,7 +26,7 @@ import { toast, toastError } from "@/components/ui/toast";
import { creatingLine, thisComputerText } from "@/lib/host-labels";
import { plural } from "@/lib/plural";
import { cn } from "@/lib/utils";
-import { createError, createProgress, machineName, matchesQuery, powerButton, powerError, realSpaces, spacePlace, spaceState, visibleSpaces, type SpaceFilter } from "@/lib/spaces";
+import { createError, createProgress, creatingElsewhereLine, creatingElsewherePercent, creatingElsewherePlace, elsewhereOs, machineName, matchesQuery, powerButton, powerError, realSpaces, spacePlace, spaceState, visibleSpaces, type SpaceFilter } from "@/lib/spaces";
export const Route = createFileRoute("/spaces/")({
component: SpacesPage,
@@ -42,7 +42,7 @@ const FILTERS: { value: SpaceFilter; label: string }[] = [
];
function SpacesPage() {
- const { data: all = [], isLoading, error, listNotice, listStatus } = useSpaces();
+ const { data: all = [], isLoading, error, listNotice, listStatus, creatingElsewhere } = useSpaces();
// Machines' own desktops are on Machines, not here.
const spaces = realSpaces(all);
const { data: machines = [] } = useMachines();
@@ -60,6 +60,11 @@ function SpacesPage() {
const visible = visibleSpaces(spaces, filter, (s) => matchesQuery(core, s, machineName(machines, s), query));
const onDisk = (s: Space) => spaceResources(resources, s.id)?.diskOnHost?.bytes ?? -1;
const shown = sort === "size" ? [...visible].sort((a, b) => onDisk(b) - onDisk(a)) : visible;
+ // Spaces your other computers are creating (CUA-2349): first in the grid, until they are ready.
+ const elsewhere =
+ filter === "all" || filter === "creating"
+ ? creatingElsewhere.filter((c) => matchesQuery(core, { id: `${c.machineId}/${c.name}`, name: c.name, detail: creatingElsewhereLine(c) }, c.machineName, query))
+ : [];
const access = useSpaceAccess(spaces);
const running = spaces.filter((s) => spaceState(s) === "running").length;
// After the first run's Finish later, its to-do list stands in for the checklist.
@@ -78,7 +83,7 @@ function SpacesPage() {
const view = listView(core, listStatus, spaces.length);
// Never read, and the host says why: "Spaces could not be loaded" (the empty home's unread title).
const unread = !listStatus.loaded && Boolean(listNotice);
- const empty = !error && !isLoading && (view.empty || unread);
+ const empty = !error && !isLoading && (view.empty || unread) && creatingElsewhere.length === 0;
// No Spaces yet (or the list could not be read): the SwiftUI app's empty home, as the first-run guide.
const guide = empty && home && home.tiles.length > 0 ? home : null;
const reachingLine = error || unread ? null : view.reachingLine;
@@ -158,7 +163,22 @@ function SpacesPage() {
<EmptyState icon={<MonitorIcon />} title="Couldn't load Spaces">
{error.message}
</EmptyState>
- ) : isLoading ? null : guide ? (
+ ) : isLoading ? null : shown.length + elsewhere.length > 0 ? (
+ <ul className="grid grid-cols-[repeat(auto-fill,minmax(232px,1fr))] gap-4">
+ {/* Being created, first: as this computer's own creates sort. */}
+ {elsewhere.map((c) => (
+ <li key={`elsewhere:${c.machineId}/${c.name}`}>
+ <CreatingElsewhereTile creating={c} />
+ </li>
+ ))}
+ {shown.map((space) => (
+ // Off-screen tiles skip layout and paint until they scroll in.
+ <li key={space.id} className="[content-visibility:auto] [contain-intrinsic-size:auto_232px]">
+ <SpaceTile space={space} machine={machineName(machines, space)} accessKey={access.signedIn.has(space.id) ? access.accessKey(space.id) : undefined} />
+ </li>
+ ))}
+ </ul>
+ ) : guide ? (
<EmptyHome home={guide} unread={Boolean(listNotice)} />
) : spaces.length === 0 && !empty ? null : spaces.length === 0 ? (
<EmptyState
@@ -180,16 +200,7 @@ function SpacesPage() {
<EmptyState icon={<MonitorIcon />} title={`No ${filter} Spaces`}>
Pick another filter to see the rest.
</EmptyState>
- ) : (
- <ul className="grid grid-cols-[repeat(auto-fill,minmax(232px,1fr))] gap-4">
- {shown.map((space) => (
- // Off-screen tiles skip layout and paint until they scroll in.
- <li key={space.id} className="[content-visibility:auto] [contain-intrinsic-size:auto_232px]">
- <SpaceTile space={space} machine={machineName(machines, space)} accessKey={access.signedIn.has(space.id) ? access.accessKey(space.id) : undefined} />
- </li>
- ))}
- </ul>
- )}
+ ) : null}
{reachingLine && !isLoading ? (
<p data-spaces-reaching="" role="status" className={cn("px-1 text-xs text-muted-foreground", spaces.length > 0 ? "mt-4" : "py-6 text-center")}>
{reachingLine}
@@ -380,6 +391,44 @@ function SpaceLink({ space, machine, windowOver = false }: { space: Space; machi
);
}
+/**
+ * A Space another of your computers is creating (CUA-2349): the same tile
+ * as one this computer creates, with "Creating macOS on Mac mini… 40%" from
+ * that computer's own report. Nothing to open yet; once it is ready it is a
+ * Space like any other (or that computer's count, when its Spaces are not
+ * shared).
+ */
+function CreatingElsewhereTile({ creating }: { creating: CreatingElsewhere }) {
+ const os = elsewhereOs(creating);
+ const line = creatingElsewhereLine(creating);
+ return (
+ <div data-creating-elsewhere={creating.machineId} data-state="creating" role="group" aria-label={`${creating.name}: ${line}`} className="block w-full rounded-xl border bg-card p-1.5 text-left shadow-xs">
+ <SpaceCanvas>
+ <OsIcon os={os} className="size-6 text-muted-foreground/30" />
+ <div className="absolute inset-x-3 bottom-3">
+ <div className="h-1 overflow-hidden rounded-full bg-foreground/10">
+ <div data-create-progress className="h-full rounded-full bg-brand transition-[width] duration-500" style={{ width: `${Math.min(100, Math.max(0, creating.percent))}%` }} />
+ </div>
+ </div>
+ </SpaceCanvas>
+ <div className="flex items-start gap-2.5 px-1.5 pt-2.5 pb-1">
+ <OsIcon os={os} className="mt-0.5 size-3.5 shrink-0 text-muted-foreground" />
+ <div className="min-w-0 flex-1">
+ <div className="truncate text-[13px] font-medium">{creating.name}</div>
+ <div className="mt-0.5 truncate text-xs text-muted-foreground" title={line}>
+ {creatingElsewherePlace(creating)}
+ </div>
+ </div>
+ {/* How far, where this computer's own creates say "Creating". */}
+ <span data-state-label="creating" className="mt-px inline-flex shrink-0 items-center gap-1.5 text-xs tabular-nums text-muted-foreground">
+ <span className="size-1.5 animate-pulse rounded-full bg-brand" aria-hidden />
+ {creatingElsewherePercent(creating)}
+ </span>
+ </div>
+ </div>
+ );
+}
+
function Thumbnail({ space }: { space: Space }) {
const state = spaceState(space);
const ref = useRef<HTMLDivElement | null>(null);
diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdx
index c8e675e681..8f63f4ddc8 100644
--- a/docs/content/docs/cua-sdk/reference/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/index.mdx
@@ -57,6 +57,8 @@ The Cua SDK in Python, TypeScript, Swift, Kotlin and Rust, all generated from th
| [Resize a Space](/cua-sdk/reference/spaces/resize) | Change a local VM's CPU, memory or disk while keeping its files. |
| [Lifetime and egress](/cua-sdk/reference/spaces/lifetime) | How long a Space lives and which destinations it may reach, set after it exists. |
| [Space](/cua-sdk/reference/spaces/space) | A connected Space: shell, files, tools, windows, icons, displays, the hotspot and teleport. |
+| [Share a Space](/cua-sdk/reference/spaces/sharing) | Give another person access to a Space, list who has it and take it back. |
+| [Relay registration](/cua-sdk/reference/spaces/relay-registration) | Register a Space with the relay so other devices reach it, and unregister it. |
| [Elastic pool and prewarm](/cua-sdk/reference/spaces/elastic) | Plan where Spaces go and what it costs, add and remove cloud hosts, set the budget, and keep Spaces ready. |
| [Build an image](/cua-sdk/reference/spaces/build) | Build a Dockerfile or steps in a Space as pinned checkpoints that Spaces fork from, with a content-hash layer cache. |
| [Channel](/cua-sdk/reference/spaces/channel) | Which way a Space's calls go, and port forwards over its own connection. |
@@ -95,4 +97,4 @@ The Cua SDK in Python, TypeScript, Swift, Kotlin and Rust, all generated from th
| --- | --- |
| [Protocol](/cua-sdk/reference/protocol) | The gRPC contracts of cua-spacesd (`cua.env.v1`) and the cua daemon (`cua.daemon.v1`). |
-339 items, 424 methods. The [Types](/cua-sdk/reference/types) page lists them.
+340 items, 424 methods. The [Types](/cua-sdk/reference/types) page lists them.
diff --git a/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx b/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx
index 7b150ddf05..53ed96ba74 100644
--- a/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx
+++ b/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx
@@ -431,6 +431,21 @@ Response for `SpaceService.ListSpaces`.
| `reaching` | 3 | `uint32` | `known_now` only: how many computers are still being reached (0 when unknown). |
| `stale` | 4 | `bool` | `known_now` only: the other computers' rows are the last known ones, not yet confirmed by the relay. |
| `notice` | 5 | `string` | `known_now` only: why the account's computers could not be read, when they could not. |
+| `creating` | 6 | repeated [`CreatingSpace`](#creatingspace) | `known_now` only: Spaces your other computers are creating now, from what each published in its relay machine record (CUA-2349). |
+
+### CreatingSpace
+
+A Space another of your computers is creating.
+
+| Field | # | Type | Description |
+| --- | --- | --- | --- |
+| `machine_id` | 1 | `string` | The computer's relay machine id. |
+| `machine_name` | 2 | `string` | The computer's name. |
+| `name` | 3 | `string` | The Space's name. |
+| `os` | 4 | `string` | `macos`, `linux`, `windows`, or empty when unknown. |
+| `phase` | 5 | `string` | The create's phase (`preparing`, `pulling`, `booting`, ...). |
+| `percent` | 6 | `uint32` | How far along the whole create is, 0 to 100. |
+| `updated_at_ms` | 7 | `uint64` | When the computer published it, unix ms. |
### NamedVolume
diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
index ecc3407eed..b0107081e6 100644
--- a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
+++ b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx
@@ -18,7 +18,7 @@ The cua SDK: the only `#[uniffi::export]` crate of `libs/cua`.
These are the objects, records, enums and functions the language bindings export, documented once in the [Cua SDK reference](/cua-sdk/reference), whose Rust tabs show each signature. Objects are `Arc<T>` handles whose methods are `async fn` returning `Result<_, CuaError>`, records are structs with public fields, and names are snake_case.
-[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces/agents#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agent-setup#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agent-setup#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces/agents#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agent-setup#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agent-setup#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agent-setup#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agent-setup#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces/agents#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox/lifecycle#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BakeForkCheck`](/cua-sdk/reference/sandbox/bake#bakeforkcheck-record), [`BakeOptions`](/cua-sdk/reference/sandbox/bake#bakeoptions-record), [`BakeSummary`](/cua-sdk/reference/sandbox/bake#bakesummary-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BuildImageConfig`](/cua-sdk/reference/spaces/build#buildimageconfig-record), [`BuildInfo`](/cua-sdk/reference/spaces/build#buildinfo-record), [`BuildListener`](/cua-sdk/reference/spaces/build#buildlistener), [`BuildOptions`](/cua-sdk/reference/spaces/build#buildoptions-record), [`BuildProgress`](/cua-sdk/reference/spaces/build#buildprogress-record), [`BuildResult`](/cua-sdk/reference/spaces/build#buildresult-record), [`BuildStep`](/cua-sdk/reference/spaces/build#buildstep-enum), [`BuildStepResult`](/cua-sdk/reference/spaces/build#buildstepresult-record), [`BundledSkill`](/cua-sdk/reference/agent-setup#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CheckpointSummary`](/cua-sdk/reference/sandbox/checkpoints#checkpointsummary-record), [`CloudAuditEntry`](/cua-sdk/reference/spaces/persistent-agents#cloudauditentry-record), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`EgressEnforcement`](/cua-sdk/reference/spaces/space#egressenforcement-enum), [`EgressPolicy`](/cua-sdk/reference/spaces#egresspolicy-record), [`ElasticAssignment`](/cua-sdk/reference/spaces/elastic#elasticassignment-record), [`ElasticBudget`](/cua-sdk/reference/spaces/elastic#elasticbudget-record), [`ElasticBudgetUpdate`](/cua-sdk/reference/spaces/elastic#elasticbudgetupdate-record), [`ElasticDecision`](/cua-sdk/reference/spaces/elastic#elasticdecision-record), [`ElasticHost`](/cua-sdk/reference/spaces/elastic#elastichost-record), [`ElasticNewHost`](/cua-sdk/reference/spaces/elastic#elasticnewhost-record), [`ElasticPlan`](/cua-sdk/reference/spaces/elastic#elasticplan-record), [`ElasticPlanRequest`](/cua-sdk/reference/spaces/elastic#elasticplanrequest-record), [`ElasticRemoved`](/cua-sdk/reference/spaces/elastic#elasticremoved-record), [`ElasticUnplaced`](/cua-sdk/reference/spaces/elastic#elasticunplaced-record), [`ForkBatch`](/cua-sdk/reference/sandbox/fork-batch#forkbatch), [`ForkBatchEvent`](/cua-sdk/reference/sandbox/fork-batch#forkbatchevent-enum), [`ForkBatchItem`](/cua-sdk/reference/sandbox/fork-batch#forkbatchitem-record), [`ForkBatchPlacement`](/cua-sdk/reference/sandbox/fork-batch#forkbatchplacement-record), [`ForkBatchResult`](/cua-sdk/reference/sandbox/fork-batch#forkbatchresult-record), [`ForkBatchSummary`](/cua-sdk/reference/sandbox/fork-batch#forkbatchsummary-record), [`ForkGroup`](/cua-sdk/reference/sandbox/fork-batch#forkgroup-record), [`ForkManyOptions`](/cua-sdk/reference/sandbox/fork-batch#forkmanyoptions-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostServiceMigration`](/cua-sdk/reference/spaces/host#hostservicemigration-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record), [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`NamedVolume`](/cua-sdk/reference/spaces/volume#namedvolume-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox/lifecycle#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PoolCreateOptions`](/cua-sdk/reference/image#poolcreateoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`Prewarm`](/cua-sdk/reference/spaces/elastic#prewarm-record), [`PrewarmOptions`](/cua-sdk/reference/spaces/elastic#prewarmoptions-record), [`PrewarmPlacement`](/cua-sdk/reference/spaces/elastic#prewarmplacement-record), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox/lifecycle#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd/shell#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxPool`](/cua-sdk/reference/image#sandboxpool-record), [`SandboxRefParts`](/cua-sdk/reference/sandbox/lifecycle#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`Share`](/cua-sdk/reference/share#share-record), [`ShareAccess`](/cua-sdk/reference/share#shareaccess-enum), [`ShareCheck`](/cua-sdk/reference/share#sharecheck-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`SnapshotFallbackOptions`](/cua-sdk/reference/sandbox/fork-batch#snapshotfallbackoptions-record), [`SnapshotSyncProgress`](/cua-sdk/reference/sandbox/fork-batch#snapshotsyncprogress-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces/agents#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpaceList`](/cua-sdk/reference/spaces#spacelist-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResizeReport`](/cua-sdk/reference/spaces/resize#spaceresizereport-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`SpacesdDownload`](/cua-sdk/reference/spacesd#spacesddownload), [`SpacesdForward`](/cua-sdk/reference/spacesd#spacesdforward), [`SpacesdHttpHeader`](/cua-sdk/reference/spacesd#spacesdhttpheader-record), [`SpacesdHttpRequest`](/cua-sdk/reference/spacesd#spacesdhttprequest-record), [`SpacesdHttpResponse`](/cua-sdk/reference/spacesd#spacesdhttpresponse-record), [`SpacesdProcess`](/cua-sdk/reference/spacesd/shell#spacesdprocess), [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record), [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record), [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record), [`SpaceShareEntry`](/cua-sdk/reference/spaces/space#spaceshareentry-record), [`SpaceShares`](/cua-sdk/reference/spaces/space#spaceshares-record), [`SpacesHost`](/cua-sdk/reference/spaces/host#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/host#spaceshostlimit-record), [`SpacesHostLoad`](/cua-sdk/reference/spaces/host#spaceshostload-record), [`SpacesListListener`](/cua-sdk/reference/spaces/list-watch#spaceslistlistener), [`SpacesListWatch`](/cua-sdk/reference/spaces/list-watch#spaceslistwatch), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceTransport`](/cua-sdk/reference/spaces/channel#spacetransport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record), [`VolumeMount`](/cua-sdk/reference/spaces/volume#volumemount-record).
+[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces/agents#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agent-setup#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agent-setup#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces/agents#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agent-setup#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agent-setup#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agent-setup#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agent-setup#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces/agents#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox/lifecycle#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BakeForkCheck`](/cua-sdk/reference/sandbox/bake#bakeforkcheck-record), [`BakeOptions`](/cua-sdk/reference/sandbox/bake#bakeoptions-record), [`BakeSummary`](/cua-sdk/reference/sandbox/bake#bakesummary-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BuildImageConfig`](/cua-sdk/reference/spaces/build#buildimageconfig-record), [`BuildInfo`](/cua-sdk/reference/spaces/build#buildinfo-record), [`BuildListener`](/cua-sdk/reference/spaces/build#buildlistener), [`BuildOptions`](/cua-sdk/reference/spaces/build#buildoptions-record), [`BuildProgress`](/cua-sdk/reference/spaces/build#buildprogress-record), [`BuildResult`](/cua-sdk/reference/spaces/build#buildresult-record), [`BuildStep`](/cua-sdk/reference/spaces/build#buildstep-enum), [`BuildStepResult`](/cua-sdk/reference/spaces/build#buildstepresult-record), [`BundledSkill`](/cua-sdk/reference/agent-setup#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CheckpointSummary`](/cua-sdk/reference/sandbox/checkpoints#checkpointsummary-record), [`CloudAuditEntry`](/cua-sdk/reference/spaces/persistent-agents#cloudauditentry-record), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`EgressEnforcement`](/cua-sdk/reference/spaces/space#egressenforcement-enum), [`EgressPolicy`](/cua-sdk/reference/spaces#egresspolicy-record), [`ElasticAssignment`](/cua-sdk/reference/spaces/elastic#elasticassignment-record), [`ElasticBudget`](/cua-sdk/reference/spaces/elastic#elasticbudget-record), [`ElasticBudgetUpdate`](/cua-sdk/reference/spaces/elastic#elasticbudgetupdate-record), [`ElasticDecision`](/cua-sdk/reference/spaces/elastic#elasticdecision-record), [`ElasticHost`](/cua-sdk/reference/spaces/elastic#elastichost-record), [`ElasticNewHost`](/cua-sdk/reference/spaces/elastic#elasticnewhost-record), [`ElasticPlan`](/cua-sdk/reference/spaces/elastic#elasticplan-record), [`ElasticPlanRequest`](/cua-sdk/reference/spaces/elastic#elasticplanrequest-record), [`ElasticRemoved`](/cua-sdk/reference/spaces/elastic#elasticremoved-record), [`ElasticUnplaced`](/cua-sdk/reference/spaces/elastic#elasticunplaced-record), [`ForkBatch`](/cua-sdk/reference/sandbox/fork-batch#forkbatch), [`ForkBatchEvent`](/cua-sdk/reference/sandbox/fork-batch#forkbatchevent-enum), [`ForkBatchItem`](/cua-sdk/reference/sandbox/fork-batch#forkbatchitem-record), [`ForkBatchPlacement`](/cua-sdk/reference/sandbox/fork-batch#forkbatchplacement-record), [`ForkBatchResult`](/cua-sdk/reference/sandbox/fork-batch#forkbatchresult-record), [`ForkBatchSummary`](/cua-sdk/reference/sandbox/fork-batch#forkbatchsummary-record), [`ForkGroup`](/cua-sdk/reference/sandbox/fork-batch#forkgroup-record), [`ForkManyOptions`](/cua-sdk/reference/sandbox/fork-batch#forkmanyoptions-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostServiceMigration`](/cua-sdk/reference/spaces/host#hostservicemigration-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record), [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`NamedVolume`](/cua-sdk/reference/spaces/volume#namedvolume-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox/lifecycle#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PoolCreateOptions`](/cua-sdk/reference/image#poolcreateoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`Prewarm`](/cua-sdk/reference/spaces/elastic#prewarm-record), [`PrewarmOptions`](/cua-sdk/reference/spaces/elastic#prewarmoptions-record), [`PrewarmPlacement`](/cua-sdk/reference/spaces/elastic#prewarmplacement-record), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox/lifecycle#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd/shell#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxPool`](/cua-sdk/reference/image#sandboxpool-record), [`SandboxRefParts`](/cua-sdk/reference/sandbox/lifecycle#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`Share`](/cua-sdk/reference/share#share-record), [`ShareAccess`](/cua-sdk/reference/share#shareaccess-enum), [`ShareCheck`](/cua-sdk/reference/share#sharecheck-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`SnapshotFallbackOptions`](/cua-sdk/reference/sandbox/fork-batch#snapshotfallbackoptions-record), [`SnapshotSyncProgress`](/cua-sdk/reference/sandbox/fork-batch#snapshotsyncprogress-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces/agents#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceCreatingElsewhere`](/cua-sdk/reference/spaces/space#spacecreatingelsewhere-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpaceList`](/cua-sdk/reference/spaces#spacelist-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/relay-registration#spacerelayregistration-record), [`SpaceResizeReport`](/cua-sdk/reference/spaces/resize#spaceresizereport-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`SpacesdDownload`](/cua-sdk/reference/spacesd#spacesddownload), [`SpacesdForward`](/cua-sdk/reference/spacesd#spacesdforward), [`SpacesdHttpHeader`](/cua-sdk/reference/spacesd#spacesdhttpheader-record), [`SpacesdHttpRequest`](/cua-sdk/reference/spacesd#spacesdhttprequest-record), [`SpacesdHttpResponse`](/cua-sdk/reference/spacesd#spacesdhttpresponse-record), [`SpacesdProcess`](/cua-sdk/reference/spacesd/shell#spacesdprocess), [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record), [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record), [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record), [`SpaceShareEntry`](/cua-sdk/reference/spaces/sharing#spaceshareentry-record), [`SpaceShares`](/cua-sdk/reference/spaces/sharing#spaceshares-record), [`SpacesHost`](/cua-sdk/reference/spaces/host#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/host#spaceshostlimit-record), [`SpacesHostLoad`](/cua-sdk/reference/spaces/host#spaceshostload-record), [`SpacesListListener`](/cua-sdk/reference/spaces/list-watch#spaceslistlistener), [`SpacesListWatch`](/cua-sdk/reference/spaces/list-watch#spaceslistwatch), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceTransport`](/cua-sdk/reference/spaces/channel#spacetransport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record), [`VolumeMount`](/cua-sdk/reference/spaces/volume#volumemount-record).
## Types
diff --git a/docs/content/docs/cua-sdk/reference/spaces/index.mdx b/docs/content/docs/cua-sdk/reference/spaces/index.mdx
index ee95e4725b..0f29cdfb17 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/index.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/index.mdx
@@ -36,8 +36,6 @@ Returned by [`Cua.spaces`](/cua-sdk/reference/cua#cua).
| [`list`](#spaceslist) | Registered Spaces. |
| [`list_known`](#spaceslist_known) | The Spaces known now: this machine's at once, and the account's other computers as far as they answered within a moment (`SpaceList` says how far the read got). |
| [`list_tools_json`](#spaceslist_tools_json) | The Spaces MCP `tools/list` result as JSON (the contract). |
-| [`relay_register`](#spacesrelay_register) | Publishes `space` on the cua.ai relay as a machine of the signed-in account, the way `cua host setup` publishes this computer: the Space's own driver dials out, so the account's other devices (a phone off this network) reach it as `relay:<machine>`, and nobody else until it is shared. |
-| [`relay_unregister`](#spacesrelay_unregister) | Takes `space` off the relay (its driver leaves; every share goes). |
| [`remove`](#spacesremove) | Unregisters a Space (the sandbox is not touched). |
| [`resolve`](#spacesresolve) | Resolves an id, legacy id, URL or display name. |
| [`space`](#spacesspace) | A connected handle to a registered Space. |
@@ -80,6 +78,8 @@ Returned by [`Cua.spaces`](/cua-sdk/reference/cua#cua).
| [`persistent_agents`](/cua-sdk/reference/spaces/persistent-agents#spacespersistent_agents) | Every persistent agent. |
| [`prewarm`](/cua-sdk/reference/spaces/elastic#spacesprewarm) | Keeps Spaces of `image` ready where the elastic pool puts them (the same solve as `on` `auto`, under the budget and pins), so the next creates of that shape start in a fraction of a second. |
| [`prewarms`](/cua-sdk/reference/spaces/elastic#spacesprewarms) | The prewarms, with how many each keeps ready now. |
+| [`relay_register`](/cua-sdk/reference/spaces/relay-registration#spacesrelay_register) | Publishes `space` on the cua.ai relay as a machine of the signed-in account, the way `cua host setup` publishes this computer: the Space's own driver dials out, so the account's other devices (a phone off this network) reach it as `relay:<machine>`, and nobody else until it is shared. |
+| [`relay_unregister`](/cua-sdk/reference/spaces/relay-registration#spacesrelay_unregister) | Takes `space` off the relay (its driver leaves; every share goes). |
| [`remove_prewarm`](/cua-sdk/reference/spaces/elastic#spacesremove_prewarm) | Ends prewarm `id` (its ready Spaces go). |
| [`resize`](/cua-sdk/reference/spaces/resize#spacesresize) | Gives a local VM Space another shape: `cpus` vCPUs, `memory_mb` MiB of memory, a disk grown to `disk_gb` GiB (each `None` keeps it). |
| [`resources`](/cua-sdk/reference/spaces/resources#spacesresources) | What this Mac, its extra Spaces and your other computers use now: processor, memory and disk, as one snapshot (a few seconds old at most). |
@@ -780,109 +780,6 @@ pub async fn list_tools_json(&self) -> Result<String, CuaError>
**Returns** `String` · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-### `Spaces.relay_register`
-
-Publishes `space` on the cua.ai relay as a machine of the signed-in
-account, the way `cua host setup` publishes this computer: the
-Space's own driver dials out, so the account's other devices (a
-phone off this network) reach it as `relay:<machine>`, and nobody
-else until it is shared. Idempotent.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def relay_register(self, space: str) -> SpaceRelayRegistration
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-relayRegister(space: string, asyncOpts_?: { signal: AbortSignal }): Promise<SpaceRelayRegistration>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func relayRegister(space: String) async throws -> SpaceRelayRegistration
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun relayRegister(space: String): SpaceRelayRegistration
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn relay_register(&self, space: String) -> Result<SpaceRelayRegistration, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `space` | `String` | required |
-
-**Returns** [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `Spaces.relay_unregister`
-
-Takes `space` off the relay (its driver leaves; every share goes).
-Returns false when it was not on the relay.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def relay_unregister(self, space: str) -> bool
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-relayUnregister(space: string, asyncOpts_?: { signal: AbortSignal }): Promise<boolean>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func relayUnregister(space: String) async throws -> Bool
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun relayUnregister(space: String): Boolean
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn relay_unregister(&self, space: String) -> Result<bool, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `space` | `String` | required |
-
-**Returns** `bool` · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
### `Spaces.remove`
Unregisters a Space (the sandbox is not touched).
@@ -1239,6 +1136,7 @@ Returned by [`Spaces.list_known`](#spaceslist_known).
| `reaching` | `u32` | | How many computers are still being reached (0 when unknown). |
| `stale` | `bool` | | The other computers' rows are the last known ones, not yet confirmed by the relay. |
| `notice` | `String` | | Why the account's computers could not be read, when they could not. |
+| `creating` | [`Vec<SpaceCreatingElsewhere>`](/cua-sdk/reference/spaces/space#spacecreatingelsewhere-record) | | Spaces your other computers are creating now, from what each published through the relay (empty from a daemon that predates it). |
## `SpacePowerReport` record
diff --git a/docs/content/docs/cua-sdk/reference/spaces/meta.json b/docs/content/docs/cua-sdk/reference/spaces/meta.json
index 2a6a0fc561..657a81e31b 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/meta.json
+++ b/docs/content/docs/cua-sdk/reference/spaces/meta.json
@@ -4,6 +4,8 @@
"resize",
"lifetime",
"space",
+ "sharing",
+ "relay-registration",
"elastic",
"build",
"channel",
diff --git a/docs/content/docs/cua-sdk/reference/spaces/relay-registration.mdx b/docs/content/docs/cua-sdk/reference/spaces/relay-registration.mdx
new file mode 100644
index 0000000000..050c751ae8
--- /dev/null
+++ b/docs/content/docs/cua-sdk/reference/spaces/relay-registration.mdx
@@ -0,0 +1,136 @@
+---
+title: "Relay registration"
+description: "Register a Space with the relay so other devices reach it, and unregister it."
+---
+
+{/*
+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
+ Generated by: pnpm --dir docs docs:generate:cua-sdk
+ Source: cua-bindgen docs (UniFFI metadata of libcua_sdk)
+ Version: 0.9.0
+*/}
+
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+`Spaces.relay_register` makes a Space reachable from your other devices through the relay; `Spaces.relay_unregister` stops that.
+
+## Relay registration
+
+Methods of [`Spaces`](/cua-sdk/reference/spaces#spaces).
+
+### `Spaces.relay_register`
+
+Publishes `space` on the cua.ai relay as a machine of the signed-in
+account, the way `cua host setup` publishes this computer: the
+Space's own driver dials out, so the account's other devices (a
+phone off this network) reach it as `relay:<machine>`, and nobody
+else until it is shared. Idempotent.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def relay_register(self, space: str) -> SpaceRelayRegistration
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+relayRegister(space: string, asyncOpts_?: { signal: AbortSignal }): Promise<SpaceRelayRegistration>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func relayRegister(space: String) async throws -> SpaceRelayRegistration
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun relayRegister(space: String): SpaceRelayRegistration
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn relay_register(&self, space: String) -> Result<SpaceRelayRegistration, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `space` | `String` | required |
+
+**Returns** [`SpaceRelayRegistration`](#spacerelayregistration-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `Spaces.relay_unregister`
+
+Takes `space` off the relay (its driver leaves; every share goes).
+Returns false when it was not on the relay.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def relay_unregister(self, space: str) -> bool
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+relayUnregister(space: string, asyncOpts_?: { signal: AbortSignal }): Promise<boolean>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func relayUnregister(space: String) async throws -> Bool
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun relayUnregister(space: String): Boolean
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn relay_unregister(&self, space: String) -> Result<bool, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `space` | `String` | required |
+
+**Returns** `bool` · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+## `SpaceRelayRegistration` record
+
+A Space published on the relay (`Spaces.relay_register`).
+
+Returned by [`Spaces.relay_register`](#spacesrelay_register).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `space` | `String` | | The Space. |
+| `relay_space` / `relaySpace` | `String` | | How the account's other devices reach it: `relay:<machine>`. |
+| `machine` | `String` | | The relay machine id. |
+| `url` | `String` | | The relay URL of the machine. |
+| `online` | `bool` | | Connected to the relay now. |
diff --git a/docs/content/docs/cua-sdk/reference/spaces/sharing.mdx b/docs/content/docs/cua-sdk/reference/spaces/sharing.mdx
new file mode 100644
index 0000000000..aae8eaad62
--- /dev/null
+++ b/docs/content/docs/cua-sdk/reference/spaces/sharing.mdx
@@ -0,0 +1,191 @@
+---
+title: "Share a Space"
+description: "Give another person access to a Space, list who has it and take it back."
+---
+
+{/*
+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
+ Generated by: pnpm --dir docs docs:generate:cua-sdk
+ Source: cua-bindgen docs (UniFFI metadata of libcua_sdk)
+ Version: 0.9.0
+*/}
+
+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
+
+`Space.share` gives a person access to a Space, `Space.shares` lists who has it, and `Space.unshare` takes it back.
+
+## Sharing
+
+Methods of [`Space`](/cua-sdk/reference/spaces/space#space).
+
+### `Space.share`
+
+Lets `who` (a verified email or an account id) watch (`viewer`,
+the default) or use (`editor`) this Space through the relay. A Space
+that is not a host is attached to the relay on its first share.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def share(self, who: str, role: Optional[str]) -> SpaceShares
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+share(who: string, role: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<SpaceShares>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func share(who: String, role: String?) async throws -> SpaceShares
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun share(who: String, role: String?): SpaceShares
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn share(&self, who: String, role: Option<String>) -> Result<SpaceShares, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `who` | `String` | required |
+| `role` | `Option<String>` | required |
+
+**Returns** [`SpaceShares`](#spaceshares-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `Space.shares`
+
+Who this Space is shared with, and who of them is connected now.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def shares(self) -> SpaceShares
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+shares(asyncOpts_?: { signal: AbortSignal }): Promise<SpaceShares>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func shares() async throws -> SpaceShares
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun shares(): SpaceShares
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn shares(&self) -> Result<SpaceShares, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+**Returns** [`SpaceShares`](#spaceshares-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+### `Space.unshare`
+
+Stops sharing this Space with `who` at once, or with everyone when
+`who` is `None`.
+
+<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
+<Tab value="Python">
+
+```python
+async def unshare(self, who: Optional[str]) -> SpaceShares
+```
+
+</Tab>
+<Tab value="TypeScript">
+
+```ts
+unshare(who: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<SpaceShares>
+```
+
+</Tab>
+<Tab value="Swift">
+
+```swift
+func unshare(who: String?) async throws -> SpaceShares
+```
+
+</Tab>
+<Tab value="Kotlin">
+
+```kotlin
+@Throws(CuaException::class)
+suspend fun unshare(who: String?): SpaceShares
+```
+
+</Tab>
+<Tab value="Rust">
+
+```rust
+pub async fn unshare(&self, who: Option<String>) -> Result<SpaceShares, CuaError>
+```
+
+</Tab>
+</Tabs>
+
+| Parameter | Type | Default |
+| --- | --- | --- |
+| `who` | `Option<String>` | required |
+
+**Returns** [`SpaceShares`](#spaceshares-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
+
+## `SpaceShareEntry` record
+
+One account a Space is shared with.
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `who` | `String` | | The email or account id, as shared. |
+| `role` | `String` | | `viewer` or `editor`. |
+| `connected` | `bool` | | Connected through the relay right now. |
+
+## `SpaceShares` record
+
+Who a Space is shared with.
+
+Returned by [`Space.share`](#spaceshare), [`Space.shares`](#spaceshares), [`Space.unshare`](#spaceunshare).
+
+| Field | Type | Default | Description |
+| --- | --- | --- | --- |
+| `space` | `String` | | The Space. |
+| `machine` | `String` | | The relay machine it is shared as (empty when not shared). |
+| `invitee_space` / `inviteeSpace` | `String` | | What the people it is shared with open (`relay:<machine>`). |
+| `url` | `String` | | The relay URL of the machine. |
+| `online` | `bool` | | The machine is on the relay now. |
+| `shares` | [`Vec<SpaceShareEntry>`](#spaceshareentry-record) | | The accounts and their roles. |
diff --git a/docs/content/docs/cua-sdk/reference/spaces/space.mdx b/docs/content/docs/cua-sdk/reference/spaces/space.mdx
index d60f1ee8f7..fd038ff0d8 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/space.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/space.mdx
@@ -35,12 +35,9 @@ Returned by [`Space.fork`](/cua-sdk/reference/sandbox/checkpoints#spacefork), [`
| [`screenshot`](#spacescreenshot) | Captures the Space's display: PNG at full size on the primary display unless `options` say otherwise (for a small preview, `Space.thumbnail` reads the shared cache instead). |
| [`send_file`](#spacesend_file) | Drops a host file or folder into the Space's `~/Downloads[/subdir]` (TeleportService.ReceiveFiles, per-file SHA-256). |
| [`set_presence_settings`](#spaceset_presence_settings) | Sets this Space's presence settings. |
-| [`share`](#spaceshare) | Lets `who` (a verified email or an account id) watch (`viewer`, the default) or use (`editor`) this Space through the relay. |
-| [`shares`](#spaceshares) | Who this Space is shared with, and who of them is connected now. |
| [`start_hotspot`](#spacestart_hotspot) | Starts the reverse-SOCKS hotspot: this host serves the Space's egress. |
| [`stop_hotspot`](#spacestop_hotspot) | Stops this Space's hotspot. |
| [`supports`](#spacesupports) | Whether the spacesd supports `feature`. |
-| [`unshare`](#spaceunshare) | Stops sharing this Space with `who` at once, or with everyone when `who` is `None`. |
| [`upload`](#spaceupload) | Copies a host file or folder to `dest` in the Space (default: the home directory). |
| [`write`](#spacewrite) | Writes bytes to a guest path (parents created, verified by SHA-256). |
| [`agent_events`](/cua-sdk/reference/spaces/agents#spaceagent_events) | Normalized events after `cursor` (0: the start), as the `agent_events` JSON (`events`, `cursor`, `caught_up`, `status`). |
@@ -61,12 +58,15 @@ Returned by [`Space.fork`](/cua-sdk/reference/sandbox/checkpoints#spacefork), [`
| [`join_presence`](/cua-sdk/reference/spaces/streams#spacejoin_presence) | Joins presence. |
| [`open_stream`](/cua-sdk/reference/spaces/streams#spaceopen_stream) | Mints a media session (ticket + WebSocket URL) for another client to attach to. |
| [`route`](/cua-sdk/reference/spaces/channel#spaceroute) | Which way this Space's calls go now (see `super.spacesd.SpacesdClient.route`): `local …`, `direct …`, `relay …`, `mesh direct <ip:port> rtt <ms> ms`, `mesh relayed` or `cloud`; empty when the Space runs no cua-spacesd. |
+| [`share`](/cua-sdk/reference/spaces/sharing#spaceshare) | Lets `who` (a verified email or an account id) watch (`viewer`, the default) or use (`editor`) this Space through the relay. |
+| [`shares`](/cua-sdk/reference/spaces/sharing#spaceshares) | Who this Space is shared with, and who of them is connected now. |
| [`spacesd`](/cua-sdk/reference/spacesd#spacespacesd) | The cua-spacesd client over the connection this Space authenticated. |
| [`stream_session`](/cua-sdk/reference/spaces/streams#spacestream_session) | Opens a media session and delivers keyframe-gated encoded frames and audio to the sinks (one delivery thread; decoding stays with the caller). |
| [`teleport`](/cua-sdk/reference/spaces/space#spaceteleport) | Teleports `app`'s session into this Space. |
| [`teleport_manifest`](/cua-sdk/reference/spaces/space#spaceteleport_manifest) | What teleporting `app` (`full` or `tabs`) would move from this host. |
| [`thumbnail`](/cua-sdk/reference/spaces/space#spacethumbnail) | The Space's latest thumbnail (a small JPEG of its primary display) from the cache every client on this machine shares: returned at once when it is younger than `max_age_ms` (unset: any age), else captured fresh through cua-spacesd and kept for the next caller. |
| [`transport`](/cua-sdk/reference/spaces/channel#spacetransport) | What carries this Space's calls, for a badge: `mesh` (end to end) or `relay_https` (the relay can read the session in transit; with `fallback_reason` when the mesh was wanted), or `local`, `direct`, `cloud`. |
+| [`unshare`](/cua-sdk/reference/spaces/sharing#spaceunshare) | Stops sharing this Space with `who` at once, or with everyone when `who` is `None`. |
| [`usage`](/cua-sdk/reference/spaces/space#spaceusage) | Processor, memory and storage use now (cheap: poll it at a low rate while a detail is visible). |
| [`websocket_headers`](/cua-sdk/reference/spaces/streams#spacewebsocket_headers) | Headers a media WebSocket to this Space needs besides its ticket. |
| [`window_thumbnail`](/cua-sdk/reference/spaces/space#spacewindow_thumbnail) | A small JPEG preview of one of the Space's windows (`window_id` and `epoch` from `windows`), at most `max_dimension` px, reused for a few seconds (the SDK's preview cache); `None` when the guest captured nothing. |
@@ -627,103 +627,6 @@ pub async fn set_presence_settings(&self, cursor_probe: Option<bool>) -> Result<
**Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-### `Space.share`
-
-Lets `who` (a verified email or an account id) watch (`viewer`,
-the default) or use (`editor`) this Space through the relay. A Space
-that is not a host is attached to the relay on its first share.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def share(self, who: str, role: Optional[str]) -> SpaceShares
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-share(who: string, role: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<SpaceShares>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func share(who: String, role: String?) async throws -> SpaceShares
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun share(who: String, role: String?): SpaceShares
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn share(&self, who: String, role: Option<String>) -> Result<SpaceShares, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `who` | `String` | required |
-| `role` | `Option<String>` | required |
-
-**Returns** [`SpaceShares`](#spaceshares-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
-### `Space.shares`
-
-Who this Space is shared with, and who of them is connected now.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def shares(self) -> SpaceShares
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-shares(asyncOpts_?: { signal: AbortSignal }): Promise<SpaceShares>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func shares() async throws -> SpaceShares
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun shares(): SpaceShares
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn shares(&self) -> Result<SpaceShares, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-**Returns** [`SpaceShares`](#spaceshares-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
### `Space.start_hotspot`
Starts the reverse-SOCKS hotspot: this host serves the Space's
@@ -869,56 +772,6 @@ pub fn supports(&self, feature: String) -> bool
**Returns** `bool`
-### `Space.unshare`
-
-Stops sharing this Space with `who` at once, or with everyone when
-`who` is `None`.
-
-<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>
-<Tab value="Python">
-
-```python
-async def unshare(self, who: Optional[str]) -> SpaceShares
-```
-
-</Tab>
-<Tab value="TypeScript">
-
-```ts
-unshare(who: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<SpaceShares>
-```
-
-</Tab>
-<Tab value="Swift">
-
-```swift
-func unshare(who: String?) async throws -> SpaceShares
-```
-
-</Tab>
-<Tab value="Kotlin">
-
-```kotlin
-@Throws(CuaException::class)
-suspend fun unshare(who: String?): SpaceShares
-```
-
-</Tab>
-<Tab value="Rust">
-
-```rust
-pub async fn unshare(&self, who: Option<String>) -> Result<SpaceShares, CuaError>
-```
-
-</Tab>
-</Tabs>
-
-| Parameter | Type | Default |
-| --- | --- | --- |
-| `who` | `Option<String>` | required |
-
-**Returns** [`SpaceShares`](#spaceshares-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)
-
### `Space.upload`
Copies a host file or folder to `dest` in the Space (default: the
@@ -1201,44 +1054,19 @@ Returned by [`Space.request_site_login`](#spacerequest_site_login).
| `target_id` / `targetId` | `Option<String>` | | See `session`. |
| `tab_id` / `tabId` | `Option<String>` | | See `session`. |
-## `SpaceRelayRegistration` record
-
-A Space published on the relay (`Spaces.relay_register`).
-
-Returned by [`Spaces.relay_register`](/cua-sdk/reference/spaces#spacesrelay_register).
-
-| Field | Type | Default | Description |
-| --- | --- | --- | --- |
-| `space` | `String` | | The Space. |
-| `relay_space` / `relaySpace` | `String` | | How the account's other devices reach it: `relay:<machine>`. |
-| `machine` | `String` | | The relay machine id. |
-| `url` | `String` | | The relay URL of the machine. |
-| `online` | `bool` | | Connected to the relay now. |
-
-## `SpaceShareEntry` record
-
-One account a Space is shared with.
-
-| Field | Type | Default | Description |
-| --- | --- | --- | --- |
-| `who` | `String` | | The email or account id, as shared. |
-| `role` | `String` | | `viewer` or `editor`. |
-| `connected` | `bool` | | Connected through the relay right now. |
-
-## `SpaceShares` record
-
-Who a Space is shared with.
+## `SpaceCreatingElsewhere` record
-Returned by [`Space.share`](#spaceshare), [`Space.shares`](#spaceshares), [`Space.unshare`](#spaceunshare).
+A Space another of your computers is creating (`SpaceList.creating`).
| Field | Type | Default | Description |
| --- | --- | --- | --- |
-| `space` | `String` | | The Space. |
-| `machine` | `String` | | The relay machine it is shared as (empty when not shared). |
-| `invitee_space` / `inviteeSpace` | `String` | | What the people it is shared with open (`relay:<machine>`). |
-| `url` | `String` | | The relay URL of the machine. |
-| `online` | `bool` | | The machine is on the relay now. |
-| `shares` | [`Vec<SpaceShareEntry>`](#spaceshareentry-record) | | The accounts and their roles. |
+| `machine_id` / `machineId` | `String` | | The computer's relay machine id. |
+| `machine_name` / `machineName` | `String` | | The computer's name. |
+| `name` | `String` | | The Space's name. |
+| `os` | `String` | | `macos`, `linux`, `windows`, or empty when unknown. |
+| `phase` | `String` | | The create's phase (`preparing`, `pulling`, `booting`, ...). |
+| `percent` | `u32` | | How far along the whole create is, 0 to 100. |
+| `updated_at_ms` / `updatedAtMs` | `u64` | | When the computer published it, unix ms. |
## `EgressEnforcement` enum
diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdx
index 8719431f07..f07e651e44 100644
--- a/docs/content/docs/cua-sdk/reference/types.mdx
+++ b/docs/content/docs/cua-sdk/reference/types.mdx
@@ -48,7 +48,7 @@ Renamed members: in Kotlin, objects implement `AutoCloseable`, whose `close()` f
## All items
-311 items. Methods are listed on their object.
+312 items. Methods are listed on their object.
The 10 items of Batched forks are listed on [its page](/cua-sdk/reference/sandbox/fork-batch#all-items).
@@ -292,13 +292,14 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref
| [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record) | record | Options for `Spaces.create`: the same location / kind / runtime model as sandboxes. |
| [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record) | record | What a Space create is doing (see `Spaces.create_with_progress`). |
| [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record) | record | Result of `Spaces.create`. |
+| [`SpaceCreatingElsewhere`](/cua-sdk/reference/spaces/space#spacecreatingelsewhere-record) | record | A Space another of your computers is creating (`SpaceList.creating`). |
| [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record) | record | One of a Space's displays (`Space.displays`). |
| [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record) | record | Hotspot state. |
| [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record) | record | A registered Space. |
| [`SpaceList`](/cua-sdk/reference/spaces#spacelist-record) | record | The Spaces known now (`Spaces.list_known`) and how far the read got. |
| [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record) | record | What `Spaces.stop` or `Spaces.start` did. |
| [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence) | object | A joined presence session. |
-| [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record) | record | A Space published on the relay (`Spaces.relay_register`). |
+| [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/relay-registration#spacerelayregistration-record) | record | A Space published on the relay (`Spaces.relay_register`). |
| [`SpaceResizeReport`](/cua-sdk/reference/spaces/resize#spaceresizereport-record) | record | What `Spaces.resize` did: the shape the Space has now. |
| [`Spaces`](/cua-sdk/reference/spaces#spaces) | object | The Spaces registry: add a machine by URL, provision a local one, and get `Space` handles. |
| [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods) | function | Which SDK method covers each Spaces contract tool. |
@@ -315,8 +316,8 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref
| [`SpaceSendFileOptions`](/cua-sdk/reference/spaces/space#spacesendfileoptions-record) | record | Options for `Space.send_file`. |
| [`SpaceSendFileReport`](/cua-sdk/reference/spaces/space#spacesendfilereport-record) | record | Result of `Space.send_file`. |
| [`SpaceSentFile`](/cua-sdk/reference/spaces/space#spacesentfile-record) | record | One file placed by `Space.send_file`. |
-| [`SpaceShareEntry`](/cua-sdk/reference/spaces/space#spaceshareentry-record) | record | One account a Space is shared with. |
-| [`SpaceShares`](/cua-sdk/reference/spaces/space#spaceshares-record) | record | Who a Space is shared with. |
+| [`SpaceShareEntry`](/cua-sdk/reference/spaces/sharing#spaceshareentry-record) | record | One account a Space is shared with. |
+| [`SpaceShares`](/cua-sdk/reference/spaces/sharing#spaceshares-record) | record | Who a Space is shared with. |
| [`SpacesHost`](/cua-sdk/reference/spaces/host#spaceshost-record) | record | One of your machines that provides Spaces (`Spaces.hosts`). |
| [`SpacesHostLimit`](/cua-sdk/reference/spaces/host#spaceshostlimit-record) | record | One limit of a host that provides Spaces and how much of it is used. |
| [`SpacesHostLoad`](/cua-sdk/reference/spaces/host#spaceshostload-record) | record | How busy one of your machines is (its job runner's view). |
diff --git a/libs/cua/crates/cua-daemon/src/spaces_svc.rs b/libs/cua/crates/cua-daemon/src/spaces_svc.rs
index 8169654f7b..a0519a0271 100644
--- a/libs/cua/crates/cua-daemon/src/spaces_svc.rs
+++ b/libs/cua/crates/cua-daemon/src/spaces_svc.rs
@@ -350,16 +350,16 @@ mod imp {
// Plus the signed-in account's relay machines: refreshed, or
// (`known_now`) as far as they answered, never holding up this
// machine's own Spaces.
- let (others, progress) = if known_now {
+ let (others, progress, creating) = if known_now {
let l = self
.spaces()
.list_known(cua_spaces::LIST_WAIT)
.await
.map_err(|e| st(e.into()))?;
- (l.spaces, l.progress)
+ (l.spaces, l.progress, l.creating)
} else {
let all = self.spaces().list_all().await.map_err(|e| st(e.into()))?;
- (all, cua_spaces::ListProgress::default())
+ (all, cua_spaces::ListProgress::default(), Vec::new())
};
for info in others {
if info.provider == cua_spaces::Provider::Relay
@@ -374,6 +374,18 @@ mod imp {
reaching: progress.reaching,
stale: progress.stale,
notice: progress.notice,
+ creating: creating
+ .into_iter()
+ .map(|c| pb::CreatingSpace {
+ machine_id: c.machine_id,
+ machine_name: c.machine_name,
+ name: c.name,
+ os: c.os,
+ phase: c.phase,
+ percent: u32::from(c.percent),
+ updated_at_ms: c.updated_at_ms,
+ })
+ .collect(),
})
}
diff --git a/libs/cua/crates/cua-sdk/src/native/spaces.rs b/libs/cua/crates/cua-sdk/src/native/spaces.rs
index ece2ae0f23..e5c8134956 100644
--- a/libs/cua/crates/cua-sdk/src/native/spaces.rs
+++ b/libs/cua/crates/cua-sdk/src/native/spaces.rs
@@ -285,6 +285,28 @@ pub struct SpaceList {
pub stale: bool,
/// Why the account's computers could not be read, when they could not.
pub notice: String,
+ /// Spaces your other computers are creating now, from what each
+ /// published through the relay (empty from a daemon that predates it).
+ pub creating: Vec<SpaceCreatingElsewhere>,
+}
+
+/// A Space another of your computers is creating ([`SpaceList::creating`]).
+#[derive(Debug, Clone, Default, PartialEq, Eq, uniffi::Record)]
+pub struct SpaceCreatingElsewhere {
+ /// The computer's relay machine id.
+ pub machine_id: String,
+ /// The computer's name.
+ pub machine_name: String,
+ /// The Space's name.
+ pub name: String,
+ /// `macos`, `linux`, `windows`, or empty when unknown.
+ pub os: String,
+ /// The create's phase (`preparing`, `pulling`, `booting`, ...).
+ pub phase: String,
+ /// How far along the whole create is, 0 to 100.
+ pub percent: u32,
+ /// When the computer published it, unix ms.
+ pub updated_at_ms: u64,
}
/// A registered Space.
@@ -2939,6 +2961,19 @@ impl Spaces {
reaching: l.progress.reaching,
stale: l.progress.stale,
notice: l.progress.notice,
+ creating: l
+ .creating
+ .into_iter()
+ .map(|c| SpaceCreatingElsewhere {
+ machine_id: c.machine_id,
+ machine_name: c.machine_name,
+ name: c.name,
+ os: c.os,
+ phase: c.phase,
+ percent: u32::from(c.percent),
+ updated_at_ms: c.updated_at_ms,
+ })
+ .collect(),
})
}
Host::Daemon(d) => {
@@ -2954,6 +2989,19 @@ impl Spaces {
reaching: r.reaching,
stale: r.stale,
notice: r.notice,
+ creating: r
+ .creating
+ .into_iter()
+ .map(|c| SpaceCreatingElsewhere {
+ machine_id: c.machine_id,
+ machine_name: c.machine_name,
+ name: c.name,
+ os: c.os,
+ phase: c.phase,
+ percent: c.percent.min(100),
+ updated_at_ms: c.updated_at_ms,
+ })
+ .collect(),
})
}
}
diff --git a/libs/cua/crates/cua-spaces/src/elastic.rs b/libs/cua/crates/cua-spaces/src/elastic.rs
index 5ef6bce162..6ad07e37e0 100644
--- a/libs/cua/crates/cua-spaces/src/elastic.rs
+++ b/libs/cua/crates/cua-spaces/src/elastic.rs
@@ -523,7 +523,7 @@ fn default_linux_image() -> String {
/// The guest OS of `image`: the catalog's word, else `windows` for a name
/// that says so, else `linux`.
-fn guest_os(image: &str) -> String {
+pub(crate) fn guest_os(image: &str) -> String {
if let Some(os) = cua_image::catalog::catalog_os(image).filter(|o| !o.is_empty()) {
return os;
}
diff --git a/libs/cua/crates/cua-spaces/src/listing.rs b/libs/cua/crates/cua-spaces/src/listing.rs
index e11b772023..827aab9ed1 100644
--- a/libs/cua/crates/cua-spaces/src/listing.rs
+++ b/libs/cua/crates/cua-spaces/src/listing.rs
@@ -53,6 +53,9 @@ pub struct ListProgress {
pub struct SpaceListing {
pub spaces: Vec<SpaceInfo>,
pub progress: ListProgress,
+ /// Spaces your other computers are creating now
+ /// ([`Spaces::creating_elsewhere`]).
+ pub creating: Vec<crate::resources::creates::CreatingElsewhere>,
}
/// How a read of the account's computers ended.
@@ -187,7 +190,11 @@ impl Spaces {
notice: why,
},
};
- Ok(SpaceListing { spaces, progress })
+ Ok(SpaceListing {
+ spaces,
+ progress,
+ creating: self.creating_elsewhere(),
+ })
}
/// The account's computers the directory last listed, other than this
diff --git a/libs/cua/crates/cua-spaces/src/resources/creates.rs b/libs/cua/crates/cua-spaces/src/resources/creates.rs
new file mode 100644
index 0000000000..6b88a78e0a
--- /dev/null
+++ b/libs/cua/crates/cua-spaces/src/resources/creates.rs
@@ -0,0 +1,625 @@
+//! The Spaces this computer is creating, published through its relay
+//! machine record next to its [`summary`](super::summary), so your other
+//! computers show "Creating macOS on Mac mini… 40%" while it happens
+//! (CUA-2349).
+//!
+//! One `meta` key, [`META_KEY`], holds compact JSON of at most
+//! [`MAX_LEN`] characters (the relay's value limit):
+//! `{"v":1,"t":<unix s>,"s":[[name,os,phase,percent],...]}`, at most
+//! [`MAX_SHOWN`] Spaces, names cut to [`NAME_CHARS`]. No ids, paths, images
+//! or tokens. The key is cleared (an empty value) when nothing is being
+//! created.
+//!
+//! The daemon publishes at once when a create starts, when its phase
+//! changes, when it finishes or fails, and when its percent moved by
+//! [`PERCENT_STEP`] or [`PERCENT_EVERY`] passed; and again every
+//! [`HEARTBEAT`] while one runs. A reader drops a value older than
+//! [`STALE_AFTER`]: a computer that stopped mid-create (its daemon crashed)
+//! does not show a Space being created forever.
+//!
+//! The relay shows a machine's `meta` to everyone who can see the machine,
+//! so people a computer is shared with see its creates too.
+
+use super::summary::MAX_LEN;
+use cua_sandbox_core::progress::{Phase, Progress};
+use serde::{Deserialize, Serialize};
+use std::collections::BTreeMap;
+use std::sync::Mutex;
+use std::time::{Duration, Instant};
+use tokio::sync::Notify;
+
+/// The relay machine meta key.
+pub const META_KEY: &str = "cua.new";
+/// The format.
+pub const VERSION: u32 = 1;
+/// At most this many Spaces are published (the rest are left out).
+pub const MAX_SHOWN: usize = 4;
+/// A name longer than this is cut.
+pub const NAME_CHARS: usize = 32;
+/// A published value older than this is ignored.
+pub const STALE_AFTER: Duration = Duration::from_secs(120);
+/// While a create runs, published again at least this often.
+pub const HEARTBEAT: Duration = Duration::from_secs(60);
+/// A percent change this big publishes at once ...
+pub const PERCENT_STEP: u8 = 10;
+/// ... any other once this long passed since the last publish.
+pub const PERCENT_EVERY: Duration = Duration::from_secs(5);
+
+/// One Space being created, as published.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub struct Creating {
+ /// Its name.
+ pub name: String,
+ /// `macos`, `linux`, `windows`, or empty when unknown.
+ pub os: String,
+ /// The create's phase ([`Phase::as_str`]).
+ pub phase: String,
+ /// How far along the whole create is, 0 to 100.
+ pub percent: u8,
+}
+
+/// A Space another of your computers is creating.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CreatingElsewhere {
+ /// The computer's relay machine id.
+ pub machine_id: String,
+ /// The computer's name.
+ pub machine_name: String,
+ /// The Space's name.
+ pub name: String,
+ /// `macos`, `linux`, `windows`, or empty when unknown.
+ pub os: String,
+ /// The create's phase ([`Phase::as_str`]).
+ pub phase: String,
+ /// How far along the whole create is, 0 to 100.
+ pub percent: u8,
+ /// When the computer published it, unix ms.
+ pub updated_at_ms: u64,
+}
+
+#[derive(Serialize, Deserialize)]
+struct Wire {
+ v: u32,
+ /// Published at, unix seconds.
+ t: u64,
+ /// `[name, os, phase, percent]` each.
+ s: Vec<(String, String, String, u8)>,
+}
+
+/// `creates` (at `at_secs`) as the value of [`META_KEY`]: empty when there
+/// are none (which clears the key). At most [`MAX_SHOWN`], as many as fit
+/// in [`MAX_LEN`].
+pub fn encode(creates: &[Creating], at_secs: u64) -> String {
+ if creates.is_empty() {
+ return String::new();
+ }
+ let mut wire = Wire {
+ v: VERSION,
+ t: at_secs,
+ s: Vec::new(),
+ };
+ let mut out = String::new();
+ for c in creates.iter().take(MAX_SHOWN) {
+ let name: String = c
+ .name
+ .chars()
+ .filter(|ch| !ch.is_control())
+ .take(NAME_CHARS)
+ .collect();
+ let os: String =
+ c.os.chars()
+ .filter(char::is_ascii_alphanumeric)
+ .take(12)
+ .collect();
+ let phase: String = c
+ .phase
+ .chars()
+ .filter(|ch| ch.is_ascii_alphanumeric() || *ch == '_')
+ .take(24)
+ .collect();
+ wire.s.push((name, os, phase, c.percent.min(100)));
+ let next = serde_json::to_string(&wire).expect("strings and numbers serialize");
+ if next.chars().count() > MAX_LEN {
+ wire.s.pop();
+ break;
+ }
+ out = next;
+ }
+ out
+}
+
+/// The Spaces the computer `machine_id` named `machine_name` published as
+/// being created, or none for text that is not a value of a version this
+/// build knows, or one older than [`STALE_AFTER`] at `now_ms`.
+pub fn decode(
+ machine_id: &str,
+ machine_name: &str,
+ value: &str,
+ now_ms: u64,
+) -> Vec<CreatingElsewhere> {
+ let Ok(w) = serde_json::from_str::<Wire>(value) else {
+ return Vec::new();
+ };
+ let at_ms = w.t.saturating_mul(1000);
+ if w.v != VERSION || now_ms.saturating_sub(at_ms) > STALE_AFTER.as_millis() as u64 {
+ return Vec::new();
+ }
+ w.s.into_iter()
+ .take(MAX_SHOWN)
+ .filter(|(name, ..)| !name.is_empty())
+ .map(|(name, os, phase, percent)| CreatingElsewhere {
+ machine_id: machine_id.into(),
+ machine_name: machine_name.into(),
+ name,
+ os,
+ phase,
+ percent: percent.min(100),
+ updated_at_ms: at_ms,
+ })
+ .collect()
+}
+
+/// How far along a whole create is at `p`, 0 to 99 (100 is ready): each
+/// phase has a band, and a download moves through its own by how much is
+/// done.
+pub fn percent(p: &Progress) -> u8 {
+ let (from, to) = match p.phase {
+ Phase::Preparing => (0, 5),
+ Phase::Pulling => (5, 60),
+ Phase::Creating => (60, 70),
+ Phase::Booting => (70, 85),
+ Phase::WaitingForServices => (85, 95),
+ Phase::Connecting => (95, 99),
+ Phase::Ready => return 100,
+ };
+ let fraction = p.fraction.or_else(|| {
+ p.bytes
+ .filter(|b| b.total > 0)
+ .map(|b| b.done as f64 / b.total as f64)
+ });
+ let within = fraction.unwrap_or(0.0).clamp(0.0, 1.0);
+ (f64::from(from) + f64::from(to - from) * within).floor() as u8
+}
+
+struct Entry {
+ creating: Creating,
+ /// The percent last published, and when.
+ published: Option<(u8, Instant)>,
+}
+
+/// The creates running on this computer (one per runtime), and the signal
+/// that wakes the publisher.
+#[derive(Default)]
+pub(crate) struct Board {
+ entries: Mutex<BTreeMap<String, Entry>>,
+ wake: Notify,
+}
+
+impl Board {
+ /// A create of `name` (`os`) started under the key `id`: published at once.
+ pub(crate) fn start(&self, id: &str, name: &str, os: &str) {
+ let creating = Creating {
+ name: name.into(),
+ os: os.into(),
+ phase: Phase::Preparing.as_str().into(),
+ percent: 0,
+ };
+ self.entries.lock().expect("creates").insert(
+ id.into(),
+ Entry {
+ creating,
+ published: None,
+ },
+ );
+ self.wake.notify_one();
+ }
+
+ /// The create `id` reported `p`. Wakes the publisher when the phase
+ /// changed, or the percent moved by [`PERCENT_STEP`], or by anything
+ /// once [`PERCENT_EVERY`] passed since the last publish.
+ pub(crate) fn report(&self, id: &str, p: &Progress) {
+ if p.phase == Phase::Ready {
+ return;
+ }
+ let mut entries = self.entries.lock().expect("creates");
+ let Some(e) = entries.get_mut(id) else { return };
+ let phase = p.phase.as_str();
+ let pct = percent(p).max(if e.creating.phase == phase {
+ e.creating.percent
+ } else {
+ 0
+ });
+ let phase_changed = e.creating.phase != phase;
+ e.creating.phase = phase.into();
+ e.creating.percent = pct;
+ let due = phase_changed
+ || match e.published {
+ None => true,
+ Some((last, at)) => {
+ pct >= last.saturating_add(PERCENT_STEP)
+ || (pct != last && at.elapsed() >= PERCENT_EVERY)
+ }
+ };
+ drop(entries);
+ if due {
+ self.wake.notify_one();
+ }
+ }
+
+ /// The create `id` finished or failed: it leaves the list at once.
+ pub(crate) fn finish(&self, id: &str) {
+ if self.entries.lock().expect("creates").remove(id).is_some() {
+ self.wake.notify_one();
+ }
+ }
+
+ /// What to publish now, oldest first; marks each as published.
+ pub(crate) fn take(&self) -> Vec<Creating> {
+ let now = Instant::now();
+ let mut entries = self.entries.lock().expect("creates");
+ entries
+ .values_mut()
+ .map(|e| {
+ e.published = Some((e.creating.percent, now));
+ e.creating.clone()
+ })
+ .collect()
+ }
+
+ /// Whether a create runs (the publisher keeps a heartbeat while one does).
+ pub(crate) fn busy(&self) -> bool {
+ !self.entries.lock().expect("creates").is_empty()
+ }
+
+ /// Waits until something should be published.
+ pub(crate) async fn changed(&self) {
+ self.wake.notified().await
+ }
+}
+
+/// Removes a create from the [`Board`] when dropped: a create that returns,
+/// fails, is cancelled or is dropped leaves the list.
+pub(crate) struct OnBoard {
+ pub(crate) board: std::sync::Arc<super::Hub>,
+ pub(crate) id: String,
+}
+
+impl Drop for OnBoard {
+ fn drop(&mut self) {
+ self.board.creates.finish(&self.id);
+ }
+}
+
+impl crate::Spaces {
+ /// The Spaces your other computers are creating, from what each
+ /// published in its relay machine record ([`decode`]). Reads the
+ /// machine list already fetched: no relay call of its own. A Space the
+ /// list already has as a row (one a computer makes for this device,
+ /// listed under it from the start) is left out.
+ pub fn creating_elsewhere(&self) -> Vec<CreatingElsewhere> {
+ let own = self.this_relay_machine_id();
+ let listed = self.list().unwrap_or_default();
+ let now = super::now_ms();
+ let cache = self.inner.relay_cache.lock().expect("relay cache");
+ cache
+ .iter()
+ .filter(|m| own.as_deref() != Some(m.id.as_str()))
+ .filter_map(|m| Some((m, m.meta.get(META_KEY)?)))
+ .flat_map(|(m, value)| decode(&m.id, &m.name, value, now))
+ .filter(|c| {
+ !listed
+ .iter()
+ .any(|i| i.host == c.machine_id && i.name == c.name)
+ })
+ .collect()
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn c(name: &str, os: &str, phase: &str, percent: u8) -> Creating {
+ Creating {
+ name: name.into(),
+ os: os.into(),
+ phase: phase.into(),
+ percent,
+ }
+ }
+
+ #[test]
+ fn a_value_round_trips() {
+ let now = 1_760_000_000u64;
+ let s = encode(&[c("design-review", "macos", "pulling", 40)], now);
+ let back = decode("m-1", "Mac mini", &s, now * 1000 + 3_000);
+ assert_eq!(
+ back,
+ vec![CreatingElsewhere {
+ machine_id: "m-1".into(),
+ machine_name: "Mac mini".into(),
+ name: "design-review".into(),
+ os: "macos".into(),
+ phase: "pulling".into(),
+ percent: 40,
+ updated_at_ms: now * 1000,
+ }]
+ );
+ }
+
+ #[test]
+ fn nothing_being_created_clears_the_key() {
+ assert_eq!(encode(&[], 1), "");
+ assert!(decode("m", "", "", 0).is_empty());
+ }
+
+ #[test]
+ fn the_largest_value_fits_the_relay_limit() {
+ let long = "x".repeat(200);
+ let many: Vec<Creating> = (0..20)
+ .map(|_| c(&long, "windows", "waiting_for_services", 100))
+ .collect();
+ let s = encode(&many, u64::MAX);
+ assert!(!s.is_empty());
+ assert!(
+ s.chars().count() <= MAX_LEN,
+ "{} chars: {s}",
+ s.chars().count()
+ );
+ assert!(s.chars().all(|ch| !ch.is_control()));
+ // Names are cut, and only what fits is kept.
+ let back = decode("m", "", &s, u64::MAX);
+ assert!(
+ !back.is_empty() && back.len() <= MAX_SHOWN,
+ "{}",
+ back.len()
+ );
+ assert!(back.iter().all(|b| b.name.chars().count() == NAME_CHARS));
+ }
+
+ #[test]
+ fn a_value_with_quotes_and_unicode_still_fits() {
+ let odd = "\"é\\".repeat(40);
+ let four: Vec<Creating> = (0..4).map(|_| c(&odd, "macos", "booting", 70)).collect();
+ let s = encode(&four, 1_760_000_000);
+ assert!(s.chars().count() <= MAX_LEN, "{} chars", s.chars().count());
+ assert!(!decode("m", "", &s, 1_760_000_000_000).is_empty());
+ }
+
+ #[test]
+ fn at_most_max_shown_are_published() {
+ let many: Vec<Creating> = (0..9)
+ .map(|i| c(&format!("s{i}"), "linux", "booting", 70))
+ .collect();
+ let back = decode("m", "", &encode(&many, 10), 10_000);
+ assert_eq!(back.len(), MAX_SHOWN);
+ assert_eq!(back[0].name, "s0");
+ }
+
+ #[test]
+ fn a_stale_value_is_ignored() {
+ let s = encode(&[c("a", "linux", "booting", 70)], 1_000);
+ assert_eq!(decode("m", "", &s, 1_000_000 + 119_000).len(), 1);
+ assert!(decode("m", "", &s, 1_000_000 + 121_000).is_empty());
+ }
+
+ #[test]
+ fn text_that_is_not_a_known_value_is_ignored() {
+ assert!(decode("m", "", "not json", 0).is_empty());
+ assert!(
+ decode(
+ "m",
+ "",
+ r#"{"v":99,"t":0,"s":[["a","linux","booting",1]]}"#,
+ 0
+ )
+ .is_empty()
+ );
+ }
+
+ #[test]
+ fn percent_moves_through_each_phase() {
+ let p = |phase| Progress::phase(phase);
+ assert_eq!(percent(&p(Phase::Preparing)), 0);
+ assert_eq!(percent(&p(Phase::Pulling).fraction(0.5)), 32);
+ assert_eq!(percent(&p(Phase::Booting)), 70);
+ assert_eq!(percent(&p(Phase::Connecting)), 95);
+ assert_eq!(percent(&p(Phase::Ready)), 100);
+ }
+
+ #[test]
+ fn the_board_wakes_on_start_phase_and_finish_and_throttles_percent() {
+ let rt = tokio::runtime::Builder::new_current_thread()
+ .enable_time()
+ .build()
+ .unwrap();
+ rt.block_on(async {
+ let board = Board::default();
+ let woke = |b: &Board| {
+ let fut = b.changed();
+ futures_util::FutureExt::now_or_never(Box::pin(fut)).is_some()
+ };
+ board.start("local:a", "a", "macos");
+ assert!(woke(&board), "a start publishes at once");
+ assert_eq!(board.take()[0].phase, "preparing");
+ board.report("local:a", &Progress::phase(Phase::Pulling).fraction(0.01));
+ assert!(woke(&board), "a phase change publishes at once");
+ assert_eq!(board.take()[0].percent, 5);
+ board.report("local:a", &Progress::phase(Phase::Pulling).fraction(0.05));
+ assert!(!woke(&board), "a small move waits");
+ board.report("local:a", &Progress::phase(Phase::Pulling).fraction(0.3));
+ assert!(woke(&board), "ten points publish at once");
+ board.take();
+ board.finish("local:a");
+ assert!(woke(&board), "a finish publishes at once");
+ assert!(!board.busy());
+ assert!(board.take().is_empty());
+ });
+ }
+}
+
+#[cfg(test)]
+mod publish_tests {
+ //! The daemon's publisher against a relay (`cua_host::testing::FakeRelay`):
+ //! a create is published at once, and so is a new Space count.
+
+ use super::*;
+ use crate::resources::summary;
+ use crate::{RelayAccount, Spaces};
+ use cua_host::testing::FakeRelay;
+ use std::sync::Arc;
+
+ const MACHINE: &str = "aaaa000000000002";
+
+ async fn host(relay: &FakeRelay, home: &std::path::Path) -> Spaces {
+ relay.add_account("owner-token", "user-1", Some("[email protected]"));
+ cua_host::RelayClient::new(&relay.url)
+ .unwrap()
+ .register(
+ "owner-token",
+ &cua_host::relay::RegisterRequest {
+ id: MACHINE.into(),
+ name: "Mac mini".into(),
+ allow: vec![],
+ host: None,
+ meta: Default::default(),
+ },
+ )
+ .await
+ .unwrap();
+ std::fs::create_dir_all(home.join("host")).unwrap();
+ std::fs::write(
+ home.join("host/config.json"),
+ serde_json::json!({
+ "mode": "relay",
+ "name": "Mac mini",
+ "machine_id": MACHINE,
+ "runner": "process",
+ "driver_bin": "/nonexistent/cua-spacesd",
+ })
+ .to_string(),
+ )
+ .unwrap();
+ Spaces::builder()
+ .home(home)
+ .relay(RelayAccount::new(
+ &relay.url,
+ Arc::new(crate::relay::StaticToken("owner-token".into())),
+ ))
+ .build()
+ }
+
+ /// Waits (up to `secs`) for the machine's meta to satisfy `ok`.
+ async fn until(
+ relay: &FakeRelay,
+ secs: u64,
+ ok: impl Fn(&std::collections::BTreeMap<String, String>) -> bool,
+ ) -> bool {
+ let end = Instant::now() + Duration::from_secs(secs);
+ while Instant::now() < end {
+ if ok(&relay.machine(MACHINE).unwrap().meta) {
+ return true;
+ }
+ tokio::time::sleep(Duration::from_millis(100)).await;
+ }
+ false
+ }
+
+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
+ async fn a_create_is_published_at_once_and_cleared_when_it_ends() {
+ let relay = FakeRelay::start().await;
+ let home = tempfile::tempdir().unwrap();
+ let spaces = host(&relay, home.path()).await;
+ let _publisher = spaces.spawn_resources_publisher();
+ let hub = spaces.inner.resources.clone();
+
+ // Long before the first timed publish (20 s after start).
+ hub.creates
+ .start("local:design-review", "design-review", "macos");
+ assert!(
+ until(&relay, 5, |m| m
+ .get(META_KEY)
+ .is_some_and(|v| v.contains("design-review")))
+ .await,
+ "the create was not published at once"
+ );
+ // The phase moved on: published again at once.
+ hub.creates
+ .report("local:design-review", &Progress::phase(Phase::Booting));
+ assert!(
+ until(&relay, 5, |m| m
+ .get(META_KEY)
+ .is_some_and(|v| v.contains("booting")))
+ .await
+ );
+
+ // Another device reads it from the machine list.
+ let laptop_home = tempfile::tempdir().unwrap();
+ let laptop = Spaces::builder()
+ .home(laptop_home.path())
+ .relay(RelayAccount::new(
+ &relay.url,
+ Arc::new(crate::relay::StaticToken("owner-token".into())),
+ ))
+ .build();
+ laptop.relay_machines().await.unwrap();
+ let seen = laptop.creating_elsewhere();
+ assert_eq!(seen.len(), 1, "{seen:?}");
+ assert_eq!(
+ (
+ seen[0].machine_name.as_str(),
+ seen[0].name.as_str(),
+ seen[0].os.as_str()
+ ),
+ ("Mac mini", "design-review", "macos")
+ );
+ assert_eq!(seen[0].percent, 70);
+ // The computer creating it does not list its own create as elsewhere.
+ spaces.relay_machines().await.unwrap();
+ assert!(spaces.creating_elsewhere().is_empty());
+
+ // Finished: the key goes at once.
+ hub.creates.finish("local:design-review");
+ assert!(until(&relay, 5, |m| !m.contains_key(META_KEY)).await);
+ laptop.relay_machines().await.unwrap();
+ assert!(laptop.creating_elsewhere().is_empty());
+ }
+
+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
+ async fn a_new_space_count_is_published_without_waiting_for_the_timer() {
+ let relay = FakeRelay::start().await;
+ let home = tempfile::tempdir().unwrap();
+ let spaces = host(&relay, home.path()).await;
+ let _publisher = spaces.spawn_resources_publisher();
+ // A first publish (a create that came and went).
+ let hub = spaces.inner.resources.clone();
+ hub.creates.start("local:a", "a", "linux");
+ hub.creates.finish("local:a");
+ let count = |m: &std::collections::BTreeMap<String, String>| {
+ m.get(summary::META_KEY)
+ .and_then(|v| summary::decode(MACHINE, "", true, v))
+ .map(|c| c.spaces_count)
+ };
+ assert!(until(&relay, 5, |m| count(m) == Some(0)).await);
+
+ // A Space appears in the registry: published well before the
+ // five-minute interval.
+ spaces
+ .registry()
+ .upsert(
+ cua_proto::daemon::v1::Space {
+ id: "local:a".into(),
+ name: "a".into(),
+ os: "linux".into(),
+ ..Default::default()
+ },
+ Default::default(),
+ )
+ .unwrap();
+ assert!(
+ until(&relay, 20, |m| count(m) == Some(1)).await,
+ "the new count was not published"
+ );
+ }
+}
diff --git a/libs/cua/crates/cua-spaces/src/resources/hub.rs b/libs/cua/crates/cua-spaces/src/resources/hub.rs
index dbdf6664bf..96a44bc72a 100644
--- a/libs/cua/crates/cua-spaces/src/resources/hub.rs
+++ b/libs/cua/crates/cua-spaces/src/resources/hub.rs
@@ -49,6 +49,9 @@ pub(crate) struct Hub {
wake: Notify,
tx: watch::Sender<Option<Arc<Resources>>>,
sampler: tokio::sync::Mutex<Sampler>,
+ /// The Spaces being created here, for the relay summary
+ /// ([`super::creates`]).
+ pub(crate) creates: super::creates::Board,
}
#[derive(Default)]
@@ -108,6 +111,7 @@ impl Hub {
wake: Notify::new(),
tx: watch::channel(None).0,
sampler: tokio::sync::Mutex::new(Sampler::new()),
+ creates: Default::default(),
})
}
diff --git a/libs/cua/crates/cua-spaces/src/resources/mod.rs b/libs/cua/crates/cua-spaces/src/resources/mod.rs
index 2e9f56ea94..d8d52a9561 100644
--- a/libs/cua/crates/cua-spaces/src/resources/mod.rs
+++ b/libs/cua/crates/cua-spaces/src/resources/mod.rs
@@ -22,6 +22,7 @@
use serde::{Deserialize, Serialize};
use std::time::Duration;
+pub mod creates;
pub mod disk;
pub mod host;
mod hub;
diff --git a/libs/cua/crates/cua-spaces/src/resources/publish.rs b/libs/cua/crates/cua-spaces/src/resources/publish.rs
index a413d08fc4..d245ae9757 100644
--- a/libs/cua/crates/cua-spaces/src/resources/publish.rs
+++ b/libs/cua/crates/cua-spaces/src/resources/publish.rs
@@ -5,10 +5,15 @@
//! Rates: once a minute while someone is connected to the machine
//! ([`summary::WATCHED_EVERY`]; the relay's answer to each publish says who
//! is), every five minutes otherwise ([`summary::IDLE_EVERY`]), and at once
-//! when the low-disk level changes. A relay that predates summaries drops
-//! the key; the publisher then tries again only hourly.
+//! when the low-disk level or the number of Spaces changes. A relay that
+//! predates summaries drops the key; the publisher then tries again only
+//! hourly.
+//!
+//! The same publish carries the Spaces being created here ([`creates`]): at
+//! once when one starts, changes phase, moves on, finishes or fails, and
+//! every [`creates::HEARTBEAT`] while one runs.
-use super::{ResourcesEvent, summary};
+use super::{ResourcesEvent, creates, summary};
use crate::{Result, Spaces};
use std::collections::BTreeMap;
use std::sync::Arc;
@@ -19,6 +24,9 @@ use std::time::{Duration, Instant};
const FIRST_PUBLISH_DELAY: Duration = Duration::from_secs(20);
/// How long a relay that dropped the summary is left alone.
const UNSUPPORTED_BACKOFF: Duration = Duration::from_secs(3600);
+/// How often the number of this computer's Spaces is compared with the one
+/// last published (a local read).
+const COUNT_EVERY: Duration = Duration::from_secs(5);
/// What a publish did.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -32,6 +40,8 @@ pub enum Published {
Sent {
/// Clients connected to this machine.
watchers: usize,
+ /// The number of Spaces it published.
+ spaces: u32,
},
}
@@ -44,6 +54,8 @@ impl Spaces {
};
let snapshot = self.resources(false).await?;
let value = summary::encode(&snapshot.this_mac);
+ // An empty value clears the key: nothing is being created here.
+ let making = creates::encode(&self.inner.resources.creates.take(), super::now_ms() / 1000);
let token = relay.tokens.access_token().await?;
let client = relay.client().await?;
let reply = client
@@ -51,10 +63,10 @@ impl Spaces {
&token,
&machine,
&cua_host::MachinePatch {
- meta: Some(BTreeMap::from([(
- summary::META_KEY.to_string(),
- value.clone(),
- )])),
+ meta: Some(BTreeMap::from([
+ (summary::META_KEY.to_string(), value.clone()),
+ (creates::META_KEY.to_string(), making),
+ ])),
..Default::default()
},
)
@@ -64,9 +76,22 @@ impl Spaces {
}
Ok(Published::Sent {
watchers: reply.clients.len(),
+ spaces: snapshot.this_mac.spaces_count,
})
}
+ /// How many of this computer's own Spaces the registry lists now (what
+ /// the summary counts).
+ fn own_space_count(&self) -> u32 {
+ let n = self
+ .list()
+ .unwrap_or_default()
+ .iter()
+ .filter(|i| i.id.starts_with("local:") && i.host.is_empty())
+ .count();
+ u32::try_from(n).unwrap_or(u32::MAX)
+ }
+
/// Keeps this computer's summary published until the runtime is
/// dropped (the daemon starts it once). The task is also a hidden
/// watcher, which is what keeps the sampler running every five minutes
@@ -76,7 +101,13 @@ impl Spaces {
let mut watch = self.watch_resources(false);
tokio::spawn(async move {
let mut next = Instant::now() + FIRST_PUBLISH_DELAY;
+ // What the last publish said, until the first one went out.
+ let mut published: Option<u32> = None;
+ let mut count_at = Instant::now() + COUNT_EVERY;
loop {
+ let Some(hub) = weak.upgrade().map(|i| i.resources.clone()) else {
+ return;
+ };
tokio::select! {
event = watch.next() => match event {
None => return,
@@ -84,11 +115,26 @@ impl Spaces {
Some(ResourcesEvent::LowDisk(_)) => next = Instant::now(),
Some(_) => {}
},
+ // A create started, moved on or ended: at once.
+ _ = hub.creates.changed() => next = Instant::now(),
+ _ = tokio::time::sleep_until(count_at.into()) => {
+ count_at = Instant::now() + COUNT_EVERY;
+ let Some(inner) = weak.upgrade() else { return };
+ let spaces = Spaces { inner };
+ // A Space was added or removed: at once (after the
+ // first publish, which is due anyway).
+ if published.is_some_and(|n| n != spaces.own_space_count()) {
+ next = Instant::now();
+ }
+ }
_ = tokio::time::sleep_until(next.into()) => {
let Some(inner) = weak.upgrade() else { return };
let spaces = Spaces { inner };
let wait = match spaces.publish_resources().await {
- Ok(Published::Sent { watchers }) if watchers > 0 => summary::WATCHED_EVERY,
+ Ok(Published::Sent { watchers, spaces: n }) => {
+ published = Some(n);
+ if watchers > 0 { summary::WATCHED_EVERY } else { summary::IDLE_EVERY }
+ }
Ok(Published::Unsupported) => UNSUPPORTED_BACKOFF,
Ok(_) => summary::IDLE_EVERY,
Err(e) => {
@@ -96,6 +142,8 @@ impl Spaces {
summary::IDLE_EVERY
}
};
+ // While a create runs, its progress stays fresh.
+ let wait = if hub.creates.busy() { wait.min(creates::HEARTBEAT) } else { wait };
next = Instant::now() + wait;
}
}
diff --git a/libs/cua/crates/cua-spaces/src/spaces.rs b/libs/cua/crates/cua-spaces/src/spaces.rs
index a9d62adf9f..5b9ea25f1b 100644
--- a/libs/cua/crates/cua-spaces/src/spaces.rs
+++ b/libs/cua/crates/cua-spaces/src/spaces.rs
@@ -2368,9 +2368,38 @@ impl Spaces {
spaces: self.clone(),
journal: Some(journal.clone()),
};
- cua_sandbox_core::progress::report(cua_sandbox_core::progress::Progress::phase(
- cua_sandbox_core::progress::Phase::Preparing,
- ));
+ // A Space made on this computer shows on your other computers while
+ // it is created ([`crate::resources::creates`]): it leaves the list
+ // when this returns, fails, is cancelled or is dropped.
+ let on_board = (kind == "local").then(|| {
+ let hub = self.inner.resources.clone();
+ let os = opts
+ .image
+ .as_deref()
+ .map(crate::elastic::guest_os)
+ .unwrap_or_default();
+ hub.creates.start(&key.id, &key.name, &os);
+ crate::resources::creates::OnBoard {
+ board: hub,
+ id: key.id.clone(),
+ }
+ });
+ let outer = cua_sandbox_core::progress::current();
+ let sink: Option<cua_sandbox_core::progress::Sink> = on_board.as_ref().map(|b| {
+ let (hub, id) = (b.board.clone(), b.id.clone());
+ Arc::new(move |p: &CreateProgress| {
+ hub.creates.report(&id, p);
+ if let Some(outer) = &outer {
+ outer(p);
+ }
+ }) as cua_sandbox_core::progress::Sink
+ });
+ cua_sandbox_core::progress::carry(sink.clone(), async {
+ cua_sandbox_core::progress::report(cua_sandbox_core::progress::Progress::phase(
+ cua_sandbox_core::progress::Phase::Preparing,
+ ));
+ })
+ .await;
let wants_volumes = !opts.volumes.is_empty();
let volumes = opts.volumes.clone();
let run = Box::pin(crate::creating::scope(
@@ -2414,6 +2443,7 @@ impl Spaces {
})
}),
));
+ let run = cua_sandbox_core::progress::carry(sink, run);
let result = tokio::select! {
r = run => r,
_ = flight.cancelled() => {
diff --git a/libs/cua/crates/cua-spaces/tests/resources_publish.rs b/libs/cua/crates/cua-spaces/tests/resources_publish.rs
index 20023f01bf..f8f5e717f3 100644
--- a/libs/cua/crates/cua-spaces/tests/resources_publish.rs
+++ b/libs/cua/crates/cua-spaces/tests/resources_publish.rs
@@ -58,10 +58,18 @@ async fn a_host_publishes_numbers_into_its_machine_record() {
let spaces = host(&relay, home.path()).await;
let out = spaces.publish_resources().await.unwrap();
- assert_eq!(out, Published::Sent { watchers: 0 });
+ assert_eq!(
+ out,
+ Published::Sent {
+ watchers: 0,
+ spaces: 0
+ }
+ );
let meta = relay.machine(MACHINE).unwrap().meta;
- // What registration set stays; the summary joins it.
+ // What registration set stays; the summary joins it. Nothing is being
+ // created: no creates key.
assert_eq!(meta["cua.host.os"], "macos");
+ assert!(!meta.contains_key(cua_spaces::resources::creates::META_KEY));
let value = &meta[summary::META_KEY];
assert!(value.len() <= summary::MAX_LEN, "{value}");
let c = summary::decode(MACHINE, "Studio Mac", true, value).expect("a summary");
@@ -94,7 +102,10 @@ async fn somebody_connected_means_watched() {
);
assert_eq!(
spaces.publish_resources().await.unwrap(),
- Published::Sent { watchers: 1 }
+ Published::Sent {
+ watchers: 1,
+ spaces: 0
+ }
);
}
diff --git a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
index 179792b3e4..878110f8d6 100644
--- a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
+++ b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
@@ -41958,6 +41958,93 @@ public object FfiConverterTypeSpaceCreateResult: FfiConverterRustBuffer<SpaceCre
+/**
+ * A Space another of your computers is creating ([`SpaceList::creating`]).
+ */
+data class SpaceCreatingElsewhere (
+ /**
+ * The computer's relay machine id.
+ */
+ var `machineId`: kotlin.String
+ ,
+ /**
+ * The computer's name.
+ */
+ var `machineName`: kotlin.String
+ ,
+ /**
+ * The Space's name.
+ */
+ var `name`: kotlin.String
+ ,
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */
+ var `os`: kotlin.String
+ ,
+ /**
+ * The create's phase (`preparing`, `pulling`, `booting`, ...).
+ */
+ var `phase`: kotlin.String
+ ,
+ /**
+ * How far along the whole create is, 0 to 100.
+ */
+ var `percent`: kotlin.UInt
+ ,
+ /**
+ * When the computer published it, unix ms.
+ */
+ var `updatedAtMs`: kotlin.ULong
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeSpaceCreatingElsewhere: FfiConverterRustBuffer<SpaceCreatingElsewhere> {
+ override fun read(buf: ByteBuffer): SpaceCreatingElsewhere {
+ return SpaceCreatingElsewhere(
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterString.read(buf),
+ FfiConverterUInt.read(buf),
+ FfiConverterULong.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: SpaceCreatingElsewhere) = (
+ FfiConverterString.allocationSize(value.`machineId`) +
+ FfiConverterString.allocationSize(value.`machineName`) +
+ FfiConverterString.allocationSize(value.`name`) +
+ FfiConverterString.allocationSize(value.`os`) +
+ FfiConverterString.allocationSize(value.`phase`) +
+ FfiConverterUInt.allocationSize(value.`percent`) +
+ FfiConverterULong.allocationSize(value.`updatedAtMs`)
+ )
+
+ override fun write(value: SpaceCreatingElsewhere, buf: ByteBuffer) {
+ FfiConverterString.write(value.`machineId`, buf)
+ FfiConverterString.write(value.`machineName`, buf)
+ FfiConverterString.write(value.`name`, buf)
+ FfiConverterString.write(value.`os`, buf)
+ FfiConverterString.write(value.`phase`, buf)
+ FfiConverterUInt.write(value.`percent`, buf)
+ FfiConverterULong.write(value.`updatedAtMs`, buf)
+ }
+}
+
+
+
/**
* One of a Space's displays ([`Space::displays`]).
*/
@@ -42460,6 +42547,12 @@ data class SpaceList (
* Why the account's computers could not be read, when they could not.
*/
var `notice`: kotlin.String
+ ,
+ /**
+ * Spaces your other computers are creating now, from what each
+ * published through the relay (empty from a daemon that predates it).
+ */
+ var `creating`: List<SpaceCreatingElsewhere>
){
@@ -42481,6 +42574,7 @@ public object FfiConverterTypeSpaceList: FfiConverterRustBuffer<SpaceList> {
FfiConverterUInt.read(buf),
FfiConverterBoolean.read(buf),
FfiConverterString.read(buf),
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.read(buf),
)
}
@@ -42489,7 +42583,8 @@ public object FfiConverterTypeSpaceList: FfiConverterRustBuffer<SpaceList> {
FfiConverterBoolean.allocationSize(value.`incomplete`) +
FfiConverterUInt.allocationSize(value.`reaching`) +
FfiConverterBoolean.allocationSize(value.`stale`) +
- FfiConverterString.allocationSize(value.`notice`)
+ FfiConverterString.allocationSize(value.`notice`) +
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.allocationSize(value.`creating`)
)
override fun write(value: SpaceList, buf: ByteBuffer) {
@@ -42498,6 +42593,7 @@ public object FfiConverterTypeSpaceList: FfiConverterRustBuffer<SpaceList> {
FfiConverterUInt.write(value.`reaching`, buf)
FfiConverterBoolean.write(value.`stale`, buf)
FfiConverterString.write(value.`notice`, buf)
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.write(value.`creating`, buf)
}
}
@@ -52125,6 +52221,34 @@ public object FfiConverterSequenceTypeSpaceAppIconRequest: FfiConverterRustBuffe
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeSpaceCreatingElsewhere: FfiConverterRustBuffer<List<SpaceCreatingElsewhere>> {
+ override fun read(buf: ByteBuffer): List<SpaceCreatingElsewhere> {
+ val len = buf.getInt()
+ return List<SpaceCreatingElsewhere>(len) {
+ FfiConverterTypeSpaceCreatingElsewhere.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List<SpaceCreatingElsewhere>): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeSpaceCreatingElsewhere.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List<SpaceCreatingElsewhere>, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeSpaceCreatingElsewhere.write(it, buf)
+ }
+ }
+}
+
+
+
+
/**
* @suppress
*/
diff --git a/libs/cua/proto/cua/daemon/v1/spaces.proto b/libs/cua/proto/cua/daemon/v1/spaces.proto
index de242c9b79..6035cd694a 100644
--- a/libs/cua/proto/cua/daemon/v1/spaces.proto
+++ b/libs/cua/proto/cua/daemon/v1/spaces.proto
@@ -298,6 +298,27 @@ message ListSpacesResponse {
// `known_now` only: why the account's computers could not be read, when
// they could not.
string notice = 5;
+ // `known_now` only: Spaces your other computers are creating now, from
+ // what each published in its relay machine record (CUA-2349).
+ repeated CreatingSpace creating = 6;
+}
+
+// A Space another of your computers is creating.
+message CreatingSpace {
+ // The computer's relay machine id.
+ string machine_id = 1;
+ // The computer's name.
+ string machine_name = 2;
+ // The Space's name.
+ string name = 3;
+ // `macos`, `linux`, `windows`, or empty when unknown.
+ string os = 4;
+ // The create's phase (`preparing`, `pulling`, `booting`, ...).
+ string phase = 5;
+ // How far along the whole create is, 0 to 100.
+ uint32 percent = 6;
+ // When the computer published it, unix ms.
+ uint64 updated_at_ms = 7;
}
// A named volume: the folder `volumes/<name>/` of Cua Volume.
diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.py
index a7359daf60..984f1e23d4 100644
--- a/libs/cua/python/src/cua/_native.py
+++ b/libs/cua/python/src/cua/_native.py
@@ -23686,6 +23686,75 @@ class _UniffiFfiConverterTypeSpaceCreateResult(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalString.write(value.pending_id, buf)
_UniffiFfiConverterBoolean.write(value.reused, buf)
+@dataclass
+class SpaceCreatingElsewhere:
+ """
+ A Space another of your computers is creating ([`SpaceList::creating`]).
+"""
+ def __init__(self, *, machine_id:str, machine_name:str, name:str, os:str, phase:str, percent:int, updated_at_ms:int):
+ self.machine_id = machine_id
+ self.machine_name = machine_name
+ self.name = name
+ self.os = os
+ self.phase = phase
+ self.percent = percent
+ self.updated_at_ms = updated_at_ms
+
+
+
+
+ def __str__(self):
+ return "SpaceCreatingElsewhere(machine_id={}, machine_name={}, name={}, os={}, phase={}, percent={}, updated_at_ms={})".format(self.machine_id, self.machine_name, self.name, self.os, self.phase, self.percent, self.updated_at_ms)
+ def __eq__(self, other):
+ if self.machine_id != other.machine_id:
+ return False
+ if self.machine_name != other.machine_name:
+ return False
+ if self.name != other.name:
+ return False
+ if self.os != other.os:
+ return False
+ if self.phase != other.phase:
+ return False
+ if self.percent != other.percent:
+ return False
+ if self.updated_at_ms != other.updated_at_ms:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeSpaceCreatingElsewhere(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return SpaceCreatingElsewhere(
+ machine_id=_UniffiFfiConverterString.read(buf),
+ machine_name=_UniffiFfiConverterString.read(buf),
+ name=_UniffiFfiConverterString.read(buf),
+ os=_UniffiFfiConverterString.read(buf),
+ phase=_UniffiFfiConverterString.read(buf),
+ percent=_UniffiFfiConverterUInt32.read(buf),
+ updated_at_ms=_UniffiFfiConverterUInt64.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.machine_id)
+ _UniffiFfiConverterString.check_lower(value.machine_name)
+ _UniffiFfiConverterString.check_lower(value.name)
+ _UniffiFfiConverterString.check_lower(value.os)
+ _UniffiFfiConverterString.check_lower(value.phase)
+ _UniffiFfiConverterUInt32.check_lower(value.percent)
+ _UniffiFfiConverterUInt64.check_lower(value.updated_at_ms)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.machine_id, buf)
+ _UniffiFfiConverterString.write(value.machine_name, buf)
+ _UniffiFfiConverterString.write(value.name, buf)
+ _UniffiFfiConverterString.write(value.os, buf)
+ _UniffiFfiConverterString.write(value.phase, buf)
+ _UniffiFfiConverterUInt32.write(value.percent, buf)
+ _UniffiFfiConverterUInt64.write(value.updated_at_ms, buf)
+
@dataclass
class SpaceDisplay:
"""
@@ -23847,23 +23916,47 @@ class _UniffiFfiConverterSequenceTypeSpaceInfo(_UniffiConverterRustBuffer):
_UniffiFfiConverterTypeSpaceInfo.read(buf) for i in range(count)
]
+class _UniffiFfiConverterSequenceTypeSpaceCreatingElsewhere(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ for item in value:
+ _UniffiFfiConverterTypeSpaceCreatingElsewhere.check_lower(item)
+
+ @classmethod
+ def write(cls, value, buf):
+ items = len(value)
+ buf.write_i32(items)
+ for item in value:
+ _UniffiFfiConverterTypeSpaceCreatingElsewhere.write(item, buf)
+
+ @classmethod
+ def read(cls, buf):
+ count = buf.read_i32()
+ if count < 0:
+ raise InternalError("Unexpected negative sequence length")
+
+ return [
+ _UniffiFfiConverterTypeSpaceCreatingElsewhere.read(buf) for i in range(count)
+ ]
+
@dataclass
class SpaceList:
"""
The Spaces known now ([`Spaces::list_known`]) and how far the read got.
"""
- def __init__(self, *, spaces:typing.List[SpaceInfo], incomplete:bool, reaching:int, stale:bool, notice:str):
+ def __init__(self, *, spaces:typing.List[SpaceInfo], incomplete:bool, reaching:int, stale:bool, notice:str, creating:typing.List[SpaceCreatingElsewhere]):
self.spaces = spaces
self.incomplete = incomplete
self.reaching = reaching
self.stale = stale
self.notice = notice
+ self.creating = creating
def __str__(self):
- return "SpaceList(spaces={}, incomplete={}, reaching={}, stale={}, notice={})".format(self.spaces, self.incomplete, self.reaching, self.stale, self.notice)
+ return "SpaceList(spaces={}, incomplete={}, reaching={}, stale={}, notice={}, creating={})".format(self.spaces, self.incomplete, self.reaching, self.stale, self.notice, self.creating)
def __eq__(self, other):
if self.spaces != other.spaces:
return False
@@ -23875,6 +23968,8 @@ class SpaceList:
return False
if self.notice != other.notice:
return False
+ if self.creating != other.creating:
+ return False
return True
class _UniffiFfiConverterTypeSpaceList(_UniffiConverterRustBuffer):
@@ -23886,6 +23981,7 @@ class _UniffiFfiConverterTypeSpaceList(_UniffiConverterRustBuffer):
reaching=_UniffiFfiConverterUInt32.read(buf),
stale=_UniffiFfiConverterBoolean.read(buf),
notice=_UniffiFfiConverterString.read(buf),
+ creating=_UniffiFfiConverterSequenceTypeSpaceCreatingElsewhere.read(buf),
)
@staticmethod
@@ -23895,6 +23991,7 @@ class _UniffiFfiConverterTypeSpaceList(_UniffiConverterRustBuffer):
_UniffiFfiConverterUInt32.check_lower(value.reaching)
_UniffiFfiConverterBoolean.check_lower(value.stale)
_UniffiFfiConverterString.check_lower(value.notice)
+ _UniffiFfiConverterSequenceTypeSpaceCreatingElsewhere.check_lower(value.creating)
@staticmethod
def write(value, buf):
@@ -23903,6 +24000,7 @@ class _UniffiFfiConverterTypeSpaceList(_UniffiConverterRustBuffer):
_UniffiFfiConverterUInt32.write(value.reaching, buf)
_UniffiFfiConverterBoolean.write(value.stale, buf)
_UniffiFfiConverterString.write(value.notice, buf)
+ _UniffiFfiConverterSequenceTypeSpaceCreatingElsewhere.write(value.creating, buf)
@dataclass
class SpacePowerReport:
@@ -45428,6 +45526,7 @@ __all__ = [
"SpaceCreateProgress",
"SpaceInfo",
"SpaceCreateResult",
+ "SpaceCreatingElsewhere",
"SpaceDisplay",
"SpaceHotspotStatus",
"SpaceList",
diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
index 325ebcf3c8..48b7a33724 100644
--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
@@ -36278,6 +36278,125 @@ public func FfiConverterTypeSpaceCreateResult_lower(_ value: SpaceCreateResult)
}
+/**
+ * A Space another of your computers is creating ([`SpaceList::creating`]).
+ */
+public struct SpaceCreatingElsewhere: Equatable, Hashable {
+ /**
+ * The computer's relay machine id.
+ */
+ public var machineId: String
+ /**
+ * The computer's name.
+ */
+ public var machineName: String
+ /**
+ * The Space's name.
+ */
+ public var name: String
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */
+ public var os: String
+ /**
+ * The create's phase (`preparing`, `pulling`, `booting`, ...).
+ */
+ public var phase: String
+ /**
+ * How far along the whole create is, 0 to 100.
+ */
+ public var percent: UInt32
+ /**
+ * When the computer published it, unix ms.
+ */
+ public var updatedAtMs: UInt64
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The computer's relay machine id.
+ */machineId: String,
+ /**
+ * The computer's name.
+ */machineName: String,
+ /**
+ * The Space's name.
+ */name: String,
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */os: String,
+ /**
+ * The create's phase (`preparing`, `pulling`, `booting`, ...).
+ */phase: String,
+ /**
+ * How far along the whole create is, 0 to 100.
+ */percent: UInt32,
+ /**
+ * When the computer published it, unix ms.
+ */updatedAtMs: UInt64) {
+ self.machineId = machineId
+ self.machineName = machineName
+ self.name = name
+ self.os = os
+ self.phase = phase
+ self.percent = percent
+ self.updatedAtMs = updatedAtMs
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension SpaceCreatingElsewhere: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeSpaceCreatingElsewhere: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpaceCreatingElsewhere {
+ return
+ try SpaceCreatingElsewhere(
+ machineId: FfiConverterString.read(from: &buf),
+ machineName: FfiConverterString.read(from: &buf),
+ name: FfiConverterString.read(from: &buf),
+ os: FfiConverterString.read(from: &buf),
+ phase: FfiConverterString.read(from: &buf),
+ percent: FfiConverterUInt32.read(from: &buf),
+ updatedAtMs: FfiConverterUInt64.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: SpaceCreatingElsewhere, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.machineId, into: &buf)
+ FfiConverterString.write(value.machineName, into: &buf)
+ FfiConverterString.write(value.name, into: &buf)
+ FfiConverterString.write(value.os, into: &buf)
+ FfiConverterString.write(value.phase, into: &buf)
+ FfiConverterUInt32.write(value.percent, into: &buf)
+ FfiConverterUInt64.write(value.updatedAtMs, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeSpaceCreatingElsewhere_lift(_ buf: RustBuffer) throws -> SpaceCreatingElsewhere {
+ return try FfiConverterTypeSpaceCreatingElsewhere.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeSpaceCreatingElsewhere_lower(_ value: SpaceCreatingElsewhere) -> RustBuffer {
+ return FfiConverterTypeSpaceCreatingElsewhere.lower(value)
+}
+
+
/**
* One of a Space's displays ([`Space::displays`]).
*/
@@ -36943,6 +37062,11 @@ public struct SpaceList: Equatable, Hashable {
* Why the account's computers could not be read, when they could not.
*/
public var notice: String
+ /**
+ * Spaces your other computers are creating now, from what each
+ * published through the relay (empty from a daemon that predates it).
+ */
+ public var creating: [SpaceCreatingElsewhere]
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -36965,12 +37089,17 @@ public struct SpaceList: Equatable, Hashable {
*/stale: Bool,
/**
* Why the account's computers could not be read, when they could not.
- */notice: String) {
+ */notice: String,
+ /**
+ * Spaces your other computers are creating now, from what each
+ * published through the relay (empty from a daemon that predates it).
+ */creating: [SpaceCreatingElsewhere]) {
self.spaces = spaces
self.incomplete = incomplete
self.reaching = reaching
self.stale = stale
self.notice = notice
+ self.creating = creating
}
@@ -36993,7 +37122,8 @@ public struct FfiConverterTypeSpaceList: FfiConverterRustBuffer {
incomplete: FfiConverterBool.read(from: &buf),
reaching: FfiConverterUInt32.read(from: &buf),
stale: FfiConverterBool.read(from: &buf),
- notice: FfiConverterString.read(from: &buf)
+ notice: FfiConverterString.read(from: &buf),
+ creating: FfiConverterSequenceTypeSpaceCreatingElsewhere.read(from: &buf)
)
}
@@ -37003,6 +37133,7 @@ public struct FfiConverterTypeSpaceList: FfiConverterRustBuffer {
FfiConverterUInt32.write(value.reaching, into: &buf)
FfiConverterBool.write(value.stale, into: &buf)
FfiConverterString.write(value.notice, into: &buf)
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.write(value.creating, into: &buf)
}
}
@@ -47492,6 +47623,31 @@ fileprivate struct FfiConverterSequenceTypeSpaceAppIconRequest: FfiConverterRust
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterSequenceTypeSpaceCreatingElsewhere: FfiConverterRustBuffer {
+ typealias SwiftType = [SpaceCreatingElsewhere]
+
+ public static func write(_ value: [SpaceCreatingElsewhere], into buf: inout [UInt8]) {
+ let len = Int32(value.count)
+ writeInt(&buf, len)
+ for item in value {
+ FfiConverterTypeSpaceCreatingElsewhere.write(item, into: &buf)
+ }
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [SpaceCreatingElsewhere] {
+ let len: Int32 = try readInt(&buf)
+ var seq = [SpaceCreatingElsewhere]()
+ seq.reserveCapacity(Int(len))
+ for _ in 0 ..< len {
+ seq.append(try FfiConverterTypeSpaceCreatingElsewhere.read(from: &buf))
+ }
+ return seq
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.ts
index fa6a690263..ff919cfa58 100644
--- a/libs/cua/typescript/src/native/cua_sdk.ts
+++ b/libs/cua/typescript/src/native/cua_sdk.ts
@@ -18684,6 +18684,93 @@ const FfiConverterTypeSpaceCreateResult = (() => {
return new FFIConverter();
})();
+/**
+ * A Space another of your computers is creating ([`SpaceList::creating`]).
+ */
+export type SpaceCreatingElsewhere = {
+ /**
+ * The computer's relay machine id.
+ */
+ machineId: string,
+ /**
+ * The computer's name.
+ */
+ machineName: string,
+ /**
+ * The Space's name.
+ */
+ name: string,
+ /**
+ * `macos`, `linux`, `windows`, or empty when unknown.
+ */
+ os: string,
+ /**
+ * The create's phase (`preparing`, `pulling`, `booting`, ...).
+ */
+ phase: string,
+ /**
+ * How far along the whole create is, 0 to 100.
+ */
+ percent: number,
+ /**
+ * When the computer published it, unix ms.
+ */
+ updatedAtMs: bigint
+}
+
+/**
+ * Generated factory for {@link SpaceCreatingElsewhere} record objects.
+ */
+export const SpaceCreatingElsewhere = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<SpaceCreatingElsewhere, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<SpaceCreatingElsewhere>,
+ });
+})();
+
+const FfiConverterTypeSpaceCreatingElsewhere = (() => {
+ type TypeName = SpaceCreatingElsewhere;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ machineId: FfiConverterString.read(from),
+ machineName: FfiConverterString.read(from),
+ name: FfiConverterString.read(from),
+ os: FfiConverterString.read(from),
+ phase: FfiConverterString.read(from),
+ percent: FfiConverterUInt32.read(from),
+ updatedAtMs: FfiConverterUInt64.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.machineId, into);
+ FfiConverterString.write(value.machineName, into);
+ FfiConverterString.write(value.name, into);
+ FfiConverterString.write(value.os, into);
+ FfiConverterString.write(value.phase, into);
+ FfiConverterUInt32.write(value.percent, into);
+ FfiConverterUInt64.write(value.updatedAtMs, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.machineId) +
+ FfiConverterString.allocationSize(value.machineName) +
+ FfiConverterString.allocationSize(value.name) +
+ FfiConverterString.allocationSize(value.os) +
+ FfiConverterString.allocationSize(value.phase) +
+ FfiConverterUInt32.allocationSize(value.percent) +
+ FfiConverterUInt64.allocationSize(value.updatedAtMs);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
/**
* One of a Space's displays ([`Space::displays`]).
*/
@@ -18885,7 +18972,12 @@ export type SpaceList = {
/**
* Why the account's computers could not be read, when they could not.
*/
- notice: string
+ notice: string,
+ /**
+ * Spaces your other computers are creating now, from what each
+ * published through the relay (empty from a daemon that predates it).
+ */
+ creating: Array<SpaceCreatingElsewhere>
}
/**
@@ -18913,7 +19005,8 @@ const FfiConverterTypeSpaceList = (() => {
incomplete: FfiConverterBool.read(from),
reaching: FfiConverterUInt32.read(from),
stale: FfiConverterBool.read(from),
- notice: FfiConverterString.read(from)
+ notice: FfiConverterString.read(from),
+ creating: FfiConverterSequenceTypeSpaceCreatingElsewhere.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -18922,13 +19015,15 @@ const FfiConverterTypeSpaceList = (() => {
FfiConverterUInt32.write(value.reaching, into);
FfiConverterBool.write(value.stale, into);
FfiConverterString.write(value.notice, into);
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.write(value.creating, into);
}
allocationSize(value: TypeName): number {
return FfiConverterSequenceTypeSpaceInfo.allocationSize(value.spaces) +
FfiConverterBool.allocationSize(value.incomplete) +
FfiConverterUInt32.allocationSize(value.reaching) +
FfiConverterBool.allocationSize(value.stale) +
- FfiConverterString.allocationSize(value.notice);
+ FfiConverterString.allocationSize(value.notice) +
+ FfiConverterSequenceTypeSpaceCreatingElsewhere.allocationSize(value.creating);
}
};
@@ -44321,6 +44416,9 @@ const FfiConverterOptionalTypeSpaceInfo = new FfiConverterOptional(FfiConverterT
// FfiConverter for Array<SpaceInfo>
const FfiConverterSequenceTypeSpaceInfo = new FfiConverterArray(FfiConverterTypeSpaceInfo);
+// FfiConverter for Array<SpaceCreatingElsewhere>
+const FfiConverterSequenceTypeSpaceCreatingElsewhere = new FfiConverterArray(FfiConverterTypeSpaceCreatingElsewhere);
+
// FfiConverter for Array<SpaceSentFile>
const FfiConverterSequenceTypeSpaceSentFile = new FfiConverterArray(FfiConverterTypeSpaceSentFile);
@@ -46250,6 +46348,7 @@ export default Object.freeze({
FfiConverterTypeSpaceCreateOptions,
FfiConverterTypeSpaceCreateProgress,
FfiConverterTypeSpaceCreateResult,
+ FfiConverterTypeSpaceCreatingElsewhere,
FfiConverterTypeSpaceDisplay,
FfiConverterTypeSpaceHotspotStatus,
FfiConverterTypeSpaceInfo,
diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.ts
index 3b051acf73..f61a433028 100644
--- a/scripts/docs-generators/cua-sdk.ts
+++ b/scripts/docs-generators/cua-sdk.ts
@@ -537,6 +537,24 @@ export const PAGES: PageSpec[] = [
],
modules: ['spaces'],
},
+ {
+ slug: 'spaces/sharing',
+ title: 'Share a Space',
+ description: 'Give another person access to a Space, list who has it and take it back.',
+ intro:
+ '`Space.share` gives a person access to a Space, `Space.shares` lists who has it, and `Space.unshare` takes it back.',
+ items: ['SpaceShareEntry', 'SpaceShares'],
+ members: [{ object: 'Space', title: 'Sharing', methods: ['share', 'shares', 'unshare'] }],
+ },
+ {
+ slug: 'spaces/relay-registration',
+ title: 'Relay registration',
+ description: 'Register a Space with the relay so other devices reach it, and unregister it.',
+ intro:
+ '`Spaces.relay_register` makes a Space reachable from your other devices through the relay; `Spaces.relay_unregister` stops that.',
+ items: ['SpaceRelayRegistration'],
+ members: [{ object: 'Spaces', title: 'Relay registration', methods: ['relay_register', 'relay_unregister'] }],
+ },
{
slug: 'spaces/elastic',
title: 'Elastic pool and prewarm',