pennyrouter 0.2.22 → 0.2.24
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 +6 -3
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: 1,
|
|
50
50
|
...(existing?.padding !== undefined ? { padding: existing.padding } : {}),
|
|
51
51
|
};
|
|
52
52
|
return { script_path: statuslineScriptPath(), wrapped: Boolean(config.wrap_command) };
|
|
@@ -121,6 +121,9 @@ if (process.argv[2] === "--refresh") {
|
|
|
121
121
|
});
|
|
122
122
|
if (resp.ok) {
|
|
123
123
|
const data = await resp.json();
|
|
124
|
+
if (data.cache_expires_at && typeof data.cache_expires_at === "number") {
|
|
125
|
+
data.cache_expires_at = Math.round(data.cache_expires_at / 10) * 10;
|
|
126
|
+
}
|
|
124
127
|
mkdirSync(cacheDir, { recursive: true });
|
|
125
128
|
writeFileSync(join(cacheDir, sessionId + ".json"), JSON.stringify(data));
|
|
126
129
|
}
|
|
@@ -168,13 +171,13 @@ function askBadges(c) {
|
|
|
168
171
|
// Cache warmth countdown: when a prompt cache prefix is live, show time remaining.
|
|
169
172
|
// The gateway sends cache_expires_at (absolute Unix timestamp); we interpolate locally
|
|
170
173
|
// so it ticks down smoothly every statusline render (every ~1s), only "jumping" when
|
|
171
|
-
// the gateway refreshes (~15s) with a fresh timestamp.
|
|
174
|
+
// the gateway refreshes (~15s) with a fresh timestamp. Show ❄️ cold when expired.
|
|
172
175
|
function cacheWarmth(c) {
|
|
173
176
|
if (!c || typeof c.cache_expires_at !== "number" || c.cache_expires_at <= 0) {
|
|
174
177
|
return "";
|
|
175
178
|
}
|
|
176
179
|
const remaining = c.cache_expires_at - Date.now() / 1000;
|
|
177
|
-
if (remaining <= 0) return "";
|
|
180
|
+
if (remaining <= 0) return " · ❄️ cold";
|
|
178
181
|
const minutes = Math.floor(remaining / 60);
|
|
179
182
|
const seconds = Math.floor(remaining % 60);
|
|
180
183
|
return " · 🔥 warm " + minutes + ":" + String(seconds).padStart(2, "0");
|