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-driver): strip UTF-8 BOM from uninstall.ps1
Francesco Bonaccida44420193b5
diff --git a/.github/scripts/tests/test_cua_fleet_release_wiring.py b/.github/scripts/tests/test_cua_fleet_release_wiring.pyindex ee4fe391da..72e4bfdc10 100644--- a/.github/scripts/tests/test_cua_fleet_release_wiring.py+++ b/.github/scripts/tests/test_cua_fleet_release_wiring.py@@ -10,14 +10,14 @@ REPO_ROOT = Path(__file__).resolve().parents[3]class TestCuaFleetReleaseWiring(unittest.TestCase):"""Keep Fleet's promotion workflow aligned with canonical SDK wheels."""- def test_publisher_promotes_cua_fleet_0_1_8(self) -> None:+ def test_publisher_promotes_cua_fleet_0_1_11(self) -> None:workflow = (REPO_ROOT / ".github/workflows/cd-py-fleet.yml").read_text()expected_sources = {- "cua_fleet-0.1.8-py3-none-manylinux_2_34_x86_64.whl": "0bac329552d351604ad15b7eb4f4f3ed944921083238d74f51277d657d8f0a34",- "cua_fleet-0.1.8-py3-none-manylinux_2_34_aarch64.whl": "d7604668a7186d06cefb2bd23974b033c0b2cda61ccbe88d944af622b37f58d3",- "cua_fleet-0.1.8-py3-none-macosx_10_12_x86_64.whl": "20611a14c185157e6f41502e1bbdcc1e98663347e94463ca538755b0efc173bb",- "cua_fleet-0.1.8-py3-none-macosx_11_0_arm64.whl": "7c21d0a36a8d74bfe0768422e4f3d9367ee51837920e2c22ee57521fc93c4f3b",- "cua_fleet-0.1.8-py3-none-win_amd64.whl": "d78fe6934a2f650dcf5b105a08833418245c720765da9c3b40e160b86a3d203d",+ "cua_fleet-0.1.11-py3-none-manylinux_2_34_x86_64.whl": "0539a40aac915368362dd2f3e90d4b6d233e7bece77d13a5733d8cecb7298731",+ "cua_fleet-0.1.11-py3-none-manylinux_2_34_aarch64.whl": "c76052d9cb1710936a59709fd5a2894fe9fb43fe89e2a0313ad0b88faf4c2b1e",+ "cua_fleet-0.1.11-py3-none-macosx_10_12_x86_64.whl": "5884a26388b44e9cf59314d20b9aae34f278c48b108d927ebaf802b8d5b7d7f6",+ "cua_fleet-0.1.11-py3-none-macosx_11_0_arm64.whl": "1f6d1532f76166fe30001c68765c4f3fcb94e9b713751f7a009d3780f523aa9c",+ "cua_fleet-0.1.11-py3-none-win_amd64.whl": "da8e1c40abcd3fee5cdab48801d4bd43a277ecddb7afebcba3d9885d9ec5d431",}self.assertIn("https://wheels.cua.ai/simple/cua-fleet/$WHEEL", workflow)diff --git a/.github/scripts/tests/test_driver_script_encoding.py b/.github/scripts/tests/test_driver_script_encoding.pynew file mode 100644index 0000000000..4892ce7f51--- /dev/null+++ b/.github/scripts/tests/test_driver_script_encoding.py@@ -0,0 +1,77 @@+"""Guards the encoding of the Cua Driver scripts served for remote execution.++The documented install/uninstall one-liners pipe a downloaded script straight+into an interpreter:++ irm https://cua.ai/driver/uninstall.ps1 | iex+ curl -fsSL https://cua.ai/driver/install.sh | sh++On that path a leading UTF-8 BOM is not consumed as an encoding signal. `irm`+decodes it into a literal U+FEFF at the head of the string, so `#` no longer+opens a comment on line 1 and PowerShell tokenizes the header comment as code.+That is the defect fixed in #3174, where the header text `(Windows)` was+evaluated as a command and the one-liner exited non-zero on a successful+uninstall.++Running the same file from disk hides the problem, because PowerShell treats a+leading BOM as a valid encoding signal when reading a script file. A BOM is+also invisible in review and in the GitHub diff view, and editors that default+to UTF-8-with-BOM on Windows can reintroduce one silently. Hence this guard.+"""++from __future__ import annotations++from pathlib import Path++import pytest+++REPO_ROOT = Path(__file__).resolve().parents[3]+DRIVER_SCRIPTS = REPO_ROOT / "libs/cua-driver/scripts"++UTF8_BOM = b"\xef\xbb\xbf"++# Scripts published as release assets and fetched by the documented one-liners.+# Named explicitly so a rename or deletion fails loudly instead of quietly+# shrinking the globbed set below.+REMOTELY_EXECUTED_SCRIPTS = (+ "install.ps1",+ "uninstall.ps1",+ "install.sh",+ "uninstall.sh",+)+++def driver_scripts() -> list[Path]:+ return sorted(+ path+ for pattern in ("*.ps1", "*.sh")+ for path in DRIVER_SCRIPTS.glob(pattern)+ )++[email protected]("name", REMOTELY_EXECUTED_SCRIPTS)+def test_remotely_executed_script_exists(name: str):+ assert (DRIVER_SCRIPTS / name).is_file(), (+ f"{name} is missing from {DRIVER_SCRIPTS.relative_to(REPO_ROOT)}; "+ "update REMOTELY_EXECUTED_SCRIPTS if it was intentionally renamed"+ )+++def test_driver_scripts_are_discovered():+ """A glob that matches nothing would make the BOM assertions vacuous."""+ discovered = {path.name for path in driver_scripts()}+ assert discovered, f"no scripts found under {DRIVER_SCRIPTS}"+ assert set(REMOTELY_EXECUTED_SCRIPTS) <= discovered+++ "script", driver_scripts(), ids=lambda path: path.name+)+def test_driver_script_has_no_utf8_bom(script: Path):+ head = script.read_bytes()[: len(UTF8_BOM)]+ assert head != UTF8_BOM, (+ f"{script.relative_to(REPO_ROOT)} starts with a UTF-8 BOM. "+ "Rewrite it as UTF-8 without BOM: a BOM breaks the documented "+ "`irm ... | iex` and `curl ... | sh` one-liners (see #3174)."+ )diff --git a/libs/cua-driver/scripts/uninstall.ps1 b/libs/cua-driver/scripts/uninstall.ps1index 11cc5fd7e4..c86cb7679e 100644--- a/libs/cua-driver/scripts/uninstall.ps1+++ b/libs/cua-driver/scripts/uninstall.ps1@@ -1,4 +1,4 @@-# cua-driver-rs uninstaller (Windows) — removes the runtime installed by install.ps1+# cua-driver-rs uninstaller (Windows) — removes the runtime installed by install.ps1# laid down: the Scheduled Task autostart entry, running daemon# processes, the directory junctions wiring the visible bin dir back to# a per-version release dir, the entire package home tree, and any skill