pi-one-ui 0.2.2 → 0.3.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 (61) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.en.md +256 -0
  3. package/README.md +26 -25
  4. package/extensions/app/commands/settings-previews.ts +3 -3
  5. package/extensions/app/config/renderer.ts +12 -23
  6. package/extensions/app/config/shell.ts +122 -426
  7. package/extensions/app/config/store.ts +23 -92
  8. package/extensions/app/overlay/selector-border.ts +5 -5
  9. package/extensions/app/ownership.ts +1 -1
  10. package/extensions/app/panel.ts +18 -19
  11. package/extensions/app/presets.ts +1 -2
  12. package/extensions/app/runtime/tui-runtime.ts +31 -31
  13. package/extensions/features/context-inspector/index.ts +3 -3
  14. package/extensions/features/session-reference/index.ts +5 -5
  15. package/extensions/features/subagent-autocomplete.ts +1 -1
  16. package/extensions/layouts/context/index.ts +9 -12
  17. package/extensions/layouts/context/renderer/compact-mode.ts +24 -24
  18. package/extensions/layouts/context/renderer/default-mode.ts +21 -16
  19. package/extensions/layouts/context/renderer/index.ts +24 -24
  20. package/extensions/layouts/context/renderer/mouse/hover.ts +6 -6
  21. package/extensions/layouts/context/renderer/mouse/interaction.ts +35 -35
  22. package/extensions/layouts/context/renderer/mouse/packets.ts +3 -2
  23. package/extensions/layouts/context/renderer/mouse/scroll.ts +2 -2
  24. package/extensions/layouts/context/renderer/tool/diff/diff-component.ts +2 -1
  25. package/extensions/layouts/context/renderer/tool/diff/diff-edit-render.ts +21 -21
  26. package/extensions/layouts/context/renderer/tool/diff/diff-header.ts +4 -4
  27. package/extensions/layouts/context/renderer/tool/diff/diff-highlight.ts +6 -6
  28. package/extensions/layouts/context/renderer/tool/diff/diff-inline.ts +1 -1
  29. package/extensions/layouts/context/renderer/tool/diff/diff-layout.ts +18 -18
  30. package/extensions/layouts/context/renderer/tool/diff/diff-limits.ts +5 -5
  31. package/extensions/layouts/context/renderer/tool/diff/diff-palette.ts +3 -3
  32. package/extensions/layouts/context/renderer/tool/diff/diff-presentation.ts +1 -1
  33. package/extensions/layouts/context/renderer/tool/diff/diff-renderer.ts +2 -1
  34. package/extensions/layouts/context/renderer/tool/diff/diff-write-render.ts +31 -31
  35. package/extensions/layouts/context/renderer/tool/diff/index.ts +4 -4
  36. package/extensions/layouts/context/renderer/tool/diff/line-width-safety.ts +1 -1
  37. package/extensions/layouts/context/renderer/tool/diff/write-execution.ts +1 -1
  38. package/extensions/layouts/context/renderer/tool/grouping.ts +12 -12
  39. package/extensions/layouts/context/renderer/tool/message-display.ts +2 -2
  40. package/extensions/layouts/context/renderer/tool/result.ts +199 -19
  41. package/extensions/layouts/context/summary/core.ts +1 -0
  42. package/extensions/layouts/context/summary/index.ts +3 -3
  43. package/extensions/layouts/context/thinking/compact-thinking.ts +12 -13
  44. package/extensions/layouts/editor/accent-rail-editor.ts +5 -5
  45. package/extensions/layouts/editor/controller.ts +4 -4
  46. package/extensions/layouts/editor/editor-metadata-format.ts +4 -4
  47. package/extensions/layouts/editor/factory.ts +3 -3
  48. package/extensions/layouts/editor/index.ts +7 -7
  49. package/extensions/layouts/editor/minimalist-editor.ts +1 -1
  50. package/extensions/layouts/editor/ui.ts +7 -7
  51. package/extensions/layouts/footer/controller.ts +3 -3
  52. package/extensions/layouts/footer/footer.ts +21 -21
  53. package/extensions/layouts/footer/index.ts +8 -8
  54. package/extensions/layouts/header/index.ts +1 -1
  55. package/extensions/layouts/header/startup-header.ts +3 -2
  56. package/extensions/layouts/working-line/controller.ts +6 -6
  57. package/extensions/services/project-refresh.ts +2 -2
  58. package/extensions/services/session-state.ts +1 -1
  59. package/extensions/shared/format.ts +2 -2
  60. package/package.json +17 -10
  61. package/extensions/features/legacy/working-message.ts +0 -226
package/CHANGELOG.md ADDED
@@ -0,0 +1,51 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.3.1] - 2026-08-31
10
+
11
+ ### Changed
12
+
13
+ - Unified the test suite on Vitest and reorganized tests into domain-oriented directories.
14
+
15
+ ### Fixed
16
+
17
+ - Keep `/oneui` open and focused during in-place Editor changes, restore effective values after persistence failures, and position the panel closer to the top.
18
+ - Reduced global tool expansion latency and preserved pi-subagents' dedicated live progress renderer instead of wrapping and grouping it as a generic tool.
19
+
20
+ ## [0.3.0] - 2026-08-30
21
+
22
+ ### Added
23
+
24
+ - Added a maintained English README with bidirectional language navigation.
25
+
26
+ ### Changed
27
+
28
+ - Use `~/.pi/agent/pi-one-ui.json` as the only configuration source.
29
+ - Persist settings with the canonical v1 `components` and `renderer` structure.
30
+
31
+ ### Removed
32
+
33
+ - Removed automatic loading and migration of `pi-mine-ui.json`, `zentui.json`, and `claude-code-style.json`.
34
+ - Removed legacy flat configuration fields, old style identifiers, and WorkingLine aliases.
35
+ - Removed the legacy `enableWorkingMessage` renderer option.
36
+
37
+ ### Migration
38
+
39
+ - Before upgrading, recreate or translate supported settings into the canonical `components` and `renderer` structure in `~/.pi/agent/pi-one-ui.json`.
40
+ - Use `/oneui` to write settings in the canonical format, then run `/reload`.
41
+
42
+ ## [0.2.2] - 2026-08-29
43
+
44
+ ### Fixed
45
+
46
+ - Reduced rendering lag when expanding settled tool groups by reusing cached child output.
47
+
48
+ [Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.3.1...HEAD
49
+ [0.3.1]: https://github.com/kerolt/pi-one-ui/compare/v0.3.0...v0.3.1
50
+ [0.3.0]: https://github.com/kerolt/pi-one-ui/compare/v0.2.2...v0.3.0
51
+ [0.2.2]: https://github.com/kerolt/pi-one-ui/compare/v0.2.1...v0.2.2
package/README.en.md ADDED
@@ -0,0 +1,256 @@
1
+ # pi-one-ui
2
+
3
+ [![npm version](https://img.shields.io/npm/v/pi-one-ui?style=flat-square)](https://www.npmjs.com/package/pi-one-ui)
4
+ [![Node.js](https://img.shields.io/badge/Node.js-%E2%89%A522.19-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
5
+ [![License](https://img.shields.io/github/license/kerolt/pi-one-ui?style=flat-square)](./LICENSE)
6
+
7
+ [简体中文](./README.md) | English
8
+
9
+ `pi-one-ui` is a unified TUI extension package for [Pi](https://pi.dev). It started as an effort to build a simple and polished terminal interface by combining, at the source level:
10
+
11
+ - the terminal shell capabilities of [pi-zentui](https://github.com/lmilojevicc/pi-zentui)
12
+ - the conversation rendering and productivity features of [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions)
13
+
14
+ The result is a single installable and configurable Pi package that continues to evolve through module refactoring, tighter ownership, and independent improvements.
15
+
16
+ ## Features
17
+
18
+ ### Unified interface layout
19
+
20
+ `pi-one-ui` organizes the Pi interface into the following layouts:
21
+
22
+ ```text
23
+ Header → Context → WorkingLine → Editor → Footer
24
+ ```
25
+
26
+ - **Header**: startup information, logo, and shortcut hints.
27
+ - **Context**: the conversation area, including user messages, assistant messages, thinking, tools, diffs, Markdown, and summaries.
28
+ - **WorkingLine**: working state, spinner, token/thought/elapsed information, and turn summaries.
29
+ - **Editor**: input editor, completion, metadata, Accent Rail, and Minimalist styles.
30
+ - **Footer**: current directory, Git, runtime, token, cost, and extension status information.
31
+ - **Overlay**: temporary interfaces such as the settings panel and Context Inspector, managed by a shared OverlayManager.
32
+
33
+ ### Built-in functionality
34
+
35
+ | Feature | Description | Entry point |
36
+ | --- | --- | --- |
37
+ | Unified settings panel | Organizes settings by Header, Context, WorkingLine, Editor, Footer, and Features | `/oneui` |
38
+ | Context Inspector | Shows context usage and previews the system prompt, memory, skills, tools, and messages | `/context` |
39
+ | Session reference | Searches previous Pi sessions or SubAgents and injects their useful context | `@` completion |
40
+ | Subagent autocomplete | Completes SubAgent names and delegation hints | `@` completion |
41
+ | Tool / Diff renderer | Provides unified rendering for tool calls, results, collapsed content, and Edit/Write diffs | Automatic |
42
+ | Subagent live renderer | Preserves pi-subagents' dedicated progress cards and keeps them out of generic tool groups | Automatic |
43
+ | Markdown enhancement | Adds Mermaid, admonitions, URL linking, and related rendering improvements | Automatic |
44
+ | Built-in themes | Provides CC Dark and CC Light themes | `/theme` |
45
+ | Compatibility aliases | Optionally provides common command aliases | `/clear`, `/exit` |
46
+
47
+ ## Quick start
48
+
49
+ ### Requirements
50
+
51
+ - Node.js `>=22.19.0`
52
+ - Pi and related runtime packages `>=0.84.0`
53
+
54
+ ### Install from npm
55
+
56
+ ```bash
57
+ pi install npm:pi-one-ui
58
+ ```
59
+
60
+ ### Install from GitHub
61
+
62
+ ```bash
63
+ pi install git:github.com/kerolt/pi-one-ui
64
+ ```
65
+
66
+ After installation, reload extensions in Pi:
67
+
68
+ ```text
69
+ /reload
70
+ ```
71
+
72
+ Then open the unified settings panel:
73
+
74
+ ```text
75
+ /oneui
76
+ ```
77
+
78
+ ## Configuration
79
+
80
+ The configuration file is located at:
81
+
82
+ ```text
83
+ ~/.pi/agent/pi-one-ui.json
84
+ ```
85
+
86
+ Using the `/oneui` settings panel is recommended. The panel uses a top-centered layout, stays open while Editor enablement or style changes are applied, restores focus after Editor replacement, and restores the effective list value when persistence fails. The current configuration uses the v1 structure, for example:
87
+
88
+ ```json
89
+ {
90
+ "version": 1,
91
+ "components": {
92
+ "editor": {
93
+ "enabled": true,
94
+ "style": "opencode"
95
+ },
96
+ "userMessages": {
97
+ "enabled": true,
98
+ "style": "framed"
99
+ },
100
+ "workingLine": {
101
+ "enabled": true
102
+ },
103
+ "footer": {
104
+ "style": "starship"
105
+ }
106
+ },
107
+ "renderer": {
108
+ "mode": "on",
109
+ "diffViewMode": "auto"
110
+ }
111
+ }
112
+ ```
113
+
114
+ Available layout and renderer options may change between versions, so prefer configuring them through `/oneui`.
115
+
116
+ ### Canonical configuration policy
117
+
118
+ `pi-one-ui` reads and writes only:
119
+
120
+ ```text
121
+ ~/.pi/agent/pi-one-ui.json
122
+ ```
123
+
124
+ It does not automatically read, merge, or migrate historical configuration files, and it does not parse legacy flat fields or old style identifiers. If the file does not exist, runtime defaults are used in memory. The file is created only after the first settings change through `/oneui`. All persisted changes use the current v1 `components` and `renderer` structure.
125
+
126
+ ## Upstream origins and project evolution
127
+
128
+ `pi-one-ui` originally combined source from the following open-source projects. Many thanks to their maintainers and contributors for providing the initial foundation.
129
+
130
+ | Upstream project | Capabilities incorporated into `pi-one-ui` | Reference baseline |
131
+ | --- | --- | --- |
132
+ | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship-style Footer, Opencode-style Editor, layouts, and shell capabilities | v0.21.0, commit `5341b38` |
133
+ | [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) | Claude Code-style Context renderer, Tool/Diff rendering, Context Inspector, and references | v0.8.67, commit `dba37e5` |
134
+
135
+ Production code lives in `extensions/`. The project has since unified its entry point, configuration storage, lifecycle, layout ownership, overlays, and input routing. The current implementation is no longer equivalent to either upstream project and does not automatically track upstream changes.
136
+
137
+ The upstream projects provided the original foundation. Continued development focuses on turning these capabilities into one coherent product with clear seams and sustainable maintenance.
138
+
139
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for detailed module boundaries, event flow, and ownership conventions.
140
+
141
+ ## Local development
142
+
143
+ ### Clone the repository
144
+
145
+ ```bash
146
+ git clone https://github.com/kerolt/pi-one-ui.git
147
+ cd pi-one-ui
148
+ npm install
149
+ ```
150
+
151
+ Node.js `>=22.19.0` is required. If multiple Node.js versions are installed, switch to a compatible version first.
152
+
153
+ ### Run in development mode
154
+
155
+ Start Pi directly with the current source:
156
+
157
+ ```bash
158
+ npm run pi:dev
159
+ ```
160
+
161
+ This is equivalent to:
162
+
163
+ ```bash
164
+ pi --no-extensions -e ./extensions/index.ts
165
+ ```
166
+
167
+ You can also install the current package as a local link:
168
+
169
+ ```bash
170
+ npm run pi:install-local
171
+ ```
172
+
173
+ After changing the source, run the following command in Pi:
174
+
175
+ ```text
176
+ /reload
177
+ ```
178
+
179
+ ### Development commands
180
+
181
+ | Command | Purpose |
182
+ | --- | --- |
183
+ | `npm install` | Install dependencies |
184
+ | `npm run format` | Format source, tests, and configuration files |
185
+ | `npm run check` | Check formatting and import organization |
186
+ | `npm run fix` | Fix formatting and organize imports |
187
+ | `npm run typecheck` | Run TypeScript type checking |
188
+ | `npm test` | Run all tests with Vitest |
189
+ | `npm run pack:check` | Preview the npm package contents |
190
+ | `npm run verify` | Run Biome checks, type checking, and all tests |
191
+
192
+ Before submitting changes, run at least:
193
+
194
+ ```bash
195
+ npm run verify
196
+ npm run pack:check
197
+ ```
198
+
199
+ ### Test organization
200
+
201
+ All tests run through Vitest and are organized into domain directories:
202
+
203
+ - `tests/config/`: canonical configuration, storage, and compatibility boundaries.
204
+ - `tests/context/`: Context content, tools, diffs, thinking, and mouse interaction.
205
+ - `tests/header/`, `tests/working-line/`, `tests/editor/`, and `tests/footer/`: Layout behavior and lifecycle coverage.
206
+ - `tests/runtime/`, `tests/overlay/`, and `tests/integration/`: runtime infrastructure, overlays, and the composed entry point.
207
+ - `tests/services/`: Git, runtime, project, session, and telemetry data.
208
+ - `tests/shell/`: remaining layout lifecycle glue and standalone compatibility.
209
+ - `tests/support/` and `tests/fixtures/`: shared test helpers and fixtures.
210
+
211
+ Changes involving the TUI lifecycle should specifically cover reloads, session tree rebuilds, compaction, regular/fullscreen TUI modes, headless mode, overlays, and third-party patch ownership.
212
+
213
+ ## Releases
214
+
215
+ User-visible changes and upgrade notes are maintained in [CHANGELOG.md](./CHANGELOG.md). Changes under development belong in `Unreleased` and are moved to a versioned section only during a release.
216
+
217
+ The project uses GitHub Actions for continuous integration and npm publishing:
218
+
219
+ - [`.github/workflows/ci.yml`](./.github/workflows/ci.yml) runs complete verification for pull requests and pushes to `main`.
220
+ - [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) publishes to npm when a `v*.*.*` tag is pushed.
221
+
222
+ To publish a new version:
223
+
224
+ ```bash
225
+ # Ensure main is checked out and up to date
226
+ git switch main
227
+ git pull --ff-only origin main
228
+
229
+ # Run release checks
230
+ npm ci
231
+ npm run verify
232
+ npm run pack:check
233
+
234
+ # Select the SemVer increment
235
+ npm version patch # Backward-compatible fixes, for example 0.2.1 -> 0.2.2
236
+ # npm version minor # New features or breaking changes while the project is on 0.x
237
+ # npm version major # Breaking changes after a stable 1.x release
238
+
239
+ # Push the release commit and tag
240
+ git push origin main --follow-tags
241
+ ```
242
+
243
+ After the tag is pushed, the publish workflow verifies that the tag matches `package.json`, runs the full verification suite again, and publishes the public package through npm Trusted Publishing with provenance. Published npm versions cannot be overwritten, so never reuse an existing version or tag.
244
+
245
+ ## Contributing
246
+
247
+ GitHub issues and contributions are welcome. When submitting changes:
248
+
249
+ 1. Keep each commit focused on one primary purpose.
250
+ 2. Use a concise Conventional Commit message, for example `fix: prevent settings panel freeze after editor toggle`.
251
+ 3. Add or update tests for behavioral changes.
252
+ 4. Run `npm run verify` and `npm run pack:check` before submitting.
253
+
254
+ ## License
255
+
256
+ This project is released under the [MIT License](./LICENSE).
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  [![Node.js](https://img.shields.io/badge/Node.js-%E2%89%A522.19-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org/)
5
5
  [![License](https://img.shields.io/github/license/kerolt/pi-one-ui?style=flat-square)](./LICENSE)
6
6
 
7
+ 简体中文 | [English](./README.en.md)
8
+
7
9
  `pi-one-ui` 是一个面向 [Pi](https://pi.dev) 的统一 TUI 扩展包。项目的初衷是希望打造一个简单美观的 TUI 界面,最初通过源码级融合,将:
8
10
 
9
11
  - [pi-zentui](https://github.com/lmilojevicc/pi-zentui)`pi-zentui` 的终端外壳能力
@@ -37,6 +39,7 @@ Header → Context → WorkingLine → Editor → Footer
37
39
  | Session reference | 搜索并注入历史 Pi session 或 SubAgent 的有效上下文 | `@` 补全 |
38
40
  | Subagent autocomplete | 提供 SubAgent 名称补全和委派提示 | `@` 补全 |
39
41
  | Tool / Diff renderer | 工具调用、结果、折叠内容和 Edit/Write diff 的统一展示 | 自动生效 |
42
+ | Subagent live renderer | 保留 pi-subagents 专用进度卡,并避免纳入通用工具分组 | 自动生效 |
40
43
  | Markdown enhancement | 支持 Mermaid、提示框和 URL 链接化等增强渲染 | 自动生效 |
41
44
  | Built-in themes | 提供 CC Dark 和 CC Light 主题 | `/theme` |
42
45
  | Compatibility aliases | 可选提供常用命令别名 | `/clear`、`/exit` |
@@ -80,7 +83,7 @@ pi install git:github.com/kerolt/pi-one-ui
80
83
  ~/.pi/agent/pi-one-ui.json
81
84
  ```
82
85
 
83
- 推荐通过 `/oneui` 设置面板修改配置。当前配置仍使用 v1 结构,例如:
86
+ 推荐通过 `/oneui` 设置面板修改配置。面板采用更靠近顶部的居中布局;切换 Editor 启用状态或样式时会保持打开并在 Editor 替换后恢复焦点,持久化失败时则恢复列表中的有效旧值。当前配置仍使用 v1 结构,例如:
84
87
 
85
88
  ```json
86
89
  {
@@ -103,25 +106,22 @@ pi install git:github.com/kerolt/pi-one-ui
103
106
  },
104
107
  "renderer": {
105
108
  "mode": "on",
106
- "diffViewMode": "auto",
107
- "enableWorkingMessage": false
109
+ "diffViewMode": "auto"
108
110
  }
109
111
  }
110
112
  ```
111
113
 
112
114
  不同布局和渲染器的可用选项会随版本变化,建议优先使用 `/oneui` 面板进行配置。
113
115
 
114
- ### 配置迁移与兼容
116
+ ### Canonical 配置约定
115
117
 
116
- `pi-one-ui` 通过统一的 `ConfigStore` 读取和写入配置,并兼容读取以下历史配置文件:
118
+ `pi-one-ui` 只读取和写入:
117
119
 
118
120
  ```text
119
- ~/.pi/agent/zentui.json
120
- ~/.pi/agent/claude-code-style.json
121
- ~/.pi/agent/pi-mine-ui.json
121
+ ~/.pi/agent/pi-one-ui.json
122
122
  ```
123
123
 
124
- 历史配置只作为兼容输入;新的配置写入统一使用 `pi-one-ui.json`。`enableWorkingMessage` 仍可以从旧配置中读取,但统一运行时不会注册第二套 Working Message 实现,WorkingLine 是该 UI seam 的唯一 owner。
124
+ 不会自动读取、合并或迁移其他历史配置文件,也不会解析旧版扁平字段和旧 style 名称。配置文件不存在时,运行时直接使用内置默认值;首次通过 `/oneui` 修改设置时才创建文件。所有持久化修改统一写入当前 v1 的 `components` 和 `renderer` 结构。
125
125
 
126
126
  ## 上游来源与项目演进
127
127
 
@@ -182,14 +182,12 @@ npm run pi:install-local
182
182
  | ---------------------- | ---------------------------------- |
183
183
  | `npm install` | 安装依赖 |
184
184
  | `npm run format` | 格式化源码、测试和配置文件 |
185
- | `npm run format:check` | 检查格式但不修改文件 |
186
- | `npm run lint` | 运行 Biome 检查 |
185
+ | `npm run check` | 检查格式和 import organization |
186
+ | `npm run fix` | 修复格式并整理 imports |
187
187
  | `npm run typecheck` | 执行 TypeScript 类型检查 |
188
- | `npm test` | 运行全部测试 |
189
- | `npm run test:node` | 运行 Node.js test runner 测试 |
190
- | `npm run test:vitest` | 运行 Vitest 测试 |
188
+ | `npm test` | 使用 Vitest 运行全部测试 |
191
189
  | `npm run pack:check` | 预览 npm 实际打包内容 |
192
- | `npm run verify` | 执行格式、lint、类型检查和全部测试 |
190
+ | `npm run verify` | 执行 Biome check、类型检查和全部测试 |
193
191
 
194
192
  提交修改前建议至少运行:
195
193
 
@@ -200,19 +198,22 @@ npm run pack:check
200
198
 
201
199
  ### 测试组织
202
200
 
203
- 测试按照功能领域划分:
201
+ 所有测试统一由 Vitest 执行,并按照功能领域组织在子目录中:
204
202
 
205
- - `tests/context-*`:Context 内容区、Tool、Diff、Thinking 和鼠标交互。
206
- - `tests/working-line-*`:WorkingLine 和 turn summary。
207
- - `tests/editor-*`:Editor、completion、metadata、transfer 和 Accent Rail。
208
- - `tests/footer-*`:Footer、Footer format/layout/status。
209
- - `tests/services-*`:Git、runtime、project、session 和 telemetry。
210
- - `tests/shell-*`:剩余布局生命周期 glue 和 standalone compatibility。
203
+ - `tests/config/`:canonical 配置、存储和兼容性边界。
204
+ - `tests/context/`:Context 内容区、Tool、Diff、Thinking 和鼠标交互。
205
+ - `tests/header/`、`tests/working-line/`、`tests/editor/`、`tests/footer/`:各 Layout 的行为和生命周期。
206
+ - `tests/runtime/`、`tests/overlay/`、`tests/integration/`:运行时基础设施、Overlay 和组合入口。
207
+ - `tests/services/`:Git、runtime、project、session 和 telemetry。
208
+ - `tests/shell/`:剩余布局生命周期 glue 和 standalone compatibility。
209
+ - `tests/support/`、`tests/fixtures/`:共享测试工具和 fixtures。
211
210
 
212
211
  涉及 TUI 生命周期的修改,应特别覆盖 reload、session tree rebuild、compact、regular/fullscreen TUI、headless mode、overlay 和第三方 patch ownership 等场景。
213
212
 
214
213
  ## 发布
215
214
 
215
+ 用户可见变更和升级说明统一记录在 [CHANGELOG.md](./CHANGELOG.md)。开发中的变更先写入 `Unreleased`,正式发版时再归档到对应版本。
216
+
216
217
  项目使用 GitHub Actions 进行持续集成和 npm 发布:
217
218
 
218
219
  - [`.github/workflows/ci.yml`](./.github/workflows/ci.yml):在 Pull Request 和 `main` 分支提交时执行完整验证。
@@ -231,9 +232,9 @@ npm run verify
231
232
  npm run pack:check
232
233
 
233
234
  # 按 SemVer 升级版本
234
- npm version patch # Bug 修复,例如 0.2.1 -> 0.2.2
235
- # npm version minor # 新增兼容功能
236
- # npm version major # 破坏性变更
235
+ npm version patch # 向后兼容的修复,例如 0.2.1 -> 0.2.2
236
+ # npm version minor # 0.x 阶段的新功能或破坏性变更
237
+ # npm version major # 进入稳定 1.x 后的破坏性变更
237
238
 
238
239
  # 推送版本 commit 和 tag
239
240
  git push origin main --follow-tags
@@ -1,12 +1,12 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
3
+ import { renderUserMessageStyle } from "../../layouts/context/message/user-message-styles.ts";
3
4
  import { renderAccentRailEditorFrame } from "../../layouts/editor/accent-rail-editor.ts";
4
- import type { PolishedTuiConfig } from "../config/shell.ts";
5
5
  import { sanitizeEditorMetadataText } from "../../layouts/editor/editor-metadata-format.ts";
6
6
  import { renderMinimalistFrame } from "../../layouts/editor/minimalist-editor.ts";
7
- import { safeThemeFg } from "../../shared/style.ts";
8
7
  import { renderPolishedEditorFrame } from "../../layouts/editor/ui.ts";
9
- import { renderUserMessageStyle } from "../../layouts/context/message/user-message-styles.ts";
8
+ import { safeThemeFg } from "../../shared/style.ts";
9
+ import type { PolishedTuiConfig } from "../config/shell.ts";
10
10
 
11
11
  export const SETTINGS_PREVIEW_MAX_WIDTH = 72;
12
12
  export const SETTINGS_PREVIEW_MAX_ROWS = 10;
@@ -1,5 +1,5 @@
1
1
  import type { CompactThinkingConfig } from "../../layouts/context/thinking/compact-thinking.ts";
2
- import { configStore, type ConfigRecord } from "./store.ts";
2
+ import { type ConfigRecord, configStore } from "./store.ts";
3
3
 
4
4
  export type CompactStyleMode = "on" | "compact" | "off";
5
5
 
@@ -61,7 +61,6 @@ export type Config = {
61
61
  enableSubagentAutocomplete: boolean;
62
62
  enableContextCommand: boolean;
63
63
  enableAgentSummary: boolean;
64
- enableWorkingMessage: boolean;
65
64
  enableAliases: boolean;
66
65
  };
67
66
 
@@ -69,7 +68,7 @@ function rendererConfigFrom(record: ConfigRecord): ConfigRecord {
69
68
  const renderer = record.renderer;
70
69
  return renderer && typeof renderer === "object" && !Array.isArray(renderer)
71
70
  ? (renderer as ConfigRecord)
72
- : record;
71
+ : {};
73
72
  }
74
73
 
75
74
  export const DIFF_VIEW_MODES: DiffViewMode[] = ["auto", "split", "unified"];
@@ -166,8 +165,6 @@ export const DEFAULT_CONFIG: Config = {
166
165
  enableSubagentAutocomplete: true,
167
166
  enableContextCommand: true,
168
167
  enableAgentSummary: true,
169
- // Zentui is the sole owner of Pi's unkeyed working row in pi-one-ui.
170
- enableWorkingMessage: false,
171
168
  enableAliases: true,
172
169
  };
173
170
 
@@ -218,15 +215,8 @@ export function normalizeConfig(input: unknown): Config {
218
215
  unknown
219
216
  >;
220
217
  const mode = source.mode;
221
- // 旧 `enabled: boolean` 配置迁移;compact 已恢复为受支持模式,不再回退 on。
222
- const migratedMode: CompactStyleMode =
223
- mode === "on" || mode === "compact" || mode === "off"
224
- ? mode
225
- : typeof source.enabled === "boolean"
226
- ? source.enabled
227
- ? "on"
228
- : "off"
229
- : "on";
218
+ const normalizedMode: CompactStyleMode =
219
+ mode === "on" || mode === "compact" || mode === "off" ? mode : "on";
230
220
  const excludeRenderers = Array.isArray(source.excludeRenderers)
231
221
  ? [
232
222
  ...new Set(
@@ -238,7 +228,7 @@ export function normalizeConfig(input: unknown): Config {
238
228
  ]
239
229
  : [];
240
230
  return {
241
- mode: migratedMode,
231
+ mode: normalizedMode,
242
232
  excludeRenderers,
243
233
  diffViewMode: pickEnum(
244
234
  source.diffViewMode,
@@ -257,7 +247,7 @@ export function normalizeConfig(input: unknown): Config {
257
247
  300,
258
248
  ),
259
249
  editDiffCollapsedLines: pickPositiveInt(
260
- source.editDiffCollapsedLines ?? source.diffCollapsedLines,
250
+ source.editDiffCollapsedLines,
261
251
  DEFAULT_CONFIG.editDiffCollapsedLines,
262
252
  1,
263
253
  500,
@@ -305,7 +295,6 @@ export function normalizeConfig(input: unknown): Config {
305
295
  enableSubagentAutocomplete: source.enableSubagentAutocomplete !== false,
306
296
  enableContextCommand: source.enableContextCommand !== false,
307
297
  enableAgentSummary: source.enableAgentSummary !== false,
308
- enableWorkingMessage: source.enableWorkingMessage === true,
309
298
  enableAliases: source.enableAliases !== false,
310
299
  };
311
300
  }
@@ -360,7 +349,6 @@ export function formatConfigStatus(source: Config = config): string {
360
349
  `subagentAuto=${source.enableSubagentAutocomplete ? "on" : "off"}`,
361
350
  `context=${source.enableContextCommand ? "on" : "off"}`,
362
351
  `agentSummary=${source.enableAgentSummary ? "on" : "off"}`,
363
- `workingMsg=${source.enableWorkingMessage ? "on" : "off"}`,
364
352
  `aliases=${source.enableAliases ? "on" : "off"}`,
365
353
  ].join(" · ");
366
354
  }
@@ -383,17 +371,18 @@ function loadConfig(): Config {
383
371
  /**
384
372
  * Persists the in-memory renderer projection through the shared store.
385
373
  */
386
- export function saveConfig() {
374
+ export function saveConfig(next: Config = config) {
387
375
  configStore.update((record) => {
388
376
  record.version = 1;
389
- record.renderer = config;
377
+ record.renderer = next;
390
378
  });
391
379
  }
392
380
 
393
- /** 运行时配置写入的唯一入口:合并 + 规范化 + 持久化。 */
381
+ /** 运行时配置写入的唯一入口:规范化并持久化成功后再提交到活动配置。 */
394
382
  export function updateConfig(partial: Partial<Config>): void {
395
- Object.assign(config, normalizeConfig({ ...config, ...partial }));
396
- saveConfig();
383
+ const next = normalizeConfig({ ...config, ...partial });
384
+ saveConfig(next);
385
+ Object.assign(config, next);
397
386
  }
398
387
 
399
388
  /** 整体替换配置(default export 的 configOverride 注入路径;就地覆盖,不持久化)。 */