rinco-pi-hud 1.0.0 → 1.1.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.
- package/README.md +35 -20
- package/docs/CONTRIBUTING.md +37 -13
- package/docs/README.zh-CN.md +35 -20
- package/docs/footer.md +49 -33
- package/extensions/hud/commands/settings-controller.ts +78 -0
- package/extensions/hud/commands/settings.ts +93 -37
- package/extensions/hud/config/config-counts.ts +6 -5
- package/extensions/hud/config/config.ts +2 -0
- package/extensions/hud/config/normalize.ts +36 -4
- package/extensions/hud/config/persist.ts +36 -3
- package/extensions/hud/config/schema.ts +30 -8
- package/extensions/hud/footer/groups.ts +104 -0
- package/extensions/hud/footer/index.ts +62 -68
- package/extensions/hud/footer/layout.ts +93 -19
- package/extensions/hud/footer/render-labels.ts +47 -23
- package/extensions/hud/index.ts +40 -296
- package/extensions/hud/segments/git.ts +2 -8
- package/extensions/hud/segments/mcp-status.ts +2 -1
- package/extensions/hud/segments/package-version.ts +1 -2
- package/extensions/hud/segments/runtime.ts +3 -3
- package/extensions/hud/segments/skill-activity.ts +6 -2
- package/extensions/hud/session/event-handlers.ts +174 -0
- package/extensions/hud/state/project-controller.ts +106 -0
- package/extensions/hud/state/telemetry.ts +14 -8
- package/extensions/hud/telemetry/codex-usage/app-server-client.ts +6 -2
- package/extensions/hud/telemetry/codex-usage/format.ts +1 -4
- package/extensions/hud/telemetry/codex-usage/safety.ts +7 -7
- package/extensions/hud/telemetry/codex-usage/types.ts +1 -2
- package/extensions/hud/telemetry/token-switch.ts +2 -7
- package/package.json +11 -7
package/README.md
CHANGED
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
Rinco Pi HUD provides a rich, real-time status footer for Pi TUI sessions. It displays project state, Git metrics, runtime versions, session activity, model usage, token costs, and more — all in a
|
|
15
|
+
Rinco Pi HUD provides a rich, real-time status footer for Pi TUI sessions. It displays project state, Git metrics, runtime versions, session activity, model usage, token costs, and more — all in a responsive four-group or customizable single-line layout. Pi loads the TypeScript extension directly, so no build step is required (`tsconfig.json` sets `noEmit: true` and is used only for `npm run typecheck`).
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **Project state** — Working directory, Git branch, commit, tag, status, diff metrics, and runtime versions.
|
|
20
|
-
- **Session activity** — Model, provider, context usage, tokens, cache, session cost, turn count, and thinking level.
|
|
21
|
-
- **Tool and agent activity** —
|
|
19
|
+
- **Project state** — Working directory, Git branch, commit, tag, status, operation state, diff metrics, and runtime versions.
|
|
20
|
+
- **Session activity** — Model, provider, context usage, independently controlled input/output tokens, cache, session cost, turn count, and thinking level.
|
|
21
|
+
- **Tool and agent activity** — Independent controls for running tools, completed tool counts, active agents, idle state, skills, and MCP server status.
|
|
22
22
|
- **Model quota** — Automatic Codex weekly quota or Token Switch balance display by model provider.
|
|
23
23
|
- **Git awareness** — Branches, detached HEAD, tags, ahead/behind, stash, merge/rebase conflicts, and dirty state.
|
|
24
24
|
- **Runtime detection** — Node, Python, Go, Rust, Java, and 60+ other runtimes with package version parsing.
|
|
25
|
-
- **Configurable layout** —
|
|
25
|
+
- **Configurable layout** — Responsive Project, Session, Activity, and Usage groups by default, or fully customizable single-line templates.
|
|
26
|
+
- **Granular status controls** — Toggle Git operation state, tool runtime/counts, active/idle agents, and input/output tokens separately from `/zentui`.
|
|
26
27
|
- **Extension statuses** — Reads third-party extension statuses and places them by configurable position and color mode.
|
|
27
28
|
- **Safe fallback** — Graceful timeout and error handling; no stale data after session shutdown.
|
|
28
29
|
|
|
@@ -69,6 +70,10 @@ The HUD footer is enabled by default. Run `/zentui` to open the interactive sett
|
|
|
69
70
|
/zentui statusline enable
|
|
70
71
|
/zentui statusline disable
|
|
71
72
|
/zentui statusline toggle
|
|
73
|
+
/zentui row project toggle
|
|
74
|
+
/zentui row session disable
|
|
75
|
+
/zentui row activity enable
|
|
76
|
+
/zentui row usage toggle
|
|
72
77
|
/zentui format clear
|
|
73
78
|
/zentui format "$model · $context · $cost · $git_branch( $git_commit) · $session_duration"
|
|
74
79
|
/codex-status
|
|
@@ -82,24 +87,24 @@ The HUD footer is enabled by default. Run `/zentui` to open the interactive sett
|
|
|
82
87
|
|
|
83
88
|
| Path | Purpose |
|
|
84
89
|
| --- | --- |
|
|
85
|
-
| [`extensions/hud/index.ts`](extensions/hud/index.ts) |
|
|
86
|
-
| [`extensions/hud/config/`](extensions/hud/config/config.ts) | Configuration model, normalization, and persistence |
|
|
87
|
-
| [`extensions/hud/footer/`](extensions/hud/footer/index.ts) | Footer rendering,
|
|
90
|
+
| [`extensions/hud/index.ts`](extensions/hud/index.ts) | Composition root for controllers, shared state, and UI installation |
|
|
91
|
+
| [`extensions/hud/config/`](extensions/hud/config/config.ts) | Configuration model, normalization, migration, and persistence |
|
|
92
|
+
| [`extensions/hud/footer/`](extensions/hud/footer/index.ts) | Footer rendering, semantic grouping, responsive layout, and template parsing |
|
|
88
93
|
| [`extensions/hud/segments/`](extensions/hud/segments/) | State collectors: Git, runtime, MCP, skills, projects, etc. |
|
|
89
94
|
| [`extensions/hud/telemetry/`](extensions/hud/telemetry/format.ts) | Usage formatting, token switch, and Codex subscription client |
|
|
90
|
-
| [`extensions/hud/session/`](extensions/hud/session/) |
|
|
91
|
-
| [`extensions/hud/state/`](extensions/hud/state/) | Aggregated state, telemetry, and project refresh |
|
|
92
|
-
| [`extensions/hud/commands/`](extensions/hud/commands/settings.ts) | `/zentui`
|
|
95
|
+
| [`extensions/hud/session/`](extensions/hud/session/) | Pi event registration, session lifecycle, and live context overlay |
|
|
96
|
+
| [`extensions/hud/state/`](extensions/hud/state/) | Aggregated state, telemetry reducer, and project refresh controller |
|
|
97
|
+
| [`extensions/hud/commands/`](extensions/hud/commands/settings.ts) | `/zentui` settings UI and configuration controller |
|
|
93
98
|
| [`extensions/hud/ui/`](extensions/hud/ui/) | Icons and terminal style utilities |
|
|
94
99
|
| [`docs/footer.md`](docs/footer.md) | Complete footer configuration reference |
|
|
95
100
|
| [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md) | Local development, testing guidance, and pull request checklist |
|
|
96
|
-
| [`tests/`](tests/) | Vitest test suite (
|
|
101
|
+
| [`tests/`](tests/) | Vitest test suite (41 tests across 8 files) |
|
|
97
102
|
|
|
98
103
|
## Customization
|
|
99
104
|
|
|
100
105
|
### Layout
|
|
101
106
|
|
|
102
|
-
The default
|
|
107
|
+
The default layout groups Project, Session, Activity, and Usage information. Long groups wrap at complete segment boundaries with aligned continuation lines. Set `footerFormat` to a template string for a single-line layout:
|
|
103
108
|
|
|
104
109
|
```text
|
|
105
110
|
/zentui format "$cwd( $git_branch)$fill($context)( $tokens)( $cost)"
|
|
@@ -109,14 +114,25 @@ Template variables use `$name` or `${name}` syntax. See the [footer reference](d
|
|
|
109
114
|
|
|
110
115
|
### Segments
|
|
111
116
|
|
|
112
|
-
|
|
117
|
+
Open `/zentui`, then select **Built-in segments** to enable or disable individual statuses. Fine-grained controls include:
|
|
118
|
+
|
|
119
|
+
| Group | Independently controlled statuses |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| Project | Git status, Git operation state (`MERGING`, `REBASING`, etc.), commit, metrics, runtime, package, OS, and user |
|
|
122
|
+
| Session | Model, thinking level, turn count, and duration |
|
|
123
|
+
| Activity | Running tools, completed tool counts, active agents, `Agent idle`, skills, and MCP |
|
|
124
|
+
| Usage | Context, input tokens, output tokens, cache details/hit rate, cost, quota, and time |
|
|
125
|
+
|
|
126
|
+
Existing configs using the former aggregate `tokens`, `toolActivity`, or `agentActivity` switches are migrated automatically. The whole footer can still be controlled with `/zentui statusline enable|disable|toggle`.
|
|
127
|
+
|
|
128
|
+
In the default four-row layout, each semantic row can also be controlled directly:
|
|
113
129
|
|
|
114
130
|
```text
|
|
115
|
-
/zentui
|
|
116
|
-
/zentui statusline disable
|
|
117
|
-
/zentui statusline toggle
|
|
131
|
+
/zentui row <project|session|activity|usage> <enable|disable|toggle>
|
|
118
132
|
```
|
|
119
133
|
|
|
134
|
+
Row switches are persisted in `footerRows`. They do not affect a custom single-line `footerFormat`.
|
|
135
|
+
|
|
120
136
|
### Extension statuses
|
|
121
137
|
|
|
122
138
|
Third-party extensions publish statuses that the HUD footer can display. Configure placement (`left`, `middle`, `right`, `off`) and color mode (`zentui`, `original`) for each extension status key.
|
|
@@ -160,11 +176,10 @@ Check types:
|
|
|
160
176
|
npm run typecheck
|
|
161
177
|
```
|
|
162
178
|
|
|
163
|
-
Verify tests and package contents:
|
|
179
|
+
Verify formatting, types, lint rules, tests, and package contents:
|
|
164
180
|
|
|
165
181
|
```bash
|
|
166
|
-
npm
|
|
167
|
-
npm run typecheck
|
|
182
|
+
npm run verify
|
|
168
183
|
npm run pack:check
|
|
169
184
|
```
|
|
170
185
|
|
package/docs/CONTRIBUTING.md
CHANGED
|
@@ -39,16 +39,20 @@ Pi loads the TypeScript extension directly, so this project has no separate buil
|
|
|
39
39
|
Before submitting a change, run:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npm
|
|
43
|
-
npm run typecheck
|
|
42
|
+
npm run verify
|
|
44
43
|
npm run pack:check
|
|
45
44
|
```
|
|
46
45
|
|
|
46
|
+
`npm run verify` checks Prettier formatting, TypeScript types, ESLint rules, and the Vitest suite.
|
|
47
|
+
|
|
47
48
|
Tests live in `tests/`:
|
|
48
49
|
|
|
49
50
|
- `zentui-status.test.ts` — Config counts, MCP status parsing, and extension status helpers.
|
|
50
51
|
- `codex-usage.test.ts` — Codex payload normalization and model-specific quota formatting.
|
|
51
|
-
- `footer-layout.test.ts` —
|
|
52
|
+
- `footer-layout.test.ts` — Four-group categorized layout, segment wrapping, and narrow-width budget.
|
|
53
|
+
- `footer-groups.test.ts` — Semantic Project, Session, Activity, and Usage segment ordering.
|
|
54
|
+
- `footer-segment-controls.test.ts` — Independent status controls and legacy-config migration.
|
|
55
|
+
- `footer-row-controls.test.ts` — Per-row command parsing, persistence, and configuration defaults.
|
|
52
56
|
- `model-switch-statusline.test.ts` — Model switch statusline integration.
|
|
53
57
|
- `model-usage-refresh.test.ts` — Model usage refresh integration.
|
|
54
58
|
- `token-switch-usage.test.ts` — Token Switch balance formatting.
|
|
@@ -65,10 +69,19 @@ In addition to automated tests, validate HUD behavior in a real Pi TUI across di
|
|
|
65
69
|
|
|
66
70
|
## Code style
|
|
67
71
|
|
|
68
|
-
The project
|
|
72
|
+
The project uses ESLint for code-quality checks and Prettier for deterministic formatting:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm run lint
|
|
76
|
+
npm run lint:fix
|
|
77
|
+
npm run format:check
|
|
78
|
+
npm run format
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Follow the configured conventions:
|
|
69
82
|
|
|
70
83
|
- Use TypeScript ESM and explicit types.
|
|
71
|
-
- Use
|
|
84
|
+
- Use tab indentation, double quotes, and semicolons.
|
|
72
85
|
- Keep extension lifecycle handling clear and release timers and UI state during `session_shutdown`.
|
|
73
86
|
- Do not edit content enclosed by `AUTO-GENERATED` markers manually; regenerate it from the source identified in the marker.
|
|
74
87
|
|
|
@@ -78,32 +91,43 @@ Do not add ignore rules, skip tests, or weaken types merely to bypass a check.
|
|
|
78
91
|
|
|
79
92
|
The HUD extension is organized into functional modules under `extensions/hud/`:
|
|
80
93
|
|
|
81
|
-
- **`index.ts`** —
|
|
94
|
+
- **`index.ts`** — Composition root for controllers, shared state, and UI installation.
|
|
95
|
+
- **`commands/`** — `/zentui` presentation and its configuration-persistence controller.
|
|
82
96
|
- **`config/`** — Configuration model, normalization, and persistence.
|
|
83
|
-
- **`footer/`** — Footer rendering,
|
|
97
|
+
- **`footer/`** — Footer rendering, semantic group construction, responsive layout, and templates.
|
|
84
98
|
- **`segments/`** — State collectors: Git, runtime, MCP, skills, projects, etc.
|
|
99
|
+
- **`session/`** — Pi event registration, lifecycle generations, and live-context throttling.
|
|
100
|
+
- **`state/`** — Shared footer state, telemetry reducer, and project-refresh controller.
|
|
85
101
|
- **`telemetry/`** — Usage formatting, token switch, and Codex subscription client.
|
|
86
|
-
- **`session/`** — Session lifecycle, context, and live context overlay.
|
|
87
|
-
- **`state/`** — Aggregated state, telemetry, and project refresh.
|
|
88
|
-
- **`commands/`** — `/zentui` command and interactive TUI settings.
|
|
89
102
|
- **`ui/`** — Icons and terminal style utilities.
|
|
90
103
|
|
|
91
104
|
Key conventions:
|
|
92
105
|
|
|
93
|
-
- Keep event listeners
|
|
106
|
+
- Keep composition in `index.ts`, Pi event listeners in `session/event-handlers.ts`, and avoid file reads or subprocesses in `render()`.
|
|
94
107
|
- Async results check session generation before applying.
|
|
95
108
|
- Timers should be cleaned up on shutdown and `unref()` where possible.
|
|
96
109
|
- State collectors return explicit `ok` / `error` / `not found` semantics.
|
|
97
110
|
- Use `visibleWidth()` and `truncateToWidth()` for terminal width calculations.
|
|
98
111
|
|
|
112
|
+
## Releases
|
|
113
|
+
|
|
114
|
+
npm releases use GitHub Trusted Publishing through `.github/workflows/publish.yml`; no `NPM_TOKEN` repository secret is required. The workflow has narrowly scoped `id-token: write` permission, verifies the package, and publishes with provenance.
|
|
115
|
+
|
|
116
|
+
1. Update the same version in `package.json` and `package-lock.json`.
|
|
117
|
+
2. Commit and push the release changes to `main`.
|
|
118
|
+
3. Create an annotated tag that exactly matches the package version, for example `git tag -a v1.1.0 -m "v1.1.0"`.
|
|
119
|
+
4. Push the tag with `git push origin v1.1.0`.
|
|
120
|
+
5. Confirm the **Publish npm package** workflow succeeds and verify the version on npm.
|
|
121
|
+
|
|
122
|
+
The tag/version guard fails the workflow before publication if they do not match.
|
|
123
|
+
|
|
99
124
|
## Pull request checklist
|
|
100
125
|
|
|
101
126
|
Before opening a pull request, confirm that:
|
|
102
127
|
|
|
103
128
|
- [ ] The change has a focused scope and contains no unrelated files.
|
|
104
129
|
- [ ] New behavior or bug fixes include appropriate tests.
|
|
105
|
-
- [ ] `npm
|
|
106
|
-
- [ ] `npm run typecheck` passes.
|
|
130
|
+
- [ ] `npm run verify` passes (format, types, lint, and tests).
|
|
107
131
|
- [ ] `npm run pack:check` passes and the package contains the expected files.
|
|
108
132
|
- [ ] Affected HUD behavior was verified in a real Pi TUI.
|
|
109
133
|
- [ ] Related documentation was synchronized from its source of truth.
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
Rinco Pi HUD 为 Pi TUI 会话提供丰富的实时状态脚注,可显示项目状态、Git 指标、运行时版本、会话活动、模型用量、Token
|
|
15
|
+
Rinco Pi HUD 为 Pi TUI 会话提供丰富的实时状态脚注,可显示项目状态、Git 指标、运行时版本、会话活动、模型用量、Token 费用等信息,支持响应式四分组布局或可定制的单行布局。Pi 可直接加载 TypeScript 扩展,无需构建步骤(`tsconfig.json` 设置了 `noEmit: true`,仅用于 `npm run typecheck` 类型检查)。
|
|
16
16
|
|
|
17
17
|
## 功能
|
|
18
18
|
|
|
19
|
-
- **Project state**:当前目录、Git 分支、Commit、Tag
|
|
20
|
-
- **Session activity**:模型、Provider、Context
|
|
21
|
-
- **Tool and agent activity
|
|
19
|
+
- **Project state**:当前目录、Git 分支、Commit、Tag、工作区状态、Git 操作状态、差异指标和运行时版本。
|
|
20
|
+
- **Session activity**:模型、Provider、Context 用量、可独立控制的输入/输出 Token、缓存、会话费用、轮次和 Thinking 等级。
|
|
21
|
+
- **Tool and agent activity**:可分别控制正在运行的 Tool、已完成 Tool 计数、活跃 Agent、空闲状态、Skill 和 MCP Server 状态。
|
|
22
22
|
- **Model quota**:根据当前模型自动切换 Codex 周限额或 Token Switch 余额。
|
|
23
23
|
- **Git awareness**:分支、Detached HEAD、Tag、Ahead/Behind、Stash、合并冲突和脏状态。
|
|
24
24
|
- **Runtime detection**:支持 Node、Python、Go、Rust、Java 等 60+ 运行时,并解析项目清单版本。
|
|
25
|
-
- **Configurable layout
|
|
25
|
+
- **Configurable layout**:默认使用响应式 Project、Session、Activity、Usage 四分组布局,或完全自定义的单行模板。
|
|
26
|
+
- **Granular status controls**:可在 `/zentui` 中分别控制 Git 操作状态、Tool 运行状态/计数、Agent 活跃/空闲状态及输入/输出 Token。
|
|
26
27
|
- **Extension statuses**:读取第三方扩展发布的状态,按配置的位置和颜色模式显示。
|
|
27
28
|
- **Safe fallback**:超时和错误处理优雅,会话关闭后不留过期数据。
|
|
28
29
|
|
|
@@ -69,6 +70,10 @@ HUD 脚注默认启用。运行 `/zentui` 打开交互式设置。
|
|
|
69
70
|
/zentui statusline enable
|
|
70
71
|
/zentui statusline disable
|
|
71
72
|
/zentui statusline toggle
|
|
73
|
+
/zentui row project toggle
|
|
74
|
+
/zentui row session disable
|
|
75
|
+
/zentui row activity enable
|
|
76
|
+
/zentui row usage toggle
|
|
72
77
|
/zentui format clear
|
|
73
78
|
/zentui format "$model · $context · $cost · $git_branch( $git_commit) · $session_duration"
|
|
74
79
|
/codex-status
|
|
@@ -82,24 +87,24 @@ HUD 脚注默认启用。运行 `/zentui` 打开交互式设置。
|
|
|
82
87
|
|
|
83
88
|
| 路径 | 说明 |
|
|
84
89
|
| --- | --- |
|
|
85
|
-
| [`extensions/hud/index.ts`](../extensions/hud/index.ts) |
|
|
86
|
-
| [`extensions/hud/config/`](../extensions/hud/config/config.ts) |
|
|
87
|
-
| [`extensions/hud/footer/`](../extensions/hud/footer/index.ts) |
|
|
90
|
+
| [`extensions/hud/index.ts`](../extensions/hud/index.ts) | Controller、共享状态与 UI 安装的组合入口 |
|
|
91
|
+
| [`extensions/hud/config/`](../extensions/hud/config/config.ts) | 配置模型、归一化、迁移与持久化 |
|
|
92
|
+
| [`extensions/hud/footer/`](../extensions/hud/footer/index.ts) | 脚注渲染、语义分组、响应式布局与模板解析 |
|
|
88
93
|
| [`extensions/hud/segments/`](../extensions/hud/segments/) | 状态采集器:Git、运行时、MCP、Skill、项目等 |
|
|
89
94
|
| [`extensions/hud/telemetry/`](../extensions/hud/telemetry/format.ts) | 用量格式化、Token Switch 与 Codex 订阅客户端 |
|
|
90
|
-
| [`extensions/hud/session/`](../extensions/hud/session/) |
|
|
91
|
-
| [`extensions/hud/state/`](../extensions/hud/state/) |
|
|
92
|
-
| [`extensions/hud/commands/`](../extensions/hud/commands/settings.ts) | `/zentui`
|
|
95
|
+
| [`extensions/hud/session/`](../extensions/hud/session/) | Pi 事件注册、会话生命周期与实时 Context 覆盖 |
|
|
96
|
+
| [`extensions/hud/state/`](../extensions/hud/state/) | 聚合状态、Telemetry Reducer 与项目刷新 Controller |
|
|
97
|
+
| [`extensions/hud/commands/`](../extensions/hud/commands/settings.ts) | `/zentui` 设置界面与配置 Controller |
|
|
93
98
|
| [`extensions/hud/ui/`](../extensions/hud/ui/) | 图标与终端样式工具 |
|
|
94
99
|
| [`docs/footer.md`](footer.md) | 完整脚注配置参考 |
|
|
95
100
|
| [`docs/CONTRIBUTING.md`](CONTRIBUTING.md) | 本地开发、测试规范和 PR 检查清单 |
|
|
96
|
-
| [`tests/`](../tests/) | Vitest 测试套件(
|
|
101
|
+
| [`tests/`](../tests/) | Vitest 测试套件(41 个测试用例,8 个文件) |
|
|
97
102
|
|
|
98
103
|
## 定制
|
|
99
104
|
|
|
100
105
|
### 布局
|
|
101
106
|
|
|
102
|
-
|
|
107
|
+
默认布局将信息分为 Project、Session、Activity 和 Usage 四组;超长分组会在完整状态项边界处换行,并保持续行对齐。设置 `footerFormat` 模板字符串可切换为单行布局:
|
|
103
108
|
|
|
104
109
|
```text
|
|
105
110
|
/zentui format "$cwd( $git_branch)$fill($context)( $tokens)( $cost)"
|
|
@@ -109,14 +114,25 @@ HUD 脚注默认启用。运行 `/zentui` 打开交互式设置。
|
|
|
109
114
|
|
|
110
115
|
### 状态段
|
|
111
116
|
|
|
112
|
-
|
|
117
|
+
运行 `/zentui` 并进入 **Built-in segments**,即可启用或禁用单个状态:
|
|
118
|
+
|
|
119
|
+
| 分组 | 可独立控制的状态 |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| Project | Git 状态、Git 操作状态(`MERGING`、`REBASING` 等)、Commit、差异指标、运行时、包版本、OS 和用户 |
|
|
122
|
+
| Session | 模型、Thinking 等级、轮次和会话时长 |
|
|
123
|
+
| Activity | 正在运行的 Tool、已完成 Tool 计数、活跃 Agent、`Agent idle`、Skill 和 MCP |
|
|
124
|
+
| Usage | Context、输入 Token、输出 Token、缓存详情/命中率、费用、限额和时间 |
|
|
125
|
+
|
|
126
|
+
使用旧版聚合开关 `tokens`、`toolActivity` 或 `agentActivity` 的配置会自动迁移。仍可通过 `/zentui statusline enable|disable|toggle` 控制整个脚注。
|
|
127
|
+
|
|
128
|
+
默认四行布局中的每个语义行也可以通过命令单独控制:
|
|
113
129
|
|
|
114
130
|
```text
|
|
115
|
-
/zentui
|
|
116
|
-
/zentui statusline disable
|
|
117
|
-
/zentui statusline toggle
|
|
131
|
+
/zentui row <project|session|activity|usage> <enable|disable|toggle>
|
|
118
132
|
```
|
|
119
133
|
|
|
134
|
+
行开关会持久化到 `footerRows`。使用自定义单行 `footerFormat` 时,这些开关不生效。
|
|
135
|
+
|
|
120
136
|
### 扩展状态
|
|
121
137
|
|
|
122
138
|
第三方扩展发布的状态可由 HUD 脚注显示。可为每个扩展状态键配置位置(`left`、`middle`、`right`、`off`)和颜色模式(`zentui`、`original`)。
|
|
@@ -160,11 +176,10 @@ npm test
|
|
|
160
176
|
npm run typecheck
|
|
161
177
|
```
|
|
162
178
|
|
|
163
|
-
|
|
179
|
+
验证格式、类型、Lint、测试与发布内容:
|
|
164
180
|
|
|
165
181
|
```bash
|
|
166
|
-
npm
|
|
167
|
-
npm run typecheck
|
|
182
|
+
npm run verify
|
|
168
183
|
npm run pack:check
|
|
169
184
|
```
|
|
170
185
|
|
package/docs/footer.md
CHANGED
|
@@ -2,46 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
## Default layout
|
|
4
4
|
|
|
5
|
-
When `footerFormat` is empty, the HUD displays
|
|
5
|
+
When `footerFormat` is empty, the HUD displays four semantic groups:
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Project · pi-sakura · main · 24.18
|
|
9
|
+
Session · gpt-5.3 · Thinking level: high · Turn 8
|
|
10
|
+
Activity · Agent idle · Skill 2/3 · MCP 2/2
|
|
11
|
+
Usage · 35%/200k · ↑ 4.2k · ↓ 1.1k · $ 0.030
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
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.
|
|
15
|
+
|
|
16
|
+
Control each default-layout row independently:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
/zentui row project enable
|
|
20
|
+
/zentui row session disable
|
|
21
|
+
/zentui row activity toggle
|
|
22
|
+
/zentui row usage toggle
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
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`.
|
|
14
26
|
|
|
15
27
|
## Built-in status segments
|
|
16
28
|
|
|
17
|
-
| Key | Default |
|
|
29
|
+
| Key | Default | Group | Description |
|
|
18
30
|
| --- | --- | --- | --- |
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
| `packageVersion` | off |
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
31
|
+
| `cwd` | on | Project | Current working directory |
|
|
32
|
+
| `gitBranch` | on | Project | Branch name or `HEAD` when detached |
|
|
33
|
+
| `gitStatus` | on | Project | Conflicts, staged, modified, untracked, stash, ahead/behind |
|
|
34
|
+
| `gitState` | on | Project | Git operation state such as `MERGING` or `REBASING` |
|
|
35
|
+
| `gitCounts` | off | Project | Numeric counts embedded in ahead/behind and stash status |
|
|
36
|
+
| `gitCommit` | off | Project | Short commit hash and optional exact tag |
|
|
37
|
+
| `gitMetrics` | off | Project | Added/deleted lines from `git diff HEAD --numstat` |
|
|
38
|
+
| `runtime` | on | Project | Detected language/build system and tool version |
|
|
39
|
+
| `packageVersion` | off | Project | Project manifest version |
|
|
40
|
+
| `configCounts` | off | Project | Instruction files and installed Pi packages count |
|
|
41
|
+
| `os` | on | Project | OS icon/text per platform |
|
|
42
|
+
| `username` | off | Project | `user@hostname` |
|
|
43
|
+
| `sessionName` | on | Session | Current Pi session name |
|
|
44
|
+
| `model` | on | Session | Provider and model ID |
|
|
45
|
+
| `thinking` | on | Session | Thinking level when reasoning-capable |
|
|
46
|
+
| `turnCount` | on | Session | Current turn index |
|
|
47
|
+
| `sessionDuration` | off | Session | Current session duration |
|
|
48
|
+
| `runningTools` | on | Activity | Currently running native tools and elapsed time |
|
|
49
|
+
| `toolCounts` | on | Activity | Cumulative completed native-tool counts |
|
|
50
|
+
| `activeAgents` | on | Activity | Active primary agent runs |
|
|
51
|
+
| `agentIdle` | on | Activity | `Agent idle` when no primary agent run is active |
|
|
52
|
+
| `skills` | on | Activity | Active/available skills count, e.g. `Skill 1/3` |
|
|
53
|
+
| `mcp` | on | Activity | MCP connected/total servers |
|
|
54
|
+
| `context` | on | Usage | Context percentage, window size, and/or gauge |
|
|
55
|
+
| `inputTokens` | on | Usage | Cumulative input tokens |
|
|
56
|
+
| `outputTokens` | on | Usage | Cumulative output tokens |
|
|
57
|
+
| `cacheDetails` | on | Usage | Cache read/write tokens and latest hit rate |
|
|
58
|
+
| `cost` | on | Usage | Cumulative session cost |
|
|
59
|
+
| `codexUsage` | on | Usage | Codex weekly quota remaining |
|
|
60
|
+
| `time` | off | Usage | Current time `HH:MM` |
|
|
45
61
|
|
|
46
62
|
## Template syntax
|
|
47
63
|
|
|
@@ -100,7 +116,7 @@ Clear it:
|
|
|
100
116
|
| `$instruction_files` | `AGENTS.md` + `CLAUDE.md` total |
|
|
101
117
|
| `$agents_files` | `AGENTS.md` count |
|
|
102
118
|
| `$claude_files` | `CLAUDE.md` count |
|
|
103
|
-
| `$skills` | Active/available skills, e.g.
|
|
119
|
+
| `$skills` | Active/available skills, e.g. `Skill 1/3` |
|
|
104
120
|
| `$active_skills` | Active skills count only |
|
|
105
121
|
| `$extensions` | Installed Pi packages count |
|
|
106
122
|
| `$mcp` | MCP connected/total |
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import {
|
|
3
|
+
type PolishedTuiConfig,
|
|
4
|
+
saveColorSourcesPatch,
|
|
5
|
+
saveContextStylePatch,
|
|
6
|
+
saveExtensionStatusColorMode,
|
|
7
|
+
saveExtensionStatusPlacement,
|
|
8
|
+
saveFooterFormatPatch,
|
|
9
|
+
saveFooterRowsPatch,
|
|
10
|
+
saveFooterSegmentsPatch,
|
|
11
|
+
saveGitBranchPatch,
|
|
12
|
+
saveIconsModePatch,
|
|
13
|
+
savePathDisplayPatch,
|
|
14
|
+
saveSeparatorPatch,
|
|
15
|
+
saveUiFeaturesPatch,
|
|
16
|
+
} from "../config/config.js";
|
|
17
|
+
import { registerZentuiSettingsCommand } from "./settings.js";
|
|
18
|
+
|
|
19
|
+
interface SettingsControllerDeps {
|
|
20
|
+
getConfig: () => PolishedTuiConfig;
|
|
21
|
+
setConfig: (config: PolishedTuiConfig) => void;
|
|
22
|
+
applyConfiguredUi: (ctx: ExtensionContext) => void;
|
|
23
|
+
restartSessionTimer: () => void;
|
|
24
|
+
getActiveExtensionStatuses: () => ReadonlyMap<string, string>;
|
|
25
|
+
requestRender: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Connect the settings UI to persistence without exposing patch mechanics to the extension root. */
|
|
29
|
+
export function registerSettingsController(pi: ExtensionAPI, deps: SettingsControllerDeps): void {
|
|
30
|
+
const updateConfig = (config: PolishedTuiConfig) => {
|
|
31
|
+
deps.setConfig(config);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
registerZentuiSettingsCommand(pi, {
|
|
35
|
+
getConfig: deps.getConfig,
|
|
36
|
+
setColorSources(patch) {
|
|
37
|
+
updateConfig(saveColorSourcesPatch(patch));
|
|
38
|
+
},
|
|
39
|
+
setUiFeatures(patch, ctx) {
|
|
40
|
+
updateConfig(saveUiFeaturesPatch(patch));
|
|
41
|
+
deps.applyConfiguredUi(ctx);
|
|
42
|
+
},
|
|
43
|
+
setFooterRows(patch) {
|
|
44
|
+
updateConfig(saveFooterRowsPatch(patch));
|
|
45
|
+
},
|
|
46
|
+
setFooterSegments(patch) {
|
|
47
|
+
updateConfig(saveFooterSegmentsPatch(patch));
|
|
48
|
+
deps.restartSessionTimer();
|
|
49
|
+
},
|
|
50
|
+
setFooterFormat(value) {
|
|
51
|
+
updateConfig(saveFooterFormatPatch(value));
|
|
52
|
+
deps.restartSessionTimer();
|
|
53
|
+
},
|
|
54
|
+
setIconMode(mode) {
|
|
55
|
+
updateConfig(saveIconsModePatch(mode));
|
|
56
|
+
},
|
|
57
|
+
setContextStyle(style) {
|
|
58
|
+
updateConfig(saveContextStylePatch(style));
|
|
59
|
+
},
|
|
60
|
+
setSeparator(separator) {
|
|
61
|
+
updateConfig(saveSeparatorPatch(separator));
|
|
62
|
+
},
|
|
63
|
+
setPathDisplay(patch) {
|
|
64
|
+
updateConfig(savePathDisplayPatch(patch));
|
|
65
|
+
},
|
|
66
|
+
setGitBranch(patch) {
|
|
67
|
+
updateConfig(saveGitBranchPatch(patch));
|
|
68
|
+
},
|
|
69
|
+
getActiveExtensionStatuses: deps.getActiveExtensionStatuses,
|
|
70
|
+
setExtensionStatusPlacement(key, placement) {
|
|
71
|
+
updateConfig(saveExtensionStatusPlacement(key, placement));
|
|
72
|
+
},
|
|
73
|
+
setExtensionStatusColorMode(key, colorMode) {
|
|
74
|
+
updateConfig(saveExtensionStatusColorMode(key, colorMode));
|
|
75
|
+
},
|
|
76
|
+
requestRender: deps.requestRender,
|
|
77
|
+
});
|
|
78
|
+
}
|