@haven_ai/sdk 0.0.0-dev.202610231728.63dccc8 → 0.0.0-dev.202610240100.6d87ddf

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
@@ -273,7 +273,7 @@ const response = await haven.payX402Quote(quote)
273
273
  const data = await response.json()
274
274
  ```
275
275
 
276
- Merchant-verified x402 retries use the official EIP-3009 `exact` scheme on Base USDC (`base` / `eip155:8453`). `haven.fetch()` sends the payment under `PAYMENT-SIGNATURE` (the x402 v2 name), and on the EIP-3009 bridge also under `X-PAYMENT` (v1), so a merchant on either version reads it. **On erc7710 it sends the v2 name ALONE**: that payload is always x402 v2, and its header carries a whole delegation chain, so duplicating it overflows the merchant's header limit and the request is refused with HTTP 431. If you build the retry yourself, follow the same rule. Haven's older tx-hash proof helper remains exported for Haven-native integrations; it is a different payload that happens to have shared the v2 name, and it is not what `haven.fetch()` sends.
276
+ Merchant-verified x402 retries use the x402 `exact` scheme on Base USDC (`base` / `eip155:8453`, or Base Sepolia `eip155:84532`): the EIP-3009 `authorization` payload on the bridge, or a delegation when the merchant's entry carries `extra.assetTransferMethod: 'erc7710'`. `haven.fetch()` sends the payment under `PAYMENT-SIGNATURE` (the x402 v2 name), and on the EIP-3009 bridge also under `X-PAYMENT` (v1), so a merchant on either version reads it. **On erc7710 it sends the v2 name ALONE**: that payload is always x402 v2, and its header carries a whole delegation chain, so duplicating it overflows the merchant's header limit and the request is refused with HTTP 431. If you build the retry yourself, follow the same rule: `x402RetryHeadersFor(paymentHeader)` returns exactly those headers (#3727). Haven's older tx-hash proof helper remains exported for Haven-native integrations; it is a different payload that happens to have shared the v2 name, and it is not what `haven.fetch()` sends.
277
277
 
278
278
  For standard x402, the `x402-wallet` identity is the agent delegate wallet, because that is the wallet that signs and settles the merchant payment. Integrations that scope access by Haven wallet address should use a Haven-native flow instead of standard merchant x402.
279
279
 
@@ -428,6 +428,8 @@ x402 tool-window failures:
428
428
  | `rejected` | The payment was rejected and cannot proceed. | yes |
429
429
  | `expired` | Payment expired before completion. | yes |
430
430
  | `failed` | Haven could not complete the payment. | yes |
431
+ | `insufficient_funds` | Carried by the `delegation_budget_exceeded` refusal — `403` at prepare, or `502` when the budget ran out by the time the payment was signed — with `nextAction: fund_account_or_raise_allowance`. The budget must be raised, or the period reset, before a new payment can succeed. | yes |
432
+ | `funded_but_unsettled` | The EIP-3009 bridge's funding leg confirmed, but the merchant leg has not settled: either the merchant rejected the retry (`nextAction: sweep_stranded_funds`) or no merchant response was ever recorded (`nextAction: retry_original_x402_request`). Follow `nextAction`. | no |
431
433
  | `delivered_unverified` | **#3420: terminal.** The merchant delivered, but the settlement window and the sweep's last attribution chance have both passed with no verified on-chain evidence. Polling cannot change this; the only remedy is reporting a real settlement hash (`haven_report_settlement_evidence`). | yes |
432
434
 
433
435
  The merchant settlement leg of x402 (and the MPP retry) is the agent's own request to the merchant — it does not have a Haven `phase`. The payment is `funding_sent` until the agent retries with the payment header (`PAYMENT-SIGNATURE`, plus `X-PAYMENT` on this bridged path) (x402) or the MPP proof header; from Haven's perspective the payment becomes `executed` only after the agent successfully resumes.
@@ -445,6 +447,8 @@ The merchant settlement leg of x402 (and the MPP retry) is the agent's own reque
445
447
  | `retry_original_x402_request` | Haven's funding leg confirmed but no merchant response was ever recorded — most often because the process crashed between the funding confirmation and the merchant retry (a 15-minute grace window applies before this fires; a client-reported merchant rejection instead yields `sweep_stranded_funds`). Call `resumeX402Payment()` with the preserved `resumeState`, or rehydrate it first with `getResumeState(payment_id)`. Do not start a new payment for the same purchase. |
446
448
  | `stop_and_tell_user` | Stop retrying and tell the user what happened — the payment failed, was rejected, or (#3420) was delivered but its settlement can no longer be verified. |
447
449
  | `request_again_if_user_still_wants_it` | The request expired; ask again only if the user still wants the payment. |
450
+ | `retry_with_explicit_context` | #1307: retry the same tool call, passing `merchant_url`, `tool_name`, `arguments` and `mcp_transport` explicitly — the server had no stored context to rehydrate for this payment id. |
451
+ | `fund_account_or_raise_allowance` | Stop and tell the user the agent's budget must be raised (or its period reset) before a new payment can succeed; it rides on the `delegation_budget_exceeded` refusal. An approval will not fix it. |
448
452
  | `payment_window_expired` | The x402 funding/quote window expired. Re-quote the same paid MCP tool call with the same `idempotency_key`, then sign the fresh `payload_hash`. |
449
453
  | `sweep_stranded_funds` | A funding leg succeeded but the merchant/protocol leg did not settle. Stop retrying and use `haven_sweep_delegate` to recover stranded delegate funds. |
450
454
 
@@ -471,8 +475,10 @@ queue**: the queue-and-approve path belonged to the retired Safe rail, which now
471
475
  answers HTTP 410 at every agent-payment entry point.
472
476
 
473
477
  If an agent requests a payment outside that policy, Haven **declines it before
474
- any money moves** — during prepare, before anything is written and before the
475
- agent is asked to sign. `POST /payments` answers `403` when no active delegation
478
+ any money moves** — during prepare, before any payment intent is created and
479
+ before the agent is asked to sign. The one row written is the refusal itself,
480
+ in the `payment_refusals` ledger (#2945, migration 086; written through the
481
+ `refuse()` choke point since #3053). `POST /payments` answers `403` when no active delegation
476
482
  authorizes that token and recipient, `403 delegation_budget_exceeded` when the
477
483
  remaining period budget cannot cover the amount (#3503; the x402 authorize path
478
484
  answers the same), and `502` when the on-chain caveat check rejects a
@@ -609,7 +615,9 @@ For MCP/SSE x402 tools, keep the same MCP session and JSON-RPC payload where the
609
615
  merchant requires it: initialize, retain `mcp-session-id`, send the original
610
616
  `tools/call`, parse the 402 challenge, wait for the funding leg to confirm if
611
617
  the payment is bridged, then resume with the same `payment_id` and retry the
612
- original `tools/call`, setting BOTH `PAYMENT-SIGNATURE` (x402 v2) and `X-PAYMENT` (v1) to the header. Use a stable `idempotencyKey` for the
618
+ original `tools/call` with the headers `x402RetryHeadersFor(paymentHeader)`
619
+ returns — `PAYMENT-SIGNATURE` (x402 v2), plus `X-PAYMENT` (v1) only on the
620
+ EIP-3009 bridge; erc7710 sends the v2 name alone. Use a stable `idempotencyKey` for the
613
621
  user intent so fresh merchant quotes or sessions do not become duplicate Haven
614
622
  payments.
615
623
 
@@ -200,7 +200,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
200
200
  * This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
201
201
  * it with the package version on every release — never hand-edit it.
202
202
  */
203
- declare const SDK_VERSION = "0.0.0-dev.202610231728.63dccc8";
203
+ declare const SDK_VERSION = "0.0.0-dev.202610240100.6d87ddf";
204
204
  /** The request header every published Haven client sends. */
205
205
  declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
206
206
  /** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
@@ -200,7 +200,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
200
200
  * This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
201
201
  * it with the package version on every release — never hand-edit it.
202
202
  */
203
- declare const SDK_VERSION = "0.0.0-dev.202610231728.63dccc8";
203
+ declare const SDK_VERSION = "0.0.0-dev.202610240100.6d87ddf";
204
204
  /** The request header every published Haven client sends. */
205
205
  declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
206
206
  /** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
@@ -782,7 +782,7 @@ function stableStringify2(value) {
782
782
  }
783
783
 
784
784
  // src/client-identity.ts
785
- var SDK_VERSION = "0.0.0-dev.202610231728.63dccc8";
785
+ var SDK_VERSION = "0.0.0-dev.202610240100.6d87ddf";
786
786
  var HAVEN_CLIENT_HEADER = "X-Haven-Client";
787
787
  function havenClientIdentity(pkg, version) {
788
788
  return `${pkg}/${version}`;
@@ -1477,5 +1477,5 @@ exports.x402PaymentHeaderNamesFor = x402PaymentHeaderNamesFor;
1477
1477
  exports.x402PaymentHeaderNamesSent = x402PaymentHeaderNamesSent;
1478
1478
  exports.x402RetryHeadersFor = x402RetryHeadersFor;
1479
1479
  exports.x402V2PaymentEnvelope = x402V2PaymentEnvelope;
1480
- //# sourceMappingURL=chunk-OBZQNRY6.cjs.map
1481
- //# sourceMappingURL=chunk-OBZQNRY6.cjs.map
1480
+ //# sourceMappingURL=chunk-2C5XPH4C.cjs.map
1481
+ //# sourceMappingURL=chunk-2C5XPH4C.cjs.map