@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.
- package/README.md +19 -17
- package/dist/challenge/index.d.mts +26 -2
- package/dist/challenge/index.d.ts +26 -2
- package/dist/challenge/index.js +14 -5
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +14 -5
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-McfNpZJf.d.ts → checkout-C4RD7M0Z.d.ts} +46 -13
- package/dist/{checkout-o17dIxHi.d.mts → checkout-CzB9f_jf.d.mts} +46 -13
- package/dist/core.d.mts +20 -9
- package/dist/core.d.ts +20 -9
- package/dist/core.js +35 -24
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +35 -24
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +17 -2
- package/dist/discovery/index.d.ts +17 -2
- package/dist/discovery/index.js +36 -12
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +35 -12
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/{gate-CWP10xPQ.d.mts → gate-D2RP6bZg.d.ts} +109 -141
- package/dist/{gate-CWP10xPQ.d.ts → gate-GCXy4FHI.d.mts} +109 -141
- package/dist/identity/express.d.mts +3 -1
- package/dist/identity/express.d.ts +3 -1
- package/dist/identity/express.js +164 -55
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +164 -55
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +3 -1
- package/dist/identity/fastify.d.ts +3 -1
- package/dist/identity/fastify.js +171 -57
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +171 -57
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +3 -1
- package/dist/identity/hono.d.ts +3 -1
- package/dist/identity/hono.js +159 -59
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +159 -59
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +3 -1
- package/dist/identity/nextjs.d.ts +3 -1
- package/dist/identity/nextjs.js +153 -56
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +153 -56
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.d.mts +21 -2
- package/dist/identity/policy.d.ts +21 -2
- package/dist/identity/policy.js +22 -1
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs +21 -1
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +3 -1
- package/dist/identity/web.d.ts +3 -1
- package/dist/identity/web.js +153 -56
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +153 -56
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +55 -10
- package/dist/index.d.ts +55 -10
- package/dist/index.js +2227 -501
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2219 -501
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +1 -1
- package/dist/payment/index.d.ts +1 -1
- package/dist/payment/index.js +10 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +10 -2
- package/dist/payment/index.mjs.map +1 -1
- package/dist/stripe-multichain/index.js +1621 -266
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +1621 -266
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/dist/types-D1slMt0H.d.mts +137 -0
- package/dist/types-D1slMt0H.d.ts +137 -0
- package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
- package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
- package/package.json +23 -18
package/dist/discovery/index.js
CHANGED
|
@@ -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(
|
|
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,
|
|
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.
|
|
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 = "
|
|
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.
|
|
1316
|
-
var AGENTSCORE_DEFAULT_SCHEMA_URL = "https://agentscore.
|
|
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.
|
|
1406
|
-
var SCHEMA_BASE = "https://agentscore.
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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,
|