/** * Weavetab — cdp/pruner.ts * Semantic DOM Pruning: one-shot compression of a single DOM snapshot. * * DISTINCT FROM Delta Mapping: * Delta = diffs snapshots across time (previous call → now). * Pruning = compresses ONE snapshot before it is returned. * They are complementary — delta runs after pruning. * * Execution model: 1 Runtime.evaluate call (2 if page exceeds perf gate — * the split path costs one extra CDP round trip; see ARCHITECTURE.md). * * Weavetab by fy2ne */ import CDP from "chrome-remote-interface"; import type { ActionElement } from "./walker.js"; export interface PruneStats { total: number; pruned: number; svgReplaced: number; elapsedMs: number; /** true when the perf-gate fallback triggered a second Runtime.evaluate */ splitPath: boolean; } export interface PruneResult { elements: ActionElement[]; stats: PruneStats; } /** * pruneSnapshot — filters rawElements in-place using three ordered in-browser passes. * * Ordering guarantee (stable ref-id assignment): * 1. Synthetic-id assignment (pre-Pass 1) * 2. Pass 1 — controlsMap * 3. Pass 2 — post-order hasInteractiveDescendant * 4. Pass 3 — per-element prune decision * └─ data-wt-secret check fires on the ATTRIBUTE, not the id, * so it is safe even when an element is running on a synthetic id. * 5. Synthetic-id strip (post-filter, before return) */ export declare function pruneSnapshot(session: CDP.Client, rawElements: ActionElement[], _targetId?: string, structuralIdioms?: string[]): Promise;