claudish 7.12.7 → 7.14.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/AI_AGENT_GUIDE.md CHANGED
@@ -266,7 +266,7 @@ for (const model of models) {
266
266
  | `--default-provider <name>` | Override default provider for bare model routing (v7.0.0+) | Auto-detected |
267
267
  | `--quiet` / `-q` | Suppress logs | Enabled in single-shot |
268
268
  | `--verbose` / `-v` | Show logs | Enabled in interactive |
269
- | `--log-debug` / `-d` | Debug logging to file | Disabled |
269
+ | `--debug-claudish` / `-d` | Debug logging to file | Disabled |
270
270
  | `--no-auto-approve` | Require prompts | Auto-approve enabled |
271
271
 
272
272
  ### Claude Code Flag Passthrough
package/dist/index.js CHANGED
@@ -581,7 +581,7 @@ var init_onepassword_config = __esm(() => {
581
581
  });
582
582
 
583
583
  // src/version.ts
584
- var VERSION = "7.12.7";
584
+ var VERSION = "7.14.0";
585
585
 
586
586
  // src/logger.ts
587
587
  var exports_logger = {};
@@ -31354,6 +31354,28 @@ var init_base_api_format = __esm(() => {
31354
31354
  };
31355
31355
  });
31356
31356
 
31357
+ // src/adapters/reasoning-cache.ts
31358
+ function rememberReasoningForCall(callId, items) {
31359
+ if (!callId || items.length === 0)
31360
+ return;
31361
+ if (cache.has(callId))
31362
+ cache.delete(callId);
31363
+ cache.set(callId, items);
31364
+ while (cache.size > MAX_ENTRIES) {
31365
+ const oldest = cache.keys().next().value;
31366
+ if (oldest === undefined)
31367
+ break;
31368
+ cache.delete(oldest);
31369
+ }
31370
+ }
31371
+ function reasoningForCall(callId) {
31372
+ return cache.get(callId);
31373
+ }
31374
+ var MAX_ENTRIES = 500, cache;
31375
+ var init_reasoning_cache = __esm(() => {
31376
+ cache = new Map;
31377
+ });
31378
+
31357
31379
  // src/adapters/codex-api-format.ts
31358
31380
  function normalizeCodexModel(modelId) {
31359
31381
  if (!modelId)
@@ -31365,6 +31387,7 @@ var CodexAPIFormat;
31365
31387
  var init_codex_api_format = __esm(() => {
31366
31388
  init_logger();
31367
31389
  init_base_api_format();
31390
+ init_reasoning_cache();
31368
31391
  CodexAPIFormat = class CodexAPIFormat extends BaseAPIFormat {
31369
31392
  processTextContent(textContent, _accumulatedText) {
31370
31393
  return {
@@ -31387,6 +31410,10 @@ var init_codex_api_format = __esm(() => {
31387
31410
  }
31388
31411
  buildPayload(claudeRequest, messages, tools) {
31389
31412
  const convertedMessages = this.convertMessagesToResponsesAPI(messages);
31413
+ const replayedReasoning = convertedMessages.filter((i) => i.type === "reasoning").length;
31414
+ if (replayedReasoning > 0) {
31415
+ log(`[CodexAPIFormat] replaying ${replayedReasoning} cached reasoning item(s)`);
31416
+ }
31390
31417
  const normalizedModel = normalizeCodexModel(this.modelId);
31391
31418
  const strippedMessages = convertedMessages.map((item) => {
31392
31419
  const { id, ...rest } = item;
@@ -31491,6 +31518,9 @@ var init_codex_api_format = __esm(() => {
31491
31518
  }
31492
31519
  for (const toolCall of msg.tool_calls) {
31493
31520
  if (toolCall.type === "function") {
31521
+ const reasoning = reasoningForCall(toolCall.id);
31522
+ if (reasoning?.length)
31523
+ result.push(...reasoning);
31494
31524
  result.push({
31495
31525
  type: "function_call",
31496
31526
  call_id: toolCall.id,
@@ -36157,10 +36187,10 @@ function getCachedEntries() {
36157
36187
  if (mtimeMs === _memoMtimeMs && _memoEntries !== null) {
36158
36188
  return _memoEntries;
36159
36189
  }
36160
- const cache = readAllModelsCache();
36161
- if (!cache)
36190
+ const cache2 = readAllModelsCache();
36191
+ if (!cache2)
36162
36192
  return null;
36163
- _memoEntries = cache.entries;
36193
+ _memoEntries = cache2.entries;
36164
36194
  _memoMtimeMs = mtimeMs;
36165
36195
  return _memoEntries;
36166
36196
  }
@@ -38150,6 +38180,7 @@ function createResponsesStreamHandler(c, response, opts) {
38150
38180
  let reasoningIdx = -1;
38151
38181
  let lastSummaryIndex = -1;
38152
38182
  let incompleteReason = null;
38183
+ let pendingReasoning = [];
38153
38184
  let inputTokens = 0;
38154
38185
  let outputTokens = 0;
38155
38186
  let hasToolUse = false;
@@ -38266,6 +38297,10 @@ data: ${JSON.stringify(data)}
38266
38297
  functionCalls.set(itemId, fnCallData);
38267
38298
  }
38268
38299
  openToolBlocks.add(fnCallData);
38300
+ if (pendingReasoning.length > 0) {
38301
+ rememberReasoningForCall(callId, pendingReasoning);
38302
+ pendingReasoning = [];
38303
+ }
38269
38304
  send("content_block_start", {
38270
38305
  type: "content_block_start",
38271
38306
  index: fnCallData.index,
@@ -38311,6 +38346,14 @@ data: ${JSON.stringify(data)}
38311
38346
  });
38312
38347
  }
38313
38348
  } else if (event.type === "response.output_item.done") {
38349
+ if (event.item?.type === "reasoning" && event.item.encrypted_content) {
38350
+ pendingReasoning.push({
38351
+ type: "reasoning",
38352
+ content: event.item.content ?? [],
38353
+ encrypted_content: event.item.encrypted_content,
38354
+ summary: event.item.summary ?? []
38355
+ });
38356
+ }
38314
38357
  if (event.item?.type === "function_call") {
38315
38358
  const callId = event.item.call_id || event.item.id;
38316
38359
  const fnCall = functionCalls.get(callId) || functionCalls.get(event.item.id);
@@ -38449,6 +38492,7 @@ data: ${JSON.stringify(data)}
38449
38492
  });
38450
38493
  }
38451
38494
  var init_openai_responses_sse = __esm(() => {
38495
+ init_reasoning_cache();
38452
38496
  init_logger();
38453
38497
  });
38454
38498
 
@@ -39446,15 +39490,15 @@ class OpenRouterCatalogResolver {
39446
39490
  _getEntries() {
39447
39491
  if (_memCache)
39448
39492
  return _memCache;
39449
- const cache = readAllModelsCache();
39450
- if (!cache)
39493
+ const cache2 = readAllModelsCache();
39494
+ if (!cache2)
39451
39495
  return null;
39452
- if (cache.entries.length > 0) {
39453
- _memCache = cache.entries;
39496
+ if (cache2.entries.length > 0) {
39497
+ _memCache = cache2.entries;
39454
39498
  return _memCache;
39455
39499
  }
39456
- if (cache.models.length > 0) {
39457
- _memCache = cache.models.map((m) => ({
39500
+ if (cache2.models.length > 0) {
39501
+ _memCache = cache2.models.map((m) => ({
39458
39502
  modelId: m.id.includes("/") ? m.id.split("/").slice(1).join("/") : m.id,
39459
39503
  aliases: [],
39460
39504
  sources: { "openrouter-api": { externalId: m.id } }
@@ -58397,8 +58441,8 @@ async function codexQuotaHandler() {
58397
58441
  try {
58398
58442
  const modelsPath = join22(homedir21(), ".codex", "models_cache.json");
58399
58443
  if (existsSync20(modelsPath)) {
58400
- const cache = JSON.parse(readFileSync18(modelsPath, "utf-8"));
58401
- modelSlugs = (cache.models || []).map((m) => m.slug || m.id).filter(Boolean);
58444
+ const cache2 = JSON.parse(readFileSync18(modelsPath, "utf-8"));
58445
+ modelSlugs = (cache2.models || []).map((m) => m.slug || m.id).filter(Boolean);
58402
58446
  }
58403
58447
  } catch {}
58404
58448
  const W = 58;
@@ -58636,13 +58680,13 @@ function slimEntryToCatalogModel(entry) {
58636
58680
  };
58637
58681
  }
58638
58682
  function readSlimCacheWithFreshness(reader) {
58639
- const cache = reader();
58640
- if (!cache)
58683
+ const cache2 = reader();
58684
+ if (!cache2)
58641
58685
  return { entries: [], stale: true };
58642
- const lastUpdatedMs = new Date(cache.lastUpdated).getTime();
58686
+ const lastUpdatedMs = new Date(cache2.lastUpdated).getTime();
58643
58687
  const ageMs = Date.now() - lastUpdatedMs;
58644
58688
  const stale = !Number.isFinite(lastUpdatedMs) || ageMs > FIREBASE_CACHE_TTL_MS;
58645
- return { entries: cache.entries ?? [], stale };
58689
+ return { entries: cache2.entries ?? [], stale };
58646
58690
  }
58647
58691
  function createCatalogClient(deps = {}) {
58648
58692
  const _getModelsByProvider = deps.getModelsByProvider ?? getModelsByProvider;
@@ -62424,11 +62468,14 @@ async function parseArgs(args) {
62424
62468
  config3.dangerous = true;
62425
62469
  } else if (arg === "--interactive" || arg === "-i") {
62426
62470
  config3.interactive = true;
62427
- } else if (arg === "--log-debug" || arg === "-d") {
62471
+ } else if (arg === "--debug-claudish" || arg === "-d") {
62428
62472
  config3.debug = true;
62429
62473
  if (config3.logLevel === "info") {
62430
62474
  config3.logLevel = "debug";
62431
62475
  }
62476
+ } else if (arg === "--log-debug") {
62477
+ console.error("--log-debug was renamed to --debug-claudish (it enables claudish's own debug log, not Claude Code's --debug).");
62478
+ process.exit(1);
62432
62479
  } else if (arg === "--log-level") {
62433
62480
  const levelArg = args[++i];
62434
62481
  if (!levelArg || !["debug", "info", "minimal"].includes(levelArg)) {
@@ -62649,7 +62696,7 @@ Usage: claudish --models --provider <slug>`);
62649
62696
  if (!config3.quiet) {
62650
62697
  console.log("[claudish] Monitor mode enabled - proxying to real Anthropic API");
62651
62698
  console.log("[claudish] Using Claude Code's native authentication");
62652
- console.log("[claudish] Tip: Run with --log-debug to see request/response details");
62699
+ console.log("[claudish] Tip: Run with --debug-claudish to see request/response details");
62653
62700
  }
62654
62701
  }
62655
62702
  config3.openrouterApiKey = process.env[ENV.OPENROUTER_API_KEY];
@@ -63530,7 +63577,7 @@ ${h("OPTIONS")}
63530
63577
  ${green("--op")} ${yellow("<glob>")} ${green("--list")} Preview which fields the glob would import (names only, no values)
63531
63578
  ${green("--op-env")} ${yellow("<id>")} Load env vars from a 1Password Environment (highest priority)
63532
63579
  ${green("--port")} ${yellow("<port>")} Proxy server port (default: random)
63533
- ${green("-d, --log-debug")} Enable debug logging to file (logs/claudish_*.log)
63580
+ ${green("-d, --debug-claudish")} Enable claudish debug logging to file (logs/claudish_*.log)
63534
63581
  ${green("--log-off")} Disable always-on structural logging (~/.claudish/logs/)
63535
63582
  ${green("--log-diag")} ${yellow("<mode>")} Diagnostic output: auto (default), logfile, off
63536
63583
  ${dim('Also: CLAUDISH_DIAG_MODE env var or "diagMode" in config.json')}
@@ -63913,8 +63960,8 @@ function writeCache(latestVersion) {
63913
63960
  writeFileSync15(cachePath, JSON.stringify(data), "utf-8");
63914
63961
  } catch {}
63915
63962
  }
63916
- function isCacheValid(cache) {
63917
- const age = Date.now() - cache.lastCheck;
63963
+ function isCacheValid(cache2) {
63964
+ const age = Date.now() - cache2.lastCheck;
63918
63965
  return age < CACHE_MAX_AGE_MS;
63919
63966
  }
63920
63967
  function clearCache() {
@@ -63978,9 +64025,9 @@ async function fetchLatestVersion(options = {}) {
63978
64025
  async function checkForUpdates(currentVersion, options = {}) {
63979
64026
  const { quiet = false } = options;
63980
64027
  let latestVersion = null;
63981
- const cache = readCache();
63982
- if (cache && isCacheValid(cache)) {
63983
- latestVersion = cache.latestVersion;
64028
+ const cache2 = readCache();
64029
+ if (cache2 && isCacheValid(cache2)) {
64030
+ latestVersion = cache2.latestVersion;
63984
64031
  } else {
63985
64032
  latestVersion = await fetchLatestVersion();
63986
64033
  writeCache(latestVersion);
@@ -64891,10 +64938,10 @@ async function forceRefreshProbeModels() {
64891
64938
  }
64892
64939
  }
64893
64940
  function getProbeModel(claudishSlug) {
64894
- const cache = readProbeModelsCache();
64895
- if (!cache)
64941
+ const cache2 = readProbeModelsCache();
64942
+ if (!cache2)
64896
64943
  return null;
64897
- const entry = cache.providers[claudishSlug];
64944
+ const entry = cache2.providers[claudishSlug];
64898
64945
  return typeof entry === "string" && entry.length > 0 ? entry : null;
64899
64946
  }
64900
64947
  async function discoverProbeModelFromEndpoint(proxyUrl, providerSlug, exclude) {
@@ -71760,12 +71807,12 @@ function shouldWarmCatalog(args) {
71760
71807
  }
71761
71808
  return true;
71762
71809
  }
71763
- function classifyCatalogState(cache, ttlHours, now) {
71764
- if (cache === null)
71810
+ function classifyCatalogState(cache2, ttlHours, now) {
71811
+ if (cache2 === null)
71765
71812
  return "missing";
71766
- if (cache.entries.length === 0 && cache.models.length === 0)
71813
+ if (cache2.entries.length === 0 && cache2.models.length === 0)
71767
71814
  return "missing";
71768
- const lastUpdatedMs = Date.parse(cache.lastUpdated);
71815
+ const lastUpdatedMs = Date.parse(cache2.lastUpdated);
71769
71816
  if (Number.isNaN(lastUpdatedMs))
71770
71817
  return "missing";
71771
71818
  const ageMs = now.getTime() - lastUpdatedMs;
@@ -71826,8 +71873,8 @@ async function warmCatalogIfNeeded(config3, opts) {
71826
71873
  const ttlHoursRaw = opts?.ttlHours ?? Number.parseFloat(process.env.CLAUDISH_CATALOG_TTL_HOURS ?? "24");
71827
71874
  const ttlHours = Number.isFinite(ttlHoursRaw) && ttlHoursRaw > 0 ? ttlHoursRaw : 24;
71828
71875
  const now = opts?.now ?? new Date;
71829
- const cache = readAllModelsCache();
71830
- const state = classifyCatalogState(cache, ttlHours, now);
71876
+ const cache2 = readAllModelsCache();
71877
+ const state = classifyCatalogState(cache2, ttlHours, now);
71831
71878
  if (state === "fresh" && !config3.forceUpdate) {
71832
71879
  return "ok";
71833
71880
  }
@@ -71854,14 +71901,14 @@ async function warmCatalogIfNeeded(config3, opts) {
71854
71901
  return "ok";
71855
71902
  }
71856
71903
  if (state === "stale") {
71857
- const ageMs = now.getTime() - Date.parse(cache.lastUpdated);
71904
+ const ageMs = now.getTime() - Date.parse(cache2.lastUpdated);
71858
71905
  const ageStr = humanizeAge(ageMs);
71859
71906
  process.stderr.write(`WARNING: Catalog stale (${ageStr}). Using cached version. Run \`claudish --models-refresh\` to retry.
71860
71907
  `);
71861
71908
  return "warned";
71862
71909
  }
71863
71910
  if (state === "fresh") {
71864
- const ageMs = now.getTime() - Date.parse(cache.lastUpdated);
71911
+ const ageMs = now.getTime() - Date.parse(cache2.lastUpdated);
71865
71912
  const ageStr = humanizeAge(ageMs);
71866
71913
  process.stderr.write(`WARNING: Catalog refresh failed (cache age ${ageStr}). Using cached version.
71867
71914
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "7.12.7",
3
+ "version": "7.14.0",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,10 +60,10 @@
60
60
  "ai"
61
61
  ],
62
62
  "optionalDependencies": {
63
- "@claudish/magmux-darwin-arm64": "7.12.7",
64
- "@claudish/magmux-darwin-x64": "7.12.7",
65
- "@claudish/magmux-linux-arm64": "7.12.7",
66
- "@claudish/magmux-linux-x64": "7.12.7"
63
+ "@claudish/magmux-darwin-arm64": "7.14.0",
64
+ "@claudish/magmux-darwin-x64": "7.14.0",
65
+ "@claudish/magmux-linux-arm64": "7.14.0",
66
+ "@claudish/magmux-linux-x64": "7.14.0"
67
67
  },
68
68
  "author": "Jack Rudenko <i@madappgang.com>",
69
69
  "license": "MIT",