import type { SpecShieldConfig } from "./config.js"; import type { Logger } from "./logger.js"; export interface ApiClientOptions { /** Total attempts including the first (retries = maxAttempts - 1). */ maxAttempts?: number; /** Base backoff in ms; delay grows linearly per attempt. 0 disables sleeping (tests). */ baseDelayMs?: number; /** Injectable fetch + sleep for tests. */ fetchImpl?: typeof fetch; sleepImpl?: (ms: number) => Promise; } /** * Thin HTTP adapter over the SpecShield backend `/api/intelligence/**` endpoints. * It holds NO diff/risk logic — every result comes from the backend. * * Contract: * - sends `X-Api-Key` on every request; * - retries only transient 429 / 5xx / network / timeout, up to `maxAttempts`; * - never retries 4xx validation/auth errors; * - enforces `SPECSHIELD_TIMEOUT_MS`; * - throws {@link SpecShieldError} whose message never contains the spec, the * API key, or the request body. */ export declare class SpecShieldApiClient { private readonly config; private readonly logger; private readonly maxAttempts; private readonly baseDelayMs; private readonly fetchImpl; private readonly sleep; constructor(config: SpecShieldConfig, logger: Logger, options?: ApiClientOptions); /** POST a JSON body and return the parsed JSON response. */ post(path: string, body: unknown): Promise; private backoff; }