/** * The agent's component queries: the tree, and the details of one element or * of every element of a tag. Asked of the live page each time, since the * cache only holds what the panel last requested and an agent with no panel * open would otherwise read an empty tree. * * The rules a caller would otherwise have to know: * - The page gets a short timeout; silence falls back to the cache, so a * query never hangs on a page that is gone or never answers. * - For one element, `null` is the page saying it is gone and wins over a * cached entry; `undefined` from the page is silence. * - A frozen snapshot (or a build) has no page: the cache is the answer. * * Owns the {@link InspectorRequester} that correlates the page's replies with * these asks; every inbound inspector message goes through {@link resolve}. */ import type { InspectorDetails, InspectorMessage, InspectorTreeNode } from '../../types/inspector.js'; import type { ComponentDetailsArgs, ComponentDetailsByTagResult, ListComponentsArgs, SetPropArgs } from './protocol.js'; import type { TimelineSource } from './source.js'; export interface InspectorQueriesOptions { /** Where the asks go. */ source: Pick; /** What the page last reported, for when it does not answer. */ cache: { roots(): InspectorTreeNode[]; details(id: number): InspectorDetails | null; }; /** A live page to ask; otherwise the cache is the answer. */ live: boolean; /** How long to wait for the page before answering from the cache. */ timeoutMs: number; } export interface InspectorQueries { /** The `list-components` query. */ tree(args?: ListComponentsArgs): Promise; /** The `component-details` query: one element by id, or a tag's elements. */ details(args: ComponentDetailsArgs): Promise; /** * The `set-prop` action: write a value on the live page and answer with * the element's details after it, `null` when it is gone. Throws with no * live page or no answer, since there is nothing to fall back to. */ setProp(args: SetPropArgs): Promise; /** Feed every inbound inspector message through here first. */ resolve(message: InspectorMessage): void; } /** Copy of `nodes` cut off below `maxDepth` levels (1 = roots only). */ export declare const pruneTree: (nodes: readonly InspectorTreeNode[], maxDepth: number) => InspectorTreeNode[]; /** * Ids of the elements with `tagName` (case-insensitive), in tree order: * parents before children, siblings as the page listed them. Capped at * `limit` (default 20, ceiling 50); `truncated` says more matched. */ export declare const findByTag: (roots: readonly InspectorTreeNode[], tagName: string, limit?: number) => { ids: number[]; truncated: boolean; }; export declare const createInspectorQueries: (options: InspectorQueriesOptions) => InspectorQueries; //# sourceMappingURL=inspector-queries.d.ts.map