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
perf(spaces): a Space starting or stopping on another computer shows within a second, pushed by the daemon (#5915)
ddupont74a6057dba1b
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 ef4d1cc845..d5863981af 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@@ -569,6 +569,26 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_clone_spaceslistlistener": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_free_spaceslistlistener": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_clone_spaceslistwatch": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_free_spaceslistwatch": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_clone_spacesdclient": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -644,6 +664,11 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener": {+ args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceCuaSdkSpacesListListener"))],+ ret: FfiType.Void,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_init_callback_vtable_teleportapprover": {args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceCuaSdkTeleportApprover"))],ret: FfiType.Void,@@ -2724,11 +2749,26 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_method_spaces_watch_list": {+ args: [FfiType.Handle, FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_method_spaces_watch_resources": {args: [FfiType.Handle, FfiType.Int8, FfiType.Handle],ret: FfiType.Handle,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed": {+ args: [FfiType.Handle, FfiType.UInt64],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_method_spaceslistwatch_stop": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_method_spacesdclient_agents": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -5124,11 +5164,26 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_spaces_watch_list": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_spaces_watch_resources": {args: [],ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_sdk_checksum_method_spaceslistwatch_stop": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_spacesdclient_agents": {args: [],ret: FfiType.UInt16,@@ -5542,6 +5597,22 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: false,},+ "CallbackInterfaceCuaSdkSpacesListListenerMethod0": {+ args: [FfiType.Handle, FfiType.UInt64],+ ret: FfiType.VoidPointer,+ hasRustCallStatus: true,+ outReturn: true,+ },+ "CallbackInterfaceCloneCuaSdk_SpacesListListener": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },+ "CallbackInterfaceFreeCuaSdk_SpacesListListener": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: false,+ },"CallbackInterfaceCuaSdkTeleportApproverMethod0": {args: [FfiType.Handle, FfiType.RustBuffer],ret: FfiType.RustBuffer,@@ -5590,6 +5661,11 @@ const DEFINITIONS = {{ name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCuaSdk_SpaceCreateListener") },{ name: "on_progress", type: FfiType.Callback("CallbackInterfaceCuaSdkSpaceCreateListenerMethod0") },],+ "VTableCallbackInterfaceCuaSdkSpacesListListener": [+ { name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeCuaSdk_SpacesListListener") },+ { name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCuaSdk_SpacesListListener") },+ { name: "on_changed", type: FfiType.Callback("CallbackInterfaceCuaSdkSpacesListListenerMethod0") },+ ],"VTableCallbackInterfaceCuaSdkTeleportApprover": [{ name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeCuaSdk_TeleportApprover") },{ name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCuaSdk_TeleportApprover") },@@ -5707,6 +5783,10 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_free_spacestreamsession(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_clone_spaces(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_free_spaces(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_clone_spaceslistlistener(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;+ uniffi_cua_sdk_fn_free_spaceslistlistener(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_clone_spaceslistwatch(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;+ uniffi_cua_sdk_fn_free_spaceslistwatch(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_clone_spacesdclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_free_spacesdclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_clone_spacesddownload(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;@@ -5722,6 +5802,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_init_callback_vtable_framesink(vtable: UniffiVTableCallbackInterfaceCuaSdkFrameSink): void;uniffi_cua_sdk_fn_init_callback_vtable_resourceslistener(vtable: UniffiVTableCallbackInterfaceCuaSdkResourcesListener): void;uniffi_cua_sdk_fn_init_callback_vtable_spacecreatelistener(vtable: UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener): void;+ uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(vtable: UniffiVTableCallbackInterfaceCuaSdkSpacesListListener): void;uniffi_cua_sdk_fn_init_callback_vtable_teleportapprover(vtable: UniffiVTableCallbackInterfaceCuaSdkTeleportApprover): void;uniffi_cua_sdk_fn_func_agent_event_category(kind: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_agent_harnesses(uniffi_out_err: UniffiRustCallStatus): Uint8Array;@@ -6138,7 +6219,10 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_method_spaces_volume_unmount(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_volume_write(uniffiSelf: bigint, path: Uint8Array, content: Uint8Array, ifEtag: Uint8Array, createOnly: number, view: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spaces_volumes(uniffiSelf: bigint): bigint;+ uniffi_cua_sdk_fn_method_spaces_watch_list(uniffiSelf: bigint, listener: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_method_spaces_watch_resources(uniffiSelf: bigint, visible: number, listener: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;+ uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(uniffiSelf: bigint, generation: bigint, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_method_spaceslistwatch_stop(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_method_spacesdclient_agents(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spacesdclient_attach(uniffiSelf: bigint, pid: Uint8Array, tag: Uint8Array, replay: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spacesdclient_call_json(uniffiSelf: bigint, method: Uint8Array, requestJson: Uint8Array, user: Uint8Array): bigint;@@ -6618,7 +6702,10 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_method_spaces_volume_unmount(): number;uniffi_cua_sdk_checksum_method_spaces_volume_write(): number;uniffi_cua_sdk_checksum_method_spaces_volumes(): number;+ uniffi_cua_sdk_checksum_method_spaces_watch_list(): number;uniffi_cua_sdk_checksum_method_spaces_watch_resources(): number;+ uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed(): number;+ uniffi_cua_sdk_checksum_method_spaceslistwatch_stop(): number;uniffi_cua_sdk_checksum_method_spacesdclient_agents(): number;uniffi_cua_sdk_checksum_method_spacesdclient_attach(): number;uniffi_cua_sdk_checksum_method_spacesdclient_call_json(): number;@@ -6749,6 +6836,14 @@ export type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener = {uniffi_clone: UniffiCallbackInterfaceCloneCuaSdkSpaceCreateListener;on_progress: UniffiCallbackInterfaceCuaSdkSpaceCreateListenerMethod0;};+type UniffiCallbackInterfaceCuaSdkSpacesListListenerMethod0 = (uniffiHandle: bigint, generation: bigint) => UniffiResult<void>;+type UniffiCallbackInterfaceCloneCuaSdkSpacesListListener = (handle: bigint) => UniffiResult<void>;+type UniffiCallbackInterfaceFreeCuaSdkSpacesListListener = (handle: bigint) => void;+export type UniffiVTableCallbackInterfaceCuaSdkSpacesListListener = {+ uniffi_free: UniffiCallbackInterfaceFreeCuaSdkSpacesListListener;+ uniffi_clone: UniffiCallbackInterfaceCloneCuaSdkSpacesListListener;+ on_changed: UniffiCallbackInterfaceCuaSdkSpacesListListenerMethod0;+};type UniffiCallbackInterfaceCuaSdkTeleportApproverMethod0 = (uniffiHandle: bigint, manifest: Uint8Array) => Uint8Array;type UniffiCallbackInterfaceCloneCuaSdkTeleportApprover = (handle: bigint) => UniffiResult<void>;type UniffiCallbackInterfaceFreeCuaSdkTeleportApprover = (handle: bigint) => void;diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.tsindex aa7be6dfed..164600277a 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts@@ -10,7 +10,7 @@/* eslint-disable */// @ts-nocheckimport nativeModule from "./cua_sdk-ffi";-import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceCuaSdkAudioSink, type UniffiVTableCallbackInterfaceCuaSdkBuildListener, type UniffiVTableCallbackInterfaceCuaSdkFrameSink, type UniffiVTableCallbackInterfaceCuaSdkResourcesListener, type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener, type UniffiVTableCallbackInterfaceCuaSdkTeleportApprover,+import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceCuaSdkAudioSink, type UniffiVTableCallbackInterfaceCuaSdkBuildListener, type UniffiVTableCallbackInterfaceCuaSdkFrameSink, type UniffiVTableCallbackInterfaceCuaSdkResourcesListener, type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener, type UniffiVTableCallbackInterfaceCuaSdkSpacesListListener, type UniffiVTableCallbackInterfaceCuaSdkTeleportApprover,} from "./cua_sdk-ffi";import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterFloat64, FfiConverterInt32, FfiConverterInt64, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTypeNameSymbol, variantOrdinalSymbol,} from "@ubjs/core";@@ -37992,6 +37992,305 @@ const uniffiTypeSpaceObjectFactory: UniffiObjectFactory<SpaceLike> = (() => {}})();const FfiConverterTypeSpace = new FfiConverterObject(uniffiTypeSpaceObjectFactory);+/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+export interface SpacesListListener {++/**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+ onChanged(generation: bigint): void;+}+++/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+export class SpacesListListenerImpl extends UniffiAbstractObject implements SpacesListListener {++ readonly [uniffiTypeNameSymbol] = "SpacesListListenerImpl";+ readonly [destructorGuardSymbol]: UniffiGcObject;+ readonly [pointerLiteralSymbol]: UniffiHandle;+ // No primary constructor declared for this class.+private constructor(pointer: UniffiHandle) {+ super();+ this[pointerLiteralSymbol] = pointer;+ this[destructorGuardSymbol] = uniffiTypeSpacesListListenerImplObjectFactory.bless(pointer);+}+++++/**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+ onChanged(generation: bigint): void {uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(+ uniffiTypeSpacesListListenerImplObjectFactory.clonePointer(this),+ FfiConverterUInt64.lower(generation, nativeModule().rustbuffer_alloc),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ );+ }+++ uniffiDestroy(): void {+ const ptr = (this as any)[destructorGuardSymbol];+ if (ptr !== undefined) {+ const pointer = uniffiTypeSpacesListListenerImplObjectFactory.pointer(this);+ uniffiTypeSpacesListListenerImplObjectFactory.freePointer(pointer);+ uniffiTypeSpacesListListenerImplObjectFactory.unbless(ptr);+ delete (this as any)[destructorGuardSymbol];+ }+ }++ static instanceOf(obj_: any): obj_ is SpacesListListenerImpl {+ return uniffiTypeSpacesListListenerImplObjectFactory.isConcreteType(obj_);+ }+++}++const uniffiTypeSpacesListListenerImplObjectFactory: UniffiObjectFactory<SpacesListListener> = (() => {++ /// <reference lib="es2021" />+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {+ uniffiTypeSpacesListListenerImplObjectFactory.freePointer(heldValue);+ }) : null;++ return {+ create(pointer: UniffiHandle): SpacesListListener {+ const instance = Object.create(SpacesListListenerImpl.prototype);+ instance[pointerLiteralSymbol] = pointer;+ instance[destructorGuardSymbol] = this.bless(pointer);+ instance[uniffiTypeNameSymbol] = "SpacesListListenerImpl";+ return instance;+ },+++ bless(p: UniffiHandle): UniffiGcObject {+ const ptr = {+ p, // make sure this object doesn't get optimized away.+ markDestroyed: () => undefined,+ };+ if (registry) {+ registry.register(ptr, p, ptr);+ }+ return ptr;+ },++ unbless(ptr_: UniffiGcObject) {+ if (registry) {+ registry.unregister(ptr_);+ }+ },++ pointer(obj_: SpacesListListener): UniffiHandle {+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {+ throw new UniffiInternalError.UnexpectedNullPointer();+ }+ return (obj_ as any)[pointerLiteralSymbol];+ },++ clonePointer(obj_: SpacesListListener): UniffiHandle {+ const pointer = this.pointer(obj_);+ return uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spaceslistlistener(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ freePointer(pointer: UniffiHandle): void {+ uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spaceslistlistener(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ isConcreteType(obj_: any): obj_ is SpacesListListener {+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesListListenerImpl";+ },+}})();+const FfiConverterTypeSpacesListListener = new FfiConverterObjectWithCallbacks(uniffiTypeSpacesListListenerImplObjectFactory);++// Add a vtable for the callbacks that go in SpacesListListener.++// Put the implementation in a struct so we don't pollute the top-level namespace+const uniffiCallbackInterfaceSpacesListListener: { vtable: any; register: () => void; } = {+ // Create the VTable using a series of closures.+ // ts automatically converts these into C callback functions.+ vtable: {+ on_changed: (+ uniffiHandle: bigint,+ generation: bigint,) => {+ const uniffiMakeCall =+ ()+ : void => {+ const jsCallback = FfiConverterTypeSpacesListListener.lift(uniffiHandle);+ return jsCallback.onChanged(+ FfiConverterUInt64.lift(generation)+ )+ };+ const uniffiResult = UniffiResult.ready<void>();+ const uniffiHandleSuccess = (obj: any) => {};+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {+ UniffiResult.writeError(uniffiResult, code, errBuf);+ };+ uniffiTraitInterfaceCall(+ /*makeCall:*/ uniffiMakeCall,+ /*handleSuccess:*/ uniffiHandleSuccess,+ /*handleError:*/ uniffiHandleError,+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),+ /*alloc:*/ nativeModule().rustbuffer_alloc,+ )+ return uniffiResult;+ },+ uniffi_free: (uniffiHandle: UniffiHandle): void => {+ // this will throw a stale handle error if the handle isn't found.+ FfiConverterTypeSpacesListListener.drop(uniffiHandle);+ },+ uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => {+ return FfiConverterTypeSpacesListListener.clone(uniffiHandle);+ }+ },+ register: () => {nativeModule().uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(+ uniffiCallbackInterfaceSpacesListListener.vtable+ );+ },+};++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+export interface SpacesListWatchLike {++/**+ * Ends the watch. No call is made after this returns.+ */+ stop(): void;+}+/**+ * @deprecated Use `SpacesListWatchLike` instead.+ */+export type SpacesListWatchInterface = SpacesListWatchLike;+++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+export class SpacesListWatch extends UniffiAbstractObject implements SpacesListWatchLike {++ readonly [uniffiTypeNameSymbol] = "SpacesListWatch";+ readonly [destructorGuardSymbol]: UniffiGcObject;+ readonly [pointerLiteralSymbol]: UniffiHandle;+ // No primary constructor declared for this class.+private constructor(pointer: UniffiHandle) {+ super();+ this[pointerLiteralSymbol] = pointer;+ this[destructorGuardSymbol] = uniffiTypeSpacesListWatchObjectFactory.bless(pointer);+}+++++/**+ * Ends the watch. No call is made after this returns.+ */+ stop(): void {uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_spaceslistwatch_stop(+ uniffiTypeSpacesListWatchObjectFactory.clonePointer(this),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ );+ }+++ uniffiDestroy(): void {+ const ptr = (this as any)[destructorGuardSymbol];+ if (ptr !== undefined) {+ const pointer = uniffiTypeSpacesListWatchObjectFactory.pointer(this);+ uniffiTypeSpacesListWatchObjectFactory.freePointer(pointer);+ uniffiTypeSpacesListWatchObjectFactory.unbless(ptr);+ delete (this as any)[destructorGuardSymbol];+ }+ }++ static instanceOf(obj_: any): obj_ is SpacesListWatch {+ return uniffiTypeSpacesListWatchObjectFactory.isConcreteType(obj_);+ }+++}++const uniffiTypeSpacesListWatchObjectFactory: UniffiObjectFactory<SpacesListWatchLike> = (() => {++ /// <reference lib="es2021" />+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {+ uniffiTypeSpacesListWatchObjectFactory.freePointer(heldValue);+ }) : null;++ return {+ create(pointer: UniffiHandle): SpacesListWatchLike {+ const instance = Object.create(SpacesListWatch.prototype);+ instance[pointerLiteralSymbol] = pointer;+ instance[destructorGuardSymbol] = this.bless(pointer);+ instance[uniffiTypeNameSymbol] = "SpacesListWatch";+ return instance;+ },+++ bless(p: UniffiHandle): UniffiGcObject {+ const ptr = {+ p, // make sure this object doesn't get optimized away.+ markDestroyed: () => undefined,+ };+ if (registry) {+ registry.register(ptr, p, ptr);+ }+ return ptr;+ },++ unbless(ptr_: UniffiGcObject) {+ if (registry) {+ registry.unregister(ptr_);+ }+ },++ pointer(obj_: SpacesListWatchLike): UniffiHandle {+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {+ throw new UniffiInternalError.UnexpectedNullPointer();+ }+ return (obj_ as any)[pointerLiteralSymbol];+ },++ clonePointer(obj_: SpacesListWatchLike): UniffiHandle {+ const pointer = this.pointer(obj_);+ return uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spaceslistwatch(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ freePointer(pointer: UniffiHandle): void {+ uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spaceslistwatch(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ isConcreteType(obj_: any): obj_ is SpacesListWatchLike {+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesListWatch";+ },+}})();+const FfiConverterTypeSpacesListWatch = new FfiConverterObject(uniffiTypeSpacesListWatchObjectFactory);+/*** Receives [`ResourcesEvent`]s from [`Spaces::watch_resources`], in order.* Called on an SDK worker thread; return quickly.@@ -38789,6 +39088,15 @@ export interface SpacesLike {* each. Needs Cua Spaces (the Cua Volume).*/volumes(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<NamedVolume>>;+/**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+ watchList(listener: SpacesListListener): SpacesListWatchLike;/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -42023,6 +42331,26 @@ private constructor(pointer: UniffiHandle) {}}+/**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+ watchList(listener: SpacesListListener): SpacesListWatchLike {+ return FfiConverterTypeSpacesListWatch.lift(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_method_spaces_watch_list(+ uniffiTypeSpacesObjectFactory.clonePointer(this),+ FfiConverterTypeSpacesListListener.lower(listener, nativeModule().rustbuffer_alloc),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }+/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -45312,9 +45640,18 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_volumes() !== 15143) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_volumes");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_watch_list() !== 1499) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_watch_list");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_watch_resources() !== 49660) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_watch_resources");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed() !== 40063) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed");+ }+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaceslistwatch_stop() !== 38223) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaceslistwatch_stop");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_spacesdclient_agents() !== 39176) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_agents");}@@ -45510,6 +45847,7 @@ function uniffiEnsureInitialized() {uniffiCallbackInterfaceFrameSink.register();uniffiCallbackInterfaceSpaceCreateListener.register();uniffiCallbackInterfaceTeleportApprover.register();+ uniffiCallbackInterfaceSpacesListListener.register();uniffiCallbackInterfaceResourcesListener.register();}@@ -45774,6 +46112,8 @@ export default Object.freeze({FfiConverterTypeSpacesHost,FfiConverterTypeSpacesHostLimit,FfiConverterTypeSpacesHostLoad,+ FfiConverterTypeSpacesListListener,+ FfiConverterTypeSpacesListWatch,FfiConverterTypeSpacesToolMethod,FfiConverterTypeSpacesdCapabilities,FfiConverterTypeSpacesdClient,diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swiftindex a5f6a57546..f916d88490 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift@@ -753,6 +753,43 @@ public final class AppModel {}}+ /// The daemon's push of list changes (`watchList`), while it is kept.+ private var listWatch: AnyObject?+ /// The read a push started, and whether another push came meanwhile.+ private var listPushRead: Task<Void, Never>?+ private var listPushedAgain = false+ /// How long a push waits for the next one before the list is read (a+ /// computer coming up moves several of its Spaces at once).+ static let listPushSettleMs = 100++ /// Push: the daemon says when the list changed (a Space started or+ /// stopped on another computer, one came up or went away), and the list+ /// is read again then, within a second or two, instead of at the next+ /// poll. The poll stays as the fallback. Started again after a+ /// reconnect.+ public func startListWatch() async {+ listWatch = await backend.watchList { [weak self] in+ Task { @MainActor in self?.listPushed() }+ }+ }++ /// One read per burst of pushes; a push during a read reads once more.+ func listPushed() {+ guard listPushRead == nil else {+ listPushedAgain = true+ return+ }+ listPushRead = Task { @MainActor [weak self] in+ try? await Task.sleep(for: .milliseconds(Self.listPushSettleMs))+ while let self {+ self.listPushedAgain = false+ await self.refresh(fresh: true)+ if !self.listPushedAgain { break }+ }+ self?.listPushRead = nil+ }+ }+/// Reconnects when the list has not been read for `listStaleAfter`/// (nothing before the live services are in).func checkListHealth(now: Date? = nil) async {@@ -775,6 +812,8 @@ public final class AppModel {let ok = await reconnect()listWatchedSince = listClock()reconnecting = false+ // The push came over the old connection: watch on the new one.+ if ok, listWatch != nil { await startListWatch() }if !ok { NSLog("Cua Spaces: the reconnect did not make a new connection; trying again later") }await refresh()}diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swiftindex de8376a5df..426d58d40d 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppStartup.swift@@ -610,6 +610,9 @@ public final class PendingSpacesBackend: SpacesBackend, AgentsToolRunning, Cloudpublic func rows() async throws -> [AppSpaceRow] { try await b().rows() }public func listRead() async throws -> AppListRead { try await b().listRead() }+ public func watchList(_ onChange: @escaping @Sendable () -> Void) async -> AnyObject? {+ await b().watchList(onChange)+ }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 68107408fd..5ff133fc05 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift@@ -17,6 +17,11 @@ public protocol SpacesBackend: AnyObject, Sendable {/// [`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+ /// Calls `onChange` (on an SDK thread) when the Space list changed, and+ /// once at the start (`Spaces.watch_list`): the daemon pushes it, so the+ /// list is read again when something happened. The watch lasts while the+ /// returned handle is kept; `nil` when this backend cannot push.+ func watchList(_ onChange: @escaping @Sendable () -> Void) async -> AnyObject?/// 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@@ -177,6 +182,8 @@ public struct AppListRead: Sendable {public extension SpacesBackend {/// A backend that lists complete lists only.func listRead() async throws -> AppListRead { AppListRead(rows: try await rows()) }+ /// A backend that cannot push: the list poll alone keeps it fresh.+ func watchList(_ onChange: @escaping @Sendable () -> Void) async -> AnyObject? { nil }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 }@@ -261,6 +268,10 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {public func rows() async throws -> [AppSpaceRow] { try await listRead().rows }+ public func watchList(_ onChange: @escaping @Sendable () -> Void) async -> AnyObject? {+ cua.spaces().watchList(listener: ListChangeListener(onChange))+ }+/// 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.@@ -633,6 +644,13 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {}}+/// The SDK's list changes, to a closure.+final class ListChangeListener: SpacesListListener {+ private let forward: @Sendable () -> Void+ init(_ forward: @escaping @Sendable () -> Void) { self.forward = forward }+ func onChanged(generation: UInt64) { forward() }+}+/// The SDK's create progress, to a closure.final class CreateListener: SpaceCreateListener {private let forward: @Sendable (SpaceCreateProgress) -> Void@@ -874,10 +892,21 @@ public final class FixtureSpacesBackend: SpacesBackend, @unchecked Sendable {public var fixtureReaching: UInt32 = 0public func listRead() async throws -> AppListRead {await MainActor.run {- AppListRead(rows: fixtureRows, incomplete: fixtureIncomplete, reaching: fixtureReaching, stale: fixtureIncomplete)+ fixtureListReads += 1+ return AppListRead(rows: fixtureRows, incomplete: fixtureIncomplete, reaching: fixtureReaching, stale: fixtureIncomplete)}}+ /// List reads so far (a push reads the list again).+ public private(set) var fixtureListReads = 0+ private var fixturePush: (@Sendable () -> Void)?+ public func watchList(_ onChange: @escaping @Sendable () -> Void) async -> AnyObject? {+ await MainActor.run { fixturePush = onChange }+ return self+ }+ /// The daemon says the list changed.+ public func pushListChanged() { fixturePush?() }+/// Progress a fixture create reports, in order (the SDK's words).public var createPhases: [SpaceCreateProgress] = [SpaceCreateProgress(phase: "preparing", fraction: nil, detail: ""),diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swiftindex e2db4929f1..6a1ccb49ad 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CuaSpacesMacApp.swift@@ -443,6 +443,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate {// fresh from here rather than from the window.// Bounded, and it reconnects to the daemon when the list goes stale._ = model.startListPoll()+ // ... and the daemon says when it changed, so a Space starting or+ // stopping on another computer shows within a second or two.+ Task { @MainActor in await model.startListWatch() }// Keyvault access is never silent: the notch indicator and the menu// bar line follow live deliveries even with the main window closed.Task { @MainActor indiff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ListPushTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ListPushTests.swiftnew file mode 100644index 0000000000..826975dda4--- /dev/null+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ListPushTests.swift@@ -0,0 +1,75 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++@testable import CuaSpacesMacKit+import CuaSDK+import Foundation+import Testing++/// The daemon says when the Space list changed (a Space started or stopped+/// on another computer), and the app reads it again then, instead of at the+/// next poll, once per burst of pushes. (The time budget from a change to+/// the push is the core's, asserted in `cua_spaces::list_watch`; these run+/// beside suites that hold the main actor for seconds, so they check what+/// happens, with room on the clock.)+@Suite("The list read again when the daemon pushes a change")+@MainActor+struct ListPushTests {+ /// Well past the app's settle time, for a busy main actor.+ static let deadline: Duration = .seconds(15)++ func model(_ backend: SpacesBackend) -> AppModel {+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("cua-push-\(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())+ }++ func until(_ within: Duration, _ done: @MainActor () -> Bool) async -> Bool {+ let clock = ContinuousClock()+ let end = clock.now + within+ while clock.now < end {+ if done() { return true }+ try? await Task.sleep(for: .milliseconds(20))+ }+ return done()+ }++ @Test func aPushedChangeShowsWithoutAPoll() async {+ let backend = FixtureSpacesBackend(rows: FixtureSpacesBackend.sample)+ let m = model(backend)+ await m.refresh()+ await m.startListWatch()+ let before = m.spaces.count+ // A Space starts on another computer: it is in the next read.+ var row = FixtureSpacesBackend.sample[0]+ row.id = "relay:0000000000000abc"+ row.name = "on another computer"+ backend.fixtureRows.append(row)+ // No poll runs here: only the push can bring it in.+ backend.pushListChanged()+ #expect(await until(Self.deadline) { m.spaces.count == before + 1 })+ }++ @Test func aBurstOfPushesReadsTheListOnceOrTwice() async {+ let backend = FixtureSpacesBackend(rows: FixtureSpacesBackend.sample)+ let m = model(backend)+ await m.refresh()+ await m.startListWatch()+ let reads = backend.fixtureListReads+ for _ in 0..<50 { backend.pushListChanged() }+ // Until the reads it started are done (no new one for a while).+ #expect(await until(Self.deadline) { backend.fixtureListReads > reads })+ var settled = backend.fixtureListReads+ while true {+ try? await Task.sleep(for: .milliseconds(500))+ if backend.fixtureListReads == settled { break }+ settled = backend.fixtureListReads+ }+ // No read storm: the burst is one read, plus at most one for pushes+ // that came during it.+ let extra = backend.fixtureListReads - reads+ #expect(extra >= 1 && extra <= 2, "\(extra) reads for one burst")+ }+}diff --git a/apps/cua-spaces-web/src/components/video/tile-video.ts b/apps/cua-spaces-web/src/components/video/tile-video.tsindex 27d6b1023a..d0194a4724 100644--- a/apps/cua-spaces-web/src/components/video/tile-video.ts+++ b/apps/cua-spaces-web/src/components/video/tile-video.ts@@ -25,8 +25,11 @@ export function canStreamTile(space: Space): boolean {* A Space tile's live video: small, at a low frame rate, view only (clicks* and scrolls go to the page). Null where the host draws no video; the tile* keeps its drawn thumbnail under the video, so a stream that never starts- * or fails leaves the thumbnail.+ * or fails leaves the thumbnail. `inView`: the tile is on screen or near it+ * (`useInView`); off it, no video.*/-export function useTileVideo(ref: RefObject<HTMLElement | null>, space: Space): VideoSlot | null {- return useVideoSlot(ref, { active: canStreamTile(space), spaceId: space.id, tier: "tile", interactive: false, radius: TILE_RADIUS, os: space.os });+export function useTileVideo(ref: RefObject<HTMLElement | null>, space: Space, inView = true): VideoSlot | null {+ // Only tiles near the viewport stream: the host opens one live session per+ // slot, and a grid of 200 running Spaces would decode 200 desktops.+ return useVideoSlot(ref, { active: inView && canStreamTile(space), spaceId: space.id, tier: "tile", interactive: false, radius: TILE_RADIUS, os: space.os });}diff --git a/apps/cua-spaces-web/src/hooks/use-in-view.test.tsx b/apps/cua-spaces-web/src/hooks/use-in-view.test.tsxnew file mode 100644index 0000000000..6b1f3318db--- /dev/null+++ b/apps/cua-spaces-web/src/hooks/use-in-view.test.tsx@@ -0,0 +1,55 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { act, renderHook } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";++import { useInView } from "./use-in-view";++type Callback = (entries: { isIntersecting: boolean }[]) => void;++/** An IntersectionObserver the test drives. */+function fakeObserver() {+ const observers: { cb: Callback; margin?: string; observed: number; disconnected: boolean }[] = [];+ class FakeIO {+ o: (typeof observers)[number];+ constructor(cb: Callback, init?: { rootMargin?: string }) {+ this.o = { cb, margin: init?.rootMargin, observed: 0, disconnected: false };+ observers.push(this.o);+ }+ observe() {+ this.o.observed += 1;+ }+ disconnect() {+ this.o.disconnected = true;+ }+ }+ vi.stubGlobal("IntersectionObserver", FakeIO);+ return observers;+}++describe("useInView", () => {+ afterEach(() => vi.unstubAllGlobals());++ it("is false until the element nears the viewport, and follows it out again", () => {+ const observers = fakeObserver();+ const el = document.createElement("div");+ const { result, unmount } = renderHook(() => useInView({ current: el }));+ // A grid of many Spaces: an off-screen tile asks for nothing.+ expect(result.current).toBe(false);+ expect(observers).toHaveLength(1);+ expect(observers[0]!.margin).toBe("400px");+ act(() => observers[0]!.cb([{ isIntersecting: true }]));+ expect(result.current).toBe(true);+ act(() => observers[0]!.cb([{ isIntersecting: false }]));+ expect(result.current).toBe(false);+ unmount();+ expect(observers[0]!.disconnected).toBe(true);+ });++ it("is true where the page cannot tell", () => {+ vi.stubGlobal("IntersectionObserver", undefined);+ const { result } = renderHook(() => useInView({ current: document.createElement("div") }));+ expect(result.current).toBe(true);+ });+});diff --git a/apps/cua-spaces-web/src/hooks/use-in-view.ts b/apps/cua-spaces-web/src/hooks/use-in-view.tsnew file mode 100644index 0000000000..ac7d180849--- /dev/null+++ b/apps/cua-spaces-web/src/hooks/use-in-view.ts@@ -0,0 +1,28 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { useEffect, useState, type RefObject } from "react";++/** How far outside the viewport a tile already counts as shown, so it has+ * its picture by the time it scrolls in. */+export const IN_VIEW_MARGIN = "400px";++/**+ * Whether `ref`'s element is on screen (or within `margin` of it). A grid of+ * many Spaces asks for pictures and live video only for the tiles near the+ * viewport, so 200 Spaces cost what the dozen on screen cost. True where+ * the page cannot tell (no IntersectionObserver), as before.+ */+export function useInView(ref: RefObject<Element | null>, margin = IN_VIEW_MARGIN): boolean {+ const [inView, setInView] = useState(() => typeof IntersectionObserver === "undefined");+ useEffect(() => {+ const el = ref.current;+ if (!el || typeof IntersectionObserver === "undefined") return;+ const io = new IntersectionObserver((entries) => {+ for (const e of entries) setInView(e.isIntersecting);+ }, { rootMargin: margin });+ io.observe(el);+ return () => io.disconnect();+ }, [ref, margin]);+ return inView;+}diff --git a/apps/cua-spaces-web/src/routes/spaces/index.tsx b/apps/cua-spaces-web/src/routes/spaces/index.tsxindex b6708dca60..dd52f14a34 100644--- a/apps/cua-spaces-web/src/routes/spaces/index.tsx+++ b/apps/cua-spaces-web/src/routes/spaces/index.tsx@@ -18,6 +18,7 @@ import { SpaceCanvas } from "@/components/space-canvas";import { StateLabel } from "@/components/state-dot";import { useTileVideo } from "@/components/video/tile-video";import { useNewSpace } from "@/hooks/use-new-space";+import { useInView } from "@/hooks/use-in-view";import { useQuiet } from "@/hooks/use-quiet";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";@@ -184,7 +185,8 @@ function SpacesPage() {) : (<ul className="grid grid-cols-[repeat(auto-fill,minmax(232px,1fr))] gap-4">{shown.map((space) => (- <li key={space.id}>+ // Off-screen tiles skip layout and paint until they scroll in.+ <li key={space.id} className="[content-visibility:auto] [contain-intrinsic-size:auto_232px]"><SpaceTile space={space} machine={machineName(machines, space)} accessKey={access.signedIn.has(space.id) ? access.accessKey(space.id) : undefined} /></li>))}@@ -383,9 +385,11 @@ function SpaceLink({ space, machine, windowOver = false }: { space: Space; machifunction Thumbnail({ space }: { space: Space }) {const state = spaceState(space);const ref = useRef<HTMLDivElement | null>(null);- const video = useTileVideo(ref, space);+ // Pictures and live video only for the tiles on screen (or close to it).+ const inView = useInView(ref);+ const video = useTileVideo(ref, space, inView);// Its latest capture (the notch's image), until live video draws over it.- const thumbnail = useSpaceThumbnail(space.id, state === "running" || state === "stopped");+ const thumbnail = useSpaceThumbnail(space.id, inView && (state === "running" || state === "stopped"));return (<SpaceCanvas ref={ref} dim={state === "stopped"} streamState={video?.phase}>{thumbnail ? (diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdxindex a31fc02fe4..1f3eba47cc 100644--- a/docs/content/docs/cua-sdk/reference/index.mdx+++ b/docs/content/docs/cua-sdk/reference/index.mdx@@ -62,6 +62,7 @@ The Cua SDK in Python, TypeScript, Swift, Kotlin and Rust, all generated from th| [Cua Volume](/cua-sdk/reference/spaces/volume) | The versioned volume every Space and agent shares: files, history, grants, requests, audit, storage and sync. || [Streams and presence](/cua-sdk/reference/spaces/streams) | Media sessions of a Space and presence (who is connected, and their cursors). || [Processor, memory and disk](/cua-sdk/reference/spaces/resources) | What this Mac, its extra Spaces and your other computers use: one snapshot, a stream of changes and the low-disk warning. |+| [List changes](/cua-sdk/reference/spaces/list-watch) | Hear when the Space list changed, so it is read again then instead of on a timer. || [Agents in a Space](/cua-sdk/reference/spaces/agents) | Start, follow, message and stop coding-agent runs inside a Space. || [Persistent agents and your cloud](/cua-sdk/reference/spaces/persistent-agents) | Named agents whose memory outlives their Space: homes in the Cua Volume, routines, notifications, pause and resume, access to your computers, and Spaces in your own AWS, Google Cloud or Modal account. || [Host, relay and devices](/cua-sdk/reference/spaces/host) | Unattended host setup, the cua-relay directory client, and this device's enrollment on the relay. |@@ -93,4 +94,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`). |-336 items, 419 methods. The [Types](/cua-sdk/reference/types) page lists them.+338 items, 422 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 f73263b28d..7b150ddf05 100644--- a/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/daemon-spaces.mdx@@ -60,6 +60,7 @@ without touching it.| [`GetSpaceRoute`](#spaceservicegetspaceroute) | [`GetSpaceRouteRequest`](#getspacerouterequest) | [`GetSpaceRouteResponse`](#getspacerouteresponse) | unary || [`GetResources`](#spaceservicegetresources) | [`GetResourcesRequest`](/cua-sdk/reference/protocol/daemon-resources#getresourcesrequest) | [`GetResourcesResponse`](/cua-sdk/reference/protocol/daemon-resources#getresourcesresponse) | unary || [`WatchResources`](#spaceservicewatchresources) | [`WatchResourcesRequest`](/cua-sdk/reference/protocol/daemon-resources#watchresourcesrequest) | [`WatchResourcesResponse`](/cua-sdk/reference/protocol/daemon-resources#watchresourcesresponse) | server stream |+| [`WatchSpaces`](#spaceservicewatchspaces) | [`WatchSpacesRequest`](#watchspacesrequest) | [`WatchSpacesResponse`](#watchspacesresponse) | server stream |### SpaceService.AddSpace@@ -295,6 +296,18 @@ sampled every 5 minutes and still hears `low_disk`, for the menu bar.Cancel the stream to stop; call again with the other `visible` toswitch.+### SpaceService.WatchSpaces++`/cua.daemon.v1.SpaceService/WatchSpaces`, server stream: [`WatchSpacesRequest`](#watchspacesrequest) to [`WatchSpacesResponse`](#watchspacesresponse).++Says when the Space list changed, so a client reads it again+(`ListSpaces`) when something happened instead of on a timer: one+message at once (the generation now), then one per change. This+computer's Spaces are announced within a second; your other computers+on the mesh within about a second of connecting or going away (the mesh+coordinator pushes it); computers not on the mesh within 10 seconds.+Cancel the stream to stop.+## DaemonService`cua.daemon.v1.DaemonService`@@ -329,6 +342,20 @@ Stops the daemon after the response is sent.## Types in `cua/daemon/v1/spaces.proto`+### WatchSpacesRequest++`SpaceService.WatchSpaces` takes no arguments.++No fields.++### WatchSpacesResponse++One event of `SpaceService.WatchSpaces`.++| Field | # | Type | Description |+| --- | --- | --- | --- |+| `generation` | 1 | `uint64` | Moves on every change of the list (only increases while the daemon runs; a new daemon starts again from 0). |+### SpaceA registered Space.diff --git a/docs/content/docs/cua-sdk/reference/protocol/index.mdx b/docs/content/docs/cua-sdk/reference/protocol/index.mdxindex 15f9c7ee7c..e3e3330387 100644--- a/docs/content/docs/cua-sdk/reference/protocol/index.mdx+++ b/docs/content/docs/cua-sdk/reference/protocol/index.mdx@@ -58,7 +58,7 @@ Tickets go in `?ticket=` or the WebSocket subprotocol `cua.ticket.<ticket>`. Tic| [`SandboxService`](/cua-sdk/reference/protocol/daemon#sandboxservice) | `cua.daemon.v1` | [Cua daemon: sandboxes and runtimes](/cua-sdk/reference/protocol/daemon) | 27 || [`PoolService`](/cua-sdk/reference/protocol/daemon#poolservice) | `cua.daemon.v1` | [Cua daemon: sandboxes and runtimes](/cua-sdk/reference/protocol/daemon) | 4 || [`RuntimeService`](/cua-sdk/reference/protocol/daemon#runtimeservice) | `cua.daemon.v1` | [Cua daemon: sandboxes and runtimes](/cua-sdk/reference/protocol/daemon) | 5 |-| [`SpaceService`](/cua-sdk/reference/protocol/daemon-spaces#spaceservice) | `cua.daemon.v1` | [Daemon: Spaces and service](/cua-sdk/reference/protocol/daemon-spaces) | 29 |+| [`SpaceService`](/cua-sdk/reference/protocol/daemon-spaces#spaceservice) | `cua.daemon.v1` | [Daemon: Spaces and service](/cua-sdk/reference/protocol/daemon-spaces) | 30 || [`DaemonService`](/cua-sdk/reference/protocol/daemon-spaces#daemonservice) | `cua.daemon.v1` | [Daemon: Spaces and service](/cua-sdk/reference/protocol/daemon-spaces) | 3 |## Metadata and HTTP routesdiff --git a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdxindex 9651e27b97..022dbcec8a 100644--- a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx+++ b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx@@ -18,7 +18,7 @@ The cua SDK: the only `#[uniffi::export]` crate of `libs/cua`.These are the objects, records, enums and functions the language bindings export, documented once in the [Cua SDK reference](/cua-sdk/reference), whose Rust tabs show each signature. Objects are `Arc<T>` handles whose methods are `async fn` returning `Result<_, CuaError>`, records are structs with public fields, and names are snake_case.-[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces/agents#agentactionreport-record), [`AgentArtifact`](/cua-sdk/reference/agents#agentartifact-record), [`AgentDelivery`](/cua-sdk/reference/spaces/persistent-agents#agentdelivery-record), [`AgentEvent`](/cua-sdk/reference/agents#agentevent-record), [`AgentEventPage`](/cua-sdk/reference/agents#agenteventpage-record), [`AgentFile`](/cua-sdk/reference/agents#agentfile-record), [`AgentInfo`](/cua-sdk/reference/agent-setup#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agent-setup#agentmcpserver-record), [`AgentPauseReport`](/cua-sdk/reference/spaces/persistent-agents#agentpausereport-record), [`AgentResumeReport`](/cua-sdk/reference/spaces/persistent-agents#agentresumereport-record), [`AgentRun`](/cua-sdk/reference/agents#agentrun), [`AgentRunInfo`](/cua-sdk/reference/agents#agentruninfo-record), [`AgentRunMcpServer`](/cua-sdk/reference/agents#agentrunmcpserver-record), [`AgentRunOptions`](/cua-sdk/reference/agents#agentrunoptions-record), [`AgentRunResult`](/cua-sdk/reference/agents#agentrunresult-record), [`AgentRunStatus`](/cua-sdk/reference/spaces/agents#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agent-setup#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agent-setup#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agent-setup#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agent-setup#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces/agents#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox/lifecycle#ambiguous_sandbox_candidates), [`AudioPacket`](/cua-sdk/reference/spacesd/computer#audiopacket-record), [`AudioSink`](/cua-sdk/reference/spacesd/computer#audiosink), [`Auth`](/cua-sdk/reference/auth#auth), [`AuthIdentity`](/cua-sdk/reference/auth#authidentity-record), [`AuthStatus`](/cua-sdk/reference/auth#authstatus-record), [`BakeForkCheck`](/cua-sdk/reference/sandbox/bake#bakeforkcheck-record), [`BakeOptions`](/cua-sdk/reference/sandbox/bake#bakeoptions-record), [`BakeSummary`](/cua-sdk/reference/sandbox/bake#bakesummary-record), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BuildImageConfig`](/cua-sdk/reference/spaces/build#buildimageconfig-record), [`BuildInfo`](/cua-sdk/reference/spaces/build#buildinfo-record), [`BuildListener`](/cua-sdk/reference/spaces/build#buildlistener), [`BuildOptions`](/cua-sdk/reference/spaces/build#buildoptions-record), [`BuildProgress`](/cua-sdk/reference/spaces/build#buildprogress-record), [`BuildResult`](/cua-sdk/reference/spaces/build#buildresult-record), [`BuildStep`](/cua-sdk/reference/spaces/build#buildstep-enum), [`BuildStepResult`](/cua-sdk/reference/spaces/build#buildstepresult-record), [`BundledSkill`](/cua-sdk/reference/agent-setup#bundledskill-record), [`canonical_image`](/cua-sdk/reference/image#canonical_image), [`canonical_image_tier`](/cua-sdk/reference/image#canonical_image_tier), [`check_placement`](/cua-sdk/reference/cua#check_placement), [`CheckpointSummary`](/cua-sdk/reference/sandbox/checkpoints#checkpointsummary-record), [`CloudAuditEntry`](/cua-sdk/reference/spaces/persistent-agents#cloudauditentry-record), [`CloudCheck`](/cua-sdk/reference/spaces/persistent-agents#cloudcheck-record), [`CloudConnected`](/cua-sdk/reference/spaces/persistent-agents#cloudconnected-record), [`CloudCredentials`](/cua-sdk/reference/spaces/persistent-agents#cloudcredentials-record), [`CloudDisconnected`](/cua-sdk/reference/spaces/persistent-agents#clouddisconnected-record), [`CloudKind`](/cua-sdk/reference/spaces/persistent-agents#cloudkind-record), [`CloudProvider`](/cua-sdk/reference/spaces/persistent-agents#cloudprovider-record), [`CloudResource`](/cua-sdk/reference/spaces/persistent-agents#cloudresource-record), [`CloudStatus`](/cua-sdk/reference/spaces/persistent-agents#cloudstatus-record), [`CloudSweepItem`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepitem-record), [`CloudSweepReport`](/cua-sdk/reference/spaces/persistent-agents#cloudsweepreport-record), [`CloudTarget`](/cua-sdk/reference/spaces/persistent-agents#cloudtarget-record), [`CloudTestReport`](/cua-sdk/reference/spaces/persistent-agents#cloudtestreport-record), [`ComputerGrant`](/cua-sdk/reference/spaces/persistent-agents#computergrant-record), [`ComputerResources`](/cua-sdk/reference/spaces/resources#computerresources-record), [`config_get`](/cua-sdk/reference/cua#config_get), [`config_list`](/cua-sdk/reference/cua#config_list), [`config_path`](/cua-sdk/reference/cua#config_path), [`config_set`](/cua-sdk/reference/cua#config_set), [`config_unset`](/cua-sdk/reference/cua#config_unset), [`ConfigEntry`](/cua-sdk/reference/cua#configentry-record), [`Container`](/cua-sdk/reference/image#container-record), [`contrib_providers_built`](/cua-sdk/reference/sandbox#contrib_providers_built), [`Cua`](/cua-sdk/reference/cua#cua), [`CuaConfig`](/cua-sdk/reference/cua#cuaconfig-record), [`CuaInfo`](/cua-sdk/reference/cua#cuainfo-record), [`CuaMode`](/cua-sdk/reference/cua#cuamode-enum), [`CursorArt`](/cua-sdk/reference/spaces/streams#cursorart-record), [`DeviceEnrollment`](/cua-sdk/reference/spaces/host#deviceenrollment-record), [`Devices`](/cua-sdk/reference/spaces/host#devices), [`DevicesSnapshot`](/cua-sdk/reference/spaces/host#devicessnapshot-record), [`DiskLevel`](/cua-sdk/reference/spaces/resources#disklevel-enum), [`DiskOnHost`](/cua-sdk/reference/spaces/resources#diskonhost-record), [`DiskWarning`](/cua-sdk/reference/spaces/resources#diskwarning-record), [`DoctorReport`](/cua-sdk/reference/cua#doctorreport-record), [`DriveAccessRequest`](/cua-sdk/reference/spaces/volume#driveaccessrequest-record), [`DriveAudit`](/cua-sdk/reference/spaces/volume#driveaudit-record), [`DriveAuditEvent`](/cua-sdk/reference/spaces/volume#driveauditevent-record), [`DriveCacheStats`](/cua-sdk/reference/spaces/volume#drivecachestats-record), [`DriveConflict`](/cua-sdk/reference/spaces/volume#driveconflict-record), [`DriveDevice`](/cua-sdk/reference/spaces/volume#drivedevice-record), [`DriveEntry`](/cua-sdk/reference/spaces/volume#driveentry-record), [`DriveFile`](/cua-sdk/reference/spaces/volume#drivefile-record), [`DriveFileSync`](/cua-sdk/reference/spaces/volume#drivefilesync-record), [`DriveGrant`](/cua-sdk/reference/spaces/volume#drivegrant-record), [`DriveListing`](/cua-sdk/reference/spaces/volume#drivelisting-record), [`DriveMountStatus`](/cua-sdk/reference/spaces/volume#drivemountstatus-record), [`DriveObject`](/cua-sdk/reference/spaces/volume#driveobject-record), [`DrivePendingUpload`](/cua-sdk/reference/spaces/volume#drivependingupload-record), [`DriveS3Settings`](/cua-sdk/reference/spaces/volume#drives3settings-record), [`DriveSpaceVolume`](/cua-sdk/reference/spaces/volume#drivespacevolume-record), [`DriveStorage`](/cua-sdk/reference/spaces/volume#drivestorage-record), [`DriveStorageCheck`](/cua-sdk/reference/spaces/volume#drivestoragecheck-record), [`DriveStorageUpdate`](/cua-sdk/reference/spaces/volume#drivestorageupdate-record), [`DriveSyncEvent`](/cua-sdk/reference/spaces/volume#drivesyncevent-record), [`DriveSyncEvents`](/cua-sdk/reference/spaces/volume#drivesyncevents-record), [`DriveSyncStatus`](/cua-sdk/reference/spaces/volume#drivesyncstatus-record), [`DriveVersion`](/cua-sdk/reference/spaces/volume#driveversion-record), [`DriveView`](/cua-sdk/reference/spaces/volume#driveview-record), [`EgressEnforcement`](/cua-sdk/reference/spaces/space#egressenforcement-enum), [`EgressPolicy`](/cua-sdk/reference/spaces#egresspolicy-record), [`ElasticAssignment`](/cua-sdk/reference/spaces/elastic#elasticassignment-record), [`ElasticBudget`](/cua-sdk/reference/spaces/elastic#elasticbudget-record), [`ElasticBudgetUpdate`](/cua-sdk/reference/spaces/elastic#elasticbudgetupdate-record), [`ElasticDecision`](/cua-sdk/reference/spaces/elastic#elasticdecision-record), [`ElasticHost`](/cua-sdk/reference/spaces/elastic#elastichost-record), [`ElasticNewHost`](/cua-sdk/reference/spaces/elastic#elasticnewhost-record), [`ElasticPlan`](/cua-sdk/reference/spaces/elastic#elasticplan-record), [`ElasticPlanRequest`](/cua-sdk/reference/spaces/elastic#elasticplanrequest-record), [`ElasticRemoved`](/cua-sdk/reference/spaces/elastic#elasticremoved-record), [`ElasticUnplaced`](/cua-sdk/reference/spaces/elastic#elasticunplaced-record), [`ForkBatch`](/cua-sdk/reference/sandbox/fork-batch#forkbatch), [`ForkBatchEvent`](/cua-sdk/reference/sandbox/fork-batch#forkbatchevent-enum), [`ForkBatchItem`](/cua-sdk/reference/sandbox/fork-batch#forkbatchitem-record), [`ForkBatchPlacement`](/cua-sdk/reference/sandbox/fork-batch#forkbatchplacement-record), [`ForkBatchResult`](/cua-sdk/reference/sandbox/fork-batch#forkbatchresult-record), [`ForkBatchSummary`](/cua-sdk/reference/sandbox/fork-batch#forkbatchsummary-record), [`ForkGroup`](/cua-sdk/reference/sandbox/fork-batch#forkgroup-record), [`ForkManyOptions`](/cua-sdk/reference/sandbox/fork-batch#forkmanyoptions-record), [`FrameSink`](/cua-sdk/reference/spacesd/computer#framesink), [`GpuOption`](/cua-sdk/reference/spaces#gpuoption-record), [`GpuSupport`](/cua-sdk/reference/spaces#gpusupport-record), [`GuestDisplay`](/cua-sdk/reference/spacesd#guestdisplay), [`GuestUsage`](/cua-sdk/reference/spaces/resources#guestusage-record), [`HomeTransfer`](/cua-sdk/reference/spaces/persistent-agents#hometransfer-record), [`Host`](/cua-sdk/reference/spaces/host#host), [`HostAccessRecord`](/cua-sdk/reference/spaces/host#hostaccessrecord-record), [`HostPermission`](/cua-sdk/reference/spaces/host#hostpermission-record), [`HostProvidedSpace`](/cua-sdk/reference/spaces/host#hostprovidedspace-record), [`HostServiceMigration`](/cua-sdk/reference/spaces/host#hostservicemigration-record), [`HostSettingsChange`](/cua-sdk/reference/spaces/host#hostsettingschange-record), [`HostSetupOptions`](/cua-sdk/reference/spaces/host#hostsetupoptions-record), [`HostSpacesAuditRecord`](/cua-sdk/reference/spaces/host#hostspacesauditrecord-record), [`HostStatus`](/cua-sdk/reference/spaces/host#hoststatus-record), [`HttpHeader`](/cua-sdk/reference/services#httpheader-record), [`HttpResponse`](/cua-sdk/reference/services#httpresponse-record), [`image_alias`](/cua-sdk/reference/image#image_alias), [`ImageBuild`](/cua-sdk/reference/image#imagebuild-record), [`ImageInfo`](/cua-sdk/reference/image#imageinfo-record), [`ImageLayer`](/cua-sdk/reference/image#imagelayer-enum), [`Local`](/cua-sdk/reference/cua#local), [`LocalImage`](/cua-sdk/reference/cua#localimage-record), [`LocalStorage`](/cua-sdk/reference/cua#localstorage-record), [`LocationInfo`](/cua-sdk/reference/cua#locationinfo-record), [`locations`](/cua-sdk/reference/cua#locations), [`LoginAttempt`](/cua-sdk/reference/auth#loginattempt), [`LoginMethod`](/cua-sdk/reference/auth#loginmethod-enum), [`MachineHealth`](/cua-sdk/reference/spaces/host#machinehealth-record), [`MachineHealthCheck`](/cua-sdk/reference/spaces/host#machinehealthcheck-record), [`may_have_session`](/cua-sdk/reference/auth#may_have_session), [`mcp_connect`](/cua-sdk/reference/services#mcp_connect), [`mcp_connect_url`](/cua-sdk/reference/services#mcp_connect_url), [`McpClient`](/cua-sdk/reference/services#mcpclient), [`McpConfig`](/cua-sdk/reference/services#mcpconfig-record), [`MediaBridge`](/cua-sdk/reference/spacesd/computer#mediabridge-record), [`MediaEvent`](/cua-sdk/reference/spacesd/computer#mediaevent-record), [`MediaSession`](/cua-sdk/reference/spacesd/computer#mediasession), [`MediaStats`](/cua-sdk/reference/spacesd/computer#mediastats-record), [`NamedVolume`](/cua-sdk/reference/spaces/volume#namedvolume-record), [`normalize_image`](/cua-sdk/reference/image#normalize_image), [`NotificationInfo`](/cua-sdk/reference/spaces/persistent-agents#notificationinfo-record), [`omarchy_image`](/cua-sdk/reference/image#omarchy_image), [`Overlay`](/cua-sdk/reference/sandbox#overlay-record), [`OverlayResult`](/cua-sdk/reference/sandbox#overlayresult-record), [`PairingCode`](/cua-sdk/reference/spaces/host#pairingcode-record), [`parse_sandbox_ref`](/cua-sdk/reference/sandbox/lifecycle#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PoolCreateOptions`](/cua-sdk/reference/image#poolcreateoptions-record), [`PortForward`](/cua-sdk/reference/services#portforward), [`presence_color`](/cua-sdk/reference/spaces/streams#presence_color), [`presence_conformance_json`](/cua-sdk/reference/spaces/streams#presence_conformance_json), [`presence_cursor_art`](/cua-sdk/reference/spaces/streams#presence_cursor_art), [`presence_cursor_art_all`](/cua-sdk/reference/spaces/streams#presence_cursor_art_all), [`presence_cursor_art_svg`](/cua-sdk/reference/spaces/streams#presence_cursor_art_svg), [`presence_now_ms`](/cua-sdk/reference/spaces/streams#presence_now_ms), [`presence_text_color`](/cua-sdk/reference/spaces/streams#presence_text_color), [`PresenceCursor`](/cua-sdk/reference/spaces/streams#presencecursor-record), [`PresenceDrawable`](/cua-sdk/reference/spaces/streams#presencedrawable-record), [`PresenceEvent`](/cua-sdk/reference/spaces/streams#presenceevent-record), [`PresenceIdentity`](/cua-sdk/reference/spaces/streams#presenceidentity-record), [`PresenceMember`](/cua-sdk/reference/spaces/streams#presencemember-record), [`PresenceParticipant`](/cua-sdk/reference/spaces/streams#presenceparticipant-record), [`PresencePoint`](/cua-sdk/reference/spaces/streams#presencepoint-record), [`PresenceView`](/cua-sdk/reference/spaces/streams#presenceview), [`Prewarm`](/cua-sdk/reference/spaces/elastic#prewarm-record), [`PrewarmOptions`](/cua-sdk/reference/spaces/elastic#prewarmoptions-record), [`PrewarmPlacement`](/cua-sdk/reference/spaces/elastic#prewarmplacement-record), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox/lifecycle#qualify_sandbox_ref), [`ReadinessProbe`](/cua-sdk/reference/image#readinessprobe-record), [`RegistrySecret`](/cua-sdk/reference/image#registrysecret-enum), [`Relay`](/cua-sdk/reference/spaces/host#relay), [`RelayAuditEvent`](/cua-sdk/reference/spaces/host#relayauditevent-record), [`RelayClientInfo`](/cua-sdk/reference/spaces/host#relayclientinfo-record), [`RelayDevice`](/cua-sdk/reference/spaces/host#relaydevice-record), [`RelayMachine`](/cua-sdk/reference/spaces/host#relaymachine-record), [`ReplayMode`](/cua-sdk/reference/spacesd/shell#replaymode-enum), [`resolve_image`](/cua-sdk/reference/image#resolve_image), [`resolve_image_with_secret`](/cua-sdk/reference/image#resolve_image_with_secret), [`ResolvedImage`](/cua-sdk/reference/image#resolvedimage-record), [`ResourcesEvent`](/cua-sdk/reference/spaces/resources#resourcesevent-enum), [`ResourcesListener`](/cua-sdk/reference/spaces/resources#resourceslistener), [`ResourcesSnapshot`](/cua-sdk/reference/spaces/resources#resourcessnapshot-record), [`ResourcesUpdate`](/cua-sdk/reference/spaces/resources#resourcesupdate-record), [`ResourcesWatch`](/cua-sdk/reference/spaces/resources#resourceswatch), [`RoutineInfo`](/cua-sdk/reference/spaces/persistent-agents#routineinfo-record), [`RuntimeCheck`](/cua-sdk/reference/cua#runtimecheck-record), [`RuntimeCheckStatus`](/cua-sdk/reference/cua#runtimecheckstatus-enum), [`Sandbox`](/cua-sdk/reference/sandbox#sandbox), [`sandbox_locations`](/cua-sdk/reference/sandbox#sandbox_locations), [`SandboxCreateOptions`](/cua-sdk/reference/image#sandboxcreateoptions-record), [`Sandboxes`](/cua-sdk/reference/sandbox#sandboxes), [`SandboxInfo`](/cua-sdk/reference/sandbox#sandboxinfo-record), [`SandboxListing`](/cua-sdk/reference/sandbox#sandboxlisting-record), [`SandboxPhase`](/cua-sdk/reference/sandbox#sandboxphase-enum), [`SandboxPool`](/cua-sdk/reference/image#sandboxpool-record), [`SandboxRefParts`](/cua-sdk/reference/sandbox/lifecycle#sandboxrefparts-record), [`SandboxStatus`](/cua-sdk/reference/sandbox#sandboxstatus-enum), [`Service`](/cua-sdk/reference/services#service), [`ServiceEndpoint`](/cua-sdk/reference/services#serviceendpoint-record), [`SetupStep`](/cua-sdk/reference/cua#setupstep-record), [`Share`](/cua-sdk/reference/share#share-record), [`ShareAccess`](/cua-sdk/reference/share#shareaccess-enum), [`ShareCheck`](/cua-sdk/reference/share#sharecheck-record), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`SnapshotFallbackOptions`](/cua-sdk/reference/sandbox/fork-batch#snapshotfallbackoptions-record), [`SnapshotSyncProgress`](/cua-sdk/reference/sandbox/fork-batch#snapshotsyncprogress-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces/agents#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpaceList`](/cua-sdk/reference/spaces#spacelist-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`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), [`SpacesListListener`](/cua-sdk/reference/spaces/list-watch#spaceslistlistener), [`SpacesListWatch`](/cua-sdk/reference/spaces/list-watch#spaceslistwatch), [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record), [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record), [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession), [`SpaceStreamStats`](/cua-sdk/reference/spaces/streams#spacestreamstats-record), [`SpaceStreamTicket`](/cua-sdk/reference/spaces/streams#spacestreamticket-record), [`SpaceToolInfo`](/cua-sdk/reference/spaces/space#spacetoolinfo-record), [`SpaceToolResult`](/cua-sdk/reference/spaces/space#spacetoolresult-record), [`SpaceTransferReport`](/cua-sdk/reference/spaces/space#spacetransferreport-record), [`SpaceTransport`](/cua-sdk/reference/spaces/channel#spacetransport-record), [`SpaceUsage`](/cua-sdk/reference/spaces/space#spaceusage-record), [`SpaceWindow`](/cua-sdk/reference/spaces/space#spacewindow-record), [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record), [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record), [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record), [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice), [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice), [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due), [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state), [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text), [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run), [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature), [`telemetry_record_onboarding_step`](/cua-sdk/reference/auth#telemetry_record_onboarding_step), [`telemetry_record_stream_stats`](/cua-sdk/reference/auth#telemetry_record_stream_stats), [`telemetry_reset_id`](/cua-sdk/reference/auth#telemetry_reset_id), [`telemetry_schema_json`](/cua-sdk/reference/auth#telemetry_schema_json), [`telemetry_set_enabled`](/cua-sdk/reference/auth#telemetry_set_enabled), [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface), [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last), [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status), [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account), [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record), [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record), [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover), [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record), [`TeleportItem`](/cua-sdk/reference/spaces/space#teleportitem-record), [`TeleportManifest`](/cua-sdk/reference/spaces/space#teleportmanifest-record), [`TeleportReceipt`](/cua-sdk/reference/spaces/space#teleportreceipt-record), [`VideoFrame`](/cua-sdk/reference/spacesd/computer#videoframe-record), [`ViewerLink`](/cua-sdk/reference/sandbox#viewerlink-record), [`ViewerOptions`](/cua-sdk/reference/sandbox#vieweroptions-record), [`VolumeMount`](/cua-sdk/reference/spaces/volume#volumemount-record).## Typesdiff --git a/docs/content/docs/cua-sdk/reference/spaces/index.mdx b/docs/content/docs/cua-sdk/reference/spaces/index.mdxindex 59d94b1b27..eda84871fc 100644--- a/docs/content/docs/cua-sdk/reference/spaces/index.mdx+++ b/docs/content/docs/cua-sdk/reference/spaces/index.mdx@@ -113,6 +113,7 @@ Returned by [`Cua.spaces`](/cua-sdk/reference/cua#cua).| [`volume_unmount`](/cua-sdk/reference/spaces/volume#spacesvolume_unmount) | `volume_unmount`: turns the mount off; pending uploads land first. || [`volume_write`](/cua-sdk/reference/spaces/volume#spacesvolume_write) | `volume_write`: a new version of a file. || [`volumes`](/cua-sdk/reference/spaces/volume#spacesvolumes) | The named volumes of Cua Volume, by name, with the Spaces that mount each. |+| [`watch_list`](/cua-sdk/reference/spaces/list-watch#spaceswatch_list) | Tells `listener` when the Space list changed: once at the start, then on every change. || [`watch_resources`](/cua-sdk/reference/spaces/resources#spaceswatch_resources) | The same numbers as events for `listener`: a snapshot first, then an update with only the entries that changed by more than 1 point or 256 MB, and `LowDisk` whenever the warning level changes. |### `Spaces.add`diff --git a/docs/content/docs/cua-sdk/reference/spaces/list-watch.mdx b/docs/content/docs/cua-sdk/reference/spaces/list-watch.mdxnew file mode 100644index 0000000000..58daa07281--- /dev/null+++ b/docs/content/docs/cua-sdk/reference/spaces/list-watch.mdx@@ -0,0 +1,143 @@+---+title: "List changes"+description: "Hear when the Space list changed, so it is read again then instead of on a timer."+---++{/*+ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY+ Generated by: pnpm --dir docs docs:generate:cua-sdk+ Source: cua-bindgen docs (UniFFI metadata of libcua_sdk)+ Version: 0.9.0+*/}++import { Callout } from 'fumadocs-ui/components/callout';+import { Tab, Tabs } from 'fumadocs-ui/components/tabs';++`Spaces.watch_list` calls a `SpacesListListener` once at the start and again whenever the list changes: this computer's Spaces within a second, your other computers on the mesh within about a second of connecting or going away, the others within 10 seconds. Read the list again (`Spaces.list`) when it is called. It reopens by itself after a daemon restart; `SpacesListWatch.stop` ends it.++## List changes++Methods of [`Spaces`](/cua-sdk/reference/spaces#spaces).++### `Spaces.watch_list`++Tells `listener` when the Space list changed: once at the start, then+on every change. This computer's Spaces within a second; your other+computers on the mesh within about a second of connecting or going+away; the others within 10 seconds. Reopens by itself if the daemon+restarts (and then calls `listener` again). Stop it with+`SpacesListWatch.stop`.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+def watch_list(self, listener: SpacesListListener) -> SpacesListWatch+```++</Tab>+<Tab value="TypeScript">++```ts+watchList(listener: SpacesListListener): SpacesListWatchLike+```++</Tab>+<Tab value="Swift">++```swift+func watchList(listener: SpacesListListener) -> SpacesListWatch+```++</Tab>+<Tab value="Kotlin">++```kotlin+fun watchList(listener: SpacesListListener): SpacesListWatch+```++</Tab>+<Tab value="Rust">++```rust+pub fn watch_list(&self, listener: Arc<dyn SpacesListListener>) -> Arc<SpacesListWatch>+```++</Tab>+</Tabs>++| Parameter | Type | Default |+| --- | --- | --- |+| `listener` | [`SpacesListListener`](#spaceslistlistener) | required |++**Returns** [`SpacesListWatch`](#spaceslistwatch)++## `SpacesListListener`++Hears that the Space list changed (`Spaces.watch_list`). Called on an+SDK worker thread; return quickly (read the list on your own queue).++<Callout>+You implement `SpacesListListener` and pass it to the SDK (a callback interface): subclass it in Python, implement the interface in TypeScript, the `SpacesListListener` protocol in Swift, the interface in Kotlin and the trait in Rust.+</Callout>++| Method | Description |+| --- | --- |+| [`on_changed`](#spaceslistlisteneron_changed) | The list changed (and once at the start): read it again. |++### `SpacesListListener.on_changed`++The list changed (and once at the start): read it again.+`generation` only increases while one daemon runs.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+def on_changed(self, generation: int) -> None+```++</Tab>+<Tab value="TypeScript">++```ts+onChanged(generation: bigint): void+```++</Tab>+<Tab value="Swift">++```swift+func onChanged(generation: UInt64)+```++</Tab>+<Tab value="Kotlin">++```kotlin+fun onChanged(generation: ULong)+```++</Tab>+<Tab value="Rust">++```rust+pub fn on_changed(&self, generation: u64)+```++</Tab>+</Tabs>++| Parameter | Type | Default |+| --- | --- | --- |+| `generation` | `u64` | required |++## `SpacesListWatch`++A running `Spaces.watch_list`. Dropping it also stops it.++Returned by [`Spaces.watch_list`](#spaceswatch_list).++| Accessor | Returns | Description |+| --- | --- | --- |+| `stop()` | | Ends the watch. No call is made after this returns. |diff --git a/docs/content/docs/cua-sdk/reference/spaces/meta.json b/docs/content/docs/cua-sdk/reference/spaces/meta.jsonindex c2689882ec..32e82980e7 100644--- a/docs/content/docs/cua-sdk/reference/spaces/meta.json+++ b/docs/content/docs/cua-sdk/reference/spaces/meta.json@@ -9,6 +9,7 @@"volume","streams","resources",+ "list-watch","agents","persistent-agents","host"diff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdxindex e1b421f6a9..17fdfa7cd3 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-308 items. Methods are listed on their object.+310 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).@@ -319,6 +319,8 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref| [`SpacesHost`](/cua-sdk/reference/spaces/host#spaceshost-record) | record | One of your machines that provides Spaces (`Spaces.hosts`). || [`SpacesHostLimit`](/cua-sdk/reference/spaces/host#spaceshostlimit-record) | record | One limit of a host that provides Spaces and how much of it is used. || [`SpacesHostLoad`](/cua-sdk/reference/spaces/host#spaceshostload-record) | record | How busy one of your machines is (its job runner's view). |+| [`SpacesListListener`](/cua-sdk/reference/spaces/list-watch#spaceslistlistener) | object | Hears that the Space list changed (`Spaces.watch_list`). |+| [`SpacesListWatch`](/cua-sdk/reference/spaces/list-watch#spaceslistwatch) | object | A running `Spaces.watch_list`. || [`SpacesToolMethod`](/cua-sdk/reference/spaces#spacestoolmethod-record) | record | One row of `SPACES_TOOL_METHODS`. || [`SpaceStreamOptions`](/cua-sdk/reference/spaces/streams#spacestreamoptions-record) | record | What to stream and how. || [`SpaceStreamSession`](/cua-sdk/reference/spaces/streams#spacestreamsession) | object | A live Space media session (see `Space.stream_session`). |diff --git a/libs/cua/crates/cua-daemon/src/spaces_svc.rs b/libs/cua/crates/cua-daemon/src/spaces_svc.rsindex fc95a9f849..8169654f7b 100644--- a/libs/cua/crates/cua-daemon/src/spaces_svc.rs+++ b/libs/cua/crates/cua-daemon/src/spaces_svc.rs@@ -1026,6 +1026,44 @@ mod imp {});ok(Box::pin(tokio_stream::wrappers::ReceiverStream::new(rx)))}++ type WatchSpacesStream = std::pin::Pin<+ Box<+ dyn tokio_stream::Stream<+ Item = std::result::Result<pb::WatchSpacesResponse, tonic::Status>,+ > + Send,+ >,+ >;++ async fn watch_spaces(+ &self,+ _: tonic::Request<pb::WatchSpacesRequest>,+ ) -> R<Self::WatchSpacesStream> {+ let mut watch = self.spaces().watch_list();+ let (tx, rx) = tokio::sync::mpsc::channel(4);+ // The subscription is the interest: it ends with the stream, so+ // the watcher stops when the last reader is gone.+ tokio::spawn(async move {+ let mut generation = watch.generation();+ loop {+ if tx+ .send(Ok(pb::WatchSpacesResponse { generation }))+ .await+ .is_err()+ {+ break;+ }+ tokio::select! {+ g = watch.changed() => match g {+ Some(g) => generation = g,+ None => break,+ },+ _ = tx.closed() => break,+ }+ }+ });+ ok(Box::pin(tokio_stream::wrappers::ReceiverStream::new(rx)))+ }}}@@ -1231,5 +1269,20 @@ mod imp {) -> R<Self::WatchResourcesStream> {off()}++ type WatchSpacesStream = std::pin::Pin<+ Box<+ dyn tokio_stream::Stream<+ Item = std::result::Result<pb::WatchSpacesResponse, tonic::Status>,+ > + Send,+ >,+ >;++ async fn watch_spaces(+ &self,+ _: tonic::Request<pb::WatchSpacesRequest>,+ ) -> R<Self::WatchSpacesStream> {+ off()+ }}}diff --git a/libs/cua/crates/cua-mesh/src/node.rs b/libs/cua/crates/cua-mesh/src/node.rsindex 7b2938b050..f100cc18ce 100644--- a/libs/cua/crates/cua-mesh/src/node.rs+++ b/libs/cua/crates/cua-mesh/src/node.rs@@ -436,6 +436,12 @@ impl Mesh {.find(|p| p.kind == NodeKind::Machine && p.machine_id.as_deref() == Some(machine_id))}+ /// Bumped on every network map (a peer joined, left, or went online or+ /// offline): a caller that shows peers' state reads it again.+ pub fn subscribe_peers(&self) -> tokio::sync::watch::Receiver<u64> {+ self.inner.engine.subscribe_peers()+ }+/// Waits up to `timeout` for machine `machine_id` to be in the map.pub async fn wait_machine(&self, machine_id: &str, timeout: Duration) -> Option<PeerInfo> {let mut rx = self.inner.engine.subscribe_peers();diff --git a/libs/cua/crates/cua-sdk/src/native/spaces.rs b/libs/cua/crates/cua-sdk/src/native/spaces.rsindex 37b203cfff..6deaf0b082 100644--- a/libs/cua/crates/cua-sdk/src/native/spaces.rs+++ b/libs/cua/crates/cua-sdk/src/native/spaces.rs@@ -138,6 +138,7 @@ pub const SPACES_SDK_ONLY_METHODS: &[&str] = &["Spaces.call_tool_json","Spaces.resources","Spaces.watch_resources",+ "Spaces.watch_list","Space.home","Space.screenshot","Space.close_stream",@@ -2450,6 +2451,9 @@ impl ToolOut {// private `Host` and `daemon_err`.include!("spaces_resources.rs");+// The list watch lives in `spaces_list_watch.rs`.+include!("spaces_list_watch.rs");+/// Where the Spaces runtime lives.#[derive(Clone)]enum Host {diff --git a/libs/cua/crates/cua-sdk/src/native/spaces_list_watch.rs b/libs/cua/crates/cua-sdk/src/native/spaces_list_watch.rsnew file mode 100644index 0000000000..abb5ccd594--- /dev/null+++ b/libs/cua/crates/cua-sdk/src/native/spaces_list_watch.rs@@ -0,0 +1,111 @@+// When the Space list changed (`Spaces.watch_list`), so an app reads it+// again when something happened instead of on a timer.++/// Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+/// SDK worker thread; return quickly (read the list on your own queue).+#[uniffi::export(with_foreign)]+pub trait SpacesListListener: Send + Sync {+ /// The list changed (and once at the start): read it again.+ /// `generation` only increases while one daemon runs.+ fn on_changed(&self, generation: u64);+}++/// A running [`Spaces::watch_list`]. Dropping it also stops it.+#[derive(uniffi::Object)]+pub struct SpacesListWatch {+ stop: tokio::sync::watch::Sender<bool>,+ task: std::sync::Mutex<Option<tokio::task::JoinHandle<()>>>,+}++#[uniffi::export]+impl SpacesListWatch {+ /// Ends the watch. No call is made after this returns.+ pub fn stop(&self) {+ let _ = self.stop.send(true);+ if let Some(t) = self.task.lock().expect("watch task").take() {+ t.abort();+ }+ }+}++impl Drop for SpacesListWatch {+ fn drop(&mut self) {+ self.stop();+ }+}++#[uniffi::export]+impl Spaces {+ /// Tells `listener` when the Space list changed: once at the start, then+ /// on every change. This computer's Spaces within a second; your other+ /// computers on the mesh within about a second of connecting or going+ /// away; the others within 10 seconds. Reopens by itself if the daemon+ /// restarts (and then calls `listener` again). Stop it with+ /// [`SpacesListWatch::stop`].+ pub fn watch_list(&self, listener: Arc<dyn SpacesListListener>) -> Arc<SpacesListWatch> {+ let (stop, rx) = tokio::sync::watch::channel(false);+ let host = self.host.clone();+ let task = super::runtime().spawn(async move {+ match host {+ Host::Embedded(s) => embedded_list_watch(s, rx, listener).await,+ Host::Daemon(d) => daemon_list_watch(d, rx, listener).await,+ }+ });+ Arc::new(SpacesListWatch {+ stop,+ task: std::sync::Mutex::new(Some(task)),+ })+ }+}++async fn embedded_list_watch(+ spaces: cua_spaces::Spaces,+ mut stop: tokio::sync::watch::Receiver<bool>,+ listener: Arc<dyn SpacesListListener>,+) {+ let mut watch = spaces.watch_list();+ listener.on_changed(watch.generation());+ loop {+ tokio::select! {+ g = watch.changed() => match g {+ Some(g) => listener.on_changed(g),+ None => return,+ },+ _ = stop.changed() => return,+ }+ }+}++async fn daemon_list_watch(+ daemon: cua_daemon::client::DaemonClient,+ mut stop: tokio::sync::watch::Receiver<bool>,+ listener: Arc<dyn SpacesListListener>,+) {+ loop {+ if *stop.borrow() {+ return;+ }+ let opened = daemon+ .spaces()+ .watch_spaces(dpb::WatchSpacesRequest {})+ .await;+ if let Ok(stream) = opened {+ let mut stream = stream.into_inner();+ loop {+ tokio::select! {+ msg = stream.message() => match msg {+ Ok(Some(m)) => listener.on_changed(m.generation),+ // The daemon ended the stream or went away.+ Ok(None) | Err(_) => break,+ },+ _ = stop.changed() => return,+ }+ }+ }+ // A daemon that is not up (or predates this): try again.+ tokio::select! {+ _ = tokio::time::sleep(REOPEN_AFTER) => {}+ _ = stop.changed() => return,+ }+ }+}diff --git a/libs/cua/crates/cua-spaces/src/lib.rs b/libs/cua/crates/cua-spaces/src/lib.rsindex 896399229e..3772eb4806 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 list_watch;pub mod listing;mod local_load;pub mod mesh;diff --git a/libs/cua/crates/cua-spaces/src/list_watch.rs b/libs/cua/crates/cua-spaces/src/list_watch.rsnew file mode 100644index 0000000000..fb1cd6bbae--- /dev/null+++ b/libs/cua/crates/cua-spaces/src/list_watch.rs@@ -0,0 +1,287 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 Cua AI, Inc.++//! Push for the Space list ([`Spaces::watch_list`]): a generation that moves+//! whenever what [`Spaces::list`] returns changes, so an app reads the list+//! again when something happened instead of on a timer.+//!+//! - This machine's Spaces (the registry, their power states) are compared+//! every [`LOCAL_TICK`]: a local read.+//! - The account's other computers: the mesh coordinator pushes a new+//! network map the moment one of them (or one of their Spaces) connects or+//! goes away. Each map is followed, after [`MESH_SETTLE`], by one read of+//! the relay directory (which has every computer's state), at most one per+//! [`MESH_SETTLE`]. Computers that are not on the mesh are read again every+//! [`REMOTE_FALLBACK`], the interval the apps polled at before.+//!+//! One watcher runs per [`Spaces`] however many subscribe, and stops with the+//! last subscriber.++use std::sync::{Arc, Mutex, Weak};+use std::time::{Duration, Instant};++use tokio::sync::watch;++use crate::Spaces;++/// How often this machine's Spaces are compared.+pub const LOCAL_TICK: Duration = Duration::from_secs(1);+/// After a network map, how long to wait for the next one before reading+/// the directory (a computer coming up moves several of its Spaces at once).+pub const MESH_SETTLE: Duration = Duration::from_millis(200);+/// How often the directory is read without a push.+pub const REMOTE_FALLBACK: Duration = Duration::from_secs(10);++/// One subscription to [`Spaces::watch_list`].+pub struct ListWatch {+ rx: watch::Receiver<u64>,+ _watcher: Arc<Watcher>,+}++impl ListWatch {+ /// The generation now.+ pub fn generation(&self) -> u64 {+ *self.rx.borrow()+ }++ /// Waits for the list to change; the new generation (`None` once the+ /// watcher is gone).+ pub async fn changed(&mut self) -> Option<u64> {+ self.rx.changed().await.ok()?;+ Some(*self.rx.borrow_and_update())+ }+}++pub(crate) struct Watcher {+ tx: watch::Sender<u64>,+ task: Mutex<Option<tokio::task::JoinHandle<()>>>,+}++impl Drop for Watcher {+ fn drop(&mut self) {+ if let Some(t) = self.task.lock().expect("watcher").take() {+ t.abort();+ }+ }+}++/// The running watcher of a [`Spaces`], while it has subscribers.+#[derive(Default)]+pub(crate) struct ListWatchSlot(Mutex<Weak<Watcher>>);++impl Spaces {+ /// Subscribes to changes of [`Spaces::list`]'s answer (see the module+ /// docs): this machine's Spaces within [`LOCAL_TICK`], the account's+ /// computers on the mesh within about [`MESH_SETTLE`] plus a directory+ /// read, the others within [`REMOTE_FALLBACK`].+ pub fn watch_list(&self) -> ListWatch {+ let mut slot = self.inner.list_watch.0.lock().expect("list watch");+ if let Some(w) = slot.upgrade() {+ return ListWatch {+ rx: w.tx.subscribe(),+ _watcher: w,+ };+ }+ let (tx, rx) = watch::channel(0u64);+ let w = Arc::new(Watcher {+ tx,+ task: Mutex::new(None),+ });+ let task = tokio::spawn(watch_loop(self.clone(), Arc::downgrade(&w)));+ *w.task.lock().expect("watcher") = Some(task);+ *slot = Arc::downgrade(&w);+ ListWatch { rx, _watcher: w }+ }+}++/// What the list says, to compare cheaply.+fn fingerprint(spaces: &Spaces) -> u64 {+ use std::hash::{Hash, Hasher};+ let mut h = std::collections::hash_map::DefaultHasher::new();+ match spaces.list() {+ Ok(rows) => format!("{rows:?}").hash(&mut h),+ Err(e) => e.to_string().hash(&mut h),+ }+ h.finish()+}++async fn watch_loop(spaces: Spaces, watcher: Weak<Watcher>) {+ let mut last = fingerprint(&spaces);+ let mut read_at = Instant::now();+ let mut pushed_at: Option<Instant> = None;+ loop {+ // The mesh nodes may come and go (the first relay Space starts+ // one): take their receivers afresh each round.+ let mut maps = spaces.inner.mesh.peer_changes().await;+ for m in &mut maps {+ m.borrow_and_update();+ }+ let pushed = async {+ if maps.is_empty() {+ return std::future::pending::<()>().await;+ }+ let changes = maps.iter_mut().map(|m| Box::pin(m.changed()));+ let _ = futures_util::future::select_all(changes).await;+ };+ let mut read_remote = false;+ tokio::select! {+ _ = tokio::time::sleep(LOCAL_TICK) => {}+ _ = pushed => {+ // Several maps in a row (a computer and its Spaces): one read.+ tokio::time::sleep(MESH_SETTLE).await;+ if pushed_at.is_none_or(|t| t.elapsed() >= MESH_SETTLE) {+ read_remote = true;+ pushed_at = Some(Instant::now());+ }+ }+ }+ if spaces.relay_account().is_some() && (read_remote || read_at.elapsed() >= REMOTE_FALLBACK)+ {+ read_at = Instant::now();+ if let Err(e) = spaces.relay_machines().await {+ tracing::debug!(error = %e, "list watch: directory not read");+ }+ }+ let now = fingerprint(&spaces);+ if now != last {+ last = now;+ let Some(w) = watcher.upgrade() else { return };+ w.tx.send_modify(|g| *g += 1);+ } else if watcher.strong_count() == 0 {+ return;+ }+ }+}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::relay::{RelayAccount, StaticToken};+ use cua_host::testing::FakeRelay;++ /// A change on another computer reaches a subscriber within this.+ const PUSH_BUDGET: Duration = Duration::from_secs(2);++ async fn changed_within(w: &mut ListWatch, within: Duration) -> Option<Duration> {+ let t = Instant::now();+ tokio::time::timeout(within, w.changed())+ .await+ .ok()+ .flatten()+ .map(|_| t.elapsed())+ }++ /// A Space added on this machine is announced within a tick.+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn a_local_change_is_pushed() {+ let home = tempfile::tempdir().unwrap();+ let spaces = Spaces::builder().home(home.path()).build();+ let mut w = spaces.watch_list();+ let env =+ cua_spacesd_client::testing::MockServer::start(cua_spacesd_client::testing::MockAuth {+ token: None,+ gateway: None,+ prefix: None,+ })+ .await;+ spaces+ .add(&env.url(), None, Some("new".into()))+ .await+ .unwrap();+ let took = changed_within(&mut w, LOCAL_TICK * 3)+ .await+ .expect("the new Space was announced");+ assert!(took <= LOCAL_TICK + Duration::from_millis(500), "{took:?}");+ // Nothing else moved: no further announcement.+ assert!(changed_within(&mut w, LOCAL_TICK * 2).await.is_none());+ }++ /// A computer that comes up (its node joins the mesh, the relay lists+ /// it online) is announced within the push budget, long before the+ /// fallback read.+ #[tokio::test(flavor = "multi_thread", worker_threads = 4)]+ async fn a_computer_coming_up_is_pushed_by_the_mesh() {+ let relay = FakeRelay::start().await;+ relay.add_account("tok", "ada", None);+ let client = cua_host::RelayClient::new(&relay.url).unwrap();+ client+ .register(+ "tok",+ &cua_host::relay::RegisterRequest {+ id: "aaaa000000000001".into(),+ name: "far".into(),+ allow: vec![],+ host: None,+ meta: Default::default(),+ },+ )+ .await+ .unwrap();+ relay.set_online("aaaa000000000001", false, "1.0.0");+ let home = tempfile::tempdir().unwrap();+ let spaces = Spaces::builder()+ .home(home.path())+ .relay(RelayAccount::new(+ &relay.url,+ Arc::new(StaticToken("tok".into())),+ ))+ .build();+ spaces.list_all().await.unwrap();+ // The account's mesh node, as the first relay Space starts it.+ let coord = cua_mesh::testing::FakeCoordinator::start(cua_mesh::Mode::Account).await;+ let dialer = cua_mesh::dialer::Dialer::start(+ &coord.url,+ cua_mesh::static_auth(vec![]),+ None,+ Duration::from_secs(10),+ )+ .await+ .unwrap();+ spaces.inner.mesh.insert_for_test(&relay.url, dialer).await;+ let mut w = spaces.watch_list();+ // Let the watcher take the node's map receiver and settle.+ tokio::time::sleep(LOCAL_TICK * 2).await;+ while changed_within(&mut w, Duration::from_millis(100))+ .await+ .is_some()+ {}++ // The computer comes up: the relay lists it online, and its node+ // joins the mesh (the coordinator pushes a new map).+ let t = Instant::now();+ relay.set_online("aaaa000000000001", true, "1.0.0");+ let mut cfg = cua_mesh::MeshConfig::new(+ coord.url.clone(),+ cua_mesh::NodeKind::Machine,+ None,+ cua_mesh::static_auth(vec![("x-cua-machine-id".into(), "aaaa000000000001".into())]),+ );+ cfg.media_udp_port = 0;+ let machine = cua_mesh::Mesh::start(cfg).await.unwrap();+ let _ = changed_within(&mut w, PUSH_BUDGET + Duration::from_secs(1))+ .await+ .expect("the computer coming up was announced");+ let took = t.elapsed();+ assert!(took <= PUSH_BUDGET, "announced after {took:?}");+ let row = spaces+ .list()+ .unwrap()+ .into_iter()+ .find(|i| i.id == "relay:aaaa000000000001")+ .unwrap();+ assert_ne!(row.power_state, "offline", "{row:?}");++ // ... and going away again.+ let t = Instant::now();+ relay.set_online("aaaa000000000001", false, "1.0.0");+ machine.shutdown();+ changed_within(&mut w, PUSH_BUDGET + Duration::from_secs(1))+ .await+ .expect("the computer going away was announced");+ assert!(+ t.elapsed() <= PUSH_BUDGET,+ "announced after {:?}",+ t.elapsed()+ );+ }+}diff --git a/libs/cua/crates/cua-spaces/src/mesh.rs b/libs/cua/crates/cua-spaces/src/mesh.rsindex 81bff621e3..47237bfc0e 100644--- a/libs/cua/crates/cua-spaces/src/mesh.rs+++ b/libs/cua/crates/cua-spaces/src/mesh.rs@@ -427,6 +427,19 @@ impl MeshClients {}}+ /// A receiver per running node, bumped on each of its network maps.+ pub(crate) async fn peer_changes(&self) -> Vec<tokio::sync::watch::Receiver<u64>> {+ self.nodes+ .lock()+ .await+ .values()+ .filter_map(|slot| match slot {+ Slot::Ready { dialer, .. } => Some(dialer.mesh().subscribe_peers()),+ _ => None,+ })+ .collect()+ }+/// The status of each node, for displays and measurements.pub(crate) async fn status(&self) -> Vec<(String, cua_mesh::Status)> {self.nodes@@ -443,6 +456,21 @@ impl MeshClients {}}+#[cfg(test)]+impl MeshClients {+ /// A running node for `url`'s account, as if a Space had started it.+ pub(crate) async fn insert_for_test(&self, url: &str, dialer: Dialer) {+ self.nodes.lock().await.insert(+ Key::Account(url.to_owned()),+ Slot::Ready {+ dialer: Arc::new(dialer),+ _lock: None,+ account: None,+ },+ );+ }+}+async fn relay_has_mesh(url: &str) -> Result<(), String> {let info = cua_host::RelayClient::new(url).map_err(|e| e.to_string())?diff --git a/libs/cua/crates/cua-spaces/src/spaces.rs b/libs/cua/crates/cua-spaces/src/spaces.rsindex c32ddca518..faf70e7b7d 100644--- a/libs/cua/crates/cua-spaces/src/spaces.rs+++ b/libs/cua/crates/cua-spaces/src/spaces.rs@@ -370,6 +370,7 @@ impl SpacesBuilder {relay_read: tokio::sync::Mutex::new(None),relay_confirmed: std::sync::atomic::AtomicBool::new(false),rounds: Default::default(),+ list_watch: Default::default(),site_login: std::sync::RwLock::new(None),pool: std::sync::RwLock::new(None),durable: std::sync::Mutex::new(Vec::new()),@@ -590,6 +591,9 @@ pub(crate) struct Inner {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 list's watcher, while anything subscribes+ /// ([`Spaces::watch_list`]).+ pub(crate) list_watch: crate::list_watch::ListWatchSlot,/// 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>>>,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 fce5e30102..a8a3fe2c86 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@@ -635,6 +635,9 @@ internal interface UniffiCallbackInterfaceResourcesListenerMethod0 : com.sun.jnainternal interface UniffiCallbackInterfaceSpaceCreateListenerMethod0 : com.sun.jna.Callback {fun callback(`uniffiHandle`: Long,`progress`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,)}+internal interface UniffiCallbackInterfaceSpacesListListenerMethod0 : com.sun.jna.Callback {+ fun callback(`uniffiHandle`: Long,`generation`: Long,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,)+}internal interface UniffiCallbackInterfaceTeleportApproverMethod0 : com.sun.jna.Callback {fun callback(`uniffiHandle`: Long,`manifest`: RustBuffer.ByValue,`uniffiOutReturn`: RustBuffer,uniffiCallStatus: UniffiRustCallStatus,)}@@ -719,6 +722,25 @@ internal open class UniffiVTableCallbackInterfaceSpaceCreateListener(`onProgress` = other.`onProgress`}+}[email protected]("uniffiFree", "uniffiClone", "onChanged")+internal open class UniffiVTableCallbackInterfaceSpacesListListener(+ @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,+ @JvmField internal var `uniffiClone`: UniffiCallbackInterfaceClone? = null,+ @JvmField internal var `onChanged`: UniffiCallbackInterfaceSpacesListListenerMethod0? = null,+) : Structure() {+ class UniffiByValue(+ `uniffiFree`: UniffiCallbackInterfaceFree? = null,+ `uniffiClone`: UniffiCallbackInterfaceClone? = null,+ `onChanged`: UniffiCallbackInterfaceSpacesListListenerMethod0? = null,+ ): UniffiVTableCallbackInterfaceSpacesListListener(`uniffiFree`,`uniffiClone`,`onChanged`,), Structure.ByValue++ internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceSpacesListListener) {+ `uniffiFree` = other.`uniffiFree`+ `uniffiClone` = other.`uniffiClone`+ `onChanged` = other.`onChanged`+ }+}@Structure.FieldOrder("uniffiFree", "uniffiClone", "approve")internal open class UniffiVTableCallbackInterfaceTeleportApprover(@@ -1587,6 +1609,8 @@ external fun uniffi_cua_sdk_checksum_method_spaces_volume_write(): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_volumes(): Short+external fun uniffi_cua_sdk_checksum_method_spaces_watch_list(+): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_watch_resources(): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_build(@@ -1597,6 +1621,10 @@ external fun uniffi_cua_sdk_checksum_method_spaces_builds(): Shortexternal fun uniffi_cua_sdk_checksum_method_spaces_delete_build(): Short+external fun uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed(+): Short+external fun uniffi_cua_sdk_checksum_method_spaceslistwatch_stop(+): Shortexternal fun uniffi_cua_sdk_checksum_method_teleportapprover_approve(): Shortexternal fun uniffi_cua_sdk_checksum_method_buildlistener_on_progress(@@ -1760,6 +1788,7 @@ internal object UniffiLib {uniffiCallbackInterfaceFrameSink.register(this)uniffiCallbackInterfaceResourcesListener.register(this)uniffiCallbackInterfaceSpaceCreateListener.register(this)+ uniffiCallbackInterfaceSpacesListListener.register(this)uniffiCallbackInterfaceTeleportApprover.register(this)}@@ -2601,6 +2630,8 @@ external fun uniffi_cua_sdk_fn_method_spaces_volume_write(`ptr`: Long,`path`: Ru): Longexternal fun uniffi_cua_sdk_fn_method_spaces_volumes(`ptr`: Long,): Long+external fun uniffi_cua_sdk_fn_method_spaces_watch_list(`ptr`: Long,`listener`: Long,uniffi_out_err: UniffiRustCallStatus,+): Longexternal fun uniffi_cua_sdk_fn_method_spaces_watch_resources(`ptr`: Long,`visible`: Byte,`listener`: Long,uniffi_out_err: UniffiRustCallStatus,): Longexternal fun uniffi_cua_sdk_fn_method_spaces_build(`ptr`: Long,`options`: RustBuffer.ByValue,@@ -2611,6 +2642,20 @@ external fun uniffi_cua_sdk_fn_method_spaces_builds(`ptr`: Long,): Longexternal fun uniffi_cua_sdk_fn_method_spaces_delete_build(`ptr`: Long,`build`: RustBuffer.ByValue,): Long+external fun uniffi_cua_sdk_fn_clone_spaceslistlistener(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,+): Long+external fun uniffi_cua_sdk_fn_free_spaceslistlistener(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,+): Unit+external fun uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(`vtable`: UniffiVTableCallbackInterfaceSpacesListListener,+): Unit+external fun uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(`ptr`: Long,`generation`: Long,uniffi_out_err: UniffiRustCallStatus,+): Unit+external fun uniffi_cua_sdk_fn_clone_spaceslistwatch(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,+): Long+external fun uniffi_cua_sdk_fn_free_spaceslistwatch(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,+): Unit+external fun uniffi_cua_sdk_fn_method_spaceslistwatch_stop(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,+): Unitexternal fun uniffi_cua_sdk_fn_clone_teleportapprover(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,): Longexternal fun uniffi_cua_sdk_fn_free_teleportapprover(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,@@ -4201,6 +4246,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_method_spaces_volumes() != 15143.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_method_spaces_watch_list() != 1499.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_method_spaces_watch_resources() != 49660.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -4216,6 +4264,12 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_method_spaces_delete_build() != 6500.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed() != 40063.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }+ if (lib.uniffi_cua_sdk_checksum_method_spaceslistwatch_stop() != 38223.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_method_teleportapprover_approve() != 36264.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -20638,6 +20692,16 @@ public interface SpacesInterface {*/suspend fun `volumes`(): List<NamedVolume>+ /**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+ fun `watchList`(`listener`: SpacesListListener): SpacesListWatch+/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -22932,6 +22996,27 @@ open class Spaces: Disposable, AutoCloseable, SpacesInterface}+ /**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */override fun `watchList`(`listener`: SpacesListListener): SpacesListWatch {+ return FfiConverterTypeSpacesListWatch.lift(+ callWithHandle {+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_list(+ it,+ FfiConverterTypeSpacesListListener.lower(`listener`),_status)+}+ }+ )+ }+++/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -23194,6 +23279,588 @@ public object FfiConverterTypeSpaces: FfiConverter<Spaces, Long> {//+/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+public interface SpacesListListener {++ /**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+ fun `onChanged`(`generation`: kotlin.ULong)++ companion object+}++/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+open class SpacesListListenerImpl: Disposable, AutoCloseable, SpacesListListener+{++ @Suppress("UNUSED_PARAMETER")+ /**+ * @suppress+ */+ constructor(withHandle: UniffiWithHandle, handle: Long) {+ this.handle = handle+ this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(handle))+ }++ /**+ * @suppress+ *+ * This constructor can be used to instantiate a fake object. Only used for tests. Any+ * attempt to actually use an object constructed this way will fail as there is no+ * connected Rust object.+ */+ @Suppress("UNUSED_PARAMETER")+ constructor(noHandle: NoHandle) {+ this.handle = 0+ this.cleanable = null+ }++ protected val handle: Long+ protected val cleanable: UniffiCleaner.Cleanable?++ private val wasDestroyed = AtomicBoolean(false)+ private val callCounter = AtomicLong(1)++ override fun destroy() {+ // Only allow a single call to this method.+ // TODO: maybe we should log a warning if called more than once?+ if (this.wasDestroyed.compareAndSet(false, true)) {+ // This decrement always matches the initial count of 1 given at creation time.+ if (this.callCounter.decrementAndGet() == 0L) {+ cleanable?.clean()+ }+ }+ }++ @Synchronized+ override fun close() {+ this.destroy()+ }++ internal inline fun <R> callWithHandle(block: (handle: Long) -> R): R {+ // Check and increment the call counter, to keep the object alive.+ // This needs a compare-and-set retry loop in case of concurrent updates.+ do {+ val c = this.callCounter.get()+ if (c == 0L) {+ throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed")+ }+ if (c == Long.MAX_VALUE) {+ throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow")+ }+ } while (! this.callCounter.compareAndSet(c, c + 1L))+ // Now we can safely do the method call without the handle being freed concurrently.+ try {+ return block(this.uniffiCloneHandle())+ } finally {+ // This decrement always matches the increment we performed above.+ if (this.callCounter.decrementAndGet() == 0L) {+ cleanable?.clean()+ }+ }+ }++ // Use a static inner class instead of a closure so as not to accidentally+ // capture `this` as part of the cleanable's action.+ private class UniffiCleanAction(private val handle: Long) : Runnable {+ override fun run() {+ if (handle == 0.toLong()) {+ // Fake object created with `NoHandle`, don't try to free.+ return;+ }+ uniffiRustCall { status ->+ UniffiLib.uniffi_cua_sdk_fn_free_spaceslistlistener(handle, status)+ }+ }+ }++ /**+ * @suppress+ */+ fun uniffiCloneHandle(): Long {+ if (handle == 0.toLong()) {+ throw InternalException("uniffiCloneHandle() called on NoHandle object");+ }+ return uniffiRustCall() { status ->+ UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistlistener(handle, status)+ }+ }+++ /**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */override fun `onChanged`(`generation`: kotlin.ULong)+ =+ callWithHandle {+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(+ it,+ FfiConverterULong.lower(`generation`),_status)+}+ }+++++++++++ /**+ * @suppress+ */+ companion object++}++++// Put the implementation in an object so we don't pollute the top-level namespace+internal object uniffiCallbackInterfaceSpacesListListener {+ internal object `onChanged`: UniffiCallbackInterfaceSpacesListListenerMethod0 {+ override fun callback(`uniffiHandle`: Long,`generation`: Long,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) {+ val uniffiObj = FfiConverterTypeSpacesListListener.handleMap.get(uniffiHandle)+ val makeCall = { ->+ uniffiObj.`onChanged`(+ FfiConverterULong.lift(`generation`),+ )+ }+ val writeReturn = { _: Unit -> Unit }+ uniffiTraitInterfaceCall(uniffiCallStatus, makeCall, writeReturn)+ }+ }++ internal object uniffiFree: UniffiCallbackInterfaceFree {+ override fun callback(handle: Long) {+ FfiConverterTypeSpacesListListener.handleMap.remove(handle)+ }+ }++ internal object uniffiClone: UniffiCallbackInterfaceClone {+ override fun callback(handle: Long): Long {+ return FfiConverterTypeSpacesListListener.handleMap.clone(handle)+ }+ }++ internal var vtable = UniffiVTableCallbackInterfaceSpacesListListener.UniffiByValue(+ uniffiFree,+ uniffiClone,+ `onChanged`,+ )++ // Registers the foreign callback with the Rust side.+ // This method is generated for each callback interface.+ internal fun register(lib: UniffiLib) {+ lib.uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(vtable)+ }+}++/**+ * @suppress+ */+public object FfiConverterTypeSpacesListListener: FfiConverter<SpacesListListener, Long> {+ internal val handleMap = UniffiHandleMap<SpacesListListener>()++ override fun lower(value: SpacesListListener): Long {+ if (value is SpacesListListenerImpl) {+ // Rust-implemented object. Clone the handle and return it+ return value.uniffiCloneHandle()+ } else {+ // Kotlin object, generate a new vtable handle and return that.+ return handleMap.insert(value)+ }+ }++ override fun lift(value: Long): SpacesListListener {+ if ((value and 1.toLong()) == 0.toLong()) {+ // Rust-generated handle, construct a new class that uses the handle to implement the+ // interface+ return SpacesListListenerImpl(UniffiWithHandle, value)+ } else {+ // Kotlin-generated handle, get the object from the handle map+ return handleMap.remove(value)+ }+ }++ override fun read(buf: ByteBuffer): SpacesListListener {+ return lift(buf.getLong())+ }++ override fun allocationSize(value: SpacesListListener) = 8UL++ override fun write(value: SpacesListListener, buf: ByteBuffer) {+ buf.putLong(lower(value))+ }+}+++// This template implements a class for working with a Rust struct via a handle+// to the live Rust struct on the other side of the FFI.+//+// There's some subtlety here, because we have to be careful not to operate on a Rust+// struct after it has been dropped, and because we must expose a public API for freeing+// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are:+//+// * Each instance holds an opaque handle to the underlying Rust struct.+// Method calls need to read this handle from the object's state and pass it in to+// the Rust FFI.+//+// * When an instance is no longer needed, its handle should be passed to a+// special destructor function provided by the Rust FFI, which will drop the+// underlying Rust struct.+//+// * Given an instance, calling code is expected to call the special+// `destroy` method in order to free it after use, either by calling it explicitly+// or by using a higher-level helper like the `use` method. Failing to do so risks+// leaking the underlying Rust struct.+//+// * We can't assume that calling code will do the right thing, and must be prepared+// to handle Kotlin method calls executing concurrently with or even after a call to+// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`.+//+// * We must never allow Rust code to operate on the underlying Rust struct after+// the destructor has been called, and must never call the destructor more than once.+// Doing so may trigger memory unsafety.+//+// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner`+// is implemented to call the destructor when the Kotlin object becomes unreachable.+// This is done in a background thread. This is not a panacea, and client code should be aware that+// 1. the thread may starve if some there are objects that have poorly performing+// `drop` methods or do significant work in their `drop` methods.+// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`,+// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html).+//+// If we try to implement this with mutual exclusion on access to the handle, there is the+// possibility of a race between a method call and a concurrent call to `destroy`:+//+// * Thread A starts a method call, reads the value of the handle, but is interrupted+// before it can pass the handle over the FFI to Rust.+// * Thread B calls `destroy` and frees the underlying Rust struct.+// * Thread A resumes, passing the already-read handle value to Rust and triggering+// a use-after-free.+//+// One possible solution would be to use a `ReadWriteLock`, with each method call taking+// a read lock (and thus allowed to run concurrently) and the special `destroy` method+// taking a write lock (and thus blocking on live method calls). However, we aim not to+// generate methods with any hidden blocking semantics, and a `destroy` method that might+// block if called incorrectly seems to meet that bar.+//+// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track+// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy`+// has been called. These are updated according to the following rules:+//+// * The initial value of the counter is 1, indicating a live object with no in-flight calls.+// The initial value for the flag is false.+//+// * At the start of each method call, we atomically check the counter.+// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted.+// If it is nonzero them we atomically increment it by 1 and proceed with the method call.+//+// * At the end of each method call, we atomically decrement and check the counter.+// If it has reached zero then we destroy the underlying Rust struct.+//+// * When `destroy` is called, we atomically flip the flag from false to true.+// If the flag was already true we silently fail.+// Otherwise we atomically decrement and check the counter.+// If it has reached zero then we destroy the underlying Rust struct.+//+// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc<T>` works,+// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`.+//+// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been+// called *and* all in-flight method calls have completed, avoiding violating any of the expectations+// of the underlying Rust code.+//+// This makes a cleaner a better alternative to _not_ calling `destroy()` as+// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop`+// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner+// thread may be starved, and the app will leak memory.+//+// In this case, `destroy`ing manually may be a better solution.+//+// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects+// with Rust peers are reclaimed:+//+// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen:+// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then:+// 3. The memory is reclaimed when the process terminates.+//+// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219+//+++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+public interface SpacesListWatchInterface {++ /**+ * Ends the watch. No call is made after this returns.+ */+ fun `stop`()++ companion object+}++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+open class SpacesListWatch: Disposable, AutoCloseable, SpacesListWatchInterface+{++ @Suppress("UNUSED_PARAMETER")+ /**+ * @suppress+ */+ constructor(withHandle: UniffiWithHandle, handle: Long) {+ this.handle = handle+ this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(handle))+ }++ /**+ * @suppress+ *+ * This constructor can be used to instantiate a fake object. Only used for tests. Any+ * attempt to actually use an object constructed this way will fail as there is no+ * connected Rust object.+ */+ @Suppress("UNUSED_PARAMETER")+ constructor(noHandle: NoHandle) {+ this.handle = 0+ this.cleanable = null+ }++ protected val handle: Long+ protected val cleanable: UniffiCleaner.Cleanable?++ private val wasDestroyed = AtomicBoolean(false)+ private val callCounter = AtomicLong(1)++ override fun destroy() {+ // Only allow a single call to this method.+ // TODO: maybe we should log a warning if called more than once?+ if (this.wasDestroyed.compareAndSet(false, true)) {+ // This decrement always matches the initial count of 1 given at creation time.+ if (this.callCounter.decrementAndGet() == 0L) {+ cleanable?.clean()+ }+ }+ }++ @Synchronized+ override fun close() {+ this.destroy()+ }++ internal inline fun <R> callWithHandle(block: (handle: Long) -> R): R {+ // Check and increment the call counter, to keep the object alive.+ // This needs a compare-and-set retry loop in case of concurrent updates.+ do {+ val c = this.callCounter.get()+ if (c == 0L) {+ throw IllegalStateException("${this.javaClass.simpleName} object has already been destroyed")+ }+ if (c == Long.MAX_VALUE) {+ throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow")+ }+ } while (! this.callCounter.compareAndSet(c, c + 1L))+ // Now we can safely do the method call without the handle being freed concurrently.+ try {+ return block(this.uniffiCloneHandle())+ } finally {+ // This decrement always matches the increment we performed above.+ if (this.callCounter.decrementAndGet() == 0L) {+ cleanable?.clean()+ }+ }+ }++ // Use a static inner class instead of a closure so as not to accidentally+ // capture `this` as part of the cleanable's action.+ private class UniffiCleanAction(private val handle: Long) : Runnable {+ override fun run() {+ if (handle == 0.toLong()) {+ // Fake object created with `NoHandle`, don't try to free.+ return;+ }+ uniffiRustCall { status ->+ UniffiLib.uniffi_cua_sdk_fn_free_spaceslistwatch(handle, status)+ }+ }+ }++ /**+ * @suppress+ */+ fun uniffiCloneHandle(): Long {+ if (handle == 0.toLong()) {+ throw InternalException("uniffiCloneHandle() called on NoHandle object");+ }+ return uniffiRustCall() { status ->+ UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistwatch(handle, status)+ }+ }+++ /**+ * Ends the watch. No call is made after this returns.+ */override fun `stop`()+ =+ callWithHandle {+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_method_spaceslistwatch_stop(+ it,+ _status)+}+ }+++++++++++ /**+ * @suppress+ */+ companion object++}+++/**+ * @suppress+ */+public object FfiConverterTypeSpacesListWatch: FfiConverter<SpacesListWatch, Long> {+ override fun lower(value: SpacesListWatch): Long {+ return value.uniffiCloneHandle()+ }++ override fun lift(value: Long): SpacesListWatch {+ return SpacesListWatch(UniffiWithHandle, value)+ }++ override fun read(buf: ByteBuffer): SpacesListWatch {+ return lift(buf.getLong())+ }++ override fun allocationSize(value: SpacesListWatch) = 8UL++ override fun write(value: SpacesListWatch, buf: ByteBuffer) {+ buf.putLong(lower(value))+ }+}+++// This template implements a class for working with a Rust struct via a handle+// to the live Rust struct on the other side of the FFI.+//+// There's some subtlety here, because we have to be careful not to operate on a Rust+// struct after it has been dropped, and because we must expose a public API for freeing+// theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are:+//+// * Each instance holds an opaque handle to the underlying Rust struct.+// Method calls need to read this handle from the object's state and pass it in to+// the Rust FFI.+//+// * When an instance is no longer needed, its handle should be passed to a+// special destructor function provided by the Rust FFI, which will drop the+// underlying Rust struct.+//+// * Given an instance, calling code is expected to call the special+// `destroy` method in order to free it after use, either by calling it explicitly+// or by using a higher-level helper like the `use` method. Failing to do so risks+// leaking the underlying Rust struct.+//+// * We can't assume that calling code will do the right thing, and must be prepared+// to handle Kotlin method calls executing concurrently with or even after a call to+// `destroy`, and to handle multiple (possibly concurrent!) calls to `destroy`.+//+// * We must never allow Rust code to operate on the underlying Rust struct after+// the destructor has been called, and must never call the destructor more than once.+// Doing so may trigger memory unsafety.+//+// * To mitigate many of the risks of leaking memory and use-after-free unsafety, a `Cleaner`+// is implemented to call the destructor when the Kotlin object becomes unreachable.+// This is done in a background thread. This is not a panacea, and client code should be aware that+// 1. the thread may starve if some there are objects that have poorly performing+// `drop` methods or do significant work in their `drop` methods.+// 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`,+// or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html).+//+// If we try to implement this with mutual exclusion on access to the handle, there is the+// possibility of a race between a method call and a concurrent call to `destroy`:+//+// * Thread A starts a method call, reads the value of the handle, but is interrupted+// before it can pass the handle over the FFI to Rust.+// * Thread B calls `destroy` and frees the underlying Rust struct.+// * Thread A resumes, passing the already-read handle value to Rust and triggering+// a use-after-free.+//+// One possible solution would be to use a `ReadWriteLock`, with each method call taking+// a read lock (and thus allowed to run concurrently) and the special `destroy` method+// taking a write lock (and thus blocking on live method calls). However, we aim not to+// generate methods with any hidden blocking semantics, and a `destroy` method that might+// block if called incorrectly seems to meet that bar.+//+// So, we achieve our goals by giving each instance an associated `AtomicLong` counter to track+// the number of in-flight method calls, and an `AtomicBoolean` flag to indicate whether `destroy`+// has been called. These are updated according to the following rules:+//+// * The initial value of the counter is 1, indicating a live object with no in-flight calls.+// The initial value for the flag is false.+//+// * At the start of each method call, we atomically check the counter.+// If it is 0 then the underlying Rust struct has already been destroyed and the call is aborted.+// If it is nonzero them we atomically increment it by 1 and proceed with the method call.+//+// * At the end of each method call, we atomically decrement and check the counter.+// If it has reached zero then we destroy the underlying Rust struct.+//+// * When `destroy` is called, we atomically flip the flag from false to true.+// If the flag was already true we silently fail.+// Otherwise we atomically decrement and check the counter.+// If it has reached zero then we destroy the underlying Rust struct.+//+// Astute readers may observe that this all sounds very similar to the way that Rust's `Arc<T>` works,+// and indeed it is, with the addition of a flag to guard against multiple calls to `destroy`.+//+// The overall effect is that the underlying Rust struct is destroyed only when `destroy` has been+// called *and* all in-flight method calls have completed, avoiding violating any of the expectations+// of the underlying Rust code.+//+// This makes a cleaner a better alternative to _not_ calling `destroy()` as+// and when the object is finished with, but the abstraction is not perfect: if the Rust object's `drop`+// method is slow, and/or there are many objects to cleanup, and it's on a low end Android device, then the cleaner+// thread may be starved, and the app will leak memory.+//+// In this case, `destroy`ing manually may be a better solution.+//+// The cleaner can live side by side with the manual calling of `destroy`. In the order of responsiveness, uniffi objects+// with Rust peers are reclaimed:+//+// 1. By calling the `destroy` method of the object, which calls `rustObject.free()`. If that doesn't happen:+// 2. When the object becomes unreachable, AND the Cleaner thread gets to call `rustObject.free()`. If the thread is starved then:+// 3. The memory is reclaimed when the process terminates.+//+// [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219+//++/*** Client for one cua-spacesd.*/diff --git a/libs/cua/proto/cua/daemon/v1/spaces.proto b/libs/cua/proto/cua/daemon/v1/spaces.protoindex 6185cbab17..de242c9b79 100644--- a/libs/cua/proto/cua/daemon/v1/spaces.proto+++ b/libs/cua/proto/cua/daemon/v1/spaces.proto@@ -138,6 +138,24 @@ service SpaceService {// Cancel the stream to stop; call again with the other `visible` to// switch.rpc WatchResources(WatchResourcesRequest) returns (stream WatchResourcesResponse);+ // Says when the Space list changed, so a client reads it again+ // (`ListSpaces`) when something happened instead of on a timer: one+ // message at once (the generation now), then one per change. This+ // computer's Spaces are announced within a second; your other computers+ // on the mesh within about a second of connecting or going away (the mesh+ // coordinator pushes it); computers not on the mesh within 10 seconds.+ // Cancel the stream to stop.+ rpc WatchSpaces(WatchSpacesRequest) returns (stream WatchSpacesResponse);+}++// `SpaceService.WatchSpaces` takes no arguments.+message WatchSpacesRequest {}++// One event of `SpaceService.WatchSpaces`.+message WatchSpacesResponse {+ // Moves on every change of the list (only increases while the daemon+ // runs; a new daemon starts again from 0).+ uint64 generation = 1;}// A registered Space.diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.pyindex 6c1d3d8941..68143cbd10 100644--- a/libs/cua/python/src/cua/_native.py+++ b/libs/cua/python/src/cua/_native.py@@ -1309,8 +1309,14 @@ 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_volumes() != 15143:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_method_spaces_watch_list() != 1499:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_spaces_watch_resources() != 49660:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed() != 40063:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_method_spaceslistwatch_stop() != 38223:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_spacesdclient_agents() != 39176:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_spacesdclient_attach() != 5563:@@ -2000,6 +2006,26 @@ _UniffiLib.uniffi_cua_sdk_fn_free_spaces.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)_UniffiLib.uniffi_cua_sdk_fn_free_spaces.restype = None+_UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistlistener.argtypes = (+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistlistener.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_free_spaceslistlistener.argtypes = (+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_free_spaceslistlistener.restype = None+_UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistwatch.argtypes = (+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistwatch.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_free_spaceslistwatch.argtypes = (+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_free_spaceslistwatch.restype = None_UniffiLib.uniffi_cua_sdk_fn_clone_spacesdclient.argtypes = (ctypes.c_uint64,ctypes.POINTER(_UniffiRustCallStatus),@@ -2139,6 +2165,23 @@ _UniffiLib.uniffi_cua_sdk_fn_init_callback_vtable_spacecreatelistener.argtypes =ctypes.POINTER(_UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener),)_UniffiLib.uniffi_cua_sdk_fn_init_callback_vtable_spacecreatelistener.restype = None+_UNIFFI_CALLBACK_INTERFACE_CUA_SDK_SPACES_LIST_LISTENER_METHOD0 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_uint64,ctypes.c_void_p,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UNIFFI_CALLBACK_INTERFACE_CLONE_CUA_SDK_SPACES_LIST_LISTENER = ctypes.CFUNCTYPE(ctypes.c_uint64,ctypes.c_uint64,+)+_UNIFFI_CALLBACK_INTERFACE_FREE_CUA_SDK_SPACES_LIST_LISTENER = ctypes.CFUNCTYPE(None,ctypes.c_uint64,+)+class _UniffiVTableCallbackInterfaceCuaSdkSpacesListListener(ctypes.Structure):+ _fields_ = [+ ("uniffi_free", _UNIFFI_CALLBACK_INTERFACE_FREE_CUA_SDK_SPACES_LIST_LISTENER),+ ("uniffi_clone", _UNIFFI_CALLBACK_INTERFACE_CLONE_CUA_SDK_SPACES_LIST_LISTENER),+ ("on_changed", _UNIFFI_CALLBACK_INTERFACE_CUA_SDK_SPACES_LIST_LISTENER_METHOD0),+ ]+_UniffiLib.uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener.argtypes = (+ ctypes.POINTER(_UniffiVTableCallbackInterfaceCuaSdkSpacesListListener),+)+_UniffiLib.uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener.restype = None_UNIFFI_CALLBACK_INTERFACE_CUA_SDK_TELEPORT_APPROVER_METHOD0 = ctypes.CFUNCTYPE(None,ctypes.c_uint64,_UniffiRustBuffer,ctypes.POINTER(_UniffiRustBuffer),ctypes.POINTER(_UniffiRustCallStatus),)@@ -4326,6 +4369,12 @@ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_volumes.argtypes = (ctypes.c_uint64,)_UniffiLib.uniffi_cua_sdk_fn_method_spaces_volumes.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_list.argtypes = (+ ctypes.c_uint64,+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_list.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_resources.argtypes = (ctypes.c_uint64,ctypes.c_int8,@@ -4333,6 +4382,17 @@ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_resources.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)_UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_resources.restype = ctypes.c_uint64+_UniffiLib.uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed.argtypes = (+ ctypes.c_uint64,+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed.restype = None+_UniffiLib.uniffi_cua_sdk_fn_method_spaceslistwatch_stop.argtypes = (+ ctypes.c_uint64,+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_method_spaceslistwatch_stop.restype = None_UniffiLib.uniffi_cua_sdk_fn_method_spacesdclient_agents.argtypes = (ctypes.c_uint64,)@@ -5928,9 +5988,18 @@ _UniffiLib.uniffi_cua_sdk_checksum_method_spaces_volume_write.restype = ctypes.c_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_volumes.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_volumes.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_watch_list.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_watch_list.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_watch_resources.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_spaces_watch_resources.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_method_spaceslistwatch_stop.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_method_spaceslistwatch_stop.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_method_spacesdclient_agents.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_method_spacesdclient_agents.restype = ctypes.c_uint16@@ -39621,6 +39690,248 @@ class _UniffiFfiConverterSequenceTypeNamedVolume(_UniffiConverterRustBuffer):]+class SpacesListListener():+ """+ Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ SDK worker thread; return quickly (read the list on your own queue).+"""++ def on_changed(self, generation: int) -> None:+ """+ The list changed (and once at the start): read it again.+ `generation` only increases while one daemon runs.+"""+ raise NotImplementedError++class SpacesListListenerImpl(SpacesListListener):+ """+ Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ SDK worker thread; return quickly (read the list on your own queue).+"""++ _handle: ctypes.c_uint64++ def __init__(self, *args, **kwargs):+ raise ValueError("This class has no default constructor")++ def __del__(+ self,+ _uniffi_free=_UniffiLib.uniffi_cua_sdk_fn_free_spaceslistlistener,+ _uniffi_call=_uniffi_rust_call,+ _uniffi_finalizing=sys.is_finalizing,+ ):+ # In case of partial initialization of instances.+ handle = getattr(self, "_handle", None)+ # At interpreter exit the module globals are gone: skip the free (cua+ # post-process, libs/cua/scripts/uniffi-python-postprocess.mjs).+ if handle is not None and not _uniffi_finalizing():+ _uniffi_call(_uniffi_free, handle)++ def _uniffi_clone_handle(self):+ return _uniffi_rust_call(_UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistlistener, self._handle)++ # Used by alternative constructors or any methods which return this type.+ @classmethod+ def _uniffi_make_instance(cls, handle):+ # Lightly yucky way to bypass the usual __init__ logic+ # and just create a new instance with the required handle.+ inst = cls.__new__(cls)+ inst._handle = handle+ return inst+ def on_changed(self, generation: int) -> None:+ """+ The list changed (and once at the start): read it again.+ `generation` only increases while one daemon runs.+"""++ _UniffiFfiConverterUInt64.check_lower(generation)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ _UniffiFfiConverterUInt64.lower(generation),+ )+ _uniffi_lift_return = lambda val: None+ _uniffi_error_converter = None+ _uniffi_ffi_result = _uniffi_rust_call_with_error(+ _uniffi_error_converter,+ _UniffiLib.uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)+++++# Put all the bits inside a class to keep the top-level namespace clean+class _UniffiTraitImplSpacesListListenerImpl:+ # For each method, generate a callback function to pass to Rust++ @_UNIFFI_CALLBACK_INTERFACE_CUA_SDK_SPACES_LIST_LISTENER_METHOD0+ def on_changed(+ uniffi_handle,+ generation,+ uniffi_out_return,+ uniffi_call_status_ptr,+ ):+ uniffi_obj = _UniffiFfiConverterTypeSpacesListListener._handle_map.get(uniffi_handle)+ def make_call():+ uniffi_args = (_UniffiFfiConverterUInt64.lift(generation), )+ uniffi_method = uniffi_obj.on_changed+ return uniffi_method(*uniffi_args)+ write_return_value = lambda v: None+ _uniffi_trait_interface_call(+ uniffi_call_status_ptr.contents,+ make_call,+ write_return_value,+ )++ @_UNIFFI_CALLBACK_INTERFACE_FREE_CUA_SDK_SPACES_LIST_LISTENER+ def _uniffi_free(uniffi_handle):+ _UniffiFfiConverterTypeSpacesListListener._handle_map.remove(uniffi_handle)++ @_UNIFFI_CALLBACK_INTERFACE_CLONE_CUA_SDK_SPACES_LIST_LISTENER+ def _uniffi_clone(uniffi_handle):+ return _UniffiFfiConverterTypeSpacesListListener._handle_map.clone(uniffi_handle)++ # Generate the FFI VTable. This has a field for each callback interface method.+ _uniffi_vtable = _UniffiVTableCallbackInterfaceCuaSdkSpacesListListener(+ _uniffi_free,+ _uniffi_clone,+ on_changed,+ )+ # Send Rust a pointer to the VTable. Note: this means we need to keep the struct alive forever,+ # or else bad things will happen when Rust tries to access it.+ _UniffiLib.uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(ctypes.byref(_uniffi_vtable))++class _UniffiFfiConverterTypeSpacesListListener:+ _handle_map = _UniffiHandleMap()++ @staticmethod+ def lift(value: int):+ if (value & 1) == 0:+ # Rust-generated handle, construct a new class that uses the handle to implement the+ # interface+ return SpacesListListenerImpl._uniffi_make_instance(value)+ else:+ # Python-generated handle, get the object from the handle map+ return _UniffiFfiConverterTypeSpacesListListener._handle_map.remove(value)++ @staticmethod+ def check_lower(value: SpacesListListener):+ if not isinstance(value, SpacesListListener):+ raise TypeError("Expected SpacesListListener subclass, {} found".format(type(value).__name__))++ @staticmethod+ def lower(value: SpacesListListener):+ if isinstance(value, SpacesListListenerImpl):+ # Rust-implementated object. Clone the handle and return it+ return value._uniffi_clone_handle()+ else:+ # Python-implementated object, generate a new vtable handle and return that.+ return _UniffiFfiConverterTypeSpacesListListener._handle_map.insert(value)++ @classmethod+ def read(cls, buf: _UniffiRustBuffer):+ ptr = buf.read_u64()+ if ptr == 0:+ raise InternalError("Raw handle value was null")+ return cls.lift(ptr)++ @classmethod+ def write(cls, value: SpacesListListener, buf: _UniffiRustBuffer):+ buf.write_u64(cls.lower(value))+++class SpacesListWatchProtocol(typing.Protocol):+ """+ A running [`Spaces::watch_list`]. Dropping it also stops it.+"""++ def stop(self, ) -> None:+ """+ Ends the watch. No call is made after this returns.+"""+ raise NotImplementedError++class SpacesListWatch(SpacesListWatchProtocol):+ """+ A running [`Spaces::watch_list`]. Dropping it also stops it.+"""++ _handle: ctypes.c_uint64++ def __init__(self, *args, **kwargs):+ raise ValueError("This class has no default constructor")++ def __del__(+ self,+ _uniffi_free=_UniffiLib.uniffi_cua_sdk_fn_free_spaceslistwatch,+ _uniffi_call=_uniffi_rust_call,+ _uniffi_finalizing=sys.is_finalizing,+ ):+ # In case of partial initialization of instances.+ handle = getattr(self, "_handle", None)+ # At interpreter exit the module globals are gone: skip the free (cua+ # post-process, libs/cua/scripts/uniffi-python-postprocess.mjs).+ if handle is not None and not _uniffi_finalizing():+ _uniffi_call(_uniffi_free, handle)++ def _uniffi_clone_handle(self):+ return _uniffi_rust_call(_UniffiLib.uniffi_cua_sdk_fn_clone_spaceslistwatch, self._handle)++ # Used by alternative constructors or any methods which return this type.+ @classmethod+ def _uniffi_make_instance(cls, handle):+ # Lightly yucky way to bypass the usual __init__ logic+ # and just create a new instance with the required handle.+ inst = cls.__new__(cls)+ inst._handle = handle+ return inst+ def stop(self, ) -> None:+ """+ Ends the watch. No call is made after this returns.+"""+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ )+ _uniffi_lift_return = lambda val: None+ _uniffi_error_converter = None+ _uniffi_ffi_result = _uniffi_rust_call_with_error(+ _uniffi_error_converter,+ _UniffiLib.uniffi_cua_sdk_fn_method_spaceslistwatch_stop,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)++++++class _UniffiFfiConverterTypeSpacesListWatch:+ @staticmethod+ def lift(value: int) -> SpacesListWatch:+ return SpacesListWatch._uniffi_make_instance(value)++ @staticmethod+ def check_lower(value: SpacesListWatch):+ if not isinstance(value, SpacesListWatch):+ raise TypeError("Expected SpacesListWatch instance, {} found".format(type(value).__name__))++ @staticmethod+ def lower(value: SpacesListWatch) -> ctypes.c_uint64:+ return value._uniffi_clone_handle()++ @classmethod+ def read(cls, buf: _UniffiRustBuffer) -> SpacesListWatch:+ ptr = buf.read_u64()+ if ptr == 0:+ raise InternalError("Raw handle value was null")+ return cls.lift(ptr)++ @classmethod+ def write(cls, value: SpacesListWatch, buf: _UniffiRustBuffer):+ buf.write_u64(cls.lower(value))++class ResourcesListener():"""Receives [`ResourcesEvent`]s from [`Spaces::watch_resources`], in order.@@ -40454,6 +40765,16 @@ class SpacesProtocol(typing.Protocol):"""The named volumes of Cua Volume, by name, with the Spaces that mounteach. Needs Cua Spaces (the Cua Volume).+"""+ raise NotImplementedError+ def watch_list(self, listener: SpacesListListener) -> SpacesListWatch:+ """+ Tells `listener` when the Space list changed: once at the start, then+ on every change. This computer's Spaces within a second; your other+ computers on the mesh within about a second of connecting or going+ away; the others within 10 seconds. Reopens by itself if the daemon+ restarts (and then calls `listener` again). Stop it with+ [`SpacesListWatch::stop`]."""raise NotImplementedErrordef watch_resources(self, visible: bool,listener: ResourcesListener) -> ResourcesWatch:@@ -42527,6 +42848,29 @@ class Spaces(SpacesProtocol):_uniffi_lift_return,_uniffi_error_converter,)+ def watch_list(self, listener: SpacesListListener) -> SpacesListWatch:+ """+ Tells `listener` when the Space list changed: once at the start, then+ on every change. This computer's Spaces within a second; your other+ computers on the mesh within about a second of connecting or going+ away; the others within 10 seconds. Reopens by itself if the daemon+ restarts (and then calls `listener` again). Stop it with+ [`SpacesListWatch::stop`].+"""++ _UniffiFfiConverterTypeSpacesListListener.check_lower(listener)+ _uniffi_lowered_args = (+ self._uniffi_clone_handle(),+ _UniffiFfiConverterTypeSpacesListListener.lower(listener),+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeSpacesListWatch.lift+ _uniffi_error_converter = None+ _uniffi_ffi_result = _uniffi_rust_call_with_error(+ _uniffi_error_converter,+ _UniffiLib.uniffi_cua_sdk_fn_method_spaces_watch_list,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)def watch_resources(self, visible: bool,listener: ResourcesListener) -> ResourcesWatch:"""The same numbers as events for `listener`: a snapshot first, then an@@ -45083,6 +45427,10 @@ __all__ = ["TeleportApprover","Space","SpaceProtocol",+ "SpacesListListenerImpl",+ "SpacesListListener",+ "SpacesListWatch",+ "SpacesListWatchProtocol","ResourcesListenerImpl","ResourcesListener","ResourcesWatch",diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swiftindex 939f53ae59..09298d2730 100644--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift@@ -11419,6 +11419,16 @@ public protocol SpacesProtocol: AnyObject, Sendable {*/func volumes() async throws -> [NamedVolume]+ /**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+ func watchList(listener: SpacesListListener) -> SpacesListWatch+/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -13321,6 +13331,23 @@ open func volumes()async throws -> [NamedVolume] {)}+ /**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+open func watchList(listener: SpacesListListener) -> SpacesListWatch {+ return try! FfiConverterTypeSpacesListWatch_lift(try! rustCall() {+ uniffi_cua_sdk_fn_method_spaces_watch_list(+ self.uniffiCloneHandle(),+ FfiConverterTypeSpacesListListener_lower(listener),$0+ )+})+}+/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -13481,6 +13508,335 @@ public func FfiConverterTypeSpaces_lower(_ value: Spaces) -> UInt64 {+/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+public protocol SpacesListListener: AnyObject, Sendable {++ /**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+ func onChanged(generation: UInt64)++}+/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+open class SpacesListListenerImpl: SpacesListListener, @unchecked Sendable {+ fileprivate let handle: UInt64++ /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.+#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ public struct NoHandle {+ public init() {}+ }++ // TODO: We'd like this to be `private` but for Swifty reasons,+ // we can't implement `FfiConverter` without making this `required` and we can't+ // make it `required` without making it `public`.+#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ required public init(unsafeFromHandle handle: UInt64) {+ self.handle = handle+ }++ // This constructor can be used to instantiate a fake object.+ // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].+ //+ // - Warning:+ // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.+#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ public init(noHandle: NoHandle) {+ self.handle = 0+ }++#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ public func uniffiCloneHandle() -> UInt64 {+ return try! rustCall { uniffi_cua_sdk_fn_clone_spaceslistlistener(self.handle, $0) }+ }+ // No primary constructor declared for this class.++ deinit {+ if handle == 0 {+ // Mock objects have handle=0 don't try to free them+ return+ }++ try! rustCall { uniffi_cua_sdk_fn_free_spaceslistlistener(handle, $0) }+ }+++++ /**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+open func onChanged(generation: UInt64) {try! rustCall() {+ uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(+ self.uniffiCloneHandle(),+ FfiConverterUInt64.lower(generation),$0+ )+}+}++++}++++// Put the implementation in a struct so we don't pollute the top-level namespace+fileprivate struct UniffiCallbackInterfaceSpacesListListener {++ // Create the VTable using a series of closures.+ // Swift automatically converts these into C callback functions.+ //+ // This creates 1-element array, since this seems to be the only way to construct a const+ // pointer that we can pass to the Rust code.+ static let vtable: [UniffiVTableCallbackInterfaceSpacesListListener] = [UniffiVTableCallbackInterfaceSpacesListListener(+ uniffiFree: { (uniffiHandle: UInt64) -> () in+ do {+ try FfiConverterTypeSpacesListListener.handleMap.remove(handle: uniffiHandle)+ } catch {+ print("Uniffi callback interface SpacesListListener: handle missing in uniffiFree")+ }+ },+ uniffiClone: { (uniffiHandle: UInt64) -> UInt64 in+ do {+ return try FfiConverterTypeSpacesListListener.handleMap.clone(handle: uniffiHandle)+ } catch {+ fatalError("Uniffi callback interface SpacesListListener: handle missing in uniffiClone")+ }+ },+ onChanged: { (+ uniffiHandle: UInt64,+ generation: UInt64,+ uniffiOutReturn: UnsafeMutableRawPointer,+ uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>+ ) in+ let makeCall = {+ () throws -> () in+ guard let uniffiObj = try? FfiConverterTypeSpacesListListener.handleMap.get(handle: uniffiHandle) else {+ throw UniffiInternalError.unexpectedStaleHandle+ }+ return uniffiObj.onChanged(+ generation: try FfiConverterUInt64.lift(generation)+ )+ }+++ let writeReturn = { () }+ uniffiTraitInterfaceCall(+ callStatus: uniffiCallStatus,+ makeCall: makeCall,+ writeReturn: writeReturn+ )+ }+ )]+}++private func uniffiCallbackInitSpacesListListener() {+ uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(UniffiCallbackInterfaceSpacesListListener.vtable)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeSpacesListListener: FfiConverter {+ fileprivate static let handleMap = UniffiHandleMap<SpacesListListener>()++ typealias FfiType = UInt64+ typealias SwiftType = SpacesListListener++ public static func lift(_ handle: UInt64) throws -> SpacesListListener {+ if ((handle & 1) == 0) {+ // Rust-generated handle, construct a new class that uses the handle to implement the+ // interface+ return SpacesListListenerImpl(unsafeFromHandle: handle)+ } else {+ // Swift-generated handle, get the object from the handle map+ return try handleMap.remove(handle: handle)+ }+ }++ public static func lower(_ value: SpacesListListener) -> UInt64 {+ if let rustImpl = value as? SpacesListListenerImpl {+ // Rust-implemented object. Clone the handle and return it+ return rustImpl.uniffiCloneHandle()+ } else {+ // Swift object, generate a new vtable handle and return that.+ return handleMap.insert(obj: value)+ }+ }++ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpacesListListener {+ let handle: UInt64 = try readInt(&buf)+ return try lift(handle)+ }++ public static func write(_ value: SpacesListListener, into buf: inout [UInt8]) {+ writeInt(&buf, lower(value))+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeSpacesListListener_lift(_ handle: UInt64) throws -> SpacesListListener {+ return try FfiConverterTypeSpacesListListener.lift(handle)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeSpacesListListener_lower(_ value: SpacesListListener) -> UInt64 {+ return FfiConverterTypeSpacesListListener.lower(value)+}+++++++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+public protocol SpacesListWatchProtocol: AnyObject, Sendable {++ /**+ * Ends the watch. No call is made after this returns.+ */+ func stop()++}+/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+open class SpacesListWatch: SpacesListWatchProtocol, @unchecked Sendable {+ fileprivate let handle: UInt64++ /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.+#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ public struct NoHandle {+ public init() {}+ }++ // TODO: We'd like this to be `private` but for Swifty reasons,+ // we can't implement `FfiConverter` without making this `required` and we can't+ // make it `required` without making it `public`.+#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ required public init(unsafeFromHandle handle: UInt64) {+ self.handle = handle+ }++ // This constructor can be used to instantiate a fake object.+ // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].+ //+ // - Warning:+ // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.+#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ public init(noHandle: NoHandle) {+ self.handle = 0+ }++#if swift(>=5.8)+ @_documentation(visibility: private)+#endif+ public func uniffiCloneHandle() -> UInt64 {+ return try! rustCall { uniffi_cua_sdk_fn_clone_spaceslistwatch(self.handle, $0) }+ }+ // No primary constructor declared for this class.++ deinit {+ if handle == 0 {+ // Mock objects have handle=0 don't try to free them+ return+ }++ try! rustCall { uniffi_cua_sdk_fn_free_spaceslistwatch(handle, $0) }+ }+++++ /**+ * Ends the watch. No call is made after this returns.+ */+open func stop() {try! rustCall() {+ uniffi_cua_sdk_fn_method_spaceslistwatch_stop(+ self.uniffiCloneHandle(),$0+ )+}+}++++}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeSpacesListWatch: FfiConverter {+ typealias FfiType = UInt64+ typealias SwiftType = SpacesListWatch++ public static func lift(_ handle: UInt64) throws -> SpacesListWatch {+ return SpacesListWatch(unsafeFromHandle: handle)+ }++ public static func lower(_ value: SpacesListWatch) -> UInt64 {+ return value.uniffiCloneHandle()+ }++ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpacesListWatch {+ let handle: UInt64 = try readInt(&buf)+ return try lift(handle)+ }++ public static func write(_ value: SpacesListWatch, into buf: inout [UInt8]) {+ writeInt(&buf, lower(value))+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeSpacesListWatch_lift(_ handle: UInt64) throws -> SpacesListWatch {+ return try FfiConverterTypeSpacesListWatch.lift(handle)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeSpacesListWatch_lower(_ value: SpacesListWatch) -> UInt64 {+ return FfiConverterTypeSpacesListWatch.lower(value)+}++++++/*** Client for one cua-spacesd.*/@@ -49419,6 +49775,9 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_method_spaces_volumes() != 15143) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_method_spaces_watch_list() != 1499) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_method_spaces_watch_resources() != 49660) {return InitializationResult.apiChecksumMismatch}@@ -49434,6 +49793,12 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_method_spaces_delete_build() != 6500) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed() != 40063) {+ return InitializationResult.apiChecksumMismatch+ }+ if (uniffi_cua_sdk_checksum_method_spaceslistwatch_stop() != 38223) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_method_teleportapprover_approve() != 36264) {return InitializationResult.apiChecksumMismatch}@@ -49653,6 +50018,7 @@ private let initializationResult: InitializationResult = {uniffiCallbackInitFrameSink()uniffiCallbackInitResourcesListener()uniffiCallbackInitSpaceCreateListener()+ uniffiCallbackInitSpacesListListener()uniffiCallbackInitTeleportApprover()return InitializationResult.ok}()diff --git a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.hindex d0ed32352c..50e1a92019 100644--- a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h+++ b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h@@ -277,6 +277,13 @@ typedef void (*UniffiCallbackInterfaceSpaceCreateListenerMethod0)(uint64_t, RustRustCallStatus *_Nonnull uniffiCallStatus);+#endif+#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_SPACES_LIST_LISTENER_METHOD0+#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_SPACES_LIST_LISTENER_METHOD0+typedef void (*UniffiCallbackInterfaceSpacesListListenerMethod0)(uint64_t, uint64_t, void* _Nonnull,+ RustCallStatus *_Nonnull uniffiCallStatus+ );+#endif#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_TELEPORT_APPROVER_METHOD0#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_TELEPORT_APPROVER_METHOD0@@ -328,6 +335,15 @@ typedef struct UniffiVTableCallbackInterfaceSpaceCreateListener {UniffiCallbackInterfaceSpaceCreateListenerMethod0 _Nonnull onProgress;} UniffiVTableCallbackInterfaceSpaceCreateListener;+#endif+#ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_SPACES_LIST_LISTENER+#define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_SPACES_LIST_LISTENER+typedef struct UniffiVTableCallbackInterfaceSpacesListListener {+ UniffiCallbackInterfaceFree _Nonnull uniffiFree;+ UniffiCallbackInterfaceClone _Nonnull uniffiClone;+ UniffiCallbackInterfaceSpacesListListenerMethod0 _Nonnull onChanged;+} UniffiVTableCallbackInterfaceSpacesListListener;+#endif#ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_TELEPORT_APPROVER#define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_TELEPORT_APPROVER@@ -2443,6 +2459,11 @@ uint64_t uniffi_cua_sdk_fn_method_spaces_volume_write(uint64_t ptr, RustBuffer puint64_t uniffi_cua_sdk_fn_method_spaces_volumes(uint64_t ptr);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_WATCH_LIST+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_WATCH_LIST+uint64_t uniffi_cua_sdk_fn_method_spaces_watch_list(uint64_t ptr, uint64_t listener, RustCallStatus *_Nonnull out_status+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_WATCH_RESOURCES#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACES_WATCH_RESOURCESuint64_t uniffi_cua_sdk_fn_method_spaces_watch_resources(uint64_t ptr, int8_t visible, uint64_t listener, RustCallStatus *_Nonnull out_status@@ -2468,6 +2489,41 @@ uint64_t uniffi_cua_sdk_fn_method_spaces_builds(uint64_t ptruint64_t uniffi_cua_sdk_fn_method_spaces_delete_build(uint64_t ptr, RustBuffer build);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_CLONE_SPACESLISTLISTENER+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_CLONE_SPACESLISTLISTENER+uint64_t uniffi_cua_sdk_fn_clone_spaceslistlistener(uint64_t handle, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FREE_SPACESLISTLISTENER+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FREE_SPACESLISTLISTENER+void uniffi_cua_sdk_fn_free_spaceslistlistener(uint64_t handle, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_INIT_CALLBACK_VTABLE_SPACESLISTLISTENER+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_INIT_CALLBACK_VTABLE_SPACESLISTLISTENER+void uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(const UniffiVTableCallbackInterfaceSpacesListListener* _Nonnull vtable+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACESLISTLISTENER_ON_CHANGED+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACESLISTLISTENER_ON_CHANGED+void uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(uint64_t ptr, uint64_t generation, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_CLONE_SPACESLISTWATCH+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_CLONE_SPACESLISTWATCH+uint64_t uniffi_cua_sdk_fn_clone_spaceslistwatch(uint64_t handle, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FREE_SPACESLISTWATCH+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FREE_SPACESLISTWATCH+void uniffi_cua_sdk_fn_free_spaceslistwatch(uint64_t handle, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACESLISTWATCH_STOP+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_METHOD_SPACESLISTWATCH_STOP+void uniffi_cua_sdk_fn_method_spaceslistwatch_stop(uint64_t ptr, RustCallStatus *_Nonnull out_status+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_CLONE_TELEPORTAPPROVER#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_CLONE_TELEPORTAPPROVERuint64_t uniffi_cua_sdk_fn_clone_teleportapprover(uint64_t handle, RustCallStatus *_Nonnull out_status@@ -5822,6 +5878,12 @@ uint16_t uniffi_cua_sdk_checksum_method_spaces_volume_write(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_VOLUMESuint16_t uniffi_cua_sdk_checksum_method_spaces_volumes(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_WATCH_LIST+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_WATCH_LIST+uint16_t uniffi_cua_sdk_checksum_method_spaces_watch_list(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_WATCH_RESOURCES@@ -5852,6 +5914,18 @@ uint16_t uniffi_cua_sdk_checksum_method_spaces_builds(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACES_DELETE_BUILDuint16_t uniffi_cua_sdk_checksum_method_spaces_delete_build(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACESLISTLISTENER_ON_CHANGED+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACESLISTLISTENER_ON_CHANGED+uint16_t uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed(void++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACESLISTWATCH_STOP+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_SPACESLISTWATCH_STOP+uint16_t uniffi_cua_sdk_checksum_method_spaceslistwatch_stop(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_METHOD_TELEPORTAPPROVER_APPROVEdiff --git a/libs/cua/typescript/src/native/cua_sdk-ffi.ts b/libs/cua/typescript/src/native/cua_sdk-ffi.tsindex c5b3a6414b..1655096823 100644--- a/libs/cua/typescript/src/native/cua_sdk-ffi.ts+++ b/libs/cua/typescript/src/native/cua_sdk-ffi.ts@@ -563,6 +563,26 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_clone_spaceslistlistener": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_free_spaceslistlistener": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_clone_spaceslistwatch": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_free_spaceslistwatch": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_clone_spacesdclient": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -638,6 +658,11 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener": {+ args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceCuaSdkSpacesListListener"))],+ ret: FfiType.Void,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_init_callback_vtable_teleportapprover": {args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceCuaSdkTeleportApprover"))],ret: FfiType.Void,@@ -2718,11 +2743,26 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_sdk_fn_method_spaces_watch_list": {+ args: [FfiType.Handle, FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_method_spaces_watch_resources": {args: [FfiType.Handle, FfiType.Int8, FfiType.Handle],ret: FfiType.Handle,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed": {+ args: [FfiType.Handle, FfiType.UInt64],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_method_spaceslistwatch_stop": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_method_spacesdclient_agents": {args: [FfiType.Handle],ret: FfiType.Handle,@@ -5118,11 +5158,26 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_spaces_watch_list": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_spaces_watch_resources": {args: [],ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_sdk_checksum_method_spaceslistwatch_stop": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_method_spacesdclient_agents": {args: [],ret: FfiType.UInt16,@@ -5536,6 +5591,22 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: false,},+ "CallbackInterfaceCuaSdkSpacesListListenerMethod0": {+ args: [FfiType.Handle, FfiType.UInt64],+ ret: FfiType.VoidPointer,+ hasRustCallStatus: true,+ outReturn: true,+ },+ "CallbackInterfaceCloneCuaSdk_SpacesListListener": {+ args: [FfiType.Handle],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },+ "CallbackInterfaceFreeCuaSdk_SpacesListListener": {+ args: [FfiType.Handle],+ ret: FfiType.Void,+ hasRustCallStatus: false,+ },"CallbackInterfaceCuaSdkTeleportApproverMethod0": {args: [FfiType.Handle, FfiType.RustBuffer],ret: FfiType.RustBuffer,@@ -5584,6 +5655,11 @@ const DEFINITIONS = {{ name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCuaSdk_SpaceCreateListener") },{ name: "on_progress", type: FfiType.Callback("CallbackInterfaceCuaSdkSpaceCreateListenerMethod0") },],+ "VTableCallbackInterfaceCuaSdkSpacesListListener": [+ { name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeCuaSdk_SpacesListListener") },+ { name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCuaSdk_SpacesListListener") },+ { name: "on_changed", type: FfiType.Callback("CallbackInterfaceCuaSdkSpacesListListenerMethod0") },+ ],"VTableCallbackInterfaceCuaSdkTeleportApprover": [{ name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeCuaSdk_TeleportApprover") },{ name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneCuaSdk_TeleportApprover") },@@ -5701,6 +5777,10 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_free_spacestreamsession(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_clone_spaces(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_free_spaces(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_clone_spaceslistlistener(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;+ uniffi_cua_sdk_fn_free_spaceslistlistener(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_clone_spaceslistwatch(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;+ uniffi_cua_sdk_fn_free_spaceslistwatch(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_clone_spacesdclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_free_spacesdclient(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_clone_spacesddownload(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;@@ -5716,6 +5796,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_init_callback_vtable_framesink(vtable: UniffiVTableCallbackInterfaceCuaSdkFrameSink): void;uniffi_cua_sdk_fn_init_callback_vtable_resourceslistener(vtable: UniffiVTableCallbackInterfaceCuaSdkResourcesListener): void;uniffi_cua_sdk_fn_init_callback_vtable_spacecreatelistener(vtable: UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener): void;+ uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(vtable: UniffiVTableCallbackInterfaceCuaSdkSpacesListListener): void;uniffi_cua_sdk_fn_init_callback_vtable_teleportapprover(vtable: UniffiVTableCallbackInterfaceCuaSdkTeleportApprover): void;uniffi_cua_sdk_fn_func_agent_event_category(kind: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_agent_harnesses(uniffi_out_err: UniffiRustCallStatus): Uint8Array;@@ -6132,7 +6213,10 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_method_spaces_volume_unmount(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spaces_volume_write(uniffiSelf: bigint, path: Uint8Array, content: Uint8Array, ifEtag: Uint8Array, createOnly: number, view: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spaces_volumes(uniffiSelf: bigint): bigint;+ uniffi_cua_sdk_fn_method_spaces_watch_list(uniffiSelf: bigint, listener: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;uniffi_cua_sdk_fn_method_spaces_watch_resources(uniffiSelf: bigint, visible: number, listener: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;+ uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(uniffiSelf: bigint, generation: bigint, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_method_spaceslistwatch_stop(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_method_spacesdclient_agents(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_spacesdclient_attach(uniffiSelf: bigint, pid: Uint8Array, tag: Uint8Array, replay: Uint8Array): bigint;uniffi_cua_sdk_fn_method_spacesdclient_call_json(uniffiSelf: bigint, method: Uint8Array, requestJson: Uint8Array, user: Uint8Array): bigint;@@ -6612,7 +6696,10 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_method_spaces_volume_unmount(): number;uniffi_cua_sdk_checksum_method_spaces_volume_write(): number;uniffi_cua_sdk_checksum_method_spaces_volumes(): number;+ uniffi_cua_sdk_checksum_method_spaces_watch_list(): number;uniffi_cua_sdk_checksum_method_spaces_watch_resources(): number;+ uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed(): number;+ uniffi_cua_sdk_checksum_method_spaceslistwatch_stop(): number;uniffi_cua_sdk_checksum_method_spacesdclient_agents(): number;uniffi_cua_sdk_checksum_method_spacesdclient_attach(): number;uniffi_cua_sdk_checksum_method_spacesdclient_call_json(): number;@@ -6748,6 +6835,14 @@ export type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener = {uniffi_clone: UniffiCallbackInterfaceCloneCuaSdkSpaceCreateListener;on_progress: UniffiCallbackInterfaceCuaSdkSpaceCreateListenerMethod0;};+type UniffiCallbackInterfaceCuaSdkSpacesListListenerMethod0 = (uniffiHandle: bigint, generation: bigint) => UniffiResult<void>;+type UniffiCallbackInterfaceCloneCuaSdkSpacesListListener = (handle: bigint) => UniffiResult<void>;+type UniffiCallbackInterfaceFreeCuaSdkSpacesListListener = (handle: bigint) => void;+export type UniffiVTableCallbackInterfaceCuaSdkSpacesListListener = {+ uniffi_free: UniffiCallbackInterfaceFreeCuaSdkSpacesListListener;+ uniffi_clone: UniffiCallbackInterfaceCloneCuaSdkSpacesListListener;+ on_changed: UniffiCallbackInterfaceCuaSdkSpacesListListenerMethod0;+};type UniffiCallbackInterfaceCuaSdkTeleportApproverMethod0 = (uniffiHandle: bigint, manifest: Uint8Array) => Uint8Array;type UniffiCallbackInterfaceCloneCuaSdkTeleportApprover = (handle: bigint) => UniffiResult<void>;type UniffiCallbackInterfaceFreeCuaSdkTeleportApprover = (handle: bigint) => void;diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.tsindex 12701361c9..4d96d6b435 100644--- a/libs/cua/typescript/src/native/cua_sdk.ts+++ b/libs/cua/typescript/src/native/cua_sdk.ts@@ -4,7 +4,7 @@/* eslint-disable */// @ts-nocheckimport nativeModule from "./cua_sdk-ffi.js";-import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceCuaSdkAudioSink, type UniffiVTableCallbackInterfaceCuaSdkBuildListener, type UniffiVTableCallbackInterfaceCuaSdkFrameSink, type UniffiVTableCallbackInterfaceCuaSdkResourcesListener, type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener, type UniffiVTableCallbackInterfaceCuaSdkTeleportApprover,+import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceCuaSdkAudioSink, type UniffiVTableCallbackInterfaceCuaSdkBuildListener, type UniffiVTableCallbackInterfaceCuaSdkFrameSink, type UniffiVTableCallbackInterfaceCuaSdkResourcesListener, type UniffiVTableCallbackInterfaceCuaSdkSpaceCreateListener, type UniffiVTableCallbackInterfaceCuaSdkSpacesListListener, type UniffiVTableCallbackInterfaceCuaSdkTeleportApprover,} from "./cua_sdk-ffi.js";import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterFloat64, FfiConverterInt32, FfiConverterInt64, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTypeNameSymbol, variantOrdinalSymbol,} from "@ubjs/core";@@ -37986,6 +37986,305 @@ const uniffiTypeSpaceObjectFactory: UniffiObjectFactory<SpaceLike> = (() => {}})();const FfiConverterTypeSpace = new FfiConverterObject(uniffiTypeSpaceObjectFactory);+/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+export interface SpacesListListener {++/**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+ onChanged(generation: bigint): void;+}+++/**+ * Hears that the Space list changed ([`Spaces::watch_list`]). Called on an+ * SDK worker thread; return quickly (read the list on your own queue).+ */+export class SpacesListListenerImpl extends UniffiAbstractObject implements SpacesListListener {++ readonly [uniffiTypeNameSymbol] = "SpacesListListenerImpl";+ readonly [destructorGuardSymbol]: UniffiGcObject;+ readonly [pointerLiteralSymbol]: UniffiHandle;+ // No primary constructor declared for this class.+private constructor(pointer: UniffiHandle) {+ super();+ this[pointerLiteralSymbol] = pointer;+ this[destructorGuardSymbol] = uniffiTypeSpacesListListenerImplObjectFactory.bless(pointer);+}+++++/**+ * The list changed (and once at the start): read it again.+ * `generation` only increases while one daemon runs.+ */+ onChanged(generation: bigint): void {uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_spaceslistlistener_on_changed(+ uniffiTypeSpacesListListenerImplObjectFactory.clonePointer(this),+ FfiConverterUInt64.lower(generation, nativeModule().rustbuffer_alloc),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ );+ }+++ uniffiDestroy(): void {+ const ptr = (this as any)[destructorGuardSymbol];+ if (ptr !== undefined) {+ const pointer = uniffiTypeSpacesListListenerImplObjectFactory.pointer(this);+ uniffiTypeSpacesListListenerImplObjectFactory.freePointer(pointer);+ uniffiTypeSpacesListListenerImplObjectFactory.unbless(ptr);+ delete (this as any)[destructorGuardSymbol];+ }+ }++ static instanceOf(obj_: any): obj_ is SpacesListListenerImpl {+ return uniffiTypeSpacesListListenerImplObjectFactory.isConcreteType(obj_);+ }+++}++const uniffiTypeSpacesListListenerImplObjectFactory: UniffiObjectFactory<SpacesListListener> = (() => {++ /// <reference lib="es2021" />+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {+ uniffiTypeSpacesListListenerImplObjectFactory.freePointer(heldValue);+ }) : null;++ return {+ create(pointer: UniffiHandle): SpacesListListener {+ const instance = Object.create(SpacesListListenerImpl.prototype);+ instance[pointerLiteralSymbol] = pointer;+ instance[destructorGuardSymbol] = this.bless(pointer);+ instance[uniffiTypeNameSymbol] = "SpacesListListenerImpl";+ return instance;+ },+++ bless(p: UniffiHandle): UniffiGcObject {+ const ptr = {+ p, // make sure this object doesn't get optimized away.+ markDestroyed: () => undefined,+ };+ if (registry) {+ registry.register(ptr, p, ptr);+ }+ return ptr;+ },++ unbless(ptr_: UniffiGcObject) {+ if (registry) {+ registry.unregister(ptr_);+ }+ },++ pointer(obj_: SpacesListListener): UniffiHandle {+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {+ throw new UniffiInternalError.UnexpectedNullPointer();+ }+ return (obj_ as any)[pointerLiteralSymbol];+ },++ clonePointer(obj_: SpacesListListener): UniffiHandle {+ const pointer = this.pointer(obj_);+ return uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spaceslistlistener(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ freePointer(pointer: UniffiHandle): void {+ uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spaceslistlistener(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ isConcreteType(obj_: any): obj_ is SpacesListListener {+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesListListenerImpl";+ },+}})();+const FfiConverterTypeSpacesListListener = new FfiConverterObjectWithCallbacks(uniffiTypeSpacesListListenerImplObjectFactory);++// Add a vtable for the callbacks that go in SpacesListListener.++// Put the implementation in a struct so we don't pollute the top-level namespace+const uniffiCallbackInterfaceSpacesListListener: { vtable: any; register: () => void; } = {+ // Create the VTable using a series of closures.+ // ts automatically converts these into C callback functions.+ vtable: {+ on_changed: (+ uniffiHandle: bigint,+ generation: bigint,) => {+ const uniffiMakeCall =+ ()+ : void => {+ const jsCallback = FfiConverterTypeSpacesListListener.lift(uniffiHandle);+ return jsCallback.onChanged(+ FfiConverterUInt64.lift(generation)+ )+ };+ const uniffiResult = UniffiResult.ready<void>();+ const uniffiHandleSuccess = (obj: any) => {};+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {+ UniffiResult.writeError(uniffiResult, code, errBuf);+ };+ uniffiTraitInterfaceCall(+ /*makeCall:*/ uniffiMakeCall,+ /*handleSuccess:*/ uniffiHandleSuccess,+ /*handleError:*/ uniffiHandleError,+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),+ /*alloc:*/ nativeModule().rustbuffer_alloc,+ )+ return uniffiResult;+ },+ uniffi_free: (uniffiHandle: UniffiHandle): void => {+ // this will throw a stale handle error if the handle isn't found.+ FfiConverterTypeSpacesListListener.drop(uniffiHandle);+ },+ uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => {+ return FfiConverterTypeSpacesListListener.clone(uniffiHandle);+ }+ },+ register: () => {nativeModule().uniffi_cua_sdk_fn_init_callback_vtable_spaceslistlistener(+ uniffiCallbackInterfaceSpacesListListener.vtable+ );+ },+};++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+export interface SpacesListWatchLike {++/**+ * Ends the watch. No call is made after this returns.+ */+ stop(): void;+}+/**+ * @deprecated Use `SpacesListWatchLike` instead.+ */+export type SpacesListWatchInterface = SpacesListWatchLike;+++/**+ * A running [`Spaces::watch_list`]. Dropping it also stops it.+ */+export class SpacesListWatch extends UniffiAbstractObject implements SpacesListWatchLike {++ readonly [uniffiTypeNameSymbol] = "SpacesListWatch";+ readonly [destructorGuardSymbol]: UniffiGcObject;+ readonly [pointerLiteralSymbol]: UniffiHandle;+ // No primary constructor declared for this class.+private constructor(pointer: UniffiHandle) {+ super();+ this[pointerLiteralSymbol] = pointer;+ this[destructorGuardSymbol] = uniffiTypeSpacesListWatchObjectFactory.bless(pointer);+}+++++/**+ * Ends the watch. No call is made after this returns.+ */+ stop(): void {uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_method_spaceslistwatch_stop(+ uniffiTypeSpacesListWatchObjectFactory.clonePointer(this),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ );+ }+++ uniffiDestroy(): void {+ const ptr = (this as any)[destructorGuardSymbol];+ if (ptr !== undefined) {+ const pointer = uniffiTypeSpacesListWatchObjectFactory.pointer(this);+ uniffiTypeSpacesListWatchObjectFactory.freePointer(pointer);+ uniffiTypeSpacesListWatchObjectFactory.unbless(ptr);+ delete (this as any)[destructorGuardSymbol];+ }+ }++ static instanceOf(obj_: any): obj_ is SpacesListWatch {+ return uniffiTypeSpacesListWatchObjectFactory.isConcreteType(obj_);+ }+++}++const uniffiTypeSpacesListWatchObjectFactory: UniffiObjectFactory<SpacesListWatchLike> = (() => {++ /// <reference lib="es2021" />+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {+ uniffiTypeSpacesListWatchObjectFactory.freePointer(heldValue);+ }) : null;++ return {+ create(pointer: UniffiHandle): SpacesListWatchLike {+ const instance = Object.create(SpacesListWatch.prototype);+ instance[pointerLiteralSymbol] = pointer;+ instance[destructorGuardSymbol] = this.bless(pointer);+ instance[uniffiTypeNameSymbol] = "SpacesListWatch";+ return instance;+ },+++ bless(p: UniffiHandle): UniffiGcObject {+ const ptr = {+ p, // make sure this object doesn't get optimized away.+ markDestroyed: () => undefined,+ };+ if (registry) {+ registry.register(ptr, p, ptr);+ }+ return ptr;+ },++ unbless(ptr_: UniffiGcObject) {+ if (registry) {+ registry.unregister(ptr_);+ }+ },++ pointer(obj_: SpacesListWatchLike): UniffiHandle {+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {+ throw new UniffiInternalError.UnexpectedNullPointer();+ }+ return (obj_ as any)[pointerLiteralSymbol];+ },++ clonePointer(obj_: SpacesListWatchLike): UniffiHandle {+ const pointer = this.pointer(obj_);+ return uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_clone_spaceslistwatch(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ freePointer(pointer: UniffiHandle): void {+ uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => nativeModule().uniffi_cua_sdk_fn_free_spaceslistwatch(pointer, callStatus),+ /*liftString:*/ FfiConverterString.lift+ );+ },++ isConcreteType(obj_: any): obj_ is SpacesListWatchLike {+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SpacesListWatch";+ },+}})();+const FfiConverterTypeSpacesListWatch = new FfiConverterObject(uniffiTypeSpacesListWatchObjectFactory);+/*** Receives [`ResourcesEvent`]s from [`Spaces::watch_resources`], in order.* Called on an SDK worker thread; return quickly.@@ -38783,6 +39082,15 @@ export interface SpacesLike {* each. Needs Cua Spaces (the Cua Volume).*/volumes(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array<NamedVolume>>;+/**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+ watchList(listener: SpacesListListener): SpacesListWatchLike;/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -42017,6 +42325,26 @@ private constructor(pointer: UniffiHandle) {}}+/**+ * Tells `listener` when the Space list changed: once at the start, then+ * on every change. This computer's Spaces within a second; your other+ * computers on the mesh within about a second of connecting or going+ * away; the others within 10 seconds. Reopens by itself if the daemon+ * restarts (and then calls `listener` again). Stop it with+ * [`SpacesListWatch::stop`].+ */+ watchList(listener: SpacesListListener): SpacesListWatchLike {+ return FfiConverterTypeSpacesListWatch.lift(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_method_spaces_watch_list(+ uniffiTypeSpacesObjectFactory.clonePointer(this),+ FfiConverterTypeSpacesListListener.lower(listener, nativeModule().rustbuffer_alloc),+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }+/*** The same numbers as events for `listener`: a snapshot first, then an* update with only the entries that changed by more than 1 point or@@ -45306,9 +45634,18 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_volumes() !== 15143) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_volumes");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_watch_list() !== 1499) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_watch_list");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_spaces_watch_resources() !== 49660) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaces_watch_resources");}+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed() !== 40063) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaceslistlistener_on_changed");+ }+ if (nativeModule().uniffi_cua_sdk_checksum_method_spaceslistwatch_stop() !== 38223) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spaceslistwatch_stop");+ }if (nativeModule().uniffi_cua_sdk_checksum_method_spacesdclient_agents() !== 39176) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_spacesdclient_agents");}@@ -45504,6 +45841,7 @@ function uniffiEnsureInitialized() {uniffiCallbackInterfaceFrameSink.register();uniffiCallbackInterfaceSpaceCreateListener.register();uniffiCallbackInterfaceTeleportApprover.register();+ uniffiCallbackInterfaceSpacesListListener.register();uniffiCallbackInterfaceResourcesListener.register();}@@ -45768,6 +46106,8 @@ export default Object.freeze({FfiConverterTypeSpacesHost,FfiConverterTypeSpacesHostLimit,FfiConverterTypeSpacesHostLoad,+ FfiConverterTypeSpacesListListener,+ FfiConverterTypeSpacesListWatch,FfiConverterTypeSpacesToolMethod,FfiConverterTypeSpacesdCapabilities,FfiConverterTypeSpacesdClient,diff --git a/scripts/docs-generators/cua-sdk.ts b/scripts/docs-generators/cua-sdk.tsindex ca40b3882a..320709491c 100644--- a/scripts/docs-generators/cua-sdk.ts+++ b/scripts/docs-generators/cua-sdk.ts@@ -730,6 +730,15 @@ export const PAGES: PageSpec[] = [],catalog: true,},+ {+ slug: 'spaces/list-watch',+ title: 'List changes',+ description: 'Hear when the Space list changed, so it is read again then instead of on a timer.',+ intro:+ '`Spaces.watch_list` calls a `SpacesListListener` once at the start and again whenever the list changes: this computer\'s Spaces within a second, your other computers on the mesh within about a second of connecting or going away, the others within 10 seconds. Read the list again (`Spaces.list`) when it is called. It reopens by itself after a daemon restart; `SpacesListWatch.stop` ends it.',+ members: [{ object: 'Spaces', title: 'List changes', methods: ['watch_list'] }],+ items: ['SpacesListListener', 'SpacesListWatch'],+ },{slug: 'spaces/agents',title: 'Agents in a Space',