@vapi-network/cli 0.9.7 → 0.11.0

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/cli.js CHANGED
@@ -39308,7 +39308,6 @@ var BROWSER_ENABLED_X402_NETWORK_CONFIG = Object.freeze({
39308
39308
 
39309
39309
  // ../core/src/marketplace-contracts.ts
39310
39310
  var MARKETPLACE_DISCOVERY_PROTOCOL = "vapi.marketplace.discovery/1";
39311
- var MARKETPLACE_RANKING_VERSION = "marketplace-ranking-v1";
39312
39311
  var MARKETPLACE_KINDS = ["api", "service_offer", "open_request"];
39313
39312
  var MARKETPLACE_EXECUTION_METHODS = [
39314
39313
  "GET",
@@ -39341,6 +39340,32 @@ var listingLivenessSchema = external_exports.looseObject({
39341
39340
  latencyP95Ms: external_exports.number().nonnegative().nullable(),
39342
39341
  checks7d: external_exports.number().int().nonnegative()
39343
39342
  });
39343
+ var LISTING_HEALTH_STATES = ["healthy", "degraded", "outage", "unknown"];
39344
+ var listingHealthStateSchema = external_exports.enum(LISTING_HEALTH_STATES).catch("unknown");
39345
+ var listingHealthSchema = external_exports.looseObject({
39346
+ state: listingHealthStateSchema,
39347
+ uptime7d: external_exports.number().min(0).max(1).nullable().catch(null),
39348
+ latencyP50Ms: external_exports.number().nonnegative().nullable().catch(null),
39349
+ latencyP95Ms: external_exports.number().nonnegative().nullable().catch(null),
39350
+ checks7d: external_exports.number().int().nonnegative().catch(0)
39351
+ });
39352
+ var marketplaceAlternativeSchema = external_exports.looseObject({
39353
+ ref: external_exports.string().trim().min(1),
39354
+ reason: external_exports.enum(["cheaper", "healthier"])
39355
+ });
39356
+ var marketplaceAlternativesSchema = external_exports.preprocess((value) => {
39357
+ if (!Array.isArray(value)) return void 0;
39358
+ const alternatives = [];
39359
+ const refs = /* @__PURE__ */ new Set();
39360
+ for (const entry of value) {
39361
+ const parsed = marketplaceAlternativeSchema.safeParse(entry);
39362
+ if (!parsed.success || refs.has(parsed.data.ref)) continue;
39363
+ refs.add(parsed.data.ref);
39364
+ alternatives.push(parsed.data);
39365
+ if (alternatives.length === 2) break;
39366
+ }
39367
+ return alternatives.length > 0 ? alternatives : void 0;
39368
+ }, external_exports.array(marketplaceAlternativeSchema).optional());
39344
39369
  var listingConformanceSchema = external_exports.looseObject({
39345
39370
  declaredVersion: external_exports.union([external_exports.literal(1), external_exports.literal(2)]).nullable(),
39346
39371
  versionConformant: external_exports.boolean(),
@@ -39372,7 +39397,8 @@ var marketplaceBadgeCodeSchema = external_exports.enum([
39372
39397
  "vapi_verified",
39373
39398
  "external_catalog",
39374
39399
  "approved_vendor",
39375
- "unverified"
39400
+ "unverified",
39401
+ "failed_calls_free"
39376
39402
  ]);
39377
39403
  var marketplaceBadgeSchema = external_exports.looseObject({
39378
39404
  code: marketplaceBadgeCodeSchema,
@@ -39413,6 +39439,8 @@ var firstPartyApiMarketplaceHitSchema = external_exports.looseObject({
39413
39439
  ...marketplaceHitBase,
39414
39440
  kind: external_exports.literal("api"),
39415
39441
  provenance: firstPartyProvenanceSchema,
39442
+ health: listingHealthSchema.optional().catch(void 0),
39443
+ alternatives: marketplaceAlternativesSchema.optional().catch(void 0),
39416
39444
  execution: external_exports.looseObject({
39417
39445
  mode: executionModeSchema
39418
39446
  }),
@@ -39422,6 +39450,8 @@ var mirroredApiMarketplaceHitSchema = external_exports.looseObject({
39422
39450
  ...marketplaceHitBase,
39423
39451
  kind: external_exports.literal("api"),
39424
39452
  provenance: external_exports.literal("indexed"),
39453
+ health: listingHealthSchema.optional().catch(void 0),
39454
+ alternatives: marketplaceAlternativesSchema.optional().catch(void 0),
39425
39455
  execution: external_exports.looseObject({
39426
39456
  mode: external_exports.literal("direct"),
39427
39457
  url: external_exports.url().max(2048).regex(/^https:\/\/(?![^/?#]*@)/),
@@ -39471,7 +39501,8 @@ var marketplaceDiscoveryInputSchema = external_exports.strictObject({
39471
39501
  network: external_exports.string().trim().min(1).max(160).optional(),
39472
39502
  cursor: external_exports.string().trim().min(1).max(4096).optional(),
39473
39503
  limit: external_exports.number().int().min(1).max(50).optional(),
39474
- includeUnverified: external_exports.boolean().optional()
39504
+ includeUnverified: external_exports.boolean().optional(),
39505
+ includeOutage: external_exports.boolean().optional()
39475
39506
  }).superRefine((input2, context) => {
39476
39507
  if (input2.kinds && new Set(input2.kinds).size !== input2.kinds.length) {
39477
39508
  context.addIssue({
@@ -39489,7 +39520,14 @@ var marketplaceDiscoveryEnvelopeSchema = external_exports.looseObject({
39489
39520
  items: external_exports.array(external_exports.unknown()),
39490
39521
  nextCursor: external_exports.string().min(1).max(4096).nullable(),
39491
39522
  unavailableKinds: external_exports.array(marketplaceKindSchema).max(MARKETPLACE_KINDS.length),
39492
- rankingVersion: external_exports.literal(MARKETPLACE_RANKING_VERSION)
39523
+ // The ranking label is informational: pinning it made every installed client
39524
+ // reject the page the day the registry re-ranked, so any label is accepted.
39525
+ rankingVersion: external_exports.string().trim().min(1).max(80),
39526
+ // `hiddenOutage` counts listings in outage the registry left out because
39527
+ // `includeOutage` was not set. Older registries send no totals at all.
39528
+ totals: external_exports.looseObject({
39529
+ hiddenOutage: external_exports.number().int().nonnegative().optional().catch(void 0)
39530
+ }).optional().catch(void 0)
39493
39531
  });
39494
39532
  var marketplaceDiscoveryPageSchema = marketplaceDiscoveryEnvelopeSchema.extend({
39495
39533
  items: external_exports.array(marketplaceHitSchema)
@@ -40525,14 +40563,14 @@ function assertByteArrayOffsetIsNotOutOfRange(codecDescription, offset, bytesLen
40525
40563
  }
40526
40564
  }
40527
40565
  function addEncoderSizePrefix(encoder5, prefix) {
40528
- const write = ((value, bytes, offset) => {
40566
+ const write2 = ((value, bytes, offset) => {
40529
40567
  const encoderBytes = encoder5.encode(value);
40530
40568
  offset = prefix.write(encoderBytes.length, bytes, offset);
40531
40569
  bytes.set(encoderBytes, offset);
40532
40570
  return offset + encoderBytes.length;
40533
40571
  });
40534
40572
  if (isFixedSize(prefix) && isFixedSize(encoder5)) {
40535
- return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write });
40573
+ return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write: write2 });
40536
40574
  }
40537
40575
  const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
40538
40576
  const encoderMaxSize = isFixedSize(encoder5) ? encoder5.fixedSize : encoder5.maxSize ?? null;
@@ -40544,7 +40582,7 @@ function addEncoderSizePrefix(encoder5, prefix) {
40544
40582
  const encoderSize = getEncodedSize(value, encoder5);
40545
40583
  return getEncodedSize(encoderSize, prefix) + encoderSize;
40546
40584
  },
40547
- write
40585
+ write: write2
40548
40586
  });
40549
40587
  }
40550
40588
  function addDecoderSizePrefix(decoder2, prefix) {
@@ -41380,13 +41418,13 @@ function getTupleDecoder(items) {
41380
41418
  }
41381
41419
  function getUnionEncoder(variants, getIndexFromValue) {
41382
41420
  const fixedSize = getUnionFixedSize(variants);
41383
- const write = (variant, bytes, offset) => {
41421
+ const write2 = (variant, bytes, offset) => {
41384
41422
  const index2 = getIndexFromValue(variant);
41385
41423
  assertValidVariantIndex(variants, index2);
41386
41424
  return variants[index2].write(variant, bytes, offset);
41387
41425
  };
41388
41426
  if (fixedSize !== null) {
41389
- return createEncoder({ fixedSize, write });
41427
+ return createEncoder({ fixedSize, write: write2 });
41390
41428
  }
41391
41429
  const maxSize = getUnionMaxSize(variants);
41392
41430
  return createEncoder({
@@ -41396,7 +41434,7 @@ function getUnionEncoder(variants, getIndexFromValue) {
41396
41434
  assertValidVariantIndex(variants, index2);
41397
41435
  return getEncodedSize(variant, variants[index2]);
41398
41436
  },
41399
- write
41437
+ write: write2
41400
41438
  });
41401
41439
  }
41402
41440
  function getUnionDecoder(variants, getIndexFromBytes) {
@@ -46030,6 +46068,11 @@ var discoveryEndpointSchema = external_exports.looseObject({
46030
46068
  operationId: external_exports.string().trim().min(1).optional(),
46031
46069
  requestContentType: external_exports.string().trim().min(1).optional(),
46032
46070
  requestSchema: external_exports.json().optional(),
46071
+ responseSchema: external_exports.json().optional().catch(void 0),
46072
+ exampleRequest: external_exports.looseObject({
46073
+ query: external_exports.record(external_exports.string(), external_exports.string()).optional().catch(void 0),
46074
+ body: external_exports.json().optional()
46075
+ }).optional().catch(void 0),
46033
46076
  responseContentType: external_exports.string().trim().min(1).optional(),
46034
46077
  pathTemplate: external_exports.string().trim().min(1).optional(),
46035
46078
  pathParameters: external_exports.array(external_exports.string().trim().min(1)).optional(),
@@ -70185,7 +70228,7 @@ function keychainStore(platform2, run) {
70185
70228
  const value = withoutTrailingNewline(result.stdout);
70186
70229
  return value.length === 0 ? void 0 : value;
70187
70230
  };
70188
- const write = async (account, value, what) => {
70231
+ const write2 = async (account, value, what) => {
70189
70232
  const result = await run(
70190
70233
  SECURITY_BINARY,
70191
70234
  [
@@ -70256,7 +70299,7 @@ ${value}
70256
70299
  const account = accountFor(name);
70257
70300
  const what = `store the passphrase of ${name} in the macOS Keychain`;
70258
70301
  if (passphrase.length <= KEYCHAIN_PROMPT_LIMIT) {
70259
- await write(account, passphrase, what);
70302
+ await write2(account, passphrase, what);
70260
70303
  return;
70261
70304
  }
70262
70305
  const chunks = [];
@@ -70267,10 +70310,10 @@ ${value}
70267
70310
  throw new KeystoreError(`The secret ${name} is too long for the macOS Keychain.`);
70268
70311
  }
70269
70312
  for (const [index2, chunk] of chunks.entries()) {
70270
- await write(keychainPart(account, index2 + 1), chunk, what);
70313
+ await write2(keychainPart(account, index2 + 1), chunk, what);
70271
70314
  }
70272
70315
  await erasePartsAfter(account, chunks.length, what);
70273
- await write(account, `${CHUNKED_MARKER}${chunks.length}`, what);
70316
+ await write2(account, `${CHUNKED_MARKER}${chunks.length}`, what);
70274
70317
  },
70275
70318
  async remove(name) {
70276
70319
  const account = accountFor(name);
@@ -73800,12 +73843,14 @@ var ledgerFileSchema = external_exports.union([
73800
73843
  ledgerRowSchema
73801
73844
  ]);
73802
73845
  var SpendCapError = class extends Error {
73803
- constructor(code, message) {
73846
+ constructor(code, message, details) {
73804
73847
  super(message);
73805
73848
  this.code = code;
73849
+ this.details = details;
73806
73850
  this.name = "SpendCapError";
73807
73851
  }
73808
73852
  code;
73853
+ details;
73809
73854
  };
73810
73855
  function utcDateKey(now = /* @__PURE__ */ new Date()) {
73811
73856
  return now.toISOString().slice(0, 10);
@@ -73887,7 +73932,8 @@ async function reserveSpend(amountAtomic2, caps, options) {
73887
73932
  if (amountAtomic2 > perCallAtomic) {
73888
73933
  throw new SpendCapError(
73889
73934
  "per_call_cap_exceeded",
73890
- `Payment quote ${amountAtomic2} atomic USDC exceeds the per-call cap ${perCallAtomic}. Refusing to sign.`
73935
+ `Payment quote ${amountAtomic2} atomic USDC exceeds the per-call cap ${perCallAtomic}. Refusing to sign.`,
73936
+ { amountAtomic: amountAtomic2, limitAtomic: perCallAtomic, wallet: options?.wallet }
73891
73937
  );
73892
73938
  }
73893
73939
  }
@@ -73976,7 +74022,8 @@ async function reserveSpend(amountAtomic2, caps, options) {
73976
74022
  if (nextSpent > perDayAtomic) {
73977
74023
  throw new SpendCapError(
73978
74024
  "per_day_cap_exceeded",
73979
- `${kind === "escrow-funding" ? "Escrow funding" : "Payment quote"} ${amountAtomic2} atomic USDC would raise today's spend to ${nextSpent} for wallet ${wallet}, above the per-day cap ${perDayAtomic}. Refusing to sign.`
74025
+ `${kind === "escrow-funding" ? "Escrow funding" : "Payment quote"} ${amountAtomic2} atomic USDC would raise today's spend to ${nextSpent} for wallet ${wallet}, above the per-day cap ${perDayAtomic}. Refusing to sign.`,
74026
+ { amountAtomic: amountAtomic2, limitAtomic: perDayAtomic, spentAtomic: BigInt(spentAtomic), wallet }
73980
74027
  );
73981
74028
  }
73982
74029
  const reservationId = options?.reservationId ?? (options?.taskKey === void 0 ? void 0 : randomBytes10(16).toString("hex"));
@@ -76932,6 +76979,96 @@ function parseAtomic(value, label) {
76932
76979
  throw new Error(`Invalid ${label} atomic amount.`);
76933
76980
  }
76934
76981
 
76982
+ // ../core/src/spend-cap-exceeded.ts
76983
+ var SpendCapExceededError = class extends Error {
76984
+ name = "SpendCapExceededError";
76985
+ code = "spend_cap_exceeded";
76986
+ retryable = false;
76987
+ cap;
76988
+ amountUsd;
76989
+ limitUsd;
76990
+ spentUsd;
76991
+ wallet;
76992
+ command;
76993
+ constructor(input2) {
76994
+ const amountUsd = normalizeUsd(input2.amountUsd);
76995
+ const limitUsd = normalizeUsd(input2.limitUsd);
76996
+ const spentUsd = input2.spentUsd === void 0 ? void 0 : normalizeUsd(input2.spentUsd);
76997
+ const wallet = input2.wallet?.trim() || void 0;
76998
+ const command = input2.command === void 0 ? spendCapCommand(input2.cap, amountUsd, spentUsd, wallet, input2.perDayLimitUsd) : input2.command;
76999
+ super(
77000
+ input2.message ?? spendCapMessage(input2.cap, amountUsd, limitUsd, spentUsd, wallet, command),
77001
+ input2.cause === void 0 ? void 0 : { cause: input2.cause }
77002
+ );
77003
+ this.cap = input2.cap;
77004
+ this.amountUsd = amountUsd;
77005
+ this.limitUsd = limitUsd;
77006
+ this.spentUsd = spentUsd;
77007
+ this.wallet = wallet;
77008
+ this.command = command;
77009
+ }
77010
+ toJSON() {
77011
+ return {
77012
+ code: this.code,
77013
+ cap: this.cap,
77014
+ amountUsd: this.amountUsd,
77015
+ limitUsd: this.limitUsd,
77016
+ ...this.spentUsd === void 0 ? {} : { spentUsd: this.spentUsd },
77017
+ ...this.wallet === void 0 ? {} : { wallet: this.wallet },
77018
+ command: this.command,
77019
+ message: this.message
77020
+ };
77021
+ }
77022
+ };
77023
+ function spendCapCommand(cap, amountUsd, spentUsd, wallet, perDayLimitUsd) {
77024
+ const account = wallet ?? "<account>";
77025
+ if (cap === "per_call") {
77026
+ const scale = Math.max(fractionLength(amountUsd), fractionLength(perDayLimitUsd ?? "0"));
77027
+ const raiseDay = perDayLimitUsd !== void 0 && parseDecimal(amountUsd, scale) > parseDecimal(perDayLimitUsd, scale);
77028
+ return `vapi accounts caps ${account} --per-call ${amountUsd}${raiseDay ? ` --per-day ${amountUsd}` : ""}`;
77029
+ }
77030
+ if (cap === "per_day") {
77031
+ return `vapi accounts caps ${account} --per-day ${addUsd(spentUsd ?? "0", amountUsd)}`;
77032
+ }
77033
+ if (cap === "max_price") {
77034
+ return `--max ${amountUsd}`;
77035
+ }
77036
+ if (cap === "run_budget") {
77037
+ const budget = addUsd(spentUsd ?? "0", amountUsd);
77038
+ return `--budget ${budget}`;
77039
+ }
77040
+ return null;
77041
+ }
77042
+ function spendCapMessage(cap, amountUsd, limitUsd, spentUsd, wallet, command) {
77043
+ const capName = cap === "per_call" ? "per-call spend cap" : cap === "per_day" ? "per-day spend cap" : cap === "max_price" ? "maximum price" : cap === "max_amount" ? "maximum amount" : "run budget";
77044
+ const account = cap === "per_call" || cap === "per_day" ? ` of account ${wallet ?? "<account>"}` : "";
77045
+ const payment = cap === "per_day" || cap === "run_budget" ? `this payment of $${amountUsd} would raise ${cap === "per_day" ? "today's spend" : "run spend"} from $${spentUsd ?? "0"} to $${addUsd(spentUsd ?? "0", amountUsd)}, above $${limitUsd}` : `this payment of $${amountUsd} exceeds the limit of $${limitUsd}`;
77046
+ const guidance = cap === "max_price" ? ` MCP call.pay takes maxPriceUsd. Raise the CLI maximum with:` : cap === "run_budget" ? " Raise it on vapi agent run or vapi swarm run with:" : " Raise it with:";
77047
+ const action = command === null ? "" : `${guidance} ${command}`;
77048
+ return `Blocked by the ${capName}${account}: ${payment}. Nothing was signed.${action}`;
77049
+ }
77050
+ function normalizeUsd(value) {
77051
+ const trimmed = value.trim();
77052
+ if (!trimmed.includes(".")) return trimmed;
77053
+ const normalized = trimmed.replace(/0+$/u, "").replace(/\.$/u, "");
77054
+ return normalized || "0";
77055
+ }
77056
+ function addUsd(left, right) {
77057
+ const scale = Math.max(fractionLength(left), fractionLength(right));
77058
+ const factor = 10n ** BigInt(scale);
77059
+ const total = parseDecimal(left, scale) + parseDecimal(right, scale);
77060
+ const whole = total / factor;
77061
+ const fraction = (total % factor).toString().padStart(scale, "0").replace(/0+$/u, "");
77062
+ return fraction ? `${whole}.${fraction}` : whole.toString();
77063
+ }
77064
+ function fractionLength(value) {
77065
+ return value.split(".")[1]?.length ?? 0;
77066
+ }
77067
+ function parseDecimal(value, scale) {
77068
+ const [whole = "0", fraction = ""] = value.split(".");
77069
+ return BigInt(whole) * 10n ** BigInt(scale) + BigInt(fraction.padEnd(scale, "0") || "0");
77070
+ }
77071
+
76935
77072
  // ../core/src/swarm.ts
76936
77073
  import { readdir as readdir6, readFile as readFile15, stat as stat11, unlink as unlink11 } from "node:fs/promises";
76937
77074
  import { join as join12 } from "node:path";
@@ -77603,7 +77740,7 @@ function createRunBudget(args) {
77603
77740
  import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
77604
77741
  import { arch, platform, release } from "node:os";
77605
77742
  import { join as join13 } from "node:path";
77606
- var VAPI_CLIENT_VERSION = "0.9.7";
77743
+ var VAPI_CLIENT_VERSION = "0.11.0";
77607
77744
  async function createSupportReport(options) {
77608
77745
  const message = options.message.trim();
77609
77746
  if (!message) throw new Error("Support report message must not be empty.");
@@ -77798,8 +77935,28 @@ async function completeX402Payment(args) {
77798
77935
  }
77799
77936
  args.challenge.request.signal.throwIfAborted();
77800
77937
  if (trace) trace.capsApplied = true;
77801
- assertMaximumAtomic(quote.amountAtomic, args.maxAtomic);
77802
- assertMaxPrice(quote.amountAtomic, args.maxPriceUsd);
77938
+ try {
77939
+ assertMaximumAtomic(quote.amountAtomic, args.maxAtomic);
77940
+ } catch (error61) {
77941
+ if (args.maxAtomic !== void 0 && isErrorCode(error61, "max_price_exceeded")) {
77942
+ throw paymentCapError("max_amount", quote.amountAtomic, args.maxAtomic, args, error61);
77943
+ }
77944
+ throw error61;
77945
+ }
77946
+ try {
77947
+ assertMaxPrice(quote.amountAtomic, args.maxPriceUsd);
77948
+ } catch (error61) {
77949
+ if (args.maxPriceUsd !== void 0 && isErrorCode(error61, "max_price_exceeded")) {
77950
+ throw paymentCapError(
77951
+ "max_price",
77952
+ quote.amountAtomic,
77953
+ usdToAtomic(args.maxPriceUsd),
77954
+ args,
77955
+ error61
77956
+ );
77957
+ }
77958
+ throw error61;
77959
+ }
77803
77960
  const spendReservation = {
77804
77961
  ledgerPath: args.ledgerPath ?? getVapiPaths().ledger,
77805
77962
  now: args.now,
@@ -77808,18 +77965,42 @@ async function completeX402Payment(args) {
77808
77965
  let reservationId;
77809
77966
  let reservedOn;
77810
77967
  if (args.runBudget === void 0) {
77811
- await reserveSpend(quote.amountAtomic, args.caps, spendReservation);
77968
+ try {
77969
+ await reserveSpend(quote.amountAtomic, args.caps, spendReservation);
77970
+ } catch (error61) {
77971
+ throw walletCapError(error61, quote.amountAtomic, args);
77972
+ }
77812
77973
  } else {
77813
77974
  reservationId = args.paymentId ?? `x402_${randomBytes14(12).toString("hex")}`;
77814
- const reservation = await reserveSpend(quote.amountAtomic, args.caps, {
77815
- ...spendReservation,
77816
- reservationId
77817
- });
77975
+ let reservation;
77976
+ try {
77977
+ reservation = await reserveSpend(quote.amountAtomic, args.caps, {
77978
+ ...spendReservation,
77979
+ reservationId
77980
+ });
77981
+ } catch (error61) {
77982
+ throw walletCapError(error61, quote.amountAtomic, args);
77983
+ }
77818
77984
  reservedOn = reservation.date;
77819
77985
  try {
77820
77986
  args.runBudget.reserve(quote.amountAtomic, reservationId);
77821
77987
  } catch (error61) {
77822
- await releaseUnsentReservation(args, quote.amountAtomic, reservationId, reservedOn);
77988
+ let runSpentAtomic;
77989
+ try {
77990
+ runSpentAtomic = args.runBudget.spentAtomic();
77991
+ } finally {
77992
+ await releaseUnsentReservation(args, quote.amountAtomic, reservationId, reservedOn);
77993
+ }
77994
+ if (error61 instanceof RunBudgetError || isErrorCode(error61, "run_budget_exceeded")) {
77995
+ throw new SpendCapExceededError({
77996
+ cap: "run_budget",
77997
+ amountUsd: formatUsdc(quote.amountAtomic),
77998
+ limitUsd: formatUsdc(args.runBudget.limitAtomic),
77999
+ spentUsd: formatUsdc(runSpentAtomic),
78000
+ ...args.wallet === void 0 ? {} : { wallet: args.wallet },
78001
+ cause: error61
78002
+ });
78003
+ }
77823
78004
  throw error61;
77824
78005
  }
77825
78006
  }
@@ -78102,6 +78283,18 @@ function sanitizeThrownError(error61, secrets) {
78102
78283
  if (!(error61 instanceof Error)) return error61;
78103
78284
  const message = redactKnownSecrets(error61.message, secrets);
78104
78285
  const cause = error61.cause === void 0 ? void 0 : sanitizeThrownError(error61.cause, secrets);
78286
+ if (error61 instanceof SpendCapExceededError) {
78287
+ return new SpendCapExceededError({
78288
+ cap: error61.cap,
78289
+ amountUsd: error61.amountUsd,
78290
+ limitUsd: error61.limitUsd,
78291
+ ...error61.spentUsd === void 0 ? {} : { spentUsd: error61.spentUsd },
78292
+ ...error61.wallet === void 0 ? {} : { wallet: error61.wallet },
78293
+ command: error61.command,
78294
+ message,
78295
+ ...cause === void 0 ? {} : { cause }
78296
+ });
78297
+ }
78105
78298
  if (message === error61.message && cause === error61.cause) return error61;
78106
78299
  if (error61 instanceof X402Error) {
78107
78300
  return new X402Error(error61.code, message, cause === void 0 ? void 0 : { cause });
@@ -78203,6 +78396,43 @@ function assertMaximumAtomic(amountAtomic2, maxAtomic) {
78203
78396
  );
78204
78397
  }
78205
78398
  }
78399
+ function walletCapError(error61, amountAtomic2, args) {
78400
+ if (!(error61 instanceof SpendCapError)) return error61;
78401
+ if (error61.code === "per_call_cap_exceeded") {
78402
+ return paymentCapError(
78403
+ "per_call",
78404
+ amountAtomic2,
78405
+ error61.details?.limitAtomic ?? BigInt(args.caps.perCallAtomic),
78406
+ args,
78407
+ error61
78408
+ );
78409
+ }
78410
+ if (error61.code === "per_day_cap_exceeded") {
78411
+ return paymentCapError(
78412
+ "per_day",
78413
+ amountAtomic2,
78414
+ error61.details?.limitAtomic ?? BigInt(args.caps.perDayAtomic),
78415
+ args,
78416
+ error61,
78417
+ error61.details?.spentAtomic
78418
+ );
78419
+ }
78420
+ return error61;
78421
+ }
78422
+ function paymentCapError(cap, amountAtomic2, limitAtomic, args, cause, spentAtomic) {
78423
+ return new SpendCapExceededError({
78424
+ cap,
78425
+ amountUsd: formatUsdc(amountAtomic2),
78426
+ limitUsd: formatUsdc(limitAtomic),
78427
+ ...cap === "per_call" ? { perDayLimitUsd: formatUsdc(BigInt(args.caps.perDayAtomic)) } : {},
78428
+ ...spentAtomic === void 0 ? {} : { spentUsd: formatUsdc(spentAtomic) },
78429
+ ...args.wallet === void 0 ? {} : { wallet: args.wallet },
78430
+ cause
78431
+ });
78432
+ }
78433
+ function isErrorCode(error61, code) {
78434
+ return typeof error61 === "object" && error61 !== null && Reflect.get(error61, "code") === code;
78435
+ }
78206
78436
  function settlementUnknown(message, quote, payment, payer, receipt, cause) {
78207
78437
  return new X402PaymentError(
78208
78438
  "settlement_unknown",
@@ -78278,7 +78508,7 @@ function receiptQuote(quote) {
78278
78508
  };
78279
78509
  }
78280
78510
  function paymentErrorOutcome(error61) {
78281
- if (error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error && error61.code === "max_price_exceeded") {
78511
+ if (error61 instanceof SpendCapExceededError || error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error && error61.code === "max_price_exceeded") {
78282
78512
  return "declined_policy";
78283
78513
  }
78284
78514
  if (error61 instanceof X402PaymentError) {
@@ -78295,7 +78525,7 @@ function errorCode(error61) {
78295
78525
  return "request_failed";
78296
78526
  }
78297
78527
  function receiptSafeErrorMessage(error61) {
78298
- if (error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error || error61 instanceof X402PaymentError) {
78528
+ if (error61 instanceof SpendCapExceededError || error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error || error61 instanceof X402PaymentError) {
78299
78529
  return error61.message;
78300
78530
  }
78301
78531
  return "The x402 request failed before it completed.";
@@ -78801,15 +79031,18 @@ function budgetExhaustedError(resetsAt, status) {
78801
79031
  );
78802
79032
  }
78803
79033
  function refillDeclinedDetail(error61) {
79034
+ if (error61 instanceof SpendCapExceededError) return `${error61.name}: ${error61.cap}`;
78804
79035
  if (error61 instanceof SpendCapError) return `${error61.name}: ${error61.code}`;
78805
- if (isRunBudgetError(error61)) return `RunBudgetError: ${error61.code}`;
79036
+ if (isRunBudgetError(error61)) {
79037
+ return error61.code === "spend_cap_exceeded" ? "SpendCapExceededError: run_budget" : `RunBudgetError: ${error61.code}`;
79038
+ }
78806
79039
  if (error61 instanceof RouterClientError) {
78807
79040
  return `${error61.name}: ${error61.code}${error61.status === void 0 ? "" : ` (${error61.status})`}`;
78808
79041
  }
78809
79042
  return "Error: Router balance refill failed.";
78810
79043
  }
78811
79044
  function isRunBudgetError(error61) {
78812
- return typeof error61 === "object" && error61 !== null && Reflect.get(error61, "code") === "run_budget_exceeded";
79045
+ return typeof error61 === "object" && error61 !== null && (Reflect.get(error61, "code") === "run_budget_exceeded" || Reflect.get(error61, "code") === "spend_cap_exceeded" && Reflect.get(error61, "cap") === "run_budget");
78813
79046
  }
78814
79047
  function isRouterTopupTier(value) {
78815
79048
  return ROUTER_TOPUP_TIERS.some((tier) => tier === value);
@@ -84851,6 +85084,11 @@ function safeOrigin2(value) {
84851
85084
  }
84852
85085
  }
84853
85086
 
85087
+ // ../core/src/listing-fee.ts
85088
+ function formatListingFee(fee) {
85089
+ return fee.bps === 0 ? "No network fee" : `${fee.label} (${fee.bps / 100}%)`;
85090
+ }
85091
+
84854
85092
  // ../core/src/onramp.ts
84855
85093
  var ONRAMP_NETWORK = "base";
84856
85094
  var ONRAMP_FALLBACK_INSTRUCTIONS = "Send USDC on Base (eip155:8453) to this address; add a little ETH for gas if you plan to sweep.";
@@ -87199,7 +87437,7 @@ function isRecord4(value) {
87199
87437
  }
87200
87438
 
87201
87439
  // src/cli.ts
87202
- import { spawn as spawn3 } from "node:child_process";
87440
+ import { spawn as spawn4 } from "node:child_process";
87203
87441
  import { stat as stat16 } from "node:fs/promises";
87204
87442
  import { join as join28 } from "node:path";
87205
87443
  import { createInterface as createInterface3 } from "node:readline/promises";
@@ -87687,7 +87925,8 @@ async function searchMarketplace(input2, config2, fetchImpl, options = {}) {
87687
87925
  network: input2.network,
87688
87926
  limit: input2.limit,
87689
87927
  cursor: input2.cursor,
87690
- includeUnverified: input2.includeUnverified
87928
+ includeUnverified: input2.includeUnverified,
87929
+ includeOutage: input2.includeOutage
87691
87930
  });
87692
87931
  const startedAt = options.now ?? /* @__PURE__ */ new Date();
87693
87932
  const attempts = [];
@@ -87709,6 +87948,9 @@ async function searchMarketplace(input2, config2, fetchImpl, options = {}) {
87709
87948
  if (normalized.includeUnverified === true) {
87710
87949
  url2.searchParams.set("includeUnverified", "true");
87711
87950
  }
87951
+ if (normalized.includeOutage === true) {
87952
+ url2.searchParams.set("includeOutage", "true");
87953
+ }
87712
87954
  }
87713
87955
  });
87714
87956
  const envelope = marketplaceDiscoveryEnvelopeSchema.parse(await response.json());
@@ -87753,7 +87995,7 @@ async function resolveServiceListing(id2, config2, fetchImpl, endpointName) {
87753
87995
  }
87754
87996
  async function findMarketplaceApiByRef(ref, config2, fetchImpl) {
87755
87997
  const page = await searchMarketplace(
87756
- { query: ref, kinds: ["api"], limit: 50, includeUnverified: true },
87998
+ { query: ref, kinds: ["api"], limit: 50, includeUnverified: true, includeOutage: true },
87757
87999
  config2,
87758
88000
  fetchImpl
87759
88001
  );
@@ -87771,6 +88013,7 @@ async function fetchCallsDiscovery(query, config2, fetchImpl) {
87771
88013
  configureUrl(url2) {
87772
88014
  url2.searchParams.set("q", query);
87773
88015
  url2.searchParams.set("includeUnverified", "true");
88016
+ url2.searchParams.set("includeOutage", "true");
87774
88017
  }
87775
88018
  });
87776
88019
  return parseDiscovery(await response.json());
@@ -87843,6 +88086,18 @@ function isEnotfound(error61) {
87843
88086
  return false;
87844
88087
  }
87845
88088
 
88089
+ // ../mcp/src/tools/search.ts
88090
+ async function searchMarketplace2(...args) {
88091
+ const page = await searchMarketplace(...args);
88092
+ return {
88093
+ ...page,
88094
+ items: page.items.map((item) => ({
88095
+ ...item,
88096
+ ...item.fee === void 0 ? {} : { feeDisplay: formatListingFee(item.fee) }
88097
+ }))
88098
+ };
88099
+ }
88100
+
87846
88101
  // ../mcp/src/tools/call.ts
87847
88102
  var VapiCallError = class extends Error {
87848
88103
  constructor(code, message, possibleSettlement2, options) {
@@ -88353,7 +88608,7 @@ function receiptContext(args, trace, resourceUrl) {
88353
88608
  };
88354
88609
  }
88355
88610
  function errorOutcome(error61, code) {
88356
- if (code === "max_price_exceeded" || code.includes("cap_exceeded")) {
88611
+ if (error61 instanceof SpendCapExceededError || code === "max_price_exceeded" || code.includes("cap_exceeded")) {
88357
88612
  return "declined_policy";
88358
88613
  }
88359
88614
  if (error61 instanceof VapiCallError) {
@@ -88695,6 +88950,7 @@ function paidRequestTimeoutMs(timeoutSeconds, internalTimeoutMs, offerTimeoutSec
88695
88950
  return usableOfferTimeout === void 0 ? 12e4 : Math.min(12e4, Math.max(3e4, usableOfferTimeout * 1e3));
88696
88951
  }
88697
88952
  function mapX402PaymentError(error61, resumeId) {
88953
+ if (error61 instanceof SpendCapExceededError) return error61;
88698
88954
  if (!(error61 instanceof X402PaymentError)) return error61;
88699
88955
  if (error61.code === "payment_rejected") {
88700
88956
  return new VapiCallError("payment_rejected", error61.message, void 0, {
@@ -88754,9 +89010,11 @@ async function inspectService(input2, config2, fetchImpl) {
88754
89010
  ...endpoint.operationId === void 0 ? {} : { operationId: endpoint.operationId },
88755
89011
  ...endpoint.requestContentType === void 0 ? {} : { requestContentType: endpoint.requestContentType },
88756
89012
  ...endpoint.requestSchema === void 0 ? {} : { requestSchema: endpoint.requestSchema },
89013
+ ...endpoint.responseSchema === void 0 ? {} : { responseSchema: endpoint.responseSchema },
89014
+ ...endpoint.exampleRequest === void 0 ? {} : { exampleRequest: endpoint.exampleRequest },
88757
89015
  ...endpoint.responseContentType === void 0 ? {} : { responseContentType: endpoint.responseContentType },
88758
89016
  ...service.group === void 0 ? {} : { group: service.group },
88759
- ...service.fee === void 0 ? {} : { fee: service.fee },
89017
+ ...service.fee === void 0 ? {} : { fee: service.fee, feeDisplay: formatListingFee(service.fee) },
88760
89018
  verification: service.verification,
88761
89019
  ...healthOf(service),
88762
89020
  payment: endpoint.payment ?? null
@@ -88771,14 +89029,16 @@ function inspectIndexedHit(hit) {
88771
89029
  description: hit.card.summary,
88772
89030
  network: hit.execution.network,
88773
89031
  ...hit.group === void 0 ? {} : { group: hit.group },
88774
- ...hit.fee === void 0 ? {} : { fee: hit.fee },
89032
+ ...hit.fee === void 0 ? {} : { fee: hit.fee, feeDisplay: formatListingFee(hit.fee) },
88775
89033
  verification: hit.verification,
88776
89034
  ...healthOf(hit),
88777
89035
  payment: null
88778
89036
  };
88779
89037
  }
88780
89038
  function healthOf(listing) {
89039
+ const health = listingHealthSchema.optional().catch(void 0).parse(listing.health);
88781
89040
  return {
89041
+ ...health === void 0 ? {} : { health },
88782
89042
  ...listing.liveness === void 0 ? {} : { liveness: listing.liveness },
88783
89043
  ...listing.conformance === void 0 ? {} : { conformance: listing.conformance },
88784
89044
  ...listing.identity === void 0 ? {} : { identity: listing.identity }
@@ -88797,6 +89057,160 @@ function inspectionCacheKey(input2) {
88797
89057
  return JSON.stringify([input2.id, input2.endpoint ?? null]);
88798
89058
  }
88799
89059
 
89060
+ // ../mcp/src/actions/hints.ts
89061
+ function searchHints(page, options) {
89062
+ const hints = [];
89063
+ const apis = page.items.filter((hit) => hit.kind === "api");
89064
+ const payable = apis.find(
89065
+ (hit) => hit.action.type === "invoke_api" && hit.execution.payable !== false
89066
+ );
89067
+ if (payable) {
89068
+ hints.push(
89069
+ `Inspect before paying: ${renderAction(options.surface, "inspect", { id: payable.ref })}`
89070
+ );
89071
+ }
89072
+ hints.push(
89073
+ ...apis.flatMap(
89074
+ (hit) => (hit.alternatives ?? []).map((alternative) => {
89075
+ const reason = alternative.reason === "cheaper" ? "cheaper healthy" : "healthier";
89076
+ return `${hit.ref} has a ${reason} alternative: ${alternative.ref}`;
89077
+ })
89078
+ ).slice(0, 2)
89079
+ );
89080
+ const hiddenOutage = page.totals?.hiddenOutage ?? 0;
89081
+ if (options.includeOutage !== true && hiddenOutage > 0) {
89082
+ const count = hiddenOutage === 1 ? "1 listing in outage is" : `${hiddenOutage} listings in outage are`;
89083
+ hints.push(
89084
+ options.surface === "cli" ? `${count} hidden; add --include-outage to show them.` : `${count} hidden; call with includeOutage: true to show them.`
89085
+ );
89086
+ }
89087
+ if (page.items.length === 0) {
89088
+ hints.push(
89089
+ `Broaden your search with: ${renderAction(options.surface, "search", { includeUnverified: true })}`
89090
+ );
89091
+ }
89092
+ return hints.slice(0, 4);
89093
+ }
89094
+ function inspectHints(result, options) {
89095
+ const hints = [];
89096
+ if (result.health?.state === "degraded" || result.health?.state === "outage") {
89097
+ hints.push(
89098
+ options.surface === "agent" ? `Recent checks show ${result.health.state}; find another API with: ${renderAction(options.surface, "search", {})}` : `Recent checks show ${result.health.state}; retry inspection later with: ${renderAction(options.surface, "inspect", { id: options.ref })}`
89099
+ );
89100
+ }
89101
+ if (typeof result.payment?.protocol === "string") {
89102
+ hints.push(
89103
+ `This payment protocol is not supported; find another API with: ${renderAction(options.surface, "search", {})}`
89104
+ );
89105
+ return hints;
89106
+ }
89107
+ const query = result.exampleRequest?.query;
89108
+ const hasQuery = query !== void 0 && Object.keys(query).length > 0;
89109
+ const queryInBody = result.method === "GET" || result.method === "HEAD";
89110
+ let body = result.exampleRequest?.body;
89111
+ if (queryInBody && hasQuery) {
89112
+ body = { ...isRecord6(body) ? body : {}, ...query };
89113
+ }
89114
+ if (body === void 0) body = requiredBody(result.requestSchema);
89115
+ if (options.surface === "agent" && !queryInBody && hasQuery) {
89116
+ hints.push(
89117
+ `This example needs URL query parameters; find another API with: ${renderAction(options.surface, "search", {})}`
89118
+ );
89119
+ } else if (options.surface === "agent" && (exactPrice(result.price) === void 0 || result.method === null)) {
89120
+ hints.push(
89121
+ `Find an API with a published price and method: ${renderAction(options.surface, "search", {})}`
89122
+ );
89123
+ } else {
89124
+ const queryUrl = !queryInBody && hasQuery ? new URL(result.url) : void 0;
89125
+ if (queryUrl) {
89126
+ for (const [key2, value] of Object.entries(query)) queryUrl.searchParams.set(key2, value);
89127
+ }
89128
+ const direct = queryUrl !== void 0 || result.network !== void 0 || /^https?:\/\//u.test(options.ref);
89129
+ hints.push(
89130
+ `Pay with: ${renderAction(
89131
+ options.surface,
89132
+ "pay",
89133
+ {
89134
+ ...queryUrl === void 0 ? { id: options.ref } : { url: queryUrl.href },
89135
+ ...!direct && result.name ? { endpoint: result.name } : {},
89136
+ ...direct ? { method: result.method ?? "<method>" } : {},
89137
+ body,
89138
+ ...queryUrl !== void 0 && result.requestContentType !== void 0 ? { contentType: result.requestContentType } : {},
89139
+ ...queryUrl !== void 0 && result.payment?.network !== void 0 ? { network: result.payment.network } : {},
89140
+ ...queryUrl !== void 0 && result.payment?.payTo !== void 0 ? { expectedPayTo: result.payment.payTo } : {}
89141
+ },
89142
+ result.price
89143
+ )}`
89144
+ );
89145
+ }
89146
+ return hints;
89147
+ }
89148
+ function payHints(result, options) {
89149
+ const hints = [];
89150
+ const settlementUnknown2 = result.outcome === "settlement_unknown";
89151
+ if (result.status >= 200 && result.status < 300 && !settlementUnknown2) {
89152
+ if (options.surface === "cli") {
89153
+ hints.push(
89154
+ `Receipt saved; review it with: vapi receipts --limit 1${result.wallet ? ` --account ${shellWord(result.wallet)}` : ""}`
89155
+ );
89156
+ } else if (options.surface === "mcp") {
89157
+ hints.push(
89158
+ `Receipt saved; review it with: receipts.list ${JSON.stringify({ limit: 1, ...result.wallet ? { wallet: result.wallet } : {} })}`
89159
+ );
89160
+ } else if (options.ref) {
89161
+ hints.push(
89162
+ `Review the request contract with: ${renderAction(options.surface, "inspect", { id: options.ref })}`
89163
+ );
89164
+ }
89165
+ return hints;
89166
+ }
89167
+ if (options.ref) {
89168
+ hints.push(
89169
+ `The provider answered ${result.status}; check the request contract with: ${renderAction(options.surface, "inspect", { id: options.ref })}`
89170
+ );
89171
+ }
89172
+ const receiptId = options.receiptId ?? result.receiptId;
89173
+ if ((result.status === 402 || settlementUnknown2) && receiptId && options.surface === "cli") {
89174
+ hints.push(`Check settlement with: vapi pay --resume ${shellWord(receiptId)}`);
89175
+ }
89176
+ return hints;
89177
+ }
89178
+ function renderAction(surface, action, args, price) {
89179
+ if (surface === "agent") {
89180
+ const loopArgs = action === "search" ? { query: "api", network: null, includeOutage: false } : action === "inspect" ? { ref: args.id } : { ref: args.id, body: JSON.stringify(args.body), max_usd: exactPrice(price ?? "") };
89181
+ return `call_${action} ${JSON.stringify(loopArgs)}`;
89182
+ }
89183
+ if (surface === "mcp") return `call.${action} ${JSON.stringify(args)}`;
89184
+ if (action === "search") return "vapi search --include-unverified";
89185
+ const command = `vapi ${action} ${shellWord(args.url ?? args.id ?? "")}`;
89186
+ if (action === "inspect") return command;
89187
+ const endpoint = args.endpoint ? ` --endpoint ${shellWord(args.endpoint)}` : "";
89188
+ const method = args.method ? ` --method ${shellWord(args.method)}` : "";
89189
+ const headers = args.contentType ? ` --content-type ${shellWord(args.contentType)}` : "";
89190
+ const network = args.network ? ` --network ${shellWord(args.network)}` : "";
89191
+ const payee = args.expectedPayTo ? ` --expected-pay-to ${shellWord(args.expectedPayTo)}` : "";
89192
+ return `${command}${endpoint}${method} --body ${shellQuote(args.body === "<json>" ? "<json>" : JSON.stringify(args.body) ?? "<json>")}${headers}${network}${payee}`;
89193
+ }
89194
+ function exactPrice(price) {
89195
+ if (!/^\$(0|[1-9]\d*)(?:\.\d{1,6})?$/u.test(price.trim())) return void 0;
89196
+ const value = Number(price.trim().slice(1));
89197
+ return Number.isFinite(value) ? value : void 0;
89198
+ }
89199
+ function requiredBody(schema) {
89200
+ if (!isRecord6(schema) || !Array.isArray(schema.required)) return "<json>";
89201
+ const names = schema.required.filter((name) => typeof name === "string");
89202
+ return names.length > 0 ? Object.fromEntries(names.map((name) => [name, "<value>"])) : "<json>";
89203
+ }
89204
+ function isRecord6(value) {
89205
+ return typeof value === "object" && value !== null && !Array.isArray(value);
89206
+ }
89207
+ function shellWord(value) {
89208
+ return /^[a-zA-Z0-9_./:@%-]+$/u.test(value) ? value : shellQuote(value);
89209
+ }
89210
+ function shellQuote(value) {
89211
+ return `'${value.replaceAll("'", "'\\''")}'`;
89212
+ }
89213
+
88800
89214
  // ../mcp/src/actions/call.ts
88801
89215
  var MAX_CACHED_MARKETPLACE_REFS = 200;
88802
89216
  var walletArgument = {
@@ -88805,6 +89219,7 @@ var walletArgument = {
88805
89219
  )
88806
89220
  };
88807
89221
  var callToolResultSchema = external_exports.object({
89222
+ hints: external_exports.array(external_exports.string()).max(4),
88808
89223
  wallet: external_exports.string(),
88809
89224
  status: external_exports.number().int(),
88810
89225
  body: external_exports.unknown(),
@@ -88827,6 +89242,7 @@ var callToolResultSchema = external_exports.object({
88827
89242
  }).optional()
88828
89243
  });
88829
89244
  var inspectToolResultSchema = external_exports.object({
89245
+ hints: external_exports.array(external_exports.string()).max(4),
88830
89246
  name: external_exports.string(),
88831
89247
  method: external_exports.string().nullable(),
88832
89248
  url: external_exports.url(),
@@ -88835,13 +89251,17 @@ var inspectToolResultSchema = external_exports.object({
88835
89251
  operationId: external_exports.string().optional(),
88836
89252
  requestContentType: external_exports.string().optional(),
88837
89253
  requestSchema: external_exports.unknown().optional(),
89254
+ responseSchema: discoveryEndpointSchema.shape.responseSchema,
89255
+ exampleRequest: discoveryEndpointSchema.shape.exampleRequest,
88838
89256
  responseContentType: external_exports.string().optional(),
88839
89257
  network: external_exports.string().optional(),
88840
89258
  // Registry-owned listing disclosures, mirrored from call.search.
88841
89259
  group: listingGroupSchema.optional(),
88842
89260
  fee: listingFeeSchema.optional(),
89261
+ feeDisplay: external_exports.string().optional(),
88843
89262
  verification: listingVerificationSchema,
88844
89263
  liveness: listingLivenessSchema.optional(),
89264
+ health: listingHealthSchema.optional().catch(void 0),
88845
89265
  conformance: listingConformanceSchema.optional(),
88846
89266
  identity: listingIdentitySchema.optional(),
88847
89267
  payment: discoveryEndpointSchema.shape.payment.unwrap().nullable()
@@ -88854,6 +89274,9 @@ var callSearchInputSchema = external_exports.object({
88854
89274
  cursor: external_exports.string().trim().min(1).max(4096).optional(),
88855
89275
  includeUnverified: external_exports.boolean().optional().describe(
88856
89276
  "Default results are vAPI-verified listings plus mirrored external catalogs; includeUnverified: true adds unverified self-listed APIs, which passed vAPI's automated x402 probe but were not reviewed."
89277
+ ),
89278
+ includeOutage: external_exports.boolean().optional().describe(
89279
+ "Default results hide listings whose recent health checks show an outage; includeOutage: true shows them."
88857
89280
  )
88858
89281
  });
88859
89282
  var callInspectInputSchema = external_exports.object({
@@ -88878,11 +89301,14 @@ var callPayInputSchema = external_exports.object({
88878
89301
  "Seconds to wait for the paid response. Default: the provider's maxTimeoutSeconds, at most 120."
88879
89302
  )
88880
89303
  });
89304
+ var callSearchOutputSchema = marketplaceDiscoveryPageSchema.extend({
89305
+ hints: external_exports.array(external_exports.string()).max(4)
89306
+ });
88881
89307
  var callSearch = defineAction({
88882
89308
  name: "call.search",
88883
89309
  description: "Search the public vAPI Marketplace for APIs, services, and open requests. API results can be paid locally; other results continue at their web action. Search returns public cards, not request bodies \u2014 use call.inspect before call.pay whenever the request contract is not already known.",
88884
89310
  input: callSearchInputSchema,
88885
- output: marketplaceDiscoveryPageSchema,
89311
+ output: callSearchOutputSchema,
88886
89312
  money: "none",
88887
89313
  grant: "call",
88888
89314
  async run(input2, ctx) {
@@ -88890,7 +89316,13 @@ var callSearch = defineAction({
88890
89316
  if (ctx.caller.run) {
88891
89317
  for (const item of page.items) ctx.caller.run.searchedRefs.add(item.ref);
88892
89318
  }
88893
- return page;
89319
+ return {
89320
+ ...page,
89321
+ hints: searchHints(page, {
89322
+ surface: ctx.caller.surface,
89323
+ ...input2.includeOutage === void 0 ? {} : { includeOutage: input2.includeOutage }
89324
+ })
89325
+ };
88894
89326
  }
88895
89327
  });
88896
89328
  var callInspect = defineAction({
@@ -88903,10 +89335,13 @@ var callInspect = defineAction({
88903
89335
  async run(input2, ctx) {
88904
89336
  const cacheKey2 = inspectionCacheKey(input2);
88905
89337
  const cached2 = ctx.caller.run?.inspected.get(cacheKey2);
88906
- if (cached2) return cached2;
88907
- const result = await ctx.call.inspect(input2);
88908
- ctx.caller.run?.inspected.set(cacheKey2, result);
88909
- return result;
89338
+ const result = cached2 ?? await ctx.call.inspect(input2);
89339
+ if (!cached2) ctx.caller.run?.inspected.set(cacheKey2, result);
89340
+ return {
89341
+ ...result,
89342
+ payment: result.payment ?? null,
89343
+ hints: inspectHints(result, { ref: input2.id, surface: ctx.caller.surface })
89344
+ };
88910
89345
  }
88911
89346
  });
88912
89347
  var callPay = defineAction({
@@ -88917,14 +89352,22 @@ var callPay = defineAction({
88917
89352
  money: "spends",
88918
89353
  grant: "call",
88919
89354
  async run(input2, ctx) {
88920
- return await ctx.call.pay(input2);
89355
+ const result = await ctx.call.pay(input2);
89356
+ return {
89357
+ ...result,
89358
+ hints: payHints(result, {
89359
+ surface: ctx.caller.surface,
89360
+ ...input2.id === void 0 ? {} : { ref: input2.id },
89361
+ ...input2.url === void 0 ? {} : { url: input2.url }
89362
+ })
89363
+ };
88921
89364
  }
88922
89365
  });
88923
89366
  function createCallPort(options) {
88924
89367
  const searchedMarketplaceHits = options.cacheMarketplaceHits ? /* @__PURE__ */ new Map() : void 0;
88925
89368
  return {
88926
89369
  async search(input2) {
88927
- const page = await searchMarketplace(input2, options.config, options.fetchImpl, {
89370
+ const page = await searchMarketplace2(input2, options.config, options.fetchImpl, {
88928
89371
  ...options.searchesPath === void 0 ? {} : { searchesPath: options.searchesPath },
88929
89372
  ...options.notice === void 0 ? {} : { notice: options.notice }
88930
89373
  });
@@ -89381,6 +89824,15 @@ async function checkAction(action, input2, ctx, options = {}) {
89381
89824
  }
89382
89825
  const priceUsd = exactUsdcPrice(listing.price);
89383
89826
  const profile = ctx.caller.profile;
89827
+ if (priceUsd !== null && ctx.caps !== void 0 && priceUsd > ctx.caps.perCallUsd) {
89828
+ throw new SpendCapExceededError({
89829
+ cap: "per_call",
89830
+ amountUsd: listing.price.trim().slice(1),
89831
+ limitUsd: String(ctx.caps.perCallUsd),
89832
+ ...ctx.caps.perDayUsd === void 0 ? {} : { perDayLimitUsd: ctx.caps.perDayUsd },
89833
+ wallet: profile.wallet
89834
+ });
89835
+ }
89384
89836
  const decision = decidePayment({
89385
89837
  ref,
89386
89838
  priceUsd,
@@ -89401,10 +89853,12 @@ async function checkAction(action, input2, ctx, options = {}) {
89401
89853
  }
89402
89854
  const maxUsd = Number(input2.maxPriceUsd);
89403
89855
  if (priceUsd !== null && maxUsd < priceUsd) {
89404
- return {
89405
- kind: "deny",
89406
- reason: `Requested maximum $${maxUsd} is below the listing price $${priceUsd}.`
89407
- };
89856
+ throw new SpendCapExceededError({
89857
+ cap: "max_price",
89858
+ amountUsd: listing.price.trim().slice(1),
89859
+ limitUsd: String(maxUsd),
89860
+ wallet: profile.wallet
89861
+ });
89408
89862
  }
89409
89863
  return { kind: "allow" };
89410
89864
  }
@@ -89947,6 +90401,7 @@ function createAgentRunDeps(input2) {
89947
90401
  config: input2.config,
89948
90402
  home: input2.home,
89949
90403
  chat: input2.chat,
90404
+ searchPage: call2.search,
89950
90405
  async search(query) {
89951
90406
  const page = await call2.search(query);
89952
90407
  const rows = page.items.map((hit) => ({
@@ -89995,7 +90450,10 @@ function createAgentRunDeps(input2) {
89995
90450
  network: result.payment?.network ?? listing?.payment?.network ?? listing?.network ?? ""
89996
90451
  };
89997
90452
  },
89998
- caps: { perCallUsd: Number(input2.spendCaps.perCallAtomic) / 1e6 },
90453
+ caps: {
90454
+ perCallUsd: Number(input2.spendCaps.perCallAtomic) / 1e6,
90455
+ perDayUsd: formatUsdc(BigInt(input2.spendCaps.perDayAtomic))
90456
+ },
89999
90457
  approve: input2.approve,
90000
90458
  ...input2.budget === void 0 ? {} : { budget: input2.budget },
90001
90459
  ...input2.runId === void 0 ? {} : { runId: input2.runId },
@@ -90005,6 +90463,7 @@ function createAgentRunDeps(input2) {
90005
90463
  return {
90006
90464
  ...this,
90007
90465
  search: this.search === dependencies.search ? next.search : this.search,
90466
+ searchPage: this.searchPage !== dependencies.searchPage ? this.searchPage : this.search === dependencies.search ? next.searchPage : void 0,
90008
90467
  inspect: this.inspect === dependencies.inspect ? next.inspect : this.inspect,
90009
90468
  read: this.read === dependencies.read ? next.read : this.read,
90010
90469
  pay: this.pay === dependencies.pay ? next.pay : this.pay,
@@ -90036,7 +90495,11 @@ var loopSearchResultSchema = external_exports.array(
90036
90495
  description: external_exports.string().optional()
90037
90496
  })
90038
90497
  );
90039
- var loopPayResultSchema = external_exports.object({ status: external_exports.number(), body: external_exports.unknown() });
90498
+ var loopPayResultSchema = external_exports.object({
90499
+ status: external_exports.number(),
90500
+ body: external_exports.unknown(),
90501
+ hints: external_exports.array(external_exports.string()).max(4)
90502
+ });
90040
90503
  var LOOP_BINDINGS = {
90041
90504
  "call.search": {
90042
90505
  description: "Search vAPI Call listings available to this agent. Set network to null to search every network, or to a CAIP-2 id such as eip155:8453 (Base) or eip155:5042 (Arc).",
@@ -90044,26 +90507,33 @@ var LOOP_BINDINGS = {
90044
90507
  type: "object",
90045
90508
  properties: {
90046
90509
  query: { type: "string" },
90047
- network: { type: ["string", "null"] }
90510
+ network: { type: ["string", "null"] },
90511
+ includeOutage: { type: ["boolean", "null"] }
90048
90512
  },
90049
- required: ["query", "network"],
90513
+ required: ["query", "network", "includeOutage"],
90050
90514
  additionalProperties: false
90051
90515
  },
90052
- output: loopSearchResultSchema,
90516
+ output: external_exports.union([callSearchOutputSchema, loopSearchResultSchema]),
90053
90517
  summary: "Search completed.",
90054
90518
  parseArguments(value, deps) {
90055
90519
  const args = parseObjectArgs(value);
90056
90520
  const query = requiredString2(args, "query");
90057
90521
  const network = searchNetwork(nullableString(args, "network"));
90522
+ const includeOutage = args.includeOutage;
90523
+ if (includeOutage !== void 0 && includeOutage !== null && typeof includeOutage !== "boolean") {
90524
+ throw new ToolInputError("includeOutage must be a boolean or null.");
90525
+ }
90058
90526
  return {
90059
90527
  query,
90060
90528
  ...network === null ? {} : { network },
90061
- includeUnverified: !deps.profile.verifiedOnly
90529
+ includeUnverified: !deps.profile.verifiedOnly,
90530
+ ...includeOutage == null ? {} : { includeOutage }
90062
90531
  };
90063
90532
  },
90064
90533
  async run(input2, ctx, execution) {
90065
- const search = input2;
90066
- const rows = await execution.deps.search(search);
90534
+ const search2 = input2;
90535
+ if (execution.deps.searchPage) return await callSearch.run(search2, ctx);
90536
+ const rows = await execution.deps.search(search2);
90067
90537
  for (const row of rows) ctx.caller.run?.searchedRefs.add(row.ref);
90068
90538
  return rows;
90069
90539
  }
@@ -90082,14 +90552,8 @@ var LOOP_BINDINGS = {
90082
90552
  const args = parseObjectArgs(value);
90083
90553
  return { id: requiredString2(args, "ref") };
90084
90554
  },
90085
- async run(input2, ctx, execution) {
90086
- const { id: id2 } = input2;
90087
- const cacheKey2 = inspectionCacheKey({ id: id2 });
90088
- const cached2 = ctx.caller.run?.inspected.get(cacheKey2);
90089
- if (cached2) return cached2;
90090
- const result = await execution.deps.inspect(id2);
90091
- ctx.caller.run?.inspected.set(cacheKey2, result);
90092
- return result;
90555
+ async run(input2, ctx) {
90556
+ return await callInspect.run(input2, ctx);
90093
90557
  }
90094
90558
  },
90095
90559
  "call.pay": {
@@ -90134,7 +90598,8 @@ var LOOP_BINDINGS = {
90134
90598
  }
90135
90599
  return {
90136
90600
  status: execution.payment.status,
90137
- body: execution.payment.body
90601
+ body: execution.payment.body,
90602
+ hints: payHints(execution.payment, { ref: id2, surface: ctx.caller.surface })
90138
90603
  };
90139
90604
  }
90140
90605
  },
@@ -90284,7 +90749,8 @@ async function runAgent(task, deps) {
90284
90749
  config: deps.config,
90285
90750
  clock: deps.now ?? (() => /* @__PURE__ */ new Date()),
90286
90751
  call: {
90287
- async search() {
90752
+ async search(input2) {
90753
+ if (runDeps.searchPage) return await runDeps.searchPage(input2);
90288
90754
  throw new Error("The agent loop uses its reduced search binding.");
90289
90755
  },
90290
90756
  async inspect({ id: id2 }) {
@@ -90429,6 +90895,18 @@ ${UNTRUSTED_NOTICE}` },
90429
90895
  fatalDetail: "The local audit log could not be written."
90430
90896
  };
90431
90897
  }
90898
+ if (error61 instanceof SpendCapExceededError) {
90899
+ const ref2 = paymentRef(input2);
90900
+ const reason = callRunBudgetReason(error61, runDeps.budget) ?? callBudgetReason(error61);
90901
+ if (ref2 !== void 0 && reason !== void 0) {
90902
+ const outcome = await declineSafely(ref2, reason);
90903
+ return outcome.fatalDetail === void 0 ? {
90904
+ ...outcome,
90905
+ fatalDetail: reason,
90906
+ ...error61.cap === "run_budget" ? { fatalReason: "run_budget" } : {}
90907
+ } : outcome;
90908
+ }
90909
+ }
90432
90910
  if (error61 instanceof ActionDeclinedError) {
90433
90911
  const declinedRef = actionDeclineRef(action, input2);
90434
90912
  if (declinedRef !== void 0) {
@@ -90446,7 +90924,8 @@ ${UNTRUSTED_NOTICE}` },
90446
90924
  }
90447
90925
  const runBudgetReason = callRunBudgetReason(error61.paymentError, runDeps.budget);
90448
90926
  if (runBudgetReason !== void 0) {
90449
- return await declineSafely(ref, runBudgetReason);
90927
+ const outcome = await declineSafely(ref, runBudgetReason);
90928
+ return spendCap(error61.paymentError) === "run_budget" ? { ...outcome, fatalDetail: runBudgetReason, fatalReason: "run_budget" } : outcome;
90450
90929
  }
90451
90930
  const spendBudgetReason = callBudgetReason(error61.paymentError);
90452
90931
  if (spendBudgetReason !== void 0) {
@@ -90468,7 +90947,7 @@ ${UNTRUSTED_NOTICE}` },
90468
90947
  try {
90469
90948
  reply = await deps.chat({ model: profile.model, messages, tools, tool_choice: "auto" });
90470
90949
  } catch (error61) {
90471
- if (error61 instanceof RunBudgetError || hasErrorCode(error61, "run_budget_exceeded")) {
90950
+ if (error61 instanceof RunBudgetError || hasErrorCode(error61, "run_budget_exceeded") || spendCap(error61) === "run_budget") {
90472
90951
  return await stop("run_budget", runBudgetDetail(runDeps.budget));
90473
90952
  }
90474
90953
  if (hasErrorCode(error61, "budget_exhausted")) {
@@ -90515,7 +90994,9 @@ ${UNTRUSTED_NOTICE}` },
90515
90994
  name: call2.name,
90516
90995
  summary: toolSummary(call2.name, loopActions)
90517
90996
  });
90518
- if (outcome.fatalDetail) return await stop("error", outcome.fatalDetail);
90997
+ if (outcome.fatalDetail) {
90998
+ return await stop(outcome.fatalReason ?? "error", outcome.fatalDetail);
90999
+ }
90519
91000
  }
90520
91001
  }
90521
91002
  return await stop("max_steps");
@@ -90608,6 +91089,14 @@ function hasErrorCode(error61, code) {
90608
91089
  return typeof error61 === "object" && error61 !== null && typeof Reflect.get(error61, "code") === "string" && Reflect.get(error61, "code") === code;
90609
91090
  }
90610
91091
  function callBudgetReason(error61) {
91092
+ const cap = spendCap(error61);
91093
+ if (cap !== void 0) {
91094
+ if (cap === "per_call") return "This wallet's per-call Call budget is exhausted.";
91095
+ if (cap === "per_day") return "This wallet's daily Call budget is exhausted.";
91096
+ if (cap === "max_price") return "This call exceeds its maximum price.";
91097
+ if (cap === "max_amount") return "This payment exceeds its maximum amount.";
91098
+ return void 0;
91099
+ }
90611
91100
  if (hasErrorCode(error61, "per_call_cap_exceeded")) {
90612
91101
  return "This wallet's per-call Call budget is exhausted.";
90613
91102
  }
@@ -90617,11 +91106,17 @@ function callBudgetReason(error61) {
90617
91106
  return void 0;
90618
91107
  }
90619
91108
  function callRunBudgetReason(error61, budget) {
90620
- if (!(error61 instanceof RunBudgetError) && !hasErrorCode(error61, "run_budget_exceeded")) {
91109
+ if (!(error61 instanceof RunBudgetError) && spendCap(error61) !== "run_budget" && !hasErrorCode(error61, "run_budget_exceeded")) {
90621
91110
  return void 0;
90622
91111
  }
90623
91112
  return budget === void 0 ? "The run budget is spent; this call was not paid." : `The run budget of $${formatUsdc(budget.limitAtomic)} is spent; this call was not paid.`;
90624
91113
  }
91114
+ function spendCap(error61) {
91115
+ if (error61 instanceof SpendCapExceededError) return error61.cap;
91116
+ if (!hasErrorCode(error61, "spend_cap_exceeded")) return void 0;
91117
+ const cap = Reflect.get(error61, "cap");
91118
+ return cap === "per_call" || cap === "per_day" || cap === "max_price" || cap === "max_amount" || cap === "run_budget" ? cap : void 0;
91119
+ }
90625
91120
  function runBudgetDetail(budget) {
90626
91121
  return budget === void 0 ? "The run budget is spent." : `The run budget of $${formatUsdc(budget.limitAtomic)} is spent.`;
90627
91122
  }
@@ -93461,6 +93956,106 @@ function createDocsTools(options) {
93461
93956
  };
93462
93957
  }
93463
93958
 
93959
+ // ../mcp/src/tool-presentation.ts
93960
+ var SERVER_ICONS = [
93961
+ {
93962
+ src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-light.png",
93963
+ mimeType: "image/png",
93964
+ sizes: ["1024x1024"],
93965
+ theme: "light"
93966
+ },
93967
+ {
93968
+ src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-dark.png",
93969
+ mimeType: "image/png",
93970
+ sizes: ["1024x1024"],
93971
+ theme: "dark"
93972
+ }
93973
+ ];
93974
+ var readOnly = {
93975
+ readOnlyHint: true,
93976
+ destructiveHint: false,
93977
+ idempotentHint: true,
93978
+ openWorldHint: false
93979
+ };
93980
+ var write = {
93981
+ readOnlyHint: false,
93982
+ destructiveHint: false,
93983
+ idempotentHint: false,
93984
+ openWorldHint: false
93985
+ };
93986
+ var destructive = { ...write, destructiveHint: true };
93987
+ var search = { ...readOnly, openWorldHint: true };
93988
+ var TOOL_PRESENTATION = {
93989
+ "docs.search": { title: "Search the vAPI docs", annotations: readOnly },
93990
+ "docs.read": { title: "Read a vAPI docs page", annotations: readOnly },
93991
+ "auth.link": {
93992
+ title: "Link this account to the vAPI dashboard",
93993
+ annotations: { ...write, idempotentHint: true }
93994
+ },
93995
+ "auth.status": { title: "Check the dashboard link", annotations: readOnly },
93996
+ "router.models": { title: "List Router models", annotations: readOnly },
93997
+ "router.usage": { title: "Show Router usage", annotations: readOnly },
93998
+ "router.chat": { title: "Chat through the vAPI Router", annotations: destructive },
93999
+ "router.buy": { title: "Buy Router balance", annotations: destructive },
94000
+ "tasks.search": { title: "Browse tasks", annotations: readOnly },
94001
+ "tasks.show": { title: "Show a task", annotations: readOnly },
94002
+ "tasks.post": { title: "Post a task", annotations: write },
94003
+ "tasks.propose": { title: "Propose on a task", annotations: write },
94004
+ "tasks.submit": { title: "Submit a proposal", annotations: write },
94005
+ "tasks.award": { title: "Award a task", annotations: write },
94006
+ "tasks.sign": { title: "Sign a task step", annotations: destructive },
94007
+ "tasks.fund": { title: "Fund escrow", annotations: destructive },
94008
+ "tasks.deliver": { title: "Deliver work", annotations: write },
94009
+ "tasks.release": { title: "Release escrow", annotations: destructive },
94010
+ "tasks.refund": { title: "Refund escrow", annotations: destructive },
94011
+ "tasks.dispute": { title: "Open a dispute", annotations: destructive },
94012
+ "tasks.counter-evidence": { title: "Add counter-evidence", annotations: write },
94013
+ "tasks.resolve-unmatched": { title: "Resolve an unmatched escrow", annotations: destructive },
94014
+ "tasks.message": { title: "Message a task thread", annotations: write },
94015
+ "tasks.thread": { title: "Read a task thread", annotations: readOnly },
94016
+ "tasks.watch": { title: "Watch a task", annotations: readOnly },
94017
+ "tasks.status": { title: "Check a task's chain status", annotations: readOnly },
94018
+ "vapi.status": { title: "Show the vAPI status screen", annotations: readOnly },
94019
+ "vapi.accounts": { title: "List vAPI accounts", annotations: readOnly },
94020
+ "vapi.siblings": { title: "List sibling agents", annotations: readOnly },
94021
+ "accounts.add": { title: "Add a local account", annotations: write },
94022
+ "accounts.caps": { title: "Lower an account's spend caps", annotations: write },
94023
+ "accounts.send": { title: "Send USDC from an account", annotations: destructive },
94024
+ "call.search": { title: "Search the vAPI marketplace", annotations: search },
94025
+ search: { title: "Search the vAPI marketplace (deprecated)", annotations: search },
94026
+ "call.inspect": { title: "Inspect a Call listing", annotations: readOnly },
94027
+ inspect: { title: "Inspect a Call listing (deprecated)", annotations: readOnly },
94028
+ "call.pay": { title: "Pay an x402 API", annotations: destructive },
94029
+ call: { title: "Pay an x402 API (deprecated)", annotations: destructive },
94030
+ "call.read": { title: "Read a paid origin", annotations: readOnly },
94031
+ "wallet.address": { title: "Show the account address", annotations: readOnly },
94032
+ "wallet.balance": { title: "Show the account balance", annotations: readOnly },
94033
+ "wallet.accounts": { title: "Show the account's addresses", annotations: readOnly },
94034
+ "wallet.list": { title: "List local accounts", annotations: readOnly },
94035
+ "wallet.use": { title: "Switch the active account", annotations: write },
94036
+ "wallet.fund": { title: "Fund the account", annotations: destructive },
94037
+ wallet: { title: "Show the account balance (deprecated)", annotations: readOnly },
94038
+ "receipts.list": { title: "List payment receipts", annotations: readOnly },
94039
+ "receipts.stats": { title: "Show receipt statistics", annotations: readOnly },
94040
+ "support.report": { title: "Create a local support report", annotations: write },
94041
+ "swarm.setup": { title: "Set up a swarm", annotations: write },
94042
+ "swarm.add": { title: "Add a swarm member", annotations: write },
94043
+ "swarm.leave": { title: "Leave a swarm", annotations: write },
94044
+ "swarm.fund": { title: "Fund a swarm", annotations: destructive },
94045
+ "swarm.rebalance": { title: "Rebalance a swarm", annotations: destructive },
94046
+ "swarm.status": { title: "Show swarm status", annotations: readOnly },
94047
+ "swarm.dissolve": { title: "Dissolve a swarm", annotations: destructive },
94048
+ "swarm.run": { title: "Run a swarm", annotations: destructive },
94049
+ "swarm.allocate": { title: "Allocate swarm budget", annotations: destructive },
94050
+ "swarm.delegate": { title: "Delegate a swarm task", annotations: destructive },
94051
+ "swarm.runs": { title: "List swarm runs", annotations: readOnly }
94052
+ };
94053
+ function withPresentation(tool) {
94054
+ const presentation = Object.hasOwn(TOOL_PRESENTATION, tool.name) ? TOOL_PRESENTATION[tool.name] : void 0;
94055
+ if (!presentation) throw new Error(`no presentation for tool ${tool.name}`);
94056
+ return { ...tool, ...presentation };
94057
+ }
94058
+
93464
94059
  // ../mcp/src/wallet-session.ts
93465
94060
  var WalletSession = class {
93466
94061
  constructor(options) {
@@ -93689,6 +94284,99 @@ var WalletSession = class {
93689
94284
  }
93690
94285
  };
93691
94286
 
94287
+ // ../mcp/src/views.ts
94288
+ var searchView = { view: "call-search", uri: "ui://vapi/call-search.html" };
94289
+ var inspectView = { view: "call-inspect", uri: "ui://vapi/call-inspect.html" };
94290
+ var MCP_APP_VIEWS = {
94291
+ "call.search": searchView,
94292
+ "call.inspect": inspectView,
94293
+ search: searchView,
94294
+ inspect: inspectView
94295
+ };
94296
+ var VIEW_RESOURCE_META = {
94297
+ "call-search": {
94298
+ title: "vAPI marketplace results",
94299
+ description: "Interactive list of Call listings returned by call.search."
94300
+ },
94301
+ "call-inspect": {
94302
+ title: "vAPI listing inspector",
94303
+ description: "Interactive request contract and price for one Call listing."
94304
+ }
94305
+ };
94306
+ function createViewLoader(options) {
94307
+ const origin = new URL(options.registryUrl).origin;
94308
+ const timeoutMs = options.timeoutMs ?? 2e3;
94309
+ const log = options.log ?? ((line) => process.stderr.write(`${line}
94310
+ `));
94311
+ const cache = /* @__PURE__ */ new Map();
94312
+ const inFlight = /* @__PURE__ */ new Map();
94313
+ const logged = /* @__PURE__ */ new Set();
94314
+ async function fetchHtml(view) {
94315
+ const url2 = `${origin}/mcp/apps/${view}.html`;
94316
+ const controller = new AbortController();
94317
+ let timer;
94318
+ const timedOut = new Promise((_resolve, reject) => {
94319
+ timer = setTimeout(() => {
94320
+ const error61 = new Error(`timed out after ${timeoutMs} ms`);
94321
+ reject(error61);
94322
+ controller.abort(error61);
94323
+ }, timeoutMs);
94324
+ });
94325
+ try {
94326
+ return await Promise.race([
94327
+ (async () => {
94328
+ const response = await options.fetchImpl(url2, {
94329
+ signal: controller.signal,
94330
+ redirect: "manual"
94331
+ });
94332
+ if (response.status !== 200) {
94333
+ void response.body?.cancel().catch(() => {
94334
+ });
94335
+ throw new Error(`HTTP ${response.status}`);
94336
+ }
94337
+ return await response.text();
94338
+ })(),
94339
+ timedOut
94340
+ ]);
94341
+ } catch (error61) {
94342
+ if (!logged.has(view)) {
94343
+ logged.add(view);
94344
+ const reason = (error61 instanceof Error ? error61.message : String(error61)).replace(
94345
+ /[\r\n\u2028\u2029]+/gu,
94346
+ " "
94347
+ );
94348
+ try {
94349
+ log(`vapi mcp: could not load view ${view} from ${url2}: ${reason}`);
94350
+ } catch {
94351
+ }
94352
+ }
94353
+ return void 0;
94354
+ } finally {
94355
+ if (timer !== void 0) clearTimeout(timer);
94356
+ }
94357
+ }
94358
+ function load(view) {
94359
+ const html = cache.get(view);
94360
+ if (html !== void 0) return Promise.resolve(html);
94361
+ const pending = inFlight.get(view);
94362
+ if (pending) return pending;
94363
+ const request = fetchHtml(view).then((html2) => {
94364
+ if (html2 !== void 0) cache.set(view, html2);
94365
+ return html2;
94366
+ }).finally(() => inFlight.delete(view));
94367
+ inFlight.set(view, request);
94368
+ return request;
94369
+ }
94370
+ return {
94371
+ origin,
94372
+ load,
94373
+ get: (view) => cache.get(view),
94374
+ async warm() {
94375
+ await Promise.allSettled([load("call-search"), load("call-inspect")]);
94376
+ }
94377
+ };
94378
+ }
94379
+
93692
94380
  // ../mcp/src/server.ts
93693
94381
  var allWalletsArgument = {
93694
94382
  allWallets: external_exports.boolean().optional().describe("Read every account's rows instead of one account's.")
@@ -93829,16 +94517,50 @@ function objectOutputSchema(schema) {
93829
94517
  const json2 = external_exports.toJSONSchema(schema);
93830
94518
  return json2.type === "object" ? { outputSchema: json2 } : {};
93831
94519
  }
94520
+ function appViewForTool(name) {
94521
+ return Object.hasOwn(MCP_APP_VIEWS, name) ? MCP_APP_VIEWS[name] : void 0;
94522
+ }
94523
+ function appViewResource({ view, uri }, origin) {
94524
+ return {
94525
+ uri,
94526
+ name: `vapi-${view}`,
94527
+ ...VIEW_RESOURCE_META[view],
94528
+ mimeType: "text/html;profile=mcp-app",
94529
+ _meta: {
94530
+ ui: {
94531
+ csp: {
94532
+ connectDomains: [origin],
94533
+ resourceDomains: ["https://assets.claude.ai", origin]
94534
+ },
94535
+ prefersBorder: view === "call-inspect"
94536
+ }
94537
+ }
94538
+ };
94539
+ }
93832
94540
  var VapiMcpServer = class {
93833
94541
  #tools = /* @__PURE__ */ new Map();
93834
94542
  #onClose;
93835
94543
  #stdio;
94544
+ #views;
94545
+ #viewSequence = 0;
93836
94546
  constructor(onClose) {
93837
94547
  this.#onClose = onClose;
93838
94548
  }
94549
+ useViews(loader) {
94550
+ this.#views = loader;
94551
+ }
94552
+ #resources() {
94553
+ const loader = this.#views;
94554
+ return loader ? [MCP_APP_VIEWS["call.search"], MCP_APP_VIEWS["call.inspect"]].map(
94555
+ (view) => appViewResource(view, loader.origin)
94556
+ ) : [];
94557
+ }
93839
94558
  registerTool(name, definition, handler) {
94559
+ const presentation = definition.title !== void 0 && definition.annotations !== void 0 ? { title: definition.title, annotations: definition.annotations } : withPresentation({ name, ...definition });
93840
94560
  const inputSchema = definition.strictInput ? external_exports.strictObject(definition.inputSchema) : external_exports.object(definition.inputSchema);
93841
94561
  this.#tools.set(name, {
94562
+ title: presentation.title,
94563
+ annotations: presentation.annotations,
93842
94564
  ...definition.description ? { description: definition.description } : {},
93843
94565
  ...definition.deprecatedReplacement ? { deprecatedReplacement: definition.deprecatedReplacement } : {},
93844
94566
  inputSchema,
@@ -93848,12 +94570,19 @@ var VapiMcpServer = class {
93848
94570
  }
93849
94571
  async listTools() {
93850
94572
  return {
93851
- tools: [...this.#tools].map(([name, tool]) => ({
93852
- name,
93853
- ...tool.description ? { description: tool.description } : {},
93854
- inputSchema: external_exports.toJSONSchema(tool.inputSchema),
93855
- ...objectOutputSchema(tool.outputSchema)
93856
- }))
94573
+ tools: [...this.#tools].map(([name, tool]) => {
94574
+ const view = appViewForTool(name);
94575
+ const uri = view && this.#views?.get(view.view) !== void 0 ? view.uri : void 0;
94576
+ return {
94577
+ name,
94578
+ title: tool.title,
94579
+ annotations: tool.annotations,
94580
+ ...tool.description ? { description: tool.description } : {},
94581
+ inputSchema: external_exports.toJSONSchema(tool.inputSchema),
94582
+ ...objectOutputSchema(tool.outputSchema),
94583
+ ...uri === void 0 ? {} : { _meta: { ui: { resourceUri: uri }, "ui/resourceUri": uri } }
94584
+ };
94585
+ })
93857
94586
  };
93858
94587
  }
93859
94588
  async callTool(request) {
@@ -93865,7 +94594,16 @@ var VapiMcpServer = class {
93865
94594
  };
93866
94595
  }
93867
94596
  try {
93868
- const result = await tool.handler(request.arguments ?? {});
94597
+ let result = await tool.handler(request.arguments ?? {});
94598
+ if (!result.isError && appViewForTool(request.name)) {
94599
+ result = {
94600
+ ...result,
94601
+ structuredContent: {
94602
+ ...result.structuredContent,
94603
+ _view: { createdAt: Date.now(), seq: ++this.#viewSequence }
94604
+ }
94605
+ };
94606
+ }
93869
94607
  return tool.deprecatedReplacement ? withDeprecation(result, tool.deprecatedReplacement) : result;
93870
94608
  } catch (error61) {
93871
94609
  const result = request.name.startsWith("tasks.") ? tasksErrorResult(error61) : toolError(error61);
@@ -93897,17 +94635,44 @@ var VapiMcpServer = class {
93897
94635
  this.#write({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } });
93898
94636
  return;
93899
94637
  }
94638
+ const response = await this.handleRequest(request);
94639
+ if (response !== void 0) this.#write(response);
94640
+ }
94641
+ async handleRequest(request) {
93900
94642
  const id2 = request.id;
93901
94643
  const method = request.method;
93902
94644
  if (typeof method !== "string" || id2 === void 0) return;
93903
94645
  try {
93904
94646
  let result;
93905
94647
  if (method === "initialize") {
94648
+ await this.#views?.warm();
93906
94649
  const params = asRecord2(request.params);
93907
94650
  result = {
93908
94651
  protocolVersion: typeof params?.protocolVersion === "string" ? params.protocolVersion : "2025-11-25",
93909
- capabilities: { tools: {} },
93910
- serverInfo: { name: "@vapi-network/mcp", version: VAPI_CLIENT_VERSION }
94652
+ capabilities: { tools: {}, ...this.#views ? { resources: {} } : {} },
94653
+ serverInfo: {
94654
+ name: "@vapi-network/mcp",
94655
+ title: "vAPI Network",
94656
+ version: VAPI_CLIENT_VERSION,
94657
+ websiteUrl: "https://vapinetwork.ai",
94658
+ icons: SERVER_ICONS
94659
+ }
94660
+ };
94661
+ } else if (method === "resources/list") {
94662
+ result = { resources: this.#resources() };
94663
+ } else if (method === "resources/read") {
94664
+ const params = asRecord2(request.params);
94665
+ const view = Object.values(MCP_APP_VIEWS).find((view2) => view2.uri === params?.uri);
94666
+ if (!this.#views || !view) {
94667
+ return { jsonrpc: "2.0", id: id2, error: { code: -32002, message: "resource not found" } };
94668
+ }
94669
+ const html = await this.#views.load(view.view);
94670
+ if (html === void 0) throw new Error(`view ${view.view} is unavailable`);
94671
+ const resource = appViewResource(view, this.#views.origin);
94672
+ result = {
94673
+ contents: [
94674
+ { uri: resource.uri, mimeType: resource.mimeType, text: html, _meta: resource._meta }
94675
+ ]
93911
94676
  };
93912
94677
  } else if (method === "tools/list") {
93913
94678
  result = await this.listTools();
@@ -93920,20 +94685,19 @@ var VapiMcpServer = class {
93920
94685
  } else if (method === "ping") {
93921
94686
  result = {};
93922
94687
  } else {
93923
- this.#write({
94688
+ return {
93924
94689
  jsonrpc: "2.0",
93925
94690
  id: id2,
93926
94691
  error: { code: -32601, message: `Method not found: ${method}` }
93927
- });
93928
- return;
94692
+ };
93929
94693
  }
93930
- this.#write({ jsonrpc: "2.0", id: id2, result });
94694
+ return { jsonrpc: "2.0", id: id2, result };
93931
94695
  } catch (error61) {
93932
- this.#write({
94696
+ return {
93933
94697
  jsonrpc: "2.0",
93934
94698
  id: id2,
93935
94699
  error: { code: -32603, message: error61 instanceof Error ? error61.message : String(error61) }
93936
- });
94700
+ };
93937
94701
  }
93938
94702
  }
93939
94703
  #write(message) {
@@ -93972,6 +94736,7 @@ function createVapiServer(options = {}) {
93972
94736
  });
93973
94737
  const guardedFetch2 = options.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: config2.allowPrivateNetwork ?? false });
93974
94738
  const apiBase = options.agentLink?.apiBase ?? agentApiBase(config2, options.env);
94739
+ server.useViews(createViewLoader({ registryUrl: apiBase, fetchImpl: guardedFetch2 }));
93975
94740
  const auth = createAuthTools({
93976
94741
  session,
93977
94742
  secrets,
@@ -94348,7 +95113,9 @@ function createVapiServer(options = {}) {
94348
95113
  const tool = {
94349
95114
  description: action.description,
94350
95115
  inputSchema: action.input.shape,
94351
- outputSchema: action.output
95116
+ outputSchema: appViewForTool(action.name) && action.output instanceof external_exports.ZodObject ? action.output.extend({
95117
+ _view: external_exports.object({ createdAt: external_exports.number(), seq: external_exports.number().int() }).optional()
95118
+ }) : action.output
94352
95119
  };
94353
95120
  const handler = async (input2) => asStructuredToolResult(() => runAction(registeredAction, input2, actionContext));
94354
95121
  server.registerTool(action.name, tool, handler);
@@ -94719,7 +95486,8 @@ async function startStdioServer(options) {
94719
95486
  return server;
94720
95487
  }
94721
95488
  function toolError(error61) {
94722
- const text = error61 instanceof VapiCallError ? JSON.stringify(
95489
+ const spendCapError = serializeSpendCapError(error61);
95490
+ const text = spendCapError !== void 0 ? JSON.stringify(spendCapError, null, 2) : error61 instanceof VapiCallError ? JSON.stringify(
94723
95491
  {
94724
95492
  error: error61.message,
94725
95493
  code: error61.code,
@@ -94741,6 +95509,29 @@ function toolError(error61) {
94741
95509
  content: [{ type: "text", text }]
94742
95510
  };
94743
95511
  }
95512
+ function serializeSpendCapError(error61) {
95513
+ const record2 = asRecord2(error61);
95514
+ if (!(error61 instanceof SpendCapExceededError) && (record2 === void 0 || record2.code !== "spend_cap_exceeded")) {
95515
+ return void 0;
95516
+ }
95517
+ const value = error61;
95518
+ if (typeof value.amountUsd !== "string" || typeof value.limitUsd !== "string") return void 0;
95519
+ if (value.cap !== "per_call" && value.cap !== "per_day" && value.cap !== "max_price" && value.cap !== "max_amount" && value.cap !== "run_budget") {
95520
+ return void 0;
95521
+ }
95522
+ const message = typeof value.message === "string" ? value.message : "A spend cap was exceeded.";
95523
+ return {
95524
+ error: message,
95525
+ code: "spend_cap_exceeded",
95526
+ cap: value.cap,
95527
+ amountUsd: value.amountUsd,
95528
+ limitUsd: value.limitUsd,
95529
+ ...typeof value.spentUsd === "string" ? { spentUsd: value.spentUsd } : {},
95530
+ ...typeof value.wallet === "string" ? { wallet: value.wallet } : {},
95531
+ command: typeof value.command === "string" ? value.command : null,
95532
+ retryable: false
95533
+ };
95534
+ }
94744
95535
  function asRecord2(value) {
94745
95536
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
94746
95537
  }
@@ -94979,12 +95770,6 @@ function createListingsClient(options) {
94979
95770
  query: { wallet }
94980
95771
  });
94981
95772
  },
94982
- async splitters(wallet) {
94983
- return await call2("/api/call/listings/splitters", {
94984
- method: "GET",
94985
- query: { wallet }
94986
- });
94987
- },
94988
95773
  async create(input2) {
94989
95774
  return await call2("/api/call/listings", { method: "POST", body: input2 });
94990
95775
  },
@@ -95058,11 +95843,11 @@ function readProbeOperations(probe) {
95058
95843
  return isOperation(probe.endpoint) ? [probe.endpoint] : [];
95059
95844
  }
95060
95845
  function isOperation(operation) {
95061
- return isRecord6(operation) && typeof operation.name === "string" && operation.name.length > 0;
95846
+ return isRecord7(operation) && typeof operation.name === "string" && operation.name.length > 0;
95062
95847
  }
95063
95848
  function readProbeRejection(probe) {
95064
95849
  const rejection = probe.diagnostics?.rejection;
95065
- return isRecord6(rejection) ? rejection : void 0;
95850
+ return isRecord7(rejection) ? rejection : void 0;
95066
95851
  }
95067
95852
  function formatProbeSteps(probe) {
95068
95853
  const steps = probe.diagnostics?.steps;
@@ -95071,7 +95856,7 @@ function formatProbeSteps(probe) {
95071
95856
  }
95072
95857
  function formatProbeStep(step2) {
95073
95858
  if (typeof step2 === "string") return step2;
95074
- if (!isRecord6(step2)) return JSON.stringify(step2);
95859
+ if (!isRecord7(step2)) return JSON.stringify(step2);
95075
95860
  const label = asString(step2.name) ?? asString(step2.step) ?? asString(step2.label) ?? "step";
95076
95861
  const outcome = asString(step2.status) ?? asString(step2.outcome) ?? asString(step2.result) ?? (typeof step2.ok === "boolean" ? step2.ok ? "ok" : "failed" : void 0);
95077
95862
  const detail = asString(step2.detail) ?? asString(step2.message) ?? asString(step2.description);
@@ -95137,19 +95922,19 @@ async function readJson(response) {
95137
95922
  }
95138
95923
  function readErrorMessage(body) {
95139
95924
  if (typeof body === "string") return body.trim() || void 0;
95140
- if (!isRecord6(body)) return void 0;
95925
+ if (!isRecord7(body)) return void 0;
95141
95926
  const error61 = body.error;
95142
- if (isRecord6(error61)) return asString(error61.message) ?? asString(error61.code);
95927
+ if (isRecord7(error61)) return asString(error61.message) ?? asString(error61.code);
95143
95928
  return asString(body.message) ?? asString(body.error) ?? asString(body.detail);
95144
95929
  }
95145
95930
  function readErrorIssues(body) {
95146
- if (!isRecord6(body)) return [];
95931
+ if (!isRecord7(body)) return [];
95147
95932
  const candidates = [body.issues, body.errors, body.details];
95148
95933
  for (const candidate of candidates) {
95149
95934
  if (!Array.isArray(candidate)) continue;
95150
95935
  const issues = candidate.map((issue2) => {
95151
95936
  if (typeof issue2 === "string") return issue2;
95152
- if (!isRecord6(issue2)) return JSON.stringify(issue2);
95937
+ if (!isRecord7(issue2)) return JSON.stringify(issue2);
95153
95938
  const path = Array.isArray(issue2.path) ? issue2.path.join(".") : asString(issue2.path);
95154
95939
  const message = asString(issue2.message) ?? asString(issue2.code) ?? JSON.stringify(issue2);
95155
95940
  return path ? `${path}: ${message}` : message;
@@ -95161,7 +95946,7 @@ function readErrorIssues(body) {
95161
95946
  function asString(value) {
95162
95947
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
95163
95948
  }
95164
- function isRecord6(value) {
95949
+ function isRecord7(value) {
95165
95950
  return typeof value === "object" && value !== null && !Array.isArray(value);
95166
95951
  }
95167
95952
 
@@ -95196,11 +95981,11 @@ function formatIdentityLines(identity) {
95196
95981
  ];
95197
95982
  }
95198
95983
  function parseIdentityResponse(value) {
95199
- if (!isRecord7(value) || typeof value.wallet !== "string" || value.chain !== "eip155:8453") {
95984
+ if (!isRecord8(value) || typeof value.wallet !== "string" || value.chain !== "eip155:8453") {
95200
95985
  return void 0;
95201
95986
  }
95202
95987
  if (value.identity === null) return null;
95203
- if (!isRecord7(value.identity)) return void 0;
95988
+ if (!isRecord8(value.identity)) return void 0;
95204
95989
  const { identity } = value;
95205
95990
  if (typeof identity.erc8004Id !== "string" || identity.erc8004Id.length === 0 || typeof identity.agentCount !== "number" || !Number.isFinite(identity.agentCount) || typeof identity.registry !== "string") {
95206
95991
  return void 0;
@@ -95214,13 +95999,13 @@ function parseIdentityResponse(value) {
95214
95999
  };
95215
96000
  }
95216
96001
  function parseReputation(value) {
95217
- if (!isRecord7(value)) return void 0;
96002
+ if (!isRecord8(value)) return void 0;
95218
96003
  if (typeof value.score !== "number" || !Number.isFinite(value.score) || typeof value.count !== "number" || !Number.isInteger(value.count) || value.count < 0) {
95219
96004
  return void 0;
95220
96005
  }
95221
96006
  return { score: value.score, count: value.count };
95222
96007
  }
95223
- function isRecord7(value) {
96008
+ function isRecord8(value) {
95224
96009
  return typeof value === "object" && value !== null && !Array.isArray(value);
95225
96010
  }
95226
96011
 
@@ -95519,7 +96304,7 @@ async function offerDashboardLink({
95519
96304
  apiBase
95520
96305
  }) {
95521
96306
  const otherHome = resolve2(home) !== resolve2(getVapiPaths().directory);
95522
- const command = `${otherHome ? `VAPI_HOME=${shellQuote(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote(apiBase)} `}vapi login --account ${name}`;
96307
+ const command = `${otherHome ? `VAPI_HOME=${shellQuote2(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote2(apiBase)} `}vapi login --account ${name}`;
95523
96308
  const unlinked = {
95524
96309
  linked: false,
95525
96310
  next: [{ kind: "link", account: name, command }]
@@ -95582,7 +96367,7 @@ async function dashboardCommand(argv, json2, io, dependencies) {
95582
96367
  }
95583
96368
  io.stdout(json2 ? JSON.stringify({ account: target.name, url: url2, ...status, opened }) : url2);
95584
96369
  }
95585
- function shellQuote(value) {
96370
+ function shellQuote2(value) {
95586
96371
  return /^[a-zA-Z0-9_./-]+$/u.test(value) ? value : `'${value.replace(/'/gu, "'\\''")}'`;
95587
96372
  }
95588
96373
 
@@ -96055,7 +96840,7 @@ function buildRelayRestorePayload(options) {
96055
96840
  const owner = normalizedOwner(options.owner);
96056
96841
  assertDevice(options.device);
96057
96842
  assertBytes(options.key, 32);
96058
- if (!isRecord8(options.kdf)) throw new Error();
96843
+ if (!isRecord9(options.kdf)) throw new Error();
96059
96844
  const kdf = parseKdf(options.kdf);
96060
96845
  const parsed = backupPlaintextSchema.safeParse(options.vault);
96061
96846
  if (!parsed.success) throw new Error();
@@ -96077,7 +96862,7 @@ function buildRelayRestorePayload(options) {
96077
96862
  async function exportBackupSource(options) {
96078
96863
  try {
96079
96864
  assertBytes(options.vaultKey, 32);
96080
- if (!isRecord8(options.store) || typeof options.store.home !== "string" || typeof options.store.snapshot !== "function" || typeof options.store.reload !== "function") {
96865
+ if (!isRecord9(options.store) || typeof options.store.home !== "string" || typeof options.store.snapshot !== "function" || typeof options.store.reload !== "function") {
96081
96866
  throw new BackupError("backup_invalid_input");
96082
96867
  }
96083
96868
  const networks = normalizeNetworks(options.networks ?? []);
@@ -96810,7 +97595,7 @@ function prettyJson(value) {
96810
97595
  }
96811
97596
  function parseSealed(sealed) {
96812
97597
  const value = JSON.parse(sealed);
96813
- if (!isRecord8(value) || !hasExactKeys(value, RELAY_KEYS) || value.format !== RELAY_FORMAT || value.v !== RELAY_VERSION || typeof value.epk !== "string" || typeof value.nonce !== "string" || typeof value.ciphertext !== "string" || decodeBase64Url(value.epk)?.byteLength !== 32 || decodeBase64Url(value.nonce)?.byteLength !== 12 || (decodeBase64Url(value.ciphertext)?.byteLength ?? 0) < 16) {
97598
+ if (!isRecord9(value) || !hasExactKeys(value, RELAY_KEYS) || value.format !== RELAY_FORMAT || value.v !== RELAY_VERSION || typeof value.epk !== "string" || typeof value.nonce !== "string" || typeof value.ciphertext !== "string" || decodeBase64Url(value.epk)?.byteLength !== 32 || decodeBase64Url(value.nonce)?.byteLength !== 12 || (decodeBase64Url(value.ciphertext)?.byteLength ?? 0) < 16) {
96814
97599
  throw new Error();
96815
97600
  }
96816
97601
  return { epk: value.epk, nonce: value.nonce, ciphertext: value.ciphertext };
@@ -96977,13 +97762,13 @@ async function pathExists4(path) {
96977
97762
  }
96978
97763
  }
96979
97764
  function isMissingFile4(error61) {
96980
- return isErrorCode(error61, "ENOENT");
97765
+ return isErrorCode2(error61, "ENOENT");
96981
97766
  }
96982
97767
  function isExistingFile2(error61) {
96983
- return isErrorCode(error61, "EEXIST");
97768
+ return isErrorCode2(error61, "EEXIST");
96984
97769
  }
96985
- function isErrorCode(error61, code) {
96986
- return isRecord8(error61) && Reflect.get(error61, "code") === code;
97770
+ function isErrorCode2(error61, code) {
97771
+ return isRecord9(error61) && Reflect.get(error61, "code") === code;
96987
97772
  }
96988
97773
  function validateBackupSourceRelationships(source, context) {
96989
97774
  const names = /* @__PURE__ */ new Set();
@@ -97382,7 +98167,7 @@ function assertBytes(value, length) {
97382
98167
  }
97383
98168
  }
97384
98169
  function assertOwnerKey(ownerKey) {
97385
- if (!isRecord8(ownerKey) || ownerKey.kdf !== "hkdf-sha256" && ownerKey.kdf !== "scrypt") {
98170
+ if (!isRecord9(ownerKey) || ownerKey.kdf !== "hkdf-sha256" && ownerKey.kdf !== "scrypt") {
97386
98171
  throw new BackupError("backup_invalid_input");
97387
98172
  }
97388
98173
  assertBytes(ownerKey.key, 32);
@@ -97412,7 +98197,7 @@ function isIsoUtcMilliseconds(value) {
97412
98197
  return false;
97413
98198
  }
97414
98199
  }
97415
- function isRecord8(value) {
98200
+ function isRecord9(value) {
97416
98201
  return typeof value === "object" && value !== null && !Array.isArray(value);
97417
98202
  }
97418
98203
  function hasExactKeys(value, expected) {
@@ -97480,7 +98265,7 @@ async function startRelay(options) {
97480
98265
  );
97481
98266
  if (response.status !== 201) throw new Error();
97482
98267
  const value = await response.json();
97483
- if (!isRecord9(value) || !hasExactKeys2(value, RELAY_START_KEYS) || value.code !== code || typeof value.expiresAt !== "string" || !isIsoUtc(value.expiresAt) || new Date(value.expiresAt).getTime() <= readNow(options.now).getTime()) {
98268
+ if (!isRecord10(value) || !hasExactKeys2(value, RELAY_START_KEYS) || value.code !== code || typeof value.expiresAt !== "string" || !isIsoUtc(value.expiresAt) || new Date(value.expiresAt).getTime() <= readNow(options.now).getTime()) {
97484
98269
  throw new Error();
97485
98270
  }
97486
98271
  return { code, expiresAt: value.expiresAt, keyPair };
@@ -97777,7 +98562,7 @@ async function readRelayResult(response, options) {
97777
98562
  let plaintext;
97778
98563
  try {
97779
98564
  const result = await response.json();
97780
- if (!isRecord9(result) || !hasExactKeys2(result, RELAY_RESULT_KEYS) || typeof result.sealed !== "string") {
98565
+ if (!isRecord10(result) || !hasExactKeys2(result, RELAY_RESULT_KEYS) || typeof result.sealed !== "string") {
97781
98566
  throw new Error();
97782
98567
  }
97783
98568
  plaintext = openSealed({
@@ -97807,11 +98592,11 @@ async function readRelayResult(response, options) {
97807
98592
  }
97808
98593
  }
97809
98594
  function parseRelayPayload(value) {
97810
- if (!isRecord9(value) || !isRelayPurpose(value.purpose)) {
98595
+ if (!isRecord10(value) || !isRelayPurpose(value.purpose)) {
97811
98596
  throw new CloudBackupError("payload_invalid");
97812
98597
  }
97813
98598
  const expectedKeys = value.purpose === "restore" ? RESTORE_PAYLOAD_KEYS : ENROLL_PAYLOAD_KEYS;
97814
- if (!hasExactKeys2(value, expectedKeys) || value.format !== RELAY_PAYLOAD_FORMAT || value.v !== 1 || typeof value.owner !== "string" || !OWNER_PATTERN.test(value.owner) || typeof value.device !== "string" || !DEVICE_NAME_PATTERN.test(value.device) || !isRecord9(value.kdf) || typeof value.key !== "string") {
98599
+ if (!hasExactKeys2(value, expectedKeys) || value.format !== RELAY_PAYLOAD_FORMAT || value.v !== 1 || typeof value.owner !== "string" || !OWNER_PATTERN.test(value.owner) || typeof value.device !== "string" || !DEVICE_NAME_PATTERN.test(value.device) || !isRecord10(value.kdf) || typeof value.key !== "string") {
97815
98600
  throw new CloudBackupError("payload_invalid");
97816
98601
  }
97817
98602
  const kdf = parseKdf2(value.kdf);
@@ -97841,7 +98626,7 @@ function parseRelayPayload(value) {
97841
98626
  };
97842
98627
  }
97843
98628
  function parseStoredBackupKey(value) {
97844
- if (!isRecord9(value) || !hasExactKeys2(value, STORED_KEY_KEYS) || typeof value.owner !== "string" || !OWNER_PATTERN.test(value.owner) || typeof value.device !== "string" || !DEVICE_NAME_PATTERN.test(value.device) || !isRecord9(value.kdf) || typeof value.key !== "string") {
98629
+ if (!isRecord10(value) || !hasExactKeys2(value, STORED_KEY_KEYS) || typeof value.owner !== "string" || !OWNER_PATTERN.test(value.owner) || typeof value.device !== "string" || !DEVICE_NAME_PATTERN.test(value.device) || !isRecord10(value.kdf) || typeof value.key !== "string") {
97845
98630
  return void 0;
97846
98631
  }
97847
98632
  const kdf = parseKdf2(value.kdf);
@@ -97867,7 +98652,7 @@ function parseStoredState(value) {
97867
98652
  if (value === void 0) return void 0;
97868
98653
  try {
97869
98654
  const parsed = JSON.parse(value);
97870
- if (!isRecord9(parsed) || !hasExactKeys2(parsed, STATE_KEYS) || typeof parsed.lastUploadAt !== "string" || !isIsoUtc(parsed.lastUploadAt) || typeof parsed.sizeBytes !== "number" || !Number.isSafeInteger(parsed.sizeBytes) || parsed.sizeBytes < 0) {
98655
+ if (!isRecord10(parsed) || !hasExactKeys2(parsed, STATE_KEYS) || typeof parsed.lastUploadAt !== "string" || !isIsoUtc(parsed.lastUploadAt) || typeof parsed.sizeBytes !== "number" || !Number.isSafeInteger(parsed.sizeBytes) || parsed.sizeBytes < 0) {
97871
98656
  return void 0;
97872
98657
  }
97873
98658
  return { lastUploadAt: parsed.lastUploadAt, sizeBytes: parsed.sizeBytes };
@@ -97959,7 +98744,7 @@ function isRelayPurpose(value) {
97959
98744
  function isAborted(signal) {
97960
98745
  return signal?.aborted === true;
97961
98746
  }
97962
- function isRecord9(value) {
98747
+ function isRecord10(value) {
97963
98748
  return typeof value === "object" && value !== null && !Array.isArray(value);
97964
98749
  }
97965
98750
  function hasExactKeys2(value, expected) {
@@ -98157,6 +98942,7 @@ async function buyCommand(argv, json2, io, dependencies) {
98157
98942
  )
98158
98943
  );
98159
98944
  } catch (error61) {
98945
+ if (error61 instanceof SpendCapExceededError) throw error61;
98160
98946
  if (error61 instanceof SpendCapError) {
98161
98947
  throw new Error(
98162
98948
  `Router balance purchase refused by the wallet spend policy: ${error61.message} Review or change it with vapi accounts caps ${target.name}.`
@@ -98309,7 +99095,7 @@ async function readProcessStdin() {
98309
99095
  }
98310
99096
 
98311
99097
  // src/version.ts
98312
- var CLI_VERSION = "0.9.7";
99098
+ var CLI_VERSION = "0.11.0";
98313
99099
 
98314
99100
  // src/status.ts
98315
99101
  async function statusCommand(argv, json2, io, dependencies) {
@@ -99889,7 +100675,7 @@ async function readOffer(response) {
99889
100675
  if (raw !== null) {
99890
100676
  try {
99891
100677
  const decoded = decodePaymentRequiredHeader(raw);
99892
- if (isRecord10(decoded)) header = decoded;
100678
+ if (isRecord11(decoded)) header = decoded;
99893
100679
  else headerMalformed = true;
99894
100680
  } catch {
99895
100681
  headerMalformed = true;
@@ -99898,7 +100684,7 @@ async function readOffer(response) {
99898
100684
  let body;
99899
100685
  try {
99900
100686
  const parsed = JSON.parse(await readBoundedText(response) ?? "");
99901
- if (isRecord10(parsed) && ("accepts" in parsed || "x402Version" in parsed)) body = parsed;
100687
+ if (isRecord11(parsed) && ("accepts" in parsed || "x402Version" in parsed)) body = parsed;
99902
100688
  } catch {
99903
100689
  }
99904
100690
  const mpp = parseMppChallenge(response.headers.get("www-authenticate"));
@@ -99976,7 +100762,7 @@ function gradeOffer(offer) {
99976
100762
  };
99977
100763
  }
99978
100764
  const version5 = declared.x402Version === 1 || declared.x402Version === 2 ? declared.x402Version : null;
99979
- const accepts = (Array.isArray(declared.accepts) ? declared.accepts : []).filter(isRecord10);
100765
+ const accepts = (Array.isArray(declared.accepts) ? declared.accepts : []).filter(isRecord11);
99980
100766
  const exact = accepts.filter((accept) => accept.scheme === "exact");
99981
100767
  const fields = version5 === null ? void 0 : fieldsRule(declared, version5);
99982
100768
  const offerRules = [
@@ -100001,7 +100787,7 @@ function gradeOffer(offer) {
100001
100787
  }
100002
100788
  function advertisedExtensions(declared) {
100003
100789
  const extensions = declared.extensions;
100004
- if (!isRecord10(extensions)) return [];
100790
+ if (!isRecord11(extensions)) return [];
100005
100791
  return KNOWN_EXTENSIONS.filter((name) => Object.prototype.hasOwnProperty.call(extensions, name));
100006
100792
  }
100007
100793
  function extensionsRule(advertised) {
@@ -100124,14 +100910,14 @@ function fieldsRule(declared, version5) {
100124
100910
  if (version5 === 2) {
100125
100911
  const resource = declared.resource;
100126
100912
  if (resource === void 0) issues.push("v2_missing_resource");
100127
- else if (!isRecord10(resource) || !nonEmptyString(resource.url)) {
100913
+ else if (!isRecord11(resource) || !nonEmptyString(resource.url)) {
100128
100914
  issues.push("v2_invalid_resource");
100129
100915
  }
100130
100916
  }
100131
100917
  const accepts = declared.accepts;
100132
100918
  if (!Array.isArray(accepts) || accepts.length === 0) issues.push(`${prefix}_missing_accepts`);
100133
100919
  for (const accept of Array.isArray(accepts) ? accepts : []) {
100134
- if (!isRecord10(accept)) {
100920
+ if (!isRecord11(accept)) {
100135
100921
  issues.push(`${prefix}_invalid_accepts`);
100136
100922
  continue;
100137
100923
  }
@@ -100189,7 +100975,7 @@ function usdcIssue(accept, network) {
100189
100975
  if (typeof accept.asset !== "string" || accept.asset.toLowerCase() !== canonical.usdc.toLowerCase()) {
100190
100976
  return "asset_not_usdc";
100191
100977
  }
100192
- const extra = isRecord10(accept.extra) ? accept.extra : {};
100978
+ const extra = isRecord11(accept.extra) ? accept.extra : {};
100193
100979
  return extra.name === canonical.eip712Domain.name && extra.version === canonical.eip712Domain.version ? void 0 : "usdc_domain_mismatch";
100194
100980
  }
100195
100981
  function payToRule(exact, version5) {
@@ -100241,7 +101027,7 @@ async function discoveryRule(target, fetchImpl) {
100241
101027
  "discovery_missing"
100242
101028
  ]);
100243
101029
  }
100244
- if (!isRecord10(document)) {
101030
+ if (!isRecord11(document)) {
100245
101031
  return rule("discovery", "warn", `${url2.href} is not a JSON object.`, ["discovery_malformed"]);
100246
101032
  }
100247
101033
  const resources = Array.isArray(document.resources) ? document.resources.length : void 0;
@@ -100312,12 +101098,12 @@ function pathAdjacentOpenApiUrls(target) {
100312
101098
  }
100313
101099
  }
100314
101100
  function apiCatalogOpenApiUrls(document, catalogUrl, origin, seen) {
100315
- if (!isRecord10(document) || !Array.isArray(document.linkset)) return [];
101101
+ if (!isRecord11(document) || !Array.isArray(document.linkset)) return [];
100316
101102
  const candidates = [];
100317
101103
  for (const link3 of document.linkset) {
100318
- if (!isRecord10(link3) || !Array.isArray(link3["service-desc"])) continue;
101104
+ if (!isRecord11(link3) || !Array.isArray(link3["service-desc"])) continue;
100319
101105
  for (const description of link3["service-desc"]) {
100320
- if (!isRecord10(description) || typeof description.href !== "string") continue;
101106
+ if (!isRecord11(description) || typeof description.href !== "string") continue;
100321
101107
  let candidate;
100322
101108
  try {
100323
101109
  candidate = new URL(description.href, catalogUrl);
@@ -100336,7 +101122,7 @@ async function findOpenApiOperation(fetchImpl, candidates, pathname, method, via
100336
101122
  let firstDocument;
100337
101123
  for (const url2 of candidates) {
100338
101124
  const document = await fetchJson(fetchImpl, url2);
100339
- if (isRecord10(document) && isRecord10(document.paths)) {
101125
+ if (isRecord11(document) && isRecord11(document.paths)) {
100340
101126
  const located = {
100341
101127
  url: url2,
100342
101128
  paths: document.paths,
@@ -100357,9 +101143,9 @@ function openApiSource(document, catalogUrl) {
100357
101143
  function findOperation(paths, pathname, method) {
100358
101144
  const path = trimSlash(pathname);
100359
101145
  for (const [template, item] of Object.entries(paths)) {
100360
- if (!isRecord10(item)) continue;
101146
+ if (!isRecord11(item)) continue;
100361
101147
  const operation = item[method.toLowerCase()];
100362
- if (!isRecord10(operation)) continue;
101148
+ if (!isRecord11(operation)) continue;
100363
101149
  const pattern = trimSlash(template).split(/(\{[^/}]+\})/).map((part) => part.startsWith("{") ? "[^/]+" : part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("");
100364
101150
  if (new RegExp(`${pattern}$`).test(path)) return { item, operation };
100365
101151
  }
@@ -100428,7 +101214,7 @@ function trimSlash(path) {
100428
101214
  function nonEmptyString(value) {
100429
101215
  return typeof value === "string" && value.length > 0;
100430
101216
  }
100431
- function isRecord10(value) {
101217
+ function isRecord11(value) {
100432
101218
  return typeof value === "object" && value !== null && !Array.isArray(value);
100433
101219
  }
100434
101220
 
@@ -101556,7 +102342,7 @@ async function reserveRemoteAllowance(args) {
101556
102342
  );
101557
102343
  return { atomic: reserved, expiresAt: nextUtcMidnight(reservation.date) };
101558
102344
  } catch (error61) {
101559
- if (error61 instanceof Error && "code" in error61 && error61.code === "per_day_cap_exceeded") {
102345
+ if (error61 instanceof SpendCapExceededError && error61.cap === "per_day" || error61 instanceof Error && "code" in error61 && error61.code === "per_day_cap_exceeded") {
101560
102346
  throw new RemoteKeyRefusedError(
101561
102347
  "no_daily_allowance",
101562
102348
  `${args.account}'s remaining daily allowance changed while Railway was starting. Run the command again.`
@@ -101818,7 +102604,7 @@ function createLocalRuntime(options) {
101818
102604
  const { home } = options;
101819
102605
  const entry = options.entry ?? realpathSync(process.argv[1]);
101820
102606
  const execPath = options.execPath ?? process.execPath;
101821
- const spawn4 = options.spawn ?? nodeSpawn;
102607
+ const spawn5 = options.spawn ?? nodeSpawn;
101822
102608
  const kill = options.kill ?? ((pid, signal) => process.kill(pid, signal));
101823
102609
  const processCommand = options.processCommand ?? defaultProcessCommand;
101824
102610
  const ownsProcess = (handle, pid) => processCommand(pid)?.includes(runResultPath(home, handle.runId)) === true;
@@ -101841,7 +102627,7 @@ function createLocalRuntime(options) {
101841
102627
  const logFd = openLog(logPath);
101842
102628
  let child;
101843
102629
  try {
101844
- child = spawn4(execPath, [entry, ...args, "--json", "--result-file", resultPath], {
102630
+ child = spawn5(execPath, [entry, ...args, "--json", "--result-file", resultPath], {
101845
102631
  detached: true,
101846
102632
  stdio: ["ignore", logFd, logFd],
101847
102633
  env: {
@@ -102462,9 +103248,9 @@ async function buildAgentRunDeps(input2) {
102462
103248
  })
102463
103249
  }
102464
103250
  });
102465
- const search = runDependencies.search;
103251
+ const search2 = runDependencies.search;
102466
103252
  runDependencies.search = async (query) => {
102467
- const rows = await search(query);
103253
+ const rows = await search2(query);
102468
103254
  for (const row of rows) listingNames.set(row.ref, row.name);
102469
103255
  return rows;
102470
103256
  };
@@ -102755,13 +103541,17 @@ function usd(value, minimumDecimals = 0) {
102755
103541
  }
102756
103542
 
102757
103543
  // src/mcp-install.ts
103544
+ import { spawn as spawn3 } from "node:child_process";
102758
103545
  import { mkdir as mkdir20, readFile as readFile27, writeFile as writeFile11 } from "node:fs/promises";
102759
103546
  import { homedir as systemHomedir } from "node:os";
102760
103547
  import { dirname as dirname14, posix, win32 as win322 } from "node:path";
102761
- var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
102762
- var APPS = /* @__PURE__ */ new Set(["claude", "cursor", "codex"]);
103548
+ var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude-code|claude-desktop|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
103549
+ var APPS = /* @__PURE__ */ new Set(["claude-code", "claude-desktop", "cursor", "codex"]);
103550
+ var CLAUDE_ALIAS_NOTICE = "vapi mcp install claude installs into Claude Desktop; for the Claude Code CLI use: vapi mcp install claude-code";
103551
+ var CLAUDE_NOT_FOUND = "Claude Code's claude command was not found on PATH. Install Claude Code, or run this yourself:";
102763
103552
  var NEXT_STEP = {
102764
- claude: 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
103553
+ "claude-code": 'Start a new Claude Code session, then ask: "Search vAPI for a weather API."',
103554
+ "claude-desktop": 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
102765
103555
  cursor: 'Reload Cursor, then ask its agent: "Search vAPI for a weather API."',
102766
103556
  codex: 'Start codex in a new terminal, then ask: "Search vAPI for a weather API."'
102767
103557
  };
@@ -102802,36 +103592,44 @@ async function mcpInstallCommand(argv, json2, io, dependencies) {
102802
103592
  booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
102803
103593
  maximumPositionals: 1
102804
103594
  });
102805
- const appValue = parsed.positionals[0];
102806
- if (appValue === void 0) throw new UsageError(MCP_INSTALL_USAGE);
103595
+ const requestedApp = parsed.positionals[0];
103596
+ if (requestedApp === void 0) throw new UsageError(MCP_INSTALL_USAGE);
103597
+ const appValue = requestedApp === "claude" ? "claude-desktop" : requestedApp;
102807
103598
  if (!isMcpInstallApp(appValue)) {
102808
103599
  throw new UsageError(
102809
- `Unknown app ${JSON.stringify(appValue)}. Choose claude, cursor or codex.
103600
+ `Unknown app ${JSON.stringify(requestedApp)}. Choose claude-code, claude-desktop, cursor or codex.
102810
103601
  ${MCP_INSTALL_USAGE}`
102811
103602
  );
102812
103603
  }
103604
+ if (requestedApp === "claude") io.stderr(CLAUDE_ALIAS_NOTICE);
102813
103605
  const home = parsed.one("--home") ?? getVapiPaths().directory;
102814
103606
  const paths = getVapiPaths(home);
102815
103607
  const registry2 = parsed.one("--registry") ?? (await pathExists5(paths.config) ? registryBaseUrl(await readConfig(paths.config, io)) : resolveRegistryUrl());
103608
+ const offerLink = async () => {
103609
+ const name = await unlinkedDefaultAccount(home, dependencies);
103610
+ return name === void 0 ? {} : await offerDashboardLink({
103611
+ name,
103612
+ json: json2,
103613
+ noLink: parsed.has("--no-link"),
103614
+ io,
103615
+ dependencies,
103616
+ home,
103617
+ apiBase: parsed.one("--registry")
103618
+ });
103619
+ };
103620
+ const platform2 = dependencies.mcpInstall?.platform ?? process.platform;
103621
+ const entry = serverEntry(home, registry2);
103622
+ if (appValue === "claude-code") {
103623
+ return await installClaudeCode(entry, platform2, json2, io, dependencies, offerLink);
103624
+ }
102816
103625
  const target = mcpInstallTarget(appValue, {
102817
- platform: dependencies.mcpInstall?.platform ?? process.platform,
103626
+ platform: platform2,
102818
103627
  homedir: dependencies.mcpInstall?.homedir ?? systemHomedir(),
102819
103628
  cwd: dependencies.mcpInstall?.cwd ?? process.cwd(),
102820
103629
  appData: dependencies.mcpInstall?.appData ?? process.env.APPDATA
102821
103630
  });
102822
- const entry = serverEntry(home, registry2);
102823
103631
  const created = await writeMcpConfig(target, entry);
102824
- const name = await unlinkedDefaultAccount(home, dependencies);
102825
- const offerLink = (name2) => offerDashboardLink({
102826
- name: name2,
102827
- json: json2,
102828
- noLink: parsed.has("--no-link"),
102829
- io,
102830
- dependencies,
102831
- home,
102832
- apiBase: parsed.one("--registry")
102833
- });
102834
- const link3 = json2 && name !== void 0 ? await offerLink(name) : {};
103632
+ const link3 = json2 ? await offerLink() : {};
102835
103633
  output3(
102836
103634
  io,
102837
103635
  json2,
@@ -102840,8 +103638,9 @@ ${MCP_INSTALL_USAGE}`
102840
103638
  );
102841
103639
  if (!json2) {
102842
103640
  io.stdout(NEXT_STEP[appValue]);
102843
- if (name !== void 0) await offerLink(name);
103641
+ await offerLink();
102844
103642
  }
103643
+ return 0;
102845
103644
  }
102846
103645
  async function unlinkedDefaultAccount(home, dependencies) {
102847
103646
  try {
@@ -102855,6 +103654,131 @@ async function unlinkedDefaultAccount(home, dependencies) {
102855
103654
  }
102856
103655
  return void 0;
102857
103656
  }
103657
+ async function installClaudeCode(entry, platform2, json2, io, dependencies, offerLink) {
103658
+ const processCommand = platform2 === "win32" ? "claude.cmd" : "claude";
103659
+ const processArgs = claudeCodeArgs(entry);
103660
+ const command = platform2 === "win32" ? [escapeCmd(processCommand), ...processArgs.map(escapeCmdArgument)].join(" ") : displayCommand(processCommand, processArgs);
103661
+ let result;
103662
+ try {
103663
+ result = await (dependencies.mcpInstall?.runProcess ?? defaultMcpInstallProcess)(
103664
+ processCommand,
103665
+ processArgs
103666
+ );
103667
+ } catch (error61) {
103668
+ if (isErrorCode3(error61, "ENOENT")) {
103669
+ return claudeCodeFailure(json2, io, command, "claude_not_found", CLAUDE_NOT_FOUND);
103670
+ }
103671
+ const message = `Claude Code MCP installation failed: ${errorMessage2(error61)}`;
103672
+ return claudeCodeFailure(json2, io, command, "claude_mcp_add_failed", message);
103673
+ }
103674
+ if (result.exitCode !== 0) {
103675
+ const status = result.exitCode === null ? "Claude Code's claude command ended without an exit code." : `Claude Code's claude command exited with code ${result.exitCode}.`;
103676
+ const stderr2 = result.stderr.trim();
103677
+ const message = stderr2.length === 0 ? status : `${status} ${stderr2}`;
103678
+ return claudeCodeFailure(json2, io, command, "claude_mcp_add_failed", message, result.exitCode);
103679
+ }
103680
+ const nextStep = NEXT_STEP["claude-code"];
103681
+ const link3 = json2 ? await offerLink() : {};
103682
+ if (json2)
103683
+ io.stdout(JSON.stringify({ ...link3, app: "claude-code", installed: true, command, nextStep }));
103684
+ else {
103685
+ io.stdout(command);
103686
+ io.stdout(nextStep);
103687
+ await offerLink();
103688
+ }
103689
+ return 0;
103690
+ }
103691
+ function claudeCodeArgs(entry) {
103692
+ return [
103693
+ "mcp",
103694
+ "add",
103695
+ "--scope",
103696
+ "user",
103697
+ "vapi",
103698
+ "-e",
103699
+ `VAPI_HOME=${entry.env.VAPI_HOME}`,
103700
+ "-e",
103701
+ `VAPI_REGISTRY_URL=${entry.env.VAPI_REGISTRY_URL}`,
103702
+ "--",
103703
+ entry.command,
103704
+ ...entry.args
103705
+ ];
103706
+ }
103707
+ function claudeCodeFailure(json2, io, command, code, message, exitCode) {
103708
+ if (json2) {
103709
+ io.stdout(
103710
+ JSON.stringify({
103711
+ app: "claude-code",
103712
+ installed: false,
103713
+ command,
103714
+ error: { code, message, ...exitCode === void 0 ? {} : { exitCode } }
103715
+ })
103716
+ );
103717
+ } else if (code === "claude_not_found") {
103718
+ io.stderr(`${message}
103719
+ ${command}`);
103720
+ } else {
103721
+ io.stderr(`${command}
103722
+ ${message}`);
103723
+ }
103724
+ return 1;
103725
+ }
103726
+ function displayCommand(command, args) {
103727
+ return [command, ...args].map(shellQuote3).join(" ");
103728
+ }
103729
+ function shellQuote3(value) {
103730
+ return /^[A-Za-z0-9_@%+=:,./-]+$/u.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
103731
+ }
103732
+ function isErrorCode3(error61, code) {
103733
+ return typeof error61 === "object" && error61 !== null && "code" in error61 && error61.code === code;
103734
+ }
103735
+ function errorMessage2(error61) {
103736
+ return error61 instanceof Error ? error61.message : String(error61);
103737
+ }
103738
+ var defaultMcpInstallProcess = async (command, args) => {
103739
+ const batch = /\.(?:cmd|bat)$/iu.test(command);
103740
+ const executable = batch ? await windowsBatchPath(command) : command;
103741
+ const commandLine = batch ? [escapeCmd(executable), ...args.map((arg) => escapeCmdArgument(arg))].join(" ") : void 0;
103742
+ return await new Promise((resolve3, reject) => {
103743
+ const child = spawn3(
103744
+ batch ? "cmd.exe" : command,
103745
+ batch ? ["/d", "/v:off", "/s", "/c", `"${commandLine}"`] : [...args],
103746
+ {
103747
+ shell: false,
103748
+ ...batch ? { windowsVerbatimArguments: true } : {},
103749
+ stdio: ["ignore", "pipe", "pipe"],
103750
+ timeout: 6e4,
103751
+ killSignal: "SIGKILL",
103752
+ windowsHide: true
103753
+ }
103754
+ );
103755
+ let stdout = "";
103756
+ let stderr2 = "";
103757
+ child.stdout.setEncoding("utf8").on("data", (chunk) => {
103758
+ stdout += chunk;
103759
+ });
103760
+ child.stderr.setEncoding("utf8").on("data", (chunk) => {
103761
+ stderr2 += chunk;
103762
+ });
103763
+ child.once("error", reject);
103764
+ child.once("close", (exitCode) => resolve3({ exitCode, stdout, stderr: stderr2 }));
103765
+ });
103766
+ };
103767
+ async function windowsBatchPath(command) {
103768
+ const path = Object.entries(process.env).find(([key2]) => key2.toLowerCase() === "path")?.[1];
103769
+ for (const directory of ["", ...(path ?? "").split(";")]) {
103770
+ const candidate = win322.join(directory.replace(/^"|"$/gu, ""), command);
103771
+ if (await pathExists5(candidate)) return candidate;
103772
+ }
103773
+ throw Object.assign(new Error(`${command} was not found on PATH.`), { code: "ENOENT" });
103774
+ }
103775
+ function escapeCmd(value) {
103776
+ return value.replace(/[()[\]%!^"`<>&|;, *?]/gu, "^$&");
103777
+ }
103778
+ function escapeCmdArgument(value) {
103779
+ const quoted = `"${value.replace(/(\\*)"/gu, '$1$1\\"').replace(/(\\*)$/u, "$1$1")}"`;
103780
+ return escapeCmd(escapeCmd(quoted));
103781
+ }
102858
103782
  function isMcpInstallApp(value) {
102859
103783
  return APPS.has(value);
102860
103784
  }
@@ -102888,13 +103812,13 @@ function jsonConfig(path, existing, entry) {
102888
103812
  } catch {
102889
103813
  throw new Error(`${path} is not valid JSON. Fix it by hand; nothing was written.`);
102890
103814
  }
102891
- if (!isRecord11(parsed)) {
103815
+ if (!isRecord12(parsed)) {
102892
103816
  throw new Error(`${path} must contain a JSON object. Fix it by hand; nothing was written.`);
102893
103817
  }
102894
103818
  config2 = parsed;
102895
103819
  }
102896
103820
  const existingServers = config2.mcpServers;
102897
- if (existingServers !== void 0 && !isRecord11(existingServers)) {
103821
+ if (existingServers !== void 0 && !isRecord12(existingServers)) {
102898
103822
  throw new Error(
102899
103823
  `${path} has an invalid mcpServers value. Fix it by hand; nothing was written.`
102900
103824
  );
@@ -102956,7 +103880,7 @@ function tomlSeparator(contents) {
102956
103880
  function escapeToml(value) {
102957
103881
  return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
102958
103882
  }
102959
- function isRecord11(value) {
103883
+ function isRecord12(value) {
102960
103884
  return typeof value === "object" && value !== null && !Array.isArray(value);
102961
103885
  }
102962
103886
  async function readExistingFile(path) {
@@ -105584,7 +106508,7 @@ Usage:
105584
106508
  vapi docs "<question>" [--json]
105585
106509
  vapi docs search "<query>" [--json]
105586
106510
  vapi docs read <url-or-path> [--json]
105587
- vapi search [query] [--kind <kind>] [--network <caip2>] [--limit <n>] [--cursor <cursor>] [--include-unverified] [--json]
106511
+ vapi search [query] [--kind <kind>] [--network <caip2>] [--limit <n>] [--cursor <cursor>] [--include-unverified] [--include-outage] [--json]
105588
106512
  vapi inspect <id> [--endpoint <name>] [--json]
105589
106513
  vapi pay <id-or-url> [--method <method>] [--endpoint <name>] [--body <json>] [--content-type <type>] [--network <caip2>] [--expected-pay-to <address>] [--max <amount>] [--timeout <seconds>] [--account <name>] [--json]
105590
106514
  vapi pay --resume <receipt-id> [--json]
@@ -105653,7 +106577,7 @@ Usage:
105653
106577
  vapi publish list [--json]
105654
106578
  vapi claim <origin> [--account <name>] [--json]
105655
106579
  vapi mcp [--account <name>] [--json]
105656
- vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
106580
+ vapi mcp install <claude-code|claude-desktop|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
105657
106581
  vapi serve [--json]
105658
106582
  vapi version [--json]
105659
106583
  vapi help [--json]
@@ -105680,13 +106604,13 @@ Solana listings remain searchable; inspect and pay return \`unsupported_network\
105680
106604
 
105681
106605
  \`vapi backup\` and \`vapi export-key\` print a secret, so they run only on a real terminal, never for an agent, and ask you to type the wallet name first. \`vapi backup --cloud\` keeps an encrypted vault copy that only the owner can approve for recovery. \`vapi restore\` rebuilds the vault from the phrase and re-derives accounts until five consecutive addresses have no Base USDC, and reports the number scanned. Use \`--accounts <n>\` with restore or setup to recover a fixed count without querying balances. Set \`VAPI_NO_SECRETS=1\` to switch exports off entirely. Every export and every wallet change is logged to ~/.vapi/audit.log.
105682
106606
 
105683
- \`vapi publish <url>\` lists an API you own. vAPI probes the URL \u2014 an origin, one endpoint, or an OpenAPI document \u2014 you choose which endpoints to list, and your wallet signs one line naming where the payouts go. Listing is permissionless: a listing that passed the probe goes live with \`vapi publish activate <slug>\`, and \`vapi publish verify-request <slug>\` asks for the review that puts it in the default search. Deploying the FeeSplitter that receives the payouts is a wallet transaction and stays in the console. A catalog of more than 20 endpoints is listed as several listings of up to 20, with one result line per endpoint; \`--resume\` skips every endpoint this key already lists.
106607
+ \`vapi publish <url>\` lists an API you own. vAPI probes the URL \u2014 an origin, one endpoint, or an OpenAPI document \u2014 you choose which endpoints to list, and your wallet signs one line naming where the payouts go. Listing is permissionless: a listing that passed the probe goes live with \`vapi publish activate <slug>\`, and \`vapi publish verify-request <slug>\` asks for the review that puts it in the default search. Set each endpoint's x402 payTo to the payout wallet you signed with before activation. vAPI Call takes no fee. Providers are paid directly. A catalog of more than 20 endpoints is listed as several listings of up to 20, with one result line per endpoint; \`--resume\` skips every endpoint this key already lists.
105684
106608
 
105685
106609
  \`vapi claim <origin>\` takes ownership of the listings vAPI indexed from your API. The wallet their payments go to signs one line, \`Claim the vAPI Call listings served from <origin>\`; the listings stay paid directly to that wallet, and \`vapi publish list\` shows them.
105686
106610
 
105687
106611
  \`vapi auth set-key\` types the registry API key once, on a terminal, into the same OS secret store as the passphrase. A key is a secret: it is never an argument, \`VAPI_API_KEY\` is the route for CI, and no agent or MCP tool can reach it.
105688
106612
 
105689
- With no command, vapi shows the status screen; vapi help prints this text. The MCP server starts only with \`vapi mcp\`; \`vapi mcp install <app>\` writes that app's MCP config and prints the file it touched.`;
106613
+ With no command, vapi shows the status screen; vapi help prints this text. The MCP server starts only with \`vapi mcp\`; \`vapi mcp install claude-code\` runs Claude Code's installer, while the other install targets write the client's MCP config.`;
105690
106614
  var processIo = {
105691
106615
  stdout: (message) => process.stdout.write(`${message}
105692
106616
  `),
@@ -105724,6 +106648,7 @@ var ACCOUNT_OPTION2 = "--account";
105724
106648
  var WALLET_OPTION_DEPRECATION = "--wallet is now --account; --wallet keeps working for one release.";
105725
106649
  var SOLANA_VAULT_UNAVAILABLE2 = "Solana keys are not part of the device vault yet.";
105726
106650
  var INCLUDE_UNVERIFIED_OPTION = "--include-unverified";
106651
+ var INCLUDE_OUTAGE_OPTION = "--include-outage";
105727
106652
  async function openWalletStore(dependencies, home = getVapiPaths().directory) {
105728
106653
  return await WalletStore.open(home, {
105729
106654
  secrets: getSecretStore(dependencies),
@@ -106009,11 +106934,11 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
106009
106934
  break;
106010
106935
  case "mcp":
106011
106936
  if (args[1] === "install") {
106012
- await mcpInstallCommand(args.slice(2), json2, io, dependencies);
106937
+ exitCode = await mcpInstallCommand(args.slice(2), json2, io, dependencies);
106013
106938
  } else {
106014
106939
  await mcpCommand(args.slice(1), dependencies);
106940
+ exitCode = 0;
106015
106941
  }
106016
- exitCode = 0;
106017
106942
  break;
106018
106943
  case "serve":
106019
106944
  outputStub(io, json2);
@@ -106043,7 +106968,9 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
106043
106968
  ).catch(() => void 0);
106044
106969
  }
106045
106970
  if (json2) {
106046
- if (taskInvocation) {
106971
+ if (error61 instanceof SpendCapExceededError) {
106972
+ runIo.stdout(JSON.stringify({ error: error61.toJSON(), exitCode: 1 }));
106973
+ } else if (taskInvocation) {
106047
106974
  runIo.stdout(
106048
106975
  JSON.stringify({
106049
106976
  ok: false,
@@ -106429,7 +107356,7 @@ async function fundCommand2(argv, json2, io, dependencies) {
106429
107356
  async function searchCommand(argv, json2, io, dependencies) {
106430
107357
  const parsed = parseArguments(argv, {
106431
107358
  valueOptions: /* @__PURE__ */ new Set(["--kind", "--network", "--limit", "--cursor"]),
106432
- booleanOptions: /* @__PURE__ */ new Set([INCLUDE_UNVERIFIED_OPTION]),
107359
+ booleanOptions: /* @__PURE__ */ new Set([INCLUDE_UNVERIFIED_OPTION, INCLUDE_OUTAGE_OPTION]),
106433
107360
  repeatableOptions: /* @__PURE__ */ new Set(["--kind"]),
106434
107361
  maximumPositionals: 1
106435
107362
  });
@@ -106442,7 +107369,8 @@ async function searchCommand(argv, json2, io, dependencies) {
106442
107369
  ...limit === void 0 ? {} : { limit },
106443
107370
  ...parsed.one("--cursor") ? { cursor: parsed.one("--cursor") } : {},
106444
107371
  // Only the opt-in travels: `false` is the registry default.
106445
- ...parsed.has(INCLUDE_UNVERIFIED_OPTION) ? { includeUnverified: true } : {}
107372
+ ...parsed.has(INCLUDE_UNVERIFIED_OPTION) ? { includeUnverified: true } : {},
107373
+ ...parsed.has(INCLUDE_OUTAGE_OPTION) ? { includeOutage: true } : {}
106446
107374
  };
106447
107375
  const call2 = createCallPort({
106448
107376
  config: config2,
@@ -106568,12 +107496,14 @@ async function payCommand(argv, json2, io, dependencies) {
106568
107496
  cliActionContext(config2, pinPayInput(call2, input2), dependencies)
106569
107497
  );
106570
107498
  void _resolvedWallet;
107499
+ const { hints: _hints, ...humanResult } = result;
107500
+ void _hints;
106571
107501
  outputForWallet2(
106572
107502
  io,
106573
107503
  json2,
106574
107504
  wallet,
106575
107505
  result,
106576
- [...verificationNotice(result.verification), JSON.stringify(result, null, 2)].join("\n")
107506
+ [...verificationNotice(result.verification), JSON.stringify(humanResult, null, 2)].join("\n")
106577
107507
  );
106578
107508
  await (dependencies.ceiling?.drainCeilingSweeps ?? drainCeilingSweeps)(1e4).catch(
106579
107509
  () => void 0
@@ -107214,15 +108144,6 @@ async function publishListingCommand(argv, json2, io, dependencies) {
107214
108144
  }
107215
108145
  say(formatCreatedListing(listing, batch.name, payoutWallet, batch.endpoints.length));
107216
108146
  }
107217
- let splitters;
107218
- let splittersError;
107219
- if (created.length > 0) {
107220
- try {
107221
- splitters = await client.splitters(payoutWallet);
107222
- } catch (error61) {
107223
- splittersError = error61 instanceof Error ? error61.message : String(error61);
107224
- }
107225
- }
107226
108147
  const failed2 = failures.length > 0;
107227
108148
  const resumeHint = `Run the same vapi publish command with ${RESUME_OPTION} to list the rest; it skips what is already listed.`;
107228
108149
  if (json2) {
@@ -107232,8 +108153,6 @@ async function publishListingCommand(argv, json2, io, dependencies) {
107232
108153
  probe,
107233
108154
  listings: created,
107234
108155
  results,
107235
- ...splitters === void 0 ? {} : { splitters },
107236
- ...splittersError === void 0 ? {} : { splittersError },
107237
108156
  ...failed2 ? {
107238
108157
  error: [...new Set(failures.map((failure) => failure.message))].join("\n"),
107239
108158
  exitCode: 1
@@ -107243,8 +108162,12 @@ async function publishListingCommand(argv, json2, io, dependencies) {
107243
108162
  return failed2 ? 1 : 0;
107244
108163
  }
107245
108164
  if (created.length > 0) {
107246
- const slug = created.length === 1 ? listingSlug(created[0]) : void 0;
107247
- for (const line of formatSplitters(splitters, splittersError, slug, baseUrl)) io.stdout(line);
108165
+ for (const line of formatDescriptionWarnings(created[0])) io.stdout(line);
108166
+ io.stdout("vAPI Call takes no fee. Providers are paid directly.");
108167
+ io.stdout(`Set each endpoint's payTo to your payout wallet ${payoutWallet}, then run:`);
108168
+ for (const listing of created) {
108169
+ io.stdout(` vapi publish activate ${listingSlug(listing) ?? "<slug>"}`);
108170
+ }
107248
108171
  }
107249
108172
  if (!failed2) return 0;
107250
108173
  for (const message of new Set(failures.map((failure) => failure.message))) io.stderr(message);
@@ -107536,22 +108459,15 @@ function formatCreatedListing(created, name, payoutWallet, endpoints) {
107536
108459
  `Payout wallet: ${payoutWallet}`
107537
108460
  ].join("\n");
107538
108461
  }
107539
- function formatSplitters(splitters, splittersError, slug, baseUrl) {
107540
- const nextStep = `Deploy the FeeSplitter from your wallet in the console at ${listingsUrl(baseUrl, "/providers").href}, then run \`vapi publish activate ${slug ?? "<slug>"}\`.`;
107541
- if (splittersError !== void 0) {
107542
- return [`Could not read your splitters: ${splittersError}`, nextStep];
107543
- }
107544
- const states = Array.isArray(splitters?.networkStates) ? splitters.networkStates : [];
107545
- const fee = typeof splitters?.feeBp === "number" ? ` (vAPI fee ${splitters.feeBp / 100}%)` : "";
107546
- return [
107547
- `Splitters${fee}:`,
107548
- ...states.map((state) => {
107549
- const label = [state.name, state.network].filter(Boolean).join(" ");
107550
- const address4 = typeof state.splitterAddress === "string" ? state.splitterAddress : "unknown";
107551
- return ` ${label || "network"} ${address4} ${state.deployed === true ? "deployed" : "not deployed"}`;
107552
- }),
107553
- nextStep
107554
- ];
108462
+ function formatDescriptionWarnings(created) {
108463
+ const warnings = Array.isArray(created.descriptionWarnings) ? created.descriptionWarnings : [];
108464
+ const lines = warnings.flatMap((warning) => {
108465
+ if (typeof warning !== "object" || warning === null) return [];
108466
+ const { message, hint } = warning;
108467
+ if (typeof message !== "string") return [];
108468
+ return [`- ${message}${typeof hint === "string" ? ` ${hint}` : ""}`];
108469
+ });
108470
+ return lines.length === 0 ? [] : ["Description check (the listing is published either way):", ...lines];
107555
108471
  }
107556
108472
  function formatListingStatus(slug, action, result) {
107557
108473
  const status = typeof result.status === "string" ? result.status : "unknown";
@@ -108099,26 +109015,42 @@ function formatSearch(page) {
108099
109015
  verificationTag({ verification: item.verification, external: isMirroredHit(item) })
108100
109016
  ];
108101
109017
  const prefix = [...new Set(tags)].map((tag) => `[${tag}] `).join("");
109018
+ const health = item.kind === "api" && item.health ? `${item.health.state}${item.health.latencyP50Ms === null ? "" : ` ${Math.round(item.health.latencyP50Ms)}ms`}` : "-";
108102
109019
  return [
108103
- `${item.ref} ${item.kind} ${prefix}${item.card.title}`,
109020
+ `${item.ref} ${item.kind} ${health} ${prefix}${item.card.title}`,
108104
109021
  ` ${item.card.summary}`,
108105
- ...item.fee ? [` Fee: ${item.fee.label}`] : []
109022
+ ...item.fee ? [` Fee: ${formatListingFee(item.fee)}`] : [],
109023
+ ...item.kind === "api" && item.alternatives ? [
109024
+ ` Alternatives: ${item.alternatives.map((alternative) => `${alternative.ref} (${alternative.reason})`).join(", ")}`
109025
+ ] : []
108106
109026
  ].join("\n");
108107
109027
  }).join("\n");
108108
109028
  }
108109
109029
  function formatInspect(result) {
109030
+ const { hints: _hints, ...humanResult } = result;
109031
+ void _hints;
108110
109032
  return [
108111
109033
  `Verification: ${verificationTag({
108112
109034
  verification: result.verification,
108113
109035
  external: result.group === "external"
108114
109036
  })}`,
108115
- ...result.fee ? [`Fee: ${result.fee.label}`] : [],
109037
+ ...result.fee ? [`Fee: ${formatListingFee(result.fee)}`] : [],
109038
+ ...result.health ? [formatHealth(result.health)] : [],
109039
+ ...result.exampleRequest ? [`Example request: ${JSON.stringify(result.exampleRequest)}`] : [],
108116
109040
  ...result.liveness ? [formatLiveness(result.liveness)] : [],
108117
109041
  ...result.conformance ? [formatConformance(result.conformance)] : [],
108118
109042
  ...result.identity ? formatIdentityLines(result.identity) : [],
108119
- JSON.stringify(result, null, 2)
109043
+ JSON.stringify(humanResult, null, 2)
108120
109044
  ].join("\n");
108121
109045
  }
109046
+ function formatHealth(health) {
109047
+ return [
109048
+ `Health: ${health.state}`,
109049
+ ...health.uptime7d === null ? [`(${health.checks7d} checks)`] : [`${(health.uptime7d * 100).toFixed(1)}% up over 7 days (${health.checks7d} checks)`],
109050
+ ...health.latencyP50Ms === null ? [] : [`p50 ${Math.round(health.latencyP50Ms)} ms`],
109051
+ ...health.latencyP95Ms === null ? [] : [`p95 ${Math.round(health.latencyP95Ms)} ms`]
109052
+ ].join(" \xB7 ");
109053
+ }
108122
109054
  function formatLiveness(liveness) {
108123
109055
  const checks = `${liveness.checks7d} check${liveness.checks7d === 1 ? "" : "s"}`;
108124
109056
  return [
@@ -108163,7 +109095,7 @@ function formatFund(address4, url2, opened) {
108163
109095
  function openInBrowser(url2) {
108164
109096
  const opener = process.platform === "darwin" ? { command: "open", args: [url2] } : process.platform === "win32" ? { command: "cmd", args: ["/c", "start", "", url2] } : { command: "xdg-open", args: [url2] };
108165
109097
  try {
108166
- const child = spawn3(opener.command, opener.args, { stdio: "ignore", detached: true });
109098
+ const child = spawn4(opener.command, opener.args, { stdio: "ignore", detached: true });
108167
109099
  child.on("error", () => void 0);
108168
109100
  child.unref();
108169
109101
  return true;
@@ -108503,7 +109435,7 @@ async function latestNotice(options, env, signal) {
108503
109435
  let cached2;
108504
109436
  try {
108505
109437
  const value = JSON.parse(await readFile29(paths.updateCheck, "utf8"));
108506
- if (isRecord12(value) && typeof value.checkedAt === "number" && Number.isFinite(value.checkedAt) && typeof value.latest === "string" && parseVersion(value.latest)) {
109438
+ if (isRecord13(value) && typeof value.checkedAt === "number" && Number.isFinite(value.checkedAt) && typeof value.latest === "string" && parseVersion(value.latest)) {
108507
109439
  cached2 = { checkedAt: value.checkedAt, latest: value.latest };
108508
109440
  }
108509
109441
  } catch {
@@ -108536,7 +109468,7 @@ async function latestNotice(options, env, signal) {
108536
109468
  if (!response.ok) return void 0;
108537
109469
  const body = await response.json();
108538
109470
  signal.throwIfAborted();
108539
- if (!isRecord12(body) || typeof body.version !== "string" || !parseVersion(body.version)) {
109471
+ if (!isRecord13(body) || typeof body.version !== "string" || !parseVersion(body.version)) {
108540
109472
  return void 0;
108541
109473
  }
108542
109474
  latest = body.version;
@@ -108545,7 +109477,7 @@ async function latestNotice(options, env, signal) {
108545
109477
  signal.throwIfAborted();
108546
109478
  return isNewerVersion(latest, CLI_VERSION) ? `vapi-network ${latest} is available (you have ${CLI_VERSION}). Update: npm i -g vapi-network@latest` : void 0;
108547
109479
  }
108548
- function isRecord12(value) {
109480
+ function isRecord13(value) {
108549
109481
  return typeof value === "object" && value !== null && !Array.isArray(value);
108550
109482
  }
108551
109483
  function parseVersion(version5) {