pi-kimi-keepalive 0.3.1 → 0.3.2
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/index.ts +11 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-kimi-keepalive",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Prompt-cache keepalive for Kimi (kimi-coding) sessions in the Pi coding agent. Replays the last real provider request while idle so the automatic prefix cache never expires.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/index.ts
CHANGED
|
@@ -202,7 +202,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
202
202
|
maxMissStreak: int(raw.maxMissStreak, DEFAULT_CONFIG.maxMissStreak, 1),
|
|
203
203
|
maxErrorStreak: int(raw.maxErrorStreak, DEFAULT_CONFIG.maxErrorStreak, 1),
|
|
204
204
|
mode: raw.mode === "smart" ? "smart" : "default",
|
|
205
|
-
|
|
205
|
+
initialized: raw.initialized === true,
|
|
206
206
|
};
|
|
207
207
|
} catch {
|
|
208
208
|
config = { ...DEFAULT_CONFIG };
|
|
@@ -233,8 +233,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
const confirmNext = await wizardCtx.ui.confirm(
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
opts.firstRun
|
|
237
|
+
? "pi-kimi-keepalive — first-time setup"
|
|
238
|
+
: "pi-kimi-keepalive — reconfigure",
|
|
239
|
+
"Set the keepalive guardrails. Press Esc at any prompt to keep the current value. " +
|
|
238
240
|
"All values are saved to ~/.pi/cache-keepalive/state.json and can be changed later " +
|
|
239
241
|
"via /keepalive <setting>.",
|
|
240
242
|
);
|
|
@@ -670,6 +672,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
670
672
|
errorStreak += 1;
|
|
671
673
|
debug("probe failed:", message);
|
|
672
674
|
if (/^HTTP 40[13]\b/.test(message)) {
|
|
675
|
+
// Credentials are dead regardless of history; clear the streaks so the
|
|
676
|
+
// automatic recovery after the next real turn starts from a clean slate.
|
|
677
|
+
missStreak = 0;
|
|
678
|
+
errorStreak = 0;
|
|
679
|
+
smartHitStreak = 0;
|
|
673
680
|
pause("captured credentials rejected; will recapture after your next real turn");
|
|
674
681
|
return;
|
|
675
682
|
}
|
|
@@ -843,6 +850,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
843
850
|
notify("usage: /keepalive maxidle=30m (0 disables the cutoff)", "error");
|
|
844
851
|
break;
|
|
845
852
|
}
|
|
853
|
+
config.maxIdleMs = ms;
|
|
846
854
|
persistConfig();
|
|
847
855
|
notify(ms === 0 ? "maxidle disabled — probing continues while idle" : `maxidle set to ${formatDuration(ms)}`, "info");
|
|
848
856
|
break;
|