@each1024/pi-mini-mode 1.3.2 → 1.3.4

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
@@ -3,14 +3,14 @@
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <a href="#install">Install</a> · <a href="#make-it-yours">Settings</a> · <a href="https://github.com/user-attachments/assets/5f2f4816-45ed-4759-b035-d9ee59e8a763">Watch demo</a>
6
+ <a href="#install">Install</a> · <a href="#make-it-yours">Settings</a> · <a href="https://github.com/user-attachments/assets/5f2f4816-45ed-4759-b035-d9ee59e8a763">Watch demo</a> · <a href="README.zh-CN.md">中文</a>
7
7
  </p>
8
8
 
9
9
  A compact, configurable footer for [Pi](https://pi.dev). Your model, usage, cost estimate, context, and generation speed — at a glance.
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
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.
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.
@@ -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
 
@@ -95,7 +95,7 @@ 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.
@@ -129,12 +129,19 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/mini
129
129
  | `mini-lens-session-tokens-show` | `true` | Accumulated session tokens (`Total`) |
130
130
  | `mini-lens-cache-tokens-show` | `true` | Accumulated cache read + cache write tokens |
131
131
  | `mini-lens-cost-show` | `true` | Estimated session list price |
132
+ | `mini-lens-mcp-show` | `false` | Enabled MCP server count |
132
133
  | `mini-lens-context-show` | `true` | Used/total context tokens and progress bar |
133
134
  | `mini-lens-context-dots-show` | `false` | Use a single-line dot-matrix bar instead of the default solid bar |
134
135
  | `mini-lens-context-percent-show` | `true` | Context-use percentage |
135
136
  | `mini-lens-speed-show` | `true` | Generation speed at the far right |
136
137
  | `mini-lens-speed-unit-show` | `true` | Generation-speed sub-setting: append `tok/s` to the numeric value |
137
138
  | `mini-lens-minimal-show` | `false` | Collapse replies; off keeps Pi's default conversation history |
139
+ | `mini-lens-minimal-thinking-show` | `true` | Show thinking in collapsed replies |
140
+ | `mini-lens-minimal-tools-show` | `true` | Show tool calls and agent calls |
141
+ | `mini-lens-minimal-output-show` | `true` | Show process output |
142
+ | `mini-lens-minimal-skills-show` | `true` | Show skill reads |
143
+ | `mini-lens-agent-usage-show` | `true` | Show Agent token usage |
144
+ | `mini-lens-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**
@@ -0,0 +1,152 @@
1
+ # Mini Lens for Pi(中文)
2
+
3
+ [English](README.md)
4
+
5
+ <p align="center">
6
+ <img src="assets/mini-lens-hero.png" alt="Mini Lens:显示模型、令牌、缓存、费用、上下文和生成速度的紧凑页脚" 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>
11
+ </p>
12
+
13
+ 适用于 [Pi](https://pi.dev) 的紧凑、可配置页脚。模型、用量、费用估算、上下文使用率和生成速度,一眼即可查看。
14
+
15
+ ## 极简输出
16
+
17
+ `/pi-mini-mode-settings` 现在包含 **Lens**、独立的 **Collapse replies(折叠回复)** 和 **Minimal output(极简输出)** 设置。折叠回复默认关闭;关闭时,极简输出选项也会禁用,因此 Pi 的对话历史会保持原生显示。
18
+
19
+ - `/mini-lens-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
+ - `/mini-lens-history` 可浏览完整过程记录,每次显示 5 条。
24
+ - 最终 Markdown 会随着文本事件流式显示;失败和中断会明确标记。
25
+ - `/reload` 会重新挂载 transcript,也会包含原生模式中产生的历史记录。展开状态的树形连接线会贯穿段落、空行和代码块。
26
+ - `/mini-lens-minimal off` 恢复 Pi 默认的对话历史显示。
27
+
28
+ 用户区域会混合当前 Pi 强调色与用户背景色。过程和回答文本没有背景;用户区域水平方向留出两个终端列、垂直方向留出一行。Markdown、高亮代码、表格以及 Mermaid 终端图表可适配明暗主题;不完整、不支持或过宽的图表会保留源文本。
29
+
30
+ 极简模式使用私有的 Pi 0.85.x 布局适配器,不会修改 Pi 安装目录。未知布局会拒绝启用并保留原生输出。升级 Pi 后请重新检查兼容性;如果其他扩展也替换 transcript,可能产生冲突。
31
+
32
+ ## 安装
33
+
34
+ ```bash
35
+ pi install npm:@each1024/pi-mini-mode
36
+ ```
37
+
38
+ 在 Pi 中运行 `/reload`。需要 **Pi ≥ 0.84.0**。
39
+
40
+ 也可以直接从 GitHub 安装:
41
+
42
+ ```bash
43
+ pi install git:github.com/eachann1024/pi-mini-mode
44
+ ```
45
+
46
+ ## 页脚指标与配置
47
+
48
+ 默认显示:
49
+
50
+ - 模型与思考级别
51
+ - 会话令牌总数
52
+ - 缓存令牌与命中率
53
+ - 会话费用估算
54
+ - 上下文用量与进度条
55
+ - 最新生成速度
56
+
57
+ 运行以下命令即可配置显示字段,修改立即生效,并会按照当前 Pi 主题预览:
58
+
59
+ ```text
60
+ /pi-mini-mode-settings
61
+ ```
62
+
63
+ 页脚会跟随 Pi 主题并适配窄终端。只有页脚会变化,Pi 内置的工具和思考视图保持不变。内置的 `cc-light` / `cc-dark` 主题来自 [pi-cc-extensions](https://github.com/minuque/pi-cc-extensions),采用 MIT 许可。
64
+
65
+ 首次进入交互式 TUI 会话时,Mini Lens 默认启用所有字段并显示预览,例如:
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
+ ```
70
+
71
+ 首次设置会提供 **Keep defaults(保留默认值)** 和 **Configure now(立即配置)**。保留默认值会保存页脚字段、保持折叠回复关闭,并且不再显示首次设置提示;立即配置会直接打开同一设置列表。Print、JSON 等非交互模式不会显示提示。
72
+
73
+ 设置保存在 Pi 的 agent 目录中,通常是 `~/.pi/agent/mini-lens.json`;如果 Pi 使用其他配置目录,则保存在对应目录。文件缺失或格式错误时会安全回退到默认设置。设置示例:
74
+
75
+ ```json
76
+ {
77
+ "mini-lens-model-show": true,
78
+ "mini-lens-thinking-show": true,
79
+ "mini-lens-ch-show": true,
80
+ "mini-lens-session-tokens-show": true,
81
+ "mini-lens-cache-tokens-show": true,
82
+ "mini-lens-cost-show": true,
83
+ "mini-lens-mcp-show": false,
84
+ "mini-lens-context-show": true,
85
+ "mini-lens-context-dots-show": false,
86
+ "mini-lens-context-percent-show": true,
87
+ "mini-lens-speed-show": true,
88
+ "mini-lens-speed-unit-show": true,
89
+ "onboardingCompleted": true
90
+ }
91
+ ```
92
+
93
+ | 配置项 | 默认值 | 说明 |
94
+ | --- | --- | --- |
95
+ | `mini-lens-model-show` | `true` | 显示不含 provider 前缀的模型 ID |
96
+ | `mini-lens-thinking-show` | `true` | 显示思考级别 |
97
+ | `mini-lens-ch-show` | `true` | 显示会话缓存命中率(`CH`) |
98
+ | `mini-lens-session-tokens-show` | `true` | 显示会话累计令牌(`Total`) |
99
+ | `mini-lens-cache-tokens-show` | `true` | 显示缓存读取与写入令牌(已包含在 Total 中) |
100
+ | `mini-lens-cost-show` | `true` | 显示会话费用估算 |
101
+ | `mini-lens-mcp-show` | `false` | 显示已启用的 MCP 服务器数量 |
102
+ | `mini-lens-context-show` | `true` | 显示已用/总上下文令牌和进度条 |
103
+ | `mini-lens-context-dots-show` | `false` | 使用单行点阵进度条替代默认实心进度条 |
104
+ | `mini-lens-context-percent-show` | `true` | 显示上下文使用百分比 |
105
+ | `mini-lens-speed-show` | `true` | 显示最新生成速度 |
106
+ | `mini-lens-speed-unit-show` | `true` | 速度子设置:在数字后追加 `tok/s` |
107
+ | `mini-lens-minimal-show` | `false` | 折叠回复;关闭则使用 Pi 默认历史显示 |
108
+ | `mini-lens-minimal-thinking-show` | `true` | 显示折叠回复中的思考 |
109
+ | `mini-lens-minimal-tools-show` | `true` | 显示工具调用和 Agent 调用 |
110
+ | `mini-lens-minimal-output-show` | `true` | 显示过程输出 |
111
+ | `mini-lens-minimal-skills-show` | `true` | 显示技能读取 |
112
+ | `mini-lens-agent-usage-show` | `true` | 显示 Agent token 用量 |
113
+ | `mini-lens-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 版本和本地版本会导致扩展重复注册:
129
+
130
+ ```bash
131
+ pi remove npm:@each1024/pi-mini-mode && pi install /path/to/pi-mini-mode
132
+ npm run check
133
+ npm test
134
+ ```
135
+
136
+ 修改源码后,在已打开的 Pi 会话中运行 `/reload`。`npm run check` 会执行 TypeScript 检查,`npm test` 会执行页脚、设置和发布自检。真实终端冒烟测试:
137
+
138
+ ```bash
139
+ python3 test/minimal-pty.py
140
+ ```
141
+
142
+ 该测试需要 Python 3、Node 以及已安装依赖中自带的 Pi CLI;会使用临时 fixture,覆盖普通/全屏模式、切换、10 条过程记录、`Ctrl+O` 展开/收起、恢复结果和窄终端,不会调用模型。
143
+
144
+ ## 发布
145
+
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。
149
+
150
+ ---
151
+
152
+ [MIT License](LICENSE) · 为 [Pi](https://pi.dev) 打造
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@each1024/pi-mini-mode",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
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": {