@echo off
echo Starting OpenCode...
start "OpenCode" cmd /c "opencode serve"

echo Waiting for OpenCode to start...
:wait_loop
curl -s http://localhost:4096/health >nul 2>&1
if %errorlevel% neq 0 (
    timeout /t 1 >nul
    goto wait_loop
)
echo OpenCode started on port 4096

echo.
echo Starting OpenChamber...
start "OpenChamber" cmd /c "bun run start:web"

echo.
echo ========================================
echo OpenChamber should be ready at:
echo   http://localhost:3000
echo ========================================
pause
