@haven_ai/sdk 0.5.0-alpha.1 → 0.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkQSSVOPWA_cjs = require('./chunk-QSSVOPWA.cjs');
4
- var chunkJKUIE45B_cjs = require('./chunk-JKUIE45B.cjs');
3
+ var chunkCK4NLLMO_cjs = require('./chunk-CK4NLLMO.cjs');
4
+ var chunkS42QSWJY_cjs = require('./chunk-S42QSWJY.cjs');
5
5
  var viem = require('viem');
6
6
  var ethers = require('ethers');
7
7
  var async_hooks = require('async_hooks');
@@ -14,7 +14,7 @@ function signHash(privateKey, hash) {
14
14
  const sig = signingKey.sign(hash);
15
15
  return sig.serialized;
16
16
  } catch (err) {
17
- throw new chunkJKUIE45B_cjs.HavenSigningError(
17
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
18
18
  `Failed to sign hash: ${err instanceof Error ? err.message : String(err)}`
19
19
  );
20
20
  }
@@ -30,7 +30,7 @@ async function signTypedDataVerbatim(privateKey, typedData, label) {
30
30
  typedData.message
31
31
  );
32
32
  } catch (err) {
33
- throw new chunkJKUIE45B_cjs.HavenSigningError(
33
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
34
34
  `Failed to sign ${label}: ${err instanceof Error ? err.message : String(err)}`
35
35
  );
36
36
  }
@@ -45,7 +45,7 @@ function addressFromKey(privateKey) {
45
45
  try {
46
46
  return new ethers.ethers.Wallet(privateKey).address;
47
47
  } catch (err) {
48
- throw new chunkJKUIE45B_cjs.HavenSigningError(
48
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
49
49
  `Invalid private key: ${err instanceof Error ? err.message : String(err)}`
50
50
  );
51
51
  }
@@ -61,7 +61,7 @@ function verifySignature(hash, signature, expectedAddress) {
61
61
  var DEFAULT_BASE_URL = "http://localhost:3001";
62
62
  var DEFAULT_REQUEST_TIMEOUT = 3e4;
63
63
  function withoutClientHeader(headers) {
64
- const target = chunkQSSVOPWA_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
64
+ const target = chunkCK4NLLMO_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
65
65
  return Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== target));
66
66
  }
67
67
  var HavenApiTransport = class {
@@ -77,7 +77,7 @@ var HavenApiTransport = class {
77
77
  this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
78
78
  this.requestTimeout = config.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
79
79
  this.defaultHeaders = { ...config.defaultHeaders ?? {} };
80
- this.clientIdentity = config.clientIdentity ?? chunkQSSVOPWA_cjs.SDK_CLIENT_IDENTITY;
80
+ this.clientIdentity = config.clientIdentity ?? chunkCK4NLLMO_cjs.SDK_CLIENT_IDENTITY;
81
81
  }
82
82
  /**
83
83
  * The newest `client_update` the backend sent (#3303): inside a
@@ -90,7 +90,7 @@ var HavenApiTransport = class {
90
90
  }
91
91
  recordClientUpdate(data) {
92
92
  if (data === null || typeof data !== "object" || Array.isArray(data)) return;
93
- const hint = chunkQSSVOPWA_cjs.readClientUpdate(data.client_update);
93
+ const hint = chunkCK4NLLMO_cjs.readClientUpdate(data.client_update);
94
94
  if (!hint) return;
95
95
  this.lastClientUpdate = hint;
96
96
  const store = this.requestContext.getStore();
@@ -123,7 +123,7 @@ var HavenApiTransport = class {
123
123
  // JOIN `x-haven-client` and `X-Haven-Client` into one unparseable
124
124
  // value), so neither `defaultHeaders` nor a dispatch context can
125
125
  // misname the client; `clientIdentity` is the one way to set it.
126
- [chunkQSSVOPWA_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
126
+ [chunkCK4NLLMO_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
127
127
  },
128
128
  body: body ? JSON.stringify(body) : void 0,
129
129
  signal: controller.signal
@@ -136,15 +136,15 @@ var HavenApiTransport = class {
136
136
  const rawDetails = record.details ?? record.detail;
137
137
  const detailsText = typeof rawDetails === "string" ? rawDetails : rawDetails != null ? JSON.stringify(rawDetails) : void 0;
138
138
  const message = errorText && detailsText ? `${errorText}: ${detailsText}` : errorText ?? detailsText ?? "API request failed";
139
- throw new chunkJKUIE45B_cjs.HavenApiError(message, res.status, data);
139
+ throw new chunkS42QSWJY_cjs.HavenApiError(message, res.status, data);
140
140
  }
141
141
  return data;
142
142
  } catch (err) {
143
- if (err instanceof chunkJKUIE45B_cjs.HavenApiError) throw err;
143
+ if (err instanceof chunkS42QSWJY_cjs.HavenApiError) throw err;
144
144
  if (err instanceof Error && err.name === "AbortError") {
145
- throw new chunkJKUIE45B_cjs.HavenApiError(`Request to ${path} timed out`, 408);
145
+ throw new chunkS42QSWJY_cjs.HavenApiError(`Request to ${path} timed out`, 408);
146
146
  }
147
- throw new chunkJKUIE45B_cjs.HavenApiError(
147
+ throw new chunkS42QSWJY_cjs.HavenApiError(
148
148
  `Request to ${path} failed: ${err instanceof Error ? err.message : String(err)}`,
149
149
  0
150
150
  );
@@ -232,17 +232,13 @@ function mapPaymentReceipt(raw) {
232
232
  id: raw.id,
233
233
  paymentId: raw.payment_id,
234
234
  source: raw.rail,
235
- rail: raw.rail,
236
235
  paymentProofStatus: raw.proof_status,
237
- proofStatus: raw.proof_status,
238
236
  txHash: raw.tx_hash,
239
237
  fundingTxHash: raw.funding_tx_hash ?? null,
240
238
  settlementTxHash: raw.settlement_tx_hash ?? null,
241
239
  chainId: raw.chain_id,
242
240
  x402ResourceUrl: raw.resource_url,
243
- resourceUrl: raw.resource_url,
244
241
  x402MerchantAddress: raw.merchant_address,
245
- merchantAddress: raw.merchant_address,
246
242
  payerAddress: raw.payer_address,
247
243
  parties: mapParties(raw.parties),
248
244
  settlementAddress: raw.settlement_address,
@@ -291,29 +287,29 @@ function paymentStateStatusCode(status, fallback = 502) {
291
287
  return PAYMENT_STATE_STATUS_CODES[status] ?? fallback;
292
288
  }
293
289
  function phaseForStatus(status) {
294
- if (status === "pending_signature") return chunkJKUIE45B_cjs.AgentPaymentPhase.AgentSignatureRequired;
295
- if (status === "submitted") return chunkJKUIE45B_cjs.AgentPaymentPhase.PaymentSubmitted;
296
- if (status === "confirmed") return chunkJKUIE45B_cjs.AgentPaymentPhase.PaymentConfirmed;
297
- if (status === "pending" || status === "pending_approval") return chunkJKUIE45B_cjs.AgentPaymentPhase.UserApprovalRequired;
298
- if (status === "approved") return chunkJKUIE45B_cjs.AgentPaymentPhase.UserExecutionRequired;
299
- if (status === "proposed") return chunkJKUIE45B_cjs.AgentPaymentPhase.WaitingForAdditionalApprovals;
300
- if (status === "executed") return chunkJKUIE45B_cjs.AgentPaymentPhase.FundingSent;
301
- if (status === "rejected") return chunkJKUIE45B_cjs.AgentPaymentPhase.Rejected;
302
- if (status === "expired") return chunkJKUIE45B_cjs.AgentPaymentPhase.Expired;
303
- if (status === "failed") return chunkJKUIE45B_cjs.AgentPaymentPhase.Failed;
290
+ if (status === "pending_signature") return chunkS42QSWJY_cjs.AgentPaymentPhase.AgentSignatureRequired;
291
+ if (status === "submitted") return chunkS42QSWJY_cjs.AgentPaymentPhase.PaymentSubmitted;
292
+ if (status === "confirmed") return chunkS42QSWJY_cjs.AgentPaymentPhase.PaymentConfirmed;
293
+ if (status === "pending" || status === "pending_approval") return chunkS42QSWJY_cjs.AgentPaymentPhase.UserApprovalRequired;
294
+ if (status === "approved") return chunkS42QSWJY_cjs.AgentPaymentPhase.UserExecutionRequired;
295
+ if (status === "proposed") return chunkS42QSWJY_cjs.AgentPaymentPhase.WaitingForAdditionalApprovals;
296
+ if (status === "executed") return chunkS42QSWJY_cjs.AgentPaymentPhase.FundingSent;
297
+ if (status === "rejected") return chunkS42QSWJY_cjs.AgentPaymentPhase.Rejected;
298
+ if (status === "expired") return chunkS42QSWJY_cjs.AgentPaymentPhase.Expired;
299
+ if (status === "failed") return chunkS42QSWJY_cjs.AgentPaymentPhase.Failed;
304
300
  return null;
305
301
  }
306
302
  function nextActionForStatus(status) {
307
- if (status === "pending_signature") return chunkJKUIE45B_cjs.AgentPaymentNextAction.SignAndSubmitPayment;
308
- if (status === "submitted") return chunkJKUIE45B_cjs.AgentPaymentNextAction.CheckStatusLater;
309
- if (status === "confirmed") return chunkJKUIE45B_cjs.AgentPaymentNextAction.None;
310
- if (status === "pending" || status === "pending_approval") return chunkJKUIE45B_cjs.AgentPaymentNextAction.StopAndTellUser;
311
- if (status === "approved") return chunkJKUIE45B_cjs.AgentPaymentNextAction.StopAndTellUser;
312
- if (status === "proposed") return chunkJKUIE45B_cjs.AgentPaymentNextAction.StopAndTellUser;
313
- if (status === "executed") return chunkJKUIE45B_cjs.AgentPaymentNextAction.StopAndTellUser;
314
- if (status === "rejected") return chunkJKUIE45B_cjs.AgentPaymentNextAction.StopAndTellUser;
315
- if (status === "expired") return chunkJKUIE45B_cjs.AgentPaymentNextAction.RequestAgainIfUserStillWantsIt;
316
- if (status === "failed") return chunkJKUIE45B_cjs.AgentPaymentNextAction.StopAndTellUser;
303
+ if (status === "pending_signature") return chunkS42QSWJY_cjs.AgentPaymentNextAction.SignAndSubmitPayment;
304
+ if (status === "submitted") return chunkS42QSWJY_cjs.AgentPaymentNextAction.CheckStatusLater;
305
+ if (status === "confirmed") return chunkS42QSWJY_cjs.AgentPaymentNextAction.None;
306
+ if (status === "pending" || status === "pending_approval") return chunkS42QSWJY_cjs.AgentPaymentNextAction.StopAndTellUser;
307
+ if (status === "approved") return chunkS42QSWJY_cjs.AgentPaymentNextAction.StopAndTellUser;
308
+ if (status === "proposed") return chunkS42QSWJY_cjs.AgentPaymentNextAction.StopAndTellUser;
309
+ if (status === "executed") return chunkS42QSWJY_cjs.AgentPaymentNextAction.StopAndTellUser;
310
+ if (status === "rejected") return chunkS42QSWJY_cjs.AgentPaymentNextAction.StopAndTellUser;
311
+ if (status === "expired") return chunkS42QSWJY_cjs.AgentPaymentNextAction.RequestAgainIfUserStillWantsIt;
312
+ if (status === "failed") return chunkS42QSWJY_cjs.AgentPaymentNextAction.StopAndTellUser;
317
313
  return null;
318
314
  }
319
315
  function messageForState(label, status, paymentId, nextAction) {
@@ -387,17 +383,17 @@ function throwPaymentStateError(label, raw) {
387
383
  const statusCode = paymentStateStatusCode(raw.status);
388
384
  const state = paymentStateFromRaw(label, raw);
389
385
  if (state) {
390
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(state.message, statusCode, state, raw);
386
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(state.message, statusCode, state, raw);
391
387
  }
392
388
  if (raw.status === "pending_approval") {
393
- throw new chunkJKUIE45B_cjs.HavenApiError(
389
+ throw new chunkS42QSWJY_cjs.HavenApiError(
394
390
  `${label} exceeds the agent's on-chain budget and was declined; no approval is pending and none will arrive (payment_id: ${raw.payment_id}).`,
395
391
  statusCode,
396
392
  raw
397
393
  );
398
394
  }
399
395
  if (raw.status === "expired") {
400
- throw new chunkJKUIE45B_cjs.HavenApiError(
396
+ throw new chunkS42QSWJY_cjs.HavenApiError(
401
397
  `${label} expired before it could be completed (payment_id: ${raw.payment_id}).`,
402
398
  statusCode,
403
399
  raw
@@ -405,7 +401,7 @@ function throwPaymentStateError(label, raw) {
405
401
  }
406
402
  const paymentId = raw.payment_id ? ` (payment_id: ${raw.payment_id})` : "";
407
403
  const message = raw.error ?? `${label} ${raw.status}${paymentId}`;
408
- throw new chunkJKUIE45B_cjs.HavenApiError(message, statusCode, raw);
404
+ throw new chunkS42QSWJY_cjs.HavenApiError(message, statusCode, raw);
409
405
  }
410
406
 
411
407
  // src/x402-retry-target.ts
@@ -437,7 +433,7 @@ function isSecureX402RetryTarget(url) {
437
433
  return RESERVED_SUFFIXES.some((suffix) => host.endsWith(suffix));
438
434
  }
439
435
  var INSECURE_RETRY_TARGET_CODE = "INSECURE_RETRY_TARGET";
440
- var HavenInsecureRetryTargetError = class extends chunkJKUIE45B_cjs.HavenError {
436
+ var HavenInsecureRetryTargetError = class extends chunkS42QSWJY_cjs.HavenError {
441
437
  constructor(url) {
442
438
  super(
443
439
  `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.`,
@@ -479,7 +475,7 @@ var McpMerchantTransport = class {
479
475
  return await this.fetchImpl(url, { ...init, signal });
480
476
  } catch (err) {
481
477
  if (timeoutSignal.aborted) {
482
- throw new chunkJKUIE45B_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${url}`);
478
+ throw new chunkS42QSWJY_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${url}`);
483
479
  }
484
480
  throw err;
485
481
  }
@@ -616,8 +612,8 @@ var McpMerchantTransport = class {
616
612
  async deliverPayment(url, init, paymentHeader) {
617
613
  assertSecureX402RetryTarget(url);
618
614
  const headers = new Headers(init?.headers);
619
- const send = chunkQSSVOPWA_cjs.x402PaymentHeaderNamesFor(paymentHeader);
620
- for (const name of chunkQSSVOPWA_cjs.X402_PAYMENT_HEADER_NAMES) {
615
+ const send = chunkCK4NLLMO_cjs.x402PaymentHeaderNamesFor(paymentHeader);
616
+ for (const name of chunkCK4NLLMO_cjs.X402_PAYMENT_HEADER_NAMES) {
621
617
  if (send.includes(name)) headers.set(name, paymentHeader);
622
618
  else headers.delete(name);
623
619
  }
@@ -704,7 +700,7 @@ function mcpToolResultOf(value) {
704
700
  function extractMcpPaymentRequired(toolResult) {
705
701
  if (toolResult.isError !== true) return void 0;
706
702
  if (isRecord(toolResult.structuredContent)) {
707
- const parsed = chunkQSSVOPWA_cjs.normalizePaymentRequired(toolResult.structuredContent);
703
+ const parsed = chunkCK4NLLMO_cjs.normalizePaymentRequired(toolResult.structuredContent);
708
704
  if (parsed) return parsed;
709
705
  }
710
706
  if (Array.isArray(toolResult.content)) {
@@ -716,7 +712,7 @@ function extractMcpPaymentRequired(toolResult) {
716
712
  } catch {
717
713
  continue;
718
714
  }
719
- const parsed = chunkQSSVOPWA_cjs.normalizePaymentRequired(candidate);
715
+ const parsed = chunkCK4NLLMO_cjs.normalizePaymentRequired(candidate);
720
716
  if (parsed) return parsed;
721
717
  }
722
718
  }
@@ -740,7 +736,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
740
736
  if (!request) return init;
741
737
  let envelope;
742
738
  try {
743
- envelope = chunkQSSVOPWA_cjs.decodeBase64Json(paymentHeader);
739
+ envelope = chunkCK4NLLMO_cjs.decodeBase64Json(paymentHeader);
744
740
  } catch {
745
741
  return init;
746
742
  }
@@ -756,7 +752,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
756
752
  };
757
753
  }
758
754
  function encodeMcpSettlementReceipt(settlement) {
759
- return chunkQSSVOPWA_cjs.encodeBase64Json(settlement);
755
+ return chunkCK4NLLMO_cjs.encodeBase64Json(settlement);
760
756
  }
761
757
  function parseJsonRpcToolsCall(body) {
762
758
  if (typeof body !== "string") return void 0;
@@ -880,9 +876,42 @@ function deriveReadiness(status, allowances) {
880
876
  return allowances.some((allowance) => safeBigInt(allowance.remainingAtomic) > 0n) ? "ready" : "needs_approval";
881
877
  }
882
878
  function formatRemainingDisplay(tokenAddress, tokenSymbol, remainingAtomic) {
883
- const token = chunkQSSVOPWA_cjs.resolveTokenFromAddress(tokenAddress);
879
+ const token = chunkCK4NLLMO_cjs.resolveTokenFromAddress(tokenAddress);
884
880
  return token ? `${formatAtomicAmount(safeBigInt(remainingAtomic), token.decimals)} ${tokenSymbol}` : `${remainingAtomic} ${tokenSymbol} (atomic; unknown decimals)`;
885
881
  }
882
+ function mapTaskBudget(raw) {
883
+ return {
884
+ id: raw.id,
885
+ agentId: raw.agent_id,
886
+ chainId: raw.chain_id,
887
+ tokenAddress: raw.token_address,
888
+ recipientAddress: raw.recipient_address,
889
+ parentDelegationHash: raw.parent_delegation_hash,
890
+ delegationHash: raw.delegation_hash,
891
+ label: raw.label,
892
+ maxAtomic: raw.max_atomic,
893
+ status: raw.status,
894
+ expiresAt: raw.expires_at,
895
+ isExpired: raw.is_expired,
896
+ createdAt: raw.created_at,
897
+ openedAt: raw.opened_at,
898
+ closedAt: raw.closed_at,
899
+ closeTxHash: raw.close_tx_hash
900
+ };
901
+ }
902
+ function summarizeTaskBudget(taskBudget) {
903
+ const token = chunkCK4NLLMO_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
904
+ const maxDisplay = token ? `${formatAtomicAmount(safeBigInt(taskBudget.maxAtomic), token.decimals)} ${token.symbol}` : `${taskBudget.maxAtomic} (atomic; unknown decimals)`;
905
+ return {
906
+ id: taskBudget.id,
907
+ label: taskBudget.label,
908
+ tokenAddress: taskBudget.tokenAddress,
909
+ maxAtomic: taskBudget.maxAtomic,
910
+ maxDisplay,
911
+ recipientAddress: taskBudget.recipientAddress,
912
+ expiresAt: taskBudget.expiresAt
913
+ };
914
+ }
886
915
  var AccountReads = class {
887
916
  transport;
888
917
  getPaymentStatus;
@@ -902,7 +931,11 @@ var AccountReads = class {
902
931
  return request;
903
932
  }
904
933
  async getAgentSummary() {
905
- const [agent, allowanceSummary] = await Promise.all([this.getAgent(), this.getAllowances()]);
934
+ const [agent, allowanceSummary, taskBudgets] = await Promise.all([
935
+ this.getAgent(),
936
+ this.getAllowances(),
937
+ this.listOpenTaskBudgetsSummary()
938
+ ]);
906
939
  const allowances = allowanceSummary.allowances.map((allowance) => {
907
940
  return {
908
941
  id: allowance.id,
@@ -916,7 +949,30 @@ var AccountReads = class {
916
949
  };
917
950
  });
918
951
  const readiness = deriveReadiness(agent.status, allowances);
919
- return { ...agent, readiness, spend_authority_readiness: readiness, allowances };
952
+ return { ...agent, readiness, spend_authority_readiness: readiness, allowances, taskBudgets };
953
+ }
954
+ /**
955
+ * #3329: `GET /task-budgets?status=open`, mapped to the condensed summary
956
+ * row `getAgentSummary()` carries. Fails SOFT per the #3093 rule (default
957
+ * every array wire key to `[]` so an absent/malformed key degrades instead
958
+ * of taking the route down): a 404 (a backend that predates #3329's
959
+ * route), ANY other transport error, an undefined/null body, or a missing
960
+ * or non-array `task_budgets` key all return `[]` rather than throwing —
961
+ * `getAgentSummary`'s identity + readiness + allowances fields are what
962
+ * callers depend on, and this read must never be why the whole summary
963
+ * fails.
964
+ */
965
+ async listOpenTaskBudgetsSummary() {
966
+ try {
967
+ const raw = await this.transport.get(
968
+ "/task-budgets?status=open"
969
+ );
970
+ const rows = raw?.task_budgets;
971
+ if (!Array.isArray(rows)) return [];
972
+ return rows.map((row) => summarizeTaskBudget(mapTaskBudget(row)));
973
+ } catch {
974
+ return [];
975
+ }
920
976
  }
921
977
  async getAllowances() {
922
978
  const raw = await this.transport.get("/machine-payments/allowances");
@@ -984,7 +1040,7 @@ var AccountReads = class {
984
1040
  payment: payment2,
985
1041
  allowance: null,
986
1042
  warnings: [{
987
- code: chunkJKUIE45B_cjs.AgentPaymentWarningCode.AllowanceCheckUnavailable,
1043
+ code: chunkS42QSWJY_cjs.AgentPaymentWarningCode.AllowanceCheckUnavailable,
988
1044
  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.`
989
1045
  }]
990
1046
  });
@@ -1010,7 +1066,7 @@ var AccountReads = class {
1010
1066
  (allowance) => allowance.tokenAddress.toLowerCase() === tokenAddress.toLowerCase()
1011
1067
  );
1012
1068
  if (!match) return unavailable("no allowance/budget row matches the settled token", payment);
1013
- const token = chunkQSSVOPWA_cjs.resolveTokenFromAddress(match.tokenAddress);
1069
+ const token = chunkCK4NLLMO_cjs.resolveTokenFromAddress(match.tokenAddress);
1014
1070
  const remainingDisplay = token ? `${formatAtomicAmount(safeBigInt(match.onchain.remaining), token.decimals)} ${match.tokenSymbol}` : void 0;
1015
1071
  const rail = agentResult.value.executionRail;
1016
1072
  return {
@@ -1085,7 +1141,7 @@ function isWaitTimeout(err) {
1085
1141
  async function waitForSweepTx(tx) {
1086
1142
  let receipt;
1087
1143
  try {
1088
- receipt = await tx.wait(1, chunkJKUIE45B_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS);
1144
+ receipt = await tx.wait(1, chunkS42QSWJY_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS);
1089
1145
  } catch (err) {
1090
1146
  if (!isWaitTimeout(err)) throw err;
1091
1147
  return { txHash: tx.hash, confirmation: "unconfirmed" };
@@ -1099,16 +1155,16 @@ var DelegateSweepApi = class {
1099
1155
  }
1100
1156
  options;
1101
1157
  async sweepDelegate() {
1102
- if (!this.options.delegateKey) throw new chunkJKUIE45B_cjs.HavenSigningError("delegateKey is required for sweepDelegate.");
1158
+ if (!this.options.delegateKey) throw new chunkS42QSWJY_cjs.HavenSigningError("delegateKey is required for sweepDelegate.");
1103
1159
  const agent = await this.options.getAgent();
1104
- if (!agent.delegateAddress) throw new chunkJKUIE45B_cjs.HavenApiError("Agent has no delegate address.", 422);
1160
+ if (!agent.delegateAddress) throw new chunkS42QSWJY_cjs.HavenApiError("Agent has no delegate address.", 422);
1105
1161
  const rpcUrl = this.options.chainRpcs[agent.chainId];
1106
- if (!rpcUrl) throw new chunkJKUIE45B_cjs.HavenApiError(`chainRpcs[${agent.chainId}] must be configured to sweep the delegate wallet.`, 422);
1162
+ if (!rpcUrl) throw new chunkS42QSWJY_cjs.HavenApiError(`chainRpcs[${agent.chainId}] must be configured to sweep the delegate wallet.`, 422);
1107
1163
  const provider = createJsonRpcProvider(rpcUrl);
1108
1164
  const wallet = createWallet(this.options.delegateKey, provider);
1109
1165
  const transfers = [];
1110
- if (chunkQSSVOPWA_cjs.isSweepableChain(agent.chainId)) {
1111
- const contract = createErc20Contract(chunkQSSVOPWA_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
1166
+ if (chunkCK4NLLMO_cjs.isSweepableChain(agent.chainId)) {
1167
+ const contract = createErc20Contract(chunkCK4NLLMO_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
1112
1168
  const balance2 = await contract.balanceOf(agent.delegateAddress);
1113
1169
  if (balance2 > 0n) {
1114
1170
  const tx = await contract.transfer(agent.accountAddress, balance2);
@@ -1196,7 +1252,7 @@ function snapshotRequestBody(body) {
1196
1252
  if (body == null) return void 0;
1197
1253
  if (typeof body === "string") return body;
1198
1254
  if (body instanceof URLSearchParams) return body.toString();
1199
- throw new chunkJKUIE45B_cjs.HavenApiError(
1255
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1200
1256
  "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.",
1201
1257
  400
1202
1258
  );
@@ -1217,25 +1273,25 @@ function requestInitFromSnapshot(request) {
1217
1273
  };
1218
1274
  }
1219
1275
  function noCompatiblePaymentOptionError(accepts) {
1220
- const erc7710Only = chunkQSSVOPWA_cjs.selectErc7710PaymentOption(accepts) !== null;
1276
+ const erc7710Only = chunkCK4NLLMO_cjs.selectErc7710PaymentOption(accepts) !== null;
1221
1277
  const unsupportedOnly = !erc7710Only && accepts.some(
1222
- (opt) => opt !== null && typeof opt === "object" && !chunkQSSVOPWA_cjs.isErc7710Option(opt) && (chunkQSSVOPWA_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
1278
+ (opt) => opt !== null && typeof opt === "object" && !chunkCK4NLLMO_cjs.isErc7710Option(opt) && (chunkCK4NLLMO_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
1223
1279
  );
1224
- return new chunkJKUIE45B_cjs.HavenApiError(
1280
+ return new chunkS42QSWJY_cjs.HavenApiError(
1225
1281
  "No compatible payment option found in x402 requirements. Haven supports standard x402 exact payments on Base USDC." + (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." : ""),
1226
1282
  400
1227
1283
  );
1228
1284
  }
1229
1285
  function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport) {
1230
- const standard = chunkQSSVOPWA_cjs.selectStandardPaymentOption(paymentRequired.accepts);
1231
- const option = standard ?? chunkQSSVOPWA_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
1286
+ const standard = chunkCK4NLLMO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
1287
+ const option = standard ?? chunkCK4NLLMO_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
1232
1288
  if (!option) {
1233
1289
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
1234
1290
  }
1235
- const token = chunkQSSVOPWA_cjs.resolveTokenFromAddress(option.asset, option.network);
1291
+ const token = chunkCK4NLLMO_cjs.resolveTokenFromAddress(option.asset, option.network);
1236
1292
  return {
1237
1293
  rail: "x402",
1238
- idempotencyKey: idempotencyKey ?? chunkQSSVOPWA_cjs.buildX402IdempotencyKey(paymentRequired, option),
1294
+ idempotencyKey: idempotencyKey ?? chunkCK4NLLMO_cjs.buildX402IdempotencyKey(paymentRequired, option),
1239
1295
  paymentRequired,
1240
1296
  accepted: option,
1241
1297
  acceptedScheme: standard ? "standard" : "erc7710",
@@ -1249,8 +1305,8 @@ function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport)
1249
1305
  resourceUrlDiffersFromRequest: paymentRequired.resource.url !== request.url,
1250
1306
  description: paymentRequired.resource.description ?? option.description ?? null,
1251
1307
  mimeType: paymentRequired.resource.mimeType ?? option.mimeType ?? null,
1252
- amountAtomic: chunkQSSVOPWA_cjs.x402AuthorizationAmount(option),
1253
- amount: decimalFromUsdcAtomic(chunkQSSVOPWA_cjs.x402AuthorizationAmount(option)),
1308
+ amountAtomic: chunkCK4NLLMO_cjs.x402AuthorizationAmount(option),
1309
+ amount: decimalFromUsdcAtomic(chunkCK4NLLMO_cjs.x402AuthorizationAmount(option)),
1254
1310
  token: token?.symbol ?? "USDC",
1255
1311
  // #1351: null when the asset is unrecognised on this network — the
1256
1312
  // `token` fallback above is a LABEL, not evidence of 6 decimals, and a
@@ -1289,7 +1345,7 @@ function buildX402Receipt(input) {
1289
1345
  payTo: input.merchantTo ?? input.accepted.payTo
1290
1346
  },
1291
1347
  x402: {
1292
- amount: chunkQSSVOPWA_cjs.x402AuthorizationAmount(input.accepted),
1348
+ amount: chunkCK4NLLMO_cjs.x402AuthorizationAmount(input.accepted),
1293
1349
  token: input.token,
1294
1350
  network: input.accepted.network,
1295
1351
  asset: input.accepted.asset,
@@ -1298,7 +1354,7 @@ function buildX402Receipt(input) {
1298
1354
  };
1299
1355
  }
1300
1356
  function buildX402ResumeState(input) {
1301
- const token = chunkQSSVOPWA_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
1357
+ const token = chunkCK4NLLMO_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
1302
1358
  return {
1303
1359
  rail: "x402",
1304
1360
  paymentId: input.paymentId,
@@ -1309,8 +1365,8 @@ function buildX402ResumeState(input) {
1309
1365
  request: input.request,
1310
1366
  resourceUrl: input.paymentRequired.resource.url,
1311
1367
  description: input.paymentRequired.resource.description ?? input.accepted.description ?? null,
1312
- amountAtomic: chunkQSSVOPWA_cjs.x402AuthorizationAmount(input.accepted),
1313
- amount: decimalFromUsdcAtomic(chunkQSSVOPWA_cjs.x402AuthorizationAmount(input.accepted)),
1368
+ amountAtomic: chunkCK4NLLMO_cjs.x402AuthorizationAmount(input.accepted),
1369
+ amount: decimalFromUsdcAtomic(chunkCK4NLLMO_cjs.x402AuthorizationAmount(input.accepted)),
1314
1370
  token: token?.symbol ?? "USDC",
1315
1371
  asset: input.accepted.asset,
1316
1372
  network: input.accepted.network,
@@ -1319,7 +1375,7 @@ function buildX402ResumeState(input) {
1319
1375
  };
1320
1376
  }
1321
1377
  function attachX402ResumeState(err, paymentRequired, accepted, idempotencyKey, request) {
1322
- if (!(err instanceof chunkJKUIE45B_cjs.HavenPaymentStateError)) return;
1378
+ if (!(err instanceof chunkS42QSWJY_cjs.HavenPaymentStateError)) return;
1323
1379
  if (err.state.rail !== "x402") return;
1324
1380
  err.resumeState = buildX402ResumeState({
1325
1381
  paymentId: err.state.paymentId,
@@ -1340,17 +1396,17 @@ function attachResumeState(err, input) {
1340
1396
  }
1341
1397
  function assertCanResumeX402(status, paymentRequired, option) {
1342
1398
  if (status.rail !== "x402") {
1343
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(
1399
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(
1344
1400
  `Payment ${status.paymentId} is ${status.rail}, not x402.`,
1345
1401
  409,
1346
1402
  status
1347
1403
  );
1348
1404
  }
1349
- if (status.nextAction !== chunkJKUIE45B_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
1350
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
1405
+ if (status.nextAction !== chunkS42QSWJY_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
1406
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
1351
1407
  }
1352
1408
  if (!status.txHash) {
1353
- throw new chunkJKUIE45B_cjs.HavenApiError(
1409
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1354
1410
  `x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
1355
1411
  502,
1356
1412
  status,
@@ -1358,7 +1414,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1358
1414
  );
1359
1415
  }
1360
1416
  if (status.resourceUrl && status.resourceUrl !== paymentRequired.resource.url) {
1361
- throw new chunkJKUIE45B_cjs.HavenApiError(
1417
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1362
1418
  "x402 resume request does not match the approved resource URL.",
1363
1419
  409,
1364
1420
  { status, paymentRequired },
@@ -1366,7 +1422,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1366
1422
  );
1367
1423
  }
1368
1424
  if (status.merchantAddress && !sameAddress(status.merchantAddress, option.payTo)) {
1369
- throw new chunkJKUIE45B_cjs.HavenApiError(
1425
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1370
1426
  "x402 resume request does not match the approved merchant.",
1371
1427
  409,
1372
1428
  { status, selectedPayment: option },
@@ -1375,7 +1431,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1375
1431
  }
1376
1432
  const optionChainId = chainIdFromNetwork(option.network);
1377
1433
  if (status.chainId && optionChainId && status.chainId !== optionChainId) {
1378
- throw new chunkJKUIE45B_cjs.HavenApiError(
1434
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1379
1435
  "x402 resume request does not match the approved network.",
1380
1436
  409,
1381
1437
  { status, selectedPayment: option },
@@ -1383,7 +1439,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1383
1439
  );
1384
1440
  }
1385
1441
  if (status.token && status.token !== "USDC") {
1386
- throw new chunkJKUIE45B_cjs.HavenApiError(
1442
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1387
1443
  "x402 resume request does not match the approved token.",
1388
1444
  409,
1389
1445
  { status, selectedPayment: option },
@@ -1391,9 +1447,9 @@ function assertCanResumeX402(status, paymentRequired, option) {
1391
1447
  );
1392
1448
  }
1393
1449
  const approvedAmount = status.amount ? normalizeDecimal(status.amount) : "";
1394
- const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunkQSSVOPWA_cjs.x402AuthorizationAmount(option)));
1450
+ const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunkCK4NLLMO_cjs.x402AuthorizationAmount(option)));
1395
1451
  if (approvedAmount && approvedAmount !== requestedAmount) {
1396
- throw new chunkJKUIE45B_cjs.HavenApiError(
1452
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1397
1453
  "x402 resume request does not match the approved amount.",
1398
1454
  409,
1399
1455
  { status, selectedPayment: option },
@@ -1446,12 +1502,12 @@ var X402FundingLeg = class {
1446
1502
  }
1447
1503
  }
1448
1504
  // ── Authorization ────────────────────────────────────────────────
1449
- async authorize(paymentRequired, option, idempotencyKey) {
1505
+ async authorize(paymentRequired, option, idempotencyKey, taskBudgetId) {
1450
1506
  const raw = await this.post("/x402", {
1451
1507
  url: paymentRequired.resource.url,
1452
1508
  payTo: this.delegateAddress,
1453
1509
  merchantPayTo: option.payTo,
1454
- amount: chunkQSSVOPWA_cjs.x402AuthorizationAmount(option),
1510
+ amount: chunkCK4NLLMO_cjs.x402AuthorizationAmount(option),
1455
1511
  asset: option.asset,
1456
1512
  network: option.network,
1457
1513
  description: paymentRequired.resource.description,
@@ -1459,20 +1515,23 @@ var X402FundingLeg = class {
1459
1515
  // #1360: same explicit funding-leg declaration as createX402Intent —
1460
1516
  // this local-key path derives payTo from the key (never stale), but the
1461
1517
  // declaration keeps both writers of the 3009 shape loud-by-default.
1462
- settlementScheme: "eip3009"
1518
+ settlementScheme: "eip3009",
1519
+ // #3329: `/x402` bodies are camelCase (`X402AuthorizeRequest`) — do not
1520
+ // switch this to `task_budget_id`, which is only the `POST /payments` key.
1521
+ ...taskBudgetId ? { taskBudgetId } : {}
1463
1522
  });
1464
1523
  const state = paymentStateFromRaw("x402 payment", raw);
1465
- const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === chunkJKUIE45B_cjs.AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
1524
+ const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === chunkS42QSWJY_cjs.AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
1466
1525
  if (executedReplay) {
1467
1526
  const canFund = await this.delegateCanFund(
1468
1527
  raw.chain_id ?? state?.chainId ?? chainIdFromNetwork(option.network),
1469
1528
  option.asset,
1470
- chunkQSSVOPWA_cjs.x402AuthorizationAmount(option)
1529
+ chunkCK4NLLMO_cjs.x402AuthorizationAmount(option)
1471
1530
  );
1472
1531
  const refuse = executedReplay === "idempotency-collision" ? canFund !== true : canFund === false;
1473
1532
  if (refuse) {
1474
1533
  const settledReceipt = state && executedReplay === "approval-resume" ? this.receiptFromStatus(paymentRequired, option, void 0, state) : this.receiptFromAuthorization(paymentRequired, option, void 0, raw);
1475
- throw new chunkJKUIE45B_cjs.X402AlreadySettledError(
1534
+ throw new chunkS42QSWJY_cjs.X402AlreadySettledError(
1476
1535
  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`.",
1477
1536
  settledReceipt,
1478
1537
  canFund === false ? "settled" : "unverifiable"
@@ -1485,16 +1544,19 @@ var X402FundingLeg = class {
1485
1544
  this.cacheReceipt(idempotencyKey, paymentHeader, receipt2);
1486
1545
  return receipt2;
1487
1546
  }
1488
- if (state?.nextAction === chunkJKUIE45B_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
1547
+ if (state?.nextAction === chunkS42QSWJY_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
1489
1548
  const receipt2 = this.receiptFromStatus(paymentRequired, option, paymentHeader, state);
1490
1549
  this.cacheReceipt(idempotencyKey, paymentHeader, receipt2);
1491
1550
  return receipt2;
1492
1551
  }
1493
1552
  this.assertSignableAuthorizationState("x402 payment", raw);
1494
1553
  if (!raw.sign_data?.hash) {
1495
- throw new chunkJKUIE45B_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
1554
+ throw new chunkS42QSWJY_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
1496
1555
  }
1497
- const sig = await this.signForData(raw.sign_data);
1556
+ const sig = await this.signForData(raw.sign_data, {
1557
+ asset: option.asset,
1558
+ amount: chunkCK4NLLMO_cjs.x402AuthorizationAmount(option)
1559
+ });
1498
1560
  const execResult = await this.post(
1499
1561
  `/payments/${raw.payment_id}/sign`,
1500
1562
  { signature: sig }
@@ -1513,25 +1575,25 @@ var X402FundingLeg = class {
1513
1575
  // ── Header minting ───────────────────────────────────────────────
1514
1576
  async createPaymentHeader(paymentRequired, option) {
1515
1577
  if (!this.delegateKey) {
1516
- throw new chunkJKUIE45B_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
1578
+ throw new chunkS42QSWJY_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
1517
1579
  }
1518
1580
  const account = accounts.privateKeyToAccount(this.delegateKey);
1519
- const requirements = chunkQSSVOPWA_cjs.toStandardPaymentRequirements(paymentRequired, option);
1581
+ const requirements = chunkCK4NLLMO_cjs.toStandardPaymentRequirements(paymentRequired, option);
1520
1582
  const header = await schemes.exact.evm.createPaymentHeader(
1521
1583
  account,
1522
1584
  paymentRequired.x402Version,
1523
1585
  requirements
1524
1586
  );
1525
1587
  if (paymentRequired.x402Version < 2) return header;
1526
- const payment = chunkQSSVOPWA_cjs.decodeBase64Json(header);
1527
- return chunkQSSVOPWA_cjs.encodeBase64Json(chunkQSSVOPWA_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
1588
+ const payment = chunkCK4NLLMO_cjs.decodeBase64Json(header);
1589
+ return chunkCK4NLLMO_cjs.encodeBase64Json(chunkCK4NLLMO_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
1528
1590
  }
1529
1591
  // ── Receipt mapping ──────────────────────────────────────────────
1530
1592
  receiptFromAuthorization(paymentRequired, option, paymentHeader, raw, execResult) {
1531
1593
  const txHash = execResult?.tx_hash ?? raw.tx_hash ?? "";
1532
1594
  const chainId = execResult?.chain_id ?? raw.chain_id ?? chainIdFromNetwork(option.network);
1533
1595
  const token = execResult?.token ?? raw.token ?? "USDC";
1534
- const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunkQSSVOPWA_cjs.x402AuthorizationAmount(option));
1596
+ const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunkCK4NLLMO_cjs.x402AuthorizationAmount(option));
1535
1597
  const to = execResult?.to ?? raw.to ?? this.delegateAddress ?? "";
1536
1598
  const explorerUrl = execResult?.explorer_url ?? raw.explorer_url ?? explorerUrlOrEmpty(chainId, txHash);
1537
1599
  const merchantTo = execResult?.merchant_to ?? raw.merchant_to ?? option.payTo;
@@ -1553,7 +1615,7 @@ var X402FundingLeg = class {
1553
1615
  }
1554
1616
  receiptFromStatus(paymentRequired, option, paymentHeader, status) {
1555
1617
  if (!status.txHash) {
1556
- throw new chunkJKUIE45B_cjs.HavenApiError(
1618
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1557
1619
  `x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
1558
1620
  502,
1559
1621
  status,
@@ -1564,7 +1626,7 @@ var X402FundingLeg = class {
1564
1626
  paymentId: status.paymentId,
1565
1627
  txHash: status.txHash,
1566
1628
  token: status.token || "USDC",
1567
- amount: status.amount || decimalFromUsdcAtomic(chunkQSSVOPWA_cjs.x402AuthorizationAmount(option)),
1629
+ amount: status.amount || decimalFromUsdcAtomic(chunkCK4NLLMO_cjs.x402AuthorizationAmount(option)),
1568
1630
  to: this.delegateAddress ?? "",
1569
1631
  resourceUrl: paymentRequired.resource.url,
1570
1632
  explorerUrl: explorerUrlOrEmpty(status.chainId, status.txHash),
@@ -1592,7 +1654,7 @@ var X402FundingLeg = class {
1592
1654
  const provider = createJsonRpcProvider(rpcUrl);
1593
1655
  const onChainReceipt = await provider.waitForTransaction(txHash, 1, timeoutMs);
1594
1656
  if (!onChainReceipt || onChainReceipt.status !== 1) {
1595
- throw new chunkJKUIE45B_cjs.HavenApiError(
1657
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1596
1658
  "Funding tx did not confirm on-chain within the timeout window.",
1597
1659
  500,
1598
1660
  { txHash, chainId }
@@ -1641,7 +1703,7 @@ var X402FundingLeg = class {
1641
1703
  };
1642
1704
  function getPaymentHeaderValidBefore(paymentHeader) {
1643
1705
  try {
1644
- const payment = chunkQSSVOPWA_cjs.decodeBase64Json(
1706
+ const payment = chunkCK4NLLMO_cjs.decodeBase64Json(
1645
1707
  paymentHeader
1646
1708
  );
1647
1709
  const payload = payment.payload;
@@ -1696,7 +1758,7 @@ var X402Erc7710 = class {
1696
1758
  */
1697
1759
  async settle(paymentRequired, options = {}) {
1698
1760
  if (!this.delegateKey) {
1699
- throw new chunkJKUIE45B_cjs.HavenSigningError(
1761
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
1700
1762
  "delegateKey is required for x402 payments. Pass it in the HavenClient config."
1701
1763
  );
1702
1764
  }
@@ -1721,21 +1783,21 @@ var X402Erc7710 = class {
1721
1783
  async prepare(paymentRequired, options = {}) {
1722
1784
  const delegationRail = options.delegationRail ?? (await this.getAgent()).executionRail === "delegation";
1723
1785
  if (!delegationRail) {
1724
- throw new chunkJKUIE45B_cjs.HavenApiError(
1786
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1725
1787
  "erc7710 settlement requires a delegation-rail account; this one is not on it. Use authorizeX402() for the standard EIP-3009 path.",
1726
1788
  400
1727
1789
  );
1728
1790
  }
1729
- const selection = chunkQSSVOPWA_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
1791
+ const selection = chunkCK4NLLMO_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
1730
1792
  if (!selection || selection.scheme !== "erc7710") {
1731
- throw new chunkJKUIE45B_cjs.HavenApiError(
1793
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1732
1794
  "This merchant does not advertise an erc7710 settlement option (no accepts[] entry carries extra.assetTransferMethod: 'erc7710'). Use authorizeX402() for the standard EIP-3009 path.",
1733
1795
  400
1734
1796
  );
1735
1797
  }
1736
1798
  const option = selection.option;
1737
1799
  const merchantPayTo = option.payTo;
1738
- const amountAtomic = chunkQSSVOPWA_cjs.x402AuthorizationAmount(option);
1800
+ const amountAtomic = chunkCK4NLLMO_cjs.x402AuthorizationAmount(option);
1739
1801
  const raw = await this.post("/x402", {
1740
1802
  url: options.resourceUrl ?? paymentRequired.resource?.url,
1741
1803
  // #2373: the full 402 challenge, persisted verbatim by the backend
@@ -1770,14 +1832,17 @@ var X402Erc7710 = class {
1770
1832
  ...selection.facilitatorAddresses ? { facilitatorAddresses: selection.facilitatorAddresses } : {},
1771
1833
  // #1307/#1547: persisted so the settle leg can rehydrate the merchant
1772
1834
  // call by payment_id on this scheme too, not only on the 3009 bridge.
1773
- ...options.mcpCallContext ? { mcpCallContext: options.mcpCallContext } : {}
1835
+ ...options.mcpCallContext ? { mcpCallContext: options.mcpCallContext } : {},
1836
+ // #3329: `/x402` bodies are camelCase (`X402AuthorizeRequest`) — do not
1837
+ // switch this to `task_budget_id`, which is only the `POST /payments` key.
1838
+ ...options.taskBudgetId ? { taskBudgetId: options.taskBudgetId } : {}
1774
1839
  });
1775
1840
  if (!raw.payment_id) {
1776
- throw new chunkJKUIE45B_cjs.HavenApiError("No payment_id returned from x402/authorize", 500, raw);
1841
+ throw new chunkS42QSWJY_cjs.HavenApiError("No payment_id returned from x402/authorize", 500, raw);
1777
1842
  }
1778
1843
  const signData = raw.sign_data;
1779
1844
  if (signData?.signature_scheme !== "eip712_delegation" || !signData.typed_data) {
1780
- throw new chunkJKUIE45B_cjs.HavenApiError(
1845
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1781
1846
  `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.`,
1782
1847
  500,
1783
1848
  raw
@@ -1810,7 +1875,7 @@ var X402Erc7710 = class {
1810
1875
  { signature }
1811
1876
  );
1812
1877
  if (!settled.payment_header) {
1813
- throw new chunkJKUIE45B_cjs.HavenApiError(
1878
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1814
1879
  "x402 settle returned no payment_header \u2014 the merchant cannot be retried.",
1815
1880
  500,
1816
1881
  settled
@@ -1820,9 +1885,9 @@ var X402Erc7710 = class {
1820
1885
  }
1821
1886
  };
1822
1887
  function settlementExpectationFromQuote(settlement) {
1823
- const chainId = chunkJKUIE45B_cjs.chainIdForNetwork(settlement.network);
1888
+ const chainId = chunkS42QSWJY_cjs.chainIdForNetwork(settlement.network);
1824
1889
  if (chainId === void 0) {
1825
- throw new chunkJKUIE45B_cjs.HavenSigningError(
1890
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
1826
1891
  `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.`
1827
1892
  );
1828
1893
  }
@@ -1872,7 +1937,7 @@ function x402ToolReceipt(receipt) {
1872
1937
  };
1873
1938
  }
1874
1939
  function toolError(err) {
1875
- if (err instanceof chunkJKUIE45B_cjs.HavenPaymentStateError) {
1940
+ if (err instanceof chunkS42QSWJY_cjs.HavenPaymentStateError) {
1876
1941
  return {
1877
1942
  success: false,
1878
1943
  payment_id: err.state.paymentId,
@@ -1917,7 +1982,7 @@ function toolError(err) {
1917
1982
  error: err.message
1918
1983
  };
1919
1984
  }
1920
- if (err instanceof chunkJKUIE45B_cjs.HavenApiError) {
1985
+ if (err instanceof chunkS42QSWJY_cjs.HavenApiError) {
1921
1986
  return {
1922
1987
  success: false,
1923
1988
  status_code: err.statusCode,
@@ -1954,10 +2019,10 @@ var MerchantCompletion = class {
1954
2019
  }
1955
2020
  async retryRequest(url, initialInit, paymentRequired, receipt) {
1956
2021
  if (!receipt.accepted) {
1957
- throw new chunkJKUIE45B_cjs.HavenApiError("No accepted x402 option was recorded for payment retry", 500);
2022
+ throw new chunkS42QSWJY_cjs.HavenApiError("No accepted x402 option was recorded for payment retry", 500);
1958
2023
  }
1959
2024
  if (!receipt.paymentHeader) {
1960
- throw new chunkJKUIE45B_cjs.HavenApiError("No x402 payment header was returned for payment retry", 500);
2025
+ throw new chunkS42QSWJY_cjs.HavenApiError("No x402 payment header was returned for payment retry", 500);
1961
2026
  }
1962
2027
  const retryResponse = await this.merchantTransport.deliverPaymentRecoveringSession(
1963
2028
  url,
@@ -1982,7 +2047,7 @@ var MerchantCompletion = class {
1982
2047
  delegate_to: receipt.to
1983
2048
  }
1984
2049
  });
1985
- throw new chunkJKUIE45B_cjs.HavenApiError(
2050
+ throw new chunkS42QSWJY_cjs.HavenApiError(
1986
2051
  "x402 retry failed after Haven funded the delegate wallet; reconciliation may be required.",
1987
2052
  inBandRejection ? X402_RETRY_REJECTED_STATUS : merchant.merchant_status,
1988
2053
  {
@@ -2015,7 +2080,7 @@ var MerchantCompletion = class {
2015
2080
  merchantStatus: retryResponse.status,
2016
2081
  challengePayload: paymentRequired,
2017
2082
  selectedPayment: receipt.accepted,
2018
- paymentProofHeaderName: chunkQSSVOPWA_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
2083
+ paymentProofHeaderName: chunkCK4NLLMO_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
2019
2084
  paymentProofHeader: receipt.paymentHeader,
2020
2085
  protocolReceiptHeaderName,
2021
2086
  protocolReceiptHeader
@@ -2056,18 +2121,18 @@ var MerchantCompletion = class {
2056
2121
  async resolveCompletionContext(input) {
2057
2122
  const status = await this.getPaymentStatus(input.paymentId);
2058
2123
  if (status.rail !== "x402") {
2059
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(
2124
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(
2060
2125
  `Payment ${status.paymentId} is ${status.rail}, not x402.`,
2061
2126
  409,
2062
2127
  status
2063
2128
  );
2064
2129
  }
2065
- const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === chunkJKUIE45B_cjs.AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === chunkJKUIE45B_cjs.AgentPaymentPhase.PaymentConfirmed && status.nextAction === chunkJKUIE45B_cjs.AgentPaymentNextAction.None;
2130
+ const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === chunkS42QSWJY_cjs.AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === chunkS42QSWJY_cjs.AgentPaymentPhase.PaymentConfirmed && status.nextAction === chunkS42QSWJY_cjs.AgentPaymentNextAction.None;
2066
2131
  if (!readyForMerchantCompletion) {
2067
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
2132
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
2068
2133
  }
2069
2134
  if (!input.noFundingLeg && !status.txHash) {
2070
- throw new chunkJKUIE45B_cjs.HavenApiError(
2135
+ throw new chunkS42QSWJY_cjs.HavenApiError(
2071
2136
  `x402 payment ${status.paymentId} is ready for merchant completion but has no Haven transaction hash.`,
2072
2137
  502,
2073
2138
  status,
@@ -2076,7 +2141,7 @@ var MerchantCompletion = class {
2076
2141
  }
2077
2142
  const approvedResourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
2078
2143
  if (approvedResourceUrl && approvedResourceUrl !== input.url) {
2079
- throw new chunkJKUIE45B_cjs.HavenApiError(
2144
+ throw new chunkS42QSWJY_cjs.HavenApiError(
2080
2145
  "x402 merchant completion does not match the approved resource URL.",
2081
2146
  409,
2082
2147
  { status, url: input.url },
@@ -2162,7 +2227,7 @@ var MerchantCompletion = class {
2162
2227
  */
2163
2228
  async reportMerchantOutcome(input) {
2164
2229
  if (!Number.isInteger(input.merchantStatus) || input.merchantStatus < 100 || input.merchantStatus > 599) {
2165
- throw new chunkJKUIE45B_cjs.HavenApiError(
2230
+ throw new chunkS42QSWJY_cjs.HavenApiError(
2166
2231
  `merchant_status must be an integer HTTP status from 100 to 599 (received ${input.merchantStatus}).`,
2167
2232
  400,
2168
2233
  void 0,
@@ -2171,7 +2236,7 @@ var MerchantCompletion = class {
2171
2236
  }
2172
2237
  const looksAccepted = input.merchantStatus >= 200 && input.merchantStatus < 300;
2173
2238
  if (looksAccepted !== (input.outcome === "accepted")) {
2174
- throw new chunkJKUIE45B_cjs.HavenApiError(
2239
+ throw new chunkS42QSWJY_cjs.HavenApiError(
2175
2240
  `outcome "${input.outcome}" contradicts merchant_status ${input.merchantStatus}: report "accepted" only for a 2xx and "rejected" only for a non-2xx.`,
2176
2241
  400,
2177
2242
  void 0,
@@ -2180,14 +2245,14 @@ var MerchantCompletion = class {
2180
2245
  }
2181
2246
  const status = await this.getPaymentStatus(input.paymentId);
2182
2247
  if (status.rail !== "x402") {
2183
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(
2248
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(
2184
2249
  `Payment ${status.paymentId} is ${status.rail}, not x402 \u2014 there is no merchant retry to report.`,
2185
2250
  409,
2186
2251
  status
2187
2252
  );
2188
2253
  }
2189
2254
  if (status.status !== "confirmed" || !status.txHash) {
2190
- throw new chunkJKUIE45B_cjs.HavenPaymentStateError(
2255
+ throw new chunkS42QSWJY_cjs.HavenPaymentStateError(
2191
2256
  `Payment ${status.paymentId} has no confirmed Haven funding transaction to anchor a merchant report to (status ${status.status}). ${status.message}`,
2192
2257
  paymentStateStatusCode(status.status, 409),
2193
2258
  status
@@ -2195,7 +2260,7 @@ var MerchantCompletion = class {
2195
2260
  }
2196
2261
  const resourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
2197
2262
  if (!resourceUrl) {
2198
- throw new chunkJKUIE45B_cjs.HavenApiError(
2263
+ throw new chunkS42QSWJY_cjs.HavenApiError(
2199
2264
  `Payment ${status.paymentId} has no recorded resource URL, so a merchant report cannot be stored.`,
2200
2265
  409,
2201
2266
  status,
@@ -2248,7 +2313,7 @@ var MerchantCompletion = class {
2248
2313
  await this.post("/machine-payments/evidence", body);
2249
2314
  return { outcome: "confirmed" };
2250
2315
  } catch (err) {
2251
- const statusCode = err instanceof chunkJKUIE45B_cjs.HavenApiError ? err.statusCode : void 0;
2316
+ const statusCode = err instanceof chunkS42QSWJY_cjs.HavenApiError ? err.statusCode : void 0;
2252
2317
  const retryable = statusCode === EVIDENCE_RETRYABLE_STATUS;
2253
2318
  if (!retryable) {
2254
2319
  return { outcome: "refused", statusCode: statusCode ?? 0 };
@@ -2285,7 +2350,7 @@ var MerchantCompletion = class {
2285
2350
  */
2286
2351
  async reportSettlementEvidence(paymentId, settlementTxHash) {
2287
2352
  if (isZeroSettlementTxHash(settlementTxHash)) {
2288
- throw new chunkJKUIE45B_cjs.HavenZeroSettlementHashError(paymentId);
2353
+ throw new chunkS42QSWJY_cjs.HavenZeroSettlementHashError(paymentId);
2289
2354
  }
2290
2355
  return this.reportEvidence({
2291
2356
  paymentId,
@@ -2305,7 +2370,7 @@ function parseMerchantSettlement(header) {
2305
2370
  }
2306
2371
  function parseProtocolReceiptHeader(value) {
2307
2372
  try {
2308
- return chunkQSSVOPWA_cjs.decodeBase64Json(value);
2373
+ return chunkCK4NLLMO_cjs.decodeBase64Json(value);
2309
2374
  } catch {
2310
2375
  try {
2311
2376
  return JSON.parse(value);
@@ -2322,7 +2387,7 @@ function x402TypedDataDigest(typedData) {
2322
2387
  try {
2323
2388
  return viem.hashTypedData(typedData);
2324
2389
  } catch (err) {
2325
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2390
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2326
2391
  `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)}`
2327
2392
  );
2328
2393
  }
@@ -2404,7 +2469,7 @@ var HavenClient = class {
2404
2469
  });
2405
2470
  this.x402Wallet = config.x402Wallet;
2406
2471
  this.merchantTransport = new McpMerchantTransport({ merchantTimeout: config.merchantTimeout });
2407
- this.confirmationTimeout = config.confirmationTimeout ?? chunkJKUIE45B_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS;
2472
+ this.confirmationTimeout = config.confirmationTimeout ?? chunkS42QSWJY_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS;
2408
2473
  this.pollingInterval = config.pollingInterval ?? DEFAULT_POLLING_INTERVAL;
2409
2474
  this.chainRpcs = config.chainRpcs ?? {};
2410
2475
  if (this.delegateKey) {
@@ -2416,7 +2481,7 @@ var HavenClient = class {
2416
2481
  x402Wallet: this.x402Wallet,
2417
2482
  chainRpcs: this.chainRpcs,
2418
2483
  post: (path, body) => this.post(path, body),
2419
- signForData: (signData) => this.signForData(signData),
2484
+ signForData: (signData, fundingExpectation) => this.signForData(signData, void 0, fundingExpectation),
2420
2485
  assertSignableAuthorizationState: (label, raw) => this.throwIfNonSignableAuthorizationState(label, raw)
2421
2486
  });
2422
2487
  this.merchantCompletion = new MerchantCompletion({
@@ -2473,7 +2538,7 @@ var HavenClient = class {
2473
2538
  */
2474
2539
  async pay(request) {
2475
2540
  if (!this.delegateKey) {
2476
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2541
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2477
2542
  "Cannot use pay() without a delegateKey. Use createIntent() + submitSignature() for manual signing."
2478
2543
  );
2479
2544
  }
@@ -2493,7 +2558,8 @@ var HavenClient = class {
2493
2558
  token: request.token,
2494
2559
  amount: request.amount,
2495
2560
  to: request.to,
2496
- ...request.idempotencyKey ? { idempotency_key: request.idempotencyKey } : {}
2561
+ ...request.idempotencyKey ? { idempotency_key: request.idempotencyKey } : {},
2562
+ ...request.taskBudgetId ? { task_budget_id: request.taskBudgetId } : {}
2497
2563
  });
2498
2564
  if (raw.status === "pending_approval") {
2499
2565
  throwPaymentStateError("Payment", raw);
@@ -2522,15 +2588,15 @@ var HavenClient = class {
2522
2588
  * on-chain allowance — there is nothing to sign until the user approves.
2523
2589
  */
2524
2590
  async createX402Intent(paymentRequired, options = {}) {
2525
- const option = chunkQSSVOPWA_cjs.selectStandardPaymentOption(paymentRequired.accepts);
2591
+ const option = chunkCK4NLLMO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
2526
2592
  if (!option) {
2527
2593
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
2528
2594
  }
2529
2595
  const fundingTo = options.delegateAddress ?? (await this.getAgent()).delegateAddress;
2530
2596
  if (!fundingTo) {
2531
- throw new chunkJKUIE45B_cjs.HavenApiError("Authenticated agent has no delegate address registered.", 502);
2597
+ throw new chunkS42QSWJY_cjs.HavenApiError("Authenticated agent has no delegate address registered.", 502);
2532
2598
  }
2533
- const idempotencyKey = options.idempotencyKey ?? chunkQSSVOPWA_cjs.buildX402IdempotencyKey(paymentRequired, option);
2599
+ const idempotencyKey = options.idempotencyKey ?? chunkCK4NLLMO_cjs.buildX402IdempotencyKey(paymentRequired, option);
2534
2600
  const raw = await this.post("/x402", {
2535
2601
  url: paymentRequired.resource.url,
2536
2602
  payTo: fundingTo,
@@ -2541,7 +2607,7 @@ var HavenClient = class {
2541
2607
  // of a silent reroute to the erc7710 settlement branch (the #1358
2542
2608
  // review's open-budget misroute). Legacy-rail backends ignore the field.
2543
2609
  settlementScheme: "eip3009",
2544
- amount: chunkQSSVOPWA_cjs.x402AuthorizationAmount(option),
2610
+ amount: chunkCK4NLLMO_cjs.x402AuthorizationAmount(option),
2545
2611
  asset: option.asset,
2546
2612
  network: option.network,
2547
2613
  description: paymentRequired.resource.description,
@@ -2553,21 +2619,25 @@ var HavenClient = class {
2553
2619
  // the agent passes only payment_id. Bounded: the backend rejects >64KB,
2554
2620
  // so an oversized blob is omitted here (signer falls back to the
2555
2621
  // caller-supplied copy) rather than failing the intent.
2556
- ...new TextEncoder().encode(JSON.stringify(paymentRequired)).length <= 65536 ? { paymentRequired } : {}
2622
+ ...new TextEncoder().encode(JSON.stringify(paymentRequired)).length <= 65536 ? { paymentRequired } : {},
2623
+ // #3329: `/x402` bodies are camelCase (`X402AuthorizeRequest`), unlike
2624
+ // `POST /payments`'s snake_case `task_budget_id` above — the two
2625
+ // surfaces use different conventions, so this key is NOT `task_budget_id`.
2626
+ ...options.taskBudgetId ? { taskBudgetId: options.taskBudgetId } : {}
2557
2627
  });
2558
2628
  if (raw.status !== "pending_signature") {
2559
2629
  throwPaymentStateError("x402 payment", raw);
2560
2630
  }
2561
2631
  if (!raw.sign_data?.hash) {
2562
- throw new chunkJKUIE45B_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
2632
+ throw new chunkS42QSWJY_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
2563
2633
  }
2564
2634
  if (raw.sign_data.signature_scheme !== void 0 && !raw.sign_data.typed_data) {
2565
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2635
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2566
2636
  `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.`
2567
2637
  );
2568
2638
  }
2569
2639
  if (!raw.x402_expected_auth) {
2570
- throw new chunkJKUIE45B_cjs.HavenApiError("No x402 expected-context binding returned from x402/authorize", 500, raw);
2640
+ throw new chunkS42QSWJY_cjs.HavenApiError("No x402 expected-context binding returned from x402/authorize", 500, raw);
2571
2641
  }
2572
2642
  return {
2573
2643
  paymentId: raw.payment_id,
@@ -2578,7 +2648,7 @@ var HavenClient = class {
2578
2648
  accepted: option,
2579
2649
  resourceUrl: paymentRequired.resource.url,
2580
2650
  merchantTo: raw.merchant_to ?? option.payTo,
2581
- amountAtomic: chunkQSSVOPWA_cjs.x402AuthorizationAmount(option),
2651
+ amountAtomic: chunkCK4NLLMO_cjs.x402AuthorizationAmount(option),
2582
2652
  asset: option.asset,
2583
2653
  network: option.network,
2584
2654
  expectedAuth: raw.x402_expected_auth,
@@ -2603,13 +2673,13 @@ var HavenClient = class {
2603
2673
  */
2604
2674
  sign(hash) {
2605
2675
  if (!this.delegateKey) {
2606
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2676
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2607
2677
  "Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
2608
2678
  );
2609
2679
  }
2610
2680
  const signature = signHash(this.delegateKey, hash);
2611
2681
  if (!verifySignature(hash, signature, this.delegateAddress)) {
2612
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2682
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2613
2683
  "Local signature verification failed \u2014 recovered address does not match delegate key."
2614
2684
  );
2615
2685
  }
@@ -2625,51 +2695,58 @@ var HavenClient = class {
2625
2695
  * (#834) — the backend refuses those intents with HTTP 410 before any
2626
2696
  * sign_data reaches a client, so encountering it here is a hard error too.
2627
2697
  */
2628
- async signForData(signData, settlementExpectation) {
2698
+ async signForData(signData, settlementExpectation, fundingExpectation) {
2629
2699
  if (!this.delegateKey) {
2630
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2700
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2631
2701
  "Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
2632
2702
  );
2633
2703
  }
2634
2704
  const scheme = signData.signature_scheme;
2635
2705
  if (scheme === "eip191_userop") {
2636
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2706
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2637
2707
  "The session rail is retired \u2014 'eip191_userop' intents can no longer be signed. Re-onboard the account on the delegation rail."
2638
2708
  );
2639
2709
  }
2640
2710
  if (scheme === "eip712_userop") {
2641
2711
  if (!signData.typed_data) {
2642
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2712
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2643
2713
  "sign_data.signature_scheme is eip712_userop but typed_data is missing \u2014 refusing to sign the bare hash (the account would reject it)."
2644
2714
  );
2645
2715
  }
2646
- chunkJKUIE45B_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
2647
- chunkQSSVOPWA_cjs.assertBoundDirectPaymentUserOp(
2716
+ chunkS42QSWJY_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
2717
+ chunkCK4NLLMO_cjs.assertBoundDirectPaymentUserOp(
2648
2718
  signData.typed_data,
2649
2719
  this.delegateAddress
2650
2720
  );
2721
+ if (fundingExpectation) {
2722
+ chunkCK4NLLMO_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
2723
+ delegateAddress: this.delegateAddress,
2724
+ asset: fundingExpectation.asset,
2725
+ amount: fundingExpectation.amount
2726
+ });
2727
+ }
2651
2728
  return signUserOpTypedDataForDelegation(this.delegateKey, signData.typed_data);
2652
2729
  }
2653
2730
  if (scheme === "eip712_delegation") {
2654
2731
  if (!signData.typed_data) {
2655
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2732
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2656
2733
  "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)."
2657
2734
  );
2658
2735
  }
2659
2736
  if (!settlementExpectation) {
2660
- throw new chunkQSSVOPWA_cjs.HavenTypedDataRefusedError(
2737
+ throw new chunkCK4NLLMO_cjs.HavenTypedDataRefusedError(
2661
2738
  "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."
2662
2739
  );
2663
2740
  }
2664
- chunkQSSVOPWA_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
2741
+ chunkCK4NLLMO_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
2665
2742
  return signSettlementDelegationTypedData(this.delegateKey, signData.typed_data);
2666
2743
  }
2667
2744
  if (scheme === void 0) {
2668
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2745
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2669
2746
  "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."
2670
2747
  );
2671
2748
  }
2672
- throw new chunkJKUIE45B_cjs.HavenSigningError(
2749
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2673
2750
  `Unknown sign_data.signature_scheme '${scheme}' \u2014 refusing to guess a signing scheme. Update @haven_ai/sdk.`
2674
2751
  );
2675
2752
  }
@@ -2853,7 +2930,7 @@ var HavenClient = class {
2853
2930
  */
2854
2931
  async getPaymentStatusWithPostPurchaseAllowance(paymentId) {
2855
2932
  const status = await this.getPaymentStatus(paymentId);
2856
- if (status.rail === chunkJKUIE45B_cjs.AgentPaymentRail.X402 && status.phase === chunkJKUIE45B_cjs.AgentPaymentPhase.PaymentConfirmed) {
2933
+ if (status.rail === chunkS42QSWJY_cjs.AgentPaymentRail.X402 && status.phase === chunkS42QSWJY_cjs.AgentPaymentPhase.PaymentConfirmed) {
2857
2934
  const { allowance, warnings } = await this.getPostPurchaseAllowanceSummary(paymentId);
2858
2935
  return { ...status, allowance, ...warnings.length > 0 ? { warnings } : {} };
2859
2936
  }
@@ -2939,6 +3016,96 @@ var HavenClient = class {
2939
3016
  async getReceipt(paymentId) {
2940
3017
  return this.accountReads.getReceipt(paymentId);
2941
3018
  }
3019
+ // ── Task Budgets (#3329) ────────────────────────────────────────────
3020
+ /**
3021
+ * Open a task budget: a self-delegated, time-boxed slice of the agent's own
3022
+ * budget delegation. Returns the pending row plus the child delegation's
3023
+ * `sign_data` — sign it (via `signForData` / `haven_sign` with
3024
+ * `task_budget_id`) and pass the signature to `submitTaskBudget` to make it
3025
+ * OPEN. Nothing is on-chain until then.
3026
+ */
3027
+ async openTaskBudget(request) {
3028
+ const raw = await this.post("/task-budgets", {
3029
+ ...request.tokenAddress ? { token_address: request.tokenAddress } : {},
3030
+ max_amount_atomic: request.maxAmountAtomic,
3031
+ ttl_seconds: request.ttlSeconds,
3032
+ ...request.recipientAddress ? { recipient_address: request.recipientAddress } : {},
3033
+ ...request.label ? { label: request.label } : {}
3034
+ });
3035
+ return {
3036
+ taskBudget: mapTaskBudget(raw.task_budget),
3037
+ signData: raw.sign_data,
3038
+ nextAction: raw.next_action,
3039
+ instructions: raw.instructions
3040
+ };
3041
+ }
3042
+ /** Read one task budget by id. */
3043
+ async getTaskBudget(id) {
3044
+ const raw = await this.get(`/task-budgets/${encodeURIComponent(id)}`);
3045
+ return mapTaskBudget(raw.task_budget);
3046
+ }
3047
+ /** List this agent's task budgets — `status: 'open'` (default; unexpired only) or `'all'`. */
3048
+ async listTaskBudgets(options = {}) {
3049
+ const query = options.status ? `?status=${encodeURIComponent(options.status)}` : "";
3050
+ const raw = await this.get(`/task-budgets${query}`);
3051
+ return raw.task_budgets.map(mapTaskBudget);
3052
+ }
3053
+ /**
3054
+ * The exact signing payload for a pending (purpose `open`) or closing
3055
+ * (purpose `close`) task budget — the `task_budget_id` counterpart of
3056
+ * `getResumeState` / the payment sign-context reads. `haven_sign` with
3057
+ * `task_budget_id` fetches this itself; call it directly only for manual
3058
+ * signing.
3059
+ */
3060
+ async getTaskBudgetSignContext(id) {
3061
+ const raw = await this.get(`/task-budgets/${encodeURIComponent(id)}/sign-context`);
3062
+ if (raw.purpose === "close") {
3063
+ return {
3064
+ taskBudgetId: raw.task_budget_id,
3065
+ purpose: "close",
3066
+ taskSignContextVersion: raw.task_sign_context_version,
3067
+ typedData: raw.typed_data,
3068
+ userOperation: raw.user_operation,
3069
+ userOpHash: raw.user_op_hash,
3070
+ expected: raw.expected
3071
+ };
3072
+ }
3073
+ return {
3074
+ taskBudgetId: raw.task_budget_id,
3075
+ purpose: "open",
3076
+ taskSignContextVersion: raw.task_sign_context_version,
3077
+ typedData: raw.typed_data,
3078
+ expected: raw.expected
3079
+ };
3080
+ }
3081
+ /** Submit a signature for a pending (open) or closing task budget. */
3082
+ async submitTaskBudget(id, signature) {
3083
+ const raw = await this.post(
3084
+ `/task-budgets/${encodeURIComponent(id)}/submit`,
3085
+ { signature }
3086
+ );
3087
+ return {
3088
+ taskBudget: mapTaskBudget(raw.task_budget),
3089
+ status: raw.status,
3090
+ ...raw.close_tx_hash ? { closeTxHash: raw.close_tx_hash } : {}
3091
+ };
3092
+ }
3093
+ /**
3094
+ * Close a task budget early. A `pending` or already-expired `open` budget
3095
+ * closes immediately (nothing was ever signed or is on-chain). A live
3096
+ * `open` budget returns `sign_data` for an on-chain `disableDelegation`
3097
+ * UserOp — sign it (`haven_sign` with `task_budget_id`) and call
3098
+ * `submitTaskBudget`.
3099
+ */
3100
+ async closeTaskBudget(id) {
3101
+ const raw = await this.post(`/task-budgets/${encodeURIComponent(id)}/close`, {});
3102
+ return {
3103
+ taskBudget: mapTaskBudget(raw.task_budget),
3104
+ status: raw.status,
3105
+ ...raw.sign_data ? { signData: raw.sign_data } : {},
3106
+ ...raw.next_action ? { nextAction: raw.next_action } : {}
3107
+ };
3108
+ }
2942
3109
  /**
2943
3110
  * Rehydrate the x402 resume-state bundle for a payment id (#1328: the MPP
2944
3111
  * resume-state variant retired along with the rest of the mpp_demo surface).
@@ -2961,7 +3128,7 @@ var HavenClient = class {
2961
3128
  }
2962
3129
  await sleep(this.pollingInterval);
2963
3130
  }
2964
- throw new chunkJKUIE45B_cjs.HavenTimeoutError(paymentId);
3131
+ throw new chunkS42QSWJY_cjs.HavenTimeoutError(paymentId);
2965
3132
  }
2966
3133
  // ── x402 Protocol Support ────────────────────────────────────────
2967
3134
  /**
@@ -2975,23 +3142,23 @@ var HavenClient = class {
2975
3142
  */
2976
3143
  async authorizeX402(paymentRequired, options = {}) {
2977
3144
  if (!this.delegateKey) {
2978
- throw new chunkJKUIE45B_cjs.HavenSigningError(
3145
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
2979
3146
  "delegateKey is required for x402 payments. Pass it in the HavenClient config."
2980
3147
  );
2981
3148
  }
2982
3149
  if (!this.delegateAddress) {
2983
- throw new chunkJKUIE45B_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3150
+ throw new chunkS42QSWJY_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
2984
3151
  }
2985
- const option = chunkQSSVOPWA_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3152
+ const option = chunkCK4NLLMO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
2986
3153
  if (!option) {
2987
3154
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
2988
3155
  }
2989
- const idempotencyKey = options.idempotencyKey ?? chunkQSSVOPWA_cjs.buildX402IdempotencyKey(paymentRequired, option);
3156
+ const idempotencyKey = options.idempotencyKey ?? chunkCK4NLLMO_cjs.buildX402IdempotencyKey(paymentRequired, option);
2990
3157
  const cached = this.fundingLeg.cachedReceipt(idempotencyKey);
2991
3158
  if (cached) return cached;
2992
3159
  const inFlight = this.inFlightX402.get(idempotencyKey);
2993
3160
  if (inFlight) return inFlight;
2994
- const promise = this.fundingLeg.authorize(paymentRequired, option, idempotencyKey);
3161
+ const promise = this.fundingLeg.authorize(paymentRequired, option, idempotencyKey, options.taskBudgetId);
2995
3162
  this.inFlightX402.set(idempotencyKey, promise);
2996
3163
  try {
2997
3164
  return await promise;
@@ -3026,16 +3193,16 @@ var HavenClient = class {
3026
3193
  } catch {
3027
3194
  body = void 0;
3028
3195
  }
3029
- throw new chunkJKUIE45B_cjs.X402UnexpectedStatusError(
3196
+ throw new chunkS42QSWJY_cjs.X402UnexpectedStatusError(
3030
3197
  `Expected an x402 quote response with HTTP 402, got HTTP ${response.status}.`,
3031
3198
  response.status || 400,
3032
3199
  body
3033
3200
  );
3034
3201
  }
3035
3202
  if (response.headers.get("MACHINE-PAYMENT-CHALLENGE")) {
3036
- throw new chunkJKUIE45B_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
3203
+ throw new chunkS42QSWJY_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
3037
3204
  }
3038
- const paymentRequired = await chunkQSSVOPWA_cjs.parsePaymentRequiredResponse(response);
3205
+ const paymentRequired = await chunkCK4NLLMO_cjs.parsePaymentRequiredResponse(response);
3039
3206
  const mcpTransport = await this.merchantTransport.detect(url, paymentRequired, response);
3040
3207
  return buildX402Quote(paymentRequired, request, options.idempotencyKey, mcpTransport);
3041
3208
  }
@@ -3053,7 +3220,7 @@ var HavenClient = class {
3053
3220
  const wallet = await this.merchantCompletion.resolveWalletForMerchantCall();
3054
3221
  const sessionId = await this.merchantTransport.initialize(url, init, wallet);
3055
3222
  if (!sessionId) {
3056
- throw new chunkJKUIE45B_cjs.HavenApiError(
3223
+ throw new chunkS42QSWJY_cjs.HavenApiError(
3057
3224
  "The merchant did not establish an MCP session before the x402 quote. No payment was created.",
3058
3225
  502,
3059
3226
  { mcpSessionNotEstablished: true }
@@ -3073,7 +3240,7 @@ var HavenClient = class {
3073
3240
  async payX402Quote(quote, options = {}) {
3074
3241
  const idempotencyKey = options.idempotencyKey ?? quote.idempotencyKey;
3075
3242
  try {
3076
- const receipt = await this.authorizeX402(quote.paymentRequired, { idempotencyKey });
3243
+ const receipt = await this.authorizeX402(quote.paymentRequired, { ...options, idempotencyKey });
3077
3244
  return this.merchantCompletion.retryRequest(
3078
3245
  quote.request.url,
3079
3246
  requestInitFromSnapshot(quote.request),
@@ -3127,18 +3294,18 @@ var HavenClient = class {
3127
3294
  }
3128
3295
  async resumeAuthorizedX402(input) {
3129
3296
  if (!this.delegateKey) {
3130
- throw new chunkJKUIE45B_cjs.HavenSigningError(
3297
+ throw new chunkS42QSWJY_cjs.HavenSigningError(
3131
3298
  "delegateKey is required for x402 payments. Pass it in the HavenClient config."
3132
3299
  );
3133
3300
  }
3134
3301
  if (!this.delegateAddress) {
3135
- throw new chunkJKUIE45B_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3302
+ throw new chunkS42QSWJY_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3136
3303
  }
3137
- const option = chunkQSSVOPWA_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
3304
+ const option = chunkCK4NLLMO_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
3138
3305
  if (!option) {
3139
3306
  throw noCompatiblePaymentOptionError(input.paymentRequired.accepts);
3140
3307
  }
3141
- const idempotencyKey = input.idempotencyKey ?? chunkQSSVOPWA_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
3308
+ const idempotencyKey = input.idempotencyKey ?? chunkCK4NLLMO_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
3142
3309
  const cached = this.fundingLeg.cachedReceipt(idempotencyKey);
3143
3310
  if (cached) return cached;
3144
3311
  const status = await this.getPaymentStatus(input.paymentId);
@@ -3146,10 +3313,10 @@ var HavenClient = class {
3146
3313
  const canFund = await this.fundingLeg.delegateCanFund(
3147
3314
  status.chainId ?? chainIdFromNetwork(option.network),
3148
3315
  option.asset,
3149
- chunkQSSVOPWA_cjs.x402AuthorizationAmount(option)
3316
+ chunkCK4NLLMO_cjs.x402AuthorizationAmount(option)
3150
3317
  );
3151
3318
  if (canFund === false) {
3152
- throw new chunkJKUIE45B_cjs.X402AlreadySettledError(
3319
+ throw new chunkS42QSWJY_cjs.X402AlreadySettledError(
3153
3320
  `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.`,
3154
3321
  this.fundingLeg.receiptFromStatus(input.paymentRequired, option, void 0, status),
3155
3322
  "settled"
@@ -3170,13 +3337,13 @@ var HavenClient = class {
3170
3337
  const url = input.url ?? input.request?.url;
3171
3338
  if (!paymentRequired) {
3172
3339
  if (!url) {
3173
- throw new chunkJKUIE45B_cjs.HavenApiError("x402 resume requires the original URL or a captured request snapshot.", 400);
3340
+ throw new chunkS42QSWJY_cjs.HavenApiError("x402 resume requires the original URL or a captured request snapshot.", 400);
3174
3341
  }
3175
3342
  const response = await this.merchantTransport.fetch(url, initialInit);
3176
3343
  if (response.status !== 402) {
3177
- throw new chunkJKUIE45B_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
3344
+ throw new chunkS42QSWJY_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
3178
3345
  }
3179
- paymentRequired = await chunkQSSVOPWA_cjs.parsePaymentRequiredResponse(response);
3346
+ paymentRequired = await chunkCK4NLLMO_cjs.parsePaymentRequiredResponse(response);
3180
3347
  }
3181
3348
  const receipt = await this.resumeAuthorizedX402({
3182
3349
  paymentId: input.paymentId,
@@ -3229,7 +3396,7 @@ var HavenClient = class {
3229
3396
  nativeChallenge = true;
3230
3397
  } else {
3231
3398
  try {
3232
- paymentRequired = await chunkQSSVOPWA_cjs.parsePaymentRequiredResponse(response);
3399
+ paymentRequired = await chunkCK4NLLMO_cjs.parsePaymentRequiredResponse(response);
3233
3400
  } catch {
3234
3401
  return response;
3235
3402
  }
@@ -3239,8 +3406,8 @@ var HavenClient = class {
3239
3406
  if (mcpSessionId) requestInit = this.merchantTransport.withSessionHeaders(requestInit, mcpSessionId);
3240
3407
  }
3241
3408
  const request = snapshotX402Request(url, requestInit);
3242
- const option = chunkQSSVOPWA_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3243
- const idempotencyKey = options.idempotencyKey ?? (option ? chunkQSSVOPWA_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
3409
+ const option = chunkCK4NLLMO_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3410
+ const idempotencyKey = options.idempotencyKey ?? (option ? chunkCK4NLLMO_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
3244
3411
  let receipt;
3245
3412
  try {
3246
3413
  receipt = await this.authorizeX402(paymentRequired, options);
@@ -3367,7 +3534,7 @@ var HavenClient = class {
3367
3534
  txHash: evidenceTxHash,
3368
3535
  resourceUrl: evidenceContext.resourceUrl,
3369
3536
  merchantStatus: surfaced.status,
3370
- paymentProofHeaderName: chunkQSSVOPWA_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
3537
+ paymentProofHeaderName: chunkCK4NLLMO_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
3371
3538
  paymentProofHeader: input.paymentHeader,
3372
3539
  protocolReceiptHeaderName,
3373
3540
  protocolReceiptHeader
@@ -3651,7 +3818,7 @@ var toolDescriptions = {
3651
3818
  send: {
3652
3819
  summary: "Send ETH or USDC directly from the agent's Haven wallet to a recipient address.",
3653
3820
  selectionGuidance: "Use this for plain transfers \u2014 refunding a user, paying a freelancer, topping up a co-agent's wallet, or moving funds between addresses. Do NOT use for x402 paid endpoints \u2014 use haven_pay_x402 instead. Do NOT use for read-only allowance, budget, or what-can-I-spend questions \u2014 use haven_get_allowances. Do NOT use to check whether funds are held before sending \u2014 use haven_check_funds.",
3654
- behavior: "Sends the amount by redeeming the agent's on-chain budget delegation, account to recipient with no funding leg. Budget, recipient and expiry are enforced on-chain while the transfer is prepared, so a request outside them is declined before any money moves or any signing \u2014 never queued for a human to approve. The agent's signing key signs the account's typed data, refusing any that mismatches the payment's hash; Haven never receives the key.",
3821
+ behavior: "Sends the amount by redeeming the agent's on-chain budget delegation, account to recipient with no funding leg. Budget, recipient and expiry are enforced on-chain while the transfer is prepared, so a request outside them is declined before any money moves or any signing \u2014 never queued for a human to approve. The agent's signing key signs the account's typed data; a current signer refuses any that does not match the payment's hash (USEROP_BINDING_MISMATCH), an older signer signs it and the account rejects it on-chain. Haven never receives the key.",
3655
3822
  nextActionGuidance: "On a decline, report the reason to the user and ask them to grant or raise the budget in Haven \u2014 there is nothing to poll and no approval will arrive. After a successful send, poll haven_get_payment_status until nextAction=none."
3656
3823
  },
3657
3824
  reportSettlementEvidence: {
@@ -3984,6 +4151,10 @@ Call \`haven_get_agent\`, one of the Haven MCP tools the connector wires into yo
3984
4151
 
3985
4152
  Nothing here needs you to. Steps 1-3 are links: hand your user the full \`<host>/\u2026\` URL and ask them to say when it is done. Step 5 is a link only when your run reported one in \`approval.url\` \u2014 otherwise it is the tab they already have open, as above. Then poll \`haven_get_agent\` until it reads \`ready\`. Do not route around the sign-in wall \u2014 it makes the account theirs, not yours.
3986
4153
 
4154
+ ## If something breaks
4155
+
4156
+ If a Haven result carries \`client_update\`, that client is out of date: update it \u2014 \`upgrade_command\` names the package and channel \u2014 then retry. \`required: true\` means payments are refused until you do. What changed: [/releases](/releases).
4157
+
3987
4158
  ## Vocabulary
3988
4159
 
3989
4160
  | Term | What it is |
@@ -4364,435 +4535,455 @@ function sameUrl(a, b) {
4364
4535
 
4365
4536
  Object.defineProperty(exports, "DEFAULT_NEXT_TOOL_BY_ACTION", {
4366
4537
  enumerable: true,
4367
- get: function () { return chunkQSSVOPWA_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
4538
+ get: function () { return chunkCK4NLLMO_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
4368
4539
  });
4369
4540
  Object.defineProperty(exports, "ERC7710_ASSET_TRANSFER_METHOD", {
4370
4541
  enumerable: true,
4371
- get: function () { return chunkQSSVOPWA_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
4542
+ get: function () { return chunkCK4NLLMO_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
4372
4543
  });
4373
4544
  Object.defineProperty(exports, "HAVEN_CLIENT_HEADER", {
4374
4545
  enumerable: true,
4375
- get: function () { return chunkQSSVOPWA_cjs.HAVEN_CLIENT_HEADER; }
4546
+ get: function () { return chunkCK4NLLMO_cjs.HAVEN_CLIENT_HEADER; }
4376
4547
  });
4377
4548
  Object.defineProperty(exports, "HAVEN_MINIMUM_NODE_VERSION", {
4378
4549
  enumerable: true,
4379
- get: function () { return chunkQSSVOPWA_cjs.HAVEN_MINIMUM_NODE_VERSION; }
4550
+ get: function () { return chunkCK4NLLMO_cjs.HAVEN_MINIMUM_NODE_VERSION; }
4380
4551
  });
4381
4552
  Object.defineProperty(exports, "HavenTypedDataRefusedError", {
4382
4553
  enumerable: true,
4383
- get: function () { return chunkQSSVOPWA_cjs.HavenTypedDataRefusedError; }
4554
+ get: function () { return chunkCK4NLLMO_cjs.HavenTypedDataRefusedError; }
4555
+ });
4556
+ Object.defineProperty(exports, "MAX_TASK_BUDGET_TTL_SECONDS", {
4557
+ enumerable: true,
4558
+ get: function () { return chunkCK4NLLMO_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
4384
4559
  });
4385
4560
  Object.defineProperty(exports, "NEXT_TOOL_SERVER_NAMES", {
4386
4561
  enumerable: true,
4387
- get: function () { return chunkQSSVOPWA_cjs.NEXT_TOOL_SERVER_NAMES; }
4562
+ get: function () { return chunkCK4NLLMO_cjs.NEXT_TOOL_SERVER_NAMES; }
4388
4563
  });
4389
4564
  Object.defineProperty(exports, "NEXT_TOOL_SERVER_ROLES", {
4390
4565
  enumerable: true,
4391
- get: function () { return chunkQSSVOPWA_cjs.NEXT_TOOL_SERVER_ROLES; }
4566
+ get: function () { return chunkCK4NLLMO_cjs.NEXT_TOOL_SERVER_ROLES; }
4392
4567
  });
4393
4568
  Object.defineProperty(exports, "SDK_CLIENT_IDENTITY", {
4394
4569
  enumerable: true,
4395
- get: function () { return chunkQSSVOPWA_cjs.SDK_CLIENT_IDENTITY; }
4570
+ get: function () { return chunkCK4NLLMO_cjs.SDK_CLIENT_IDENTITY; }
4396
4571
  });
4397
4572
  Object.defineProperty(exports, "SDK_VERSION", {
4398
4573
  enumerable: true,
4399
- get: function () { return chunkQSSVOPWA_cjs.SDK_VERSION; }
4574
+ get: function () { return chunkCK4NLLMO_cjs.SDK_VERSION; }
4400
4575
  });
4401
4576
  Object.defineProperty(exports, "SWEEP_BASE_CHAIN_ID", {
4402
4577
  enumerable: true,
4403
- get: function () { return chunkQSSVOPWA_cjs.SWEEP_BASE_CHAIN_ID; }
4578
+ get: function () { return chunkCK4NLLMO_cjs.SWEEP_BASE_CHAIN_ID; }
4404
4579
  });
4405
4580
  Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_CHAIN_ID", {
4406
4581
  enumerable: true,
4407
- get: function () { return chunkQSSVOPWA_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
4582
+ get: function () { return chunkCK4NLLMO_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
4408
4583
  });
4409
4584
  Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_USDC_ADDRESS", {
4410
4585
  enumerable: true,
4411
- get: function () { return chunkQSSVOPWA_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
4586
+ get: function () { return chunkCK4NLLMO_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
4412
4587
  });
4413
4588
  Object.defineProperty(exports, "SWEEP_BASE_USDC_ADDRESS", {
4414
4589
  enumerable: true,
4415
- get: function () { return chunkQSSVOPWA_cjs.SWEEP_BASE_USDC_ADDRESS; }
4590
+ get: function () { return chunkCK4NLLMO_cjs.SWEEP_BASE_USDC_ADDRESS; }
4416
4591
  });
4417
4592
  Object.defineProperty(exports, "TRANSFER_WITH_AUTHORIZATION_TYPES", {
4418
4593
  enumerable: true,
4419
- get: function () { return chunkQSSVOPWA_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
4594
+ get: function () { return chunkCK4NLLMO_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
4420
4595
  });
4421
4596
  Object.defineProperty(exports, "TYPED_DATA_NOT_ALLOWED", {
4422
4597
  enumerable: true,
4423
- get: function () { return chunkQSSVOPWA_cjs.TYPED_DATA_NOT_ALLOWED; }
4598
+ get: function () { return chunkCK4NLLMO_cjs.TYPED_DATA_NOT_ALLOWED; }
4424
4599
  });
4425
4600
  Object.defineProperty(exports, "X402PaymentHeaderValidationError", {
4426
4601
  enumerable: true,
4427
- get: function () { return chunkQSSVOPWA_cjs.X402PaymentHeaderValidationError; }
4602
+ get: function () { return chunkCK4NLLMO_cjs.X402PaymentHeaderValidationError; }
4428
4603
  });
4429
4604
  Object.defineProperty(exports, "X402_LEGACY_PAYMENT_HEADER_NAME", {
4430
4605
  enumerable: true,
4431
- get: function () { return chunkQSSVOPWA_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
4606
+ get: function () { return chunkCK4NLLMO_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
4432
4607
  });
4433
4608
  Object.defineProperty(exports, "X402_MAX_AUTHORIZATION_WINDOW_SECONDS", {
4434
4609
  enumerable: true,
4435
- get: function () { return chunkQSSVOPWA_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
4610
+ get: function () { return chunkCK4NLLMO_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
4436
4611
  });
4437
4612
  Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAME", {
4438
4613
  enumerable: true,
4439
- get: function () { return chunkQSSVOPWA_cjs.X402_PAYMENT_HEADER_NAME; }
4614
+ get: function () { return chunkCK4NLLMO_cjs.X402_PAYMENT_HEADER_NAME; }
4440
4615
  });
4441
4616
  Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAMES_SENT", {
4442
4617
  enumerable: true,
4443
- get: function () { return chunkQSSVOPWA_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
4618
+ get: function () { return chunkCK4NLLMO_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
4444
4619
  });
4445
4620
  Object.defineProperty(exports, "X402_PAYMENT_REQUIRED_HEADER_NAME", {
4446
4621
  enumerable: true,
4447
- get: function () { return chunkQSSVOPWA_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
4622
+ get: function () { return chunkCK4NLLMO_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
4448
4623
  });
4449
4624
  Object.defineProperty(exports, "X402_PAYMENT_RESPONSE_HEADER_NAME", {
4450
4625
  enumerable: true,
4451
- get: function () { return chunkQSSVOPWA_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
4626
+ get: function () { return chunkCK4NLLMO_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
4452
4627
  });
4453
4628
  Object.defineProperty(exports, "X402_SETTLEMENT_FORWARD_MARGIN_SECONDS", {
4454
4629
  enumerable: true,
4455
- get: function () { return chunkQSSVOPWA_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
4630
+ get: function () { return chunkCK4NLLMO_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
4456
4631
  });
4457
4632
  Object.defineProperty(exports, "assertBoundDirectPaymentUserOp", {
4458
4633
  enumerable: true,
4459
- get: function () { return chunkQSSVOPWA_cjs.assertBoundDirectPaymentUserOp; }
4634
+ get: function () { return chunkCK4NLLMO_cjs.assertBoundDirectPaymentUserOp; }
4635
+ });
4636
+ Object.defineProperty(exports, "assertOwnTaskBudgetCloseUserOp", {
4637
+ enumerable: true,
4638
+ get: function () { return chunkCK4NLLMO_cjs.assertOwnTaskBudgetCloseUserOp; }
4639
+ });
4640
+ Object.defineProperty(exports, "assertOwnTaskChild", {
4641
+ enumerable: true,
4642
+ get: function () { return chunkCK4NLLMO_cjs.assertOwnTaskChild; }
4460
4643
  });
4461
4644
  Object.defineProperty(exports, "buildSweepAuthorizationMessage", {
4462
4645
  enumerable: true,
4463
- get: function () { return chunkQSSVOPWA_cjs.buildSweepAuthorizationMessage; }
4646
+ get: function () { return chunkCK4NLLMO_cjs.buildSweepAuthorizationMessage; }
4464
4647
  });
4465
4648
  Object.defineProperty(exports, "buildSweepTypedData", {
4466
4649
  enumerable: true,
4467
- get: function () { return chunkQSSVOPWA_cjs.buildSweepTypedData; }
4650
+ get: function () { return chunkCK4NLLMO_cjs.buildSweepTypedData; }
4468
4651
  });
4469
4652
  Object.defineProperty(exports, "buildX402ExpectedMessage", {
4470
4653
  enumerable: true,
4471
- get: function () { return chunkQSSVOPWA_cjs.buildX402ExpectedMessage; }
4654
+ get: function () { return chunkCK4NLLMO_cjs.buildX402ExpectedMessage; }
4472
4655
  });
4473
4656
  Object.defineProperty(exports, "compareNodeVersions", {
4474
4657
  enumerable: true,
4475
- get: function () { return chunkQSSVOPWA_cjs.compareNodeVersions; }
4658
+ get: function () { return chunkCK4NLLMO_cjs.compareNodeVersions; }
4476
4659
  });
4477
4660
  Object.defineProperty(exports, "createNextStepBuilder", {
4478
4661
  enumerable: true,
4479
- get: function () { return chunkQSSVOPWA_cjs.createNextStepBuilder; }
4662
+ get: function () { return chunkCK4NLLMO_cjs.createNextStepBuilder; }
4480
4663
  });
4481
4664
  Object.defineProperty(exports, "decodeBase64Json", {
4482
4665
  enumerable: true,
4483
- get: function () { return chunkQSSVOPWA_cjs.decodeBase64Json; }
4666
+ get: function () { return chunkCK4NLLMO_cjs.decodeBase64Json; }
4484
4667
  });
4485
4668
  Object.defineProperty(exports, "decodeBase64Utf8", {
4486
4669
  enumerable: true,
4487
- get: function () { return chunkQSSVOPWA_cjs.decodeBase64Utf8; }
4670
+ get: function () { return chunkCK4NLLMO_cjs.decodeBase64Utf8; }
4488
4671
  });
4489
4672
  Object.defineProperty(exports, "defaultNextToolFor", {
4490
4673
  enumerable: true,
4491
- get: function () { return chunkQSSVOPWA_cjs.defaultNextToolFor; }
4674
+ get: function () { return chunkCK4NLLMO_cjs.defaultNextToolFor; }
4492
4675
  });
4493
4676
  Object.defineProperty(exports, "encodeBase64Json", {
4494
4677
  enumerable: true,
4495
- get: function () { return chunkQSSVOPWA_cjs.encodeBase64Json; }
4678
+ get: function () { return chunkCK4NLLMO_cjs.encodeBase64Json; }
4496
4679
  });
4497
4680
  Object.defineProperty(exports, "encodeBase64Utf8", {
4498
4681
  enumerable: true,
4499
- get: function () { return chunkQSSVOPWA_cjs.encodeBase64Utf8; }
4682
+ get: function () { return chunkCK4NLLMO_cjs.encodeBase64Utf8; }
4500
4683
  });
4501
4684
  Object.defineProperty(exports, "encodePaymentProof", {
4502
4685
  enumerable: true,
4503
- get: function () { return chunkQSSVOPWA_cjs.encodePaymentProof; }
4686
+ get: function () { return chunkCK4NLLMO_cjs.encodePaymentProof; }
4687
+ });
4688
+ Object.defineProperty(exports, "hashDelegation", {
4689
+ enumerable: true,
4690
+ get: function () { return chunkCK4NLLMO_cjs.hashDelegation; }
4504
4691
  });
4505
4692
  Object.defineProperty(exports, "havenClientIdentity", {
4506
4693
  enumerable: true,
4507
- get: function () { return chunkQSSVOPWA_cjs.havenClientIdentity; }
4694
+ get: function () { return chunkCK4NLLMO_cjs.havenClientIdentity; }
4508
4695
  });
4509
4696
  Object.defineProperty(exports, "isErc7710Option", {
4510
4697
  enumerable: true,
4511
- get: function () { return chunkQSSVOPWA_cjs.isErc7710Option; }
4698
+ get: function () { return chunkCK4NLLMO_cjs.isErc7710Option; }
4512
4699
  });
4513
4700
  Object.defineProperty(exports, "isSupportedNodeVersion", {
4514
4701
  enumerable: true,
4515
- get: function () { return chunkQSSVOPWA_cjs.isSupportedNodeVersion; }
4702
+ get: function () { return chunkCK4NLLMO_cjs.isSupportedNodeVersion; }
4516
4703
  });
4517
4704
  Object.defineProperty(exports, "isSweepableChain", {
4518
4705
  enumerable: true,
4519
- get: function () { return chunkQSSVOPWA_cjs.isSweepableChain; }
4706
+ get: function () { return chunkCK4NLLMO_cjs.isSweepableChain; }
4707
+ });
4708
+ Object.defineProperty(exports, "isTaskChildTypedData", {
4709
+ enumerable: true,
4710
+ get: function () { return chunkCK4NLLMO_cjs.isTaskChildTypedData; }
4520
4711
  });
4521
4712
  Object.defineProperty(exports, "normalizePaymentRequired", {
4522
4713
  enumerable: true,
4523
- get: function () { return chunkQSSVOPWA_cjs.normalizePaymentRequired; }
4714
+ get: function () { return chunkCK4NLLMO_cjs.normalizePaymentRequired; }
4524
4715
  });
4525
4716
  Object.defineProperty(exports, "parseNextTool", {
4526
4717
  enumerable: true,
4527
- get: function () { return chunkQSSVOPWA_cjs.parseNextTool; }
4718
+ get: function () { return chunkCK4NLLMO_cjs.parseNextTool; }
4528
4719
  });
4529
4720
  Object.defineProperty(exports, "parsePaymentRequired", {
4530
4721
  enumerable: true,
4531
- get: function () { return chunkQSSVOPWA_cjs.parsePaymentRequired; }
4722
+ get: function () { return chunkCK4NLLMO_cjs.parsePaymentRequired; }
4532
4723
  });
4533
4724
  Object.defineProperty(exports, "parsePaymentRequiredResponse", {
4534
4725
  enumerable: true,
4535
- get: function () { return chunkQSSVOPWA_cjs.parsePaymentRequiredResponse; }
4726
+ get: function () { return chunkCK4NLLMO_cjs.parsePaymentRequiredResponse; }
4536
4727
  });
4537
4728
  Object.defineProperty(exports, "readClientUpdate", {
4538
4729
  enumerable: true,
4539
- get: function () { return chunkQSSVOPWA_cjs.readClientUpdate; }
4730
+ get: function () { return chunkCK4NLLMO_cjs.readClientUpdate; }
4540
4731
  });
4541
4732
  Object.defineProperty(exports, "renderNextTool", {
4542
4733
  enumerable: true,
4543
- get: function () { return chunkQSSVOPWA_cjs.renderNextTool; }
4734
+ get: function () { return chunkCK4NLLMO_cjs.renderNextTool; }
4544
4735
  });
4545
4736
  Object.defineProperty(exports, "resolveTokenFromAddress", {
4546
4737
  enumerable: true,
4547
- get: function () { return chunkQSSVOPWA_cjs.resolveTokenFromAddress; }
4738
+ get: function () { return chunkCK4NLLMO_cjs.resolveTokenFromAddress; }
4548
4739
  });
4549
4740
  Object.defineProperty(exports, "selectErc7710PaymentOption", {
4550
4741
  enumerable: true,
4551
- get: function () { return chunkQSSVOPWA_cjs.selectErc7710PaymentOption; }
4742
+ get: function () { return chunkCK4NLLMO_cjs.selectErc7710PaymentOption; }
4552
4743
  });
4553
4744
  Object.defineProperty(exports, "selectPaymentOption", {
4554
4745
  enumerable: true,
4555
- get: function () { return chunkQSSVOPWA_cjs.selectPaymentOption; }
4746
+ get: function () { return chunkCK4NLLMO_cjs.selectPaymentOption; }
4556
4747
  });
4557
4748
  Object.defineProperty(exports, "selectStandardPaymentOption", {
4558
4749
  enumerable: true,
4559
- get: function () { return chunkQSSVOPWA_cjs.selectStandardPaymentOption; }
4750
+ get: function () { return chunkCK4NLLMO_cjs.selectStandardPaymentOption; }
4560
4751
  });
4561
4752
  Object.defineProperty(exports, "selectX402SettlementScheme", {
4562
4753
  enumerable: true,
4563
- get: function () { return chunkQSSVOPWA_cjs.selectX402SettlementScheme; }
4754
+ get: function () { return chunkCK4NLLMO_cjs.selectX402SettlementScheme; }
4564
4755
  });
4565
4756
  Object.defineProperty(exports, "sweepUsdcAddress", {
4566
4757
  enumerable: true,
4567
- get: function () { return chunkQSSVOPWA_cjs.sweepUsdcAddress; }
4758
+ get: function () { return chunkCK4NLLMO_cjs.sweepUsdcAddress; }
4568
4759
  });
4569
4760
  Object.defineProperty(exports, "sweepUsdcDomain", {
4570
4761
  enumerable: true,
4571
- get: function () { return chunkQSSVOPWA_cjs.sweepUsdcDomain; }
4762
+ get: function () { return chunkCK4NLLMO_cjs.sweepUsdcDomain; }
4572
4763
  });
4573
4764
  Object.defineProperty(exports, "toStandardPaymentRequirements", {
4574
4765
  enumerable: true,
4575
- get: function () { return chunkQSSVOPWA_cjs.toStandardPaymentRequirements; }
4766
+ get: function () { return chunkCK4NLLMO_cjs.toStandardPaymentRequirements; }
4576
4767
  });
4577
4768
  Object.defineProperty(exports, "unsupportedNodeVersionMessage", {
4578
4769
  enumerable: true,
4579
- get: function () { return chunkQSSVOPWA_cjs.unsupportedNodeVersionMessage; }
4770
+ get: function () { return chunkCK4NLLMO_cjs.unsupportedNodeVersionMessage; }
4580
4771
  });
4581
4772
  Object.defineProperty(exports, "validateStandardX402PaymentHeader", {
4582
4773
  enumerable: true,
4583
- get: function () { return chunkQSSVOPWA_cjs.validateStandardX402PaymentHeader; }
4774
+ get: function () { return chunkCK4NLLMO_cjs.validateStandardX402PaymentHeader; }
4584
4775
  });
4585
4776
  Object.defineProperty(exports, "x402AssetTransferMethod", {
4586
4777
  enumerable: true,
4587
- get: function () { return chunkQSSVOPWA_cjs.x402AssetTransferMethod; }
4778
+ get: function () { return chunkCK4NLLMO_cjs.x402AssetTransferMethod; }
4588
4779
  });
4589
4780
  Object.defineProperty(exports, "x402AuthorizationAmount", {
4590
4781
  enumerable: true,
4591
- get: function () { return chunkQSSVOPWA_cjs.x402AuthorizationAmount; }
4782
+ get: function () { return chunkCK4NLLMO_cjs.x402AuthorizationAmount; }
4592
4783
  });
4593
4784
  Object.defineProperty(exports, "x402FacilitatorAddresses", {
4594
4785
  enumerable: true,
4595
- get: function () { return chunkQSSVOPWA_cjs.x402FacilitatorAddresses; }
4786
+ get: function () { return chunkCK4NLLMO_cjs.x402FacilitatorAddresses; }
4596
4787
  });
4597
4788
  Object.defineProperty(exports, "x402V2PaymentEnvelope", {
4598
4789
  enumerable: true,
4599
- get: function () { return chunkQSSVOPWA_cjs.x402V2PaymentEnvelope; }
4790
+ get: function () { return chunkCK4NLLMO_cjs.x402V2PaymentEnvelope; }
4600
4791
  });
4601
4792
  Object.defineProperty(exports, "AGENT_PAYMENT_FAILURE_CODE_VALUES", {
4602
4793
  enumerable: true,
4603
- get: function () { return chunkJKUIE45B_cjs.AGENT_PAYMENT_FAILURE_CODE_VALUES; }
4794
+ get: function () { return chunkS42QSWJY_cjs.AGENT_PAYMENT_FAILURE_CODE_VALUES; }
4604
4795
  });
4605
4796
  Object.defineProperty(exports, "AGENT_PAYMENT_NEXT_ACTION_VALUES", {
4606
4797
  enumerable: true,
4607
- get: function () { return chunkJKUIE45B_cjs.AGENT_PAYMENT_NEXT_ACTION_VALUES; }
4798
+ get: function () { return chunkS42QSWJY_cjs.AGENT_PAYMENT_NEXT_ACTION_VALUES; }
4608
4799
  });
4609
4800
  Object.defineProperty(exports, "AGENT_PAYMENT_PHASE_VALUES", {
4610
4801
  enumerable: true,
4611
- get: function () { return chunkJKUIE45B_cjs.AGENT_PAYMENT_PHASE_VALUES; }
4802
+ get: function () { return chunkS42QSWJY_cjs.AGENT_PAYMENT_PHASE_VALUES; }
4612
4803
  });
4613
4804
  Object.defineProperty(exports, "AGENT_PAYMENT_RAIL_VALUES", {
4614
4805
  enumerable: true,
4615
- get: function () { return chunkJKUIE45B_cjs.AGENT_PAYMENT_RAIL_VALUES; }
4806
+ get: function () { return chunkS42QSWJY_cjs.AGENT_PAYMENT_RAIL_VALUES; }
4616
4807
  });
4617
4808
  Object.defineProperty(exports, "AgentPaymentFailureCode", {
4618
4809
  enumerable: true,
4619
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentFailureCode; }
4810
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentFailureCode; }
4620
4811
  });
4621
4812
  Object.defineProperty(exports, "AgentPaymentFailureCodeDescriptions", {
4622
4813
  enumerable: true,
4623
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentFailureCodeDescriptions; }
4814
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentFailureCodeDescriptions; }
4624
4815
  });
4625
4816
  Object.defineProperty(exports, "AgentPaymentFailureCodeSchema", {
4626
4817
  enumerable: true,
4627
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentFailureCodeSchema; }
4818
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentFailureCodeSchema; }
4628
4819
  });
4629
4820
  Object.defineProperty(exports, "AgentPaymentNextAction", {
4630
4821
  enumerable: true,
4631
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentNextAction; }
4822
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentNextAction; }
4632
4823
  });
4633
4824
  Object.defineProperty(exports, "AgentPaymentNextActionDescriptions", {
4634
4825
  enumerable: true,
4635
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentNextActionDescriptions; }
4826
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentNextActionDescriptions; }
4636
4827
  });
4637
4828
  Object.defineProperty(exports, "AgentPaymentNextActionSchema", {
4638
4829
  enumerable: true,
4639
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentNextActionSchema; }
4830
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentNextActionSchema; }
4640
4831
  });
4641
4832
  Object.defineProperty(exports, "AgentPaymentPhase", {
4642
4833
  enumerable: true,
4643
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentPhase; }
4834
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentPhase; }
4644
4835
  });
4645
4836
  Object.defineProperty(exports, "AgentPaymentPhaseDescriptions", {
4646
4837
  enumerable: true,
4647
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentPhaseDescriptions; }
4838
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentPhaseDescriptions; }
4648
4839
  });
4649
4840
  Object.defineProperty(exports, "AgentPaymentPhaseSchema", {
4650
4841
  enumerable: true,
4651
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentPhaseSchema; }
4842
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentPhaseSchema; }
4652
4843
  });
4653
4844
  Object.defineProperty(exports, "AgentPaymentRail", {
4654
4845
  enumerable: true,
4655
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentRail; }
4846
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentRail; }
4656
4847
  });
4657
4848
  Object.defineProperty(exports, "AgentPaymentRailDescriptions", {
4658
4849
  enumerable: true,
4659
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentRailDescriptions; }
4850
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentRailDescriptions; }
4660
4851
  });
4661
4852
  Object.defineProperty(exports, "AgentPaymentRailSchema", {
4662
4853
  enumerable: true,
4663
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentRailSchema; }
4854
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentRailSchema; }
4664
4855
  });
4665
4856
  Object.defineProperty(exports, "AgentPaymentWarningCode", {
4666
4857
  enumerable: true,
4667
- get: function () { return chunkJKUIE45B_cjs.AgentPaymentWarningCode; }
4858
+ get: function () { return chunkS42QSWJY_cjs.AgentPaymentWarningCode; }
4668
4859
  });
4669
4860
  Object.defineProperty(exports, "CONNECTOR_PACKAGE_NAME", {
4670
4861
  enumerable: true,
4671
- get: function () { return chunkJKUIE45B_cjs.CONNECTOR_PACKAGE_NAME; }
4862
+ get: function () { return chunkS42QSWJY_cjs.CONNECTOR_PACKAGE_NAME; }
4672
4863
  });
4673
4864
  Object.defineProperty(exports, "DEFAULT_CONFIRMATION_TIMEOUT_MS", {
4674
4865
  enumerable: true,
4675
- get: function () { return chunkJKUIE45B_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS; }
4866
+ get: function () { return chunkS42QSWJY_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS; }
4676
4867
  });
4677
4868
  Object.defineProperty(exports, "DIRECT_SIGN_CONTEXT_VERSION", {
4678
4869
  enumerable: true,
4679
- get: function () { return chunkJKUIE45B_cjs.DIRECT_SIGN_CONTEXT_VERSION; }
4870
+ get: function () { return chunkS42QSWJY_cjs.DIRECT_SIGN_CONTEXT_VERSION; }
4680
4871
  });
4681
4872
  Object.defineProperty(exports, "ENTRY_POINT_V07", {
4682
4873
  enumerable: true,
4683
- get: function () { return chunkJKUIE45B_cjs.ENTRY_POINT_V07; }
4874
+ get: function () { return chunkS42QSWJY_cjs.ENTRY_POINT_V07; }
4684
4875
  });
4685
4876
  Object.defineProperty(exports, "HAVEN_CONNECTOR_CHANNEL", {
4686
4877
  enumerable: true,
4687
- get: function () { return chunkJKUIE45B_cjs.HAVEN_CONNECTOR_CHANNEL; }
4878
+ get: function () { return chunkS42QSWJY_cjs.HAVEN_CONNECTOR_CHANNEL; }
4688
4879
  });
4689
4880
  Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_NAME", {
4690
4881
  enumerable: true,
4691
- get: function () { return chunkJKUIE45B_cjs.HYBRID_DELEGATOR_DOMAIN_NAME; }
4882
+ get: function () { return chunkS42QSWJY_cjs.HYBRID_DELEGATOR_DOMAIN_NAME; }
4692
4883
  });
4693
4884
  Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_VERSION", {
4694
4885
  enumerable: true,
4695
- get: function () { return chunkJKUIE45B_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION; }
4886
+ get: function () { return chunkS42QSWJY_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION; }
4696
4887
  });
4697
4888
  Object.defineProperty(exports, "HavenApiError", {
4698
4889
  enumerable: true,
4699
- get: function () { return chunkJKUIE45B_cjs.HavenApiError; }
4890
+ get: function () { return chunkS42QSWJY_cjs.HavenApiError; }
4700
4891
  });
4701
4892
  Object.defineProperty(exports, "HavenError", {
4702
4893
  enumerable: true,
4703
- get: function () { return chunkJKUIE45B_cjs.HavenError; }
4894
+ get: function () { return chunkS42QSWJY_cjs.HavenError; }
4704
4895
  });
4705
4896
  Object.defineProperty(exports, "HavenPaymentStateError", {
4706
4897
  enumerable: true,
4707
- get: function () { return chunkJKUIE45B_cjs.HavenPaymentStateError; }
4898
+ get: function () { return chunkS42QSWJY_cjs.HavenPaymentStateError; }
4708
4899
  });
4709
4900
  Object.defineProperty(exports, "HavenSigningError", {
4710
4901
  enumerable: true,
4711
- get: function () { return chunkJKUIE45B_cjs.HavenSigningError; }
4902
+ get: function () { return chunkS42QSWJY_cjs.HavenSigningError; }
4712
4903
  });
4713
4904
  Object.defineProperty(exports, "HavenTimeoutError", {
4714
4905
  enumerable: true,
4715
- get: function () { return chunkJKUIE45B_cjs.HavenTimeoutError; }
4906
+ get: function () { return chunkS42QSWJY_cjs.HavenTimeoutError; }
4716
4907
  });
4717
4908
  Object.defineProperty(exports, "HavenUnsupportedSignerVersionError", {
4718
4909
  enumerable: true,
4719
- get: function () { return chunkJKUIE45B_cjs.HavenUnsupportedSignerVersionError; }
4910
+ get: function () { return chunkS42QSWJY_cjs.HavenUnsupportedSignerVersionError; }
4720
4911
  });
4721
4912
  Object.defineProperty(exports, "HavenUserOpBindingError", {
4722
4913
  enumerable: true,
4723
- get: function () { return chunkJKUIE45B_cjs.HavenUserOpBindingError; }
4914
+ get: function () { return chunkS42QSWJY_cjs.HavenUserOpBindingError; }
4724
4915
  });
4725
4916
  Object.defineProperty(exports, "HavenZeroSettlementHashError", {
4726
4917
  enumerable: true,
4727
- get: function () { return chunkJKUIE45B_cjs.HavenZeroSettlementHashError; }
4918
+ get: function () { return chunkS42QSWJY_cjs.HavenZeroSettlementHashError; }
4728
4919
  });
4729
4920
  Object.defineProperty(exports, "MerchantTimeoutError", {
4730
4921
  enumerable: true,
4731
- get: function () { return chunkJKUIE45B_cjs.MerchantTimeoutError; }
4922
+ get: function () { return chunkS42QSWJY_cjs.MerchantTimeoutError; }
4732
4923
  });
4733
4924
  Object.defineProperty(exports, "PACKED_USER_OPERATION_FIELDS", {
4734
4925
  enumerable: true,
4735
- get: function () { return chunkJKUIE45B_cjs.PACKED_USER_OPERATION_FIELDS; }
4926
+ get: function () { return chunkS42QSWJY_cjs.PACKED_USER_OPERATION_FIELDS; }
4736
4927
  });
4737
4928
  Object.defineProperty(exports, "ROOT_AUTHORITY", {
4738
4929
  enumerable: true,
4739
- get: function () { return chunkJKUIE45B_cjs.ROOT_AUTHORITY; }
4930
+ get: function () { return chunkS42QSWJY_cjs.ROOT_AUTHORITY; }
4740
4931
  });
4741
4932
  Object.defineProperty(exports, "SIGNER_UPDATE_FALLBACK", {
4742
4933
  enumerable: true,
4743
- get: function () { return chunkJKUIE45B_cjs.SIGNER_UPDATE_FALLBACK; }
4934
+ get: function () { return chunkS42QSWJY_cjs.SIGNER_UPDATE_FALLBACK; }
4744
4935
  });
4745
4936
  Object.defineProperty(exports, "SignerRefusalCode", {
4746
4937
  enumerable: true,
4747
- get: function () { return chunkJKUIE45B_cjs.SignerRefusalCode; }
4938
+ get: function () { return chunkS42QSWJY_cjs.SignerRefusalCode; }
4748
4939
  });
4749
4940
  Object.defineProperty(exports, "X402AlreadySettledError", {
4750
4941
  enumerable: true,
4751
- get: function () { return chunkJKUIE45B_cjs.X402AlreadySettledError; }
4942
+ get: function () { return chunkS42QSWJY_cjs.X402AlreadySettledError; }
4752
4943
  });
4753
4944
  Object.defineProperty(exports, "X402UnexpectedStatusError", {
4754
4945
  enumerable: true,
4755
- get: function () { return chunkJKUIE45B_cjs.X402UnexpectedStatusError; }
4946
+ get: function () { return chunkS42QSWJY_cjs.X402UnexpectedStatusError; }
4756
4947
  });
4757
4948
  Object.defineProperty(exports, "assertUserOpTypedDataBinding", {
4758
4949
  enumerable: true,
4759
- get: function () { return chunkJKUIE45B_cjs.assertUserOpTypedDataBinding; }
4950
+ get: function () { return chunkS42QSWJY_cjs.assertUserOpTypedDataBinding; }
4760
4951
  });
4761
4952
  Object.defineProperty(exports, "connectorRerunCommand", {
4762
4953
  enumerable: true,
4763
- get: function () { return chunkJKUIE45B_cjs.connectorRerunCommand; }
4954
+ get: function () { return chunkS42QSWJY_cjs.connectorRerunCommand; }
4764
4955
  });
4765
4956
  Object.defineProperty(exports, "connectorSpec", {
4766
4957
  enumerable: true,
4767
- get: function () { return chunkJKUIE45B_cjs.connectorSpec; }
4958
+ get: function () { return chunkS42QSWJY_cjs.connectorSpec; }
4768
4959
  });
4769
4960
  Object.defineProperty(exports, "deriveDelegateAccountAddress", {
4770
4961
  enumerable: true,
4771
- get: function () { return chunkJKUIE45B_cjs.deriveDelegateAccountAddress; }
4962
+ get: function () { return chunkS42QSWJY_cjs.deriveDelegateAccountAddress; }
4772
4963
  });
4773
4964
  Object.defineProperty(exports, "isConnectorChannel", {
4774
4965
  enumerable: true,
4775
- get: function () { return chunkJKUIE45B_cjs.isConnectorChannel; }
4966
+ get: function () { return chunkS42QSWJY_cjs.isConnectorChannel; }
4776
4967
  });
4777
4968
  Object.defineProperty(exports, "isPackedUserOperationTypedData", {
4778
4969
  enumerable: true,
4779
- get: function () { return chunkJKUIE45B_cjs.isPackedUserOperationTypedData; }
4970
+ get: function () { return chunkS42QSWJY_cjs.isPackedUserOperationTypedData; }
4780
4971
  });
4781
4972
  Object.defineProperty(exports, "packedUserOperationHash", {
4782
4973
  enumerable: true,
4783
- get: function () { return chunkJKUIE45B_cjs.packedUserOperationHash; }
4974
+ get: function () { return chunkS42QSWJY_cjs.packedUserOperationHash; }
4784
4975
  });
4785
4976
  Object.defineProperty(exports, "resolveConnectorChannel", {
4786
4977
  enumerable: true,
4787
- get: function () { return chunkJKUIE45B_cjs.resolveConnectorChannel; }
4978
+ get: function () { return chunkS42QSWJY_cjs.resolveConnectorChannel; }
4788
4979
  });
4789
4980
  Object.defineProperty(exports, "signerUpdateFallback", {
4790
4981
  enumerable: true,
4791
- get: function () { return chunkJKUIE45B_cjs.signerUpdateFallback; }
4982
+ get: function () { return chunkS42QSWJY_cjs.signerUpdateFallback; }
4792
4983
  });
4793
4984
  Object.defineProperty(exports, "verifySettlementChild", {
4794
4985
  enumerable: true,
4795
- get: function () { return chunkJKUIE45B_cjs.verifySettlementChild; }
4986
+ get: function () { return chunkS42QSWJY_cjs.verifySettlementChild; }
4796
4987
  });
4797
4988
  exports.AGENT_APPROVAL_RELAY_JSON_SENTENCE = AGENT_APPROVAL_RELAY_JSON_SENTENCE;
4798
4989
  exports.AGENT_APPROVAL_RELAY_PROSE_SENTENCE = AGENT_APPROVAL_RELAY_PROSE_SENTENCE;