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.

Rust CLI: drop run.cua.ai dependencies (Fleets shutdown) (#5089)

Francesco Bonaccia59479ad0d0c
diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-fleet.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-fleet.mdx
index e244bff0df..2264cce6fa 100644
--- a/docs/content/docs/cua-sdk/reference/rust/cua-fleet.mdx
+++ b/docs/content/docs/cua-sdk/reference/rust/cua-fleet.mdx
@@ -825,7 +825,7 @@ pub fn parse_memory_mib(q: &str) -> Option<u32>
pub const CLOUD_DEFAULT_RANGE_CPUS: RangeInclusive<u32> = _;
/// The everyday memory range of a cloud ...
pub const CLOUD_DEFAULT_RANGE_MEMORY_MB: RangeInclusive<u32> = _;
-/// Default Fleet API endpoint ...
+/// Legacy Fleet API endpoint ...
pub const DEFAULT_FLEET_BASE_URL: &str = "https://run.cua.ai";
/// Poll interval cua-sandbox uses for ...
pub const DEFAULT_POLL_INTERVAL_MS: u64 = 2000;
diff --git a/libs/cua/crates/cua-cli/src/auth.rs b/libs/cua/crates/cua-cli/src/auth.rs
index 5fa1521410..3685d8cffb 100644
--- a/libs/cua/crates/cua-cli/src/auth.rs
+++ b/libs/cua/crates/cua-cli/src/auth.rs
@@ -213,7 +213,7 @@ pub async fn login(opts: &LoginOptions, out: &mut dyn Write) -> Result<i32, CuaE
(Some(u), _) | (None, Some(u)) => format!(" as {u}"),
_ => String::new(),
};
- line(out, format!("Logged in to run.cua.ai{who}."));
+ line(out, format!("Logged in to Cua{who}."));
Ok(0)
}
@@ -274,15 +274,12 @@ pub async fn status(json: bool, out: &mut dyn Write) -> Result<i32, CuaError> {
if c.expires().map_err(auth_err)? <= chrono::Utc::now() {
line(
out,
- "Logged in; access token expired and will refresh on the next run.cua.ai request.",
+ "Logged in; access token expired and will refresh on the next request.",
);
} else {
line(
out,
- format!(
- "Logged in to run.cua.ai. Access token expires {}.",
- c.expires_at
- ),
+ format!("Logged in to Cua. Access token expires {}.", c.expires_at),
);
}
Ok(0)
diff --git a/libs/cua/crates/cua-cli/tests/agents_login.rs b/libs/cua/crates/cua-cli/tests/agents_login.rs
index 1f313a2870..45d9f5abe9 100644
--- a/libs/cua/crates/cua-cli/tests/agents_login.rs
+++ b/libs/cua/crates/cua-cli/tests/agents_login.rs
@@ -174,7 +174,7 @@ async fn browser_pkce_login_then_onboards_the_named_agents() {
}
assert!(status.success(), "{seen}");
assert!(
- seen.contains("Logged in to run.cua.ai as tester ([email protected])."),
+ seen.contains("Logged in to Cua as tester ([email protected])."),
"{seen}"
);
assert!(
@@ -210,10 +210,7 @@ async fn login_falls_back_to_device_when_loopback_is_not_allowed_and_remote_skip
o.ok();
assert!(o.stdout.contains("using a device code instead"), "{o:?}");
assert!(o.stdout.contains("WXYZ-1234"), "{o:?}");
- assert!(
- o.stdout.contains("Logged in to run.cua.ai as tester"),
- "{o:?}"
- );
+ assert!(o.stdout.contains("Logged in to Cua as tester"), "{o:?}");
// Non-interactive with no --agents: no onboarding.
assert!(!o.stdout.contains("AI coding agents"), "{o:?}");
assert!(log.lock().unwrap().challenge.is_some(), "the preflight ran");
@@ -634,7 +631,7 @@ async fn interactive_login_onboarding_prompts() {
tokio::task::spawn_blocking(move || {
// Yes to onboarding, default (yes) to skills, no to MCP.
let mut p = Pty::spawn(&h, &["auth", "login"]);
- let at = p.expect("Logged in to run.cua.ai as tester", 0);
+ let at = p.expect("Logged in to Cua as tester", 0);
let at = p.expect(
"Configure cua skills and the cua MCP server for your AI coding agent(s)? [y/n/never]",
at,
diff --git a/libs/cua/crates/cua-cli/tests/auth.rs b/libs/cua/crates/cua-cli/tests/auth.rs
index dbe5f892e2..b68484cff2 100644
--- a/libs/cua/crates/cua-cli/tests/auth.rs
+++ b/libs/cua/crates/cua-cli/tests/auth.rs
@@ -90,10 +90,7 @@ async fn device_login_session_drives_fleet_then_refresh_and_logout() {
let o = h.run(&["auth", "login", "--no-browser"]).await;
o.ok();
assert!(o.stdout.contains("ABCD-EFGH"), "{o:?}");
- assert!(
- o.stdout.contains("Logged in to run.cua.ai as tester."),
- "{o:?}"
- );
+ assert!(o.stdout.contains("Logged in to Cua as tester."), "{o:?}");
let cred_file = h.cua_home().join("credentials.json");
let creds = read_json(&cred_file);
assert_eq!(creds["refresh_token"], "rt-1");
diff --git a/libs/cua/crates/cua-fleet/src/billing.rs b/libs/cua/crates/cua-fleet/src/billing.rs
index 8f0378f2a6..c9be7fae8f 100644
--- a/libs/cua/crates/cua-fleet/src/billing.rs
+++ b/libs/cua/crates/cua-fleet/src/billing.rs
@@ -8,7 +8,7 @@
//! open that page; Fleet refuses app tokens on its Stripe session routes
//! (trycua/cloud#7933).
-use crate::{Error, FleetClient, Result, SdkError};
+use crate::{FleetClient, Result};
use serde::{Deserialize, Serialize};
/// The saved card, as Fleet describes it (never its number).
@@ -88,19 +88,28 @@ impl FleetClient {
)
}
- /// The account's billing state. A Fleet without the route (404) or
- /// with billing off answers [`BillingStatus::disabled`].
+ /// The account's billing state. Fleets is shut down, so this never
+ /// fails: a Fleet without the route (404), one that is gone (410, 5xx)
+ /// or unreachable, or with billing off, answers
+ /// [`BillingStatus::disabled`] and logs why.
pub async fn billing_status(&self) -> Result<BillingStatus> {
- match self.raw("GET", self.billing_url("status"), None).await? {
- (200, body) => serde_json::from_value(body).map_err(|e| {
- Error::InvalidArgument(format!("unexpected billing status from Fleet: {e}"))
+ match self.raw("GET", self.billing_url("status"), None).await {
+ Ok((200, body)) => serde_json::from_value(body).or_else(|e| {
+ tracing::warn!("billing status unavailable: unexpected Fleet reply: {e}");
+ Ok(BillingStatus::disabled())
}),
- (404, _) => Ok(BillingStatus::disabled()),
- (status, body) => {
- Err(
- SdkError::status("read billing status", status, body.to_string().as_bytes())
- .into(),
- )
+ Ok((404, _)) => Ok(BillingStatus::disabled()),
+ Ok((status, _)) => {
+ tracing::warn!(
+ "billing status unavailable: Cua Fleets is shut down (HTTP {status}); billing is managed at https://app.cua.ai"
+ );
+ Ok(BillingStatus::disabled())
+ }
+ Err(e) => {
+ tracing::warn!(
+ "billing status unavailable: Cua Fleets is shut down ({e}); billing is managed at https://app.cua.ai"
+ );
+ Ok(BillingStatus::disabled())
}
}
}
diff --git a/libs/cua/crates/cua-fleet/src/config.rs b/libs/cua/crates/cua-fleet/src/config.rs
index 4a57b52654..a851acfc84 100644
--- a/libs/cua/crates/cua-fleet/src/config.rs
+++ b/libs/cua/crates/cua-fleet/src/config.rs
@@ -3,7 +3,9 @@
use std::fmt;
-/// Default Fleet API endpoint (`_DEFAULT_FLEET_BASE_URL`).
+/// Legacy Fleet API endpoint (`_DEFAULT_FLEET_BASE_URL`). Fleets is shut
+/// down (static from 16 Oct); the Spaces API at api.cua.ai replaces it
+/// later. Kept only so callers still compile and fail softly.
pub const DEFAULT_FLEET_BASE_URL: &str = "https://run.cua.ai";
/// Default OAuth token endpoint (`_DEFAULT_TOKEN_URL`).
pub const DEFAULT_TOKEN_URL: &str =
diff --git a/libs/cua/crates/cua-spaces-app-core/src/billing.rs b/libs/cua/crates/cua-spaces-app-core/src/billing.rs
index a504dc5f96..dd109dd8b5 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/billing.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/billing.rs
@@ -15,6 +15,11 @@ use serde::{Deserialize, Serialize};
/// ([`crate::model::CLOUD_SPACES_OFFERED`]); the SDK's billing calls stay.
pub const BILLING_SHOWN: bool = crate::model::CLOUD_SPACES_OFFERED;
+/// The account app's billing page. Fleets (run.cua.ai) is shut down, so
+/// billing and account links point at the account app, and only while
+/// [`BILLING_SHOWN`] is on (off by default).
+pub const BILLING_URL: &str = "https://app.cua.ai/billing";
+
/// The saved card (never its number).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -86,10 +91,12 @@ pub fn credit_notice(raw: &str) -> Option<CreditNotice> {
.split_whitespace()
.next()?
.trim_end_matches(['.', ')', ',', '"', '\'']);
+ // Whatever page the error names (an old Fleet link), the button opens
+ // the account app.
(url.starts_with("https://") || url.starts_with("http://")).then(|| CreditNotice {
text: OUT_OF_CREDIT.into(),
button: ADD_CREDIT.into(),
- url: url.into(),
+ url: BILLING_URL.into(),
})
}
@@ -150,7 +157,7 @@ mod tests {
credit: Some(BillingCredit {
balance_usd_cents: 742,
}),
- billing_url: Some("https://run.cua.ai/billing".into()),
+ billing_url: Some(BILLING_URL.into()),
};
assert_eq!(billing_line(&s), "$7.42 credit left");
s.credit = None;
@@ -171,7 +178,7 @@ mod tests {
Some(CreditNotice {
text: OUT_OF_CREDIT.into(),
button: ADD_CREDIT.into(),
- url: "https://run.cua.ai/billing".into(),
+ url: BILLING_URL.into(),
}),
"{raw}"
);
diff --git a/libs/cua/crates/cua-spaces-app-core/src/settings.rs b/libs/cua/crates/cua-spaces-app-core/src/settings.rs
index 7aad5123da..83d8c93016 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/settings.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/settings.rs
@@ -568,8 +568,8 @@ pub fn page(input: &SettingsInput) -> SettingsPage {
let mut r = row("billing", Text, "Billing");
r.value = Some(crate::billing::billing_line(b));
r.button = Some(crate::billing::MANAGE_BILLING.into());
- r.link_url = b.billing_url.clone();
- r.enabled = b.billing_url.is_some();
+ r.link_url = Some(crate::billing::BILLING_URL.into());
+ r.enabled = true;
account.push(r);
}
} else if let SignInPhase::Waiting { user_code } = &input.sign_in {
diff --git a/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs b/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs
index 7051e217e2..882e8931dd 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/spaces/creating.rs
@@ -2116,7 +2116,7 @@ mod tests {
(
crate::billing::OUT_OF_CREDIT,
"Add credit",
- "https://run.cua.ai/billing"
+ crate::billing::BILLING_URL
)
);
} else {
diff --git a/libs/cua/crates/cua-spaces-ffi/tests/fleet_billing_app.rs b/libs/cua/crates/cua-spaces-ffi/tests/fleet_billing_app.rs
index 84dfd01bf2..532225a4ae 100644
--- a/libs/cua/crates/cua-spaces-ffi/tests/fleet_billing_app.rs
+++ b/libs/cua/crates/cua-spaces-ffi/tests/fleet_billing_app.rs
@@ -67,7 +67,7 @@ async fn a_cloud_create_out_of_credit_is_a_typed_error_with_the_billing_page() {
);
assert_eq!(
cua_spaces_app_core::billing::credit_notice(&m).map(|n| n.url),
- Some("https://run.cua.ai/billing".into())
+ Some("https://app.cua.ai/billing".into())
);
}
Err(e) => panic!("expected CloudCreditExhausted, got {e:?}"),