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
ci(cua-driver): run the jev-use deterministic proof on macOS and Windows (#4228)
Francesco Bonacci7f67737b5c64
diff --git a/.github/scripts/tests/test_ci_jev_use_workflow.py b/.github/scripts/tests/test_ci_jev_use_workflow.pynew file mode 100644index 0000000000..60194b580b--- /dev/null+++ b/.github/scripts/tests/test_ci_jev_use_workflow.py@@ -0,0 +1,87 @@+"""Keep the jev-use released-Driver proof on macOS and Windows secret-free and user-shaped."""++from pathlib import Path++import yaml+++ROOT = Path(__file__).resolve().parents[3]+WORKFLOW = ROOT / ".github/workflows/ci-jev-use.yml"+STANDARD_USER_SCRIPTS = (+ "scripts/ci/windows/invoke-standard-user-token.ps1",+ "scripts/ci/windows/run-jev-use-standard-user.ps1",+)+++def load() -> dict:+ return yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))+++def job_text(name: str) -> str:+ """Return the raw YAML of one top-level job, so script bodies compare verbatim."""+ text = WORKFLOW.read_text(encoding="utf-8").split(f"\n {name}:\n", 1)[1]+ lines = []+ for line in text.splitlines():+ if line and not line.startswith(" "):+ break+ lines.append(line)+ return "\n".join(lines)+++def test_workflow_is_read_only_and_never_reads_secrets() -> None:+ workflow = load()+ assert workflow["permissions"] == {"contents": "read"}+ assert "secrets." not in WORKFLOW.read_text(encoding="utf-8")+ assert "pull_request_target" not in workflow[True]+++def test_released_driver_jobs_run_on_hosted_macos_and_windows() -> None:+ jobs = load()["jobs"]+ assert jobs["released-driver-macos"]["runs-on"].startswith("macos-")+ assert jobs["released-driver-windows"]["runs-on"].startswith("windows-")+++def test_released_driver_jobs_use_the_canonical_installers() -> None:+ macos = job_text("released-driver-macos")+ windows = job_text("released-driver-windows")+ assert "https://cua.ai/driver/install.sh" in macos+ assert "cargo build" not in macos+ assert "https://cua.ai/driver/install.ps1" in windows+ assert "-NoAutoStart" in windows+ assert "cargo build" not in windows+++def test_released_driver_jobs_run_both_languages_and_audit_the_state_oracle() -> None:+ for name in ("released-driver-macos", "released-driver-windows"):+ text = job_text(name)+ assert '"observed"] == {"submitted": "jev-guide-mock"}' in text, name+ assert '("typescript", "mock", "verified")' in text, name+ assert "verify_setup.py --typescript" in job_text("released-driver-macos")+ inner = (ROOT / STANDARD_USER_SCRIPTS[1]).read_text(encoding="utf-8")+ assert "verify_setup.py --typescript" in inner+++def test_windows_proof_runs_from_a_standard_user_token() -> None:+ windows = job_text("released-driver-windows")+ assert "verify-user-session.ps1" in windows+ assert "invoke-standard-user-token.ps1" in windows+ assert "run-jev-use-standard-user.ps1" in windows+ helper = (ROOT / STANDARD_USER_SCRIPTS[0]).read_text(encoding="utf-8")+ assert "SAFER_LEVELID_NORMALUSER = 0x20000" in helper+ inner = (ROOT / STANDARD_USER_SCRIPTS[1]).read_text(encoding="utf-8")+ assert "WindowsBuiltInRole]::Administrator" in inner+ assert "deny only" in inner+++def test_helper_scripts_trigger_the_workflow() -> None:+ triggers = load()[True]+ for event in ("pull_request", "push"):+ for path in STANDARD_USER_SCRIPTS:+ assert path in triggers[event]["paths"], (event, path)+++def test_macos_seeds_tcc_only_for_the_released_app_identity() -> None:+ macos = job_text("released-driver-macos")+ assert "seed-tcc-guest.sh" in macos+ assert "--app /Applications/CuaDriver.app --expected-client com.trycua.driver\n" in macos+ assert "install-local.sh" not in macosdiff --git a/.github/workflows/ci-jev-use.yml b/.github/workflows/ci-jev-use.ymlindex b394eb5cec..3788e5ccf2 100644--- a/.github/workflows/ci-jev-use.yml+++ b/.github/workflows/ci-jev-use.yml@@ -11,6 +11,8 @@ on:- ".github/workflows/ci-jev-use.yml"- ".github/workflows/authorized-live-jev-use.yml"- ".github/workflows/authorized-live-jev-use-demo.yml"+ - "scripts/ci/windows/invoke-standard-user-token.ps1"+ - "scripts/ci/windows/run-jev-use-standard-user.ps1"push:branches: [main]paths:@@ -22,8 +24,12 @@ on:- ".github/workflows/ci-jev-use.yml"- ".github/workflows/authorized-live-jev-use.yml"- ".github/workflows/authorized-live-jev-use-demo.yml"+ - "scripts/ci/windows/invoke-standard-user-token.ps1"+ - "scripts/ci/windows/run-jev-use-standard-user.ps1"workflow_dispatch:+# Pull request code runs only on disposable GitHub-hosted runners. No job in+# this workflow reads a secret.permissions:contents: read@@ -287,3 +293,217 @@ jobs:${{ runner.temp }}/jev-use-mock-proof/visual-fixture/*.jsonlif-no-files-found: errorretention-days: 14++ # macOS and Windows prove the example against the released Driver, installed+ # through the canonical installers exactly as the guide tells users to. The+ # candidate-source build above stays Linux-only.+ released-driver-macos:+ name: macOS released Driver mock E2E+ runs-on: macos-26+ timeout-minutes: 45+ env:+ CUA_DRIVER_BIN: /Applications/CuaDriver.app/Contents/MacOS/cua-driver+ steps:+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ with:+ ref: ${{ github.event.pull_request.head.sha || github.sha }}+ persist-credentials: false+ - uses: actions/setup-python@v5+ with:+ python-version: "3.12"+ - uses: astral-sh/setup-uv@v6+ with:+ version: "0.8.15"+ enable-cache: true+ cache-dependency-glob: libs/cua-driver/examples/jev-use/uv.lock+ - uses: actions/setup-node@v4+ with:+ node-version: "22"+ cache: npm+ cache-dependency-path: libs/cua-driver/examples/jev-use/package-lock.json+ - name: Install the released Driver with the canonical installer+ working-directory: ${{ github.workspace }}+ env:+ CUA_DRIVER_NO_MODIFY_PATH: "1"+ run: |+ /bin/bash -c "$(curl -fsSL https://cua.ai/driver/install.sh)"+ "$CUA_DRIVER_BIN" --version+ codesign --verify --strict /Applications/CuaDriver.app+ test -x "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"+ - name: Install locked example dependencies+ run: |+ uv sync --frozen+ npm ci --ignore-scripts+ - name: Grant the released Driver its TCC permissions+ working-directory: ${{ github.workspace }}+ run: |+ # Driver gates every action, including browser_prepare, on its+ # Accessibility and Screen Recording grants, which a user approves+ # in System Settings. Hosted macOS runners are disposable SIP-off+ # VirtualMacs, so seed those two grants for the released,+ # Developer ID-signed app only. The seeder binds each grant to the+ # app's designated requirement; no pull request code receives them.+ "$CUA_DRIVER_BIN" stop >/dev/null 2>&1 || true+ bash libs/cua-driver/tests/runners/macos-lume/seed-tcc-guest.sh \+ --app /Applications/CuaDriver.app --expected-client com.trycua.driver+ open -n -g -a CuaDriver --args serve+ for _ in $(seq 1 60); do+ if "$CUA_DRIVER_BIN" permissions status --json > "$RUNNER_TEMP/permissions.json" 2>/dev/null \+ && jq -e '.accessibility == true and .screen_recording == true' "$RUNNER_TEMP/permissions.json" >/dev/null; then+ break+ fi+ sleep 1+ done+ cat "$RUNNER_TEMP/permissions.json"+ jq -e '.accessibility == true and .screen_recording == true' "$RUNNER_TEMP/permissions.json" >/dev/null+ "$CUA_DRIVER_BIN" status+ - name: Run both mock agents through MCP+ run: |+ uv run --frozen python verify_mcp_tools.py+ uv run --frozen python verify_setup.py --typescript --output-dir "$RUNNER_TEMP/jev-use-mock-proof"+ - name: Audit redacted E2E evidence+ run: |+ uv run --frozen python - "$RUNNER_TEMP/jev-use-mock-proof" <<'PY'+ import json, pathlib, sys+ root = pathlib.Path(sys.argv[1])+ summary = json.loads((root / "summary.json").read_text())+ assert summary["complete"] is True+ assert summary["live_requested"] is False+ assert summary["typescript_requested"] is True+ assert {(item["language"], item["provider"], item["outcome"]) for item in summary["checks"]} == {+ ("python", "mock", "verified"), ("typescript", "mock", "verified")+ }+ # verify_setup.py read the fixture's /state endpoint itself; the+ # runners' own outcome events are not the oracle.+ assert all(item["observed"] == {"submitted": "jev-guide-mock"} for item in summary["checks"])+ assert all(item["acted_path"] == "page_structure" for item in summary["checks"])+ assert all(item["submit_tool"] == "browser_click" for item in summary["checks"])+ forbidden = ("typesafe_api_key", "authorization", "environment", "image_base64", "screenshot")+ for path in root.iterdir():+ if path.name == "summary.json" or path.suffix == ".jsonl":+ text = path.read_text().lower()+ assert not any(value in text for value in forbidden), path+ PY+ - name: Stop the Driver daemon+ if: always()+ run: '"$CUA_DRIVER_BIN" stop || true'+ - name: Upload redacted action evidence+ if: always()+ uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4+ with:+ name: jev-use-macos-released-mock+ path: |+ ${{ runner.temp }}/jev-use-mock-proof/summary.json+ ${{ runner.temp }}/jev-use-mock-proof/*.jsonl+ if-no-files-found: error+ retention-days: 14++ released-driver-windows:+ name: Windows released Driver mock E2E+ runs-on: windows-latest+ timeout-minutes: 45+ defaults:+ run:+ shell: pwsh+ working-directory: libs/cua-driver/examples/jev-use+ steps:+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ with:+ ref: ${{ github.event.pull_request.head.sha || github.sha }}+ persist-credentials: false+ - uses: actions/setup-python@v5+ with:+ python-version: "3.12"+ - uses: astral-sh/setup-uv@v6+ with:+ version: "0.8.15"+ enable-cache: true+ cache-dependency-glob: libs/cua-driver/examples/jev-use/uv.lock+ - uses: actions/setup-node@v4+ with:+ node-version: "22"+ cache: npm+ cache-dependency-path: libs/cua-driver/examples/jev-use/package-lock.json+ - name: Verify the interactive desktop session+ working-directory: ${{ github.workspace }}+ run: .\scripts\ci\windows\verify-user-session.ps1+ - name: Install the released Driver with the canonical installer+ run: |+ # -NoAutoStart: the logon task runs at the account's highest token,+ # which on this administrator account is elevated. The proof starts+ # the daemon itself from a standard-user token instead.+ & ([scriptblock]::Create((irm https://cua.ai/driver/install.ps1))) -NoAutoStart -NoPathUpdate+ $driver = Join-Path $env:LOCALAPPDATA "Programs\Cua\cua-driver\bin\cua-driver.exe"+ if (-not (Test-Path -LiteralPath $driver -PathType Leaf)) { throw "installer did not create $driver" }+ & $driver --version+ $chrome = Join-Path ${env:ProgramFiles} "Google\Chrome\Application\chrome.exe"+ if ((Get-AuthenticodeSignature -FilePath $chrome).Status -ne "Valid") { throw "Chrome is not vendor-signed: $chrome" }+ "CUA_DRIVER_BIN=$driver" >> $env:GITHUB_ENV+ - name: Install locked example dependencies+ run: |+ uv sync --frozen+ if ($LASTEXITCODE -ne 0) { throw "uv sync failed" }+ npm.cmd ci --ignore-scripts+ if ($LASTEXITCODE -ne 0) { throw "npm ci failed" }+ - name: Run both mock agents through MCP from a standard-user token+ working-directory: ${{ github.workspace }}+ run: |+ # The proof and its evidence live in the user profile, which the+ # standard-user token can write.+ $root = Join-Path $env:USERPROFILE "jev-use-ci"+ $env:JEV_USE_PROOF_DIR = Join-Path $root "proof"+ $env:JEV_USE_LOG_DIR = Join-Path $root "logs"+ New-Item -ItemType Directory -Force $env:JEV_USE_LOG_DIR | Out-Null+ "JEV_USE_PROOF_DIR=$env:JEV_USE_PROOF_DIR" >> $env:GITHUB_ENV+ "JEV_USE_LOG_DIR=$env:JEV_USE_LOG_DIR" >> $env:GITHUB_ENV+ $inner = Join-Path $PWD "scripts\ci\windows\run-jev-use-standard-user.ps1"+ $pwshExe = (Get-Process -Id $PID).Path+ $transcript = Join-Path $env:JEV_USE_LOG_DIR "proof.log"+ $command = "cmd.exe /d /s /c `"`"$pwshExe`" -NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$inner`" > `"$transcript`" 2>&1`""+ $status = 1+ try {+ & .\scripts\ci\windows\invoke-standard-user-token.ps1 -CommandLine $command -WorkingDirectory $PWD -TimeoutSeconds 900+ $status = $LASTEXITCODE+ } finally {+ if (Test-Path $transcript) { Get-Content $transcript }+ }+ if ($status -ne 0) { throw "standard-user proof failed with exit code $status" }+ - name: Audit redacted E2E evidence+ run: |+ @'+ import json, pathlib, sys+ root = pathlib.Path(sys.argv[1])+ summary = json.loads((root / "summary.json").read_text())+ assert summary["complete"] is True+ assert summary["live_requested"] is False+ assert summary["typescript_requested"] is True+ assert {(item["language"], item["provider"], item["outcome"]) for item in summary["checks"]} == {+ ("python", "mock", "verified"), ("typescript", "mock", "verified")+ }+ # verify_setup.py read the fixture's /state endpoint itself; the+ # runners' own outcome events are not the oracle.+ assert all(item["observed"] == {"submitted": "jev-guide-mock"} for item in summary["checks"])+ assert all(item["acted_path"] == "page_structure" for item in summary["checks"])+ assert all(item["submit_tool"] == "browser_click" for item in summary["checks"])+ forbidden = ("typesafe_api_key", "authorization", "environment", "image_base64", "screenshot")+ for path in root.iterdir():+ if path.name == "summary.json" or path.suffix == ".jsonl":+ text = path.read_text(encoding="utf-8").lower()+ assert not any(value in text for value in forbidden), path+ '@ | uv run --frozen python - $env:JEV_USE_PROOF_DIR+ if ($LASTEXITCODE -ne 0) { throw "evidence audit failed" }+ - name: Stop Driver processes+ if: always()+ run: Get-Process cua-driver -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue+ - name: Upload redacted action evidence+ if: always()+ uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4+ with:+ name: jev-use-windows-released-mock+ path: |+ ${{ env.JEV_USE_PROOF_DIR }}/summary.json+ ${{ env.JEV_USE_PROOF_DIR }}/*.jsonl+ ${{ env.JEV_USE_LOG_DIR }}/*.txt+ ${{ env.JEV_USE_LOG_DIR }}/*.log+ if-no-files-found: error+ retention-days: 14diff --git a/scripts/ci/windows/invoke-standard-user-token.ps1 b/scripts/ci/windows/invoke-standard-user-token.ps1new file mode 100644index 0000000000..2d5766bebd--- /dev/null+++ b/scripts/ci/windows/invoke-standard-user-token.ps1@@ -0,0 +1,132 @@+# Run a command line in the current interactive session with a standard-user+# token derived from the caller's token.+#+# GitHub-hosted Windows runs jobs as an administrator with a full token. Cua+# Driver refuses to launch an isolated browser from an installation the+# current token can modify, which any administrator token can do for Program+# Files. This helper asks Windows for the SAFER "Normal User" level of the+# caller's own token (the same level `runas /trustlevel:0x20000` uses): the+# Administrators group becomes deny-only and administrative privileges are+# removed, while the user, session, and desktop stay the same. It is a CI+# stand-in for a standard user's logged-in desktop, not a sandbox.+param(+ [Parameter(Mandatory = $true)]+ [string]$CommandLine,+ [Parameter(Mandatory = $true)]+ [string]$WorkingDirectory,+ [int]$TimeoutSeconds = 900+)++Set-StrictMode -Version Latest+$ErrorActionPreference = "Stop"++Add-Type -TypeDefinition @"+using System;+using System.ComponentModel;+using System.Runtime.InteropServices;+using System.Text;++public static class CuaStandardUserToken {+ const uint SAFER_SCOPEID_USER = 2;+ const uint SAFER_LEVELID_NORMALUSER = 0x20000;+ const uint SAFER_LEVEL_OPEN = 1;+ const uint CREATE_NO_WINDOW = 0x08000000;+ const uint CREATE_UNICODE_ENVIRONMENT = 0x00000400;+ const uint WAIT_OBJECT_0 = 0;++ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]+ struct STARTUPINFO {+ public int cb;+ public string lpReserved;+ public string lpDesktop;+ public string lpTitle;+ public int dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags;+ public short wShowWindow, cbReserved2;+ public IntPtr lpReserved2, hStdInput, hStdOutput, hStdError;+ }++ [StructLayout(LayoutKind.Sequential)]+ struct PROCESS_INFORMATION {+ public IntPtr hProcess, hThread;+ public int dwProcessId, dwThreadId;+ }++ [DllImport("advapi32.dll", SetLastError = true)]+ static extern bool SaferCreateLevel(uint scopeId, uint levelId, uint openFlags, out IntPtr level, IntPtr reserved);++ [DllImport("advapi32.dll", SetLastError = true)]+ static extern bool SaferComputeTokenFromLevel(IntPtr level, IntPtr inToken, out IntPtr outToken, uint flags, IntPtr reserved);++ [DllImport("advapi32.dll", SetLastError = true)]+ static extern bool SaferCloseLevel(IntPtr level);++ [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]+ static extern bool CreateProcessAsUser(+ IntPtr token, string application, StringBuilder commandLine, IntPtr processAttributes,+ IntPtr threadAttributes, bool inheritHandles, uint creationFlags, IntPtr environment,+ string currentDirectory, ref STARTUPINFO startupInfo, out PROCESS_INFORMATION processInformation);++ [DllImport("kernel32.dll", SetLastError = true)]+ static extern uint WaitForSingleObject(IntPtr handle, uint milliseconds);++ [DllImport("kernel32.dll", SetLastError = true)]+ static extern bool GetExitCodeProcess(IntPtr process, out uint exitCode);++ [DllImport("kernel32.dll", SetLastError = true)]+ static extern bool TerminateProcess(IntPtr process, uint exitCode);++ [DllImport("kernel32.dll")]+ static extern bool CloseHandle(IntPtr handle);++ // Returns the child's exit code, or -1 after terminating it on timeout.+ public static int Run(string commandLine, string workingDirectory, uint timeoutMilliseconds) {+ IntPtr level;+ if (!SaferCreateLevel(SAFER_SCOPEID_USER, SAFER_LEVELID_NORMALUSER, SAFER_LEVEL_OPEN, out level, IntPtr.Zero)) {+ throw new Win32Exception(Marshal.GetLastWin32Error(), "SaferCreateLevel failed");+ }+ IntPtr token = IntPtr.Zero;+ try {+ if (!SaferComputeTokenFromLevel(level, IntPtr.Zero, out token, 0, IntPtr.Zero)) {+ throw new Win32Exception(Marshal.GetLastWin32Error(), "SaferComputeTokenFromLevel failed");+ }+ } finally {+ SaferCloseLevel(level);+ }+ try {+ var startup = new STARTUPINFO();+ startup.cb = Marshal.SizeOf(typeof(STARTUPINFO));+ startup.lpDesktop = "winsta0\\default";+ PROCESS_INFORMATION process;+ // A null environment inherits this process's environment block.+ if (!CreateProcessAsUser(token, null, new StringBuilder(commandLine), IntPtr.Zero, IntPtr.Zero,+ false, CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT, IntPtr.Zero,+ workingDirectory, ref startup, out process)) {+ throw new Win32Exception(Marshal.GetLastWin32Error(), "CreateProcessAsUser failed");+ }+ try {+ if (WaitForSingleObject(process.hProcess, timeoutMilliseconds) != WAIT_OBJECT_0) {+ TerminateProcess(process.hProcess, 124);+ WaitForSingleObject(process.hProcess, 10000);+ return -1;+ }+ uint exitCode;+ if (!GetExitCodeProcess(process.hProcess, out exitCode)) {+ throw new Win32Exception(Marshal.GetLastWin32Error(), "GetExitCodeProcess failed");+ }+ return unchecked((int)exitCode);+ } finally {+ CloseHandle(process.hThread);+ CloseHandle(process.hProcess);+ }+ } finally {+ CloseHandle(token);+ }+ }+}+"@++$exitCode = [CuaStandardUserToken]::Run($CommandLine, $WorkingDirectory, [uint32]($TimeoutSeconds * 1000))+if ($exitCode -eq -1) {+ throw "standard-user command timed out after $TimeoutSeconds seconds"+}+exit $exitCodediff --git a/scripts/ci/windows/run-jev-use-standard-user.ps1 b/scripts/ci/windows/run-jev-use-standard-user.ps1new file mode 100644index 0000000000..7f60eafb26--- /dev/null+++ b/scripts/ci/windows/run-jev-use-standard-user.ps1@@ -0,0 +1,80 @@+# Run the jev-use deterministic proof against the installed Cua Driver from a+# standard-user token. Start this through invoke-standard-user-token.ps1; it+# refuses to run with administrator rights, because Driver correctly refuses+# isolated browser launch from an installation the current token can modify.+#+# Inputs (environment):+# CUA_DRIVER_BIN installed cua-driver.exe+# JEV_USE_PROOF_DIR new evidence directory for verify_setup.py+# JEV_USE_LOG_DIR existing directory for daemon and token diagnostics+Set-StrictMode -Version Latest+$ErrorActionPreference = "Stop"++$driver = $env:CUA_DRIVER_BIN+$proofDir = $env:JEV_USE_PROOF_DIR+$logDir = $env:JEV_USE_LOG_DIR+foreach ($name in @("CUA_DRIVER_BIN", "JEV_USE_PROOF_DIR", "JEV_USE_LOG_DIR")) {+ if ([string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($name))) {+ throw "$name is required"+ }+}+if (-not (Test-Path -LiteralPath $driver -PathType Leaf)) {+ throw "installed Driver not found: $driver"+}++$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..\..")).Path+$exampleDir = Join-Path $repoRoot "libs\cua-driver\examples\jev-use"+$python = Join-Path $exampleDir ".venv\Scripts\python.exe"+if (-not (Test-Path -LiteralPath $python -PathType Leaf)) {+ throw "locked example environment not found: $python"+}++# Prove the token is a standard-user token before touching the Driver.+$identity = [Security.Principal.WindowsIdentity]::GetCurrent()+$principal = [Security.Principal.WindowsPrincipal]::new($identity)+$groups = (& whoami.exe /groups /fo csv | ConvertFrom-Csv)+$groups | Format-Table -AutoSize | Out-String -Width 400 |+ Set-Content -Encoding utf8 (Join-Path $logDir "token-groups.txt")+$administrators = @($groups | Where-Object { $_.SID -eq "S-1-5-32-544" })+Write-Host "Token user: $($identity.Name); session: $((Get-Process -Id $PID).SessionId)"+Write-Host "Administrators group: $(if ($administrators) { $administrators[0].Attributes } else { 'absent' })"+if ($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {+ throw "the proof must run from a standard-user token, but Administrators is enabled"+}+if ($administrators -and $administrators[0].Attributes -notmatch "deny only") {+ throw "Administrators is present without the deny-only attribute: $($administrators[0].Attributes)"+}++$daemon = $null+try {+ Write-Host "[driver] $(& $driver --version)"+ # The installer ran with -NoAutoStart, so no elevated daemon exists. Start+ # the daemon from this token, as a standard user's logon task would.+ $daemon = Start-Process -FilePath $driver -ArgumentList "serve" -WindowStyle Hidden -PassThru `+ -RedirectStandardOutput (Join-Path $logDir "daemon.out.log") `+ -RedirectStandardError (Join-Path $logDir "daemon.err.log")+ $deadline = (Get-Date).AddSeconds(60)+ while ($true) {+ & $driver status *> (Join-Path $logDir "daemon-status.txt")+ if ($LASTEXITCODE -eq 0) { break }+ if ($daemon.HasExited) { throw "Driver daemon exited early with code $($daemon.ExitCode)" }+ if ((Get-Date) -gt $deadline) { throw "Driver daemon did not become ready within 60 seconds" }+ Start-Sleep -Milliseconds 500+ }+ Get-Content (Join-Path $logDir "daemon-status.txt")++ Push-Location $exampleDir+ try {+ & $python verify_mcp_tools.py+ if ($LASTEXITCODE -ne 0) { throw "verify_mcp_tools.py failed with exit code $LASTEXITCODE" }+ & $python verify_setup.py --typescript --output-dir $proofDir+ if ($LASTEXITCODE -ne 0) { throw "verify_setup.py failed with exit code $LASTEXITCODE" }+ } finally {+ Pop-Location+ }+} finally {+ & $driver stop *> $null+ if ($null -ne $daemon -and -not $daemon.HasExited) {+ Stop-Process -Id $daemon.Id -Force -ErrorAction SilentlyContinue+ }+}