/** Everything that can go wrong with one request, as data. */ export type StatelogFailure = { kind: "unreachable"; cause: string; } | { kind: "non-json"; status: number; diagnostic: string; } | { kind: "http"; status: number; serverError?: string; } | { kind: "bad-envelope"; status: number; } | { kind: "envelope-error"; status: number; serverError?: string; }; export type StatelogRequestOptions = { method: "GET" | "POST" | "PATCH" | "DELETE"; /** Families build their own URLs; the core receives a finished one. */ url: string; apiKey: string; /** JSON.stringify'd (exactly once) when present. */ body?: unknown; /** Unwrap the { success, value | error } envelope. Default true. Both * serve's bare-JSON /list manifest and uploadClient pass false. */ envelope?: boolean; /** Default true: a non-2xx response is an `http` failure, and that * classification wins over non-json and envelope handling. uploadClient * passes false — its route's settled semantics let the envelope decide the * outcome regardless of status. */ requireOk?: boolean; /** Default "when-body". serveClient passes "always" — it has always sent * Content-Type on bodyless GETs, and dropping a header is a wire change. */ contentType?: "when-body" | "always"; /** Diagnostic-only redaction, forwarded to readJsonBody. */ sanitizeDiagnostic?: (raw: string) => string; /** Test seam for the retry backoff; default real timer. */ sleep?: (ms: number) => Promise; }; export declare const RETRY_DELAYS_MS: number[]; export type StatelogRequestResult = { ok: true; value: unknown; status: number; } | { ok: false; failure: StatelogFailure; }; export declare function statelogRequest(options: StatelogRequestOptions): Promise;