import type { IncomingMessage, ServerResponse } from 'node:http'; import type { Subsystems } from '../../server.js'; export interface CompatContext { subsystems: Subsystems; bindIsLoopback: boolean; /** Path after the `/compat/firecrawl` prefix, e.g. `/v1/scrape`. */ subPath: string; respond: (status: number, body: unknown, headers?: Record) => void; } interface CompatCrawlPage { markdown: string; metadata: { sourceURL: string; statusCode?: number; }; } type JobStatus = 'scraping' | 'completed' | 'failed'; interface CrawlJob { id: string; status: JobStatus; data: CompatCrawlPage[]; total?: number; completed?: number; error?: string; /** Approximate stored payload size in bytes, for byte-pressure eviction. */ bytes: number; /** Wall-clock ms when the job reached a terminal state (completed/failed). */ settledAt?: number; } /** * In-memory crawl job store. NON-DURABLE — jobs are lost on restart; this is a * bench/compat convenience, not a durable queue. Bounded three ways: * - LRU by entry count (JOB_COUNT_CAP) * - total stored bytes (WIGOLO_SERVE_JOB_STORE_MAX_BYTES) with eviction on * byte pressure (oldest first) * - 30-min TTL for completed/failed jobs (swept lazily on access + on insert) * Insertion order in the Map is the LRU order (oldest first). */ export declare class CrawlJobStore { private readonly jobs; create(): CrawlJob; get(id: string): CrawlJob | undefined; /** Record the terminal payload for a job and enforce byte pressure. */ settle(job: CrawlJob, next: Partial): void; private sweepExpired; private enforceCountCap; private enforceByteCap; /** Test-only introspection. */ get size(): number; } /** For tests: the shared job store instance. */ export declare function getJobStore(): CrawlJobStore; /** * Handle a `/compat/firecrawl/*` request. Returns true when the request was * handled (response written). Auth + flag-gating already ran in the router. */ export declare function handleCompatRequest(req: IncomingMessage, _res: ServerResponse, ctx: CompatContext): Promise; export {}; //# sourceMappingURL=firecrawl-compat.d.ts.map