"""Server-level constants: paths, port, timeouts, state lock.""" import threading from pathlib import Path # Runtime data lives in XDG data dir DATA_DIR = Path.home() / ".local" / "share" / "amc" SESSIONS_DIR = DATA_DIR / "sessions" EVENTS_DIR = DATA_DIR / "events" # Source files live in project directory (relative to this module) PROJECT_DIR = Path(__file__).resolve().parent.parent DASHBOARD_DIR = PROJECT_DIR / "dashboard" PORT = 7400 STALE_EVENT_AGE = 86400 # 24 hours in seconds STALE_STARTING_AGE = 3600 # 1 hour - sessions stuck in "starting" are orphans # Serialize state collection because it mutates session files/caches. _state_lock = threading.Lock()