@haven_ai/sdk 0.1.22-alpha.0 → 0.1.23-alpha.1

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 CHANGED
@@ -183,7 +183,6 @@ for (const block of response.content) {
183
183
  | `get_allowances` | Read configured and on-chain allowance state, including spent and remaining allowance |
184
184
  | `authorize_x402_payment` | Authorize a policy-limited x402 payment and return a payment header for an HTTP 402 resource |
185
185
  | `resume_x402_payment` | Resume an approved x402 payment and return a merchant payment header without creating a duplicate approval |
186
- | `authorize_machine_payment` | Authorize an internal Haven MPP demo challenge and return proof details |
187
186
 
188
187
  Use `get_allowances` for allowance, budget, spend-limit, remaining amount, reset-period, or "what can I spend?" questions. Payment tools still require the agent-held delegate key and on-chain Safe allowance state; the Haven API key identifies the agent but does not authorize spending by itself.
189
188
 
@@ -209,10 +208,13 @@ The backend serves an OpenAPI 3.1 contract at:
209
208
  - Local development: `http://localhost:3001/openapi.json`
210
209
 
211
210
  The spec covers the agent-facing payment surface: agents, direct payments,
212
- payment status, x402 authorization, MPP demo authorization, resume-state
213
- rehydration, machine-payment receipts, and transactions. Its security scheme is
214
- deliberate: the Haven API key identifies the agent, but payment authority still
215
- requires an agent-held delegate signature and on-chain Safe allowance state.
211
+ payment status, x402 authorization, resume-state rehydration, machine-payment
212
+ receipts, and transactions. `POST /machine-payments/authorize` (the legacy
213
+ internal MPP demo challenge flow) is retired it now refuses unconditionally
214
+ with HTTP 410; use the x402 flow for agent-to-merchant payments. Its security
215
+ scheme is deliberate: the Haven API key identifies the agent, but payment
216
+ authority still requires an agent-held delegate signature and on-chain Safe
217
+ allowance state.
216
218
 
217
219
  ## Agent payment state machine
218
220
 
@@ -220,7 +222,7 @@ Every payment or approval state returned by Haven includes:
220
222
 
221
223
  - `phase`: where the Haven-side payment currently is.
222
224
  - `nextAction`: the stable action an agent should take next.
223
- - `rail`: which payment rail produced the state. Categorical values (`direct`, `x402`, `mpp`) appear on resume-state discriminators; granular values (`mpp_demo`, `mpp_crypto`, `stripe_deposit`, `spt`) appear on response bodies.
225
+ - `rail`: which payment rail produced the state. Categorical values (`direct`, `x402`, `mpp`) appear on resume-state discriminators; granular values (`mpp_demo`, `mpp_crypto`, `stripe_deposit`, `spt`) appear on response bodies. The `mpp` resume-state shape is a historical read only — the SDK no longer exposes a client method that acts on it (`mpp_demo` is retired, #1328).
224
226
  - `message`: human-readable guidance for the same state.
225
227
 
226
228
  The enum values and JSON Schema fragments are exported from `@haven_ai/sdk`:
@@ -323,7 +325,9 @@ Hosted MCP and signer tools also return stable `code` values on recoverable x402
323
325
 
324
326
  | `code` | Meaning | Agent recovery |
325
327
  |--------|---------|----------------|
326
- | `PRICE_EXCEEDS_MAX` | The merchant-authoritative x402 price is above the caller's `max_amount` cap. No funding transfer was created. | Tell the user the live price exceeded the cap and retry only after they confirm a higher `max_amount`. |
328
+ | `PRICE_EXCEEDS_MAX` | The merchant-authoritative x402 price is above the caller's spending cap. No funding transfer was created. | Tell the user the live price exceeded the cap and retry only after they confirm a higher one. |
329
+ | `AMBIGUOUS_MAX_AMOUNT` | Both `max_amount` (atomic units) and `max_amount_human` (whole tokens) were sent for one purchase. Nothing was contacted and nothing was spent. | Re-send with exactly one — `max_amount_human` for a cap the user stated in tokens, `max_amount` for an exact atomic figure. |
330
+ | `MAX_AMOUNT_UNCONVERTIBLE` | `max_amount_human` could not be converted against this quote's asset — its decimals are unknown to Haven, or the cap has more decimal places than the asset supports. Nothing was spent. | Round the cap to the asset's decimals, or re-send it as an exact atomic `max_amount`. |
327
331
  | `PAYMENT_WINDOW_EXPIRED` | The funding/quote window closed before `haven_x402_sign_header`, `haven_submit`, or `haven_complete_mcp_tool` could finish. | Re-run `haven_pay_mcp_tool` with the same `idempotency_key`, then sign and complete the fresh quote. Payloads include `retry_with_new_quote: true`. |
328
332
  | `MERCHANT_REJECTED_AFTER_FUNDING` | Haven's funding leg succeeded, but the merchant rejected the paid retry. | Stop retrying the merchant and call `haven_sweep_delegate` so the user can recover stranded delegate USDC. |
329
333