$ErrorActionPreference = "Stop" Write-Host "Setting up and launching Background Vision Agent..." -ForegroundColor Cyan $root = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $root $venv = Join-Path $root ".venv" if (!(Test-Path $venv)) { Write-Host "Creating venv..." -ForegroundColor DarkCyan try { py -3 -m venv $venv } catch { python -m venv $venv } } $python = Join-Path $venv "Scripts/python.exe" $pythonw = Join-Path $venv "Scripts/pythonw.exe" & $python -m pip install --upgrade pip | Out-Null & $python -m pip install -r (Join-Path $root "requirements.txt") Write-Host "Starting agent in background (hidden)..." -ForegroundColor DarkCyan Start-Process -FilePath $pythonw -ArgumentList "-m","bg_agent" -WindowStyle Hidden Write-Host "Agent started. Use the hotkeys below:" -ForegroundColor Green Write-Host " Alt+Shift+1 -> Capture active window" Write-Host " Alt+Shift+2 -> Send to OpenAI" Write-Host " Alt+Shift+3 -> Action 3 (type or clipboard mode)" Write-Host " Alt+Shift+4 -> Reset state" Write-Host " Alt+Shift+5 -> Quit (press 3 times quickly)" Write-Host " Alt+Shift+6 -> Switch modes for Action 3" Write-Host "Set OPENAI_API_KEY in your user environment before sending." -ForegroundColor Yellow