ccstatusline-usage 2.0.41 → 2.0.42

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.41";
51453
+ var PACKAGE_VERSION = "2.0.42";
51454
51454
  function getPackageVersion() {
51455
51455
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51456
51456
  return PACKAGE_VERSION;
@@ -52296,8 +52296,11 @@ class ModelWidget {
52296
52296
  render(item, context, settings) {
52297
52297
  if (context.isPreview) {
52298
52298
  return item.rawValue ? "Claude" : "Model: Claude";
52299
- } else if (context.data?.model?.display_name) {
52300
- return item.rawValue ? context.data.model.display_name : `Model: ${context.data.model.display_name}`;
52299
+ }
52300
+ const model = context.data?.model;
52301
+ const modelDisplayName = typeof model === "string" ? model : model?.display_name ?? model?.id;
52302
+ if (modelDisplayName) {
52303
+ return item.rawValue ? modelDisplayName : `Model: ${modelDisplayName}`;
52301
52304
  }
52302
52305
  return null;
52303
52306
  }
@@ -52590,7 +52593,8 @@ function calculateContextPercentage(context) {
52590
52593
  if (!context.tokenMetrics) {
52591
52594
  return 0;
52592
52595
  }
52593
- const modelId = context.data?.model?.id;
52596
+ const model = context.data?.model;
52597
+ const modelId = typeof model === "string" ? model : model?.id;
52594
52598
  const contextConfig = getContextConfig(modelId);
52595
52599
  return Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
52596
52600
  }
@@ -53446,7 +53450,8 @@ class ContextPercentageWidget {
53446
53450
  const previewValue = isInverse ? "90.7%" : "9.3%";
53447
53451
  return item.rawValue ? previewValue : `Ctx: ${previewValue}`;
53448
53452
  } else if (context.tokenMetrics) {
53449
- const modelId = context.data?.model?.id;
53453
+ const model = context.data?.model;
53454
+ const modelId = typeof model === "string" ? model : model?.id;
53450
53455
  const contextConfig = getContextConfig(modelId);
53451
53456
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.maxTokens * 100);
53452
53457
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
@@ -53519,7 +53524,8 @@ class ContextPercentageUsableWidget {
53519
53524
  const previewValue = isInverse ? "88.4%" : "11.6%";
53520
53525
  return item.rawValue ? previewValue : `Ctx(u): ${previewValue}`;
53521
53526
  } else if (context.tokenMetrics) {
53522
- const modelId = context.data?.model?.id;
53527
+ const model = context.data?.model;
53528
+ const modelId = typeof model === "string" ? model : model?.id;
53523
53529
  const contextConfig = getContextConfig(modelId);
53524
53530
  const usedPercentage = Math.min(100, context.tokenMetrics.contextLength / contextConfig.usableTokens * 100);
53525
53531
  const displayPercentage = isInverse ? 100 - usedPercentage : usedPercentage;
@@ -54538,7 +54544,7 @@ function fetchApiData() {
54538
54544
  const apiData = {};
54539
54545
  if (data.five_hour) {
54540
54546
  apiData.sessionUsage = data.five_hour.utilization;
54541
- apiData.sessionResetAt = data.five_hour.reset_at;
54547
+ apiData.sessionResetAt = data.five_hour.resets_at;
54542
54548
  }
54543
54549
  if (data.seven_day) {
54544
54550
  apiData.weeklyUsage = data.seven_day.utilization;
@@ -56306,6 +56312,7 @@ var LineSelector = ({
56306
56312
  }) => {
56307
56313
  const [selectedIndex, setSelectedIndex] = import_react37.useState(initialSelection);
56308
56314
  const [showDeleteDialog, setShowDeleteDialog] = import_react37.useState(false);
56315
+ const [moveMode, setMoveMode] = import_react37.useState(false);
56309
56316
  const [localLines, setLocalLines] = import_react37.useState(lines);
56310
56317
  import_react37.useEffect(() => {
56311
56318
  setLocalLines(lines);
@@ -56337,6 +56344,32 @@ var LineSelector = ({
56337
56344
  onBack();
56338
56345
  return;
56339
56346
  }
56347
+ if (moveMode) {
56348
+ if (key.upArrow && selectedIndex > 0) {
56349
+ const newLines = [...localLines];
56350
+ const temp = newLines[selectedIndex];
56351
+ const prev = newLines[selectedIndex - 1];
56352
+ if (temp && prev) {
56353
+ [newLines[selectedIndex], newLines[selectedIndex - 1]] = [prev, temp];
56354
+ }
56355
+ setLocalLines(newLines);
56356
+ onLinesUpdate(newLines);
56357
+ setSelectedIndex(selectedIndex - 1);
56358
+ } else if (key.downArrow && selectedIndex < localLines.length - 1) {
56359
+ const newLines = [...localLines];
56360
+ const temp = newLines[selectedIndex];
56361
+ const next = newLines[selectedIndex + 1];
56362
+ if (temp && next) {
56363
+ [newLines[selectedIndex], newLines[selectedIndex + 1]] = [next, temp];
56364
+ }
56365
+ setLocalLines(newLines);
56366
+ onLinesUpdate(newLines);
56367
+ setSelectedIndex(selectedIndex + 1);
56368
+ } else if (key.escape || key.return) {
56369
+ setMoveMode(false);
56370
+ }
56371
+ return;
56372
+ }
56340
56373
  switch (input) {
56341
56374
  case "a":
56342
56375
  if (allowEditing) {
@@ -56348,6 +56381,11 @@ var LineSelector = ({
56348
56381
  setShowDeleteDialog(true);
56349
56382
  }
56350
56383
  return;
56384
+ case "m":
56385
+ if (allowEditing && localLines.length > 1 && selectedIndex < localLines.length) {
56386
+ setMoveMode(true);
56387
+ }
56388
+ return;
56351
56389
  }
56352
56390
  if (key.escape) {
56353
56391
  onBack();
@@ -56470,17 +56508,31 @@ var LineSelector = ({
56470
56508
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56471
56509
  flexDirection: "column",
56472
56510
  children: [
56473
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56474
- bold: true,
56475
- children: title ?? "Select Line to Edit"
56476
- }, undefined, false, undefined, this),
56511
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56512
+ children: [
56513
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56514
+ bold: true,
56515
+ children: [
56516
+ title ?? "Select Line to Edit",
56517
+ " "
56518
+ ]
56519
+ }, undefined, true, undefined, this),
56520
+ moveMode && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56521
+ color: "blue",
56522
+ children: "[MOVE MODE]"
56523
+ }, undefined, false, undefined, this)
56524
+ ]
56525
+ }, undefined, true, undefined, this),
56477
56526
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56478
56527
  dimColor: true,
56479
56528
  children: "Choose which status line to configure"
56480
56529
  }, undefined, false, undefined, this),
56481
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56530
+ moveMode ? /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56531
+ dimColor: true,
56532
+ children: "↑↓ to move line, ESC or Enter to exit move mode"
56533
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56482
56534
  dimColor: true,
56483
- children: allowEditing ? localLines.length > 1 ? "(a) to append new line, (d) to delete line, ESC to go back" : "(a) to append new line, ESC to go back" : "ESC to go back"
56535
+ children: allowEditing ? localLines.length > 1 ? "(a) to append new line, (d) to delete line, (m) to move line, ESC to go back" : "(a) to append new line, ESC to go back" : "ESC to go back"
56484
56536
  }, undefined, false, undefined, this),
56485
56537
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56486
56538
  marginTop: 1,
@@ -56491,10 +56543,10 @@ var LineSelector = ({
56491
56543
  const suffix = line.length ? import_pluralize.default("widget", line.length, true) : "empty";
56492
56544
  return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56493
56545
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56494
- color: isSelected ? "green" : undefined,
56546
+ color: isSelected ? moveMode ? "blue" : "green" : undefined,
56495
56547
  children: [
56496
56548
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56497
- children: isSelected ? "▶ " : " "
56549
+ children: isSelected ? moveMode ? "◆ " : "▶ " : " "
56498
56550
  }, undefined, false, undefined, this),
56499
56551
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56500
56552
  children: [
@@ -56520,7 +56572,7 @@ var LineSelector = ({
56520
56572
  }, undefined, true, undefined, this)
56521
56573
  }, index, false, undefined, this);
56522
56574
  }),
56523
- /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56575
+ !moveMode && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
56524
56576
  marginTop: 1,
56525
56577
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text, {
56526
56578
  color: selectedIndex === localLines.length ? "green" : undefined,
@@ -58540,10 +58592,13 @@ var StatusJSONSchema = exports_external.looseObject({
58540
58592
  session_id: exports_external.string().optional(),
58541
58593
  transcript_path: exports_external.string().optional(),
58542
58594
  cwd: exports_external.string().optional(),
58543
- model: exports_external.object({
58544
- id: exports_external.string().optional(),
58545
- display_name: exports_external.string().optional()
58546
- }).optional(),
58595
+ model: exports_external.union([
58596
+ exports_external.string(),
58597
+ exports_external.object({
58598
+ id: exports_external.string().optional(),
58599
+ display_name: exports_external.string().optional()
58600
+ })
58601
+ ]).optional(),
58547
58602
  workspace: exports_external.object({
58548
58603
  current_dir: exports_external.string().optional(),
58549
58604
  project_dir: exports_external.string().optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.0.41",
3
+ "version": "2.0.42",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",