Files
hermes-portable-rescue/build/output/run-hermes.bat
T
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

220 lines
5.8 KiB
Batchfile

@echo off
title Hermes Portable Rescue - Windows Agent
setlocal enabledelayedexpansion
cd /d "%~dp0"
set HERMES_HOME=%~dp0..\hermes
set HERMES_ROOT=%~dp0..\hermes
set HERMES_CONFIG=%HERMES_ROOT%\config.yaml
set PYTHON=%~dp0python\python.exe
set HERMES_CLI=%~dp0python\Scripts\hermes.exe
set PIP=%~dp0python\Scripts\pip.exe
set WHEELS_DIR=%~dp0bin\wheels
set MARKER=%~dp0\.installed
set WEB_SERVER=%~dp0..\hermes\web\server.py
set OLLAMA_DIR=%~dp0bin\ollama
echo.
echo ============================================
echo Hermes Portable Rescue - Windows Agent
echo ============================================
echo.
echo Python: !PYTHON!
echo Config: !HERMES_CONFIG!
echo.
:: Check Python
if not exist "!PYTHON!" (
echo [ERROR] Python not found at !PYTHON!
pause
exit /b 1
)
:: First-run: bootstrap pip + install hermes + zeroconf
if not exist "!MARKER!" (
echo [*] First run -- installing Hermes Agent...
echo.
"!PYTHON!" "%~dp0bin\get-pip.py" --quiet --no-warn-script-location 2>&1
if errorlevel 1 (
echo [ERROR] Failed to bootstrap pip.
pause
exit /b 1
)
"!PYTHON!" -m pip install --no-index --find-links "!WHEELS_DIR!" --quiet hermes-agent zeroconf ifaddr 2>&1
if errorlevel 1 (
echo [ERROR] Failed to install Hermes Agent.
pause
exit /b 1
)
echo. > "!MARKER!"
echo [OK] Hermes Agent installed.
echo.
)
:: Launch menu
:menu
cls
echo ============================================
echo Hermes Portable Rescue - Windows Agent
echo ============================================
echo.
echo Python: !PYTHON!
echo Config: !HERMES_CONFIG!
echo.
echo What would you like to do?
echo.
echo 1) Hermes CLI (ONLINE - opencode-go)
echo 2) Hermes CLI (OFFLINE - local LLM)
echo 3) Web Dashboard (http://rescue.local:8080)
echo 4) Full Diagnostics (hardware, disk, mem, stress)
echo 5) Start Local LLM Server (llama.cpp)
echo 6) Windows MCP Server (UI Automation)
echo 7) Exit
echo.
set /p choice="Choice (1-7): "
if "!choice!"=="1" goto run_online
if "!choice!"=="2" goto run_offline
if "!choice!"=="3" goto run_dashboard
if "!choice!"=="4" goto run_diag
if "!choice!"=="5" goto run_llm
if "!choice!"=="6" goto run_mcp
if "!choice!"=="7" exit /b
echo Invalid choice.
pause
goto menu
:run_online
echo.
echo [*] Starting Hermes CLI (online mode - opencode-go)...
echo.
call :ensure_mcp
set HERMES_HOME=%~dp0..\hermes
if not exist "!HERMES_CLI!" (
echo [ERROR] Hermes CLI not found at !HERMES_CLI!
echo Run this script again to install Hermes Agent first.
echo.
pause
goto menu
)
"!HERMES_CLI!" --config "!HERMES_CONFIG!"
echo.
pause
goto menu
:run_offline
call :ensure_mcp
if not exist "!OLLAMA_DIR!\qwen2.5-coder-1.5b-q4_k_m.gguf" (
echo.
echo [ERROR] Offline model not found at !OLLAMA_DIR!
echo Run option 5 first to start the LLM server.
echo.
pause
goto menu
)
echo.
echo [*] Starting local LLM server (llama.cpp)...
start "Hermes Local LLM" "%~dp0start-llama-server.bat"
echo [*] Waiting for LLM server to be ready (polling)...
set POLL_COUNT=0
:wait_llm
set /a POLL_COUNT+=1
if !POLL_COUNT! gtr 30 (
echo [WARN] LLM server not ready after 30s - starting anyway...
goto skip_wait
)
>nul 2>&1 curl -s http://127.0.0.1:11434/v1/models && (
echo [OK] LLM server is ready!
goto skip_wait
)
>nul 2>&1 timeout /t 1 /nobreak
goto wait_llm
:skip_wait
echo.
echo [*] Starting Hermes CLI (offline mode - local LLM)...
echo [*] Using single config.yaml with auto-fallback to lmstudio provider.
set HERMES_HOME=%~dp0..\hermes
if not exist "!HERMES_CLI!" (
echo [ERROR] Hermes CLI not found at !HERMES_CLI!
echo Run this script again to install Hermes Agent first.
echo.
pause
goto menu
)
"!HERMES_CLI!" --config "!HERMES_CONFIG!"
echo.
pause
goto menu
:run_dashboard
echo.
echo [*] Starting web dashboard at http://localhost:8080
echo [*] On other devices, use http://rescue.local:8080
echo.
start "Hermes Dashboard" "http://localhost:8080"
"!PYTHON!" "!WEB_SERVER!"
pause
goto menu
:run_diag
echo.
echo [*] Running full diagnostics...
echo.
for %%s in (hardware bsod drivers stress) do (
echo.
echo --- %%s ---
"!PYTHON!" "!HERMES_ROOT!\scripts\%%s.py"
)
echo.
pause
goto menu
:run_llm
echo.
echo [*] Starting llama-server (local LLM backend)...
echo [*] Model: qwen2.5-coder-1.5b-q4_k_m.gguf
echo [*] Server: http://127.0.0.1:11434/v1
echo [*] Press Ctrl+C to stop when done.
echo.
start "Hermes LLM Server" "%~dp0start-llama-server.bat"
echo [OK] Server starting in new window.
echo.
pause
goto menu
:: -----------------------------------------------------------------------------
:: Auto-start Windows-MCP server before launching Hermes CLI.
:: Starts silently in a new window, polls until ready, continues anyway if
:: it doesn't come up (Hermes just won't have UI Automation tools).
:: -----------------------------------------------------------------------------
:ensure_mcp
>nul 2>&1 curl -s http://127.0.0.1:8000/mcp/health && (
goto :eof
)
echo [*] Auto-starting Windows MCP Server (UI Automation)...
start "Hermes - Windows MCP" /MIN "%~dp0start-windows-mcp.bat"
set MCP_POLL=0
:wait_mcp
set /a MCP_POLL+=1
if !MCP_POLL! gtr 20 (
echo [WARN] Windows MCP Server not ready after 20s - continuing...
goto :eof
)
>nul 2>&1 timeout /t 1 /nobreak
>nul 2>&1 curl -s http://127.0.0.1:8000/mcp/health && (
echo [OK] Windows MCP Server is ready!
goto :eof
)
goto wait_mcp
:run_mcp
echo.
echo [*] Starting Windows MCP Server (UI Automation)...
echo.
start "Hermes - Windows MCP" "%~dp0start-windows-mcp.bat"
echo [OK] Windows MCP Server starting in new window.
echo.
pause
goto menu