/** * Storage Access Tools */ import { z } from 'zod'; import type { CDPManager } from '../cdp-manager.js'; import { PuppeteerManager } from '../puppeteer-manager.js'; import type { StorageToolMeta } from '../tool-response.js'; /** * Describe an arbitrary structured-clone value as JSON-expressible data. * * IndexedDB stores structured-clone values, and several of the most interesting * ones (a non-extractable `CryptoKey`, a `Blob`, an `ArrayBuffer`) serialize to * `{}` under JSON - which is exactly the case the caller most wants to assert * on. Instead of dropping them, emit a typed descriptor: * * { __type: 'CryptoKey', keyType, algorithm, extractable, usages } * * so "an unwrappable signing key is present, P-256, non-extractable" is * observable even though the key material is not. * * BUDGETS: `maxDepth`/`maxItems` are per-path and per-container, so they * multiply rather than bound - a 500-wide array whose elements share a 500-wide * array, repeated, is 500^6 visited nodes and pins the page's main thread. Two * TOTAL budgets bound the whole walk instead: `maxNodes` (values visited) and * `maxTotalChars` (characters emitted). Long strings are capped individually by * `maxStringLength`. Whenever a budget or a string cap trips, an explicit * marker is emitted ({__type:'BudgetExceeded'} / {__type:'String',truncated}) * and the top-level result is flagged, so a truncated read is never mistaken * for a complete one. * * IMPORTANT: this function is injected into the page by stringifying it (see * `SERIALIZER_SOURCE`), so it must be entirely self-contained - no imports, no * closure variables, no references to anything outside its own body. Everything * it needs is defined inline. It is exported so it can be unit-tested directly * in Node without a browser. */ export declare function describeStructuredValue(value: any, options?: { maxDepth?: number; maxItems?: number; maxNodes?: number; maxTotalChars?: number; maxStringLength?: number; }): any; /** * Presence for a localStorage/sessionStorage read, structurally. `getItem` * returns null only when the key is absent, so a stored empty string still * counts as present - which reading the rendered JSON could not tell apart. */ export declare function webStorageMeta(items: any, key?: string | number): StorageToolMeta; export declare function createStorageTools(puppeteerManager: PuppeteerManager, cdpManager: CDPManager, resolveConnectionFromReason?: (connectionReason: string) => Promise<{ connection: any; cdpManager: CDPManager; puppeteerManager: any; consoleMonitor: any; networkMonitor: any; } | null>): { storage: { description: string; zodSchema: z.ZodObject<{ action: z.ZodEnum<["getCookies", "setCookie", "getLocalStorage", "setLocalStorage", "removeLocalStorage", "getSessionStorage", "setSessionStorage", "removeSessionStorage", "idbListDatabases", "idbListStores", "idbGet", "idbGetAll", "idbPut", "idbDelete", "clear"]>; connectionReason: z.ZodOptional; url: z.ZodOptional; name: z.ZodOptional; value: z.ZodOptional; domain: z.ZodOptional; path: z.ZodOptional; expires: z.ZodOptional; httpOnly: z.ZodOptional; secure: z.ZodOptional; key: z.ZodOptional>; db: z.ZodOptional; store: z.ZodOptional; record: z.ZodOptional; limit: z.ZodOptional; reason: z.ZodOptional; types: z.ZodOptional, "many">>; }, "strict", z.ZodTypeAny, { action: "clear" | "getCookies" | "getLocalStorage" | "idbGet" | "idbGetAll" | "setCookie" | "setLocalStorage" | "removeLocalStorage" | "getSessionStorage" | "setSessionStorage" | "removeSessionStorage" | "idbListDatabases" | "idbListStores" | "idbPut" | "idbDelete"; value?: string | undefined; path?: string | undefined; url?: string | undefined; key?: string | number | undefined; name?: string | undefined; reason?: string | undefined; record?: any; connectionReason?: string | undefined; limit?: number | undefined; db?: string | undefined; store?: string | undefined; types?: ("localStorage" | "indexedDB" | "cookies" | "sessionStorage")[] | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; }, { action: "clear" | "getCookies" | "getLocalStorage" | "idbGet" | "idbGetAll" | "setCookie" | "setLocalStorage" | "removeLocalStorage" | "getSessionStorage" | "setSessionStorage" | "removeSessionStorage" | "idbListDatabases" | "idbListStores" | "idbPut" | "idbDelete"; value?: string | undefined; path?: string | undefined; url?: string | undefined; key?: string | number | undefined; name?: string | undefined; reason?: string | undefined; record?: any; connectionReason?: string | undefined; limit?: number | undefined; db?: string | undefined; store?: string | undefined; types?: ("localStorage" | "indexedDB" | "cookies" | "sessionStorage")[] | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; }>; inputSchema: import("zod-to-json-schema").JsonSchema7Type & { $schema?: string | undefined; definitions?: { [key: string]: import("zod-to-json-schema").JsonSchema7Type; } | undefined; }; handler: (args: { action: "clear" | "getCookies" | "getLocalStorage" | "idbGet" | "idbGetAll" | "setCookie" | "setLocalStorage" | "removeLocalStorage" | "getSessionStorage" | "setSessionStorage" | "removeSessionStorage" | "idbListDatabases" | "idbListStores" | "idbPut" | "idbDelete"; value?: string | undefined; path?: string | undefined; url?: string | undefined; key?: string | number | undefined; name?: string | undefined; reason?: string | undefined; record?: any; connectionReason?: string | undefined; limit?: number | undefined; db?: string | undefined; store?: string | undefined; types?: ("localStorage" | "indexedDB" | "cookies" | "sessionStorage")[] | undefined; domain?: string | undefined; expires?: number | undefined; httpOnly?: boolean | undefined; secure?: boolean | undefined; }, abortSignal?: AbortSignal) => Promise; }; }; //# sourceMappingURL=storage-tools.d.ts.map