ccstatusline-usage 2.1.12 → 2.1.14
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 +11 -0
- package/dist/ccstatusline.js +20 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,17 @@ Session: [████░░░░░░░░░░░] 27.0% | Weekly: [██
|
|
|
64
64
|
|
|
65
65
|
## 🆕 Recent Updates
|
|
66
66
|
|
|
67
|
+
### [v2.1.14](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.14) - Reduce API polling frequency to prevent rate limiting
|
|
68
|
+
|
|
69
|
+
- [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
|
|
70
|
+
- [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
|
|
71
|
+
|
|
72
|
+
### [v2.1.13](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.13) - Fix stale API cache causing stuck usage display
|
|
73
|
+
|
|
74
|
+
- [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
|
|
75
|
+
- [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **429 rate limit handling** — Properly detects HTTP 429 responses and backs off for 120s instead of hammering the API every 30s
|
|
76
|
+
- [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Token cache invalidation** — Automatically re-reads OAuth token from Keychain/disk when stale cache expires, recovering from expired tokens
|
|
77
|
+
|
|
67
78
|
### [v2.1.12](https://github.com/pcvelz/ccstatusline-usage/releases/tag/v2.1.12) - Remove thinking effort bars from model widget
|
|
68
79
|
|
|
69
80
|
- [pcvelz/ccstatusline-usage](https://github.com/pcvelz/ccstatusline-usage): **Remove thinking effort bars** — Claude Code now shows thinking intensity natively in its own UI, so the `▌▌▌` bars after the model name have been removed from the Model widget
|
package/dist/ccstatusline.js
CHANGED
|
@@ -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.
|
|
51476
|
+
var PACKAGE_VERSION = "2.1.14";
|
|
51477
51477
|
function getPackageVersion() {
|
|
51478
51478
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
51479
51479
|
return PACKAGE_VERSION;
|
|
@@ -54672,8 +54672,8 @@ 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 =
|
|
54676
|
-
var LOCK_MAX_AGE =
|
|
54675
|
+
var CACHE_MAX_AGE = 600;
|
|
54676
|
+
var LOCK_MAX_AGE = 60;
|
|
54677
54677
|
var TOKEN_CACHE_MAX_AGE = 3600;
|
|
54678
54678
|
var cachedData = null;
|
|
54679
54679
|
var cacheTime = 0;
|
|
@@ -54745,6 +54745,8 @@ function fetchFromApi(token) {
|
|
|
54745
54745
|
process.stdout.write(data);
|
|
54746
54746
|
} else if (res.statusCode === 401) {
|
|
54747
54747
|
process.exit(2);
|
|
54748
|
+
} else if (res.statusCode === 429) {
|
|
54749
|
+
process.exit(3);
|
|
54748
54750
|
} else {
|
|
54749
54751
|
process.exit(1);
|
|
54750
54752
|
}
|
|
@@ -54762,11 +54764,15 @@ function fetchFromApi(token) {
|
|
|
54762
54764
|
if (result2.error || !result2.stdout) {
|
|
54763
54765
|
if (result2.status === 2)
|
|
54764
54766
|
return "auth-error";
|
|
54767
|
+
if (result2.status === 3)
|
|
54768
|
+
return "rate-limited";
|
|
54765
54769
|
return null;
|
|
54766
54770
|
}
|
|
54767
54771
|
if (result2.status !== 0) {
|
|
54768
54772
|
if (result2.status === 2)
|
|
54769
54773
|
return "auth-error";
|
|
54774
|
+
if (result2.status === 3)
|
|
54775
|
+
return "rate-limited";
|
|
54770
54776
|
return null;
|
|
54771
54777
|
}
|
|
54772
54778
|
return result2.stdout;
|
|
@@ -54821,6 +54827,16 @@ function fetchApiData() {
|
|
|
54821
54827
|
return stale;
|
|
54822
54828
|
return { error: "api-error" };
|
|
54823
54829
|
}
|
|
54830
|
+
if (response === "rate-limited") {
|
|
54831
|
+
try {
|
|
54832
|
+
const futureTime = new Date(Date.now() + 90000);
|
|
54833
|
+
fs6.utimesSync(LOCK_FILE, futureTime, futureTime);
|
|
54834
|
+
} catch {}
|
|
54835
|
+
const stale = readStaleCache();
|
|
54836
|
+
if (stale && !stale.error)
|
|
54837
|
+
return stale;
|
|
54838
|
+
return { error: "timeout" };
|
|
54839
|
+
}
|
|
54824
54840
|
if (!response) {
|
|
54825
54841
|
const stale = readStaleCache();
|
|
54826
54842
|
if (stale && !stale.error)
|
|
@@ -54848,6 +54864,7 @@ function fetchApiData() {
|
|
|
54848
54864
|
return stale;
|
|
54849
54865
|
return { error: "parse-error" };
|
|
54850
54866
|
}
|
|
54867
|
+
apiData.fetchedAt = now2;
|
|
54851
54868
|
try {
|
|
54852
54869
|
const cacheDir = path5.dirname(CACHE_FILE);
|
|
54853
54870
|
if (!fs6.existsSync(cacheDir)) {
|