/** * Transient-network-error classification + retry helper. * * The MCP talks to each live worker over HTTP. A momentary glitch — a worker briefly * saturated mid-compile, a dropped keep-alive socket — is NOT proof the session died, but * historically surfaced as a fatal-sounding "Session ended". This module lets idempotent * calls retry THROUGH such a glitch, while a real death signal (ECONNREFUSED — nothing is * listening) is never retried and surfaces immediately. * * Pure logic, cross-platform: the error codes below are libuv codes, identical on * Windows / macOS / Linux. No OS-specific behaviour. */ export declare const TRANSIENT_NET_CODES: ReadonlySet; /** * True when `err` is a transient network glitch (retryable), false otherwise. * ECONNREFUSED is deliberately NOT transient — nothing is listening, a real death signal — * so it returns false and the caller surfaces it immediately instead of retrying into a * closed port. */ export declare function isTransientNetError(err: unknown): boolean; /** * Run `fn`, retrying up to `retries` times on a TRANSIENT error only, with a short linear * backoff between attempts. A non-transient error (or exhausting the retries) rethrows the * last error. `retries = 0` runs exactly once (no retry) — the default for non-idempotent * callers, so a dispatch is never double-fired. * * @param sleep injectable delay (defaults to a real timer) — lets tests run instantly. */ export declare function withTransientRetry(fn: () => Promise, retries: number, sleep?: (ms: number) => Promise, onRetry?: (info: { attempt: number; retries: number; errorClass: string; }) => void): Promise; /** Short, greppable class for an error — the libuv code, else a trimmed message. */ export declare function errClass(err: unknown): string;