@agent-score/commerce 2.6.4 → 2.6.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/README.md +2 -2
- package/dist/{checkout-BtdHSF_w.d.mts → checkout-DOd9GDmt.d.mts} +6 -3
- package/dist/{checkout-B-Z5_EQP.d.ts → checkout-GcDNDzSK.d.ts} +6 -3
- 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 +23 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -4
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +26 -12
- package/dist/payment/index.d.ts +26 -12
- package/dist/payment/index.js +18 -0
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +17 -0
- package/dist/payment/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/payment/index.d.mts
CHANGED
|
@@ -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
|
-
* - **
|
|
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)
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
*
|
|
808
|
-
*
|
|
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
|
|
814
|
-
*
|
|
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 };
|
package/dist/payment/index.d.ts
CHANGED
|
@@ -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
|
-
* - **
|
|
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)
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
*
|
|
808
|
-
*
|
|
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
|
|
814
|
-
*
|
|
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 };
|
package/dist/payment/index.js
CHANGED
|
@@ -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,
|