import type { FetchImpl, Model } from "../types.js"; /** Bodies below one TCP segment gain nothing from compression; skip them. */ export declare const MIN_COMPRESSED_BODY_BYTES = 1024; /** * Compresses request bodies from {@link model} to its provider's own endpoint * when its catalog rules declare encodings the endpoint decodes * (`request-encodings` / `endpoint-hosts` KDL axes). Long sessions resend * multi-MB transcripts every turn, so upload time dominates time-to-first-token * on ordinary uplinks. * * Install it beneath any body rewriter or signer (e.g. the cch attestation * patch): those must see the uncompressed bytes. Other hosts, small bodies, * bodies that already carry `Content-Encoding`, and `PI_REQUEST_COMPRESSION=0` * pass through untouched. A possible rejection — the host's decode error, or a * non-JSON 400/403/415 from a proxy in front of it — is resent uncompressed * once; only when that resend succeeds is the encoding latched off for the * host, so a genuine 400 never disables compression. When a non-JSON refusal * recurs uncompressed with the same status and a non-JSON body, that status * stops being re-checked for the host. */ export declare function wrapFetchForRequestCompression(base: FetchImpl, model: Model): FetchImpl; /** Test hook: clears every per-host latch. */ export declare function resetRequestCompressionForTesting(): void;