@vapi-network/cli 0.10.0 → 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/index.js CHANGED
@@ -10116,7 +10116,7 @@ var init_call = __esm({
10116
10116
  });
10117
10117
 
10118
10118
  // src/cli.ts
10119
- import { spawn as spawn3 } from "node:child_process";
10119
+ import { spawn as spawn4 } from "node:child_process";
10120
10120
  import { stat as stat16 } from "node:fs/promises";
10121
10121
  import { join as join28 } from "node:path";
10122
10122
  import { createInterface as createInterface3 } from "node:readline/promises";
@@ -39309,7 +39309,6 @@ var BROWSER_ENABLED_X402_NETWORK_CONFIG = Object.freeze({
39309
39309
 
39310
39310
  // ../core/src/marketplace-contracts.ts
39311
39311
  var MARKETPLACE_DISCOVERY_PROTOCOL = "vapi.marketplace.discovery/1";
39312
- var MARKETPLACE_RANKING_VERSION = "marketplace-ranking-v1";
39313
39312
  var MARKETPLACE_KINDS = ["api", "service_offer", "open_request"];
39314
39313
  var MARKETPLACE_EXECUTION_METHODS = [
39315
39314
  "GET",
@@ -39342,6 +39341,32 @@ var listingLivenessSchema = external_exports.looseObject({
39342
39341
  latencyP95Ms: external_exports.number().nonnegative().nullable(),
39343
39342
  checks7d: external_exports.number().int().nonnegative()
39344
39343
  });
39344
+ var LISTING_HEALTH_STATES = ["healthy", "degraded", "outage", "unknown"];
39345
+ var listingHealthStateSchema = external_exports.enum(LISTING_HEALTH_STATES).catch("unknown");
39346
+ var listingHealthSchema = external_exports.looseObject({
39347
+ state: listingHealthStateSchema,
39348
+ uptime7d: external_exports.number().min(0).max(1).nullable().catch(null),
39349
+ latencyP50Ms: external_exports.number().nonnegative().nullable().catch(null),
39350
+ latencyP95Ms: external_exports.number().nonnegative().nullable().catch(null),
39351
+ checks7d: external_exports.number().int().nonnegative().catch(0)
39352
+ });
39353
+ var marketplaceAlternativeSchema = external_exports.looseObject({
39354
+ ref: external_exports.string().trim().min(1),
39355
+ reason: external_exports.enum(["cheaper", "healthier"])
39356
+ });
39357
+ var marketplaceAlternativesSchema = external_exports.preprocess((value) => {
39358
+ if (!Array.isArray(value)) return void 0;
39359
+ const alternatives = [];
39360
+ const refs = /* @__PURE__ */ new Set();
39361
+ for (const entry of value) {
39362
+ const parsed = marketplaceAlternativeSchema.safeParse(entry);
39363
+ if (!parsed.success || refs.has(parsed.data.ref)) continue;
39364
+ refs.add(parsed.data.ref);
39365
+ alternatives.push(parsed.data);
39366
+ if (alternatives.length === 2) break;
39367
+ }
39368
+ return alternatives.length > 0 ? alternatives : void 0;
39369
+ }, external_exports.array(marketplaceAlternativeSchema).optional());
39345
39370
  var listingConformanceSchema = external_exports.looseObject({
39346
39371
  declaredVersion: external_exports.union([external_exports.literal(1), external_exports.literal(2)]).nullable(),
39347
39372
  versionConformant: external_exports.boolean(),
@@ -39373,7 +39398,8 @@ var marketplaceBadgeCodeSchema = external_exports.enum([
39373
39398
  "vapi_verified",
39374
39399
  "external_catalog",
39375
39400
  "approved_vendor",
39376
- "unverified"
39401
+ "unverified",
39402
+ "failed_calls_free"
39377
39403
  ]);
39378
39404
  var marketplaceBadgeSchema = external_exports.looseObject({
39379
39405
  code: marketplaceBadgeCodeSchema,
@@ -39414,6 +39440,8 @@ var firstPartyApiMarketplaceHitSchema = external_exports.looseObject({
39414
39440
  ...marketplaceHitBase,
39415
39441
  kind: external_exports.literal("api"),
39416
39442
  provenance: firstPartyProvenanceSchema,
39443
+ health: listingHealthSchema.optional().catch(void 0),
39444
+ alternatives: marketplaceAlternativesSchema.optional().catch(void 0),
39417
39445
  execution: external_exports.looseObject({
39418
39446
  mode: executionModeSchema
39419
39447
  }),
@@ -39423,6 +39451,8 @@ var mirroredApiMarketplaceHitSchema = external_exports.looseObject({
39423
39451
  ...marketplaceHitBase,
39424
39452
  kind: external_exports.literal("api"),
39425
39453
  provenance: external_exports.literal("indexed"),
39454
+ health: listingHealthSchema.optional().catch(void 0),
39455
+ alternatives: marketplaceAlternativesSchema.optional().catch(void 0),
39426
39456
  execution: external_exports.looseObject({
39427
39457
  mode: external_exports.literal("direct"),
39428
39458
  url: external_exports.url().max(2048).regex(/^https:\/\/(?![^/?#]*@)/),
@@ -39472,7 +39502,8 @@ var marketplaceDiscoveryInputSchema = external_exports.strictObject({
39472
39502
  network: external_exports.string().trim().min(1).max(160).optional(),
39473
39503
  cursor: external_exports.string().trim().min(1).max(4096).optional(),
39474
39504
  limit: external_exports.number().int().min(1).max(50).optional(),
39475
- includeUnverified: external_exports.boolean().optional()
39505
+ includeUnverified: external_exports.boolean().optional(),
39506
+ includeOutage: external_exports.boolean().optional()
39476
39507
  }).superRefine((input2, context) => {
39477
39508
  if (input2.kinds && new Set(input2.kinds).size !== input2.kinds.length) {
39478
39509
  context.addIssue({
@@ -39490,7 +39521,14 @@ var marketplaceDiscoveryEnvelopeSchema = external_exports.looseObject({
39490
39521
  items: external_exports.array(external_exports.unknown()),
39491
39522
  nextCursor: external_exports.string().min(1).max(4096).nullable(),
39492
39523
  unavailableKinds: external_exports.array(marketplaceKindSchema).max(MARKETPLACE_KINDS.length),
39493
- rankingVersion: external_exports.literal(MARKETPLACE_RANKING_VERSION)
39524
+ // The ranking label is informational: pinning it made every installed client
39525
+ // reject the page the day the registry re-ranked, so any label is accepted.
39526
+ rankingVersion: external_exports.string().trim().min(1).max(80),
39527
+ // `hiddenOutage` counts listings in outage the registry left out because
39528
+ // `includeOutage` was not set. Older registries send no totals at all.
39529
+ totals: external_exports.looseObject({
39530
+ hiddenOutage: external_exports.number().int().nonnegative().optional().catch(void 0)
39531
+ }).optional().catch(void 0)
39494
39532
  });
39495
39533
  var marketplaceDiscoveryPageSchema = marketplaceDiscoveryEnvelopeSchema.extend({
39496
39534
  items: external_exports.array(marketplaceHitSchema)
@@ -46031,6 +46069,11 @@ var discoveryEndpointSchema = external_exports.looseObject({
46031
46069
  operationId: external_exports.string().trim().min(1).optional(),
46032
46070
  requestContentType: external_exports.string().trim().min(1).optional(),
46033
46071
  requestSchema: external_exports.json().optional(),
46072
+ responseSchema: external_exports.json().optional().catch(void 0),
46073
+ exampleRequest: external_exports.looseObject({
46074
+ query: external_exports.record(external_exports.string(), external_exports.string()).optional().catch(void 0),
46075
+ body: external_exports.json().optional()
46076
+ }).optional().catch(void 0),
46034
46077
  responseContentType: external_exports.string().trim().min(1).optional(),
46035
46078
  pathTemplate: external_exports.string().trim().min(1).optional(),
46036
46079
  pathParameters: external_exports.array(external_exports.string().trim().min(1)).optional(),
@@ -73801,12 +73844,14 @@ var ledgerFileSchema = external_exports.union([
73801
73844
  ledgerRowSchema
73802
73845
  ]);
73803
73846
  var SpendCapError = class extends Error {
73804
- constructor(code, message) {
73847
+ constructor(code, message, details) {
73805
73848
  super(message);
73806
73849
  this.code = code;
73850
+ this.details = details;
73807
73851
  this.name = "SpendCapError";
73808
73852
  }
73809
73853
  code;
73854
+ details;
73810
73855
  };
73811
73856
  function utcDateKey(now = /* @__PURE__ */ new Date()) {
73812
73857
  return now.toISOString().slice(0, 10);
@@ -73888,7 +73933,8 @@ async function reserveSpend(amountAtomic2, caps, options) {
73888
73933
  if (amountAtomic2 > perCallAtomic) {
73889
73934
  throw new SpendCapError(
73890
73935
  "per_call_cap_exceeded",
73891
- `Payment quote ${amountAtomic2} atomic USDC exceeds the per-call cap ${perCallAtomic}. Refusing to sign.`
73936
+ `Payment quote ${amountAtomic2} atomic USDC exceeds the per-call cap ${perCallAtomic}. Refusing to sign.`,
73937
+ { amountAtomic: amountAtomic2, limitAtomic: perCallAtomic, wallet: options?.wallet }
73892
73938
  );
73893
73939
  }
73894
73940
  }
@@ -73977,7 +74023,8 @@ async function reserveSpend(amountAtomic2, caps, options) {
73977
74023
  if (nextSpent > perDayAtomic) {
73978
74024
  throw new SpendCapError(
73979
74025
  "per_day_cap_exceeded",
73980
- `${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
+ `${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.`,
74027
+ { amountAtomic: amountAtomic2, limitAtomic: perDayAtomic, spentAtomic: BigInt(spentAtomic), wallet }
73981
74028
  );
73982
74029
  }
73983
74030
  const reservationId = options?.reservationId ?? (options?.taskKey === void 0 ? void 0 : randomBytes10(16).toString("hex"));
@@ -76933,6 +76980,96 @@ function parseAtomic(value, label) {
76933
76980
  throw new Error(`Invalid ${label} atomic amount.`);
76934
76981
  }
76935
76982
 
76983
+ // ../core/src/spend-cap-exceeded.ts
76984
+ var SpendCapExceededError = class extends Error {
76985
+ name = "SpendCapExceededError";
76986
+ code = "spend_cap_exceeded";
76987
+ retryable = false;
76988
+ cap;
76989
+ amountUsd;
76990
+ limitUsd;
76991
+ spentUsd;
76992
+ wallet;
76993
+ command;
76994
+ constructor(input2) {
76995
+ const amountUsd = normalizeUsd(input2.amountUsd);
76996
+ const limitUsd = normalizeUsd(input2.limitUsd);
76997
+ const spentUsd = input2.spentUsd === void 0 ? void 0 : normalizeUsd(input2.spentUsd);
76998
+ const wallet = input2.wallet?.trim() || void 0;
76999
+ const command = input2.command === void 0 ? spendCapCommand(input2.cap, amountUsd, spentUsd, wallet, input2.perDayLimitUsd) : input2.command;
77000
+ super(
77001
+ input2.message ?? spendCapMessage(input2.cap, amountUsd, limitUsd, spentUsd, wallet, command),
77002
+ input2.cause === void 0 ? void 0 : { cause: input2.cause }
77003
+ );
77004
+ this.cap = input2.cap;
77005
+ this.amountUsd = amountUsd;
77006
+ this.limitUsd = limitUsd;
77007
+ this.spentUsd = spentUsd;
77008
+ this.wallet = wallet;
77009
+ this.command = command;
77010
+ }
77011
+ toJSON() {
77012
+ return {
77013
+ code: this.code,
77014
+ cap: this.cap,
77015
+ amountUsd: this.amountUsd,
77016
+ limitUsd: this.limitUsd,
77017
+ ...this.spentUsd === void 0 ? {} : { spentUsd: this.spentUsd },
77018
+ ...this.wallet === void 0 ? {} : { wallet: this.wallet },
77019
+ command: this.command,
77020
+ message: this.message
77021
+ };
77022
+ }
77023
+ };
77024
+ function spendCapCommand(cap, amountUsd, spentUsd, wallet, perDayLimitUsd) {
77025
+ const account = wallet ?? "<account>";
77026
+ if (cap === "per_call") {
77027
+ const scale = Math.max(fractionLength(amountUsd), fractionLength(perDayLimitUsd ?? "0"));
77028
+ const raiseDay = perDayLimitUsd !== void 0 && parseDecimal(amountUsd, scale) > parseDecimal(perDayLimitUsd, scale);
77029
+ return `vapi accounts caps ${account} --per-call ${amountUsd}${raiseDay ? ` --per-day ${amountUsd}` : ""}`;
77030
+ }
77031
+ if (cap === "per_day") {
77032
+ return `vapi accounts caps ${account} --per-day ${addUsd(spentUsd ?? "0", amountUsd)}`;
77033
+ }
77034
+ if (cap === "max_price") {
77035
+ return `--max ${amountUsd}`;
77036
+ }
77037
+ if (cap === "run_budget") {
77038
+ const budget = addUsd(spentUsd ?? "0", amountUsd);
77039
+ return `--budget ${budget}`;
77040
+ }
77041
+ return null;
77042
+ }
77043
+ function spendCapMessage(cap, amountUsd, limitUsd, spentUsd, wallet, command) {
77044
+ 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";
77045
+ const account = cap === "per_call" || cap === "per_day" ? ` of account ${wallet ?? "<account>"}` : "";
77046
+ 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}`;
77047
+ 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:";
77048
+ const action = command === null ? "" : `${guidance} ${command}`;
77049
+ return `Blocked by the ${capName}${account}: ${payment}. Nothing was signed.${action}`;
77050
+ }
77051
+ function normalizeUsd(value) {
77052
+ const trimmed = value.trim();
77053
+ if (!trimmed.includes(".")) return trimmed;
77054
+ const normalized = trimmed.replace(/0+$/u, "").replace(/\.$/u, "");
77055
+ return normalized || "0";
77056
+ }
77057
+ function addUsd(left, right) {
77058
+ const scale = Math.max(fractionLength(left), fractionLength(right));
77059
+ const factor = 10n ** BigInt(scale);
77060
+ const total = parseDecimal(left, scale) + parseDecimal(right, scale);
77061
+ const whole = total / factor;
77062
+ const fraction = (total % factor).toString().padStart(scale, "0").replace(/0+$/u, "");
77063
+ return fraction ? `${whole}.${fraction}` : whole.toString();
77064
+ }
77065
+ function fractionLength(value) {
77066
+ return value.split(".")[1]?.length ?? 0;
77067
+ }
77068
+ function parseDecimal(value, scale) {
77069
+ const [whole = "0", fraction = ""] = value.split(".");
77070
+ return BigInt(whole) * 10n ** BigInt(scale) + BigInt(fraction.padEnd(scale, "0") || "0");
77071
+ }
77072
+
76936
77073
  // ../core/src/swarm.ts
76937
77074
  import { readdir as readdir6, readFile as readFile15, stat as stat11, unlink as unlink11 } from "node:fs/promises";
76938
77075
  import { join as join12 } from "node:path";
@@ -77604,7 +77741,7 @@ function createRunBudget(args) {
77604
77741
  import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
77605
77742
  import { arch, platform, release } from "node:os";
77606
77743
  import { join as join13 } from "node:path";
77607
- var VAPI_CLIENT_VERSION = "0.10.0";
77744
+ var VAPI_CLIENT_VERSION = "0.11.0";
77608
77745
  async function createSupportReport(options) {
77609
77746
  const message = options.message.trim();
77610
77747
  if (!message) throw new Error("Support report message must not be empty.");
@@ -77799,8 +77936,28 @@ async function completeX402Payment(args) {
77799
77936
  }
77800
77937
  args.challenge.request.signal.throwIfAborted();
77801
77938
  if (trace) trace.capsApplied = true;
77802
- assertMaximumAtomic(quote.amountAtomic, args.maxAtomic);
77803
- assertMaxPrice(quote.amountAtomic, args.maxPriceUsd);
77939
+ try {
77940
+ assertMaximumAtomic(quote.amountAtomic, args.maxAtomic);
77941
+ } catch (error61) {
77942
+ if (args.maxAtomic !== void 0 && isErrorCode(error61, "max_price_exceeded")) {
77943
+ throw paymentCapError("max_amount", quote.amountAtomic, args.maxAtomic, args, error61);
77944
+ }
77945
+ throw error61;
77946
+ }
77947
+ try {
77948
+ assertMaxPrice(quote.amountAtomic, args.maxPriceUsd);
77949
+ } catch (error61) {
77950
+ if (args.maxPriceUsd !== void 0 && isErrorCode(error61, "max_price_exceeded")) {
77951
+ throw paymentCapError(
77952
+ "max_price",
77953
+ quote.amountAtomic,
77954
+ usdToAtomic(args.maxPriceUsd),
77955
+ args,
77956
+ error61
77957
+ );
77958
+ }
77959
+ throw error61;
77960
+ }
77804
77961
  const spendReservation = {
77805
77962
  ledgerPath: args.ledgerPath ?? getVapiPaths().ledger,
77806
77963
  now: args.now,
@@ -77809,18 +77966,42 @@ async function completeX402Payment(args) {
77809
77966
  let reservationId;
77810
77967
  let reservedOn;
77811
77968
  if (args.runBudget === void 0) {
77812
- await reserveSpend(quote.amountAtomic, args.caps, spendReservation);
77969
+ try {
77970
+ await reserveSpend(quote.amountAtomic, args.caps, spendReservation);
77971
+ } catch (error61) {
77972
+ throw walletCapError(error61, quote.amountAtomic, args);
77973
+ }
77813
77974
  } else {
77814
77975
  reservationId = args.paymentId ?? `x402_${randomBytes14(12).toString("hex")}`;
77815
- const reservation = await reserveSpend(quote.amountAtomic, args.caps, {
77816
- ...spendReservation,
77817
- reservationId
77818
- });
77976
+ let reservation;
77977
+ try {
77978
+ reservation = await reserveSpend(quote.amountAtomic, args.caps, {
77979
+ ...spendReservation,
77980
+ reservationId
77981
+ });
77982
+ } catch (error61) {
77983
+ throw walletCapError(error61, quote.amountAtomic, args);
77984
+ }
77819
77985
  reservedOn = reservation.date;
77820
77986
  try {
77821
77987
  args.runBudget.reserve(quote.amountAtomic, reservationId);
77822
77988
  } catch (error61) {
77823
- await releaseUnsentReservation(args, quote.amountAtomic, reservationId, reservedOn);
77989
+ let runSpentAtomic;
77990
+ try {
77991
+ runSpentAtomic = args.runBudget.spentAtomic();
77992
+ } finally {
77993
+ await releaseUnsentReservation(args, quote.amountAtomic, reservationId, reservedOn);
77994
+ }
77995
+ if (error61 instanceof RunBudgetError || isErrorCode(error61, "run_budget_exceeded")) {
77996
+ throw new SpendCapExceededError({
77997
+ cap: "run_budget",
77998
+ amountUsd: formatUsdc(quote.amountAtomic),
77999
+ limitUsd: formatUsdc(args.runBudget.limitAtomic),
78000
+ spentUsd: formatUsdc(runSpentAtomic),
78001
+ ...args.wallet === void 0 ? {} : { wallet: args.wallet },
78002
+ cause: error61
78003
+ });
78004
+ }
77824
78005
  throw error61;
77825
78006
  }
77826
78007
  }
@@ -78103,6 +78284,18 @@ function sanitizeThrownError(error61, secrets) {
78103
78284
  if (!(error61 instanceof Error)) return error61;
78104
78285
  const message = redactKnownSecrets(error61.message, secrets);
78105
78286
  const cause = error61.cause === void 0 ? void 0 : sanitizeThrownError(error61.cause, secrets);
78287
+ if (error61 instanceof SpendCapExceededError) {
78288
+ return new SpendCapExceededError({
78289
+ cap: error61.cap,
78290
+ amountUsd: error61.amountUsd,
78291
+ limitUsd: error61.limitUsd,
78292
+ ...error61.spentUsd === void 0 ? {} : { spentUsd: error61.spentUsd },
78293
+ ...error61.wallet === void 0 ? {} : { wallet: error61.wallet },
78294
+ command: error61.command,
78295
+ message,
78296
+ ...cause === void 0 ? {} : { cause }
78297
+ });
78298
+ }
78106
78299
  if (message === error61.message && cause === error61.cause) return error61;
78107
78300
  if (error61 instanceof X402Error) {
78108
78301
  return new X402Error(error61.code, message, cause === void 0 ? void 0 : { cause });
@@ -78204,6 +78397,43 @@ function assertMaximumAtomic(amountAtomic2, maxAtomic) {
78204
78397
  );
78205
78398
  }
78206
78399
  }
78400
+ function walletCapError(error61, amountAtomic2, args) {
78401
+ if (!(error61 instanceof SpendCapError)) return error61;
78402
+ if (error61.code === "per_call_cap_exceeded") {
78403
+ return paymentCapError(
78404
+ "per_call",
78405
+ amountAtomic2,
78406
+ error61.details?.limitAtomic ?? BigInt(args.caps.perCallAtomic),
78407
+ args,
78408
+ error61
78409
+ );
78410
+ }
78411
+ if (error61.code === "per_day_cap_exceeded") {
78412
+ return paymentCapError(
78413
+ "per_day",
78414
+ amountAtomic2,
78415
+ error61.details?.limitAtomic ?? BigInt(args.caps.perDayAtomic),
78416
+ args,
78417
+ error61,
78418
+ error61.details?.spentAtomic
78419
+ );
78420
+ }
78421
+ return error61;
78422
+ }
78423
+ function paymentCapError(cap, amountAtomic2, limitAtomic, args, cause, spentAtomic) {
78424
+ return new SpendCapExceededError({
78425
+ cap,
78426
+ amountUsd: formatUsdc(amountAtomic2),
78427
+ limitUsd: formatUsdc(limitAtomic),
78428
+ ...cap === "per_call" ? { perDayLimitUsd: formatUsdc(BigInt(args.caps.perDayAtomic)) } : {},
78429
+ ...spentAtomic === void 0 ? {} : { spentUsd: formatUsdc(spentAtomic) },
78430
+ ...args.wallet === void 0 ? {} : { wallet: args.wallet },
78431
+ cause
78432
+ });
78433
+ }
78434
+ function isErrorCode(error61, code) {
78435
+ return typeof error61 === "object" && error61 !== null && Reflect.get(error61, "code") === code;
78436
+ }
78207
78437
  function settlementUnknown(message, quote, payment, payer, receipt, cause) {
78208
78438
  return new X402PaymentError(
78209
78439
  "settlement_unknown",
@@ -78279,7 +78509,7 @@ function receiptQuote(quote) {
78279
78509
  };
78280
78510
  }
78281
78511
  function paymentErrorOutcome(error61) {
78282
- if (error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error && error61.code === "max_price_exceeded") {
78512
+ if (error61 instanceof SpendCapExceededError || error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error && error61.code === "max_price_exceeded") {
78283
78513
  return "declined_policy";
78284
78514
  }
78285
78515
  if (error61 instanceof X402PaymentError) {
@@ -78296,7 +78526,7 @@ function errorCode(error61) {
78296
78526
  return "request_failed";
78297
78527
  }
78298
78528
  function receiptSafeErrorMessage(error61) {
78299
- if (error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error || error61 instanceof X402PaymentError) {
78529
+ if (error61 instanceof SpendCapExceededError || error61 instanceof SpendCapError || error61 instanceof RunBudgetError || error61 instanceof X402Error || error61 instanceof X402PaymentError) {
78300
78530
  return error61.message;
78301
78531
  }
78302
78532
  return "The x402 request failed before it completed.";
@@ -78802,15 +79032,18 @@ function budgetExhaustedError(resetsAt, status) {
78802
79032
  );
78803
79033
  }
78804
79034
  function refillDeclinedDetail(error61) {
79035
+ if (error61 instanceof SpendCapExceededError) return `${error61.name}: ${error61.cap}`;
78805
79036
  if (error61 instanceof SpendCapError) return `${error61.name}: ${error61.code}`;
78806
- if (isRunBudgetError(error61)) return `RunBudgetError: ${error61.code}`;
79037
+ if (isRunBudgetError(error61)) {
79038
+ return error61.code === "spend_cap_exceeded" ? "SpendCapExceededError: run_budget" : `RunBudgetError: ${error61.code}`;
79039
+ }
78807
79040
  if (error61 instanceof RouterClientError) {
78808
79041
  return `${error61.name}: ${error61.code}${error61.status === void 0 ? "" : ` (${error61.status})`}`;
78809
79042
  }
78810
79043
  return "Error: Router balance refill failed.";
78811
79044
  }
78812
79045
  function isRunBudgetError(error61) {
78813
- return typeof error61 === "object" && error61 !== null && Reflect.get(error61, "code") === "run_budget_exceeded";
79046
+ 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");
78814
79047
  }
78815
79048
  function isRouterTopupTier(value) {
78816
79049
  return ROUTER_TOPUP_TIERS.some((tier) => tier === value);
@@ -84852,6 +85085,11 @@ function safeOrigin2(value) {
84852
85085
  }
84853
85086
  }
84854
85087
 
85088
+ // ../core/src/listing-fee.ts
85089
+ function formatListingFee(fee) {
85090
+ return fee.bps === 0 ? "No network fee" : `${fee.label} (${fee.bps / 100}%)`;
85091
+ }
85092
+
84855
85093
  // ../core/src/onramp.ts
84856
85094
  var ONRAMP_NETWORK = "base";
84857
85095
  var ONRAMP_FALLBACK_INSTRUCTIONS = "Send USDC on Base (eip155:8453) to this address; add a little ETH for gas if you plan to sweep.";
@@ -87682,7 +87920,8 @@ async function searchMarketplace(input2, config2, fetchImpl, options = {}) {
87682
87920
  network: input2.network,
87683
87921
  limit: input2.limit,
87684
87922
  cursor: input2.cursor,
87685
- includeUnverified: input2.includeUnverified
87923
+ includeUnverified: input2.includeUnverified,
87924
+ includeOutage: input2.includeOutage
87686
87925
  });
87687
87926
  const startedAt = options.now ?? /* @__PURE__ */ new Date();
87688
87927
  const attempts = [];
@@ -87704,6 +87943,9 @@ async function searchMarketplace(input2, config2, fetchImpl, options = {}) {
87704
87943
  if (normalized.includeUnverified === true) {
87705
87944
  url2.searchParams.set("includeUnverified", "true");
87706
87945
  }
87946
+ if (normalized.includeOutage === true) {
87947
+ url2.searchParams.set("includeOutage", "true");
87948
+ }
87707
87949
  }
87708
87950
  });
87709
87951
  const envelope = marketplaceDiscoveryEnvelopeSchema.parse(await response.json());
@@ -87748,7 +87990,7 @@ async function resolveServiceListing(id2, config2, fetchImpl, endpointName) {
87748
87990
  }
87749
87991
  async function findMarketplaceApiByRef(ref, config2, fetchImpl) {
87750
87992
  const page = await searchMarketplace(
87751
- { query: ref, kinds: ["api"], limit: 50, includeUnverified: true },
87993
+ { query: ref, kinds: ["api"], limit: 50, includeUnverified: true, includeOutage: true },
87752
87994
  config2,
87753
87995
  fetchImpl
87754
87996
  );
@@ -87766,6 +88008,7 @@ async function fetchCallsDiscovery(query, config2, fetchImpl) {
87766
88008
  configureUrl(url2) {
87767
88009
  url2.searchParams.set("q", query);
87768
88010
  url2.searchParams.set("includeUnverified", "true");
88011
+ url2.searchParams.set("includeOutage", "true");
87769
88012
  }
87770
88013
  });
87771
88014
  return parseDiscovery(await response.json());
@@ -87838,6 +88081,18 @@ function isEnotfound(error61) {
87838
88081
  return false;
87839
88082
  }
87840
88083
 
88084
+ // ../mcp/src/tools/search.ts
88085
+ async function searchMarketplace2(...args) {
88086
+ const page = await searchMarketplace(...args);
88087
+ return {
88088
+ ...page,
88089
+ items: page.items.map((item) => ({
88090
+ ...item,
88091
+ ...item.fee === void 0 ? {} : { feeDisplay: formatListingFee(item.fee) }
88092
+ }))
88093
+ };
88094
+ }
88095
+
87841
88096
  // ../mcp/src/tools/call.ts
87842
88097
  var VapiCallError = class extends Error {
87843
88098
  constructor(code, message, possibleSettlement2, options) {
@@ -88348,7 +88603,7 @@ function receiptContext(args, trace, resourceUrl) {
88348
88603
  };
88349
88604
  }
88350
88605
  function errorOutcome(error61, code) {
88351
- if (code === "max_price_exceeded" || code.includes("cap_exceeded")) {
88606
+ if (error61 instanceof SpendCapExceededError || code === "max_price_exceeded" || code.includes("cap_exceeded")) {
88352
88607
  return "declined_policy";
88353
88608
  }
88354
88609
  if (error61 instanceof VapiCallError) {
@@ -88690,6 +88945,7 @@ function paidRequestTimeoutMs(timeoutSeconds, internalTimeoutMs, offerTimeoutSec
88690
88945
  return usableOfferTimeout === void 0 ? 12e4 : Math.min(12e4, Math.max(3e4, usableOfferTimeout * 1e3));
88691
88946
  }
88692
88947
  function mapX402PaymentError(error61, resumeId) {
88948
+ if (error61 instanceof SpendCapExceededError) return error61;
88693
88949
  if (!(error61 instanceof X402PaymentError)) return error61;
88694
88950
  if (error61.code === "payment_rejected") {
88695
88951
  return new VapiCallError("payment_rejected", error61.message, void 0, {
@@ -88749,9 +89005,11 @@ async function inspectService(input2, config2, fetchImpl) {
88749
89005
  ...endpoint.operationId === void 0 ? {} : { operationId: endpoint.operationId },
88750
89006
  ...endpoint.requestContentType === void 0 ? {} : { requestContentType: endpoint.requestContentType },
88751
89007
  ...endpoint.requestSchema === void 0 ? {} : { requestSchema: endpoint.requestSchema },
89008
+ ...endpoint.responseSchema === void 0 ? {} : { responseSchema: endpoint.responseSchema },
89009
+ ...endpoint.exampleRequest === void 0 ? {} : { exampleRequest: endpoint.exampleRequest },
88752
89010
  ...endpoint.responseContentType === void 0 ? {} : { responseContentType: endpoint.responseContentType },
88753
89011
  ...service.group === void 0 ? {} : { group: service.group },
88754
- ...service.fee === void 0 ? {} : { fee: service.fee },
89012
+ ...service.fee === void 0 ? {} : { fee: service.fee, feeDisplay: formatListingFee(service.fee) },
88755
89013
  verification: service.verification,
88756
89014
  ...healthOf(service),
88757
89015
  payment: endpoint.payment ?? null
@@ -88766,14 +89024,16 @@ function inspectIndexedHit(hit) {
88766
89024
  description: hit.card.summary,
88767
89025
  network: hit.execution.network,
88768
89026
  ...hit.group === void 0 ? {} : { group: hit.group },
88769
- ...hit.fee === void 0 ? {} : { fee: hit.fee },
89027
+ ...hit.fee === void 0 ? {} : { fee: hit.fee, feeDisplay: formatListingFee(hit.fee) },
88770
89028
  verification: hit.verification,
88771
89029
  ...healthOf(hit),
88772
89030
  payment: null
88773
89031
  };
88774
89032
  }
88775
89033
  function healthOf(listing) {
89034
+ const health = listingHealthSchema.optional().catch(void 0).parse(listing.health);
88776
89035
  return {
89036
+ ...health === void 0 ? {} : { health },
88777
89037
  ...listing.liveness === void 0 ? {} : { liveness: listing.liveness },
88778
89038
  ...listing.conformance === void 0 ? {} : { conformance: listing.conformance },
88779
89039
  ...listing.identity === void 0 ? {} : { identity: listing.identity }
@@ -88792,6 +89052,160 @@ function inspectionCacheKey(input2) {
88792
89052
  return JSON.stringify([input2.id, input2.endpoint ?? null]);
88793
89053
  }
88794
89054
 
89055
+ // ../mcp/src/actions/hints.ts
89056
+ function searchHints(page, options) {
89057
+ const hints = [];
89058
+ const apis = page.items.filter((hit) => hit.kind === "api");
89059
+ const payable = apis.find(
89060
+ (hit) => hit.action.type === "invoke_api" && hit.execution.payable !== false
89061
+ );
89062
+ if (payable) {
89063
+ hints.push(
89064
+ `Inspect before paying: ${renderAction(options.surface, "inspect", { id: payable.ref })}`
89065
+ );
89066
+ }
89067
+ hints.push(
89068
+ ...apis.flatMap(
89069
+ (hit) => (hit.alternatives ?? []).map((alternative) => {
89070
+ const reason = alternative.reason === "cheaper" ? "cheaper healthy" : "healthier";
89071
+ return `${hit.ref} has a ${reason} alternative: ${alternative.ref}`;
89072
+ })
89073
+ ).slice(0, 2)
89074
+ );
89075
+ const hiddenOutage = page.totals?.hiddenOutage ?? 0;
89076
+ if (options.includeOutage !== true && hiddenOutage > 0) {
89077
+ const count = hiddenOutage === 1 ? "1 listing in outage is" : `${hiddenOutage} listings in outage are`;
89078
+ hints.push(
89079
+ options.surface === "cli" ? `${count} hidden; add --include-outage to show them.` : `${count} hidden; call with includeOutage: true to show them.`
89080
+ );
89081
+ }
89082
+ if (page.items.length === 0) {
89083
+ hints.push(
89084
+ `Broaden your search with: ${renderAction(options.surface, "search", { includeUnverified: true })}`
89085
+ );
89086
+ }
89087
+ return hints.slice(0, 4);
89088
+ }
89089
+ function inspectHints(result, options) {
89090
+ const hints = [];
89091
+ if (result.health?.state === "degraded" || result.health?.state === "outage") {
89092
+ hints.push(
89093
+ 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 })}`
89094
+ );
89095
+ }
89096
+ if (typeof result.payment?.protocol === "string") {
89097
+ hints.push(
89098
+ `This payment protocol is not supported; find another API with: ${renderAction(options.surface, "search", {})}`
89099
+ );
89100
+ return hints;
89101
+ }
89102
+ const query = result.exampleRequest?.query;
89103
+ const hasQuery = query !== void 0 && Object.keys(query).length > 0;
89104
+ const queryInBody = result.method === "GET" || result.method === "HEAD";
89105
+ let body = result.exampleRequest?.body;
89106
+ if (queryInBody && hasQuery) {
89107
+ body = { ...isRecord6(body) ? body : {}, ...query };
89108
+ }
89109
+ if (body === void 0) body = requiredBody(result.requestSchema);
89110
+ if (options.surface === "agent" && !queryInBody && hasQuery) {
89111
+ hints.push(
89112
+ `This example needs URL query parameters; find another API with: ${renderAction(options.surface, "search", {})}`
89113
+ );
89114
+ } else if (options.surface === "agent" && (exactPrice(result.price) === void 0 || result.method === null)) {
89115
+ hints.push(
89116
+ `Find an API with a published price and method: ${renderAction(options.surface, "search", {})}`
89117
+ );
89118
+ } else {
89119
+ const queryUrl = !queryInBody && hasQuery ? new URL(result.url) : void 0;
89120
+ if (queryUrl) {
89121
+ for (const [key2, value] of Object.entries(query)) queryUrl.searchParams.set(key2, value);
89122
+ }
89123
+ const direct = queryUrl !== void 0 || result.network !== void 0 || /^https?:\/\//u.test(options.ref);
89124
+ hints.push(
89125
+ `Pay with: ${renderAction(
89126
+ options.surface,
89127
+ "pay",
89128
+ {
89129
+ ...queryUrl === void 0 ? { id: options.ref } : { url: queryUrl.href },
89130
+ ...!direct && result.name ? { endpoint: result.name } : {},
89131
+ ...direct ? { method: result.method ?? "<method>" } : {},
89132
+ body,
89133
+ ...queryUrl !== void 0 && result.requestContentType !== void 0 ? { contentType: result.requestContentType } : {},
89134
+ ...queryUrl !== void 0 && result.payment?.network !== void 0 ? { network: result.payment.network } : {},
89135
+ ...queryUrl !== void 0 && result.payment?.payTo !== void 0 ? { expectedPayTo: result.payment.payTo } : {}
89136
+ },
89137
+ result.price
89138
+ )}`
89139
+ );
89140
+ }
89141
+ return hints;
89142
+ }
89143
+ function payHints(result, options) {
89144
+ const hints = [];
89145
+ const settlementUnknown2 = result.outcome === "settlement_unknown";
89146
+ if (result.status >= 200 && result.status < 300 && !settlementUnknown2) {
89147
+ if (options.surface === "cli") {
89148
+ hints.push(
89149
+ `Receipt saved; review it with: vapi receipts --limit 1${result.wallet ? ` --account ${shellWord(result.wallet)}` : ""}`
89150
+ );
89151
+ } else if (options.surface === "mcp") {
89152
+ hints.push(
89153
+ `Receipt saved; review it with: receipts.list ${JSON.stringify({ limit: 1, ...result.wallet ? { wallet: result.wallet } : {} })}`
89154
+ );
89155
+ } else if (options.ref) {
89156
+ hints.push(
89157
+ `Review the request contract with: ${renderAction(options.surface, "inspect", { id: options.ref })}`
89158
+ );
89159
+ }
89160
+ return hints;
89161
+ }
89162
+ if (options.ref) {
89163
+ hints.push(
89164
+ `The provider answered ${result.status}; check the request contract with: ${renderAction(options.surface, "inspect", { id: options.ref })}`
89165
+ );
89166
+ }
89167
+ const receiptId = options.receiptId ?? result.receiptId;
89168
+ if ((result.status === 402 || settlementUnknown2) && receiptId && options.surface === "cli") {
89169
+ hints.push(`Check settlement with: vapi pay --resume ${shellWord(receiptId)}`);
89170
+ }
89171
+ return hints;
89172
+ }
89173
+ function renderAction(surface, action, args, price) {
89174
+ if (surface === "agent") {
89175
+ 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 ?? "") };
89176
+ return `call_${action} ${JSON.stringify(loopArgs)}`;
89177
+ }
89178
+ if (surface === "mcp") return `call.${action} ${JSON.stringify(args)}`;
89179
+ if (action === "search") return "vapi search --include-unverified";
89180
+ const command = `vapi ${action} ${shellWord(args.url ?? args.id ?? "")}`;
89181
+ if (action === "inspect") return command;
89182
+ const endpoint = args.endpoint ? ` --endpoint ${shellWord(args.endpoint)}` : "";
89183
+ const method = args.method ? ` --method ${shellWord(args.method)}` : "";
89184
+ const headers = args.contentType ? ` --content-type ${shellWord(args.contentType)}` : "";
89185
+ const network = args.network ? ` --network ${shellWord(args.network)}` : "";
89186
+ const payee = args.expectedPayTo ? ` --expected-pay-to ${shellWord(args.expectedPayTo)}` : "";
89187
+ return `${command}${endpoint}${method} --body ${shellQuote(args.body === "<json>" ? "<json>" : JSON.stringify(args.body) ?? "<json>")}${headers}${network}${payee}`;
89188
+ }
89189
+ function exactPrice(price) {
89190
+ if (!/^\$(0|[1-9]\d*)(?:\.\d{1,6})?$/u.test(price.trim())) return void 0;
89191
+ const value = Number(price.trim().slice(1));
89192
+ return Number.isFinite(value) ? value : void 0;
89193
+ }
89194
+ function requiredBody(schema) {
89195
+ if (!isRecord6(schema) || !Array.isArray(schema.required)) return "<json>";
89196
+ const names = schema.required.filter((name) => typeof name === "string");
89197
+ return names.length > 0 ? Object.fromEntries(names.map((name) => [name, "<value>"])) : "<json>";
89198
+ }
89199
+ function isRecord6(value) {
89200
+ return typeof value === "object" && value !== null && !Array.isArray(value);
89201
+ }
89202
+ function shellWord(value) {
89203
+ return /^[a-zA-Z0-9_./:@%-]+$/u.test(value) ? value : shellQuote(value);
89204
+ }
89205
+ function shellQuote(value) {
89206
+ return `'${value.replaceAll("'", "'\\''")}'`;
89207
+ }
89208
+
88795
89209
  // ../mcp/src/actions/call.ts
88796
89210
  var MAX_CACHED_MARKETPLACE_REFS = 200;
88797
89211
  var walletArgument = {
@@ -88800,6 +89214,7 @@ var walletArgument = {
88800
89214
  )
88801
89215
  };
88802
89216
  var callToolResultSchema = external_exports.object({
89217
+ hints: external_exports.array(external_exports.string()).max(4),
88803
89218
  wallet: external_exports.string(),
88804
89219
  status: external_exports.number().int(),
88805
89220
  body: external_exports.unknown(),
@@ -88822,6 +89237,7 @@ var callToolResultSchema = external_exports.object({
88822
89237
  }).optional()
88823
89238
  });
88824
89239
  var inspectToolResultSchema = external_exports.object({
89240
+ hints: external_exports.array(external_exports.string()).max(4),
88825
89241
  name: external_exports.string(),
88826
89242
  method: external_exports.string().nullable(),
88827
89243
  url: external_exports.url(),
@@ -88830,13 +89246,17 @@ var inspectToolResultSchema = external_exports.object({
88830
89246
  operationId: external_exports.string().optional(),
88831
89247
  requestContentType: external_exports.string().optional(),
88832
89248
  requestSchema: external_exports.unknown().optional(),
89249
+ responseSchema: discoveryEndpointSchema.shape.responseSchema,
89250
+ exampleRequest: discoveryEndpointSchema.shape.exampleRequest,
88833
89251
  responseContentType: external_exports.string().optional(),
88834
89252
  network: external_exports.string().optional(),
88835
89253
  // Registry-owned listing disclosures, mirrored from call.search.
88836
89254
  group: listingGroupSchema.optional(),
88837
89255
  fee: listingFeeSchema.optional(),
89256
+ feeDisplay: external_exports.string().optional(),
88838
89257
  verification: listingVerificationSchema,
88839
89258
  liveness: listingLivenessSchema.optional(),
89259
+ health: listingHealthSchema.optional().catch(void 0),
88840
89260
  conformance: listingConformanceSchema.optional(),
88841
89261
  identity: listingIdentitySchema.optional(),
88842
89262
  payment: discoveryEndpointSchema.shape.payment.unwrap().nullable()
@@ -88849,6 +89269,9 @@ var callSearchInputSchema = external_exports.object({
88849
89269
  cursor: external_exports.string().trim().min(1).max(4096).optional(),
88850
89270
  includeUnverified: external_exports.boolean().optional().describe(
88851
89271
  "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."
89272
+ ),
89273
+ includeOutage: external_exports.boolean().optional().describe(
89274
+ "Default results hide listings whose recent health checks show an outage; includeOutage: true shows them."
88852
89275
  )
88853
89276
  });
88854
89277
  var callInspectInputSchema = external_exports.object({
@@ -88873,11 +89296,14 @@ var callPayInputSchema = external_exports.object({
88873
89296
  "Seconds to wait for the paid response. Default: the provider's maxTimeoutSeconds, at most 120."
88874
89297
  )
88875
89298
  });
89299
+ var callSearchOutputSchema = marketplaceDiscoveryPageSchema.extend({
89300
+ hints: external_exports.array(external_exports.string()).max(4)
89301
+ });
88876
89302
  var callSearch = defineAction({
88877
89303
  name: "call.search",
88878
89304
  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.",
88879
89305
  input: callSearchInputSchema,
88880
- output: marketplaceDiscoveryPageSchema,
89306
+ output: callSearchOutputSchema,
88881
89307
  money: "none",
88882
89308
  grant: "call",
88883
89309
  async run(input2, ctx) {
@@ -88885,7 +89311,13 @@ var callSearch = defineAction({
88885
89311
  if (ctx.caller.run) {
88886
89312
  for (const item of page.items) ctx.caller.run.searchedRefs.add(item.ref);
88887
89313
  }
88888
- return page;
89314
+ return {
89315
+ ...page,
89316
+ hints: searchHints(page, {
89317
+ surface: ctx.caller.surface,
89318
+ ...input2.includeOutage === void 0 ? {} : { includeOutage: input2.includeOutage }
89319
+ })
89320
+ };
88889
89321
  }
88890
89322
  });
88891
89323
  var callInspect = defineAction({
@@ -88898,10 +89330,13 @@ var callInspect = defineAction({
88898
89330
  async run(input2, ctx) {
88899
89331
  const cacheKey2 = inspectionCacheKey(input2);
88900
89332
  const cached2 = ctx.caller.run?.inspected.get(cacheKey2);
88901
- if (cached2) return cached2;
88902
- const result = await ctx.call.inspect(input2);
88903
- ctx.caller.run?.inspected.set(cacheKey2, result);
88904
- return result;
89333
+ const result = cached2 ?? await ctx.call.inspect(input2);
89334
+ if (!cached2) ctx.caller.run?.inspected.set(cacheKey2, result);
89335
+ return {
89336
+ ...result,
89337
+ payment: result.payment ?? null,
89338
+ hints: inspectHints(result, { ref: input2.id, surface: ctx.caller.surface })
89339
+ };
88905
89340
  }
88906
89341
  });
88907
89342
  var callPay = defineAction({
@@ -88912,14 +89347,22 @@ var callPay = defineAction({
88912
89347
  money: "spends",
88913
89348
  grant: "call",
88914
89349
  async run(input2, ctx) {
88915
- return await ctx.call.pay(input2);
89350
+ const result = await ctx.call.pay(input2);
89351
+ return {
89352
+ ...result,
89353
+ hints: payHints(result, {
89354
+ surface: ctx.caller.surface,
89355
+ ...input2.id === void 0 ? {} : { ref: input2.id },
89356
+ ...input2.url === void 0 ? {} : { url: input2.url }
89357
+ })
89358
+ };
88916
89359
  }
88917
89360
  });
88918
89361
  function createCallPort(options) {
88919
89362
  const searchedMarketplaceHits = options.cacheMarketplaceHits ? /* @__PURE__ */ new Map() : void 0;
88920
89363
  return {
88921
89364
  async search(input2) {
88922
- const page = await searchMarketplace(input2, options.config, options.fetchImpl, {
89365
+ const page = await searchMarketplace2(input2, options.config, options.fetchImpl, {
88923
89366
  ...options.searchesPath === void 0 ? {} : { searchesPath: options.searchesPath },
88924
89367
  ...options.notice === void 0 ? {} : { notice: options.notice }
88925
89368
  });
@@ -89376,6 +89819,15 @@ async function checkAction(action, input2, ctx, options = {}) {
89376
89819
  }
89377
89820
  const priceUsd = exactUsdcPrice(listing.price);
89378
89821
  const profile = ctx.caller.profile;
89822
+ if (priceUsd !== null && ctx.caps !== void 0 && priceUsd > ctx.caps.perCallUsd) {
89823
+ throw new SpendCapExceededError({
89824
+ cap: "per_call",
89825
+ amountUsd: listing.price.trim().slice(1),
89826
+ limitUsd: String(ctx.caps.perCallUsd),
89827
+ ...ctx.caps.perDayUsd === void 0 ? {} : { perDayLimitUsd: ctx.caps.perDayUsd },
89828
+ wallet: profile.wallet
89829
+ });
89830
+ }
89379
89831
  const decision = decidePayment({
89380
89832
  ref,
89381
89833
  priceUsd,
@@ -89396,10 +89848,12 @@ async function checkAction(action, input2, ctx, options = {}) {
89396
89848
  }
89397
89849
  const maxUsd = Number(input2.maxPriceUsd);
89398
89850
  if (priceUsd !== null && maxUsd < priceUsd) {
89399
- return {
89400
- kind: "deny",
89401
- reason: `Requested maximum $${maxUsd} is below the listing price $${priceUsd}.`
89402
- };
89851
+ throw new SpendCapExceededError({
89852
+ cap: "max_price",
89853
+ amountUsd: listing.price.trim().slice(1),
89854
+ limitUsd: String(maxUsd),
89855
+ wallet: profile.wallet
89856
+ });
89403
89857
  }
89404
89858
  return { kind: "allow" };
89405
89859
  }
@@ -89942,6 +90396,7 @@ function createAgentRunDeps(input2) {
89942
90396
  config: input2.config,
89943
90397
  home: input2.home,
89944
90398
  chat: input2.chat,
90399
+ searchPage: call2.search,
89945
90400
  async search(query) {
89946
90401
  const page = await call2.search(query);
89947
90402
  const rows = page.items.map((hit) => ({
@@ -89990,7 +90445,10 @@ function createAgentRunDeps(input2) {
89990
90445
  network: result.payment?.network ?? listing?.payment?.network ?? listing?.network ?? ""
89991
90446
  };
89992
90447
  },
89993
- caps: { perCallUsd: Number(input2.spendCaps.perCallAtomic) / 1e6 },
90448
+ caps: {
90449
+ perCallUsd: Number(input2.spendCaps.perCallAtomic) / 1e6,
90450
+ perDayUsd: formatUsdc(BigInt(input2.spendCaps.perDayAtomic))
90451
+ },
89994
90452
  approve: input2.approve,
89995
90453
  ...input2.budget === void 0 ? {} : { budget: input2.budget },
89996
90454
  ...input2.runId === void 0 ? {} : { runId: input2.runId },
@@ -90000,6 +90458,7 @@ function createAgentRunDeps(input2) {
90000
90458
  return {
90001
90459
  ...this,
90002
90460
  search: this.search === dependencies.search ? next.search : this.search,
90461
+ searchPage: this.searchPage !== dependencies.searchPage ? this.searchPage : this.search === dependencies.search ? next.searchPage : void 0,
90003
90462
  inspect: this.inspect === dependencies.inspect ? next.inspect : this.inspect,
90004
90463
  read: this.read === dependencies.read ? next.read : this.read,
90005
90464
  pay: this.pay === dependencies.pay ? next.pay : this.pay,
@@ -90031,7 +90490,11 @@ var loopSearchResultSchema = external_exports.array(
90031
90490
  description: external_exports.string().optional()
90032
90491
  })
90033
90492
  );
90034
- var loopPayResultSchema = external_exports.object({ status: external_exports.number(), body: external_exports.unknown() });
90493
+ var loopPayResultSchema = external_exports.object({
90494
+ status: external_exports.number(),
90495
+ body: external_exports.unknown(),
90496
+ hints: external_exports.array(external_exports.string()).max(4)
90497
+ });
90035
90498
  var LOOP_BINDINGS = {
90036
90499
  "call.search": {
90037
90500
  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).",
@@ -90039,25 +90502,32 @@ var LOOP_BINDINGS = {
90039
90502
  type: "object",
90040
90503
  properties: {
90041
90504
  query: { type: "string" },
90042
- network: { type: ["string", "null"] }
90505
+ network: { type: ["string", "null"] },
90506
+ includeOutage: { type: ["boolean", "null"] }
90043
90507
  },
90044
- required: ["query", "network"],
90508
+ required: ["query", "network", "includeOutage"],
90045
90509
  additionalProperties: false
90046
90510
  },
90047
- output: loopSearchResultSchema,
90511
+ output: external_exports.union([callSearchOutputSchema, loopSearchResultSchema]),
90048
90512
  summary: "Search completed.",
90049
90513
  parseArguments(value, deps) {
90050
90514
  const args = parseObjectArgs(value);
90051
90515
  const query = requiredString2(args, "query");
90052
90516
  const network = searchNetwork(nullableString(args, "network"));
90517
+ const includeOutage = args.includeOutage;
90518
+ if (includeOutage !== void 0 && includeOutage !== null && typeof includeOutage !== "boolean") {
90519
+ throw new ToolInputError("includeOutage must be a boolean or null.");
90520
+ }
90053
90521
  return {
90054
90522
  query,
90055
90523
  ...network === null ? {} : { network },
90056
- includeUnverified: !deps.profile.verifiedOnly
90524
+ includeUnverified: !deps.profile.verifiedOnly,
90525
+ ...includeOutage == null ? {} : { includeOutage }
90057
90526
  };
90058
90527
  },
90059
90528
  async run(input2, ctx, execution) {
90060
90529
  const search2 = input2;
90530
+ if (execution.deps.searchPage) return await callSearch.run(search2, ctx);
90061
90531
  const rows = await execution.deps.search(search2);
90062
90532
  for (const row of rows) ctx.caller.run?.searchedRefs.add(row.ref);
90063
90533
  return rows;
@@ -90077,14 +90547,8 @@ var LOOP_BINDINGS = {
90077
90547
  const args = parseObjectArgs(value);
90078
90548
  return { id: requiredString2(args, "ref") };
90079
90549
  },
90080
- async run(input2, ctx, execution) {
90081
- const { id: id2 } = input2;
90082
- const cacheKey2 = inspectionCacheKey({ id: id2 });
90083
- const cached2 = ctx.caller.run?.inspected.get(cacheKey2);
90084
- if (cached2) return cached2;
90085
- const result = await execution.deps.inspect(id2);
90086
- ctx.caller.run?.inspected.set(cacheKey2, result);
90087
- return result;
90550
+ async run(input2, ctx) {
90551
+ return await callInspect.run(input2, ctx);
90088
90552
  }
90089
90553
  },
90090
90554
  "call.pay": {
@@ -90129,7 +90593,8 @@ var LOOP_BINDINGS = {
90129
90593
  }
90130
90594
  return {
90131
90595
  status: execution.payment.status,
90132
- body: execution.payment.body
90596
+ body: execution.payment.body,
90597
+ hints: payHints(execution.payment, { ref: id2, surface: ctx.caller.surface })
90133
90598
  };
90134
90599
  }
90135
90600
  },
@@ -90279,7 +90744,8 @@ async function runAgent(task, deps) {
90279
90744
  config: deps.config,
90280
90745
  clock: deps.now ?? (() => /* @__PURE__ */ new Date()),
90281
90746
  call: {
90282
- async search() {
90747
+ async search(input2) {
90748
+ if (runDeps.searchPage) return await runDeps.searchPage(input2);
90283
90749
  throw new Error("The agent loop uses its reduced search binding.");
90284
90750
  },
90285
90751
  async inspect({ id: id2 }) {
@@ -90424,6 +90890,18 @@ ${UNTRUSTED_NOTICE}` },
90424
90890
  fatalDetail: "The local audit log could not be written."
90425
90891
  };
90426
90892
  }
90893
+ if (error61 instanceof SpendCapExceededError) {
90894
+ const ref2 = paymentRef(input2);
90895
+ const reason = callRunBudgetReason(error61, runDeps.budget) ?? callBudgetReason(error61);
90896
+ if (ref2 !== void 0 && reason !== void 0) {
90897
+ const outcome = await declineSafely(ref2, reason);
90898
+ return outcome.fatalDetail === void 0 ? {
90899
+ ...outcome,
90900
+ fatalDetail: reason,
90901
+ ...error61.cap === "run_budget" ? { fatalReason: "run_budget" } : {}
90902
+ } : outcome;
90903
+ }
90904
+ }
90427
90905
  if (error61 instanceof ActionDeclinedError) {
90428
90906
  const declinedRef = actionDeclineRef(action, input2);
90429
90907
  if (declinedRef !== void 0) {
@@ -90441,7 +90919,8 @@ ${UNTRUSTED_NOTICE}` },
90441
90919
  }
90442
90920
  const runBudgetReason = callRunBudgetReason(error61.paymentError, runDeps.budget);
90443
90921
  if (runBudgetReason !== void 0) {
90444
- return await declineSafely(ref, runBudgetReason);
90922
+ const outcome = await declineSafely(ref, runBudgetReason);
90923
+ return spendCap(error61.paymentError) === "run_budget" ? { ...outcome, fatalDetail: runBudgetReason, fatalReason: "run_budget" } : outcome;
90445
90924
  }
90446
90925
  const spendBudgetReason = callBudgetReason(error61.paymentError);
90447
90926
  if (spendBudgetReason !== void 0) {
@@ -90463,7 +90942,7 @@ ${UNTRUSTED_NOTICE}` },
90463
90942
  try {
90464
90943
  reply = await deps.chat({ model: profile.model, messages, tools, tool_choice: "auto" });
90465
90944
  } catch (error61) {
90466
- if (error61 instanceof RunBudgetError || hasErrorCode(error61, "run_budget_exceeded")) {
90945
+ if (error61 instanceof RunBudgetError || hasErrorCode(error61, "run_budget_exceeded") || spendCap(error61) === "run_budget") {
90467
90946
  return await stop("run_budget", runBudgetDetail(runDeps.budget));
90468
90947
  }
90469
90948
  if (hasErrorCode(error61, "budget_exhausted")) {
@@ -90510,7 +90989,9 @@ ${UNTRUSTED_NOTICE}` },
90510
90989
  name: call2.name,
90511
90990
  summary: toolSummary(call2.name, loopActions)
90512
90991
  });
90513
- if (outcome.fatalDetail) return await stop("error", outcome.fatalDetail);
90992
+ if (outcome.fatalDetail) {
90993
+ return await stop(outcome.fatalReason ?? "error", outcome.fatalDetail);
90994
+ }
90514
90995
  }
90515
90996
  }
90516
90997
  return await stop("max_steps");
@@ -90603,6 +91084,14 @@ function hasErrorCode(error61, code) {
90603
91084
  return typeof error61 === "object" && error61 !== null && typeof Reflect.get(error61, "code") === "string" && Reflect.get(error61, "code") === code;
90604
91085
  }
90605
91086
  function callBudgetReason(error61) {
91087
+ const cap = spendCap(error61);
91088
+ if (cap !== void 0) {
91089
+ if (cap === "per_call") return "This wallet's per-call Call budget is exhausted.";
91090
+ if (cap === "per_day") return "This wallet's daily Call budget is exhausted.";
91091
+ if (cap === "max_price") return "This call exceeds its maximum price.";
91092
+ if (cap === "max_amount") return "This payment exceeds its maximum amount.";
91093
+ return void 0;
91094
+ }
90606
91095
  if (hasErrorCode(error61, "per_call_cap_exceeded")) {
90607
91096
  return "This wallet's per-call Call budget is exhausted.";
90608
91097
  }
@@ -90612,11 +91101,17 @@ function callBudgetReason(error61) {
90612
91101
  return void 0;
90613
91102
  }
90614
91103
  function callRunBudgetReason(error61, budget) {
90615
- if (!(error61 instanceof RunBudgetError) && !hasErrorCode(error61, "run_budget_exceeded")) {
91104
+ if (!(error61 instanceof RunBudgetError) && spendCap(error61) !== "run_budget" && !hasErrorCode(error61, "run_budget_exceeded")) {
90616
91105
  return void 0;
90617
91106
  }
90618
91107
  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.`;
90619
91108
  }
91109
+ function spendCap(error61) {
91110
+ if (error61 instanceof SpendCapExceededError) return error61.cap;
91111
+ if (!hasErrorCode(error61, "spend_cap_exceeded")) return void 0;
91112
+ const cap = Reflect.get(error61, "cap");
91113
+ return cap === "per_call" || cap === "per_day" || cap === "max_price" || cap === "max_amount" || cap === "run_budget" ? cap : void 0;
91114
+ }
90620
91115
  function runBudgetDetail(budget) {
90621
91116
  return budget === void 0 ? "The run budget is spent." : `The run budget of $${formatUsdc(budget.limitAtomic)} is spent.`;
90622
91117
  }
@@ -94986,7 +95481,8 @@ async function startStdioServer(options) {
94986
95481
  return server;
94987
95482
  }
94988
95483
  function toolError(error61) {
94989
- const text = error61 instanceof VapiCallError ? JSON.stringify(
95484
+ const spendCapError = serializeSpendCapError(error61);
95485
+ const text = spendCapError !== void 0 ? JSON.stringify(spendCapError, null, 2) : error61 instanceof VapiCallError ? JSON.stringify(
94990
95486
  {
94991
95487
  error: error61.message,
94992
95488
  code: error61.code,
@@ -95008,6 +95504,29 @@ function toolError(error61) {
95008
95504
  content: [{ type: "text", text }]
95009
95505
  };
95010
95506
  }
95507
+ function serializeSpendCapError(error61) {
95508
+ const record2 = asRecord2(error61);
95509
+ if (!(error61 instanceof SpendCapExceededError) && (record2 === void 0 || record2.code !== "spend_cap_exceeded")) {
95510
+ return void 0;
95511
+ }
95512
+ const value = error61;
95513
+ if (typeof value.amountUsd !== "string" || typeof value.limitUsd !== "string") return void 0;
95514
+ if (value.cap !== "per_call" && value.cap !== "per_day" && value.cap !== "max_price" && value.cap !== "max_amount" && value.cap !== "run_budget") {
95515
+ return void 0;
95516
+ }
95517
+ const message = typeof value.message === "string" ? value.message : "A spend cap was exceeded.";
95518
+ return {
95519
+ error: message,
95520
+ code: "spend_cap_exceeded",
95521
+ cap: value.cap,
95522
+ amountUsd: value.amountUsd,
95523
+ limitUsd: value.limitUsd,
95524
+ ...typeof value.spentUsd === "string" ? { spentUsd: value.spentUsd } : {},
95525
+ ...typeof value.wallet === "string" ? { wallet: value.wallet } : {},
95526
+ command: typeof value.command === "string" ? value.command : null,
95527
+ retryable: false
95528
+ };
95529
+ }
95011
95530
  function asRecord2(value) {
95012
95531
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
95013
95532
  }
@@ -95246,12 +95765,6 @@ function createListingsClient(options) {
95246
95765
  query: { wallet }
95247
95766
  });
95248
95767
  },
95249
- async splitters(wallet) {
95250
- return await call2("/api/call/listings/splitters", {
95251
- method: "GET",
95252
- query: { wallet }
95253
- });
95254
- },
95255
95768
  async create(input2) {
95256
95769
  return await call2("/api/call/listings", { method: "POST", body: input2 });
95257
95770
  },
@@ -95325,11 +95838,11 @@ function readProbeOperations(probe) {
95325
95838
  return isOperation(probe.endpoint) ? [probe.endpoint] : [];
95326
95839
  }
95327
95840
  function isOperation(operation) {
95328
- return isRecord6(operation) && typeof operation.name === "string" && operation.name.length > 0;
95841
+ return isRecord7(operation) && typeof operation.name === "string" && operation.name.length > 0;
95329
95842
  }
95330
95843
  function readProbeRejection(probe) {
95331
95844
  const rejection = probe.diagnostics?.rejection;
95332
- return isRecord6(rejection) ? rejection : void 0;
95845
+ return isRecord7(rejection) ? rejection : void 0;
95333
95846
  }
95334
95847
  function formatProbeSteps(probe) {
95335
95848
  const steps = probe.diagnostics?.steps;
@@ -95338,7 +95851,7 @@ function formatProbeSteps(probe) {
95338
95851
  }
95339
95852
  function formatProbeStep(step2) {
95340
95853
  if (typeof step2 === "string") return step2;
95341
- if (!isRecord6(step2)) return JSON.stringify(step2);
95854
+ if (!isRecord7(step2)) return JSON.stringify(step2);
95342
95855
  const label = asString(step2.name) ?? asString(step2.step) ?? asString(step2.label) ?? "step";
95343
95856
  const outcome = asString(step2.status) ?? asString(step2.outcome) ?? asString(step2.result) ?? (typeof step2.ok === "boolean" ? step2.ok ? "ok" : "failed" : void 0);
95344
95857
  const detail = asString(step2.detail) ?? asString(step2.message) ?? asString(step2.description);
@@ -95404,19 +95917,19 @@ async function readJson(response) {
95404
95917
  }
95405
95918
  function readErrorMessage(body) {
95406
95919
  if (typeof body === "string") return body.trim() || void 0;
95407
- if (!isRecord6(body)) return void 0;
95920
+ if (!isRecord7(body)) return void 0;
95408
95921
  const error61 = body.error;
95409
- if (isRecord6(error61)) return asString(error61.message) ?? asString(error61.code);
95922
+ if (isRecord7(error61)) return asString(error61.message) ?? asString(error61.code);
95410
95923
  return asString(body.message) ?? asString(body.error) ?? asString(body.detail);
95411
95924
  }
95412
95925
  function readErrorIssues(body) {
95413
- if (!isRecord6(body)) return [];
95926
+ if (!isRecord7(body)) return [];
95414
95927
  const candidates = [body.issues, body.errors, body.details];
95415
95928
  for (const candidate of candidates) {
95416
95929
  if (!Array.isArray(candidate)) continue;
95417
95930
  const issues = candidate.map((issue2) => {
95418
95931
  if (typeof issue2 === "string") return issue2;
95419
- if (!isRecord6(issue2)) return JSON.stringify(issue2);
95932
+ if (!isRecord7(issue2)) return JSON.stringify(issue2);
95420
95933
  const path = Array.isArray(issue2.path) ? issue2.path.join(".") : asString(issue2.path);
95421
95934
  const message = asString(issue2.message) ?? asString(issue2.code) ?? JSON.stringify(issue2);
95422
95935
  return path ? `${path}: ${message}` : message;
@@ -95428,7 +95941,7 @@ function readErrorIssues(body) {
95428
95941
  function asString(value) {
95429
95942
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
95430
95943
  }
95431
- function isRecord6(value) {
95944
+ function isRecord7(value) {
95432
95945
  return typeof value === "object" && value !== null && !Array.isArray(value);
95433
95946
  }
95434
95947
 
@@ -95463,11 +95976,11 @@ function formatIdentityLines(identity) {
95463
95976
  ];
95464
95977
  }
95465
95978
  function parseIdentityResponse(value) {
95466
- if (!isRecord7(value) || typeof value.wallet !== "string" || value.chain !== "eip155:8453") {
95979
+ if (!isRecord8(value) || typeof value.wallet !== "string" || value.chain !== "eip155:8453") {
95467
95980
  return void 0;
95468
95981
  }
95469
95982
  if (value.identity === null) return null;
95470
- if (!isRecord7(value.identity)) return void 0;
95983
+ if (!isRecord8(value.identity)) return void 0;
95471
95984
  const { identity } = value;
95472
95985
  if (typeof identity.erc8004Id !== "string" || identity.erc8004Id.length === 0 || typeof identity.agentCount !== "number" || !Number.isFinite(identity.agentCount) || typeof identity.registry !== "string") {
95473
95986
  return void 0;
@@ -95481,13 +95994,13 @@ function parseIdentityResponse(value) {
95481
95994
  };
95482
95995
  }
95483
95996
  function parseReputation(value) {
95484
- if (!isRecord7(value)) return void 0;
95997
+ if (!isRecord8(value)) return void 0;
95485
95998
  if (typeof value.score !== "number" || !Number.isFinite(value.score) || typeof value.count !== "number" || !Number.isInteger(value.count) || value.count < 0) {
95486
95999
  return void 0;
95487
96000
  }
95488
96001
  return { score: value.score, count: value.count };
95489
96002
  }
95490
- function isRecord7(value) {
96003
+ function isRecord8(value) {
95491
96004
  return typeof value === "object" && value !== null && !Array.isArray(value);
95492
96005
  }
95493
96006
 
@@ -95786,7 +96299,7 @@ async function offerDashboardLink({
95786
96299
  apiBase
95787
96300
  }) {
95788
96301
  const otherHome = resolve2(home) !== resolve2(getVapiPaths().directory);
95789
- const command = `${otherHome ? `VAPI_HOME=${shellQuote(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote(apiBase)} `}vapi login --account ${name}`;
96302
+ const command = `${otherHome ? `VAPI_HOME=${shellQuote2(home)} ` : ""}${apiBase === void 0 ? "" : `VAPI_REGISTRY_URL=${shellQuote2(apiBase)} `}vapi login --account ${name}`;
95790
96303
  const unlinked = {
95791
96304
  linked: false,
95792
96305
  next: [{ kind: "link", account: name, command }]
@@ -95849,7 +96362,7 @@ async function dashboardCommand(argv, json2, io, dependencies) {
95849
96362
  }
95850
96363
  io.stdout(json2 ? JSON.stringify({ account: target.name, url: url2, ...status, opened }) : url2);
95851
96364
  }
95852
- function shellQuote(value) {
96365
+ function shellQuote2(value) {
95853
96366
  return /^[a-zA-Z0-9_./-]+$/u.test(value) ? value : `'${value.replace(/'/gu, "'\\''")}'`;
95854
96367
  }
95855
96368
 
@@ -96322,7 +96835,7 @@ function buildRelayRestorePayload(options) {
96322
96835
  const owner = normalizedOwner(options.owner);
96323
96836
  assertDevice(options.device);
96324
96837
  assertBytes(options.key, 32);
96325
- if (!isRecord8(options.kdf)) throw new Error();
96838
+ if (!isRecord9(options.kdf)) throw new Error();
96326
96839
  const kdf = parseKdf(options.kdf);
96327
96840
  const parsed = backupPlaintextSchema.safeParse(options.vault);
96328
96841
  if (!parsed.success) throw new Error();
@@ -96344,7 +96857,7 @@ function buildRelayRestorePayload(options) {
96344
96857
  async function exportBackupSource(options) {
96345
96858
  try {
96346
96859
  assertBytes(options.vaultKey, 32);
96347
- if (!isRecord8(options.store) || typeof options.store.home !== "string" || typeof options.store.snapshot !== "function" || typeof options.store.reload !== "function") {
96860
+ if (!isRecord9(options.store) || typeof options.store.home !== "string" || typeof options.store.snapshot !== "function" || typeof options.store.reload !== "function") {
96348
96861
  throw new BackupError("backup_invalid_input");
96349
96862
  }
96350
96863
  const networks = normalizeNetworks(options.networks ?? []);
@@ -97077,7 +97590,7 @@ function prettyJson(value) {
97077
97590
  }
97078
97591
  function parseSealed(sealed) {
97079
97592
  const value = JSON.parse(sealed);
97080
- 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) {
97593
+ 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) {
97081
97594
  throw new Error();
97082
97595
  }
97083
97596
  return { epk: value.epk, nonce: value.nonce, ciphertext: value.ciphertext };
@@ -97244,13 +97757,13 @@ async function pathExists4(path) {
97244
97757
  }
97245
97758
  }
97246
97759
  function isMissingFile4(error61) {
97247
- return isErrorCode(error61, "ENOENT");
97760
+ return isErrorCode2(error61, "ENOENT");
97248
97761
  }
97249
97762
  function isExistingFile2(error61) {
97250
- return isErrorCode(error61, "EEXIST");
97763
+ return isErrorCode2(error61, "EEXIST");
97251
97764
  }
97252
- function isErrorCode(error61, code) {
97253
- return isRecord8(error61) && Reflect.get(error61, "code") === code;
97765
+ function isErrorCode2(error61, code) {
97766
+ return isRecord9(error61) && Reflect.get(error61, "code") === code;
97254
97767
  }
97255
97768
  function validateBackupSourceRelationships(source, context) {
97256
97769
  const names = /* @__PURE__ */ new Set();
@@ -97649,7 +98162,7 @@ function assertBytes(value, length) {
97649
98162
  }
97650
98163
  }
97651
98164
  function assertOwnerKey(ownerKey) {
97652
- if (!isRecord8(ownerKey) || ownerKey.kdf !== "hkdf-sha256" && ownerKey.kdf !== "scrypt") {
98165
+ if (!isRecord9(ownerKey) || ownerKey.kdf !== "hkdf-sha256" && ownerKey.kdf !== "scrypt") {
97653
98166
  throw new BackupError("backup_invalid_input");
97654
98167
  }
97655
98168
  assertBytes(ownerKey.key, 32);
@@ -97679,7 +98192,7 @@ function isIsoUtcMilliseconds(value) {
97679
98192
  return false;
97680
98193
  }
97681
98194
  }
97682
- function isRecord8(value) {
98195
+ function isRecord9(value) {
97683
98196
  return typeof value === "object" && value !== null && !Array.isArray(value);
97684
98197
  }
97685
98198
  function hasExactKeys(value, expected) {
@@ -97747,7 +98260,7 @@ async function startRelay(options) {
97747
98260
  );
97748
98261
  if (response.status !== 201) throw new Error();
97749
98262
  const value = await response.json();
97750
- 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()) {
98263
+ 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()) {
97751
98264
  throw new Error();
97752
98265
  }
97753
98266
  return { code, expiresAt: value.expiresAt, keyPair };
@@ -98044,7 +98557,7 @@ async function readRelayResult(response, options) {
98044
98557
  let plaintext;
98045
98558
  try {
98046
98559
  const result = await response.json();
98047
- if (!isRecord9(result) || !hasExactKeys2(result, RELAY_RESULT_KEYS) || typeof result.sealed !== "string") {
98560
+ if (!isRecord10(result) || !hasExactKeys2(result, RELAY_RESULT_KEYS) || typeof result.sealed !== "string") {
98048
98561
  throw new Error();
98049
98562
  }
98050
98563
  plaintext = openSealed({
@@ -98074,11 +98587,11 @@ async function readRelayResult(response, options) {
98074
98587
  }
98075
98588
  }
98076
98589
  function parseRelayPayload(value) {
98077
- if (!isRecord9(value) || !isRelayPurpose(value.purpose)) {
98590
+ if (!isRecord10(value) || !isRelayPurpose(value.purpose)) {
98078
98591
  throw new CloudBackupError("payload_invalid");
98079
98592
  }
98080
98593
  const expectedKeys = value.purpose === "restore" ? RESTORE_PAYLOAD_KEYS : ENROLL_PAYLOAD_KEYS;
98081
- 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") {
98594
+ 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") {
98082
98595
  throw new CloudBackupError("payload_invalid");
98083
98596
  }
98084
98597
  const kdf = parseKdf2(value.kdf);
@@ -98108,7 +98621,7 @@ function parseRelayPayload(value) {
98108
98621
  };
98109
98622
  }
98110
98623
  function parseStoredBackupKey(value) {
98111
- 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") {
98624
+ 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") {
98112
98625
  return void 0;
98113
98626
  }
98114
98627
  const kdf = parseKdf2(value.kdf);
@@ -98134,7 +98647,7 @@ function parseStoredState(value) {
98134
98647
  if (value === void 0) return void 0;
98135
98648
  try {
98136
98649
  const parsed = JSON.parse(value);
98137
- 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) {
98650
+ 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) {
98138
98651
  return void 0;
98139
98652
  }
98140
98653
  return { lastUploadAt: parsed.lastUploadAt, sizeBytes: parsed.sizeBytes };
@@ -98226,7 +98739,7 @@ function isRelayPurpose(value) {
98226
98739
  function isAborted(signal) {
98227
98740
  return signal?.aborted === true;
98228
98741
  }
98229
- function isRecord9(value) {
98742
+ function isRecord10(value) {
98230
98743
  return typeof value === "object" && value !== null && !Array.isArray(value);
98231
98744
  }
98232
98745
  function hasExactKeys2(value, expected) {
@@ -98424,6 +98937,7 @@ async function buyCommand(argv, json2, io, dependencies) {
98424
98937
  )
98425
98938
  );
98426
98939
  } catch (error61) {
98940
+ if (error61 instanceof SpendCapExceededError) throw error61;
98427
98941
  if (error61 instanceof SpendCapError) {
98428
98942
  throw new Error(
98429
98943
  `Router balance purchase refused by the wallet spend policy: ${error61.message} Review or change it with vapi accounts caps ${target.name}.`
@@ -98576,7 +99090,7 @@ async function readProcessStdin() {
98576
99090
  }
98577
99091
 
98578
99092
  // src/version.ts
98579
- var CLI_VERSION = "0.10.0";
99093
+ var CLI_VERSION = "0.11.0";
98580
99094
 
98581
99095
  // src/status.ts
98582
99096
  async function statusCommand(argv, json2, io, dependencies) {
@@ -100156,7 +100670,7 @@ async function readOffer(response) {
100156
100670
  if (raw !== null) {
100157
100671
  try {
100158
100672
  const decoded = decodePaymentRequiredHeader(raw);
100159
- if (isRecord10(decoded)) header = decoded;
100673
+ if (isRecord11(decoded)) header = decoded;
100160
100674
  else headerMalformed = true;
100161
100675
  } catch {
100162
100676
  headerMalformed = true;
@@ -100165,7 +100679,7 @@ async function readOffer(response) {
100165
100679
  let body;
100166
100680
  try {
100167
100681
  const parsed = JSON.parse(await readBoundedText(response) ?? "");
100168
- if (isRecord10(parsed) && ("accepts" in parsed || "x402Version" in parsed)) body = parsed;
100682
+ if (isRecord11(parsed) && ("accepts" in parsed || "x402Version" in parsed)) body = parsed;
100169
100683
  } catch {
100170
100684
  }
100171
100685
  const mpp = parseMppChallenge(response.headers.get("www-authenticate"));
@@ -100243,7 +100757,7 @@ function gradeOffer(offer) {
100243
100757
  };
100244
100758
  }
100245
100759
  const version5 = declared.x402Version === 1 || declared.x402Version === 2 ? declared.x402Version : null;
100246
- const accepts = (Array.isArray(declared.accepts) ? declared.accepts : []).filter(isRecord10);
100760
+ const accepts = (Array.isArray(declared.accepts) ? declared.accepts : []).filter(isRecord11);
100247
100761
  const exact = accepts.filter((accept) => accept.scheme === "exact");
100248
100762
  const fields = version5 === null ? void 0 : fieldsRule(declared, version5);
100249
100763
  const offerRules = [
@@ -100268,7 +100782,7 @@ function gradeOffer(offer) {
100268
100782
  }
100269
100783
  function advertisedExtensions(declared) {
100270
100784
  const extensions = declared.extensions;
100271
- if (!isRecord10(extensions)) return [];
100785
+ if (!isRecord11(extensions)) return [];
100272
100786
  return KNOWN_EXTENSIONS.filter((name) => Object.prototype.hasOwnProperty.call(extensions, name));
100273
100787
  }
100274
100788
  function extensionsRule(advertised) {
@@ -100391,14 +100905,14 @@ function fieldsRule(declared, version5) {
100391
100905
  if (version5 === 2) {
100392
100906
  const resource = declared.resource;
100393
100907
  if (resource === void 0) issues.push("v2_missing_resource");
100394
- else if (!isRecord10(resource) || !nonEmptyString(resource.url)) {
100908
+ else if (!isRecord11(resource) || !nonEmptyString(resource.url)) {
100395
100909
  issues.push("v2_invalid_resource");
100396
100910
  }
100397
100911
  }
100398
100912
  const accepts = declared.accepts;
100399
100913
  if (!Array.isArray(accepts) || accepts.length === 0) issues.push(`${prefix}_missing_accepts`);
100400
100914
  for (const accept of Array.isArray(accepts) ? accepts : []) {
100401
- if (!isRecord10(accept)) {
100915
+ if (!isRecord11(accept)) {
100402
100916
  issues.push(`${prefix}_invalid_accepts`);
100403
100917
  continue;
100404
100918
  }
@@ -100456,7 +100970,7 @@ function usdcIssue(accept, network) {
100456
100970
  if (typeof accept.asset !== "string" || accept.asset.toLowerCase() !== canonical.usdc.toLowerCase()) {
100457
100971
  return "asset_not_usdc";
100458
100972
  }
100459
- const extra = isRecord10(accept.extra) ? accept.extra : {};
100973
+ const extra = isRecord11(accept.extra) ? accept.extra : {};
100460
100974
  return extra.name === canonical.eip712Domain.name && extra.version === canonical.eip712Domain.version ? void 0 : "usdc_domain_mismatch";
100461
100975
  }
100462
100976
  function payToRule(exact, version5) {
@@ -100508,7 +101022,7 @@ async function discoveryRule(target, fetchImpl) {
100508
101022
  "discovery_missing"
100509
101023
  ]);
100510
101024
  }
100511
- if (!isRecord10(document)) {
101025
+ if (!isRecord11(document)) {
100512
101026
  return rule("discovery", "warn", `${url2.href} is not a JSON object.`, ["discovery_malformed"]);
100513
101027
  }
100514
101028
  const resources = Array.isArray(document.resources) ? document.resources.length : void 0;
@@ -100579,12 +101093,12 @@ function pathAdjacentOpenApiUrls(target) {
100579
101093
  }
100580
101094
  }
100581
101095
  function apiCatalogOpenApiUrls(document, catalogUrl, origin, seen) {
100582
- if (!isRecord10(document) || !Array.isArray(document.linkset)) return [];
101096
+ if (!isRecord11(document) || !Array.isArray(document.linkset)) return [];
100583
101097
  const candidates = [];
100584
101098
  for (const link3 of document.linkset) {
100585
- if (!isRecord10(link3) || !Array.isArray(link3["service-desc"])) continue;
101099
+ if (!isRecord11(link3) || !Array.isArray(link3["service-desc"])) continue;
100586
101100
  for (const description of link3["service-desc"]) {
100587
- if (!isRecord10(description) || typeof description.href !== "string") continue;
101101
+ if (!isRecord11(description) || typeof description.href !== "string") continue;
100588
101102
  let candidate;
100589
101103
  try {
100590
101104
  candidate = new URL(description.href, catalogUrl);
@@ -100603,7 +101117,7 @@ async function findOpenApiOperation(fetchImpl, candidates, pathname, method, via
100603
101117
  let firstDocument;
100604
101118
  for (const url2 of candidates) {
100605
101119
  const document = await fetchJson(fetchImpl, url2);
100606
- if (isRecord10(document) && isRecord10(document.paths)) {
101120
+ if (isRecord11(document) && isRecord11(document.paths)) {
100607
101121
  const located = {
100608
101122
  url: url2,
100609
101123
  paths: document.paths,
@@ -100624,9 +101138,9 @@ function openApiSource(document, catalogUrl) {
100624
101138
  function findOperation(paths, pathname, method) {
100625
101139
  const path = trimSlash(pathname);
100626
101140
  for (const [template, item] of Object.entries(paths)) {
100627
- if (!isRecord10(item)) continue;
101141
+ if (!isRecord11(item)) continue;
100628
101142
  const operation = item[method.toLowerCase()];
100629
- if (!isRecord10(operation)) continue;
101143
+ if (!isRecord11(operation)) continue;
100630
101144
  const pattern = trimSlash(template).split(/(\{[^/}]+\})/).map((part) => part.startsWith("{") ? "[^/]+" : part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("");
100631
101145
  if (new RegExp(`${pattern}$`).test(path)) return { item, operation };
100632
101146
  }
@@ -100695,7 +101209,7 @@ function trimSlash(path) {
100695
101209
  function nonEmptyString(value) {
100696
101210
  return typeof value === "string" && value.length > 0;
100697
101211
  }
100698
- function isRecord10(value) {
101212
+ function isRecord11(value) {
100699
101213
  return typeof value === "object" && value !== null && !Array.isArray(value);
100700
101214
  }
100701
101215
 
@@ -101823,7 +102337,7 @@ async function reserveRemoteAllowance(args) {
101823
102337
  );
101824
102338
  return { atomic: reserved, expiresAt: nextUtcMidnight(reservation.date) };
101825
102339
  } catch (error61) {
101826
- if (error61 instanceof Error && "code" in error61 && error61.code === "per_day_cap_exceeded") {
102340
+ if (error61 instanceof SpendCapExceededError && error61.cap === "per_day" || error61 instanceof Error && "code" in error61 && error61.code === "per_day_cap_exceeded") {
101827
102341
  throw new RemoteKeyRefusedError(
101828
102342
  "no_daily_allowance",
101829
102343
  `${args.account}'s remaining daily allowance changed while Railway was starting. Run the command again.`
@@ -102085,7 +102599,7 @@ function createLocalRuntime(options) {
102085
102599
  const { home } = options;
102086
102600
  const entry = options.entry ?? realpathSync(process.argv[1]);
102087
102601
  const execPath = options.execPath ?? process.execPath;
102088
- const spawn4 = options.spawn ?? nodeSpawn;
102602
+ const spawn5 = options.spawn ?? nodeSpawn;
102089
102603
  const kill = options.kill ?? ((pid, signal) => process.kill(pid, signal));
102090
102604
  const processCommand = options.processCommand ?? defaultProcessCommand;
102091
102605
  const ownsProcess = (handle, pid) => processCommand(pid)?.includes(runResultPath(home, handle.runId)) === true;
@@ -102108,7 +102622,7 @@ function createLocalRuntime(options) {
102108
102622
  const logFd = openLog(logPath);
102109
102623
  let child;
102110
102624
  try {
102111
- child = spawn4(execPath, [entry, ...args, "--json", "--result-file", resultPath], {
102625
+ child = spawn5(execPath, [entry, ...args, "--json", "--result-file", resultPath], {
102112
102626
  detached: true,
102113
102627
  stdio: ["ignore", logFd, logFd],
102114
102628
  env: {
@@ -103022,13 +103536,17 @@ function usd(value, minimumDecimals = 0) {
103022
103536
  }
103023
103537
 
103024
103538
  // src/mcp-install.ts
103539
+ import { spawn as spawn3 } from "node:child_process";
103025
103540
  import { mkdir as mkdir20, readFile as readFile27, writeFile as writeFile11 } from "node:fs/promises";
103026
103541
  import { homedir as systemHomedir } from "node:os";
103027
103542
  import { dirname as dirname14, posix, win32 as win322 } from "node:path";
103028
- var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
103029
- var APPS = /* @__PURE__ */ new Set(["claude", "cursor", "codex"]);
103543
+ var MCP_INSTALL_USAGE = "Usage: vapi mcp install <claude-code|claude-desktop|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]";
103544
+ var APPS = /* @__PURE__ */ new Set(["claude-code", "claude-desktop", "cursor", "codex"]);
103545
+ var CLAUDE_ALIAS_NOTICE = "vapi mcp install claude installs into Claude Desktop; for the Claude Code CLI use: vapi mcp install claude-code";
103546
+ var CLAUDE_NOT_FOUND = "Claude Code's claude command was not found on PATH. Install Claude Code, or run this yourself:";
103030
103547
  var NEXT_STEP = {
103031
- claude: 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
103548
+ "claude-code": 'Start a new Claude Code session, then ask: "Search vAPI for a weather API."',
103549
+ "claude-desktop": 'Restart Claude Desktop, then ask it: "Search vAPI for a weather API."',
103032
103550
  cursor: 'Reload Cursor, then ask its agent: "Search vAPI for a weather API."',
103033
103551
  codex: 'Start codex in a new terminal, then ask: "Search vAPI for a weather API."'
103034
103552
  };
@@ -103069,36 +103587,44 @@ async function mcpInstallCommand(argv, json2, io, dependencies) {
103069
103587
  booleanOptions: /* @__PURE__ */ new Set(["--no-link"]),
103070
103588
  maximumPositionals: 1
103071
103589
  });
103072
- const appValue = parsed.positionals[0];
103073
- if (appValue === void 0) throw new UsageError(MCP_INSTALL_USAGE);
103590
+ const requestedApp = parsed.positionals[0];
103591
+ if (requestedApp === void 0) throw new UsageError(MCP_INSTALL_USAGE);
103592
+ const appValue = requestedApp === "claude" ? "claude-desktop" : requestedApp;
103074
103593
  if (!isMcpInstallApp(appValue)) {
103075
103594
  throw new UsageError(
103076
- `Unknown app ${JSON.stringify(appValue)}. Choose claude, cursor or codex.
103595
+ `Unknown app ${JSON.stringify(requestedApp)}. Choose claude-code, claude-desktop, cursor or codex.
103077
103596
  ${MCP_INSTALL_USAGE}`
103078
103597
  );
103079
103598
  }
103599
+ if (requestedApp === "claude") io.stderr(CLAUDE_ALIAS_NOTICE);
103080
103600
  const home = parsed.one("--home") ?? getVapiPaths().directory;
103081
103601
  const paths = getVapiPaths(home);
103082
103602
  const registry2 = parsed.one("--registry") ?? (await pathExists5(paths.config) ? registryBaseUrl(await readConfig(paths.config, io)) : resolveRegistryUrl());
103603
+ const offerLink = async () => {
103604
+ const name = await unlinkedDefaultAccount(home, dependencies);
103605
+ return name === void 0 ? {} : await offerDashboardLink({
103606
+ name,
103607
+ json: json2,
103608
+ noLink: parsed.has("--no-link"),
103609
+ io,
103610
+ dependencies,
103611
+ home,
103612
+ apiBase: parsed.one("--registry")
103613
+ });
103614
+ };
103615
+ const platform2 = dependencies.mcpInstall?.platform ?? process.platform;
103616
+ const entry = serverEntry(home, registry2);
103617
+ if (appValue === "claude-code") {
103618
+ return await installClaudeCode(entry, platform2, json2, io, dependencies, offerLink);
103619
+ }
103083
103620
  const target = mcpInstallTarget(appValue, {
103084
- platform: dependencies.mcpInstall?.platform ?? process.platform,
103621
+ platform: platform2,
103085
103622
  homedir: dependencies.mcpInstall?.homedir ?? systemHomedir(),
103086
103623
  cwd: dependencies.mcpInstall?.cwd ?? process.cwd(),
103087
103624
  appData: dependencies.mcpInstall?.appData ?? process.env.APPDATA
103088
103625
  });
103089
- const entry = serverEntry(home, registry2);
103090
103626
  const created = await writeMcpConfig(target, entry);
103091
- const name = await unlinkedDefaultAccount(home, dependencies);
103092
- const offerLink = (name2) => offerDashboardLink({
103093
- name: name2,
103094
- json: json2,
103095
- noLink: parsed.has("--no-link"),
103096
- io,
103097
- dependencies,
103098
- home,
103099
- apiBase: parsed.one("--registry")
103100
- });
103101
- const link3 = json2 && name !== void 0 ? await offerLink(name) : {};
103627
+ const link3 = json2 ? await offerLink() : {};
103102
103628
  output3(
103103
103629
  io,
103104
103630
  json2,
@@ -103107,8 +103633,9 @@ ${MCP_INSTALL_USAGE}`
103107
103633
  );
103108
103634
  if (!json2) {
103109
103635
  io.stdout(NEXT_STEP[appValue]);
103110
- if (name !== void 0) await offerLink(name);
103636
+ await offerLink();
103111
103637
  }
103638
+ return 0;
103112
103639
  }
103113
103640
  async function unlinkedDefaultAccount(home, dependencies) {
103114
103641
  try {
@@ -103122,6 +103649,131 @@ async function unlinkedDefaultAccount(home, dependencies) {
103122
103649
  }
103123
103650
  return void 0;
103124
103651
  }
103652
+ async function installClaudeCode(entry, platform2, json2, io, dependencies, offerLink) {
103653
+ const processCommand = platform2 === "win32" ? "claude.cmd" : "claude";
103654
+ const processArgs = claudeCodeArgs(entry);
103655
+ const command = platform2 === "win32" ? [escapeCmd(processCommand), ...processArgs.map(escapeCmdArgument)].join(" ") : displayCommand(processCommand, processArgs);
103656
+ let result;
103657
+ try {
103658
+ result = await (dependencies.mcpInstall?.runProcess ?? defaultMcpInstallProcess)(
103659
+ processCommand,
103660
+ processArgs
103661
+ );
103662
+ } catch (error61) {
103663
+ if (isErrorCode3(error61, "ENOENT")) {
103664
+ return claudeCodeFailure(json2, io, command, "claude_not_found", CLAUDE_NOT_FOUND);
103665
+ }
103666
+ const message = `Claude Code MCP installation failed: ${errorMessage2(error61)}`;
103667
+ return claudeCodeFailure(json2, io, command, "claude_mcp_add_failed", message);
103668
+ }
103669
+ if (result.exitCode !== 0) {
103670
+ 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}.`;
103671
+ const stderr2 = result.stderr.trim();
103672
+ const message = stderr2.length === 0 ? status : `${status} ${stderr2}`;
103673
+ return claudeCodeFailure(json2, io, command, "claude_mcp_add_failed", message, result.exitCode);
103674
+ }
103675
+ const nextStep = NEXT_STEP["claude-code"];
103676
+ const link3 = json2 ? await offerLink() : {};
103677
+ if (json2)
103678
+ io.stdout(JSON.stringify({ ...link3, app: "claude-code", installed: true, command, nextStep }));
103679
+ else {
103680
+ io.stdout(command);
103681
+ io.stdout(nextStep);
103682
+ await offerLink();
103683
+ }
103684
+ return 0;
103685
+ }
103686
+ function claudeCodeArgs(entry) {
103687
+ return [
103688
+ "mcp",
103689
+ "add",
103690
+ "--scope",
103691
+ "user",
103692
+ "vapi",
103693
+ "-e",
103694
+ `VAPI_HOME=${entry.env.VAPI_HOME}`,
103695
+ "-e",
103696
+ `VAPI_REGISTRY_URL=${entry.env.VAPI_REGISTRY_URL}`,
103697
+ "--",
103698
+ entry.command,
103699
+ ...entry.args
103700
+ ];
103701
+ }
103702
+ function claudeCodeFailure(json2, io, command, code, message, exitCode) {
103703
+ if (json2) {
103704
+ io.stdout(
103705
+ JSON.stringify({
103706
+ app: "claude-code",
103707
+ installed: false,
103708
+ command,
103709
+ error: { code, message, ...exitCode === void 0 ? {} : { exitCode } }
103710
+ })
103711
+ );
103712
+ } else if (code === "claude_not_found") {
103713
+ io.stderr(`${message}
103714
+ ${command}`);
103715
+ } else {
103716
+ io.stderr(`${command}
103717
+ ${message}`);
103718
+ }
103719
+ return 1;
103720
+ }
103721
+ function displayCommand(command, args) {
103722
+ return [command, ...args].map(shellQuote3).join(" ");
103723
+ }
103724
+ function shellQuote3(value) {
103725
+ return /^[A-Za-z0-9_@%+=:,./-]+$/u.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
103726
+ }
103727
+ function isErrorCode3(error61, code) {
103728
+ return typeof error61 === "object" && error61 !== null && "code" in error61 && error61.code === code;
103729
+ }
103730
+ function errorMessage2(error61) {
103731
+ return error61 instanceof Error ? error61.message : String(error61);
103732
+ }
103733
+ var defaultMcpInstallProcess = async (command, args) => {
103734
+ const batch = /\.(?:cmd|bat)$/iu.test(command);
103735
+ const executable = batch ? await windowsBatchPath(command) : command;
103736
+ const commandLine = batch ? [escapeCmd(executable), ...args.map((arg) => escapeCmdArgument(arg))].join(" ") : void 0;
103737
+ return await new Promise((resolve3, reject) => {
103738
+ const child = spawn3(
103739
+ batch ? "cmd.exe" : command,
103740
+ batch ? ["/d", "/v:off", "/s", "/c", `"${commandLine}"`] : [...args],
103741
+ {
103742
+ shell: false,
103743
+ ...batch ? { windowsVerbatimArguments: true } : {},
103744
+ stdio: ["ignore", "pipe", "pipe"],
103745
+ timeout: 6e4,
103746
+ killSignal: "SIGKILL",
103747
+ windowsHide: true
103748
+ }
103749
+ );
103750
+ let stdout = "";
103751
+ let stderr2 = "";
103752
+ child.stdout.setEncoding("utf8").on("data", (chunk) => {
103753
+ stdout += chunk;
103754
+ });
103755
+ child.stderr.setEncoding("utf8").on("data", (chunk) => {
103756
+ stderr2 += chunk;
103757
+ });
103758
+ child.once("error", reject);
103759
+ child.once("close", (exitCode) => resolve3({ exitCode, stdout, stderr: stderr2 }));
103760
+ });
103761
+ };
103762
+ async function windowsBatchPath(command) {
103763
+ const path = Object.entries(process.env).find(([key2]) => key2.toLowerCase() === "path")?.[1];
103764
+ for (const directory of ["", ...(path ?? "").split(";")]) {
103765
+ const candidate = win322.join(directory.replace(/^"|"$/gu, ""), command);
103766
+ if (await pathExists5(candidate)) return candidate;
103767
+ }
103768
+ throw Object.assign(new Error(`${command} was not found on PATH.`), { code: "ENOENT" });
103769
+ }
103770
+ function escapeCmd(value) {
103771
+ return value.replace(/[()[\]%!^"`<>&|;, *?]/gu, "^$&");
103772
+ }
103773
+ function escapeCmdArgument(value) {
103774
+ const quoted = `"${value.replace(/(\\*)"/gu, '$1$1\\"').replace(/(\\*)$/u, "$1$1")}"`;
103775
+ return escapeCmd(escapeCmd(quoted));
103776
+ }
103125
103777
  function isMcpInstallApp(value) {
103126
103778
  return APPS.has(value);
103127
103779
  }
@@ -103155,13 +103807,13 @@ function jsonConfig(path, existing, entry) {
103155
103807
  } catch {
103156
103808
  throw new Error(`${path} is not valid JSON. Fix it by hand; nothing was written.`);
103157
103809
  }
103158
- if (!isRecord11(parsed)) {
103810
+ if (!isRecord12(parsed)) {
103159
103811
  throw new Error(`${path} must contain a JSON object. Fix it by hand; nothing was written.`);
103160
103812
  }
103161
103813
  config2 = parsed;
103162
103814
  }
103163
103815
  const existingServers = config2.mcpServers;
103164
- if (existingServers !== void 0 && !isRecord11(existingServers)) {
103816
+ if (existingServers !== void 0 && !isRecord12(existingServers)) {
103165
103817
  throw new Error(
103166
103818
  `${path} has an invalid mcpServers value. Fix it by hand; nothing was written.`
103167
103819
  );
@@ -103223,7 +103875,7 @@ function tomlSeparator(contents) {
103223
103875
  function escapeToml(value) {
103224
103876
  return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
103225
103877
  }
103226
- function isRecord11(value) {
103878
+ function isRecord12(value) {
103227
103879
  return typeof value === "object" && value !== null && !Array.isArray(value);
103228
103880
  }
103229
103881
  async function readExistingFile(path) {
@@ -105851,7 +106503,7 @@ Usage:
105851
106503
  vapi docs "<question>" [--json]
105852
106504
  vapi docs search "<query>" [--json]
105853
106505
  vapi docs read <url-or-path> [--json]
105854
- vapi search [query] [--kind <kind>] [--network <caip2>] [--limit <n>] [--cursor <cursor>] [--include-unverified] [--json]
106506
+ vapi search [query] [--kind <kind>] [--network <caip2>] [--limit <n>] [--cursor <cursor>] [--include-unverified] [--include-outage] [--json]
105855
106507
  vapi inspect <id> [--endpoint <name>] [--json]
105856
106508
  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]
105857
106509
  vapi pay --resume <receipt-id> [--json]
@@ -105920,7 +106572,7 @@ Usage:
105920
106572
  vapi publish list [--json]
105921
106573
  vapi claim <origin> [--account <name>] [--json]
105922
106574
  vapi mcp [--account <name>] [--json]
105923
- vapi mcp install <claude|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
106575
+ vapi mcp install <claude-code|claude-desktop|cursor|codex> [--home <dir>] [--registry <url>] [--no-link] [--json]
105924
106576
  vapi serve [--json]
105925
106577
  vapi version [--json]
105926
106578
  vapi help [--json]
@@ -105947,13 +106599,13 @@ Solana listings remain searchable; inspect and pay return \`unsupported_network\
105947
106599
 
105948
106600
  \`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.
105949
106601
 
105950
- \`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.
106602
+ \`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.
105951
106603
 
105952
106604
  \`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.
105953
106605
 
105954
106606
  \`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.
105955
106607
 
105956
- 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.`;
106608
+ 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.`;
105957
106609
  var processIo = {
105958
106610
  stdout: (message) => process.stdout.write(`${message}
105959
106611
  `),
@@ -105991,6 +106643,7 @@ var ACCOUNT_OPTION2 = "--account";
105991
106643
  var WALLET_OPTION_DEPRECATION = "--wallet is now --account; --wallet keeps working for one release.";
105992
106644
  var SOLANA_VAULT_UNAVAILABLE2 = "Solana keys are not part of the device vault yet.";
105993
106645
  var INCLUDE_UNVERIFIED_OPTION = "--include-unverified";
106646
+ var INCLUDE_OUTAGE_OPTION = "--include-outage";
105994
106647
  async function openWalletStore(dependencies, home = getVapiPaths().directory) {
105995
106648
  return await WalletStore.open(home, {
105996
106649
  secrets: getSecretStore(dependencies),
@@ -106276,11 +106929,11 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
106276
106929
  break;
106277
106930
  case "mcp":
106278
106931
  if (args[1] === "install") {
106279
- await mcpInstallCommand(args.slice(2), json2, io, dependencies);
106932
+ exitCode = await mcpInstallCommand(args.slice(2), json2, io, dependencies);
106280
106933
  } else {
106281
106934
  await mcpCommand(args.slice(1), dependencies);
106935
+ exitCode = 0;
106282
106936
  }
106283
- exitCode = 0;
106284
106937
  break;
106285
106938
  case "serve":
106286
106939
  outputStub(io, json2);
@@ -106310,7 +106963,9 @@ async function runCli(argv = process.argv.slice(2), io = processIo, dependencies
106310
106963
  ).catch(() => void 0);
106311
106964
  }
106312
106965
  if (json2) {
106313
- if (taskInvocation) {
106966
+ if (error61 instanceof SpendCapExceededError) {
106967
+ runIo.stdout(JSON.stringify({ error: error61.toJSON(), exitCode: 1 }));
106968
+ } else if (taskInvocation) {
106314
106969
  runIo.stdout(
106315
106970
  JSON.stringify({
106316
106971
  ok: false,
@@ -106696,7 +107351,7 @@ async function fundCommand2(argv, json2, io, dependencies) {
106696
107351
  async function searchCommand(argv, json2, io, dependencies) {
106697
107352
  const parsed = parseArguments(argv, {
106698
107353
  valueOptions: /* @__PURE__ */ new Set(["--kind", "--network", "--limit", "--cursor"]),
106699
- booleanOptions: /* @__PURE__ */ new Set([INCLUDE_UNVERIFIED_OPTION]),
107354
+ booleanOptions: /* @__PURE__ */ new Set([INCLUDE_UNVERIFIED_OPTION, INCLUDE_OUTAGE_OPTION]),
106700
107355
  repeatableOptions: /* @__PURE__ */ new Set(["--kind"]),
106701
107356
  maximumPositionals: 1
106702
107357
  });
@@ -106709,7 +107364,8 @@ async function searchCommand(argv, json2, io, dependencies) {
106709
107364
  ...limit === void 0 ? {} : { limit },
106710
107365
  ...parsed.one("--cursor") ? { cursor: parsed.one("--cursor") } : {},
106711
107366
  // Only the opt-in travels: `false` is the registry default.
106712
- ...parsed.has(INCLUDE_UNVERIFIED_OPTION) ? { includeUnverified: true } : {}
107367
+ ...parsed.has(INCLUDE_UNVERIFIED_OPTION) ? { includeUnverified: true } : {},
107368
+ ...parsed.has(INCLUDE_OUTAGE_OPTION) ? { includeOutage: true } : {}
106713
107369
  };
106714
107370
  const call2 = createCallPort({
106715
107371
  config: config2,
@@ -106835,12 +107491,14 @@ async function payCommand(argv, json2, io, dependencies) {
106835
107491
  cliActionContext(config2, pinPayInput(call2, input2), dependencies)
106836
107492
  );
106837
107493
  void _resolvedWallet;
107494
+ const { hints: _hints, ...humanResult } = result;
107495
+ void _hints;
106838
107496
  outputForWallet2(
106839
107497
  io,
106840
107498
  json2,
106841
107499
  wallet,
106842
107500
  result,
106843
- [...verificationNotice(result.verification), JSON.stringify(result, null, 2)].join("\n")
107501
+ [...verificationNotice(result.verification), JSON.stringify(humanResult, null, 2)].join("\n")
106844
107502
  );
106845
107503
  await (dependencies.ceiling?.drainCeilingSweeps ?? drainCeilingSweeps)(1e4).catch(
106846
107504
  () => void 0
@@ -107481,15 +108139,6 @@ async function publishListingCommand(argv, json2, io, dependencies) {
107481
108139
  }
107482
108140
  say(formatCreatedListing(listing, batch.name, payoutWallet, batch.endpoints.length));
107483
108141
  }
107484
- let splitters;
107485
- let splittersError;
107486
- if (created.length > 0) {
107487
- try {
107488
- splitters = await client.splitters(payoutWallet);
107489
- } catch (error61) {
107490
- splittersError = error61 instanceof Error ? error61.message : String(error61);
107491
- }
107492
- }
107493
108142
  const failed2 = failures.length > 0;
107494
108143
  const resumeHint = `Run the same vapi publish command with ${RESUME_OPTION} to list the rest; it skips what is already listed.`;
107495
108144
  if (json2) {
@@ -107499,8 +108148,6 @@ async function publishListingCommand(argv, json2, io, dependencies) {
107499
108148
  probe,
107500
108149
  listings: created,
107501
108150
  results,
107502
- ...splitters === void 0 ? {} : { splitters },
107503
- ...splittersError === void 0 ? {} : { splittersError },
107504
108151
  ...failed2 ? {
107505
108152
  error: [...new Set(failures.map((failure) => failure.message))].join("\n"),
107506
108153
  exitCode: 1
@@ -107510,8 +108157,12 @@ async function publishListingCommand(argv, json2, io, dependencies) {
107510
108157
  return failed2 ? 1 : 0;
107511
108158
  }
107512
108159
  if (created.length > 0) {
107513
- const slug = created.length === 1 ? listingSlug(created[0]) : void 0;
107514
- for (const line of formatSplitters(splitters, splittersError, slug, baseUrl)) io.stdout(line);
108160
+ for (const line of formatDescriptionWarnings(created[0])) io.stdout(line);
108161
+ io.stdout("vAPI Call takes no fee. Providers are paid directly.");
108162
+ io.stdout(`Set each endpoint's payTo to your payout wallet ${payoutWallet}, then run:`);
108163
+ for (const listing of created) {
108164
+ io.stdout(` vapi publish activate ${listingSlug(listing) ?? "<slug>"}`);
108165
+ }
107515
108166
  }
107516
108167
  if (!failed2) return 0;
107517
108168
  for (const message of new Set(failures.map((failure) => failure.message))) io.stderr(message);
@@ -107803,22 +108454,15 @@ function formatCreatedListing(created, name, payoutWallet, endpoints) {
107803
108454
  `Payout wallet: ${payoutWallet}`
107804
108455
  ].join("\n");
107805
108456
  }
107806
- function formatSplitters(splitters, splittersError, slug, baseUrl) {
107807
- const nextStep = `Deploy the FeeSplitter from your wallet in the console at ${listingsUrl(baseUrl, "/providers").href}, then run \`vapi publish activate ${slug ?? "<slug>"}\`.`;
107808
- if (splittersError !== void 0) {
107809
- return [`Could not read your splitters: ${splittersError}`, nextStep];
107810
- }
107811
- const states = Array.isArray(splitters?.networkStates) ? splitters.networkStates : [];
107812
- const fee = typeof splitters?.feeBp === "number" ? ` (vAPI fee ${splitters.feeBp / 100}%)` : "";
107813
- return [
107814
- `Splitters${fee}:`,
107815
- ...states.map((state) => {
107816
- const label = [state.name, state.network].filter(Boolean).join(" ");
107817
- const address4 = typeof state.splitterAddress === "string" ? state.splitterAddress : "unknown";
107818
- return ` ${label || "network"} ${address4} ${state.deployed === true ? "deployed" : "not deployed"}`;
107819
- }),
107820
- nextStep
107821
- ];
108457
+ function formatDescriptionWarnings(created) {
108458
+ const warnings = Array.isArray(created.descriptionWarnings) ? created.descriptionWarnings : [];
108459
+ const lines = warnings.flatMap((warning) => {
108460
+ if (typeof warning !== "object" || warning === null) return [];
108461
+ const { message, hint } = warning;
108462
+ if (typeof message !== "string") return [];
108463
+ return [`- ${message}${typeof hint === "string" ? ` ${hint}` : ""}`];
108464
+ });
108465
+ return lines.length === 0 ? [] : ["Description check (the listing is published either way):", ...lines];
107822
108466
  }
107823
108467
  function formatListingStatus(slug, action, result) {
107824
108468
  const status = typeof result.status === "string" ? result.status : "unknown";
@@ -108366,26 +109010,42 @@ function formatSearch(page) {
108366
109010
  verificationTag({ verification: item.verification, external: isMirroredHit(item) })
108367
109011
  ];
108368
109012
  const prefix = [...new Set(tags)].map((tag) => `[${tag}] `).join("");
109013
+ const health = item.kind === "api" && item.health ? `${item.health.state}${item.health.latencyP50Ms === null ? "" : ` ${Math.round(item.health.latencyP50Ms)}ms`}` : "-";
108369
109014
  return [
108370
- `${item.ref} ${item.kind} ${prefix}${item.card.title}`,
109015
+ `${item.ref} ${item.kind} ${health} ${prefix}${item.card.title}`,
108371
109016
  ` ${item.card.summary}`,
108372
- ...item.fee ? [` Fee: ${item.fee.label}`] : []
109017
+ ...item.fee ? [` Fee: ${formatListingFee(item.fee)}`] : [],
109018
+ ...item.kind === "api" && item.alternatives ? [
109019
+ ` Alternatives: ${item.alternatives.map((alternative) => `${alternative.ref} (${alternative.reason})`).join(", ")}`
109020
+ ] : []
108373
109021
  ].join("\n");
108374
109022
  }).join("\n");
108375
109023
  }
108376
109024
  function formatInspect(result) {
109025
+ const { hints: _hints, ...humanResult } = result;
109026
+ void _hints;
108377
109027
  return [
108378
109028
  `Verification: ${verificationTag({
108379
109029
  verification: result.verification,
108380
109030
  external: result.group === "external"
108381
109031
  })}`,
108382
- ...result.fee ? [`Fee: ${result.fee.label}`] : [],
109032
+ ...result.fee ? [`Fee: ${formatListingFee(result.fee)}`] : [],
109033
+ ...result.health ? [formatHealth(result.health)] : [],
109034
+ ...result.exampleRequest ? [`Example request: ${JSON.stringify(result.exampleRequest)}`] : [],
108383
109035
  ...result.liveness ? [formatLiveness(result.liveness)] : [],
108384
109036
  ...result.conformance ? [formatConformance(result.conformance)] : [],
108385
109037
  ...result.identity ? formatIdentityLines(result.identity) : [],
108386
- JSON.stringify(result, null, 2)
109038
+ JSON.stringify(humanResult, null, 2)
108387
109039
  ].join("\n");
108388
109040
  }
109041
+ function formatHealth(health) {
109042
+ return [
109043
+ `Health: ${health.state}`,
109044
+ ...health.uptime7d === null ? [`(${health.checks7d} checks)`] : [`${(health.uptime7d * 100).toFixed(1)}% up over 7 days (${health.checks7d} checks)`],
109045
+ ...health.latencyP50Ms === null ? [] : [`p50 ${Math.round(health.latencyP50Ms)} ms`],
109046
+ ...health.latencyP95Ms === null ? [] : [`p95 ${Math.round(health.latencyP95Ms)} ms`]
109047
+ ].join(" \xB7 ");
109048
+ }
108389
109049
  function formatLiveness(liveness) {
108390
109050
  const checks = `${liveness.checks7d} check${liveness.checks7d === 1 ? "" : "s"}`;
108391
109051
  return [
@@ -108430,7 +109090,7 @@ function formatFund(address4, url2, opened) {
108430
109090
  function openInBrowser(url2) {
108431
109091
  const opener = process.platform === "darwin" ? { command: "open", args: [url2] } : process.platform === "win32" ? { command: "cmd", args: ["/c", "start", "", url2] } : { command: "xdg-open", args: [url2] };
108432
109092
  try {
108433
- const child = spawn3(opener.command, opener.args, { stdio: "ignore", detached: true });
109093
+ const child = spawn4(opener.command, opener.args, { stdio: "ignore", detached: true });
108434
109094
  child.on("error", () => void 0);
108435
109095
  child.unref();
108436
109096
  return true;
@@ -108772,7 +109432,7 @@ async function latestNotice(options, env, signal) {
108772
109432
  let cached2;
108773
109433
  try {
108774
109434
  const value = JSON.parse(await readFile29(paths.updateCheck, "utf8"));
108775
- if (isRecord12(value) && typeof value.checkedAt === "number" && Number.isFinite(value.checkedAt) && typeof value.latest === "string" && parseVersion(value.latest)) {
109435
+ if (isRecord13(value) && typeof value.checkedAt === "number" && Number.isFinite(value.checkedAt) && typeof value.latest === "string" && parseVersion(value.latest)) {
108776
109436
  cached2 = { checkedAt: value.checkedAt, latest: value.latest };
108777
109437
  }
108778
109438
  } catch {
@@ -108805,7 +109465,7 @@ async function latestNotice(options, env, signal) {
108805
109465
  if (!response.ok) return void 0;
108806
109466
  const body = await response.json();
108807
109467
  signal.throwIfAborted();
108808
- if (!isRecord12(body) || typeof body.version !== "string" || !parseVersion(body.version)) {
109468
+ if (!isRecord13(body) || typeof body.version !== "string" || !parseVersion(body.version)) {
108809
109469
  return void 0;
108810
109470
  }
108811
109471
  latest = body.version;
@@ -108814,7 +109474,7 @@ async function latestNotice(options, env, signal) {
108814
109474
  signal.throwIfAborted();
108815
109475
  return isNewerVersion(latest, CLI_VERSION) ? `vapi-network ${latest} is available (you have ${CLI_VERSION}). Update: npm i -g vapi-network@latest` : void 0;
108816
109476
  }
108817
- function isRecord12(value) {
109477
+ function isRecord13(value) {
108818
109478
  return typeof value === "object" && value !== null && !Array.isArray(value);
108819
109479
  }
108820
109480
  function parseVersion(version5) {