/** A consent decision captured from the caller during a call. */ export interface ConsentGrant { /** * The consent item, matching a key in the worker's `configuration.consentPolicy` (e.g. * `'summaryStorage'`). */ item: string; /** `true` if the caller agreed, `false` if they declined. */ granted: boolean; /** The caller the grant belongs to (the memory `resource`), when the call is memory-scoped. */ resourceId?: string; /** The call thread the grant was captured on, when the call is memory-scoped. */ threadId?: string; } export interface ConsentToolOptions { /** * Persist the caller's decision to YOUR system of record (database, CRM, consent ledger). Called * each time the caller answers a consent question — keep it quick, it runs inside the turn. This * tool owns extracting the caller's identity from the tool execution context; you own storage, so * consent lives in a durable, compliant place rather than an opaque plugin store. Read those * grants back at `onCallEnd` (or before any consent-gated step) to enforce the requirement. */ onGrant: (grant: ConsentGrant) => void | Promise; /** Tool id the agent calls. Defaults to `'recordConsent'`. */ id?: string; /** Override the description the model sees when deciding to call the tool. */ description?: string; /** Restrict the accepted consent items to this set (becomes an enum). Defaults to any string. */ items?: readonly string[]; } /** * Builds a Mastra tool that captures the caller's consent decisions at runtime — the companion to * the worker's `configuration.consentPolicy`, which only DECLARES which consents a call needs. Add * it to the agent that answers the call; on each call the tool reads the caller's `resourceId` / * `threadId` from its execution context and hands the decision to your `onGrant` store. The runtime * grants live only where `onGrant` put them: enforce consent by reading them back from your own * store — at `onCallEnd` or before any consent-gated action — cross-checking against the declared * requirements in `VoiceCallEndArgs.configuration.consentPolicy` (the configuration carries the * policy, never the grants). * * ```ts * // agent tools * recordConsent: createConsentTool({ * items: ['summaryStorage'], * onGrant: async ({ item, granted, resourceId }) => { * if (resourceId) await db.saveConsent(resourceId, item, granted); * }, * }), * ``` */ export declare function createConsentTool(options: ConsentToolOptions): import("@mastra/core/tools").Tool<{ item: string; granted: boolean; }, unknown, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext, string, unknown>; //# sourceMappingURL=consent.d.ts.map