import type { DcqlQuery, GateOrder } from "./types.js"; export interface MinimalToolResult { structuredContent?: Record; content: { type: "text"; text: string; }[]; isError?: boolean; } export interface EasyGatePolicy { /** Require age verification. `true` uses the cart's strictest item threshold. */ age?: boolean; } export interface GateDeps { /** Resolve the order from the tool args (created ONCE, so the id is stable). */ resolveOrder: (args: A) => O | Promise; /** True iff this order is age-restricted AND has no recorded age verification. */ isAgeUnverified: (order: O) => boolean | Promise; /** Per-order link the buyer opens to prove age. */ approveUrl: (order: O) => string; /** The age threshold for this order (e.g. 21), or undefined. */ minAge?: (order: O) => number | undefined; /** The DCQL to request; defaults to `ageDcql()`. */ request?: DcqlQuery; resumeTool?: string; } /** * @deprecated v0.1 uses consolidated Mode A — wrap your checkout tool with * `CredentAgent.requirements(order, policy)` instead. `gated()` is the Mode-B * blocking shim, kept for page-less tools / one minor version. * * Wrap an MCP tool handler so it returns a `verification_required` envelope when * the age gate isn't met, instead of completing. The handler receives the * resolved order so it never re-creates it (a fresh id would desync the approve * link from the verified order). */ export declare function gated(handler: (args: A, ctx: { order: O; }) => MinimalToolResult | Promise, policy: EasyGatePolicy, deps: GateDeps): (args: A) => Promise;