claude-usage-dashboard 1.5.4 → 1.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/js/app.js +26 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-usage-dashboard",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "Claude Code usage dashboard — token costs, quota cycle tracking, cache efficiency, multi-machine sync across all your devices",
5
5
  "main": "server/index.js",
6
6
  "bin": {
package/public/js/app.js CHANGED
@@ -144,18 +144,35 @@ async function loadAll() {
144
144
  fetchCache(params),
145
145
  ]);
146
146
 
147
- // Summary cards
147
+ // Summary cards — use multi-machine cycle data when viewing current cycle
148
148
  const t = usage.total;
149
- const totalAll = t.input_tokens + t.output_tokens + t.cache_read_tokens + t.cache_creation_tokens;
149
+ let tokIn = t.input_tokens, tokOut = t.output_tokens;
150
+ let tokCR = t.cache_read_tokens, tokCW = t.cache_creation_tokens;
151
+ let apiCost = cost.api_equivalent_cost_usd;
152
+ const cc = _cachedCycleData?.currentCycle?.overall;
153
+ if (cc?.tokens) {
154
+ const cct = cc.tokens;
155
+ const mergedAll = cct.input + cct.output + cct.cacheRead + cct.cacheCreation;
156
+ const localAll = tokIn + tokOut + tokCR + tokCW;
157
+ if (mergedAll > localAll) {
158
+ tokIn = cct.input; tokOut = cct.output;
159
+ tokCR = cct.cacheRead; tokCW = cct.cacheCreation;
160
+ apiCost = cc.actualCost;
161
+ }
162
+ }
163
+ const totalAll = tokIn + tokOut + tokCR + tokCW;
150
164
  document.getElementById('val-total-tokens').textContent = formatNumber(totalAll);
151
165
  document.getElementById('sub-total-tokens').innerHTML =
152
- `<span style="color:#4ade80">cache read:${formatNumber(t.cache_read_tokens)}</span> · ` +
153
- `<span style="color:#f59e0b">cache write:${formatNumber(t.cache_creation_tokens)}</span> · ` +
154
- `<span style="color:#60a5fa">in:${formatNumber(t.input_tokens)}</span> · ` +
155
- `<span style="color:#f97316">out:${formatNumber(t.output_tokens)}</span>`;
156
- document.getElementById('val-api-cost').textContent = `$${cost.api_equivalent_cost_usd.toFixed(2)}`;
157
-
158
- document.getElementById('val-cache-rate').textContent = `${(cache.cache_read_rate * 100).toFixed(1)}%`;
166
+ `<span style="color:#4ade80">cache read:${formatNumber(tokCR)}</span> · ` +
167
+ `<span style="color:#f59e0b">cache write:${formatNumber(tokCW)}</span> · ` +
168
+ `<span style="color:#60a5fa">in:${formatNumber(tokIn)}</span> · ` +
169
+ `<span style="color:#f97316">out:${formatNumber(tokOut)}</span>`;
170
+ document.getElementById('val-api-cost').textContent = `$${apiCost.toFixed(2)}`;
171
+
172
+ const totalInput = tokIn + tokCR + tokCW;
173
+ document.getElementById('val-cache-rate').textContent = totalInput > 0
174
+ ? `${((tokCR / totalInput) * 100).toFixed(1)}%`
175
+ : `${(cache.cache_read_rate * 100).toFixed(1)}%`;
159
176
 
160
177
  // Set active granularity button
161
178
  const activeGran = usage.granularity;