ccstatusline-usage 2.0.36 → 2.0.37

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.
@@ -51450,7 +51450,7 @@ import { execSync as execSync3 } from "child_process";
51450
51450
  import * as fs5 from "fs";
51451
51451
  import * as path4 from "path";
51452
51452
  var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
51453
- var PACKAGE_VERSION = "2.0.36";
51453
+ var PACKAGE_VERSION = "2.0.37";
51454
51454
  function getPackageVersion() {
51455
51455
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51456
  return PACKAGE_VERSION;
@@ -54684,7 +54684,13 @@ class ContextBarWidget {
54684
54684
  if (!cw)
54685
54685
  return null;
54686
54686
  const total = Number(cw.context_window_size) || 200000;
54687
- const used = Number(cw.current_usage) || 0;
54687
+ let used = 0;
54688
+ if (typeof cw.current_usage === "number") {
54689
+ used = cw.current_usage;
54690
+ } else if (cw.current_usage && typeof cw.current_usage === "object") {
54691
+ const u = cw.current_usage;
54692
+ used = (Number(u.input_tokens) || 0) + (Number(u.output_tokens) || 0) + (Number(u.cache_creation_input_tokens) || 0) + (Number(u.cache_read_input_tokens) || 0);
54693
+ }
54688
54694
  if (isNaN(total) || isNaN(used))
54689
54695
  return null;
54690
54696
  const percent = total > 0 ? used / total * 100 : 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.36",
3
+ "version": "2.0.37",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",