/** * Shared HTTP plumbing for the capability probe and the inline wires: * bounded response reading, caller-cancellation races for preflight steps, * and the stable {@link WebError} translations. The patterns mirror the * harness `dsh-web` package family (web-search-deepseek, model discovery) so * every credentialed request rejects redirects before a `Location` target can * be contacted. * @module dsh-github-copilot/http */ /** * Endpoint replies larger than this are refused. The endpoint is whatever * base URL the configuration named, so the ceiling holds on the bytes * actually read rather than on the length the server claims. */ export declare const MAX_RESPONSE_BYTES: number; /** * Read a response body with a hard byte cap, refusing one that outgrows it. * A declared length is checked first so an honest server is turned away * without transferring anything; the accumulated total is what actually * enforces the bound, because a server that under-declares (or streams) tells * us nothing up front. * @param response - the HTTP response whose body is read to completion. * @param url - the requested URL, named in the refusal message. * @returns the decoded body text. * @throws WebError `WEB_PROVIDER_ERROR` when the body exceeds the cap. */ export declare function readBounded(response: Response, url: string): Promise; /** Whether an error is the fetch/`AbortSignal` abort signal. */ export declare function isAbortError(error: unknown): boolean; /** * Race a same-process asynchronous preflight (credential resolution) against * a cancellation signal. The attached settlement handlers keep observing an * uncooperative operation after the race is lost, so a later rejection cannot * become unhandled. * @param operation - the preflight promise. * @param signal - the cancellation signal (request abort or idle watchdog). * @returns the operation's value, or a rejection once the signal fires. */ export declare function abortable(operation: Promise, signal: AbortSignal | undefined): Promise; /** * Extract a provider error message from an error envelope whose shape varies * by protocol and vendor: `{ error: { message } }`, `{ error: "text" }`, or * `{ message }`. Returns `undefined` when nothing usable is present. * @param body - the parsed non-2xx response body. * @returns the provider message, or `undefined`. */ export declare function providerErrorMessage(body: unknown): string | undefined; //# sourceMappingURL=http.d.ts.map