Files
shawn 14cf8332a2 fix: correct broken batch file paths and update README
- start-llama-server.bat: fix LLAMA_DIR to bin\llama (was bin\ollama),
  fix model to qwen2.5-coder-1.5b (was Llama-3.2-1B), use correct
  GPU (llama-server.exe) and CPU (cpu\llama-server-cpu.exe) binaries
- start-windows-mcp.bat: remove dead python313\ tier, use single
  embedded Python 3.13 at python\python.exe
- run-hermes.bat: use Scripts\hermes.exe instead of -m hermes_cli
  (no __main__.py in package), fix offline mode to use single
  config.yaml instead of non-existent config.offline.yaml
- run-hermes.ps1: same hermes_cli → hermes.exe fix
- README.txt: update to match actual USB state (Python 3.13, 142
  wheels, Qwen2.5-Coder-1.5B 1117MB model, correct dir structure)
2026-07-12 12:37:52 -04:00

83 lines
3.2 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
}
# Check Hermes CLI installed
if (-not (Test-Path $HermesExe)) {
Write-Host "[ERROR] Hermes CLI not found at $HermesExe" -ForegroundColor Red
Write-Host "Run this script again to install Hermes Agent first."
exit 1
}
# 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..."
& $HermesExe --config $HermesConfig
Write-Host ""
Write-Host "[*] Hermes exited."