import { LoadWebOptions, RagLoaderResult } from "./loader.type.mjs"; //#region ../ai/src/rag/loaders/load-web.d.ts /** * Fetch a URL through the SSRF-safe outbound policy and load it into a single * {@link RagDocument} of readable text. The fetch ALWAYS goes through * `guardedFetch` — never a raw `fetch` — so the scheme allowlist, host * allowlist, post-DNS private-IP guard, timeout, and response-size cap from * {@link LoadWebOptions.policy} (or the strict defaults) always apply. * * HTML responses are run through the same tag-strip pass as {@link loadHtml} * (scripts/styles dropped, entities decoded, paragraph structure kept); * non-HTML text responses (`text/plain`, markdown, …) are used verbatim. * The document's `metadata.source` is the resolved URL, `metadata.title` is * the page `` (HTML only, unless overridden), `metadata.contentType` * is the server-reported type, and `metadata.loader` is `"web"`. * * The output is the exact shape `index()` consumes, so a load feeds straight * in: * * @example * const kb = ai.rag({ embedder, store }); * await kb.index(await loadWeb("https://example.com/guide")); * * @example * // Tighten the SSRF policy to a single host: * await kb.index(await loadWeb(url, { * policy: { hostAllowlist: ["docs.example.com"], maxBytes: 2_000_000 }, * tags: ["docs"], * })); * * @param url - The absolute URL to fetch. Validated by the outbound policy. * @param options - `policy` (the {@link OutboundPolicy}) plus shared * `id` / `metadata` / `tags` ({@link LoadWebOptions}). * @returns A {@link RagLoaderResult} (one document) ready for `rag.index()`. * @throws {OutboundPolicyError} when the policy blocks the URL, the request * times out, the body exceeds the cap, or the response is not OK. */ declare function loadWeb(url: string, options?: LoadWebOptions): Promise<RagLoaderResult>; //#endregion export { loadWeb }; //# sourceMappingURL=load-web.d.mts.map