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.

fix(spaces): Teleport's review says what happens for "Just the app" (CUA-1616) (#5187)

dduponta8d9f38ff49f
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 9a18c7a00f..678e507064 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
@@ -31616,7 +31616,11 @@ export type AppReviewView = {
*/
items: Array<AppConsentItem>,
/**
- * Plan steps.
+ * What happens, in plan steps, when the review has nothing to choose
+ * (no files, state, secrets or sites; e.g. "Just the app" for an app
+ * the Space's image already has), so the review is never blank. Empty
+ * otherwise: the lines below say what is sent, and a step's counts
+ * would not follow what is turned off. The installs are in `items`.
*/
steps: Array<AppPlanStepView>,
/**
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportReviewViews.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportReviewViews.swift
index 5885395924..f9a7b3c710 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportReviewViews.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Views/TeleportReviewViews.swift
@@ -34,6 +34,12 @@ struct TeleportReview: View {
.font(.caption).foregroundStyle(.secondary)
}
}
+ // What happens, when there is nothing to choose (the core's).
+ if !review.steps.isEmpty {
+ Section("What happens") {
+ ForEach(Array(review.steps.enumerated()), id: \.offset) { _, s in Text(s.summary) }
+ }
+ }
Section { summary }
if review.needsAcknowledgement {
Toggle("Send the secrets listed above", isOn: Binding(
diff --git a/apps/cua-spaces-web/src/components/__tests__/teleport-review.test.tsx b/apps/cua-spaces-web/src/components/__tests__/teleport-review.test.tsx
new file mode 100644
index 0000000000..911e9a0a67
--- /dev/null
+++ b/apps/cua-spaces-web/src/components/__tests__/teleport-review.test.tsx
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+import { cleanup, render } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import type { CatalogEntry, TeleportPlan, TeleportStore } from "@/bridge";
+import { pickerInitial, pickerReduce, pickerReview } from "@/bridge/teleport";
+import { testCore, wasmBuilt } from "@/bridge/__tests__/testCore";
+import { TeleportReview } from "@/components/teleport/review";
+
+afterEach(cleanup);
+
+const firefox: CatalogEntry = {
+ id: "firefox",
+ name: "Firefox",
+ hostPath: "/Applications/Firefox.app",
+ hostAppId: "org.mozilla.firefox",
+ version: "131.0",
+ capability: "full",
+ reason: null,
+ moves: ["app_only", "app_with_state"],
+ providerId: "firefox",
+ sensitiveGroups: ["sign_ins", "history"],
+ installSource: "image",
+ installId: null,
+ installVersion: null,
+ launchBin: "firefox",
+ lastUsedMs: null,
+ json: "firefox",
+};
+
+describe.skipIf(!wasmBuilt)("teleport review", () => {
+ // CUA-1616: "Just the app" for an app the Space's image already has
+ // installs and sends nothing; the review was blank under its title.
+ it("says what happens for just the app when nothing is installed or sent", async () => {
+ const core = await testCore();
+ let s = pickerInitial(core, "space-5973f9e636");
+ s = pickerReduce(core, s, { type: "preselect", entry: firefox, files: [] });
+ s = pickerReduce(core, s, { type: "move", move: "app_only" });
+ s = pickerReduce(core, s, { type: "plan" });
+ const plan: TeleportPlan = {
+ app: firefox,
+ spaceId: "local:space-5973f9e636",
+ moves: "app_only",
+ steps: [{ kind: "launch", summary: "Open firefox" }],
+ consent: [],
+ sensitive: false,
+ relayUnsealed: false,
+ totalBytes: 0,
+ warnings: [],
+ json: "{}",
+ };
+ s = pickerReduce(core, s, { type: "planned", plan });
+ const review = pickerReview(core, s)!;
+ expect(review.title).toBe("Teleport Firefox to space-5973f9e636");
+
+ const teleport = { send: vi.fn(), sendFrom: vi.fn(), bytes: (n: number) => `${n} B` } as unknown as TeleportStore;
+ const { container } = render(<TeleportReview review={review} readingSites={false} vault={null} teleport={teleport} />);
+ expect(container.textContent).toContain("What happens");
+ expect([...container.querySelectorAll("[data-review-step]")].map((li) => li.textContent)).toEqual(["Open Firefox"]);
+ });
+});
diff --git a/apps/cua-spaces-web/src/components/teleport/review.tsx b/apps/cua-spaces-web/src/components/teleport/review.tsx
index 30b471df0b..924025de5e 100644
--- a/apps/cua-spaces-web/src/components/teleport/review.tsx
+++ b/apps/cua-spaces-web/src/components/teleport/review.tsx
@@ -88,6 +88,18 @@ export function TeleportReview({
</Group>
) : null}
+ {r.steps.length ? (
+ <Group title="What happens">
+ <ul className="divide-y">
+ {r.steps.map((s, i) => (
+ <li key={i} className="px-4 py-2.5 text-[13px]" data-review-step={s.kind}>
+ {s.summary}
+ </li>
+ ))}
+ </ul>
+ </Group>
+ ) : null}
+
{installs.length || r.warnings.length ? (
<Group>
<ul className="divide-y">
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/teleport-review.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/teleport-review.mdx
index 2b2e22da4b..8af00de325 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/teleport-review.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/teleport-review.mdx
@@ -27,7 +27,7 @@ Returned by [`app_picker_review`](/cua-sdk/reference/spaces/app-core/teleport#ap
| --- | --- | --- | --- |
| `title` | `String` | | "Teleport Slack to Aurora". |
| `items` | [`Vec<AppConsentItem>`](#appconsentitem-record) | | The consent lines. |
-| `steps` | [`Vec<AppPlanStepView>`](#appplanstepview-record) | | Plan steps. |
+| `steps` | [`Vec<AppPlanStepView>`](#appplanstepview-record) | | What happens, in plan steps, when the review has nothing to choose (no files, state, secrets or sites; e.g. "Just the app" for an app the Space's image already has), so the review is never blank. Empty otherwise: the lines below say what is sent, and a step's counts would not follow what is turned off. The installs are in `items`. |
| `needs_acknowledgement` / `needsAcknowledgement` | `bool` | | The secrets checkbox shows. |
| `acknowledged` | `bool` | | Checked. |
| `offers_save_to_keyvault` / `offersSaveToKeyvault` | `bool` | | The "Save to Keyvault" checkbox shows (a sensitive plan only: there is nothing to keep sealed otherwise). |
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 e6783cfc94..826954f5bf 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
@@ -1250,7 +1250,11 @@ pub struct ReviewView {
pub title: String,
/// The consent lines.
pub items: Vec<ConsentItem>,
- /// Plan steps.
+ /// What happens, in plan steps, when the review has nothing to choose
+ /// (no files, state, secrets or sites; e.g. "Just the app" for an app
+ /// the Space's image already has), so the review is never blank. Empty
+ /// otherwise: the lines below say what is sent, and a step's counts
+ /// would not follow what is turned off. The installs are in `items`.
pub steps: Vec<PlanStepView>,
/// The secrets checkbox shows.
pub needs_acknowledgement: bool,
@@ -1344,10 +1348,27 @@ pub fn review(s: &PickerState) -> Option<ReviewView> {
(bytes > 0).then(|| format!("{} leaves this Mac", format_bytes(bytes)))
};
let app = &plan.app.name;
+ let chooses = vault || cookies || plan.consent.iter().any(|c| toggleable(c, choice));
Some(ReviewView {
title: format!("Teleport {} to {}", plan.app.name, s.space_name),
items: plan.consent.clone(),
- steps: plan.steps.clone(),
+ steps: if chooses {
+ vec![]
+ } else {
+ plan.steps
+ .iter()
+ .filter(|st| st.kind != "install")
+ .map(|st| PlanStepView {
+ // The app's own name ("Open Firefox"), not its program's.
+ summary: if st.kind == "launch" {
+ format!("Open {app}")
+ } else {
+ st.summary.clone()
+ },
+ ..st.clone()
+ })
+ .collect()
+ },
toggles: plan
.consent
.iter()
@@ -1700,6 +1721,90 @@ mod tests {
reduce(&s, &PickerEvent::Plan)
}
+ /// "Just the app" for an app the Space's image already has sends
+ /// nothing and installs nothing: the review still says what happens
+ /// (CUA-1616), and only when there is nothing to choose.
+ #[test]
+ fn a_review_with_nothing_to_choose_lists_what_happens() {
+ let step = |kind: &str, summary: &str| PlanStepView {
+ kind: kind.into(),
+ summary: summary.into(),
+ };
+ let s = reduce(
+ &initial("dev"),
+ &PickerEvent::Preselect {
+ entry: chrome_entry(),
+ files: vec![],
+ },
+ );
+ let s = reduce(
+ &reduce(
+ &s,
+ &PickerEvent::Move {
+ moves: Move::AppOnly,
+ },
+ ),
+ &PickerEvent::Plan,
+ );
+ let app_only = Plan {
+ moves: Move::AppOnly,
+ steps: vec![step("launch", "Open google-chrome")],
+ total_bytes: 0,
+ ..plan(false)
+ };
+ let s = reduce(
+ &s,
+ &PickerEvent::Planned {
+ plan: app_only.clone(),
+ },
+ );
+ let rv = review(&s).unwrap();
+ assert!(rv.items.is_empty() && rv.toggles.is_empty() && rv.warnings.is_empty());
+ assert_eq!(rv.steps, vec![step("launch", "Open Google Chrome")]);
+ assert!(rv.can_confirm);
+
+ // An install is listed in `items` already, not again as a step.
+ let installs = Plan {
+ steps: vec![
+ step("install", "Install google-chrome (pinned, verified)"),
+ step("launch", "Open google-chrome"),
+ ],
+ consent: vec![ConsentItem {
+ kind: ConsentKind::Install,
+ key: "google-chrome".into(),
+ label: "Install Google Chrome 141".into(),
+ detail: String::new(),
+ bytes: 0,
+ sensitive: false,
+ }],
+ ..app_only.clone()
+ };
+ let s2 = reduce(&reduce(&s, &PickerEvent::Back), &PickerEvent::Plan);
+ let rv = review(&reduce(&s2, &PickerEvent::Planned { plan: installs })).unwrap();
+ assert_eq!(rv.steps, vec![step("launch", "Open Google Chrome")]);
+
+ // Something to choose: the lines say what is sent, not the steps.
+ let files = Plan {
+ moves: Move::AppWithFiles,
+ steps: vec![
+ step("files", "Send 1 item(s) to ~/Downloads/x"),
+ step("launch", "Open google-chrome"),
+ ],
+ consent: vec![ConsentItem {
+ kind: ConsentKind::File,
+ key: "/Users/me/a.txt".into(),
+ label: "a.txt".into(),
+ detail: String::new(),
+ bytes: 10,
+ sensitive: false,
+ }],
+ ..app_only
+ };
+ let rv = review(&reduce(&s2, &PickerEvent::Planned { plan: files })).unwrap();
+ assert_eq!(rv.toggles.len(), 1);
+ assert!(rv.steps.is_empty());
+ }
+
/// "Save to Keyvault" only shows and only takes for a sensitive plan (a
/// non-sensitive teleport has nothing a Keyvault would seal), resets
/// going Back, and reaches `consent()`.
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 597356ce0f..35e7e6cd04 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
@@ -2793,7 +2793,11 @@ pub struct AppReviewView {
pub title: String,
/// The consent lines.
pub items: Vec<AppConsentItem>,
- /// Plan steps.
+ /// What happens, in plan steps, when the review has nothing to choose
+ /// (no files, state, secrets or sites; e.g. "Just the app" for an app
+ /// the Space's image already has), so the review is never blank. Empty
+ /// otherwise: the lines below say what is sent, and a step's counts
+ /// would not follow what is turned off. The installs are in `items`.
pub steps: Vec<AppPlanStepView>,
/// The secrets checkbox shows.
pub needs_acknowledgement: bool,
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index 9dc751f5fb..f63c581a39 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -26614,7 +26614,11 @@ public struct AppReviewView: Equatable, Hashable {
*/
public var items: [AppConsentItem]
/**
- * Plan steps.
+ * What happens, in plan steps, when the review has nothing to choose
+ * (no files, state, secrets or sites; e.g. "Just the app" for an app
+ * the Space's image already has), so the review is never blank. Empty
+ * otherwise: the lines below say what is sent, and a step's counts
+ * would not follow what is turned off. The installs are in `items`.
*/
public var steps: [AppPlanStepView]
/**
@@ -26734,7 +26738,11 @@ public struct AppReviewView: Equatable, Hashable {
* The consent lines.
*/items: [AppConsentItem],
/**
- * Plan steps.
+ * What happens, in plan steps, when the review has nothing to choose
+ * (no files, state, secrets or sites; e.g. "Just the app" for an app
+ * the Space's image already has), so the review is never blank. Empty
+ * otherwise: the lines below say what is sent, and a step's counts
+ * would not follow what is turned off. The installs are in `items`.
*/steps: [AppPlanStepView],
/**
* The secrets checkbox shows.