/** * HTTP server for primary mode. * Allows proxy instances to forward tool calls and check health. * * Endpoints: * GET /health → { server, version, godot_connected } * POST /tool → { name, args } → MCP-formatted result * POST /client/register → { client_id } — register/heartbeat a proxy client * POST /client/unregister → { client_id } — drop a proxy client */ export interface ToolCallResult { content: Array<{ type: string; text: string; }>; isError?: boolean; } export type ToolExecutor = (name: string, args: Record) => Promise; export declare class PrimaryHttpServer { /** * How long a client may go unheard-from before it is presumed gone. Proxies * re-register on a shorter interval, so this only expires something that has * genuinely stopped running. */ static readonly CLIENT_TTL_MS = 90000; private server; private port; private serverVersion; private executeToolCall; private lastActivityTime; /** * Connected proxy clients, by id, with the time each was last heard from. * * This used to be a bare counter: +1 on register, -1 on unregister. A proxy * only unregisters from its own shutdown handler (stdin close, SIGINT, * SIGTERM), so anything harder — SIGKILL, a client that force-terminates its * MCP servers, a crash, a sleeping machine — skipped it and the primary never * found out. The number could only climb, and the editor toolbar ended up * advertising "Agents (4)" with one client open. * * A set with a last-seen stamp cannot leak: an entry nothing has refreshed * within CLIENT_TTL_MS is gone, whether or not its process said goodbye. */ private proxyClients; private onClientCountChange; private sweepTimer; private toolCount; constructor(port: number, version: string, executor: ToolExecutor, toolCount: number); getLastActivityTime(): number; /** Live clients, stale entries dropped first. */ getProxyClientCount(): number; /** * Forget clients nothing has heard from in a while. * * Called on every register/unregister and on every read of the count, plus * from the sweep timer — the last client to die has nobody left to trigger a * lazy reap, and the editor's toolbar would otherwise keep advertising it. */ private reapStaleClients; /** Record a client as alive right now. Returns the live count. */ private touchClient; setClientCountChangeCallback(cb: (count: number) => void): void; /** Drop expired clients and report if that changed the count. */ private sweep; start(): Promise; isListening(): boolean; stop(): void; private handleRequest; } //# sourceMappingURL=primary-http.d.ts.map