pi-my-compact-ui 0.2.2 → 0.4.0

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
@@ -19,9 +19,9 @@ glyph is a spinner while the entry is still streaming:
19
19
 
20
20
  ```text
21
21
  ⠋ tool calling...
22
- │ ✓ thinking: The parser test is failing… · 1.2K tok
22
+ │ ✓ thinking The parser test is failing… (1.2k)
23
23
  │ ✓ bash: npm test (3.2s)
24
- └ ⠋ thinking: The assertion is off by one…
24
+ └ ⠋ thinking The assertion is off by one…
25
25
  ```
26
26
 
27
27
  Expand the group to inspect tool arguments, result previews, and more of the
@@ -29,7 +29,7 @@ reasoning content:
29
29
 
30
30
  ```text
31
31
  ✓ tools done
32
- ├─ ✓ thinking · 1.2K tok
32
+ ├─ ✓ thinking (1.2k)
33
33
  │ The validation path now handles expired sessions…
34
34
  ├─ ✓ read: src/auth.ts (0.1s)
35
35
  │ export async function authenticate() { …
@@ -50,6 +50,7 @@ reasoning content:
50
50
  - Shows reasoning-token usage. During streaming it uses an estimate, then
51
51
  prefers provider-reported usage when available.
52
52
  - Follows Pi's standard `Ctrl+O` expand and collapse behavior.
53
+ - Press `Ctrl+I` (or run `/compact-inspect`) to interactively select any tool call or thinking run with `↑`/`↓` and press `Enter` to pop up a centered modal showing full details. Press `Esc` or `q` to close.
53
54
  - Renders fenced code blocks as subtle theme-aware background panels with
54
55
  syntax highlighting and one character of horizontal padding instead of
55
56
  decorative top and bottom border rows.
@@ -135,6 +136,33 @@ Its main responsibilities are:
135
136
  > control their presentation. Actual execution is still delegated to Pi's
136
137
  > native tool implementations.
137
138
 
139
+ ## 开发与测试
140
+
141
+ 公开入口仍为 `index.ts`,实现按职责拆分在 `src/`:
142
+
143
+ | 模块 | 职责 |
144
+ |---|---|
145
+ | `config.ts` / `settings.ts` | 配置读写与交互式设置;读写器可注入,测试不写入用户配置 |
146
+ | `helpers.ts` / `types.ts` / `constants.ts` | 格式化、流式参数解析、共享类型和常量 |
147
+ | `state.ts` | 集中管理运行状态;`createRuntimeState()` 创建独立状态快照 |
148
+ | `thinking.ts` / `streaming-tools.ts` | 思考生命周期、工具占位行和执行时间 |
149
+ | `tool-group.ts` / `markdown.ts` / `compaction.ts` / `modals.ts` | 分组、代码块、压缩摘要与弹窗渲染 |
150
+ | `guards.ts` / `grouping.ts` / `assistant-patches.ts` | 组件识别、分组、正文锚点与 Pi 原生组件适配 |
151
+ | `animation.ts` / `extension.ts` | 动画调度、命令与事件接入 |
152
+
153
+ ```bash
154
+ npm run typecheck # 严格 TypeScript 检查,包含源码和测试
155
+ npm test # 编译到 .test-build/,使用 Node 内置测试框架
156
+ npm run check # 类型检查 + 全部测试,CI 和发布前自动执行
157
+ ```
158
+
159
+ 测试位于 `tests/`,覆盖纯逻辑、配置与数值编辑器、ANSI/中文代码块、
160
+ 分组与弹窗、流式事件顺序、正文封组、历史锚点、热重载,以及 Pi 实际
161
+ TypeScript 扩展加载器。测试无需新增依赖;`.test-build/` 不进入版本控制或发布包。
162
+
163
+ 涉及真实终端的改动还需手动验证:通过 `pi -e ./index.ts` 加载,检查流式
164
+ 思考与并行工具、正文切换、`Ctrl+O` 展开、`Ctrl+I` 弹窗、设置保存和 `/reload`。
165
+
138
166
  ## License
139
167
 
140
168
  MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,3 @@
1
+ /** Public Pi extension entry point; implementation is split by responsibility. */
2
+ export { default } from "./src/extension.js";
3
+ export { getCompactMarkdownTheme, normalizeCompactCodeBlockLines } from "./src/markdown.js";