vapi-network 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9846,8 +9846,10 @@ __export(src_exports, {
9846
9846
  enableSolanaKey: () => enableSolanaKey,
9847
9847
  encryptPrivateKey: () => encryptPrivateKey,
9848
9848
  executionModeSchema: () => executionModeSchema,
9849
+ exportKeystoreKeys: () => exportKeystoreKeys,
9849
9850
  filterReceiptsByRange: () => filterReceiptsByRange,
9850
9851
  firstPartyProvenanceSchema: () => firstPartyProvenanceSchema,
9852
+ formatLegacyRegistryRewrites: () => formatLegacyRegistryRewrites,
9851
9853
  formatUsdc: () => formatUsdc,
9852
9854
  getAgentCashPaths: () => getAgentCashPaths,
9853
9855
  getArcGasHeadroomAtomic: () => getArcGasHeadroomAtomic,
@@ -9881,6 +9883,7 @@ __export(src_exports, {
9881
9883
  marketplaceKindSchema: () => marketplaceKindSchema,
9882
9884
  marketplacePublicFactSchema: () => marketplacePublicFactSchema,
9883
9885
  mergeListings: () => mergeListings,
9886
+ migrateLegacyRegistryConfig: () => migrateLegacyRegistryConfig,
9884
9887
  migrateLegacyVapiHome: () => migrateLegacyVapiHome,
9885
9888
  normalizeResourceUrl: () => normalizeResourceUrl,
9886
9889
  openRequestMarketplaceHitSchema: () => openRequestMarketplaceHitSchema,
@@ -9896,6 +9899,7 @@ __export(src_exports, {
9896
9899
  parseSettlementResponse: () => parseSettlementResponse,
9897
9900
  pinnedLookup: () => pinnedLookup,
9898
9901
  provenanceSchema: () => provenanceSchema,
9902
+ readKeystoreAddress: () => readKeystoreAddress,
9899
9903
  readReceipts: () => readReceipts,
9900
9904
  readSearchEvents: () => readSearchEvents,
9901
9905
  readSolanaGasBalance: () => readSolanaGasBalance,
@@ -9905,6 +9909,8 @@ __export(src_exports, {
9905
9909
  receiptsToCsv: () => receiptsToCsv,
9906
9910
  requireRpcUrl: () => requireRpcUrl,
9907
9911
  reserveSpend: () => reserveSpend,
9912
+ rewriteLegacyRegistryUrl: () => rewriteLegacyRegistryUrl,
9913
+ rewriteLegacyRegistryUrls: () => rewriteLegacyRegistryUrls,
9908
9914
  searchServicesResponseSchema: () => searchServicesResponseSchema,
9909
9915
  serviceOfferMarketplaceHitSchema: () => serviceOfferMarketplaceHitSchema,
9910
9916
  serviceSummarySchema: () => serviceSummarySchema,
@@ -45526,8 +45532,8 @@ var DEFAULT_DISCOVERY_URL = `${DEFAULT_REGISTRY_URL}/api/call/services`;
45526
45532
  var DEFAULT_MARKETPLACE_DISCOVERY_URL = `${DEFAULT_REGISTRY_URL}/api/call/discovery`;
45527
45533
  var DEFAULT_REGISTRY_FALLBACKS = [
45528
45534
  {
45529
- discoveryUrl: "https://console.vapinetwork.ai/api/call/services",
45530
- marketplaceDiscoveryUrl: "https://console.vapinetwork.ai/api/call/discovery"
45535
+ discoveryUrl: DEFAULT_DISCOVERY_URL,
45536
+ marketplaceDiscoveryUrl: DEFAULT_MARKETPLACE_DISCOVERY_URL
45531
45537
  }
45532
45538
  ];
45533
45539
  var DEFAULT_SPEND_CAPS = {
@@ -45632,6 +45638,83 @@ async function migrateLegacyVapiHome(options = {}) {
45632
45638
  }
45633
45639
  return copied;
45634
45640
  }
45641
+ var LEGACY_REGISTRY_HOSTS = /* @__PURE__ */ new Map([
45642
+ ["console.vapinetwork.ai", "api.vapinetwork.ai"],
45643
+ ["console-staging.vapinetwork.ai", "api-staging.vapinetwork.ai"]
45644
+ ]);
45645
+ var LEGACY_REGISTRY_PATHS = /* @__PURE__ */ new Map([
45646
+ ["/api/network/services", "/api/call/services"],
45647
+ ["/api/marketplace/discovery", "/api/call/discovery"]
45648
+ ]);
45649
+ var REGISTRY_DOMAIN = "vapinetwork.ai";
45650
+ function rewriteLegacyRegistryUrl(value) {
45651
+ let url2;
45652
+ try {
45653
+ url2 = new URL(value);
45654
+ } catch {
45655
+ return value;
45656
+ }
45657
+ let rewritten = false;
45658
+ const host = LEGACY_REGISTRY_HOSTS.get(url2.hostname.toLowerCase());
45659
+ if (host) {
45660
+ url2.hostname = host;
45661
+ rewritten = true;
45662
+ }
45663
+ const hostname4 = url2.hostname.toLowerCase();
45664
+ if (hostname4 === REGISTRY_DOMAIN || hostname4.endsWith(`.${REGISTRY_DOMAIN}`)) {
45665
+ const path = LEGACY_REGISTRY_PATHS.get(url2.pathname.replace(/\/+$/, ""));
45666
+ if (path) {
45667
+ url2.pathname = path;
45668
+ rewritten = true;
45669
+ }
45670
+ }
45671
+ return rewritten ? url2.href : value;
45672
+ }
45673
+ function rewriteLegacyRegistryUrls(config2) {
45674
+ const changes = [];
45675
+ const rewrite = (field, from16) => {
45676
+ const to = rewriteLegacyRegistryUrl(from16);
45677
+ if (to !== from16) changes.push({ field, from: from16, to });
45678
+ return to;
45679
+ };
45680
+ const next = {
45681
+ ...config2,
45682
+ discoveryUrl: rewrite("discoveryUrl", config2.discoveryUrl),
45683
+ marketplaceDiscoveryUrl: rewrite("marketplaceDiscoveryUrl", config2.marketplaceDiscoveryUrl),
45684
+ ...config2.registryFallbacks ? {
45685
+ registryFallbacks: config2.registryFallbacks.map((fallback, index2) => ({
45686
+ discoveryUrl: rewrite(
45687
+ `registryFallbacks[${index2}].discoveryUrl`,
45688
+ fallback.discoveryUrl
45689
+ ),
45690
+ marketplaceDiscoveryUrl: rewrite(
45691
+ `registryFallbacks[${index2}].marketplaceDiscoveryUrl`,
45692
+ fallback.marketplaceDiscoveryUrl
45693
+ )
45694
+ }))
45695
+ } : {}
45696
+ };
45697
+ return changes.length === 0 ? { config: config2, changes } : { config: next, changes };
45698
+ }
45699
+ function formatLegacyRegistryRewrites(changes) {
45700
+ return [
45701
+ "Rewrote retired vAPI registry URLs in the local config:",
45702
+ ...changes.map((change) => ` ${change.field}: ${change.from} -> ${change.to}`)
45703
+ ].join("\n");
45704
+ }
45705
+ async function migrateLegacyRegistryConfig(path = getVapiPaths().config) {
45706
+ let raw;
45707
+ try {
45708
+ raw = await readFile(path, "utf8");
45709
+ } catch (error61) {
45710
+ if (isMissingFile(error61)) return [];
45711
+ throw error61;
45712
+ }
45713
+ const { config: config2, changes } = rewriteLegacyRegistryUrls(configSchema.parse(JSON.parse(raw)));
45714
+ if (changes.length === 0) return [];
45715
+ await writeConfigFile(path, config2);
45716
+ return changes;
45717
+ }
45635
45718
  function getDefaultConfig(source = process.env, options = {}) {
45636
45719
  const registry2 = registryEndpoints(source.VAPI_REGISTRY_URL?.trim() || DEFAULT_REGISTRY_URL);
45637
45720
  const requested = new Set(options.networks ?? ["base"]);
@@ -45670,7 +45753,7 @@ function getDefaultConfig(source = process.env, options = {}) {
45670
45753
  spendCaps: { ...DEFAULT_SPEND_CAPS }
45671
45754
  };
45672
45755
  }
45673
- async function loadConfig(path = getVapiPaths().config, source = process.env) {
45756
+ async function loadConfig(path = getVapiPaths().config, source = process.env, options = {}) {
45674
45757
  if (!process.env.VAPI_HOME?.trim() && path === getVapiPaths(join(homedir(), ".vapi")).config) {
45675
45758
  await migrateLegacyVapiHome({ targetDirectory: join(homedir(), ".vapi") });
45676
45759
  }
@@ -45681,8 +45764,16 @@ async function loadConfig(path = getVapiPaths().config, source = process.env) {
45681
45764
  if (isMissingFile(error61)) return getDefaultConfig(source);
45682
45765
  throw error61;
45683
45766
  }
45684
- const config2 = configSchema.parse(JSON.parse(raw));
45685
- config2.registryFallbacks ??= DEFAULT_REGISTRY_FALLBACKS.map((fallback) => ({ ...fallback }));
45767
+ const parsed = configSchema.parse(JSON.parse(raw));
45768
+ parsed.registryFallbacks ??= DEFAULT_REGISTRY_FALLBACKS.map((fallback) => ({ ...fallback }));
45769
+ const migrated = rewriteLegacyRegistryUrls(parsed);
45770
+ const config2 = migrated.config;
45771
+ if (migrated.changes.length > 0 && options.notice) {
45772
+ options.notice(
45773
+ `${formatLegacyRegistryRewrites(migrated.changes)}
45774
+ Run vapi init to write the new URLs to ${path}.`
45775
+ );
45776
+ }
45686
45777
  const baseRpcUrl = source.BASE_RPC_URL?.trim();
45687
45778
  const arcRpcUrl = source.ARC_TESTNET_RPC_URL?.trim();
45688
45779
  const solanaRpcUrl = source.SOLANA_RPC_URL?.trim();
@@ -45738,15 +45829,7 @@ async function writeDefaultConfig(path = getVapiPaths().config, source = process
45738
45829
  if (copied.includes(path)) return await loadConfig(path, source);
45739
45830
  }
45740
45831
  const config2 = getDefaultConfig(source, options);
45741
- await mkdir(dirname(path), { recursive: true, mode: 448 });
45742
- const temporaryPath = `${path}.${process.pid}.tmp`;
45743
- await writeFile(temporaryPath, `${JSON.stringify(config2, null, 2)}
45744
- `, {
45745
- encoding: "utf8",
45746
- mode: 384,
45747
- flag: "wx"
45748
- });
45749
- await rename(temporaryPath, path);
45832
+ await writeConfigFile(path, config2);
45750
45833
  return config2;
45751
45834
  }
45752
45835
  async function enableDefaultNetwork(network, path = getVapiPaths().config, source = process.env) {
@@ -45757,6 +45840,10 @@ async function enableDefaultNetwork(network, path = getVapiPaths().config, sourc
45757
45840
  usdc: NETWORKS[SOLANA_MAINNET_CAIP2].usdc
45758
45841
  };
45759
45842
  }
45843
+ await writeConfigFile(path, config2);
45844
+ return config2;
45845
+ }
45846
+ async function writeConfigFile(path, config2) {
45760
45847
  await mkdir(dirname(path), { recursive: true, mode: 448 });
45761
45848
  const temporaryPath = `${path}.${process.pid}.tmp`;
45762
45849
  await writeFile(temporaryPath, `${JSON.stringify(config2, null, 2)}
@@ -45766,7 +45853,6 @@ async function enableDefaultNetwork(network, path = getVapiPaths().config, sourc
45766
45853
  flag: "wx"
45767
45854
  });
45768
45855
  await rename(temporaryPath, path);
45769
- return config2;
45770
45856
  }
45771
45857
  async function pathExists(path) {
45772
45858
  try {
@@ -46323,6 +46409,49 @@ async function unlockKeystore(passphrase, path = getVapiPaths().keystore) {
46323
46409
  }
46324
46410
  return await paymentAccountFromKeys(keys);
46325
46411
  }
46412
+ async function readKeystoreAddress(path = getVapiPaths().keystore) {
46413
+ let raw;
46414
+ try {
46415
+ raw = await readFile3(path, "utf8");
46416
+ } catch {
46417
+ return void 0;
46418
+ }
46419
+ let parsed;
46420
+ try {
46421
+ parsed = JSON.parse(raw);
46422
+ } catch {
46423
+ return void 0;
46424
+ }
46425
+ const address2 = typeof parsed === "object" && parsed !== null ? Reflect.get(parsed, "address") : void 0;
46426
+ return typeof address2 === "string" ? address2 : void 0;
46427
+ }
46428
+ async function exportKeystoreKeys(passphrase, path = getVapiPaths().keystore) {
46429
+ let raw;
46430
+ try {
46431
+ raw = await readFile3(path, "utf8");
46432
+ } catch (error61) {
46433
+ if (isMissingFile(error61)) {
46434
+ throw new KeystoreError(`No vAPI keystore found at ${path}. Run vapi init.`);
46435
+ }
46436
+ throw error61;
46437
+ }
46438
+ const keys = await decryptKeys(parseAnyKeystore(JSON.parse(raw)), passphrase);
46439
+ const evmPrivateKey = keys.evm;
46440
+ const exported = {
46441
+ evm: { address: privateKeyToAccount(evmPrivateKey).address, privateKey: evmPrivateKey }
46442
+ };
46443
+ if (!keys.solana) return exported;
46444
+ const seed = Uint8Array.from(Buffer.from(keys.solana, "base64"));
46445
+ const signer = await createSolanaSigner(Uint8Array.from(seed));
46446
+ const publicKey = Uint8Array.from(getBase58Encoder().encode(signer.address));
46447
+ const secretKey = new Uint8Array(seed.length + publicKey.length);
46448
+ secretKey.set(seed);
46449
+ secretKey.set(publicKey, seed.length);
46450
+ const encoded = getBase58Decoder().decode(secretKey);
46451
+ seed.fill(0);
46452
+ secretKey.fill(0);
46453
+ return { ...exported, solana: { address: signer.address, secretKey: encoded } };
46454
+ }
46326
46455
  async function enableSolanaKey(passphrase, path = getVapiPaths().keystore) {
46327
46456
  let raw;
46328
46457
  try {
@@ -47022,7 +47151,7 @@ function csvCell(value) {
47022
47151
  import { mkdir as mkdir6, writeFile as writeFile4 } from "node:fs/promises";
47023
47152
  import { arch, platform, release } from "node:os";
47024
47153
  import { join as join2 } from "node:path";
47025
- var VAPI_CLIENT_VERSION = "0.2.2";
47154
+ var VAPI_CLIENT_VERSION = "0.2.3";
47026
47155
  async function createSupportReport(options) {
47027
47156
  const message = options.message.trim();
47028
47157
  if (!message) throw new Error("Support report message must not be empty.");
@@ -49790,7 +49919,7 @@ function rgbToAnsi256(red, green, blue) {
49790
49919
  }
49791
49920
 
49792
49921
  // ../cli/src/version.ts
49793
- var CLI_VERSION = "0.2.2";
49922
+ var CLI_VERSION = "0.2.3";
49794
49923
 
49795
49924
  // ../cli/src/cli.ts
49796
49925
  var HELP_HEADING = "vAPI Network";
@@ -49808,6 +49937,7 @@ Usage:
49808
49937
  vapi receipts export --format <json|csv> [--range <24h|7d|30d>]
49809
49938
  vapi stats [--range <24h|7d|30d>] [--json]
49810
49939
  vapi sweep <address> [--network <caip2>] [--json]
49940
+ vapi export-key [--network <caip2>] [--json]
49811
49941
  vapi report "<what happened>" [--include-addresses] [--send] [--json]
49812
49942
  vapi mcp [--json]
49813
49943
  vapi serve [--json]
@@ -49876,6 +50006,9 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
49876
50006
  case "sweep":
49877
50007
  await sweepCommand(args.slice(1), json2, io);
49878
50008
  return 0;
50009
+ case "export-key":
50010
+ await exportKeyCommand(args.slice(1), json2, io);
50011
+ return 0;
49879
50012
  case "report":
49880
50013
  await reportCommand(args.slice(1), json2, io, dependencies);
49881
50014
  return 0;
@@ -49915,8 +50048,18 @@ async function initCommand(argv, json2, io, dependencies) {
49915
50048
  if (!process.env.VAPI_HOME?.trim()) {
49916
50049
  migrated = await migrateLegacyVapiHome({ targetDirectory: paths.directory, notice: io.stderr });
49917
50050
  }
50051
+ const adopted = migrated.includes(paths.keystore);
50052
+ if (!adopted && await fileExists(paths.keystore)) {
50053
+ const address2 = await readKeystoreAddress(paths.keystore);
50054
+ throw new Error(
50055
+ [
50056
+ `Keystore already exists at ${paths.keystore}. Refusing to replace the local payment key.`,
50057
+ ...address2 ? [`Address: ${address2}`] : []
50058
+ ].join("\n")
50059
+ );
50060
+ }
49918
50061
  const passphrase = await getKeystorePassphrase({ confirm: true });
49919
- let account = migrated.includes(paths.keystore) ? await unlockKeystore(passphrase, paths.keystore) : await createKeystore(passphrase, paths.keystore, { enableSolana });
50062
+ let account = adopted ? await unlockKeystore(passphrase, paths.keystore) : await createKeystore(passphrase, paths.keystore, { enableSolana });
49920
50063
  if (enableSolana && !account.solana) {
49921
50064
  account = await enableSolanaKey(passphrase, paths.keystore);
49922
50065
  }
@@ -49925,7 +50068,8 @@ async function initCommand(argv, json2, io, dependencies) {
49925
50068
  } else if (enableSolana) {
49926
50069
  await enableDefaultNetwork("solana", paths.config);
49927
50070
  }
49928
- const config2 = await loadConfig(paths.config);
50071
+ const configRewrites = await migrateLegacyRegistryConfig(paths.config);
50072
+ const config2 = await readConfig(paths.config, io);
49929
50073
  const accounts = await listAccounts({
49930
50074
  address: account.address,
49931
50075
  ...account.solana ? { solanaAddress: account.solana.address } : {},
@@ -49937,6 +50081,7 @@ async function initCommand(argv, json2, io, dependencies) {
49937
50081
  accounts,
49938
50082
  config: paths.config,
49939
50083
  keystore: paths.keystore,
50084
+ ...configRewrites.length > 0 ? { configRewrites } : {},
49940
50085
  message: "vAPI wallet created. Its encrypted key stays on this machine.",
49941
50086
  nextSteps: buildNextSteps(account.address)
49942
50087
  };
@@ -49944,6 +50089,7 @@ async function initCommand(argv, json2, io, dependencies) {
49944
50089
  io.stdout(JSON.stringify(result));
49945
50090
  return;
49946
50091
  }
50092
+ if (configRewrites.length > 0) io.stdout(formatLegacyRegistryRewrites(configRewrites));
49947
50093
  io.stdout(result.message);
49948
50094
  io.stdout(`Address: ${result.address}`);
49949
50095
  io.stdout(
@@ -49968,7 +50114,7 @@ async function fundCommand(argv, json2, io, dependencies) {
49968
50114
  });
49969
50115
  const fiatAmount = optionalUsdAmount(parsed.one("--amount"), "--amount");
49970
50116
  const paths = getVapiPaths();
49971
- const config2 = await loadConfig(paths.config);
50117
+ const config2 = await readConfig(paths.config, io);
49972
50118
  const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
49973
50119
  const session = await createOnrampSession({
49974
50120
  address: account.address,
@@ -49988,7 +50134,7 @@ async function searchCommand(argv, json2, io, dependencies) {
49988
50134
  maximumPositionals: 1
49989
50135
  });
49990
50136
  const limit = optionalPositiveInteger(parsed.one("--limit"), "--limit");
49991
- const config2 = await loadConfig(getVapiPaths().config);
50137
+ const config2 = await readConfig(getVapiPaths().config, io);
49992
50138
  const page = await searchMarketplace(
49993
50139
  {
49994
50140
  ...parsed.positionals[0] ? { query: parsed.positionals[0] } : {},
@@ -50012,7 +50158,7 @@ async function inspectCommand(argv, json2, io, dependencies) {
50012
50158
  parsed.positionals[0],
50013
50159
  "Usage: vapi inspect <id> [--endpoint <name>]"
50014
50160
  );
50015
- const config2 = await loadConfig(getVapiPaths().config);
50161
+ const config2 = await readConfig(getVapiPaths().config, io);
50016
50162
  const result = await inspectService(
50017
50163
  { id, ...parsed.one("--endpoint") ? { endpoint: parsed.one("--endpoint") } : {} },
50018
50164
  config2,
@@ -50036,7 +50182,7 @@ async function payCommand(argv, json2, io) {
50036
50182
  });
50037
50183
  const target = requiredPositional(parsed.positionals[0], "Usage: vapi pay <id-or-url> [options]");
50038
50184
  const paths = getVapiPaths();
50039
- const config2 = await loadConfig(paths.config);
50185
+ const config2 = await readConfig(paths.config, io);
50040
50186
  const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
50041
50187
  const bodyText = parsed.one("--body");
50042
50188
  const maxPriceUsd = aliasedOption(parsed, "--max", "--max-price-usd");
@@ -50062,7 +50208,7 @@ async function payCommand(argv, json2, io) {
50062
50208
  async function balanceCommand(argv, json2, io, dependencies) {
50063
50209
  requireNoArguments(argv, "balance");
50064
50210
  const paths = getVapiPaths();
50065
- const config2 = await loadConfig(paths.config);
50211
+ const config2 = await readConfig(paths.config, io);
50066
50212
  const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
50067
50213
  const wallet = await getWallet(account, config2, dependencies);
50068
50214
  output2(io, json2, wallet, formatWallet(wallet));
@@ -50080,7 +50226,7 @@ async function accountsCommand(argv, json2, io, dependencies) {
50080
50226
  const passphrase = await getKeystorePassphrase();
50081
50227
  const account = enable ? await enableSolanaKey(passphrase, paths.keystore) : await unlockKeystore(passphrase, paths.keystore);
50082
50228
  if (enable) await enableDefaultNetwork("solana", paths.config);
50083
- const config2 = await loadConfig(paths.config);
50229
+ const config2 = await readConfig(paths.config, io);
50084
50230
  const accounts = await listAccounts({
50085
50231
  address: account.address,
50086
50232
  ...account.solana ? { solanaAddress: account.solana.address } : {},
@@ -50149,7 +50295,7 @@ async function sweepCommand(argv, json2, io) {
50149
50295
  );
50150
50296
  const requestedNetwork = parsed.one("--network");
50151
50297
  const paths = getVapiPaths();
50152
- const config2 = await loadConfig(paths.config);
50298
+ const config2 = await readConfig(paths.config, io);
50153
50299
  const account = await unlockKeystore(await getKeystorePassphrase(), paths.keystore);
50154
50300
  if (requestedNetwork && !isNetworkConfigured(config2.networks, requestedNetwork)) {
50155
50301
  throw new Error(`Network ${requestedNetwork} is not configured.`);
@@ -50193,6 +50339,33 @@ async function reportCommand(argv, json2, io, dependencies) {
50193
50339
  });
50194
50340
  output2(io, json2, result, formatSupportReport(result));
50195
50341
  }
50342
+ var EXPORT_KEY_WARNING = "Anyone with this key can spend the wallet. Never paste it into a website or chat.";
50343
+ async function exportKeyCommand(argv, json2, io) {
50344
+ const parsed = parseArguments(argv, {
50345
+ valueOptions: /* @__PURE__ */ new Set(["--network"]),
50346
+ maximumPositionals: 0
50347
+ });
50348
+ const network = parsed.one("--network") ?? BASE_MAINNET_CAIP2;
50349
+ const solana = isSolanaNetwork(network);
50350
+ if (!solana && !network.startsWith("eip155:")) {
50351
+ throw new UsageError("--network must be an eip155:<chainId> or Solana network identifier.");
50352
+ }
50353
+ const paths = getVapiPaths();
50354
+ const keys = await exportKeystoreKeys(await getKeystorePassphrase(), paths.keystore);
50355
+ if (solana && !keys.solana) {
50356
+ throw new Error(
50357
+ `No Solana key is enabled in ${paths.keystore}. Run vapi accounts --enable solana first.`
50358
+ );
50359
+ }
50360
+ const selected = solana && keys.solana ? keys.solana : keys.evm;
50361
+ const result = {
50362
+ network,
50363
+ address: selected.address,
50364
+ privateKey: "secretKey" in selected ? selected.secretKey : selected.privateKey
50365
+ };
50366
+ io.stderr(EXPORT_KEY_WARNING);
50367
+ io.stdout(json2 ? JSON.stringify(result) : result.privateKey);
50368
+ }
50196
50369
  async function mcpCommand(argv) {
50197
50370
  requireNoArguments(argv, "mcp");
50198
50371
  const paths = getVapiPaths();
@@ -50206,6 +50379,9 @@ async function mcpCommand(argv) {
50206
50379
  searchesPath: paths.searches
50207
50380
  });
50208
50381
  }
50382
+ async function readConfig(path, io) {
50383
+ return await loadConfig(path, process.env, { notice: io.stderr });
50384
+ }
50209
50385
  function output2(io, json2, value, human) {
50210
50386
  io.stdout(json2 ? JSON.stringify(value) : human);
50211
50387
  }