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.

Add Windows Arena benchmark apps installation support

f-trycua004c83f9cb9c
diff --git a/libs/qemu-docker/windows/Dockerfile b/libs/qemu-docker/windows/Dockerfile
index 2ff7b51264..f15b06167f 100644
--- a/libs/qemu-docker/windows/Dockerfile
+++ b/libs/qemu-docker/windows/Dockerfile
@@ -1,15 +1,40 @@
+# CUA Windows Container
+#
+# A Windows 11 VM with cua-computer-server for Computer-Use Agents.
+#
+# Build:
+# docker build -t trycua/cua-qemu-windows:latest .
+#
+# With Windows Arena benchmark apps (Chrome, LibreOffice, VLC, etc.):
+# docker build --build-arg INSTALL_WINARENA_APPS=true -t trycua/cua-qemu-windows:latest .
+#
+# Environment variables:
+# INSTALL_WINARENA_APPS - "true" to install benchmark apps (Chrome, LibreOffice, VLC, etc.)
+
FROM trycua/windows-local:latest
+# Build argument for Windows Arena benchmark apps
+ARG INSTALL_WINARENA_APPS=false
+
COPY src/vm/setup/. /oem/
COPY --chmod=755 src/entry.sh /entry.sh
+# VM configuration
ENV RAM_SIZE="8G"
ENV CPU_CORES="8"
ENV VERSION="win11x64-enterprise-eval"
ENV DISK_SIZE="30G"
+
+# Enable QEMU Machine Protocol for VM control
ENV ARGUMENTS="-qmp tcp:0.0.0.0:7200,server,nowait"
+# Pass build arg as env var for setup.ps1 to read
+ENV INSTALL_WINARENA_APPS=${INSTALL_WINARENA_APPS}
+
+# Expose ports:
+# 5000 - cua-computer-server API
+# 8006 - noVNC web interface
EXPOSE 5000 8006
ENTRYPOINT ["/entry.sh"]
\ No newline at end of file
diff --git a/libs/qemu-docker/windows/src/vm/setup/setup-utils.psm1 b/libs/qemu-docker/windows/src/vm/setup/setup-utils.psm1
index 0b5578d6df..c36e598544 100644
--- a/libs/qemu-docker/windows/src/vm/setup/setup-utils.psm1
+++ b/libs/qemu-docker/windows/src/vm/setup/setup-utils.psm1
@@ -59,6 +59,86 @@ function Add-ToEnvPath {
$env:PATH += ";${newPath}"
}
+# =============================================================================
+# Tools Config Helpers (for Windows Arena apps)
+# =============================================================================
+
+function Get-Tools {
+ param(
+ [string]$toolsConfigJson
+ )
+ $toolsList = $toolsConfigJson | ConvertFrom-Json
+ return $toolsList
+}
+
+function Get-ToolDetails {
+ param(
+ $toolsList,
+ [string]$toolName
+ )
+ if ($toolsList.PSObject.Properties.Name -contains $toolName) {
+ return $toolsList.$toolName
+ } else {
+ Write-Host "Tool '$toolName' not found in config."
+ return $null
+ }
+}
+
+function Invoke-DownloadFileFromAvailableMirrors {
+ param (
+ [string[]]$mirrorUrls,
+ [string]$outfile
+ )
+ foreach ($url in $mirrorUrls) {
+ try {
+ $result = Invoke-DownloadFile -url $url -outfile $outfile
+ if ($result -eq $true) {
+ Write-Host "Downloaded using $url"
+ return $true
+ }
+ } catch {
+ Write-Host "Error downloading from $url"
+ }
+ }
+ Write-Host "All mirrors failed for $outfile"
+ return $false
+}
+
+function Invoke-DownloadFile {
+ param (
+ [string]$url,
+ [string]$outfile
+ )
+ $ProgressPreference = "SilentlyContinue"
+ $retryCount = 0
+ $maxRetries = 3
+ $sleepSeconds = 2
+ $userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
+
+ $directory = Split-Path -Path $outfile -Parent
+ if ($directory -and -Not (Test-Path -Path $directory)) {
+ New-Item -Path $directory -ItemType Directory -Force | Out-Null
+ }
+
+ while ($retryCount -lt $maxRetries) {
+ try {
+ Invoke-RestMethod -Uri $url -OutFile $outfile -Headers @{"User-Agent" = $userAgent}
+ Write-Host "Download successful: $outfile"
+ return $true
+ } catch {
+ $retryCount++
+ Write-Host "Attempt $retryCount of $maxRetries failed: $($_.Exception.Message)"
+ Start-Sleep -Seconds $sleepSeconds
+ $sleepSeconds = [Math]::Min($sleepSeconds * 2, 10)
+ }
+ }
+ return $false
+}
+
+# =============================================================================
+# Scheduled Task Helpers
+# =============================================================================
+
function Register-LogonTask {
param(
diff --git a/libs/qemu-docker/windows/src/vm/setup/setup.ps1 b/libs/qemu-docker/windows/src/vm/setup/setup.ps1
index 85c0aff37a..af8614b8f2 100644
--- a/libs/qemu-docker/windows/src/vm/setup/setup.ps1
+++ b/libs/qemu-docker/windows/src/vm/setup/setup.ps1
@@ -9,6 +9,35 @@ Set-StrictMode -Version Latest
# Set TLS version to 1.2 or higher
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
+# =============================================================================
+# Check if we should install Windows Arena benchmark apps
+# Set INSTALL_WINARENA_APPS=true to install Chrome, LibreOffice, VLC, etc.
+# =============================================================================
+$installWinarenaApps = $false
+$configFilePath = Join-Path $scriptFolder -ChildPath "install_config.json"
+if ($env:INSTALL_WINARENA_APPS -eq "true") {
+ $installWinarenaApps = $true
+} elseif (Test-Path $configFilePath) {
+ try {
+ $config = Get-Content -Path $configFilePath -Raw | ConvertFrom-Json
+ if ($config.INSTALL_WINARENA_APPS -eq $true) {
+ $installWinarenaApps = $true
+ }
+ } catch {
+ Write-Host "Warning: Could not read install_config.json"
+ }
+}
+
+Write-Host "============================================"
+Write-Host "CUA Windows Setup"
+Write-Host "============================================"
+Write-Host "Install Windows Arena Apps: $installWinarenaApps"
+Write-Host ""
+
+# =============================================================================
+# CORE: Git (always installed)
+# =============================================================================
+
# Install Git via Chocolatey
$ChocoExe = Resolve-ChocoPath
if ($ChocoExe) {
@@ -46,4 +75,176 @@ if (Get-ScheduledTask -TaskName $onLogonTaskName -ErrorAction SilentlyContinue)
Start-Sleep -Seconds 10
Write-Host "Starting $onLogonTaskName task in background..."
-Start-Process -WindowStyle Hidden -FilePath "powershell.exe" -ArgumentList "-Command", "Start-ScheduledTask -TaskName '$onLogonTaskName'"
\ No newline at end of file
+Start-Process -WindowStyle Hidden -FilePath "powershell.exe" -ArgumentList "-Command", "Start-ScheduledTask -TaskName '$onLogonTaskName'"
+
+# =============================================================================
+# OPTIONAL: Windows Arena Benchmark Apps
+# =============================================================================
+if ($installWinarenaApps) {
+ Write-Host ""
+ Write-Host "============================================"
+ Write-Host "Installing Windows Arena benchmark apps..."
+ Write-Host "============================================"
+
+ # Load tools config
+ $toolsConfigJsonPath = Join-Path $scriptFolder -ChildPath "tools_config.json"
+ if (-not (Test-Path $toolsConfigJsonPath)) {
+ Write-Host "Warning: tools_config.json not found, skipping app installation"
+ } else {
+ $toolsConfigJson = Get-Content -Path $toolsConfigJsonPath -Raw
+ $toolsList = Get-Tools -toolsConfigJson $toolsConfigJson
+
+ # --- 7zip ---
+ Write-Host "Installing 7-Zip..."
+ $7ZipToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "7zip"
+ if ($7ZipToolDetails -and -not (Get-Command 7z -ErrorAction SilentlyContinue)) {
+ $7ZipInstallerFilePath = "$env:TEMP\7_zip.exe"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $7ZipToolDetails.mirrors -outfile $7ZipInstallerFilePath
+ if ($downloadResult) {
+ Start-Process -FilePath $7ZipInstallerFilePath -Args "/S" -Verb RunAs -Wait
+ Remove-Item $7ZipInstallerFilePath -ErrorAction SilentlyContinue
+ Add-ToEnvPath -NewPath "${env:ProgramFiles}\7-Zip"
+ Write-Host "[OK] 7-Zip installed"
+ }
+ } else {
+ Write-Host "[OK] 7-Zip already installed"
+ }
+
+ # --- ffmpeg ---
+ Write-Host "Installing ffmpeg..."
+ $ffmpegToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "ffmpeg"
+ if ($ffmpegToolDetails -and -not (Get-Command ffmpeg -ErrorAction SilentlyContinue)) {
+ $ffmpegInstallerFilePath = "C:\ffmpeg.7z"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $ffmpegToolDetails.mirrors -outfile $ffmpegInstallerFilePath
+ if ($downloadResult) {
+ & 7z x -y -o"C:\" "C:\ffmpeg.7z" | Out-Null
+ $ffmpegFolder = Get-ChildItem -Path "C:\" -Filter "ffmpeg-*" -Directory | Select-Object -First 1
+ if ($ffmpegFolder) {
+ if (Test-Path "C:\ffmpeg") { Remove-Item -Path "C:\ffmpeg" -Recurse -Force }
+ Rename-Item -Path $ffmpegFolder.FullName -NewName "ffmpeg"
+ Add-ToEnvPath -NewPath "C:\ffmpeg\bin"
+ }
+ Remove-Item $ffmpegInstallerFilePath -ErrorAction SilentlyContinue
+ Write-Host "[OK] ffmpeg installed"
+ }
+ } else {
+ Write-Host "[OK] ffmpeg already installed"
+ }
+
+ # --- Google Chrome ---
+ Write-Host "Installing Google Chrome..."
+ $chromeToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "Google Chrome"
+ $chromeExePath = "C:\Program Files\Google\Chrome\Application\chrome.exe"
+ if ($chromeToolDetails -and -not (Test-Path $chromeExePath)) {
+ $chromeInstallerFilePath = "$env:TEMP\chrome_installer.exe"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $chromeToolDetails.mirrors -outfile $chromeInstallerFilePath
+ if ($downloadResult) {
+ Start-Process -FilePath $chromeInstallerFilePath -ArgumentList "/silent", "/install" -Verb RunAs -Wait
+ Remove-Item -Path $chromeInstallerFilePath -ErrorAction SilentlyContinue
+ Add-ToEnvPath -NewPath "${env:ProgramFiles}\Google\Chrome\Application"
+ # Disable auto updates
+ $chromeRegPath = "HKLM:\SOFTWARE\Policies\Google\Update"
+ if (-not (Test-Path $chromeRegPath)) { New-Item -Path $chromeRegPath -Force | Out-Null }
+ Set-ItemProperty -Path $chromeRegPath -Name "AutoUpdateCheckPeriodMinutes" -Value 0
+ Set-ItemProperty -Path $chromeRegPath -Name "UpdateDefault" -Value 0
+ Write-Host "[OK] Chrome installed"
+ }
+ } else {
+ Write-Host "[OK] Chrome already installed"
+ }
+
+ # --- LibreOffice ---
+ Write-Host "Installing LibreOffice..."
+ $libreOfficeToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "LibreOffice"
+ $installedVersion = (Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name like 'LibreOffice%'" -ErrorAction SilentlyContinue).Version
+ if ($libreOfficeToolDetails -and [string]::IsNullOrWhiteSpace($installedVersion)) {
+ $libreOfficeInstallerFilePath = "$env:TEMP\libreOffice_installer.msi"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $libreOfficeToolDetails.mirrors -outfile $libreOfficeInstallerFilePath
+ if ($downloadResult) {
+ Start-Process "msiexec.exe" -ArgumentList "/i `"$libreOfficeInstallerFilePath`" /quiet" -Wait -NoNewWindow
+ Add-ToEnvPath -NewPath "C:\Program Files\LibreOffice\program"
+ Write-Host "[OK] LibreOffice installed"
+ }
+ } else {
+ Write-Host "[OK] LibreOffice already installed"
+ }
+
+ # --- VLC ---
+ Write-Host "Installing VLC..."
+ $vlcToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "VLC"
+ $vlcExecutableFilePath = "C:\Program Files\VideoLAN\VLC\vlc.exe"
+ if ($vlcToolDetails -and -not (Test-Path $vlcExecutableFilePath)) {
+ $vlcInstallerFilePath = "$env:TEMP\vlc_installer.exe"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $vlcToolDetails.mirrors -outfile $vlcInstallerFilePath
+ if ($downloadResult) {
+ Start-Process -FilePath $vlcInstallerFilePath -ArgumentList "/S" -Verb RunAs -Wait
+ Remove-Item -Path $vlcInstallerFilePath -ErrorAction SilentlyContinue
+ Add-ToEnvPath -NewPath "C:\Program Files\VideoLAN\VLC"
+ Write-Host "[OK] VLC installed"
+ }
+ } else {
+ Write-Host "[OK] VLC already installed"
+ }
+
+ # --- GIMP ---
+ Write-Host "Installing GIMP..."
+ $gimpToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "GIMP"
+ $gimpExecutablePath = "C:\Program Files\GIMP 2\bin\gimp-2.10.exe"
+ if ($gimpToolDetails -and -not (Test-Path $gimpExecutablePath)) {
+ $gimpInstallerFilePath = "$env:TEMP\gimp_installer.exe"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $gimpToolDetails.mirrors -outfile $gimpInstallerFilePath
+ if ($downloadResult) {
+ Start-Process -FilePath $gimpInstallerFilePath -ArgumentList "/VERYSILENT /ALLUSERS" -Verb RunAs -Wait
+ Remove-Item -Path $gimpInstallerFilePath -ErrorAction SilentlyContinue
+ Add-ToEnvPath -NewPath "C:\Program Files\GIMP 2\bin"
+ Write-Host "[OK] GIMP installed"
+ }
+ } else {
+ Write-Host "[OK] GIMP already installed"
+ }
+
+ # --- VS Code ---
+ Write-Host "Installing VS Code..."
+ $vsCodeToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "VS Code"
+ $vsCodeExecutablePath = "C:\Users\$env:USERNAME\AppData\Local\Programs\Microsoft VS Code\Code.exe"
+ if ($vsCodeToolDetails -and -not (Test-Path $vsCodeExecutablePath)) {
+ $vsCodeInstallerFilePath = "$env:TEMP\VSCodeSetup.exe"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $vsCodeToolDetails.mirrors -outfile $vsCodeInstallerFilePath
+ if ($downloadResult) {
+ Start-Process -FilePath $vsCodeInstallerFilePath -ArgumentList "/VERYSILENT", "/mergetasks=!runcode" -Verb RunAs -Wait
+ Remove-Item -Path $vsCodeInstallerFilePath -ErrorAction SilentlyContinue
+ Add-ToEnvPath -NewPath "C:\Users\$env:USERNAME\AppData\Local\Programs\Microsoft VS Code\bin"
+ Write-Host "[OK] VS Code installed"
+ }
+ } else {
+ Write-Host "[OK] VS Code already installed"
+ }
+
+ # --- Thunderbird ---
+ Write-Host "Installing Thunderbird..."
+ $thunderbirdToolDetails = Get-ToolDetails -toolsList $toolsList -toolName "Thunderbird"
+ $thunderbirdExecutablePath = "C:\Program Files\Mozilla Thunderbird\thunderbird.exe"
+ if ($thunderbirdToolDetails -and -not (Test-Path $thunderbirdExecutablePath)) {
+ $thunderbirdInstallerFilePath = "$env:TEMP\ThunderbirdSetup.exe"
+ $downloadResult = Invoke-DownloadFileFromAvailableMirrors -mirrorUrls $thunderbirdToolDetails.mirrors -outfile $thunderbirdInstallerFilePath
+ if ($downloadResult) {
+ Start-Process -FilePath $thunderbirdInstallerFilePath -ArgumentList "/S" -Verb RunAs -Wait
+ Remove-Item -Path $thunderbirdInstallerFilePath -ErrorAction SilentlyContinue
+ Add-ToEnvPath -NewPath "C:\Program Files\Mozilla Thunderbird"
+ Write-Host "[OK] Thunderbird installed"
+ }
+ } else {
+ Write-Host "[OK] Thunderbird already installed"
+ }
+
+ Write-Host ""
+ Write-Host "[OK] Windows Arena apps installation complete"
+ }
+} else {
+ Write-Host "Skipping Windows Arena apps (minimal install)"
+}
+
+Write-Host ""
+Write-Host "============================================"
+Write-Host "CUA Windows Setup Complete!"
+Write-Host "============================================"
\ No newline at end of file
diff --git a/libs/qemu-docker/windows/src/vm/setup/tools_config.json b/libs/qemu-docker/windows/src/vm/setup/tools_config.json
new file mode 100644
index 0000000000..f175bb70a0
--- /dev/null
+++ b/libs/qemu-docker/windows/src/vm/setup/tools_config.json
@@ -0,0 +1,52 @@
+{
+ "7zip": {
+ "mirrors": [
+ "https://www.7-zip.org/a/7z2409-x64.exe"
+ ]
+ },
+ "ffmpeg": {
+ "mirrors": [
+ "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.7z"
+ ]
+ },
+ "Google Chrome": {
+ "mirrors": [
+ "https://dl.google.com/chrome/install/latest/chrome_installer.exe"
+ ],
+ "alias": "google-chrome"
+ },
+ "LibreOffice": {
+ "mirrors": [
+ "https://download.documentfoundation.org/libreoffice/stable/25.8.4/win/x86_64/LibreOffice_25.8.4_Win_x86-64.msi",
+ "https://mirrors.dotsrc.org/tdf/libreoffice/stable/25.8.4/win/x86_64/LibreOffice_25.8.4_Win_x86-64.msi",
+ "https://ftp.halifax.rwth-aachen.de/tdf/libreoffice/stable/25.8.4/win/x86_64/LibreOffice_25.8.4_Win_x86-64.msi"
+ ]
+ },
+ "VLC": {
+ "mirrors": [
+ "https://southfront.mm.fcix.net/videolan-ftp/vlc/3.0.21/win64/vlc-3.0.21-win64.exe",
+ "https://mirror.fcix.net/videolan-ftp/vlc/3.0.21/win64/vlc-3.0.21-win64.exe"
+ ],
+ "alias": "vlc"
+ },
+ "GIMP": {
+ "mirrors": [
+ "https://download.gimp.org/gimp/v3.0/windows/gimp-3.0.6-setup.exe",
+ "https://www-ftp.lip6.fr/pub/gimp/gimp/v3.0/windows/gimp-3.0.6-setup.exe"
+ ],
+ "alias": "gimp"
+ },
+ "VS Code": {
+ "mirrors": [
+ "https://update.code.visualstudio.com/latest/win32-x64-user/stable"
+ ],
+ "alias": "code"
+ },
+ "Thunderbird": {
+ "mirrors": [
+ "https://download.mozilla.org/?product=thunderbird-128.5.2esr-SSL&os=win64&lang=en-US",
+ "https://archive.mozilla.org/pub/thunderbird/releases/128.5.2esr/win64/en-US/Thunderbird%20Setup%20128.5.2esr.exe"
+ ],
+ "alias": "thunderbird"
+ }
+}