import { T as ToolCaller, G as GuardOptions } from '../_shared-CA1scTRq.cjs'; export { O as OnDeny, d as denialMessage, g as guardExecute } from '../_shared-CA1scTRq.cjs'; import '../types-C6RfE7pX.cjs'; /** * AxioRank adapter for the OpenAI Agents SDK (`@openai/agents`). * * Guard the `execute` you hand to `tool(...)` so every invocation is scored by * AxioRank first. Wrapping the handler (rather than the built tool object) is * robust to the SDK's internal tool shape: * * @example * ```ts * import { Agent, run, tool } from "@openai/agents"; * import { AxioRank } from "@axiorank/sdk"; * import { guardExecute, guardToolConfig } from "@axiorank/sdk/openai-agents"; * import { z } from "zod"; * * const axio = new AxioRank({ apiKey: process.env.AXIORANK_KEY! }); * * // Option A - wrap just the execute function: * const refund = tool({ * name: "refund", * description: "Refund a charge", * parameters: z.object({ chargeId: z.string(), amount: z.number() }), * execute: guardExecute("refund", async ({ chargeId, amount }) => doRefund(chargeId, amount), axio), * }); * * // Option B - wrap the whole tool config (name is read for you): * const deploy = tool( * guardToolConfig( * { * name: "deploy", * description: "Deploy to production", * parameters: z.object({ service: z.string() }), * execute: async ({ service }) => doDeploy(service), * }, * axio, * { onDeny: "return" }, * ), * ); * ``` */ /** * The config object passed to `tool(...)`: a `name` plus an `execute` handler. * `execute` args are typed `any` so a handler with a precise, zod-inferred * argument type still satisfies this shape (a stricter type would reject it). */ interface AgentToolConfig { name: string; execute: (args: any, ...rest: any[]) => unknown; } /** * Wrap the config you pass to `tool(...)` so its `execute` is guarded by * AxioRank, reading the tool `name` from the config. Returns a new config - * hand it straight to `tool(...)`. */ declare function guardToolConfig(config: T, caller: ToolCaller, opts?: GuardOptions): T; export { GuardOptions, ToolCaller, guardToolConfig };