@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/dist/index.js CHANGED
@@ -112,43 +112,51 @@ var AgentPaymentNextAction = {
112
112
  * the agent's per-token allowance needs to be raised before the payment
113
113
  * can succeed. A user approval will not fix this state on its own.
114
114
  *
115
- * #2908: the wire twin `fund_account_or_raise_allowance`
116
- * ({@link AgentPaymentNextActionAccountAlias}) means the same thing; the
117
- * server keeps emitting THIS value until #2914. Compare via
118
- * {@link canonicalAgentPaymentNextAction}.
115
+ * #2914: the account-vocabulary spelling, and the only one — the
116
+ * pre-#2907 `fund_safe_or_raise_allowance` wire value (and the
117
+ * `AgentPaymentNextActionAccountAlias` seam #2908 added to bridge it) are
118
+ * retired along with the rest of the #2908 compatibility window.
119
119
  */
120
- FundSafeOrRaiseAllowance: "fund_safe_or_raise_allowance",
120
+ FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance",
121
121
  /**
122
122
  * The delegate wallet may hold funds that were sent from the Safe but never
123
123
  * settled to the merchant. The wallet owner should initiate a sweep to
124
124
  * return those funds to the originating Safe.
125
125
  */
126
- SweepStrandedFunds: "sweep_stranded_funds"
127
- };
128
- var AgentPaymentNextActionAccountAlias = {
129
- /** Account-vocabulary twin of `fund_safe_or_raise_allowance`; same meaning. */
130
- FundAccountOrRaiseAllowance: "fund_account_or_raise_allowance"
126
+ SweepStrandedFunds: "sweep_stranded_funds",
127
+ /**
128
+ * #2970: a `submitted` erc7710 x402 intent whose settlement window has
129
+ * passed with no on-chain settlement evidence Haven could verify. Distinct
130
+ * from {@link CheckStatusLater}, which this REPLACES once the window is
131
+ * past — but it is not futile: Haven's settlement sweep (120s tick) scans
132
+ * each candidate over its own window plus a 120s clock-skew allowance, so
133
+ * it can still attribute the settlement for a short while after this value
134
+ * first appears. Poll {@link CheckStatusLater}'s tool
135
+ * (`haven_get_payment_status`) once more, roughly two minutes later; if it
136
+ * still shows no evidence, tell the user the goods were delivered but
137
+ * Haven holds no verified settlement evidence for this payment. If the
138
+ * agent holds the merchant's real settlement transaction hash (from
139
+ * `PAYMENT-RESPONSE`'s `transaction` field, or a prior settle/complete
140
+ * result's `settlement_tx_hash`), report it with the hosted
141
+ * `haven_report_settlement_evidence` tool instead of waiting —
142
+ * `haven_report_x402_outcome` takes no hash and refuses a non-`confirmed`
143
+ * intent.
144
+ */
145
+ AwaitingSettlementEvidence: "awaiting_settlement_evidence"
131
146
  };
132
- function canonicalAgentPaymentNextAction(value) {
133
- if (value === AgentPaymentNextActionAccountAlias.FundAccountOrRaiseAllowance) {
134
- return AgentPaymentNextAction.FundSafeOrRaiseAllowance;
135
- }
136
- return value;
137
- }
138
- function isFundAccountOrRaiseAllowance(value) {
139
- return value === AgentPaymentNextAction.FundSafeOrRaiseAllowance || value === AgentPaymentNextActionAccountAlias.FundAccountOrRaiseAllowance;
140
- }
141
147
  var AgentPaymentFailureCode = {
142
148
  /** A merchant-authoritative x402 price exceeds the caller's pre-funding max_amount cap. */
143
149
  PriceExceedsMax: "PRICE_EXCEEDS_MAX",
144
150
  /** The x402 funding/quote window expired before the signer or hosted settle step could finish. */
145
151
  PaymentWindowExpired: "PAYMENT_WINDOW_EXPIRED",
146
- /** The Haven funding leg succeeded, but the merchant rejected the paid retry. */
152
+ /** The merchant rejected the paid retry. On eip3009 the funding leg had succeeded (sweep);
153
+ * on erc7710 there is no funding leg — nothing to sweep, follow the message (#2983). */
147
154
  MerchantRejectedAfterFunding: "MERCHANT_REJECTED_AFTER_FUNDING",
148
155
  /** #1300 review: funding is on-chain but the merchant never ANSWERED the
149
156
  * paid retry within the timeout. NOT proof of rejection — the merchant
150
- * holds a valid EIP-3009 authorization and may still settle late, so the
151
- * guidance is verify-then-sweep, never blind sweep. */
157
+ * may still settle late, so the guidance is verify-then-act. On eip3009
158
+ * the funding leg had succeeded (verify-then-sweep); on erc7710 there is
159
+ * no funding leg — nothing to sweep, follow the message (#3000). */
152
160
  MerchantUnresponsiveAfterFunding: "MERCHANT_UNRESPONSIVE_AFTER_FUNDING",
153
161
  /**
154
162
  * #1307: the caller omitted merchant_url/tool_name (asking Haven to
@@ -174,7 +182,17 @@ var AgentPaymentFailureCode = {
174
182
  * asset can represent (truncating it would silently change the user's cap).
175
183
  * The fallback is the exact atomic `max_amount`.
176
184
  */
177
- MaxAmountUnconvertible: "MAX_AMOUNT_UNCONVERTIBLE"
185
+ MaxAmountUnconvertible: "MAX_AMOUNT_UNCONVERTIBLE",
186
+ /**
187
+ * #2979: the merchant answered a `tools/call` probe with its own
188
+ * machine-readable "cannot settle right now" refusal (HTTP 503,
189
+ * `{ error: 'merchant_not_ready', reason_code, ... }`) instead of a 402
190
+ * challenge — e.g. its settlement wallet is out of gas. No 402 was ever
191
+ * issued and no payment was created; this is honest and (per
192
+ * `retry_after_s`, when present) usually transient, unlike a permanent
193
+ * endpoint miss.
194
+ */
195
+ MerchantNotReady: "MERCHANT_NOT_READY"
178
196
  };
179
197
  var AgentPaymentRail = {
180
198
  /** Standard Haven payment from the user's Safe through an approved delegate allowance. */
@@ -220,18 +238,20 @@ var AgentPaymentNextActionDescriptions = {
220
238
  [AgentPaymentNextAction.StopAndTellUser]: "Stop retrying this payment and tell the user what happened.",
221
239
  [AgentPaymentNextAction.RequestAgainIfUserStillWantsIt]: "Ask again only if the user still wants the payment after expiry.",
222
240
  [AgentPaymentNextAction.PaymentWindowExpired]: "The x402 funding/quote window expired. Re-quote with the same idempotency key before asking the signer to build a merchant payment header again.",
223
- [AgentPaymentNextAction.FundSafeOrRaiseAllowance]: "Stop and tell the user that the account needs to be funded or the agent budget raised before the payment can succeed.",
241
+ [AgentPaymentNextAction.FundAccountOrRaiseAllowance]: "Stop and tell the user that the account needs to be funded or the agent budget raised before the payment can succeed.",
224
242
  [AgentPaymentNextAction.RetryWithExplicitContext]: "Retry the same tool call, this time passing merchant_url, tool_name, arguments, and mcp_transport explicitly \u2014 the server had no stored context to rehydrate for this payment id.",
225
- [AgentPaymentNextAction.SweepStrandedFunds]: "Tell the user that funds may be stranded in the delegate wallet and prompt them to initiate a sweep in Haven to return them to the originating account."
243
+ [AgentPaymentNextAction.SweepStrandedFunds]: "Tell the user that funds may be stranded in the delegate wallet and prompt them to initiate a sweep in Haven to return them to the originating account.",
244
+ [AgentPaymentNextAction.AwaitingSettlementEvidence]: "The settlement window passed with no verified on-chain evidence yet. If you hold the merchant's real settlement transaction hash, report it with haven_report_settlement_evidence. Otherwise, Haven's settlement sweep may still attribute it within about two minutes \u2014 poll getPaymentStatus once more, then tell the user the goods were delivered but unverified if it still shows nothing."
226
245
  };
227
246
  var AgentPaymentFailureCodeDescriptions = {
228
247
  [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.",
229
248
  [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.",
230
- [AgentPaymentFailureCode.MerchantRejectedAfterFunding]: "The Haven funding leg succeeded, but the merchant rejected the paid retry. Stop retrying the merchant and reconcile stranded delegate funds with haven_sweep_delegate.",
231
- [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.",
249
+ [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).",
250
+ [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.",
232
251
  [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.",
233
252
  [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.",
234
- [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."
253
+ [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.",
254
+ [AgentPaymentFailureCode.MerchantNotReady]: 'The merchant refused the probe with its own "cannot settle right now" signal instead of a 402 challenge. No payment was created. Often transient \u2014 retry later (see retry_after_s in the message, if given) rather than treating this as a broken or wrong endpoint.'
235
255
  };
236
256
  var AgentPaymentWarningCode = {
237
257
  /** No max_amount cap was supplied — the live quoted price was accepted as-is. */
@@ -262,7 +282,24 @@ var AgentPaymentWarningCode = {
262
282
  * on-chain policy re-checks at redemption either way; this only says the
263
283
  * guidance shown here may be optimistic.
264
284
  */
265
- AllowanceReadOptimistic: "ALLOWANCE_READ_OPTIMISTIC"
285
+ AllowanceReadOptimistic: "ALLOWANCE_READ_OPTIMISTIC",
286
+ /**
287
+ * #2991: the quote tools' `expected_settlement_scheme` prediction of what
288
+ * `haven_prepare_catalog_purchase` / `haven_pay_mcp_tool` will actually
289
+ * select could not be computed — the agent's execution rail could not be
290
+ * read from Haven, so `expected_settlement_scheme` is `null` rather than a
291
+ * guess. `accepted_scheme` (the merchant's offer) is unaffected.
292
+ */
293
+ X402SchemeUnknown: "X402_SCHEME_UNKNOWN",
294
+ /**
295
+ * #2968: the merchant answered 200 and handed over goods, but Haven holds NO
296
+ * on-chain evidence that the payment moved. `settled: false` beside this code
297
+ * is not a failure — it is the absence of proof, and the two must travel
298
+ * together so an agent can tell "the user has the goods" apart from "the
299
+ * money moved". Carries the intent's `expires_at`: after that instant the
300
+ * settlement can no longer land at all.
301
+ */
302
+ SettlementUnconfirmed: "SETTLEMENT_UNCONFIRMED"
266
303
  };
267
304
  var AgentPaymentRailDescriptions = {
268
305
  [AgentPaymentRail.Direct]: "Standard Haven payment from the user-controlled account, redeeming the agent's on-chain budget delegation.",
@@ -326,8 +363,18 @@ var MerchantTimeoutError = class extends HavenApiError {
326
363
  };
327
364
  var X402UnexpectedStatusError = class extends HavenApiError {
328
365
  x402ErrorCode = "unexpected_non_402_status";
329
- constructor(message, statusCode) {
330
- super(message, statusCode);
366
+ /**
367
+ * #2979: `body` is the merchant's own JSON, when the non-402 response
368
+ * carried one — e.g. the demo merchant's `/mcp` readiness gate answers
369
+ * `503 { error: 'merchant_not_ready', reason_code, ... }`. Optional and
370
+ * best-effort: a non-JSON or unreadable body leaves this `undefined`, same
371
+ * as before this field existed. Consumers key on it (not on the message
372
+ * string) to distinguish an honest, machine-readable merchant refusal from
373
+ * a genuine "this is not the x402 endpoint" miss, which otherwise look
374
+ * identical — both are just "some non-402 status".
375
+ */
376
+ constructor(message, statusCode, body) {
377
+ super(message, statusCode, body);
331
378
  this.name = "X402UnexpectedStatusError";
332
379
  }
333
380
  };
@@ -366,6 +413,17 @@ var HavenSigningError = class extends HavenError {
366
413
  this.name = "HavenSigningError";
367
414
  }
368
415
  };
416
+ var HavenZeroSettlementHashError = class extends HavenError {
417
+ constructor(paymentId) {
418
+ super(
419
+ "settlement_tx_hash is the zero hash (0x00\u202600), which is never a real settlement transaction \u2014 refused before any report was sent.",
420
+ "ZERO_SETTLEMENT_HASH",
421
+ 400,
422
+ paymentId
423
+ );
424
+ this.name = "HavenZeroSettlementHashError";
425
+ }
426
+ };
369
427
  var SignerRefusalCode = {
370
428
  /** `SUPPORTED_X402_EXPECTED_VERSIONS` in `@haven_ai/signer` does not include the received version. */
371
429
  UnsupportedExpectedContextVersion: "UNSUPPORTED_EXPECTED_CONTEXT_VERSION",
@@ -1114,6 +1172,15 @@ var HavenApiTransport = class {
1114
1172
  };
1115
1173
 
1116
1174
  // src/payment-mappers.ts
1175
+ function mapParties(raw) {
1176
+ if (!raw) return void 0;
1177
+ return {
1178
+ treasuryAccount: raw.treasury_account,
1179
+ delegate: raw.delegate,
1180
+ delegateAccount: raw.delegate_account,
1181
+ merchant: raw.merchant
1182
+ };
1183
+ }
1117
1184
  function mapPaymentResult(raw, buildExplorerUrl2) {
1118
1185
  return {
1119
1186
  paymentId: raw.payment_id,
@@ -1144,15 +1211,13 @@ function mapPaymentStatusResult(raw) {
1144
1211
  rail: raw.rail,
1145
1212
  status: raw.status,
1146
1213
  phase: raw.phase,
1147
- // #2908: the account-vocabulary alias collapses onto the canonical value
1148
- // so every `=== AgentPaymentNextAction.X` downstream keeps working when
1149
- // the server flips its emit at #2914.
1150
- nextAction: canonicalAgentPaymentNextAction(raw.next_action),
1214
+ nextAction: raw.next_action,
1151
1215
  amount: raw.amount,
1152
1216
  token: raw.token,
1153
1217
  resourceUrl: raw.resource_url,
1154
1218
  merchantAddress: raw.merchant_address,
1155
1219
  payerAddress: raw.payer_address ?? null,
1220
+ parties: mapParties(raw.parties),
1156
1221
  txHash: raw.tx_hash,
1157
1222
  expiresAt: raw.expires_at,
1158
1223
  chainId: raw.chain_id,
@@ -1186,10 +1251,13 @@ function mapPaymentReceipt(raw) {
1186
1251
  rail: raw.rail,
1187
1252
  proofStatus: raw.proof_status,
1188
1253
  txHash: raw.tx_hash,
1254
+ fundingTxHash: raw.funding_tx_hash ?? null,
1255
+ settlementTxHash: raw.settlement_tx_hash ?? null,
1189
1256
  chainId: raw.chain_id,
1190
1257
  resourceUrl: raw.resource_url,
1191
1258
  merchantAddress: raw.merchant_address,
1192
1259
  payerAddress: raw.payer_address,
1260
+ parties: mapParties(raw.parties),
1193
1261
  settlementAddress: raw.settlement_address,
1194
1262
  tokenSymbol: raw.token_symbol,
1195
1263
  tokenAddress: raw.token_address,
@@ -1279,7 +1347,7 @@ function messageForState(label, status, paymentId, nextAction) {
1279
1347
  function paymentStateFromRaw(label, raw) {
1280
1348
  if (!raw.payment_id || !raw.status) return null;
1281
1349
  const phase = raw.phase ?? phaseForStatus(raw.status);
1282
- const nextAction = canonicalAgentPaymentNextAction(raw.next_action) ?? nextActionForStatus(raw.status);
1350
+ const nextAction = raw.next_action ?? nextActionForStatus(raw.status);
1283
1351
  if (!phase || !nextAction) return null;
1284
1352
  const amount = raw.amount ?? raw.requested ?? "";
1285
1353
  const token = raw.token ?? "";
@@ -1602,20 +1670,6 @@ function verifyPaymentReceipt(receipt, recover = defaultRecover) {
1602
1670
  return { verified: true, recoveredSigner: recovered };
1603
1671
  }
1604
1672
 
1605
- // src/account-naming.ts
1606
- function readAccountAddress(raw) {
1607
- return raw.account_address ?? raw.safe_address ?? void 0;
1608
- }
1609
- function readAccountId(raw) {
1610
- return raw.account_id ?? raw.safe_id ?? void 0;
1611
- }
1612
- function accountAddressTwins(address) {
1613
- return { accountAddress: address, safeAddress: address };
1614
- }
1615
- function readX402ReceiptPayer(raw) {
1616
- return raw.payer ?? raw.account_address ?? raw.sign_data?.components?.payer_account ?? raw.safe_address ?? raw.sign_data?.components?.safe;
1617
- }
1618
-
1619
1673
  // src/account-reads.ts
1620
1674
  function safeBigInt(value) {
1621
1675
  try {
@@ -1674,10 +1728,13 @@ var AccountReads = class {
1674
1728
  const raw = await this.transport.get("/machine-payments/allowances");
1675
1729
  return {
1676
1730
  agentId: raw.agent_id,
1677
- // #2908: one mapper, both names, same value — `readAccountAddress`
1678
- // prefers the server's `account_address` twin and falls back to
1679
- // `safe_address` for a pre-#2907 server.
1680
- ...accountAddressTwins(readAccountAddress(raw)),
1731
+ // `account_address` is required on the wire contract, so the declared
1732
+ // type stays `string`; a server that omits it is off-contract and the
1733
+ // cast is the one place that case is allowed through as `undefined`
1734
+ // rather than a fabricated `''` (a present-but-blank address downstream
1735
+ // — the hosted MCP output spreads this object, and the sweep uses it as
1736
+ // a destination).
1737
+ accountAddress: raw.account_address,
1681
1738
  delegateAddress: raw.delegate_address,
1682
1739
  chainId: raw.chain_id,
1683
1740
  allowances: raw.allowances.map((allowance) => ({
@@ -1766,10 +1823,10 @@ var AccountReads = class {
1766
1823
  id: raw.id,
1767
1824
  name: raw.name,
1768
1825
  status: raw.status,
1769
- // #2908: both camelCase names off whichever snake_case name the server
1770
- // sent (new first). The hosted MCP's `haven_get_agent` spreads this
1771
- // object, so this is also the hosted output's dual-emit point.
1772
- ...accountAddressTwins(readAccountAddress(raw)),
1826
+ // See the comment on `getAllowances` above: `account_address` is
1827
+ // required on the wire contract, so an omission here is off-contract
1828
+ // and comes through as `undefined` rather than a fabricated `''`.
1829
+ accountAddress: raw.account_address,
1773
1830
  delegateAddress: raw.delegate_address,
1774
1831
  chainId: raw.chain_id,
1775
1832
  executionRail: raw.execution_rail === "delegation" ? "delegation" : "legacy"
@@ -2101,6 +2158,13 @@ function assertCanResumeX402(status, paymentRequired, option) {
2101
2158
  );
2102
2159
  }
2103
2160
  }
2161
+
2162
+ // src/account-naming.ts
2163
+ function readX402ReceiptPayer(raw) {
2164
+ return raw.payer ?? raw.account_address ?? raw.sign_data?.components?.payer_account;
2165
+ }
2166
+
2167
+ // src/x402-funding-leg.ts
2104
2168
  var X402FundingLeg = class {
2105
2169
  delegateKey;
2106
2170
  delegateAddress;
@@ -2913,15 +2977,57 @@ var MerchantCompletion = class {
2913
2977
  for (let attempt = 0; ; attempt += 1) {
2914
2978
  try {
2915
2979
  await this.post("/machine-payments/evidence", body);
2916
- return;
2980
+ return { outcome: "confirmed" };
2917
2981
  } catch (err) {
2918
- const retryable = err instanceof HavenApiError && err.statusCode === EVIDENCE_RETRYABLE_STATUS;
2919
- if (!retryable || attempt >= EVIDENCE_RETRY_DELAYS_MS.length) return;
2982
+ const statusCode = err instanceof HavenApiError ? err.statusCode : void 0;
2983
+ const retryable = statusCode === EVIDENCE_RETRYABLE_STATUS;
2984
+ if (!retryable) {
2985
+ return { outcome: "refused", statusCode: statusCode ?? 0 };
2986
+ }
2987
+ if (attempt >= EVIDENCE_RETRY_DELAYS_MS.length) {
2988
+ return { outcome: "retryable", statusCode };
2989
+ }
2920
2990
  await this.sleep(EVIDENCE_RETRY_DELAYS_MS[attempt]);
2921
2991
  }
2922
2992
  }
2923
2993
  }
2994
+ /**
2995
+ * #2972: report the merchant's REAL settlement transaction hash for an
2996
+ * erc7710 x402 payment out of band — the remedy #2970's guidance could not
2997
+ * name, because no hosted tool accepted a hash. An agent reaches this after
2998
+ * `haven_settle_mcp_tool` / `haven_complete_mcp_tool` answered
2999
+ * `DELIVERED_UNSETTLED` or `SETTLEMENT_PENDING`, or after
3000
+ * `haven_get_payment_status` reports `awaiting_settlement_evidence` — in
3001
+ * every one of those cases the agent may be holding the merchant's own
3002
+ * `PAYMENT-RESPONSE.transaction` while Haven has nothing.
3003
+ *
3004
+ * Reuses `reportEvidence` — same backend seam
3005
+ * (`POST /machine-payments/evidence` → `observeErc7710Settlement`,
3006
+ * fail-closed — see `settlement-observed.ts`), same three-outcome contract.
3007
+ * `resourceUrl` and `merchantStatus` are omitted: this call has no fresh
3008
+ * merchant HTTP exchange to read either from, and both are optional at the
3009
+ * backend (see the parameter doc on `reportEvidence`).
3010
+ *
3011
+ * The zero hash is refused HERE, client-side, before any network call —
3012
+ * never posted. `isZeroSettlementTxHash` is the same recognizer the #2970
3013
+ * gate uses, so a caller cannot "fix" a missing hash by reporting the demo
3014
+ * merchant's own marker and getting a different verdict than the settle
3015
+ * path already gave it.
3016
+ */
3017
+ async reportSettlementEvidence(paymentId, settlementTxHash) {
3018
+ if (isZeroSettlementTxHash(settlementTxHash)) {
3019
+ throw new HavenZeroSettlementHashError(paymentId);
3020
+ }
3021
+ return this.reportEvidence({
3022
+ paymentId,
3023
+ rail: "x402",
3024
+ txHash: settlementTxHash
3025
+ });
3026
+ }
2924
3027
  };
3028
+ function isZeroSettlementTxHash(hash) {
3029
+ return typeof hash === "string" && /^0x0+$/i.test(hash);
3030
+ }
2925
3031
  function parseMerchantSettlement(header) {
2926
3032
  if (!header) return {};
2927
3033
  const parsed = parseProtocolReceiptHeader(header);
@@ -3423,7 +3529,7 @@ var HavenClient = class {
3423
3529
  const query = params.size > 0 ? `?${params.toString()}` : "";
3424
3530
  const raw = await this.get(`/catalog${query}`);
3425
3531
  let entries = raw.entries.map(mapCatalogEntry);
3426
- if (options.verified === "verified") entries = entries.filter((e) => e.source === "ingestion");
3532
+ if (options.verified === "verified") entries = entries.filter((e) => e.verifiedPayable === true);
3427
3533
  if (options.verified === "operator") entries = entries.filter((e) => e.source === "operator");
3428
3534
  return entries;
3429
3535
  }
@@ -3560,9 +3666,16 @@ var HavenClient = class {
3560
3666
  const request = snapshotX402Request(url, initialInit);
3561
3667
  const response = await this.merchantTransport.fetch(url, initialInit);
3562
3668
  if (response.status !== 402) {
3669
+ let body;
3670
+ try {
3671
+ body = await response.clone().json();
3672
+ } catch {
3673
+ body = void 0;
3674
+ }
3563
3675
  throw new X402UnexpectedStatusError(
3564
3676
  `Expected an x402 quote response with HTTP 402, got HTTP ${response.status}.`,
3565
- response.status || 400
3677
+ response.status || 400,
3678
+ body
3566
3679
  );
3567
3680
  }
3568
3681
  if (response.headers.get("MACHINE-PAYMENT-CHALLENGE")) {
@@ -3851,6 +3964,7 @@ var HavenClient = class {
3851
3964
  } catch {
3852
3965
  body = text;
3853
3966
  }
3967
+ let evidenceOutcome;
3854
3968
  if (!surfaced.ok) {
3855
3969
  if (!input.noFundingLeg && fundingTxHash) {
3856
3970
  await this.merchantCompletion.recordRetryRejected({
@@ -3870,9 +3984,10 @@ var HavenClient = class {
3870
3984
  });
3871
3985
  }
3872
3986
  } else {
3873
- const evidenceTxHash = input.noFundingLeg ? settlement.settlementTxHash ?? void 0 : fundingTxHash ?? void 0;
3987
+ const rawEvidenceTxHash = input.noFundingLeg ? settlement.settlementTxHash ?? void 0 : fundingTxHash ?? void 0;
3988
+ const evidenceTxHash = rawEvidenceTxHash && !isZeroSettlementTxHash(rawEvidenceTxHash) ? rawEvidenceTxHash : void 0;
3874
3989
  if (evidenceTxHash) {
3875
- await this.merchantCompletion.reportEvidence({
3990
+ evidenceOutcome = await this.merchantCompletion.reportEvidence({
3876
3991
  paymentId: evidenceContext.paymentId,
3877
3992
  rail: "x402",
3878
3993
  txHash: evidenceTxHash,
@@ -3890,7 +4005,8 @@ var HavenClient = class {
3890
4005
  status: surfaced.status,
3891
4006
  ok: surfaced.ok,
3892
4007
  body,
3893
- settlementTxHash: settlement.settlementTxHash ?? void 0
4008
+ settlementTxHash: settlement.settlementTxHash ?? void 0,
4009
+ evidenceOutcome
3894
4010
  };
3895
4011
  }
3896
4012
  /**
@@ -3905,6 +4021,19 @@ var HavenClient = class {
3905
4021
  async reportX402MerchantOutcome(input) {
3906
4022
  return await this.merchantCompletion.reportMerchantOutcome(input);
3907
4023
  }
4024
+ /**
4025
+ * #2972: report the merchant's real settlement transaction hash for an
4026
+ * erc7710 x402 payment — the remedy for `DELIVERED_UNSETTLED` /
4027
+ * `SETTLEMENT_PENDING` / `awaiting_settlement_evidence` when the agent
4028
+ * holds the hash (`PAYMENT-RESPONSE.transaction`, or a prior settle/
4029
+ * complete result's `settlement_tx_hash`) and Haven does not. See
4030
+ * `MerchantCompletion.reportSettlementEvidence` for the fail-closed
4031
+ * verification this posts into (`observeErc7710Settlement`) and the
4032
+ * client-side zero-hash refusal.
4033
+ */
4034
+ async reportSettlementEvidence(paymentId, settlementTxHash) {
4035
+ return await this.merchantCompletion.reportSettlementEvidence(paymentId, settlementTxHash);
4036
+ }
3908
4037
  /**
3909
4038
  * GET /x402/:id/merchant-call-context — the settle-leg twin of #1263's
3910
4039
  * sign-context fetch (#1307). Re-serves the stored merchant MCP-tool call
@@ -4061,13 +4190,13 @@ var toolDescriptions = {
4061
4190
  summary: "Pay an inspected x402 quote. The delegate key signs locally; Haven only validates and relays signed, on-chain-constrained payment transactions.",
4062
4191
  selectionGuidance: "Do not use this for read-only allowance, budget, spend-limit, remaining-amount, reset-period, or what-can-I-spend questions; use the allowance lookup tool instead.",
4063
4192
  behavior: "Signs the payment locally and returns the merchant response. Settlement is either direct account-to-merchant with no funding leg, or a bridge that first redeems the agent's budget delegation to fund the delegate wallet for an EIP-3009 authorization. A payment outside the on-chain budget is declined before any money moves; nothing is queued for a human to approve later.",
4064
- nextActionGuidance: "Preserve the returned resume_state \u2014 it identifies this payment if you need to ask about it later. This tool performs the merchant retry itself, so do not wait on a signal while the call is in flight. If the process crashes after this call and a later haven_get_payment_status reports nextAction=retry_original_x402_request, Haven's funding leg confirmed but no merchant response was ever recorded \u2014 call the resume tool with the preserved resume_state or payment_id instead of paying again. If the response carries phase=insufficient_funds and nextAction=fund_safe_or_raise_allowance (or fund_account_or_raise_allowance), the payment cannot be retried until the account is funded or the agent budget raised \u2014 stop and tell the user the shortfall reported on the response."
4193
+ nextActionGuidance: "Preserve the returned resume_state \u2014 it identifies this payment if you need to ask about it later. This tool performs the merchant retry itself, so do not wait on a signal while the call is in flight. If the process crashes after this call and a later haven_get_payment_status reports nextAction=retry_original_x402_request, Haven's funding leg confirmed but no merchant response was ever recorded \u2014 call the resume tool with the preserved resume_state or payment_id instead of paying again. If the response carries phase=insufficient_funds and nextAction=fund_account_or_raise_allowance, the payment cannot be retried until the account is funded or the agent budget raised \u2014 stop and tell the user the shortfall reported on the response."
4065
4194
  },
4066
4195
  payX402OneShot: {
4067
4196
  summary: "Fetch an x402 paid HTTP resource in a single call. Handles the full probe -> pay -> retry round trip and returns the merchant response.",
4068
4197
  selectionGuidance: "Prefer this over the quote+pay split when the agent just wants the paid resource and does not need to inspect the price first. If you already have a quote from haven_quote_x402, use haven_pay_x402_quote instead. Do not use for read-only allowance, budget, spend-limit, remaining-amount, reset-period, or what-can-I-spend questions; use the allowance lookup tool instead.",
4069
4198
  behavior: "Calls the URL, parses any HTTP 402 x402 challenge, signs the payment locally, then retries the original request with the signed payment header (sent under PAYMENT-SIGNATURE, plus the legacy X-PAYMENT on the EIP-3009 path only) and returns the merchant response. Settlement is either direct account-to-merchant with no funding leg, or a bridge that first redeems the agent's budget delegation to fund the delegate wallet for an EIP-3009 authorization. A payment outside the on-chain budget is declined before any money moves; nothing is queued for a human to approve later. If the resource returns a non-402 status, returns it unchanged without contacting Haven.",
4070
- nextActionGuidance: "Preserve the returned resume_state or paymentId \u2014 either identifies this payment if you need to ask about it later. This tool performs the merchant retry itself, so do not wait on a signal while the call is in flight. If the process crashes after this call and a later haven_get_payment_status reports nextAction=retry_original_x402_request, Haven's funding leg confirmed but no merchant response was ever recorded \u2014 call the resume tool with the preserved resume_state or payment_id instead of paying again. If the response carries phase=insufficient_funds and nextAction=fund_safe_or_raise_allowance (or fund_account_or_raise_allowance), the payment cannot be retried until the account is funded or the agent budget raised \u2014 stop and tell the user the shortfall reported on the response."
4199
+ nextActionGuidance: "Preserve the returned resume_state or paymentId \u2014 either identifies this payment if you need to ask about it later. This tool performs the merchant retry itself, so do not wait on a signal while the call is in flight. If the process crashes after this call and a later haven_get_payment_status reports nextAction=retry_original_x402_request, Haven's funding leg confirmed but no merchant response was ever recorded \u2014 call the resume tool with the preserved resume_state or payment_id instead of paying again. If the response carries phase=insufficient_funds and nextAction=fund_account_or_raise_allowance, the payment cannot be retried until the account is funded or the agent budget raised \u2014 stop and tell the user the shortfall reported on the response."
4071
4200
  },
4072
4201
  resumeX402: {
4073
4202
  summary: "Resume an x402 payment whose Haven-side authorization already succeeded but whose merchant retry did not complete.",
@@ -4079,8 +4208,8 @@ var toolDescriptions = {
4079
4208
  // MACHINE-PAYMENT-CHALLENGE was never produced by anything besides the now
4080
4209
  // deleted `/demo/mpp/*` route. Use the x402 fragments above instead.
4081
4210
  getPaymentStatus: {
4082
- summary: "Fetch structured Haven payment status, including phase and nextAction taxonomy for agent recovery.",
4083
- behavior: "Accepts a payment intent id and returns the full state taxonomy (phase, nextAction, rail, amount, merchant, resource url, idempotency key, message).",
4211
+ summary: "Fetch structured Haven payment status for agent recovery.",
4212
+ behavior: "State: phase, nextAction, rail, amount, merchant, resource, idempotency, message; parties: treasury/delegate/delegateAccount/merchant. awaiting_settlement_evidence: poll once, else unverified.",
4084
4213
  nextActionGuidance: ""
4085
4214
  },
4086
4215
  getResumeState: {
@@ -4091,7 +4220,7 @@ var toolDescriptions = {
4091
4220
  getAgent: {
4092
4221
  summary: "Return the authenticated agent identity AND its live spend authority in one call: Haven wallet, delegate, chain, raw status, spend_authority_readiness, and per-token remaining allowance (atomic + human-readable). The recommended first call in a new session to confirm who you are and whether Haven will let you spend right now.",
4093
4222
  selectionGuidance: "Use this as the one-shot orientation/bootstrap at the start of a session, or whenever you need to confirm identity together with whether the agent can spend right now. For a detailed per-token breakdown (configured vs spent vs reset window) use haven_get_allowances.",
4094
- behavior: `Reads identity plus the live spend-authority snapshot in one shot \u2014 the agent's active on-chain budget delegation. spend_authority_readiness (readiness is a deprecated alias, same value) is "ready" when at least one token has remaining spend authority, "needs_approval" when the agent is active but has none, and "revoked" when the credential is not active. It covers hosted identity + on-chain spend authority ONLY \u2014 the hosted server cannot see the LOCAL signer, so "ready" does not mean the signer can start; verify the signer with a signer tool call or connect --doctor. An over-budget payment is declined before any money moves: there is no approval queue, so ask the owner to grant or raise the budget in Haven rather than waiting for an approval. allowances[] carries remainingAtomic and remainingDisplay per token. Identity fields: id, name, status, accountAddress (safeAddress: deprecated alias, same value), delegateAddress, chainId.`,
4223
+ behavior: `Reads identity plus the live spend-authority snapshot in one shot \u2014 the agent's active on-chain budget delegation. spend_authority_readiness (readiness is a deprecated alias, same value) is "ready" when at least one token has remaining spend authority, "needs_approval" when the agent is active but has none, and "revoked" when the credential is not active. It covers hosted identity + on-chain spend authority ONLY \u2014 the hosted server cannot see the LOCAL signer, so "ready" does not mean the signer can start; verify the signer with a signer tool call or connect --doctor. An over-budget payment is declined before any money moves: there is no approval queue, so ask the owner to grant or raise the budget in Haven rather than waiting for an approval. allowances[] carries remainingAtomic and remainingDisplay per token. Identity fields: id, name, status, accountAddress, delegateAddress, chainId.`,
4095
4224
  nextActionGuidance: ""
4096
4225
  },
4097
4226
  getAllowances: {
@@ -4120,7 +4249,7 @@ var toolDescriptions = {
4120
4249
  },
4121
4250
  discoverTools: {
4122
4251
  summary: "Step 1 of a purchase: discover payable services from Haven's curated merchant catalog \u2014 names, prices, and which pay tool to use next.",
4123
- selectionGuidance: "Use this when the user asks what the agent can buy, pay for, or which paid services exist \u2014 or when you need a resource URL for a service the user described. Use verified=verified to show only self-submitted directory entries that passed domain-ownership proof and a live quote probe \u2014 never treat those badges as proof of merchant honesty, quality, or reliability. Do NOT use for balance, budget, or spend-limit questions \u2014 use haven_get_allowances. Do NOT use to pay \u2014 each returned entry names the pay tool to use next.",
4252
+ selectionGuidance: "Use this when the user asks what the agent can buy, pay for, or which paid services exist \u2014 or when you need a resource URL for a service the user described. Use verified=verified for entries Haven watched pass a live quote probe (operator-curated or self-submitted) \u2014 domain_verified is the only ownership claim; never treat these badges as proof of merchant honesty, quality, or reliability. Do NOT use for balance, budget, or spend-limit questions \u2014 use haven_get_allowances. Do NOT use to pay \u2014 each returned entry names the pay tool to use next.",
4124
4253
  behavior: "Use each entry's suggested_tool field first \u2014 it names the exact next call. Read-only lookup against Haven's curated catalog; entries are periodically re-verified against the live merchant and degraded entries are flagged. Use category for a case-insensitive category filter (for example, VPN or vpn), or search for a product name, category, or description term. Returns name, description, price, rail, resource URL, tool_name, tool_arguments, suggested_tool, and the provenance badges source/domain_verified/verified_payable. The catalog price (price_display/price_atomic, marked price_is_indicative) is a last-verified hint, NOT authoritative \u2014 the real price comes from the merchant's live 402 at pay time. Never creates a payment, signature, or approval.",
4125
4254
  nextActionGuidance: `Pick an entry and pay it with the tool named in suggested_tool, passing the entry's resource_url, tool_name, and tool_arguments for MCP merchants. Confirm the price from the live pay-tool result (not the catalog), and pass the user's cap as max_amount_human in whole tokens ("no more than 1 USDC" \u2192 max_amount_human: "1") \u2014 never convert it to atomic units by hand.`
4126
4255
  },
@@ -4141,6 +4270,11 @@ var toolDescriptions = {
4141
4270
  selectionGuidance: "Use this for plain transfers \u2014 refunding a user, paying a freelancer, topping up a co-agent's wallet, or moving funds between addresses. Do NOT use for x402 paid endpoints \u2014 use haven_pay_x402 instead. Do NOT use for read-only allowance, budget, or what-can-I-spend questions \u2014 use haven_get_allowances.",
4142
4271
  behavior: "Sends the requested amount by redeeming the agent's on-chain budget delegation, account to recipient with no funding leg. Budget, recipient and expiry are enforced on-chain while the transfer is prepared, so a request outside them is declined before any money moves and before the agent is asked to sign \u2014 it is never queued for a human to approve later. The agent's signing key signs the account's typed data; Haven never receives the key.",
4143
4272
  nextActionGuidance: "On a decline, report the reason to the user and ask them to grant or raise the budget in Haven \u2014 there is nothing to poll and no approval will arrive. After a successful send, poll haven_get_payment_status until nextAction=none."
4273
+ },
4274
+ reportSettlementEvidence: {
4275
+ summary: "Report an erc7710 payment's real settlement transaction hash so Haven can verify it on-chain and confirm the payment.",
4276
+ behavior: "Pass payment_id and settlement_tx_hash (0x + 64 hex chars) \u2014 from PAYMENT-RESPONSE or a prior settlement_tx_hash. Haven verifies on-chain before confirming; a zero, mismatched, or reverted hash is refused. Your own payments only.",
4277
+ nextActionGuidance: "code DELIVERED_UNSETTLED: did not verify, do not retry \u2014 poll haven_get_payment_status. code SETTLEMENT_PENDING (retryable:true): not mined or RPC unreachable \u2014 report the same hash again shortly."
4144
4278
  }
4145
4279
  };
4146
4280
 
@@ -4743,15 +4877,30 @@ present and surface \`message\` or \`error\` verbatim. Common cases:
4743
4877
  Round the cap, or send an exact atomic \`max_amount\`.
4744
4878
  - \`PAYMENT_WINDOW_EXPIRED\`: re-run the quote/prepare tool with the same
4745
4879
  \`idempotency_key\`, then sign the fresh payload.
4880
+ - \`MERCHANT_NOT_READY\`: the merchant refused the quote with its own
4881
+ "cannot settle right now" signal (a 503 \`merchant_not_ready\` with a
4882
+ \`reason_code\`) instead of a 402. No payment was created. Tell the user;
4883
+ retry later (the message carries \`retry_after_s\` when the merchant gave
4884
+ one) \u2014 this is not a wrong or broken endpoint.
4746
4885
  - \`MERCHANT_REJECTED_AFTER_FUNDING\`: the merchant refused the paid retry.
4747
- Stop-and-sweep \u2014 stop retrying the merchant and use
4748
- \`mcp__haven__haven_sweep_delegate\` to recover stranded delegate funds.
4749
- - \`MERCHANT_UNRESPONSIVE_AFTER_FUNDING\`: funding confirmed on-chain, but the
4750
- merchant never answered the paid retry. This is NOT proof of rejection \u2014 the
4751
- merchant may still settle late. Verify-then-sweep, never a blind sweep:
4752
- check \`mcp__haven__haven_get_payment_status\`, retry
4886
+ On eip3009 (\`rail\` not \`erc7710\`): Stop-and-sweep \u2014 stop retrying the
4887
+ merchant and use \`mcp__haven__haven_sweep_delegate\` to recover stranded
4888
+ delegate funds. On erc7710 there is no funding leg and nothing to sweep:
4889
+ follow the message \u2014 it says whether the merchant declined to settle
4890
+ (re-quote later) or whether to check \`haven_get_payment_status\` after
4891
+ the payment window first.
4892
+ - \`MERCHANT_UNRESPONSIVE_AFTER_FUNDING\`: the merchant never answered the paid
4893
+ retry. This is NOT proof of rejection \u2014 the merchant may still settle late.
4894
+ On eip3009 (\`rail\` not \`erc7710\`), funding confirmed on-chain: Verify-then-sweep,
4895
+ never a blind sweep \u2014 check \`mcp__haven__haven_get_payment_status\`, retry
4753
4896
  \`mcp__haven__haven_complete_mcp_tool\` ONCE, and only sweep with
4754
- \`mcp__haven__haven_sweep_delegate\` if no settlement appears.
4897
+ \`mcp__haven__haven_sweep_delegate\` if no settlement appears. On erc7710
4898
+ there is no funding leg and nothing to sweep, and
4899
+ \`mcp__haven__haven_complete_mcp_tool\` has no erc7710 branch (it refuses a
4900
+ submitted intent) \u2014 do not retry it: the merchant may still redeem the
4901
+ settlement authorization within the payment window, so check
4902
+ \`mcp__haven__haven_get_payment_status\` after that window and re-quote only
4903
+ if it shows no settlement.
4755
4904
  - Budget exceeded: tell the user how much remains (from
4756
4905
  \`mcp__haven__haven_get_allowances\`) and that they can raise the budget in
4757
4906
  Haven.
@@ -4858,6 +5007,6 @@ function sameUrl(a, b) {
4858
5007
  }
4859
5008
  }
4860
5009
 
4861
- export { AGENT_APPROVAL_RELAY_JSON_SENTENCE, AGENT_APPROVAL_RELAY_PROSE_SENTENCE, AGENT_COMMAND_MODIFICATION_SENTENCE, AGENT_JSON_MODE_SENTENCE, AGENT_LOCAL_KEY_SENTENCE, AGENT_NETWORK_ACCESS_SENTENCE, AGENT_ONBOARDING_PROMPT, AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AGENT_README_SECTION_MD, AGENT_SECRET_HYGIENE_SENTENCE, AGENT_WIRING_COLLISION_RELAY_SENTENCE, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionAccountAlias, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, CONNECTOR_PACKAGE_NAME, DEFAULT_CONFIRMATION_TIMEOUT_MS, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_AGENT_RUNBOOK_MD, HAVEN_CONNECTOR_CHANNEL, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenApiError, HavenClient, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, MerchantTimeoutError, RECEIPT_VERSION, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402AlreadySettledError, X402PaymentHeaderValidationError, X402UnexpectedStatusError, X402_LEGACY_PAYMENT_HEADER_NAME, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_PAYMENT_HEADER_NAME, X402_PAYMENT_HEADER_NAMES_SENT, X402_PAYMENT_REQUIRED_HEADER_NAME, X402_PAYMENT_RESPONSE_HEADER_NAME, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, accountAddressTwins, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, canonicalAgentPaymentNextAction, compareNodeVersions, composeDescription, connectorRerunCommand, connectorSpec, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isConnectorChannel, isErc7710Option, isFundAccountOrRaiseAllowance, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, readAccountAddress, readAccountId, readX402ReceiptPayer, resolveConnectorChannel, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, signerUpdateFallback, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses, x402V2PaymentEnvelope };
5010
+ export { AGENT_APPROVAL_RELAY_JSON_SENTENCE, AGENT_APPROVAL_RELAY_PROSE_SENTENCE, AGENT_COMMAND_MODIFICATION_SENTENCE, AGENT_JSON_MODE_SENTENCE, AGENT_LOCAL_KEY_SENTENCE, AGENT_NETWORK_ACCESS_SENTENCE, AGENT_ONBOARDING_PROMPT, AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AGENT_README_SECTION_MD, AGENT_SECRET_HYGIENE_SENTENCE, AGENT_WIRING_COLLISION_RELAY_SENTENCE, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, CONNECTOR_PACKAGE_NAME, DEFAULT_CONFIRMATION_TIMEOUT_MS, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_AGENT_RUNBOOK_MD, HAVEN_CONNECTOR_CHANNEL, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenApiError, HavenClient, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, HavenZeroSettlementHashError, MERCHANT_DISCOVERY_PATHS, MerchantTimeoutError, RECEIPT_VERSION, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402AlreadySettledError, X402PaymentHeaderValidationError, X402UnexpectedStatusError, X402_LEGACY_PAYMENT_HEADER_NAME, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_PAYMENT_HEADER_NAME, X402_PAYMENT_HEADER_NAMES_SENT, X402_PAYMENT_REQUIRED_HEADER_NAME, X402_PAYMENT_RESPONSE_HEADER_NAME, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, connectorRerunCommand, connectorSpec, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isConnectorChannel, isErc7710Option, isSupportedNodeVersion, isSweepableChain, isZeroSettlementTxHash, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, readX402ReceiptPayer, resolveConnectorChannel, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, signerUpdateFallback, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses, x402V2PaymentEnvelope };
4862
5011
  //# sourceMappingURL=index.js.map
4863
5012
  //# sourceMappingURL=index.js.map