pennyrouter 0.2.20 โ†’ 0.2.22

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/statusline.js +17 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pennyrouter",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "Install and manage PennyRouter local coding-agent integrations.",
5
5
  "homepage": "https://pennyrouter.com",
6
6
  "bugs": {
package/src/statusline.js CHANGED
@@ -46,6 +46,7 @@ export async function configureClaudeCodeStatusline(current) {
46
46
  current.statusLine = {
47
47
  type: "command",
48
48
  command: `node "${statuslineScriptPath()}"`,
49
+ refreshInterval: 15,
49
50
  ...(existing?.padding !== undefined ? { padding: existing.padding } : {}),
50
51
  };
51
52
  return { script_path: statuslineScriptPath(), wrapped: Boolean(config.wrap_command) };
@@ -164,13 +165,28 @@ function askBadges(c) {
164
165
  return out;
165
166
  }
166
167
 
168
+ // Cache warmth countdown: when a prompt cache prefix is live, show time remaining.
169
+ // The gateway sends cache_expires_at (absolute Unix timestamp); we interpolate locally
170
+ // so it ticks down smoothly every statusline render (every ~1s), only "jumping" when
171
+ // the gateway refreshes (~15s) with a fresh timestamp.
172
+ function cacheWarmth(c) {
173
+ if (!c || typeof c.cache_expires_at !== "number" || c.cache_expires_at <= 0) {
174
+ return "";
175
+ }
176
+ const remaining = c.cache_expires_at - Date.now() / 1000;
177
+ if (remaining <= 0) return "";
178
+ const minutes = Math.floor(remaining / 60);
179
+ const seconds = Math.floor(remaining % 60);
180
+ return " ยท ๐Ÿ”ฅ warm " + minutes + ":" + String(seconds).padStart(2, "0");
181
+ }
182
+
167
183
  let penny;
168
184
  if (!pennyInstalled) {
169
185
  penny = "๐Ÿช™ penny off";
170
186
  } else if (cache && cache.known && cache.bypass) {
171
187
  penny = "๐Ÿช™ penny off";
172
188
  } else {
173
- penny = "๐Ÿช™ penny" + authSuffix(cache && cache.auth_mode) + askBadges(cache);
189
+ penny = "๐Ÿช™ penny" + authSuffix(cache && cache.auth_mode) + askBadges(cache) + cacheWarmth(cache);
174
190
  }
175
191
 
176
192
  let lines;