@haven_ai/sdk 0.0.0-dev.202609151059.9a6ee13 → 0.0.0-dev.202609151245.66966f3

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
@@ -363,6 +363,7 @@ Terminal from any non-confirmed phase:
363
363
  x402 tool-window failures:
364
364
  expired funding/quote window → PAYMENT_WINDOW_EXPIRED → re-quote with same idempotency_key
365
365
  merchant rejection after funding → MERCHANT_REJECTED_AFTER_FUNDING → haven_sweep_delegate (eip3009 only; erc7710: nothing to sweep, follow the message)
366
+ merchant timeout after funding → MERCHANT_UNRESPONSIVE_AFTER_FUNDING → check_status_later; eip3009: retry once, then haven_sweep_delegate; erc7710: no retry, check status after the window, re-quote only if unsettled
366
367
  ```
367
368
 
368
369
  ### `phase` reference
@@ -409,6 +410,7 @@ Hosted MCP and signer tools also return stable `code` values on recoverable x402
409
410
  | `MERCHANT_NOT_READY` | The merchant answered the quote probe with its own `503 { error: 'merchant_not_ready', reason_code, retry_after_s }` instead of a 402 — it cannot settle right now (e.g. its settlement wallet is out of gas). No payment was created. | Tell the user and retry later (`retry_after_s` in the message when given); do not treat it as a wrong endpoint. Payloads carry `next_action: stop_and_tell_user` and `retry_with_new_quote: true`. |
410
411
  | `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`. |
411
412
  | `MERCHANT_REJECTED_AFTER_FUNDING` | The merchant rejected the paid retry. On eip3009 Haven's funding leg had succeeded; on erc7710 there is no funding leg (#2983). | eip3009: stop retrying the merchant and call `haven_sweep_delegate` so the user can recover stranded delegate USDC. erc7710: nothing to sweep — follow the message (re-quote later if the merchant declined to settle; otherwise check `haven_get_payment_status` after the payment window before re-quoting). |
413
+ | `MERCHANT_UNRESPONSIVE_AFTER_FUNDING` | The merchant did not answer the paid retry before the timeout — NOT proof of rejection, the merchant may still settle late. On eip3009 Haven's funding leg had succeeded; on erc7710 there is no funding leg (#3000). | eip3009: check `haven_get_payment_status`, retry `haven_complete_mcp_tool` once, and only then call `haven_sweep_delegate` if no settlement appears. erc7710: nothing to sweep and `haven_complete_mcp_tool` has no erc7710 branch — do not retry it; check `haven_get_payment_status` after the payment window and re-quote only if it shows no settlement. |
412
414
 
413
415
  ## Payments outside the agent's budget
414
416
 
package/dist/index.cjs CHANGED
@@ -169,8 +169,9 @@ var AgentPaymentFailureCode = {
169
169
  MerchantRejectedAfterFunding: "MERCHANT_REJECTED_AFTER_FUNDING",
170
170
  /** #1300 review: funding is on-chain but the merchant never ANSWERED the
171
171
  * paid retry within the timeout. NOT proof of rejection — the merchant
172
- * holds a valid EIP-3009 authorization and may still settle late, so the
173
- * guidance is verify-then-sweep, never blind sweep. */
172
+ * may still settle late, so the guidance is verify-then-act. On eip3009
173
+ * the funding leg had succeeded (verify-then-sweep); on erc7710 there is
174
+ * no funding leg — nothing to sweep, follow the message (#3000). */
174
175
  MerchantUnresponsiveAfterFunding: "MERCHANT_UNRESPONSIVE_AFTER_FUNDING",
175
176
  /**
176
177
  * #1307: the caller omitted merchant_url/tool_name (asking Haven to
@@ -261,7 +262,7 @@ var AgentPaymentFailureCodeDescriptions = {
261
262
  [AgentPaymentFailureCode.PriceExceedsMax]: "The merchant-authoritative x402 amount exceeds the caller's max_amount cap. No funding transfer was created; ask the user before retrying with a larger cap.",
262
263
  [AgentPaymentFailureCode.PaymentWindowExpired]: "The x402 funding/quote window expired before the signer or hosted settle step could finish. Re-quote via haven_pay_mcp_tool with the same idempotency key to avoid duplicate funding.",
263
264
  [AgentPaymentFailureCode.MerchantRejectedAfterFunding]: "The merchant rejected the paid retry. eip3009: the funding leg succeeded \u2014 stop retrying the merchant and reconcile stranded delegate funds with haven_sweep_delegate. erc7710: no funding leg, nothing to sweep \u2014 follow the message (re-quote later, or check haven_get_payment_status after the window first).",
264
- [AgentPaymentFailureCode.MerchantUnresponsiveAfterFunding]: "The Haven funding leg succeeded, but the merchant did not answer the paid retry before the timeout. The merchant may still settle late \u2014 check haven_get_payment_status (and retry haven_complete_mcp_tool once) BEFORE sweeping; sweep only if no settlement appears.",
265
+ [AgentPaymentFailureCode.MerchantUnresponsiveAfterFunding]: "The merchant did not answer the paid retry before the timeout. The merchant may still settle late. eip3009: the funding leg succeeded \u2014 check haven_get_payment_status, retry haven_complete_mcp_tool once, sweep only if no settlement appears. erc7710: no funding leg, nothing to sweep, and haven_complete_mcp_tool has no erc7710 branch \u2014 do not retry it; check haven_get_payment_status after the payment window and re-quote only if it shows no settlement.",
265
266
  [AgentPaymentFailureCode.MerchantCallContextUnavailable]: "merchant_url/tool_name were omitted and no stored merchant call context is available for this payment_id. Re-send merchant_url, tool_name, arguments, and mcp_transport explicitly.",
266
267
  [AgentPaymentFailureCode.AmbiguousMaxAmount]: "Both max_amount (atomic units) and max_amount_human (whole tokens) were supplied 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.",
267
268
  [AgentPaymentFailureCode.MaxAmountUnconvertible]: "max_amount_human could not be converted to atomic units against this quote's asset \u2014 either its decimals are unknown to Haven or the cap has more decimal places than the asset supports. Nothing was spent. Round the cap, or re-send it as an exact atomic max_amount.",
@@ -4910,12 +4911,18 @@ present and surface \`message\` or \`error\` verbatim. Common cases:
4910
4911
  follow the message \u2014 it says whether the merchant declined to settle
4911
4912
  (re-quote later) or whether to check \`haven_get_payment_status\` after
4912
4913
  the payment window first.
4913
- - \`MERCHANT_UNRESPONSIVE_AFTER_FUNDING\`: funding confirmed on-chain, but the
4914
- merchant never answered the paid retry. This is NOT proof of rejection \u2014 the
4915
- merchant may still settle late. Verify-then-sweep, never a blind sweep:
4916
- check \`mcp__haven__haven_get_payment_status\`, retry
4914
+ - \`MERCHANT_UNRESPONSIVE_AFTER_FUNDING\`: the merchant never answered the paid
4915
+ retry. This is NOT proof of rejection \u2014 the merchant may still settle late.
4916
+ On eip3009 (\`rail\` not \`erc7710\`), funding confirmed on-chain: Verify-then-sweep,
4917
+ never a blind sweep \u2014 check \`mcp__haven__haven_get_payment_status\`, retry
4917
4918
  \`mcp__haven__haven_complete_mcp_tool\` ONCE, and only sweep with
4918
- \`mcp__haven__haven_sweep_delegate\` if no settlement appears.
4919
+ \`mcp__haven__haven_sweep_delegate\` if no settlement appears. On erc7710
4920
+ there is no funding leg and nothing to sweep, and
4921
+ \`mcp__haven__haven_complete_mcp_tool\` has no erc7710 branch (it refuses a
4922
+ submitted intent) \u2014 do not retry it: the merchant may still redeem the
4923
+ settlement authorization within the payment window, so check
4924
+ \`mcp__haven__haven_get_payment_status\` after that window and re-quote only
4925
+ if it shows no settlement.
4919
4926
  - Budget exceeded: tell the user how much remains (from
4920
4927
  \`mcp__haven__haven_get_allowances\`) and that they can raise the budget in
4921
4928
  Haven.