@haven_ai/sdk 0.0.0-dev.202609291158.c1438b6 → 0.0.0-dev.202609291238.5cdfbfe

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/README.md CHANGED
@@ -655,7 +655,8 @@ treat them as proof of purchase rather than retrying:
655
655
  path) and carries `err.receipt`.
656
656
  - `X402Erc7710AlreadySettledError` extends `HavenError`, **not**
657
657
  `HavenApiError` (no status; code `PAYMENT_ALREADY_SETTLED`; erc7710
658
- `prepareX402Erc7710()`), and carries `err.paymentId` and `err.txHash`. An
658
+ `prepareX402Erc7710()`, and since #3423 `submitX402Erc7710()` on a repeated
659
+ settle), and carries `err.paymentId` and `err.txHash`. An
659
660
  `instanceof HavenApiError` branch does not catch it.
660
661
 
661
662
  See [Idempotency](#idempotency-what-the-key-guarantees-and-what-it-costs).
@@ -2033,7 +2033,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
2033
2033
  * This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
2034
2034
  * it with the package version on every release — never hand-edit it.
2035
2035
  */
2036
- declare const SDK_VERSION = "0.0.0-dev.202609291158.c1438b6";
2036
+ declare const SDK_VERSION = "0.0.0-dev.202609291238.5cdfbfe";
2037
2037
  /** The request header every published Haven client sends. */
2038
2038
  declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
2039
2039
  /** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
@@ -2033,7 +2033,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
2033
2033
  * This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
2034
2034
  * it with the package version on every release — never hand-edit it.
2035
2035
  */
2036
- declare const SDK_VERSION = "0.0.0-dev.202609291158.c1438b6";
2036
+ declare const SDK_VERSION = "0.0.0-dev.202609291238.5cdfbfe";
2037
2037
  /** The request header every published Haven client sends. */
2038
2038
  declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
2039
2039
  /** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkOQAGKO3Y_cjs = require('./chunk-OQAGKO3Y.cjs');
3
+ var chunkHMVJTEKQ_cjs = require('./chunk-HMVJTEKQ.cjs');
4
4
  var viem = require('viem');
5
5
  var crypto = require('crypto');
6
6
 
7
7
  var TYPED_DATA_NOT_ALLOWED = "TYPED_DATA_NOT_ALLOWED";
8
- var HavenTypedDataRefusedError = class extends chunkOQAGKO3Y_cjs.HavenSigningError {
8
+ var HavenTypedDataRefusedError = class extends chunkHMVJTEKQ_cjs.HavenSigningError {
9
9
  constructor(message) {
10
10
  super(message);
11
11
  this.code = TYPED_DATA_NOT_ALLOWED;
@@ -46,7 +46,7 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
46
46
  `This signer only signs direct payments on chains the delegation rail has pinned contracts for (${[...DIRECT_PAYMENT_CHAIN_IDS].join(", ")}); this typed data names chain ${String(domain.chainId)}. Refusing.`
47
47
  );
48
48
  }
49
- const ownAccount = chunkOQAGKO3Y_cjs.deriveDelegateAccountAddress(delegateAddress);
49
+ const ownAccount = chunkHMVJTEKQ_cjs.deriveDelegateAccountAddress(delegateAddress);
50
50
  const sender = typeof message.sender === "string" ? message.sender : "";
51
51
  if (sender.toLowerCase() !== ownAccount.toLowerCase()) {
52
52
  throw new HavenTypedDataRefusedError(
@@ -76,9 +76,9 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
76
76
  "This UserOperation's execute() call does not re-encode to the exact callData bytes (trailing or non-canonical bytes). Refusing."
77
77
  );
78
78
  }
79
- if (decoded.target.toLowerCase() !== chunkOQAGKO3Y_cjs.DELEGATION_MANAGER.toLowerCase()) {
79
+ if (decoded.target.toLowerCase() !== chunkHMVJTEKQ_cjs.DELEGATION_MANAGER.toLowerCase()) {
80
80
  throw new HavenTypedDataRefusedError(
81
- `This UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkOQAGKO3Y_cjs.DELEGATION_MANAGER}). A direct payment only ever redeems the agent's own budget delegation \u2014 refusing what looks like a self-call (e.g. transferOwnership, updateSigners, upgradeToAndCall) or a call to an unrelated contract.`
81
+ `This UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkHMVJTEKQ_cjs.DELEGATION_MANAGER}). A direct payment only ever redeems the agent's own budget delegation \u2014 refusing what looks like a self-call (e.g. transferOwnership, updateSigners, upgradeToAndCall) or a call to an unrelated contract.`
82
82
  );
83
83
  }
84
84
  if (decoded.value !== 0n) {
@@ -87,20 +87,20 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
87
87
  );
88
88
  }
89
89
  try {
90
- chunkOQAGKO3Y_cjs.assertRedeemsOwnBudgetDelegation(decoded.callData, ownAccount);
90
+ chunkHMVJTEKQ_cjs.assertRedeemsOwnBudgetDelegation(decoded.callData, ownAccount);
91
91
  } catch (err) {
92
92
  throw new HavenTypedDataRefusedError(err instanceof Error ? err.message : String(err));
93
93
  }
94
94
  }
95
95
  function assertOwnSettlementChild(typedData, expectation, delegateAddress) {
96
96
  try {
97
- chunkOQAGKO3Y_cjs.verifySettlementChild(typedData, {
97
+ chunkHMVJTEKQ_cjs.verifySettlementChild(typedData, {
98
98
  ...expectation,
99
- delegatorAccount: chunkOQAGKO3Y_cjs.deriveDelegateAccountAddress(delegateAddress)
99
+ delegatorAccount: chunkHMVJTEKQ_cjs.deriveDelegateAccountAddress(delegateAddress)
100
100
  });
101
101
  } catch (err) {
102
102
  if (err instanceof HavenTypedDataRefusedError) throw err;
103
- if (err instanceof chunkOQAGKO3Y_cjs.HavenSigningError) throw new HavenTypedDataRefusedError(err.message);
103
+ if (err instanceof chunkHMVJTEKQ_cjs.HavenSigningError) throw new HavenTypedDataRefusedError(err.message);
104
104
  throw new HavenTypedDataRefusedError(
105
105
  `Refusing to sign the x402 settlement child: it is malformed (${err instanceof Error ? err.message : String(err)}).`
106
106
  );
@@ -129,7 +129,7 @@ function assertFundingLegPaysDelegate(typedData, expected) {
129
129
  try {
130
130
  const { args: executeArgs } = viem.decodeFunctionData({ abi: EXECUTE_ABI, data: message.callData });
131
131
  const inner = executeArgs[0].callData;
132
- const { args } = viem.decodeFunctionData({ abi: chunkOQAGKO3Y_cjs.REDEEM_DELEGATIONS_ABI, data: inner });
132
+ const { args } = viem.decodeFunctionData({ abi: chunkHMVJTEKQ_cjs.REDEEM_DELEGATIONS_ABI, data: inner });
133
133
  const executions = args[2];
134
134
  executionCallData = executions[0];
135
135
  } catch {
@@ -248,7 +248,7 @@ var TRANSFER_WITH_AUTHORIZATION_TYPES = {
248
248
  function sweepUsdcAddress(chainId) {
249
249
  const address = USDC_ADDRESS_BY_CHAIN[chainId];
250
250
  if (!address) {
251
- throw new chunkOQAGKO3Y_cjs.HavenSigningError(
251
+ throw new chunkHMVJTEKQ_cjs.HavenSigningError(
252
252
  `Sweep is not supported on chain ${chainId}. Supported: ${SWEEPABLE_CHAIN_IDS.join(", ")}.`
253
253
  );
254
254
  }
@@ -257,7 +257,7 @@ function sweepUsdcAddress(chainId) {
257
257
  function sweepUsdcDomain(chainId) {
258
258
  const domain = USDC_EIP712_DOMAIN_BY_CHAIN[chainId];
259
259
  if (!domain) {
260
- throw new chunkOQAGKO3Y_cjs.HavenSigningError(
260
+ throw new chunkHMVJTEKQ_cjs.HavenSigningError(
261
261
  `Sweep is not supported on chain ${chainId}. Supported: ${SWEEPABLE_CHAIN_IDS.join(", ")}.`
262
262
  );
263
263
  }
@@ -270,12 +270,12 @@ function buildSweepTypedData(auth) {
270
270
  const domain = sweepUsdcDomain(auth.chainId);
271
271
  const expectedToken = sweepUsdcAddress(auth.chainId);
272
272
  if (!sameAddress(auth.token, expectedToken)) {
273
- throw new chunkOQAGKO3Y_cjs.HavenSigningError(
273
+ throw new chunkHMVJTEKQ_cjs.HavenSigningError(
274
274
  `Sweep token ${auth.token} is not the canonical USDC contract for chain ${auth.chainId}.`
275
275
  );
276
276
  }
277
277
  if (!/^0x[0-9a-fA-F]{64}$/.test(auth.nonce)) {
278
- throw new chunkOQAGKO3Y_cjs.HavenSigningError("Sweep nonce must be a 0x-prefixed 32-byte hex string.");
278
+ throw new chunkHMVJTEKQ_cjs.HavenSigningError("Sweep nonce must be a 0x-prefixed 32-byte hex string.");
279
279
  }
280
280
  return {
281
281
  domain,
@@ -785,7 +785,7 @@ function stableStringify2(value) {
785
785
  }
786
786
 
787
787
  // src/client-identity.ts
788
- var SDK_VERSION = "0.0.0-dev.202609291158.c1438b6";
788
+ var SDK_VERSION = "0.0.0-dev.202609291238.5cdfbfe";
789
789
  var HAVEN_CLIENT_HEADER = "X-Haven-Client";
790
790
  function havenClientIdentity(pkg, version) {
791
791
  return `${pkg}/${version}`;
@@ -952,10 +952,10 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
952
952
  if (td?.primaryType !== "Delegation") {
953
953
  refuseTaskChild("it is not a Delegation payload", `primaryType was '${String(td?.primaryType)}'.`);
954
954
  }
955
- if (!same(td.domain?.verifyingContract, chunkOQAGKO3Y_cjs.DELEGATION_MANAGER)) {
955
+ if (!same(td.domain?.verifyingContract, chunkHMVJTEKQ_cjs.DELEGATION_MANAGER)) {
956
956
  refuseTaskChild(
957
957
  "the EIP-712 domain names an unknown DelegationManager",
958
- `Expected ${chunkOQAGKO3Y_cjs.DELEGATION_MANAGER}, got ${td.domain?.verifyingContract}.`
958
+ `Expected ${chunkHMVJTEKQ_cjs.DELEGATION_MANAGER}, got ${td.domain?.verifyingContract}.`
959
959
  );
960
960
  }
961
961
  if (td.domain?.name !== DELEGATION_DOMAIN_NAME || td.domain?.version !== DELEGATION_DOMAIN_VERSION) {
@@ -983,7 +983,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
983
983
  `Expected chain ${expected.chainId}; the child says ${td.domain?.chainId}.`
984
984
  );
985
985
  }
986
- const ownAccount = chunkOQAGKO3Y_cjs.deriveDelegateAccountAddress(delegateAddress);
986
+ const ownAccount = chunkHMVJTEKQ_cjs.deriveDelegateAccountAddress(delegateAddress);
987
987
  const delegator = td.message?.delegator;
988
988
  if (typeof delegator !== "string" || !same(delegator, ownAccount)) {
989
989
  refuseTaskChild(
@@ -1002,7 +1002,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
1002
1002
  if (typeof authority !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(authority)) {
1003
1003
  refuseTaskChild("its authority is not a 32-byte delegation hash", `Got ${String(authority)}.`);
1004
1004
  }
1005
- if (authority.toLowerCase() === chunkOQAGKO3Y_cjs.ROOT_AUTHORITY) {
1005
+ if (authority.toLowerCase() === chunkHMVJTEKQ_cjs.ROOT_AUTHORITY) {
1006
1006
  refuseTaskChild(
1007
1007
  "it is a ROOT delegation, not a re-delegation of the agent budget",
1008
1008
  "A task budget always chains under the agent budget delegation."
@@ -1015,7 +1015,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
1015
1015
  );
1016
1016
  }
1017
1017
  const caveats = td.message?.caveats ?? [];
1018
- const transfer = findCaveat(caveats, chunkOQAGKO3Y_cjs.CAVEAT_ENFORCERS.erc20TransferAmount);
1018
+ const transfer = findCaveat(caveats, chunkHMVJTEKQ_cjs.CAVEAT_ENFORCERS.erc20TransferAmount);
1019
1019
  if (!transfer) {
1020
1020
  refuseTaskChild(
1021
1021
  "it has no ERC-20 transfer-amount caveat",
@@ -1033,7 +1033,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
1033
1033
  `Expected ${expected.maxAmountAtomic}; the child allows ${amount.toString()}.`
1034
1034
  );
1035
1035
  }
1036
- const timestamp = findCaveat(caveats, chunkOQAGKO3Y_cjs.CAVEAT_ENFORCERS.timestamp);
1036
+ const timestamp = findCaveat(caveats, chunkHMVJTEKQ_cjs.CAVEAT_ENFORCERS.timestamp);
1037
1037
  if (!timestamp) {
1038
1038
  refuseTaskChild("it never expires", "A task-budget child without a timestamp caveat is open-ended.");
1039
1039
  }
@@ -1054,7 +1054,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
1054
1054
  `Expected ${expected.expiresAt}; the child says ${beforeThreshold}.`
1055
1055
  );
1056
1056
  }
1057
- const calldata = findCaveat(caveats, chunkOQAGKO3Y_cjs.CAVEAT_ENFORCERS.allowedCalldata);
1057
+ const calldata = findCaveat(caveats, chunkHMVJTEKQ_cjs.CAVEAT_ENFORCERS.allowedCalldata);
1058
1058
  if (expected.recipientAddress) {
1059
1059
  if (!calldata) {
1060
1060
  refuseTaskChild(
@@ -1091,7 +1091,7 @@ var DISABLE_DELEGATION_ABI = [
1091
1091
  {
1092
1092
  type: "function",
1093
1093
  name: "disableDelegation",
1094
- inputs: [{ name: "delegation", type: "tuple", components: chunkOQAGKO3Y_cjs.DELEGATION_TUPLE_COMPONENTS }],
1094
+ inputs: [{ name: "delegation", type: "tuple", components: chunkHMVJTEKQ_cjs.DELEGATION_TUPLE_COMPONENTS }],
1095
1095
  outputs: [],
1096
1096
  stateMutability: "nonpayable"
1097
1097
  }
@@ -1110,7 +1110,7 @@ function assertOwnTaskBudgetCloseUserOp(typedData, expected, delegateAddress) {
1110
1110
  `This signer only signs a task-budget close on chains the delegation rail has pinned contracts for (${[...DIRECT_PAYMENT_CHAIN_IDS].join(", ")}); this typed data names chain ${String(domain.chainId)}. Refusing.`
1111
1111
  );
1112
1112
  }
1113
- const ownAccount = chunkOQAGKO3Y_cjs.deriveDelegateAccountAddress(delegateAddress);
1113
+ const ownAccount = chunkHMVJTEKQ_cjs.deriveDelegateAccountAddress(delegateAddress);
1114
1114
  const sender = typeof message.sender === "string" ? message.sender : "";
1115
1115
  if (sender.toLowerCase() !== ownAccount.toLowerCase()) {
1116
1116
  throw new HavenTypedDataRefusedError(
@@ -1133,9 +1133,9 @@ function assertOwnTaskBudgetCloseUserOp(typedData, expected, delegateAddress) {
1133
1133
  "This close UserOperation's execute() call does not re-encode to the exact callData bytes (trailing or non-canonical bytes). Refusing."
1134
1134
  );
1135
1135
  }
1136
- if (decoded.target.toLowerCase() !== chunkOQAGKO3Y_cjs.DELEGATION_MANAGER.toLowerCase()) {
1136
+ if (decoded.target.toLowerCase() !== chunkHMVJTEKQ_cjs.DELEGATION_MANAGER.toLowerCase()) {
1137
1137
  throw new HavenTypedDataRefusedError(
1138
- `This close UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkOQAGKO3Y_cjs.DELEGATION_MANAGER}). Refusing what looks like a self-call or a call to an unrelated contract.`
1138
+ `This close UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkHMVJTEKQ_cjs.DELEGATION_MANAGER}). Refusing what looks like a self-call or a call to an unrelated contract.`
1139
1139
  );
1140
1140
  }
1141
1141
  if (decoded.value !== 0n) {
@@ -1172,7 +1172,7 @@ function assertOwnTaskBudgetCloseUserOp(typedData, expected, delegateAddress) {
1172
1172
  `This close UserOperation disables a delegation granted to ${delegation.delegate}, not this signer's own account (${ownAccount}) \u2014 a task-budget child is always self-delegated. Refusing.`
1173
1173
  );
1174
1174
  }
1175
- if (delegation.authority.toLowerCase() === chunkOQAGKO3Y_cjs.ROOT_AUTHORITY) {
1175
+ if (delegation.authority.toLowerCase() === chunkHMVJTEKQ_cjs.ROOT_AUTHORITY) {
1176
1176
  throw new HavenTypedDataRefusedError(
1177
1177
  "This close UserOperation disables a ROOT delegation, not a re-delegation of the agent budget. A task-budget child always chains under the agent budget delegation. Refusing."
1178
1178
  );
@@ -1289,5 +1289,5 @@ exports.x402FacilitatorAddresses = x402FacilitatorAddresses;
1289
1289
  exports.x402PaymentHeaderNamesFor = x402PaymentHeaderNamesFor;
1290
1290
  exports.x402PaymentHeaderNamesSent = x402PaymentHeaderNamesSent;
1291
1291
  exports.x402V2PaymentEnvelope = x402V2PaymentEnvelope;
1292
- //# sourceMappingURL=chunk-TJKQPWGS.cjs.map
1293
- //# sourceMappingURL=chunk-TJKQPWGS.cjs.map
1292
+ //# sourceMappingURL=chunk-3W7NKKZK.cjs.map
1293
+ //# sourceMappingURL=chunk-3W7NKKZK.cjs.map