@gotgenes/pi-permission-system 20.7.0 → 20.7.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [20.7.1](https://github.com/gotgenes/pi-packages/compare/pi-permission-system-v20.7.0...pi-permission-system-v20.7.1) (2026-07-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **pi-permission-system:** clip inline permission prompt lines to terminal width ([e3c6907](https://github.com/gotgenes/pi-packages/commit/e3c6907057070cbb444f4ca0dbc69661849b7dc2)), closes [#573](https://github.com/gotgenes/pi-packages/issues/573)
14
+
8
15
  ## [20.7.0](https://github.com/gotgenes/pi-packages/compare/pi-permission-system-v20.6.0...pi-permission-system-v20.7.0) (2026-07-14)
9
16
 
10
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotgenes/pi-permission-system",
3
- "version": "20.7.0",
3
+ "version": "20.7.1",
4
4
  "description": "Permission enforcement extension for the Pi coding agent.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -2,7 +2,12 @@ import type {
2
2
  ExtensionContext,
3
3
  ExtensionUIContext,
4
4
  } from "@earendil-works/pi-coding-agent";
5
- import { type Component, matchesKey } from "@earendil-works/pi-tui";
5
+ import {
6
+ type Component,
7
+ matchesKey,
8
+ truncateToWidth,
9
+ wrapTextWithAnsi,
10
+ } from "@earendil-works/pi-tui";
6
11
  import {
7
12
  type PermissionPromptDecision,
8
13
  type RequestPermissionOptions,
@@ -126,7 +131,11 @@ class PermissionPromptComponent implements Component {
126
131
  // No cached rendering state to clear.
127
132
  }
128
133
 
129
- render(_width: number): string[] {
134
+ render(width: number): string[] {
135
+ return fitToWidth(this.renderStep(), width);
136
+ }
137
+
138
+ private renderStep(): string[] {
130
139
  switch (this.state.step) {
131
140
  case "decision":
132
141
  return this.renderDecision();
@@ -264,6 +273,24 @@ class PermissionPromptComponent implements Component {
264
273
  }
265
274
  }
266
275
 
276
+ /**
277
+ * Fit rendered lines to the terminal width, satisfying the `ctx.ui.custom`
278
+ * contract that every returned line be a single visual row no wider than
279
+ * `width`. Long lines (e.g. a wide tool-preview message) are wrapped rather
280
+ * than clipped so no content is lost; the final `truncateToWidth` guards the
281
+ * edge cases `wrapTextWithAnsi` cannot split (a lone wide grapheme).
282
+ */
283
+ function fitToWidth(lines: string[], width: number): string[] {
284
+ if (width <= 0) {
285
+ return [];
286
+ }
287
+ return lines.flatMap((line) =>
288
+ wrapTextWithAnsi(line, width).map((wrapped) =>
289
+ truncateToWidth(wrapped, width),
290
+ ),
291
+ );
292
+ }
293
+
267
294
  function isPrintable(data: string): boolean {
268
295
  if (data.length !== 1) {
269
296
  return false;