import os from pathlib import Path from typing import Dict, Any, List from pydantic import BaseModel, Field from pydantic_settings import BaseSettings BASE_DIR = Path(__file__).resolve().parent.parent DATA_DIR = Path(os.getenv("HUB_DATA_DIR", BASE_DIR / "data")) PERSONAS_DIR = DATA_DIR / "personas" CLONES_DIR = DATA_DIR / "clones" class UniverseConfig(BaseModel): id: str name: str tagline: str description: str backend_url: str scope: str accent_token: str icon: str persona_file: str enabled: bool = True class Settings(BaseSettings): app_name: str = "Hermes Hub" host: str = "0.0.0.0" port: int = 8080 debug: bool = False # NAS & VPS Network Configurations nas_tailscale_ip: str = os.getenv("NAS_TAILSCALE_IP", "100.86.197.88") vps_tailscale_ip: str = os.getenv("VPS_TAILSCALE_IP", "100.94.90.119") # Backends hermes_tt_url: str = os.getenv("HERMES_TT_URL", "http://100.86.197.88:3010") hermes_nyora_url: str = os.getenv("HERMES_NYORA_URL", "http://100.86.197.88:3020") hermes_perso_url: str = os.getenv("HERMES_PERSO_URL", "http://100.86.197.88:3031") hermes_nabil_url: str = os.getenv("HERMES_NABIL_URL", "http://127.0.0.1:8642") # Hub Secret for internal session sealing if needed hub_secret: str = os.getenv("HUB_SECRET", "hermes-hub-master-key-2026") class Config: env_file = ".env" extra = "ignore" settings = Settings() UNIVERSES: Dict[str, UniverseConfig] = { "tt": UniverseConfig( id="tt", name="Tunisie Telecom", tagline="Achats Zone Sud", description="Direction Régionale — Marchés, RLA & Appels d'Offres", backend_url=settings.hermes_tt_url, scope="tt", accent_token="--accent-tt", icon="briefcase", persona_file="tt.yaml" ), "nyora": UniverseConfig( id="nyora", name="Nyora", tagline="Venture & Dr Nexum", description="Projets entrepreneuriaux, conseil & veille stratégique", backend_url=settings.hermes_nyora_url, scope="nyora", accent_token="--accent-nyora", icon="sparkles", persona_file="nyora.yaml" ), "perso": UniverseConfig( id="perso", name="Personnel", tagline="Famille & Santé", description="Espace privé, santé familiale, gestion du quotidien", backend_url=settings.hermes_perso_url, scope="perso", accent_token="--accent-perso", icon="home", persona_file="perso.yaml" ), "nabil": UniverseConfig( id="nabil", name="Nabil Master", tagline="Orchestration & DSH", description="Master Agent VPS, exécution de code & DeepSeek Harness", backend_url=settings.hermes_nabil_url, scope="nabil", accent_token="--accent-nabil", icon="terminal", persona_file="nabil.yaml" ) } def get_universe(universe_id: str) -> UniverseConfig: if universe_id not in UNIVERSES: raise KeyError(f"Universe '{universe_id}' does not exist.") return UNIVERSES[universe_id]