/** * Session-selected page routing. chrome-devtools-mcp 1.8+ requires `pageId` * on page-scoped tools; AXI injects the last page this session selected * rather than parsing `[selected]` out of `list_pages` (titles and dialog * text can forge that marker). * * Survives across short-lived CLI processes the same way the snapshot * generation counter does: a file in the active session's state dir. * `select_page` writes the caller-supplied id. `new_page` (open / newpage) * records the created tab when exactly one complete row in that tool's own * dump has a URL matching `args.url` — not a `list_pages` call, not * `[selected]`, and not every `N:` line after `## Pages`. Title * continuations, zero matches, and two matching URLs clear the session id * so the next page-scoped call fails loud until an explicit `select_page`. * Extra complete rows that do not match (for example `about:blank`) are * ignored. `close_page` of the selected id also clears it, and so does the * bridge when chrome-devtools-mcp reports a browser reconnect that reissues * every page id (`didMcpPageIdentityChange` in `src/bridge.ts`). */ export declare function getSelectedPageId(): number | null; export declare function setSelectedPageId(pageId: number): void; /** * Drop this session's routing. Returns whether a usable id was actually * dropped, so a caller reacting to a browser reconnect can tell a session * that lost its page from one that never had one. A missing or malformed * file counts as no routing. * * The answer is the read-back post-condition, never the pre-delete state: an * unlink that fails (a read-only state dir) leaves an id `getSelectedPageId` * still returns, so the next page-scoped call injects it. Reporting a drop * there would tell the bridge - and through `/health` the CLI - that routing * is gone while it is still resolvable, and the reconnect marker that would * have re-detected it is one-shot and already consumed. Reporting no drop * instead keeps the surviving id and the reported state in agreement: the * stale id fails loud on its next use (upstream issues page ids from a * monotonic counter, so it resolves to nothing) rather than being explained * away as a reconnect that dropped it. */ export declare function clearSelectedPageId(): boolean; /** * Overlay AXI's session selected id onto display rows. MCP `[selected]` * text stays on the raw `list_pages` parse and must not imply routing. */ export declare function overlaySessionSelected(pages: T[], selectedId?: number | null): T[]; /** * Record routing after a successful browser-scoped tool. Never reads * `[selected]` — that marker is display-only on `list_pages`. * * `new_page` records the unique complete row whose URL matches `args.url`. * Otherwise the session id is cleared (do not keep a prior dump guess). */ export declare function rememberToolRouting(name: string, args: Record, result: string): void; /** * Created page id from a `new_page` dump, or null when the dump is * ambiguous. The created id is the unique complete row in the last * `## Pages` block whose URL matches `requestedUrl`. Title continuations * such as `404: Not Found` are not page ids and fail the dump. Extra * complete rows that do not match (`about:blank`, another tab) are * ignored. Two matching URLs, or none, leave the id unset. Extension * pages are never routing targets. Does not read `[selected]` or walk * `collapsePageRows`. */ export declare function createdPageIdFromNewPageDump(text: string, requestedUrl: string): number | null;