import type { SearchRequest, SearchSource } from "../../capabilities/search.js"; import type { ReaderFetchRequest, ReaderFetchResult, LegacyReaderCacheCandidate } from "../../capabilities/reader.js"; import type { CrawlRequest, CrawlResult } from "../../capabilities/crawl.js"; import type { MapRequest, MapResult } from "../../capabilities/map.js"; import type { DiagnosticsCapability } from "../../capabilities/diagnostics.js"; import type { ProviderCapability, ProviderContext } from "../types.js"; import { type SpiderTransportDeps } from "./client.js"; import { type SpiderQuotaCapability } from "./quota.js"; /** * Local cache-identity type: identical to the shared * `SearchCacheIdentity` except `provider` is the `"spider"` literal. * Assignable to the shared contract once `"spider"` joins `PROVIDER_IDS`. */ interface SpiderSearchCacheIdentity { readonly provider: "spider"; readonly capability: "search"; readonly credentialFingerprint: string; readonly request: Readonly; } /** Local Search contract — see the module header. */ interface SpiderSearchCapability { validate(request: SearchRequest): void; cacheIdentity(request: SearchRequest): SpiderSearchCacheIdentity; invoke(request: SearchRequest): Promise; } /** * Local cache-identity type: identical to the shared * `ReaderCacheIdentity` except `provider` is the `"spider"` literal. * Assignable to the shared contract once `"spider"` joins `PROVIDER_IDS`. */ interface SpiderReaderCacheIdentity { readonly provider: "spider"; readonly capability: "reader"; readonly operation: "reader-fetch"; readonly credentialFingerprint: string; readonly request: Readonly; readonly legacyCandidates: readonly LegacyReaderCacheCandidate[]; } /** Local Reader operation contract — see the module header. */ interface SpiderReaderOperation { readonly kind: "reader-fetch"; validate(request: ReaderFetchRequest): void; cacheIdentity(request: ReaderFetchRequest): SpiderReaderCacheIdentity; decodeCached(value: unknown): ReaderFetchResult | null; invoke(request: ReaderFetchRequest, signal?: AbortSignal): Promise; } /** Local Reader contract — see the module header. */ interface SpiderReaderCapability { readonly fetch: SpiderReaderOperation; } /** * Local cache-identity type: identical to the shared `CacheIdentity` * for crawl except `provider` is the `"spider"` literal. Assignable to * the shared contract once `"spider"` joins `PROVIDER_IDS`. */ interface SpiderCrawlCacheIdentity { readonly provider: "spider"; readonly capability: "crawl"; readonly credentialFingerprint: string; readonly request: Readonly; } /** Local Crawl operation contract — see the module header. */ interface SpiderCrawlOperation { readonly kind: "crawl-fetch"; validate(request: CrawlRequest): void; cacheIdentity(request: CrawlRequest): SpiderCrawlCacheIdentity; decodeCached(value: unknown): CrawlResult | null; invoke(request: CrawlRequest): Promise; } /** Local Crawl contract — see the module header. */ interface SpiderCrawlCapability { readonly fetch: SpiderCrawlOperation; } /** * Local cache-identity type: identical to the shared `CacheIdentity` * for map except `provider` is the `"spider"` literal. Assignable to * the shared contract once `"spider"` joins `PROVIDER_IDS`. */ interface SpiderMapCacheIdentity { readonly provider: "spider"; readonly capability: "map"; readonly credentialFingerprint: string; readonly request: Readonly; } /** Local Map operation contract — see the module header. */ interface SpiderMapOperation { readonly kind: "map-fetch"; validate(request: MapRequest): void; cacheIdentity(request: MapRequest): SpiderMapCacheIdentity; decodeCached(value: unknown): MapResult | null; invoke(request: MapRequest): Promise; } /** Local Map contract — see the module header. */ interface SpiderMapCapability { readonly fetch: SpiderMapOperation; } /** * Dependencies the Spider Adapter accepts. The unified `transport` seam * carries `fetch` and timer injection. */ export interface SpiderAdapterDependencies { readonly transport?: SpiderTransportDeps; } /** Local Adapter contract — see the module header. */ interface SpiderAdapter { readonly id: "spider"; readonly search: SpiderSearchCapability; readonly reader: SpiderReaderCapability; readonly crawl: SpiderCrawlCapability; readonly map: SpiderMapCapability; readonly quota: SpiderQuotaCapability; readonly diagnostics: DiagnosticsCapability; } /** Local Descriptor contract — see the module header. */ interface SpiderDescriptor { readonly id: "spider"; isConfigured(env: NodeJS.ProcessEnv): boolean; capabilities(): ReadonlySet; create(context: ProviderContext): SpiderAdapter; readonly credentialEnvVars: readonly string[]; } /** * Build the Spider.cloud Provider Descriptor. Advertises the full * Spider.cloud capability set (Search, Reader, Crawl, Map, Quota, * Diagnostics). `create()` is side-effect-free; the transport is * invoked per Capability call. */ export declare function createSpiderDescriptor(dependencies?: SpiderAdapterDependencies): SpiderDescriptor; export {}; //# sourceMappingURL=adapter.d.ts.map