@vapi-network/mcp 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +39 -16
- package/dist/index.js.map +2 -2
- package/dist/wallet-session.d.ts +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -73067,7 +73067,7 @@ function createRunBudget(args) {
|
|
|
73067
73067
|
import { mkdir as mkdir13, writeFile as writeFile7 } from "node:fs/promises";
|
|
73068
73068
|
import { arch, platform, release } from "node:os";
|
|
73069
73069
|
import { join as join11 } from "node:path";
|
|
73070
|
-
var VAPI_CLIENT_VERSION = "0.9.
|
|
73070
|
+
var VAPI_CLIENT_VERSION = "0.9.6";
|
|
73071
73071
|
async function createSupportReport(options) {
|
|
73072
73072
|
const message = options.message.trim();
|
|
73073
73073
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -86757,7 +86757,7 @@ function createAuthTools(options) {
|
|
|
86757
86757
|
async link(input2) {
|
|
86758
86758
|
requireSafeSecretStore(options.secrets);
|
|
86759
86759
|
requireWalletStore2(options.wallets);
|
|
86760
|
-
const wallet = options.session.
|
|
86760
|
+
const wallet = (await options.session.resolveLatest(input2.account)).name;
|
|
86761
86761
|
const existing = pending.get(wallet);
|
|
86762
86762
|
if (existing !== void 0) return linkResult(wallet, existing);
|
|
86763
86763
|
let startup = starting.get(wallet);
|
|
@@ -86947,6 +86947,7 @@ function createRouterTools(options) {
|
|
|
86947
86947
|
return toolResult({ models: models.map((model) => model.id) });
|
|
86948
86948
|
},
|
|
86949
86949
|
async usage(input2) {
|
|
86950
|
+
await options.session.resolveLatest(input2.wallet);
|
|
86950
86951
|
const deps = routerDeps(options, input2.wallet);
|
|
86951
86952
|
const [usage, stake] = await Promise.all([readUsage(deps), readStake(deps)]);
|
|
86952
86953
|
return toolResult({
|
|
@@ -86960,6 +86961,7 @@ function createRouterTools(options) {
|
|
|
86960
86961
|
},
|
|
86961
86962
|
async chat(input2) {
|
|
86962
86963
|
const parsed = routerChatInputSchema.parse(input2);
|
|
86964
|
+
await options.session.resolveLatest(parsed.wallet);
|
|
86963
86965
|
const result = await chat(routerDeps(options, parsed.wallet, unlockedWallet), {
|
|
86964
86966
|
model: parsed.model,
|
|
86965
86967
|
messages: parsed.messages,
|
|
@@ -88090,9 +88092,23 @@ var WalletSession = class {
|
|
|
88090
88092
|
}
|
|
88091
88093
|
return { name: only };
|
|
88092
88094
|
}
|
|
88095
|
+
/**
|
|
88096
|
+
* `resolve`, after re-reading `wallets.json` when the name is not known yet.
|
|
88097
|
+
* An account created in a terminal while this server runs works at once; the
|
|
88098
|
+
* session's active account and the human's default stay as they were.
|
|
88099
|
+
*/
|
|
88100
|
+
async resolveLatest(name) {
|
|
88101
|
+
const store = this.options.store;
|
|
88102
|
+
const requested = name?.trim();
|
|
88103
|
+
const selection = requested && requested.length > 0 ? requested : this.#active;
|
|
88104
|
+
if (store && selection !== void 0 && !store.has(assertWalletName(selection))) {
|
|
88105
|
+
await store.refreshRegistry();
|
|
88106
|
+
}
|
|
88107
|
+
return this.resolve(name);
|
|
88108
|
+
}
|
|
88093
88109
|
/** The addresses of an account, read from the vault or a legacy keystore header. */
|
|
88094
88110
|
async addressesFor(name) {
|
|
88095
|
-
const wallet = this.
|
|
88111
|
+
const wallet = await this.resolveLatest(name);
|
|
88096
88112
|
const store = this.options.store;
|
|
88097
88113
|
if (!store) {
|
|
88098
88114
|
const account = this.options.account;
|
|
@@ -88120,7 +88136,7 @@ var WalletSession = class {
|
|
|
88120
88136
|
* so switching accounts mid-session pays from the account that was asked for.
|
|
88121
88137
|
*/
|
|
88122
88138
|
async payment(name) {
|
|
88123
|
-
const wallet = this.
|
|
88139
|
+
const wallet = await this.resolveLatest(name);
|
|
88124
88140
|
const store = this.options.store;
|
|
88125
88141
|
if (!store || wallet.path === void 0) {
|
|
88126
88142
|
return { wallet, account: this.options.account };
|
|
@@ -88128,7 +88144,10 @@ var WalletSession = class {
|
|
|
88128
88144
|
const account = await store.hasVaultAccount(wallet.name) ? await store.unlock(wallet.name, "") : await this.#unlockLegacy(wallet);
|
|
88129
88145
|
return { wallet, account, spendCaps: await spendCapsForWallet(store, wallet.name) };
|
|
88130
88146
|
}
|
|
88131
|
-
/**
|
|
88147
|
+
/**
|
|
88148
|
+
* Every account this machine knows, with the session's own marker on one.
|
|
88149
|
+
* `wallets.json` is re-read first, so accounts made in a terminal show up.
|
|
88150
|
+
*/
|
|
88132
88151
|
async list() {
|
|
88133
88152
|
const store = this.options.store;
|
|
88134
88153
|
const active = this.#active;
|
|
@@ -88145,6 +88164,7 @@ var WalletSession = class {
|
|
|
88145
88164
|
}
|
|
88146
88165
|
];
|
|
88147
88166
|
}
|
|
88167
|
+
await store.refreshRegistry();
|
|
88148
88168
|
return (await store.list()).map((info) => ({
|
|
88149
88169
|
name: info.name,
|
|
88150
88170
|
...info.address === void 0 ? {} : { address: info.address },
|
|
@@ -88162,7 +88182,7 @@ var WalletSession = class {
|
|
|
88162
88182
|
* an agent pays from changed.
|
|
88163
88183
|
*/
|
|
88164
88184
|
async use(name) {
|
|
88165
|
-
const wallet = this.
|
|
88185
|
+
const wallet = await this.resolveLatest(assertWalletName(name));
|
|
88166
88186
|
const previous = this.#active ?? null;
|
|
88167
88187
|
this.#active = wallet.name;
|
|
88168
88188
|
let address4;
|
|
@@ -88974,13 +88994,16 @@ function createVapiServer(options = {}) {
|
|
|
88974
88994
|
inputSchema: {},
|
|
88975
88995
|
outputSchema: walletListToolResultSchema
|
|
88976
88996
|
},
|
|
88977
|
-
async () => asStructuredToolResult(async () =>
|
|
88978
|
-
|
|
88979
|
-
|
|
88980
|
-
|
|
88981
|
-
|
|
88982
|
-
|
|
88983
|
-
|
|
88997
|
+
async () => asStructuredToolResult(async () => {
|
|
88998
|
+
const accounts2 = await session.list();
|
|
88999
|
+
return {
|
|
89000
|
+
wallet: session.activeName ?? null,
|
|
89001
|
+
default: session.store?.defaultName ?? session.activeName ?? null,
|
|
89002
|
+
wallets: await Promise.all(
|
|
89003
|
+
accounts2.map((info) => describeWallet(info, config2, guardedFetch2))
|
|
89004
|
+
)
|
|
89005
|
+
};
|
|
89006
|
+
})
|
|
88984
89007
|
);
|
|
88985
89008
|
server.registerTool(
|
|
88986
89009
|
"wallet.use",
|
|
@@ -89033,7 +89056,7 @@ function createVapiServer(options = {}) {
|
|
|
89033
89056
|
),
|
|
89034
89057
|
balance
|
|
89035
89058
|
);
|
|
89036
|
-
const ledgerWallet = (input2) => input2.allWallets === true ? null : session.
|
|
89059
|
+
const ledgerWallet = async (input2) => input2.allWallets === true ? null : (await session.resolveLatest(input2.wallet)).name;
|
|
89037
89060
|
server.registerTool(
|
|
89038
89061
|
"receipts.list",
|
|
89039
89062
|
{
|
|
@@ -89046,7 +89069,7 @@ function createVapiServer(options = {}) {
|
|
|
89046
89069
|
outputSchema: external_exports.object({ wallet: external_exports.string().nullable(), receipts: external_exports.array(external_exports.unknown()) })
|
|
89047
89070
|
},
|
|
89048
89071
|
async (input2) => asStructuredToolResult(async () => {
|
|
89049
|
-
const wallet = ledgerWallet(input2);
|
|
89072
|
+
const wallet = await ledgerWallet(input2);
|
|
89050
89073
|
return {
|
|
89051
89074
|
wallet,
|
|
89052
89075
|
receipts: await readReceipts(options.receiptsPath ?? getVapiPaths().receipts, {
|
|
@@ -89069,7 +89092,7 @@ function createVapiServer(options = {}) {
|
|
|
89069
89092
|
},
|
|
89070
89093
|
async (input2) => asStructuredToolResult(async () => {
|
|
89071
89094
|
const paths = getVapiPaths();
|
|
89072
|
-
const wallet = ledgerWallet(input2);
|
|
89095
|
+
const wallet = await ledgerWallet(input2);
|
|
89073
89096
|
return {
|
|
89074
89097
|
wallet,
|
|
89075
89098
|
...aggregateStats({
|