pi-one-ui 0.5.1 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.6.1] - 2026-09-06
10
+
11
+ ### Added
12
+
13
+ - Built-in `/effort` command for selecting the thinking effort level (interactive picker, argument autocomplete, and model-clamping feedback), gated by `renderer.enableEffortCommand` (default `true`) and toggleable from the `/oneui` Features section. Replaces the need for a standalone local effort extension — remove any self-installed `/effort` extension to avoid duplicate command registration.
14
+ - The `/oneui` settings panel overlay placement is now configurable via the optional top-level `panel` key in `pi-one-ui.json` (`anchor`, `width`, `maxHeight`, `margin`), replacing the previously hardcoded `top-center`/`85%`/`90%` layout. Invalid values fall back to the defaults, and edits apply the next time the panel opens.
15
+
16
+ ## [0.6.0] - 2026-09-05
17
+
18
+ ### Removed
19
+
20
+ - Removed the `colorSource` (`theme`/`terminal`) concept from the Editor, user messages, WorkingLine, selector borders, and Footer. Colors are now always rendered with theme semantics: configured `colors.*` values resolve as theme tokens (ANSI names such as `red` map to semantic tokens like `error`), while hex, 256-color indexes, and `fg:`/`bg:` prefixes still render fixed terminal colors.
21
+ - Removed the terminal-only adaptive border ladder and the Color source setting from `/oneui`.
22
+
23
+ ### Changed
24
+
25
+ - Adaptive Editor borders now prefer the per-level `colors.editorThinking*` configuration, then Pi's native effort coloring, then the default border; thinking labels keep following the border in adaptive mode.
26
+
27
+ ### Migration
28
+
29
+ - Existing `colorSource` fields in `~/.pi/agent/pi-one-ui.json` are ignored at load time and not rewritten. Configurations that relied on `terminal` fixed colors should move those `colors.*` values to hex, a 256-color index, or an `fg:`/`bg:` prefix; ANSI color names now resolve to theme semantic tokens. See [docs/editor-colors.md](./docs/editor-colors.md) for the full color field reference.
30
+
9
31
  ## [0.5.1] - 2026-09-05
10
32
 
11
33
  ### Changed
@@ -93,7 +115,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
93
115
 
94
116
  - Reduced rendering lag when expanding settled tool groups by reusing cached child output.
95
117
 
96
- [Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.5.1...HEAD
118
+ [Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.6.1...HEAD
119
+ [0.6.1]: https://github.com/kerolt/pi-one-ui/compare/v0.6.0...v0.6.1
120
+ [0.6.0]: https://github.com/kerolt/pi-one-ui/compare/v0.5.1...v0.6.0
97
121
  [0.5.1]: https://github.com/kerolt/pi-one-ui/compare/v0.5.0...v0.5.1
98
122
  [0.5.0]: https://github.com/kerolt/pi-one-ui/compare/v0.4.0...v0.5.0
99
123
  [0.4.0]: https://github.com/kerolt/pi-one-ui/compare/v0.3.1...v0.4.0
package/README.en.md CHANGED
@@ -6,43 +6,44 @@
6
6
 
7
7
  [简体中文](./README.md) | English
8
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:
9
+ `pi-one-ui` is a unified TUI extension package for [Pi](https://pi.dev), designed to deliver a clean, beautiful, and efficient terminal experience. It originated as a source-level combination of:
10
10
 
11
- - the terminal shell capabilities of [pi-zentui](https://github.com/lmilojevicc/pi-zentui)
11
+ - the terminal shell and layout capabilities of [pi-zentui](https://github.com/lmilojevicc/pi-zentui)
12
12
  - the conversation rendering and productivity features of [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions)
13
13
 
14
- The result is a single installable and configurable Pi package that continues to evolve through module refactoring, tighter ownership, and independent improvements.
14
+ The result is a single installable and configurable Pi package that continues to evolve through architectural refactoring, strict boundary ownership, and ongoing optimization.
15
15
 
16
16
  ## Features
17
17
 
18
18
  ### Unified interface layout
19
19
 
20
- `pi-one-ui` organizes the Pi interface into the following layouts:
20
+ `pi-one-ui` organizes the Pi interface into a clean hierarchy:
21
21
 
22
22
  ```text
23
23
  Header → Context → WorkingLine → Editor → Footer
24
24
  ```
25
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, live output rate, and turn summaries.
29
- - **Editor**: input editor, completion, metadata, and the Minimalist style (Pi native is one toggle away).
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.
26
+ - **Header**: Startup information, logo, and shortcut hints.
27
+ - **Context**: Conversation content area, including user messages, assistant messages, thinking blocks, tool calls, diffs, Markdown, and turn summaries.
28
+ - **WorkingLine**: Working state indicator, spinner, token/thought/elapsed statistics, live output throughput, and turn summaries.
29
+ - **Editor**: Input editor, completion menu, metadata display, and the Minimalist style (with effortless toggle to Pi native).
30
+ - **Footer**: Current directory, Git status, runtime info, token/cost tracking, and extension statuses.
31
+ - **Overlay**: Temporary views such as the settings panel and Context Inspector, managed centrally by OverlayManager.
32
32
 
33
33
  ### Built-in functionality
34
34
 
35
35
  | Feature | Description | Entry point |
36
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` |
37
+ | Unified settings panel | Centrally manages settings for Header, Context, WorkingLine, Editor, Footer, and Features | `/oneui` |
38
+ | Context Inspector | Shows context usage and previews system prompt, memory, skills, tools, and message contents | `/context` |
39
+ | Session reference | Searches previous Pi sessions or subagents and injects their relevant context | `@` completion |
40
+ | Subagent autocomplete | Provides subagent name completion and delegation hints | `@` completion |
41
+ | Tool / Diff renderer | Unified rendering for tool executions, results, collapsible blocks, and Edit/Write diffs | Automatic |
42
+ | Subagent live renderer | Preserves subagents' dedicated progress cards without grouping them into generic tool calls | Automatic |
43
+ | Markdown enhancement | Adds Mermaid diagrams, admonitions, clickable URL linking, and rendering improvements | Automatic |
44
+ | Built-in themes | Includes CC Dark and CC Light themes | `/theme` |
45
45
  | Compatibility aliases | Optionally provides common command aliases | `/clear`, `/exit` |
46
+ | Effort command | Interactively or directly switch the active model's thinking effort level | `/effort` |
46
47
 
47
48
  ## Quick start
48
49
 
@@ -77,13 +78,22 @@ Then open the unified settings panel:
77
78
 
78
79
  ## Configuration
79
80
 
80
- The configuration file is located at:
81
+ ### Configuration methods
82
+
83
+ `pi-one-ui` uses a single canonical v1 configuration file:
81
84
 
82
85
  ```text
83
86
  ~/.pi/agent/pi-one-ui.json
84
87
  ```
85
88
 
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:
89
+ You can configure the extension in two ways:
90
+
91
+ 1. **Interactive settings panel (recommended)**: Run `/oneui` in Pi to adjust common component toggles, styles, and border modes via a visual menu. Changes take effect immediately and are persisted automatically.
92
+ 2. **Direct JSON editing**: Advanced users can edit the JSON configuration file directly for finer-grained control. After saving edits, run `/reload` in Pi to apply changes. When the file does not exist, safe runtime defaults are used in memory.
93
+
94
+ ### Basic configuration example
95
+
96
+ Below is a typical v1 configuration structure:
87
97
 
88
98
  ```json
89
99
  {
@@ -91,55 +101,60 @@ Using the `/oneui` settings panel is recommended. The panel uses a top-centered
91
101
  "components": {
92
102
  "editor": {
93
103
  "style": "on",
94
- "colorSource": "theme",
95
104
  "borderColorMode": "static"
96
105
  },
97
- "userMessages": {
98
- "enabled": true,
99
- "style": "framed"
106
+ "footer": {
107
+ "style": "starship"
100
108
  },
101
109
  "workingLine": {
102
110
  "enabled": true
103
111
  },
104
- "footer": {
105
- "style": "starship"
112
+ "userMessages": {
113
+ "enabled": true,
114
+ "style": "framed"
106
115
  }
107
116
  },
108
117
  "renderer": {
109
118
  "mode": "on",
110
119
  "diffViewMode": "auto"
120
+ },
121
+ "panel": {
122
+ "anchor": "top-center",
123
+ "width": "85%",
124
+ "maxHeight": "90%",
125
+ "margin": { "top": 6, "right": 1, "bottom": 1, "left": 1 }
111
126
  }
112
127
  }
113
128
  ```
114
129
 
115
- The Editor keeps a single `minimalist` decoration style controlled by `style`: `on` enables the Minimalist decoration, `off` restores Pi's native editor (the border follows the theme and effort coloring by default; when `colors.editorBorder` is explicitly configured, the off mode applies that color through `colorSource`, overriding the native effort coloring). Legacy configurations migrate automatically: `enabled: false` becomes `style: "off"`, and `opencode`/`minimalist` become `style: "on"`; the `styles.opencode` block and the retired `opencode-copy-friendly`/`accent-rail` styles are ignored. `borderColorMode` supports `static` (fixed `colors.editorBorder`) and `adaptive` (border shifts with the effort level); `colorSource` supports `theme` (colors resolved through the active Pi theme tokens) and `terminal` (fixed terminal colors). When `cwd`, the model label, or the static border are not explicitly configured, the theme's `cwd`/`editorModel`/`editorBorder` tokens are used first (they may point to `vars` variables or hex values), falling back to Pi's native defaults when the theme does not define them; the terminal source falls back to Pi's native colors as well when unconfigured (only an explicit terminal color name or hex is rendered fixed). Context-usage information is presented by Footer.
130
+ ### Advanced configuration & documentation guide
116
131
 
117
- The WorkingLine token segment appends live output throughput, such as `⚡12 tok/s`, after a model response has run for at least 500ms. Throughput is calculated independently for the current response and resets on the next `turn_start`; disabling the token segment hides it as well.
132
+ To keep the configuration section clean and focused, in-depth options, template variables, and color references are organized in dedicated documentation:
118
133
 
119
- Available layout and renderer options may change between versions, so prefer configuring them through `/oneui`.
120
-
121
- ### Canonical configuration policy
122
-
123
- `pi-one-ui` reads and writes only:
124
-
125
- ```text
126
- ~/.pi/agent/pi-one-ui.json
127
- ```
128
-
129
- 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.
134
+ - **Component options & layout customization**: see [Editor & Footer Configuration Guide (docs/configuration.md)](./docs/configuration.md)
135
+ - **Editor**: Configure `style` (`on` for Minimalist decoration / `off` for Pi native), `borderColorMode` (`static` or `adaptive` to thinking effort), `modelLabel`, and granular Minimalist displays (directory path format, session name, timer, cost, Git status, etc.).
136
+ - **Footer**: Starship-style layout powered by format templates (`$cwd`, `$git_branch`, `$tokens`, `$cost`, etc.), individual `segments` toggles, customizable separators, and context-usage indicators (gauge or text).
137
+ - **WorkingLine**: Built-in live output throughput tracking (appends e.g. `⚡12 tok/s` when a model response runs for at least 500ms, reset per turn).
138
+ - **Settings panel (`/oneui`) customization**: the optional top-level `panel` section controls the overlay placement and size (all fields default to the values shown in the example above).
139
+ - `anchor`: one of `center`, `top-left`, `top-right`, `bottom-left`, `bottom-right`, `top-center`, `bottom-center`, `left-center`, `right-center`.
140
+ - `width` / `maxHeight`: absolute column/row counts, or percentage strings like `"85%"`.
141
+ - `margin`: distance from the terminal edges — either a single number for all sides, or an object with per-edge `top`/`right`/`bottom`/`left` values.
142
+ - Saved changes apply the next time `/oneui` opens; no `/reload` needed.
143
+ - **Color system & theme customization**: see [Editor Colors Reference (docs/editor-colors.md)](./docs/editor-colors.md)
144
+ - All colors resolve through unified theme semantics. Configured `colors.*` values resolve as theme tokens (adapting automatically across themes), while ANSI names map to semantic tokens (e.g. `red` to `error`). Fixed terminal colors can be specified using hex codes, 256-color indexes, or `fg:`/`bg:` prefixes.
145
+ - Full support for adaptive thinking-effort border colors (from Low to Max) and labels.
146
+ - **Migration from legacy versions**: Field cleanups from 0.5.x/0.6.0 (such as merging `opencode` into `minimalist`, or removing `colorSource`) are covered in [docs/configuration.md: Changes and Migration](./docs/configuration.md#6-变更与迁移).
130
147
 
131
148
  ## Upstream origins and project evolution
132
149
 
133
- `pi-one-ui` originally combined source from the following open-source projects. Many thanks to their maintainers and contributors for providing the initial foundation.
150
+ `pi-one-ui` was originally built upon source code from two open-source projects. We express our sincere appreciation to both upstream projects and their contributors:
134
151
 
135
152
  | Upstream project | Capabilities incorporated into `pi-one-ui` | Reference baseline |
136
153
  | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------- |
137
- | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship-style Footer, Opencode-style Editor, layouts, and shell capabilities | v0.21.0, commit `5341b38` |
154
+ | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship-style Footer, Editor layouts, and shell interaction capabilities | v0.21.0, commit `5341b38` |
138
155
  | [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` |
139
156
 
140
- 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.
141
-
142
- The upstream projects provided the original foundation. Continued development focuses on turning these capabilities into one coherent product with clear seams and sustainable maintenance.
157
+ Production code lives in `extensions/`. `pi-one-ui` has unified the composition entry point, configuration storage, lifecycle management, layout ownership, overlay orchestration, and input routing. The project now evolves independently and no longer tracks upstream changes directly.
143
158
 
144
159
  See [ARCHITECTURE.md](./ARCHITECTURE.md) for detailed module boundaries, event flow, and ownership conventions.
145
160
 
package/README.md CHANGED
@@ -6,43 +6,44 @@
6
6
 
7
7
  简体中文 | [English](./README.en.md)
8
8
 
9
- `pi-one-ui` 是一个面向 [Pi](https://pi.dev) 的统一 TUI 扩展包。项目的初衷是希望打造一个简单美观的 TUI 界面,最初通过源码级融合,将:
9
+ `pi-one-ui` 是面向 [Pi](https://pi.dev) 的统一 TUI 扩展包,旨在打造简洁、美观且高效的终端交互界面。项目最初通过源码级融合,将:
10
10
 
11
- - [pi-zentui](https://github.com/lmilojevicc/pi-zentui)`pi-zentui` 的终端外壳能力
11
+ - [pi-zentui](https://github.com/lmilojevicc/pi-zentui) 的终端外壳与布局能力
12
12
  - [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) 的对话内容渲染及生产力功能
13
13
 
14
- 整合到同一个可安装、可配置的 Pi package 中,并在此基础上持续进行模块重构、职责收敛和独立优化。
14
+ 整合为开箱即用、统一可配置的单一扩展包,并在此基础上持续进行模块重构、职责收敛和体验优化。
15
15
 
16
16
  ## 特性
17
17
 
18
18
  ### 统一的界面布局
19
19
 
20
- `pi-one-ui` 将 Pi 的交互界面划分为以下布局:
20
+ `pi-one-ui` 将 Pi 的交互界面划分为以下布局层级:
21
21
 
22
22
  ```text
23
23
  Header → Context → WorkingLine → Editor → Footer
24
24
  ```
25
25
 
26
26
  - **Header**:启动信息、Logo 和快捷键提示。
27
- - **Context**:对话内容区,包含用户消息、Assistant 消息、Thinking、Tool、Diff、Markdown 和 Summary。
28
- - **WorkingLine**:工作状态、spinner、token/thought/elapsed、实时输出速率和回合摘要。
29
- - **Editor**:输入编辑器、completion、metadata,以及 Minimalist 样式(可切换 Pi 原生)。
30
- - **Footer**:目录、Git、runtime、token、cost 和扩展状态等信息。
31
- - **Overlay**:设置面板、Context Inspector 等临时浮层由统一的 OverlayManager 管理。
27
+ - **Context**:对话内容区,包含用户消息、Assistant 消息、Thinking 思考过程、Tool 执行、Diff 对比、Markdown 及回合摘要。
28
+ - **WorkingLine**:工作状态指示、Spinner、Token/思考时长统计、实时吞吐速率及回合摘要。
29
+ - **Editor**:输入编辑器、补全建议、元数据展示及 Minimalist 极简样式(支持一键切换 Pi 原生)。
30
+ - **Footer**:工作目录、Git 状态、运行时信息、Token/费用统计及扩展状态等。
31
+ - **Overlay**:设置面板、Context Inspector 等临时浮层,统一由 OverlayManager 调度管理。
32
32
 
33
33
  ### 内置功能
34
34
 
35
35
  | 功能 | 说明 | 入口 |
36
36
  | --------------------- | ---------------------------------------------------------------------- | ----------------- |
37
- | 统一设置面板 | 按 Header、Context、WorkingLine、Editor、Footer 和 Features 组织设置 | `/oneui` |
38
- | Context Inspector | 查看上下文占用,并预览 System prompt、Memory、Skills、Tools 和消息内容 | `/context` |
39
- | Session reference | 搜索并注入历史 Pi session 或 SubAgent 的有效上下文 | `@` 补全 |
40
- | Subagent autocomplete | 提供 SubAgent 名称补全和委派提示 | `@` 补全 |
41
- | Tool / Diff renderer | 工具调用、结果、折叠内容和 Edit/Write diff 的统一展示 | 自动生效 |
42
- | Subagent live renderer | 保留 pi-subagents 专用进度卡,并避免纳入通用工具分组 | 自动生效 |
43
- | Markdown enhancement | 支持 Mermaid、提示框和 URL 链接化等增强渲染 | 自动生效 |
44
- | Built-in themes | 提供 CC Dark 和 CC Light 主题 | `/theme` |
37
+ | 统一设置面板 | 集中管理 Header、Context、WorkingLine、Editor、Footer 等组件及功能设置 | `/oneui` |
38
+ | Context Inspector | 查看上下文占用,并预览 System prompt、Memory、Skills、Tools 及消息内容 | `/context` |
39
+ | Session reference | 搜索并引用注入历史 Pi 会话或 Subagent 的有效上下文 | `@` 补全 |
40
+ | Subagent autocomplete | 提供 Subagent 名称补全与委派提示 | `@` 补全 |
41
+ | Tool / Diff renderer | 工具调用、执行结果、折叠内容与 Edit/Write Diff 的统一美化渲染 | 自动生效 |
42
+ | Subagent live renderer | 保留 subagents 专用进度卡片,避免混入通用工具分组 | 自动生效 |
43
+ | Markdown enhancement | 支持 Mermaid 图表、提示框与 URL 链接化等增强渲染 | 自动生效 |
44
+ | Built-in themes | 内置 CC Dark 和 CC Light 主题 | `/theme` |
45
45
  | Compatibility aliases | 可选提供常用命令别名 | `/clear`、`/exit` |
46
+ | Effort command | 交互式或直接切换当前模型的 Thinking 思考档位 | `/effort` |
46
47
 
47
48
  ## 快速开始
48
49
 
@@ -77,14 +78,22 @@ pi install git:github.com/kerolt/pi-one-ui
77
78
 
78
79
  ## 配置
79
80
 
80
- 配置文件位于:
81
+ ### 配置方式
82
+
83
+ `pi-one-ui` 统一使用 Canonical v1 格式的配置文件:
81
84
 
82
85
  ```text
83
86
  ~/.pi/agent/pi-one-ui.json
84
87
  ```
85
88
 
89
+ 提供两种配置途径:
90
+
91
+ 1. **交互式设置面板(推荐)**:在 Pi 会话中运行 `/oneui`,即可在可视化面板中即时调整常用组件开关、样式和边框模式。修改即刻生效并自动持久化。
92
+ 2. **手动编辑配置文件**:高级用户可直接编辑 JSON 配置文件以启用更多细粒度选项。修改保存后,在 Pi 中执行 `/reload` 即可生效。文件不存在时将直接使用内置默认值。
93
+
94
+ ### 基础配置示例
86
95
 
87
- 推荐通过 `/oneui` 设置面板修改配置。面板采用更靠近顶部的居中布局;切换 Editor 开关、颜色源或边框模式时会保持打开并在 Editor 替换后恢复焦点,持久化失败时则恢复列表中的有效旧值。当前配置仍使用 v1 结构,例如:
96
+ 以下为一个典型的 v1 配置文件结构:
88
97
 
89
98
  ```json
90
99
  {
@@ -92,57 +101,62 @@ pi install git:github.com/kerolt/pi-one-ui
92
101
  "components": {
93
102
  "editor": {
94
103
  "style": "on",
95
- "colorSource": "theme",
96
104
  "borderColorMode": "static"
97
105
  },
98
- "userMessages": {
99
- "enabled": true,
100
- "style": "framed"
106
+ "footer": {
107
+ "style": "starship"
101
108
  },
102
109
  "workingLine": {
103
110
  "enabled": true
104
111
  },
105
- "footer": {
106
- "style": "starship"
112
+ "userMessages": {
113
+ "enabled": true,
114
+ "style": "framed"
107
115
  }
108
116
  },
109
117
  "renderer": {
110
118
  "mode": "on",
111
119
  "diffViewMode": "auto"
120
+ },
121
+ "panel": {
122
+ "anchor": "top-center",
123
+ "width": "85%",
124
+ "maxHeight": "90%",
125
+ "margin": { "top": 6, "right": 1, "bottom": 1, "left": 1 }
112
126
  }
113
127
  }
114
128
  ```
115
129
 
116
- Editor 只保留 `minimalist` 一种装饰样式,通过 `style` 开关控制:`on` 启用 Minimalist 装饰,`off` 恢复 Pi 原生编辑器(边框默认跟随主题与 effort 变色;若显式配置了 `colors.editorBorder`,off 模式下也会按 `colorSource` 应用该颜色,覆盖原生 effort 变色)。旧配置的 `enabled: false` 会迁移为 `style: "off"`,`opencode`/`minimalist` 会迁移为 `style: "on"`,`styles.opencode` 嵌套配置与 `opencode-copy-friendly`、`accent-rail` 一并失效。`borderColorMode` 支持 `static`(固定 `colors.editorBorder`)与 `adaptive`(边框随 effort 档位变化);`colorSource` 支持 `theme`(颜色取当前主题 token)与 `terminal`(固定终端色)。cwd、模型名与边框(static)未显式配置时优先使用主题的 `cwd`/`editorModel`/`editorBorder` token(可指向 vars 变量或 hex),主题未定义则回落 Pi 原生默认;terminal 源未配置时同样回落 Pi 原生颜色(配置了终端色名/hex 才固定渲染)。上下文占用相关信息由 Footer 统一展示。
130
+ ### 深度配置与文档指引
117
131
 
118
- WorkingLine 的 token segment 会在一次模型响应持续至少 500ms 后追加实时输出速率,例如 `⚡12 tok/s`。速率按当前响应独立计算,在下一次 `turn_start` 时重置;关闭 token segment 时也会一并隐藏。
132
+ 各项组件开关、模板变量与颜色字段的完整规范拆分收录于独立文档中,便于按需查阅:
119
133
 
120
- 不同布局和渲染器的可用选项会随版本变化,建议优先使用 `/oneui` 面板进行配置。
121
-
122
- ### Canonical 配置约定
123
-
124
- `pi-one-ui` 只读取和写入:
125
-
126
- ```text
127
- ~/.pi/agent/pi-one-ui.json
128
- ```
129
-
130
- 不会自动读取、合并或迁移其他历史配置文件,也不会解析旧版扁平字段和旧 style 名称。配置文件不存在时,运行时直接使用内置默认值;首次通过 `/oneui` 修改设置时才创建文件。所有持久化修改统一写入当前 v1 的 `components` 和 `renderer` 结构。
134
+ - **组件开关与排版定制**:详见 [Editor 与 Footer 配置指南 (docs/configuration.md)](./docs/configuration.md)
135
+ - **Editor**:支持 `style`(`on` 极简装饰 / `off` 原生)、`borderColorMode`(固定色 / 思考档位自适应)、`modelLabel` 及 Minimalist 装饰细节(目录层级、会话名、耗时、费用、Git 状态等)。
136
+ - **Footer**:支持 Starship 风格排版,提供丰富的模板变量(`$cwd`、`$git_branch`、`$tokens`、`$cost` 等),支持通过 `format` 自定义或通过 `segments` 控制各段开关,并可自由配置上下文占用率的展示形式(gauge / text)。
137
+ - **WorkingLine**:内置实时输出速率检测(单次响应持续 >=500ms 自动追加如 `⚡12 tok/s`,按回合独立重置)。
138
+ - **设置面板(`/oneui`)定制**:通过顶层 `panel` 字段控制浮层位置与尺寸,全部字段可省略(缺省值见上文示例)。
139
+ - `anchor`:锚点,支持 `center`、`top-left`、`top-right`、`bottom-left`、`bottom-right`、`top-center`、`bottom-center`、`left-center`、`right-center`。
140
+ - `width` / `maxHeight`:列数 / 行数,或 `"85%"` 形式的百分比字符串。
141
+ - `margin`:距终端边缘的外边距,可以是四边统一数字,也可以是按 `top`/`right`/`bottom`/`left` 分别配置的对象。
142
+ - 修改保存后下次打开 `/oneui` 即生效,无需 `/reload`。
143
+ - **颜色体系与主题定制**:详见 [Editor 颜色配置说明 (docs/editor-colors.md)](./docs/editor-colors.md)
144
+ - 所有颜色统一按 Theme 语义解释,优先解析为当前主题语义 Token(随主题自动切换),ANSI 色名自动映射为语义色(如 `red` 对应 `error`);如需固定色彩,可直接指定 Hex、256 色索引或 `fg:`/`bg:` 前缀。
145
+ - 支持完整的 Thinking 思考档位(Low 至 Max)自适应边框与标签分级配色。
146
+ - **历史版本迁移**:旧版升级带来的字段收敛(如 `opencode` 样式统一合并入 `minimalist`、`colorSource` 双模式移除等)参见 [docs/configuration.md 变更与迁移节](./docs/configuration.md#6-变更与迁移)。
131
147
 
132
148
  ## 上游来源与项目演进
133
149
 
134
- `pi-one-ui` 以以下两个开源项目的源码为初始基础,并对它们进行源码级融合。在此再次感谢两个上游项目及其贡献者,他们为 `pi-one-ui` 提供了最初的实现基础。
150
+ `pi-one-ui` 最初以两个开源项目的源码为基础进行整合。由衷感谢两个上游项目及其贡献者的出色工作:
135
151
 
136
- | 上游项目 | 融入 `pi-one-ui` 的主要能力 | 参照baseline |
152
+ | 上游项目 | 融入 `pi-one-ui` 的主要能力 | 参照 Baseline |
137
153
  | --------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------- |
138
- | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship 风格 Footer、Opencode 风格 Editor、布局和 shell 能力 | v0.21.0,commit `5341b38` |
139
- | [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) | Claude Code 风格 Context renderer、Tool/Diff、Context Inspector 和引用功能 | v0.8.67,commit `dba37e5` |
140
-
141
- 融合后的生产代码位于 `extensions/`。项目已经在原始实现之上统一入口、配置存储、生命周期、Layout ownership、Overlay 和输入路由,并会继续独立演进;当前实现不再等同于任一上游项目,也不会自动跟随上游同步。
154
+ | [pi-zentui](https://github.com/lmilojevicc/pi-zentui) | Starship 风格 Footer、Editor 基础布局与 Shell 交互能力 | v0.21.0,commit `5341b38` |
155
+ | [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions) | Claude Code 风格 Context 渲染器、Tool/Diff 视图、Context Inspector 与会话引用 | v0.8.67,commit `dba37e5` |
142
156
 
143
- 感谢两个上游项目及其贡献者。它们为 `pi-one-ui` 提供了最初的实现基础,而本项目后续的工作重点是将这些能力收敛为一个边界清晰、可持续维护的统一产品。
157
+ 融合后的生产代码位于 `extensions/`。`pi-one-ui` 在原始实现之上完成了入口统一、配置存储规范化、生命周期治理、Layout Ownership 收敛、Overlay 统一调度与输入路由解耦,并持续独立演进。当前实现已完全独立于上游,不依赖也不自动同步上游分支。
144
158
 
145
- 更详细的模块边界、事件流和 ownership 约定参见 [ARCHITECTURE.md](./ARCHITECTURE.md)。
159
+ 更详细的模块边界、事件流与 Ownership 约定参见 [ARCHITECTURE.md](./ARCHITECTURE.md)。
146
160
 
147
161
  ## 本地开发
148
162
 
@@ -0,0 +1,117 @@
1
+ import type {
2
+ OverlayAnchor,
3
+ OverlayMargin,
4
+ SizeValue,
5
+ } from "@earendil-works/pi-tui";
6
+ import { configStore } from "./store.ts";
7
+
8
+ /**
9
+ * Overlay placement for the /oneui settings panel. Mirrors the Pi
10
+ * `OverlayOptions` subset the panel supports; persisted under the
11
+ * top-level `panel` key in `pi-one-ui.json`.
12
+ */
13
+ export type PanelOverlayConfig = {
14
+ anchor: OverlayAnchor;
15
+ width: SizeValue;
16
+ maxHeight: SizeValue;
17
+ margin: OverlayMargin | number;
18
+ };
19
+
20
+ /** Defaults preserve the historically hardcoded /oneui panel placement. */
21
+ export const DEFAULT_PANEL_OVERLAY: PanelOverlayConfig = {
22
+ anchor: "top-center",
23
+ width: "85%",
24
+ maxHeight: "90%",
25
+ margin: { top: 6, right: 1, bottom: 1, left: 1 },
26
+ };
27
+
28
+ const PANEL_ANCHORS: readonly OverlayAnchor[] = [
29
+ "center",
30
+ "top-left",
31
+ "top-right",
32
+ "bottom-left",
33
+ "bottom-right",
34
+ "top-center",
35
+ "bottom-center",
36
+ "left-center",
37
+ "right-center",
38
+ ];
39
+
40
+ function isRecord(value: unknown): value is Record<string, unknown> {
41
+ return value !== null && typeof value === "object" && !Array.isArray(value);
42
+ }
43
+
44
+ function parseAnchor(value: unknown): OverlayAnchor {
45
+ return PANEL_ANCHORS.some((anchor) => anchor === value)
46
+ ? (value as OverlayAnchor)
47
+ : DEFAULT_PANEL_OVERLAY.anchor;
48
+ }
49
+
50
+ /** Accepts a positive column/row count or a "N%" string within 0..100. */
51
+ function parseSizeValue(value: unknown, fallback: SizeValue): SizeValue {
52
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) {
53
+ return Math.floor(value);
54
+ }
55
+ if (typeof value === "string") {
56
+ const match = /^(\d+(?:\.\d+)?)%$/.exec(value.trim());
57
+ if (match) {
58
+ const percent = Number(match[1]);
59
+ if (percent > 0 && percent <= 100) {
60
+ return value.trim() as SizeValue;
61
+ }
62
+ }
63
+ }
64
+ return fallback;
65
+ }
66
+
67
+ function parseMarginEdge(value: unknown): number | undefined {
68
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0
69
+ ? value
70
+ : undefined;
71
+ }
72
+
73
+ /** Accepts one non-negative integer for all edges or a per-edge object. */
74
+ function parseMargin(value: unknown): OverlayMargin | number {
75
+ const fallback = DEFAULT_PANEL_OVERLAY.margin;
76
+ if (typeof value === "number") {
77
+ return parseMarginEdge(value) ?? fallback;
78
+ }
79
+ if (!isRecord(value)) {
80
+ return fallback;
81
+ }
82
+ const defaults = isRecord(fallback) ? (fallback as OverlayMargin) : {};
83
+ const margin: OverlayMargin = {};
84
+ for (const edge of ["top", "right", "bottom", "left"] as const) {
85
+ margin[edge] = parseMarginEdge(value[edge]) ?? defaults[edge];
86
+ }
87
+ return margin;
88
+ }
89
+
90
+ /**
91
+ * Normalizes the raw `panel` config section, replacing invalid fields with
92
+ * defaults so a broken entry never blocks the /oneui panel from opening.
93
+ */
94
+ export function normalizePanelOverlay(input: unknown): PanelOverlayConfig {
95
+ const source = isRecord(input) ? input : {};
96
+ return {
97
+ anchor: parseAnchor(source.anchor),
98
+ width: parseSizeValue(source.width, DEFAULT_PANEL_OVERLAY.width),
99
+ maxHeight: parseSizeValue(
100
+ source.maxHeight,
101
+ DEFAULT_PANEL_OVERLAY.maxHeight,
102
+ ),
103
+ margin: parseMargin(source.margin),
104
+ };
105
+ }
106
+
107
+ /**
108
+ * Loads the panel overlay placement from the shared store. Read fresh on
109
+ * every /oneui open so JSON edits apply without `/reload`.
110
+ */
111
+ export function loadPanelOverlayConfig(): PanelOverlayConfig {
112
+ try {
113
+ return normalizePanelOverlay(configStore.read().panel);
114
+ } catch {
115
+ return normalizePanelOverlay(undefined);
116
+ }
117
+ }
@@ -62,6 +62,7 @@ export type Config = {
62
62
  enableContextCommand: boolean;
63
63
  enableAgentSummary: boolean;
64
64
  enableAliases: boolean;
65
+ enableEffortCommand: boolean;
65
66
  };
66
67
 
67
68
  function rendererConfigFrom(record: ConfigRecord): ConfigRecord {
@@ -166,6 +167,7 @@ export const DEFAULT_CONFIG: Config = {
166
167
  enableContextCommand: true,
167
168
  enableAgentSummary: true,
168
169
  enableAliases: true,
170
+ enableEffortCommand: true,
169
171
  };
170
172
 
171
173
  function pickEnum<T extends string>(
@@ -296,6 +298,7 @@ export function normalizeConfig(input: unknown): Config {
296
298
  enableContextCommand: source.enableContextCommand !== false,
297
299
  enableAgentSummary: source.enableAgentSummary !== false,
298
300
  enableAliases: source.enableAliases !== false,
301
+ enableEffortCommand: source.enableEffortCommand !== false,
299
302
  };
300
303
  }
301
304
 
@@ -350,6 +353,7 @@ export function formatConfigStatus(source: Config = config): string {
350
353
  `context=${source.enableContextCommand ? "on" : "off"}`,
351
354
  `agentSummary=${source.enableAgentSummary ? "on" : "off"}`,
352
355
  `aliases=${source.enableAliases ? "on" : "off"}`,
356
+ `effort=${source.enableEffortCommand ? "on" : "off"}`,
353
357
  ].join(" · ");
354
358
  }
355
359