/** * Exa search-provider adapter for `web.search`. * * Implements the {@link SearchProvider} contract from `./provider.ts` and * registers itself in the {@link searchProviders} registry on import. Like * the Brave and Tavily adapters it issues exactly one outbound HTTPS request * per invocation (Requirement 6.7), forwards the caller-provided * {@link AbortSignal} so the `web.search` timeout is honored (Requirement * 1.8), and returns a {@link RawProviderResponse} carrying the raw HTTP * status plus the parsed hit list for uniform error classification in the * handler (Requirements 6.1, 6.2, 6.5, 6.6). * * Endpoint and request shape follow Exa's `/search` reference * (https://docs.exa.ai/reference/search-api-guide-for-coding-agents): * * - POST `https://api.exa.ai/search` * - Header: `x-api-key: ` * - Body: `{ query, type, numResults, contents: { highlights: true } }` * where `type` is the user-configured {@link ExaSearchType} and * `contents` is omitted for the `instant` tier so it keeps its * sub-second latency profile. * - Response: `{ results: [{ title, url, highlights?, text?, summary? }] }` * mapped into `SearchResult { title, url, snippet }`. * * Only raw `results` + `highlights` are requested; `outputSchema` synthesis * is intentionally not used because the handler maps discrete hits rather * than a single grounded answer, and skipping it keeps latency and response * shape stable across every search type. */ import https from "node:https"; import { type SearchProvider } from "./provider.js"; import { type ExaSearchType } from "../types.js"; type HttpsRequestFn = typeof https.request; /** * Test-only seam: swap the HTTPS transport used by the adapter. Production * callers never invoke this; tests use it to inject a stubbed `request` * implementation that emits scripted responses. */ export declare function __setExaHttpsRequestForTesting(fn: HttpsRequestFn | undefined): void; /** * Test-only seam: override how the adapter resolves the configured search * type. Passing `undefined` restores the config-backed resolver. */ export declare function __setExaSearchTypeResolverForTesting(resolver: (() => ExaSearchType) | undefined): void; /** * Exa adapter. Registered in {@link searchProviders} as a side-effect of * importing this module — `web.search` resolves the active provider via the * registry. */ export declare const exaProvider: SearchProvider; export {};