import { type Resolver } from '../source-url-validator.js'; /** * Link-check gate: verifies every `sources[*].url` declared in changed * knowledge entries resolves to a 2xx (after following 3xx). HEAD is tried * first; if the server returns 405/501 or any non-2xx that's still <500, we * fall back to a GET with `Range: bytes=0-0` so the body cap from * `fetchAndHash` doesn't apply here either. * * SSRF: every hop is re-validated using the same `assertSafeSourceUrlWithDns` * + pinning-agent pattern as `source-hash.ts::fetchAndHash`. This is the only * other code path that issues outbound HTTP from this package — keeping the * guards identical means a fix to one applies to both. */ export type FetchImpl = (input: string, init?: Record) => Promise; export interface LinkCheckOptions { resolver?: Resolver; timeoutMs?: number; fetchImpl?: FetchImpl; /** * Hosts (or exact URLs) to skip entirely. Drawn from * `.scaffold/observability.yaml` `knowledge_freshness.link_check.skip:` when * present. Matching is by exact-URL or by hostname suffix. */ skip?: string[]; } export interface LinkCheckResult { url: string; ok: boolean; status: number | null; reason?: string; /** True when the URL matched the operator opt-out list and was not fetched. */ skipped?: boolean; } /** * HEAD-check one URL (with GET-Range fallback). Returns a structured result * rather than throwing so the caller can aggregate per-URL outcomes for the * CI annotation output. SSRF / DNS-rebinding errors surface as `ok: false` * with `status: null` and the validator's message in `reason`. */ export declare function checkOneUrl(url: string, opts?: LinkCheckOptions): Promise; /** * Check every URL across a set of entries. Returns one result per (url, file) * pair so the CLI can attribute failures to specific files in the PR. */ export interface AggregateLinkCheckResult { ok: boolean; results: Array; } export declare function checkUrlsForEntries(entries: Array<{ file: string; sourceUrls: string[]; }>, opts?: LinkCheckOptions): Promise; //# sourceMappingURL=link-check.d.ts.map