@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/README.md +8 -1
- package/dist/accounts.d.ts +3 -1
- package/dist/cli.d.ts +3 -3
- package/dist/cli.js +293 -109
- package/dist/cli.js.map +3 -3
- package/dist/dashboard.d.ts +24 -0
- package/dist/index.js +293 -109
- package/dist/index.js.map +3 -3
- package/dist/login.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9442,13 +9442,13 @@ var init_getCallError = __esm({
|
|
|
9442
9442
|
|
|
9443
9443
|
// ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withResolvers.js
|
|
9444
9444
|
function withResolvers() {
|
|
9445
|
-
let
|
|
9445
|
+
let resolve3 = () => void 0;
|
|
9446
9446
|
let reject = () => void 0;
|
|
9447
9447
|
const promise2 = new Promise((resolve_, reject_) => {
|
|
9448
|
-
|
|
9448
|
+
resolve3 = resolve_;
|
|
9449
9449
|
reject = reject_;
|
|
9450
9450
|
});
|
|
9451
|
-
return { promise: promise2, resolve:
|
|
9451
|
+
return { promise: promise2, resolve: resolve3, reject };
|
|
9452
9452
|
}
|
|
9453
9453
|
var init_withResolvers = __esm({
|
|
9454
9454
|
"../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withResolvers.js"() {
|
|
@@ -9467,8 +9467,8 @@ function createBatchScheduler({ fn, id: id2, shouldSplitBatch, wait: wait2 = 0,
|
|
|
9467
9467
|
if (sort && Array.isArray(data))
|
|
9468
9468
|
data.sort(sort);
|
|
9469
9469
|
for (let i = 0; i < scheduler.length; i++) {
|
|
9470
|
-
const { resolve:
|
|
9471
|
-
|
|
9470
|
+
const { resolve: resolve3 } = scheduler[i];
|
|
9471
|
+
resolve3?.([data[i], data]);
|
|
9472
9472
|
}
|
|
9473
9473
|
}).catch((err) => {
|
|
9474
9474
|
for (let i = 0; i < scheduler.length; i++) {
|
|
@@ -9484,16 +9484,16 @@ function createBatchScheduler({ fn, id: id2, shouldSplitBatch, wait: wait2 = 0,
|
|
|
9484
9484
|
return {
|
|
9485
9485
|
flush,
|
|
9486
9486
|
async schedule(args) {
|
|
9487
|
-
const { promise: promise2, resolve:
|
|
9487
|
+
const { promise: promise2, resolve: resolve3, reject } = withResolvers();
|
|
9488
9488
|
const split2 = shouldSplitBatch?.([...getBatchedArgs(), args]);
|
|
9489
9489
|
if (split2)
|
|
9490
9490
|
exec();
|
|
9491
9491
|
const hasActiveScheduler = getScheduler().length > 0;
|
|
9492
9492
|
if (hasActiveScheduler) {
|
|
9493
|
-
setScheduler({ args, resolve:
|
|
9493
|
+
setScheduler({ args, resolve: resolve3, reject });
|
|
9494
9494
|
return promise2;
|
|
9495
9495
|
}
|
|
9496
|
-
setScheduler({ args, resolve:
|
|
9496
|
+
setScheduler({ args, resolve: resolve3, reject });
|
|
9497
9497
|
setTimeout(exec, wait2);
|
|
9498
9498
|
return promise2;
|
|
9499
9499
|
}
|
|
@@ -30773,7 +30773,7 @@ function observe(observerId, callbacks, fn) {
|
|
|
30773
30773
|
// ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/wait.js
|
|
30774
30774
|
init_utils3();
|
|
30775
30775
|
async function wait(time3, { signal } = {}) {
|
|
30776
|
-
return new Promise((
|
|
30776
|
+
return new Promise((resolve3, reject) => {
|
|
30777
30777
|
if (signal?.aborted) {
|
|
30778
30778
|
reject(getAbortError(signal));
|
|
30779
30779
|
return;
|
|
@@ -30781,7 +30781,7 @@ async function wait(time3, { signal } = {}) {
|
|
|
30781
30781
|
const cleanup = () => signal?.removeEventListener("abort", onAbort);
|
|
30782
30782
|
const timeout = setTimeout(() => {
|
|
30783
30783
|
cleanup();
|
|
30784
|
-
|
|
30784
|
+
resolve3();
|
|
30785
30785
|
}, time3);
|
|
30786
30786
|
const onAbort = () => {
|
|
30787
30787
|
clearTimeout(timeout);
|
|
@@ -31357,7 +31357,7 @@ init_withResolvers();
|
|
|
31357
31357
|
// ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withRetry.js
|
|
31358
31358
|
init_utils3();
|
|
31359
31359
|
function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shouldRetry2 = () => true, signal } = {}) {
|
|
31360
|
-
return new Promise((
|
|
31360
|
+
return new Promise((resolve3, reject) => {
|
|
31361
31361
|
const attemptRetry = async ({ count = 0 } = {}) => {
|
|
31362
31362
|
if (signal?.aborted) {
|
|
31363
31363
|
reject(getAbortError(signal));
|
|
@@ -31377,7 +31377,7 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
|
|
|
31377
31377
|
};
|
|
31378
31378
|
try {
|
|
31379
31379
|
const data = await fn();
|
|
31380
|
-
|
|
31380
|
+
resolve3(data);
|
|
31381
31381
|
} catch (err) {
|
|
31382
31382
|
if (signal?.aborted) {
|
|
31383
31383
|
reject(getAbortError(signal));
|
|
@@ -31528,7 +31528,7 @@ async function sendCalls(client, parameters) {
|
|
|
31528
31528
|
results.push({ reason, status: "rejected" });
|
|
31529
31529
|
}
|
|
31530
31530
|
if (experimental_fallbackDelay > 0)
|
|
31531
|
-
await new Promise((
|
|
31531
|
+
await new Promise((resolve3) => setTimeout(resolve3, experimental_fallbackDelay));
|
|
31532
31532
|
}
|
|
31533
31533
|
if (results.every((r) => r.status === "rejected"))
|
|
31534
31534
|
throw results[0].reason;
|
|
@@ -31631,9 +31631,9 @@ async function waitForCallsStatus(client, parameters) {
|
|
|
31631
31631
|
throwOnFailure = false
|
|
31632
31632
|
} = parameters;
|
|
31633
31633
|
const observerId = stringify(["waitForCallsStatus", client.uid, id2]);
|
|
31634
|
-
const { promise: promise2, resolve:
|
|
31634
|
+
const { promise: promise2, resolve: resolve3, reject } = withResolvers();
|
|
31635
31635
|
let timer;
|
|
31636
|
-
const unobserve = observe(observerId, { resolve:
|
|
31636
|
+
const unobserve = observe(observerId, { resolve: resolve3, reject }, (emit) => {
|
|
31637
31637
|
const unpoll = poll(async () => {
|
|
31638
31638
|
const done = (fn) => {
|
|
31639
31639
|
clearTimeout(timer);
|
|
@@ -32015,13 +32015,13 @@ async function isImageUri(uri) {
|
|
|
32015
32015
|
}
|
|
32016
32016
|
if (!Object.hasOwn(globalThis, "Image"))
|
|
32017
32017
|
return false;
|
|
32018
|
-
return new Promise((
|
|
32018
|
+
return new Promise((resolve3) => {
|
|
32019
32019
|
const img = new Image();
|
|
32020
32020
|
img.onload = () => {
|
|
32021
|
-
|
|
32021
|
+
resolve3(true);
|
|
32022
32022
|
};
|
|
32023
32023
|
img.onerror = () => {
|
|
32024
|
-
|
|
32024
|
+
resolve3(false);
|
|
32025
32025
|
};
|
|
32026
32026
|
img.src = uri;
|
|
32027
32027
|
});
|
|
@@ -33484,7 +33484,7 @@ init_utils3();
|
|
|
33484
33484
|
// ../../node_modules/.pnpm/viem@2.56.1_typescript@6.0.3_zod@4.5.4/node_modules/viem/_esm/utils/promise/withTimeout.js
|
|
33485
33485
|
init_utils3();
|
|
33486
33486
|
function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, signal }) {
|
|
33487
|
-
return new Promise((
|
|
33487
|
+
return new Promise((resolve3, reject) => {
|
|
33488
33488
|
;
|
|
33489
33489
|
(async () => {
|
|
33490
33490
|
let timeoutId;
|
|
@@ -33499,7 +33499,7 @@ function withTimeout(fn, { errorInstance = new Error("timed out"), timeout, sign
|
|
|
33499
33499
|
}
|
|
33500
33500
|
}, timeout);
|
|
33501
33501
|
}
|
|
33502
|
-
|
|
33502
|
+
resolve3(await fn({ signal: controller?.signal || null }));
|
|
33503
33503
|
} catch (err) {
|
|
33504
33504
|
if (controller?.signal.aborted && isAbortError(err)) {
|
|
33505
33505
|
reject(errorInstance);
|
|
@@ -37479,13 +37479,13 @@ async function waitForTransactionReceipt(client, parameters) {
|
|
|
37479
37479
|
let retrying = false;
|
|
37480
37480
|
let _unobserve;
|
|
37481
37481
|
let _unwatch;
|
|
37482
|
-
const { promise: promise2, resolve:
|
|
37482
|
+
const { promise: promise2, resolve: resolve3, reject } = withResolvers();
|
|
37483
37483
|
const timer = timeout ? setTimeout(() => {
|
|
37484
37484
|
_unwatch?.();
|
|
37485
37485
|
_unobserve?.();
|
|
37486
37486
|
reject(new WaitForTransactionReceiptTimeoutError({ hash: hash5 }));
|
|
37487
37487
|
}, timeout) : void 0;
|
|
37488
|
-
_unobserve = observe(observerId, { onReplaced, resolve:
|
|
37488
|
+
_unobserve = observe(observerId, { onReplaced, resolve: resolve3, reject }, async (emit) => {
|
|
37489
37489
|
receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({ hash: hash5 }).catch(() => void 0);
|
|
37490
37490
|
if (receipt && confirmations <= 1) {
|
|
37491
37491
|
clearTimeout(timer);
|
|
@@ -43444,7 +43444,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
|
43444
43444
|
coalescedRequest.numConsumers++;
|
|
43445
43445
|
if (signal) {
|
|
43446
43446
|
const responsePromise = coalescedRequest.responsePromise;
|
|
43447
|
-
return await new Promise((
|
|
43447
|
+
return await new Promise((resolve3, reject) => {
|
|
43448
43448
|
const handleAbort = (e22) => {
|
|
43449
43449
|
signal.removeEventListener("abort", handleAbort);
|
|
43450
43450
|
coalescedRequest.numConsumers -= 1;
|
|
@@ -43457,7 +43457,7 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
|
|
|
43457
43457
|
reject(e22.target.reason);
|
|
43458
43458
|
};
|
|
43459
43459
|
signal.addEventListener("abort", handleAbort);
|
|
43460
|
-
responsePromise.then(
|
|
43460
|
+
responsePromise.then(resolve3).catch(reject).finally(() => {
|
|
43461
43461
|
signal.removeEventListener("abort", handleAbort);
|
|
43462
43462
|
});
|
|
43463
43463
|
});
|
|
@@ -44840,7 +44840,7 @@ function createPublicFetch(options) {
|
|
|
44840
44840
|
});
|
|
44841
44841
|
const normalized = new Request(input2, init);
|
|
44842
44842
|
const bytes = normalized.body ? Buffer.from(await normalized.arrayBuffer()) : null;
|
|
44843
|
-
return await new Promise((
|
|
44843
|
+
return await new Promise((resolve3, reject) => {
|
|
44844
44844
|
const requestOptions2 = {
|
|
44845
44845
|
method: normalized.method,
|
|
44846
44846
|
headers: Object.fromEntries(normalized.headers),
|
|
@@ -44865,7 +44865,7 @@ function createPublicFetch(options) {
|
|
|
44865
44865
|
{ status, statusText: incoming.statusMessage, headers }
|
|
44866
44866
|
);
|
|
44867
44867
|
Object.defineProperty(response, "url", { value: url2.toString() });
|
|
44868
|
-
|
|
44868
|
+
resolve3(response);
|
|
44869
44869
|
} catch (error61) {
|
|
44870
44870
|
incoming.destroy();
|
|
44871
44871
|
reject(error61);
|
|
@@ -45634,8 +45634,8 @@ var svmFetchQueue = Promise.resolve();
|
|
|
45634
45634
|
async function withGuardedSvmFetch(fetchImpl, operation) {
|
|
45635
45635
|
const previous = svmFetchQueue;
|
|
45636
45636
|
let release2;
|
|
45637
|
-
svmFetchQueue = new Promise((
|
|
45638
|
-
release2 =
|
|
45637
|
+
svmFetchQueue = new Promise((resolve3) => {
|
|
45638
|
+
release2 = resolve3;
|
|
45639
45639
|
});
|
|
45640
45640
|
await previous;
|
|
45641
45641
|
const originalFetch = globalThis.fetch;
|
|
@@ -46848,7 +46848,7 @@ async function withFileLock(lockPath, fn, options = {}) {
|
|
|
46848
46848
|
if (Date.now() >= deadline) {
|
|
46849
46849
|
throw new FileLockedError(options.lockedMessage);
|
|
46850
46850
|
}
|
|
46851
|
-
await new Promise((
|
|
46851
|
+
await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
|
|
46852
46852
|
continue;
|
|
46853
46853
|
}
|
|
46854
46854
|
handle = candidate;
|
|
@@ -46863,7 +46863,7 @@ async function withFileLock(lockPath, fn, options = {}) {
|
|
|
46863
46863
|
if (Date.now() >= deadline) {
|
|
46864
46864
|
throw new FileLockedError(options.lockedMessage);
|
|
46865
46865
|
}
|
|
46866
|
-
await new Promise((
|
|
46866
|
+
await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
|
|
46867
46867
|
}
|
|
46868
46868
|
}
|
|
46869
46869
|
const ownedHandle = handle;
|
|
@@ -46984,7 +46984,7 @@ async function restoreRenamedLock(path, tombPath) {
|
|
|
46984
46984
|
} catch (error61) {
|
|
46985
46985
|
if (hasCode(error61, "ENOENT")) return;
|
|
46986
46986
|
if (!hasCode(error61, "EEXIST")) throw error61;
|
|
46987
|
-
await new Promise((
|
|
46987
|
+
await new Promise((resolve3) => setTimeout(resolve3, LOCK_RETRY_MS));
|
|
46988
46988
|
}
|
|
46989
46989
|
}
|
|
46990
46990
|
}
|
|
@@ -47983,7 +47983,7 @@ async function withAgentCredentialLock(wallets, clientId, operation) {
|
|
|
47983
47983
|
if (Date.now() >= deadline) {
|
|
47984
47984
|
throw httpError("Timed out waiting to update the agent credentials.");
|
|
47985
47985
|
}
|
|
47986
|
-
await new Promise((
|
|
47986
|
+
await new Promise((resolve3) => setTimeout(resolve3, 20));
|
|
47987
47987
|
}
|
|
47988
47988
|
}
|
|
47989
47989
|
try {
|
|
@@ -48136,7 +48136,7 @@ function splitScopes(scope) {
|
|
|
48136
48136
|
return scope.split(/\s+/u).filter(Boolean);
|
|
48137
48137
|
}
|
|
48138
48138
|
async function sleepFor(milliseconds) {
|
|
48139
|
-
await new Promise((
|
|
48139
|
+
await new Promise((resolve3) => setTimeout(resolve3, milliseconds));
|
|
48140
48140
|
}
|
|
48141
48141
|
|
|
48142
48142
|
// ../core/src/keystore.ts
|
|
@@ -69614,7 +69614,7 @@ function decryptWithKey(key2, sealed) {
|
|
|
69614
69614
|
return Buffer.concat([decipher.update(sealed.ciphertext), decipher.final()]);
|
|
69615
69615
|
}
|
|
69616
69616
|
async function deriveScryptKey(passphrase, salt) {
|
|
69617
|
-
return await new Promise((
|
|
69617
|
+
return await new Promise((resolve3, reject) => {
|
|
69618
69618
|
scrypt(
|
|
69619
69619
|
passphrase,
|
|
69620
69620
|
salt,
|
|
@@ -69630,7 +69630,7 @@ async function deriveScryptKey(passphrase, salt) {
|
|
|
69630
69630
|
reject(error61);
|
|
69631
69631
|
return;
|
|
69632
69632
|
}
|
|
69633
|
-
|
|
69633
|
+
resolve3(derivedKey);
|
|
69634
69634
|
}
|
|
69635
69635
|
);
|
|
69636
69636
|
});
|
|
@@ -69954,7 +69954,7 @@ async function promptForSecret(prompt, noTerminalHint) {
|
|
|
69954
69954
|
stdin.setRawMode(true);
|
|
69955
69955
|
stdin.resume();
|
|
69956
69956
|
stdin.setEncoding("utf8");
|
|
69957
|
-
return await new Promise((
|
|
69957
|
+
return await new Promise((resolve3, reject) => {
|
|
69958
69958
|
let value = "";
|
|
69959
69959
|
const cleanup = () => {
|
|
69960
69960
|
stdin.off("data", onData);
|
|
@@ -69971,7 +69971,7 @@ async function promptForSecret(prompt, noTerminalHint) {
|
|
|
69971
69971
|
}
|
|
69972
69972
|
if (character === "\r" || character === "\n") {
|
|
69973
69973
|
cleanup();
|
|
69974
|
-
|
|
69974
|
+
resolve3(value);
|
|
69975
69975
|
return;
|
|
69976
69976
|
}
|
|
69977
69977
|
if (character === "\x7F" || character === "\b") {
|
|
@@ -70033,7 +70033,7 @@ async function withAccountMovementLock(home, account, timeoutMs, operation, sign
|
|
|
70033
70033
|
if (!(error61 instanceof Error && "code" in error61 && error61.code === "EEXIST")) throw error61;
|
|
70034
70034
|
await removeStaleLock2(path);
|
|
70035
70035
|
if (Date.now() >= deadline) throw new AccountMovementLockedError(account);
|
|
70036
|
-
await new Promise((
|
|
70036
|
+
await new Promise((resolve3) => setTimeout(resolve3, 20));
|
|
70037
70037
|
}
|
|
70038
70038
|
}
|
|
70039
70039
|
const ownedHandle = handle;
|
|
@@ -70504,14 +70504,14 @@ function requireSuccess(result, what) {
|
|
|
70504
70504
|
function withoutTrailingNewline(value) {
|
|
70505
70505
|
return value.replace(/\r?\n$/u, "");
|
|
70506
70506
|
}
|
|
70507
|
-
var spawnRunner = async (file2, args, input2) => await new Promise((
|
|
70507
|
+
var spawnRunner = async (file2, args, input2) => await new Promise((resolve3) => {
|
|
70508
70508
|
let stdout = "";
|
|
70509
70509
|
let stderr2 = "";
|
|
70510
70510
|
let settled = false;
|
|
70511
70511
|
const finish = (outcome) => {
|
|
70512
70512
|
if (settled) return;
|
|
70513
70513
|
settled = true;
|
|
70514
|
-
|
|
70514
|
+
resolve3(outcome);
|
|
70515
70515
|
};
|
|
70516
70516
|
const child = spawn(file2, [...args], {
|
|
70517
70517
|
detached: true,
|
|
@@ -71474,7 +71474,7 @@ async function withVaultLock(path, operation) {
|
|
|
71474
71474
|
if (Date.now() >= deadline) {
|
|
71475
71475
|
throw new VaultError("corrupt", "Timed out waiting for the vault lock.");
|
|
71476
71476
|
}
|
|
71477
|
-
await new Promise((
|
|
71477
|
+
await new Promise((resolve3) => setTimeout(resolve3, 20));
|
|
71478
71478
|
}
|
|
71479
71479
|
}
|
|
71480
71480
|
try {
|
|
@@ -72063,6 +72063,22 @@ var WalletStore = class _WalletStore {
|
|
|
72063
72063
|
this.registry = await this.readRegistry();
|
|
72064
72064
|
return this.snapshot();
|
|
72065
72065
|
}
|
|
72066
|
+
/**
|
|
72067
|
+
* Re-reads `wallets.json` for a long-running process such as the MCP server.
|
|
72068
|
+
* Unlike `reload`, it never zeroes the cached vault key, because a payment in
|
|
72069
|
+
* flight may still be signing with it. When accounts were added elsewhere the
|
|
72070
|
+
* cached vault is forgotten, so the next unlock reads the vault file again.
|
|
72071
|
+
*/
|
|
72072
|
+
async refreshRegistry() {
|
|
72073
|
+
const registry2 = await this.readRegistry();
|
|
72074
|
+
const known = new Set(this.names());
|
|
72075
|
+
if (Object.keys(registry2.wallets).some((name) => !known.has(name))) {
|
|
72076
|
+
this.cachedVault = void 0;
|
|
72077
|
+
this.vaultKey = void 0;
|
|
72078
|
+
}
|
|
72079
|
+
this.registry = registry2;
|
|
72080
|
+
return this.snapshot();
|
|
72081
|
+
}
|
|
72066
72082
|
/**
|
|
72067
72083
|
* Picks the wallet a command acts on: an explicit name first, then
|
|
72068
72084
|
* `VAPI_WALLET`, then the registry default.
|
|
@@ -73207,7 +73223,7 @@ async function withRegistryLock(path, operation) {
|
|
|
73207
73223
|
if (Date.now() >= deadline) {
|
|
73208
73224
|
throw new KeystoreError("Timed out waiting for the wallet registry lock.");
|
|
73209
73225
|
}
|
|
73210
|
-
await new Promise((
|
|
73226
|
+
await new Promise((resolve3) => setTimeout(resolve3, 20));
|
|
73211
73227
|
}
|
|
73212
73228
|
}
|
|
73213
73229
|
try {
|
|
@@ -73553,11 +73569,11 @@ function publicErrorMessage(error61, fallback, sensitiveValues = []) {
|
|
|
73553
73569
|
return error61 instanceof Error ? message : fallback;
|
|
73554
73570
|
}
|
|
73555
73571
|
async function unrefSleep(milliseconds, signal) {
|
|
73556
|
-
await new Promise((
|
|
73572
|
+
await new Promise((resolve3) => {
|
|
73557
73573
|
const finish = () => {
|
|
73558
73574
|
clearTimeout(timer);
|
|
73559
73575
|
signal?.removeEventListener("abort", finish);
|
|
73560
|
-
|
|
73576
|
+
resolve3();
|
|
73561
73577
|
};
|
|
73562
73578
|
const timer = setTimeout(finish, milliseconds);
|
|
73563
73579
|
timer.unref();
|
|
@@ -74094,7 +74110,7 @@ async function withLedgerLock(path, operation) {
|
|
|
74094
74110
|
if (Date.now() >= deadline) {
|
|
74095
74111
|
throw new Error("Timed out waiting for the spend ledger lock.");
|
|
74096
74112
|
}
|
|
74097
|
-
await new Promise((
|
|
74113
|
+
await new Promise((resolve3) => setTimeout(resolve3, 20));
|
|
74098
74114
|
}
|
|
74099
74115
|
}
|
|
74100
74116
|
try {
|
|
@@ -74728,7 +74744,7 @@ async function withTransferLock(context, nonce, operation) {
|
|
|
74728
74744
|
if (Date.now() >= deadline) {
|
|
74729
74745
|
throw new Error("Timed out waiting for the transfer lock.");
|
|
74730
74746
|
}
|
|
74731
|
-
await new Promise((
|
|
74747
|
+
await new Promise((resolve3) => setTimeout(resolve3, 20));
|
|
74732
74748
|
}
|
|
74733
74749
|
}
|
|
74734
74750
|
try {
|
|
@@ -76446,8 +76462,8 @@ async function sweepAllAboveCeiling(args) {
|
|
|
76446
76462
|
}
|
|
76447
76463
|
var pendingCeilingSweeps = /* @__PURE__ */ new Set();
|
|
76448
76464
|
function scheduleCeilingSweep(hook) {
|
|
76449
|
-
const task = new Promise((
|
|
76450
|
-
setTimeout(
|
|
76465
|
+
const task = new Promise((resolve3) => {
|
|
76466
|
+
setTimeout(resolve3, 0);
|
|
76451
76467
|
}).then(async () => {
|
|
76452
76468
|
const timeoutMs = hook.timeoutMs ?? CEILING_SWEEP_TIMEOUT_MS;
|
|
76453
76469
|
const controller = new AbortController();
|
|
@@ -76487,8 +76503,8 @@ async function drainCeilingSweeps(timeoutMs = CEILING_SWEEP_TIMEOUT_MS) {
|
|
|
76487
76503
|
try {
|
|
76488
76504
|
await Promise.race([
|
|
76489
76505
|
Promise.allSettled(pending),
|
|
76490
|
-
new Promise((
|
|
76491
|
-
timeout = setTimeout(
|
|
76506
|
+
new Promise((resolve3) => {
|
|
76507
|
+
timeout = setTimeout(resolve3, timeoutMs);
|
|
76492
76508
|
})
|
|
76493
76509
|
]);
|
|
76494
76510
|
} finally {
|
|
@@ -77587,7 +77603,7 @@ function createRunBudget(args) {
|
|
|
77587
77603
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
77588
77604
|
import { arch, platform, release } from "node:os";
|
|
77589
77605
|
import { join as join13 } from "node:path";
|
|
77590
|
-
var VAPI_CLIENT_VERSION = "0.9.
|
|
77606
|
+
var VAPI_CLIENT_VERSION = "0.9.6";
|
|
77591
77607
|
async function createSupportReport(options) {
|
|
77592
77608
|
const message = options.message.trim();
|
|
77593
77609
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -81293,7 +81309,7 @@ var authorizationTypes = {
|
|
|
81293
81309
|
function createTasksChain(options) {
|
|
81294
81310
|
const { account, client, pending, rpcFor } = options;
|
|
81295
81311
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
81296
|
-
const sleep = options.sleep ?? ((ms) => new Promise((
|
|
81312
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
|
|
81297
81313
|
const randomBytes17 = options.randomBytes ?? cryptoRandomBytes2;
|
|
81298
81314
|
const confirmations = options.confirmations ?? 2;
|
|
81299
81315
|
if (!Number.isSafeInteger(confirmations) || confirmations < 1)
|
|
@@ -82098,7 +82114,7 @@ async function waitForMilestone(client, input2) {
|
|
|
82098
82114
|
throw new RangeError("The milestone wait timeout must be non-negative and finite.");
|
|
82099
82115
|
if (!Number.isFinite(intervalMs) || intervalMs <= 0)
|
|
82100
82116
|
throw new RangeError("The milestone wait interval must be positive and finite.");
|
|
82101
|
-
const sleep = input2.sleep ?? ((ms) => new Promise((
|
|
82117
|
+
const sleep = input2.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
|
|
82102
82118
|
const now = input2.now ?? (() => /* @__PURE__ */ new Date());
|
|
82103
82119
|
const started = now().getTime();
|
|
82104
82120
|
const deadline = started + timeoutMs;
|
|
@@ -86700,10 +86716,10 @@ async function buildStatus(deps) {
|
|
|
86700
86716
|
const timers = deps.timers ?? { setTimeout, clearTimeout };
|
|
86701
86717
|
const controller = new AbortController();
|
|
86702
86718
|
let timeout;
|
|
86703
|
-
const deadline = new Promise((
|
|
86719
|
+
const deadline = new Promise((resolve3) => {
|
|
86704
86720
|
timeout = timers.setTimeout(() => {
|
|
86705
86721
|
controller.abort(new Error("Status request deadline exceeded."));
|
|
86706
|
-
|
|
86722
|
+
resolve3();
|
|
86707
86723
|
}, deps.timeoutMs ?? STATUS_TIMEOUT_MS);
|
|
86708
86724
|
});
|
|
86709
86725
|
try {
|
|
@@ -92159,7 +92175,7 @@ function createAuthTools(options) {
|
|
|
92159
92175
|
async link(input2) {
|
|
92160
92176
|
requireSafeSecretStore(options.secrets);
|
|
92161
92177
|
requireWalletStore2(options.wallets);
|
|
92162
|
-
const wallet = options.session.
|
|
92178
|
+
const wallet = (await options.session.resolveLatest(input2.account)).name;
|
|
92163
92179
|
const existing = pending.get(wallet);
|
|
92164
92180
|
if (existing !== void 0) return linkResult(wallet, existing);
|
|
92165
92181
|
let startup = starting.get(wallet);
|
|
@@ -92349,6 +92365,7 @@ function createRouterTools(options) {
|
|
|
92349
92365
|
return toolResult({ models: models.map((model) => model.id) });
|
|
92350
92366
|
},
|
|
92351
92367
|
async usage(input2) {
|
|
92368
|
+
await options.session.resolveLatest(input2.wallet);
|
|
92352
92369
|
const deps = routerDeps(options, input2.wallet);
|
|
92353
92370
|
const [usage, stake] = await Promise.all([readUsage(deps), readStake(deps)]);
|
|
92354
92371
|
return toolResult({
|
|
@@ -92362,6 +92379,7 @@ function createRouterTools(options) {
|
|
|
92362
92379
|
},
|
|
92363
92380
|
async chat(input2) {
|
|
92364
92381
|
const parsed = routerChatInputSchema.parse(input2);
|
|
92382
|
+
await options.session.resolveLatest(parsed.wallet);
|
|
92365
92383
|
const result = await chat(routerDeps(options, parsed.wallet, unlockedWallet), {
|
|
92366
92384
|
model: parsed.model,
|
|
92367
92385
|
messages: parsed.messages,
|
|
@@ -93492,9 +93510,23 @@ var WalletSession = class {
|
|
|
93492
93510
|
}
|
|
93493
93511
|
return { name: only };
|
|
93494
93512
|
}
|
|
93513
|
+
/**
|
|
93514
|
+
* `resolve`, after re-reading `wallets.json` when the name is not known yet.
|
|
93515
|
+
* An account created in a terminal while this server runs works at once; the
|
|
93516
|
+
* session's active account and the human's default stay as they were.
|
|
93517
|
+
*/
|
|
93518
|
+
async resolveLatest(name) {
|
|
93519
|
+
const store = this.options.store;
|
|
93520
|
+
const requested = name?.trim();
|
|
93521
|
+
const selection = requested && requested.length > 0 ? requested : this.#active;
|
|
93522
|
+
if (store && selection !== void 0 && !store.has(assertWalletName(selection))) {
|
|
93523
|
+
await store.refreshRegistry();
|
|
93524
|
+
}
|
|
93525
|
+
return this.resolve(name);
|
|
93526
|
+
}
|
|
93495
93527
|
/** The addresses of an account, read from the vault or a legacy keystore header. */
|
|
93496
93528
|
async addressesFor(name) {
|
|
93497
|
-
const wallet = this.
|
|
93529
|
+
const wallet = await this.resolveLatest(name);
|
|
93498
93530
|
const store = this.options.store;
|
|
93499
93531
|
if (!store) {
|
|
93500
93532
|
const account = this.options.account;
|
|
@@ -93522,7 +93554,7 @@ var WalletSession = class {
|
|
|
93522
93554
|
* so switching accounts mid-session pays from the account that was asked for.
|
|
93523
93555
|
*/
|
|
93524
93556
|
async payment(name) {
|
|
93525
|
-
const wallet = this.
|
|
93557
|
+
const wallet = await this.resolveLatest(name);
|
|
93526
93558
|
const store = this.options.store;
|
|
93527
93559
|
if (!store || wallet.path === void 0) {
|
|
93528
93560
|
return { wallet, account: this.options.account };
|
|
@@ -93530,7 +93562,10 @@ var WalletSession = class {
|
|
|
93530
93562
|
const account = await store.hasVaultAccount(wallet.name) ? await store.unlock(wallet.name, "") : await this.#unlockLegacy(wallet);
|
|
93531
93563
|
return { wallet, account, spendCaps: await spendCapsForWallet(store, wallet.name) };
|
|
93532
93564
|
}
|
|
93533
|
-
/**
|
|
93565
|
+
/**
|
|
93566
|
+
* Every account this machine knows, with the session's own marker on one.
|
|
93567
|
+
* `wallets.json` is re-read first, so accounts made in a terminal show up.
|
|
93568
|
+
*/
|
|
93534
93569
|
async list() {
|
|
93535
93570
|
const store = this.options.store;
|
|
93536
93571
|
const active = this.#active;
|
|
@@ -93547,6 +93582,7 @@ var WalletSession = class {
|
|
|
93547
93582
|
}
|
|
93548
93583
|
];
|
|
93549
93584
|
}
|
|
93585
|
+
await store.refreshRegistry();
|
|
93550
93586
|
return (await store.list()).map((info) => ({
|
|
93551
93587
|
name: info.name,
|
|
93552
93588
|
...info.address === void 0 ? {} : { address: info.address },
|
|
@@ -93564,7 +93600,7 @@ var WalletSession = class {
|
|
|
93564
93600
|
* an agent pays from changed.
|
|
93565
93601
|
*/
|
|
93566
93602
|
async use(name) {
|
|
93567
|
-
const wallet = this.
|
|
93603
|
+
const wallet = await this.resolveLatest(assertWalletName(name));
|
|
93568
93604
|
const previous = this.#active ?? null;
|
|
93569
93605
|
this.#active = wallet.name;
|
|
93570
93606
|
let address4;
|
|
@@ -94376,13 +94412,16 @@ function createVapiServer(options = {}) {
|
|
|
94376
94412
|
inputSchema: {},
|
|
94377
94413
|
outputSchema: walletListToolResultSchema
|
|
94378
94414
|
},
|
|
94379
|
-
async () => asStructuredToolResult(async () =>
|
|
94380
|
-
|
|
94381
|
-
|
|
94382
|
-
|
|
94383
|
-
|
|
94384
|
-
|
|
94385
|
-
|
|
94415
|
+
async () => asStructuredToolResult(async () => {
|
|
94416
|
+
const accounts2 = await session.list();
|
|
94417
|
+
return {
|
|
94418
|
+
wallet: session.activeName ?? null,
|
|
94419
|
+
default: session.store?.defaultName ?? session.activeName ?? null,
|
|
94420
|
+
wallets: await Promise.all(
|
|
94421
|
+
accounts2.map((info) => describeWallet(info, config2, guardedFetch2))
|
|
94422
|
+
)
|
|
94423
|
+
};
|
|
94424
|
+
})
|
|
94386
94425
|
);
|
|
94387
94426
|
server.registerTool(
|
|
94388
94427
|
"wallet.use",
|
|
@@ -94435,7 +94474,7 @@ function createVapiServer(options = {}) {
|
|
|
94435
94474
|
),
|
|
94436
94475
|
balance
|
|
94437
94476
|
);
|
|
94438
|
-
const ledgerWallet2 = (input2) => input2.allWallets === true ? null : session.
|
|
94477
|
+
const ledgerWallet2 = async (input2) => input2.allWallets === true ? null : (await session.resolveLatest(input2.wallet)).name;
|
|
94439
94478
|
server.registerTool(
|
|
94440
94479
|
"receipts.list",
|
|
94441
94480
|
{
|
|
@@ -94448,7 +94487,7 @@ function createVapiServer(options = {}) {
|
|
|
94448
94487
|
outputSchema: external_exports.object({ wallet: external_exports.string().nullable(), receipts: external_exports.array(external_exports.unknown()) })
|
|
94449
94488
|
},
|
|
94450
94489
|
async (input2) => asStructuredToolResult(async () => {
|
|
94451
|
-
const wallet = ledgerWallet2(input2);
|
|
94490
|
+
const wallet = await ledgerWallet2(input2);
|
|
94452
94491
|
return {
|
|
94453
94492
|
wallet,
|
|
94454
94493
|
receipts: await readReceipts(options.receiptsPath ?? getVapiPaths().receipts, {
|
|
@@ -94471,7 +94510,7 @@ function createVapiServer(options = {}) {
|
|
|
94471
94510
|
},
|
|
94472
94511
|
async (input2) => asStructuredToolResult(async () => {
|
|
94473
94512
|
const paths = getVapiPaths();
|
|
94474
|
-
const wallet = ledgerWallet2(input2);
|
|
94513
|
+
const wallet = await ledgerWallet2(input2);
|
|
94475
94514
|
return {
|
|
94476
94515
|
wallet,
|
|
94477
94516
|
...aggregateStats({
|
|
@@ -94872,6 +94911,9 @@ function rgbToAnsi256(red, green, blue) {
|
|
|
94872
94911
|
import { readFile as readFile24, stat as stat14 } from "node:fs/promises";
|
|
94873
94912
|
import { join as join21 } from "node:path";
|
|
94874
94913
|
|
|
94914
|
+
// src/dashboard.ts
|
|
94915
|
+
import { resolve as resolve2 } from "node:path";
|
|
94916
|
+
|
|
94875
94917
|
// src/publish-client.ts
|
|
94876
94918
|
var LISTING_CATEGORIES = ["ai", "data", "crypto", "compute", "search"];
|
|
94877
94919
|
var PROBE_MODES = ["origin", "endpoint", "openapi"];
|
|
@@ -95192,7 +95234,8 @@ async function runLoginFlow(argv, json2, io, dependencies, options = {}) {
|
|
|
95192
95234
|
booleanOptions: /* @__PURE__ */ new Set(["--publish", "--no-browser"]),
|
|
95193
95235
|
maximumPositionals: 0
|
|
95194
95236
|
});
|
|
95195
|
-
const
|
|
95237
|
+
const paths = getVapiPaths(options.home);
|
|
95238
|
+
const target = await targetWallet(parsed, dependencies, paths.directory);
|
|
95196
95239
|
const { account } = await unlockTarget(target, dependencies);
|
|
95197
95240
|
const label = parsed.one("--label") ?? target.name;
|
|
95198
95241
|
const scopes = [
|
|
@@ -95201,13 +95244,13 @@ async function runLoginFlow(argv, json2, io, dependencies, options = {}) {
|
|
|
95201
95244
|
"tasks:write",
|
|
95202
95245
|
...parsed.has("--publish") ? ["call.publish"] : []
|
|
95203
95246
|
];
|
|
95204
|
-
const config2 = await loadConfig(
|
|
95205
|
-
const apiBase = registryBaseUrl(config2);
|
|
95247
|
+
const config2 = await loadConfig(paths.config, process.env, { notice: io.stderr });
|
|
95248
|
+
const apiBase = options.apiBase ?? registryBaseUrl(config2);
|
|
95206
95249
|
const fetchImpl = dependencies.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: false });
|
|
95207
95250
|
const secrets = getSecretStore(dependencies);
|
|
95208
95251
|
const device = await ensureDeviceName({
|
|
95209
95252
|
env: getEnvironment(dependencies),
|
|
95210
|
-
configPath:
|
|
95253
|
+
configPath: paths.config,
|
|
95211
95254
|
...dependencies.hostname === void 0 ? {} : { hostname: dependencies.hostname() }
|
|
95212
95255
|
});
|
|
95213
95256
|
const bearer = await trustedLinkBearer({
|
|
@@ -95461,6 +95504,87 @@ function shortAddress(address4) {
|
|
|
95461
95504
|
return address4.length <= 12 ? address4 : `${address4.slice(0, 6)}\u2026${address4.slice(-4)}`;
|
|
95462
95505
|
}
|
|
95463
95506
|
|
|
95507
|
+
// src/dashboard.ts
|
|
95508
|
+
function dashboardUrl(apiBase) {
|
|
95509
|
+
return `${apiBase.replace(/\/+$/u, "")}/agents`;
|
|
95510
|
+
}
|
|
95511
|
+
async function offerDashboardLink({
|
|
95512
|
+
name,
|
|
95513
|
+
json: json2,
|
|
95514
|
+
noLink = false,
|
|
95515
|
+
io,
|
|
95516
|
+
dependencies,
|
|
95517
|
+
home = getVapiPaths().directory,
|
|
95518
|
+
apiBase
|
|
95519
|
+
}) {
|
|
95520
|
+
const otherHome = resolve2(home) !== resolve2(getVapiPaths().directory);
|
|
95521
|
+
const command = `${otherHome ? `VAPI_HOME=${shellQuote(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote(apiBase)} `}vapi login --account ${name}`;
|
|
95522
|
+
const unlinked = {
|
|
95523
|
+
linked: false,
|
|
95524
|
+
next: [{ kind: "link", account: name, command }]
|
|
95525
|
+
};
|
|
95526
|
+
const hint = () => {
|
|
95527
|
+
if (!json2) io.stdout(`Run \`${command}\` to see this wallet on your dashboard.`);
|
|
95528
|
+
return unlinked;
|
|
95529
|
+
};
|
|
95530
|
+
try {
|
|
95531
|
+
const store = await WalletStore.open(home, {
|
|
95532
|
+
secrets: getSecretStore(dependencies),
|
|
95533
|
+
env: getEnvironment(dependencies)
|
|
95534
|
+
});
|
|
95535
|
+
if (store.entry(name)?.link !== void 0) return { linked: true };
|
|
95536
|
+
if (noLink || json2 || !isInteractive(dependencies) || activeAgentMarker(getEnvironment(dependencies)) !== void 0) {
|
|
95537
|
+
return hint();
|
|
95538
|
+
}
|
|
95539
|
+
const answer = (await getLinePrompt(dependencies)(`Link ${name} to your vAPI dashboard? [Y/n] `)).trim();
|
|
95540
|
+
if (!/^(?:y|yes)?$/iu.test(answer)) return hint();
|
|
95541
|
+
await runLoginFlow(["--account", name, "--label", name], false, io, dependencies, {
|
|
95542
|
+
home,
|
|
95543
|
+
...apiBase === void 0 ? {} : { apiBase }
|
|
95544
|
+
});
|
|
95545
|
+
await store.reload();
|
|
95546
|
+
const link3 = store.entry(name)?.link;
|
|
95547
|
+
if (link3 === void 0) return hint();
|
|
95548
|
+
io.stdout(`See it on your dashboard: ${dashboardUrl(link3.apiBase)}`);
|
|
95549
|
+
return { linked: true };
|
|
95550
|
+
} catch (error61) {
|
|
95551
|
+
if (!json2) {
|
|
95552
|
+
io.stderr(`Link not completed: ${error61 instanceof Error ? error61.message : String(error61)}`);
|
|
95553
|
+
}
|
|
95554
|
+
return hint();
|
|
95555
|
+
}
|
|
95556
|
+
}
|
|
95557
|
+
async function dashboardCommand(argv, json2, io, dependencies) {
|
|
95558
|
+
const parsed = parseArguments(argv, {
|
|
95559
|
+
valueOptions: /* @__PURE__ */ new Set(["--wallet"]),
|
|
95560
|
+
booleanOptions: /* @__PURE__ */ new Set(["--no-browser", "--no-link"]),
|
|
95561
|
+
maximumPositionals: 0
|
|
95562
|
+
});
|
|
95563
|
+
const target = await targetWallet(parsed, dependencies);
|
|
95564
|
+
let status = { linked: true };
|
|
95565
|
+
if (target.entry.link === void 0) {
|
|
95566
|
+
if (!json2) io.stdout(`${target.name} is not linked to your vAPI dashboard yet.`);
|
|
95567
|
+
status = await offerDashboardLink({
|
|
95568
|
+
name: target.name,
|
|
95569
|
+
json: json2,
|
|
95570
|
+
noLink: parsed.has("--no-link"),
|
|
95571
|
+
io,
|
|
95572
|
+
dependencies: parsed.has("--no-browser") ? { ...dependencies, openUrl: () => false } : dependencies
|
|
95573
|
+
});
|
|
95574
|
+
}
|
|
95575
|
+
await target.store.reload();
|
|
95576
|
+
const apiBase = target.store.entry(target.name)?.link?.apiBase ?? registryBaseUrl(await readConfig(getVapiPaths().config, io));
|
|
95577
|
+
const url2 = dashboardUrl(apiBase);
|
|
95578
|
+
let opened = false;
|
|
95579
|
+
if (status.linked && !parsed.has("--no-browser") && (dependencies.interactive ?? Boolean(process.stdout.isTTY)) && activeAgentMarker(getEnvironment(dependencies)) === void 0) {
|
|
95580
|
+
opened = (dependencies.openUrl ?? openInBrowser)(url2);
|
|
95581
|
+
}
|
|
95582
|
+
io.stdout(json2 ? JSON.stringify({ account: target.name, url: url2, ...status, opened }) : url2);
|
|
95583
|
+
}
|
|
95584
|
+
function shellQuote(value) {
|
|
95585
|
+
return /^[a-zA-Z0-9_./-]+$/u.test(value) ? value : `'${value.replace(/'/gu, "'\\''")}'`;
|
|
95586
|
+
}
|
|
95587
|
+
|
|
95464
95588
|
// src/status.ts
|
|
95465
95589
|
import { stat as stat13 } from "node:fs/promises";
|
|
95466
95590
|
import { homedir as homedir2 } from "node:os";
|
|
@@ -97846,10 +97970,10 @@ function apiEndpoint2(apiBase, path) {
|
|
|
97846
97970
|
}
|
|
97847
97971
|
async function sleepFor2(milliseconds, signal) {
|
|
97848
97972
|
if (signal?.aborted === true) throw signal.reason;
|
|
97849
|
-
await new Promise((
|
|
97973
|
+
await new Promise((resolve3, reject) => {
|
|
97850
97974
|
const finish = () => {
|
|
97851
97975
|
signal?.removeEventListener("abort", abort);
|
|
97852
|
-
|
|
97976
|
+
resolve3();
|
|
97853
97977
|
};
|
|
97854
97978
|
const timeout = setTimeout(finish, milliseconds);
|
|
97855
97979
|
const abort = () => {
|
|
@@ -98184,7 +98308,7 @@ async function readProcessStdin() {
|
|
|
98184
98308
|
}
|
|
98185
98309
|
|
|
98186
98310
|
// src/version.ts
|
|
98187
|
-
var CLI_VERSION = "0.9.
|
|
98311
|
+
var CLI_VERSION = "0.9.6";
|
|
98188
98312
|
|
|
98189
98313
|
// src/status.ts
|
|
98190
98314
|
async function statusCommand(argv, json2, io, dependencies) {
|
|
@@ -98328,10 +98452,10 @@ async function runStatusSweep(args) {
|
|
|
98328
98452
|
timeoutMs,
|
|
98329
98453
|
...args.warn === void 0 ? {} : { warn: args.warn }
|
|
98330
98454
|
}),
|
|
98331
|
-
new Promise((
|
|
98455
|
+
new Promise((resolve3) => {
|
|
98332
98456
|
timeout = setTimeout(() => {
|
|
98333
98457
|
controller.abort();
|
|
98334
|
-
|
|
98458
|
+
resolve3();
|
|
98335
98459
|
}, timeoutMs);
|
|
98336
98460
|
timeout.unref();
|
|
98337
98461
|
})
|
|
@@ -98560,7 +98684,7 @@ async function siblingsFetchImpl(dependencies) {
|
|
|
98560
98684
|
function shortAddress3(address4) {
|
|
98561
98685
|
return address4.length <= 12 ? address4 : `${address4.slice(0, 6)}\u2026${address4.slice(-4)}`;
|
|
98562
98686
|
}
|
|
98563
|
-
async function accountsAddCommand(argv, json2, io, dependencies) {
|
|
98687
|
+
async function accountsAddCommand(argv, json2, io, dependencies, options = { link: "always" }) {
|
|
98564
98688
|
const parsed = parseArguments(argv, {
|
|
98565
98689
|
valueOptions: /* @__PURE__ */ new Set(["--label"]),
|
|
98566
98690
|
booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
|
|
@@ -98577,6 +98701,18 @@ async function accountsAddCommand(argv, json2, io, dependencies) {
|
|
|
98577
98701
|
});
|
|
98578
98702
|
await recordAudit(dependencies, "wallet.create", { wallet: created.account });
|
|
98579
98703
|
const address4 = created.address;
|
|
98704
|
+
if (options.link === "offer") {
|
|
98705
|
+
if (!json2) io.stdout(`Account ${created.account} derived: ${address4}`);
|
|
98706
|
+
const link3 = await offerDashboardLink({
|
|
98707
|
+
name: created.account,
|
|
98708
|
+
json: json2,
|
|
98709
|
+
noLink: parsed.has("--no-link"),
|
|
98710
|
+
io,
|
|
98711
|
+
dependencies
|
|
98712
|
+
});
|
|
98713
|
+
if (json2) io.stdout(JSON.stringify({ account: created.account, address: address4, ...link3 }));
|
|
98714
|
+
return;
|
|
98715
|
+
}
|
|
98580
98716
|
if (parsed.has("--no-link")) {
|
|
98581
98717
|
output2(
|
|
98582
98718
|
io,
|
|
@@ -99392,10 +99528,10 @@ async function autoUploadBackup(io, json2, dependencies) {
|
|
|
99392
99528
|
const timeoutMs = dependencies.cloudBackup?.uploadTimeoutMs ?? DEFAULT_UPLOAD_TIMEOUT_MS;
|
|
99393
99529
|
const controller = new AbortController();
|
|
99394
99530
|
let timer;
|
|
99395
|
-
const timeout = new Promise((
|
|
99531
|
+
const timeout = new Promise((resolve3) => {
|
|
99396
99532
|
timer = setTimeout(() => {
|
|
99397
99533
|
controller.abort();
|
|
99398
|
-
|
|
99534
|
+
resolve3({ status: "skipped", reason: "timeout" });
|
|
99399
99535
|
}, timeoutMs);
|
|
99400
99536
|
timer.unref();
|
|
99401
99537
|
});
|
|
@@ -100619,7 +100755,7 @@ var HTTP_NOT_FOUND_PATTERN = /\b404\b/u;
|
|
|
100619
100755
|
var OTHER_SCOPE_PATTERN = /\b(?:project|environment|service|workspace|team|token|user|account|volume|deployment|command|file|directory|module|package)s?\b/iu;
|
|
100620
100756
|
var SIDECAR_SUFFIX = ".railway.json";
|
|
100621
100757
|
var MINIMUM_SECRET_LENGTH = 8;
|
|
100622
|
-
var defaultRailwayExec = (file2, args) => new Promise((
|
|
100758
|
+
var defaultRailwayExec = (file2, args) => new Promise((resolve3, reject) => {
|
|
100623
100759
|
const child = spawn2(file2, [...args], {
|
|
100624
100760
|
stdio: ["ignore", "pipe", "pipe"],
|
|
100625
100761
|
env: process.env,
|
|
@@ -100634,7 +100770,7 @@ var defaultRailwayExec = (file2, args) => new Promise((resolve2, reject) => {
|
|
|
100634
100770
|
stderr2 += chunk;
|
|
100635
100771
|
});
|
|
100636
100772
|
child.once("error", reject);
|
|
100637
|
-
child.once("close", (code) =>
|
|
100773
|
+
child.once("close", (code) => resolve3({ code, stdout, stderr: stderr2 }));
|
|
100638
100774
|
});
|
|
100639
100775
|
function parseSandboxId(stdout) {
|
|
100640
100776
|
const trimmed = stdout.trim();
|
|
@@ -100767,8 +100903,8 @@ function createRailwayRuntime(options) {
|
|
|
100767
100903
|
const readyAttempts = options.readyAttempts ?? DEFAULT_RAILWAY_READY_ATTEMPTS;
|
|
100768
100904
|
const readyIntervalMs = options.readyIntervalMs ?? DEFAULT_RAILWAY_READY_INTERVAL_MS;
|
|
100769
100905
|
const signalDestroyTimeoutMs = options.signalDestroyTimeoutMs ?? DEFAULT_RAILWAY_SIGNAL_DESTROY_TIMEOUT_MS;
|
|
100770
|
-
const sleep = options.sleep ?? ((milliseconds) => new Promise((
|
|
100771
|
-
setTimeout(
|
|
100906
|
+
const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve3) => {
|
|
100907
|
+
setTimeout(resolve3, milliseconds);
|
|
100772
100908
|
}));
|
|
100773
100909
|
let secrets = options.secrets;
|
|
100774
100910
|
const getSecrets = () => secrets ??= secretStore();
|
|
@@ -102621,7 +102757,7 @@ function usd(value, minimumDecimals = 0) {
|
|
|
102621
102757
|
import { mkdir as mkdir20, readFile as readFile27, writeFile as writeFile11 } from "node:fs/promises";
|
|
102622
102758
|
import { homedir as systemHomedir } from "node:os";
|
|
102623
102759
|
import { dirname as dirname14, posix, win32 as win322 } from "node:path";
|
|
102624
|
-
var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]";
|
|
102760
|
+
var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
|
|
102625
102761
|
var APPS = /* @__PURE__ */ new Set(["claude", "cursor", "codex"]);
|
|
102626
102762
|
var NEXT_STEP = {
|
|
102627
102763
|
claude: 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
|
|
@@ -102662,6 +102798,7 @@ function mcpInstallTarget(app, context) {
|
|
|
102662
102798
|
async function mcpInstallCommand(argv, json2, io, dependencies) {
|
|
102663
102799
|
const parsed = parseArguments(argv, {
|
|
102664
102800
|
valueOptions: /* @__PURE__ */ new Set(["--home", "--registry"]),
|
|
102801
|
+
booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
|
|
102665
102802
|
maximumPositionals: 1
|
|
102666
102803
|
});
|
|
102667
102804
|
const appValue = parsed.positionals[0];
|
|
@@ -102683,13 +102820,39 @@ ${MCP_INSTALL_USAGE}`
|
|
|
102683
102820
|
});
|
|
102684
102821
|
const entry = serverEntry(home, registry2);
|
|
102685
102822
|
const created = await writeMcpConfig(target, entry);
|
|
102823
|
+
const name = await unlinkedDefaultAccount(home, dependencies);
|
|
102824
|
+
const offerLink = (name2) => offerDashboardLink({
|
|
102825
|
+
name: name2,
|
|
102826
|
+
json: json2,
|
|
102827
|
+
noLink: parsed.has("--no-link"),
|
|
102828
|
+
io,
|
|
102829
|
+
dependencies,
|
|
102830
|
+
home,
|
|
102831
|
+
apiBase: parsed.one("--registry")
|
|
102832
|
+
});
|
|
102833
|
+
const link3 = json2 && name !== void 0 ? await offerLink(name) : {};
|
|
102686
102834
|
output3(
|
|
102687
102835
|
io,
|
|
102688
102836
|
json2,
|
|
102689
|
-
{ command: "mcp install", app: appValue, path: target.path, created, home, registry: registry2 },
|
|
102837
|
+
{ ...link3, command: "mcp install", app: appValue, path: target.path, created, home, registry: registry2 },
|
|
102690
102838
|
`${created ? "Wrote" : "Updated"} ${target.path}.`
|
|
102691
102839
|
);
|
|
102692
|
-
if (!json2)
|
|
102840
|
+
if (!json2) {
|
|
102841
|
+
io.stdout(NEXT_STEP[appValue]);
|
|
102842
|
+
if (name !== void 0) await offerLink(name);
|
|
102843
|
+
}
|
|
102844
|
+
}
|
|
102845
|
+
async function unlinkedDefaultAccount(home, dependencies) {
|
|
102846
|
+
try {
|
|
102847
|
+
const store = await WalletStore.open(home, {
|
|
102848
|
+
secrets: getSecretStore(dependencies),
|
|
102849
|
+
env: getEnvironment(dependencies)
|
|
102850
|
+
});
|
|
102851
|
+
const name = store.defaultName;
|
|
102852
|
+
if (name !== void 0 && store.resolve({ name }).entry.link === void 0) return name;
|
|
102853
|
+
} catch {
|
|
102854
|
+
}
|
|
102855
|
+
return void 0;
|
|
102693
102856
|
}
|
|
102694
102857
|
function isMcpInstallApp(value) {
|
|
102695
102858
|
return APPS.has(value);
|
|
@@ -103359,7 +103522,7 @@ async function taskContext(parsed, io, dependencies, publicOnly = false) {
|
|
|
103359
103522
|
pending,
|
|
103360
103523
|
randomUUID: dependencies.tasks?.randomUUID ?? randomUUID6,
|
|
103361
103524
|
signInHint: "Run vapi login for the acting wallet.",
|
|
103362
|
-
sleep: dependencies.tasks?.sleep ?? ((milliseconds) => new Promise((
|
|
103525
|
+
sleep: dependencies.tasks?.sleep ?? ((milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds)))
|
|
103363
103526
|
};
|
|
103364
103527
|
}
|
|
103365
103528
|
async function taskRequest2(verb, route, operation) {
|
|
@@ -105159,11 +105322,11 @@ ${usage}`);
|
|
|
105159
105322
|
}
|
|
105160
105323
|
}
|
|
105161
105324
|
async function referencedSleep(milliseconds, signal) {
|
|
105162
|
-
await new Promise((
|
|
105325
|
+
await new Promise((resolve3) => {
|
|
105163
105326
|
const finish = () => {
|
|
105164
105327
|
clearTimeout(timer);
|
|
105165
105328
|
signal?.removeEventListener("abort", finish);
|
|
105166
|
-
|
|
105329
|
+
resolve3();
|
|
105167
105330
|
};
|
|
105168
105331
|
const timer = setTimeout(finish, milliseconds);
|
|
105169
105332
|
if (signal === void 0) return;
|
|
@@ -105391,7 +105554,7 @@ var HELP_HEADING = "vAPI Network";
|
|
|
105391
105554
|
var HELP = `${HELP_HEADING}
|
|
105392
105555
|
|
|
105393
105556
|
Usage:
|
|
105394
|
-
vapi init [--networks <base,arc>] [--json]
|
|
105557
|
+
vapi init [--networks <base,arc>] [--no-link] [--json]
|
|
105395
105558
|
vapi setup [--no-cloud-backup] [--accounts <n>] [--json]
|
|
105396
105559
|
vapi accounts [--all] [--json]
|
|
105397
105560
|
vapi accounts add <name> [--label <text>] [--no-link] [--json]
|
|
@@ -105438,6 +105601,7 @@ Usage:
|
|
|
105438
105601
|
vapi agent pause <name> [--json]
|
|
105439
105602
|
vapi agent resume <name> [--json]
|
|
105440
105603
|
vapi agent revoke <name> [--json]
|
|
105604
|
+
vapi dashboard [--account <name>] [--no-browser] [--json]
|
|
105441
105605
|
vapi login [--account <name>] [--label <name>] [--publish] [--no-browser] [--json]
|
|
105442
105606
|
vapi logout [--account <name>] [--json]
|
|
105443
105607
|
vapi whoami [--account <name>] [--json]
|
|
@@ -105488,11 +105652,13 @@ Usage:
|
|
|
105488
105652
|
vapi publish list [--json]
|
|
105489
105653
|
vapi claim <origin> [--account <name>] [--json]
|
|
105490
105654
|
vapi mcp [--account <name>] [--json]
|
|
105491
|
-
vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--json]
|
|
105655
|
+
vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
|
|
105492
105656
|
vapi serve [--json]
|
|
105493
105657
|
vapi version [--json]
|
|
105494
105658
|
vapi help [--json]
|
|
105495
105659
|
|
|
105660
|
+
\`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.
|
|
105661
|
+
|
|
105496
105662
|
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.
|
|
105497
105663
|
|
|
105498
105664
|
\`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]\`.
|
|
@@ -105557,8 +105723,8 @@ var ACCOUNT_OPTION2 = "--account";
|
|
|
105557
105723
|
var WALLET_OPTION_DEPRECATION = "--wallet is now --account; --wallet keeps working for one release.";
|
|
105558
105724
|
var SOLANA_VAULT_UNAVAILABLE2 = "Solana keys are not part of the device vault yet.";
|
|
105559
105725
|
var INCLUDE_UNVERIFIED_OPTION = "--include-unverified";
|
|
105560
|
-
async function openWalletStore(dependencies) {
|
|
105561
|
-
return await WalletStore.open(
|
|
105726
|
+
async function openWalletStore(dependencies, home = getVapiPaths().directory) {
|
|
105727
|
+
return await WalletStore.open(home, {
|
|
105562
105728
|
secrets: getSecretStore(dependencies),
|
|
105563
105729
|
env: getEnvironment(dependencies),
|
|
105564
105730
|
...dependencies.now === void 0 ? {} : { now: dependencies.now }
|
|
@@ -105573,8 +105739,8 @@ async function selectWallet(store, parsed, dependencies) {
|
|
|
105573
105739
|
const address4 = await store.readAddress(resolved.name);
|
|
105574
105740
|
return { store, ...resolved, ...address4 === void 0 ? {} : { address: address4 } };
|
|
105575
105741
|
}
|
|
105576
|
-
async function targetWallet(parsed, dependencies) {
|
|
105577
|
-
return await selectWallet(await openWalletStore(dependencies), parsed, dependencies);
|
|
105742
|
+
async function targetWallet(parsed, dependencies, home = getVapiPaths().directory) {
|
|
105743
|
+
return await selectWallet(await openWalletStore(dependencies, home), parsed, dependencies);
|
|
105578
105744
|
}
|
|
105579
105745
|
function getSecretStore(dependencies) {
|
|
105580
105746
|
return dependencies.secretStore ?? secretStore();
|
|
@@ -105753,6 +105919,10 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
|
|
|
105753
105919
|
case "agent":
|
|
105754
105920
|
exitCode = await agentCommand(args.slice(1), json2, runIo, dependencies);
|
|
105755
105921
|
break;
|
|
105922
|
+
case "dashboard":
|
|
105923
|
+
await dashboardCommand(args.slice(1), json2, io, dependencies);
|
|
105924
|
+
exitCode = 0;
|
|
105925
|
+
break;
|
|
105756
105926
|
case "login":
|
|
105757
105927
|
await loginCommand(args.slice(1), json2, io, dependencies);
|
|
105758
105928
|
exitCode = 0;
|
|
@@ -105967,6 +106137,7 @@ function shouldAutoUploadAfterFailure(args) {
|
|
|
105967
106137
|
async function initCommand(argv, json2, io, dependencies) {
|
|
105968
106138
|
const parsed = parseArguments(argv, {
|
|
105969
106139
|
valueOptions: /* @__PURE__ */ new Set(["--networks"]),
|
|
106140
|
+
booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
|
|
105970
106141
|
maximumPositionals: 0
|
|
105971
106142
|
});
|
|
105972
106143
|
const networks = parseInitNetworks(parsed.one("--networks") ?? "base");
|
|
@@ -106014,7 +106185,14 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
106014
106185
|
nextSteps: buildNextSteps(account.address)
|
|
106015
106186
|
};
|
|
106016
106187
|
if (json2) {
|
|
106017
|
-
|
|
106188
|
+
const link3 = await offerDashboardLink({
|
|
106189
|
+
name: created.name,
|
|
106190
|
+
json: json2,
|
|
106191
|
+
noLink: parsed.has("--no-link"),
|
|
106192
|
+
io,
|
|
106193
|
+
dependencies
|
|
106194
|
+
});
|
|
106195
|
+
io.stdout(JSON.stringify({ ...result, ...link3 }));
|
|
106018
106196
|
return;
|
|
106019
106197
|
}
|
|
106020
106198
|
if (configRewrites.length > 0) io.stdout(formatLegacyRegistryRewrites(configRewrites));
|
|
@@ -106035,6 +106213,13 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
106035
106213
|
io.stdout(formatAccounts(accounts));
|
|
106036
106214
|
io.stdout("");
|
|
106037
106215
|
io.stdout(result.nextSteps.join("\n"));
|
|
106216
|
+
await offerDashboardLink({
|
|
106217
|
+
name: created.name,
|
|
106218
|
+
json: json2,
|
|
106219
|
+
noLink: parsed.has("--no-link"),
|
|
106220
|
+
io,
|
|
106221
|
+
dependencies
|
|
106222
|
+
});
|
|
106038
106223
|
}
|
|
106039
106224
|
var INIT_ALREADY_DONE = "This machine already has a wallet, so vapi init created nothing.";
|
|
106040
106225
|
async function reportExistingWallets(store, json2, io, dependencies) {
|
|
@@ -106070,12 +106255,11 @@ async function walletCommand(argv, json2, io, dependencies) {
|
|
|
106070
106255
|
`Unknown wallet subcommand ${JSON.stringify(subcommand)}. ${WALLET_USAGE}`
|
|
106071
106256
|
);
|
|
106072
106257
|
}
|
|
106073
|
-
|
|
106074
|
-
|
|
106075
|
-
|
|
106076
|
-
|
|
106077
|
-
|
|
106078
|
-
);
|
|
106258
|
+
if (subcommand === "create") {
|
|
106259
|
+
await accountsAddCommand(rest, json2, io, dependencies, { link: "offer" });
|
|
106260
|
+
return;
|
|
106261
|
+
}
|
|
106262
|
+
await accountsCommand([mapped2, ...rest], json2, io, dependencies);
|
|
106079
106263
|
}
|
|
106080
106264
|
async function unlockedWallets(walletsStore, wallets, dependencies) {
|
|
106081
106265
|
const secrets = getSecretStore(dependencies);
|
|
@@ -106617,8 +106801,8 @@ async function fetchNetworkStats(dependencies) {
|
|
|
106617
106801
|
})();
|
|
106618
106802
|
let timeout;
|
|
106619
106803
|
try {
|
|
106620
|
-
const timedOut = new Promise((
|
|
106621
|
-
timeout = setTimeout(() =>
|
|
106804
|
+
const timedOut = new Promise((resolve3) => {
|
|
106805
|
+
timeout = setTimeout(() => resolve3(null), NETWORK_STATS_REQUEST_TIMEOUT_MS);
|
|
106622
106806
|
});
|
|
106623
106807
|
return await Promise.race([request, timedOut]);
|
|
106624
106808
|
} finally {
|
|
@@ -108297,10 +108481,10 @@ async function checkForUpdate(options = {}) {
|
|
|
108297
108481
|
try {
|
|
108298
108482
|
return await Promise.race([
|
|
108299
108483
|
latestNotice(options, env, controller.signal),
|
|
108300
|
-
new Promise((
|
|
108484
|
+
new Promise((resolve3) => {
|
|
108301
108485
|
timer = setTimeout(() => {
|
|
108302
108486
|
controller.abort();
|
|
108303
|
-
|
|
108487
|
+
resolve3(void 0);
|
|
108304
108488
|
}, CHECK_TIMEOUT_MS);
|
|
108305
108489
|
})
|
|
108306
108490
|
]);
|