@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.mjs
CHANGED
|
@@ -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(
|
|
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,
|
|
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.
|
|
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 = "
|
|
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.
|
|
1235
|
-
var AGENTSCORE_DEFAULT_SCHEMA_URL = "https://agentscore.
|
|
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.
|
|
1325
|
-
var SCHEMA_BASE = "https://agentscore.
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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,
|