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): show the runtime-inclusive Linux disk footprint (#5038)

injaneitya3f9a2595f53
diff --git a/apps/cua-spaces-desktop/src/model/app-model.ts b/apps/cua-spaces-desktop/src/model/app-model.ts
index 28d4f525cc..8d0f2253d5 100644
--- a/apps/cua-spaces-desktop/src/model/app-model.ts
+++ b/apps/cua-spaces-desktop/src/model/app-model.ts
@@ -777,5 +777,5 @@ export class AppModel {
/** The SDK's storage probe as the wizard env takes it. */
export function wizardStorage(s: LocalStorage): AppLocalStorage {
const volume = (v: LocalStorage["lume"]) => (v ? { availableBytes: v.availableBytes, totalBytes: v.totalBytes, name: v.name } : undefined);
- return { reserveBytes: s.reserveBytes, lume: volume(s.lume), qemu: volume(s.qemu), container: volume(s.container), pulled: s.pulled };
+ return { reserveBytes: s.reserveBytes, lume: volume(s.lume), qemu: volume(s.qemu), container: volume(s.container), pulled: s.pulled, linuxRuntimeDownloadBytes: s.linuxRuntimeDownloadBytes };
}
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 35382c2851..070ad110f4 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_sdk.ts
@@ -10299,7 +10299,8 @@ export type LocalStorage = {
/**
* Catalog image refs already pulled here at their published digest.
*/
- pulled: Array<string>
+ pulled: Array<string>,
+ linuxRuntimeDownloadBytes: bigint
}
/**
@@ -10328,7 +10329,8 @@ const FfiConverterTypeLocalStorage = (() => {
lume: FfiConverterOptionalTypeStorageVolume.read(from),
qemu: FfiConverterOptionalTypeStorageVolume.read(from),
container: FfiConverterOptionalTypeStorageVolume.read(from),
- pulled: FfiConverterSequenceString.read(from)
+ pulled: FfiConverterSequenceString.read(from),
+ linuxRuntimeDownloadBytes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -10338,6 +10340,7 @@ const FfiConverterTypeLocalStorage = (() => {
FfiConverterOptionalTypeStorageVolume.write(value.qemu, into);
FfiConverterOptionalTypeStorageVolume.write(value.container, into);
FfiConverterSequenceString.write(value.pulled, into);
+ FfiConverterUInt64.write(value.linuxRuntimeDownloadBytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.hostArch) +
@@ -10345,7 +10348,8 @@ const FfiConverterTypeLocalStorage = (() => {
FfiConverterOptionalTypeStorageVolume.allocationSize(value.lume) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.qemu) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.container) +
- FfiConverterSequenceString.allocationSize(value.pulled);
+ FfiConverterSequenceString.allocationSize(value.pulled) +
+ FfiConverterUInt64.allocationSize(value.linuxRuntimeDownloadBytes);
}
};
diff --git a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
index 7ce47ce129..002aa84272 100644
--- a/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
+++ b/apps/cua-spaces-desktop/src/native/generated/cua_spaces_ffi.ts
@@ -22937,7 +22937,8 @@ export type AppLocalStorage = {
/**
* Catalog refs already pulled here.
*/
- pulled: Array<string>
+ pulled: Array<string>,
+ linuxRuntimeDownloadBytes: bigint
}
/**
@@ -22965,7 +22966,8 @@ const FfiConverterTypeAppLocalStorage = (() => {
lume: FfiConverterOptionalTypeAppStorageVolume.read(from),
qemu: FfiConverterOptionalTypeAppStorageVolume.read(from),
container: FfiConverterOptionalTypeAppStorageVolume.read(from),
- pulled: FfiConverterSequenceString.read(from)
+ pulled: FfiConverterSequenceString.read(from),
+ linuxRuntimeDownloadBytes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -22974,13 +22976,15 @@ const FfiConverterTypeAppLocalStorage = (() => {
FfiConverterOptionalTypeAppStorageVolume.write(value.qemu, into);
FfiConverterOptionalTypeAppStorageVolume.write(value.container, into);
FfiConverterSequenceString.write(value.pulled, into);
+ FfiConverterUInt64.write(value.linuxRuntimeDownloadBytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt64.allocationSize(value.reserveBytes) +
FfiConverterOptionalTypeAppStorageVolume.allocationSize(value.lume) +
FfiConverterOptionalTypeAppStorageVolume.allocationSize(value.qemu) +
FfiConverterOptionalTypeAppStorageVolume.allocationSize(value.container) +
- FfiConverterSequenceString.allocationSize(value.pulled);
+ FfiConverterSequenceString.allocationSize(value.pulled) +
+ FfiConverterUInt64.allocationSize(value.linuxRuntimeDownloadBytes);
}
};
diff --git a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
index e9aef6e2b2..11e1b0dbac 100644
--- a/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
+++ b/apps/cua-spaces-macos/Sources/CuaSpacesMacKit/Models/AppModel.swift
@@ -846,7 +846,8 @@ public final class AppModel {
v.map { AppStorageVolume(availableBytes: $0.availableBytes, totalBytes: $0.totalBytes, name: $0.name) }
}
return AppLocalStorage(reserveBytes: s.reserveBytes, lume: volume(s.lume), qemu: volume(s.qemu),
- container: volume(s.container), pulled: s.pulled)
+ container: volume(s.container), pulled: s.pulled,
+ linuxRuntimeDownloadBytes: s.linuxRuntimeDownloadBytes)
}
/// "Create Space": the new Space shows in the list and the notch at
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateOptionsTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateOptionsTests.swift
index 7352f7b6a3..18602da78f 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateOptionsTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/CreateOptionsTests.swift
@@ -31,7 +31,7 @@ struct CreateOptionsTests {
backend.fixtureBackends = ["container", "lume", "qemu"]
let hd = StorageVolume(availableBytes: 82 * Self.gb, totalBytes: 1_800 * Self.gb, name: "Macintosh HD")
backend.fixtureStorage = LocalStorage(hostArch: "arm64", reserveBytes: 5 * Self.gb, lume: hd, qemu: hd,
- container: hd, pulled: ["ghcr.io/trycua/linux:24.04"])
+ container: hd, pulled: ["ghcr.io/trycua/linux:24.04"], linuxRuntimeDownloadBytes: 0)
backend.fixtureMacosVms = 2
return backend
}
@@ -57,7 +57,7 @@ struct CreateOptionsTests {
#expect(try decodedEnv(options) == (await model.newSpaceEnv()))
let env = try #require(options["env"] as? [String: Any])
let storage = try #require(env["storage"] as? [String: Any])
- #expect(Set(storage.keys) == ["reserveBytes", "lume", "qemu", "container", "pulled"])
+ #expect(Set(storage.keys) == ["reserveBytes", "lume", "qemu", "container", "pulled", "linuxRuntimeDownloadBytes"])
let container = try #require(storage["container"] as? [String: Any])
#expect(Set(container.keys) == ["availableBytes", "totalBytes", "name"])
#expect(container["name"] as? String == "Macintosh HD")
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
index 465daaeff2..c708e7bdef 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ParityTests.swift
@@ -209,7 +209,8 @@ struct ParityTests {
}
return AppLocalStorage(reserveBytes: (s["reserveBytes"] as! NSNumber).uint64Value,
lume: volume(s["lume"]), qemu: volume(s["qemu"]),
- container: volume(s["container"]), pulled: s["pulled"] as! [String])
+ container: volume(s["container"]), pulled: s["pulled"] as! [String],
+ linuxRuntimeDownloadBytes: (s["linuxRuntimeDownloadBytes"] as? NSNumber)?.uint64Value ?? 0)
}
/// `id: Label [placeholder] !error (advanced)`, as `parity.rs` writes it.
diff --git a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
index 38c31e3d7e..d4683540f4 100644
--- a/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
+++ b/apps/cua-spaces-macos/Tests/CuaSpacesMacTests/ViewModelTests.swift
@@ -711,7 +711,7 @@ struct ViewModelTests {
lume: StorageVolume(availableBytes: 212 * gb, totalBytes: 500 * gb, name: "Macintosh HD"),
qemu: StorageVolume(availableBytes: 212 * gb, totalBytes: 500 * gb, name: "Macintosh HD"),
container: StorageVolume(availableBytes: 40 * gb, totalBytes: 100 * gb, name: "Colima"),
- pulled: [])
+ pulled: [], linuxRuntimeDownloadBytes: 0)
let model = makeModel(backend)
await model.openNewSpace()
let w = model.wizard
diff --git a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
index 90cfc4afab..e5d4decebf 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
+++ b/apps/cua-spaces-web/src/bridge/contracts/bridge-shapes.json
@@ -1332,6 +1332,9 @@
"reserveBytes": {
"type": "number"
},
+ "linuxRuntimeDownloadBytes": {
+ "type": "number"
+ },
"lume": {
"type": [
"object",
diff --git a/apps/cua-spaces-web/src/bridge/contracts/new-space.ts b/apps/cua-spaces-web/src/bridge/contracts/new-space.ts
index 7566caf834..736b7032bd 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/new-space.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/new-space.ts
@@ -34,6 +34,7 @@ export interface StorageVolume {
/** Where local Spaces are written and what is already pulled. */
export interface LocalStorage {
reserveBytes: number;
+ linuxRuntimeDownloadBytes?: number;
lume: StorageVolume | null;
qemu: StorageVolume | null;
container: StorageVolume | null;
diff --git a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
index 59b616f457..436d804a4d 100644
--- a/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
+++ b/apps/cua-spaces-web/src/bridge/contracts/shapes.ts
@@ -382,6 +382,7 @@ const LocalStorageShape = ref(
"LocalStorage",
obj<LocalStorage>()({
reserveBytes: num,
+ linuxRuntimeDownloadBytes: opt(num),
lume: nullable(StorageVolumeShape),
qemu: nullable(StorageVolumeShape),
container: nullable(StorageVolumeShape),
diff --git a/apps/cua-spaces/src-tauri/src/core.rs b/apps/cua-spaces/src-tauri/src/core.rs
index 86a7555613..180ce009fa 100644
--- a/apps/cua-spaces/src-tauri/src/core.rs
+++ b/apps/cua-spaces/src-tauri/src/core.rs
@@ -363,6 +363,7 @@ fn wizard_storage(
qemu: vol(r.qemu),
container: vol(r.container),
pulled: r.pulled,
+ linux_runtime_download_bytes: r.linux_runtime_download_bytes,
}
}
diff --git a/apps/cua-spaces/src/components/desktop/NewSpaceWizard.test.tsx b/apps/cua-spaces/src/components/desktop/NewSpaceWizard.test.tsx
index 01b98a876f..652a7a8ab7 100644
--- a/apps/cua-spaces/src/components/desktop/NewSpaceWizard.test.tsx
+++ b/apps/cua-spaces/src/components/desktop/NewSpaceWizard.test.tsx
@@ -308,11 +308,28 @@ describe("the Resources step", () => {
next();
const p = size("ghcr.io/trycua/linux:24.04", "arm64");
const gb = (b: number) => (b / GB < 10 ? (b / GB).toFixed(1) : Math.round(b / GB)) + " GB";
- expect(facts()).toEqual(["Container", "ARM", `${gb(p.disk)} (download ${gb(p.download)})`, "40 GB on Colima"]);
+ expect(facts()).toEqual(["Container", "ARM", `${gb(p.unpacked)}–${gb(p.unpacked + p.disk + p.download)} initially; grows with use (download ${gb(p.download)})`, "40 GB on Colima"]);
expect(screen.queryByRole("slider", { name: "Disk" })).toBeNull();
expect(screen.getByRole("button", { name: "Continue" })).toBeEnabled();
});
+ it("includes the first Linux runtime in the Summary footprint", () => {
+ renderWizard({
+ hostArch: "arm64",
+ storage: { ...storage(), linuxRuntimeDownloadBytes: 455 * 1024 * 1024 },
+ });
+ runOn("local");
+ next();
+ expect(screen.getByText(/includes 455 MB one-time Linux runtime download/)).toBeInTheDocument();
+ expect(screen.queryByText("Linux runtime")).toBeNull();
+ next();
+ next();
+ expect(screen.getByText(/includes 455 MB one-time Linux runtime download/)).toBeInTheDocument();
+ expect(screen.queryByText("Linux runtime")).toBeNull();
+ expect(screen.getAllByText("Disk")).toHaveLength(1);
+ expect(screen.getByText(/GB–.*GB initially; grows with use/)).toBeInTheDocument();
+ });
+
it("blocks Continue in one line when the Space does not fit", () => {
renderWizard({ hostArch: "arm64", storage: storage(3) });
runOn("local");
diff --git a/apps/cua-spaces/src/native/local.ts b/apps/cua-spaces/src/native/local.ts
index 4a464be426..0750bc3b20 100644
--- a/apps/cua-spaces/src/native/local.ts
+++ b/apps/cua-spaces/src/native/local.ts
@@ -22,6 +22,7 @@ export interface StorageVolume {
export interface LocalStorage {
/** Bytes the SDK keeps free on a volume. */
reserveBytes: number;
+ linuxRuntimeDownloadBytes?: number;
lume: StorageVolume | null;
qemu: StorageVolume | null;
container: StorageVolume | null;
diff --git a/docs/content/docs/cua-sdk/reference/local.mdx b/docs/content/docs/cua-sdk/reference/local.mdx
index 2c5d0ef76d..0e9f7f26d7 100644
--- a/docs/content/docs/cua-sdk/reference/local.mdx
+++ b/docs/content/docs/cua-sdk/reference/local.mdx
@@ -414,6 +414,7 @@ Returned by [`Local.storage`](#localstorage).
| `qemu` | [`Option<StorageVolume>`](#storagevolume-record) | | Where QEMU writes VM disks and the containerDisk cache. |
| `container` | [`Option<StorageVolume>`](#storagevolume-record) | | The container engine's data disk (Colima, Docker Desktop, OrbStack, `/var/lib/docker`), when its free space can be read. |
| `pulled` | `Vec<String>` | | Catalog image refs already pulled here at their published digest. |
+| `linux_runtime_download_bytes` / `linuxRuntimeDownloadBytes` | `u64` | | |
## `RuntimeCheck` record
diff --git a/docs/content/docs/cua-sdk/reference/spaces/app-core/new-space.mdx b/docs/content/docs/cua-sdk/reference/spaces/app-core/new-space.mdx
index 7dc8857cc4..290f26d6c2 100644
--- a/docs/content/docs/cua-sdk/reference/spaces/app-core/new-space.mdx
+++ b/docs/content/docs/cua-sdk/reference/spaces/app-core/new-space.mdx
@@ -211,6 +211,7 @@ Returned by [`app_wizard_create_args`](#app_wizard_create_args).
| `qemu` | [`Option<AppStorageVolume>`](#appstoragevolume-record) | | The cua home (QEMU disks and the image cache). |
| `container` | [`Option<AppStorageVolume>`](#appstoragevolume-record) | | The container engine's data disk. |
| `pulled` | `Vec<String>` | | Catalog refs already pulled here. |
+| `linux_runtime_download_bytes` / `linuxRuntimeDownloadBytes` | `u64` | | |
## `AppStorageVolume` record
diff --git a/libs/cua/crates/cua-daemon/src/storage.rs b/libs/cua/crates/cua-daemon/src/storage.rs
index 5472ce1511..c1bd85b445 100644
--- a/libs/cua/crates/cua-daemon/src/storage.rs
+++ b/libs/cua/crates/cua-daemon/src/storage.rs
@@ -28,6 +28,8 @@ pub struct StorageReport {
pub container: Option<Volume>,
/// Catalog refs whose published digest is already pulled here.
pub pulled: Vec<String>,
+ #[serde(default)]
+ pub linux_runtime_download_bytes: u64,
}
const PROBE: Duration = Duration::from_secs(10);
@@ -70,10 +72,33 @@ pub async fn storage_report() -> StorageReport {
.await
.ok()
.flatten();
- (vol, pulled_containers(&entries).await)
+ let wanted: Vec<_> = entries
+ .iter()
+ .copied()
+ .filter(|e| e.local.as_deref() == Some("container"))
+ .collect();
+ let (runtime_bytes, engine) = tokio::time::timeout(PROBE, async {
+ let choice = cua_vmm::managed::choose(
+ Default::default(),
+ cua_vmm::managed::LinuxSource::current(),
+ )
+ .await
+ .ok();
+ let bytes = runtime_download_bytes(choice.as_ref(), cua_vmm::managed::exists());
+ let engine = match choice.filter(|_| !wanted.is_empty()) {
+ Some(choice) => choice.connect_if_up().await,
+ None => None,
+ };
+ (bytes, engine)
+ })
+ .await
+ .unwrap_or((0, None));
+ (vol, pulled_containers(&wanted, engine).await, runtime_bytes)
};
- let ((lume, a), (qemu, b), (container, c)) = tokio::join!(lume, qemu, container);
+ let ((lume, a), (qemu, b), (container, c, linux_runtime_download_bytes)) =
+ tokio::join!(lume, qemu, container);
StorageReport {
+ linux_runtime_download_bytes,
host_arch,
reserve: cua_vmm::disk::CacheConfig::load().min_free,
lume,
@@ -83,6 +108,14 @@ pub async fn storage_report() -> StorageReport {
}
}
+fn runtime_download_bytes(choice: Option<&cua_vmm::managed::Choice>, exists: bool) -> u64 {
+ if !exists && matches!(choice, Some(cua_vmm::managed::Choice::Builtin(_))) {
+ cua_vmm::managed::first_use_download()
+ } else {
+ 0
+ }
+}
+
/// macOS images whose base VM (`cua-base-<sha(ref@digest)>`, what a create
/// clones) is in Lume's storage.
fn pulled_lume(entries: &[&cua_image::catalog::CatalogEntry]) -> Vec<String> {
@@ -104,22 +137,15 @@ fn pulled_lume(entries: &[&cua_image::catalog::CatalogEntry]) -> Vec<String> {
}
/// Container images the engine has at their published digest.
-async fn pulled_containers(entries: &[&cua_image::catalog::CatalogEntry]) -> Vec<String> {
- let wanted: Vec<_> = entries
- .iter()
- .filter(|e| e.local.as_deref() == Some("container"))
- .collect();
- if wanted.is_empty() {
- return vec![];
- }
- // The engine Linux Spaces use; the built-in runtime only while it runs.
- let Ok(Some(rt)) =
- tokio::time::timeout(PROBE, cua_vmm::managed::connect_if_up(Default::default())).await
- else {
+async fn pulled_containers(
+ entries: &[&cua_image::catalog::CatalogEntry],
+ engine: Option<cua_vmm::container::ContainerRuntime>,
+) -> Vec<String> {
+ let Some(rt) = engine else {
return vec![];
};
let mut out = vec![];
- for e in wanted {
+ for e in entries {
let repo = repo_of(&e.reference);
let pinned = format!("{repo}@{}", e.digest.as_deref().unwrap_or_default());
if let Ok(Ok(_)) = tokio::time::timeout(PROBE, rt.docker().inspect_image(&pinned)).await {
@@ -143,6 +169,20 @@ fn repo_of(reference: &str) -> &str {
mod tests {
use super::*;
+ #[test]
+ fn runtime_download_requires_a_known_absent_builtin() {
+ assert_eq!(runtime_download_bytes(None, false), 0);
+ assert_eq!(runtime_download_bytes(None, true), 0);
+ let choice = cua_vmm::managed::Choice::Builtin(std::sync::Arc::new(
+ cua_vmm::managed::ManagedContainers::new(Default::default()),
+ ));
+ assert_eq!(
+ runtime_download_bytes(Some(&choice), false),
+ cua_vmm::managed::first_use_download()
+ );
+ assert_eq!(runtime_download_bytes(Some(&choice), true), 0);
+ }
+
#[test]
fn repo_drops_tag_and_digest() {
assert_eq!(
diff --git a/libs/cua/crates/cua-sdk/src/native/local.rs b/libs/cua/crates/cua-sdk/src/native/local.rs
index 03e93ba8ba..edf169f932 100644
--- a/libs/cua/crates/cua-sdk/src/native/local.rs
+++ b/libs/cua/crates/cua-sdk/src/native/local.rs
@@ -118,6 +118,7 @@ pub struct LocalStorage {
pub container: Option<StorageVolume>,
/// Catalog image refs already pulled here at their published digest.
pub pulled: Vec<String>,
+ pub linux_runtime_download_bytes: u64,
}
impl From<cua_daemon::storage::StorageReport> for LocalStorage {
@@ -136,6 +137,7 @@ impl From<cua_daemon::storage::StorageReport> for LocalStorage {
qemu: vol(r.qemu),
container: vol(r.container),
pulled: r.pulled,
+ linux_runtime_download_bytes: r.linux_runtime_download_bytes,
}
}
}
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/create-resources.json b/libs/cua/crates/cua-spaces-app-core/parity/create-resources.json
index 5c775984f4..efe73c14e9 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/create-resources.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/create-resources.json
@@ -11,6 +11,7 @@
"hostArch": "arm64",
"storage": {
"reserveBytes": 5368709120,
+ "linuxRuntimeDownloadBytes": 477884184,
"lume": {
"availableBytes": 227633266688,
"totalBytes": 536870912000,
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-gpu.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-gpu.json
index 144dca5b4f..bfd7a274c6 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-gpu.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-gpu.json
@@ -47,7 +47,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -264,7 +264,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-resources.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-resources.json
index e9faf64ec5..b4fe799a12 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-resources.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-resources.json
@@ -47,10 +47,10 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB (download 1.1 GB)",
+ "Disk: 3.3 GB–7.2 GB initially; grows with use (download 1.1 GB); includes 456 MB one-time Linux runtime download, shared by Linux Spaces",
"Available: 3.0 GB on Colima"
],
- "resourcesError": "Not enough space on Colima: needs 9.0 GB, 3.0 GB available.",
+ "resourcesError": "Not enough space on Colima: needs 9.4 GB, 3.0 GB available.",
"runtime": "auto",
"runtimes": [
"auto",
@@ -103,10 +103,10 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB (download 1.1 GB)",
+ "Disk: 3.3 GB–7.2 GB initially; grows with use (download 1.1 GB); includes 456 MB one-time Linux runtime download, shared by Linux Spaces",
"Available: 3.0 GB on Colima"
],
- "resourcesError": "Not enough space on Colima: needs 9.0 GB, 3.0 GB available.",
+ "resourcesError": "Not enough space on Colima: needs 9.4 GB, 3.0 GB available.",
"runtime": "auto",
"runtimes": [
"auto",
@@ -163,10 +163,10 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB (download 1.1 GB)",
+ "Disk: 3.3 GB–7.2 GB initially; grows with use (download 1.1 GB); includes 456 MB one-time Linux runtime download, shared by Linux Spaces",
"Available: 3.0 GB on Colima"
],
- "resourcesError": "Not enough space on Colima: needs 9.0 GB, 3.0 GB available.",
+ "resourcesError": "Not enough space on Colima: needs 9.4 GB, 3.0 GB available.",
"runtime": "auto",
"runtimes": [
"auto",
@@ -223,10 +223,10 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 1.2 GB",
+ "Disk: 1.6 GB–3.2 GB initially; grows with use; includes 456 MB one-time Linux runtime download, shared by Linux Spaces",
"Available: 3.0 GB on Colima"
],
- "resourcesError": null,
+ "resourcesError": "Not enough space on Colima: needs 5.4 GB, 3.0 GB available.",
"runtime": "auto",
"runtimes": [
"auto",
@@ -245,7 +245,7 @@
"submit": null,
"submitLabel": "Add Space"
},
- "canContinue": true,
+ "canContinue": false,
"cpusText": "2 cores",
"disk": null,
"fields": [
@@ -279,10 +279,10 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 1.2 GB",
+ "Disk: 1.6 GB–3.2 GB initially; grows with use; includes 456 MB one-time Linux runtime download, shared by Linux Spaces",
"Available: 3.0 GB on Colima"
],
- "resourcesError": null,
+ "resourcesError": "Not enough space on Colima: needs 5.4 GB, 3.0 GB available.",
"runtime": "auto",
"runtimes": [
"auto",
@@ -339,10 +339,10 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 1.2 GB",
+ "Disk: 1.6 GB–3.2 GB initially; grows with use; includes 456 MB one-time Linux runtime download, shared by Linux Spaces",
"Available: 3.0 GB on Colima"
],
- "resourcesError": null,
+ "resourcesError": "Not enough space on Colima: needs 5.4 GB, 3.0 GB available.",
"runtime": "auto",
"runtimes": [
"auto",
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-space.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-space.json
index b4e0420925..20c0ee1e4f 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/create-space.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/create-space.json
@@ -46,7 +46,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -160,7 +160,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -218,7 +218,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -276,7 +276,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -334,7 +334,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -448,7 +448,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "auto",
@@ -506,7 +506,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "gvisor",
@@ -571,7 +571,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "gvisor",
@@ -636,7 +636,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "gvisor",
@@ -701,7 +701,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "gvisor",
@@ -759,7 +759,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "gvisor",
@@ -1161,7 +1161,7 @@
"ranges": "cpus 1-8, memory 2-16",
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"resourcesError": null,
"runtime": "gvisor",
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/placement-picker.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/placement-picker.json
index b08659a9fa..68190d0be9 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/placement-picker.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/placement-picker.json
@@ -29,7 +29,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -40,6 +40,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -74,7 +75,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -85,6 +86,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -119,7 +121,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -130,6 +132,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -163,7 +166,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -251,7 +254,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -294,7 +297,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -340,7 +343,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -437,7 +440,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -448,6 +451,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -481,7 +485,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -520,7 +524,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 1,
"summary": [
@@ -559,7 +563,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 2,
"summary": [
@@ -595,7 +599,7 @@
"price": null,
"resourceFacts": [
"Kind: Container",
- "Disk: 3.0 GB"
+ "Disk: 3.0 GB–7.1 GB initially; grows with use"
],
"step": 3,
"summary": [
@@ -628,7 +632,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 3,
"summary": [
@@ -639,6 +643,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -662,7 +667,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 3,
"summary": [
@@ -673,6 +678,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
diff --git a/libs/cua/crates/cua-spaces-app-core/parity/golden/your-cloud.json b/libs/cua/crates/cua-spaces-app-core/parity/golden/your-cloud.json
index c8c524f5f3..be2626e421 100644
--- a/libs/cua/crates/cua-spaces-app-core/parity/golden/your-cloud.json
+++ b/libs/cua/crates/cua-spaces-app-core/parity/golden/your-cloud.json
@@ -26,7 +26,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -37,6 +37,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -68,7 +69,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 0,
"summary": [
@@ -79,6 +80,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
@@ -783,7 +785,7 @@
"resourceFacts": [
"Kind: Container",
"Architecture: ARM",
- "Disk: 2.8 GB"
+ "Disk: 2.8 GB–6.8 GB initially; grows with use"
],
"step": 2,
"summary": [
@@ -794,6 +796,7 @@
"Architecture: ARM",
"Runtime: Container on this Mac (gVisor when installed)",
"Resources: 2 cores, 4 GB memory",
+ "Disk: 2.8 GB–6.8 GB initially; grows with use",
"Name: Chosen automatically",
"When ready: Open the desktop"
],
diff --git a/libs/cua/crates/cua-spaces-app-core/src/wizard.rs b/libs/cua/crates/cua-spaces-app-core/src/wizard.rs
index fe174c3f79..eea2a41f46 100644
--- a/libs/cua/crates/cua-spaces-app-core/src/wizard.rs
+++ b/libs/cua/crates/cua-spaces-app-core/src/wizard.rs
@@ -1215,6 +1215,8 @@ pub struct LocalStorage {
pub container: Option<StorageVolume>,
/// Catalog refs already pulled here.
pub pulled: Vec<String>,
+ #[serde(default)]
+ pub linux_runtime_download_bytes: u64,
}
/// Create or connect by address.
@@ -2478,16 +2480,45 @@ fn disk_view(state: &WizardState, image: &SandboxImage, env: &WizardEnv, os: Spa
let download = size
.filter(|_| local && pulled == Some(false))
.map(|s| s.download);
+ let runtime_download = env.storage.as_ref().map_or(0, |s| {
+ if local && image.local == Some(LocalEngine::Container) {
+ s.linux_runtime_download_bytes
+ } else {
+ 0
+ }
+ });
+ let runtime_suffix = (runtime_download > 0).then(|| {
+ format!(
+ "includes {} one-time Linux runtime download, shared by Linux Spaces",
+ size_text(runtime_download)
+ )
+ });
if let Some(s) = size {
if bounds.is_none() {
+ let initial = s.unpacked.saturating_add(runtime_download);
+ let footprint = if image.local == Some(LocalEngine::Container) {
+ format!(
+ "{}–{} initially; grows with use",
+ size_text(initial),
+ size_text(initial.saturating_add(s.disk).saturating_add(s.download))
+ )
+ } else {
+ size_text(s.disk)
+ };
let value = match download {
- Some(d) => format!("{} (download {})", size_text(s.disk), size_text(d)),
- None => size_text(s.disk),
+ Some(d) => format!("{footprint} (download {})", size_text(d)),
+ None => footprint,
+ };
+ let value = match &runtime_suffix {
+ Some(suffix) => format!("{value}; {suffix}"),
+ None => value,
};
facts.push(fact_line("disk", "Disk", value));
} else if let Some(d) = download {
facts.push(fact_line("download", "Download", size_text(d)));
}
+ } else if let Some(suffix) = runtime_suffix {
+ facts.push(fact_line("disk", "Disk", suffix));
}
let mut error = None;
if local && let Some(v) = volume_of(image, env) {
@@ -2499,7 +2530,8 @@ fn disk_view(state: &WizardState, image: &SandboxImage, env: &WizardEnv, os: Spa
let reserve = env.storage.as_ref().map_or(0, |s| s.reserve_bytes);
let need = size
.filter(|_| pulled == Some(false))
- .map_or(0, |s| s.download.saturating_add(s.unpacked));
+ .map_or(0, |s| s.download.saturating_add(s.unpacked))
+ .saturating_add(runtime_download);
if need > 0 && v.available_bytes < need.saturating_add(reserve) {
error = Some(format!(
"Not enough space on {}: needs {}, {} available.",
@@ -2928,6 +2960,19 @@ pub fn view_on(state: &WizardState, env: &WizardEnv, os: SpaceOs) -> WizardView
warning: None,
});
}
+ summary.extend(
+ disk.facts
+ .iter()
+ .find(|f| f.id == "disk")
+ .filter(|_| local && image.local == Some(LocalEngine::Container))
+ .map(|f| Fact {
+ label: f.label.clone(),
+ value: f.value.clone(),
+ copy: None,
+ help: f.help.clone(),
+ warning: None,
+ }),
+ );
// One short line; nothing when the cloud rates are unknown.
if let Some(value) = price.clone() {
summary.push(Fact {
@@ -3327,6 +3372,7 @@ mod tests {
qemu: Some(vol(212, "Macintosh HD")),
container: Some(vol(40, "Colima")),
pulled: vec![],
+ linux_runtime_download_bytes: 0,
}),
..env()
}
@@ -3421,6 +3467,93 @@ mod tests {
}
}
+ #[test]
+ fn container_footprint_includes_unpacked_image_and_writable_copy() {
+ let e = storage_env();
+ let s = on("ghcr.io/trycua/linux:24.04", &e);
+ let p = sizes("ghcr.io/trycua/linux:24.04", "arm64");
+ let v = view(&s, &e);
+ assert_eq!(
+ v.resource_facts[2].value,
+ format!(
+ "{}–{} initially; grows with use (download {})",
+ size_text(p.unpacked),
+ size_text(p.unpacked + p.disk + p.download),
+ size_text(p.download)
+ )
+ );
+ }
+
+ #[test]
+ fn first_linux_runtime_is_shared_and_included_in_summary() {
+ let mut e = storage_env();
+ e.storage.as_mut().unwrap().linux_runtime_download_bytes = 455 << 20;
+ let s = on("ghcr.io/trycua/linux:24.04", &e);
+ let v = view(&s, &e);
+ let p = sizes("ghcr.io/trycua/linux:24.04", "arm64");
+ assert!(v.resource_facts.iter().all(|f| f.label != "Linux runtime"));
+ assert!(v.summary.iter().all(|f| f.label != "Linux runtime"));
+ assert_eq!(v.summary.iter().filter(|f| f.label == "Disk").count(), 1);
+ assert!(v.resource_facts.iter().any(|f| {
+ f.label == "Disk"
+ && f.value
+ .contains("includes 455 MB one-time Linux runtime download")
+ }));
+ assert!(v.summary.iter().any(|f| {
+ f.label == "Disk"
+ && f.value
+ .contains("includes 455 MB one-time Linux runtime download")
+ }));
+ assert!(v.summary.iter().any(
+ |f| f.label == "Disk" && f.value.starts_with(&size_text(p.unpacked + (455 << 20)))
+ ));
+ e.storage.as_mut().unwrap().linux_runtime_download_bytes = 0;
+ assert!(
+ !view(&s, &e)
+ .summary
+ .iter()
+ .any(|f| f.value.contains("one-time Linux runtime download"))
+ );
+ let mac = on("ghcr.io/trycua/macos:15", &e);
+ e.storage.as_mut().unwrap().linux_runtime_download_bytes = 455 << 20;
+ assert!(
+ !view(&mac, &e)
+ .summary
+ .iter()
+ .any(|f| f.value.contains("one-time Linux runtime download"))
+ );
+ assert!(
+ view(&mac, &e)
+ .summary
+ .iter()
+ .all(|f| f.label != "Download" && f.label != "Disk")
+ );
+ let mut remote = s;
+ remote.placement = Location::Cloud;
+ assert!(
+ !view(&remote, &e)
+ .resource_facts
+ .iter()
+ .any(|f| f.value.contains("one-time Linux runtime download"))
+ );
+ }
+
+ #[test]
+ fn runtime_is_disclosed_without_catalog_sizes() {
+ let mut e = storage_env();
+ e.storage.as_mut().unwrap().linux_runtime_download_bytes = 455 << 20;
+ let s = on("ghcr.io/trycua/linux:24.04", &e);
+ let mut image = image_of(&s);
+ image.sizes = None;
+ let disk = disk_view(&s, &image, &e, SpaceOs::Linux);
+ assert_eq!(disk.facts.iter().filter(|f| f.id == "disk").count(), 1);
+ assert!(disk.facts.iter().any(|f| {
+ f.id == "disk"
+ && f.value
+ .contains("includes 455 MB one-time Linux runtime download")
+ }));
+ }
+
#[test]
fn a_container_shows_its_size_and_the_engines_room() {
let e = storage_env();
@@ -3435,7 +3568,12 @@ mod tests {
("Architecture".into(), "ARM".into()),
(
"Disk".into(),
- format!("{} (download {})", size_text(p.disk), size_text(p.download))
+ format!(
+ "{}–{} initially; grows with use (download {})",
+ size_text(p.unpacked),
+ size_text(p.unpacked + p.disk + p.download),
+ size_text(p.download)
+ )
),
("Available".into(), "40 GB on Colima".into()),
]
@@ -3447,7 +3585,14 @@ mod tests {
let mut pulled = e.clone();
pulled.storage.as_mut().unwrap().pulled = vec!["ghcr.io/trycua/linux:24.04".into()];
let v = view(&s, &pulled);
- assert_eq!(v.resource_facts[2].value, size_text(p.disk));
+ assert_eq!(
+ v.resource_facts[2].value,
+ format!(
+ "{}–{} initially; grows with use",
+ size_text(p.unpacked),
+ size_text(p.unpacked + p.disk + p.download)
+ )
+ );
}
#[test]
diff --git a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
index 1bdd24d676..627f13f834 100644
--- a/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
+++ b/libs/cua/crates/cua-spaces-ffi/src/app_core_types.rs
@@ -3011,6 +3011,7 @@ pub struct AppLocalStorage {
pub container: Option<AppStorageVolume>,
/// Catalog refs already pulled here.
pub pulled: Vec<String>,
+ pub linux_runtime_download_bytes: u64,
}
/// Cua Cloud rates for this account (the SDK's `Fleet.usage_pricing()`,
diff --git a/libs/cua/crates/cua-vmm/src/managed.rs b/libs/cua/crates/cua-vmm/src/managed.rs
index 7e81239e79..16bb76da41 100644
--- a/libs/cua/crates/cua-vmm/src/managed.rs
+++ b/libs/cua/crates/cua-vmm/src/managed.rs
@@ -932,15 +932,25 @@ mod engine_impl {
/// runtime only while its VM runs). Never boots or downloads anything:
/// for views of what is there (disk use, downloaded images).
pub async fn connect_if_up(cfg: ContainerConfig) -> Option<ContainerRuntime> {
- match choose(cfg.clone(), LinuxSource::current()).await.ok()? {
- Choice::System(rt) => Some(*rt),
- Choice::Builtin(_) if running() => ContainerRuntime::connect(ContainerConfig {
- endpoint: Some(endpoint()),
- ..cfg
- })
+ choose(cfg, LinuxSource::current())
+ .await
+ .ok()?
+ .connect_if_up()
.await
- .ok(),
- Choice::Builtin(_) => None,
+ }
+
+ impl Choice {
+ pub async fn connect_if_up(self) -> Option<ContainerRuntime> {
+ match self {
+ Self::System(rt) => Some(*rt),
+ Self::Builtin(rt) if running() => ContainerRuntime::connect(ContainerConfig {
+ endpoint: Some(endpoint()),
+ ..rt.cfg.clone()
+ })
+ .await
+ .ok(),
+ Self::Builtin(_) => None,
+ }
}
}
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 b3b6f02007..fd1de534ca 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
@@ -30945,6 +30945,8 @@ data class LocalStorage (
* Catalog image refs already pulled here at their published digest.
*/
var `pulled`: List<kotlin.String>
+ ,
+ var `linuxRuntimeDownloadBytes`: kotlin.ULong
){
@@ -30967,6 +30969,7 @@ public object FfiConverterTypeLocalStorage: FfiConverterRustBuffer<LocalStorage>
FfiConverterOptionalTypeStorageVolume.read(buf),
FfiConverterOptionalTypeStorageVolume.read(buf),
FfiConverterSequenceString.read(buf),
+ FfiConverterULong.read(buf),
)
}
@@ -30976,7 +30979,8 @@ public object FfiConverterTypeLocalStorage: FfiConverterRustBuffer<LocalStorage>
FfiConverterOptionalTypeStorageVolume.allocationSize(value.`lume`) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.`qemu`) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.`container`) +
- FfiConverterSequenceString.allocationSize(value.`pulled`)
+ FfiConverterSequenceString.allocationSize(value.`pulled`) +
+ FfiConverterULong.allocationSize(value.`linuxRuntimeDownloadBytes`)
)
override fun write(value: LocalStorage, buf: ByteBuffer) {
@@ -30986,6 +30990,7 @@ public object FfiConverterTypeLocalStorage: FfiConverterRustBuffer<LocalStorage>
FfiConverterOptionalTypeStorageVolume.write(value.`qemu`, buf)
FfiConverterOptionalTypeStorageVolume.write(value.`container`, buf)
FfiConverterSequenceString.write(value.`pulled`, buf)
+ FfiConverterULong.write(value.`linuxRuntimeDownloadBytes`, buf)
}
}
diff --git a/libs/cua/python/src/cua/_native.py b/libs/cua/python/src/cua/_native.py
index 49216db555..0780e5d305 100644
--- a/libs/cua/python/src/cua/_native.py
+++ b/libs/cua/python/src/cua/_native.py
@@ -15199,19 +15199,20 @@ class LocalStorage:
"""
What local Spaces have room for (see [`Local::storage`]).
"""
- def __init__(self, *, host_arch:str, reserve_bytes:int, lume:typing.Optional[StorageVolume], qemu:typing.Optional[StorageVolume], container:typing.Optional[StorageVolume], pulled:typing.List[str]):
+ def __init__(self, *, host_arch:str, reserve_bytes:int, lume:typing.Optional[StorageVolume], qemu:typing.Optional[StorageVolume], container:typing.Optional[StorageVolume], pulled:typing.List[str], linux_runtime_download_bytes:int):
self.host_arch = host_arch
self.reserve_bytes = reserve_bytes
self.lume = lume
self.qemu = qemu
self.container = container
self.pulled = pulled
+ self.linux_runtime_download_bytes = linux_runtime_download_bytes
def __str__(self):
- return "LocalStorage(host_arch={}, reserve_bytes={}, lume={}, qemu={}, container={}, pulled={})".format(self.host_arch, self.reserve_bytes, self.lume, self.qemu, self.container, self.pulled)
+ return "LocalStorage(host_arch={}, reserve_bytes={}, lume={}, qemu={}, container={}, pulled={}, linux_runtime_download_bytes={})".format(self.host_arch, self.reserve_bytes, self.lume, self.qemu, self.container, self.pulled, self.linux_runtime_download_bytes)
def __eq__(self, other):
if self.host_arch != other.host_arch:
return False
@@ -15225,6 +15226,8 @@ class LocalStorage:
return False
if self.pulled != other.pulled:
return False
+ if self.linux_runtime_download_bytes != other.linux_runtime_download_bytes:
+ return False
return True
class _UniffiFfiConverterTypeLocalStorage(_UniffiConverterRustBuffer):
@@ -15237,6 +15240,7 @@ class _UniffiFfiConverterTypeLocalStorage(_UniffiConverterRustBuffer):
qemu=_UniffiFfiConverterOptionalTypeStorageVolume.read(buf),
container=_UniffiFfiConverterOptionalTypeStorageVolume.read(buf),
pulled=_UniffiFfiConverterSequenceString.read(buf),
+ linux_runtime_download_bytes=_UniffiFfiConverterUInt64.read(buf),
)
@staticmethod
@@ -15247,6 +15251,7 @@ class _UniffiFfiConverterTypeLocalStorage(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalTypeStorageVolume.check_lower(value.qemu)
_UniffiFfiConverterOptionalTypeStorageVolume.check_lower(value.container)
_UniffiFfiConverterSequenceString.check_lower(value.pulled)
+ _UniffiFfiConverterUInt64.check_lower(value.linux_runtime_download_bytes)
@staticmethod
def write(value, buf):
@@ -15256,6 +15261,7 @@ class _UniffiFfiConverterTypeLocalStorage(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalTypeStorageVolume.write(value.qemu, buf)
_UniffiFfiConverterOptionalTypeStorageVolume.write(value.container, buf)
_UniffiFfiConverterSequenceString.write(value.pulled, buf)
+ _UniffiFfiConverterUInt64.write(value.linux_runtime_download_bytes, buf)
class _UniffiFfiConverterMapStringSequenceString(_UniffiConverterRustBuffer):
@classmethod
diff --git a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
index 744a1ab67d..ba70719285 100644
--- a/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
+++ b/libs/cua/swift/Sources/CuaSDK/CuaSDK.swift
@@ -23815,6 +23815,7 @@ public struct LocalStorage: Equatable, Hashable {
* Catalog image refs already pulled here at their published digest.
*/
public var pulled: [String]
+ public var linuxRuntimeDownloadBytes: UInt64
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -23838,13 +23839,14 @@ public struct LocalStorage: Equatable, Hashable {
*/container: StorageVolume?,
/**
* Catalog image refs already pulled here at their published digest.
- */pulled: [String]) {
+ */pulled: [String], linuxRuntimeDownloadBytes: UInt64) {
self.hostArch = hostArch
self.reserveBytes = reserveBytes
self.lume = lume
self.qemu = qemu
self.container = container
self.pulled = pulled
+ self.linuxRuntimeDownloadBytes = linuxRuntimeDownloadBytes
}
@@ -23868,7 +23870,8 @@ public struct FfiConverterTypeLocalStorage: FfiConverterRustBuffer {
lume: FfiConverterOptionTypeStorageVolume.read(from: &buf),
qemu: FfiConverterOptionTypeStorageVolume.read(from: &buf),
container: FfiConverterOptionTypeStorageVolume.read(from: &buf),
- pulled: FfiConverterSequenceString.read(from: &buf)
+ pulled: FfiConverterSequenceString.read(from: &buf),
+ linuxRuntimeDownloadBytes: FfiConverterUInt64.read(from: &buf)
)
}
@@ -23879,6 +23882,7 @@ public struct FfiConverterTypeLocalStorage: FfiConverterRustBuffer {
FfiConverterOptionTypeStorageVolume.write(value.qemu, into: &buf)
FfiConverterOptionTypeStorageVolume.write(value.container, into: &buf)
FfiConverterSequenceString.write(value.pulled, into: &buf)
+ FfiConverterUInt64.write(value.linuxRuntimeDownloadBytes, into: &buf)
}
}
diff --git a/libs/cua/typescript/src/native/cua_sdk.ts b/libs/cua/typescript/src/native/cua_sdk.ts
index 60404cdf56..b469f13448 100644
--- a/libs/cua/typescript/src/native/cua_sdk.ts
+++ b/libs/cua/typescript/src/native/cua_sdk.ts
@@ -10293,7 +10293,8 @@ export type LocalStorage = {
/**
* Catalog image refs already pulled here at their published digest.
*/
- pulled: Array<string>
+ pulled: Array<string>,
+ linuxRuntimeDownloadBytes: bigint
}
/**
@@ -10322,7 +10323,8 @@ const FfiConverterTypeLocalStorage = (() => {
lume: FfiConverterOptionalTypeStorageVolume.read(from),
qemu: FfiConverterOptionalTypeStorageVolume.read(from),
container: FfiConverterOptionalTypeStorageVolume.read(from),
- pulled: FfiConverterSequenceString.read(from)
+ pulled: FfiConverterSequenceString.read(from),
+ linuxRuntimeDownloadBytes: FfiConverterUInt64.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -10332,6 +10334,7 @@ const FfiConverterTypeLocalStorage = (() => {
FfiConverterOptionalTypeStorageVolume.write(value.qemu, into);
FfiConverterOptionalTypeStorageVolume.write(value.container, into);
FfiConverterSequenceString.write(value.pulled, into);
+ FfiConverterUInt64.write(value.linuxRuntimeDownloadBytes, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.hostArch) +
@@ -10339,7 +10342,8 @@ const FfiConverterTypeLocalStorage = (() => {
FfiConverterOptionalTypeStorageVolume.allocationSize(value.lume) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.qemu) +
FfiConverterOptionalTypeStorageVolume.allocationSize(value.container) +
- FfiConverterSequenceString.allocationSize(value.pulled);
+ FfiConverterSequenceString.allocationSize(value.pulled) +
+ FfiConverterUInt64.allocationSize(value.linuxRuntimeDownloadBytes);
}
};
diff --git a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
index a85c6f480f..eb37cc72e2 100644
--- a/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
+++ b/libs/spaces-app-swift/Sources/CuaSpacesFFI/CuaSpacesFFI.swift
@@ -18002,6 +18002,7 @@ public struct AppLocalStorage: Equatable, Hashable {
* Catalog refs already pulled here.
*/
public var pulled: [String]
+ public var linuxRuntimeDownloadBytes: UInt64
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -18021,12 +18022,13 @@ public struct AppLocalStorage: Equatable, Hashable {
*/container: AppStorageVolume?,
/**
* Catalog refs already pulled here.
- */pulled: [String]) {
+ */pulled: [String], linuxRuntimeDownloadBytes: UInt64) {
self.reserveBytes = reserveBytes
self.lume = lume
self.qemu = qemu
self.container = container
self.pulled = pulled
+ self.linuxRuntimeDownloadBytes = linuxRuntimeDownloadBytes
}
@@ -18049,7 +18051,8 @@ public struct FfiConverterTypeAppLocalStorage: FfiConverterRustBuffer {
lume: FfiConverterOptionTypeAppStorageVolume.read(from: &buf),
qemu: FfiConverterOptionTypeAppStorageVolume.read(from: &buf),
container: FfiConverterOptionTypeAppStorageVolume.read(from: &buf),
- pulled: FfiConverterSequenceString.read(from: &buf)
+ pulled: FfiConverterSequenceString.read(from: &buf),
+ linuxRuntimeDownloadBytes: FfiConverterUInt64.read(from: &buf)
)
}
@@ -18059,6 +18062,7 @@ public struct FfiConverterTypeAppLocalStorage: FfiConverterRustBuffer {
FfiConverterOptionTypeAppStorageVolume.write(value.qemu, into: &buf)
FfiConverterOptionTypeAppStorageVolume.write(value.container, into: &buf)
FfiConverterSequenceString.write(value.pulled, into: &buf)
+ FfiConverterUInt64.write(value.linuxRuntimeDownloadBytes, into: &buf)
}
}