/** * One entry in the per-session page cache. `html` is the response body; * `status` and `headers` come from the original fetch so downstream tools * (`check_indexability` reading X-Robots-Tag, etc.) don't have to re-fetch. */ export interface PageCacheEntry { url: string; html: string; status: number; headers: Record; fetchedAt: number; } export declare class PageCache { private readonly maxBytes; private readonly store; private currentBytes; constructor(maxBytes?: number); /** * Stable pageId derivation: sha256 of the URL, truncated to 16 hex chars * (~64 bits — collision-safe for any realistic session size). Same URL * always maps to the same pageId so `fetch_page` is idempotent within * a session, and the LLM can re-reference a page without juggling ids. */ static idFor(url: string): string; put(entry: Omit): string; get(pageId: string): PageCacheEntry | null; has(pageId: string): boolean; size(): number; /** Memory usage estimate in bytes — useful for orchestrator-side monitoring. */ approximateBytes(): number; } /** * Run `fn` with `cache` available via `currentPageCache()`. The * orchestrator runner wraps its `generateText` call in this so every tool * invocation (including those nested inside the AI SDK's tool loop) sees * the same cache. */ export declare function withPageCache(cache: PageCache, fn: () => Promise): Promise; /** * Read the current session's page cache. Returns null when called outside * `withPageCache` (e.g. unit tests that don't set one up — those tests use * `setTestCache` to inject a cache directly). */ export declare function currentPageCache(): PageCache | null; /** * Test-only helper: set a page cache for the duration of a synchronous or * async test. Use as `await withPageCache(cache, async () => { ... })` * — same API as the production wrapper, just imported in tests. */ export declare const setTestCache: typeof withPageCache; /** * Resolve a `pageId` to its cache entry — the standard tool-side helper. * Throws a clear, LLM-friendly error when the cache isn't in scope or the * pageId is unknown so the orchestrator can recover by re-fetching rather * than crashing the session. */ export declare function resolvePage(pageId: string): PageCacheEntry; /** * Multi-page variant. Resolves a list of pageIds in one call; throws on * the first unknown id so the LLM gets specific feedback about which page * needs re-fetching. */ export declare function resolvePages(pageIds: string[]): PageCacheEntry[]; //# sourceMappingURL=page-cache.d.ts.map