crosscheck-mcp 0.1.5 → 0.1.7

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.
@@ -1318,6 +1318,53 @@ function defaultTransient(kind) {
1318
1318
  return kind === "rate_limit" || kind === "server" || kind === "timeout" || kind === "network";
1319
1319
  }
1320
1320
 
1321
+ // src/providers/http-errors.ts
1322
+ init_cjs_shims();
1323
+ var CREDIT_RE = /insufficient|no\s+credit|credits?|billing|quota|payment\s*required|exceeded your current quota|not\s+enough|fund|no active subscription|spend limit/i;
1324
+ function isCreditsFailure(status, bodyText) {
1325
+ if (status === 402) return true;
1326
+ if (status === 401 || status === 403 || status === 429 || status === 400) {
1327
+ return CREDIT_RE.test(bodyText);
1328
+ }
1329
+ return false;
1330
+ }
1331
+ function httpFailureToProviderError(provider, status, bodyText) {
1332
+ const detail = bodyText.slice(0, 512);
1333
+ if (isCreditsFailure(status, bodyText)) {
1334
+ return new ProviderError(
1335
+ "auth",
1336
+ `${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}`,
1337
+ { status }
1338
+ );
1339
+ }
1340
+ if (status === 401 || status === 403) {
1341
+ return new ProviderError(
1342
+ "auth",
1343
+ `${provider}: API key rejected (HTTP ${status}). Check that the key is correct, active, and from the right ${provider} account. Detail: ${detail}`,
1344
+ { status }
1345
+ );
1346
+ }
1347
+ if (status === 429) {
1348
+ return new ProviderError(
1349
+ "rate_limit",
1350
+ `${provider}: rate limited (HTTP 429). Detail: ${detail}`,
1351
+ { status }
1352
+ );
1353
+ }
1354
+ if (status >= 500 && status <= 599) {
1355
+ return new ProviderError(
1356
+ "server",
1357
+ `${provider}: upstream server error (HTTP ${status}). Detail: ${detail}`,
1358
+ { status }
1359
+ );
1360
+ }
1361
+ return new ProviderError(
1362
+ "client",
1363
+ `${provider}: request failed (HTTP ${status}). Detail: ${detail}`,
1364
+ { status }
1365
+ );
1366
+ }
1367
+
1321
1368
  // src/providers/anthropic.ts
1322
1369
  var ANTHROPIC_API_URL = "https://api.anthropic.com/v1/messages";
1323
1370
  var ANTHROPIC_VERSION_HEADER = "2023-06-01";
@@ -1466,16 +1513,7 @@ async function sendAnthropic(args) {
1466
1513
  return { text, attempts: 1, usage: applyPricing(usage, args.pricing) };
1467
1514
  }
1468
1515
  const bodyText = await respLike.text().catch(() => "");
1469
- if (status === 401 || status === 403) {
1470
- throw new ProviderError("auth", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1471
- }
1472
- if (status === 429) {
1473
- throw new ProviderError("rate_limit", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1474
- }
1475
- if (status >= 500 && status <= 599) {
1476
- throw new ProviderError("server", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1477
- }
1478
- throw new ProviderError("client", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1516
+ throw httpFailureToProviderError("anthropic", status, bodyText);
1479
1517
  }
1480
1518
 
1481
1519
  // src/providers/gemini.ts
@@ -1649,16 +1687,7 @@ async function sendGemini(args) {
1649
1687
  return { text, attempts: 1, usage: applyPricing2(usage, args.pricing) };
1650
1688
  }
1651
1689
  const bodyText = await respLike.text().catch(() => "");
1652
- if (status === 401 || status === 403) {
1653
- throw new ProviderError("auth", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1654
- }
1655
- if (status === 429) {
1656
- throw new ProviderError("rate_limit", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1657
- }
1658
- if (status >= 500 && status <= 599) {
1659
- throw new ProviderError("server", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1660
- }
1661
- throw new ProviderError("client", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1690
+ throw httpFailureToProviderError("gemini", status, bodyText);
1662
1691
  }
1663
1692
 
1664
1693
  // src/providers/openai-compatible.ts
@@ -1780,6 +1809,12 @@ async function sendOpenAICompatible(args) {
1780
1809
  temperature: args.temperature,
1781
1810
  ...args.jsonSchema ? { jsonSchema: args.jsonSchema } : {}
1782
1811
  });
1812
+ if (args.provider === "openai" && isReasoningModel("openai", args.model) && !/^o1(?:-|$)/i.test(args.model)) {
1813
+ const effort = (process.env["CROSSCHECK_OPENAI_REASONING_EFFORT"] ?? "low").toLowerCase();
1814
+ if (effort === "minimal" || effort === "low" || effort === "medium" || effort === "high") {
1815
+ body.reasoning_effort = effort;
1816
+ }
1817
+ }
1783
1818
  const doFetch = args.fetchImpl ?? globalThis.fetch;
1784
1819
  const init = {
1785
1820
  method: "POST",
@@ -1810,16 +1845,7 @@ async function sendOpenAICompatible(args) {
1810
1845
  return { text, attempts: 1, usage: applyPricing3(usage, args.pricing) };
1811
1846
  }
1812
1847
  const bodyText = await respLike.text().catch(() => "");
1813
- if (status === 401 || status === 403) {
1814
- throw new ProviderError("auth", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1815
- }
1816
- if (status === 429) {
1817
- throw new ProviderError("rate_limit", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1818
- }
1819
- if (status >= 500 && status <= 599) {
1820
- throw new ProviderError("server", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1821
- }
1822
- throw new ProviderError("client", `HTTP ${status}: ${bodyText.slice(0, 512)}`, { status });
1848
+ throw httpFailureToProviderError(args.provider, status, bodyText);
1823
1849
  }
1824
1850
 
1825
1851
  // src/providers/registry.ts
@@ -1914,7 +1940,7 @@ function makeGeminiProvider(model, apiKey, opts) {
1914
1940
  // src/server.ts
1915
1941
  init_cjs_shims();
1916
1942
  var import_server2 = require("@modelcontextprotocol/sdk/server/index.js");
1917
- var import_types5 = require("@modelcontextprotocol/sdk/types.js");
1943
+ var import_types6 = require("@modelcontextprotocol/sdk/types.js");
1918
1944
 
1919
1945
  // src/instructions.ts
1920
1946
  init_cjs_shims();
@@ -10708,7 +10734,7 @@ function pingTool() {
10708
10734
 
10709
10735
  // src/server.ts
10710
10736
  var SERVER_NAME = "crosscheck-agent";
10711
- var SERVER_VERSION = true ? "0.1.5" : "0.0.0-dev";
10737
+ var SERVER_VERSION = true ? "0.1.7" : "0.0.0-dev";
10712
10738
  function createServer(opts = {}) {
10713
10739
  const server = new import_server2.Server(
10714
10740
  { name: SERVER_NAME, version: SERVER_VERSION },
@@ -10721,14 +10747,14 @@ function createServer(opts = {}) {
10721
10747
  }
10722
10748
  );
10723
10749
  const tools = buildToolRegistry(opts);
10724
- server.setRequestHandler(import_types5.ListToolsRequestSchema, async () => ({
10750
+ server.setRequestHandler(import_types6.ListToolsRequestSchema, async () => ({
10725
10751
  tools: Array.from(tools.values()).map((t) => ({
10726
10752
  name: t.name,
10727
10753
  description: t.description,
10728
10754
  inputSchema: t.inputSchema
10729
10755
  }))
10730
10756
  }));
10731
- server.setRequestHandler(import_types5.CallToolRequestSchema, async (req) => {
10757
+ server.setRequestHandler(import_types6.CallToolRequestSchema, async (req) => {
10732
10758
  const name = req.params.name;
10733
10759
  const tool = tools.get(name);
10734
10760
  if (!tool) {