feat(api): /VERSION single source read at startup + GET /version

This commit is contained in:
2026-07-11 10:31:54 -05:00
parent 8e4c0bf957
commit 56278a4831
4 changed files with 63 additions and 1 deletions

View File

@@ -17,8 +17,9 @@ from .canon_log import validate_canon_log
from .narrate import run as narrate_run
from .npc import UnknownNpc, run as npc_run
from .ollama_client import ModelError
from .version import VERSION
app = FastAPI(title="coc-rpg proxy", version="0.0.1")
app = FastAPI(title="coc-rpg proxy", version=VERSION)
@app.exception_handler(RequestValidationError)
@@ -65,6 +66,11 @@ def health() -> dict:
return {"status": "ok"}
@app.get("/version")
def version() -> dict:
return {"version": VERSION}
# ── Role endpoints (charter §4) ──────────────────────────────────────────────
# The client knows these paths and nothing about which model or prompt serves
# them. Bodies are validated against the canon log contract. /dm/narrate is