/** * Page-parser plugin loader. * * A parser plugin is a small ES module dropped into `.cdp-tools/parsers/` * (project first, then `~/.cdp-tools/parsers/`). It is imported dynamically at * call time — so adding or editing a parser needs no rebuild/restart of the * server. Each plugin default-exports: * * export default { * name: 'ai-overview', * description: 'Google AI Overview summary + cited links', * match: /google\.[a-z.]+\/search/, // optional: hints it fits the URL * waitFor: () => boolean, // optional: runs IN the page; the tool * // waits for this to become true * extract: () => any, // required: runs IN the page (via * // page.evaluate) and returns JSON * }; * * IMPORTANT: `waitFor` and `extract` are serialized and executed in the browser * context, so they must be self-contained — no closures over Node-side scope, * no imports. Define any helpers inside the function body. */ export interface ParserPlugin { name: string; description?: string; match?: RegExp; /** Runs in the page; the tool waits until it returns true (or waitMs elapses). */ waitFor?: () => boolean; /** Runs in the page via page.evaluate; returns JSON-serializable data. */ extract: () => unknown; } export interface ParserInfo { name: string; description?: string; file: string; /** true/false when the plugin declares a `match` and a URL was provided. */ matches?: boolean; } export declare function parserSearchPaths(): string[]; /** List available plugins (project overrides global on name collision). */ export declare function listParsers(url?: string): Promise; /** Load a single plugin by name. Throws if not found. */ export declare function loadParser(name: string): Promise; //# sourceMappingURL=parser-plugins.d.ts.map