UNPKG

overmind-mcp

Version:

Orchestrateur universel agents IA multi-modeles via MCP. Inclut le protocole 'Custom-Nickname' pour identifier vos agents avec des surnoms originaux (The Chaos Prophet, Shadow Sniper, etc.), l'isolation mémoire (Private Memory Context) et le support pour

92 lines • 4.67 kB
/** * HermesGatewayManager — Manages the Hermes API Server lifecycle. * * ╔══════════════════════════════════════════════════════════════════════╗ * ║ PURPOSE ║ * ║ ║ * ║ Singleton that detects, validates, and ensures the Hermes API ║ * ║ Server (gateway/platforms/api_server.py) is reachable. ║ * ║ ║ * ║ The API Server is a platform adapter inside the Hermes gateway ║ * ║ process. It exposes an OpenAI-compatible HTTP+SSE API: ║ * ║ ║ * ║ GET /health → {"status": "ok", ...} ║ * ║ GET /v1/models → OpenAI model list ║ * ║ GET /v1/capabilities → Feature flags ║ * ║ POST /v1/chat/completions → Chat (streaming SSE or JSON) ║ * ║ POST /v1/responses → Responses API (stateful) ║ * ║ POST /v1/runs → Async run (returns run_id) ║ * ║ GET /v1/runs/{id}/events → SSE lifecycle events ║ * ║ POST /v1/runs/{id}/stop → Interrupt a run ║ * ║ POST /v1/runs/{id}/approval → Resolve pending approval ║ * ║ ║ * ║ Configuration (read from Hermes .env): ║ * ║ API_SERVER_ENABLED=1 → enables the adapter ║ * ║ API_SERVER_KEY=<secret> → Bearer token for auth ║ * ║ API_SERVER_PORT=8642 → listen port (default: 8642) ║ * ║ API_SERVER_HOST=127.0.0.1 → listen host (default: loopback) ║ * ║ ║ * ║ This manager does NOT start the gateway — that's Hermes' job ║ * ║ (via `hermes gateway start`). It only detects and health-checks. ║ * ╚══════════════════════════════════════════════════════════════════════╝ */ export interface GatewayInfo { /** Base URL of the API server, e.g. http://127.0.0.1:8642 */ url: string; /** Bearer token for Authorization header */ apiKey: string; /** Port the server listens on */ port: number; /** Host the server listens on */ host: string; /** True if the last health check succeeded */ healthy: boolean; /** PID of the gateway process (from health/detailed), if available */ pid: number | null; /** Hermes version reported by the server */ version: string | null; } /** * Singleton manager for the Hermes API Server connection. * * Call `await HermesGatewayManager.getInstance()` to get a healthy gateway * info object. The first call probes the server; subsequent calls return * the cached state with periodic re-validation. */ export declare class HermesGatewayManager { private static instance; private cachedInfo; private lastHealthCheck; private readonly HEALTH_CHECK_TTL_MS; private constructor(); static getInstance(): HermesGatewayManager; /** * Probe the API server health endpoint. * Returns the raw JSON response or null on failure. */ private probeHealth; /** * Get detailed health info (includes PID, gateway state, platform status). */ getDetailedHealth(): Promise<Record<string, unknown> | null>; /** * Ensure the API server is reachable. Probes health, caches result. * * @param forceRefresh Skip the cache TTL and re-probe. * @returns GatewayInfo if healthy, null if unreachable. */ ensureReady(forceRefresh?: boolean): Promise<GatewayInfo | null>; /** * Check if the gateway is ready (quick boolean check). */ isReady(): Promise<boolean>; /** * Get cached info without probing. Returns last known state. */ getCachedInfo(): GatewayInfo | null; /** * Force a fresh health check on next ensureReady() call. */ invalidate(): void; } //# sourceMappingURL=HermesGatewayManager.d.ts.map