import { i as FirecrawlScrapeResponse, n as FIRECRAWL_PROVIDER_ID, t as FIRECRAWL_DEFAULT_BASE_URL } from "./http-DplgJYHl.js"; import z from "@deepseek-ai/schemastery"; import { WebFetchProvider, WebFetchRequest, WebFetchResult } from "@deepseek-ai/dsh-web"; import { Context } from "@deepseek-ai/cordis"; //#region src/fetch-provider.d.ts /** Which Firecrawl format backs the returned body. */ type FirecrawlFetchFormat = 'markdown' | 'html'; /** Firecrawl proxy tier for the scrape. */ type FirecrawlProxy = 'auto' | 'basic' | 'stealth'; /** Resolved provider options (the plugin's `apply` supplies every default). */ interface FirecrawlFetchProviderOptions { /** Firecrawl API key. Empty/absent makes the provider unavailable. */ apiKey: string; /** Endpoint base; `/v2/scrape` is appended. */ baseURL: string; /** Requested format. `markdown` decodes as `text`; `html` as `html`. */ format: FirecrawlFetchFormat; /** Strip nav/header/footer chrome from the result. */ onlyMainContent: boolean; /** Serve a cached page younger than this many milliseconds. 0 disables. */ maxAgeMs: number; /** Delay in milliseconds before capture, for slow client-rendered pages. */ waitForMs: number; /** Emulate a mobile device. */ mobile: boolean; /** Block ads and cookie banners. */ blockAds: boolean; /** Proxy tier; `stealth` retries anti-bot pages at a higher credit cost. */ proxy: FirecrawlProxy; /** Firecrawl-side timeout in milliseconds. */ timeoutMs: number; /** Cap on decoded body characters; the result flags truncation. */ maxBodyChars: number; /** Maximum accepted request URL length. */ maxUrlLength: number; } /** The Firecrawl-backed fetch provider. */ declare class FirecrawlFetchProvider implements WebFetchProvider { private readonly options; readonly id = "firecrawl"; constructor(options: FirecrawlFetchProviderOptions); available(): boolean; fetch(request: WebFetchRequest, signal?: AbortSignal): Promise; } /** * Validate a fetch target locally, throwing {@link WebError} `WEB_INVALID_URL` * when it must not be requested. Same vocabulary as the local HTTP provider so * a consumer routing on the code does not care which backend is mounted. * * @param url - the requested URL. * @param maxUrlLength - the configured length cap. */ declare function assertFetchableUrl(url: string, maxUrlLength: number): void; /** * Build the `POST /v2/scrape` request body. * * @param request - the seam's fetch request. * @param options - the resolved provider options. * @returns the JSON body to POST. */ declare function buildScrapeBody(request: WebFetchRequest, options: FirecrawlFetchProviderOptions): Record; /** * Map a Firecrawl scrape envelope to the seam's normalized fetch result. * * A non-2xx page is a RESULT, not a throw: Firecrawl answers `success: true` * with `metadata.statusCode: 404` and whatever the server served, and the seam * defines the status code as part of the fetched resource state. * * @param payload - the parsed `POST /v2/scrape` response. * @param requestedUrl - the URL as requested, used when the response omits one. * @param options - the resolved provider options. * @returns the normalized fetch result. */ declare function mapScrapeResponse(payload: FirecrawlScrapeResponse, requestedUrl: string, options: Pick): WebFetchResult; //#endregion //#region src/fetch.d.ts /** Cordis plugin name used by loader diagnostics. */ declare const name = "web-fetch-firecrawl"; /** The web seam this provider registers into. */ declare const inject: string[]; /** Default Firecrawl-side scrape timeout (ms), matching the API's own default. */ declare const DEFAULT_FETCH_TIMEOUT_MS = 60000; /** * Default decoded-body cap. Matches the local HTTP provider's 100,000-character * cap, which sits below `dsh-tool-web`'s 200,000-character output cap. */ declare const DEFAULT_MAX_BODY_CHARS = 100000; /** Default cached-page age (ms) Firecrawl may serve: two days, the API default. */ declare const DEFAULT_MAX_AGE_MS = 172800000; /** 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/scrape` is appended. Defaults to the public API. */ baseURL?: string; /** * Body format. `markdown` (default) decodes as the seam's `text` kind and is * what a model reads best; `html` decodes as `html` for markup-sensitive work. */ format?: FirecrawlFetchFormat; /** Strip nav/header/footer chrome. Defaults to true. */ onlyMainContent?: boolean; /** Serve a cached page younger than this many ms. 0 forces a fresh scrape. */ maxAgeMs?: number; /** Delay in ms before capture, for slow client-rendered pages. Defaults to 0. */ waitForMs?: number; /** Emulate a mobile device. Defaults to false. */ mobile?: boolean; /** Block ads and cookie banners. Defaults to true. */ blockAds?: boolean; /** Proxy tier. `stealth` retries anti-bot pages at a higher credit cost. */ proxy?: FirecrawlProxy; /** Firecrawl-side timeout in milliseconds. Defaults to 60000. */ timeoutMs?: number; /** Cap on decoded body characters. Defaults to 100000. */ maxBodyChars?: number; /** Maximum accepted request URL length. Defaults to 2048. */ maxUrlLength?: number; } /** Complete config after schemastery applies every field default. */ type ResolvedConfig = Required> & Pick; declare const Config: z; /** Register the Firecrawl fetch provider with `ctx.web`. */ declare function apply(ctx: Context, config: ResolvedConfig): void; //#endregion export { Config, DEFAULT_FETCH_TIMEOUT_MS, DEFAULT_MAX_AGE_MS, DEFAULT_MAX_BODY_CHARS, FIRECRAWL_DEFAULT_BASE_URL, FIRECRAWL_PROVIDER_ID, type FirecrawlFetchFormat, FirecrawlFetchProvider, type FirecrawlFetchProviderOptions, type FirecrawlProxy, apply, assertFetchableUrl, buildScrapeBody, inject, mapScrapeResponse, name };