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(install): fail early with a clear message when the installed CLI has no host setup --pair (CUA-1748) (#5296)
Francesco Bonaccic6cb386cf371
diff --git a/scripts/install/install.ps1 b/scripts/install/install.ps1index 498cf389be..71d7f40a54 100644--- a/scripts/install/install.ps1+++ b/scripts/install/install.ps1@@ -471,6 +471,13 @@ function Invoke-HostPair([string]$Cua) {$pairArgs = @('host', 'setup', '--pair', $Pair)if ($Relay) { $pairArgs += @('--relay', $Relay) }if ($DryRun) { Write-Host "[dry-run] $Cua $($pairArgs -join ' ')"; return }+ # A CLI released before pairing exists would fail with a bare+ # "unexpected argument '--pair'"; say what to do instead.+ $setupHelp = (& $Cua host setup --help 2>&1 | Out-String)+ if ($setupHelp -notmatch '--pair') {+ $have = (& $Cua --version 2>&1 | Out-String).Trim()+ Stop-Install "the installed cua CLI ($have) cannot add a machine with a code (no 'cua host setup --pair'); install a newer release (-Version) or sign in instead: cua auth login; cua host setup"+ }Write-Info 'adding this machine to your account (cua host setup --pair)'$null | & $Cua @pairArgsif ($LASTEXITCODE -ne 0) { Stop-Install 'adding this machine did not finish; if the code expired or was used, make a new one in Cua Spaces (Add a machine) and run: cua host setup --pair <code>' }diff --git a/scripts/install/install.sh b/scripts/install/install.shindex 37d44e2570..1f0cda587e 100755--- a/scripts/install/install.sh+++ b/scripts/install/install.sh@@ -907,6 +907,11 @@ host_pair() {say "[dry-run] $*"returnfi+ # A CLI released before pairing exists would fail with a bare+ # "unexpected argument '--pair'"; say what to do instead.+ if ! "$cua_bin" host setup --help 2>&1 </dev/null | grep -q -e '--pair'; then+ die "the installed cua CLI ($("$cua_bin" --version 2>/dev/null || echo unknown)) cannot add a machine with a code (no 'cua host setup --pair'); update the CLI (cua update, or install a newer release: --version) or sign in instead: cua auth login && cua host setup"+ fiinfo "adding this machine to your account (cua host setup --pair)"if "$@" </dev/null; thensay ""diff --git a/scripts/install/tests/run.sh b/scripts/install/tests/run.shindex 26e9eb7e44..d66fa27a68 100755--- a/scripts/install/tests/run.sh+++ b/scripts/install/tests/run.sh@@ -54,6 +54,11 @@ make_cua() { # dir platformcat >"$1/cua" <<EOF#!/bin/shif [ "\${1:-}" = --version ]; then echo "cua $version ($2)"; exit 0; fi+if [ "\${1:-} \${2:-} \${3:-}" = "host setup --help" ]; then+ echo "Usage: cua host setup [OPTIONS]"+ [ -n "\${CUA_FAKE_NO_PAIR:-}" ] || echo " --pair <CODE> add this machine with a code"+ exit 0+fiecho "\$*" >>"\${CUA_FAKE_LOG:-/dev/null}"EOFchmod +x "$1/cua"@@ -213,6 +218,9 @@ check "--only host: runs 'cua host setup', no app" sh -c "[ $status = 0 ] && greinst -- --pair k7qm-4xpb-2rhd --prefix "$work/pr1"check "--pair: runs 'cua host setup --pair', no sign-in, no checklist" sh -c "[ $status = 0 ] && grep -qx 'host setup --pair k7qm-4xpb-2rhd' '$home/cua.log' && ! grep -q 'auth login' '$home/cua.log' && grep -q 'This machine is added' '$work/out'"+inst CUA_FAKE_NO_PAIR=1 -- --pair K7QM-4XPB-2RHD --prefix "$work/pr0"+check "--pair: a CLI without 'host setup --pair' fails early with a clear message" sh -c "[ $status != 0 ] && grep -q \"no 'cua host setup --pair'\" '$work/out' && ! grep -q 'host setup --pair' '$home/cua.log' 2>/dev/null"+inst -- --pair K7QM-4XPB-2RHD --relay https://relay.example.com --cli-only --prefix "$work/pr2"check "--pair --relay --cli-only: passes the relay on" sh -c "[ $status = 0 ] && grep -qx 'host setup --pair K7QM-4XPB-2RHD --relay https://relay.example.com' '$home/cua.log'"