Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(spaces): one teleport setup sheet and a profile picker (CUA-2855, CUA-2853) (#6194)
ddupont2d974f1843c7
diff --git a/apps/cua-spaces-desktop/src/bridge/methods.ts b/apps/cua-spaces-desktop/src/bridge/methods.tsindex 20c7ef70ae..76b857e617 100644--- a/apps/cua-spaces-desktop/src/bridge/methods.ts+++ b/apps/cua-spaces-desktop/src/bridge/methods.ts@@ -24,7 +24,7 @@ export const METHODS = ["spaces.add", "clouds.status", "clouds.test", "clouds.connect", "clouds.disconnect", "clouds.approve","teleport.catalog", "teleport.entryForPath", "teleport.windows", "teleport.remoteWindows","teleport.icon", "teleport.thumbnail", "teleport.plan", "teleport.run", "teleport.sites",- "teleport.remembered", "teleport.streamWindow", "sharing.list", "sharing.share", "sharing.unshare",+ "teleport.readiness", "teleport.remembered", "teleport.streamWindow", "sharing.list", "sharing.share", "sharing.unshare","sharing.removals", "sharing.ackRemovals","volume.overview", "volume.storage", "volume.storageSet", "volume.mount", "volume.unmount","volume.approve", "volume.deny", "volume.revoke", "volume.resolve", "volume.reveal",diff --git a/apps/cua-spaces-desktop/src/bridge/teleport.ts b/apps/cua-spaces-desktop/src/bridge/teleport.tsindex bb5d9dce92..3331c50a9f 100644--- a/apps/cua-spaces-desktop/src/bridge/teleport.ts+++ b/apps/cua-spaces-desktop/src/bridge/teleport.ts@@ -7,7 +7,7 @@// SDK's entries and plans between the page's steps (`TeleportCache`).import type { SpaceLike, TeleportLike } from "../native/generated/index";import { dataURL, groupsOf, iconRequest, liveSources, moveOf, rememberChoice, runReport, spaceName, TeleportCache, teleportConsent } from "../model/teleport";-import { object, string } from "./args";+import { object, optionalString, string } from "./args";import { spaceStreams } from "./space-detail";import type { BridgeContext } from "./context";import { Failure, type BridgeArgs, type Handlers } from "./host";@@ -135,7 +135,15 @@ export function teleportMethods(ctx: BridgeContext): Handlers {const client = model.keyvault.client;if (!client) throw Failure.unsupported("The Keyvault is not available");foreground();- return encode(await client.inventory(string(args, "providerId"), undefined));+ return encode(await client.inventory(string(args, "providerId"), optionalString(args, "profile") ?? undefined));+ },+ "teleport.readiness": async (args) => {+ // Whether a teleport can work now, in plain words: the Keyvault, what+ // macOS lets the daemon read, the profiles. Reads no value and asks for+ // no presence, so it shows nothing over the foreground window.+ const client = model.keyvault.client;+ if (!client) throw Failure.unsupported("The Keyvault is not available");+ return encode(await client.readiness(string(args, "providerId"), optionalString(args, "profile") ?? undefined));},"teleport.remembered": (args) => {const key = native.appReviewRememberKey(string(args, "providerId"), spaceName(model, spaceId(args)));diff --git a/apps/cua-spaces-desktop/src/model/teleport.ts b/apps/cua-spaces-desktop/src/model/teleport.tsindex e243fc12fd..a492b9e803 100644--- a/apps/cua-spaces-desktop/src/model/teleport.ts+++ b/apps/cua-spaces-desktop/src/model/teleport.ts@@ -136,6 +136,7 @@ export function teleportConsent(c: Record<string, unknown>): TeleportConsent {fromVault: strings(c.fromVault),includePasswords: c.includePasswords === true,passwordDomains: strings(c.passwordDomains),+ profile: typeof c.profile === "string" && c.profile !== "" ? c.profile : undefined,};}diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.tsindex c3f078f102..87e11ddeaa 100644--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi-ffi.ts@@ -2157,6 +2157,11 @@ const DEFINITIONS = {ret: FfiType.Handle,hasRustCallStatus: false,},+ "uniffi_cua_spaces_ffi_fn_method_keyvaultclient_readiness": {+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],+ ret: FfiType.Handle,+ hasRustCallStatus: false,+ },"uniffi_cua_spaces_ffi_fn_method_keyvaultclient_setup_with_passphrase": {args: [FfiType.Handle, FfiType.RustBuffer],ret: FfiType.Handle,@@ -4082,6 +4087,11 @@ const DEFINITIONS = {ret: FfiType.UInt16,hasRustCallStatus: false,},+ "uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_readiness": {+ args: [],+ ret: FfiType.UInt16,+ hasRustCallStatus: false,+ },"uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_setup_with_passphrase": {args: [],ret: FfiType.UInt16,@@ -4787,6 +4797,7 @@ interface NativeModuleInterface {uniffi_cua_spaces_ffi_fn_method_keyvaultclient_inventory(uniffiSelf: bigint, app: Uint8Array, profile: Uint8Array): bigint;uniffi_cua_spaces_ffi_fn_method_keyvaultclient_lock(uniffiSelf: bigint): bigint;uniffi_cua_spaces_ffi_fn_method_keyvaultclient_overview(uniffiSelf: bigint): bigint;+ uniffi_cua_spaces_ffi_fn_method_keyvaultclient_readiness(uniffiSelf: bigint, app: Uint8Array, profile: Uint8Array): bigint;uniffi_cua_spaces_ffi_fn_method_keyvaultclient_setup_with_passphrase(uniffiSelf: bigint, passphrase: Uint8Array): bigint;uniffi_cua_spaces_ffi_fn_method_keyvaultclient_unlock_with_passphrase(uniffiSelf: bigint, passphrase: Uint8Array): bigint;uniffi_cua_spaces_ffi_fn_method_pcmsink_on_pcm(uniffiSelf: bigint, audio: Uint8Array, uniffi_out_err: UniffiRustCallStatus): void;@@ -5172,6 +5183,7 @@ interface NativeModuleInterface {uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_inventory(): number;uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_lock(): number;uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_overview(): number;+ uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_readiness(): number;uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_setup_with_passphrase(): number;uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_unlock_with_passphrase(): number;uniffi_cua_spaces_ffi_checksum_method_pcmsink_on_pcm(): number;diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.tsindex 8e8ecfdc60..d99d98c058 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@@ -50305,6 +50305,69 @@ const FfiConverterTypeKvApprovalView = (() => {return new FFIConverter();})();+export type KvBrowserProfile = {+ /**+ * Directory name (`Default`, `Profile 1`).+ */+ dir: string,+ /**+ * The name the person gave it.+ */+ name: string,+ /**+ * The account signed in to it.+ */+ account?: string,+ /**+ * The browser used it last.+ */+ lastUsed: boolean+}++/**+ * Generated factory for {@link KvBrowserProfile} record objects.+ */+export const KvBrowserProfile = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<KvBrowserProfile, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<KvBrowserProfile>,+ });+})();++const FfiConverterTypeKvBrowserProfile = (() => {+ type TypeName = KvBrowserProfile;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ dir: FfiConverterString.read(from),+ name: FfiConverterString.read(from),+ account: FfiConverterOptionalString.read(from),+ lastUsed: FfiConverterBool.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.dir, into);+ FfiConverterString.write(value.name, into);+ FfiConverterOptionalString.write(value.account, into);+ FfiConverterBool.write(value.lastUsed, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.dir) ++ FfiConverterString.allocationSize(value.name) ++ FfiConverterOptionalString.allocationSize(value.account) ++ FfiConverterBool.allocationSize(value.lastUsed);++ }+ };+ return new FFIConverter();+})();+export enum KvCategory {/*** Every item, grouped by app.@@ -51428,6 +51491,160 @@ const FfiConverterTypeKvPassphraseCheck = (() => {return new FFIConverter();})();+export type KvReadinessCheck = {+ /**+ * `granted`, `denied` or `unknown` (only known by trying).+ */+ state: string,+ /**+ * What it means and what to do, in plain words (empty when nothing).+ */+ say: string+}++/**+ * Generated factory for {@link KvReadinessCheck} record objects.+ */+export const KvReadinessCheck = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<KvReadinessCheck, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<KvReadinessCheck>,+ });+})();++const FfiConverterTypeKvReadinessCheck = (() => {+ type TypeName = KvReadinessCheck;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ state: FfiConverterString.read(from),+ say: FfiConverterString.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.state, into);+ FfiConverterString.write(value.say, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.state) ++ FfiConverterString.allocationSize(value.say);++ }+ };+ return new FFIConverter();+})();++export type KvReadiness = {+ /**+ * Provider id.+ */+ providerId: string,+ /**+ * App name.+ */+ appDisplay: string,+ /**+ * The Keyvault exists.+ */+ keyvaultInitialized: boolean,+ /**+ * The Keyvault is unlocked.+ */+ keyvaultUnlocked: boolean,+ /**+ * The profile checked: the one asked for, else the last used.+ */+ profile?: string,+ /**+ * The profile a teleport reads when none is named.+ */+ defaultProfile?: string,+ /**+ * Every profile.+ */+ profiles: Array<KvBrowserProfile>,+ /**+ * Reading the app's files (Full Disk Access).+ */+ files: KvReadinessCheck,+ /**+ * Reading the app's open tabs (Automation).+ */+ tabs: KvReadinessCheck,+ /**+ * The checked profile has no sign-in data.+ */+ profileEmpty: boolean+}++/**+ * Generated factory for {@link KvReadiness} record objects.+ */+export const KvReadiness = (() => {+ const defaults = () => ({+ });+ const create = (() => {+ return uniffiCreateRecord<KvReadiness, ReturnType<typeof defaults>>(defaults);+ })();+ return Object.freeze({+ create,+ new: create,+ defaults: () => Object.freeze(defaults()) as Partial<KvReadiness>,+ });+})();++const FfiConverterTypeKvReadiness = (() => {+ type TypeName = KvReadiness;+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {+ read(from: RustBuffer): TypeName {+ return {+ providerId: FfiConverterString.read(from),+ appDisplay: FfiConverterString.read(from),+ keyvaultInitialized: FfiConverterBool.read(from),+ keyvaultUnlocked: FfiConverterBool.read(from),+ profile: FfiConverterOptionalString.read(from),+ defaultProfile: FfiConverterOptionalString.read(from),+ profiles: FfiConverterSequenceTypeKvBrowserProfile.read(from),+ files: FfiConverterTypeKvReadinessCheck.read(from),+ tabs: FfiConverterTypeKvReadinessCheck.read(from),+ profileEmpty: FfiConverterBool.read(from)+ };+ }+ write(value: TypeName, into: RustBuffer): void {+ FfiConverterString.write(value.providerId, into);+ FfiConverterString.write(value.appDisplay, into);+ FfiConverterBool.write(value.keyvaultInitialized, into);+ FfiConverterBool.write(value.keyvaultUnlocked, into);+ FfiConverterOptionalString.write(value.profile, into);+ FfiConverterOptionalString.write(value.defaultProfile, into);+ FfiConverterSequenceTypeKvBrowserProfile.write(value.profiles, into);+ FfiConverterTypeKvReadinessCheck.write(value.files, into);+ FfiConverterTypeKvReadinessCheck.write(value.tabs, into);+ FfiConverterBool.write(value.profileEmpty, into);+ }+ allocationSize(value: TypeName): number {+ return FfiConverterString.allocationSize(value.providerId) ++ FfiConverterString.allocationSize(value.appDisplay) ++ FfiConverterBool.allocationSize(value.keyvaultInitialized) ++ FfiConverterBool.allocationSize(value.keyvaultUnlocked) ++ FfiConverterOptionalString.allocationSize(value.profile) ++ FfiConverterOptionalString.allocationSize(value.defaultProfile) ++ FfiConverterSequenceTypeKvBrowserProfile.allocationSize(value.profiles) ++ FfiConverterTypeKvReadinessCheck.allocationSize(value.files) ++ FfiConverterTypeKvReadinessCheck.allocationSize(value.tabs) ++ FfiConverterBool.allocationSize(value.profileEmpty);++ }+ };+ return new FFIConverter();+})();+export type KvSidebar = {/*** All Items, Waiting, Access, Recent.@@ -53051,7 +53268,11 @@ export type TeleportConsent = {* The sites whose saved passwords to send (the review's own* choice; `None`: those of `cookie_domains`).*/- passwordDomains?: Array<string>+ passwordDomains?: Array<string>,+ /**+ * The browser profile to read (`Profile 1`); `None`: `Default`.+ */+ profile?: string}/**@@ -53066,7 +53287,8 @@ export const TeleportConsent = (() => {exclude: [],fromVault: undefined,includePasswords: false,- passwordDomains: undefined+ passwordDomains: undefined,+ profile: undefined});const create = (() => {return uniffiCreateRecord<TeleportConsent, ReturnType<typeof defaults>>(defaults);@@ -53091,7 +53313,8 @@ const FfiConverterTypeTeleportConsent = (() => {exclude: FfiConverterSequenceString.read(from),fromVault: FfiConverterOptionalSequenceString.read(from),includePasswords: FfiConverterBool.read(from),- passwordDomains: FfiConverterOptionalSequenceString.read(from)+ passwordDomains: FfiConverterOptionalSequenceString.read(from),+ profile: FfiConverterOptionalString.read(from)};}write(value: TypeName, into: RustBuffer): void {@@ -53104,6 +53327,7 @@ const FfiConverterTypeTeleportConsent = (() => {FfiConverterOptionalSequenceString.write(value.fromVault, into);FfiConverterBool.write(value.includePasswords, into);FfiConverterOptionalSequenceString.write(value.passwordDomains, into);+ FfiConverterOptionalString.write(value.profile, into);}allocationSize(value: TypeName): number {return FfiConverterBool.allocationSize(value.approved) +@@ -53114,7 +53338,8 @@ const FfiConverterTypeTeleportConsent = (() => {FfiConverterSequenceString.allocationSize(value.exclude) +FfiConverterOptionalSequenceString.allocationSize(value.fromVault) +FfiConverterBool.allocationSize(value.includePasswords) +- FfiConverterOptionalSequenceString.allocationSize(value.passwordDomains);+ FfiConverterOptionalSequenceString.allocationSize(value.passwordDomains) ++ FfiConverterOptionalString.allocationSize(value.profile);}};@@ -67767,6 +67992,12 @@ export interface KeyvaultClientLike {* state (`availability`).*/overview(asyncOpts_?: { signal: AbortSignal }): Promise<KeyvaultOverview>;+/**+ * Whether a teleport of `app` can work now: the Keyvault's state, what+ * macOS lets the daemon read, and the profiles. Reads no value and asks+ * for no presence.+ */+ readiness(app: string, profile: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<KvReadiness>;/*** Creates the vault with a passphrase (and a recovery key, returned* once). The passphrase goes only to the broker over the verified@@ -67988,6 +68219,43 @@ export class KeyvaultClient extends UniffiAbstractObject implements KeyvaultClie}}+/**+ * Whether a teleport of `app` can work now: the Keyvault's state, what+ * macOS lets the daemon read, and the profiles. Reads no value and asks+ * for no presence.+ */+ async readiness(app: string, profile: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<KvReadiness> /*throws*/ {+ const __stack = uniffiIsDebug ? new Error().stack : undefined;+ try {+ return await uniffiRustCallAsync(+ /*rustCaller:*/ uniffiCaller,+ /*rustFutureFunc:*/ () => {+ return nativeModule().uniffi_cua_spaces_ffi_fn_method_keyvaultclient_readiness(+ uniffiTypeKeyvaultClientObjectFactory.clonePointer(this),FfiConverterString.lower(app, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(profile, nativeModule().rustbuffer_alloc)+ );+ },+ /*pollFunc:*/ nativeModule().ffi_cua_spaces_ffi_rust_future_poll_rust_buffer,+ /*cancelFunc:*/ nativeModule().ffi_cua_spaces_ffi_rust_future_cancel_rust_buffer,+ /*completeFunc:*/ nativeModule().ffi_cua_spaces_ffi_rust_future_complete_rust_buffer,+ /*freeFunc:*/ nativeModule().ffi_cua_spaces_ffi_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:*/ FfiConverterTypeKvReadiness.lift.bind(FfiConverterTypeKvReadiness),+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),+ /*asyncOpts:*/ asyncOpts_,+ /*errorHandler:*/ FfiConverterTypeCuaError.lift.bind(FfiConverterTypeCuaError)+ );+ } catch (__error: any) {+ if (uniffiIsDebug && __error instanceof Error) {+ __error.stack = __stack;+ }+ throw __error;+ }+ }+/*** Creates the vault with a passphrase (and a recovery key, returned* once). The passphrase goes only to the broker over the verified@@ -70617,6 +70885,9 @@ const FfiConverterOptionalTypeKvCredentialForm = new FfiConverterOptional(FfiCon// FfiConverter for KvStrength | undefinedconst FfiConverterOptionalTypeKvStrength = new FfiConverterOptional(FfiConverterTypeKvStrength);+// FfiConverter for Array<KvBrowserProfile>+const FfiConverterSequenceTypeKvBrowserProfile = new FfiConverterArray(FfiConverterTypeKvBrowserProfile);+// FfiConverter for Array<KvCategoryRow>const FfiConverterSequenceTypeKvCategoryRow = new FfiConverterArray(FfiConverterTypeKvCategoryRow);@@ -71899,6 +72170,9 @@ function uniffiEnsureInitialized() {if (nativeModule().uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_overview() !== 65171) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_overview");}+ if (nativeModule().uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_readiness() !== 1765) {+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_readiness");+ }if (nativeModule().uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_setup_with_passphrase() !== 6939) {throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_setup_with_passphrase");}@@ -72511,6 +72785,7 @@ export default Object.freeze({FfiConverterTypeKvApprovalState,FfiConverterTypeKvApprovalView,FfiConverterTypeKvAuditEntry,+ FfiConverterTypeKvBrowserProfile,FfiConverterTypeKvCaller,FfiConverterTypeKvCategory,FfiConverterTypeKvCategoryRow,@@ -72537,6 +72812,8 @@ export default Object.freeze({FfiConverterTypeKvPassphraseCheck,FfiConverterTypeKvPending,FfiConverterTypeKvPendingRow,+ FfiConverterTypeKvReadiness,+ FfiConverterTypeKvReadinessCheck,FfiConverterTypeKvRecentRow,FfiConverterTypeKvRule,FfiConverterTypeKvRuleCaller,diff --git a/apps/cua-spaces-desktop/test/vault-fixtures.ts b/apps/cua-spaces-desktop/test/vault-fixtures.tsindex 4758f6ee83..256ecec72f 100644--- a/apps/cua-spaces-desktop/test/vault-fixtures.ts+++ b/apps/cua-spaces-desktop/test/vault-fixtures.ts@@ -13,6 +13,7 @@ import type {KeyvaultOverview,KvCommand,KvInventory,+ KvReadiness,KvOutcome,SpaceAppIcon,SpaceAppIconRequest,@@ -32,13 +33,13 @@ const parity = JSON.parse(readFileSync(path.resolve(__dirname, "../../../libs/cu/** The methods and page operations vault-native.test.ts covers (the other bridge tests leave them to it). */export const VAULT_METHODS = ["teleport.catalog", "teleport.entryForPath", "teleport.windows", "teleport.remoteWindows", "teleport.icon", "teleport.thumbnail",- "teleport.plan", "teleport.run", "teleport.sites", "teleport.remembered", "teleport.streamWindow",+ "teleport.plan", "teleport.run", "teleport.sites", "teleport.readiness", "teleport.remembered", "teleport.streamWindow","keyvault.get", "keyvault.lock", "keyvault.unlock", "keyvault.unlockVault", "keyvault.setup", "keyvault.setDisabled","keyvault.approve", "keyvault.deny", "keyvault.revokeGrant", "keyvault.showItems", "keyvault.delete", "keyvault.run", "keyvault.dismiss",];export const VAULT_OPS = ["teleport.catalog", "teleport.entryForPath", "teleport.windows", "teleport.remoteWindows", "teleport.icon", "teleport.thumbnail",- "teleport.plan", "teleport.run", "teleport.sites", "teleport.remembered", "teleport.streamWindow",+ "teleport.plan", "teleport.run", "teleport.sites", "teleport.readiness", "teleport.remembered", "teleport.streamWindow","keyvault.overview", "keyvault.unlock", "keyvault.setUnattended", "keyvault.setDisabled", "keyvault.approve", "keyvault.deny","keyvault.revokeGrant", "keyvault.setup", "keyvault.showItems", "keyvault.delete", "keyvault.run", "keyvault.dismiss",] as const;@@ -83,6 +84,22 @@ export class FakeKeyvault implements KeyvaultClientLike {notes: [],};inventoryAsks: { app: string; profile: string | undefined }[] = [];+ readinessResult: KvReadiness = {+ providerId: "chrome",+ appDisplay: "Google Chrome",+ keyvaultInitialized: true,+ keyvaultUnlocked: true,+ profile: "Profile 1",+ defaultProfile: "Default",+ profiles: [+ { dir: "Default", name: "Personal", account: undefined, lastUsed: false },+ { dir: "Profile 1", name: "Work", account: "[email protected]", lastUsed: true },+ ],+ files: { state: "denied", say: "macOS is not letting Cua read this browser's files." },+ tabs: { state: "unknown", say: "" },+ profileEmpty: false,+ };+ readinessAsks: { app: string; profile: string | undefined }[] = [];/** Makes the next command fail with this message. */failWith: string | null = null;@@ -104,6 +121,11 @@ export class FakeKeyvault implements KeyvaultClientLike {return this.inventoryResult;}+ async readiness(app: string, profile: string | undefined): Promise<KvReadiness> {+ this.readinessAsks.push({ app, profile });+ return this.readinessResult;+ }+async lock(): Promise<void> {}async setupWithPassphrase(passphrase: string): Promise<string | undefined> {diff --git a/apps/cua-spaces-desktop/test/vault-native.test.ts b/apps/cua-spaces-desktop/test/vault-native.test.tsindex c1834b6fc3..999e74abd7 100644--- a/apps/cua-spaces-desktop/test/vault-native.test.ts+++ b/apps/cua-spaces-desktop/test/vault-native.test.ts@@ -805,6 +805,25 @@ describe.skipIf(!built)("Teleport and the Keyvault on the app core", () => {expect(await code("teleport.sites", { providerId: "chrome" })).toBe("unsupported");});+ it("checks whether a teleport can work, in plain words, without asking for presence or moving the window", async () => {+ const ready = await shapes("teleport.readiness", { providerId: "chrome", profile: "Profile 1" });+ expect(ready).toMatchObject({ providerId: "chrome", keyvaultInitialized: true, files: { state: "denied" } });+ expect(ready.profiles.map((p: { dir: string }) => p.dir)).toEqual(["Default", "Profile 1"]);+ expect(fake.readinessAsks).toEqual([{ app: "chrome", profile: "Profile 1" }]);+ // The last used profile when none is named; it reads nothing, so it never asks.+ await call("teleport.readiness", { providerId: "chrome" });+ expect(fake.readinessAsks.at(-1)).toEqual({ app: "chrome", profile: undefined });+ expect(activations).toBe(0);+ expect(await code("teleport.readiness", {})).toBe("bad_args");+ await setUp(parityOverview(native), false);+ expect(await code("teleport.readiness", { providerId: "chrome" })).toBe("unsupported");+ });++ it("asks the daemon to read the profile that was chosen", async () => {+ await shapes("teleport.sites", { providerId: "chrome", profile: "Profile 2" });+ expect(fake.inventoryAsks.at(-1)).toEqual({ app: "chrome", profile: "Profile 2" });+ });+it("streams one of the Space's windows onto this machine", async () => {expect(await shapes("teleport.streamWindow", { spaceId: aurora, windowId: "w-1" })).toBeNull();const name = model.spaces.find((s) => s.id === aurora)!.name;@@ -847,6 +866,7 @@ describe.skipIf(!built)("Teleport and the Keyvault on the app core", () => {["teleport.icon", { spaceId: SPACE, icon: { kind: "host", path: "/Applications/Slack.app" } }],["teleport.thumbnail", { spaceId: SPACE, thumbnail: { kind: "host-window", windowId: 41 } }],["teleport.sites", { providerId: "chrome" }],+ ["teleport.readiness", { providerId: "chrome" }],["teleport.remembered", { providerId: "chrome", spaceId: SPACE }],["teleport.streamWindow", { spaceId: SPACE, spaceName: "Aurora", windowId: "w-1", appName: "Firefox", title: "Mozilla Firefox" }],];diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swiftindex a1eaf13678..ea9208e134 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge+Pages.swift@@ -43,7 +43,8 @@ extension WebUIBridge {// Teleport and Sharecase "teleport.catalog", "teleport.entryForPath", "teleport.windows", "teleport.remoteWindows",- "teleport.icon", "teleport.thumbnail", "teleport.plan", "teleport.run", "teleport.sites", "teleport.remembered",+ "teleport.icon", "teleport.thumbnail", "teleport.plan", "teleport.run", "teleport.sites", "teleport.readiness",+ "teleport.remembered","teleport.streamWindow":return try await teleport(method, args)// Links to things you run (`cua share`): the daemon's shares.@@ -964,7 +965,13 @@ extension WebUIBridge {// Counts per site, never values; the daemon asks for Touch ID// before it shows names, as for the native review.guard let client = model.keyvault.client else { throw Failure.unsupported("The Keyvault is not available") }- return BridgeValue.encode(try await client.inventory(app: try string(args, "providerId"), profile: nil))+ return BridgeValue.encode(try await client.inventory(app: try string(args, "providerId"), profile: Self.profile(args)))+ case "teleport.readiness":+ // Whether a teleport can work now, in plain words: the Keyvault,+ // what macOS lets the daemon read, the profiles. Reads no value+ // and asks for no presence.+ guard let client = model.keyvault.client else { throw Failure.unsupported("The Keyvault is not available") }+ return BridgeValue.encode(try await client.readiness(app: try string(args, "providerId"), profile: Self.profile(args)))case "teleport.remembered":let key = appReviewRememberKey(app: try string(args, "providerId"), space: spaceName(try string(args, "spaceId")))return appReviewRemembered(choices: model.settings.teleportChoices, key: key).map { $0 as Any } ?? NSNull()@@ -1005,7 +1012,7 @@ extension WebUIBridge {/// through `sdkConsent`, the same path `TeleportModel.confirm` takes, so/// every field (Save to Keyvault included) reaches the run.static func teleportConsent(_ c: [String: Any]) -> TeleportConsent {- sdkConsent(AppTeleportConsent(+ var consent = sdkConsent(AppTeleportConsent(approved: c["approved"] as? Bool ?? false,acknowledgeSensitive: c["acknowledgeSensitive"] as? Bool ?? false,saveToKeyvault: c["saveToKeyvault"] as? Bool ?? false,@@ -1015,6 +1022,15 @@ extension WebUIBridge {fromVault: c["fromVault"] as? [String],includePasswords: c["includePasswords"] as? Bool ?? false,passwordDomains: c["passwordDomains"] as? [String]))+ // The browser profile chosen in the setup sheet; absent reads Default.+ consent.profile = profile(c)+ return consent+ }++ /// The browser profile an argument names (`Profile 1`), or nil.+ static func profile(_ args: [String: Any]) -> String? {+ guard let p = args["profile"] as? String, !p.isEmpty else { return nil }+ return p}/// A run's report, as the page reads it (`RunReport`).diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swiftindex 277bb31385..32f0c5da59 100644--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/WebHost/WebUIBridge.swift@@ -88,7 +88,7 @@ final class WebUIBridge: NSObject, WKScriptMessageHandlerWithReply {"spaces.add", "clouds.status", "clouds.test", "clouds.connect", "clouds.disconnect", "clouds.approve","teleport.catalog", "teleport.entryForPath", "teleport.windows", "teleport.remoteWindows","teleport.icon", "teleport.thumbnail", "teleport.plan", "teleport.run", "teleport.sites",- "teleport.remembered", "teleport.streamWindow", "sharing.list", "sharing.share", "sharing.unshare", "sharing.removals", "sharing.ackRemovals",+ "teleport.readiness", "teleport.remembered", "teleport.streamWindow", "sharing.list", "sharing.share", "sharing.unshare", "sharing.removals", "sharing.ackRemovals","volume.overview", "volume.storage", "volume.storageSet", "volume.mount", "volume.unmount","volume.approve", "volume.deny", "volume.revoke", "volume.resolve", "volume.reveal","agents.setupDriver",diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swiftindex 603a49650b..206947cf07 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/BridgeContractTests.swift@@ -325,7 +325,7 @@ struct BridgeContractTests {"teleport.windows": "lists this Mac's real windows", "teleport.remoteWindows": "needs a Space's stream","teleport.icon": "needs the SDK's teleport handle", "teleport.thumbnail": "needs the SDK's teleport handle","teleport.plan": "needs the SDK's teleport handle", "teleport.run": "needs the SDK's teleport handle",- "teleport.sites": "reads a browser's profile through the Keyvault", "teleport.streamWindow": "opens a native window",+ "teleport.sites": "reads a browser's profile through the Keyvault", "teleport.readiness": "checks a browser through the Keyvault", "teleport.streamWindow": "opens a native window","volume.approve": "the fake has no request", "volume.deny": "the fake has no request","volume.revoke": "the fake has no grant", "volume.resolve": "changes the fake's conflicts","volume.reveal": "opens Finder", "loginItem.openSettings": "opens System Settings",@@ -427,6 +427,13 @@ struct BridgeContractTests {KvDomainCount(domain: "slack.com", cookies: 4, sessionCookies: 1, localStorage: 2, passwords: 0,signin: true, identityProvider: false, unavailable: 0, unavailableReason: ""),], notes: [])+ let readiness = KvReadiness(+ providerId: "chrome", appDisplay: "Google Chrome", keyvaultInitialized: true, keyvaultUnlocked: false,+ profile: "Profile 1", defaultProfile: "Default",+ profiles: [KvBrowserProfile(dir: "Default", name: "Personal", account: nil, lastUsed: false),+ KvBrowserProfile(dir: "Profile 1", name: "Work", account: "[email protected]", lastUsed: true)],+ files: KvReadinessCheck(state: "denied", say: "Turn on Full Disk Access."),+ tabs: KvReadinessCheck(state: "unknown", say: ""), profileEmpty: false)let open = AppOpenWindow(windowId: 41, appId: "", appName: "Slack", windowTitle: "general", supported: true,bundlePath: "/Applications/Slack.app")let remote = AppRemoteWindow(id: "w-1", appName: "Firefox", title: "Mozilla Firefox", visible: true, appId: "firefox",@@ -442,6 +449,7 @@ struct BridgeContractTests {("teleport.plan", BridgeValue.encode(plan)),("teleport.run", WebUIBridge.runReport(report)),("teleport.sites", BridgeValue.encode(sites)),+ ("teleport.readiness", BridgeValue.encode(readiness)),("teleport.streamWindow", NSNull()),].map { ($0.0, try json($0.1)) }}diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swiftindex c646458c54..25901ed3d0 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/TeleportBridgeTests.swift@@ -61,6 +61,15 @@ struct TeleportBridgeTests {#expect(!off.saveToKeyvault && off.exclude.isEmpty && off.cookieDomains == nil)}+ /// The profile chosen in the setup sheet reaches the SDK's consent; a+ /// blank or absent one reads Default.+ @Test func theChosenProfileReachesTheSdkConsent() {+ let named = WebUIBridge.teleportConsent(["approved": true, "acknowledgeSensitive": true, "profile": "Profile 1"])+ #expect(named.profile == "Profile 1")+ #expect(WebUIBridge.teleportConsent(["approved": true, "profile": ""]).profile == nil)+ #expect(WebUIBridge.teleportConsent(["approved": true]).profile == nil)+ }+// MARK: - Keyvault, as the SwiftUI list does it/// The vault with a live copy of two GitHub items in Aurora.diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swiftindex e1212d2574..419d9166f4 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift@@ -88,6 +88,21 @@ final class FakeKeyvault: KeyvaultClientProtocol, @unchecked Sendable {return inventoryResult}+ /// What the Keyvault says about a teleport of an app (the setup sheet).+ var readinessResult = KvReadiness(+ providerId: "chrome", appDisplay: "Google Chrome", keyvaultInitialized: true, keyvaultUnlocked: true,+ profile: "Profile 1", defaultProfile: "Default",+ profiles: [KvBrowserProfile(dir: "Default", name: "Personal", account: nil, lastUsed: false),+ KvBrowserProfile(dir: "Profile 1", name: "Work", account: "[email protected]", lastUsed: true)],+ files: KvReadinessCheck(state: "denied", say: "macOS is not letting Cua read this browser's files."),+ tabs: KvReadinessCheck(state: "unknown", say: ""), profileEmpty: false)+ var readinessAsks: [(app: String, profile: String?)] = []++ func readiness(app: String, profile: String?) async throws -> KvReadiness {+ readinessAsks.append((app, profile))+ return readinessResult+ }+/// Passphrases the page sent (test fixtures, never real secrets).var passphrases: [String] = []diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swiftindex 8be4dbb18a..4833161bde 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/WebUIHostTests.swift@@ -215,6 +215,27 @@ struct WebUIHostTests {#expect(fake.commands.last == .revokeGrant(id: "grant-1"))}+ /// The teleport setup sheet's check goes to the Keyvault with the profile+ /// asked for (none: the last used), reads no value, and is a method the+ /// page may call.+ @Test func theTeleportReadinessCheckAsksTheKeyvaultForTheProfile() async throws {+ let fake = FakeKeyvault(try fixtureOverview())+ let (bridge, model) = bridge(kv: fake)+ await model.keyvault.refresh()+ #expect(WebUIBridge.methods.contains("teleport.readiness"))+ let r = try await bridge.handle("teleport.readiness", ["providerId": "chrome", "profile": "Profile 1"]) as? [String: Any]+ #expect(r?["providerId"] as? String == "chrome")+ #expect(r?["keyvaultInitialized"] as? Bool == true)+ #expect((r?["files"] as? [String: Any])?["state"] as? String == "denied")+ #expect((r?["profiles"] as? [Any])?.count == 2)+ #expect(fake.readinessAsks.last?.app == "chrome" && fake.readinessAsks.last?.profile == "Profile 1")+ _ = try await bridge.handle("teleport.readiness", ["providerId": "chrome", "profile": NSNull()])+ #expect(fake.readinessAsks.last?.profile == nil)+ #expect(await failure(bridge, "teleport.readiness", [:]) == "bad_args")+ // The sites list reads the profile the page chose.+ _ = try await bridge.handle("teleport.sites", ["providerId": "chrome", "profile": "Profile 2"])+ }+/// "No Keyvault yet" on the web page: Set up Keyvault runs the core's/// Touch ID setup and answers the recovery key once.@Test func setupFromTheWebPageAnswersTheRecoveryKey() async throws {diff --git a/apps/cua-spaces-web/src/__tests__/teleport-setup.test.tsx b/apps/cua-spaces-web/src/__tests__/teleport-setup.test.tsxnew file mode 100644index 0000000000..03fcb1bac0--- /dev/null+++ b/apps/cua-spaces-web/src/__tests__/teleport-setup.test.tsx@@ -0,0 +1,102 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++// The teleport setup sheet: what a browser teleport needs, in plain words,+// before anything is read. Keyvault, Full Disk Access, Automation, profile.++import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vitest";+import { RouterProvider, createMemoryHistory, createRootRoute, createRoute, createRouter } from "@tanstack/react-router";+import type { KvReadiness, TeleportSetup, TeleportStore } from "@/bridge";+import { demoReadiness } from "@/bridge/adapters/demo/teleport";+import { TeleportSetupSheet } from "@/components/teleport/setup-sheet";++afterEach(cleanup);++function store() {+ return {+ close: vi.fn(),+ openPane: vi.fn(async () => {}),+ useTabsOnly: vi.fn(),+ chooseProfile: vi.fn(async () => {}),+ } as unknown as TeleportStore & Record<string, ReturnType<typeof vi.fn>>;+}++function sheet(readiness: KvReadiness, t: TeleportStore, extra: Partial<TeleportSetup> = {}) {+ const setup: TeleportSetup = {+ open: true,+ checking: false,+ readiness,+ profile: readiness.profile ?? null,+ error: null,+ blocked: !readiness.keyvault_initialized || readiness.files.state === "denied" || readiness.profile_empty,+ ...extra,+ };+ const root = createRootRoute({ component: () => <TeleportSetupSheet setup={setup} teleport={t} /> });+ const keyvault = createRoute({ getParentRoute: () => root, path: "/keyvault", component: () => null });+ const router = createRouter({ routeTree: root.addChildren([keyvault]), history: createMemoryHistory({ initialEntries: ["/"] }) });+ return render(<RouterProvider router={router} />);+}++const row = (key: string) => document.querySelector<HTMLElement>(`[data-setup-row="${key}"]`);+const states = () => [...document.querySelectorAll<HTMLElement>("[data-setup-state]")].map((e) => e.dataset.setupState);++describe("Teleport setup sheet", () => {+ it("says in plain words that Full Disk Access is needed, and offers open tabs only", async () => {+ const t = store();+ sheet(demoReadiness(null, "blocked", 1), t);+ await screen.findByText(/cannot be teleported yet/);+ expect(document.querySelector("[data-teleport-setup]")?.getAttribute("data-teleport-setup")).toBe("blocked");+ expect(states()).toEqual(["Ready", "Needed", "Asked when needed"]);+ const say = document.querySelector("[data-setup-say='files']")!.textContent!;+ expect(say).toContain("Full Disk Access");+ expect(say).toContain("restart the Cua daemon");+ expect(say).not.toContain("os error");+ fireEvent.click(screen.getByRole("button", { name: "Open Settings" }));+ expect(t.openPane).toHaveBeenCalledWith(expect.stringContaining("Privacy_AllFiles"));+ fireEvent.click(screen.getByRole("button", { name: "Send open tabs only" }));+ expect(t.useTabsOnly).toHaveBeenCalled();+ });++ it("lists the profiles with name and account, the last used marked, and chooses one", async () => {+ const t = store();+ sheet(demoReadiness(null, "profiles", 2), t);+ await screen.findByText(/Choose the Google Chrome profile/);+ const profiles = [...document.querySelectorAll<HTMLElement>("[data-setup-profile]")];+ expect(profiles.map((p) => p.dataset.setupProfile)).toEqual(["Default", "Profile 1", "Profile 2"]);+ expect(profiles[1]!.textContent).toContain("Work");+ expect(profiles[1]!.textContent).toContain("[email protected]");+ expect(profiles[1]!.textContent).toContain("Used last");+ expect(profiles[0]!.textContent).not.toContain("Used last");+ // Nothing blocks, so no Open Settings and no tabs-only.+ expect(screen.queryByRole("button", { name: "Open Settings" })).toBeNull();+ expect(row("tabs-only")).toBeNull();+ fireEvent.click(profiles[2]!.querySelector("[role='radio']")!);+ expect(t.chooseProfile).toHaveBeenCalledWith("Profile 2");+ });++ it("asks for the Keyvault first when it does not exist, and leaves for its page", async () => {+ const t = store();+ sheet({ ...demoReadiness(null, "ready", 2), keyvault_initialized: false }, t);+ await screen.findByText(/Create it first/);+ expect(states()[0]).toBe("Not set up");+ fireEvent.click(screen.getByRole("link", { name: "Set up" }));+ expect(t.close).toHaveBeenCalled();+ });++ it("says a profile with no sign-in data names the profiles that exist", async () => {+ const t = store();+ const r = demoReadiness("Profile 2", "profiles", 2);+ sheet({ ...r, profile_empty: true, files: { state: "granted", say: 'The browser profile "Profile 2" has no sign-in data. Profiles found: Default, Profile 1.' } }, t);+ await screen.findByText(/has no sign-in data/);+ expect(document.querySelector("[data-teleport-setup]")?.getAttribute("data-teleport-setup")).toBe("blocked");+ });++ it("uses words, never a dot between them, and never a device", async () => {+ sheet(demoReadiness(null, "blocked", 1), store());+ await screen.findByText(/cannot be teleported yet/);+ const text = document.body.textContent ?? "";+ expect(text).not.toContain("·");+ expect(text.toLowerCase()).not.toContain("device");+ });+});diff --git a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.tsindex 78cd1f31c3..83bfb7e0aa 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/contract-args.ts@@ -87,6 +87,7 @@ export const DEMO_ARGS: { [K in OpName]: OpArgs<K> } = {runId: "run-contract",},"teleport.sites": { providerId: "chrome" },+ "teleport.readiness": { providerId: "chrome", profile: null },"teleport.remembered": { providerId: "chrome", spaceId: SPACE },"teleport.streamWindow": { spaceId: SPACE, spaceName: "design-review", windowId: "w-1", appName: "Firefox", title: "Mozilla Firefox" },"sharing.list": { spaceId: SPACE },diff --git a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.tsindex e40cc1c8dc..8cbd489931 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/coverage.test.ts@@ -87,6 +87,7 @@ const ARGS: { [K in OpName]: OpArgs<K> } = {"teleport.plan": { spaceId: "s1", entry: { json: "{}" } as never, move: "app_only", files: [], sensitiveGroups: [] },"teleport.run": { spaceId: "s1", plan: { json: "{}" } as never, consent: { approved: true, acknowledgeSensitive: false }, runId: "run-1" },"teleport.sites": { providerId: "chrome" },+ "teleport.readiness": { providerId: "chrome", profile: null },"teleport.remembered": { providerId: "chrome", spaceId: "s1" },"teleport.streamWindow": { spaceId: "s1", spaceName: "Aurora", windowId: "w-1", appName: "Firefox", title: "Mozilla Firefox" },"sharing.list": { spaceId: "s1" },diff --git a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.tsindex 7e90526032..c30164e22b 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/hosts.test.ts@@ -944,10 +944,42 @@ describe("webkit adapter", () => {["teleport.catalog", { spaceId: "s1" }],["teleport.plan", { spaceId: "s1", entry: { id: "com.apple.Safari" }, move: "app_with_state", files: [], sensitiveGroups: ["sign_ins"] }],["teleport.run", { spaceId: "s1", plan: { json: "plan-1" }, consent: { approved: true, acknowledgeSensitive: true }, runId: "r1" }],- ["teleport.sites", { providerId: "safari" }],+ ["teleport.sites", { providerId: "safari", profile: null }],]);});+ it("maps the teleport readiness check onto the core's words", async () => {+ const { win, sent } = webkitHost((req) =>+ req.method === "teleport.readiness"+ ? ok({+ providerId: "chrome",+ appDisplay: "Google Chrome",+ keyvaultInitialized: true,+ keyvaultUnlocked: false,+ profile: "Profile 1",+ defaultProfile: "Default",+ profiles: [+ { dir: "Default", name: "Personal", lastUsed: false },+ { dir: "Profile 1", name: "Work", account: "[email protected]", lastUsed: true },+ ],+ files: { state: "denied", say: "Turn on Full Disk Access." },+ tabs: { state: "unknown", say: "" },+ profileEmpty: false,+ })+ : ok(null),+ );+ const got = await createWebkitAdapter(win).call("teleport.readiness", { providerId: "chrome" });+ expect(got).toMatchObject({+ provider_id: "chrome",+ keyvault_initialized: true,+ default_profile: "Default",+ profiles: [{ dir: "Default", last_used: false }, { dir: "Profile 1", account: "[email protected]", last_used: true }],+ files: { state: "denied" },+ profile_empty: false,+ });+ expect(sent.map((r) => [r.method, r.args])).toEqual([["teleport.readiness", { providerId: "chrome", profile: null }]]);+ });+it("sends only clean usage events, and opens only System Settings panes", async () => {const { win, sent } = webkitHost(() => ok(null));const a = createWebkitAdapter(win);diff --git a/apps/cua-spaces-web/src/bridge/__tests__/teleport.test.ts b/apps/cua-spaces-web/src/bridge/__tests__/teleport.test.tsindex 9961d99068..60331ff22c 100644--- a/apps/cua-spaces-web/src/bridge/__tests__/teleport.test.ts+++ b/apps/cua-spaces-web/src/bridge/__tests__/teleport.test.ts@@ -235,6 +235,145 @@ describe.skipIf(!wasmBuilt)("teleport picker", () => {});});+describe.skipIf(!wasmBuilt)("teleport setup sheet", () => {+ /** A demo adapter that records what the host was asked. */+ function spy() {+ const base = createDemoAdapter({ latencyMs: 0, stepMs: 2 });+ const calls: [string, unknown][] = [];+ const adapter = Object.assign(Object.create(base) as DataAdapter, {+ call: ((op: string, args: unknown) => {+ calls.push([op, args]);+ return (base.call as (o: string, a: unknown) => Promise<unknown>).call(base, op, args);+ }) as DataAdapter["call"],+ });+ return { adapter, calls, ops: (op: string) => calls.filter(([o]) => o === op).map(([, a]) => a) };+ }++ /** Chrome's sign-ins as far as the plan. */+ async function planChrome(t: TeleportStore) {+ t.open(space);+ await until(() => expect(t.getSession()!.state.step).toBe("pick"));+ t.setQuery("chrome");+ await t.activate(t.getSession()!.grid.sections.flatMap((x) => x.tiles)[0]);+ t.send({ type: "move", move: "app_with_state" });+ t.send({ type: "sensitive", group: "sign_ins", value: true });+ await t.plan();+ }++ const mode = (m: string | null) => {+ if (m) localStorage.setItem("cua.demo.teleportSetup", m);+ else localStorage.removeItem("cua.demo.teleportSetup");+ };++ it("has nothing to say when one profile is ready: the review comes straight up", async () => {+ mode(null);+ const h = spy();+ const t = new TeleportStore(h.adapter, await testCore());+ await planChrome(t);+ await until(() => expect(t.getSession()!.frame.review!.needsDomains).toBe(false));+ expect(t.getSession()!.setup).toBeNull();+ expect(h.ops("teleport.readiness")).toEqual([{ providerId: "chrome", profile: null }]);+ });++ it("stops at the sheet when Full Disk Access is off: nothing is read, no Touch ID is asked, until it is on", async () => {+ mode("blocked");+ try {+ const h = spy();+ const t = new TeleportStore(h.adapter, await testCore());+ await planChrome(t);+ const sheet = await until(() => {+ const s = t.getSession()!.setup;+ expect(s?.open).toBe(true);+ return s!;+ });+ expect(sheet.blocked).toBe(true);+ expect(sheet.readiness!.files.state).toBe("denied");+ expect(sheet.readiness!.files.say).toContain("Full Disk Access");+ // The sites (which asks for Touch ID) and the saved items are not read yet.+ expect(h.ops("teleport.sites")).toEqual([]);+ // Continue is refused while blocked.+ await t.finishSetup();+ expect(t.getSession()!.setup?.open).toBe(true);+ expect(h.ops("teleport.sites")).toEqual([]);+ // Turned on: checked again, the last used profile is the one to read, Continue works.+ await t.recheckSetup();+ const ready = t.getSession()!.setup!;+ expect(ready.blocked).toBe(false);+ expect(ready.profile).toBe("Profile 1");+ await t.finishSetup();+ await until(() => expect(t.getSession()!.frame.review!.needsDomains).toBe(false));+ expect(t.getSession()!.setup).toBeNull();+ expect(h.ops("teleport.sites")).toEqual([{ providerId: "chrome", profile: "Profile 1" }]);+ } finally {+ mode(null);+ }+ });++ it("reads the profile that was chosen, and carries it to the run", async () => {+ mode("profiles");+ try {+ const h = spy();+ const t = new TeleportStore(h.adapter, await testCore());+ await planChrome(t);+ await until(() => expect(t.getSession()!.setup?.open).toBe(true));+ expect(t.getSession()!.setup!.blocked).toBe(false);+ expect(t.getSession()!.setup!.readiness!.profiles.map((p) => p.name)).toEqual(["Personal", "Work", "Side project"]);+ await t.chooseProfile("Profile 2");+ expect(h.ops("teleport.readiness").at(-1)).toEqual({ providerId: "chrome", profile: "Profile 2" });+ await t.finishSetup();+ await until(() => expect(t.getSession()!.frame.review!.needsDomains).toBe(false));+ expect(h.ops("teleport.sites")).toEqual([{ providerId: "chrome", profile: "Profile 2" }]);+ t.send({ type: "acknowledge", value: true });+ await t.confirm();+ await until(() => expect(t.getSession()!.state.step).toBe("done"));+ const run = h.ops("teleport.run")[0] as { consent: { profile?: string } };+ expect(run.consent.profile).toBe("Profile 2");+ } finally {+ mode(null);+ }+ });++ it("offers open tabs only when Full Disk Access is off: signed-in sites are left out", async () => {+ mode("blocked");+ try {+ const h = spy();+ const t = new TeleportStore(h.adapter, await testCore());+ await planChrome(t);+ await until(() => expect(t.getSession()!.setup?.open).toBe(true));+ t.useTabsOnly();+ const s = t.getSession()!;+ expect(s.setup).toBeNull();+ expect(s.state.step).toBe("options");+ expect(s.frame.planSensitive).toEqual([]);+ expect(h.ops("teleport.sites")).toEqual([]);+ } finally {+ mode(null);+ }+ });++ it("says a macOS refusal as the sentence alone, without the prefixes it travelled with", async () => {+ const base = createDemoAdapter({ latencyMs: 0, stepMs: 2 });+ const adapter = Object.assign(Object.create(base) as DataAdapter, {+ call: ((op: string, args: unknown) =>+ op === "teleport.run"+ ? Promise.reject(new Error("teleport refused: chrome: macOS is not letting Cua read this browser's files. Turn on Full Disk Access."))+ : (base.call as (o: string, a: unknown) => Promise<unknown>).call(base, op, args)) as DataAdapter["call"],+ });+ mode(null);+ const t = new TeleportStore(adapter, await testCore());+ await planChrome(t);+ await until(() => expect(t.getSession()!.frame.review!.needsDomains).toBe(false));+ t.send({ type: "acknowledge", value: true });+ await t.confirm();+ const failed = await until(() => {+ const s = t.getSession()!;+ expect(s.state.step).toBe("error");+ return s;+ });+ expect(failed.state.error).toBe("macOS is not letting Cua read this browser's files. Turn on Full Disk Access.");+ });+});+describe.skipIf(!wasmBuilt)("share sheet", () => {it("shares, changes nothing while busy, and removes", async () => {const s = new ShareStore(createDemoAdapter({ latencyMs: 0, stepMs: 2 }), await testCore());diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/teleport.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/teleport.tsindex f35f5e8376..df00b0f24b 100644--- a/apps/cua-spaces-web/src/bridge/adapters/demo/teleport.ts+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/teleport.ts@@ -13,6 +13,7 @@ import type {CatalogEntry,ConsentItem,KvInventory,+ KvReadiness,OpenWindow,RemoteWindow,SensitiveGroup,@@ -149,6 +150,50 @@ export const DEMO_CHROME_SITES: KvInventory = {],};+/** The demo's teleport setup: `ready` (one profile, nothing to do: the review+ * comes straight up), `profiles` (three profiles to choose from), or `blocked`+ * (three profiles and Full Disk Access off, granted on the second check as a+ * person would after turning it on). Chosen with the localStorage key+ * `cua.demo.teleportSetup`, so the sheet can be seen in both states. */+export type DemoSetupMode = "ready" | "profiles" | "blocked";++export function demoSetupMode(): DemoSetupMode {+ try {+ const v = localStorage.getItem("cua.demo.teleportSetup");+ return v === "profiles" || v === "blocked" ? v : "ready";+ } catch {+ return "ready";+ }+}++export function demoReadiness(profile: string | null | undefined, mode: DemoSetupMode, checks: number): KvReadiness {+ const all = [+ { dir: "Default", name: "Personal", account: "[email protected]", last_used: false },+ { dir: "Profile 1", name: "Work", account: "[email protected]", last_used: true },+ { dir: "Profile 2", name: "Side project", account: null, last_used: false },+ ];+ const profiles = mode === "ready" ? [{ ...all[0]!, last_used: true }] : all;+ const chosen = profile ?? profiles.find((p) => p.last_used)?.dir ?? "Default";+ const blocked = mode === "blocked" && checks <= 1;+ return {+ provider_id: "chrome",+ app_display: "Google Chrome",+ keyvault_initialized: true,+ keyvault_unlocked: true,+ profile: chosen,+ default_profile: "Default",+ profiles,+ files: blocked+ ? {+ state: "denied",+ say: "macOS is not letting Cua read this browser's files. Teleporting sign-ins needs Full Disk Access for Cua: open System Settings, Privacy & Security, Full Disk Access, and turn on Cua. Then restart the Cua daemon, because macOS only applies the setting to programs that start after it is on. Without it you can still teleport open tabs only.",+ }+ : { state: "granted", say: "" },+ tabs: { state: "unknown", say: "" },+ profile_empty: false,+ };+}+const MB = 1_048_576;function consentFor(e: CatalogEntry, move: TeleportMove, files: string[], groups: SensitiveGroup[]): ConsentItem[] {@@ -184,6 +229,7 @@ export interface DemoTeleportDeps {}export function demoTeleportHandlers({ wait, emit, now, stepMs }: DemoTeleportDeps): TeleportHandlers {+ let readinessChecks = 0;const catalog = () => demoCatalog(now());const find = (id: string) => {const e = catalog().find((x) => x.id === id);@@ -249,6 +295,11 @@ export function demoTeleportHandlers({ wait, emit, now, stepMs }: DemoTeleportDeif (providerId !== "chrome") throw new HostError(`no sites saved for ${providerId}`, "not_found");return structuredClone(DEMO_CHROME_SITES);},+ "teleport.readiness": async ({ providerId, profile }) => {+ if (providerId !== "chrome") throw new HostError(`no sign-ins to check for ${providerId}`, "not_found");+ readinessChecks += 1;+ return structuredClone(demoReadiness(profile, demoSetupMode(), readinessChecks));+ },"teleport.remembered": async () => null,"teleport.streamWindow": async () => null,};diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.jsonindex 374ba7ed2e..891cc2c6ee 100644--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json@@ -8875,6 +8875,114 @@"json"]},+ "teleport.readiness": {+ "type": "object",+ "properties": {+ "provider_id": {+ "type": "string"+ },+ "app_display": {+ "type": "string"+ },+ "keyvault_initialized": {+ "type": "boolean"+ },+ "keyvault_unlocked": {+ "type": "boolean"+ },+ "profile": {+ "type": [+ "string",+ "null"+ ]+ },+ "default_profile": {+ "type": [+ "string",+ "null"+ ]+ },+ "profiles": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "dir": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "account": {+ "type": [+ "string",+ "null"+ ]+ },+ "last_used": {+ "type": "boolean"+ }+ },+ "required": [+ "dir",+ "name",+ "last_used"+ ]+ }+ },+ "files": {+ "type": "object",+ "properties": {+ "state": {+ "enum": [+ "granted",+ "denied",+ "unknown"+ ]+ },+ "say": {+ "type": "string"+ }+ },+ "required": [+ "state",+ "say"+ ]+ },+ "tabs": {+ "type": "object",+ "properties": {+ "state": {+ "enum": [+ "granted",+ "denied",+ "unknown"+ ]+ },+ "say": {+ "type": "string"+ }+ },+ "required": [+ "state",+ "say"+ ]+ },+ "profile_empty": {+ "type": "boolean"+ }+ },+ "required": [+ "provider_id",+ "app_display",+ "keyvault_initialized",+ "keyvault_unlocked",+ "profiles",+ "files",+ "tabs",+ "profile_empty"+ ]+ },"teleport.remembered": {"type": ["array",@@ -11502,6 +11610,114 @@"json"]},+ "teleport.readiness": {+ "type": "object",+ "properties": {+ "providerId": {+ "type": "string"+ },+ "appDisplay": {+ "type": "string"+ },+ "keyvaultInitialized": {+ "type": "boolean"+ },+ "keyvaultUnlocked": {+ "type": "boolean"+ },+ "profile": {+ "type": [+ "string",+ "null"+ ]+ },+ "defaultProfile": {+ "type": [+ "string",+ "null"+ ]+ },+ "profiles": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "dir": {+ "type": "string"+ },+ "name": {+ "type": "string"+ },+ "account": {+ "type": [+ "string",+ "null"+ ]+ },+ "lastUsed": {+ "type": "boolean"+ }+ },+ "required": [+ "dir",+ "name",+ "lastUsed"+ ]+ }+ },+ "files": {+ "type": "object",+ "properties": {+ "state": {+ "enum": [+ "granted",+ "denied",+ "unknown"+ ]+ },+ "say": {+ "type": "string"+ }+ },+ "required": [+ "state",+ "say"+ ]+ },+ "tabs": {+ "type": "object",+ "properties": {+ "state": {+ "enum": [+ "granted",+ "denied",+ "unknown"+ ]+ },+ "say": {+ "type": "string"+ }+ },+ "required": [+ "state",+ "say"+ ]+ },+ "profileEmpty": {+ "type": "boolean"+ }+ },+ "required": [+ "providerId",+ "appDisplay",+ "keyvaultInitialized",+ "keyvaultUnlocked",+ "profiles",+ "files",+ "tabs",+ "profileEmpty"+ ]+ },"teleport.remembered": {"type": ["array",diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.tsindex 49dbbf5ab6..c1fad318b8 100644--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts@@ -61,7 +61,7 @@ import type { AboutInput, DriveCheckInput, DriveStorageInput, LoginItemReport, Rimport type { ShareEntry, ShareRemoval } from "./share";import type { BulkResult } from "./spaces-page";import type { CreateFix, CreatingElsewhere, SpaceAccess, SpaceProgress, SpaceRow, SpaceSharingFacts } from "./spaces";-import type { CatalogEntry, ConsentItem, KvDomainCount, KvInventory, OpenWindow, PlanStep, RemoteWindow, RunReport, TeleportPlan } from "./teleport";+import type { CatalogEntry, ConsentItem, KvBrowserProfile, KvDomainCount, KvInventory, KvReadiness, KvReadinessCheck, 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";@@ -1335,6 +1335,18 @@ export const OP_SHAPES: Record<OpName, Schema> = {),notes: opt(strings),}),+ "teleport.readiness": obj<KvReadiness>()({+ provider_id: str,+ app_display: str,+ keyvault_initialized: bool,+ keyvault_unlocked: bool,+ profile: opt(nullable(str)),+ default_profile: opt(nullable(str)),+ profiles: list(obj<KvBrowserProfile>()({ dir: str, name: str, account: opt(nullable(str)), last_used: bool })),+ files: obj<KvReadinessCheck>()({ state: oneOf("granted", "denied", "unknown"), say: str }),+ tabs: obj<KvReadinessCheck>()({ state: oneOf("granted", "denied", "unknown"), say: str }),+ profile_empty: bool,+ }),"teleport.remembered": nullable(strings),"teleport.streamWindow": nul,"sharing.list": shares,@@ -1731,6 +1743,20 @@ const WkKvInventory = object({notes: strings,});+const WkReadinessCheck = object({ state: oneOf("granted", "denied", "unknown"), say: str });+const WkKvReadiness = object({+ providerId: str,+ appDisplay: str,+ keyvaultInitialized: bool,+ keyvaultUnlocked: bool,+ profile: optNull(str),+ defaultProfile: optNull(str),+ profiles: list(object({ dir: str, name: str, account: optNull(str), lastUsed: bool })),+ files: WkReadinessCheck,+ tabs: WkReadinessCheck,+ profileEmpty: bool,+});+/** What the SwiftUI host answers each method with (shapes `adapters/webkit.ts` reads). */export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {"app.info": WkAppInfoShape,@@ -1804,6 +1830,7 @@ export const WEBKIT_SHAPES: Partial<Record<WebkitMethod, Schema>> = {"teleport.plan": WkTeleportPlan,"teleport.run": OP_SHAPES["teleport.run"],"teleport.sites": WkKvInventory,+ "teleport.readiness": WkKvReadiness,"teleport.remembered": nullable(strings),"teleport.streamWindow": nul,"sharing.list": shares,diff --git a/apps/cua-spaces-web/src/bridge/contracts/teleport.ts b/apps/cua-spaces-web/src/bridge/contracts/teleport.tsindex 17637023b7..2d66ad0b11 100644--- a/apps/cua-spaces-web/src/bridge/contracts/teleport.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/teleport.ts@@ -104,6 +104,8 @@ export interface TeleportConsent {/** Reading the app: the sites whose saved passwords to send (the review's* own choice of passwords). */passwordDomains?: string[] | null;+ /** The browser profile to read (`Profile 1`), chosen in the setup sheet; absent reads `Default`. */+ profile?: string | null;}export type PickerStep = "loading" | "pick" | "options" | "planning" | "consent" | "running" | "done" | "error";@@ -152,6 +154,42 @@ export interface KvInventory {notes?: string[];}+/** One thing a teleport needs from the OS (`keyvault::wire::KvReadinessCheck`). */+export interface KvReadinessCheck {+ /** `granted`, `denied`, or `unknown` (macOS only decides on first use). */+ state: "granted" | "denied" | "unknown";+ /** What it means and what to do, in plain words; empty when nothing. */+ say: string;+}++/** A browser profile to choose from (`KvBrowserProfile`). */+export interface KvBrowserProfile {+ dir: string;+ name: string;+ account?: string | null;+ last_used: boolean;+}++/** Whether a teleport of an app can work now (`KvReadiness`): the Keyvault, what the+ * OS lets the daemon read, and the profiles. Reads no value, asks for no Touch ID. */+export interface KvReadiness {+ provider_id: string;+ app_display: string;+ keyvault_initialized: boolean;+ keyvault_unlocked: boolean;+ /** The profile checked: the one asked for, else the last used. */+ profile?: string | null;+ /** The profile a teleport reads when none is named. */+ default_profile?: string | null;+ profiles: KvBrowserProfile[];+ /** Reading the app's files (Full Disk Access). */+ files: KvReadinessCheck;+ /** Reading the app's open tabs (Automation). */+ tabs: KvReadinessCheck;+ /** The checked profile has no sign-in data. */+ profile_empty: boolean;+}+/** An input to the picker (`flow::PickerEvent`). */export type PickerEvent =| { type: "loaded"; entries: CatalogEntry[] }diff --git a/apps/cua-spaces-web/src/bridge/index.ts b/apps/cua-spaces-web/src/bridge/index.tsindex f44497549b..f3853b6da5 100644--- a/apps/cua-spaces-web/src/bridge/index.ts+++ b/apps/cua-spaces-web/src/bridge/index.ts@@ -54,7 +54,20 @@ export type {} from "./store";export { newPendingId } from "./store";export type { TranscriptItem, TranscriptStep } from "./transcript";-export { GRID_COLUMNS, iconKey, thumbnailKey, useTeleport, type TeleportHook, type TeleportSession, type TeleportStore } from "./teleport";+export {+ AUTOMATION_PANE,+ FULL_DISK_ACCESS_PANE,+ GRID_COLUMNS,+ iconKey,+ setupBlocked,+ setupProfile,+ thumbnailKey,+ useTeleport,+ type TeleportHook,+ type TeleportSession,+ type TeleportSetup,+ type TeleportStore,+} from "./teleport";export { useShareSheet, type ShareHook, type ShareSession } from "./share";export { useShareRemovalNote, type ShareRemovalNoteHook } from "./removal-note";export {diff --git a/apps/cua-spaces-web/src/bridge/ops/teleport.ts b/apps/cua-spaces-web/src/bridge/ops/teleport.tsindex 278760a6e4..9da1bdb042 100644--- a/apps/cua-spaces-web/src/bridge/ops/teleport.ts+++ b/apps/cua-spaces-web/src/bridge/ops/teleport.ts@@ -20,6 +20,7 @@* | `teleport.plan` `{spaceId, entry, move, files, sensitiveGroups}` | `teleport_plan` |* | `teleport.run` `{spaceId, plan, consent, runId}` | `teleport_run` (progress on its channel, re-sent as `teleport.progress`) |* | `teleport.sites` `{providerId}` | none: the Keyvault inventory has no Tauri command |+ * | `teleport.readiness` `{providerId, profile?}` | none: the readiness check has no Tauri command |* | `teleport.remembered` `{providerId, spaceId}` | none: the SwiftUI app's remembered site choices are its own setting |* | `teleport.streamWindow` `{spaceId, spaceName, windowId, appName, title}` | `stream_remote_windows` |*@@ -44,6 +45,7 @@import type {CatalogEntry,KvInventory,+ KvReadiness,OpenWindow,PickerTileIcon,PickerTileThumbnail,@@ -78,7 +80,11 @@ export interface TeleportOperations {* Progress arrives as `teleport.progress` events carrying `runId`. */"teleport.run": { args: { spaceId: string; plan: TeleportPlan; consent: TeleportConsent; runId: string }; result: RunReport };/** A browser's sites with counts, from the Keyvault (never values). */- "teleport.sites": { args: { providerId: string }; result: KvInventory };+ "teleport.sites": { args: { providerId: string; profile?: string | null }; result: KvInventory };+ /** Whether a teleport of a browser can work now, checked in plain words before+ * anything is read or any Touch ID is asked: the Keyvault, Full Disk Access,+ * Automation and the profiles (`profile` null: the last used). */+ "teleport.readiness": { args: { providerId: string; profile?: string | null }; result: KvReadiness };/** The sites sent last time to this Space from this browser (the review starts from them), or null. */"teleport.remembered": { args: { providerId: string; spaceId: string }; result: string[] | null };/** Streams one of the Space's windows onto this machine (From <Space>). */@@ -103,6 +109,7 @@ export const TELEPORT_OPERATIONS = ["teleport.plan","teleport.run","teleport.sites",+ "teleport.readiness","teleport.remembered","teleport.streamWindow",] as const satisfies readonly TeleportOpName[];@@ -112,7 +119,7 @@ export type TeleportHostEvent = { type: "teleport.progress"; runId: string; evenexport const TELEPORT_EVENTS = ["teleport.progress"] as const;/** No Tauri command answers these (`TAURI_UNSUPPORTED`). */-export const TELEPORT_TAURI_UNSUPPORTED = ["teleport.sites", "teleport.remembered"] as const satisfies readonly TeleportOpName[];+export const TELEPORT_TAURI_UNSUPPORTED = ["teleport.sites", "teleport.readiness", "teleport.remembered"] as const satisfies readonly TeleportOpName[];/* ---- Coverage (`../coverage.ts`) ------------------------------------------ */@@ -132,6 +139,7 @@ export const TELEPORT_COVERAGE = {"teleport.plan": row("teleport.plan", ["teleport_plan"]),"teleport.run": row("teleport.run", ["teleport_run"]),"teleport.sites": row("teleport.sites", [], "the Keyvault inventory has no Tauri command"),+ "teleport.readiness": row("teleport.readiness", [], "the readiness check has no Tauri command"),"teleport.remembered": row("teleport.remembered", [], "remembered site choices are the SwiftUI app's setting"),"teleport.streamWindow": row("teleport.streamWindow", ["stream_remote_windows"]),} as const;@@ -245,6 +253,7 @@ export function consentToSdk(c: TeleportConsent): Json {from_vault: c.fromVault ?? null,include_passwords: Boolean(c.includePasswords),password_domains: c.passwordDomains ?? null,+ profile: c.profile ?? null,};}@@ -279,7 +288,7 @@ export function tauriTeleportOps(/** `window.__TAURI_INTERNALS__`. */tauriInternals: unknown,emit: (e: TeleportHostEvent) => void,-): Omit<TeleportHandlers, "teleport.sites" | "teleport.remembered"> {+): Omit<TeleportHandlers, "teleport.sites" | "teleport.readiness" | "teleport.remembered"> {const internals = tauriInternals as TauriInternals | undefined;return {"teleport.catalog": async ({ spaceId }) => ((await invoke<Json[] | null>("teleport_catalog", { spaceId })) ?? []).map(entryFromSdk),diff --git a/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts b/apps/cua-spaces-web/src/bridge/ops/webkit-pages.tsindex 3cb2852f2c..5efb4b6826 100644--- a/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts+++ b/apps/cua-spaces-web/src/bridge/ops/webkit-pages.ts@@ -22,7 +22,7 @@import { HostError } from "../adapter";import type { HostStatus } from "../contracts/host";import type { SpaceRow } from "../contracts/spaces";-import type { CatalogEntry, KvInventory, RunEvent, TeleportPlan } from "../contracts/teleport";+import type { CatalogEntry, KvInventory, KvReadiness, RunEvent, TeleportPlan } from "../contracts/teleport";import type { HostEvent, OpArgs, OpName, OpResult } from "../protocol";import type { WebkitMethod, WkHostState, WkSpace } from "../webkit-protocol";import { isSettingsPane } from "./host-setup";@@ -49,6 +49,7 @@ export const WEBKIT_PAGE_OPS = ["teleport.plan","teleport.run","teleport.sites",+ "teleport.readiness","teleport.remembered","teleport.streamWindow","sharing.list",@@ -231,7 +232,9 @@ export function webkitPageOps(request: Request, toHostStatus: (h: WkHostState) =// As long as the run takes (an install downloads the app); it reports// progress as it goes (teleport.progress) and answers when it is done."teleport.run": ({ spaceId, plan, consent, runId }) => request("teleport.run", { spaceId, plan: { json: plan?.json }, consent, runId }, null),- "teleport.sites": async ({ providerId }) => snake(await request("teleport.sites", { providerId })) as KvInventory,+ "teleport.sites": async ({ providerId, profile }) => snake(await request("teleport.sites", { providerId, profile: profile ?? null })) as KvInventory,+ "teleport.readiness": async ({ providerId, profile }) =>+ snake(await request("teleport.readiness", { providerId, profile: profile ?? null })) as KvReadiness,"teleport.remembered": async ({ providerId, spaceId }) => (await request<string[] | null>("teleport.remembered", { providerId, spaceId })) ?? null,"teleport.streamWindow": none("teleport.streamWindow"),diff --git a/apps/cua-spaces-web/src/bridge/teleport.ts b/apps/cua-spaces-web/src/bridge/teleport.tsindex 85d22f8f0c..2db9208ce8 100644--- a/apps/cua-spaces-web/src/bridge/teleport.ts+++ b/apps/cua-spaces-web/src/bridge/teleport.ts@@ -23,6 +23,7 @@ import type { KeyvaultOverview, VaultAction, VaultSource, VaultState, VaultViewimport type {CatalogEntry,EntrySection,+ KvReadiness,OpenWindow,PickerEvent,PickerFrame,@@ -112,8 +113,39 @@ export interface TeleportSession {/** The app's saved Keyvault items as the review lists them (the Keyvault* as the source, once read); null while the live app is the source. */vault: { view: VaultView; query: string } | null;+ /** The setup sheet, while a browser teleport has something to set up or a profile to choose. */+ setup: TeleportSetup | null;}+/** The teleport setup sheet: what a browser teleport needs, checked in plain+ * words before any Touch ID. It stands in for the review while something+ * needs doing (or a profile has to be chosen), and goes once it is done. */+export interface TeleportSetup {+ /** The sheet is showing. */+ open: boolean;+ /** A check is running. */+ checking: boolean;+ /** The last answer; null before the first. */+ readiness: KvReadiness | null;+ /** The profile to read (a directory name such as `Profile 1`). */+ profile: string | null;+ /** The check itself could not be made, in words. */+ error: string | null;+ /** Something stops the teleport: the Keyvault, Full Disk Access or an empty profile. */+ blocked: boolean;+}++/** What stops a browser teleport, from the check's answer. */+export const setupBlocked = (r: KvReadiness): boolean => !r.keyvault_initialized || r.files.state === "denied" || r.profile_empty;++/** The profile to start from: the one chosen, else the last used, else the default. */+export const setupProfile = (r: KvReadiness, chosen: string | null): string | null =>+ chosen ?? r.profiles.find((p) => p.last_used)?.dir ?? r.default_profile ?? r.profiles[0]?.dir ?? null;++/** The privacy panes the sheet opens (System Settings, Privacy and Security). */+export const FULL_DISK_ACCESS_PANE = "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles";+export const AUTOMATION_PANE = "x-apple.systempreferences:com.apple.preference.security?Privacy_Automation";+/** The Keyvault as the review lists it: what a teleport can send, with the* list's own state (search, selection, open groups). */interface ReviewVault {@@ -135,6 +167,9 @@ interface Session {readingSites: boolean;vault: ReviewVault | null;runId: string | null;+ setup: TeleportSetup | null;+ /** The browser profile chosen in the setup sheet; null reads the default. */+ profile: string | null;}/** An image the grid shows (an icon or a live preview), by what it asks for. */@@ -155,7 +190,17 @@ export const MAX_READS = 4;* (they sign in through site login), so they are not offered here. */const reviewOverview = (o: KeyvaultOverview): KeyvaultOverview => ({ ...o, items: o.items.filter((i) => i.kind !== "password") });-const words = (e: unknown) => (e instanceof Error ? e.message : String(e));+const words = (e: unknown) => plainWords(e);+/** A host's failure as the person should read it: a macOS permission refusal is+ * only the sentence that says what to turn on, without the prefixes it travelled with. */+function plainWords(e: unknown): string {+ const m = e instanceof Error ? e.message : String(e);+ const i = m.indexOf("macOS is not letting");+ return i >= 0 ? m.slice(i) : m;+}++/** The apps the setup sheet is for: browsers that keep sign-ins in a profile. */+const BROWSERS = new Set(["chrome", "edge", "chromium"]);let runs = 0;export class TeleportStore {@@ -208,6 +253,7 @@ export class TeleportStore {query: s.tab === "apps" ? s.state.query : s.windowQuery,remoteError: s.remoteError,readingSites: s.readingSites,+ setup: s.setup,vault:s.vault && frame.review?.source === "vault"? {@@ -239,7 +285,7 @@ export class TeleportStore {send(event: PickerEvent): void {const s = this.session;if (!s) return;- this.patch({ state: pickerReduce(this.core, s.state, event) });+ this.patch({ state: pickerReduce(this.core, s.state, event), ...(event.type === "back" && s.setup ? { setup: null } : {}) });}/** Opens the picker for a Space and reads the catalog and both window@@ -263,6 +309,8 @@ export class TeleportStore {readingSites: false,vault: null,runId: null,+ setup: null,+ profile: null,};this.publish();const opened = ++this.generation;@@ -386,12 +434,52 @@ export class TeleportStore {if (!s || !provider) return;const opened = this.generation;const live = () => this.generation === opened;+ // A browser that sends its sign-ins: what it needs is checked, in words,+ // before the sites are listed (which asks for Touch ID) or anything is read.+ if (this.view?.frame.review?.needsDomains && BROWSERS.has(provider)) {+ this.patch({ setup: { open: false, checking: true, readiness: null, profile: s.profile, error: null, blocked: false } });+ const ready = await this.checkSetup(provider, s.profile, live);+ if (!live()) return;+ // Something to do, or a profile to choose: the sheet comes first.+ if (ready && (setupBlocked(ready) || ready.profiles.length > 1)) {+ this.patch({ setup: { ...this.session!.setup!, open: true } });+ return;+ }+ this.patch({ setup: null });+ }+ await this.loadSites(provider, live);+ }++ /** Asks the host whether a teleport of `provider` can work now. Reads no+ * value and asks for no Touch ID. Null when the check itself failed. */+ private async checkSetup(provider: string, profile: string | null, live: () => boolean): Promise<KvReadiness | null> {+ try {+ const readiness = await this.adapter.call("teleport.readiness", { providerId: provider, profile });+ if (!live() || !this.session?.setup) return null;+ const chosen = setupProfile(readiness, profile);+ this.patch({+ profile: chosen,+ setup: { ...this.session.setup, checking: false, readiness, profile: chosen, error: null, blocked: setupBlocked(readiness) },+ });+ return readiness;+ } catch (e) {+ if (live() && this.session?.setup) {+ this.patch({ setup: { ...this.session.setup, checking: false, error: plainWords(e), blocked: false } });+ }+ return null;+ }+ }++ /** The browser's sites and the saved items, once the setup is done. */+ private async loadSites(provider: string, live: () => boolean): Promise<void> {+ const s = this.session;+ if (!s) return;const needsDomains = Boolean(this.view?.frame.review?.needsDomains);await this.loadVault(provider, live);if (!live() || !needsDomains) return;this.patch({ readingSites: true });try {- const inventory = await this.adapter.call("teleport.sites", { providerId: provider });+ const inventory = await this.adapter.call("teleport.sites", { providerId: provider, profile: s.profile });// Not asked of every host: no remembered choice is a fresh start.const remembered = await this.adapter.call("teleport.remembered", { providerId: provider, spaceId: s.spaceId }).catch(() => null);if (!live()) return;@@ -404,6 +492,48 @@ export class TeleportStore {}}+ /** The setup sheet's Check again: asks again (after Full Disk Access was+ * turned on, or the Keyvault set up) with the profile chosen. */+ async recheckSetup(): Promise<void> {+ const s = this.session;+ const provider = s?.state.entry?.providerId;+ if (!s?.setup || !provider) return;+ const opened = this.generation;+ this.patch({ setup: { ...s.setup, checking: true } });+ await this.checkSetup(provider, s.profile, () => this.generation === opened);+ }++ /** Chooses the browser profile, then checks that one. */+ async chooseProfile(dir: string): Promise<void> {+ const s = this.session;+ if (!s?.setup) return;+ this.patch({ profile: dir, setup: { ...s.setup, profile: dir } });+ await this.recheckSetup();+ }++ /** Continue: the setup is done, so the review reads the sites of the chosen profile. */+ async finishSetup(): Promise<void> {+ const s = this.session;+ const provider = s?.state.entry?.providerId;+ if (!s?.setup || !provider || s.setup.blocked) return;+ const opened = this.generation;+ this.patch({ setup: null });+ await this.loadSites(provider, () => this.generation === opened);+ }++ /** Without Full Disk Access, send open tabs only: back to the options with+ * the signed-in sites left out. */+ useTabsOnly(): void {+ this.patch({ setup: null });+ this.send({ type: "back" });+ this.send({ type: "sensitive", group: "sign_ins", value: false });+ }++ /** Opens the System Settings pane for Full Disk Access or Automation. */+ async openPane(url: string): Promise<void> {+ await this.adapter.call("host.openSettings", { url }).catch(() => null);+ }+/** The saved items a teleport can send for `provider`: passwords are never* listed here (they sign in through site login), and the core counts the* rest. Without a Keyvault the review simply sends from the app. */@@ -463,7 +593,7 @@ export class TeleportStore {const s = this.session;const plan = s?.state.plan;if (!s || !plan || !this.view?.frame.review?.canConfirm) return;- const consent = pickerConsent(this.core, s.state);+ const consent = { ...pickerConsent(this.core, s.state), ...(s.profile ? { profile: s.profile } : {}) };const runId = `run-${++runs}`;this.patch({ runId });this.send({ type: "confirm" });@@ -568,6 +698,8 @@ export class TeleportStore {readingSites: false,vault: null,runId: null,+ setup: null,+ profile: null,};this.publish();}diff --git a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts b/apps/cua-spaces-web/src/bridge/webkit-protocol.tsindex 04f3400e49..d95fa7c487 100644--- a/apps/cua-spaces-web/src/bridge/webkit-protocol.ts+++ b/apps/cua-spaces-web/src/bridge/webkit-protocol.ts@@ -100,6 +100,7 @@ export const WEBKIT_METHODS = ["teleport.plan","teleport.run","teleport.sites",+ "teleport.readiness","teleport.remembered","teleport.streamWindow","sharing.list",diff --git a/apps/cua-spaces-web/src/components/teleport/setup-sheet.tsx b/apps/cua-spaces-web/src/components/teleport/setup-sheet.tsxnew file mode 100644index 0000000000..0a4bb2de5b--- /dev/null+++ b/apps/cua-spaces-web/src/components/teleport/setup-sheet.tsx@@ -0,0 +1,134 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++import { Radio } from "@base-ui/react/radio";+import { RadioGroup } from "@base-ui/react/radio-group";+import { Link } from "@tanstack/react-router";+import { LoaderCircleIcon } from "lucide-react";++import { AUTOMATION_PANE, FULL_DISK_ACCESS_PANE, type KvReadiness, type TeleportSetup, type TeleportStore } from "@/bridge";+import { Button } from "@/components/ui/button";+import { GroupedSection, SettingRow } from "@/components/ui/grouped";++/**+ * Teleport setup: one sheet, shown before a browser's sign-ins are read, that+ * says what a teleport needs and what is missing, in plain words, in place+ * of the raw refusals a first teleport used to end in. Keyvault, Full Disk+ * Access, Automation, the browser profile. Nothing is read to draw it and no+ * Touch ID is asked; Cua cannot turn any of these on (macOS only lets you),+ * so each row says what to do and a button takes you there.+ */+export function TeleportSetupSheet({ setup, teleport }: { setup: TeleportSetup; teleport: TeleportStore }) {+ const r = setup.readiness;+ if (!r) {+ return (+ <div className="flex h-full items-center justify-center gap-2 text-[13px] text-muted-foreground" data-teleport-setup="checking">+ <LoaderCircleIcon className="size-4 animate-spin" /> Checking+ </div>+ );+ }+ const name = r.app_display;+ const denied = r.files.state === "denied";+ return (+ <div className="space-y-4 px-5 pb-4" data-teleport-setup={setup.blocked ? "blocked" : "ready"} aria-busy={setup.checking || undefined}>+ <p className="text-[13px] text-muted-foreground" data-setup-intro>+ {setup.blocked+ ? `${name} cannot be teleported yet. Here is what is missing.`+ : `Choose the ${name} profile to teleport. Everything it needs is ready.`}+ </p>+ <GroupedSection>+ <SettingRow+ data-setup-row="keyvault"+ label="Keyvault"+ help={r.keyvault_initialized ? null : "Teleport keeps what it moves in your Keyvault. Create it first."}+ value={state(r.keyvault_initialized ? "Ready" : "Not set up")}+ control={+ r.keyvault_initialized ? null : (+ <Button size="sm" variant="secondary" render={<Link to="/keyvault" onClick={() => teleport.close()} />}>+ Set up+ </Button>+ )+ }+ />+ <SettingRow+ data-setup-row="files"+ label="Full Disk Access"+ help={+ denied ? (+ <span data-setup-say="files">{r.files.say}</span>+ ) : r.profile_empty ? null : (+ `So Cua can read ${name}'s sign-ins when you approve.`+ )+ }+ value={state(denied ? "Needed" : "Allowed")}+ control={+ denied ? (+ <Button size="sm" variant="secondary" onClick={() => void teleport.openPane(FULL_DISK_ACCESS_PANE)}>+ Open Settings+ </Button>+ ) : null+ }+ />+ {denied ? (+ <SettingRow+ data-setup-row="tabs-only"+ label="Without it"+ help="Open tabs can still be teleported, signed out."+ control={+ <Button size="sm" variant="secondary" onClick={() => teleport.useTabsOnly()}>+ Send open tabs only+ </Button>+ }+ />+ ) : null}+ <SettingRow+ data-setup-row="tabs"+ label="Automation"+ help={r.tabs.state === "denied" ? <span data-setup-say="tabs">{r.tabs.say}</span> : "macOS asks the first time open tabs are read."}+ value={state(r.tabs.state === "denied" ? "Needed" : r.tabs.state === "granted" ? "Allowed" : "Asked when needed")}+ control={+ r.tabs.state === "denied" ? (+ <Button size="sm" variant="secondary" onClick={() => void teleport.openPane(AUTOMATION_PANE)}>+ Open Settings+ </Button>+ ) : null+ }+ />+ </GroupedSection>+ <Profiles readiness={r} chosen={setup.profile} onChoose={(dir) => void teleport.chooseProfile(dir)} />+ {setup.error ? (+ <p className="text-xs text-muted-foreground" data-setup-error>+ {setup.error}+ </p>+ ) : null}+ </div>+ );+}++const state = (word: string) => <span data-setup-state={word}>{word}</span>;++/** The browser profile to read: name and account, the last used one marked. */+function Profiles({ readiness: r, chosen, onChoose }: { readiness: KvReadiness; chosen: string | null; onChoose: (dir: string) => void }) {+ if (!r.profiles.length) return null;+ return (+ <GroupedSection title="Profile" data-setup-profiles footer={r.profile_empty ? <span data-setup-say="profile">{r.files.say}</span> : null}>+ <RadioGroup value={chosen ?? ""} onValueChange={(v) => onChoose(String(v))} aria-label="Profile">+ {r.profiles.map((p) => (+ <label key={p.dir} className="flex min-h-11 cursor-default items-center gap-3 px-4 py-2 text-[13px]" data-setup-profile={p.dir} data-last-used={p.last_used || undefined}>+ <Radio.Root+ value={p.dir}+ className="flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-card shadow-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/60 data-checked:border-brand data-checked:bg-brand dark:bg-input/30" // design-ok: radio control ring, not a content box+ >+ <Radio.Indicator className="size-1.5 rounded-full bg-white" />+ </Radio.Root>+ <span className="min-w-0 flex-1">+ <span className="block truncate">{p.name}</span>+ {p.account ? <span className="block truncate text-xs text-muted-foreground">{p.account}</span> : null}+ </span>+ {p.last_used ? <span className="shrink-0 text-xs text-muted-foreground">Used last</span> : null}+ </label>+ ))}+ </RadioGroup>+ </GroupedSection>+ );+}diff --git a/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx b/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsxindex 2f1f290b0d..8f0730e01c 100644--- a/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx+++ b/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx@@ -19,6 +19,7 @@ import { Segmented } from "@/components/ui/segmented";import { markExplained, needsExplainer, TeleportExplainer } from "./explainer";import { TeleportGrid } from "./grid";import { TeleportReview } from "./review";+import { TeleportSetupSheet } from "./setup-sheet";/** What each move is called (the SwiftUI app's `AppTeleportMove.label`, the core's `Move::label`). */export const MOVE_LABEL: Record<TeleportMove, string> = {@@ -53,7 +54,7 @@ export default function TeleportDialog() {<DialogPopupdata-teleportdata-step={session.state.step}- className="top-[8vh] flex h-[min(600px,84vh)] w-[min(700px,calc(100vw-2rem))] flex-col"+ className={`top-[6vh] flex w-[min(700px,calc(100vw-2rem))] flex-col ${session.setup?.open ? "h-[min(740px,88vh)]" : "h-[min(600px,84vh)]"}`}><DialogTitle className="shrink-0 px-5 pt-4 pb-3 text-[15px] font-semibold" data-teleport-title>{title(session)}@@ -68,6 +69,7 @@ export default function TeleportDialog() {}function title(s: TeleportSession): string {+ if (s.setup?.open) return `Set up ${s.setup.readiness?.app_display ?? s.state.entry?.name ?? "teleport"}`;if (s.frame.review) return s.frame.review.title;if (s.state.entry) return s.state.entry.name;return `Teleport an app to ${s.spaceName}`;@@ -106,6 +108,7 @@ function Body({ session: s, teleport, images }: { session: TeleportSession; telecase "options":return <Options state={s.state} session={s} teleport={teleport} />;case "consent":+ if (s.setup?.open || s.setup?.checking) return <TeleportSetupSheet setup={s.setup} teleport={teleport} />;return s.frame.review ? <TeleportReview review={s.frame.review} readingSites={s.readingSites} vault={s.vault} teleport={teleport} /> : null;case "running":return <Running session={s} />;@@ -234,7 +237,8 @@ function Footer({onConfirm: () => void;}) {const step = s.state.step;- const leaves = step === "consent" && !explaining ? leavesLine(s.frame.review?.leavesText ?? "") : null;+ const setup = step === "consent" && (s.setup?.open || s.setup?.checking) ? s.setup : null;+ const leaves = step === "consent" && !explaining && !setup ? leavesLine(s.frame.review?.leavesText ?? "") : null;return (<div /* design-ok: full-width dialog footer */ className="flex shrink-0 items-center gap-2 border-t bg-muted/60 px-5 py-3">{leaves ? (@@ -261,6 +265,21 @@ function Footer({Review</Button></>+ ) : setup ? (+ <>+ <Button variant="secondary" onClick={() => teleport.send({ type: "back" })}>+ Back+ </Button>+ {setup.blocked ? (+ <Button data-setup-recheck disabled={setup.checking} onClick={() => void teleport.recheckSetup()}>+ Check again+ </Button>+ ) : (+ <Button data-setup-continue disabled={setup.checking || !setup.readiness} onClick={() => void teleport.finishSetup()}>+ Continue+ </Button>+ )}+ </>) : step === "consent" ? (<><Button variant="secondary" onClick={() => (explaining ? onBack() : teleport.send({ type: "back" }))}>diff --git a/docs/content/docs/spaces/guides/teleport-an-app.mdx b/docs/content/docs/spaces/guides/teleport-an-app.mdxindex 9e8439fb92..e6f2d7b600 100644--- a/docs/content/docs/spaces/guides/teleport-an-app.mdx+++ b/docs/content/docs/spaces/guides/teleport-an-app.mdx@@ -82,6 +82,17 @@ access. See [Keyvault](/spaces/guides/keyvault).with a preview of that window; drop it on a Space to teleport the app.This needs the Accessibility permission (macOS).+When you teleport a browser's signed-in sites, a **Set up** sheet comes before+the consent screen if anything is missing or there is a choice to make. It+shows the Keyvault, Full Disk Access, Automation and the browser profile, each+with a plain word for where it stands and what to do about it. Full Disk Access+needs the macOS setting turned on for Cua (the sheet opens System Settings for+you), and then the Cua app opened again; without it you can still **send open+tabs only**. When the browser has more than one profile, the sheet lists them+with the account signed in to each and marks the one used last, and the profile+you choose is the one that is read. Nothing is read, and Touch ID is not asked,+until you continue past the sheet.+Files land in `~/Downloads/Teleported` in the Space and open in the app.@@ -275,26 +286,6 @@ starts, so after turning it on, restart the Cua daemon. Without Full DiskAccess you can still teleport open tabs only. Without a `--profile`, a pushreads the `Default` profile, so pick the one you are signed in to.-### When macOS asks for permission--Sending a browser's signed-in sites reads its files, and macOS decides whether-Cua may do that. Teleport checks first and says what is missing, in words,-before it asks for Touch ID or reads anything:--```bash test="cli-shape" id="cua-teleport-doctor"-cua teleport doctor-cua teleport doctor --app chrome --profile "Profile 1"-```--It reports whether the Keyvault is set up, whether macOS lets Cua read the-browser's files (Full Disk Access) and its open tabs (Automation), and which-browser profiles exist, with the account signed in to each and the one used-last. Cua cannot grant these for you: macOS only lets you, in System Settings,-under Privacy and Security. macOS applies Full Disk Access to a program when it-starts, so after turning it on, restart the Cua daemon. Without Full Disk-Access you can still teleport open tabs only. Without a `--profile`, a push-reads the `Default` profile, so pick the one you are signed in to.-<Callout type="warn">A teleported session is a live sign-in that anyone controlling the Space canuse. Teleport only into Spaces you own, and prefer `tabs`.diff --git a/libs/cua/crates/cua-spaces-app-core/src/keyvault/client.rs b/libs/cua/crates/cua-spaces-app-core/src/keyvault/client.rsindex f9d868d235..ddd9246543 100644--- a/libs/cua/crates/cua-spaces-app-core/src/keyvault/client.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/keyvault/client.rs@@ -27,7 +27,9 @@ use cua_keyvault::model::Grant;use serde::Serialize;use serde_json::Value;-use super::wire::{KeyvaultOverview, KvCommand, KvFavicon, KvGrant, KvInventory, KvItem};+use super::wire::{+ KeyvaultOverview, KvCommand, KvFavicon, KvGrant, KvInventory, KvItem, KvReadiness,+};/// How many audit entries the page reads.pub const AUDIT_TAIL: usize = 200;@@ -572,6 +574,27 @@ impl KeyvaultCommands {mirror(&inv)}+ /// Whether a teleport of `app` can work now: the Keyvault's state, what+ /// the OS allows the daemon to read and the profiles to choose from. The+ /// daemon reads no value and asks for no presence.+ pub async fn readiness(+ &self,+ app: &str,+ profile: Option<String>,+ ) -> Result<KvReadiness, KvFailure> {+ let status: Status = self.typed(Request::Status).await?;+ let ready: cua_keyvault::broker::Readiness = self+ .typed(Request::Readiness {+ app: app.into(),+ profile,+ })+ .await?;+ let mut out: KvReadiness = mirror(&ready)?;+ out.keyvault_initialized = status.initialized;+ out.keyvault_unlocked = status.unlocked;+ Ok(out)+ }+/// Imports a browser's saved passwords (`browser`: `chrome`), one item/// per site, `sites` empty for every saved site. The daemon asks for/// presence; the passwords stay sealed and are used only to sign in.diff --git a/libs/cua/crates/cua-spaces-app-core/src/keyvault/wire.rs b/libs/cua/crates/cua-spaces-app-core/src/keyvault/wire.rsindex 9c7a6da117..603af7a5c9 100644--- a/libs/cua/crates/cua-spaces-app-core/src/keyvault/wire.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/keyvault/wire.rs@@ -123,6 +123,68 @@ pub struct KvInventory {pub notes: Vec<String>,}+/// One thing a teleport needs from the OS, as the setup sheet shows it+/// (`cua_keyvault::broker::ReadinessCheck`).+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]+pub struct KvReadinessCheck {+ /// `granted`, `denied` or `unknown` (only known by trying).+ #[serde(default)]+ pub state: String,+ /// What it means and what to do, in plain words (empty when nothing).+ #[serde(default)]+ pub say: String,+}++/// A browser profile to choose from (`cua_keyvault::broker::BrowserProfile`).+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]+pub struct KvBrowserProfile {+ /// Directory name (`Default`, `Profile 1`).+ pub dir: String,+ /// The name the person gave it.+ pub name: String,+ /// The account signed in to it.+ #[serde(default)]+ pub account: Option<String>,+ /// The browser used it last.+ #[serde(default)]+ pub last_used: bool,+}++/// Whether a teleport of an app can work now: the Keyvault, what the OS+/// allows and the profiles to choose from. Reads no value and asks for no+/// presence (`cua_keyvault::broker::Readiness`, plus the Keyvault's state).+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]+pub struct KvReadiness {+ /// Provider id.+ pub provider_id: String,+ /// App name.+ pub app_display: String,+ /// The Keyvault exists.+ #[serde(default)]+ pub keyvault_initialized: bool,+ /// The Keyvault is unlocked.+ #[serde(default)]+ pub keyvault_unlocked: bool,+ /// The profile checked: the one asked for, else the last used.+ #[serde(default)]+ pub profile: Option<String>,+ /// The profile a teleport reads when none is named.+ #[serde(default)]+ pub default_profile: Option<String>,+ /// Every profile.+ #[serde(default)]+ pub profiles: Vec<KvBrowserProfile>,+ /// Reading the app's files (Full Disk Access).+ #[serde(default)]+ pub files: KvReadinessCheck,+ /// Reading the app's open tabs (Automation).+ #[serde(default)]+ pub tabs: KvReadinessCheck,+ /// The checked profile has no sign-in data.+ #[serde(default)]+ pub profile_empty: bool,+}+/// How a caller is signed (`cua_keyvault::caller::Signing`: tagged by/// `kind`, snake_case).#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]diff --git a/libs/cua/crates/cua-spaces-app-core/tests/wire_drift.rs b/libs/cua/crates/cua-spaces-app-core/tests/wire_drift.rsindex ce98cf594d..20905b83e2 100644--- a/libs/cua/crates/cua-spaces-app-core/tests/wire_drift.rs+++ b/libs/cua/crates/cua-spaces-app-core/tests/wire_drift.rs@@ -252,3 +252,35 @@ fn the_inventory_mirror_decodes_the_brokers() {assert_eq!(k.domains[0].unavailable_reason, "app-bound");assert!(k.domains[0].signin);}++#[test]+fn the_readiness_mirror_decodes_the_brokers() {+ use cua_keyvault::broker::{Access, BrowserProfile, Readiness, ReadinessCheck};+ let r = Readiness {+ provider_id: "chrome".into(),+ app_display: "Google Chrome".into(),+ profile: Some("Profile 1".into()),+ default_profile: Some("Default".into()),+ profiles: vec![BrowserProfile {+ dir: "Profile 1".into(),+ name: "Work".into(),+ account: Some("[email protected]".into()),+ last_used: true,+ }],+ files: ReadinessCheck {+ state: Access::Denied,+ say: "turn on Full Disk Access".into(),+ },+ tabs: ReadinessCheck {+ state: Access::Unknown,+ say: String::new(),+ },+ profile_empty: true,+ };+ let k: cua_spaces_app_core::keyvault::KvReadiness = round(&r);+ assert_eq!(k.files.state, "denied");+ assert_eq!(k.tabs.state, "unknown");+ assert_eq!(k.profiles[0].account.as_deref(), Some("[email protected]"));+ assert!(k.profiles[0].last_used && k.profile_empty);+ assert_eq!(k.default_profile.as_deref(), Some("Default"));+}diff --git a/libs/cua/crates/cua-spaces-ext/src/daemon/keyvault.rs b/libs/cua/crates/cua-spaces-ext/src/daemon/keyvault.rsindex 2fb00e6e23..182d68da2f 100644--- a/libs/cua/crates/cua-spaces-ext/src/daemon/keyvault.rs+++ b/libs/cua/crates/cua-spaces-ext/src/daemon/keyvault.rs@@ -49,7 +49,13 @@ const B64: base64::engine::general_purpose::GeneralPurpose =base64::engine::general_purpose::STANDARD;fn backend_err(context: &str, e: impl std::fmt::Display) -> KvError {- KvError::Backend(format!("{context}: {e}"))+ let m = e.to_string();+ // A macOS privacy refusal is said in plain words (what to turn on), not+ // as "export session: Operation not permitted (os error 1)".+ if let Some(say) = cua_teleport::privacy::plain_words(&m) {+ return KvError::Backend(say);+ }+ KvError::Backend(format!("{context}: {m}"))}fn scope_str(scope: TransferScope) -> &'static str {diff --git a/libs/cua/crates/cua-spaces-ext/src/teleport.rs b/libs/cua/crates/cua-spaces-ext/src/teleport.rsindex cf2b2f9eeb..ede8e1c9a2 100644--- a/libs/cua/crates/cua-spaces-ext/src/teleport.rs+++ b/libs/cua/crates/cua-spaces-ext/src/teleport.rs@@ -575,6 +575,8 @@ pub struct TeleportSelection {/// The sites whose saved passwords to send (the review's own choice of/// passwords); `None`: those of `cookie_domains`.pub password_domains: Option<Vec<String>>,+ /// The browser profile to read (`Profile 1`); `None` reads `Default`.+ pub profile: Option<String>,}/// Session teleport on a [`Space`]: what it can import, and the export and@@ -744,7 +746,7 @@ impl SpaceTeleport for Space {let spec = cua_keyvault::broker::ImportSpec {app: approval.app.clone(),- profile: None,+ profile: selection.profile.clone(),sites: vec![],whole_app: true,cookies: cua_keyvault::broker::CookieFilter::default(),diff --git a/libs/cua/crates/cua-spaces-ext/src/teleport_app.rs b/libs/cua/crates/cua-spaces-ext/src/teleport_app.rsindex 000cfd060d..bbe69db4c0 100644--- a/libs/cua/crates/cua-spaces-ext/src/teleport_app.rs+++ b/libs/cua/crates/cua-spaces-ext/src/teleport_app.rs@@ -329,6 +329,7 @@ impl SpaceAppTeleport for Space {from_vault: plan.from_vault.clone(),include_passwords: plan.include_passwords,password_domains: plan.password_domains.clone(),+ profile: plan.profile.clone(),};let app = plan.app.name.clone();let receipt = selfdiff --git a/libs/cua/crates/cua-spaces-ext/tests/keyvault_items.rs b/libs/cua/crates/cua-spaces-ext/tests/keyvault_items.rsindex adbaf5d81f..b72ea767f8 100644--- a/libs/cua/crates/cua-spaces-ext/tests/keyvault_items.rs+++ b/libs/cua/crates/cua-spaces-ext/tests/keyvault_items.rs@@ -514,3 +514,81 @@ fn readiness_lists_profiles_and_checks_the_chosen_one_without_reading_values() {assert_eq!(r.files.state, Access::Granted);assert!(r.profiles.is_empty());}++/// A refused read reaches the person as the plain sentence, not as+/// "export session: ... Operation not permitted (os error 1)".+#[test]+fn a_privacy_refusal_in_a_capture_is_said_in_plain_words() {+ struct Refusing(Arc<dyn HostEffects>);+ impl ExportProvider for Refusing {+ fn id(&self) -> &str {+ "chrome"+ }+ fn display_name(&self) -> &str {+ "Google Chrome"+ }+ fn host(&self) -> &dyn HostEffects {+ self.0.as_ref()+ }+ fn platform_supported(&self, _: Platform) -> bool {+ true+ }+ fn matches(&self, app: &AppRef) -> bool {+ app.app_id == "chrome"+ }+ fn app_ids(&self) -> &[&str] {+ &["chrome"]+ }+ fn manifest(+ &self,+ _: &AppRef,+ _: Option<&WindowRef>,+ scope: TransferScope,+ ) -> cua_teleport::Result<TransferManifest> {+ Ok(TransferManifest {+ provider_id: "chrome".into(),+ app_display_name: "Google Chrome".into(),+ scope,+ items: vec![ManifestItem {+ label: "Cookies".into(),+ rel_path: "Default/Cookies".into(),+ est_bytes: 1,+ count: None,+ count_noun: None,+ sensitive: false,+ default_checked: true,+ }],+ total_est_bytes: 1,+ notes: vec![],+ })+ }+ fn capture_selected(+ &self,+ _: &AppRef,+ _: TransferScope,+ _: Option<&HashSet<String>>,+ _: &mut dyn Write,+ ) -> cua_teleport::Result<()> {+ Err(cua_teleport::TeleportError::Provider(+ "copying Cookies failed: Operation not permitted (os error 1)".into(),+ ))+ }+ }+ let reg = tempfile::tempdir().unwrap();+ let spaces = Spaces::builder()+ .home(reg.path())+ .operator_display(Arc::new(cua_spaces::operator::NoDisplay))+ .build();+ let mut registry = ExportRegistry::new();+ registry.register(Box::new(Refusing(Arc::new(FakeHost::new()))));+ let b = DaemonBackend::new(spaces, Arc::new(AppSessions::from_registry(registry)));+ let err = b+ .capture(&spec(&["Default/Cookies"]))+ .unwrap_err()+ .to_string();+ assert!(err.contains("Full Disk Access"), "{err}");+ assert!(+ !err.contains("os error") && !err.contains("export session"),+ "{err}"+ );+}diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core.rsindex f44d1e1a33..a684c62678 100644--- a/libs/cua/crates/cua-spaces-ffi/src/app_core.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core.rs@@ -1963,6 +1963,15 @@ impl KeyvaultClient {cua_sdk::support::run(async move { inner.inventory(&app, profile).await.map_err(kv_error) }).await}++ /// Whether a teleport of `app` can work now: the Keyvault's state, what+ /// macOS lets the daemon read, and the profiles. Reads no value and asks+ /// for no presence.+ pub async fn readiness(&self, app: String, profile: Option<String>) -> Result<KvReadiness> {+ let inner = self.inner.clone();+ cua_sdk::support::run(async move { inner.readiness(&app, profile).await.map_err(kv_error) })+ .await+ }}// ---- Onboarding and settings ---------------------------------------------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 214bb3260f..8535a42730 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@@ -4351,6 +4351,59 @@ pub struct KvInventory {pub notes: Vec<String>,}+/// One thing a teleport needs from the OS, as the setup sheet shows it+/// (`cua_keyvault::broker::ReadinessCheck`).+pub type KvReadinessCheck = core::keyvault::wire::KvReadinessCheck;+#[uniffi::remote(Record)]+pub struct KvReadinessCheck {+ /// `granted`, `denied` or `unknown` (only known by trying).+ pub state: String,+ /// What it means and what to do, in plain words (empty when nothing).+ pub say: String,+}++/// A browser profile to choose from (`cua_keyvault::broker::BrowserProfile`).+pub type KvBrowserProfile = core::keyvault::wire::KvBrowserProfile;+#[uniffi::remote(Record)]+pub struct KvBrowserProfile {+ /// Directory name (`Default`, `Profile 1`).+ pub dir: String,+ /// The name the person gave it.+ pub name: String,+ /// The account signed in to it.+ pub account: Option<String>,+ /// The browser used it last.+ pub last_used: bool,+}++/// Whether a teleport of an app can work now: the Keyvault, what the OS+/// allows and the profiles to choose from. Reads no value and asks for no+/// presence (`cua_keyvault::broker::Readiness`, plus the Keyvault's state).+pub type KvReadiness = core::keyvault::wire::KvReadiness;+#[uniffi::remote(Record)]+pub struct KvReadiness {+ /// Provider id.+ pub provider_id: String,+ /// App name.+ pub app_display: String,+ /// The Keyvault exists.+ pub keyvault_initialized: bool,+ /// The Keyvault is unlocked.+ pub keyvault_unlocked: bool,+ /// The profile checked: the one asked for, else the last used.+ pub profile: Option<String>,+ /// The profile a teleport reads when none is named.+ pub default_profile: Option<String>,+ /// Every profile.+ pub profiles: Vec<KvBrowserProfile>,+ /// Reading the app's files (Full Disk Access).+ pub files: KvReadinessCheck,+ /// Reading the app's open tabs (Automation).+ pub tabs: KvReadinessCheck,+ /// The checked profile has no sign-in data.+ pub profile_empty: bool,+}+/// How a caller is signed (`cua_keyvault::caller::Signing`: tagged by/// `kind`, snake_case).pub type KvSigning = core::keyvault::wire::KvSigning;diff --git a/libs/cua/crates/cua-spaces-ffi/src/teleport_app.rs b/libs/cua/crates/cua-spaces-ffi/src/teleport_app.rsindex 97ac83ac06..ded8d8e3b2 100644--- a/libs/cua/crates/cua-spaces-ffi/src/teleport_app.rs+++ b/libs/cua/crates/cua-spaces-ffi/src/teleport_app.rs@@ -647,6 +647,9 @@ mod space_side {/// choice; `None`: those of `cookie_domains`).#[uniffi(default = None)]pub password_domains: Option<Vec<String>>,+ /// The browser profile to read (`Profile 1`); `None`: `Default`.+ #[uniffi(default = None)]+ pub profile: Option<String>,}/// One progress event of [`Teleport::run`].@@ -878,6 +881,7 @@ mod space_side {from_vault: consent.from_vault.clone(),include_passwords: consent.include_passwords,password_domains: consent.password_domains.clone(),+ profile: consent.profile.clone(),}).map_err(crate::teleport_app::ux_err)?;let sessions = sessions(self);diff --git a/libs/cua/crates/cua-teleport/src/ux/plan.rs b/libs/cua/crates/cua-teleport/src/ux/plan.rsindex 2ace70dd60..1d10de50d1 100644--- a/libs/cua/crates/cua-teleport/src/ux/plan.rs+++ b/libs/cua/crates/cua-teleport/src/ux/plan.rs@@ -299,6 +299,9 @@ pub struct TeleportPlan {/// ([`Consent::password_domains`]); `None`: those of `cookie_domains`.#[serde(default, skip_serializing_if = "Option::is_none")]pub password_domains: Option<Vec<String>>,+ /// The browser profile to read ([`Consent::profile`]); `None`: `Default`.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub profile: Option<String>,}fn is_false(b: &bool) -> bool {@@ -350,6 +353,10 @@ pub struct Consent {/// those of `cookie_domains` (every site when that is `None` too).#[serde(default)]pub password_domains: Option<Vec<String>>,+ /// The browser profile to read (`Profile 1`), as chosen in the setup+ /// sheet's picker. `None` reads `Default`.+ #[serde(default)]+ pub profile: Option<String>,}/// A plan the user approved. Only [`TeleportPlan::approve`] makes one.@@ -431,6 +438,11 @@ impl TeleportPlan {.password_domains.clone().filter(|_| consent.include_passwords);+ self.profile = consent+ .profile+ .clone()+ .map(|p| p.trim().to_string())+ .filter(|p| !p.is_empty());self.save_to_keyvault = self.sensitive && consent.save_to_keyvault;Ok(ApprovedPlan(self))}@@ -684,6 +696,7 @@ pub fn build(from_vault: None,include_passwords: false,password_domains: None,+ profile: None,})}@@ -1195,6 +1208,26 @@ mod tests {"a chosen domain keeps the store");}+ // The chosen browser profile rides along, trimmed; blank or absent is+ // `Default` (None), never invented.+ let named = p+ .clone()+ .approve(Consent {+ profile: Some(" Profile 1 ".into()),+ ..ok.clone()+ })+ .unwrap();+ assert_eq!(named.plan().profile.as_deref(), Some("Profile 1"));+ for blank in [None, Some(" ".to_string())] {+ let a = p+ .clone()+ .approve(Consent {+ profile: blank,+ ..ok.clone()+ })+ .unwrap();+ assert_eq!(a.plan().profile, None);+ }// The vault source is carried, never invented.let v = p.clone()diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.pyindex cfa4bce942..6dc14991d5 100644--- a/libs/cua/scripts/generate-app-core-ffi.py+++ b/libs/cua/scripts/generate-app-core-ffi.py@@ -37,7 +37,7 @@ TYPES = [("teleport/review.rs", "teleport::review", ["SendSource", "RememberedChoice", "ReviewDomain", "ReviewToggle", "VaultPassword", "ReviewPassword", "VaultSource", "ReviewChoice"]),("teleport/flow.rs", "teleport::flow", ["Capability", "Move", "SensitiveGroup", "SensitiveOption", "CatalogEntry", "ConsentKind", "ConsentItem", "PlanStepView", "Plan", "RunPhase", "RunEvent", "RunReport", "Consent", "InstallCuaPrompt", "Step", "PickerState", "PickerEvent", "EntrySection", "ReviewView"]),("wizard.rs", "wizard", ["LocalEngine", "ExternalImage", "ExternalRuntimeInfo", "ImageTier", "ImageDistro", "PlatformSize", "ImageSizes", "SandboxImage", "ImageGroup", "KindOption", "StorageVolume", "LocalStorage", "CloudOffer", "ConnectedCloud", "HostLimit", "HostLoad", "SpaceHost", "RuntimeSwitch", "PlacementOption", "GpuChoice", "WizardEnv", "WizardMode", "AddressForm", "ResourceField", "ResourceEdit", "WizardState", "WizardAction", "StepState", "StepView", "Tile", "MenuOption", "CreatePlan", "CreateSpaceArgs", "AddressView", "AddressSubmit", "ImageSuggestion", "SuggestionGroup", "ImageFieldView", "WizardField", "WizardLabels", "WizardFact", "GpuRow", "ResourceEditView", "WizardView"]),- ("keyvault/wire.rs", "keyvault::wire", ["KvItemPolicy", "KvItem", "KvFavicon", "KvDomainCount", "KvInventory", "KvSigning", "KvCaller", "KvSelector", "KvAccessRequest", "KvPending", "KvGrant", "KvRuleCaller", "KvRule", "KvDelivery", "KvAuditEntry", "KvStatus", "KvVerification", "KeyvaultOverview", "KvCommand"]),+ ("keyvault/wire.rs", "keyvault::wire", ["KvItemPolicy", "KvItem", "KvFavicon", "KvDomainCount", "KvInventory", "KvReadinessCheck", "KvBrowserProfile", "KvReadiness", "KvSigning", "KvCaller", "KvSelector", "KvAccessRequest", "KvPending", "KvGrant", "KvRuleCaller", "KvRule", "KvDelivery", "KvAuditEntry", "KvStatus", "KvVerification", "KeyvaultOverview", "KvCommand"]),("keyvault/view.rs", "keyvault::view", ["Tone", "SigningBadge", "Tri", "DecisionTone", "Decision", "PendingRow", "AccessKind", "AccessRow", "KvLabels", "KeyvaultPage"]),("keyvault/vault.rs", "keyvault::vault", ["KvKind", "KvLock", "VaultState", "VaultAction", "VaultRow", "VaultSite", "VaultFiles", "VaultApp", "VaultSelection", "VaultView", "UnlockPrompt", "KvDeleteConfirm", "KvVaultSource"]),("keyvault/browse.rs", "keyvault::browse", ["KvCategory", "CategoryRow", "AppRow", "KvSidebar", "KvSelection", "RecentRow", "KvListView"]),diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swiftindex 85872473a2..b2b00ad48a 100644--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift@@ -1111,6 +1111,13 @@ public protocol KeyvaultClientProtocol: AnyObject, Sendable {*/func overview() async -> KeyvaultOverview+ /**+ * Whether a teleport of `app` can work now: the Keyvault's state, what+ * macOS lets the daemon read, and the profiles. Reads no value and asks+ * for no presence.+ */+ func readiness(app: String, profile: String?) async throws -> KvReadiness+/*** Creates the vault with a passphrase (and a recovery key, returned* once). The passphrase goes only to the broker over the verified@@ -1298,6 +1305,28 @@ open func overview()async -> KeyvaultOverview {)}+ /**+ * Whether a teleport of `app` can work now: the Keyvault's state, what+ * macOS lets the daemon read, and the profiles. Reads no value and asks+ * for no presence.+ */+open func readiness(app: String, profile: String?)async throws -> KvReadiness {+ return+ try await uniffiRustCallAsync(+ rustFutureFunc: {+ uniffi_cua_spaces_ffi_fn_method_keyvaultclient_readiness(+ self.uniffiCloneHandle(),+ FfiConverterString.lower(app),FfiConverterOptionString.lower(profile)+ )+ },+ pollFunc: ffi_cua_spaces_ffi_rust_future_poll_rust_buffer,+ completeFunc: ffi_cua_spaces_ffi_rust_future_complete_rust_buffer,+ freeFunc: ffi_cua_spaces_ffi_rust_future_free_rust_buffer,+ liftFunc: FfiConverterTypeKvReadiness_lift,+ errorHandler: FfiConverterTypeCuaError_lift+ )+}+/*** Creates the vault with a passphrase (and a recovery key, returned* once). The passphrase goes only to the broker over the verified@@ -46945,6 +46974,92 @@ public func FfiConverterTypeKvAuditEntry_lower(_ value: KvAuditEntry) -> RustBuf}+public struct KvBrowserProfile: Equatable, Hashable {+ /**+ * Directory name (`Default`, `Profile 1`).+ */+ public var dir: String+ /**+ * The name the person gave it.+ */+ public var name: String+ /**+ * The account signed in to it.+ */+ public var account: String?+ /**+ * The browser used it last.+ */+ public var lastUsed: Bool++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * Directory name (`Default`, `Profile 1`).+ */dir: String,+ /**+ * The name the person gave it.+ */name: String,+ /**+ * The account signed in to it.+ */account: String?,+ /**+ * The browser used it last.+ */lastUsed: Bool) {+ self.dir = dir+ self.name = name+ self.account = account+ self.lastUsed = lastUsed+ }+++++}++#if compiler(>=6)+extension KvBrowserProfile: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeKvBrowserProfile: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> KvBrowserProfile {+ return+ try KvBrowserProfile(+ dir: FfiConverterString.read(from: &buf),+ name: FfiConverterString.read(from: &buf),+ account: FfiConverterOptionString.read(from: &buf),+ lastUsed: FfiConverterBool.read(from: &buf)+ )+ }++ public static func write(_ value: KvBrowserProfile, into buf: inout [UInt8]) {+ FfiConverterString.write(value.dir, into: &buf)+ FfiConverterString.write(value.name, into: &buf)+ FfiConverterOptionString.write(value.account, into: &buf)+ FfiConverterBool.write(value.lastUsed, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeKvBrowserProfile_lift(_ buf: RustBuffer) throws -> KvBrowserProfile {+ return try FfiConverterTypeKvBrowserProfile.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeKvBrowserProfile_lower(_ value: KvBrowserProfile) -> RustBuffer {+ return FfiConverterTypeKvBrowserProfile.lower(value)+}++public struct KvCaller: Equatable, Hashable {/*** Pid.@@ -49137,6 +49252,218 @@ public func FfiConverterTypeKvPendingRow_lower(_ value: KvPendingRow) -> RustBuf}+public struct KvReadiness: Equatable, Hashable {+ /**+ * Provider id.+ */+ public var providerId: String+ /**+ * App name.+ */+ public var appDisplay: String+ /**+ * The Keyvault exists.+ */+ public var keyvaultInitialized: Bool+ /**+ * The Keyvault is unlocked.+ */+ public var keyvaultUnlocked: Bool+ /**+ * The profile checked: the one asked for, else the last used.+ */+ public var profile: String?+ /**+ * The profile a teleport reads when none is named.+ */+ public var defaultProfile: String?+ /**+ * Every profile.+ */+ public var profiles: [KvBrowserProfile]+ /**+ * Reading the app's files (Full Disk Access).+ */+ public var files: KvReadinessCheck+ /**+ * Reading the app's open tabs (Automation).+ */+ public var tabs: KvReadinessCheck+ /**+ * The checked profile has no sign-in data.+ */+ public var profileEmpty: Bool++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * Provider id.+ */providerId: String,+ /**+ * App name.+ */appDisplay: String,+ /**+ * The Keyvault exists.+ */keyvaultInitialized: Bool,+ /**+ * The Keyvault is unlocked.+ */keyvaultUnlocked: Bool,+ /**+ * The profile checked: the one asked for, else the last used.+ */profile: String?,+ /**+ * The profile a teleport reads when none is named.+ */defaultProfile: String?,+ /**+ * Every profile.+ */profiles: [KvBrowserProfile],+ /**+ * Reading the app's files (Full Disk Access).+ */files: KvReadinessCheck,+ /**+ * Reading the app's open tabs (Automation).+ */tabs: KvReadinessCheck,+ /**+ * The checked profile has no sign-in data.+ */profileEmpty: Bool) {+ self.providerId = providerId+ self.appDisplay = appDisplay+ self.keyvaultInitialized = keyvaultInitialized+ self.keyvaultUnlocked = keyvaultUnlocked+ self.profile = profile+ self.defaultProfile = defaultProfile+ self.profiles = profiles+ self.files = files+ self.tabs = tabs+ self.profileEmpty = profileEmpty+ }+++++}++#if compiler(>=6)+extension KvReadiness: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeKvReadiness: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> KvReadiness {+ return+ try KvReadiness(+ providerId: FfiConverterString.read(from: &buf),+ appDisplay: FfiConverterString.read(from: &buf),+ keyvaultInitialized: FfiConverterBool.read(from: &buf),+ keyvaultUnlocked: FfiConverterBool.read(from: &buf),+ profile: FfiConverterOptionString.read(from: &buf),+ defaultProfile: FfiConverterOptionString.read(from: &buf),+ profiles: FfiConverterSequenceTypeKvBrowserProfile.read(from: &buf),+ files: FfiConverterTypeKvReadinessCheck.read(from: &buf),+ tabs: FfiConverterTypeKvReadinessCheck.read(from: &buf),+ profileEmpty: FfiConverterBool.read(from: &buf)+ )+ }++ public static func write(_ value: KvReadiness, into buf: inout [UInt8]) {+ FfiConverterString.write(value.providerId, into: &buf)+ FfiConverterString.write(value.appDisplay, into: &buf)+ FfiConverterBool.write(value.keyvaultInitialized, into: &buf)+ FfiConverterBool.write(value.keyvaultUnlocked, into: &buf)+ FfiConverterOptionString.write(value.profile, into: &buf)+ FfiConverterOptionString.write(value.defaultProfile, into: &buf)+ FfiConverterSequenceTypeKvBrowserProfile.write(value.profiles, into: &buf)+ FfiConverterTypeKvReadinessCheck.write(value.files, into: &buf)+ FfiConverterTypeKvReadinessCheck.write(value.tabs, into: &buf)+ FfiConverterBool.write(value.profileEmpty, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeKvReadiness_lift(_ buf: RustBuffer) throws -> KvReadiness {+ return try FfiConverterTypeKvReadiness.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeKvReadiness_lower(_ value: KvReadiness) -> RustBuffer {+ return FfiConverterTypeKvReadiness.lower(value)+}+++public struct KvReadinessCheck: Equatable, Hashable {+ /**+ * `granted`, `denied` or `unknown` (only known by trying).+ */+ public var state: String+ /**+ * What it means and what to do, in plain words (empty when nothing).+ */+ public var say: String++ // Default memberwise initializers are never public by default, so we+ // declare one manually.+ public init(+ /**+ * `granted`, `denied` or `unknown` (only known by trying).+ */state: String,+ /**+ * What it means and what to do, in plain words (empty when nothing).+ */say: String) {+ self.state = state+ self.say = say+ }+++++}++#if compiler(>=6)+extension KvReadinessCheck: Sendable {}+#endif++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public struct FfiConverterTypeKvReadinessCheck: FfiConverterRustBuffer {+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> KvReadinessCheck {+ return+ try KvReadinessCheck(+ state: FfiConverterString.read(from: &buf),+ say: FfiConverterString.read(from: &buf)+ )+ }++ public static func write(_ value: KvReadinessCheck, into buf: inout [UInt8]) {+ FfiConverterString.write(value.state, into: &buf)+ FfiConverterString.write(value.say, into: &buf)+ }+}+++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeKvReadinessCheck_lift(_ buf: RustBuffer) throws -> KvReadinessCheck {+ return try FfiConverterTypeKvReadinessCheck.lift(buf)+}++#if swift(>=5.8)+@_documentation(visibility: private)+#endif+public func FfiConverterTypeKvReadinessCheck_lower(_ value: KvReadinessCheck) -> RustBuffer {+ return FfiConverterTypeKvReadinessCheck.lower(value)+}++public struct KvRecentRow: Equatable, Hashable {/*** The decision.@@ -51645,6 +51972,10 @@ public struct TeleportConsent: Equatable, Hashable {* choice; `None`: those of `cookie_domains`).*/public var passwordDomains: [String]?+ /**+ * The browser profile to read (`Profile 1`); `None`: `Default`.+ */+ public var profile: String?// Default memberwise initializers are never public by default, so we// declare one manually.@@ -51679,7 +52010,10 @@ public struct TeleportConsent: Equatable, Hashable {/*** The sites whose saved passwords to send (the review's own* choice; `None`: those of `cookie_domains`).- */passwordDomains: [String]? = nil) {+ */passwordDomains: [String]? = nil,+ /**+ * The browser profile to read (`Profile 1`); `None`: `Default`.+ */profile: String? = nil) {self.approved = approvedself.acknowledgeSensitive = acknowledgeSensitiveself.saveToKeyvault = saveToKeyvault@@ -51689,6 +52023,7 @@ public struct TeleportConsent: Equatable, Hashable {self.fromVault = fromVaultself.includePasswords = includePasswordsself.passwordDomains = passwordDomains+ self.profile = profile}@@ -51715,7 +52050,8 @@ public struct FfiConverterTypeTeleportConsent: FfiConverterRustBuffer {exclude: FfiConverterSequenceString.read(from: &buf),fromVault: FfiConverterOptionSequenceString.read(from: &buf),includePasswords: FfiConverterBool.read(from: &buf),- passwordDomains: FfiConverterOptionSequenceString.read(from: &buf)+ passwordDomains: FfiConverterOptionSequenceString.read(from: &buf),+ profile: FfiConverterOptionString.read(from: &buf))}@@ -51729,6 +52065,7 @@ public struct FfiConverterTypeTeleportConsent: FfiConverterRustBuffer {FfiConverterOptionSequenceString.write(value.fromVault, into: &buf)FfiConverterBool.write(value.includePasswords, into: &buf)FfiConverterOptionSequenceString.write(value.passwordDomains, into: &buf)+ FfiConverterOptionString.write(value.profile, into: &buf)}}@@ -77087,6 +77424,31 @@ fileprivate struct FfiConverterSequenceTypeKvAuditEntry: FfiConverterRustBuffer}}+#if swift(>=5.8)+@_documentation(visibility: private)+#endif+fileprivate struct FfiConverterSequenceTypeKvBrowserProfile: FfiConverterRustBuffer {+ typealias SwiftType = [KvBrowserProfile]++ public static func write(_ value: [KvBrowserProfile], into buf: inout [UInt8]) {+ let len = Int32(value.count)+ writeInt(&buf, len)+ for item in value {+ FfiConverterTypeKvBrowserProfile.write(item, into: &buf)+ }+ }++ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [KvBrowserProfile] {+ let len: Int32 = try readInt(&buf)+ var seq = [KvBrowserProfile]()+ seq.reserveCapacity(Int(len))+ for _ in 0 ..< len {+ seq.append(try FfiConverterTypeKvBrowserProfile.read(from: &buf))+ }+ return seq+ }+}+#if swift(>=5.8)@_documentation(visibility: private)#endif@@ -82842,6 +83204,9 @@ private let initializationResult: InitializationResult = {if (uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_overview() != 65171) {return InitializationResult.apiChecksumMismatch}+ if (uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_readiness() != 1765) {+ return InitializationResult.apiChecksumMismatch+ }if (uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_setup_with_passphrase() != 6939) {return InitializationResult.apiChecksumMismatch}diff --git a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.hindex e23d69ee30..14fbb53f07 100644--- a/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h+++ b/libs/spaces-app-swift/Sources/cua_spaces_ffiFFI/include/cua_spaces_ffiFFI.h@@ -404,6 +404,11 @@ uint64_t uniffi_cua_spaces_ffi_fn_method_keyvaultclient_lock(uint64_t ptruint64_t uniffi_cua_spaces_ffi_fn_method_keyvaultclient_overview(uint64_t ptr);#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_METHOD_KEYVAULTCLIENT_READINESS+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_METHOD_KEYVAULTCLIENT_READINESS+uint64_t uniffi_cua_spaces_ffi_fn_method_keyvaultclient_readiness(uint64_t ptr, RustBuffer app, RustBuffer profile+);+#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_METHOD_KEYVAULTCLIENT_SETUP_WITH_PASSPHRASE#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_FN_METHOD_KEYVAULTCLIENT_SETUP_WITH_PASSPHRASEuint64_t uniffi_cua_spaces_ffi_fn_method_keyvaultclient_setup_with_passphrase(uint64_t ptr, RustBuffer passphrase@@ -4753,6 +4758,12 @@ uint16_t uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_lock(void#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_METHOD_KEYVAULTCLIENT_OVERVIEWuint16_t uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_overview(void+);+#endif+#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_METHOD_KEYVAULTCLIENT_READINESS+#define UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_METHOD_KEYVAULTCLIENT_READINESS+uint16_t uniffi_cua_spaces_ffi_checksum_method_keyvaultclient_readiness(void+);#endif#ifndef UNIFFI_FFIDEF_UNIFFI_CUA_SPACES_FFI_CHECKSUM_METHOD_KEYVAULTCLIENT_SETUP_WITH_PASSPHRASE