/** * Stripe Agent Commerce Protocol (ACP) Adapter * * Maps a verified Bolyra v=2 proof bundle into a Stripe ACP context. The * narrowing story: * * human ──handshake──> root agent (bit 4: FINANCIAL_UNLIMITED) * │ * ▼ delegation hop 1 * agent A (bit 3: FINANCIAL_MEDIUM) * │ * ▼ delegation hop 2 * agent B (bit 2: FINANCIAL_SMALL) ── acting agent * * Stripe sees the leaf delegatee's scope (`small`) and a max-tx cap of $100. * It never sees the human's identity, the root agent's broader authority, or * the intermediate hops — only the most-narrowed cap. * * This adapter is a pure mapping layer: it consumes a `BolyraVerifiedContext` * (already-verified handshake + chain) and returns a `StripeACPContext`. It * deliberately does NOT call into the SDK. Verify the bundle with * `@bolyra/mcp`'s `verifyBundle` or via direct SDK calls, then pass the * result here. * * @see https://github.com/stripe/agent-toolkit (Stripe Agent Commerce Protocol) */ import type { BolyraVerifiedContext, StripeACPContext, StripeACPSpendDecision, StripeACPSpendingLimits } from './types'; /** * Derive Stripe ACP spending limits from a Bolyra scope bitmask. * * Pure function — no I/O, no SDK calls. Suitable for both production checks * and offline policy preview. */ export declare function bitmaskToStripeSpendingLimits(bitmask: bigint, currency?: string): StripeACPSpendingLimits; /** * Reshape a verified Bolyra context into a Stripe ACP context. * * The caller is responsible for verification (via `@bolyra/mcp`'s * `verifyBundle` or direct SDK calls). The adapter trusts `ctx.verified` * after running runtime validation on the structurally-typed input. * * Codex P1-7 fix: `rootAgentDid` is derived from the verified `ctx.did`, * NOT from a caller-supplied commitment. The caller cannot rebind the * acting credential to an unrelated chain's root. * * @param ctx Verified Bolyra context (leaf scope already collapsed). * Must be produced by a trusted verifier; the adapter runs * runtime validation but does NOT re-run ZKP verification. * @param network DID network suffix used to derive `actingAgentDid` from * the leaf commitment (default "base-sepolia"). Should * match the network embedded in `ctx.did`. * @param currency ISO 4217 currency for the limits (default "usd"). Stripe * uses lowercase; the adapter normalizes both sides. */ export declare function authContextToStripeACPContext(ctx: BolyraVerifiedContext, network?: string, currency?: string): StripeACPContext; /** * Operation surface for a Stripe ACP charge. * * "authorize" — creating a PaymentIntent on behalf of the user (does NOT * require `SIGN_ON_BEHALF`). * "confirm" — confirming an existing PaymentIntent on the user's behalf * (REQUIRES `SIGN_ON_BEHALF` per CLAUDE.md §"Permissions Model" * bit 5). * * Defaults to "authorize" for backward compatibility. The README documents * "confirm" as the path that needs bit 5. */ export type StripeACPOperation = 'authorize' | 'confirm'; /** * Decide whether a proposed Stripe charge is authorized by the ACP context. * * Rules: * 1. Context must be verified. * 2. Currency must match. * 3. Amount must be a positive safe integer in minor units (Stripe rejects * fractional or unsafe-integer cents). * 4. Tier must be "small" | "medium" | "unlimited" (not "none"). * 5. For tiers other than "unlimited", amount must be STRICTLY LESS than * the cap. CLAUDE.md defines bit 2 as `< $100` and bit 3 as `< $10K`, * so $100 against tier=small or $10K against tier=medium is rejected. * 6. If `operation === "confirm"`, the leaf scope must include * `SIGN_ON_BEHALF` (bit 5). `pi.confirm`-style paths fail closed * without it. */ export declare function verifyStripeACPSpend(ctx: StripeACPContext, amount: number, currency: string, operation?: StripeACPOperation): StripeACPSpendDecision;