Files
loki/scripts/_beacon_config.py
T
g-butandClaude Sonnet 4.6 ebdac2d404 fix(ssot): centralise SWITCH_CHOICE_PREFIX wire constant across all three languages
SWITCH_CHOICE_PREFIX="switch:" was defined locally in beacon/[id]/page.tsx
(TypeScript) and _beacon_popups.py (Python), while its sibling CUSTOM_CHOICE_PREFIX
already lived in src/lib/constants/control.ts and _beacon_config.py respectively.

- Add SWITCH_CHOICE_PREFIX to constants/control.ts alongside CUSTOM_CHOICE_PREFIX
- Remove local const from beacon/[id]/page.tsx; import from constants instead
- Move SWITCH_CHOICE_PREFIX from _beacon_popups.py into _beacon_config.py; import it
- Update shell script comment to cover both prefixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 06:15:09 +02:00

36 lines
1.2 KiB
Python

"""Beacon — runtime constants and config-file helpers. No PyQt dependency."""
import os, json
# Wire-format prefixes — must match constants in src/lib/constants/control.ts
CUSTOM_CHOICE_PREFIX = "custom:"
SWITCH_CHOICE_PREFIX = "switch:"
# Override via COCKPIT_URL env var for non-default ports or remote deployments.
COCKPIT_URL = os.environ.get("COCKPIT_URL", "http://localhost:3000").rstrip("/")
COUNTDOWN_SECONDS = 12 # default; overridden by settings file if present
_SETTINGS_PATH = os.path.expanduser("~/.config/agent-dashboard-settings.json")
_META_PATH = os.path.expanduser("~/.config/agent-prompts.json")
_LEGACY_META_PATH = os.path.expanduser("~/.config/claude-prompts.json")
def load_settings() -> dict:
try:
if os.path.exists(_SETTINGS_PATH):
return json.load(open(_SETTINGS_PATH))
except Exception:
pass
return {}
def load_prompt_meta() -> list:
"""Load prompt metadata from SSOT config file."""
try:
file = _META_PATH if os.path.exists(_META_PATH) else _LEGACY_META_PATH
if os.path.exists(file):
return json.load(open(file))
except Exception:
pass
return []