mppx 0.9.2 → 0.10.0

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 (78) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +19 -0
  3. package/dist/Method.d.ts +2 -0
  4. package/dist/cli/Extension.d.ts +20 -0
  5. package/dist/cli/Extension.js +5 -0
  6. package/dist/cli/cli.js +137 -137
  7. package/dist/cli/config.d.ts +4 -0
  8. package/dist/cli/config.js +1 -0
  9. package/dist/cli/internal.d.ts +7 -1
  10. package/dist/cli/internal.js +51 -5
  11. package/dist/cli/plugins/index.js +12 -12
  12. package/dist/cli/plugins/plugin.d.ts +2 -2
  13. package/dist/cli/sessions/request.d.ts +1 -0
  14. package/dist/cli/sessions/request.js +1 -0
  15. package/dist/cli/validate/discovery.d.ts +3 -1
  16. package/dist/cli/validate/discovery.js +28 -1
  17. package/dist/cli/validate/helpers.d.ts +3 -2
  18. package/dist/cli/validate/helpers.js +3 -0
  19. package/dist/cli/validate/index.js +3 -1
  20. package/dist/cli/validate/payment.js +118 -59
  21. package/dist/client/Mppx.d.ts +32 -0
  22. package/dist/client/Mppx.js +180 -6
  23. package/dist/client/internal/Fetch.d.ts +6 -0
  24. package/dist/client/internal/Fetch.js +4 -2
  25. package/dist/evm/client/Charge.d.ts +2 -2
  26. package/dist/evm/client/Charge.js +1 -1
  27. package/dist/evm/server/Charge.d.ts +7 -2
  28. package/dist/evm/server/Charge.js +28 -2
  29. package/dist/evm/server/Methods.d.ts +1 -1
  30. package/dist/internal/version.d.ts +5 -0
  31. package/dist/internal/version.js +6 -0
  32. package/dist/server/Mppx.d.ts +7 -6
  33. package/dist/server/Mppx.js +84 -2
  34. package/dist/server/internal/html/config.js +1 -3
  35. package/dist/stripe/Methods.d.ts +4 -3
  36. package/dist/stripe/Methods.js +14 -11
  37. package/dist/stripe/client/Charge.d.ts +3 -3
  38. package/dist/stripe/client/Methods.d.ts +3 -3
  39. package/dist/stripe/internal/parse-units.d.ts +8 -0
  40. package/dist/stripe/internal/parse-units.js +20 -0
  41. package/dist/stripe/internal/payment-intent.d.ts +29 -0
  42. package/dist/stripe/internal/payment-intent.js +8 -0
  43. package/dist/stripe/server/Charge.d.ts +5 -3
  44. package/dist/stripe/server/Charge.js +17 -21
  45. package/dist/stripe/server/Methods.d.ts +6 -4
  46. package/dist/stripe/server/Methods.js +42 -14
  47. package/dist/stripe/server/internal/analytics.d.ts +6 -0
  48. package/dist/stripe/server/internal/analytics.js +16 -0
  49. package/dist/stripe/server/internal/html.gen.d.ts +1 -1
  50. package/dist/stripe/server/internal/html.gen.js +1 -1
  51. package/dist/stripe/server/internal/record-payment.d.ts +1 -0
  52. package/dist/stripe/server/internal/record-payment.js +7 -5
  53. package/dist/tempo/client/Charge.d.ts +8 -2
  54. package/dist/tempo/client/Charge.js +19 -11
  55. package/dist/tempo/client/Subscription.js +6 -2
  56. package/dist/tempo/internal/fee-payer.d.ts +2 -0
  57. package/dist/tempo/internal/fee-payer.js +4 -0
  58. package/dist/tempo/server/Subscription.js +1 -0
  59. package/dist/tempo/server/internal/html.gen.d.ts +1 -1
  60. package/dist/tempo/server/internal/html.gen.js +1 -1
  61. package/dist/tempo/session/client/CredentialState.d.ts +2 -0
  62. package/dist/tempo/session/client/CredentialState.js +9 -3
  63. package/dist/tempo/session/client/Session.d.ts +6 -0
  64. package/dist/tempo/session/client/Session.js +4 -1
  65. package/dist/tempo/session/client/SessionManager.d.ts +11 -0
  66. package/dist/tempo/session/client/SessionManager.js +23 -2
  67. package/dist/tempo/session/precompile/Chain.js +3 -0
  68. package/dist/tempo/subscription/KeyAuthorization.d.ts +7 -1
  69. package/dist/tempo/subscription/KeyAuthorization.js +21 -3
  70. package/dist/validation/core.d.ts +1 -0
  71. package/dist/validation/core.js +7 -2
  72. package/dist/viem/Client.d.ts +4 -0
  73. package/dist/viem/Client.js +13 -0
  74. package/dist/x402/client/Exact.d.ts +2 -2
  75. package/dist/x402/client/Exact.js +1 -1
  76. package/dist/x402/server/EvmCharge.d.ts +2 -0
  77. package/dist/x402/server/EvmCharge.js +34 -26
  78. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # mppx
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c0ce0fe: Enforced recipient allowlists for both primary and split recipients, including zero-amount proofs.
8
+
9
+ Migration: include the primary recipient address as well as every split recipient in `expectedRecipients`. Configurations containing only split recipients are now rejected.
10
+
11
+ ### Patch Changes
12
+
13
+ - 3c14a65: Enforced charge and session chain policies and rejected clients on conflicting payment chains. Preserved configured payment methods, challenge preferences, session retries, incremental SSE output, and follow-up vouchers in the CLI. Updated validation to use configured methods and advertised payment metadata, avoid unrelated wallet preflights, and settle session attempts after responses or transport failures.
14
+ - eda059a: Added a non-blocking `suggested` validation category and used it for missing, empty, or non-text `/llms.txt` documentation.
15
+ - d71ad79: Added request-aware payment preparation with safe redirect handling and pinned credential delivery.
16
+
17
+ ## 0.9.3
18
+
19
+ ### Patch Changes
20
+
21
+ - 43ec92c: Bound subscription key authorizations to their server-issued payment challenge.
22
+ - 175d709: Allowed EVM and x402 payments to be prepared without an account and signed using an account supplied during credential creation.
23
+ - 5932b08: Added non-mutating EVM credential validation with facilitator checks and revalidation before settlement through the existing broadcast lifecycle.
24
+ - 1fd8746: Expanded Tempo session close rollback and expiring-nonce transaction coverage.
25
+ - 459b517: Added challenge context to payment-success hooks, standardized Stripe PaymentIntent analytics
26
+ metadata, and added a shared SDK version identifier.
27
+ - 203bad2: Added typed multi-offer composition for MCP SDK and JSON-RPC transports while preserving selected-payment dispatch and receipt metadata.
28
+ - a5451d0: Updated `fast-uri` and `qs` to patched versions, resolving their latest security advisories.
29
+ - a802ce9: Added method-agnostic CLI payment extensions that can enforce policy or prepare funds before credential creation.
30
+ - baa0fd5: Added a fee-payer policy option to reject sponsored key authorizations while allowing them by default.
31
+ - f494ffd: Added request-scoped PaymentIntent option resolvers that run before terminal Stripe payments.
32
+ - 7949db6: Fixed server-side session transactions to use expiring nonces across independent processes.
33
+ - 26f9840: Removed the Stripe SPT runtime dependency on viem.
34
+
3
35
  ## 0.9.2
4
36
 
5
37
  ### Patch Changes
package/README.md CHANGED
@@ -138,6 +138,25 @@ that do not support custom escrows should leave it unset. See the
138
138
  Pass `mpp` or `x402` to require one protocol. x402 payments use the same EVM account as EVM
139
139
  charges, so `MPPX_PRIVATE_KEY` or a stored account works for both.
140
140
 
141
+ Payment extensions can enforce policy or prepare funds after challenge selection and confirmation,
142
+ immediately before credential creation:
143
+
144
+ ```ts
145
+ import { defineConfig, Extension } from 'mppx/cli'
146
+
147
+ export default defineConfig({
148
+ extensions: [
149
+ Extension.from({
150
+ async preparePayment({ challenge }) {
151
+ await prepareFunds(challenge)
152
+ },
153
+ }),
154
+ ],
155
+ })
156
+ ```
157
+
158
+ Extensions run in configuration order. Throwing rejects the payment before Mppx signs it.
159
+
141
160
  You can also install globally to use the `mppx` CLI from anywhere:
142
161
 
143
162
  ```bash
package/dist/Method.d.ts CHANGED
@@ -185,6 +185,8 @@ export type CanOfferFn<method extends Method> = (parameters: {
185
185
  * like recording the payment in an external system.
186
186
  */
187
187
  export type OnPaymentSuccessFn<method extends Method> = (parameters: {
188
+ /** Challenge associated with the successful payment. */
189
+ challenge?: DeepReadonly<Challenge.Challenge<z.output<method['schema']['request']>, method['intent'], method['name']>> | undefined;
188
190
  input?: globalThis.Request;
189
191
  receipt: DeepReadonly<Receipt.Receipt>;
190
192
  /** Canonical payment request included in the challenge. */
@@ -0,0 +1,20 @@
1
+ import type * as Challenge from '../Challenge.js';
2
+ /** Context supplied before the CLI creates a payment credential. */
3
+ export type Context = Readonly<{
4
+ challenge: Challenge.Challenge;
5
+ /** Method-specific context that will be supplied to credential creation. */
6
+ credentialContext?: unknown;
7
+ }>;
8
+ /** Result of preparing a selected payment. */
9
+ export type Result = Readonly<{
10
+ /** Replaces the method-specific context supplied to credential creation. */
11
+ credentialContext?: unknown;
12
+ }>;
13
+ /** Method-agnostic CLI lifecycle hooks. */
14
+ export type Extension = Readonly<{
15
+ /** Runs after challenge selection and confirmation, immediately before credential creation. */
16
+ preparePayment?(context: Context): Result | void | Promise<Result | void>;
17
+ }>;
18
+ /** Defines an Mppx CLI extension. */
19
+ export declare function from(extension: Extension): Extension;
20
+ //# sourceMappingURL=Extension.d.ts.map
@@ -0,0 +1,5 @@
1
+ /** Defines an Mppx CLI extension. */
2
+ export function from(extension) {
3
+ return extension;
4
+ }
5
+ //# sourceMappingURL=Extension.js.map