pi-sakura-cyberdeck 1.5.2 → 1.5.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +36 -18
  3. package/README.zh-CN.md +7 -5
  4. package/extensions/changelog/index.ts +186 -42
  5. package/extensions/claude-shimmer/index.ts +336 -140
  6. package/extensions/header/index.ts +84 -41
  7. package/extensions/matrix/index.ts +221 -69
  8. package/extensions/shared/color.ts +90 -36
  9. package/extensions/shared/config-file.ts +324 -0
  10. package/extensions/shared/tui-context.ts +78 -0
  11. package/extensions/zentui/config.ts +87 -128
  12. package/extensions/zentui/extension-status.ts +158 -19
  13. package/extensions/zentui/footer-format.ts +279 -85
  14. package/extensions/zentui/footer-segments.ts +630 -0
  15. package/extensions/zentui/footer.ts +668 -525
  16. package/extensions/zentui/format.ts +43 -19
  17. package/extensions/zentui/git.ts +362 -167
  18. package/extensions/zentui/gradient.ts +100 -50
  19. package/extensions/zentui/index.ts +172 -59
  20. package/extensions/zentui/live-context.ts +2 -1
  21. package/extensions/zentui/package-version.ts +102 -14
  22. package/extensions/zentui/project-refresh.ts +42 -20
  23. package/extensions/zentui/project-state.ts +2 -2
  24. package/extensions/zentui/runtime.ts +140 -51
  25. package/extensions/zentui/selector-border.ts +96 -16
  26. package/extensions/zentui/session-lifecycle.ts +3 -1
  27. package/extensions/zentui/settings-command.ts +404 -246
  28. package/extensions/zentui/shell-call.ts +140 -26
  29. package/extensions/zentui/style.ts +109 -40
  30. package/extensions/zentui/thinking-trail.ts +234 -9
  31. package/extensions/zentui/tool-execution.ts +144 -64
  32. package/extensions/zentui/ui.ts +698 -145
  33. package/extensions/zentui/user-message.ts +24 -12
  34. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,130 @@
3
3
  All notable changes to pi-sakura-cyberdeck. Pi >= 1.5.0 shows new package entries
4
4
  once after updating; run `/sakura-changelog` on any supported Pi to read this file.
5
5
 
6
+ ## [1.5.4] - 2026-12-03
7
+
8
+ ### Highlights
9
+
10
+ - **Full Pi 1.7.0 compatibility**: honors Pi's `readonly string[]` render contract and `Container`
11
+ frame-identity caching, adapts `/zentui` to Pi 1.7.0's lowercase keybinding-driven `SettingsList`
12
+ hints, adds mouse and keybinding support to dialogs, and resolves config paths lazily for
13
+ `--agent-dir`.
14
+ - **Faster rendering & non-blocking probes**: identity-preserving frame caches for the footer,
15
+ editor and selector borders, gradient/style caching with SGR coalescing, linear parsing for custom
16
+ footer formats and Thought trails, and fully async git, runtime and package-version probes with
17
+ cancellation.
18
+ - **Hardened persistence & lifecycle**: atomic symlink- and size-guarded config saves, live `/theme`
19
+ switches without restarting Pi, BiDi/SGR sanitization for extension statuses, and zero hanging
20
+ timers across all five extensions.
21
+
22
+ ### Added
23
+
24
+ - Mouse and keybinding support in interactive dialogs:
25
+ - `/zentui` settings modal supports clicking section tabs, clicking list items and mouse-wheel
26
+ scrolling with overscroll containment.
27
+ - `/sakura-changelog` supports mouse-wheel scrolling, `Ctrl+C` close and Pi's `tui.select.*`
28
+ keybindings.
29
+ - Atomic JSON config persistence (`extensions/shared/config-file.ts`) with automatic parent
30
+ directory creation, symlink and file-mode preservation, pre-read regular-file and size guards,
31
+ `fsync` + atomic rename and rollback on failure; corrupt config files are never overwritten.
32
+ - Shared TUI context and color-math utilities (`extensions/shared/tui-context.ts`) unifying
33
+ interactive TUI gating, finite width normalization and gradient interpolation across all
34
+ extensions.
35
+
36
+ ### Performance
37
+
38
+ - **Identity-preserving render caches**: static footer renders, `PolishedEditor`,
39
+ `WrappedPolishedEditor` and selector border wrappers reuse cached line arrays on unchanged frames
40
+ so Pi 1.6.0+ `Container` skips redundant redraws. Default segments and `cwd` labels are skipped
41
+ when unused by a custom `footerFormat`, and text-only `$context` no longer wakes the footer pulse
42
+ timer.
43
+ - **Color, gradient & style hot paths**: scalar RGB-to-256 conversion without per-call tuple
44
+ allocations, bounded LRU caches for Sakura gradients, static Macaron gauges and Starship style
45
+ specs, and consecutive-SGR coalescing to reduce ANSI sequences on 256-color terminals.
46
+ - **Non-blocking project probes**: `git`, runtime and package-version probes now use async
47
+ `fs/promises` with `AbortSignal` cancellation and bounded mtime-aware caching instead of
48
+ synchronous filesystem calls.
49
+ - **Linear parsers**: `footer-format` now uses an iterative parser and linear orphan-separator
50
+ cleanup (preventing stack overflows on deeply nested `(` and regex backtracking); `thinking-trail`
51
+ adds a plain-text fast path and linear code-fence scanning.
52
+ - **Streaming & standalone extensions**: `live-context` skips redundant updates when token counts
53
+ are unchanged; `claude-shimmer` skips full-text estimation scans when authoritative usage is
54
+ present; `header` slices artwork to the active width before painting; `matrix` precomputes its
55
+ candy ANSI palette table.
56
+
57
+ ### Fixed
58
+
59
+ - **Pi 1.7.0 & dialogs**:
60
+ - Restored the `Tab/Shift+Tab to switch sections` hint in `/zentui` on Pi 1.7.0 (where
61
+ `SettingsList` renders lowercase keybinding hints) while staying compatible with Pi 1.5.x and
62
+ never rewriting item descriptions at narrow widths.
63
+ - Zentui and Matrix resolve config paths lazily via `getAgentDir()`, honoring Pi 1.7.0's
64
+ `--agent-dir` flag and runtime `PI_CODING_AGENT_DIR` changes.
65
+ - Fixed strict TypeScript compatibility with Pi 1.6.0+'s `Component.render(): readonly string[]`
66
+ and ensured render helpers never mutate frozen caller arrays.
67
+ - **Zentui core, footer & chrome**:
68
+ - Mid-session `/theme` switches now propagate immediately to the editor, footer, tool cards and
69
+ color mode without restarting Pi.
70
+ - Narrow-footer layout no longer overflows its column budget; non-finite context values format
71
+ cleanly as `--`; `toHomePath` matches Windows drive and UNC prefixes case-insensitively.
72
+ - Bare git repositories and `.git/` subdirectories are handled cleanly without spurious errors,
73
+ and transient `git status --show-stash` probe failures are retried instead of cached for the
74
+ whole process.
75
+ - `thinking-trail` handles CRLF fenced code blocks and closing tags inside fenced code cleanly.
76
+ - `tool-execution` resets SGR before the right rail, handles CRLF and empty context lines in diff
77
+ stats, preserves grapheme clusters in card titles, and forwards captured mouse drag/release
78
+ events (matching `PolishedEditor`).
79
+ - Extension statuses strip BiDi override characters, terminate unclosed original SGR spans and
80
+ strip SGR when `colorMode === "none"` (`NO_COLOR` / `TERM=dumb`).
81
+ - Prototype patches roll back atomically on partial install failure, and disabling features across
82
+ `session_start` switches cleanly uninstalls prior UI and timers.
83
+ - Added `thinking-trail` to `/zentui` usage help and argument completions, and validated inputs
84
+ when saving path-display and extension-status settings.
85
+ - **Color detection & standalone extensions**:
86
+ - `detectColorMode` and `syncColorMode` handle `TERM=dumb`, `PI_TRUE_COLOR`, `TMUX`/`screen`
87
+ precedence, `"none"` theme modes and non-finite RGB channels cleanly.
88
+ - `claude-shimmer` pauses its clock and freezes stall timing during `ui_prompt_start` /
89
+ `ui_prompt_end`, suppresses false completion notices after pre-message API errors, resets active
90
+ tool counts across turns and sessions, and restores Pi's working UI on `session_shutdown`.
91
+ - `matrix` pauses during UI prompts, reloads config on `session_start`, rejects extra tokens in
92
+ `/sakura-matrix` commands, and guards invalid widths/heights and `ctx.isIdle?.()`.
93
+ - `header` emits zero ANSI sequences in `NO_COLOR` mode across all widths and only clears a header
94
+ it owns on shutdown.
95
+ - `changelog` handles fenced code blocks, narrow/non-finite widths, empty `0/0` states and
96
+ headless `notify` fallbacks safely.
97
+ - Every timer across all five extensions calls `.unref?.()` so background timers never hold the
98
+ Node process open on exit.
99
+
100
+ ### Development
101
+
102
+ - Bumped `scripts/dev-setup.mjs` default Pi host to `1.7.0`, honored `PI_HOST_ROOT` in
103
+ `test/theme.test.ts`, upgraded `scripts/check.mjs` to a lexer-based import scanner, removed the
104
+ `style.ts` ↔ `config.ts` type import cycle, decomposed high-complexity modules
105
+ (`footer-segments.ts`, `git.ts`, `settings-command.ts`), and added static invariant tests plus an
106
+ end-to-end test suite (`npm run test:e2e`) wired into CI.
107
+
108
+ ## [1.5.3] - 2026-11-28
109
+
110
+ ### Highlights
111
+
112
+ - **Tagged thinking trails**: inline `<thinking>…</thinking>` (and `<think>` / `<thought>`) tags
113
+ written into assistant replies now render as a `✦ Thought trail`.
114
+ - **npm Trusted Publishing (OIDC)**: automated GitHub Actions CI and OIDC release publishing with
115
+ provenance attestations.
116
+
117
+ ### Fixed
118
+
119
+ - Reasoning that a model writes into its answer as `<thinking>…</thinking>` (also `<think>` and
120
+ `<thought>`), as Gemini often does behind OpenAI-compatible endpoints, is now shown as a
121
+ `✦ Thought trail` instead of literal tags. Only tags at the start of a line outside fenced code
122
+ count; an unclosed tag is a trail while streaming and stays literal once the message is final.
123
+ Display-only, and `/zentui thinking-trail off` keeps Pi's stock rendering.
124
+
125
+ ### Development
126
+
127
+ - Added GitHub Actions CI (`ci.yml`) and npm Trusted Publishing via OIDC (`publish.yml`) with
128
+ automatic provenance.
129
+
6
130
  ## [1.5.2] - 2026-11-18
7
131
 
8
132
  ### Highlights
package/README.md CHANGED
@@ -7,7 +7,7 @@ Lightweight Sakura Macaron visual pack for [Pi](https://pi.dev): a pastel theme,
7
7
  ## Quick start
8
8
 
9
9
  ```bash
10
- pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
10
+ pi install npm:pi-sakura-cyberdeck
11
11
  ```
12
12
 
13
13
  Then pick the theme in `/settings` → **sakura-macaron** and restart Pi once. Details: [Install](#install).
@@ -18,7 +18,7 @@ Then pick the theme in `/settings` → **sakura-macaron** and restart Pi once. D
18
18
  <sub>Real Pi 1.5.2 session rendered by this pack (scripted demo model; GohuFont uni14 Nerd Font Mono).</sub>
19
19
  </p>
20
20
 
21
- **v1.5.2** — frames every tool card (image results included), brings back Pi's bash-mode and scroll cues in the Sakura editor frame, and hardens the footer, settings, changelog viewer, matrix rain and shimmer. See [what changed](#152).
21
+ **v1.5.4** — full Pi 1.7.0 compatibility, identity-preserving render caches, async non-blocking probes, atomic config persistence and broad robustness hardening. See [what changed](#154).
22
22
 
23
23
  ## What’s inside
24
24
 
@@ -95,10 +95,11 @@ Other editor extensions (e.g. `pi-fff`) keep their input and autocomplete inside
95
95
  - One step per thinking paragraph, first line only; rails/`◇` in the sakura gradient, body in the thinking tint
96
96
  - Wrapped rows keep their `│` rail, including long inline code, URLs, backticks and math; each digest row is literal text rather than reparsed Markdown. Long trails cap at 16 rows, then `╰─ … +N more`. Very narrow widths fall back to Pi's normal thinking render.
97
97
  - Display-only via Pi's public markdown transformer; the session and model context keep the full thinking text
98
+ - Reasoning a model writes into its answer as `<thinking>…</thinking>` (also `<think>` / `<thought>`, common with Gemini) gets the same trail; only line-start tags outside code fences count
98
99
 
99
100
  ## Requirements
100
101
 
101
- - Pi **>= 0.87.1** (tested on 0.87.1, 0.99.1 and 1.5.2)
102
+ - Pi **>= 0.87.1** (tested on 0.87.1, 0.99.1, 1.5.2 and 1.7.0)
102
103
  - Dark terminal background (the theme does not paint a background)
103
104
  - Truecolor recommended; 256-color terminals get the nearest palette colors, `NO_COLOR` disables the pack’s own colors
104
105
  - Nerd Font for the default icons (`icons.mode: "ascii"` works without)
@@ -107,10 +108,20 @@ Other editor extensions (e.g. `pi-fff`) keep their input and autocomplete inside
107
108
 
108
109
  ## Install
109
110
 
111
+ From npm:
112
+
113
+ ```bash
114
+ pi install npm:pi-sakura-cyberdeck
115
+ ```
116
+
117
+ From Git:
118
+
110
119
  ```bash
111
120
  pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
112
121
  ```
113
122
 
123
+ Pi treats the npm and Git sources as different packages, so install from one only. To switch, `pi remove` the old source first.
124
+
114
125
  Local:
115
126
 
116
127
  ```bash
@@ -123,18 +134,22 @@ Then `/settings` → theme **sakura-macaron** (Pi 0.99 defaults to its `system`
123
134
 
124
135
  ### Updating
125
136
 
126
- For an unpinned Git installation:
137
+ For an unpinned installation:
127
138
 
128
139
  ```bash
140
+ pi update npm:pi-sakura-cyberdeck
141
+ # or, if you installed from Git
129
142
  pi update git:github.com/beautifulrem/pi-sakura-cyberdeck
130
143
  ```
131
144
 
132
145
  Restart Pi after updating. Pi **>= 1.5.0** shows what changed under **Extension Updates** on the next fresh launch (its own package-changelog notice, condensed when `collapseChangelog` is set). On older Pi versions, use `/sakura-changelog`; the command always opens the full changelog inside Pi. See also [CHANGELOG.md](CHANGELOG.md).
133
146
 
134
- Pi does not push package updates automatically. Users who pinned a tag or commit must explicitly select the new version:
147
+ Pi does not push package updates automatically. Users who pinned a version, tag or commit must explicitly select the new version:
135
148
 
136
149
  ```bash
137
- pi install git:github.com/beautifulrem/pi-sakura-cyberdeck@v1.2.0
150
+ pi install npm:pi-sakura-cyberdeck@1.5.4
151
+ # or
152
+ pi install git:github.com/beautifulrem/pi-sakura-cyberdeck@v1.5.4
138
153
  ```
139
154
 
140
155
  Notes for 1.2.0:
@@ -160,13 +175,13 @@ Or start with `pi --tui-mode fullscreen`. Pack styling (editor chrome, footer, s
160
175
 
161
176
  ### Load only some pieces
162
177
 
163
- Pi can filter a package's resources. Replace the plain source string in `~/.pi/agent/settings.json` with an object:
178
+ Pi can filter a package's resources. Replace the plain source string in `~/.pi/agent/settings.json` with an object. Keep `source` exactly as it is in your settings (a Git source, or an npm version pin such as `npm:pi-sakura-cyberdeck@1.5.4`); changing it installs a different package rather than filtering the one you have.
164
179
 
165
180
  ```jsonc
166
181
  {
167
182
  "packages": [
168
183
  {
169
- "source": "git:github.com/beautifulrem/pi-sakura-cyberdeck",
184
+ "source": "npm:pi-sakura-cyberdeck",
170
185
  // everything except the startup header and matrix rain
171
186
  "extensions": ["extensions/*/index.ts", "!extensions/header/index.ts", "!extensions/matrix/index.ts"]
172
187
  }
@@ -224,26 +239,29 @@ Avoid stacking with `pi-zentui`, `pi-powerline-footer`, stock `pi-claude-shimmer
224
239
 
225
240
  Full history: [CHANGELOG.md](CHANGELOG.md) (also available in Pi via `/sakura-changelog`).
226
241
 
227
- ### 1.5.2
242
+ ### 1.5.4
228
243
 
229
- - Tool cards with image results (`read` of a PNG on a vision model, browser screenshots) are framed
230
- like every other card; terminal image rows only gain the left rail.
231
- - The framed editor shows Pi's bash-mode colour while the prompt starts with `!`, and keeps the
232
- `↑/↓ N more` scroll labels. Sent prompts keep Pi's OSC 133 prompt markers at line start.
233
- - Footer: right side (context, tokens, cost) survives narrow terminals; virtual models show context;
234
- literal `|` separators keep neighbouring colours; another extension's footer is never removed;
235
- fewer git/runtime probes.
236
- - Settings, `/sakura-changelog`, matrix rain and shimmer fixes. See [CHANGELOG.md](CHANGELOG.md).
244
+ - Full Pi 1.7.0 support: `readonly string[]` render contract and `Container` identity caching,
245
+ lowercase `SettingsList` hints in `/zentui`, mouse and keybinding controls for `/zentui` and
246
+ `/sakura-changelog`, and lazy `getAgentDir()` resolution for `--agent-dir`.
247
+ - Performance: identity-preserving frame caches for the footer, editor and selector borders; scalar
248
+ RGB-to-256 conversion with LRU gradient/style caching and SGR coalescing; non-blocking async git,
249
+ runtime and package-version probes with `AbortSignal`; iterative `footer-format` parsing and
250
+ linear `thinking-trail` fence scanning (fixing CRLF fences).
251
+ - Robustness: atomic symlink- and size-guarded config saves, immediate mid-session `/theme` updates,
252
+ BiDi/SGR sanitization for extension statuses, `.unref()` across all timers, and standalone
253
+ extension hardening across `claude-shimmer`, `matrix`, `header` and `changelog`.
237
254
 
238
255
  ### Earlier versions
239
256
 
240
- See [CHANGELOG.md](CHANGELOG.md) for 1.0.0 – 1.5.1.
257
+ See [CHANGELOG.md](CHANGELOG.md) for 1.0.0 – 1.5.3.
241
258
 
242
259
  ## Development
243
260
 
244
261
  ```bash
245
262
  npm run dev:setup # installs Pi + TypeScript into .dev/ (not shipped, no package deps)
246
263
  npm run verify # package check + strict typecheck + unit tests
264
+ npm run test:e2e # end-to-end suite against the installed Pi host
247
265
  PI_HOST_ROOT=/path/to/node_modules/@earendil-works/pi-coding-agent npm test # test against another Pi
248
266
  ```
249
267
 
package/README.zh-CN.md CHANGED
@@ -7,9 +7,11 @@
7
7
  ## 快速开始
8
8
 
9
9
  ```bash
10
- pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
10
+ pi install npm:pi-sakura-cyberdeck
11
11
  ```
12
12
 
13
+ 也可以从 Git 安装:`pi install git:github.com/beautifulrem/pi-sakura-cyberdeck`。两种来源 Pi 会当成两个不同的包,只装一个;要换来源,先 `pi remove` 旧的。
14
+
13
15
  然后在 `/settings` 里把主题选成 **sakura-macaron**,重启一次 Pi。
14
16
 
15
17
  <p align="center">
@@ -36,11 +38,11 @@ pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
36
38
  - **底栏**:上下文用量条、token 和费用统计与 Pi 自带底栏一致;显示 git 分支和运行时版本。`/zentui pulse on` 可在工作时让渐变动起来。
37
39
  - **工具卡片**:标题一条连续的樱花渐变,状态始终写明(`RUNNING` / `COMPLETE` / `FAILED`);`edit` 显示 `+N −M` 行数;工具输出保持 Pi 原样,不重新上色。
38
40
  - **Bash 命令头**:用 `❯` 提示符和 Pi 自带的 Shell 语法高亮,长命令折叠成五行。
39
- - **Thought trail**:把可见的思考过程压缩成树状摘要,每段一行;只影响显示,模型上下文保持完整。
41
+ - **Thought trail**:把可见的思考过程压缩成树状摘要,每段一行;只影响显示,模型上下文保持完整。模型(常见于 Gemini)把推理写进正文的 `<thinking>…</thinking>` 也会显示为 Thought trail。
40
42
 
41
43
  ## 要求
42
44
 
43
- - Pi **>= 0.87.1**(在 0.87.1、0.99.1、1.5.2 上测试过)
45
+ - Pi **>= 0.87.1**(在 0.87.1、0.99.1、1.5.2、1.7.0 上测试过)
44
46
  - 深色终端背景;推荐真彩色终端
45
47
  - 默认图标需要 Nerd Font(没有的话设置 `icons.mode: "ascii"`)
46
48
 
@@ -48,13 +50,13 @@ pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
48
50
 
49
51
  ## 只加载部分组件
50
52
 
51
- 在 `~/.pi/agent/settings.json` 里把包来源写成对象,可以按需过滤:
53
+ 在 `~/.pi/agent/settings.json` 里把包来源写成对象,可以按需过滤。`source` 保持你设置里原来的写法(比如 Git 来源,或者 `npm:pi-sakura-cyberdeck@1.5.4` 这样锁定版本的写法);改了它就等于装了另一个包,而不是过滤现有的这个。
52
54
 
53
55
  ```jsonc
54
56
  {
55
57
  "packages": [
56
58
  {
57
- "source": "git:github.com/beautifulrem/pi-sakura-cyberdeck",
59
+ "source": "npm:pi-sakura-cyberdeck",
58
60
  // 不要启动画面和数字雨
59
61
  "extensions": ["extensions/*/index.ts", "!extensions/header/index.ts", "!extensions/matrix/index.ts"]
60
62
  }