claude-friends 0.4.13 → 0.4.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/mcp-server.js CHANGED
@@ -83,6 +83,13 @@ await new Promise((resolve) => {
83
83
  ws.addEventListener("open", resolve, { once: true });
84
84
  });
85
85
 
86
+ // Send heartbeats to avoid being reaped by server
87
+ setInterval(() => {
88
+ if (ws.readyState === 1) {
89
+ ws.send(JSON.stringify({ type: "heartbeat" }));
90
+ }
91
+ }, 10000);
92
+
86
93
  // --- MCP Server ---
87
94
 
88
95
  const server = new McpServer({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-friends",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "description": "See who's online in Claude Code. Add friends, share status, nudge each other.",
5
5
  "type": "module",
6
6
  "bin": {
package/statusline.js CHANGED
@@ -84,11 +84,18 @@ if (data.transcript_path) {
84
84
  } catch {}
85
85
  }
86
86
 
87
- // 6. Cost
88
- if (data.cost?.total_cost_usd != null) {
89
- const cost = data.cost.total_cost_usd;
90
- const color = cost > 10 ? YELLOW : GREEN;
91
- segments.push(`${color}$${cost.toFixed(2)}${RESET}`);
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