@agent-score/commerce 2.4.0 → 2.6.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.
Files changed (80) hide show
  1. package/README.md +19 -17
  2. package/dist/challenge/index.d.mts +31 -3
  3. package/dist/challenge/index.d.ts +31 -3
  4. package/dist/challenge/index.js +25 -9
  5. package/dist/challenge/index.js.map +1 -1
  6. package/dist/challenge/index.mjs +25 -9
  7. package/dist/challenge/index.mjs.map +1 -1
  8. package/dist/{checkout-B-MIzYzW.d.ts → checkout-C4RD7M0Z.d.ts} +117 -13
  9. package/dist/{checkout-Bn7ZKIBD.d.mts → checkout-CzB9f_jf.d.mts} +117 -13
  10. package/dist/core.d.mts +40 -7
  11. package/dist/core.d.ts +40 -7
  12. package/dist/core.js +52 -27
  13. package/dist/core.js.map +1 -1
  14. package/dist/core.mjs +52 -27
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/discovery/index.d.mts +33 -3
  17. package/dist/discovery/index.d.ts +33 -3
  18. package/dist/discovery/index.js +50 -16
  19. package/dist/discovery/index.js.map +1 -1
  20. package/dist/discovery/index.mjs +49 -16
  21. package/dist/discovery/index.mjs.map +1 -1
  22. package/dist/gate-D2RP6bZg.d.ts +307 -0
  23. package/dist/gate-GCXy4FHI.d.mts +307 -0
  24. package/dist/identity/express.d.mts +28 -1
  25. package/dist/identity/express.d.ts +28 -1
  26. package/dist/identity/express.js +714 -31
  27. package/dist/identity/express.js.map +1 -1
  28. package/dist/identity/express.mjs +710 -30
  29. package/dist/identity/express.mjs.map +1 -1
  30. package/dist/identity/fastify.d.mts +14 -2
  31. package/dist/identity/fastify.d.ts +14 -2
  32. package/dist/identity/fastify.js +727 -31
  33. package/dist/identity/fastify.js.map +1 -1
  34. package/dist/identity/fastify.mjs +723 -30
  35. package/dist/identity/fastify.mjs.map +1 -1
  36. package/dist/identity/hono.d.mts +28 -1
  37. package/dist/identity/hono.d.ts +28 -1
  38. package/dist/identity/hono.js +696 -33
  39. package/dist/identity/hono.js.map +1 -1
  40. package/dist/identity/hono.mjs +692 -32
  41. package/dist/identity/hono.mjs.map +1 -1
  42. package/dist/identity/nextjs.d.mts +5 -0
  43. package/dist/identity/nextjs.d.ts +5 -0
  44. package/dist/identity/nextjs.js +695 -30
  45. package/dist/identity/nextjs.js.map +1 -1
  46. package/dist/identity/nextjs.mjs +691 -29
  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 +26 -1
  55. package/dist/identity/web.d.ts +26 -1
  56. package/dist/identity/web.js +695 -30
  57. package/dist/identity/web.js.map +1 -1
  58. package/dist/identity/web.mjs +691 -29
  59. package/dist/identity/web.mjs.map +1 -1
  60. package/dist/index.d.mts +165 -4
  61. package/dist/index.d.ts +165 -4
  62. package/dist/index.js +3103 -534
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +3086 -545
  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 +1614 -266
  73. package/dist/stripe-multichain/index.js.map +1 -1
  74. package/dist/stripe-multichain/index.mjs +1614 -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 +26 -21
@@ -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) {
@@ -444,11 +467,13 @@ function buildWellKnownX402(input) {
444
467
  // src/discovery/llms_txt.ts
445
468
  function llmsTxtIdentitySection({
446
469
  agentscore,
447
- compliance
470
+ compliance,
471
+ aip
448
472
  } = {}) {
449
473
  if (!agentscore) {
450
474
  return "";
451
475
  }
476
+ const aipBullet = aip ? "\n- **`Agent-Identity: <JWT>` + RFC 9421 signature** \u2014 present an Agent Identity Token (AIP) from a trusted issuer (AgentScore is always trusted). Short-lived and bound to your key; sign the request (`Signature-Input` + `Signature` over `@method @authority @path agent-identity`, tag `agent-identity`) to prove possession. No long-lived token on the wire. Mint one with `agentscore-pay identity-mint` or let `agentscore-pay pay --identity aip` attach it automatically." : "";
452
477
  const complianceNote = compliance ? `
453
478
 
454
479
  Compliance: ${[
@@ -462,7 +487,7 @@ Compliance: ${[
462
487
  AgentScore identity is reusable across every AgentScore-gated merchant \u2014 one KYC, no re-verification per site. Pick a header:
463
488
 
464
489
  - **\`X-Wallet-Address: 0x...\` or base58** \u2014 works on signing rails (Tempo, x402, Solana MPP). The wallet you claim must sign the payment.
465
- - **\`X-Operator-Token: opc_...\`** \u2014 works on every rail, including Stripe SPT. Reusable across AgentScore merchants until expiry.
490
+ - **\`X-Operator-Token: opc_...\`** \u2014 works on every rail, including Stripe SPT. Reusable across AgentScore merchants until expiry.${aipBullet}
466
491
  - **Neither** \u2014 you get a 403 with \`verify_url\`. Complete the session flow once and reuse the resulting \`opc_...\` everywhere.${complianceNote}`;
467
492
  }
468
493
  function llmsTxtPaymentSection(input) {
@@ -601,7 +626,13 @@ function agentscoreSecuritySchemes() {
601
626
  type: "apiKey",
602
627
  in: "header",
603
628
  name: "X-Wallet-Address",
604
- 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."
630
+ },
631
+ AgentIdentity: {
632
+ type: "apiKey",
633
+ in: "header",
634
+ name: "Agent-Identity",
635
+ description: "AIP Agent Identity Token path (a JWT from a trusted issuer; AgentScore is always trusted). Opt-in. The token is bound to the agent key via `cnf`; the request MUST also carry an RFC 9421 HTTP Message Signature (`Signature-Input` + `Signature` over `@method @authority @path agent-identity`, tag `agent-identity`) proving possession. A verified AIT is the sole identity and is evaluated against the merchant policy via its attested claims."
605
636
  },
606
637
  siwx: siwxSecurityScheme()
607
638
  };
@@ -966,14 +997,16 @@ function identitySection(input) {
966
997
  if (id.minAge) reqs.push(`age ${id.minAge}+`);
967
998
  if (id.allowedJurisdictions?.length) reqs.push(`${id.allowedJurisdictions.join("/")} only`);
968
999
  if (id.sanctionsClear) reqs.push("sanctions clear");
969
- if (reqs.length === 0) return "";
1000
+ if (reqs.length === 0 && !id.aip) return "";
970
1001
  const bootstrap = input.identityBootstrapUrl ? `
971
1002
 
972
1003
  If you don't have a Passport, fetch \`${input.identityBootstrapUrl}\` and follow the onboarding there first. Bring back the \`opc_...\` operator token in \`X-Operator-Token\` on every gated request.` : "";
1004
+ const reqLine = reqs.length ? `This merchant uses AgentScore identity. Required: ${reqs.join(", ")}.${bootstrap}` : `This merchant uses AgentScore identity.${bootstrap}`;
1005
+ const aipNote = id.aip ? "\n\nThis merchant accepts AIP Agent Identity Tokens. If you hold an AIT from a trusted issuer (AgentScore is always trusted), present the JWT in an `Agent-Identity` header plus an RFC 9421 HTTP Message Signature (`Signature-Input` + `Signature` over `@method @authority @path agent-identity`, tag `agent-identity`) signed with the token-bound cnf key \u2014 it satisfies identity in one round trip, no separate AgentScore credential needed. `agentscore-pay pay --identity aip` does this automatically." : "";
973
1006
  return [
974
1007
  "## Identity Prerequisite",
975
1008
  "",
976
- `This merchant uses AgentScore identity. Required: ${reqs.join(", ")}.${bootstrap}`,
1009
+ `${reqLine}${aipNote}`,
977
1010
  "",
978
1011
  "Denial bodies carry an `agent_instructions` block describing the recovery action \u2014 read the `action` field and follow it. See the identity-bootstrap skill for the canonical denial-code \u2192 action table."
979
1012
  ].join("\n");
@@ -1078,7 +1111,7 @@ function buildAgentscoreOnboardingSteps(opts) {
1078
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.";
1079
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.`;
1080
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.";
1081
- 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).";
1082
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.`;
1083
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.).`;
1084
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.).`;
@@ -1300,10 +1333,10 @@ var UCPSigningKey = {
1300
1333
  fromJWK: ucpSigningKeyFromJWKImpl
1301
1334
  };
1302
1335
  var DEFAULT_VERSION = "2026-04-08";
1303
- var AGENTSCORE_CAPABILITY_NAME = "sh.agentscore.identity";
1336
+ var AGENTSCORE_CAPABILITY_NAME = "com.agentscore.identity";
1304
1337
  var AGENTSCORE_CAPABILITY_VERSION = "2026-04-08";
1305
- var AGENTSCORE_DEFAULT_SPEC_URL = "https://agentscore.sh/specification/identity";
1306
- 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";
1307
1340
  var AGENTSCORE_EXTENDS = ["dev.ucp.shopping.checkout", "dev.ucp.shopping.cart"];
1308
1341
  var RESERVED_TOP_LEVEL = /* @__PURE__ */ new Set([
1309
1342
  "ucp",
@@ -1392,8 +1425,8 @@ function buildUCPProfile(input) {
1392
1425
  return profile;
1393
1426
  }
1394
1427
  var HANDLER_VERSION = "2026-04-08";
1395
- var SPEC_BASE = "https://agentscore.sh/specification/payment-handlers";
1396
- 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";
1397
1430
  var CAIP2_TO_UCP_NETWORK = {
1398
1431
  "eip155:8453": "base-8453",
1399
1432
  "eip155:84532": "base-84532",
@@ -1451,7 +1484,7 @@ function mppPaymentHandler({
1451
1484
  networks: networks2
1452
1485
  }) {
1453
1486
  return {
1454
- "sh.agentscore.payment.mpp": [{
1487
+ "com.agentscore.payment.mpp": [{
1455
1488
  id: "mpp",
1456
1489
  version: HANDLER_VERSION,
1457
1490
  spec: `${SPEC_BASE}/mpp`,
@@ -1472,7 +1505,7 @@ function x402PaymentHandler({
1472
1505
  networks: networks2
1473
1506
  }) {
1474
1507
  return {
1475
- "sh.agentscore.payment.x402": [{
1508
+ "com.agentscore.payment.x402": [{
1476
1509
  id: "x402",
1477
1510
  version: HANDLER_VERSION,
1478
1511
  spec: `${SPEC_BASE}/x402`,
@@ -1485,7 +1518,7 @@ function stripeSptPaymentHandler({
1485
1518
  spec
1486
1519
  }) {
1487
1520
  return {
1488
- "sh.agentscore.payment.stripe_spt": [{
1521
+ "com.agentscore.payment.stripe_spt": [{
1489
1522
  id: "stripe-spt",
1490
1523
  version: HANDLER_VERSION,
1491
1524
  spec: `${SPEC_BASE}/stripe_spt`,
@@ -1958,6 +1991,7 @@ function echoRequestIdHeaderHono() {
1958
1991
  defaultA2aServices,
1959
1992
  defaultDiscoveryPaths,
1960
1993
  echoRequestIdHeaderHono,
1994
+ enrichBazaarDiscoveryExtensions,
1961
1995
  isDiscoveryPath,
1962
1996
  isDiscoveryProbeRequest,
1963
1997
  llmsTxtIdentitySection,