"""
Historical-2d Studio Review Hub Server Launcher
Binds to 0.0.0.0:1516 so Seven Nguyen can access remotely via Tailscale.
"""

import sys
import time
import uvicorn

if __name__ == "__main__":
    print("[Historical-2d] Starting Executive Review Hub on http://0.0.0.0:1516 ...")
    while True:
        try:
            uvicorn.run(
                "src.web_review.server:app",
                host="0.0.0.0",
                port=1516,
                reload=False,
                log_level="info",
                access_log=True
            )
        except KeyboardInterrupt:
            print("[Historical-2d] Server terminated by user.")
            break
        except Exception as e:
            print(f"[Historical-2d] Server error: {e}. Auto-restarting in 2s...")
            time.sleep(2)
        else:
            print("[Historical-2d] Uvicorn exited normally. Auto-restarting in 1s...")
            time.sleep(1)

