@agent-score/commerce 2.6.4 → 2.6.6

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.
Files changed (50) hide show
  1. package/README.md +2 -2
  2. package/dist/challenge/index.js +1 -1
  3. package/dist/challenge/index.js.map +1 -1
  4. package/dist/challenge/index.mjs +1 -1
  5. package/dist/challenge/index.mjs.map +1 -1
  6. package/dist/{checkout-BtdHSF_w.d.mts → checkout-DOd9GDmt.d.mts} +6 -3
  7. package/dist/{checkout-B-Z5_EQP.d.ts → checkout-GcDNDzSK.d.ts} +6 -3
  8. package/dist/core.js +2 -2
  9. package/dist/core.js.map +1 -1
  10. package/dist/core.mjs +2 -2
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/discovery/index.d.mts +12 -3
  13. package/dist/discovery/index.d.ts +12 -3
  14. package/dist/discovery/index.js +15 -9
  15. package/dist/discovery/index.js.map +1 -1
  16. package/dist/discovery/index.mjs +15 -9
  17. package/dist/discovery/index.mjs.map +1 -1
  18. package/dist/identity/express.js +2 -2
  19. package/dist/identity/express.js.map +1 -1
  20. package/dist/identity/express.mjs +2 -2
  21. package/dist/identity/express.mjs.map +1 -1
  22. package/dist/identity/fastify.js +2 -2
  23. package/dist/identity/fastify.js.map +1 -1
  24. package/dist/identity/fastify.mjs +2 -2
  25. package/dist/identity/fastify.mjs.map +1 -1
  26. package/dist/identity/hono.js +2 -2
  27. package/dist/identity/hono.js.map +1 -1
  28. package/dist/identity/hono.mjs +2 -2
  29. package/dist/identity/hono.mjs.map +1 -1
  30. package/dist/identity/nextjs.js +2 -2
  31. package/dist/identity/nextjs.js.map +1 -1
  32. package/dist/identity/nextjs.mjs +2 -2
  33. package/dist/identity/nextjs.mjs.map +1 -1
  34. package/dist/identity/web.js +2 -2
  35. package/dist/identity/web.js.map +1 -1
  36. package/dist/identity/web.mjs +2 -2
  37. package/dist/identity/web.mjs.map +1 -1
  38. package/dist/index.d.mts +3 -3
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +25 -6
  41. package/dist/index.js.map +1 -1
  42. package/dist/index.mjs +25 -6
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/payment/index.d.mts +26 -12
  45. package/dist/payment/index.d.ts +26 -12
  46. package/dist/payment/index.js +18 -0
  47. package/dist/payment/index.js.map +1 -1
  48. package/dist/payment/index.mjs +17 -0
  49. package/dist/payment/index.mjs.map +1 -1
  50. package/package.json +12 -12
@@ -795,23 +795,30 @@ declare function settlementOverrideHeader(overrides: SettlementOverrides): {
795
795
  * `value=0` as `invalid_payload`, so $0 x402 orders take the carve-out. The
796
796
  * credential is still run through `verifyX402Request` (signature shape +
797
797
  * payTo binding) before the carve-out is honored.
798
- * - **Tempo (and other EVM MPP)**: NOT carved out. mppx >= 0.8 settles
798
+ * - **MPP `proof` credentials**: NOT carved out. mppx >= 0.8 settles
799
799
  * zero-amount challenges natively via the wallet-bound EIP-712 proof
800
800
  * credential (full verification, access-key authorization, replay
801
- * protection), so $0 Tempo orders flow through the normal MPP settle path.
802
- * - **Solana MPP**: `@solana/mpp` has no proof-credential contract, so there
803
- * is nothing upstream to verify a $0 credential against. The carve-out
804
- * parses the credential and lifts the signer for wallet-capture
805
- * attribution; that signer block is UNAUTHENTICATED (parse-only) and must
806
- * not be trusted for anything beyond attribution hints. Identity is still
807
- * authenticated by the merchant's gate above; redemption codes are
808
- * single-use; nothing settles on-chain.
801
+ * protection). An agent that saw a $0 challenge signs a `proof`, so those
802
+ * delegate to the normal MPP settle path.
803
+ * - **Every other MPP credential at $0** (`hash` / `transaction` payloads,
804
+ * token-style credentials, Solana): carved out. These arise when the agent
805
+ * signed against a NONZERO quote that the merchant re-priced to $0 at
806
+ * settle (no-match / full-discount flows the authorization is simply
807
+ * never exercised), or on rails with no upstream $0 contract
808
+ * (`@solana/mpp` has no proof-credential surface). Upstream would reject
809
+ * all of them at $0, so the carve-out lifts the signer for wallet-capture
810
+ * attribution only; that signer block is UNAUTHENTICATED (parse-only) and
811
+ * must not be trusted beyond attribution hints. Identity is still
812
+ * authenticated by the merchant's gate above; nothing settles on-chain.
809
813
  *
810
814
  * `zeroAmountCarveOut` parses the credential, lifts the signer, and returns
811
815
  * `{ signerAddress, signerNetwork, txHash: null }`. The MPP path uses inline
812
816
  * base64+JSON parsing (no `mppx` dependency at runtime) so this module stays
813
- * dependency-free; it is also how `handleZeroSettle` classifies the rail
814
- * (Solana vs EVM did:pkh source) to decide carve-out vs delegation.
817
+ * dependency-free. `mppCredentialPayloadType` is the router `handleZeroSettle`
818
+ * uses to decide delegation (`proof`) vs carve-out (everything else); signer
819
+ * recovery itself prefers the full `extractPaymentSigner` (which also decodes
820
+ * source-less Solana credentials from the signed transaction) with this
821
+ * module's inline parse as the dependency-free backstop.
815
822
  */
816
823
 
817
824
  type ZeroSettleRail = 'x402-base' | 'tempo' | 'solana';
@@ -845,6 +852,13 @@ declare function zeroAmountCarveOut({ rail, payload, authorizationHeader, }: {
845
852
  * header value. Reads the `did:pkh:*` source DID. */
846
853
  authorizationHeader?: string | null;
847
854
  }): ZeroSettleResult;
855
+ /**
856
+ * Read the MPP credential's `payload.type` (`'proof'` / `'hash'` /
857
+ * `'transaction'`) from an `Authorization: Payment <base64>` header without
858
+ * any `mppx` dependency. Returns `null` for token-style values (JWTs),
859
+ * unparseable headers, or credentials without a typed payload.
860
+ */
861
+ declare function mppCredentialPayloadType(authorizationHeader: string | null | undefined): string | null;
848
862
 
849
863
  /**
850
864
  * Lazy-init helpers for x402 + mppx servers.
@@ -887,4 +901,4 @@ declare function lazyMppxServer(opts: {
887
901
  secretKey: string;
888
902
  }): () => Promise<unknown>;
889
903
 
890
- export { type ClassifiedX402Error, type MppxComposeResult, type MppxRailSpec, type NetworkFamily, type PaymentHeadersRail, type PaymentHeadersResult, type ProcessX402SettleFailure, type ProcessX402SettleResult, type ProcessX402SettleSuccess, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, SignerNetwork, SolanaMppRailSpec, StripeRailSpec, TempoRailSpec, TempoSessionRailSpec, USDC, type VerifyX402RequestResult, X402BaseRailSpec, X402Server, type X402ServerLike, X402_SUPPORTED_BASE_NETWORKS, type ZeroSettleRail, type ZeroSettleResult, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyOrchestrationError, classifyX402SettleResult, composeMppxRequest, createMppxServer, detectRailFromHeaders, dispatchSettlementByNetwork, lazyMppxServer, lazyX402Server, lookupRail, mppxChallengeHeaders, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, runWithMppxFailureCapture, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash, zeroAmountCarveOut };
904
+ export { type ClassifiedX402Error, type MppxComposeResult, type MppxRailSpec, type NetworkFamily, type PaymentHeadersRail, type PaymentHeadersResult, type ProcessX402SettleFailure, type ProcessX402SettleResult, type ProcessX402SettleSuccess, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, SignerNetwork, SolanaMppRailSpec, StripeRailSpec, TempoRailSpec, TempoSessionRailSpec, USDC, type VerifyX402RequestResult, X402BaseRailSpec, X402Server, type X402ServerLike, X402_SUPPORTED_BASE_NETWORKS, type ZeroSettleRail, type ZeroSettleResult, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyOrchestrationError, classifyX402SettleResult, composeMppxRequest, createMppxServer, detectRailFromHeaders, dispatchSettlementByNetwork, lazyMppxServer, lazyX402Server, lookupRail, mppCredentialPayloadType, mppxChallengeHeaders, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, runWithMppxFailureCapture, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash, zeroAmountCarveOut };
@@ -795,23 +795,30 @@ declare function settlementOverrideHeader(overrides: SettlementOverrides): {
795
795
  * `value=0` as `invalid_payload`, so $0 x402 orders take the carve-out. The
796
796
  * credential is still run through `verifyX402Request` (signature shape +
797
797
  * payTo binding) before the carve-out is honored.
798
- * - **Tempo (and other EVM MPP)**: NOT carved out. mppx >= 0.8 settles
798
+ * - **MPP `proof` credentials**: NOT carved out. mppx >= 0.8 settles
799
799
  * zero-amount challenges natively via the wallet-bound EIP-712 proof
800
800
  * credential (full verification, access-key authorization, replay
801
- * protection), so $0 Tempo orders flow through the normal MPP settle path.
802
- * - **Solana MPP**: `@solana/mpp` has no proof-credential contract, so there
803
- * is nothing upstream to verify a $0 credential against. The carve-out
804
- * parses the credential and lifts the signer for wallet-capture
805
- * attribution; that signer block is UNAUTHENTICATED (parse-only) and must
806
- * not be trusted for anything beyond attribution hints. Identity is still
807
- * authenticated by the merchant's gate above; redemption codes are
808
- * single-use; nothing settles on-chain.
801
+ * protection). An agent that saw a $0 challenge signs a `proof`, so those
802
+ * delegate to the normal MPP settle path.
803
+ * - **Every other MPP credential at $0** (`hash` / `transaction` payloads,
804
+ * token-style credentials, Solana): carved out. These arise when the agent
805
+ * signed against a NONZERO quote that the merchant re-priced to $0 at
806
+ * settle (no-match / full-discount flows the authorization is simply
807
+ * never exercised), or on rails with no upstream $0 contract
808
+ * (`@solana/mpp` has no proof-credential surface). Upstream would reject
809
+ * all of them at $0, so the carve-out lifts the signer for wallet-capture
810
+ * attribution only; that signer block is UNAUTHENTICATED (parse-only) and
811
+ * must not be trusted beyond attribution hints. Identity is still
812
+ * authenticated by the merchant's gate above; nothing settles on-chain.
809
813
  *
810
814
  * `zeroAmountCarveOut` parses the credential, lifts the signer, and returns
811
815
  * `{ signerAddress, signerNetwork, txHash: null }`. The MPP path uses inline
812
816
  * base64+JSON parsing (no `mppx` dependency at runtime) so this module stays
813
- * dependency-free; it is also how `handleZeroSettle` classifies the rail
814
- * (Solana vs EVM did:pkh source) to decide carve-out vs delegation.
817
+ * dependency-free. `mppCredentialPayloadType` is the router `handleZeroSettle`
818
+ * uses to decide delegation (`proof`) vs carve-out (everything else); signer
819
+ * recovery itself prefers the full `extractPaymentSigner` (which also decodes
820
+ * source-less Solana credentials from the signed transaction) with this
821
+ * module's inline parse as the dependency-free backstop.
815
822
  */
816
823
 
817
824
  type ZeroSettleRail = 'x402-base' | 'tempo' | 'solana';
@@ -845,6 +852,13 @@ declare function zeroAmountCarveOut({ rail, payload, authorizationHeader, }: {
845
852
  * header value. Reads the `did:pkh:*` source DID. */
846
853
  authorizationHeader?: string | null;
847
854
  }): ZeroSettleResult;
855
+ /**
856
+ * Read the MPP credential's `payload.type` (`'proof'` / `'hash'` /
857
+ * `'transaction'`) from an `Authorization: Payment <base64>` header without
858
+ * any `mppx` dependency. Returns `null` for token-style values (JWTs),
859
+ * unparseable headers, or credentials without a typed payload.
860
+ */
861
+ declare function mppCredentialPayloadType(authorizationHeader: string | null | undefined): string | null;
848
862
 
849
863
  /**
850
864
  * Lazy-init helpers for x402 + mppx servers.
@@ -887,4 +901,4 @@ declare function lazyMppxServer(opts: {
887
901
  secretKey: string;
888
902
  }): () => Promise<unknown>;
889
903
 
890
- export { type ClassifiedX402Error, type MppxComposeResult, type MppxRailSpec, type NetworkFamily, type PaymentHeadersRail, type PaymentHeadersResult, type ProcessX402SettleFailure, type ProcessX402SettleResult, type ProcessX402SettleSuccess, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, SignerNetwork, SolanaMppRailSpec, StripeRailSpec, TempoRailSpec, TempoSessionRailSpec, USDC, type VerifyX402RequestResult, X402BaseRailSpec, X402Server, type X402ServerLike, X402_SUPPORTED_BASE_NETWORKS, type ZeroSettleRail, type ZeroSettleResult, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyOrchestrationError, classifyX402SettleResult, composeMppxRequest, createMppxServer, detectRailFromHeaders, dispatchSettlementByNetwork, lazyMppxServer, lazyX402Server, lookupRail, mppxChallengeHeaders, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, runWithMppxFailureCapture, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash, zeroAmountCarveOut };
904
+ export { type ClassifiedX402Error, type MppxComposeResult, type MppxRailSpec, type NetworkFamily, type PaymentHeadersRail, type PaymentHeadersResult, type ProcessX402SettleFailure, type ProcessX402SettleResult, type ProcessX402SettleSuccess, type RailDefinition, type RailName, SETTLEMENT_OVERRIDES_HEADER, type SettlementHandlers, type SettlementOverrides, type SettlementPayloadLike, SignerNetwork, SolanaMppRailSpec, StripeRailSpec, TempoRailSpec, TempoSessionRailSpec, USDC, type VerifyX402RequestResult, X402BaseRailSpec, X402Server, type X402ServerLike, X402_SUPPORTED_BASE_NETWORKS, type ZeroSettleRail, type ZeroSettleResult, buildIdempotencyKey, buildPaymentDirective, buildPaymentHeaders, buildPaymentRequestBlob, classifyOrchestrationError, classifyX402SettleResult, composeMppxRequest, createMppxServer, detectRailFromHeaders, dispatchSettlementByNetwork, lazyMppxServer, lazyX402Server, lookupRail, mppCredentialPayloadType, mppxChallengeHeaders, networkFamily, networks, paymentDirective, processX402Settle, rails, registerX402SchemesV1V2, runWithMppxFailureCapture, settlementOverrideHeader, validateX402NetworkConfig, verifyX402Request, wrapSolanaChargeWithFinalizedBlockhash, zeroAmountCarveOut };
@@ -54,6 +54,7 @@ __export(payment_exports, {
54
54
  loadSolanaFeePayer: () => loadSolanaFeePayer,
55
55
  lookupRail: () => lookupRail,
56
56
  malformedPaymentCredential: () => malformedPaymentCredential,
57
+ mppCredentialPayloadType: () => mppCredentialPayloadType,
57
58
  mppxChallengeHeaders: () => mppxChallengeHeaders,
58
59
  networkFamily: () => networkFamily,
59
60
  networks: () => networks,
@@ -1220,6 +1221,22 @@ function x402SignerFromPayload(payload) {
1220
1221
  txHash: null
1221
1222
  };
1222
1223
  }
1224
+ function mppCredentialPayloadType(authorizationHeader) {
1225
+ if (typeof authorizationHeader !== "string") return null;
1226
+ if (!authorizationHeader.toLowerCase().startsWith("payment ")) return null;
1227
+ const token = authorizationHeader.slice("payment ".length).trim();
1228
+ if (!token) return null;
1229
+ try {
1230
+ const credential = JSON.parse(atob(token));
1231
+ if (!credential || typeof credential !== "object") return null;
1232
+ const payload = credential.payload;
1233
+ if (!payload || typeof payload !== "object") return null;
1234
+ const type = payload.type;
1235
+ return typeof type === "string" ? type : null;
1236
+ } catch {
1237
+ return null;
1238
+ }
1239
+ }
1223
1240
  function mppSignerFromAuth(authorizationHeader) {
1224
1241
  if (typeof authorizationHeader !== "string") return NULL_RESULT;
1225
1242
  if (!authorizationHeader.toLowerCase().startsWith("payment ")) return NULL_RESULT;
@@ -1513,6 +1530,7 @@ function isSolanaNetwork(input) {
1513
1530
  loadSolanaFeePayer,
1514
1531
  lookupRail,
1515
1532
  malformedPaymentCredential,
1533
+ mppCredentialPayloadType,
1516
1534
  mppxChallengeHeaders,
1517
1535
  networkFamily,
1518
1536
  networks,