/** Minimal structural shape of a fetch response we depend on. */ export interface HttpResponse { status: number; headers: { get(name: string): string | null; }; text(): Promise; } /** Injectable fetch. The global `fetch` is structurally compatible. */ export type FetchLike = (url: string, init?: { redirect?: 'manual' | 'follow'; headers?: Record; signal?: AbortSignal; }) => Promise; export interface FetchOk { ok: true; url: string; finalUrl: string; status: number; body: string; contentType: string | null; truncated: boolean; } export type FetchErrorKind = 'http' | 'network' | 'timeout' | 'too-many-redirects'; export interface FetchErr { ok: false; url: string; status?: number; error: string; kind: FetchErrorKind; } export type FetchResult = FetchOk | FetchErr; export interface SitemapResult { urls: string[]; truncated: boolean; errors: string[]; } export interface FetcherOptions { fetchImpl?: FetchLike; userAgent?: string; timeoutMs?: number; /** Approximate max body size (UTF-16 length); oversized bodies are truncated. */ maxBytes?: number; maxRedirects?: number; } export interface Fetcher { fetchUrl(url: string): Promise; fetchRobots(siteUrl: string): Promise; fetchLlmsTxt(siteUrl: string): Promise; fetchSitemap(url: string, opts?: { cap?: number; }): Promise; } export declare function createFetcher(options?: FetcherOptions): Fetcher;