@agent-score/commerce 2.7.3 → 2.7.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/dist/core.js +1 -1
- package/dist/core.mjs +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.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +23 -1
- package/dist/payment/index.d.ts +23 -1
- package/dist/payment/index.js +16 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +15 -2
- package/dist/payment/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -22618,7 +22618,7 @@ function createAgentScoreCore(options) {
|
|
|
22618
22618
|
} = options;
|
|
22619
22619
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
22620
22620
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
22621
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
22621
|
+
const defaultUa = `@agent-score/commerce@${"2.7.5"}`;
|
|
22622
22622
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
22623
22623
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
22624
22624
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -25068,6 +25068,17 @@ function classifyX402SettleResult(result) {
|
|
|
25068
25068
|
};
|
|
25069
25069
|
}
|
|
25070
25070
|
}
|
|
25071
|
+
function stripUnsignedX402PayloadFields(payload) {
|
|
25072
|
+
if (typeof payload !== "object" || payload === null) return payload;
|
|
25073
|
+
const p = payload;
|
|
25074
|
+
if (!("extensions" in p) && !("resource" in p)) return payload;
|
|
25075
|
+
const rest = {};
|
|
25076
|
+
for (const [k, v] of Object.entries(p)) {
|
|
25077
|
+
if (k === "extensions" || k === "resource") continue;
|
|
25078
|
+
rest[k] = v;
|
|
25079
|
+
}
|
|
25080
|
+
return rest;
|
|
25081
|
+
}
|
|
25071
25082
|
async function processX402Settle({
|
|
25072
25083
|
x402Server,
|
|
25073
25084
|
payload,
|
|
@@ -25088,6 +25099,7 @@ async function processX402Settle({
|
|
|
25088
25099
|
if (!matchedRequirement) {
|
|
25089
25100
|
return { success: false, phase: "no_requirements", reason: "x402Server.buildPaymentRequirements returned empty" };
|
|
25090
25101
|
}
|
|
25102
|
+
const facilitatorPayload = stripUnsignedX402PayloadFields(payload);
|
|
25091
25103
|
const resolvedTransportContext = transportContext ?? (() => {
|
|
25092
25104
|
const path = new URL(resourceMeta.url).pathname;
|
|
25093
25105
|
return { method: "POST", adapter: { getPath: () => path }, routePattern: path };
|
|
@@ -25102,7 +25114,7 @@ async function processX402Settle({
|
|
|
25102
25114
|
let verifyResult;
|
|
25103
25115
|
try {
|
|
25104
25116
|
verifyResult = await server.verifyPayment(
|
|
25105
|
-
|
|
25117
|
+
facilitatorPayload,
|
|
25106
25118
|
matchedRequirement,
|
|
25107
25119
|
enrichedExt,
|
|
25108
25120
|
resolvedTransportContext
|
|
@@ -25117,7 +25129,7 @@ async function processX402Settle({
|
|
|
25117
25129
|
}
|
|
25118
25130
|
try {
|
|
25119
25131
|
const settleResult = await server.settlePayment(
|
|
25120
|
-
|
|
25132
|
+
facilitatorPayload,
|
|
25121
25133
|
matchedRequirement,
|
|
25122
25134
|
enrichedExt,
|
|
25123
25135
|
resolvedTransportContext
|