pi-status-footer 1.1.0 → 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # pi-status-footer
2
2
 
3
- Compact two-line status footer for the pi TUI: context usage, tokens, cost, live TPS, git diff, and run timers.
3
+ Compact status footer for the pi TUI: context usage, tokens, cost, live TPS, git diff, and run timers, plus an optional third line for other extensions' status segments.
4
4
 
5
5
  See [pi.dev docs](https://pi.dev) for how extensions work.
6
6
 
@@ -8,7 +8,7 @@ See [pi.dev docs](https://pi.dev) for how extensions work.
8
8
 
9
9
  | Extension | Command / shortcut | What it does |
10
10
  |---|---|---|
11
- | `stats-footer.ts` | (no command; TUI footer widget) | Renders a two-line footer: line 1 stats/timers, line 2 folder, git branch/diff, model, thinking level |
11
+ | `stats-footer.ts` | (no command; TUI footer widget) | Renders a footer: line 1 stats/timers, line 2 folder, git branch/diff, model, thinking level, and a conditional line 3 carrying statuses other extensions set via `ctx.ui.setStatus()` |
12
12
 
13
13
  It registers no slash commands, shortcuts, flags, tools, or providers. It hooks session/agent/turn/message events (`session_start`, `agent_start`, `agent_settled`, `turn_start/end`, `message_start/update/end`, `model_select`, `thinking_level_select`, `session_info_changed`, `session_shutdown`) to update the footer.
14
14
 
@@ -36,10 +36,13 @@ Just run `pi` in the TUI. Example footer:
36
36
  ```
37
37
  📦 38%/128k 💾 63% ↑5.2k ↓8.1k 💰 $0.420 +$0.020000 ⚡42 t/s ⏳ 4:32 💬 1:18
38
38
  📁 my-project ▸  main +3 -1 🤖 openai/gpt-4o 💭 medium
39
+ bg 1 running · Shift↓
39
40
  ```
40
41
 
41
42
  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.
42
43
 
44
+ 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.
45
+
43
46
  ## Configuration
44
47
 
45
48
  Zero config. No env vars, no settings keys.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "pi-status-footer",
3
- "version": "1.1.0",
4
- "description": "Compact two-line status footer for pi: model, thinking level, tokens, cost, TPS, cache hit rate, context usage, live git diff, and working/turn timers.",
3
+ "version": "1.2.0",
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
+ "author": "kslamph",
5
6
  "keywords": [
6
7
  "pi-package",
7
8
  "pi",
package/stats-footer.ts CHANGED
@@ -129,6 +129,16 @@ export function collectSessionStats(entries: readonly SessionEntry[]): {
129
129
  }
130
130
  if (entry.type === "branch_summary" || entry.type === "compaction") {
131
131
  addUsage(usage, entry.usage);
132
+ continue;
133
+ }
134
+ // Model work outside the conversation — today only cache warming
135
+ // (`kind: "cache_warm"`) — is recorded *only* as a usage entry: no
136
+ // assistant message, no tool result. Pi counts these in session
137
+ // totals (docs/session-format.md), so skipping them would under-report
138
+ // cost, tokens and the cache-hit rate against `/session`. Unknown
139
+ // kinds are counted like any other usage, per the same doc.
140
+ if (entry.type === "usage") {
141
+ addUsage(usage, entry.usage);
132
142
  }
133
143
  }
134
144
 
@@ -593,9 +603,24 @@ export default function statsFooter(pi: ExtensionAPI) {
593
603
  width,
594
604
  );
595
605
 
606
+ // Extension statuses set via ctx.ui.setStatus() are rendered by
607
+ // the built-in footer, which this custom footer replaces. Surface
608
+ // them on an optional third line so status segments from other
609
+ // extensions (background tasks, subagent runs) stay visible.
610
+ // Older hosts without getExtensionStatuses() keep the two lines.
611
+ const extensionStatusLine = joinSegments(
612
+ Array.from(footerData.getExtensionStatuses?.()?.values() ?? [])
613
+ .map((text) => text.trim())
614
+ .filter(Boolean),
615
+ separator,
616
+ );
617
+
596
618
  return [
597
619
  truncateSafe(statsLine, width, ""),
598
620
  truncateSafe(gitLine, width, ""),
621
+ ...(extensionStatusLine
622
+ ? [truncateSafe(extensionStatusLine, width, "")]
623
+ : []),
599
624
  ];
600
625
  } catch {
601
626
  // Footer rendering must never crash the TUI, even on very