@agent-score/commerce 1.2.0 → 1.3.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 +26 -11
- package/dist/{_response-RpEB7-vl.d.ts → _response-C2yFQoIA.d.ts} +1 -1
- package/dist/{_response-DS-LR590.d.mts → _response-DpB-cm2c.d.mts} +1 -1
- package/dist/{agent_instructions-d3UWTdam.d.mts → agent_instructions-DiMSGkdm.d.mts} +10 -6
- package/dist/{agent_instructions-d3UWTdam.d.ts → agent_instructions-DiMSGkdm.d.ts} +10 -6
- package/dist/challenge/index.d.mts +18 -9
- package/dist/challenge/index.d.ts +18 -9
- package/dist/challenge/index.js +25 -24
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +25 -24
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +130 -6
- package/dist/discovery/index.d.ts +130 -6
- package/dist/discovery/index.js +75 -59
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +70 -58
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/identity/express.d.mts +2 -2
- package/dist/identity/express.d.ts +2 -2
- package/dist/identity/express.js +48 -25
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +48 -25
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +2 -2
- package/dist/identity/fastify.d.ts +2 -2
- package/dist/identity/fastify.js +48 -25
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +48 -25
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +2 -2
- package/dist/identity/hono.d.ts +2 -2
- package/dist/identity/hono.js +48 -25
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +48 -25
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +2 -2
- package/dist/identity/nextjs.d.ts +2 -2
- package/dist/identity/nextjs.js +48 -25
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +48 -25
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/web.d.mts +2 -2
- package/dist/identity/web.d.ts +2 -2
- package/dist/identity/web.js +48 -25
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +48 -25
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +47 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -24
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +136 -49
- package/dist/payment/index.d.ts +136 -49
- package/dist/payment/index.js +161 -73
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +160 -72
- package/dist/payment/index.mjs.map +1 -1
- package/dist/{signer-Cvdwn6Cs.d.mts → signer-kCAJUZwp.d.mts} +10 -12
- package/dist/{signer-Cvdwn6Cs.d.ts → signer-kCAJUZwp.d.ts} +10 -12
- package/dist/stripe-multichain/index.d.mts +2 -2
- package/dist/stripe-multichain/index.d.ts +2 -2
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/package.json +13 -4
package/dist/discovery/index.mjs
CHANGED
|
@@ -83,15 +83,15 @@ var rails = {
|
|
|
83
83
|
decimals: USDC.base.sepolia.decimals,
|
|
84
84
|
asset: USDC.base.sepolia.address
|
|
85
85
|
},
|
|
86
|
-
"
|
|
87
|
-
method: "
|
|
86
|
+
"mpp-solana-mainnet": {
|
|
87
|
+
method: "solana",
|
|
88
88
|
network: networks.solana.mainnet.caip2,
|
|
89
89
|
currency: USDC.solana.mainnet.mint,
|
|
90
90
|
decimals: USDC.solana.mainnet.decimals,
|
|
91
91
|
asset: USDC.solana.mainnet.mint
|
|
92
92
|
},
|
|
93
|
-
"
|
|
94
|
-
method: "
|
|
93
|
+
"mpp-solana-devnet": {
|
|
94
|
+
method: "solana",
|
|
95
95
|
network: networks.solana.devnet.caip2,
|
|
96
96
|
currency: USDC.solana.devnet.mint,
|
|
97
97
|
decimals: USDC.solana.devnet.decimals,
|
|
@@ -280,6 +280,14 @@ function buildWellKnownMpp(input) {
|
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
// src/discovery/well_known_x402.ts
|
|
284
|
+
function buildWellKnownX402(input) {
|
|
285
|
+
return {
|
|
286
|
+
version: 1,
|
|
287
|
+
resources: input.resources.map((r) => `${r.method.toUpperCase()} ${r.path}`)
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
283
291
|
// src/discovery/llms_txt.ts
|
|
284
292
|
function llmsTxtIdentitySection(input = {}) {
|
|
285
293
|
if (!input.agentscore) {
|
|
@@ -294,19 +302,13 @@ Compliance: ${[
|
|
|
294
302
|
compliance.allowed_jurisdictions?.length ? `${compliance.allowed_jurisdictions.join("/")} only` : null,
|
|
295
303
|
compliance.require_sanctions_clear ? "sanctions clear" : null
|
|
296
304
|
].filter(Boolean).join(", ")}.` : "";
|
|
297
|
-
return `##
|
|
305
|
+
return `## Identity
|
|
298
306
|
|
|
299
|
-
AgentScore
|
|
307
|
+
AgentScore identity is reusable across every AgentScore-gated merchant \u2014 one KYC, no re-verification per site. Pick a header:
|
|
300
308
|
|
|
301
|
-
-
|
|
302
|
-
-
|
|
303
|
-
- **Neither
|
|
304
|
-
|
|
305
|
-
If you reach another AgentScore-gated endpoint in the future, the same credential and/or any linked wallet already works \u2014 skip the session flow.
|
|
306
|
-
|
|
307
|
-
## Memory contract
|
|
308
|
-
|
|
309
|
-
First-encounter 403 responses (and the POST /v1/sessions success body) include an \`agent_memory\` block describing how AgentScore identity works across merchants. LLM-hosted agents should persist its contents (the pattern, never secrets) so subsequent AgentScore-gated endpoints become returning-customer encounters.${complianceNote}`;
|
|
309
|
+
- **\`X-Wallet-Address: 0x...\` or base58** \u2014 works on signing rails (Tempo, x402, Solana MPP). The wallet you claim must sign the payment.
|
|
310
|
+
- **\`X-Operator-Token: opc_...\`** \u2014 works on every rail, including Stripe SPT. Reusable across AgentScore merchants until expiry.
|
|
311
|
+
- **Neither** \u2014 you get a 403 with \`verify_url\`. Complete the session flow once and reuse the resulting \`opc_...\` everywhere.${complianceNote}`;
|
|
310
312
|
}
|
|
311
313
|
function llmsTxtPaymentSection(input) {
|
|
312
314
|
return input.verbose ? llmsTxtPaymentSectionVerbose(input) : llmsTxtPaymentSectionCompact(input);
|
|
@@ -326,8 +328,8 @@ function llmsTxtPaymentSectionCompact(input) {
|
|
|
326
328
|
if (hasRailFamily(rails2, "x402-base-")) {
|
|
327
329
|
lines.push("- **x402 USDC on Base** (EIP-3009) \u2014 `agentscore-pay pay POST " + input.appUrl + ` --chain base -H "X-Operator-Token: opc_..." -d '{...}'\``);
|
|
328
330
|
}
|
|
329
|
-
if (hasRailFamily(rails2, "
|
|
330
|
-
lines.push("- **
|
|
331
|
+
if (hasRailFamily(rails2, "mpp-solana-")) {
|
|
332
|
+
lines.push("- **USDC on Solana** \u2014 `agentscore-pay pay POST " + input.appUrl + ` --chain solana -H "X-Operator-Token: opc_..." -d '{...}'\``);
|
|
331
333
|
}
|
|
332
334
|
if (rails2.includes("stripe-spt")) {
|
|
333
335
|
lines.push("- **Stripe Shared Payment Token** \u2014 agent mints SPT (own Stripe account scoped to networkId, OR `link-cli spend-request create --credential-type shared_payment_token --network-id <profileId> ...`)");
|
|
@@ -343,72 +345,62 @@ function llmsTxtPaymentSectionVerbose(input) {
|
|
|
343
345
|
const tempoChain = input.tempoChainId ?? 4217;
|
|
344
346
|
const hasTempo = hasRailFamily(rails2, "tempo-");
|
|
345
347
|
const hasBase = hasRailFamily(rails2, "x402-base-");
|
|
346
|
-
const hasSolana = hasRailFamily(rails2, "
|
|
348
|
+
const hasSolana = hasRailFamily(rails2, "mpp-solana-");
|
|
347
349
|
const hasStripe = rails2.includes("stripe-spt");
|
|
348
350
|
const baseNetworkName = isTestnetRail(rails2, "x402-base-") ? "Base Sepolia" : "Base";
|
|
349
|
-
const solanaNetworkName = isTestnetRail(rails2, "
|
|
351
|
+
const solanaNetworkName = isTestnetRail(rails2, "mpp-solana-") ? "Solana devnet" : "Solana";
|
|
350
352
|
const lines = ["## Payment", ""];
|
|
351
|
-
lines.push("
|
|
353
|
+
lines.push("Accepted rails:");
|
|
352
354
|
lines.push("");
|
|
353
|
-
if (hasTempo) lines.push("- **
|
|
354
|
-
if (hasBase
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
if (hasStripe) lines.push("- **Stripe Shared Payment Token** (agent mints SPT on their Stripe account scoped to our networkId in the challenge, submits it in the credential)");
|
|
355
|
+
if (hasTempo) lines.push("- **USDC on Tempo**");
|
|
356
|
+
if (hasBase) lines.push(`- **USDC on ${baseNetworkName}**`);
|
|
357
|
+
if (hasSolana) lines.push(`- **USDC on ${solanaNetworkName}**`);
|
|
358
|
+
if (hasStripe) lines.push("- **Stripe Shared Payment Token**");
|
|
359
359
|
lines.push("");
|
|
360
360
|
if (hasTempo) {
|
|
361
|
-
lines.push("###
|
|
361
|
+
lines.push("### Pay with Tempo");
|
|
362
362
|
lines.push("");
|
|
363
|
-
lines.push("
|
|
364
|
-
lines.push("
|
|
365
|
-
lines.push(
|
|
366
|
-
lines.push(
|
|
367
|
-
lines.push("");
|
|
368
|
-
lines.push("Then use `tempo request` to make the paid purchase:");
|
|
363
|
+
lines.push("```bash");
|
|
364
|
+
lines.push("curl -fsSL https://tempo.xyz/install | bash");
|
|
365
|
+
lines.push("tempo wallet login");
|
|
366
|
+
lines.push(`tempo wallet whoami # need USDC.e on ${tempoNetwork} (chain ${tempoChain})`);
|
|
367
|
+
lines.push("tempo wallet fund # if zero");
|
|
369
368
|
lines.push("");
|
|
370
369
|
lines.push("tempo request -X POST \\");
|
|
371
|
-
lines.push(' -H "X-Operator-Token:
|
|
372
|
-
lines.push(' -H "Content-Type: application/json" \\');
|
|
370
|
+
lines.push(' -H "X-Operator-Token: opc_..." \\');
|
|
373
371
|
lines.push(" --json '{...}' \\");
|
|
374
372
|
lines.push(" --max-spend N \\");
|
|
375
373
|
lines.push(` ${input.appUrl}`);
|
|
376
|
-
lines.push("");
|
|
377
|
-
lines.push(`\`tempo request\` handles the full MPP handshake: sends the POST, receives the 402 challenge, signs the payment on ${tempoNetwork}, submits the credential, and returns the completed order.`);
|
|
374
|
+
lines.push("```");
|
|
378
375
|
lines.push("");
|
|
379
376
|
}
|
|
380
377
|
if (hasBase || hasSolana) {
|
|
381
378
|
const chainsLabel = [hasBase && baseNetworkName, hasSolana && solanaNetworkName].filter(Boolean).join(" or ");
|
|
382
379
|
const flags = [hasBase && "`--chain base`", hasSolana && "`--chain solana`"].filter(Boolean).join(" or ");
|
|
383
|
-
lines.push(`###
|
|
384
|
-
lines.push("");
|
|
385
|
-
lines.push("1. Install the agentscore-pay CLI: npm install -g @agent-score/pay (or: brew install agentscore/tap/agentscore-pay)");
|
|
386
|
-
lines.push(`2. Create a wallet on your chain of choice: agentscore-pay wallet create ${flags}`);
|
|
387
|
-
lines.push(`3. Fund the printed address with USDC on ${chainsLabel}`);
|
|
388
|
-
lines.push(`4. Confirm balance: agentscore-pay balance ${flags}`);
|
|
380
|
+
lines.push(`### Pay with ${chainsLabel}`);
|
|
389
381
|
lines.push("");
|
|
390
|
-
lines.push("
|
|
382
|
+
lines.push("```bash");
|
|
383
|
+
lines.push("npm install -g @agent-score/pay");
|
|
384
|
+
lines.push(`agentscore-pay wallet create ${flags}`);
|
|
385
|
+
lines.push(`agentscore-pay balance ${flags} # fund the printed address with USDC`);
|
|
391
386
|
lines.push("");
|
|
392
387
|
lines.push(`agentscore-pay pay POST ${input.appUrl} \\`);
|
|
393
388
|
lines.push(` ${hasBase ? "--chain base" : "--chain solana"} \\`);
|
|
394
|
-
lines.push(' -H "X-Operator-Token:
|
|
395
|
-
lines.push(' -H "Content-Type: application/json" \\');
|
|
389
|
+
lines.push(' -H "X-Operator-Token: opc_..." \\');
|
|
396
390
|
lines.push(" -d '{...}' \\");
|
|
397
391
|
lines.push(" --max-spend N");
|
|
398
|
-
lines.push("");
|
|
399
|
-
const handshakeChains = [hasBase && "EIP-3009 (Base)", hasSolana && "SPL Token (Solana)"].filter(Boolean).join(" or ");
|
|
400
|
-
lines.push(`The CLI handles the full x402 handshake: hits the URL, parses the 402 challenge, signs the ${handshakeChains} transaction, submits via X-Payment header, and returns the completed order.`);
|
|
392
|
+
lines.push("```");
|
|
401
393
|
lines.push("");
|
|
402
394
|
}
|
|
403
395
|
if (hasStripe) {
|
|
404
|
-
lines.push("###
|
|
396
|
+
lines.push("### Pay with Stripe SPT");
|
|
405
397
|
lines.push("");
|
|
406
|
-
lines.push("Mint a SharedPaymentToken scoped to the profile_id
|
|
398
|
+
lines.push("Mint a SharedPaymentToken scoped to the `profile_id` from the 402 body, then submit via `Authorization: Payment` with `method=stripe/charge`. Either your own Stripe account or `link-cli spend-request create --credential-type shared_payment_token --network-id <profileId> ...` for Stripe Link wallets.");
|
|
407
399
|
lines.push("");
|
|
408
400
|
}
|
|
409
|
-
lines.push("IMPORTANT:
|
|
401
|
+
lines.push("IMPORTANT: Use the CLIs above. Raw on-chain transfers (e.g. `tempo wallet transfer`, sending USDC manually to deposit addresses) bypass the protocol handshake and the order will not complete.");
|
|
410
402
|
if (hasBase || hasSolana) {
|
|
411
|
-
lines.push("IMPORTANT:
|
|
403
|
+
lines.push("IMPORTANT: Pay the exact amount in the 402 challenge. Overpayments and underpayments cannot be matched.");
|
|
412
404
|
}
|
|
413
405
|
lines.push("");
|
|
414
406
|
return lines.join("\n");
|
|
@@ -449,7 +441,16 @@ function agentscoreSecuritySchemes() {
|
|
|
449
441
|
in: "header",
|
|
450
442
|
name: "X-Wallet-Address",
|
|
451
443
|
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."
|
|
452
|
-
}
|
|
444
|
+
},
|
|
445
|
+
siwx: siwxSecurityScheme()
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function siwxSecurityScheme() {
|
|
449
|
+
return {
|
|
450
|
+
type: "http",
|
|
451
|
+
scheme: "bearer",
|
|
452
|
+
bearerFormat: "SIWX",
|
|
453
|
+
description: "Sign-In With X wallet authentication. Agent signs a challenge with their wallet (any supported chain) and presents the proof in the Authorization header. Used for identity-gated free endpoints; payment-required endpoints declare x-payment-info instead."
|
|
453
454
|
};
|
|
454
455
|
}
|
|
455
456
|
function agentscoreDenialSchemas() {
|
|
@@ -522,6 +523,12 @@ function agentscorePaymentRequiredSchema() {
|
|
|
522
523
|
}
|
|
523
524
|
};
|
|
524
525
|
}
|
|
526
|
+
function xPaymentInfoExtension(input) {
|
|
527
|
+
return { "x-payment-info": { price: input.price, protocols: input.protocols } };
|
|
528
|
+
}
|
|
529
|
+
function xGuidanceExtension(text) {
|
|
530
|
+
return { "x-guidance": text };
|
|
531
|
+
}
|
|
525
532
|
function agentscoreOpenApiSnippets(opts = {}) {
|
|
526
533
|
const out = {};
|
|
527
534
|
if (opts.security !== false) {
|
|
@@ -543,6 +550,7 @@ var defaultDiscoveryPaths = /* @__PURE__ */ new Set([
|
|
|
543
550
|
"/skill.md",
|
|
544
551
|
"/SKILL.md",
|
|
545
552
|
"/.well-known/mpp.json",
|
|
553
|
+
"/.well-known/x402",
|
|
546
554
|
"/.well-known/agent-card.json",
|
|
547
555
|
"/.well-known/ucp",
|
|
548
556
|
"/favicon.png",
|
|
@@ -613,7 +621,7 @@ var applyNoindexHeader = wrapNoindexResponse;
|
|
|
613
621
|
var RAIL_CLIENTS = {
|
|
614
622
|
tempo_mpp: ["agentscore-pay", "tempo request", "x402-proxy"],
|
|
615
623
|
x402_base: ["agentscore-pay", "x402-proxy", "purl (omit --network flag)"],
|
|
616
|
-
|
|
624
|
+
solana_mpp: ["agentscore-pay"],
|
|
617
625
|
stripe: ["link-cli"]
|
|
618
626
|
};
|
|
619
627
|
function compatibleClientsByRails(rails2) {
|
|
@@ -626,13 +634,13 @@ function compatibleClientsByRails(rails2) {
|
|
|
626
634
|
var RAIL_LABELS = {
|
|
627
635
|
tempo_mpp: "MPP on Tempo",
|
|
628
636
|
x402_base: "x402 on Base",
|
|
629
|
-
|
|
637
|
+
solana_mpp: "MPP on Solana",
|
|
630
638
|
stripe: "Stripe Shared Payment Token"
|
|
631
639
|
};
|
|
632
640
|
var RAIL_NOTES = {
|
|
633
641
|
tempo_mpp: "USDC. Use `agentscore-pay --chain tempo` (or `tempo request`); MPP credential goes in `Authorization: Payment`.",
|
|
634
642
|
x402_base: "USDC (EIP-3009). Use `agentscore-pay`; X-Payment header carries the signed credential.",
|
|
635
|
-
|
|
643
|
+
solana_mpp: "USDC (SPL). Use `agentscore-pay --chain solana`; MPP credential goes in `Authorization: Payment`.",
|
|
636
644
|
stripe: "Card via Link wallet. Use `@stripe/link-cli` \u2014 `agentscore-pay` emits the handoff hint when this rail is picked."
|
|
637
645
|
};
|
|
638
646
|
var NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
@@ -816,6 +824,7 @@ export {
|
|
|
816
824
|
buildLlmsTxt,
|
|
817
825
|
buildSkillMd,
|
|
818
826
|
buildWellKnownMpp,
|
|
827
|
+
buildWellKnownX402,
|
|
819
828
|
compatibleClientsByRails,
|
|
820
829
|
createBazaarDiscovery,
|
|
821
830
|
defaultDiscoveryPaths,
|
|
@@ -827,6 +836,9 @@ export {
|
|
|
827
836
|
noindexNonDiscoveryPathsExpress,
|
|
828
837
|
noindexNonDiscoveryPathsFastify,
|
|
829
838
|
sampleX402AcceptForNetwork,
|
|
830
|
-
|
|
839
|
+
siwxSecurityScheme,
|
|
840
|
+
wrapNoindexResponse,
|
|
841
|
+
xGuidanceExtension,
|
|
842
|
+
xPaymentInfoExtension
|
|
831
843
|
};
|
|
832
844
|
//# sourceMappingURL=index.mjs.map
|