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.

Relay: fix 'isn't not in your team'; Teams docs: checkout is 1 seat, invites add seats (CUA-2836, CUA-2838) (#6166)

cua-agents[bot]54e632c96751
diff --git a/docs/content/docs/spaces/guides/teams.mdx b/docs/content/docs/spaces/guides/teams.mdx
index 67b7536d4a..3dc5000860 100644
--- a/docs/content/docs/spaces/guides/teams.mdx
+++ b/docs/content/docs/spaces/guides/teams.mdx
@@ -73,13 +73,14 @@ before it can reach a team computer.
Create a team, invite a teammate and add a computer for the team (29 seconds, no sound).
</VideoDemo>
-Teams starts at 1 seat, so you can begin with just yourself and add seats as
-people join. Two seats give 10 live sessions and 400 remote hours a month for the
+Teams starts with 1 seat, for you. Start with just yourself, then add a seat for
+each teammate when you invite them. Two seats give 10 live sessions and 400 remote hours a month for the
whole team.
1. Open [app.cua.ai/buy/teams](https://app.cua.ai/buy/teams) and sign in or
create a Cua account.
-2. Name your team and choose the number of seats and monthly or yearly billing.
+2. Name your team and choose monthly or yearly billing. Checkout is for 1 seat;
+ you add seats later, as you invite people.
3. Pay with Stripe Checkout. Teams is for business use: Stripe asks for your
company name and address, and you can add your company's VAT or GST ID.
@@ -95,9 +96,10 @@ Teams are invitation only. Enter an email address and choose a role. The person
gets an email, signs in with that address and joins. Invitees do not pay and do
not see checkout.
-- Members plus pending invitations cannot exceed the seats you pay for, and you
- take one seat yourself. On a 1-seat team, the Team page shows **Add seats**
- before your first invite. It opens Stripe, where you raise the quantity (see
+- Each member and each pending invitation takes a seat, and you take one
+ yourself. When every seat is taken, as on a new 1-seat team, inviting someone
+ adds a seat: the Team page shows the price, for example "This adds 1 seat,
+ $30/month, prorated today", and charges only after you confirm (see
[Seats and billing](#seats-and-billing)).
- Until the first payment completes, a new team can invite up to 5 people.
- Revoke a pending invitation from the same page.
@@ -236,6 +238,8 @@ Seats, the monthly or yearly period, the card and invoices are managed in the
Stripe billing portal: [app.cua.ai/billing](https://app.cua.ai/billing), then
**Manage billing**. Only the owner buys and changes the plan.
+- **Invite into a full team:** the Team page adds a seat for you after you
+ confirm the price. The owner and admins can do this.
- **Add seats:** you pay a prorated amount for the rest of the current period,
added to your next invoice. The maximum is 100 seats.
- **Remove seats:** you get a prorated credit on future invoices. Credits are not
diff --git a/libs/cua-spacesd/crates/cua-relay/src/team_sharing.rs b/libs/cua-spacesd/crates/cua-relay/src/team_sharing.rs
index 23757c80d6..217c42ef74 100644
--- a/libs/cua-spacesd/crates/cua-relay/src/team_sharing.rs
+++ b/libs/cua-spacesd/crates/cua-relay/src/team_sharing.rs
@@ -179,13 +179,7 @@ pub(crate) async fn check_added_shares(
Ok(Err(crate::org_access::ShareRefusal::OutsideTeam(who))) => Err(error_code(
StatusCode::FORBIDDEN,
"share_outside_team",
- format!(
- "{} not in your team. Invite them to your team first.",
- match who.as_slice() {
- [one] => format!("{one} isn't"),
- many => format!("{} aren't", many.join(", ")),
- }
- ),
+ outside_team_message(&who),
)),
Err(e) => {
tracing::warn!(machine = %id, error = %e, "share refused: the Spaces API is unavailable");
@@ -199,6 +193,20 @@ pub(crate) async fn check_added_shares(
}
/// The newly shared names in `patch`: not in `before`, any case.
+/// What a share with people outside the team says (CUA-2836). Matches the
+/// apps' words: "[email protected] isn't in your team. Invite them to your team
+/// first."
+fn outside_team_message(who: &[String]) -> String {
+ match who {
+ [one] => format!("{one} isn't in your team. Invite them to your team first."),
+ [] => "That person isn't in your team. Invite them to your team first.".into(),
+ many => format!(
+ "{} aren't in your team. Invite them to your team first.",
+ many.join(", ")
+ ),
+ }
+}
+
fn added_shares(before: &MachineRecord, patch: &MachinePatch) -> Vec<String> {
let known = |n: &String| {
before
@@ -241,3 +249,21 @@ fn audit_sweep(relay: &Relay, record: &MachineRecord, removed: &[String]) {
);
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::outside_team_message;
+
+ #[test]
+ fn outside_team_message_has_no_double_negative() {
+ assert_eq!(
+ outside_team_message(&["[email protected]".into()]),
+ "[email protected] isn't in your team. Invite them to your team first."
+ );
+ assert_eq!(
+ outside_team_message(&["[email protected]".into(), "[email protected]".into()]),
+ "[email protected], [email protected] aren't in your team. Invite them to your team first."
+ );
+ assert!(!outside_team_message(&[]).contains("not in"));
+ }
+}