@haven_ai/sdk 0.1.27-alpha.0 → 0.1.29-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/dist/index.cjs +1871 -1689
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -163
- package/dist/index.d.ts +104 -163
- package/dist/index.js +1871 -1690
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -334,6 +334,13 @@ interface X402Intent {
|
|
|
334
334
|
network: string;
|
|
335
335
|
/** Haven-authenticated binding over the x402 expected context. */
|
|
336
336
|
expectedAuth: X402ExpectedAuth;
|
|
337
|
+
/**
|
|
338
|
+
* #1690: the payer identity Haven bound into the expected context (v3),
|
|
339
|
+
* relayed VERBATIM to the signer's wire shape. Absent until the backend
|
|
340
|
+
* flips X402_EMIT_PAYER_CONTEXT.
|
|
341
|
+
*/
|
|
342
|
+
payerDelegate?: string;
|
|
343
|
+
payerAgentId?: string;
|
|
337
344
|
/**
|
|
338
345
|
* EIP-712 digest of `signData.typed_data`, present on the delegation rail
|
|
339
346
|
* (#1138). The edge signer needs it to reconstruct the v2 expected-context
|
|
@@ -364,6 +371,16 @@ interface X402ExpectedContext {
|
|
|
364
371
|
* this digest makes Haven's declaration cover the real payload.
|
|
365
372
|
*/
|
|
366
373
|
typedDataHash?: string;
|
|
374
|
+
/**
|
|
375
|
+
* The DELEGATE ADDRESS this quote was created for (#1690). Present ⇒ the
|
|
376
|
+
* context is **version 3** and the signer refuses to sign when this is not
|
|
377
|
+
* its own delegate — the guard that turns "quote as agent A, sign as agent
|
|
378
|
+
* B" from an on-chain revert three layers later into a named refusal.
|
|
379
|
+
* Inside the Haven-signed message on purpose: outside it, it is forgeable.
|
|
380
|
+
*/
|
|
381
|
+
payerDelegate?: string;
|
|
382
|
+
/** The paying agent's id, for the refusal message's diagnosis (#1690). */
|
|
383
|
+
payerAgentId?: string;
|
|
367
384
|
}
|
|
368
385
|
interface X402ExpectedAuth {
|
|
369
386
|
/**
|
|
@@ -653,6 +670,36 @@ interface HavenPaymentReceipt {
|
|
|
653
670
|
createdAt: string;
|
|
654
671
|
updatedAt: string;
|
|
655
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* How long this SDK waits for an on-chain confirmation before it stops
|
|
675
|
+
* waiting (#1756).
|
|
676
|
+
*
|
|
677
|
+
* Lives here rather than in `client.ts` so the payment-confirmation poller
|
|
678
|
+
* and the delegate sweep share ONE number instead of forking it. The SDK's
|
|
679
|
+
* other chain waits are already bounded (`waitForFundingTx` at 30 s), so a
|
|
680
|
+
* fourth independently chosen literal is exactly the drift this constant
|
|
681
|
+
* exists to prevent.
|
|
682
|
+
*/
|
|
683
|
+
declare const DEFAULT_CONFIRMATION_TIMEOUT_MS = 90000;
|
|
684
|
+
/**
|
|
685
|
+
* Whether a sweep transfer was observed to confirm (#1756).
|
|
686
|
+
*
|
|
687
|
+
* The distinction is the point: `unconfirmed` means the transfer was
|
|
688
|
+
* BROADCAST and may still land, which is neither success nor failure. It must
|
|
689
|
+
* never be collapsed into either — reporting a still-pending transaction as
|
|
690
|
+
* done, or as failed, are the same defect in opposite directions.
|
|
691
|
+
*/
|
|
692
|
+
type SweepConfirmation =
|
|
693
|
+
/** A receipt was observed. The funds are in the Safe. */
|
|
694
|
+
'confirmed'
|
|
695
|
+
/**
|
|
696
|
+
* Broadcast, but no receipt within `DEFAULT_CONFIRMATION_TIMEOUT_MS` (or the
|
|
697
|
+
* node returned no receipt). The transaction is still in the mempool and may
|
|
698
|
+
* mine at any time. `txHash` is the broadcast hash — check it on the
|
|
699
|
+
* explorer before re-running the sweep, and expect a re-run to find nothing
|
|
700
|
+
* stranded if it has since landed.
|
|
701
|
+
*/
|
|
702
|
+
| 'unconfirmed';
|
|
656
703
|
/** One transferred asset in a delegate sweep. */
|
|
657
704
|
interface SweepEntry {
|
|
658
705
|
/** 'USDC' or 'ETH' */
|
|
@@ -661,10 +708,24 @@ interface SweepEntry {
|
|
|
661
708
|
amount: string;
|
|
662
709
|
/** Atomic amount swept */
|
|
663
710
|
amountAtomic: string;
|
|
664
|
-
/**
|
|
711
|
+
/**
|
|
712
|
+
* Transaction hash of the sweep transfer.
|
|
713
|
+
*
|
|
714
|
+
* The RECEIPT hash when `confirmation` is `confirmed`; the BROADCAST hash
|
|
715
|
+
* when it is `unconfirmed` — which is the whole reason the sweep returns
|
|
716
|
+
* instead of throwing on a deadline, since this hash is the only thing that
|
|
717
|
+
* lets a user recover the transfer by hand (#1756).
|
|
718
|
+
*/
|
|
665
719
|
txHash: string;
|
|
666
720
|
/** Block explorer URL for the tx */
|
|
667
721
|
explorerUrl: string;
|
|
722
|
+
/**
|
|
723
|
+
* Did this transfer confirm on-chain within the deadline? (#1756)
|
|
724
|
+
*
|
|
725
|
+
* `unconfirmed` entries have MOVED NOTHING YET and may still move. Do not
|
|
726
|
+
* report a sweep as complete without checking this on every entry.
|
|
727
|
+
*/
|
|
728
|
+
confirmation: SweepConfirmation;
|
|
668
729
|
}
|
|
669
730
|
/** Result of a `sweepDelegate()` call. */
|
|
670
731
|
interface SweepResult {
|
|
@@ -676,6 +737,16 @@ interface SweepResult {
|
|
|
676
737
|
chainId: number;
|
|
677
738
|
/** One entry per transferred asset. Empty when nothing was stranded. */
|
|
678
739
|
transfers: SweepEntry[];
|
|
740
|
+
/**
|
|
741
|
+
* True when ANY entry is `unconfirmed` — i.e. the sweep broadcast something
|
|
742
|
+
* it could not confirm within the deadline (#1756).
|
|
743
|
+
*
|
|
744
|
+
* Derived from `transfers`, and present anyway because the consumer most
|
|
745
|
+
* likely to misread this result is an LLM reading the JSON of the
|
|
746
|
+
* `haven_sweep_delegate` tool, which will otherwise see a populated
|
|
747
|
+
* `transfers` array and report the money as recovered.
|
|
748
|
+
*/
|
|
749
|
+
unconfirmed: boolean;
|
|
679
750
|
}
|
|
680
751
|
type PaymentStateKind = 'payment_intent' | 'approval_request';
|
|
681
752
|
interface AgentPaymentEnumSchema {
|
|
@@ -1356,32 +1427,31 @@ declare function buildSweepTypedData(auth: SweepAuthorization): SweepTypedData;
|
|
|
1356
1427
|
declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): string;
|
|
1357
1428
|
|
|
1358
1429
|
declare class HavenClient {
|
|
1359
|
-
private readonly apiKey;
|
|
1360
1430
|
private readonly delegateKey;
|
|
1361
|
-
private readonly
|
|
1431
|
+
private readonly havenApi;
|
|
1432
|
+
private readonly accountReads;
|
|
1433
|
+
private readonly delegateSweep;
|
|
1362
1434
|
private readonly x402Wallet;
|
|
1363
|
-
private readonly
|
|
1364
|
-
private readonly merchantTimeout;
|
|
1435
|
+
private readonly merchantTransport;
|
|
1365
1436
|
private readonly confirmationTimeout;
|
|
1366
1437
|
private readonly pollingInterval;
|
|
1367
1438
|
private readonly chainRpcs;
|
|
1368
1439
|
private readonly inFlightX402;
|
|
1369
|
-
private readonly x402ReceiptCache;
|
|
1370
1440
|
/**
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
|
|
1441
|
+
* The EIP-3009 funding-leg lifecycle (#1618). The facade holds a reference
|
|
1442
|
+
* and delegates; it does not reimplement any of it.
|
|
1443
|
+
*/
|
|
1444
|
+
private readonly fundingLeg;
|
|
1445
|
+
/**
|
|
1446
|
+
* The erc7710 direct-settlement lifecycle (#1619). Separate from the funding
|
|
1447
|
+
* leg on purpose: this scheme has no funding leg to share.
|
|
1374
1448
|
*/
|
|
1375
|
-
private readonly
|
|
1449
|
+
private readonly erc7710;
|
|
1376
1450
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
* overlapping async work — like two MCP tool dispatches in flight at
|
|
1380
|
-
* the same time — see their own headers without stepping on each other.
|
|
1451
|
+
* Merchant delivery and the evidence trail behind it (#1620). Scheme-neutral
|
|
1452
|
+
* on purpose — both settlement schemes finish through the same door.
|
|
1381
1453
|
*/
|
|
1382
|
-
private readonly
|
|
1383
|
-
/** Monotonic JSON-RPC id source for the MCP `initialize` handshake. */
|
|
1384
|
-
private mcpRequestId;
|
|
1454
|
+
private readonly merchantCompletion;
|
|
1385
1455
|
/** Delegate address derived from the private key (if provided) */
|
|
1386
1456
|
readonly delegateAddress: string | undefined;
|
|
1387
1457
|
constructor(config: HavenClientConfig);
|
|
@@ -1474,8 +1544,6 @@ declare class HavenClient {
|
|
|
1474
1544
|
* Get the agent identity tied to this API key.
|
|
1475
1545
|
*/
|
|
1476
1546
|
getAgent(): Promise<HavenAgent>;
|
|
1477
|
-
private agentInFlight;
|
|
1478
|
-
private fetchAgent;
|
|
1479
1547
|
/**
|
|
1480
1548
|
* One-shot "am I ready?" bootstrap: identity + live spend authority + a
|
|
1481
1549
|
* readiness signal, in a single call. Folds {@link getAgent} and
|
|
@@ -1546,7 +1614,6 @@ declare class HavenClient {
|
|
|
1546
1614
|
getPostPurchaseAllowanceSummary(paymentId: string): Promise<{
|
|
1547
1615
|
allowance: PostPurchaseAllowanceSummary | null;
|
|
1548
1616
|
warnings: AgentPaymentWarning[];
|
|
1549
|
-
/** Same authenticated payment-state read used to resolve the settled token. */
|
|
1550
1617
|
payment: PaymentStatusResult | null;
|
|
1551
1618
|
}>;
|
|
1552
1619
|
/**
|
|
@@ -1647,35 +1714,16 @@ declare class HavenClient {
|
|
|
1647
1714
|
* Pay a previously inspected x402 quote and retry the exact captured request.
|
|
1648
1715
|
*/
|
|
1649
1716
|
payX402Quote(quote: X402Quote, options?: X402AuthorizationOptions): Promise<Response>;
|
|
1650
|
-
private authorizeStandardX402;
|
|
1651
1717
|
/**
|
|
1652
1718
|
* Pay a merchant through **erc7710 direct settlement** (#1454, epic #1450).
|
|
1653
1719
|
*
|
|
1654
|
-
*
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1657
|
-
*
|
|
1658
|
-
* method is SMALLER than the 3009 path — the backend assembles the merchant
|
|
1659
|
-
* `X-PAYMENT` header in `assembleSettlementPayload`, so the SDK builds no
|
|
1660
|
-
* header locally.
|
|
1720
|
+
* **Nothing has settled when this returns** — that is why it does not return
|
|
1721
|
+
* an `X402Receipt`; the caller still has to retry the merchant with the
|
|
1722
|
+
* header. **MCP callers must pass `options.resourceUrl`**, because an in-band
|
|
1723
|
+
* MCP 402 challenge frequently carries no `resource` object at all.
|
|
1661
1724
|
*
|
|
1662
|
-
*
|
|
1663
|
-
*
|
|
1664
|
-
* The caller then retries the merchant with that header. **Nothing has
|
|
1665
|
-
* settled when this returns** — that is why it does not return an
|
|
1666
|
-
* `X402Receipt`.
|
|
1667
|
-
*
|
|
1668
|
-
* Requires a delegation-rail account. The backend enforces that
|
|
1669
|
-
* (`validateGenericSchemeRail`), and so does this method, before building a
|
|
1670
|
-
* request the backend would only reject: an error a client can explain is
|
|
1671
|
-
* worth more than a 400 it has to decode.
|
|
1672
|
-
*
|
|
1673
|
-
* **MCP callers must pass `options.resourceUrl`.** An in-band MCP 402
|
|
1674
|
-
* challenge frequently carries no `resource` object at all, so
|
|
1675
|
-
* `paymentRequired.resource?.url` is undefined and the backend answers
|
|
1676
|
-
* "Valid url is required". The QA scenario this path was ported from falls
|
|
1677
|
-
* back to the request URL for exactly that reason — the SDK cannot, because
|
|
1678
|
-
* it never saw the request. Pass it.
|
|
1725
|
+
* Both caveats, and why this scheme has no funding leg, are explained where
|
|
1726
|
+
* the lifecycle lives: `x402-erc7710.ts` (#1619).
|
|
1679
1727
|
*/
|
|
1680
1728
|
settleX402Erc7710(paymentRequired: X402PaymentRequired, options?: {
|
|
1681
1729
|
resourceUrl?: string;
|
|
@@ -1686,30 +1734,21 @@ declare class HavenClient {
|
|
|
1686
1734
|
*
|
|
1687
1735
|
* Split out because the hosted topology cannot use `settleX402Erc7710()`:
|
|
1688
1736
|
* that method signs in-process with `delegateKey`, and hosted Haven does not
|
|
1689
|
-
* have one and must not.
|
|
1690
|
-
* the LOCAL signer in between, so the key stays where it belongs and the
|
|
1691
|
-
* request shaping stays in one place rather than being reimplemented.
|
|
1737
|
+
* have one and must not.
|
|
1692
1738
|
*/
|
|
1693
1739
|
prepareX402Erc7710(paymentRequired: X402PaymentRequired, options?: {
|
|
1694
1740
|
resourceUrl?: string;
|
|
1695
1741
|
/**
|
|
1696
|
-
* The account's rail, when the caller has ALREADY read it
|
|
1697
|
-
*
|
|
1698
|
-
*
|
|
1699
|
-
*
|
|
1700
|
-
*
|
|
1701
|
-
* This is an optimisation, not a trust boundary: omit it and the rail is
|
|
1702
|
-
* read here, and either way the backend independently refuses erc7710
|
|
1703
|
-
* from a non-delegation account (`validateGenericSchemeRail`). A caller
|
|
1704
|
-
* that asserted the wrong rail would build a request the backend rejects.
|
|
1742
|
+
* The account's rail, when the caller has ALREADY read it — passing it
|
|
1743
|
+
* skips a duplicate fetch (#1456). An optimisation, not a trust
|
|
1744
|
+
* boundary: the backend independently refuses erc7710 from a
|
|
1745
|
+
* non-delegation account (`validateGenericSchemeRail`).
|
|
1705
1746
|
*/
|
|
1706
1747
|
delegationRail?: boolean;
|
|
1707
1748
|
/**
|
|
1708
1749
|
* #1547: the merchant MCP-tool call this authorization was quoted
|
|
1709
1750
|
* against, persisted so the settle leg can rehydrate it by payment_id
|
|
1710
|
-
* (#1307)
|
|
1711
|
-
* it an erc7710 settle needs merchant_url/tool_name/arguments
|
|
1712
|
-
* re-threaded, which the guided catalog path (#1305) exists to remove.
|
|
1751
|
+
* (#1307).
|
|
1713
1752
|
*/
|
|
1714
1753
|
mcpCallContext?: X402McpCallContext;
|
|
1715
1754
|
}): Promise<{
|
|
@@ -1721,9 +1760,8 @@ declare class HavenClient {
|
|
|
1721
1760
|
* The SETTLE half (#1456): exchange the signed child for the merchant header.
|
|
1722
1761
|
*
|
|
1723
1762
|
* The SDK builds no header on this path — the backend assembles the MetaMask
|
|
1724
|
-
* erc7710 payload
|
|
1725
|
-
*
|
|
1726
|
-
* hosted boundary) is irrelevant here.
|
|
1763
|
+
* erc7710 payload. Whoever produced the signature (an in-process delegate
|
|
1764
|
+
* key, or the local edge signer over the hosted boundary) is irrelevant.
|
|
1727
1765
|
*/
|
|
1728
1766
|
submitX402Erc7710(paymentId: string, signature: string): Promise<string>;
|
|
1729
1767
|
resumeAuthorizedX402(input: ResumeAuthorizedX402Input): Promise<X402Receipt>;
|
|
@@ -1752,45 +1790,6 @@ declare class HavenClient {
|
|
|
1752
1790
|
* Requires `delegateKey` to be set in the client config.
|
|
1753
1791
|
*/
|
|
1754
1792
|
fetch(url: string, init?: RequestInit, options?: X402AuthorizationOptions): Promise<Response>;
|
|
1755
|
-
/**
|
|
1756
|
-
* Run the MCP `initialize` handshake against a Streamable-HTTP endpoint and
|
|
1757
|
-
* return the `mcp-session-id` the server assigns.
|
|
1758
|
-
*
|
|
1759
|
-
* Returns `undefined` whenever the endpoint is not actually an MCP server —
|
|
1760
|
-
* a transport/HTTP error, a missing session id, or a JSON-RPC error in the
|
|
1761
|
-
* handshake response — so the caller can fall back to plain x402.
|
|
1762
|
-
*/
|
|
1763
|
-
private mcpInitialize;
|
|
1764
|
-
/**
|
|
1765
|
-
* Send the MCP `notifications/initialized` notification that completes the
|
|
1766
|
-
* lifecycle handshake. Best-effort: the session is already established, so a
|
|
1767
|
-
* failed notification must not abort the payment.
|
|
1768
|
-
*/
|
|
1769
|
-
private mcpNotifyInitialized;
|
|
1770
|
-
/** Read a single JSON-RPC message from an MCP response (JSON or SSE body). */
|
|
1771
|
-
private readMcpMessage;
|
|
1772
|
-
/** Add the MCP transport headers (session id + SSE Accept) to a request. */
|
|
1773
|
-
private withMcpHeaders;
|
|
1774
|
-
/**
|
|
1775
|
-
* Collapse an MCP SSE response into a plain JSON response carrying the
|
|
1776
|
-
* JSON-RPC `result`, so callers of `fetch()` never see raw SSE framing.
|
|
1777
|
-
* Non-SSE responses pass through untouched.
|
|
1778
|
-
*/
|
|
1779
|
-
private surfaceMcpResult;
|
|
1780
|
-
private retryX402Request;
|
|
1781
|
-
/**
|
|
1782
|
-
* #956: capture the merchant's OWN receipt when the paid response carries
|
|
1783
|
-
* one, and report it to Haven so the reporting feed can attach it next to
|
|
1784
|
-
* the Haven-generated payment evidence (#498). Two supported signals on the
|
|
1785
|
-
* paid response:
|
|
1786
|
-
*
|
|
1787
|
-
* x-receipt-json: base64-encoded JSON receipt document (inline)
|
|
1788
|
-
* x-receipt-url: https URL to the receipt document (reference)
|
|
1789
|
-
*
|
|
1790
|
-
* Strictly best-effort: absence is the normal case, and no failure here may
|
|
1791
|
-
* ever affect the completed payment — the response is already paid for.
|
|
1792
|
-
*/
|
|
1793
|
-
private reportMerchantReceipt;
|
|
1794
1793
|
/**
|
|
1795
1794
|
* Deliver an already-signed x402 payment header to the merchant and return
|
|
1796
1795
|
* the merchant's response. Used by the hosted MCP server to complete the
|
|
@@ -1814,7 +1813,7 @@ declare class HavenClient {
|
|
|
1814
1813
|
* and before delivering the X-PAYMENT header, so the merchant's
|
|
1815
1814
|
* balanceOf(delegate) / transferWithAuthorization verification sees the funded
|
|
1816
1815
|
* balance — otherwise it rejects with "Payment verification failed". The
|
|
1817
|
-
* SDK's local path already does this (see
|
|
1816
|
+
* SDK's local path already does this (see `X402FundingLeg.authorize`); the hosted
|
|
1818
1817
|
* split flow regressed when the 5→3 collapse removed the incidental
|
|
1819
1818
|
* inter-call latency that used to mask it.
|
|
1820
1819
|
*
|
|
@@ -1863,16 +1862,6 @@ declare class HavenClient {
|
|
|
1863
1862
|
* fallback (re-send the full context explicitly).
|
|
1864
1863
|
*/
|
|
1865
1864
|
getX402MerchantCallContext(paymentId: string): Promise<X402MerchantCallContext>;
|
|
1866
|
-
private resolveX402MerchantCompletionContext;
|
|
1867
|
-
private resolveX402WalletForMerchantCall;
|
|
1868
|
-
private assertCanResumeX402;
|
|
1869
|
-
private mapX402ReceiptFromAuthorization;
|
|
1870
|
-
private mapX402ReceiptFromStatus;
|
|
1871
|
-
private buildX402Receipt;
|
|
1872
|
-
private createStandardX402Header;
|
|
1873
|
-
private cacheX402Receipt;
|
|
1874
|
-
private recordMerchantRetryRejected;
|
|
1875
|
-
private reportMachinePaymentEvidence;
|
|
1876
1865
|
/**
|
|
1877
1866
|
* Wait for a funding tx to be mined with ≥1 confirmation before the
|
|
1878
1867
|
* merchant retry, eliminating the race where the merchant's
|
|
@@ -1882,39 +1871,7 @@ declare class HavenClient {
|
|
|
1882
1871
|
* backend has already confirmed on-chain submission and callers accept the
|
|
1883
1872
|
* small propagation window as a trade-off for not configuring an RPC URL.
|
|
1884
1873
|
*/
|
|
1885
|
-
private waitForFundingTx;
|
|
1886
|
-
/**
|
|
1887
|
-
* Can the delegate EOA still fund an authorization for `amountAtomic`?
|
|
1888
|
-
*
|
|
1889
|
-
* #1521: the only question that separates a legitimate resume (funding
|
|
1890
|
-
* confirmed, merchant never paid — the delegate still holds the money) from
|
|
1891
|
-
* a replayed settled payment (funding confirmed, merchant paid, delegate
|
|
1892
|
-
* spent). The intent's own `status: 'confirmed'` is identical in both.
|
|
1893
|
-
*
|
|
1894
|
-
* The balance is asked of the CHAIN rather than of Haven's bookkeeping on
|
|
1895
|
-
* purpose: the merchant-settlement evidence record is written by this SDK
|
|
1896
|
-
* *after* the merchant call, so a client that dies between the two leaves
|
|
1897
|
-
* the backend believing the merchant was never paid — the exact case the
|
|
1898
|
-
* discriminator has to get right. The chain cannot be behind in that way.
|
|
1899
|
-
*
|
|
1900
|
-
* Returns `null` — never a guess — when `chainRpcs` has no entry for the
|
|
1901
|
-
* chain or the read fails. Callers must treat that as "unverifiable", not
|
|
1902
|
-
* as "funded".
|
|
1903
|
-
*/
|
|
1904
|
-
private delegateCanFund;
|
|
1905
1874
|
private throwIfNonSignableAuthorizationState;
|
|
1906
|
-
private throwPaymentStateError;
|
|
1907
|
-
private paymentStateFromRaw;
|
|
1908
|
-
private x402PayerAddress;
|
|
1909
|
-
private snapshotX402Request;
|
|
1910
|
-
private snapshotRequestBody;
|
|
1911
|
-
private requestInitFromSnapshot;
|
|
1912
|
-
private withX402Wallet;
|
|
1913
|
-
private buildX402Quote;
|
|
1914
|
-
private detectX402McpTransport;
|
|
1915
|
-
private buildX402ResumeState;
|
|
1916
|
-
private attachResumeState;
|
|
1917
|
-
private attachX402ResumeState;
|
|
1918
1875
|
/**
|
|
1919
1876
|
* Execute a tool call by name and input.
|
|
1920
1877
|
*
|
|
@@ -1928,24 +1885,8 @@ declare class HavenClient {
|
|
|
1928
1885
|
* ```
|
|
1929
1886
|
*/
|
|
1930
1887
|
executeTool(toolName: string, input: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1931
|
-
private toolX402PaymentRequired;
|
|
1932
|
-
private x402ToolReceipt;
|
|
1933
|
-
private toolError;
|
|
1934
1888
|
private post;
|
|
1935
1889
|
private get;
|
|
1936
|
-
/**
|
|
1937
|
-
* #1300: every MERCHANT-facing fetch goes through here. Haven API calls
|
|
1938
|
-
* have always been bounded (request() below); the merchant probes/retries
|
|
1939
|
-
* called globalThis.fetch bare, so a slow-loris merchant could hold a tool
|
|
1940
|
-
* call open forever. A caller-supplied signal still applies (combined via
|
|
1941
|
-
* AbortSignal.any); a timeout abort surfaces as a clear HavenApiError 504
|
|
1942
|
-
* naming the URL rather than a bare AbortError.
|
|
1943
|
-
*/
|
|
1944
|
-
private merchantFetch;
|
|
1945
|
-
private request;
|
|
1946
|
-
private mapPaymentResult;
|
|
1947
|
-
private mapPaymentStatusResult;
|
|
1948
|
-
private mapPaymentReceipt;
|
|
1949
1890
|
}
|
|
1950
1891
|
|
|
1951
1892
|
/**
|
|
@@ -2146,7 +2087,7 @@ declare const toolDescriptions: {
|
|
|
2146
2087
|
readonly summary: "Sweep stranded USDC and/or ETH from the delegate wallet back to the originating Safe.";
|
|
2147
2088
|
readonly selectionGuidance: string;
|
|
2148
2089
|
readonly behavior: string;
|
|
2149
|
-
readonly nextActionGuidance:
|
|
2090
|
+
readonly nextActionGuidance: string;
|
|
2150
2091
|
};
|
|
2151
2092
|
readonly send: {
|
|
2152
2093
|
readonly summary: "Send ETH or USDC directly from the agent's Haven wallet to a recipient address.";
|
|
@@ -2546,4 +2487,4 @@ declare function discoverMerchantMcpUrl(inputUrl: string): Promise<string | null
|
|
|
2546
2487
|
/** Trailing-slash/percent-case echoes compare equal; unparseable never does. */
|
|
2547
2488
|
declare function sameUrl(a: string, b: string): boolean;
|
|
2548
2489
|
|
|
2549
|
-
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentNextStep, type AgentPaymentEnumSchema, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type AgentPaymentSummary, type AgentPaymentWarning, AgentPaymentWarningCode, type AgentPurchaseSummary, type ClaudeTool, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, type HavenAgent, type HavenAgentAllowanceSummary, type HavenAgentReadiness, type HavenAgentSummary, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, type HavenCatalogEntry, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, type MachinePaymentRail, MerchantTimeoutError, type OpenAITool, type PaymentFee, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentReceipt, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, type SharedToolKey, type SignData, SignerRefusalCode, type SweepAuthorization, type SweepEip712Domain, type SweepEntry, type SweepExpectedAuth, type SweepPreparation, type SweepPrepareResponse, type SweepResult, type SweepSubmitResponse, type SweepSubmitResult, type SweepTypedData, TRANSFER_WITH_AUTHORIZATION_TYPES, type ToolDescription, type UnsupportedNodeVersionMessageOptions, X402AlreadySettledError, type X402AuthorizationOptions, type X402Erc7710Settlement, type X402ExpectedAuth, type X402ExpectedContext, type X402Intent, type X402McpCallContext, type X402McpTransport, type X402MerchantCallContext, type X402PaymentHeaderContext, X402PaymentHeaderValidationError, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, type X402SchemeSelection, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
|
|
2490
|
+
export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentNextStep, type AgentPaymentEnumSchema, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type AgentPaymentSummary, type AgentPaymentWarning, AgentPaymentWarningCode, type AgentPurchaseSummary, type ClaudeTool, DEFAULT_CONFIRMATION_TIMEOUT_MS, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, type HavenAgent, type HavenAgentAllowanceSummary, type HavenAgentReadiness, type HavenAgentSummary, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, type HavenCatalogEntry, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, type MachinePaymentRail, MerchantTimeoutError, type OpenAITool, type PaymentFee, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentReceipt, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, type SharedToolKey, type SignData, SignerRefusalCode, type SweepAuthorization, type SweepConfirmation, type SweepEip712Domain, type SweepEntry, type SweepExpectedAuth, type SweepPreparation, type SweepPrepareResponse, type SweepResult, type SweepSubmitResponse, type SweepSubmitResult, type SweepTypedData, TRANSFER_WITH_AUTHORIZATION_TYPES, type ToolDescription, type UnsupportedNodeVersionMessageOptions, X402AlreadySettledError, type X402AuthorizationOptions, type X402Erc7710Settlement, type X402ExpectedAuth, type X402ExpectedContext, type X402Intent, type X402McpCallContext, type X402McpTransport, type X402MerchantCallContext, type X402PaymentHeaderContext, X402PaymentHeaderValidationError, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, type X402SchemeSelection, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
|