import { type Diagnostic, type PipelineOptions, type ToolDescriptor } from '@agenticschema/core'; /** * The slice of WebMCP this adapter needs. * * It deliberately leaves out `getTools()` and `executeTool()`. Those are * agent-side calls and they do not resolve while no agent is attached, so * awaiting one would stall page init. The adapter keeps its own registry instead. */ interface ModelContext { registerTool(tool: { name: string; description: string; inputSchema: unknown; execute: (args: Record, context?: { signal?: AbortSignal; }) => unknown; }, options?: { signal?: AbortSignal; }): Promise; } export interface StartOptions extends PipelineOptions { /** Defaults to the page's own `document`. */ document?: Document; /** Follow route changes and markup edits in single-page apps. Defaults to true. */ watch?: boolean; /** How long to wait after a DOM change before remapping. Defaults to 250 ms. */ debounceMs?: number; /** Injectable in tests. Otherwise `document.modelContext` is used. */ modelContext?: ModelContext; } export interface Handle { /** The tools currently registered. */ tools(): readonly ToolDescriptor[]; /** * What the pipeline noticed on the way from markup to tools: blocks it could * not parse, actions it refused, fields it truncated. The tool list alone * cannot tell you why something is missing, and missing is the failure mode * that matters here. */ diagnostics(): readonly Diagnostic[]; /** Remap the page now. Does nothing if the markup has not changed. */ refresh(): Promise; /** Unregister everything and stop watching. */ stop(): void; } export declare function start(options?: StartOptions): Promise; /** * `start()`, but at most once per document. * * The CDN build is an IIFE, which the browser does not deduplicate the way it * deduplicates a module by URL. A page carrying the script twice — a * hand-written tag and a tag manager's copy, often on two different version * specifiers — evaluates the bundle twice, and the second `start()` finds the * `document.modelContext` the first one filled and asks for names it already * owns. WebMCP refuses those with `Duplicate tool name`. * * The latch lives on the document rather than in module scope for the same * reason: each evaluation gets a fresh scope and would see its own empty slot. */ export declare function startOnce(options?: StartOptions): Promise; export {};