claudish 5.5.2 → 5.6.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/dist/index.js CHANGED
@@ -29650,18 +29650,228 @@ var init_oauth_registry = __esm(() => {
29650
29650
  };
29651
29651
  });
29652
29652
 
29653
- // src/providers/auto-route.ts
29654
- import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
29653
+ // src/providers/catalog-resolvers/static-fallback.ts
29654
+ function staticOpenRouterFallback(userInput) {
29655
+ if (userInput.includes("/"))
29656
+ return userInput;
29657
+ const lower = userInput.toLowerCase();
29658
+ for (const [key, vendor] of Object.entries(OPENROUTER_VENDOR_MAP)) {
29659
+ if (lower.startsWith(key)) {
29660
+ return `${vendor}/${userInput}`;
29661
+ }
29662
+ }
29663
+ return null;
29664
+ }
29665
+ var OPENROUTER_VENDOR_MAP;
29666
+ var init_static_fallback = __esm(() => {
29667
+ OPENROUTER_VENDOR_MAP = {
29668
+ google: "google",
29669
+ openai: "openai",
29670
+ kimi: "moonshotai",
29671
+ "kimi-coding": "moonshotai",
29672
+ glm: "z-ai",
29673
+ "glm-coding": "z-ai",
29674
+ zai: "z-ai",
29675
+ minimax: "minimax",
29676
+ ollamacloud: "meta-llama",
29677
+ qwen: "qwen"
29678
+ };
29679
+ });
29680
+
29681
+ // src/providers/catalog-resolvers/openrouter.ts
29682
+ import { readFileSync as readFileSync7, existsSync as existsSync8 } from "node:fs";
29655
29683
  import { join as join8 } from "node:path";
29656
29684
  import { homedir as homedir7 } from "node:os";
29685
+
29686
+ class OpenRouterCatalogResolver {
29687
+ provider = "openrouter";
29688
+ resolveSync(userInput) {
29689
+ if (userInput.includes("/")) {
29690
+ const models2 = this._getModels();
29691
+ if (models2) {
29692
+ const exactMatch = models2.find((m) => m.id === userInput);
29693
+ return exactMatch ? exactMatch.id : userInput;
29694
+ }
29695
+ return userInput;
29696
+ }
29697
+ const models = this._getModels();
29698
+ if (models) {
29699
+ const suffix = `/${userInput}`;
29700
+ const match = models.find((m) => m.id.endsWith(suffix));
29701
+ if (match)
29702
+ return match.id;
29703
+ const lowerSuffix = `/${userInput.toLowerCase()}`;
29704
+ const ciMatch = models.find((m) => m.id.toLowerCase().endsWith(lowerSuffix));
29705
+ if (ciMatch)
29706
+ return ciMatch.id;
29707
+ }
29708
+ return staticOpenRouterFallback(userInput);
29709
+ }
29710
+ async warmCache() {
29711
+ try {
29712
+ const existing = getCachedOpenRouterModels();
29713
+ if (existing && existing.length > 0) {
29714
+ _memCache = existing;
29715
+ return;
29716
+ }
29717
+ const models = await ensureOpenRouterModelsLoaded();
29718
+ if (models.length > 0) {
29719
+ _memCache = models;
29720
+ }
29721
+ } catch {}
29722
+ }
29723
+ isCacheWarm() {
29724
+ return _memCache !== null && _memCache.length > 0;
29725
+ }
29726
+ _getModels() {
29727
+ if (_memCache)
29728
+ return _memCache;
29729
+ const diskPath = join8(homedir7(), ".claudish", "all-models.json");
29730
+ if (existsSync8(diskPath)) {
29731
+ try {
29732
+ const data = JSON.parse(readFileSync7(diskPath, "utf-8"));
29733
+ if (Array.isArray(data.models) && data.models.length > 0) {
29734
+ _memCache = data.models;
29735
+ return _memCache;
29736
+ }
29737
+ } catch {}
29738
+ }
29739
+ return null;
29740
+ }
29741
+ }
29742
+ var _memCache = null;
29743
+ var init_openrouter = __esm(() => {
29744
+ init_model_loader();
29745
+ init_static_fallback();
29746
+ });
29747
+
29748
+ // src/providers/catalog-resolvers/litellm.ts
29749
+ import { readFileSync as readFileSync8, existsSync as existsSync9 } from "node:fs";
29750
+ import { join as join9 } from "node:path";
29751
+ import { homedir as homedir8 } from "node:os";
29657
29752
  import { createHash as createHash3 } from "node:crypto";
29658
- function readLiteLLMCacheSync(baseUrl) {
29753
+ function getCachePath() {
29754
+ const baseUrl = process.env.LITELLM_BASE_URL;
29755
+ if (!baseUrl)
29756
+ return null;
29659
29757
  const hash2 = createHash3("sha256").update(baseUrl).digest("hex").substring(0, 16);
29660
- const cachePath = join8(homedir7(), ".claudish", `litellm-models-${hash2}.json`);
29661
- if (!existsSync8(cachePath))
29758
+ return join9(homedir8(), ".claudish", `litellm-models-${hash2}.json`);
29759
+ }
29760
+
29761
+ class LiteLLMCatalogResolver {
29762
+ provider = "litellm";
29763
+ resolveSync(userInput) {
29764
+ const ids = this._getModelIds();
29765
+ if (!ids || ids.length === 0)
29766
+ return null;
29767
+ if (ids.includes(userInput))
29768
+ return userInput;
29769
+ const prefixMatch = ids.find((id) => {
29770
+ if (!id.includes("/"))
29771
+ return false;
29772
+ const afterSlash = id.split("/").pop();
29773
+ return afterSlash === userInput;
29774
+ });
29775
+ if (prefixMatch)
29776
+ return prefixMatch;
29777
+ if (userInput.includes("/")) {
29778
+ const bare = userInput.split("/").pop();
29779
+ if (ids.includes(bare))
29780
+ return bare;
29781
+ }
29782
+ return null;
29783
+ }
29784
+ async warmCache() {
29785
+ const path = getCachePath();
29786
+ if (!path || !existsSync9(path))
29787
+ return;
29788
+ try {
29789
+ const data = JSON.parse(readFileSync8(path, "utf-8"));
29790
+ if (Array.isArray(data.models)) {
29791
+ _memCache2 = data.models.map((m) => m.name ?? m.id?.replace("litellm@", "") ?? "");
29792
+ }
29793
+ } catch {}
29794
+ }
29795
+ isCacheWarm() {
29796
+ return _memCache2 !== null && _memCache2.length > 0;
29797
+ }
29798
+ _getModelIds() {
29799
+ if (_memCache2)
29800
+ return _memCache2;
29801
+ const path = getCachePath();
29802
+ if (!path || !existsSync9(path))
29803
+ return null;
29804
+ try {
29805
+ const data = JSON.parse(readFileSync8(path, "utf-8"));
29806
+ if (Array.isArray(data.models)) {
29807
+ _memCache2 = data.models.map((m) => m.name ?? m.id?.replace("litellm@", "") ?? "");
29808
+ return _memCache2;
29809
+ }
29810
+ } catch {}
29811
+ return null;
29812
+ }
29813
+ }
29814
+ var _memCache2 = null;
29815
+ var init_litellm = () => {};
29816
+
29817
+ // src/providers/model-catalog-resolver.ts
29818
+ function registerResolver(resolver) {
29819
+ RESOLVER_REGISTRY.set(resolver.provider, resolver);
29820
+ }
29821
+ function getResolver(provider) {
29822
+ return RESOLVER_REGISTRY.get(provider) ?? null;
29823
+ }
29824
+ function resolveModelNameSync(userInput, targetProvider) {
29825
+ if (targetProvider !== "openrouter" && userInput.includes("/")) {
29826
+ return { resolvedId: userInput, wasResolved: false, sourceLabel: "passthrough" };
29827
+ }
29828
+ const resolver = getResolver(targetProvider);
29829
+ if (!resolver) {
29830
+ return { resolvedId: userInput, wasResolved: false, sourceLabel: "passthrough" };
29831
+ }
29832
+ const resolved = resolver.resolveSync(userInput);
29833
+ if (!resolved || resolved === userInput) {
29834
+ return { resolvedId: userInput, wasResolved: false, sourceLabel: "passthrough" };
29835
+ }
29836
+ return {
29837
+ resolvedId: resolved,
29838
+ wasResolved: true,
29839
+ sourceLabel: `${targetProvider} catalog`
29840
+ };
29841
+ }
29842
+ function logResolution(userInput, result, quiet = false) {
29843
+ if (result.wasResolved && !quiet) {
29844
+ process.stderr.write(`[Model] Resolved "${userInput}" → "${result.resolvedId}" (${result.sourceLabel})
29845
+ `);
29846
+ }
29847
+ }
29848
+ async function warmAllCatalogs(providers) {
29849
+ const targets = providers ? [...RESOLVER_REGISTRY.entries()].filter(([k]) => providers.includes(k)) : [...RESOLVER_REGISTRY.entries()];
29850
+ await Promise.allSettled(targets.map(([, r]) => r.warmCache()));
29851
+ }
29852
+ var RESOLVER_REGISTRY;
29853
+ var init_model_catalog_resolver = __esm(() => {
29854
+ init_openrouter();
29855
+ init_litellm();
29856
+ RESOLVER_REGISTRY = new Map;
29857
+ [
29858
+ new OpenRouterCatalogResolver,
29859
+ new LiteLLMCatalogResolver
29860
+ ].forEach(registerResolver);
29861
+ });
29862
+
29863
+ // src/providers/auto-route.ts
29864
+ import { existsSync as existsSync10, readFileSync as readFileSync9 } from "node:fs";
29865
+ import { join as join10 } from "node:path";
29866
+ import { homedir as homedir9 } from "node:os";
29867
+ import { createHash as createHash4 } from "node:crypto";
29868
+ function readLiteLLMCacheSync(baseUrl) {
29869
+ const hash2 = createHash4("sha256").update(baseUrl).digest("hex").substring(0, 16);
29870
+ const cachePath = join10(homedir9(), ".claudish", `litellm-models-${hash2}.json`);
29871
+ if (!existsSync10(cachePath))
29662
29872
  return null;
29663
29873
  try {
29664
- const data = JSON.parse(readFileSync7(cachePath, "utf-8"));
29874
+ const data = JSON.parse(readFileSync9(cachePath, "utf-8"));
29665
29875
  if (!Array.isArray(data.models))
29666
29876
  return null;
29667
29877
  return data.models;
@@ -29708,16 +29918,6 @@ function checkApiKeyForProvider(nativeProvider, modelName) {
29708
29918
  }
29709
29919
  return null;
29710
29920
  }
29711
- function formatForOpenRouter(modelName, nativeProvider) {
29712
- if (modelName.includes("/")) {
29713
- return modelName;
29714
- }
29715
- const vendor = OPENROUTER_VENDOR_MAP[nativeProvider];
29716
- if (vendor) {
29717
- return `${vendor}/${modelName}`;
29718
- }
29719
- return modelName;
29720
- }
29721
29921
  function getAutoRouteHint(modelName, nativeProvider) {
29722
29922
  const hint = PROVIDER_HINT_MAP[nativeProvider];
29723
29923
  const lines = [
@@ -29771,7 +29971,8 @@ function autoRoute(modelName, nativeProvider) {
29771
29971
  return apiKeyResult;
29772
29972
  }
29773
29973
  if (process.env.OPENROUTER_API_KEY) {
29774
- const orModelId = formatForOpenRouter(modelName, nativeProvider);
29974
+ const resolution = resolveModelNameSync(modelName, "openrouter");
29975
+ const orModelId = resolution.resolvedId;
29775
29976
  return {
29776
29977
  provider: "openrouter",
29777
29978
  resolvedModelId: orModelId,
@@ -29782,9 +29983,10 @@ function autoRoute(modelName, nativeProvider) {
29782
29983
  }
29783
29984
  return null;
29784
29985
  }
29785
- var API_KEY_ENV_VARS, OPENROUTER_VENDOR_MAP, PROVIDER_HINT_MAP;
29986
+ var API_KEY_ENV_VARS, PROVIDER_HINT_MAP;
29786
29987
  var init_auto_route = __esm(() => {
29787
29988
  init_oauth_registry();
29989
+ init_model_catalog_resolver();
29788
29990
  API_KEY_ENV_VARS = {
29789
29991
  google: { envVar: "GEMINI_API_KEY" },
29790
29992
  "gemini-codeassist": { envVar: "GEMINI_API_KEY" },
@@ -29802,18 +30004,6 @@ var init_auto_route = __esm(() => {
29802
30004
  vertex: { envVar: "VERTEX_API_KEY", aliases: ["VERTEX_PROJECT"] },
29803
30005
  poe: { envVar: "POE_API_KEY" }
29804
30006
  };
29805
- OPENROUTER_VENDOR_MAP = {
29806
- google: "google",
29807
- openai: "openai",
29808
- kimi: "moonshotai",
29809
- "kimi-coding": "moonshotai",
29810
- glm: "z-ai",
29811
- "glm-coding": "z-ai",
29812
- zai: "z-ai",
29813
- minimax: "minimax",
29814
- ollamacloud: "meta-llama",
29815
- qwen: "qwen"
29816
- };
29817
30007
  PROVIDER_HINT_MAP = {
29818
30008
  "kimi-coding": {
29819
30009
  loginFlag: "--kimi-login",
@@ -29870,9 +30060,9 @@ __export(exports_provider_resolver, {
29870
30060
  getMissingKeyResolutions: () => getMissingKeyResolutions,
29871
30061
  getMissingKeyError: () => getMissingKeyError
29872
30062
  });
29873
- import { existsSync as existsSync9 } from "node:fs";
29874
- import { join as join9 } from "node:path";
29875
- import { homedir as homedir8 } from "node:os";
30063
+ import { existsSync as existsSync11 } from "node:fs";
30064
+ import { join as join11 } from "node:path";
30065
+ import { homedir as homedir10 } from "node:os";
29876
30066
  function isApiKeyAvailable(info) {
29877
30067
  if (!info.envVar) {
29878
30068
  return true;
@@ -29889,8 +30079,8 @@ function isApiKeyAvailable(info) {
29889
30079
  }
29890
30080
  if (info.oauthFallback) {
29891
30081
  try {
29892
- const credPath = join9(homedir8(), ".claudish", info.oauthFallback);
29893
- if (existsSync9(credPath)) {
30082
+ const credPath = join11(homedir10(), ".claudish", info.oauthFallback);
30083
+ if (existsSync11(credPath)) {
29894
30084
  return true;
29895
30085
  }
29896
30086
  } catch {}
@@ -30287,16 +30477,16 @@ __export(exports_cli, {
30287
30477
  getMissingKeyResolutions: () => getMissingKeyResolutions,
30288
30478
  getMissingKeyError: () => getMissingKeyError
30289
30479
  });
30290
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync5, existsSync as existsSync10, mkdirSync as mkdirSync5, copyFileSync, readdirSync, unlinkSync as unlinkSync3 } from "node:fs";
30480
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync5, existsSync as existsSync12, mkdirSync as mkdirSync5, copyFileSync, readdirSync, unlinkSync as unlinkSync3 } from "node:fs";
30291
30481
  import { fileURLToPath as fileURLToPath3 } from "node:url";
30292
- import { dirname as dirname3, join as join10 } from "node:path";
30293
- import { homedir as homedir9 } from "node:os";
30482
+ import { dirname as dirname3, join as join12 } from "node:path";
30483
+ import { homedir as homedir11 } from "node:os";
30294
30484
  function getVersion() {
30295
30485
  return VERSION;
30296
30486
  }
30297
30487
  function clearAllModelCaches() {
30298
- const cacheDir = join10(homedir9(), ".claudish");
30299
- if (!existsSync10(cacheDir))
30488
+ const cacheDir = join12(homedir11(), ".claudish");
30489
+ if (!existsSync12(cacheDir))
30300
30490
  return;
30301
30491
  const cachePatterns = ["all-models.json", "pricing-cache.json"];
30302
30492
  let cleared = 0;
@@ -30304,7 +30494,7 @@ function clearAllModelCaches() {
30304
30494
  const files = readdirSync(cacheDir);
30305
30495
  for (const file2 of files) {
30306
30496
  if (cachePatterns.includes(file2) || file2.startsWith("litellm-models-")) {
30307
- unlinkSync3(join10(cacheDir, file2));
30497
+ unlinkSync3(join12(cacheDir, file2));
30308
30498
  cleared++;
30309
30499
  }
30310
30500
  }
@@ -30580,9 +30770,9 @@ async function fetchOllamaModels() {
30580
30770
  }
30581
30771
  async function searchAndPrintModels(query, forceUpdate) {
30582
30772
  let models = [];
30583
- if (!forceUpdate && existsSync10(ALL_MODELS_JSON_PATH)) {
30773
+ if (!forceUpdate && existsSync12(ALL_MODELS_JSON_PATH)) {
30584
30774
  try {
30585
- const cacheData = JSON.parse(readFileSync8(ALL_MODELS_JSON_PATH, "utf-8"));
30775
+ const cacheData = JSON.parse(readFileSync10(ALL_MODELS_JSON_PATH, "utf-8"));
30586
30776
  const lastUpdated = new Date(cacheData.lastUpdated);
30587
30777
  const now = new Date;
30588
30778
  const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
@@ -30750,9 +30940,9 @@ Found ${results.length} matching models:
30750
30940
  async function printAllModels(jsonOutput, forceUpdate) {
30751
30941
  let models = [];
30752
30942
  const [ollamaModels, zenModels] = await Promise.all([fetchOllamaModels(), fetchZenModels()]);
30753
- if (!forceUpdate && existsSync10(ALL_MODELS_JSON_PATH)) {
30943
+ if (!forceUpdate && existsSync12(ALL_MODELS_JSON_PATH)) {
30754
30944
  try {
30755
- const cacheData = JSON.parse(readFileSync8(ALL_MODELS_JSON_PATH, "utf-8"));
30945
+ const cacheData = JSON.parse(readFileSync10(ALL_MODELS_JSON_PATH, "utf-8"));
30756
30946
  const lastUpdated = new Date(cacheData.lastUpdated);
30757
30947
  const now = new Date;
30758
30948
  const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
@@ -30953,11 +31143,11 @@ async function printAllModels(jsonOutput, forceUpdate) {
30953
31143
  console.log("Top models: claudish --top-models");
30954
31144
  }
30955
31145
  function isCacheStale() {
30956
- if (!existsSync10(MODELS_JSON_PATH)) {
31146
+ if (!existsSync12(MODELS_JSON_PATH)) {
30957
31147
  return true;
30958
31148
  }
30959
31149
  try {
30960
- const jsonContent = readFileSync8(MODELS_JSON_PATH, "utf-8");
31150
+ const jsonContent = readFileSync10(MODELS_JSON_PATH, "utf-8");
30961
31151
  const data = JSON.parse(jsonContent);
30962
31152
  if (!data.lastUpdated) {
30963
31153
  return true;
@@ -31052,9 +31242,9 @@ async function updateModelsFromOpenRouter() {
31052
31242
  providers.add(provider);
31053
31243
  }
31054
31244
  let version2 = "1.1.5";
31055
- if (existsSync10(MODELS_JSON_PATH)) {
31245
+ if (existsSync12(MODELS_JSON_PATH)) {
31056
31246
  try {
31057
- const existing = JSON.parse(readFileSync8(MODELS_JSON_PATH, "utf-8"));
31247
+ const existing = JSON.parse(readFileSync10(MODELS_JSON_PATH, "utf-8"));
31058
31248
  version2 = existing.version || version2;
31059
31249
  } catch {}
31060
31250
  }
@@ -31082,7 +31272,7 @@ async function checkAndUpdateModelsCache(forceUpdate = false) {
31082
31272
  await updateModelsFromOpenRouter();
31083
31273
  } else {
31084
31274
  try {
31085
- const data = JSON.parse(readFileSync8(MODELS_JSON_PATH, "utf-8"));
31275
+ const data = JSON.parse(readFileSync10(MODELS_JSON_PATH, "utf-8"));
31086
31276
  console.error(`✓ Using cached models (last updated: ${data.lastUpdated})`);
31087
31277
  } catch {}
31088
31278
  }
@@ -31399,8 +31589,8 @@ MORE INFO:
31399
31589
  }
31400
31590
  function printAIAgentGuide() {
31401
31591
  try {
31402
- const guidePath = join10(__dirname4, "../AI_AGENT_GUIDE.md");
31403
- const guideContent = readFileSync8(guidePath, "utf-8");
31592
+ const guidePath = join12(__dirname4, "../AI_AGENT_GUIDE.md");
31593
+ const guideContent = readFileSync10(guidePath, "utf-8");
31404
31594
  console.log(guideContent);
31405
31595
  } catch (error46) {
31406
31596
  console.error("Error reading AI Agent Guide:");
@@ -31416,19 +31606,19 @@ async function initializeClaudishSkill() {
31416
31606
  console.log(`\uD83D\uDD27 Initializing Claudish skill in current project...
31417
31607
  `);
31418
31608
  const cwd = process.cwd();
31419
- const claudeDir = join10(cwd, ".claude");
31420
- const skillsDir = join10(claudeDir, "skills");
31421
- const claudishSkillDir = join10(skillsDir, "claudish-usage");
31422
- const skillFile = join10(claudishSkillDir, "SKILL.md");
31423
- if (existsSync10(skillFile)) {
31609
+ const claudeDir = join12(cwd, ".claude");
31610
+ const skillsDir = join12(claudeDir, "skills");
31611
+ const claudishSkillDir = join12(skillsDir, "claudish-usage");
31612
+ const skillFile = join12(claudishSkillDir, "SKILL.md");
31613
+ if (existsSync12(skillFile)) {
31424
31614
  console.log("✅ Claudish skill already installed at:");
31425
31615
  console.log(` ${skillFile}
31426
31616
  `);
31427
31617
  console.log("\uD83D\uDCA1 To reinstall, delete the file and run 'claudish --init' again.");
31428
31618
  return;
31429
31619
  }
31430
- const sourceSkillPath = join10(__dirname4, "../skills/claudish-usage/SKILL.md");
31431
- if (!existsSync10(sourceSkillPath)) {
31620
+ const sourceSkillPath = join12(__dirname4, "../skills/claudish-usage/SKILL.md");
31621
+ if (!existsSync12(sourceSkillPath)) {
31432
31622
  console.error("❌ Error: Claudish skill file not found in installation.");
31433
31623
  console.error(` Expected at: ${sourceSkillPath}`);
31434
31624
  console.error(`
@@ -31437,15 +31627,15 @@ async function initializeClaudishSkill() {
31437
31627
  process.exit(1);
31438
31628
  }
31439
31629
  try {
31440
- if (!existsSync10(claudeDir)) {
31630
+ if (!existsSync12(claudeDir)) {
31441
31631
  mkdirSync5(claudeDir, { recursive: true });
31442
31632
  console.log("\uD83D\uDCC1 Created .claude/ directory");
31443
31633
  }
31444
- if (!existsSync10(skillsDir)) {
31634
+ if (!existsSync12(skillsDir)) {
31445
31635
  mkdirSync5(skillsDir, { recursive: true });
31446
31636
  console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
31447
31637
  }
31448
- if (!existsSync10(claudishSkillDir)) {
31638
+ if (!existsSync12(claudishSkillDir)) {
31449
31639
  mkdirSync5(claudishSkillDir, { recursive: true });
31450
31640
  console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
31451
31641
  }
@@ -31488,8 +31678,8 @@ function printAvailableModels() {
31488
31678
  let lastUpdated = "unknown";
31489
31679
  let models = [];
31490
31680
  try {
31491
- if (existsSync10(MODELS_JSON_PATH)) {
31492
- const data = JSON.parse(readFileSync8(MODELS_JSON_PATH, "utf-8"));
31681
+ if (existsSync12(MODELS_JSON_PATH)) {
31682
+ const data = JSON.parse(readFileSync10(MODELS_JSON_PATH, "utf-8"));
31493
31683
  lastUpdated = data.lastUpdated || "unknown";
31494
31684
  models = data.models || [];
31495
31685
  }
@@ -31538,9 +31728,9 @@ Force update: claudish --list-models --force-update
31538
31728
  `);
31539
31729
  }
31540
31730
  function printAvailableModelsJSON() {
31541
- const jsonPath = join10(__dirname4, "../recommended-models.json");
31731
+ const jsonPath = join12(__dirname4, "../recommended-models.json");
31542
31732
  try {
31543
- const jsonContent = readFileSync8(jsonPath, "utf-8");
31733
+ const jsonContent = readFileSync10(jsonPath, "utf-8");
31544
31734
  const data = JSON.parse(jsonContent);
31545
31735
  console.log(JSON.stringify(data, null, 2));
31546
31736
  } catch (error46) {
@@ -31625,7 +31815,7 @@ async function fetchGLMCodingModels() {
31625
31815
  return [];
31626
31816
  }
31627
31817
  }
31628
- var __filename4, __dirname4, VERSION = "5.5.2", CACHE_MAX_AGE_DAYS2 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH;
31818
+ var __filename4, __dirname4, VERSION = "5.6.0", CACHE_MAX_AGE_DAYS2 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH;
31629
31819
  var init_cli = __esm(() => {
31630
31820
  init_config();
31631
31821
  init_model_loader();
@@ -31634,12 +31824,12 @@ var init_cli = __esm(() => {
31634
31824
  __filename4 = fileURLToPath3(import.meta.url);
31635
31825
  __dirname4 = dirname3(__filename4);
31636
31826
  try {
31637
- const packageJson = JSON.parse(readFileSync8(join10(__dirname4, "../package.json"), "utf-8"));
31827
+ const packageJson = JSON.parse(readFileSync10(join12(__dirname4, "../package.json"), "utf-8"));
31638
31828
  VERSION = packageJson.version;
31639
31829
  } catch {}
31640
- MODELS_JSON_PATH = join10(__dirname4, "../recommended-models.json");
31641
- CLAUDISH_CACHE_DIR2 = join10(homedir9(), ".claudish");
31642
- ALL_MODELS_JSON_PATH = join10(CLAUDISH_CACHE_DIR2, "all-models.json");
31830
+ MODELS_JSON_PATH = join12(__dirname4, "../recommended-models.json");
31831
+ CLAUDISH_CACHE_DIR2 = join12(homedir11(), ".claudish");
31832
+ ALL_MODELS_JSON_PATH = join12(CLAUDISH_CACHE_DIR2, "all-models.json");
31643
31833
  });
31644
31834
 
31645
31835
  // src/update-checker.ts
@@ -31651,9 +31841,9 @@ __export(exports_update_checker, {
31651
31841
  checkForUpdates: () => checkForUpdates
31652
31842
  });
31653
31843
  import { execSync } from "node:child_process";
31654
- import { existsSync as existsSync11, mkdirSync as mkdirSync6, readFileSync as readFileSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "node:fs";
31655
- import { homedir as homedir10, platform as platform2, tmpdir } from "node:os";
31656
- import { join as join11 } from "node:path";
31844
+ import { existsSync as existsSync13, mkdirSync as mkdirSync6, readFileSync as readFileSync11, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "node:fs";
31845
+ import { homedir as homedir12, platform as platform2, tmpdir } from "node:os";
31846
+ import { join as join13 } from "node:path";
31657
31847
  import { createInterface } from "node:readline";
31658
31848
  function getUpdateCommand() {
31659
31849
  const scriptPath = process.argv[1] || "";
@@ -31665,27 +31855,27 @@ function getUpdateCommand() {
31665
31855
  function getCacheFilePath() {
31666
31856
  let cacheDir;
31667
31857
  if (isWindows) {
31668
- const localAppData = process.env.LOCALAPPDATA || join11(homedir10(), "AppData", "Local");
31669
- cacheDir = join11(localAppData, "claudish");
31858
+ const localAppData = process.env.LOCALAPPDATA || join13(homedir12(), "AppData", "Local");
31859
+ cacheDir = join13(localAppData, "claudish");
31670
31860
  } else {
31671
- cacheDir = join11(homedir10(), ".cache", "claudish");
31861
+ cacheDir = join13(homedir12(), ".cache", "claudish");
31672
31862
  }
31673
31863
  try {
31674
- if (!existsSync11(cacheDir)) {
31864
+ if (!existsSync13(cacheDir)) {
31675
31865
  mkdirSync6(cacheDir, { recursive: true });
31676
31866
  }
31677
- return join11(cacheDir, "update-check.json");
31867
+ return join13(cacheDir, "update-check.json");
31678
31868
  } catch {
31679
- return join11(tmpdir(), "claudish-update-check.json");
31869
+ return join13(tmpdir(), "claudish-update-check.json");
31680
31870
  }
31681
31871
  }
31682
31872
  function readCache() {
31683
31873
  try {
31684
31874
  const cachePath = getCacheFilePath();
31685
- if (!existsSync11(cachePath)) {
31875
+ if (!existsSync13(cachePath)) {
31686
31876
  return null;
31687
31877
  }
31688
- const data = JSON.parse(readFileSync9(cachePath, "utf-8"));
31878
+ const data = JSON.parse(readFileSync11(cachePath, "utf-8"));
31689
31879
  return data;
31690
31880
  } catch {
31691
31881
  return null;
@@ -31708,7 +31898,7 @@ function isCacheValid(cache) {
31708
31898
  function clearCache() {
31709
31899
  try {
31710
31900
  const cachePath = getCacheFilePath();
31711
- if (existsSync11(cachePath)) {
31901
+ if (existsSync13(cachePath)) {
31712
31902
  unlinkSync4(cachePath);
31713
31903
  }
31714
31904
  } catch {}
@@ -34198,14 +34388,14 @@ __export(exports_model_selector, {
34198
34388
  promptForApiKey: () => promptForApiKey,
34199
34389
  confirmAction: () => confirmAction
34200
34390
  });
34201
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, existsSync as existsSync12, mkdirSync as mkdirSync7 } from "node:fs";
34202
- import { join as join12, dirname as dirname4 } from "node:path";
34203
- import { homedir as homedir11 } from "node:os";
34391
+ import { readFileSync as readFileSync12, writeFileSync as writeFileSync7, existsSync as existsSync14, mkdirSync as mkdirSync7 } from "node:fs";
34392
+ import { join as join14, dirname as dirname4 } from "node:path";
34393
+ import { homedir as homedir13 } from "node:os";
34204
34394
  import { fileURLToPath as fileURLToPath4 } from "node:url";
34205
34395
  function loadRecommendedModels2() {
34206
- if (existsSync12(RECOMMENDED_MODELS_JSON_PATH)) {
34396
+ if (existsSync14(RECOMMENDED_MODELS_JSON_PATH)) {
34207
34397
  try {
34208
- const content = readFileSync10(RECOMMENDED_MODELS_JSON_PATH, "utf-8");
34398
+ const content = readFileSync12(RECOMMENDED_MODELS_JSON_PATH, "utf-8");
34209
34399
  const data = JSON.parse(content);
34210
34400
  return (data.models || []).map((model) => ({
34211
34401
  ...model,
@@ -34218,9 +34408,9 @@ function loadRecommendedModels2() {
34218
34408
  return [];
34219
34409
  }
34220
34410
  async function fetchAllModels(forceUpdate = false) {
34221
- if (!forceUpdate && existsSync12(ALL_MODELS_JSON_PATH2)) {
34411
+ if (!forceUpdate && existsSync14(ALL_MODELS_JSON_PATH2)) {
34222
34412
  try {
34223
- const cacheData = JSON.parse(readFileSync10(ALL_MODELS_JSON_PATH2, "utf-8"));
34413
+ const cacheData = JSON.parse(readFileSync12(ALL_MODELS_JSON_PATH2, "utf-8"));
34224
34414
  const lastUpdated = new Date(cacheData.lastUpdated);
34225
34415
  const now = new Date;
34226
34416
  const ageInDays = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
@@ -34649,11 +34839,11 @@ async function fetchOllamaCloudModels() {
34649
34839
  }
34650
34840
  }
34651
34841
  function shouldRefreshForFreeModels() {
34652
- if (!existsSync12(ALL_MODELS_JSON_PATH2)) {
34842
+ if (!existsSync14(ALL_MODELS_JSON_PATH2)) {
34653
34843
  return true;
34654
34844
  }
34655
34845
  try {
34656
- const cacheData = JSON.parse(readFileSync10(ALL_MODELS_JSON_PATH2, "utf-8"));
34846
+ const cacheData = JSON.parse(readFileSync12(ALL_MODELS_JSON_PATH2, "utf-8"));
34657
34847
  const lastUpdated = new Date(cacheData.lastUpdated);
34658
34848
  const now = new Date;
34659
34849
  const ageInHours = (now.getTime() - lastUpdated.getTime()) / (1000 * 60 * 60);
@@ -35169,9 +35359,9 @@ var init_model_selector = __esm(() => {
35169
35359
  init_model_loader();
35170
35360
  __filename5 = fileURLToPath4(import.meta.url);
35171
35361
  __dirname5 = dirname4(__filename5);
35172
- CLAUDISH_CACHE_DIR3 = join12(homedir11(), ".claudish");
35173
- ALL_MODELS_JSON_PATH2 = join12(CLAUDISH_CACHE_DIR3, "all-models.json");
35174
- RECOMMENDED_MODELS_JSON_PATH = join12(__dirname5, "../recommended-models.json");
35362
+ CLAUDISH_CACHE_DIR3 = join14(homedir13(), ".claudish");
35363
+ ALL_MODELS_JSON_PATH2 = join14(CLAUDISH_CACHE_DIR3, "all-models.json");
35364
+ RECOMMENDED_MODELS_JSON_PATH = join14(__dirname5, "../recommended-models.json");
35175
35365
  PROVIDER_FILTER_ALIASES = {
35176
35366
  zen: "Zen",
35177
35367
  openrouter: "OpenRouter",
@@ -36168,17 +36358,17 @@ __export(exports_claude_runner, {
36168
36358
  checkClaudeInstalled: () => checkClaudeInstalled
36169
36359
  });
36170
36360
  import { spawn } from "node:child_process";
36171
- import { writeFileSync as writeFileSync8, unlinkSync as unlinkSync5, mkdirSync as mkdirSync8, existsSync as existsSync13, readFileSync as readFileSync11 } from "node:fs";
36172
- import { tmpdir as tmpdir2, homedir as homedir12 } from "node:os";
36173
- import { join as join13 } from "node:path";
36361
+ import { writeFileSync as writeFileSync8, unlinkSync as unlinkSync5, mkdirSync as mkdirSync8, existsSync as existsSync15, readFileSync as readFileSync13 } from "node:fs";
36362
+ import { tmpdir as tmpdir2, homedir as homedir14 } from "node:os";
36363
+ import { join as join15 } from "node:path";
36174
36364
  function isWindows2() {
36175
36365
  return process.platform === "win32";
36176
36366
  }
36177
36367
  function createStatusLineScript(tokenFilePath) {
36178
36368
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
36179
- const claudishDir = join13(homeDir, ".claudish");
36369
+ const claudishDir = join15(homeDir, ".claudish");
36180
36370
  const timestamp = Date.now();
36181
- const scriptPath = join13(claudishDir, `status-${timestamp}.js`);
36371
+ const scriptPath = join15(claudishDir, `status-${timestamp}.js`);
36182
36372
  const escapedTokenPath = tokenFilePath.replace(/\\/g, "\\\\");
36183
36373
  const script = `
36184
36374
  const fs = require('fs');
@@ -36263,13 +36453,13 @@ process.stdin.on('end', () => {
36263
36453
  }
36264
36454
  function createTempSettingsFile(modelDisplay, port) {
36265
36455
  const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
36266
- const claudishDir = join13(homeDir, ".claudish");
36456
+ const claudishDir = join15(homeDir, ".claudish");
36267
36457
  try {
36268
36458
  mkdirSync8(claudishDir, { recursive: true });
36269
36459
  } catch {}
36270
36460
  const timestamp = Date.now();
36271
- const tempPath = join13(claudishDir, `settings-${timestamp}.json`);
36272
- const tokenFilePath = join13(claudishDir, `tokens-${port}.json`);
36461
+ const tempPath = join15(claudishDir, `settings-${timestamp}.json`);
36462
+ const tokenFilePath = join15(claudishDir, `tokens-${port}.json`);
36273
36463
  let statusCommand;
36274
36464
  if (isWindows2()) {
36275
36465
  const scriptPath = createStatusLineScript(tokenFilePath);
@@ -36305,7 +36495,7 @@ function mergeUserSettingsIfPresent(config3, tempSettingsPath, statusLine) {
36305
36495
  if (userSettingsValue.trimStart().startsWith("{")) {
36306
36496
  userSettings = JSON.parse(userSettingsValue);
36307
36497
  } else {
36308
- const rawUserSettings = readFileSync11(userSettingsValue, "utf-8");
36498
+ const rawUserSettings = readFileSync13(userSettingsValue, "utf-8");
36309
36499
  userSettings = JSON.parse(rawUserSettings);
36310
36500
  }
36311
36501
  userSettings.statusLine = statusLine;
@@ -36392,8 +36582,8 @@ async function runClaudeWithProxy(config3, proxyUrl) {
36392
36582
  console.error("Install it from: https://claude.com/claude-code");
36393
36583
  console.error(`
36394
36584
  Or set CLAUDE_PATH to your custom installation:`);
36395
- const home = homedir12();
36396
- const localPath = isWindows2() ? join13(home, ".claude", "local", "claude.exe") : join13(home, ".claude", "local", "claude");
36585
+ const home = homedir14();
36586
+ const localPath = isWindows2() ? join15(home, ".claude", "local", "claude.exe") : join15(home, ".claude", "local", "claude");
36397
36587
  console.error(` export CLAUDE_PATH=${localPath}`);
36398
36588
  process.exit(1);
36399
36589
  }
@@ -36432,23 +36622,23 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet) {
36432
36622
  async function findClaudeBinary() {
36433
36623
  const isWindows3 = process.platform === "win32";
36434
36624
  if (process.env.CLAUDE_PATH) {
36435
- if (existsSync13(process.env.CLAUDE_PATH)) {
36625
+ if (existsSync15(process.env.CLAUDE_PATH)) {
36436
36626
  return process.env.CLAUDE_PATH;
36437
36627
  }
36438
36628
  }
36439
- const home = homedir12();
36440
- const localPath = isWindows3 ? join13(home, ".claude", "local", "claude.exe") : join13(home, ".claude", "local", "claude");
36441
- if (existsSync13(localPath)) {
36629
+ const home = homedir14();
36630
+ const localPath = isWindows3 ? join15(home, ".claude", "local", "claude.exe") : join15(home, ".claude", "local", "claude");
36631
+ if (existsSync15(localPath)) {
36442
36632
  return localPath;
36443
36633
  }
36444
36634
  if (isWindows3) {
36445
36635
  const windowsPaths = [
36446
- join13(home, "AppData", "Roaming", "npm", "claude.cmd"),
36447
- join13(home, ".npm-global", "claude.cmd"),
36448
- join13(home, "node_modules", ".bin", "claude.cmd")
36636
+ join15(home, "AppData", "Roaming", "npm", "claude.cmd"),
36637
+ join15(home, ".npm-global", "claude.cmd"),
36638
+ join15(home, "node_modules", ".bin", "claude.cmd")
36449
36639
  ];
36450
36640
  for (const path of windowsPaths) {
36451
- if (existsSync13(path)) {
36641
+ if (existsSync15(path)) {
36452
36642
  return path;
36453
36643
  }
36454
36644
  }
@@ -36456,14 +36646,14 @@ async function findClaudeBinary() {
36456
36646
  const commonPaths = [
36457
36647
  "/usr/local/bin/claude",
36458
36648
  "/opt/homebrew/bin/claude",
36459
- join13(home, ".npm-global/bin/claude"),
36460
- join13(home, ".local/bin/claude"),
36461
- join13(home, "node_modules/.bin/claude"),
36649
+ join15(home, ".npm-global/bin/claude"),
36650
+ join15(home, ".local/bin/claude"),
36651
+ join15(home, "node_modules/.bin/claude"),
36462
36652
  "/data/data/com.termux/files/usr/bin/claude",
36463
- join13(home, "../usr/bin/claude")
36653
+ join15(home, "../usr/bin/claude")
36464
36654
  ];
36465
36655
  for (const path of commonPaths) {
36466
- if (existsSync13(path)) {
36656
+ if (existsSync15(path)) {
36467
36657
  return path;
36468
36658
  }
36469
36659
  }
@@ -39109,7 +39299,7 @@ class OpenRouterProvider {
39109
39299
  }
39110
39300
  }
39111
39301
  var OPENROUTER_API_URL2 = "https://openrouter.ai/api/v1/chat/completions";
39112
- var init_openrouter = __esm(() => {
39302
+ var init_openrouter2 = __esm(() => {
39113
39303
  init_openrouter_queue();
39114
39304
  });
39115
39305
 
@@ -62406,9 +62596,9 @@ var init_gemini_codeassist = __esm(() => {
62406
62596
  // src/auth/vertex-auth.ts
62407
62597
  import { exec as exec4 } from "node:child_process";
62408
62598
  import { promisify as promisify3 } from "node:util";
62409
- import { existsSync as existsSync14 } from "node:fs";
62410
- import { homedir as homedir13 } from "node:os";
62411
- import { join as join14 } from "node:path";
62599
+ import { existsSync as existsSync16 } from "node:fs";
62600
+ import { homedir as homedir15 } from "node:os";
62601
+ import { join as join16 } from "node:path";
62412
62602
 
62413
62603
  class VertexAuthManager {
62414
62604
  cachedToken = null;
@@ -62462,8 +62652,8 @@ class VertexAuthManager {
62462
62652
  }
62463
62653
  async tryADC() {
62464
62654
  try {
62465
- const adcPath = join14(homedir13(), ".config/gcloud/application_default_credentials.json");
62466
- if (!existsSync14(adcPath)) {
62655
+ const adcPath = join16(homedir15(), ".config/gcloud/application_default_credentials.json");
62656
+ if (!existsSync16(adcPath)) {
62467
62657
  log("[VertexAuth] ADC credentials file not found");
62468
62658
  return null;
62469
62659
  }
@@ -62487,7 +62677,7 @@ class VertexAuthManager {
62487
62677
  if (!credPath) {
62488
62678
  return null;
62489
62679
  }
62490
- if (!existsSync14(credPath)) {
62680
+ if (!existsSync16(credPath)) {
62491
62681
  throw new Error(`Service account file not found: ${credPath}
62492
62682
 
62493
62683
  Check GOOGLE_APPLICATION_CREDENTIALS path.`);
@@ -62526,8 +62716,8 @@ function validateVertexOAuthConfig() {
62526
62716
  ` + ` export VERTEX_PROJECT='your-gcp-project-id'
62527
62717
  ` + " export VERTEX_LOCATION='us-central1' # optional";
62528
62718
  }
62529
- const adcPath = join14(homedir13(), ".config/gcloud/application_default_credentials.json");
62530
- const hasADC = existsSync14(adcPath);
62719
+ const adcPath = join16(homedir15(), ".config/gcloud/application_default_credentials.json");
62720
+ const hasADC = existsSync16(adcPath);
62531
62721
  const hasServiceAccount = !!process.env.GOOGLE_APPLICATION_CREDENTIALS;
62532
62722
  if (!hasADC && !hasServiceAccount) {
62533
62723
  return `No Vertex AI credentials found.
@@ -62923,8 +63113,8 @@ var init_middleware = __esm(() => {
62923
63113
 
62924
63114
  // src/handlers/shared/token-tracker.ts
62925
63115
  import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync9 } from "node:fs";
62926
- import { homedir as homedir14 } from "node:os";
62927
- import { join as join15 } from "node:path";
63116
+ import { homedir as homedir16 } from "node:os";
63117
+ import { join as join17 } from "node:path";
62928
63118
 
62929
63119
  class TokenTracker {
62930
63120
  port;
@@ -63038,9 +63228,9 @@ class TokenTracker {
63038
63228
  is_free: isFreeModel,
63039
63229
  is_estimated: isEstimate || false
63040
63230
  };
63041
- const claudishDir = join15(homedir14(), ".claudish");
63231
+ const claudishDir = join17(homedir16(), ".claudish");
63042
63232
  mkdirSync9(claudishDir, { recursive: true });
63043
- writeFileSync9(join15(claudishDir, `tokens-${this.port}.json`), JSON.stringify(data), "utf-8");
63233
+ writeFileSync9(join17(claudishDir, `tokens-${this.port}.json`), JSON.stringify(data), "utf-8");
63044
63234
  } catch (e) {
63045
63235
  log(`[TokenTracker] Error writing token file: ${e}`);
63046
63236
  }
@@ -64348,17 +64538,17 @@ class LiteLLMProvider {
64348
64538
  }
64349
64539
  }
64350
64540
  var MODEL_EXTRA_HEADERS;
64351
- var init_litellm = __esm(() => {
64541
+ var init_litellm2 = __esm(() => {
64352
64542
  MODEL_EXTRA_HEADERS = [
64353
64543
  { pattern: "kimi", headers: { "User-Agent": "claude-code/1.0" } }
64354
64544
  ];
64355
64545
  });
64356
64546
 
64357
64547
  // src/adapters/litellm-adapter.ts
64358
- import { existsSync as existsSync15, readFileSync as readFileSync13 } from "node:fs";
64359
- import { createHash as createHash4 } from "node:crypto";
64360
- import { homedir as homedir15 } from "node:os";
64361
- import { join as join16 } from "node:path";
64548
+ import { existsSync as existsSync17, readFileSync as readFileSync15 } from "node:fs";
64549
+ import { createHash as createHash5 } from "node:crypto";
64550
+ import { homedir as homedir17 } from "node:os";
64551
+ import { join as join18 } from "node:path";
64362
64552
  var INLINE_IMAGE_MODEL_PATTERNS, LiteLLMAdapter;
64363
64553
  var init_litellm_adapter = __esm(() => {
64364
64554
  init_base_adapter();
@@ -64453,11 +64643,11 @@ var init_litellm_adapter = __esm(() => {
64453
64643
  }
64454
64644
  checkVisionSupport() {
64455
64645
  try {
64456
- const hash2 = createHash4("sha256").update(this.baseUrl).digest("hex").substring(0, 16);
64457
- const cachePath = join16(homedir15(), ".claudish", `litellm-models-${hash2}.json`);
64458
- if (!existsSync15(cachePath))
64646
+ const hash2 = createHash5("sha256").update(this.baseUrl).digest("hex").substring(0, 16);
64647
+ const cachePath = join18(homedir17(), ".claudish", `litellm-models-${hash2}.json`);
64648
+ if (!existsSync17(cachePath))
64459
64649
  return true;
64460
- const cacheData = JSON.parse(readFileSync13(cachePath, "utf-8"));
64650
+ const cacheData = JSON.parse(readFileSync15(cachePath, "utf-8"));
64461
64651
  const model = cacheData.models?.find((m) => m.name === this.modelId);
64462
64652
  if (model && model.supportsVision === false) {
64463
64653
  log(`[LiteLLMAdapter] Model ${this.modelId} does not support vision`);
@@ -64575,12 +64765,12 @@ class AnthropicCompatProvider {
64575
64765
  }
64576
64766
  if (this.provider.name === "kimi-coding" && !this.apiKey) {
64577
64767
  try {
64578
- const { existsSync: existsSync16, readFileSync: readFileSync14 } = await import("node:fs");
64579
- const { join: join17 } = await import("node:path");
64580
- const { homedir: homedir16 } = await import("node:os");
64581
- const credPath = join17(homedir16(), ".claudish", "kimi-oauth.json");
64582
- if (existsSync16(credPath)) {
64583
- const data = JSON.parse(readFileSync14(credPath, "utf-8"));
64768
+ const { existsSync: existsSync18, readFileSync: readFileSync16 } = await import("node:fs");
64769
+ const { join: join19 } = await import("node:path");
64770
+ const { homedir: homedir18 } = await import("node:os");
64771
+ const credPath = join19(homedir18(), ".claudish", "kimi-oauth.json");
64772
+ if (existsSync18(credPath)) {
64773
+ const data = JSON.parse(readFileSync16(credPath, "utf-8"));
64584
64774
  if (data.access_token && data.refresh_token) {
64585
64775
  const { KimiOAuth: KimiOAuth2 } = await Promise.resolve().then(() => (init_kimi_oauth(), exports_kimi_oauth));
64586
64776
  const oauth = KimiOAuth2.getInstance();
@@ -64802,9 +64992,9 @@ var init_ollamacloud_adapter = __esm(() => {
64802
64992
  });
64803
64993
 
64804
64994
  // src/services/pricing-cache.ts
64805
- import { readFileSync as readFileSync14, writeFileSync as writeFileSync10, existsSync as existsSync16, mkdirSync as mkdirSync10, statSync } from "node:fs";
64806
- import { homedir as homedir16 } from "node:os";
64807
- import { join as join17 } from "node:path";
64995
+ import { readFileSync as readFileSync16, writeFileSync as writeFileSync10, existsSync as existsSync18, mkdirSync as mkdirSync10, statSync } from "node:fs";
64996
+ import { homedir as homedir18 } from "node:os";
64997
+ import { join as join19 } from "node:path";
64808
64998
  function getDynamicPricingSync(provider, modelName) {
64809
64999
  if (provider === "openrouter") {
64810
65000
  const direct = pricingMap.get(modelName);
@@ -64869,12 +65059,12 @@ async function warmPricingCache() {
64869
65059
  }
64870
65060
  function loadDiskCache() {
64871
65061
  try {
64872
- if (!existsSync16(CACHE_FILE))
65062
+ if (!existsSync18(CACHE_FILE))
64873
65063
  return false;
64874
65064
  const stat = statSync(CACHE_FILE);
64875
65065
  const age = Date.now() - stat.mtimeMs;
64876
65066
  const isFresh = age < CACHE_TTL_MS;
64877
- const raw2 = readFileSync14(CACHE_FILE, "utf-8");
65067
+ const raw2 = readFileSync16(CACHE_FILE, "utf-8");
64878
65068
  const data = JSON.parse(raw2);
64879
65069
  for (const [key, pricing] of Object.entries(data)) {
64880
65070
  pricingMap.set(key, pricing);
@@ -64921,8 +65111,8 @@ var init_pricing_cache = __esm(() => {
64921
65111
  init_model_loader();
64922
65112
  init_remote_provider_types();
64923
65113
  pricingMap = new Map;
64924
- CACHE_DIR = join17(homedir16(), ".claudish");
64925
- CACHE_FILE = join17(CACHE_DIR, "pricing-cache.json");
65114
+ CACHE_DIR = join19(homedir18(), ".claudish");
65115
+ CACHE_FILE = join19(CACHE_DIR, "pricing-cache.json");
64926
65116
  CACHE_TTL_MS = 24 * 60 * 60 * 1000;
64927
65117
  PROVIDER_TO_OR_PREFIX = {
64928
65118
  openai: ["openai/"],
@@ -65200,6 +65390,16 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
65200
65390
  } else if (model) {
65201
65391
  target = model;
65202
65392
  }
65393
+ {
65394
+ const parsedTarget = parseModelSpec(target);
65395
+ if (parsedTarget.provider === "openrouter" || parsedTarget.provider === "litellm") {
65396
+ const resolution = resolveModelNameSync(parsedTarget.model, parsedTarget.provider);
65397
+ logResolution(parsedTarget.model, resolution, options.quiet);
65398
+ if (resolution.wasResolved) {
65399
+ target = `${parsedTarget.provider}@${resolution.resolvedId}`;
65400
+ }
65401
+ }
65402
+ }
65203
65403
  if (isPoeModel(target)) {
65204
65404
  const poeHandler = getPoeHandler(target);
65205
65405
  if (poeHandler) {
@@ -65268,6 +65468,10 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
65268
65468
  port = actualPort;
65269
65469
  log(`[Proxy] Server started on port ${port}`);
65270
65470
  warmPricingCache().catch(() => {});
65471
+ const catalogProvidersToWarm = ["openrouter"];
65472
+ if (process.env.LITELLM_BASE_URL)
65473
+ catalogProvidersToWarm.push("litellm");
65474
+ warmAllCatalogs(catalogProvidersToWarm).catch(() => {});
65271
65475
  return {
65272
65476
  port,
65273
65477
  url: `http://127.0.0.1:${port}`,
@@ -65282,7 +65486,7 @@ var init_proxy_server = __esm(() => {
65282
65486
  init_dist10();
65283
65487
  init_logger();
65284
65488
  init_native_handler();
65285
- init_openrouter();
65489
+ init_openrouter2();
65286
65490
  init_openrouter_adapter();
65287
65491
  init_local();
65288
65492
  init_local_adapter();
@@ -65292,7 +65496,7 @@ var init_proxy_server = __esm(() => {
65292
65496
  init_vertex_oauth();
65293
65497
  init_base_adapter();
65294
65498
  init_composed_handler();
65295
- init_litellm();
65499
+ init_litellm2();
65296
65500
  init_litellm_adapter();
65297
65501
  init_openai();
65298
65502
  init_openai_adapter();
@@ -65306,6 +65510,7 @@ var init_proxy_server = __esm(() => {
65306
65510
  init_provider_resolver();
65307
65511
  init_pricing_cache();
65308
65512
  init_model_loader();
65513
+ init_model_catalog_resolver();
65309
65514
  });
65310
65515
 
65311
65516
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "5.5.2",
3
+ "version": "5.6.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",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.2.0",
3
- "lastUpdated": "2026-03-03",
3
+ "lastUpdated": "2026-03-05",
4
4
  "source": "https://openrouter.ai/models?categories=programming&fmt=cards&order=top-weekly",
5
5
  "models": [
6
6
  {
@@ -122,9 +122,9 @@
122
122
  "category": "vision",
123
123
  "priority": 6,
124
124
  "pricing": {
125
- "input": "$0.40/1M",
126
- "output": "$2.40/1M",
127
- "average": "$1.40/1M"
125
+ "input": "$0.26/1M",
126
+ "output": "$1.56/1M",
127
+ "average": "$0.91/1M"
128
128
  },
129
129
  "context": "1000K",
130
130
  "maxOutputTokens": 65536,