claudish 4.6.3 → 4.6.4
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 +65 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31620,6 +31620,31 @@ function formatModelChoice(model, showSource = false) {
|
|
|
31620
31620
|
}
|
|
31621
31621
|
return `${model.id} (${model.provider}, ${priceStr}, ${ctxStr}${capsStr})`;
|
|
31622
31622
|
}
|
|
31623
|
+
function parseProviderFilter(term) {
|
|
31624
|
+
if (!term.startsWith("@")) {
|
|
31625
|
+
return { provider: null, searchTerm: term };
|
|
31626
|
+
}
|
|
31627
|
+
const withoutAt = term.slice(1);
|
|
31628
|
+
const spaceIdx = withoutAt.indexOf(" ");
|
|
31629
|
+
let prefix;
|
|
31630
|
+
let rest;
|
|
31631
|
+
if (spaceIdx === -1) {
|
|
31632
|
+
prefix = withoutAt;
|
|
31633
|
+
rest = "";
|
|
31634
|
+
} else {
|
|
31635
|
+
prefix = withoutAt.slice(0, spaceIdx);
|
|
31636
|
+
rest = withoutAt.slice(spaceIdx + 1).trim();
|
|
31637
|
+
}
|
|
31638
|
+
const source = PROVIDER_FILTER_ALIASES[prefix.toLowerCase()];
|
|
31639
|
+
if (source) {
|
|
31640
|
+
return { provider: source, searchTerm: rest };
|
|
31641
|
+
}
|
|
31642
|
+
const partialMatch = Object.entries(PROVIDER_FILTER_ALIASES).find(([alias]) => alias.startsWith(prefix.toLowerCase()));
|
|
31643
|
+
if (partialMatch) {
|
|
31644
|
+
return { provider: partialMatch[1], searchTerm: rest };
|
|
31645
|
+
}
|
|
31646
|
+
return { provider: null, searchTerm: term };
|
|
31647
|
+
}
|
|
31623
31648
|
function fuzzyMatch(text, query) {
|
|
31624
31649
|
const lowerText = text.toLowerCase();
|
|
31625
31650
|
const lowerQuery = query.toLowerCase();
|
|
@@ -31684,7 +31709,12 @@ async function selectModel(options = {}) {
|
|
|
31684
31709
|
}
|
|
31685
31710
|
}
|
|
31686
31711
|
}
|
|
31687
|
-
const
|
|
31712
|
+
const availableProviders = [...new Set(models.map((m) => m.source).filter(Boolean))];
|
|
31713
|
+
const providerHints = availableProviders.map((src) => {
|
|
31714
|
+
const aliases = Object.entries(PROVIDER_FILTER_ALIASES).filter(([, v]) => v === src).map(([k]) => k).sort((a, b) => a.length - b.length);
|
|
31715
|
+
return aliases[0] ? `@${aliases[0]}` : null;
|
|
31716
|
+
}).filter(Boolean).join(" ");
|
|
31717
|
+
const promptMessage = message || (freeOnly ? "Select a FREE model:" : `Select a model (type to search, ${providerHints} to filter):`);
|
|
31688
31718
|
const selected = await dist_default4({
|
|
31689
31719
|
message: promptMessage,
|
|
31690
31720
|
pageSize: 20,
|
|
@@ -31696,9 +31726,21 @@ async function selectModel(options = {}) {
|
|
|
31696
31726
|
description: m.description?.slice(0, 80)
|
|
31697
31727
|
}));
|
|
31698
31728
|
}
|
|
31699
|
-
const
|
|
31729
|
+
const { provider: filterProvider, searchTerm } = parseProviderFilter(term);
|
|
31730
|
+
let pool = models;
|
|
31731
|
+
if (filterProvider) {
|
|
31732
|
+
pool = models.filter((m) => m.source === filterProvider);
|
|
31733
|
+
}
|
|
31734
|
+
if (!searchTerm) {
|
|
31735
|
+
return pool.slice(0, 30).map((m) => ({
|
|
31736
|
+
name: formatModelChoice(m, true),
|
|
31737
|
+
value: m.id,
|
|
31738
|
+
description: m.description?.slice(0, 80)
|
|
31739
|
+
}));
|
|
31740
|
+
}
|
|
31741
|
+
const results = pool.map((m) => ({
|
|
31700
31742
|
model: m,
|
|
31701
|
-
score: Math.max(fuzzyMatch(m.id,
|
|
31743
|
+
score: Math.max(fuzzyMatch(m.id, searchTerm), fuzzyMatch(m.name, searchTerm), fuzzyMatch(m.provider, searchTerm) * 0.5)
|
|
31702
31744
|
})).filter((r) => r.score > 0.1).sort((a, b) => b.score - a.score).slice(0, 30);
|
|
31703
31745
|
return results.map((r) => ({
|
|
31704
31746
|
name: formatModelChoice(r.model, true),
|
|
@@ -31955,7 +31997,7 @@ async function selectProfile(profiles) {
|
|
|
31955
31997
|
async function confirmAction(message) {
|
|
31956
31998
|
return dist_default2({ message, default: false });
|
|
31957
31999
|
}
|
|
31958
|
-
var __filename4, __dirname4, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH, RECOMMENDED_MODELS_JSON_PATH, CACHE_MAX_AGE_DAYS2 = 2, FREE_MODELS_CACHE_MAX_AGE_HOURS = 3, PROVIDER_CHOICES, PROVIDER_MODEL_PREFIX, PROVIDER_SOURCE_FILTER;
|
|
32000
|
+
var __filename4, __dirname4, CLAUDISH_CACHE_DIR2, ALL_MODELS_JSON_PATH, RECOMMENDED_MODELS_JSON_PATH, CACHE_MAX_AGE_DAYS2 = 2, FREE_MODELS_CACHE_MAX_AGE_HOURS = 3, PROVIDER_FILTER_ALIASES, PROVIDER_CHOICES, PROVIDER_MODEL_PREFIX, PROVIDER_SOURCE_FILTER;
|
|
31959
32001
|
var init_model_selector = __esm(() => {
|
|
31960
32002
|
init_dist8();
|
|
31961
32003
|
init_model_loader();
|
|
@@ -31964,6 +32006,24 @@ var init_model_selector = __esm(() => {
|
|
|
31964
32006
|
CLAUDISH_CACHE_DIR2 = join7(homedir6(), ".claudish");
|
|
31965
32007
|
ALL_MODELS_JSON_PATH = join7(CLAUDISH_CACHE_DIR2, "all-models.json");
|
|
31966
32008
|
RECOMMENDED_MODELS_JSON_PATH = join7(__dirname4, "../recommended-models.json");
|
|
32009
|
+
PROVIDER_FILTER_ALIASES = {
|
|
32010
|
+
zen: "Zen",
|
|
32011
|
+
openrouter: "OpenRouter",
|
|
32012
|
+
or: "OpenRouter",
|
|
32013
|
+
xai: "xAI",
|
|
32014
|
+
gemini: "Gemini",
|
|
32015
|
+
gem: "Gemini",
|
|
32016
|
+
google: "Gemini",
|
|
32017
|
+
openai: "OpenAI",
|
|
32018
|
+
oai: "OpenAI",
|
|
32019
|
+
glm: "GLM",
|
|
32020
|
+
"glm-coding": "GLM Coding",
|
|
32021
|
+
gc: "GLM Coding",
|
|
32022
|
+
ollamacloud: "OllamaCloud",
|
|
32023
|
+
oc: "OllamaCloud",
|
|
32024
|
+
litellm: "LiteLLM",
|
|
32025
|
+
ll: "LiteLLM"
|
|
32026
|
+
};
|
|
31967
32027
|
PROVIDER_CHOICES = [
|
|
31968
32028
|
{ name: "Skip (keep Claude default)", value: "skip", description: "Use native Claude model for this tier" },
|
|
31969
32029
|
{ name: "OpenRouter", value: "openrouter", description: "580+ models via unified API" },
|
|
@@ -34796,7 +34856,7 @@ async function fetchGLMCodingModels2() {
|
|
|
34796
34856
|
return [];
|
|
34797
34857
|
}
|
|
34798
34858
|
}
|
|
34799
|
-
var __filename5, __dirname5, VERSION = "4.6.
|
|
34859
|
+
var __filename5, __dirname5, VERSION = "4.6.4", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR3, ALL_MODELS_JSON_PATH2;
|
|
34800
34860
|
var init_cli = __esm(() => {
|
|
34801
34861
|
init_config();
|
|
34802
34862
|
init_model_loader();
|