@erichll/pi-statusline 0.4.1 → 0.6.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/CHANGELOG.md +80 -0
- package/README.md +152 -296
- package/examples/statusline.json +10 -1
- package/package.json +1 -1
- package/src/config.ts +14 -4
- package/src/index.ts +10 -3
- package/src/panel.ts +6 -6
- package/src/quota.ts +186 -0
- package/src/render.ts +75 -12
- package/src/runtime-render.ts +114 -41
- package/src/runtime.ts +25 -7
- package/src/session.ts +26 -5
- package/src/tools.ts +43 -0
- package/src/types.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0 - 2026-10-16
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add a tool activity row between the main line and the runtime row, shown
|
|
8
|
+
once the current run has used tools: `◐ bash npm test 12s · ✓ read ×5 ·
|
|
9
|
+
✗ bash ×1 · +2`. Up to two running tools show their target (shell command
|
|
10
|
+
without `cd`/env prefixes, file name, search pattern or directory) and timer;
|
|
11
|
+
same-name calls merge as `×N`. Completed (`✓`) and failed (`✗`) calls are
|
|
12
|
+
counted per run and kept in the last-run summary.
|
|
13
|
+
- Count nested calls (`parentToolCallId`) but represent them by their parent
|
|
14
|
+
while running. Calls ended by a user cancellation are not counted as failures.
|
|
15
|
+
- Add a `session` segment on the runtime row, enabled by default: the time
|
|
16
|
+
since the session was created (` 2h 6m`; `◷` in Unicode and `ses:` in ASCII
|
|
17
|
+
icon modes), to the minute and before session tokens. It is read once per
|
|
18
|
+
session from Pi's session header, survives reloads and resuming, restarts with
|
|
19
|
+
`/new` or a fork, and is hidden when the header time is missing or invalid.
|
|
20
|
+
Existing segment lists gain it before `tokens` unless they list it explicitly.
|
|
21
|
+
- Add `runtime.toolsMaxVisible` (1–8, default 4) for completed tool kinds shown
|
|
22
|
+
before `+N`, editable in the panel. Narrow rows fold kinds, then drop targets,
|
|
23
|
+
then timers.
|
|
24
|
+
- Label quota windows from the reported length (`x-codex-*-window-minutes`
|
|
25
|
+
headers and WebSocket `window_minutes`): `5h`, `1d`, `7d` or `30d` within 5%,
|
|
26
|
+
otherwise exact (`1h30m`). Without a reported length a window stays unlabeled
|
|
27
|
+
rather than guessed; a malformed length drops only the label.
|
|
28
|
+
- Add tool target, tool counting, window label, per-window color and session age
|
|
29
|
+
tests, and extend the offline PTY smoke with the tool row, completed counts
|
|
30
|
+
and session age.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Render quota as `5h ███░░░░░░░ 27% 4h8m · 7d ████░░░░░░ 44% 6d1h`: dim labels
|
|
35
|
+
and `·` separators, muted countdowns without brackets, and each window colored
|
|
36
|
+
by its own usage (accent, warning above 70%, error above 90%). An explicit
|
|
37
|
+
segment `color` still applies to both. Unlabeled windows keep their countdown
|
|
38
|
+
instead of their bar on narrow terminals.
|
|
39
|
+
- Restyle the runtime row and move it to the bottom of the footer. A run status
|
|
40
|
+
symbol (`●` running, `✓` done, `✗` failed, `⊘` cancelled) precedes the
|
|
41
|
+
duration in place of `Elapsed`; labels are dim and lowercase
|
|
42
|
+
(`avg 39 tok/s · cache 100% · 11 turns · 1 compaction`); cache is green from
|
|
43
|
+
80% and warning below 50%. ASCII mode uses `*`, `ok`, `x` and `-`.
|
|
44
|
+
- Keep average speed and cache visible while tools run or input is awaited.
|
|
45
|
+
`awaiting input`, `no content` and `compacting…` follow the duration in the
|
|
46
|
+
warning color; `no content` was previously muted.
|
|
47
|
+
- Move the session token total (`tokens`) from the main line to the runtime row,
|
|
48
|
+
before other extensions' statuses. It keeps its icon, color and enablement.
|
|
49
|
+
- `runtime.tools` now controls the tool row. Existing configurations with
|
|
50
|
+
`"tools": true` show it after upgrading; set it to `false` to hide it.
|
|
51
|
+
|
|
52
|
+
### Removed
|
|
53
|
+
|
|
54
|
+
- Remove `Tool X 3s` / `Tools N active` from the runtime row; the tool row
|
|
55
|
+
replaces them.
|
|
56
|
+
|
|
57
|
+
## 0.5.0 - 2026-10-14
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- Add Codex subscription Usage (`quota`) with primary/secondary progress bars,
|
|
62
|
+
used percentages and live reset countdowns. Passively observe SSE response
|
|
63
|
+
headers and native WebSocket `codex.rate_limits` events on Pi 1.2+, with no
|
|
64
|
+
extra requests or credential lookups. Existing statusline features retain
|
|
65
|
+
Pi 1.1 support.
|
|
66
|
+
- Enable quota after context by default, including in existing configurations
|
|
67
|
+
that omit it. Explicit quota settings preserve enablement and order;
|
|
68
|
+
the panel supports disabling, reordering and styling it.
|
|
69
|
+
- Use accent/warning/error colors at the 70%/90% usage thresholds, with ASCII
|
|
70
|
+
support and narrow-screen fallback to bars, percentages or hiding the segment.
|
|
71
|
+
- Hide missing, malformed and expired quota windows; replace snapshots rather
|
|
72
|
+
than merge credentials' data. Clear old samples on model/provider/API/endpoint
|
|
73
|
+
changes, reload, new session, footer disable and no-quota WebSocket streams.
|
|
74
|
+
- Add quota parser, lifecycle, countdown and rendering tests, plus offline
|
|
75
|
+
regular/fullscreen PTY coverage for both headers and WebSocket events.
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- Simplify context bars from `[██░░░░░░░░]20%` to `██░░░░░░░░ 20%`.
|
|
80
|
+
- Condense the README around installation, configuration, quota setup and
|
|
81
|
+
statistics; link to the complete example configuration instead of duplicating it.
|
|
82
|
+
|
|
3
83
|
## 0.4.1 - 2026-10-13
|
|
4
84
|
|
|
5
85
|
- Upgrade the Pi 1.2.0 development baseline (`pi-ai`, `pi-coding-agent`,
|
package/README.md
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
1
|
# @erichll/pi-statusline
|
|
2
2
|
|
|
3
|
-
A configurable
|
|
3
|
+
A configurable native Pi footer with Git status, session usage, runtime/tool
|
|
4
|
+
activity and live configuration preview. Leaves the editor intact.
|
|
4
5
|
|
|
5
6
|
```text
|
|
6
|
-
Example model(high)
|
|
7
|
-
|
|
7
|
+
Example model(high) █░░░░░░░░░ 11.9% pi-packages main ● *2 ↑2
|
|
8
|
+
◐ bash npm test 12s · ✓ read ×5 · ✓ edit ×2
|
|
9
|
+
● 5m 42s · avg 45 tok/s · cache 86% · 3 turns · 1 compaction · 2h 6m · 49.4k
|
|
8
10
|
```
|
|
9
11
|
|
|
12
|
+
Rows, top to bottom: the main segments, tool activity for the current run
|
|
13
|
+
(only once it has used tools), then run status, run metrics, session age and
|
|
14
|
+
tokens, and other extensions' statuses.
|
|
15
|
+
|
|
10
16
|
## Install
|
|
11
17
|
|
|
12
18
|
```sh
|
|
13
19
|
pi install npm:@erichll/pi-statusline
|
|
14
20
|
```
|
|
15
21
|
|
|
16
|
-
Requires Node.js >=22.19
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
other
|
|
20
|
-
|
|
21
|
-
extension in `pi config` before enabling this one.
|
|
22
|
-
|
|
23
|
-
## Local use
|
|
24
|
-
|
|
25
|
-
From this repository, try the extension for one invocation:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
npm install
|
|
29
|
-
pi --no-extensions --extension ./packages/pi-statusline/src/index.ts
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
`--no-extensions` disables other auto-discovered extensions for this invocation.
|
|
33
|
-
To use your other extensions, disable `pi-powerline-footer` in `pi config`
|
|
34
|
-
before starting Pi with `--extension ./packages/pi-statusline/src/index.ts`.
|
|
35
|
-
Only one extension should own the footer. The previous package can remain
|
|
36
|
-
installed for rollback. Loading this repository as a whole also discovers the
|
|
37
|
-
security extensions; use the statusline entrypoint to try it on its own.
|
|
38
|
-
|
|
39
|
-
This checkout is for development only. For a persistent install use the
|
|
40
|
-
published package, `npm:@erichll/pi-statusline`.
|
|
22
|
+
Requires Node.js >=22.19 and Pi >=1.1.0; subscription Usage requires Pi >=1.2.0.
|
|
23
|
+
Git is optional. The default Powerline layout requires a Nerd Font; choose
|
|
24
|
+
ASCII icons and plain separators for a font-independent layout.
|
|
25
|
+
Disable other footer extensions in `pi config`: only one should own the footer.
|
|
26
|
+
No extra network requests or credential lookups are made.
|
|
41
27
|
|
|
42
28
|
## Commands
|
|
43
29
|
|
|
@@ -46,292 +32,162 @@ published package, `npm:@erichll/pi-statusline`.
|
|
|
46
32
|
| `/statusline` | Open configuration and live preview |
|
|
47
33
|
| `/statusline on` | Enable for this session |
|
|
48
34
|
| `/statusline off` | Restore Pi's native footer for this session |
|
|
49
|
-
| `/statusline reload` | Reload saved configuration
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
the no-content threshold.
|
|
56
|
-
**Restore defaults in preview** changes only the draft until saved.
|
|
57
|
-
Preview uses the real footer renderer and current session data, or clearly
|
|
58
|
-
labelled example data for an empty session. A save error leaves the active
|
|
59
|
-
configuration unchanged and keeps the panel open.
|
|
35
|
+
| `/statusline reload` | Reload saved configuration |
|
|
36
|
+
|
|
37
|
+
In the panel: arrows navigate, Space toggles, Alt+Up/Down reorders segments,
|
|
38
|
+
Enter edits, and Esc backs out or cancels. **Save and apply globally** persists
|
|
39
|
+
changes; **Restore defaults in preview** only changes the draft until saved.
|
|
40
|
+
Thinking settings are under **model**; runtime settings are under **Runtime options**.
|
|
60
41
|
|
|
61
42
|
## Configuration
|
|
62
43
|
|
|
63
|
-
Settings
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
existing file to the new path before running `/reload`; the old path is no longer read.
|
|
44
|
+
Settings are global, stored at
|
|
45
|
+
`~/.pi/agent/extensions/pi-statusline/config.json` (`PI_CODING_AGENT_DIR` is
|
|
46
|
+
respected). After manual edits, run `/statusline reload`; after source edits,
|
|
47
|
+
run Pi's `/reload` instead. The old `~/.pi/agent/statusline.json` path is no
|
|
48
|
+
longer read—move an existing file to the new location when upgrading.
|
|
49
|
+
|
|
50
|
+
Use the panel or start with a partial configuration:
|
|
71
51
|
|
|
72
52
|
```json
|
|
73
53
|
{
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"pathMode": "basename",
|
|
80
|
-
"modelDisplay": "name",
|
|
81
|
-
"contextDisplay": "bar",
|
|
82
|
-
"spacing": 1,
|
|
83
|
-
"segments": [
|
|
84
|
-
{
|
|
85
|
-
"id": "model",
|
|
86
|
-
"enabled": true
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"id": "thinking",
|
|
90
|
-
"enabled": true
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"id": "context",
|
|
94
|
-
"enabled": true
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"id": "directory",
|
|
98
|
-
"enabled": true
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"id": "git",
|
|
102
|
-
"enabled": true
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"id": "cost",
|
|
106
|
-
"enabled": false
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"id": "input",
|
|
110
|
-
"enabled": false
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
"id": "output",
|
|
114
|
-
"enabled": false
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"id": "tokens",
|
|
118
|
-
"enabled": true
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"id": "cacheRead",
|
|
122
|
-
"enabled": false
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"id": "cacheWrite",
|
|
126
|
-
"enabled": false
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
"id": "statuses",
|
|
130
|
-
"enabled": true
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
"runtime": {
|
|
134
|
-
"enabled": true,
|
|
135
|
-
"status": true,
|
|
136
|
-
"tools": true,
|
|
137
|
-
"noContent": true,
|
|
138
|
-
"noContentSeconds": 10,
|
|
139
|
-
"avg": true,
|
|
140
|
-
"cache": true,
|
|
141
|
-
"counts": true,
|
|
142
|
-
"retainSummary": true
|
|
143
|
-
}
|
|
54
|
+
"icons": "ascii",
|
|
55
|
+
"separator": "pipe",
|
|
56
|
+
"modelDisplay": "last",
|
|
57
|
+
"contextDisplay": "text",
|
|
58
|
+
"spacing": 0
|
|
144
59
|
}
|
|
145
60
|
```
|
|
146
61
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
even when a display name is configured. For example, `provider/a/b/c/d` becomes `d`.
|
|
160
|
-
Restoring defaults resets this preference to `name`.
|
|
161
|
-
- Context display: `bar` (default, `[██░░░░░░░░]20%`) or `text`
|
|
162
|
-
(`12.7k/272k(4.7%)`). Choose **Context display: bar** in the panel or set
|
|
163
|
-
`"contextDisplay": "bar"`.
|
|
164
|
-
The ten-cell bar uses whole blocks to avoid gaps inside partial glyphs. Fill
|
|
165
|
-
rounds to the nearest cell, with at least one filled cell for non-zero usage;
|
|
166
|
-
the percentage retains the more precise value. ASCII mode uses `#` and `-`.
|
|
167
|
-
Unknown usage shows `[??????????]?%`; values above 100% fill
|
|
168
|
-
the bar completely and retain the reported percentage. Both modes use the
|
|
169
|
-
existing context warning colors. Text mode includes token counts and capacity;
|
|
170
|
-
bar mode shows progress and percentage.
|
|
171
|
-
- Spacing: `1` (default), `0`, `2` or `3` blank lines above the statusline.
|
|
172
|
-
Pi renders the footer directly under the editor, so this is the only supported
|
|
173
|
-
way to add breathing room between the input box and the statusline; the editor's
|
|
174
|
-
own bottom border cannot be removed. Choose **Spacing above statusline** in the
|
|
175
|
-
panel or set `"spacing": 0` for a flush footer.
|
|
176
|
-
- `segments`: optional ordered array of `{ id, enabled, icon?, color?, iconColor?, background? }`.
|
|
177
|
-
An explicit list is authoritative: omitted segments are disabled but remain
|
|
178
|
-
available in the panel. The `statuses` segment always occupies the second row.
|
|
179
|
-
Preset layouts place context immediately after the model, before directory
|
|
180
|
-
and Git. Explicit saved segment order is respected and can be changed in the panel.
|
|
181
|
-
- Thinking is appended to the model as `(level)`, with no separate icon or
|
|
182
|
-
separator. In the panel, edit **model → Thinking level / Thinking color**.
|
|
183
|
-
The existing `thinking` configuration entry controls suffix enablement and an
|
|
184
|
-
optional color override; its position, icon and background are ignored. It
|
|
185
|
-
does not render on its own when the model is hidden or non-reasoning.
|
|
186
|
-
By default, `off`, `minimal`, `low`, and `medium` use their respective Pi theme
|
|
187
|
-
colors; `high`, `xhigh`, and `max` use a fixed violet/pink/orange/yellow/green/cyan/blue
|
|
188
|
-
palette independent of the Pi theme, distributed across the available characters.
|
|
189
|
-
The color or rainbow covers the entire `(level)`, including parentheses, and
|
|
190
|
-
the model's background covers the whole item.
|
|
191
|
-
- Icon `""` hides a glyph. In the panel, enter `:default` to restore its default.
|
|
192
|
-
Color fields accept `#RRGGBB` or `text`, `accent`, `muted`, `dim`, `success`,
|
|
193
|
-
`warning`, `error`, `border`, `borderAccent`, `borderMuted`, and Pi's
|
|
194
|
-
`thinkingOff/Minimal/Low/Medium/High/Xhigh/Max` tokens. Empty color input in the
|
|
195
|
-
panel restores the default. Explicit colors override automatic warning colors.
|
|
62
|
+
See [examples/statusline.json](examples/statusline.json) for the complete defaults.
|
|
63
|
+
|
|
64
|
+
| Setting | Values (default first) |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `enabled` | `true`, `false` (startup enablement) |
|
|
67
|
+
| `preset` | `powerline` only; colors adapt to Pi's light/dark theme |
|
|
68
|
+
| `icons` | `nerd`, `unicode`, `ascii` |
|
|
69
|
+
| `separator` | `powerline`, `pipe`, `dot`, `space` |
|
|
70
|
+
| `pathMode` | `basename`, `abbreviated`, `full` |
|
|
71
|
+
| `modelDisplay` | `name` (display name/ID), `last` (final model ID component) |
|
|
72
|
+
| `contextDisplay` | `bar` (`██░░░░░░░░ 20%`), `text` (`12.7k/272k(4.7%)`) |
|
|
73
|
+
| `spacing` | `1`, `0`, `2`, `3` blank lines above the footer |
|
|
196
74
|
|
|
197
75
|
Available segments:
|
|
198
76
|
|
|
199
77
|
| ID | Data | Default |
|
|
200
78
|
| --- | --- | --- |
|
|
201
|
-
| `model` |
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `directory` | Current
|
|
205
|
-
| `git` | Branch,
|
|
206
|
-
| `
|
|
207
|
-
| `tokens` | Cumulative
|
|
208
|
-
| `
|
|
209
|
-
| `cacheRead`, `cacheWrite` |
|
|
210
|
-
| `statuses` | Other extensions'
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
filenames containing newlines are supported. Disabling the Git segment stops
|
|
302
|
-
its polling.
|
|
303
|
-
|
|
304
|
-
Rendering performs no file reads, Git queries or full-session scans. Streaming
|
|
305
|
-
refresh requests are coalesced to 100 ms. Narrow terminals shorten model/path
|
|
306
|
-
labels, then hide cost, cache/token counters, the thinking suffix, Git and directory in
|
|
307
|
-
that order, retaining model/context where possible. The secondary status row
|
|
308
|
-
drops extension text and cache/rate first, preserving
|
|
309
|
-
leading Elapsed and compaction status where possible, then truncates by terminal
|
|
310
|
-
cell width. Reload, session replacement, disabling and shutdown
|
|
311
|
-
release timers and subscriptions. RPC, JSON and print mode do not install UI
|
|
312
|
-
components or start polling.
|
|
313
|
-
|
|
314
|
-
## Development and rollback
|
|
79
|
+
| `model`, `thinking` | Model and colored `(level)` suffix | On |
|
|
80
|
+
| `context` | Current context usage | On |
|
|
81
|
+
| `quota` | Subscription Usage and reset countdowns; hidden without data | On |
|
|
82
|
+
| `directory` | Current directory | On |
|
|
83
|
+
| `git` | Branch, dirty/conflict state, staged/unstaged/untracked counts, ahead/behind | On |
|
|
84
|
+
| `session` | Time since the session was created, on the bottom row | On |
|
|
85
|
+
| `tokens` | Cumulative session tokens, on the bottom row | On |
|
|
86
|
+
| `cost` | Pi-recorded cumulative USD cost | Off |
|
|
87
|
+
| `input`, `output`, `cacheRead`, `cacheWrite` | Individual session token counters | Off |
|
|
88
|
+
| `statuses` | Other extensions' text, at the end of the bottom row | On |
|
|
89
|
+
|
|
90
|
+
`segments` is an ordered array of
|
|
91
|
+
`{ id, enabled, icon?, color?, iconColor?, background? }`. Omitted segments are
|
|
92
|
+
disabled, **except `quota` and `session`**: old configurations automatically
|
|
93
|
+
gain `quota` after `context` and `session` before `tokens` (or at the end when
|
|
94
|
+
the anchor is absent). To keep one off, include it with `"enabled": false`.
|
|
95
|
+
|
|
96
|
+
Colors accept `#RRGGBB` or supported Pi theme tokens such as `accent`, `muted`,
|
|
97
|
+
`success`, `warning` and `error`; explicit colors override automatic thresholds.
|
|
98
|
+
An empty icon hides it; enter `:default` in the panel to restore its default.
|
|
99
|
+
The `thinking` entry controls the model suffix, not a standalone segment.
|
|
100
|
+
|
|
101
|
+
Invalid configurations retain the last working settings and show a warning.
|
|
102
|
+
Removing the file restores defaults on reload; panel saves are atomic.
|
|
103
|
+
|
|
104
|
+
## Subscription Usage (Pi 1.2+)
|
|
105
|
+
|
|
106
|
+
Codex quota appears after context when valid data is available:
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
█░░░░░░░░░ 4.6% 5h ████░░░░░░ 40% 3h3m · 7d ██░░░░░░░░ 21% 4d9h
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Bars show **used** percentages for the primary and secondary windows, with live
|
|
113
|
+
reset countdowns. Labels come from the reported window length (`5h`, `1d`,
|
|
114
|
+
`7d`, `30d` within 5%, otherwise exact such as `1h30m`); without one, the
|
|
115
|
+
window is unlabeled rather than guessed. Each window is colored on its own:
|
|
116
|
+
Pi's accent, warning above 70% and error above 90%; a segment `color` overrides
|
|
117
|
+
both. Narrow terminals omit countdowns, then bars, then the segment rather than
|
|
118
|
+
truncate a window; an unlabeled window keeps its countdown instead of its bar.
|
|
119
|
+
|
|
120
|
+
Data is observed passively through Pi's provider events:
|
|
121
|
+
|
|
122
|
+
- **SSE:** `x-codex-{primary,secondary}-{used-percent,reset-at,window-minutes}` response headers.
|
|
123
|
+
CLIProxyAPI needs `requests.passthrough-headers: true`.
|
|
124
|
+
- **WebSocket:** native `codex.rate_limits` events with numeric `used_percent`,
|
|
125
|
+
`reset_at` and optional `window_minutes` in `rate_limits.primary` / `secondary`. Other named metered
|
|
126
|
+
buckets are ignored. The proxy must forward these events.
|
|
127
|
+
|
|
128
|
+
For CLIProxyAPI v8.0.28, each eligible Codex credential needs `websockets: true`
|
|
129
|
+
for the **proxy-to-upstream** WebSocket leg. A downstream WebSocket alone is
|
|
130
|
+
not enough: upstream SSE headers do not become quota frames. This setting is
|
|
131
|
+
separate from `ws-auth` and Pi's transport setting.
|
|
132
|
+
|
|
133
|
+
Missing, malformed or expired windows are hidden; a reported 0% remains visible.
|
|
134
|
+
Each response/event replaces the snapshot without merging credentials' windows.
|
|
135
|
+
Model/provider/API/endpoint changes, reload, new session and footer disable clear
|
|
136
|
+
old data. This is the responding upstream's quota, **not a proxy-pool aggregate**
|
|
137
|
+
or RPM/TPM rate limit.
|
|
138
|
+
|
|
139
|
+
## Statistics
|
|
140
|
+
|
|
141
|
+
- Context is Pi's current estimate, not cumulative consumption; unknown values
|
|
142
|
+
show `?`. Session totals include recorded usage across the whole session file,
|
|
143
|
+
including compaction and abandoned branches. Cost is Pi-reported, not an invoice.
|
|
144
|
+
- The bottom row starts with the run status (`●` running, `✓` done, `✗` failed,
|
|
145
|
+
`⊘` cancelled) and its duration, which spans retries, tools, UI waits and
|
|
146
|
+
compaction. `avg` is assistant output tokens / total run seconds, **not
|
|
147
|
+
inference speed**; `cache` is cache-read / (input + cache-read + cache-write),
|
|
148
|
+
green from 80% and warning below 50%. `turns` counts Pi turns, not upstream
|
|
149
|
+
requests; `compactions` counts successful session entries.
|
|
150
|
+
- The run duration (to the second) covers one run, from your message until the
|
|
151
|
+
agent settles, across all its turns. The session age (` 2h 6m`, to the
|
|
152
|
+
minute) counts from the session header's creation time: it survives reloads
|
|
153
|
+
and resuming, restarts with `/new` or a fork, and is hidden when the header
|
|
154
|
+
time is missing or invalid.
|
|
155
|
+
- `awaiting input` and `no content 10s` follow the duration while active. No
|
|
156
|
+
content means no non-empty text, reasoning or tool-call delta was observed; it
|
|
157
|
+
is not a server timeout and is suppressed during tools, UI waits and compaction.
|
|
158
|
+
- The tool row shows up to two running tools with what they work on (a shell
|
|
159
|
+
command without `cd`/env prefixes, a file name or a search pattern), merging
|
|
160
|
+
same-name calls as `×N`, then this run's completed (`✓`) and failed (`✗`)
|
|
161
|
+
counts. `toolsMaxVisible` (1–8, default 4) completed kinds show before `+N`.
|
|
162
|
+
Nested calls count but are represented by their parent while running; calls
|
|
163
|
+
ended by a cancellation are not failures. Narrow rows fold kinds, then drop
|
|
164
|
+
targets, then timers.
|
|
165
|
+
|
|
166
|
+
All runtime options default to enabled; `noContentSeconds` accepts 1–3600
|
|
167
|
+
(default 10). `tools: false` hides the tool row. `retainSummary` keeps the last run until the next one;
|
|
168
|
+
`runtime.enabled: false` hides local runtime metrics. Reload/new session resets
|
|
169
|
+
in-memory runtime summaries, not persisted session totals.
|
|
170
|
+
|
|
171
|
+
Extension statuses remain display-only; a plain `tps` status of `Elapsed …`
|
|
172
|
+
supplies the duration. Git updates asynchronously; no repository
|
|
173
|
+
hides the segment, and query failures show `?`. Narrow layouts prioritize model
|
|
174
|
+
and context. RPC, JSON and print mode do not install the footer or start polling.
|
|
175
|
+
|
|
176
|
+
## Development
|
|
177
|
+
|
|
178
|
+
From this repository, load only the statusline for one invocation:
|
|
315
179
|
|
|
316
180
|
```sh
|
|
181
|
+
npm install
|
|
182
|
+
pi --no-extensions --extension ./packages/pi-statusline/src/index.ts
|
|
183
|
+
|
|
317
184
|
npm run check --workspace @erichll/pi-statusline
|
|
318
185
|
npm test --workspace @erichll/pi-statusline
|
|
319
|
-
# Optional: POSIX PTY integration, using an offline simulated model
|
|
320
186
|
npm run smoke --workspace @erichll/pi-statusline
|
|
321
187
|
```
|
|
322
188
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
40-column layout, draft cancel/save, off/on, reload and new session. It writes
|
|
329
|
-
`/tmp/pi-statusline-pty-<layout>.log` for diagnosis. To roll back a persistent
|
|
330
|
-
installation, disable this extension in `pi config`, re-enable the previous
|
|
331
|
-
footer and reload Pi. `/statusline off` restores the native footer, not another
|
|
332
|
-
extension's editor or widgets.
|
|
333
|
-
|
|
334
|
-
The initial implementation is independently written, with design references to
|
|
335
|
-
[pi-powerline-footer](https://github.com/nicobailon/pi-powerline-footer).
|
|
336
|
-
|
|
337
|
-
MIT licensed.
|
|
189
|
+
The POSIX PTY smoke uses an offline provider in regular and fullscreen layouts.
|
|
190
|
+
For a persistent install, use the published npm package.
|
|
191
|
+
|
|
192
|
+
Independently implemented with design references to
|
|
193
|
+
[pi-powerline-footer](https://github.com/nicobailon/pi-powerline-footer). MIT licensed.
|
package/examples/statusline.json
CHANGED
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"id": "context",
|
|
22
22
|
"enabled": true
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"id": "quota",
|
|
26
|
+
"enabled": true
|
|
27
|
+
},
|
|
24
28
|
{
|
|
25
29
|
"id": "directory",
|
|
26
30
|
"enabled": true
|
|
@@ -41,6 +45,10 @@
|
|
|
41
45
|
"id": "output",
|
|
42
46
|
"enabled": false
|
|
43
47
|
},
|
|
48
|
+
{
|
|
49
|
+
"id": "session",
|
|
50
|
+
"enabled": true
|
|
51
|
+
},
|
|
44
52
|
{
|
|
45
53
|
"id": "tokens",
|
|
46
54
|
"enabled": true
|
|
@@ -67,6 +75,7 @@
|
|
|
67
75
|
"avg": true,
|
|
68
76
|
"cache": true,
|
|
69
77
|
"counts": true,
|
|
70
|
-
"retainSummary": true
|
|
78
|
+
"retainSummary": true,
|
|
79
|
+
"toolsMaxVisible": 4
|
|
71
80
|
}
|
|
72
81
|
}
|