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.

spaces: pairing links use cua.ai/add/<code> (CUA-1497) (#5210)

Francesco Bonaccia52cf881e01e
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
index 070ad110f4..3ff2f8d3ef 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
@@ -11007,7 +11007,7 @@ export type PairingCode = {
*/
code?: string,
/**
- * `https://spaces.cua.ai/add/<code>` (the link and the QR code): only
+ * `https://cua.ai/add/<code>` (the link and the QR code): only
* when just made.
*/
url?: string,
diff --git a/apps/cua-spaces-desktop/test/host-fixtures.ts b/apps/cua-spaces-desktop/test/host-fixtures.ts
index e7f465e4f2..5c1e3a06cc 100644
--- a/apps/cua-spaces-desktop/test/host-fixtures.ts
+++ b/apps/cua-spaces-desktop/test/host-fixtures.ts
@@ -245,7 +245,7 @@ export class FixtureDevices {
const made: PairingCode = {
id: `pc_fixture${n}`,
code,
- url: `https://spaces.cua.ai/add/${code}`,
+ url: `https://cua.ai/add/${code}`,
installSh: `curl -fsSL https://cua.ai/install.sh | sh -s -- --pair ${code}`,
installPowershell: `& ([scriptblock]::Create((irm https://cua.ai/install.ps1))) -Pair ${code}`,
state: "active",
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
index ee9d0bda5b..4ad3ffacdb 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/DevicesModel.swift
@@ -194,7 +194,7 @@ public final class FixtureDevices: DevicesRunning, @unchecked Sendable {
let now = UInt64(Date().timeIntervalSince1970)
let code = "K7QM-4XPB-\(String(format: "%04d", pairing.count + 1))"
let made = PairingCode(
- id: "pc_fixture\(pairing.count + 1)", code: code, url: "https://spaces.cua.ai/add/\(code)",
+ id: "pc_fixture\(pairing.count + 1)", code: code, url: "https://cua.ai/add/\(code)",
installSh: "curl -fsSL https://cua.ai/install.sh | sh -s -- --pair \(code)",
installPowershell: "& ([scriptblock]::Create((irm https://cua.ai/install.ps1))) -Pair \(code)",
state: "active", team: team, createdAt: now, expiresAt: now + 1800, usedAt: nil, machine: nil)
diff --git a/apps/cua-spaces-web/src/bridge/adapters/demo/settings.ts b/apps/cua-spaces-web/src/bridge/adapters/demo/settings.ts
index c9c1a6c504..6a1aaa9666 100644
--- a/apps/cua-spaces-web/src/bridge/adapters/demo/settings.ts
+++ b/apps/cua-spaces-web/src/bridge/adapters/demo/settings.ts
@@ -263,7 +263,7 @@ export function createDemoSettings(ctx: DemoSettingsContext): Handlers {
const made: PairingCode = {
id: `pc_demo${pairingSeq}`,
code,
- url: `https://spaces.cua.ai/add/${code}`,
+ url: `https://cua.ai/add/${code}`,
installSh: `curl -fsSL https://cua.ai/install.sh | sh -s -- --pair ${code}`,
installPowershell: `& ([scriptblock]::Create((irm https://cua.ai/install.ps1))) -Pair ${code}`,
state: "active",
diff --git a/apps/cua-spaces-web/src/bridge/contracts/devices.ts b/apps/cua-spaces-web/src/bridge/contracts/devices.ts
index 5e2bf48034..5986eb49b7 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/devices.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/devices.ts
@@ -63,7 +63,7 @@ export interface PairingCode {
id: string;
/** `XXXX-XXXX-XXXX`. */
code: string | null;
- /** `https://spaces.cua.ai/add/<code>`: the link and the QR code. */
+ /** `https://cua.ai/add/<code>`: the link and the QR code. */
url: string | null;
/** The macOS and Linux one-liner. */
installSh: string | null;
diff --git a/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx b/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx
index d1d1836ff5..b349fa3c5d 100644
--- a/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx
+++ b/apps/cua-spaces-web/src/components/__tests__/add-machine-dialog.test.tsx
@@ -60,7 +60,7 @@ describe("Add a machine by link or QR code", () => {
await waitFor(() => expect(phase()).toBe("ready"));
expect(calls[0]).toBe("devices.createPairingCode");
expect(document.querySelector("[data-pairing-qr] path")?.getAttribute("d")).toMatch(/^M\d/);
- expect(screen.getByText(/^https:\/\/spaces\.cua\.ai\/add\/K7QM-4XPB-/)).toBeTruthy();
+ expect(screen.getByText(/^https:\/\/cua\.ai\/add\/K7QM-4XPB-/)).toBeTruthy();
expect(screen.getByText(/sh -s -- --pair K7QM-4XPB-/)).toBeTruthy();
expect(screen.getByText("Waiting for the computer…")).toBeTruthy();
expect(document.querySelector("[data-pairing-expires]")?.textContent).toBe("Works once. Expires in 30 min");
diff --git a/apps/cua-spaces/src/native/devices.ts b/apps/cua-spaces/src/native/devices.ts
index d384ef7d54..9e0b0fa842 100644
--- a/apps/cua-spaces/src/native/devices.ts
+++ b/apps/cua-spaces/src/native/devices.ts
@@ -156,7 +156,7 @@ export function createFakeDevicesBridge(
const made: PairingCode = {
id: `pc_fake${pairing.length + 1}`,
code,
- url: `https://spaces.cua.ai/add/${code}`,
+ url: `https://cua.ai/add/${code}`,
installSh: `curl -fsSL https://cua.ai/install.sh | sh -s -- --pair ${code}`,
installPowershell: `& ([scriptblock]::Create((irm https://cua.ai/install.ps1))) -Pair ${code}`,
state: "active",
diff --git a/docs/content/docs/cua-sdk/reference/spaces/host.mdx b/docs/content/docs/cua-sdk/reference/spaces/host.mdx
index 8050ed3ef7..cfab80525e 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/host.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/host.mdx
@@ -895,7 +895,7 @@ Returned by [`Devices.create_pairing_code`](/cua-sdk/reference/spaces/devices#de
| --- | --- | --- | --- |
| `id` | `String` | | `pc_…` (to revoke it). |
| `code` | `Option<String>` | | `XXXX-XXXX-XXXX`: only when just made. |
-| `url` | `Option<String>` | | `https://spaces.cua.ai/add/<code>` (the link and the QR code): only when just made. |
+| `url` | `Option<String>` | | `https://cua.ai/add/<code>` (the link and the QR code): only when just made. |
| `install_sh` / `installSh` | `Option<String>` | | `curl … \| sh -s -- --pair <code>` (macOS, Linux): only when just made. |
| `install_powershell` / `installPowershell` | `Option<String>` | | The PowerShell one-liner (Windows): only when just made. |
| `state` | `String` | | `active`, `used`, `revoked` or `expired`. |
diff --git a/libs/cua/crates/cua-cli/tests/host_setup.rs b/libs/cua/crates/cua-cli/tests/host_setup.rs
index 7e179518e4..125dfdec4f 100644
--- a/libs/cua/crates/cua-cli/tests/host_setup.rs
+++ b/libs/cua/crates/cua-cli/tests/host_setup.rs
@@ -254,7 +254,7 @@ async fn pair_never_signs_in_and_keeps_the_code_when_the_download_fails() {
// A pasted link works as well as the typed code (any case). The driver
// is installed before the code is used, so a failed download spends
// nothing: the relay is never asked.
- let o = setup(&h, &["--pair", "https://spaces.cua.ai/add/k7qm-4xpb-2rhd"]).await;
+ let o = setup(&h, &["--pair", "https://cua.ai/add/k7qm-4xpb-2rhd"]).await;
assert_eq!(o.code, 2, "{o:?}");
assert!(o.stderr.contains("host setup failed at download:"), "{o:?}");
assert!(!o.stderr.contains("Sign in"), "{o:?}");
diff --git a/libs/cua/crates/cua-home/src/env.rs b/libs/cua/crates/cua-home/src/env.rs
index de74b1f88c..237a5363c9 100644
--- a/libs/cua/crates/cua-home/src/env.rs
+++ b/libs/cua/crates/cua-home/src/env.rs
@@ -11,7 +11,7 @@
//! | Relay | `CUA_RELAY_URL` | `https://relay.cua.ai` | `https://relay.staging.cua.ai` |
//! | Spaces API | `CUA_SPACES_API_URL` | `https://api.cua.ai` | `https://api.staging.cua.ai` |
//! | Account app | `CUA_ACCOUNT_APP_URL` | `https://app.cua.ai` | `https://app.staging.cua.ai` |
-//! | Spaces site | `CUA_SPACES_SITE_URL` | `https://spaces.cua.ai` | `https://spaces.staging.cua.ai` |
+//! | Spaces site | `CUA_SPACES_SITE_URL` | `https://cua.ai` | `https://spaces.staging.cua.ai` |
//! | cua home | `CUA_HOME` | `~/.cua` | `~/.cua/envs/staging` |
//!
//! A per-setting override always wins over `CUA_ENV`. With `CUA_ENV` unset,
@@ -125,7 +125,7 @@ impl CuaEnv {
/// The default Spaces site (pairing links are `<site>/add/<code>`).
pub fn spaces_site_url(self) -> &'static str {
match self {
- Self::Prod => "https://spaces.cua.ai",
+ Self::Prod => "https://cua.ai",
Self::Staging => "https://spaces.staging.cua.ai",
}
}
@@ -277,7 +277,7 @@ mod tests {
assert_eq!(e.relay_url, "https://relay.cua.ai");
assert_eq!(e.spaces_api_url, "https://api.cua.ai");
assert_eq!(e.account_app_url, "https://app.cua.ai");
- assert_eq!(e.spaces_site_url, "https://spaces.cua.ai");
+ assert_eq!(e.spaces_site_url, "https://cua.ai");
assert_eq!(CuaEnv::Prod.keyring_service(), "run.cua.ai");
assert_eq!(CuaEnv::Prod.home_subdir(), None);
// An unknown value never selects staging.
diff --git a/libs/cua/crates/cua-host/src/pairing.rs b/libs/cua/crates/cua-host/src/pairing.rs
index a0ca79ac84..8f59979224 100644
--- a/libs/cua/crates/cua-host/src/pairing.rs
+++ b/libs/cua/crates/cua-host/src/pairing.rs
@@ -24,7 +24,7 @@ pub const PAIRING_TOKEN_PREFIX: &str = "cpc_";
/// Characters of a code.
pub const PAIRING_CODE_LEN: usize = 12;
/// Where an add-machine link opens in production.
-pub const ADD_MACHINE_BASE_URL: &str = "https://spaces.cua.ai/add";
+pub const ADD_MACHINE_BASE_URL: &str = "https://cua.ai/add";
/// Where an add-machine link opens: `<Spaces site>/add`, the site of
/// `CUA_SPACES_SITE_URL` or `CUA_ENV` ([`ADD_MACHINE_BASE_URL`] in
@@ -80,7 +80,7 @@ pub fn display_pairing_code(code: &str) -> String {
}
/// The add-machine link for `code`: `<add_machine_base_url>/<code>`
-/// (`https://spaces.cua.ai/add/<code>` in production), plus `?relay=<url>`
+/// (`https://cua.ai/add/<code>` in production), plus `?relay=<url>`
/// when the machine must join another relay than the production
/// [`DEFAULT_RELAY_URL`] (a staging relay is always named, since the
/// machine being added has no `CUA_ENV`).
@@ -349,6 +349,11 @@ mod tests {
normalize_pairing_code("k7qm-4xpb-2rhd").as_deref(),
Some("K7QM4XPB2RHD")
);
+ assert_eq!(
+ normalize_pairing_code("https://cua.ai/add/K7QM-4XPB-2RHD?relay=x").as_deref(),
+ Some("K7QM4XPB2RHD")
+ );
+ // Links printed by older apps keep working.
assert_eq!(
normalize_pairing_code("https://spaces.cua.ai/add/K7QM-4XPB-2RHD?relay=x").as_deref(),
Some("K7QM4XPB2RHD")
@@ -365,7 +370,7 @@ mod tests {
}
assert_eq!(
pairing_link_relay(
- "https://spaces.cua.ai/add/K7QM-4XPB-2RHD?relay=https%3A%2F%2Fr.example"
+ "https://cua.ai/add/K7QM-4XPB-2RHD?relay=https%3A%2F%2Fr.example"
)
.as_deref(),
Some("https://r.example")
@@ -378,11 +383,11 @@ mod tests {
fn links_and_commands_carry_a_custom_relay_only() {
assert_eq!(
add_machine_url("k7qm4xpb2rhd", DEFAULT_RELAY_URL),
- "https://spaces.cua.ai/add/K7QM-4XPB-2RHD"
+ "https://cua.ai/add/K7QM-4XPB-2RHD"
);
assert_eq!(
add_machine_url("K7QM4XPB2RHD", "https://relay.example.com/"),
- "https://spaces.cua.ai/add/K7QM-4XPB-2RHD?relay=https%3A%2F%2Frelay.example.com"
+ "https://cua.ai/add/K7QM-4XPB-2RHD?relay=https%3A%2F%2Frelay.example.com"
);
assert_eq!(
install_command("K7QM4XPB2RHD", DEFAULT_RELAY_URL, "linux"),
diff --git a/libs/cua/crates/cua-sdk/src/native/host.rs b/libs/cua/crates/cua-sdk/src/native/host.rs
index a1fe2dd1e5..fb8849a8dc 100644
--- a/libs/cua/crates/cua-sdk/src/native/host.rs
+++ b/libs/cua/crates/cua-sdk/src/native/host.rs
@@ -112,7 +112,7 @@ pub struct PairingCode {
pub id: String,
/// `XXXX-XXXX-XXXX`: only when just made.
pub code: Option<String>,
- /// `https://spaces.cua.ai/add/<code>` (the link and the QR code): only
+ /// `https://cua.ai/add/<code>` (the link and the QR code): only
/// when just made.
pub url: Option<String>,
/// `curl … | sh -s -- --pair <code>` (macOS, Linux): only when just made.
diff --git a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
index fd1de534ca..b2db44139a 100644
--- a/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
+++ b/libs/cua/kotlin/src/main/kotlin/ai/cua/sdk/cua_sdk.kt
@@ -31619,7 +31619,7 @@ data class PairingCode (
var `code`: kotlin.String?
,
/**
- * `https://spaces.cua.ai/add/<code>` (the link and the QR code): only
+ * `https://cua.ai/add/<code>` (the link and the QR code): only
* when just made.
*/
var `url`: kotlin.String?
diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
index ba70719285..ef7c01d13b 100644
--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
@@ -24756,7 +24756,7 @@ public struct PairingCode: Equatable, Hashable {
*/
public var code: String?
/**
- * `https://spaces.cua.ai/add/<code>` (the link and the QR code): only
+ * `https://cua.ai/add/<code>` (the link and the QR code): only
* when just made.
*/
public var url: String?
@@ -24803,7 +24803,7 @@ public struct PairingCode: Equatable, Hashable {
* `XXXX-XXXX-XXXX`: only when just made.
*/code: String?,
/**
- * `https://spaces.cua.ai/add/<code>` (the link and the QR code): only
+ * `https://cua.ai/add/<code>` (the link and the QR code): only
* when just made.
*/url: String?,
/**
diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.ts
index b469f13448..8260aabbea 100644
--- a/libs/cua/typescript/src/native/cua_sdk.ts
+++ b/libs/cua/typescript/src/native/cua_sdk.ts
@@ -11001,7 +11001,7 @@ export type PairingCode = {
*/
code?: string,
/**
- * `https://spaces.cua.ai/add/<code>` (the link and the QR code): only
+ * `https://cua.ai/add/<code>` (the link and the QR code): only
* when just made.
*/
url?: string,