/** * TokensaveMcpClient — long-lived `tokensave serve` subprocess over JSON-RPC 2.0. * * Responsibilities: * - Spawn and own exactly ONE `tokensave serve` child per instance. * - Multiplex concurrent call() invocations via a numeric-id PendingMap. * - Restart on crash with 3-per-60s circuit breaker (health → 'broken' when * tripped; subsequent call() rejects immediately). * - Reject in-flight call() promises on child exit rather than leaving them * to time out. */ import type { GraphSection } from "./types.js"; import type { IncidentLog } from "./incidents.js"; export type EngineHealth = "starting" | "ready" | "restarting" | "broken"; export declare class TokensaveMcpClient { private readonly projectRoot; private readonly cfg; private readonly incidents; private readonly binary; childPid: number | null; private child; private handshakeId; private healthState; private nextId; private readonly pending; private restartTimestamps; private stdoutBuf; private stopping; constructor(projectRoot: string, cfg: GraphSection, incidents: IncidentLog, binary?: string); health(): EngineHealth; /** * Spawn the child process and wait for the JSON-RPC handshake. * Resolves once health flips to 'ready'. * Rejects within HANDSHAKE_TIMEOUT_MS if the child exits early or the * handshake never arrives. */ start(): Promise; /** * SIGTERM the child; wait up to 2000ms; SIGKILL if still alive. */ stop(): Promise; /** * Send a JSON-RPC 2.0 request and await the matching response. * Rejects immediately when health is 'broken' or the engine is stopped. */ call(tool: string, params: unknown): Promise; private spawnAndHandshake; private handleResponse; private onExit; private rejectAllPending; } //# sourceMappingURL=mcp-client.d.ts.map