@each1024/pi-mini-mode 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="assets/mini-lens-hero.png" alt="Mini Lens for Pi — Your session. In focus. A compact footer showing model, tokens, cache, cost, context and generation speed." width="100%">
2
+ <img src="assets/pi-mini-mode-hero.png" alt="Pi Mini Mode for Pi — Your session. In focus. A compact footer showing model, tokens, cache, cost, context and generation speed." width="100%">
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -10,16 +10,16 @@ A compact, configurable footer for [Pi](https://pi.dev). Your model, usage, cost
10
10
 
11
11
  ## Minimal output
12
12
 
13
- `/mini-lens-settings` now has **Lens**, a separate **Collapse replies** switch, and **Minimal output**. Collapsed replies are off by default, so Pi's conversation history stays native until you turn them on. While the switch is off, Minimal output options stay disabled.
13
+ `/pi-mini-mode-settings` now has **Lens**, a separate **Collapse replies** switch, and **Minimal output**. Collapsed replies are off by default, so Pi's conversation history stays native until you turn them on. While the switch is off, Minimal output options stay disabled.
14
14
 
15
- - `/mini-lens-minimal on` shows the user's Markdown on an accent-tinted surface, a background-free process summary, and the final reply without a heading or extra background. No duplicate dock panel.
15
+ - `/pi-mini-mode-minimal on` shows the user's Markdown on an accent-tinted surface, a background-free process summary, and the final reply without a heading or extra background. No duplicate dock panel.
16
16
  - Each turn uses one shared tree showing the latest **ten summary entries**: available thinking, tool calls, streaming tool output, and skill reads. `Ctrl+O` expands the full Markdown process and toggles it closed again; new questions start collapsed; tools without output show an elapsed wait counter, and empty progress events never overwrite existing content; there are no section headings, collapsed counts, or completion labels. Original session messages remain intact.
17
17
  - Agent/subagent calls share the same chronological tree as tools and skills; `Ctrl+O` reveals tasks and Markdown output. A returned call does not imply background completion.
18
18
  - The pi-subagents `async subagent` / `Async agents` widget uses a background-free status tree, retaining native detail shortcuts and output paths. This adapter is active only in minimal mode, restores on disable, and passes unknown formats through. Grouping design reference: [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions).
19
- - `/mini-lens-history` browses complete process entries, five at a time.
19
+ - `/pi-mini-mode-history` browses complete process entries, five at a time.
20
20
  - Final Markdown streams as text events arrive; failures and interruptions are indicated.
21
21
  - `/reload` remounts the transcript, including history created in native mode. Expanded tree rails continue through paragraphs, blank lines and code blocks.
22
- - `/mini-lens-minimal off` restores Pi's default conversation history.
22
+ - `/pi-mini-mode-minimal off` restores Pi's default conversation history.
23
23
 
24
24
  The user surface blends the active Pi accent with its user background. Process and answer text have no background. User padding is two terminal columns horizontally and one row vertically. Markdown, highlighted code, tables and Mermaid terminal diagrams work in light/dark themes; incomplete, unsupported or over-wide diagrams retain their source. **Minimal mode uses a private Pi 0.85.x layout adapter**, without patching the Pi installation. Unknown layouts refuse activation and retain native output. Recheck compatibility after Pi upgrades; another extension replacing the transcript may conflict.
25
25
 
@@ -64,7 +64,7 @@ pi install git:github.com/eachann1024/pi-mini-mode
64
64
 
65
65
  Choose the fields you need. Preview each change instantly, in your Pi theme.
66
66
 
67
- <a href="assets/mini-lens-settings.jpg"><img src="assets/mini-lens-settings.jpg" alt="Mini Lens settings in Pi's light theme, showing the live preview and field toggles. Click to view at full size." width="100%"></a>
67
+ <a href="assets/pi-mini-mode-settings.jpg"><img src="assets/pi-mini-mode-settings.jpg" alt="Pi Mini Mode settings in Pi's light theme, showing the live preview and field toggles. Click to view at full size." width="100%"></a>
68
68
 
69
69
  [Watch the settings demo](https://github.com/user-attachments/assets/5f2f4816-45ed-4759-b035-d9ee59e8a763)
70
70
 
@@ -72,7 +72,7 @@ Choose the fields you need. Preview each change instantly, in your Pi theme.
72
72
  </tr>
73
73
  </table>
74
74
 
75
- Customize with `/mini-lens-settings`. Changes take effect immediately.
75
+ Customize with `/pi-mini-mode-settings`. Changes take effect immediately.
76
76
 
77
77
  **Fits your terminal.** Follows your Pi theme and adapts to narrow widths. Only the footer changes; Pi's built-in tool and thinking views stay intact.
78
78
 
@@ -84,7 +84,7 @@ Bundled themes `cc-light` / `cc-dark` are vendored from [pi-cc-extensions](https
84
84
  <details>
85
85
  <summary><strong>First run & configuration</strong> — defaults, controls, and settings file</summary>
86
86
 
87
- On the first interactive TUI session, Mini Lens shows a preview with every field enabled by default:
87
+ On the first interactive TUI session, Pi Mini Mode shows a preview with every field enabled by default:
88
88
 
89
89
  ```text
90
90
  deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s
@@ -95,50 +95,57 @@ The first-run picker offers **Keep defaults** and **Configure now**. Keeping def
95
95
  Open that settings UI any time with:
96
96
 
97
97
  ```text
98
- /mini-lens-settings
98
+ /pi-mini-mode-settings
99
99
  ```
100
100
 
101
101
  The focused option and its corresponding preview field use bold theme `accent` text with a `selectedBg` background. Fullscreen Pi supports hover to focus and click to toggle; regular terminal mode uses keyboard navigation. Hovering never changes a setting.
102
102
 
103
103
  Changes take effect immediately. The command requires Pi's TUI mode. Its preview always uses fixed example data rather than your current session, while reflecting every setting toggle immediately.
104
104
 
105
- Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/mini-lens.json`; installations with a different Pi config directory use that directory). A malformed or missing file safely falls back to the defaults.
105
+ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-mini-mode.json`; installations with a different Pi config directory use that directory). A malformed or missing file safely falls back to the defaults.
106
106
 
107
107
  ```json
108
108
  {
109
- "mini-lens-model-show": true,
110
- "mini-lens-thinking-show": true,
111
- "mini-lens-ch-show": true,
112
- "mini-lens-session-tokens-show": true,
113
- "mini-lens-cache-tokens-show": true,
114
- "mini-lens-cost-show": true,
115
- "mini-lens-context-show": true,
116
- "mini-lens-context-dots-show": false,
117
- "mini-lens-context-percent-show": true,
118
- "mini-lens-speed-show": true,
119
- "mini-lens-speed-unit-show": true,
109
+ "pi-mini-mode-model-show": true,
110
+ "pi-mini-mode-thinking-show": true,
111
+ "pi-mini-mode-ch-show": true,
112
+ "pi-mini-mode-session-tokens-show": true,
113
+ "pi-mini-mode-cache-tokens-show": true,
114
+ "pi-mini-mode-cost-show": true,
115
+ "pi-mini-mode-context-show": true,
116
+ "pi-mini-mode-context-dots-show": false,
117
+ "pi-mini-mode-context-percent-show": true,
118
+ "pi-mini-mode-speed-show": true,
119
+ "pi-mini-mode-speed-unit-show": true,
120
120
  "onboardingCompleted": true
121
121
  }
122
122
  ```
123
123
 
124
124
  | Key | Default | Controls |
125
125
  | --- | --- | --- |
126
- | `mini-lens-model-show` | `true` | Model ID without provider prefix |
127
- | `mini-lens-thinking-show` | `true` | Thinking level |
128
- | `mini-lens-ch-show` | `true` | Session cache-hit rate (`CH`) |
129
- | `mini-lens-session-tokens-show` | `true` | Accumulated session tokens (`Total`) |
130
- | `mini-lens-cache-tokens-show` | `true` | Accumulated cache read + cache write tokens |
131
- | `mini-lens-cost-show` | `true` | Estimated session list price |
132
- | `mini-lens-context-show` | `true` | Used/total context tokens and progress bar |
133
- | `mini-lens-context-dots-show` | `false` | Use a single-line dot-matrix bar instead of the default solid bar |
134
- | `mini-lens-context-percent-show` | `true` | Context-use percentage |
135
- | `mini-lens-speed-show` | `true` | Generation speed at the far right |
136
- | `mini-lens-speed-unit-show` | `true` | Generation-speed sub-setting: append `tok/s` to the numeric value |
137
- | `mini-lens-minimal-show` | `false` | Collapse replies; off keeps Pi's default conversation history |
126
+ | `pi-mini-mode-model-show` | `true` | Model ID without provider prefix |
127
+ | `pi-mini-mode-thinking-show` | `true` | Thinking level |
128
+ | `pi-mini-mode-ch-show` | `true` | Session cache-hit rate (`CH`) |
129
+ | `pi-mini-mode-session-tokens-show` | `true` | Accumulated session tokens (`Total`) |
130
+ | `pi-mini-mode-cache-tokens-show` | `true` | Accumulated cache read + cache write tokens |
131
+ | `pi-mini-mode-cost-show` | `true` | Estimated session list price |
132
+ | `pi-mini-mode-mcp-show` | `false` | Enabled MCP server count |
133
+ | `pi-mini-mode-context-show` | `true` | Used/total context tokens and progress bar |
134
+ | `pi-mini-mode-context-dots-show` | `false` | Use a single-line dot-matrix bar instead of the default solid bar |
135
+ | `pi-mini-mode-context-percent-show` | `true` | Context-use percentage |
136
+ | `pi-mini-mode-speed-show` | `true` | Generation speed at the far right |
137
+ | `pi-mini-mode-speed-unit-show` | `true` | Generation-speed sub-setting: append `tok/s` to the numeric value |
138
+ | `pi-mini-mode-minimal-show` | `false` | Collapse replies; off keeps Pi's default conversation history |
139
+ | `pi-mini-mode-minimal-thinking-show` | `true` | Show thinking in collapsed replies |
140
+ | `pi-mini-mode-minimal-tools-show` | `true` | Show tool calls and agent calls |
141
+ | `pi-mini-mode-minimal-output-show` | `true` | Show process output |
142
+ | `pi-mini-mode-minimal-skills-show` | `true` | Show skill reads |
143
+ | `pi-mini-mode-agent-usage-show` | `true` | Show Agent token usage |
144
+ | `pi-mini-mode-agent-shortcut-show` | `true` | Show the temporary `Ctrl+O` hint for new Agents |
138
145
  | `onboardingCompleted` | `false` initially | Internal marker that prevents another first-run prompt |
139
146
 
140
147
  - **Generation speed**
141
- - **Show tok/s unit** (`mini-lens-speed-unit-show`) is the indented sub-setting shown beneath **Show latest generation speed** in `/mini-lens-settings`. Turning it off keeps the speed number (for example `40.0`) and removes only `tok/s`.
148
+ - **Show tok/s unit** (`pi-mini-mode-speed-unit-show`) is the indented sub-setting shown beneath **Show latest generation speed** in `/pi-mini-mode-settings`. Turning it off keeps the speed number (for example `40.0`) and removes only `tok/s`.
142
149
  - The sub-setting is retained when generation speed itself is hidden.
143
150
 
144
151
  </details>
@@ -150,7 +157,7 @@ Session totals are aggregated from each finalized `assistant` and `toolResult` e
150
157
 
151
158
  During an assistant stream, speed appears as soon as a positive cumulative `usage.output` sample and elapsed time are available. It is refreshed while streaming and is output tokens divided by elapsed time from the assistant message start. The completed rate remains visible while later assistant messages only call tools or wait for output; it is replaced only by a newer measurable generation. Regressing output samples and non-increasing timestamps are ignored. For a tool result that reports nested LLM usage but has no stream events, the final rate is output tokens divided by that tool execution's duration. A tool that does not report output usage has no measurable speed and leaves the prior rate intact.
152
159
 
153
- Before a measurable response exists, the speed field is absent entirely—Mini Lens never displays a `-- tok/s` placeholder. When present, speed is the rightmost footer field (the context percentage, if enabled, is immediately to its left). Its color uses Pi theme semantics: **success** at >=30 tok/s, **warning** at 10–29.9 tok/s, and **error** below 10 tok/s. No colors are hard-coded, so it follows the selected Pi theme.
160
+ Before a measurable response exists, the speed field is absent entirely—Pi Mini Mode never displays a `-- tok/s` placeholder. When present, speed is the rightmost footer field (the context percentage, if enabled, is immediately to its left). Its color uses Pi theme semantics: **success** at >=30 tok/s, **warning** at 10–29.9 tok/s, and **error** below 10 tok/s. No colors are hard-coded, so it follows the selected Pi theme.
154
161
 
155
162
  The price is the same finalized active-branch usage and configured per-million-token rates. It is an estimate, not a provider invoice. In narrow terminals, the footer drops/truncates lower-priority content to remain one line without overflow.
156
163
 
package/README.zh-CN.md CHANGED
@@ -1,13 +1,34 @@
1
- # Mini Lens for Pi(中文)
1
+ # Pi Mini Mode for Pi(中文)
2
2
 
3
3
  [English](README.md)
4
4
 
5
5
  <p align="center">
6
- <img src="assets/mini-lens-hero.png" alt="Mini Lens:显示模型、令牌、缓存、费用、上下文和生成速度的紧凑页脚" width="100%">
6
+ <img src="assets/pi-mini-mode-hero.png" alt="Pi Mini Mode:显示模型、令牌、缓存、费用、上下文和生成速度的紧凑页脚" width="100%">
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="#安装">安装</a> · <a href="#按需配置">配置</a> · <a href="https://github.com/user-attachments/assets/5f2f4816-45ed-4759-b035-d9ee59e8a763">观看演示</a> · <a href="README.md">English</a>
7
11
  </p>
8
12
 
9
13
  适用于 [Pi](https://pi.dev) 的紧凑、可配置页脚。模型、用量、费用估算、上下文使用率和生成速度,一眼即可查看。
10
14
 
15
+ ## 极简输出
16
+
17
+ `/pi-mini-mode-settings` 现在包含 **Lens**、独立的 **Collapse replies(折叠回复)** 和 **Minimal output(极简输出)** 设置。折叠回复默认关闭;关闭时,极简输出选项也会禁用,因此 Pi 的对话历史会保持原生显示。
18
+
19
+ - `/pi-mini-mode-minimal on` 显示带主题色背景的用户 Markdown、无背景的过程摘要,以及没有标题或额外背景的最终回复,不会重复显示停靠面板。
20
+ - 每轮使用一棵共享树,显示最新 **10 条摘要**,包括可用的思考、工具调用、流式工具输出和技能读取。按 `Ctrl+O` 可展开完整 Markdown 过程,再按一次收起;新问题默认收起。没有输出的工具会显示已等待时间,空的进度事件不会覆盖已有内容,也不会显示分组标题、折叠数量或完成标签。原始会话消息保持不变。
21
+ - Agent/subagent 调用会按时间顺序与工具、技能共用同一棵树;按 `Ctrl+O` 可查看任务和 Markdown 输出。调用返回并不代表后台任务已经完成。
22
+ - pi-subagents 的 `async subagent` / `Async agents` 小组件使用无背景的状态树,同时保留原生详情快捷键和输出路径。此适配器只在极简模式启用,关闭后恢复原状,未知格式会直接交给原生处理。分组设计参考 [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions)。
23
+ - `/pi-mini-mode-history` 可浏览完整过程记录,每次显示 5 条。
24
+ - 最终 Markdown 会随着文本事件流式显示;失败和中断会明确标记。
25
+ - `/reload` 会重新挂载 transcript,也会包含原生模式中产生的历史记录。展开状态的树形连接线会贯穿段落、空行和代码块。
26
+ - `/pi-mini-mode-minimal off` 恢复 Pi 默认的对话历史显示。
27
+
28
+ 用户区域会混合当前 Pi 强调色与用户背景色。过程和回答文本没有背景;用户区域水平方向留出两个终端列、垂直方向留出一行。Markdown、高亮代码、表格以及 Mermaid 终端图表可适配明暗主题;不完整、不支持或过宽的图表会保留源文本。
29
+
30
+ 极简模式使用私有的 Pi 0.85.x 布局适配器,不会修改 Pi 安装目录。未知布局会拒绝启用并保留原生输出。升级 Pi 后请重新检查兼容性;如果其他扩展也替换 transcript,可能产生冲突。
31
+
11
32
  ## 安装
12
33
 
13
34
  ```bash
@@ -22,21 +43,7 @@ pi install npm:@each1024/pi-mini-mode
22
43
  pi install git:github.com/eachann1024/pi-mini-mode
23
44
  ```
24
45
 
25
- ## 极简输出
26
-
27
- 在 `/mini-lens-settings` 中可以找到 **Lens**、独立的 **Collapse replies(折叠回复)** 和 **Minimal output(极简输出)** 设置。折叠回复默认关闭;关闭时,极简输出选项也会禁用。
28
-
29
- - `/mini-lens-minimal on` 显示带主题色背景的用户 Markdown、无背景的过程摘要,以及没有标题和额外背景的最终回复。
30
- - 每轮使用一棵共享树,显示最新 **10 条摘要**,包括思考、工具调用、流式工具输出和技能读取。按 `Ctrl+O` 展开完整 Markdown 过程,再按一次收起。
31
- - Agent/subagent 调用会按时间顺序与工具、技能共用同一棵树;展开后可查看任务和 Markdown 输出。
32
- - `/mini-lens-history` 可浏览完整过程记录,每次显示 5 条。
33
- - 最终 Markdown 会随着文本事件流式显示;失败和中断会明确标记。
34
- - `/reload` 会重新挂载 transcript,也会包含原生模式中产生的历史记录。
35
- - `/mini-lens-minimal off` 恢复 Pi 默认的对话历史显示。
36
-
37
- 极简模式使用私有的 Pi 0.85.x 布局适配器,不会修改 Pi 安装目录。未知布局会拒绝启用并保留原生输出。升级 Pi 后请重新检查兼容性;如果其他扩展也替换 transcript,可能产生冲突。
38
-
39
- ## 页脚指标
46
+ ## 页脚指标与配置
40
47
 
41
48
  默认显示:
42
49
 
@@ -50,33 +57,75 @@ pi install git:github.com/eachann1024/pi-mini-mode
50
57
  运行以下命令即可配置显示字段,修改立即生效,并会按照当前 Pi 主题预览:
51
58
 
52
59
  ```text
53
- /mini-lens-settings
60
+ /pi-mini-mode-settings
54
61
  ```
55
62
 
56
- 页脚会跟随 Pi 主题并适配窄终端。只有页脚会变化,Pi 内置的工具和思考视图保持不变。
63
+ 页脚会跟随 Pi 主题并适配窄终端。只有页脚会变化,Pi 内置的工具和思考视图保持不变。内置的 `cc-light` / `cc-dark` 主题来自 [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions),采用 MIT 许可。
57
64
 
58
- ## 配置
65
+ 首次进入交互式 TUI 会话时,Pi Mini Mode 默认启用所有字段并显示预览,例如:
66
+
67
+ ```text
68
+ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s
69
+ ```
59
70
 
60
- 设置保存在 Pi 的 agent 目录中,通常是 `~/.pi/agent/mini-lens.json`。文件缺失或格式错误时会安全回退到默认设置。
71
+ 首次设置会提供 **Keep defaults(保留默认值)** 和 **Configure now(立即配置)**。保留默认值会保存页脚字段、保持折叠回复关闭,并且不再显示首次设置提示;立即配置会直接打开同一设置列表。Print、JSON 等非交互模式不会显示提示。
72
+
73
+ 设置保存在 Pi 的 agent 目录中,通常是 `~/.pi/agent/pi-mini-mode.json`;如果 Pi 使用其他配置目录,则保存在对应目录。文件缺失或格式错误时会安全回退到默认设置。设置示例:
74
+
75
+ ```json
76
+ {
77
+ "pi-mini-mode-model-show": true,
78
+ "pi-mini-mode-thinking-show": true,
79
+ "pi-mini-mode-ch-show": true,
80
+ "pi-mini-mode-session-tokens-show": true,
81
+ "pi-mini-mode-cache-tokens-show": true,
82
+ "pi-mini-mode-cost-show": true,
83
+ "pi-mini-mode-mcp-show": false,
84
+ "pi-mini-mode-context-show": true,
85
+ "pi-mini-mode-context-dots-show": false,
86
+ "pi-mini-mode-context-percent-show": true,
87
+ "pi-mini-mode-speed-show": true,
88
+ "pi-mini-mode-speed-unit-show": true,
89
+ "onboardingCompleted": true
90
+ }
91
+ ```
61
92
 
62
93
  | 配置项 | 默认值 | 说明 |
63
94
  | --- | --- | --- |
64
- | `mini-lens-model-show` | `true` | 显示模型 ID |
65
- | `mini-lens-thinking-show` | `true` | 显示思考级别 |
66
- | `mini-lens-ch-show` | `true` | 显示会话缓存命中率(`CH`) |
67
- | `mini-lens-session-tokens-show` | `true` | 显示会话累计令牌(`Total`) |
68
- | `mini-lens-cache-tokens-show` | `true` | 显示缓存读取与写入令牌 |
69
- | `mini-lens-cost-show` | `true` | 显示会话费用估算 |
70
- | `mini-lens-context-show` | `true` | 显示上下文令牌和进度条 |
71
- | `mini-lens-context-dots-show` | `false` | 使用点阵进度条 |
72
- | `mini-lens-context-percent-show` | `true` | 显示上下文使用百分比 |
73
- | `mini-lens-speed-show` | `true` | 显示最新生成速度 |
74
- | `mini-lens-speed-unit-show` | `true` | 在速度后显示 `tok/s` |
75
- | `mini-lens-minimal-show` | `false` | 折叠回复;关闭则使用 Pi 默认历史显示 |
76
-
77
- 生成速度只有在获得有效的输出令牌和耗时后才会显示,不会显示 `-- tok/s` 占位符。速度颜色遵循 Pi 主题:至少 30 tok/s 为成功色,10–29.9 tok/s 为警告色,低于 10 tok/s 为错误色。费用是基于已完成会话用量和配置费率的估算,并非服务商账单。
78
-
79
- ## 开发
95
+ | `pi-mini-mode-model-show` | `true` | 显示不含 provider 前缀的模型 ID |
96
+ | `pi-mini-mode-thinking-show` | `true` | 显示思考级别 |
97
+ | `pi-mini-mode-ch-show` | `true` | 显示会话缓存命中率(`CH`) |
98
+ | `pi-mini-mode-session-tokens-show` | `true` | 显示会话累计令牌(`Total`) |
99
+ | `pi-mini-mode-cache-tokens-show` | `true` | 显示缓存读取与写入令牌(已包含在 Total 中) |
100
+ | `pi-mini-mode-cost-show` | `true` | 显示会话费用估算 |
101
+ | `pi-mini-mode-mcp-show` | `false` | 显示已启用的 MCP 服务器数量 |
102
+ | `pi-mini-mode-context-show` | `true` | 显示已用/总上下文令牌和进度条 |
103
+ | `pi-mini-mode-context-dots-show` | `false` | 使用单行点阵进度条替代默认实心进度条 |
104
+ | `pi-mini-mode-context-percent-show` | `true` | 显示上下文使用百分比 |
105
+ | `pi-mini-mode-speed-show` | `true` | 显示最新生成速度 |
106
+ | `pi-mini-mode-speed-unit-show` | `true` | 速度子设置:在数字后追加 `tok/s` |
107
+ | `pi-mini-mode-minimal-show` | `false` | 折叠回复;关闭则使用 Pi 默认历史显示 |
108
+ | `pi-mini-mode-minimal-thinking-show` | `true` | 显示折叠回复中的思考 |
109
+ | `pi-mini-mode-minimal-tools-show` | `true` | 显示工具调用和 Agent 调用 |
110
+ | `pi-mini-mode-minimal-output-show` | `true` | 显示过程输出 |
111
+ | `pi-mini-mode-minimal-skills-show` | `true` | 显示技能读取 |
112
+ | `pi-mini-mode-agent-usage-show` | `true` | 显示 Agent token 用量 |
113
+ | `pi-mini-mode-agent-shortcut-show` | `true` | 新 Agent 显示临时 `Ctrl+O` 提示 |
114
+ | `onboardingCompleted` | 初始为 `false` | 防止再次显示首次设置提示的内部标记 |
115
+
116
+ 生成速度设置中的 **显示 tok/s 单位** 是 **显示最新生成速度** 下方的缩进子设置。关闭它只会移除 `tok/s`,保留速度数字;即使隐藏生成速度,该子设置仍会保留。
117
+
118
+ ## 指标如何计算
119
+
120
+ 会话总量来自当前会话分支中每一条已完成的 `assistant` 和 `toolResult` 记录。工具报告的嵌套 LLM 工作(例如子 Agent)会准确计入一次。若 provider 提供 `totalTokens`,`Total` 使用该值;较旧或自定义结果没有该字段时,则使用输入、输出、缓存读取和缓存写入令牌之和。`Cached` 是缓存读取与写入之和(包含在 `Total` 中);`CH` 是缓存读取量除以输入量与缓存读取量之和。只有已持久化的最终用量会计入,因此流式更新不会重复累计。
121
+
122
+ 助手生成过程中,只要有正数的累计 `usage.output` 样本和可用耗时,就会显示速度,并持续刷新。速度等于输出令牌数除以助手消息开始后的耗时。后续助手消息如果只是调用工具或等待输出,之前完成的速度仍会保留;只有新的可测量生成才会替换它。倒退的输出样本和不递增的时间戳会被忽略。工具结果若报告嵌套 LLM 用量但没有流事件,则使用输出令牌数除以工具执行时长计算最终速度;无法报告输出用量的工具不会产生速度,也不会清除之前的速度。
123
+
124
+ 在获得可测量响应前,速度字段完全不显示,不会出现 `-- tok/s` 占位符。速度位于页脚最右侧;启用上下文百分比时,百分比紧邻其左侧。颜色遵循 Pi 主题语义:至少 30 tok/s 为成功色,10–29.9 tok/s 为警告色,低于 10 tok/s 为错误色。费用是基于当前分支已完成用量和配置的每百万令牌费率得出的估算,并非 provider 账单。窄终端中,页脚会丢弃或截断优先级较低的内容,确保保持单行且不溢出。
125
+
126
+ ## 开发与检查
127
+
128
+ 开发时只安装本地副本;同时安装 npm 版本和本地版本会导致扩展重复注册:
80
129
 
81
130
  ```bash
82
131
  pi remove npm:@each1024/pi-mini-mode && pi install /path/to/pi-mini-mode
@@ -84,15 +133,19 @@ npm run check
84
133
  npm test
85
134
  ```
86
135
 
87
- 修改源码后,在已打开的 Pi 会话中运行 `/reload`。真实终端冒烟测试:
136
+ 修改源码后,在已打开的 Pi 会话中运行 `/reload`。`npm run check` 会执行 TypeScript 检查,`npm test` 会执行页脚、设置和发布自检。真实终端冒烟测试:
88
137
 
89
138
  ```bash
90
139
  python3 test/minimal-pty.py
91
140
  ```
92
141
 
142
+ 该测试需要 Python 3、Node 以及已安装依赖中自带的 Pi CLI;会使用临时 fixture,覆盖普通/全屏模式、切换、10 条过程记录、`Ctrl+O` 展开/收起、恢复结果和窄终端,不会调用模型。
143
+
93
144
  ## 发布
94
145
 
95
- 推送到 `main` 后,GitHub Actions 会在通过 `npm ci`、`npm run check` 和 `npm test` 后自动发布到 npm。发布使用 npm Trusted Publisher、OIDC 和 provenance,无需 npm token。
146
+ 推送到 `main` 后,GitHub Actions 会在通过 `npm ci`、`npm run check` 和 `npm test` 后自动发布到 npm;也支持在 `main` 上手动触发。每次发布都会取本地版本基线与 npm 最新稳定版本加一个 patch 中的较高者。版本只在 runner 中变更,不创建版本提交或 tag;发布 major/minor 版本时,应同时提高 `package.json` 和 lockfile 中的基线。已经发布过的提交会跳过。Actions 并发策略可能替换等待中的推送,因此不是每次推送或一次推送中的每个提交都保证生成独立版本。
147
+
148
+ 后续发布使用 npm Trusted Publisher、OIDC 和 provenance,无需 npm token。
96
149
 
97
150
  ---
98
151
 
@@ -11,66 +11,66 @@ import { dirname, join } from "node:path";
11
11
  import attachFooterTidy from "../lib/footer-tidy.ts";
12
12
  import attachTitlePlain from "../lib/title-plain.ts";
13
13
 
14
- export const SETTINGS_FILE_NAME = "mini-lens.json";
14
+ export const SETTINGS_FILE_NAME = "pi-mini-mode.json";
15
15
 
16
16
  export interface MiniLensSettings {
17
- "mini-lens-model-show": boolean;
18
- "mini-lens-thinking-show": boolean;
19
- "mini-lens-ch-show": boolean;
20
- "mini-lens-session-tokens-show": boolean;
21
- "mini-lens-cache-tokens-show": boolean;
22
- "mini-lens-cost-show": boolean;
23
- "mini-lens-mcp-show": boolean;
24
- "mini-lens-context-show": boolean;
25
- "mini-lens-context-dots-show": boolean;
26
- "mini-lens-context-percent-show": boolean;
27
- "mini-lens-speed-show": boolean;
28
- "mini-lens-speed-unit-show": boolean;
29
- "mini-lens-minimal-show": boolean;
30
- "mini-lens-minimal-thinking-show": boolean;
31
- "mini-lens-minimal-tools-show": boolean;
32
- "mini-lens-minimal-output-show": boolean;
33
- "mini-lens-minimal-skills-show": boolean;
34
- "mini-lens-agent-usage-show": boolean;
35
- "mini-lens-agent-shortcut-show": boolean;
17
+ "pi-mini-mode-model-show": boolean;
18
+ "pi-mini-mode-thinking-show": boolean;
19
+ "pi-mini-mode-ch-show": boolean;
20
+ "pi-mini-mode-session-tokens-show": boolean;
21
+ "pi-mini-mode-cache-tokens-show": boolean;
22
+ "pi-mini-mode-cost-show": boolean;
23
+ "pi-mini-mode-mcp-show": boolean;
24
+ "pi-mini-mode-context-show": boolean;
25
+ "pi-mini-mode-context-dots-show": boolean;
26
+ "pi-mini-mode-context-percent-show": boolean;
27
+ "pi-mini-mode-speed-show": boolean;
28
+ "pi-mini-mode-speed-unit-show": boolean;
29
+ "pi-mini-mode-minimal-show": boolean;
30
+ "pi-mini-mode-minimal-thinking-show": boolean;
31
+ "pi-mini-mode-minimal-tools-show": boolean;
32
+ "pi-mini-mode-minimal-output-show": boolean;
33
+ "pi-mini-mode-minimal-skills-show": boolean;
34
+ "pi-mini-mode-agent-usage-show": boolean;
35
+ "pi-mini-mode-agent-shortcut-show": boolean;
36
36
  onboardingCompleted: boolean;
37
37
  }
38
38
 
39
39
  export const DEFAULT_SETTINGS: Readonly<MiniLensSettings> = {
40
- "mini-lens-model-show": true,
41
- "mini-lens-thinking-show": true,
42
- "mini-lens-ch-show": true,
43
- "mini-lens-session-tokens-show": true,
44
- "mini-lens-cache-tokens-show": true,
45
- "mini-lens-cost-show": true,
46
- "mini-lens-mcp-show": false,
47
- "mini-lens-context-show": true,
48
- "mini-lens-context-dots-show": false,
49
- "mini-lens-context-percent-show": true,
50
- "mini-lens-speed-show": true,
51
- "mini-lens-speed-unit-show": true,
52
- "mini-lens-minimal-show": false,
53
- "mini-lens-minimal-thinking-show": true,
54
- "mini-lens-minimal-tools-show": true,
55
- "mini-lens-minimal-output-show": true,
56
- "mini-lens-minimal-skills-show": true,
57
- "mini-lens-agent-usage-show": true,
58
- "mini-lens-agent-shortcut-show": true,
40
+ "pi-mini-mode-model-show": true,
41
+ "pi-mini-mode-thinking-show": true,
42
+ "pi-mini-mode-ch-show": true,
43
+ "pi-mini-mode-session-tokens-show": true,
44
+ "pi-mini-mode-cache-tokens-show": true,
45
+ "pi-mini-mode-cost-show": true,
46
+ "pi-mini-mode-mcp-show": false,
47
+ "pi-mini-mode-context-show": true,
48
+ "pi-mini-mode-context-dots-show": false,
49
+ "pi-mini-mode-context-percent-show": true,
50
+ "pi-mini-mode-speed-show": true,
51
+ "pi-mini-mode-speed-unit-show": true,
52
+ "pi-mini-mode-minimal-show": false,
53
+ "pi-mini-mode-minimal-thinking-show": true,
54
+ "pi-mini-mode-minimal-tools-show": true,
55
+ "pi-mini-mode-minimal-output-show": true,
56
+ "pi-mini-mode-minimal-skills-show": true,
57
+ "pi-mini-mode-agent-usage-show": true,
58
+ "pi-mini-mode-agent-shortcut-show": true,
59
59
  onboardingCompleted: false,
60
60
  };
61
61
 
62
62
  const SETTING_IDS = Object.keys(DEFAULT_SETTINGS) as Array<keyof MiniLensSettings>;
63
63
 
64
64
  const COPY = {
65
- title: "Mini Lens 设置", preview: "预览(示例数据)", lens: "Lens", minimal: "极简输出",
65
+ title: "Pi Mini Mode 设置", preview: "预览(示例数据)", lens: "设置", minimal: "极简输出",
66
66
  model: "显示模型", thinking: "显示思考等级", total: "显示会话总 token", cached: "显示会话缓存 token", totalLabel: "Total", cachedLabel: "Cached", cacheHitLabel: "CH", cacheHit: "显示缓存命中率 (CH)", price: "显示会话价格", mcp: "显示已启用 MCP 服务器", context: "显示上下文 token 与进度条", dots: "↳ 使用点阵进度条", percent: "显示上下文百分比", speed: "显示最近生成速度", speedUnit: "↳ 显示 tok/s 单位", enableMinimal: "折叠回复", showThinking: "显示思考", tools: "显示工具调用", output: "显示过程输出", skills: "显示技能", agentUsage: "显示 Agent token 用量", shortcut: "新 Agent 显示 Ctrl+O 提示(6 秒)",
67
67
  totalDescription: "Total:当前会话分支上的全部 token,含工具上报的 LLM 用量。", cachedDescription: "Cached:累计 cache-read + cache-write token(包含在 Total 中)。", cacheHitDescription: "CH(cache hit):cache-read / (input + cache-read)。Cache write 不计入此比率。",
68
68
  enableMinimalDescription: "关闭后保留 Pi 默认会话历史。",
69
69
  minimalLocked: "打开「折叠回复」后才能配置这些选项。",
70
- tuiRequired: "/mini-lens-settings 需要 TUI 模式", saveFailed: "无法保存 Mini Lens 设置", minimalRequired: "/mini-lens-minimal 需要 TUI 模式", minimalUsage: "用法:/mini-lens-minimal [on|off]", minimalState: "Mini Lens 折叠回复:", onboarding: "MCP 数量、点阵样式和折叠回复默认关闭;其余项默认开启。", keepDefaults: "保留默认", configureNow: "立即配置",
70
+ tuiRequired: "/pi-mini-mode-settings 需要 TUI 模式", saveFailed: "无法保存 Pi Mini Mode 设置", minimalRequired: "/pi-mini-mode-minimal 需要 TUI 模式", minimalUsage: "用法:/pi-mini-mode-minimal [on|off]", minimalState: "Pi Mini Mode 折叠回复:", onboarding: "MCP 数量、点阵样式和折叠回复默认关闭;其余项默认开启。", keepDefaults: "保留默认", configureNow: "立即配置",
71
71
  } as const;
72
72
 
73
- export function settingsPath(agentDir = process.env.MINI_LENS_AGENT_DIR ?? join(homedir(), CONFIG_DIR_NAME, "agent")): string {
73
+ export function settingsPath(agentDir = process.env.PI_MINI_MODE_AGENT_DIR ?? join(homedir(), CONFIG_DIR_NAME, "agent")): string {
74
74
  return join(agentDir, SETTINGS_FILE_NAME);
75
75
  }
76
76
 
@@ -244,10 +244,10 @@ function renderRight(
244
244
  highlighted?: keyof MiniLensSettings,
245
245
  ): string {
246
246
  const fields: string[] = [];
247
- if (settings["mini-lens-context-percent-show"] && percentText) fields.push(highlighted === "mini-lens-context-percent-show" ? theme.bg("selectedBg", theme.fg("accent", theme.bold(percentText))) : theme.fg("accent", percentText));
248
- if (settings["mini-lens-speed-show"] && speed !== undefined) {
249
- const text = formatSpeed(speed, settings["mini-lens-speed-unit-show"]);
250
- fields.push(highlighted === "mini-lens-speed-show" || highlighted === "mini-lens-speed-unit-show"
247
+ if (settings["pi-mini-mode-context-percent-show"] && percentText) fields.push(highlighted === "pi-mini-mode-context-percent-show" ? theme.bg("selectedBg", theme.fg("accent", theme.bold(percentText))) : theme.fg("accent", percentText));
248
+ if (settings["pi-mini-mode-speed-show"] && speed !== undefined) {
249
+ const text = formatSpeed(speed, settings["pi-mini-mode-speed-unit-show"]);
250
+ fields.push(highlighted === "pi-mini-mode-speed-show" || highlighted === "pi-mini-mode-speed-unit-show"
251
251
  ? theme.bg("selectedBg", theme.fg("accent", theme.bold(text)))
252
252
  : theme.fg(speedColor(speed), text));
253
253
  }
@@ -289,7 +289,7 @@ export function statusLine(
289
289
  mcpCount?: number,
290
290
  statuses?: ReadonlyMap<string, string>,
291
291
  ): string {
292
- if (highlighted === "mini-lens-context-dots-show") highlighted = "mini-lens-context-show";
292
+ if (highlighted === "pi-mini-mode-context-dots-show") highlighted = "pi-mini-mode-context-show";
293
293
  const field = (id: keyof MiniLensSettings, color: Parameters<typeof theme.fg>[0], text: string) =>
294
294
  id === highlighted ? theme.bg("selectedBg", theme.fg("accent", theme.bold(text))) : theme.fg(color, text);
295
295
  if (width <= 0) return "";
@@ -306,37 +306,37 @@ export function statusLine(
306
306
  const percent = rawPercent === undefined ? undefined : Math.max(0, Math.min(100, rawPercent));
307
307
  const percentText = percent === undefined ? "" : `${Math.round(percent)}%`;
308
308
  const tokenText = tokens === undefined || contextWindow === undefined ? "" : `${formatTokens(Math.max(0, tokens))}/${formatTokens(Math.max(0, contextWindow))}`;
309
- const showContext = settings["mini-lens-context-show"] && Boolean(tokenText);
310
- const mcpText = settings["mini-lens-mcp-show"] && mcpCount !== undefined ? `◇ MCP ${mcpCount}` : "";
309
+ const showContext = settings["pi-mini-mode-context-show"] && Boolean(tokenText);
310
+ const mcpText = settings["pi-mini-mode-mcp-show"] && mcpCount !== undefined ? `◇ MCP ${mcpCount}` : "";
311
311
  const planTag = plannotatorPlanTag(statuses);
312
312
 
313
313
  const right = renderRight(theme, settings, percentText, speed, highlighted);
314
314
  const rightWidth = visibleWidth(right);
315
315
  if (right && width <= rightWidth) {
316
- const compactRight = settings["mini-lens-speed-show"] && speed !== undefined
317
- ? theme.fg(speedColor(speed), formatSpeed(speed, settings["mini-lens-speed-unit-show"]))
316
+ const compactRight = settings["pi-mini-mode-speed-show"] && speed !== undefined
317
+ ? theme.fg(speedColor(speed), formatSpeed(speed, settings["pi-mini-mode-speed-unit-show"]))
318
318
  : right;
319
319
  return truncateToWidth(compactRight, width, "");
320
320
  }
321
321
 
322
322
  const leftParts = [
323
323
  planTag,
324
- settings["mini-lens-model-show"] && model && field("mini-lens-model-show", "accent", model),
325
- settings["mini-lens-thinking-show"] && thinking && field("mini-lens-thinking-show", "muted", thinking),
326
- settings["mini-lens-session-tokens-show"] && usageTotals.totalTokens > 0 && field("mini-lens-session-tokens-show", "text", `${COPY.totalLabel} ${formatTokens(usageTotals.totalTokens)}`),
327
- settings["mini-lens-cache-tokens-show"] && cachedTokens > 0 && field("mini-lens-cache-tokens-show", "text", `${COPY.cachedLabel} ${formatTokens(cachedTokens)}`),
328
- settings["mini-lens-ch-show"] && hitText && field("mini-lens-ch-show", "text", hitText),
329
- settings["mini-lens-cost-show"] && price && field("mini-lens-cost-show", "muted", price),
330
- mcpText && field("mini-lens-mcp-show", "muted", mcpText),
324
+ settings["pi-mini-mode-model-show"] && model && field("pi-mini-mode-model-show", "accent", model),
325
+ settings["pi-mini-mode-thinking-show"] && thinking && field("pi-mini-mode-thinking-show", "muted", thinking),
326
+ settings["pi-mini-mode-session-tokens-show"] && usageTotals.totalTokens > 0 && field("pi-mini-mode-session-tokens-show", "text", `${COPY.totalLabel} ${formatTokens(usageTotals.totalTokens)}`),
327
+ settings["pi-mini-mode-cache-tokens-show"] && cachedTokens > 0 && field("pi-mini-mode-cache-tokens-show", "text", `${COPY.cachedLabel} ${formatTokens(cachedTokens)}`),
328
+ settings["pi-mini-mode-ch-show"] && hitText && field("pi-mini-mode-ch-show", "text", hitText),
329
+ settings["pi-mini-mode-cost-show"] && price && field("pi-mini-mode-cost-show", "muted", price),
330
+ mcpText && field("pi-mini-mode-mcp-show", "muted", mcpText),
331
331
  ].filter((part): part is string => Boolean(part));
332
332
  const unstyledLeft = [
333
333
  planTag && stripVTControlCharacters(planTag),
334
- settings["mini-lens-model-show"] && model,
335
- settings["mini-lens-thinking-show"] && thinking,
336
- settings["mini-lens-session-tokens-show"] && usageTotals.totalTokens > 0 && `${COPY.totalLabel} ${formatTokens(usageTotals.totalTokens)}`,
337
- settings["mini-lens-cache-tokens-show"] && cachedTokens > 0 && `${COPY.cachedLabel} ${formatTokens(cachedTokens)}`,
338
- settings["mini-lens-ch-show"] && hitText,
339
- settings["mini-lens-cost-show"] && price,
334
+ settings["pi-mini-mode-model-show"] && model,
335
+ settings["pi-mini-mode-thinking-show"] && thinking,
336
+ settings["pi-mini-mode-session-tokens-show"] && usageTotals.totalTokens > 0 && `${COPY.totalLabel} ${formatTokens(usageTotals.totalTokens)}`,
337
+ settings["pi-mini-mode-cache-tokens-show"] && cachedTokens > 0 && `${COPY.cachedLabel} ${formatTokens(cachedTokens)}`,
338
+ settings["pi-mini-mode-ch-show"] && hitText,
339
+ settings["pi-mini-mode-cost-show"] && price,
340
340
  mcpText,
341
341
  ].filter(Boolean).join(" ");
342
342
  const leftBudget = Math.min(visibleWidth(unstyledLeft), Math.max(1, width - rightWidth - (showContext ? 20 : 1)), Math.max(0, width - rightWidth - 1));
@@ -349,12 +349,12 @@ export function statusLine(
349
349
  const visibleToken = truncateToWidth(tokenText, middleBudget, "…");
350
350
  const visibleTokenWidth = visibleWidth(visibleToken);
351
351
  const barWidth = middleBudget - visibleTokenWidth - 1;
352
- const filledCell = settings["mini-lens-context-dots-show"] ? "⣿" : "█";
353
- const emptyCell = settings["mini-lens-context-dots-show"] ? "⣀" : "░";
352
+ const filledCell = settings["pi-mini-mode-context-dots-show"] ? "⣿" : "█";
353
+ const emptyCell = settings["pi-mini-mode-context-dots-show"] ? "⣀" : "░";
354
354
  const bar = barWidth >= 2 && percent !== undefined
355
- ? `${field("mini-lens-context-show", "accent", filledCell.repeat(Math.round(barWidth * percent / 100)))}${field("mini-lens-context-show", "borderMuted", emptyCell.repeat(barWidth - Math.round(barWidth * percent / 100)))}`
355
+ ? `${field("pi-mini-mode-context-show", "accent", filledCell.repeat(Math.round(barWidth * percent / 100)))}${field("pi-mini-mode-context-show", "borderMuted", emptyCell.repeat(barWidth - Math.round(barWidth * percent / 100)))}`
356
356
  : "";
357
- middle = `${field("mini-lens-context-show", "muted", visibleToken)}${bar ? ` ${bar}` : ""}`;
357
+ middle = `${field("pi-mini-mode-context-show", "muted", visibleToken)}${bar ? ` ${bar}` : ""}`;
358
358
  }
359
359
 
360
360
  const content = [left, middle].filter(Boolean).join(" ");
@@ -364,18 +364,18 @@ export function statusLine(
364
364
  }
365
365
 
366
366
  export function isCollapsedReplyChildSetting(id: string): boolean {
367
- return id === "mini-lens-minimal-thinking-show" || id === "mini-lens-minimal-tools-show" || id === "mini-lens-minimal-output-show"
368
- || id === "mini-lens-minimal-skills-show" || id === "mini-lens-agent-usage-show" || id === "mini-lens-agent-shortcut-show";
367
+ return id === "pi-mini-mode-minimal-thinking-show" || id === "pi-mini-mode-minimal-tools-show" || id === "pi-mini-mode-minimal-output-show"
368
+ || id === "pi-mini-mode-minimal-skills-show" || id === "pi-mini-mode-agent-usage-show" || id === "pi-mini-mode-agent-shortcut-show";
369
369
  }
370
370
 
371
371
  export function settingsItems(settings: MiniLensSettings): SettingItem[] {
372
372
  const values = ["on", "off"];
373
373
  const labels: Record<Exclude<keyof MiniLensSettings, "onboardingCompleted">, string> = {
374
- "mini-lens-model-show": COPY.model, "mini-lens-thinking-show": COPY.thinking, "mini-lens-session-tokens-show": COPY.total, "mini-lens-cache-tokens-show": COPY.cached, "mini-lens-ch-show": COPY.cacheHit, "mini-lens-cost-show": COPY.price, "mini-lens-mcp-show": COPY.mcp, "mini-lens-context-show": COPY.context, "mini-lens-context-dots-show": COPY.dots, "mini-lens-context-percent-show": COPY.percent, "mini-lens-speed-show": COPY.speed, "mini-lens-speed-unit-show": COPY.speedUnit, "mini-lens-minimal-show": COPY.enableMinimal, "mini-lens-minimal-thinking-show": COPY.showThinking, "mini-lens-minimal-tools-show": COPY.tools, "mini-lens-minimal-output-show": COPY.output, "mini-lens-minimal-skills-show": COPY.skills, "mini-lens-agent-usage-show": COPY.agentUsage, "mini-lens-agent-shortcut-show": COPY.shortcut,
374
+ "pi-mini-mode-model-show": COPY.model, "pi-mini-mode-thinking-show": COPY.thinking, "pi-mini-mode-session-tokens-show": COPY.total, "pi-mini-mode-cache-tokens-show": COPY.cached, "pi-mini-mode-ch-show": COPY.cacheHit, "pi-mini-mode-cost-show": COPY.price, "pi-mini-mode-mcp-show": COPY.mcp, "pi-mini-mode-context-show": COPY.context, "pi-mini-mode-context-dots-show": COPY.dots, "pi-mini-mode-context-percent-show": COPY.percent, "pi-mini-mode-speed-show": COPY.speed, "pi-mini-mode-speed-unit-show": COPY.speedUnit, "pi-mini-mode-minimal-show": COPY.enableMinimal, "pi-mini-mode-minimal-thinking-show": COPY.showThinking, "pi-mini-mode-minimal-tools-show": COPY.tools, "pi-mini-mode-minimal-output-show": COPY.output, "pi-mini-mode-minimal-skills-show": COPY.skills, "pi-mini-mode-agent-usage-show": COPY.agentUsage, "pi-mini-mode-agent-shortcut-show": COPY.shortcut,
375
375
  };
376
376
  return (Object.keys(labels) as Array<keyof typeof labels>).map((id) => ({
377
377
  id, label: labels[id],
378
- description: id === "mini-lens-minimal-show" ? COPY.enableMinimalDescription : id === "mini-lens-session-tokens-show" ? COPY.totalDescription : id === "mini-lens-cache-tokens-show" ? COPY.cachedDescription : id === "mini-lens-ch-show" ? COPY.cacheHitDescription : undefined,
378
+ description: id === "pi-mini-mode-minimal-show" ? COPY.enableMinimalDescription : id === "pi-mini-mode-session-tokens-show" ? COPY.totalDescription : id === "pi-mini-mode-cache-tokens-show" ? COPY.cachedDescription : id === "pi-mini-mode-ch-show" ? COPY.cacheHitDescription : undefined,
379
379
  currentValue: settings[id] ? values[0] : values[1], values,
380
380
  }));
381
381
  }
@@ -535,10 +535,10 @@ function visibleMinimalTurns(settings: MiniLensSettings, turns: MinimalTurn[]):
535
535
  let thinking: number | undefined;
536
536
  let visibleCount = 0;
537
537
  const process = turn.process.filter((line, index) => {
538
- const visible = line.startsWith("thinking ") ? settings["mini-lens-minimal-thinking-show"]
539
- : /^(tool|call) /.test(line) ? settings["mini-lens-minimal-tools-show"]
540
- : line.startsWith("output ") ? settings["mini-lens-minimal-output-show"]
541
- : line.startsWith("skill ") ? settings["mini-lens-minimal-skills-show"] : true;
538
+ const visible = line.startsWith("thinking ") ? settings["pi-mini-mode-minimal-thinking-show"]
539
+ : /^(tool|call) /.test(line) ? settings["pi-mini-mode-minimal-tools-show"]
540
+ : line.startsWith("output ") ? settings["pi-mini-mode-minimal-output-show"]
541
+ : line.startsWith("skill ") ? settings["pi-mini-mode-minimal-skills-show"] : true;
542
542
  if (visible) {
543
543
  if (index === turn.thinking) thinking = visibleCount;
544
544
  visibleCount++;
@@ -548,8 +548,8 @@ function visibleMinimalTurns(settings: MiniLensSettings, turns: MinimalTurn[]):
548
548
  return {
549
549
  ...turn,
550
550
  thinking,
551
- awaitingResponse: turn.awaitingResponse && settings["mini-lens-minimal-thinking-show"],
552
- agentCalls: settings["mini-lens-minimal-tools-show"] ? turn.agentCalls : [],
551
+ awaitingResponse: turn.awaitingResponse && settings["pi-mini-mode-minimal-thinking-show"],
552
+ agentCalls: settings["pi-mini-mode-minimal-tools-show"] ? turn.agentCalls : [],
553
553
  process,
554
554
  };
555
555
  });
@@ -648,9 +648,9 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
648
648
  return { handled: true, render: true };
649
649
  }
650
650
  }
651
- if (event.button !== "left" || event.shift || event.ctrl || event.alt || (event.clickCount ?? 1) !== 1) return;
651
+ if (event.button !== "left" || event.shift || event.ctrl || event.alt) return;
652
652
  const control = promptControls.find(control => event.y === control.y && event.x >= control.x && event.x < control.x + control.width);
653
- if (control) {
653
+ if (control && (event.clickCount ?? 1) === 1) {
654
654
  if (event.type === "press") return { handled: true };
655
655
  if (event.type === "click") {
656
656
  togglePrompt(control.index, control.question);
@@ -665,6 +665,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
665
665
  return { handled: true, render: true };
666
666
  }
667
667
  }
668
+ if ((event.clickCount ?? 1) !== 1) return;
668
669
  const region = noticeRegions.find(region => event.y >= region.y && event.y < region.y + region.rows.length);
669
670
  return region?.rows.handleMouse?.({ ...event, y: event.y - region.y });
670
671
  },
@@ -699,7 +700,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
699
700
  const control = truncateToWidth(label, inner, "");
700
701
  promptControls.push({ index, question: turn.question, y: lines.length + 1 + userRows.length,
701
702
  x: 0, width, label });
702
- userRows.push(theme.fg("accent", control) + theme.fg("muted", truncateToWidth(" · /mini-lens-prompts", Math.max(0, inner - visibleWidth(control)), "")));
703
+ userRows.push(theme.fg("accent", control) + theme.fg("muted", truncateToWidth(" · /pi-mini-mode-prompts", Math.max(0, inner - visibleWidth(control)), "")));
703
704
  }
704
705
  lines.push(...surface(userRows, width, true));
705
706
  const entries = turn.process.flatMap((entry, processIndex) => {
@@ -725,7 +726,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
725
726
  const agents = liveAgentView(turn.subAgents ?? [], theme, width, subAgentsExpanded(), true, agentDeadlines, Date.now(), expandedSubagents, agentTurnControls);
726
727
  if (entries.length || turn.running || turn.usage || agents.total) {
727
728
  const expanded = isExpanded();
728
- const shown = expanded ? entries : entries.filter(entry => !entry.thinking || entry.state === "running" || expandedThinking.has(entry.id)).slice(-10);
729
+ const shown = expanded ? entries : entries.filter(entry => !entry.thinking || entry.state === "running" || expandedThinking.has(entry.id)).slice(-6);
729
730
  const done = entries.filter(entry => entry.state === "done").length;
730
731
  const progressHeader = theme.bold(theme.fg("text", "Agent")) + (entries.length ? theme.fg("muted", ` · ${done}/${entries.length}`) : "")
731
732
  + (agents.total ? theme.bold(theme.fg("text", " Subagent")) + theme.fg("muted", ` ${agents.done + agents.errors}/${agents.total}`)
@@ -803,7 +804,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
803
804
  const details = entry.detail.split(/\r?\n/).filter(line => line.trim());
804
805
  // ponytail: four diagnostic lines; full output remains in the native transcript.
805
806
  lines.push(...details.slice(1, 5).map(line => truncateToWidth(rail + theme.fg("muted", line), width)));
806
- if (details.length > 5) lines.push(truncateToWidth(rail + theme.fg("muted", `… +${details.length - 5} lines · /mini-lens-minimal off`), width));
807
+ if (details.length > 5) lines.push(truncateToWidth(rail + theme.fg("muted", `… +${details.length - 5} lines · /pi-mini-mode-minimal off`), width));
807
808
  }
808
809
  });
809
810
  const agentStartY = lines.length;
@@ -875,7 +876,7 @@ export default function (pi: ExtensionAPI) {
875
876
  restoreAgentWidgets?.();
876
877
  restoreAgentWidgets = undefined;
877
878
  promptView = undefined;
878
- if (settings["mini-lens-minimal-show"] && ctx.mode === "tui") unsubscribeMinimalInput = ctx.ui.onTerminalInput?.((data) => {
879
+ if (settings["pi-mini-mode-minimal-show"] && ctx.mode === "tui") unsubscribeMinimalInput = ctx.ui.onTerminalInput?.((data) => {
879
880
  const nativeKey = matchesKey(data, "ctrl+alt+o");
880
881
  const subAgentKey = matchesKey(data, "ctrl+s");
881
882
  if (!nativeKey && (!restoreTranscript || (!subAgentKey && !matchesKey(data, "ctrl+o")))) return;
@@ -889,14 +890,14 @@ export default function (pi: ExtensionAPI) {
889
890
  refreshMinimalOutput();
890
891
  return { consume: true };
891
892
  });
892
- if (nativeOutput || !settings["mini-lens-minimal-show"] || ctx.mode !== "tui") {
893
+ if (nativeOutput || !settings["pi-mini-mode-minimal-show"] || ctx.mode !== "tui") {
893
894
  lastAttachMode = undefined;
894
- ctx.ui.setWidget?.("mini-lens-minimal-output", undefined);
895
+ ctx.ui.setWidget?.("pi-mini-mode-minimal-output", undefined);
895
896
  refreshMinimalOutput();
896
897
  refreshMinimal = undefined;
897
898
  return;
898
899
  }
899
- ctx.ui.setWidget("mini-lens-minimal-output", (tui, theme) => {
900
+ ctx.ui.setWidget("pi-mini-mode-minimal-output", (tui, theme) => {
900
901
  refreshMinimal = () => tui.requestRender();
901
902
  // Retain children under their originating user turn, including while idle,
902
903
  // after a follow-up user message, and when rebuilding a saved session.
@@ -933,7 +934,7 @@ export default function (pi: ExtensionAPI) {
933
934
  return { ...turn, subAgents: withNotices };
934
935
  });
935
936
  };
936
- const view = minimalOutputComponent(theme, () => visibleMinimalTurns(settings, turnsWithAgents()), () => processExpanded, turn => settings["mini-lens-agent-shortcut-show"] && Date.now() < (turn.shortcutHintUntil ?? 0), () => settings["mini-lens-agent-usage-show"], () => subAgentsExpanded, agentDeadlines);
937
+ const view = minimalOutputComponent(theme, () => visibleMinimalTurns(settings, turnsWithAgents()), () => processExpanded, turn => settings["pi-mini-mode-agent-shortcut-show"] && Date.now() < (turn.shortcutHintUntil ?? 0), () => settings["pi-mini-mode-agent-usage-show"], () => subAgentsExpanded, agentDeadlines);
937
938
  const hintRemaining = (activeMinimalTurn?.shortcutHintUntil ?? 0) - Date.now();
938
939
  if (hintRemaining > 0) {
939
940
  shortcutTimer = setTimeout(() => tui.requestRender(), hintRemaining);
@@ -1007,7 +1008,7 @@ export default function (pi: ExtensionAPI) {
1007
1008
  return { render: () => [], invalidate() {} };
1008
1009
  });
1009
1010
  };
1010
- pi.registerCommand("mini-lens-prompts", {
1011
+ pi.registerCommand("pi-mini-mode-prompts", {
1011
1012
  description: "Expand or collapse a user prompt in fullscreen minimal output",
1012
1013
  handler: async (_args, ctx) => {
1013
1014
  if (ctx.mode !== "tui" || !restoreTranscript || !promptView) {
@@ -1026,7 +1027,7 @@ export default function (pi: ExtensionAPI) {
1026
1027
  }
1027
1028
  },
1028
1029
  });
1029
- pi.registerCommand("mini-lens-tools", {
1030
+ pi.registerCommand("pi-mini-mode-tools", {
1030
1031
  description: "Expand or collapse a tool's saved text or thinking in fullscreen minimal output",
1031
1032
  handler: async (_args, ctx) => {
1032
1033
  if (ctx.mode !== "tui" || !restoreTranscript || !promptView) {
@@ -1106,22 +1107,22 @@ export default function (pi: ExtensionAPI) {
1106
1107
  label: (text: string, selected: boolean) => {
1107
1108
  const name = text.trimEnd();
1108
1109
  if (selected) highlighted = items.find((item) => item.label === name)?.id as keyof MiniLensSettings | undefined;
1109
- const disabled = name === COPY.minimal && !settings["mini-lens-minimal-show"];
1110
+ const disabled = name === COPY.minimal && !settings["pi-mini-mode-minimal-show"];
1110
1111
  if (selected) return theme.bg("selectedBg", theme.fg("accent", theme.bold(text)));
1111
1112
  return theme.fg(disabled ? "muted" : "text", text);
1112
1113
  },
1113
1114
  value: (text: string, selected: boolean) =>
1114
1115
  selected ? theme.bg("selectedBg", theme.fg("accent", theme.bold(text))) : theme.fg("muted", text),
1115
1116
  };
1116
- const lensItems = () => settingsItems(settings).filter((item) => item.id !== "mini-lens-minimal-show" && !isCollapsedReplyChildSetting(item.id));
1117
+ const lensItems = () => settingsItems(settings).filter((item) => item.id !== "pi-mini-mode-minimal-show" && !isCollapsedReplyChildSetting(item.id));
1117
1118
  const minimalItems = () => settingsItems(settings).filter((item) => isCollapsedReplyChildSetting(item.id));
1118
1119
  const collapseItem: SettingItem = {
1119
- id: "mini-lens-minimal-show", label: COPY.enableMinimal, description: COPY.enableMinimalDescription,
1120
- currentValue: settings["mini-lens-minimal-show"] ? "on" : "off", values: ["on", "off"],
1120
+ id: "pi-mini-mode-minimal-show", label: COPY.enableMinimal, description: COPY.enableMinimalDescription,
1121
+ currentValue: settings["pi-mini-mode-minimal-show"] ? "on" : "off", values: ["on", "off"],
1121
1122
  };
1122
1123
  const minimalGroup: SettingItem = { id: "minimal", label: COPY.minimal, currentValue: "›" };
1123
1124
  const applyCollapseState = () => {
1124
- const enabled = settings["mini-lens-minimal-show"];
1125
+ const enabled = settings["pi-mini-mode-minimal-show"];
1125
1126
  collapseItem.currentValue = enabled ? "on" : "off";
1126
1127
  minimalGroup.currentValue = enabled ? "›" : "off";
1127
1128
  minimalGroup.description = enabled ? undefined : COPY.minimalLocked;
@@ -1133,9 +1134,7 @@ export default function (pi: ExtensionAPI) {
1133
1134
  };
1134
1135
  applyCollapseState();
1135
1136
  const groups: SettingItem[] = [
1136
- { id: "lens", label: COPY.lens, currentValue: "›", submenu: (_value, back) => new SettingsList(lensItems(), 12, settingsTheme, onChange, () => back(), { enableSearch: true }) },
1137
- collapseItem,
1138
- minimalGroup,
1137
+ { id: "settings", label: COPY.lens, currentValue: "›", submenu: (_value, back) => new SettingsList([...lensItems(), collapseItem, minimalGroup], 12, settingsTheme, onChange, () => back(), { enableSearch: true }) },
1139
1138
  ];
1140
1139
  const settingsList = new SettingsList(groups, 12, settingsTheme, onChange, () => done(undefined), { enableSearch: true });
1141
1140
  container.addChild(settingsList);
@@ -1157,11 +1156,11 @@ export default function (pi: ExtensionAPI) {
1157
1156
  });
1158
1157
  };
1159
1158
 
1160
- pi.registerCommand("mini-lens-settings", {
1161
- description: "Configure Lens, collapsed replies, and Minimal output",
1159
+ pi.registerCommand("pi-mini-mode-settings", {
1160
+ description: "Configure Pi Mini Mode settings",
1162
1161
  handler: async (_args, ctx) => openSettings(ctx),
1163
1162
  });
1164
- pi.registerCommand("mini-lens-history", {
1163
+ pi.registerCommand("pi-mini-mode-history", {
1165
1164
  description: "View collapsed process entries for a conversation turn",
1166
1165
  handler: async (_args, ctx) => {
1167
1166
  if (ctx.mode !== "tui" || minimalTurns.length === 0) return;
@@ -1191,7 +1190,7 @@ export default function (pi: ExtensionAPI) {
1191
1190
  });
1192
1191
  },
1193
1192
  });
1194
- pi.registerCommand("mini-lens-minimal", {
1193
+ pi.registerCommand("pi-mini-mode-minimal", {
1195
1194
  description: "Toggle collapsed replies (off keeps Pi's default conversation history)",
1196
1195
  handler: async (args, ctx) => {
1197
1196
  const normalized = args.trim().toLowerCase();
@@ -1205,16 +1204,16 @@ export default function (pi: ExtensionAPI) {
1205
1204
  }
1206
1205
  settings = {
1207
1206
  ...settings,
1208
- "mini-lens-minimal-show": normalized === "on" ? true : normalized === "off" ? false : !settings["mini-lens-minimal-show"],
1207
+ "pi-mini-mode-minimal-show": normalized === "on" ? true : normalized === "off" ? false : !settings["pi-mini-mode-minimal-show"],
1209
1208
  onboardingCompleted: true,
1210
1209
  };
1211
- if (settings["mini-lens-minimal-show"]) nativeOutput = false;
1210
+ if (settings["pi-mini-mode-minimal-show"]) nativeOutput = false;
1212
1211
  mountMinimalOutput(ctx);
1213
1212
  await persistSettings(ctx);
1214
1213
  // The mount already explains unsupported layouts; do not contradict it
1215
1214
  // with a success notification when only the preference was saved.
1216
- if (settings["mini-lens-minimal-show"] && !restoreTranscript) return;
1217
- ctx.ui.notify(`${COPY.minimalState}${settings["mini-lens-minimal-show"] ? "on" : "off"}`, "info");
1215
+ if (settings["pi-mini-mode-minimal-show"] && !restoreTranscript) return;
1216
+ ctx.ui.notify(`${COPY.minimalState}${settings["pi-mini-mode-minimal-show"] ? "on" : "off"}`, "info");
1218
1217
  },
1219
1218
  });
1220
1219
 
@@ -1232,7 +1231,7 @@ export default function (pi: ExtensionAPI) {
1232
1231
  invalidate() {},
1233
1232
  render(width: number): string[] {
1234
1233
  // switchTuiMode does not re-run setWidget; remount once the live renderer is fullscreen.
1235
- if (settings["mini-lens-minimal-show"] && !nativeOutput && ctx.mode === "tui" && !restoreTranscript
1234
+ if (settings["pi-mini-mode-minimal-show"] && !nativeOutput && ctx.mode === "tui" && !restoreTranscript
1236
1235
  && tui.mode !== "regular" && lastAttachMode === "regular" && !remountQueued) {
1237
1236
  remountQueued = true;
1238
1237
  queueMicrotask(() => {
@@ -1247,7 +1246,7 @@ export default function (pi: ExtensionAPI) {
1247
1246
  refresh();
1248
1247
  if (!loaded.exists && ctx.mode === "tui" && ctx.hasUI) {
1249
1248
  const choice = await ctx.ui.select(
1250
- `Mini Lens ${COPY.preview}\n\n deepseek-v4-flash high ${COPY.totalLabel} 45K ${COPY.cachedLabel} 25K ${COPY.cacheHitLabel} 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s\n\n${COPY.onboarding}`,
1249
+ `Pi Mini Mode ${COPY.preview}\n\n deepseek-v4-flash high ${COPY.totalLabel} 45K ${COPY.cachedLabel} 25K ${COPY.cacheHitLabel} 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s\n\n${COPY.onboarding}`,
1251
1250
  [COPY.keepDefaults, COPY.configureNow],
1252
1251
  );
1253
1252
  settings = { ...settings, onboardingCompleted: true };
package/lib/agent-view.ts CHANGED
@@ -4,7 +4,7 @@ import { readdirSync, readFileSync, statSync } from "node:fs";
4
4
  import { join, resolve } from "node:path";
5
5
  import { tmpdir } from "node:os";
6
6
  import { getMarkdownTheme, type ExtensionContext } from "@earendil-works/pi-coding-agent";
7
- import { Markdown, truncateToWidth, visibleWidth, type Component } from "@earendil-works/pi-tui";
7
+ import { Markdown, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component } from "@earendil-works/pi-tui";
8
8
 
9
9
  type Theme = ExtensionContext["ui"]["theme"];
10
10
  export const RUNNING_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
@@ -175,7 +175,7 @@ const isAgentFleetSummary = (lines: string[]) => {
175
175
  && !/\b(?:jobs?|panes?)\b/.test(content[0]);
176
176
  };
177
177
 
178
- export const AGENT_STATUS_ENTRY = "mini-lens-agent-status";
178
+ export const AGENT_STATUS_ENTRY = "pi-mini-mode-agent-status";
179
179
 
180
180
  export function savedAgentStatuses(entries: unknown[]): Record<string, unknown>[] {
181
181
  const saved = new Map<string, Record<string, unknown>>();
@@ -381,6 +381,11 @@ export function liveAgentView(statuses: Record<string, unknown>[], theme: Theme,
381
381
  subagentControls?.push({ runId: runKey, y: rows.length, width, line });
382
382
  rows.push(line);
383
383
  if (isChildExpanded) {
384
+ // Live activity is literal text, not a final answer or Markdown tool output.
385
+ if (!terminal) {
386
+ const details = wrapTextWithAnsi(`当前活动:${text(activity)}`, Math.max(1, width - 3));
387
+ rows.push(...details.map(line => truncateToWidth(` ${theme.fg("muted", line)}`, width)));
388
+ }
384
389
  const messages = Array.isArray(child.noticeMessages) ? child.noticeMessages : [];
385
390
  const bodies: string[] = [];
386
391
  for (const msg of messages) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@each1024/pi-mini-mode",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "A compact Pi footer with live usage metrics, theme-aware settings previews, and configurable progress bars.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -25,7 +25,7 @@
25
25
  "tui"
26
26
  ],
27
27
  "pi": {
28
- "video": "https://raw.githubusercontent.com/eachann1024/pi-mini-mode/main/assets/mini-lens-settings.mp4",
28
+ "video": "https://raw.githubusercontent.com/eachann1024/pi-mini-mode/main/assets/pi-mini-mode-settings.mp4",
29
29
  "extensions": [
30
30
  "./extensions/footer-status.ts"
31
31
  ],