/** * Daemon client — used by hooks and MCP server to connect to the central daemon. * * ensureServer() — check PID, ping /health, spawn daemon if not running * gatherFromDaemon() — POST /gather for hooks * connectSSE() — GET /events for MCP server channel forwarding */ import { type IncomingMessage } from 'node:http'; export interface DaemonInfo { pid: number; port: number; host: string; startedAt: string; serverScript: string; version: string; } export type SessionLifecycleStatus = 'online' | 'busy' | 'idle' | 'unknown' | 'offline'; export interface SessionStatusUpdate { sessionId: string; provider?: string; status?: SessionLifecycleStatus; reason?: string; } /** * Ensure the daemon is running. Starts it if needed. * Returns connection info { host, port } or null on failure. */ export declare function ensureServer(): Promise; /** * POST /gather — request plugin output for a trigger. Used by hooks. */ export declare function gatherFromDaemon(info: DaemonInfo, trigger: string, cwd?: string, session?: SessionStatusUpdate): Promise; export declare function registerSessionStatus(info: DaemonInfo, update: SessionStatusUpdate): Promise; export declare function unregisterSessionStatus(info: DaemonInfo, update: SessionStatusUpdate): Promise; /** * POST /reload — tell the daemon to re-discover and re-import all plugins. * Returns { ok, loaded, errors } or null if no daemon is running. */ export declare function reloadDaemon(): Promise<{ ok: boolean; loaded: string[]; errors: string[]; } | null>; /** * GET /events — connect to daemon SSE stream. Used by MCP server. * Returns the HTTP response for streaming, or null on failure. * * Events arrive as: * event: plugin-result * data: {"plugin":"name","text":"...","timestamp":"..."} */ export declare function connectSSE(info: DaemonInfo, sessionId: string, provider?: string): Promise; /** * GET /doctor — get diagnostic output from daemon. */ export declare function getDoctorFromDaemon(info: DaemonInfo): Promise;