import { type Resolver } from './source-url-validator.js'; /** Production fetch implementation. Tests inject a mock via opts.fetchImpl. */ export type FetchImpl = (input: string, init?: Record) => Promise; /** Test-injectable options. Production callers omit this. */ export interface FetchAndHashOptions { resolver?: Resolver; /** Per-fetch timeout in ms (each hop is bounded separately). Default 30s. */ timeoutMs?: number; /** Body size ceiling in bytes. Default 5 MiB. */ maxBodyBytes?: number; /** * Override the fetch implementation. Used only by tests so they can * mock responses without going to the network. Production uses undici's * fetch so the pinning Agent dispatcher API matches. */ fetchImpl?: FetchImpl; } /** * GET a URL and sha256 its body. Used by: * - audit-prefilter: to detect upstream changes (compare fresh hash * against the frontmatter's stored hash) * - audit-apply: to compute deterministic hashes for persistence, * preferring them over LLM-emitted content_hash values * * Validates EVERY hop (initial URL + each redirect target) against the SSRF * guard. A naive `fetch(url)` follows redirects automatically, so a source * pointing at a public URL that 302's to localhost / 169.254.169.254 would * bypass the guard (round-4 F-002). We do redirects manually, validate the * Location header, and cap at MAX_REDIRECT_HOPS. * * Throws on guard failure, network failure, non-2xx final responses, or * redirect-without-Location so callers can decide whether to skip * (pre-filter) or abort (apply). */ export declare function fetchAndHash(url: string, opts?: FetchAndHashOptions): Promise<{ hash: string; body: string; }>; //# sourceMappingURL=source-hash.d.ts.map