Skip to content

armgit / cua

Public Imported from GitHub
0

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

feat(spaces): core returns message codes for teleport opt-ins (CUA-1928) (#5599)

Francesco Bonacci12720d6ab44e
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.ts
index 3b134d8641..c2e4803da5 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
@@ -25929,6 +25929,55 @@ const FfiConverterTypeAppModeChoice = (() => {
return new FFIConverter();
})();
+export type AppMsg = {
+ /**
+ * The catalog key, `<area>.<screen_or_component>.<element>`.
+ */
+ code: string,
+ /**
+ * Values for the text's variables.
+ */
+ vars: Map<string, string>
+}
+
+/**
+ * Generated factory for {@link AppMsg} record objects.
+ */
+export const AppMsg = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<AppMsg, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<AppMsg>,
+ });
+})();
+
+const FfiConverterTypeAppMsg = (() => {
+ type TypeName = AppMsg;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ code: FfiConverterString.read(from),
+ vars: FfiConverterMapStringString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.code, into);
+ FfiConverterMapStringString.write(value.vars, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.code) +
+ FfiConverterMapStringString.allocationSize(value.vars);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type AppNewSpaceOn = {
/**
* The button's label.
@@ -34090,11 +34139,11 @@ export type AppSensitiveOption = {
/**
* Label.
*/
- label: string,
+ label: AppMsg,
/**
* The line under the label.
*/
- detail: string,
+ detail: AppMsg,
/**
* Checked.
*/
@@ -34123,21 +34172,21 @@ const FfiConverterTypeAppSensitiveOption = (() => {
read(from: RustBuffer): TypeName {
return {
group: FfiConverterTypeAppSensitiveGroup.read(from),
- label: FfiConverterString.read(from),
- detail: FfiConverterString.read(from),
+ label: FfiConverterTypeAppMsg.read(from),
+ detail: FfiConverterTypeAppMsg.read(from),
checked: FfiConverterBool.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterTypeAppSensitiveGroup.write(value.group, into);
- FfiConverterString.write(value.label, into);
- FfiConverterString.write(value.detail, into);
+ FfiConverterTypeAppMsg.write(value.label, into);
+ FfiConverterTypeAppMsg.write(value.detail, into);
FfiConverterBool.write(value.checked, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeAppSensitiveGroup.allocationSize(value.group) +
- FfiConverterString.allocationSize(value.label) +
- FfiConverterString.allocationSize(value.detail) +
+ FfiConverterTypeAppMsg.allocationSize(value.label) +
+ FfiConverterTypeAppMsg.allocationSize(value.detail) +
FfiConverterBool.allocationSize(value.checked);
}
@@ -63533,6 +63582,7 @@ export default Object.freeze({
FfiConverterTypeAppMenuPreview,
FfiConverterTypeAppMenuPreviewRow,
FfiConverterTypeAppModeChoice,
+ FfiConverterTypeAppMsg,
FfiConverterTypeAppNewSpaceOn,
FfiConverterTypeAppNotchAccess,
FfiConverterTypeAppNotchActivity,
diff --git a/apps/cua-spaces-macos/Package.swift b/apps/cua-spaces-macos/Package.swift
index 97ebe20c32..371ce5bc0f 100644
--- a/apps/cua-spaces-macos/Package.swift
+++ b/apps/cua-spaces-macos/Package.swift
@@ -25,6 +25,7 @@ import PackageDescription
// (XcodeGen) on a macOS runner with Xcode.
let package = Package(
name: "CuaSpacesMac",
+ defaultLocalization: "en",
platforms: [.macOS(.v26)],
products: [
.executable(name: "CuaSpacesMac", targets: ["CuaSpacesMac"]),
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
index ea0ed550fd..2850537a84 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/TeleportModel.swift
@@ -498,9 +498,9 @@ extension AppTeleportMove {
public var label: String {
switch self {
- case .appOnly: return "Just the app"
- case .appWithFiles: return "The app with files or folders"
- case .appWithState: return "The app with its signed-in state"
+ case .appOnly: return CoreMessages.text(code: "teleport.move.app_only")
+ case .appWithFiles: return CoreMessages.text(code: "teleport.move.app_with_files")
+ case .appWithState: return CoreMessages.text(code: "teleport.move.app_with_state")
}
}
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstrings b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstrings
new file mode 100644
index 0000000000..2fbb929cef
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Resources/Localizable.xcstrings
@@ -0,0 +1,105 @@
+{
+ "sourceLanguage": "en",
+ "strings": {
+ "teleport.move.app_only": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Just the app"
+ }
+ }
+ }
+ },
+ "teleport.move.app_with_files": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "The app with files or folders"
+ }
+ }
+ }
+ },
+ "teleport.move.app_with_state": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "The app with its signed-in state"
+ }
+ }
+ }
+ },
+ "teleport.sensitive.sign_ins.label": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Keep me signed in"
+ }
+ }
+ }
+ },
+ "teleport.sensitive.sign_ins.detail": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sends the session cookies."
+ }
+ }
+ }
+ },
+ "teleport.sensitive.passwords.label": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Saved passwords"
+ }
+ }
+ }
+ },
+ "teleport.sensitive.passwords.detail": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sends the passwords saved in the app."
+ }
+ }
+ }
+ },
+ "teleport.sensitive.history.label": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Browsing history"
+ }
+ }
+ }
+ },
+ "teleport.sensitive.history.detail": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sends the history of pages visited, and the bookmarks where the browser keeps them together."
+ }
+ }
+ }
+ }
+ },
+ "version": "1.0"
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CoreMessages.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CoreMessages.swift
new file mode 100644
index 0000000000..0b1b7423be
--- /dev/null
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/CoreMessages.swift
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import CuaSpacesFFI
+import Foundation
+
+/// The app core's messages (`AppMsg`: a stable code plus variables, never
+/// English) as text. The code is the key in `Localizable.xcstrings`, the same
+/// key the web UI's `en` namespaces use; `{name}` in the text takes the
+/// variable `name`. A code with no entry shows as the code.
+public enum CoreMessages {
+ public static func text(_ message: AppMsg) -> String {
+ text(code: message.code, vars: message.vars)
+ }
+
+ public static func text(code: String, vars: [String: String] = [:]) -> String {
+ let bundle = ModuleResources.bundle ?? .main
+ var out = bundle.localizedString(forKey: code, value: code, table: nil)
+ for (name, value) in vars { out = out.replacingOccurrences(of: "{\(name)}", with: value) }
+ return out
+ }
+}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportPickerSheet.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportPickerSheet.swift
index e8e8c4e32a..6b0a388a90 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportPickerSheet.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportPickerSheet.swift
@@ -82,11 +82,11 @@ struct TeleportPickerSheet: View {
// The core's opt-ins, each unchecked until chosen: "Keep me
// signed in" (the session cookies), "Saved passwords",
// "Browsing history".
- ForEach(appPickerSensitiveOptions(state: s), id: \.label) { option in
+ ForEach(appPickerSensitiveOptions(state: s), id: \.group) { option in
Toggle(isOn: Binding(get: { option.checked },
set: { teleport.send(.sensitive(group: option.group, value: $0)) })) {
- Text(option.label)
- Text(option.detail)
+ Text(CoreMessages.text(option.label))
+ Text(CoreMessages.text(option.detail))
}
.toggleStyle(.checkbox)
}
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
index aeeb697b22..aae946a42f 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
@@ -501,7 +501,7 @@ struct ParityTests {
"error": opt(s.error),
"report": opt(s.report?.appId),
"sensitive": appPickerSensitiveOptions(state: s).map {
- "\(word($0.group)):\($0.label):\($0.detail):\($0.checked ? "on" : "off")"
+ "\(word($0.group)):\($0.label.code):\($0.detail.code):\($0.checked ? "on" : "off")"
},
"planSensitive": appPickerPlanSensitive(state: s).map(word),
]
diff --git a/apps/cua-spaces-web/e2e/teleport.ts b/apps/cua-spaces-web/e2e/teleport.ts
index 616a3d4418..a7dd91df05 100644
--- a/apps/cua-spaces-web/e2e/teleport.ts
+++ b/apps/cua-spaces-web/e2e/teleport.ts
@@ -15,6 +15,7 @@ import { expect, type Page } from "@playwright/test";
import type { ParityCheckpoint } from "../src/bridge/parity";
import type { PickerGrid, PickerTile } from "../src/bridge/contracts/teleport";
import type { GridShown } from "../src/bridge/parity-teleport";
+import { messageText } from "../src/lib/messages";
type Cp<K extends ParityCheckpoint["kind"]> = Extract<ParityCheckpoint, { kind: K }>;
@@ -103,7 +104,7 @@ async function checkPicker(page: Page, cp: Cp<"picker">): Promise<void> {
case "options": {
await expect.poll(() => root.locator("[data-move]").evaluateAll((els) => els.map((e) => e.getAttribute("data-move")))).toEqual(state.entry?.moves ?? []);
await expect(root.locator("[data-move]:has([data-checked])")).toHaveAttribute("data-move", state.move ?? "app_only");
- const want = frame.sensitive.map((o) => `${o.group}:${o.label}:${o.detail}:${o.checked ? "on" : "off"}`);
+ const want = frame.sensitive.map((o) => `${o.group}:${messageText(o.label)}:${messageText(o.detail)}:${o.checked ? "on" : "off"}`);
await expect
.poll(() =>
root.locator("[data-sensitive]").evaluateAll((els) =>
diff --git a/apps/cua-spaces-web/src/bridge/contracts/teleport.ts b/apps/cua-spaces-web/src/bridge/contracts/teleport.ts
index 384747454b..17637023b7 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/teleport.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/teleport.ts
@@ -9,6 +9,12 @@
* decides every step; these only carry its state and views.
*/
+/** A message from the core (`message::Msg`): a code plus variables. */
+export interface Msg {
+ code: string;
+ vars: Record<string, string>;
+}
+
export type Capability = "full" | "install_only" | "unsupported";
export type TeleportMove = "app_only" | "app_with_files" | "app_with_state";
export type SensitiveGroup = "sign_ins" | "passwords" | "history";
@@ -190,8 +196,8 @@ export interface EntrySection {
/** An opt-in of the signed-in state move (`flow::SensitiveOption`). */
export interface SensitiveOption {
group: SensitiveGroup;
- label: string;
- detail: string;
+ label: Msg;
+ detail: Msg;
checked: boolean;
}
diff --git a/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx b/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx
index fe756a72af..9c5302fb18 100644
--- a/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx
+++ b/apps/cua-spaces-web/src/components/teleport/teleport-dialog.tsx
@@ -12,6 +12,7 @@ import { Checkbox } from "@/components/ui/checkbox";
import { Dialog, DialogPopup, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { leavesLine } from "@/lib/host-labels";
+import { messageText } from "@/lib/messages";
import { Segmented } from "@/components/ui/segmented";
import { markExplained, needsExplainer, TeleportExplainer } from "./explainer";
@@ -167,10 +168,10 @@ function Options({ state, session, teleport }: { state: PickerState; session: Te
/>
<span className="min-w-0">
<span className="block text-[13px]" data-sensitive-label>
- {o.label}
+ {messageText(o.label)}
</span>
<span className="block text-xs text-muted-foreground" data-sensitive-detail>
- {o.detail}
+ {messageText(o.detail)}
</span>
</span>
</label>
diff --git a/apps/cua-spaces-web/src/lib/messages.test.ts b/apps/cua-spaces-web/src/lib/messages.test.ts
new file mode 100644
index 0000000000..5472c6c5bc
--- /dev/null
+++ b/apps/cua-spaces-web/src/lib/messages.test.ts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import { readFileSync, readdirSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+
+import { MESSAGES, messageText } from "./messages";
+
+const en = "../cua-spaces/src/i18n/locales/en";
+
+describe("core messages", () => {
+ it("match the app's English catalog", () => {
+ const catalog: Record<string, string> = {};
+ for (const f of readdirSync(en)) Object.assign(catalog, JSON.parse(readFileSync(`${en}/${f}`, "utf8")));
+ for (const [code, text] of Object.entries(MESSAGES)) expect(catalog[code], code).toBe(text);
+ });
+
+ it("fills variables and shows an unknown code as it is", () => {
+ expect(messageText({ code: "x.unknown", vars: {} })).toBe("x.unknown");
+ });
+});
diff --git a/apps/cua-spaces-web/src/lib/messages.ts b/apps/cua-spaces-web/src/lib/messages.ts
new file mode 100644
index 0000000000..7acb09de46
--- /dev/null
+++ b/apps/cua-spaces-web/src/lib/messages.ts
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import type { Msg } from "../bridge/contracts/teleport";
+
+/**
+ * English for the core's message codes (`message::Msg`). This site is
+ * English only; the app's catalog is `apps/cua-spaces/src/i18n/locales/en`,
+ * and `messages.test.ts` fails if the two drift.
+ */
+export const MESSAGES: Record<string, string> = {
+ "teleport.sensitive.sign_ins.label": "Keep me signed in",
+ "teleport.sensitive.sign_ins.detail": "Sends the session cookies.",
+ "teleport.sensitive.passwords.label": "Saved passwords",
+ "teleport.sensitive.passwords.detail": "Sends the passwords saved in the app.",
+ "teleport.sensitive.history.label": "Browsing history",
+ "teleport.sensitive.history.detail":
+ "Sends the history of pages visited, and the bookmarks where the browser keeps them together.",
+};
+
+/** A core message as text: its English with the variables filled in. */
+export function messageText(msg: Msg): string {
+ const text = MESSAGES[msg.code] ?? msg.code;
+ return text.replace(/\{(\w+)\}/g, (whole, name: string) => msg.vars[name] ?? whole);
+}
diff --git a/apps/cua-spaces/src/components/AppTeleportPicker.tsx b/apps/cua-spaces/src/components/AppTeleportPicker.tsx
index fc2130a211..f8d4ef7a4e 100644
--- a/apps/cua-spaces/src/components/AppTeleportPicker.tsx
+++ b/apps/cua-spaces/src/components/AppTeleportPicker.tsx
@@ -3,7 +3,7 @@
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
-import { type CatalogEntry, MOVE_LABEL, type RunReport, type TeleportHost } from "@trycua/cua/teleport";
+import { type CatalogEntry, type RunReport, type TeleportHost } from "@trycua/cua/teleport";
import {
TeleportPickerController,
@@ -24,7 +24,7 @@ import { hasTauri } from "../native/bridge";
import { useGridLoads } from "./pickerLoads";
import { PickerTileView } from "./PickerTile";
import { SearchGlyph } from "./SearchGlyph";
-import { useT } from "../i18n";
+import { tMsg, useT } from "../i18n";
/**
* "Teleport an app…": every app on this machine, classified by the cua SDK
@@ -205,7 +205,7 @@ export function AppTeleportPicker({
checked={s.move === m}
onChange={() => controller.dispatch({ type: "move", move: m })}
/>
- <span>{MOVE_LABEL[m]}</span>
+ <span>{t(`teleport.move.${m}`)}</span>
</label>
))}
</div>
@@ -219,8 +219,8 @@ export function AppTeleportPicker({
onChange={(ev) => controller.dispatch({ type: "sensitive", group: o.group, value: ev.target.checked })}
/>
<span>
- <span className="ta-optin-label">{o.label}</span>
- <span className="ta-optin-detail">{o.detail}</span>
+ <span className="ta-optin-label">{tMsg(o.label)}</span>
+ <span className="ta-optin-detail">{tMsg(o.detail)}</span>
</span>
</label>
))}
diff --git a/apps/cua-spaces/src/i18n/index.ts b/apps/cua-spaces/src/i18n/index.ts
index de6d27fbfb..74253e026f 100644
--- a/apps/cua-spaces/src/i18n/index.ts
+++ b/apps/cua-spaces/src/i18n/index.ts
@@ -119,6 +119,17 @@ export function t(key: string, options?: TOptions): string {
return i18next.t(key, options) as string;
}
+/** A message from the Rust core: a stable code plus variables, never English. */
+export interface Msg {
+ code: string;
+ vars: Record<string, string>;
+}
+
+/** Translate a core message by looking its code up like any other key. */
+export function tMsg(msg: Msg): string {
+ return t(msg.code, msg.vars);
+}
+
/** React hook: `const t = useT("sharing")`. Re-renders on locale change. */
export function useT(ns: Namespace | Namespace[] = "common") {
return useTranslation(ns).t;
diff --git a/apps/cua-spaces/src/i18n/locales/en/teleport.json b/apps/cua-spaces/src/i18n/locales/en/teleport.json
index 661d07bb77..a66af6053d 100644
--- a/apps/cua-spaces/src/i18n/locales/en/teleport.json
+++ b/apps/cua-spaces/src/i18n/locales/en/teleport.json
@@ -34,5 +34,14 @@
"teleport.picker.preparing": "Preparing…",
"teleport.picker.tabs_label": "Teleport",
"teleport.picker.search": "Search",
- "teleport.drop_zone.label": "Teleport to {name}"
+ "teleport.drop_zone.label": "Teleport to {name}",
+ "teleport.move.app_only": "Just the app",
+ "teleport.move.app_with_files": "The app with files or folders",
+ "teleport.move.app_with_state": "The app with its signed-in state",
+ "teleport.sensitive.sign_ins.label": "Keep me signed in",
+ "teleport.sensitive.sign_ins.detail": "Sends the session cookies.",
+ "teleport.sensitive.passwords.label": "Saved passwords",
+ "teleport.sensitive.passwords.detail": "Sends the passwords saved in the app.",
+ "teleport.sensitive.history.label": "Browsing history",
+ "teleport.sensitive.history.detail": "Sends the history of pages visited, and the bookmarks where the browser keeps them together."
}
diff --git a/apps/cua-spaces/src/model/teleportFlow.ts b/apps/cua-spaces/src/model/teleportFlow.ts
index a77e4e3756..f02cf16f00 100644
--- a/apps/cua-spaces/src/model/teleportFlow.ts
+++ b/apps/cua-spaces/src/model/teleportFlow.ts
@@ -17,6 +17,7 @@ import type {
} from "@trycua/cua/teleport";
import { core } from "../core";
+import type { Msg } from "../i18n";
export type { PickerState };
@@ -75,8 +76,8 @@ export function canConfirm(s: PickerState): boolean {
/** One opt-in checkbox of the options step. */
export interface SensitiveOption {
group: SensitiveGroup;
- label: string;
- detail: string;
+ label: Msg;
+ detail: Msg;
checked: boolean;
}
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-sign-ins.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-sign-ins.json
index 2f4dd9a98d..f0b15465fc 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-sign-ins.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/teleport-sign-ins.json
@@ -128,9 +128,9 @@
],
"selectedId": "com.google.Chrome",
"sensitive": [
- "sign_ins:Keep me signed in:Sends the session cookies.:off",
- "passwords:Saved passwords:Sends the passwords saved in the app.:off",
- "history:Browsing history:Sends the history of pages visited, and the bookmarks where the browser keeps them together.:off"
+ "sign_ins:teleport.sensitive.sign_ins.label:teleport.sensitive.sign_ins.detail:off",
+ "passwords:teleport.sensitive.passwords.label:teleport.sensitive.passwords.detail:off",
+ "history:teleport.sensitive.history.label:teleport.sensitive.history.detail:off"
],
"step": "options"
},
@@ -153,9 +153,9 @@
],
"selectedId": "com.google.Chrome",
"sensitive": [
- "sign_ins:Keep me signed in:Sends the session cookies.:on",
- "passwords:Saved passwords:Sends the passwords saved in the app.:off",
- "history:Browsing history:Sends the history of pages visited, and the bookmarks where the browser keeps them together.:off"
+ "sign_ins:teleport.sensitive.sign_ins.label:teleport.sensitive.sign_ins.detail:on",
+ "passwords:teleport.sensitive.passwords.label:teleport.sensitive.passwords.detail:off",
+ "history:teleport.sensitive.history.label:teleport.sensitive.history.detail:off"
],
"step": "options"
},
@@ -179,9 +179,9 @@
],
"selectedId": "com.google.Chrome",
"sensitive": [
- "sign_ins:Keep me signed in:Sends the session cookies.:on",
- "passwords:Saved passwords:Sends the passwords saved in the app.:off",
- "history:Browsing history:Sends the history of pages visited, and the bookmarks where the browser keeps them together.:on"
+ "sign_ins:teleport.sensitive.sign_ins.label:teleport.sensitive.sign_ins.detail:on",
+ "passwords:teleport.sensitive.passwords.label:teleport.sensitive.passwords.detail:off",
+ "history:teleport.sensitive.history.label:teleport.sensitive.history.detail:on"
],
"step": "options"
},
@@ -204,9 +204,9 @@
],
"selectedId": "com.google.Chrome",
"sensitive": [
- "sign_ins:Keep me signed in:Sends the session cookies.:on",
- "passwords:Saved passwords:Sends the passwords saved in the app.:off",
- "history:Browsing history:Sends the history of pages visited, and the bookmarks where the browser keeps them together.:off"
+ "sign_ins:teleport.sensitive.sign_ins.label:teleport.sensitive.sign_ins.detail:on",
+ "passwords:teleport.sensitive.passwords.label:teleport.sensitive.passwords.detail:off",
+ "history:teleport.sensitive.history.label:teleport.sensitive.history.detail:off"
],
"step": "options"
},
diff --git a/libs/cua/crates/cua-spaces-app-core/src/lib.rs b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
index 1f32b1a614..6d155d7aa9 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/lib.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/lib.rs
@@ -75,6 +75,7 @@ pub mod installer;
pub mod keyvault;
pub mod login_item;
pub mod machines;
+pub mod message;
pub mod model;
pub mod notch;
pub mod notifications;
diff --git a/libs/cua/crates/cua-spaces-app-core/src/message.rs b/libs/cua/crates/cua-spaces-app-core/src/message.rs
new file mode 100644
index 0000000000..5e116c0403
--- /dev/null
+++ b/libs/cua/crates/cua-spaces-app-core/src/message.rs
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+//! A user-visible message as the core hands it to a shell: a stable code
+//! plus variables, never English. The shell looks the code up in its own
+//! catalog (the web UI's `en` namespaces, or the SwiftUI app's
+//! `.xcstrings`) and fills the variables, so translations never touch Rust.
+//! The code is the web UI's i18n key, for example `teleport.sensitive.history`.
+
+use serde::{Deserialize, Serialize};
+
+/// A message code and the variables its text uses (`{name}`).
+#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
+pub struct Msg {
+ /// The catalog key, `<area>.<screen_or_component>.<element>`.
+ pub code: String,
+ /// Values for the text's variables.
+ pub vars: std::collections::HashMap<String, String>,
+}
+
+impl Msg {
+ /// A message without variables.
+ pub fn new(code: &str) -> Self {
+ Self {
+ code: code.into(),
+ vars: std::collections::HashMap::new(),
+ }
+ }
+
+ /// Adds one variable.
+ pub fn with(mut self, name: &str, value: impl ToString) -> Self {
+ self.vars.insert(name.into(), value.to_string());
+ self
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn a_message_is_a_code_and_variables() {
+ let m = Msg::new("x.y").with("count", 3);
+ assert_eq!(m.code, "x.y");
+ assert_eq!(m.vars["count"], "3");
+ assert_eq!(
+ serde_json::to_string(&Msg::new("x.y")).unwrap(),
+ r#"{"code":"x.y","vars":{}}"#
+ );
+ }
+}
diff --git a/libs/cua/crates/cua-spaces-app-core/src/parity.rs b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
index 29e6c96899..9cb982fb67 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/parity.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/parity.rs
@@ -1234,8 +1234,8 @@ pub mod frame {
"error": state["error"],
"report": state["report"]["appId"],
"sensitive": sensitive.as_array().map(|a| a.iter().map(|o| Value::String(format!("{}:{}:{}:{}",
- o["group"].as_str().unwrap_or(""), o["label"].as_str().unwrap_or(""),
- o["detail"].as_str().unwrap_or(""), if o["checked"] == true { "on" } else { "off" }))).collect::<Vec<_>>()).unwrap_or_default(),
+ o["group"].as_str().unwrap_or(""), o["label"]["code"].as_str().unwrap_or(""),
+ o["detail"]["code"].as_str().unwrap_or(""), if o["checked"] == true { "on" } else { "off" }))).collect::<Vec<_>>()).unwrap_or_default(),
"planSensitive": plan_sensitive,
});
// Saved passwords, while the review offers them: the box's label
diff --git a/libs/cua/crates/cua-spaces-app-core/src/teleport/flow.rs b/libs/cua/crates/cua-spaces-app-core/src/teleport/flow.rs
index ace09b0a12..af5e5f867c 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/teleport/flow.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/teleport/flow.rs
@@ -15,6 +15,7 @@ use super::review::{
VaultSource,
};
use crate::keyvault::wire::KvInventory;
+use crate::message::Msg;
use crate::util::{contains_word, to_fixed};
use serde::{Deserialize, Serialize};
@@ -81,24 +82,22 @@ pub enum SensitiveGroup {
}
impl SensitiveGroup {
- /// The checkbox label.
- pub fn label(self) -> &'static str {
- match self {
- SensitiveGroup::SignIns => "Keep me signed in",
- SensitiveGroup::Passwords => "Saved passwords",
- SensitiveGroup::History => "Browsing history",
- }
+ /// The checkbox label (`teleport.sensitive.<group>.label`).
+ pub fn label(self) -> Msg {
+ Msg::new(match self {
+ SensitiveGroup::SignIns => "teleport.sensitive.sign_ins.label",
+ SensitiveGroup::Passwords => "teleport.sensitive.passwords.label",
+ SensitiveGroup::History => "teleport.sensitive.history.label",
+ })
}
- /// The line under it.
- pub fn detail(self) -> &'static str {
- match self {
- SensitiveGroup::SignIns => "Sends the session cookies.",
- SensitiveGroup::Passwords => "Sends the passwords saved in the app.",
- SensitiveGroup::History => {
- "Sends the history of pages visited, and the bookmarks where the browser keeps them together."
- }
- }
+ /// The line under it (`teleport.sensitive.<group>.detail`).
+ pub fn detail(self) -> Msg {
+ Msg::new(match self {
+ SensitiveGroup::SignIns => "teleport.sensitive.sign_ins.detail",
+ SensitiveGroup::Passwords => "teleport.sensitive.passwords.detail",
+ SensitiveGroup::History => "teleport.sensitive.history.detail",
+ })
}
}
@@ -109,9 +108,9 @@ pub struct SensitiveOption {
/// The group.
pub group: SensitiveGroup,
/// Label.
- pub label: String,
+ pub label: Msg,
/// The line under the label.
- pub detail: String,
+ pub detail: Msg,
/// Checked.
pub checked: bool,
}
@@ -772,8 +771,8 @@ pub fn sensitive_options(s: &PickerState) -> Vec<SensitiveOption> {
.flat_map(|e| e.sensitive_groups.iter())
.map(|&group| SensitiveOption {
group,
- label: group.label().into(),
- detail: group.detail().into(),
+ label: group.label(),
+ detail: group.detail(),
checked: s.sensitive.contains(&group),
})
.collect()
@@ -1688,14 +1687,16 @@ mod tests {
},
);
let opts = sensitive_options(&s);
- let labels: Vec<(&str, bool)> =
- opts.iter().map(|o| (o.label.as_str(), o.checked)).collect();
+ let labels: Vec<(&str, bool)> = opts
+ .iter()
+ .map(|o| (o.label.code.as_str(), o.checked))
+ .collect();
assert_eq!(
labels,
[
- ("Keep me signed in", true),
- ("Saved passwords", false),
- ("Browsing history", false)
+ ("teleport.sensitive.sign_ins.label", true),
+ ("teleport.sensitive.passwords.label", false),
+ ("teleport.sensitive.history.label", false)
]
);
assert_eq!(plan_sensitive(&s), [SensitiveGroup::SignIns]);
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.rs
index 27a7fdb438..86377ba006 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
@@ -9,6 +9,16 @@
use cua_spaces_app_core as core;
+/// A message code and the variables its text uses (`{name}`).
+pub type AppMsg = core::message::Msg;
+#[uniffi::remote(Record)]
+pub struct AppMsg {
+ /// The catalog key, `<area>.<screen_or_component>.<element>`.
+ pub code: String,
+ /// Values for the text's variables.
+ pub vars: std::collections::HashMap<String, String>,
+}
+
/// Operating system a Space runs.
pub type AppSpaceOs = core::model::SpaceOs;
#[uniffi::remote(Enum)]
@@ -2397,9 +2407,9 @@ pub struct AppSensitiveOption {
/// The group.
pub group: AppSensitiveGroup,
/// Label.
- pub label: String,
+ pub label: AppMsg,
/// The line under the label.
- pub detail: String,
+ pub detail: AppMsg,
/// Checked.
pub checked: bool,
}
diff --git a/libs/cua/scripts/generate-app-core-ffi.py b/libs/cua/scripts/generate-app-core-ffi.py
index 49127741ad..43b73194c3 100644
--- a/libs/cua/scripts/generate-app-core-ffi.py
+++ b/libs/cua/scripts/generate-app-core-ffi.py
@@ -19,6 +19,7 @@ OUT = ROOT / "crates/cua-spaces-ffi/src/app_core_types.rs"
# (source file, module path, [types]) in FFI order.
TYPES = [
+ ("message.rs", "message", ["Msg"]),
("model.rs", "model", ["SpaceOs", "SpaceStatus", "ThumbnailScene", "SpaceProvider", "SpaceSdkRef", "SpaceProgress", "PowerControl", "SpacePower", "Space", "SpaceRow", "Location", "SpaceKind", "Runtime"]),
("spaces/mod.rs", "spaces", ["AmbientDots"]),
("spaces/roster.rs", "spaces::roster", ["NoticeKind", "Notice", "RosterState", "RosterAction"]),
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index 1aec782885..e0ff9072e4 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -20396,6 +20396,72 @@ public func FfiConverterTypeAppModeChoice_lower(_ value: AppModeChoice) -> RustB
}
+public struct AppMsg: Equatable, Hashable {
+ /**
+ * The catalog key, `<area>.<screen_or_component>.<element>`.
+ */
+ public var code: String
+ /**
+ * Values for the text's variables.
+ */
+ public var vars: [String: String]
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(
+ /**
+ * The catalog key, `<area>.<screen_or_component>.<element>`.
+ */code: String,
+ /**
+ * Values for the text's variables.
+ */vars: [String: String]) {
+ self.code = code
+ self.vars = vars
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension AppMsg: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeAppMsg: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppMsg {
+ return
+ try AppMsg(
+ code: FfiConverterString.read(from: &buf),
+ vars: FfiConverterDictionaryStringString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: AppMsg, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.code, into: &buf)
+ FfiConverterDictionaryStringString.write(value.vars, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMsg_lift(_ buf: RustBuffer) throws -> AppMsg {
+ return try FfiConverterTypeAppMsg.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeAppMsg_lower(_ value: AppMsg) -> RustBuffer {
+ return FfiConverterTypeAppMsg.lower(value)
+}
+
+
public struct AppNewSpaceOn: Equatable, Hashable {
/**
* The button's label.
@@ -29246,11 +29312,11 @@ public struct AppSensitiveOption: Equatable, Hashable {
/**
* Label.
*/
- public var label: String
+ public var label: AppMsg
/**
* The line under the label.
*/
- public var detail: String
+ public var detail: AppMsg
/**
* Checked.
*/
@@ -29264,10 +29330,10 @@ public struct AppSensitiveOption: Equatable, Hashable {
*/group: AppSensitiveGroup,
/**
* Label.
- */label: String,
+ */label: AppMsg,
/**
* The line under the label.
- */detail: String,
+ */detail: AppMsg,
/**
* Checked.
*/checked: Bool) {
@@ -29294,16 +29360,16 @@ public struct FfiConverterTypeAppSensitiveOption: FfiConverterRustBuffer {
return
try AppSensitiveOption(
group: FfiConverterTypeAppSensitiveGroup.read(from: &buf),
- label: FfiConverterString.read(from: &buf),
- detail: FfiConverterString.read(from: &buf),
+ label: FfiConverterTypeAppMsg.read(from: &buf),
+ detail: FfiConverterTypeAppMsg.read(from: &buf),
checked: FfiConverterBool.read(from: &buf)
)
}
public static func write(_ value: AppSensitiveOption, into buf: inout [UInt8]) {
FfiConverterTypeAppSensitiveGroup.write(value.group, into: &buf)
- FfiConverterString.write(value.label, into: &buf)
- FfiConverterString.write(value.detail, into: &buf)
+ FfiConverterTypeAppMsg.write(value.label, into: &buf)
+ FfiConverterTypeAppMsg.write(value.detail, into: &buf)
FfiConverterBool.write(value.checked, into: &buf)
}
}