feat: make Telegram relay delivery opt-in

This commit is contained in:
2026-08-16 04:39:07 +02:00
parent 67160b2de0
commit f7047eb429
4 changed files with 51 additions and 18 deletions
+20 -4
View File
@@ -34,9 +34,25 @@ HERMES_MAX_TURNS = int(os.environ.get("HERMES_RELAY_MAX_TURNS", "10"))
HERMES_TIMEOUT = int(os.environ.get("HERMES_RELAY_TIMEOUT", "120"))
LOG_LEVEL = os.environ.get("HERMES_RELAY_LOG_LEVEL", "INFO").upper()
# Default paths for auto-detection (used when env vars not set)
# Default paths for auto-detection (used when env vars not set). Hermes v0.20
# installs from a Git checkout, where modules live at the project root rather
# than inside the former venv site-packages directory.
DEFAULT_HERMES_HOME = "/root/.hermes/profiles/voice-assistant"
DEFAULT_SITE_PACKAGES = "/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages"
DEFAULT_SITE_PACKAGES = "/usr/local/lib/hermes-agent"
def _resolve_hermes_import_path() -> str:
"""Return the directory that contains the installed hermes_cli package."""
configured = HERMES_SITE_PACKAGES or DEFAULT_SITE_PACKAGES
candidates = [
configured,
"/usr/local/lib/hermes-agent",
"/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages",
]
for candidate in candidates:
if os.path.isdir(os.path.join(candidate, "hermes_cli")):
return candidate
return configured
# ── Module-level state (true warm agent) ────────────────────────────────
_HERMES_LOADED = False
@@ -76,8 +92,8 @@ def _ensure_hermes_loaded() -> None:
# Force voice-assistant profile via HERMES_HOME
os.environ["HERMES_HOME"] = HERMES_HOME or DEFAULT_HERMES_HOME
# Ensure Hermes is in Python path
site_packages = HERMES_SITE_PACKAGES or DEFAULT_SITE_PACKAGES
# Ensure Hermes is in Python path. v0.20 uses a Git-checkout layout.
site_packages = _resolve_hermes_import_path()
if site_packages not in sys.path:
sys.path.insert(0, site_packages)