pi-status-footer 1.0.7 β 1.1.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 +48 -75
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,107 +1,80 @@
|
|
|
1
1
|
# pi-status-footer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compact two-line status footer for the pi TUI: context usage, tokens, cost, live TPS, git diff, and run timers.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
See [pi.dev docs](https://pi.dev) for how extensions work.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## What's included
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
**Line 1 β Stats & timers:** context window usage with color-coded fullness (green < 60%, yellow < 80%, red β₯ 80%), cache hit rate, input/output tokens, session cost with the current run's cost (π°), tokens per second (live while streaming), agent run timer (β³), current turn timer (π¬).
|
|
15
|
-
|
|
16
|
-
**Line 2 β Project & model:** repo folder name, git branch, live working-tree diff from HEAD (+N added lines, -M deleted), provider/model, thinking level with themed color.
|
|
17
|
-
|
|
18
|
-
Everything auto-fits to your terminal width. Line 1 always keeps every segment (it clips only on very narrow terminals). On line 2 the model is mandatory: the model id is shortened from the left, keeping the provider and thinking level intact β only if even that can't fit does the folder/git group drop off.
|
|
19
|
-
|
|
20
|
-
## Features
|
|
9
|
+
| Extension | Command / shortcut | What it does |
|
|
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 |
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
- **Live TPS** β shows tokens/second during generation, stays visible between turns
|
|
24
|
-
- **Git awareness** β asynchronous, debounced `git diff --shortstat HEAD` so typing never blocks; branch changes detected automatically via `footerData.onBranchChange`
|
|
25
|
-
- **Cache hit rate** β percentage of prompt tokens served from cache
|
|
26
|
-
- **Cost, sum + delta** β session total with the current agent run's cost alongside it, at fixed precision (sum 3 decimals, delta 6) so the segment width never changes and no value is abbreviated into scientific notation; a fresh session shows a `$0.000` placeholder and models with no catalog pricing read `n/a` instead of a misleading `$0.00`
|
|
27
|
-
- **Context gauge** β percentage and raw max; shifts from green β yellow β red as you approach the limit
|
|
28
|
-
- **Thinking level** β color-coded to match pi's thinking theme
|
|
29
|
-
- **Responsive model id** β shortened from the left (with an `β¦` marker) when space is tight, so the provider and thinking level stay fully readable; the folder/git group drops only when the model still can't share the line
|
|
30
|
-
- **Line 1 never drops stats** β every stat segment always renders; on very narrow terminals the line clips instead
|
|
31
|
-
- **East Asian safe** β explicit ambiguous-width handling for CJK-friendly terminals
|
|
32
|
-
- **Safe at all times** β footer rendering never crashes the TUI, even on edge cases
|
|
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.
|
|
33
14
|
|
|
34
|
-
##
|
|
15
|
+
## Install
|
|
35
16
|
|
|
36
17
|
```bash
|
|
37
|
-
# Option 1: git (recommended, no npm account needed)
|
|
38
|
-
pi install git:github.com/kslamph/pi-status-footer@v1.0.0
|
|
39
|
-
|
|
40
|
-
# Option 2: npm
|
|
41
18
|
pi install npm:pi-status-footer
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
pi install /path/to/pi-status-footer
|
|
19
|
+
pi install git:github.com/kslamph/pi-status-footer
|
|
20
|
+
pi install ./pi-status-footer
|
|
45
21
|
```
|
|
46
22
|
|
|
47
|
-
|
|
23
|
+
Try without installing (one run only, nothing saved):
|
|
48
24
|
|
|
49
|
-
|
|
25
|
+
```bash
|
|
26
|
+
pi -e npm:pi-status-footer
|
|
27
|
+
pi -e ./stats-footer.ts
|
|
28
|
+
```
|
|
50
29
|
|
|
51
|
-
|
|
30
|
+
The footer appears automatically in the next TUI session.
|
|
52
31
|
|
|
53
|
-
|
|
54
|
-
|---|---|---|
|
|
55
|
-
| π¦context | `π¦ 38%/128k` | `ctx.getContextUsage()`, color-coded by percent |
|
|
56
|
-
| πΎcache | `πΎ 63%` | `cacheRead / (input + cacheRead + cacheWrite)` |
|
|
57
|
-
| βinput βoutput | `β5.2k β8.1k` | Session `usage.input / usage.output` (accumulated across all entries) |
|
|
58
|
-
| π° cost | `π° $0.420 +$0.020000` | Session sum of `usage.cost.total`, plus the current agent run's cost |
|
|
59
|
-
| β‘tps | `β‘42 t/s` | Live during generation; last completed rate shown between turns |
|
|
60
|
-
| β³ working | `β³ 4:32` | Elapsed time since `agent_start`, HH:MM:SS above 1h |
|
|
61
|
-
| π¬ turn | `π¬ 1:18` | Elapsed time since last `turn_start` |
|
|
32
|
+
## Usage
|
|
62
33
|
|
|
63
|
-
|
|
34
|
+
Just run `pi` in the TUI. Example footer:
|
|
64
35
|
|
|
65
|
-
|
|
36
|
+
```
|
|
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
|
+
```
|
|
66
40
|
|
|
67
|
-
|
|
68
|
-
|---|---|---|
|
|
69
|
-
| π repo | `π my-project` | Git repo root basename (from `ctx.cwd` walk-up) |
|
|
70
|
-
| βΈ ξ₯ branch | `βΈ ξ₯ main` | `footerData.getGitBranch()`, auto-updates |
|
|
71
|
-
| +N -M diff | `+3 -1` | Async `git diff --shortstat HEAD` (1s debounced) |
|
|
72
|
-
| π€ model | `π€ openai/gpt-4o` | `ctx.model.provider / ctx.model.id`, id shortened from the left when narrow |
|
|
73
|
-
| π thinking | `π high` | `ctx.thinkingLevel`, themed via `theme.fg()` |
|
|
41
|
+
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.
|
|
74
42
|
|
|
75
|
-
##
|
|
43
|
+
## Configuration
|
|
76
44
|
|
|
77
|
-
|
|
45
|
+
Zero config. No env vars, no settings keys.
|
|
78
46
|
|
|
79
|
-
|
|
80
|
-
- **`agent_start` / `agent_settled`** β controls the agent-run timer and a 1-second interval that triggers git diff refresh; also samples the session cost at `agent_start` as the baseline for the run's cost delta
|
|
81
|
-
- **`turn_start` / `turn_end`** β drives the per-turn timer. It deliberately does *not* touch the cost baseline: see the cost notes above.
|
|
82
|
-
- **`message_start` / `message_update` / `message_end`** β tracks the generation window for live TPS. Most providers only report output-token usage at message end, so `message_update` estimates tokens live from the streamed delta characters (text/thinking/toolcall), calibrated against each message's real usage at `message_end`
|
|
83
|
-
- **`model_select`** β clears stale TPS on model switch
|
|
84
|
-
- **`session_shutdown`** β cleans up all state
|
|
47
|
+
## Security note
|
|
85
48
|
|
|
86
|
-
|
|
49
|
+
Runs in-process with your OS permissions. It reads session entries (token usage, cost, model, context) and runs one shell command, debounced to 1s during agent runs: `git diff --shortstat HEAD` (with `--no-optional-locks`, 3s timeout) plus a walk-up check for `.git` to find the repo root. No network access, no file writes.
|
|
87
50
|
|
|
88
|
-
##
|
|
51
|
+
## Update / remove / enable-disable
|
|
89
52
|
|
|
90
|
-
|
|
91
|
-
|
|
53
|
+
```bash
|
|
54
|
+
pi update --extensions # update all packages
|
|
55
|
+
pi update npm:pi-status-footer
|
|
56
|
+
pi remove pi-status-footer
|
|
57
|
+
pi list
|
|
58
|
+
pi config # enable/disable resources
|
|
59
|
+
```
|
|
92
60
|
|
|
93
|
-
##
|
|
61
|
+
## Compatibility
|
|
94
62
|
|
|
95
|
-
|
|
63
|
+
- Peer deps: `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, `@earendil-works/pi-tui` (any version with `ctx.ui.setFooter`)
|
|
64
|
+
- TODO: confirm exact tested Pi version and OS coverage (developed on Linux)
|
|
96
65
|
|
|
97
|
-
|
|
66
|
+
## Development
|
|
98
67
|
|
|
99
68
|
```bash
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
69
|
+
git clone https://github.com/kslamph/pi-status-footer.git
|
|
70
|
+
cd pi-status-footer
|
|
71
|
+
pi install ./ # local copy loads in place
|
|
72
|
+
pi -e ./stats-footer.ts # single run from inside the repo
|
|
73
|
+
npm test # runs test-layout, test-live-tps, test-cost
|
|
103
74
|
```
|
|
104
75
|
|
|
105
|
-
|
|
76
|
+
No build step; pi loads the TypeScript file directly. Optional typecheck: install the peer deps as devDependencies, then `npx tsc --noEmit stats-footer.ts`.
|
|
77
|
+
|
|
78
|
+
## License + credits
|
|
106
79
|
|
|
107
|
-
MIT β see [LICENSE](./LICENSE).
|
|
80
|
+
MIT β see [LICENSE](./LICENSE). Footer demo image: `docs/footer-demo.png`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-status-footer",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|