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
feat(telemetry): link signed-in usage data to an opaque account id, off until the policy is published (CUA-1881) (#5472)
Francesco Bonacci911fc16042b2
diff --git a/apps/cua-spaces-desktop/src/bridge/methods.ts b/apps/cua-spaces-desktop/src/bridge/methods.tsindex 03751c4f6a..d1a7e4aab6 100644--- a/apps/cua-spaces-desktop/src/bridge/methods.ts+++ b/apps/cua-spaces-desktop/src/bridge/methods.ts@@ -32,7 +32,7 @@ export const METHODS = ["devices.revoke", "devices.confirmMachine", "devices.createPairingCode", "devices.pairingCodes","devices.revokePairingCode", "teams.list", "storage.get", "storage.run","notifications.list", "notifications.markAllRead", "notifications.markRead",- "telemetry.track", "spaces.usage", "spaces.windows", "stream.pip",+ "telemetry.track", "telemetry.linkNotice", "telemetry.acknowledgeLinkNotice", "spaces.usage", "spaces.windows", "stream.pip","spaces.thumbnail","spaces.chooseFiles", "spaces.droppedFiles", "spaces.sendFiles","host.setUp", "host.joinWithCode", "host.action", "host.openSettings",diff --git a/apps/cua-spaces-desktop/src/bridge/telemetry.ts b/apps/cua-spaces-desktop/src/bridge/telemetry.tsindex 85191c3a1b..e19d24eb33 100644--- a/apps/cua-spaces-desktop/src/bridge/telemetry.ts+++ b/apps/cua-spaces-desktop/src/bridge/telemetry.ts@@ -142,5 +142,12 @@ export function telemetryMethods({ model }: BridgeContext): Handlers {if (kept.some((k) => leftWelcome(k.raw))) telemetry.acknowledgeNotice();return null;},+ // The one-time linking notice (CUA-1881): the SDK's words and whether+ // it is due. No telemetry (a test host) has none.+ "telemetry.linkNotice": () => model.telemetry?.linkNotice() ?? null,+ "telemetry.acknowledgeLinkNotice": () => {+ model.telemetry?.acknowledgeLinkNotice();+ return null;+ },};}diff --git a/apps/cua-spaces-desktop/src/model/services.ts b/apps/cua-spaces-desktop/src/model/services.tsindex aa973e168e..8b68301977 100644--- a/apps/cua-spaces-desktop/src/model/services.ts+++ b/apps/cua-spaces-desktop/src/model/services.ts@@ -104,6 +104,19 @@ export function hostAccount(account: AccountRunning): AppHostAccount | null {return { id: p?.subject, email: p?.email, display: name ?? who };}+/** The one-time notice that usage data is now linked to the signed-in+ * account (CUA-1881), as the page shows it: the SDK's words, and whether it+ * is due now. */+export interface LinkNoticeView {+ due: boolean;+ title: string;+ body: string;+ okLabel: string;+ turnOffLabel: string;+ detailsLabel: string;+ docsUrl: string;+}+/** The usage-telemetry switch, and where the app's usage events go. */export interface TelemetryRunning {status(): AppTelemetryInput;@@ -115,6 +128,12 @@ export interface TelemetryRunning {* from here usage events may be sent (the SwiftUI app's* `appTelemetryWelcomeLeft`). */acknowledgeNotice(): void;+ /** The one-time linking notice for machines that saw the older+ * "anonymous" wording (`telemetryLinkNotice`, `telemetryLinkNoticeDue`). */+ linkNotice(): LinkNoticeView;+ /** The person closed it, either button (`telemetryAcknowledgeLinkNotice`):+ * linking starts at the next launch, never in this process. */+ acknowledgeLinkNotice(): void;}/** Signals held while the first-run notice is still on screen. */@@ -174,6 +193,23 @@ export class LiveTelemetry implements TelemetryRunning {if (held.length && s.enabled) this.native.appTelemetryRecord(held);}+ linkNotice(): LinkNoticeView {+ const n = this.native.telemetryLinkNotice();+ return {+ due: this.native.telemetryLinkNoticeDue(),+ title: n.title,+ body: n.body,+ okLabel: n.okLabel,+ turnOffLabel: n.turnOffLabel,+ detailsLabel: n.detailsLabel,+ docsUrl: n.docsUrl,+ };+ }++ acknowledgeLinkNotice(): void {+ this.native.telemetryAcknowledgeLinkNotice();+ }+private shown(): boolean {if (!this.noticeShown) this.noticeShown = this.native.telemetryStatus().noticeShown;return this.noticeShown;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 267dc8928a..5605622f99 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@@ -819,6 +819,11 @@ const DEFINITIONS = {ret: FfiType.RustBuffer,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice": {+ args: [],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice": {args: [],ret: FfiType.Void,@@ -829,6 +834,21 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_func_telemetry_link_notice": {+ args: [],+ ret: FfiType.RustBuffer,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_func_telemetry_link_notice_due": {+ args: [],+ ret: FfiType.Int8,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_func_telemetry_link_state": {+ args: [],+ ret: FfiType.RustBuffer,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_func_telemetry_notice_text": {args: [],ret: FfiType.RustBuffer,@@ -884,6 +904,11 @@ const DEFINITIONS = {ret: FfiType.RustBuffer,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_func_telemetry_sync_account": {+ args: [],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_func_telemetry_use_app_notice": {args: [],ret: FfiType.Void,@@ -3074,6 +3099,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice": {args: [],ret: FfiType.UInt16,@@ -3084,6 +3114,21 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_func_telemetry_link_notice": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_sdk_checksum_func_telemetry_link_notice_due": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_sdk_checksum_func_telemetry_link_state": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_func_telemetry_notice_text": {args: [],ret: FfiType.UInt16,@@ -3139,6 +3184,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_func_telemetry_sync_account": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_func_telemetry_use_app_notice": {args: [],ret: FfiType.UInt16,@@ -5421,8 +5471,12 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_func_resolve_image_with_secret(reference: Uint8Array, backend: Uint8Array, arch: Uint8Array, secret: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_sandbox_locations(uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_spaces_tool_methods(uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice(uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_func_telemetry_flush(timeoutMs: number, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_func_telemetry_link_notice(uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_sdk_fn_func_telemetry_link_notice_due(uniffi_out_err: UniffiRustCallStatus): number;+ uniffi_cua_sdk_fn_func_telemetry_link_state(uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_telemetry_notice_text(uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_telemetry_record_bench_run(taskset: Uint8Array, successRate: Uint8Array, taskCount: bigint, outcome: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;uniffi_cua_sdk_fn_func_telemetry_record_feature(feature: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;@@ -5434,6 +5488,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_func_telemetry_set_surface(surface: Uint8Array, version: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_func_telemetry_show_last(limit: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_telemetry_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_sdk_fn_func_telemetry_sync_account(): bigint;uniffi_cua_sdk_fn_func_telemetry_use_app_notice(uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_method_agentrun_artifacts(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_agentrun_events(uniffiSelf: bigint, cursor: bigint, max: Uint8Array): bigint;@@ -5872,8 +5927,12 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_func_resolve_image_with_secret(): number;uniffi_cua_sdk_checksum_func_sandbox_locations(): number;uniffi_cua_sdk_checksum_func_spaces_tool_methods(): number;+ uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice(): number;uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice(): number;uniffi_cua_sdk_checksum_func_telemetry_flush(): number;+ uniffi_cua_sdk_checksum_func_telemetry_link_notice(): number;+ uniffi_cua_sdk_checksum_func_telemetry_link_notice_due(): number;+ uniffi_cua_sdk_checksum_func_telemetry_link_state(): number;uniffi_cua_sdk_checksum_func_telemetry_notice_text(): number;uniffi_cua_sdk_checksum_func_telemetry_record_bench_run(): number;uniffi_cua_sdk_checksum_func_telemetry_record_feature(): number;@@ -5885,6 +5944,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_func_telemetry_set_surface(): number;uniffi_cua_sdk_checksum_func_telemetry_show_last(): number;uniffi_cua_sdk_checksum_func_telemetry_status(): number;+ uniffi_cua_sdk_checksum_func_telemetry_sync_account(): number;uniffi_cua_sdk_checksum_func_telemetry_use_app_notice(): number;uniffi_cua_sdk_checksum_method_agentrun_artifacts(): number;uniffi_cua_sdk_checksum_method_agentrun_events(): number;diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.tsindex aab73a7d31..7e77deae5e 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts@@ -914,6 +914,18 @@ export function spacesToolMethods(): Array<SpacesToolMethod> {));}+/**+ * The person closed the linking notice (either button). Linking starts+ * with the app's next launch, never in the process that showed it.+ */+export function telemetryAcknowledgeLinkNotice(): void {uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ );+ }+/*** Records that the first-run notice was shown in the app's UI (nothing is* sent from a machine before that). Apps that show the notice themselves@@ -940,6 +952,58 @@ export function telemetryFlush(timeoutMs: number): void {uniffiCaller.rustCall();}+/**+ * The one-time linking notice's words.+ */+export function telemetryLinkNotice(): TelemetryLinkNotice {+ return ((__rb: Uint8Array) => {+ try {+ return FfiConverterTypeTelemetryLinkNotice.lift(__rb);+ } finally {+ nativeModule().rustbuffer_free(__rb);+ }+ })(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_notice(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }++/**+ * Whether the app should show the one-time linking notice now: usage data+ * is on, the account offered linking, and this machine has not shown it.+ */+export function telemetryLinkNoticeDue(): boolean {+ return FfiConverterBool.lift(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_notice_due(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }++/**+ * Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.+ */+export function telemetryLinkState(): string {+ return ((__rb: Uint8Array) => {+ try {+ return FfiConverterString.lift(__rb);+ } finally {+ nativeModule().rustbuffer_free(__rb);+ }+ })(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_state(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }+/*** The first-run notice text (an app shows it in its own UI, then calls* [`telemetry_acknowledge_notice`]).@@ -1135,6 +1199,43 @@ export function telemetryStatus(): TelemetryStatus {));}+/**+ * Asks the Spaces API for the signed-in account's opaque id and hands it+ * to telemetry (none unlinks). Call at launch and after a sign-in; the+ * SDK's own sign-in already does. Returns the link state. Best effort:+ * offline or signed out, nothing changes.+ */+export async function telemetrySyncAccount(asyncOpts_?: { signal: AbortSignal }): Promise<string> {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_sync_account(+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,++ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** The host app shows the first-run notice itself (no stderr notice).*/@@ -17592,6 +17693,79 @@ const FfiConverterTypeStreamStatsReport = (() => {return new FFIConverter();})();+/**+ * The one-time notice for machines that saw the older "anonymous" wording,+ * shown before anything is linked to the account. Both buttons close it;+ * the second also turns usage data off.+ */+export type TelemetryLinkNotice = {+ title: string,+ body: string,+ /**+ * Keeps usage data on ("Got it").+ */+ okLabel: string,+ /**+ * Turns usage data off ("Turn off usage data").+ */+ turnOffLabel: string,+ /**+ * The link to what is collected.+ */+ detailsLabel: string,+ docsUrl: string+}++/**+ * Generated factory for {@link TelemetryLinkNotice} record objects.+ */+export const TelemetryLinkNotice = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<TelemetryLinkNotice, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<TelemetryLinkNotice>,+ });+})();++const FfiConverterTypeTelemetryLinkNotice = (() => {+ type TypeName = TelemetryLinkNotice;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ title: FfiConverterString.read(from),+ body: FfiConverterString.read(from),+ okLabel: FfiConverterString.read(from),+ turnOffLabel: FfiConverterString.read(from),+ detailsLabel: FfiConverterString.read(from),+ docsUrl: FfiConverterString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.title, into);+ FfiConverterString.write(value.body, into);+ FfiConverterString.write(value.okLabel, into);+ FfiConverterString.write(value.turnOffLabel, into);+ FfiConverterString.write(value.detailsLabel, into);+ FfiConverterString.write(value.docsUrl, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.title) ++ FfiConverterString.allocationSize(value.body) ++ FfiConverterString.allocationSize(value.okLabel) ++ FfiConverterString.allocationSize(value.turnOffLabel) ++ FfiConverterString.allocationSize(value.detailsLabel) ++ FfiConverterString.allocationSize(value.docsUrl);++ }+ };+ return new FFIConverter();+})();+/*** Telemetry state.*/@@ -22503,8 +22677,8 @@ export interface AuthLike {*/devices(relayUrl: string | undefined, name: string | undefined) /*throws*/: DevicesLike;/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/logout(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<boolean>;/**@@ -22629,8 +22803,8 @@ private constructor(pointer: UniffiHandle) {}/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/async logout(asyncOpts_?: { signal: AbortSignal }): Promise<boolean> /*throws*/ {const __stack = uniffiIsDebug ? new Error().stack : undefined;@@ -38451,12 +38625,24 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_func_spaces_tool_methods() !== 24762) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_spaces_tool_methods");}+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice() !== 46398) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice");+ }if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice() !== 6317) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice");}if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_flush() !== 29688) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_flush");}+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_link_notice() !== 11798) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_link_notice");+ }+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_link_notice_due() !== 52419) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_link_notice_due");+ }+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_link_state() !== 28062) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_link_state");+ }if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_notice_text() !== 47486) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_notice_text");}@@ -38490,6 +38676,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_status() !== 18801) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_status");}+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_sync_account() !== 61343) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_sync_account");+ }if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_use_app_notice() !== 17365) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_use_app_notice");}@@ -38607,7 +38796,7 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_auth_devices() !== 36673) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_auth_devices");}- if (nativeModule().uniffi_cua_sdk_checksum_method_auth_logout() !== 38806) {+ if (nativeModule().uniffi_cua_sdk_checksum_method_auth_logout() !== 42354) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_auth_logout");}if (nativeModule().uniffi_cua_sdk_checksum_method_auth_status() !== 29264) {@@ -39934,6 +40123,7 @@ export default Object.freeze({FfiConverterTypeSpacesdProcess,FfiConverterTypeStorageVolume,FfiConverterTypeStreamStatsReport,+ FfiConverterTypeTelemetryLinkNotice,FfiConverterTypeTelemetryStatus,FfiConverterTypeTeleportApprover,FfiConverterTypeTeleportDecision,diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.tsindex 1ee09e93b1..8258b92d63 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts@@ -5089,7 +5089,8 @@ export function appTelemetrySignInFailed(message: string | undefined): Array<App/*** The app started: attributes this process's events to `spaces_app` at- * `version`, lets the app show the first-run notice itself (nothing is+ * `version`, links usage data to the signed-in account in the background+ * when the Spaces API offers it, lets the app show the first-run notice itself (nothing is* sent before it has been shown once), and records `app_launched` (on a* first run, once the notice shows). Call once at launch, before the* first `Cua`. `onboarding_eligible`: the first run is still to finish@@ -28974,7 +28975,7 @@ export type AppOnboardingState = {launchAtLogin: boolean,/*** The usage-data switch on Welcome: the machine's telemetry setting- * (Settings' "Share anonymous usage data", `cua telemetry off`), none+ * (Settings' "Share usage data to help improve Cua", `cua telemetry off`), none* until the shell read it (then it shows on).*/telemetry?: AppTelemetryInput,@@ -29360,7 +29361,7 @@ const FfiConverterTypeAppPresentationCard = (() => {export type AppUsageToggle = {/**- * "Share anonymous usage data".+ * "Share usage data to help improve Cua".*/label: string,/**@@ -52542,7 +52543,7 @@ inner: {telemetry: AppTelemetryInput }): TelemetryLoaded_ {Readonly<{on: boolean}>};/**- * Welcome's "Share anonymous usage data" switch (not while the+ * Welcome's "Share usage data to help improve Cua" switch (not while the* environment decides). The shell writes the setting.*/class UsageDataToggled_ extends UniffiEnum implements UsageDataToggled__interface {@@ -62653,7 +62654,7 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_telemetry_sign_in_failed() !== 34262) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_telemetry_sign_in_failed");}- if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_telemetry_start() !== 189) {+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_telemetry_start() !== 30125) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_func_app_telemetry_start");}if (nativeModule().uniffi_cua_spaces_ffi_checksum_func_app_telemetry_storage() !== 21459) {diff --git a/apps/cua-spaces-desktop/test/bridge-native.test.ts b/apps/cua-spaces-desktop/test/bridge-native.test.tsindex 1c79539228..6e3a7f37c8 100644--- a/apps/cua-spaces-desktop/test/bridge-native.test.ts+++ b/apps/cua-spaces-desktop/test/bridge-native.test.ts@@ -149,6 +149,8 @@ describe.skipIf(!built)("the bridge on the app core", () => {["machines.list", {}],["host.status", {}],["telemetry.track", { signals: [{ type: "step", step: "app_launched", ok: true }] }],+ ["telemetry.linkNotice", {}],+ ["telemetry.acknowledgeLinkNotice", {}],["window.setBackgroundColor", { color: "#16181c" }],["window.setDragRegions", { rects: [{ x: 78, y: 0, width: 400, height: 38 }] }],["window.setDropTargets", { targets: [{ spaceId: space, x: 20, y: 60, width: 232, height: 180 }] }],@@ -347,6 +349,16 @@ describe.skipIf(!built)("the bridge on the app core", () => {expect(telemetrySignal(native, { type: "launched", onboardingEligible: null })).not.toBeNull();});+ it("answers the one-time linking notice from the host's telemetry, and records that it was closed", async () => {+ telemetry.linkNoticeDue = true;+ const notice = (await call("telemetry.linkNotice")) as Record<string, unknown>;+ expect(notice).toMatchObject({ due: true, title: "We've updated how usage data works", okLabel: "Got it", turnOffLabel: "Turn off usage data", detailsLabel: "What is collected", docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry" });+ const before = telemetry.linkNoticeAcknowledged;+ expect(await call("telemetry.acknowledgeLinkNotice")).toBeNull();+ expect(telemetry.linkNoticeAcknowledged).toBe(before + 1);+ expect(((await call("telemetry.linkNotice")) as { due: boolean }).due).toBe(false);+ });+it("leaves a create's signals to the host, which records them from the create it runs", async () => {const before = telemetry.recorded.length;await call("telemetry.track", {diff --git a/apps/cua-spaces-desktop/test/fixtures.ts b/apps/cua-spaces-desktop/test/fixtures.tsindex 750665419e..0acce146e9 100644--- a/apps/cua-spaces-desktop/test/fixtures.ts+++ b/apps/cua-spaces-desktop/test/fixtures.ts@@ -23,7 +23,7 @@ import type {} from "../src/native/generated/index";import type { LocalRuntimes, SpaceThumbnailData, SpacesBackend } from "../src/model/backend";import type { StreamWindow } from "../src/model/streams";-import type { AccountProfile, AccountRunning, SignInAttempt, TelemetryRunning } from "../src/model/services";+import type { AccountProfile, AccountRunning, LinkNoticeView, SignInAttempt, TelemetryRunning } from "../src/model/services";export function sampleRows(n: Native): AppSpaceRow[] {const row = (r: Partial<AppSpaceRow> & Pick<AppSpaceRow, "id" | "name" | "provider">): AppSpaceRow => ({@@ -391,4 +391,22 @@ export class FixtureTelemetry implements TelemetryRunning {this.acknowledged += 1;this.current = { ...this.current, noticeShown: true };}+ /** Whether the one-time linking notice is due (a machine that saw the older wording). */+ linkNoticeDue = false;+ linkNoticeAcknowledged = 0;+ linkNotice(): LinkNoticeView {+ return {+ due: this.linkNoticeDue,+ title: "We've updated how usage data works",+ body: "Cua collects usage data, like which features you use and when something goes wrong.",+ okLabel: "Got it",+ turnOffLabel: "Turn off usage data",+ detailsLabel: "What is collected",+ docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry",+ };+ }+ acknowledgeLinkNotice() {+ this.linkNoticeAcknowledged += 1;+ this.linkNoticeDue = false;+ }}diff --git a/apps/cua-spaces-desktop/test/live-telemetry.test.ts b/apps/cua-spaces-desktop/test/live-telemetry.test.tsindex b659c5c8b2..40619936bc 100644--- a/apps/cua-spaces-desktop/test/live-telemetry.test.ts+++ b/apps/cua-spaces-desktop/test/live-telemetry.test.ts@@ -39,6 +39,41 @@ function fakeNative(o: { noticeShown?: boolean; enabled?: boolean; failAck?: booconst sig = (tag: string) => ({ tag }) as never;+describe("LiveTelemetry: the one-time linking notice", () => {+ it("reads the SDK's words and whether it is due, and acknowledges through the SDK", () => {+ const acknowledged: number[] = [];+ let due = true;+ const native = {+ telemetryLinkNotice: () => ({+ title: "We've updated how usage data works",+ body: "Cua collects usage data.",+ okLabel: "Got it",+ turnOffLabel: "Turn off usage data",+ detailsLabel: "What is collected",+ docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry",+ }),+ telemetryLinkNoticeDue: () => due,+ telemetryAcknowledgeLinkNotice: () => {+ acknowledged.push(1);+ due = false;+ },+ } as unknown as Native;+ const t = new LiveTelemetry(native);+ expect(t.linkNotice()).toEqual({+ due: true,+ title: "We've updated how usage data works",+ body: "Cua collects usage data.",+ okLabel: "Got it",+ turnOffLabel: "Turn off usage data",+ detailsLabel: "What is collected",+ docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry",+ });+ t.acknowledgeLinkNotice();+ expect(acknowledged).toEqual([1]);+ expect(t.linkNotice().due).toBe(false);+ });+});+describe("LiveTelemetry before and after the first-run notice", () => {it("holds the first session's signals until the notice was seen, then sends them in order", () => {const f = fakeNative();diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swiftindex 160c95fc76..218674073f 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift@@ -121,6 +121,33 @@ public final class FixtureAgentSetup: AgentSetupRunning, @unchecked Sendable {}}+/// The one-time notice that usage data is now linked to the signed-in+/// account (CUA-1881), for machines that saw the older "anonymous" wording:+/// the SDK's words (`telemetryLinkNotice`) and whether it is due now.+public struct LinkNoticeCopy: Sendable, Equatable {+ public var due: Bool+ public var title: String+ public var body: String+ /// "Got it": keeps usage data on.+ public var okLabel: String+ /// "Turn off usage data".+ public var turnOffLabel: String+ /// The link to what is collected.+ public var detailsLabel: String+ public var docsUrl: String++ public init(due: Bool, title: String, body: String, okLabel: String, turnOffLabel: String,+ detailsLabel: String, docsUrl: String) {+ self.due = due+ self.title = title+ self.body = body+ self.okLabel = okLabel+ self.turnOffLabel = turnOffLabel+ self.detailsLabel = detailsLabel+ self.docsUrl = docsUrl+ }+}+/// The usage-telemetry switch, and where the app's usage events go.public protocol TelemetryRunning: AnyObject, Sendable {func status() -> AppTelemetryInput@@ -132,6 +159,12 @@ public protocol TelemetryRunning: AnyObject, Sendable {/// (left Welcome, finished the first run, or used the switch beside the/// note): from here usage events may be sent. Keeps the switch as it is.func acknowledgeNotice()++ /// The one-time linking notice: its words and whether it is due now.+ func linkNotice() -> LinkNoticeCopy+ /// The person closed it (either button): linking starts at the next+ /// launch, never in this process.+ func acknowledgeLinkNotice()}/// The SDK's telemetry setting (`$CUA_HOME/config.toml`, the same switch as@@ -161,6 +194,15 @@ public final class LiveTelemetry: TelemetryRunning, @unchecked Sendable {NSLog("Cua Spaces: the usage notice was not recorded: %@", LiveSpacesBackend.words(error))}}+++ public func linkNotice() -> LinkNoticeCopy {+ let n = telemetryLinkNotice()+ return LinkNoticeCopy(due: telemetryLinkNoticeDue(), title: n.title, body: n.body, okLabel: n.okLabel,+ turnOffLabel: n.turnOffLabel, detailsLabel: n.detailsLabel, docsUrl: n.docsUrl)+ }++ public func acknowledgeLinkNotice() { telemetryAcknowledgeLinkNotice() }}/// An in-memory switch (fixtures, tests).@@ -183,6 +225,21 @@ public final class FixtureTelemetry: TelemetryRunning, @unchecked Sendable {acknowledgements += 1current.noticeShown = true}++ /// Whether the one-time linking notice is due (a machine that saw the older wording).+ public var linkNoticeDue = false+ /// How many times the notice was closed.+ public private(set) var linkNoticeAcknowledged = 0+ public func linkNotice() -> LinkNoticeCopy {+ LinkNoticeCopy(due: linkNoticeDue, title: "We've updated how usage data works",+ body: "Cua collects usage data, like which features you use and when something goes wrong.",+ okLabel: "Got it", turnOffLabel: "Turn off usage data", detailsLabel: "What is collected",+ docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry")+ }+ public func acknowledgeLinkNotice() {+ linkNoticeAcknowledged += 1+ linkNoticeDue = false+ }}/// A started sign-in: the code to confirm (device flow), then the identity.diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swiftindex ef9e9d4dae..04abaea024 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift@@ -181,6 +181,17 @@ extension WebUIBridge {if !signals.isEmpty { telemetry.record(signals) }return NSNull()+ // The one-time notice that usage data is now linked to the account+ // (CUA-1881); no telemetry (a bare model) has none.+ case "telemetry.linkNotice":+ guard let telemetry = model.telemetrySink else { return NSNull() }+ let n = telemetry.linkNotice()+ return ["due": n.due, "title": n.title, "body": n.body, "okLabel": n.okLabel,+ "turnOffLabel": n.turnOffLabel, "detailsLabel": n.detailsLabel, "docsUrl": n.docsUrl] as [String: Any]+ case "telemetry.acknowledgeLinkNotice":+ model.telemetrySink?.acknowledgeLinkNotice()+ return NSNull()+// A Space's detailcase "spaces.usage":return BridgeValue.encode(await model.backend.usage(id: try spaceId(args)))diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swiftindex ab41f88866..1702716b60 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift@@ -94,7 +94,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {"devices.revoke", "devices.confirmMachine", "devices.createPairingCode", "devices.pairingCodes","devices.revokePairingCode", "teams.list", "storage.get", "storage.run","notifications.list", "notifications.markAllRead", "notifications.markRead",- "telemetry.track", "spaces.usage", "spaces.windows", "stream.pip",+ "telemetry.track", "telemetry.linkNotice", "telemetry.acknowledgeLinkNotice", "spaces.usage", "spaces.windows", "stream.pip",// A Space's thumbnail (WebUIBridge+Thumbnails.swift)."spaces.thumbnail",// A Space's drop well: Send file… and dropped files (WebUIBridge+Files.swift).diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swiftindex d565e364e8..c9a2121187 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift@@ -237,6 +237,7 @@ struct BridgeContractTests {("storage.get", [:]), ("storage.run", ["request": ["kind": "clear-cache"]]),("notifications.list", [:]), ("notifications.markRead", ["ids": ["n1"]]), ("notifications.markAllRead", [:]),("telemetry.track", ["signals": [["type": "step", "step": "app_launched", "ok": true]]]),+ ("telemetry.linkNotice", [:]), ("telemetry.acknowledgeLinkNotice", [:]),("spaces.usage", ["spaceId": space]), ("spaces.windows", ["spaceId": space]),("spaces.thumbnail", ["spaceId": space]),("spaces.droppedFiles", ["names": ["notes.txt"]]), ("spaces.chooseFiles", [:]),diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swiftindex 4a8b6469b1..576a3bf718 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift@@ -367,7 +367,7 @@ struct WebUIHostTests {@Test func everyPageOperationIsRouted() {for m in ["spaces.add", "clouds.status", "teleport.catalog", "teleport.run", "sharing.share", "volume.overview","agents.setupDriver", "about.set", "update.get", "update.install", "loginItem.set", "devices.approve", "storage.run",- "notifications.list", "telemetry.track", "spaces.windows", "stream.pip", "spaces.thumbnail", "spaces.sendFiles", "host.setUp", "host.action",+ "notifications.list", "telemetry.track", "telemetry.linkNotice", "telemetry.acknowledgeLinkNotice", "spaces.windows", "stream.pip", "spaces.thumbnail", "spaces.sendFiles", "host.setUp", "host.action","host.openSettings"] {#expect(WebUIBridge.methods.contains(m), "\(m)")}@@ -450,6 +450,27 @@ struct WebUIHostTests {#expect(telemetry.recorded.count == before + 1)}+ /// The one-time linking notice: the host's words and whether it is due,+ /// and closing it is recorded once (CUA-1881).+ @Test func theLinkNoticeIsTheHostsToShowAndAcknowledge() async throws {+ let (bridge, model) = bridge()+ let telemetry = try #require(model.telemetrySink as? FixtureTelemetry)+ let quiet = try #require(try await bridge.handle("telemetry.linkNotice", [:]) as? [String: Any])+ #expect(quiet["due"] as? Bool == false)+ telemetry.linkNoticeDue = true+ let due = try #require(try await bridge.handle("telemetry.linkNotice", [:]) as? [String: Any])+ #expect(due["due"] as? Bool == true)+ #expect(due["title"] as? String == "We've updated how usage data works")+ #expect(due["okLabel"] as? String == "Got it")+ #expect(due["turnOffLabel"] as? String == "Turn off usage data")+ #expect(due["detailsLabel"] as? String == "What is collected")+ #expect(due["docsUrl"] as? String == "https://cua.ai/docs/cua-sdk/concepts/telemetry")+ _ = try await bridge.handle("telemetry.acknowledgeLinkNotice", [:])+ #expect(telemetry.linkNoticeAcknowledged == 1)+ let after = try #require(try await bridge.handle("telemetry.linkNotice", [:]) as? [String: Any])+ #expect(after["due"] as? Bool == false)+ }+@Test func pagesWithoutTheirServiceSayUnsupported() async {let (bridge, _) = bridge()#expect(await failure(bridge, "volume.overview", [:]) == "unsupported")diff --git a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx b/apps/cua-spaces-web/src/__tests__/first-run.test.tsxindex 3e4ddc0c6c..9417282ff1 100644--- a/apps/cua-spaces-web/src/__tests__/first-run.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/first-run.test.tsx@@ -70,6 +70,24 @@ describe.skipIf(!wasmBuilt)("the first run (real route, wasm core)", () => {expect(document.body.textContent).not.toMatch(/\bVM\b|virtual machine|container|daemon|MCP/i);});+ it("says in plain words that usage data is on and linked to the account, and turns it off with one tap", async () => {+ const calls = await mount();+ await waitFor(() => expect(heading()).toBe("A shared Space for every agent."));+ const note = await waitFor(() => {+ const n = document.querySelector("[data-first-run-usage]");+ expect(n).toBeTruthy();+ return n!;+ });+ expect(note.textContent).toMatch(/linked to your account through a random ID/);+ expect(note.textContent).toMatch(/Never your files, what you type or your screen/);+ expect(note.textContent).not.toMatch(/SPACES_CP_LINK_USAGE|telemetry|opaque/i);+ expect(note.textContent).toMatch(/Share usage data to help improve Cua/);+ const sw = note.querySelector<HTMLElement>('[role="switch"]')!;+ expect(sw.getAttribute("aria-checked")).toBe("true");+ fireEvent.click(sw);+ await waitFor(() => expect(calls.some((c) => /telemetry|settings/.test(c.op))).toBe(true));+ });+it("makes the extra Space in the background, asks the host to notify, and keeps Done on", async () => {writeFirstRun({ step: "setup", agent: "claude-code", setupStartedMs: Date.now() });const calls = await mount({ local: (l) => ({ ...l, backends: ["docker"], macosImage: null, hostArch: "amd64" }) });diff --git a/apps/cua-spaces-web/src/__tests__/native-parity.test.tsx b/apps/cua-spaces-web/src/__tests__/native-parity.test.tsxindex bf94fa0da4..2554581230 100644--- a/apps/cua-spaces-web/src/__tests__/native-parity.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/native-parity.test.tsx@@ -93,7 +93,7 @@ describe.skipIf(!wasmBuilt)("as the SwiftUI app (real routes, wasm core)", () =>expect(document.body.textContent).not.toContain("waitlist");expect(within(teams).getByText("Manage team")).toBeTruthy();const note = document.querySelector<HTMLElement>('[data-setting-row="telemetry-note"]')!;- expect(note.textContent).toMatch(/^Features used, sandbox types, durations and error categories/);+ expect(note.textContent).toMatch(/^Which features you use and when something goes wrong\./);expect(within(note).getByText("What is collected")).toBeTruthy();expect(document.body.textContent).not.toContain("Crash reports and feature counts");// Manage team opens the account app in the browser.diff --git a/apps/cua-spaces-web/src/__tests__/usage-link-notice.test.tsx b/apps/cua-spaces-web/src/__tests__/usage-link-notice.test.tsxnew file mode 100644index 0000000000..4cac68f8e5--- /dev/null+++ b/apps/cua-spaces-web/src/__tests__/usage-link-notice.test.tsx@@ -0,0 +1,167 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++// The one-time linking notice (CUA-1881): shown once when the host says it is+// due, closed only by its two buttons, and "Turn off usage data" turns the+// switch off through the Settings path before it acknowledges.++import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";++import { createDemoAdapter } from "@/bridge/adapters/demo";+import { wasmBuilt } from "@/bridge/__tests__/testCore";+import { unavailableCore } from "@/bridge/core";+import { BridgeProvider, TURN_OFF_FAILED, type DataAdapter, type TelemetryLinkNotice } from "@/bridge";+import { UsageLinkNotice } from "@/components/usage-link-notice";+import { mountApp, stubBrowserApis } from "./app-harness";++afterEach(cleanup);+stubBrowserApis();++const NOTICE: TelemetryLinkNotice = {+ due: true,+ title: "We've updated how usage data works",+ body: "Cua collects usage data, like which features you use and when something goes wrong. Until now, it wasn't connected to your account.",+ okLabel: "Got it",+ turnOffLabel: "Turn off usage data",+ detailsLabel: "What is collected",+ docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry",+};++/** The demo host with a linking notice: what it was asked, in order. */+function hostWith(notice: TelemetryLinkNotice | null, options: { failsTurnOff?: boolean } = {}) {+ const demo = createDemoAdapter({ latencyMs: 0 });+ const calls: Array<[string, unknown]> = [];+ const adapter: DataAdapter = {+ mode: demo.mode,+ subscribe: demo.subscribe,+ call: (async (op: string, args: never) => {+ calls.push([op, args]);+ if (op === "telemetry.linkNotice") return notice;+ if (op === "telemetry.acknowledgeLinkNotice") return null;+ if (op === "settings.set" && options.failsTurnOff) throw new Error("config is read-only");+ return demo.call(op as never, args);+ }) as DataAdapter["call"],+ dispose: demo.dispose,+ };+ return { adapter, calls, demo };+}++function mount(adapter: DataAdapter) {+ return render(+ <BridgeProvider adapter={adapter} core={unavailableCore("test: no core")}>+ <UsageLinkNotice />+ </BridgeProvider>,+ );+}++const ops = (calls: Array<[string, unknown]>) => calls.map(([op]) => op);++describe("the one-time usage-data linking notice", () => {+ it("shows the host's words with a link to what is collected when it is due", async () => {+ const { adapter } = hostWith(NOTICE);+ mount(adapter);+ expect(await screen.findByText(NOTICE.title)).toBeTruthy();+ expect(screen.getByText(NOTICE.body)).toBeTruthy();+ expect(screen.getByRole("button", { name: NOTICE.okLabel })).toBeTruthy();+ expect(screen.getByRole("button", { name: NOTICE.turnOffLabel })).toBeTruthy();+ expect(screen.getByRole("button", { name: NOTICE.detailsLabel })).toBeTruthy();+ });++ it("is not shown when it is not due, when the host has none, or when it cannot say", async () => {+ for (const notice of [{ ...NOTICE, due: false }, null]) {+ const { adapter, calls } = hostWith(notice);+ const view = mount(adapter);+ await waitFor(() => expect(ops(calls)).toContain("telemetry.linkNotice"));+ expect(screen.queryByText(NOTICE.title)).toBeNull();+ view.unmount();+ }+ const demo = createDemoAdapter({ latencyMs: 0 });+ const failing = { ...demo, call: (async (op: string, args: never) => {+ if (op === "telemetry.linkNotice") throw new Error("host is busy");+ return demo.call(op as never, args);+ }) as DataAdapter["call"], subscribe: demo.subscribe } as DataAdapter;+ mount(failing);+ await new Promise((r) => setTimeout(r, 20));+ expect(screen.queryByText(NOTICE.title)).toBeNull();+ });++ it("the demo host has no notice", async () => {+ const demo = createDemoAdapter({ latencyMs: 0 });+ expect(await demo.call("telemetry.linkNotice", {})).toBeNull();+ expect(await demo.call("telemetry.acknowledgeLinkNotice", {})).toBeNull();+ demo.dispose?.();+ });++ it("Got it acknowledges and closes it, leaving usage data on", async () => {+ const { adapter, calls, demo } = hostWith(NOTICE);+ mount(adapter);+ fireEvent.click(await screen.findByRole("button", { name: NOTICE.okLabel }));+ await waitFor(() => expect(screen.queryByText(NOTICE.title)).toBeNull());+ expect(ops(calls)).toContain("telemetry.acknowledgeLinkNotice");+ expect(calls.some(([op]) => op === "settings.set")).toBe(false);+ expect((await demo.call("settings.get", {})).values.telemetry).toBe(true);+ });++ it("Turn off usage data turns it off through settings, then acknowledges and closes", async () => {+ const { adapter, calls, demo } = hostWith(NOTICE);+ mount(adapter);+ fireEvent.click(await screen.findByRole("button", { name: NOTICE.turnOffLabel }));+ await waitFor(() => expect(screen.queryByText(NOTICE.title)).toBeNull());+ const set = calls.findIndex(([op]) => op === "settings.set");+ const ack = calls.findIndex(([op]) => op === "telemetry.acknowledgeLinkNotice");+ expect(calls[set]).toEqual(["settings.set", { key: "telemetry", value: false }]);+ expect(ack).toBeGreaterThan(set);+ expect((await demo.call("settings.get", {})).values.telemetry).toBe(false);+ });++ it("stays up, without acknowledging, when usage data could not be turned off", async () => {+ const { adapter, calls } = hostWith(NOTICE, { failsTurnOff: true });+ mount(adapter);+ fireEvent.click(await screen.findByRole("button", { name: NOTICE.turnOffLabel }));+ expect((await screen.findByRole("alert")).textContent).toBe(TURN_OFF_FAILED);+ expect(screen.getByText(NOTICE.title)).toBeTruthy();+ expect(ops(calls)).not.toContain("telemetry.acknowledgeLinkNotice");+ });++ it("Escape does not close it: only the two buttons are a choice", async () => {+ const { adapter, calls } = hostWith(NOTICE);+ mount(adapter);+ await screen.findByText(NOTICE.title);+ fireEvent.keyDown(document.activeElement ?? document.body, { key: "Escape" });+ await new Promise((r) => setTimeout(r, 30));+ expect(screen.getByText(NOTICE.title)).toBeTruthy();+ expect(ops(calls)).not.toContain("telemetry.acknowledgeLinkNotice");+ });+});++describe.skipIf(!wasmBuilt)("the notice in the app shell (real routes, wasm core)", () => {+ const due = (asked: string[]) => ({+ failsCreates: false,+ listsGhost: false,+ intercept: (op: string) => {+ asked.push(op);+ if (op === "telemetry.linkNotice") return NOTICE;+ if (op === "telemetry.acknowledgeLinkNotice") return null;+ return undefined;+ },+ });++ it("shows over the app when the host says it is due, and Got it closes it", async () => {+ const asked: string[] = [];+ const { router } = await mountApp("/", due(asked));+ await router.load();+ fireEvent.click(await screen.findByRole("button", { name: NOTICE.okLabel }));+ await waitFor(() => expect(screen.queryByText(NOTICE.title)).toBeNull());+ expect(asked).toContain("telemetry.acknowledgeLinkNotice");+ });++ it("does not interrupt the first run", async () => {+ const asked: string[] = [];+ const { router } = await mountApp("/onboarding", due(asked));+ await router.load();+ await new Promise((r) => setTimeout(r, 100));+ expect(screen.queryByText(NOTICE.title)).toBeNull();+ expect(asked).not.toContain("telemetry.linkNotice");+ });+});diff --git a/apps/cua-spaces-web/src/bridge/README.md b/apps/cua-spaces-web/src/bridge/README.mdindex fd81cba2e5..d19fdb8570 100644--- a/apps/cua-spaces-web/src/bridge/README.md+++ b/apps/cua-spaces-web/src/bridge/README.md@@ -465,6 +465,8 @@ something the native apps already do; nothing is a new mechanism.| Operation | Args | Result | Tauri | SwiftUI (`WebUIBridge+Pages.swift`) ||---|---|---|---|---|| `telemetry.track` | `{ signals }` | `null` | `telemetry_record_signals` | `model.telemetrySink?.record(signals)` (`appTelemetryRecord`), only while `status().enabled`; each signal checked again |+| `telemetry.linkNotice` | `{}` | `{ due, title, body, okLabel, turnOffLabel, detailsLabel, docsUrl } \| null` | `telemetry_link_notice` | `model.telemetrySink?.linkNotice()` (`telemetryLinkNotice`, `telemetryLinkNoticeDue`); the one-time notice that usage data is now linked to the account (CUA-1881). The page shows it only while `due`. The demo host has none |+| `telemetry.acknowledgeLinkNotice` | `{}` | `null` | `telemetry_acknowledge_link_notice` | `model.telemetrySink?.acknowledgeLinkNotice()` (`telemetryAcknowledgeLinkNotice`); either button. "Turn off usage data" first sets `telemetry` off through `updateSetting` || `spaces.usage` | `{ spaceId }` | `SpaceUsage \| null` | `space_usage` | `backend.usage(id:)` || `spaces.windows` | `{ spaceId }` | `{ windows, display, open }` (`open`: the rows whose picture in picture is open) | none (the viewer lists windows over its own stream) | `StreamRowsModel` over `backend.streamProvider(id:)` || `stream.pip` | `{ spaceId, command: { type: "open" \| "close", row } }` | open row ids | none (its PiP is a viewer window) | a `StreamPiPSet` per Space, as the detail view keeps |diff --git a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.tsindex f5a5167e98..34835a4446 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts@@ -131,6 +131,8 @@ export const DEMO_ARGS: { [K in OpName]: OpArgs<K> } = {"notifications.markAllRead": {},"notifications.markRead": { ids: ["n1"] },"telemetry.track": { signals: [{ type: "step", step: "app_launched", ok: true }] },+ "telemetry.linkNotice": {},+ "telemetry.acknowledgeLinkNotice": {},"spaces.usage": { spaceId: SPACE },"spaces.windows": { spaceId: SPACE },"stream.pip": { spaceId: SPACE, command: { type: "open", row: "desktop" } },diff --git a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.tsindex 9a5a1ec57f..146ff99b18 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts@@ -114,6 +114,8 @@ const ARGS: { [K in OpName]: OpArgs<K> } = {"notifications.markAllRead": {},"notifications.markRead": { ids: ["n1"] },"telemetry.track": { signals: [{ type: "step", step: "app_launched", ok: true }] },+ "telemetry.linkNotice": {},+ "telemetry.acknowledgeLinkNotice": {},"spaces.usage": { spaceId: "s1" },"spaces.windows": { spaceId: "s1" },"stream.pip": { spaceId: "s1", command: { type: "open", row: "desktop" } },diff --git a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.tsindex ddf2ead049..3c79b85cd9 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts@@ -48,6 +48,22 @@ function tauriHost(answers: Record<string, unknown> = {}, withEvents = true) {return { win, calls, listeners, invoke };}+describe("tauri adapter: the one-time linking notice", () => {+ it("reads the notice from telemetry_link_notice and acknowledges with telemetry_acknowledge_link_notice", async () => {+ const notice = { due: true, title: "We've updated how usage data works", body: "b", okLabel: "Got it", turnOffLabel: "Turn off usage data", detailsLabel: "What is collected", docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry" };+ const { win, calls } = tauriHost({ telemetry_link_notice: notice });+ const a = createTauriAdapter(win);+ expect(await a.call("telemetry.linkNotice", {})).toEqual(notice);+ expect(await a.call("telemetry.acknowledgeLinkNotice", {})).toBeNull();+ expect(calls.map(([c]) => c)).toEqual(["telemetry_link_notice", "telemetry_acknowledge_link_notice"]);+ });++ it("a command that answers nothing (an older shell) reads as no notice", async () => {+ const { win } = tauriHost();+ expect(await createTauriAdapter(win).call("telemetry.linkNotice", {})).toBeNull();+ });+});+describe("tauri adapter", () => {it("maps operations onto the existing invoke commands", async () => {const { win, calls } = tauriHost({ list_spaces: [], keyvault_set_unattended: [], set_space_power: {} });@@ -928,6 +944,22 @@ describe("webkit adapter", () => {expect(sent).toHaveLength(1);});+ it("asks the host for the one-time linking notice and sends the acknowledgement; no answer reads as none", async () => {+ const notice = { due: true, title: "We've updated how usage data works", body: "b", okLabel: "Got it", turnOffLabel: "Turn off usage data", detailsLabel: "What is collected", docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry" };+ const { win, sent } = webkitHost((req) => (req.method === "telemetry.linkNotice" ? ok(notice) : ok(null)));+ const a = createWebkitAdapter(win);+ expect(await a.call("telemetry.linkNotice", {})).toEqual(notice);+ expect(await a.call("telemetry.acknowledgeLinkNotice", {})).toBeNull();+ expect(sent.map((r) => [r.method, r.args])).toEqual([+ ["telemetry.linkNotice", {}],+ ["telemetry.acknowledgeLinkNotice", {}],+ ]);+ const older = webkitHost(() => ({ ok: false, error: { code: "unimplemented", message: "telemetry.linkNotice is not available in this host" } }));+ expect(await createWebkitAdapter(older.win).call("telemetry.linkNotice", {})).toBeNull();+ const odd = webkitHost(() => ok({ due: true, title: "", body: 3 }));+ expect(await createWebkitAdapter(odd.win).call("telemetry.linkNotice", {})).toBeNull();+ });+it("runs New Space on the app's env and create, with its progress", async () => {vi.useFakeTimers();try {diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo-data.ts b/apps/cua-spaces-web/src/bridge/adapters/demo-data.tsindex b3ab5af87c..f5b80fe699 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo-data.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo-data.ts@@ -232,7 +232,7 @@ export function demoTelemetry(enabled: boolean): TelemetryView {source: "config ~/.cua/config.toml",sourceKind: "config",noticeShown: true,- noticeText: "Cua sends anonymous usage data to improve the app. No content, names or addresses.",+ noticeText: "Cua collects usage data, like which features you use and when something goes wrong. When you're signed in, it's linked to your account through a random ID. Never your files, what you type or your screen.",docsUrl: "https://cua.ai/docs/cua-sdk/concepts/telemetry",};}diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/telemetry.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/telemetry.tsindex 5a5a20d8b8..240a725dd8 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo/telemetry.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/telemetry.ts@@ -2,7 +2,8 @@// Copyright (c) 2026 Cua AI, Inc./** The demo host's telemetry: the events it was sent, kept in memory, and- * only while its usage-data setting is on (as the SDK's client drops them). */+ * only while its usage-data setting is on (as the SDK's client drops them).+ * It links nothing to an account, so it has no linking notice. */import type { TelemetrySignal } from "../../ops/telemetry";import type { DemoContext, DemoHandlers } from "./context";@@ -14,11 +15,13 @@ export interface DemoTelemetryState {export const demoTelemetryState = (): DemoTelemetryState => ({ telemetry: [] });-export function demoTelemetryHandlers({ state }: DemoContext): DemoHandlers<"telemetry.track"> {+export function demoTelemetryHandlers({ state }: DemoContext): DemoHandlers<"telemetry.track" | "telemetry.linkNotice" | "telemetry.acknowledgeLinkNotice"> {return {"telemetry.track": ({ signals }) => {if (state.settings.telemetry) state.telemetry.push(...signals);return null;},+ "telemetry.linkNotice": () => null,+ "telemetry.acknowledgeLinkNotice": () => null,};}diff --git a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts b/apps/cua-spaces-web/src/bridge/adapters/webkit.tsindex 6c34807a50..ef2c2d72a3 100644--- a/apps/cua-spaces-web/src/bridge/adapters/webkit.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/webkit.ts@@ -56,6 +56,7 @@ import { webkitKeyvaultManageOps } from "../ops/keyvault-manage";import { webkitKeyvaultSetupOps } from "../ops/keyvault-setup";import { webkitSettingsOps } from "../ops/settings";import { startupFromHost, webkitStartupOps } from "../ops/startup";+import { webkitTelemetryNoticeOps } from "../ops/telemetry";import { unsupportedStreamOps, type StreamTicket } from "../ops/stream";import type { RelayUsage } from "../ops/relay-usage";import type { RiskyRequest } from "../ops/nudges";@@ -635,6 +636,7 @@ export function createWebkitAdapter(...webkitSettingsOps(request),...webkitPageOps(request, toHostStatus, spaceToRow),...webkitStartupOps(request),+ ...webkitTelemetryNoticeOps(request),...webkitAgentDetailOps(request),...webkitAgentKeysOps(request),...webkitKeyvaultManageOps(request, toKeyvaultOverview as (wk: never) => KeyvaultOverview),diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.jsonindex ea13c57b5b..e604387bd2 100644--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json@@ -2866,6 +2866,41 @@"currentTeamId"]},+ "TelemetryLinkNotice": {+ "type": "object",+ "properties": {+ "due": {+ "type": "boolean"+ },+ "title": {+ "type": "string"+ },+ "body": {+ "type": "string"+ },+ "okLabel": {+ "type": "string"+ },+ "turnOffLabel": {+ "type": "string"+ },+ "detailsLabel": {+ "type": "string"+ },+ "docsUrl": {+ "type": "string"+ }+ },+ "required": [+ "due",+ "title",+ "body",+ "okLabel",+ "turnOffLabel",+ "detailsLabel",+ "docsUrl"+ ]+ },"UpdateState": {"type": "object","properties": {@@ -5354,6 +5389,19 @@"teams.list": {"$ref": "#/$defs/TeamsList"},+ "telemetry.acknowledgeLinkNotice": {+ "type": "null"+ },+ "telemetry.linkNotice": {+ "anyOf": [+ {+ "$ref": "#/$defs/TelemetryLinkNotice"+ },+ {+ "type": "null"+ }+ ]+ },"telemetry.track": {"type": "null"},@@ -6851,6 +6899,19 @@"teams.list": {"$ref": "#/$defs/TeamsList"},+ "telemetry.acknowledgeLinkNotice": {+ "type": "null"+ },+ "telemetry.linkNotice": {+ "anyOf": [+ {+ "$ref": "#/$defs/TelemetryLinkNotice"+ },+ {+ "type": "null"+ }+ ]+ },"telemetry.track": {"type": "null"},diff --git a/apps/cua-spaces-web/src/bridge/contracts/onboarding.ts b/apps/cua-spaces-web/src/bridge/contracts/onboarding.tsindex cbdefcd6b8..d4d637f29a 100644--- a/apps/cua-spaces-web/src/bridge/contracts/onboarding.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/onboarding.ts@@ -123,7 +123,7 @@ export interface PresentationCard {selected: boolean;}-/** Welcome's "Share anonymous usage data" switch. */+/** Welcome's "Share usage data to help improve Cua" switch. */export interface OnboardingUsage {label: string;on: boolean;diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.tsindex f2bbed4169..d782d0d521 100644--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts@@ -58,6 +58,7 @@ import type { SpaceProgress, SpaceRow } from "./spaces";import type { CatalogEntry, ConsentItem, KvDomainCount, KvInventory, OpenWindow, PlanStep, RemoteWindow, RunReport, TeleportPlan } from "./teleport";import type { AgentSetupOutcome, DriveGrantInput, DriveMountInput, DriveRequestInput, Experiments, VolumeOverview } from "./volume";import type { AgentKeysReport } from "../ops/agent-keys";+import type { TelemetryLinkNotice } from "../ops/telemetry";import type { SentFileInfo, SpaceThumbnail, SpaceUsage, SpaceWindows } from "../ops/space-detail";import type { RelayUsage } from "../ops/relay-usage";import type { RiskyRequest } from "../ops/nudges";@@ -434,6 +435,19 @@ const StartupShape = ref(}),);+const LinkNoticeShape = ref(+ "TelemetryLinkNotice",+ obj<TelemetryLinkNotice>()({+ due: bool,+ title: str,+ body: str,+ okLabel: str,+ turnOffLabel: str,+ detailsLabel: str,+ docsUrl: str,+ }),+);+/* ---- New Space ------------------------------------------------------------- */const StorageVolumeShape = obj<StorageVolume>()({ availableBytes: num, totalBytes: num, name: str });@@ -947,6 +961,8 @@ export const OP_SHAPES: Record<OpName, Schema> = {"notifications.markRead": nul,"telemetry.track": nul,+ "telemetry.linkNotice": nullable(LinkNoticeShape),+ "telemetry.acknowledgeLinkNotice": nul,"spaces.usage": nullable(obj<SpaceUsage>()({ memoryUsed: num, memoryTotal: num, memoryLimited: bool, diskUsed: num, diskTotal: num, diskLimited: bool }),),@@ -1262,6 +1278,8 @@ export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {"notifications.markAllRead": nul,"notifications.markRead": nul,"telemetry.track": nul,+ "telemetry.linkNotice": nullable(LinkNoticeShape),+ "telemetry.acknowledgeLinkNotice": nul,"spaces.usage": OP_SHAPES["spaces.usage"],"spaces.windows": OP_SHAPES["spaces.windows"],"stream.pip": strings,diff --git a/apps/cua-spaces-web/src/bridge/first-run.ts b/apps/cua-spaces-web/src/bridge/first-run.tsindex fe800bf24b..6e722143db 100644--- a/apps/cua-spaces-web/src/bridge/first-run.ts+++ b/apps/cua-spaces-web/src/bridge/first-run.ts@@ -42,7 +42,7 @@ import type {import { useSession, useSettings, useSpaces } from "./hooks";import { hostOs } from "./host-os";import { useFirstSpaceOffers } from "./new-space-hooks";-import { onboardingInitial, onboardingTelemetry, readSavedOnboarding, writeSavedOnboarding } from "./onboarding";+import { onboardingInitial, onboardingTelemetry, onboardingView, readSavedOnboarding, writeSavedOnboarding } from "./onboarding";import type { OnboardingFlowState } from "./contracts/onboarding";import { useRelayUsage } from "./relay-usage";import { newPendingId } from "./store";@@ -255,8 +255,25 @@ function track(send: () => void): void {/** How often the setup screen reads the agent setup and this computer. */export const FIRST_RUN_POLL_MS = 2_500;+/** The usage-data note and switch on the first page: the words are the app core's+ * (the old Welcome's), on by default, off with one tap. */+export interface FirstRunUsage {+ notice: string;+ linkLabel: string;+ linkUrl: string;+ label: string;+ on: boolean;+ enabled: boolean;+ help: string | null;+}+export interface FirstRunHook {view: FirstRunView;+ /** The usage-data note and switch (first page only; none until the host says what the setting is). */+ usage: FirstRunUsage | null;+ setUsage(on: boolean): Promise<void>;+ /** "What is collected". */+ openUsageLink(): void;input: FirstRunInput;saved: FirstRunSaved;/** Every agent the setup knows (for "Other"). */@@ -410,6 +427,22 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRun};const view = firstRunView(core, input);+ const welcome = settings.data?.telemetry+ ? onboardingView(core, { ...onboardingInitial(core, null), step: "welcome", telemetry: onboardingTelemetry(settings.data.telemetry) })+ : null;+ const usageNote: FirstRunUsage | null =+ s.step === "connect" && welcome?.usage && welcome.notice && welcome.noticeLinkLabel && welcome.noticeLinkUrl+ ? {+ notice: welcome.notice,+ linkLabel: welcome.noticeLinkLabel,+ linkUrl: welcome.noticeLinkUrl,+ label: welcome.usage.label,+ on: welcome.usage.on,+ enabled: welcome.usage.enabled,+ help: welcome.usage.help ?? null,+ }+ : null;+// The run starts (once a page shows): the usage event the old Welcome sent.useEffect(() => {const t = settings.data?.telemetry;@@ -496,6 +529,11 @@ export function useFirstRun(active = true, pollMs = FIRST_RUN_POLL_MS): FirstRunreturn {view,+ usage: usageNote,+ setUsage: (on) => settings.updateSetting("telemetry", on),+ openUsageLink: () => {+ if (usageNote) void session.openExternal(usageNote.linkUrl).catch(() => {});+ },input,saved: s,agents: agents ?? [],diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.tsindex e7b9e702fb..7f2370331e 100644--- a/apps/cua-spaces-web/src/bridge/index.ts+++ b/apps/cua-spaces-web/src/bridge/index.ts@@ -116,6 +116,8 @@ export { useThisMachine, type HostFailure, type HostFormView as HostSetupFormVieexport type { HostFormAction, HostSetupRequest } from "./ops/host-setup";export type { TelemetrySignal } from "./ops/telemetry";export { useStartup, type StartupHook } from "./startup";+export { useLinkNotice, TURN_OFF_FAILED, type LinkNoticeHook } from "./link-notice";+export type { TelemetryLinkNotice } from "./ops/telemetry";export { defaultTeam, eligibleTeams, teamName, useTeamChoices, type TeamChoices } from "./teams";export { joinFailureText, useJoinWithCode, type JoinHook, type JoinPhase } from "./join";export { displayPairingCode, normalizePairingCode, pairingLinkRelay } from "./pairing-code";@@ -178,6 +180,7 @@ export {useFirstRunSaved,writeFirstRun,type FirstRunHook,+ type FirstRunUsage,type FirstRunSaved,} from "./first-run";export type * from "./contracts/first-run";diff --git a/apps/cua-spaces-web/src/bridge/link-notice.ts b/apps/cua-spaces-web/src/bridge/link-notice.tsnew file mode 100644index 0000000000..c0ba307ddf--- /dev/null+++ b/apps/cua-spaces-web/src/bridge/link-notice.ts@@ -0,0 +1,96 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++/**+ * `useLinkNotice()`: the one-time notice for machines that saw the older+ * "anonymous" usage-data wording (CUA-1881). Usage data is linked to the+ * signed-in account through a random ID, and nothing links before the person+ * closes this notice. The host says whether it is due and owns the words+ * (`telemetry.linkNotice`); both buttons close it+ * (`telemetry.acknowledgeLinkNotice`), and "Turn off usage data" turns the+ * switch off first, through the same path as Settings.+ *+ * Reads the adapter directly, so a host without the operation, or a failed+ * read, shows nothing (and the host links nothing either).+ */++import { useCallback, useContext, useEffect, useState } from "react";+import { BridgeContext } from "./BridgeProvider";+import { useSettings } from "./hooks";+import type { TelemetryLinkNotice } from "./ops/telemetry";++export interface LinkNoticeHook {+ /** The notice while it is due and not closed yet; null otherwise. */+ notice: TelemetryLinkNotice | null;+ /** A button is working (the notice stays up until it finishes). */+ busy: boolean;+ /** "Turn off usage data" could not turn it off: the notice stays up. */+ error: string | null;+ /** "Got it": usage data stays on. */+ keep(): Promise<void>;+ /** "Turn off usage data": turns it off, then closes. */+ turnOff(): Promise<void>;+}++export const TURN_OFF_FAILED = "Couldn't turn off usage data. Try again, or change it in Settings, Privacy.";++export function useLinkNotice(): LinkNoticeHook {+ const ctx = useContext(BridgeContext);+ if (!ctx) throw new Error("bridge hooks need a <BridgeProvider> above them");+ const { adapter } = ctx;+ const { updateSetting } = useSettings();+ const [notice, setNotice] = useState<TelemetryLinkNotice | null>(null);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState<string | null>(null);++ useEffect(() => {+ if (!adapter) return;+ let live = true;+ void adapter.call("telemetry.linkNotice", {}).then(+ (n) => live && setNotice(n?.due ? n : null),+ () => undefined,+ );+ return () => {+ live = false;+ };+ }, [adapter]);++ // Closing never fails the person: a host that could not record it asks again next launch.+ const close = useCallback(async () => {+ try {+ await adapter?.call("telemetry.acknowledgeLinkNotice", {});+ } catch {+ /* asked again at the next launch */+ }+ setNotice(null);+ }, [adapter]);++ const keep = useCallback(async () => {+ setBusy(true);+ try {+ await close();+ } finally {+ setBusy(false);+ }+ }, [close]);++ const turnOff = useCallback(async () => {+ setBusy(true);+ setError(null);+ try {+ await updateSetting("telemetry", false);+ } catch {+ // Still on: closing now would link what the person just said no to.+ setError(TURN_OFF_FAILED);+ setBusy(false);+ return;+ }+ try {+ await close();+ } finally {+ setBusy(false);+ }+ }, [updateSetting, close]);++ return { notice, busy, error, keep, turnOff };+}diff --git a/apps/cua-spaces-web/src/bridge/onboarding.ts b/apps/cua-spaces-web/src/bridge/onboarding.tsindex 573819f776..e468a701a4 100644--- a/apps/cua-spaces-web/src/bridge/onboarding.ts+++ b/apps/cua-spaces-web/src/bridge/onboarding.ts@@ -319,13 +319,13 @@ function fallbackView(s: OnboardingFlowState, os: HostOs): OnboardingView {{ menuBar: true, title: "Menu bar only", id: "onboarding-menu-bar", imageLabel: "The menu bar menu alone", selected: s.menuBar },]: [],- notice: s.step === "welcome" ? "Cua collects anonymous usage data. Change it here or in Settings, Privacy." : null,+ notice: s.step === "welcome" ? "Cua collects usage data, like which features you use and when something goes wrong. When you're signed in, it's linked to your account through a random ID. Never your files, what you type or your screen. Change this here or in Settings, Privacy." : null,noticeLinkLabel: s.step === "welcome" ? "What is collected" : null,noticeLinkUrl: s.step === "welcome" ? "https://cua.ai/docs/cua-sdk/concepts/telemetry" : null,usage:s.step === "welcome"? {- label: "Share anonymous usage data",+ label: "Share usage data to help improve Cua",on: s.telemetry?.enabled ?? true,enabled: !locked,help: locked ? `Set by ${locked}` : null,diff --git a/apps/cua-spaces-web/src/bridge/ops/telemetry.ts b/apps/cua-spaces-web/src/bridge/ops/telemetry.tsindex 14411a6c33..073a9ad3fa 100644--- a/apps/cua-spaces-web/src/bridge/ops/telemetry.ts+++ b/apps/cua-spaces-web/src/bridge/ops/telemetry.ts@@ -12,6 +12,18 @@* - SwiftUI: `telemetry.track`, which checks the switch, then records* through `TelemetryRunning.record` (`appTelemetryRecord`).* - Electron: the same method, recorded the same way.+ *+ * `telemetry.linkNotice` and `telemetry.acknowledgeLinkNotice`: the one-time+ * notice for machines that saw the older "anonymous" wording (CUA-1881).+ * Usage data is linked to the signed-in account through a random ID, and+ * nothing links before this notice is closed. The host owns whether it is+ * due and the words (`cua_telemetry::link`), so every shell says the same.+ *+ * - Tauri: `telemetry_link_notice`, `telemetry_acknowledge_link_notice`.+ * - SwiftUI and Electron: the same method names, answered from the SDK's+ * `telemetryLinkNotice`, `telemetryLinkNoticeDue` and+ * `telemetryAcknowledgeLinkNotice`.+ * - Demo: no notice (`null`).*/import type { OpCoverage } from "../coverage";@@ -45,10 +57,54 @@ export type TelemetrySignal =| { type: "experiment"; action: string; experiment: string }| { type: "experiments-on"; experiments: string[] };+/** The one-time linking notice: the host's words, and whether it is due now. */+export interface TelemetryLinkNotice {+ /** Show it now: usage data is on, the account offered linking, and this+ * machine has not shown it. */+ due: boolean;+ title: string;+ body: string;+ /** "Got it": keeps usage data on. */+ okLabel: string;+ /** "Turn off usage data". */+ turnOffLabel: string;+ /** The link to what is collected. */+ detailsLabel: string;+ docsUrl: string;+}+export interface TelemetryOps {/** Records the signals on the host's telemetry, which drops them while* usage data is off or before the first-run notice. */"telemetry.track": { args: { signals: TelemetrySignal[] }; result: null };+ /** The one-time linking notice, or null when the host has none. */+ "telemetry.linkNotice": { args: Record<string, never>; result: TelemetryLinkNotice | null };+ /** The notice was closed (either button): linking may start at the next launch. */+ "telemetry.acknowledgeLinkNotice": { args: Record<string, never>; result: null };+}++export const TELEMETRY_OPERATIONS = [+ "telemetry.track",+ "telemetry.linkNotice",+ "telemetry.acknowledgeLinkNotice",+] as const satisfies readonly (keyof TelemetryOps)[];++const text = (v: unknown): v is string => typeof v === "string" && v.length > 0;++/** A host's answer as a notice; anything malformed reads as none. */+export function linkNoticeFromHost(raw: unknown): TelemetryLinkNotice | null {+ const n = raw as Partial<TelemetryLinkNotice> | null | undefined;+ if (!n || typeof n !== "object") return null;+ if (!text(n.title) || !text(n.body) || !text(n.okLabel) || !text(n.turnOffLabel) || !text(n.detailsLabel) || !text(n.docsUrl)) return null;+ return {+ due: n.due === true,+ title: n.title,+ body: n.body,+ okLabel: n.okLabel,+ turnOffLabel: n.turnOffLabel,+ detailsLabel: n.detailsLabel,+ docsUrl: n.docsUrl,+ };}@@ -143,6 +199,29 @@ export function tauriTelemetryOps(invoke: Invoke) {await invoke("telemetry_record_signals", { signals });return null;},+ "telemetry.linkNotice": async () => linkNoticeFromHost(await invoke("telemetry_link_notice")),+ "telemetry.acknowledgeLinkNotice": async () => {+ await invoke("telemetry_acknowledge_link_notice");+ return null;+ },+ };+}++type WebkitRequest = <T>(+ method: "telemetry.linkNotice" | "telemetry.acknowledgeLinkNotice",+ args?: Record<string, unknown>,+ wait?: number | null,+) => Promise<T>;++/** SwiftUI and Electron: both methods go to the host. An older build+ * (`unimplemented`) or any failure reads as no notice, so nothing links. */+export function webkitTelemetryNoticeOps(request: WebkitRequest) {+ return {+ "telemetry.linkNotice": () => request<unknown>("telemetry.linkNotice", {}, 5_000).then(linkNoticeFromHost, () => null),+ "telemetry.acknowledgeLinkNotice": async () => {+ await request("telemetry.acknowledgeLinkNotice", {});+ return null;+ },};}@@ -151,4 +230,12 @@ export const TELEMETRY_COVERAGE = {webkit: { methods: ["telemetry.track"] },tauri: ["telemetry_record_signals"],},+ "telemetry.linkNotice": {+ webkit: { methods: ["telemetry.linkNotice"] },+ tauri: ["telemetry_link_notice"],+ },+ "telemetry.acknowledgeLinkNotice": {+ webkit: { methods: ["telemetry.acknowledgeLinkNotice"] },+ tauri: ["telemetry_acknowledge_link_notice"],+ },} as const satisfies Record<keyof TelemetryOps, OpCoverage>;diff --git a/apps/cua-spaces-web/src/bridge/protocol.ts b/apps/cua-spaces-web/src/bridge/protocol.tsindex f70d3a9e98..b5572ed797 100644--- a/apps/cua-spaces-web/src/bridge/protocol.ts+++ b/apps/cua-spaces-web/src/bridge/protocol.ts@@ -50,7 +50,7 @@ import { RESOURCES_OPERATIONS, type ResourcesOps } from "./ops/resources";import { CHECKLIST_OPERATIONS, type ChecklistOps } from "./ops/checklist";import { PRESENCE_OPERATIONS, type PresenceOps } from "./ops/presence";import { RUNTIME_FIX_OPERATIONS, type RuntimeFixOps } from "./ops/runtime-fix";-import type { TelemetryOps } from "./ops/telemetry";+import { TELEMETRY_OPERATIONS, type TelemetryOps } from "./ops/telemetry";import { STARTUP_EVENTS, STARTUP_OPERATIONS, type StartupHostEvent, type StartupOps } from "./ops/startup";/* ---- Settings the web UI reads and writes -------------------------------- */@@ -65,7 +65,7 @@ export interface SettingsValues {menuBar: boolean;/** The global hotkey, as glyphs (`⌘⇧Space`). */hotkey: string;- /** Anonymous usage telemetry (`$CUA_HOME/config.toml`, same as `cua telemetry`). */+ /** Usage telemetry (`$CUA_HOME/config.toml`, same as `cua telemetry`). */telemetry: boolean;/** Where New Space starts: `local`, `cloud`, `host:<id>`, or a cloud word. */defaultLocation: string;@@ -301,7 +301,7 @@ export const OPERATIONS = [...RUNTIME_FIX_OPERATIONS,...SETTINGS_OPERATIONS,...NOTIFICATIONS_OPERATIONS,- "telemetry.track",+ ...TELEMETRY_OPERATIONS,"spaces.usage","spaces.windows","stream.pip",diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.tsindex 25723d55c7..643b6421b2 100644--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts@@ -127,6 +127,8 @@ export const WEBKIT_METHODS = ["notifications.markAllRead","notifications.markRead","telemetry.track",+ "telemetry.linkNotice",+ "telemetry.acknowledgeLinkNotice","spaces.usage","spaces.windows","stream.pip",diff --git a/apps/cua-spaces-web/src/components/usage-link-notice.tsx b/apps/cua-spaces-web/src/components/usage-link-notice.tsxnew file mode 100644index 0000000000..ad9d4a4548--- /dev/null+++ b/apps/cua-spaces-web/src/components/usage-link-notice.tsx@@ -0,0 +1,48 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { useLinkNotice, useSession } from "@/bridge";+import { Button } from "@/components/ui/button";+import { Dialog, DialogDescription, DialogPopup, DialogTitle } from "@/components/ui/dialog";++/**+ * The one-time notice for machines that saw the older "anonymous" usage-data+ * wording: usage data is now linked to the signed-in account through a+ * random ID. The host says when it is due and owns the words. Only the two+ * buttons close it, so an Escape or a click outside can't count as a choice.+ */+export function UsageLinkNotice() {+ const { notice, busy, error, keep, turnOff } = useLinkNotice();+ const { openExternal } = useSession();+ if (!notice) return null;+ return (+ <Dialog open onOpenChange={() => undefined} disablePointerDismissal>+ <DialogPopup className="top-[14vh] w-[min(460px,calc(100vw-2rem))]" data-usage-link-notice="">+ <div className="px-6 pt-5 pb-4">+ <DialogTitle className="text-[15px] font-semibold">{notice.title}</DialogTitle>+ <DialogDescription className="mt-1 text-[13px] text-muted-foreground">{notice.body}</DialogDescription>+ <button+ type="button"+ className="mt-2 text-xs text-foreground underline-offset-2 hover:underline"+ onClick={() => void openExternal(notice.docsUrl).catch(() => undefined)}+ >+ {notice.detailsLabel}+ </button>+ {error ? (+ <p role="alert" className="mt-2 text-xs text-destructive">+ {error}+ </p>+ ) : null}+ <div className="mt-4 flex justify-end gap-2">+ <Button type="button" variant="outline" disabled={busy} onClick={() => void turnOff()}>+ {notice.turnOffLabel}+ </Button>+ <Button type="button" autoFocus disabled={busy} onClick={() => void keep()}>+ {notice.okLabel}+ </Button>+ </div>+ </div>+ </DialogPopup>+ </Dialog>+ );+}diff --git a/apps/cua-spaces-web/src/routes/__root.tsx b/apps/cua-spaces-web/src/routes/__root.tsxindex ed528ce49e..7146a62269 100644--- a/apps/cua-spaces-web/src/routes/__root.tsx+++ b/apps/cua-spaces-web/src/routes/__root.tsx@@ -14,6 +14,7 @@ import { Sidebar } from "@/components/shell/sidebar";import { RelayAllowanceNotice } from "@/components/shell/relay-allowance-notice";import { SpacesNotice } from "@/components/shell/spaces-notice";import { SpaceSheets } from "@/components/space-sheets";+import { UsageLinkNotice } from "@/components/usage-link-notice";import { TopBar } from "@/components/shell/top-bar";import { ThisMacNudges } from "@/components/this-mac-nudges";import { useGlobalKeybindings } from "@/hooks/use-global-keybindings";@@ -79,6 +80,7 @@ function RootLayout() {<NewSpace /><SpaceSheets /><ThisMacNudges />+ <UsageLinkNotice /></div>);}diff --git a/apps/cua-spaces-web/src/routes/onboarding/index.tsx b/apps/cua-spaces-web/src/routes/onboarding/index.tsxindex 9d53375572..e82e36b5fb 100644--- a/apps/cua-spaces-web/src/routes/onboarding/index.tsx+++ b/apps/cua-spaces-web/src/routes/onboarding/index.tsx@@ -10,6 +10,7 @@ import { CuaKey } from "@/components/cua-key";import { CuaLogo } from "@/components/cua-logo";import { OsIcon } from "@/components/os-icon";import { Button } from "@/components/ui/button";+import { Switch } from "@/components/ui/switch";import { toast } from "@/components/ui/toast";import { RuntimeFixRow } from "@/components/new-space/runtime-fix";import { cn } from "@/lib/utils";@@ -131,6 +132,26 @@ function Connect({ fr, view }: { fr: FirstRunHook; view: FirstRunView }) {<span>{c.note}</span><span className="text-muted-foreground">{c.noteMore}</span></p>+ {fr.usage ? (+ <div className="mt-8 flex max-w-[520px] flex-col gap-3 text-[13px] text-muted-foreground" data-first-run-usage="">+ <p>+ {fr.usage.notice}{" "}+ <button type="button" className="underline hover:text-foreground" onClick={fr.openUsageLink}>+ {fr.usage.linkLabel}+ </button>+ </p>+ <label className="flex items-center gap-2.5 text-foreground">+ <Switch+ checked={fr.usage.on}+ disabled={!fr.usage.enabled}+ onCheckedChange={(on) => void fr.setUsage(on).catch(() => {})}+ aria-label={fr.usage.label}+ />+ <span>{fr.usage.label}</span>+ {fr.usage.help ? <span className="text-muted-foreground">{fr.usage.help}</span> : null}+ </label>+ </div>+ ) : null}<div className="mt-8 flex flex-wrap items-center gap-x-5 gap-y-2 text-[13px]"><span className="text-muted-foreground">{c.orLabel}</span>{c.others.map((o) => (diff --git a/apps/cua-spaces-web/src/routes/settings/index.tsx b/apps/cua-spaces-web/src/routes/settings/index.tsxindex d1ac23f810..1c7896507b 100644--- a/apps/cua-spaces-web/src/routes/settings/index.tsx+++ b/apps/cua-spaces-web/src/routes/settings/index.tsx@@ -308,8 +308,8 @@ function FallbackSettingsPage() {<SettingsGroup title="Privacy"><SettingsRow- label="Share anonymous usage data"- description="Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items."+ label="Share usage data to help improve Cua"+ description="Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen."htmlFor="telemetry"control={<Switchdiff --git a/apps/cua-spaces/src-tauri/Cargo.toml b/apps/cua-spaces/src-tauri/Cargo.tomlindex 23b2dd6c3c..a94cd94a49 100644--- a/apps/cua-spaces/src-tauri/Cargo.toml+++ b/apps/cua-spaces/src-tauri/Cargo.toml@@ -82,7 +82,7 @@ cua-host = { path = "../../../libs/cua/crates/cua-host" }cua-agent-setup = { path = "../../../libs/cua/crates/cua-agent-setup" }# "Sign in to Cua" and the credential store shared with the CLI and daemon.cua-auth = { path = "../../../libs/cua/crates/cua-auth" }-# Anonymous usage telemetry (the SDK core).+# Usage telemetry (the SDK core).cua-telemetry = { path = "../../../libs/cua/crates/cua-telemetry" }tokio = { version = "1", features = ["net", "rt", "rt-multi-thread", "sync", "macros", "time", "process"] }# User "Sign in to Cua" device-authorization grant (src/auth.rs): the devicediff --git a/apps/cua-spaces/src-tauri/src/core.rs b/apps/cua-spaces/src-tauri/src/core.rsindex 2cd3807718..e1ebf62034 100644--- a/apps/cua-spaces/src-tauri/src/core.rs+++ b/apps/cua-spaces/src-tauri/src/core.rs@@ -949,11 +949,21 @@ impl AppCore {let identity = self.session.install(c).await?;self.signed_in.store(true, Ordering::Relaxed);self.identity_changed().await;+ self.sync_usage_link().await;Ok(identity)}+ /// Links usage data to the signed-in account when the Spaces API offers+ /// an account id (CUA-1881); none unlinks. Best effort: offline or+ /// signed out, nothing changes. Called at launch and after a sign-in.+ pub async fn sync_usage_link(&self) {+ crate::telemetry::sync_account(&self.session).await;+ }+/// Signs out.pub async fn sign_out(&self) {+ // Usage data goes back to a new anonymous install id.+ let _ = cua_telemetry::global().forget_account();self.session.clear().await;self.signed_in.store(false, Ordering::Relaxed);self.identity_changed().await;diff --git a/apps/cua-spaces/src-tauri/src/lib.rs b/apps/cua-spaces/src-tauri/src/lib.rsindex 8703bb0a3c..6842068fee 100644--- a/apps/cua-spaces/src-tauri/src/lib.rs+++ b/apps/cua-spaces/src-tauri/src/lib.rs@@ -569,6 +569,8 @@ pub fn run() {keyvault::keyvault_approve,keyvault::keyvault_deny,telemetry::telemetry_status,+ telemetry::telemetry_link_notice,+ telemetry::telemetry_acknowledge_link_notice,telemetry::telemetry_set_enabled,telemetry::telemetry_acknowledge_notice,telemetry::telemetry_record_feature,@@ -586,6 +588,13 @@ pub fn run() {.setup(move |app| {let accessory_activation = false;+ // Links usage data to the signed-in account when the Spaces API+ // offers it (CUA-1881). Best effort, off the startup path.+ {+ let core = core.clone();+ tauri::async_runtime::spawn(async move { core.sync_usage_link().await });+ }+// Webview data stays in the app's data directory (webview_data):// the page's settings file, then the tauri.conf.json windows// (`create: false`) built with that policy, before anythingdiff --git a/apps/cua-spaces/src-tauri/src/telemetry.rs b/apps/cua-spaces/src-tauri/src/telemetry.rsindex 413441d39f..4f713bea2e 100644--- a/apps/cua-spaces/src-tauri/src/telemetry.rs+++ b/apps/cua-spaces/src-tauri/src/telemetry.rs@@ -1,7 +1,7 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.-//! Anonymous usage telemetry for the Spaces app, on the SDK's telemetry+//! Usage telemetry for the Spaces app, on the SDK's telemetry//! core (cua-telemetry): the same schema, install id, switches and//! `$CUA_HOME/config.toml` setting as the `cua` CLI. The app shows the//! first-run notice in its onboarding (nothing is sent before), and@@ -45,6 +45,26 @@ fn t() -> Option<&'static Telemetry> {CLIENT.get()}+/// Asks the Spaces API for the signed-in account's opaque id and hands it+/// to telemetry (CUA-1881). The state is the install's, in+/// `$CUA_HOME/telemetry`, so the app's and the SDK's clients both see it.+pub async fn sync_account(session: &crate::auth::SessionHandle) {+ let Some(t) = t() else { return };+ if !t.is_enabled() {+ return;+ }+ let budget = std::time::Duration::from_secs(10);+ let Ok(Ok(token)) = tokio::time::timeout(budget, session.get_valid_token(false)).await else {+ return;+ };+ let Ok(api) = cua_host::spaces_api::SpacesApiClient::current() else {+ return;+ };+ if let Ok(Ok(me)) = tokio::time::timeout(budget, api.me(&token)).await {+ t.offer_account(me.analytics_id.as_deref());+ }+}+/// Records signals the app core derived (both shells send them the same/// way) and marks the day active.pub fn record(signals: &[TelemetrySignal]) {@@ -120,6 +140,8 @@ pub struct TelemetryView {pub notice_shown: bool,pub notice_text: String,pub docs_url: String,+ /// Show the one-time linking notice now (CUA-1881).+ pub link_notice_due: bool,}fn client() -> Result<&'static Telemetry, String> {@@ -136,9 +158,57 @@ fn view(t: &Telemetry) -> TelemetryView {notice_shown: s.notice_shown,notice_text: cua_telemetry::notice::TEXT.to_string(),docs_url: cua_telemetry::notice::DOCS_URL.to_string(),+ link_notice_due: t.link_notice_due(),+ }+}++/// The one-time linking notice (CUA-1881) as the web UI shows it: the words+/// from `cua_telemetry::link`, one copy for every shell, and whether it is+/// due now.+#[derive(Clone, Debug, PartialEq, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct LinkNoticeView {+ pub due: bool,+ pub title: String,+ pub body: String,+ /// "Got it": keeps usage data on.+ pub ok_label: String,+ /// "Turn off usage data".+ pub turn_off_label: String,+ /// The link to what is collected.+ pub details_label: String,+ pub docs_url: String,+}++fn link_notice_view(due: bool) -> LinkNoticeView {+ use cua_telemetry::link;+ LinkNoticeView {+ due,+ title: link::NOTICE_TITLE.into(),+ body: link::NOTICE_BODY.into(),+ ok_label: link::NOTICE_OK.into(),+ turn_off_label: link::NOTICE_TURN_OFF.into(),+ details_label: link::NOTICE_DETAILS.into(),+ docs_url: cua_telemetry::notice::DOCS_URL.into(),}}+/// The one-time linking notice: its words and whether it is due now.+#[tauri::command]+pub fn telemetry_link_notice() -> Result<LinkNoticeView, String> {+ let t = client()?;+ t.refresh();+ Ok(link_notice_view(t.link_notice_due()))+}++/// The one-time linking notice was closed (either button).+#[tauri::command]+pub fn telemetry_acknowledge_link_notice() -> Result<TelemetryView, String> {+ let t = client()?;+ t.acknowledge_link_notice();+ Ok(view(t))+}+#[tauri::command]pub fn telemetry_status() -> Result<TelemetryView, String> {Ok(view(client()?))@@ -225,3 +295,27 @@ pub fn shutdown() {t.shutdown(std::time::Duration::from_millis(400));}}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn the_link_notice_carries_the_sdk_words_in_the_pages_shape() {+ let v = serde_json::to_value(link_notice_view(true)).unwrap();+ assert_eq!(v["due"], true);+ assert_eq!(v["title"], cua_telemetry::link::NOTICE_TITLE);+ assert_eq!(v["body"], cua_telemetry::link::NOTICE_BODY);+ assert_eq!(v["okLabel"], "Got it");+ assert_eq!(v["turnOffLabel"], "Turn off usage data");+ assert_eq!(v["detailsLabel"], "What is collected");+ assert_eq!(+ v["docsUrl"],+ "https://cua.ai/docs/cua-sdk/concepts/telemetry"+ );+ assert_eq!(+ serde_json::to_value(link_notice_view(false)).unwrap()["due"],+ false+ );+ }+}diff --git a/apps/cua-spaces/src/components/InstallerFlow.test.tsx b/apps/cua-spaces/src/components/InstallerFlow.test.tsxindex cef63b3f02..a4bb6941dd 100644--- a/apps/cua-spaces/src/components/InstallerFlow.test.tsx+++ b/apps/cua-spaces/src/components/InstallerFlow.test.tsx@@ -142,13 +142,13 @@ describe("InstallerFlow", () => {expect(screen.getByText("Welcome to Cua Spaces")).toBeInTheDocument();// The telemetry notice is on Welcome: it is recorded as shown before// anything is recorded.- expect(screen.getByTestId("telemetry-notice")).toHaveTextContent("Change it here or in Settings, Privacy.");+ expect(screen.getByTestId("telemetry-notice")).toHaveTextContent("Change this here or in Settings, Privacy.");expect(screen.getByRole("link", { name: "What is collected" })).toHaveAttribute("href","https://cua.ai/docs/cua-sdk/concepts/telemetry",);// Nothing is recorded while Welcome shows; the switch is on.- expect(screen.getByRole("switch", { name: "Share anonymous usage data" })).toBeChecked();+ expect(screen.getByRole("switch", { name: "Share usage data to help improve Cua" })).toBeChecked();expect(telemetry.signals).toEqual([]);// First launch installs the bundled cua (PATH line added): no page.await waitFor(() => expect(installer.calls).toEqual(["cliPlan", "installCli:path"]));@@ -257,7 +257,7 @@ describe("InstallerFlow", () => {onDone={vi.fn()}/>,);- const toggle = screen.getByRole("switch", { name: "Share anonymous usage data" });+ const toggle = screen.getByRole("switch", { name: "Share usage data to help improve Cua" });await waitFor(() => expect(toggle).toBeChecked());fireEvent.click(toggle);expect(toggle).not.toBeChecked();diff --git a/apps/cua-spaces/src/components/SettingsPanel.test.tsx b/apps/cua-spaces/src/components/SettingsPanel.test.tsxindex 27a177e645..7cb69a6c18 100644--- a/apps/cua-spaces/src/components/SettingsPanel.test.tsx+++ b/apps/cua-spaces/src/components/SettingsPanel.test.tsx@@ -376,7 +376,7 @@ describe("SettingsPanel Privacy", () => {it("acknowledges the notice, turns usage telemetry off and links the docs", async () => {const telemetry = fakeTelemetry();const props = renderPanel({ telemetry });- await screen.findByText("Share anonymous usage data");+ await screen.findByText("Share usage data to help improve Cua");expect(telemetry.calls).toEqual(["ack"]);await userEvent.click(screen.getByRole("radio", { name: "Off" }));expect(telemetry.calls).toContain("set:false");@@ -395,7 +395,7 @@ describe("SettingsPanel Privacy", () => {it("lists Account, Teams, General, Privacy, AI agents and Experiments in order, with Show again", async () => {const onShowWelcome = vi.fn();renderPanel({ telemetry: fakeTelemetry(), onShowWelcome });- await screen.findByText("Share anonymous usage data");+ await screen.findByText("Share usage data to help improve Cua");const titles = screen.getAllByRole("heading", { level: 3 }).map((h) => h.textContent);expect(titles).toEqual(["Account", "Teams", "General", "Privacy", "AI agents", "Experiments"]);await userEvent.click(screen.getByRole("button", { name: "Show again" }));@@ -426,7 +426,7 @@ describe("SettingsPanel Experiments", () => {recordSignals: vi.fn(),};renderPanel({ telemetry });- await screen.findByText("Share anonymous usage data");+ await screen.findByText("Share usage data to help improve Cua");const experiments = within(screen.getByRole("region", { name: "Experiments" }));for (const name of ["Cua Volume", "Your cloud"]) {expect(experiments.getByRole("switch", { name })).toHaveAttribute("aria-checked", "false");diff --git a/apps/cua-spaces/src/model/onboarding.ts b/apps/cua-spaces/src/model/onboarding.tsindex 9102e3c818..f9e1ad99d7 100644--- a/apps/cua-spaces/src/model/onboarding.ts+++ b/apps/cua-spaces/src/model/onboarding.ts@@ -112,7 +112,7 @@ export interface OnboardingView {notice: string | null;noticeLinkLabel: string | null;noticeLinkUrl: string | null;- /** Welcome's "Share anonymous usage data" switch (Welcome only). */+ /** Welcome's "Share usage data to help improve Cua" switch (Welcome only). */usage: { label: string; on: boolean; enabled: boolean; help: string | null } | null;/** The Cua Volume page's card. */drive: DriveCard | null;diff --git a/apps/cua-spaces/src/model/telemetry.ts b/apps/cua-spaces/src/model/telemetry.tsindex 2a58a1d779..73f012a45d 100644--- a/apps/cua-spaces/src/model/telemetry.ts+++ b/apps/cua-spaces/src/model/telemetry.ts@@ -2,7 +2,7 @@// Copyright (c) 2026 Cua AI, Inc./**- * Which anonymous usage events a UI step means, from the app core+ * Which usage events a UI step means, from the app core* (`telemetry::*`): the first run's pages, Space creates, Settings, Storage,* the Share sheet and enrolling this device. The shell sends the signals* (`telemetry_record_signals`); the SwiftUI app derives and sends the samediff --git a/apps/cua-spaces/src/native/telemetry.ts b/apps/cua-spaces/src/native/telemetry.tsindex 1aa0c3ff27..8ce3621874 100644--- a/apps/cua-spaces/src/native/telemetry.ts+++ b/apps/cua-spaces/src/native/telemetry.ts@@ -5,7 +5,7 @@ import type { TelemetrySignal } from "../model/telemetry";import { hasTauri } from "./bridge";/**- * Anonymous usage telemetry (the shell's `telemetry_*` commands in+ * Usage telemetry (the shell's `telemetry_*` commands in* `src-tauri/src/telemetry.rs`, on the SDK's cua-telemetry core). The switch* is the same `$CUA_HOME/config.toml` setting as `cua telemetry off`.*/diff --git a/docs/content/docs/cua-sdk/concepts/telemetry.mdx b/docs/content/docs/cua-sdk/concepts/telemetry.mdxindex 4692e1132e..41e945d380 100644--- a/docs/content/docs/cua-sdk/concepts/telemetry.mdx+++ b/docs/content/docs/cua-sdk/concepts/telemetry.mdx@@ -3,9 +3,12 @@ title: Telemetry and privacydescription: What the cua SDK, the cua CLI, cua daemon, cua-spacesd and the Cua Spaces app collect, what they never collect, and how to turn it off.----Cua sends anonymous usage data so we can see which features are used and-where things break. It never contains your content. You can see every event-before or after it is sent, and turn it off with one switch.+Cua collects usage data so we can see which features are used and where+things break. It's on by default, like in VS Code or Docker Desktop. It+never contains your content: no files, file paths, names, emails, prompts or+screen content, only fixed event names and counts. When you're signed in,+it's linked to your Cua account through a random account ID. You can see+every event before or after it is sent, and turn it off with one switch.## Turn it off@@ -17,7 +20,7 @@ Any of these turns usage telemetry off for every Cua program on the machine| `DO_NOT_TRACK=1` | This environment. Wins over everything. || `CUA_TELEMETRY=0` | This environment. `CUA_TELEMETRY=1` turns it back on. || `cua telemetry off` or `cua config set telemetry off` | This machine (`[telemetry] enabled = "off"` in `$CUA_HOME/config.toml`). |-| Spaces app: "Share anonymous usage data" on the first run's Welcome page, or Settings, Privacy | Same setting as above. |+| Spaces app: "Share usage data to help improve Cua" on the first run's Welcome page, or Settings, Privacy | Same setting as above. || SDK: `cua.telemetry.disable()` (Python), `telemetrySetEnabled(false)` (TypeScript, Swift, Kotlin) | Same setting as above. |CI environments (`CI`, `GITHUB_ACTIONS`, `BUILDKITE`, ...) are off by default.@@ -37,20 +40,40 @@ cua telemetry reset-id # a new anonymous install idNothing is sent from a machine until the first-run notice has been shownthere once (in the terminal, or in the Spaces app's onboarding or Settings).The process that shows it sends nothing. In the Spaces app the notice is on-the first run's Welcome page, next to a "Share anonymous usage data" switch:+the first run's Welcome page, next to a "Share usage data to help improve+Cua" switch:nothing is queued or sent until you leave that page, and if you turn theswitch off there, nothing is sent at all (the setting is saved for every Cuaprogram on the machine).+## Linked to your account when you're signed in++When you're signed in, usage data is linked to your account so we can see+where people get stuck. We see which steps you reached, not what you did.++- **A random account ID.** The Cua service gives a signed-in app or CLI an ID+ like `acct_3f9c...`, a one-way code made from your account. It is never your+ email, name or sign-in id. One PostHog `$identify` joins this install's+ earlier events to it.+- **You see it first.** Nothing is linked before the notice has been shown on+ this machine. Installs that saw the older "anonymous" wording get a one-time+ notice with "Turn off usage data" right there.+- **Off means off.** Signing out, `cua telemetry off` and `cua telemetry+ reset-id` unlink this machine. `cua telemetry status` shows whether it's linked.++Our service also records sign-ups, checkouts and subscription changes under+the same ID. Those are records of our service, so the switch doesn't change them.+## How it works-- **Anonymous id.** 128 random bits in `$CUA_HOME/telemetry/install_id`, created+- **Install id.** 128 random bits in `$CUA_HOME/telemetry/install_id`, createdon the first event actually sent, never while telemetry is off. It is notderived from your machine or account. `reset-id` deletes it.-- **No person profiles, no location.** Every event sets `$process_person_profile: false`- and `$geoip_disable: true`. Like any HTTPS request, the upload reaches- PostHog (EU) from your IP address; it is never an event property and is- not used for location.+- **No location.** Every event sets `$geoip_disable: true`. Like any HTTPS+ request, the upload reaches PostHog (EU) from your IP address; it is never+ an event property and is not used for location. Events that aren't linked to+ an account set `$process_person_profile: false`; linked events belong to+ the account's PostHog person, which never holds a name or an email.- **Closed vocabularies.** Every property is one of a fixed list of values, abucket, a boolean or a version. An image reference that is not in the publicimage catalog is sent as `custom`; an app outside the public teleport catalog@@ -67,34 +90,17 @@ property and why it is collected: [Telemetry events](/cua-sdk/concepts/telemetry## What we use it for-These are the questions the events answer, and nothing else:--- How many people install and launch Cua Spaces, and how many finish the- first run? Where do they leave it (which page), and what do they pick on- each page?-- How many make a first Space, of which kind and where? How long until it is- ready, and how often does a create fail (in which phase, or by stalling) or- get abandoned?-- Do people teleport, and does it work? Do they run an agent?-- Do they use the Cua Volume, persistent agents, host Spaces, the Keyvault,- sharing and multiplayer? Do they update?-- Are they still using Cua a day, a week and a month later?--The activation funnel joins events on the anonymous install id, in order:-installer started and finished (`cua_installer_step`), app launched-(`cua_onboarding_step` `app_launched`), first run completed-(`onboarding_completed`), signed in (`signed_in`), first Space created-(`first_space_created`), first Space ready (`first_space_ready`), first-teleport (`first_teleport`), first agent run (`first_agent_run`) and an-AI agent using a Space (`cua_agent_used_space`). The `first_*` steps are sent-once per install.--How the installers, an AI agent using a Space, agent runs and retention-are counted: [How events are counted](/cua-sdk/concepts/telemetry-counting).+To answer how many people install Cua Spaces, finish the first run, sign in,+make a first Space, teleport and run an agent; where creates fail or stall;+which features are used; and who still uses Cua a day, a week and a month+later. The funnel joins events on the install id, and on the account ID once+you sign in. The `first_*` steps are sent once per install. How installers,+an AI agent using a Space, agent runs and retention are counted:+[How events are counted](/cua-sdk/concepts/telemetry-counting).## Never collected-File paths, file names, usernames, hostnames, IP addresses, emails, window+File paths, file names, names, usernames, hostnames, IP addresses, emails, windowtitles, URLs, clipboard, keystrokes or typed text, screenshots, screen oraccessibility content, prompts, model output, sandbox or Space names, errormessages, and anything stored in the Keyvault (only consent decisions arediff --git a/docs/content/docs/cua-sdk/reference/auth.mdx b/docs/content/docs/cua-sdk/reference/auth.mdxindex 9a2d9b32c5..98f09f4139 100644--- a/docs/content/docs/cua-sdk/reference/auth.mdx+++ b/docs/content/docs/cua-sdk/reference/auth.mdx@@ -27,7 +27,7 @@ Returned by [`Cua.auth`](/cua-sdk/reference/cua#cua).| [`access_token`](#authaccess_token) | A valid access token (refreshed when it expires within a minute, or when `force`). || [`begin_login`](#authbegin_login) | Starts a sign-in. || [`devices`](#authdevices) | This device on `relay_url` (`None` = the relay `cua` uses: `CUA_RELAY_URL`, else this machine's host setup, else `https://relay.cua.ai`) as the signed-in account, shown as `name` (default: this computer's name). |-| [`logout`](#authlogout) | Revokes (best effort) and removes the session. |+| [`logout`](#authlogout) | Revokes (best effort) and removes the session, and unlinks usage data from the account. || [`status`](#authstatus) | The stored session (no network). |### `Auth.access_token`@@ -185,8 +185,8 @@ pub fn devices(&self, relay_url: Option<String>, name: Option<String>) -> Result### `Auth.logout`-Revokes (best effort) and removes the session. Returns whether one-existed.+Revokes (best effort) and removes the session, and unlinks usage+data from the account. Returns whether one existed.<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist><Tab value="Python">@@ -721,6 +721,23 @@ One stream session's aggregate stats (sampled).| `height` | `u32` | | Stream height in pixels. || `duration_ms` / `durationMs` | `u64` | | |+## `TelemetryLinkNotice` record++The one-time notice for machines that saw the older "anonymous" wording,+shown before anything is linked to the account. Both buttons close it;+the second also turns usage data off.++Returned by [`telemetry_link_notice`](#telemetry_link_notice).++| Field | Type | Default | Description |+| --- | --- | --- | --- |+| `title` | `String` | | |+| `body` | `String` | | |+| `ok_label` / `okLabel` | `String` | | Keeps usage data on ("Got it"). |+| `turn_off_label` / `turnOffLabel` | `String` | | Turns usage data off ("Turn off usage data"). |+| `details_label` / `detailsLabel` | `String` | | The link to what is collected. |+| `docs_url` / `docsUrl` | `String` | | |+## `TelemetryStatus` recordTelemetry state.@@ -739,6 +756,49 @@ Returned by [`telemetry_set_enabled`](#telemetry_set_enabled), [`telemetry_statu| `product` | `String` | | Which Cua program events are attributed to. || `envelope_json` / `envelopeJson` | `String` | | The exact properties every event carries, as JSON. |+## `telemetry_acknowledge_link_notice`++The person closed the linking notice (either button). Linking starts+with the app's next launch, never in the process that showed it.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+def telemetry_acknowledge_link_notice() -> None+```++</Tab>+<Tab value="TypeScript">++```ts+function telemetryAcknowledgeLinkNotice(): void+```++</Tab>+<Tab value="Swift">++```swift+func telemetryAcknowledgeLinkNotice()+```++</Tab>+<Tab value="Kotlin">++```kotlin+fun telemetryAcknowledgeLinkNotice()+```++</Tab>+<Tab value="Rust">++```rust+pub fn telemetry_acknowledge_link_notice()+```++</Tab>+</Tabs>+## `telemetry_acknowledge_notice`Records that the first-run notice was shown in the app's UI (nothing is@@ -830,6 +890,139 @@ pub fn telemetry_flush(timeout_ms: u32)| --- | --- | --- || `timeout_ms` | `u32` | required |+## `telemetry_link_notice`++The one-time linking notice's words.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+def telemetry_link_notice() -> TelemetryLinkNotice+```++</Tab>+<Tab value="TypeScript">++```ts+function telemetryLinkNotice(): TelemetryLinkNotice+```++</Tab>+<Tab value="Swift">++```swift+func telemetryLinkNotice() -> TelemetryLinkNotice+```++</Tab>+<Tab value="Kotlin">++```kotlin+fun telemetryLinkNotice(): TelemetryLinkNotice+```++</Tab>+<Tab value="Rust">++```rust+pub fn telemetry_link_notice() -> TelemetryLinkNotice+```++</Tab>+</Tabs>++**Returns** [`TelemetryLinkNotice`](#telemetrylinknotice-record)++## `telemetry_link_notice_due`++Whether the app should show the one-time linking notice now: usage data+is on, the account offered linking, and this machine has not shown it.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+def telemetry_link_notice_due() -> bool+```++</Tab>+<Tab value="TypeScript">++```ts+function telemetryLinkNoticeDue(): boolean+```++</Tab>+<Tab value="Swift">++```swift+func telemetryLinkNoticeDue() -> Bool+```++</Tab>+<Tab value="Kotlin">++```kotlin+fun telemetryLinkNoticeDue(): Boolean+```++</Tab>+<Tab value="Rust">++```rust+pub fn telemetry_link_notice_due() -> bool+```++</Tab>+</Tabs>++**Returns** `bool`++## `telemetry_link_state`++Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+def telemetry_link_state() -> str+```++</Tab>+<Tab value="TypeScript">++```ts+function telemetryLinkState(): string+```++</Tab>+<Tab value="Swift">++```swift+func telemetryLinkState() -> String+```++</Tab>+<Tab value="Kotlin">++```kotlin+fun telemetryLinkState(): String+```++</Tab>+<Tab value="Rust">++```rust+pub fn telemetry_link_state() -> String+```++</Tab>+</Tabs>++**Returns** `String`+## `telemetry_notice_text`The first-run notice text (an app shows it in its own UI, then calls@@ -1126,6 +1319,53 @@ pub fn telemetry_set_surface(surface: String, version: String)| `surface` | `String` | required || `version` | `String` | required |+## `telemetry_sync_account`++Asks the Spaces API for the signed-in account's opaque id and hands it+to telemetry (none unlinks). Call at launch and after a sign-in; the+SDK's own sign-in already does. Returns the link state. Best effort:+offline or signed out, nothing changes.++<Tabs items={['Python', 'TypeScript', 'Swift', 'Kotlin', 'Rust']} groupId="sdk-lang" persist>+<Tab value="Python">++```python+async def telemetry_sync_account() -> str+```++</Tab>+<Tab value="TypeScript">++```ts+function telemetrySyncAccount(asyncOpts_?: { signal: AbortSignal }): Promise<string>+```++</Tab>+<Tab value="Swift">++```swift+func telemetrySyncAccount() async -> String+```++</Tab>+<Tab value="Kotlin">++```kotlin+suspend fun telemetrySyncAccount(): String+```++</Tab>+<Tab value="Rust">++```rust+pub async fn telemetry_sync_account() -> String+```++</Tab>+</Tabs>++**Returns** `String` · **Async**+## `telemetry_use_app_notice`The host app shows the first-run notice itself (no stderr notice).diff --git a/docs/content/docs/cua-sdk/reference/index.mdx b/docs/content/docs/cua-sdk/reference/index.mdxindex 9bd879868f..cee817e28a 100644--- a/docs/content/docs/cua-sdk/reference/index.mdx+++ b/docs/content/docs/cua-sdk/reference/index.mdx@@ -89,4 +89,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`). |-302 items, 390 methods. The [Types](/cua-sdk/reference/types) page lists them.+308 items, 390 methods. The [Types](/cua-sdk/reference/types) page lists them.diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-sdk.mdxindex 62dd2be552..3589318e0c 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#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/agents#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agents#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#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agents#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agents#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agents#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agents#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox#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), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BundledSkill`](/cua-sdk/reference/agents#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), [`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), [`CloudOptions`](/cua-sdk/reference/image#cloudoptions-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), [`Fleet`](/cua-sdk/reference/errors#fleet), [`fleet_check_runtime`](/cua-sdk/reference/fleet/images#fleet_check_runtime), [`fleet_generate_claim_token`](/cua-sdk/reference/fleet#fleet_generate_claim_token), [`fleet_image_variant`](/cua-sdk/reference/fleet/images#fleet_image_variant), [`fleet_resolve_runtime`](/cua-sdk/reference/fleet/images#fleet_resolve_runtime), [`fleet_size_limits`](/cua-sdk/reference/fleet/images#fleet_size_limits), [`FleetBillingCard`](/cua-sdk/reference/fleet/images#fleetbillingcard-record), [`FleetBillingCredit`](/cua-sdk/reference/fleet/images#fleetbillingcredit-record), [`FleetBillingStatus`](/cua-sdk/reference/fleet/images#fleetbillingstatus-record), [`FleetClaim`](/cua-sdk/reference/fleet/claims#fleetclaim-record), [`FleetClaimOptions`](/cua-sdk/reference/fleet/claims#fleetclaimoptions-record), [`FleetGcReport`](/cua-sdk/reference/fleet#fleetgcreport-record), [`FleetManagedPool`](/cua-sdk/reference/fleet#fleetmanagedpool-record), [`FleetPool`](/cua-sdk/reference/fleet#fleetpool-record), [`FleetPoolExport`](/cua-sdk/reference/fleet#fleetpoolexport-record), [`FleetPools`](/cua-sdk/reference/fleet#fleetpools), [`FleetPoolSpec`](/cua-sdk/reference/fleet#fleetpoolspec-record), [`FleetSandbox`](/cua-sdk/reference/fleet/claims#fleetsandbox-record), [`FleetSettings`](/cua-sdk/reference/cua#fleetsettings-record), [`FleetSignedUrl`](/cua-sdk/reference/fleet/claims#fleetsignedurl-record), [`FleetSizeLimits`](/cua-sdk/reference/fleet/images#fleetsizelimits-record), [`FleetUsagePricing`](/cua-sdk/reference/fleet/images#fleetusagepricing-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), [`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), [`may_have_fleet_session`](/cua-sdk/reference/auth#may_have_fleet_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), [`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#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PoolOptions`](/cua-sdk/reference/fleet#pooloptions-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), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox#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#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), [`SandboxRefParts`](/cua-sdk/reference/sandbox#sandboxrefparts-record), [`SandboxSpec`](/cua-sdk/reference/fleet#sandboxspec-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), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`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#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/space#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/space#spaceshostlimit-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), [`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_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice), [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush), [`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_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice), [`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).+[`agent_event_category`](/cua-sdk/reference/agents#agent_event_category), [`agent_harnesses`](/cua-sdk/reference/agents#agent_harnesses), [`AgentActionReport`](/cua-sdk/reference/spaces#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/agents#agentinfo-record), [`AgentMcpServer`](/cua-sdk/reference/agents#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#agentrunstatus-record), [`Agents`](/cua-sdk/reference/agents#agents), [`AgentSetup`](/cua-sdk/reference/agents#agentsetup), [`AgentSetupChange`](/cua-sdk/reference/agents#agentsetupchange-enum), [`AgentSetupOutcome`](/cua-sdk/reference/agents#agentsetupoutcome-record), [`AgentSetupTarget`](/cua-sdk/reference/agents#agentsetuptarget-enum), [`AgentStartReport`](/cua-sdk/reference/spaces#agentstartreport-record), [`AgentTranscript`](/cua-sdk/reference/agents#agenttranscript), [`AgentTranscriptItem`](/cua-sdk/reference/agents#agenttranscriptitem-record), [`ambiguous_sandbox_candidates`](/cua-sdk/reference/sandbox#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), [`BuildFile`](/cua-sdk/reference/image#buildfile-record), [`BundledSkill`](/cua-sdk/reference/agents#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), [`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), [`CloudOptions`](/cua-sdk/reference/image#cloudoptions-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), [`Fleet`](/cua-sdk/reference/errors#fleet), [`fleet_check_runtime`](/cua-sdk/reference/fleet/images#fleet_check_runtime), [`fleet_generate_claim_token`](/cua-sdk/reference/fleet#fleet_generate_claim_token), [`fleet_image_variant`](/cua-sdk/reference/fleet/images#fleet_image_variant), [`fleet_resolve_runtime`](/cua-sdk/reference/fleet/images#fleet_resolve_runtime), [`fleet_size_limits`](/cua-sdk/reference/fleet/images#fleet_size_limits), [`FleetBillingCard`](/cua-sdk/reference/fleet/images#fleetbillingcard-record), [`FleetBillingCredit`](/cua-sdk/reference/fleet/images#fleetbillingcredit-record), [`FleetBillingStatus`](/cua-sdk/reference/fleet/images#fleetbillingstatus-record), [`FleetClaim`](/cua-sdk/reference/fleet/claims#fleetclaim-record), [`FleetClaimOptions`](/cua-sdk/reference/fleet/claims#fleetclaimoptions-record), [`FleetGcReport`](/cua-sdk/reference/fleet#fleetgcreport-record), [`FleetManagedPool`](/cua-sdk/reference/fleet#fleetmanagedpool-record), [`FleetPool`](/cua-sdk/reference/fleet#fleetpool-record), [`FleetPoolExport`](/cua-sdk/reference/fleet#fleetpoolexport-record), [`FleetPools`](/cua-sdk/reference/fleet#fleetpools), [`FleetPoolSpec`](/cua-sdk/reference/fleet#fleetpoolspec-record), [`FleetSandbox`](/cua-sdk/reference/fleet/claims#fleetsandbox-record), [`FleetSettings`](/cua-sdk/reference/cua#fleetsettings-record), [`FleetSignedUrl`](/cua-sdk/reference/fleet/claims#fleetsignedurl-record), [`FleetSizeLimits`](/cua-sdk/reference/fleet/images#fleetsizelimits-record), [`FleetUsagePricing`](/cua-sdk/reference/fleet/images#fleetusagepricing-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), [`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), [`may_have_fleet_session`](/cua-sdk/reference/auth#may_have_fleet_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), [`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#parse_sandbox_ref), [`PersistentAgentInfo`](/cua-sdk/reference/spaces/persistent-agents#persistentagentinfo-record), [`PersistentAgentOptions`](/cua-sdk/reference/spaces/persistent-agents#persistentagentoptions-record), [`PoolOptions`](/cua-sdk/reference/fleet#pooloptions-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), [`PublicUrl`](/cua-sdk/reference/services#publicurl-record), [`qualify_sandbox_ref`](/cua-sdk/reference/sandbox#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#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), [`SandboxRefParts`](/cua-sdk/reference/sandbox#sandboxrefparts-record), [`SandboxSpec`](/cua-sdk/reference/fleet#sandboxspec-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), [`SiteLoginOptions`](/cua-sdk/reference/spaces/space#siteloginoptions-record), [`SiteLoginReport`](/cua-sdk/reference/spaces/space#siteloginreport-record), [`Space`](/cua-sdk/reference/spaces/space#space), [`SpaceAgentOptions`](/cua-sdk/reference/spaces#spaceagentoptions-record), [`SpaceAppIcon`](/cua-sdk/reference/spaces/space#spaceappicon-record), [`SpaceAppIconRequest`](/cua-sdk/reference/spaces/space#spaceappiconrequest-record), [`SpaceBashResult`](/cua-sdk/reference/spaces/space#spacebashresult-record), [`SpaceCancelOutcome`](/cua-sdk/reference/spaces#spacecanceloutcome-record), [`SpaceCreateListener`](/cua-sdk/reference/spaces#spacecreatelistener), [`SpaceCreateOptions`](/cua-sdk/reference/spaces#spacecreateoptions-record), [`SpaceCreateProgress`](/cua-sdk/reference/spaces#spacecreateprogress-record), [`SpaceCreateResult`](/cua-sdk/reference/spaces#spacecreateresult-record), [`SpaceDisplay`](/cua-sdk/reference/spaces/space#spacedisplay-record), [`SpaceHotspotStatus`](/cua-sdk/reference/spaces/space#spacehotspotstatus-record), [`SpaceInfo`](/cua-sdk/reference/spaces#spaceinfo-record), [`SpacePowerReport`](/cua-sdk/reference/spaces#spacepowerreport-record), [`SpacePresence`](/cua-sdk/reference/spaces/streams#spacepresence), [`SpaceRelayRegistration`](/cua-sdk/reference/spaces/space#spacerelayregistration-record), [`SpaceResources`](/cua-sdk/reference/spaces/resources#spaceresources-record), [`Spaces`](/cua-sdk/reference/spaces#spaces), [`spaces_tool_methods`](/cua-sdk/reference/spaces#spaces_tool_methods), [`SpacesdClient`](/cua-sdk/reference/spacesd#spacesdclient), [`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#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/space#spaceshost-record), [`SpacesHostLimit`](/cua-sdk/reference/spaces/space#spaceshostlimit-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), [`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).## Typesdiff --git a/docs/content/docs/cua-sdk/reference/types.mdx b/docs/content/docs/cua-sdk/reference/types.mdxindex 9d6322d452..e8bac7d93e 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-292 items. Methods are listed on their object.+298 items. Methods are listed on their object.The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/reference/spaces/resources#all-items).@@ -321,8 +321,12 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref| [`SpaceWriteReport`](/cua-sdk/reference/spaces/space#spacewritereport-record) | record | Result of `Space.write`. || [`StorageVolume`](/cua-sdk/reference/cua#storagevolume-record) | record | Space on the volume a local engine writes to. || [`StreamStatsReport`](/cua-sdk/reference/auth#streamstatsreport-record) | record | One stream session's aggregate stats (sampled). |+| [`telemetry_acknowledge_link_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_link_notice) | function | The person closed the linking notice (either button). || [`telemetry_acknowledge_notice`](/cua-sdk/reference/auth#telemetry_acknowledge_notice) | function | Records that the first-run notice was shown in the app's UI (nothing is sent from a machine before that). || [`telemetry_flush`](/cua-sdk/reference/auth#telemetry_flush) | function | Sends queued events now, waiting at most `timeout_ms`; anything left is kept on disk for a later process. |+| [`telemetry_link_notice`](/cua-sdk/reference/auth#telemetry_link_notice) | function | The one-time linking notice's words. |+| [`telemetry_link_notice_due`](/cua-sdk/reference/auth#telemetry_link_notice_due) | function | Whether the app should show the one-time linking notice now: usage data is on, the account offered linking, and this machine has not shown it. |+| [`telemetry_link_state`](/cua-sdk/reference/auth#telemetry_link_state) | function | Where linking stands: `off`, `not_offered`, `notice_due` or `linked`. || [`telemetry_notice_text`](/cua-sdk/reference/auth#telemetry_notice_text) | function | The first-run notice text (an app shows it in its own UI, then calls `telemetry_acknowledge_notice`). || [`telemetry_record_bench_run`](/cua-sdk/reference/auth#telemetry_record_bench_run) | function | Records a finished cua-bench run: the taskset (catalog name, else `custom`), the aggregate success rate (0 to 1, bucketed), the task count (bucketed) and the outcome (`ok`, `error`, `cancelled`). || [`telemetry_record_feature`](/cua-sdk/reference/auth#telemetry_record_feature) | function | Records use of a Spaces app feature (fixed names: `space_create_local`, `teleport_drop`, ... see the docs). |@@ -334,7 +338,9 @@ The 11 items of Processor, memory and disk are listed on [its page](/cua-sdk/ref| [`telemetry_set_surface`](/cua-sdk/reference/auth#telemetry_set_surface) | function | Names the SDK surface events are attributed to. || [`telemetry_show_last`](/cua-sdk/reference/auth#telemetry_show_last) | function | The last `limit` events queued or sent from this machine, exactly as sent, as JSON (`[{status, payload}]`). || [`telemetry_status`](/cua-sdk/reference/auth#telemetry_status) | function | Telemetry state, and exactly what every event carries. |+| [`telemetry_sync_account`](/cua-sdk/reference/auth#telemetry_sync_account) | function | Asks the Spaces API for the signed-in account's opaque id and hands it to telemetry (none unlinks). || [`telemetry_use_app_notice`](/cua-sdk/reference/auth#telemetry_use_app_notice) | function | The host app shows the first-run notice itself (no stderr notice). |+| [`TelemetryLinkNotice`](/cua-sdk/reference/auth#telemetrylinknotice-record) | record | The one-time notice for machines that saw the older "anonymous" wording, shown before anything is linked to the account. || [`TelemetryStatus`](/cua-sdk/reference/auth#telemetrystatus-record) | record | Telemetry state. || [`TeleportApprover`](/cua-sdk/reference/spaces/space#teleportapprover) | object | The consent gate of `Space.teleport`: shown the manifest, returns the human's decision, or `None` to cancel. || [`TeleportDecision`](/cua-sdk/reference/spaces/space#teleportdecision-record) | record | A human's answer to a teleport manifest. |diff --git a/libs/cua/crates/cua-cli/src/auth.rs b/libs/cua/crates/cua-cli/src/auth.rsindex 9b260b888f..e643f418f1 100644--- a/libs/cua/crates/cua-cli/src/auth.rs+++ b/libs/cua/crates/cua-cli/src/auth.rs@@ -100,6 +100,7 @@ pub async fn login(opts: &LoginOptions, out: &mut dyn Write) -> Result<i32, CuaE// Activation funnel: a sign-in from the CLI (browser or device code)// counts like one in the Spaces app's first run.cua_telemetry::global().capture_step("signed_in", cua_telemetry::Outcome::Ok);+ link_usage(&s).await;let who = match (&id.username, &id.email) {(Some(u), Some(e)) if u != e => format!(" as {u} ({e})"),(Some(u), _) | (None, Some(u)) => format!(" as {u}"),@@ -109,9 +110,43 @@ pub async fn login(opts: &LoginOptions, out: &mut dyn Write) -> Result<i32, CuaEOk(0)}+/// Links this install's usage data to the signed-in account when the+/// Spaces API offers an account id (CUA-1881), and prints the one-time+/// notice when this machine saw only the older "anonymous" notice. Best+/// effort: a sign-in never fails or waits long on it.+async fn link_usage(s: &cua_auth::Session) {+ let t = cua_telemetry::global();+ if !t.is_enabled() {+ return;+ }+ let Ok(Ok(token)) =+ tokio::time::timeout(std::time::Duration::from_secs(5), s.access_token(false)).await+ else {+ return;+ };+ let Ok(api) = SpacesApiClient::current() else {+ return;+ };+ if let Ok(Ok(me)) =+ tokio::time::timeout(std::time::Duration::from_secs(5), api.me(&token)).await+ {+ offer_account(&me);+ }+}++/// Hands the account id `GET /v1/me` answered with (or its absence) to+/// telemetry, then shows the linking notice if it is due.+fn offer_account(me: &cua_host::spaces_api::ApiMe) {+ let t = cua_telemetry::global();+ t.offer_account(me.analytics_id.as_deref());+ t.show_notice_if_needed();+}+/// `cua auth logout`.pub async fn logout(out: &mut dyn Write) -> Result<i32, CuaError> {let (existed, revoked) = session().logout().await.map_err(auth_err)?;+ // Signed out: usage data goes back to a new anonymous install id.+ let _ = cua_telemetry::global().forget_account();if !existed {line(out, "Not logged in.");return Ok(0);@@ -226,7 +261,10 @@ pub async fn whoami_with(// failure (offline, a server error, no Teams routes yet) only costs the// plan and team count.let me = match api.me(token).await {- Ok(me) => Some(me),+ Ok(me) => {+ offer_account(&me);+ Some(me)+ }Err(e @ (E::Unauthenticated(_) | E::PermissionDenied(_))) => {return Err(CuaError::Unauthenticated(format!("your Cua sign-in is no longer valid ({e}); run 'cua auth login' again"diff --git a/libs/cua/crates/cua-cli/src/telemetry_cmd.rs b/libs/cua/crates/cua-cli/src/telemetry_cmd.rsindex 98bf114c4e..d0fd648fd6 100644--- a/libs/cua/crates/cua-cli/src/telemetry_cmd.rs+++ b/libs/cua/crates/cua-cli/src/telemetry_cmd.rs@@ -83,6 +83,18 @@ pub fn run(cmd: TelemetryCmd, json: bool, out: &mut dyn Write) -> Result<i32, Cu);line(out, format!("Endpoint: {}", s.endpoint));line(out, format!("First-run notice shown: {}", s.notice_shown));+ line(+ out,+ format!(+ "Linked to your account: {}",+ match s.link.as_str() {+ "linked" => "yes (an opaque account id while signed in)",+ "notice_due" => "not yet (the notice shows first)",+ "off" => "no (usage data is off)",+ _ => "no",+ }+ ),+ );line(out, format!("Offline spool: {} events", s.spooled));line(out, format!("State: {}", s.state_dir));line(diff --git a/libs/cua/crates/cua-cli/tests/telemetry.rs b/libs/cua/crates/cua-cli/tests/telemetry.rsindex b2289ea020..d473ca7420 100644--- a/libs/cua/crates/cua-cli/tests/telemetry.rs+++ b/libs/cua/crates/cua-cli/tests/telemetry.rs@@ -11,7 +11,7 @@ fn enabled_home() -> Home {h}-const NOTICE: &str = "Cua collects anonymous usage data";+const NOTICE: &str = "Cua collects usage data to help improve it";#[tokio::test]async fn notice_once_then_events_that_show_last_prints_without_arguments() {diff --git a/libs/cua/crates/cua-host/src/spaces_api.rs b/libs/cua/crates/cua-host/src/spaces_api.rsindex 4b48032028..38a200ea4d 100644--- a/libs/cua/crates/cua-host/src/spaces_api.rs+++ b/libs/cua/crates/cua-host/src/spaces_api.rs@@ -177,6 +177,11 @@ pub struct ApiMe {pub orgs: Vec<ApiOrg>,#[serde(default)]pub entitlements: ApiEntitlements,+ /// The opaque account id usage data is linked to (`acct_` and 32 hex,+ /// never the email or the subject). Absent while linking is off on the+ /// server (`SPACES_CP_LINK_USAGE`), so no client links anything then.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub analytics_id: Option<String>,}/// The parts of the entitlements the apps read. Unknown plans mean freediff --git a/libs/cua/crates/cua-sdk/src/native/auth.rs b/libs/cua/crates/cua-sdk/src/native/auth.rsindex adace45493..5f1e6abb74 100644--- a/libs/cua/crates/cua-sdk/src/native/auth.rs+++ b/libs/cua/crates/cua-sdk/src/native/auth.rs@@ -134,6 +134,8 @@ impl LoginAttempt {let creds = pending.complete().await?;let who = self.session.install(creds).await?;enroll_after_sign_in(&self.session).await;+ #[cfg(feature = "host")]+ super::telemetry::sync_account(&self.session).await;Ok(who.into())}).await@@ -265,11 +267,14 @@ impl Auth {run(async move { Ok(session.access_token(force).await?) }).await}- /// Revokes (best effort) and removes the session. Returns whether one- /// existed.+ /// Revokes (best effort) and removes the session, and unlinks usage+ /// data from the account. Returns whether one existed.pub async fn logout(&self) -> Result<bool> {let session = self.session.clone();- run(async move { Ok(session.logout().await?.0) }).await+ let existed = run(async move { Ok(session.logout().await?.0) }).await?;+ // Signed out: usage data goes back to a new anonymous install id.+ let _ = cua_telemetry::global().forget_account();+ Ok(existed)}}diff --git a/libs/cua/crates/cua-sdk/src/native/telemetry.rs b/libs/cua/crates/cua-sdk/src/native/telemetry.rsindex 19d48b4a73..7ea758eb83 100644--- a/libs/cua/crates/cua-sdk/src/native/telemetry.rs+++ b/libs/cua/crates/cua-sdk/src/native/telemetry.rs@@ -119,6 +119,91 @@ pub fn telemetry_use_app_notice() {t().set_notice_mode(cua_telemetry::NoticeMode::External);}+// ---- Linking usage data to the signed-in account (CUA-1881) ------------------++/// The one-time notice for machines that saw the older "anonymous" wording,+/// shown before anything is linked to the account. Both buttons close it;+/// the second also turns usage data off.+#[derive(Debug, Clone, PartialEq, uniffi::Record)]+pub struct TelemetryLinkNotice {+ pub title: String,+ pub body: String,+ /// Keeps usage data on ("Got it").+ pub ok_label: String,+ /// Turns usage data off ("Turn off usage data").+ pub turn_off_label: String,+ /// The link to what is collected.+ pub details_label: String,+ pub docs_url: String,+}++/// The one-time linking notice's words.+#[uniffi::export]+pub fn telemetry_link_notice() -> TelemetryLinkNotice {+ use cua_telemetry::link;+ TelemetryLinkNotice {+ title: link::NOTICE_TITLE.into(),+ body: link::NOTICE_BODY.into(),+ ok_label: link::NOTICE_OK.into(),+ turn_off_label: link::NOTICE_TURN_OFF.into(),+ details_label: link::NOTICE_DETAILS.into(),+ docs_url: cua_telemetry::notice::DOCS_URL.into(),+ }+}++/// Whether the app should show the one-time linking notice now: usage data+/// is on, the account offered linking, and this machine has not shown it.+#[uniffi::export]+pub fn telemetry_link_notice_due() -> bool {+ t().link_notice_due()+}++/// The person closed the linking notice (either button). Linking starts+/// with the app's next launch, never in the process that showed it.+#[uniffi::export]+pub fn telemetry_acknowledge_link_notice() {+ t().acknowledge_link_notice();+}++/// Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.+#[uniffi::export]+pub fn telemetry_link_state() -> String {+ t().link_state().as_str().into()+}++/// Asks the Spaces API for the signed-in account's opaque id and hands it+/// to telemetry (none unlinks). Call at launch and after a sign-in; the+/// SDK's own sign-in already does. Returns the link state. Best effort:+/// offline or signed out, nothing changes.+#[cfg(feature = "host")]+#[uniffi::export]+pub async fn telemetry_sync_account() -> String {+ let _ = crate::native::run(async {+ sync_account(&cua_auth::Session::from_env()).await;+ Ok(())+ })+ .await;+ telemetry_link_state()+}++/// [`telemetry_sync_account`] for `session`.+#[cfg(feature = "host")]+pub(crate) async fn sync_account(session: &cua_auth::Session) {+ if !t().is_enabled() {+ return;+ }+ let budget = Duration::from_secs(10);+ let Ok(Ok(token)) = tokio::time::timeout(budget, session.access_token(false)).await else {+ return;+ };+ let Ok(api) = cua_host::spaces_api::SpacesApiClient::current() else {+ return;+ };+ if let Ok(Ok(me)) = tokio::time::timeout(budget, api.me(&token)).await {+ t().offer_account(me.analytics_id.as_deref());+ }+}+/// Records use of a Spaces app feature (fixed names: `space_create_local`,/// `teleport_drop`, ... see the docs). Returns whether it was queued;/// unknown names are dropped.diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.jsonindex 1c6246bc58..c1f73f02b3 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/experiments.json@@ -75,8 +75,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [],@@ -191,8 +191,8 @@"- mount choice: Add Cua Volume to Finder {*On|Off}","- mount-path text: In Finder at = ~/Cua Volume [Show in Finder] ?/Users/maya/Cua Volume < /Users/maya/Cua Volume>","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [@@ -320,8 +320,8 @@"- mount choice: Add Cua Volume to Finder {*On|Off}","- mount-path text: In Finder at = ~/Cua Volume [Show in Finder] ?/Users/maya/Cua Volume < /Users/maya/Cua Volume>","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [@@ -453,8 +453,8 @@"- mount choice: Add Cua Volume to Finder {*On|Off}","- mount-path text: In Finder at = ~/Cua Volume [Show in Finder] ?/Users/maya/Cua Volume < /Users/maya/Cua Volume>","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [],@@ -572,8 +572,8 @@"- mount choice: Add Cua Volume to Finder {*On|Off}","- mount-path text: In Finder at = ~/Cua Volume [Show in Finder] ?/Users/maya/Cua Volume < /Users/maya/Cua Volume>","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [],@@ -691,8 +691,8 @@"- mount choice: Add Cua Volume to Finder {*On|Off}","- mount-path text: In Finder at = ~/Cua Volume [Show in Finder] ?/Users/maya/Cua Volume < /Users/maya/Cua Volume>","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [],@@ -803,8 +803,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [@@ -928,8 +928,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [@@ -1048,8 +1048,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [@@ -1166,8 +1166,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [@@ -1286,8 +1286,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"signals": [diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.jsonindex e7a4790040..8dc714cc2a 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/main-window.json@@ -693,8 +693,8 @@"- notch choice: Spaces tab in the notch {Show|*Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {On|*Off} (disabled) ?Set by DO_NOT_TRACK",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {On|*Off} (disabled) ?Set by DO_NOT_TRACK",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents] (disabled)"],"settings": 1@@ -712,8 +712,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configure all detected agents]","- agent:codex text: Codex = skills and MCP configured [Remove]","- agent:cursor text: Cursor = working…",@@ -736,8 +736,8 @@"- notch choice: Spaces tab in the notch {*Show|Hide}","- welcome text: Welcome [Show again]","# Privacy (privacy)",- "- telemetry choice: Share anonymous usage data {*On|Off}",- "- telemetry-note note: Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>",+ "- telemetry choice: Share usage data to help improve Cua {*On|Off}",+ "- telemetry-note note: Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen. <What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry>","# AI agents (agents) [Configuring…] (disabled)","- agent:codex text: Codex = skills and MCP configured [Remove] (disabled)","- agent:cursor text: Cursor = skills 1/3, MCP not configured [Configure] (disabled)",@@ -756,7 +756,7 @@"drive": null,"driveStorage": null,"lede": "Computers for you and your agents.",- "notice": "Cua collects anonymous usage data (features used, sandbox types, durations, error categories), never file paths, names, prompts or screen content. Change it here or in Settings, Privacy.",+ "notice": "Cua collects usage data, like which features you use and when something goes wrong. When you're signed in, it's linked to your account through a random ID. Never your files, what you type or your screen. Change this here or in Settings, Privacy.","noticeLink": "What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry","presentations": [],"primary": "Get started",@@ -766,7 +766,7 @@"summary": [],"title": "Welcome to Cua Spaces","todos": [],- "usage": "Share anonymous usage data [x]"+ "usage": "Share usage data to help improve Cua [x]"},"onboarding": "initial"},@@ -779,7 +779,7 @@"drive": null,"driveStorage": null,"lede": "Computers for you and your agents.",- "notice": "Cua collects anonymous usage data (features used, sandbox types, durations, error categories), never file paths, names, prompts or screen content. Change it here or in Settings, Privacy.",+ "notice": "Cua collects usage data, like which features you use and when something goes wrong. When you're signed in, it's linked to your account through a random ID. Never your files, what you type or your screen. Change this here or in Settings, Privacy.","noticeLink": "What is collected https://cua.ai/docs/cua-sdk/concepts/telemetry","presentations": [],"primary": "Get started",@@ -789,7 +789,7 @@"summary": [],"title": "Welcome to Cua Spaces","todos": [],- "usage": "Share anonymous usage data [x]"+ "usage": "Share usage data to help improve Cua [x]"},"onboarding": "cli-installed"},diff --git a/libs/cua/crates/cua-spaces-app-core/src/lib.rs b/libs/cua/crates/cua-spaces-app-core/src/lib.rsindex f4427375d9..1f32b1a614 100644--- a/libs/cua/crates/cua-spaces-app-core/src/lib.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/lib.rs@@ -47,7 +47,7 @@//! | [`share`] | who a Space is shared with (viewer or editor) and the Share sheet |//! | `installer` | the "Command line" step: plan and install the bundled `cua` (feature `installer`) |//! | [`agents`] | coding agent runs (labels, order, filter) and the agents on this machine (Settings rows, setup summary) |-//! | [`telemetry`] | which anonymous usage events a UI step means, and sending them (feature `telemetry`) |+//! | [`telemetry`] | which usage events a UI step means, and sending them (feature `telemetry`) |//! | [`presence`] | the name and principal id the apps join a Space's presence as |//! | [`paths`] | home-relative paths |//! | [`errors`] | the words a failed action shows (a dead daemon in plain words) |diff --git a/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs b/libs/cua/crates/cua-spaces-app-core/src/onboarding.rsindex 986dc70999..431c78d093 100644--- a/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/onboarding.rs@@ -206,7 +206,7 @@ pub struct OnboardingState {#[serde(default = "ticked")]pub launch_at_login: bool,/// The usage-data switch on Welcome: the machine's telemetry setting- /// (Settings' "Share anonymous usage data", `cua telemetry off`), none+ /// (Settings' "Share usage data to help improve Cua", `cua telemetry off`), none/// until the shell read it (then it shows on).#[serde(default)]pub telemetry: Option<TelemetryInput>,@@ -355,7 +355,7 @@ pub enum OnboardingAction {/// On a machine that already showed the usage notice, with usage data/// on, the run's start counts now rather than when Welcome is left.WelcomeShown,- /// Welcome's "Share anonymous usage data" switch (not while the+ /// Welcome's "Share usage data to help improve Cua" switch (not while the/// environment decides). The shell writes the setting.UsageDataToggled {/// On.@@ -1007,11 +1007,11 @@ fn drive_fact(s: &OnboardingState) -> String {}/// One answer on the This machine page.-/// Welcome's "Share anonymous usage data" switch.+/// Welcome's "Share usage data to help improve Cua" switch.#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]#[serde(rename_all = "camelCase")]pub struct UsageToggle {- /// "Share anonymous usage data".+ /// "Share usage data to help improve Cua".pub label: String,/// On.pub on: bool,@@ -1417,7 +1417,7 @@ pub fn view_for(s: &OnboardingState, os: SpaceOs, cli_page: bool) -> OnboardingVvec![]},notice: (s.step == Welcome).then(|| {- "Cua collects anonymous usage data (features used, sandbox types, durations, error categories), never file paths, names, prompts or screen content. Change it here or in Settings, Privacy."+ "Cua collects usage data, like which features you use and when something goes wrong. When you're signed in, it's linked to your account through a random ID. Never your files, what you type or your screen. Change this here or in Settings, Privacy.".into()}),notice_link_label: (s.step == Welcome).then(|| "What is collected".into()),@@ -1429,7 +1429,7 @@ pub fn view_for(s: &OnboardingState, os: SpaceOs, cli_page: bool) -> OnboardingV.and_then(|t| t.locked_by.clone()).filter(|b| !b.is_empty());UsageToggle {- label: "Share anonymous usage data".into(),+ label: "Share usage data to help improve Cua".into(),on: s.shares_usage(),enabled: locked.is_none(),help: locked.map(|by| format!("Set by {by}")),diff --git a/libs/cua/crates/cua-spaces-app-core/src/settings.rs b/libs/cua/crates/cua-spaces-app-core/src/settings.rsindex 9e42ae62ae..865a1874a1 100644--- a/libs/cua/crates/cua-spaces-app-core/src/settings.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/settings.rs@@ -796,7 +796,7 @@ pub fn page(input: &SettingsInput) -> SettingsPage {}if let Some(t) = &input.telemetry {- let mut share = row("telemetry", Choice, "Share anonymous usage data");+ let mut share = row("telemetry", Choice, "Share usage data to help improve Cua");share.options = vec![opt("on", "On", t.enabled), opt("off", "Off", !t.enabled)];if let Some(by) = t.locked_by.clone().filter(|b| !b.is_empty()) {share.enabled = false;@@ -805,7 +805,7 @@ pub fn page(input: &SettingsInput) -> SettingsPage {let mut note = row("telemetry-note",Note,- "Features used, sandbox types, durations and error categories. Never paths, names, prompts, screen content or Keyvault items.",+ "Which features you use and when something goes wrong. Linked to your account through a random ID while you're signed in. Never your files, what you type or your screen.",);note.link_label = Some("What is collected".into());note.link_url = Some(TELEMETRY_DOCS_URL.into());diff --git a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rsindex 36db0c7201..05213d3c5d 100644--- a/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/telemetry.rs@@ -1,7 +1,7 @@// SPDX-License-Identifier: FSL-1.1-MIT// Copyright (c) 2026 Cua AI, Inc.-//! Which anonymous usage events a UI transition means, for both shells.+//! Which usage events a UI transition means, for both shells.//!//! The apps drive the core's reducers; these functions look at one step of//! a reducer (the state before and the action) and answer withdiff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rsindex e044d39bc4..be98211b7e 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs@@ -2471,7 +2471,8 @@ impl AppCliInstaller {// ---- Usage telemetry ------------------------------------------------------------/// The app started: attributes this process's events to `spaces_app` at-/// `version`, lets the app show the first-run notice itself (nothing is+/// `version`, links usage data to the signed-in account in the background+/// when the Spaces API offers it, lets the app show the first-run notice itself (nothing is/// sent before it has been shown once), and records `app_launched` (on a/// first run, once the notice shows). Call once at launch, before the/// first `Cua`. `onboarding_eligible`: the first run is still to finish@@ -2482,6 +2483,11 @@ pub fn app_telemetry_start(version: String, onboarding_eligible: Option<bool>) -let t = cua_telemetry::global();t.set_product("spaces_app", &version);t.set_notice_mode(cua_telemetry::NoticeMode::External);+ // Links usage data to the signed-in account when the Spaces API offers+ // it (CUA-1881); the SDK's sign-in does the same. Off the launch path.+ cua_sdk::support::spawn(async {+ cua_sdk::telemetry_sync_account().await;+ });core::telemetry::start_with(t, onboarding_eligible)}diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rsindex 53f0701809..0ba979d7b4 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs@@ -5594,7 +5594,7 @@ pub struct AppOnboardingState {/// shell applies it when the first run finishes.pub launch_at_login: bool,/// The usage-data switch on Welcome: the machine's telemetry setting- /// (Settings' "Share anonymous usage data", `cua telemetry off`), none+ /// (Settings' "Share usage data to help improve Cua", `cua telemetry off`), none/// until the shell read it (then it shows on).pub telemetry: Option<AppTelemetryInput>,/// Settings, Experiments: the Cua Volume page (and its Done line) only@@ -5725,7 +5725,7 @@ pub enum AppOnboardingAction {/// On a machine that already showed the usage notice, with usage data/// on, the run's start counts now rather than when Welcome is left.WelcomeShown,- /// Welcome's "Share anonymous usage data" switch (not while the+ /// Welcome's "Share usage data to help improve Cua" switch (not while the/// environment decides). The shell writes the setting.UsageDataToggled {/// On.@@ -5799,11 +5799,11 @@ pub struct AppStepDot {}/// One answer on the This machine page.-/// Welcome's "Share anonymous usage data" switch.+/// Welcome's "Share usage data to help improve Cua" switch.pub type AppUsageToggle = core::onboarding::UsageToggle;#[uniffi::remote(Record)]pub struct AppUsageToggle {- /// "Share anonymous usage data".+ /// "Share usage data to help improve Cua".pub label: String,/// On.pub on: bool,diff --git a/libs/cua/crates/cua-telemetry/src/client.rs b/libs/cua/crates/cua-telemetry/src/client.rsindex 21acd7b8bf..f3922df9c9 100644--- a/libs/cua/crates/cua-telemetry/src/client.rs+++ b/libs/cua/crates/cua-telemetry/src/client.rs@@ -15,6 +15,7 @@ use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};use crate::config::{self, Decision};use crate::events::Event;use crate::identity::{self, Identity};+use crate::link::{self, LinkState};use crate::schema;use crate::sink::{self, HttpSink, SendError, Sink};use crate::{fsutil, notice};@@ -108,6 +109,8 @@ struct Inner {first_run_checked: AtomicBool,/// This process showed the first-run notice: it sends nothing.notice_shown_here: AtomicBool,+ /// This process showed the linking notice: it links nothing.+ link_notice_shown_here: AtomicBool,}/// A telemetry client. Cheap to clone.@@ -213,6 +216,7 @@ impl Builder {background: self.background,first_run_checked: AtomicBool::new(false),notice_shown_here: AtomicBool::new(false),+ link_notice_shown_here: AtomicBool::new(false),}),}}@@ -326,16 +330,30 @@ impl Telemetry {lock(&self.inner.queue).events.clear();if let Some(dir) = self.state_dir() {fsutil::remove(&dir.join(SPOOL_FILE))?;+ // Off also stops linking; the next sign-in offers it again.+ fsutil::remove(&dir.join(link::ACCOUNT_FILE))?;+ fsutil::remove(&dir.join(link::LINKED_FILE))?;}}Ok(path)}- /// Deletes the install id and salt; the next event gets new ones.+ /// Deletes the install id and salt; the next event gets new ones. It+ /// also unlinks the account (the next sign-in offers it again).pub fn reset_id(&self) -> std::io::Result<Vec<PathBuf>> {*lock(&self.inner.identity) = None;match self.state_dir() {- Some(dir) => identity::reset(&dir),+ Some(dir) => {+ let mut removed = identity::reset(&dir)?;+ for f in [link::ACCOUNT_FILE, link::LINKED_FILE] {+ let p = dir.join(f);+ if p.exists() {+ fsutil::remove(&p)?;+ removed.push(p);+ }+ }+ Ok(removed)+ }None => Ok(vec![]),}}@@ -347,27 +365,184 @@ impl Telemetry {}/// Records that the notice was shown (the app calls this after showing- /// it in its UI).+ /// it in its UI). The first-run notice says that a signed-in install's+ /// usage data is linked to its account, so a machine that sees it for+ /// the first time has also seen the linking notice. A machine that saw+ /// an older notice gets the one-time linking notice instead.pub fn acknowledge_notice(&self) {if let Some(d) = self.state_dir() {- let _ = fsutil::create_once(&d.join(notice::MARKER), b"1\n");+ let marker = d.join(notice::MARKER);+ let fresh = !marker.exists();+ let _ = fsutil::create_once(&marker, b"1\n");+ if fresh {+ let _ = fsutil::create_once(&d.join(link::NOTICE_MARKER), b"1\n");+ }+ }+ }++ /// Whether this machine showed the linking notice.+ pub fn link_notice_shown(&self) -> bool {+ self.state_dir()+ .is_some_and(|d| d.join(link::NOTICE_MARKER).exists())+ }++ /// Records that the one-time linking notice was shown (the app calls+ /// this when the person closes it, with either button). Linking starts+ /// with the next process's events, never this one's: this process+ /// keeps sending as before.+ pub fn acknowledge_link_notice(&self) {+ if let Some(d) = self.state_dir() {+ let _ = fsutil::create_once(&d.join(link::NOTICE_MARKER), b"1\n");+ }+ }++ fn read_id(&self, file: &str) -> Option<String> {+ let dir = self.state_dir()?;+ std::fs::read_to_string(dir.join(file))+ .ok()+ .map(|s| s.trim().to_string())+ .filter(|s| link::valid_account_id(s))+ }++ /// The server offered `account_id` for the signed-in account (the+ /// `analytics_id` of `GET /v1/me`), or none: not signed in, or linking+ /// is off on the server. None (or anything that is not an account id)+ /// unlinks. Nothing is written while usage data is off.+ pub fn offer_account(&self, account_id: Option<&str>) -> LinkState {+ let Some(dir) = self.state_dir() else {+ return LinkState::NotOffered;+ };+ let id = account_id+ .map(str::trim)+ .filter(|id| link::valid_account_id(id));+ let Some(id) = id else {+ let _ = fsutil::remove(&dir.join(link::ACCOUNT_FILE));+ let _ = fsutil::remove(&dir.join(link::LINKED_FILE));+ return self.link_state();+ };+ if !self.is_enabled() {+ return LinkState::Off;+ }+ if self.read_id(link::ACCOUNT_FILE).as_deref() != Some(id) {+ // Another account was linked here (a sign-in without a sign-out+ // first): start from a new install id so the two never merge.+ if self.read_id(link::LINKED_FILE).is_some() {+ let _ = self.forget_account();+ }+ let _ =+ fsutil::write_replace(&dir.join(link::ACCOUNT_FILE), format!("{id}\n").as_bytes());+ }+ self.link_state()+ }++ /// Signed out: unlinks, and when something was linked, starts over with+ /// a new install id (PostHog's `reset`), so whoever signs in next on+ /// this machine is not merged with the last account.+ pub fn forget_account(&self) -> std::io::Result<()> {+ let Some(dir) = self.state_dir() else {+ return Ok(());+ };+ let was_linked = dir.join(link::LINKED_FILE).exists();+ fsutil::remove(&dir.join(link::ACCOUNT_FILE))?;+ fsutil::remove(&dir.join(link::LINKED_FILE))?;+ if was_linked {+ *lock(&self.inner.identity) = None;+ identity::reset(&dir)?;+ }+ Ok(())+ }++ /// Where linking stands on this machine.+ pub fn link_state(&self) -> LinkState {+ if !self.is_enabled() {+ return LinkState::Off;+ }+ if self.read_id(link::ACCOUNT_FILE).is_none() {+ return LinkState::NotOffered;}+ if !self.link_notice_shown() {+ return LinkState::NoticeDue;+ }+ LinkState::Linked+ }++ /// Whether the app should show the one-time linking notice now.+ pub fn link_notice_due(&self) -> bool {+ self.link_state() == LinkState::NoticeDue+ }++ /// The account id events from this process carry, if linked.+ fn linked_account(&self) -> Option<String> {+ if self.inner.link_notice_shown_here.load(Ordering::SeqCst) || !self.link_notice_shown() {+ return None;+ }+ let account = self.read_id(link::ACCOUNT_FILE)?;+ (self.read_id(link::LINKED_FILE).as_deref() == Some(account.as_str())).then_some(account)+ }++ /// Sends `$identify` once for an offered account whose notice was+ /// shown: merges this install's events into the account.+ fn identify_if_needed(&self) {+ if self.inner.link_notice_shown_here.load(Ordering::SeqCst) || !self.link_notice_shown() {+ return;+ }+ let Some(account) = self.read_id(link::ACCOUNT_FILE) else {+ return;+ };+ if self.read_id(link::LINKED_FILE).as_deref() == Some(account.as_str()) {+ return;+ }+ let Some(dir) = self.state_dir() else { return };+ let identity = self.identity();+ let payload = serde_json::json!({+ "event": "$identify",+ "distinct_id": account,+ "uuid": random_uuid(),+ "timestamp": rfc3339(SystemTime::now()),+ "properties": {+ "$anon_distinct_id": identity.id,+ "product": self.product(),+ "$geoip_disable": true,+ "$lib": "cua-telemetry",+ "$lib_version": env!("CARGO_PKG_VERSION"),+ },+ });+ if fsutil::write_replace(+ &dir.join(link::LINKED_FILE),+ format!("{account}\n").as_bytes(),+ )+ .is_err()+ {+ return;+ }+ self.enqueue(payload);}/// Shows the first-run notice on stderr if it has not been shown and/// telemetry is on. Returns whether it printed. The CLI calls this at/// startup; SDK processes get it on their first event.pub fn show_notice_if_needed(&self) -> bool {- if !self.is_enabled() || self.notice_shown() {+ if !self.is_enabled() {return false;}if *lock(&self.inner.notice_mode) == NoticeMode::External {return false;}- eprintln!("{}", notice::TEXT);- self.acknowledge_notice();- self.inner.notice_shown_here.store(true, Ordering::SeqCst);- true+ if !self.notice_shown() {+ eprintln!("{}", notice::TEXT);+ self.acknowledge_notice();+ self.inner.notice_shown_here.store(true, Ordering::SeqCst);+ return true;+ }+ if self.link_notice_due() {+ eprintln!("{}", link::NOTICE_TEXT);+ self.acknowledge_link_notice();+ self.inner+ .link_notice_shown_here+ .store(true, Ordering::SeqCst);+ return true;+ }+ false}fn identity(&self) -> Identity {@@ -480,6 +655,7 @@ impl Telemetry {return Captured::NoticePending;}self.record_first_run();+ self.identify_if_needed();self.capture_inner(event)}@@ -508,10 +684,15 @@ impl Telemetry {if let Err(e) = schema::validate(event.name, &props) {return Captured::Invalid(e.to_string());}- let identity = self.identity();+ let account = self.linked_account();+ if account.is_some() {+ // A linked event belongs to the account's person in PostHog.+ props.insert("$process_person_profile".into(), Value::Bool(true));+ }+ let distinct_id = account.unwrap_or_else(|| self.identity().id);let payload = serde_json::json!({"event": event.name,- "distinct_id": identity.id,+ "distinct_id": distinct_id,"uuid": random_uuid(),"timestamp": rfc3339(SystemTime::now()),"properties": props,@@ -524,6 +705,11 @@ impl Telemetry {{eprintln!("[cua telemetry] {payload}");}+ self.enqueue(payload);+ Captured::Queued+ }++ fn enqueue(&self, payload: Value) {self.log_last(&payload, "queued");{let mut q = lock(&self.inner.queue);@@ -534,7 +720,6 @@ impl Telemetry {}self.start_sender();self.inner.cond.notify_all();- Captured::Queued}/// Records `cua_first_run` once per install (after the notice).@@ -926,7 +1111,7 @@ impl Telemetry {.is_some_and(|t| t >= oldest.as_str())&& v["event"].as_str()- .is_some_and(|e| schema::spec(e).is_some())+ .is_some_and(|e| e == "$identify" || schema::spec(e).is_some())}).collect()}@@ -957,6 +1142,7 @@ impl Telemetry {.and_then(|d| Identity::peek(&d)).map(|i| identity::redact(&i)),notice_shown: self.notice_shown(),+ link: self.link_state().as_str().to_string(),endpoint: self.endpoint(),product: self.product().to_string(),state_dir: self@@ -985,6 +1171,9 @@ pub struct Status {/// First 8 characters of the install id, if one exists.pub install_id: Option<String>,pub notice_shown: bool,+ /// Whether usage data is linked to the signed-in account: `off`,+ /// `not_offered`, `notice_due` or `linked`.+ pub link: String,pub endpoint: String,pub product: String,pub state_dir: String,diff --git a/libs/cua/crates/cua-telemetry/src/lib.rs b/libs/cua/crates/cua-telemetry/src/lib.rsindex 795cd119ab..8b23c7371f 100644--- a/libs/cua/crates/cua-telemetry/src/lib.rs+++ b/libs/cua/crates/cua-telemetry/src/lib.rs@@ -1,8 +1,9 @@//! Cua product telemetry: one module for the SDK core, the bindings, the//! `cua` CLI, `cua daemon`, cua-spacesd and the Spaces app.//!-//! Usage analytics ([`client`], [`events`], [`schema`]): anonymous and-//! content-free. On by default; off with `DO_NOT_TRACK=1`,+//! Usage analytics ([`client`], [`events`], [`schema`]): content-free,+//! keyed on a random install id, and linked to an opaque account id once a+//! signed-in install has shown the linking notice ([`link`]). On by default; off with `DO_NOT_TRACK=1`,//! `CUA_TELEMETRY=0`, `cua config set telemetry off`, `cua telemetry off`//! or the Spaces app setting; off in CI unless `CUA_TELEMETRY=1`. Nothing//! is sent before the first-run notice has been shown once.@@ -11,7 +12,9 @@//! the tests in `tests/privacy.rs`: telemetry never carries file paths,//! usernames, hostnames, IPs, emails, window titles, URLs, clipboard,//! keystrokes, screenshots or prompts; identifiers are per-install salted-//! hashes or absent; nothing from the Keyvault but counts.+//! hashes, the random install id or the server's opaque account id+//! (`acct_` and 32 hex, never an email or a subject); nothing from the+//! Keyvault but counts.pub mod agent_runs;pub mod client;@@ -19,12 +22,14 @@ pub mod config;pub mod events;mod fsutil;pub mod identity;+pub mod link;pub mod notice;pub mod schema;pub mod sink;pub use client::{Captured, NoticeMode, Status, Telemetry, global, init};pub use events::{CallerKind, CallerKindSource, Event, Outcome, TeleportInfo, TeleportOutcome};+pub use link::LinkState;/// Captures `event` on the process-wide client. Never blocks, never fails.pub fn capture(event: events::Event) -> Captured {diff --git a/libs/cua/crates/cua-telemetry/src/link.rs b/libs/cua/crates/cua-telemetry/src/link.rsnew file mode 100644index 0000000000..4628f5470d--- /dev/null+++ b/libs/cua/crates/cua-telemetry/src/link.rs@@ -0,0 +1,112 @@+//! Linking a signed-in install's usage data to its Cua account (CUA-1881).+//!+//! The Spaces API hands a signed-in client an opaque account id+//! (`analytics_id` on `GET /v1/me`): `acct_` and 32 hex, an HMAC of the+//! account the server keeps to itself. It is never the email, the name or+//! the Keycloak subject. The server only hands it out while linking is+//! turned on there (`SPACES_CP_LINK_USAGE`), so that flag is the one switch+//! for every client: with it off, no client links anything.+//!+//! On the client, linking happens only when all of these hold:+//!+//! - usage data is on (every opt-out still wins);+//! - the server offered an account id ([`crate::Telemetry::offer_account`]);+//! - this machine showed the linking notice once: the first-run notice of a+//! new install (it says so), or the one-time notice existing installs get+//! ([`crate::Telemetry::acknowledge_link_notice`]);+//! - the process that showed the notice is not the one sending.+//!+//! Then the next event sends one PostHog `$identify` (`distinct_id` the+//! account id, `$anon_distinct_id` the install id), which merges the+//! install's events into the account, and later events carry the account+//! id. Signing out ([`crate::Telemetry::forget_account`]) goes back to a new+//! anonymous install id, like PostHog's `reset`.+//!+//! State lives next to the install id in `$CUA_HOME/telemetry/`.++/// The account id the server offered (one line).+pub const ACCOUNT_FILE: &str = "account";+/// The account id `$identify` was sent for (one line).+pub const LINKED_FILE: &str = "linked";+/// Marker: this machine showed the linking notice.+pub const NOTICE_MARKER: &str = "link_notice_shown";++/// The one-time notice for installs that saw the older "anonymous" wording,+/// as the CLI prints it. The app shows [`NOTICE_TITLE`] and [`NOTICE_BODY`].+pub const NOTICE_TEXT: &str = "\+We've updated how usage data works. Cua collects usage data, like which features+you use and when something goes wrong. Until now, it wasn't connected to your+account. Now, when you're signed in, it's linked to your account through a+random ID, so we can see where people get stuck and fix it. We never see your+files, what you type or your screen.+ Turn it off: cua telemetry off+ What is collected: https://cua.ai/docs/cua-sdk/concepts/telemetry";++/// The app's one-time notice: title.+pub const NOTICE_TITLE: &str = "We've updated how usage data works";+/// The app's one-time notice: body.+pub const NOTICE_BODY: &str = "Cua collects usage data, like which features you use and when something goes wrong. Until now, it wasn't connected to your account. Now, when you're signed in, it's linked to your account through a random ID, so we can see where people get stuck and fix it. We never see your files, what you type or your screen. You can turn it off at any time.";+/// The app's one-time notice: the button that keeps usage data on.+pub const NOTICE_OK: &str = "Got it";+/// The app's one-time notice: the button that turns usage data off.+pub const NOTICE_TURN_OFF: &str = "Turn off usage data";+/// The app's one-time notice: the link to the docs page.+pub const NOTICE_DETAILS: &str = "What is collected";++/// Whether `id` is an account id the server mints: `acct_` and 32 lowercase+/// hex. Anything else (an email, a subject, a name) is refused.+pub fn valid_account_id(id: &str) -> bool {+ id.len() == 37+ && id.starts_with("acct_")+ && id[5..]+ .bytes()+ .all(|b| matches!(b, b'0'..=b'9' | b'a'..=b'f'))+}++/// Where linking stands on this machine.+#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]+#[serde(rename_all = "snake_case")]+pub enum LinkState {+ /// Usage data is off: nothing is linked or sent.+ Off,+ /// Not signed in, or the server does not offer linking.+ NotOffered,+ /// Offered, but this machine has not shown the linking notice yet.+ NoticeDue,+ /// Linked: events carry the account id.+ Linked,+}++impl LinkState {+ /// Short name (`off`, `not_offered`, `notice_due`, `linked`).+ pub fn as_str(self) -> &'static str {+ match self {+ LinkState::Off => "off",+ LinkState::NotOffered => "not_offered",+ LinkState::NoticeDue => "notice_due",+ LinkState::Linked => "linked",+ }+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn only_server_minted_ids_pass() {+ assert!(valid_account_id("acct_0123456789abcdef0123456789abcdef"));+ for bad in [+ "",+ "acct_",+ "acct_0123456789ABCDEF0123456789abcdef",+ "acct_0123456789abcdef0123456789abcde",+ "acct_0123456789abcdef0123456789abcdef0",+ "user_0123456789abcdef0123456789abcdef",+ "[email protected]",+ "f3c1a2b4-1111-2222-3333-444455556666",+ ] {+ assert!(!valid_account_id(bad), "{bad}");+ }+ }+}diff --git a/libs/cua/crates/cua-telemetry/src/notice.rs b/libs/cua/crates/cua-telemetry/src/notice.rsindex e75d3191a9..c9269f4612 100644--- a/libs/cua/crates/cua-telemetry/src/notice.rs+++ b/libs/cua/crates/cua-telemetry/src/notice.rs@@ -10,9 +10,10 @@ pub const MARKER: &str = "notice_shown";/// The notice, as printed.pub const TEXT: &str = "\-Cua collects anonymous usage data: which commands and features are used, sandbox-types, durations and error categories. Never file paths, names, hostnames, IPs,-prompts, screen content or anything from your Keyvault. Nothing has been sent yet.+Cua collects usage data to help improve it: which commands and features you use,+how long things take and what kind of errors happen. If you sign in, it's linked+to your Cua account through a random ID. Never your files, file paths, names,+what you type, your screen or anything from your Keyvault. Nothing has been sent yet.Turn it off: cua telemetry off (or DO_NOT_TRACK=1, or CUA_TELEMETRY=0)See what is sent: cua telemetry show-lastDetails: https://cua.ai/docs/cua-sdk/concepts/telemetry";diff --git a/libs/cua/crates/cua-telemetry/tests/link.rs b/libs/cua/crates/cua-telemetry/tests/link.rsnew file mode 100644index 0000000000..5897cb98c9--- /dev/null+++ b/libs/cua/crates/cua-telemetry/tests/link.rs@@ -0,0 +1,268 @@+//! Linking a signed-in install's usage data to its opaque account id+//! (CUA-1881): only with usage data on, only for an id the server minted,+//! never before the machine showed the linking notice, never from the+//! process that showed it, and undone by signing out, the opt-out or the+//! server no longer offering it.++use cua_telemetry::events::{self, Outcome};+use cua_telemetry::sink::MemorySink;+use cua_telemetry::{LinkState, NoticeMode, Telemetry, link, notice};+use serde_json::Value;+use std::path::Path;+use std::sync::Arc;+use std::time::Duration;++const ACCT: &str = "acct_0123456789abcdef0123456789abcdef";+const OTHER: &str = "acct_fedcba9876543210fedcba9876543210";++fn client(home: &Path, mode: NoticeMode) -> (Telemetry, Arc<MemorySink>) {+ let sink = Arc::new(MemorySink::new());+ let t = Telemetry::builder()+ .env(|k| (k == "CUA_TELEMETRY_FORBID_NETWORK").then(|| "1".into()))+ .home(home)+ .sink(sink.clone())+ .product("cli", "1.2.3")+ .notice_mode(mode)+ .foreground()+ .build();+ (t, sink)+}++fn send(t: &Telemetry) {+ t.capture(events::sandbox_deleted("local", Outcome::Ok, None));+ t.flush(Duration::from_secs(1));+}++fn install_id(home: &Path) -> String {+ std::fs::read_to_string(home.join("telemetry").join("install_id"))+ .unwrap()+ .trim()+ .to_string()+}++fn named<'a>(events: &'a [Value], name: &str) -> Vec<&'a Value> {+ events.iter().filter(|e| e["event"] == name).collect()+}++/// An install that showed the old "anonymous" notice before this release.+fn existing_install(home: &Path) {+ let dir = home.join("telemetry");+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join(notice::MARKER), "1\n").unwrap();+}++#[test]+fn without_an_offer_events_stay_on_the_install_id() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ t.acknowledge_notice();+ send(&t);+ let ev = sink.events();+ assert!(named(&ev, "$identify").is_empty());+ assert_eq!(ev[0]["distinct_id"], install_id(h.path()));+ assert_eq!(ev[0]["properties"]["$process_person_profile"], false);+ assert_eq!(t.link_state(), LinkState::NotOffered);+}++#[test]+fn a_new_install_links_once_signed_in() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ // The first-run notice says signed-in usage is linked.+ t.acknowledge_notice();+ send(&t);+ let anon = install_id(h.path());+ assert_eq!(t.offer_account(Some(ACCT)), LinkState::Linked);+ assert!(!t.link_notice_due());+ send(&t);+ send(&t);+ let ev = sink.events();+ let ids = named(&ev, "$identify");+ assert_eq!(ids.len(), 1, "one $identify: {ev:?}");+ assert_eq!(ids[0]["distinct_id"], ACCT);+ assert_eq!(ids[0]["properties"]["$anon_distinct_id"], anon.as_str());+ let deleted = named(&ev, "cua_sandbox_deleted");+ assert_eq!(deleted[0]["distinct_id"], anon.as_str());+ for e in &deleted[1..] {+ assert_eq!(e["distinct_id"], ACCT);+ assert_eq!(e["properties"]["$process_person_profile"], true);+ }+ assert_eq!(t.status().link, "linked");+}++#[test]+fn an_existing_install_waits_for_the_one_time_notice() {+ let h = tempfile::tempdir().unwrap();+ existing_install(h.path());+ let (t, sink) = client(h.path(), NoticeMode::External);+ assert_eq!(t.offer_account(Some(ACCT)), LinkState::NoticeDue);+ assert!(t.link_notice_due());+ send(&t);+ let ev = sink.events();+ assert!(+ named(&ev, "$identify").is_empty(),+ "never linked before the notice"+ );+ assert_eq!(ev[0]["distinct_id"], install_id(h.path()));++ // The app showed it and the person closed it.+ t.acknowledge_link_notice();+ assert!(!t.link_notice_due());+ send(&t);+ let ev = sink.events();+ assert_eq!(named(&ev, "$identify").len(), 1);+ assert_eq!(ev.last().unwrap()["distinct_id"], ACCT);+}++#[test]+fn the_cli_prints_the_notice_and_that_process_links_nothing() {+ let h = tempfile::tempdir().unwrap();+ existing_install(h.path());+ let (t, sink) = client(h.path(), NoticeMode::Stderr);+ t.offer_account(Some(ACCT));+ assert!(t.show_notice_if_needed(), "prints the linking notice");+ assert!(!t.show_notice_if_needed(), "once");+ send(&t);+ let ev = sink.events();+ assert!(named(&ev, "$identify").is_empty());+ assert_eq!(ev[0]["distinct_id"], install_id(h.path()));++ // The next command links.+ let (t2, sink2) = client(h.path(), NoticeMode::Stderr);+ assert!(!t2.show_notice_if_needed());+ send(&t2);+ let ev = sink2.events();+ assert_eq!(named(&ev, "$identify").len(), 1);+ assert_eq!(ev.last().unwrap()["distinct_id"], ACCT);+}++#[test]+fn the_opt_out_wins_and_unlinks() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ t.acknowledge_notice();+ t.offer_account(Some(ACCT));+ send(&t);+ t.set_enabled(false).unwrap();+ assert_eq!(t.link_state(), LinkState::Off);+ assert_eq!(t.offer_account(Some(ACCT)), LinkState::Off);+ let dir = h.path().join("telemetry");+ assert!(!dir.join(link::ACCOUNT_FILE).exists());+ assert!(!dir.join(link::LINKED_FILE).exists());+ let before = sink.events().len();+ send(&t);+ assert_eq!(sink.events().len(), before, "nothing sent while off");++ let off = tempfile::tempdir().unwrap();+ let sink = Arc::new(MemorySink::new());+ let t = Telemetry::builder()+ .env(|k| match k {+ "CUA_TELEMETRY_FORBID_NETWORK" => Some("1".into()),+ "DO_NOT_TRACK" => Some("1".into()),+ _ => None,+ })+ .home(off.path())+ .sink(sink.clone())+ .foreground()+ .build();+ t.acknowledge_notice();+ assert_eq!(t.offer_account(Some(ACCT)), LinkState::Off);+ send(&t);+ assert!(sink.events().is_empty());+ assert!(+ !off.path()+ .join("telemetry")+ .join(link::ACCOUNT_FILE)+ .exists()+ );+}++#[test]+fn only_server_minted_ids_are_linked() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ t.acknowledge_notice();+ for bad in [+ "[email protected]",+ "f3c1a2b4-1111-2222-3333-444455556666",+ "acct_XYZ",+ ] {+ assert_eq!(t.offer_account(Some(bad)), LinkState::NotOffered, "{bad}");+ }+ send(&t);+ let ev = sink.events();+ assert!(named(&ev, "$identify").is_empty());+ for e in &ev {+ assert!(!e.to_string().contains("[email protected]"));+ }+}++#[test]+fn the_server_turning_linking_off_unlinks() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ t.acknowledge_notice();+ t.offer_account(Some(ACCT));+ send(&t);+ // `GET /v1/me` without analytics_id: SPACES_CP_LINK_USAGE is off.+ assert_eq!(t.offer_account(None), LinkState::NotOffered);+ send(&t);+ let ev = sink.events();+ assert_eq!(ev.last().unwrap()["distinct_id"], install_id(h.path()));+ assert_eq!(+ ev.last().unwrap()["properties"]["$process_person_profile"],+ false+ );+}++#[test]+fn signing_out_starts_over_and_accounts_never_merge() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ t.acknowledge_notice();+ t.offer_account(Some(ACCT));+ send(&t);+ let first = install_id(h.path());+ t.forget_account().unwrap();+ send(&t);+ let second = install_id(h.path());+ assert_ne!(first, second, "a new install id after sign-out");+ assert_eq!(+ sink.events().last().unwrap()["distinct_id"],+ second.as_str()+ );++ // Another account signs in without a sign-out in between.+ t.offer_account(Some(ACCT));+ send(&t);+ let third = install_id(h.path());+ t.offer_account(Some(OTHER));+ send(&t);+ let fourth = install_id(h.path());+ assert_ne!(third, fourth);+ let ev = sink.events();+ let ids = named(&ev, "$identify");+ let last = ids.last().unwrap();+ assert_eq!(last["distinct_id"], OTHER);+ assert_eq!(last["properties"]["$anon_distinct_id"], fourth.as_str());+ for i in &ids {+ if i["distinct_id"] == OTHER {+ assert_ne!(i["properties"]["$anon_distinct_id"], third.as_str());+ }+ }+}++#[test]+fn a_spooled_identify_survives_a_failed_send() {+ let h = tempfile::tempdir().unwrap();+ let (t, sink) = client(h.path(), NoticeMode::External);+ t.acknowledge_notice();+ t.offer_account(Some(ACCT));+ sink.set_failing(true);+ send(&t);+ sink.set_failing(false);+ let (t2, sink2) = client(h.path(), NoticeMode::External);+ t2.capture(events::sandbox_deleted("local", Outcome::Ok, None));+ t2.flush(Duration::from_secs(1));+ assert_eq!(named(&sink2.events(), "$identify").len(), 1);+}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 564bfbf4c4..962f9b83d1 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@@ -837,10 +837,18 @@ external fun uniffi_cua_sdk_checksum_func_presence_text_color(): Shortexternal fun uniffi_cua_sdk_checksum_func_spaces_tool_methods(): Short+external fun uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice(+): Shortexternal fun uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice(): Shortexternal fun uniffi_cua_sdk_checksum_func_telemetry_flush(): Short+external fun uniffi_cua_sdk_checksum_func_telemetry_link_notice(+): Short+external fun uniffi_cua_sdk_checksum_func_telemetry_link_notice_due(+): Short+external fun uniffi_cua_sdk_checksum_func_telemetry_link_state(+): Shortexternal fun uniffi_cua_sdk_checksum_func_telemetry_notice_text(): Shortexternal fun uniffi_cua_sdk_checksum_func_telemetry_record_bench_run(@@ -863,6 +871,8 @@ external fun uniffi_cua_sdk_checksum_func_telemetry_show_last(): Shortexternal fun uniffi_cua_sdk_checksum_func_telemetry_status(): Short+external fun uniffi_cua_sdk_checksum_func_telemetry_sync_account(+): Shortexternal fun uniffi_cua_sdk_checksum_func_telemetry_use_app_notice(): Shortexternal fun uniffi_cua_sdk_checksum_method_agentsetup_configure_mcp(@@ -2696,10 +2706,18 @@ external fun uniffi_cua_sdk_fn_func_presence_text_color(`background`: RustBuffer): RustBuffer.ByValueexternal fun uniffi_cua_sdk_fn_func_spaces_tool_methods(uniffi_out_err: UniffiRustCallStatus,): RustBuffer.ByValue+external fun uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(uniffi_out_err: UniffiRustCallStatus,+): Unitexternal fun uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice(uniffi_out_err: UniffiRustCallStatus,): Unitexternal fun uniffi_cua_sdk_fn_func_telemetry_flush(`timeoutMs`: Int,uniffi_out_err: UniffiRustCallStatus,): Unit+external fun uniffi_cua_sdk_fn_func_telemetry_link_notice(uniffi_out_err: UniffiRustCallStatus,+): RustBuffer.ByValue+external fun uniffi_cua_sdk_fn_func_telemetry_link_notice_due(uniffi_out_err: UniffiRustCallStatus,+): Byte+external fun uniffi_cua_sdk_fn_func_telemetry_link_state(uniffi_out_err: UniffiRustCallStatus,+): RustBuffer.ByValueexternal fun uniffi_cua_sdk_fn_func_telemetry_notice_text(uniffi_out_err: UniffiRustCallStatus,): RustBuffer.ByValueexternal fun uniffi_cua_sdk_fn_func_telemetry_record_bench_run(`taskset`: RustBuffer.ByValue,`successRate`: RustBuffer.ByValue,`taskCount`: Long,`outcome`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,@@ -2722,6 +2740,8 @@ external fun uniffi_cua_sdk_fn_func_telemetry_show_last(`limit`: Int,uniffi_out_): RustBuffer.ByValueexternal fun uniffi_cua_sdk_fn_func_telemetry_status(uniffi_out_err: UniffiRustCallStatus,): RustBuffer.ByValue+external fun uniffi_cua_sdk_fn_func_telemetry_sync_account(+): Longexternal fun uniffi_cua_sdk_fn_func_telemetry_use_app_notice(uniffi_out_err: UniffiRustCallStatus,): Unitexternal fun ffi_cua_sdk_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,@@ -2960,12 +2980,24 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_func_spaces_tool_methods() != 24762.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice() != 46398.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice() != 6317.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}if (lib.uniffi_cua_sdk_checksum_func_telemetry_flush() != 29688.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_func_telemetry_link_notice() != 11798.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }+ if (lib.uniffi_cua_sdk_checksum_func_telemetry_link_notice_due() != 52419.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }+ if (lib.uniffi_cua_sdk_checksum_func_telemetry_link_state() != 28062.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_func_telemetry_notice_text() != 47486.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -2999,6 +3031,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_func_telemetry_status() != 18801.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}+ if (lib.uniffi_cua_sdk_checksum_func_telemetry_sync_account() != 61343.toShort()) {+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ }if (lib.uniffi_cua_sdk_checksum_func_telemetry_use_app_notice() != 17365.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}@@ -3107,7 +3142,7 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {if (lib.uniffi_cua_sdk_checksum_method_auth_begin_login() != 55109.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}- if (lib.uniffi_cua_sdk_checksum_method_auth_logout() != 38806.toShort()) {+ if (lib.uniffi_cua_sdk_checksum_method_auth_logout() != 42354.toShort()) {throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")}if (lib.uniffi_cua_sdk_checksum_method_auth_status() != 29264.toShort()) {@@ -6939,8 +6974,8 @@ public interface AuthInterface {suspend fun `beginLogin`(`flow`: kotlin.String?): LoginAttempt/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/suspend fun `logout`(): kotlin.Boolean@@ -7111,8 +7146,8 @@ open class Auth: Disposable, AutoCloseable, AuthInterface/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/@Throws(CuaException::class)@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")@@ -39378,6 +39413,78 @@ public object FfiConverterTypeStreamStatsReport: FfiConverterRustBuffer<StreamSt+/**+ * The one-time notice for machines that saw the older "anonymous" wording,+ * shown before anything is linked to the account. Both buttons close it;+ * the second also turns usage data off.+ */+data class TelemetryLinkNotice (+ var `title`: kotlin.String+ ,+ var `body`: kotlin.String+ ,+ /**+ * Keeps usage data on ("Got it").+ */+ var `okLabel`: kotlin.String+ ,+ /**+ * Turns usage data off ("Turn off usage data").+ */+ var `turnOffLabel`: kotlin.String+ ,+ /**+ * The link to what is collected.+ */+ var `detailsLabel`: kotlin.String+ ,+ var `docsUrl`: kotlin.String++){++++++ companion object+}++/**+ * @suppress+ */+public object FfiConverterTypeTelemetryLinkNotice: FfiConverterRustBuffer<TelemetryLinkNotice> {+ override fun read(buf: ByteBuffer): TelemetryLinkNotice {+ return TelemetryLinkNotice(+ FfiConverterString.read(buf),+ FfiConverterString.read(buf),+ FfiConverterString.read(buf),+ FfiConverterString.read(buf),+ FfiConverterString.read(buf),+ FfiConverterString.read(buf),+ )+ }++ override fun allocationSize(value: TelemetryLinkNotice) = (+ FfiConverterString.allocationSize(value.`title`) ++ FfiConverterString.allocationSize(value.`body`) ++ FfiConverterString.allocationSize(value.`okLabel`) ++ FfiConverterString.allocationSize(value.`turnOffLabel`) ++ FfiConverterString.allocationSize(value.`detailsLabel`) ++ FfiConverterString.allocationSize(value.`docsUrl`)+ )++ override fun write(value: TelemetryLinkNotice, buf: ByteBuffer) {+ FfiConverterString.write(value.`title`, buf)+ FfiConverterString.write(value.`body`, buf)+ FfiConverterString.write(value.`okLabel`, buf)+ FfiConverterString.write(value.`turnOffLabel`, buf)+ FfiConverterString.write(value.`detailsLabel`, buf)+ FfiConverterString.write(value.`docsUrl`, buf)+ }+}+++/*** Telemetry state.*/@@ -46297,6 +46404,19 @@ public object FfiConverterMapStringSequenceString: FfiConverterRustBuffer<Map<ko}+ /**+ * The person closed the linking notice (either button). Linking starts+ * with the app's next launch, never in the process that showed it.+ */ fun `telemetryAcknowledgeLinkNotice`()+ =+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(++ _status)+}+++/*** Records that the first-run notice was shown in the app's UI (nothing is* sent from a machine before that). Apps that show the notice themselves@@ -46324,6 +46444,46 @@ public object FfiConverterMapStringSequenceString: FfiConverterRustBuffer<Map<ko+ /**+ * The one-time linking notice's words.+ */ fun `telemetryLinkNotice`(): TelemetryLinkNotice {+ return FfiConverterTypeTelemetryLinkNotice.lift(+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice(++ _status)+}+ )+ }+++ /**+ * Whether the app should show the one-time linking notice now: usage data+ * is on, the account offered linking, and this machine has not shown it.+ */ fun `telemetryLinkNoticeDue`(): kotlin.Boolean {+ return FfiConverterBoolean.lift(+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice_due(++ _status)+}+ )+ }+++ /**+ * Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.+ */ fun `telemetryLinkState`(): kotlin.String {+ return FfiConverterString.lift(+ uniffiRustCall() { _status ->+ UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_state(++ _status)+}+ )+ }++/*** The first-run notice text (an app shows it in its own UI, then calls* [`telemetry_acknowledge_notice`]).@@ -46479,6 +46639,26 @@ public object FfiConverterMapStringSequenceString: FfiConverterRustBuffer<Map<ko}+ /**+ * Asks the Spaces API for the signed-in account's opaque id and hands it+ * to telemetry (none unlinks). Call at launch and after a sign-in; the+ * SDK's own sign-in already does. Returns the link state. Best effort:+ * offline or signed out, nothing changes.+ */+ @Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")+ suspend fun `telemetrySyncAccount`() : kotlin.String {+ return uniffiRustCallAsync(+ UniffiLib.uniffi_cua_sdk_fn_func_telemetry_sync_account(),+ { future, callback, continuation -> UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer(future, callback, continuation) },+ { future, continuation -> UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer(future, continuation) },+ { future -> UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer(future) },+ // lift function+ { FfiConverterString.lift(it) },+ // Error FFI converter+ UniffiNullRustCallStatusErrorHandler,+ )+ }+/*** The host app shows the first-run notice itself (no stderr notice).*/ fun `telemetryUseAppNotice`()diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.pyindex c699fb2460..28c6549ef5 100644--- a/libs/cua/python/src/cua/_native.py+++ b/libs/cua/python/src/cua/_native.py@@ -557,10 +557,18 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_spaces_tool_methods() != 24762:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice() != 46398:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice() != 6317:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_telemetry_flush() != 29688:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_func_telemetry_link_notice() != 11798:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_func_telemetry_link_notice_due() != 52419:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_func_telemetry_link_state() != 28062:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_telemetry_notice_text() != 47486:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_telemetry_record_bench_run() != 8029:@@ -583,6 +591,8 @@ def _uniffi_check_api_checksums(lib):raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_telemetry_status() != 18801:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")+ if lib.uniffi_cua_sdk_checksum_func_telemetry_sync_account() != 61343:+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_func_telemetry_use_app_notice() != 17365:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_agentrun_artifacts() != 30980:@@ -661,7 +671,7 @@ 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_auth_devices() != 36673:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")- if lib.uniffi_cua_sdk_checksum_method_auth_logout() != 38806:+ if lib.uniffi_cua_sdk_checksum_method_auth_logout() != 42354:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")if lib.uniffi_cua_sdk_checksum_method_auth_status() != 29264:raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")@@ -2259,6 +2269,10 @@ _UniffiLib.uniffi_cua_sdk_fn_func_spaces_tool_methods.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)_UniffiLib.uniffi_cua_sdk_fn_func_spaces_tool_methods.restype = _UniffiRustBuffer+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice.argtypes = (+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice.restype = None_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)@@ -2268,6 +2282,18 @@ _UniffiLib.uniffi_cua_sdk_fn_func_telemetry_flush.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_flush.restype = None+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice.argtypes = (+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice.restype = _UniffiRustBuffer+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice_due.argtypes = (+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice_due.restype = ctypes.c_int8+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_state.argtypes = (+ ctypes.POINTER(_UniffiRustCallStatus),+)+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_state.restype = _UniffiRustBuffer_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_notice_text.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)@@ -2324,6 +2350,9 @@ _UniffiLib.uniffi_cua_sdk_fn_func_telemetry_status.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_status.restype = _UniffiRustBuffer+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_sync_account.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_sync_account.restype = ctypes.c_uint64_UniffiLib.uniffi_cua_sdk_fn_func_telemetry_use_app_notice.argtypes = (ctypes.POINTER(_UniffiRustCallStatus),)@@ -4555,12 +4584,24 @@ _UniffiLib.uniffi_cua_sdk_checksum_func_sandbox_locations.restype = ctypes.c_uin_UniffiLib.uniffi_cua_sdk_checksum_func_spaces_tool_methods.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_func_spaces_tool_methods.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_flush.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_flush.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_link_notice.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_link_notice.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_link_notice_due.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_link_notice_due.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_link_state.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_link_state.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_notice_text.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_notice_text.restype = ctypes.c_uint16@@ -4594,6 +4635,9 @@ _UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_show_last.restype = ctypes.c_u_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_status.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_status.restype = ctypes.c_uint16+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_sync_account.argtypes = (+)+_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_sync_account.restype = ctypes.c_uint16_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_use_app_notice.argtypes = ()_UniffiLib.uniffi_cua_sdk_checksum_func_telemetry_use_app_notice.restype = ctypes.c_uint16@@ -21991,6 +22035,71 @@ class _UniffiFfiConverterTypeStreamStatsReport(_UniffiConverterRustBuffer):_UniffiFfiConverterUInt32.write(value.height, buf)_UniffiFfiConverterUInt64.write(value.duration_ms, buf)+@dataclass+class TelemetryLinkNotice:+ """+ The one-time notice for machines that saw the older "anonymous" wording,+ shown before anything is linked to the account. Both buttons close it;+ the second also turns usage data off.+"""+ def __init__(self, *, title:str, body:str, ok_label:str, turn_off_label:str, details_label:str, docs_url:str):+ self.title = title+ self.body = body+ self.ok_label = ok_label+ self.turn_off_label = turn_off_label+ self.details_label = details_label+ self.docs_url = docs_url+++++ def __str__(self):+ return "TelemetryLinkNotice(title={}, body={}, ok_label={}, turn_off_label={}, details_label={}, docs_url={})".format(self.title, self.body, self.ok_label, self.turn_off_label, self.details_label, self.docs_url)+ def __eq__(self, other):+ if self.title != other.title:+ return False+ if self.body != other.body:+ return False+ if self.ok_label != other.ok_label:+ return False+ if self.turn_off_label != other.turn_off_label:+ return False+ if self.details_label != other.details_label:+ return False+ if self.docs_url != other.docs_url:+ return False+ return True++class _UniffiFfiConverterTypeTelemetryLinkNotice(_UniffiConverterRustBuffer):+ @staticmethod+ def read(buf):+ return TelemetryLinkNotice(+ title=_UniffiFfiConverterString.read(buf),+ body=_UniffiFfiConverterString.read(buf),+ ok_label=_UniffiFfiConverterString.read(buf),+ turn_off_label=_UniffiFfiConverterString.read(buf),+ details_label=_UniffiFfiConverterString.read(buf),+ docs_url=_UniffiFfiConverterString.read(buf),+ )++ @staticmethod+ def check_lower(value):+ _UniffiFfiConverterString.check_lower(value.title)+ _UniffiFfiConverterString.check_lower(value.body)+ _UniffiFfiConverterString.check_lower(value.ok_label)+ _UniffiFfiConverterString.check_lower(value.turn_off_label)+ _UniffiFfiConverterString.check_lower(value.details_label)+ _UniffiFfiConverterString.check_lower(value.docs_url)++ @staticmethod+ def write(value, buf):+ _UniffiFfiConverterString.write(value.title, buf)+ _UniffiFfiConverterString.write(value.body, buf)+ _UniffiFfiConverterString.write(value.ok_label, buf)+ _UniffiFfiConverterString.write(value.turn_off_label, buf)+ _UniffiFfiConverterString.write(value.details_label, buf)+ _UniffiFfiConverterString.write(value.docs_url, buf)+@dataclassclass TelemetryStatus:"""@@ -25751,8 +25860,8 @@ class AuthProtocol(typing.Protocol):raise NotImplementedErrorasync def logout(self, ) -> bool:"""- Revokes (best effort) and removes the session. Returns whether one- existed.+ Revokes (best effort) and removes the session, and unlinks usage+ data from the account. Returns whether one existed."""raise NotImplementedErrordef status(self, ) -> AuthStatus:@@ -25863,8 +25972,8 @@ class Auth(AuthProtocol):return _uniffi_lift_return(_uniffi_ffi_result)async def logout(self, ) -> bool:"""- Revokes (best effort) and removes the session. Returns whether one- existed.+ Revokes (best effort) and removes the session, and unlinks usage+ data from the account. Returns whether one existed."""_uniffi_lowered_args = (self._uniffi_clone_handle(),@@ -38836,6 +38945,21 @@ def spaces_tool_methods() -> typing.List[SpacesToolMethod]:*_uniffi_lowered_args,)return _uniffi_lift_return(_uniffi_ffi_result)+def telemetry_acknowledge_link_notice() -> None:+ """+ The person closed the linking notice (either button). Linking starts+ with the app's next launch, never in the process that showed it.+"""+ _uniffi_lowered_args = (+ )+ _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_func_telemetry_acknowledge_link_notice,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)def telemetry_acknowledge_notice() -> None:"""Records that the first-run notice was shown in the app's UI (nothing is@@ -38870,6 +38994,49 @@ def telemetry_flush(timeout_ms: int) -> None:*_uniffi_lowered_args,)return _uniffi_lift_return(_uniffi_ffi_result)+def telemetry_link_notice() -> TelemetryLinkNotice:+ """+ The one-time linking notice's words.+"""+ _uniffi_lowered_args = (+ )+ _uniffi_lift_return = _UniffiFfiConverterTypeTelemetryLinkNotice.lift+ _uniffi_error_converter = None+ _uniffi_ffi_result = _uniffi_rust_call_with_error(+ _uniffi_error_converter,+ _UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)+def telemetry_link_notice_due() -> bool:+ """+ Whether the app should show the one-time linking notice now: usage data+ is on, the account offered linking, and this machine has not shown it.+"""+ _uniffi_lowered_args = (+ )+ _uniffi_lift_return = _UniffiFfiConverterBoolean.lift+ _uniffi_error_converter = None+ _uniffi_ffi_result = _uniffi_rust_call_with_error(+ _uniffi_error_converter,+ _UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_notice_due,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)+def telemetry_link_state() -> str:+ """+ Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.+"""+ _uniffi_lowered_args = (+ )+ _uniffi_lift_return = _UniffiFfiConverterString.lift+ _uniffi_error_converter = None+ _uniffi_ffi_result = _uniffi_rust_call_with_error(+ _uniffi_error_converter,+ _UniffiLib.uniffi_cua_sdk_fn_func_telemetry_link_state,+ *_uniffi_lowered_args,+ )+ return _uniffi_lift_return(_uniffi_ffi_result)def telemetry_notice_text() -> str:"""The first-run notice text (an app shows it in its own UI, then calls@@ -39072,6 +39239,25 @@ def telemetry_status() -> TelemetryStatus:*_uniffi_lowered_args,)return _uniffi_lift_return(_uniffi_ffi_result)+async def telemetry_sync_account() -> str:+ """+ Asks the Spaces API for the signed-in account's opaque id and hands it+ to telemetry (none unlinks). Call at launch and after a sign-in; the+ SDK's own sign-in already does. Returns the link state. Best effort:+ offline or signed out, nothing changes.+"""+ _uniffi_lowered_args = (+ )+ _uniffi_lift_return = _UniffiFfiConverterString.lift+ _uniffi_error_converter = None+ return await _uniffi_rust_call_async(+ _UniffiLib.uniffi_cua_sdk_fn_func_telemetry_sync_account(*_uniffi_lowered_args),+ _UniffiLib.ffi_cua_sdk_rust_future_poll_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_complete_rust_buffer,+ _UniffiLib.ffi_cua_sdk_rust_future_free_rust_buffer,+ _uniffi_lift_return,+ _uniffi_error_converter,+ )def telemetry_use_app_notice() -> None:"""The host app shows the first-run notice itself (no stderr notice).@@ -39296,6 +39482,7 @@ __all__ = ["SpacesdHttpRequest","SpacesdHttpResponse","StreamStatsReport",+ "TelemetryLinkNotice","TelemetryStatus","TeleportDecision","TeleportItem",@@ -39345,8 +39532,12 @@ __all__ = ["resolve_image_with_secret","sandbox_locations","spaces_tool_methods",+ "telemetry_acknowledge_link_notice","telemetry_acknowledge_notice","telemetry_flush",+ "telemetry_link_notice",+ "telemetry_link_notice_due",+ "telemetry_link_state","telemetry_notice_text","telemetry_record_bench_run","telemetry_record_feature",@@ -39358,6 +39549,7 @@ __all__ = ["telemetry_set_surface","telemetry_show_last","telemetry_status",+ "telemetry_sync_account","telemetry_use_app_notice","AgentRun","AgentRunProtocol",diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swiftindex 869faae98d..bb87b6f033 100644--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift@@ -2001,8 +2001,8 @@ public protocol AuthProtocol: AnyObject, Sendable {func beginLogin(flow: String?) async throws -> LoginAttempt/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/func logout() async throws -> Bool@@ -2119,8 +2119,8 @@ open func beginLogin(flow: String?)async throws -> LoginAttempt {}/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/open func logout()async throws -> Bool {return@@ -34809,6 +34809,99 @@ public func FfiConverterTypeStreamStatsReport_lower(_ value: StreamStatsReport)}+/**+ * The one-time notice for machines that saw the older "anonymous" wording,+ * shown before anything is linked to the account. Both buttons close it;+ * the second also turns usage data off.+ */+public struct TelemetryLinkNotice: Equatable, Hashable {+ public var title: String+ public var body: String+ /**+ * Keeps usage data on ("Got it").+ */+ public var okLabel: String+ /**+ * Turns usage data off ("Turn off usage data").+ */+ public var turnOffLabel: String+ /**+ * The link to what is collected.+ */+ public var detailsLabel: String+ public var docsUrl: String++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(title: String, body: String,+ /**+ * Keeps usage data on ("Got it").+ */okLabel: String,+ /**+ * Turns usage data off ("Turn off usage data").+ */turnOffLabel: String,+ /**+ * The link to what is collected.+ */detailsLabel: String, docsUrl: String) {+ self.title = title+ self.body = body+ self.okLabel = okLabel+ self.turnOffLabel = turnOffLabel+ self.detailsLabel = detailsLabel+ self.docsUrl = docsUrl+ }+++++}++#if compiler(>=6)+extension TelemetryLinkNotice: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeTelemetryLinkNotice: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TelemetryLinkNotice {+ return+ try TelemetryLinkNotice(+ title: FfiConverterString.read(from: &buf),+ body: FfiConverterString.read(from: &buf),+ okLabel: FfiConverterString.read(from: &buf),+ turnOffLabel: FfiConverterString.read(from: &buf),+ detailsLabel: FfiConverterString.read(from: &buf),+ docsUrl: FfiConverterString.read(from: &buf)+ )+ }++ public static func write(_ value: TelemetryLinkNotice, into buf: inout [UInt8]) {+ FfiConverterString.write(value.title, into: &buf)+ FfiConverterString.write(value.body, into: &buf)+ FfiConverterString.write(value.okLabel, into: &buf)+ FfiConverterString.write(value.turnOffLabel, into: &buf)+ FfiConverterString.write(value.detailsLabel, into: &buf)+ FfiConverterString.write(value.docsUrl, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeTelemetryLinkNotice_lift(_ buf: RustBuffer) throws -> TelemetryLinkNotice {+ return try FfiConverterTypeTelemetryLinkNotice.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeTelemetryLinkNotice_lower(_ value: TelemetryLinkNotice) -> RustBuffer {+ return FfiConverterTypeTelemetryLinkNotice.lower(value)+}++/*** Telemetry state.*/@@ -41613,6 +41706,15 @@ public func spacesToolMethods() -> [SpacesToolMethod] {)})}+/**+ * The person closed the linking notice (either button). Linking starts+ * with the app's next launch, never in the process that showed it.+ */+public func telemetryAcknowledgeLinkNotice() {try! rustCall() {+ uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice($0+ )+}+}/*** Records that the first-run notice was shown in the app's UI (nothing is* sent from a machine before that). Apps that show the notice themselves@@ -41633,6 +41735,34 @@ public func telemetryFlush(timeoutMs: UInt32) {try! rustCall() {)}}+/**+ * The one-time linking notice's words.+ */+public func telemetryLinkNotice() -> TelemetryLinkNotice {+ return try! FfiConverterTypeTelemetryLinkNotice_lift(try! rustCall() {+ uniffi_cua_sdk_fn_func_telemetry_link_notice($0+ )+})+}+/**+ * Whether the app should show the one-time linking notice now: usage data+ * is on, the account offered linking, and this machine has not shown it.+ */+public func telemetryLinkNoticeDue() -> Bool {+ return try! FfiConverterBool.lift(try! rustCall() {+ uniffi_cua_sdk_fn_func_telemetry_link_notice_due($0+ )+})+}+/**+ * Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.+ */+public func telemetryLinkState() -> String {+ return try! FfiConverterString.lift(try! rustCall() {+ uniffi_cua_sdk_fn_func_telemetry_link_state($0+ )+})+}/*** The first-run notice text (an app shows it in its own UI, then calls* [`telemetry_acknowledge_notice`]).@@ -41754,6 +41884,27 @@ public func telemetryStatus() -> TelemetryStatus {)})}+/**+ * Asks the Spaces API for the signed-in account's opaque id and hands it+ * to telemetry (none unlinks). Call at launch and after a sign-in; the+ * SDK's own sign-in already does. Returns the link state. Best effort:+ * offline or signed out, nothing changes.+ */+public func telemetrySyncAccount()async -> String {+ return+ try! await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cua_sdk_fn_func_telemetry_sync_account(+ )+ },+ pollFunc: ffi_cua_sdk_rust_future_poll_rust_buffer,+ completeFunc: ffi_cua_sdk_rust_future_complete_rust_buffer,+ freeFunc: ffi_cua_sdk_rust_future_free_rust_buffer,+ liftFunc: FfiConverterString.lift,+ errorHandler: nil++ )+}/*** The host app shows the first-run notice itself (no stderr notice).*/@@ -41895,12 +42046,24 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_func_spaces_tool_methods() != 24762) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice() != 46398) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice() != 6317) {return InitializationResult.apiChecksumMismatch}if (uniffi_cua_sdk_checksum_func_telemetry_flush() != 29688) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_func_telemetry_link_notice() != 11798) {+ return InitializationResult.apiChecksumMismatch+ }+ if (uniffi_cua_sdk_checksum_func_telemetry_link_notice_due() != 52419) {+ return InitializationResult.apiChecksumMismatch+ }+ if (uniffi_cua_sdk_checksum_func_telemetry_link_state() != 28062) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_func_telemetry_notice_text() != 47486) {return InitializationResult.apiChecksumMismatch}@@ -41934,6 +42097,9 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_func_telemetry_status() != 18801) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_sdk_checksum_func_telemetry_sync_account() != 61343) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_sdk_checksum_func_telemetry_use_app_notice() != 17365) {return InitializationResult.apiChecksumMismatch}@@ -42042,7 +42208,7 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_sdk_checksum_method_auth_begin_login() != 55109) {return InitializationResult.apiChecksumMismatch}- if (uniffi_cua_sdk_checksum_method_auth_logout() != 38806) {+ if (uniffi_cua_sdk_checksum_method_auth_logout() != 42354) {return InitializationResult.apiChecksumMismatch}if (uniffi_cua_sdk_checksum_method_auth_status() != 29264) {diff --git a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.hindex 0c68a2535e..3d8ac14a3c 100644--- a/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h+++ b/libs/cua/swift/Sources/cua_sdkFFI/include/cua_sdkFFI.h@@ -2879,6 +2879,12 @@ RustBuffer uniffi_cua_sdk_fn_func_presence_text_color(RustBuffer background, Rus#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_SPACES_TOOL_METHODSRustBuffer uniffi_cua_sdk_fn_func_spaces_tool_methods(RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_ACKNOWLEDGE_LINK_NOTICE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_ACKNOWLEDGE_LINK_NOTICE+void uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(RustCallStatus *_Nonnull out_status+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_ACKNOWLEDGE_NOTICE@@ -2890,6 +2896,24 @@ void uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice(RustCallStatus *_Nonnul#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_FLUSH#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_FLUSHvoid uniffi_cua_sdk_fn_func_telemetry_flush(uint32_t timeout_ms, RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_LINK_NOTICE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_LINK_NOTICE+RustBuffer uniffi_cua_sdk_fn_func_telemetry_link_notice(RustCallStatus *_Nonnull out_status++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_LINK_NOTICE_DUE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_LINK_NOTICE_DUE+int8_t uniffi_cua_sdk_fn_func_telemetry_link_notice_due(RustCallStatus *_Nonnull out_status++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_LINK_STATE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_LINK_STATE+RustBuffer uniffi_cua_sdk_fn_func_telemetry_link_state(RustCallStatus *_Nonnull out_status+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_NOTICE_TEXT@@ -2949,6 +2973,12 @@ RustBuffer uniffi_cua_sdk_fn_func_telemetry_show_last(uint32_t limit, RustCallSt#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_STATUSRustBuffer uniffi_cua_sdk_fn_func_telemetry_status(RustCallStatus *_Nonnull out_status+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_SYNC_ACCOUNT+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_SYNC_ACCOUNT+uint64_t uniffi_cua_sdk_fn_func_telemetry_sync_account(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_FN_FUNC_TELEMETRY_USE_APP_NOTICE@@ -3449,6 +3479,12 @@ uint16_t uniffi_cua_sdk_checksum_func_presence_text_color(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_SPACES_TOOL_METHODSuint16_t uniffi_cua_sdk_checksum_func_spaces_tool_methods(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_ACKNOWLEDGE_LINK_NOTICE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_ACKNOWLEDGE_LINK_NOTICE+uint16_t uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_ACKNOWLEDGE_NOTICE@@ -3461,6 +3497,24 @@ uint16_t uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_FLUSHuint16_t uniffi_cua_sdk_checksum_func_telemetry_flush(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_LINK_NOTICE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_LINK_NOTICE+uint16_t uniffi_cua_sdk_checksum_func_telemetry_link_notice(void++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_LINK_NOTICE_DUE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_LINK_NOTICE_DUE+uint16_t uniffi_cua_sdk_checksum_func_telemetry_link_notice_due(void++);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_LINK_STATE+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_LINK_STATE+uint16_t uniffi_cua_sdk_checksum_func_telemetry_link_state(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_NOTICE_TEXT@@ -3527,6 +3581,12 @@ uint16_t uniffi_cua_sdk_checksum_func_telemetry_show_last(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_STATUSuint16_t uniffi_cua_sdk_checksum_func_telemetry_status(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_SYNC_ACCOUNT+#define UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_SYNC_ACCOUNT+uint16_t uniffi_cua_sdk_checksum_func_telemetry_sync_account(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SDK_CHECKSUM_FUNC_TELEMETRY_USE_APP_NOTICEdiff --git a/libs/cua/typescript/src/native/cua_sdk-ffi.ts b/libs/cua/typescript/src/native/cua_sdk-ffi.tsindex 85d6215b50..90afe4c172 100644--- a/libs/cua/typescript/src/native/cua_sdk-ffi.ts+++ b/libs/cua/typescript/src/native/cua_sdk-ffi.ts@@ -813,6 +813,11 @@ const DEFINITIONS = {ret: FfiType.RustBuffer,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice": {+ args: [],+ ret: FfiType.Void,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice": {args: [],ret: FfiType.Void,@@ -823,6 +828,21 @@ const DEFINITIONS = {ret: FfiType.Void,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_func_telemetry_link_notice": {+ args: [],+ ret: FfiType.RustBuffer,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_func_telemetry_link_notice_due": {+ args: [],+ ret: FfiType.Int8,+ hasRustCallStatus: true,+ },+ "uniffi_cua_sdk_fn_func_telemetry_link_state": {+ args: [],+ ret: FfiType.RustBuffer,+ hasRustCallStatus: true,+ },"uniffi_cua_sdk_fn_func_telemetry_notice_text": {args: [],ret: FfiType.RustBuffer,@@ -878,6 +898,11 @@ const DEFINITIONS = {ret: FfiType.RustBuffer,hasRustCallStatus: true,},+ "uniffi_cua_sdk_fn_func_telemetry_sync_account": {+ args: [],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_fn_func_telemetry_use_app_notice": {args: [],ret: FfiType.Void,@@ -3068,6 +3093,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice": {args: [],ret: FfiType.UInt16,@@ -3078,6 +3108,21 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_func_telemetry_link_notice": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_sdk_checksum_func_telemetry_link_notice_due": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },+ "uniffi_cua_sdk_checksum_func_telemetry_link_state": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_func_telemetry_notice_text": {args: [],ret: FfiType.UInt16,@@ -3133,6 +3178,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_sdk_checksum_func_telemetry_sync_account": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_sdk_checksum_func_telemetry_use_app_notice": {args: [],ret: FfiType.UInt16,@@ -5415,8 +5465,12 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_func_resolve_image_with_secret(reference: Uint8Array, backend: Uint8Array, arch: Uint8Array, secret: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_sandbox_locations(uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_spaces_tool_methods(uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_func_telemetry_acknowledge_notice(uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_func_telemetry_flush(timeoutMs: number, uniffi_out_err: UniffiRustCallStatus): void;+ uniffi_cua_sdk_fn_func_telemetry_link_notice(uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_sdk_fn_func_telemetry_link_notice_due(uniffi_out_err: UniffiRustCallStatus): number;+ uniffi_cua_sdk_fn_func_telemetry_link_state(uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_telemetry_notice_text(uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_telemetry_record_bench_run(taskset: Uint8Array, successRate: Uint8Array, taskCount: bigint, outcome: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;uniffi_cua_sdk_fn_func_telemetry_record_feature(feature: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;@@ -5428,6 +5482,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_fn_func_telemetry_set_surface(surface: Uint8Array, version: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_func_telemetry_show_last(limit: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;uniffi_cua_sdk_fn_func_telemetry_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;+ uniffi_cua_sdk_fn_func_telemetry_sync_account(): bigint;uniffi_cua_sdk_fn_func_telemetry_use_app_notice(uniffi_out_err: UniffiRustCallStatus): void;uniffi_cua_sdk_fn_method_agentrun_artifacts(uniffiSelf: bigint): bigint;uniffi_cua_sdk_fn_method_agentrun_events(uniffiSelf: bigint, cursor: bigint, max: Uint8Array): bigint;@@ -5866,8 +5921,12 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_func_resolve_image_with_secret(): number;uniffi_cua_sdk_checksum_func_sandbox_locations(): number;uniffi_cua_sdk_checksum_func_spaces_tool_methods(): number;+ uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice(): number;uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice(): number;uniffi_cua_sdk_checksum_func_telemetry_flush(): number;+ uniffi_cua_sdk_checksum_func_telemetry_link_notice(): number;+ uniffi_cua_sdk_checksum_func_telemetry_link_notice_due(): number;+ uniffi_cua_sdk_checksum_func_telemetry_link_state(): number;uniffi_cua_sdk_checksum_func_telemetry_notice_text(): number;uniffi_cua_sdk_checksum_func_telemetry_record_bench_run(): number;uniffi_cua_sdk_checksum_func_telemetry_record_feature(): number;@@ -5879,6 +5938,7 @@ interface NativeModuleInterface {uniffi_cua_sdk_checksum_func_telemetry_set_surface(): number;uniffi_cua_sdk_checksum_func_telemetry_show_last(): number;uniffi_cua_sdk_checksum_func_telemetry_status(): number;+ uniffi_cua_sdk_checksum_func_telemetry_sync_account(): number;uniffi_cua_sdk_checksum_func_telemetry_use_app_notice(): number;uniffi_cua_sdk_checksum_method_agentrun_artifacts(): number;uniffi_cua_sdk_checksum_method_agentrun_events(): number;diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.tsindex a8809a80c9..7753de747c 100644--- a/libs/cua/typescript/src/native/cua_sdk.ts+++ b/libs/cua/typescript/src/native/cua_sdk.ts@@ -908,6 +908,18 @@ export function spacesToolMethods(): Array<SpacesToolMethod> {));}+/**+ * The person closed the linking notice (either button). Linking starts+ * with the app's next launch, never in the process that showed it.+ */+export function telemetryAcknowledgeLinkNotice(): void {uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => { nativeModule().uniffi_cua_sdk_fn_func_telemetry_acknowledge_link_notice(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ );+ }+/*** Records that the first-run notice was shown in the app's UI (nothing is* sent from a machine before that). Apps that show the notice themselves@@ -934,6 +946,58 @@ export function telemetryFlush(timeoutMs: number): void {uniffiCaller.rustCall();}+/**+ * The one-time linking notice's words.+ */+export function telemetryLinkNotice(): TelemetryLinkNotice {+ return ((__rb: Uint8Array) => {+ try {+ return FfiConverterTypeTelemetryLinkNotice.lift(__rb);+ } finally {+ nativeModule().rustbuffer_free(__rb);+ }+ })(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_notice(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }++/**+ * Whether the app should show the one-time linking notice now: usage data+ * is on, the account offered linking, and this machine has not shown it.+ */+export function telemetryLinkNoticeDue(): boolean {+ return FfiConverterBool.lift(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_notice_due(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }++/**+ * Where linking stands: `off`, `not_offered`, `notice_due` or `linked`.+ */+export function telemetryLinkState(): string {+ return ((__rb: Uint8Array) => {+ try {+ return FfiConverterString.lift(__rb);+ } finally {+ nativeModule().rustbuffer_free(__rb);+ }+ })(uniffiCaller.rustCall(+ /*caller:*/ (callStatus) => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_link_state(+ callStatus);+ },+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ ));+ }+/*** The first-run notice text (an app shows it in its own UI, then calls* [`telemetry_acknowledge_notice`]).@@ -1129,6 +1193,43 @@ export function telemetryStatus(): TelemetryStatus {));}+/**+ * Asks the Spaces API for the signed-in account's opaque id and hands it+ * to telemetry (none unlinks). Call at launch and after a sign-in; the+ * SDK's own sign-in already does. Returns the link state. Best effort:+ * offline or signed out, nothing changes.+ */+export async function telemetrySyncAccount(asyncOpts_?: { signal: AbortSignal }): Promise<string> {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_sdk_fn_func_telemetry_sync_account(+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_sdk_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_sdk_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_sdk_rust_future_free_rust_buffer,+ // Async returns always go through the JS-side converter: the+ // FFI symbol returns the future handle (u64), and the user-level+ // RustBuffer comes back via the shared `rust_future_complete_*`+ // export. The bytes the runtime hands back must be deserialized+ // here using the per-callable return-type converter.+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,++ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** The host app shows the first-run notice itself (no stderr notice).*/@@ -17586,6 +17687,79 @@ const FfiConverterTypeStreamStatsReport = (() => {return new FFIConverter();})();+/**+ * The one-time notice for machines that saw the older "anonymous" wording,+ * shown before anything is linked to the account. Both buttons close it;+ * the second also turns usage data off.+ */+export type TelemetryLinkNotice = {+ title: string,+ body: string,+ /**+ * Keeps usage data on ("Got it").+ */+ okLabel: string,+ /**+ * Turns usage data off ("Turn off usage data").+ */+ turnOffLabel: string,+ /**+ * The link to what is collected.+ */+ detailsLabel: string,+ docsUrl: string+}++/**+ * Generated factory for {@link TelemetryLinkNotice} record objects.+ */+export const TelemetryLinkNotice = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<TelemetryLinkNotice, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<TelemetryLinkNotice>,+ });+})();++const FfiConverterTypeTelemetryLinkNotice = (() => {+ type TypeName = TelemetryLinkNotice;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ title: FfiConverterString.read(from),+ body: FfiConverterString.read(from),+ okLabel: FfiConverterString.read(from),+ turnOffLabel: FfiConverterString.read(from),+ detailsLabel: FfiConverterString.read(from),+ docsUrl: FfiConverterString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.title, into);+ FfiConverterString.write(value.body, into);+ FfiConverterString.write(value.okLabel, into);+ FfiConverterString.write(value.turnOffLabel, into);+ FfiConverterString.write(value.detailsLabel, into);+ FfiConverterString.write(value.docsUrl, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.title) ++ FfiConverterString.allocationSize(value.body) ++ FfiConverterString.allocationSize(value.okLabel) ++ FfiConverterString.allocationSize(value.turnOffLabel) ++ FfiConverterString.allocationSize(value.detailsLabel) ++ FfiConverterString.allocationSize(value.docsUrl);++ }+ };+ return new FFIConverter();+})();+/*** Telemetry state.*/@@ -22497,8 +22671,8 @@ export interface AuthLike {*/devices(relayUrl: string | undefined, name: string | undefined) /*throws*/: DevicesLike;/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/logout(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<boolean>;/**@@ -22623,8 +22797,8 @@ private constructor(pointer: UniffiHandle) {}/**- * Revokes (best effort) and removes the session. Returns whether one- * existed.+ * Revokes (best effort) and removes the session, and unlinks usage+ * data from the account. Returns whether one existed.*/async logout(asyncOpts_?: { signal: AbortSignal }): Promise<boolean> /*throws*/ {const __stack = uniffiIsDebug ? new Error().stack : undefined;@@ -38445,12 +38619,24 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_func_spaces_tool_methods() !== 24762) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_spaces_tool_methods");}+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice() !== 46398) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_acknowledge_link_notice");+ }if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice() !== 6317) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_acknowledge_notice");}if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_flush() !== 29688) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_flush");}+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_link_notice() !== 11798) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_link_notice");+ }+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_link_notice_due() !== 52419) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_link_notice_due");+ }+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_link_state() !== 28062) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_link_state");+ }if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_notice_text() !== 47486) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_notice_text");}@@ -38484,6 +38670,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_status() !== 18801) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_status");}+ if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_sync_account() !== 61343) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_sync_account");+ }if (nativeModule().uniffi_cua_sdk_checksum_func_telemetry_use_app_notice() !== 17365) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_func_telemetry_use_app_notice");}@@ -38601,7 +38790,7 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_sdk_checksum_method_auth_devices() !== 36673) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_auth_devices");}- if (nativeModule().uniffi_cua_sdk_checksum_method_auth_logout() !== 38806) {+ if (nativeModule().uniffi_cua_sdk_checksum_method_auth_logout() !== 42354) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_sdk_checksum_method_auth_logout");}if (nativeModule().uniffi_cua_sdk_checksum_method_auth_status() !== 29264) {@@ -39928,6 +40117,7 @@ export default Object.freeze({FfiConverterTypeSpacesdProcess,FfiConverterTypeStorageVolume,FfiConverterTypeStreamStatsReport,+ FfiConverterTypeTelemetryLinkNotice,FfiConverterTypeTelemetryStatus,FfiConverterTypeTeleportApprover,FfiConverterTypeTeleportDecision,diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 21a4c089aa..7597dfe535 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -23018,7 +23018,7 @@ public struct AppOnboardingState: Equatable, Hashable {public var launchAtLogin: Bool/*** The usage-data switch on Welcome: the machine's telemetry setting- * (Settings' "Share anonymous usage data", `cua telemetry off`), none+ * (Settings' "Share usage data to help improve Cua", `cua telemetry off`), none* until the shell read it (then it shows on).*/public var telemetry: AppTelemetryInput?@@ -23114,7 +23114,7 @@ public struct AppOnboardingState: Equatable, Hashable {*/launchAtLogin: Bool,/*** The usage-data switch on Welcome: the machine's telemetry setting- * (Settings' "Share anonymous usage data", `cua telemetry off`), none+ * (Settings' "Share usage data to help improve Cua", `cua telemetry off`), none* until the shell read it (then it shows on).*/telemetry: AppTelemetryInput?,/**@@ -35680,7 +35680,7 @@ public func FfiConverterTypeAppUnconfirmedMachine_lower(_ value: AppUnconfirmedMpublic struct AppUsageToggle: Equatable, Hashable {/**- * "Share anonymous usage data".+ * "Share usage data to help improve Cua".*/public var label: String/**@@ -35700,7 +35700,7 @@ public struct AppUsageToggle: Equatable, Hashable {// declare one manually.public init(/**- * "Share anonymous usage data".+ * "Share usage data to help improve Cua".*/label: String,/*** On.@@ -50454,7 +50454,7 @@ public enum AppOnboardingAction: Equatable, Hashable {*/case welcomeShown/**- * Welcome's "Share anonymous usage data" switch (not while the+ * Welcome's "Share usage data to help improve Cua" switch (not while the* environment decides). The shell writes the setting.*/case usageDataToggled(@@ -69157,7 +69157,8 @@ public func appTelemetrySignInFailed(message: String?) -> [AppTelemetrySignal]}/*** The app started: attributes this process's events to `spaces_app` at- * `version`, lets the app show the first-run notice itself (nothing is+ * `version`, links usage data to the signed-in account in the background+ * when the Spaces API offers it, lets the app show the first-run notice itself (nothing is* sent before it has been shown once), and records `app_launched` (on a* first run, once the notice shows). Call once at launch, before the* first `Cua`. `onboarding_eligible`: the first run is still to finish@@ -70580,7 +70581,7 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_spaces_ffi_checksum_func_app_telemetry_sign_in_failed() != 34262) {return InitializationResult.apiChecksumMismatch}- if (uniffi_cua_spaces_ffi_checksum_func_app_telemetry_start() != 189) {+ if (uniffi_cua_spaces_ffi_checksum_func_app_telemetry_start() != 30125) {return InitializationResult.apiChecksumMismatch}if (uniffi_cua_spaces_ffi_checksum_func_app_telemetry_storage() != 21459) {