claude-scope 0.8.31 → 0.8.33
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/claude-scope.cjs +28 -12
- package/package.json +1 -1
package/dist/claude-scope.cjs
CHANGED
|
@@ -2704,7 +2704,7 @@ var init_cache_metrics_widget = __esm({
|
|
|
2704
2704
|
}
|
|
2705
2705
|
/**
|
|
2706
2706
|
* Calculate cache metrics from context usage data
|
|
2707
|
-
* Returns
|
|
2707
|
+
* Returns zero metrics if no usage data is available (widget should always be visible)
|
|
2708
2708
|
*/
|
|
2709
2709
|
calculateMetrics(data) {
|
|
2710
2710
|
let usage = data.context_window?.current_usage;
|
|
@@ -2715,7 +2715,13 @@ var init_cache_metrics_widget = __esm({
|
|
|
2715
2715
|
}
|
|
2716
2716
|
}
|
|
2717
2717
|
if (!usage) {
|
|
2718
|
-
return
|
|
2718
|
+
return {
|
|
2719
|
+
cacheRead: 0,
|
|
2720
|
+
cacheWrite: 0,
|
|
2721
|
+
totalTokens: 0,
|
|
2722
|
+
hitRate: 0,
|
|
2723
|
+
savings: 0
|
|
2724
|
+
};
|
|
2719
2725
|
}
|
|
2720
2726
|
const cacheRead = usage.cache_read_input_tokens ?? 0;
|
|
2721
2727
|
const cacheWrite = usage.cache_creation_input_tokens ?? 0;
|
|
@@ -2746,13 +2752,16 @@ var init_cache_metrics_widget = __esm({
|
|
|
2746
2752
|
}
|
|
2747
2753
|
this.lastSessionId = data.session_id;
|
|
2748
2754
|
const usage = data.context_window?.current_usage;
|
|
2749
|
-
if (usage &&
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2755
|
+
if (usage && !sessionChanged) {
|
|
2756
|
+
const hasAnyTokens = (usage.input_tokens ?? 0) > 0 || (usage.output_tokens ?? 0) > 0 || (usage.cache_creation_input_tokens ?? 0) > 0 || (usage.cache_read_input_tokens ?? 0) > 0;
|
|
2757
|
+
if (hasAnyTokens) {
|
|
2758
|
+
this.cacheManager.setCachedUsage(data.session_id, {
|
|
2759
|
+
input_tokens: usage.input_tokens,
|
|
2760
|
+
output_tokens: usage.output_tokens,
|
|
2761
|
+
cache_creation_input_tokens: usage.cache_creation_input_tokens,
|
|
2762
|
+
cache_read_input_tokens: usage.cache_read_input_tokens
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2756
2765
|
}
|
|
2757
2766
|
const metrics = this.calculateMetrics(data);
|
|
2758
2767
|
this.renderData = metrics ?? void 0;
|
|
@@ -2771,10 +2780,10 @@ var init_cache_metrics_widget = __esm({
|
|
|
2771
2780
|
return styleFn(this.renderData, this.theme);
|
|
2772
2781
|
}
|
|
2773
2782
|
/**
|
|
2774
|
-
* Widget is enabled
|
|
2783
|
+
* Widget is always enabled (shows zeros when no data)
|
|
2775
2784
|
*/
|
|
2776
2785
|
isEnabled() {
|
|
2777
|
-
return
|
|
2786
|
+
return true;
|
|
2778
2787
|
}
|
|
2779
2788
|
};
|
|
2780
2789
|
}
|
|
@@ -3315,7 +3324,14 @@ var init_context_widget = __esm({
|
|
|
3315
3324
|
usage = cached.usage;
|
|
3316
3325
|
}
|
|
3317
3326
|
}
|
|
3318
|
-
if (!usage)
|
|
3327
|
+
if (!usage) {
|
|
3328
|
+
const renderData2 = {
|
|
3329
|
+
used: 0,
|
|
3330
|
+
contextWindowSize: context_window_size,
|
|
3331
|
+
percent: 0
|
|
3332
|
+
};
|
|
3333
|
+
return this.styleFn(renderData2, this.colors.context);
|
|
3334
|
+
}
|
|
3319
3335
|
const used = usage.input_tokens + usage.cache_creation_input_tokens + usage.cache_read_input_tokens + usage.output_tokens;
|
|
3320
3336
|
const percent = Math.round(used / context_window_size * 100);
|
|
3321
3337
|
const renderData = {
|