@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
|
@@ -979,19 +979,20 @@ declare class Checkout {
|
|
|
979
979
|
private asyncIsCachedAddress;
|
|
980
980
|
private handleX402;
|
|
981
981
|
private handleMppx;
|
|
982
|
-
/** Emit
|
|
983
|
-
* ask the
|
|
984
|
-
* build the rich 402 body.
|
|
985
|
-
*
|
|
986
|
-
* computed pricing / resolved recipients, so the normal discovery leg (which
|
|
987
|
-
* primes both) pays nothing extra. */
|
|
982
|
+
/** Emit the discovery-leg 402: pricing (idempotent), mint per-order
|
|
983
|
+
* recipients, ask the optional MPP compose hook for a fresh WWW-Authenticate,
|
|
984
|
+
* and build the rich 402 body. preValidate + pricing already ran in the main
|
|
985
|
+
* flow before this is reached, so it primes nothing twice. */
|
|
988
986
|
private emitFreshChallenge;
|
|
989
|
-
/** Return a copy of
|
|
990
|
-
*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
* re-challenge.
|
|
994
|
-
|
|
987
|
+
/** Return a copy of the request with every payment-credential header removed,
|
|
988
|
+
* so re-entering handle() treats it as a discovery (no-credential) request:
|
|
989
|
+
* preValidate + pricing + minting + compose all run their fresh path, and the
|
|
990
|
+
* gate/assess and settle are skipped. Turns a malformed-credential request
|
|
991
|
+
* into a clean 402 re-challenge. The raw request is left intact (its body may
|
|
992
|
+
* already be consumed); MPP compose reads it only best-effort under a
|
|
993
|
+
* try/catch, while the stripped headers are what the credential-shape check,
|
|
994
|
+
* gate dispatch, and recipient minting read. */
|
|
995
|
+
private stripPaymentHeaders;
|
|
995
996
|
private emit402;
|
|
996
997
|
private buildSuccess;
|
|
997
998
|
}
|
|
@@ -979,19 +979,20 @@ declare class Checkout {
|
|
|
979
979
|
private asyncIsCachedAddress;
|
|
980
980
|
private handleX402;
|
|
981
981
|
private handleMppx;
|
|
982
|
-
/** Emit
|
|
983
|
-
* ask the
|
|
984
|
-
* build the rich 402 body.
|
|
985
|
-
*
|
|
986
|
-
* computed pricing / resolved recipients, so the normal discovery leg (which
|
|
987
|
-
* primes both) pays nothing extra. */
|
|
982
|
+
/** Emit the discovery-leg 402: pricing (idempotent), mint per-order
|
|
983
|
+
* recipients, ask the optional MPP compose hook for a fresh WWW-Authenticate,
|
|
984
|
+
* and build the rich 402 body. preValidate + pricing already ran in the main
|
|
985
|
+
* flow before this is reached, so it primes nothing twice. */
|
|
988
986
|
private emitFreshChallenge;
|
|
989
|
-
/** Return a copy of
|
|
990
|
-
*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
* re-challenge.
|
|
994
|
-
|
|
987
|
+
/** Return a copy of the request with every payment-credential header removed,
|
|
988
|
+
* so re-entering handle() treats it as a discovery (no-credential) request:
|
|
989
|
+
* preValidate + pricing + minting + compose all run their fresh path, and the
|
|
990
|
+
* gate/assess and settle are skipped. Turns a malformed-credential request
|
|
991
|
+
* into a clean 402 re-challenge. The raw request is left intact (its body may
|
|
992
|
+
* already be consumed); MPP compose reads it only best-effort under a
|
|
993
|
+
* try/catch, while the stripped headers are what the credential-shape check,
|
|
994
|
+
* gate dispatch, and recipient minting read. */
|
|
995
|
+
private stripPaymentHeaders;
|
|
995
996
|
private emit402;
|
|
996
997
|
private buildSuccess;
|
|
997
998
|
}
|
package/dist/core.js
CHANGED
|
@@ -227,7 +227,7 @@ function createAgentScoreCore(options) {
|
|
|
227
227
|
} = options;
|
|
228
228
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
229
229
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
230
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
230
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
231
231
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
232
232
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
233
233
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/core.mjs
CHANGED
|
@@ -209,7 +209,7 @@ function createAgentScoreCore(options) {
|
|
|
209
209
|
} = options;
|
|
210
210
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
211
211
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
212
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
212
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
213
213
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
214
214
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
215
215
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { R as RailKey, C as CompatibleClients } from '../pricing-sfv3CPiY.mjs';
|
|
2
2
|
export { g as compatibleClientsByRails } from '../pricing-sfv3CPiY.mjs';
|
|
3
|
-
import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-
|
|
3
|
+
import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-DKq9gV3G.mjs';
|
|
4
4
|
import '../rail_spec-DGdb4Gnd.mjs';
|
|
5
5
|
import '../core.mjs';
|
|
6
6
|
import '@agent-score/sdk';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { R as RailKey, C as CompatibleClients } from '../pricing-Dx3F1VAv.js';
|
|
2
2
|
export { g as compatibleClientsByRails } from '../pricing-Dx3F1VAv.js';
|
|
3
|
-
import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-
|
|
3
|
+
import { C as Checkout, p as UCPServiceBinding, a as AgentScoreGatePolicy } from '../checkout-DW7GgRrl.js';
|
|
4
4
|
import '../rail_spec-DGdb4Gnd.js';
|
|
5
5
|
import '../core.js';
|
|
6
6
|
import '@agent-score/sdk';
|
package/dist/identity/express.js
CHANGED
|
@@ -920,7 +920,7 @@ function createAgentScoreCore(options) {
|
|
|
920
920
|
} = options;
|
|
921
921
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
922
922
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
923
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
923
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
924
924
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
925
925
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
926
926
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -892,7 +892,7 @@ function createAgentScoreCore(options) {
|
|
|
892
892
|
} = options;
|
|
893
893
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
894
894
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
895
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
895
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
896
896
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
897
897
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
898
898
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/fastify.js
CHANGED
|
@@ -921,7 +921,7 @@ function createAgentScoreCore(options) {
|
|
|
921
921
|
} = options;
|
|
922
922
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
923
923
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
924
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
924
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
925
925
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
926
926
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
927
927
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -892,7 +892,7 @@ function createAgentScoreCore(options) {
|
|
|
892
892
|
} = options;
|
|
893
893
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
894
894
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
895
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
895
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
896
896
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
897
897
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
898
898
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/hono.js
CHANGED
|
@@ -901,7 +901,7 @@ function createAgentScoreCore(options) {
|
|
|
901
901
|
} = options;
|
|
902
902
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
903
903
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
904
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
904
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
905
905
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
906
906
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
907
907
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/hono.mjs
CHANGED
|
@@ -873,7 +873,7 @@ function createAgentScoreCore(options) {
|
|
|
873
873
|
} = options;
|
|
874
874
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
875
875
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
876
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
876
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
877
877
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
878
878
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
879
879
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/nextjs.js
CHANGED
|
@@ -922,7 +922,7 @@ function createAgentScoreCore(options) {
|
|
|
922
922
|
} = options;
|
|
923
923
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
924
924
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
925
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
925
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
926
926
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
927
927
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
928
928
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/nextjs.mjs
CHANGED
|
@@ -897,7 +897,7 @@ function createAgentScoreCore(options) {
|
|
|
897
897
|
} = options;
|
|
898
898
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
899
899
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
900
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
900
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
901
901
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
902
902
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
903
903
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/web.js
CHANGED
|
@@ -898,7 +898,7 @@ function createAgentScoreCore(options) {
|
|
|
898
898
|
} = options;
|
|
899
899
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
900
900
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
901
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
901
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
902
902
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
903
903
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
904
904
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/identity/web.mjs
CHANGED
|
@@ -873,7 +873,7 @@ function createAgentScoreCore(options) {
|
|
|
873
873
|
} = options;
|
|
874
874
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
875
875
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
876
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
876
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
877
877
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
878
878
|
const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
879
879
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VerifyWalletSignerResult, DenialReason } from './core.mjs';
|
|
2
2
|
export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, buildAgentMemoryHint } from './core.mjs';
|
|
3
3
|
export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.mjs';
|
|
4
|
-
import { q as UCPSigningKey, n as UCPProfile } from './checkout-
|
|
5
|
-
export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, 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 { q as UCPSigningKey, n as UCPProfile } from './checkout-DKq9gV3G.mjs';
|
|
5
|
+
export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, 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-DKq9gV3G.mjs';
|
|
6
6
|
export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.mjs';
|
|
7
7
|
import { H as HeadersLike } from './network_kind-CLdLbqU5.mjs';
|
|
8
8
|
export { M as MalformedPaymentCredential, c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, i as isEvmNetwork, j as isSolanaNetwork, l as loadSolanaFeePayer, m as malformedPaymentCredential } from './network_kind-CLdLbqU5.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VerifyWalletSignerResult, DenialReason } from './core.js';
|
|
2
2
|
export { AccountVerification, AgentIdentity, AgentMemoryHint, AgentScoreCore, AssessResult, CreateSessionOnMissing, DenialCode, EvaluateOutcome, OperatorVerification, PolicyCheck, PolicyResult, SignerVerdict, buildAgentMemoryHint } from './core.js';
|
|
3
3
|
export { P as PaymentSigner, S as SignerNetwork, e as extractPaymentSigner, a as extractPaymentSignerFromAuth, b as extractSignerForPrecheck, r as readX402PaymentHeader } from './signer-3FAit11j.js';
|
|
4
|
-
import { q as UCPSigningKey, n as UCPProfile } from './checkout-
|
|
5
|
-
export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, 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 { q as UCPSigningKey, n as UCPProfile } from './checkout-DW7GgRrl.js';
|
|
5
|
+
export { A as AGENTSCORE_UCP_CAPABILITY, a as AgentScoreGatePolicy, C as Checkout, b as CheckoutContext, c as CheckoutGateConfig, d as CheckoutRailSpec, e as CheckoutRequest, f as CheckoutResult, g as ComposeMppxFn, D as DiscoveryProbeConfig, G as GateDenial, I as IsCachedAddressFn, M as MountUcpRoutesOptions, h as MppxComposeOutcome, O as OnSettledFn, P as PreValidateFn, i as PricingFn, j as PricingResult, R as RecipientsFn, k as ReferenceIdFn, l as RunGateFn, S as SettleOutcome, U as UCPCapabilityBinding, m as UCPPaymentHandlerBinding, o as UCPProfileBody, p as UCPServiceBinding, r as buildAipTrustedIssuers, 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-DW7GgRrl.js';
|
|
6
6
|
export { EnforcementMode, GateResult, IdentityStatus, PolicyBlock, buildGateFromPolicy, runGateWithEnforcement, shippingCountryAllowed, shippingStateAllowed, validateShippingAgainstPolicy } from './identity/policy.js';
|
|
7
7
|
import { H as HeadersLike } from './network_kind-toxNABqw.js';
|
|
8
8
|
export { M as MalformedPaymentCredential, c as buildDefaultCheckoutRails, d as buildMppxComposeRails, f as formatUsdCents, h as hasMppxHeader, e as hasPaymentHeader, g as hasX402Header, i as isEvmNetwork, j as isSolanaNetwork, l as loadSolanaFeePayer, m as malformedPaymentCredential } from './network_kind-toxNABqw.js';
|
package/dist/index.js
CHANGED
|
@@ -20148,7 +20148,7 @@ var version3;
|
|
|
20148
20148
|
var init_version2 = __esm({
|
|
20149
20149
|
"node_modules/viem/_esm/errors/version.js"() {
|
|
20150
20150
|
"use strict";
|
|
20151
|
-
version3 = "2.
|
|
20151
|
+
version3 = "2.55.2";
|
|
20152
20152
|
}
|
|
20153
20153
|
});
|
|
20154
20154
|
|
|
@@ -20704,6 +20704,8 @@ var Assets_exports = {};
|
|
|
20704
20704
|
__export(Assets_exports, {
|
|
20705
20705
|
base: () => base,
|
|
20706
20706
|
baseSepolia: () => baseSepolia,
|
|
20707
|
+
celo: () => celo,
|
|
20708
|
+
celoSepolia: () => celoSepolia,
|
|
20707
20709
|
define: () => define,
|
|
20708
20710
|
fromToken: () => fromToken,
|
|
20709
20711
|
isAsset: () => isAsset,
|
|
@@ -20791,7 +20793,7 @@ function withTokenDefaults(transfer, token) {
|
|
|
20791
20793
|
name: token.name
|
|
20792
20794
|
};
|
|
20793
20795
|
}
|
|
20794
|
-
var knownAsset, base, baseSepolia;
|
|
20796
|
+
var knownAsset, base, baseSepolia, celo, celoSepolia;
|
|
20795
20797
|
var init_Assets = __esm({
|
|
20796
20798
|
"node_modules/mppx/dist/x402/Assets.js"() {
|
|
20797
20799
|
"use strict";
|
|
@@ -20823,6 +20825,42 @@ var init_Assets = __esm({
|
|
|
20823
20825
|
}
|
|
20824
20826
|
})
|
|
20825
20827
|
};
|
|
20828
|
+
celo = {
|
|
20829
|
+
USDC: define({
|
|
20830
|
+
address: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C",
|
|
20831
|
+
decimals: 6,
|
|
20832
|
+
network: "eip155:42220",
|
|
20833
|
+
transfer: {
|
|
20834
|
+
// Celo USDC signs with the shorter EIP-712 domain name.
|
|
20835
|
+
name: "USDC",
|
|
20836
|
+
type: "eip3009",
|
|
20837
|
+
version: "2"
|
|
20838
|
+
}
|
|
20839
|
+
}),
|
|
20840
|
+
USDT: define({
|
|
20841
|
+
address: "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e",
|
|
20842
|
+
decimals: 6,
|
|
20843
|
+
network: "eip155:42220",
|
|
20844
|
+
transfer: {
|
|
20845
|
+
// Celo USDT signs with domain version "1", unlike Circle's FiatToken "2".
|
|
20846
|
+
name: "Tether USD",
|
|
20847
|
+
type: "eip3009",
|
|
20848
|
+
version: "1"
|
|
20849
|
+
}
|
|
20850
|
+
})
|
|
20851
|
+
};
|
|
20852
|
+
celoSepolia = {
|
|
20853
|
+
USDC: define({
|
|
20854
|
+
address: "0x01C5C0122039549AD1493B8220cABEdD739BC44E",
|
|
20855
|
+
decimals: 6,
|
|
20856
|
+
network: "eip155:11142220",
|
|
20857
|
+
transfer: {
|
|
20858
|
+
name: "USDC",
|
|
20859
|
+
type: "eip3009",
|
|
20860
|
+
version: "2"
|
|
20861
|
+
}
|
|
20862
|
+
})
|
|
20863
|
+
};
|
|
20826
20864
|
}
|
|
20827
20865
|
});
|
|
20828
20866
|
|
|
@@ -20831,6 +20869,8 @@ var Assets_exports2 = {};
|
|
|
20831
20869
|
__export(Assets_exports2, {
|
|
20832
20870
|
base: () => base,
|
|
20833
20871
|
baseSepolia: () => baseSepolia,
|
|
20872
|
+
celo: () => celo,
|
|
20873
|
+
celoSepolia: () => celoSepolia,
|
|
20834
20874
|
define: () => define,
|
|
20835
20875
|
fromToken: () => fromToken,
|
|
20836
20876
|
isAsset: () => isAsset,
|
|
@@ -20852,14 +20892,18 @@ var init_Assets2 = __esm({
|
|
|
20852
20892
|
var Chains_exports = {};
|
|
20853
20893
|
__export(Chains_exports, {
|
|
20854
20894
|
base: () => base2,
|
|
20855
|
-
baseSepolia: () => baseSepolia2
|
|
20895
|
+
baseSepolia: () => baseSepolia2,
|
|
20896
|
+
celo: () => celo2,
|
|
20897
|
+
celoSepolia: () => celoSepolia2
|
|
20856
20898
|
});
|
|
20857
|
-
var base2, baseSepolia2;
|
|
20899
|
+
var base2, baseSepolia2, celo2, celoSepolia2;
|
|
20858
20900
|
var init_Chains = __esm({
|
|
20859
20901
|
"node_modules/mppx/dist/evm/Chains.js"() {
|
|
20860
20902
|
"use strict";
|
|
20861
20903
|
base2 = 8453;
|
|
20862
20904
|
baseSepolia2 = 84532;
|
|
20905
|
+
celo2 = 42220;
|
|
20906
|
+
celoSepolia2 = 11142220;
|
|
20863
20907
|
}
|
|
20864
20908
|
});
|
|
20865
20909
|
|
|
@@ -21531,7 +21575,7 @@ var init_Header = __esm({
|
|
|
21531
21575
|
if (record2.x402Version !== 2 || !Array.isArray(record2.accepts))
|
|
21532
21576
|
throw new InvalidJsonHeaderError();
|
|
21533
21577
|
const resource = ResourceInfoSchema.parse(record2.resource);
|
|
21534
|
-
const extensions = record2.extensions
|
|
21578
|
+
const extensions = record2.extensions !== void 0 ? ExtensionsSchema.safeParse(record2.extensions).data : void 0;
|
|
21535
21579
|
return {
|
|
21536
21580
|
accepts: record2.accepts,
|
|
21537
21581
|
...extensions ? { extensions } : {},
|
|
@@ -22666,7 +22710,7 @@ function createAgentScoreCore(options) {
|
|
|
22666
22710
|
} = options;
|
|
22667
22711
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
22668
22712
|
const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
|
|
22669
|
-
const defaultUa = `@agent-score/commerce@${"2.7.
|
|
22713
|
+
const defaultUa = `@agent-score/commerce@${"2.7.2"}`;
|
|
22670
22714
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
22671
22715
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
22672
22716
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|
|
@@ -25803,7 +25847,7 @@ var Checkout = class {
|
|
|
25803
25847
|
const malformed = malformedPaymentCredential(request.headers);
|
|
25804
25848
|
const enforced = malformed !== null && (malformed.channel === "x402" ? this.x402ServerAvailable() && this.x402BaseNetwork !== null : this.composeMppx !== void 0);
|
|
25805
25849
|
if (enforced) {
|
|
25806
|
-
const result = await this.
|
|
25850
|
+
const result = await this.handle(this.stripPaymentHeaders(request));
|
|
25807
25851
|
return { ...result, settlePhase: "credential_malformed" };
|
|
25808
25852
|
}
|
|
25809
25853
|
}
|
|
@@ -26322,12 +26366,10 @@ var Checkout = class {
|
|
|
26322
26366
|
settlePhase: "verify_failed"
|
|
26323
26367
|
};
|
|
26324
26368
|
}
|
|
26325
|
-
/** Emit
|
|
26326
|
-
* ask the
|
|
26327
|
-
* build the rich 402 body.
|
|
26328
|
-
*
|
|
26329
|
-
* computed pricing / resolved recipients, so the normal discovery leg (which
|
|
26330
|
-
* primes both) pays nothing extra. */
|
|
26369
|
+
/** Emit the discovery-leg 402: pricing (idempotent), mint per-order
|
|
26370
|
+
* recipients, ask the optional MPP compose hook for a fresh WWW-Authenticate,
|
|
26371
|
+
* and build the rich 402 body. preValidate + pricing already ran in the main
|
|
26372
|
+
* flow before this is reached, so it primes nothing twice. */
|
|
26331
26373
|
async emitFreshChallenge(ctx) {
|
|
26332
26374
|
if (ctx.pricing === null) ctx.pricing = await this.computePricing(ctx);
|
|
26333
26375
|
await this.resolveRecipientsForCtx(ctx);
|
|
@@ -26341,25 +26383,23 @@ var Checkout = class {
|
|
|
26341
26383
|
}
|
|
26342
26384
|
return await this.emit402(ctx, mppxHeaders);
|
|
26343
26385
|
}
|
|
26344
|
-
/** Return a copy of
|
|
26345
|
-
*
|
|
26346
|
-
*
|
|
26347
|
-
*
|
|
26348
|
-
* re-challenge.
|
|
26349
|
-
|
|
26386
|
+
/** Return a copy of the request with every payment-credential header removed,
|
|
26387
|
+
* so re-entering handle() treats it as a discovery (no-credential) request:
|
|
26388
|
+
* preValidate + pricing + minting + compose all run their fresh path, and the
|
|
26389
|
+
* gate/assess and settle are skipped. Turns a malformed-credential request
|
|
26390
|
+
* into a clean 402 re-challenge. The raw request is left intact (its body may
|
|
26391
|
+
* already be consumed); MPP compose reads it only best-effort under a
|
|
26392
|
+
* try/catch, while the stripped headers are what the credential-shape check,
|
|
26393
|
+
* gate dispatch, and recipient minting read. */
|
|
26394
|
+
stripPaymentHeaders(request) {
|
|
26350
26395
|
const headers = {};
|
|
26351
|
-
for (const [k, v] of Object.entries(
|
|
26396
|
+
for (const [k, v] of Object.entries(request.headers)) {
|
|
26352
26397
|
const lk = k.toLowerCase();
|
|
26353
26398
|
if (lk === "payment-signature" || lk === "x-payment") continue;
|
|
26354
26399
|
if (lk === "authorization" && v.startsWith("Payment ")) continue;
|
|
26355
26400
|
headers[k] = v;
|
|
26356
26401
|
}
|
|
26357
|
-
return {
|
|
26358
|
-
...ctx,
|
|
26359
|
-
request: { ...ctx.request, headers },
|
|
26360
|
-
pricing: null,
|
|
26361
|
-
recipients: {}
|
|
26362
|
-
};
|
|
26402
|
+
return { ...request, headers };
|
|
26363
26403
|
}
|
|
26364
26404
|
async emit402(ctx, mppxHeaders = {}) {
|
|
26365
26405
|
if (ctx.pricing === null) {
|