@echo off
REM Durable session host. PATH-RELATIVE binary + USER-WRITABLE logs (%LOCALAPPDATA%\Ormur) so it
REM runs from any install dir (incl. an admin-only %ProgramFiles%\Ormur where the program dir is
REM not user-writable, hence logs go to %LOCALAPPDATA%).
cd /d "%~dp0"
set "ARGUS_BETA_TOKEN_FILE=%~dp0.token"
set DC_TRUST_XFF=1
REM Notifications: the heuristic reply-detector scraped the terminal tail as the "reply" summary,
REM which on modern AI TUIs (full-screen box/banner redraws) produced garbage ("onceki session ---").
REM The precise Claude-Code Stop hook (ormur_done_hook.cmd -> /api/hook "done") + the Notification
REM hook ("Claude needs you") are the clean signals; disable the noisy heuristic.
set DC_REPLY_OFF=1
set "DCLOG=%LOCALAPPDATA%\Ormur"
if not exist "%DCLOG%" mkdir "%DCLOG%" 2>nul
REM machine-wide state (buyer): survives the admin-install vs user-run profile split so pairing
REM and tsnet-serve share ONE node identity. dev.cmd (if present) overrides these for a dev box.
set "DCSTATE=%ProgramData%\Ormur\state"
set "ARGUS_BETA_PAIRING_DIR=%DCSTATE%"
set "ARGUS_BETA_TSNET_DIR=%DCSTATE%\tsnet"
set "ARGUS_BETA_AGENT_KEY=%DCSTATE%\agent_ed25519"
if not exist "%DCSTATE%\tsnet" mkdir "%DCSTATE%\tsnet" 2>nul
if exist "%~dp0dev.cmd" call "%~dp0dev.cmd"
"%~dp0agent.exe" sessiond --addr 127.0.0.1:8099 >> "%DCLOG%\sessiond.log" 2>&1
