import * as _mastra_core_tools0 from "@mastra/core/tools"; import { RunAgentInput } from "@ag-ui/client"; import { A2UIAttemptRecord, A2UIGuidelines, A2UIRecoveryConfig, A2UIToolParams, A2UIValidationCatalog } from "@ag-ui/a2ui-toolkit"; //#region src/a2ui-tool.d.ts /** * Loose type for the subagent model. Typed as ``any`` so the factory accepts any * Mastra-compatible model config — a provider-string like ``"openai/gpt-4.1"`` * (resolved by Mastra's own model router, the idiomatic Mastra form) OR an AI SDK * model object (``openai("gpt-4.1")``). Running the subagent through a Mastra * ``Agent`` (below) means the package never imports ``ai`` directly, so it is * immune to consumer ``ai`` / ``@ai-sdk/*`` major-version skew. */ type A2UISubagentModel = any; /** AG-UI render-stream chunk type the tool writes onto the outer agent stream * (via Mastra `ToolStream.custom`); the bridge's createChunkProcessor * translates it into synthetic inner render_a2ui TOOL_CALL_* events. */ declare const A2UI_RENDER_STREAM_TYPE = "data-a2ui-render"; /** * Build a Mastra tool that delegates A2UI surface generation to a subagent, * with the shared validate→retry recovery loop. Add the returned tool to a * Mastra agent's ``tools`` map (conventionally under the key ``generate_a2ui``). * * @param params Shared ``A2UIToolParams`` (model + behavior knobs). The toolkit * owns the shape and fills defaults via ``resolveA2UIToolParams``. */ declare function getA2UITools(params: A2UIToolParams): _mastra_core_tools0.Tool<{ intent?: "create" | "update" | undefined; target_surface_id?: string | undefined; changes?: string | undefined; }, unknown, unknown, unknown, _mastra_core_tools0.ToolExecutionContext, string, unknown>; /** Marks a tool this adapter auto-injected, so the bridge can refresh (not * "user-prevails") its own prior-turn tool on a cached/multi-turn thread. */ declare const A2UI_AUTOINJECT_MARKER: unique symbol; /** Backend override knobs for auto-injection (mirrors the runtime `injectA2UITool` * flag + the customizable `getA2UITools` properties). All optional. */ interface A2UIInjectConfig { /** Force on/off from the backend (nullish-falls-back FROM forwardedProps — * an explicit runtime value wins). A string names the injected render tool. */ injectA2UITool?: boolean | string; /** Model the render subagent runs. Required for auto-inject unless the bridge * can infer one from the wrapped agent. */ model?: TModel; /** Catalog id stamped on created surfaces (else resolved from run context). */ defaultCatalogId?: string; /** Prompt knobs (else the run's component schema becomes the composition guide). */ guidelines?: A2UIGuidelines; /** Inline catalog for semantic validation (structural-only when absent). */ catalog?: A2UIValidationCatalog; /** Recovery loop config (attempt cap, etc.). */ recovery?: A2UIRecoveryConfig; /** Per-attempt observability hook. */ onA2UIAttempt?: (record: A2UIAttemptRecord) => void; } /** The per-run injection decision. */ interface A2UIInjectionPlan { /** The `generate_a2ui` Mastra tool to register for this run. */ tool: ReturnType; /** Name the tool is registered under (`generate_a2ui`). */ toolName: string; /** Injected render-tool names to drop so the model calls `generate_a2ui`. */ dropToolNames: string[]; } interface PlanA2UIInjectionInput { /** Model inferred from the wrapped agent (null when none is inferable). */ model: TModel | null | undefined; /** The run input — read for `forwardedProps.injectA2UITool` + catalog context. */ input: RunAgentInput; /** Tool names already on the agent (USER-PREVAILS dedup). */ existingToolNames: string[]; /** Backend override config. */ config?: A2UIInjectConfig; /** Logger for the no-model skip warning. */ log?: { warn: (msg: string) => void; }; } /** * Decide whether to auto-inject `generate_a2ui` for this run. Off unless the * runtime forwarded `injectA2UITool` (or `config.injectA2UITool` is set); * USER-PREVAILS (skip if the dev already wired `generate_a2ui`); skip + warn when * no model is available. Otherwise builds the backend recovery tool, resolving * the catalog id + composition guide from run context (backend config wins), and * drops the middleware-injected render tool so the model calls `generate_a2ui`. */ declare function planA2UIInjection(args: PlanA2UIInjectionInput): A2UIInjectionPlan | null; /** True if `tool` is a `generate_a2ui` this adapter auto-injected. */ declare function isAutoInjectedA2UITool(tool: unknown): boolean; //#endregion export { A2UISubagentModel as a, A2UI_RENDER_STREAM_TYPE as c, isAutoInjectedA2UITool as d, planA2UIInjection as f, A2UIRecoveryConfig as i, PlanA2UIInjectionInput as l, A2UIInjectConfig as n, A2UIToolParams as o, A2UIInjectionPlan as r, A2UI_AUTOINJECT_MARKER as s, A2UIAttemptRecord as t, getA2UITools as u }; //# sourceMappingURL=a2ui-tool-qqFj935O.d.ts.map