claudish 3.7.2 → 3.7.3
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 +73 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32160,6 +32160,7 @@ class OpenRouterHandler {
|
|
|
32160
32160
|
const total = input + output;
|
|
32161
32161
|
const limit = this.contextWindowCache.get(this.targetModel) || 200000;
|
|
32162
32162
|
const leftPct = limit > 0 ? Math.max(0, Math.min(100, Math.round((limit - total) / limit * 100))) : 100;
|
|
32163
|
+
const displayModelName = this.targetModel.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
32163
32164
|
const data = {
|
|
32164
32165
|
input_tokens: input,
|
|
32165
32166
|
output_tokens: output,
|
|
@@ -32167,6 +32168,8 @@ class OpenRouterHandler {
|
|
|
32167
32168
|
total_cost: this.sessionTotalCost,
|
|
32168
32169
|
context_window: limit,
|
|
32169
32170
|
context_left_percent: leftPct,
|
|
32171
|
+
provider_name: "OpenRouter",
|
|
32172
|
+
model_name: displayModelName,
|
|
32170
32173
|
updated_at: Date.now()
|
|
32171
32174
|
};
|
|
32172
32175
|
const claudishDir = join4(homedir(), ".claudish");
|
|
@@ -53115,6 +53118,14 @@ class LocalProviderHandler {
|
|
|
53115
53118
|
this.sessionOutputTokens += output;
|
|
53116
53119
|
const sessionTotal = this.sessionInputTokens + this.sessionOutputTokens;
|
|
53117
53120
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - sessionTotal) / this.contextWindow * 100))) : 100;
|
|
53121
|
+
const providerNameMap = {
|
|
53122
|
+
ollama: "Ollama",
|
|
53123
|
+
lmstudio: "LM Studio",
|
|
53124
|
+
vllm: "vLLM",
|
|
53125
|
+
mlx: "MLX",
|
|
53126
|
+
custom: "Custom"
|
|
53127
|
+
};
|
|
53128
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
53118
53129
|
const data = {
|
|
53119
53130
|
input_tokens: this.sessionInputTokens,
|
|
53120
53131
|
output_tokens: this.sessionOutputTokens,
|
|
@@ -53122,6 +53133,8 @@ class LocalProviderHandler {
|
|
|
53122
53133
|
total_cost: 0,
|
|
53123
53134
|
context_window: this.contextWindow,
|
|
53124
53135
|
context_left_percent: leftPct,
|
|
53136
|
+
provider_name: providerNameMap[this.provider.name] || "Local",
|
|
53137
|
+
model_name: displayModelName,
|
|
53125
53138
|
updated_at: Date.now()
|
|
53126
53139
|
};
|
|
53127
53140
|
const claudishDir = join5(homedir2(), ".claudish");
|
|
@@ -53853,6 +53866,8 @@ class BaseGeminiHandler {
|
|
|
53853
53866
|
try {
|
|
53854
53867
|
const total = input + output;
|
|
53855
53868
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
53869
|
+
const pricing = this.getPricing();
|
|
53870
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
53856
53871
|
const data = {
|
|
53857
53872
|
input_tokens: input,
|
|
53858
53873
|
output_tokens: output,
|
|
@@ -53860,6 +53875,10 @@ class BaseGeminiHandler {
|
|
|
53860
53875
|
total_cost: this.sessionTotalCost,
|
|
53861
53876
|
context_window: this.contextWindow,
|
|
53862
53877
|
context_left_percent: leftPct,
|
|
53878
|
+
is_free: pricing.isFree || false,
|
|
53879
|
+
is_estimated: pricing.isEstimate || false,
|
|
53880
|
+
provider_name: this.getProviderName(),
|
|
53881
|
+
model_name: displayModelName,
|
|
53863
53882
|
updated_at: Date.now()
|
|
53864
53883
|
};
|
|
53865
53884
|
const claudishDir = join6(homedir3(), ".claudish");
|
|
@@ -54366,6 +54385,9 @@ var init_gemini_handler = __esm(() => {
|
|
|
54366
54385
|
"x-goog-api-key": this.apiKey
|
|
54367
54386
|
};
|
|
54368
54387
|
}
|
|
54388
|
+
getProviderName() {
|
|
54389
|
+
return "Gemini API";
|
|
54390
|
+
}
|
|
54369
54391
|
};
|
|
54370
54392
|
});
|
|
54371
54393
|
|
|
@@ -54851,6 +54873,7 @@ class GeminiCodeAssistHandler {
|
|
|
54851
54873
|
const total = input + output;
|
|
54852
54874
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
54853
54875
|
const pricing = this.getPricing();
|
|
54876
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
54854
54877
|
const data = {
|
|
54855
54878
|
input_tokens: input,
|
|
54856
54879
|
output_tokens: output,
|
|
@@ -54860,6 +54883,8 @@ class GeminiCodeAssistHandler {
|
|
|
54860
54883
|
context_left_percent: leftPct,
|
|
54861
54884
|
is_free: pricing.isFree || false,
|
|
54862
54885
|
is_estimated: pricing.isEstimate || false,
|
|
54886
|
+
provider_name: "Gemini Free",
|
|
54887
|
+
model_name: displayModelName,
|
|
54863
54888
|
updated_at: Date.now()
|
|
54864
54889
|
};
|
|
54865
54890
|
const claudishDir = join8(homedir5(), ".claudish");
|
|
@@ -55331,6 +55356,7 @@ class OpenAIHandler {
|
|
|
55331
55356
|
try {
|
|
55332
55357
|
const total = input + output;
|
|
55333
55358
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
55359
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
55334
55360
|
const data = {
|
|
55335
55361
|
input_tokens: input,
|
|
55336
55362
|
output_tokens: output,
|
|
@@ -55338,6 +55364,8 @@ class OpenAIHandler {
|
|
|
55338
55364
|
total_cost: this.sessionTotalCost,
|
|
55339
55365
|
context_window: this.contextWindow,
|
|
55340
55366
|
context_left_percent: leftPct,
|
|
55367
|
+
provider_name: "OpenAI",
|
|
55368
|
+
model_name: displayModelName,
|
|
55341
55369
|
updated_at: Date.now()
|
|
55342
55370
|
};
|
|
55343
55371
|
if (isEstimate) {
|
|
@@ -55906,6 +55934,17 @@ class AnthropicCompatHandler {
|
|
|
55906
55934
|
try {
|
|
55907
55935
|
const total = input + output;
|
|
55908
55936
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
55937
|
+
const providerNameMap = {
|
|
55938
|
+
minimax: "MiniMax",
|
|
55939
|
+
kimi: "Kimi",
|
|
55940
|
+
moonshot: "Kimi",
|
|
55941
|
+
glm: "GLM",
|
|
55942
|
+
zhipu: "GLM"
|
|
55943
|
+
};
|
|
55944
|
+
const providerKey = this.provider.name.toLowerCase();
|
|
55945
|
+
const providerDisplayName = providerNameMap[providerKey] || this.provider.name;
|
|
55946
|
+
const pricing = this.getPricing();
|
|
55947
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
55909
55948
|
const data = {
|
|
55910
55949
|
input_tokens: input,
|
|
55911
55950
|
output_tokens: output,
|
|
@@ -55913,6 +55952,10 @@ class AnthropicCompatHandler {
|
|
|
55913
55952
|
total_cost: this.sessionTotalCost,
|
|
55914
55953
|
context_window: this.contextWindow,
|
|
55915
55954
|
context_left_percent: leftPct,
|
|
55955
|
+
is_free: pricing.isFree || false,
|
|
55956
|
+
is_estimated: pricing.isEstimate || false,
|
|
55957
|
+
provider_name: providerDisplayName,
|
|
55958
|
+
model_name: displayModelName,
|
|
55916
55959
|
updated_at: Date.now()
|
|
55917
55960
|
};
|
|
55918
55961
|
const claudishDir = join10(homedir7(), ".claudish");
|
|
@@ -56245,6 +56288,8 @@ class VertexOAuthHandler {
|
|
|
56245
56288
|
try {
|
|
56246
56289
|
const total = input + output;
|
|
56247
56290
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
56291
|
+
const pricing = this.getPricing();
|
|
56292
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
56248
56293
|
const data = {
|
|
56249
56294
|
input_tokens: input,
|
|
56250
56295
|
output_tokens: output,
|
|
@@ -56252,6 +56297,10 @@ class VertexOAuthHandler {
|
|
|
56252
56297
|
total_cost: this.sessionTotalCost,
|
|
56253
56298
|
context_window: this.contextWindow,
|
|
56254
56299
|
context_left_percent: leftPct,
|
|
56300
|
+
is_free: pricing.isFree || false,
|
|
56301
|
+
is_estimated: pricing.isEstimate || false,
|
|
56302
|
+
provider_name: "Vertex AI",
|
|
56303
|
+
model_name: displayModelName,
|
|
56255
56304
|
updated_at: Date.now()
|
|
56256
56305
|
};
|
|
56257
56306
|
const claudishDir = join12(homedir9(), ".claudish");
|
|
@@ -57695,6 +57744,7 @@ class OllamaCloudHandler {
|
|
|
57695
57744
|
this.sessionOutputTokens += output;
|
|
57696
57745
|
const sessionTotal = this.sessionInputTokens + this.sessionOutputTokens;
|
|
57697
57746
|
const cost = calculateCost(this.provider.name, this.modelName, this.sessionInputTokens, this.sessionOutputTokens);
|
|
57747
|
+
const displayModelName = this.modelName.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\/:]/, "");
|
|
57698
57748
|
const data = {
|
|
57699
57749
|
input_tokens: this.sessionInputTokens,
|
|
57700
57750
|
output_tokens: this.sessionOutputTokens,
|
|
@@ -57702,6 +57752,8 @@ class OllamaCloudHandler {
|
|
|
57702
57752
|
total_cost: cost,
|
|
57703
57753
|
context_window: 0,
|
|
57704
57754
|
context_left_percent: 100,
|
|
57755
|
+
provider_name: "OllamaCloud",
|
|
57756
|
+
model_name: displayModelName,
|
|
57705
57757
|
updated_at: Date.now()
|
|
57706
57758
|
};
|
|
57707
57759
|
const claudishDir = join13(homedir10(), ".claudish");
|
|
@@ -62964,6 +63016,7 @@ const CYAN = "\\x1b[96m";
|
|
|
62964
63016
|
const YELLOW = "\\x1b[93m";
|
|
62965
63017
|
const GREEN = "\\x1b[92m";
|
|
62966
63018
|
const MAGENTA = "\\x1b[95m";
|
|
63019
|
+
const BLUE = "\\x1b[94m";
|
|
62967
63020
|
const DIM = "\\x1b[2m";
|
|
62968
63021
|
const RESET = "\\x1b[0m";
|
|
62969
63022
|
const BOLD = "\\x1b[1m";
|
|
@@ -62976,8 +63029,7 @@ process.stdin.on('end', () => {
|
|
|
62976
63029
|
let dir = path.basename(process.cwd());
|
|
62977
63030
|
if (dir.length > 15) dir = dir.substring(0, 12) + '...';
|
|
62978
63031
|
|
|
62979
|
-
let ctx = 100, cost = 0;
|
|
62980
|
-
const model = process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
|
|
63032
|
+
let ctx = 100, cost = 0, providerName = '', model = 'unknown';
|
|
62981
63033
|
const isLocal = process.env.CLAUDISH_IS_LOCAL === 'true';
|
|
62982
63034
|
|
|
62983
63035
|
let isFree = false, isEstimated = false;
|
|
@@ -62987,7 +63039,15 @@ process.stdin.on('end', () => {
|
|
|
62987
63039
|
ctx = tokens.context_left_percent || 100;
|
|
62988
63040
|
isFree = tokens.is_free || false;
|
|
62989
63041
|
isEstimated = tokens.is_estimated || false;
|
|
63042
|
+
providerName = tokens.provider_name || '';
|
|
63043
|
+
// Read model_name from token file, fallback to env var
|
|
63044
|
+
model = tokens.model_name || process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
|
|
63045
|
+
// Strip provider prefix if not already stripped in token file
|
|
63046
|
+
model = model.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]/, '');
|
|
62990
63047
|
} catch (e) {
|
|
63048
|
+
// Fallback to env var if token file not available
|
|
63049
|
+
const rawModel = process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
|
|
63050
|
+
model = rawModel.replace(/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]/, '');
|
|
62991
63051
|
try {
|
|
62992
63052
|
const json = JSON.parse(input);
|
|
62993
63053
|
cost = json.total_cost_usd || 0;
|
|
@@ -63004,7 +63064,13 @@ process.stdin.on('end', () => {
|
|
|
63004
63064
|
} else {
|
|
63005
63065
|
costDisplay = '$' + cost.toFixed(3);
|
|
63006
63066
|
}
|
|
63007
|
-
|
|
63067
|
+
|
|
63068
|
+
// Build status line with provider name
|
|
63069
|
+
if (providerName) {
|
|
63070
|
+
console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${BLUE}\${providerName}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}\${costDisplay}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
|
|
63071
|
+
} else {
|
|
63072
|
+
console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}\${costDisplay}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
|
|
63073
|
+
}
|
|
63008
63074
|
} catch (e) {
|
|
63009
63075
|
console.log('claudish');
|
|
63010
63076
|
}
|
|
@@ -63013,7 +63079,7 @@ process.stdin.on('end', () => {
|
|
|
63013
63079
|
writeFileSync15(scriptPath, script, "utf-8");
|
|
63014
63080
|
return scriptPath;
|
|
63015
63081
|
}
|
|
63016
|
-
function createTempSettingsFile(
|
|
63082
|
+
function createTempSettingsFile(port) {
|
|
63017
63083
|
const homeDir = process.env.HOME || process.env.USERPROFILE || tmpdir2();
|
|
63018
63084
|
const claudishDir = join19(homeDir, ".claudish");
|
|
63019
63085
|
try {
|
|
@@ -63031,10 +63097,11 @@ function createTempSettingsFile(modelDisplay, port) {
|
|
|
63031
63097
|
const YELLOW3 = "\\033[93m";
|
|
63032
63098
|
const GREEN3 = "\\033[92m";
|
|
63033
63099
|
const MAGENTA = "\\033[95m";
|
|
63100
|
+
const BLUE = "\\033[94m";
|
|
63034
63101
|
const DIM2 = "\\033[2m";
|
|
63035
63102
|
const RESET3 = "\\033[0m";
|
|
63036
63103
|
const BOLD3 = "\\033[1m";
|
|
63037
|
-
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && IS_FREE="false" && IS_EST="false" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null | tr -d ' \\n') && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; fi && IS_FREE=$(echo "$TOKENS" | grep -o '"is_free":[a-z]*' | cut -d: -f2) && IS_EST=$(echo "$TOKENS" | grep -o '"is_estimated":[a-z]*' | cut -d: -f2); fi && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; elif [ "$IS_FREE" = "true" ]; then COST_DISPLAY="FREE"; elif [ "$IS_EST" = "true" ]; then COST_DISPLAY=$(printf "~\\$%.3f" "$COST"); else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi && printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM2}•${RESET3} ${YELLOW3}%s${RESET3} ${DIM2}•${RESET3} ${GREEN3}%s${RESET3} ${DIM2}•${RESET3} ${MAGENTA}%s%%${RESET3}\\n" "$DIR" "$
|
|
63104
|
+
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && IS_FREE="false" && IS_EST="false" && PROVIDER="" && MODEL="unknown" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null | tr -d ' \\n') && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; fi && IS_FREE=$(echo "$TOKENS" | grep -o '"is_free":[a-z]*' | cut -d: -f2) && IS_EST=$(echo "$TOKENS" | grep -o '"is_estimated":[a-z]*' | cut -d: -f2) && PROVIDER=$(echo "$TOKENS" | grep -o '"provider_name":"[^"]*"' | cut -d: -f2 | tr -d '"') && MODEL=$(echo "$TOKENS" | grep -o '"model_name":"[^"]*"' | cut -d: -f2 | tr -d '"'); fi && if [ -z "$MODEL" ] || [ "$MODEL" = "unknown" ]; then RAW_MODEL="$CLAUDISH_ACTIVE_MODEL_NAME" && MODEL=$(echo "$RAW_MODEL" | sed -E 's/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]//'); fi && MODEL=$(echo "$MODEL" | sed -E 's/^(go|g|gemini|v|vertex|oai|mmax|mm|kimi|moonshot|glm|zhipu|oc|ollama|lmstudio|vllm|mlx)[\\/:]//') && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; elif [ "$IS_FREE" = "true" ]; then COST_DISPLAY="FREE"; elif [ "$IS_EST" = "true" ]; then COST_DISPLAY=$(printf "~\\$%.3f" "$COST"); else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi && if [ ! -z "$PROVIDER" ]; then printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM2}•${RESET3} ${BLUE}%s${RESET3} ${DIM2}•${RESET3} ${YELLOW3}%s${RESET3} ${DIM2}•${RESET3} ${GREEN3}%s${RESET3} ${DIM2}•${RESET3} ${MAGENTA}%s%%${RESET3}\\n" "$DIR" "$PROVIDER" "$MODEL" "$COST_DISPLAY" "$CTX"; else printf "${CYAN3}${BOLD3}%s${RESET3} ${DIM2}•${RESET3} ${YELLOW3}%s${RESET3} ${DIM2}•${RESET3} ${GREEN3}%s${RESET3} ${DIM2}•${RESET3} ${MAGENTA}%s%%${RESET3}\\n" "$DIR" "$MODEL" "$COST_DISPLAY" "$CTX"; fi`;
|
|
63038
63105
|
}
|
|
63039
63106
|
const settings = {
|
|
63040
63107
|
statusLine: {
|
|
@@ -63050,7 +63117,7 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
63050
63117
|
const modelId = config3.model || "unknown";
|
|
63051
63118
|
const portMatch = proxyUrl.match(/:(\d+)/);
|
|
63052
63119
|
const port = portMatch ? portMatch[1] : "unknown";
|
|
63053
|
-
const tempSettingsPath = createTempSettingsFile(
|
|
63120
|
+
const tempSettingsPath = createTempSettingsFile(port);
|
|
63054
63121
|
const claudeArgs = [];
|
|
63055
63122
|
claudeArgs.push("--settings", tempSettingsPath);
|
|
63056
63123
|
if (config3.interactive) {
|