@haven_ai/sdk 0.9.0-alpha.0 → 0.10.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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/dist/{base64-BZDPJ8M1.d.ts → base64-CiR5BJhk.d.cts} +11 -3
  3. package/dist/{base64-Cyxhsvqd.d.cts → base64-CxkinHPQ.d.ts} +11 -3
  4. package/dist/{chunk-ZDKNPNI3.cjs → chunk-22FJ4JQO.cjs} +41 -35
  5. package/dist/chunk-22FJ4JQO.cjs.map +1 -0
  6. package/dist/{chunk-7UTWSJC5.cjs → chunk-6LEXYQ7J.cjs} +4 -4
  7. package/dist/{chunk-7UTWSJC5.cjs.map → chunk-6LEXYQ7J.cjs.map} +1 -1
  8. package/dist/{chunk-VRKWNJ7H.js → chunk-EWTHDEIW.js} +3 -3
  9. package/dist/{chunk-VRKWNJ7H.js.map → chunk-EWTHDEIW.js.map} +1 -1
  10. package/dist/{chunk-4Z6ATE44.cjs → chunk-H37YVYZA.cjs} +6 -4
  11. package/dist/chunk-H37YVYZA.cjs.map +1 -0
  12. package/dist/{chunk-424S4QMG.js → chunk-MLUWABVT.js} +10 -6
  13. package/dist/chunk-MLUWABVT.js.map +1 -0
  14. package/dist/{chunk-J7N4LUZZ.js → chunk-TD2PHUYP.js} +6 -4
  15. package/dist/chunk-TD2PHUYP.js.map +1 -0
  16. package/dist/edge.cjs +99 -91
  17. package/dist/edge.d.cts +4 -4
  18. package/dist/edge.d.ts +4 -4
  19. package/dist/edge.js +4 -4
  20. package/dist/index.cjs +430 -333
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +41 -9
  23. package/dist/index.d.ts +41 -9
  24. package/dist/index.js +109 -21
  25. package/dist/index.js.map +1 -1
  26. package/dist/{receipt-WkXHZGbu.d.ts → receipt-Cg9a5Seq.d.ts} +1 -1
  27. package/dist/{receipt-D4Roey3D.d.cts → receipt-q7ez8Zb2.d.cts} +1 -1
  28. package/dist/test-support.cjs +21 -21
  29. package/dist/test-support.d.cts +2 -2
  30. package/dist/test-support.d.ts +2 -2
  31. package/dist/test-support.js +2 -2
  32. package/dist/{types-CrszUJ7Z.d.cts → types-BKgqzvnk.d.cts} +31 -2
  33. package/dist/{types-CrszUJ7Z.d.ts → types-BKgqzvnk.d.ts} +31 -2
  34. package/package.json +1 -1
  35. package/dist/chunk-424S4QMG.js.map +0 -1
  36. package/dist/chunk-4Z6ATE44.cjs.map +0 -1
  37. package/dist/chunk-J7N4LUZZ.js.map +0 -1
  38. package/dist/chunk-ZDKNPNI3.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkZDKNPNI3_cjs = require('./chunk-ZDKNPNI3.cjs');
4
- var chunk7UTWSJC5_cjs = require('./chunk-7UTWSJC5.cjs');
5
- var chunk4Z6ATE44_cjs = require('./chunk-4Z6ATE44.cjs');
3
+ var chunk22FJ4JQO_cjs = require('./chunk-22FJ4JQO.cjs');
4
+ var chunk6LEXYQ7J_cjs = require('./chunk-6LEXYQ7J.cjs');
5
+ var chunkH37YVYZA_cjs = require('./chunk-H37YVYZA.cjs');
6
6
  var viem = require('viem');
7
7
  var ethers = require('ethers');
8
8
  var async_hooks = require('async_hooks');
@@ -15,7 +15,7 @@ function signHash(privateKey, hash) {
15
15
  const sig = signingKey.sign(hash);
16
16
  return sig.serialized;
17
17
  } catch (err) {
18
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
18
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
19
19
  `Failed to sign hash: ${err instanceof Error ? err.message : String(err)}`
20
20
  );
21
21
  }
@@ -31,7 +31,7 @@ async function signTypedDataVerbatim(privateKey, typedData, label) {
31
31
  typedData.message
32
32
  );
33
33
  } catch (err) {
34
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
34
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
35
35
  `Failed to sign ${label}: ${err instanceof Error ? err.message : String(err)}`
36
36
  );
37
37
  }
@@ -46,7 +46,7 @@ function addressFromKey(privateKey) {
46
46
  try {
47
47
  return new ethers.ethers.Wallet(privateKey).address;
48
48
  } catch (err) {
49
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
49
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
50
50
  `Invalid private key: ${err instanceof Error ? err.message : String(err)}`
51
51
  );
52
52
  }
@@ -62,7 +62,7 @@ function verifySignature(hash, signature, expectedAddress) {
62
62
  var DEFAULT_BASE_URL = "http://localhost:3001";
63
63
  var DEFAULT_REQUEST_TIMEOUT = 3e4;
64
64
  function withoutClientHeader(headers) {
65
- const target = chunkZDKNPNI3_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
65
+ const target = chunk22FJ4JQO_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
66
66
  return Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== target));
67
67
  }
68
68
  var HavenApiTransport = class {
@@ -78,7 +78,7 @@ var HavenApiTransport = class {
78
78
  this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
79
79
  this.requestTimeout = config.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
80
80
  this.defaultHeaders = { ...config.defaultHeaders ?? {} };
81
- this.clientIdentity = config.clientIdentity ?? chunkZDKNPNI3_cjs.SDK_CLIENT_IDENTITY;
81
+ this.clientIdentity = config.clientIdentity ?? chunk22FJ4JQO_cjs.SDK_CLIENT_IDENTITY;
82
82
  }
83
83
  /**
84
84
  * The newest `client_update` the backend sent (#3303): inside a
@@ -91,7 +91,7 @@ var HavenApiTransport = class {
91
91
  }
92
92
  recordClientUpdate(data) {
93
93
  if (data === null || typeof data !== "object" || Array.isArray(data)) return;
94
- const hint = chunkZDKNPNI3_cjs.readClientUpdate(data.client_update);
94
+ const hint = chunk22FJ4JQO_cjs.readClientUpdate(data.client_update);
95
95
  if (!hint) return;
96
96
  this.lastClientUpdate = hint;
97
97
  const store = this.requestContext.getStore();
@@ -124,7 +124,7 @@ var HavenApiTransport = class {
124
124
  // JOIN `x-haven-client` and `X-Haven-Client` into one unparseable
125
125
  // value), so neither `defaultHeaders` nor a dispatch context can
126
126
  // misname the client; `clientIdentity` is the one way to set it.
127
- [chunkZDKNPNI3_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
127
+ [chunk22FJ4JQO_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
128
128
  },
129
129
  body: body ? JSON.stringify(body) : void 0,
130
130
  signal: controller.signal
@@ -137,15 +137,15 @@ var HavenApiTransport = class {
137
137
  const rawDetails = record.details ?? record.detail;
138
138
  const detailsText = typeof rawDetails === "string" ? rawDetails : rawDetails != null ? JSON.stringify(rawDetails) : void 0;
139
139
  const message = errorText && detailsText ? `${errorText}: ${detailsText}` : errorText ?? detailsText ?? "API request failed";
140
- throw new chunk4Z6ATE44_cjs.HavenApiError(message, res.status, data);
140
+ throw new chunkH37YVYZA_cjs.HavenApiError(message, res.status, data);
141
141
  }
142
142
  return data;
143
143
  } catch (err) {
144
- if (err instanceof chunk4Z6ATE44_cjs.HavenApiError) throw err;
144
+ if (err instanceof chunkH37YVYZA_cjs.HavenApiError) throw err;
145
145
  if (err instanceof Error && err.name === "AbortError") {
146
- throw new chunk4Z6ATE44_cjs.HavenApiError(`Request to ${path} timed out`, 408);
146
+ throw new chunkH37YVYZA_cjs.HavenApiError(`Request to ${path} timed out`, 408);
147
147
  }
148
- throw new chunk4Z6ATE44_cjs.HavenApiError(
148
+ throw new chunkH37YVYZA_cjs.HavenApiError(
149
149
  `Request to ${path} failed: ${err instanceof Error ? err.message : String(err)}`,
150
150
  0
151
151
  );
@@ -168,13 +168,13 @@ async function fetchUnsignedTaxDeclaration(client) {
168
168
  if (reason === "feature_disabled" || reason === "disabled" || reason === "no_company_details" || reason === "vies_not_valid") {
169
169
  return { available: false, reason };
170
170
  }
171
- throw new chunk4Z6ATE44_cjs.HavenApiError(
171
+ throw new chunkH37YVYZA_cjs.HavenApiError(
172
172
  "The tax-declaration endpoint answered a body that is neither the \xA72.1 content nor a named unavailability reason.",
173
173
  502
174
174
  );
175
175
  }
176
176
  async function resolveTaxDeclarationHeader(client, input) {
177
- if (chunkZDKNPNI3_cjs.isErc7710Option(input.accepted)) {
177
+ if (chunk22FJ4JQO_cjs.isErc7710Option(input.accepted)) {
178
178
  return { header: void 0 };
179
179
  }
180
180
  let content;
@@ -186,7 +186,7 @@ async function resolveTaxDeclarationHeader(client, input) {
186
186
  if (!content.available) {
187
187
  return { header: void 0 };
188
188
  }
189
- const signed = chunkZDKNPNI3_cjs.buildSignedTaxDeclaration({
189
+ const signed = chunk22FJ4JQO_cjs.buildSignedTaxDeclaration({
190
190
  content: content.declaration,
191
191
  network: input.accepted.network,
192
192
  delegateKey: input.delegateKey
@@ -195,19 +195,19 @@ async function resolveTaxDeclarationHeader(client, input) {
195
195
  `[haven-sdk] signing x402 tax declaration taxId=${JSON.stringify(content.declaration.taxId)} jurisdiction=${JSON.stringify(content.declaration.jurisdiction)} principalId=${signed.declaration.principalId}
196
196
  `
197
197
  );
198
- return { header: chunkZDKNPNI3_cjs.encodeTaxDeclarationHeader(signed) };
198
+ return { header: chunk22FJ4JQO_cjs.encodeTaxDeclarationHeader(signed) };
199
199
  }
200
200
  function withTaxDeclarationHeader(init, header) {
201
201
  if (!header) {
202
- if (init?.headers && new Headers(init.headers).has(chunkZDKNPNI3_cjs.X_TAX_DECLARATION_HEADER)) {
202
+ if (init?.headers && new Headers(init.headers).has(chunk22FJ4JQO_cjs.X_TAX_DECLARATION_HEADER)) {
203
203
  const headers2 = new Headers(init.headers);
204
- headers2.delete(chunkZDKNPNI3_cjs.X_TAX_DECLARATION_HEADER);
204
+ headers2.delete(chunk22FJ4JQO_cjs.X_TAX_DECLARATION_HEADER);
205
205
  return { ...init, headers: headers2 };
206
206
  }
207
207
  return init ?? {};
208
208
  }
209
209
  const headers = new Headers(init?.headers);
210
- headers.set(chunkZDKNPNI3_cjs.X_TAX_DECLARATION_HEADER, header);
210
+ headers.set(chunk22FJ4JQO_cjs.X_TAX_DECLARATION_HEADER, header);
211
211
  return { ...init, headers };
212
212
  }
213
213
 
@@ -373,29 +373,29 @@ function paymentStateStatusCode(status, fallback = 502) {
373
373
  return PAYMENT_STATE_STATUS_CODES[status] ?? fallback;
374
374
  }
375
375
  function phaseForStatus(status) {
376
- if (status === "pending_signature") return chunk4Z6ATE44_cjs.AgentPaymentPhase.AgentSignatureRequired;
377
- if (status === "submitted") return chunk4Z6ATE44_cjs.AgentPaymentPhase.PaymentSubmitted;
378
- if (status === "confirmed") return chunk4Z6ATE44_cjs.AgentPaymentPhase.PaymentConfirmed;
379
- if (status === "pending" || status === "pending_approval") return chunk4Z6ATE44_cjs.AgentPaymentPhase.UserApprovalRequired;
380
- if (status === "approved") return chunk4Z6ATE44_cjs.AgentPaymentPhase.UserExecutionRequired;
381
- if (status === "proposed") return chunk4Z6ATE44_cjs.AgentPaymentPhase.WaitingForAdditionalApprovals;
382
- if (status === "executed") return chunk4Z6ATE44_cjs.AgentPaymentPhase.FundingSent;
383
- if (status === "rejected") return chunk4Z6ATE44_cjs.AgentPaymentPhase.Rejected;
384
- if (status === "expired") return chunk4Z6ATE44_cjs.AgentPaymentPhase.Expired;
385
- if (status === "failed") return chunk4Z6ATE44_cjs.AgentPaymentPhase.Failed;
376
+ if (status === "pending_signature") return chunkH37YVYZA_cjs.AgentPaymentPhase.AgentSignatureRequired;
377
+ if (status === "submitted") return chunkH37YVYZA_cjs.AgentPaymentPhase.PaymentSubmitted;
378
+ if (status === "confirmed") return chunkH37YVYZA_cjs.AgentPaymentPhase.PaymentConfirmed;
379
+ if (status === "pending" || status === "pending_approval") return chunkH37YVYZA_cjs.AgentPaymentPhase.UserApprovalRequired;
380
+ if (status === "approved") return chunkH37YVYZA_cjs.AgentPaymentPhase.UserExecutionRequired;
381
+ if (status === "proposed") return chunkH37YVYZA_cjs.AgentPaymentPhase.WaitingForAdditionalApprovals;
382
+ if (status === "executed") return chunkH37YVYZA_cjs.AgentPaymentPhase.FundingSent;
383
+ if (status === "rejected") return chunkH37YVYZA_cjs.AgentPaymentPhase.Rejected;
384
+ if (status === "expired") return chunkH37YVYZA_cjs.AgentPaymentPhase.Expired;
385
+ if (status === "failed") return chunkH37YVYZA_cjs.AgentPaymentPhase.Failed;
386
386
  return null;
387
387
  }
388
388
  function nextActionForStatus(status) {
389
- if (status === "pending_signature") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.SignAndSubmitPayment;
390
- if (status === "submitted") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.CheckStatusLater;
391
- if (status === "confirmed") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.None;
392
- if (status === "pending" || status === "pending_approval") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.StopAndTellUser;
393
- if (status === "approved") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.StopAndTellUser;
394
- if (status === "proposed") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.StopAndTellUser;
395
- if (status === "executed") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.StopAndTellUser;
396
- if (status === "rejected") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.StopAndTellUser;
397
- if (status === "expired") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.RequestAgainIfUserStillWantsIt;
398
- if (status === "failed") return chunk4Z6ATE44_cjs.AgentPaymentNextAction.StopAndTellUser;
389
+ if (status === "pending_signature") return chunkH37YVYZA_cjs.AgentPaymentNextAction.SignAndSubmitPayment;
390
+ if (status === "submitted") return chunkH37YVYZA_cjs.AgentPaymentNextAction.CheckStatusLater;
391
+ if (status === "confirmed") return chunkH37YVYZA_cjs.AgentPaymentNextAction.None;
392
+ if (status === "pending" || status === "pending_approval") return chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser;
393
+ if (status === "approved") return chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser;
394
+ if (status === "proposed") return chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser;
395
+ if (status === "executed") return chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser;
396
+ if (status === "rejected") return chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser;
397
+ if (status === "expired") return chunkH37YVYZA_cjs.AgentPaymentNextAction.RequestAgainIfUserStillWantsIt;
398
+ if (status === "failed") return chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser;
399
399
  return null;
400
400
  }
401
401
  function messageForState(label, status, paymentId, nextAction) {
@@ -469,17 +469,17 @@ function throwPaymentStateError(label, raw) {
469
469
  const statusCode = paymentStateStatusCode(raw.status);
470
470
  const state = paymentStateFromRaw(label, raw);
471
471
  if (state) {
472
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(state.message, statusCode, state, raw);
472
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(state.message, statusCode, state, raw);
473
473
  }
474
474
  if (raw.status === "pending_approval") {
475
- throw new chunk4Z6ATE44_cjs.HavenApiError(
475
+ throw new chunkH37YVYZA_cjs.HavenApiError(
476
476
  `${label} exceeds the agent's on-chain budget and was declined; no approval is pending and none will arrive (payment_id: ${raw.payment_id}).`,
477
477
  statusCode,
478
478
  raw
479
479
  );
480
480
  }
481
481
  if (raw.status === "expired") {
482
- throw new chunk4Z6ATE44_cjs.HavenApiError(
482
+ throw new chunkH37YVYZA_cjs.HavenApiError(
483
483
  `${label} expired before it could be completed (payment_id: ${raw.payment_id}).`,
484
484
  statusCode,
485
485
  raw
@@ -487,7 +487,7 @@ function throwPaymentStateError(label, raw) {
487
487
  }
488
488
  const paymentId = raw.payment_id ? ` (payment_id: ${raw.payment_id})` : "";
489
489
  const message = raw.error ?? `${label} ${raw.status}${paymentId}`;
490
- throw new chunk4Z6ATE44_cjs.HavenApiError(message, statusCode, raw);
490
+ throw new chunkH37YVYZA_cjs.HavenApiError(message, statusCode, raw);
491
491
  }
492
492
 
493
493
  // src/x402-retry-target.ts
@@ -519,7 +519,7 @@ function isSecureX402RetryTarget(url) {
519
519
  return RESERVED_SUFFIXES.some((suffix) => host.endsWith(suffix));
520
520
  }
521
521
  var INSECURE_RETRY_TARGET_CODE = "INSECURE_RETRY_TARGET";
522
- var HavenInsecureRetryTargetError = class extends chunk4Z6ATE44_cjs.HavenError {
522
+ var HavenInsecureRetryTargetError = class extends chunkH37YVYZA_cjs.HavenError {
523
523
  constructor(url) {
524
524
  super(
525
525
  `Refusing to send a payment header to ${url}: the paid x402 retry must go to an https URL (or a loopback / reserved test host). The merchant's challenge declared this resource URL; retry with the https URL you quoted (pass it as \`url\`), and report a merchant whose challenge downgrades the scheme.`,
@@ -537,7 +537,7 @@ function assertSecureX402RetryTarget(url) {
537
537
 
538
538
  // src/merchant-egress.ts
539
539
  var MERCHANT_EGRESS_REFUSED_CODE = "MERCHANT_EGRESS_REFUSED";
540
- var MerchantEgressRefusedError = class extends chunk4Z6ATE44_cjs.HavenError {
540
+ var MerchantEgressRefusedError = class extends chunkH37YVYZA_cjs.HavenError {
541
541
  url;
542
542
  refusal;
543
543
  beforeRequest;
@@ -550,7 +550,7 @@ var MerchantEgressRefusedError = class extends chunk4Z6ATE44_cjs.HavenError {
550
550
  }
551
551
  };
552
552
  var MERCHANT_EGRESS_RESPONSE_CAP_CODE = "MERCHANT_EGRESS_RESPONSE_CAP";
553
- var MerchantEgressResponseCapError = class extends chunk4Z6ATE44_cjs.HavenError {
553
+ var MerchantEgressResponseCapError = class extends chunkH37YVYZA_cjs.HavenError {
554
554
  url;
555
555
  limitBytes;
556
556
  constructor(message, limitBytes, url) {
@@ -698,7 +698,7 @@ var McpMerchantTransport = class {
698
698
  return await this.fetchImpl(url, { ...init, signal });
699
699
  } catch (err) {
700
700
  if (timeoutSignal.aborted) {
701
- throw new chunk4Z6ATE44_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${url}`);
701
+ throw new chunkH37YVYZA_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${url}`);
702
702
  }
703
703
  throw err;
704
704
  }
@@ -781,7 +781,7 @@ var McpMerchantTransport = class {
781
781
  }
782
782
  } catch (err) {
783
783
  if (timeoutSignal.aborted) {
784
- throw new chunk4Z6ATE44_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${currentUrl}`);
784
+ throw new chunkH37YVYZA_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${currentUrl}`);
785
785
  }
786
786
  throw err;
787
787
  }
@@ -869,7 +869,7 @@ var McpMerchantTransport = class {
869
869
  text = await response.clone().text();
870
870
  } catch (err) {
871
871
  if (err instanceof MerchantEgressResponseCapError) throw err;
872
- if (isBodyPhaseTimeout(err)) throw new chunk4Z6ATE44_cjs.MerchantTimeoutError(`Merchant response body read timed out.`);
872
+ if (isBodyPhaseTimeout(err)) throw new chunkH37YVYZA_cjs.MerchantTimeoutError(`Merchant response body read timed out.`);
873
873
  return void 0;
874
874
  }
875
875
  if ((response.headers.get("content-type") ?? "").includes("text/event-stream")) {
@@ -894,7 +894,7 @@ var McpMerchantTransport = class {
894
894
  text = await response.clone().text();
895
895
  } catch (err) {
896
896
  if (err instanceof MerchantEgressResponseCapError) throw err;
897
- if (isBodyPhaseTimeout(err)) throw new chunk4Z6ATE44_cjs.MerchantTimeoutError(`Merchant response body read timed out.`);
897
+ if (isBodyPhaseTimeout(err)) throw new chunkH37YVYZA_cjs.MerchantTimeoutError(`Merchant response body read timed out.`);
898
898
  return response;
899
899
  }
900
900
  const message = selectJsonRpcResult(parseSseJsonRpcMessages(text));
@@ -956,8 +956,8 @@ var McpMerchantTransport = class {
956
956
  async deliverPayment(url, init, paymentHeader) {
957
957
  assertSecureX402RetryTarget(url);
958
958
  const headers = new Headers(init?.headers);
959
- const send = chunkZDKNPNI3_cjs.x402PaymentHeaderNamesFor(paymentHeader);
960
- for (const name of chunkZDKNPNI3_cjs.X402_PAYMENT_HEADER_NAMES) {
959
+ const send = chunk22FJ4JQO_cjs.x402PaymentHeaderNamesFor(paymentHeader);
960
+ for (const name of chunk22FJ4JQO_cjs.X402_PAYMENT_HEADER_NAMES) {
961
961
  if (send.includes(name)) headers.set(name, paymentHeader);
962
962
  else headers.delete(name);
963
963
  }
@@ -1044,7 +1044,7 @@ function mcpToolResultOf(value) {
1044
1044
  function extractMcpPaymentRequired(toolResult) {
1045
1045
  if (toolResult.isError !== true) return void 0;
1046
1046
  if (isRecord(toolResult.structuredContent)) {
1047
- const parsed = chunkZDKNPNI3_cjs.normalizePaymentRequired(toolResult.structuredContent);
1047
+ const parsed = chunk22FJ4JQO_cjs.normalizePaymentRequired(toolResult.structuredContent);
1048
1048
  if (parsed) return parsed;
1049
1049
  }
1050
1050
  if (Array.isArray(toolResult.content)) {
@@ -1056,7 +1056,7 @@ function extractMcpPaymentRequired(toolResult) {
1056
1056
  } catch {
1057
1057
  continue;
1058
1058
  }
1059
- const parsed = chunkZDKNPNI3_cjs.normalizePaymentRequired(candidate);
1059
+ const parsed = chunk22FJ4JQO_cjs.normalizePaymentRequired(candidate);
1060
1060
  if (parsed) return parsed;
1061
1061
  }
1062
1062
  }
@@ -1080,7 +1080,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
1080
1080
  if (!request) return init;
1081
1081
  let envelope;
1082
1082
  try {
1083
- envelope = chunkZDKNPNI3_cjs.decodeBase64Json(paymentHeader);
1083
+ envelope = chunk22FJ4JQO_cjs.decodeBase64Json(paymentHeader);
1084
1084
  } catch {
1085
1085
  return init;
1086
1086
  }
@@ -1096,7 +1096,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
1096
1096
  };
1097
1097
  }
1098
1098
  function encodeMcpSettlementReceipt(settlement) {
1099
- return chunkZDKNPNI3_cjs.encodeBase64Json(settlement);
1099
+ return chunk22FJ4JQO_cjs.encodeBase64Json(settlement);
1100
1100
  }
1101
1101
  function parseJsonRpcToolsCall(body) {
1102
1102
  if (typeof body !== "string") return void 0;
@@ -1214,7 +1214,7 @@ function deriveReadiness(status, allowances) {
1214
1214
  return allowances.some((allowance) => safeBigInt(allowance.remainingAtomic) > 0n) ? "ready" : "needs_approval";
1215
1215
  }
1216
1216
  function formatRemainingDisplay(tokenAddress, tokenSymbol, remainingAtomic) {
1217
- const token = chunkZDKNPNI3_cjs.resolveTokenFromAddress(tokenAddress);
1217
+ const token = chunk22FJ4JQO_cjs.resolveTokenFromAddress(tokenAddress);
1218
1218
  return token ? `${formatAtomicAmount(safeBigInt(remainingAtomic), token.decimals)} ${tokenSymbol}` : `${remainingAtomic} ${tokenSymbol} (atomic; unknown decimals)`;
1219
1219
  }
1220
1220
  function formatTokenAmount(atomic, decimals) {
@@ -1225,6 +1225,19 @@ function formatTokenAmount(atomic, decimals) {
1225
1225
  const fracPart = digits.slice(digits.length - decimals).replace(/0+$/, "");
1226
1226
  return fracPart ? `${intPart}.${fracPart}` : intPart;
1227
1227
  }
1228
+ function mapSupersession(raw) {
1229
+ if (typeof raw !== "object" || raw === null) return null;
1230
+ const { agent_id: replacementAgentId, superseded_at: supersededAt } = raw;
1231
+ if (typeof replacementAgentId !== "string" || replacementAgentId === "") return null;
1232
+ if (typeof supersededAt !== "string" || supersededAt === "") return null;
1233
+ return {
1234
+ replacementAgentId,
1235
+ supersededAt,
1236
+ warning: `This agent was replaced on its machine by agent ${replacementAgentId} at ${supersededAt}. This session is still running as the old agent: restart the agent runtime so it loads the new agent, and ask the user to remove this agent on its Haven agent page if it is no longer used \u2014 it keeps any budget it still holds until then.`,
1237
+ nextAction: chunkH37YVYZA_cjs.AgentPaymentNextAction.StopAndTellUser,
1238
+ nextToolOmittedReason: "The next step is the user's: restart this session, and remove the superseded agent in the Haven dashboard. No Haven tool does either."
1239
+ };
1240
+ }
1228
1241
  function mapTaskBudget(raw) {
1229
1242
  return {
1230
1243
  id: raw.id,
@@ -1290,7 +1303,7 @@ function summarizePendingSubBudget(row) {
1290
1303
  };
1291
1304
  }
1292
1305
  function summarizeTaskBudget(taskBudget) {
1293
- const token = chunkZDKNPNI3_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
1306
+ const token = chunk22FJ4JQO_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
1294
1307
  const maxDisplay = token ? `${formatAtomicAmount(safeBigInt(taskBudget.maxAtomic), token.decimals)} ${token.symbol}` : `${taskBudget.maxAtomic} (atomic; unknown decimals)`;
1295
1308
  const spendDisplay = (atomic) => {
1296
1309
  if (atomic === null) return null;
@@ -1418,7 +1431,7 @@ var AccountReads = class {
1418
1431
  async listTaskBudgetsSummary() {
1419
1432
  try {
1420
1433
  const raw = await this.transport.get("/task-budgets?status=live").catch((error) => {
1421
- if (error instanceof chunk4Z6ATE44_cjs.HavenApiError && error.statusCode === 400) {
1434
+ if (error instanceof chunkH37YVYZA_cjs.HavenApiError && error.statusCode === 400) {
1422
1435
  return this.transport.get("/task-budgets?status=all");
1423
1436
  }
1424
1437
  throw error;
@@ -1460,6 +1473,7 @@ var AccountReads = class {
1460
1473
  accountAddress: raw.account_address,
1461
1474
  delegateAddress: raw.delegate_address,
1462
1475
  chainId: raw.chain_id,
1476
+ supersededBy: mapSupersession(raw.superseded_by),
1463
1477
  allowances: raw.allowances.map((allowance) => ({
1464
1478
  id: allowance.id,
1465
1479
  tokenAddress: allowance.token_address,
@@ -1525,7 +1539,7 @@ var AccountReads = class {
1525
1539
  payment: payment2,
1526
1540
  allowance: null,
1527
1541
  warnings: [{
1528
- code: chunk4Z6ATE44_cjs.AgentPaymentWarningCode.AllowanceCheckUnavailable,
1542
+ code: chunkH37YVYZA_cjs.AgentPaymentWarningCode.AllowanceCheckUnavailable,
1529
1543
  message: `Could not read the post-purchase allowance/budget for payment ${paymentId} (${detail}). The payment itself succeeded \u2014 the on-chain policy remains the actual spend gate; this only affects the remaining-budget figure reported here.`
1530
1544
  }]
1531
1545
  });
@@ -1618,7 +1632,7 @@ var AccountReads = class {
1618
1632
  */
1619
1633
  async getReceipt(paymentId) {
1620
1634
  const { receipt } = await this.transport.get(`/payments/${paymentId}/receipt`);
1621
- return { receipt, verification: chunk7UTWSJC5_cjs.verifyPaymentReceipt(receipt) };
1635
+ return { receipt, verification: chunk6LEXYQ7J_cjs.verifyPaymentReceipt(receipt) };
1622
1636
  }
1623
1637
  async fetchAgent() {
1624
1638
  const raw = await this.transport.get("/machine-payments/agent");
@@ -1632,7 +1646,8 @@ var AccountReads = class {
1632
1646
  accountAddress: raw.account_address,
1633
1647
  delegateAddress: raw.delegate_address,
1634
1648
  chainId: raw.chain_id,
1635
- executionRail: raw.execution_rail === "delegation" ? "delegation" : "legacy"
1649
+ executionRail: raw.execution_rail === "delegation" ? "delegation" : "legacy",
1650
+ supersededBy: mapSupersession(raw.superseded_by)
1636
1651
  };
1637
1652
  }
1638
1653
  };
@@ -1653,7 +1668,7 @@ function isWaitTimeout(err) {
1653
1668
  async function waitForSweepTx(tx) {
1654
1669
  let receipt;
1655
1670
  try {
1656
- receipt = await tx.wait(1, chunk4Z6ATE44_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS);
1671
+ receipt = await tx.wait(1, chunkH37YVYZA_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS);
1657
1672
  } catch (err) {
1658
1673
  if (!isWaitTimeout(err)) throw err;
1659
1674
  return { txHash: tx.hash, confirmation: "unconfirmed" };
@@ -1667,16 +1682,16 @@ var DelegateSweepApi = class {
1667
1682
  }
1668
1683
  options;
1669
1684
  async sweepDelegate() {
1670
- if (!this.options.delegateKey) throw new chunk4Z6ATE44_cjs.HavenSigningError("delegateKey is required for sweepDelegate.");
1685
+ if (!this.options.delegateKey) throw new chunkH37YVYZA_cjs.HavenSigningError("delegateKey is required for sweepDelegate.");
1671
1686
  const agent = await this.options.getAgent();
1672
- if (!agent.delegateAddress) throw new chunk4Z6ATE44_cjs.HavenApiError("Agent has no delegate address.", 422);
1687
+ if (!agent.delegateAddress) throw new chunkH37YVYZA_cjs.HavenApiError("Agent has no delegate address.", 422);
1673
1688
  const rpcUrl = this.options.chainRpcs[agent.chainId];
1674
- if (!rpcUrl) throw new chunk4Z6ATE44_cjs.HavenApiError(`chainRpcs[${agent.chainId}] must be configured to sweep the delegate wallet.`, 422);
1689
+ if (!rpcUrl) throw new chunkH37YVYZA_cjs.HavenApiError(`chainRpcs[${agent.chainId}] must be configured to sweep the delegate wallet.`, 422);
1675
1690
  const provider = createJsonRpcProvider(rpcUrl);
1676
1691
  const wallet = createWallet(this.options.delegateKey, provider);
1677
1692
  const transfers = [];
1678
- if (chunkZDKNPNI3_cjs.isSweepableChain(agent.chainId)) {
1679
- const contract = createErc20Contract(chunkZDKNPNI3_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
1693
+ if (chunk22FJ4JQO_cjs.isSweepableChain(agent.chainId)) {
1694
+ const contract = createErc20Contract(chunk22FJ4JQO_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
1680
1695
  const balance2 = await contract.balanceOf(agent.delegateAddress);
1681
1696
  if (balance2 > 0n) {
1682
1697
  const tx = await contract.transfer(agent.accountAddress, balance2);
@@ -1764,7 +1779,7 @@ function snapshotRequestBody(body) {
1764
1779
  if (body == null) return void 0;
1765
1780
  if (typeof body === "string") return body;
1766
1781
  if (body instanceof URLSearchParams) return body.toString();
1767
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1782
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1768
1783
  "Quote helpers can only capture resumable request bodies that are strings or URLSearchParams. For streams, blobs, or binary bodies, preserve the original request yourself and call the matching resume method with fresh init.",
1769
1784
  400
1770
1785
  );
@@ -1785,12 +1800,12 @@ function requestInitFromSnapshot(request) {
1785
1800
  };
1786
1801
  }
1787
1802
  function noCompatiblePaymentOptionError(accepts) {
1788
- const erc7710Only = chunkZDKNPNI3_cjs.selectErc7710PaymentOption(accepts) !== null;
1803
+ const erc7710Only = chunk22FJ4JQO_cjs.selectErc7710PaymentOption(accepts) !== null;
1789
1804
  const unsupportedOnly = !erc7710Only && accepts.some(
1790
- (opt) => opt !== null && typeof opt === "object" && !chunkZDKNPNI3_cjs.isErc7710Option(opt) && (chunkZDKNPNI3_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
1805
+ (opt) => opt !== null && typeof opt === "object" && !chunk22FJ4JQO_cjs.isErc7710Option(opt) && (chunk22FJ4JQO_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
1791
1806
  );
1792
1807
  const offeredSchemes = nonExactSchemesOnly(accepts);
1793
- return new chunk4Z6ATE44_cjs.HavenApiError(
1808
+ return new chunkH37YVYZA_cjs.HavenApiError(
1794
1809
  "No compatible payment option found in x402 requirements. Haven supports standard x402 exact payments on Base USDC." + (offeredSchemes ? ` The merchant offered only ${offeredSchemes}; Haven pays only the 'exact' scheme. For a request with a body, this often means the body or its Content-Type was missing or invalid: send the full request again (method, body, and Content-Type: application/json for a JSON API).` : erc7710Only ? " The only Haven-compatible option this merchant advertises is tagged extra.assetTransferMethod: 'erc7710' (direct settlement), which this EIP-3009 payment path cannot settle \u2014 the limitation is the settlement scheme, not the asset. Paying this merchant requires a delegation-rail erc7710 flow (settleX402Erc7710, or the hosted MCP purchase tools)." : unsupportedOnly ? " Every option this merchant advertises asks for a transfer method or payment flow Haven cannot construct (for example extra.assetTransferMethod: 'permit2', or an unrecognized extra.paymentFlow). No payment intent was created and no funds moved." : ""),
1795
1810
  400
1796
1811
  );
@@ -1809,15 +1824,15 @@ function nonExactSchemesOnly(accepts) {
1809
1824
  return schemes.map((s) => `'${s}'`).join(", ");
1810
1825
  }
1811
1826
  function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport) {
1812
- const standard = chunkZDKNPNI3_cjs.selectStandardPaymentOption(paymentRequired.accepts);
1813
- const option = standard ?? chunkZDKNPNI3_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
1827
+ const standard = chunk22FJ4JQO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
1828
+ const option = standard ?? chunk22FJ4JQO_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
1814
1829
  if (!option) {
1815
1830
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
1816
1831
  }
1817
- const token = chunkZDKNPNI3_cjs.resolveTokenFromAddress(option.asset, option.network);
1832
+ const token = chunk22FJ4JQO_cjs.resolveTokenFromAddress(option.asset, option.network);
1818
1833
  return {
1819
1834
  rail: "x402",
1820
- idempotencyKey: idempotencyKey ?? chunkZDKNPNI3_cjs.buildX402IdempotencyKey(paymentRequired, option),
1835
+ idempotencyKey: idempotencyKey ?? chunk22FJ4JQO_cjs.buildX402IdempotencyKey(paymentRequired, option),
1821
1836
  paymentRequired,
1822
1837
  accepted: option,
1823
1838
  acceptedScheme: standard ? "standard" : "erc7710",
@@ -1831,8 +1846,8 @@ function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport)
1831
1846
  resourceUrlDiffersFromRequest: paymentRequired.resource.url !== request.url,
1832
1847
  description: paymentRequired.resource.description ?? option.description ?? null,
1833
1848
  mimeType: paymentRequired.resource.mimeType ?? option.mimeType ?? null,
1834
- amountAtomic: chunkZDKNPNI3_cjs.x402AuthorizationAmount(option),
1835
- amount: decimalFromUsdcAtomic(chunkZDKNPNI3_cjs.x402AuthorizationAmount(option)),
1849
+ amountAtomic: chunk22FJ4JQO_cjs.x402AuthorizationAmount(option),
1850
+ amount: decimalFromUsdcAtomic(chunk22FJ4JQO_cjs.x402AuthorizationAmount(option)),
1836
1851
  token: token?.symbol ?? "USDC",
1837
1852
  // #1351: null when the asset is unrecognised on this network — the
1838
1853
  // `token` fallback above is a LABEL, not evidence of 6 decimals, and a
@@ -1871,7 +1886,7 @@ function buildX402Receipt(input) {
1871
1886
  payTo: input.merchantTo ?? input.accepted.payTo
1872
1887
  },
1873
1888
  x402: {
1874
- amount: chunkZDKNPNI3_cjs.x402AuthorizationAmount(input.accepted),
1889
+ amount: chunk22FJ4JQO_cjs.x402AuthorizationAmount(input.accepted),
1875
1890
  token: input.token,
1876
1891
  network: input.accepted.network,
1877
1892
  asset: input.accepted.asset,
@@ -1880,7 +1895,7 @@ function buildX402Receipt(input) {
1880
1895
  };
1881
1896
  }
1882
1897
  function buildX402ResumeState(input) {
1883
- const token = chunkZDKNPNI3_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
1898
+ const token = chunk22FJ4JQO_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
1884
1899
  return {
1885
1900
  rail: "x402",
1886
1901
  paymentId: input.paymentId,
@@ -1891,8 +1906,8 @@ function buildX402ResumeState(input) {
1891
1906
  request: input.request,
1892
1907
  resourceUrl: input.paymentRequired.resource.url,
1893
1908
  description: input.paymentRequired.resource.description ?? input.accepted.description ?? null,
1894
- amountAtomic: chunkZDKNPNI3_cjs.x402AuthorizationAmount(input.accepted),
1895
- amount: decimalFromUsdcAtomic(chunkZDKNPNI3_cjs.x402AuthorizationAmount(input.accepted)),
1909
+ amountAtomic: chunk22FJ4JQO_cjs.x402AuthorizationAmount(input.accepted),
1910
+ amount: decimalFromUsdcAtomic(chunk22FJ4JQO_cjs.x402AuthorizationAmount(input.accepted)),
1896
1911
  token: token?.symbol ?? "USDC",
1897
1912
  asset: input.accepted.asset,
1898
1913
  network: input.accepted.network,
@@ -1901,7 +1916,7 @@ function buildX402ResumeState(input) {
1901
1916
  };
1902
1917
  }
1903
1918
  function attachX402ResumeState(err, paymentRequired, accepted, idempotencyKey, request) {
1904
- if (!(err instanceof chunk4Z6ATE44_cjs.HavenPaymentStateError)) return;
1919
+ if (!(err instanceof chunkH37YVYZA_cjs.HavenPaymentStateError)) return;
1905
1920
  if (err.state.rail !== "x402") return;
1906
1921
  err.resumeState = buildX402ResumeState({
1907
1922
  paymentId: err.state.paymentId,
@@ -1922,17 +1937,17 @@ function attachResumeState(err, input) {
1922
1937
  }
1923
1938
  function assertCanResumeX402(status, paymentRequired, option) {
1924
1939
  if (status.rail !== "x402") {
1925
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(
1940
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(
1926
1941
  `Payment ${status.paymentId} is ${status.rail}, not x402.`,
1927
1942
  409,
1928
1943
  status
1929
1944
  );
1930
1945
  }
1931
- if (status.nextAction !== chunk4Z6ATE44_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
1932
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
1946
+ if (status.nextAction !== chunkH37YVYZA_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
1947
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
1933
1948
  }
1934
1949
  if (!status.txHash) {
1935
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1950
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1936
1951
  `x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
1937
1952
  502,
1938
1953
  status,
@@ -1940,7 +1955,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1940
1955
  );
1941
1956
  }
1942
1957
  if (status.resourceUrl && status.resourceUrl !== paymentRequired.resource.url) {
1943
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1958
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1944
1959
  "x402 resume request does not match the approved resource URL.",
1945
1960
  409,
1946
1961
  { status, paymentRequired },
@@ -1948,7 +1963,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1948
1963
  );
1949
1964
  }
1950
1965
  if (status.merchantAddress && !sameAddress(status.merchantAddress, option.payTo)) {
1951
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1966
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1952
1967
  "x402 resume request does not match the approved merchant.",
1953
1968
  409,
1954
1969
  { status, selectedPayment: option },
@@ -1957,7 +1972,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1957
1972
  }
1958
1973
  const optionChainId = chainIdFromNetwork(option.network);
1959
1974
  if (status.chainId && optionChainId && status.chainId !== optionChainId) {
1960
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1975
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1961
1976
  "x402 resume request does not match the approved network.",
1962
1977
  409,
1963
1978
  { status, selectedPayment: option },
@@ -1965,7 +1980,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1965
1980
  );
1966
1981
  }
1967
1982
  if (status.token && status.token !== "USDC") {
1968
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1983
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1969
1984
  "x402 resume request does not match the approved token.",
1970
1985
  409,
1971
1986
  { status, selectedPayment: option },
@@ -1973,9 +1988,9 @@ function assertCanResumeX402(status, paymentRequired, option) {
1973
1988
  );
1974
1989
  }
1975
1990
  const approvedAmount = status.amount ? normalizeDecimal(status.amount) : "";
1976
- const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunkZDKNPNI3_cjs.x402AuthorizationAmount(option)));
1991
+ const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunk22FJ4JQO_cjs.x402AuthorizationAmount(option)));
1977
1992
  if (approvedAmount && approvedAmount !== requestedAmount) {
1978
- throw new chunk4Z6ATE44_cjs.HavenApiError(
1993
+ throw new chunkH37YVYZA_cjs.HavenApiError(
1979
1994
  "x402 resume request does not match the approved amount.",
1980
1995
  409,
1981
1996
  { status, selectedPayment: option },
@@ -2031,7 +2046,7 @@ var X402FundingLeg = class {
2031
2046
  const cached = this.receiptCache.get(idempotencyKey);
2032
2047
  if (!cached || cached.expiresAt <= Date.now()) return void 0;
2033
2048
  if (!sameX402TaskBudget(cached.taskBudgetId, taskBudgetId) || !sameX402TaskBudget(cached.subBudgetId, subBudgetId)) {
2034
- throw new chunk4Z6ATE44_cjs.X402TaskBudgetMismatchError(
2049
+ throw new chunkH37YVYZA_cjs.X402TaskBudgetMismatchError(
2035
2050
  `The x402 idempotency key '${idempotencyKey}' was already used under a different authorizing budget (task '${cached.taskBudgetId ?? "none"}' vs '${taskBudgetId ?? "none"}', sub '${cached.subBudgetId ?? "none"}' vs '${subBudgetId ?? "none"}'). Pass a new idempotencyKey to pay under this budget.`,
2036
2051
  idempotencyKey,
2037
2052
  cached.taskBudgetId,
@@ -2052,7 +2067,7 @@ var X402FundingLeg = class {
2052
2067
  url: paymentRequired.resource.url,
2053
2068
  payTo: this.delegateAddress,
2054
2069
  merchantPayTo: option.payTo,
2055
- amount: chunkZDKNPNI3_cjs.x402AuthorizationAmount(option),
2070
+ amount: chunk22FJ4JQO_cjs.x402AuthorizationAmount(option),
2056
2071
  asset: option.asset,
2057
2072
  network: option.network,
2058
2073
  description: paymentRequired.resource.description,
@@ -2071,41 +2086,41 @@ var X402FundingLeg = class {
2071
2086
  ...subBudgetId ? { subBudgetId } : {}
2072
2087
  });
2073
2088
  const state = paymentStateFromRaw("x402 payment", raw);
2074
- const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === chunk4Z6ATE44_cjs.AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
2089
+ const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === chunkH37YVYZA_cjs.AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
2075
2090
  if (executedReplay) {
2076
2091
  const canFund = await this.delegateCanFund(
2077
2092
  raw.chain_id ?? state?.chainId ?? chainIdFromNetwork(option.network),
2078
2093
  option.asset,
2079
- chunkZDKNPNI3_cjs.x402AuthorizationAmount(option)
2094
+ chunk22FJ4JQO_cjs.x402AuthorizationAmount(option)
2080
2095
  );
2081
2096
  const refuse = executedReplay === "idempotency-collision" ? canFund !== true : canFund === false;
2082
2097
  if (refuse) {
2083
2098
  const settledReceipt = state && executedReplay === "approval-resume" ? this.receiptFromStatus(paymentRequired, option, void 0, state) : this.receiptFromAuthorization(paymentRequired, option, void 0, raw);
2084
- throw new chunk4Z6ATE44_cjs.X402AlreadySettledError(
2099
+ throw new chunkH37YVYZA_cjs.X402AlreadySettledError(
2085
2100
  canFund === false ? "This x402 payment already settled \u2014 the delegate no longer holds the funds to authorize it again. To buy the same item a second time, pass a distinct `idempotencyKey`; the synthesised key intentionally collapses repeat calls for the same product within a 5-minute window so a retried request cannot pay twice." : "This x402 payment already settled, and whether the delegate can still fund a new authorization could not be verified (no `chainRpcs` entry for this chain). Refusing rather than issue an authorization that may be unfundable. To buy the same item a second time, pass a distinct `idempotencyKey`; to finish an interrupted payment, resume it by `paymentId`.",
2086
2101
  settledReceipt,
2087
2102
  canFund === false ? "settled" : "unverifiable"
2088
2103
  );
2089
2104
  }
2090
2105
  }
2091
- const paymentHeader = await this.createPaymentHeader(paymentRequired, option);
2106
+ const paymentHeader = await this.createPaymentHeader(paymentRequired, option, raw.payment_id ?? state?.paymentId);
2092
2107
  if (raw.success && raw.tx_hash) {
2093
2108
  const receipt2 = this.receiptFromAuthorization(paymentRequired, option, paymentHeader, raw);
2094
2109
  this.cacheReceipt(idempotencyKey, paymentHeader, receipt2, taskBudgetId, subBudgetId);
2095
2110
  return receipt2;
2096
2111
  }
2097
- if (state?.nextAction === chunk4Z6ATE44_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
2112
+ if (state?.nextAction === chunkH37YVYZA_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
2098
2113
  const receipt2 = this.receiptFromStatus(paymentRequired, option, paymentHeader, state);
2099
2114
  this.cacheReceipt(idempotencyKey, paymentHeader, receipt2, taskBudgetId, subBudgetId);
2100
2115
  return receipt2;
2101
2116
  }
2102
2117
  this.assertSignableAuthorizationState("x402 payment", raw);
2103
2118
  if (!raw.sign_data?.hash) {
2104
- throw new chunk4Z6ATE44_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
2119
+ throw new chunkH37YVYZA_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
2105
2120
  }
2106
2121
  const sig = await this.signForData(raw.sign_data, {
2107
2122
  asset: option.asset,
2108
- amount: chunkZDKNPNI3_cjs.x402AuthorizationAmount(option)
2123
+ amount: chunk22FJ4JQO_cjs.x402AuthorizationAmount(option)
2109
2124
  });
2110
2125
  const execResult = await this.post(
2111
2126
  `/payments/${raw.payment_id}/sign`,
@@ -2123,27 +2138,54 @@ var X402FundingLeg = class {
2123
2138
  return receipt;
2124
2139
  }
2125
2140
  // ── Header minting ───────────────────────────────────────────────
2126
- async createPaymentHeader(paymentRequired, option) {
2141
+ /**
2142
+ * Mint the merchant-facing X-PAYMENT header with the delegate key.
2143
+ *
2144
+ * #3888: when `paymentId` is given, the EIP-3009 nonce is the shared
2145
+ * derivation from that Haven payment id instead of the x402 library's
2146
+ * random draw — that is what lets the backend attribute the merchant's
2147
+ * `AuthorizationUsed(delegate, nonce)` settlement to this payment when the
2148
+ * agent never reports it, and what makes a resume/retry re-sign of a
2149
+ * settled payment carry the SAME nonce (the merchant refuses it as already
2150
+ * used, closing the #3475 re-pay hazard). The signed typed data stays the
2151
+ * library's own: the nonce only overwrites the field on the unsigned
2152
+ * payload `preparePaymentHeader` built. Without a payment id the library's
2153
+ * random nonce is kept — an install too old to name its payment behaves
2154
+ * exactly as before.
2155
+ */
2156
+ async createPaymentHeader(paymentRequired, option, paymentId) {
2127
2157
  if (!this.delegateKey) {
2128
- throw new chunk4Z6ATE44_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
2158
+ throw new chunkH37YVYZA_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
2129
2159
  }
2130
2160
  const account = accounts.privateKeyToAccount(this.delegateKey);
2131
- const requirements = chunkZDKNPNI3_cjs.toStandardPaymentRequirements(paymentRequired, option);
2132
- const header = await schemes.exact.evm.createPaymentHeader(
2133
- account,
2134
- paymentRequired.x402Version,
2135
- requirements
2136
- );
2161
+ const requirements = chunk22FJ4JQO_cjs.toStandardPaymentRequirements(paymentRequired, option);
2162
+ let header;
2163
+ if (paymentId) {
2164
+ const unsigned = schemes.exact.evm.preparePaymentHeader(
2165
+ account.address,
2166
+ paymentRequired.x402Version,
2167
+ requirements
2168
+ );
2169
+ unsigned.payload.authorization.nonce = chunk22FJ4JQO_cjs.deriveX402PaymentNonce(paymentId);
2170
+ const signed = await schemes.exact.evm.signPaymentHeader(account, requirements, unsigned);
2171
+ header = schemes.exact.evm.encodePayment(signed);
2172
+ } else {
2173
+ header = await schemes.exact.evm.createPaymentHeader(
2174
+ account,
2175
+ paymentRequired.x402Version,
2176
+ requirements
2177
+ );
2178
+ }
2137
2179
  if (paymentRequired.x402Version < 2) return header;
2138
- const payment = chunkZDKNPNI3_cjs.decodeBase64Json(header);
2139
- return chunkZDKNPNI3_cjs.encodeBase64Json(chunkZDKNPNI3_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
2180
+ const payment = chunk22FJ4JQO_cjs.decodeBase64Json(header);
2181
+ return chunk22FJ4JQO_cjs.encodeBase64Json(chunk22FJ4JQO_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
2140
2182
  }
2141
2183
  // ── Receipt mapping ──────────────────────────────────────────────
2142
2184
  receiptFromAuthorization(paymentRequired, option, paymentHeader, raw, execResult) {
2143
2185
  const txHash = execResult?.tx_hash ?? raw.tx_hash ?? "";
2144
2186
  const chainId = execResult?.chain_id ?? raw.chain_id ?? chainIdFromNetwork(option.network);
2145
2187
  const token = execResult?.token ?? raw.token ?? "USDC";
2146
- const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunkZDKNPNI3_cjs.x402AuthorizationAmount(option));
2188
+ const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunk22FJ4JQO_cjs.x402AuthorizationAmount(option));
2147
2189
  const to = execResult?.to ?? raw.to ?? this.delegateAddress ?? "";
2148
2190
  const explorerUrl = execResult?.explorer_url ?? raw.explorer_url ?? explorerUrlOrEmpty(chainId, txHash);
2149
2191
  const merchantTo = execResult?.merchant_to ?? raw.merchant_to ?? option.payTo;
@@ -2165,7 +2207,7 @@ var X402FundingLeg = class {
2165
2207
  }
2166
2208
  receiptFromStatus(paymentRequired, option, paymentHeader, status) {
2167
2209
  if (!status.txHash) {
2168
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2210
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2169
2211
  `x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
2170
2212
  502,
2171
2213
  status,
@@ -2176,7 +2218,7 @@ var X402FundingLeg = class {
2176
2218
  paymentId: status.paymentId,
2177
2219
  txHash: status.txHash,
2178
2220
  token: status.token || "USDC",
2179
- amount: status.amount || decimalFromUsdcAtomic(chunkZDKNPNI3_cjs.x402AuthorizationAmount(option)),
2221
+ amount: status.amount || decimalFromUsdcAtomic(chunk22FJ4JQO_cjs.x402AuthorizationAmount(option)),
2180
2222
  to: this.delegateAddress ?? "",
2181
2223
  resourceUrl: paymentRequired.resource.url,
2182
2224
  explorerUrl: explorerUrlOrEmpty(status.chainId, status.txHash),
@@ -2204,7 +2246,7 @@ var X402FundingLeg = class {
2204
2246
  const provider = createJsonRpcProvider(rpcUrl);
2205
2247
  const onChainReceipt = await provider.waitForTransaction(txHash, 1, timeoutMs);
2206
2248
  if (!onChainReceipt || onChainReceipt.status !== 1) {
2207
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2249
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2208
2250
  "Funding tx did not confirm on-chain within the timeout window.",
2209
2251
  500,
2210
2252
  { txHash, chainId }
@@ -2253,7 +2295,7 @@ var X402FundingLeg = class {
2253
2295
  };
2254
2296
  function getPaymentHeaderValidBefore(paymentHeader) {
2255
2297
  try {
2256
- const payment = chunkZDKNPNI3_cjs.decodeBase64Json(
2298
+ const payment = chunk22FJ4JQO_cjs.decodeBase64Json(
2257
2299
  paymentHeader
2258
2300
  );
2259
2301
  const payload = payment.payload;
@@ -2308,7 +2350,7 @@ var X402Erc7710 = class {
2308
2350
  */
2309
2351
  async settle(paymentRequired, options = {}) {
2310
2352
  if (!this.delegateKey) {
2311
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
2353
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
2312
2354
  "delegateKey is required for x402 payments. Pass it in the HavenClient config."
2313
2355
  );
2314
2356
  }
@@ -2333,21 +2375,21 @@ var X402Erc7710 = class {
2333
2375
  async prepare(paymentRequired, options = {}) {
2334
2376
  const delegationRail = options.delegationRail ?? (await this.getAgent()).executionRail === "delegation";
2335
2377
  if (!delegationRail) {
2336
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2378
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2337
2379
  "erc7710 settlement requires a delegation-rail account; this one is not on it. Use authorizeX402() for the standard EIP-3009 path.",
2338
2380
  400
2339
2381
  );
2340
2382
  }
2341
- const selection = chunkZDKNPNI3_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
2383
+ const selection = chunk22FJ4JQO_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
2342
2384
  if (!selection || selection.scheme !== "erc7710") {
2343
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2385
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2344
2386
  "This merchant does not advertise an erc7710 settlement option (no accepts[] entry carries extra.assetTransferMethod: 'erc7710'). Use authorizeX402() for the standard EIP-3009 path.",
2345
2387
  400
2346
2388
  );
2347
2389
  }
2348
2390
  const option = selection.option;
2349
2391
  const merchantPayTo = option.payTo;
2350
- const amountAtomic = chunkZDKNPNI3_cjs.x402AuthorizationAmount(option);
2392
+ const amountAtomic = chunk22FJ4JQO_cjs.x402AuthorizationAmount(option);
2351
2393
  const raw = await this.post("/x402", {
2352
2394
  url: options.resourceUrl ?? paymentRequired.resource?.url,
2353
2395
  // #2373: the full 402 challenge, persisted verbatim by the backend
@@ -2391,24 +2433,24 @@ var X402Erc7710 = class {
2391
2433
  ...options.subBudgetId ? { subBudgetId: options.subBudgetId } : {}
2392
2434
  });
2393
2435
  if (!raw.payment_id) {
2394
- throw new chunk4Z6ATE44_cjs.HavenApiError("No payment_id returned from x402/authorize", 500, raw);
2436
+ throw new chunkH37YVYZA_cjs.HavenApiError("No payment_id returned from x402/authorize", 500, raw);
2395
2437
  }
2396
2438
  if (raw.status === "confirmed" && raw.tx_hash) {
2397
2439
  const requestedUrl = options.resourceUrl ?? paymentRequired.resource?.url;
2398
2440
  const samePurchase = typeof raw.to === "string" && raw.to.toLowerCase() === merchantPayTo.toLowerCase() && raw.resource_url === requestedUrl;
2399
2441
  if (!samePurchase) {
2400
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2442
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2401
2443
  `Idempotency key already belongs to confirmed payment ${raw.payment_id}, which is not this erc7710 purchase (different payee or resource). Nothing was signed and nothing was charged. Check that payment's status before buying again: a funded but undelivered EIP-3009 payment is recovered, not paid twice. Otherwise use a new idempotency key for this purchase.`,
2402
2444
  409,
2403
2445
  raw,
2404
2446
  raw.payment_id
2405
2447
  );
2406
2448
  }
2407
- throw new chunk4Z6ATE44_cjs.X402Erc7710AlreadySettledError(raw.payment_id, raw.tx_hash, raw);
2449
+ throw new chunkH37YVYZA_cjs.X402Erc7710AlreadySettledError(raw.payment_id, raw.tx_hash, raw);
2408
2450
  }
2409
2451
  const signData = raw.sign_data;
2410
2452
  if (signData?.signature_scheme !== "eip712_delegation" || !signData.typed_data) {
2411
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2453
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2412
2454
  `x402/authorize did not return an erc7710 settlement child (signature_scheme was ${JSON.stringify(signData?.signature_scheme)}). Refusing to sign a payload this path did not ask for.`,
2413
2455
  500,
2414
2456
  raw
@@ -2440,9 +2482,9 @@ var X402Erc7710 = class {
2440
2482
  try {
2441
2483
  settled = await this.post(`/x402/${paymentId}/settle`, { signature });
2442
2484
  } catch (err) {
2443
- const body = err instanceof chunk4Z6ATE44_cjs.HavenApiError ? err.body : void 0;
2444
- if (err instanceof chunk4Z6ATE44_cjs.HavenApiError && err.statusCode === 409 && body?.code === "payment_already_settled" && typeof body.tx_hash === "string") {
2445
- throw new chunk4Z6ATE44_cjs.X402Erc7710AlreadySettledError(
2485
+ const body = err instanceof chunkH37YVYZA_cjs.HavenApiError ? err.body : void 0;
2486
+ if (err instanceof chunkH37YVYZA_cjs.HavenApiError && err.statusCode === 409 && body?.code === "payment_already_settled" && typeof body.tx_hash === "string") {
2487
+ throw new chunkH37YVYZA_cjs.X402Erc7710AlreadySettledError(
2446
2488
  typeof body.payment_id === "string" ? body.payment_id : paymentId,
2447
2489
  body.tx_hash,
2448
2490
  body
@@ -2451,7 +2493,7 @@ var X402Erc7710 = class {
2451
2493
  throw err;
2452
2494
  }
2453
2495
  if (!settled.payment_header) {
2454
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2496
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2455
2497
  "x402 settle returned no payment_header \u2014 the merchant cannot be retried.",
2456
2498
  500,
2457
2499
  settled
@@ -2461,9 +2503,9 @@ var X402Erc7710 = class {
2461
2503
  }
2462
2504
  };
2463
2505
  function settlementExpectationFromQuote(settlement) {
2464
- const chainId = chunk4Z6ATE44_cjs.chainIdForNetwork(settlement.network);
2506
+ const chainId = chunkH37YVYZA_cjs.chainIdForNetwork(settlement.network);
2465
2507
  if (chainId === void 0) {
2466
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
2508
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
2467
2509
  `Refusing to sign the x402 settlement child: the merchant's network ${JSON.stringify(settlement.network)} is not one this SDK can verify a settlement child on.`
2468
2510
  );
2469
2511
  }
@@ -2513,7 +2555,7 @@ function x402ToolReceipt(receipt) {
2513
2555
  };
2514
2556
  }
2515
2557
  function toolError(err) {
2516
- if (err instanceof chunk4Z6ATE44_cjs.HavenPaymentStateError) {
2558
+ if (err instanceof chunkH37YVYZA_cjs.HavenPaymentStateError) {
2517
2559
  return {
2518
2560
  success: false,
2519
2561
  payment_id: err.state.paymentId,
@@ -2558,7 +2600,7 @@ function toolError(err) {
2558
2600
  error: err.message
2559
2601
  };
2560
2602
  }
2561
- if (err instanceof chunk4Z6ATE44_cjs.HavenApiError) {
2603
+ if (err instanceof chunkH37YVYZA_cjs.HavenApiError) {
2562
2604
  return {
2563
2605
  success: false,
2564
2606
  status_code: err.statusCode,
@@ -2602,14 +2644,14 @@ var MerchantCompletion = class {
2602
2644
  }
2603
2645
  async retryRequest(url, initialInit, paymentRequired, receipt) {
2604
2646
  if (!receipt.accepted) {
2605
- throw new chunk4Z6ATE44_cjs.HavenApiError("No accepted x402 option was recorded for payment retry", 500);
2647
+ throw new chunkH37YVYZA_cjs.HavenApiError("No accepted x402 option was recorded for payment retry", 500);
2606
2648
  }
2607
2649
  if (!receipt.paymentHeader) {
2608
- throw new chunk4Z6ATE44_cjs.HavenApiError("No x402 payment header was returned for payment retry", 500);
2650
+ throw new chunkH37YVYZA_cjs.HavenApiError("No x402 payment header was returned for payment retry", 500);
2609
2651
  }
2610
2652
  let retryInit = initialInit;
2611
2653
  if (this.getTaxDeclarationHeader && this.delegateKey) {
2612
- const scheme = chunkZDKNPNI3_cjs.x402PaymentHeaderNamesFor(receipt.paymentHeader);
2654
+ const scheme = chunk22FJ4JQO_cjs.x402PaymentHeaderNamesFor(receipt.paymentHeader);
2613
2655
  const isEip3009 = scheme.length > 1;
2614
2656
  if (isEip3009) {
2615
2657
  const resolved = await this.getTaxDeclarationHeader({
@@ -2644,7 +2686,7 @@ var MerchantCompletion = class {
2644
2686
  delegate_to: receipt.to
2645
2687
  }
2646
2688
  });
2647
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2689
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2648
2690
  "x402 retry failed after Haven funded the delegate wallet; reconciliation may be required.",
2649
2691
  inBandRejection ? X402_RETRY_REJECTED_STATUS : merchant.merchant_status,
2650
2692
  {
@@ -2674,7 +2716,7 @@ var MerchantCompletion = class {
2674
2716
  merchantStatus: retryResponse.status,
2675
2717
  challengePayload: paymentRequired,
2676
2718
  selectedPayment: receipt.accepted,
2677
- paymentProofHeaderName: chunkZDKNPNI3_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
2719
+ paymentProofHeaderName: chunk22FJ4JQO_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
2678
2720
  paymentProofHeader: receipt.paymentHeader,
2679
2721
  protocolReceiptHeaderName,
2680
2722
  protocolReceiptHeader
@@ -2733,18 +2775,18 @@ var MerchantCompletion = class {
2733
2775
  async resolveCompletionContext(input) {
2734
2776
  const status = await this.getPaymentStatus(input.paymentId);
2735
2777
  if (status.rail !== "x402") {
2736
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(
2778
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(
2737
2779
  `Payment ${status.paymentId} is ${status.rail}, not x402.`,
2738
2780
  409,
2739
2781
  status
2740
2782
  );
2741
2783
  }
2742
- const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === chunk4Z6ATE44_cjs.AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === chunk4Z6ATE44_cjs.AgentPaymentPhase.PaymentConfirmed && status.nextAction === chunk4Z6ATE44_cjs.AgentPaymentNextAction.None;
2784
+ const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === chunkH37YVYZA_cjs.AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === chunkH37YVYZA_cjs.AgentPaymentPhase.PaymentConfirmed && status.nextAction === chunkH37YVYZA_cjs.AgentPaymentNextAction.None;
2743
2785
  if (!readyForMerchantCompletion) {
2744
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
2786
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
2745
2787
  }
2746
2788
  if (!input.noFundingLeg && !status.txHash) {
2747
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2789
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2748
2790
  `x402 payment ${status.paymentId} is ready for merchant completion but has no Haven transaction hash.`,
2749
2791
  502,
2750
2792
  status,
@@ -2753,7 +2795,7 @@ var MerchantCompletion = class {
2753
2795
  }
2754
2796
  const approvedResourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
2755
2797
  if (approvedResourceUrl && approvedResourceUrl !== input.url) {
2756
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2798
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2757
2799
  "x402 merchant completion does not match the approved resource URL.",
2758
2800
  409,
2759
2801
  { status, url: input.url },
@@ -2839,7 +2881,7 @@ var MerchantCompletion = class {
2839
2881
  */
2840
2882
  async reportMerchantOutcome(input) {
2841
2883
  if (!Number.isInteger(input.merchantStatus) || input.merchantStatus < 100 || input.merchantStatus > 599) {
2842
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2884
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2843
2885
  `merchant_status must be an integer HTTP status from 100 to 599 (received ${input.merchantStatus}).`,
2844
2886
  400,
2845
2887
  void 0,
@@ -2848,7 +2890,7 @@ var MerchantCompletion = class {
2848
2890
  }
2849
2891
  const looksAccepted = input.merchantStatus >= 200 && input.merchantStatus < 300;
2850
2892
  if (looksAccepted !== (input.outcome === "accepted")) {
2851
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2893
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2852
2894
  `outcome "${input.outcome}" contradicts merchant_status ${input.merchantStatus}: report "accepted" only for a 2xx and "rejected" only for a non-2xx.`,
2853
2895
  400,
2854
2896
  void 0,
@@ -2857,14 +2899,14 @@ var MerchantCompletion = class {
2857
2899
  }
2858
2900
  const status = await this.getPaymentStatus(input.paymentId);
2859
2901
  if (status.rail !== "x402") {
2860
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(
2902
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(
2861
2903
  `Payment ${status.paymentId} is ${status.rail}, not x402 \u2014 there is no merchant retry to report.`,
2862
2904
  409,
2863
2905
  status
2864
2906
  );
2865
2907
  }
2866
2908
  if (status.status !== "confirmed" || !status.txHash) {
2867
- throw new chunk4Z6ATE44_cjs.HavenPaymentStateError(
2909
+ throw new chunkH37YVYZA_cjs.HavenPaymentStateError(
2868
2910
  `Payment ${status.paymentId} has no confirmed Haven funding transaction to anchor a merchant report to (status ${status.status}). ${status.message}`,
2869
2911
  paymentStateStatusCode(status.status, 409),
2870
2912
  status
@@ -2872,7 +2914,7 @@ var MerchantCompletion = class {
2872
2914
  }
2873
2915
  const resourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
2874
2916
  if (!resourceUrl) {
2875
- throw new chunk4Z6ATE44_cjs.HavenApiError(
2917
+ throw new chunkH37YVYZA_cjs.HavenApiError(
2876
2918
  `Payment ${status.paymentId} has no recorded resource URL, so a merchant report cannot be stored.`,
2877
2919
  409,
2878
2920
  status,
@@ -2943,7 +2985,7 @@ var MerchantCompletion = class {
2943
2985
  await this.post("/machine-payments/evidence", body);
2944
2986
  return { outcome: "confirmed" };
2945
2987
  } catch (err) {
2946
- const statusCode = err instanceof chunk4Z6ATE44_cjs.HavenApiError ? err.statusCode : void 0;
2988
+ const statusCode = err instanceof chunkH37YVYZA_cjs.HavenApiError ? err.statusCode : void 0;
2947
2989
  if (statusCode !== EVIDENCE_RETRYABLE_STATUS) {
2948
2990
  const reason = refusalReasonFromBody(err);
2949
2991
  return {
@@ -2989,7 +3031,7 @@ var MerchantCompletion = class {
2989
3031
  */
2990
3032
  async reportSettlementEvidence(paymentId, settlementTxHash) {
2991
3033
  if (isZeroSettlementTxHash(settlementTxHash)) {
2992
- throw new chunk4Z6ATE44_cjs.HavenZeroSettlementHashError(paymentId);
3034
+ throw new chunkH37YVYZA_cjs.HavenZeroSettlementHashError(paymentId);
2993
3035
  }
2994
3036
  return this.reportEvidence({
2995
3037
  paymentId,
@@ -3020,7 +3062,7 @@ var MerchantCompletion = class {
3020
3062
  }
3021
3063
  };
3022
3064
  function refusalReasonFromBody(err) {
3023
- if (!(err instanceof chunk4Z6ATE44_cjs.HavenApiError)) return void 0;
3065
+ if (!(err instanceof chunkH37YVYZA_cjs.HavenApiError)) return void 0;
3024
3066
  const body = err.body;
3025
3067
  if (body === null || typeof body !== "object" || Array.isArray(body)) return void 0;
3026
3068
  const reason = body.reason;
@@ -3037,7 +3079,7 @@ function parseMerchantSettlement(header) {
3037
3079
  }
3038
3080
  function parseProtocolReceiptHeader(value) {
3039
3081
  try {
3040
- return chunkZDKNPNI3_cjs.decodeBase64Json(value);
3082
+ return chunk22FJ4JQO_cjs.decodeBase64Json(value);
3041
3083
  } catch {
3042
3084
  try {
3043
3085
  return JSON.parse(value);
@@ -3054,7 +3096,7 @@ function x402TypedDataDigest(typedData) {
3054
3096
  try {
3055
3097
  return viem.hashTypedData(typedData);
3056
3098
  } catch (err) {
3057
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3099
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3058
3100
  `The x402 funding intent carried a sign_data.typed_data that is not a valid EIP-712 payload (needs domain, types, primaryType, message), so its digest cannot be derived and no signer could accept it. Underlying error: ${err instanceof Error ? err.message : String(err)}`
3059
3101
  );
3060
3102
  }
@@ -3084,6 +3126,9 @@ function mapCatalogEntry(entry) {
3084
3126
  priceAtomic: entry.price_atomic,
3085
3127
  asset: entry.asset,
3086
3128
  network: entry.network,
3129
+ // #3839: conditional like `merchant` — absent (not null) when the backend
3130
+ // does not send the field, so an older backend's exact shape is unchanged.
3131
+ ...entry.asset_transfer_methods !== void 0 ? { assetTransferMethods: entry.asset_transfer_methods } : {},
3087
3132
  status: entry.status,
3088
3133
  verifiedAt: entry.verified_at,
3089
3134
  source: entry.source,
@@ -3166,7 +3211,7 @@ var HavenClient = class {
3166
3211
  this.x402Wallet = config.x402Wallet;
3167
3212
  this.egressPolicy = config.merchantEgress;
3168
3213
  this.merchantTransport = new McpMerchantTransport({ merchantTimeout: config.merchantTimeout, egress: config.merchantEgress });
3169
- this.confirmationTimeout = config.confirmationTimeout ?? chunk4Z6ATE44_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS;
3214
+ this.confirmationTimeout = config.confirmationTimeout ?? chunkH37YVYZA_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS;
3170
3215
  this.pollingInterval = config.pollingInterval ?? DEFAULT_POLLING_INTERVAL;
3171
3216
  this.chainRpcs = config.chainRpcs ?? {};
3172
3217
  if (this.delegateKey) {
@@ -3247,7 +3292,7 @@ var HavenClient = class {
3247
3292
  */
3248
3293
  async pay(request) {
3249
3294
  if (!this.delegateKey) {
3250
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3295
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3251
3296
  "Cannot use pay() without a delegateKey. Use createIntent() + submitSignature() for manual signing."
3252
3297
  );
3253
3298
  }
@@ -3303,15 +3348,15 @@ var HavenClient = class {
3303
3348
  * on-chain allowance — there is nothing to sign until the user approves.
3304
3349
  */
3305
3350
  async createX402Intent(paymentRequired, options = {}) {
3306
- const option = chunkZDKNPNI3_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3351
+ const option = chunk22FJ4JQO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3307
3352
  if (!option) {
3308
3353
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
3309
3354
  }
3310
3355
  const fundingTo = options.delegateAddress ?? (await this.getAgent()).delegateAddress;
3311
3356
  if (!fundingTo) {
3312
- throw new chunk4Z6ATE44_cjs.HavenApiError("Authenticated agent has no delegate address registered.", 502);
3357
+ throw new chunkH37YVYZA_cjs.HavenApiError("Authenticated agent has no delegate address registered.", 502);
3313
3358
  }
3314
- const idempotencyKey = options.idempotencyKey ?? chunkZDKNPNI3_cjs.buildX402IdempotencyKey(paymentRequired, option);
3359
+ const idempotencyKey = options.idempotencyKey ?? chunk22FJ4JQO_cjs.buildX402IdempotencyKey(paymentRequired, option);
3315
3360
  const raw = await this.post("/x402", {
3316
3361
  url: paymentRequired.resource.url,
3317
3362
  payTo: fundingTo,
@@ -3322,7 +3367,7 @@ var HavenClient = class {
3322
3367
  // of a silent reroute to the erc7710 settlement branch (the #1358
3323
3368
  // review's open-budget misroute). Legacy-rail backends ignore the field.
3324
3369
  settlementScheme: "eip3009",
3325
- amount: chunkZDKNPNI3_cjs.x402AuthorizationAmount(option),
3370
+ amount: chunk22FJ4JQO_cjs.x402AuthorizationAmount(option),
3326
3371
  asset: option.asset,
3327
3372
  network: option.network,
3328
3373
  description: paymentRequired.resource.description,
@@ -3347,15 +3392,15 @@ var HavenClient = class {
3347
3392
  throwPaymentStateError("x402 payment", raw);
3348
3393
  }
3349
3394
  if (!raw.sign_data?.hash) {
3350
- throw new chunk4Z6ATE44_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
3395
+ throw new chunkH37YVYZA_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
3351
3396
  }
3352
3397
  if (raw.sign_data.signature_scheme !== void 0 && !raw.sign_data.typed_data) {
3353
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3398
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3354
3399
  `This account's x402 funding intent declares signature scheme '${raw.sign_data.signature_scheme}' but carried no typed_data to sign. Refusing to fall back to the bare hash \u2014 the account would reject that signature on-chain. This is a backend contract violation; report it rather than working around it.`
3355
3400
  );
3356
3401
  }
3357
3402
  if (!raw.x402_expected_auth) {
3358
- throw new chunk4Z6ATE44_cjs.HavenApiError("No x402 expected-context binding returned from x402/authorize", 500, raw);
3403
+ throw new chunkH37YVYZA_cjs.HavenApiError("No x402 expected-context binding returned from x402/authorize", 500, raw);
3359
3404
  }
3360
3405
  return {
3361
3406
  paymentId: raw.payment_id,
@@ -3366,7 +3411,7 @@ var HavenClient = class {
3366
3411
  accepted: option,
3367
3412
  resourceUrl: paymentRequired.resource.url,
3368
3413
  merchantTo: raw.merchant_to ?? option.payTo,
3369
- amountAtomic: chunkZDKNPNI3_cjs.x402AuthorizationAmount(option),
3414
+ amountAtomic: chunk22FJ4JQO_cjs.x402AuthorizationAmount(option),
3370
3415
  asset: option.asset,
3371
3416
  network: option.network,
3372
3417
  expectedAuth: raw.x402_expected_auth,
@@ -3391,13 +3436,13 @@ var HavenClient = class {
3391
3436
  */
3392
3437
  sign(hash) {
3393
3438
  if (!this.delegateKey) {
3394
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3439
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3395
3440
  "Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
3396
3441
  );
3397
3442
  }
3398
3443
  const signature = signHash(this.delegateKey, hash);
3399
3444
  if (!verifySignature(hash, signature, this.delegateAddress)) {
3400
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3445
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3401
3446
  "Local signature verification failed \u2014 recovered address does not match delegate key."
3402
3447
  );
3403
3448
  }
@@ -3415,29 +3460,29 @@ var HavenClient = class {
3415
3460
  */
3416
3461
  async signForData(signData, settlementExpectation, fundingExpectation) {
3417
3462
  if (!this.delegateKey) {
3418
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3463
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3419
3464
  "Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
3420
3465
  );
3421
3466
  }
3422
3467
  const scheme = signData.signature_scheme;
3423
3468
  if (scheme === "eip191_userop") {
3424
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3469
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3425
3470
  "The session rail is retired \u2014 'eip191_userop' intents can no longer be signed. Re-onboard the account on the delegation rail."
3426
3471
  );
3427
3472
  }
3428
3473
  if (scheme === "eip712_userop") {
3429
3474
  if (!signData.typed_data) {
3430
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3475
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3431
3476
  "sign_data.signature_scheme is eip712_userop but typed_data is missing \u2014 refusing to sign the bare hash (the account would reject it)."
3432
3477
  );
3433
3478
  }
3434
- chunk4Z6ATE44_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
3435
- chunkZDKNPNI3_cjs.assertBoundDirectPaymentUserOp(
3479
+ chunkH37YVYZA_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
3480
+ chunk22FJ4JQO_cjs.assertBoundDirectPaymentUserOp(
3436
3481
  signData.typed_data,
3437
3482
  this.delegateAddress
3438
3483
  );
3439
3484
  if (fundingExpectation) {
3440
- chunkZDKNPNI3_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
3485
+ chunk22FJ4JQO_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
3441
3486
  delegateAddress: this.delegateAddress,
3442
3487
  asset: fundingExpectation.asset,
3443
3488
  amount: fundingExpectation.amount
@@ -3447,24 +3492,24 @@ var HavenClient = class {
3447
3492
  }
3448
3493
  if (scheme === "eip712_delegation") {
3449
3494
  if (!signData.typed_data) {
3450
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3495
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3451
3496
  "sign_data.signature_scheme is eip712_delegation but typed_data is missing \u2014 refusing to sign the bare hash (the settlement would be rejected on redemption)."
3452
3497
  );
3453
3498
  }
3454
3499
  if (!settlementExpectation) {
3455
- throw new chunkZDKNPNI3_cjs.HavenTypedDataRefusedError(
3500
+ throw new chunk22FJ4JQO_cjs.HavenTypedDataRefusedError(
3456
3501
  "Refusing to sign an x402 settlement child without an independent expectation of what it must pay (the merchant's 402). Pay erc7710 merchants through settleX402Erc7710(), which supplies it."
3457
3502
  );
3458
3503
  }
3459
- chunkZDKNPNI3_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
3504
+ chunk22FJ4JQO_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
3460
3505
  return signSettlementDelegationTypedData(this.delegateKey, signData.typed_data);
3461
3506
  }
3462
3507
  if (scheme === void 0) {
3463
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3508
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3464
3509
  "sign_data.signature_scheme is required \u2014 the legacy AllowanceModule rail that signed the bare hash is retired (#2850). Refusing to guess a signing scheme."
3465
3510
  );
3466
3511
  }
3467
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3512
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3468
3513
  `Unknown sign_data.signature_scheme '${scheme}' \u2014 refusing to guess a signing scheme. Update @haven_ai/sdk.`
3469
3514
  );
3470
3515
  }
@@ -3654,7 +3699,7 @@ var HavenClient = class {
3654
3699
  */
3655
3700
  async getPaymentStatusWithPostPurchaseAllowance(paymentId) {
3656
3701
  const status = await this.getPaymentStatus(paymentId);
3657
- if (status.rail === chunk4Z6ATE44_cjs.AgentPaymentRail.X402 && status.phase === chunk4Z6ATE44_cjs.AgentPaymentPhase.PaymentConfirmed) {
3702
+ if (status.rail === chunkH37YVYZA_cjs.AgentPaymentRail.X402 && status.phase === chunkH37YVYZA_cjs.AgentPaymentPhase.PaymentConfirmed) {
3658
3703
  const { allowance, warnings } = await this.getPostPurchaseAllowanceSummary(paymentId);
3659
3704
  return { ...status, allowance, ...warnings.length > 0 ? { warnings } : {} };
3660
3705
  }
@@ -3904,7 +3949,7 @@ var HavenClient = class {
3904
3949
  }
3905
3950
  await sleep(this.pollingInterval);
3906
3951
  }
3907
- throw new chunk4Z6ATE44_cjs.HavenTimeoutError(paymentId);
3952
+ throw new chunkH37YVYZA_cjs.HavenTimeoutError(paymentId);
3908
3953
  }
3909
3954
  // ── x402 Protocol Support ────────────────────────────────────────
3910
3955
  /**
@@ -3918,24 +3963,24 @@ var HavenClient = class {
3918
3963
  */
3919
3964
  async authorizeX402(paymentRequired, options = {}) {
3920
3965
  if (!this.delegateKey) {
3921
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
3966
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
3922
3967
  "delegateKey is required for x402 payments. Pass it in the HavenClient config."
3923
3968
  );
3924
3969
  }
3925
3970
  if (!this.delegateAddress) {
3926
- throw new chunk4Z6ATE44_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3971
+ throw new chunkH37YVYZA_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3927
3972
  }
3928
- const option = chunkZDKNPNI3_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3973
+ const option = chunk22FJ4JQO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3929
3974
  if (!option) {
3930
3975
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
3931
3976
  }
3932
- const idempotencyKey = options.idempotencyKey ?? chunkZDKNPNI3_cjs.buildX402IdempotencyKey(paymentRequired, option);
3977
+ const idempotencyKey = options.idempotencyKey ?? chunk22FJ4JQO_cjs.buildX402IdempotencyKey(paymentRequired, option);
3933
3978
  const cached = this.fundingLeg.cachedReceipt(idempotencyKey, options.taskBudgetId, options.subBudgetId);
3934
3979
  if (cached) return cached;
3935
3980
  const inFlight = this.inFlightX402.get(idempotencyKey);
3936
3981
  if (inFlight) {
3937
3982
  if (!sameX402TaskBudget(this.inFlightX402TaskBudget.get(idempotencyKey), options.taskBudgetId) || !sameX402TaskBudget(this.inFlightX402SubBudget.get(idempotencyKey), options.subBudgetId)) {
3938
- throw new chunk4Z6ATE44_cjs.X402TaskBudgetMismatchError(
3983
+ throw new chunkH37YVYZA_cjs.X402TaskBudgetMismatchError(
3939
3984
  `The x402 idempotency key '${idempotencyKey}' has an in-flight payment created under a different authorizing budget (task '${this.inFlightX402TaskBudget.get(idempotencyKey) ?? "none"}' vs '${options.taskBudgetId ?? "none"}', sub '${this.inFlightX402SubBudget.get(idempotencyKey) ?? "none"}' vs '${options.subBudgetId ?? "none"}'). Pass a new idempotencyKey to pay under this budget.`,
3940
3985
  idempotencyKey,
3941
3986
  this.inFlightX402TaskBudget.get(idempotencyKey),
@@ -3990,16 +4035,16 @@ var HavenClient = class {
3990
4035
  if (err instanceof MerchantEgressResponseCapError) throw err;
3991
4036
  body = void 0;
3992
4037
  }
3993
- throw new chunk4Z6ATE44_cjs.X402UnexpectedStatusError(
4038
+ throw new chunkH37YVYZA_cjs.X402UnexpectedStatusError(
3994
4039
  `Expected an x402 quote response with HTTP 402, got HTTP ${response.status}.`,
3995
4040
  response.status || 400,
3996
4041
  body
3997
4042
  );
3998
4043
  }
3999
4044
  if (response.headers.get("MACHINE-PAYMENT-CHALLENGE")) {
4000
- throw new chunk4Z6ATE44_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
4045
+ throw new chunkH37YVYZA_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
4001
4046
  }
4002
- const paymentRequired = await chunkZDKNPNI3_cjs.parsePaymentRequiredResponse(response);
4047
+ const paymentRequired = await chunk22FJ4JQO_cjs.parsePaymentRequiredResponse(response);
4003
4048
  const mcpTransport = await this.merchantTransport.detect(url, paymentRequired, response);
4004
4049
  return buildX402Quote(paymentRequired, request, options.idempotencyKey, mcpTransport);
4005
4050
  }
@@ -4017,7 +4062,7 @@ var HavenClient = class {
4017
4062
  const wallet = await this.merchantCompletion.resolveWalletForMerchantCall();
4018
4063
  const sessionId = await this.merchantTransport.initialize(url, init, wallet);
4019
4064
  if (!sessionId) {
4020
- throw new chunk4Z6ATE44_cjs.HavenApiError(
4065
+ throw new chunkH37YVYZA_cjs.HavenApiError(
4021
4066
  "The merchant did not establish an MCP session before the x402 quote. No payment was created.",
4022
4067
  502,
4023
4068
  { mcpSessionNotEstablished: true }
@@ -4091,18 +4136,18 @@ var HavenClient = class {
4091
4136
  }
4092
4137
  async resumeAuthorizedX402(input) {
4093
4138
  if (!this.delegateKey) {
4094
- throw new chunk4Z6ATE44_cjs.HavenSigningError(
4139
+ throw new chunkH37YVYZA_cjs.HavenSigningError(
4095
4140
  "delegateKey is required for x402 payments. Pass it in the HavenClient config."
4096
4141
  );
4097
4142
  }
4098
4143
  if (!this.delegateAddress) {
4099
- throw new chunk4Z6ATE44_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
4144
+ throw new chunkH37YVYZA_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
4100
4145
  }
4101
- const option = chunkZDKNPNI3_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
4146
+ const option = chunk22FJ4JQO_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
4102
4147
  if (!option) {
4103
4148
  throw noCompatiblePaymentOptionError(input.paymentRequired.accepts);
4104
4149
  }
4105
- const idempotencyKey = input.idempotencyKey ?? chunkZDKNPNI3_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
4150
+ const idempotencyKey = input.idempotencyKey ?? chunk22FJ4JQO_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
4106
4151
  const cached = this.fundingLeg.cachedReceipt(idempotencyKey, input.taskBudgetId);
4107
4152
  if (cached) return cached;
4108
4153
  const status = await this.getPaymentStatus(input.paymentId);
@@ -4110,16 +4155,16 @@ var HavenClient = class {
4110
4155
  const canFund = await this.fundingLeg.delegateCanFund(
4111
4156
  status.chainId ?? chainIdFromNetwork(option.network),
4112
4157
  option.asset,
4113
- chunkZDKNPNI3_cjs.x402AuthorizationAmount(option)
4158
+ chunk22FJ4JQO_cjs.x402AuthorizationAmount(option)
4114
4159
  );
4115
4160
  if (canFund === false) {
4116
- throw new chunk4Z6ATE44_cjs.X402AlreadySettledError(
4161
+ throw new chunkH37YVYZA_cjs.X402AlreadySettledError(
4117
4162
  `x402 payment ${status.paymentId} has already settled \u2014 the delegate no longer holds the funds to authorize it again, so there is nothing left to resume.`,
4118
4163
  this.fundingLeg.receiptFromStatus(input.paymentRequired, option, void 0, status),
4119
4164
  "settled"
4120
4165
  );
4121
4166
  }
4122
- const paymentHeader = await this.fundingLeg.createPaymentHeader(input.paymentRequired, option);
4167
+ const paymentHeader = await this.fundingLeg.createPaymentHeader(input.paymentRequired, option, status.paymentId);
4123
4168
  const receipt = this.fundingLeg.receiptFromStatus(input.paymentRequired, option, paymentHeader, status);
4124
4169
  this.fundingLeg.cacheReceipt(idempotencyKey, paymentHeader, receipt, input.taskBudgetId);
4125
4170
  return receipt;
@@ -4134,13 +4179,13 @@ var HavenClient = class {
4134
4179
  const url = input.url ?? input.request?.url;
4135
4180
  if (!paymentRequired) {
4136
4181
  if (!url) {
4137
- throw new chunk4Z6ATE44_cjs.HavenApiError("x402 resume requires the original URL or a captured request snapshot.", 400);
4182
+ throw new chunkH37YVYZA_cjs.HavenApiError("x402 resume requires the original URL or a captured request snapshot.", 400);
4138
4183
  }
4139
4184
  const response = await this.merchantTransport.fetch(url, initialInit, this.merchantTransport.budgetFor("quote"), this.merchantTransport.capFor("quote"));
4140
4185
  if (response.status !== 402) {
4141
- throw new chunk4Z6ATE44_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
4186
+ throw new chunkH37YVYZA_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
4142
4187
  }
4143
- paymentRequired = await chunkZDKNPNI3_cjs.parsePaymentRequiredResponse(response);
4188
+ paymentRequired = await chunk22FJ4JQO_cjs.parsePaymentRequiredResponse(response);
4144
4189
  }
4145
4190
  const receipt = await this.resumeAuthorizedX402({
4146
4191
  paymentId: input.paymentId,
@@ -4193,7 +4238,7 @@ var HavenClient = class {
4193
4238
  nativeChallenge = true;
4194
4239
  } else {
4195
4240
  try {
4196
- paymentRequired = await chunkZDKNPNI3_cjs.parsePaymentRequiredResponse(response);
4241
+ paymentRequired = await chunk22FJ4JQO_cjs.parsePaymentRequiredResponse(response);
4197
4242
  } catch (err) {
4198
4243
  if (err instanceof MerchantEgressResponseCapError) throw err;
4199
4244
  return response;
@@ -4204,8 +4249,8 @@ var HavenClient = class {
4204
4249
  if (mcpSessionId) requestInit = this.merchantTransport.withSessionHeaders(requestInit, mcpSessionId);
4205
4250
  }
4206
4251
  const request = snapshotX402Request(url, requestInit);
4207
- const option = chunkZDKNPNI3_cjs.selectStandardPaymentOption(paymentRequired.accepts);
4208
- const idempotencyKey = options.idempotencyKey ?? (option ? chunkZDKNPNI3_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
4252
+ const option = chunk22FJ4JQO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
4253
+ const idempotencyKey = options.idempotencyKey ?? (option ? chunk22FJ4JQO_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
4209
4254
  let receipt;
4210
4255
  try {
4211
4256
  receipt = await this.authorizeX402(paymentRequired, options);
@@ -4333,7 +4378,7 @@ var HavenClient = class {
4333
4378
  txHash: evidenceTxHash,
4334
4379
  resourceUrl: evidenceContext.resourceUrl,
4335
4380
  merchantStatus: surfaced.status,
4336
- paymentProofHeaderName: chunkZDKNPNI3_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
4381
+ paymentProofHeaderName: chunk22FJ4JQO_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
4337
4382
  paymentProofHeader: input.paymentHeader,
4338
4383
  protocolReceiptHeaderName,
4339
4384
  protocolReceiptHeader,
@@ -4452,7 +4497,7 @@ var HavenClient = class {
4452
4497
  try {
4453
4498
  raw = await this.get(`/x402/by-idempotency-key/${encodeURIComponent(key)}`);
4454
4499
  } catch (err) {
4455
- if (err instanceof chunk4Z6ATE44_cjs.HavenApiError && err.statusCode === 404) return null;
4500
+ if (err instanceof chunkH37YVYZA_cjs.HavenApiError && err.statusCode === 404) return null;
4456
4501
  throw err;
4457
4502
  }
4458
4503
  return {
@@ -4587,6 +4632,7 @@ function sleep(ms) {
4587
4632
  function composeDescription(d) {
4588
4633
  return [d.summary, d.selectionGuidance, d.behavior, d.nextActionGuidance].filter(Boolean).join(" ");
4589
4634
  }
4635
+ var FUNDING_LEG_DISCOVERY_GUIDANCE = `funding_leg_expected is a catalog hint: among equivalent entries prefer false (erc7710, no funding leg); "unknown" is no preference; never hide true entries. A recipient-pinned budget can pay erc7710 merchants only. The quote's expected_funding_leg is authoritative.`;
4590
4636
  var toolDescriptions = {
4591
4637
  quoteX402: {
4592
4638
  summary: "Inspect an HTTP 402 x402 paid resource without creating a Haven payment, signature, approval, or on-chain transaction.",
@@ -4671,7 +4717,7 @@ var toolDescriptions = {
4671
4717
  discoverTools: {
4672
4718
  summary: "Step 1 of a purchase: discover payable services from Haven's curated merchant catalog \u2014 names, prices, the next call.",
4673
4719
  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 next tool to call.",
4674
- behavior: "Use each entry's suggested_tool + suggested_arguments first; an entry without them says why. 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, the hint, 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.",
4720
+ behavior: "Use each entry's suggested_tool + suggested_arguments first; an entry without them says why. 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, the hint, and the provenance badges source/domain_verified/verified_payable. " + FUNDING_LEG_DISCOVERY_GUIDANCE + " 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.",
4675
4721
  nextActionGuidance: `Call suggested_tool with suggested_arguments VERBATIM (no hint: read suggested_tool_omitted_reason). Confirm the price from the live quote or pay result, not the catalog; if the next tool takes a cap, pass the user's cap as max_amount_human in whole tokens ("no more than 1 USDC" \u2192 max_amount_human: "1"), never atomic units by hand.`
4676
4722
  },
4677
4723
  submitCatalogEntry: {
@@ -4913,9 +4959,17 @@ var havenTools = {
4913
4959
  openai: openaiTools
4914
4960
  };
4915
4961
 
4962
+ // src/catalog-funding-leg.ts
4963
+ function catalogFundingLegExpected(assetTransferMethods) {
4964
+ if (typeof assetTransferMethods !== "string") return "unknown";
4965
+ const methods = assetTransferMethods.split(",").map((method) => method.trim()).filter((method) => method.length > 0);
4966
+ if (methods.length === 0) return "unknown";
4967
+ return !methods.includes("erc7710");
4968
+ }
4969
+
4916
4970
  // src/agent-guidance.ts
4917
4971
  var AGENT_SECRET_HYGIENE_SENTENCE = "Do not print private keys, API keys, credential file contents, or config secrets in chat or logs.";
4918
- var AGENT_CLIENT_UPDATE_SENTENCE = "If a Haven result carries `client_update`, that client is out of date: run its `upgrade_command` as given, then any repair line it prints, then retry. `required: true` means payments are refused until you do.";
4972
+ var AGENT_CLIENT_UPDATE_SENTENCE = "If a Haven result carries `client_update`, that client is out of date: run its `upgrade_command` exactly as given \u2014 a connector command may name your pair with `--name <slug>` \u2014 then any repair line it prints, then retry. `required: true` means payments are refused until you do.";
4919
4973
  var AGENT_LOCAL_KEY_SENTENCE = "The Haven connector generates the signing key locally and sends Haven only the public signing address plus proof.";
4920
4974
  var AGENT_NETWORK_ACCESS_SENTENCE = "Network access is expected: this command downloads the npm package and contacts the Haven API, so if your environment is sandboxed, run it with network access enabled or request network access escalation; that changes the execution environment, not the command, and is not a command modification.";
4921
4975
  var AGENT_JSON_MODE_SENTENCE = "If you are an AI agent running this command yourself rather than a human pasting it, you should append --json: the connector then emits one machine-readable, secret-free result object on stdout with progress on stderr, and returns promptly instead of blocking while it waits for the budget approval.";
@@ -4963,7 +5017,7 @@ haven budget grant <agentId> --amount <n> --token USDC --period <minutes> [--rec
4963
5017
  haven budget revoke <agentId> <delegationHash> [--wait]
4964
5018
  \`\`\`
4965
5019
 
4966
- The CLI never signs: it prints a dashboard link, your user opens it and signs with their passkey or wallet. \`--wait\` polls until the human's signature lands. The hash for \`revoke\` is in \`haven agents show <agentId>\`.
5020
+ The CLI never signs: it prints a dashboard link, your user opens it and signs with their passkey or wallet. \`--wait\` polls until the human's signature lands. The hash for \`revoke\` is in \`haven budget show <agentId> --hashes\`.
4967
5021
 
4968
5022
  ## Hand-off scripts
4969
5023
 
@@ -5305,7 +5359,25 @@ the FINAL URL after redirects \u2014 and retry the merchant with the
5305
5359
  \`SIGN-IN-WITH-X\` header it returns: the delegate
5306
5360
  wallet signs in as the wallet that paid, moving no funds. NEVER follow a
5307
5361
  redirect with \`SIGN-IN-WITH-X\` (or a resulting session token) attached; if
5308
- the final origin differs, re-sign there. On THIS path Haven never sends the
5362
+ the final origin differs, re-sign there.
5363
+
5364
+ Sign in BEFORE a multi-call flow: if a merchant documents or offers a
5365
+ sign-in session (its docs, or a 402 whose \`sign-in-with-x\` extension names
5366
+ a free sign-in route), do not pay call by call. Send the unsigned sign-in
5367
+ request yourself, take the \`sign-in-with-x\` extension from its 402, and
5368
+ call \`mcp__haven-signer__haven_sign_siwx\` with it. The session token (often
5369
+ about 2 h) waives the merchant's micro-fees, so make every now-free call
5370
+ YOURSELF with the \`SIGN-IN-WITH-X\` header set \u2014 never pass a merchant
5371
+ session token to \`mcp__haven__haven_quote_x402\` or
5372
+ \`mcp__haven__haven_pay_x402_quote\` (their unpaid probe refuses a 200 with
5373
+ X402_PROBE_NOT_PAYMENT_REQUIRED) \u2014 and pay only where the merchant still
5374
+ charges (on Bitrefill, \`invoice/pay\`; keep sending the session token
5375
+ there). Sign at the FINAL URL after redirects, and never forward
5376
+ \`SIGN-IN-WITH-X\` or a session token across a redirect. If the signer's
5377
+ tools/list has no \`haven_sign_siwx\` (a signer older than 0.9.0-alpha.0),
5378
+ or the sign-in is refused, pay each call normally instead.
5379
+
5380
+ On THIS path Haven never sends the
5309
5381
  paid request (it sends only unpaid probes):
5310
5382
  on the **EIP-3009** scheme (the pay result names
5311
5383
  \`mcp__haven-signer__haven_sign_x402\`), that tool returns both
@@ -5424,6 +5496,20 @@ check on in-flight payments. Do not poll in a tight loop.
5424
5496
  reports a missing or invalid credential, tell the user to re-run the Haven
5425
5497
  connector command.
5426
5498
 
5499
+ ## Stale tool list
5500
+
5501
+ Every hosted Haven result carries \`contract_fingerprint\` and
5502
+ \`server_version\` at the top level of its JSON. If a result's
5503
+ \`contract_fingerprint\` differs from the one in the server instructions you
5504
+ loaded at connect, or a \`next_arguments\` doesn't fit the schema you loaded
5505
+ for the hosted tool it names, your tool list is stale \u2014 reconnect or restart
5506
+ the session before continuing, and never hand-build or reshape a payload to
5507
+ make it fit; defer to the live schema and the \`next_arguments\` Haven returns.
5508
+ (A misfit on a signer tool is signer skew, not a stale list.) If a payment is
5509
+ already prepared or funded, keep its \`payment_id\`: after reconnecting,
5510
+ resume through \`haven_get_payment_status\` or \`haven_resume_x402_payment\`
5511
+ (\`haven_sweep_delegate\` for a stranded bridge balance). Never pay again.
5512
+
5427
5513
  ## Failure handling
5428
5514
 
5429
5515
  Haven tool failures are shaped like \`{ success: false, code, message, ... }\`
@@ -5448,7 +5534,9 @@ fields a success does; follow them first, then branch on \`code\` and surface
5448
5534
  "cannot settle right now" signal (a 503 \`merchant_not_ready\` with a
5449
5535
  \`reason_code\`) instead of a 402. No payment was created. Tell the user;
5450
5536
  retry later (the message carries \`retry_after_s\` when the merchant gave
5451
- one) \u2014 this is not a wrong or broken endpoint.
5537
+ one) \u2014 this is not a wrong or broken endpoint. An out-of-gas refusal
5538
+ (\`settlement_wallet_out_of_gas\`) needs the merchant's operator to top up
5539
+ its settlement wallet first; retrying before then is refused again.
5452
5540
  - \`MERCHANT_REJECTED_AFTER_FUNDING\`: the merchant refused the paid retry.
5453
5541
  On eip3009 (\`rail\` not \`erc7710\`): Stop-and-sweep \u2014 stop retrying the
5454
5542
  merchant and use \`mcp__haven__haven_sweep_delegate\` to recover stranded
@@ -5576,7 +5664,7 @@ async function discoverMerchantMcpUrl(inputUrl, egress) {
5576
5664
  } catch (err) {
5577
5665
  if (err instanceof MerchantEgressRefusedError || err instanceof MerchantEgressResponseCapError) throw err;
5578
5666
  if (isBodyPhaseTimeout(err)) {
5579
- throw new chunk4Z6ATE44_cjs.MerchantTimeoutError(`Merchant discovery document read timed out after ${timeoutMs}ms.`);
5667
+ throw new chunkH37YVYZA_cjs.MerchantTimeoutError(`Merchant discovery document read timed out after ${timeoutMs}ms.`);
5580
5668
  }
5581
5669
  continue;
5582
5670
  }
@@ -5595,491 +5683,499 @@ function sameUrl(a, b) {
5595
5683
 
5596
5684
  Object.defineProperty(exports, "DEFAULT_NEXT_TOOL_BY_ACTION", {
5597
5685
  enumerable: true,
5598
- get: function () { return chunkZDKNPNI3_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
5686
+ get: function () { return chunk22FJ4JQO_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
5599
5687
  });
5600
5688
  Object.defineProperty(exports, "ERC7710_ASSET_TRANSFER_METHOD", {
5601
5689
  enumerable: true,
5602
- get: function () { return chunkZDKNPNI3_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
5690
+ get: function () { return chunk22FJ4JQO_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
5603
5691
  });
5604
5692
  Object.defineProperty(exports, "HAVEN_CLIENT_HEADER", {
5605
5693
  enumerable: true,
5606
- get: function () { return chunkZDKNPNI3_cjs.HAVEN_CLIENT_HEADER; }
5694
+ get: function () { return chunk22FJ4JQO_cjs.HAVEN_CLIENT_HEADER; }
5607
5695
  });
5608
5696
  Object.defineProperty(exports, "HAVEN_MINIMUM_NODE_VERSION", {
5609
5697
  enumerable: true,
5610
- get: function () { return chunkZDKNPNI3_cjs.HAVEN_MINIMUM_NODE_VERSION; }
5698
+ get: function () { return chunk22FJ4JQO_cjs.HAVEN_MINIMUM_NODE_VERSION; }
5611
5699
  });
5612
5700
  Object.defineProperty(exports, "HavenTypedDataRefusedError", {
5613
5701
  enumerable: true,
5614
- get: function () { return chunkZDKNPNI3_cjs.HavenTypedDataRefusedError; }
5702
+ get: function () { return chunk22FJ4JQO_cjs.HavenTypedDataRefusedError; }
5615
5703
  });
5616
5704
  Object.defineProperty(exports, "MAX_TASK_BUDGET_TTL_SECONDS", {
5617
5705
  enumerable: true,
5618
- get: function () { return chunkZDKNPNI3_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
5706
+ get: function () { return chunk22FJ4JQO_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
5619
5707
  });
5620
5708
  Object.defineProperty(exports, "NEXT_TOOL_SERVER_NAMES", {
5621
5709
  enumerable: true,
5622
- get: function () { return chunkZDKNPNI3_cjs.NEXT_TOOL_SERVER_NAMES; }
5710
+ get: function () { return chunk22FJ4JQO_cjs.NEXT_TOOL_SERVER_NAMES; }
5623
5711
  });
5624
5712
  Object.defineProperty(exports, "NEXT_TOOL_SERVER_ROLES", {
5625
5713
  enumerable: true,
5626
- get: function () { return chunkZDKNPNI3_cjs.NEXT_TOOL_SERVER_ROLES; }
5714
+ get: function () { return chunk22FJ4JQO_cjs.NEXT_TOOL_SERVER_ROLES; }
5627
5715
  });
5628
5716
  Object.defineProperty(exports, "SDK_CLIENT_IDENTITY", {
5629
5717
  enumerable: true,
5630
- get: function () { return chunkZDKNPNI3_cjs.SDK_CLIENT_IDENTITY; }
5718
+ get: function () { return chunk22FJ4JQO_cjs.SDK_CLIENT_IDENTITY; }
5631
5719
  });
5632
5720
  Object.defineProperty(exports, "SDK_VERSION", {
5633
5721
  enumerable: true,
5634
- get: function () { return chunkZDKNPNI3_cjs.SDK_VERSION; }
5722
+ get: function () { return chunk22FJ4JQO_cjs.SDK_VERSION; }
5635
5723
  });
5636
5724
  Object.defineProperty(exports, "SWEEP_BASE_CHAIN_ID", {
5637
5725
  enumerable: true,
5638
- get: function () { return chunkZDKNPNI3_cjs.SWEEP_BASE_CHAIN_ID; }
5726
+ get: function () { return chunk22FJ4JQO_cjs.SWEEP_BASE_CHAIN_ID; }
5639
5727
  });
5640
5728
  Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_CHAIN_ID", {
5641
5729
  enumerable: true,
5642
- get: function () { return chunkZDKNPNI3_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
5730
+ get: function () { return chunk22FJ4JQO_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
5643
5731
  });
5644
5732
  Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_USDC_ADDRESS", {
5645
5733
  enumerable: true,
5646
- get: function () { return chunkZDKNPNI3_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
5734
+ get: function () { return chunk22FJ4JQO_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
5647
5735
  });
5648
5736
  Object.defineProperty(exports, "SWEEP_BASE_USDC_ADDRESS", {
5649
5737
  enumerable: true,
5650
- get: function () { return chunkZDKNPNI3_cjs.SWEEP_BASE_USDC_ADDRESS; }
5738
+ get: function () { return chunk22FJ4JQO_cjs.SWEEP_BASE_USDC_ADDRESS; }
5651
5739
  });
5652
5740
  Object.defineProperty(exports, "TRANSFER_WITH_AUTHORIZATION_TYPES", {
5653
5741
  enumerable: true,
5654
- get: function () { return chunkZDKNPNI3_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
5742
+ get: function () { return chunk22FJ4JQO_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
5655
5743
  });
5656
5744
  Object.defineProperty(exports, "TYPED_DATA_NOT_ALLOWED", {
5657
5745
  enumerable: true,
5658
- get: function () { return chunkZDKNPNI3_cjs.TYPED_DATA_NOT_ALLOWED; }
5746
+ get: function () { return chunk22FJ4JQO_cjs.TYPED_DATA_NOT_ALLOWED; }
5659
5747
  });
5660
5748
  Object.defineProperty(exports, "X402PaymentHeaderValidationError", {
5661
5749
  enumerable: true,
5662
- get: function () { return chunkZDKNPNI3_cjs.X402PaymentHeaderValidationError; }
5750
+ get: function () { return chunk22FJ4JQO_cjs.X402PaymentHeaderValidationError; }
5663
5751
  });
5664
5752
  Object.defineProperty(exports, "X402_LEGACY_PAYMENT_HEADER_NAME", {
5665
5753
  enumerable: true,
5666
- get: function () { return chunkZDKNPNI3_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
5754
+ get: function () { return chunk22FJ4JQO_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
5667
5755
  });
5668
5756
  Object.defineProperty(exports, "X402_MAX_AUTHORIZATION_WINDOW_SECONDS", {
5669
5757
  enumerable: true,
5670
- get: function () { return chunkZDKNPNI3_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
5758
+ get: function () { return chunk22FJ4JQO_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
5671
5759
  });
5672
5760
  Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAME", {
5673
5761
  enumerable: true,
5674
- get: function () { return chunkZDKNPNI3_cjs.X402_PAYMENT_HEADER_NAME; }
5762
+ get: function () { return chunk22FJ4JQO_cjs.X402_PAYMENT_HEADER_NAME; }
5675
5763
  });
5676
5764
  Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAMES_SENT", {
5677
5765
  enumerable: true,
5678
- get: function () { return chunkZDKNPNI3_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
5766
+ get: function () { return chunk22FJ4JQO_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
5767
+ });
5768
+ Object.defineProperty(exports, "X402_PAYMENT_NONCE_TAG", {
5769
+ enumerable: true,
5770
+ get: function () { return chunk22FJ4JQO_cjs.X402_PAYMENT_NONCE_TAG; }
5679
5771
  });
5680
5772
  Object.defineProperty(exports, "X402_PAYMENT_REQUIRED_HEADER_NAME", {
5681
5773
  enumerable: true,
5682
- get: function () { return chunkZDKNPNI3_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
5774
+ get: function () { return chunk22FJ4JQO_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
5683
5775
  });
5684
5776
  Object.defineProperty(exports, "X402_PAYMENT_RESPONSE_HEADER_NAME", {
5685
5777
  enumerable: true,
5686
- get: function () { return chunkZDKNPNI3_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
5778
+ get: function () { return chunk22FJ4JQO_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
5687
5779
  });
5688
5780
  Object.defineProperty(exports, "X402_SETTLEMENT_FORWARD_MARGIN_SECONDS", {
5689
5781
  enumerable: true,
5690
- get: function () { return chunkZDKNPNI3_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
5782
+ get: function () { return chunk22FJ4JQO_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
5691
5783
  });
5692
5784
  Object.defineProperty(exports, "assertBoundDirectPaymentUserOp", {
5693
5785
  enumerable: true,
5694
- get: function () { return chunkZDKNPNI3_cjs.assertBoundDirectPaymentUserOp; }
5786
+ get: function () { return chunk22FJ4JQO_cjs.assertBoundDirectPaymentUserOp; }
5695
5787
  });
5696
5788
  Object.defineProperty(exports, "assertOwnTaskBudgetCloseUserOp", {
5697
5789
  enumerable: true,
5698
- get: function () { return chunkZDKNPNI3_cjs.assertOwnTaskBudgetCloseUserOp; }
5790
+ get: function () { return chunk22FJ4JQO_cjs.assertOwnTaskBudgetCloseUserOp; }
5699
5791
  });
5700
5792
  Object.defineProperty(exports, "assertOwnTaskChild", {
5701
5793
  enumerable: true,
5702
- get: function () { return chunkZDKNPNI3_cjs.assertOwnTaskChild; }
5794
+ get: function () { return chunk22FJ4JQO_cjs.assertOwnTaskChild; }
5703
5795
  });
5704
5796
  Object.defineProperty(exports, "buildSweepAuthorizationMessage", {
5705
5797
  enumerable: true,
5706
- get: function () { return chunkZDKNPNI3_cjs.buildSweepAuthorizationMessage; }
5798
+ get: function () { return chunk22FJ4JQO_cjs.buildSweepAuthorizationMessage; }
5707
5799
  });
5708
5800
  Object.defineProperty(exports, "buildSweepTypedData", {
5709
5801
  enumerable: true,
5710
- get: function () { return chunkZDKNPNI3_cjs.buildSweepTypedData; }
5802
+ get: function () { return chunk22FJ4JQO_cjs.buildSweepTypedData; }
5711
5803
  });
5712
5804
  Object.defineProperty(exports, "buildX402ExpectedMessage", {
5713
5805
  enumerable: true,
5714
- get: function () { return chunkZDKNPNI3_cjs.buildX402ExpectedMessage; }
5806
+ get: function () { return chunk22FJ4JQO_cjs.buildX402ExpectedMessage; }
5715
5807
  });
5716
5808
  Object.defineProperty(exports, "compareNodeVersions", {
5717
5809
  enumerable: true,
5718
- get: function () { return chunkZDKNPNI3_cjs.compareNodeVersions; }
5810
+ get: function () { return chunk22FJ4JQO_cjs.compareNodeVersions; }
5719
5811
  });
5720
5812
  Object.defineProperty(exports, "createNextStepBuilder", {
5721
5813
  enumerable: true,
5722
- get: function () { return chunkZDKNPNI3_cjs.createNextStepBuilder; }
5814
+ get: function () { return chunk22FJ4JQO_cjs.createNextStepBuilder; }
5723
5815
  });
5724
5816
  Object.defineProperty(exports, "decodeBase64Json", {
5725
5817
  enumerable: true,
5726
- get: function () { return chunkZDKNPNI3_cjs.decodeBase64Json; }
5818
+ get: function () { return chunk22FJ4JQO_cjs.decodeBase64Json; }
5727
5819
  });
5728
5820
  Object.defineProperty(exports, "decodeBase64Utf8", {
5729
5821
  enumerable: true,
5730
- get: function () { return chunkZDKNPNI3_cjs.decodeBase64Utf8; }
5822
+ get: function () { return chunk22FJ4JQO_cjs.decodeBase64Utf8; }
5731
5823
  });
5732
5824
  Object.defineProperty(exports, "defaultNextToolFor", {
5733
5825
  enumerable: true,
5734
- get: function () { return chunkZDKNPNI3_cjs.defaultNextToolFor; }
5826
+ get: function () { return chunk22FJ4JQO_cjs.defaultNextToolFor; }
5827
+ });
5828
+ Object.defineProperty(exports, "deriveX402PaymentNonce", {
5829
+ enumerable: true,
5830
+ get: function () { return chunk22FJ4JQO_cjs.deriveX402PaymentNonce; }
5735
5831
  });
5736
5832
  Object.defineProperty(exports, "encodeBase64Json", {
5737
5833
  enumerable: true,
5738
- get: function () { return chunkZDKNPNI3_cjs.encodeBase64Json; }
5834
+ get: function () { return chunk22FJ4JQO_cjs.encodeBase64Json; }
5739
5835
  });
5740
5836
  Object.defineProperty(exports, "encodeBase64Utf8", {
5741
5837
  enumerable: true,
5742
- get: function () { return chunkZDKNPNI3_cjs.encodeBase64Utf8; }
5838
+ get: function () { return chunk22FJ4JQO_cjs.encodeBase64Utf8; }
5743
5839
  });
5744
5840
  Object.defineProperty(exports, "encodePaymentProof", {
5745
5841
  enumerable: true,
5746
- get: function () { return chunkZDKNPNI3_cjs.encodePaymentProof; }
5842
+ get: function () { return chunk22FJ4JQO_cjs.encodePaymentProof; }
5747
5843
  });
5748
5844
  Object.defineProperty(exports, "hashDelegation", {
5749
5845
  enumerable: true,
5750
- get: function () { return chunkZDKNPNI3_cjs.hashDelegation; }
5846
+ get: function () { return chunk22FJ4JQO_cjs.hashDelegation; }
5751
5847
  });
5752
5848
  Object.defineProperty(exports, "havenClientIdentity", {
5753
5849
  enumerable: true,
5754
- get: function () { return chunkZDKNPNI3_cjs.havenClientIdentity; }
5850
+ get: function () { return chunk22FJ4JQO_cjs.havenClientIdentity; }
5755
5851
  });
5756
5852
  Object.defineProperty(exports, "isErc7710Option", {
5757
5853
  enumerable: true,
5758
- get: function () { return chunkZDKNPNI3_cjs.isErc7710Option; }
5854
+ get: function () { return chunk22FJ4JQO_cjs.isErc7710Option; }
5759
5855
  });
5760
5856
  Object.defineProperty(exports, "isSupportedNodeVersion", {
5761
5857
  enumerable: true,
5762
- get: function () { return chunkZDKNPNI3_cjs.isSupportedNodeVersion; }
5858
+ get: function () { return chunk22FJ4JQO_cjs.isSupportedNodeVersion; }
5763
5859
  });
5764
5860
  Object.defineProperty(exports, "isSweepableChain", {
5765
5861
  enumerable: true,
5766
- get: function () { return chunkZDKNPNI3_cjs.isSweepableChain; }
5862
+ get: function () { return chunk22FJ4JQO_cjs.isSweepableChain; }
5767
5863
  });
5768
5864
  Object.defineProperty(exports, "isTaskChildTypedData", {
5769
5865
  enumerable: true,
5770
- get: function () { return chunkZDKNPNI3_cjs.isTaskChildTypedData; }
5866
+ get: function () { return chunk22FJ4JQO_cjs.isTaskChildTypedData; }
5771
5867
  });
5772
5868
  Object.defineProperty(exports, "normalizePaymentRequired", {
5773
5869
  enumerable: true,
5774
- get: function () { return chunkZDKNPNI3_cjs.normalizePaymentRequired; }
5870
+ get: function () { return chunk22FJ4JQO_cjs.normalizePaymentRequired; }
5775
5871
  });
5776
5872
  Object.defineProperty(exports, "parseNextTool", {
5777
5873
  enumerable: true,
5778
- get: function () { return chunkZDKNPNI3_cjs.parseNextTool; }
5874
+ get: function () { return chunk22FJ4JQO_cjs.parseNextTool; }
5779
5875
  });
5780
5876
  Object.defineProperty(exports, "parsePaymentRequired", {
5781
5877
  enumerable: true,
5782
- get: function () { return chunkZDKNPNI3_cjs.parsePaymentRequired; }
5878
+ get: function () { return chunk22FJ4JQO_cjs.parsePaymentRequired; }
5783
5879
  });
5784
5880
  Object.defineProperty(exports, "parsePaymentRequiredResponse", {
5785
5881
  enumerable: true,
5786
- get: function () { return chunkZDKNPNI3_cjs.parsePaymentRequiredResponse; }
5882
+ get: function () { return chunk22FJ4JQO_cjs.parsePaymentRequiredResponse; }
5787
5883
  });
5788
5884
  Object.defineProperty(exports, "readClientUpdate", {
5789
5885
  enumerable: true,
5790
- get: function () { return chunkZDKNPNI3_cjs.readClientUpdate; }
5886
+ get: function () { return chunk22FJ4JQO_cjs.readClientUpdate; }
5791
5887
  });
5792
5888
  Object.defineProperty(exports, "renderNextTool", {
5793
5889
  enumerable: true,
5794
- get: function () { return chunkZDKNPNI3_cjs.renderNextTool; }
5890
+ get: function () { return chunk22FJ4JQO_cjs.renderNextTool; }
5795
5891
  });
5796
5892
  Object.defineProperty(exports, "resolveTokenBySymbol", {
5797
5893
  enumerable: true,
5798
- get: function () { return chunkZDKNPNI3_cjs.resolveTokenBySymbol; }
5894
+ get: function () { return chunk22FJ4JQO_cjs.resolveTokenBySymbol; }
5799
5895
  });
5800
5896
  Object.defineProperty(exports, "resolveTokenFromAddress", {
5801
5897
  enumerable: true,
5802
- get: function () { return chunkZDKNPNI3_cjs.resolveTokenFromAddress; }
5898
+ get: function () { return chunk22FJ4JQO_cjs.resolveTokenFromAddress; }
5803
5899
  });
5804
5900
  Object.defineProperty(exports, "selectErc7710PaymentOption", {
5805
5901
  enumerable: true,
5806
- get: function () { return chunkZDKNPNI3_cjs.selectErc7710PaymentOption; }
5902
+ get: function () { return chunk22FJ4JQO_cjs.selectErc7710PaymentOption; }
5807
5903
  });
5808
5904
  Object.defineProperty(exports, "selectPaymentOption", {
5809
5905
  enumerable: true,
5810
- get: function () { return chunkZDKNPNI3_cjs.selectPaymentOption; }
5906
+ get: function () { return chunk22FJ4JQO_cjs.selectPaymentOption; }
5811
5907
  });
5812
5908
  Object.defineProperty(exports, "selectStandardPaymentOption", {
5813
5909
  enumerable: true,
5814
- get: function () { return chunkZDKNPNI3_cjs.selectStandardPaymentOption; }
5910
+ get: function () { return chunk22FJ4JQO_cjs.selectStandardPaymentOption; }
5815
5911
  });
5816
5912
  Object.defineProperty(exports, "selectX402SettlementScheme", {
5817
5913
  enumerable: true,
5818
- get: function () { return chunkZDKNPNI3_cjs.selectX402SettlementScheme; }
5914
+ get: function () { return chunk22FJ4JQO_cjs.selectX402SettlementScheme; }
5819
5915
  });
5820
5916
  Object.defineProperty(exports, "sweepUsdcAddress", {
5821
5917
  enumerable: true,
5822
- get: function () { return chunkZDKNPNI3_cjs.sweepUsdcAddress; }
5918
+ get: function () { return chunk22FJ4JQO_cjs.sweepUsdcAddress; }
5823
5919
  });
5824
5920
  Object.defineProperty(exports, "sweepUsdcDomain", {
5825
5921
  enumerable: true,
5826
- get: function () { return chunkZDKNPNI3_cjs.sweepUsdcDomain; }
5922
+ get: function () { return chunk22FJ4JQO_cjs.sweepUsdcDomain; }
5827
5923
  });
5828
5924
  Object.defineProperty(exports, "toStandardPaymentRequirements", {
5829
5925
  enumerable: true,
5830
- get: function () { return chunkZDKNPNI3_cjs.toStandardPaymentRequirements; }
5926
+ get: function () { return chunk22FJ4JQO_cjs.toStandardPaymentRequirements; }
5831
5927
  });
5832
5928
  Object.defineProperty(exports, "unsupportedNodeVersionMessage", {
5833
5929
  enumerable: true,
5834
- get: function () { return chunkZDKNPNI3_cjs.unsupportedNodeVersionMessage; }
5930
+ get: function () { return chunk22FJ4JQO_cjs.unsupportedNodeVersionMessage; }
5835
5931
  });
5836
5932
  Object.defineProperty(exports, "validateStandardX402PaymentHeader", {
5837
5933
  enumerable: true,
5838
- get: function () { return chunkZDKNPNI3_cjs.validateStandardX402PaymentHeader; }
5934
+ get: function () { return chunk22FJ4JQO_cjs.validateStandardX402PaymentHeader; }
5839
5935
  });
5840
5936
  Object.defineProperty(exports, "x402AssetTransferMethod", {
5841
5937
  enumerable: true,
5842
- get: function () { return chunkZDKNPNI3_cjs.x402AssetTransferMethod; }
5938
+ get: function () { return chunk22FJ4JQO_cjs.x402AssetTransferMethod; }
5843
5939
  });
5844
5940
  Object.defineProperty(exports, "x402AuthorizationAmount", {
5845
5941
  enumerable: true,
5846
- get: function () { return chunkZDKNPNI3_cjs.x402AuthorizationAmount; }
5942
+ get: function () { return chunk22FJ4JQO_cjs.x402AuthorizationAmount; }
5847
5943
  });
5848
5944
  Object.defineProperty(exports, "x402FacilitatorAddresses", {
5849
5945
  enumerable: true,
5850
- get: function () { return chunkZDKNPNI3_cjs.x402FacilitatorAddresses; }
5946
+ get: function () { return chunk22FJ4JQO_cjs.x402FacilitatorAddresses; }
5851
5947
  });
5852
5948
  Object.defineProperty(exports, "x402PaymentHeaderNamesFor", {
5853
5949
  enumerable: true,
5854
- get: function () { return chunkZDKNPNI3_cjs.x402PaymentHeaderNamesFor; }
5950
+ get: function () { return chunk22FJ4JQO_cjs.x402PaymentHeaderNamesFor; }
5855
5951
  });
5856
5952
  Object.defineProperty(exports, "x402RetryHeadersFor", {
5857
5953
  enumerable: true,
5858
- get: function () { return chunkZDKNPNI3_cjs.x402RetryHeadersFor; }
5954
+ get: function () { return chunk22FJ4JQO_cjs.x402RetryHeadersFor; }
5859
5955
  });
5860
5956
  Object.defineProperty(exports, "x402V2PaymentEnvelope", {
5861
5957
  enumerable: true,
5862
- get: function () { return chunkZDKNPNI3_cjs.x402V2PaymentEnvelope; }
5958
+ get: function () { return chunk22FJ4JQO_cjs.x402V2PaymentEnvelope; }
5863
5959
  });
5864
5960
  Object.defineProperty(exports, "RECEIPT_VERSION", {
5865
5961
  enumerable: true,
5866
- get: function () { return chunk7UTWSJC5_cjs.RECEIPT_VERSION; }
5962
+ get: function () { return chunk6LEXYQ7J_cjs.RECEIPT_VERSION; }
5867
5963
  });
5868
5964
  Object.defineProperty(exports, "verifyPaymentReceipt", {
5869
5965
  enumerable: true,
5870
- get: function () { return chunk7UTWSJC5_cjs.verifyPaymentReceipt; }
5966
+ get: function () { return chunk6LEXYQ7J_cjs.verifyPaymentReceipt; }
5871
5967
  });
5872
5968
  Object.defineProperty(exports, "AGENT_PAYMENT_FAILURE_CODE_VALUES", {
5873
5969
  enumerable: true,
5874
- get: function () { return chunk4Z6ATE44_cjs.AGENT_PAYMENT_FAILURE_CODE_VALUES; }
5970
+ get: function () { return chunkH37YVYZA_cjs.AGENT_PAYMENT_FAILURE_CODE_VALUES; }
5875
5971
  });
5876
5972
  Object.defineProperty(exports, "AGENT_PAYMENT_NEXT_ACTION_VALUES", {
5877
5973
  enumerable: true,
5878
- get: function () { return chunk4Z6ATE44_cjs.AGENT_PAYMENT_NEXT_ACTION_VALUES; }
5974
+ get: function () { return chunkH37YVYZA_cjs.AGENT_PAYMENT_NEXT_ACTION_VALUES; }
5879
5975
  });
5880
5976
  Object.defineProperty(exports, "AGENT_PAYMENT_PHASE_VALUES", {
5881
5977
  enumerable: true,
5882
- get: function () { return chunk4Z6ATE44_cjs.AGENT_PAYMENT_PHASE_VALUES; }
5978
+ get: function () { return chunkH37YVYZA_cjs.AGENT_PAYMENT_PHASE_VALUES; }
5883
5979
  });
5884
5980
  Object.defineProperty(exports, "AGENT_PAYMENT_RAIL_VALUES", {
5885
5981
  enumerable: true,
5886
- get: function () { return chunk4Z6ATE44_cjs.AGENT_PAYMENT_RAIL_VALUES; }
5982
+ get: function () { return chunkH37YVYZA_cjs.AGENT_PAYMENT_RAIL_VALUES; }
5887
5983
  });
5888
5984
  Object.defineProperty(exports, "AgentPaymentFailureCode", {
5889
5985
  enumerable: true,
5890
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentFailureCode; }
5986
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentFailureCode; }
5891
5987
  });
5892
5988
  Object.defineProperty(exports, "AgentPaymentFailureCodeDescriptions", {
5893
5989
  enumerable: true,
5894
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentFailureCodeDescriptions; }
5990
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentFailureCodeDescriptions; }
5895
5991
  });
5896
5992
  Object.defineProperty(exports, "AgentPaymentFailureCodeSchema", {
5897
5993
  enumerable: true,
5898
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentFailureCodeSchema; }
5994
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentFailureCodeSchema; }
5899
5995
  });
5900
5996
  Object.defineProperty(exports, "AgentPaymentNextAction", {
5901
5997
  enumerable: true,
5902
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentNextAction; }
5998
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentNextAction; }
5903
5999
  });
5904
6000
  Object.defineProperty(exports, "AgentPaymentNextActionDescriptions", {
5905
6001
  enumerable: true,
5906
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentNextActionDescriptions; }
6002
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentNextActionDescriptions; }
5907
6003
  });
5908
6004
  Object.defineProperty(exports, "AgentPaymentNextActionSchema", {
5909
6005
  enumerable: true,
5910
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentNextActionSchema; }
6006
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentNextActionSchema; }
5911
6007
  });
5912
6008
  Object.defineProperty(exports, "AgentPaymentPhase", {
5913
6009
  enumerable: true,
5914
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentPhase; }
6010
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentPhase; }
5915
6011
  });
5916
6012
  Object.defineProperty(exports, "AgentPaymentPhaseDescriptions", {
5917
6013
  enumerable: true,
5918
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentPhaseDescriptions; }
6014
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentPhaseDescriptions; }
5919
6015
  });
5920
6016
  Object.defineProperty(exports, "AgentPaymentPhaseSchema", {
5921
6017
  enumerable: true,
5922
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentPhaseSchema; }
6018
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentPhaseSchema; }
5923
6019
  });
5924
6020
  Object.defineProperty(exports, "AgentPaymentRail", {
5925
6021
  enumerable: true,
5926
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentRail; }
6022
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentRail; }
5927
6023
  });
5928
6024
  Object.defineProperty(exports, "AgentPaymentRailDescriptions", {
5929
6025
  enumerable: true,
5930
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentRailDescriptions; }
6026
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentRailDescriptions; }
5931
6027
  });
5932
6028
  Object.defineProperty(exports, "AgentPaymentRailSchema", {
5933
6029
  enumerable: true,
5934
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentRailSchema; }
6030
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentRailSchema; }
5935
6031
  });
5936
6032
  Object.defineProperty(exports, "AgentPaymentWarningCode", {
5937
6033
  enumerable: true,
5938
- get: function () { return chunk4Z6ATE44_cjs.AgentPaymentWarningCode; }
6034
+ get: function () { return chunkH37YVYZA_cjs.AgentPaymentWarningCode; }
5939
6035
  });
5940
6036
  Object.defineProperty(exports, "CONNECTOR_PACKAGE_NAME", {
5941
6037
  enumerable: true,
5942
- get: function () { return chunk4Z6ATE44_cjs.CONNECTOR_PACKAGE_NAME; }
6038
+ get: function () { return chunkH37YVYZA_cjs.CONNECTOR_PACKAGE_NAME; }
5943
6039
  });
5944
6040
  Object.defineProperty(exports, "DEFAULT_CONFIRMATION_TIMEOUT_MS", {
5945
6041
  enumerable: true,
5946
- get: function () { return chunk4Z6ATE44_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS; }
6042
+ get: function () { return chunkH37YVYZA_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS; }
5947
6043
  });
5948
6044
  Object.defineProperty(exports, "DIRECT_SIGN_CONTEXT_VERSION", {
5949
6045
  enumerable: true,
5950
- get: function () { return chunk4Z6ATE44_cjs.DIRECT_SIGN_CONTEXT_VERSION; }
6046
+ get: function () { return chunkH37YVYZA_cjs.DIRECT_SIGN_CONTEXT_VERSION; }
5951
6047
  });
5952
6048
  Object.defineProperty(exports, "ENTRY_POINT_V07", {
5953
6049
  enumerable: true,
5954
- get: function () { return chunk4Z6ATE44_cjs.ENTRY_POINT_V07; }
6050
+ get: function () { return chunkH37YVYZA_cjs.ENTRY_POINT_V07; }
5955
6051
  });
5956
6052
  Object.defineProperty(exports, "HAVEN_CONNECTOR_CHANNEL", {
5957
6053
  enumerable: true,
5958
- get: function () { return chunk4Z6ATE44_cjs.HAVEN_CONNECTOR_CHANNEL; }
6054
+ get: function () { return chunkH37YVYZA_cjs.HAVEN_CONNECTOR_CHANNEL; }
5959
6055
  });
5960
6056
  Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_NAME", {
5961
6057
  enumerable: true,
5962
- get: function () { return chunk4Z6ATE44_cjs.HYBRID_DELEGATOR_DOMAIN_NAME; }
6058
+ get: function () { return chunkH37YVYZA_cjs.HYBRID_DELEGATOR_DOMAIN_NAME; }
5963
6059
  });
5964
6060
  Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_VERSION", {
5965
6061
  enumerable: true,
5966
- get: function () { return chunk4Z6ATE44_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION; }
6062
+ get: function () { return chunkH37YVYZA_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION; }
5967
6063
  });
5968
6064
  Object.defineProperty(exports, "HavenApiError", {
5969
6065
  enumerable: true,
5970
- get: function () { return chunk4Z6ATE44_cjs.HavenApiError; }
6066
+ get: function () { return chunkH37YVYZA_cjs.HavenApiError; }
5971
6067
  });
5972
6068
  Object.defineProperty(exports, "HavenError", {
5973
6069
  enumerable: true,
5974
- get: function () { return chunk4Z6ATE44_cjs.HavenError; }
6070
+ get: function () { return chunkH37YVYZA_cjs.HavenError; }
5975
6071
  });
5976
6072
  Object.defineProperty(exports, "HavenPaymentStateError", {
5977
6073
  enumerable: true,
5978
- get: function () { return chunk4Z6ATE44_cjs.HavenPaymentStateError; }
6074
+ get: function () { return chunkH37YVYZA_cjs.HavenPaymentStateError; }
5979
6075
  });
5980
6076
  Object.defineProperty(exports, "HavenSigningError", {
5981
6077
  enumerable: true,
5982
- get: function () { return chunk4Z6ATE44_cjs.HavenSigningError; }
6078
+ get: function () { return chunkH37YVYZA_cjs.HavenSigningError; }
5983
6079
  });
5984
6080
  Object.defineProperty(exports, "HavenTimeoutError", {
5985
6081
  enumerable: true,
5986
- get: function () { return chunk4Z6ATE44_cjs.HavenTimeoutError; }
6082
+ get: function () { return chunkH37YVYZA_cjs.HavenTimeoutError; }
5987
6083
  });
5988
6084
  Object.defineProperty(exports, "HavenUnsupportedSignerVersionError", {
5989
6085
  enumerable: true,
5990
- get: function () { return chunk4Z6ATE44_cjs.HavenUnsupportedSignerVersionError; }
6086
+ get: function () { return chunkH37YVYZA_cjs.HavenUnsupportedSignerVersionError; }
5991
6087
  });
5992
6088
  Object.defineProperty(exports, "HavenUserOpBindingError", {
5993
6089
  enumerable: true,
5994
- get: function () { return chunk4Z6ATE44_cjs.HavenUserOpBindingError; }
6090
+ get: function () { return chunkH37YVYZA_cjs.HavenUserOpBindingError; }
5995
6091
  });
5996
6092
  Object.defineProperty(exports, "HavenZeroSettlementHashError", {
5997
6093
  enumerable: true,
5998
- get: function () { return chunk4Z6ATE44_cjs.HavenZeroSettlementHashError; }
6094
+ get: function () { return chunkH37YVYZA_cjs.HavenZeroSettlementHashError; }
5999
6095
  });
6000
6096
  Object.defineProperty(exports, "MerchantTimeoutError", {
6001
6097
  enumerable: true,
6002
- get: function () { return chunk4Z6ATE44_cjs.MerchantTimeoutError; }
6098
+ get: function () { return chunkH37YVYZA_cjs.MerchantTimeoutError; }
6003
6099
  });
6004
6100
  Object.defineProperty(exports, "PACKED_USER_OPERATION_FIELDS", {
6005
6101
  enumerable: true,
6006
- get: function () { return chunk4Z6ATE44_cjs.PACKED_USER_OPERATION_FIELDS; }
6102
+ get: function () { return chunkH37YVYZA_cjs.PACKED_USER_OPERATION_FIELDS; }
6007
6103
  });
6008
6104
  Object.defineProperty(exports, "ROOT_AUTHORITY", {
6009
6105
  enumerable: true,
6010
- get: function () { return chunk4Z6ATE44_cjs.ROOT_AUTHORITY; }
6106
+ get: function () { return chunkH37YVYZA_cjs.ROOT_AUTHORITY; }
6011
6107
  });
6012
6108
  Object.defineProperty(exports, "SIGNER_UPDATE_FALLBACK", {
6013
6109
  enumerable: true,
6014
- get: function () { return chunk4Z6ATE44_cjs.SIGNER_UPDATE_FALLBACK; }
6110
+ get: function () { return chunkH37YVYZA_cjs.SIGNER_UPDATE_FALLBACK; }
6015
6111
  });
6016
6112
  Object.defineProperty(exports, "SignerRefusalCode", {
6017
6113
  enumerable: true,
6018
- get: function () { return chunk4Z6ATE44_cjs.SignerRefusalCode; }
6114
+ get: function () { return chunkH37YVYZA_cjs.SignerRefusalCode; }
6019
6115
  });
6020
6116
  Object.defineProperty(exports, "TASK_SIGN_CONTEXT_VERSION", {
6021
6117
  enumerable: true,
6022
- get: function () { return chunk4Z6ATE44_cjs.TASK_SIGN_CONTEXT_VERSION; }
6118
+ get: function () { return chunkH37YVYZA_cjs.TASK_SIGN_CONTEXT_VERSION; }
6023
6119
  });
6024
6120
  Object.defineProperty(exports, "X402AlreadySettledError", {
6025
6121
  enumerable: true,
6026
- get: function () { return chunk4Z6ATE44_cjs.X402AlreadySettledError; }
6122
+ get: function () { return chunkH37YVYZA_cjs.X402AlreadySettledError; }
6027
6123
  });
6028
6124
  Object.defineProperty(exports, "X402Erc7710AlreadySettledError", {
6029
6125
  enumerable: true,
6030
- get: function () { return chunk4Z6ATE44_cjs.X402Erc7710AlreadySettledError; }
6126
+ get: function () { return chunkH37YVYZA_cjs.X402Erc7710AlreadySettledError; }
6031
6127
  });
6032
6128
  Object.defineProperty(exports, "X402TaskBudgetMismatchError", {
6033
6129
  enumerable: true,
6034
- get: function () { return chunk4Z6ATE44_cjs.X402TaskBudgetMismatchError; }
6130
+ get: function () { return chunkH37YVYZA_cjs.X402TaskBudgetMismatchError; }
6035
6131
  });
6036
6132
  Object.defineProperty(exports, "X402UnexpectedStatusError", {
6037
6133
  enumerable: true,
6038
- get: function () { return chunk4Z6ATE44_cjs.X402UnexpectedStatusError; }
6134
+ get: function () { return chunkH37YVYZA_cjs.X402UnexpectedStatusError; }
6039
6135
  });
6040
6136
  Object.defineProperty(exports, "assertUserOpTypedDataBinding", {
6041
6137
  enumerable: true,
6042
- get: function () { return chunk4Z6ATE44_cjs.assertUserOpTypedDataBinding; }
6138
+ get: function () { return chunkH37YVYZA_cjs.assertUserOpTypedDataBinding; }
6043
6139
  });
6044
6140
  Object.defineProperty(exports, "connectorRerunCommand", {
6045
6141
  enumerable: true,
6046
- get: function () { return chunk4Z6ATE44_cjs.connectorRerunCommand; }
6142
+ get: function () { return chunkH37YVYZA_cjs.connectorRerunCommand; }
6047
6143
  });
6048
6144
  Object.defineProperty(exports, "connectorSpec", {
6049
6145
  enumerable: true,
6050
- get: function () { return chunk4Z6ATE44_cjs.connectorSpec; }
6146
+ get: function () { return chunkH37YVYZA_cjs.connectorSpec; }
6051
6147
  });
6052
6148
  Object.defineProperty(exports, "connectorUpgradeCommand", {
6053
6149
  enumerable: true,
6054
- get: function () { return chunk4Z6ATE44_cjs.connectorUpgradeCommand; }
6150
+ get: function () { return chunkH37YVYZA_cjs.connectorUpgradeCommand; }
6055
6151
  });
6056
6152
  Object.defineProperty(exports, "deriveDelegateAccountAddress", {
6057
6153
  enumerable: true,
6058
- get: function () { return chunk4Z6ATE44_cjs.deriveDelegateAccountAddress; }
6154
+ get: function () { return chunkH37YVYZA_cjs.deriveDelegateAccountAddress; }
6059
6155
  });
6060
6156
  Object.defineProperty(exports, "isConnectorChannel", {
6061
6157
  enumerable: true,
6062
- get: function () { return chunk4Z6ATE44_cjs.isConnectorChannel; }
6158
+ get: function () { return chunkH37YVYZA_cjs.isConnectorChannel; }
6063
6159
  });
6064
6160
  Object.defineProperty(exports, "isPackedUserOperationTypedData", {
6065
6161
  enumerable: true,
6066
- get: function () { return chunk4Z6ATE44_cjs.isPackedUserOperationTypedData; }
6162
+ get: function () { return chunkH37YVYZA_cjs.isPackedUserOperationTypedData; }
6067
6163
  });
6068
6164
  Object.defineProperty(exports, "packedUserOperationHash", {
6069
6165
  enumerable: true,
6070
- get: function () { return chunk4Z6ATE44_cjs.packedUserOperationHash; }
6166
+ get: function () { return chunkH37YVYZA_cjs.packedUserOperationHash; }
6071
6167
  });
6072
6168
  Object.defineProperty(exports, "resolveConnectorChannel", {
6073
6169
  enumerable: true,
6074
- get: function () { return chunk4Z6ATE44_cjs.resolveConnectorChannel; }
6170
+ get: function () { return chunkH37YVYZA_cjs.resolveConnectorChannel; }
6075
6171
  });
6076
6172
  Object.defineProperty(exports, "signerUpdateFallback", {
6077
6173
  enumerable: true,
6078
- get: function () { return chunk4Z6ATE44_cjs.signerUpdateFallback; }
6174
+ get: function () { return chunkH37YVYZA_cjs.signerUpdateFallback; }
6079
6175
  });
6080
6176
  Object.defineProperty(exports, "verifySettlementChild", {
6081
6177
  enumerable: true,
6082
- get: function () { return chunk4Z6ATE44_cjs.verifySettlementChild; }
6178
+ get: function () { return chunkH37YVYZA_cjs.verifySettlementChild; }
6083
6179
  });
6084
6180
  exports.AGENT_APPROVAL_RELAY_JSON_SENTENCE = AGENT_APPROVAL_RELAY_JSON_SENTENCE;
6085
6181
  exports.AGENT_APPROVAL_RELAY_PROSE_SENTENCE = AGENT_APPROVAL_RELAY_PROSE_SENTENCE;
@@ -6111,6 +6207,7 @@ exports.SKILL_FOLDER_NAME = SKILL_FOLDER_NAME;
6111
6207
  exports.addressFromKey = addressFromKey;
6112
6208
  exports.assertPublicHttpsMerchantUrl = assertPublicHttpsMerchantUrl;
6113
6209
  exports.assertSecureX402RetryTarget = assertSecureX402RetryTarget;
6210
+ exports.catalogFundingLegExpected = catalogFundingLegExpected;
6114
6211
  exports.composeDescription = composeDescription;
6115
6212
  exports.discoverMerchantMcpUrl = discoverMerchantMcpUrl;
6116
6213
  exports.formatTokenAmount = formatTokenAmount;