/** * DuckDuckGo search-provider adapter. * * Used as the keyless default so `clai` works out of the box without * any API key (Requirement 3.5). The adapter targets DuckDuckGo's * lite-HTML endpoint at `https://html.duckduckgo.com/html/?q=…`, * parses the response with `cheerio`, unwraps the in-page redirect * shim (`/l/?uddg=`) so callers see the destination URL, and * applies the same URL filter `web.search` enforces (Requirement 7.3) * before forwarding hits to the registry handler. * * The adapter does not need redirect-chain capture, fine-grained * timing, TLS metadata, or DNS-rebinding protection beyond the * per-invocation `AbortSignal`, so it deliberately bypasses the full * `fetch-core` pipeline. A small `node:https.request`-based helper * keeps the implementation simple while still honoring the 15-second * `web.search` invocation timeout (Requirement 1.8) via the supplied * `AbortSignal`. * * Per Requirement 6.7 the adapter issues exactly one outbound request * per invocation and never retries on transient failure. */ import https from "node:https"; import type { SearchProvider } from "./provider.js"; /** * Inject point for the underlying HTTPS transport. Mirrors the seam in * `./brave.ts` so unit tests can drive the adapter without touching the * network. Production code never invokes the setter. */ type HttpsRequestFn = typeof https.request; /** * Test-only seam: swap the HTTPS transport used by the adapter. Tests use * this to inject a stubbed `request` implementation that emits scripted * responses; production callers never invoke it. */ export declare function __setDuckduckgoHttpsRequestForTesting(fn: HttpsRequestFn | undefined): void; /** * The DuckDuckGo {@link SearchProvider} adapter. * * Resolves a search query into a {@link RawProviderResponse} carrying * up to `maxResults` `{title, url, snippet}` hits. URL filtering and * `maxResults` truncation happen here so the registry handler does not * have to re-walk the cheerio tree; the handler still re-applies the * filter for defense in depth (Requirement 7.3). */ export declare const duckduckgoProvider: SearchProvider; export {};