ccstatusline 2.0.22 → 2.0.24

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.
@@ -51405,7 +51405,7 @@ import { execSync as execSync3 } from "child_process";
51405
51405
  import * as fs5 from "fs";
51406
51406
  import * as path4 from "path";
51407
51407
  var __dirname = "/Users/sirmalloc/Projects/Personal/ccstatusline/src/utils";
51408
- var PACKAGE_VERSION = "2.0.22";
51408
+ var PACKAGE_VERSION = "2.0.24";
51409
51409
  function getPackageVersion() {
51410
51410
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51411
51411
  return PACKAGE_VERSION;
@@ -52251,8 +52251,11 @@ class ModelWidget {
52251
52251
  render(item, context, settings) {
52252
52252
  if (context.isPreview) {
52253
52253
  return item.rawValue ? "Claude" : "Model: Claude";
52254
- } else if (context.data?.model?.display_name) {
52255
- return item.rawValue ? context.data.model.display_name : `Model: ${context.data.model.display_name}`;
52254
+ }
52255
+ const model = context.data?.model;
52256
+ const modelDisplayName = typeof model === "string" ? model : model?.display_name ?? model?.id;
52257
+ if (modelDisplayName) {
52258
+ return item.rawValue ? modelDisplayName : `Model: ${modelDisplayName}`;
52256
52259
  }
52257
52260
  return null;
52258
52261
  }
@@ -52545,7 +52548,8 @@ function calculateContextPercentage(context) {
52545
52548
  if (!context.tokenMetrics) {
52546
52549
  return 0;
52547
52550
  }
52548
- const modelId = context.data?.model?.id;
52551
+ const model = context.data?.model;
52552
+ const modelId = typeof model === "string" ? model : model?.id;
52549
52553
  const contextConfig = getContextConfig(modelId);
52550
52554
  return Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
52551
52555
  }
@@ -53401,7 +53405,8 @@ class ContextPercentageWidget {
53401
53405
  const previewValue = isInverse ? "90.7%" : "9.3%";
53402
53406
  return item.rawValue ? previewValue : `Ctx: ${previewValue}`;
53403
53407
  } else if (context.tokenMetrics) {
53404
- const modelId = context.data?.model?.id;
53408
+ const model = context.data?.model;
53409
+ const modelId = typeof model === "string" ? model : model?.id;
53405
53410
  const contextConfig = getContextConfig(modelId);
53406
53411
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
53407
53412
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
@@ -53462,7 +53467,8 @@ class ContextPercentageUsableWidget {
53462
53467
  const previewValue = isInverse ? "88.4%" : "11.6%";
53463
53468
  return item.rawValue ? previewValue : `Ctx(u): ${previewValue}`;
53464
53469
  } else if (context.tokenMetrics) {
53465
- const modelId = context.data?.model?.id;
53470
+ const model = context.data?.model;
53471
+ const modelId = typeof model === "string" ? model : model?.id;
53466
53472
  const contextConfig = getContextConfig(modelId);
53467
53473
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.usableTokens * 100);
53468
53474
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
@@ -54308,6 +54314,38 @@ var CurrentWorkingDirEditor = ({ widget, onComplete, onCancel, action }) => {
54308
54314
  children: "Unknown editor mode"
54309
54315
  }, undefined, false, undefined, this);
54310
54316
  };
54317
+ // src/widgets/ClaudeSessionId.ts
54318
+ class ClaudeSessionIdWidget {
54319
+ getDefaultColor() {
54320
+ return "cyan";
54321
+ }
54322
+ getDescription() {
54323
+ return "Shows the current Claude Code session ID reported in status JSON";
54324
+ }
54325
+ getDisplayName() {
54326
+ return "Claude Session ID";
54327
+ }
54328
+ getEditorDisplay(item) {
54329
+ return { displayText: this.getDisplayName() };
54330
+ }
54331
+ render(item, context, settings) {
54332
+ if (context.isPreview) {
54333
+ return item.rawValue ? "preview-session-id" : "Session ID: preview-session-id";
54334
+ } else {
54335
+ const sessionId = context.data?.session_id;
54336
+ if (!sessionId) {
54337
+ return null;
54338
+ }
54339
+ return item.rawValue ? sessionId : `Session ID: ${sessionId}`;
54340
+ }
54341
+ }
54342
+ supportsRawValue() {
54343
+ return true;
54344
+ }
54345
+ supportsColors(item) {
54346
+ return true;
54347
+ }
54348
+ }
54311
54349
  // src/utils/widgets.ts
54312
54350
  var widgetRegistry = new Map([
54313
54351
  ["model", new ModelWidget],
@@ -54329,7 +54367,8 @@ var widgetRegistry = new Map([
54329
54367
  ["terminal-width", new TerminalWidthWidget],
54330
54368
  ["version", new VersionWidget],
54331
54369
  ["custom-text", new CustomTextWidget],
54332
- ["custom-command", new CustomCommandWidget]
54370
+ ["custom-command", new CustomCommandWidget],
54371
+ ["claude-session-id", new ClaudeSessionIdWidget]
54333
54372
  ]);
54334
54373
  function getWidget(type) {
54335
54374
  return widgetRegistry.get(type) ?? null;
@@ -58112,10 +58151,13 @@ var StatusJSONSchema = exports_external.looseObject({
58112
58151
  session_id: exports_external.string().optional(),
58113
58152
  transcript_path: exports_external.string().optional(),
58114
58153
  cwd: exports_external.string().optional(),
58115
- model: exports_external.object({
58116
- id: exports_external.string().optional(),
58117
- display_name: exports_external.string().optional()
58118
- }).optional(),
58154
+ model: exports_external.union([
58155
+ exports_external.string(),
58156
+ exports_external.object({
58157
+ id: exports_external.string().optional(),
58158
+ display_name: exports_external.string().optional()
58159
+ })
58160
+ ]).optional(),
58119
58161
  workspace: exports_external.object({
58120
58162
  current_dir: exports_external.string().optional(),
58121
58163
  project_dir: exports_external.string().optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",