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(windows): no firewall prompt for cua and cua-spacesd, and a real publisher name (#6558)
cua-agents[bot]0d196ad76698
diff --git a/libs/cua-spacesd/crates/cua-spacesd/build.rs b/libs/cua-spacesd/crates/cua-spacesd/build.rsindex f975c16d2c..4b57a57618 100644--- a/libs/cua-spacesd/crates/cua-spacesd/build.rs+++ b/libs/cua-spacesd/crates/cua-spacesd/build.rs@@ -62,9 +62,30 @@ fn main() {if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {// The linked Windows driver expects physical pixels. Declare the// process context before any async, native, or overlay thread starts.+ // The DPI manifest (cua-spacesd.rc) and the version resource, in one+ // resource script written to OUT_DIR (the manifest beside it).println!("cargo:rerun-if-changed=cua-spacesd.rc");println!("cargo:rerun-if-changed=cua-spacesd.manifest");- embed_resource::compile_for("cua-spacesd.rc", ["cua-spacesd"], embed_resource::NONE);+ let out = PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR"));+ let version = std::env::var("CARGO_PKG_VERSION").unwrap_or_default();+ let manifest = std::fs::read_to_string("cua-spacesd.rc").expect("cua-spacesd.rc");+ std::fs::copy("cua-spacesd.manifest", out.join("cua-spacesd.manifest"))+ .expect("copy cua-spacesd.manifest");+ let rc = out.join("cua-spacesd-resources.rc");+ std::fs::write(+ &rc,+ format!(+ "{manifest}\n{}",+ version_resource(+ "Cua Spaces background service",+ "cua-spacesd",+ "Cua Spaces",+ version.trim()+ )+ ),+ )+ .expect("write the resource script");+ embed_resource::compile_for(&rc, ["cua-spacesd"], embed_resource::NONE);}println!("cargo:rerun-if-env-changed=CUA_SPACESD_GIT_SHA");@@ -99,3 +120,52 @@ fn main() {}println!("cargo:rustc-env=CUA_SPACESD_GIT_SHA={sha}");}++/// The Windows version resource (`VS_VERSION_INFO`): what Explorer's+/// Details tab and the Windows Firewall prompt show. The prompt reads the+/// name from `FileDescription` and the publisher from `CompanyName`, not+/// from the Authenticode signature, so without it a signed binary showed+/// Publisher "Unknown" (CUA-3515). Numeric constants only, so no Windows+/// SDK header is needed: 1 = VS_VERSION_INFO, 0x40004 = VOS_NT_WINDOWS32,+/// 1 = VFT_APP.+fn version_resource(description: &str, internal: &str, product: &str, version: &str) -> String {+ let mut parts = version+ .split(['.', '-', '+'])+ .map(|p| p.parse::<u16>().unwrap_or(0))+ .chain(std::iter::repeat(0));+ let numeric: Vec<String> = (0..4)+ .map(|_| parts.next().unwrap_or(0).to_string())+ .collect();+ let numeric = numeric.join(",");+ format!(+ r#"1 VERSIONINFO+FILEVERSION {numeric}+PRODUCTVERSION {numeric}+FILEFLAGSMASK 0x3F+FILEFLAGS 0x0+FILEOS 0x40004+FILETYPE 0x1+FILESUBTYPE 0x0+BEGIN+ BLOCK "StringFileInfo"+ BEGIN+ BLOCK "040904B0"+ BEGIN+ VALUE "CompanyName", "Cua AI, Inc."+ VALUE "FileDescription", "{description}"+ VALUE "FileVersion", "{version}"+ VALUE "InternalName", "{internal}"+ VALUE "LegalCopyright", "Copyright (c) 2026 Cua AI, Inc."+ VALUE "OriginalFilename", "{internal}.exe"+ VALUE "ProductName", "{product}"+ VALUE "ProductVersion", "{version}"+ END+ END+ BLOCK "VarFileInfo"+ BEGIN+ VALUE "Translation", 0x409, 1200+ END+END+"#+ )+}diff --git a/libs/cua-spacesd/crates/cua-spacesd/tests/windows_version_resource.rs b/libs/cua-spacesd/crates/cua-spacesd/tests/windows_version_resource.rsnew file mode 100644index 0000000000..7cb84844ce--- /dev/null+++ b/libs/cua-spacesd/crates/cua-spacesd/tests/windows_version_resource.rs@@ -0,0 +1,41 @@+// SPDX-License-Identifier: FSL-1.1-MIT+// Copyright (c) 2026 Cua AI, Inc.++//! The shipped `cua-spacesd.exe` carries its version resource: the Windows+//! Firewall prompt names the app from `FileDescription` and its publisher+//! from `CompanyName` (not from the Authenticode signature), so without+//! them it said Publisher "Unknown" (CUA-3515).+#![cfg(target_os = "windows")]++use std::process::Command;++#[test]+fn the_exe_names_cua_ai_as_its_publisher() {+ let exe = env!("CARGO_BIN_EXE_cua-spacesd");+ let script = format!(+ "$v = (Get-Item -LiteralPath '{}').VersionInfo; \+ \"$($v.CompanyName)|$($v.FileDescription)|$($v.ProductName)|$($v.ProductVersion)\"",+ exe.replace('\'', "''")+ );+ let out = Command::new("powershell")+ .args(["-NoProfile", "-NonInteractive", "-Command", &script])+ .output()+ .expect("powershell");+ assert!(+ out.status.success(),+ "{}",+ String::from_utf8_lossy(&out.stderr)+ );+ let text = String::from_utf8_lossy(&out.stdout).trim().to_string();+ let fields: Vec<&str> = text.split('|').collect();+ assert_eq!(+ fields,+ [+ "Cua AI, Inc.",+ "Cua Spaces background service",+ "Cua Spaces",+ env!("CARGO_PKG_VERSION")+ ],+ "{text}"+ );+}diff --git a/libs/cua/Cargo.lock b/libs/cua/Cargo.lockindex 995fa3186f..674318e622 100644--- a/libs/cua/Cargo.lock+++ b/libs/cua/Cargo.lock@@ -2334,7 +2334,7 @@ dependencies = ["sha2 0.10.9","tempfile","thiserror 2.0.20",- "toml_edit",+ "toml_edit 0.25.15+spec-1.1.0",][[package]]@@ -2532,6 +2532,7 @@ dependencies = ["cua-spacesd-client","cua-telemetry","cua-vmm",+ "embed-resource","flate2","futures-util","humantime",@@ -3121,7 +3122,7 @@ dependencies = ["thiserror 2.0.20","tokio","tokio-util",- "toml_edit",+ "toml_edit 0.25.15+spec-1.1.0","tracing","url",]@@ -3570,7 +3571,7 @@ dependencies = ["serde_json","sha2 0.10.9","tempfile",- "toml_edit",+ "toml_edit 0.25.15+spec-1.1.0","ureq",]@@ -3700,7 +3701,7 @@ dependencies = ["tempfile","thiserror 2.0.20","tokio",- "toml_edit",+ "toml_edit 0.25.15+spec-1.1.0","tracing","vnc-rs","windows-sys 0.61.2",@@ -4148,6 +4149,20 @@ dependencies = ["serde",]+[[package]]+name = "embed-resource"+version = "2.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d506610004cfc74a6f5ee7e8c632b355de5eca1f03ee5e5e0ec11b77d4eb3d61"+dependencies = [+ "cc",+ "memchr",+ "rustc_version",+ "toml 0.8.23",+ "vswhom",+ "winreg 0.52.0",+]+[[package]]name = "endi"version = "1.1.1"@@ -7100,7 +7115,7 @@ dependencies = ["shared_library","shell-words","winapi",- "winreg",+ "winreg 0.10.1",][[package]]@@ -7167,7 +7182,7 @@ version = "3.5.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"dependencies = [- "toml_edit",+ "toml_edit 0.25.15+spec-1.1.0",][[package]]@@ -8448,6 +8463,15 @@ dependencies = ["syn 3.0.6",]+[[package]]+name = "serde_spanned"+version = "0.6.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"+dependencies = [+ "serde",+]+[[package]]name = "serde_spanned"version = "1.1.1"@@ -9229,6 +9253,18 @@ dependencies = ["tokio",]+[[package]]+name = "toml"+version = "0.8.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"+dependencies = [+ "serde",+ "serde_spanned 0.6.9",+ "toml_datetime 0.6.11",+ "toml_edit 0.22.27",+]+[[package]]name = "toml"version = "0.9.12+spec-1.1.0"@@ -9237,7 +9273,7 @@ checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863"dependencies = ["indexmap","serde_core",- "serde_spanned",+ "serde_spanned 1.1.1","toml_datetime 0.7.5+spec-1.1.0","toml_parser","toml_writer",@@ -9252,13 +9288,22 @@ checksum = "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a"dependencies = ["indexmap","serde_core",- "serde_spanned",+ "serde_spanned 1.1.1","toml_datetime 1.1.1+spec-1.1.0","toml_parser","toml_writer","winnow 1.0.4",]+[[package]]+name = "toml_datetime"+version = "0.6.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"+dependencies = [+ "serde",+]+[[package]]name = "toml_datetime"version = "0.7.5+spec-1.1.0"@@ -9277,6 +9322,20 @@ dependencies = ["serde_core",]+[[package]]+name = "toml_edit"+version = "0.22.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"+dependencies = [+ "indexmap",+ "serde",+ "serde_spanned 0.6.9",+ "toml_datetime 0.6.11",+ "toml_write",+ "winnow 0.7.15",+]+[[package]]name = "toml_edit"version = "0.25.15+spec-1.1.0"@@ -9299,6 +9358,12 @@ dependencies = ["winnow 1.0.4",]+[[package]]+name = "toml_write"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"+[[package]]name = "toml_writer"version = "1.1.2+spec-1.1.0"@@ -9985,6 +10050,26 @@ version = "0.8.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64"+[[package]]+name = "vswhom"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b"+dependencies = [+ "libc",+ "vswhom-sys",+]++[[package]]+name = "vswhom-sys"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150"+dependencies = [+ "cc",+ "libc",+]+[[package]]name = "wait-timeout"version = "0.2.1"@@ -11190,6 +11275,16 @@ dependencies = ["winapi",]+[[package]]+name = "winreg"+version = "0.52.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"+dependencies = [+ "cfg-if",+ "windows-sys 0.48.0",+]+[[package]]name = "wit-bindgen"version = "0.57.1"diff --git a/libs/cua/crates/cua-cli/Cargo.toml b/libs/cua/crates/cua-cli/Cargo.tomlindex 0ac002a289..829381e1d8 100644--- a/libs/cua/crates/cua-cli/Cargo.toml+++ b/libs/cua/crates/cua-cli/Cargo.toml@@ -16,6 +16,10 @@ path = "src/lib.rs"name = "cua"path = "src/main.rs"+[build-dependencies]+# The Windows version resource of cua.exe (build.rs).+embed-resource = "2"+[features]default = []byoc = ["cua-sdk/byoc", "cua-daemon/byoc", "dep:cua-byoc"]diff --git a/libs/cua/crates/cua-cli/build.rs b/libs/cua/crates/cua-cli/build.rsindex 06123ebe12..d7c917a63d 100644--- a/libs/cua/crates/cua-cli/build.rs+++ b/libs/cua/crates/cua-cli/build.rs@@ -2,6 +2,11 @@//! Linux and macOS already give it. Windows defaults to 1 MiB, and the main//! thread parses the command tree and polls the top-level command future,//! which overflowed it (STATUS_STACK_OVERFLOW) in unoptimized builds.+//!+//! Built on Windows, `cua.exe` also gets its version resource (company,+//! description, version), which the Windows Firewall prompt shows as the+//! app's name and publisher ([`version_resource`]). A cross build from+//! another OS skips it: it needs the Windows resource compiler.fn main() {const STACK: u32 = 8 * 1024 * 1024;@@ -14,5 +19,62 @@ fn main() {println!("cargo:rustc-link-arg-bins=-Wl,--stack,{STACK}");}}+ if os == "windows" && cfg!(windows) && env == "msvc" {+ let out = std::path::PathBuf::from(std::env::var("OUT_DIR").expect("OUT_DIR"));+ let version = std::env::var("CARGO_PKG_VERSION").unwrap_or_default();+ let rc = out.join("cua-resources.rc");+ std::fs::write(&rc, version_resource("Cua", "cua", "Cua", &version))+ .expect("write the resource script");+ embed_resource::compile_for(&rc, ["cua"], embed_resource::NONE);+ }println!("cargo:rerun-if-changed=build.rs");}++/// The Windows version resource (`VS_VERSION_INFO`): what Explorer's+/// Details tab and the Windows Firewall prompt show. The prompt reads the+/// name from `FileDescription` and the publisher from `CompanyName`, not+/// from the Authenticode signature, so without it a signed binary showed+/// Publisher "Unknown" (CUA-3515). Numeric constants only, so no Windows+/// SDK header is needed: 1 = VS_VERSION_INFO, 0x40004 = VOS_NT_WINDOWS32,+/// 1 = VFT_APP.+fn version_resource(description: &str, internal: &str, product: &str, version: &str) -> String {+ let mut parts = version+ .split(['.', '-', '+'])+ .map(|p| p.parse::<u16>().unwrap_or(0))+ .chain(std::iter::repeat(0));+ let numeric: Vec<String> = (0..4)+ .map(|_| parts.next().unwrap_or(0).to_string())+ .collect();+ let numeric = numeric.join(",");+ format!(+ r#"1 VERSIONINFO+FILEVERSION {numeric}+PRODUCTVERSION {numeric}+FILEFLAGSMASK 0x3F+FILEFLAGS 0x0+FILEOS 0x40004+FILETYPE 0x1+FILESUBTYPE 0x0+BEGIN+ BLOCK "StringFileInfo"+ BEGIN+ BLOCK "040904B0"+ BEGIN+ VALUE "CompanyName", "Cua AI, Inc."+ VALUE "FileDescription", "{description}"+ VALUE "FileVersion", "{version}"+ VALUE "InternalName", "{internal}"+ VALUE "LegalCopyright", "Copyright (c) 2026 Cua AI, Inc."+ VALUE "OriginalFilename", "{internal}.exe"+ VALUE "ProductName", "{product}"+ VALUE "ProductVersion", "{version}"+ END+ END+ BLOCK "VarFileInfo"+ BEGIN+ VALUE "Translation", 0x409, 1200+ END+END+"#+ )+}diff --git a/libs/cua/crates/cua-cli/tests/windows_version_resource.rs b/libs/cua/crates/cua-cli/tests/windows_version_resource.rsnew file mode 100644index 0000000000..5d3c4fd597--- /dev/null+++ b/libs/cua/crates/cua-cli/tests/windows_version_resource.rs@@ -0,0 +1,33 @@+//! The shipped `cua.exe` carries its version resource: the Windows+//! Firewall prompt names the app from `FileDescription` and its publisher+//! from `CompanyName` (not from the Authenticode signature), so without+//! them it said Publisher "Unknown" (CUA-3515).+#![cfg(target_os = "windows")]++use std::process::Command;++#[test]+fn the_exe_names_cua_ai_as_its_publisher() {+ let exe = env!("CARGO_BIN_EXE_cua");+ let script = format!(+ "$v = (Get-Item -LiteralPath '{}').VersionInfo; \+ \"$($v.CompanyName)|$($v.FileDescription)|$($v.ProductName)|$($v.ProductVersion)\"",+ exe.replace('\'', "''")+ );+ let out = Command::new("powershell")+ .args(["-NoProfile", "-NonInteractive", "-Command", &script])+ .output()+ .expect("powershell");+ assert!(+ out.status.success(),+ "{}",+ String::from_utf8_lossy(&out.stderr)+ );+ let text = String::from_utf8_lossy(&out.stdout).trim().to_string();+ let fields: Vec<&str> = text.split('|').collect();+ assert_eq!(+ fields,+ ["Cua AI, Inc.", "Cua", "Cua", env!("CARGO_PKG_VERSION")],+ "{text}"+ );+}diff --git a/libs/cua/crates/cua-mesh/src/engine.rs b/libs/cua/crates/cua-mesh/src/engine.rsindex 66a0538f48..f277acfd41 100644--- a/libs/cua/crates/cua-mesh/src/engine.rs+++ b/libs/cua/crates/cua-mesh/src/engine.rs@@ -340,12 +340,18 @@ impl Engine {/// (Re)binds the UDP sockets: `port` 0 picks a fresh one.pub(crate) async fn bind(self: &Arc<Self>, port: u16) -> io::Result<()> {let v4 = bind_udp(SocketAddr::from(([0, 0, 0, 0], port)))?;- let v6 = bind_udp(SocketAddr::from((- Ipv6Addr::UNSPECIFIED,- v4.local_addr()?.port(),- )))- .or_else(|_| bind_udp(SocketAddr::from((Ipv6Addr::UNSPECIFIED, 0))))- .ok();+ // IPv6 asks for the same `port`, so an ephemeral request stays+ // ephemeral: never the explicit port number IPv4 was given. Binding+ // every address to an explicit UDP port is what makes Windows+ // Firewall stop and ask the user to allow the app ("Do you want to+ // allow public and private networks to access this app?"), which it+ // did for `cua` and `cua-spacesd` (CUA-3515); an ephemeral bind never+ // asks. Direct paths need no inbound rule: both peers send first, and+ // the firewall lets each one's answers in. The two sockets need not+ // share a port: each one's is advertised (`local_ports`, STUN).+ let v6 = bind_udp(SocketAddr::from((Ipv6Addr::UNSPECIFIED, port)))+ .or_else(|_| bind_udp(SocketAddr::from((Ipv6Addr::UNSPECIFIED, 0))))+ .ok();let mut tasks = Vec::new();for sock in std::iter::once(v4.clone()).chain(v6.clone()) {let weak = Arc::downgrade(self);@@ -1115,7 +1121,7 @@ fn bind_udp(addr: SocketAddr) -> io::Result<Arc<UdpSocket>> {};let s = Socket::new(domain, Type::DGRAM, Some(Protocol::UDP))?;if addr.is_ipv6() {- // Native IPv6 only; IPv4 has its own socket on the same port.+ // Native IPv6 only; IPv4 has its own socket.s.set_only_v6(true)?;}// Best effort: the kernel caps these (net.core.*mem_max on Linux).