rinco-pi-hud 1.5.0 → 1.6.1

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.
Files changed (39) hide show
  1. package/NOTICE +6 -1
  2. package/README.md +26 -21
  3. package/assets/readme/hero.svg +1 -1
  4. package/assets/readme/responsive.svg +4 -5
  5. package/docs/CONTRIBUTING.md +11 -2
  6. package/docs/README.zh-CN.md +26 -21
  7. package/docs/footer.md +163 -17
  8. package/docs/upstream-zentui.md +81 -0
  9. package/extensions/hud/ZENTUI-LICENSE +21 -0
  10. package/extensions/hud/commands/settings-controller.ts +8 -2
  11. package/extensions/hud/commands/settings.ts +104 -25
  12. package/extensions/hud/config/config-counts.ts +0 -3
  13. package/extensions/hud/config/config.ts +3 -0
  14. package/extensions/hud/config/normalize.ts +42 -6
  15. package/extensions/hud/config/persist.ts +47 -4
  16. package/extensions/hud/config/schema.ts +25 -7
  17. package/extensions/hud/footer/compact.ts +160 -0
  18. package/extensions/hud/footer/custom-values.ts +83 -0
  19. package/extensions/hud/footer/demand.ts +32 -0
  20. package/extensions/hud/footer/format.ts +152 -10
  21. package/extensions/hud/footer/groups.ts +2 -6
  22. package/extensions/hud/footer/index.ts +133 -27
  23. package/extensions/hud/footer/render-labels.ts +3 -14
  24. package/extensions/hud/index.ts +103 -8
  25. package/extensions/hud/segments/custom-variables.ts +152 -0
  26. package/extensions/hud/segments/extension-status.ts +35 -15
  27. package/extensions/hud/segments/git.ts +37 -29
  28. package/extensions/hud/segments/live-metadata.ts +357 -0
  29. package/extensions/hud/segments/mcp-status.ts +23 -26
  30. package/extensions/hud/segments/project-state.ts +4 -0
  31. package/extensions/hud/segments/repository-root.ts +18 -0
  32. package/extensions/hud/session/event-handlers.ts +0 -8
  33. package/extensions/hud/session/footer-clock.ts +15 -20
  34. package/extensions/hud/state/index.ts +3 -1
  35. package/extensions/hud/state/project-controller.ts +7 -1
  36. package/extensions/hud/state/telemetry.ts +2 -44
  37. package/extensions/hud/telemetry/format.ts +13 -4
  38. package/extensions/hud/telemetry/optional.ts +183 -0
  39. package/package.json +1 -1
package/NOTICE CHANGED
@@ -4,7 +4,12 @@ License: MIT.
4
4
 
5
5
  This package contains a dynamic HUD footer for Pi, adapted from the Footer
6
6
  portion of pi-zentui by Luka: https://github.com/lmilojevicc/pi-zentui
7
- License: MIT.
7
+ Footer integration snapshot: version 0.32.0, commit
8
+ 9e8e798cfcce26cee9e1def4daf3668616482610.
9
+ Adapted modules include template joining/compact layout, custom values,
10
+ repository paths, optional telemetry, and passive live metadata.
11
+ License: MIT. The original copyright and license text is retained at
12
+ extensions/hud/ZENTUI-LICENSE.
8
13
 
9
14
  Session, model, activity, MCP, configuration-count, and Codex subscription
10
15
  status capabilities are adapted from pi-shannon-statusline by RealAlexandreAI:
package/README.md CHANGED
@@ -26,7 +26,7 @@ Requires Pi **1.3.0 or newer within the 1.x release line**. Development and CI d
26
26
  pi install npm:rinco-pi-hud
27
27
  ```
28
28
 
29
- Restart Pi afterwards, or run `/reload`. The footer is enabled by default and `/zentui` opens the settings UI.
29
+ Restart Pi afterwards, or run `/reload`. The footer is enabled by default and `/hud` opens the settings UI.
30
30
 
31
31
  From GitHub, or from a local checkout:
32
32
 
@@ -44,29 +44,32 @@ pi install "$PWD"
44
44
  > Pi extensions run with your user permissions. Review the source before installing any third-party extension.
45
45
 
46
46
  > [!NOTE]
47
- > Truecolor and 256-color terminals are supported; explicit RGB colors use Pi's terminal-capability-aware encoder. The screenshot above renders with ASCII icon mode; `/zentui` switches between the `auto`, `nerd`, and `ascii` glyph sets.
47
+ > Truecolor and 256-color terminals are supported; explicit RGB colors use Pi's terminal-capability-aware encoder. The screenshot above renders with ASCII icon mode; `/hud` switches between the `auto`, `nerd`, and `ascii` glyph sets.
48
48
 
49
49
  ## Commands
50
50
 
51
51
  | Command | Effect |
52
52
  | --- | --- |
53
- | `/zentui` | Settings UI: rows, segments, separator, icons, colors, templates |
54
- | `/zentui statusline enable\|disable\|toggle` | Show or hide the whole footer |
55
- | `/zentui row project\|session\|activity\|usage <enable\|disable\|toggle>` | Turn one row on or off |
56
- | `/zentui format "<template>"` | Replace the four rows with a single-line template |
53
+ | `/hud` | Settings UI: rows, segments, separator, icons, colors, templates |
54
+ | `/hud statusline enable\|disable\|toggle` | Show or hide the whole footer |
55
+ | `/hud row project\|session\|activity\|usage <enable\|disable\|toggle>` | Turn one row on or off |
56
+ | `/hud format "<template>"` | Replace the four rows with a single-line template |
57
+ | `/hud compact-format "<template>"` | Opt into a wrapped template below 80 columns; `clear` removes it |
58
+ | `/hud footer hud\|hidden\|native` | Four-group/template HUD, statuses only, or Pi’s native footer |
59
+ | `/hud layout\|segments\|extensions` | Open a settings section directly |
57
60
  | `/codex-status` | Print Codex subscription usage and rate-limit windows |
58
61
  | `/usage-refresh` | Refresh the model usage or balance shown in the footer |
59
62
 
60
63
  ## What it shows
61
64
 
62
- | Row | Segments, each with its own switch under **Built-in segments** in `/zentui` |
65
+ | Row | Segments, each with its own switch under **Built-in segments** in `/hud` |
63
66
  | --- | --- |
64
67
  | **Project** | directory, git branch, commit and tag, working-tree status, operation state (`MERGING`, `REBASING`, …), diff metrics, runtime, package version, OS, user |
65
- | **Session** | session name, provider and model, thinking level, turn count, duration |
66
- | **Activity** | running tools, completed tool counts, active agents, `Agent idle`, skills, MCP servers |
67
- | **Usage** | context window with a gauge, input and output tokens, cache read/write volume and hit rate, cost, model quota, clock |
68
+ | **Session** | session name, provider and model, thinking level, turn count, duration, clock |
69
+ | **Activity** | running tools, completed tool counts, skills, MCP servers |
70
+ | **Usage** | context window with a gauge, input and output tokens, cache read/write volume and hit rate, cost, model quota |
68
71
 
69
- Rows are toggled with `/zentui row usage disable`; the segments inside them have individual switches in the same UI. Existing configs that used the former aggregate `tokens`, `toolActivity`, or `agentActivity` switches are migrated automatically.
72
+ Rows are toggled with `/hud row usage disable`; the segments inside them have individual switches in the same UI. Existing configs that used the former aggregate `tokens` or `toolActivity` switches are migrated automatically.
70
73
 
71
74
  ### Model quota
72
75
 
@@ -89,18 +92,20 @@ Groups wrap only at segment boundaries. A continuation line realigns under the s
89
92
  Set a template for a single-line footer instead of the four groups:
90
93
 
91
94
  ```text
92
- /zentui format "$cwd( $git_branch)$fill($context)( $tokens)( $cost)"
95
+ /hud format "$cwd( $git_branch)$fill($context)( $tokens)( $cost)"
93
96
  ```
94
97
 
95
- Variables accept `$name` or `${name}`. The [footer reference](docs/footer.md) lists all of them, along with the aliases (`$directory`, `$status`, `$codex`, …). Run `/zentui format` with no argument, or `/zentui format clear`, to go back to the four groups.
98
+ Variables accept `$name` or `${name}`. The [footer reference](docs/footer.md) lists all of them, along with the aliases (`$directory`, `$status`, `$codex`, …). Run `/hud format` with no argument, or `/hud format clear`, to go back to the four groups.
96
99
 
97
100
  ## Configuration
98
101
 
99
- `/zentui` writes to `~/.pi/agent/rinco-pi-hud.json` and applies changes immediately. It covers the separator style, icon mode (`nerd`, `ascii`, or `auto`), footer colors (Pi theme tokens or terminal palette styles), context rendering (text, gauge, or both), the project refresh interval, and third-party extension statuses with their own placement and color mode.
102
+ The HUD uses `/hud`; `/zentui` is reserved for the original Zentui package. There is no legacy command alias. See [Using with Zentui](docs/footer.md#using-with-the-original-zentui) for component separation.
100
103
 
101
- Footer colors follow the active Pi theme by default, including theme switches and automatic light/dark changes. In `/zentui`, **Footer colors → theme** enables this behavior; **terminal** keeps the original Sakura RGB palette. Explicit custom colors (hex, indexed, or `fg:`/`bg:` styles) remain fixed in either mode. Remove those entries from `colors` to restore automatic theme colors.
104
+ `/hud` writes to `~/.pi/agent/rinco-pi-hud.json` and applies changes immediately. It covers the separator style, icon mode (`nerd`, `ascii`, or `auto`), footer colors (Pi theme tokens or terminal palette styles), context rendering (text, gauge, or both), the project refresh interval, and third-party extension statuses with their own placement and color mode.
102
105
 
103
- See [docs/footer.md](docs/footer.md) for the full variable and segment reference.
106
+ Footer colors follow the active Pi theme by default, including theme switches and automatic light/dark changes. In `/hud`, **Footer colors → theme** enables this behavior; **terminal** keeps the original Sakura RGB palette. Explicit custom colors (hex, indexed, or `fg:`/`bg:` styles) remain fixed in either mode. Remove those entries from `colors` to restore automatic theme colors.
107
+
108
+ Footer features are adapted from Zentui **0.32.0**, without installing its editor, messages, working line, tool display, or OMP adapter. New opt-in features include repository-relative paths, `$join_sep`, compact templates, extension-published values, safe status hyperlinks, PR/CI metadata, and average token rate. Defaults and existing configurations remain unchanged. See [docs/upstream-zentui.md](docs/upstream-zentui.md) for the exact snapshot and integration boundaries, and [docs/footer.md](docs/footer.md) for configuration and examples.
104
109
 
105
110
  ## Project contents
106
111
 
@@ -113,11 +118,11 @@ See [docs/footer.md](docs/footer.md) for the full variable and segment reference
113
118
  | [`extensions/hud/telemetry/`](extensions/hud/telemetry/format.ts) | Usage formatting, provider balance probes, and the Codex subscription client |
114
119
  | [`extensions/hud/session/`](extensions/hud/session/) | Pi event registration, session lifecycle, and live context overlay |
115
120
  | [`extensions/hud/state/`](extensions/hud/state/) | Aggregated state, telemetry reducer, and project refresh controller |
116
- | [`extensions/hud/commands/`](extensions/hud/commands/settings.ts) | `/zentui` settings UI and configuration controller |
121
+ | [`extensions/hud/commands/`](extensions/hud/commands/settings.ts) | `/hud` settings UI and configuration controller |
117
122
  | [`extensions/hud/ui/`](extensions/hud/ui/) | Icons and terminal style utilities |
118
123
  | [`docs/footer.md`](docs/footer.md) | Complete footer configuration reference |
119
124
  | [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md) | Local development, testing guidance, and pull request checklist |
120
- | [`tests/`](tests/) | Vitest suite: footer layout, telemetry, provider balances, MCP configuration counts |
125
+ | [`tests/`](tests/) | Vitest suite: footer layout, telemetry, provider balances, MCP runtime tool counts |
121
126
 
122
127
  ## Development
123
128
 
@@ -152,19 +157,19 @@ Confirm Pi is running in TUI mode rather than headless, JSON, or print mode. The
152
157
  <details>
153
158
  <summary>The layout looks wrong in a narrow terminal</summary>
154
159
 
155
- The footer measures the terminal and wraps at segment boundaries, so narrow windows show fewer segments per line. Set a `footerFormat` template, or disable low-priority segments in `/zentui`.
160
+ The footer measures the terminal and wraps at segment boundaries, so narrow windows show fewer segments per line. Set a `footerFormat` template, or disable low-priority segments in `/hud`.
156
161
  </details>
157
162
 
158
163
  <details>
159
164
  <summary>Colors look incorrect</summary>
160
165
 
161
- The default palette follows the active Pi theme. If the footer still uses fixed colors, select **Footer colors → theme** in `/zentui` and remove explicit color overrides from `~/.pi/agent/rinco-pi-hud.json`. Third-party statuses set to `original` retain their own colors. Truecolor and 256-color output follow Pi's detected terminal capabilities.
166
+ The default palette follows the active Pi theme. If the footer still uses fixed colors, select **Footer colors → theme** in `/hud` and remove explicit color overrides from `~/.pi/agent/rinco-pi-hud.json`. Third-party statuses set to `original` retain their own colors. Truecolor and 256-color output follow Pi's detected terminal capabilities.
162
167
  </details>
163
168
 
164
169
  <details>
165
170
  <summary>Icons are missing or misaligned</summary>
166
171
 
167
- Unicode and Nerd Font glyphs vary between terminals and fonts. Install a Nerd Font, or switch to ASCII icons in `/zentui`.
172
+ Unicode and Nerd Font glyphs vary between terminals and fonts. Install a Nerd Font, or switch to ASCII icons in `/hud`.
168
173
  </details>
169
174
 
170
175
  ## License
@@ -15,7 +15,7 @@
15
15
 
16
16
  <text x="80" y="260" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#f2a7c6" font-weight="700">Project</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#f2a7c6" font-weight="700">rinco-pi-hud</tspan><tspan fill="#716879"> › </tspan><tspan>on </tspan><tspan fill="#c7b8f5" font-weight="700">*</tspan><tspan> </tspan><tspan fill="#c7b8f5" font-weight="700">main</tspan><tspan fill="#716879"> › </tspan><tspan fill="#9fd3f2">via</tspan><tspan> </tspan><tspan fill="#AEE5C5" font-weight="700">node v24.18.0</tspan><tspan fill="#716879"> › </tspan><tspan fill="#f7eef8">linux</tspan></text>
17
17
  <text x="80" y="290" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#9fd3f2">Session</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#9fd3f2">deepseek/deepseek-flash</tspan><tspan fill="#716879"> › </tspan><tspan fill="#efc3e6">Thinking level: max</tspan><tspan fill="#716879"> › </tspan><tspan fill="#efc3e6">Turn 3</tspan></text>
18
- <text x="80" y="320" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#efc3e6">Activity</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">Tool read × 30 write × 7 edit × 13 bash × 76</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">Agent idle</tspan></text>
18
+ <text x="80" y="320" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#efc3e6">Activity</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">Tool read × 30 write × 7 edit × 13 bash × 76</tspan></text>
19
19
  <text x="80" y="350" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#aee5c5">Usage</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">[##--------] 17%/1.0M</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↑ 177k</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↓ 74k</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">R 10M</tspan><tspan> </tspan><tspan fill="#aee5c5">CH 99.8%</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5" font-weight="700">$ 0.204</tspan></text>
20
20
  </g>
21
21
  </svg>
@@ -14,14 +14,14 @@
14
14
  <line x1="194" y1="160" x2="194" y2="334" stroke="#716879" stroke-dasharray="3 5" opacity="0.55"/>
15
15
  <text x="80" y="190" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#f2a7c6" font-weight="700">Project</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#f2a7c6" font-weight="700">rinco-pi-hud</tspan><tspan fill="#716879"> › </tspan><tspan>on </tspan><tspan fill="#c7b8f5" font-weight="700">*</tspan><tspan> </tspan><tspan fill="#c7b8f5" font-weight="700">main</tspan><tspan fill="#716879"> › </tspan><tspan fill="#9fd3f2">via</tspan><tspan> </tspan><tspan fill="#AEE5C5" font-weight="700">node v24.18.0</tspan><tspan fill="#716879"> › </tspan><tspan fill="#f7eef8">linux</tspan></text>
16
16
  <text x="80" y="220" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#9fd3f2">Session</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#9fd3f2">deepseek/deepseek-flash</tspan><tspan fill="#716879"> › </tspan><tspan fill="#efc3e6">Thinking level: max</tspan><tspan fill="#716879"> › </tspan><tspan fill="#efc3e6">Turn 3</tspan></text>
17
- <text x="80" y="250" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#efc3e6">Activity</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">Tool read × 30 write × 7 edit × 13 bash × 76</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">Agent idle</tspan></text>
17
+ <text x="80" y="250" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#efc3e6">Activity</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">Tool read × 30 write × 7 edit × 13 bash × 76</tspan></text>
18
18
  <text x="80" y="280" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#aee5c5">Usage</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">[##--------] 17%/1.0M</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↑ 177k</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↓ 74k</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">R 10M</tspan><tspan> </tspan><tspan fill="#aee5c5">CH 99.8%</tspan></text>
19
19
  <text x="80" y="310" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5" font-weight="700">$ 0.204</tspan></text>
20
20
  </g>
21
21
  <g id="panel-56">
22
22
  <rect x="56" y="368" width="1088" height="298" rx="14" fill="#16131F" stroke="#2C2640"/>
23
23
  <text x="80" y="391" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="18" fill="#A99BAE">render(56)</text>
24
- <text x="1120" y="391" text-anchor="end" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="18" fill="#A99BAE">8 rows · continuations align</text>
24
+ <text x="1120" y="391" text-anchor="end" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="18" fill="#A99BAE">7 rows · continuations align</text>
25
25
  <line x1="56" y1="402" x2="1144" y2="402" stroke="#2C2640"/>
26
26
  <line x1="194" y1="402" x2="194" y2="666" stroke="#716879" stroke-dasharray="3 5" opacity="0.55"/>
27
27
  <text x="80" y="432" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#f2a7c6" font-weight="700">Project</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#f2a7c6" font-weight="700">rinco-pi-hud</tspan><tspan fill="#716879"> › </tspan><tspan>on </tspan><tspan fill="#c7b8f5" font-weight="700">*</tspan><tspan> </tspan><tspan fill="#c7b8f5" font-weight="700">main</tspan></text>
@@ -29,8 +29,7 @@
29
29
  <text x="80" y="492" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#9fd3f2">Session</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#9fd3f2">deepseek/deepseek-flash</tspan></text>
30
30
  <text x="80" y="522" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#efc3e6">Thinking level: max</tspan><tspan fill="#716879"> › </tspan><tspan fill="#efc3e6">Turn 3</tspan></text>
31
31
  <text x="80" y="552" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#efc3e6">Activity</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">Tool read × 30 write × 7 edit × 13 bash × </tspan><tspan>…</tspan></text>
32
- <text x="80" y="582" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">Agent idle</tspan></text>
33
- <text x="80" y="612" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#aee5c5">Usage</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">[##--------] 17%/1.0M</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↑ 177k</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↓ 74k</tspan></text>
34
- <text x="80" y="642" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">R 10M</tspan><tspan> </tspan><tspan fill="#aee5c5">CH 99.8%</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5" font-weight="700">$ 0.204</tspan></text>
32
+ <text x="80" y="582" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#aee5c5">Usage</tspan><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5">[##--------] 17%/1.0M</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↑ 177k</tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">↓ 74k</tspan></text>
33
+ <text x="80" y="612" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" xml:space="preserve"><tspan> </tspan><tspan fill="#716879"> › </tspan><tspan fill="#a99bae">R 10M</tspan><tspan> </tspan><tspan fill="#aee5c5">CH 99.8%</tspan><tspan fill="#716879"> › </tspan><tspan fill="#aee5c5" font-weight="700">$ 0.204</tspan></text>
35
34
  </g>
36
35
  </svg>
@@ -50,7 +50,8 @@ npm run pack:check
50
50
 
51
51
  Tests live in `tests/`:
52
52
 
53
- - `zentui-status.test.ts` — Config counts, MCP configuration counts, and extension status helpers.
53
+ - `zentui-status.test.ts` — Config counts, telemetry, and skill activity.
54
+ - `mcp-status.test.ts` — Pi runtime MCP namespaces, exposure filtering, and dynamic tool changes.
54
55
  - `mcp-footer.test.ts` — MCP count rendering, segment controls, custom formats, and legacy third-party statuses.
55
56
  - `codex-usage.test.ts` — Codex payload normalization and model-specific quota formatting.
56
57
  - `footer-layout.test.ts` — Four-group categorized layout, segment wrapping, and narrow-width budget.
@@ -61,6 +62,14 @@ Tests live in `tests/`:
61
62
  - `model-usage-refresh.test.ts` — Model usage refresh integration.
62
63
  - `token-switch-usage.test.ts` — Token Switch balance formatting.
63
64
  - `deepseek-balance.test.ts` — DeepSeek balance parsing, formatting, and query safety.
65
+ - `footer-template-enhancements.test.ts` — Conditional joining, compact packing and alignment.
66
+ - `footer-options.test.ts` — New layout persistence, direct commands and settings routes.
67
+ - `footer-lifecycle.test.ts` — Root wiring, ownership/demand cleanup, clock teardown and inactive network gating.
68
+ - `repository-path.test.ts` — Repository paths, worktrees, safe fallback and stale roots.
69
+ - `live-metadata.test.ts` — Demand gating, GitHub identity/TTL and completed-call token rate.
70
+ - `zentui-footer-integration.test.ts` — Publisher bounds, atomic values, links, hidden mode and optional telemetry.
71
+
72
+ Upstream source versions and adaptation boundaries are recorded in [upstream-zentui.md](upstream-zentui.md).
64
73
 
65
74
  When adding tests:
66
75
 
@@ -95,7 +104,7 @@ Follow the configured conventions:
95
104
  The HUD extension is organized into functional modules under `extensions/hud/`:
96
105
 
97
106
  - **`index.ts`** — Composition root for controllers, shared state, and UI installation.
98
- - **`commands/`** — `/zentui` presentation and its configuration-persistence controller.
107
+ - **`commands/`** — `/hud` presentation and its configuration-persistence controller.
99
108
  - **`config/`** — Configuration model, normalization, and persistence.
100
109
  - **`footer/`** — Footer rendering, semantic group construction, responsive layout, and templates.
101
110
  - **`segments/`** — State collectors: Git, runtime, MCP, skills, projects, etc.
@@ -26,7 +26,7 @@ Rinco Pi HUD 用四组实时状态替换 Pi 的脚注行,不需要的部分都
26
26
  pi install npm:rinco-pi-hud
27
27
  ```
28
28
 
29
- 装完重启 Pi,或执行 `/reload`。脚注默认启用,`/zentui` 打开设置界面。
29
+ 装完重启 Pi,或执行 `/reload`。脚注默认启用,`/hud` 打开设置界面。
30
30
 
31
31
  从 GitHub 或本地目录安装:
32
32
 
@@ -44,29 +44,32 @@ pi install "$PWD"
44
44
  > Pi 扩展以当前用户权限运行。安装任何第三方扩展前,请先审查其源码。
45
45
 
46
46
  > [!NOTE]
47
- > 支持 Truecolor 和 256 色终端;显式 RGB 颜色通过 Pi 的终端能力适配接口输出。上图用的是 ASCII 图标模式,`/zentui` 可以在 `auto`、`nerd`、`ascii` 三套符号之间切换。
47
+ > 支持 Truecolor 和 256 色终端;显式 RGB 颜色通过 Pi 的终端能力适配接口输出。上图用的是 ASCII 图标模式,`/hud` 可以在 `auto`、`nerd`、`ascii` 三套符号之间切换。
48
48
 
49
49
  ## 命令
50
50
 
51
51
  | 命令 | 作用 |
52
52
  | --- | --- |
53
- | `/zentui` | 设置界面:行、状态段、分隔符、图标、颜色、模板 |
54
- | `/zentui statusline enable\|disable\|toggle` | 显示或隐藏整个脚注 |
55
- | `/zentui row project\|session\|activity\|usage <enable\|disable\|toggle>` | 开关某一行 |
56
- | `/zentui format "<template>"` | 用单行模板替换四行布局 |
53
+ | `/hud` | 设置界面:行、状态段、分隔符、图标、颜色、模板 |
54
+ | `/hud statusline enable\|disable\|toggle` | 显示或隐藏整个脚注 |
55
+ | `/hud row project\|session\|activity\|usage <enable\|disable\|toggle>` | 开关某一行 |
56
+ | `/hud format "<template>"` | 用单行模板替换四行布局 |
57
+ | `/hud compact-format "<template>"` | 设置低于 80 列时使用的换行模板;`clear` 清除 |
58
+ | `/hud footer hud\|hidden\|native` | HUD、仅第三方状态、恢复 Pi 原生脚注 |
59
+ | `/hud layout\|segments\|extensions` | 直接打开对应设置页 |
57
60
  | `/codex-status` | 打印 Codex 订阅用量与限额窗口 |
58
61
  | `/usage-refresh` | 立即刷新脚注上的模型用量或余额 |
59
62
 
60
63
  ## 显示什么
61
64
 
62
- | 行 | 状态段。每段在 `/zentui` 的 **Built-in segments** 里都有独立开关 |
65
+ | 行 | 状态段。每段在 `/hud` 的 **Built-in segments** 里都有独立开关 |
63
66
  | --- | --- |
64
67
  | **Project** | 目录、Git 分支、Commit 与 Tag、工作区状态、Git 操作状态(`MERGING`、`REBASING` 等)、差异指标、运行时、包版本、OS、用户 |
65
- | **Session** | 会话名称、Provider 与模型、Thinking 等级、轮次、会话时长 |
66
- | **Activity** | 正在运行的 Tool、已完成 Tool 计数、活跃 Agent、`Agent idle`、Skill、MCP Server |
67
- | **Usage** | Context 窗口与进度条、输入/输出 Token、缓存读写量与命中率、费用、模型限额、时间 |
68
+ | **Session** | 会话名称、Provider 与模型、Thinking 等级、轮次、会话时长、时间 |
69
+ | **Activity** | 正在运行的 Tool、已完成 Tool 计数、Skill、MCP Server |
70
+ | **Usage** | Context 窗口与进度条、输入/输出 Token、缓存读写量与命中率、费用、模型限额 |
68
71
 
69
- 行用 `/zentui row usage disable` 开关;行内每个状态段在同一界面里各有开关。使用旧版聚合开关 `tokens`、`toolActivity`、`agentActivity` 的配置会自动迁移。
72
+ 行用 `/hud row usage disable` 开关;行内每个状态段在同一界面里各有开关。使用旧版聚合开关 `tokens`、`toolActivity` 的配置会自动迁移。
70
73
 
71
74
  ### 模型限额
72
75
 
@@ -89,18 +92,20 @@ Usage 行跟随当前模型的 Provider:
89
92
  想换成单行脚注,设置模板即可:
90
93
 
91
94
  ```text
92
- /zentui format "$cwd( $git_branch)$fill($context)( $tokens)( $cost)"
95
+ /hud format "$cwd( $git_branch)$fill($context)( $tokens)( $cost)"
93
96
  ```
94
97
 
95
- 变量可以写成 `$name` 或 `${name}`。[脚注参考](footer.md)列出了全部变量和别名(`$directory`、`$status`、`$codex` 等)。不带参数的 `/zentui format`(或 `/zentui format clear`)恢复四行分组布局。
98
+ 变量可以写成 `$name` 或 `${name}`。[脚注参考](footer.md)列出了全部变量和别名(`$directory`、`$status`、`$codex` 等)。不带参数的 `/hud format`(或 `/hud format clear`)恢复四行分组布局。
96
99
 
97
100
  ## 配置
98
101
 
99
- `/zentui` 把配置写入 `~/.pi/agent/rinco-pi-hud.json`,改动立即生效。可配置分隔符样式、图标模式(`nerd`、`ascii`、`auto`)、脚注配色(Pi 主题色或终端调色板样式)、Context 渲染方式(文本、进度条或两者)、项目刷新间隔,以及第三方扩展状态的位置与颜色模式。
102
+ 本项目使用 `/hud`,把 `/zentui` 留给原版 Zentui,不保留旧命令别名。配置文件和现有设置不变。与原版搭配时,请将 Zentui 的 Footer 设为 Native,让本项目继续管理 HUD;详见[共存说明](footer.md#using-with-the-original-zentui)。
100
103
 
101
- 脚注默认自动跟随当前 Pi 主题,包括手动切换主题和自动明暗切换。在 `/zentui` 中选择 **Footer colors → theme** 启用跟随,选择 **terminal** 则保留原有 Sakura RGB 配色。显式自定义颜色(十六进制、索引色或 `fg:`/`bg:` 样式)在两种模式下都会保留;删除 `colors` 中的相应配置即可恢复自动配色。
104
+ `/hud` 把配置写入 `~/.pi/agent/rinco-pi-hud.json`,改动立即生效。可配置分隔符样式、图标模式(`nerd`、`ascii`、`auto`)、脚注配色(Pi 主题色或终端调色板样式)、Context 渲染方式(文本、进度条或两者)、项目刷新间隔,以及第三方扩展状态的位置与颜色模式。
102
105
 
103
- 完整的变量与状态段参考见 [docs/footer.md](footer.md)。
106
+ 脚注默认自动跟随当前 Pi 主题,包括手动切换主题和自动明暗切换。在 `/hud` 中选择 **Footer colors → theme** 启用跟随,选择 **terminal** 则保留原有 Sakura RGB 配色。显式自定义颜色(十六进制、索引色或 `fg:`/`bg:` 样式)在两种模式下都会保留;删除 `colors` 中的相应配置即可恢复自动配色。
107
+
108
+ 已适配 Zentui **0.32.0** 的 Footer 新功能:仓库相对路径、`$join_sep` 条件分隔符、窄屏模板、扩展发布的自定义值、安全状态超链接,以及按需启用的 PR/CI 与平均 Token 速率。默认四行 HUD、原有配置及余额查询保持不变;不接管编辑器、消息、工作进度行或工具展示,也不引入 OMP 适配。同步快照和边界见[上游集成记录](upstream-zentui.md),配置示例和完整变量参考见 [docs/footer.md](footer.md)。
104
109
 
105
110
  ## 仓库结构
106
111
 
@@ -113,11 +118,11 @@ Usage 行跟随当前模型的 Provider:
113
118
  | [`extensions/hud/telemetry/`](../extensions/hud/telemetry/format.ts) | 用量格式化、各家余额探测与 Codex 订阅客户端 |
114
119
  | [`extensions/hud/session/`](../extensions/hud/session/) | Pi 事件注册、会话生命周期与实时 Context 覆盖 |
115
120
  | [`extensions/hud/state/`](../extensions/hud/state/) | 聚合状态、Telemetry Reducer 与项目刷新 Controller |
116
- | [`extensions/hud/commands/`](../extensions/hud/commands/settings.ts) | `/zentui` 设置界面与配置 Controller |
121
+ | [`extensions/hud/commands/`](../extensions/hud/commands/settings.ts) | `/hud` 设置界面与配置 Controller |
117
122
  | [`extensions/hud/ui/`](../extensions/hud/ui/) | 图标与终端样式工具 |
118
123
  | [`docs/footer.md`](footer.md) | 完整脚注配置参考 |
119
124
  | [`docs/CONTRIBUTING.md`](CONTRIBUTING.md) | 本地开发、测试规范和 PR 检查清单 |
120
- | [`tests/`](../tests/) | Vitest 测试套件:脚注布局、遥测、各家余额与 MCP 配置计数 |
125
+ | [`tests/`](../tests/) | Vitest 测试套件:脚注布局、遥测、各家余额与 MCP 运行时工具计数 |
121
126
 
122
127
  ## 开发
123
128
 
@@ -152,19 +157,19 @@ npx tsx assets/readme/source/build-assets.mts /tmp/footer.json
152
157
  <details>
153
158
  <summary>窄终端里布局看起来不对</summary>
154
159
 
155
- 脚注会测量终端宽度,只在状态段边界换行,所以窗口越窄,每行容纳的状态段越少。可以设置 `footerFormat` 模板,或在 `/zentui` 中关闭低优先级状态段。
160
+ 脚注会测量终端宽度,只在状态段边界换行,所以窗口越窄,每行容纳的状态段越少。可以设置 `footerFormat` 模板,或在 `/hud` 中关闭低优先级状态段。
156
161
  </details>
157
162
 
158
163
  <details>
159
164
  <summary>颜色显示异常</summary>
160
165
 
161
- 默认配色自动跟随当前 Pi 主题。如果脚注仍使用固定颜色,请在 `/zentui` 中选择 **Footer colors → theme**,并删除 `~/.pi/agent/rinco-pi-hud.json` 中的显式颜色覆盖。设为 `original` 的第三方扩展状态会保留自己的颜色。Truecolor 与 256 色输出仍按 Pi 检测到的终端能力选择。
166
+ 默认配色自动跟随当前 Pi 主题。如果脚注仍使用固定颜色,请在 `/hud` 中选择 **Footer colors → theme**,并删除 `~/.pi/agent/rinco-pi-hud.json` 中的显式颜色覆盖。设为 `original` 的第三方扩展状态会保留自己的颜色。Truecolor 与 256 色输出仍按 Pi 检测到的终端能力选择。
162
167
  </details>
163
168
 
164
169
  <details>
165
170
  <summary>图标缺失或错位</summary>
166
171
 
167
- Unicode 与 Nerd Font 符号的显示效果因终端和字体而异。建议安装 Nerd Font,或在 `/zentui` 中切换到 ASCII 图标。
172
+ Unicode 与 Nerd Font 符号的显示效果因终端和字体而异。建议安装 Nerd Font,或在 `/hud` 中切换到 ASCII 图标。
168
173
  </details>
169
174
 
170
175
  ## 许可证
package/docs/footer.md CHANGED
@@ -7,30 +7,70 @@ When `footerFormat` is empty, the HUD displays four semantic groups:
7
7
  ```text
8
8
  Project · pi-sakura ·  main ·  24.18
9
9
  Session · gpt-5.3 · Thinking level: high · Turn 8
10
- Activity · Agent idle · Skill 2/3 · MCP 2
10
+ Activity · Tool read × 4 · Skill 2/3 · MCP 2
11
11
  Usage · 35%/200k · ↑ 4.2k · ↓ 1.1k · $ 0.030
12
12
  ```
13
13
 
14
- The MCP segment counts server entries in Pi's agent-directory `mcp.json` and the project's `.pi/mcp.json`. Same-name entries count once; disabled entries are included. This is a raw file-entry count: differently spelled names such as `my-server` and `my_server` remain separate, even though Pi may reject them as a namespace collision. Zero entries hide the segment. Counts refresh with the project state polling interval. This does not report connection state, validate individual server settings, or include servers registered dynamically by extensions. Missing, unreadable, malformed, or larger-than-1-MiB files contribute no entries. Legacy adapter footer statuses remain ordinary third-party statuses.
14
+ The MCP segment uses Pi's public `pi.getAllTools()` API to count unique MCP namespaces with non-hidden registered tools, including direct, codemode, and deferred exposure. It includes file-configured and dynamically registered servers without reading `mcp.json`, resolving credentials, or creating connections. Hidden tools left behind after disabling or removing a server do not count. The value is read on each footer render (including normal project refreshes); zero hides the segment. This is a runtime tool-availability count, not a connection-health or configured-server count: resource-only servers and servers with no exposed tools are omitted, and a disconnected server may retain registered tools. Use Pi's `/mcp` for full connection status. `pi.getMcpServers()` is not used because it only lists extension registrations, not all configured servers. Legacy adapter footer statuses remain ordinary third-party statuses.
15
15
 
16
16
  The category column is sized from visible text so every separator aligns. When a row exceeds the terminal width, complete status segments move to an indented continuation line. Only a single segment that is wider than the available content area is truncated. Third-party extension statuses appear on the Activity group in configured `left`, `middle`, then `right` order.
17
17
 
18
18
  Control each default-layout row independently:
19
19
 
20
20
  ```text
21
- /zentui row project enable
22
- /zentui row session disable
23
- /zentui row activity toggle
24
- /zentui row usage toggle
21
+ /hud row project enable
22
+ /hud row session disable
23
+ /hud row activity toggle
24
+ /hud row usage toggle
25
25
  ```
26
26
 
27
- The command shape is `/zentui row <project|session|activity|usage> <enable|disable|toggle>`. Values persist under `footerRows`; all four default to `true`. Row switches apply only to the default layout and do not alter a custom single-line `footerFormat`.
27
+ The command shape is `/hud row <project|session|activity|usage> <enable|disable|toggle>`. Values persist under `footerRows`; all four default to `true`. Row switches apply only to the default layout and do not alter a custom single-line `footerFormat`.
28
+
29
+ ## Using with the original Zentui
30
+
31
+ This package registers `/hud`, not `/zentui`. The original Zentui keeps `/zentui`;
32
+ the HUD has no legacy alias and still uses `rinco-pi-hud.json`.
33
+
34
+ To use Zentui's User messages, Working line, or Tool display alongside the HUD,
35
+ set Zentui's `components.footer.style` to `"native"` in
36
+ `~/.pi/agent/zentui.json`. Native releases Zentui's Footer ownership without
37
+ removing another extension's footer. Keep this package's status line enabled.
38
+ Do not select Zentui Starship or Hidden while expecting the HUD to remain in control.
39
+
40
+ Zentui components are independent. Disable its Editor, Thinking and selector borders
41
+ unless wanted. With its Editor disabled, use Working line placement `"above"` rather
42
+ than the editor-border placement. Tool display custom/MCP overrides and replacement
43
+ of Bash renderers require separate consent; installing the package does not authorize them.
44
+
45
+ ## Footer modes
46
+
47
+ - `/hud footer hud`: enable the normal four groups or configured templates.
48
+ - `/hud footer hidden`: show only allowed third-party statuses, no row when none exist.
49
+ - `/hud footer native`: release ownership to Pi; saved HUD choices remain unchanged.
50
+
51
+ Hidden and HUD share the existing per-key `extensionStatuses` placement/color policy.
52
+ Native is Pi-owned and does not apply this policy. `/hud layout`, `segments`, and
53
+ `extensions` open the corresponding settings tabs directly.
54
+
55
+ ## Repository paths
56
+
57
+ `pathDisplay` defaults to `{ "mode": "basename", "depth": 0 }`.
58
+ Select `repository` in Layout → Path display, or set:
59
+
60
+ ```json
61
+ { "pathDisplay": { "mode": "repository", "depth": 2 } }
62
+ ```
63
+
64
+ Repository root displays `.`; `/repo/packages/core/src` displays `…/core/src` at depth 2.
65
+ Zero depth is unlimited. Worktrees are supported. Until a root qualified for the current cwd
66
+ is available, missing/failed/unsafe roots fall back to the unlimited full path with home `~`
67
+ abbreviation; a stale root is never used to produce a relative path.
28
68
 
29
69
  ## Colors and theme switching
30
70
 
31
71
  By default, `colorSources.starship` is `"theme"`. Built-in footer colors use semantic Pi theme tokens such as `accent`, `muted`, `success`, `warning`, and `error`; runtime labels also use the active theme. Switching themes, including automatic light/dark switching, recolors the footer without reloading the extension. This applies to both the default rows and custom templates.
32
72
 
33
- To enable theme colors in an existing configuration, use **Footer colors → theme** in `/zentui`, or set:
73
+ To enable theme colors in an existing configuration, use **Footer colors → theme** in `/hud`, or set:
34
74
 
35
75
  ```json
36
76
  {
@@ -67,30 +107,28 @@ Entries you explicitly set under `colors` override the selected defaults. Semant
67
107
  | `sessionDuration` | off | Session | Current session duration |
68
108
  | `runningTools` | on | Activity | Currently running native tools and elapsed time |
69
109
  | `toolCounts` | on | Activity | Cumulative completed native-tool counts |
70
- | `activeAgents` | on | Activity | Active primary agent runs |
71
- | `agentIdle` | on | Activity | `Agent idle` when no primary agent run is active |
72
110
  | `skills` | on | Activity | Active/available skills count, e.g. `Skill 1/3` |
73
- | `mcp` | on | Activity | File-configured MCP servers, e.g. `MCP 2` |
111
+ | `mcp` | on | Activity | MCP namespaces with exposed runtime tools, e.g. `MCP 2` |
74
112
  | `context` | on | Usage | Context percentage, window size, and/or gauge |
75
113
  | `inputTokens` | on | Usage | Cumulative input tokens |
76
114
  | `outputTokens` | on | Usage | Cumulative output tokens |
77
115
  | `cacheDetails` | on | Usage | Cache read/write tokens and latest hit rate |
78
116
  | `cost` | on | Usage | Cumulative session cost |
79
117
  | `codexUsage` | on | Usage | Codex weekly quota remaining |
80
- | `time` | off | Usage | Current time `HH:MM` |
118
+ | `time` | off | Session | Current time `HH:MM`, after session duration |
81
119
 
82
120
  ## Template syntax
83
121
 
84
122
  Set a custom template:
85
123
 
86
124
  ```text
87
- /zentui format "$os $cwd( $git_branch)$fill($context)( $tokens)( $cost)"
125
+ /hud format "$os $cwd( $git_branch)$fill($context)( $tokens)( $cost)"
88
126
  ```
89
127
 
90
128
  Clear it:
91
129
 
92
130
  ```text
93
- /zentui format clear
131
+ /hud format clear
94
132
  ```
95
133
 
96
134
  ### Variables
@@ -99,6 +137,12 @@ Clear it:
99
137
  - `( ... )` — conditional group; hidden when all contained variables are empty
100
138
  - `$fill` — layout partition marker (0 = left only, 1 = left/right, 2 = left/middle/right)
101
139
  - `$sep` — styled ` | ` separator, does not cause a conditional group to show
140
+ - `$join_sep` — insert the styled separator only between populated sibling fields
141
+
142
+ For example, `$session_name$join_sep($git_branch $git_status)$join_sep$runtime` joins only
143
+ populated fields, with no orphan separator when an intervening field is missing. Each group
144
+ and top-level fill/wrap boundary has its own join scope. Do not pad `$join_sep` with spaces;
145
+ the separator already owns spacing. Templates without it retain their previous behavior.
102
146
 
103
147
  ### Variable list
104
148
 
@@ -139,11 +183,16 @@ Clear it:
139
183
  | `$skills` | Active/available skills, e.g. `Skill 1/3` |
140
184
  | `$active_skills` | Active skills count only |
141
185
  | `$extensions` | Installed Pi packages count |
142
- | `$mcp` | File-configured MCP server count |
186
+ | `$mcp` | MCP namespace count from Pi's exposed runtime tools |
143
187
  | `$tool_counts` | Native tool completion counts |
144
188
  | `$running_tools` | Recently running tools |
145
- | `$active_agents` | Active primary agent runs |
189
+ | `$subscription` | Optional `(sub)` when Pi reports OAuth subscription use (also kimi-coding) |
190
+ | `$auto_compaction` | Optional `(auto)` when public, trust-aware Pi settings report automatic compaction |
191
+ | `$pr_number` / `$pr_url` | Current open GitHub PR number / plain HTTPS URL, qualified against local HEAD |
192
+ | `$ci` | `CI passing`, `CI running`, `CI failed`, `CI no checks`, or `CI stale`; unavailable data is empty |
193
+ | `$token_rate` | Current interaction’s completed-call average, e.g. `48 tok/s avg` |
146
194
  | `$sep` | Styled ` | ` |
195
+ | `$join_sep` | Conditional sibling separator |
147
196
  | `$fill` | Layout marker, renders nothing |
148
197
 
149
198
  ### Aliases
@@ -158,13 +207,110 @@ $tag → $git_tag
158
207
  $duration → $session_duration
159
208
  $session → $session_name
160
209
  $thinking_level → $thinking
210
+ $thinkingLevel → $thinking
211
+ $codex_quota → $codex_usage
161
212
  $turn_count → $turn
162
213
  $codex → $codex_usage
163
214
  $tools → $tool_counts
164
- $agents → $active_agents
165
215
  $separator → $sep
166
216
  ```
167
217
 
218
+ ## Opt-in compact templates
219
+
220
+ Set a separate narrow layout (used below 80 terminal columns):
221
+
222
+ ```text
223
+ /hud compact-format "$cwd$wrap(on $git_branch)$fill$context$wrap_sep$tokens$wrap_sep$extension_statuses"
224
+ ```
225
+
226
+ `$wrap` starts an independently packable chunk with a space boundary.
227
+ `$wrap_sep` uses the configured default-layout separator only when chunks share a row.
228
+ The first top-level `$fill` divides left/right zones; right-hand chunks have priority in
229
+ template order and are right-aligned. Nested/additional fills do not create extra zones.
230
+ `$extension_statuses` expands allowed third-party statuses into separate chunks; the existing
231
+ `$extensions` still reports installed packages. Wide templates keep their existing status placements.
232
+
233
+ `compactFooterMaxLines` defaults to 2 (range 1–8), and omitted/truncated chunks use `…`.
234
+ Layout → Responsive compact controls `responsiveFooter`; an empty compact format is inert.
235
+ Use `/hud compact-format clear` to return to the existing layout at every width.
236
+ Custom templates and wide templates are otherwise unchanged; arbitrary narrow layouts cannot keep every field.
237
+
238
+ ## Custom extension values
239
+
240
+ Alias stable publisher keys in JSON, then explicitly reference them in templates:
241
+
242
+ ```json
243
+ {
244
+ "footerVariables": { "quota": "@scope/usage:quota" },
245
+ "customValueColorMode": "original",
246
+ "customValueColors": { "@scope/usage:quota": "bold success" },
247
+ "footerFormat": "$cwd$fill($quota)($sep$cost)",
248
+ "compactFooterFormat": "$cwd$fill($quota)$wrap_sep$context"
249
+ }
250
+ ```
251
+
252
+ Aliases cannot shadow builtins, builtin aliases, structural/prototype names, except an explicit
253
+ `ci` alias may replace GitHub CI and suppress its query. At most 16 aliases are accepted.
254
+ Unpublished/empty values drop optional groups. Nothing is automatically appended to templates.
255
+
256
+ Original color mode preserves safe publisher SGR/HTTP(S) links; Zentui mode uses the current
257
+ HUD extension-status color. `customValueColors` overrides are keyed by publisher ID across
258
+ aliases: explicit styles replace publisher styling, `""` removes styling, and deleting a leaf
259
+ restores inheritance. These JSON-only per-value overrides are independent of `setStatus()` colors.
260
+ Layout → Custom value colors changes the shared mode.
261
+
262
+ Publish through Pi's shared event bus using Zentui protocol v1:
263
+
264
+ ```typescript
265
+ const key = "@scope/usage:quota";
266
+ const capability = { supported: false, active: false, key };
267
+ pi.events.emit("zentui:variable-capability", capability);
268
+ if (capability.active) {
269
+ pi.events.emit("zentui:variable", { key, text: "Quota 80%" });
270
+ ctx.ui.setStatus(key, undefined); // remove only your own fallback
271
+ } else {
272
+ ctx.ui.setStatus(key, "Quota 80%");
273
+ }
274
+ // Removal also works after demand becomes inactive:
275
+ pi.events.emit("zentui:variable", { key, text: undefined });
276
+ ```
277
+
278
+ Capability probes receive `supported: true`, `version: 1`, and current `active` demand.
279
+ Probe again on each publisher refresh. Active means an owned, enabled current TUI Footer
280
+ references the alias in its wide or enabled compact template, not guaranteed visibility at every width.
281
+ Hidden/native/disabled/unowned consumers are inactive. Registry limits: 16 publisher keys,
282
+ 64 UTF-16 units per key, 256 per raw text. Inactive/malformed/oversized updates are ignored;
283
+ empty text removes a value. Session replacement, shutdown or lost ownership/demand clears values.
284
+ Publishers must republish on reactivation and own their refresh/freshness resources.
285
+ A custom value is kept whole or omitted with template recomposition, never partially cropped.
286
+
287
+ ## Status hyperlinks and live metadata
288
+
289
+ Third-party statuses in `original` mode preserve only SGR and HTTP(S) OSC 8 hyperlinks.
290
+ Unsafe protocols, title, clipboard, cursor controls and embedded line breaks are stripped;
291
+ links and styles are closed before adjacent content. Zentui mode strips publisher styling/links.
292
+
293
+ ```text
294
+ /hud format "$cwd( · PR #$pr_number)( · $ci)$fill($token_rate)"
295
+ ```
296
+
297
+ PR/CI collection is opt-in through template references and requires installed/authenticated
298
+ `gh` plus an unambiguous `github.com` Git remote. No tools are installed or authenticated
299
+ automatically, and no fetch/write is performed. Repository/head changes invalidate results;
300
+ missing CLI/auth/PR, mismatched local/PR HEAD, detached HEAD or conflicting remotes yield empty values.
301
+ A 30-second cache is refreshed by normal session/project synchronization, not an extra polling timer.
302
+ A stale retained check snapshot shows `CI stale`. An explicit `ci` custom alias uses only publisher data.
303
+
304
+ `$token_rate` divides completed output by observed model-call duration in the current interaction.
305
+ It includes first-byte wait, excludes tools/gaps, and never estimates in-flight output speed.
306
+ It retains completed values until the next interaction; incomplete measurements show `— tok/s avg`.
307
+
308
+ Optional subscription and compaction markers use public Pi capabilities only and render empty
309
+ when unavailable. Automatic compaction reads respect public project trust and are refreshed during
310
+ normal Footer synchronization. They do not change Pi settings.
311
+
312
+ See [the integration record](upstream-zentui.md) for the pinned source and differences from full Zentui.
313
+
168
314
  ## Model quota
169
315
 
170
316
  The status line automatically switches quota display based on model provider: