Files
hermes-portable-rescue/build/output/run-hermes.ps1
T
shawn 2b7a8290a5 feat: add Windows-MCP UI automation + full offline deps
- New start-windows-mcp.bat — starts Windows-MCP SSE server on :8000
- Windows-MCP auto-starts when Hermes CLI launches (options 1/2)
- Pre-downloaded wheels: hermes-agent (47), windows-mcp (95)
- Offline Python 3.13 embedded + get-pip.py bootstrapper
- Hermes config wired with mcp_servers.windows-mcp
- Updated Makefile with targets: wheels-hermes, wheels-windows-mcp,
  python-portable, get-pip, deps
- Recreated: run-hermes.ps1, start-hermes-dashboard.bat
- Pure ASCII .bat files with CRLF line endings
2026-07-11 18:11:06 -04:00

76 lines
3.0 KiB
PowerShell

#!/usr/bin/env pwsh
# Hermes Portable Rescue — Windows Agent (PowerShell)
# Run: powershell -ExecutionPolicy Bypass -File .\run-hermes.ps1
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$HermesRoot = Resolve-Path (Join-Path $ScriptDir "..\hermes")
$HermesConfig = Join-Path $HermesRoot "config.yaml"
$PythonExe = Join-Path $ScriptDir "python\python.exe"
$HermesExe = Join-Path $ScriptDir "python\Scripts\hermes.exe"
$PipBootstrap = Join-Path $ScriptDir "bin\get-pip.py"
$WheelsDir = Join-Path $ScriptDir "bin\wheels"
$Marker = Join-Path $ScriptDir ".installed"
$WinMCPWheelsDir = Join-Path $ScriptDir "bin\wheels-windows-mcp"
$WinMCPScript = Join-Path $ScriptDir "start-windows-mcp.bat"
$WinMCPMarker = Join-Path $ScriptDir "bin\.windows-mcp-installed"
Write-Host "============================================" -ForegroundColor Cyan
Write-Host " Hermes Portable Rescue - Windows Agent" -ForegroundColor Cyan
Write-Host "============================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Python: $PythonExe"
Write-Host "Config: $HermesConfig"
if (-not (Test-Path $PythonExe)) {
Write-Host "[ERROR] Python not found at $PythonExe" -ForegroundColor Red
exit 1
}
# Bootstrap Hermes on first run
if (-not (Test-Path $Marker)) {
Write-Host "[*] First run -- installing Hermes Agent..."
& $PythonExe $PipBootstrap --quiet --no-warn-script-location 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Host "[ERROR] Failed to bootstrap pip." -ForegroundColor Red
exit 1
}
& $PythonExe -m pip install --no-index --find-links $WheelsDir --quiet hermes-agent zeroconf ifaddr 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "[ERROR] Failed to install Hermes Agent." -ForegroundColor Red
exit 1
}
Set-Content -Path $Marker -Value ""
Write-Host "[OK] Hermes Agent installed." -ForegroundColor Green
}
# Auto-start Windows-MCP server
$mcpHealth = "http://127.0.0.1:8000/mcp/health"
try {
$null = Invoke-WebRequest -Uri $mcpHealth -Method GET -TimeoutSec 2 -ErrorAction Stop
Write-Host "[OK] Windows MCP Server already running." -ForegroundColor Green
} catch {
Write-Host "[*] Auto-starting Windows MCP Server (UI Automation)..."
Start-Process -WindowStyle Minimized -FilePath $WinMCPScript
$mcpReady = $false
for ($i = 0; $i -lt 20; $i++) {
Start-Sleep -Seconds 1
try {
$null = Invoke-WebRequest -Uri $mcpHealth -Method GET -TimeoutSec 1 -ErrorAction Stop
$mcpReady = $true
Write-Host "[OK] Windows MCP Server is ready!" -ForegroundColor Green
break
} catch {}
}
if (-not $mcpReady) {
Write-Host "[WARN] Windows MCP Server not ready after 20s - continuing..." -ForegroundColor Yellow
}
}
# Launch Hermes
Write-Host ""
Write-Host "[*] Starting Hermes Agent..."
& $PythonExe -m hermes_cli --config $HermesConfig
Write-Host ""
Write-Host "[*] Hermes exited."