bermudis-pi-goodies 0.24.2 → 0.26.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
@@ -9,7 +9,7 @@ extensions. One entry point, thirteen independent features.
9
9
  | `copy-trajectory` | `/copy-trajectory [thinking]` | Copy the whole conversation (user + assistant text, tool calls stripped) to the clipboard; `thinking` also includes assistant thinking blocks. |
10
10
  | `name-with-ai` | `/name-with-ai [name]` | Generate a short session name from the first user message (or set one manually). |
11
11
  | `zed` | `/z` | Open Zed editor on the current working directory. |
12
- | `prefer-tools` | hook (no command) | Nudge toward modern CLIs: `rg` over `grep`, `fd` over `find`, `uv` over bare `python`/`pip`/`pytest`/`mypy`. |
12
+ | `prefer-tools` | hook (no command) | Blocks legacy tools: `rm` → `trash`, bare `python`/`pip`/`pytest`/`mypy` → `uv`. On `glm-5.*` models it also blocks bash `rg` (they invent ripgrep flags) — the built-in grep tool still works. |
13
13
  | `keep-model-on-new` | hook (no command) | Keep the active model when `/new` starts a fresh session instead of reverting to pi's saved default model. |
14
14
  | `model-thinking` | `/model-thinking` | Per-model default thinking levels: save the current level as this model's default and get it back on every switch to that model, instead of pi's global default. |
15
15
  | `clean-tui` | tool overrides (no command) | Collapse built-in tool output for a cleaner TUI: back-to-back same-tool calls share one block (e.g. `read ×2`) until a boundary — visible text (assistant prose or a typed user message) or a thinking block (even an empty one, as OpenAI emits between tool calls) — so reasoning-per-call models render one block per call. Images stay visible without expanding, expand a row with ctrl+o to see the full command and results/diffs. Long bash commands get an AI-generated summary once you pick a model with `/goodies summary-model <provider/model>` (see "Smart summaries" below) — expanding a row swaps the summary back out for the raw command. While enabled, also flips `@bermudi/pi-codex`'s `apply_patch`/`web_search` into the same burst style. Long thinking runs can show a live plain-English line above the editor (`/goodies thinking-summaries on`) instead of a static `Thinking...` — see "Smart summaries". |
@@ -26,13 +26,18 @@ extensions. One entry point, thirteen independent features.
26
26
  After publishing the package to npm:
27
27
 
28
28
  ```bash
29
- pi install npm:bermudis-pi-goodies@0.24.2
29
+ pi install npm:bermudis-pi-goodies@0.26.0
30
30
  ```
31
31
 
32
32
  Remove any old `bermudis-pi-goodies.ts` symlink before reloading Pi. Each
33
33
  feature is independent — use `/goodies disable <name>` to turn one off
34
34
  without losing the rest (e.g. `/goodies disable clean-tui` keeps kilo and
35
35
  the balance footer). State persists to `~/.pi/agent/goodies.json`.
36
+ While enabled, the tool overrides carry the built-ins' full definitions —
37
+ schema, execution, and system-prompt contributions (`promptSnippet`,
38
+ `promptGuidelines`) — so the model sees exactly what vanilla pi would show it;
39
+ the extension is purely presentational. Every feature toggle, clean-tui
40
+ included, takes effect on the next `/reload` or new session.
36
41
  Kilo's provider and its balance footer are bundled here.
37
42
 
38
43
  ## Smart summaries for long bash commands
@@ -165,13 +170,23 @@ which reads as a full-screen flash:
165
170
  (`firstChanged < prevViewportTop` — width-independent; on a long
166
171
  transcript this is any row more than a screenful above the input box).
167
172
 
168
- clean-tui therefore follows two rules in its render paths:
173
+ clean-tui therefore follows three rules in its render paths:
169
174
 
170
175
  - **Grow-only swaps:** the raw command text a summary may later replace is
171
- capped at 99 characters plus an ellipsis (`BASH_BULLET_WIDTH`); summaries
176
+ capped to a total line budget — head, bullet prefix, and the `(+N lines)`
177
+ hint together — that fits one terminal row at the current width
178
+ (`bashLineCap()`; when there is no TTY it falls back to the historical
179
+ `BASH_BULLET_WIDTH` head plus prefix, and never grows past it). Summaries
172
180
  render uncapped. A landing summary can add a wrapped line — a cheap tail
173
- update — but never collapses one (rule 1) wherever the raw line fits on a
174
- single terminal row.
181
+ update — but never collapses one (rule 1), on any terminal width.
182
+ - **Viewport-fit bursts:** a collapsed grouped burst renders at most the
183
+ most recent ~15 bullets (smaller in short panes; `groupedBulletCap()`),
184
+ with a muted `… +N earlier` under the `×N` title. The title sits at the
185
+ TOP of the shared box and changes on every new call; an uncapped box
186
+ eventually outgrows the viewport, putting the title above it — and then
187
+ every new call is a rule-2 violation, a full-screen flash per call. The
188
+ cap keeps the title inside the viewport so burst updates stay
189
+ differential. Expanded views are opt-in and uncapped.
175
190
  - **Tail-only refresh:** when a summary lands, only rows that are still
176
191
  executing, or that finished while their summary was in flight (bounded by
177
192
  a ~10s freshness window), are re-rendered — at landing such rows sit at
@@ -357,6 +372,12 @@ session. `/side-exit` closes it and chooses what the main agent receives.
357
372
 
358
373
  How it works:
359
374
 
375
+ - **Badge**: while a side session is open, the footer's model readout becomes
376
+ `side: (zai) glm-5.3 • max` — the provider-balance footer prepends the
377
+ badge to the stats line instead of adding a separate `side:` status line
378
+ (which remains the fallback when that footer is not mounted). The readout
379
+ tracks mid-side ctrl+l switches, and the badge clears on exit or when
380
+ switching to a session that is not in a side consultation.
360
381
  - **Entry**: `/side` opens pi's own model selector (falls back to a plain
361
382
  selector when pi's internal runtime is not reachable; in headless modes pass
362
383
  the model explicitly as `/side provider/model-id[:level]`). The main agent's
@@ -0,0 +1,15 @@
1
+ // Load-time contract shared by index.ts, vision.ts and @bermudi/pi-codex.
2
+ // The flag reflects how the extension STARTED (goodies.json config) and is
3
+ // read at registration time only — toggling the feature requires /reload.
4
+ // Keep the symbol stable: pi-codex reads this exact global key.
5
+ const CLEAN_TUI_ACTIVE = Symbol.for("bermudis-pi-goodies.clean-tui.active.v1");
6
+
7
+ export function setCleanTuiActive(active: boolean): void {
8
+ const globals = globalThis as Record<symbol, unknown>;
9
+ if (active) globals[CLEAN_TUI_ACTIVE] = true;
10
+ else delete globals[CLEAN_TUI_ACTIVE];
11
+ }
12
+
13
+ export function isCleanTuiActive(): boolean {
14
+ return (globalThis as Record<symbol, unknown>)[CLEAN_TUI_ACTIVE] === true;
15
+ }