@haven_ai/sdk 0.9.0-alpha.0 → 0.10.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/dist/{base64-BZDPJ8M1.d.ts → base64-CiR5BJhk.d.cts} +11 -3
  3. package/dist/{base64-Cyxhsvqd.d.cts → base64-CxkinHPQ.d.ts} +11 -3
  4. package/dist/{chunk-ZDKNPNI3.cjs → chunk-22FJ4JQO.cjs} +41 -35
  5. package/dist/chunk-22FJ4JQO.cjs.map +1 -0
  6. package/dist/{chunk-7UTWSJC5.cjs → chunk-6LEXYQ7J.cjs} +4 -4
  7. package/dist/{chunk-7UTWSJC5.cjs.map → chunk-6LEXYQ7J.cjs.map} +1 -1
  8. package/dist/{chunk-VRKWNJ7H.js → chunk-EWTHDEIW.js} +3 -3
  9. package/dist/{chunk-VRKWNJ7H.js.map → chunk-EWTHDEIW.js.map} +1 -1
  10. package/dist/{chunk-4Z6ATE44.cjs → chunk-H37YVYZA.cjs} +6 -4
  11. package/dist/chunk-H37YVYZA.cjs.map +1 -0
  12. package/dist/{chunk-424S4QMG.js → chunk-MLUWABVT.js} +10 -6
  13. package/dist/chunk-MLUWABVT.js.map +1 -0
  14. package/dist/{chunk-J7N4LUZZ.js → chunk-TD2PHUYP.js} +6 -4
  15. package/dist/chunk-TD2PHUYP.js.map +1 -0
  16. package/dist/edge.cjs +99 -91
  17. package/dist/edge.d.cts +4 -4
  18. package/dist/edge.d.ts +4 -4
  19. package/dist/edge.js +4 -4
  20. package/dist/index.cjs +430 -333
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +41 -9
  23. package/dist/index.d.ts +41 -9
  24. package/dist/index.js +109 -21
  25. package/dist/index.js.map +1 -1
  26. package/dist/{receipt-WkXHZGbu.d.ts → receipt-Cg9a5Seq.d.ts} +1 -1
  27. package/dist/{receipt-D4Roey3D.d.cts → receipt-q7ez8Zb2.d.cts} +1 -1
  28. package/dist/test-support.cjs +21 -21
  29. package/dist/test-support.d.cts +2 -2
  30. package/dist/test-support.d.ts +2 -2
  31. package/dist/test-support.js +2 -2
  32. package/dist/{types-CrszUJ7Z.d.cts → types-BKgqzvnk.d.cts} +31 -2
  33. package/dist/{types-CrszUJ7Z.d.ts → types-BKgqzvnk.d.ts} +31 -2
  34. package/package.json +1 -1
  35. package/dist/chunk-424S4QMG.js.map +0 -1
  36. package/dist/chunk-4Z6ATE44.cjs.map +0 -1
  37. package/dist/chunk-J7N4LUZZ.js.map +0 -1
  38. package/dist/chunk-ZDKNPNI3.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { aV as RawPaymentParties } from './types-CrszUJ7Z.js';
1
+ import { aW as RawPaymentParties } from './types-BKgqzvnk.js';
2
2
 
3
3
  /**
4
4
  * Verifiable payment receipts.
@@ -1,4 +1,4 @@
1
- import { aV as RawPaymentParties } from './types-CrszUJ7Z.cjs';
1
+ import { aW as RawPaymentParties } from './types-BKgqzvnk.cjs';
2
2
 
3
3
  /**
4
4
  * Verifiable payment receipts.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk7UTWSJC5_cjs = require('./chunk-7UTWSJC5.cjs');
4
- var chunk4Z6ATE44_cjs = require('./chunk-4Z6ATE44.cjs');
3
+ var chunk6LEXYQ7J_cjs = require('./chunk-6LEXYQ7J.cjs');
4
+ var chunkH37YVYZA_cjs = require('./chunk-H37YVYZA.cjs');
5
5
  var viem = require('viem');
6
6
  var ethers = require('ethers');
7
7
 
@@ -9,7 +9,7 @@ var ZERO_BYTES32 = `0x${"00".repeat(32)}`;
9
9
  var ROOT_AUTHORITY = `0x${"ff".repeat(32)}`;
10
10
  var DEFAULT_DELEGATOR = "0x98989898989898989898989898989898989898De";
11
11
  var DELEGATION_ARRAY_PARAM = [
12
- { type: "tuple[]", components: chunk4Z6ATE44_cjs.DELEGATION_TUPLE_COMPONENTS }
12
+ { type: "tuple[]", components: chunkH37YVYZA_cjs.DELEGATION_TUPLE_COMPONENTS }
13
13
  ];
14
14
  var EXECUTE_ABI = [
15
15
  {
@@ -85,16 +85,16 @@ function buildBoundRedeemDelegationsCallData(options) {
85
85
  10000n
86
86
  );
87
87
  return viem.encodeFunctionData({
88
- abi: chunk4Z6ATE44_cjs.REDEEM_DELEGATIONS_ABI,
88
+ abi: chunkH37YVYZA_cjs.REDEEM_DELEGATIONS_ABI,
89
89
  functionName: "redeemDelegations",
90
- args: [[permissionContext], [chunk4Z6ATE44_cjs.SINGLE_DEFAULT_MODE], [executionCallData]]
90
+ args: [[permissionContext], [chunkH37YVYZA_cjs.SINGLE_DEFAULT_MODE], [executionCallData]]
91
91
  });
92
92
  }
93
93
  function buildEmptyPermissionContextRedemption(selfCallCallData) {
94
94
  return viem.encodeFunctionData({
95
- abi: chunk4Z6ATE44_cjs.REDEEM_DELEGATIONS_ABI,
95
+ abi: chunkH37YVYZA_cjs.REDEEM_DELEGATIONS_ABI,
96
96
  functionName: "redeemDelegations",
97
- args: [[buildEmptyPermissionContext()], [chunk4Z6ATE44_cjs.SINGLE_DEFAULT_MODE], [selfCallCallData]]
97
+ args: [[buildEmptyPermissionContext()], [chunkH37YVYZA_cjs.SINGLE_DEFAULT_MODE], [selfCallCallData]]
98
98
  });
99
99
  }
100
100
  function buildExecuteCallData(target, value, innerCallData) {
@@ -106,20 +106,20 @@ function buildExecuteCallData(target, value, innerCallData) {
106
106
  }
107
107
  function buildBoundDirectUserOp(options) {
108
108
  const chainId = options.chainId ?? 84532;
109
- const sender = options.sender ?? chunk4Z6ATE44_cjs.deriveDelegateAccountAddress(options.delegate);
109
+ const sender = options.sender ?? chunkH37YVYZA_cjs.deriveDelegateAccountAddress(options.delegate);
110
110
  const callData = options.callData ?? buildExecuteCallData(
111
- options.target ?? chunk4Z6ATE44_cjs.DELEGATION_MANAGER,
111
+ options.target ?? chunkH37YVYZA_cjs.DELEGATION_MANAGER,
112
112
  options.value ?? 0n,
113
113
  buildBoundRedeemDelegationsCallData({ delegate: sender, delegator: options.delegator })
114
114
  );
115
115
  const typedData = {
116
116
  domain: {
117
- name: chunk4Z6ATE44_cjs.HYBRID_DELEGATOR_DOMAIN_NAME,
118
- version: chunk4Z6ATE44_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION,
117
+ name: chunkH37YVYZA_cjs.HYBRID_DELEGATOR_DOMAIN_NAME,
118
+ version: chunkH37YVYZA_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION,
119
119
  chainId,
120
120
  verifyingContract: sender
121
121
  },
122
- types: { PackedUserOperation: chunk4Z6ATE44_cjs.PACKED_USER_OPERATION_FIELDS.map((field) => ({ ...field })) },
122
+ types: { PackedUserOperation: chunkH37YVYZA_cjs.PACKED_USER_OPERATION_FIELDS.map((field) => ({ ...field })) },
123
123
  primaryType: "PackedUserOperation",
124
124
  message: {
125
125
  sender,
@@ -130,10 +130,10 @@ function buildBoundDirectUserOp(options) {
130
130
  preVerificationGas: "0",
131
131
  gasFees: ZERO_BYTES32,
132
132
  paymasterAndData: "0x",
133
- entryPoint: chunk4Z6ATE44_cjs.ENTRY_POINT_V07
133
+ entryPoint: chunkH37YVYZA_cjs.ENTRY_POINT_V07
134
134
  }
135
135
  };
136
- const payloadHash = chunk4Z6ATE44_cjs.packedUserOperationHash(typedData);
136
+ const payloadHash = chunkH37YVYZA_cjs.packedUserOperationHash(typedData);
137
137
  return { typedData, payloadHash, sender };
138
138
  }
139
139
  function buildSelfCallCallData(sender) {
@@ -151,7 +151,7 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
151
151
  const originalCallData = fixtureTypedData.message.callData;
152
152
  const { args: executeArgs } = viem.decodeFunctionData({ abi: EXECUTE_ABI, data: originalCallData });
153
153
  const execution = executeArgs[0];
154
- const { args: redeemArgs } = viem.decodeFunctionData({ abi: chunk4Z6ATE44_cjs.REDEEM_DELEGATIONS_ABI, data: execution.callData });
154
+ const { args: redeemArgs } = viem.decodeFunctionData({ abi: chunkH37YVYZA_cjs.REDEEM_DELEGATIONS_ABI, data: execution.callData });
155
155
  const [permissionContexts, modes, executionCallDatas] = redeemArgs;
156
156
  const [delegations] = viem.decodeAbiParameters(DELEGATION_ARRAY_PARAM, permissionContexts[0]);
157
157
  const adjustedDelegations = delegations.map(
@@ -159,7 +159,7 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
159
159
  );
160
160
  const adjustedPermissionContext = viem.encodeAbiParameters(DELEGATION_ARRAY_PARAM, [adjustedDelegations]);
161
161
  const adjustedRedeemCallData = viem.encodeFunctionData({
162
- abi: chunk4Z6ATE44_cjs.REDEEM_DELEGATIONS_ABI,
162
+ abi: chunkH37YVYZA_cjs.REDEEM_DELEGATIONS_ABI,
163
163
  functionName: "redeemDelegations",
164
164
  args: [[adjustedPermissionContext], modes, executionCallDatas]
165
165
  });
@@ -173,13 +173,13 @@ function rebuildDirectUserOpForSender(fixtureTypedData, newSender) {
173
173
  domain: { ...fixtureTypedData.domain, verifyingContract: newSender },
174
174
  message: { ...fixtureTypedData.message, sender: newSender, callData: adjustedCallData }
175
175
  };
176
- const payloadHash = chunk4Z6ATE44_cjs.packedUserOperationHash(typedData);
176
+ const payloadHash = chunkH37YVYZA_cjs.packedUserOperationHash(typedData);
177
177
  return { typedData, payloadHash };
178
178
  }
179
179
  function buildFundingLegUserOp(options) {
180
- const sender = chunk4Z6ATE44_cjs.deriveDelegateAccountAddress(options.delegate);
180
+ const sender = chunkH37YVYZA_cjs.deriveDelegateAccountAddress(options.delegate);
181
181
  const callData = buildExecuteCallData(
182
- chunk4Z6ATE44_cjs.DELEGATION_MANAGER,
182
+ chunkH37YVYZA_cjs.DELEGATION_MANAGER,
183
183
  0n,
184
184
  buildBoundRedeemDelegationsCallData({
185
185
  delegate: sender,
@@ -212,7 +212,7 @@ function delegationDigest(signHash, chainId) {
212
212
  viem.keccak256(viem.toBytes("DelegationManager")),
213
213
  viem.keccak256(viem.toBytes("1")),
214
214
  BigInt(chainId),
215
- chunk4Z6ATE44_cjs.DELEGATION_MANAGER
215
+ chunkH37YVYZA_cjs.DELEGATION_MANAGER
216
216
  ]
217
217
  )
218
218
  );
@@ -224,7 +224,7 @@ function signedErc7710Receipt(options = {}) {
224
224
  const delegate = new ethers.Wallet(options.delegateKey ?? RECEIPT_DELEGATE_KEY);
225
225
  const signature = delegate.signingKey.sign(delegationDigest(signHash, chainId)).serialized;
226
226
  return {
227
- version: chunk7UTWSJC5_cjs.RECEIPT_VERSION,
227
+ version: chunk6LEXYQ7J_cjs.RECEIPT_VERSION,
228
228
  paymentId: options.paymentId ?? "pay_3723",
229
229
  payment: {
230
230
  token: "USDC",
@@ -1,6 +1,6 @@
1
1
  import { Address, Hex } from 'viem';
2
- import { P as PaymentReceipt } from './receipt-D4Roey3D.cjs';
3
- import './types-CrszUJ7Z.cjs';
2
+ import { P as PaymentReceipt } from './receipt-q7ez8Zb2.cjs';
3
+ import './types-BKgqzvnk.cjs';
4
4
 
5
5
  /**
6
6
  * #3272 — a real-shaped, BOUND direct-payment `PackedUserOperation` for
@@ -1,6 +1,6 @@
1
1
  import { Address, Hex } from 'viem';
2
- import { P as PaymentReceipt } from './receipt-WkXHZGbu.js';
3
- import './types-CrszUJ7Z.js';
2
+ import { P as PaymentReceipt } from './receipt-Cg9a5Seq.js';
3
+ import './types-BKgqzvnk.js';
4
4
 
5
5
  /**
6
6
  * #3272 — a real-shaped, BOUND direct-payment `PackedUserOperation` for
@@ -1,5 +1,5 @@
1
- import { RECEIPT_VERSION } from './chunk-VRKWNJ7H.js';
2
- import { DELEGATION_TUPLE_COMPONENTS, SINGLE_DEFAULT_MODE, REDEEM_DELEGATIONS_ABI, deriveDelegateAccountAddress, DELEGATION_MANAGER, PACKED_USER_OPERATION_FIELDS, packedUserOperationHash, ENTRY_POINT_V07, HYBRID_DELEGATOR_DOMAIN_VERSION, HYBRID_DELEGATOR_DOMAIN_NAME } from './chunk-J7N4LUZZ.js';
1
+ import { RECEIPT_VERSION } from './chunk-EWTHDEIW.js';
2
+ import { DELEGATION_TUPLE_COMPONENTS, SINGLE_DEFAULT_MODE, REDEEM_DELEGATIONS_ABI, deriveDelegateAccountAddress, DELEGATION_MANAGER, PACKED_USER_OPERATION_FIELDS, packedUserOperationHash, ENTRY_POINT_V07, HYBRID_DELEGATOR_DOMAIN_VERSION, HYBRID_DELEGATOR_DOMAIN_NAME } from './chunk-TD2PHUYP.js';
3
3
  import { keccak256, toBytes, encodeAbiParameters, encodePacked, encodeFunctionData, decodeFunctionData, decodeAbiParameters, hashTypedData, concatHex } from 'viem';
4
4
  import { Wallet } from 'ethers';
5
5
 
@@ -715,6 +715,23 @@ interface HavenAgent {
715
715
  * mechanism a caller should read/derive from.
716
716
  */
717
717
  executionRail: 'legacy' | 'delegation';
718
+ /**
719
+ * #3772: non-null when a later `connect --replace` on this machine retired
720
+ * this agent's directory and installed a replacement — the session reading
721
+ * this is still running as the OLD agent. Warning only: nothing is paused or
722
+ * revoked, and the old agent keeps any budget it still holds until the user
723
+ * removes it. Null when not superseded, and on an older backend that sends nothing.
724
+ */
725
+ supersededBy: HavenAgentSupersession | null;
726
+ }
727
+ /** #3772: the "this agent was replaced" notice carried by agent reads. */
728
+ interface HavenAgentSupersession {
729
+ replacementAgentId: string;
730
+ supersededAt: string;
731
+ warning: string;
732
+ nextAction: typeof AgentPaymentNextAction.StopAndTellUser;
733
+ /** Why no Haven tool follows: the next step is the user's. */
734
+ nextToolOmittedReason: string;
718
735
  }
719
736
  interface HavenAllowance {
720
737
  id: string;
@@ -789,6 +806,8 @@ interface HavenAllowanceSummary {
789
806
  delegateAddress: string;
790
807
  chainId: number;
791
808
  allowances: HavenAllowance[];
809
+ /** #3772: see {@link HavenAgent.supersededBy}. */
810
+ supersededBy: HavenAgentSupersession | null;
792
811
  }
793
812
  /**
794
813
  * Post-purchase allowance/budget summary attached to a settled x402 payment
@@ -1667,7 +1686,9 @@ declare const AgentPaymentFailureCode: {
1667
1686
  * challenge — e.g. its settlement wallet is out of gas. No 402 was ever
1668
1687
  * issued and no payment was created; this is honest and (per
1669
1688
  * `retry_after_s`, when present) usually transient, unlike a permanent
1670
- * endpoint miss.
1689
+ * endpoint miss — except out of gas (`reason_code:
1690
+ * settlement_wallet_out_of_gas`), which needs the merchant's operator to
1691
+ * top up its settlement wallet first (#3834).
1671
1692
  */
1672
1693
  readonly MerchantNotReady: "MERCHANT_NOT_READY";
1673
1694
  };
@@ -2017,6 +2038,14 @@ interface HavenCatalogEntry {
2017
2038
  priceAtomic: string | null;
2018
2039
  asset: string | null;
2019
2040
  network: string | null;
2041
+ /**
2042
+ * #3839: the x402 `assetTransferMethods` the merchant advertised on its last
2043
+ * probe, comma-separated as the catalog stores them (`"eip3009"`,
2044
+ * `"eip3009,erc7710"`); null until the first successful x402 probe and for
2045
+ * ingestion/MPP rows. OPTIONAL on purpose: absent against a backend that does
2046
+ * not send it. Feed it to `catalogFundingLegExpected` for the funding-leg hint.
2047
+ */
2048
+ assetTransferMethods?: string | null;
2020
2049
  status: 'active' | 'degraded' | 'delisted';
2021
2050
  verifiedAt: string | null;
2022
2051
  /**
@@ -2296,4 +2325,4 @@ declare class HavenTimeoutError extends HavenError {
2296
2325
  constructor(paymentId: string);
2297
2326
  }
2298
2327
 
2299
- export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type PaymentNextAction as aA, type PaymentPhase as aB, type PaymentStatus as aC, SIGNER_UPDATE_FALLBACK as aD, SignerRefusalCode as aE, type SweepConfirmation as aF, type SweepEntry as aG, X402AlreadySettledError as aH, X402Erc7710AlreadySettledError as aI, type X402ExpectedAuth as aJ, type X402ExpectedContext as aK, type X402PaymentOption as aL, type X402RequestSnapshot as aM, X402TaskBudgetMismatchError as aN, X402UnexpectedStatusError as aO, assertPublicHttpsMerchantUrl as aP, isPublicHttpsMerchantUrl as aQ, publicHttpsMerchantUrlRefusal as aR, readBodyCapped as aS, signerUpdateFallback as aT, strictMerchantEgressPolicy as aU, type RawPaymentParties as aV, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, HOSTED_DISCOVERY_TIMEOUT_MS as ab, HOSTED_EGRESS_TIMEOUTS as ac, HOSTED_MAX_GET_REDIRECTS as ad, HOSTED_RESPONSE_BYTE_CAPS as ae, type HavenAgentAllowanceSummary as af, type HavenAgentReadiness as ag, type HavenAllowance as ah, HavenApiError as ai, type HavenCatalogMerchant as aj, type HavenListScope as ak, HavenPaymentStateError as al, HavenSigningError as am, HavenTimeoutError as an, HavenUnsupportedSignerVersionError as ao, HavenZeroSettlementHashError as ap, MERCHANT_EGRESS_REFUSED_CODE as aq, MERCHANT_EGRESS_RESPONSE_CAP_CODE as ar, type MachinePaymentRail as as, type MerchantEgressRefusalReason as at, MerchantEgressRefusedError as au, MerchantEgressResponseCapError as av, type MerchantEgressTimeouts as aw, type MerchantEgressUse as ax, MerchantTimeoutError as ay, type PaymentFee as az, type PaymentIntent as b, type X402AuthorizationOptions as c, type X402Intent as d, type PaymentStatusResult as e, type HavenAgent as f, type HavenAgentSummary as g, type HavenAllowanceSummary as h, type HavenBalanceCoverage as i, type PostPurchaseAllowanceSummary as j, type HavenCatalogEntry as k, type HavenCatalogSubmission as l, type HavenPaymentReceipt as m, type HavenPaymentReceiptsPage as n, type HavenTaskBudget as o, type SubmitTaskBudgetResult as p, type SubmitSubBudgetResult as q, type HavenPendingSubBudgetSignature as r, type CloseSubBudgetResult as s, type PaymentResumeState as t, type X402Receipt as u, type X402Quote as v, type X402Erc7710Settlement as w, type X402McpCallContext as x, type SignData as y, type ResumeX402PaymentInput as z };
2328
+ export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type PaymentFee as aA, type PaymentNextAction as aB, type PaymentPhase as aC, type PaymentStatus as aD, SIGNER_UPDATE_FALLBACK as aE, SignerRefusalCode as aF, type SweepConfirmation as aG, type SweepEntry as aH, X402AlreadySettledError as aI, X402Erc7710AlreadySettledError as aJ, type X402ExpectedAuth as aK, type X402ExpectedContext as aL, type X402PaymentOption as aM, type X402RequestSnapshot as aN, X402TaskBudgetMismatchError as aO, X402UnexpectedStatusError as aP, assertPublicHttpsMerchantUrl as aQ, isPublicHttpsMerchantUrl as aR, publicHttpsMerchantUrlRefusal as aS, readBodyCapped as aT, signerUpdateFallback as aU, strictMerchantEgressPolicy as aV, type RawPaymentParties as aW, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, HOSTED_DISCOVERY_TIMEOUT_MS as ab, HOSTED_EGRESS_TIMEOUTS as ac, HOSTED_MAX_GET_REDIRECTS as ad, HOSTED_RESPONSE_BYTE_CAPS as ae, type HavenAgentAllowanceSummary as af, type HavenAgentReadiness as ag, type HavenAgentSupersession as ah, type HavenAllowance as ai, HavenApiError as aj, type HavenCatalogMerchant as ak, type HavenListScope as al, HavenPaymentStateError as am, HavenSigningError as an, HavenTimeoutError as ao, HavenUnsupportedSignerVersionError as ap, HavenZeroSettlementHashError as aq, MERCHANT_EGRESS_REFUSED_CODE as ar, MERCHANT_EGRESS_RESPONSE_CAP_CODE as as, type MachinePaymentRail as at, type MerchantEgressRefusalReason as au, MerchantEgressRefusedError as av, MerchantEgressResponseCapError as aw, type MerchantEgressTimeouts as ax, type MerchantEgressUse as ay, MerchantTimeoutError as az, type PaymentIntent as b, type X402AuthorizationOptions as c, type X402Intent as d, type PaymentStatusResult as e, type HavenAgent as f, type HavenAgentSummary as g, type HavenAllowanceSummary as h, type HavenBalanceCoverage as i, type PostPurchaseAllowanceSummary as j, type HavenCatalogEntry as k, type HavenCatalogSubmission as l, type HavenPaymentReceipt as m, type HavenPaymentReceiptsPage as n, type HavenTaskBudget as o, type SubmitTaskBudgetResult as p, type SubmitSubBudgetResult as q, type HavenPendingSubBudgetSignature as r, type CloseSubBudgetResult as s, type PaymentResumeState as t, type X402Receipt as u, type X402Quote as v, type X402Erc7710Settlement as w, type X402McpCallContext as x, type SignData as y, type ResumeX402PaymentInput as z };
@@ -715,6 +715,23 @@ interface HavenAgent {
715
715
  * mechanism a caller should read/derive from.
716
716
  */
717
717
  executionRail: 'legacy' | 'delegation';
718
+ /**
719
+ * #3772: non-null when a later `connect --replace` on this machine retired
720
+ * this agent's directory and installed a replacement — the session reading
721
+ * this is still running as the OLD agent. Warning only: nothing is paused or
722
+ * revoked, and the old agent keeps any budget it still holds until the user
723
+ * removes it. Null when not superseded, and on an older backend that sends nothing.
724
+ */
725
+ supersededBy: HavenAgentSupersession | null;
726
+ }
727
+ /** #3772: the "this agent was replaced" notice carried by agent reads. */
728
+ interface HavenAgentSupersession {
729
+ replacementAgentId: string;
730
+ supersededAt: string;
731
+ warning: string;
732
+ nextAction: typeof AgentPaymentNextAction.StopAndTellUser;
733
+ /** Why no Haven tool follows: the next step is the user's. */
734
+ nextToolOmittedReason: string;
718
735
  }
719
736
  interface HavenAllowance {
720
737
  id: string;
@@ -789,6 +806,8 @@ interface HavenAllowanceSummary {
789
806
  delegateAddress: string;
790
807
  chainId: number;
791
808
  allowances: HavenAllowance[];
809
+ /** #3772: see {@link HavenAgent.supersededBy}. */
810
+ supersededBy: HavenAgentSupersession | null;
792
811
  }
793
812
  /**
794
813
  * Post-purchase allowance/budget summary attached to a settled x402 payment
@@ -1667,7 +1686,9 @@ declare const AgentPaymentFailureCode: {
1667
1686
  * challenge — e.g. its settlement wallet is out of gas. No 402 was ever
1668
1687
  * issued and no payment was created; this is honest and (per
1669
1688
  * `retry_after_s`, when present) usually transient, unlike a permanent
1670
- * endpoint miss.
1689
+ * endpoint miss — except out of gas (`reason_code:
1690
+ * settlement_wallet_out_of_gas`), which needs the merchant's operator to
1691
+ * top up its settlement wallet first (#3834).
1671
1692
  */
1672
1693
  readonly MerchantNotReady: "MERCHANT_NOT_READY";
1673
1694
  };
@@ -2017,6 +2038,14 @@ interface HavenCatalogEntry {
2017
2038
  priceAtomic: string | null;
2018
2039
  asset: string | null;
2019
2040
  network: string | null;
2041
+ /**
2042
+ * #3839: the x402 `assetTransferMethods` the merchant advertised on its last
2043
+ * probe, comma-separated as the catalog stores them (`"eip3009"`,
2044
+ * `"eip3009,erc7710"`); null until the first successful x402 probe and for
2045
+ * ingestion/MPP rows. OPTIONAL on purpose: absent against a backend that does
2046
+ * not send it. Feed it to `catalogFundingLegExpected` for the funding-leg hint.
2047
+ */
2048
+ assetTransferMethods?: string | null;
2020
2049
  status: 'active' | 'degraded' | 'delisted';
2021
2050
  verifiedAt: string | null;
2022
2051
  /**
@@ -2296,4 +2325,4 @@ declare class HavenTimeoutError extends HavenError {
2296
2325
  constructor(paymentId: string);
2297
2326
  }
2298
2327
 
2299
- export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type PaymentNextAction as aA, type PaymentPhase as aB, type PaymentStatus as aC, SIGNER_UPDATE_FALLBACK as aD, SignerRefusalCode as aE, type SweepConfirmation as aF, type SweepEntry as aG, X402AlreadySettledError as aH, X402Erc7710AlreadySettledError as aI, type X402ExpectedAuth as aJ, type X402ExpectedContext as aK, type X402PaymentOption as aL, type X402RequestSnapshot as aM, X402TaskBudgetMismatchError as aN, X402UnexpectedStatusError as aO, assertPublicHttpsMerchantUrl as aP, isPublicHttpsMerchantUrl as aQ, publicHttpsMerchantUrlRefusal as aR, readBodyCapped as aS, signerUpdateFallback as aT, strictMerchantEgressPolicy as aU, type RawPaymentParties as aV, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, HOSTED_DISCOVERY_TIMEOUT_MS as ab, HOSTED_EGRESS_TIMEOUTS as ac, HOSTED_MAX_GET_REDIRECTS as ad, HOSTED_RESPONSE_BYTE_CAPS as ae, type HavenAgentAllowanceSummary as af, type HavenAgentReadiness as ag, type HavenAllowance as ah, HavenApiError as ai, type HavenCatalogMerchant as aj, type HavenListScope as ak, HavenPaymentStateError as al, HavenSigningError as am, HavenTimeoutError as an, HavenUnsupportedSignerVersionError as ao, HavenZeroSettlementHashError as ap, MERCHANT_EGRESS_REFUSED_CODE as aq, MERCHANT_EGRESS_RESPONSE_CAP_CODE as ar, type MachinePaymentRail as as, type MerchantEgressRefusalReason as at, MerchantEgressRefusedError as au, MerchantEgressResponseCapError as av, type MerchantEgressTimeouts as aw, type MerchantEgressUse as ax, MerchantTimeoutError as ay, type PaymentFee as az, type PaymentIntent as b, type X402AuthorizationOptions as c, type X402Intent as d, type PaymentStatusResult as e, type HavenAgent as f, type HavenAgentSummary as g, type HavenAllowanceSummary as h, type HavenBalanceCoverage as i, type PostPurchaseAllowanceSummary as j, type HavenCatalogEntry as k, type HavenCatalogSubmission as l, type HavenPaymentReceipt as m, type HavenPaymentReceiptsPage as n, type HavenTaskBudget as o, type SubmitTaskBudgetResult as p, type SubmitSubBudgetResult as q, type HavenPendingSubBudgetSignature as r, type CloseSubBudgetResult as s, type PaymentResumeState as t, type X402Receipt as u, type X402Quote as v, type X402Erc7710Settlement as w, type X402McpCallContext as x, type SignData as y, type ResumeX402PaymentInput as z };
2328
+ export { AgentPaymentNextActionSchema as $, type AgentPaymentWarning as A, type BudgetPrecheckResult as B, type CloseTaskBudgetResult as C, type X402ResumeState as D, type X402McpTransport as E, type X402MerchantCallContext as F, type X402IntentByKey as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, type MerchantEgressPolicy as M, AGENT_PAYMENT_RAIL_VALUES as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentNextStep as Q, type ResumeAuthorizedX402Input as R, type SweepResult as S, type TaskBudgetSignContext as T, type AgentPaymentEnumSchema as U, AgentPaymentFailureCode as V, AgentPaymentFailureCodeDescriptions as W, type X402PaymentRequired as X, AgentPaymentFailureCodeSchema as Y, AgentPaymentNextAction as Z, AgentPaymentNextActionDescriptions as _, type PaymentResult as a, AgentPaymentPhase as a0, AgentPaymentPhaseDescriptions as a1, AgentPaymentPhaseSchema as a2, AgentPaymentRail as a3, AgentPaymentRailDescriptions as a4, AgentPaymentRailSchema as a5, type AgentPaymentSummary as a6, AgentPaymentWarningCode as a7, type AgentPurchaseSummary as a8, type CatalogSubmissionAccepted as a9, type PaymentFee as aA, type PaymentNextAction as aB, type PaymentPhase as aC, type PaymentStatus as aD, SIGNER_UPDATE_FALLBACK as aE, SignerRefusalCode as aF, type SweepConfirmation as aG, type SweepEntry as aH, X402AlreadySettledError as aI, X402Erc7710AlreadySettledError as aJ, type X402ExpectedAuth as aK, type X402ExpectedContext as aL, type X402PaymentOption as aM, type X402RequestSnapshot as aN, X402TaskBudgetMismatchError as aO, X402UnexpectedStatusError as aP, assertPublicHttpsMerchantUrl as aQ, isPublicHttpsMerchantUrl as aR, publicHttpsMerchantUrlRefusal as aS, readBodyCapped as aT, signerUpdateFallback as aU, strictMerchantEgressPolicy as aV, type RawPaymentParties as aW, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, HOSTED_DISCOVERY_TIMEOUT_MS as ab, HOSTED_EGRESS_TIMEOUTS as ac, HOSTED_MAX_GET_REDIRECTS as ad, HOSTED_RESPONSE_BYTE_CAPS as ae, type HavenAgentAllowanceSummary as af, type HavenAgentReadiness as ag, type HavenAgentSupersession as ah, type HavenAllowance as ai, HavenApiError as aj, type HavenCatalogMerchant as ak, type HavenListScope as al, HavenPaymentStateError as am, HavenSigningError as an, HavenTimeoutError as ao, HavenUnsupportedSignerVersionError as ap, HavenZeroSettlementHashError as aq, MERCHANT_EGRESS_REFUSED_CODE as ar, MERCHANT_EGRESS_RESPONSE_CAP_CODE as as, type MachinePaymentRail as at, type MerchantEgressRefusalReason as au, MerchantEgressRefusedError as av, MerchantEgressResponseCapError as aw, type MerchantEgressTimeouts as ax, type MerchantEgressUse as ay, MerchantTimeoutError as az, type PaymentIntent as b, type X402AuthorizationOptions as c, type X402Intent as d, type PaymentStatusResult as e, type HavenAgent as f, type HavenAgentSummary as g, type HavenAllowanceSummary as h, type HavenBalanceCoverage as i, type PostPurchaseAllowanceSummary as j, type HavenCatalogEntry as k, type HavenCatalogSubmission as l, type HavenPaymentReceipt as m, type HavenPaymentReceiptsPage as n, type HavenTaskBudget as o, type SubmitTaskBudgetResult as p, type SubmitSubBudgetResult as q, type HavenPendingSubBudgetSignature as r, type CloseSubBudgetResult as s, type PaymentResumeState as t, type X402Receipt as u, type X402Quote as v, type X402Erc7710Settlement as w, type X402McpCallContext as x, type SignData as y, type ResumeX402PaymentInput as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven_ai/sdk",
3
- "version": "0.9.0-alpha.0",
3
+ "version": "0.10.0-alpha.0",
4
4
  "description": "TypeScript SDK for Haven — give AI agents budgeted, non-custodial payment ability. Pay x402 (HTTP 402) APIs in USDC within on-chain-enforced spending limits; the agent never holds funds or keys.",
5
5
  "engines": {
6
6
  "node": ">=22"