claudish 6.5.0 → 6.5.1
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 +42 -11
- package/package.json +1 -1
- package/recommended-models.json +1 -1
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.
|
|
34299
|
+
var __filename4, __dirname4, VERSION = "6.5.1", 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,24 @@ 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 = "";
|
|
96509
96524
|
lastError = "";
|
|
96510
96525
|
errorCount = 0;
|
|
96511
96526
|
requestCount = 0;
|
|
@@ -96513,6 +96528,9 @@ class MtmDiagRunner {
|
|
|
96513
96528
|
avgRoundtripMs = 0;
|
|
96514
96529
|
roundtripSamples = [];
|
|
96515
96530
|
adapters = "";
|
|
96531
|
+
setPort(port) {
|
|
96532
|
+
this.port = String(port);
|
|
96533
|
+
}
|
|
96516
96534
|
setModel(name) {
|
|
96517
96535
|
this.modelName = name.includes("/") ? name.split("/").pop() : name;
|
|
96518
96536
|
if (name.includes("@")) {
|
|
@@ -96522,13 +96540,23 @@ class MtmDiagRunner {
|
|
|
96522
96540
|
}
|
|
96523
96541
|
}
|
|
96524
96542
|
refreshStatusBar() {
|
|
96543
|
+
let quotaRemaining;
|
|
96544
|
+
try {
|
|
96545
|
+
const tokPath = join31(homedir27(), ".claudish", `tokens-${this.port}.json`);
|
|
96546
|
+
const tok = JSON.parse(readFileSync24(tokPath, "utf-8"));
|
|
96547
|
+
if (typeof tok.quota_remaining === "number")
|
|
96548
|
+
quotaRemaining = tok.quota_remaining;
|
|
96549
|
+
if (!this.provider && tok.provider_name)
|
|
96550
|
+
this.provider = tok.provider_name;
|
|
96551
|
+
} catch {}
|
|
96525
96552
|
const bar = renderStatusBar({
|
|
96526
96553
|
model: this.modelName,
|
|
96527
96554
|
provider: this.provider,
|
|
96528
96555
|
errorCount: this.errorCount,
|
|
96529
96556
|
lastError: this.lastError,
|
|
96530
96557
|
requestCount: this.requestCount,
|
|
96531
|
-
avgRoundtripMs: this.avgRoundtripMs
|
|
96558
|
+
avgRoundtripMs: this.avgRoundtripMs,
|
|
96559
|
+
quotaRemaining
|
|
96532
96560
|
});
|
|
96533
96561
|
try {
|
|
96534
96562
|
appendFileSync2(this.statusPath, bar + `
|
|
@@ -96593,16 +96621,17 @@ function shellQuote(s) {
|
|
|
96593
96621
|
return "'" + s.replace(/'/g, "'\\''") + "'";
|
|
96594
96622
|
}
|
|
96595
96623
|
function renderStatusBar(state) {
|
|
96596
|
-
const { model, provider, errorCount, lastError, requestCount, avgRoundtripMs } = state;
|
|
96624
|
+
const { model, provider, errorCount, lastError, requestCount, avgRoundtripMs, quotaRemaining } = state;
|
|
96597
96625
|
const parts = [];
|
|
96598
96626
|
parts.push("M: claudish ");
|
|
96599
96627
|
if (model)
|
|
96600
96628
|
parts.push(`C: ${model} `);
|
|
96601
96629
|
if (provider)
|
|
96602
|
-
parts.push(`
|
|
96603
|
-
if (
|
|
96604
|
-
const
|
|
96605
|
-
|
|
96630
|
+
parts.push(`W: ${provider} `);
|
|
96631
|
+
if (typeof quotaRemaining === "number") {
|
|
96632
|
+
const pct = Math.round(quotaRemaining * 100);
|
|
96633
|
+
const color = pct > 50 ? "G" : pct > 20 ? "Y" : "R";
|
|
96634
|
+
parts.push(`${color}: ${pct}% quota `);
|
|
96606
96635
|
}
|
|
96607
96636
|
if (errorCount > 0) {
|
|
96608
96637
|
const errLabel = errorCount === 1 ? " \u26A0 1 error " : ` \u26A0 ${errorCount} errors `;
|
|
@@ -96670,7 +96699,7 @@ var init_pty_diag_runner = __esm(() => {
|
|
|
96670
96699
|
|
|
96671
96700
|
// src/index.ts
|
|
96672
96701
|
var import_dotenv3 = __toESM(require_main(), 1);
|
|
96673
|
-
import { existsSync as existsSync30, readFileSync as
|
|
96702
|
+
import { existsSync as existsSync30, readFileSync as readFileSync25 } from "fs";
|
|
96674
96703
|
import { homedir as homedir28 } from "os";
|
|
96675
96704
|
import { join as join32 } from "path";
|
|
96676
96705
|
import_dotenv3.config({ quiet: true });
|
|
@@ -96679,7 +96708,7 @@ function loadStoredApiKeys() {
|
|
|
96679
96708
|
const configPath = join32(homedir28(), ".claudish", "config.json");
|
|
96680
96709
|
if (!existsSync30(configPath))
|
|
96681
96710
|
return;
|
|
96682
|
-
const raw2 =
|
|
96711
|
+
const raw2 = readFileSync25(configPath, "utf-8");
|
|
96683
96712
|
const cfg = JSON.parse(raw2);
|
|
96684
96713
|
if (cfg.apiKeys) {
|
|
96685
96714
|
for (const [envVar, value] of Object.entries(cfg.apiKeys)) {
|
|
@@ -96938,8 +96967,10 @@ async function runCli() {
|
|
|
96938
96967
|
});
|
|
96939
96968
|
const needsMtm = cliConfig.interactive && (cliConfig.diagMode === "auto" || cliConfig.diagMode === "pty");
|
|
96940
96969
|
const mtmRunner = needsMtm ? await tryCreateMtmRunner2() : null;
|
|
96941
|
-
if (mtmRunner
|
|
96942
|
-
|
|
96970
|
+
if (mtmRunner) {
|
|
96971
|
+
if (explicitModel)
|
|
96972
|
+
mtmRunner.setModel(explicitModel);
|
|
96973
|
+
mtmRunner.setPort(port);
|
|
96943
96974
|
}
|
|
96944
96975
|
const diag = createDiagOutput2({
|
|
96945
96976
|
interactive: cliConfig.interactive,
|
package/package.json
CHANGED