Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(spaces): list signed-in devices under "Your devices" on the Machines page (#6085)
injaneity9758f8518b6e
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swiftindex 3cbe8900af..1fe579de1d 100644--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swift+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/MachinesViewTests.swift@@ -143,6 +143,8 @@ struct MachinesViewTests {let work = view.machines.first { $0.name == "Work laptop" }#expect(work?.remove?.device == "dev_work")#expect(work?.remove?.label == "Remove from account")+ #expect(work?.line == "Signed-in device, not shared")+ #expect(view.groups.first { $0.id == "devices" }?.ids.contains("dev_work") == true)// No Space actions on a machine: its Spaces only lead to the Space.#expect(view.machines.allSatisfy { $0.newSpace.label == "New Space here" })diff --git a/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx b/apps/cua-spaces-web/src/__tests__/machines-page.test.tsxindex ca45cbabc5..075fa131e6 100644--- a/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx+++ b/apps/cua-spaces-web/src/__tests__/machines-page.test.tsx@@ -116,7 +116,12 @@ describe.skipIf(!wasmBuilt)("the Machines page (real routes, wasm core)", () =>// Groups, with the old machines collapsed.const groups = [...document.querySelectorAll("[data-machine-group]")].map((g) => g.getAttribute("data-machine-group"));- expect(groups).toEqual(["yours", "old", "team"]);+ expect(groups).toEqual(["yours", "devices", "old", "team"]);+ const devices = document.querySelector<HTMLElement>('[data-machine-group="devices"]')!;+ expect(devices.textContent).toContain("Your devices");+ const lap = devices.querySelector<HTMLElement>('[data-machine-id="dev_lap"]')!;+ expect(lap.hidden).toBe(false);+ expect(lap.querySelector("[data-machine-line]")?.textContent).toBe("Signed-in device, not shared");const old = document.querySelector<HTMLElement>('[data-machine-id="old1"]')!;expect(old.hidden).toBe(true);fireEvent.click(screen.getByRole("button", { name: /Offline for 30\+ days/ }));diff --git a/apps/cua-spaces-web/src/bridge/contracts/host.ts b/apps/cua-spaces-web/src/bridge/contracts/host.tsindex eb14f21667..34fe455821 100644--- a/apps/cua-spaces-web/src/bridge/contracts/host.ts+++ b/apps/cua-spaces-web/src/bridge/contracts/host.ts@@ -326,7 +326,7 @@ export interface MachinesViewMachine {/** A group of the list (`machines_view::MachinesViewGroup`). */export interface MachinesViewGroup {- /** `yours`, `old` or `team`. */+ /** `yours`, `devices`, `old` or `team`. */id: string;title: string;collapsed: boolean;diff --git a/apps/cua-spaces-web/src/lib/machines.test.ts b/apps/cua-spaces-web/src/lib/machines.test.tsindex c659b935b2..9a5645a057 100644--- a/apps/cua-spaces-web/src/lib/machines.test.ts+++ b/apps/cua-spaces-web/src/lib/machines.test.ts@@ -41,6 +41,14 @@ describe("machines", () => {expect(machineSubtitle(machine({ os: "windows", connection: "direct" }))).toBe("Windows · Direct");});+ it("labels a signed-in device apart from a machine's connection", () => {+ expect(connectionLabel(machine({ connection: null, device: true }))).toBe("Signed-in device, not shared");+ expect(machineSubtitle(machine({ os: "windows", connection: null, device: true }))).toBe("Windows · Signed-in device, not shared");+ expect(connectionLabel(machine({ connection: "relay", device: true }))).toBe("Cua relay");+ expect(connectionLabel(machine({ connection: null, current: true }))).toBe("Not set up for access");+ expect(connectionLabel(machine({ connection: null, current: false }))).toBe("Unknown");+ });+it("says when an offline machine was last seen", () => {expect(presenceLabel(machine({}), NOW)).toBe("Online");expect(presenceLabel(machine({ online: false }), NOW)).toBe("Offline");diff --git a/apps/cua-spaces-web/src/lib/machines.ts b/apps/cua-spaces-web/src/lib/machines.tsindex 20569c516f..668b642e71 100644--- a/apps/cua-spaces-web/src/lib/machines.ts+++ b/apps/cua-spaces-web/src/lib/machines.ts@@ -27,10 +27,14 @@ export const CONNECTION_LABEL: Record<"relay" | "direct", string> = {direct: "Direct",};+/** A row that is only a signed-in device (`machines_view::DEVICE_LINE`). */+export const DEVICE_LINE = "Signed-in device, not shared";+/** How other devices reach it, in words. */export function connectionLabel(m: Pick<Machine, "connection" | "current"> & Pick<Partial<Machine>, "device">): string {if (m.connection) return CONNECTION_LABEL[m.connection];- return m.current || m.device ? "Not set up for access" : "Unknown";+ if (m.device) return DEVICE_LINE;+ return m.current ? "Not set up for access" : "Unknown";}/** The list row's second line: OS, then how it is reached. */diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.jsonindex d48fc92b39..fe17ce3798 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/machines.json@@ -78,8 +78,13 @@"● Ada's MacBook Pro [This Mac] — Desktop · 2 Spaces","● cua's Mac Studio — Desktop · 1 Space","○ Cua BYOC tests — Offline",- "○ Adas-MacBook-Pro-2.local — Not sharing",- "● Ana's laptop — Online"+ "○ Adas-MacBook-Pro-2.local — Not sharing"+ ]+ },+ {+ "group": "Your devices",+ "rows": [+ "● Ana's laptop — Signed-in device, not shared"]},{@@ -175,15 +180,15 @@{"group": "Your machines","rows": [- "● Ada's MacBook Pro [This Mac] — 1 Space running",- "○ Cua BYOC tests — Offline",- "● Ana's laptop — Online"+ "● Ada's MacBook Pro [This Mac] — 1 Space running"]},{- "group": "Offline for 30+ days (1) (collapsed) · Remove old machines",+ "group": "Your devices","rows": [- "○ mac-mini-staging — Offline"+ "○ Cua BYOC tests — Signed-in device, not shared",+ "○ mac-mini-staging — Signed-in device, not shared",+ "● Ana's laptop — Signed-in device, not shared"]}],@@ -207,16 +212,6 @@"details: Last seen: 9 days ago; OS: macOS","Remove from account -> dev_byoc"],- [- "Ana's laptop — Online (rename: device)",- "Provide Spaces: off (read-only)",- "Share this desktop: off (read-only)",- "note: Change this on that PC.",- "spaces: No Spaces yet.",- "New Space here on host:dev_lap (disabled: It doesn’t provide Spaces. Turn on “Let my other devices use this PC” on that PC.)",- "details: OS: Windows",- "Remove from account -> dev_lap"- ],["mac-mini-staging — Offline (rename: device)","notice: This machine is offline. Open Cua Spaces on it to use it.",@@ -226,6 +221,16 @@"New Space here on host:dev_old1 (disabled: It’s offline.)","details: Last seen: 41 days ago; OS: macOS","Remove from account -> dev_old1"+ ],+ [+ "Ana's laptop — Online (rename: device)",+ "Provide Spaces: off (read-only)",+ "Share this desktop: off (read-only)",+ "note: Change this on that PC.",+ "spaces: No Spaces yet.",+ "New Space here on host:dev_lap (disabled: It doesn’t provide Spaces. Turn on “Let my other devices use this PC” on that PC.)",+ "details: OS: Windows",+ "Remove from account -> dev_lap"]],"summary": "4 machines, 2 online",@@ -260,8 +265,13 @@"● Ada's MacBook Pro [This Mac] — Desktop · 2 Spaces [fail]","● cua's Mac Studio — Desktop · 1 Space [warn]","○ Cua BYOC tests — Offline",- "○ Adas-MacBook-Pro-2.local — Not sharing",- "● Ana's laptop — Online"+ "○ Adas-MacBook-Pro-2.local — Not sharing"+ ]+ },+ {+ "group": "Your devices",+ "rows": [+ "● Ana's laptop — Signed-in device, not shared"]},{@@ -364,8 +374,13 @@"● Ada's MacBook Pro [This Mac] — Desktop · 2 Spaces [fail]","● cua's Mac Studio — Desktop · 1 Space [warn]","○ Cua BYOC tests — Offline",- "○ Adas-MacBook-Pro-2.local — Not sharing",- "● Ana's laptop — Online"+ "○ Adas-MacBook-Pro-2.local — Not sharing"+ ]+ },+ {+ "group": "Your devices",+ "rows": [+ "● Ana's laptop — Signed-in device, not shared"]},{@@ -468,8 +483,13 @@"● Ada's MacBook Pro [This Mac] — Desktop · 2 Spaces [fail]","● cua's Mac Studio — Desktop · 1 Space [warn]","○ Cua BYOC tests — Offline",- "○ Adas-MacBook-Pro-2.local — Not sharing",- "● Ana's laptop — Online"+ "○ Adas-MacBook-Pro-2.local — Not sharing"+ ]+ },+ {+ "group": "Your devices",+ "rows": [+ "● Ana's laptop — Signed-in device, not shared"]},{@@ -570,6 +590,7 @@"order": ["clouds","yours",+ "devices","old","team"],@@ -618,8 +639,13 @@"● Ada's MacBook Pro [This Mac] — Desktop · 2 Spaces [fail]","● cua's Mac Studio — Desktop · 1 Space [warn]","○ Cua BYOC tests — Offline",- "○ Adas-MacBook-Pro-2.local — Not sharing",- "● Ana's laptop — Online"+ "○ Adas-MacBook-Pro-2.local — Not sharing"+ ]+ },+ {+ "group": "Your devices",+ "rows": [+ "● Ana's laptop — Signed-in device, not shared"]},{@@ -720,6 +746,7 @@"order": ["clouds","yours",+ "devices","old","team"],@@ -769,8 +796,13 @@"● Ada's MacBook Pro [This Mac] — Desktop · 2 Spaces [fail]","● cua's Mac Studio — Desktop · 1 Space [warn]","○ Cua BYOC tests — Offline",- "○ Adas-MacBook-Pro-2.local — Not sharing",- "● Ana's laptop — Online"+ "○ Adas-MacBook-Pro-2.local — Not sharing"+ ]+ },+ {+ "group": "Your devices",+ "rows": [+ "● Ana's laptop — Signed-in device, not shared"]},{diff --git a/libs/cua/crates/cua-spaces-app-core/src/machines_view.rs b/libs/cua/crates/cua-spaces-app-core/src/machines_view.rsindex 2b4af5d8c3..f95e704b5b 100644--- a/libs/cua/crates/cua-spaces-app-core/src/machines_view.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/machines_view.rs@@ -2,7 +2,9 @@// Copyright (c) 2026 Cua AI, Inc.//! The Machines page as every UI draws it: the list in groups ("Your-//! machines", a collapsed "Offline for 30+ days", "Team machines"), one+//! machines", "Your devices" (signed-in devices that are none of the+//! machines, whatever their age), a collapsed "Offline for 30+ days", "Team+//! machines"), one//! muted line per row, and each machine's page (its name and rename, the//! one "Let my other devices use this computer" switch, the Spaces on it as//! links, New Space here, Details, and Remove from account).@@ -356,6 +358,12 @@ pub struct MachinesView {pub const DESKTOP_LABEL: &str = "Desktop";/// "Your machines".pub const YOURS_TITLE: &str = "Your machines";+/// "Your devices": the group of signed-in devices that are none of your+/// machines, whatever their age.+pub const DEVICES_TITLE: &str = "Your devices";+/// The line of a row that is only a signed-in device: it can't run Spaces+/// and nothing is shared from it.+pub const DEVICE_LINE: &str = "Signed-in device, not shared";/// "Team machines".pub const TEAM_TITLE: &str = "Team machines";/// The button that removes a machine.@@ -573,6 +581,7 @@ pub fn view(input: &MachinesViewInput) -> MachinesView {let host = input.host.as_ref();let mut list = Vec::with_capacity(rows.len());let mut yours = vec![];+ let mut devices = vec![];let mut old = vec![];let mut team_ids = vec![];let mut old_removes = vec![];@@ -632,12 +641,12 @@ pub fn view(input: &MachinesViewInput) -> MachinesView {// The row's one line.// One short label: no "a · b" chains (the switches show the rest),// except a shared desktop's "Desktop · N Spaces".- let line = if !row.online {+ let line = if row.device_only {+ DEVICE_LINE.into()+ } else if !row.online {machines::OFFLINE.into()} else if row.stopped_sharing {machines::NOT_SHARING.into()- } else if row.device_only {- machines::ONLINE.into()} else if has_desktop {machines::desktop_spaces_label(u32::try_from(on.len()).unwrap_or(u32::MAX))} else {@@ -881,7 +890,9 @@ pub fn view(input: &MachinesViewInput) -> MachinesView {&& row.last_seen.is_some_and(|t| t > 0 && now.saturating_sub(t) >= OLD_AFTER_SECS);- if team {+ if row.device_only {+ devices.push(row.id.clone());+ } else if team {team_ids.push(row.id.clone());} else if is_old {old.push(row.id.clone());@@ -975,6 +986,15 @@ pub fn view(input: &MachinesViewInput) -> MachinesView {remove_all: None,});}+ if !devices.is_empty() {+ groups.push(MachinesViewGroup {+ id: "devices".into(),+ title: DEVICES_TITLE.into(),+ collapsed: false,+ ids: devices,+ remove_all: None,+ });+ }if !old.is_empty() {let n = old_removes.len();groups.push(MachinesViewGroup {@@ -1092,6 +1112,13 @@ mod tests {}}+ fn device_never_seen(id: &str, name: &str) -> DeviceIn {+ DeviceIn {+ last_seen: None,+ ..device(id, name, 0)+ }+ }+fn relay(id: &str, role: &str, provides: Option<bool>) -> MachinesViewRelay {MachinesViewRelay {id: id.into(),@@ -1238,6 +1265,99 @@ mod tests {assert_eq!(all.removes[0].device.as_deref(), Some("dev_old1"));}+ fn with_devices() -> MachinesViewInput {+ let mut input = mockup();+ input.page.devices.extend([+ device("dev_lap", "Ana's laptop", NOW - 120),+ device("dev_away", "Away laptop", NOW - 3 * DAY),+ device("dev_stale", "Stale laptop", NOW - 41 * DAY),+ ]);+ input+ }++ #[test]+ fn a_device_that_is_only_signed_in_is_under_your_devices() {+ let base = with_devices();+ let shell = MachinesViewInput {+ rows: Some(machines::page_rows(&base.page)),+ ..base.clone()+ };+ for input in [base, shell] {+ let v = view(&input);+ let groups: Vec<(&str, &str, bool, Vec<&str>)> = v+ .groups+ .iter()+ .map(|g| {+ (+ g.id.as_str(),+ g.title.as_str(),+ g.collapsed,+ g.ids.iter().map(String::as_str).collect(),+ )+ })+ .collect();+ assert_eq!(+ groups,+ [+ (+ "yours",+ "Your machines",+ false,+ vec!["this-mac", "studio", "byoc"]+ ),+ (+ "devices",+ "Your devices",+ false,+ vec!["dev_lap", "dev_away", "dev_stale"]+ ),+ ("old", "Offline for 30+ days (1)", true, vec!["old1"]),+ ("team", "Team machines", false, vec!["team"]),+ ]+ );+ assert!(v.groups[1].remove_all.is_none());+ let flat: Vec<&str> = v+ .groups+ .iter()+ .flat_map(|g| g.ids.iter().map(String::as_str))+ .collect();+ assert_eq!(+ flat,+ v.machines.iter().map(|m| m.id.as_str()).collect::<Vec<_>>()+ );+ let all = v.groups[2].remove_all.as_ref().unwrap();+ assert_eq!(all.removes.len(), 1);+ assert_eq!(all.removes[0].machine.as_deref(), Some("old1"));+ assert_eq!(all.removes[0].device.as_deref(), Some("dev_old1"));+ }+ }++ #[test]+ fn a_device_of_its_own_reads_signed_in_device_not_shared() {+ let mut input = with_devices();+ input+ .page+ .devices+ .push(device_never_seen("dev_never", "Never seen"));+ let v = view(&input);+ let devs = ["dev_lap", "dev_away", "dev_stale", "dev_never"];+ for id in devs {+ let m = by_id(&v, id);+ assert_eq!(m.line, "Signed-in device, not shared", "{id}");+ assert_eq!(m.online, id == "dev_lap", "{id}");+ assert_eq!(+ m.status,+ if id == "dev_lap" { "Online" } else { "Offline" },+ "{id}"+ );+ let rm = m.remove.as_ref().unwrap();+ assert!(rm.enabled, "{id}");+ assert!(rm.device.is_some() && rm.machine.is_none(), "{id}");+ }+ assert_eq!(by_id(&v, "byoc").line, "Offline");+ assert!(v.machines.iter().all(|m| m.line != "Not set up for access"));+ }+#[test]fn only_this_machine_s_switches_change_here() {let v = view(&mockup());