@agent-score/commerce 2.7.0 → 2.7.1

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.
@@ -979,19 +979,20 @@ declare class Checkout {
979
979
  private asyncIsCachedAddress;
980
980
  private handleX402;
981
981
  private handleMppx;
982
- /** Emit a fresh 402 challenge: compute pricing, mint per-order recipients,
983
- * ask the (optional) MPP compose hook for a fresh WWW-Authenticate, and
984
- * build the rich 402 body. This is the discovery leg, factored out so the
985
- * malformed-credential path can reuse it verbatim. Idempotent on already
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 `ctx` with every payment-credential header removed, so
990
- * downstream recipient minting and MPP compose take their discovery
991
- * (fresh-mint, fresh-challenge) path instead of trying to bind the inbound
992
- * credential. Used to turn a malformed-credential request into a clean 402
993
- * re-challenge. Pricing / recipients are reset so they mint fresh. */
994
- private discoveryView;
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 a fresh 402 challenge: compute pricing, mint per-order recipients,
983
- * ask the (optional) MPP compose hook for a fresh WWW-Authenticate, and
984
- * build the rich 402 body. This is the discovery leg, factored out so the
985
- * malformed-credential path can reuse it verbatim. Idempotent on already
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 `ctx` with every payment-credential header removed, so
990
- * downstream recipient minting and MPP compose take their discovery
991
- * (fresh-mint, fresh-challenge) path instead of trying to bind the inbound
992
- * credential. Used to turn a malformed-credential request into a clean 402
993
- * re-challenge. Pricing / recipients are reset so they mint fresh. */
994
- private discoveryView;
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.0"}`;
230
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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.0"}`;
212
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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-Wc7NUHxZ.mjs';
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-CIH1UcKZ.js';
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';
@@ -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.0"}`;
923
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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.0"}`;
895
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
924
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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.0"}`;
895
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
904
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
876
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
925
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
900
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
901
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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();
@@ -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.0"}`;
876
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
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-Wc7NUHxZ.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-Wc7NUHxZ.mjs';
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-CIH1UcKZ.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-CIH1UcKZ.js';
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
@@ -22666,7 +22666,7 @@ function createAgentScoreCore(options) {
22666
22666
  } = options;
22667
22667
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
22668
22668
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
22669
- const defaultUa = `@agent-score/commerce@${"2.7.0"}`;
22669
+ const defaultUa = `@agent-score/commerce@${"2.7.1"}`;
22670
22670
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
22671
22671
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
22672
22672
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -25803,7 +25803,7 @@ var Checkout = class {
25803
25803
  const malformed = malformedPaymentCredential(request.headers);
25804
25804
  const enforced = malformed !== null && (malformed.channel === "x402" ? this.x402ServerAvailable() && this.x402BaseNetwork !== null : this.composeMppx !== void 0);
25805
25805
  if (enforced) {
25806
- const result = await this.emitFreshChallenge(this.discoveryView(ctx));
25806
+ const result = await this.handle(this.stripPaymentHeaders(request));
25807
25807
  return { ...result, settlePhase: "credential_malformed" };
25808
25808
  }
25809
25809
  }
@@ -26322,12 +26322,10 @@ var Checkout = class {
26322
26322
  settlePhase: "verify_failed"
26323
26323
  };
26324
26324
  }
26325
- /** Emit a fresh 402 challenge: compute pricing, mint per-order recipients,
26326
- * ask the (optional) MPP compose hook for a fresh WWW-Authenticate, and
26327
- * build the rich 402 body. This is the discovery leg, factored out so the
26328
- * malformed-credential path can reuse it verbatim. Idempotent on already
26329
- * computed pricing / resolved recipients, so the normal discovery leg (which
26330
- * primes both) pays nothing extra. */
26325
+ /** Emit the discovery-leg 402: pricing (idempotent), mint per-order
26326
+ * recipients, ask the optional MPP compose hook for a fresh WWW-Authenticate,
26327
+ * and build the rich 402 body. preValidate + pricing already ran in the main
26328
+ * flow before this is reached, so it primes nothing twice. */
26331
26329
  async emitFreshChallenge(ctx) {
26332
26330
  if (ctx.pricing === null) ctx.pricing = await this.computePricing(ctx);
26333
26331
  await this.resolveRecipientsForCtx(ctx);
@@ -26341,25 +26339,23 @@ var Checkout = class {
26341
26339
  }
26342
26340
  return await this.emit402(ctx, mppxHeaders);
26343
26341
  }
26344
- /** Return a copy of `ctx` with every payment-credential header removed, so
26345
- * downstream recipient minting and MPP compose take their discovery
26346
- * (fresh-mint, fresh-challenge) path instead of trying to bind the inbound
26347
- * credential. Used to turn a malformed-credential request into a clean 402
26348
- * re-challenge. Pricing / recipients are reset so they mint fresh. */
26349
- discoveryView(ctx) {
26342
+ /** Return a copy of the request with every payment-credential header removed,
26343
+ * so re-entering handle() treats it as a discovery (no-credential) request:
26344
+ * preValidate + pricing + minting + compose all run their fresh path, and the
26345
+ * gate/assess and settle are skipped. Turns a malformed-credential request
26346
+ * into a clean 402 re-challenge. The raw request is left intact (its body may
26347
+ * already be consumed); MPP compose reads it only best-effort under a
26348
+ * try/catch, while the stripped headers are what the credential-shape check,
26349
+ * gate dispatch, and recipient minting read. */
26350
+ stripPaymentHeaders(request) {
26350
26351
  const headers = {};
26351
- for (const [k, v] of Object.entries(ctx.request.headers)) {
26352
+ for (const [k, v] of Object.entries(request.headers)) {
26352
26353
  const lk = k.toLowerCase();
26353
26354
  if (lk === "payment-signature" || lk === "x-payment") continue;
26354
26355
  if (lk === "authorization" && v.startsWith("Payment ")) continue;
26355
26356
  headers[k] = v;
26356
26357
  }
26357
- return {
26358
- ...ctx,
26359
- request: { ...ctx.request, headers },
26360
- pricing: null,
26361
- recipients: {}
26362
- };
26358
+ return { ...request, headers };
26363
26359
  }
26364
26360
  async emit402(ctx, mppxHeaders = {}) {
26365
26361
  if (ctx.pricing === null) {