pennyrouter 0.2.21 → 0.2.23
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/src/statusline.js +7 -5
package/package.json
CHANGED
package/src/statusline.js
CHANGED
|
@@ -46,7 +46,7 @@ export async function configureClaudeCodeStatusline(current) {
|
|
|
46
46
|
current.statusLine = {
|
|
47
47
|
type: "command",
|
|
48
48
|
command: `node "${statuslineScriptPath()}"`,
|
|
49
|
-
refreshInterval:
|
|
49
|
+
refreshInterval: 10,
|
|
50
50
|
...(existing?.padding !== undefined ? { padding: existing.padding } : {}),
|
|
51
51
|
};
|
|
52
52
|
return { script_path: statuslineScriptPath(), wrapped: Boolean(config.wrap_command) };
|
|
@@ -168,15 +168,17 @@ function askBadges(c) {
|
|
|
168
168
|
// Cache warmth countdown: when a prompt cache prefix is live, show time remaining.
|
|
169
169
|
// The gateway sends cache_expires_at (absolute Unix timestamp); we interpolate locally
|
|
170
170
|
// so it ticks down smoothly every statusline render (every ~1s), only "jumping" when
|
|
171
|
-
// the gateway refreshes (~
|
|
171
|
+
// the gateway refreshes (~10s) with a fresh timestamp. Round to nearest 10 seconds
|
|
172
|
+
// to avoid annoying flicker; show ❄️ cold when expired.
|
|
172
173
|
function cacheWarmth(c) {
|
|
173
174
|
if (!c || typeof c.cache_expires_at !== "number" || c.cache_expires_at <= 0) {
|
|
174
175
|
return "";
|
|
175
176
|
}
|
|
176
177
|
const remaining = c.cache_expires_at - Date.now() / 1000;
|
|
177
|
-
if (remaining <= 0) return "";
|
|
178
|
-
const
|
|
179
|
-
const
|
|
178
|
+
if (remaining <= 0) return " · ❄️ cold";
|
|
179
|
+
const roundedRemaining = Math.round(remaining / 10) * 10;
|
|
180
|
+
const minutes = Math.floor(roundedRemaining / 60);
|
|
181
|
+
const seconds = Math.floor(roundedRemaining % 60);
|
|
180
182
|
return " · 🔥 warm " + minutes + ":" + String(seconds).padStart(2, "0");
|
|
181
183
|
}
|
|
182
184
|
|