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