@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.
- package/README.md +19 -17
- package/dist/challenge/index.d.mts +31 -3
- package/dist/challenge/index.d.ts +31 -3
- package/dist/challenge/index.js +25 -9
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +25 -9
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-B-MIzYzW.d.ts → checkout-C4RD7M0Z.d.ts} +117 -13
- package/dist/{checkout-Bn7ZKIBD.d.mts → checkout-CzB9f_jf.d.mts} +117 -13
- package/dist/core.d.mts +40 -7
- package/dist/core.d.ts +40 -7
- package/dist/core.js +52 -27
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +52 -27
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +33 -3
- package/dist/discovery/index.d.ts +33 -3
- package/dist/discovery/index.js +50 -16
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +49 -16
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/gate-D2RP6bZg.d.ts +307 -0
- package/dist/gate-GCXy4FHI.d.mts +307 -0
- package/dist/identity/express.d.mts +28 -1
- package/dist/identity/express.d.ts +28 -1
- package/dist/identity/express.js +714 -31
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +710 -30
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +14 -2
- package/dist/identity/fastify.d.ts +14 -2
- package/dist/identity/fastify.js +727 -31
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +723 -30
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +28 -1
- package/dist/identity/hono.d.ts +28 -1
- package/dist/identity/hono.js +696 -33
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +692 -32
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +5 -0
- package/dist/identity/nextjs.d.ts +5 -0
- package/dist/identity/nextjs.js +695 -30
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +691 -29
- 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 +26 -1
- package/dist/identity/web.d.ts +26 -1
- package/dist/identity/web.js +695 -30
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +691 -29
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +165 -4
- package/dist/index.d.ts +165 -4
- package/dist/index.js +3103 -534
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3086 -545
- 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 +1614 -266
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +1614 -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 +26 -21
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) {
|
|
@@ -363,11 +385,13 @@ function buildWellKnownX402(input) {
|
|
|
363
385
|
// src/discovery/llms_txt.ts
|
|
364
386
|
function llmsTxtIdentitySection({
|
|
365
387
|
agentscore,
|
|
366
|
-
compliance
|
|
388
|
+
compliance,
|
|
389
|
+
aip
|
|
367
390
|
} = {}) {
|
|
368
391
|
if (!agentscore) {
|
|
369
392
|
return "";
|
|
370
393
|
}
|
|
394
|
+
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." : "";
|
|
371
395
|
const complianceNote = compliance ? `
|
|
372
396
|
|
|
373
397
|
Compliance: ${[
|
|
@@ -381,7 +405,7 @@ Compliance: ${[
|
|
|
381
405
|
AgentScore identity is reusable across every AgentScore-gated merchant \u2014 one KYC, no re-verification per site. Pick a header:
|
|
382
406
|
|
|
383
407
|
- **\`X-Wallet-Address: 0x...\` or base58** \u2014 works on signing rails (Tempo, x402, Solana MPP). The wallet you claim must sign the payment.
|
|
384
|
-
- **\`X-Operator-Token: opc_...\`** \u2014 works on every rail, including Stripe SPT. Reusable across AgentScore merchants until expiry
|
|
408
|
+
- **\`X-Operator-Token: opc_...\`** \u2014 works on every rail, including Stripe SPT. Reusable across AgentScore merchants until expiry.${aipBullet}
|
|
385
409
|
- **Neither** \u2014 you get a 403 with \`verify_url\`. Complete the session flow once and reuse the resulting \`opc_...\` everywhere.${complianceNote}`;
|
|
386
410
|
}
|
|
387
411
|
function llmsTxtPaymentSection(input) {
|
|
@@ -520,7 +544,13 @@ function agentscoreSecuritySchemes() {
|
|
|
520
544
|
type: "apiKey",
|
|
521
545
|
in: "header",
|
|
522
546
|
name: "X-Wallet-Address",
|
|
523
|
-
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."
|
|
548
|
+
},
|
|
549
|
+
AgentIdentity: {
|
|
550
|
+
type: "apiKey",
|
|
551
|
+
in: "header",
|
|
552
|
+
name: "Agent-Identity",
|
|
553
|
+
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."
|
|
524
554
|
},
|
|
525
555
|
siwx: siwxSecurityScheme()
|
|
526
556
|
};
|
|
@@ -885,14 +915,16 @@ function identitySection(input) {
|
|
|
885
915
|
if (id.minAge) reqs.push(`age ${id.minAge}+`);
|
|
886
916
|
if (id.allowedJurisdictions?.length) reqs.push(`${id.allowedJurisdictions.join("/")} only`);
|
|
887
917
|
if (id.sanctionsClear) reqs.push("sanctions clear");
|
|
888
|
-
if (reqs.length === 0) return "";
|
|
918
|
+
if (reqs.length === 0 && !id.aip) return "";
|
|
889
919
|
const bootstrap = input.identityBootstrapUrl ? `
|
|
890
920
|
|
|
891
921
|
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.` : "";
|
|
922
|
+
const reqLine = reqs.length ? `This merchant uses AgentScore identity. Required: ${reqs.join(", ")}.${bootstrap}` : `This merchant uses AgentScore identity.${bootstrap}`;
|
|
923
|
+
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." : "";
|
|
892
924
|
return [
|
|
893
925
|
"## Identity Prerequisite",
|
|
894
926
|
"",
|
|
895
|
-
|
|
927
|
+
`${reqLine}${aipNote}`,
|
|
896
928
|
"",
|
|
897
929
|
"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."
|
|
898
930
|
].join("\n");
|
|
@@ -997,7 +1029,7 @@ function buildAgentscoreOnboardingSteps(opts) {
|
|
|
997
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.";
|
|
998
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.`;
|
|
999
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.";
|
|
1000
|
-
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).";
|
|
1001
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.`;
|
|
1002
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.).`;
|
|
1003
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.).`;
|
|
@@ -1219,10 +1251,10 @@ var UCPSigningKey = {
|
|
|
1219
1251
|
fromJWK: ucpSigningKeyFromJWKImpl
|
|
1220
1252
|
};
|
|
1221
1253
|
var DEFAULT_VERSION = "2026-04-08";
|
|
1222
|
-
var AGENTSCORE_CAPABILITY_NAME = "
|
|
1254
|
+
var AGENTSCORE_CAPABILITY_NAME = "com.agentscore.identity";
|
|
1223
1255
|
var AGENTSCORE_CAPABILITY_VERSION = "2026-04-08";
|
|
1224
|
-
var AGENTSCORE_DEFAULT_SPEC_URL = "https://agentscore.
|
|
1225
|
-
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";
|
|
1226
1258
|
var AGENTSCORE_EXTENDS = ["dev.ucp.shopping.checkout", "dev.ucp.shopping.cart"];
|
|
1227
1259
|
var RESERVED_TOP_LEVEL = /* @__PURE__ */ new Set([
|
|
1228
1260
|
"ucp",
|
|
@@ -1311,8 +1343,8 @@ function buildUCPProfile(input) {
|
|
|
1311
1343
|
return profile;
|
|
1312
1344
|
}
|
|
1313
1345
|
var HANDLER_VERSION = "2026-04-08";
|
|
1314
|
-
var SPEC_BASE = "https://agentscore.
|
|
1315
|
-
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";
|
|
1316
1348
|
var CAIP2_TO_UCP_NETWORK = {
|
|
1317
1349
|
"eip155:8453": "base-8453",
|
|
1318
1350
|
"eip155:84532": "base-84532",
|
|
@@ -1370,7 +1402,7 @@ function mppPaymentHandler({
|
|
|
1370
1402
|
networks: networks2
|
|
1371
1403
|
}) {
|
|
1372
1404
|
return {
|
|
1373
|
-
"
|
|
1405
|
+
"com.agentscore.payment.mpp": [{
|
|
1374
1406
|
id: "mpp",
|
|
1375
1407
|
version: HANDLER_VERSION,
|
|
1376
1408
|
spec: `${SPEC_BASE}/mpp`,
|
|
@@ -1391,7 +1423,7 @@ function x402PaymentHandler({
|
|
|
1391
1423
|
networks: networks2
|
|
1392
1424
|
}) {
|
|
1393
1425
|
return {
|
|
1394
|
-
"
|
|
1426
|
+
"com.agentscore.payment.x402": [{
|
|
1395
1427
|
id: "x402",
|
|
1396
1428
|
version: HANDLER_VERSION,
|
|
1397
1429
|
spec: `${SPEC_BASE}/x402`,
|
|
@@ -1404,7 +1436,7 @@ function stripeSptPaymentHandler({
|
|
|
1404
1436
|
spec
|
|
1405
1437
|
}) {
|
|
1406
1438
|
return {
|
|
1407
|
-
"
|
|
1439
|
+
"com.agentscore.payment.stripe_spt": [{
|
|
1408
1440
|
id: "stripe-spt",
|
|
1409
1441
|
version: HANDLER_VERSION,
|
|
1410
1442
|
spec: `${SPEC_BASE}/stripe_spt`,
|
|
@@ -1876,6 +1908,7 @@ export {
|
|
|
1876
1908
|
defaultA2aServices,
|
|
1877
1909
|
defaultDiscoveryPaths,
|
|
1878
1910
|
echoRequestIdHeaderHono,
|
|
1911
|
+
enrichBazaarDiscoveryExtensions,
|
|
1879
1912
|
isDiscoveryPath,
|
|
1880
1913
|
isDiscoveryProbeRequest,
|
|
1881
1914
|
llmsTxtIdentitySection,
|