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.

fix(spaces): the apps stop calling the retired run.cua.ai (CUA-1515) (#5098)

ddupont499130b2cb13
diff --git a/apps/cua-spaces-desktop/src/model/backend.ts b/apps/cua-spaces-desktop/src/model/backend.ts
index 8cdb991aca..d166ce4bec 100644
--- a/apps/cua-spaces-desktop/src/model/backend.ts
+++ b/apps/cua-spaces-desktop/src/model/backend.ts
@@ -395,10 +395,13 @@ export class LiveSpacesBackend implements SpacesBackend {
return runningMacosVms(answer);
}
+ /**
+ * No estimate: the rates came from the retired Fleets API
+ * (`fleet().usagePricing()` on run.cua.ai), and the app does not offer new
+ * cloud Spaces. New Space never waits on it.
+ */
async cloudPricing(): Promise<AppCloudPricing | null> {
- if (!(await this.cloudAvailable())) return null;
- const p = await bounded(PROBE_SECONDS, () => this.cua.fleet().usagePricing());
- return p ? { vcpuHourUsd: p.vcpuHourUsd, memoryGibHourUsd: p.memoryGibHourUsd } : null;
+ return null;
}
async usage(id: string): Promise<AppSpaceUsage | null> {
diff --git a/apps/cua-spaces-desktop/test/spaces-model.test.ts b/apps/cua-spaces-desktop/test/spaces-model.test.ts
index adfdc57208..27c71f2cfb 100644
--- a/apps/cua-spaces-desktop/test/spaces-model.test.ts
+++ b/apps/cua-spaces-desktop/test/spaces-model.test.ts
@@ -272,3 +272,13 @@ describe("LiveSpacesBackend's runtime settings", () => {
expect(await backend("linux").linuxSource()).toBe("auto");
});
});
+
+describe("LiveSpacesBackend and the retired Fleets API", () => {
+ it("New Space asks no Fleet for pricing, even with Fleet credentials set", async () => {
+ let fleetCalls = 0;
+ const cua = { fleet: () => (fleetCalls++, { usagePricing: async () => ({ vcpuHourUsd: 1, memoryGibHourUsd: 1 }) }) };
+ const backend = new LiveSpacesBackend({} as Native, cua as never, { FLEETS_TOKEN: "t" }, fetch, "darwin");
+ expect(await backend.cloudPricing()).toBeNull();
+ expect(fleetCalls).toBe(0);
+ });
+});
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift
index d4a7ccbb74..13038fc796 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppServices.swift
@@ -264,21 +264,22 @@ public final class FixtureAccount: AccountRunning, @unchecked Sendable {
// MARK: - Cua Cloud billing
-/// The account's Cua Cloud billing through the cua SDK (`Fleet.billingStatus`):
-/// the credit left and the website billing page. The app takes no payment
-/// details; the website does.
+/// The account's Cua Cloud billing: the credit left and the account app's
+/// billing page. The app takes no payment details; the account app does.
public protocol BillingRunning: AnyObject, Sendable {
/// The status as the app core takes it.
func status() async throws -> AppBillingStatus
}
-/// The SDK's Fleet billing status.
+/// Billing no longer calls the retired Fleets API (`GET /api/billing/status`
+/// on run.cua.ai). It reports "billing not enabled" with no network call, so
+/// Settings hides the row and a refused cloud Space offers no Add credit.
public final class LiveBilling: BillingRunning, @unchecked Sendable {
let cua: Cua
public init(cua: Cua) { self.cua = cua }
public func status() async throws -> AppBillingStatus {
- appBillingStatus(status: try await cua.fleet().billingStatus())
+ AppBillingStatus(billingEnabled: false, card: nil, credit: nil, billingUrl: nil)
}
}
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
index 6e7f43e88c..23a229ba99 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/SpacesBackend.swift
@@ -65,8 +65,8 @@ public protocol SpacesBackend: AnyObject, Sendable {
/// macOS VMs running on this Mac now (Lume's, Spaces or not: Apple's
/// license counts every one), when Lume says.
func runningMacosVms() async -> Int?
- /// This account's Cua Cloud rates (`Fleet.usagePricing()`), when known:
- /// the New Space estimate. `nil` shows none.
+ /// This account's Cua Cloud rates, when known: the New Space estimate.
+ /// `nil` shows none (the live backend has no source for them).
func cloudPricing() async -> AppCloudPricing?
/// The SDK's teleport handle and the Space handle, for "Teleport an app".
func teleportContext(id: String) async throws -> (CuaSpacesFFI.Teleport, CuaSDK.Space)?
@@ -401,13 +401,10 @@ public final class LiveSpacesBackend: SpacesBackend, @unchecked Sendable {
}.count
}
- public func cloudPricing() async -> AppCloudPricing? {
- guard await cloudAvailable(), let fleet = try? cua.fleet(),
- case .success(let got) = await withTimeout(seconds: Self.probeSeconds, { try await fleet.usagePricing() }),
- let p = got
- else { return nil }
- return AppCloudPricing(vcpuHourUsd: p.vcpuHourUsd, memoryGibHourUsd: p.memoryGibHourUsd)
- }
+ /// No estimate: the rates came from the retired Fleets API
+ /// (`Fleet.usagePricing()` on run.cua.ai), and the app does not offer
+ /// new cloud Spaces. New Space never waits on it.
+ public func cloudPricing() async -> AppCloudPricing? { nil }
public func teleportContext(id: String) async throws -> (CuaSpacesFFI.Teleport, CuaSDK.Space)? {
(cua.teleport(), try await cua.spaces().space(space: id))
diff --git a/apps/cua-spaces/README.md b/apps/cua-spaces/README.md
index c5fe8f9466..1207e65ac5 100644
--- a/apps/cua-spaces/README.md
+++ b/apps/cua-spaces/README.md
@@ -147,7 +147,7 @@ in the Space's `~/Downloads`, digest-verified.
| Variable | Default | Purpose |
| --- | --- | --- |
-| `CUA_FLEET_BASE_URL` | `https://run.cua.ai` | Cua Cloud API base URL |
+| `CUA_FLEET_BASE_URL` | none | Legacy Fleets API base URL (run.cua.ai is retired) |
| `CUA_TOKEN_URL` | `https://auth.cua.ai/realms/cyclops-cs/protocol/openid-connect/token` | OAuth token endpoint |
| `CUA_CLIENT_ID` / `CUA_CLIENT_SECRET` | none | client-credentials auth |
| `FLEETS_TOKEN` | none | static bearer token (takes precedence) |
diff --git a/apps/cua-spaces/src-tauri/src/core.rs b/apps/cua-spaces/src-tauri/src/core.rs
index 180ce009fa..f46c43315a 100644
--- a/apps/cua-spaces/src-tauri/src/core.rs
+++ b/apps/cua-spaces/src-tauri/src/core.rs
@@ -1181,45 +1181,20 @@ impl AppCore {
// ----------------------------------------------------------- cloud
- /// `cloud_pricing`: this account's Cua Cloud rates (the SDK caches them
- /// for five minutes). `None` when not signed in or Fleet gave no rates:
- /// the wizard then shows no estimate.
+ /// `cloud_pricing`: always `None` (no estimate). The rates came from the
+ /// retired Fleets API (run.cua.ai), and the app does not offer new cloud
+ /// Spaces.
pub async fn cloud_pricing(&self) -> Option<cua_spaces_app_core::wizard::CloudPricing> {
- let fleet = self.fleet_client.as_ref()?;
- match fleet.usage_pricing().await {
- Ok(p) => p.map(|p| cua_spaces_app_core::wizard::CloudPricing {
- vcpu_hour_usd: p.vcpu_hour_usd,
- memory_gib_hour_usd: p.memory_gib_hour_usd,
- }),
- Err(e) => {
- tracing::debug!("cloud pricing unavailable: {e}");
- None
- }
- }
+ None
}
- /// `billing_status`: the account's Cua Cloud billing as the app core
- /// takes it (Settings' Billing row). `None` without a Fleet client
- /// (not signed in).
+ /// `billing_status`: always `None`. The Fleets billing API
+ /// (`GET /api/billing/status` on run.cua.ai) is retired, so the app no
+ /// longer calls it and Settings hides the Billing row.
pub async fn billing_status(
&self,
) -> CmdResult<Option<cua_spaces_app_core::billing::BillingStatus>> {
- use cua_spaces_app_core::billing as b;
- let Some(fleet) = self.fleet_client.as_ref() else {
- return Ok(None);
- };
- let s = fleet.billing_status().await.map_err(msg)?;
- Ok(Some(b::BillingStatus {
- billing_enabled: s.billing_enabled,
- card: s.card.map(|c| b::BillingCard {
- brand: c.brand,
- last4: c.last4,
- }),
- credit: s.credit.map(|c| b::BillingCredit {
- balance_usd_cents: c.balance_usd_cents,
- }),
- billing_url: s.billing_url,
- }))
+ Ok(None)
}
// ----------------------------------------------------------- local
diff --git a/apps/cua-spaces/src/native/fleet.ts b/apps/cua-spaces/src/native/fleet.ts
index 5c55c2afaf..c1a01e1b76 100644
--- a/apps/cua-spaces/src/native/fleet.ts
+++ b/apps/cua-spaces/src/native/fleet.ts
@@ -239,9 +239,9 @@ export interface BillingStatus {
export interface FleetBridge {
readonly isNative: boolean;
status(probe?: boolean): Promise<FleetStatus>;
- /** This account's Cua Cloud rates; null when unknown (no estimate). */
+ /** This account's Cua Cloud rates; null when unknown (no estimate; always null in the native app). */
cloudPricing?(): Promise<CloudPricing | null>;
- /** The account's Cua Cloud billing (null: no Fleet client). */
+ /** Always null in the native app: the Fleets billing API is retired. */
billingStatus?(): Promise<BillingStatus | null>;
daemonStatus(): Promise<DaemonStatus>;
ensureDaemon(): Promise<DaemonStatus>;