Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(cua-spacesd): let an image mark features not applicable; bench images skip volume.mount (#4568)
ddupontfe6d89d8049d
diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdxindex 24497384d1..e5176de742 100644--- a/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx+++ b/docs/content/docs/cua-sdk/reference/rust/cua-spaces.mdx@@ -1988,6 +1988,22 @@ pub enum SessionDelivery {}```+### `thumbnails::CaptureFailure`++The last failed capture of a Space (cleared by a good ...++```rust+pub struct CaptureFailure {+ pub at: Instant,+ pub attempts: u32,+ pub denied: bool,+ pub message: String,+}+impl CaptureFailure {+ fn backoff(&self) -> Duration;+}+```+### `thumbnails::Thumbnail`One Space's latest thumbnail.@@ -2018,6 +2034,8 @@ impl ThumbnailCache {fn get(&self, space: &str) -> Option<Thumbnail>;fn spaces(&self) -> Vec<String>;fn put(&self, space: &str, t: Thumbnail);+ fn fail(&self, space: &str, now: Instant, denied: bool, message: String);+ fn backing_off(&self, space: &str, now: Instant) -> Option<CaptureFailure>;fn remove(&self, space: &str);fn retain(&self, keep: &HashSet<String>);fn note_interest(&self, now: Instant);@@ -2370,12 +2388,18 @@ pub const MIN_STREAMABLE_SIDE: f64 = 40.0;// mod thumbnails/// A running Space's thumbnail is captured ...pub const BACKGROUND_INTERVAL: Duration = _;+/// After a refused capture (a host that ...+pub const DENIED_BACKOFF: Duration = _;/// Disk cap for the whole cache.pub const DISK_BYTES: u64 = _;+/// After another failed capture: the first ...+pub const FAILURE_BACKOFF: Duration = _;/// How long one request keeps the ...pub const INTEREST_WINDOW: Duration = _;/// Long edge of a captured thumbnail ...pub const MAX_DIMENSION: u32 = 320;+/// The longest wait after failed captures.+pub const MAX_FAILURE_BACKOFF: Duration = _;/// JPEG quality of a captured thumbnail.pub const QUALITY: u32 = 70;/// How often the daemon checks which ...diff --git a/docs/content/docs/cua-sdk/reference/rust/cua-spacesd-client.mdx b/docs/content/docs/cua-sdk/reference/rust/cua-spacesd-client.mdxindex ff809be079..9ca04dbe7d 100644--- a/docs/content/docs/cua-sdk/reference/rust/cua-spacesd-client.mdx+++ b/docs/content/docs/cua-sdk/reference/rust/cua-spacesd-client.mdx@@ -734,6 +734,7 @@ pub struct Manifest {pub spacesd: SpacesdClaim,pub features_required: Vec<String>,pub features_optional: Vec<String>,+ pub features_not_applicable: Vec<String>,pub feature_attributes: BTreeMap<String, BTreeMap<String, String>>,pub codecs_required: Vec<String>,pub auth_modes: Vec<String>,@@ -760,6 +761,7 @@ impl Manifest {fn is_named(&self, name: &str) -> bool;fn requires(&self, feature: &str) -> bool;fn allows(&self, feature: &str) -> bool;+ fn not_applicable(&self, feature: &str) -> bool;fn lists(&self, feature: &str) -> bool;fn av_skew_budget(&self, runtime: &str) -> u32;}diff --git a/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/capabilities.rs b/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/capabilities.rsindex 297e90617d..9dd2879ff2 100644--- a/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/capabilities.rs+++ b/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/capabilities.rs@@ -113,6 +113,21 @@ pub async fn run(ctx: &Ctx, rec: &mut Recorder<'_>) {rec.push(check, &[&claim]).await;}+ for name in &manifest.features_not_applicable {+ if name.ends_with('*') || manifest.requires(name) {+ continue;+ }+ let id = format!("capabilities.not_applicable.{name}");+ let claim = format!("feature:{name}");+ rec.skip(+ &id,+ &[&claim],+ "not_applicable",+ format!("{name} does not apply to this image"),+ )+ .await;+ }+// Claimed attribute values: the backends the image was built for (for// example presence.cursor_shape's hit_test/system/probe).for (name, want) in &manifest.feature_attributes {diff --git a/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/volume.rs b/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/volume.rsindex d7191637c2..2beb72cc30 100644--- a/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/volume.rs+++ b/libs/cua-spacesd/crates/cua-spacesd-doctor/src/checks/volume.rs@@ -25,6 +25,17 @@ pub async fn run(ctx: &Ctx, rec: &mut Recorder<'_>) {if !rec.wants_group("volume") {return;}+ if ctx.manifest.manifest.not_applicable("volume.mount") {+ rec.skip(+ "volume.mount",+ &[VOLUME],+ "not_applicable",+ "the image lists volume.mount as not applicable (claims.features_not_applicable)"+ .into(),+ )+ .await;+ return;+ }if !ctx.supports("volume.mount") {let message = format!("volume.mount unsupported: {}",diff --git a/libs/cua/crates/cua-spacesd-client/src/manifest.rs b/libs/cua/crates/cua-spacesd-client/src/manifest.rsindex 6d08962213..9290bc4b32 100644--- a/libs/cua/crates/cua-spacesd-client/src/manifest.rs+++ b/libs/cua/crates/cua-spacesd-client/src/manifest.rs@@ -65,6 +65,11 @@ pub struct Manifest {/// Features that may be missing (a warning, not a failure). A trailing/// `*` matches a prefix ("teleport.*").pub features_optional: Vec<String>,+ /// Features that do not apply to this image (a benchmark guest has no+ /// use for a Cua Volume mount, say). The doctor skips their checks as+ /// `not_applicable` instead of exercising them. A trailing `*` matches+ /// a prefix. A feature that is also required stays required.+ pub features_not_applicable: Vec<String>,/// Attribute values a feature must report, by feature name and then/// attribute (`{"presence.cursor_shape": {"hit_test": "atspi"}}`). The/// doctor fails when the feature is unsupported or reports another@@ -459,9 +464,19 @@ impl Manifest {self.features_optional.iter().any(|p| matches(p, feature))}+ /// Whether `feature` is listed as not applicable to this image (and is+ /// not also required, which wins).+ pub fn not_applicable(&self, feature: &str) -> bool {+ !self.requires(feature)+ && self+ .features_not_applicable+ .iter()+ .any(|p| matches(p, feature))+ }+/// Whether `feature` is listed at all.pub fn lists(&self, feature: &str) -> bool {- self.requires(feature) || self.allows(feature)+ self.requires(feature) || self.allows(feature) || self.not_applicable(feature)}/// Budget for the A/V skew under `runtime` (a runtime name from the@@ -518,6 +533,25 @@ mod tests {assert_eq!(none.severity(&["core"]), Severity::Required);}+ #[test]+ fn not_applicable_features_are_listed_and_required_wins() {+ let loaded = Loaded::parse(+ br#"{"schema_version":1,"name":"bench","features_required":["driver"],+ "features_optional":["teleport.*"],+ "features_not_applicable":["volume.mount","driver","audio.*"]}"#,+ "m",+ );+ let m = &loaded.manifest;+ assert!(m.not_applicable("volume.mount"));+ assert!(m.not_applicable("audio.opus"));+ assert!(m.lists("volume.mount"));+ // A required feature can't be waved off.+ assert!(!m.not_applicable("driver"));+ assert!(m.requires("driver"));+ // Images that don't say keep today's behaviour.+ assert!(!sample().manifest.not_applicable("volume.mount"));+ }+#[test]fn bad_manifests_are_reported_not_trusted() {let wrong = Loaded::parse(br#"{"schema_version":2}"#, "m");diff --git a/libs/images/bench/osworld/image.json b/libs/images/bench/osworld/image.jsonindex 4a60b5f677..1f0ebbbda3 100644--- a/libs/images/bench/osworld/image.json+++ b/libs/images/bench/osworld/image.json@@ -94,7 +94,9 @@"audio.uplink","audio.opus","audio.per_app",- "teleport.*",+ "teleport.*"+ ],+ "features_not_applicable": ["volume.mount"],"codecs_required": [],diff --git a/libs/images/bench/web/image.json b/libs/images/bench/web/image.jsonindex aafc8ed062..5b25ba86c3 100644--- a/libs/images/bench/web/image.json+++ b/libs/images/bench/web/image.json@@ -201,7 +201,9 @@"audio.per_app","clipboard.files","clipboard.image",- "teleport.*",+ "teleport.*"+ ],+ "features_not_applicable": ["volume.mount"],"feature_attributes": {diff --git a/libs/images/common/tools/cua-image-manifest b/libs/images/common/tools/cua-image-manifestindex b1ed3ebeec..b8ada961d6 100755--- a/libs/images/common/tools/cua-image-manifest+++ b/libs/images/common/tools/cua-image-manifest@@ -206,6 +206,8 @@ def generate(args: argparse.Namespace) -> dict[str, Any]:},"features_required": list(claims.get("features_required", [])),"features_optional": list(claims.get("features_optional", [])),+ # Features that do not apply to this image (the doctor skips them).+ "features_not_applicable": list(claims.get("features_not_applicable", [])),# Attribute values a feature must report (the backends the image was# built for, e.g. presence.cursor_shape's hit_test/system/probe)."feature_attributes": {diff --git a/libs/images/common/tools/tests/fixtures/manifest.linux.json b/libs/images/common/tools/tests/fixtures/manifest.linux.jsonindex 4cf9d8e3ce..2567f49619 100644--- a/libs/images/common/tools/tests/fixtures/manifest.linux.json+++ b/libs/images/common/tools/tests/fixtures/manifest.linux.json@@ -90,6 +90,7 @@"system": "xfixes"}},+ "features_not_applicable": [],"features_optional": ["hotspot","relay_attach",diff --git a/libs/images/common/tools/tests/test_cua_image_manifest.py b/libs/images/common/tools/tests/test_cua_image_manifest.pyindex 94dec0c35e..9bb2dd0442 100644--- a/libs/images/common/tools/tests/test_cua_image_manifest.py+++ b/libs/images/common/tools/tests/test_cua_image_manifest.py@@ -76,6 +76,8 @@ class ManifestTests(unittest.TestCase):self.assertEqual(m["aliases"], ["cua-desktop-linux"])self.assertIn("desktop_stream", m["features_required"])self.assertIn("teleport.*", m["features_optional"])+ # The Linux OS image applies every feature it lists.+ self.assertEqual(m["features_not_applicable"], [])# The X11 desktop pins its presence cursor-shape backends.self.assertIn("presence.cursor_shape", m["features_required"])self.assertEqual(m["feature_attributes"]["presence.cursor_shape"],