pi-open-tui 0.4.1 → 0.4.3
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 +54 -0
- package/README.md +54 -121
- package/README.zh-CN.md +54 -121
- package/docs/configuration.md +245 -0
- package/docs/footer-segments.md +121 -0
- package/docs/implementation.md +185 -0
- package/extensions/open-tui/config.ts +25 -7
- package/extensions/open-tui/copy-buttons.ts +172 -66
- package/extensions/open-tui/footer-segments.ts +119 -0
- package/extensions/open-tui/footer.ts +121 -13
- package/extensions/open-tui/index.ts +8 -1
- package/extensions/open-tui/settings-command.ts +312 -63
- package/extensions/open-tui/tool-preview.ts +8 -2
- package/extensions/open-tui/tool-view.ts +206 -38
- package/extensions/open-tui/utils.ts +18 -6
- package/package.json +10 -8
package/README.zh-CN.md
CHANGED
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
[English](./README.md) | **简体中文**
|
|
6
6
|
|
|
7
|
-
一个为 [Pi](https://pi.dev)
|
|
7
|
+
一个为 [Pi](https://pi.dev) 编程代理打造的终端界面扩展。
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
Pi 1.4.0 的真实终端截图。
|
|
12
|
-
|
|
13
11
|
## 功能亮点
|
|
14
12
|
|
|
15
13
|
- **Pi 顶栏**:显示模型、思考等级、当前目录和常用斜杠命令提示
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- **项目环境感知**:识别 50 多种运行环境,并展示 ahead/behind、已暂存、已修改、未跟踪、stash
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
14
|
+
- **自适应底栏**:展示 Git 状态、运行环境、上下文用量、Token、费用和扩展状态
|
|
15
|
+
- **带边框的编辑器**:支持块状、竖线和下划线光标,保留其他扩展的兼容编辑器
|
|
16
|
+
- **项目环境感知**:识别 50 多种运行环境,并展示 ahead/behind、已暂存、已修改、未跟踪、stash 和分离 HEAD 等 Git 状态
|
|
17
|
+
- **单轮遥测**:展示生成速度、首 Token 延迟、耗时、停顿、Token 数量和费用速率
|
|
18
|
+
- **思考预览**:模型工作时实时预览隐藏的推理内容
|
|
19
|
+
- **紧凑工具视图**:提供编辑/写入预览,可选支持扩展和 MCP 工具
|
|
20
|
+
- **全屏复制按钮**:一键复制代码块和用户消息
|
|
21
|
+
- **交互式设置**:通过 `/open-tui` 使用英文或简体中文界面
|
|
22
22
|
|
|
23
23
|
## 环境要求
|
|
24
24
|
|
|
25
|
-
- Pi 1.
|
|
25
|
+
- Pi 1.5.0 或更高版本
|
|
26
26
|
- Node.js 22.19.0 或更高版本(Pi 的最低要求)
|
|
27
27
|
- 支持 UTF-8 和彩色输出的终端
|
|
28
|
-
- 使用完整图标集时需要 [Nerd Font](https://www.nerdfonts.com/font-downloads)
|
|
28
|
+
- 使用完整图标集时需要 [Nerd Font](https://www.nerdfonts.com/font-downloads)(可选,也可使用 Unicode 或 ASCII 模式)
|
|
29
29
|
|
|
30
30
|
## 安装
|
|
31
31
|
|
|
@@ -43,132 +43,64 @@ pi -e npm:pi-open-tui
|
|
|
43
43
|
|
|
44
44
|
## 字体与图标
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
默认的 `auto` 模式检查终端环境,而不是已安装的字体文件。在支持 UTF-8 的交互式 TTY 中,它会使用 Nerd Font 图标,即使 Pi 运行在 runner 或子 shell 中。如果图标显示为方框、乱码或错误符号,请打开 `/open-tui`,在**外观**页选择合适的模式:
|
|
49
|
-
|
|
50
|
-
- `nerd`:终端已配置 Nerd Font 时,强制使用 Nerd Font 图标
|
|
51
|
-
- `unicode`:可移植 Unicode 图标(文件夹、分支、笔记本电脑、灯泡、插头、沙漏等),无需修补字体;emoji 字形通过终端的 emoji 回退渲染
|
|
52
|
-
- `ascii`:使用纯文本图标,无需安装修补字体
|
|
53
|
-
- `auto`:在支持 UTF-8 的交互式 TTY 中使用 Nerd Font 图标;SSH 会话使用可移植 Unicode 图标(字体由客户端终端决定,通常没有 Nerd Font);非交互式输出、`TERM=dumb` 或明确配置为非 UTF-8 的 locale 使用 ASCII
|
|
46
|
+
使用完整图标集时,请安装 [Nerd Font](https://www.nerdfonts.com/font-downloads),在终端配置中选中它并重启终端。使用 VS Code、Windows Terminal 等应用时,只在操作系统中安装字体还不够。
|
|
54
47
|
|
|
55
|
-
|
|
48
|
+
`/open-tui` 的**外观 → 图标**提供 `auto`、`nerd`、`unicode` 和 `ascii`。默认 `auto` 检查终端环境,并不检查实际字体;图标显示为方框时可选 `unicode`,终端已配置 Nerd Font 时可强制选 `nerd`,SSH 会话同样适用。
|
|
56
49
|
|
|
57
|
-
|
|
50
|
+
自动选择规则和 Kitty 的间距选项见[图标检测与间距](./docs/configuration.md#图标)。
|
|
58
51
|
|
|
59
52
|
## 配置
|
|
60
53
|
|
|
61
|
-
运行 `/open-tui`
|
|
62
|
-
|
|
63
|
-
配置示例:
|
|
64
|
-
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"enabled": true,
|
|
68
|
-
"header": true,
|
|
69
|
-
"inlineFooter": false,
|
|
70
|
-
"copyButtons": true,
|
|
71
|
-
"settingsLanguage": "zh",
|
|
72
|
-
"cursorStyle": "block",
|
|
73
|
-
"icons": {
|
|
74
|
-
"mode": "auto"
|
|
75
|
-
},
|
|
76
|
-
"footerSegments": {
|
|
77
|
-
"cwd": true,
|
|
78
|
-
"hostname": false,
|
|
79
|
-
"sessionName": false,
|
|
80
|
-
"gitBranch": true,
|
|
81
|
-
"gitStatus": true,
|
|
82
|
-
"gitCommit": false,
|
|
83
|
-
"runtime": true,
|
|
84
|
-
"context": true,
|
|
85
|
-
"tokens": true,
|
|
86
|
-
"cost": true,
|
|
87
|
-
"liveTps": true,
|
|
88
|
-
"extensionStatuses": true,
|
|
89
|
-
"capitalizeProviderName": true,
|
|
90
|
-
"nerdIconSpacing": false
|
|
91
|
-
},
|
|
92
|
-
"telemetry": {
|
|
93
|
-
"enabled": true,
|
|
94
|
-
"tps": true,
|
|
95
|
-
"ttft": true,
|
|
96
|
-
"duration": true,
|
|
97
|
-
"tokens": true,
|
|
98
|
-
"stalls": true,
|
|
99
|
-
"cost": true
|
|
100
|
-
},
|
|
101
|
-
"thinkingPeek": {
|
|
102
|
-
"lines": 1
|
|
103
|
-
},
|
|
104
|
-
"toolView": {
|
|
105
|
-
"mode": "native"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
```
|
|
54
|
+
运行 `/open-tui` 打开设置窗口,包含**常规**、**外观**、**底栏**和**遥测**四个页面,支持英文和简体中文,并适应终端尺寸。Tab/Shift+Tab 或 ←/→ 切页,↑/↓ 移动,Enter/Space 修改值,Esc/q 关闭。
|
|
109
55
|
|
|
110
|
-
|
|
56
|
+
设置保存在 Pi 的 agent 目录内的 `open-tui.json` 中,默认目录是 `~/.pi/agent`,可通过 `PI_CODING_AGENT_DIR` 覆盖。保存失败时会提示:修改仅在当前会话生效。
|
|
111
57
|
|
|
112
|
-
|
|
|
58
|
+
| 设置 | 位置 | 默认值 |
|
|
113
59
|
| --- | --- | --- |
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
| `footerSegments.capitalizeProviderName` | 布尔开关 | 将底栏中提供商名称的首字母大写;设为 `false` 时保留原始大小写 |
|
|
122
|
-
| `footerSegments.nerdIconSpacing` | 布尔开关 | 在底栏 Nerd Font 图标后额外留一格空白;默认 `false` |
|
|
123
|
-
| `telemetry` | 布尔开关 | 控制遥测总开关和各项指标 |
|
|
124
|
-
| `thinkingPeek.lines` | `0`、`1`、`2` | 关闭、单行或双行思考预览 |
|
|
125
|
-
| `toolView.mode` | `native`、`compact` | Pi 原生卡片(默认),或带编辑/写入成功预览的紧凑调用与摘要行。只对切换后新建的行生效 |
|
|
126
|
-
|
|
127
|
-
`sessionName` 仅在会话有名称时显示;`hostname` 会显示主机名的短名称(主机名的第一个标签,例如从 `mba.example.com` 显示为 `mba`),并使用服务器图标;处于分离 HEAD(detached HEAD)状态时,`gitBranch` 会显示 `HEAD` 和短提交哈希,`gitCommit` 会在其后追加指向该提交的标签,且仅在开启 `gitBranch` 时生效;关闭 `extensionStatuses` 会隐藏整行扩展状态,其中也包括 MCP 状态。每条状态会保留其扩展通过 `ctx.ui.theme.fg()` 设置的颜色;未设置颜色的状态使用 muted 主题色显示。
|
|
60
|
+
| 顶栏与设置语言 | 常规 → 界面 | 顶栏开启、英文 |
|
|
61
|
+
| 思考预览 | 常规 → 消息与工具 | 单行 |
|
|
62
|
+
| 复制按钮 | 常规 → 消息与工具 | 开启,仅全屏模式 |
|
|
63
|
+
| 工具视图 | 常规 → 消息与工具 | 原生 |
|
|
64
|
+
| 底栏嵌入输入框 | 常规 → 底栏 | 关闭 |
|
|
65
|
+
| 图标与光标样式 | 外观 | 自动图标、块状光标 |
|
|
66
|
+
| 底栏字段与遥测指标 | 底栏 / 遥测 | 可分别设置 |
|
|
128
67
|
|
|
129
|
-
|
|
68
|
+
选择**工具视图:紧凑**后,才会显示子选项**紧凑显示扩展工具**;切回原生时隐藏该选项并保留其值。完整 JSON 默认配置、所有选项和工具排除列表见[配置参考](./docs/configuration.md#简体中文)。
|
|
130
69
|
|
|
131
|
-
|
|
70
|
+
## 顶栏、底栏与编辑器
|
|
132
71
|
|
|
133
|
-
|
|
72
|
+
顶栏提供模型、项目环境和命令提示。两条主底栏集中显示位置、Git 状态、运行环境、工作/完成计时器、上下文用量、模型详情、Token 和费用。可单独开关各项字段;终端变窄时,布局会缩短或隐藏低优先级信息。
|
|
134
73
|
|
|
135
|
-
|
|
74
|
+
底栏 Token 和费用总计包含助手回复、工具报告的用量、压缩与分支摘要以及缓存预热;缓存命中率表示最近一条助手回复。其他扩展可以使用独立状态行,也可以[直接向主底栏添加内容](./docs/footer-segments.md)。
|
|
136
75
|
|
|
137
|
-
|
|
76
|
+
开启**底栏嵌入输入框**,可把两条主信息行移入编辑器上下边框,扩展状态行仍显示在编辑器下方。兼容编辑器会保留输入行为、补全和灰字建议;无法加框的编辑器继续使用独立底栏。集成边界见[编辑器兼容性与布局](./docs/implementation.md#编辑器与布局)。
|
|
138
77
|
|
|
139
78
|
## 单轮遥测
|
|
140
79
|
|
|
141
|
-
每次 Agent 完整运行结束后,pi-open-tui
|
|
80
|
+
每次 Agent 完整运行结束后,pi-open-tui 会合并其中的助手轮次,显示一条临时结果:
|
|
142
81
|
|
|
143
82
|
```text
|
|
144
83
|
> TPS 42.5 tok/s | ~ TTFT 1.2s | + 29.7s | ↑ 567 | ↓ 1.2k | ! stall 1x / 4.3s | $ $3.60/M
|
|
145
84
|
```
|
|
146
85
|
|
|
147
|
-
TPS
|
|
86
|
+
TPS 用服务商报告的输出 Token 除以生成时间,包含等待和停顿,不包含轮次之间的工具执行时间。流式输出期间,工作计时器还会显示 `~54 tok/s` 这样的实时估算速度。`$ / M` 表示本次运行每百万 Token 的综合费率,底栏则显示会话累计费用。
|
|
148
87
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
`$ / M` 表示根据 `usage.cost.total` 得到的模型标价速率,不是底栏中的会话累计费用。所有遥测字段都可以在**遥测**页单独开关。
|
|
88
|
+
可在**遥测 → 测量指标**中开关通知字段,在**底栏 → 运行环境 → 实时 TPS**中控制实时速度。计算公式、计时边界和缓存统计见[指标定义](./docs/implementation.md#用量与遥测)。
|
|
152
89
|
|
|
153
90
|
## 思考预览
|
|
154
91
|
|
|
155
|
-
开启 Pi 的 **Hide thinking**
|
|
156
|
-
|
|
157
|
-
- 模型推理时,思考内容的末尾片段会随 spinner 滚动(`~ think ⠋ …`);
|
|
158
|
-
- 开始输出正文时定格为对勾(`~ think ✓`);
|
|
159
|
-
- 双行模式中,上一条和最新一条思考内容使用相同的文字缩进;如果最新一行超出宽度,则两行随新 Token 持续显示它的最新末尾片段,不再保留上一条;
|
|
160
|
-
- 任务结束后恢复原生 `Thinking...` 标签。
|
|
92
|
+
开启 Pi 的 **Hide thinking** 后,模型工作时 pi-open-tui 会用最新推理片段替换隐藏思考块的 `Thinking...` 标签:
|
|
161
93
|
|
|
162
94
|
```text
|
|
163
95
|
~ think ⠋ 上一条思考
|
|
164
96
|
最新一条思考
|
|
165
97
|
```
|
|
166
98
|
|
|
167
|
-
|
|
99
|
+
在**常规 → 消息与工具 → 思考预览**中选择**关闭、单行或双行**。字幕仅在模型真正输出推理时出现,正文开始后变为对勾,任务结束后恢复原生标签。可见性随 Pi 的 Hide thinking 开关立即变化,文字会按可用宽度截断。
|
|
168
100
|
|
|
169
101
|
## 工具视图
|
|
170
102
|
|
|
171
|
-
|
|
103
|
+
默认使用**原生**模式。在**常规 → 消息与工具 → 工具视图**中选择**紧凑**后,Pi 内置工具(`read`、`bash`、`powershell`、`edit`、`write`、`grep`、`find`、`ls`)显示为调用行和摘要行:
|
|
172
104
|
|
|
173
105
|
```text
|
|
174
106
|
● Read(extensions/open-tui/footer.ts:1-120)
|
|
@@ -179,18 +111,17 @@ TPS 的计算方式是:将本次运行中服务商报告的全部 Assistant
|
|
|
179
111
|
└ Done · 131 lines · 6.4s
|
|
180
112
|
```
|
|
181
113
|
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
- `
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
- 模式在 Pi 创建某行时确定,因此切换只影响新建的行;执行 `/reload` 或新开会话后整个记录都会应用。
|
|
114
|
+
- `edit` 和 `write` 成功后显示带语法高亮的预览,最多 16 行,较长输出会提示展开。
|
|
115
|
+
- Shell 运行时显示近期输出和已用时间;出错时保留错误摘要。
|
|
116
|
+
- 点击某行展开其原生卡片,`Ctrl+O` 展开全部行。工具、参数、结果和模型看到的内容都不改变。
|
|
117
|
+
- 开启**紧凑显示扩展工具**可包含扩展和 MCP 工具;需要保留原生显示的工具可写入配置文件中的 `toolView.exclude`。识别到的 `@ff-labs/pi-fff` 工具使用专门的搜索摘要。
|
|
118
|
+
- 切换模式只影响新建的行;执行 `/reload` 或新开会话后,整个记录都会应用。
|
|
119
|
+
|
|
120
|
+
预览规则、扩展摘要和渲染器兼容性见[工具渲染细节](./docs/implementation.md#工具渲染)。
|
|
190
121
|
|
|
191
122
|
## 复制按钮
|
|
192
123
|
|
|
193
|
-
全屏模式(Pi 的 `tuiMode: "fullscreen"
|
|
124
|
+
全屏模式(Pi 的 `tuiMode: "fullscreen"`)下,完成的代码块会在宽度足够时,在圆角边框中显示可点击的 `[Copy]` 标签;用户消息也有复制标签。点击后复制原文,Pi 会短暂提示 `Copied!`。
|
|
194
125
|
|
|
195
126
|
```text
|
|
196
127
|
╭─ sh ─────────────── [Copy] ╮
|
|
@@ -198,15 +129,16 @@ TPS 的计算方式是:将本次运行中服务商报告的全部 Assistant
|
|
|
198
129
|
╰────────────────────────────╯
|
|
199
130
|
```
|
|
200
131
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
- 拖动选择经过边框时会包含边框字符和 `[Copy]` 文字。
|
|
207
|
-
- 如果同时安装了 pi-pretty-tui,则保留它自己的代码块边框和复制按钮,不再绘制这些内容。
|
|
132
|
+
代码标签复制不含围栏的代码,保留缩进和制表符;用户消息标签复制输入原文。流式代码块会在输出结束后显示标签;普通模式和思考块保留 Pi 原生围栏。复制整条助手回复请使用 Pi 的 `/copy`。
|
|
133
|
+
|
|
134
|
+
可在**常规 → 消息与工具 → 复制按钮**中开关此功能。宽度限制、代码块缓存和与其他渲染器共存的细节见[复制按钮说明](./docs/implementation.md#复制按钮行为)。
|
|
135
|
+
|
|
136
|
+
## 文档
|
|
208
137
|
|
|
209
|
-
|
|
138
|
+
- [配置参考](./docs/configuration.md#简体中文) — 完整默认值、配置项和图标选择规则
|
|
139
|
+
- [实现与兼容性](./docs/implementation.md#简体中文) — 指标公式、布局、渲染和生命周期
|
|
140
|
+
- [扩展底栏接口(英文)](./docs/footer-segments.md) — 面向扩展开发者的公开事件和接入示例
|
|
141
|
+
- [更新日志](./CHANGELOG.md) — 已发布和待发布的改动
|
|
210
142
|
|
|
211
143
|
## 本地开发
|
|
212
144
|
|
|
@@ -217,7 +149,7 @@ npm run typecheck
|
|
|
217
149
|
pi -e .
|
|
218
150
|
```
|
|
219
151
|
|
|
220
|
-
CI 在 Linux、Windows、macOS 上,使用 Node.js 22.19.0 和 24
|
|
152
|
+
CI 在 Linux、Windows、macOS 上,使用 Node.js 22.19.0 和 24 检查 Pi 1.5.0 及最新版本。核对兼容性时应让所有 Pi 包保持同一版本。终端字体、鼠标交互和光标支持可通过 `pi -e .` 实际检查。
|
|
221
153
|
|
|
222
154
|
## 致谢
|
|
223
155
|
|
|
@@ -227,6 +159,7 @@ CI 在 Linux、Windows、macOS 上,使用 Node.js 22.19.0 和 24,检查 Pi 1
|
|
|
227
159
|
- **[pi-claude-code-tui](https://github.com/Phoobobo/pi-claude-code-tui)** — Pi Logo 图案与圆角编辑器边框技术
|
|
228
160
|
- **[pi-zentui](https://github.com/lmilojevicc/pi-zentui)** — Starship 风格底栏、运行环境检测、会话生命周期和设置界面模式
|
|
229
161
|
- **[pi-tps](https://github.com/monotykamary/pi-tps)** — 单轮计时、停顿检测和保守的 TPS 计算方式
|
|
162
|
+
- **[pi-polish](https://github.com/Pringled/pi-extensions/blob/main/packages/pi-polish)** — 紧凑的工具调用行和带语法高亮的编辑 diff
|
|
230
163
|
|
|
231
164
|
Logo 图案源自 Pi 官方安装脚本(`pi.dev/install.sh`)。运行环境检测和 Git porcelain 解析借鉴了 `pi-zentui` 的结构。
|
|
232
165
|
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Configuration reference / 配置参考
|
|
2
|
+
|
|
3
|
+
[English](#english) | [简体中文](#简体中文) | [Default JSON / 默认 JSON](#default-json)
|
|
4
|
+
|
|
5
|
+
## English
|
|
6
|
+
|
|
7
|
+
For installation and feature examples, see the [README](../README.md). This reference covers all settings accepted by `open-tui.json`. The sources are [config.ts](../extensions/open-tui/config.ts), [settings-command.ts](../extensions/open-tui/settings-command.ts), and [icons.ts](../extensions/open-tui/icons.ts).
|
|
8
|
+
|
|
9
|
+
### Storage and loading
|
|
10
|
+
|
|
11
|
+
The file is stored in Pi's agent directory: `~/.pi/agent/open-tui.json` by default, or `<PI_CODING_AGENT_DIR>/open-tui.json` when that environment variable is set. The extension creates the file with defaults if it is missing and the directory is writable.
|
|
12
|
+
|
|
13
|
+
You only need to specify values you want to change; missing fields inherit [the defaults](#default-json). Flags must be JSON booleans, not strings such as `"false"`. Invalid known values fall back to their defaults, and unreadable or malformed JSON falls back to the default configuration with a warning. Direct file edits are loaded on `/reload` or a new session. If saving from `/open-tui` fails, the new values still apply to the current session and a warning asks you to check directory permissions and free space.
|
|
14
|
+
|
|
15
|
+
### Settings dialog
|
|
16
|
+
|
|
17
|
+
| Tab | Sections |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| General | Extension, Interface, Messages & tools, Footer |
|
|
20
|
+
| Appearance | Icons, Editor |
|
|
21
|
+
| Footer | Location, Git, Runtime, Usage, Other |
|
|
22
|
+
| Telemetry | Enabled (standalone master switch), Measurements |
|
|
23
|
+
|
|
24
|
+
Tab/Shift+Tab or ←/→ switches tabs; ↑/↓ or Page Up/Page Down moves between settings; Enter/Space changes a value; Esc/q closes the dialog. Dim section headings occupy rows but cannot be selected or changed. The scroll position counts both headings and settings.
|
|
25
|
+
|
|
26
|
+
**Compact extension tools** appears only while **Tool view** is Compact. Switching to Native hides it while retaining its value. Installing or removing the UI through the **Enabled** switch is deferred until the dialog closes. Existing configuration files need no migration.
|
|
27
|
+
|
|
28
|
+
### General options
|
|
29
|
+
|
|
30
|
+
| Key | Default | Values and behavior |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `enabled` | `true` | Master switch for open-tui |
|
|
33
|
+
| `header` | `true` | Replaces the header; disable to leave that slot to Pi or another extension |
|
|
34
|
+
| `inlineFooter` | `false` | Moves the two main footer rows into a compatible editor's borders; extension status rows remain separate |
|
|
35
|
+
| `copyButtons` | `true` | Code-block and user-message Copy labels in fullscreen mode |
|
|
36
|
+
| `settingsLanguage` | `"en"` | `"en"` or `"zh"`; changes the settings interface language |
|
|
37
|
+
| `cursorStyle` | `"block"` | `"block"`, `"bar"`, or `"underline"`; the latter two need terminal cursor-shape support |
|
|
38
|
+
| `icons.mode` | `"auto"` | `"auto"`, `"nerd"`, `"unicode"`, or `"ascii"`; see [Icons](#icons) |
|
|
39
|
+
| `thinkingPeek.lines` | `1` | `0` (off), `1`, or `2`; visible while Pi's Hide thinking setting is on and reasoning is streamed |
|
|
40
|
+
| `toolView.mode` | `"native"` | `"native"` or `"compact"`; selected when Pi creates each tool row |
|
|
41
|
+
| `toolView.extensionTools` | `false` | In compact mode, includes extension, MCP, and replacement tools |
|
|
42
|
+
| `toolView.exclude` | `[]` | Exact tool names that keep native rendering, including built-ins; edited in the JSON file only |
|
|
43
|
+
|
|
44
|
+
For example, `"toolView": { "mode": "compact", "extensionTools": true, "exclude": ["edit", "subagent_wait"] }` enables compact rendering while preserving those two tools' native cards. Use `/reload` or a new session to rebuild existing rows with the new tool-view settings.
|
|
45
|
+
|
|
46
|
+
### Footer options
|
|
47
|
+
|
|
48
|
+
All keys below are booleans inside `footerSegments`.
|
|
49
|
+
|
|
50
|
+
| Key | Default | Content or effect |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `cwd` | `true` | Current working directory, shortened when needed |
|
|
53
|
+
| `hostname` | `false` | Short host name (before the first dot) with a server icon |
|
|
54
|
+
| `sessionName` | `false` | Session name, when one is set |
|
|
55
|
+
| `gitBranch` | `true` | Branch name, or `HEAD` and a short commit hash in detached HEAD state |
|
|
56
|
+
| `gitStatus` | `true` | Conflicted, deleted, modified, renamed, staged, untracked, stashed, and ahead/behind counts |
|
|
57
|
+
| `gitCommit` | `false` | Tag pointing at the detached HEAD commit; only used when `gitBranch` is on |
|
|
58
|
+
| `runtime` | `true` | Detected project runtime and its version when available |
|
|
59
|
+
| `context` | `true` | Context bar, percentage, and token usage |
|
|
60
|
+
| `tokens` | `true` | Cumulative input/output tokens and the latest assistant cache-hit percentage |
|
|
61
|
+
| `cost` | `true` | Cumulative session cost reported by Pi |
|
|
62
|
+
| `liveTps` | `true` | Estimated streaming speed beside the working timer |
|
|
63
|
+
| `extensionStatuses` | `true` | Separate `ctx.ui.setStatus()` rows, including MCP status |
|
|
64
|
+
| `extensionSegments` | `true` | Contributions embedded in the main rows through the [footer event API](./footer-segments.md) |
|
|
65
|
+
| `capitalizeProviderName` | `true` | Capitalizes the provider's first character; disable to retain original casing |
|
|
66
|
+
| `nerdIconSpacing` | `false` | Adds one blank cell after Nerd Font icons, including runtime icons |
|
|
67
|
+
|
|
68
|
+
The provider/model and working/done timer do not have separate visibility switches; `liveTps` controls only the speed estimate. `extensionSegments` controls visibility, so hidden contributions still receive updates and their lifecycle stays available. It is independent of `extensionStatuses`.
|
|
69
|
+
|
|
70
|
+
### Telemetry options
|
|
71
|
+
|
|
72
|
+
All keys below are booleans inside `telemetry` and default to `true`.
|
|
73
|
+
|
|
74
|
+
| Key | Effect |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `enabled` | Master switch for the end-of-run notification |
|
|
77
|
+
| `tps` | Provider-based output tokens per second |
|
|
78
|
+
| `ttft` | Time to first output |
|
|
79
|
+
| `duration` | Full agent-run duration |
|
|
80
|
+
| `tokens` | Assistant input/output counts for measured turns |
|
|
81
|
+
| `stalls` | Stream pauses, shown only when detected |
|
|
82
|
+
| `cost` | Effective dollar rate per million reported tokens |
|
|
83
|
+
|
|
84
|
+
The footer's live-speed estimate has its own `footerSegments.liveTps` switch. See [usage and telemetry](./implementation.md#usage-and-telemetry) for measurement definitions and limitations.
|
|
85
|
+
|
|
86
|
+
### Icons
|
|
87
|
+
|
|
88
|
+
| `icons.mode` | Selection |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `auto` | ASCII when stdout is not a TTY, `TERM=dumb`, or the first configured locale (`LC_ALL`, `LC_CTYPE`, `LANG`) is not UTF-8. Otherwise Unicode when `SSH_TTY` or `SSH_CONNECTION` is set, and Nerd Font locally. An unset locale passes the UTF-8 check |
|
|
91
|
+
| `nerd` | Always use Nerd Font glyphs |
|
|
92
|
+
| `unicode` | Portable Unicode symbols; emoji use the terminal's own fallback font |
|
|
93
|
+
| `ascii` | Plain-text symbols |
|
|
94
|
+
|
|
95
|
+
Auto detection does not inspect installed fonts. Configure a Nerd Font in the terminal profile or choose `unicode`/`ascii` if symbols are missing. If the SSH client terminal has a Nerd Font, select `nerd` explicitly.
|
|
96
|
+
|
|
97
|
+
For wide Nerd glyphs that consume the gap before a label, enable **Footer → Other → Extra space after Nerd icons** (`footerSegments.nerdIconSpacing`). This affects regular and inline footers; Unicode/ASCII icons and compact Git flags are unchanged. In Kitty, `narrow_symbols U+E000-U+F8FF 1` in `kitty.conf` is an alternative.
|
|
98
|
+
|
|
99
|
+
## 简体中文
|
|
100
|
+
|
|
101
|
+
安装和功能示例见 [README](../README.zh-CN.md)。本参考列出 `open-tui.json` 接受的全部设置,依据为 [config.ts](../extensions/open-tui/config.ts)、[settings-command.ts](../extensions/open-tui/settings-command.ts) 和 [icons.ts](../extensions/open-tui/icons.ts)。
|
|
102
|
+
|
|
103
|
+
### 存储与加载
|
|
104
|
+
|
|
105
|
+
配置位于 Pi 的 agent 目录,默认路径为 `~/.pi/agent/open-tui.json`;设置 `PI_CODING_AGENT_DIR` 后则使用 `<PI_CODING_AGENT_DIR>/open-tui.json`。文件不存在且目录可写时,扩展会创建默认配置。
|
|
106
|
+
|
|
107
|
+
只需填写要修改的值,缺失字段会补入[默认值](#default-json)。布尔开关应使用 JSON 布尔值,不能写成 `"false"` 这样的字符串。已知字段的无效值会回退到默认值;无法读取或解析 JSON 时,会提示警告并使用默认配置。直接编辑文件后,执行 `/reload` 或新开会话加载。如果从 `/open-tui` 保存失败,新值仍在当前会话生效,并提示检查目录权限和可用空间。
|
|
108
|
+
|
|
109
|
+
### 设置窗口
|
|
110
|
+
|
|
111
|
+
| 页面 | 分组 |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| 常规 | 扩展、界面、消息与工具、底栏 |
|
|
114
|
+
| 外观 | 图标、输入框 |
|
|
115
|
+
| 底栏 | 位置、Git、运行环境、用量、其他 |
|
|
116
|
+
| 遥测 | 启用(独立总开关)、测量指标 |
|
|
117
|
+
|
|
118
|
+
Tab/Shift+Tab 或 ←/→ 切页,↑/↓ 或 Page Up/Page Down 移动,Enter/Space 修改值,Esc/q 关闭。暗色分组标题占一行,但不能选中或修改;滚动位置同时统计标题行和设置行。
|
|
119
|
+
|
|
120
|
+
**紧凑显示扩展工具**仅在**工具视图**为紧凑时显示;切回原生后隐藏,但保留开关值。通过**启用**开关安装或移除界面会延迟到窗口关闭后执行。现有配置文件无需迁移。
|
|
121
|
+
|
|
122
|
+
### 常规选项
|
|
123
|
+
|
|
124
|
+
| 键 | 默认值 | 可选值与行为 |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| `enabled` | `true` | open-tui 总开关 |
|
|
127
|
+
| `header` | `true` | 替换顶栏;关闭后把位置留给 Pi 或其他扩展 |
|
|
128
|
+
| `inlineFooter` | `false` | 将两条主底栏行移入兼容编辑器的边框,扩展状态行保持独立 |
|
|
129
|
+
| `copyButtons` | `true` | 全屏模式中代码块和用户消息的复制标签 |
|
|
130
|
+
| `settingsLanguage` | `"en"` | `"en"` 或 `"zh"`,控制设置界面的语言 |
|
|
131
|
+
| `cursorStyle` | `"block"` | `"block"`、`"bar"` 或 `"underline"`,后两种需要终端支持光标形状控制 |
|
|
132
|
+
| `icons.mode` | `"auto"` | `"auto"`、`"nerd"`、`"unicode"` 或 `"ascii"`,见[图标](#图标) |
|
|
133
|
+
| `thinkingPeek.lines` | `1` | `0`(关闭)、`1` 或 `2`;Pi 开启 Hide thinking 且模型输出推理时可见 |
|
|
134
|
+
| `toolView.mode` | `"native"` | `"native"` 或 `"compact"`,每条工具行创建时确定 |
|
|
135
|
+
| `toolView.extensionTools` | `false` | 紧凑模式下包含扩展、MCP 和替换内置工具的扩展 |
|
|
136
|
+
| `toolView.exclude` | `[]` | 保持原生渲染的完整工具名,可包含内置工具;仅在 JSON 文件中编辑 |
|
|
137
|
+
|
|
138
|
+
例如 `"toolView": { "mode": "compact", "extensionTools": true, "exclude": ["edit", "subagent_wait"] }` 会启用紧凑模式,并让这两个工具保留原生卡片。执行 `/reload` 或新开会话,可让已有工具行按新设置重建。
|
|
139
|
+
|
|
140
|
+
### 底栏选项
|
|
141
|
+
|
|
142
|
+
下面各键均为 `footerSegments` 内的布尔值。
|
|
143
|
+
|
|
144
|
+
| 键 | 默认值 | 内容或作用 |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| `cwd` | `true` | 当前工作目录,必要时缩短 |
|
|
147
|
+
| `hostname` | `false` | 主机短名称,即第一个点之前的部分,配合服务器图标 |
|
|
148
|
+
| `sessionName` | `false` | 会话名称,仅在已设置名称时显示 |
|
|
149
|
+
| `gitBranch` | `true` | 分支名称;分离 HEAD 时显示 `HEAD` 和短提交哈希 |
|
|
150
|
+
| `gitStatus` | `true` | 冲突、删除、修改、重命名、已暂存、未跟踪、stash 和 ahead/behind 数量 |
|
|
151
|
+
| `gitCommit` | `false` | 指向分离 HEAD 提交的标签,仅在 `gitBranch` 开启时使用 |
|
|
152
|
+
| `runtime` | `true` | 检测到的项目运行环境,以及可获取时的版本号 |
|
|
153
|
+
| `context` | `true` | 上下文进度条、百分比和 Token 用量 |
|
|
154
|
+
| `tokens` | `true` | 累计输入/输出 Token,以及最新助手回复的缓存命中率 |
|
|
155
|
+
| `cost` | `true` | Pi 报告的会话累计费用 |
|
|
156
|
+
| `liveTps` | `true` | 工作计时器旁的流式速度估算 |
|
|
157
|
+
| `extensionStatuses` | `true` | 独立的 `ctx.ui.setStatus()` 状态行,包括 MCP 状态 |
|
|
158
|
+
| `extensionSegments` | `true` | 扩展通过[底栏事件接口](./footer-segments.md)嵌入主信息行的内容 |
|
|
159
|
+
| `capitalizeProviderName` | `true` | 将服务商名称首字母大写;关闭后保留原始大小写 |
|
|
160
|
+
| `nerdIconSpacing` | `false` | Nerd Font 图标后额外留一格,包括运行环境图标 |
|
|
161
|
+
|
|
162
|
+
服务商/模型和工作/完成计时器没有独立显示开关,`liveTps` 仅控制速度估算。`extensionSegments` 只控制可见性,隐藏内容仍接收更新,生命周期仍保持可用;它与 `extensionStatuses` 相互独立。
|
|
163
|
+
|
|
164
|
+
### 遥测选项
|
|
165
|
+
|
|
166
|
+
下面各键均为 `telemetry` 内的布尔值,默认全部为 `true`。
|
|
167
|
+
|
|
168
|
+
| 键 | 作用 |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `enabled` | 运行结束通知的总开关 |
|
|
171
|
+
| `tps` | 基于服务商用量的每秒输出 Token |
|
|
172
|
+
| `ttft` | 首次输出延迟 |
|
|
173
|
+
| `duration` | Agent 完整运行耗时 |
|
|
174
|
+
| `tokens` | 被统计轮次的助手输入/输出数量 |
|
|
175
|
+
| `stalls` | 流式输出停顿,仅检测到时显示 |
|
|
176
|
+
| `cost` | 每百万报告 Token 的综合美元费率 |
|
|
177
|
+
|
|
178
|
+
底栏实时速度使用独立的 `footerSegments.liveTps` 开关。指标定义和限制见[用量与遥测](./implementation.md#用量与遥测)。
|
|
179
|
+
|
|
180
|
+
### 图标
|
|
181
|
+
|
|
182
|
+
| `icons.mode` | 选择规则 |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| `auto` | stdout 不是 TTY、`TERM=dumb`,或首个已设置的 locale(依次为 `LC_ALL`、`LC_CTYPE`、`LANG`)不是 UTF-8 时使用 ASCII。否则,存在 `SSH_TTY` 或 `SSH_CONNECTION` 时使用 Unicode,本地使用 Nerd Font。未设置 locale 时通过 UTF-8 检查 |
|
|
185
|
+
| `nerd` | 始终使用 Nerd Font 字形 |
|
|
186
|
+
| `unicode` | 可移植 Unicode 图标,emoji 使用终端自身的回退字体 |
|
|
187
|
+
| `ascii` | 纯文本图标 |
|
|
188
|
+
|
|
189
|
+
自动检测不会检查已安装字体。图标缺失时,请在终端配置中选中 Nerd Font,或切换到 `unicode`/`ascii`。SSH 客户端终端已配置 Nerd Font 时,可显式选择 `nerd`。
|
|
190
|
+
|
|
191
|
+
如果较宽的 Nerd Font 图标占用了标签前的间隔,可开启**底栏 → 其他 → Nerd 图标后额外留空**(`footerSegments.nerdIconSpacing`)。普通和内嵌底栏都适用,Unicode/ASCII 图标和紧凑 Git 状态标记不受影响。Kitty 用户也可在 `kitty.conf` 中设置 `narrow_symbols U+E000-U+F8FF 1`。
|
|
192
|
+
|
|
193
|
+
## Default JSON
|
|
194
|
+
|
|
195
|
+
The complete default configuration is shared by both language references. Set `settingsLanguage` to `"zh"` for the Chinese settings interface.
|
|
196
|
+
|
|
197
|
+
以下为两种语言共用的完整默认配置。将 `settingsLanguage` 改为 `"zh"` 即可使用中文设置界面。
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"enabled": true,
|
|
202
|
+
"header": true,
|
|
203
|
+
"inlineFooter": false,
|
|
204
|
+
"copyButtons": true,
|
|
205
|
+
"settingsLanguage": "en",
|
|
206
|
+
"cursorStyle": "block",
|
|
207
|
+
"icons": {
|
|
208
|
+
"mode": "auto"
|
|
209
|
+
},
|
|
210
|
+
"footerSegments": {
|
|
211
|
+
"cwd": true,
|
|
212
|
+
"hostname": false,
|
|
213
|
+
"sessionName": false,
|
|
214
|
+
"gitBranch": true,
|
|
215
|
+
"gitStatus": true,
|
|
216
|
+
"gitCommit": false,
|
|
217
|
+
"runtime": true,
|
|
218
|
+
"context": true,
|
|
219
|
+
"tokens": true,
|
|
220
|
+
"cost": true,
|
|
221
|
+
"liveTps": true,
|
|
222
|
+
"extensionSegments": true,
|
|
223
|
+
"extensionStatuses": true,
|
|
224
|
+
"capitalizeProviderName": true,
|
|
225
|
+
"nerdIconSpacing": false
|
|
226
|
+
},
|
|
227
|
+
"telemetry": {
|
|
228
|
+
"enabled": true,
|
|
229
|
+
"tps": true,
|
|
230
|
+
"ttft": true,
|
|
231
|
+
"duration": true,
|
|
232
|
+
"tokens": true,
|
|
233
|
+
"stalls": true,
|
|
234
|
+
"cost": true
|
|
235
|
+
},
|
|
236
|
+
"thinkingPeek": {
|
|
237
|
+
"lines": 1
|
|
238
|
+
},
|
|
239
|
+
"toolView": {
|
|
240
|
+
"mode": "native",
|
|
241
|
+
"extensionTools": false,
|
|
242
|
+
"exclude": []
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|