@haven_ai/sdk 0.2.0-alpha.0 → 0.3.0-alpha.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.
- package/README.md +13 -6
- package/dist/index.cjs +230 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +284 -191
- package/dist/index.d.ts +284 -191
- package/dist/index.js +229 -80
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,9 +85,13 @@ shows up in your Haven dashboard activity feed.
|
|
|
85
85
|
## Step-by-Step API
|
|
86
86
|
|
|
87
87
|
Discovery and listing: `discoverTools({ verified?: 'any' | 'verified' | 'operator' })` returns the merged
|
|
88
|
-
catalog — operator-curated plus
|
|
89
|
-
`domainVerified` and `verifiedPayable`. `
|
|
90
|
-
|
|
88
|
+
catalog — operator-curated rows plus self-submitted directory entries (epic #1717), each with `source`,
|
|
89
|
+
`domainVerified` and `verifiedPayable`. `verified: 'verified'` (#2978) filters on the badge, not the
|
|
90
|
+
source: it returns any entry, from either source, whose endpoint Haven watched answer a live quote
|
|
91
|
+
probe (`verifiedPayable === true`); `domainVerified` stays true only for entries that also proved
|
|
92
|
+
domain ownership. `verified: 'operator'` filters on provenance alone. `submitCatalogEntry(resourceUrl)`
|
|
93
|
+
submits a merchant endpoint to the Verified Payable Directory (queue-only; the seller still must prove
|
|
94
|
+
domain ownership before listing),
|
|
91
95
|
and `getCatalogSubmissionStatus(id)` returns coarse status plus the ownership-proof instructions while
|
|
92
96
|
the submission can still prove ownership.
|
|
93
97
|
|
|
@@ -358,7 +362,8 @@ Terminal from any non-confirmed phase:
|
|
|
358
362
|
|
|
359
363
|
x402 tool-window failures:
|
|
360
364
|
expired funding/quote window → PAYMENT_WINDOW_EXPIRED → re-quote with same idempotency_key
|
|
361
|
-
merchant rejection after funding → MERCHANT_REJECTED_AFTER_FUNDING → haven_sweep_delegate
|
|
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
|
|
362
367
|
```
|
|
363
368
|
|
|
364
369
|
### `phase` reference
|
|
@@ -399,11 +404,13 @@ Hosted MCP and signer tools also return stable `code` values on recoverable x402
|
|
|
399
404
|
|
|
400
405
|
| `code` | Meaning | Agent recovery |
|
|
401
406
|
|--------|---------|----------------|
|
|
402
|
-
| `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. |
|
|
407
|
+
| `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. Payloads carry `next_action: stop_and_tell_user` and `retry_with_new_quote: true` — the latter means any retry needs a fresh quote, not that one should be attempted unattended. |
|
|
403
408
|
| `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. |
|
|
404
409
|
| `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`. |
|
|
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`. |
|
|
405
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`. |
|
|
406
|
-
| `MERCHANT_REJECTED_AFTER_FUNDING` | Haven's funding leg succeeded
|
|
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. |
|
|
407
414
|
|
|
408
415
|
## Payments outside the agent's budget
|
|
409
416
|
|