ccstatusline-usage 2.1.13 → 2.1.15

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.
package/README.md CHANGED
@@ -64,6 +64,15 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
64
64
 
65
65
  ## 🆕 Recent Updates
66
66
 
67
+ ### [v2.1.15](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.15) - Show extra usage balance on 1M context models
68
+
69
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Extra usage on 1M models** — Reset Timer widget now shows extra usage spending (`Extra: €X.XX/€Y.YY`) whenever a 1M context model is active (Opus/Sonnet with 1M context window), in addition to the existing trigger when weekly limit reaches 100%
70
+
71
+ ### [v2.1.14](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.14) - Reduce API polling frequency to prevent rate limiting
72
+
73
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Reduced polling** — API cache extended from 3 to 10 minutes (~6 calls/hr instead of ~20), verified over 6 hours with zero 429 rate limit errors
74
+ - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Always serve stale cache** — When API is unavailable, stale data is served indefinitely instead of showing `[Timeout]` — old usage percentages are more useful than an error
75
+
67
76
  ### [v2.1.13](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.13) - Fix stale API cache causing stuck usage display
68
77
 
69
78
  - [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Stale cache expiry** — API usage data older than 10 minutes is now discarded instead of served indefinitely, preventing frozen percentage displays
@@ -51473,7 +51473,7 @@ import { execSync as execSync3 } from "child_process";
51473
51473
  import * as fs5 from "fs";
51474
51474
  import * as path4 from "path";
51475
51475
  var __dirname = "/Users/peter/Documents/Code/ccstatusline-usage/src/utils";
51476
- var PACKAGE_VERSION = "2.1.13";
51476
+ var PACKAGE_VERSION = "2.1.15";
51477
51477
  function getPackageVersion() {
51478
51478
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
51479
51479
  return PACKAGE_VERSION;
@@ -54672,10 +54672,9 @@ import * as os6 from "os";
54672
54672
  import * as path5 from "path";
54673
54673
  var CACHE_FILE = path5.join(os6.homedir(), ".cache", "ccstatusline-api.json");
54674
54674
  var LOCK_FILE = path5.join(os6.homedir(), ".cache", "ccstatusline-api.lock");
54675
- var CACHE_MAX_AGE = 180;
54676
- var LOCK_MAX_AGE = 30;
54675
+ var CACHE_MAX_AGE = 600;
54676
+ var LOCK_MAX_AGE = 60;
54677
54677
  var TOKEN_CACHE_MAX_AGE = 3600;
54678
- var STALE_MAX_AGE = 600;
54679
54678
  var cachedData = null;
54680
54679
  var cacheTime = 0;
54681
54680
  var cachedToken = null;
@@ -54720,18 +54719,7 @@ function getToken() {
54720
54719
  }
54721
54720
  function readStaleCache() {
54722
54721
  try {
54723
- const data = JSON.parse(fs6.readFileSync(CACHE_FILE, "utf8"));
54724
- if (data.fetchedAt) {
54725
- const age = Math.floor(Date.now() / 1000) - data.fetchedAt;
54726
- if (age > STALE_MAX_AGE)
54727
- return null;
54728
- } else {
54729
- const stat = fs6.statSync(CACHE_FILE);
54730
- const age = Math.floor(Date.now() / 1000) - Math.floor(stat.mtimeMs / 1000);
54731
- if (age > STALE_MAX_AGE)
54732
- return null;
54733
- }
54734
- return data;
54722
+ return JSON.parse(fs6.readFileSync(CACHE_FILE, "utf8"));
54735
54723
  } catch {
54736
54724
  return null;
54737
54725
  }
@@ -54823,10 +54811,6 @@ function fetchApiData() {
54823
54811
  }
54824
54812
  fs6.writeFileSync(LOCK_FILE, "");
54825
54813
  } catch {}
54826
- const staleBeforeFetch = readStaleCache();
54827
- if (!staleBeforeFetch) {
54828
- invalidateTokenCache();
54829
- }
54830
54814
  const token = getToken();
54831
54815
  if (!token) {
54832
54816
  const stale = readStaleCache();
@@ -55016,7 +55000,11 @@ class ResetTimerWidget {
55016
55000
  const data = fetchApiData();
55017
55001
  if (data.error)
55018
55002
  return getErrorMessage(data.error);
55019
- if (data.extraUsageEnabled && data.weeklyUsage !== undefined && data.weeklyUsage >= 100 && data.extraUsageUsed !== undefined && data.extraUsageLimit !== undefined) {
55003
+ const model = context.data?.model;
55004
+ const modelId = typeof model === "string" ? model : model?.id ?? "";
55005
+ const contextWindowSize = context.data?.context_window?.context_window_size;
55006
+ const is1mModel = modelId.includes("[1m]") || contextWindowSize !== null && contextWindowSize !== undefined && contextWindowSize >= 1e6;
55007
+ if (data.extraUsageEnabled && (is1mModel || data.weeklyUsage !== undefined && data.weeklyUsage >= 100) && data.extraUsageUsed !== undefined && data.extraUsageLimit !== undefined) {
55020
55008
  const used = formatCents(data.extraUsageUsed);
55021
55009
  const displayLimit = settings.extraUsageBalance ?? data.extraUsageLimit;
55022
55010
  const limit = formatCents(displayLimit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstatusline-usage",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
4
4
  "description": "A customizable status line formatter for Claude Code CLI",
5
5
  "module": "src/ccstatusline.ts",
6
6
  "type": "module",