@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
@@ -189,9 +189,17 @@ function paymentDirective({
189
189
  function paymentRequiredHeader({
190
190
  x402Version,
191
191
  accepts,
192
- resource
192
+ resource,
193
+ extensions
193
194
  }) {
194
- return Buffer.from(JSON.stringify({ x402Version, accepts, ...resource ? { resource } : {} })).toString("base64");
195
+ return Buffer.from(
196
+ JSON.stringify({
197
+ x402Version,
198
+ accepts,
199
+ ...resource ? { resource } : {},
200
+ ...extensions && Object.keys(extensions).length > 0 ? { extensions } : {}
201
+ })
202
+ ).toString("base64");
195
203
  }
196
204
 
197
205
  // src/discovery/probe.ts
@@ -301,6 +309,20 @@ async function isDiscoveryProbeRequest(req) {
301
309
  }
302
310
 
303
311
  // src/discovery/bazaar.ts
312
+ async function enrichBazaarDiscoveryExtensions(extensions, request) {
313
+ if (extensions === void 0) return extensions;
314
+ const bazaar = await dynamicImport("@x402/extensions/bazaar");
315
+ const ext = bazaar?.bazaarResourceServerExtension;
316
+ if (!ext?.key || typeof ext.enrichDeclaration !== "function") return extensions;
317
+ const declaration = extensions[ext.key];
318
+ if (declaration === void 0) return extensions;
319
+ const transportContext = {
320
+ method: request.method,
321
+ adapter: { getPath: () => request.path },
322
+ routePattern: request.path
323
+ };
324
+ return { ...extensions, [ext.key]: ext.enrichDeclaration(declaration, transportContext) };
325
+ }
304
326
  async function createBazaarDiscovery(config) {
305
327
  const bazaar = await dynamicImport("@x402/extensions/bazaar");
306
328
  if (!bazaar?.declareDiscoveryExtension) {
@@ -522,7 +544,7 @@ function agentscoreSecuritySchemes() {
522
544
  type: "apiKey",
523
545
  in: "header",
524
546
  name: "X-Wallet-Address",
525
- 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."
547
+ 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."
526
548
  },
527
549
  AgentIdentity: {
528
550
  type: "apiKey",
@@ -1007,7 +1029,7 @@ function buildAgentscoreOnboardingSteps(opts) {
1007
1029
  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.";
1008
1030
  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.`;
1009
1031
  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.";
1010
- 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).";
1032
+ 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).";
1011
1033
  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.`;
1012
1034
  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.).`;
1013
1035
  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.).`;
@@ -1229,10 +1251,10 @@ var UCPSigningKey = {
1229
1251
  fromJWK: ucpSigningKeyFromJWKImpl
1230
1252
  };
1231
1253
  var DEFAULT_VERSION = "2026-04-08";
1232
- var AGENTSCORE_CAPABILITY_NAME = "sh.agentscore.identity";
1254
+ var AGENTSCORE_CAPABILITY_NAME = "com.agentscore.identity";
1233
1255
  var AGENTSCORE_CAPABILITY_VERSION = "2026-04-08";
1234
- var AGENTSCORE_DEFAULT_SPEC_URL = "https://agentscore.sh/specification/identity";
1235
- var AGENTSCORE_DEFAULT_SCHEMA_URL = "https://agentscore.sh/schemas/ucp/sh-agentscore-identity-v1.json";
1256
+ var AGENTSCORE_DEFAULT_SPEC_URL = "https://www.agentscore.com/specification/identity";
1257
+ var AGENTSCORE_DEFAULT_SCHEMA_URL = "https://www.agentscore.com/schemas/ucp/com-agentscore-identity-v1.json";
1236
1258
  var AGENTSCORE_EXTENDS = ["dev.ucp.shopping.checkout", "dev.ucp.shopping.cart"];
1237
1259
  var RESERVED_TOP_LEVEL = /* @__PURE__ */ new Set([
1238
1260
  "ucp",
@@ -1321,8 +1343,8 @@ function buildUCPProfile(input) {
1321
1343
  return profile;
1322
1344
  }
1323
1345
  var HANDLER_VERSION = "2026-04-08";
1324
- var SPEC_BASE = "https://agentscore.sh/specification/payment-handlers";
1325
- var SCHEMA_BASE = "https://agentscore.sh/schemas/payment-handlers";
1346
+ var SPEC_BASE = "https://www.agentscore.com/specification/payment-handlers";
1347
+ var SCHEMA_BASE = "https://www.agentscore.com/schemas/payment-handlers";
1326
1348
  var CAIP2_TO_UCP_NETWORK = {
1327
1349
  "eip155:8453": "base-8453",
1328
1350
  "eip155:84532": "base-84532",
@@ -1380,7 +1402,7 @@ function mppPaymentHandler({
1380
1402
  networks: networks2
1381
1403
  }) {
1382
1404
  return {
1383
- "sh.agentscore.payment.mpp": [{
1405
+ "com.agentscore.payment.mpp": [{
1384
1406
  id: "mpp",
1385
1407
  version: HANDLER_VERSION,
1386
1408
  spec: `${SPEC_BASE}/mpp`,
@@ -1401,7 +1423,7 @@ function x402PaymentHandler({
1401
1423
  networks: networks2
1402
1424
  }) {
1403
1425
  return {
1404
- "sh.agentscore.payment.x402": [{
1426
+ "com.agentscore.payment.x402": [{
1405
1427
  id: "x402",
1406
1428
  version: HANDLER_VERSION,
1407
1429
  spec: `${SPEC_BASE}/x402`,
@@ -1414,7 +1436,7 @@ function stripeSptPaymentHandler({
1414
1436
  spec
1415
1437
  }) {
1416
1438
  return {
1417
- "sh.agentscore.payment.stripe_spt": [{
1439
+ "com.agentscore.payment.stripe_spt": [{
1418
1440
  id: "stripe-spt",
1419
1441
  version: HANDLER_VERSION,
1420
1442
  spec: `${SPEC_BASE}/stripe_spt`,
@@ -1886,6 +1908,7 @@ export {
1886
1908
  defaultA2aServices,
1887
1909
  defaultDiscoveryPaths,
1888
1910
  echoRequestIdHeaderHono,
1911
+ enrichBazaarDiscoveryExtensions,
1889
1912
  isDiscoveryPath,
1890
1913
  isDiscoveryProbeRequest,
1891
1914
  llmsTxtIdentitySection,