import { T as ToolCaller, G as GuardOptions } from '../_shared-Dc0ifJAY.js'; export { O as OnDeny, d as denialMessage, g as guardExecute } from '../_shared-Dc0ifJAY.js'; import '../types-C6RfE7pX.js'; /** * AxioRank adapter for the Vercel AI SDK (`ai`). * * Put every tool your agent can call behind the firewall by wrapping the tools * object you already hand to `generateText` / `streamText`: * * @example * ```ts * import { generateText, tool } from "ai"; * import { openai } from "@ai-sdk/openai"; * import { AxioRank } from "@axiorank/sdk"; * import { guardTools } from "@axiorank/sdk/vercel"; * import { z } from "zod"; * * const axio = new AxioRank({ apiKey: process.env.AXIORANK_KEY! }); * * const tools = guardTools( * { * deployToProd: tool({ * description: "Deploy the current build to production", * parameters: z.object({ service: z.string() }), * execute: async ({ service }) => deploy(service), * }), * }, * axio, * { onDeny: "return" }, // let the model read the refusal and adapt * ); * * await generateText({ model: openai("gpt-4.1"), tools, prompt }); * ``` * * Pass `axio.trace()` instead of `axio` to correlate one agent run into a single * kill-chain trace on the gateway. */ /** * A Vercel AI SDK tool. Only `execute` is wrapped; its arguments are typed as * `any` so a tool with a precise, zod-inferred argument type still satisfies * this structural shape (a stricter type would reject it by contravariance). */ interface VercelToolLike { execute?: (args: any, ...rest: any[]) => unknown; } /** * Wrap a single Vercel AI SDK tool so its `execute` is scored by AxioRank * first. The tool `name` is supplied separately because a Vercel tool object * doesn't carry its own name - the name is the key in the tools record. A tool * with no `execute` (a client-side / provider-executed tool) is returned * unchanged. */ declare function guardTool(name: string, tool: T, caller: ToolCaller, opts?: GuardOptions): T; /** * Wrap every tool in a Vercel AI SDK tools record. The record key is used as * the tool name sent to AxioRank, so guarded calls line up with your audit log. */ declare function guardTools>(tools: T, caller: ToolCaller, opts?: GuardOptions): T; export { GuardOptions, ToolCaller, guardTool, guardTools };