vapi-network 0.11.0 → 0.12.1
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 +259 -126
- package/SKILL.md +25 -20
- package/dist/cli.js +773 -132
- package/dist/cli.js.map +3 -3
- package/dist/index.js +953 -191
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10117,9 +10117,9 @@ var init_call = __esm({
|
|
|
10117
10117
|
});
|
|
10118
10118
|
|
|
10119
10119
|
// ../cli/src/cli.ts
|
|
10120
|
-
import { spawn as
|
|
10120
|
+
import { spawn as spawn5 } from "node:child_process";
|
|
10121
10121
|
import { stat as stat16 } from "node:fs/promises";
|
|
10122
|
-
import { join as
|
|
10122
|
+
import { join as join29 } from "node:path";
|
|
10123
10123
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
10124
10124
|
|
|
10125
10125
|
// ../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/external.js
|
|
@@ -70104,13 +70104,13 @@ async function withAccountMovementLocks(home, accounts, timeoutMs, operation) {
|
|
|
70104
70104
|
);
|
|
70105
70105
|
}
|
|
70106
70106
|
async function acquireAccountMovementLocks(home, accounts, timeoutMs, operation) {
|
|
70107
|
-
const [account, ...
|
|
70107
|
+
const [account, ...remaining2] = accounts;
|
|
70108
70108
|
if (account === void 0) return await operation();
|
|
70109
70109
|
return await withAccountMovementLock(
|
|
70110
70110
|
home,
|
|
70111
70111
|
account,
|
|
70112
70112
|
timeoutMs,
|
|
70113
|
-
async () => acquireAccountMovementLocks(home,
|
|
70113
|
+
async () => acquireAccountMovementLocks(home, remaining2, timeoutMs, operation)
|
|
70114
70114
|
);
|
|
70115
70115
|
}
|
|
70116
70116
|
async function removeStaleLock2(path) {
|
|
@@ -70183,7 +70183,7 @@ var POWERSHELL_MISSING = [
|
|
|
70183
70183
|
].join(" ");
|
|
70184
70184
|
function secretStore(options = {}) {
|
|
70185
70185
|
const platform2 = options.platform ?? process.platform;
|
|
70186
|
-
const run = options.run ?? spawnRunner;
|
|
70186
|
+
const run = options.run ?? (async (file2, args, input2) => await spawnRunner(platform2, file2, args, input2));
|
|
70187
70187
|
const env = options.env ?? process.env;
|
|
70188
70188
|
const installed = options.installed ?? ((file2) => binaryInstalled(file2, env));
|
|
70189
70189
|
if (platform2 === "darwin") return keychainStore(platform2, run);
|
|
@@ -70377,6 +70377,7 @@ function windowsDataProtectionStore(platform2, run, env, installed) {
|
|
|
70377
70377
|
].join("\n");
|
|
70378
70378
|
const execute = async (script2) => {
|
|
70379
70379
|
const result = await run(powershell, WINDOWS_POWERSHELL_ARGS, `${script2}
|
|
70380
|
+
|
|
70380
70381
|
`);
|
|
70381
70382
|
requirePowerShell(result);
|
|
70382
70383
|
return result;
|
|
@@ -70539,17 +70540,25 @@ function binaryInstalled(file2, env) {
|
|
|
70539
70540
|
if (isAbsolute(file2) || win32.isAbsolute(file2)) return existsSync(file2);
|
|
70540
70541
|
return (env.PATH ?? "").split(delimiter).some((directory) => existsSync(join6(directory, file2)));
|
|
70541
70542
|
}
|
|
70543
|
+
var SAFE_FAILURE_DETAILS = [
|
|
70544
|
+
"Cannot autolaunch D-Bus without X11 $DISPLAY",
|
|
70545
|
+
"Cannot autolaunch D-Bus",
|
|
70546
|
+
"The name org.freedesktop.secrets was not provided by any .service files",
|
|
70547
|
+
"Cannot create an item in a locked collection",
|
|
70548
|
+
"User interaction is not allowed.",
|
|
70549
|
+
"Access to the path is denied."
|
|
70550
|
+
];
|
|
70542
70551
|
function requireSuccess(result, what) {
|
|
70543
70552
|
if (result.code === 0) return;
|
|
70544
|
-
const detail =
|
|
70553
|
+
const detail = SAFE_FAILURE_DETAILS.find((reason) => result.stderr.includes(reason));
|
|
70545
70554
|
throw new KeystoreError(
|
|
70546
|
-
`Could not ${what}${result.code === null ? "" : ` (exit ${result.code})`}.${detail
|
|
70555
|
+
`Could not ${what}${result.code === null ? "" : ` (exit ${result.code})`}.${detail === void 0 ? "" : ` ${detail}`}`
|
|
70547
70556
|
);
|
|
70548
70557
|
}
|
|
70549
70558
|
function withoutTrailingNewline(value) {
|
|
70550
70559
|
return value.replace(/\r?\n$/u, "");
|
|
70551
70560
|
}
|
|
70552
|
-
var spawnRunner = async (file2, args, input2) => await new Promise((resolve3) => {
|
|
70561
|
+
var spawnRunner = async (platform2, file2, args, input2) => await new Promise((resolve3) => {
|
|
70553
70562
|
let stdout = "";
|
|
70554
70563
|
let stderr2 = "";
|
|
70555
70564
|
let settled = false;
|
|
@@ -70559,7 +70568,7 @@ var spawnRunner = async (file2, args, input2) => await new Promise((resolve3) =>
|
|
|
70559
70568
|
resolve3(outcome);
|
|
70560
70569
|
};
|
|
70561
70570
|
const child = spawn(file2, [...args], {
|
|
70562
|
-
detached:
|
|
70571
|
+
detached: platform2 !== "win32",
|
|
70563
70572
|
stdio: ["pipe", "pipe", "pipe"],
|
|
70564
70573
|
windowsHide: true
|
|
70565
70574
|
});
|
|
@@ -71569,7 +71578,7 @@ async function loadOrCreateDeviceKey(args) {
|
|
|
71569
71578
|
await args.secrets.set(VAULT_KEY_ACCOUNT, key2.toString("base64"));
|
|
71570
71579
|
return key2;
|
|
71571
71580
|
} catch (error61) {
|
|
71572
|
-
throw asVaultError2(error61,
|
|
71581
|
+
throw asVaultError2(error61, deviceKeyFailureMessage(error61, args.secrets.platform));
|
|
71573
71582
|
}
|
|
71574
71583
|
});
|
|
71575
71584
|
}
|
|
@@ -71827,6 +71836,12 @@ function parseJson(value) {
|
|
|
71827
71836
|
function asVaultError2(error61, message) {
|
|
71828
71837
|
return error61 instanceof VaultError ? error61 : new VaultError("corrupt", message, { cause: error61 });
|
|
71829
71838
|
}
|
|
71839
|
+
var HEADLESS_LINUX_HINT = "A server, container or GitHub Codespace usually has no keyring. Run vapi on your own computer, or connect Claude from https://api.vapinetwork.ai/connect.";
|
|
71840
|
+
function deviceKeyFailureMessage(error61, platform2) {
|
|
71841
|
+
if (!(error61 instanceof KeystoreError)) return "Unable to load or create the device vault key.";
|
|
71842
|
+
const detail = `Unable to load or create the device vault key: ${error61.message.replace(/\.$/u, "")}.`;
|
|
71843
|
+
return platform2 === "linux" ? `${detail} ${HEADLESS_LINUX_HINT}` : detail;
|
|
71844
|
+
}
|
|
71830
71845
|
|
|
71831
71846
|
// ../core/src/vault-migrate.ts
|
|
71832
71847
|
import {
|
|
@@ -72175,6 +72190,17 @@ var WalletStore = class _WalletStore {
|
|
|
72175
72190
|
);
|
|
72176
72191
|
return account?.address ?? (await readKeystoreSummary(this.pathFor(target))).address;
|
|
72177
72192
|
}
|
|
72193
|
+
/**
|
|
72194
|
+
* Creates the vault without deriving an account, for apps that create every
|
|
72195
|
+
* account by name. Refuses when a vault already exists in this home.
|
|
72196
|
+
*/
|
|
72197
|
+
async createEmptyVault() {
|
|
72198
|
+
if (await this.readVaultUnlocked() !== void 0) {
|
|
72199
|
+
throw new KeystoreError("A vault already exists in this home.");
|
|
72200
|
+
}
|
|
72201
|
+
await this.openVault({ create: true });
|
|
72202
|
+
this.dropVaultCache();
|
|
72203
|
+
}
|
|
72178
72204
|
async create(name, passphrase, options = {}) {
|
|
72179
72205
|
void passphrase;
|
|
72180
72206
|
void options.enableSolana;
|
|
@@ -73055,11 +73081,11 @@ function accountChangeBusyError(account, command) {
|
|
|
73055
73081
|
);
|
|
73056
73082
|
}
|
|
73057
73083
|
async function withAccountMutationLocks(home, accounts, command, operation) {
|
|
73058
|
-
const [account, ...
|
|
73084
|
+
const [account, ...remaining2] = [...new Set(accounts)].sort();
|
|
73059
73085
|
if (account === void 0) return await operation();
|
|
73060
73086
|
return await withFileLock(
|
|
73061
73087
|
join8(home, `.account-${account}.lock`),
|
|
73062
|
-
async () => await withAccountMutationLocks(home,
|
|
73088
|
+
async () => await withAccountMutationLocks(home, remaining2, command, operation),
|
|
73063
73089
|
{
|
|
73064
73090
|
lockedMessage: `Account ${account} is busy with another account change. Wait for it to finish, then retry ${command}.`
|
|
73065
73091
|
}
|
|
@@ -73867,8 +73893,8 @@ async function escrowFundingDayRemainingAtomic(input2) {
|
|
|
73867
73893
|
const rows = await readStoredSpendLedgerRows(input2.ledgerPath, input2.now);
|
|
73868
73894
|
const row = rows.find((candidate) => candidate.wallet === input2.wallet);
|
|
73869
73895
|
const reserved = input2.reservationId ? row?.reservations?.find((candidate) => candidate.id === input2.reservationId) : void 0;
|
|
73870
|
-
const
|
|
73871
|
-
return
|
|
73896
|
+
const remaining2 = perDayAtomic - BigInt(row?.spentAtomic ?? "0") + BigInt(reserved?.amountAtomic ?? "0");
|
|
73897
|
+
return remaining2 > 0n ? remaining2 : 0n;
|
|
73872
73898
|
}
|
|
73873
73899
|
async function taskReservedAtomic(input2) {
|
|
73874
73900
|
const rows = await readStoredSpendLedgerRows(input2.ledgerPath, input2.now, true);
|
|
@@ -75208,13 +75234,13 @@ function splitMovementPlanAtRelayLimit(plan) {
|
|
|
75208
75234
|
const legs = plan.legs.flatMap((leg) => {
|
|
75209
75235
|
const purpose = leg.purpose ?? "send";
|
|
75210
75236
|
const split2 = purpose === "sweep" || plan.reason === "send" && plan.treasury !== void 0 && leg.to === plan.treasury;
|
|
75211
|
-
let
|
|
75212
|
-
if (!split2 ||
|
|
75237
|
+
let remaining2 = parseUsdCents(leg.amountUsd);
|
|
75238
|
+
if (!split2 || remaining2 <= maximumCents) return [leg];
|
|
75213
75239
|
const parts = [];
|
|
75214
|
-
while (
|
|
75215
|
-
const cents =
|
|
75240
|
+
while (remaining2 > 0n) {
|
|
75241
|
+
const cents = remaining2 > maximumCents ? maximumCents : remaining2;
|
|
75216
75242
|
parts.push({ ...leg, amountUsd: formatUsdCents(cents) });
|
|
75217
|
-
|
|
75243
|
+
remaining2 -= cents;
|
|
75218
75244
|
}
|
|
75219
75245
|
return parts;
|
|
75220
75246
|
});
|
|
@@ -76090,13 +76116,13 @@ async function withMovementLock(home, from16, timeoutMs, operation) {
|
|
|
76090
76116
|
}
|
|
76091
76117
|
}
|
|
76092
76118
|
async function withMovementLocks(home, senders, timeoutMs, operation) {
|
|
76093
|
-
const [sender, ...
|
|
76119
|
+
const [sender, ...remaining2] = senders;
|
|
76094
76120
|
if (sender === void 0) return await operation();
|
|
76095
76121
|
return await withMovementLock(
|
|
76096
76122
|
home,
|
|
76097
76123
|
sender,
|
|
76098
76124
|
timeoutMs,
|
|
76099
|
-
async () => withMovementLocks(home,
|
|
76125
|
+
async () => withMovementLocks(home, remaining2, timeoutMs, operation)
|
|
76100
76126
|
);
|
|
76101
76127
|
}
|
|
76102
76128
|
async function assertNoPendingCeilingSweep(deps, senders) {
|
|
@@ -76903,11 +76929,11 @@ function planTargets(input2) {
|
|
|
76903
76929
|
function splitCandidateAtRelayMaximum(candidate, relayMaxAtomic) {
|
|
76904
76930
|
const maximumCents = relayMaxAtomic / 10000n;
|
|
76905
76931
|
const legs = [];
|
|
76906
|
-
let
|
|
76907
|
-
while (
|
|
76908
|
-
const cents =
|
|
76932
|
+
let remaining2 = candidate.cents;
|
|
76933
|
+
while (remaining2 > 0n) {
|
|
76934
|
+
const cents = remaining2 > maximumCents ? maximumCents : remaining2;
|
|
76909
76935
|
legs.push(allocationLeg(candidate.from, candidate.to, cents, candidate.purpose));
|
|
76910
|
-
|
|
76936
|
+
remaining2 -= cents;
|
|
76911
76937
|
}
|
|
76912
76938
|
return legs;
|
|
76913
76939
|
}
|
|
@@ -77742,7 +77768,7 @@ function createRunBudget(args) {
|
|
|
77742
77768
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
77743
77769
|
import { arch, platform, release } from "node:os";
|
|
77744
77770
|
import { join as join13 } from "node:path";
|
|
77745
|
-
var VAPI_CLIENT_VERSION = "0.
|
|
77771
|
+
var VAPI_CLIENT_VERSION = "0.12.1";
|
|
77746
77772
|
async function createSupportReport(options) {
|
|
77747
77773
|
const message = options.message.trim();
|
|
77748
77774
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -79134,8 +79160,15 @@ async function ownerStake(deps) {
|
|
|
79134
79160
|
stakeUrl: parsed.data.stakeUrl
|
|
79135
79161
|
};
|
|
79136
79162
|
}
|
|
79137
|
-
async function routerCredentials(deps) {
|
|
79138
|
-
const
|
|
79163
|
+
async function routerCredentials(deps, options = {}) {
|
|
79164
|
+
const credentials = options.funding === "balance" ? await routerBalanceCredentialSnapshot(deps) : await routerCredentialSnapshot(deps);
|
|
79165
|
+
if (credentials === void 0) {
|
|
79166
|
+
throw new RouterClientError(
|
|
79167
|
+
"no_router_key",
|
|
79168
|
+
"No Router balance key is stored for this wallet."
|
|
79169
|
+
);
|
|
79170
|
+
}
|
|
79171
|
+
const { routerBaseUrl, routerKey } = credentials;
|
|
79139
79172
|
return { baseURL: `${routerBaseUrl}/v1`, apiKey: routerKey };
|
|
79140
79173
|
}
|
|
79141
79174
|
async function routerCredentialSnapshot(deps) {
|
|
@@ -82359,10 +82392,10 @@ async function waitForMilestone(client, input2) {
|
|
|
82359
82392
|
return { reached, milestone, polls, elapsedMs: now().getTime() - started };
|
|
82360
82393
|
}
|
|
82361
82394
|
for (; ; ) {
|
|
82362
|
-
const
|
|
82363
|
-
if (
|
|
82395
|
+
const remaining2 = deadline - now().getTime();
|
|
82396
|
+
if (remaining2 <= 0) return result(false);
|
|
82364
82397
|
const controller = new AbortController();
|
|
82365
|
-
const timer = setTimeout(() => controller.abort(),
|
|
82398
|
+
const timer = setTimeout(() => controller.abort(), remaining2);
|
|
82366
82399
|
let response;
|
|
82367
82400
|
polls++;
|
|
82368
82401
|
try {
|
|
@@ -83026,7 +83059,7 @@ async function feeTask(input2, action) {
|
|
|
83026
83059
|
);
|
|
83027
83060
|
let approvalGranted = input2.approval !== void 0 && "granted" in input2.approval && input2.approval.granted;
|
|
83028
83061
|
const checkPolicy = async (reservationId) => {
|
|
83029
|
-
const
|
|
83062
|
+
const remaining2 = await escrowFundingDayRemainingAtomic({
|
|
83030
83063
|
caps: input2.caps,
|
|
83031
83064
|
ledgerPath: input2.ledgerPath,
|
|
83032
83065
|
wallet: input2.wallet,
|
|
@@ -83043,13 +83076,13 @@ async function feeTask(input2, action) {
|
|
|
83043
83076
|
const maxPerTaskAtomic = policyAtomic(input2.policy.maxPerTaskUsd);
|
|
83044
83077
|
if (feeAtomic > maxPerTaskAtomic || taskReserved + feeAtomic > maxPerTaskAtomic)
|
|
83045
83078
|
return { outcome: "refused", reason: "policy.perTask", money: money2, disputeFee: fee };
|
|
83046
|
-
if (feeAtomic >
|
|
83079
|
+
if (feeAtomic > remaining2)
|
|
83047
83080
|
return { outcome: "refused", reason: "policy.perDay", money: money2, disputeFee: fee };
|
|
83048
83081
|
if (feeAtomic > policyAtomic(input2.policy.approveAboveUsd) && !approvalGranted) {
|
|
83049
83082
|
if (input2.approval && "ask" in input2.approval) {
|
|
83050
83083
|
approvalGranted = await input2.approval.ask({
|
|
83051
83084
|
money: money2,
|
|
83052
|
-
dayRemainingUsd: Number(formatBaseUnitsUsd(
|
|
83085
|
+
dayRemainingUsd: Number(formatBaseUnitsUsd(remaining2))
|
|
83053
83086
|
});
|
|
83054
83087
|
if (!approvalGranted) return { outcome: "declined", money: money2, disputeFee: fee };
|
|
83055
83088
|
} else return { outcome: "approval_needed", money: money2, disputeFee: fee };
|
|
@@ -91565,8 +91598,8 @@ async function memberBudgetAtomic(account, configured, deps) {
|
|
|
91565
91598
|
deps.now?.() ?? /* @__PURE__ */ new Date(),
|
|
91566
91599
|
account
|
|
91567
91600
|
);
|
|
91568
|
-
const
|
|
91569
|
-
return
|
|
91601
|
+
const remaining2 = BigInt(caps.perDayAtomic) - BigInt(ledger.spentAtomic);
|
|
91602
|
+
return remaining2 < 0n ? 0n : remaining2;
|
|
91570
91603
|
}
|
|
91571
91604
|
function withoutTreasuryGrants(profile) {
|
|
91572
91605
|
return {
|
|
@@ -93561,9 +93594,9 @@ async function watchEvents(ctx, input2, now, sleep, deadline, signal, progress)
|
|
|
93561
93594
|
const reached = input2.until !== void 0 && next.events.some((event) => taskStateMatches(input2.until, taskEventState(event)));
|
|
93562
93595
|
if (next.events.length || reached)
|
|
93563
93596
|
return { ...next, ...reached ? { reached: input2.until } : {}, timedOut: false };
|
|
93564
|
-
const
|
|
93565
|
-
if (
|
|
93566
|
-
await sleep(Math.min(TASK_LIMITS.watchIntervalMinMs,
|
|
93597
|
+
const remaining2 = deadline - now().getTime();
|
|
93598
|
+
if (remaining2 <= 0) return { ...next, timedOut: true };
|
|
93599
|
+
await sleep(Math.min(TASK_LIMITS.watchIntervalMinMs, remaining2), signal);
|
|
93567
93600
|
if (now().getTime() >= deadline)
|
|
93568
93601
|
return { events: [], nextCursor: progress.cursor, timedOut: true };
|
|
93569
93602
|
}
|
|
@@ -94606,9 +94639,15 @@ var VapiMcpServer = class {
|
|
|
94606
94639
|
return tool.deprecatedReplacement ? withDeprecation(result, tool.deprecatedReplacement) : result;
|
|
94607
94640
|
}
|
|
94608
94641
|
}
|
|
94609
|
-
|
|
94642
|
+
#output = process.stdout;
|
|
94643
|
+
/**
|
|
94644
|
+
* Serves JSON-RPC lines from `input` and answers on `output`. The desktop
|
|
94645
|
+
* app hands in a socket; the CLI hands in stdio through connectStdio().
|
|
94646
|
+
*/
|
|
94647
|
+
connect(input2, output4) {
|
|
94610
94648
|
if (this.#stdio) return;
|
|
94611
|
-
this.#
|
|
94649
|
+
this.#output = output4;
|
|
94650
|
+
this.#stdio = createInterface({ input: input2, crlfDelay: Infinity });
|
|
94612
94651
|
this.#stdio.on("line", (line) => {
|
|
94613
94652
|
void this.#handleLine(line);
|
|
94614
94653
|
});
|
|
@@ -94617,6 +94656,9 @@ var VapiMcpServer = class {
|
|
|
94617
94656
|
this.#onClose?.();
|
|
94618
94657
|
});
|
|
94619
94658
|
}
|
|
94659
|
+
connectStdio() {
|
|
94660
|
+
this.connect(process.stdin, process.stdout);
|
|
94661
|
+
}
|
|
94620
94662
|
async close() {
|
|
94621
94663
|
this.#stdio?.close();
|
|
94622
94664
|
this.#stdio = void 0;
|
|
@@ -94697,7 +94739,7 @@ var VapiMcpServer = class {
|
|
|
94697
94739
|
}
|
|
94698
94740
|
}
|
|
94699
94741
|
#write(message) {
|
|
94700
|
-
|
|
94742
|
+
this.#output.write(`${JSON.stringify(message)}
|
|
94701
94743
|
`);
|
|
94702
94744
|
}
|
|
94703
94745
|
};
|
|
@@ -95707,7 +95749,12 @@ var PROBE_MODES = ["origin", "endpoint", "openapi"];
|
|
|
95707
95749
|
var PAYOUT_CHAIN_ID = "eip155:8453";
|
|
95708
95750
|
var PAYOUT_STATEMENT = "Confirm this wallet receives vAPI Call payouts";
|
|
95709
95751
|
var CLAIM_STATEMENT_PREFIX = "Claim the vAPI Call listings served from";
|
|
95710
|
-
|
|
95752
|
+
function apiKeyConsoleUrl(baseUrl) {
|
|
95753
|
+
const url2 = listingsUrl(baseUrl, "/connect");
|
|
95754
|
+
url2.search = "advanced=keys";
|
|
95755
|
+
url2.hash = "api-keys";
|
|
95756
|
+
return url2;
|
|
95757
|
+
}
|
|
95711
95758
|
var RegistryApiError = class extends Error {
|
|
95712
95759
|
constructor(status, message, body) {
|
|
95713
95760
|
super(message);
|
|
@@ -95867,7 +95914,7 @@ async function registryError(response, baseUrl) {
|
|
|
95867
95914
|
[
|
|
95868
95915
|
"The vAPI API key was rejected.",
|
|
95869
95916
|
detail,
|
|
95870
|
-
`Create a key in the console at ${
|
|
95917
|
+
`Create a key in the console at ${apiKeyConsoleUrl(baseUrl).href} and store it with vapi auth set-key.`
|
|
95871
95918
|
].filter(Boolean).join(" "),
|
|
95872
95919
|
body
|
|
95873
95920
|
);
|
|
@@ -98279,10 +98326,10 @@ async function awaitRelay(options) {
|
|
|
98279
98326
|
if (!Number.isFinite(deadline)) throw new CloudBackupError("relay_expired");
|
|
98280
98327
|
while (true) {
|
|
98281
98328
|
if (isAborted(options.signal)) throw new CloudBackupError("relay_aborted");
|
|
98282
|
-
const
|
|
98283
|
-
if (
|
|
98329
|
+
const remaining2 = deadline - readNow(now).getTime();
|
|
98330
|
+
if (remaining2 <= 0) throw new CloudBackupError("relay_expired");
|
|
98284
98331
|
let response;
|
|
98285
|
-
const requestDeadline = AbortSignal.timeout(Math.max(1,
|
|
98332
|
+
const requestDeadline = AbortSignal.timeout(Math.max(1, remaining2));
|
|
98286
98333
|
const requestSignal = options.signal === void 0 ? requestDeadline : AbortSignal.any([options.signal, requestDeadline]);
|
|
98287
98334
|
try {
|
|
98288
98335
|
response = await (options.fetchImpl ?? publicFetch5)(
|
|
@@ -98301,7 +98348,7 @@ async function awaitRelay(options) {
|
|
|
98301
98348
|
return await readRelayResult(response, options);
|
|
98302
98349
|
}
|
|
98303
98350
|
try {
|
|
98304
|
-
await sleep(Math.min(Math.max(0, pollMs),
|
|
98351
|
+
await sleep(Math.min(Math.max(0, pollMs), remaining2), options.signal);
|
|
98305
98352
|
} catch {
|
|
98306
98353
|
if (isAborted(options.signal)) throw new CloudBackupError("relay_aborted");
|
|
98307
98354
|
}
|
|
@@ -99091,7 +99138,7 @@ async function readProcessStdin() {
|
|
|
99091
99138
|
}
|
|
99092
99139
|
|
|
99093
99140
|
// ../cli/src/version.ts
|
|
99094
|
-
var CLI_VERSION = "0.
|
|
99141
|
+
var CLI_VERSION = "0.12.1";
|
|
99095
99142
|
|
|
99096
99143
|
// ../cli/src/status.ts
|
|
99097
99144
|
async function statusCommand(argv, json2, io, dependencies) {
|
|
@@ -102316,9 +102363,9 @@ async function reserveRemoteAllowance(args) {
|
|
|
102316
102363
|
const perDayAtomic = BigInt(args.caps.perDayAtomic);
|
|
102317
102364
|
const ledgerPath = getVapiPaths(args.home).ledger;
|
|
102318
102365
|
const spent = BigInt((await readSpendLedger(ledgerPath, args.now, args.account)).spentAtomic);
|
|
102319
|
-
const
|
|
102320
|
-
const requested = args.run.budgetUsd === void 0 ?
|
|
102321
|
-
const reserved = requested <
|
|
102366
|
+
const remaining2 = spent >= perDayAtomic ? 0n : perDayAtomic - spent;
|
|
102367
|
+
const requested = args.run.budgetUsd === void 0 ? remaining2 : usdToAtomic(args.run.budgetUsd);
|
|
102368
|
+
const reserved = requested < remaining2 ? requested : remaining2;
|
|
102322
102369
|
if (reserved === 0n) {
|
|
102323
102370
|
throw new RemoteKeyRefusedError(
|
|
102324
102371
|
"no_daily_allowance",
|
|
@@ -102600,12 +102647,12 @@ function createLocalRuntime(options) {
|
|
|
102600
102647
|
const { home } = options;
|
|
102601
102648
|
const entry = options.entry ?? realpathSync(process.argv[1]);
|
|
102602
102649
|
const execPath = options.execPath ?? process.execPath;
|
|
102603
|
-
const
|
|
102650
|
+
const spawn6 = options.spawn ?? nodeSpawn;
|
|
102604
102651
|
const kill = options.kill ?? ((pid, signal) => process.kill(pid, signal));
|
|
102605
102652
|
const processCommand = options.processCommand ?? defaultProcessCommand;
|
|
102606
102653
|
const ownsProcess = (handle, pid) => processCommand(pid)?.includes(runResultPath(home, handle.runId)) === true;
|
|
102607
102654
|
const closeFd = options.closeFd ?? closeSync2;
|
|
102608
|
-
const
|
|
102655
|
+
const readFile32 = options.readFile ?? nodeReadFile;
|
|
102609
102656
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
102610
102657
|
const openLog = options.openLog ?? ((path) => {
|
|
102611
102658
|
mkdirSync2(runsDirectory(home), { recursive: true, mode: 448 });
|
|
@@ -102623,7 +102670,7 @@ function createLocalRuntime(options) {
|
|
|
102623
102670
|
const logFd = openLog(logPath);
|
|
102624
102671
|
let child;
|
|
102625
102672
|
try {
|
|
102626
|
-
child =
|
|
102673
|
+
child = spawn6(execPath, [entry, ...args, "--json", "--result-file", resultPath], {
|
|
102627
102674
|
detached: true,
|
|
102628
102675
|
stdio: ["ignore", logFd, logFd],
|
|
102629
102676
|
env: {
|
|
@@ -102660,7 +102707,7 @@ function createLocalRuntime(options) {
|
|
|
102660
102707
|
return handle;
|
|
102661
102708
|
},
|
|
102662
102709
|
async status(handle) {
|
|
102663
|
-
const result = await readResultFile(
|
|
102710
|
+
const result = await readResultFile(readFile32, runResultPath(home, handle.runId));
|
|
102664
102711
|
if (result !== void 0) return result;
|
|
102665
102712
|
const pid = localPid(handle);
|
|
102666
102713
|
if (pid === void 0 || handle.kind !== "local") {
|
|
@@ -102763,10 +102810,10 @@ function childArguments(member, run) {
|
|
|
102763
102810
|
...run.drawUsd ? ["--draw", run.drawUsd] : []
|
|
102764
102811
|
];
|
|
102765
102812
|
}
|
|
102766
|
-
async function readResultFile(
|
|
102813
|
+
async function readResultFile(readFile32, path) {
|
|
102767
102814
|
let text;
|
|
102768
102815
|
try {
|
|
102769
|
-
text = await
|
|
102816
|
+
text = await readFile32(path, "utf8");
|
|
102770
102817
|
} catch (error61) {
|
|
102771
102818
|
if (hasCode3(error61, "ENOENT")) return void 0;
|
|
102772
102819
|
return { state: "failed", detail: "unreadable result file" };
|
|
@@ -103541,6 +103588,80 @@ import { spawn as spawn3 } from "node:child_process";
|
|
|
103541
103588
|
import { mkdir as mkdir20, readFile as readFile27, writeFile as writeFile11 } from "node:fs/promises";
|
|
103542
103589
|
import { homedir as systemHomedir } from "node:os";
|
|
103543
103590
|
import { dirname as dirname14, posix, win32 as win322 } from "node:path";
|
|
103591
|
+
|
|
103592
|
+
// ../cli/src/toml-config.ts
|
|
103593
|
+
function removeTomlTables(contents, isTarget) {
|
|
103594
|
+
let removing = false;
|
|
103595
|
+
let retained = "";
|
|
103596
|
+
for (const { line, table } of tomlLines(contents)) {
|
|
103597
|
+
if (table !== void 0) removing = isTarget(tomlKeyPath(table));
|
|
103598
|
+
if (!removing) retained += line;
|
|
103599
|
+
}
|
|
103600
|
+
return retained;
|
|
103601
|
+
}
|
|
103602
|
+
function* tomlLines(contents) {
|
|
103603
|
+
let multiline;
|
|
103604
|
+
for (const line of contents.match(/[^\n]*\n|[^\n]+$/g) ?? []) {
|
|
103605
|
+
yield { line, table: multiline === void 0 ? tomlTableName(line) : void 0 };
|
|
103606
|
+
for (let index2 = 0; index2 < line.length; index2 += 1) {
|
|
103607
|
+
const char = line[index2];
|
|
103608
|
+
if (multiline !== void 0) {
|
|
103609
|
+
if (multiline === '"""' && char === "\\") {
|
|
103610
|
+
index2 += 1;
|
|
103611
|
+
continue;
|
|
103612
|
+
}
|
|
103613
|
+
if (line.startsWith(multiline, index2)) {
|
|
103614
|
+
index2 += 2;
|
|
103615
|
+
multiline = void 0;
|
|
103616
|
+
}
|
|
103617
|
+
} else {
|
|
103618
|
+
if (char === "#") break;
|
|
103619
|
+
if (char !== "'" && char !== '"') continue;
|
|
103620
|
+
const delimiter2 = char.repeat(3);
|
|
103621
|
+
if (line.startsWith(delimiter2, index2)) {
|
|
103622
|
+
multiline = delimiter2;
|
|
103623
|
+
index2 += 2;
|
|
103624
|
+
} else {
|
|
103625
|
+
for (index2 += 1; index2 < line.length; index2 += 1) {
|
|
103626
|
+
if (char === '"' && line[index2] === "\\") index2 += 1;
|
|
103627
|
+
else if (line[index2] === char) break;
|
|
103628
|
+
}
|
|
103629
|
+
}
|
|
103630
|
+
}
|
|
103631
|
+
}
|
|
103632
|
+
}
|
|
103633
|
+
}
|
|
103634
|
+
function tomlKeyPath(table) {
|
|
103635
|
+
const key2 = String.raw`(?:[A-Za-z0-9_-]+|"(?:[^"\\]|\\.)*"|'[^']*')`;
|
|
103636
|
+
const pattern = new RegExp(`^\\s*(${key2})(?:\\s*\\.\\s*(${key2}))*\\s*$`);
|
|
103637
|
+
if (!pattern.test(table)) return [];
|
|
103638
|
+
return [...table.matchAll(new RegExp(key2, "g"))].map(([part]) => unquoteTomlKey(part));
|
|
103639
|
+
}
|
|
103640
|
+
function tomlTableName(line) {
|
|
103641
|
+
const header = line.replace(/\r?\n$/, "");
|
|
103642
|
+
const match = /^\s*(?:\[\[\s*(.*?)\s*\]\]|\[\s*(.*?)\s*\])\s*(?:#.*)?$/.exec(header);
|
|
103643
|
+
return match?.[1] ?? match?.[2];
|
|
103644
|
+
}
|
|
103645
|
+
function unquoteTomlKey(key2) {
|
|
103646
|
+
if (key2.startsWith("'") && key2.endsWith("'")) return key2.slice(1, -1);
|
|
103647
|
+
if (key2.startsWith('"') && key2.endsWith('"')) {
|
|
103648
|
+
try {
|
|
103649
|
+
return JSON.parse(key2);
|
|
103650
|
+
} catch {
|
|
103651
|
+
return key2;
|
|
103652
|
+
}
|
|
103653
|
+
}
|
|
103654
|
+
return key2;
|
|
103655
|
+
}
|
|
103656
|
+
function tomlSeparator(contents) {
|
|
103657
|
+
if (contents.length === 0 || /(?:\r?\n)[ \t]*(?:\r?\n)$/.test(contents)) return "";
|
|
103658
|
+
return /\r?\n$/.test(contents) ? "\n" : "\n\n";
|
|
103659
|
+
}
|
|
103660
|
+
function escapeToml(value) {
|
|
103661
|
+
return JSON.stringify(value).slice(1, -1);
|
|
103662
|
+
}
|
|
103663
|
+
|
|
103664
|
+
// ../cli/src/mcp-install.ts
|
|
103544
103665
|
var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude-code|claude-desktop|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
|
|
103545
103666
|
var APPS = /* @__PURE__ */ new Set(["claude-code", "claude-desktop", "cursor", "codex"]);
|
|
103546
103667
|
var CLAUDE_ALIAS_NOTICE = "vapi mcp install claude installs into Claude Desktop; for the Claude Code CLI use: vapi mcp install claude-code";
|
|
@@ -103826,7 +103947,10 @@ function jsonConfig(path, existing, entry) {
|
|
|
103826
103947
|
`;
|
|
103827
103948
|
}
|
|
103828
103949
|
function tomlConfig(existing, entry) {
|
|
103829
|
-
const retained =
|
|
103950
|
+
const retained = removeTomlTables(
|
|
103951
|
+
existing,
|
|
103952
|
+
([root, name]) => root === "mcp_servers" && name === "vapi"
|
|
103953
|
+
);
|
|
103830
103954
|
const block = [
|
|
103831
103955
|
"[mcp_servers.vapi]",
|
|
103832
103956
|
'command = "npx"',
|
|
@@ -103836,46 +103960,6 @@ function tomlConfig(existing, entry) {
|
|
|
103836
103960
|
].join("\n");
|
|
103837
103961
|
return `${retained}${tomlSeparator(retained)}${block}`;
|
|
103838
103962
|
}
|
|
103839
|
-
function removeVapiTomlTables(contents) {
|
|
103840
|
-
const lines = contents.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
103841
|
-
let removing = false;
|
|
103842
|
-
let retained = "";
|
|
103843
|
-
for (const line of lines) {
|
|
103844
|
-
const table = tomlTableName(line);
|
|
103845
|
-
if (table !== void 0) removing = isVapiTomlTable(table);
|
|
103846
|
-
if (!removing) retained += line;
|
|
103847
|
-
}
|
|
103848
|
-
return retained;
|
|
103849
|
-
}
|
|
103850
|
-
function tomlTableName(line) {
|
|
103851
|
-
const header = line.replace(/\r?\n$/, "");
|
|
103852
|
-
const match = /^\s*(?:\[\[\s*(.*?)\s*\]\]|\[\s*(.*?)\s*\])\s*(?:#.*)?$/.exec(header);
|
|
103853
|
-
return match?.[1] ?? match?.[2];
|
|
103854
|
-
}
|
|
103855
|
-
function isVapiTomlTable(table) {
|
|
103856
|
-
const key2 = String.raw`(?:[A-Za-z0-9_-]+|"(?:[^"\\]|\\.)*"|'[^']*')`;
|
|
103857
|
-
const match = new RegExp(`^\\s*(${key2})\\s*\\.\\s*(${key2})(?:\\s*\\.|\\s*$)`).exec(table);
|
|
103858
|
-
if (match === null) return false;
|
|
103859
|
-
return unquoteTomlKey(match[1]) === "mcp_servers" && unquoteTomlKey(match[2]) === "vapi";
|
|
103860
|
-
}
|
|
103861
|
-
function unquoteTomlKey(key2) {
|
|
103862
|
-
if (key2.startsWith("'") && key2.endsWith("'")) return key2.slice(1, -1);
|
|
103863
|
-
if (key2.startsWith('"') && key2.endsWith('"')) {
|
|
103864
|
-
try {
|
|
103865
|
-
return JSON.parse(key2);
|
|
103866
|
-
} catch {
|
|
103867
|
-
return key2;
|
|
103868
|
-
}
|
|
103869
|
-
}
|
|
103870
|
-
return key2;
|
|
103871
|
-
}
|
|
103872
|
-
function tomlSeparator(contents) {
|
|
103873
|
-
if (contents.length === 0 || /(?:\r?\n)[ \t]*(?:\r?\n)$/.test(contents)) return "";
|
|
103874
|
-
return /\r?\n$/.test(contents) ? "\n" : "\n\n";
|
|
103875
|
-
}
|
|
103876
|
-
function escapeToml(value) {
|
|
103877
|
-
return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
103878
|
-
}
|
|
103879
103963
|
function isRecord12(value) {
|
|
103880
103964
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
103881
103965
|
}
|
|
@@ -103897,6 +103981,546 @@ async function pathExists5(path) {
|
|
|
103897
103981
|
}
|
|
103898
103982
|
}
|
|
103899
103983
|
|
|
103984
|
+
// ../cli/src/code.ts
|
|
103985
|
+
import { constants as constants2 } from "node:fs";
|
|
103986
|
+
import { access, mkdir as mkdir21, readFile as readFile28, realpath, unlink as unlink13, writeFile as writeFile12 } from "node:fs/promises";
|
|
103987
|
+
import { homedir as homedir3 } from "node:os";
|
|
103988
|
+
import { basename as basename5, dirname as dirname15, join as join26, posix as posix2, win32 as win323 } from "node:path";
|
|
103989
|
+
var VAPI_CODEX_PROVIDER = "vapi";
|
|
103990
|
+
var VAPI_CODEX_PROFILE = "vapi";
|
|
103991
|
+
var VAPI_CODEX_DEFAULT_MODEL = "venice/openai-gpt-61-sol";
|
|
103992
|
+
var VAPI_ROUTER_KEY_ENV = "VAPI_ROUTER_KEY";
|
|
103993
|
+
function codexConfigPath(env, home) {
|
|
103994
|
+
return join26(env.CODEX_HOME || join26(home, ".codex"), "config.toml");
|
|
103995
|
+
}
|
|
103996
|
+
function hasVapiCodexProfile(contents) {
|
|
103997
|
+
const roots = new Set(
|
|
103998
|
+
[...tomlLines(contents)].flatMap(({ table }) => {
|
|
103999
|
+
const path = table === void 0 ? [] : tomlKeyPath(table);
|
|
104000
|
+
return path.length === 2 && path[1] === "vapi" ? [path[0]] : [];
|
|
104001
|
+
})
|
|
104002
|
+
);
|
|
104003
|
+
return roots.has("model_providers") && roots.has("profiles");
|
|
104004
|
+
}
|
|
104005
|
+
async function resolveBinary(name, options) {
|
|
104006
|
+
const windows = (options.platform ?? process.platform) === "win32";
|
|
104007
|
+
const path = options.env.PATH ?? (windows ? Object.entries(options.env).find(([key2]) => key2.toLowerCase() === "path")?.[1] : void 0);
|
|
104008
|
+
if (path === void 0) return void 0;
|
|
104009
|
+
const paths = windows ? win323 : posix2;
|
|
104010
|
+
const canonical = options.realpath ?? realpath;
|
|
104011
|
+
const executable = options.isExecutable ?? (async (candidate) => {
|
|
104012
|
+
try {
|
|
104013
|
+
await access(candidate, constants2.X_OK);
|
|
104014
|
+
return true;
|
|
104015
|
+
} catch (error61) {
|
|
104016
|
+
if (isMissingFile(error61) || error61.code === "EACCES")
|
|
104017
|
+
return false;
|
|
104018
|
+
throw error61;
|
|
104019
|
+
}
|
|
104020
|
+
});
|
|
104021
|
+
const self = options.selfPath ?? process.argv[1];
|
|
104022
|
+
const selfReal = self === void 0 ? void 0 : await canonical(self);
|
|
104023
|
+
const extensions = windows ? ["", ...(options.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";")] : [""];
|
|
104024
|
+
for (const directory of path.split(windows ? ";" : ":")) {
|
|
104025
|
+
for (const extension of extensions) {
|
|
104026
|
+
const candidate = paths.resolve(directory.replace(/^"|"$/gu, ""), `${name}${extension}`);
|
|
104027
|
+
if (!await executable(candidate)) continue;
|
|
104028
|
+
const resolved = await canonical(candidate);
|
|
104029
|
+
if (selfReal !== void 0 && (windows ? resolved.toLowerCase() === selfReal.toLowerCase() : resolved === selfReal))
|
|
104030
|
+
continue;
|
|
104031
|
+
return candidate;
|
|
104032
|
+
}
|
|
104033
|
+
}
|
|
104034
|
+
return void 0;
|
|
104035
|
+
}
|
|
104036
|
+
var RC_START = "# >>> vapi code >>>";
|
|
104037
|
+
var RC_END = "# <<< vapi code <<<";
|
|
104038
|
+
var CONFIG_END = "# <<< vapi code config <<<\n";
|
|
104039
|
+
var isCodeTable = ([root, name]) => name === "vapi" && (root === "model_providers" || root === "profiles");
|
|
104040
|
+
function cleanConfig(contents) {
|
|
104041
|
+
let created = false;
|
|
104042
|
+
const cleaned = contents.replace(
|
|
104043
|
+
/(\n?)\[model_providers\.vapi\]\n# >>> vapi code config (created|existing) (0|1) >>>\n([\s\S]*?)# <<< vapi code config <<<\n/gu,
|
|
104044
|
+
(_, prefix, kind, separator, body) => {
|
|
104045
|
+
created ||= kind === "created";
|
|
104046
|
+
return (separator === "1" ? "" : prefix) + removeTomlTables(`[model_providers.vapi]
|
|
104047
|
+
${body}`, isCodeTable);
|
|
104048
|
+
}
|
|
104049
|
+
);
|
|
104050
|
+
return { contents: removeTomlTables(cleaned, isCodeTable), created };
|
|
104051
|
+
}
|
|
104052
|
+
function configContents(existing, baseURL) {
|
|
104053
|
+
const clean2 = cleanConfig(existing ?? "");
|
|
104054
|
+
const retained = clean2.contents;
|
|
104055
|
+
const separator = retained.length > 0 && !retained.endsWith("\n") ? "\n" : "";
|
|
104056
|
+
return `${retained}${separator}[model_providers.vapi]
|
|
104057
|
+
# >>> vapi code config ${existing === void 0 || clean2.created ? "created" : "existing"} ${separator.length} >>>
|
|
104058
|
+
` + [
|
|
104059
|
+
'name = "vAPI Router"',
|
|
104060
|
+
`base_url = "${escapeToml(baseURL)}"`,
|
|
104061
|
+
`env_key = "${VAPI_ROUTER_KEY_ENV}"`,
|
|
104062
|
+
'wire_api = "responses"',
|
|
104063
|
+
"",
|
|
104064
|
+
"[profiles.vapi]",
|
|
104065
|
+
`model_provider = "${VAPI_CODEX_PROVIDER}"`,
|
|
104066
|
+
`model = "${VAPI_CODEX_DEFAULT_MODEL}"`,
|
|
104067
|
+
""
|
|
104068
|
+
].join("\n") + CONFIG_END;
|
|
104069
|
+
}
|
|
104070
|
+
function removeAliases(contents) {
|
|
104071
|
+
return contents.replace(
|
|
104072
|
+
/(^|\n)# >>> vapi code >>>\r?\n[\s\S]*?^# <<< vapi code <<<(\r?\n|$)/gmu,
|
|
104073
|
+
(_, prefix, suffix) => suffix === "" ? "" : prefix
|
|
104074
|
+
);
|
|
104075
|
+
}
|
|
104076
|
+
function aliasContents(original, tools) {
|
|
104077
|
+
const existing = original ?? "";
|
|
104078
|
+
const block = [RC_START, ...tools.map((tool) => `alias ${tool}="vapi ${tool}"`), RC_END].join(
|
|
104079
|
+
"\n"
|
|
104080
|
+
);
|
|
104081
|
+
const match = /^# >>> vapi code >>>\r?\n[\s\S]*?^# <<< vapi code <<</gmu;
|
|
104082
|
+
if (match.test(existing)) return existing.replace(match, block);
|
|
104083
|
+
const separator = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
104084
|
+
return `${existing}${separator}${block}${original === "" || existing.endsWith("\n") ? "\n" : ""}`;
|
|
104085
|
+
}
|
|
104086
|
+
async function readOptional(path) {
|
|
104087
|
+
try {
|
|
104088
|
+
return await readFile28(path, "utf8");
|
|
104089
|
+
} catch (error61) {
|
|
104090
|
+
if (isMissingFile(error61)) return void 0;
|
|
104091
|
+
throw error61;
|
|
104092
|
+
}
|
|
104093
|
+
}
|
|
104094
|
+
async function writeConfig(path, contents) {
|
|
104095
|
+
await mkdir21(dirname15(path), { recursive: true });
|
|
104096
|
+
await writeFile12(path, contents);
|
|
104097
|
+
}
|
|
104098
|
+
async function codeCommand(argv, json2, io, dependencies) {
|
|
104099
|
+
const command = argv[0];
|
|
104100
|
+
if (command !== "install" && command !== "uninstall")
|
|
104101
|
+
throw new UsageError("Usage: vapi code <install|uninstall>.");
|
|
104102
|
+
const parsed = parseArguments(argv.slice(1), {
|
|
104103
|
+
valueOptions: new Set(command === "install" ? ["--wallet"] : []),
|
|
104104
|
+
booleanOptions: new Set(command === "install" ? ["--yes", "--no-alias"] : []),
|
|
104105
|
+
maximumPositionals: 0
|
|
104106
|
+
});
|
|
104107
|
+
const env = getEnvironment(dependencies);
|
|
104108
|
+
const home = dependencies.code?.homedir ?? homedir3();
|
|
104109
|
+
const config2 = codexConfigPath(env, home);
|
|
104110
|
+
const rcPaths = [join26(home, ".zshrc"), join26(home, ".bashrc")];
|
|
104111
|
+
if (command === "uninstall") {
|
|
104112
|
+
const removed = [];
|
|
104113
|
+
const previous = await readOptional(config2);
|
|
104114
|
+
if (previous !== void 0) {
|
|
104115
|
+
const clean2 = cleanConfig(previous);
|
|
104116
|
+
if (clean2.contents !== previous) {
|
|
104117
|
+
if (clean2.contents === "" && clean2.created) await unlink13(config2);
|
|
104118
|
+
else await writeFile12(config2, clean2.contents);
|
|
104119
|
+
removed.push(config2);
|
|
104120
|
+
}
|
|
104121
|
+
}
|
|
104122
|
+
for (const path of rcPaths) {
|
|
104123
|
+
const previous2 = await readOptional(path);
|
|
104124
|
+
if (previous2 === void 0) continue;
|
|
104125
|
+
const clean2 = removeAliases(previous2);
|
|
104126
|
+
if (clean2 !== previous2) {
|
|
104127
|
+
if (clean2 === "" && previous2.startsWith(RC_START) && !previous2.endsWith("\n"))
|
|
104128
|
+
await unlink13(path);
|
|
104129
|
+
else await writeFile12(path, clean2);
|
|
104130
|
+
removed.push(path);
|
|
104131
|
+
}
|
|
104132
|
+
}
|
|
104133
|
+
io.stdout(
|
|
104134
|
+
json2 ? JSON.stringify({ command: "code uninstall", removed }) : removed.length === 0 ? "Nothing to remove." : `Removed vAPI code settings from: ${removed.join(", ")}`
|
|
104135
|
+
);
|
|
104136
|
+
return 0;
|
|
104137
|
+
}
|
|
104138
|
+
const tools = [];
|
|
104139
|
+
const skipped2 = [];
|
|
104140
|
+
for (const name of ["claude", "codex"]) {
|
|
104141
|
+
const binary = await resolveBinary(name, { ...dependencies.code, env });
|
|
104142
|
+
if (binary === void 0)
|
|
104143
|
+
skipped2.push(
|
|
104144
|
+
`Skipped ${name === "claude" ? "Claude Code" : "Codex"}: \`${name}\` is not on PATH.`
|
|
104145
|
+
);
|
|
104146
|
+
else tools.push(name);
|
|
104147
|
+
}
|
|
104148
|
+
if (tools.length === 0) {
|
|
104149
|
+
const message = "Neither claude nor codex is on PATH; nothing was installed.";
|
|
104150
|
+
if (json2) io.stdout(JSON.stringify({ installed: [], skipped: skipped2, error: message }));
|
|
104151
|
+
else {
|
|
104152
|
+
skipped2.forEach(io.stderr);
|
|
104153
|
+
io.stderr(message);
|
|
104154
|
+
}
|
|
104155
|
+
return 1;
|
|
104156
|
+
}
|
|
104157
|
+
let target = await targetWallet(parsed, dependencies);
|
|
104158
|
+
const credentials = dependencies.router?.routerCredentials ?? routerCredentials;
|
|
104159
|
+
let linked = false;
|
|
104160
|
+
let rotated = false;
|
|
104161
|
+
let result;
|
|
104162
|
+
for (; ; ) {
|
|
104163
|
+
try {
|
|
104164
|
+
result = await credentials(routerDeps2(target, dependencies));
|
|
104165
|
+
break;
|
|
104166
|
+
} catch (error61) {
|
|
104167
|
+
if (error61 instanceof RouterClientError && error61.code === "not_linked" && !linked) {
|
|
104168
|
+
linked = true;
|
|
104169
|
+
const account = parsed.one("--wallet");
|
|
104170
|
+
await (dependencies.code?.login ?? runLoginFlow)(
|
|
104171
|
+
account === void 0 ? [] : ["--account", account],
|
|
104172
|
+
json2,
|
|
104173
|
+
{ ...io, stdout: io.stderr },
|
|
104174
|
+
json2 ? { ...dependencies, interactive: false, stdinIsTTY: false } : dependencies
|
|
104175
|
+
);
|
|
104176
|
+
target = await targetWallet(parsed, dependencies);
|
|
104177
|
+
} else if (error61 instanceof RouterClientError && error61.code === "no_router_key" && !rotated) {
|
|
104178
|
+
rotated = true;
|
|
104179
|
+
await (dependencies.router?.rotateRouterKey ?? rotateRouterKey)(
|
|
104180
|
+
routerDeps2(target, dependencies)
|
|
104181
|
+
);
|
|
104182
|
+
} else throw error61;
|
|
104183
|
+
}
|
|
104184
|
+
}
|
|
104185
|
+
const installed = [];
|
|
104186
|
+
if (tools.includes("claude")) installed.push("Claude Code: ready, launch with `vapi claude`");
|
|
104187
|
+
if (tools.includes("codex")) {
|
|
104188
|
+
await writeConfig(config2, configContents(await readOptional(config2), result.baseURL));
|
|
104189
|
+
installed.push(`Codex: installed ${config2}`);
|
|
104190
|
+
}
|
|
104191
|
+
let alias = "Aliases: skipped.";
|
|
104192
|
+
if (!parsed.has("--no-alias")) {
|
|
104193
|
+
if ((dependencies.code?.platform ?? process.platform) === "win32")
|
|
104194
|
+
alias = "Aliases: skipped on Windows.";
|
|
104195
|
+
else {
|
|
104196
|
+
const yes = parsed.has("--yes") || !json2 && isInteractive(dependencies) && isStdinInteractive(dependencies) && /^y(?:es)?$/iu.test(
|
|
104197
|
+
(await getLinePrompt(dependencies)(
|
|
104198
|
+
"Make `claude` and `codex` use your vAPI Compute first from now on? [y/N] "
|
|
104199
|
+
)).trim()
|
|
104200
|
+
);
|
|
104201
|
+
if (yes) {
|
|
104202
|
+
const shell = basename5(env.SHELL ?? "");
|
|
104203
|
+
const rc = shell === "zsh" ? rcPaths[0] : shell === "bash" ? rcPaths[1] : await readOptional(rcPaths[0]) !== void 0 ? rcPaths[0] : rcPaths[1];
|
|
104204
|
+
await writeConfig(rc, aliasContents(await readOptional(rc), tools));
|
|
104205
|
+
alias = `Aliases: installed in ${rc}. Open a new terminal or run: source ${rc}`;
|
|
104206
|
+
}
|
|
104207
|
+
}
|
|
104208
|
+
}
|
|
104209
|
+
let compute;
|
|
104210
|
+
try {
|
|
104211
|
+
const usage = await (dependencies.router?.routerUsage ?? routerUsage)(
|
|
104212
|
+
routerDeps2(target, dependencies)
|
|
104213
|
+
);
|
|
104214
|
+
const reset = new Date(usage.compute.resetsAt);
|
|
104215
|
+
if (!Number.isFinite(reset.getTime())) throw new Error("invalid reset time");
|
|
104216
|
+
compute = `$${usage.compute.remainingTodayUsd.toFixed(2)} left today (resets ${reset.toISOString().slice(11, 16)} UTC)`;
|
|
104217
|
+
} catch (error61) {
|
|
104218
|
+
compute = `Compute today: unavailable (${error61 instanceof RouterClientError ? error61.code : "request failed"})`;
|
|
104219
|
+
}
|
|
104220
|
+
const start = `Start with \`vapi ${tools.includes("claude") ? "claude" : "codex"}\``;
|
|
104221
|
+
if (json2)
|
|
104222
|
+
io.stdout(
|
|
104223
|
+
JSON.stringify({ command: "code install", installed, skipped: skipped2, alias, compute, start })
|
|
104224
|
+
);
|
|
104225
|
+
else {
|
|
104226
|
+
skipped2.forEach(io.stderr);
|
|
104227
|
+
[...installed, alias, compute, start].forEach(io.stdout);
|
|
104228
|
+
}
|
|
104229
|
+
return 0;
|
|
104230
|
+
}
|
|
104231
|
+
|
|
104232
|
+
// ../cli/src/code-launch.ts
|
|
104233
|
+
import { spawn as spawn4 } from "node:child_process";
|
|
104234
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
104235
|
+
import { constants as constants3, homedir as homedir4 } from "node:os";
|
|
104236
|
+
var CLAUDE_MODELS = {
|
|
104237
|
+
sonnet: "venice/claude-sonnet-5-5",
|
|
104238
|
+
opus: "venice/claude-opus-5-5",
|
|
104239
|
+
haiku: "venice/claude-haiku-5-5"
|
|
104240
|
+
};
|
|
104241
|
+
async function claudeCommand(argv, json2, io, dependencies) {
|
|
104242
|
+
return await launch("claude", argv, json2, io, dependencies);
|
|
104243
|
+
}
|
|
104244
|
+
async function codexCommand(argv, json2, io, dependencies) {
|
|
104245
|
+
return await launch("codex", argv, json2, io, dependencies);
|
|
104246
|
+
}
|
|
104247
|
+
function parseLaunch(argv) {
|
|
104248
|
+
const result = { own: false, vapi: false, balance: false, forwarded: [] };
|
|
104249
|
+
for (let index2 = 0; index2 < argv.length; index2 += 1) {
|
|
104250
|
+
const arg = argv[index2];
|
|
104251
|
+
if (arg === "--") {
|
|
104252
|
+
result.forwarded.push(...argv.slice(index2 + 1));
|
|
104253
|
+
break;
|
|
104254
|
+
}
|
|
104255
|
+
if (arg === "--own") result.own = true;
|
|
104256
|
+
else if (arg === "--vapi") result.vapi = true;
|
|
104257
|
+
else if (arg === "--use-balance") result.balance = true;
|
|
104258
|
+
else if (arg === "--model" || arg === "--account") {
|
|
104259
|
+
const value = argv[++index2];
|
|
104260
|
+
if (!value || value.startsWith("--")) throw new UsageError(`Expected ${arg} <value>.`);
|
|
104261
|
+
if (arg === "--model") result.model = value;
|
|
104262
|
+
else result.account = value;
|
|
104263
|
+
} else result.forwarded.push(arg);
|
|
104264
|
+
}
|
|
104265
|
+
if (result.own && result.vapi) throw new UsageError("--vapi and --own cannot be used together.");
|
|
104266
|
+
return result;
|
|
104267
|
+
}
|
|
104268
|
+
var LaunchTimeout = class extends Error {
|
|
104269
|
+
constructor() {
|
|
104270
|
+
super("timed out");
|
|
104271
|
+
}
|
|
104272
|
+
};
|
|
104273
|
+
async function bounded(operation, milliseconds) {
|
|
104274
|
+
const controller = new AbortController();
|
|
104275
|
+
let timer;
|
|
104276
|
+
try {
|
|
104277
|
+
return await Promise.race([
|
|
104278
|
+
new Promise((_resolve, reject) => {
|
|
104279
|
+
timer = setTimeout(() => {
|
|
104280
|
+
const error61 = new LaunchTimeout();
|
|
104281
|
+
controller.abort(error61);
|
|
104282
|
+
reject(error61);
|
|
104283
|
+
}, milliseconds);
|
|
104284
|
+
}),
|
|
104285
|
+
operation(controller.signal)
|
|
104286
|
+
]);
|
|
104287
|
+
} finally {
|
|
104288
|
+
clearTimeout(timer);
|
|
104289
|
+
controller.abort();
|
|
104290
|
+
}
|
|
104291
|
+
}
|
|
104292
|
+
function abortableDeps(deps, signal) {
|
|
104293
|
+
const fetchImpl = deps.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: false });
|
|
104294
|
+
return {
|
|
104295
|
+
...deps,
|
|
104296
|
+
fetchImpl: (input2, init) => fetchImpl(input2, {
|
|
104297
|
+
...init,
|
|
104298
|
+
signal: init?.signal ? AbortSignal.any([signal, init.signal]) : signal
|
|
104299
|
+
})
|
|
104300
|
+
};
|
|
104301
|
+
}
|
|
104302
|
+
function shortReason(error61, env, credentials) {
|
|
104303
|
+
if (error61 instanceof RouterClientError) {
|
|
104304
|
+
if (error61.code === "not_linked") return "not linked, run vapi code install";
|
|
104305
|
+
if (error61.code === "no_router_key") return "no Router key, run vapi code install";
|
|
104306
|
+
}
|
|
104307
|
+
let message = error61 instanceof Error ? error61.message : String(error61);
|
|
104308
|
+
for (const secret of [
|
|
104309
|
+
credentials?.apiKey,
|
|
104310
|
+
env.ANTHROPIC_API_KEY,
|
|
104311
|
+
env.ANTHROPIC_AUTH_TOKEN,
|
|
104312
|
+
env[VAPI_ROUTER_KEY_ENV]
|
|
104313
|
+
]) {
|
|
104314
|
+
if (secret) message = message.replaceAll(secret, "[redacted]");
|
|
104315
|
+
}
|
|
104316
|
+
return message.replace(/\s+/gu, " ").trim().slice(0, 160) || "request failed";
|
|
104317
|
+
}
|
|
104318
|
+
async function chooseRoute(options, env, dependencies) {
|
|
104319
|
+
if (options.own) return { kind: "own" };
|
|
104320
|
+
const timeout = dependencies.code?.usageTimeoutMs ?? 4e3;
|
|
104321
|
+
let credentials;
|
|
104322
|
+
let deps;
|
|
104323
|
+
let balanceKeyRequired = false;
|
|
104324
|
+
try {
|
|
104325
|
+
credentials = await bounded(async (signal) => {
|
|
104326
|
+
const target = await targetWallet(
|
|
104327
|
+
{ one: (name) => name === "--wallet" ? options.account : void 0 },
|
|
104328
|
+
dependencies,
|
|
104329
|
+
env.VAPI_HOME
|
|
104330
|
+
);
|
|
104331
|
+
signal.throwIfAborted();
|
|
104332
|
+
deps = routerDeps2(target, dependencies);
|
|
104333
|
+
return await (dependencies.router?.routerCredentials ?? routerCredentials)(
|
|
104334
|
+
abortableDeps(deps, signal)
|
|
104335
|
+
);
|
|
104336
|
+
}, timeout);
|
|
104337
|
+
let usage;
|
|
104338
|
+
try {
|
|
104339
|
+
usage = await bounded(
|
|
104340
|
+
(signal) => (dependencies.router?.routerUsage ?? routerUsage)(abortableDeps(deps, signal)),
|
|
104341
|
+
timeout
|
|
104342
|
+
);
|
|
104343
|
+
if (!Number.isFinite(new Date(usage.compute.resetsAt).getTime()))
|
|
104344
|
+
throw new Error("invalid Compute reset time");
|
|
104345
|
+
} catch (error61) {
|
|
104346
|
+
if (options.vapi) return { kind: "vapi", credentials };
|
|
104347
|
+
throw error61;
|
|
104348
|
+
}
|
|
104349
|
+
if (options.vapi || remaining(usage, options.balance) >= 0.5) {
|
|
104350
|
+
if (options.balance && usage.compute.remainingTodayUsd < 0.5 && (usage.balance?.remainingUsd ?? 0) > 0) {
|
|
104351
|
+
balanceKeyRequired = true;
|
|
104352
|
+
credentials = await bounded(
|
|
104353
|
+
(signal) => (dependencies.router?.routerCredentials ?? routerCredentials)(
|
|
104354
|
+
abortableDeps(deps, signal),
|
|
104355
|
+
{ funding: "balance" }
|
|
104356
|
+
),
|
|
104357
|
+
timeout
|
|
104358
|
+
);
|
|
104359
|
+
}
|
|
104360
|
+
return { kind: "vapi", credentials, usage };
|
|
104361
|
+
}
|
|
104362
|
+
return { kind: "own", exhausted: true };
|
|
104363
|
+
} catch (error61) {
|
|
104364
|
+
const reason = balanceKeyRequired && error61 instanceof RouterClientError && error61.code === "no_router_key" ? "no Router balance key is stored" : shortReason(error61, env, credentials);
|
|
104365
|
+
if (options.vapi) return { kind: "unavailable", reason };
|
|
104366
|
+
return { kind: "own", reason };
|
|
104367
|
+
}
|
|
104368
|
+
}
|
|
104369
|
+
function remaining(usage, useBalance) {
|
|
104370
|
+
return usage.compute.remainingTodayUsd + (useBalance ? usage.balance?.remainingUsd ?? 0 : 0);
|
|
104371
|
+
}
|
|
104372
|
+
async function launch(tool, argv, json2, io, dependencies) {
|
|
104373
|
+
if (json2) throw new UsageError(`vapi ${tool} is interactive and does not support --json.`);
|
|
104374
|
+
const options = parseLaunch(argv);
|
|
104375
|
+
const env = getEnvironment(dependencies);
|
|
104376
|
+
let binary;
|
|
104377
|
+
try {
|
|
104378
|
+
binary = await resolveBinary(tool, { ...dependencies.code, env });
|
|
104379
|
+
} catch (error61) {
|
|
104380
|
+
io.stderr(shortReason(error61, env));
|
|
104381
|
+
return 127;
|
|
104382
|
+
}
|
|
104383
|
+
if (binary === void 0) {
|
|
104384
|
+
io.stderr(
|
|
104385
|
+
`\`${tool}\` is not on PATH. Install ${tool === "claude" ? "Claude Code" : "Codex"} first.`
|
|
104386
|
+
);
|
|
104387
|
+
return 127;
|
|
104388
|
+
}
|
|
104389
|
+
const route = await chooseRoute(options, env, dependencies);
|
|
104390
|
+
if (route.kind === "unavailable") {
|
|
104391
|
+
io.stderr(route.reason);
|
|
104392
|
+
return 1;
|
|
104393
|
+
}
|
|
104394
|
+
let args = options.forwarded;
|
|
104395
|
+
let childEnv = env;
|
|
104396
|
+
const own2 = tool === "claude" ? "your own Claude subscription" : "your own Codex/ChatGPT login";
|
|
104397
|
+
if (route.kind === "own") {
|
|
104398
|
+
if (route.exhausted) io.stderr(`\u25CF Compute used up today \u2192 ${own2}`);
|
|
104399
|
+
else if (route.reason !== void 0) io.stderr(`\u25CF vAPI unreachable (${route.reason}) \u2192 ${own2}`);
|
|
104400
|
+
if (options.model !== void 0)
|
|
104401
|
+
args = [tool === "claude" ? "--model" : "-m", options.model, ...args];
|
|
104402
|
+
} else {
|
|
104403
|
+
const { credentials, usage } = route;
|
|
104404
|
+
const model = tool === "claude" ? claudeModel(options.model) : options.model ?? VAPI_CODEX_DEFAULT_MODEL;
|
|
104405
|
+
let status = "\u25CF vAPI Compute";
|
|
104406
|
+
if (usage !== void 0)
|
|
104407
|
+
status += ` \u2014 $${remaining(usage, options.balance).toFixed(2)} left today (resets ${new Date(usage.compute.resetsAt).toISOString().slice(11, 16)} UTC)`;
|
|
104408
|
+
io.stderr(`${status} \xB7 model ${model.slice(model.lastIndexOf("/") + 1)}`);
|
|
104409
|
+
io.stderr(
|
|
104410
|
+
tool === "claude" ? " Compute runs out mid-session? /exit, then: vapi claude --continue" : " Compute runs out mid-session? /quit, then: vapi codex resume --last"
|
|
104411
|
+
);
|
|
104412
|
+
if (tool === "claude") {
|
|
104413
|
+
childEnv = {
|
|
104414
|
+
...env,
|
|
104415
|
+
ANTHROPIC_BASE_URL: credentials.baseURL.replace(/\/v1\/?$/u, ""),
|
|
104416
|
+
ANTHROPIC_AUTH_TOKEN: credentials.apiKey
|
|
104417
|
+
};
|
|
104418
|
+
delete childEnv.ANTHROPIC_API_KEY;
|
|
104419
|
+
if (args.some((arg) => arg === "--settings" || arg.startsWith("--settings=")))
|
|
104420
|
+
io.stderr("\u25CF Your --settings is passed as is; vAPI model settings were not added.");
|
|
104421
|
+
else
|
|
104422
|
+
args = [
|
|
104423
|
+
"--settings",
|
|
104424
|
+
JSON.stringify({
|
|
104425
|
+
env: {
|
|
104426
|
+
ANTHROPIC_MODEL: model,
|
|
104427
|
+
ANTHROPIC_DEFAULT_SONNET_MODEL: CLAUDE_MODELS.sonnet,
|
|
104428
|
+
ANTHROPIC_DEFAULT_OPUS_MODEL: CLAUDE_MODELS.opus,
|
|
104429
|
+
ANTHROPIC_DEFAULT_HAIKU_MODEL: CLAUDE_MODELS.haiku,
|
|
104430
|
+
CLAUDE_CODE_MAX_RETRIES: "2"
|
|
104431
|
+
}
|
|
104432
|
+
}),
|
|
104433
|
+
...args
|
|
104434
|
+
];
|
|
104435
|
+
} else {
|
|
104436
|
+
childEnv = { ...env, [VAPI_ROUTER_KEY_ENV]: credentials.apiKey };
|
|
104437
|
+
args = [...await codexArgs(env, credentials.baseURL, options.model, dependencies), ...args];
|
|
104438
|
+
}
|
|
104439
|
+
}
|
|
104440
|
+
return await runChild(binary, args, childEnv, io, dependencies);
|
|
104441
|
+
}
|
|
104442
|
+
function claudeModel(model) {
|
|
104443
|
+
return model === void 0 ? CLAUDE_MODELS.sonnet : Object.hasOwn(CLAUDE_MODELS, model) ? CLAUDE_MODELS[model] : model;
|
|
104444
|
+
}
|
|
104445
|
+
async function codexArgs(env, baseURL, model, dependencies) {
|
|
104446
|
+
let contents = "";
|
|
104447
|
+
try {
|
|
104448
|
+
contents = await readFile29(
|
|
104449
|
+
codexConfigPath(env, dependencies.code?.homedir ?? homedir4()),
|
|
104450
|
+
"utf8"
|
|
104451
|
+
);
|
|
104452
|
+
} catch (error61) {
|
|
104453
|
+
if (!isMissingFile(error61)) throw error61;
|
|
104454
|
+
}
|
|
104455
|
+
const providerArgs = [
|
|
104456
|
+
"-c",
|
|
104457
|
+
`model_providers.${VAPI_CODEX_PROVIDER}.name="vAPI Router"`,
|
|
104458
|
+
"-c",
|
|
104459
|
+
`model_providers.${VAPI_CODEX_PROVIDER}.base_url=${JSON.stringify(baseURL)}`,
|
|
104460
|
+
"-c",
|
|
104461
|
+
`model_providers.${VAPI_CODEX_PROVIDER}.env_key="${VAPI_ROUTER_KEY_ENV}"`,
|
|
104462
|
+
"-c",
|
|
104463
|
+
`model_providers.${VAPI_CODEX_PROVIDER}.wire_api="responses"`,
|
|
104464
|
+
"-c",
|
|
104465
|
+
`model_provider="${VAPI_CODEX_PROVIDER}"`
|
|
104466
|
+
];
|
|
104467
|
+
if (hasVapiCodexProfile(contents))
|
|
104468
|
+
return [
|
|
104469
|
+
"--profile",
|
|
104470
|
+
VAPI_CODEX_PROFILE,
|
|
104471
|
+
...providerArgs,
|
|
104472
|
+
...model === void 0 ? [] : ["-m", model]
|
|
104473
|
+
];
|
|
104474
|
+
return [...providerArgs, "-m", model ?? VAPI_CODEX_DEFAULT_MODEL];
|
|
104475
|
+
}
|
|
104476
|
+
async function runChild(binary, args, env, io, dependencies) {
|
|
104477
|
+
const signals = dependencies.code?.processSignals ?? process;
|
|
104478
|
+
let child;
|
|
104479
|
+
const ignore = () => {
|
|
104480
|
+
};
|
|
104481
|
+
const forward = (signal) => () => {
|
|
104482
|
+
try {
|
|
104483
|
+
child?.kill(signal);
|
|
104484
|
+
} catch (error61) {
|
|
104485
|
+
io.stderr(shortReason(error61, env));
|
|
104486
|
+
}
|
|
104487
|
+
};
|
|
104488
|
+
const listeners = [
|
|
104489
|
+
["SIGINT", ignore],
|
|
104490
|
+
["SIGQUIT", ignore],
|
|
104491
|
+
["SIGTERM", forward("SIGTERM")],
|
|
104492
|
+
["SIGHUP", forward("SIGHUP")]
|
|
104493
|
+
];
|
|
104494
|
+
try {
|
|
104495
|
+
for (const [signal, listener] of listeners) signals.on(signal, listener);
|
|
104496
|
+
return await new Promise((resolve3) => {
|
|
104497
|
+
let settled = false;
|
|
104498
|
+
const finish = (code) => {
|
|
104499
|
+
if (!settled) {
|
|
104500
|
+
settled = true;
|
|
104501
|
+
resolve3(code);
|
|
104502
|
+
}
|
|
104503
|
+
};
|
|
104504
|
+
try {
|
|
104505
|
+
child = (dependencies.code?.spawn ?? spawn4)(binary, args, { env, stdio: "inherit" });
|
|
104506
|
+
child.once("error", (error61) => {
|
|
104507
|
+
if (!settled) io.stderr(shortReason(error61, env));
|
|
104508
|
+
finish(127);
|
|
104509
|
+
});
|
|
104510
|
+
child.once(
|
|
104511
|
+
"exit",
|
|
104512
|
+
(code, signal) => finish(code ?? (signal === null ? 1 : 128 + (constants3.signals[signal] ?? 0)))
|
|
104513
|
+
);
|
|
104514
|
+
} catch (error61) {
|
|
104515
|
+
io.stderr(shortReason(error61, env));
|
|
104516
|
+
finish(127);
|
|
104517
|
+
}
|
|
104518
|
+
});
|
|
104519
|
+
} finally {
|
|
104520
|
+
for (const [signal, listener] of listeners) signals.removeListener(signal, listener);
|
|
104521
|
+
}
|
|
104522
|
+
}
|
|
104523
|
+
|
|
103900
104524
|
// ../cli/src/send.ts
|
|
103901
104525
|
var SEND_USAGE = "Usage: vapi send <amount> --from <account> --to <account|owner|0x\u2026> [--network base|arc] [--resume <nonce>] [--json]";
|
|
103902
104526
|
async function sendCommand(argv, json2, io, dependencies) {
|
|
@@ -103996,7 +104620,7 @@ async function sendConfig(dependencies) {
|
|
|
103996
104620
|
|
|
103997
104621
|
// ../cli/src/setup.ts
|
|
103998
104622
|
import { rm as rm5 } from "node:fs/promises";
|
|
103999
|
-
import { join as
|
|
104623
|
+
import { join as join27 } from "node:path";
|
|
104000
104624
|
var SETUP_ARGUMENT_ERROR = `vapi setup accepts only --no-cloud-backup and --accounts <n> (1-${MAX_RESTORE_ACCOUNTS}); a recovery phrase is typed at the prompt, never passed on the command line.`;
|
|
104001
104625
|
var VAULT_CHOICE = "Create a new vault, or restore one from a recovery phrase? [new/restore] ";
|
|
104002
104626
|
async function setupCommand(argv, json2, io, dependencies) {
|
|
@@ -104026,7 +104650,7 @@ async function setupCommand(argv, json2, io, dependencies) {
|
|
|
104026
104650
|
let changedAccount = false;
|
|
104027
104651
|
let changedLink = false;
|
|
104028
104652
|
let scannedAddresses;
|
|
104029
|
-
if (!await fileExists2(
|
|
104653
|
+
if (!await fileExists2(join27(paths.directory, "vault.json"))) {
|
|
104030
104654
|
const choice = await vaultChoice(dependencies);
|
|
104031
104655
|
if (choice === "restore") {
|
|
104032
104656
|
if (!isInteractive(dependencies)) {
|
|
@@ -104114,7 +104738,7 @@ async function restoreVaultFromPhrase(phrase, config2, io, dependencies, account
|
|
|
104114
104738
|
let scannedAddresses = 0;
|
|
104115
104739
|
try {
|
|
104116
104740
|
const restored = await restoreVault({
|
|
104117
|
-
path:
|
|
104741
|
+
path: join27(paths.directory, "vault.json"),
|
|
104118
104742
|
key: key2,
|
|
104119
104743
|
phrase: validatedPhrase,
|
|
104120
104744
|
probe: async (address4) => await readBalance3(address4) > 0n,
|
|
@@ -104125,7 +104749,7 @@ async function restoreVaultFromPhrase(phrase, config2, io, dependencies, account
|
|
|
104125
104749
|
...dependencies.now === void 0 ? {} : { now: dependencies.now }
|
|
104126
104750
|
});
|
|
104127
104751
|
names = restored.accounts().map((account) => account.name);
|
|
104128
|
-
await rm5(
|
|
104752
|
+
await rm5(join27(paths.directory, "wallets.json"), { force: true });
|
|
104129
104753
|
} finally {
|
|
104130
104754
|
key2.fill(0);
|
|
104131
104755
|
}
|
|
@@ -104243,7 +104867,7 @@ async function withRouterError2(operation) {
|
|
|
104243
104867
|
|
|
104244
104868
|
// ../cli/src/task.ts
|
|
104245
104869
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
104246
|
-
import { readFile as
|
|
104870
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
104247
104871
|
var TASK_HELP = `Usage:
|
|
104248
104872
|
vapi task search [--open] [--min <usd>] [--tab trending|new|closing|paid] [--limit <n>] [--json]
|
|
104249
104873
|
vapi task show <id> [--account <name>] [--json]
|
|
@@ -104579,7 +105203,7 @@ async function taskCommandInner(argv, json2, io, dependencies) {
|
|
|
104579
105203
|
if (maxAwards !== void 0 && maxAwards > TASK_LIMITS.maxAwardsMax)
|
|
104580
105204
|
throw new UsageError("--max-awards must be between 1 and 50.");
|
|
104581
105205
|
if (parsed.one("--webhook") !== void 0) httpsUrl2(parsed.one("--webhook"), "--webhook");
|
|
104582
|
-
const brief = briefPath === "-" ? await (dependencies.readStdin ?? readProcessStdin2)() : await
|
|
105206
|
+
const brief = briefPath === "-" ? await (dependencies.readStdin ?? readProcessStdin2)() : await readFile30(briefPath, "utf8");
|
|
104583
105207
|
const input2 = {
|
|
104584
105208
|
title: title.trim(),
|
|
104585
105209
|
description: brief.trim(),
|
|
@@ -105165,13 +105789,13 @@ async function watchTask(id2, parsed, json2, io, dependencies, now) {
|
|
|
105165
105789
|
}
|
|
105166
105790
|
}
|
|
105167
105791
|
cursor2 = Math.max(cursor2, page.nextAfter, ...events.map((event) => event.sequence));
|
|
105168
|
-
const
|
|
105169
|
-
if (
|
|
105792
|
+
const remaining2 = deadline - clock().getTime();
|
|
105793
|
+
if (remaining2 <= 0)
|
|
105170
105794
|
throw new TaskCommandError(
|
|
105171
105795
|
"timeout",
|
|
105172
105796
|
`Task watch timed out after ${parsed.one("--timeout") ?? "7d"}.`
|
|
105173
105797
|
);
|
|
105174
|
-
await context.sleep(Math.min(interval,
|
|
105798
|
+
await context.sleep(Math.min(interval, remaining2));
|
|
105175
105799
|
}
|
|
105176
105800
|
}
|
|
105177
105801
|
function expandDeliveryFiles(argv) {
|
|
@@ -106257,7 +106881,7 @@ async function referencedSleep(milliseconds, signal) {
|
|
|
106257
106881
|
}
|
|
106258
106882
|
|
|
106259
106883
|
// ../cli/src/vault.ts
|
|
106260
|
-
import { join as
|
|
106884
|
+
import { join as join28 } from "node:path";
|
|
106261
106885
|
var VAULT_USAGE = "Usage: vapi vault protect|unprotect|lock|unlock|status [--json]";
|
|
106262
106886
|
var RESTORE_USAGE = "Usage: vapi restore [--accounts <n> | --from-owner [--owner <0x\u2026>]] [--json]";
|
|
106263
106887
|
var LEGACY_PASSWORD_NOTICE = "VAPI_KEYSTORE_PASSWORD is deprecated for vault passwords; use VAPI_VAULT_PASSWORD instead.";
|
|
@@ -106301,7 +106925,7 @@ async function restoreCommand(argv, json2, io, dependencies) {
|
|
|
106301
106925
|
}
|
|
106302
106926
|
const accountCount = parseRestoreAccountCount(parsed.one("--accounts"));
|
|
106303
106927
|
const paths = getVapiPaths();
|
|
106304
|
-
const path =
|
|
106928
|
+
const path = join28(paths.directory, "vault.json");
|
|
106305
106929
|
if (await fileExists2(path)) {
|
|
106306
106930
|
throw new Error(
|
|
106307
106931
|
`A vault already exists in ${paths.directory}. Move it aside before restoring.`
|
|
@@ -106458,7 +107082,7 @@ function requireNoArguments(argv) {
|
|
|
106458
107082
|
parseArguments(argv, { valueOptions: /* @__PURE__ */ new Set(), maximumPositionals: 0 });
|
|
106459
107083
|
}
|
|
106460
107084
|
function vaultPath() {
|
|
106461
|
-
return
|
|
107085
|
+
return join28(getVapiPaths().directory, "vault.json");
|
|
106462
107086
|
}
|
|
106463
107087
|
function quietIo(io) {
|
|
106464
107088
|
return { stdout: () => void 0, stderr: io.stderr };
|
|
@@ -106526,6 +107150,10 @@ Usage:
|
|
|
106526
107150
|
vapi login [--account <name>] [--label <name>] [--publish] [--no-browser] [--json]
|
|
106527
107151
|
vapi logout [--account <name>] [--json]
|
|
106528
107152
|
vapi whoami [--account <name>] [--json]
|
|
107153
|
+
vapi claude [--vapi|--own] [--model <m>] [--use-balance] [--account <name>] [<claude args>...]
|
|
107154
|
+
vapi codex [--vapi|--own] [--model <id>] [--use-balance] [--account <name>] [<codex args>...]
|
|
107155
|
+
vapi code install [--yes] [--no-alias] [--account <name>] [--json]
|
|
107156
|
+
vapi code uninstall [--json]
|
|
106529
107157
|
vapi router models [--account <name>] [--json]
|
|
106530
107158
|
vapi router usage [--account <name>] [--json]
|
|
106531
107159
|
vapi router chat --model <id> [--system <text>] [--max-tokens <n>] "<prompt>" [--account <name>] [--json]
|
|
@@ -106745,6 +107373,8 @@ async function confirmWalletName(name, prompt, refusal, dependencies) {
|
|
|
106745
107373
|
if (typed.trim() !== name) throw new KeystoreError(refusal);
|
|
106746
107374
|
}
|
|
106747
107375
|
async function runCli(argv = process.argv.slice(2), io = processIo, dependencies = {}) {
|
|
107376
|
+
const firstArgument = argv.find((argument) => argument !== "--json");
|
|
107377
|
+
const codeLaunch = firstArgument === "claude" || firstArgument === "codex";
|
|
106748
107378
|
let json2 = argv.includes("--json");
|
|
106749
107379
|
const taskInvocation = argv.find((argument) => argument !== "--json") === "task";
|
|
106750
107380
|
const resultFile = runResultFile(argv);
|
|
@@ -106753,15 +107383,15 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
|
|
|
106753
107383
|
stderr: (message) => io.stderr(redactDetachedRunText(message, getEnvironment(dependencies)))
|
|
106754
107384
|
};
|
|
106755
107385
|
try {
|
|
106756
|
-
const parsedInvocation = removeJsonFlag(argv);
|
|
107386
|
+
const parsedInvocation = removeJsonFlag(argv, codeLaunch);
|
|
106757
107387
|
json2 = parsedInvocation.json;
|
|
106758
|
-
const hasWalletOption = parsedInvocation.args.includes(WALLET_OPTION5);
|
|
107388
|
+
const hasWalletOption = !codeLaunch && parsedInvocation.args.includes(WALLET_OPTION5);
|
|
106759
107389
|
const hasAccountOption = parsedInvocation.args.includes(ACCOUNT_OPTION2);
|
|
106760
107390
|
if (hasWalletOption && hasAccountOption) {
|
|
106761
107391
|
throw new UsageError("--wallet and --account cannot be used together.");
|
|
106762
107392
|
}
|
|
106763
107393
|
if (hasWalletOption) io.stderr(WALLET_OPTION_DEPRECATION);
|
|
106764
|
-
const args = parsedInvocation.args.map(
|
|
107394
|
+
const args = codeLaunch ? parsedInvocation.args : parsedInvocation.args.map(
|
|
106765
107395
|
(argument) => argument === WALLET_OPTION5 ? ACCOUNT_OPTION2 : argument
|
|
106766
107396
|
);
|
|
106767
107397
|
const command = args[0];
|
|
@@ -106857,6 +107487,15 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
|
|
|
106857
107487
|
await whoamiCommand(args.slice(1), json2, io, dependencies);
|
|
106858
107488
|
exitCode = 0;
|
|
106859
107489
|
break;
|
|
107490
|
+
case "claude":
|
|
107491
|
+
exitCode = await claudeCommand(args.slice(1), json2, io, dependencies);
|
|
107492
|
+
break;
|
|
107493
|
+
case "codex":
|
|
107494
|
+
exitCode = await codexCommand(args.slice(1), json2, io, dependencies);
|
|
107495
|
+
break;
|
|
107496
|
+
case "code":
|
|
107497
|
+
exitCode = await codeCommand(args.slice(1), json2, io, dependencies);
|
|
107498
|
+
break;
|
|
106860
107499
|
case "router":
|
|
106861
107500
|
await routerCommand(args.slice(1), json2, io, dependencies);
|
|
106862
107501
|
exitCode = 0;
|
|
@@ -106894,7 +107533,7 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
|
|
|
106894
107533
|
break;
|
|
106895
107534
|
case "unlock":
|
|
106896
107535
|
io.stderr("vapi unlock is now vapi vault unlock; the old name works for one release.");
|
|
106897
|
-
if (await fileExists2(
|
|
107536
|
+
if (await fileExists2(join29(getVapiPaths().directory, "vault.json"))) {
|
|
106898
107537
|
parseArguments(args.slice(1), {
|
|
106899
107538
|
valueOptions: /* @__PURE__ */ new Set([WALLET_OPTION5]),
|
|
106900
107539
|
maximumPositionals: 0
|
|
@@ -107100,7 +107739,7 @@ async function initCommand(argv, json2, io, dependencies) {
|
|
|
107100
107739
|
address: account.address,
|
|
107101
107740
|
accounts,
|
|
107102
107741
|
config: paths.config,
|
|
107103
|
-
vault:
|
|
107742
|
+
vault: join29(paths.directory, "vault.json"),
|
|
107104
107743
|
...configRewrites.length > 0 ? { configRewrites } : {},
|
|
107105
107744
|
custody: "self",
|
|
107106
107745
|
warning: CUSTODY_NOTICE,
|
|
@@ -107239,7 +107878,7 @@ async function walletCreateCommand(argv, json2, io, dependencies) {
|
|
|
107239
107878
|
const result = {
|
|
107240
107879
|
address: account.address,
|
|
107241
107880
|
...account.solana ? { solanaAddress: account.solana.address } : {},
|
|
107242
|
-
vault:
|
|
107881
|
+
vault: join29(paths.directory, "vault.json"),
|
|
107243
107882
|
...label === void 0 ? {} : { label },
|
|
107244
107883
|
spendCaps: created.entry.spendCaps,
|
|
107245
107884
|
isDefault,
|
|
@@ -107279,7 +107918,7 @@ function formatCaps2(caps) {
|
|
|
107279
107918
|
function walletListResult(store, wallets, unlocked) {
|
|
107280
107919
|
return {
|
|
107281
107920
|
default: store.defaultName ?? null,
|
|
107282
|
-
vault:
|
|
107921
|
+
vault: join29(store.home, "vault.json"),
|
|
107283
107922
|
wallets: wallets.map((wallet) => ({
|
|
107284
107923
|
name: wallet.name,
|
|
107285
107924
|
...wallet.address === void 0 ? {} : { address: wallet.address },
|
|
@@ -108295,7 +108934,7 @@ function sameOrigin2(left, right) {
|
|
|
108295
108934
|
function noApiKeyMessage(baseUrl) {
|
|
108296
108935
|
return [
|
|
108297
108936
|
"No vAPI API key on this machine.",
|
|
108298
|
-
`Create one in the console at ${
|
|
108937
|
+
`Create one in the console at ${apiKeyConsoleUrl(baseUrl).href}, then store it with vapi auth set-key.`,
|
|
108299
108938
|
`In CI, set ${API_KEY_ENV} instead.`
|
|
108300
108939
|
].join("\n");
|
|
108301
108940
|
}
|
|
@@ -108552,7 +109191,7 @@ function formatClaimed(origin, claimed) {
|
|
|
108552
109191
|
}
|
|
108553
109192
|
var EXPORT_KEY_WARNING = "Anyone with this key can spend the wallet. Never paste it into a website or chat.";
|
|
108554
109193
|
async function deviceVaultKey2(store, dependencies) {
|
|
108555
|
-
const path =
|
|
109194
|
+
const path = join29(store.home, "vault.json");
|
|
108556
109195
|
const metadata = await readVaultFileUnlocked(path);
|
|
108557
109196
|
const secrets = getSecretStore(dependencies);
|
|
108558
109197
|
const key2 = metadata.protected ? await unlockProtectedVault({
|
|
@@ -108645,7 +109284,7 @@ async function backupCommand(argv, json2, io, dependencies) {
|
|
|
108645
109284
|
const target = await targetWallet(parsed, dependencies);
|
|
108646
109285
|
const vaultAccount = await target.store.hasVaultAccount(target.name);
|
|
108647
109286
|
if (vaultAccount) {
|
|
108648
|
-
const vault = await readVaultFileUnlocked(
|
|
109287
|
+
const vault = await readVaultFileUnlocked(join29(target.store.home, "vault.json"));
|
|
108649
109288
|
if (vault.accounts.some((account) => account.name === target.name && account.kind === "imported")) {
|
|
108650
109289
|
throw new KeystoreError(
|
|
108651
109290
|
`Account ${target.name} was imported and is not recoverable from the vault phrase. Back it up with vapi export-key --account ${target.name}.`
|
|
@@ -108722,7 +109361,7 @@ async function importCommand(argv, json2, io, dependencies) {
|
|
|
108722
109361
|
const existed = store.has(name);
|
|
108723
109362
|
if (existed && !parsed.has("--replace")) {
|
|
108724
109363
|
const address4 = await store.readAddress(name);
|
|
108725
|
-
const location = await store.hasVaultAccount(name) ?
|
|
109364
|
+
const location = await store.hasVaultAccount(name) ? join29(store.home, "vault.json") : store.pathFor(name);
|
|
108726
109365
|
throw new Error(
|
|
108727
109366
|
[
|
|
108728
109367
|
`Wallet ${name} already exists at ${location}.`,
|
|
@@ -108758,7 +109397,7 @@ async function importCommand(argv, json2, io, dependencies) {
|
|
|
108758
109397
|
const result = {
|
|
108759
109398
|
address: account.address,
|
|
108760
109399
|
...account.solana ? { solanaAddress: account.solana.address } : {},
|
|
108761
|
-
vault:
|
|
109400
|
+
vault: join29(paths.directory, "vault.json"),
|
|
108762
109401
|
...previousKeystore ? { previousKeystore } : {},
|
|
108763
109402
|
message: "Wallet imported. Its encrypted key stays on this machine."
|
|
108764
109403
|
};
|
|
@@ -109091,7 +109730,7 @@ function formatFund(address4, url2, opened) {
|
|
|
109091
109730
|
function openInBrowser(url2) {
|
|
109092
109731
|
const opener = process.platform === "darwin" ? { command: "open", args: [url2] } : process.platform === "win32" ? { command: "cmd", args: ["/c", "start", "", url2] } : { command: "xdg-open", args: [url2] };
|
|
109093
109732
|
try {
|
|
109094
|
-
const child =
|
|
109733
|
+
const child = spawn5(opener.command, opener.args, { stdio: "ignore", detached: true });
|
|
109095
109734
|
child.on("error", () => void 0);
|
|
109096
109735
|
child.unref();
|
|
109097
109736
|
return true;
|
|
@@ -109283,11 +109922,13 @@ function parseArguments(argv, spec) {
|
|
|
109283
109922
|
has: (name) => flags.has(name)
|
|
109284
109923
|
};
|
|
109285
109924
|
}
|
|
109286
|
-
function removeJsonFlag(argv) {
|
|
109925
|
+
function removeJsonFlag(argv, preserveForwarded = false) {
|
|
109287
109926
|
let json2 = false;
|
|
109288
109927
|
const args = [];
|
|
109928
|
+
let forwarding = false;
|
|
109289
109929
|
for (const argument of argv) {
|
|
109290
|
-
if (argument
|
|
109930
|
+
if (preserveForwarded && argument === "--") forwarding = true;
|
|
109931
|
+
if (argument !== "--json" || forwarding) {
|
|
109291
109932
|
args.push(argument);
|
|
109292
109933
|
continue;
|
|
109293
109934
|
}
|
|
@@ -109388,7 +110029,7 @@ function parseInitNetworks(value) {
|
|
|
109388
110029
|
|
|
109389
110030
|
// ../cli/src/update-check.ts
|
|
109390
110031
|
import { lookup } from "node:dns/promises";
|
|
109391
|
-
import { mkdir as
|
|
110032
|
+
import { mkdir as mkdir22, readFile as readFile31, writeFile as writeFile13 } from "node:fs/promises";
|
|
109392
110033
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
109393
110034
|
var CHECK_TIMEOUT_MS = 1500;
|
|
109394
110035
|
var LATEST_URL = "https://registry.npmjs.org/vapi-network/latest";
|
|
@@ -109405,7 +110046,7 @@ async function runCliWithUpdateCheck(argv = process.argv.slice(2), io = {
|
|
|
109405
110046
|
async function checkForUpdate(options = {}) {
|
|
109406
110047
|
const env = options.env ?? process.env;
|
|
109407
110048
|
const argv = options.argv ?? process.argv.slice(2);
|
|
109408
|
-
if (!(options.stderrIsTTY ?? process.stderr.isTTY) || argv.includes("--json") || argv[0] === "mcp" && argv[1] !== "install" || env.VAPI_NO_UPDATE_CHECK === "1" || env.CI !== void 0) {
|
|
110049
|
+
if (!(options.stderrIsTTY ?? process.stderr.isTTY) || argv.includes("--json") || argv[0] === "claude" || argv[0] === "codex" || argv[0] === "mcp" && argv[1] !== "install" || env.VAPI_NO_UPDATE_CHECK === "1" || env.CI !== void 0) {
|
|
109409
110050
|
return void 0;
|
|
109410
110051
|
}
|
|
109411
110052
|
const controller = new AbortController();
|
|
@@ -109432,7 +110073,7 @@ async function latestNotice(options, env, signal) {
|
|
|
109432
110073
|
const now = (options.nowMs ?? Date.now)();
|
|
109433
110074
|
let cached2;
|
|
109434
110075
|
try {
|
|
109435
|
-
const value = JSON.parse(await
|
|
110076
|
+
const value = JSON.parse(await readFile31(paths.updateCheck, "utf8"));
|
|
109436
110077
|
if (isRecord13(value) && typeof value.checkedAt === "number" && Number.isFinite(value.checkedAt) && typeof value.latest === "string" && parseVersion(value.latest)) {
|
|
109437
110078
|
cached2 = { checkedAt: value.checkedAt, latest: value.latest };
|
|
109438
110079
|
}
|
|
@@ -109441,9 +110082,9 @@ async function latestNotice(options, env, signal) {
|
|
|
109441
110082
|
signal.throwIfAborted();
|
|
109442
110083
|
let latest = cached2?.latest ?? CLI_VERSION;
|
|
109443
110084
|
if (cached2 === void 0 || now - cached2.checkedAt >= CHECK_INTERVAL_MS || now < cached2.checkedAt) {
|
|
109444
|
-
await
|
|
110085
|
+
await mkdir22(paths.directory, { recursive: true });
|
|
109445
110086
|
signal.throwIfAborted();
|
|
109446
|
-
await
|
|
110087
|
+
await writeFile13(paths.updateCheck, JSON.stringify({ checkedAt: now, latest }), { mode: 384 });
|
|
109447
110088
|
signal.throwIfAborted();
|
|
109448
110089
|
const fetchImpl = options.fetchImpl ?? createPublicFetch({
|
|
109449
110090
|
allowPrivateNetwork: false,
|
|
@@ -109470,7 +110111,7 @@ async function latestNotice(options, env, signal) {
|
|
|
109470
110111
|
return void 0;
|
|
109471
110112
|
}
|
|
109472
110113
|
latest = body.version;
|
|
109473
|
-
await
|
|
110114
|
+
await writeFile13(paths.updateCheck, JSON.stringify({ checkedAt: now, latest }), { mode: 384 });
|
|
109474
110115
|
}
|
|
109475
110116
|
signal.throwIfAborted();
|
|
109476
110117
|
return isNewerVersion(latest, CLI_VERSION) ? `vapi-network ${latest} is available (you have ${CLI_VERSION}). Update: npm i -g vapi-network@latest` : void 0;
|