vapi-network 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 resolve3 = () => void 0;
9444
+ let resolve4 = () => void 0;
9445
9445
  let reject = () => void 0;
9446
9446
  const promise2 = new Promise((resolve_, reject_) => {
9447
- resolve3 = resolve_;
9447
+ resolve4 = resolve_;
9448
9448
  reject = reject_;
9449
9449
  });
9450
- return { promise: promise2, resolve: resolve3, reject };
9450
+ return { promise: promise2, resolve: resolve4, 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: resolve3 } = scheduler[i];
9470
- resolve3?.([data[i], data]);
9469
+ const { resolve: resolve4 } = scheduler[i];
9470
+ resolve4?.([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: resolve3, reject } = withResolvers();
9486
+ const { promise: promise2, resolve: resolve4, 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: resolve3, reject });
9492
+ setScheduler({ args, resolve: resolve4, reject });
9493
9493
  return promise2;
9494
9494
  }
9495
- setScheduler({ args, resolve: resolve3, reject });
9495
+ setScheduler({ args, resolve: resolve4, reject });
9496
9496
  setTimeout(exec, wait2);
9497
9497
  return promise2;
9498
9498
  }
@@ -31135,7 +31135,7 @@ function observe(observerId, callbacks, fn) {
31135
31135
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/wait.js
31136
31136
  init_utils3();
31137
31137
  async function wait(time3, { signal } = {}) {
31138
- return new Promise((resolve3, reject) => {
31138
+ return new Promise((resolve4, reject) => {
31139
31139
  if (signal?.aborted) {
31140
31140
  reject(getAbortError(signal));
31141
31141
  return;
@@ -31143,7 +31143,7 @@ async function wait(time3, { signal } = {}) {
31143
31143
  const cleanup = () => signal?.removeEventListener("abort", onAbort);
31144
31144
  const timeout = setTimeout(() => {
31145
31145
  cleanup();
31146
- resolve3();
31146
+ resolve4();
31147
31147
  }, time3);
31148
31148
  const onAbort = () => {
31149
31149
  clearTimeout(timeout);
@@ -31719,7 +31719,7 @@ init_withResolvers();
31719
31719
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withRetry.js
31720
31720
  init_utils3();
31721
31721
  function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shouldRetry2 = () => true, signal } = {}) {
31722
- return new Promise((resolve3, reject) => {
31722
+ return new Promise((resolve4, reject) => {
31723
31723
  const attemptRetry = async ({ count = 0 } = {}) => {
31724
31724
  if (signal?.aborted) {
31725
31725
  reject(getAbortError(signal));
@@ -31739,7 +31739,7 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
31739
31739
  };
31740
31740
  try {
31741
31741
  const data = await fn();
31742
- resolve3(data);
31742
+ resolve4(data);
31743
31743
  } catch (err) {
31744
31744
  if (signal?.aborted) {
31745
31745
  reject(getAbortError(signal));
@@ -31890,7 +31890,7 @@ async function sendCalls(client, parameters) {
31890
31890
  results.push({ reason, status: "rejected" });
31891
31891
  }
31892
31892
  if (experimental_fallbackDelay > 0)
31893
- await new Promise((resolve3) => setTimeout(resolve3, experimental_fallbackDelay));
31893
+ await new Promise((resolve4) => setTimeout(resolve4, experimental_fallbackDelay));
31894
31894
  }
31895
31895
  if (results.every((r) => r.status === "rejected"))
31896
31896
  throw results[0].reason;
@@ -31993,9 +31993,9 @@ async function waitForCallsStatus(client, parameters) {
31993
31993
  throwOnFailure = false
31994
31994
  } = parameters;
31995
31995
  const observerId = stringify(["waitForCallsStatus", client.uid, id2]);
31996
- const { promise: promise2, resolve: resolve3, reject } = withResolvers();
31996
+ const { promise: promise2, resolve: resolve4, reject } = withResolvers();
31997
31997
  let timer;
31998
- const unobserve = observe(observerId, { resolve: resolve3, reject }, (emit) => {
31998
+ const unobserve = observe(observerId, { resolve: resolve4, reject }, (emit) => {
31999
31999
  const unpoll = poll(async () => {
32000
32000
  const done = (fn) => {
32001
32001
  clearTimeout(timer);
@@ -32377,13 +32377,13 @@ async function isImageUri(uri) {
32377
32377
  }
32378
32378
  if (!Object.hasOwn(globalThis, "Image"))
32379
32379
  return false;
32380
- return new Promise((resolve3) => {
32380
+ return new Promise((resolve4) => {
32381
32381
  const img = new Image();
32382
32382
  img.onload = () => {
32383
- resolve3(true);
32383
+ resolve4(true);
32384
32384
  };
32385
32385
  img.onerror = () => {
32386
- resolve3(false);
32386
+ resolve4(false);
32387
32387
  };
32388
32388
  img.src = uri;
32389
32389
  });
@@ -33846,7 +33846,7 @@ init_utils3();
33846
33846
  // ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withTimeout.js
33847
33847
  init_utils3();
33848
33848
  function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, signal }) {
33849
- return new Promise((resolve3, reject) => {
33849
+ return new Promise((resolve4, reject) => {
33850
33850
  ;
33851
33851
  (async () => {
33852
33852
  let timeoutId;
@@ -33861,7 +33861,7 @@ function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, sign
33861
33861
  }
33862
33862
  }, timeout);
33863
33863
  }
33864
- resolve3(await fn({ signal: controller?.signal || null }));
33864
+ resolve4(await fn({ signal: controller?.signal || null }));
33865
33865
  } catch (err) {
33866
33866
  if (controller?.signal.aborted && isAbortError(err)) {
33867
33867
  reject(errorInstance);
@@ -37841,13 +37841,13 @@ async function waitForTransactionReceipt(client, parameters) {
37841
37841
  let retrying = false;
37842
37842
  let _unobserve;
37843
37843
  let _unwatch;
37844
- const { promise: promise2, resolve: resolve3, reject } = withResolvers();
37844
+ const { promise: promise2, resolve: resolve4, reject } = withResolvers();
37845
37845
  const timer = timeout ? setTimeout(() => {
37846
37846
  _unwatch?.();
37847
37847
  _unobserve?.();
37848
37848
  reject(new WaitForTransactionReceiptTimeoutError({ hash: hash5 }));
37849
37849
  }, timeout) : void 0;
37850
- _unobserve = observe(observerId, { onReplaced, resolve: resolve3, reject }, async (emit) => {
37850
+ _unobserve = observe(observerId, { onReplaced, resolve: resolve4, reject }, async (emit) => {
37851
37851
  receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash5 }).catch(() => void 0);
37852
37852
  if (receipt && confirmations <= 1) {
37853
37853
  clearTimeout(timer);
@@ -43806,7 +43806,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
43806
43806
  coalescedRequest.numConsumers++;
43807
43807
  if (signal) {
43808
43808
  const responsePromise = coalescedRequest.responsePromise;
43809
- return await new Promise((resolve3, reject) => {
43809
+ return await new Promise((resolve4, reject) => {
43810
43810
  const handleAbort = (e22) => {
43811
43811
  signal.removeEventListener("abort", handleAbort);
43812
43812
  coalescedRequest.numConsumers -= 1;
@@ -43819,7 +43819,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
43819
43819
  reject(e22.target.reason);
43820
43820
  };
43821
43821
  signal.addEventListener("abort", handleAbort);
43822
- responsePromise.then(resolve3).catch(reject).finally(() => {
43822
+ responsePromise.then(resolve4).catch(reject).finally(() => {
43823
43823
  signal.removeEventListener("abort", handleAbort);
43824
43824
  });
43825
43825
  });
@@ -45202,7 +45202,7 @@ function createPublicFetch(options) {
45202
45202
  });
45203
45203
  const normalized = new Request(input2, init);
45204
45204
  const bytes = normalized.body ? Buffer.from(await normalized.arrayBuffer()) : null;
45205
- return await new Promise((resolve3, reject) => {
45205
+ return await new Promise((resolve4, reject) => {
45206
45206
  const requestOptions2 = {
45207
45207
  method: normalized.method,
45208
45208
  headers: Object.fromEntries(normalized.headers),
@@ -45227,7 +45227,7 @@ function createPublicFetch(options) {
45227
45227
  { status, statusText: incoming.statusMessage, headers }
45228
45228
  );
45229
45229
  Object.defineProperty(response, "url", { value: url2.toString() });
45230
- resolve3(response);
45230
+ resolve4(response);
45231
45231
  } catch (error61) {
45232
45232
  incoming.destroy();
45233
45233
  reject(error61);
@@ -45996,8 +45996,8 @@ var svmFetchQueue = Promise.resolve();
45996
45996
  async function withGuardedSvmFetch(fetchImpl, operation) {
45997
45997
  const previous = svmFetchQueue;
45998
45998
  let release2;
45999
- svmFetchQueue = new Promise((resolve3) => {
46000
- release2 = resolve3;
45999
+ svmFetchQueue = new Promise((resolve4) => {
46000
+ release2 = resolve4;
46001
46001
  });
46002
46002
  await previous;
46003
46003
  const originalFetch = globalThis.fetch;
@@ -47226,7 +47226,7 @@ async function withFileLock(lockPath, fn, options = {}) {
47226
47226
  if (Date.now() >= deadline) {
47227
47227
  throw new FileLockedError(options.lockedMessage);
47228
47228
  }
47229
- await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
47229
+ await new Promise((resolve4) => setTimeout(resolve4, LOCK_RETRY_MS));
47230
47230
  continue;
47231
47231
  }
47232
47232
  handle = candidate;
@@ -47241,7 +47241,7 @@ async function withFileLock(lockPath, fn, options = {}) {
47241
47241
  if (Date.now() >= deadline) {
47242
47242
  throw new FileLockedError(options.lockedMessage);
47243
47243
  }
47244
- await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
47244
+ await new Promise((resolve4) => setTimeout(resolve4, LOCK_RETRY_MS));
47245
47245
  }
47246
47246
  }
47247
47247
  const ownedHandle = handle;
@@ -47362,7 +47362,7 @@ async function restoreRenamedLock(path, tombPath) {
47362
47362
  } catch (error61) {
47363
47363
  if (hasCode(error61, "ENOENT")) return;
47364
47364
  if (!hasCode(error61, "EEXIST")) throw error61;
47365
- await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
47365
+ await new Promise((resolve4) => setTimeout(resolve4, LOCK_RETRY_MS));
47366
47366
  }
47367
47367
  }
47368
47368
  }
@@ -48428,7 +48428,7 @@ async function withAgentCredentialLock(wallets, clientId, operation) {
48428
48428
  if (Date.now() >= deadline) {
48429
48429
  throw httpError("Timed out waiting to update the agent credentials.");
48430
48430
  }
48431
- await new Promise((resolve3) => setTimeout(resolve3, 20));
48431
+ await new Promise((resolve4) => setTimeout(resolve4, 20));
48432
48432
  }
48433
48433
  }
48434
48434
  try {
@@ -48581,7 +48581,7 @@ function splitScopes(scope) {
48581
48581
  return scope.split(/\s+/u).filter(Boolean);
48582
48582
  }
48583
48583
  async function sleepFor(milliseconds) {
48584
- await new Promise((resolve3) => setTimeout(resolve3, milliseconds));
48584
+ await new Promise((resolve4) => setTimeout(resolve4, milliseconds));
48585
48585
  }
48586
48586
 
48587
48587
  // ../core/src/keystore.ts
@@ -70062,7 +70062,7 @@ function decryptWithKey(key2, sealed) {
70062
70062
  return Buffer.concat([decipher.update(sealed.ciphertext), decipher.final()]);
70063
70063
  }
70064
70064
  async function deriveScryptKey(passphrase, salt) {
70065
- return await new Promise((resolve3, reject) => {
70065
+ return await new Promise((resolve4, reject) => {
70066
70066
  scrypt(
70067
70067
  passphrase,
70068
70068
  salt,
@@ -70078,7 +70078,7 @@ async function deriveScryptKey(passphrase, salt) {
70078
70078
  reject(error61);
70079
70079
  return;
70080
70080
  }
70081
- resolve3(derivedKey);
70081
+ resolve4(derivedKey);
70082
70082
  }
70083
70083
  );
70084
70084
  });
@@ -70498,7 +70498,7 @@ async function promptForSecret(prompt, noTerminalHint) {
70498
70498
  stdin.setRawMode(true);
70499
70499
  stdin.resume();
70500
70500
  stdin.setEncoding("utf8");
70501
- return await new Promise((resolve3, reject) => {
70501
+ return await new Promise((resolve4, reject) => {
70502
70502
  let value = "";
70503
70503
  const cleanup = () => {
70504
70504
  stdin.off("data", onData);
@@ -70515,7 +70515,7 @@ async function promptForSecret(prompt, noTerminalHint) {
70515
70515
  }
70516
70516
  if (character === "\r" || character === "\n") {
70517
70517
  cleanup();
70518
- resolve3(value);
70518
+ resolve4(value);
70519
70519
  return;
70520
70520
  }
70521
70521
  if (character === "\x7F" || character === "\b") {
@@ -70577,7 +70577,7 @@ async function withAccountMovementLock(home, account, timeoutMs, operation, sign
70577
70577
  if (!(error61 instanceof Error && "code" in error61 && error61.code === "EEXIST")) throw error61;
70578
70578
  await removeStaleLock2(path);
70579
70579
  if (Date.now() >= deadline) throw new AccountMovementLockedError(account);
70580
- await new Promise((resolve3) => setTimeout(resolve3, 20));
70580
+ await new Promise((resolve4) => setTimeout(resolve4, 20));
70581
70581
  }
70582
70582
  }
70583
70583
  const ownedHandle = handle;
@@ -71048,14 +71048,14 @@ function requireSuccess(result, what) {
71048
71048
  function withoutTrailingNewline(value) {
71049
71049
  return value.replace(/\r?\n$/u, "");
71050
71050
  }
71051
- var spawnRunner = async (file2, args, input2) => await new Promise((resolve3) => {
71051
+ var spawnRunner = async (file2, args, input2) => await new Promise((resolve4) => {
71052
71052
  let stdout = "";
71053
71053
  let stderr2 = "";
71054
71054
  let settled = false;
71055
71055
  const finish = (outcome) => {
71056
71056
  if (settled) return;
71057
71057
  settled = true;
71058
- resolve3(outcome);
71058
+ resolve4(outcome);
71059
71059
  };
71060
71060
  const child = spawn(file2, [...args], {
71061
71061
  detached: true,
@@ -72021,7 +72021,7 @@ async function withVaultLock(path, operation) {
72021
72021
  if (Date.now() >= deadline) {
72022
72022
  throw new VaultError("corrupt", "Timed out waiting for the vault lock.");
72023
72023
  }
72024
- await new Promise((resolve3) => setTimeout(resolve3, 20));
72024
+ await new Promise((resolve4) => setTimeout(resolve4, 20));
72025
72025
  }
72026
72026
  }
72027
72027
  try {
@@ -72610,6 +72610,22 @@ var WalletStore = class _WalletStore {
72610
72610
  this.registry = await this.readRegistry();
72611
72611
  return this.snapshot();
72612
72612
  }
72613
+ /**
72614
+ * Re-reads `wallets.json` for a long-running process such as the MCP server.
72615
+ * Unlike `reload`, it never zeroes the cached vault key, because a payment in
72616
+ * flight may still be signing with it. When accounts were added elsewhere the
72617
+ * cached vault is forgotten, so the next unlock reads the vault file again.
72618
+ */
72619
+ async refreshRegistry() {
72620
+ const registry2 = await this.readRegistry();
72621
+ const known = new Set(this.names());
72622
+ if (Object.keys(registry2.wallets).some((name) => !known.has(name))) {
72623
+ this.cachedVault = void 0;
72624
+ this.vaultKey = void 0;
72625
+ }
72626
+ this.registry = registry2;
72627
+ return this.snapshot();
72628
+ }
72613
72629
  /**
72614
72630
  * Picks the wallet a command acts on: an explicit name first, then
72615
72631
  * `VAPI_WALLET`, then the registry default.
@@ -73754,7 +73770,7 @@ async function withRegistryLock(path, operation) {
73754
73770
  if (Date.now() >= deadline) {
73755
73771
  throw new KeystoreError("Timed out waiting for the wallet registry lock.");
73756
73772
  }
73757
- await new Promise((resolve3) => setTimeout(resolve3, 20));
73773
+ await new Promise((resolve4) => setTimeout(resolve4, 20));
73758
73774
  }
73759
73775
  }
73760
73776
  try {
@@ -74100,11 +74116,11 @@ function publicErrorMessage(error61, fallback, sensitiveValues = []) {
74100
74116
  return error61 instanceof Error ? message : fallback;
74101
74117
  }
74102
74118
  async function unrefSleep(milliseconds, signal) {
74103
- await new Promise((resolve3) => {
74119
+ await new Promise((resolve4) => {
74104
74120
  const finish = () => {
74105
74121
  clearTimeout(timer);
74106
74122
  signal?.removeEventListener("abort", finish);
74107
- resolve3();
74123
+ resolve4();
74108
74124
  };
74109
74125
  const timer = setTimeout(finish, milliseconds);
74110
74126
  timer.unref();
@@ -74641,7 +74657,7 @@ async function withLedgerLock(path, operation) {
74641
74657
  if (Date.now() >= deadline) {
74642
74658
  throw new Error("Timed out waiting for the spend ledger lock.");
74643
74659
  }
74644
- await new Promise((resolve3) => setTimeout(resolve3, 20));
74660
+ await new Promise((resolve4) => setTimeout(resolve4, 20));
74645
74661
  }
74646
74662
  }
74647
74663
  try {
@@ -75275,7 +75291,7 @@ async function withTransferLock(context, nonce, operation) {
75275
75291
  if (Date.now() >= deadline) {
75276
75292
  throw new Error("Timed out waiting for the transfer lock.");
75277
75293
  }
75278
- await new Promise((resolve3) => setTimeout(resolve3, 20));
75294
+ await new Promise((resolve4) => setTimeout(resolve4, 20));
75279
75295
  }
75280
75296
  }
75281
75297
  try {
@@ -76993,8 +77009,8 @@ async function sweepAllAboveCeiling(args) {
76993
77009
  }
76994
77010
  var pendingCeilingSweeps = /* @__PURE__ */ new Set();
76995
77011
  function scheduleCeilingSweep(hook) {
76996
- const task = new Promise((resolve3) => {
76997
- setTimeout(resolve3, 0);
77012
+ const task = new Promise((resolve4) => {
77013
+ setTimeout(resolve4, 0);
76998
77014
  }).then(async () => {
76999
77015
  const timeoutMs = hook.timeoutMs ?? CEILING_SWEEP_TIMEOUT_MS;
77000
77016
  const controller = new AbortController();
@@ -77034,8 +77050,8 @@ async function drainCeilingSweeps(timeoutMs = CEILING_SWEEP_TIMEOUT_MS) {
77034
77050
  try {
77035
77051
  await Promise.race([
77036
77052
  Promise.allSettled(pending),
77037
- new Promise((resolve3) => {
77038
- timeout = setTimeout(resolve3, timeoutMs);
77053
+ new Promise((resolve4) => {
77054
+ timeout = setTimeout(resolve4, timeoutMs);
77039
77055
  })
77040
77056
  ]);
77041
77057
  } finally {
@@ -78134,7 +78150,7 @@ function createRunBudget(args) {
78134
78150
  import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
78135
78151
  import { arch, platform, release } from "node:os";
78136
78152
  import { join as join13 } from "node:path";
78137
- var VAPI_CLIENT_VERSION = "0.9.4";
78153
+ var VAPI_CLIENT_VERSION = "0.9.6";
78138
78154
  async function createSupportReport(options) {
78139
78155
  const message = options.message.trim();
78140
78156
  if (!message) throw new Error("Support report message must not be empty.");
@@ -81840,7 +81856,7 @@ var authorizationTypes = {
81840
81856
  function createTasksChain(options) {
81841
81857
  const { account, client, pending, rpcFor } = options;
81842
81858
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
81843
- const sleep = options.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
81859
+ const sleep = options.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
81844
81860
  const randomBytes17 = options.randomBytes ?? cryptoRandomBytes2;
81845
81861
  const confirmations = options.confirmations ?? 2;
81846
81862
  if (!Number.isSafeInteger(confirmations) || confirmations < 1)
@@ -82645,7 +82661,7 @@ async function waitForMilestone(client, input2) {
82645
82661
  throw new RangeError("The milestone wait timeout must be non-negative and finite.");
82646
82662
  if (!Number.isFinite(intervalMs) || intervalMs <= 0)
82647
82663
  throw new RangeError("The milestone wait interval must be positive and finite.");
82648
- const sleep = input2.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
82664
+ const sleep = input2.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
82649
82665
  const now = input2.now ?? (() => /* @__PURE__ */ new Date());
82650
82666
  const started = now().getTime();
82651
82667
  const deadline = started + timeoutMs;
@@ -87399,10 +87415,10 @@ async function buildStatus(deps) {
87399
87415
  const timers = deps.timers ?? { setTimeout, clearTimeout };
87400
87416
  const controller = new AbortController();
87401
87417
  let timeout;
87402
- const deadline = new Promise((resolve3) => {
87418
+ const deadline = new Promise((resolve4) => {
87403
87419
  timeout = timers.setTimeout(() => {
87404
87420
  controller.abort(new Error("Status request deadline exceeded."));
87405
- resolve3();
87421
+ resolve4();
87406
87422
  }, deps.timeoutMs ?? STATUS_TIMEOUT_MS);
87407
87423
  });
87408
87424
  try {
@@ -93399,7 +93415,7 @@ function createAuthTools(options) {
93399
93415
  async link(input2) {
93400
93416
  requireSafeSecretStore(options.secrets);
93401
93417
  requireWalletStore2(options.wallets);
93402
- const wallet = options.session.resolve(input2.account).name;
93418
+ const wallet = (await options.session.resolveLatest(input2.account)).name;
93403
93419
  const existing = pending.get(wallet);
93404
93420
  if (existing !== void 0) return linkResult(wallet, existing);
93405
93421
  let startup = starting.get(wallet);
@@ -93589,6 +93605,7 @@ function createRouterTools(options) {
93589
93605
  return toolResult({ models: models.map((model) => model.id) });
93590
93606
  },
93591
93607
  async usage(input2) {
93608
+ await options.session.resolveLatest(input2.wallet);
93592
93609
  const deps = routerDeps(options, input2.wallet);
93593
93610
  const [usage, stake] = await Promise.all([readUsage(deps), readStake(deps)]);
93594
93611
  return toolResult({
@@ -93602,6 +93619,7 @@ function createRouterTools(options) {
93602
93619
  },
93603
93620
  async chat(input2) {
93604
93621
  const parsed = routerChatInputSchema.parse(input2);
93622
+ await options.session.resolveLatest(parsed.wallet);
93605
93623
  const result = await chat(routerDeps(options, parsed.wallet, unlockedWallet), {
93606
93624
  model: parsed.model,
93607
93625
  messages: parsed.messages,
@@ -94732,9 +94750,23 @@ var WalletSession = class {
94732
94750
  }
94733
94751
  return { name: only };
94734
94752
  }
94753
+ /**
94754
+ * `resolve`, after re-reading `wallets.json` when the name is not known yet.
94755
+ * An account created in a terminal while this server runs works at once; the
94756
+ * session's active account and the human's default stay as they were.
94757
+ */
94758
+ async resolveLatest(name) {
94759
+ const store = this.options.store;
94760
+ const requested = name?.trim();
94761
+ const selection = requested && requested.length > 0 ? requested : this.#active;
94762
+ if (store && selection !== void 0 && !store.has(assertWalletName(selection))) {
94763
+ await store.refreshRegistry();
94764
+ }
94765
+ return this.resolve(name);
94766
+ }
94735
94767
  /** The addresses of an account, read from the vault or a legacy keystore header. */
94736
94768
  async addressesFor(name) {
94737
- const wallet = this.resolve(name);
94769
+ const wallet = await this.resolveLatest(name);
94738
94770
  const store = this.options.store;
94739
94771
  if (!store) {
94740
94772
  const account = this.options.account;
@@ -94762,7 +94794,7 @@ var WalletSession = class {
94762
94794
  * so switching accounts mid-session pays from the account that was asked for.
94763
94795
  */
94764
94796
  async payment(name) {
94765
- const wallet = this.resolve(name);
94797
+ const wallet = await this.resolveLatest(name);
94766
94798
  const store = this.options.store;
94767
94799
  if (!store || wallet.path === void 0) {
94768
94800
  return { wallet, account: this.options.account };
@@ -94770,7 +94802,10 @@ var WalletSession = class {
94770
94802
  const account = await store.hasVaultAccount(wallet.name) ? await store.unlock(wallet.name, "") : await this.#unlockLegacy(wallet);
94771
94803
  return { wallet, account, spendCaps: await spendCapsForWallet(store, wallet.name) };
94772
94804
  }
94773
- /** Every account this machine knows, with the session's own marker on one. */
94805
+ /**
94806
+ * Every account this machine knows, with the session's own marker on one.
94807
+ * `wallets.json` is re-read first, so accounts made in a terminal show up.
94808
+ */
94774
94809
  async list() {
94775
94810
  const store = this.options.store;
94776
94811
  const active = this.#active;
@@ -94787,6 +94822,7 @@ var WalletSession = class {
94787
94822
  }
94788
94823
  ];
94789
94824
  }
94825
+ await store.refreshRegistry();
94790
94826
  return (await store.list()).map((info) => ({
94791
94827
  name: info.name,
94792
94828
  ...info.address === void 0 ? {} : { address: info.address },
@@ -94804,7 +94840,7 @@ var WalletSession = class {
94804
94840
  * an agent pays from changed.
94805
94841
  */
94806
94842
  async use(name) {
94807
- const wallet = this.resolve(assertWalletName(name));
94843
+ const wallet = await this.resolveLatest(assertWalletName(name));
94808
94844
  const previous = this.#active ?? null;
94809
94845
  this.#active = wallet.name;
94810
94846
  let address4;
@@ -95616,13 +95652,16 @@ function createVapiServer(options = {}) {
95616
95652
  inputSchema: {},
95617
95653
  outputSchema: walletListToolResultSchema
95618
95654
  },
95619
- async () => asStructuredToolResult(async () => ({
95620
- wallet: session.activeName ?? null,
95621
- default: session.store?.defaultName ?? session.activeName ?? null,
95622
- wallets: await Promise.all(
95623
- (await session.list()).map((info) => describeWallet(info, config2, guardedFetch2))
95624
- )
95625
- }))
95655
+ async () => asStructuredToolResult(async () => {
95656
+ const accounts2 = await session.list();
95657
+ return {
95658
+ wallet: session.activeName ?? null,
95659
+ default: session.store?.defaultName ?? session.activeName ?? null,
95660
+ wallets: await Promise.all(
95661
+ accounts2.map((info) => describeWallet(info, config2, guardedFetch2))
95662
+ )
95663
+ };
95664
+ })
95626
95665
  );
95627
95666
  server.registerTool(
95628
95667
  "wallet.use",
@@ -95675,7 +95714,7 @@ function createVapiServer(options = {}) {
95675
95714
  ),
95676
95715
  balance
95677
95716
  );
95678
- const ledgerWallet2 = (input2) => input2.allWallets === true ? null : session.resolve(input2.wallet).name;
95717
+ const ledgerWallet2 = async (input2) => input2.allWallets === true ? null : (await session.resolveLatest(input2.wallet)).name;
95679
95718
  server.registerTool(
95680
95719
  "receipts.list",
95681
95720
  {
@@ -95688,7 +95727,7 @@ function createVapiServer(options = {}) {
95688
95727
  outputSchema: external_exports.object({ wallet: external_exports.string().nullable(), receipts: external_exports.array(external_exports.unknown()) })
95689
95728
  },
95690
95729
  async (input2) => asStructuredToolResult(async () => {
95691
- const wallet = ledgerWallet2(input2);
95730
+ const wallet = await ledgerWallet2(input2);
95692
95731
  return {
95693
95732
  wallet,
95694
95733
  receipts: await readReceipts(options.receiptsPath ?? getVapiPaths().receipts, {
@@ -95711,7 +95750,7 @@ function createVapiServer(options = {}) {
95711
95750
  },
95712
95751
  async (input2) => asStructuredToolResult(async () => {
95713
95752
  const paths = getVapiPaths();
95714
- const wallet = ledgerWallet2(input2);
95753
+ const wallet = await ledgerWallet2(input2);
95715
95754
  return {
95716
95755
  wallet,
95717
95756
  ...aggregateStats({
@@ -96115,6 +96154,9 @@ function rgbToAnsi256(red, green, blue) {
96115
96154
  import { readFile as readFile25, stat as stat14 } from "node:fs/promises";
96116
96155
  import { join as join21 } from "node:path";
96117
96156
 
96157
+ // ../cli/src/dashboard.ts
96158
+ import { resolve as resolve3 } from "node:path";
96159
+
96118
96160
  // ../cli/src/publish-client.ts
96119
96161
  var LISTING_CATEGORIES = ["ai", "data", "crypto", "compute", "search"];
96120
96162
  var PROBE_MODES = ["origin", "endpoint", "openapi"];
@@ -96435,7 +96477,8 @@ async function runLoginFlow(argv, json2, io, dependencies, options = {}) {
96435
96477
  booleanOptions: /* @__PURE__ */ new Set(["--publish", "--no-browser"]),
96436
96478
  maximumPositionals: 0
96437
96479
  });
96438
- const target = await targetWallet(parsed, dependencies);
96480
+ const paths = getVapiPaths(options.home);
96481
+ const target = await targetWallet(parsed, dependencies, paths.directory);
96439
96482
  const { account } = await unlockTarget(target, dependencies);
96440
96483
  const label = parsed.one("--label") ?? target.name;
96441
96484
  const scopes = [
@@ -96444,13 +96487,13 @@ async function runLoginFlow(argv, json2, io, dependencies, options = {}) {
96444
96487
  "tasks:write",
96445
96488
  ...parsed.has("--publish") ? ["call.publish"] : []
96446
96489
  ];
96447
- const config2 = await loadConfig(getVapiPaths().config, process.env, { notice: io.stderr });
96448
- const apiBase = registryBaseUrl(config2);
96490
+ const config2 = await loadConfig(paths.config, process.env, { notice: io.stderr });
96491
+ const apiBase = options.apiBase ?? registryBaseUrl(config2);
96449
96492
  const fetchImpl = dependencies.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: false });
96450
96493
  const secrets = getSecretStore(dependencies);
96451
96494
  const device = await ensureDeviceName({
96452
96495
  env: getEnvironment(dependencies),
96453
- configPath: getVapiPaths().config,
96496
+ configPath: paths.config,
96454
96497
  ...dependencies.hostname === void 0 ? {} : { hostname: dependencies.hostname() }
96455
96498
  });
96456
96499
  const bearer = await trustedLinkBearer({
@@ -96704,6 +96747,87 @@ function shortAddress(address4) {
96704
96747
  return address4.length <= 12 ? address4 : `${address4.slice(0, 6)}\u2026${address4.slice(-4)}`;
96705
96748
  }
96706
96749
 
96750
+ // ../cli/src/dashboard.ts
96751
+ function dashboardUrl(apiBase) {
96752
+ return `${apiBase.replace(/\/+$/u, "")}/agents`;
96753
+ }
96754
+ async function offerDashboardLink({
96755
+ name,
96756
+ json: json2,
96757
+ noLink = false,
96758
+ io,
96759
+ dependencies,
96760
+ home = getVapiPaths().directory,
96761
+ apiBase
96762
+ }) {
96763
+ const otherHome = resolve3(home) !== resolve3(getVapiPaths().directory);
96764
+ const command = `${otherHome ? `VAPI_HOME=${shellQuote(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote(apiBase)} `}vapi login --account ${name}`;
96765
+ const unlinked = {
96766
+ linked: false,
96767
+ next: [{ kind: "link", account: name, command }]
96768
+ };
96769
+ const hint = () => {
96770
+ if (!json2) io.stdout(`Run \`${command}\` to see this wallet on your dashboard.`);
96771
+ return unlinked;
96772
+ };
96773
+ try {
96774
+ const store = await WalletStore.open(home, {
96775
+ secrets: getSecretStore(dependencies),
96776
+ env: getEnvironment(dependencies)
96777
+ });
96778
+ if (store.entry(name)?.link !== void 0) return { linked: true };
96779
+ if (noLink || json2 || !isInteractive(dependencies) || activeAgentMarker(getEnvironment(dependencies)) !== void 0) {
96780
+ return hint();
96781
+ }
96782
+ const answer = (await getLinePrompt(dependencies)(`Link ${name} to your vAPI dashboard? [Y/n] `)).trim();
96783
+ if (!/^(?:y|yes)?$/iu.test(answer)) return hint();
96784
+ await runLoginFlow(["--account", name, "--label", name], false, io, dependencies, {
96785
+ home,
96786
+ ...apiBase === void 0 ? {} : { apiBase }
96787
+ });
96788
+ await store.reload();
96789
+ const link3 = store.entry(name)?.link;
96790
+ if (link3 === void 0) return hint();
96791
+ io.stdout(`See it on your dashboard: ${dashboardUrl(link3.apiBase)}`);
96792
+ return { linked: true };
96793
+ } catch (error61) {
96794
+ if (!json2) {
96795
+ io.stderr(`Link not completed: ${error61 instanceof Error ? error61.message : String(error61)}`);
96796
+ }
96797
+ return hint();
96798
+ }
96799
+ }
96800
+ async function dashboardCommand(argv, json2, io, dependencies) {
96801
+ const parsed = parseArguments(argv, {
96802
+ valueOptions: /* @__PURE__ */ new Set(["--wallet"]),
96803
+ booleanOptions: /* @__PURE__ */ new Set(["--no-browser", "--no-link"]),
96804
+ maximumPositionals: 0
96805
+ });
96806
+ const target = await targetWallet(parsed, dependencies);
96807
+ let status = { linked: true };
96808
+ if (target.entry.link === void 0) {
96809
+ if (!json2) io.stdout(`${target.name} is not linked to your vAPI dashboard yet.`);
96810
+ status = await offerDashboardLink({
96811
+ name: target.name,
96812
+ json: json2,
96813
+ noLink: parsed.has("--no-link"),
96814
+ io,
96815
+ dependencies: parsed.has("--no-browser") ? { ...dependencies, openUrl: () => false } : dependencies
96816
+ });
96817
+ }
96818
+ await target.store.reload();
96819
+ const apiBase = target.store.entry(target.name)?.link?.apiBase ?? registryBaseUrl(await readConfig(getVapiPaths().config, io));
96820
+ const url2 = dashboardUrl(apiBase);
96821
+ let opened = false;
96822
+ if (status.linked && !parsed.has("--no-browser") && (dependencies.interactive ?? Boolean(process.stdout.isTTY)) && activeAgentMarker(getEnvironment(dependencies)) === void 0) {
96823
+ opened = (dependencies.openUrl ?? openInBrowser)(url2);
96824
+ }
96825
+ io.stdout(json2 ? JSON.stringify({ account: target.name, url: url2, ...status, opened }) : url2);
96826
+ }
96827
+ function shellQuote(value) {
96828
+ return /^[a-zA-Z0-9_./-]+$/u.test(value) ? value : `'${value.replace(/'/gu, "'\\''")}'`;
96829
+ }
96830
+
96707
96831
  // ../cli/src/status.ts
96708
96832
  import { stat as stat13 } from "node:fs/promises";
96709
96833
  import { homedir as homedir2 } from "node:os";
@@ -99089,10 +99213,10 @@ function apiEndpoint2(apiBase, path) {
99089
99213
  }
99090
99214
  async function sleepFor2(milliseconds, signal) {
99091
99215
  if (signal?.aborted === true) throw signal.reason;
99092
- await new Promise((resolve3, reject) => {
99216
+ await new Promise((resolve4, reject) => {
99093
99217
  const finish = () => {
99094
99218
  signal?.removeEventListener("abort", abort);
99095
- resolve3();
99219
+ resolve4();
99096
99220
  };
99097
99221
  const timeout = setTimeout(finish, milliseconds);
99098
99222
  const abort = () => {
@@ -99427,7 +99551,7 @@ async function readProcessStdin() {
99427
99551
  }
99428
99552
 
99429
99553
  // ../cli/src/version.ts
99430
- var CLI_VERSION = "0.9.4";
99554
+ var CLI_VERSION = "0.9.6";
99431
99555
 
99432
99556
  // ../cli/src/status.ts
99433
99557
  async function statusCommand(argv, json2, io, dependencies) {
@@ -99571,10 +99695,10 @@ async function runStatusSweep(args) {
99571
99695
  timeoutMs,
99572
99696
  ...args.warn === void 0 ? {} : { warn: args.warn }
99573
99697
  }),
99574
- new Promise((resolve3) => {
99698
+ new Promise((resolve4) => {
99575
99699
  timeout = setTimeout(() => {
99576
99700
  controller.abort();
99577
- resolve3();
99701
+ resolve4();
99578
99702
  }, timeoutMs);
99579
99703
  timeout.unref();
99580
99704
  })
@@ -99803,7 +99927,7 @@ async function siblingsFetchImpl(dependencies) {
99803
99927
  function shortAddress3(address4) {
99804
99928
  return address4.length <= 12 ? address4 : `${address4.slice(0, 6)}\u2026${address4.slice(-4)}`;
99805
99929
  }
99806
- async function accountsAddCommand(argv, json2, io, dependencies) {
99930
+ async function accountsAddCommand(argv, json2, io, dependencies, options = { link: "always" }) {
99807
99931
  const parsed = parseArguments(argv, {
99808
99932
  valueOptions: /* @__PURE__ */ new Set(["--label"]),
99809
99933
  booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
@@ -99820,6 +99944,18 @@ async function accountsAddCommand(argv, json2, io, dependencies) {
99820
99944
  });
99821
99945
  await recordAudit(dependencies, "wallet.create", { wallet: created.account });
99822
99946
  const address4 = created.address;
99947
+ if (options.link === "offer") {
99948
+ if (!json2) io.stdout(`Account ${created.account} derived: ${address4}`);
99949
+ const link3 = await offerDashboardLink({
99950
+ name: created.account,
99951
+ json: json2,
99952
+ noLink: parsed.has("--no-link"),
99953
+ io,
99954
+ dependencies
99955
+ });
99956
+ if (json2) io.stdout(JSON.stringify({ account: created.account, address: address4, ...link3 }));
99957
+ return;
99958
+ }
99823
99959
  if (parsed.has("--no-link")) {
99824
99960
  output2(
99825
99961
  io,
@@ -100635,10 +100771,10 @@ async function autoUploadBackup(io, json2, dependencies) {
100635
100771
  const timeoutMs = dependencies.cloudBackup?.uploadTimeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS;
100636
100772
  const controller = new AbortController();
100637
100773
  let timer;
100638
- const timeout = new Promise((resolve3) => {
100774
+ const timeout = new Promise((resolve4) => {
100639
100775
  timer = setTimeout(() => {
100640
100776
  controller.abort();
100641
- resolve3({ status: "skipped", reason: "timeout" });
100777
+ resolve4({ status: "skipped", reason: "timeout" });
100642
100778
  }, timeoutMs);
100643
100779
  timer.unref();
100644
100780
  });
@@ -101862,7 +101998,7 @@ var HTTP_NOT_FOUND_PATTERN = /\b404\b/u;
101862
101998
  var OTHER_SCOPE_PATTERN = /\b(?:project|environment|service|workspace|team|token|user|account|volume|deployment|command|file|directory|module|package)s?\b/iu;
101863
101999
  var SIDECAR_SUFFIX = ".railway.json";
101864
102000
  var MINIMUM_SECRET_LENGTH = 8;
101865
- var defaultRailwayExec = (file2, args) => new Promise((resolve3, reject) => {
102001
+ var defaultRailwayExec = (file2, args) => new Promise((resolve4, reject) => {
101866
102002
  const child = spawn2(file2, [...args], {
101867
102003
  stdio: ["ignore", "pipe", "pipe"],
101868
102004
  env: process.env,
@@ -101877,7 +102013,7 @@ var defaultRailwayExec = (file2, args) => new Promise((resolve3, reject) => {
101877
102013
  stderr2 += chunk;
101878
102014
  });
101879
102015
  child.once("error", reject);
101880
- child.once("close", (code) => resolve3({ code, stdout, stderr: stderr2 }));
102016
+ child.once("close", (code) => resolve4({ code, stdout, stderr: stderr2 }));
101881
102017
  });
101882
102018
  function parseSandboxId(stdout) {
101883
102019
  const trimmed = stdout.trim();
@@ -102010,8 +102146,8 @@ function createRailwayRuntime(options) {
102010
102146
  const readyAttempts = options.readyAttempts ?? DEFAULT_RAILWAY_READY_ATTEMPTS;
102011
102147
  const readyIntervalMs = options.readyIntervalMs ?? DEFAULT_RAILWAY_READY_INTERVAL_MS;
102012
102148
  const signalDestroyTimeoutMs = options.signalDestroyTimeoutMs ?? DEFAULT_RAILWAY_SIGNAL_DESTROY_TIMEOUT_MS;
102013
- const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve3) => {
102014
- setTimeout(resolve3, milliseconds);
102149
+ const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve4) => {
102150
+ setTimeout(resolve4, milliseconds);
102015
102151
  }));
102016
102152
  let secrets = options.secrets;
102017
102153
  const getSecrets = () => secrets ??= secretStore();
@@ -103864,7 +104000,7 @@ function usd(value, minimumDecimals = 0) {
103864
104000
  import { mkdir as mkdir20, readFile as readFile28, writeFile as writeFile11 } from "node:fs/promises";
103865
104001
  import { homedir as systemHomedir } from "node:os";
103866
104002
  import { dirname as dirname14, posix, win32 as win322 } from "node:path";
103867
- var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]";
104003
+ var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
103868
104004
  var APPS = /* @__PURE__ */ new Set(["claude", "cursor", "codex"]);
103869
104005
  var NEXT_STEP = {
103870
104006
  claude: 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
@@ -103905,6 +104041,7 @@ function mcpInstallTarget(app, context) {
103905
104041
  async function mcpInstallCommand(argv, json2, io, dependencies) {
103906
104042
  const parsed = parseArguments(argv, {
103907
104043
  valueOptions: /* @__PURE__ */ new Set(["--home", "--registry"]),
104044
+ booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
103908
104045
  maximumPositionals: 1
103909
104046
  });
103910
104047
  const appValue = parsed.positionals[0];
@@ -103926,13 +104063,39 @@ ${MCP_INSTALL_USAGE}`
103926
104063
  });
103927
104064
  const entry = serverEntry(home, registry2);
103928
104065
  const created = await writeMcpConfig(target, entry);
104066
+ const name = await unlinkedDefaultAccount(home, dependencies);
104067
+ const offerLink = (name2) => offerDashboardLink({
104068
+ name: name2,
104069
+ json: json2,
104070
+ noLink: parsed.has("--no-link"),
104071
+ io,
104072
+ dependencies,
104073
+ home,
104074
+ apiBase: parsed.one("--registry")
104075
+ });
104076
+ const link3 = json2 && name !== void 0 ? await offerLink(name) : {};
103929
104077
  output3(
103930
104078
  io,
103931
104079
  json2,
103932
- { command: "mcp install", app: appValue, path: target.path, created, home, registry: registry2 },
104080
+ { ...link3, command: "mcp install", app: appValue, path: target.path, created, home, registry: registry2 },
103933
104081
  `${created ? "Wrote" : "Updated"} ${target.path}.`
103934
104082
  );
103935
- if (!json2) io.stdout(NEXT_STEP[appValue]);
104083
+ if (!json2) {
104084
+ io.stdout(NEXT_STEP[appValue]);
104085
+ if (name !== void 0) await offerLink(name);
104086
+ }
104087
+ }
104088
+ async function unlinkedDefaultAccount(home, dependencies) {
104089
+ try {
104090
+ const store = await WalletStore.open(home, {
104091
+ secrets: getSecretStore(dependencies),
104092
+ env: getEnvironment(dependencies)
104093
+ });
104094
+ const name = store.defaultName;
104095
+ if (name !== void 0 && store.resolve({ name }).entry.link === void 0) return name;
104096
+ } catch {
104097
+ }
104098
+ return void 0;
103936
104099
  }
103937
104100
  function isMcpInstallApp(value) {
103938
104101
  return APPS.has(value);
@@ -104602,7 +104765,7 @@ async function taskContext(parsed, io, dependencies, publicOnly = false) {
104602
104765
  pending,
104603
104766
  randomUUID: dependencies.tasks?.randomUUID ?? randomUUID6,
104604
104767
  signInHint: "Run vapi login for the acting wallet.",
104605
- sleep: dependencies.tasks?.sleep ?? ((milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds)))
104768
+ sleep: dependencies.tasks?.sleep ?? ((milliseconds) => new Promise((resolve4) => setTimeout(resolve4, milliseconds)))
104606
104769
  };
104607
104770
  }
104608
104771
  async function taskRequest2(verb, route, operation) {
@@ -106402,11 +106565,11 @@ ${usage}`);
106402
106565
  }
106403
106566
  }
106404
106567
  async function referencedSleep(milliseconds, signal) {
106405
- await new Promise((resolve3) => {
106568
+ await new Promise((resolve4) => {
106406
106569
  const finish = () => {
106407
106570
  clearTimeout(timer);
106408
106571
  signal?.removeEventListener("abort", finish);
106409
- resolve3();
106572
+ resolve4();
106410
106573
  };
106411
106574
  const timer = setTimeout(finish, milliseconds);
106412
106575
  if (signal === void 0) return;
@@ -106634,7 +106797,7 @@ var HELP_HEADING = "vAPI Network";
106634
106797
  var HELP = `${HELP_HEADING}
106635
106798
 
106636
106799
  Usage:
106637
- vapi init [--networks <base,arc>] [--json]
106800
+ vapi init [--networks <base,arc>] [--no-link] [--json]
106638
106801
  vapi setup [--no-cloud-backup] [--accounts <n>] [--json]
106639
106802
  vapi accounts [--all] [--json]
106640
106803
  vapi accounts add <name> [--label <text>] [--no-link] [--json]
@@ -106681,6 +106844,7 @@ Usage:
106681
106844
  vapi agent pause <name> [--json]
106682
106845
  vapi agent resume <name> [--json]
106683
106846
  vapi agent revoke <name> [--json]
106847
+ vapi dashboard [--account <name>] [--no-browser] [--json]
106684
106848
  vapi login [--account <name>] [--label <name>] [--publish] [--no-browser] [--json]
106685
106849
  vapi logout [--account <name>] [--json]
106686
106850
  vapi whoami [--account <name>] [--json]
@@ -106731,11 +106895,13 @@ Usage:
106731
106895
  vapi publish list [--json]
106732
106896
  vapi claim <origin> [--account <name>] [--json]
106733
106897
  vapi mcp [--account <name>] [--json]
106734
- vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]
106898
+ vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
106735
106899
  vapi serve [--json]
106736
106900
  vapi version [--json]
106737
106901
  vapi help [--json]
106738
106902
 
106903
+ \`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.
106904
+
106739
106905
  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.
106740
106906
 
106741
106907
  \`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]\`.
@@ -106800,8 +106966,8 @@ var ACCOUNT_OPTION2 = "--account";
106800
106966
  var WALLET_OPTION_DEPRECATION = "--wallet is now --account; --wallet keeps working for one release.";
106801
106967
  var SOLANA_VAULT_UNAVAILABLE2 = "Solana keys are not part of the device vault yet.";
106802
106968
  var INCLUDE_UNVERIFIED_OPTION = "--include-unverified";
106803
- async function openWalletStore(dependencies) {
106804
- return await WalletStore.open(getVapiPaths().directory, {
106969
+ async function openWalletStore(dependencies, home = getVapiPaths().directory) {
106970
+ return await WalletStore.open(home, {
106805
106971
  secrets: getSecretStore(dependencies),
106806
106972
  env: getEnvironment(dependencies),
106807
106973
  ...dependencies.now === void 0 ? {} : { now: dependencies.now }
@@ -106816,8 +106982,8 @@ async function selectWallet(store, parsed, dependencies) {
106816
106982
  const address4 = await store.readAddress(resolved.name);
106817
106983
  return { store, ...resolved, ...address4 === void 0 ? {} : { address: address4 } };
106818
106984
  }
106819
- async function targetWallet(parsed, dependencies) {
106820
- return await selectWallet(await openWalletStore(dependencies), parsed, dependencies);
106985
+ async function targetWallet(parsed, dependencies, home = getVapiPaths().directory) {
106986
+ return await selectWallet(await openWalletStore(dependencies, home), parsed, dependencies);
106821
106987
  }
106822
106988
  function getSecretStore(dependencies) {
106823
106989
  return dependencies.secretStore ?? secretStore();
@@ -106996,6 +107162,10 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
106996
107162
  case "agent":
106997
107163
  exitCode = await agentCommand(args.slice(1), json2, runIo, dependencies);
106998
107164
  break;
107165
+ case "dashboard":
107166
+ await dashboardCommand(args.slice(1), json2, io, dependencies);
107167
+ exitCode = 0;
107168
+ break;
106999
107169
  case "login":
107000
107170
  await loginCommand(args.slice(1), json2, io, dependencies);
107001
107171
  exitCode = 0;
@@ -107210,6 +107380,7 @@ function shouldAutoUploadAfterFailure(args) {
107210
107380
  async function initCommand(argv, json2, io, dependencies) {
107211
107381
  const parsed = parseArguments(argv, {
107212
107382
  valueOptions: /* @__PURE__ */ new Set(["--networks"]),
107383
+ booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
107213
107384
  maximumPositionals: 0
107214
107385
  });
107215
107386
  const networks = parseInitNetworks(parsed.one("--networks") ?? "base");
@@ -107257,7 +107428,14 @@ async function initCommand(argv, json2, io, dependencies) {
107257
107428
  nextSteps: buildNextSteps(account.address)
107258
107429
  };
107259
107430
  if (json2) {
107260
- io.stdout(JSON.stringify(result));
107431
+ const link3 = await offerDashboardLink({
107432
+ name: created.name,
107433
+ json: json2,
107434
+ noLink: parsed.has("--no-link"),
107435
+ io,
107436
+ dependencies
107437
+ });
107438
+ io.stdout(JSON.stringify({ ...result, ...link3 }));
107261
107439
  return;
107262
107440
  }
107263
107441
  if (configRewrites.length > 0) io.stdout(formatLegacyRegistryRewrites(configRewrites));
@@ -107278,6 +107456,13 @@ async function initCommand(argv, json2, io, dependencies) {
107278
107456
  io.stdout(formatAccounts(accounts));
107279
107457
  io.stdout("");
107280
107458
  io.stdout(result.nextSteps.join("\n"));
107459
+ await offerDashboardLink({
107460
+ name: created.name,
107461
+ json: json2,
107462
+ noLink: parsed.has("--no-link"),
107463
+ io,
107464
+ dependencies
107465
+ });
107281
107466
  }
107282
107467
  var INIT_ALREADY_DONE = "This machine already has a wallet, so vapi init created nothing.";
107283
107468
  async function reportExistingWallets(store, json2, io, dependencies) {
@@ -107313,12 +107498,11 @@ async function walletCommand(argv, json2, io, dependencies) {
107313
107498
  `Unknown wallet subcommand ${JSON.stringify(subcommand)}. ${WALLET_USAGE}`
107314
107499
  );
107315
107500
  }
107316
- await accountsCommand(
107317
- [mapped2, ...rest, ...subcommand === "create" ? ["--no-link"] : []],
107318
- json2,
107319
- io,
107320
- dependencies
107321
- );
107501
+ if (subcommand === "create") {
107502
+ await accountsAddCommand(rest, json2, io, dependencies, { link: "offer" });
107503
+ return;
107504
+ }
107505
+ await accountsCommand([mapped2, ...rest], json2, io, dependencies);
107322
107506
  }
107323
107507
  async function unlockedWallets(walletsStore, wallets, dependencies) {
107324
107508
  const secrets = getSecretStore(dependencies);
@@ -107860,8 +108044,8 @@ async function fetchNetworkStats(dependencies) {
107860
108044
  })();
107861
108045
  let timeout;
107862
108046
  try {
107863
- const timedOut = new Promise((resolve3) => {
107864
- timeout = setTimeout(() => resolve3(null), NETWORK_STATS_REQUEST_TIMEOUT_MS);
108047
+ const timedOut = new Promise((resolve4) => {
108048
+ timeout = setTimeout(() => resolve4(null), NETWORK_STATS_REQUEST_TIMEOUT_MS);
107865
108049
  });
107866
108050
  return await Promise.race([request, timedOut]);
107867
108051
  } finally {
@@ -109542,10 +109726,10 @@ async function checkForUpdate(options = {}) {
109542
109726
  try {
109543
109727
  return await Promise.race([
109544
109728
  latestNotice(options, env, controller.signal),
109545
- new Promise((resolve3) => {
109729
+ new Promise((resolve4) => {
109546
109730
  timer = setTimeout(() => {
109547
109731
  controller.abort();
109548
- resolve3(void 0);
109732
+ resolve4(void 0);
109549
109733
  }, CHECK_TIMEOUT_MS);
109550
109734
  })
109551
109735
  ]);