pi-sakura-cyberdeck 0.0.0-stage → 1.5.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 (40) hide show
  1. package/CHANGELOG.md +365 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +6 -0
  4. package/README.md +253 -2
  5. package/README.zh-CN.md +73 -0
  6. package/extensions/changelog/index.ts +249 -0
  7. package/extensions/claude-shimmer/README.md +20 -0
  8. package/extensions/claude-shimmer/index.ts +609 -0
  9. package/extensions/header/index.ts +103 -0
  10. package/extensions/matrix/index.ts +482 -0
  11. package/extensions/shared/color.ts +112 -0
  12. package/extensions/zentui/config.ts +984 -0
  13. package/extensions/zentui/extension-status.ts +101 -0
  14. package/extensions/zentui/footer-format.ts +290 -0
  15. package/extensions/zentui/footer.ts +713 -0
  16. package/extensions/zentui/format.ts +501 -0
  17. package/extensions/zentui/git.ts +388 -0
  18. package/extensions/zentui/gradient.ts +181 -0
  19. package/extensions/zentui/icons.ts +205 -0
  20. package/extensions/zentui/index.ts +726 -0
  21. package/extensions/zentui/live-context.ts +89 -0
  22. package/extensions/zentui/package-version.ts +165 -0
  23. package/extensions/zentui/project-refresh.ts +178 -0
  24. package/extensions/zentui/project-state.ts +80 -0
  25. package/extensions/zentui/prototype-patch-registry.ts +146 -0
  26. package/extensions/zentui/runtime.ts +219 -0
  27. package/extensions/zentui/selector-border.ts +63 -0
  28. package/extensions/zentui/session-lifecycle.ts +49 -0
  29. package/extensions/zentui/settings-command.ts +884 -0
  30. package/extensions/zentui/shell-call.ts +101 -0
  31. package/extensions/zentui/state.ts +31 -0
  32. package/extensions/zentui/style.ts +329 -0
  33. package/extensions/zentui/thinking-message.ts +28 -0
  34. package/extensions/zentui/thinking-trail.ts +135 -0
  35. package/extensions/zentui/tool-execution.ts +345 -0
  36. package/extensions/zentui/ui.ts +713 -0
  37. package/extensions/zentui/user-message.ts +107 -0
  38. package/licenses/pi-zentui-MIT.txt +21 -0
  39. package/package.json +62 -4
  40. package/themes/sakura-macaron.json +87 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,365 @@
1
+ # Changelog
2
+
3
+ All notable changes to pi-sakura-cyberdeck. Pi >= 1.5.0 shows new package entries
4
+ once after updating; run `/sakura-changelog` on any supported Pi to read this file.
5
+
6
+ ## [1.5.2] - 2026-11-18
7
+
8
+ ### Highlights
9
+
10
+ - **Every tool card is framed**, including image results (`read` of a PNG on a vision model,
11
+ browser screenshots), on plain, Kitty and iTerm2 terminals.
12
+ - **Editor cues are back**: Pi's bash-mode colour and `↑/↓ N more` scroll labels show through the
13
+ Sakura frame.
14
+ - **Sturdier footer**: keeps context/tokens/cost on narrow terminals, coexists with other footer
15
+ extensions, and spawns far fewer git processes.
16
+ - A robustness pass over settings, `/sakura-changelog`, matrix rain and shimmer, with a regression
17
+ test for every fix.
18
+
19
+ ### Fixed
20
+
21
+ - Tool cards whose results contain images are framed like every other card. Previously any image
22
+ block skipped the frame, so `read` of a PNG looked different depending on whether the model accepts
23
+ images (non-vision models never receive the image) and `agent_browser` screenshot results were
24
+ never framed. Text rows are padded so the right rail lines up; Kitty and iTerm2 image rows only
25
+ gain the left rail so nothing is drawn over the picture. Rows wider than the card (from a
26
+ self-rendered tool) are clipped so the right rail stays inside the terminal.
27
+ - Sent prompts keep Pi's OSC 133 prompt markers at the start of the line. The rail used to push them
28
+ inward, so Pi no longer stripped them (stray shell-prompt marks in the terminal) and fullscreen
29
+ previous/next-prompt navigation could not find prompts.
30
+ - The framed editor keeps Pi's `↑ N more` / `↓ N more` scroll labels inside its gradient rule.
31
+ - The framed editor shows Pi's bash-mode cue again: while the text starts with `!` (or `!!`), its
32
+ rules and rail use the theme's `bashMode` colour, and go back to the Sakura gradient as soon as it
33
+ does not. The frame used to cover the border colour Pi sets for bash mode.
34
+ - Footer:
35
+ - A literal `|` separator no longer eats the neighbouring segment's colour or reset.
36
+ - Narrow terminals keep the right side (context, tokens, cost) whole and truncate the left side
37
+ into the remaining space; a right side wider than the terminal is truncated instead of hidden.
38
+ Previously the right side vanished, and a right-only `footerFormat` such as
39
+ `$fill$context $tokens $cost` rendered blank at 25 columns.
40
+ - Routed (virtual) models show their context usage instead of `--`.
41
+ - `$directory` pulses like `$cwd`.
42
+ - When another extension replaces the footer, Zentui stops its timers and git/runtime probes and no
43
+ longer removes the other footer on `statusline disable` or shutdown. Only session start and an
44
+ explicit `/zentui statusline enable` install the Zentui footer again.
45
+ - A failed or timed-out runtime version check is retried after 30 s instead of being cached for
46
+ the whole process.
47
+ - Outside a git repository a refresh runs one `git rev-parse` instead of up to four failing git
48
+ processes; a forced refresh requested during another refresh no longer waits for the throttle;
49
+ settings that cannot change the probes no longer force a rescan.
50
+ - Settings:
51
+ - Turning the editor off in a fresh config no longer turns message styling off with it.
52
+ - Saving one extension-status setting keeps the built-in placements of the others (e.g.
53
+ `codex-goal` stays in the middle) unless the file sets `defaultPlacement`.
54
+ - Toggling the Thought trail re-renders thinking blocks already on screen.
55
+ - `/zentui` commands outside the TUI (RPC, print) start from the saved config, not defaults.
56
+ - `scrollbarTrack`, `scrollbarThumb` and `searchMatchText` are accepted as colour tokens.
57
+ - The colour-source descriptions say what `theme` really does: it remaps named colours (such as
58
+ the built-in runtime styles) and tints the sent-message rail, while hex colours (every default in
59
+ `colors`) and the Sakura gradients look the same in both modes. Behaviour is unchanged.
60
+ - `/sakura-changelog`: no blank page after widening the terminal; hard-wrapped bullets reflow with a
61
+ hanging indent; inline code spans close correctly.
62
+ - Matrix rain: `on` during a running preview keeps the rain for the rest of the run; wide terminals
63
+ rain across the full width.
64
+ - Shimmer: pressing Esc after the answer (during compaction or other post-run work) no longer shows a
65
+ success notice.
66
+ - Edit-card diff counts are computed once per result instead of on every frame.
67
+ - 1.5.0's release date is corrected to 2026-11-17.
68
+
69
+ ### Development
70
+
71
+ - The test harness points `PI_CODING_AGENT_DIR` at a temp directory, so tests never read or write
72
+ the developer's `~/.pi/agent` config.
73
+ - `scripts/check.mjs` also catches side-effect, dynamic and single-quoted imports of undeclared
74
+ packages.
75
+
76
+ ## [1.5.1] - 2026-11-17
77
+
78
+ ### Highlights
79
+
80
+ - **Sakura prompt borders restored**: submitted questions keep their gradient frame instead of
81
+ changing to a dim solid border in the default theme color-source mode.
82
+ - **Continuous tool-title gradients**: the complete title row, including its leading rule, status
83
+ symbols/words and diff counts, uses one Sakura gradient matching the local Pi agent's rendering.
84
+
85
+ ### Fixed
86
+
87
+ - Sent user-message borders retain their Sakura gradient in both theme and terminal color-source
88
+ modes. Version 1.5.0 incorrectly mapped the default `userMessages: "theme"` frame to `borderMuted`,
89
+ turning the gradient into a dim solid color after submitting a prompt. The color source now affects
90
+ the message rail only; native message content and semantic status rails are unchanged.
91
+ - Tool title rows no longer splice separately sampled border segments around solid theme-colored
92
+ status words. That split both removed the text gradient and turned the leading rule sky blue.
93
+ Running, complete, failed, diff-count and clipped titles now share one full-row gradient; status
94
+ rails remain theme-aware and result output stays native.
95
+ - Added exact-ANSI title regressions across three color modes, four widths, all states and edit diff
96
+ counts, including cached renders and theme changes.
97
+ - Added a regression using the shipped Sakura theme and Pi's real `UserMessageComponent`, covering
98
+ both color sources, truecolor/256-color/NO_COLOR, multiple widths, caching and invalidation.
99
+
100
+ ## [1.5.0] - 2026-11-17
101
+
102
+ Rendering robustness release built against Pi 1.5.2: shell command headers get a `❯` prompt, theme
103
+ syntax colors and an expandable long-command preview, while thought trails stop breaking at inline
104
+ code and editor extensions keep working inside the frame.
105
+
106
+ ### Highlights
107
+
108
+ - **Shell headers**: `❯ cd pi-sakura-cyberdeck && npm run typecheck && npm test (timeout 120s)`, with
109
+ the active theme's syntax colors and a five-row collapsed preview that expands to the full command.
110
+ - **Thought trails stay intact**: long inline code, URLs, backticks and math no longer strand the tree
111
+ on the right edge; digest rows are literal, sanitized text.
112
+ - **Theme-aware status**: running/done/failed use the theme's semantic colors, and log wording never
113
+ turns a successful tool into `FAILED`.
114
+ - **Editor-extension safety**: borderless editors keep every row, clicks map through the frame, and
115
+ fullscreen autocomplete paging and drag-capture survive wrapping.
116
+ - **The changelog comes from Pi**: the pack no longer keeps its own “what’s new” notice or state file;
117
+ Pi shows package changelog entries under “Extension Updates”. `/sakura-changelog` stays for reading
118
+ the full file inside Pi.
119
+ - **Theme schema fixed**: `$schema` points at `https://pi.dev/schemas/theme.schema.json` (Pi 1.2.0
120
+ moved it). Dark appearance is inferred, keeping the theme valid on Pi 0.87.1 too.
121
+ - **`edit` cards are framed again**: `renderShell: "self"` tools (`edit` in Pi 1.5) are no longer
122
+ skipped, so edit diffs get the same sakura card as every other tool.
123
+ - **Status labels carry the state**: `✓ BASH · COMPLETE` / `◆ BASH · RUNNING` / `× BASH · FAILED`,
124
+ plus `+N −M` for diff results.
125
+ - **`npm test` works on Node 26**: constructor parameter properties are gone, so the suite runs on
126
+ native type stripping (Node >= 22.18); `scripts/check.mjs` now parses with Node's own strip-only
127
+ mode, catching non-erasable syntax anywhere without executing source.
128
+
129
+ ### Changed
130
+
131
+ - Bash call headers use `❯` and Pi's active shell syntax colors; PowerShell uses its own grammar and
132
+ `PS>` prompt. Long commands wrap with a hanging indent, show five visual rows while collapsed,
133
+ and expand fully with the user's configured keybinding. Uses `registerToolRenderer` when available;
134
+ execution, timers, results, truncation warnings and full-output links stay native.
135
+ - Tool status labels/rails use the active theme's semantic colors, not fixed RGB. Arbitrary log text
136
+ is not classified as tool failure; structured warnings and errors keep Pi's own rendering.
137
+ - Thought-trail rows are literal display text: inline Markdown is not reparsed after prewrapping.
138
+ - Tool card status labels now always carry the state, plus diff counts when the tool's result has a
139
+ unified diff: `◆ BASH · RUNNING`, `✓ BASH · COMPLETE`, `× BASH · FAILED`, `✓ EDIT · +3 −2 · COMPLETE`.
140
+ Previously the settled state showed only `✓ BASH` — no state word, no counts. Counts are read from
141
+ Pi's own `result.details.diff`, never from the rendered body.
142
+ - `edit` (and any other `renderShell: "self"` tool) is framed like every other tool card; only image
143
+ results and hidden cards stay stock. Previously the pack skipped self-rendered tools, so `edit`
144
+ diffs had no card at all.
145
+ - Dropped the custom one-time “what’s new” notice and `sakura-cyberdeck-state.json` (Pi's own package
146
+ changelog already covers it, including `collapseChangelog`); `/sakura-changelog` still opens the
147
+ scrollable viewer.
148
+ - The footer pulse pauses while a blocking extension dialog is open (`ui_prompt_start` / `ui_prompt_end`).
149
+ - The legacy fixed-editor notice now acknowledges a user already on `"tuiMode": "fullscreen"`.
150
+ - Documented why the tool-card frame keeps its `ToolExecutionComponent` hook instead of
151
+ `pi.registerToolRenderer()` (that API draws inside the row, not the frame around it).
152
+
153
+ ### Fixed
154
+
155
+ - Thought-trail rails escaping to line ends when inline backticks spanned prewrapped rows; regression
156
+ checks now use Pi's real Markdown renderer with code, links, math, CJK/emoji and multiple widths.
157
+ Digest text is sanitized before measurement; terminal controls/bidi overrides cannot escape to the
158
+ terminal. Very narrow widths fall back to native thinking; clipped headers no longer split ANSI.
159
+ - Borderless custom editors losing their first/last rows. Editor mouse events now map through the
160
+ frame to body/autocomplete coordinates, and wrappers forward fullscreen autocomplete paging.
161
+ - `NO_COLOR` leaking theme colors from pack-owned chrome and colors in shell expansion key hints.
162
+ - User-message theme color-source settings not repainting cached cards.
163
+ - Unified-diff changes starting with `+++` or `---` mistaken for file headers inside hunks.
164
+ - Theme schema tests skipping installed Pi 1.5.2 after its schema moved; both current and legacy
165
+ paths are checked. Removed the optional `appearance` key rejected by Pi 0.87.1's schema.
166
+ - Legacy migration notice asking users to enable fullscreen when Pi already defaults to it.
167
+ - Node strip-only syntax guard missing parameter properties after commas: now uses Node's own
168
+ parser without executing source, also catching enums and other non-erasable syntax.
169
+ - Editor extensions loaded after Zentui (e.g. `pi-fff`) no longer drop the editor rails and model line
170
+ (#4). Reconcile on Pi's public `resources_discover` event after all `session_start` handlers finish,
171
+ and on later surface events; wrap the foreign editor to preserve input and autocomplete. No timed
172
+ settle window or polling is needed.
173
+ - Type checking resolves both nested and hoisted Pi dev packages; the tool-renderer test accepts
174
+ Pi 1.5's `unknown` arguments.
175
+ - Theme `$schema` still pointed at the pre-1.2.0 raw GitHub path.
176
+ - `npm test` passed the removed `--experimental-transform-types` flag.
177
+
178
+ ### Developer
179
+
180
+ - `engines.node >= 22.18`; README notes Pi's `PI_TUI_WRITE_LOG` ANSI capture for TUI debugging.
181
+
182
+ ## [1.3.0] - 2026-11-17
183
+
184
+ A focused visual release: a compact thinking view and sakura-tinted code blocks.
185
+
186
+ ### Highlights
187
+
188
+ - **Thought trail** — visible thinking blocks collapse into a compact, sakura-gradient `✦ Thought trail` digest.
189
+ - **Sakura code blocks** — ``` fences use the accent pink, code text the soft lilac.
190
+
191
+ ### Added
192
+
193
+ - **Thought trail**: visible thinking blocks are compressed into a compact `✦ Thought trail · N steps`
194
+ digest with sakura-gradient rails (`├─ ◇` / `╰─ ◇` per paragraph, wrapped rows keep their `│` rail)
195
+ via Pi's public markdown transformer — display-only, no prototype patches, the session and model
196
+ context keep the full thinking text. On by default; toggle with `/zentui thinking-trail on|off`
197
+ (setting `features.thinkingTrail`).
198
+ - Fenced code blocks read as sakura: the ``` fences use the accent pink (`mdCodeBlockBorder`)
199
+ and body text the soft lilac (`mdCodeBlock`). Pi's own `markdown.codeBlockIndent` still sets the indent.
200
+
201
+ ## [1.2.0] - 2026-09-30
202
+
203
+ A robustness, performance and "lighter footprint" release based on a full code review
204
+ against Pi 0.99.1. Extension code shrank from ~12,000 to ~8,700 lines, the pack no longer
205
+ redraws the terminal while idle, and it no longer rewrites tool or command output.
206
+ Supported Pi versions: 0.87.1 and newer (tested on 0.87.1 and 0.99.1).
207
+
208
+ ### Highlights
209
+
210
+ - **Idle means idle**: the footer no longer redraws the screen 4×/second forever (0 bytes written while idle, was ~3.4 KB/s).
211
+ - **Your output stays yours**: tool results, `!cmd` output and thinking are shown exactly as Pi renders them — no more added ✓/× glyphs, lost indentation, 200-line caps or replaced lines.
212
+ - **Fixed** `/zentui fixed-editor disable` turning off (and saving) the main editor.
213
+ - **Fixed** the working HUD being stuck at `↓ 1 token` on Anthropic models, and "done in 0s" after multi-step runs.
214
+ - **Safer git**: no more `index.lock` collisions with the agent's own git commands; far fewer git processes.
215
+ - **Removed** the obsolete fixed-editor compositor (~1,950 lines); use Pi's native `"tuiMode": "fullscreen"`.
216
+ - **Matrix rain is now opt-in** (`/sakura-matrix on`) and no longer fights the shimmer.
217
+ - **256-color terminals and `NO_COLOR`** are now respected by every effect.
218
+ - **New**: this what's-new notice after updates, and `/sakura-changelog` to read the changelog inside Pi.
219
+
220
+ ### Fixed — editor, footer and settings (Zentui)
221
+
222
+ - `/zentui fixed-editor disable|enable|toggle` was parsed as the *editor* switch and disabled the main editor, persisting it to config. Direct commands are now parsed strictly (`/zentui <target> <on|off|toggle>`); anything else shows usage. If this bug turned your editor off earlier, run `/zentui editor on` once.
223
+ - Lines you typed in the editor that contained both the model and provider name (e.g. "compare gpt-5 with OpenAI") were deleted from the editor view. Only lines Zentui itself renders are ever stripped now.
224
+ - Footer token and cost totals undercounted: compaction, branch-summary, `usage` entries and tool-result usage (subagents / codemode) were missing. Totals now match Pi's own footer.
225
+ - An extension status with a key such as `constructor` or `__proto__` crashed every footer render.
226
+ - Settings changes (enabling git commit/metrics, package version, footer format, icon mode) did not apply until the next refresh or restart; they now apply immediately.
227
+ - Built-in defaults disagreed with what users actually got (refresh interval, footer format, icons). Defaults now come from one place.
228
+ - A corrupt `sakura-cyberdeck-zentui.json` silently reset every setting to defaults. You now get a warning naming the file and the JSON error, and the file is never overwritten until fixed.
229
+ - `$sep` in a custom `footerFormat` always rendered ` | ` regardless of the separator setting.
230
+ - Numbers from 999,500 to 999,999 were shown as `1000k` (now `1.0M`).
231
+ - A `"bold accent"` style spec dropped the theme color.
232
+ - Gradients split emoji ZWJ sequences and combining marks (e.g. accented folder names) into broken pieces.
233
+ - The git segment silently froze with stale data when `git status` output exceeded 1 MB (very large change sets); the buffer is now 16 MB and failures show `[git n/a]`.
234
+ - Non-English git locales made normal folders look like git errors; git now runs with `LC_ALL=C`.
235
+ - Windows absolute paths were not recognised in git path handling.
236
+ - Runtime versions ignored the project folder and went stale after `nvm use` / `pyenv local`; they now run in the project folder and refresh when version files change.
237
+ - Thinking level `max` had no color of its own (new `colors.editorThinkingMax`).
238
+
239
+ ### Fixed — tool cards, messages and thinking
240
+
241
+ - `!cmd` output: expanded output was capped at ~19 lines, the bottom border was drawn as a second "BASH · COMPLETE" header, output lines that looked like box edges or `───` rules were replaced by frames, and failed or cancelled commands were labelled `✓ COMPLETE`. `!cmd` output is now stock Pi.
242
+ - Tool card bodies were rewritten: syntax and word-diff highlighting was lost, lines starting with `ok`/`Successfully`/`error` got ✓/× glyphs (which were copied with the text), lines starting with `read`/`edit`/`snake_case` words lost their indentation, long lines lost a trailing `...`, expanded output was capped at 200 lines, and collapsed bodies could be replaced by summaries. Bodies are now passed through byte-for-byte inside the sakura frame.
243
+ - Diff lines lost their indentation around line-number width changes (e.g. lines 95–105).
244
+ - Tool card status (running / done / failed) was guessed from the text; it now comes from the tool's real state.
245
+ - Clicking a tool card to expand it in fullscreen mode hit the wrong row.
246
+ - Clicking a thinking block to show/hide it stopped working in fullscreen mode, per-message thinking toggles were ignored, and visible thinking was cut to 16 lines. Thinking is now stock Pi; hidden thinking shows a sakura `✦ Thought` label.
247
+ - User messages lost ordered-list numbering (`1)`), backslash escapes and other extensions' markdown transforms. They are now Pi's own rendering inside the rail.
248
+ - Prototype patches could leave stale copies behind after uninstall, could stack on reload, and clashed with the upstream `pi-zentui` package's registry.
249
+
250
+ ### Fixed — working HUD (shimmer)
251
+
252
+ - The live token counter stayed at `↓ 1 token` on Anthropic models while streaming (the provider's early placeholder count was treated as final).
253
+ - After an aborted or failed message the count dropped from thousands back to 1.
254
+ - The completion notice measured only the last turn ("Sparkled for 0s" after a run with tool calls); it now covers the whole run.
255
+ - The completion notice used an invalid notification type, and also appeared after Esc or errors. It now shows only after successful runs, once Pi has fully settled (after retries/compaction).
256
+ - The spinner verb changed after every tool call; it now stays the same for the whole run.
257
+ - The "stalled" coral fade and the tool-use pulse were never actually shown; both now work.
258
+ - The highlight popped in at the left edge instead of sweeping in smoothly; the first thinking frame could glow at a random phase.
259
+ - ©, ® and ™ were counted as two tokens each in the live estimate.
260
+ - In RPC mode every prompt sent clients a notification full of raw terminal escapes; print/json modes ran animation timers for nothing. Effects now run only in the interactive TUI.
261
+
262
+ ### Fixed — matrix, header, theme
263
+
264
+ - Matrix listened to `session_switch`, an event Pi removed in 0.65.
265
+ - Matrix and shimmer both drove Pi's working indicator; switching matrix off mid-run reset the shimmer to Pi's default spinner.
266
+ - `/sakura-matrix preview` claimed "5 seconds" but did nothing while disabled or outside the TUI, and stopped the rain for the rest of a running turn.
267
+ - A failed matrix settings write left the in-memory state changed without stopping the rain or telling you.
268
+ - The header's top padding grew with terminal height (19 blank lines at 50 rows) and changed on every vertical resize; it is now a fixed single line.
269
+ - Theme `dim` text failed WCAG AA contrast (3.5:1 → 4.7:1); muted borders are more visible.
270
+
271
+ ### Performance
272
+
273
+ - No redraws while idle (footer pulse is now opt-in and only runs while the agent works).
274
+ - Context-usage and usage-total calculations are cached like Pi's own footer instead of rescanning the session on every frame.
275
+ - Working HUD: one ~11 Hz clock instead of three (≈40–55 renders/s → ≤11).
276
+ - Git: one `status --porcelain=2 --branch --show-stash` plus one `rev-parse` per refresh instead of ~10 processes; nothing runs when git segments are hidden.
277
+ - Runtime/package probes run only when their segments are visible, once per change, never in non-interactive modes.
278
+ - Tool cards are cached with no size limit and do no per-line regex work; the gradient cache no longer thrashes on animation frames.
279
+ - The clock segment wakes once a minute instead of every second.
280
+
281
+ ### Security and robustness
282
+
283
+ - A malicious repository could inject terminal escape sequences (e.g. clipboard writes) through `package.json` version, folder names, branch/tag names or runtime output shown in the footer. All external text is now sanitised.
284
+ - Git runs with `GIT_OPTIONAL_LOCKS=0` and `-c core.fsmonitor=false`, and project probes (git, runtime, package) are skipped in untrusted projects.
285
+ - Config and state writes (Zentui, matrix, changelog) are atomic; broken config files are reported instead of silently replaced.
286
+ - Matrix settings now live in Pi's agent directory (respects `PI_CODING_AGENT_DIR`) like the other pack files.
287
+ - All UI work is guarded for disposed UIs and non-TUI modes; shutdown cleanup is idempotent; nothing prints with `console.*` while the TUI runs.
288
+
289
+ ### Changed
290
+
291
+ - **Sakura Matrix is off by default** and is now a rain widget only (it no longer changes the working message or indicator). Turn it on with `/sakura-matrix on`; saved settings are kept.
292
+ - New `/sakura-matrix` subcommands: `help`, `height N`; clearer validation and "not saved" messages.
293
+ - The footer pulse animation is opt-in: `/zentui pulse on` (setting `animations.footerPulse`).
294
+ - New switch `features.messageStyle` (`/zentui messages on|off`) controls message and tool styling independently of the editor. Existing configs keep their previous look: if you had the editor turned off, message styling stays off until you enable it.
295
+ - Tool cards keep the sakura frame and status rail, but edit/self-rendered tools and image results use Pi's stock rendering.
296
+ - The "Thought trail" tree is gone; hidden thinking shows a `✦ Thought` label.
297
+ - Header height is fixed; the header is only installed in the interactive TUI.
298
+ - Runtime segment detects bun, deno, node, python, go, rust, ruby and java (~50 rarely used runtimes removed). Package version reads `package.json`, `Cargo.toml`, `pyproject.toml` and `composer.json`.
299
+ - Default background project refresh is every 60 s (and only when something visible needs it).
300
+ - Colors follow Pi's detected color mode: 24-bit on truecolor terminals, nearest 256-color otherwise, none with `NO_COLOR`.
301
+ - Theme adds scrollbar and search-match colors for Pi's fullscreen mode.
302
+
303
+ ### Removed
304
+
305
+ - The experimental fixed-editor compositor (`fixedEditor` settings and `/zentui fixed-editor`). It was already disabled on Pi 0.84+; use Pi's `"tuiMode": "fullscreen"`. Old `fixedEditor` settings are removed from your config automatically (with a one-time notice if it was enabled).
306
+ - The `!cmd` output restyling and the tool-body rewriting described above.
307
+ - Unused code paths and exports (dual-quota leftovers, dead helpers).
308
+
309
+ ### Added
310
+
311
+ - A one-time "what's new" notice above the editor after installing or updating (hidden after your next message).
312
+ - `/sakura-changelog [version]` — scrollable changelog viewer inside Pi.
313
+ - `CHANGELOG.md` shipped with the package.
314
+
315
+ ### Developer
316
+
317
+ - Real unit tests (`npm test`, 100+ tests) and a strict type check (`npm run typecheck`) against Pi 0.99.1; the suite also passes against Pi 0.87.1 (`PI_HOST_ROOT=…`). Set up with `npm run dev:setup` (installs into `.dev/`, nothing is added to the package).
318
+ - `scripts/check.mjs` now validates the manifest, shipped files, peer dependencies, theme keys and changelog instead of regex-matching source code.
319
+ - The published package no longer ships `scripts/`.
320
+
321
+ ## [1.1.6] - 2026-09-30
322
+
323
+ - Remove the Codex/Grok subscription quota component, including footer chips, API polling, caching, and the `/dual-usage` command.
324
+
325
+ ## [1.1.5] - 2026-08-08
326
+
327
+ - **Pi 0.84+**: disable fixed-editor by default and hard-block the compositor on native sticky/fullscreen TUI layouts (prevents broken input after upgrading Pi).
328
+ - Document using Pi `tuiMode: "fullscreen"` for sticky editor instead of the experimental fixed-editor compositor.
329
+
330
+ ## [1.1.4] - 2026-07-26
331
+
332
+ - **Thinking HUD**: remove the brief pink per-thought timer; the muted total turn timer remains.
333
+ - **Fixed editor**: cluster mouse clicks now pass through to below-editor widgets while transcript selection stays owned by the compositor.
334
+
335
+ ## [1.1.3] - 2026-07-26
336
+
337
+ - **Token HUD**: provider-reported `usage.output` is authoritative and accumulated across tool turns.
338
+ - Live stream fallback handles CJK/emoji better than raw `chars / 4`; `~` marks estimated values.
339
+ - Labels are readable and compact: `144 tokens`, `1.2k tokens`, `12.3k tokens`, `1.2M tokens`.
340
+ - Final usage can correct a live estimate downward instead of leaving an inflated count.
341
+
342
+ ## [1.1.2] - 2026-07-26
343
+
344
+ - **Fixed editor**: output completion no longer leaves a blank gap hiding transcript text until scroll.
345
+ - Cluster paint now clears only rows it still owns; a focused regression check covers the shrink case.
346
+
347
+ ## [1.1.1] - 2026-07-26
348
+
349
+ - **Tool cards**: stop right-edge `...` on every body line.
350
+ - **Diff body**: Pi-native `±12 text` without extra `│` gutters eating width.
351
+ - **Context gauge**: solid butter (warning) / coral (error) at high %.
352
+ - **Tool left rail**: sky / mint / coral status cues.
353
+ - **Self-shell tools** (edit): also polished and framed.
354
+ - **Startup**: deferred project refresh and other startup work.
355
+
356
+ ## [1.1.0] - 2026-07-26
357
+
358
+ - Macaron truecolor footer: gradient separators, pulsed context gauge, sky context text and peach cost.
359
+ - Thought trail: sakura chrome, tight vertical spacing.
360
+ - Tool cards: symmetric frame gradient, path/title color consistency.
361
+ - Bundled sakura Claude shimmer (effort HUD and verb list).
362
+
363
+ ## [1.0.0] - 2026-07-22
364
+
365
+ - Initial theme, header, matrix and Zentui pack.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pi-sakura-cyberdeck contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ This package includes a modified copy of pi-zentui by Luka.
2
+ Original project: https://github.com/lmilojevicc/pi-zentui
3
+ License: MIT. Full license text: licenses/pi-zentui-MIT.txt
4
+
5
+ Modifications include the Sakura Macaron palette, truecolor gradient editor
6
+ chrome, package-specific defaults, and package-specific configuration path.
package/README.md CHANGED
@@ -1,3 +1,254 @@
1
- # Temporary Holding Version
1
+ # pi-sakura-cyberdeck
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Lightweight Sakura Macaron visual pack for [Pi](https://pi.dev): a pastel theme, cyberdeck header, framed tool cards, a Starship-style footer and a Claude-style working line, with no runtime dependencies.
4
+
5
+ [English](README.md) · [简体中文](README.zh-CN.md)
6
+
7
+ ## Quick start
8
+
9
+ ```bash
10
+ pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
11
+ ```
12
+
13
+ Then pick the theme in `/settings` → **sakura-macaron** and restart Pi once. Details: [Install](#install).
14
+
15
+ <p align="center">
16
+ <img src="docs/screenshots/session.png" width="640" alt="A Pi session with pi-sakura-cyberdeck: cyberdeck header, framed prompt, thought trail, bash and edit tool cards, and the Sakura footer">
17
+ <br>
18
+ <sub>Real Pi 1.5.2 session rendered by this pack (scripted demo model; GohuFont uni14 Nerd Font Mono).</sub>
19
+ </p>
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).
22
+
23
+ ## What’s inside
24
+
25
+ | Piece | Role |
26
+ |-------|------|
27
+ | **Theme** `sakura-macaron` | Dark macaron palette (sakura / peach / petal / lavender / sky / mint / coral), incl. fullscreen scrollbar and search colors |
28
+ | **Header** | Sakura→sky cyberdeck startup art |
29
+ | **Zentui** | Editor rails, Starship-style footer, sakura tool/message frames |
30
+ | **Claude shimmer** | Working line with macaron sweep, effort + token HUD |
31
+ | **Matrix** | Pastel digital-rain widget while working — **off by default**, `/sakura-matrix on` |
32
+ | **Changelog** | `/sakura-changelog` viewer (Pi >= 1.5.0 shows updates in its own “Extension Updates” notice) |
33
+
34
+ No runtime dependencies; everything uses Pi’s public extension API except three small, guarded render patches (user messages, tool card frames, selector borders).
35
+
36
+ Other editor extensions (e.g. `pi-fff`) keep their input and autocomplete inside Zentui’s frame, even when loaded after this pack.
37
+
38
+ ## Look
39
+
40
+ ![The Sakura working line with effort, token and timer HUD above the framed editor and footer](docs/screenshots/working.png)
41
+
42
+ **Footer**
43
+
44
+ ```text
45
+ ◆ project on ⎇ main [███░░░░░░░] 4%/128k › ↑12k ↓1.4k › $0.06
46
+ ```
47
+
48
+ > In the terminal, `◆` and `⎇` are Nerd Font icons (OS logo and git branch). Without a Nerd Font, set `icons.mode: "ascii"`.
49
+
50
+ - Context gauge: macaron gauge; context label **sky**, cost **peach**
51
+ - Separators / cwd / os: sakura gradient accents
52
+ - Totals match Pi’s own footer (incl. compaction and subagent/tool usage)
53
+ - Static by default; `/zentui pulse on` animates it while the agent works
54
+
55
+ **Working line**
56
+
57
+ ```text
58
+ ✻ Whisking... ( HIGH · ↓ ~1.2k tokens · 00:12 )
59
+ ```
60
+
61
+ - Effort MINIMAL→MAX, tier-colored; one verb per run
62
+ - Tokens: `~` marks the live estimate; the provider’s final count replaces it and accumulates across tool turns
63
+ - Fades toward coral when the stream stalls; pulses mint while a tool runs
64
+ - `✻ Whisked for 12s` after a successful run (whole-run time)
65
+
66
+ **History**
67
+
68
+ ```text
69
+ ╭─ ✓ READ · COMPLETE ──────────────╮
70
+ ┃ read src/app.ts │
71
+ ┃ …Pi’s own output, unchanged… │
72
+ ╰──────────────────────────────────╯
73
+ ```
74
+
75
+ - Sent prompts keep Sakura gradient borders in both color-source modes; `colorSources.userMessages` controls the rail, not the gradient frame
76
+ - Tool cards: one continuous Sakura gradient across the whole title (rules, status symbol/text and diff counts); semantic status rail (`toolTitle` running / `success` done / `error` failed); result output stays Pi’s own render, byte-for-byte
77
+ - Status label always carries the state: `◆ READ · RUNNING`, `✓ READ · COMPLETE`, `× READ · FAILED`
78
+ - Diff results (`edit`) add their `+N −M` line counts from Pi's own result diff (`details.diff`); other tools never show a count
79
+ - Bash headers use `❯`, not `$`: `❯ cd pi-sakura-cyberdeck && npm run typecheck && npm test (timeout 120s)`
80
+ - Shell headers use Pi's native syntax grammar and active `syntax*` theme colors (keywords/builtins, strings, variables, comments). Long commands wrap with a hanging indent; collapsed cards show five command rows with the configured expand-key hint. Expand for the full command, including multiline scripts. PowerShell keeps its `PS>` prompt and grammar. Requires the public `registerToolRenderer` API; older hosts keep native headers.
81
+ - Warning/error notices, including output-truncation warnings, retain Pi's semantic theme colors. A log containing the word `Error` does **not** turn a successful tool into `FAILED`; only Pi's result status does. Arbitrary output/ANSI colors are not guessed or recolored.
82
+ - `edit` diffs and image results (`read` of a PNG on a vision model, browser screenshots) are framed like any other tool card; terminal image rows only gain the left rail so nothing is drawn over the picture. `!cmd` output stays stock Pi
83
+ - Hidden thinking shows a sakura `✦ Thought` label; visible thinking is compressed into a `✦ Thought trail` digest (`/zentui thinking-trail off` shows Pi's stock rendering)
84
+
85
+ **Thought trail**
86
+
87
+ ```text
88
+ ✦ Thought trail · 3 steps
89
+ ├─ ◇ First step here.
90
+ ├─ ◇ Second step that is quite long
91
+ │ and should wrap nicely.
92
+ ╰─ ◇ Third final step.
93
+ ```
94
+
95
+ - One step per thinking paragraph, first line only; rails/`◇` in the sakura gradient, body in the thinking tint
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
+ - Display-only via Pi's public markdown transformer; the session and model context keep the full thinking text
98
+
99
+ ## Requirements
100
+
101
+ - Pi **>= 0.87.1** (tested on 0.87.1, 0.99.1 and 1.5.2)
102
+ - Dark terminal background (the theme does not paint a background)
103
+ - Truecolor recommended; 256-color terminals get the nearest palette colors, `NO_COLOR` disables the pack’s own colors
104
+ - Nerd Font for the default icons (`icons.mode: "ascii"` works without)
105
+
106
+ **Recommended terminal font:** [GohuFont uni14 Nerd Font Mono](https://github.com/ryanoasis/nerd-fonts) as the primary font, with [Zpix](https://github.com/SolidZORO/zpix-pixel-font) and [Unifont](https://unifoundry.com/unifont/) as fallbacks. This pixel stack is what the screenshots use: Zpix covers CJK and symbols such as `✦ ◇ ✻`, and Unifont catches whatever is left. Set the fallbacks in your terminal's font settings.
107
+
108
+ ## Install
109
+
110
+ ```bash
111
+ pi install git:github.com/beautifulrem/pi-sakura-cyberdeck
112
+ ```
113
+
114
+ Local:
115
+
116
+ ```bash
117
+ pi install /path/to/pi-sakura-cyberdeck
118
+ ```
119
+
120
+ Then `/settings` → theme **sakura-macaron** (Pi 0.99 defaults to its `system` theme). Restart Pi once.
121
+
122
+ > Prefer **this package’s shimmer** over stock `npm:pi-claude-shimmer`.
123
+
124
+ ### Updating
125
+
126
+ For an unpinned Git installation:
127
+
128
+ ```bash
129
+ pi update git:github.com/beautifulrem/pi-sakura-cyberdeck
130
+ ```
131
+
132
+ 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
+
134
+ Pi does not push package updates automatically. Users who pinned a tag or commit must explicitly select the new version:
135
+
136
+ ```bash
137
+ pi install git:github.com/beautifulrem/pi-sakura-cyberdeck@v1.2.0
138
+ ```
139
+
140
+ Notes for 1.2.0:
141
+
142
+ - Existing theme and Zentui settings are preserved.
143
+ - The fixed-editor compositor was removed. Old `fixedEditor` settings are removed from your config automatically (with a one-time notice if it was enabled); use Pi’s fullscreen mode below instead.
144
+ - If an earlier `/zentui fixed-editor disable` turned your editor off (a 1.1.x bug), run `/zentui editor on` once.
145
+ - Sakura Matrix is now off by default. If you had explicitly saved it on, it stays on; otherwise run `/sakura-matrix on`.
146
+ - The footer pulse animation is now opt-in (`/zentui pulse on`).
147
+
148
+ ### Sticky editor (Pi fullscreen mode)
149
+
150
+ For a sticky editor and scrollable transcript use Pi’s native fullscreen TUI:
151
+
152
+ ```jsonc
153
+ // ~/.pi/agent/settings.json
154
+ {
155
+ "tuiMode": "fullscreen"
156
+ }
157
+ ```
158
+
159
+ Or start with `pi --tui-mode fullscreen`. Pack styling (editor chrome, footer, shimmer, theme scrollbar/search colors) still applies.
160
+
161
+ ### Load only some pieces
162
+
163
+ Pi can filter a package's resources. Replace the plain source string in `~/.pi/agent/settings.json` with an object:
164
+
165
+ ```jsonc
166
+ {
167
+ "packages": [
168
+ {
169
+ "source": "git:github.com/beautifulrem/pi-sakura-cyberdeck",
170
+ // everything except the startup header and matrix rain
171
+ "extensions": ["extensions/*/index.ts", "!extensions/header/index.ts", "!extensions/matrix/index.ts"]
172
+ }
173
+ ]
174
+ }
175
+ ```
176
+
177
+ Use `"extensions": []` to keep just the `sakura-macaron` theme. `pi config` toggles the same resources interactively.
178
+
179
+ ## Configuration
180
+
181
+ Zentui config file: `~/.pi/agent/sakura-cyberdeck-zentui.json` (edit with `/zentui`). If the file contains invalid JSON, the pack warns you at startup and does not overwrite it.
182
+
183
+ ```jsonc
184
+ // ~/.pi/agent/sakura-cyberdeck-zentui.json (excerpt)
185
+ {
186
+ "colors": {
187
+ "contextNormal": "syntaxFunction",
188
+ "cost": "mdCode",
189
+ "editorBorder": "sakura-macaron-gradient"
190
+ },
191
+ "features": {
192
+ "messageStyle": true, // sakura frames for messages and tool cards
193
+ "thinkingTrail": true // compress visible thinking into a "✦ Thought trail" digest
194
+ },
195
+ "animations": {
196
+ "footerPulse": false // animate footer gradients while the agent works
197
+ }
198
+ }
199
+ ```
200
+
201
+ Matrix settings live in `~/.pi/agent/sakura-cyberdeck-matrix.json` (edit with `/sakura-matrix`).
202
+
203
+ ## Commands
204
+
205
+ ```text
206
+ /zentui settings UI (editor, footer, messages, icons, colors…)
207
+ /zentui editor|statusline|messages|copy-friendly|thinking-trail|pulse on|off|toggle
208
+ /zentui format "<template>" custom footer format ("" = segment layout)
209
+
210
+ /sakura-matrix [status] current rain settings
211
+ /sakura-matrix on|off enable / disable the rain widget
212
+ /sakura-matrix preview show the rain for 5 seconds
213
+ /sakura-matrix fps N | density N | height N
214
+ /sakura-matrix help
215
+
216
+ /sakura-changelog [version] scrollable changelog (q / Esc to close)
217
+ ```
218
+
219
+ ## Conflicts
220
+
221
+ Avoid stacking with `pi-zentui`, `pi-powerline-footer`, stock `pi-claude-shimmer`, or a second copy of this pack. They share the footer / working line / editor surfaces.
222
+
223
+ ## Changelog
224
+
225
+ Full history: [CHANGELOG.md](CHANGELOG.md) (also available in Pi via `/sakura-changelog`).
226
+
227
+ ### 1.5.2
228
+
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).
237
+
238
+ ### Earlier versions
239
+
240
+ See [CHANGELOG.md](CHANGELOG.md) for 1.0.0 – 1.5.1.
241
+
242
+ ## Development
243
+
244
+ ```bash
245
+ npm run dev:setup # installs Pi + TypeScript into .dev/ (not shipped, no package deps)
246
+ npm run verify # package check + strict typecheck + unit tests
247
+ PI_HOST_ROOT=/path/to/node_modules/@earendil-works/pi-coding-agent npm test # test against another Pi
248
+ ```
249
+
250
+ Node **>= 22.18** is required (the suite runs on native type stripping). When debugging the TUI, Pi's `PI_TUI_WRITE_LOG` captures the raw ANSI stream.
251
+
252
+ ## License
253
+
254
+ MIT. Claude shimmer is a sakura-themed fork of [pi-claude-shimmer](https://github.com/ouzhenkun/pi-claude-shimmer) (MIT). Zentui is a modified copy of [pi-zentui](https://github.com/lmilojevicc/pi-zentui) (MIT, see NOTICE).