export type Action = "markdown" | "screenshot" | "pdf"; export type ApiResult = { ok: true; action: Action; content: string | Uint8Array; } | { ok: false; action?: Action; content?: undefined; error: string; }; /** Reject non-http(s), oversized, userinfo, or SSRF-prone URLs. */ export declare function assertSafeUrl(raw: string): string; export interface BrowserRunConfig { apiToken: string; accountId: string; apiBase?: string; } /** Validate the plugin-config credentials; returns a setup-hint error when * incomplete so the tools degrade gracefully instead of throwing at boot. */ export declare function resolveConfig(input: { cf_api_token?: string; cf_account_id?: string; cf_api_base?: string; }): BrowserRunConfig | { error: string; }; export declare function browserRunAction(config: BrowserRunConfig, action: Action, rawUrl: string, externalSignal?: AbortSignal): Promise; export type CrawlSource = "all" | "sitemaps" | "links"; export type CrawlFormat = "html" | "markdown" | "json"; export interface CrawlStartParams { url: string; limit?: number; depth?: number; formats?: CrawlFormat[]; render?: boolean; source?: CrawlSource; includePatterns?: string[]; excludePatterns?: string[]; includeExternalLinks?: boolean; includeSubdomains?: boolean; /** Content Signals purpose declarations. */ crawlPurposes?: Array<"search" | "ai-input" | "ai-train">; contentUse?: "reference" | "full"; } export interface CrawlStatusQuery { jobId: string; /** Max records to return (omit for a full page of results). */ limit?: number; cursor?: string | number; /** Filter records: queued|completed|disallowed|skipped|errored|cancelled */ status?: string; } export type CrawlJobStatus = "running" | "completed" | "errored" | "cancelled_due_to_timeout" | "cancelled_due_to_limits" | "cancelled_by_user" | string; export interface CrawlRecord { url: string; status: string; markdown?: string; html?: string; json?: unknown; metadata?: Record; } export interface CrawlJobResult { id: string; status: CrawlJobStatus; browserSecondsUsed?: number; total?: number; finished?: number; records?: CrawlRecord[]; cursor?: string | number; } export type CrawlApiResult = { ok: true; jobId: string; job?: CrawlJobResult; } | { ok: false; error: string; }; /** Start a crawl job; returns the job id immediately. */ export declare function crawlStart(config: BrowserRunConfig, params: CrawlStartParams): Promise; /** Fetch crawl job status / records. */ export declare function crawlStatus(config: BrowserRunConfig, query: CrawlStatusQuery): Promise; /** * Start a crawl and optionally poll until a terminal status. * `wait` defaults to true when limit is undefined or ≤20, else false. */ export declare function crawl(config: BrowserRunConfig, params: CrawlStartParams & { wait?: boolean; }): Promise; /** Whether wait should default on for a given limit (exported for tests). */ export declare function defaultCrawlWait(limit?: number): boolean;