@agent-score/commerce 2.0.1 → 2.0.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-B1JuEcbx.d.ts → checkout-DhSj_h94.d.ts} +6 -0
- package/dist/{checkout-BN5i1Fi7.d.mts → checkout-jNUIql6D.d.mts} +6 -0
- 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/policy.js +49 -4
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs +49 -4
- package/dist/identity/policy.mjs.map +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 +49 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/identity/web.js
CHANGED
|
@@ -371,7 +371,7 @@ function createAgentScoreCore(options) {
|
|
|
371
371
|
} = options;
|
|
372
372
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
373
373
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
374
|
-
const defaultUa = `@agent-score/commerce@${"2.0.
|
|
374
|
+
const defaultUa = `@agent-score/commerce@${"2.0.2"}`;
|
|
375
375
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
376
376
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
377
377
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/web.mjs
CHANGED
|
@@ -343,7 +343,7 @@ function createAgentScoreCore(options) {
|
|
|
343
343
|
} = options;
|
|
344
344
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
345
345
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
346
|
-
const defaultUa = `@agent-score/commerce@${"2.0.
|
|
346
|
+
const defaultUa = `@agent-score/commerce@${"2.0.2"}`;
|
|
347
347
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
348
348
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
349
349
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, DenialReason, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, VerifyWalletSignerResult, buildAgentMemoryHint } from './core.mjs';
|
|
2
2
|
export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.mjs';
|
|
3
3
|
export { F as FIXABLE_DENIAL_REASONS, b as buildContactSupportNextSteps, a as buildSignerMismatchBody, d as denialReasonStatus, c as denialReasonToBody, i as isFixableDenial, v as verificationAgentInstructions } from './_response-BFYN3b6i.mjs';
|
|
4
|
-
import { U as UCPSigningKey, a as UCPProfile } from './checkout-
|
|
5
|
-
export { A as AGENTSCORE_UCP_CAPABILITY, b as AgentScoreGatePolicy, C as Checkout, c as CheckoutContext, d as CheckoutGateConfig, e as CheckoutRailSpec, f as CheckoutRequest, g as CheckoutResult, h as CheckoutValidationError, i as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, j as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, k as PricingFn, l as PricingResult, R as RecipientsFn, m as ReferenceIdFn, n as RunGateFn, S as SettleOutcome, o as UCPCapabilityBinding, p as UCPPaymentHandlerBinding, q as UCPProfileBody, r as UCPServiceBinding, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-
|
|
4
|
+
import { U as UCPSigningKey, a as UCPProfile } from './checkout-jNUIql6D.mjs';
|
|
5
|
+
export { A as AGENTSCORE_UCP_CAPABILITY, b as AgentScoreGatePolicy, C as Checkout, c as CheckoutContext, d as CheckoutGateConfig, e as CheckoutRailSpec, f as CheckoutRequest, g as CheckoutResult, h as CheckoutValidationError, i as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, j as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, k as PricingFn, l as PricingResult, R as RecipientsFn, m as ReferenceIdFn, n as RunGateFn, S as SettleOutcome, o as UCPCapabilityBinding, p as UCPPaymentHandlerBinding, q as UCPProfileBody, r as UCPServiceBinding, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-jNUIql6D.mjs';
|
|
6
6
|
export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.mjs';
|
|
7
7
|
export { S as SolanaMppRailSpec, b as StripeRailSpec, T as TempoRailSpec, a as TempoSessionRailSpec, X as X402BaseRailSpec } from './rail_spec-XP0wKgJV.mjs';
|
|
8
8
|
export { f as formatUsdCents, l as loadSolanaFeePayer } from './solana-Cds87OTu.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, DenialReason, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, VerifyWalletSignerResult, buildAgentMemoryHint } from './core.js';
|
|
2
2
|
export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.js';
|
|
3
3
|
export { F as FIXABLE_DENIAL_REASONS, b as buildContactSupportNextSteps, a as buildSignerMismatchBody, d as denialReasonStatus, c as denialReasonToBody, i as isFixableDenial, v as verificationAgentInstructions } from './_response-_iPD5AIj.js';
|
|
4
|
-
import { U as UCPSigningKey, a as UCPProfile } from './checkout-
|
|
5
|
-
export { A as AGENTSCORE_UCP_CAPABILITY, b as AgentScoreGatePolicy, C as Checkout, c as CheckoutContext, d as CheckoutGateConfig, e as CheckoutRailSpec, f as CheckoutRequest, g as CheckoutResult, h as CheckoutValidationError, i as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, j as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, k as PricingFn, l as PricingResult, R as RecipientsFn, m as ReferenceIdFn, n as RunGateFn, S as SettleOutcome, o as UCPCapabilityBinding, p as UCPPaymentHandlerBinding, q as UCPProfileBody, r as UCPServiceBinding, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-
|
|
4
|
+
import { U as UCPSigningKey, a as UCPProfile } from './checkout-DhSj_h94.js';
|
|
5
|
+
export { A as AGENTSCORE_UCP_CAPABILITY, b as AgentScoreGatePolicy, C as Checkout, c as CheckoutContext, d as CheckoutGateConfig, e as CheckoutRailSpec, f as CheckoutRequest, g as CheckoutResult, h as CheckoutValidationError, i as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, j as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, k as PricingFn, l as PricingResult, R as RecipientsFn, m as ReferenceIdFn, n as RunGateFn, S as SettleOutcome, o as UCPCapabilityBinding, p as UCPPaymentHandlerBinding, q as UCPProfileBody, r as UCPServiceBinding, s as buildUCPProfile, t as getIdentityStatus, u as makeMppxComposeHook, v as mppPaymentHandler, w as pricingResult, x as stripeSptPaymentHandler, y as validationEnvelope, z as validationResponseExpress, B as validationResponseFastify, E as validationResponseHono, F as validationResponseNextjs, H as validationResponseWeb, J as x402PaymentHandler } from './checkout-DhSj_h94.js';
|
|
6
6
|
export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.js';
|
|
7
7
|
export { S as SolanaMppRailSpec, b as StripeRailSpec, T as TempoRailSpec, a as TempoSessionRailSpec, X as X402BaseRailSpec } from './rail_spec-XP0wKgJV.js';
|
|
8
8
|
export { f as formatUsdCents, l as loadSolanaFeePayer } from './solana-Cds87OTu.js';
|
package/dist/index.js
CHANGED
|
@@ -19694,7 +19694,7 @@ function deserialize3(value) {
|
|
|
19694
19694
|
try {
|
|
19695
19695
|
const json2 = Base64_exports.toString(prefixMatch[1]);
|
|
19696
19696
|
const parsed = JSON.parse(json2);
|
|
19697
|
-
const { opaque: challengeOpaque, request, ...challengeFields } = parsed.challenge;
|
|
19697
|
+
const { opaque: challengeOpaque, request, meta: _meta, ...challengeFields } = parsed.challenge;
|
|
19698
19698
|
const { meta: meta4, opaque } = normalizeCredentialOpaque(challengeOpaque);
|
|
19699
19699
|
const challenge = Schema.parse({
|
|
19700
19700
|
...challengeFields,
|
|
@@ -21172,7 +21172,7 @@ function createAgentScoreCore(options) {
|
|
|
21172
21172
|
} = options;
|
|
21173
21173
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
21174
21174
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
21175
|
-
const defaultUa = `@agent-score/commerce@${"2.0.
|
|
21175
|
+
const defaultUa = `@agent-score/commerce@${"2.0.2"}`;
|
|
21176
21176
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
21177
21177
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
21178
21178
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -22906,6 +22906,38 @@ var Checkout = class {
|
|
|
22906
22906
|
}
|
|
22907
22907
|
return "tempo";
|
|
22908
22908
|
}
|
|
22909
|
+
/** Map an mppx credential `method` (`tempo` | `solana` | `stripe`) to the
|
|
22910
|
+
* merchant's rails-dict key. Used in handleMppx so onSettled outcomes
|
|
22911
|
+
* distinguish Solana from Tempo (both settle under `rail: 'mpp'`) and from
|
|
22912
|
+
* Stripe SPT. Returns the first matching key or `undefined` when no rail in
|
|
22913
|
+
* the merchant's config corresponds to that method. */
|
|
22914
|
+
railsKeyForMppxMethod(method) {
|
|
22915
|
+
if (method === "stripe") {
|
|
22916
|
+
for (const [k, v] of Object.entries(this.rails)) {
|
|
22917
|
+
if (isStripeRailSpec2(v)) return k;
|
|
22918
|
+
}
|
|
22919
|
+
return void 0;
|
|
22920
|
+
}
|
|
22921
|
+
if (method === "solana") {
|
|
22922
|
+
for (const [k, v] of Object.entries(this.rails)) {
|
|
22923
|
+
if (isStripeRailSpec2(v) || isTempoSessionRailSpec3(v)) continue;
|
|
22924
|
+
const network = v.network ?? "";
|
|
22925
|
+
if (network.startsWith("solana:") || "rpcUrl" in v || "tokenProgram" in v) return k;
|
|
22926
|
+
}
|
|
22927
|
+
return void 0;
|
|
22928
|
+
}
|
|
22929
|
+
if (method === "tempo") {
|
|
22930
|
+
for (const [k, v] of Object.entries(this.rails)) {
|
|
22931
|
+
if (isStripeRailSpec2(v)) continue;
|
|
22932
|
+
const network = v.network ?? "";
|
|
22933
|
+
if (network.startsWith("solana:") || "rpcUrl" in v || "tokenProgram" in v) continue;
|
|
22934
|
+
if (network.startsWith("eip155:")) continue;
|
|
22935
|
+
return k;
|
|
22936
|
+
}
|
|
22937
|
+
return void 0;
|
|
22938
|
+
}
|
|
22939
|
+
return void 0;
|
|
22940
|
+
}
|
|
22909
22941
|
/** CAIP-2 read from `rails['x402_base'].network` (or its default).
|
|
22910
22942
|
* Defined only when an `X402BaseRailSpec` is present in rails AND a server
|
|
22911
22943
|
* is configured (explicit or auto-derived); otherwise `null`. */
|
|
@@ -23252,15 +23284,20 @@ var Checkout = class {
|
|
|
23252
23284
|
}
|
|
23253
23285
|
const composed = await this.composeMppx(ctx);
|
|
23254
23286
|
if (composed.status === 200) {
|
|
23287
|
+
const paymentReceiptHeader = composed.paymentReceiptHeader ?? extractMppxReceiptHeaderFromRaw(composed.raw);
|
|
23288
|
+
const directMethod = composed.raw?.receipt?.method;
|
|
23289
|
+
const headerMethod = paymentReceiptHeader ? await extractMppxReceiptMethod(paymentReceiptHeader) : void 0;
|
|
23290
|
+
const receiptMethod = directMethod ?? headerMethod;
|
|
23291
|
+
const derivedKey = typeof receiptMethod === "string" ? this.railsKeyForMppxMethod(receiptMethod) : void 0;
|
|
23255
23292
|
const outcome = {
|
|
23256
23293
|
rail: "mpp",
|
|
23257
23294
|
paymentResponseHeader: composed.paymentResponseHeader ?? null,
|
|
23258
|
-
paymentReceiptHeader
|
|
23295
|
+
paymentReceiptHeader,
|
|
23259
23296
|
raw: composed.raw,
|
|
23260
23297
|
txHash: composed.txHash ?? null,
|
|
23261
23298
|
signerAddress: composed.signerAddress ?? null,
|
|
23262
23299
|
signerNetwork: composed.signerNetwork ?? null,
|
|
23263
|
-
railKey: composed.railKey ?? this.mppRailKey()
|
|
23300
|
+
railKey: derivedKey ?? composed.railKey ?? this.mppRailKey()
|
|
23264
23301
|
};
|
|
23265
23302
|
return await this.buildSuccess(ctx, outcome);
|
|
23266
23303
|
}
|
|
@@ -23451,6 +23488,14 @@ function extractMppxReceiptHeaderFromRaw(raw) {
|
|
|
23451
23488
|
return null;
|
|
23452
23489
|
}
|
|
23453
23490
|
}
|
|
23491
|
+
async function extractMppxReceiptMethod(header) {
|
|
23492
|
+
try {
|
|
23493
|
+
const { Receipt } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
|
|
23494
|
+
return Receipt.deserialize(header).method;
|
|
23495
|
+
} catch {
|
|
23496
|
+
return void 0;
|
|
23497
|
+
}
|
|
23498
|
+
}
|
|
23454
23499
|
function headersToRecord(h) {
|
|
23455
23500
|
if (h === void 0) return {};
|
|
23456
23501
|
if (h instanceof Headers) {
|