Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(spaces): never show an empty Spaces page while computers are still answering (#5905)
dduponta0f98b1a35dc
diff --git a/apps/cua-spaces-desktop/src/bridge/spaces.ts b/apps/cua-spaces-desktop/src/bridge/spaces.tsindex 9a7d474adf..b973c2260d 100644--- a/apps/cua-spaces-desktop/src/bridge/spaces.ts+++ b/apps/cua-spaces-desktop/src/bridge/spaces.ts@@ -28,6 +28,12 @@ export function spacesState(model: AppModel) {rosterError: model.rosterError,// Another app keeps its own daemon and this app uses it (null otherwise).daemonNotice: model.daemonNotice,+ // Some of your computers have not answered yet (`Spaces.list_known`): the+ // page shows what is known and "Reaching N computers…", never the empty home.+ incomplete: model.listIncomplete,+ reaching: model.listReaching,+ // Your other computers' rows are the last known ones, not yet confirmed.+ stale: model.listStale,};}diff --git a/apps/cua-spaces-desktop/src/model/app-model.ts b/apps/cua-spaces-desktop/src/model/app-model.tsindex 2fb9b291e9..72fc2e3078 100644--- a/apps/cua-spaces-desktop/src/model/app-model.ts+++ b/apps/cua-spaces-desktop/src/model/app-model.ts@@ -37,7 +37,7 @@ import type {LocalStorage,SpaceCreateProgress,} from "../native/generated/index";-import type { LocalRuntimes, SpacesBackend } from "./backend";+import type { ListRead, LocalRuntimes, SpacesBackend } from "./backend";import { AgentsModel, type AgentSetupRunning, type ToolRunner } from "./agents";import { ChecklistModel } from "./checklist";import type { CloudModel } from "./cloud";@@ -194,7 +194,7 @@ export class AppModel {readonly servicesInNow: () => boolean;private listWatchedSince = Date.now();- private rowsInFlight: Promise<import("../native/generated/index").AppSpaceRow[]> | null = null;+ private rowsInFlight: Promise<ListRead> | null = null;private hostInFlight: Promise<void> | null = null;private createTicker: NodeJS.Timeout | null = null;private readonly listeners = new Set<(change: ModelChange) => void>();@@ -534,8 +534,10 @@ export class AppModel {if (done.ok && this.hostInFlight === task) this.hostInFlight = null;}- private async readRows() {- const task = this.rowsInFlight ?? this.backend.rows();+ private async readRows(): Promise<ListRead> {+ const b = this.backend;+ const task: Promise<ListRead> =+ this.rowsInFlight ?? (b.listRead ? b.listRead() : b.rows().then((rows) => ({ rows, incomplete: false, reaching: 0, stale: false, notice: "" })));this.rowsInFlight = task;const result = await withTimeout(this.listTimeout, () => task);// Still running after the timeout: the next refresh waits on the same read.@@ -546,21 +548,64 @@ export class AppModel {/** Re-reads the registry (and the host). Bounded: a daemon that stopped answering leaves the list as it was. */async refresh(): Promise<void> {- await this.refreshHost();- const cloud = await this.backend.cloudAvailable().catch(() => false);- if (cloud !== this.cloudConfigured) {- this.cloudConfigured = cloud;- this.changed("session");+ // The host's reads run beside the list, never ahead of it: this machine's+ // Spaces show as soon as the daemon lists them ("This machine" joins+ // them once the host answered).+ const hostRead = this.refreshHost().then(() => {+ if (this.loaded) {+ this.recompose();+ this.changed("spaces");+ }+ });+ const cloudRead = this.backend+ .cloudAvailable()+ .catch(() => false)+ .then((cloud) => {+ if (cloud !== this.cloudConfigured) {+ this.cloudConfigured = cloud;+ this.changed("session");+ }+ });+ try {+ await this.readList();+ } finally {+ await Promise.all([hostRead, cloudRead]);+ this.followIncompleteList();}+ }++ /** Some of your computers have not answered the last read yet (`Spaces.list_known`). */+ listIncomplete = false;+ /** How many computers are still being reached (0 when unknown). */+ listReaching = 0;+ /** Your other computers' rows are the last known ones, not yet confirmed. */+ listStale = false;+ private incompleteFollow: ReturnType<typeof setTimeout> | null = null;++ /** While some of your computers have not answered, the list is read again+ * soon (each read waits a moment for them in the daemon), not at the next poll. */+ private followIncompleteList(): void {+ if (!this.listIncomplete || this.incompleteFollow) return;+ this.incompleteFollow = setTimeout(() => {+ this.incompleteFollow = null;+ void this.refresh();+ }, 500);+ }++ private async readList(): Promise<void> {try {- const rows = await this.readRows();+ const list = await this.readRows();this.lastListOk = Date.now();this.lastListAnswer = this.lastListOk;- this.registrySpaces = this.native.appRowsToSpaces(rows, AppModel.nowMs());+ this.registrySpaces = this.native.appRowsToSpaces(list.rows, AppModel.nowMs());this.creates = this.native.appCreatesSettle(this.creates, this.registrySpaces);this.recompose();this.loaded = true;- this.rosterError = null;+ this.listIncomplete = list.incomplete;+ this.listReaching = list.reaching;+ this.listStale = list.stale;+ // 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) {const first = this.sidebar.selectedId;if (first) this.selectedSpaceId = first;diff --git a/apps/cua-spaces-desktop/src/model/backend.ts b/apps/cua-spaces-desktop/src/model/backend.tsindex 6520f1284b..581bce3393 100644--- a/apps/cua-spaces-desktop/src/model/backend.ts+++ b/apps/cua-spaces-desktop/src/model/backend.ts@@ -74,9 +74,26 @@ export interface LocalRuntimes {details: Map<string, string>;}+/** One read of the Space list and how far it got (the SDK's `SpaceList`). */+export interface ListRead {+ rows: AppSpaceRow[];+ /** Some of your computers have not answered yet: not "no Spaces". */+ incomplete: boolean;+ /** How many computers are still being reached (0 when unknown). */+ reaching: number;+ /** Your other computers' rows are the last known ones. */+ stale: boolean;+ /** Why your other computers could not be read, when they could not. */+ notice: string;+}+export interface SpacesBackend {/** The registry, one row per Space, with a bounded reachability probe. */rows(): Promise<AppSpaceRow[]>;+ /** `rows` with how far the read got (`Spaces.list_known`): this machine's+ * Spaces at once, your other computers as they answer. Undefined: the+ * backend lists complete lists only. */+ listRead?(): Promise<ListRead>;/** Creates a Space, reporting the SDK's progress until it is ready; its id. */create(args: AppCreateSpaceArgs, createId: string, progress: (p: SpaceCreateProgress) => void): Promise<string>;cancelCreate(createId: string): Promise<void>;@@ -297,8 +314,18 @@ export class LiveSpacesBackend implements SpacesBackend {) {}async rows(): Promise<AppSpaceRow[]> {+ return (await this.listRead()).rows;+ }++ /** 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 };+ }++ /** The rows of `infos`, each with a bounded reachability probe. */+ private async probe(infos: Awaited<ReturnType<ReturnType<CuaLike["spaces"]>["list"]>>): Promise<AppSpaceRow[]> {const spaces = this.cua.spaces();- const infos = await spaces.list();return Promise.all(infos.map(async (info) => {const row: AppSpaceRow = {diff --git a/apps/cua-spaces-desktop/src/model/pending.ts b/apps/cua-spaces-desktop/src/model/pending.tsindex 3133d9bdd8..18b96ed8a4 100644--- a/apps/cua-spaces-desktop/src/model/pending.ts+++ b/apps/cua-spaces-desktop/src/model/pending.ts@@ -91,6 +91,10 @@ export class PendingSpacesBackend implements SpacesBackend {}rows = async () => (await this.b()).rows();+ listRead = async () => {+ const b = await this.b();+ return b.listRead ? b.listRead() : { rows: await b.rows(), incomplete: false, reaching: 0, stale: false, notice: "" };+ };create = async (args: AppCreateSpaceArgs, createId: string, progress: (p: SpaceCreateProgress) => void) =>(await this.b()).create(args, createId, progress);cancelCreate = async (createId: string) => (await this.b()).cancelCreate(createId);diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.tsindex 8de749fc55..ef4d1cc845 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk-ffi.ts@@ -2454,6 +2454,11 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_method_spaces_list_known": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_method_spaces_list_tools_json": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -4849,6 +4854,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_spaces_list_known": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_spaces_list_tools_json": {args: [],ret: FfiType.UInt16,@@ -6074,6 +6084,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_method_spaces_gpu_support(uniffiSelf: bigint, on: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spaces_hosts(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_list(uniffiSelf: bigint): bigint;+ uniffi_cua_sdk_fn_method_spaces_list_known(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_list_tools_json(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_machine_health(uniffiSelf: bigint, machine: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spaces_notifications(uniffiSelf: bigint, unreadOnly: number, sinceMs: Uint8Array): bigint;@@ -6553,6 +6564,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_method_spaces_gpu_support(): number;uniffi_cua_sdk_checksum_method_spaces_hosts(): number;uniffi_cua_sdk_checksum_method_spaces_list(): number;+ uniffi_cua_sdk_checksum_method_spaces_list_known(): number;uniffi_cua_sdk_checksum_method_spaces_list_tools_json(): number;uniffi_cua_sdk_checksum_method_spaces_machine_health(): number;uniffi_cua_sdk_checksum_method_spaces_notifications(): number;diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.tsindex 711b431c08..aa7be6dfed 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts@@ -18864,6 +18864,83 @@ const FfiConverterTypeSpaceHotspotStatus = (() => {return new FFIConverter();})();+/**+ * The Spaces known now ([`Spaces::list_known`]) and how far the read got.+ */+export type SpaceList = {+ /**+ * This machine's Spaces, and the account's other computers' as far as+ * they answered (the last known ones meanwhile).+ */+ spaces: Array<SpaceInfo>,+ /**+ * Some of the account's computers have not answered yet: the list may+ * grow, and an empty one is not "no Spaces". Always false from a+ * daemon that predates it (it answers once every computer did).+ */+ incomplete: boolean,+ /**+ * How many computers are still being reached (0 when unknown).+ */+ reaching: number,+ /**+ * The other computers' rows are the last known ones, not yet+ * confirmed by the relay.+ */+ stale: boolean,+ /**+ * Why the account's computers could not be read, when they could not.+ */+ notice: string+}++/**+ * Generated factory for {@link SpaceList} record objects.+ */+export const SpaceList = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SpaceList, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SpaceList>,+ });+})();++const FfiConverterTypeSpaceList = (() => {+ type TypeName = SpaceList;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ spaces: FfiConverterSequenceTypeSpaceInfo.read(from),+ incomplete: FfiConverterBool.read(from),+ reaching: FfiConverterUInt32.read(from),+ stale: FfiConverterBool.read(from),+ notice: FfiConverterString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterSequenceTypeSpaceInfo.write(value.spaces, into);+ FfiConverterBool.write(value.incomplete, into);+ FfiConverterUInt32.write(value.reaching, into);+ FfiConverterBool.write(value.stale, into);+ FfiConverterString.write(value.notice, 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);++ }+ };+ return new FFIConverter();+})();+/*** What [`Spaces::stop`] or [`Spaces::start`] did.*/@@ -38450,6 +38527,15 @@ export interface SpacesLike {* Registered Spaces.*/list(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<SpaceInfo>>;+/**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ listKnown(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SpaceList>;/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -40031,6 +40117,46 @@ private constructor(pointer: UniffiHandle) {}}+/**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ async listKnown(asyncOpts_?: { signal: AbortSignal }): Promise<SpaceList> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_sdk_fn_method_spaces_list_known(+ uniffiTypeSpacesObjectFactory.clonePointer(this)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeSpaceList.lift.bind(FfiConverterTypeSpaceList),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -43703,6 +43829,9 @@ const FfiConverterOptionalTypeEgressEnforcement = new FfiConverterOptional(FfiCo// FfiConverter for SpaceInfo | undefinedconst FfiConverterOptionalTypeSpaceInfo = new FfiConverterOptional(FfiConverterTypeSpaceInfo);+// FfiConverter for Array<SpaceInfo>+const FfiConverterSequenceTypeSpaceInfo = new FfiConverterArray(FfiConverterTypeSpaceInfo);+// FfiConverter for Array<SpaceSentFile>const FfiConverterSequenceTypeSpaceSentFile = new FfiConverterArray(FfiConverterTypeSpaceSentFile);@@ -43877,9 +44006,6 @@ const FfiConverterSequenceTypeGpuSupport = new FfiConverterArray(FfiConverterTyp// FfiConverter for Array<SpacesHost>const FfiConverterSequenceTypeSpacesHost = new FfiConverterArray(FfiConverterTypeSpacesHost);-// FfiConverter for Array<SpaceInfo>-const FfiConverterSequenceTypeSpaceInfo = new FfiConverterArray(FfiConverterTypeSpaceInfo);-// FfiConverter for Array<NotificationInfo>const FfiConverterSequenceTypeNotificationInfo = new FfiConverterArray(FfiConverterTypeNotificationInfo);@@ -45024,6 +45150,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list() !== 27182) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list_known() !== 21083) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list_known");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list_tools_json() !== 19259) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list_tools_json");}@@ -45619,6 +45748,7 @@ export default Object.freeze({FfiConverterTypeSpaceDisplay,FfiConverterTypeSpaceHotspotStatus,FfiConverterTypeSpaceInfo,+ FfiConverterTypeSpaceList,FfiConverterTypeSpacePowerReport,FfiConverterTypeSpacePresence,FfiConverterTypeSpaceRelayRegistration,diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.tsindex f829eb3026..751bff90db 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts@@ -1532,6 +1532,11 @@ const DEFINITIONS = {ret: FfiType.RustBuffer,hasRustCallStatus: true,},+ "uniffi_cua_spaces_ffi_fn_func_app_spaces_list_view": {+ args: [FfiType.RustBuffer],+ ret: FfiType.RustBuffer,+ hasRustCallStatus: true,+ },"uniffi_cua_spaces_ffi_fn_func_app_status_line": {args: [FfiType.UInt32],ret: FfiType.RustBuffer,@@ -3337,6 +3342,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_spaces_ffi_checksum_func_app_spaces_list_view": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_spaces_ffi_checksum_func_app_status_line": {args: [],ret: FfiType.UInt16,@@ -4422,6 +4432,7 @@ interface NativeModuleInterface {uniffi_cua_spaces_ffi_fn_func_app_space_host(host: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_spaces_ffi_fn_func_app_space_rows_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_spaces_ffi_fn_func_app_spaces_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_spaces_ffi_fn_func_app_spaces_list_view(input: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_spaces_ffi_fn_func_app_status_line(count: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_spaces_ffi_fn_func_app_storage_action_from_json(json: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_spaces_ffi_fn_func_app_storage_choose(id: Uint8Array, option: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;@@ -4783,6 +4794,7 @@ interface NativeModuleInterface {uniffi_cua_spaces_ffi_checksum_func_app_space_host(): number;uniffi_cua_spaces_ffi_checksum_func_app_space_rows_from_json(): number;uniffi_cua_spaces_ffi_checksum_func_app_spaces_from_json(): number;+ uniffi_cua_spaces_ffi_checksum_func_app_spaces_list_view(): number;uniffi_cua_spaces_ffi_checksum_func_app_status_line(): number;uniffi_cua_spaces_ffi_checksum_func_app_storage_action_from_json(): number;uniffi_cua_spaces_ffi_checksum_func_app_storage_choose(): number;diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.tsindex 547b0b1ba6..09f99925b4 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts@@ -4822,6 +4822,27 @@ export function appSpacesFromJson(json: string): Array<AppSpace> /*throws*/ {));}+/**+ * The Spaces page's empty state and "Reaching N computers…" line: the+ * first-run page only for a complete list with no Space.+ */+export function appSpacesListView(input: AppListViewInput): AppListView {+ return ((__rb: Uint8Array) => {+ try {+ return FfiConverterTypeAppListView.lift(__rb);+ } finally {+ nativeModule().rustbuffer_free(__rb);+ }+ })(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_spaces_ffi_fn_func_app_spaces_list_view(+ FfiConverterTypeAppListViewInput.lower(input, nativeModule().rustbuffer_alloc),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }+/*** The menu bar status line ("3 Spaces").*/@@ -26144,6 +26165,122 @@ const FfiConverterTypeAppLaunchPlan = (() => {return new FFIConverter();})();+export type AppListView = {+ /**+ * "Create your first Space": only when the list is complete and has no+ * Space. A list still loading, or with computers still answering, is+ * not empty yet (an app update restarting the daemon must not show it).+ */+ empty: boolean,+ /**+ * One quiet line where the Spaces go while the list is not complete+ * ("Reaching 6 computers…"), below what is known so far.+ */+ reachingLine?: string+}++/**+ * Generated factory for {@link AppListView} record objects.+ */+export const AppListView = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<AppListView, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<AppListView>,+ });+})();++const FfiConverterTypeAppListView = (() => {+ type TypeName = AppListView;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ empty: FfiConverterBool.read(from),+ reachingLine: FfiConverterOptionalString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterBool.write(value.empty, into);+ FfiConverterOptionalString.write(value.reachingLine, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterBool.allocationSize(value.empty) ++ FfiConverterOptionalString.allocationSize(value.reachingLine);++ }+ };+ return new FFIConverter();+})();++export type AppListViewInput = {+ /**+ * The list was read at least once: before that nothing is known, not+ * even this machine's Spaces.+ */+ loaded: boolean,+ /**+ * Some of the account's computers have not answered yet.+ */+ incomplete: boolean,+ /**+ * How many computers are still being reached (0 when unknown).+ */+ reaching: number,+ /**+ * Spaces listed now.+ */+ count: number+}++/**+ * Generated factory for {@link AppListViewInput} record objects.+ */+export const AppListViewInput = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<AppListViewInput, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<AppListViewInput>,+ });+})();++const FfiConverterTypeAppListViewInput = (() => {+ type TypeName = AppListViewInput;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ loaded: FfiConverterBool.read(from),+ incomplete: FfiConverterBool.read(from),+ reaching: FfiConverterUInt32.read(from),+ count: FfiConverterUInt32.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterBool.write(value.loaded, into);+ FfiConverterBool.write(value.incomplete, into);+ FfiConverterUInt32.write(value.reaching, into);+ FfiConverterUInt32.write(value.count, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterBool.allocationSize(value.loaded) ++ FfiConverterBool.allocationSize(value.incomplete) ++ FfiConverterUInt32.allocationSize(value.reaching) ++ FfiConverterUInt32.allocationSize(value.count);++ }+ };+ return new FFIConverter();+})();+export enum AppLocalNetworkAccess {/*** A connect to the local network went out.@@ -66433,6 +66570,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_spaces_from_json() !== 7600) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_spaces_from_json");}+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_spaces_list_view() !== 47161) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_spaces_list_view");+ }if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_status_line() !== 47728) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_status_line");}@@ -67028,6 +67168,8 @@ export default Object.freeze({FfiConverterTypeAppLaunchInput,FfiConverterTypeAppLaunchPlan,FfiConverterTypeAppLineView,+ FfiConverterTypeAppListView,+ FfiConverterTypeAppListViewInput,FfiConverterTypeAppLocalEngine,FfiConverterTypeAppLocalNetworkAccess,FfiConverterTypeAppLocalNetworkInput,diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swiftindex 1de6975fee..a5f6a57546 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift@@ -79,6 +79,20 @@ public final class AppModel {/// A teleport the notch started: the Space and the dropped app.public var pendingTeleport: PendingTeleport?public private(set) var loaded = false+ /// Some of your computers have not answered the last list read yet+ /// (`Spaces.list_known`): the list is not "no Spaces" meanwhile.+ public private(set) var listIncomplete = false+ /// How many computers are still being reached (0 when unknown).+ public private(set) var listReaching: UInt32 = 0+ /// Your other computers' rows are the last known ones (kept across a+ /// daemon restart), not yet confirmed.+ public private(set) var listStale = false+ /// The Spaces page's empty state and "Reaching N computers…" line, as+ /// the core decides them: the first-run page only for a complete list.+ public var listView: AppListView {+ appSpacesListView(input: AppListViewInput(loaded: loaded, incomplete: listIncomplete,+ reaching: listReaching, count: UInt32(spaces.count)))+ }public let wizard: WizardModelpublic let keyvault: KeyvaultModel@@ -717,7 +731,7 @@ public final class AppModel {public private(set) var reconnects = 0/// The registry read in flight: refreshes share it, so a read that/// never returns is asked once, not once a poll.- private var rowsInFlight: Task<[AppSpaceRow], Error>?+ private var rowsInFlight: Task<AppListRead, Error>?/// Registry reads started so far, the one in flight and the newest/// one shown: an older read that answers late is not shown over it.private var rowsReads = 0@@ -798,11 +812,11 @@ public final class AppModel {/// with the number of the read that answered. `fresh`: a new read, not/// one already in flight, which started before the change just made/// and may answer without it.- private func readRows(fresh: Bool = false) async throws -> (rows: [AppSpaceRow], read: Int) {+ private func readRows(fresh: Bool = false) async throws -> (list: AppListRead, read: Int) {if fresh || rowsInFlight == nil {rowsReads += 1rowsInFlightRead = rowsReads- rowsInFlight = Task { [backend] in try await backend.rows() }+ rowsInFlight = Task { [backend] in try await backend.listRead() }}guard let task = rowsInFlight else { throw CancellationError() }let read = rowsInFlightRead@@ -820,21 +834,37 @@ public final class AppModel {/// `fresh` after a change this app made (a create, a delete): the list/// is read again from now, so it shows the change.public func refresh(fresh: Bool = false) async {- await refreshHost()- cloudConfigured = await backend.cloudAvailable()+ // The host's reads run beside the list, never ahead of it: this+ // Mac's Spaces show as soon as the daemon lists them, and "This+ // machine" joins them once the host answered (it recomposes then).+ async let hostRead: Void = refreshHostThenRecompose()+ async let cloud = backend.cloudAvailable()+ defer { followIncompleteList() }do {- let (rows, read) = try await readRows(fresh: fresh)+ let (list, read) = try await readRows(fresh: fresh)lastListOk = listClock()lastListAnswer = lastListOk// A read from before a newer one already shown is out of date.- guard read >= rowsShownRead else { return }+ guard read >= rowsShownRead else {+ cloudConfigured = await cloud+ await hostRead+ return+ }rowsShownRead = readlet now = Int64(Date().timeIntervalSince1970 * 1000)- registrySpaces = appRowsToSpaces(rows: rows, nowMs: now)+ registrySpaces = appRowsToSpaces(rows: list.rows, nowMs: now)creates = appCreatesSettle(state: creates, spaces: registrySpaces)recompose()loaded = true- rosterError = nil+ listIncomplete = list.incomplete+ listReaching = list.reaching+ listStale = list.stale+ // Your other computers could not be read: their rows are the+ // last known ones (this Mac's are current).+ rosterError = list.notice.isEmpty ? nil+ : "Could not reach your other computers. Their Spaces may be out of date."+ cloudConfigured = await cloud+ await hostRead// Your machines' load for their sidebar lines, every so often// (each machine is asked; never holds up the list).if registrySpaces.contains(where: { $0.id.hasPrefix("relay:") }),@@ -859,15 +889,43 @@ public final class AppModel {} catch TimeoutError.timedOut {// The daemon is slow or gone: the list stays as it was, and the// poll reconnects when it stays stale (`checkListHealth`).+ cloudConfigured = await cloud+ await hostRead} catch {if Self.daemonAnswered(error) { lastListAnswer = listClock() }// Errors may contain server bodies or credential-bearing URLs.rosterError = loaded? "Could not refresh Spaces. Previously loaded rows may be out of date.": "Could not load Spaces. Try refreshing again."+ cloudConfigured = await cloud+ await hostRead}}+ /// The host's reads, then the list composed again with what they said+ /// ("This machine").+ private func refreshHostThenRecompose() async {+ await refreshHost()+ if loaded { recompose() }+ }++ /// While some of your computers have not answered, the list is read+ /// again soon (each read waits a moment for them in the daemon), not at+ /// the next poll.+ private var incompleteFollow: Task<Void, Never>?++ private func followIncompleteList() {+ guard listIncomplete, incompleteFollow == nil else { return }+ incompleteFollow = Task { @MainActor [weak self] in+ try? await Task.sleep(for: .milliseconds(Self.incompleteFollowMs))+ guard let self, !Task.isCancelled else { return }+ self.incompleteFollow = nil+ await self.refresh()+ }+ }++ static let incompleteFollowMs = 500+public func select(_ id: String) {selection = .space(id)send(.select(id: id, now: Int64(Date().timeIntervalSince1970 * 1000)))diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swiftindex f7d195fa5c..de8376a5df 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift@@ -609,6 +609,7 @@ public final class PendingSpacesBackend: SpacesBackend, AgentsToolRunning, Cloud}public func rows() async throws -> [AppSpaceRow] { try await b().rows() }+ public func listRead() async throws -> AppListRead { try await b().listRead() }public func create(_ args: AppCreateSpaceArgs, createId: String,progress: @escaping @Sendable (SpaceCreateProgress) -> Void) async throws -> String {try await b().create(args, createId: createId, progress: progress)diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swiftindex 32b11cdac5..68107408fd 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift@@ -14,6 +14,9 @@ import Foundationpublic protocol SpacesBackend: AnyObject, Sendable {/// The registry, one row per Space, with a bounded reachability probe.func rows() async throws -> [AppSpaceRow]+ /// [`rows`] with how far the read got (the SDK's `Spaces.list_known`):+ /// this Mac's Spaces at once, your other computers as they answer.+ func listRead() async throws -> AppListRead/// Creates a Space (`create_space`), reporting the SDK's create progress/// (pulling, booting, waiting for cua-spacesd, connecting) to `progress`/// on an SDK thread until it is ready; returns its id. `createId` (the@@ -150,7 +153,30 @@ public struct ShareLink: Codable, Equatable, Sendable {}}+/// One read of the Space list and how far it got (the SDK's `SpaceList`).+public struct AppListRead: Sendable {+ public var rows: [AppSpaceRow]+ /// Some of your computers have not answered yet: not "no Spaces".+ public var incomplete: Bool+ /// How many computers are still being reached (0 when unknown).+ public var reaching: UInt32+ /// Your other computers' rows are the last known ones.+ public var stale: Bool+ /// Why your other computers could not be read, when they could not.+ public var notice: String++ public init(rows: [AppSpaceRow], incomplete: Bool = false, reaching: UInt32 = 0, stale: Bool = false, notice: String = "") {+ self.rows = rows+ self.incomplete = incomplete+ self.reaching = reaching+ self.stale = stale+ self.notice = notice+ }+}+public extension SpacesBackend {+ /// A backend that lists complete lists only.+ func listRead() async throws -> AppListRead { AppListRead(rows: try await rows()) }func thumbnail(id: String, maxAgeMs: UInt64?) async -> SpaceThumbnailData? { nil }func appIcons(id: String, requests: [SpaceAppIconRequest]) async -> [Data?] { requests.map { _ in nil } }func primaryDisplay(id: String) async -> AppStreamDisplay? { nil }@@ -233,9 +259,20 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {LiveSpacesBackend(cua: try Cua.auto(config: CuaConfig(accountFromSession: true)))}- public func rows() async throws -> [AppSpaceRow] {+ public func rows() async throws -> [AppSpaceRow] { try await listRead().rows }++ /// This Mac's Spaces at once, your other computers as far as they+ /// answered (`Spaces.list_known`): a slow relay or a daemon still+ /// reaching your computers never empties the list.+ public func listRead() async throws -> AppListRead {+ let list = try await cua.spaces().listKnown()+ return AppListRead(rows: await probe(list.spaces), incomplete: list.incomplete,+ reaching: list.reaching, stale: list.stale, notice: list.notice)+ }++ /// The rows of `infos`, each with a bounded reachability probe.+ private func probe(_ infos: [CuaSDK.SpaceInfo]) async -> [AppSpaceRow] {let spaces = cua.spaces()- let infos = try await spaces.list()return await withTaskGroup(of: (Int, AppSpaceRow).self) { group infor (index, info) in infos.enumerated() {group.addTask {@@ -832,6 +869,14 @@ public final class FixtureSpacesBackend: SpacesBackend, @unchecked Sendable {]public func rows() async throws -> [AppSpaceRow] { await MainActor.run { fixtureRows } }+ /// Your other computers still answering, as a daemon reaching them says.+ public var fixtureIncomplete = false+ public var fixtureReaching: UInt32 = 0+ public func listRead() async throws -> AppListRead {+ await MainActor.run {+ AppListRead(rows: fixtureRows, incomplete: fixtureIncomplete, reaching: fixtureReaching, stale: fixtureIncomplete)+ }+ }/// Progress a fixture create reports, in order (the SDK's words).public var createPhases: [SpaceCreateProgress] = [diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swiftindex 0a26b2695d..3b074ec0e3 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/MainWindow.swift@@ -562,6 +562,19 @@ struct EmptySpaces: View {@State private var stacked = falsevar body: some View {+ // Not read yet, or your computers still answering: one quiet line,+ // never "Create your first Space" (the core decides).+ if let line = model.listView.reachingLine, model.rosterError == nil || model.loaded {+ ContentUnavailableView {+ Text(line).font(.callout).foregroundStyle(.secondary)+ }+ .accessibilityIdentifier("spaces-reaching")+ } else {+ empty+ }+ }++ @ViewBuilder private var empty: some View {let chrome = model.chromelet tiles = stacked ? AnyLayout(VStackLayout(spacing: 12)) : AnyLayout(HStackLayout(spacing: 12))ContentUnavailableView {diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swiftindex 48f21dec09..dcc7f96da2 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift@@ -481,6 +481,13 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {"rosterError": model.rosterError ?? NSNull(),// Another app keeps its own daemon and this app uses it (null otherwise)."daemonNotice": model.daemonNotice ?? NSNull(),+ // Some of your computers have not answered yet (`Spaces.list_known`):+ // the page shows what is known and "Reaching N computers…", never+ // "Create your first Space".+ "incomplete": model.listIncomplete,+ "reaching": Int(model.listReaching),+ // Your other computers' rows are the last known ones, not yet confirmed.+ "stale": model.listStale,]}@@ -1044,7 +1051,8 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {func startEvents() {followStartup()follow("spaces.changed") { [weak self, model] in- _ = (model.spaces, model.selectedSpaceId, model.loaded, model.rosterError, model.daemonNotice)+ _ = (model.spaces, model.selectedSpaceId, model.loaded, model.rosterError, model.daemonNotice,+ model.listIncomplete, model.listReaching, model.listStale)self?.pruneStreams()}follow("keyvault.changed") { [model] in _ = (model.keyvault.overview, model.keyvault.busy, model.keyvault.dismissed) }diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/IncompleteListTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/IncompleteListTests.swiftnew file mode 100644index 0000000000..5f3ae1ed9d--- /dev/null+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/IncompleteListTests.swift@@ -0,0 +1,70 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++@testable import CuaSpacesMacKit+import CuaSDK+import CuaSpacesFFI+import Foundation+import Testing++/// Right after an update restarts the daemon, this Mac's Spaces list at once+/// and your other computers answer one by one. Until every one did (or was+/// given up on) the list is not "no Spaces": the model says how far it got,+/// the core decides there is no "Create your first Space" yet, and the web+/// page gets it with `spaces.list`.+@Suite("A list your computers are still answering")+@MainActor+struct IncompleteListTests {+ func model(_ backend: SpacesBackend) -> AppModel {+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-incomplete-\(UUID().uuidString)")+ return AppModel(backend: backend, keyvault: KeyvaultModel(client: nil),+ onboarding: OnboardingModel(statePath: dir.appendingPathComponent("onboarding.json").path),+ settingsPath: dir.appendingPathComponent("settings.json").path,+ telemetry: FixtureTelemetry())+ }++ @Test func beforeTheFirstReadThereIsNoEmptyPage() {+ let m = model(FixtureSpacesBackend(rows: []))+ #expect(!m.loaded)+ #expect(m.listView.empty == false)+ #expect(m.listView.reachingLine == "Loading Spaces…")+ }++ @Test func computersStillAnsweringAreNotAnEmptyAccount() async throws {+ let backend = FixtureSpacesBackend(rows: [])+ backend.fixtureIncomplete = true+ backend.fixtureReaching = 6+ let m = model(backend)+ let bridge = WebUIBridge(model: m, allowedOrigins: [])+ await m.refresh()+ #expect(m.loaded)+ #expect(m.listIncomplete)+ #expect(m.listView.empty == false)+ #expect(m.listView.reachingLine == "Reaching 6 computers…")+ let answer = try #require(try await bridge.handle("spaces.list", [:]) as? [String: Any])+ #expect(answer["incomplete"] as? Bool == true)+ #expect(answer["reaching"] as? Int == 6)+ #expect(answer["loaded"] as? Bool == true)++ // Every computer answered and none has a Space: now it is empty.+ backend.fixtureIncomplete = false+ backend.fixtureReaching = 0+ await m.refresh(fresh: true)+ #expect(!m.listIncomplete)+ #expect(m.listView.empty)+ #expect(m.listView.reachingLine == nil)+ let done = try #require(try await bridge.handle("spaces.list", [:]) as? [String: Any])+ #expect(done["incomplete"] as? Bool == false)+ }++ @Test func theSpacesKnownSoFarShowWhileTheRestAnswer() async {+ let backend = FixtureSpacesBackend(rows: FixtureSpacesBackend.sample)+ backend.fixtureIncomplete = true+ backend.fixtureReaching = 1+ let m = model(backend)+ await m.refresh()+ #expect(!m.spaces.isEmpty)+ #expect(m.listView.empty == false)+ #expect(m.listView.reachingLine == "Reaching 1 computer…")+ }+}diff --git a/apps/cua-spaces-web/src/__tests__/app-harness.tsx b/apps/cua-spaces-web/src/__tests__/app-harness.tsxindex 274374e893..3cfc165bca 100644--- a/apps/cua-spaces-web/src/__tests__/app-harness.tsx+++ b/apps/cua-spaces-web/src/__tests__/app-harness.tsx@@ -11,6 +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 { HostEvent } from "@/bridge/protocol";import { createDemoAdapter, type DemoOptions } from "@/bridge/adapters/demo";import { BridgeProvider, useBridge, useMachines, useSpaces, type SpacesHook } from "@/bridge";@@ -50,6 +51,8 @@ export interface TestHost {intercept?: (op: string, args: unknown) => unknown;/** The Machines page as the host's core drew it (`machinesView`). */machinesView?: () => MachinesView | null;+ /** How far the host's list read got (`listStatus`); undefined: complete. */+ listStatus?: () => ListStatus;/** The demo host's own options (signed out, a first run). */demo?: DemoOptions;}@@ -73,6 +76,7 @@ export async function mountApp(path: string, host: TestHost = { failsCreates: trconst adapter: DataAdapter = {mode: demo.mode,...(host.machinesView ? { machinesView: host.machinesView } : {}),+ ...(host.listStatus ? { listStatus: host.listStatus } : {}),subscribe: (l) => {listeners.add(l);const off = demo.subscribe(l);diff --git a/apps/cua-spaces-web/src/__tests__/spaces-list-incomplete.test.tsx b/apps/cua-spaces-web/src/__tests__/spaces-list-incomplete.test.tsxnew file mode 100644index 0000000000..791c5d8ef7--- /dev/null+++ b/apps/cua-spaces-web/src/__tests__/spaces-list-incomplete.test.tsx@@ -0,0 +1,95 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++// The Spaces page while the list is not complete: right after an app update+// restarts the daemon, before the first read, or while the account's other+// computers are still answering. It shows what is known and one quiet line,+// never "Create your first Space"; that only comes for a complete list with+// no Space, in the grid's place under the warnings and the filters.++import { act, cleanup, screen, waitFor } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import { listView } from "@/bridge";+import type { ListStatus } from "@/bridge/contracts/spaces";+import { noCore, testCore, wasmBuilt } from "@/bridge/__tests__/testCore";+import { mountApp, stubBrowserApis } from "./app-harness";++stubBrowserApis();+afterEach(cleanup);++/** The whole app mounts and settles first (`useQuiet`). */+const WAIT = { timeout: 8000 };++/** A host whose list status the test moves, with no Space or the demo's. */+async function mount(status: { current: ListStatus }, noSpaces: boolean) {+ return mountApp("/spaces", {+ failsCreates: false,+ listsGhost: false,+ demo: { noSpaces },+ listStatus: () => status.current,+ });+}++/** The empty state: the first-run home (with the core) or its plain stand-in. */+const emptyHome = () => document.querySelector("[data-empty-home]") ?? screen.queryByText("No Spaces yet")?.closest("div") ?? null;+const reaching = () => document.querySelector("[data-spaces-reaching]")?.textContent ?? null;+const spacesCount = () => document.querySelector('a[href="/spaces"]')?.textContent ?? "";++describe("the Spaces page while the list is incomplete", { timeout: 30_000 }, () => {+ it("never shows the empty home before the first read or while computers answer", async () => {+ const status = { current: { loaded: false, incomplete: false, reaching: 0, stale: false } };+ const { emit } = await mount(status, true);+ await waitFor(() => expect(reaching()).toBe("Loading Spaces…"), WAIT);+ expect(emptyHome()).toBeNull();+ expect(screen.getByText("Loading Spaces…", { selector: "p:not([data-spaces-reaching])" })).toBeTruthy();+ // No count in the sidebar before the list was read (not "0").+ expect(spacesCount()).not.toMatch(/0/);++ // This machine answered, 6 computers have not yet.+ status.current = { loaded: true, incomplete: true, reaching: 6, stale: false };+ act(() => emit({ type: "spaces.changed" }));+ await waitFor(() => expect(reaching()).toBe("Reaching 6 computers…"), WAIT);+ expect(emptyHome()).toBeNull();++ // Every computer answered and there is no Space: now it is empty.+ status.current = { loaded: true, incomplete: false, reaching: 0, stale: false };+ act(() => emit({ type: "spaces.changed" }));+ await waitFor(() => expect(emptyHome()).not.toBeNull(), WAIT);+ expect(reaching()).toBeNull();+ });++ it("shows the Spaces known so far with the line under them", async () => {+ const status = { current: { loaded: true, incomplete: true, reaching: 1, stale: false } };+ await mount(status, false);+ await waitFor(() => expect(reaching()).toBe("Reaching 1 computer…"), WAIT);+ const grid = document.querySelector("ul.grid");+ expect(grid?.children.length).toBeGreaterThan(0);+ // The line follows the tiles, so they do not move when it goes.+ expect(grid!.compareDocumentPosition(document.querySelector("[data-spaces-reaching]")!) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ expect(emptyHome()).toBeNull();+ });++ it("puts the empty home in the grid's place, under the filters", async () => {+ await mount({ current: { loaded: true, incomplete: false, reaching: 0, stale: false } }, true);+ await waitFor(() => expect(emptyHome()).not.toBeNull(), WAIT);+ const filters = document.querySelector('[aria-label="Filter by state"]')!;+ expect(filters.compareDocumentPosition(emptyHome()!) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ });+});++describe("listView", () => {+ // The core's decision, and the TypeScript stand-in without it, agree.+ const cases: [ListStatus, number, { empty: boolean; reachingLine: string | null }][] = [+ [{ loaded: false, incomplete: false, reaching: 0, stale: false }, 0, { empty: false, reachingLine: "Loading Spaces…" }],+ [{ loaded: true, incomplete: true, reaching: 6, stale: false }, 0, { empty: false, reachingLine: "Reaching 6 computers…" }],+ [{ loaded: true, incomplete: true, reaching: 1, stale: false }, 2, { empty: false, reachingLine: "Reaching 1 computer…" }],+ [{ loaded: true, incomplete: true, reaching: 0, stale: false }, 0, { empty: false, reachingLine: "Reaching your computers…" }],+ [{ loaded: true, incomplete: false, reaching: 0, stale: false }, 0, { empty: true, reachingLine: null }],+ [{ loaded: true, incomplete: false, reaching: 0, stale: false }, 3, { empty: false, reachingLine: null }],+ ];+ it.each(cases)("%o with %i Spaces", async (status, count, want) => {+ expect(listView(noCore, status, count)).toEqual(want);+ if (wasmBuilt) expect(listView(await testCore(), status, count)).toEqual(want);+ });+});diff --git a/apps/cua-spaces-web/src/bridge/adapter.ts b/apps/cua-spaces-web/src/bridge/adapter.tsindex f310fa90ae..03c7692d36 100644--- a/apps/cua-spaces-web/src/bridge/adapter.ts+++ b/apps/cua-spaces-web/src/bridge/adapter.ts@@ -2,6 +2,7 @@// Copyright (c) 2026 Cua AI, Inc.import type { MachinesView } from "./contracts/host";+import type { ListStatus } from "./contracts/spaces";import type { HostEvent, OpArgs, OpName, OpResult } from "./protocol";export type BridgeMode = "tauri" | "electron" | "webkit" | "demo";@@ -33,6 +34,13 @@ export interface DataAdapter {* the host says nothing beyond the list (a failed read rejects instead).*/listNotice?(): string | null;+ /**+ * How far the host's last `spaces.list` got (the SDK's+ * `Spaces.list_known`): whether it was read at all, and whether some of+ * the account's computers have not answered yet. Undefined: the host+ * lists complete lists only.+ */+ listStatus?(): ListStatus;/*** 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 daemondiff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.tsindex 9d03ec7778..5d40ef43b4 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 { SpaceRow } from "../contracts/spaces";+import type { ListStatus, SpaceRow } from "../contracts/spaces";import {isWebkitResponse,WEBKIT_EVENT,@@ -536,12 +536,17 @@ export function createWebkitAdapter(let rosterError: string | null = null;// The host's standing notice (`hostNotice`).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 };// The Machines page the host's core drew (`machinesView`).let machinesView: MachinesView | null = null;const listSpaces = async () => {const answer = await request<WkSpaces>("spaces.list");rosterError = answer.rosterError ?? null;daemonNotice = answer.daemonNotice ?? null;+ // 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 };return answer;};@@ -775,6 +780,7 @@ export function createWebkitAdapter(},subscribe: (l) => events.subscribe(l),listNotice: () => rosterError,+ listStatus: () => listStatus,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.jsonindex 51faf3c6f5..360e051d1b 100644--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json@@ -5083,6 +5083,15 @@"string","null"]+ },+ "incomplete": {+ "type": "boolean"+ },+ "reaching": {+ "type": "number"+ },+ "stale": {+ "type": "boolean"}},"required": [diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.tsindex 6e377493ad..64bd58ff32 100644--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts@@ -1200,7 +1200,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) }),+ 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) }),);const WkSessionShape = ref(diff --git a/apps/cua-spaces-web/src/bridge/contracts/spaces.ts b/apps/cua-spaces-web/src/bridge/contracts/spaces.tsindex 84b64ca844..6c3959d300 100644--- a/apps/cua-spaces-web/src/bridge/contracts/spaces.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/spaces.ts@@ -354,3 +354,33 @@ export type CreateAction =| { type: "power-fail"; id: string; error: string };export const NO_CREATES: CreatesState = { pending: [], deleting: [], powering: [] };++/**+ * How far the host's last `spaces.list` got (the SDK's `Spaces.list_known`).+ * This machine's Spaces come at once; the account's other computers as they+ * answer, so a list can be incomplete for a while (right after the daemon+ * restarts, say). An incomplete list is never "no Spaces".+ */+export interface ListStatus {+ /** The list was read at least once (before that nothing is known). */+ loaded: boolean;+ /** Some of the account's computers have not answered yet. */+ incomplete: boolean;+ /** How many computers are still being reached (0 when unknown). */+ reaching: number;+ /** The other computers' rows are the last known ones (kept across a daemon+ * restart, or from before a failed read), not yet confirmed. */+ stale: boolean;+}++/** What the Spaces page shows besides the Spaces (`spaces::ListView`). */+export interface ListView {+ /** "Create your first Space": a complete list with no Space only. */+ empty: boolean;+ /** One quiet line where the Spaces go while the list is not complete+ * ("Reaching 6 computers…"); null once it is. */+ reachingLine: string | null;+}++/** A host that lists complete lists only (`DataAdapter.listStatus` undefined). */+export const LIST_COMPLETE: ListStatus = { loaded: true, incomplete: false, reaching: 0, stale: false };diff --git a/apps/cua-spaces-web/src/bridge/derive.ts b/apps/cua-spaces-web/src/bridge/derive.tsindex 993563ce97..99a0753b47 100644--- a/apps/cua-spaces-web/src/bridge/derive.ts+++ b/apps/cua-spaces-web/src/bridge/derive.ts@@ -34,7 +34,7 @@ import type {VaultState,VaultView,} from "./contracts/keyvault";-import type { CreateAction, CreatesState, PendingCreate, Space, SpaceOs, SpaceRow, SpaceStatus } from "./contracts/spaces";+import type { CreateAction, CreatesState, ListStatus, ListView, PendingCreate, Space, SpaceOs, SpaceRow, SpaceStatus } from "./contracts/spaces";import type { RelayAllowanceNotice, RelayUsage, RelayUsageView } from "./ops/relay-usage";import type { SessionSnapshot, SettingsSnapshot } from "./protocol";import { notSharingOf, realLimits } from "./sharing";@@ -820,3 +820,25 @@ export function relayUsageView(core: CoreClient, usage: RelayUsage, accountApp:export function planLimitNotice(core: CoreClient, error: string, accountApp: string | null = null): RelayAllowanceNotice | null {return core.tryCall<RelayAllowanceNotice | null>("relayUsage.planLimit", accountApp ? { error, accountApp } : { error }) ?? null;}++/**+ * The Spaces page's empty state and "Reaching N computers…" line+ * (`spaces.listView`): "Create your first Space" only for a complete list+ * with no Space, so a daemon still starting or computers still answering+ * never read as an empty account.+ */+export function listView(core: CoreClient, status: ListStatus, count: number): ListView {+ const input = { loaded: status.loaded, incomplete: status.incomplete, reaching: status.reaching, count };+ return core.tryCall<ListView>("spaces.listView", { input }) ?? fallbackListView(input);+}++function fallbackListView(i: { loaded: boolean; incomplete: boolean; reaching: number; count: number }): ListView {+ const reachingLine = !i.loaded+ ? "Loading Spaces…"+ : !i.incomplete+ ? null+ : i.reaching === 0+ ? "Reaching your computers…"+ : `Reaching ${i.reaching} computer${i.reaching === 1 ? "" : "s"}…`;+ return { empty: i.loaded && !i.incomplete && i.count === 0, reachingLine };+}diff --git a/apps/cua-spaces-web/src/bridge/hooks.ts b/apps/cua-spaces-web/src/bridge/hooks.tsindex a7cffd16c1..83fa1576af 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 type { Space } from "./contracts/spaces";+import { LIST_COMPLETE, type ListStatus, type Space } from "./contracts/spaces";import { hostSetupGuide, type HostSetupGuide, type Machine } from "./derive";import {firstSpaceImages,@@ -145,13 +145,24 @@ export interface SpacesHook extends Resource<Space[]> {/** The host's last registry read failed: why the rows may be out of date* (the SwiftUI app's `rosterError`). Null when it worked. */listNotice: string | null;+ /** 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;/** The host's standing notice (another app keeps its own daemon). Null when none. */hostNotice: string | null;}+/** Nothing read yet (no store). */+const NOT_LOADED: ListStatus = { ...LIST_COMPLETE, loaded: false };+export function useSpaces(): SpacesHook {const ctx = useBridgeContext();const r = useResource<Space[]>("spaces");+ // Read through the store's subscription, not off `ctx.store` in render: the compiler keeps a property read+ // of an unchanged object from an earlier render, and the page would keep "not read yet" forever.+ 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 run = useAction();return {...r,@@ -167,7 +178,8 @@ export function useSpaces(): SpacesHook {deleteSpace: (id, removeOnly) => run((s) => s.deleteSpace(id, removeOnly)),openSpace: (id) => run((s) => s.openSpace(id)),createdId: (id) => ctx.store?.createdId(id),- listNotice: ctx.store?.listNotice ?? null,+ listNotice,+ listStatus,hostNotice: ctx.store?.hostNotice ?? null,};}diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.tsindex 4d4fb24ee5..caf115f6f2 100644--- a/apps/cua-spaces-web/src/bridge/index.ts+++ b/apps/cua-spaces-web/src/bridge/index.ts@@ -38,7 +38,7 @@ export { createAdapter, createDemoAdapter, createElectronAdapter, createTauriAdaexport { detectMode } from "./detect";export { loadCore, type CoreClient, type CoreParity, type CoreStatus, type ParityFlow } from "./core";export type { Machine, HostSetupGuide, KeyvaultAppGroup, KeyvaultViews } from "./derive";-export { machineIdOf } from "./derive";+export { listView, machineIdOf } from "./derive";export type {AgentRunSummary,AgentState,diff --git a/apps/cua-spaces-web/src/bridge/store.ts b/apps/cua-spaces-web/src/bridge/store.tsindex 2af5e52ff1..d2faa3c950 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, SignInFailimport 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 type { CreateAction, CreatesState, Space, SpaceOs, SpaceRow } from "./contracts/spaces";+import { LIST_COMPLETE, type CreateAction, type CreatesState, type ListStatus, type Space, type SpaceOs, type SpaceRow } from "./contracts/spaces";import {INITIAL_VAULT_STATE,agentRows,@@ -249,6 +249,9 @@ export class BridgeStore {private registry: Space[] = [];/** The host's word on its last registry read (`DataAdapter.listNotice`). */private listNoticeText: string | null = null;+ /** 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 };/** The host's standing notice (`DataAdapter.hostNotice`). */private hostNoticeText: string | null = null;private creates: CreatesState = { ...NO_CREATES, streaks: loadCreateStreaks() };@@ -401,6 +404,12 @@ export class BridgeStore {}/** Why the listed Spaces may be out of date (null: the host's last read worked). */+ /** How far the list got: an incomplete one (computers still answering) is+ * never "no Spaces". */+ get listStatus(): ListStatus {+ return this.listStatusValue;+ }+get listNotice(): string | null {return this.listNoticeText;}@@ -448,6 +457,7 @@ export class BridgeStore {case "spaces": {const rows = await this.adapter.call("spaces.list", {});this.listNoticeText = this.adapter.listNotice?.() ?? null;+ this.listStatusValue = this.adapter.listStatus?.() ?? LIST_COMPLETE;this.hostNoticeText = this.adapter.hostNotice?.() ?? null;this.applyRows(rows);break;@@ -1085,6 +1095,7 @@ export class BridgeStore {this.ensured.add("spaces");this.registry = registry;this.creates = creates;+ this.listStatusValue = LIST_COMPLETE;this.set("spaces", { data: composeCreates(this.core, registry, creates), isLoading: false, error: null });}diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.tsindex aa6296495c..509630ca3d 100644--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts@@ -272,6 +272,15 @@ export interface WkSpaces {/** Another app keeps its own daemon running and this app uses it* (`AppModel.daemonNotice`): a line above every page. Null otherwise. */daemonNotice?: string | null;+ /** Some of the account's computers have not answered the last read yet+ * (`Spaces.list_known`): the list may grow, and is not "no Spaces".+ * Absent from a host that lists complete lists only. */+ incomplete?: boolean;+ /** How many computers are still being reached (0 when unknown). */+ reaching?: number;+ /** Your other computers' rows are the last known ones (kept across a+ * daemon restart), not yet confirmed by the relay. */+ stale?: boolean;}/** `machines.list`: the sidebar and the account's devices. */diff --git a/apps/cua-spaces-web/src/components/shell/sidebar.tsx b/apps/cua-spaces-web/src/components/shell/sidebar.tsxindex ec001f38c5..3a906f3068 100644--- a/apps/cua-spaces-web/src/components/shell/sidebar.tsx+++ b/apps/cua-spaces-web/src/components/shell/sidebar.tsx@@ -26,10 +26,13 @@ import { SidebarGetStarted } from "@/components/getting-started";export function Sidebar() {const width = useUiStore((s) => s.sidebarWidth);- const { data: spaces } = useSpaces();+ const { data: spaces, listStatus } = useSpaces();const { data: machines } = useMachines();const notifications = useNotifications();- const counts: Partial<Record<string, number>> = { "/spaces": spaces && realSpaces(spaces).length, "/machines": machines?.length };+ // No count before the list was read (not "0" while the daemon starts); while computers still answer, the+ // Spaces known so far.+ const spacesCount = spaces && listStatus.loaded ? realSpaces(spaces).length : undefined;+ const counts: Partial<Record<string, number>> = { "/spaces": spacesCount, "/machines": machines?.length };const navItems = useNavItems();const unread = notifications.data?.unread ?? 0;diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsxindex 1d4aa9558e..b6708dca60 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 } from "@tanstack/react-router";import { ArrowDownCircleIcon, KeyRoundIcon, LoaderCircleIcon, MonitorIcon, PlusIcon, PowerIcon, SearchIcon } from "lucide-react";import { useEffect, useRef, useState, type DragEvent } from "react";-import { emptyHome, spaceResources, useAgents, useBridge, useChecklist, useResources, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaceFiles, useSpaces, useSpaceThumbnail, useWindowDropTarget, type Space } from "@/bridge";+import { emptyHome, listView, spaceResources, useAgents, useBridge, useChecklist, useResources, useFirstSpaceOffers, useMachines, useNewSpaceWizard, useSpaceAccess, useSpaceFiles, useSpaces, useSpaceThumbnail, useWindowDropTarget, type Space } from "@/bridge";import { EmptyHome } from "@/components/empty-home";import { ConnectAgentDialog } from "@/components/agents/connect-dialog";import { RunAgentDialog } from "@/components/agents/run-agent-dialog";@@ -42,7 +42,7 @@ const FILTERS: { value: SpaceFilter; label: string }[] = [];function SpacesPage() {- const { data: all = [], isLoading, error, listNotice } = useSpaces();+ const { data: all = [], isLoading, error, listNotice, listStatus } = useSpaces();// Machines' own desktops are on Machines, not here.const spaces = realSpaces(all);const { data: machines = [] } = useMachines();@@ -73,8 +73,15 @@ function SpacesPage() {const offer = useAgentOffer(Boolean(readySpace) && !agentsLoading && !agentRan);const runHere = readySpace && !agentRan && offer.visible ? readySpace : undefined;const [runOpen, setRunOpen] = useState(false);+ // The core decides: "Create your first Space" only for a complete list with no Space. A daemon still+ // starting (an app update) or computers still answering show what is known and one quiet line instead.+ 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);// No Spaces yet (or the list could not be read): the SwiftUI app's empty home, as the first-run guide.- const guide = !error && !isLoading && spaces.length === 0 && home && home.tiles.length > 0 ? home : null;+ const guide = empty && home && home.tiles.length > 0 ? home : null;+ const reachingLine = error || unread ? null : view.reachingLine;// The suggested task's request, while the run dialog was opened from it.const [runPrompt, setRunPrompt] = useState<string | undefined>();const firstRunStep = useFirstRunStep();@@ -83,14 +90,14 @@ function SpacesPage() {// The cards above the list (ready, checklist, computers) and the list come from separate host reads. Draw them// together once those have answered, not one by one with the page jumping at each (CUA-1951).const settled = useQuiet(- [isLoading, all.length, machines.length, Object.keys(checklist.done).length, checklist.dismissed, agents?.runs.length, agents?.agents.length, resources ? 1 : 0].join("|"),+ [isLoading, listStatus.loaded, all.length, machines.length, Object.keys(checklist.done).length, checklist.dismissed, agents?.runs.length, agents?.agents.length, resources ? 1 : 0].join("|"),);return (<Page><PageHeadertitle="Spaces"- description={isLoading ? "Loading Spaces…" : `${plural(spaces.length, "Space")} on ${plural(machines.length, "computer")}, ${running} running`}+ description={isLoading || !listStatus.loaded ? "Loading Spaces…" : `${plural(spaces.length, "Space")} on ${plural(machines.length, "computer")}, ${running} running`}actions={<Button onClick={newSpace}><PlusIcon /> New Space@@ -99,8 +106,6 @@ function SpacesPage() {/>{settled ? (<>- {/* No Spaces yet: the guided first run comes first, above the checklist and computers (CUA-2062). */}- {guide ? <EmptyHome home={guide} unread={Boolean(listNotice)} /> : null}{runHere ? <SpaceReadyCardspace={runHere}onRun={(task) => {@@ -148,11 +153,15 @@ function SpacesPage() {/></div></div>+ {/* The empty home and the "Reaching N computers…" line take the grid's place, under the warnings and the+ filters. */}{error ? (<EmptyState icon={<MonitorIcon />} title="Couldn't load Spaces">{error.message}</EmptyState>- ) : isLoading || guide ? null : spaces.length === 0 ? (+ ) : isLoading ? null : guide ? (+ <EmptyHome home={guide} unread={Boolean(listNotice)} />+ ) : spaces.length === 0 && !empty ? null : spaces.length === 0 ? (<EmptyStateicon={<MonitorIcon />}title="No Spaces yet"@@ -181,6 +190,11 @@ function SpacesPage() {))}</ul>)}+ {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}+ </p>+ ) : null}</>) : null}</Page>diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdxindex 51d0ec6d5c..a31fc02fe4 100644--- a/docs/content/docs/cua-sdk/reference/index.mdx+++ b/docs/content/docs/cua-sdk/reference/index.mdx@@ -93,4 +93,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`). |-335 items, 418 methods. The [Types](/cua-sdk/reference/types) page lists them.+336 items, 419 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.mdxindex 359f9b9464..f73263b28d 100644--- a/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx@@ -389,7 +389,9 @@ Response for `SpaceService.AddSpace`.Request for `SpaceService.ListSpaces`.-No fields.+| Field | # | Type | Description |+| --- | --- | --- | --- |+| `known_now` | 1 | `bool` | Answer with what is known now: this machine's Spaces at once, the account's other computers as far as they answered within a moment (the response says how far it got). Without it the daemon waits for the relay and fails when it cannot be read. |### ListSpacesResponse@@ -398,6 +400,10 @@ Response for `SpaceService.ListSpaces`.| Field | # | Type | Description || --- | --- | --- | --- || `spaces` | 1 | repeated [`Space`](#space) | Spaces. |+| `incomplete` | 2 | `bool` | `known_now` only: some of the account's computers have not answered yet, so the list may grow (an empty one is not "no Spaces"). |+| `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. |### NamedVolumediff --git a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdxindex eff81fda4b..9651e27b97 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), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-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), [`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), [`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), [`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), [`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).## Typesdiff --git a/docs/content/docs/cua-sdk/reference/spaces/index.mdx b/docs/content/docs/cua-sdk/reference/spaces/index.mdxindex 5ba51ab95d..59d94b1b27 100644--- a/docs/content/docs/cua-sdk/reference/spaces/index.mdx+++ b/docs/content/docs/cua-sdk/reference/spaces/index.mdx@@ -34,6 +34,7 @@ Returned by [`Cua.spaces`](/cua-sdk/reference/cua#cua).| [`gpu_support`](#spacesgpu_support) | The GPU options each runtime of `on` (`local` by default, or `cloud`) offers on this host: Lume's "GPU acceleration" for macOS VMs (experimental, Apple silicon), QEMU's virgl and containers' NVIDIA GPUs on Linux. || [`hosts`](#spaceshosts) | Your machines that provide Spaces (the account's relay hosts, then the hosts added by their Tailscale or LAN address), each asked for its limits: what `create` takes as `on="host:<id>"`. || [`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). |@@ -681,6 +682,56 @@ pub async fn list(&self) -> Result<Vec<SpaceInfo>, CuaError>**Returns** [`Vec<SpaceInfo>`](#spaceinfo-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)+### `Spaces.list_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). A slow or unreachable relay never holds+up or fails this machine's own Spaces, so an app shows them right+away and reads again while the list is incomplete. `Spaces.list`+waits for every computer instead.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+async def list_known(self) -> SpaceList+```++</Tab>+<Tab value="TypeScript">++```ts+listKnown(asyncOpts_?: { signal: AbortSignal }): Promise<SpaceList>+```++</Tab>+<Tab value="Swift">++```swift+func listKnown() async throws -> SpaceList+```++</Tab>+<Tab value="Kotlin">++```kotlin+@Throws(CuaException::class)+suspend fun listKnown(): SpaceList+```++</Tab>+<Tab value="Rust">++```rust+pub async fn list_known(&self) -> Result<SpaceList, CuaError>+```++</Tab>+</Tabs>++**Returns** [`SpaceList`](#spacelist-record) · **Async** · **Raises** [`CuaError`](/cua-sdk/reference/errors)+### `Spaces.list_tools_json`The Spaces MCP `tools/list` result as JSON (the contract).@@ -1119,6 +1170,20 @@ Returned by [`Space.info`](/cua-sdk/reference/spaces/space#space), [`Spaces.add`| `egress_enforced` / `egressEnforced` | [`Option<EgressEnforcement>`](/cua-sdk/reference/spaces/space#egressenforcement-enum) | | Where `egress` is enforced; `None` without one. || `volumes` | [`Vec<VolumeMount>`](/cua-sdk/reference/spaces/volume#volumemount-record) | | Named volumes mounted in the Space (see `SpaceCreateOptions.volumes`). |+## `SpaceList` record++The Spaces known now (`Spaces.list_known`) and how far the read got.++Returned by [`Spaces.list_known`](#spaceslist_known).++| Field | Type | Default | Description |+| --- | --- | --- | --- |+| `spaces` | [`Vec<SpaceInfo>`](#spaceinfo-record) | | This machine's Spaces, and the account's other computers' as far as they answered (the last known ones meanwhile). |+| `incomplete` | `bool` | | Some of the account's computers have not answered yet: the list may grow, and an empty one is not "no Spaces". Always false from a daemon that predates it (it answers once every computer did). |+| `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. |+## `SpacePowerReport` recordWhat `Spaces.stop` or `Spaces.start` did.diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdxindex eb5d31b4ba..e1b421f6a9 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-307 items. Methods are listed on their object.+308 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).@@ -295,6 +295,7 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref| [`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`). |diff --git a/libs/cua-spacesd/tests/spaces-e2e/tests/daemon_spaces.rs b/libs/cua-spacesd/tests/spaces-e2e/tests/daemon_spaces.rsindex 4f17feaa7a..a1629d10cf 100644--- a/libs/cua-spacesd/tests/spaces-e2e/tests/daemon_spaces.rs+++ b/libs/cua-spacesd/tests/spaces-e2e/tests/daemon_spaces.rs@@ -92,12 +92,20 @@ async fn space_service_delegates_to_cua_spaces_and_the_passthrough_carries_credeassert!(json.contains(&added.id) && !json.contains(TOKEN));let listed = svc- .list_spaces(pb::ListSpacesRequest {})+ .list_spaces(pb::ListSpacesRequest::default()).await.unwrap().into_inner().spaces;assert_eq!(listed, vec![added.clone()]);+ // `known_now`: the same rows, complete (no account to reach).+ let known = svc+ .list_spaces(pb::ListSpacesRequest { known_now: true })+ .await+ .unwrap()+ .into_inner();+ assert_eq!(known.spaces, vec![added.clone()]);+ assert!(!known.incomplete && !known.stale && known.reaching == 0 && known.notice.is_empty());let resolved = svc.resolve_space(pb::ResolveSpaceRequest {space: "svc".into(),@@ -207,7 +215,7 @@ async fn space_service_delegates_to_cua_spaces_and_the_passthrough_carries_crede.message;assert!(msg.contains(&added.id));assert!(- svc.list_spaces(pb::ListSpacesRequest {})+ svc.list_spaces(pb::ListSpacesRequest::default()).await.unwrap().into_inner()@@ -424,7 +432,7 @@ async fn space_service_lists_the_accounts_relay_machines() {let c = client(&h);let listed = c.spaces()- .list_spaces(pb::ListSpacesRequest {})+ .list_spaces(pb::ListSpacesRequest::default()).await.unwrap().into_inner()@@ -447,6 +455,18 @@ async fn space_service_lists_the_accounts_relay_machines() {.space.unwrap();assert_eq!(resolved.id, row.id);+ // `known_now`: the relay answered within the wait, so the list is complete.+ let known = c+ .spaces()+ .list_spaces(pb::ListSpacesRequest { known_now: true })+ .await+ .unwrap()+ .into_inner();+ assert!(known.spaces.iter().any(|s| s.id == row.id), "{known:?}");+ assert!(+ !known.incomplete && !known.stale && known.notice.is_empty(),+ "{known:?}"+ );// A configured account that loses authentication must not look like// successful empty discovery.rt.spaces().set_relay(Some(cua_spaces::RelayAccount::new(@@ -455,7 +475,7 @@ async fn space_service_lists_the_accounts_relay_machines() {)));let error = c.spaces()- .list_spaces(pb::ListSpacesRequest {})+ .list_spaces(pb::ListSpacesRequest::default()).await.unwrap_err();assert_eq!(error.code(), tonic::Code::Unauthenticated);@@ -463,11 +483,27 @@ async fn space_service_lists_the_accounts_relay_machines() {error.message(),"Relay authentication failed. Sign in again to refresh your computers.");+ // `known_now` never fails this machine's list over it: the last known+ // computers stay, stale, and the response says why.+ let known = c+ .spaces()+ .list_spaces(pb::ListSpacesRequest { known_now: true })+ .await+ .unwrap()+ .into_inner();+ assert!(known.spaces.iter().any(|s| s.id == row.id), "{known:?}");+ assert!(!known.incomplete && known.stale, "{known:?}");+ assert!(+ known+ .notice+ .contains("Relay authentication failed. Sign in again to refresh your computers."),+ "{known:?}"+ );// Explicitly disabling relay discovery still permits a local-only list.rt.spaces().set_relay(None);let listed = c.spaces()- .list_spaces(pb::ListSpacesRequest {})+ .list_spaces(pb::ListSpacesRequest::default()).await.unwrap().into_inner()diff --git a/libs/cua/crates/cua-cli/src/host.rs b/libs/cua/crates/cua-cli/src/host.rsindex 98fc1a70e3..5b015adfa3 100644--- a/libs/cua/crates/cua-cli/src/host.rs+++ b/libs/cua/crates/cua-cli/src/host.rs@@ -2922,7 +2922,10 @@ async fn power_from_daemon(list: &mut [cua_spaces::SpaceInfo]) {let client = cua_daemon::client::existing_daemon().await.ok()?;let r = client.spaces()- .list_spaces(cua_proto::daemon::v1::ListSpacesRequest {})+ .list_spaces(cua_proto::daemon::v1::ListSpacesRequest {+ // Only the power of this machine's rows is read here.+ known_now: true,+ }).await.ok()?;Some(r.into_inner().spaces)diff --git a/libs/cua/crates/cua-daemon/src/spaces_svc.rs b/libs/cua/crates/cua-daemon/src/spaces_svc.rsindex f7988b15fe..fc95a9f849 100644--- a/libs/cua/crates/cua-daemon/src/spaces_svc.rs+++ b/libs/cua/crates/cua-daemon/src/spaces_svc.rs@@ -338,23 +338,43 @@ mod imp {async fn list_spaces(&self,- _: tonic::Request<pb::ListSpacesRequest>,+ req: tonic::Request<pb::ListSpacesRequest>,) -> R<pb::ListSpacesResponse> {+ let known_now = req.into_inner().known_now;let mut spaces = self.spaces().registry().list().map_err(|e| st(e.into()))?;for s in &mut spaces {(s.power, s.power_state) = self.spaces().power_of(&s.id);s.stop_reason = self.spaces().stop_reason_of(&s.id);}self.spaces().fill_records(&mut spaces);- // Plus the signed-in account's relay machines (refreshed).- for info in self.spaces().list_all().await.map_err(|e| st(e.into()))? {+ // 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 l = self+ .spaces()+ .list_known(cua_spaces::LIST_WAIT)+ .await+ .map_err(|e| st(e.into()))?;+ (l.spaces, l.progress)+ } else {+ let all = self.spaces().list_all().await.map_err(|e| st(e.into()))?;+ (all, cua_spaces::ListProgress::default())+ };+ for info in others {if info.provider == cua_spaces::Provider::Relay&& !spaces.iter().any(|s| s.id == info.id){spaces.push(info_record(&info));}}- ok(pb::ListSpacesResponse { spaces })+ ok(pb::ListSpacesResponse {+ spaces,+ incomplete: progress.incomplete,+ reaching: progress.reaching,+ stale: progress.stale,+ notice: progress.notice,+ })}async fn list_volumes(diff --git a/libs/cua/crates/cua-sdk/src/native/spaces.rs b/libs/cua/crates/cua-sdk/src/native/spaces.rsindex e7ad8f7a55..37b203cfff 100644--- a/libs/cua/crates/cua-sdk/src/native/spaces.rs+++ b/libs/cua/crates/cua-sdk/src/native/spaces.rs@@ -266,6 +266,25 @@ pub struct SpaceTransport {pub fallback_reason: String,}+/// The Spaces known now ([`Spaces::list_known`]) and how far the read got.+#[derive(Debug, Clone, Default, PartialEq, Eq, uniffi::Record)]+pub struct SpaceList {+ /// This machine's Spaces, and the account's other computers' as far as+ /// they answered (the last known ones meanwhile).+ pub spaces: Vec<SpaceInfo>,+ /// Some of the account's computers have not answered yet: the list may+ /// grow, and an empty one is not "no Spaces". Always false from a+ /// daemon that predates it (it answers once every computer did).+ pub incomplete: bool,+ /// How many computers are still being reached (0 when unknown).+ pub reaching: u32,+ /// The other computers' rows are the last known ones, not yet+ /// confirmed by the relay.+ pub stale: bool,+ /// Why the account's computers could not be read, when they could not.+ pub notice: String,+}+/// A registered Space.#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record, Deserialize)]pub struct SpaceInfo {@@ -2865,7 +2884,7 @@ impl Spaces {Host::Embedded(s) => Ok(s.list_all().await?.into_iter().map(Into::into).collect()),Host::Daemon(d) => Ok(d.spaces()- .list_spaces(dpb::ListSpacesRequest {})+ .list_spaces(dpb::ListSpacesRequest::default()).await.map_err(daemon_err)?.into_inner()@@ -2878,6 +2897,46 @@ impl Spaces {.await}+ /// 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). A slow or unreachable relay never holds+ /// up or fails this machine's own Spaces, so an app shows them right+ /// away and reads again while the list is incomplete. [`Spaces::list`]+ /// waits for every computer instead.+ pub async fn list_known(&self) -> Result<SpaceList> {+ let host = self.host.clone();+ run(async move {+ match &host {+ Host::Embedded(s) => {+ let l = s.list_known(cua_spaces::LIST_WAIT).await?;+ Ok(SpaceList {+ spaces: l.spaces.into_iter().map(Into::into).collect(),+ incomplete: l.progress.incomplete,+ reaching: l.progress.reaching,+ stale: l.progress.stale,+ notice: l.progress.notice,+ })+ }+ Host::Daemon(d) => {+ let r = d+ .spaces()+ .list_spaces(dpb::ListSpacesRequest { known_now: true })+ .await+ .map_err(daemon_err)?+ .into_inner();+ Ok(SpaceList {+ spaces: r.spaces.into_iter().map(Into::into).collect(),+ incomplete: r.incomplete,+ reaching: r.reaching,+ stale: r.stale,+ notice: r.notice,+ })+ }+ }+ })+ .await+ }+/// The named volumes of Cua Volume, by name, with the Spaces that mount/// each. Needs Cua Spaces (the Cua Volume).pub async fn volumes(&self) -> Result<Vec<NamedVolume>> {diff --git a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rsindex 72172f94ec..6295a9017f 100644--- a/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/dispatch.rs@@ -42,6 +42,7 @@ pub const METHODS: &[&str] = &["spaces.countActive","spaces.ambientDots","spaces.statusLine",+ "spaces.listView","roster.initial","roster.reduce","creates.reduce",@@ -385,6 +386,7 @@ pub fn call_value(method: &str, args: Value) -> Result<Value, CoreError> {"spaces.countActive" => out(spaces::count_active(&a.get::<Vec<Space>>("spaces")?)),"spaces.ambientDots" => out(spaces::ambient_dots(&a.get::<Vec<Space>>("spaces")?)),"spaces.statusLine" => out(spaces::status_line(a.get("count")?)),+ "spaces.listView" => out(spaces::list_view(a.get("input")?)),"roster.initial" => out(roster::initial(&a.get::<Vec<Space>>("spaces")?)),"roster.reduce" => out(roster::reduce(&a.get("state")?, &a.get("action")?)),"localNetwork.applies" => out(local_network::applies(diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rsindex 546362ef95..d7c26bf881 100644--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/mod.rs@@ -505,10 +505,105 @@ pub fn status_line(spaces: u32) -> String {}}+/// How far the Space list read got (the SDK's `Spaces.list_known`), and+/// how many Spaces it listed.+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase", default)]+pub struct ListViewInput {+ /// The list was read at least once: before that nothing is known, not+ /// even this machine's Spaces.+ pub loaded: bool,+ /// Some of the account's computers have not answered yet.+ pub incomplete: bool,+ /// How many computers are still being reached (0 when unknown).+ pub reaching: u32,+ /// Spaces listed now.+ pub count: u32,+}++/// What the Spaces page shows besides the Spaces themselves.+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]+#[serde(rename_all = "camelCase")]+pub struct ListView {+ /// "Create your first Space": only when the list is complete and has no+ /// Space. A list still loading, or with computers still answering, is+ /// not empty yet (an app update restarting the daemon must not show it).+ pub empty: bool,+ /// One quiet line where the Spaces go while the list is not complete+ /// ("Reaching 6 computers…"), below what is known so far.+ pub reaching_line: Option<String>,+}++/// The Spaces page's empty state and "Reaching N computers…" line, for+/// every shell.+pub fn list_view(input: ListViewInput) -> ListView {+ let reaching_line = if !input.loaded {+ Some("Loading Spaces…".to_string())+ } else if input.incomplete {+ Some(match input.reaching {+ 0 => "Reaching your computers…".to_string(),+ 1 => "Reaching 1 computer…".to_string(),+ n => format!("Reaching {n} computers…"),+ })+ } else {+ None+ };+ ListView {+ empty: input.loaded && !input.incomplete && input.count == 0,+ reaching_line,+ }+}+#[cfg(test)]mod tests {use super::*;+ #[test]+ fn the_empty_page_shows_only_for_a_complete_list() {+ let v = |loaded, incomplete, reaching, count| {+ list_view(ListViewInput {+ loaded,+ incomplete,+ reaching,+ count,+ })+ };+ // Not read yet: never empty, one quiet line.+ assert_eq!(+ v(false, false, 0, 0),+ ListView {+ empty: false,+ reaching_line: Some("Loading Spaces…".into())+ }+ );+ // Computers still answering: never empty, even with no Space yet.+ assert_eq!(+ v(true, true, 6, 0),+ ListView {+ empty: false,+ reaching_line: Some("Reaching 6 computers…".into())+ }+ );+ assert_eq!(+ v(true, true, 1, 2).reaching_line.as_deref(),+ Some("Reaching 1 computer…")+ );+ assert_eq!(+ v(true, true, 0, 0).reaching_line.as_deref(),+ Some("Reaching your computers…")+ );+ assert!(!v(true, true, 3, 0).empty);+ // Complete: empty only with no Space, and no line.+ assert_eq!(+ v(true, false, 0, 0),+ ListView {+ empty: true,+ reaching_line: None+ }+ );+ assert_eq!(v(true, false, 0, 2), ListView::default());+ }+fn row() -> SpaceRow {SpaceRow {id: "space://cloud/cua-spaces-abc/brave-otter".into(),diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rsindex 05cc57aebb..032a989e8a 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs@@ -36,6 +36,13 @@ pub fn app_status_line(count: u32) -> String {core::spaces::status_line(count)}+/// The Spaces page's empty state and "Reaching N computers…" line: the+/// first-run page only for a complete list with no Space.+#[uniffi::export]+pub fn app_spaces_list_view(input: AppListViewInput) -> AppListView {+ core::spaces::list_view(input)+}+/// The ambient status dots.#[uniffi::export]pub fn app_ambient_dots(spaces: Vec<AppSpace>) -> AppAmbientDots {diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rsindex b39f480f4c..1540347a86 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs@@ -382,6 +382,35 @@ pub struct AppAmbientDots {pub agent_active: bool,}+/// How far the Space list read got (the SDK's `Spaces.list_known`), and+/// how many Spaces it listed.+pub type AppListViewInput = core::spaces::ListViewInput;+#[uniffi::remote(Record)]+pub struct AppListViewInput {+ /// The list was read at least once: before that nothing is known, not+ /// even this machine's Spaces.+ pub loaded: bool,+ /// Some of the account's computers have not answered yet.+ pub incomplete: bool,+ /// How many computers are still being reached (0 when unknown).+ pub reaching: u32,+ /// Spaces listed now.+ pub count: u32,+}++/// What the Spaces page shows besides the Spaces themselves.+pub type AppListView = core::spaces::ListView;+#[uniffi::remote(Record)]+pub struct AppListView {+ /// "Create your first Space": only when the list is complete and has no+ /// Space. A list still loading, or with computers still answering, is+ /// not empty yet (an app update restarting the daemon must not show it).+ pub empty: bool,+ /// One quiet line where the Spaces go while the list is not complete+ /// ("Reaching 6 computers…"), below what is known so far.+ pub reaching_line: Option<String>,+}+/// What a notice is about.pub type AppNoticeKind = core::spaces::roster::NoticeKind;#[uniffi::remote(Enum)]diff --git a/libs/cua/crates/cua-spaces/src/lib.rs b/libs/cua/crates/cua-spaces/src/lib.rsindex c83b9b5347..896399229e 100644--- a/libs/cua/crates/cua-spaces/src/lib.rs+++ b/libs/cua/crates/cua-spaces/src/lib.rs@@ -80,6 +80,7 @@ pub mod host_jobs;pub mod host_spaces;pub mod id;pub mod lifetimes;+pub mod listing;mod local_load;pub mod mesh;pub mod named_volumes;@@ -138,6 +139,7 @@ pub use app_icon::{AppIcon, IconRequest};pub use creating::{CancelOutcome, CancelState};pub use error::{Error, Result};pub use id::{Provider, SpaceId};+pub use listing::{LIST_WAIT, ListProgress, SpaceListing};pub use relay::{RelayAccount, RelayMachine};pub use route::{ChannelRoute, Transport};pub use space::{SPACESD_FEATURE, ServiceSource, Space, SpaceInfo, SpacePower, SpaceService};diff --git a/libs/cua/crates/cua-spaces/src/listing.rs b/libs/cua/crates/cua-spaces/src/listing.rsnew file mode 100644index 0000000000..e11b772023--- /dev/null+++ b/libs/cua/crates/cua-spaces/src/listing.rs@@ -0,0 +1,518 @@+//! The Space list as known now ([`Spaces::list_known`]).+//!+//! This machine's own Spaces are in the registry, a local file: they are+//! listed at once. The account's other computers come from the relay+//! directory, a network read that can take long (the relay or the mesh+//! still connecting right after a daemon restart). A list that waits for+//! it shows nothing at all meanwhile, not even this machine's Spaces, and+//! an app reading that as "no Spaces" draws its first-run page.+//!+//! So the read of the account's computers runs on its own (one at a time,+//! [`Spaces::list_known`] waits for it only a moment), the directory it+//! last answered is kept in `relay-directory.json` across restarts, and+//! every listing says how far it got ([`ListProgress`]): whether some+//! computers have not answered yet (the list is incomplete, and an app+//! must not call it empty), how many, and whether the rows of the other+//! computers are the last known ones rather than this process's own read.++use std::sync::Arc;+use std::time::{Duration, Instant};++use tokio::sync::watch;++use crate::{Result, SpaceInfo, Spaces};++/// The relay directory as last read, so a restarted process lists the+/// account's computers before the relay answers again.+pub(crate) const RELAY_DIRECTORY_FILE: &str = "relay-directory.json";++/// How long a list read waits for the account's computers before it+/// answers with what it knows. The relay normally answers well within it.+pub const LIST_WAIT: Duration = Duration::from_millis(1500);++/// How far a listing got.+#[derive(Clone, Debug, Default, PartialEq, Eq)]+pub struct ListProgress {+ /// Some of the account's computers have not answered yet: the list may+ /// grow, and an empty one is not "no Spaces".+ pub incomplete: bool,+ /// How many computers are still being reached (0 when unknown, or when+ /// the list is complete).+ pub reaching: u32,+ /// The other computers' rows are the last known ones (from before this+ /// process, or from before a failed read), not confirmed by the relay.+ pub stale: bool,+ /// Why the account's computers could not be read, when they could not+ /// (the list is complete as far as it goes; this machine's Spaces are+ /// in it).+ pub notice: String,+}++/// The Spaces known now, and how far the read got.+#[derive(Clone, Debug, Default)]+pub struct SpaceListing {+ pub spaces: Vec<SpaceInfo>,+ pub progress: ListProgress,+}++/// How a read of the account's computers ended.+#[derive(Clone, Debug, PartialEq, Eq)]+pub(crate) enum RoundEnd {+ /// The relay answered (or there is no account to ask).+ Answered,+ /// It could not be read: why.+ Failed(String),+}++/// The read of the account's computers in flight, and the last that ended.+#[derive(Default)]+pub(crate) struct AccountRounds {+ in_flight: std::sync::Mutex<Option<watch::Receiver<Option<RoundEnd>>>>,+ last: std::sync::Mutex<Option<(Instant, RoundEnd)>>,+}++impl AccountRounds {+ /// Another account: its first read is still ahead.+ pub(crate) fn reset(&self) {+ *self.in_flight.lock().expect("rounds") = None;+ *self.last.lock().expect("rounds") = None;+ }+}++/// What `relay-directory.json` holds.+#[derive(serde::Serialize, serde::Deserialize)]+struct SavedDirectory {+ /// The relay it was read from (a directory of another relay is not+ /// listed).+ relay: String,+ machines: Vec<crate::relay::RelayMachine>,+}++/// The directory saved for `relay`, when there is one.+pub(crate) fn load_directory(+ home: &std::path::Path,+ relay: &str,+) -> Vec<crate::relay::RelayMachine> {+ std::fs::read(home.join(RELAY_DIRECTORY_FILE))+ .ok()+ .and_then(|b| serde_json::from_slice::<SavedDirectory>(&b).ok())+ .filter(|d| d.relay == relay)+ .map(|d| d.machines)+ .unwrap_or_default()+}++/// Keeps the directory `relay` answered. Best effort.+pub(crate) fn save_directory(+ home: &std::path::Path,+ relay: &str,+ machines: &[crate::relay::RelayMachine],+) {+ let path = home.join(RELAY_DIRECTORY_FILE);+ let write = || -> Result<()> {+ cua_home::guard_write(&path)?;+ let saved = SavedDirectory {+ relay: relay.to_string(),+ machines: machines.to_vec(),+ };+ cua_home::write_private(&path, &serde_json::to_vec_pretty(&saved)?)?;+ Ok(())+ };+ if let Err(e) = write() {+ tracing::debug!(error = %e, "{RELAY_DIRECTORY_FILE} not written");+ }+}++/// Forgets the saved directory (signed out: the account's computers are not+/// listed any more).+pub(crate) fn forget_directory(home: &std::path::Path) {+ let path = home.join(RELAY_DIRECTORY_FILE);+ if path.exists() && cua_home::guard_write(&path).is_ok() {+ let _ = std::fs::remove_file(path);+ }+}++impl Spaces {+ /// The Spaces known now: this machine's at once, and the account's other+ /// computers as far as they answered within `wait`.+ ///+ /// Unlike [`Spaces::list_all`], a slow or unreachable relay never holds+ /// up this machine's own Spaces, and never fails the list: the other+ /// computers' rows are the last known ones meanwhile (also across a+ /// restart, from `relay-directory.json`), and [`ListProgress`] says so.+ /// The read it starts goes on after `wait`; the next call picks up its+ /// answer. Once one read has ended, later calls answer with the last+ /// read's rows while the next one runs, so a relay slower than `wait`+ /// does not make every list incomplete.+ pub async fn list_known(&self, wait: Duration) -> Result<SpaceListing> {+ let mut round = self.account_round();+ let ended = tokio::time::timeout(wait, round.wait_for(Option::is_some))+ .await+ .ok()+ .and_then(|r| r.ok().and_then(|v| v.clone()));+ let end = ended.or_else(|| {+ self.inner+ .rounds+ .last+ .lock()+ .expect("rounds")+ .as_ref()+ .map(|(_, e)| e.clone())+ });+ let spaces = self.list()?;+ let confirmed = self+ .inner+ .relay_confirmed+ .load(std::sync::atomic::Ordering::Acquire);+ let others = !self+ .inner+ .relay_cache+ .lock()+ .expect("relay cache")+ .is_empty();+ let progress = match end {+ None => ListProgress {+ incomplete: true,+ reaching: self.computers_to_reach(),+ stale: others && !confirmed,+ notice: String::new(),+ },+ Some(RoundEnd::Answered) => ListProgress {+ stale: others && !confirmed,+ ..ListProgress::default()+ },+ Some(RoundEnd::Failed(why)) => ListProgress {+ incomplete: false,+ reaching: 0,+ stale: others,+ notice: why,+ },+ };+ Ok(SpaceListing { spaces, progress })+ }++ /// The account's computers the directory last listed, other than this+ /// one and the Spaces a computer provides (they answer with it).+ fn computers_to_reach(&self) -> u32 {+ let this = self.this_relay_machine_id();+ let cache = self.inner.relay_cache.lock().expect("relay cache");+ let n = cache+ .iter()+ .filter(|m| m.host.as_deref().is_none_or(str::is_empty))+ .filter(|m| this.as_deref() != Some(m.id.as_str()))+ .count();+ u32::try_from(n).unwrap_or(u32::MAX)+ }++ /// The read of the account's computers in flight, or a new one.+ fn account_round(&self) -> watch::Receiver<Option<RoundEnd>> {+ let mut slot = self.inner.rounds.in_flight.lock().expect("rounds");+ if let Some(rx) = slot.as_ref()+ && rx.borrow().is_none()+ {+ return rx.clone();+ }+ let (tx, rx) = watch::channel(None);+ *slot = Some(rx.clone());+ drop(slot);+ let this = self.clone();+ let tx = Arc::new(tx);+ tokio::spawn(async move {+ let end = this.read_account_computers().await;+ *this.inner.rounds.last.lock().expect("rounds") = Some((Instant::now(), end.clone()));+ let _ = tx.send(Some(end));+ });+ rx+ }++ /// Durable Spaces and the relay directory, read again.+ async fn read_account_computers(&self) -> RoundEnd {+ if let Err(e) = self.durable_spaces().await {+ tracing::debug!(error = %e, "durable Spaces not listed");+ }+ let Some(account) = self.relay_account() else {+ return RoundEnd::Answered;+ };+ match self.relay_machines().await {+ Ok(_) => RoundEnd::Answered,+ Err(e) if e.tag() == "unauthenticated" && !account.tokens.signed_in().await => {+ tracing::debug!("relay directory skipped: not signed in");+ self.forget_account_computers();+ RoundEnd::Answered+ }+ Err(e) => RoundEnd::Failed(e.to_string()),+ }+ }++ /// Signed out: the account's computers leave the list, here and on disk.+ pub(crate) fn forget_account_computers(&self) {+ self.inner.relay_cache.lock().expect("relay cache").clear();+ self.inner+ .relay_confirmed+ .store(false, std::sync::atomic::Ordering::Release);+ forget_directory(self.home_dir());+ }+}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::relay::{RelayAccount, StaticToken};+ use cua_proto::daemon::v1 as dpb;+ use tokio::io::{AsyncReadExt, AsyncWriteExt};++ /// A relay whose directory answers `machines` only once `open` is sent+ /// (`false` keeps every read hanging).+ async fn slow_relay(+ machines: serde_json::Value,+ ) -> (+ String,+ watch::Sender<bool>,+ Arc<std::sync::atomic::AtomicUsize>,+ ) {+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();+ let url = format!("http://{}", listener.local_addr().unwrap());+ let (open, gate) = watch::channel(false);+ let reads = Arc::new(std::sync::atomic::AtomicUsize::new(0));+ let counted = reads.clone();+ tokio::spawn(async move {+ loop {+ let Ok((mut sock, _)) = listener.accept().await else {+ return;+ };+ let mut gate = gate.clone();+ let body = serde_json::json!({ "machines": machines }).to_string();+ let counted = counted.clone();+ tokio::spawn(async move {+ let mut buf = vec![0u8; 8192];+ let _ = sock.read(&mut buf).await;+ counted.fetch_add(1, std::sync::atomic::Ordering::SeqCst);+ if gate.wait_for(|o| *o).await.is_err() {+ return;+ }+ let reply = format!(+ "HTTP/1.1 200 OK\r\ncontent-type: application/json\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{body}",+ body.len()+ );+ let _ = sock.write_all(reply.as_bytes()).await;+ });+ }+ });+ (url, open, reads)+ }++ fn local_space(id: &str) -> dpb::Space {+ dpb::Space {+ id: id.into(),+ name: id.trim_start_matches("local:").into(),+ os: "macos".into(),+ ..Default::default()+ }+ }++ fn two_computers() -> serde_json::Value {+ serde_json::json!([+ {"id": "aaaaaaaaaaaaaaaa", "name": "Studio", "online": true},+ {"id": "bbbbbbbbbbbbbbbb", "name": "Builder", "online": false},+ ])+ }++ fn spaces_in(home: &std::path::Path) -> Spaces {+ let spaces = Spaces::builder().home(home.to_path_buf()).build();+ spaces+ .registry()+ .upsert(local_space("local:space-mac1"), Default::default())+ .unwrap();+ spaces+ }++ fn ids(l: &SpaceListing) -> Vec<&str> {+ l.spaces.iter().map(|s| s.id.as_str()).collect()+ }++ /// This machine's Spaces are listed while the relay has not answered,+ /// and the listing says it is incomplete (not empty).+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn this_machines_spaces_are_listed_before_the_relay_answers() {+ let home = tempfile::tempdir().unwrap();+ let (url, open, _) = slow_relay(two_computers()).await;+ let spaces = spaces_in(home.path());+ spaces.set_relay(Some(RelayAccount::new(+ &url,+ Arc::new(StaticToken("t".into())),+ )));++ let started = Instant::now();+ let first = spaces.list_known(Duration::from_millis(200)).await.unwrap();+ assert!(+ started.elapsed() < Duration::from_secs(2),+ "{:?}",+ started.elapsed()+ );+ assert_eq!(ids(&first), ["local:space-mac1"]);+ assert!(first.progress.incomplete, "{:?}", first.progress);+ // Nothing known of the account's computers yet.+ assert_eq!(first.progress.reaching, 0);+ assert!(!first.progress.stale);++ // The relay answers: the same read completes the list.+ open.send(true).unwrap();+ let done = spaces.list_known(Duration::from_secs(5)).await.unwrap();+ assert!(!done.progress.incomplete, "{:?}", done.progress);+ assert!(!done.progress.stale);+ assert_eq!(+ ids(&done),+ [+ "local:space-mac1",+ "relay:aaaaaaaaaaaaaaaa",+ "relay:bbbbbbbbbbbbbbbb"+ ]+ );+ }++ /// A restart lists the last known computers at once (stale, and+ /// incomplete while the relay is being reached, with how many), and+ /// the relay's answer confirms them.+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn the_last_known_computers_survive_a_restart() {+ let home = tempfile::tempdir().unwrap();+ let (url, open, _) = slow_relay(two_computers()).await;+ open.send(true).unwrap();+ let account = || RelayAccount::new(&url, Arc::new(StaticToken("t".into())));+ {+ let before = spaces_in(home.path());+ before.set_relay(Some(account()));+ let l = before.list_known(Duration::from_secs(5)).await.unwrap();+ assert_eq!(l.spaces.len(), 3);+ }+ assert!(home.path().join(RELAY_DIRECTORY_FILE).exists());++ // The new process: the relay does not answer yet.+ open.send(false).unwrap();+ let after = Spaces::builder().home(home.path().to_path_buf()).build();+ after.set_relay(Some(account()));+ let l = after.list_known(Duration::from_millis(200)).await.unwrap();+ assert_eq!(+ ids(&l),+ [+ "local:space-mac1",+ "relay:aaaaaaaaaaaaaaaa",+ "relay:bbbbbbbbbbbbbbbb"+ ]+ );+ assert_eq!(+ l.progress,+ ListProgress {+ incomplete: true,+ reaching: 2,+ stale: true,+ notice: String::new(),+ }+ );+ // An offline computer keeps its row, offline.+ let builder = l.spaces.iter().find(|s| s.id.ends_with("bbbb")).unwrap();+ assert_eq!(builder.status, "offline", "{builder:?}");++ open.send(true).unwrap();+ let l = after.list_known(Duration::from_secs(5)).await.unwrap();+ assert_eq!(l.progress, ListProgress::default());+ assert_eq!(l.spaces.len(), 3);+ }++ /// Another relay's saved directory is not listed.+ #[test]+ fn a_directory_of_another_relay_is_not_listed() {+ let home = tempfile::tempdir().unwrap();+ let m: crate::relay::RelayMachine =+ serde_json::from_value(serde_json::json!({"id": "aaaaaaaaaaaaaaaa"})).unwrap();+ save_directory(home.path(), "https://relay.one", &[m]);+ assert_eq!(load_directory(home.path(), "https://relay.one").len(), 1);+ assert!(load_directory(home.path(), "https://relay.two").is_empty());+ }++ /// A relay that fails: the list is complete as far as it goes (this+ /// machine's Spaces, the last known computers), stale, and says why.+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn a_failed_relay_read_lists_what_is_known_and_says_why() {+ let home = tempfile::tempdir().unwrap();+ let m: crate::relay::RelayMachine = serde_json::from_value(+ serde_json::json!({"id": "aaaaaaaaaaaaaaaa", "name": "Studio", "online": true}),+ )+ .unwrap();+ // Nothing listens there.+ let dead = {+ let l = std::net::TcpListener::bind("127.0.0.1:0").unwrap();+ format!("http://{}", l.local_addr().unwrap())+ };+ save_directory(home.path(), &dead, &[m]);+ let spaces = spaces_in(home.path());+ spaces.set_relay(Some(RelayAccount::new(+ &dead,+ Arc::new(StaticToken("t".into())),+ )));+ let l = spaces.list_known(Duration::from_secs(10)).await.unwrap();+ assert_eq!(ids(&l), ["local:space-mac1", "relay:aaaaaaaaaaaaaaaa"]);+ assert!(!l.progress.incomplete, "{:?}", l.progress);+ assert!(l.progress.stale);+ assert!(!l.progress.notice.is_empty());+ }++ /// Once a read has ended, a slow relay does not make later lists+ /// incomplete: they answer with the last read while the next one runs.+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn a_slow_relay_after_the_first_answer_keeps_the_list_complete() {+ let home = tempfile::tempdir().unwrap();+ let (url, open, reads) = slow_relay(two_computers()).await;+ open.send(true).unwrap();+ let spaces = spaces_in(home.path());+ spaces.set_relay(Some(RelayAccount::new(+ &url,+ Arc::new(StaticToken("t".into())),+ )));+ assert!(+ !spaces+ .list_known(Duration::from_secs(5))+ .await+ .unwrap()+ .progress+ .incomplete+ );+ open.send(false).unwrap();+ for _ in 0..3 {+ let l = spaces.list_known(Duration::from_millis(100)).await.unwrap();+ assert_eq!(l.progress, ListProgress::default());+ assert_eq!(l.spaces.len(), 3);+ }+ // One read at a time: the hanging one is joined, not repeated.+ assert_eq!(reads.load(std::sync::atomic::Ordering::SeqCst), 2);+ }++ /// Signed out: the account's computers leave the list and the disk.+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn signing_out_forgets_the_saved_computers() {+ let home = tempfile::tempdir().unwrap();+ let (url, open, _) = slow_relay(two_computers()).await;+ open.send(true).unwrap();+ let spaces = spaces_in(home.path());+ spaces.set_relay(Some(RelayAccount::new(+ &url,+ Arc::new(StaticToken("t".into())),+ )));+ assert_eq!(+ spaces+ .list_known(Duration::from_secs(5))+ .await+ .unwrap()+ .spaces+ .len(),+ 3+ );+ spaces.set_relay(Some(RelayAccount::new(+ &url,+ Arc::new(StaticToken(String::new())),+ )));+ let l = spaces.list_known(Duration::from_secs(5)).await.unwrap();+ assert_eq!(ids(&l), ["local:space-mac1"]);+ assert_eq!(l.progress, ListProgress::default());+ assert!(!home.path().join(RELAY_DIRECTORY_FILE).exists());+ }+}diff --git a/libs/cua/crates/cua-spaces/src/spaces.rs b/libs/cua/crates/cua-spaces/src/spaces.rsindex f354461bc6..85b4b7b6a7 100644--- a/libs/cua/crates/cua-spaces/src/spaces.rs+++ b/libs/cua/crates/cua-spaces/src/spaces.rs@@ -353,6 +353,8 @@ impl SpacesBuilder {relay_cache: std::sync::Mutex::new(Vec::new()),relay_reported: std::sync::Mutex::new(relay_reported),relay_read: tokio::sync::Mutex::new(None),+ relay_confirmed: std::sync::atomic::AtomicBool::new(false),+ rounds: Default::default(),site_login: std::sync::RwLock::new(None),pool: std::sync::RwLock::new(None),durable: std::sync::Mutex::new(Vec::new()),@@ -565,6 +567,11 @@ pub(crate) struct Inner {relay_reported: std::sync::Mutex<HashMap<String, ReportedFacts>>,/// Held across a read so only one directory read runs at a time.relay_read: tokio::sync::Mutex<Option<std::time::Instant>>,+ /// The relay answered a directory read in this process (until then the+ /// directory is the one saved by an earlier process, if any).+ pub(crate) relay_confirmed: std::sync::atomic::AtomicBool,+ /// The read of the account's computers [`Spaces::list_known`] runs.+ pub(crate) rounds: crate::listing::AccountRounds,/// The Keyvault broker `request_site_login` signs in through (the/// daemon sets it once its Keyvault is up).site_login: std::sync::RwLock<Option<Arc<dyn crate::site_login::SiteLoginBroker>>>,@@ -729,7 +736,7 @@ impl Spaces {return Err(e);}tracing::debug!("relay directory skipped: not signed in");- self.inner.relay_cache.lock().expect("relay cache").clear();+ self.forget_account_computers();}self.list()}@@ -791,11 +798,20 @@ impl Spaces {}/// Configures (or clears) the relay account after construction, e.g.- /// when `cua daemon` picks up the signed-in session. Clears the cached- /// directory listing.+ /// when `cua daemon` picks up the signed-in session. The cached+ /// directory listing becomes the one an earlier process saved for this+ /// relay (`relay-directory.json`), unconfirmed until the relay answers.pub fn set_relay(&self, relay: Option<crate::relay::RelayAccount>) {+ let saved = relay+ .as_ref()+ .map(|r| crate::listing::load_directory(self.home_dir(), &r.url))+ .unwrap_or_default();*self.inner.relay.write().expect("relay") = relay;- self.inner.relay_cache.lock().expect("relay cache").clear();+ *self.inner.relay_cache.lock().expect("relay cache") = saved;+ self.inner+ .relay_confirmed+ .store(false, std::sync::atomic::Ordering::Release);+ self.inner.rounds.reset();}/// `e`, from a call on `space`, with the reason when the call failed@@ -895,7 +911,21 @@ impl Spaces {}};*read_at = Some(std::time::Instant::now());- *self.inner.relay_cache.lock().expect("relay cache") = machines.clone();+ let changed = {+ let mut cache = self.inner.relay_cache.lock().expect("relay cache");+ let changed = *cache != machines;+ *cache = machines.clone();+ changed+ };+ let first = !self+ .inner+ .relay_confirmed+ .swap(true, std::sync::atomic::Ordering::AcqRel);+ // Kept for the next process: it lists these at once, before the+ // relay answers it (`Spaces::list_known`).+ if changed || first {+ crate::listing::save_directory(self.home_dir(), &relay.url, &machines);+ }Ok(machines)}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.ktindex 7690021728..fce5e30102 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@@ -1509,6 +1509,8 @@ external fun uniffi_cua_sdk_checksum_method_spaces_hosts(): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_list(): Short+external fun uniffi_cua_sdk_checksum_method_spaces_list_known(+): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_list_tools_json(): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_machine_health(@@ -2521,6 +2523,8 @@ external fun uniffi_cua_sdk_fn_method_spaces_hosts(`ptr`: Long,): Longexternal fun uniffi_cua_sdk_fn_method_spaces_list(`ptr`: Long,): Long+external fun uniffi_cua_sdk_fn_method_spaces_list_known(`ptr`: Long,+): Longexternal fun uniffi_cua_sdk_fn_method_spaces_list_tools_json(`ptr`: Long,): Longexternal fun uniffi_cua_sdk_fn_method_spaces_machine_health(`ptr`: Long,`machine`: RustBuffer.ByValue,@@ -4080,6 +4084,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_method_spaces_list() != 27182.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_method_spaces_list_known() != 21083.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json() != 19259.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -20396,6 +20403,16 @@ public interface SpacesInterface {*/suspend fun `list`(): List<SpaceInfo>+ /**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ suspend fun `listKnown`(): SpaceList+/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -21934,6 +21951,35 @@ open class Spaces: Disposable, AutoCloseable, SpacesInterface}+ /**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ @Throws(CuaException::class)+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ override suspend fun `listKnown`() : SpaceList {+ return uniffiRustCallAsync(+ callWithHandle { uniffiHandle ->+ UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_known(+ uniffiHandle,++ )+ },+ { future, callback, continuation -> UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer(future, continuation) },+ { future -> UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer(future) },+ // lift function+ { FfiConverterTypeSpaceList.lift(it) },+ // Error FFI converter+ CuaException.ErrorHandler,+ )+ }++/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -41627,6 +41673,81 @@ public object FfiConverterTypeSpaceInfo: FfiConverterRustBuffer<SpaceInfo> {+/**+ * The Spaces known now ([`Spaces::list_known`]) and how far the read got.+ */+data class SpaceList (+ /**+ * This machine's Spaces, and the account's other computers' as far as+ * they answered (the last known ones meanwhile).+ */+ var `spaces`: List<SpaceInfo>+ ,+ /**+ * Some of the account's computers have not answered yet: the list may+ * grow, and an empty one is not "no Spaces". Always false from a+ * daemon that predates it (it answers once every computer did).+ */+ var `incomplete`: kotlin.Boolean+ ,+ /**+ * How many computers are still being reached (0 when unknown).+ */+ var `reaching`: kotlin.UInt+ ,+ /**+ * The other computers' rows are the last known ones, not yet+ * confirmed by the relay.+ */+ var `stale`: kotlin.Boolean+ ,+ /**+ * Why the account's computers could not be read, when they could not.+ */+ var `notice`: kotlin.String++){++++++ companion object+}++/**+ * @suppress+ */+public object FfiConverterTypeSpaceList: FfiConverterRustBuffer<SpaceList> {+ override fun read(buf: ByteBuffer): SpaceList {+ return SpaceList(+ FfiConverterSequenceTypeSpaceInfo.read(buf),+ FfiConverterBoolean.read(buf),+ FfiConverterUInt.read(buf),+ FfiConverterBoolean.read(buf),+ FfiConverterString.read(buf),+ )+ }++ override fun allocationSize(value: SpaceList) = (+ FfiConverterSequenceTypeSpaceInfo.allocationSize(value.`spaces`) ++ FfiConverterBoolean.allocationSize(value.`incomplete`) ++ FfiConverterUInt.allocationSize(value.`reaching`) ++ FfiConverterBoolean.allocationSize(value.`stale`) ++ FfiConverterString.allocationSize(value.`notice`)+ )++ override fun write(value: SpaceList, buf: ByteBuffer) {+ FfiConverterSequenceTypeSpaceInfo.write(value.`spaces`, buf)+ FfiConverterBoolean.write(value.`incomplete`, buf)+ FfiConverterUInt.write(value.`reaching`, buf)+ FfiConverterBoolean.write(value.`stale`, buf)+ FfiConverterString.write(value.`notice`, buf)+ }+}+++/*** What [`Spaces::stop`] or [`Spaces::start`] did.*/diff --git a/libs/cua/proto/cua/daemon/v1/spaces.proto b/libs/cua/proto/cua/daemon/v1/spaces.protoindex 90530c4c54..6185cbab17 100644--- a/libs/cua/proto/cua/daemon/v1/spaces.proto+++ b/libs/cua/proto/cua/daemon/v1/spaces.proto@@ -256,12 +256,30 @@ message AddSpaceResponse {}// Request for `SpaceService.ListSpaces`.-message ListSpacesRequest {}+message ListSpacesRequest {+ // Answer with what is known now: this machine's Spaces at once, the+ // account's other computers as far as they answered within a moment+ // (the response says how far it got). Without it the daemon waits for+ // the relay and fails when it cannot be read.+ bool known_now = 1;+}// Response for `SpaceService.ListSpaces`.message ListSpacesResponse {// Spaces.repeated Space spaces = 1;+ // `known_now` only: some of the account's computers have not answered+ // yet, so the list may grow (an empty one is not "no Spaces").+ bool incomplete = 2;+ // `known_now` only: how many computers are still being reached (0 when+ // unknown).+ uint32 reaching = 3;+ // `known_now` only: the other computers' rows are the last known ones,+ // not yet confirmed by the relay.+ bool stale = 4;+ // `known_now` only: why the account's computers could not be read, when+ // they could not.+ string notice = 5;}// 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.pyindex 81caa5ff94..6c1d3d8941 100644--- a/libs/cua/python/src/cua/_native.py+++ b/libs/cua/python/src/cua/_native.py@@ -1201,6 +1201,8 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_spaces_list() != 27182:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_method_spaces_list_known() != 21083:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json() != 19259:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_spaces_machine_health() != 35352:@@ -4028,6 +4030,10 @@ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_list.argtypes = (ctypes.c_uint64,)_UniffiLib.uniffi_cua_sdk_fn_method_spaces_list.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_known.argtypes = (+ ctypes.c_uint64,+)+_UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_known.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_tools_json.argtypes = (ctypes.c_uint64,)@@ -5760,6 +5766,9 @@ _UniffiLib.uniffi_cua_sdk_checksum_method_spaces_hosts.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list_known.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list_known.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_list_tools_json.restype = ctypes.c_uint16@@ -23723,6 +23732,86 @@ class _UniffiFfiConverterTypeSpaceHotspotStatus(_UniffiConverterRustBuffer):_UniffiFfiConverterUInt64.write(value.bytes_in, buf)_UniffiFfiConverterBoolean.write(value.served_here, buf)+class _UniffiFfiConverterSequenceTypeSpaceInfo(_UniffiConverterRustBuffer):+ @classmethod+ def check_lower(cls, value):+ for item in value:+ _UniffiFfiConverterTypeSpaceInfo.check_lower(item)++ @classmethod+ def write(cls, value, buf):+ items = len(value)+ buf.write_i32(items)+ for item in value:+ _UniffiFfiConverterTypeSpaceInfo.write(item, buf)++ @classmethod+ def read(cls, buf):+ count = buf.read_i32()+ if count < 0:+ raise InternalError("Unexpected negative sequence length")++ return [+ _UniffiFfiConverterTypeSpaceInfo.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):+ self.spaces = spaces+ self.incomplete = incomplete+ self.reaching = reaching+ self.stale = stale+ self.notice = notice+++++ def __str__(self):+ return "SpaceList(spaces={}, incomplete={}, reaching={}, stale={}, notice={})".format(self.spaces, self.incomplete, self.reaching, self.stale, self.notice)+ def __eq__(self, other):+ if self.spaces != other.spaces:+ return False+ if self.incomplete != other.incomplete:+ return False+ if self.reaching != other.reaching:+ return False+ if self.stale != other.stale:+ return False+ if self.notice != other.notice:+ return False+ return True++class _UniffiFfiConverterTypeSpaceList(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return SpaceList(+ spaces=_UniffiFfiConverterSequenceTypeSpaceInfo.read(buf),+ incomplete=_UniffiFfiConverterBoolean.read(buf),+ reaching=_UniffiFfiConverterUInt32.read(buf),+ stale=_UniffiFfiConverterBoolean.read(buf),+ notice=_UniffiFfiConverterString.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterSequenceTypeSpaceInfo.check_lower(value.spaces)+ _UniffiFfiConverterBoolean.check_lower(value.incomplete)+ _UniffiFfiConverterUInt32.check_lower(value.reaching)+ _UniffiFfiConverterBoolean.check_lower(value.stale)+ _UniffiFfiConverterString.check_lower(value.notice)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterSequenceTypeSpaceInfo.write(value.spaces, buf)+ _UniffiFfiConverterBoolean.write(value.incomplete, buf)+ _UniffiFfiConverterUInt32.write(value.reaching, buf)+ _UniffiFfiConverterBoolean.write(value.stale, buf)+ _UniffiFfiConverterString.write(value.notice, buf)+@dataclassclass SpacePowerReport:"""@@ -39297,29 +39386,6 @@ class _UniffiFfiConverterSequenceTypeSpacesHost(_UniffiConverterRustBuffer):_UniffiFfiConverterTypeSpacesHost.read(buf) for i in range(count)]-class _UniffiFfiConverterSequenceTypeSpaceInfo(_UniffiConverterRustBuffer):- @classmethod- def check_lower(cls, value):- for item in value:- _UniffiFfiConverterTypeSpaceInfo.check_lower(item)-- @classmethod- def write(cls, value, buf):- items = len(value)- buf.write_i32(items)- for item in value:- _UniffiFfiConverterTypeSpaceInfo.write(item, buf)-- @classmethod- def read(cls, buf):- count = buf.read_i32()- if count < 0:- raise InternalError("Unexpected negative sequence length")-- return [- _UniffiFfiConverterTypeSpaceInfo.read(buf) for i in range(count)- ]-class _UniffiFfiConverterSequenceTypeNotificationInfo(_UniffiConverterRustBuffer):@classmethoddef check_lower(cls, value):@@ -40072,6 +40138,16 @@ class SpacesProtocol(typing.Protocol):async def list(self, ) -> typing.List[SpaceInfo]:"""Registered Spaces.+"""+ raise NotImplementedError+ async def list_known(self, ) -> SpaceList:+ """+ 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). A slow or unreachable relay never holds+ up or fails this machine's own Spaces, so an app shows them right+ away and reads again while the list is incomplete. [`Spaces::list`]+ waits for every computer instead."""raise NotImplementedErrorasync def list_tools_json(self, ) -> str:@@ -41247,6 +41323,28 @@ class Spaces(SpacesProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ async def list_known(self, ) -> SpaceList:+ """+ 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). A slow or unreachable relay never holds+ up or fails this machine's own Spaces, so an app shows them right+ away and reads again while the list is incomplete. [`Spaces::list`]+ waits for every computer instead.+"""+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeSpaceList.lift+ _uniffi_error_converter = _UniffiFfiConverterTypeCuaError+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_list_known(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )async def list_tools_json(self, ) -> str:"""The Spaces MCP `tools/list` result as JSON (the contract).@@ -44833,6 +44931,7 @@ __all__ = ["SpaceCreateResult","SpaceDisplay","SpaceHotspotStatus",+ "SpaceList","SpacePowerReport","SpaceRelayRegistration","SpaceSendFileOptions",diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.pyindex acbc280f87..f804640821 100644--- a/libs/cua/scripts/generate-app-core-ffi.py+++ b/libs/cua/scripts/generate-app-core-ffi.py@@ -21,7 +21,7 @@ OUT = ROOT / "crates/cua-spaces-ffi/src/app_core_types.rs"TYPES = [("message.rs", "message", ["Msg"]),("model.rs", "model", ["SpaceOs", "SpaceStatus", "ThumbnailScene", "SpaceProvider", "SpaceSdkRef", "SpaceProgress", "CreateFixAction", "CreateFix", "PowerControl", "SpacePower", "Space", "SpaceRow", "Location", "SpaceKind", "Runtime"]),- ("spaces/mod.rs", "spaces", ["AmbientDots"]),+ ("spaces/mod.rs", "spaces", ["AmbientDots", "ListViewInput", "ListView"]),("spaces/roster.rs", "spaces::roster", ["NoticeKind", "Notice", "RosterState", "RosterAction"]),("spaces/creating.rs", "spaces::creating", ["PendingCreate", "PendingDelete", "PendingPower", "FailureStreak", "CreatesState", "CreateAction"]),("spaces/sidebar.rs", "spaces::sidebar", ["PowerButton", "SidebarRow", "SidebarSection", "SidebarView", "FactCopy", "FactWarning", "Fact", "DetailActionId", "DetailAction", "DeleteConfirm", "DetailCopy", "SpaceUsage", "NewSpaceOn", "SpaceDetail"]),diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swiftindex 588743adb7..939f53ae59 100644--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift@@ -11184,6 +11184,16 @@ public protocol SpacesProtocol: AnyObject, Sendable {*/func list() async throws -> [SpaceInfo]+ /**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ func listKnown() async throws -> SpaceList+/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -12491,6 +12501,31 @@ open func list()async throws -> [SpaceInfo] {)}+ /**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+open func listKnown()async throws -> SpaceList {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cua_sdk_fn_method_spaces_list_known(+ self.uniffiCloneHandle()++ )+ },+ pollFunc: ffi_cua_sdk_rust_future_poll_rust_buffer,+ completeFunc: ffi_cua_sdk_rust_future_complete_rust_buffer,+ freeFunc: ffi_cua_sdk_rust_future_free_rust_buffer,+ liftFunc: FfiConverterTypeSpaceList_lift,+ errorHandler: FfiConverterTypeCuaError_lift+ )+}+/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -36458,6 +36493,113 @@ public func FfiConverterTypeSpaceInfo_lower(_ value: SpaceInfo) -> RustBuffer {}+/**+ * The Spaces known now ([`Spaces::list_known`]) and how far the read got.+ */+public struct SpaceList: Equatable, Hashable {+ /**+ * This machine's Spaces, and the account's other computers' as far as+ * they answered (the last known ones meanwhile).+ */+ public var spaces: [SpaceInfo]+ /**+ * Some of the account's computers have not answered yet: the list may+ * grow, and an empty one is not "no Spaces". Always false from a+ * daemon that predates it (it answers once every computer did).+ */+ public var incomplete: Bool+ /**+ * How many computers are still being reached (0 when unknown).+ */+ public var reaching: UInt32+ /**+ * The other computers' rows are the last known ones, not yet+ * confirmed by the relay.+ */+ public var stale: Bool+ /**+ * Why the account's computers could not be read, when they could not.+ */+ public var notice: String++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * This machine's Spaces, and the account's other computers' as far as+ * they answered (the last known ones meanwhile).+ */spaces: [SpaceInfo],+ /**+ * Some of the account's computers have not answered yet: the list may+ * grow, and an empty one is not "no Spaces". Always false from a+ * daemon that predates it (it answers once every computer did).+ */incomplete: Bool,+ /**+ * How many computers are still being reached (0 when unknown).+ */reaching: UInt32,+ /**+ * The other computers' rows are the last known ones, not yet+ * confirmed by the relay.+ */stale: Bool,+ /**+ * Why the account's computers could not be read, when they could not.+ */notice: String) {+ self.spaces = spaces+ self.incomplete = incomplete+ self.reaching = reaching+ self.stale = stale+ self.notice = notice+ }+++++}++#if compiler(>=6)+extension SpaceList: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeSpaceList: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpaceList {+ return+ try SpaceList(+ spaces: FfiConverterSequenceTypeSpaceInfo.read(from: &buf),+ incomplete: FfiConverterBool.read(from: &buf),+ reaching: FfiConverterUInt32.read(from: &buf),+ stale: FfiConverterBool.read(from: &buf),+ notice: FfiConverterString.read(from: &buf)+ )+ }++ public static func write(_ value: SpaceList, into buf: inout [UInt8]) {+ FfiConverterSequenceTypeSpaceInfo.write(value.spaces, into: &buf)+ FfiConverterBool.write(value.incomplete, into: &buf)+ FfiConverterUInt32.write(value.reaching, into: &buf)+ FfiConverterBool.write(value.stale, into: &buf)+ FfiConverterString.write(value.notice, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeSpaceList_lift(_ buf: RustBuffer) throws -> SpaceList {+ return try FfiConverterTypeSpaceList.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeSpaceList_lower(_ value: SpaceList) -> RustBuffer {+ return FfiConverterTypeSpaceList.lower(value)+}++/*** What [`Spaces::stop`] or [`Spaces::start`] did.*/@@ -49160,6 +49302,9 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_method_spaces_list() != 27182) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_method_spaces_list_known() != 21083) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_method_spaces_list_tools_json() != 19259) {return InitializationResult.apiChecksumMismatch}diff --git a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.hindex d07219e856..d0ed32352c 100644--- a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h+++ b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h@@ -2248,6 +2248,11 @@ uint64_t uniffi_cua_sdk_fn_method_spaces_hosts(uint64_t ptruint64_t uniffi_cua_sdk_fn_method_spaces_list(uint64_t ptr);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_LIST_KNOWN+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_LIST_KNOWN+uint64_t uniffi_cua_sdk_fn_method_spaces_list_known(uint64_t ptr+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_LIST_TOOLS_JSON#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_LIST_TOOLS_JSONuint64_t uniffi_cua_sdk_fn_method_spaces_list_tools_json(uint64_t ptr@@ -5583,6 +5588,12 @@ uint16_t uniffi_cua_sdk_checksum_method_spaces_hosts(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_LISTuint16_t uniffi_cua_sdk_checksum_method_spaces_list(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_LIST_KNOWN+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_LIST_KNOWN+uint16_t uniffi_cua_sdk_checksum_method_spaces_list_known(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_LIST_TOOLS_JSONdiff --git a/libs/cua/typescript/src/native/cua_sdk-ffi.ts b/libs/cua/typescript/src/native/cua_sdk-ffi.tsindex e8d33170f5..c5b3a6414b 100644--- a/libs/cua/typescript/src/native/cua_sdk-ffi.ts+++ b/libs/cua/typescript/src/native/cua_sdk-ffi.ts@@ -2448,6 +2448,11 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_method_spaces_list_known": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_method_spaces_list_tools_json": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -4843,6 +4848,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_spaces_list_known": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_spaces_list_tools_json": {args: [],ret: FfiType.UInt16,@@ -6068,6 +6078,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_method_spaces_gpu_support(uniffiSelf: bigint, on: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spaces_hosts(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_list(uniffiSelf: bigint): bigint;+ uniffi_cua_sdk_fn_method_spaces_list_known(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_list_tools_json(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_machine_health(uniffiSelf: bigint, machine: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spaces_notifications(uniffiSelf: bigint, unreadOnly: number, sinceMs: Uint8Array): bigint;@@ -6547,6 +6558,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_method_spaces_gpu_support(): number;uniffi_cua_sdk_checksum_method_spaces_hosts(): number;uniffi_cua_sdk_checksum_method_spaces_list(): number;+ uniffi_cua_sdk_checksum_method_spaces_list_known(): number;uniffi_cua_sdk_checksum_method_spaces_list_tools_json(): number;uniffi_cua_sdk_checksum_method_spaces_machine_health(): number;uniffi_cua_sdk_checksum_method_spaces_notifications(): number;diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.tsindex bf83c42cb7..12701361c9 100644--- a/libs/cua/typescript/src/native/cua_sdk.ts+++ b/libs/cua/typescript/src/native/cua_sdk.ts@@ -18858,6 +18858,83 @@ const FfiConverterTypeSpaceHotspotStatus = (() => {return new FFIConverter();})();+/**+ * The Spaces known now ([`Spaces::list_known`]) and how far the read got.+ */+export type SpaceList = {+ /**+ * This machine's Spaces, and the account's other computers' as far as+ * they answered (the last known ones meanwhile).+ */+ spaces: Array<SpaceInfo>,+ /**+ * Some of the account's computers have not answered yet: the list may+ * grow, and an empty one is not "no Spaces". Always false from a+ * daemon that predates it (it answers once every computer did).+ */+ incomplete: boolean,+ /**+ * How many computers are still being reached (0 when unknown).+ */+ reaching: number,+ /**+ * The other computers' rows are the last known ones, not yet+ * confirmed by the relay.+ */+ stale: boolean,+ /**+ * Why the account's computers could not be read, when they could not.+ */+ notice: string+}++/**+ * Generated factory for {@link SpaceList} record objects.+ */+export const SpaceList = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<SpaceList, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<SpaceList>,+ });+})();++const FfiConverterTypeSpaceList = (() => {+ type TypeName = SpaceList;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ spaces: FfiConverterSequenceTypeSpaceInfo.read(from),+ incomplete: FfiConverterBool.read(from),+ reaching: FfiConverterUInt32.read(from),+ stale: FfiConverterBool.read(from),+ notice: FfiConverterString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterSequenceTypeSpaceInfo.write(value.spaces, into);+ FfiConverterBool.write(value.incomplete, into);+ FfiConverterUInt32.write(value.reaching, into);+ FfiConverterBool.write(value.stale, into);+ FfiConverterString.write(value.notice, 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);++ }+ };+ return new FFIConverter();+})();+/*** What [`Spaces::stop`] or [`Spaces::start`] did.*/@@ -38444,6 +38521,15 @@ export interface SpacesLike {* Registered Spaces.*/list(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<SpaceInfo>>;+/**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ listKnown(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SpaceList>;/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -40025,6 +40111,46 @@ private constructor(pointer: UniffiHandle) {}}+/**+ * 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). A slow or unreachable relay never holds+ * up or fails this machine's own Spaces, so an app shows them right+ * away and reads again while the list is incomplete. [`Spaces::list`]+ * waits for every computer instead.+ */+ async listKnown(asyncOpts_?: { signal: AbortSignal }): Promise<SpaceList> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_sdk_fn_method_spaces_list_known(+ uniffiTypeSpacesObjectFactory.clonePointer(this)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterTypeSpaceList.lift.bind(FfiConverterTypeSpaceList),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** The Spaces MCP `tools/list` result as JSON (the contract).*/@@ -43697,6 +43823,9 @@ const FfiConverterOptionalTypeEgressEnforcement = new FfiConverterOptional(FfiCo// FfiConverter for SpaceInfo | undefinedconst FfiConverterOptionalTypeSpaceInfo = new FfiConverterOptional(FfiConverterTypeSpaceInfo);+// FfiConverter for Array<SpaceInfo>+const FfiConverterSequenceTypeSpaceInfo = new FfiConverterArray(FfiConverterTypeSpaceInfo);+// FfiConverter for Array<SpaceSentFile>const FfiConverterSequenceTypeSpaceSentFile = new FfiConverterArray(FfiConverterTypeSpaceSentFile);@@ -43871,9 +44000,6 @@ const FfiConverterSequenceTypeGpuSupport = new FfiConverterArray(FfiConverterTyp// FfiConverter for Array<SpacesHost>const FfiConverterSequenceTypeSpacesHost = new FfiConverterArray(FfiConverterTypeSpacesHost);-// FfiConverter for Array<SpaceInfo>-const FfiConverterSequenceTypeSpaceInfo = new FfiConverterArray(FfiConverterTypeSpaceInfo);-// FfiConverter for Array<NotificationInfo>const FfiConverterSequenceTypeNotificationInfo = new FfiConverterArray(FfiConverterTypeNotificationInfo);@@ -45018,6 +45144,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list() !== 27182) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list_known() !== 21083) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list_known");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_list_tools_json() !== 19259) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_list_tools_json");}@@ -45613,6 +45742,7 @@ export default Object.freeze({FfiConverterTypeSpaceDisplay,FfiConverterTypeSpaceHotspotStatus,FfiConverterTypeSpaceInfo,+ FfiConverterTypeSpaceList,FfiConverterTypeSpacePowerReport,FfiConverterTypeSpacePresence,FfiConverterTypeSpaceRelayRegistration,diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 199cc98882..ee934548b2 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -19472,6 +19472,166 @@ public func FfiConverterTypeAppLineView_lower(_ value: AppLineView) -> RustBuffe}+public struct AppListView: Equatable, Hashable {+ /**+ * "Create your first Space": only when the list is complete and has no+ * Space. A list still loading, or with computers still answering, is+ * not empty yet (an app update restarting the daemon must not show it).+ */+ public var empty: Bool+ /**+ * One quiet line where the Spaces go while the list is not complete+ * ("Reaching 6 computers…"), below what is known so far.+ */+ public var reachingLine: String?++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * "Create your first Space": only when the list is complete and has no+ * Space. A list still loading, or with computers still answering, is+ * not empty yet (an app update restarting the daemon must not show it).+ */empty: Bool,+ /**+ * One quiet line where the Spaces go while the list is not complete+ * ("Reaching 6 computers…"), below what is known so far.+ */reachingLine: String?) {+ self.empty = empty+ self.reachingLine = reachingLine+ }+++++}++#if compiler(>=6)+extension AppListView: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeAppListView: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppListView {+ return+ try AppListView(+ empty: FfiConverterBool.read(from: &buf),+ reachingLine: FfiConverterOptionString.read(from: &buf)+ )+ }++ public static func write(_ value: AppListView, into buf: inout [UInt8]) {+ FfiConverterBool.write(value.empty, into: &buf)+ FfiConverterOptionString.write(value.reachingLine, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppListView_lift(_ buf: RustBuffer) throws -> AppListView {+ return try FfiConverterTypeAppListView.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppListView_lower(_ value: AppListView) -> RustBuffer {+ return FfiConverterTypeAppListView.lower(value)+}+++public struct AppListViewInput: Equatable, Hashable {+ /**+ * The list was read at least once: before that nothing is known, not+ * even this machine's Spaces.+ */+ public var loaded: Bool+ /**+ * Some of the account's computers have not answered yet.+ */+ public var incomplete: Bool+ /**+ * How many computers are still being reached (0 when unknown).+ */+ public var reaching: UInt32+ /**+ * Spaces listed now.+ */+ public var count: UInt32++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * The list was read at least once: before that nothing is known, not+ * even this machine's Spaces.+ */loaded: Bool,+ /**+ * Some of the account's computers have not answered yet.+ */incomplete: Bool,+ /**+ * How many computers are still being reached (0 when unknown).+ */reaching: UInt32,+ /**+ * Spaces listed now.+ */count: UInt32) {+ self.loaded = loaded+ self.incomplete = incomplete+ self.reaching = reaching+ self.count = count+ }+++++}++#if compiler(>=6)+extension AppListViewInput: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeAppListViewInput: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppListViewInput {+ return+ try AppListViewInput(+ loaded: FfiConverterBool.read(from: &buf),+ incomplete: FfiConverterBool.read(from: &buf),+ reaching: FfiConverterUInt32.read(from: &buf),+ count: FfiConverterUInt32.read(from: &buf)+ )+ }++ public static func write(_ value: AppListViewInput, into buf: inout [UInt8]) {+ FfiConverterBool.write(value.loaded, into: &buf)+ FfiConverterBool.write(value.incomplete, into: &buf)+ FfiConverterUInt32.write(value.reaching, into: &buf)+ FfiConverterUInt32.write(value.count, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppListViewInput_lift(_ buf: RustBuffer) throws -> AppListViewInput {+ return try FfiConverterTypeAppListViewInput.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeAppListViewInput_lower(_ value: AppListViewInput) -> RustBuffer {+ return FfiConverterTypeAppListViewInput.lower(value)+}++public struct AppLocalNetworkInput: Equatable, Hashable {/*** The app's own connect.@@ -73891,6 +74051,17 @@ public func appSpacesFromJson(json: String)throws -> [AppSpace] {)})}+/**+ * The Spaces page's empty state and "Reaching N computers…" line: the+ * first-run page only for a complete list with no Space.+ */+public func appSpacesListView(input: AppListViewInput) -> AppListView {+ return try! FfiConverterTypeAppListView_lift(try! rustCall() {+ uniffi_cua_spaces_ffi_fn_func_app_spaces_list_view(+ FfiConverterTypeAppListViewInput_lower(input),$0+ )+})+}/*** The menu bar status line ("3 Spaces").*/@@ -75611,6 +75782,9 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_spaces_ffi_checksum_func_app_spaces_from_json() != 7600) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_spaces_ffi_checksum_func_app_spaces_list_view() != 47161) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_spaces_ffi_checksum_func_app_status_line() != 47728) {return InitializationResult.apiChecksumMismatch}diff --git a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.hindex ad4f27007b..884a68a1d2 100644--- a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h+++ b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h@@ -1824,6 +1824,11 @@ RustBuffer uniffi_cua_spaces_ffi_fn_func_app_space_rows_from_json(RustBuffer jsoRustBuffer uniffi_cua_spaces_ffi_fn_func_app_spaces_from_json(RustBuffer json, RustCallStatus *_Nonnull out_status);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_SPACES_LIST_VIEW+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_SPACES_LIST_VIEW+RustBuffer uniffi_cua_spaces_ffi_fn_func_app_spaces_list_view(RustBuffer input, RustCallStatus *_Nonnull out_status+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_STATUS_LINE#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_FUNC_APP_STATUS_LINERustBuffer uniffi_cua_spaces_ffi_fn_func_app_status_line(uint32_t count, RustCallStatus *_Nonnull out_status@@ -3912,6 +3917,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_func_app_space_rows_from_json(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACES_FROM_JSONuint16_t uniffi_cua_spaces_ffi_checksum_func_app_spaces_from_json(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACES_LIST_VIEW+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_SPACES_LIST_VIEW+uint16_t uniffi_cua_spaces_ffi_checksum_func_app_spaces_list_view(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_FUNC_APP_STATUS_LINEdiff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.tsindex a2d561f558..ca40b3882a 100644--- a/scripts/docs-generators/cua-sdk.ts+++ b/scripts/docs-generators/cua-sdk.ts@@ -488,7 +488,7 @@ export const PAGES: PageSpec[] = [description: 'The Spaces registry: create, add, resolve, delete and remove Spaces, their create options, and agent runs in a Space.',intro:'`cua.spaces()` returns the `Spaces` registry. Create a Space where `on` says (local or cloud), or add an existing machine by URL, then open a [`Space`](/cua-sdk/reference/spaces/space).',- items: ['Spaces', 'SpaceInfo', 'SpacePowerReport', 'spaces_tool_methods', 'SpacesToolMethod'],+ items: ['Spaces', 'SpaceInfo', 'SpaceList', 'SpacePowerReport', 'spaces_tool_methods', 'SpacesToolMethod'],},{slug: 'spaces/lifetime',