@agent-score/commerce 2.6.4 → 2.6.5
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 +2 -2
- package/dist/{checkout-BtdHSF_w.d.mts → checkout-DOd9GDmt.d.mts} +6 -3
- package/dist/{checkout-B-Z5_EQP.d.ts → checkout-GcDNDzSK.d.ts} +6 -3
- 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 +23 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -4
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +26 -12
- package/dist/payment/index.d.ts +26 -12
- package/dist/payment/index.js +18 -0
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +17 -0
- package/dist/payment/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -22574,7 +22574,7 @@ function createAgentScoreCore(options) {
|
|
|
22574
22574
|
} = options;
|
|
22575
22575
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
22576
22576
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
22577
|
-
const defaultUa = `@agent-score/commerce@${"2.6.
|
|
22577
|
+
const defaultUa = `@agent-score/commerce@${"2.6.5"}`;
|
|
22578
22578
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
22579
22579
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
22580
22580
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -25221,6 +25221,22 @@ function x402SignerFromPayload(payload) {
|
|
|
25221
25221
|
txHash: null
|
|
25222
25222
|
};
|
|
25223
25223
|
}
|
|
25224
|
+
function mppCredentialPayloadType(authorizationHeader) {
|
|
25225
|
+
if (typeof authorizationHeader !== "string") return null;
|
|
25226
|
+
if (!authorizationHeader.toLowerCase().startsWith("payment ")) return null;
|
|
25227
|
+
const token = authorizationHeader.slice("payment ".length).trim();
|
|
25228
|
+
if (!token) return null;
|
|
25229
|
+
try {
|
|
25230
|
+
const credential = JSON.parse(atob(token));
|
|
25231
|
+
if (!credential || typeof credential !== "object") return null;
|
|
25232
|
+
const payload = credential.payload;
|
|
25233
|
+
if (!payload || typeof payload !== "object") return null;
|
|
25234
|
+
const type = payload.type;
|
|
25235
|
+
return typeof type === "string" ? type : null;
|
|
25236
|
+
} catch {
|
|
25237
|
+
return null;
|
|
25238
|
+
}
|
|
25239
|
+
}
|
|
25224
25240
|
function mppSignerFromAuth(authorizationHeader) {
|
|
25225
25241
|
if (typeof authorizationHeader !== "string") return NULL_RESULT;
|
|
25226
25242
|
if (!authorizationHeader.toLowerCase().startsWith("payment ")) return NULL_RESULT;
|
|
@@ -26060,9 +26076,12 @@ var Checkout = class {
|
|
|
26060
26076
|
zero = zeroAmountCarveOut({ rail, payload: verified.payload });
|
|
26061
26077
|
railKey = this.x402RailKey();
|
|
26062
26078
|
} else {
|
|
26063
|
-
|
|
26064
|
-
if (
|
|
26065
|
-
|
|
26079
|
+
const authHeader = headers["authorization"] ?? null;
|
|
26080
|
+
if (mppCredentialPayloadType(authHeader) === "proof") return null;
|
|
26081
|
+
const inline = zeroAmountCarveOut({ rail, authorizationHeader: authHeader });
|
|
26082
|
+
const extracted = await extractPaymentSignerFromAuth(authHeader);
|
|
26083
|
+
zero = extracted !== null ? { signerAddress: extracted.address, signerNetwork: extracted.network, txHash: null } : inline;
|
|
26084
|
+
railKey = (zero.signerNetwork !== null ? this.railsKeyForMppxMethod(zero.signerNetwork === "solana" ? "solana" : "tempo") : void 0) ?? this.mppRailKey();
|
|
26066
26085
|
}
|
|
26067
26086
|
const outcome = {
|
|
26068
26087
|
rail: rail === "x402-base" ? "x402" : "mpp",
|