@echo off setlocal chcp 65001 >nul REM MB-X registry-aware Codex app-server start helper. set "WORKSPACE_ROOT=E:\mb-ms-doc" set "MBX_SRC=E:\mb-ms-doc\project-mbx-core\src" set "APP_SERVER_URL=ws://127.0.0.1:4570" set "PYTHONPATH=%MBX_SRC%;%PYTHONPATH%" echo [MB-X] Preflight: checking python and Codex CLI in this cmd/BAT environment. echo [MB-X] PATH=%PATH% where python >nul 2>nul if errorlevel 1 ( echo [MB-X][ERROR] python not found in PATH. echo [MB-X][NEXT] Add Python to PATH or run this script from a Python-enabled shell. pause exit /b 1 ) for /f "delims=" %%I in ('where python 2^>nul') do if not defined MBX_PYTHON_EXE set "MBX_PYTHON_EXE=%%I" echo [MB-X] python=%MBX_PYTHON_EXE% set "MBX_CODEX_EXE=" for /f "delims=" %%I in ('where codex.cmd 2^>nul') do if not defined MBX_CODEX_EXE set "MBX_CODEX_EXE=%%I" if not defined MBX_CODEX_EXE for /f "delims=" %%I in ('where codex.exe 2^>nul') do if not defined MBX_CODEX_EXE set "MBX_CODEX_EXE=%%I" if not defined MBX_CODEX_EXE for /f "delims=" %%I in ('where codex 2^>nul') do if not defined MBX_CODEX_EXE set "MBX_CODEX_EXE=%%I" if not defined MBX_CODEX_EXE ( echo [MB-X][ERROR] Codex CLI not found in this cmd/BAT PATH. remote TUI cannot start. echo [MB-X][NEXT] Confirm `codex.cmd --version` works in the same shell, add the npm/Codex bin directory to PATH, or update the workspace mbx.yaml provider command to an absolute codex.cmd/codex.exe path. echo [MB-X][DIAG] where codex: where codex echo [MB-X][DIAG] where codex.cmd: where codex.cmd pause exit /b 5 ) echo [MB-X] codex=%MBX_CODEX_EXE% echo [MB-X] where codex.cmd: where codex.cmd echo [MB-X] where codex: where codex cd /d "%WORKSPACE_ROOT%" echo [MB-X] Starting or reusing Codex app-server at %APP_SERVER_URL% python -m mbx.cli codex-server start --listen "%APP_SERVER_URL%" echo. echo [MB-X] If you run codex-server restart later, affected role sessions become window_restart_required. echo [MB-X] After any restart, run each affected open-*.bat or restore-*.bat and verify resume_remote/history before dispatch. pause