import { WipSession } from './wip-client/ws-session.js'; import { type CapabilitySnapshot } from './capability.js'; export interface ConsoleEntry { source: 'Console.messageAdded' | 'Runtime.exceptionThrown'; level: string; text: string; url?: string; line?: number; column?: number; timestamp?: number; args?: unknown[]; stackTrace?: unknown; raw: unknown; } export interface NetworkEntry { requestId: string; url: string; method?: string; status?: number; statusText?: string; mimeType?: string; type?: string; initiatorType?: string; startedAt?: number; endedAt?: number; encodedDataLength?: number; errorText?: string; state: 'pending' | 'response-received' | 'finished' | 'failed'; requestHeaders?: Record; responseHeaders?: Record; postData?: string; } /** * batch-14 frozen contract for `Network.requestIntercepted` (cross-review v2.0.1): * - 30s auto-continue if not consumed * - 16 max concurrent pending; oldest auto-continued when overflow * - explicit `abort=true` for block; default = continue */ export interface InterceptedRequest { requestId: string; url: string; method?: string; headers?: Record; postData?: string; stage?: string; arrivedAt: number; autoContinueTimer?: ReturnType; } export declare const INTERCEPT_AUTO_CONTINUE_MS = 30000; export declare const INTERCEPT_MAX_PENDING = 16; export interface AttachInfo { deviceId: string; deviceOSVersion?: string; pageId: string; pageTitle: string; pageUrl: string; webSocketDebuggerUrl: string; targetId?: string; attachedAt: number; } export declare class PageSession { private static cached; static get(opts?: { proxyDeviceListUrl?: string; bufferCap?: number; pageId?: string; }): Promise; static reset(): void; readonly session: WipSession; readonly consoleBuffer: ConsoleEntry[]; readonly networkBuffer: NetworkEntry[]; readonly networkById: Map; readonly intercepted: Map; attachInfo: AttachInfo | undefined; enableErrors: Array<{ method: string; error: string; }>; private alive; private readonly cap; private capabilityPromise; private capabilitySnapshot; private constructor(); isAlive(): boolean; close(): void; private init; /** * Returns the capability snapshot synchronously if the background probe has * completed, else `undefined`. Tools that want to fail fast should call * `await pageSession.capability()` instead. */ capabilitySync(): CapabilitySnapshot | undefined; /** Awaits capability probe completion. Resolves immediately if already done. */ capability(): Promise; private push; private recordConsoleMessageAdded; private recordRuntimeException; private upsertNetwork; private recordNetworkRequestWillBeSent; private recordNetworkResponseReceived; private recordNetworkLoadingFinished; private recordNetworkLoadingFailed; private recordRequestIntercepted; /** Drain an intercepted request's bookkeeping. Called when a tool consumes * the request via continue/respond — clears auto-continue timer and removes * from the pending map. Returns the entry if it existed. */ consumeIntercepted(requestId: string): InterceptedRequest | undefined; }