mppx 0.15.0 → 0.16.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 (90) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cli/cli.js +137 -131
  3. package/dist/cli/plugins/index.js +11 -11
  4. package/dist/cli/validate/payment.d.ts +12 -0
  5. package/dist/cli/validate/payment.js +113 -14
  6. package/dist/client/Mppx.d.ts +13 -3
  7. package/dist/client/Mppx.js +47 -22
  8. package/dist/client/internal/Fetch.d.ts +11 -0
  9. package/dist/client/internal/Fetch.js +46 -8
  10. package/dist/client/internal/ProofRealm.d.ts +21 -0
  11. package/dist/client/internal/ProofRealm.js +55 -0
  12. package/dist/{attestation → extensions/identity}/Constants.d.ts +2 -2
  13. package/dist/{attestation → extensions/identity}/Constants.js +2 -2
  14. package/dist/extensions/identity/Types.d.ts +21 -0
  15. package/dist/extensions/identity/index.d.ts +7 -0
  16. package/dist/extensions/identity/index.js +6 -0
  17. package/dist/{attestation → extensions/identity}/internal/HttpMessageSignature.d.ts +3 -3
  18. package/dist/{attestation → extensions/identity}/internal/HttpMessageSignature.js +10 -10
  19. package/dist/extensions/identity/internal/SigningContext.d.ts +6 -0
  20. package/dist/{attestation → extensions/identity}/internal/SigningContext.js +3 -3
  21. package/dist/extensions/identity/internal/Verification.d.ts +9 -0
  22. package/dist/extensions/identity/internal/Verification.js +10 -0
  23. package/dist/{tap → extensions/identity/tap}/Constants.js +1 -1
  24. package/dist/extensions/identity/tap/client/index.d.ts +32 -0
  25. package/dist/{tap → extensions/identity/tap}/client/index.js +13 -9
  26. package/dist/extensions/identity/tap/server/index.d.ts +27 -0
  27. package/dist/{tap → extensions/identity/tap}/server/index.js +12 -4
  28. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Constants.js +1 -1
  29. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/client/index.d.ts +6 -5
  30. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/client/index.js +5 -5
  31. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/server/index.d.ts +6 -5
  32. package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/server/index.js +6 -4
  33. package/dist/identity/Client.d.ts +34 -0
  34. package/dist/identity/Client.js +133 -0
  35. package/dist/identity/Server.d.ts +46 -0
  36. package/dist/identity/Server.js +145 -0
  37. package/dist/identity/Types.d.ts +90 -0
  38. package/dist/identity/Types.js +2 -0
  39. package/dist/{attestation → identity}/index.d.ts +2 -2
  40. package/dist/{attestation → identity}/index.js +1 -2
  41. package/dist/identity/internal/SigningContext.d.ts +6 -0
  42. package/dist/identity/internal/SigningContext.js +11 -0
  43. package/dist/integrations/x402/Evm.d.ts +1 -0
  44. package/dist/internal/version.d.ts +2 -2
  45. package/dist/internal/version.js +1 -1
  46. package/dist/mcp/client/McpClient.d.ts +5 -0
  47. package/dist/mcp/client/McpClient.js +2 -0
  48. package/dist/proxy/Proxy.js +10 -5
  49. package/dist/proxy/Service.d.ts +42 -4
  50. package/dist/proxy/Service.js +21 -5
  51. package/dist/server/Mppx.d.ts +27 -8
  52. package/dist/server/Mppx.js +136 -51
  53. package/dist/stripe/server/internal/html.gen.js +1 -1
  54. package/dist/tempo/internal/charge.js +2 -1
  55. package/dist/tempo/internal/fee-payer.d.ts +0 -2
  56. package/dist/tempo/internal/fee-payer.js +0 -4
  57. package/dist/tempo/server/Subscription.js +0 -1
  58. package/dist/tempo/server/internal/html.gen.js +1 -1
  59. package/dist/tempo/session/client/Runtime.d.ts +2 -0
  60. package/dist/tempo/session/client/Session.js +1 -1
  61. package/dist/tempo/session/client/SessionManager.d.ts +6 -0
  62. package/dist/tempo/session/client/SessionManager.js +14 -7
  63. package/dist/tempo/session/client/Transports.d.ts +12 -3
  64. package/dist/tempo/session/client/Transports.js +37 -11
  65. package/dist/tempo/session/precompile/Chain.js +0 -3
  66. package/dist/tempo/subscription/Store.js +10 -9
  67. package/package.json +15 -11
  68. package/dist/attestation/Client.d.ts +0 -17
  69. package/dist/attestation/Client.js +0 -28
  70. package/dist/attestation/Server.d.ts +0 -4
  71. package/dist/attestation/Server.js +0 -8
  72. package/dist/attestation/Types.d.ts +0 -76
  73. package/dist/attestation/internal/SigningContext.d.ts +0 -4
  74. package/dist/tap/client/index.d.ts +0 -26
  75. package/dist/tap/server/index.d.ts +0 -20
  76. /package/dist/{attestation → extensions/identity}/Types.js +0 -0
  77. /package/dist/{tap → extensions/identity/tap}/Constants.d.ts +0 -0
  78. /package/dist/{tap → extensions/identity/tap}/Types.d.ts +0 -0
  79. /package/dist/{tap → extensions/identity/tap}/Types.js +0 -0
  80. /package/dist/{tap → extensions/identity/tap}/index.d.ts +0 -0
  81. /package/dist/{tap → extensions/identity/tap}/index.js +0 -0
  82. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Constants.d.ts +0 -0
  83. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Types.d.ts +0 -0
  84. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/Types.js +0 -0
  85. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/index.d.ts +0 -0
  86. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/index.js +0 -0
  87. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/JwkThumbprint.d.ts +0 -0
  88. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/JwkThumbprint.js +0 -0
  89. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/SignatureAgent.d.ts +0 -0
  90. /package/dist/{web-bot-auth → extensions/identity/web-bot-auth}/internal/SignatureAgent.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # mppx
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 793aa2b: Replaced request attestation with per-route identity. Breaking changes:
8
+
9
+ - `mppx/attestation` became `mppx/identity`. Server `Mppx.create({ attestation })` was removed (passing it now throws); routes take `identity: [verifier, ...]` (all required), for example `mppx.charge({ amount, identity: [tap] })`, and the result exposes `result.identity.get(verifier)`.
10
+ - Added `Identity.anyOf(...)` to accept one of several protocols. Every member runs, so each presented proof is consumed.
11
+ - Verifiers return `missing`, `invalid` or `valid` (`unverified` became `invalid` with code 403), may set their own status `code` and `headers`, and declare a `stage`: `request` (checked before any 402) or `payment` (adds headers to the 402 and is checked against the answered challenge and credential before settlement). Identity rejections are returned on the non-200 branch as a 401/403 response.
12
+ - A composed route can include at most one offer with payment-stage identity. Payment-stage identity is not supported on methods with a preflight hook.
13
+ - Client `attestation` signer maps became `identity: [prover, ...]`. Provers have a required origin `scope`, receive the payment challenge in `prove(request, context)`, and can prepare proofs or request one resend with `retry(response, context)`. Requests that carry proofs do not follow redirects.
14
+ - TAP and Web Bot Auth moved to `mppx/extensions/identity/tap` and `mppx/extensions/identity/web-bot-auth`; `Client.signer` became `Client.prover`.
15
+
16
+ ### Patch Changes
17
+
18
+ - e555544: Fixed client payment events masking original errors when a response body had already been consumed or locked.
19
+ - 81a95e1: Fixed multi-method intent handlers rejecting every route option but `identity` when the methods' options can't be inferred, such as `mppx.charge({ amount })` with `stripe.create(...).defaultMethods()`.
20
+ - c31d932: Added optional `summary` and `requestBody` to proxy endpoint definitions, emitted in the proxy's generated `/openapi.json`. Free routes can carry them as `{ free: true, summary, requestBody }`. An endpoint that is neither a payment handler, `true` nor `{ free: true }` (such as `{ pay: undefined }`) now fails closed with an error instead of being proxied.
21
+ - dd2c3e3: Refused to sign a zero-amount Tempo proof when the Challenge realm differs from the hostname of the server that sent it, so another origin can't relay a Challenge and replay the proof at its realm. To allow a server whose realm isn't its hostname, pin the realm to its origin with `trustedTempoProofRealms` on `Mppx.create` and `Fetch.from`, such as `{ 'https://api.example.com': 'MPP Payment' }`. Without an origin (`McpClient.wrap`, or `Mppx.create` with `Transport.mcp()`), these proofs are refused unless `trustedTempoProofRealms` lists the realm. The `mppx` CLI and `sessionManager` bootstrap apply the same check, and `sessionManager` takes `trustedTempoProofRealms` too. This matches mpp-rs, mpp-go and pympp.
22
+ - d78de2c: Fixed missing subscription access-key address indexes when reusing existing keys.
23
+ - 909f3db: Fixed Tempo session top-up, voucher retry, close and bootstrap requests to send the credential in the header the challenge selects (such as `Payment-Authorization` with `requiresAuth`) instead of always using `Authorization`. These requests keep the paid request's own `Authorization` header and no longer follow redirects, so the credential can't reach another origin.
24
+ - 464df9a: Fixed Tempo charge verification rejecting split amounts written with leading zeros by comparing them as integers.
25
+ - 9008513: Removed the `allowKeyAuthorization` fee-payer policy: sponsored transactions may now carry a `keyAuthorization`, so an access key can open a fee-sponsored session (or pay a sponsored charge) in the transaction that installs it. Sponsor exposure stays bounded by `maxGas` and `maxTotalFee`.
26
+ - 4cfd556: Fixed `mppx validate` failing Tempo session responses that stream over SSE: when the receipt arrives in the event stream instead of the `Payment-Receipt` header, validation checks the `payment-receipt` event in the stream instead of requiring the header, and fails when the stream has none.
27
+ - 510d1ed: Fixed `mppx validate` failing valid SSE sessions: the in-stream `payment-receipt` event is now read from the server's own stream, which the session client strips, and lone-CR line endings are accepted.
28
+ - e6d8ffc: Fixed `mppx validate` buffering SSE session streams in memory and hanging when the session client cancelled one: in-stream receipts are now read as the client consumes the stream instead of from an unread copy.
29
+ - 464df9a: Raised the zod dependency to ^4.6.7 to pick up the fix for GHSA-mrhx-c7xc-m3w5.
30
+
3
31
  ## 0.15.0
4
32
 
5
33
  ### Minor Changes