claudish 3.7.1 → 3.7.2
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 +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -54840,12 +54840,17 @@ class GeminiCodeAssistHandler {
|
|
|
54840
54840
|
log(`[GeminiCodeAssistHandler] Shutting down handler for ${this.modelName}`);
|
|
54841
54841
|
}
|
|
54842
54842
|
getPricing() {
|
|
54843
|
-
return
|
|
54843
|
+
return {
|
|
54844
|
+
inputCostPer1M: 0,
|
|
54845
|
+
outputCostPer1M: 0,
|
|
54846
|
+
isFree: true
|
|
54847
|
+
};
|
|
54844
54848
|
}
|
|
54845
54849
|
writeTokenFile(input, output) {
|
|
54846
54850
|
try {
|
|
54847
54851
|
const total = input + output;
|
|
54848
54852
|
const leftPct = this.contextWindow > 0 ? Math.max(0, Math.min(100, Math.round((this.contextWindow - total) / this.contextWindow * 100))) : 100;
|
|
54853
|
+
const pricing = this.getPricing();
|
|
54849
54854
|
const data = {
|
|
54850
54855
|
input_tokens: input,
|
|
54851
54856
|
output_tokens: output,
|
|
@@ -54853,6 +54858,8 @@ class GeminiCodeAssistHandler {
|
|
|
54853
54858
|
total_cost: this.sessionTotalCost,
|
|
54854
54859
|
context_window: this.contextWindow,
|
|
54855
54860
|
context_left_percent: leftPct,
|
|
54861
|
+
is_free: pricing.isFree || false,
|
|
54862
|
+
is_estimated: pricing.isEstimate || false,
|
|
54856
54863
|
updated_at: Date.now()
|
|
54857
54864
|
};
|
|
54858
54865
|
const claudishDir = join8(homedir5(), ".claudish");
|
|
@@ -55266,7 +55273,6 @@ var init_gemini_codeassist_handler = __esm(() => {
|
|
|
55266
55273
|
init_transform();
|
|
55267
55274
|
init_logger();
|
|
55268
55275
|
init_openai_compat();
|
|
55269
|
-
init_remote_provider_types();
|
|
55270
55276
|
init_gemini_retry();
|
|
55271
55277
|
init_gemini_oauth();
|
|
55272
55278
|
});
|
|
@@ -62974,10 +62980,13 @@ process.stdin.on('end', () => {
|
|
|
62974
62980
|
const model = process.env.CLAUDISH_ACTIVE_MODEL_NAME || 'unknown';
|
|
62975
62981
|
const isLocal = process.env.CLAUDISH_IS_LOCAL === 'true';
|
|
62976
62982
|
|
|
62983
|
+
let isFree = false, isEstimated = false;
|
|
62977
62984
|
try {
|
|
62978
62985
|
const tokens = JSON.parse(fs.readFileSync('${escapedTokenPath}', 'utf-8'));
|
|
62979
62986
|
cost = tokens.total_cost || 0;
|
|
62980
62987
|
ctx = tokens.context_left_percent || 100;
|
|
62988
|
+
isFree = tokens.is_free || false;
|
|
62989
|
+
isEstimated = tokens.is_estimated || false;
|
|
62981
62990
|
} catch (e) {
|
|
62982
62991
|
try {
|
|
62983
62992
|
const json = JSON.parse(input);
|
|
@@ -62985,7 +62994,16 @@ process.stdin.on('end', () => {
|
|
|
62985
62994
|
} catch {}
|
|
62986
62995
|
}
|
|
62987
62996
|
|
|
62988
|
-
|
|
62997
|
+
let costDisplay;
|
|
62998
|
+
if (isLocal) {
|
|
62999
|
+
costDisplay = 'LOCAL';
|
|
63000
|
+
} else if (isFree) {
|
|
63001
|
+
costDisplay = 'FREE';
|
|
63002
|
+
} else if (isEstimated) {
|
|
63003
|
+
costDisplay = '~$' + cost.toFixed(3);
|
|
63004
|
+
} else {
|
|
63005
|
+
costDisplay = '$' + cost.toFixed(3);
|
|
63006
|
+
}
|
|
62989
63007
|
console.log(\`\${CYAN}\${BOLD}\${dir}\${RESET} \${DIM}•\${RESET} \${YELLOW}\${model}\${RESET} \${DIM}•\${RESET} \${GREEN}\${costDisplay}\${RESET} \${DIM}•\${RESET} \${MAGENTA}\${ctx}%\${RESET}\`);
|
|
62990
63008
|
} catch (e) {
|
|
62991
63009
|
console.log('claudish');
|
|
@@ -63016,7 +63034,7 @@ function createTempSettingsFile(modelDisplay, port) {
|
|
|
63016
63034
|
const DIM2 = "\\033[2m";
|
|
63017
63035
|
const RESET3 = "\\033[0m";
|
|
63018
63036
|
const BOLD3 = "\\033[1m";
|
|
63019
|
-
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null) && 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; fi && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; 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" "$CLAUDISH_ACTIVE_MODEL_NAME" "$COST_DISPLAY" "$CTX"`;
|
|
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" "$CLAUDISH_ACTIVE_MODEL_NAME" "$COST_DISPLAY" "$CTX"`;
|
|
63020
63038
|
}
|
|
63021
63039
|
const settings = {
|
|
63022
63040
|
statusLine: {
|