Skip to content

feat: pay Responses WebSocket through Tempo MPP#2

Open
gakonst wants to merge 10 commits into
masterfrom
feat/mpp-integration
Open

feat: pay Responses WebSocket through Tempo MPP#2
gakonst wants to merge 10 commits into
masterfrom
feat/mpp-integration

Conversation

@gakonst

@gakonst gakonst commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep MPP entirely in bin/nanocodex as a CLI-owned loopback WebSocket middleware; no Nanocodex library crate imports MPP, Alloy, Tempo wallet, or SQLite code
  • expose direct OpenAI as the default and explicit --provider.openai, plus paid OpenAI-over-Tempo through --provider.tempo and --provider.tempo.* overrides
  • load the active Tempo Wallet account and Accounts SDK P-256 access key from ~/.tempo/wallet/store.json; there is no raw-private-key flag or new signer trait
  • share ~/.tempo/wallet/channels.db with MPPx and Wallet CLI, bootstrap server session state, reconcile TIP-1034 on-chain state, and continue cumulative vouchers from a cold client
  • use alloy-transport-mpp for the HTTP payment probe, WebSocket authorization, in-band voucher requests, application frames, top-ups, and close-ready flow
  • apply the same provider configuration and cooperative adapter shutdown to one-shot runs and the TUI
  • default to Tempo mainnet and wss://openai.mpp.tempo.xyz/v1/responses

The provider namespace is CLI configuration only. Nanocodex still supports the OpenAI Responses WebSocket model family and the core/service crates remain unchanged.

TIP-1034 and MPPx parity

The CLI pins merged mpp-rs main at 0c509633f9ebc97861ed89d85dbe62798b9bb981. That stack follows current MPPx behavior for:

  • channel scope identity: payee, token, escrow, and chain
  • explicit escrow override, challenge escrowContract/escrow hints, then the canonical native precompile fallback
  • Tempo mainnet as the omitted-chain default
  • native TIP-1034 open/top-up transactions and cumulative TIP-1020 vouchers
  • unique sponsored repeat top-ups through a randomized past validAfter
  • authenticated durable session bootstrap and signed highest-voucher rehydration

Upstream dependencies

  • tempoxyz/mpp-rs #316-#326 are merged, including WebSocket transport, proof binding, stores and rehydration, wallet access keys, lifecycle/top-up handling, MPPx bootstrap parity, the generic service client, and TIP-1034 parity
  • tempoxyz/mpp-proxy #245 is merged and deployed
  • wevm/mppx #675-#677 are merged
  • wevm/mppx #688 is green and awaiting review; it applies the same pre-WebSocket top-up behavior to the TypeScript client

Validation

  • cargo test -p nanocodex-bin --all-targets: 120 passed
  • cargo clippy -p nanocodex-bin --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • all ten commits on the rebased branch have GitHub-verified SSH signatures

Live mainnet result

The final compiled one-shot CLI loaded the existing Tempo Wallet access key and shared SQLite session, selected gpt-5.6-sol, connected through the local MPP middleware to the hosted OpenAI Responses WebSocket, and returned exactly tip1034-final-ok.

It reused TIP-1034 channel 0xdca07bd5d0808c10e8253a17c8c67192939cfd7045cfe8bf6ed17e63b1754d9b. The persisted cumulative voucher advanced from 650,791 to 728,735 atomic units, so this run paid exactly 77,944 atomic units ($0.077944). The response completed with 8,006 input tokens, 9 output tokens, one connection attempt, zero WebSocket reconnects, and zero response retries.

@gakonst
gakonst force-pushed the feat/mpp-integration branch from cab7f02 to 80b239a Compare July 21, 2026 00:03
@gakonst gakonst changed the title feat: pay for Responses WebSocket with MPP feat: pay Responses WebSocket through Tempo MPP Jul 21, 2026
@gakonst
gakonst marked this pull request as ready for review July 21, 2026 00:04
@gakonst
gakonst force-pushed the feat/mpp-integration branch 4 times, most recently from 33f9688 to c560362 Compare July 22, 2026 03:48
@gakonst
gakonst force-pushed the feat/mpp-integration branch from 1df1725 to 6f7c22b Compare July 22, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant