import { K as Krikos } from '../types-iaO2gHBL.cjs'; /** * Vercel AI SDK integration for Krikos: authorize an agent's tool calls against its declared * capabilities before they run. * * The Vercel AI SDK models tools as a record of definitions, each with an `execute` function. * Krikos wraps those executors so a tool only runs when the acting agent is active, unexpired, * and declares a capability that admits the tool. A denied call is recorded in the audit trail * and rejected, so an over-reaching agent never silently performs an action it was not granted. * * Structural by design: Krikos imports nothing from the Vercel AI SDK. The tool shape is matched * by structure, so the same wrapper works across SDK minor versions. * * @packageDocumentation */ /** Minimal structural shape of a Vercel AI SDK tool: anything with an `execute` function. */ interface ToolLike { /** The tool's executor. Krikos wraps it; everything else on the tool is preserved. */ execute?: (args: any, options?: any) => unknown; /** Any other tool fields, preserved untouched. */ readonly [key: string]: unknown; } /** How one tool maps to a capability check. */ interface ToolCapability { /** The capability name the tool requires. */ readonly capability: string; /** The action the tool performs. Defaults to the tool name. */ readonly action?: string; /** Derives the resource from the tool's arguments, for resource-scoped capabilities. */ readonly resource?: (args: any) => string; } /** A mapping from tool name to its capability requirement. */ type ToolCapabilityMap = Readonly>; /** * Wraps a record of Vercel AI SDK tools so each call is authorized for `agentId` before it runs. * * A tool present in `mapping` is gated on its capability requirement; a tool absent from `mapping` * is left untouched (no implicit gate, so an explicit allowlist is the only thing that enforces). * A denied call rejects with KrikosError `ERR_FORBIDDEN` and is recorded as `access.denied`. * * @param krikos - The registry holding the agent. * @param agentId - The acting agent. * @param tools - The Vercel AI SDK tools record. * @param mapping - Tool-to-capability requirements. * @returns A new tools record with guarded executors. */ declare function guardVercelTools>(krikos: Krikos, agentId: string, tools: T, mapping: ToolCapabilityMap): T; export { type ToolCapability, type ToolCapabilityMap, type ToolLike, guardVercelTools };