crosscheck-mcp 0.2.20 → 0.2.21

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.
@@ -499,12 +499,20 @@ var ProviderError = class extends Error {
499
499
  * actually fix. Distinct from `transient`: this is never worth
500
500
  * retrying the SAME model, but IS worth trying a different one. */
501
501
  modelAccessFailure;
502
+ /** True for "the key works, the account is out of credit / over a spend
503
+ * limit." Rides alongside kind "auth" rather than replacing it, because
504
+ * every retry and fallback decision downstream is already tuned to that
505
+ * kind — but the two are completely different things to a human, and
506
+ * reporting "API key rejected" for an unpaid invoice sends people to
507
+ * regenerate a key that was never the problem. */
508
+ billing;
502
509
  constructor(kind, message, opts) {
503
510
  super(message);
504
511
  this.kind = kind;
505
512
  this.status = opts?.status;
506
513
  this.transient = opts?.transient ?? defaultTransient(kind);
507
514
  this.modelAccessFailure = opts?.modelAccessFailure ?? false;
515
+ this.billing = opts?.billing ?? false;
508
516
  if (opts?.retryAfterS !== void 0) {
509
517
  this.retryAfterS = opts.retryAfterS;
510
518
  }
@@ -542,7 +550,7 @@ function httpFailureToProviderError(provider, status, bodyText, retryAfterS, mod
542
550
  return new ProviderError(
543
551
  "auth",
544
552
  `${provider}: out of credits or billing isn't set up (HTTP ${status}). Your API key is reaching ${provider}, but the account has no usable balance \u2014 add credits / enable billing in your ${provider} console, then retry. Detail: ${detail}`,
545
- { status }
553
+ { status, billing: true }
546
554
  );
547
555
  }
548
556
  if (status === 401 || status === 403) {
@@ -1384,7 +1392,7 @@ var import_zod = require("zod");
1384
1392
 
1385
1393
  // src/server-meta.ts
1386
1394
  var SERVER_NAME = "crosscheck-agent";
1387
- var SERVER_VERSION = true ? "0.2.20" : "0.0.0-dev";
1395
+ var SERVER_VERSION = true ? "0.2.21" : "0.0.0-dev";
1388
1396
 
1389
1397
  // src/tools/audit.ts
1390
1398
  var import_node_fs4 = require("fs");
@@ -1890,7 +1898,9 @@ async function attachUsageBlock(result, answers, opts) {
1890
1898
  purpose: a.usage?.purpose ?? null,
1891
1899
  wall_ms: a.elapsed_ms ?? 0,
1892
1900
  cpu_ms: a.cpu_ms ?? 0,
1893
- cache_hit: Boolean(a.cache_hit)
1901
+ cache_hit: Boolean(a.cache_hit),
1902
+ ...a.error_kind ? { error_kind: a.error_kind } : {},
1903
+ ...a.error_billing ? { error_billing: true } : {}
1894
1904
  }))
1895
1905
  };
1896
1906
  result["timing"] = timing;
@@ -2191,11 +2201,13 @@ async function askOne(provider, messages, opts) {
2191
2201
  const cpuMs = Math.trunc((cpu.user + cpu.system) / 1e3);
2192
2202
  const kind = e instanceof ProviderError ? e.kind : "other";
2193
2203
  const msg = e instanceof Error ? e.message : String(e);
2204
+ const billing = e instanceof ProviderError && e.billing;
2194
2205
  return {
2195
2206
  provider: provider.name,
2196
2207
  model: provider.model,
2197
2208
  error: msg,
2198
2209
  error_kind: kind,
2210
+ ...billing ? { error_billing: true } : {},
2199
2211
  attempts: 0,
2200
2212
  usage: emptyUsage(provider.name, provider.model, opts.purpose),
2201
2213
  cache_hit: false,
@@ -11786,7 +11798,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
11786
11798
  var DEFAULT_PACKAGE = "crosscheck-cli";
11787
11799
  var FETCH_TIMEOUT_MS = 3e3;
11788
11800
  function engineVersion() {
11789
- return true ? "0.2.20" : "0.0.0-dev";
11801
+ return true ? "0.2.21" : "0.0.0-dev";
11790
11802
  }
11791
11803
  function defaultUpdateCachePath() {
11792
11804
  const base = process.env["CROSSCHECK_DATA_DIR"] || import_node_path12.default.join(import_node_os2.default.homedir() || import_node_os2.default.tmpdir(), ".crosscheck");