Build a Python 3.10+ headless support demo using only the standard library and ordinary POST https://api.mandapi.com/v1/chat/completions. Read MANDAPI_API_KEY and MANDAPI_MODEL_ID from the environment. Implement two fixed, fictional in-memory references, locally validate read/answer JSON actions with exact keys, and reject arbitrary file paths or shell actions. Persist model, task, messages and attempts before each request with a same-directory replacement file; reject mismatched resumes. Bound attempts, input size and output tokens; do not promise exact cost or answer correctness. Emit JSON events and meaningful exit codes. Include --demo with no HTTP requests and --once for a single resumable step. Add offline tests for invalid actions, four-attempt exhaustion and request failures. Do not run a paid request or deploy anything.