pi-open-tui 0.3.14 → 0.4.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,170 +1,197 @@
1
- # pi-open-tui
2
-
3
- **English** | [简体中文](./README.zh-CN.md)
4
-
5
- A polished terminal interface for the [Pi](https://pi.dev) coding agent. It brings the strongest ideas from pi-haiku, pi-claude-code-tui, and pi-zentui into one configurable extension.
6
-
7
- ![pi-open-tui preview](https://raw.githubusercontent.com/OldSuns/pi-open-tui/main/assets/preview_dashboard_1.png)
8
-
9
- ## Highlights
10
-
11
- - **Pi header** with model, thinking level, working directory, and useful slash-command hints
12
- - **Responsive footer** with Git state, detected runtime, context usage, token counts, cost, and extension status
13
- - **Framed editor** with block, bar, and underline cursor styles
14
- - **Project awareness** for 50+ runtimes and detailed Git states, including ahead/behind, staged, modified, untracked, stashed, and detached HEAD
15
- - **Turn telemetry** for TPS, time to first token (TTFT), duration, stalls, tokens, and list-price rate
16
- - **Thinking peek**: an inline ticker replaces Pi's hidden `Thinking...` label with the tail of the model's reasoning while it works
17
- - **Interactive settings** through `/open-tui`, available in English and Simplified Chinese
18
-
19
- ## Requirements
20
-
21
- - Pi 1.0 or later
22
- - A terminal with UTF-8 and color support
23
- - A [Nerd Font](https://www.nerdfonts.com/font-downloads) for the full icon set (optional; portable Unicode icons are built in)
24
-
25
- ## Install
26
-
27
- Install the extension:
28
-
29
- ```bash
30
- pi install npm:pi-open-tui
31
- ```
32
-
33
- Or try it for one session:
34
-
35
- ```bash
36
- pi -e npm:pi-open-tui
37
- ```
38
-
39
- ## Font and icons
40
-
41
- Download any patched font from the official [Nerd Fonts downloads page](https://www.nerdfonts.com/font-downloads) or [latest GitHub release](https://github.com/ryanoasis/nerd-fonts/releases/latest). Install it, select that font in your terminal profile, and restart the terminal.
42
-
43
- The default `auto` mode checks the terminal environment, not the installed font file. It uses Nerd Font icons in interactive UTF-8 TTYs, including terminals running through a runner or subshell. If icons appear as boxes or incorrect symbols, open `/open-tui` and choose one of these modes under **Appearance**:
44
-
45
- - `nerd`: force Nerd Font icons after configuring a Nerd Font in the terminal
46
- - `unicode`: portable Unicode icons (folder, branch, laptop, bulb, plug, hourglass, ...) that render without a patched font; emoji glyphs use the terminal's emoji fallback
47
- - `ascii`: use plain-text icons with no patched font required
48
- - `auto`: use Nerd Font icons in interactive UTF-8 TTYs; use portable Unicode icons for SSH sessions (the client terminal controls the font and usually has no Nerd Font); use ASCII for non-interactive output, `TERM=dumb`, or an explicitly non-UTF-8 locale
49
-
50
- If the font is installed but `auto` still selects ASCII, choose `nerd` explicitly. In VS Code, Windows Terminal, and similar apps, configure the font in the terminal profile rather than only installing it in the operating system. If your SSH client terminal does ship a Nerd Font and you want the full icon set over SSH, set the mode to `nerd` explicitly.
51
-
52
- If wide Nerd Font icons visually consume the gap before their labels (for example in Kitty), enable `footerSegments.nerdIconSpacing` (**Footer → Extra space after Nerd icons** in `/open-tui`). The footer then reserves an extra blank cell after Nerd Font icons, including runtime icons, and includes it in regular and inline footer width calculations. Unicode/ASCII icons and compact Git status flags are unchanged. In Kitty, `narrow_symbols U+E000-U+F8FF 1` in `kitty.conf` is an alternative.
53
-
54
- ## Configuration
55
-
56
- Run `/open-tui` to open the settings dialog. It provides **General**, **Appearance**, **Footer**, and **Telemetry** tabs. Settings are stored in `~/.pi/agent/open-tui.json`:
57
-
58
- ```json
59
- {
60
- "enabled": true,
61
- "inlineFooter": false,
62
- "settingsLanguage": "en",
63
- "cursorStyle": "block",
64
- "icons": {
65
- "mode": "auto"
66
- },
67
- "footerSegments": {
68
- "cwd": true,
69
- "hostname": false,
70
- "sessionName": false,
71
- "gitBranch": true,
72
- "gitStatus": true,
73
- "gitCommit": false,
74
- "runtime": true,
75
- "context": true,
76
- "tokens": true,
77
- "cost": true,
78
- "liveTps": true,
79
- "extensionStatuses": true,
80
- "capitalizeProviderName": true,
81
- "nerdIconSpacing": false
82
- },
83
- "telemetry": {
84
- "enabled": true,
85
- "tps": true,
86
- "ttft": true,
87
- "duration": true,
88
- "tokens": true,
89
- "stalls": true,
90
- "cost": true
91
- },
92
- "thinkingPeek": {
93
- "lines": 1
94
- }
95
- }
96
- ```
97
-
98
- Key options:
99
-
100
- | Option | Values | Notes |
101
- | --- | --- | --- |
102
- | `settingsLanguage` | `en`, `zh` | Changes the `/open-tui` interface language |
103
- | `inlineFooter` | `true`, `false` | Moves the two main Footer rows into the editor's top and bottom borders; defaults to `false`. Extension status rows remain below the editor |
104
- | `cursorStyle` | `block`, `bar`, `underline` | `bar` and `underline` require terminal cursor-shape support |
105
- | `icons.mode` | `auto`, `nerd`, `unicode`, `ascii` | Controls footer and telemetry icons |
106
- | `footerSegments` | Boolean flags | Shows or hides individual footer data |
107
- | `footerSegments.capitalizeProviderName` | Boolean | Capitalizes the first character of the provider name in the footer; set it to `false` to keep the provider's original casing |
108
- | `footerSegments.nerdIconSpacing` | Boolean | Adds an extra blank cell after Nerd Font icons in the footer; defaults to `false` |
109
- | `telemetry` | Boolean flags | Enables telemetry and its individual measurements |
110
- | `thinkingPeek.lines` | `0`, `1`, `2` | Off, one-line, or two-line hidden thinking preview |
111
-
112
- `sessionName` appears only when the session has a name. `hostname` shows the short host name (first label of the machine's host name, e.g. `mba` from `mba.example.com`) with a server icon. In detached HEAD state, `gitBranch` shows `HEAD` with the short commit hash; `gitCommit` appends the tag pointing at that commit and only takes effect while `gitBranch` is on. Disabling `extensionStatuses` hides the entire extension status line, including MCP status. Each status keeps the colours its extension applied with `ctx.ui.theme.fg()`. A status without colours renders in the muted theme colour.
113
-
114
- With `inlineFooter` enabled, the two normal Footer rows are rendered inside the editor frame to save vertical space. The top border places the Git branch on the left and CWD first in the right-hand group; the session title appears on the left too when `sessionName` is enabled. The Header and extension status rows remain separate; narrow terminals truncate lower-priority Footer data first, keeping the right-hand statistics and the border corner.
115
-
116
- ## Turn telemetry
117
-
118
- After each complete agent run, pi-open-tui shows one transient result. Tool-call turns are combined into that result:
119
-
120
- ```text
121
- > TPS 42.5 tok/s | ~ TTFT 1.2s | + 29.7s | ↑ 567 | ↓ 1.2k | ! stall 1x / 4.3s | $ $3.60/M
122
- ```
123
-
124
- TPS is calculated from all provider-reported assistant output tokens divided by the total generation time across the run. Timing starts at `turn_start` and ends at the assistant `message_end`, so it includes TTFT, hidden reasoning, buffering, and stalls; tool execution between turns is excluded. Runs without output tokens or measurable generation time show `TPS —`.
125
-
126
- While a response streams, the working timer also shows the current estimated speed, for example `working 12.3s · ~54 tok/s`. The `~` marks it as an estimate: it is the rate over the last 2 seconds of streamed text, thinking, and tool-call arguments, estimated at about 4 characters per token for Latin text and code and 1 token per CJK character. It drops toward zero during stalls and stays dimmed at its last value during tool execution and between messages. It is controlled by **Footer → Live TPS** (`footerSegments.liveTps`), independently of the telemetry notification. It disappears when the run ends; the exact TPS above is the authoritative value.
127
-
128
- The `$ / M` value is the model's list-price rate from `usage.cost.total`, not the cumulative session cost shown in the footer. Every telemetry field can be toggled from the **Telemetry** tab.
129
-
130
- ## Thinking peek
131
-
132
- When Pi's **Hide thinking** setting is enabled, pi-open-tui shows a compact ticker in the native hidden thinking block's `Thinking...` position. The `/open-tui` setting offers three modes: **Off**, **1 line**, and **2 lines**.
133
-
134
- - while the model is reasoning, the current thinking tail streams by with a spinner (`~ think ⠋ …`);
135
- - when the answer starts, it settles on a check mark (`~ think ✓`);
136
- - in 2-line mode, the previous and latest thinking lines share the same text indentation; if the latest line overflows, both rows follow its newest tail as tokens arrive instead of retaining the previous line;
137
- - after the task settles, the native `Thinking...` label is restored.
138
-
139
- ```text
140
- ~ think ⠋ previous thought
141
- latest thought
142
- ```
143
-
144
- The ticker appears only once the model actually streams reasoning, so non-reasoning models never show it. Pi's own Hide thinking toggle controls visibility; changing it takes effect immediately. Each row is truncated by *visible* width, so CJK-wide thinking text cannot overflow. Configure it from **General → Thinking peek** in `/open-tui`, or via `thinkingPeek.lines` in `open-tui.json`.
145
-
146
- ## Local development
147
-
148
- ```bash
149
- npm install
150
- npm test
151
- npm run typecheck
152
- pi -e .
153
- ```
154
-
155
- ## Acknowledgements
156
-
157
- This project builds on several Pi community packages:
158
-
159
- - **[pi-haiku](https://github.com/nnocte/pi-haiku)** — two-line footer structure and working timer
160
- - **[pi-claude-code-tui](https://github.com/Phoobobo/pi-claude-code-tui)** — Pi logo frames and rounded editor border technique
161
- - **[pi-zentui](https://github.com/lmilojevicc/pi-zentui)** — Starship-style footer segments, runtime detection, session lifecycle, and settings UI pattern
162
- - **[pi-tps](https://github.com/monotykamary/pi-tps)** — turn timing, stall detection, and conservative TPS measurement
163
-
164
- The logo frames are derived from Pi's official install script (`pi.dev/install.sh`). Runtime detection and Git porcelain parsing borrow structure from `pi-zentui`.
165
-
166
- Special thanks to the **[LINUX DO](https://linux.do)** community for its support.
167
-
168
- ## License
169
-
170
- [MIT](./LICENSE)
1
+ # pi-open-tui
2
+
3
+ [![omp status](https://omppackages.com/badge/pi-open-tui.svg)](https://omppackages.com/packages/pi-open-tui)
4
+
5
+ **English** | [简体中文](./README.zh-CN.md)
6
+
7
+ A polished terminal interface for the [Pi](https://pi.dev) coding agent. It brings the strongest ideas from pi-haiku, pi-claude-code-tui, and pi-zentui into one configurable extension.
8
+
9
+ ![pi-open-tui preview](https://raw.githubusercontent.com/OldSuns/pi-open-tui/main/assets/preview_dashboard_1.png)
10
+
11
+ ## Highlights
12
+
13
+ - **Pi header** with model, thinking level, working directory, and useful slash-command hints
14
+ - **Responsive footer** with Git state, detected runtime, context usage, token counts, cost, and extension status
15
+ - **Framed editor** with block, bar, and underline cursor styles
16
+ - **Project awareness** for 50+ runtimes and detailed Git states, including ahead/behind, staged, modified, untracked, stashed, and detached HEAD
17
+ - **Turn telemetry** for TPS, time to first token (TTFT), duration, stalls, tokens, and list-price rate
18
+ - **Thinking peek**: an inline ticker replaces Pi's hidden `Thinking...` label with the tail of the model's reasoning while it works
19
+ - **Interactive settings** through `/open-tui`, available in English and Simplified Chinese
20
+
21
+ ## Requirements
22
+
23
+ - Pi 1.2 or later
24
+ - A terminal with UTF-8 and color support
25
+ - A [Nerd Font](https://www.nerdfonts.com/font-downloads) for the full icon set (optional; portable Unicode icons are built in)
26
+
27
+ ## Install
28
+
29
+ Install the extension:
30
+
31
+ ```bash
32
+ pi install npm:pi-open-tui
33
+ ```
34
+
35
+ Or try it for one session:
36
+
37
+ ```bash
38
+ pi -e npm:pi-open-tui
39
+ ```
40
+
41
+ ## Font and icons
42
+
43
+ Download any patched font from the official [Nerd Fonts downloads page](https://www.nerdfonts.com/font-downloads) or [latest GitHub release](https://github.com/ryanoasis/nerd-fonts/releases/latest). Install it, select that font in your terminal profile, and restart the terminal.
44
+
45
+ The default `auto` mode checks the terminal environment, not the installed font file. It uses Nerd Font icons in interactive UTF-8 TTYs, including terminals running through a runner or subshell. If icons appear as boxes or incorrect symbols, open `/open-tui` and choose one of these modes under **Appearance**:
46
+
47
+ - `nerd`: force Nerd Font icons after configuring a Nerd Font in the terminal
48
+ - `unicode`: portable Unicode icons (folder, branch, laptop, bulb, plug, hourglass, ...) that render without a patched font; emoji glyphs use the terminal's emoji fallback
49
+ - `ascii`: use plain-text icons with no patched font required
50
+ - `auto`: use Nerd Font icons in interactive UTF-8 TTYs; use portable Unicode icons for SSH sessions (the client terminal controls the font and usually has no Nerd Font); use ASCII for non-interactive output, `TERM=dumb`, or an explicitly non-UTF-8 locale
51
+
52
+ If the font is installed but `auto` still selects ASCII, choose `nerd` explicitly. In VS Code, Windows Terminal, and similar apps, configure the font in the terminal profile rather than only installing it in the operating system. If your SSH client terminal does ship a Nerd Font and you want the full icon set over SSH, set the mode to `nerd` explicitly.
53
+
54
+ If wide Nerd Font icons visually consume the gap before their labels (for example in Kitty), enable `footerSegments.nerdIconSpacing` (**Footer → Extra space after Nerd icons** in `/open-tui`). The footer then reserves an extra blank cell after Nerd Font icons, including runtime icons, and includes it in regular and inline footer width calculations. Unicode/ASCII icons and compact Git status flags are unchanged. In Kitty, `narrow_symbols U+E000-U+F8FF 1` in `kitty.conf` is an alternative.
55
+
56
+ ## Configuration
57
+
58
+ Run `/open-tui` to open the settings dialog. It provides **General**, **Appearance**, **Footer**, and **Telemetry** tabs. Settings are stored in `~/.pi/agent/open-tui.json`:
59
+
60
+ ```json
61
+ {
62
+ "enabled": true,
63
+ "header": true,
64
+ "inlineFooter": false,
65
+ "settingsLanguage": "en",
66
+ "cursorStyle": "block",
67
+ "icons": {
68
+ "mode": "auto"
69
+ },
70
+ "footerSegments": {
71
+ "cwd": true,
72
+ "hostname": false,
73
+ "sessionName": false,
74
+ "gitBranch": true,
75
+ "gitStatus": true,
76
+ "gitCommit": false,
77
+ "runtime": true,
78
+ "context": true,
79
+ "tokens": true,
80
+ "cost": true,
81
+ "liveTps": true,
82
+ "extensionStatuses": true,
83
+ "capitalizeProviderName": true,
84
+ "nerdIconSpacing": false
85
+ },
86
+ "telemetry": {
87
+ "enabled": true,
88
+ "tps": true,
89
+ "ttft": true,
90
+ "duration": true,
91
+ "tokens": true,
92
+ "stalls": true,
93
+ "cost": true
94
+ },
95
+ "thinkingPeek": {
96
+ "lines": 1
97
+ },
98
+ "toolView": {
99
+ "mode": "native"
100
+ }
101
+ }
102
+ ```
103
+
104
+ Key options:
105
+
106
+ | Option | Values | Notes |
107
+ | --- | --- | --- |
108
+ | `settingsLanguage` | `en`, `zh` | Changes the `/open-tui` interface language |
109
+ | `header` | `true`, `false` | Overrides Pi's header with the open-tui header; set it to `false` to leave the header slot to Pi or another extension |
110
+ | `inlineFooter` | `true`, `false` | Moves the two main Footer rows into the editor's top and bottom borders; defaults to `false`. Extension status rows remain below the editor |
111
+ | `cursorStyle` | `block`, `bar`, `underline` | `bar` and `underline` require terminal cursor-shape support |
112
+ | `icons.mode` | `auto`, `nerd`, `unicode`, `ascii` | Controls footer and telemetry icons |
113
+ | `footerSegments` | Boolean flags | Shows or hides individual footer data |
114
+ | `footerSegments.capitalizeProviderName` | Boolean | Capitalizes the first character of the provider name in the footer; set it to `false` to keep the provider's original casing |
115
+ | `footerSegments.nerdIconSpacing` | Boolean | Adds an extra blank cell after Nerd Font icons in the footer; defaults to `false` |
116
+ | `telemetry` | Boolean flags | Enables telemetry and its individual measurements |
117
+ | `thinkingPeek.lines` | `0`, `1`, `2` | Off, one-line, or two-line hidden thinking preview |
118
+ | `toolView.mode` | `native`, `compact` | Draws built-in tool calls as Pi's cards or as compact two-line rows; defaults to `native`. Applies to rows created after the change |
119
+
120
+ `sessionName` appears only when the session has a name. `hostname` shows the short host name (first label of the machine's host name, e.g. `mba` from `mba.example.com`) with a server icon. In detached HEAD state, `gitBranch` shows `HEAD` with the short commit hash; `gitCommit` appends the tag pointing at that commit and only takes effect while `gitBranch` is on. Disabling `extensionStatuses` hides the entire extension status line, including MCP status. Each status keeps the colours its extension applied with `ctx.ui.theme.fg()`. A status without colours renders in the muted theme colour.
121
+
122
+ With `inlineFooter` enabled, the two normal Footer rows are rendered inside the editor frame to save vertical space. The top border places the Git branch on the left and CWD first in the right-hand group; the session title appears on the left too when `sessionName` is enabled. The Header and extension status rows remain separate; narrow terminals truncate lower-priority Footer data first, keeping the right-hand statistics and the border corner.
123
+
124
+ ## Turn telemetry
125
+
126
+ After each complete agent run, pi-open-tui shows one transient result. Tool-call turns are combined into that result:
127
+
128
+ ```text
129
+ > TPS 42.5 tok/s | ~ TTFT 1.2s | + 29.7s | ↑ 567 | ↓ 1.2k | ! stall 1x / 4.3s | $ $3.60/M
130
+ ```
131
+
132
+ TPS is calculated from all provider-reported assistant output tokens divided by the total generation time across the run. Timing starts at `turn_start` and ends at the assistant `message_end`, so it includes TTFT, hidden reasoning, buffering, and stalls; tool execution between turns is excluded. Runs without output tokens or measurable generation time show `TPS —`.
133
+
134
+ While a response streams, the working timer also shows the current estimated speed, for example `working 12.3s · ~54 tok/s`. The `~` marks it as an estimate: it is the rate over the last 2 seconds of streamed text, thinking, and tool-call arguments, estimated at about 4 characters per token for Latin text and code and 1 token per CJK character. It drops toward zero during stalls and stays dimmed at its last value during tool execution and between messages. It is controlled by **Footer → Live TPS** (`footerSegments.liveTps`), independently of the telemetry notification. It disappears when the run ends; the exact TPS above is the authoritative value.
135
+
136
+ The `$ / M` value is the model's list-price rate from `usage.cost.total`, not the cumulative session cost shown in the footer. Every telemetry field can be toggled from the **Telemetry** tab.
137
+
138
+ ## Thinking peek
139
+
140
+ When Pi's **Hide thinking** setting is enabled, pi-open-tui shows a compact ticker in the native hidden thinking block's `Thinking...` position. The `/open-tui` setting offers three modes: **Off**, **1 line**, and **2 lines**.
141
+
142
+ - while the model is reasoning, the current thinking tail streams by with a spinner (`~ think ⠋ …`);
143
+ - when the answer starts, it settles on a check mark (`~ think ✓`);
144
+ - in 2-line mode, the previous and latest thinking lines share the same text indentation; if the latest line overflows, both rows follow its newest tail as tokens arrive instead of retaining the previous line;
145
+ - after the task settles, the native `Thinking...` label is restored.
146
+
147
+ ```text
148
+ ~ think ⠋ previous thought
149
+ latest thought
150
+ ```
151
+
152
+ The ticker appears only once the model actually streams reasoning, so non-reasoning models never show it. Pi's own Hide thinking toggle controls visibility; changing it takes effect immediately. Each row is truncated by *visible* width, so CJK-wide thinking text cannot overflow. Configure it from **General → Thinking peek** in `/open-tui`, or via `thinkingPeek.lines` in `open-tui.json`.
153
+
154
+ ## Tool view
155
+
156
+ With **General → Tool view** set to **Compact** (`toolView.mode: "compact"`), Pi's built-in tools (`read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, `ls`) render as one call line and one summary line:
157
+
158
+ ```text
159
+ ● Read(extensions/open-tui/footer.ts:1-120)
160
+ └ 120 lines
161
+ ● Edit(extensions/open-tui/footer.ts)
162
+ └ +2 −1
163
+ ● Bash(npm test)
164
+ └ Done · 131 lines · 6.4s
165
+ ```
166
+
167
+ - While a shell command runs, the newest 3 output lines and the elapsed time are shown.
168
+ - The dot is yellow while running, green when done, and red when failed. Failed calls keep the compact row with a red summary; for shell commands it ends with the last output line, such as `Exited with code 1 · 12 lines · 1.2s · FAIL tests/a.test.ts`. Press Ctrl+O for the full output.
169
+ - Clicking a row expands only that row into Pi's native card, and `Ctrl+O` expands all rows. The full output, diff, and truncation notices are unchanged.
170
+ - Only the display changes. Tools, arguments, results, and what the model sees are untouched, and third-party or MCP tools keep their own rendering.
171
+ - The mode is chosen when Pi creates a row, so switching it affects new rows; `/reload` or a new session applies it to the whole transcript.
172
+
173
+ ## Local development
174
+
175
+ ```bash
176
+ npm install
177
+ npm test
178
+ npm run typecheck
179
+ pi -e .
180
+ ```
181
+
182
+ ## Acknowledgements
183
+
184
+ This project builds on several Pi community packages:
185
+
186
+ - **[pi-haiku](https://github.com/nnocte/pi-haiku)** — two-line footer structure and working timer
187
+ - **[pi-claude-code-tui](https://github.com/Phoobobo/pi-claude-code-tui)** — Pi logo frames and rounded editor border technique
188
+ - **[pi-zentui](https://github.com/lmilojevicc/pi-zentui)** — Starship-style footer segments, runtime detection, session lifecycle, and settings UI pattern
189
+ - **[pi-tps](https://github.com/monotykamary/pi-tps)** — turn timing, stall detection, and conservative TPS measurement
190
+
191
+ The logo frames are derived from Pi's official install script (`pi.dev/install.sh`). Runtime detection and Git porcelain parsing borrow structure from `pi-zentui`.
192
+
193
+ Special thanks to the **[LINUX DO](https://linux.do)** community for its support.
194
+
195
+ ## License
196
+
197
+ [MIT](./LICENSE)