"""Isolated one-shot Hermes execution for Dona dynamic dashboard generation. Never resumes or stores the primary/route-specific Hermes conversation. The JSON-only dashboard instruction thus cannot contaminate normal dialogue, ComfyUI or other MCP interactions. Existing tool routing is reused unchanged. """ from __future__ import annotations def ask_dashboard(instruction: str) -> str: """Generate ONE dashboard in a fresh Hermes CLI session, with real tools. Each invocation is stateless: no --resume, no session-state file, no identity.md wrapper. The normal Hermes personality from SOUL.md is still applied by Hermes itself. The app's conversation_lock gates requests. """ if not isinstance(instruction, str) or not instruction.strip(): raise ValueError("La demande de tableau dynamique est vide.") from services import hermes_client # Use Hermes' existing CLI configuration and the same targeted toolset # router; None guarantees a NEW session with its own launch policy. with hermes_client._REQUEST_LOCK: answer, _sid = hermes_client._call_hermes(instruction.strip(), None) return answer