pi-ui-extension 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +351 -12
  2. package/README.zh-CN.md +382 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,13 +1,267 @@
1
+ [English](README.md) | [简体中文](README.zh-CN.md)
2
+
1
3
  # pi-ui-extension
2
4
 
3
- A Pi package that extends the terminal UI with a footer, split-view sidebar, context/activity panels, session controls, resource views, and configurable tool transcript rendering.
5
+ `pi-ui-extension` is a terminal UI enhancement package for [Pi Coding Agent](https://github.com/earendil-works/pi). It adds a right-side information sidebar, session management, context inspection, tool/MCP usage tracking, and a compact footer without modifying Pi Core.
4
6
 
5
- ## Requirements
7
+ The package can be installed from npm or Git, and uses GitHub Actions for type checking, automated tests, and npm Trusted Publishing via OIDC.
8
+
9
+ ## Preview
10
+
11
+ <img width="1377" height="671" alt="pi-ui-extension preview" src="https://github.com/user-attachments/assets/ddea5dc9-8796-433a-abfc-c7ea2adec089" />
12
+
13
+ ## Features
14
+
15
+ ### 1. Right-side Sidebar
16
+
17
+ The extension mounts a right-side sidebar in Pi's fullscreen TUI. It contains three default panels:
18
+
19
+ - **SESSIONS**: recent sessions and resource shortcuts.
20
+ - **CTX**: model, context window, composition estimates, and runtime performance.
21
+ - **TOOL VIEW**: tool transcript display modes and Tool/MCP usage statistics.
22
+
23
+ The sidebar supports mouse interaction, wheel scrolling, and terminal resize handling. Panels shrink or become scrollable when vertical space is limited.
24
+
25
+ > The sidebar depends on Pi fullscreen TUI mode. In non-fullscreen mode, the extension degrades safely and does not force layout replacement.
26
+
27
+ ### 2. Session management
28
+
29
+ The `SESSIONS` panel provides quick access to recent sessions:
30
+
31
+ - Click a session to switch to it.
32
+ - Rename a non-current session.
33
+ - Delete a non-current session.
34
+ - Use the `⊗` action to remove all other sessions.
35
+ - Click `SESSIONS ↻` to refresh the session list.
36
+
37
+ To avoid corrupting active agent state, switching, renaming, deleting, and bulk cleanup are only allowed while Pi is idle. The current session cannot be deleted.
38
+
39
+ ### 3. Resource shortcuts
40
+
41
+ The bottom of the `SESSIONS` panel exposes four resource categories:
42
+
43
+ - `AGENTS.md`
44
+ - `Skills`
45
+ - `Extensions`
46
+ - `MCP`
47
+
48
+ These shortcuts let you inspect the resources currently loaded by the project/Pi environment, making it easier to verify which agent instructions, skills, extensions, and MCP servers are actually available.
49
+
50
+ ### 4. CTX context inspection
51
+
52
+ The `CTX` panel shows context and runtime information for the current model request, including:
53
+
54
+ - Current model name.
55
+ - Thinking level.
56
+ - Pi context usage / context window.
57
+ - Current-question context delta relative to the previous settled state.
58
+ - Context composition estimates.
59
+ - Image count.
60
+ - Turn count and run duration.
61
+ - Average TTFT (Time To First Token).
62
+ - Average TPS (Tokens Per Second).
63
+ - Latest observed TTFT with speed label.
64
+ - Cache-related metrics when observable.
65
+
66
+ Context composition is grouped into:
67
+
68
+ - `System`
69
+ - `Tools`
70
+ - `Messages`
71
+ - `Tool Results`
72
+ - `Summary`
73
+ - `Other`
74
+
75
+ Token counts are local heuristic estimates intended for composition and trend visibility. They are **not** provider-accurate tokenizer results and are not billing-token counts.
76
+
77
+ For tool definitions, the extension prefers the observable provider-request tool payload when available. Before a provider request exists, it falls back to estimating the schemas of Pi's currently enabled tools.
78
+
79
+ ### 5. Tool View modes
80
+
81
+ `TOOL VIEW` supports three transcript display modes:
82
+
83
+ - **Normal**: standard tool transcript rendering.
84
+ - **Compact**: denser tool output rendering.
85
+ - **Hidden**: hide tool transcripts.
86
+
87
+ Modes can be changed directly with mouse clicks.
88
+
89
+ When Fabric takes ownership of tool rendering, the panel remains visible for usage statistics but the local mode selector is hidden and replaced with `View controlled by Fabric`. This avoids conflicting display control.
90
+
91
+ ### 6. Tool / MCP usage statistics
92
+
93
+ Tool View groups usage into:
94
+
95
+ - `TOOLS`
96
+ - `MCP`
97
+
98
+ Each entry is shown as:
99
+
100
+ ```text
101
+ current-question calls / current-session calls
102
+ ```
103
+
104
+ Example:
105
+
106
+ ```text
107
+ task_todos 1/5
108
+ ```
109
+
110
+ Usage state is rebuilt when the active branch changes, so restored sessions and branch switches do not blindly reuse counts from another branch.
111
+
112
+ For calls made through MCP gateways, `mcpScript`, and similar wrappers, the extension attempts to attribute activity to the actual MCP server instead of counting only the outer wrapper tool.
113
+
114
+ ### 7. Footer
115
+
116
+ The extension replaces the default footer with a compact view that displays:
117
+
118
+ - Current working directory.
119
+ - Current Git branch, when available.
120
+
121
+ The path is automatically truncated to fit terminal width.
122
+
123
+ ## Installation
124
+
125
+ ### Recommended: install from npm
126
+
127
+ ```bash
128
+ pi install npm:pi-ui-extension
129
+ ```
130
+
131
+ Pi installs the package and writes the declaration to:
132
+
133
+ ```text
134
+ ~/.pi/agent/settings.json
135
+ ```
136
+
137
+ Example configuration:
138
+
139
+ ```json
140
+ {
141
+ "packages": [
142
+ "npm:pi-ui-extension"
143
+ ]
144
+ }
145
+ ```
6
146
 
7
- - Node.js 24+
8
- - A compatible Pi Coding Agent installation
147
+ To pin a specific version:
148
+
149
+ ```bash
150
+ pi install npm:pi-ui-extension@1.1.1
151
+ ```
152
+
153
+ or:
154
+
155
+ ```json
156
+ {
157
+ "packages": [
158
+ "npm:pi-ui-extension@1.1.1"
159
+ ]
160
+ }
161
+ ```
162
+
163
+ Pinned packages do not automatically move to newer versions.
164
+
165
+ ### Install from GitHub
166
+
167
+ You can also install directly from the Git repository:
168
+
169
+ ```bash
170
+ pi install git:github.com/1993yihuan/pi-ui-extension
171
+ ```
172
+
173
+ Configuration form:
174
+
175
+ ```json
176
+ {
177
+ "packages": [
178
+ "git:github.com/1993yihuan/pi-ui-extension"
179
+ ]
180
+ }
181
+ ```
182
+
183
+ Pin to a Git tag:
184
+
185
+ ```bash
186
+ pi install git:github.com/1993yihuan/pi-ui-extension@v1.1.1
187
+ ```
9
188
 
10
- ## Development
189
+ ### Temporary usage
190
+
191
+ To load the package for a single Pi launch without modifying `settings.json`:
192
+
193
+ ```bash
194
+ pi -e npm:pi-ui-extension
195
+ ```
196
+
197
+ ### Project-local installation
198
+
199
+ To enable the package only for the current project:
200
+
201
+ ```bash
202
+ pi install --local npm:pi-ui-extension
203
+ ```
204
+
205
+ The declaration is written to:
206
+
207
+ ```text
208
+ <project>/.pi/settings.json
209
+ ```
210
+
211
+ Project-local packages are loaded only after the project is trusted by Pi.
212
+
213
+ ## Update and removal
214
+
215
+ Update unpinned extensions:
216
+
217
+ ```bash
218
+ pi update --extensions
219
+ ```
220
+
221
+ List configured packages:
222
+
223
+ ```bash
224
+ pi list
225
+ ```
226
+
227
+ Remove the npm source:
228
+
229
+ ```bash
230
+ pi remove npm:pi-ui-extension
231
+ ```
232
+
233
+ If installed from Git, remove the corresponding Git source:
234
+
235
+ ```bash
236
+ pi remove git:github.com/1993yihuan/pi-ui-extension
237
+ ```
238
+
239
+ ## npm or Git?
240
+
241
+ For normal usage, npm is recommended:
242
+
243
+ ```text
244
+ npm:pi-ui-extension
245
+ ```
246
+
247
+ It provides clear SemVer versioning, predictable installation, and easy version pinning.
248
+
249
+ Use Git when you want to follow the latest repository state or test changes that have not yet been published to npm:
250
+
251
+ ```text
252
+ git:github.com/1993yihuan/pi-ui-extension
253
+ ```
254
+
255
+ For active local development, loading a local checkout is usually faster than committing, pushing, and updating on every change.
256
+
257
+ ## Local development
258
+
259
+ Clone the repository:
260
+
261
+ ```bash
262
+ git clone https://github.com/1993yihuan/pi-ui-extension.git
263
+ cd pi-ui-extension
264
+ ```
11
265
 
12
266
  Install dependencies:
13
267
 
@@ -21,23 +275,108 @@ Run the full validation suite:
21
275
  npm run check
22
276
  ```
23
277
 
24
- Or run checks separately:
278
+ Equivalent commands:
25
279
 
26
280
  ```bash
27
281
  npm run typecheck
28
282
  npm test
29
283
  ```
30
284
 
31
- ## Package entry
285
+ The test suite covers the main behavior of Sidebar, CTX, Session management, Tool View, MCP resources, Fabric detection, mouse scrolling, and resize handling.
286
+
287
+ During development, Pi can load the local source directory directly:
288
+
289
+ ```bash
290
+ pi install ./path/to/pi-ui-extension
291
+ ```
292
+
293
+ Or load it temporarily for one run:
294
+
295
+ ```bash
296
+ pi -e ./path/to/pi-ui-extension
297
+ ```
298
+
299
+ ## Package structure
300
+
301
+ ```text
302
+ pi-ui-extension/
303
+ ├── extensions/
304
+ │ ├── ctx/ # Context composition, delta, runtime metrics
305
+ │ ├── footer/ # Footer
306
+ │ ├── mcp/ # MCP resource / usage integration
307
+ │ ├── session/ # Session list and actions
308
+ │ ├── sidebar/ # Sidebar layout, scrolling, resize
309
+ │ ├── tool-view/ # Tool View modes and usage statistics
310
+ │ ├── fabric-detection.ts # Fabric ownership detection
311
+ │ └── index.ts # Pi Extension entry point
312
+ ├── .github/workflows/
313
+ │ ├── ci.yml # Automatic checks on push / PR
314
+ │ └── release.yml # npm publishing + GitHub Release on tags
315
+ ├── package.json
316
+ └── tsconfig.check.json
317
+ ```
318
+
319
+ Pi's extension entry point is declared explicitly in `package.json`:
320
+
321
+ ```json
322
+ {
323
+ "pi": {
324
+ "extensions": [
325
+ "./extensions/index.ts"
326
+ ]
327
+ }
328
+ }
329
+ ```
330
+
331
+ ## CI / Release
32
332
 
33
- Pi loads the extension from:
333
+ Every push to `main` and every pull request runs:
34
334
 
35
335
  ```text
36
- ./extensions/index.ts
336
+ npm ci
337
+ → npm run typecheck
338
+ → npm test
339
+ ```
340
+
341
+ To publish a release, create a version tag, for example:
342
+
343
+ ```bash
344
+ npm version patch
345
+ git push
346
+ git push --tags
37
347
  ```
38
348
 
39
- The package metadata is declared in `package.json` under the `pi.extensions` field.
349
+ A `v*` tag triggers the release workflow:
350
+
351
+ ```text
352
+ Checkout
353
+ → Node.js 24
354
+ → npm ci
355
+ → npm run check
356
+ → verify tag == package.json version
357
+ → npm pack --dry-run
358
+ → npm Trusted Publishing (OIDC)
359
+ → npm publish
360
+ → GitHub Release
361
+ ```
362
+
363
+ npm publishing uses GitHub Actions OIDC Trusted Publishing, so no long-lived `NPM_TOKEN` is required in the repository.
364
+
365
+ ## Compatibility and design principles
366
+
367
+ - Does not modify Pi Core.
368
+ - `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` are host-provided peer dependencies to avoid duplicate runtime instances.
369
+ - Fabric ownership is detected explicitly to avoid conflicting Tool View controls.
370
+ - Session and resource operations use Pi public APIs wherever possible.
371
+ - Context composition is clearly presented as an estimate, not provider-exact token accounting.
372
+ - Fullscreen sidebar behavior degrades safely when fullscreen layout is unavailable.
373
+
374
+ ## Requirements
375
+
376
+ - Pi Coding Agent
377
+ - Node.js `>= 22.19.0` (use a Node version supported by your Pi installation)
378
+ - Development and CI currently use Node.js 24
40
379
 
41
- ## Notes
380
+ ## License
42
381
 
43
- This repository contains only the extension source and development metadata. Local Pi runtime configuration, credentials, sessions, caches, and browser profiles are intentionally excluded.
382
+ This repository does not currently declare a dedicated LICENSE. If the project is intended for long-term public open-source use, adding an explicit license is recommended.
@@ -0,0 +1,382 @@
1
+ [English](README.md) | [简体中文](README.zh-CN.md)
2
+
3
+ # pi-ui-extension
4
+
5
+ `pi-ui-extension` 是一个面向 [Pi Coding Agent](https://github.com/earendil-works/pi) 的终端 UI 增强包,在不修改 Pi Core 的前提下,为全屏 TUI 增加右侧信息栏、会话管理、上下文观察、工具调用统计以及更紧凑的 Footer。
6
+
7
+ 当前包同时支持通过 npm 或 Git 安装,并使用 GitHub Actions 完成类型检查、自动化测试和 npm Trusted Publishing(OIDC)发布。
8
+
9
+ ## 界面预览
10
+
11
+ <img width="1377" height="671" alt="pi-ui-extension 界面预览" src="https://github.com/user-attachments/assets/ddea5dc9-8796-433a-abfc-c7ea2adec089" />
12
+
13
+ ## 功能概览
14
+
15
+ ### 1. 右侧 Sidebar
16
+
17
+ 扩展会在 Pi 的全屏 TUI 中挂载右侧 Sidebar。默认包含三个区域:
18
+
19
+ - **SESSIONS**:最近会话与资源入口。
20
+ - **CTX**:当前模型、上下文窗口、组成估算以及运行性能。
21
+ - **TOOL VIEW**:工具输出显示模式与 Tool / MCP 调用统计。
22
+
23
+ Sidebar 支持鼠标交互、滚轮滚动和终端尺寸变化。终端高度不足时,各区域会根据可用空间自动收缩或出现滚动区域。
24
+
25
+ > 右侧 Sidebar 依赖 Pi fullscreen TUI。非 fullscreen 场景下不会强行替换布局。
26
+
27
+ ### 2. Sessions 会话管理
28
+
29
+ `SESSIONS` 面板提供最近会话的快速管理:
30
+
31
+ - 点击会话切换到对应 Session。
32
+ - 重命名非当前 Session。
33
+ - 删除非当前 Session。
34
+ - 使用右上角 `⊗` 清理除当前 Session 外的其他会话。
35
+ - 点击 `SESSIONS ↻` 刷新会话列表。
36
+
37
+ 为避免正在执行中的 Agent 状态被破坏,会话切换、重命名、删除和批量清理只会在 Pi 空闲时执行;当前正在使用的 Session 不允许删除。
38
+
39
+ ### 3. 资源快速查看
40
+
41
+ `SESSIONS` 面板底部提供四类资源入口:
42
+
43
+ - `AGENTS.md`
44
+ - `Skills`
45
+ - `Extensions`
46
+ - `MCP`
47
+
48
+ 点击后可以直接查看当前项目 / 当前 Pi 环境中已加载的相关资源,便于快速确认 Agent 当前实际使用了哪些上下文、Skill、Extension 和 MCP Server。
49
+
50
+ ### 4. CTX 上下文观察
51
+
52
+ `CTX` 面板用于观察当前模型请求相关的上下文状态,主要包括:
53
+
54
+ - 当前模型名称。
55
+ - Thinking Level。
56
+ - Pi 当前 context usage / context window。
57
+ - 当前提问相对上一轮 settled 状态的上下文增量。
58
+ - Context composition 分类估算。
59
+ - 图片数量。
60
+ - 当前 Run 的 turn 数量与耗时。
61
+ - 平均 TTFT(Time To First Token)。
62
+ - 平均 TPS(Tokens Per Second)。
63
+ - 最近一次 TTFT 及速度标签。
64
+ - 可观测时显示缓存命中相关数据。
65
+
66
+ Composition 会将当前可观测上下文拆分为:
67
+
68
+ - `System`
69
+ - `Tools`
70
+ - `Messages`
71
+ - `Tool Results`
72
+ - `Summary`
73
+ - `Other`
74
+
75
+ 其中 token 数量是本地启发式估算,主要用于观察组成比例和变化趋势,并不是模型厂商的精确 tokenizer 结果,也不等同于计费 token。
76
+
77
+ 工具定义会优先基于 provider request 中实际可观测到的 tool payload 统计;在请求尚未发生时,则回退到 Pi 当前启用工具的 schema 估算。
78
+
79
+ ### 5. Tool View 模式切换
80
+
81
+ `TOOL VIEW` 支持三种工具输出显示模式:
82
+
83
+ - **Normal**:正常显示工具 transcript。
84
+ - **Compact**:使用更紧凑的工具输出展示。
85
+ - **Hidden**:隐藏工具 transcript。
86
+
87
+ 可以直接使用鼠标点击模式进行切换。
88
+
89
+ 当 Fabric 接管工具展示行为时,扩展会保留 Tool View 面板和调用统计,但不再显示本地模式选择器,并提示 `View controlled by Fabric`,避免与 Fabric 的展示逻辑互相抢占。
90
+
91
+ ### 6. Tool / MCP 调用统计
92
+
93
+ Tool View 会将调用拆成两类展示:
94
+
95
+ - `TOOLS`
96
+ - `MCP`
97
+
98
+ 每一项使用:
99
+
100
+ ```text
101
+ 当前提问调用数 / 当前 Session 累计调用数
102
+ ```
103
+
104
+ 例如:
105
+
106
+ ```text
107
+ task_todos 1/5
108
+ ```
109
+
110
+ 统计会跟随当前 active branch 重建,切换分支或恢复 Session 时不会简单沿用旧分支的累计结果。
111
+
112
+ 对于通过 MCP gateway、`mcpScript` 等路径发起的调用,扩展会尽量归属到实际 MCP Server,而不是只统计为一个模糊的外层工具调用。
113
+
114
+ ### 7. Footer
115
+
116
+ 扩展替换默认 Footer,保持界面简洁,显示:
117
+
118
+ - 当前工作目录。
119
+ - 当前 Git branch(存在 Git 仓库时)。
120
+
121
+ 路径会自动压缩到终端宽度以内。
122
+
123
+ ## 安装
124
+
125
+ ### 推荐:从 npm 安装
126
+
127
+ ```bash
128
+ pi install npm:pi-ui-extension
129
+ ```
130
+
131
+ Pi 会安装 package,并将声明写入个人配置:
132
+
133
+ ```text
134
+ ~/.pi/agent/settings.json
135
+ ```
136
+
137
+ 对应配置类似:
138
+
139
+ ```json
140
+ {
141
+ "packages": [
142
+ "npm:pi-ui-extension"
143
+ ]
144
+ }
145
+ ```
146
+
147
+ 如果希望固定版本:
148
+
149
+ ```bash
150
+ pi install npm:pi-ui-extension@1.1.1
151
+ ```
152
+
153
+ 或者:
154
+
155
+ ```json
156
+ {
157
+ "packages": [
158
+ "npm:pi-ui-extension@1.1.1"
159
+ ]
160
+ }
161
+ ```
162
+
163
+ 固定版本属于 pinned package,不会自动移动到后续版本。
164
+
165
+ ### 从 GitHub 安装
166
+
167
+ 也可以直接使用 Git 仓库:
168
+
169
+ ```bash
170
+ pi install git:github.com/1993yihuan/pi-ui-extension
171
+ ```
172
+
173
+ 配置形式:
174
+
175
+ ```json
176
+ {
177
+ "packages": [
178
+ "git:github.com/1993yihuan/pi-ui-extension"
179
+ ]
180
+ }
181
+ ```
182
+
183
+ 固定到 Git tag:
184
+
185
+ ```bash
186
+ pi install git:github.com/1993yihuan/pi-ui-extension@v1.1.1
187
+ ```
188
+
189
+ ### 临时试用
190
+
191
+ 如果只想在一次 Pi 启动中测试,不修改 `settings.json`:
192
+
193
+ ```bash
194
+ pi -e npm:pi-ui-extension
195
+ ```
196
+
197
+ ### 项目级安装
198
+
199
+ 需要只对当前项目生效时:
200
+
201
+ ```bash
202
+ pi install --local npm:pi-ui-extension
203
+ ```
204
+
205
+ 声明会写入:
206
+
207
+ ```text
208
+ <project>/.pi/settings.json
209
+ ```
210
+
211
+ 项目级 Package 只有在项目被 Pi 信任后才会加载。
212
+
213
+ ## 更新与卸载
214
+
215
+ 更新未固定版本的扩展:
216
+
217
+ ```bash
218
+ pi update --extensions
219
+ ```
220
+
221
+ 查看当前配置的 Package:
222
+
223
+ ```bash
224
+ pi list
225
+ ```
226
+
227
+ 卸载 npm 版本:
228
+
229
+ ```bash
230
+ pi remove npm:pi-ui-extension
231
+ ```
232
+
233
+ 如果安装的是 Git 源,则使用对应 Git source 删除:
234
+
235
+ ```bash
236
+ pi remove git:github.com/1993yihuan/pi-ui-extension
237
+ ```
238
+
239
+ ## npm 与 Git 应该选哪个?
240
+
241
+ 日常使用推荐 npm:
242
+
243
+ ```text
244
+ npm:pi-ui-extension
245
+ ```
246
+
247
+ 优点是版本语义清晰、安装速度稳定,并且可以直接固定 SemVer 版本。
248
+
249
+ 如果希望始终跟随仓库最新代码,或者需要测试尚未发布到 npm 的提交,可以使用:
250
+
251
+ ```text
252
+ git:github.com/1993yihuan/pi-ui-extension
253
+ ```
254
+
255
+ 本地开发阶段则推荐直接加载本地源码目录,避免每次调试都必须 commit / push / update。
256
+
257
+ ## 本地开发
258
+
259
+ 克隆仓库:
260
+
261
+ ```bash
262
+ git clone https://github.com/1993yihuan/pi-ui-extension.git
263
+ cd pi-ui-extension
264
+ ```
265
+
266
+ 安装开发依赖:
267
+
268
+ ```bash
269
+ npm ci
270
+ ```
271
+
272
+ 完整检查:
273
+
274
+ ```bash
275
+ npm run check
276
+ ```
277
+
278
+ 等价于:
279
+
280
+ ```bash
281
+ npm run typecheck
282
+ npm test
283
+ ```
284
+
285
+ 当前自动化测试覆盖 Sidebar、CTX、Session、Tool View、MCP resource、Fabric detection、鼠标滚轮 / resize 等主要行为。
286
+
287
+ 开发时可以直接让 Pi 加载本地目录:
288
+
289
+ ```bash
290
+ pi install ./path/to/pi-ui-extension
291
+ ```
292
+
293
+ 或者在一次启动中临时加载:
294
+
295
+ ```bash
296
+ pi -e ./path/to/pi-ui-extension
297
+ ```
298
+
299
+ ## Package 结构
300
+
301
+ ```text
302
+ pi-ui-extension/
303
+ ├── extensions/
304
+ │ ├── ctx/ # 上下文组成、增量与运行性能
305
+ │ ├── footer/ # Footer
306
+ │ ├── mcp/ # MCP resource / usage 集成
307
+ │ ├── session/ # Session 列表与操作
308
+ │ ├── sidebar/ # Sidebar 布局、滚动和 resize
309
+ │ ├── tool-view/ # Tool View 模式与调用统计
310
+ │ ├── fabric-detection.ts # Fabric 工具接管检测
311
+ │ └── index.ts # Pi Extension 入口
312
+ ├── .github/workflows/
313
+ │ ├── ci.yml # push / PR 自动检查
314
+ │ └── release.yml # tag 自动发布 npm + GitHub Release
315
+ ├── package.json
316
+ └── tsconfig.check.json
317
+ ```
318
+
319
+ Pi 的扩展入口在 `package.json` 中显式声明:
320
+
321
+ ```json
322
+ {
323
+ "pi": {
324
+ "extensions": [
325
+ "./extensions/index.ts"
326
+ ]
327
+ }
328
+ }
329
+ ```
330
+
331
+ ## CI / Release
332
+
333
+ 提交到 `main` 或创建 PR 时,GitHub Actions 会自动执行:
334
+
335
+ ```text
336
+ npm ci
337
+ → npm run typecheck
338
+ → npm test
339
+ ```
340
+
341
+ 发布版本时使用 Git tag,例如:
342
+
343
+ ```bash
344
+ npm version patch
345
+ git push
346
+ git push --tags
347
+ ```
348
+
349
+ `v*` tag 会触发 Release workflow:
350
+
351
+ ```text
352
+ Checkout
353
+ → Node.js 24
354
+ → npm ci
355
+ → npm run check
356
+ → 校验 tag 与 package.json version
357
+ → npm pack --dry-run
358
+ → npm Trusted Publishing (OIDC)
359
+ → npm publish
360
+ → GitHub Release
361
+ ```
362
+
363
+ npm 发布使用 GitHub Actions OIDC Trusted Publishing,不需要在 GitHub Repository 中保存长期 `NPM_TOKEN`。
364
+
365
+ ## 兼容性与设计原则
366
+
367
+ - 不修改 Pi Core。
368
+ - Pi host 提供的 `@earendil-works/pi-coding-agent` 和 `@earendil-works/pi-tui` 使用 `peerDependencies`,避免产生重复运行时实例。
369
+ - 对 Fabric 做显式检测,避免 Tool View 模式控制发生冲突。
370
+ - Session 与资源操作尽量通过 Pi 已公开 API 完成。
371
+ - Context composition 明确标记为估算值,不冒充 provider 精确 token 统计。
372
+ - fullscreen Sidebar 不可用时安全降级,不影响 Pi 主流程。
373
+
374
+ ## Requirements
375
+
376
+ - Pi Coding Agent
377
+ - Node.js `>= 22.19.0`(建议使用当前 Pi 支持的 Node 版本)
378
+ - 开发与 CI 当前使用 Node.js 24
379
+
380
+ ## License
381
+
382
+ 当前仓库尚未声明独立 LICENSE。如准备将项目作为正式开源项目长期维护,建议补充明确的开源许可证。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ui-extension",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "description": "Pi UI extension with footer, split-view sidebar, and configurable tool transcript rendering",
6
6
  "keywords": [