@each1024/pi-mini-mode 1.3.4 → 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 +39 -39
- package/README.zh-CN.md +38 -38
- package/extensions/footer-status.ts +107 -108
- package/lib/agent-view.ts +7 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/mini-
|
|
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">
|
|
@@ -12,14 +12,14 @@ A compact, configurable footer for [Pi](https://pi.dev). Your model, usage, cost
|
|
|
12
12
|
|
|
13
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
|
@@ -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
|
|
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
|
|
@@ -102,50 +102,50 @@ The focused option and its corresponding preview field use bold theme `accent` t
|
|
|
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-
|
|
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-
|
|
110
|
-
"mini-
|
|
111
|
-
"mini-
|
|
112
|
-
"mini-
|
|
113
|
-
"mini-
|
|
114
|
-
"mini-
|
|
115
|
-
"mini-
|
|
116
|
-
"mini-
|
|
117
|
-
"mini-
|
|
118
|
-
"mini-
|
|
119
|
-
"mini-
|
|
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-
|
|
127
|
-
| `mini-
|
|
128
|
-
| `mini-
|
|
129
|
-
| `mini-
|
|
130
|
-
| `mini-
|
|
131
|
-
| `mini-
|
|
132
|
-
| `mini-
|
|
133
|
-
| `mini-
|
|
134
|
-
| `mini-
|
|
135
|
-
| `mini-
|
|
136
|
-
| `mini-
|
|
137
|
-
| `mini-
|
|
138
|
-
| `mini-
|
|
139
|
-
| `mini-
|
|
140
|
-
| `mini-
|
|
141
|
-
| `mini-
|
|
142
|
-
| `mini-
|
|
143
|
-
| `mini-
|
|
144
|
-
| `mini-
|
|
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 |
|
|
145
145
|
| `onboardingCompleted` | `false` initially | Internal marker that prevents another first-run prompt |
|
|
146
146
|
|
|
147
147
|
- **Generation speed**
|
|
148
|
-
- **Show tok/s unit** (`mini-
|
|
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`.
|
|
149
149
|
- The sub-setting is retained when generation speed itself is hidden.
|
|
150
150
|
|
|
151
151
|
</details>
|
|
@@ -157,7 +157,7 @@ Session totals are aggregated from each finalized `assistant` and `toolResult` e
|
|
|
157
157
|
|
|
158
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.
|
|
159
159
|
|
|
160
|
-
Before a measurable response exists, the speed field is absent entirely—Mini
|
|
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.
|
|
161
161
|
|
|
162
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.
|
|
163
163
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Mini
|
|
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-
|
|
6
|
+
<img src="assets/pi-mini-mode-hero.png" alt="Pi Mini Mode:显示模型、令牌、缓存、费用、上下文和生成速度的紧凑页脚" width="100%">
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
`/pi-mini-mode-settings` 现在包含 **Lens**、独立的 **Collapse replies(折叠回复)** 和 **Minimal output(极简输出)** 设置。折叠回复默认关闭;关闭时,极简输出选项也会禁用,因此 Pi 的对话历史会保持原生显示。
|
|
18
18
|
|
|
19
|
-
- `/mini-
|
|
19
|
+
- `/pi-mini-mode-minimal on` 显示带主题色背景的用户 Markdown、无背景的过程摘要,以及没有标题或额外背景的最终回复,不会重复显示停靠面板。
|
|
20
20
|
- 每轮使用一棵共享树,显示最新 **10 条摘要**,包括可用的思考、工具调用、流式工具输出和技能读取。按 `Ctrl+O` 可展开完整 Markdown 过程,再按一次收起;新问题默认收起。没有输出的工具会显示已等待时间,空的进度事件不会覆盖已有内容,也不会显示分组标题、折叠数量或完成标签。原始会话消息保持不变。
|
|
21
21
|
- Agent/subagent 调用会按时间顺序与工具、技能共用同一棵树;按 `Ctrl+O` 可查看任务和 Markdown 输出。调用返回并不代表后台任务已经完成。
|
|
22
22
|
- pi-subagents 的 `async subagent` / `Async agents` 小组件使用无背景的状态树,同时保留原生详情快捷键和输出路径。此适配器只在极简模式启用,关闭后恢复原状,未知格式会直接交给原生处理。分组设计参考 [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions)。
|
|
23
|
-
- `/mini-
|
|
23
|
+
- `/pi-mini-mode-history` 可浏览完整过程记录,每次显示 5 条。
|
|
24
24
|
- 最终 Markdown 会随着文本事件流式显示;失败和中断会明确标记。
|
|
25
25
|
- `/reload` 会重新挂载 transcript,也会包含原生模式中产生的历史记录。展开状态的树形连接线会贯穿段落、空行和代码块。
|
|
26
|
-
- `/mini-
|
|
26
|
+
- `/pi-mini-mode-minimal off` 恢复 Pi 默认的对话历史显示。
|
|
27
27
|
|
|
28
28
|
用户区域会混合当前 Pi 强调色与用户背景色。过程和回答文本没有背景;用户区域水平方向留出两个终端列、垂直方向留出一行。Markdown、高亮代码、表格以及 Mermaid 终端图表可适配明暗主题;不完整、不支持或过宽的图表会保留源文本。
|
|
29
29
|
|
|
@@ -62,7 +62,7 @@ pi install git:github.com/eachann1024/pi-mini-mode
|
|
|
62
62
|
|
|
63
63
|
页脚会跟随 Pi 主题并适配窄终端。只有页脚会变化,Pi 内置的工具和思考视图保持不变。内置的 `cc-light` / `cc-dark` 主题来自 [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions),采用 MIT 许可。
|
|
64
64
|
|
|
65
|
-
首次进入交互式 TUI 会话时,Mini
|
|
65
|
+
首次进入交互式 TUI 会话时,Pi Mini Mode 默认启用所有字段并显示预览,例如:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
68
|
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s
|
|
@@ -70,47 +70,47 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █
|
|
|
70
70
|
|
|
71
71
|
首次设置会提供 **Keep defaults(保留默认值)** 和 **Configure now(立即配置)**。保留默认值会保存页脚字段、保持折叠回复关闭,并且不再显示首次设置提示;立即配置会直接打开同一设置列表。Print、JSON 等非交互模式不会显示提示。
|
|
72
72
|
|
|
73
|
-
设置保存在 Pi 的 agent 目录中,通常是 `~/.pi/agent/mini-
|
|
73
|
+
设置保存在 Pi 的 agent 目录中,通常是 `~/.pi/agent/pi-mini-mode.json`;如果 Pi 使用其他配置目录,则保存在对应目录。文件缺失或格式错误时会安全回退到默认设置。设置示例:
|
|
74
74
|
|
|
75
75
|
```json
|
|
76
76
|
{
|
|
77
|
-
"mini-
|
|
78
|
-
"mini-
|
|
79
|
-
"mini-
|
|
80
|
-
"mini-
|
|
81
|
-
"mini-
|
|
82
|
-
"mini-
|
|
83
|
-
"mini-
|
|
84
|
-
"mini-
|
|
85
|
-
"mini-
|
|
86
|
-
"mini-
|
|
87
|
-
"mini-
|
|
88
|
-
"mini-
|
|
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
89
|
"onboardingCompleted": true
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
| 配置项 | 默认值 | 说明 |
|
|
94
94
|
| --- | --- | --- |
|
|
95
|
-
| `mini-
|
|
96
|
-
| `mini-
|
|
97
|
-
| `mini-
|
|
98
|
-
| `mini-
|
|
99
|
-
| `mini-
|
|
100
|
-
| `mini-
|
|
101
|
-
| `mini-
|
|
102
|
-
| `mini-
|
|
103
|
-
| `mini-
|
|
104
|
-
| `mini-
|
|
105
|
-
| `mini-
|
|
106
|
-
| `mini-
|
|
107
|
-
| `mini-
|
|
108
|
-
| `mini-
|
|
109
|
-
| `mini-
|
|
110
|
-
| `mini-
|
|
111
|
-
| `mini-
|
|
112
|
-
| `mini-
|
|
113
|
-
| `mini-
|
|
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
114
|
| `onboardingCompleted` | 初始为 `false` | 防止再次显示首次设置提示的内部标记 |
|
|
115
115
|
|
|
116
116
|
生成速度设置中的 **显示 tok/s 单位** 是 **显示最新生成速度** 下方的缩进子设置。关闭它只会移除 `tok/s`,保留速度数字;即使隐藏生成速度,该子设置仍会保留。
|
|
@@ -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-
|
|
14
|
+
export const SETTINGS_FILE_NAME = "pi-mini-mode.json";
|
|
15
15
|
|
|
16
16
|
export interface MiniLensSettings {
|
|
17
|
-
"mini-
|
|
18
|
-
"mini-
|
|
19
|
-
"mini-
|
|
20
|
-
"mini-
|
|
21
|
-
"mini-
|
|
22
|
-
"mini-
|
|
23
|
-
"mini-
|
|
24
|
-
"mini-
|
|
25
|
-
"mini-
|
|
26
|
-
"mini-
|
|
27
|
-
"mini-
|
|
28
|
-
"mini-
|
|
29
|
-
"mini-
|
|
30
|
-
"mini-
|
|
31
|
-
"mini-
|
|
32
|
-
"mini-
|
|
33
|
-
"mini-
|
|
34
|
-
"mini-
|
|
35
|
-
"mini-
|
|
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-
|
|
41
|
-
"mini-
|
|
42
|
-
"mini-
|
|
43
|
-
"mini-
|
|
44
|
-
"mini-
|
|
45
|
-
"mini-
|
|
46
|
-
"mini-
|
|
47
|
-
"mini-
|
|
48
|
-
"mini-
|
|
49
|
-
"mini-
|
|
50
|
-
"mini-
|
|
51
|
-
"mini-
|
|
52
|
-
"mini-
|
|
53
|
-
"mini-
|
|
54
|
-
"mini-
|
|
55
|
-
"mini-
|
|
56
|
-
"mini-
|
|
57
|
-
"mini-
|
|
58
|
-
"mini-
|
|
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
|
|
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-
|
|
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.
|
|
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-
|
|
248
|
-
if (settings["mini-
|
|
249
|
-
const text = formatSpeed(speed, settings["mini-
|
|
250
|
-
fields.push(highlighted === "mini-
|
|
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-
|
|
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-
|
|
310
|
-
const mcpText = settings["mini-
|
|
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-
|
|
317
|
-
? theme.fg(speedColor(speed), formatSpeed(speed, settings["mini-
|
|
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-
|
|
325
|
-
settings["mini-
|
|
326
|
-
settings["mini-
|
|
327
|
-
settings["mini-
|
|
328
|
-
settings["mini-
|
|
329
|
-
settings["mini-
|
|
330
|
-
mcpText && field("mini-
|
|
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-
|
|
335
|
-
settings["mini-
|
|
336
|
-
settings["mini-
|
|
337
|
-
settings["mini-
|
|
338
|
-
settings["mini-
|
|
339
|
-
settings["mini-
|
|
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-
|
|
353
|
-
const emptyCell = settings["mini-
|
|
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-
|
|
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-
|
|
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-
|
|
368
|
-
|| id === "mini-
|
|
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-
|
|
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-
|
|
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-
|
|
539
|
-
: /^(tool|call) /.test(line) ? settings["mini-
|
|
540
|
-
: line.startsWith("output ") ? settings["mini-
|
|
541
|
-
: line.startsWith("skill ") ? settings["mini-
|
|
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-
|
|
552
|
-
agentCalls: settings["mini-
|
|
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
|
|
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-
|
|
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(-
|
|
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-
|
|
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-
|
|
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-
|
|
893
|
+
if (nativeOutput || !settings["pi-mini-mode-minimal-show"] || ctx.mode !== "tui") {
|
|
893
894
|
lastAttachMode = undefined;
|
|
894
|
-
ctx.ui.setWidget?.("mini-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
1120
|
-
currentValue: settings["mini-
|
|
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-
|
|
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: "
|
|
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-
|
|
1161
|
-
description: "Configure
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
1217
|
-
ctx.ui.notify(`${COPY.minimalState}${settings["mini-
|
|
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-
|
|
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
|
|
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-
|
|
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
|
+
"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-
|
|
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
|
],
|