@vapi-network/cli 0.9.4 → 0.9.6

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.js CHANGED
@@ -9441,13 +9441,13 @@ var init_getCallError = __esm({
9441
9441
 
9442
9442
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withResolvers.js
9443
9443
  function withResolvers() {
9444
- let resolve2 = () => void 0;
9444
+ let resolve3 = () => void 0;
9445
9445
  let reject = () => void 0;
9446
9446
  const promise2 = new Promise((resolve_, reject_) => {
9447
- resolve2 = resolve_;
9447
+ resolve3 = resolve_;
9448
9448
  reject = reject_;
9449
9449
  });
9450
- return { promise: promise2, resolve: resolve2, reject };
9450
+ return { promise: promise2, resolve: resolve3, reject };
9451
9451
  }
9452
9452
  var init_withResolvers = __esm({
9453
9453
  "../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withResolvers.js"() {
@@ -9466,8 +9466,8 @@ function createBatchScheduler({ fn, id: id2, shouldSplitBatch, wait: wait2 = 0,
9466
9466
  if (sort && Array.isArray(data))
9467
9467
  data.sort(sort);
9468
9468
  for (let i = 0; i < scheduler.length; i++) {
9469
- const { resolve: resolve2 } = scheduler[i];
9470
- resolve2?.([data[i], data]);
9469
+ const { resolve: resolve3 } = scheduler[i];
9470
+ resolve3?.([data[i], data]);
9471
9471
  }
9472
9472
  }).catch((err) => {
9473
9473
  for (let i = 0; i < scheduler.length; i++) {
@@ -9483,16 +9483,16 @@ function createBatchScheduler({ fn, id: id2, shouldSplitBatch, wait: wait2 = 0,
9483
9483
  return {
9484
9484
  flush,
9485
9485
  async schedule(args) {
9486
- const { promise: promise2, resolve: resolve2, reject } = withResolvers();
9486
+ const { promise: promise2, resolve: resolve3, reject } = withResolvers();
9487
9487
  const split2 = shouldSplitBatch?.([...getBatchedArgs(), args]);
9488
9488
  if (split2)
9489
9489
  exec();
9490
9490
  const hasActiveScheduler = getScheduler().length > 0;
9491
9491
  if (hasActiveScheduler) {
9492
- setScheduler({ args, resolve: resolve2, reject });
9492
+ setScheduler({ args, resolve: resolve3, reject });
9493
9493
  return promise2;
9494
9494
  }
9495
- setScheduler({ args, resolve: resolve2, reject });
9495
+ setScheduler({ args, resolve: resolve3, reject });
9496
9496
  setTimeout(exec, wait2);
9497
9497
  return promise2;
9498
9498
  }
@@ -30774,7 +30774,7 @@ function observe(observerId, callbacks, fn) {
30774
30774
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/wait.js
30775
30775
  init_utils3();
30776
30776
  async function wait(time3, { signal } = {}) {
30777
- return new Promise((resolve2, reject) => {
30777
+ return new Promise((resolve3, reject) => {
30778
30778
  if (signal?.aborted) {
30779
30779
  reject(getAbortError(signal));
30780
30780
  return;
@@ -30782,7 +30782,7 @@ async function wait(time3, { signal } = {}) {
30782
30782
  const cleanup = () => signal?.removeEventListener("abort", onAbort);
30783
30783
  const timeout = setTimeout(() => {
30784
30784
  cleanup();
30785
- resolve2();
30785
+ resolve3();
30786
30786
  }, time3);
30787
30787
  const onAbort = () => {
30788
30788
  clearTimeout(timeout);
@@ -31358,7 +31358,7 @@ init_withResolvers();
31358
31358
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withRetry.js
31359
31359
  init_utils3();
31360
31360
  function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shouldRetry2 = () => true, signal } = {}) {
31361
- return new Promise((resolve2, reject) => {
31361
+ return new Promise((resolve3, reject) => {
31362
31362
  const attemptRetry = async ({ count = 0 } = {}) => {
31363
31363
  if (signal?.aborted) {
31364
31364
  reject(getAbortError(signal));
@@ -31378,7 +31378,7 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
31378
31378
  };
31379
31379
  try {
31380
31380
  const data = await fn();
31381
- resolve2(data);
31381
+ resolve3(data);
31382
31382
  } catch (err) {
31383
31383
  if (signal?.aborted) {
31384
31384
  reject(getAbortError(signal));
@@ -31529,7 +31529,7 @@ async function sendCalls(client, parameters) {
31529
31529
  results.push({ reason, status: "rejected" });
31530
31530
  }
31531
31531
  if (experimental_fallbackDelay > 0)
31532
- await new Promise((resolve2) => setTimeout(resolve2, experimental_fallbackDelay));
31532
+ await new Promise((resolve3) => setTimeout(resolve3, experimental_fallbackDelay));
31533
31533
  }
31534
31534
  if (results.every((r) => r.status === "rejected"))
31535
31535
  throw results[0].reason;
@@ -31632,9 +31632,9 @@ async function waitForCallsStatus(client, parameters) {
31632
31632
  throwOnFailure = false
31633
31633
  } = parameters;
31634
31634
  const observerId = stringify(["waitForCallsStatus", client.uid, id2]);
31635
- const { promise: promise2, resolve: resolve2, reject } = withResolvers();
31635
+ const { promise: promise2, resolve: resolve3, reject } = withResolvers();
31636
31636
  let timer;
31637
- const unobserve = observe(observerId, { resolve: resolve2, reject }, (emit) => {
31637
+ const unobserve = observe(observerId, { resolve: resolve3, reject }, (emit) => {
31638
31638
  const unpoll = poll(async () => {
31639
31639
  const done = (fn) => {
31640
31640
  clearTimeout(timer);
@@ -32016,13 +32016,13 @@ async function isImageUri(uri) {
32016
32016
  }
32017
32017
  if (!Object.hasOwn(globalThis, "Image"))
32018
32018
  return false;
32019
- return new Promise((resolve2) => {
32019
+ return new Promise((resolve3) => {
32020
32020
  const img = new Image();
32021
32021
  img.onload = () => {
32022
- resolve2(true);
32022
+ resolve3(true);
32023
32023
  };
32024
32024
  img.onerror = () => {
32025
- resolve2(false);
32025
+ resolve3(false);
32026
32026
  };
32027
32027
  img.src = uri;
32028
32028
  });
@@ -33485,7 +33485,7 @@ init_utils3();
33485
33485
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withTimeout.js
33486
33486
  init_utils3();
33487
33487
  function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, signal }) {
33488
- return new Promise((resolve2, reject) => {
33488
+ return new Promise((resolve3, reject) => {
33489
33489
  ;
33490
33490
  (async () => {
33491
33491
  let timeoutId;
@@ -33500,7 +33500,7 @@ function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, sign
33500
33500
  }
33501
33501
  }, timeout);
33502
33502
  }
33503
- resolve2(await fn({ signal: controller?.signal || null }));
33503
+ resolve3(await fn({ signal: controller?.signal || null }));
33504
33504
  } catch (err) {
33505
33505
  if (controller?.signal.aborted && isAbortError(err)) {
33506
33506
  reject(errorInstance);
@@ -37480,13 +37480,13 @@ async function waitForTransactionReceipt(client, parameters) {
37480
37480
  let retrying = false;
37481
37481
  let _unobserve;
37482
37482
  let _unwatch;
37483
- const { promise: promise2, resolve: resolve2, reject } = withResolvers();
37483
+ const { promise: promise2, resolve: resolve3, reject } = withResolvers();
37484
37484
  const timer = timeout ? setTimeout(() => {
37485
37485
  _unwatch?.();
37486
37486
  _unobserve?.();
37487
37487
  reject(new WaitForTransactionReceiptTimeoutError({ hash: hash5 }));
37488
37488
  }, timeout) : void 0;
37489
- _unobserve = observe(observerId, { onReplaced, resolve: resolve2, reject }, async (emit) => {
37489
+ _unobserve = observe(observerId, { onReplaced, resolve: resolve3, reject }, async (emit) => {
37490
37490
  receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash5 }).catch(() => void 0);
37491
37491
  if (receipt && confirmations <= 1) {
37492
37492
  clearTimeout(timer);
@@ -43445,7 +43445,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
43445
43445
  coalescedRequest.numConsumers++;
43446
43446
  if (signal) {
43447
43447
  const responsePromise = coalescedRequest.responsePromise;
43448
- return await new Promise((resolve2, reject) => {
43448
+ return await new Promise((resolve3, reject) => {
43449
43449
  const handleAbort = (e22) => {
43450
43450
  signal.removeEventListener("abort", handleAbort);
43451
43451
  coalescedRequest.numConsumers -= 1;
@@ -43458,7 +43458,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
43458
43458
  reject(e22.target.reason);
43459
43459
  };
43460
43460
  signal.addEventListener("abort", handleAbort);
43461
- responsePromise.then(resolve2).catch(reject).finally(() => {
43461
+ responsePromise.then(resolve3).catch(reject).finally(() => {
43462
43462
  signal.removeEventListener("abort", handleAbort);
43463
43463
  });
43464
43464
  });
@@ -44841,7 +44841,7 @@ function createPublicFetch(options) {
44841
44841
  });
44842
44842
  const normalized = new Request(input2, init);
44843
44843
  const bytes = normalized.body ? Buffer.from(await normalized.arrayBuffer()) : null;
44844
- return await new Promise((resolve2, reject) => {
44844
+ return await new Promise((resolve3, reject) => {
44845
44845
  const requestOptions2 = {
44846
44846
  method: normalized.method,
44847
44847
  headers: Object.fromEntries(normalized.headers),
@@ -44866,7 +44866,7 @@ function createPublicFetch(options) {
44866
44866
  { status, statusText: incoming.statusMessage, headers }
44867
44867
  );
44868
44868
  Object.defineProperty(response, "url", { value: url2.toString() });
44869
- resolve2(response);
44869
+ resolve3(response);
44870
44870
  } catch (error61) {
44871
44871
  incoming.destroy();
44872
44872
  reject(error61);
@@ -45635,8 +45635,8 @@ var svmFetchQueue = Promise.resolve();
45635
45635
  async function withGuardedSvmFetch(fetchImpl, operation) {
45636
45636
  const previous = svmFetchQueue;
45637
45637
  let release2;
45638
- svmFetchQueue = new Promise((resolve2) => {
45639
- release2 = resolve2;
45638
+ svmFetchQueue = new Promise((resolve3) => {
45639
+ release2 = resolve3;
45640
45640
  });
45641
45641
  await previous;
45642
45642
  const originalFetch = globalThis.fetch;
@@ -46849,7 +46849,7 @@ async function withFileLock(lockPath, fn, options = {}) {
46849
46849
  if (Date.now() >= deadline) {
46850
46850
  throw new FileLockedError(options.lockedMessage);
46851
46851
  }
46852
- await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MS));
46852
+ await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
46853
46853
  continue;
46854
46854
  }
46855
46855
  handle = candidate;
@@ -46864,7 +46864,7 @@ async function withFileLock(lockPath, fn, options = {}) {
46864
46864
  if (Date.now() >= deadline) {
46865
46865
  throw new FileLockedError(options.lockedMessage);
46866
46866
  }
46867
- await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MS));
46867
+ await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
46868
46868
  }
46869
46869
  }
46870
46870
  const ownedHandle = handle;
@@ -46985,7 +46985,7 @@ async function restoreRenamedLock(path, tombPath) {
46985
46985
  } catch (error61) {
46986
46986
  if (hasCode(error61, "ENOENT")) return;
46987
46987
  if (!hasCode(error61, "EEXIST")) throw error61;
46988
- await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MS));
46988
+ await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
46989
46989
  }
46990
46990
  }
46991
46991
  }
@@ -47984,7 +47984,7 @@ async function withAgentCredentialLock(wallets, clientId, operation) {
47984
47984
  if (Date.now() >= deadline) {
47985
47985
  throw httpError("Timed out waiting to update the agent credentials.");
47986
47986
  }
47987
- await new Promise((resolve2) => setTimeout(resolve2, 20));
47987
+ await new Promise((resolve3) => setTimeout(resolve3, 20));
47988
47988
  }
47989
47989
  }
47990
47990
  try {
@@ -48137,7 +48137,7 @@ function splitScopes(scope) {
48137
48137
  return scope.split(/\s+/u).filter(Boolean);
48138
48138
  }
48139
48139
  async function sleepFor(milliseconds) {
48140
- await new Promise((resolve2) => setTimeout(resolve2, milliseconds));
48140
+ await new Promise((resolve3) => setTimeout(resolve3, milliseconds));
48141
48141
  }
48142
48142
 
48143
48143
  // ../core/src/keystore.ts
@@ -69615,7 +69615,7 @@ function decryptWithKey(key2, sealed) {
69615
69615
  return Buffer.concat([decipher.update(sealed.ciphertext), decipher.final()]);
69616
69616
  }
69617
69617
  async function deriveScryptKey(passphrase, salt) {
69618
- return await new Promise((resolve2, reject) => {
69618
+ return await new Promise((resolve3, reject) => {
69619
69619
  scrypt(
69620
69620
  passphrase,
69621
69621
  salt,
@@ -69631,7 +69631,7 @@ async function deriveScryptKey(passphrase, salt) {
69631
69631
  reject(error61);
69632
69632
  return;
69633
69633
  }
69634
- resolve2(derivedKey);
69634
+ resolve3(derivedKey);
69635
69635
  }
69636
69636
  );
69637
69637
  });
@@ -69955,7 +69955,7 @@ async function promptForSecret(prompt, noTerminalHint) {
69955
69955
  stdin.setRawMode(true);
69956
69956
  stdin.resume();
69957
69957
  stdin.setEncoding("utf8");
69958
- return await new Promise((resolve2, reject) => {
69958
+ return await new Promise((resolve3, reject) => {
69959
69959
  let value = "";
69960
69960
  const cleanup = () => {
69961
69961
  stdin.off("data", onData);
@@ -69972,7 +69972,7 @@ async function promptForSecret(prompt, noTerminalHint) {
69972
69972
  }
69973
69973
  if (character === "\r" || character === "\n") {
69974
69974
  cleanup();
69975
- resolve2(value);
69975
+ resolve3(value);
69976
69976
  return;
69977
69977
  }
69978
69978
  if (character === "\x7F" || character === "\b") {
@@ -70034,7 +70034,7 @@ async function withAccountMovementLock(home, account, timeoutMs, operation, sign
70034
70034
  if (!(error61 instanceof Error && "code" in error61 && error61.code === "EEXIST")) throw error61;
70035
70035
  await removeStaleLock2(path);
70036
70036
  if (Date.now() >= deadline) throw new AccountMovementLockedError(account);
70037
- await new Promise((resolve2) => setTimeout(resolve2, 20));
70037
+ await new Promise((resolve3) => setTimeout(resolve3, 20));
70038
70038
  }
70039
70039
  }
70040
70040
  const ownedHandle = handle;
@@ -70505,14 +70505,14 @@ function requireSuccess(result, what) {
70505
70505
  function withoutTrailingNewline(value) {
70506
70506
  return value.replace(/\r?\n$/u, "");
70507
70507
  }
70508
- var spawnRunner = async (file2, args, input2) => await new Promise((resolve2) => {
70508
+ var spawnRunner = async (file2, args, input2) => await new Promise((resolve3) => {
70509
70509
  let stdout = "";
70510
70510
  let stderr2 = "";
70511
70511
  let settled = false;
70512
70512
  const finish = (outcome) => {
70513
70513
  if (settled) return;
70514
70514
  settled = true;
70515
- resolve2(outcome);
70515
+ resolve3(outcome);
70516
70516
  };
70517
70517
  const child = spawn(file2, [...args], {
70518
70518
  detached: true,
@@ -71475,7 +71475,7 @@ async function withVaultLock(path, operation) {
71475
71475
  if (Date.now() >= deadline) {
71476
71476
  throw new VaultError("corrupt", "Timed out waiting for the vault lock.");
71477
71477
  }
71478
- await new Promise((resolve2) => setTimeout(resolve2, 20));
71478
+ await new Promise((resolve3) => setTimeout(resolve3, 20));
71479
71479
  }
71480
71480
  }
71481
71481
  try {
@@ -72064,6 +72064,22 @@ var WalletStore = class _WalletStore {
72064
72064
  this.registry = await this.readRegistry();
72065
72065
  return this.snapshot();
72066
72066
  }
72067
+ /**
72068
+ * Re-reads `wallets.json` for a long-running process such as the MCP server.
72069
+ * Unlike `reload`, it never zeroes the cached vault key, because a payment in
72070
+ * flight may still be signing with it. When accounts were added elsewhere the
72071
+ * cached vault is forgotten, so the next unlock reads the vault file again.
72072
+ */
72073
+ async refreshRegistry() {
72074
+ const registry2 = await this.readRegistry();
72075
+ const known = new Set(this.names());
72076
+ if (Object.keys(registry2.wallets).some((name) => !known.has(name))) {
72077
+ this.cachedVault = void 0;
72078
+ this.vaultKey = void 0;
72079
+ }
72080
+ this.registry = registry2;
72081
+ return this.snapshot();
72082
+ }
72067
72083
  /**
72068
72084
  * Picks the wallet a command acts on: an explicit name first, then
72069
72085
  * `VAPI_WALLET`, then the registry default.
@@ -73208,7 +73224,7 @@ async function withRegistryLock(path, operation) {
73208
73224
  if (Date.now() >= deadline) {
73209
73225
  throw new KeystoreError("Timed out waiting for the wallet registry lock.");
73210
73226
  }
73211
- await new Promise((resolve2) => setTimeout(resolve2, 20));
73227
+ await new Promise((resolve3) => setTimeout(resolve3, 20));
73212
73228
  }
73213
73229
  }
73214
73230
  try {
@@ -73554,11 +73570,11 @@ function publicErrorMessage(error61, fallback, sensitiveValues = []) {
73554
73570
  return error61 instanceof Error ? message : fallback;
73555
73571
  }
73556
73572
  async function unrefSleep(milliseconds, signal) {
73557
- await new Promise((resolve2) => {
73573
+ await new Promise((resolve3) => {
73558
73574
  const finish = () => {
73559
73575
  clearTimeout(timer);
73560
73576
  signal?.removeEventListener("abort", finish);
73561
- resolve2();
73577
+ resolve3();
73562
73578
  };
73563
73579
  const timer = setTimeout(finish, milliseconds);
73564
73580
  timer.unref();
@@ -74095,7 +74111,7 @@ async function withLedgerLock(path, operation) {
74095
74111
  if (Date.now() >= deadline) {
74096
74112
  throw new Error("Timed out waiting for the spend ledger lock.");
74097
74113
  }
74098
- await new Promise((resolve2) => setTimeout(resolve2, 20));
74114
+ await new Promise((resolve3) => setTimeout(resolve3, 20));
74099
74115
  }
74100
74116
  }
74101
74117
  try {
@@ -74729,7 +74745,7 @@ async function withTransferLock(context, nonce, operation) {
74729
74745
  if (Date.now() >= deadline) {
74730
74746
  throw new Error("Timed out waiting for the transfer lock.");
74731
74747
  }
74732
- await new Promise((resolve2) => setTimeout(resolve2, 20));
74748
+ await new Promise((resolve3) => setTimeout(resolve3, 20));
74733
74749
  }
74734
74750
  }
74735
74751
  try {
@@ -76447,8 +76463,8 @@ async function sweepAllAboveCeiling(args) {
76447
76463
  }
76448
76464
  var pendingCeilingSweeps = /* @__PURE__ */ new Set();
76449
76465
  function scheduleCeilingSweep(hook) {
76450
- const task = new Promise((resolve2) => {
76451
- setTimeout(resolve2, 0);
76466
+ const task = new Promise((resolve3) => {
76467
+ setTimeout(resolve3, 0);
76452
76468
  }).then(async () => {
76453
76469
  const timeoutMs = hook.timeoutMs ?? CEILING_SWEEP_TIMEOUT_MS;
76454
76470
  const controller = new AbortController();
@@ -76488,8 +76504,8 @@ async function drainCeilingSweeps(timeoutMs = CEILING_SWEEP_TIMEOUT_MS) {
76488
76504
  try {
76489
76505
  await Promise.race([
76490
76506
  Promise.allSettled(pending),
76491
- new Promise((resolve2) => {
76492
- timeout = setTimeout(resolve2, timeoutMs);
76507
+ new Promise((resolve3) => {
76508
+ timeout = setTimeout(resolve3, timeoutMs);
76493
76509
  })
76494
76510
  ]);
76495
76511
  } finally {
@@ -77588,7 +77604,7 @@ function createRunBudget(args) {
77588
77604
  import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
77589
77605
  import { arch, platform, release } from "node:os";
77590
77606
  import { join as join13 } from "node:path";
77591
- var VAPI_CLIENT_VERSION = "0.9.4";
77607
+ var VAPI_CLIENT_VERSION = "0.9.6";
77592
77608
  async function createSupportReport(options) {
77593
77609
  const message = options.message.trim();
77594
77610
  if (!message) throw new Error("Support report message must not be empty.");
@@ -81294,7 +81310,7 @@ var authorizationTypes = {
81294
81310
  function createTasksChain(options) {
81295
81311
  const { account, client, pending, rpcFor } = options;
81296
81312
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
81297
- const sleep = options.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
81313
+ const sleep = options.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
81298
81314
  const randomBytes17 = options.randomBytes ?? cryptoRandomBytes2;
81299
81315
  const confirmations = options.confirmations ?? 2;
81300
81316
  if (!Number.isSafeInteger(confirmations) || confirmations < 1)
@@ -82099,7 +82115,7 @@ async function waitForMilestone(client, input2) {
82099
82115
  throw new RangeError("The milestone wait timeout must be non-negative and finite.");
82100
82116
  if (!Number.isFinite(intervalMs) || intervalMs <= 0)
82101
82117
  throw new RangeError("The milestone wait interval must be positive and finite.");
82102
- const sleep = input2.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
82118
+ const sleep = input2.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
82103
82119
  const now = input2.now ?? (() => /* @__PURE__ */ new Date());
82104
82120
  const started = now().getTime();
82105
82121
  const deadline = started + timeoutMs;
@@ -86701,10 +86717,10 @@ async function buildStatus(deps) {
86701
86717
  const timers = deps.timers ?? { setTimeout, clearTimeout };
86702
86718
  const controller = new AbortController();
86703
86719
  let timeout;
86704
- const deadline = new Promise((resolve2) => {
86720
+ const deadline = new Promise((resolve3) => {
86705
86721
  timeout = timers.setTimeout(() => {
86706
86722
  controller.abort(new Error("Status request deadline exceeded."));
86707
- resolve2();
86723
+ resolve3();
86708
86724
  }, deps.timeoutMs ?? STATUS_TIMEOUT_MS);
86709
86725
  });
86710
86726
  try {
@@ -92154,7 +92170,7 @@ function createAuthTools(options) {
92154
92170
  async link(input2) {
92155
92171
  requireSafeSecretStore(options.secrets);
92156
92172
  requireWalletStore2(options.wallets);
92157
- const wallet = options.session.resolve(input2.account).name;
92173
+ const wallet = (await options.session.resolveLatest(input2.account)).name;
92158
92174
  const existing = pending.get(wallet);
92159
92175
  if (existing !== void 0) return linkResult(wallet, existing);
92160
92176
  let startup = starting.get(wallet);
@@ -92344,6 +92360,7 @@ function createRouterTools(options) {
92344
92360
  return toolResult({ models: models.map((model) => model.id) });
92345
92361
  },
92346
92362
  async usage(input2) {
92363
+ await options.session.resolveLatest(input2.wallet);
92347
92364
  const deps = routerDeps(options, input2.wallet);
92348
92365
  const [usage, stake] = await Promise.all([readUsage(deps), readStake(deps)]);
92349
92366
  return toolResult({
@@ -92357,6 +92374,7 @@ function createRouterTools(options) {
92357
92374
  },
92358
92375
  async chat(input2) {
92359
92376
  const parsed = routerChatInputSchema.parse(input2);
92377
+ await options.session.resolveLatest(parsed.wallet);
92360
92378
  const result = await chat(routerDeps(options, parsed.wallet, unlockedWallet), {
92361
92379
  model: parsed.model,
92362
92380
  messages: parsed.messages,
@@ -93487,9 +93505,23 @@ var WalletSession = class {
93487
93505
  }
93488
93506
  return { name: only };
93489
93507
  }
93508
+ /**
93509
+ * `resolve`, after re-reading `wallets.json` when the name is not known yet.
93510
+ * An account created in a terminal while this server runs works at once; the
93511
+ * session's active account and the human's default stay as they were.
93512
+ */
93513
+ async resolveLatest(name) {
93514
+ const store = this.options.store;
93515
+ const requested = name?.trim();
93516
+ const selection = requested && requested.length > 0 ? requested : this.#active;
93517
+ if (store && selection !== void 0 && !store.has(assertWalletName(selection))) {
93518
+ await store.refreshRegistry();
93519
+ }
93520
+ return this.resolve(name);
93521
+ }
93490
93522
  /** The addresses of an account, read from the vault or a legacy keystore header. */
93491
93523
  async addressesFor(name) {
93492
- const wallet = this.resolve(name);
93524
+ const wallet = await this.resolveLatest(name);
93493
93525
  const store = this.options.store;
93494
93526
  if (!store) {
93495
93527
  const account = this.options.account;
@@ -93517,7 +93549,7 @@ var WalletSession = class {
93517
93549
  * so switching accounts mid-session pays from the account that was asked for.
93518
93550
  */
93519
93551
  async payment(name) {
93520
- const wallet = this.resolve(name);
93552
+ const wallet = await this.resolveLatest(name);
93521
93553
  const store = this.options.store;
93522
93554
  if (!store || wallet.path === void 0) {
93523
93555
  return { wallet, account: this.options.account };
@@ -93525,7 +93557,10 @@ var WalletSession = class {
93525
93557
  const account = await store.hasVaultAccount(wallet.name) ? await store.unlock(wallet.name, "") : await this.#unlockLegacy(wallet);
93526
93558
  return { wallet, account, spendCaps: await spendCapsForWallet(store, wallet.name) };
93527
93559
  }
93528
- /** Every account this machine knows, with the session's own marker on one. */
93560
+ /**
93561
+ * Every account this machine knows, with the session's own marker on one.
93562
+ * `wallets.json` is re-read first, so accounts made in a terminal show up.
93563
+ */
93529
93564
  async list() {
93530
93565
  const store = this.options.store;
93531
93566
  const active = this.#active;
@@ -93542,6 +93577,7 @@ var WalletSession = class {
93542
93577
  }
93543
93578
  ];
93544
93579
  }
93580
+ await store.refreshRegistry();
93545
93581
  return (await store.list()).map((info) => ({
93546
93582
  name: info.name,
93547
93583
  ...info.address === void 0 ? {} : { address: info.address },
@@ -93559,7 +93595,7 @@ var WalletSession = class {
93559
93595
  * an agent pays from changed.
93560
93596
  */
93561
93597
  async use(name) {
93562
- const wallet = this.resolve(assertWalletName(name));
93598
+ const wallet = await this.resolveLatest(assertWalletName(name));
93563
93599
  const previous = this.#active ?? null;
93564
93600
  this.#active = wallet.name;
93565
93601
  let address4;
@@ -94371,13 +94407,16 @@ function createVapiServer(options = {}) {
94371
94407
  inputSchema: {},
94372
94408
  outputSchema: walletListToolResultSchema
94373
94409
  },
94374
- async () => asStructuredToolResult(async () => ({
94375
- wallet: session.activeName ?? null,
94376
- default: session.store?.defaultName ?? session.activeName ?? null,
94377
- wallets: await Promise.all(
94378
- (await session.list()).map((info) => describeWallet(info, config2, guardedFetch2))
94379
- )
94380
- }))
94410
+ async () => asStructuredToolResult(async () => {
94411
+ const accounts2 = await session.list();
94412
+ return {
94413
+ wallet: session.activeName ?? null,
94414
+ default: session.store?.defaultName ?? session.activeName ?? null,
94415
+ wallets: await Promise.all(
94416
+ accounts2.map((info) => describeWallet(info, config2, guardedFetch2))
94417
+ )
94418
+ };
94419
+ })
94381
94420
  );
94382
94421
  server.registerTool(
94383
94422
  "wallet.use",
@@ -94430,7 +94469,7 @@ function createVapiServer(options = {}) {
94430
94469
  ),
94431
94470
  balance
94432
94471
  );
94433
- const ledgerWallet2 = (input2) => input2.allWallets === true ? null : session.resolve(input2.wallet).name;
94472
+ const ledgerWallet2 = async (input2) => input2.allWallets === true ? null : (await session.resolveLatest(input2.wallet)).name;
94434
94473
  server.registerTool(
94435
94474
  "receipts.list",
94436
94475
  {
@@ -94443,7 +94482,7 @@ function createVapiServer(options = {}) {
94443
94482
  outputSchema: external_exports.object({ wallet: external_exports.string().nullable(), receipts: external_exports.array(external_exports.unknown()) })
94444
94483
  },
94445
94484
  async (input2) => asStructuredToolResult(async () => {
94446
- const wallet = ledgerWallet2(input2);
94485
+ const wallet = await ledgerWallet2(input2);
94447
94486
  return {
94448
94487
  wallet,
94449
94488
  receipts: await readReceipts(options.receiptsPath ?? getVapiPaths().receipts, {
@@ -94466,7 +94505,7 @@ function createVapiServer(options = {}) {
94466
94505
  },
94467
94506
  async (input2) => asStructuredToolResult(async () => {
94468
94507
  const paths = getVapiPaths();
94469
- const wallet = ledgerWallet2(input2);
94508
+ const wallet = await ledgerWallet2(input2);
94470
94509
  return {
94471
94510
  wallet,
94472
94511
  ...aggregateStats({
@@ -94867,6 +94906,9 @@ function rgbToAnsi256(red, green, blue) {
94867
94906
  import { readFile as readFile24, stat as stat14 } from "node:fs/promises";
94868
94907
  import { join as join21 } from "node:path";
94869
94908
 
94909
+ // src/dashboard.ts
94910
+ import { resolve as resolve2 } from "node:path";
94911
+
94870
94912
  // src/publish-client.ts
94871
94913
  var LISTING_CATEGORIES = ["ai", "data", "crypto", "compute", "search"];
94872
94914
  var PROBE_MODES = ["origin", "endpoint", "openapi"];
@@ -95187,7 +95229,8 @@ async function runLoginFlow(argv, json2, io, dependencies, options = {}) {
95187
95229
  booleanOptions: /* @__PURE__ */ new Set(["--publish", "--no-browser"]),
95188
95230
  maximumPositionals: 0
95189
95231
  });
95190
- const target = await targetWallet(parsed, dependencies);
95232
+ const paths = getVapiPaths(options.home);
95233
+ const target = await targetWallet(parsed, dependencies, paths.directory);
95191
95234
  const { account } = await unlockTarget(target, dependencies);
95192
95235
  const label = parsed.one("--label") ?? target.name;
95193
95236
  const scopes = [
@@ -95196,13 +95239,13 @@ async function runLoginFlow(argv, json2, io, dependencies, options = {}) {
95196
95239
  "tasks:write",
95197
95240
  ...parsed.has("--publish") ? ["call.publish"] : []
95198
95241
  ];
95199
- const config2 = await loadConfig(getVapiPaths().config, process.env, { notice: io.stderr });
95200
- const apiBase = registryBaseUrl(config2);
95242
+ const config2 = await loadConfig(paths.config, process.env, { notice: io.stderr });
95243
+ const apiBase = options.apiBase ?? registryBaseUrl(config2);
95201
95244
  const fetchImpl = dependencies.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: false });
95202
95245
  const secrets = getSecretStore(dependencies);
95203
95246
  const device = await ensureDeviceName({
95204
95247
  env: getEnvironment(dependencies),
95205
- configPath: getVapiPaths().config,
95248
+ configPath: paths.config,
95206
95249
  ...dependencies.hostname === void 0 ? {} : { hostname: dependencies.hostname() }
95207
95250
  });
95208
95251
  const bearer = await trustedLinkBearer({
@@ -95456,6 +95499,87 @@ function shortAddress(address4) {
95456
95499
  return address4.length <= 12 ? address4 : `${address4.slice(0, 6)}\u2026${address4.slice(-4)}`;
95457
95500
  }
95458
95501
 
95502
+ // src/dashboard.ts
95503
+ function dashboardUrl(apiBase) {
95504
+ return `${apiBase.replace(/\/+$/u, "")}/agents`;
95505
+ }
95506
+ async function offerDashboardLink({
95507
+ name,
95508
+ json: json2,
95509
+ noLink = false,
95510
+ io,
95511
+ dependencies,
95512
+ home = getVapiPaths().directory,
95513
+ apiBase
95514
+ }) {
95515
+ const otherHome = resolve2(home) !== resolve2(getVapiPaths().directory);
95516
+ const command = `${otherHome ? `VAPI_HOME=${shellQuote(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote(apiBase)} `}vapi login --account ${name}`;
95517
+ const unlinked = {
95518
+ linked: false,
95519
+ next: [{ kind: "link", account: name, command }]
95520
+ };
95521
+ const hint = () => {
95522
+ if (!json2) io.stdout(`Run \`${command}\` to see this wallet on your dashboard.`);
95523
+ return unlinked;
95524
+ };
95525
+ try {
95526
+ const store = await WalletStore.open(home, {
95527
+ secrets: getSecretStore(dependencies),
95528
+ env: getEnvironment(dependencies)
95529
+ });
95530
+ if (store.entry(name)?.link !== void 0) return { linked: true };
95531
+ if (noLink || json2 || !isInteractive(dependencies) || activeAgentMarker(getEnvironment(dependencies)) !== void 0) {
95532
+ return hint();
95533
+ }
95534
+ const answer = (await getLinePrompt(dependencies)(`Link ${name} to your vAPI dashboard? [Y/n] `)).trim();
95535
+ if (!/^(?:y|yes)?$/iu.test(answer)) return hint();
95536
+ await runLoginFlow(["--account", name, "--label", name], false, io, dependencies, {
95537
+ home,
95538
+ ...apiBase === void 0 ? {} : { apiBase }
95539
+ });
95540
+ await store.reload();
95541
+ const link3 = store.entry(name)?.link;
95542
+ if (link3 === void 0) return hint();
95543
+ io.stdout(`See it on your dashboard: ${dashboardUrl(link3.apiBase)}`);
95544
+ return { linked: true };
95545
+ } catch (error61) {
95546
+ if (!json2) {
95547
+ io.stderr(`Link not completed: ${error61 instanceof Error ? error61.message : String(error61)}`);
95548
+ }
95549
+ return hint();
95550
+ }
95551
+ }
95552
+ async function dashboardCommand(argv, json2, io, dependencies) {
95553
+ const parsed = parseArguments(argv, {
95554
+ valueOptions: /* @__PURE__ */ new Set(["--wallet"]),
95555
+ booleanOptions: /* @__PURE__ */ new Set(["--no-browser", "--no-link"]),
95556
+ maximumPositionals: 0
95557
+ });
95558
+ const target = await targetWallet(parsed, dependencies);
95559
+ let status = { linked: true };
95560
+ if (target.entry.link === void 0) {
95561
+ if (!json2) io.stdout(`${target.name} is not linked to your vAPI dashboard yet.`);
95562
+ status = await offerDashboardLink({
95563
+ name: target.name,
95564
+ json: json2,
95565
+ noLink: parsed.has("--no-link"),
95566
+ io,
95567
+ dependencies: parsed.has("--no-browser") ? { ...dependencies, openUrl: () => false } : dependencies
95568
+ });
95569
+ }
95570
+ await target.store.reload();
95571
+ const apiBase = target.store.entry(target.name)?.link?.apiBase ?? registryBaseUrl(await readConfig(getVapiPaths().config, io));
95572
+ const url2 = dashboardUrl(apiBase);
95573
+ let opened = false;
95574
+ if (status.linked && !parsed.has("--no-browser") && (dependencies.interactive ?? Boolean(process.stdout.isTTY)) && activeAgentMarker(getEnvironment(dependencies)) === void 0) {
95575
+ opened = (dependencies.openUrl ?? openInBrowser)(url2);
95576
+ }
95577
+ io.stdout(json2 ? JSON.stringify({ account: target.name, url: url2, ...status, opened }) : url2);
95578
+ }
95579
+ function shellQuote(value) {
95580
+ return /^[a-zA-Z0-9_./-]+$/u.test(value) ? value : `'${value.replace(/'/gu, "'\\''")}'`;
95581
+ }
95582
+
95459
95583
  // src/status.ts
95460
95584
  import { stat as stat13 } from "node:fs/promises";
95461
95585
  import { homedir as homedir2 } from "node:os";
@@ -97841,10 +97965,10 @@ function apiEndpoint2(apiBase, path) {
97841
97965
  }
97842
97966
  async function sleepFor2(milliseconds, signal) {
97843
97967
  if (signal?.aborted === true) throw signal.reason;
97844
- await new Promise((resolve2, reject) => {
97968
+ await new Promise((resolve3, reject) => {
97845
97969
  const finish = () => {
97846
97970
  signal?.removeEventListener("abort", abort);
97847
- resolve2();
97971
+ resolve3();
97848
97972
  };
97849
97973
  const timeout = setTimeout(finish, milliseconds);
97850
97974
  const abort = () => {
@@ -98179,7 +98303,7 @@ async function readProcessStdin() {
98179
98303
  }
98180
98304
 
98181
98305
  // src/version.ts
98182
- var CLI_VERSION = "0.9.4";
98306
+ var CLI_VERSION = "0.9.6";
98183
98307
 
98184
98308
  // src/status.ts
98185
98309
  async function statusCommand(argv, json2, io, dependencies) {
@@ -98323,10 +98447,10 @@ async function runStatusSweep(args) {
98323
98447
  timeoutMs,
98324
98448
  ...args.warn === void 0 ? {} : { warn: args.warn }
98325
98449
  }),
98326
- new Promise((resolve2) => {
98450
+ new Promise((resolve3) => {
98327
98451
  timeout = setTimeout(() => {
98328
98452
  controller.abort();
98329
- resolve2();
98453
+ resolve3();
98330
98454
  }, timeoutMs);
98331
98455
  timeout.unref();
98332
98456
  })
@@ -98555,7 +98679,7 @@ async function siblingsFetchImpl(dependencies) {
98555
98679
  function shortAddress3(address4) {
98556
98680
  return address4.length <= 12 ? address4 : `${address4.slice(0, 6)}\u2026${address4.slice(-4)}`;
98557
98681
  }
98558
- async function accountsAddCommand(argv, json2, io, dependencies) {
98682
+ async function accountsAddCommand(argv, json2, io, dependencies, options = { link: "always" }) {
98559
98683
  const parsed = parseArguments(argv, {
98560
98684
  valueOptions: /* @__PURE__ */ new Set(["--label"]),
98561
98685
  booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
@@ -98572,6 +98696,18 @@ async function accountsAddCommand(argv, json2, io, dependencies) {
98572
98696
  });
98573
98697
  await recordAudit(dependencies, "wallet.create", { wallet: created.account });
98574
98698
  const address4 = created.address;
98699
+ if (options.link === "offer") {
98700
+ if (!json2) io.stdout(`Account ${created.account} derived: ${address4}`);
98701
+ const link3 = await offerDashboardLink({
98702
+ name: created.account,
98703
+ json: json2,
98704
+ noLink: parsed.has("--no-link"),
98705
+ io,
98706
+ dependencies
98707
+ });
98708
+ if (json2) io.stdout(JSON.stringify({ account: created.account, address: address4, ...link3 }));
98709
+ return;
98710
+ }
98575
98711
  if (parsed.has("--no-link")) {
98576
98712
  output2(
98577
98713
  io,
@@ -99387,10 +99523,10 @@ async function autoUploadBackup(io, json2, dependencies) {
99387
99523
  const timeoutMs = dependencies.cloudBackup?.uploadTimeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS;
99388
99524
  const controller = new AbortController();
99389
99525
  let timer;
99390
- const timeout = new Promise((resolve2) => {
99526
+ const timeout = new Promise((resolve3) => {
99391
99527
  timer = setTimeout(() => {
99392
99528
  controller.abort();
99393
- resolve2({ status: "skipped", reason: "timeout" });
99529
+ resolve3({ status: "skipped", reason: "timeout" });
99394
99530
  }, timeoutMs);
99395
99531
  timer.unref();
99396
99532
  });
@@ -100614,7 +100750,7 @@ var HTTP_NOT_FOUND_PATTERN = /\b404\b/u;
100614
100750
  var OTHER_SCOPE_PATTERN = /\b(?:project|environment|service|workspace|team|token|user|account|volume|deployment|command|file|directory|module|package)s?\b/iu;
100615
100751
  var SIDECAR_SUFFIX = ".railway.json";
100616
100752
  var MINIMUM_SECRET_LENGTH = 8;
100617
- var defaultRailwayExec = (file2, args) => new Promise((resolve2, reject) => {
100753
+ var defaultRailwayExec = (file2, args) => new Promise((resolve3, reject) => {
100618
100754
  const child = spawn2(file2, [...args], {
100619
100755
  stdio: ["ignore", "pipe", "pipe"],
100620
100756
  env: process.env,
@@ -100629,7 +100765,7 @@ var defaultRailwayExec = (file2, args) => new Promise((resolve2, reject) => {
100629
100765
  stderr2 += chunk;
100630
100766
  });
100631
100767
  child.once("error", reject);
100632
- child.once("close", (code) => resolve2({ code, stdout, stderr: stderr2 }));
100768
+ child.once("close", (code) => resolve3({ code, stdout, stderr: stderr2 }));
100633
100769
  });
100634
100770
  function parseSandboxId(stdout) {
100635
100771
  const trimmed = stdout.trim();
@@ -100762,8 +100898,8 @@ function createRailwayRuntime(options) {
100762
100898
  const readyAttempts = options.readyAttempts ?? DEFAULT_RAILWAY_READY_ATTEMPTS;
100763
100899
  const readyIntervalMs = options.readyIntervalMs ?? DEFAULT_RAILWAY_READY_INTERVAL_MS;
100764
100900
  const signalDestroyTimeoutMs = options.signalDestroyTimeoutMs ?? DEFAULT_RAILWAY_SIGNAL_DESTROY_TIMEOUT_MS;
100765
- const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve2) => {
100766
- setTimeout(resolve2, milliseconds);
100901
+ const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve3) => {
100902
+ setTimeout(resolve3, milliseconds);
100767
100903
  }));
100768
100904
  let secrets = options.secrets;
100769
100905
  const getSecrets = () => secrets ??= secretStore();
@@ -102616,7 +102752,7 @@ function usd(value, minimumDecimals = 0) {
102616
102752
  import { mkdir as mkdir20, readFile as readFile27, writeFile as writeFile11 } from "node:fs/promises";
102617
102753
  import { homedir as systemHomedir } from "node:os";
102618
102754
  import { dirname as dirname14, posix, win32 as win322 } from "node:path";
102619
- var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]";
102755
+ var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
102620
102756
  var APPS = /* @__PURE__ */ new Set(["claude", "cursor", "codex"]);
102621
102757
  var NEXT_STEP = {
102622
102758
  claude: 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
@@ -102657,6 +102793,7 @@ function mcpInstallTarget(app, context) {
102657
102793
  async function mcpInstallCommand(argv, json2, io, dependencies) {
102658
102794
  const parsed = parseArguments(argv, {
102659
102795
  valueOptions: /* @__PURE__ */ new Set(["--home", "--registry"]),
102796
+ booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
102660
102797
  maximumPositionals: 1
102661
102798
  });
102662
102799
  const appValue = parsed.positionals[0];
@@ -102678,13 +102815,39 @@ ${MCP_INSTALL_USAGE}`
102678
102815
  });
102679
102816
  const entry = serverEntry(home, registry2);
102680
102817
  const created = await writeMcpConfig(target, entry);
102818
+ const name = await unlinkedDefaultAccount(home, dependencies);
102819
+ const offerLink = (name2) => offerDashboardLink({
102820
+ name: name2,
102821
+ json: json2,
102822
+ noLink: parsed.has("--no-link"),
102823
+ io,
102824
+ dependencies,
102825
+ home,
102826
+ apiBase: parsed.one("--registry")
102827
+ });
102828
+ const link3 = json2 && name !== void 0 ? await offerLink(name) : {};
102681
102829
  output3(
102682
102830
  io,
102683
102831
  json2,
102684
- { command: "mcp install", app: appValue, path: target.path, created, home, registry: registry2 },
102832
+ { ...link3, command: "mcp install", app: appValue, path: target.path, created, home, registry: registry2 },
102685
102833
  `${created ? "Wrote" : "Updated"} ${target.path}.`
102686
102834
  );
102687
- if (!json2) io.stdout(NEXT_STEP[appValue]);
102835
+ if (!json2) {
102836
+ io.stdout(NEXT_STEP[appValue]);
102837
+ if (name !== void 0) await offerLink(name);
102838
+ }
102839
+ }
102840
+ async function unlinkedDefaultAccount(home, dependencies) {
102841
+ try {
102842
+ const store = await WalletStore.open(home, {
102843
+ secrets: getSecretStore(dependencies),
102844
+ env: getEnvironment(dependencies)
102845
+ });
102846
+ const name = store.defaultName;
102847
+ if (name !== void 0 && store.resolve({ name }).entry.link === void 0) return name;
102848
+ } catch {
102849
+ }
102850
+ return void 0;
102688
102851
  }
102689
102852
  function isMcpInstallApp(value) {
102690
102853
  return APPS.has(value);
@@ -103354,7 +103517,7 @@ async function taskContext(parsed, io, dependencies, publicOnly = false) {
103354
103517
  pending,
103355
103518
  randomUUID: dependencies.tasks?.randomUUID ?? randomUUID6,
103356
103519
  signInHint: "Run vapi login for the acting wallet.",
103357
- sleep: dependencies.tasks?.sleep ?? ((milliseconds) => new Promise((resolve2) => setTimeout(resolve2, milliseconds)))
103520
+ sleep: dependencies.tasks?.sleep ?? ((milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds)))
103358
103521
  };
103359
103522
  }
103360
103523
  async function taskRequest2(verb, route, operation) {
@@ -105154,11 +105317,11 @@ ${usage}`);
105154
105317
  }
105155
105318
  }
105156
105319
  async function referencedSleep(milliseconds, signal) {
105157
- await new Promise((resolve2) => {
105320
+ await new Promise((resolve3) => {
105158
105321
  const finish = () => {
105159
105322
  clearTimeout(timer);
105160
105323
  signal?.removeEventListener("abort", finish);
105161
- resolve2();
105324
+ resolve3();
105162
105325
  };
105163
105326
  const timer = setTimeout(finish, milliseconds);
105164
105327
  if (signal === void 0) return;
@@ -105386,7 +105549,7 @@ var HELP_HEADING = "vAPI Network";
105386
105549
  var HELP = `${HELP_HEADING}
105387
105550
 
105388
105551
  Usage:
105389
- vapi init [--networks <base,arc>] [--json]
105552
+ vapi init [--networks <base,arc>] [--no-link] [--json]
105390
105553
  vapi setup [--no-cloud-backup] [--accounts <n>] [--json]
105391
105554
  vapi accounts [--all] [--json]
105392
105555
  vapi accounts add <name> [--label <text>] [--no-link] [--json]
@@ -105433,6 +105596,7 @@ Usage:
105433
105596
  vapi agent pause <name> [--json]
105434
105597
  vapi agent resume <name> [--json]
105435
105598
  vapi agent revoke <name> [--json]
105599
+ vapi dashboard [--account <name>] [--no-browser] [--json]
105436
105600
  vapi login [--account <name>] [--label <name>] [--publish] [--no-browser] [--json]
105437
105601
  vapi logout [--account <name>] [--json]
105438
105602
  vapi whoami [--account <name>] [--json]
@@ -105483,11 +105647,13 @@ Usage:
105483
105647
  vapi publish list [--json]
105484
105648
  vapi claim <origin> [--account <name>] [--json]
105485
105649
  vapi mcp [--account <name>] [--json]
105486
- vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]
105650
+ vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
105487
105651
  vapi serve [--json]
105488
105652
  vapi version [--json]
105489
105653
  vapi help [--json]
105490
105654
 
105655
+ \`vapi init\`, \`vapi wallet create\` and \`vapi mcp install\` offer to link the wallet to your vAPI dashboard. Use \`--no-link\` to skip the prompt.
105656
+
105491
105657
  Every command that touches a wallet takes \`--account <name>\`, falls back to \`VAPI_WALLET\`, then to the default account set by \`vapi accounts use\`, and names the wallet it used on its first line.
105492
105658
 
105493
105659
  \`vapi search\` answers with vAPI-verified listings plus the mirrored external catalogs. \`--include-unverified\` also returns self-listed APIs that passed vAPI's automated x402 probe but were never reviewed; every result is tagged \`[verified]\`, \`[requested]\`, \`[unverified]\` or \`[external]\`.
@@ -105552,8 +105718,8 @@ var ACCOUNT_OPTION2 = "--account";
105552
105718
  var WALLET_OPTION_DEPRECATION = "--wallet is now --account; --wallet keeps working for one release.";
105553
105719
  var SOLANA_VAULT_UNAVAILABLE2 = "Solana keys are not part of the device vault yet.";
105554
105720
  var INCLUDE_UNVERIFIED_OPTION = "--include-unverified";
105555
- async function openWalletStore(dependencies) {
105556
- return await WalletStore.open(getVapiPaths().directory, {
105721
+ async function openWalletStore(dependencies, home = getVapiPaths().directory) {
105722
+ return await WalletStore.open(home, {
105557
105723
  secrets: getSecretStore(dependencies),
105558
105724
  env: getEnvironment(dependencies),
105559
105725
  ...dependencies.now === void 0 ? {} : { now: dependencies.now }
@@ -105568,8 +105734,8 @@ async function selectWallet(store, parsed, dependencies) {
105568
105734
  const address4 = await store.readAddress(resolved.name);
105569
105735
  return { store, ...resolved, ...address4 === void 0 ? {} : { address: address4 } };
105570
105736
  }
105571
- async function targetWallet(parsed, dependencies) {
105572
- return await selectWallet(await openWalletStore(dependencies), parsed, dependencies);
105737
+ async function targetWallet(parsed, dependencies, home = getVapiPaths().directory) {
105738
+ return await selectWallet(await openWalletStore(dependencies, home), parsed, dependencies);
105573
105739
  }
105574
105740
  function getSecretStore(dependencies) {
105575
105741
  return dependencies.secretStore ?? secretStore();
@@ -105748,6 +105914,10 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
105748
105914
  case "agent":
105749
105915
  exitCode = await agentCommand(args.slice(1), json2, runIo, dependencies);
105750
105916
  break;
105917
+ case "dashboard":
105918
+ await dashboardCommand(args.slice(1), json2, io, dependencies);
105919
+ exitCode = 0;
105920
+ break;
105751
105921
  case "login":
105752
105922
  await loginCommand(args.slice(1), json2, io, dependencies);
105753
105923
  exitCode = 0;
@@ -105962,6 +106132,7 @@ function shouldAutoUploadAfterFailure(args) {
105962
106132
  async function initCommand(argv, json2, io, dependencies) {
105963
106133
  const parsed = parseArguments(argv, {
105964
106134
  valueOptions: /* @__PURE__ */ new Set(["--networks"]),
106135
+ booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
105965
106136
  maximumPositionals: 0
105966
106137
  });
105967
106138
  const networks = parseInitNetworks(parsed.one("--networks") ?? "base");
@@ -106009,7 +106180,14 @@ async function initCommand(argv, json2, io, dependencies) {
106009
106180
  nextSteps: buildNextSteps(account.address)
106010
106181
  };
106011
106182
  if (json2) {
106012
- io.stdout(JSON.stringify(result));
106183
+ const link3 = await offerDashboardLink({
106184
+ name: created.name,
106185
+ json: json2,
106186
+ noLink: parsed.has("--no-link"),
106187
+ io,
106188
+ dependencies
106189
+ });
106190
+ io.stdout(JSON.stringify({ ...result, ...link3 }));
106013
106191
  return;
106014
106192
  }
106015
106193
  if (configRewrites.length > 0) io.stdout(formatLegacyRegistryRewrites(configRewrites));
@@ -106030,6 +106208,13 @@ async function initCommand(argv, json2, io, dependencies) {
106030
106208
  io.stdout(formatAccounts(accounts));
106031
106209
  io.stdout("");
106032
106210
  io.stdout(result.nextSteps.join("\n"));
106211
+ await offerDashboardLink({
106212
+ name: created.name,
106213
+ json: json2,
106214
+ noLink: parsed.has("--no-link"),
106215
+ io,
106216
+ dependencies
106217
+ });
106033
106218
  }
106034
106219
  var INIT_ALREADY_DONE = "This machine already has a wallet, so vapi init created nothing.";
106035
106220
  async function reportExistingWallets(store, json2, io, dependencies) {
@@ -106065,12 +106250,11 @@ async function walletCommand(argv, json2, io, dependencies) {
106065
106250
  `Unknown wallet subcommand ${JSON.stringify(subcommand)}. ${WALLET_USAGE}`
106066
106251
  );
106067
106252
  }
106068
- await accountsCommand(
106069
- [mapped2, ...rest, ...subcommand === "create" ? ["--no-link"] : []],
106070
- json2,
106071
- io,
106072
- dependencies
106073
- );
106253
+ if (subcommand === "create") {
106254
+ await accountsAddCommand(rest, json2, io, dependencies, { link: "offer" });
106255
+ return;
106256
+ }
106257
+ await accountsCommand([mapped2, ...rest], json2, io, dependencies);
106074
106258
  }
106075
106259
  async function unlockedWallets(walletsStore, wallets, dependencies) {
106076
106260
  const secrets = getSecretStore(dependencies);
@@ -106612,8 +106796,8 @@ async function fetchNetworkStats(dependencies) {
106612
106796
  })();
106613
106797
  let timeout;
106614
106798
  try {
106615
- const timedOut = new Promise((resolve2) => {
106616
- timeout = setTimeout(() => resolve2(null), NETWORK_STATS_REQUEST_TIMEOUT_MS);
106799
+ const timedOut = new Promise((resolve3) => {
106800
+ timeout = setTimeout(() => resolve3(null), NETWORK_STATS_REQUEST_TIMEOUT_MS);
106617
106801
  });
106618
106802
  return await Promise.race([request, timedOut]);
106619
106803
  } finally {
@@ -108294,10 +108478,10 @@ async function checkForUpdate(options = {}) {
108294
108478
  try {
108295
108479
  return await Promise.race([
108296
108480
  latestNotice(options, env, controller.signal),
108297
- new Promise((resolve2) => {
108481
+ new Promise((resolve3) => {
108298
108482
  timer = setTimeout(() => {
108299
108483
  controller.abort();
108300
- resolve2(void 0);
108484
+ resolve3(void 0);
108301
108485
  }, CHECK_TIMEOUT_MS);
108302
108486
  })
108303
108487
  ]);