@agent-score/commerce 2.7.0 → 2.7.2
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/dist/{checkout-Wc7NUHxZ.d.mts → checkout-DKq9gV3G.d.mts} +13 -12
- package/dist/{checkout-CIH1UcKZ.d.ts → checkout-DW7GgRrl.d.ts} +13 -12
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/discovery/index.d.mts +1 -1
- package/dist/discovery/index.d.ts +1 -1
- package/dist/identity/express.js +1 -1
- package/dist/identity/express.mjs +1 -1
- package/dist/identity/fastify.js +1 -1
- package/dist/identity/fastify.mjs +1 -1
- package/dist/identity/hono.js +1 -1
- package/dist/identity/hono.mjs +1 -1
- package/dist/identity/nextjs.js +1 -1
- package/dist/identity/nextjs.mjs +1 -1
- package/dist/identity/web.js +1 -1
- package/dist/identity/web.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +66 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -26
- package/dist/index.mjs.map +1 -1
- package/dist/stripe-multichain/index.js +49 -5
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +49 -5
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -20146,7 +20146,7 @@ var version3;
|
|
|
20146
20146
|
var init_version2 = __esm({
|
|
20147
20147
|
"node_modules/viem/_esm/errors/version.js"() {
|
|
20148
20148
|
"use strict";
|
|
20149
|
-
version3 = "2.
|
|
20149
|
+
version3 = "2.55.2";
|
|
20150
20150
|
}
|
|
20151
20151
|
});
|
|
20152
20152
|
|
|
@@ -20702,6 +20702,8 @@ var Assets_exports = {};
|
|
|
20702
20702
|
__export(Assets_exports, {
|
|
20703
20703
|
base: () => base,
|
|
20704
20704
|
baseSepolia: () => baseSepolia,
|
|
20705
|
+
celo: () => celo,
|
|
20706
|
+
celoSepolia: () => celoSepolia,
|
|
20705
20707
|
define: () => define,
|
|
20706
20708
|
fromToken: () => fromToken,
|
|
20707
20709
|
isAsset: () => isAsset,
|
|
@@ -20789,7 +20791,7 @@ function withTokenDefaults(transfer, token) {
|
|
|
20789
20791
|
name: token.name
|
|
20790
20792
|
};
|
|
20791
20793
|
}
|
|
20792
|
-
var knownAsset, base, baseSepolia;
|
|
20794
|
+
var knownAsset, base, baseSepolia, celo, celoSepolia;
|
|
20793
20795
|
var init_Assets = __esm({
|
|
20794
20796
|
"node_modules/mppx/dist/x402/Assets.js"() {
|
|
20795
20797
|
"use strict";
|
|
@@ -20821,6 +20823,42 @@ var init_Assets = __esm({
|
|
|
20821
20823
|
}
|
|
20822
20824
|
})
|
|
20823
20825
|
};
|
|
20826
|
+
celo = {
|
|
20827
|
+
USDC: define({
|
|
20828
|
+
address: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C",
|
|
20829
|
+
decimals: 6,
|
|
20830
|
+
network: "eip155:42220",
|
|
20831
|
+
transfer: {
|
|
20832
|
+
// Celo USDC signs with the shorter EIP-712 domain name.
|
|
20833
|
+
name: "USDC",
|
|
20834
|
+
type: "eip3009",
|
|
20835
|
+
version: "2"
|
|
20836
|
+
}
|
|
20837
|
+
}),
|
|
20838
|
+
USDT: define({
|
|
20839
|
+
address: "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",
|
|
20840
|
+
decimals: 6,
|
|
20841
|
+
network: "eip155:42220",
|
|
20842
|
+
transfer: {
|
|
20843
|
+
// Celo USDT signs with domain version "1", unlike Circle's FiatToken "2".
|
|
20844
|
+
name: "Tether USD",
|
|
20845
|
+
type: "eip3009",
|
|
20846
|
+
version: "1"
|
|
20847
|
+
}
|
|
20848
|
+
})
|
|
20849
|
+
};
|
|
20850
|
+
celoSepolia = {
|
|
20851
|
+
USDC: define({
|
|
20852
|
+
address: "0x01C5C0122039549AD1493B8220cABEdD739BC44E",
|
|
20853
|
+
decimals: 6,
|
|
20854
|
+
network: "eip155:11142220",
|
|
20855
|
+
transfer: {
|
|
20856
|
+
name: "USDC",
|
|
20857
|
+
type: "eip3009",
|
|
20858
|
+
version: "2"
|
|
20859
|
+
}
|
|
20860
|
+
})
|
|
20861
|
+
};
|
|
20824
20862
|
}
|
|
20825
20863
|
});
|
|
20826
20864
|
|
|
@@ -20829,6 +20867,8 @@ var Assets_exports2 = {};
|
|
|
20829
20867
|
__export(Assets_exports2, {
|
|
20830
20868
|
base: () => base,
|
|
20831
20869
|
baseSepolia: () => baseSepolia,
|
|
20870
|
+
celo: () => celo,
|
|
20871
|
+
celoSepolia: () => celoSepolia,
|
|
20832
20872
|
define: () => define,
|
|
20833
20873
|
fromToken: () => fromToken,
|
|
20834
20874
|
isAsset: () => isAsset,
|
|
@@ -20850,14 +20890,18 @@ var init_Assets2 = __esm({
|
|
|
20850
20890
|
var Chains_exports = {};
|
|
20851
20891
|
__export(Chains_exports, {
|
|
20852
20892
|
base: () => base2,
|
|
20853
|
-
baseSepolia: () => baseSepolia2
|
|
20893
|
+
baseSepolia: () => baseSepolia2,
|
|
20894
|
+
celo: () => celo2,
|
|
20895
|
+
celoSepolia: () => celoSepolia2
|
|
20854
20896
|
});
|
|
20855
|
-
var base2, baseSepolia2;
|
|
20897
|
+
var base2, baseSepolia2, celo2, celoSepolia2;
|
|
20856
20898
|
var init_Chains = __esm({
|
|
20857
20899
|
"node_modules/mppx/dist/evm/Chains.js"() {
|
|
20858
20900
|
"use strict";
|
|
20859
20901
|
base2 = 8453;
|
|
20860
20902
|
baseSepolia2 = 84532;
|
|
20903
|
+
celo2 = 42220;
|
|
20904
|
+
celoSepolia2 = 11142220;
|
|
20861
20905
|
}
|
|
20862
20906
|
});
|
|
20863
20907
|
|
|
@@ -21529,7 +21573,7 @@ var init_Header = __esm({
|
|
|
21529
21573
|
if (record2.x402Version !== 2 || !Array.isArray(record2.accepts))
|
|
21530
21574
|
throw new InvalidJsonHeaderError();
|
|
21531
21575
|
const resource = ResourceInfoSchema.parse(record2.resource);
|
|
21532
|
-
const extensions = record2.extensions
|
|
21576
|
+
const extensions = record2.extensions !== void 0 ? ExtensionsSchema.safeParse(record2.extensions).data : void 0;
|
|
21533
21577
|
return {
|
|
21534
21578
|
accepts: record2.accepts,
|
|
21535
21579
|
...extensions ? { extensions } : {},
|
|
@@ -22574,7 +22618,7 @@ function createAgentScoreCore(options) {
|
|
|
22574
22618
|
} = options;
|
|
22575
22619
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
22576
22620
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
22577
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
22621
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
22578
22622
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
22579
22623
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
22580
22624
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -25711,7 +25755,7 @@ var Checkout = class {
|
|
|
25711
25755
|
const malformed = malformedPaymentCredential(request.headers);
|
|
25712
25756
|
const enforced = malformed !== null && (malformed.channel === "x402" ? this.x402ServerAvailable() && this.x402BaseNetwork !== null : this.composeMppx !== void 0);
|
|
25713
25757
|
if (enforced) {
|
|
25714
|
-
const result = await this.
|
|
25758
|
+
const result = await this.handle(this.stripPaymentHeaders(request));
|
|
25715
25759
|
return { ...result, settlePhase: "credential_malformed" };
|
|
25716
25760
|
}
|
|
25717
25761
|
}
|
|
@@ -26230,12 +26274,10 @@ var Checkout = class {
|
|
|
26230
26274
|
settlePhase: "verify_failed"
|
|
26231
26275
|
};
|
|
26232
26276
|
}
|
|
26233
|
-
/** Emit
|
|
26234
|
-
* ask the
|
|
26235
|
-
* build the rich 402 body.
|
|
26236
|
-
*
|
|
26237
|
-
* computed pricing / resolved recipients, so the normal discovery leg (which
|
|
26238
|
-
* primes both) pays nothing extra. */
|
|
26277
|
+
/** Emit the discovery-leg 402: pricing (idempotent), mint per-order
|
|
26278
|
+
* recipients, ask the optional MPP compose hook for a fresh WWW-Authenticate,
|
|
26279
|
+
* and build the rich 402 body. preValidate + pricing already ran in the main
|
|
26280
|
+
* flow before this is reached, so it primes nothing twice. */
|
|
26239
26281
|
async emitFreshChallenge(ctx) {
|
|
26240
26282
|
if (ctx.pricing === null) ctx.pricing = await this.computePricing(ctx);
|
|
26241
26283
|
await this.resolveRecipientsForCtx(ctx);
|
|
@@ -26249,25 +26291,23 @@ var Checkout = class {
|
|
|
26249
26291
|
}
|
|
26250
26292
|
return await this.emit402(ctx, mppxHeaders);
|
|
26251
26293
|
}
|
|
26252
|
-
/** Return a copy of
|
|
26253
|
-
*
|
|
26254
|
-
*
|
|
26255
|
-
*
|
|
26256
|
-
* re-challenge.
|
|
26257
|
-
|
|
26294
|
+
/** Return a copy of the request with every payment-credential header removed,
|
|
26295
|
+
* so re-entering handle() treats it as a discovery (no-credential) request:
|
|
26296
|
+
* preValidate + pricing + minting + compose all run their fresh path, and the
|
|
26297
|
+
* gate/assess and settle are skipped. Turns a malformed-credential request
|
|
26298
|
+
* into a clean 402 re-challenge. The raw request is left intact (its body may
|
|
26299
|
+
* already be consumed); MPP compose reads it only best-effort under a
|
|
26300
|
+
* try/catch, while the stripped headers are what the credential-shape check,
|
|
26301
|
+
* gate dispatch, and recipient minting read. */
|
|
26302
|
+
stripPaymentHeaders(request) {
|
|
26258
26303
|
const headers = {};
|
|
26259
|
-
for (const [k, v] of Object.entries(
|
|
26304
|
+
for (const [k, v] of Object.entries(request.headers)) {
|
|
26260
26305
|
const lk = k.toLowerCase();
|
|
26261
26306
|
if (lk === "payment-signature" || lk === "x-payment") continue;
|
|
26262
26307
|
if (lk === "authorization" && v.startsWith("Payment ")) continue;
|
|
26263
26308
|
headers[k] = v;
|
|
26264
26309
|
}
|
|
26265
|
-
return {
|
|
26266
|
-
...ctx,
|
|
26267
|
-
request: { ...ctx.request, headers },
|
|
26268
|
-
pricing: null,
|
|
26269
|
-
recipients: {}
|
|
26270
|
-
};
|
|
26310
|
+
return { ...request, headers };
|
|
26271
26311
|
}
|
|
26272
26312
|
async emit402(ctx, mppxHeaders = {}) {
|
|
26273
26313
|
if (ctx.pricing === null) {
|