Files
bruno b51702f24f chore: stabilisation Phase 1 — reconnexion auto, timeout LLM, systemd, README
- Ajout reconnexion auto WebSocket avec backoff exponentiel (2s→30s, max 20 tentatives)
- Ajout timeout LLM côté frontend (25s) avec réactivation du bouton
- Réduction timeout serveur httpx 60→45s
- Service systemd user jarvis-v3 (survit aux reboots)
- Launcher Python avec fallback .env si Infisical expiré
- README.md complet (architecture, URLs, roadmap, maintenance)
- .gitignore (venv, pycache, logs)
2026-06-19 22:51:01 -04:00

54 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Launcher systemd pour JARVIS v3 — récupère la clé Hermes puis démarre le bot."""
import os
import json
import subprocess
import sys
def get_hermes_key():
"""Récupère la clé API Hermes depuis Infisical."""
key = os.environ.get("HERMES_API_KEY", "") or os.environ.get("HERMES_ALEXA_KEY", "")
if key:
return key
try:
creds = json.load(open("/opt/infisical/admin-credentials.json"))
r = subprocess.run(
["/home/openclaw/.local/lib/node_modules/@infisical/cli/bin/infisical",
"secrets", "get", "API_SERVER_KEY",
"--domain", "https://secret.dracodev.net",
"--projectId", "192c1eed-6666-41ee-80df-a4636a2da0ad",
"--env", "prod", "--path", "/hermes-claw", "--plain",
"--token", creds["token"]],
capture_output=True, text=True, timeout=15)
if r.returncode == 0 and r.stdout.strip():
return r.stdout.strip()
except Exception as e:
print(f"[launcher] Infisical: {e}", file=sys.stderr)
# Fallback: lire depuis workspace/.env
try:
with open(os.path.expanduser("~/workspace/.env")) as f:
for line in f:
if line.startswith("HERMES_ALEXA_KEY="):
return line.split("=", 1)[1].strip()
if line.startswith("API_SERVER_KEY="):
return line.split("=", 1)[1].strip()
except Exception:
pass
return ""
if __name__ == "__main__":
key = get_hermes_key()
if not key:
print("[launcher] ERREUR: Impossible de récupérer la clé Hermes", file=sys.stderr)
sys.exit(1)
os.environ["HERMES_API_KEY"] = key
os.environ["JARVIS_PORT"] = os.environ.get("JARVIS_PORT", "7081")
# Lance bot_direct.py
bot_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "bot_direct.py")
python = os.path.join(os.path.dirname(os.path.abspath(__file__)), "venv", "bin", "python")
os.execv(python, [python, bot_path])