@agent-score/commerce 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,10 +24,11 @@ npm install hono mppx @x402/core @x402/evm @solana/mpp @solana/kit stripe # wh
24
24
  | Subpath | What it provides |
25
25
  |---|---|
26
26
  | `/identity/{hono,express,fastify}` | Trust gate middleware: KYC, sanctions, age, jurisdiction. Context-getter pattern: `agentscoreGate(opts)` middleware + `getAgentScoreData(ctx)` / `getGateDegradedState(ctx)` / `getGateQuotaInfo(ctx)` accessors, `captureWallet(...)`, `verifyWalletSignerMatch(...)`. Plus shared denial helpers: `denialReasonStatus`, `denialReasonToBody`, `buildSignerMismatchBody`, `buildContactSupportNextSteps`, `verificationAgentInstructions`, `isFixableDenial`, `FIXABLE_DENIAL_REASONS`. |
27
+ | `/identity/policy` | Per-product compliance helpers for multi-product merchants (each product carries its own policy: hard gate vs soft vs none, per-product shipping allowlists): `PolicyBlock`, `GateResult`, `EnforcementMode`, `IdentityStatus`, `buildGateOptionsFromPolicy`, `runGateWithEnforcement`, `shippingCountryAllowed`, `shippingStateAllowed`. |
27
28
  | `/identity/{nextjs,web}` | Same gate, wrapper pattern: `withAgentScoreGate(opts, handler)` / `createAgentScoreGate(opts) => guard(req)`. The `data` + `degraded` + `infraReason` fields land directly on the handler arg / guard result (no separate getter). Plus shared `captureWallet`, `verifyWalletSignerMatch`. |
28
29
  | `/payment` | `networks`, `USDC`, `rails` registries; `paymentDirective`, `buildPaymentDirective`, `wwwAuthenticateHeader`, `paymentRequiredHeader`, `aliasAmountFields` (v1↔v2 amount field shim: emits both `amount` and `maxAmountRequired` so v1-only x402 parsers like Coinbase awal can read v2 bodies), `settlementOverrideHeader`, `dispatchSettlementByNetwork`, `extractPaymentSigner` (returns `{address, network}`); `createX402Server`, `createMppxServer`; drop-in x402 helpers: `validateX402NetworkConfig` (boot-time guard), `verifyX402Request` (parse + validate inbound X-Payment), `processX402Settle` (verify-then-settle with one call), `classifyX402SettleResult` (maps the tagged settle result to a recommended HTTP status / code / nextSteps so merchants get a controlled envelope without coupling to facilitator-specific error text). |
29
30
  | `/discovery` | `isDiscoveryProbeRequest`, `buildDiscoveryProbeResponse` (with optional `x402Sample` for x402-aware crawlers, e.g. `awal x402 details`), `sampleX402AcceptForNetwork` (USDC sample-accept builder for known CAIP-2 networks), `buildWellKnownMpp`, `buildLlmsTxt` + `llmsTxtIdentitySection` + `llmsTxtPaymentSection` (compact + verbose modes), `buildSkillMd` (Claude-Skill-compatible `/skill.md` agent-discovery manifest; strictly agent-facing data only, no internal posture), `agentscoreOpenApiSnippets`, `createBazaarDiscovery`, `noindexNonDiscoveryPaths` (Hono middleware that emits `X-Robots-Tag: noindex` on every path except the agent-discovery surfaces; defaults cover `/openapi.json`, `/llms.txt`, `/skill.md`, `/.well-known/{mpp.json,agent-card.json,ucp,jwks.json}`, `/favicon.{png,ico}`; pure helpers `isDiscoveryPath` + `defaultDiscoveryPaths` for non-Hono frameworks). |
30
- | `/challenge` | `build402Body`, `buildAcceptedMethods`, `buildIdentityMetadata`, `buildHowToPay`, `buildAgentInstructions` (auto-emits per-rail `compatible_clients`: smoke-verified CLIs the agent should use; vendor override supported), `buildPricingBlock`, `firstEncounterAgentMemory`, `OrderReceipt`; `respond402`, a drop-in 402 emit that preserves mppx's `WWW-Authenticate` and layers x402's `PAYMENT-REQUIRED`. `buildValidationError`: structured 4xx body builder (`{error: {code, message}, required_fields?, example_body?, next_steps?, ...extra}`) so vendors compose body shapes by name instead of inlining at every validation site. |
31
+ | `/challenge` | `build402Body`, `buildAcceptedMethods`, `buildIdentityMetadata`, `buildHowToPay`, `buildAgentInstructions` (auto-emits per-rail `compatible_clients`: smoke-verified CLIs the agent should use; vendor override supported; pure helper `compatibleClientsByRails(rails)` returns the same map for vendors building custom 402s), `buildPricingBlock`, `firstEncounterAgentMemory`, `OrderReceipt`; `respond402`, a drop-in 402 emit that preserves mppx's `WWW-Authenticate` and layers x402's `PAYMENT-REQUIRED`. `buildValidationError`: structured 4xx body builder (`{error: {code, message}, required_fields?, example_body?, next_steps?, ...extra}`) so vendors compose body shapes by name instead of inlining at every validation site. |
31
32
  | `/stripe-multichain` | `createMultichainPaymentIntent`, `getDepositAddress`, `simulateCryptoDeposit`, `createMppxStripe`; `createPiCache` (TTL'd PI / deposit-address cache, Redis-backed when `redisUrl` set, in-memory otherwise), `simulateDepositIfTestMode` (gates on `sk_test_` and looks up the PI for you), `STRIPE_TEST_TX_HASH_SUCCESS` / `STRIPE_TEST_TX_HASH_FAILED` constants. Peer dep on `stripe`. |
32
33
  | `/api` | Everything from `@agent-score/sdk` re-exported in one place: `AgentScore` + `AgentScoreError`, `AGENTSCORE_TEST_ADDRESSES` + `isAgentScoreTestAddress`. **Don't add `@agent-score/sdk` as a separate dep**; the two can drift versions and cause subtle type mismatches. |
33
34
 
@@ -223,12 +224,9 @@ const profile = buildUCPProfile({
223
224
  ],
224
225
  },
225
226
  payment_handlers: {
226
- 'sh.agentscore.payment.tempo': [{
227
- id: 'tempo', version: '2026-04-08',
228
- spec: 'https://agentscore.sh/specification/payment-handlers/tempo',
229
- schema: 'https://agentscore.sh/schemas/payment-handlers/tempo.json',
230
- config: { recipient: TEMPO_ADDR },
231
- }],
227
+ ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217, recipient: TEMPO_ADDR }] }),
228
+ ...x402PaymentHandler({ networks: [{ network: 'base-8453', recipient: BASE_ADDR }] }),
229
+ ...stripeSptPaymentHandler({ profile_id: 'profile_5xKvNqM9BaH' }),
232
230
  },
233
231
  signing_keys,
234
232
  // Optional: declare the merchant's gate policy as an `sh.agentscore.identity` capability
package/dist/core.js CHANGED
@@ -220,7 +220,7 @@ function createAgentScoreCore(options) {
220
220
  } = options;
221
221
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
222
222
  const agentMemoryHint = buildAgentMemoryHint();
223
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
223
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
224
224
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
225
225
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
226
226
  const sessionSdkCache = /* @__PURE__ */ new Map();
package/dist/core.mjs CHANGED
@@ -202,7 +202,7 @@ function createAgentScoreCore(options) {
202
202
  } = options;
203
203
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
204
204
  const agentMemoryHint = buildAgentMemoryHint();
205
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
205
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
206
206
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
207
207
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
208
208
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -365,7 +365,7 @@ function createAgentScoreCore(options) {
365
365
  } = options;
366
366
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
367
367
  const agentMemoryHint = buildAgentMemoryHint();
368
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
368
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
369
369
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
370
370
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
371
371
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
332
332
  } = options;
333
333
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
334
334
  const agentMemoryHint = buildAgentMemoryHint();
335
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
335
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
336
336
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
337
337
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
338
338
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -366,7 +366,7 @@ function createAgentScoreCore(options) {
366
366
  } = options;
367
367
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
368
368
  const agentMemoryHint = buildAgentMemoryHint();
369
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
369
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
370
370
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
371
371
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
372
372
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
332
332
  } = options;
333
333
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
334
334
  const agentMemoryHint = buildAgentMemoryHint();
335
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
335
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
336
336
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
337
337
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
338
338
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -365,7 +365,7 @@ function createAgentScoreCore(options) {
365
365
  } = options;
366
366
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
367
367
  const agentMemoryHint = buildAgentMemoryHint();
368
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
368
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
369
369
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
370
370
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
371
371
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
332
332
  } = options;
333
333
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
334
334
  const agentMemoryHint = buildAgentMemoryHint();
335
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
335
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
336
336
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
337
337
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
338
338
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -361,7 +361,7 @@ function createAgentScoreCore(options) {
361
361
  } = options;
362
362
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
363
363
  const agentMemoryHint = buildAgentMemoryHint();
364
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
364
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
365
365
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
366
366
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
367
367
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
332
332
  } = options;
333
333
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
334
334
  const agentMemoryHint = buildAgentMemoryHint();
335
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
335
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
336
336
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
337
337
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
338
338
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -361,7 +361,7 @@ function createAgentScoreCore(options) {
361
361
  } = options;
362
362
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
363
363
  const agentMemoryHint = buildAgentMemoryHint();
364
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
364
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
365
365
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
366
366
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
367
367
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -332,7 +332,7 @@ function createAgentScoreCore(options) {
332
332
  } = options;
333
333
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
334
334
  const agentMemoryHint = buildAgentMemoryHint();
335
- const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
335
+ const defaultUa = `@agent-score/commerce@${"1.7.0"}`;
336
336
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
337
337
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
338
338
  const sessionSdkCache = /* @__PURE__ */ new Map();
package/dist/index.d.mts CHANGED
@@ -445,13 +445,7 @@ interface AgentScoreGatePolicy {
445
445
  * ],
446
446
  * },
447
447
  * payment_handlers: {
448
- * 'sh.agentscore.payment.tempo': [{
449
- * id: 'tempo',
450
- * version: '2026-04-08',
451
- * spec: 'https://agentscore.sh/specification/payment-handlers/tempo',
452
- * schema: 'https://agentscore.sh/schemas/payment-handlers/tempo.json',
453
- * config: { recipient: TEMPO_ADDR },
454
- * }],
448
+ * ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217, recipient: TEMPO_ADDR }] }),
455
449
  * },
456
450
  * signing_keys: [signingKey],
457
451
  * agentscore_gate: { require_kyc: true, min_age: 21, allowed_jurisdictions: ['US'] },
@@ -460,6 +454,74 @@ interface AgentScoreGatePolicy {
460
454
  */
461
455
  declare function buildUCPProfile(input: BuildUCPProfileInput): UCPProfile;
462
456
  declare const AGENTSCORE_UCP_CAPABILITY = "sh.agentscore.identity";
457
+ type MppNetwork = 'tempo-mainnet' | 'tempo-testnet' | 'mpp-solana-mainnet' | 'mpp-solana-devnet' | (string & {});
458
+ interface MppNetworkEntry {
459
+ network: MppNetwork;
460
+ /** EVM-style chain id (e.g. 4217 for Tempo mainnet). Omit for non-EVM networks. */
461
+ chain_id?: number;
462
+ /** Static settlement address. Omit for per-order recipients (e.g. Stripe-derived deposits). */
463
+ recipient?: string;
464
+ [k: string]: unknown;
465
+ }
466
+ interface MppPaymentHandlerInput {
467
+ networks: MppNetworkEntry[];
468
+ }
469
+ type X402Network = `base-${number}` | 'solana-mainnet-beta' | 'solana-devnet' | 'stellar-pubnet' | 'stellar-testnet' | (string & {});
470
+ interface X402NetworkEntry {
471
+ network: X402Network;
472
+ /** Static settlement address. Omit for per-order recipients. */
473
+ recipient?: string;
474
+ [k: string]: unknown;
475
+ }
476
+ interface X402PaymentHandlerInput {
477
+ networks: X402NetworkEntry[];
478
+ }
479
+ interface StripeSptPaymentHandlerInput {
480
+ /** Stripe profile id (the merchant-side network identifier the agent's SPT is scoped to). */
481
+ profile_id: string;
482
+ }
483
+ /**
484
+ * Build the `sh.agentscore.payment.mpp` payment handler block for a UCP profile.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * buildUCPProfile({
489
+ * ...,
490
+ * payment_handlers: {
491
+ * ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217 }] }),
492
+ * },
493
+ * });
494
+ * ```
495
+ */
496
+ declare function mppPaymentHandler(input: MppPaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
497
+ /**
498
+ * Build the `sh.agentscore.payment.x402` payment handler block for a UCP profile.
499
+ *
500
+ * @example
501
+ * ```ts
502
+ * buildUCPProfile({
503
+ * ...,
504
+ * payment_handlers: {
505
+ * ...x402PaymentHandler({ networks: [{ network: 'base-8453', recipient: '0xabc...' }] }),
506
+ * },
507
+ * });
508
+ * ```
509
+ */
510
+ declare function x402PaymentHandler(input: X402PaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
511
+ /**
512
+ * Build the `sh.agentscore.payment.stripe_spt` payment handler block for a UCP profile.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * buildUCPProfile({
517
+ * ...,
518
+ * payment_handlers: {
519
+ * ...stripeSptPaymentHandler({ profile_id: 'profile_5xKvNqM9BaH' }),
520
+ * },
521
+ * });
522
+ * ```
523
+ */
524
+ declare function stripeSptPaymentHandler(input: StripeSptPaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
463
525
 
464
526
  /**
465
527
  * UCP profile signing helpers (JWKS + JWS).
@@ -592,4 +654,4 @@ declare function verifyUCPProfile(profile: SignedUCPProfile, jwks: JWKSResponse)
592
654
  */
593
655
  declare function buildJWKSResponse(keys: UCPSigningKey[]): JWKSResponse;
594
656
 
595
- export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, AGENTSCORE_UCP_CAPABILITY, type AgentScoreGatePolicy, type BuildA2AAgentCardInput, type BuildUCPProfileInput, type GeneratedUCPKey, type JWKSResponse, type SignUCPProfileOptions, type SignedUCPProfile, type UCPCapabilityBinding, type UCPPaymentHandlerBinding, type UCPProfile, type UCPProfileBody, type UCPServiceBinding, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, buildA2AAgentCard, buildJWKSResponse, buildUCPProfile, generateUCPSigningKey, signUCPProfile, ucpA2AExtension, verifyUCPProfile };
657
+ export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, AGENTSCORE_UCP_CAPABILITY, type AgentScoreGatePolicy, type BuildA2AAgentCardInput, type BuildUCPProfileInput, type GeneratedUCPKey, type JWKSResponse, type MppNetworkEntry, type MppPaymentHandlerInput, type SignUCPProfileOptions, type SignedUCPProfile, type StripeSptPaymentHandlerInput, type UCPCapabilityBinding, type UCPPaymentHandlerBinding, type UCPProfile, type UCPProfileBody, type UCPServiceBinding, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type X402NetworkEntry, type X402PaymentHandlerInput, buildA2AAgentCard, buildJWKSResponse, buildUCPProfile, generateUCPSigningKey, mppPaymentHandler, signUCPProfile, stripeSptPaymentHandler, ucpA2AExtension, verifyUCPProfile, x402PaymentHandler };
package/dist/index.d.ts CHANGED
@@ -445,13 +445,7 @@ interface AgentScoreGatePolicy {
445
445
  * ],
446
446
  * },
447
447
  * payment_handlers: {
448
- * 'sh.agentscore.payment.tempo': [{
449
- * id: 'tempo',
450
- * version: '2026-04-08',
451
- * spec: 'https://agentscore.sh/specification/payment-handlers/tempo',
452
- * schema: 'https://agentscore.sh/schemas/payment-handlers/tempo.json',
453
- * config: { recipient: TEMPO_ADDR },
454
- * }],
448
+ * ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217, recipient: TEMPO_ADDR }] }),
455
449
  * },
456
450
  * signing_keys: [signingKey],
457
451
  * agentscore_gate: { require_kyc: true, min_age: 21, allowed_jurisdictions: ['US'] },
@@ -460,6 +454,74 @@ interface AgentScoreGatePolicy {
460
454
  */
461
455
  declare function buildUCPProfile(input: BuildUCPProfileInput): UCPProfile;
462
456
  declare const AGENTSCORE_UCP_CAPABILITY = "sh.agentscore.identity";
457
+ type MppNetwork = 'tempo-mainnet' | 'tempo-testnet' | 'mpp-solana-mainnet' | 'mpp-solana-devnet' | (string & {});
458
+ interface MppNetworkEntry {
459
+ network: MppNetwork;
460
+ /** EVM-style chain id (e.g. 4217 for Tempo mainnet). Omit for non-EVM networks. */
461
+ chain_id?: number;
462
+ /** Static settlement address. Omit for per-order recipients (e.g. Stripe-derived deposits). */
463
+ recipient?: string;
464
+ [k: string]: unknown;
465
+ }
466
+ interface MppPaymentHandlerInput {
467
+ networks: MppNetworkEntry[];
468
+ }
469
+ type X402Network = `base-${number}` | 'solana-mainnet-beta' | 'solana-devnet' | 'stellar-pubnet' | 'stellar-testnet' | (string & {});
470
+ interface X402NetworkEntry {
471
+ network: X402Network;
472
+ /** Static settlement address. Omit for per-order recipients. */
473
+ recipient?: string;
474
+ [k: string]: unknown;
475
+ }
476
+ interface X402PaymentHandlerInput {
477
+ networks: X402NetworkEntry[];
478
+ }
479
+ interface StripeSptPaymentHandlerInput {
480
+ /** Stripe profile id (the merchant-side network identifier the agent's SPT is scoped to). */
481
+ profile_id: string;
482
+ }
483
+ /**
484
+ * Build the `sh.agentscore.payment.mpp` payment handler block for a UCP profile.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * buildUCPProfile({
489
+ * ...,
490
+ * payment_handlers: {
491
+ * ...mppPaymentHandler({ networks: [{ network: 'tempo-mainnet', chain_id: 4217 }] }),
492
+ * },
493
+ * });
494
+ * ```
495
+ */
496
+ declare function mppPaymentHandler(input: MppPaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
497
+ /**
498
+ * Build the `sh.agentscore.payment.x402` payment handler block for a UCP profile.
499
+ *
500
+ * @example
501
+ * ```ts
502
+ * buildUCPProfile({
503
+ * ...,
504
+ * payment_handlers: {
505
+ * ...x402PaymentHandler({ networks: [{ network: 'base-8453', recipient: '0xabc...' }] }),
506
+ * },
507
+ * });
508
+ * ```
509
+ */
510
+ declare function x402PaymentHandler(input: X402PaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
511
+ /**
512
+ * Build the `sh.agentscore.payment.stripe_spt` payment handler block for a UCP profile.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * buildUCPProfile({
517
+ * ...,
518
+ * payment_handlers: {
519
+ * ...stripeSptPaymentHandler({ profile_id: 'profile_5xKvNqM9BaH' }),
520
+ * },
521
+ * });
522
+ * ```
523
+ */
524
+ declare function stripeSptPaymentHandler(input: StripeSptPaymentHandlerInput): Record<string, UCPPaymentHandlerBinding[]>;
463
525
 
464
526
  /**
465
527
  * UCP profile signing helpers (JWKS + JWS).
@@ -592,4 +654,4 @@ declare function verifyUCPProfile(profile: SignedUCPProfile, jwks: JWKSResponse)
592
654
  */
593
655
  declare function buildJWKSResponse(keys: UCPSigningKey[]): JWKSResponse;
594
656
 
595
- export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, AGENTSCORE_UCP_CAPABILITY, type AgentScoreGatePolicy, type BuildA2AAgentCardInput, type BuildUCPProfileInput, type GeneratedUCPKey, type JWKSResponse, type SignUCPProfileOptions, type SignedUCPProfile, type UCPCapabilityBinding, type UCPPaymentHandlerBinding, type UCPProfile, type UCPProfileBody, type UCPServiceBinding, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, buildA2AAgentCard, buildJWKSResponse, buildUCPProfile, generateUCPSigningKey, signUCPProfile, ucpA2AExtension, verifyUCPProfile };
657
+ export { type A2AAgentCard, type A2AAgentCardCapabilities, type A2AAgentCardExtension, type A2AAgentCardSignature, type A2AAgentInterface, type A2AAgentProvider, type A2AAgentSkill, AGENTSCORE_UCP_CAPABILITY, type AgentScoreGatePolicy, type BuildA2AAgentCardInput, type BuildUCPProfileInput, type GeneratedUCPKey, type JWKSResponse, type MppNetworkEntry, type MppPaymentHandlerInput, type SignUCPProfileOptions, type SignedUCPProfile, type StripeSptPaymentHandlerInput, type UCPCapabilityBinding, type UCPPaymentHandlerBinding, type UCPProfile, type UCPProfileBody, type UCPServiceBinding, UCPSigningKey, UCPVerificationError, UCP_A2A_EXTENSION_URI, type X402NetworkEntry, type X402PaymentHandlerInput, buildA2AAgentCard, buildJWKSResponse, buildUCPProfile, generateUCPSigningKey, mppPaymentHandler, signUCPProfile, stripeSptPaymentHandler, ucpA2AExtension, verifyUCPProfile, x402PaymentHandler };
package/dist/index.js CHANGED
@@ -48,14 +48,17 @@ __export(index_exports, {
48
48
  extractPaymentSignerAddress: () => extractPaymentSignerAddress,
49
49
  generateUCPSigningKey: () => generateUCPSigningKey,
50
50
  isFixableDenial: () => isFixableDenial,
51
+ mppPaymentHandler: () => mppPaymentHandler,
51
52
  readX402PaymentHeader: () => readX402PaymentHeader,
52
53
  runGateWithEnforcement: () => runGateWithEnforcement,
53
54
  shippingCountryAllowed: () => shippingCountryAllowed,
54
55
  shippingStateAllowed: () => shippingStateAllowed,
55
56
  signUCPProfile: () => signUCPProfile,
57
+ stripeSptPaymentHandler: () => stripeSptPaymentHandler,
56
58
  ucpA2AExtension: () => ucpA2AExtension,
57
59
  verificationAgentInstructions: () => verificationAgentInstructions,
58
- verifyUCPProfile: () => verifyUCPProfile
60
+ verifyUCPProfile: () => verifyUCPProfile,
61
+ x402PaymentHandler: () => x402PaymentHandler
59
62
  });
60
63
  module.exports = __toCommonJS(index_exports);
61
64
 
@@ -554,6 +557,42 @@ function buildUCPProfile(input) {
554
557
  return profile;
555
558
  }
556
559
  var AGENTSCORE_UCP_CAPABILITY = AGENTSCORE_CAPABILITY_NAME;
560
+ var HANDLER_VERSION = "2026-04-08";
561
+ var SPEC_BASE = "https://agentscore.sh/specification/payment-handlers";
562
+ var SCHEMA_BASE = "https://agentscore.sh/schemas/payment-handlers";
563
+ function mppPaymentHandler(input) {
564
+ return {
565
+ "sh.agentscore.payment.mpp": [{
566
+ id: "mpp",
567
+ version: HANDLER_VERSION,
568
+ spec: `${SPEC_BASE}/mpp`,
569
+ schema: `${SCHEMA_BASE}/mpp.json`,
570
+ config: { networks: input.networks }
571
+ }]
572
+ };
573
+ }
574
+ function x402PaymentHandler(input) {
575
+ return {
576
+ "sh.agentscore.payment.x402": [{
577
+ id: "x402",
578
+ version: HANDLER_VERSION,
579
+ spec: `${SPEC_BASE}/x402`,
580
+ schema: `${SCHEMA_BASE}/x402.json`,
581
+ config: { networks: input.networks }
582
+ }]
583
+ };
584
+ }
585
+ function stripeSptPaymentHandler(input) {
586
+ return {
587
+ "sh.agentscore.payment.stripe_spt": [{
588
+ id: "stripe-spt",
589
+ version: HANDLER_VERSION,
590
+ spec: `${SPEC_BASE}/stripe_spt`,
591
+ schema: `${SCHEMA_BASE}/stripe_spt.json`,
592
+ config: { rail: "stripe-spt", profile_id: input.profile_id }
593
+ }]
594
+ };
595
+ }
557
596
 
558
597
  // src/identity/ucp-jwks.ts
559
598
  var JOSE_INSTALL_HINT = "Install the optional peer dependency: `npm install jose@^6` (or `bun add jose`). Tested against jose v6.x.";
@@ -893,13 +932,16 @@ function shippingStateAllowed(state, country, policy) {
893
932
  extractPaymentSignerAddress,
894
933
  generateUCPSigningKey,
895
934
  isFixableDenial,
935
+ mppPaymentHandler,
896
936
  readX402PaymentHeader,
897
937
  runGateWithEnforcement,
898
938
  shippingCountryAllowed,
899
939
  shippingStateAllowed,
900
940
  signUCPProfile,
941
+ stripeSptPaymentHandler,
901
942
  ucpA2AExtension,
902
943
  verificationAgentInstructions,
903
- verifyUCPProfile
944
+ verifyUCPProfile,
945
+ x402PaymentHandler
904
946
  });
905
947
  //# sourceMappingURL=index.js.map