pi-status-footer 1.2.0 โ 1.3.0
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/README.md +4 -2
- package/package.json +1 -1
- package/stats-footer.ts +35 -12
package/README.md
CHANGED
|
@@ -34,11 +34,13 @@ The footer appears automatically in the next TUI session.
|
|
|
34
34
|
Just run `pi` in the TUI. Example footer:
|
|
35
35
|
|
|
36
36
|
```
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
๏ฒ 38%/128k ๏ 63% โ5.2k โ8.1k ๏
$0.420 +$0.020000 ๏ง 42 t/s ๏ 4:32 ๏ฅ 1:18
|
|
38
|
+
๏ my-project โธ ๎ฅ main +3 -1 ๏ openai/gpt-4o ๓ฐง medium
|
|
39
39
|
bg 1 running ยท Shiftโ
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
Icons are Nerd Font glyphs (Font Awesome / Material Design ranges), not emoji. Emoji are colour bitmaps whose rendering the terminal decides: some hosts (xterm.js/Chromium, iTerm2) paint them in full colour while others (Alacritty, kitty) draw flat monochrome silhouettes, so the same footer looked different per terminal. Nerd Font glyphs are single-cell line art everywhere. Requires a patched Nerd Font as the terminal font (for example `JetBrainsMono Nerd Font`); without one the icons show as boxes.
|
|
43
|
+
|
|
42
44
|
Line 1: context used/limit, cache hit rate, input/output tokens, session cost + current-run delta, tokens/sec (live while streaming, last rate when idle), agent-run timer, current-turn timer. Line 2: folder (repo root, or cwd outside a repo), branch, working-tree diff vs HEAD, provider/model, thinking level. Narrow terminals shorten the model id from the left first; the folder/git group drops only if the model still can't fit.
|
|
43
45
|
|
|
44
46
|
Line 3 is conditional: it appears only while an extension has status text registered through `ctx.ui.setStatus()` (for example `pi-background-tasks`'s `bg 1 running ยท Shiftโ`, or `pi-subagents` progress), and it disappears as soon as the last status clears, so the footer returns to its two-line height. Segments keep their own styling and are truncated to the terminal width like the other lines. This matters because a custom footer replaces pi's built-in footer: a footer that never reads those statuses hides other extensions' progress entirely.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-status-footer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Compact status footer for pi: model, thinking level, tokens, cost, TPS, cache hit rate, context usage, live git diff, working/turn timers, plus a conditional third line for other extensions' status segments.",
|
|
5
5
|
"author": "kslamph",
|
|
6
6
|
"keywords": [
|
package/stats-footer.ts
CHANGED
|
@@ -19,6 +19,29 @@ type UsageTotals = Pick<
|
|
|
19
19
|
|
|
20
20
|
type RenderTui = { requestRender(force?: boolean): void };
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Footer icon set: Nerd Font Private-Use-Area glyphs, deliberately not emoji.
|
|
24
|
+
*
|
|
25
|
+
* Emoji are colour bitmaps, and how a host draws them is not something the
|
|
26
|
+
* footer can control: xterm.js/Chromium (Orca, VS Code) and iTerm2 render
|
|
27
|
+
* full colour, while Alacritty and kitty rasterise the same code points as
|
|
28
|
+
* flat monochrome silhouettes. The footer therefore looked different from
|
|
29
|
+
* terminal to terminal. These glyphs sit in the patched Nerd Font ranges, so
|
|
30
|
+
* they render as one flat, single-cell line-art icon wherever a Nerd Font is
|
|
31
|
+
* installed.
|
|
32
|
+
*/
|
|
33
|
+
export const ICONS = {
|
|
34
|
+
context: "\u{F1B2}", // fa-cube
|
|
35
|
+
cache: "\u{F1C0}", // fa-database
|
|
36
|
+
cost: "\u{F155}", // fa-usd
|
|
37
|
+
tps: "\u{F0E7}", // fa-flash (bolt)
|
|
38
|
+
runTimer: "\u{F252}", // fa-hourglass-half
|
|
39
|
+
turnTimer: "\u{F0E5}", // fa-comment-o
|
|
40
|
+
folder: "\u{F114}", // fa-folder-o
|
|
41
|
+
model: "\u{F2DB}", // fa-microchip
|
|
42
|
+
thinking: "\u{F09D1}", // md-brain
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
22
45
|
const THINKING_THEME_COLOR = {
|
|
23
46
|
off: "thinkingOff",
|
|
24
47
|
minimal: "thinkingMinimal",
|
|
@@ -278,13 +301,13 @@ export function shortenModelId(
|
|
|
278
301
|
export interface SecondLineParts {
|
|
279
302
|
/** Folder/branch/diff group; "" when there is no folder to show. */
|
|
280
303
|
gitGroup: string;
|
|
281
|
-
/** Prefix before the provider, e.g.
|
|
304
|
+
/** Prefix before the provider, e.g. the model icon plus a space. */
|
|
282
305
|
modelPrefix: string;
|
|
283
306
|
/** Provider name; may be "" when no model is selected. */
|
|
284
307
|
provider: string;
|
|
285
308
|
/** Model id, shortened from the left when space is tight. */
|
|
286
309
|
modelId: string;
|
|
287
|
-
/** Everything after the model id, e.g.
|
|
310
|
+
/** Everything after the model id, e.g. the thinking icon + level. */
|
|
288
311
|
modelSuffix: string;
|
|
289
312
|
/** Between-segment separator. */
|
|
290
313
|
separator: string;
|
|
@@ -521,10 +544,10 @@ export default function statsFooter(pi: ExtensionAPI) {
|
|
|
521
544
|
] ?? "thinkingMedium";
|
|
522
545
|
let thinkingText: string;
|
|
523
546
|
try {
|
|
524
|
-
thinkingText =
|
|
547
|
+
thinkingText = `${ICONS.thinking} ${theme.fg(thinkingColor, thinkingLevel)}`;
|
|
525
548
|
} catch {
|
|
526
549
|
// thinkingMax is optional in themes; fall back to a vivid level.
|
|
527
|
-
thinkingText =
|
|
550
|
+
thinkingText = `${ICONS.thinking} ${theme.fg("thinkingHigh", thinkingLevel)}`;
|
|
528
551
|
}
|
|
529
552
|
// TPS: live rate while the current assistant message streams,
|
|
530
553
|
// falling back to the last completed message's rate so the value
|
|
@@ -544,7 +567,7 @@ export default function statsFooter(pi: ExtensionAPI) {
|
|
|
544
567
|
// Always rendered, so a fresh session shows a $0.000 placeholder
|
|
545
568
|
// rather than the segment appearing out of nowhere later.
|
|
546
569
|
const costSegment =
|
|
547
|
-
|
|
570
|
+
`${ICONS.cost} ${theme.fg("accent", formatCost(usage.cost, spentTokens > 0))}${
|
|
548
571
|
costDelta === "" ? "" : theme.fg("dim", ` ${costDelta}`)
|
|
549
572
|
}`;
|
|
550
573
|
// Line 1 โ stats only (context, cache, tokens, TPS, timers, cost). Every
|
|
@@ -552,19 +575,19 @@ export default function statsFooter(pi: ExtensionAPI) {
|
|
|
552
575
|
// and the TUI clips it rather than dropping stats.
|
|
553
576
|
const statsLine = joinSegments(
|
|
554
577
|
[
|
|
555
|
-
|
|
578
|
+
`${ICONS.context} ${theme.fg(contextColor, contextText)}`,
|
|
556
579
|
theme.fg(
|
|
557
580
|
"dim",
|
|
558
|
-
|
|
581
|
+
`${ICONS.cache} ${cacheRate === null ? "-" : `${cacheRate.toFixed(0)}%`}`,
|
|
559
582
|
),
|
|
560
583
|
theme.fg(
|
|
561
584
|
"dim",
|
|
562
585
|
`โ${formatTokens(usage.input)} โ${formatTokens(usage.output)}`,
|
|
563
586
|
),
|
|
564
587
|
costSegment,
|
|
565
|
-
theme.fg("dim",
|
|
566
|
-
|
|
567
|
-
|
|
588
|
+
theme.fg("dim", `${ICONS.tps} ${Math.round(tpsValue ?? 0)} t/s`),
|
|
589
|
+
`${ICONS.runTimer} ${theme.fg("accent", formatDuration(elapsed))}`,
|
|
590
|
+
`${ICONS.turnTimer} ${theme.fg("accent", formatDuration(turnElapsed))}`,
|
|
568
591
|
],
|
|
569
592
|
separator,
|
|
570
593
|
);
|
|
@@ -576,7 +599,7 @@ export default function statsFooter(pi: ExtensionAPI) {
|
|
|
576
599
|
const gitSegments: string[] = [];
|
|
577
600
|
if (folderName !== null) {
|
|
578
601
|
const folderLabel = repoName ?? folderName;
|
|
579
|
-
const folderText =
|
|
602
|
+
const folderText = `${ICONS.folder} ${theme.fg("accent", folderLabel)}`;
|
|
580
603
|
if (repoName !== null) {
|
|
581
604
|
const branchText = branch
|
|
582
605
|
? ` โธ ๎ฅ ${branch}`
|
|
@@ -593,7 +616,7 @@ export default function statsFooter(pi: ExtensionAPI) {
|
|
|
593
616
|
const gitLine = fitSecondLine(
|
|
594
617
|
{
|
|
595
618
|
gitGroup,
|
|
596
|
-
modelPrefix:
|
|
619
|
+
modelPrefix: `${ICONS.model} `,
|
|
597
620
|
provider: ctx.model?.provider ?? "",
|
|
598
621
|
modelId: ctx.model?.id ?? "no-model",
|
|
599
622
|
modelSuffix: ` ${thinkingText}`,
|