@agent-score/commerce 2.5.0 → 2.6.1

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.
Files changed (80) hide show
  1. package/README.md +19 -17
  2. package/dist/challenge/index.d.mts +26 -2
  3. package/dist/challenge/index.d.ts +26 -2
  4. package/dist/challenge/index.js +14 -5
  5. package/dist/challenge/index.js.map +1 -1
  6. package/dist/challenge/index.mjs +14 -5
  7. package/dist/challenge/index.mjs.map +1 -1
  8. package/dist/{checkout-McfNpZJf.d.ts → checkout-C4RD7M0Z.d.ts} +46 -13
  9. package/dist/{checkout-o17dIxHi.d.mts → checkout-CzB9f_jf.d.mts} +46 -13
  10. package/dist/core.d.mts +20 -9
  11. package/dist/core.d.ts +20 -9
  12. package/dist/core.js +35 -24
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +35 -24
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/discovery/index.d.mts +17 -2
  17. package/dist/discovery/index.d.ts +17 -2
  18. package/dist/discovery/index.js +36 -12
  19. package/dist/discovery/index.js.map +1 -1
  20. package/dist/discovery/index.mjs +35 -12
  21. package/dist/discovery/index.mjs.map +1 -1
  22. package/dist/{gate-CWP10xPQ.d.mts → gate-D2RP6bZg.d.ts} +109 -141
  23. package/dist/{gate-CWP10xPQ.d.ts → gate-GCXy4FHI.d.mts} +109 -141
  24. package/dist/identity/express.d.mts +3 -1
  25. package/dist/identity/express.d.ts +3 -1
  26. package/dist/identity/express.js +164 -55
  27. package/dist/identity/express.js.map +1 -1
  28. package/dist/identity/express.mjs +164 -55
  29. package/dist/identity/express.mjs.map +1 -1
  30. package/dist/identity/fastify.d.mts +3 -1
  31. package/dist/identity/fastify.d.ts +3 -1
  32. package/dist/identity/fastify.js +171 -57
  33. package/dist/identity/fastify.js.map +1 -1
  34. package/dist/identity/fastify.mjs +171 -57
  35. package/dist/identity/fastify.mjs.map +1 -1
  36. package/dist/identity/hono.d.mts +3 -1
  37. package/dist/identity/hono.d.ts +3 -1
  38. package/dist/identity/hono.js +159 -59
  39. package/dist/identity/hono.js.map +1 -1
  40. package/dist/identity/hono.mjs +159 -59
  41. package/dist/identity/hono.mjs.map +1 -1
  42. package/dist/identity/nextjs.d.mts +3 -1
  43. package/dist/identity/nextjs.d.ts +3 -1
  44. package/dist/identity/nextjs.js +153 -56
  45. package/dist/identity/nextjs.js.map +1 -1
  46. package/dist/identity/nextjs.mjs +153 -56
  47. package/dist/identity/nextjs.mjs.map +1 -1
  48. package/dist/identity/policy.d.mts +21 -2
  49. package/dist/identity/policy.d.ts +21 -2
  50. package/dist/identity/policy.js +22 -1
  51. package/dist/identity/policy.js.map +1 -1
  52. package/dist/identity/policy.mjs +21 -1
  53. package/dist/identity/policy.mjs.map +1 -1
  54. package/dist/identity/web.d.mts +3 -1
  55. package/dist/identity/web.d.ts +3 -1
  56. package/dist/identity/web.js +153 -56
  57. package/dist/identity/web.js.map +1 -1
  58. package/dist/identity/web.mjs +153 -56
  59. package/dist/identity/web.mjs.map +1 -1
  60. package/dist/index.d.mts +55 -10
  61. package/dist/index.d.ts +55 -10
  62. package/dist/index.js +2227 -501
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +2219 -501
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/payment/index.d.mts +1 -1
  67. package/dist/payment/index.d.ts +1 -1
  68. package/dist/payment/index.js +10 -2
  69. package/dist/payment/index.js.map +1 -1
  70. package/dist/payment/index.mjs +10 -2
  71. package/dist/payment/index.mjs.map +1 -1
  72. package/dist/stripe-multichain/index.js +1621 -266
  73. package/dist/stripe-multichain/index.js.map +1 -1
  74. package/dist/stripe-multichain/index.mjs +1621 -266
  75. package/dist/stripe-multichain/index.mjs.map +1 -1
  76. package/dist/types-D1slMt0H.d.mts +137 -0
  77. package/dist/types-D1slMt0H.d.ts +137 -0
  78. package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
  79. package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
  80. package/package.json +23 -18
@@ -53,6 +53,7 @@ __export(discovery_exports, {
53
53
  defaultA2aServices: () => defaultA2aServices,
54
54
  defaultDiscoveryPaths: () => defaultDiscoveryPaths,
55
55
  echoRequestIdHeaderHono: () => echoRequestIdHeaderHono,
56
+ enrichBazaarDiscoveryExtensions: () => enrichBazaarDiscoveryExtensions,
56
57
  isDiscoveryPath: () => isDiscoveryPath,
57
58
  isDiscoveryProbeRequest: () => isDiscoveryProbeRequest,
58
59
  llmsTxtIdentitySection: () => llmsTxtIdentitySection,
@@ -270,9 +271,17 @@ function paymentDirective({
270
271
  function paymentRequiredHeader({
271
272
  x402Version,
272
273
  accepts,
273
- resource
274
+ resource,
275
+ extensions
274
276
  }) {
275
- return Buffer.from(JSON.stringify({ x402Version, accepts, ...resource ? { resource } : {} })).toString("base64");
277
+ return Buffer.from(
278
+ JSON.stringify({
279
+ x402Version,
280
+ accepts,
281
+ ...resource ? { resource } : {},
282
+ ...extensions && Object.keys(extensions).length > 0 ? { extensions } : {}
283
+ })
284
+ ).toString("base64");
276
285
  }
277
286
 
278
287
  // src/discovery/probe.ts
@@ -382,6 +391,20 @@ async function isDiscoveryProbeRequest(req) {
382
391
  }
383
392
 
384
393
  // src/discovery/bazaar.ts
394
+ async function enrichBazaarDiscoveryExtensions(extensions, request) {
395
+ if (extensions === void 0) return extensions;
396
+ const bazaar = await dynamicImport("@x402/extensions/bazaar");
397
+ const ext = bazaar?.bazaarResourceServerExtension;
398
+ if (!ext?.key || typeof ext.enrichDeclaration !== "function") return extensions;
399
+ const declaration = extensions[ext.key];
400
+ if (declaration === void 0) return extensions;
401
+ const transportContext = {
402
+ method: request.method,
403
+ adapter: { getPath: () => request.path },
404
+ routePattern: request.path
405
+ };
406
+ return { ...extensions, [ext.key]: ext.enrichDeclaration(declaration, transportContext) };
407
+ }
385
408
  async function createBazaarDiscovery(config) {
386
409
  const bazaar = await dynamicImport("@x402/extensions/bazaar");
387
410
  if (!bazaar?.declareDiscoveryExtension) {
@@ -603,7 +626,7 @@ function agentscoreSecuritySchemes() {
603
626
  type: "apiKey",
604
627
  in: "header",
605
628
  name: "X-Wallet-Address",
606
- description: "Wallet-path identity (0x... or base58). Only works on rails that carry a wallet signature (Tempo MPP, x402 EIP-3009, x402 SPL Token). The wallet you claim MUST sign the payment."
629
+ description: "Wallet-path identity (0x... or base58). Only works on rails that carry a wallet signature (Tempo MPP, x402 EIP-3009 on Base, Solana MPP). The wallet you claim MUST sign the payment."
607
630
  },
608
631
  AgentIdentity: {
609
632
  type: "apiKey",
@@ -1088,7 +1111,7 @@ function buildAgentscoreOnboardingSteps(opts) {
1088
1111
  const installStep = `Install agentscore-pay if you don't already have a compatible client for your funded chain: \`npm i -g @agent-score/pay\` (or \`brew install agentscore/tap/agentscore-pay\`). ${merchantName} accepts: ${railsHuman}. agentscore-pay speaks every supported rail; ` + (compatibleFragment ? `the rails table also lists per-rail \`compatible_clients\` \u2014 ${compatibleFragment}. ` : "") + "Any spec-compliant client for an individual rail works too.";
1089
1112
  const bootstrapStep = `First-run only: bootstrap wallet + Passport. Run \`agentscore-pay agent-guide --json\` for the canonical cold-start path \u2014 it walks \`agentscore-pay init\` (creates keystore + per-chain wallet), \`agentscore-pay passport login\` (one-time KYC${requiresKyc ? "; required for this merchant" : ""}; the human completes a verify URL once and pay caches the operator_token), and \`agentscore-pay balance\` to see which chain has USDC. Skip if your wallet+Passport are already provisioned.`;
1090
1113
  const stripeFallbackStep = "If your only payment method is a Stripe / Link card (no crypto), install `@stripe/link-cli` instead of agentscore-pay and use it on the SPT rail. Identity gating still applies \u2014 the merchant's 403 with `verify_url` lets you bootstrap a Passport even with no crypto wallet involved.";
1091
- const returningUserStep = "Returning user note: if you've paid an AgentScore-gated merchant before from this wallet, the wallet is already in your Passport's `linked_wallets[]` and identity flows through automatically with no re-KYC prompt. Paying from a NEW wallet while you already hold an `opc_...` token returns 403 `wallet_signer_mismatch`; the body lists `linked_wallets[]` and `agent_instructions.action: resign_or_switch_to_operator_token` with three deterministic recoveries (switch to a linked wallet, drop the operator_token to re-KYC the new wallet, or pre-claim the new wallet via SIWE on agentscore.sh/verify).";
1114
+ const returningUserStep = "Returning user note: if you've paid an AgentScore-gated merchant before from this wallet, the wallet is already in your Passport's `linked_wallets[]` and identity flows through automatically with no re-KYC prompt. Paying from a NEW wallet while you already hold an `opc_...` token returns 403 `wallet_signer_mismatch`; the body lists `linked_wallets[]` and `agent_instructions.action: resign_or_switch_to_operator_token` with three deterministic recoveries (switch to a linked wallet, drop the operator_token to re-KYC the new wallet, or pre-claim the new wallet via SIWE on https://www.agentscore.com/verify).";
1092
1115
  const pickRailStep = `Pick the rail your wallet is funded for. The 402 advertises ${acceptedRails.length} rail${acceptedRails.length === 1 ? "" : "s"}. \`agentscore-pay balance\` (without \`--chain\`) lists every chain's USDC; pay rejects with \`multi_rail_ambiguity\` if you don't pass \`--chain\` on a multi-rail challenge.`;
1093
1116
  const placeOrderStep = `Place the order: \`agentscore-pay pay POST ${appUrl}/purchase --chain <${chainFlags}> -d '<body>' --max-spend <amount>\` for crypto rails. For Stripe SPT, follow the handoff hint pay emits and use \`@stripe/link-cli\` instead. Either way pay handles the 402 retry, signing, and Passport attachment; branch on the structured CliError \`code\` on non-zero exit (insufficient_balance, multi_rail_ambiguity, config_error for missing wallet/Passport, etc.).`;
1094
1117
  const makeCallStep = `Make the paid call: \`agentscore-pay pay POST ${appUrl}/<endpoint> --chain <${chainFlags}> --max-spend <amount>\`; pay handles 402 retry, rail selection, signing, and Passport attachment. Branch on the structured CliError \`code\` on non-zero exit (insufficient_balance, multi_rail_ambiguity, config_error for missing wallet/Passport, etc.).`;
@@ -1310,10 +1333,10 @@ var UCPSigningKey = {
1310
1333
  fromJWK: ucpSigningKeyFromJWKImpl
1311
1334
  };
1312
1335
  var DEFAULT_VERSION = "2026-04-08";
1313
- var AGENTSCORE_CAPABILITY_NAME = "sh.agentscore.identity";
1336
+ var AGENTSCORE_CAPABILITY_NAME = "com.agentscore.identity";
1314
1337
  var AGENTSCORE_CAPABILITY_VERSION = "2026-04-08";
1315
- var AGENTSCORE_DEFAULT_SPEC_URL = "https://agentscore.sh/specification/identity";
1316
- var AGENTSCORE_DEFAULT_SCHEMA_URL = "https://agentscore.sh/schemas/ucp/sh-agentscore-identity-v1.json";
1338
+ var AGENTSCORE_DEFAULT_SPEC_URL = "https://www.agentscore.com/specification/identity";
1339
+ var AGENTSCORE_DEFAULT_SCHEMA_URL = "https://www.agentscore.com/schemas/ucp/com-agentscore-identity-v1.json";
1317
1340
  var AGENTSCORE_EXTENDS = ["dev.ucp.shopping.checkout", "dev.ucp.shopping.cart"];
1318
1341
  var RESERVED_TOP_LEVEL = /* @__PURE__ */ new Set([
1319
1342
  "ucp",
@@ -1402,8 +1425,8 @@ function buildUCPProfile(input) {
1402
1425
  return profile;
1403
1426
  }
1404
1427
  var HANDLER_VERSION = "2026-04-08";
1405
- var SPEC_BASE = "https://agentscore.sh/specification/payment-handlers";
1406
- var SCHEMA_BASE = "https://agentscore.sh/schemas/payment-handlers";
1428
+ var SPEC_BASE = "https://www.agentscore.com/specification/payment-handlers";
1429
+ var SCHEMA_BASE = "https://www.agentscore.com/schemas/payment-handlers";
1407
1430
  var CAIP2_TO_UCP_NETWORK = {
1408
1431
  "eip155:8453": "base-8453",
1409
1432
  "eip155:84532": "base-84532",
@@ -1461,7 +1484,7 @@ function mppPaymentHandler({
1461
1484
  networks: networks2
1462
1485
  }) {
1463
1486
  return {
1464
- "sh.agentscore.payment.mpp": [{
1487
+ "com.agentscore.payment.mpp": [{
1465
1488
  id: "mpp",
1466
1489
  version: HANDLER_VERSION,
1467
1490
  spec: `${SPEC_BASE}/mpp`,
@@ -1482,7 +1505,7 @@ function x402PaymentHandler({
1482
1505
  networks: networks2
1483
1506
  }) {
1484
1507
  return {
1485
- "sh.agentscore.payment.x402": [{
1508
+ "com.agentscore.payment.x402": [{
1486
1509
  id: "x402",
1487
1510
  version: HANDLER_VERSION,
1488
1511
  spec: `${SPEC_BASE}/x402`,
@@ -1495,7 +1518,7 @@ function stripeSptPaymentHandler({
1495
1518
  spec
1496
1519
  }) {
1497
1520
  return {
1498
- "sh.agentscore.payment.stripe_spt": [{
1521
+ "com.agentscore.payment.stripe_spt": [{
1499
1522
  id: "stripe-spt",
1500
1523
  version: HANDLER_VERSION,
1501
1524
  spec: `${SPEC_BASE}/stripe_spt`,
@@ -1968,6 +1991,7 @@ function echoRequestIdHeaderHono() {
1968
1991
  defaultA2aServices,
1969
1992
  defaultDiscoveryPaths,
1970
1993
  echoRequestIdHeaderHono,
1994
+ enrichBazaarDiscoveryExtensions,
1971
1995
  isDiscoveryPath,
1972
1996
  isDiscoveryProbeRequest,
1973
1997
  llmsTxtIdentitySection,