pennyrouter 0.2.23 → 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 +7 -6
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,17 +171,15 @@ 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 (~
|
|
172
|
-
// to avoid annoying flicker; show ❄️ cold when expired.
|
|
174
|
+
// the gateway refreshes (~15s) with a fresh timestamp. Show ❄️ cold when expired.
|
|
173
175
|
function cacheWarmth(c) {
|
|
174
176
|
if (!c || typeof c.cache_expires_at !== "number" || c.cache_expires_at <= 0) {
|
|
175
177
|
return "";
|
|
176
178
|
}
|
|
177
179
|
const remaining = c.cache_expires_at - Date.now() / 1000;
|
|
178
180
|
if (remaining <= 0) return " · ❄️ cold";
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
const seconds = Math.floor(roundedRemaining % 60);
|
|
181
|
+
const minutes = Math.floor(remaining / 60);
|
|
182
|
+
const seconds = Math.floor(remaining % 60);
|
|
182
183
|
return " · 🔥 warm " + minutes + ":" + String(seconds).padStart(2, "0");
|
|
183
184
|
}
|
|
184
185
|
|