claudish 6.5.0 → 6.5.2

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
@@ -34296,7 +34296,7 @@ async function fetchGLMCodingModels() {
34296
34296
  return [];
34297
34297
  }
34298
34298
  }
34299
- var __filename4, __dirname4, VERSION = "6.5.0", CACHE_MAX_AGE_DAYS2 = 2, CLAUDISH_CACHE_DIR2, BUNDLED_MODELS_PATH, CACHED_MODELS_PATH, ALL_MODELS_JSON_PATH;
34299
+ var __filename4, __dirname4, VERSION = "6.5.2", CACHE_MAX_AGE_DAYS2 = 2, CLAUDISH_CACHE_DIR2, BUNDLED_MODELS_PATH, CACHED_MODELS_PATH, ALL_MODELS_JSON_PATH;
34300
34300
  var init_cli = __esm(() => {
34301
34301
  init_config();
34302
34302
  init_model_loader();
@@ -96423,6 +96423,7 @@ import {
96423
96423
  createWriteStream as createWriteStream4,
96424
96424
  existsSync as existsSync29,
96425
96425
  mkdirSync as mkdirSync16,
96426
+ readFileSync as readFileSync24,
96426
96427
  unlinkSync as unlinkSync11
96427
96428
  } from "fs";
96428
96429
  import { homedir as homedir27 } from "os";
@@ -96502,10 +96503,26 @@ class MtmDiagRunner {
96502
96503
  if (parts)
96503
96504
  this.adapters = parts;
96504
96505
  }
96506
+ if (msg.includes("Auth refreshed") && msg.includes("tier:")) {
96507
+ const tierMatch = msg.match(/tier:\s*(.+)$/);
96508
+ if (tierMatch)
96509
+ this.provider = tierMatch[1].trim();
96510
+ }
96511
+ if (msg.includes("[Fallback]") && msg.includes("succeeded")) {
96512
+ const fbMatch = msg.match(/\[Fallback\]\s+(\S+)\s+succeeded/);
96513
+ if (fbMatch)
96514
+ this.provider = fbMatch[1];
96515
+ }
96516
+ if (msg.includes("Rate limited") && msg.includes("retrying")) {
96517
+ this.lastError = msg.replace(/.*\]\s*/, "").substring(0, 60);
96518
+ }
96505
96519
  this.refreshStatusBar();
96506
96520
  }
96507
96521
  modelName = "";
96508
96522
  provider = "";
96523
+ port = "";
96524
+ quotaRemaining;
96525
+ tokenPollTimer = null;
96509
96526
  lastError = "";
96510
96527
  errorCount = 0;
96511
96528
  requestCount = 0;
@@ -96513,6 +96530,14 @@ class MtmDiagRunner {
96513
96530
  avgRoundtripMs = 0;
96514
96531
  roundtripSamples = [];
96515
96532
  adapters = "";
96533
+ setPort(port) {
96534
+ this.port = String(port);
96535
+ this.tokenPollTimer = setInterval(() => {
96536
+ const changed = this.readTokenFile();
96537
+ if (changed)
96538
+ this.refreshStatusBar();
96539
+ }, 3000);
96540
+ }
96516
96541
  setModel(name) {
96517
96542
  this.modelName = name.includes("/") ? name.split("/").pop() : name;
96518
96543
  if (name.includes("@")) {
@@ -96521,14 +96546,36 @@ class MtmDiagRunner {
96521
96546
  this.provider = name.split("/")[0];
96522
96547
  }
96523
96548
  }
96549
+ readTokenFile() {
96550
+ if (!this.port)
96551
+ return false;
96552
+ try {
96553
+ const tokPath = join31(homedir27(), ".claudish", `tokens-${this.port}.json`);
96554
+ const tok = JSON.parse(readFileSync24(tokPath, "utf-8"));
96555
+ let changed = false;
96556
+ if (typeof tok.quota_remaining === "number" && tok.quota_remaining !== this.quotaRemaining) {
96557
+ this.quotaRemaining = tok.quota_remaining;
96558
+ changed = true;
96559
+ }
96560
+ if (tok.provider_name && tok.provider_name !== this.provider) {
96561
+ this.provider = tok.provider_name;
96562
+ changed = true;
96563
+ }
96564
+ return changed;
96565
+ } catch {
96566
+ return false;
96567
+ }
96568
+ }
96524
96569
  refreshStatusBar() {
96570
+ this.readTokenFile();
96525
96571
  const bar = renderStatusBar({
96526
96572
  model: this.modelName,
96527
96573
  provider: this.provider,
96528
96574
  errorCount: this.errorCount,
96529
96575
  lastError: this.lastError,
96530
96576
  requestCount: this.requestCount,
96531
- avgRoundtripMs: this.avgRoundtripMs
96577
+ avgRoundtripMs: this.avgRoundtripMs,
96578
+ quotaRemaining: this.quotaRemaining
96532
96579
  });
96533
96580
  try {
96534
96581
  appendFileSync2(this.statusPath, bar + `
@@ -96539,6 +96586,10 @@ class MtmDiagRunner {
96539
96586
  return this.logPath;
96540
96587
  }
96541
96588
  cleanup() {
96589
+ if (this.tokenPollTimer) {
96590
+ clearInterval(this.tokenPollTimer);
96591
+ this.tokenPollTimer = null;
96592
+ }
96542
96593
  if (this.logStream) {
96543
96594
  try {
96544
96595
  this.logStream.end();
@@ -96593,16 +96644,17 @@ function shellQuote(s) {
96593
96644
  return "'" + s.replace(/'/g, "'\\''") + "'";
96594
96645
  }
96595
96646
  function renderStatusBar(state) {
96596
- const { model, provider, errorCount, lastError, requestCount, avgRoundtripMs } = state;
96647
+ const { model, provider, errorCount, lastError, requestCount, avgRoundtripMs, quotaRemaining } = state;
96597
96648
  const parts = [];
96598
96649
  parts.push("M: claudish ");
96599
96650
  if (model)
96600
96651
  parts.push(`C: ${model} `);
96601
96652
  if (provider)
96602
- parts.push(`D: ${provider} `);
96603
- if (requestCount > 0) {
96604
- const rt = avgRoundtripMs > 0 ? ` ~${avgRoundtripMs}ms` : "";
96605
- parts.push(`D: ${requestCount} req${rt} `);
96653
+ parts.push(`W: ${provider} `);
96654
+ if (typeof quotaRemaining === "number") {
96655
+ const pct = Math.round(quotaRemaining * 100);
96656
+ const color = pct > 50 ? "G" : pct > 20 ? "Y" : "R";
96657
+ parts.push(`${color}: ${pct}% quota `);
96606
96658
  }
96607
96659
  if (errorCount > 0) {
96608
96660
  const errLabel = errorCount === 1 ? " \u26A0 1 error " : ` \u26A0 ${errorCount} errors `;
@@ -96670,7 +96722,7 @@ var init_pty_diag_runner = __esm(() => {
96670
96722
 
96671
96723
  // src/index.ts
96672
96724
  var import_dotenv3 = __toESM(require_main(), 1);
96673
- import { existsSync as existsSync30, readFileSync as readFileSync24 } from "fs";
96725
+ import { existsSync as existsSync30, readFileSync as readFileSync25 } from "fs";
96674
96726
  import { homedir as homedir28 } from "os";
96675
96727
  import { join as join32 } from "path";
96676
96728
  import_dotenv3.config({ quiet: true });
@@ -96679,7 +96731,7 @@ function loadStoredApiKeys() {
96679
96731
  const configPath = join32(homedir28(), ".claudish", "config.json");
96680
96732
  if (!existsSync30(configPath))
96681
96733
  return;
96682
- const raw2 = readFileSync24(configPath, "utf-8");
96734
+ const raw2 = readFileSync25(configPath, "utf-8");
96683
96735
  const cfg = JSON.parse(raw2);
96684
96736
  if (cfg.apiKeys) {
96685
96737
  for (const [envVar, value] of Object.entries(cfg.apiKeys)) {
@@ -96938,8 +96990,10 @@ async function runCli() {
96938
96990
  });
96939
96991
  const needsMtm = cliConfig.interactive && (cliConfig.diagMode === "auto" || cliConfig.diagMode === "pty");
96940
96992
  const mtmRunner = needsMtm ? await tryCreateMtmRunner2() : null;
96941
- if (mtmRunner && explicitModel) {
96942
- mtmRunner.setModel(explicitModel);
96993
+ if (mtmRunner) {
96994
+ if (explicitModel)
96995
+ mtmRunner.setModel(explicitModel);
96996
+ mtmRunner.setPort(port);
96943
96997
  }
96944
96998
  const diag = createDiagOutput2({
96945
96999
  interactive: cliConfig.interactive,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "6.5.0",
3
+ "version": "6.5.2",
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",
@@ -17,7 +17,7 @@
17
17
  "average": "$0.56/1M"
18
18
  },
19
19
  "context": "196K",
20
- "maxOutputTokens": 196608,
20
+ "maxOutputTokens": 65536,
21
21
  "modality": "text->text",
22
22
  "supportsTools": true,
23
23
  "supportsReasoning": true,