/** * Sanitize a URL for logging: strip query params that might contain secrets. */ export declare function sanitizeUrlForLog(url: string | URL | Request): string; /** * instrumentedFetch, wraps the global fetch with structured OUTBOUND_HTTP logging. * * Use this in place of bare `fetch()` for non-streaming outbound HTTP calls where * observability is required. For streaming calls (SSE/chat completions) where the * caller already manages an AbortController, use fetch() directly, those streams * manage their own lifecycle and do not benefit from this wrapper. * * @param url - The URL or Request to fetch. * @param init - Standard RequestInit (optional). */ export declare function instrumentedFetch(url: string | URL | Request, init?: RequestInit): Promise; /** * createTimeoutController, creates an AbortController that fires after `timeoutMs`. * * When `parentSignal` is provided the returned signal is merged with it via * AbortSignal.any so whichever fires first wins. * * Uses the faster `AbortSignal.timeout` fast-path when available and no parent * signal needs to be merged. * * @param timeoutMs - Milliseconds before aborting. * @param parentSignal - Optional caller signal to merge with the timeout. * @returns `{ signal, dispose }`, call `dispose()` in a `finally` block to * clear the underlying timer and avoid keeping the event loop alive. */ export declare function createTimeoutController(timeoutMs: number, parentSignal?: AbortSignal): { readonly signal: AbortSignal; dispose(): void; }; /** * fetchWithTimeout, wraps a fetch implementation with an AbortController timeout. * * If the caller passes a signal that is already aborted, the request is * rejected immediately. When both a caller signal and the internal timeout * controller are present, they are merged via AbortSignal.any so that * whichever fires first wins. * * Streaming fetches (SSE, chat completions) where the caller already manages * an AbortController via ChatRequest.signal should NOT use this helper, * pass the signal directly to fetch() as they already do. * * @param url - The URL or Request to fetch. * @param init - Standard RequestInit (optional). * @param timeoutMs - Milliseconds before aborting. Default: 30 000. * @param fetchImpl - Fetch implementation to use. Defaults to global `fetch`. * Pass `instrumentedFetch` to include OUTBOUND_HTTP logging. */ export declare function fetchWithTimeout(url: string | URL | Request, init?: RequestInit, timeoutMs?: number, fetchImpl?: (url: string | URL | Request, init?: RequestInit) => Promise): Promise; //# sourceMappingURL=fetch-with-timeout.d.ts.map