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): Teams on by default, CUA_EXPERIMENTAL_TEAMS=0 as kill switch (#5142)
Francesco Bonaccie0a49bcc3924
diff --git a/docs/content/docs/cua-cli/reference/cli/host.mdx b/docs/content/docs/cua-cli/reference/cli/host.mdxindex c2c0fe6719..06034ea889 100644--- a/docs/content/docs/cua-cli/reference/cli/host.mdx+++ b/docs/content/docs/cua-cli/reference/cli/host.mdx@@ -88,7 +88,7 @@ cua host pair [OPTIONS]| Flag | Type | Default | Description || --- | --- | --- | --- |-| <span id="cua-host-pair--team"></span>`--team` | string | | Add the machine for this team (its id). Experimental: needs CUA_EXPERIMENTAL_TEAMS=1. |+| <span id="cua-host-pair--team"></span>`--team` | string | | Add the machine for this team (its id). || <span id="cua-host-pair--name"></span>`--name` | string | | Name the machine gets (default: its own host name). || <span id="cua-host-pair--expires"></span>`--expires` | integer | `30` | Minutes until the code expires (1 to 1440). || <span id="cua-host-pair--revoke"></span>`--revoke` | string | | Revoke an unused code by id (`pc_…`). |diff --git a/docs/content/docs/cua-cli/reference/cli/index.mdx b/docs/content/docs/cua-cli/reference/cli/index.mdxindex c924edf19e..0cf79be972 100644--- a/docs/content/docs/cua-cli/reference/cli/index.mdx+++ b/docs/content/docs/cua-cli/reference/cli/index.mdx@@ -166,13 +166,13 @@ Enroll this device on the relay, approve, rename and revoke devices, and read th| --- | --- | --- || <span id="cua-devices-status"></span><span id="cua-devices-enroll"></span><span id="cua-devices-approve"></span><span id="cua-devices-ls"></span><span id="cua-devices-rename"></span><span id="cua-devices-revoke"></span><span id="cua-devices-audit"></span>[`cua devices`](/cua-cli/reference/cli/devices#cua-devices) | This device as a client of your cua.ai account on the relay: enroll (second factor), approve other devices, list, rename, revoke, and the audit log of who accessed what. | [`status`](/cua-cli/reference/cli/devices#cua-devices-status), [`enroll`](/cua-cli/reference/cli/devices#cua-devices-enroll), [`approve`](/cua-cli/reference/cli/devices#cua-devices-approve), [`ls`](/cua-cli/reference/cli/devices#cua-devices-ls), [`rename`](/cua-cli/reference/cli/devices#cua-devices-rename), [`revoke`](/cua-cli/reference/cli/devices#cua-devices-revoke), [`audit`](/cua-cli/reference/cli/devices#cua-devices-audit) |-### `cua team (experimental)`+### `cua team`-Experimental, not available yet (needs `CUA_EXPERIMENTAL_TEAMS=1`): teams, their members, machines, device approvals and audit log. [Reference](/cua-cli/reference/cli/team).+Teams, their members, machines, device approvals and audit log. [Reference](/cua-cli/reference/cli/team).| Command | Description | Subcommands || --- | --- | --- |-| <span id="cua-team"></span><span id="cua-team-create"></span><span id="cua-team-ls"></span><span id="cua-team-show"></span><span id="cua-team-invite"></span><span id="cua-team-join"></span><span id="cua-team-leave"></span><span id="cua-team-remove-member"></span><span id="cua-team-set-role"></span><span id="cua-team-devices"></span><span id="cua-team-approve"></span><span id="cua-team-deny"></span><span id="cua-team-request"></span><span id="cua-team-add-machine"></span><span id="cua-team-remove-machine"></span><span id="cua-team-audit"></span><span id="cua-team-delete"></span>[`cua team`](/cua-cli/reference/cli/team#cua-team) | Experimental, not available yet (set CUA_EXPERIMENTAL_TEAMS=1): teams share machines with every member and their agents. | [`create`](/cua-cli/reference/cli/team#cua-team-create), [`ls`](/cua-cli/reference/cli/team#cua-team-ls), [`show`](/cua-cli/reference/cli/team#cua-team-show), [`invite`](/cua-cli/reference/cli/team#cua-team-invite), [`join`](/cua-cli/reference/cli/team#cua-team-join), [`leave`](/cua-cli/reference/cli/team#cua-team-leave), [`remove-member`](/cua-cli/reference/cli/team#cua-team-remove-member), [`set-role`](/cua-cli/reference/cli/team#cua-team-set-role), [`devices`](/cua-cli/reference/cli/team#cua-team-devices), [`approve`](/cua-cli/reference/cli/team#cua-team-approve), [`deny`](/cua-cli/reference/cli/team#cua-team-deny), [`request`](/cua-cli/reference/cli/team#cua-team-request), [`add-machine`](/cua-cli/reference/cli/team#cua-team-add-machine), [`remove-machine`](/cua-cli/reference/cli/team#cua-team-remove-machine), [`audit`](/cua-cli/reference/cli/team#cua-team-audit), [`delete`](/cua-cli/reference/cli/team#cua-team-delete) |+| <span id="cua-team-create"></span><span id="cua-team-ls"></span><span id="cua-team-show"></span><span id="cua-team-invite"></span><span id="cua-team-join"></span><span id="cua-team-leave"></span><span id="cua-team-remove-member"></span><span id="cua-team-set-role"></span><span id="cua-team-devices"></span><span id="cua-team-approve"></span><span id="cua-team-deny"></span><span id="cua-team-request"></span><span id="cua-team-add-machine"></span><span id="cua-team-remove-machine"></span><span id="cua-team-audit"></span><span id="cua-team-delete"></span>[`cua team`](/cua-cli/reference/cli/team#cua-team) | Teams share machines with every member and their agents. | [`create`](/cua-cli/reference/cli/team#cua-team-create), [`ls`](/cua-cli/reference/cli/team#cua-team-ls), [`show`](/cua-cli/reference/cli/team#cua-team-show), [`invite`](/cua-cli/reference/cli/team#cua-team-invite), [`join`](/cua-cli/reference/cli/team#cua-team-join), [`leave`](/cua-cli/reference/cli/team#cua-team-leave), [`remove-member`](/cua-cli/reference/cli/team#cua-team-remove-member), [`set-role`](/cua-cli/reference/cli/team#cua-team-set-role), [`devices`](/cua-cli/reference/cli/team#cua-team-devices), [`approve`](/cua-cli/reference/cli/team#cua-team-approve), [`deny`](/cua-cli/reference/cli/team#cua-team-deny), [`request`](/cua-cli/reference/cli/team#cua-team-request), [`add-machine`](/cua-cli/reference/cli/team#cua-team-add-machine), [`remove-machine`](/cua-cli/reference/cli/team#cua-team-remove-machine), [`audit`](/cua-cli/reference/cli/team#cua-team-audit), [`delete`](/cua-cli/reference/cli/team#cua-team-delete) |### `cua usage`diff --git a/docs/content/docs/cua-cli/reference/cli/team.mdx b/docs/content/docs/cua-cli/reference/cli/team.mdxindex 55bfa12c9e..cd2d2e07e2 100644--- a/docs/content/docs/cua-cli/reference/cli/team.mdx+++ b/docs/content/docs/cua-cli/reference/cli/team.mdx@@ -1,6 +1,6 @@----title: "cua team (experimental)"-description: "Experimental, not available yet (needs `CUA_EXPERIMENTAL_TEAMS=1`): teams, their members, machines, device approvals and audit log."+title: "cua team"+description: "Teams, their members, machines, device approvals and audit log."---{/*@@ -33,7 +33,7 @@ Every command also accepts the [global options](/cua-cli/reference/cli#global-op<span id="cua-team"></span>-Experimental, not available yet (set CUA_EXPERIMENTAL_TEAMS=1): teams share machines with every member and their agents. Owners and admins invite (email or link), approve member devices, add machines and read the audit log.+Teams share machines with every member and their agents. Owners and admins invite (email or link), approve member devices, add machines and read the audit log.```text outputcua team [OPTIONS] <COMMAND>@@ -284,7 +284,7 @@ cua team request AIGIS## `cua team add-machine`-Make a Space (or a machine you host) a team machine: every member and their agents see it and can open it. macOS Spaces cannot.+Make a Space (or a machine you host) a team machine: every member and their agents see it and can open it. Macs, Linux and Windows machines all can.```text outputcua team add-machine [OPTIONS] <TEAM> <SPACE>diff --git a/docs/content/docs/cua-cli/reference/index.mdx b/docs/content/docs/cua-cli/reference/index.mdxindex 861cb9064c..7fcfea0186 100644--- a/docs/content/docs/cua-cli/reference/index.mdx+++ b/docs/content/docs/cua-cli/reference/index.mdx@@ -32,7 +32,7 @@ description: "Every cua command and every cua MCP tool, generated from the CLI d| [`cua cloud`](/cua-cli/reference/cli/cloud) | Your own AWS, Google Cloud or Modal account as a place for sandboxes and Spaces: connect, test, status, sweep. || [`cua host`](/cua-cli/reference/cli/host) | Set this machine up for unattended access. || [`cua devices`](/cua-cli/reference/cli/devices) | Enroll this device on the relay, approve, rename and revoke devices, and read the access log. |-| [`cua team (experimental)`](/cua-cli/reference/cli/team) | Experimental, not available yet (needs `CUA_EXPERIMENTAL_TEAMS=1`): teams, their members, machines, device approvals and audit log. |+| [`cua team`](/cua-cli/reference/cli/team) | Teams, their members, machines, device approvals and audit log. || [`cua usage`](/cua-cli/reference/cli/usage) | Your hosted relay allowance this month: live sessions and relay hours. || [`cua teleport`](/cua-cli/reference/cli/teleport) | Move a desktop app session into a sandbox. || [`cua volume`](/cua-cli/reference/cli/volume) | Cua Volume: files, versions, grants, access requests and audit of the volume every Space and agent shares. |diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdxindex 25af504860..75fecbc39f 100644--- a/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx+++ b/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx@@ -2395,8 +2395,6 @@ pub const DRIVER_ALIASES: [&str; 5] = _;pub const DRIVER_SERVICE: &str = "driver";// mod share-/// Why a macOS Space cannot be a team ...-pub const MACOS_TEAM_REFUSED: &str = /* ... */;/// Relay machine meta: the OS of the Space ...pub const META_SPACE_OS: &str = "cua.space.os";/// The spacesd feature a Space needs to be ...diff --git a/libs/cua/crates/cua-cli/src/host.rs b/libs/cua/crates/cua-cli/src/host.rsindex 2ad59d1ae7..8436c07a84 100644--- a/libs/cua/crates/cua-cli/src/host.rs+++ b/libs/cua/crates/cua-cli/src/host.rs@@ -102,8 +102,7 @@ pub enum HostCmd {cua host pair --listcua host pair --revoke pc_0123456789abcdef")]Pair {- /// Add the machine for this team (its id). Experimental: needs- /// CUA_EXPERIMENTAL_TEAMS=1.+ /// Add the machine for this team (its id).#[arg(long)]team: Option<String>,/// Name the machine gets (default: its own host name).diff --git a/libs/cua/crates/cua-cli/src/lib.rs b/libs/cua/crates/cua-cli/src/lib.rsindex ce5d1eab87..8b0298f20f 100644--- a/libs/cua/crates/cua-cli/src/lib.rs+++ b/libs/cua/crates/cua-cli/src/lib.rs@@ -232,8 +232,7 @@ enum Command {cua devices audit")]Devices(devices_cmd::DevicesCmd),- /// Experimental, not available yet (set CUA_EXPERIMENTAL_TEAMS=1):- /// teams share machines with every member and their agents. Owners+ /// Teams share machines with every member and their agents. Owners/// and admins invite (email or link), approve member devices, add/// machines and read the audit log.#[command(@@ -1297,8 +1296,8 @@ async fn env_at(async fn run(cli: Cli, out: &mut dyn Write) -> Result<i32, CuaError> {let json = cli.json;- // Teams are experimental: refused (before any sign-in, daemon or relay- // call) unless CUA_EXPERIMENTAL_TEAMS is set.+ // Teams turned off (CUA_EXPERIMENTAL_TEAMS=0): refused before any+ // sign-in, daemon or relay call.if uses_teams(&cli.command) && !cua_home::experimental::teams_enabled() {return Err(CuaError::InvalidArgument(cua_home::experimental::TEAMS_UNAVAILABLE.into(),diff --git a/libs/cua/crates/cua-cli/src/team_cmd.rs b/libs/cua/crates/cua-cli/src/team_cmd.rsindex fa19728ac7..562db6d0bf 100644--- a/libs/cua/crates/cua-cli/src/team_cmd.rs+++ b/libs/cua/crates/cua-cli/src/team_cmd.rs@@ -1,8 +1,7 @@//! `cua team …`: teams on the relay. A team shares machines with every//! member (and their agents); owners and admins invite by email or link,-//! remove members, add machines they own, approve each member device-//! before it opens team machines, and read the team's audit log. macOS-//! Spaces cannot be team machines (one user per macOS copy).+//! remove members, add machines they own (Mac, Linux or Windows), approve each member+//! device before it opens team machines, and read the team's audit log.//!//! Adding a Space is `cua team add-machine <team> <space>`, the same as//! `cua spaces share <space> team:<id>` (it attaches the Space to the relay@@ -131,7 +130,7 @@ pub enum TeamCmd {team: String,},/// Make a Space (or a machine you host) a team machine: every member- /// and their agents see it and can open it. macOS Spaces cannot.+ /// and their agents see it and can open it. Macs, Linux and Windows machines all can.#[command(after_help = "Examples:cua team add-machine AIGIS local:build-boxcua team add-machine AIGIS relay:0123abcd4567ef89 --yes")]diff --git a/libs/cua/crates/cua-cli/tests/experimental_teams.rs b/libs/cua/crates/cua-cli/tests/experimental_teams.rsindex ce463f0665..ee29650b08 100644--- a/libs/cua/crates/cua-cli/tests/experimental_teams.rs+++ b/libs/cua/crates/cua-cli/tests/experimental_teams.rs@@ -1,10 +1,10 @@-//! Teams are experimental: `cua team`, `cua host pair --team` and sharing-//! with `team:<id>` stay out of help and are refused unless-//! CUA_EXPERIMENTAL_TEAMS is set.+//! Teams are on by default; `CUA_EXPERIMENTAL_TEAMS=0` is the kill switch:+//! `cua team`, `cua host pair --team` and sharing with `team:<id>` then+//! stay out of help and are refused.use std::process::{Command, Output, Stdio};-const UNAVAILABLE: &str = "Teams isn't available yet.";+const UNAVAILABLE: &str = "Teams is turned off (CUA_EXPERIMENTAL_TEAMS=0).";fn cua(teams: Option<&str>, args: &[&str]) -> Output {let home = tempfile::tempdir().unwrap();@@ -37,8 +37,8 @@ fn lists_team(help: &str) -> bool {}#[test]-fn without_the_flag_teams_are_hidden_and_refused() {- for off in [None, Some("0")] {+fn with_the_kill_switch_teams_are_hidden_and_refused() {+ for off in [Some("0"), Some("false")] {let help = text(&cua(off, &["--help"]));assert!(help.contains("spaces"), "{help}");assert!(!lists_team(&help), "{help}");@@ -65,10 +65,12 @@ fn without_the_flag_teams_are_hidden_and_refused() {}#[test]-fn with_the_flag_teams_work_as_before() {- let help = text(&cua(Some("1"), &["--help"]));- assert!(lists_team(&help), "{help}");- assert!(text(&cua(Some("1"), &["host", "pair", "--help"])).contains("--team"));+fn by_default_teams_are_listed_and_pass_the_gate() {+ for on in [None, Some("1")] {+ let help = text(&cua(on, &["--help"]));+ assert!(lists_team(&help), "{help}");+ assert!(text(&cua(on, &["host", "pair", "--help"])).contains("--team"));+ }// Past the gate: they fail here only for want of a sign-in or relay.for args in [&["team", "ls"][..],@@ -81,7 +83,7 @@ fn with_the_flag_teams_work_as_before() {"--yes",][..],] {- let out = cua(Some("1"), args);+ let out = cua(None, args);assert!(!text(&out).contains(UNAVAILABLE),"{args:?}: {}",diff --git a/libs/cua/crates/cua-home/src/experimental.rs b/libs/cua/crates/cua-home/src/experimental.rsindex 3fd84a6db8..81599492eb 100644--- a/libs/cua/crates/cua-home/src/experimental.rs+++ b/libs/cua/crates/cua-home/src/experimental.rs@@ -1,18 +1,18 @@-//! Opt-in gates for features that are not customer-facing yet.+//! Feature gates.//!//! Teams (`cua team`, sharing with `team:<id>`, `cua host pair --team`) are-//! a stopgap stored in the relay until Teams move to the identity provider's-//! organizations and billing entitlements. They stay off unless-//! `CUA_EXPERIMENTAL_TEAMS` is set (to anything but `0`, `false` or empty),-//! for internal and staging use.+//! on by default. Who may use them is decided by the service: the Spaces API+//! (org membership and the Stripe Teams entitlement) and the relay refuse+//! anyone who is not entitled. `CUA_EXPERIMENTAL_TEAMS=0` (or `false`,+//! `off`, `no`) is a local kill switch that hides and refuses Teams.use std::sync::atomic::{AtomicU8, Ordering};-/// Environment variable that turns Teams on.+/// Environment variable that is the kill switch for Teams (`0` turns them off).pub const TEAMS_ENV: &str = "CUA_EXPERIMENTAL_TEAMS";/// What a Teams call says while Teams are off.-pub const TEAMS_UNAVAILABLE: &str = "Teams isn't available yet.";+pub const TEAMS_UNAVAILABLE: &str = "Teams is turned off (CUA_EXPERIMENTAL_TEAMS=0).";/// 0: follow the environment; 1: off; 2: on.static TEAMS_OVERRIDE: AtomicU8 = AtomicU8::new(0);@@ -39,11 +39,17 @@ pub fn set_teams_enabled(on: Option<bool>) {TEAMS_OVERRIDE.store(v, Ordering::Relaxed);}-/// Whether a flag value turns its feature on.+/// Whether a flag value leaves its feature on: unset or empty is on; `0`,+/// `false`, `off` and `no` are off.pub fn flag_on(value: Option<&str>) -> bool {match value.map(str::trim) {- None | Some("") | Some("0") => false,- Some(v) => !v.eq_ignore_ascii_case("false"),+ None | Some("") => true,+ Some(v) => {+ !(v == "0"+ || v.eq_ignore_ascii_case("false")+ || v.eq_ignore_ascii_case("off")+ || v.eq_ignore_ascii_case("no"))+ }}}@@ -52,18 +58,25 @@ mod tests {use super::flag_on;#[test]- fn only_a_set_non_false_value_turns_a_flag_on() {+ fn a_flag_is_on_unless_it_is_set_to_an_off_value() {for off in [- None,- Some(""),- Some(" "),Some("0"),+ Some(" 0 "),Some("false"),Some("FALSE"),+ Some("off"),+ Some("no"),] {assert!(!flag_on(off), "{off:?}");}- for on in [Some("1"), Some("true"), Some("yes")] {+ for on in [+ None,+ Some(""),+ Some(" "),+ Some("1"),+ Some("true"),+ Some("yes"),+ ] {assert!(flag_on(on), "{on:?}");}}diff --git a/libs/cua/crates/cua-host/src/pairing.rs b/libs/cua/crates/cua-host/src/pairing.rsindex 13820d21ce..9618dab177 100644--- a/libs/cua/crates/cua-host/src/pairing.rs+++ b/libs/cua/crates/cua-host/src/pairing.rs@@ -275,7 +275,10 @@ mod tests {..Default::default()};let err = check_pairing_team(&team, false).unwrap_err().to_string();- assert!(err.contains("Teams isn't available yet."), "{err}");+ assert!(+ err.contains("Teams is turned off (CUA_EXPERIMENTAL_TEAMS=0)."),+ "{err}"+ );check_pairing_team(&team, true).unwrap();check_pairing_team(&PairingCodeRequest::default(), false).unwrap();}diff --git a/libs/cua/crates/cua-host/src/team.rs b/libs/cua/crates/cua-host/src/team.rsindex 79d5415aec..bd50d90a6d 100644--- a/libs/cua/crates/cua-host/src/team.rs+++ b/libs/cua/crates/cua-host/src/team.rs@@ -1,9 +1,9 @@//! Teams on the relay: a named group of cua.ai accounts with roles//! (`owner`, `admin`, `member`) that shares machines with every member.//! Owners and admins invite (by email or link), remove members, add-//! machines they own, approve member devices (a member device opens team-//! machines only once approved) and read the team's audit log. macOS-//! Spaces cannot be team machines (one user per macOS copy).+//! machines they own (Mac, Linux or Windows), approve member devices (a+//! member device opens team machines only once approved) and read the+//! team's audit log.//!//! [`RelayClient`] has the raw calls (account token, from an enrolled//! device's session); [`DeviceAuth`] wraps them with this device's session.diff --git a/libs/cua/crates/cua-host/src/testing.rs b/libs/cua/crates/cua-host/src/testing.rsindex 7b3c3ac8b3..fc478c4d10 100644--- a/libs/cua/crates/cua-host/src/testing.rs+++ b/libs/cua/crates/cua-host/src/testing.rs@@ -1526,14 +1526,6 @@ async fn team_add_machine(if record.owner.id != who.id {return err(StatusCode::FORBIDDEN, "add a machine you own");}- let macos = body["os"].as_str() == Some("macos")- || record.meta.get("cua.space.os").map(String::as_str) == Some("macos");- if macos {- return err(- StatusCode::FORBIDDEN,- "macOS Spaces cannot be shared with a team: macOS licensing allows one user per macOS copy",- );- }let t = match require_team_manager(&mut st, &id, &who) {Ok(t) => t,Err(r) => return r,diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/share-sheet.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/share-sheet.jsonindex 940512e2a0..8e9416873d 100644--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/share-sheet.json+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/share-sheet.json@@ -213,7 +213,7 @@"disabled": null,"empty": "Only you","error": null,- "field": "Email or account ID [team:design] Teams isn't available yet. Share with people, one at a time. as editor",+ "field": "Email or account ID [team:design] Enter a team as team:<id>, as `cua team ls` shows it. as editor","request": null,"roles": "viewer=Can view, editor=Can edit","rows": [],diff --git a/libs/cua/crates/cua-spaces-app-core/src/share.rs b/libs/cua/crates/cua-spaces-app-core/src/share.rsindex 177b2b5156..3d15455c4f 100644--- a/libs/cua/crates/cua-spaces-app-core/src/share.rs+++ b/libs/cua/crates/cua-spaces-app-core/src/share.rs@@ -448,8 +448,8 @@ mod tests {}#[test]- fn teams_are_shared_with_only_while_teams_are_on() {- // On (CUA_EXPERIMENTAL_TEAMS=1): a team id, always for full use.+ fn teams_are_shared_with_unless_turned_off() {+ // On (the default): a team id, always for full use.assert_eq!(validate_who_with("team:design", true).unwrap_err(),"Enter a team as team:<id>, as `cua team ls` shows it."@@ -459,11 +459,11 @@ mod tests {"team:team-0a1b");assert_eq!(role_for("team:team-0a1b", "viewer"), "editor");- // Off: refused, whatever the id.+ // Off (CUA_EXPERIMENTAL_TEAMS=0): refused, whatever the id.for who in ["team:team-0a1b", "team:design", "org:acme"] {assert_eq!(validate_who_with(who, false).unwrap_err(),- "Teams isn't available yet. Share with people, one at a time."+ "Teams is turned off (CUA_EXPERIMENTAL_TEAMS=0). Share with people, one at a time.");}assert_eq!(diff --git a/libs/cua/crates/cua-spaces/src/share.rs b/libs/cua/crates/cua-spaces/src/share.rsindex 5d688f467e..ea53575ada 100644--- a/libs/cua/crates/cua-spaces/src/share.rs+++ b/libs/cua/crates/cua-spaces/src/share.rs@@ -179,7 +179,7 @@ pub fn normalize_who(who: &str) -> Result<String> {/// Sharing with a team makes the Space a team machine: every member (and/// their agents) sees it and opens it as an editor from a device a team/// admin approved.-/// Teams are experimental: with them off ([`cua_home::experimental`]) a+/// With Teams turned off ([`cua_home::experimental`]) a/// `team:<id>` invitee is refused.pub fn team_of(who: &str) -> Option<Result<String>> {team_of_with(who, cua_home::experimental::teams_enabled())@@ -207,9 +207,6 @@ fn team_of_with(who: &str, teams: bool) -> Option<Result<String>> {})}-/// Why a macOS Space cannot be a team machine.-pub const MACOS_TEAM_REFUSED: &str = "macOS Spaces cannot be shared with a team: macOS licensing allows one user per macOS copy. Share a Linux or Windows Space, or a whole Mac set up with `cua host setup`";-/// Moves `who` onto the list for `role` (or off both with `None`).pub fn apply_share(allow: &mut Vec<String>,@@ -577,8 +574,8 @@ impl Spaces {/// Makes `space` a machine of `team`: every member (and their agents)/// lists it and opens it as an editor, from a device a team admin- /// approved. Only a team owner or admin who owns the Space can; a macOS- /// Space never can (one user per macOS copy).+ /// approved. Only a team owner or admin who owns the Space can. Macs, Linux and+ /// Windows machines can all be team machines.pub async fn share_with_team(&self, space: &str, team: &str) -> Result<SpaceShares> {let id = self.resolve(space)?;let canonical = id.to_string();@@ -590,15 +587,6 @@ impl Spaces {.find(|i| i.id == canonical).map(|i| i.os).filter(|o| !o.is_empty());- if !matches!(id, SpaceId::Relay { .. })- && os- .as_deref()- .is_some_and(|o| o.eq_ignore_ascii_case("macos"))- {- return Err(Error::Relay(cua_host::Error::PermissionDenied(- MACOS_TEAM_REFUSED.into(),- )));- }self.confirm_share(format!("Let every member of team {team} use {canonical} (see and control it)"))@@ -842,7 +830,10 @@ mod tests {.unwrap().unwrap_err().to_string();- assert!(e.contains("Teams isn't available yet."), "{e}");+ assert!(+ e.contains("Teams is turned off (CUA_EXPERIMENTAL_TEAMS=0)."),+ "{e}"+ );}#[test]diff --git a/libs/cua/crates/cua-spaces/tests/share.rs b/libs/cua/crates/cua-spaces/tests/share.rsindex d870fc66a0..0b1b81655c 100644--- a/libs/cua/crates/cua-spaces/tests/share.rs+++ b/libs/cua/crates/cua-spaces/tests/share.rs@@ -687,12 +687,12 @@ async fn only_the_owner_removes_a_relay_record() {}/// `team:<id>` makes a Space a team machine (attaching it first, with the-/// user's confirmation and the Space's OS on its relay record); a macOS-/// Space never becomes one (one user per macOS copy); `unshare team:<id>`+/// user's confirmation and the Space's OS on its relay record); a Mac+/// can be one too (Macs, Linux and Windows machines all can); `unshare team:<id>`/// takes it off.#[tokio::test]-async fn sharing_with_a_team_adds_a_team_machine_and_refuses_macos() {- // Teams are experimental (off unless CUA_EXPERIMENTAL_TEAMS is set).+async fn sharing_with_a_team_adds_a_team_machine_including_a_mac() {+ // Teams are on by default; pin them on regardless of the environment.cua_home::experimental::set_teams_enabled(Some(true));let relay = FakeRelay::start().await;relay.add_account("ada-token", "ada", Some("[email protected]"));@@ -780,7 +780,7 @@ async fn sharing_with_a_team_adds_a_team_machine_and_refuses_macos() {.is_empty());- // A macOS Space is refused before anything reaches the relay.+ // A Mac can be a team machine like any other.let mac = MockServer::start(MockAuth::default()).await;mac.state.advertise(&["relay_attach"]);*mac.state.os.lock().unwrap() = Some(Some(cua_proto::env::v1::OperatingSystem {@@ -792,16 +792,32 @@ async fn sharing_with_a_team_adds_a_team_machine_and_refuses_macos() {.add(&mac.url(), None, Some("mac".into())).await.unwrap();- let e = spaces+ let mac_state = mac.state.clone();+ let mac_online = tokio::spawn({+ let relay = relay.clone();+ async move {+ for _ in 0..400 {+ if let Some(a) = mac_state.relay_attached.lock().unwrap().clone() {+ relay.set_online(&a.machine_id, true, "0.1.0");+ return a;+ }+ tokio::time::sleep(std::time::Duration::from_millis(10)).await;+ }+ panic!("never attached");+ }+ });+ spaces.share_space(&mac_info.id,&format!("team:{}", team.id),ShareRole::Editor,).await- .unwrap_err();- assert!(e.to_string().contains("one user per macOS copy"), "{e}");- assert!(mac.state.relay_attached.lock().unwrap().is_none());+ .unwrap();+ let mac_attached = mac_online.await.unwrap();+ let t = client.team("ada-token", &team.id).await.unwrap();+ assert_eq!(t.machines.len(), 1);+ assert_eq!(t.machines[0].id, mac_attached.machine_id);// Not a team id.let e = spacesdiff --git a/scripts/docs-generators/cli-specs/cua.json b/scripts/docs-generators/cli-specs/cua.jsonindex 13d70f625f..5a801a70e2 100644--- a/scripts/docs-generators/cli-specs/cua.json+++ b/scripts/docs-generators/cli-specs/cua.json@@ -9515,7 +9515,7 @@"aliases": [],"default_value": null,"env": null,- "help": "Add the machine for this team (its id). Experimental: needs CUA_EXPERIMENTAL_TEAMS=1",+ "help": "Add the machine for this team (its id)","hidden": false,"is_optional": true,"multiple_values": false,@@ -11270,7 +11270,7 @@"usage": "cua devices [OPTIONS] <COMMAND>"},{- "abstract": "Experimental, not available yet (set CUA_EXPERIMENTAL_TEAMS=1): teams share machines with every member and their agents. Owners and admins invite (email or link), approve member devices, add machines and read the audit log",+ "abstract": "Teams share machines with every member and their agents. Owners and admins invite (email or link), approve member devices, add machines and read the audit log","after_help": "Examples:\n cua team create AIGIS\n cua team invite AIGIS [email protected]\n cua team add-machine AIGIS local:build-box\n cua team approve AIGIS dev_0123456789abcdef01234567\n cua team audit AIGIS","aliases": [],"arguments": [],@@ -11685,7 +11685,7 @@"usage": "cua team request [OPTIONS] <TEAM>"},{- "abstract": "Make a Space (or a machine you host) a team machine: every member and their agents see it and can open it. macOS Spaces cannot",+ "abstract": "Make a Space (or a machine you host) a team machine: every member and their agents see it and can open it. Macs, Linux and Windows machines all can","after_help": "Examples:\n cua team add-machine AIGIS local:build-box\n cua team add-machine AIGIS relay:0123abcd4567ef89 --yes","aliases": [],"arguments": [diff --git a/scripts/docs-generators/cua-cli.ts b/scripts/docs-generators/cua-cli.tsindex 94d6676524..096a16d7ef 100644--- a/scripts/docs-generators/cua-cli.ts+++ b/scripts/docs-generators/cua-cli.ts@@ -121,7 +121,7 @@ export const CLI_GROUPS: CliGroup[] = [{ slug: 'cloud', title: 'cua cloud', summary: 'Your own AWS, Google Cloud or Modal account as a place for sandboxes and Spaces: connect, test, status, sweep', commands: ['cloud'] },{ slug: 'host', title: 'cua host', summary: 'Set this machine up for unattended access', commands: ['host'] },{ slug: 'devices', title: 'cua devices', summary: 'Enroll this device on the relay, approve, rename and revoke devices, and read the access log', commands: ['devices'] },- { slug: 'team', title: 'cua team (experimental)', summary: 'Experimental, not available yet (needs `CUA_EXPERIMENTAL_TEAMS=1`): teams, their members, machines, device approvals and audit log', commands: ['team'] },+ { slug: 'team', title: 'cua team', summary: 'Teams, their members, machines, device approvals and audit log', commands: ['team'] },{ slug: 'usage', title: 'cua usage', summary: 'Your hosted relay allowance this month: live sessions and relay hours', commands: ['usage'] },{ slug: 'teleport', title: 'cua teleport', summary: 'Move a desktop app session into a sandbox', commands: ['teleport'] },{ slug: 'volume', title: 'cua volume', summary: 'Cua Volume: files, versions, grants, access requests and audit of the volume every Space and agent shares', commands: ['volume'] },