@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 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) Exit echo. set /p choice="Choice (1-6): " 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" exit /b echo Invalid choice. pause goto menu :run_online echo. echo [*] Starting Hermes CLI (online mode - opencode-go)... echo. set HERMES_HOME=%~dp0..\hermes "!PYTHON!" -m hermes_cli --config "!HERMES_CONFIG!" echo. pause goto menu :run_offline 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)... set HERMES_HOME=%~dp0..\hermes\offline if not exist "!HERMES_HOME!" mkdir "!HERMES_HOME!" "!PYTHON!" -m hermes_cli --config "!HERMES_ROOT!\config.offline.yaml" 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