/** Reversible fetch wrapper for proxy dispatch and fixed headers. */ import { AsyncLocalStorage } from 'node:async_hooks'; export interface ProxyContext { proxyUrl?: string; provider: string; model: string; /** Fixed extra headers of the matched rule; direct mode may send them too. */ headers?: Readonly>; } export declare const als: AsyncLocalStorage; /** Install the wrapper only when a route or fixed header may be applied. */ export declare function shouldWrapFetch(config: { enabled: boolean; defaultProxy?: string; defaultProxyHostId?: string; proxyHosts?: ReadonlyArray<{ id: string; proxyUrl: string; }>; rules?: ReadonlyArray<{ proxyUrl?: string; proxyHostId?: string; headers?: Readonly>; headerValueSources?: Readonly>; enabled?: boolean; }>; }): boolean; /** Minimal logger face so the host can route diagnostics through ctx.logger. */ export interface FetchWrapLogger { error?(msg: string): void; } /** Add configured headers only when the request does not already have them. */ export declare function applyExtraHeaders(base: Headers, extra: Readonly> | undefined): Headers; /** Wrap global fetch and return a disposer safe for overlapping HMR instances. */ export declare function installFetchWrapper(log?: FetchWrapLogger): () => void; //# sourceMappingURL=fetch-wrap.d.ts.map