mppx 0.10.1 → 0.12.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 (56) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +22 -1
  3. package/dist/cli/agent.d.ts +3 -0
  4. package/dist/cli/agent.js +20 -0
  5. package/dist/cli/cli.d.ts +1 -1
  6. package/dist/cli/cli.js +135 -135
  7. package/dist/cli/plugins/index.js +12 -12
  8. package/dist/cli/validate/payment.js +29 -12
  9. package/dist/client/internal/protocols/X402.js +0 -2
  10. package/dist/evm/server/Methods.d.ts +164 -3
  11. package/dist/evm/server/Methods.js +50 -2
  12. package/dist/internal/version.d.ts +2 -2
  13. package/dist/internal/version.js +1 -1
  14. package/dist/server/Mppx.d.ts +5 -1
  15. package/dist/server/Mppx.js +120 -49
  16. package/dist/server/internal/html/compose.main.gen.d.ts +1 -1
  17. package/dist/server/internal/html/serviceWorker.gen.d.ts +1 -1
  18. package/dist/stripe/server/Methods.js +13 -7
  19. package/dist/stripe/server/internal/analytics.d.ts +1 -0
  20. package/dist/stripe/server/internal/analytics.js +2 -2
  21. package/dist/stripe/server/internal/html.gen.d.ts +1 -1
  22. package/dist/stripe/server/internal/record-payment.js +2 -2
  23. package/dist/tempo/Methods.d.ts +5 -3
  24. package/dist/tempo/Methods.js +6 -5
  25. package/dist/tempo/client/Charge.d.ts +6 -4
  26. package/dist/tempo/client/Charge.js +61 -28
  27. package/dist/tempo/client/Methods.d.ts +5 -3
  28. package/dist/tempo/index.d.ts +2 -1
  29. package/dist/tempo/index.js +2 -1
  30. package/dist/tempo/internal/currencies.d.ts +19 -0
  31. package/dist/tempo/internal/currencies.js +41 -0
  32. package/dist/tempo/internal/defaults.d.ts +16 -3
  33. package/dist/tempo/internal/defaults.js +17 -2
  34. package/dist/tempo/internal/fee-payer.d.ts +5 -4
  35. package/dist/tempo/internal/fee-payer.js +7 -5
  36. package/dist/tempo/internal/machine-token-charge.d.ts +56 -0
  37. package/dist/tempo/internal/machine-token-charge.js +108 -0
  38. package/dist/tempo/server/Charge.d.ts +15 -1
  39. package/dist/tempo/server/Charge.js +101 -67
  40. package/dist/tempo/server/Methods.d.ts +5008 -40
  41. package/dist/tempo/server/Methods.js +105 -11
  42. package/dist/tempo/server/internal/html.gen.d.ts +1 -1
  43. package/dist/tempo/server/internal/html.gen.js +1 -1
  44. package/dist/tempo/session/server/ChannelStore.d.ts +2 -0
  45. package/dist/tempo/session/server/ChannelStore.js +12 -3
  46. package/dist/tempo/session/server/CredentialVerification.d.ts +2 -0
  47. package/dist/tempo/session/server/CredentialVerification.js +22 -13
  48. package/dist/tempo/session/server/RequestState.d.ts +6 -0
  49. package/dist/tempo/session/server/RequestState.js +11 -4
  50. package/dist/tempo/session/server/Session.js +8 -1
  51. package/dist/tempo/session/server/Settlement.d.ts +2 -0
  52. package/dist/tempo/session/server/Settlement.js +13 -8
  53. package/dist/tempo/subscription/KeyAuthorization.d.ts +70 -8
  54. package/package.json +3 -3
  55. package/dist/tempo/Tokens.d.ts +0 -13
  56. package/dist/tempo/Tokens.js +0 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # mppx
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e4f0e02: Added ordered `currencies` configuration to the Tempo and EVM server factories, with OUSD followed by USDC.e on Tempo mainnet and OUSD followed by pathUSD on Moderato. Added chain-aware viem token-set support and deprecated the factories' singular `currency` option. Explicit currency configuration continued to restrict acceptance to that currency.
8
+
9
+ Changed `tempo.charge()`, `tempo.session()`, and `tempo.subscription()` to return ordered method groups. Existing `methods: [tempo.charge(options)]` configuration remained supported. Code inspecting a single method directly must now destructure the returned group; explicit composition should use configured handlers such as `mppx.tempo.charge`. Wire Challenges and per-handler currency overrides remained singular.
10
+
11
+ Preserved offer selection, callbacks, and error responses through nested composition. Preserved proof replay policy without a configured store and honored explicit charge chain IDs. Shared session storage and settlement dispatch across accepted currencies, applied settlement thresholds using each channel's currency, and initialized session extensions without mutating previously created methods. Preserved each existing subscription's authorized currency during reuse and renewal, and defaulted new subscription offers to mainnet, with `testnet: true` selecting Moderato.
12
+
13
+ Reduced package size by removing duplicated HTML bundle literals from generated type declarations.
14
+
15
+ Pinned workspace viem dependencies to the public `2.57.1` release and required `viem >=2.57.1` as a peer dependency.
16
+
17
+ ### Patch Changes
18
+
19
+ - 1d08567: Added AI agent attribution to the CLI User-Agent header when a recognized environment signal is present.
20
+ - 869885e: Added `allowedFeeTokens` for sponsored Tempo charges. Preserved local token defaults and allowed hosted sponsors to choose their fee token unless explicitly restricted.
21
+ - 3a23894: Fixed implicit and explicit composition to preserve each configured method's identity, currency defaults, and offer order. Resolved standalone credentials against configured request bindings, rejected ambiguous method matches, and limited per-method payment success hooks to the selected method.
22
+ - dcf1589: Fixed CLI agent attribution test isolation across agent environments.
23
+ - 75cb219: Fixed hosted fee sponsorship for credential-triggered Tempo session settlement and close.
24
+ - fe2e66e: Fixed split-charge verification to reject payment transfers with attribution memos bound to conflicting challenges or realms.
25
+ - 8d2fb06: Fixed Tempo session content requests to require a voucher advance before charging, preventing an accepted cumulative voucher from authorizing multiple responses while preserving idempotent management updates.
26
+ - 8829293: Allowed `hostedFeePayer: true` in Stripe test mode by applying hosted fee sponsorship only in live mode.
27
+ - 8405b23: Fixed Stripe sandbox sessions to use Tempo testnet.
28
+ - 7159693: Fixed testnet validation of streaming Tempo sessions.
29
+ - 420b99b: Added automatic testnet faucet funding for session operators in `mppx validate`.
30
+
31
+ ## 0.11.0
32
+
33
+ ### Minor Changes
34
+
35
+ - 1851f0f: Removed custom Tempo charge memos and required challenge-bound attribution memos during direct verification. Remove `memo` from charge options; clients generate attribution memos automatically. Split transfer memos remain supported.
36
+
37
+ ### Patch Changes
38
+
39
+ - ba6f7a2: Added opt-in MACH funding through global Tempo `machineTokenEnabled` configuration, currently applied to charges using canonical swapper routes and supported stablecoin fee tokens.
40
+ - 4dc37a8: Removed the x402 client requirement that resource URLs match response URLs.
41
+ - 83cef8f: Fixed Stripe crypto PaymentIntent amounts rounding up and failing transaction verification for fractional-cent payments.
42
+ - a0a7d5b: Added automatic Stripe PaymentIntent recording for Tempo session settlements, using each transaction's newly settled amount rounded down to whole cents and recording the session intent in analytics metadata. Preserved optional settlement callbacks after recording; applications no longer need to create PaymentIntents in those callbacks.
43
+
3
44
  ## 0.10.1
4
45
 
5
46
  ### Patch Changes
package/README.md CHANGED
@@ -51,7 +51,6 @@ import { Mppx, tempo } from 'mppx/server'
51
51
  const mppx = Mppx.create({
52
52
  methods: [
53
53
  tempo({
54
- currency: '0x20c0000000000000000000000000000000000000',
55
54
  recipient: '0x742d35Cc6634c0532925a3b844bC9e7595F8fE00',
56
55
  }),
57
56
  ],
@@ -226,3 +225,25 @@ Built on the ["Payment" HTTP Authentication Scheme](https://datatracker.ietf.org
226
225
  ## License
227
226
 
228
227
  MIT
228
+
229
+ ### Accepted Tempo currencies
230
+
231
+ `tempo()`, `tempo.charge()`, `tempo.session()`, and `tempo.subscription()` offer OUSD first, followed by USDC.e on mainnet or pathUSD on Moderato (`testnet: true`). Each factory returns a group accepted directly by `Mppx.create`. Clients choose one offer; ordering does not trigger an automatic swap.
232
+
233
+ ```ts
234
+ import { Mppx, tempo } from 'mppx/server'
235
+ import { ousd, usdce } from 'viem/tokens'
236
+
237
+ const mppx = Mppx.create({
238
+ methods: [
239
+ tempo.charge({
240
+ currencies: [ousd, usdce],
241
+ recipient: '0x742d35Cc6634c0532925a3b844bC9e7595F8fE00',
242
+ }),
243
+ ],
244
+ })
245
+ ```
246
+
247
+ Omit `currencies` for the network defaults, or use `currencies: [ousd]` to accept only OUSD on mainnet. Explicit lists replace the defaults. The deprecated `currency` option also restricts acceptance to one token. Wire requests and handler overrides continue to use singular `currency`.
248
+
249
+ Use configured handlers such as `mppx.tempo.charge` when composing payments. Code that directly inspects a Method can destructure the group: `const [charge] = tempo.charge({ currencies: [ousd] })`. Existing sessions and subscriptions continue using their originally authorized currency.
@@ -0,0 +1,3 @@
1
+ /** Returns the first recognized AI agent in signal priority order. */
2
+ export declare function detectAgent(env?: NodeJS.ProcessEnv): string | undefined;
3
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1,20 @@
1
+ const agentSignals = [
2
+ ['ANTIGRAVITY_CLI_ALIAS', 'antigravity'],
3
+ ['CLAUDECODE', 'claude_code'],
4
+ ['CLINE_ACTIVE', 'cline'],
5
+ ['CODEX_SANDBOX', 'codex_cli'],
6
+ ['CODEX_THREAD_ID', 'codex_cli'],
7
+ ['CODEX_SANDBOX_NETWORK_DISABLED', 'codex_cli'],
8
+ ['CODEX_CI', 'codex_cli'],
9
+ ['CURSOR_AGENT', 'cursor'],
10
+ ['GEMINI_CLI', 'gemini_cli'],
11
+ ['OPENCODE', 'open_code'],
12
+ ['OPENCLAW_SHELL', 'openclaw'],
13
+ ['CLAUDE_CODE_ENTRYPOINT', 'claude_code'],
14
+ ['CODEX_INTERNAL_ORIGINATOR_OVERRIDE', 'codex_cli'],
15
+ ];
16
+ /** Returns the first recognized AI agent in signal priority order. */
17
+ export function detectAgent(env = process.env) {
18
+ return agentSignals.find(([variable]) => env[variable])?.[1];
19
+ }
20
+ //# sourceMappingURL=agent.js.map
package/dist/cli/cli.d.ts CHANGED
@@ -26,7 +26,7 @@ declare const cli: Cli.Cli<{
26
26
  session: string;
27
27
  silent: boolean;
28
28
  slippage?: number | undefined;
29
- userAgent: string;
29
+ userAgent?: string | undefined;
30
30
  verbose: number;
31
31
  };
32
32
  };