ccstatusline-usage 2.0.24 → 2.0.26

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.
@@ -50982,19 +50982,13 @@ var SettingsSchema = exports_external.object({
50982
50982
  version: exports_external.number().default(CURRENT_VERSION),
50983
50983
  lines: exports_external.array(exports_external.array(WidgetItemSchema)).min(1).default([
50984
50984
  [
50985
- { id: "session-usage", type: "custom-command", color: "brightBlue", commandPath: "~/.local/bin/ccstatusline-usage.sh session" },
50986
- { id: "sep-session-weekly", type: "separator" },
50987
- { id: "weekly-usage", type: "custom-command", color: "brightBlue", commandPath: "~/.local/bin/ccstatusline-usage.sh weekly" },
50988
- { id: "sep-weekly-reset", type: "separator" },
50989
- { id: "reset-timer", type: "custom-command", color: "brightBlue", commandPath: "~/.local/bin/ccstatusline-usage.sh reset" },
50990
- { id: "sep-reset-model", type: "separator" },
50991
- { id: "model", type: "model", color: "magenta" },
50992
- { id: "sep-model-chatid", type: "separator" },
50993
- { id: "chat-id", type: "claude-session-id", color: "cyan" }
50994
- ],
50995
- [
50996
- { id: "context-usage", type: "custom-command", color: "blue", commandPath: "~/.local/bin/ccstatusline-context.sh" }
50985
+ { id: "model", type: "model", color: "cyan" },
50986
+ { id: "sep1", type: "separator" },
50987
+ { id: "context", type: "context-percentage", color: "blue" },
50988
+ { id: "sep2", type: "separator" },
50989
+ { id: "session-id", type: "claude-session-id", color: "brightBlack" }
50997
50990
  ],
50991
+ [],
50998
50992
  []
50999
50993
  ]),
51000
50994
  flexMode: FlexModeSchema.default("full-minus-40"),
@@ -51450,7 +51444,7 @@ import { execSync as execSync3 } from "child_process";
51450
51444
  import * as fs5 from "fs";
51451
51445
  import * as path4 from "path";
51452
51446
  var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
51453
- var PACKAGE_VERSION = "2.0.24";
51447
+ var PACKAGE_VERSION = "2.0.26";
51454
51448
  function getPackageVersion() {
51455
51449
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51450
  return PACKAGE_VERSION;
@@ -53451,6 +53445,18 @@ class ContextPercentageWidget {
53451
53445
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
53452
53446
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
53453
53447
  return item.rawValue ? `${displayPercentage.toFixed(1)}%` : `Ctx: ${displayPercentage.toFixed(1)}%`;
53448
+ } else if (context.data?.context_window) {
53449
+ const ctxWindow = context.data.context_window;
53450
+ let usedPercentage = null;
53451
+ if (typeof ctxWindow.used_percentage === "number") {
53452
+ usedPercentage = ctxWindow.used_percentage;
53453
+ } else if (typeof ctxWindow.current_usage === "number" && ctxWindow.context_window_size) {
53454
+ usedPercentage = Math.min(100, ctxWindow.current_usage / ctxWindow.context_window_size * 100);
53455
+ }
53456
+ if (usedPercentage !== null) {
53457
+ const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
53458
+ return item.rawValue ? `${displayPercentage.toFixed(1)}%` : `Ctx: ${displayPercentage.toFixed(1)}%`;
53459
+ }
53454
53460
  }
53455
53461
  return null;
53456
53462
  }
@@ -58206,6 +58212,22 @@ var StatusJSONSchema = exports_external.looseObject({
58206
58212
  total_api_duration_ms: exports_external.number().optional(),
58207
58213
  total_lines_added: exports_external.number().optional(),
58208
58214
  total_lines_removed: exports_external.number().optional()
58215
+ }).optional(),
58216
+ context_window: exports_external.object({
58217
+ context_window_size: exports_external.number().optional(),
58218
+ total_input_tokens: exports_external.number().optional(),
58219
+ total_output_tokens: exports_external.number().optional(),
58220
+ current_usage: exports_external.union([
58221
+ exports_external.number(),
58222
+ exports_external.object({
58223
+ input_tokens: exports_external.number().optional(),
58224
+ output_tokens: exports_external.number().optional(),
58225
+ cache_creation_input_tokens: exports_external.number().optional(),
58226
+ cache_read_input_tokens: exports_external.number().optional()
58227
+ })
58228
+ ]).optional(),
58229
+ used_percentage: exports_external.number().optional(),
58230
+ remaining_percentage: exports_external.number().optional()
58209
58231
  }).optional()
58210
58232
  });
58211
58233
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.24",
3
+ "version": "2.0.26",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",
@@ -70,4 +70,4 @@
70
70
  "patchedDependencies": {
71
71
  "ink@6.2.0": "patches/ink@6.2.0.patch"
72
72
  }
73
- }
73
+ }