OCaml bootstrapper Phase 2: HTML renderer, SX server, Python bridge
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
15
sx/app.py
15
sx/app.py
@@ -148,6 +148,21 @@ def create_app() -> "Quart":
|
||||
target = path + "/" + ("?" + qs if qs else "")
|
||||
return redirect(target, 301)
|
||||
|
||||
@app.get("/sx/_engine")
|
||||
async def sx_engine_info():
|
||||
"""Diagnostic: which SX engine is active."""
|
||||
import os, json
|
||||
info = {"engine": "python-ref", "ocaml": False}
|
||||
if os.environ.get("SX_USE_OCAML") == "1":
|
||||
try:
|
||||
from shared.sx.ocaml_bridge import get_bridge
|
||||
bridge = await get_bridge()
|
||||
engine = await bridge.ping()
|
||||
info = {"engine": engine, "ocaml": True, "pid": bridge._proc.pid}
|
||||
except Exception as e:
|
||||
info = {"engine": "ocaml-error", "ocaml": False, "error": str(e)}
|
||||
return json.dumps(info), 200, {"Content-Type": "application/json"}
|
||||
|
||||
@app.get("/sx/")
|
||||
async def sx_home():
|
||||
"""SX docs home page."""
|
||||
|
||||
Reference in New Issue
Block a user