import { a as FirecrawlSearchResponse, n as FIRECRAWL_PROVIDER_ID, o as FirecrawlWebResult, r as FirecrawlNewsResult, t as FIRECRAWL_DEFAULT_BASE_URL } from "./http-DplgJYHl.js"; import z from "@deepseek-ai/schemastery"; import { WebSearchProvider, WebSearchRequest, WebSearchResult, WebSearchSource } from "@deepseek-ai/dsh-web"; import { Context } from "@deepseek-ai/cordis"; //#region src/search-provider.d.ts /** Which Firecrawl result arrays to request and map. */ type FirecrawlSearchSource = 'web' | 'news'; /** Resolved provider options (the plugin's `apply` supplies every default). */ interface FirecrawlSearchProviderOptions { /** Firecrawl API key. Empty/absent makes the provider unavailable. */ apiKey: string; /** Endpoint base; `/v2/search` is appended. */ baseURL: string; /** Result arrays to request. */ sources: readonly FirecrawlSearchSource[]; /** Default result count when a request carries no `maxResults`. */ limit?: number; /** * Scrape each result and use its markdown as the snippet. Far richer context * than the search-engine description, at a credit and latency cost, so it is * off by default. */ scrapeContent: boolean; /** Cap on snippet characters kept per result. Unset = no cap. */ maxCharsPerResult?: number; /** Restrict results to these hostnames. */ includeDomains?: readonly string[]; /** Drop results from these hostnames. */ excludeDomains?: readonly string[]; /** Time-based filter (`qdr:d`, `qdr:w`, `qdr:m`, `qdr:y`). */ tbs?: string; /** ISO country code for geo-targeting. */ country?: string; /** Location string for geo-targeting. */ location?: string; /** Firecrawl-side timeout in milliseconds. */ timeoutMs: number; } /** The Firecrawl-backed search provider. */ declare class FirecrawlSearchProvider implements WebSearchProvider { private readonly options; readonly id = "firecrawl"; constructor(options: FirecrawlSearchProviderOptions); available(): boolean; search(request: WebSearchRequest, signal?: AbortSignal): Promise; } /** * Build the `POST /v2/search` request body. * * A per-request `maxResults` wins over the configured `limit` and is sent as * Firecrawl's `limit` — a cost and latency optimization only; the seam enforces * the bound on the way back regardless. * * @param request - the seam's search request. * @param options - the resolved provider options. * @returns the JSON body to POST. */ declare function buildSearchBody(request: WebSearchRequest, options: FirecrawlSearchProviderOptions): Record; /** * Map a Firecrawl search envelope to the seam's normalized result. * * Web and news entries are mapped by their own shapes (news is where the only * publication timestamp comes from) and concatenated. Firecrawl returns no * generated answer, so `content` is omitted; the seam owns the final * `maxResults` truncation, so `truncated` is always false here. * * @param payload - the parsed `POST /v2/search` response. * @param maxCharsPerResult - optional per-snippet character cap. * @returns the normalized search result. */ declare function mapSearchResponse(payload: FirecrawlSearchResponse, maxCharsPerResult?: number): WebSearchResult; /** Map one `data.web[]` entry, or `undefined` when it carries no usable URL. */ declare function mapWebResult(result: FirecrawlWebResult, maxCharsPerResult?: number): WebSearchSource | undefined; /** Map one `data.news[]` entry, or `undefined` when it carries no usable URL. */ declare function mapNewsResult(result: FirecrawlNewsResult, maxCharsPerResult?: number): WebSearchSource | undefined; //#endregion //#region src/index.d.ts /** Cordis plugin name used by loader diagnostics. */ declare const name = "web-search-firecrawl"; /** The web seam this provider registers into. */ declare const inject: string[]; /** Default Firecrawl-side search timeout (ms), matching the API's own default. */ declare const DEFAULT_SEARCH_TIMEOUT_MS = 60000; /** Plugin config (all optional — `apply` fills env-var and schema defaults). */ interface Config { /** Firecrawl API key. Falls back to `$FIRECRAWL_API_KEY`. Empty → unavailable. */ apiKey?: string; /** Endpoint base; `/v2/search` is appended. Defaults to the public API. */ baseURL?: string; /** Result arrays to request. Defaults to `['web']`. */ sources?: FirecrawlSearchSource[]; /** Default result count when a request carries no `maxResults`. */ limit?: number; /** * Scrape each result and use its markdown as the snippet instead of the * search-engine description. Much richer context, at a credit and latency * cost — off by default. */ scrapeContent?: boolean; /** Cap on snippet characters kept per result. Unset = no cap. */ maxCharsPerResult?: number; /** Restrict results to these hostnames. */ includeDomains?: string[]; /** Drop results from these hostnames. */ excludeDomains?: string[]; /** Time filter: `qdr:h`, `qdr:d`, `qdr:w`, `qdr:m`, `qdr:y`. */ tbs?: string; /** ISO country code for geo-targeting (e.g. `US`). */ country?: string; /** Location string for geo-targeting (e.g. `San Francisco,California,United States`). */ location?: string; /** Firecrawl-side timeout in milliseconds. Defaults to 60000. */ timeoutMs?: number; } /** Complete config after schemastery applies every field default. */ interface ResolvedConfig extends Config { baseURL: string; sources: FirecrawlSearchSource[]; scrapeContent: boolean; timeoutMs: number; } declare const Config: z; /** Register the Firecrawl search provider with `ctx.web`. */ declare function apply(ctx: Context, config: ResolvedConfig): void; //#endregion export { Config, DEFAULT_SEARCH_TIMEOUT_MS, FIRECRAWL_DEFAULT_BASE_URL, FIRECRAWL_PROVIDER_ID, FirecrawlSearchProvider, type FirecrawlSearchProviderOptions, type FirecrawlSearchSource, apply, buildSearchBody, inject, mapNewsResult, mapSearchResponse, mapWebResult, name };