claude-friends 0.4.14 → 0.4.16
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/package.json +1 -1
- package/statusline.js +13 -6
package/package.json
CHANGED
package/statusline.js
CHANGED
|
@@ -84,11 +84,18 @@ if (data.transcript_path) {
|
|
|
84
84
|
} catch {}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
// 6.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
// 6. Usage remaining (bar) — rate limits if available, else context window
|
|
88
|
+
const fiveHr = data.rate_limits?.five_hour;
|
|
89
|
+
const ctxUsed = data.context_window?.used_percentage;
|
|
90
|
+
const usedPct = fiveHr?.used_percentage ?? ctxUsed;
|
|
91
|
+
{
|
|
92
|
+
const remaining = usedPct != null ? Math.max(0, 100 - usedPct) : 100;
|
|
93
|
+
const label = fiveHr?.used_percentage != null ? "" : "ctx ";
|
|
94
|
+
const BAR_WIDTH = 8;
|
|
95
|
+
const filled = Math.round((remaining / 100) * BAR_WIDTH);
|
|
96
|
+
const bar = "█".repeat(filled) + "░".repeat(BAR_WIDTH - filled);
|
|
97
|
+
const color = remaining < 5 ? "\x1b[31m" : remaining < 20 ? YELLOW : GREEN;
|
|
98
|
+
segments.push(`${color}[${bar}] ${label}${remaining.toFixed(0)}%${RESET}`);
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
// 7. Streak
|
|
@@ -124,7 +131,7 @@ function formatNum(n) {
|
|
|
124
131
|
function getFriendsOnline() {
|
|
125
132
|
try {
|
|
126
133
|
const cache = JSON.parse(readFileSync(join(homedir(), ".claude-friends-online.json"), "utf-8"));
|
|
127
|
-
if (Date.now() - cache.
|
|
134
|
+
if (Date.now() - cache.lastUpdate > 30000) return { count: 0, names: [] };
|
|
128
135
|
return { count: cache.onlineCount || 0, names: cache.onlineNames || [] };
|
|
129
136
|
} catch {
|
|
130
137
|
return { count: 0, names: [] };
|