Files
loki/scripts/_beacon_config.py
T
g-butandClaude Sonnet 4.6 d63d82eaf2 refactor(beacon): split 1925-line beacon.py into 5 focused modules
- _beacon_theme.py  — color palettes + theme loading (no PyQt)
- _beacon_config.py — runtime constants + settings helpers (no PyQt)
- _beacon_audio.py  — WhisperThread speech-to-text
- _beacon_popups.py — Qt stylesheet, all widget classes
- beacon.py         — thin 198-line entry point

Also fix inject_prompt in agent-hook-lib.sh: add || true to zellij
commands so set -euo pipefail doesn't abort before Enter is pressed.

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

35 lines
1.1 KiB
Python

"""Beacon — runtime constants and config-file helpers. No PyQt dependency."""
import os, json
# Wire-format prefix — must match CUSTOM_CHOICE_PREFIX in src/lib/constants/control.ts
CUSTOM_CHOICE_PREFIX = "custom:"
# 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 []