import type { AgentNativeClientAction, AgentNativeClientActions, AgentNativeHostCommandHandlers, AgentNativeHostContext, AgentNativeHostContextGetter, AgentNativeHostSession } from "./host-bridge.js"; export interface AgentNativeWebMcpToolAnnotations { readOnlyHint?: boolean; untrustedContentHint?: boolean; } export interface AgentNativeWebMcpTool { name: string; title?: string; description: string; inputSchema?: Record; origin?: string; annotations?: AgentNativeWebMcpToolAnnotations; } export interface AgentNativeWebMcpToolExecutionOptions { signal?: AbortSignal; } export type AgentNativeWebMcpToolResult = string | number | boolean | null | AgentNativeWebMcpToolResult[] | { [key: string]: AgentNativeWebMcpToolResult; }; export interface AgentNativeWebMcpClient { readonly supported: boolean; listTools(options?: { fromOrigins?: string[]; }): Promise; executeTool(tool: Pick, input?: unknown, options?: AgentNativeWebMcpToolExecutionOptions): Promise; executeListedTool(tool: AgentNativeWebMcpTool, input?: unknown, options?: AgentNativeWebMcpToolExecutionOptions): Promise; onToolChange?(listener: () => void): () => void; } export declare class AgentNativeWebMcpUnsupportedError extends Error { constructor(); } export type AgentNativeWebMcpRegistrationState = "registering" | "ready" | "failed"; export interface AgentNativeWebMcpStatus { state: AgentNativeWebMcpRegistrationState; registered: number; total: number; error?: string; } export declare function getAgentNativeWebMcpStatus(targetDocument?: Document): AgentNativeWebMcpStatus | undefined; export declare function initializeAgentNativeWebMcp(): boolean; export declare function isAgentNativeWebMcpSupported(targetDocument?: Document): boolean; export interface AgentNativeWebMcpClientOptions { document?: Document; fromOrigins?: string[]; maxInputChars?: number; maxResultChars?: number; maxSchemaChars?: number; maxDescriptionChars?: number; maxToolCount?: number; maxManifestChars?: number; } export declare function createAgentNativeWebMcpClient(options?: AgentNativeWebMcpClientOptions): AgentNativeWebMcpClient; export interface AgentNativeWebMcpToolSummary { name: string; title?: string; description: string; required: string[]; readOnly: boolean; origin?: string; } export type AgentNativeWebMcpCallFailureCode = "unsupported" | "registering" | "not-registered" | "execution-failed"; export type AgentNativeWebMcpCallOutcome = { id: string; state: "done"; ok: true; tool: string; attempts: number; result: unknown; } | { id: string; state: "done"; ok: false; tool: string; attempts: number; code: AgentNativeWebMcpCallFailureCode; error: string; status?: AgentNativeWebMcpStatus; } | { id: string; state: "pending"; tool: string; status?: AgentNativeWebMcpStatus; } | { id: string; state: "unknown"; }; export interface AgentNativeWebMcpPageHelper { status(): AgentNativeWebMcpStatus | undefined; ready(options?: { waitMs?: number; }): Promise; tools(filter?: string | RegExp): Promise; describe(name: string, origin?: string): Promise; call(name: string, args?: Record, options?: { waitMs?: number; origin?: string; }): Promise; result(id: string): AgentNativeWebMcpCallOutcome; } export declare function createAgentNativeWebMcpPageHelper(options?: { document?: Document; }): AgentNativeWebMcpPageHelper; export declare function installAgentNativeWebMcpPageHelper(options?: { document?: Document; }): AgentNativeWebMcpPageHelper | undefined; export declare function getAgentNativeWebMcpPageHelper(targetDocument?: Document): AgentNativeWebMcpPageHelper | undefined; export interface AgentNativeWebMcpApprovalRequest { action: AgentNativeClientAction; args: unknown; context: AgentNativeHostContext; session: AgentNativeHostSession; } export interface AgentNativeWebMcpRegistrationOptions { actions: AgentNativeClientActions; document?: Document; enabled?: boolean; exposedTo?: string[]; getContext?: AgentNativeHostContextGetter; session?: string | Partial; origin?: string; commands?: AgentNativeHostCommandHandlers; approve?: (request: AgentNativeWebMcpApprovalRequest, signal?: AbortSignal) => boolean | Promise; maxInputChars?: number; maxResultChars?: number; maxSchemaChars?: number; maxDescriptionChars?: number; maxToolCount?: number; maxManifestChars?: number; } export interface AgentNativeWebMcpRegistration { readonly supported: boolean; readonly registered: number; start(): Promise; stop(): void; } export declare function createAgentNativeServerActionWebMcpRegistration(options?: { document?: Document; fetch?: typeof fetch; excludeActionNames?: readonly string[]; }): AgentNativeWebMcpRegistration; export declare function createAgentNativeWebMcpRegistration(options: AgentNativeWebMcpRegistrationOptions): AgentNativeWebMcpRegistration;