pi-plus 0.1.3 → 0.1.4
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/indicator.ts +7 -4
package/package.json
CHANGED
package/src/indicator.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Port of Claude Code's TokenWarning indicator (src/components/TokenWarning.tsx)
|
|
2
|
+
* Port of Claude Code's TokenWarning indicator (src/components/TokenWarning.tsx),
|
|
3
|
+
* adapted for a permanent footer status line.
|
|
3
4
|
*
|
|
4
5
|
* Rendering rules (auto-compact reactive/collapse modes omitted — ant-only):
|
|
5
|
-
* - below the warning threshold:
|
|
6
|
+
* - below the warning threshold: dim "N% until auto-compact" (CC renders nothing
|
|
7
|
+
* here, but a status line should always show the current usage)
|
|
6
8
|
* - auto-compact on: dim "N% until auto-compact"
|
|
7
9
|
* - auto-compact off: "Context low (N% remaining) · Run /compact to compact & continue",
|
|
8
10
|
* warning color, or error color once past the error threshold / blocking limit
|
|
@@ -20,11 +22,12 @@ export function renderTokenWarning(
|
|
|
20
22
|
autoCompactEnabled: boolean,
|
|
21
23
|
theme: ThemeLike,
|
|
22
24
|
): string | undefined {
|
|
23
|
-
if (!state.isAboveWarningThreshold) return undefined;
|
|
24
|
-
|
|
25
25
|
if (autoCompactEnabled) {
|
|
26
26
|
return theme.fg("dim", `${state.percentLeft}% until auto-compact`);
|
|
27
27
|
}
|
|
28
|
+
if (!state.isAboveWarningThreshold) {
|
|
29
|
+
return theme.fg("dim", `${state.percentLeft}% remaining`);
|
|
30
|
+
}
|
|
28
31
|
const color = state.isAboveErrorThreshold || state.isAtBlockingLimit ? "error" : "warning";
|
|
29
32
|
return theme.fg(color, `Context low (${state.percentLeft}% remaining) · Run /compact to compact & continue`);
|
|
30
33
|
}
|