claudish 4.6.3 → 4.6.5
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 +83 -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,21 +31709,56 @@ async function selectModel(options = {}) {
|
|
|
31684
31709
|
}
|
|
31685
31710
|
}
|
|
31686
31711
|
}
|
|
31712
|
+
const providerCounts = new Map;
|
|
31713
|
+
for (const m of models) {
|
|
31714
|
+
if (m.source) {
|
|
31715
|
+
providerCounts.set(m.source, (providerCounts.get(m.source) || 0) + 1);
|
|
31716
|
+
}
|
|
31717
|
+
}
|
|
31718
|
+
let filteredModels = models;
|
|
31719
|
+
if (!freeOnly && !message && providerCounts.size > 1) {
|
|
31720
|
+
const providerChoices = [
|
|
31721
|
+
{ name: `All providers (${models.length} models)`, value: "__all__" },
|
|
31722
|
+
...Array.from(providerCounts.entries()).sort((a, b) => b[1] - a[1]).map(([source, count]) => ({
|
|
31723
|
+
name: `${source} (${count})`,
|
|
31724
|
+
value: source
|
|
31725
|
+
}))
|
|
31726
|
+
];
|
|
31727
|
+
const selectedProvider = await dist_default5({
|
|
31728
|
+
message: "Filter by provider:",
|
|
31729
|
+
choices: providerChoices
|
|
31730
|
+
});
|
|
31731
|
+
if (selectedProvider !== "__all__") {
|
|
31732
|
+
filteredModels = models.filter((m) => m.source === selectedProvider);
|
|
31733
|
+
}
|
|
31734
|
+
}
|
|
31687
31735
|
const promptMessage = message || (freeOnly ? "Select a FREE model:" : "Select a model (type to search):");
|
|
31688
31736
|
const selected = await dist_default4({
|
|
31689
31737
|
message: promptMessage,
|
|
31690
31738
|
pageSize: 20,
|
|
31691
31739
|
source: async (term) => {
|
|
31692
31740
|
if (!term) {
|
|
31693
|
-
return
|
|
31741
|
+
return filteredModels.slice(0, 30).map((m) => ({
|
|
31742
|
+
name: formatModelChoice(m, true),
|
|
31743
|
+
value: m.id,
|
|
31744
|
+
description: m.description?.slice(0, 80)
|
|
31745
|
+
}));
|
|
31746
|
+
}
|
|
31747
|
+
const { provider: filterProvider, searchTerm } = parseProviderFilter(term);
|
|
31748
|
+
let pool = filteredModels;
|
|
31749
|
+
if (filterProvider) {
|
|
31750
|
+
pool = models.filter((m) => m.source === filterProvider);
|
|
31751
|
+
}
|
|
31752
|
+
if (!searchTerm) {
|
|
31753
|
+
return pool.slice(0, 30).map((m) => ({
|
|
31694
31754
|
name: formatModelChoice(m, true),
|
|
31695
31755
|
value: m.id,
|
|
31696
31756
|
description: m.description?.slice(0, 80)
|
|
31697
31757
|
}));
|
|
31698
31758
|
}
|
|
31699
|
-
const results =
|
|
31759
|
+
const results = pool.map((m) => ({
|
|
31700
31760
|
model: m,
|
|
31701
|
-
score: Math.max(fuzzyMatch(m.id,
|
|
31761
|
+
score: Math.max(fuzzyMatch(m.id, searchTerm), fuzzyMatch(m.name, searchTerm), fuzzyMatch(m.provider, searchTerm) * 0.5)
|
|
31702
31762
|
})).filter((r) => r.score > 0.1).sort((a, b) => b.score - a.score).slice(0, 30);
|
|
31703
31763
|
return results.map((r) => ({
|
|
31704
31764
|
name: formatModelChoice(r.model, true),
|
|
@@ -31955,7 +32015,7 @@ async function selectProfile(profiles) {
|
|
|
31955
32015
|
async function confirmAction(message) {
|
|
31956
32016
|
return dist_default2({ message, default: false });
|
|
31957
32017
|
}
|
|
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;
|
|
32018
|
+
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
32019
|
var init_model_selector = __esm(() => {
|
|
31960
32020
|
init_dist8();
|
|
31961
32021
|
init_model_loader();
|
|
@@ -31964,6 +32024,24 @@ var init_model_selector = __esm(() => {
|
|
|
31964
32024
|
CLAUDISH_CACHE_DIR2 = join7(homedir6(), ".claudish");
|
|
31965
32025
|
ALL_MODELS_JSON_PATH = join7(CLAUDISH_CACHE_DIR2, "all-models.json");
|
|
31966
32026
|
RECOMMENDED_MODELS_JSON_PATH = join7(__dirname4, "../recommended-models.json");
|
|
32027
|
+
PROVIDER_FILTER_ALIASES = {
|
|
32028
|
+
zen: "Zen",
|
|
32029
|
+
openrouter: "OpenRouter",
|
|
32030
|
+
or: "OpenRouter",
|
|
32031
|
+
xai: "xAI",
|
|
32032
|
+
gemini: "Gemini",
|
|
32033
|
+
gem: "Gemini",
|
|
32034
|
+
google: "Gemini",
|
|
32035
|
+
openai: "OpenAI",
|
|
32036
|
+
oai: "OpenAI",
|
|
32037
|
+
glm: "GLM",
|
|
32038
|
+
"glm-coding": "GLM Coding",
|
|
32039
|
+
gc: "GLM Coding",
|
|
32040
|
+
ollamacloud: "OllamaCloud",
|
|
32041
|
+
oc: "OllamaCloud",
|
|
32042
|
+
litellm: "LiteLLM",
|
|
32043
|
+
ll: "LiteLLM"
|
|
32044
|
+
};
|
|
31967
32045
|
PROVIDER_CHOICES = [
|
|
31968
32046
|
{ name: "Skip (keep Claude default)", value: "skip", description: "Use native Claude model for this tier" },
|
|
31969
32047
|
{ name: "OpenRouter", value: "openrouter", description: "580+ models via unified API" },
|
|
@@ -34796,7 +34874,7 @@ async function fetchGLMCodingModels2() {
|
|
|
34796
34874
|
return [];
|
|
34797
34875
|
}
|
|
34798
34876
|
}
|
|
34799
|
-
var __filename5, __dirname5, VERSION = "4.6.
|
|
34877
|
+
var __filename5, __dirname5, VERSION = "4.6.5", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR3, ALL_MODELS_JSON_PATH2;
|
|
34800
34878
|
var init_cli = __esm(() => {
|
|
34801
34879
|
init_config();
|
|
34802
34880
|
init_model_loader();
|