@vapi-network/core 0.15.1 → 0.16.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 (77) hide show
  1. package/README.md +6 -2
  2. package/dist/agent-link.js +73 -7
  3. package/dist/agent-link.js.map +1 -1
  4. package/dist/atomic-file.d.ts +1 -0
  5. package/dist/atomic-file.d.ts.map +1 -1
  6. package/dist/backup.js +6 -4
  7. package/dist/backup.js.map +1 -1
  8. package/dist/cloud-backup.js +79 -11
  9. package/dist/cloud-backup.js.map +2 -2
  10. package/dist/index.js +126 -16
  11. package/dist/index.js.map +2 -2
  12. package/dist/net-guard.d.ts +17 -0
  13. package/dist/net-guard.d.ts.map +1 -1
  14. package/dist/router-client.js +110 -16
  15. package/dist/router-client.js.map +2 -2
  16. package/dist/secrets.js +19 -8
  17. package/dist/secrets.js.map +1 -1
  18. package/dist/support-report.d.ts +1 -1
  19. package/dist/tasks/actions.d.ts +1 -0
  20. package/dist/tasks/actions.d.ts.map +1 -1
  21. package/dist/tasks/ballots.d.ts +43 -0
  22. package/dist/tasks/ballots.d.ts.map +1 -0
  23. package/dist/tasks/chain-port.d.ts +26 -0
  24. package/dist/tasks/chain-port.d.ts.map +1 -1
  25. package/dist/tasks/chain.d.ts +5 -0
  26. package/dist/tasks/chain.d.ts.map +1 -1
  27. package/dist/tasks/client.d.ts +33 -3
  28. package/dist/tasks/client.d.ts.map +1 -1
  29. package/dist/tasks/funding-attempts.d.ts +58 -0
  30. package/dist/tasks/funding-attempts.d.ts.map +1 -0
  31. package/dist/tasks/funding-intent.d.ts +11 -0
  32. package/dist/tasks/funding-intent.d.ts.map +1 -0
  33. package/dist/tasks/index.d.ts +13 -2
  34. package/dist/tasks/index.d.ts.map +1 -1
  35. package/dist/tasks/money.d.ts +2 -0
  36. package/dist/tasks/money.d.ts.map +1 -1
  37. package/dist/tasks/operation-support.d.ts +10 -2
  38. package/dist/tasks/operation-support.d.ts.map +1 -1
  39. package/dist/tasks/operations.d.ts +651 -13
  40. package/dist/tasks/operations.d.ts.map +1 -1
  41. package/dist/tasks/pending-transactions.d.ts +11 -0
  42. package/dist/tasks/pending-transactions.d.ts.map +1 -1
  43. package/dist/tasks/post-options.d.ts +144 -0
  44. package/dist/tasks/post-options.d.ts.map +1 -0
  45. package/dist/tasks/types.d.ts +5505 -74
  46. package/dist/tasks/types.d.ts.map +1 -1
  47. package/dist/tasks/v2-abi.d.ts +12 -0
  48. package/dist/tasks/v2-abi.d.ts.map +1 -0
  49. package/dist/tasks/v2-abi.generated.d.ts +5966 -0
  50. package/dist/tasks/v2-abi.generated.d.ts.map +1 -0
  51. package/dist/tasks/v2-events.d.ts +6460 -0
  52. package/dist/tasks/v2-events.d.ts.map +1 -0
  53. package/dist/tasks/v2-execution.d.ts +1070 -0
  54. package/dist/tasks/v2-execution.d.ts.map +1 -0
  55. package/dist/tasks/v2-jury.d.ts +863 -0
  56. package/dist/tasks/v2-jury.d.ts.map +1 -0
  57. package/dist/tasks/v2-plan-guard.d.ts +100 -0
  58. package/dist/tasks/v2-plan-guard.d.ts.map +1 -0
  59. package/dist/tasks/v2-public.d.ts +154 -0
  60. package/dist/tasks/v2-public.d.ts.map +1 -0
  61. package/dist/tasks/v2-trust.d.ts +27 -0
  62. package/dist/tasks/v2-trust.d.ts.map +1 -0
  63. package/dist/tasks/v2-write.d.ts +886 -0
  64. package/dist/tasks/v2-write.d.ts.map +1 -0
  65. package/dist/tasks/v2.d.ts +847 -0
  66. package/dist/tasks/v2.d.ts.map +1 -0
  67. package/dist/tasks/verbs.d.ts +1 -1
  68. package/dist/tasks/verbs.d.ts.map +1 -1
  69. package/dist/tasks/x402-funding.d.ts +49 -0
  70. package/dist/tasks/x402-funding.d.ts.map +1 -0
  71. package/dist/tasks.js +17541 -4184
  72. package/dist/tasks.js.map +3 -3
  73. package/dist/x402-pay.d.ts +11 -1
  74. package/dist/x402-pay.d.ts.map +1 -1
  75. package/dist/x402.d.ts +6 -0
  76. package/dist/x402.d.ts.map +1 -1
  77. package/package.json +1 -1
package/dist/secrets.js CHANGED
@@ -46650,12 +46650,12 @@ async function removeStaleLock(path) {
46650
46650
  const pid = lockOwnerPid(owner);
46651
46651
  if (pid !== void 0 && processIsAlive(pid)) return;
46652
46652
  await atomicFileTestHooks?.beforeStaleLockBreak?.(path);
46653
- await removeOwnedLock(path, [owner]);
46653
+ await removeOwnedLock(path, [owner], true);
46654
46654
  } catch (error61) {
46655
46655
  if (!hasCode(error61, "ENOENT")) throw error61;
46656
46656
  }
46657
46657
  }
46658
- async function removeOwnedLock(path, owners) {
46658
+ async function removeOwnedLock(path, owners, staleDeadOwner = false) {
46659
46659
  const tombPath = `${path}.stale.${randomBytes2(16).toString("hex")}`;
46660
46660
  try {
46661
46661
  await rename(path, tombPath);
@@ -46664,7 +46664,7 @@ async function removeOwnedLock(path, owners) {
46664
46664
  await removeOwnedTombs(path, owners);
46665
46665
  const currentOwner = await readFile(path, "utf8").catch(() => void 0);
46666
46666
  if (currentOwner !== void 0 && owners.includes(currentOwner)) {
46667
- await removeOwnedLock(path, owners);
46667
+ await removeOwnedLock(path, owners, staleDeadOwner);
46668
46668
  }
46669
46669
  return;
46670
46670
  }
@@ -46673,6 +46673,7 @@ async function removeOwnedLock(path, owners) {
46673
46673
  let pendingError;
46674
46674
  let renamedOwner;
46675
46675
  try {
46676
+ await atomicFileTestHooks?.afterLockRename?.(tombPath);
46676
46677
  renamedOwner = await readFile(tombPath, "utf8");
46677
46678
  if (!owners.includes(renamedOwner) && !lockOwnerReleased(renamedOwner)) {
46678
46679
  await atomicFileTestHooks?.afterMismatchedLockRename?.(path);
@@ -46681,6 +46682,7 @@ async function removeOwnedLock(path, owners) {
46681
46682
  await atomicFileTestHooks?.afterMismatchedLockRestore?.(path);
46682
46683
  }
46683
46684
  } catch (error61) {
46685
+ if (hasCode(error61, "ENOENT")) return;
46684
46686
  pendingError = error61;
46685
46687
  }
46686
46688
  try {
@@ -46689,7 +46691,7 @@ async function removeOwnedLock(path, owners) {
46689
46691
  } catch (error61) {
46690
46692
  if (!tombUnlinkTolerated(
46691
46693
  error61,
46692
- renamedOwner !== void 0 && lockOwnerReleased(renamedOwner) && owners.includes(renamedOwner)
46694
+ renamedOwner !== void 0 && (lockOwnerReleased(renamedOwner) || staleDeadOwner) && owners.includes(renamedOwner)
46693
46695
  ) && pendingError === void 0) {
46694
46696
  pendingError = error61;
46695
46697
  }
@@ -46870,7 +46872,7 @@ async function assertPublicUrl(url2, options) {
46870
46872
  options.timeoutMs ?? 5e3
46871
46873
  );
46872
46874
  } catch {
46873
- throw guardError(url2);
46875
+ throw guardError(url2, "unresolved");
46874
46876
  }
46875
46877
  if (addresses.length === 0 || addresses.some(isNonPublicAddress)) {
46876
46878
  throw guardError(url2);
@@ -47025,9 +47027,18 @@ function isNonPublicIpv6(hextets) {
47025
47027
  const isDocumentation = first === 8193 && hextets[1] === 3512;
47026
47028
  return isUnspecified || isLoopback || isUniqueLocal || isLinkLocal || isSiteLocal || isMulticast || isDocumentation;
47027
47029
  }
47028
- function guardError(url2) {
47029
- return new Error(
47030
- `URL hostname ${JSON.stringify(url2.hostname)} is not allowed; private or internal destinations require allowPrivateNetwork true in the vAPI config.`
47030
+ var NetworkGuardError = class extends Error {
47031
+ constructor(message, reason) {
47032
+ super(message);
47033
+ this.reason = reason;
47034
+ this.name = "NetworkGuardError";
47035
+ }
47036
+ reason;
47037
+ };
47038
+ function guardError(url2, reason = "blocked") {
47039
+ return new NetworkGuardError(
47040
+ `URL hostname ${JSON.stringify(url2.hostname)} is not allowed; private or internal destinations require allowPrivateNetwork true in the vAPI config.`,
47041
+ reason
47031
47042
  );
47032
47043
  }
47033
47044