@agent-score/commerce 2.1.1 → 2.2.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 (53) hide show
  1. package/dist/challenge/index.d.mts +2 -2
  2. package/dist/challenge/index.d.ts +2 -2
  3. package/dist/challenge/index.js +7 -5
  4. package/dist/challenge/index.js.map +1 -1
  5. package/dist/challenge/index.mjs +7 -5
  6. package/dist/challenge/index.mjs.map +1 -1
  7. package/dist/{checkout-BRw_caGr.d.mts → checkout-CKQE2QpJ.d.mts} +37 -1
  8. package/dist/{checkout-CuSNUJFX.d.ts → checkout-CfgxgPZL.d.ts} +37 -1
  9. package/dist/core.js +4 -3
  10. package/dist/core.js.map +1 -1
  11. package/dist/core.mjs +4 -3
  12. package/dist/core.mjs.map +1 -1
  13. package/dist/discovery/index.d.mts +3 -3
  14. package/dist/discovery/index.d.ts +3 -3
  15. package/dist/identity/express.d.mts +4 -3
  16. package/dist/identity/express.d.ts +4 -3
  17. package/dist/identity/express.js +4 -3
  18. package/dist/identity/express.js.map +1 -1
  19. package/dist/identity/express.mjs +4 -3
  20. package/dist/identity/express.mjs.map +1 -1
  21. package/dist/identity/fastify.d.mts +4 -3
  22. package/dist/identity/fastify.d.ts +4 -3
  23. package/dist/identity/fastify.js +4 -3
  24. package/dist/identity/fastify.js.map +1 -1
  25. package/dist/identity/fastify.mjs +4 -3
  26. package/dist/identity/fastify.mjs.map +1 -1
  27. package/dist/identity/hono.d.mts +4 -3
  28. package/dist/identity/hono.d.ts +4 -3
  29. package/dist/identity/hono.js +4 -3
  30. package/dist/identity/hono.js.map +1 -1
  31. package/dist/identity/hono.mjs +4 -3
  32. package/dist/identity/hono.mjs.map +1 -1
  33. package/dist/identity/nextjs.js +4 -3
  34. package/dist/identity/nextjs.js.map +1 -1
  35. package/dist/identity/nextjs.mjs +4 -3
  36. package/dist/identity/nextjs.mjs.map +1 -1
  37. package/dist/identity/web.js +4 -3
  38. package/dist/identity/web.js.map +1 -1
  39. package/dist/identity/web.mjs +4 -3
  40. package/dist/identity/web.mjs.map +1 -1
  41. package/dist/index.d.mts +3 -3
  42. package/dist/index.d.ts +3 -3
  43. package/dist/index.js +137 -13
  44. package/dist/index.js.map +1 -1
  45. package/dist/index.mjs +137 -13
  46. package/dist/index.mjs.map +1 -1
  47. package/dist/{pricing-4n5Ota0D.d.mts → pricing-dSI3ePmE.d.mts} +4 -2
  48. package/dist/{pricing-DHfH3ogG.d.ts → pricing-uFGRNoGl.d.ts} +4 -2
  49. package/dist/stripe-multichain/index.js +2 -1
  50. package/dist/stripe-multichain/index.js.map +1 -1
  51. package/dist/stripe-multichain/index.mjs +2 -1
  52. package/dist/stripe-multichain/index.mjs.map +1 -1
  53. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from '../rail_spec-D6qzh3J0.mjs';
2
- import { A as AgentInstructions, P as PricingBlock } from '../pricing-4n5Ota0D.mjs';
3
- export { C as CompatibleClients, H as HowToPayBlock, a as HowToPayRailEntry, b as HowToPayRails, c as HowToPayStripeEntry, R as RailKey, d as buildAgentInstructions, e as buildHowToPay, f as buildPricingBlock, g as compatibleClientsByRails } from '../pricing-4n5Ota0D.mjs';
2
+ import { A as AgentInstructions, P as PricingBlock } from '../pricing-dSI3ePmE.mjs';
3
+ export { C as CompatibleClients, H as HowToPayBlock, a as HowToPayRailEntry, b as HowToPayRails, c as HowToPayStripeEntry, R as RailKey, d as buildAgentInstructions, e as buildHowToPay, f as buildPricingBlock, g as compatibleClientsByRails } from '../pricing-dSI3ePmE.mjs';
4
4
  import { AgentMemoryHint } from '../core.mjs';
5
5
  export { buildAgentMemoryHint } from '../core.mjs';
6
6
  import { p as paymentRequiredHeader } from '../wwwauthenticate-D_FMnPgU.mjs';
@@ -1,6 +1,6 @@
1
1
  import { T as TempoRailSpec, X as X402BaseRailSpec, S as SolanaMppRailSpec, b as StripeRailSpec } from '../rail_spec-D6qzh3J0.js';
2
- import { A as AgentInstructions, P as PricingBlock } from '../pricing-DHfH3ogG.js';
3
- export { C as CompatibleClients, H as HowToPayBlock, a as HowToPayRailEntry, b as HowToPayRails, c as HowToPayStripeEntry, R as RailKey, d as buildAgentInstructions, e as buildHowToPay, f as buildPricingBlock, g as compatibleClientsByRails } from '../pricing-DHfH3ogG.js';
2
+ import { A as AgentInstructions, P as PricingBlock } from '../pricing-uFGRNoGl.js';
3
+ export { C as CompatibleClients, H as HowToPayBlock, a as HowToPayRailEntry, b as HowToPayRails, c as HowToPayStripeEntry, R as RailKey, d as buildAgentInstructions, e as buildHowToPay, f as buildPricingBlock, g as compatibleClientsByRails } from '../pricing-uFGRNoGl.js';
4
4
  import { AgentMemoryHint } from '../core.js';
5
5
  export { buildAgentMemoryHint } from '../core.js';
6
6
  import { p as paymentRequiredHeader } from '../wwwauthenticate-D_FMnPgU.js';
@@ -188,14 +188,16 @@ function buildHowToPay({
188
188
  const d = decimals ?? 2;
189
189
  const defaultMaxSpend = totalNum >= 1 ? (Math.ceil(totalNum) + 1).toFixed(d) : totalNum.toFixed(d);
190
190
  const maxSpendStr = String(maxSpend ?? defaultMaxSpend);
191
+ const gateless = opTokenPlaceholder === null;
191
192
  const opToken = opTokenPlaceholder ?? "<your_opc_token>";
193
+ const opTokenHeaderFlag = gateless ? "" : `-H 'X-Operator-Token: ${opToken}' `;
192
194
  const block = {};
193
195
  if (rails.tempo) {
194
196
  const networkName = rails.tempo.testnet ? "tempo-testnet" : rails.tempo.network ?? RAIL_SPEC_DEFAULTS.tempo.network;
195
197
  const chainId = rails.tempo.chainId ?? RAIL_SPEC_DEFAULTS.tempo.chainId;
196
198
  const recommend = rails.tempo.recommend ?? RAIL_SPEC_DEFAULTS.tempo.recommend;
197
- const tempoCommand = `tempo request -X POST -H 'X-Operator-Token: ${opToken}' -H 'Content-Type: application/json' --json '${retryBodyJson}' --max-spend ${maxSpendStr} ${url}`;
198
- const payCommand = `agentscore-pay pay POST ${url} --chain tempo -H 'X-Operator-Token: ${opToken}' -H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`;
199
+ const tempoCommand = `tempo request -X POST ${opTokenHeaderFlag}-H 'Content-Type: application/json' --json '${retryBodyJson}' --max-spend ${maxSpendStr} ${url}`;
200
+ const payCommand = `agentscore-pay pay POST ${url} --chain tempo ${opTokenHeaderFlag}-H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`;
199
201
  block.tempo = {
200
202
  setup: TEMPO_SETUP,
201
203
  prerequisite: `Run \`tempo wallet whoami\` and confirm USDC.e balance on ${networkName} (chain ${chainId}) is at least $${maxSpendStr}. If the tempo CLI is not installed, run the setup commands above first.`,
@@ -209,7 +211,7 @@ function buildHowToPay({
209
211
  block.x402_base = {
210
212
  setup: PAY_SETUP_BASE,
211
213
  prerequisite: `Run \`agentscore-pay balance --chain base\` and confirm USDC balance on Base (${network}) is at least $${maxSpendStr}. If the CLI is not installed, run the setup commands above first.`,
212
- command: `agentscore-pay pay POST ${url} --chain base -H 'X-Operator-Token: ${opToken}' -H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`,
214
+ command: `agentscore-pay pay POST ${url} --chain base ${opTokenHeaderFlag}-H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`,
213
215
  what_it_does: "Pays via USDC on Base."
214
216
  };
215
217
  }
@@ -218,7 +220,7 @@ function buildHowToPay({
218
220
  block.solana_mpp = {
219
221
  setup: PAY_SETUP_SOLANA,
220
222
  prerequisite: `Run \`agentscore-pay balance --chain solana\` and confirm USDC balance on Solana (${network}) is at least $${maxSpendStr}. If the CLI is not installed, run the setup commands above first.`,
221
- command: `agentscore-pay pay POST ${url} --chain solana -H 'X-Operator-Token: ${opToken}' -H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`,
223
+ command: `agentscore-pay pay POST ${url} --chain solana ${opTokenHeaderFlag}-H 'Content-Type: application/json' -d '${retryBodyJson}' --max-spend ${maxSpendStr}`,
222
224
  what_it_does: "Pays via USDC on Solana."
223
225
  };
224
226
  }
@@ -240,7 +242,7 @@ function buildHowToPay({
240
242
  ];
241
243
  stripe.command_link_cli = [
242
244
  `SPEND_ID=$(link-cli spend-request create --payment-method-id <csmrpd_id_from_payment_methods_list> --credential-type shared_payment_token --network-id ${stripeCfg.profileId} --amount ${amountCents} --context "${sptContext}" --request-approval --output-json | jq -r .id)`,
243
- `link-cli mpp pay ${url} --spend-request-id $SPEND_ID --method POST --data '${retryBodyJson}' --header 'X-Operator-Token: ${opToken}' --output-json`
245
+ gateless ? `link-cli mpp pay ${url} --spend-request-id $SPEND_ID --method POST --data '${retryBodyJson}' --output-json` : `link-cli mpp pay ${url} --spend-request-id $SPEND_ID --method POST --data '${retryBodyJson}' --header 'X-Operator-Token: ${opToken}' --output-json`
244
246
  ];
245
247
  stripe.what_it_does_link_cli = "Mints a one-time-use SharedPaymentToken scoped to this purchase (user approves in Link wallet), then submits it as the payment credential.";
246
248
  } else if (linkCliBlocked) {