pi-open-tui 0.4.3 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.4] - 2026-11-06
4
+
5
+ ### Added
6
+
7
+ - Add `footerSegments.contextBar` to hide the context progress bar and its icon while keeping the percentage and token usage.
8
+
9
+ ### Fixed
10
+
11
+ - Restore fullscreen Copy clicks when Pi exposes the active renderer through its stable TUI reference, including after switching display modes (#93).
12
+
3
13
  ## [0.4.3] - 2026-11-05
4
14
 
5
15
  ### New Features
@@ -57,6 +57,7 @@ All keys below are booleans inside `footerSegments`.
57
57
  | `gitCommit` | `false` | Tag pointing at the detached HEAD commit; only used when `gitBranch` is on |
58
58
  | `runtime` | `true` | Detected project runtime and its version when available |
59
59
  | `context` | `true` | Context bar, percentage, and token usage |
60
+ | `contextBar` | `true` | Progress bar and its icon; `false` keeps only the percentage and token usage |
60
61
  | `tokens` | `true` | Cumulative input/output tokens and the latest assistant cache-hit percentage |
61
62
  | `cost` | `true` | Cumulative session cost reported by Pi |
62
63
  | `liveTps` | `true` | Estimated streaming speed beside the working timer |
@@ -151,6 +152,7 @@ Tab/Shift+Tab 或 ←/→ 切页,↑/↓ 或 Page Up/Page Down 移动,Enter/
151
152
  | `gitCommit` | `false` | 指向分离 HEAD 提交的标签,仅在 `gitBranch` 开启时使用 |
152
153
  | `runtime` | `true` | 检测到的项目运行环境,以及可获取时的版本号 |
153
154
  | `context` | `true` | 上下文进度条、百分比和 Token 用量 |
155
+ | `contextBar` | `true` | 进度条及其图标;关闭后仅保留百分比和 Token 用量 |
154
156
  | `tokens` | `true` | 累计输入/输出 Token,以及最新助手回复的缓存命中率 |
155
157
  | `cost` | `true` | Pi 报告的会话累计费用 |
156
158
  | `liveTps` | `true` | 工作计时器旁的流式速度估算 |
@@ -216,6 +218,7 @@ The complete default configuration is shared by both language references. Set `s
216
218
  "gitCommit": false,
217
219
  "runtime": true,
218
220
  "context": true,
221
+ "contextBar": true,
219
222
  "tokens": true,
220
223
  "cost": true,
221
224
  "liveTps": true,
@@ -19,6 +19,8 @@ export interface FooterSegments {
19
19
  gitCommit: boolean;
20
20
  runtime: boolean;
21
21
  context: boolean;
22
+ /** Context progress bar and its icon; off keeps the percentage and token usage. */
23
+ contextBar: boolean;
22
24
  tokens: boolean;
23
25
  cost: boolean;
24
26
  liveTps: boolean;
@@ -87,6 +89,7 @@ export const DEFAULT_CONFIG: OpenTuiConfig = {
87
89
  gitCommit: false,
88
90
  runtime: true,
89
91
  context: true,
92
+ contextBar: true,
90
93
  tokens: true,
91
94
  cost: true,
92
95
  liveTps: true,
@@ -48,6 +48,7 @@ interface RawMouseEvent {
48
48
  }
49
49
 
50
50
  interface AltScreenInternals {
51
+ children: TUI["children"];
51
52
  handleMouseEvent(event: RawMouseEvent): void;
52
53
  createMouseEvent(type: TuiMouseEvent["type"], button: number, x: number, y: number): TuiMouseEvent;
53
54
  resetTextSelection(): void;
@@ -280,7 +281,9 @@ export function installCopyButtons(options: {
280
281
 
281
282
  const restores = [
282
283
  patch(altScreenProto, "handleMouseEvent", function (this: AltScreenInternals, raw) {
283
- if (!active() || this !== (options.getTui() as unknown)) {
284
+ // Pi's stable TUI Proxy binds methods to the real renderer and forwards fields.
285
+ // The child list identifies that renderer, even when mode switches reuse a terminal.
286
+ if (!active() || this.children !== options.getTui()?.children) {
284
287
  press = undefined;
285
288
  return originalAltScreenMouse.call(this, raw);
286
289
  }
@@ -56,13 +56,14 @@ function renderBar(theme: Theme, pct: number, barWidth: number, ascii: boolean):
56
56
  );
57
57
  }
58
58
 
59
- /** Compact context form: icon + percentage, no bar or token counts. */
60
- function renderContextCompact(theme: Theme, ctx: ExtensionContext, glyphs: IconGlyphs): string {
59
+ /** Compact context form: percentage only, no bar, token counts, or icon when the bar is off. */
60
+ function renderContextCompact(theme: Theme, ctx: ExtensionContext, glyphs: IconGlyphs, showBar: boolean): string {
61
61
  const contextUsage = ctx.getContextUsage();
62
62
  const contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow ?? 0;
63
63
  if (contextWindow <= 0) return "";
64
64
  const contextPct = contextUsage?.percent ?? 0;
65
- return `${theme.fg(stressColor(contextPct), glyphs.context)} ${theme.fg(stressColor(contextPct), `${contextPct.toFixed(1)}%`)}`;
65
+ const pctText = theme.fg(stressColor(contextPct), `${contextPct.toFixed(1)}%`);
66
+ return showBar ? `${theme.fg(stressColor(contextPct), glyphs.context)} ${pctText}` : pctText;
66
67
  }
67
68
 
68
69
  function renderGitSegment(
@@ -149,6 +150,7 @@ function renderContextBar(
149
150
  width: number,
150
151
  glyphs: IconGlyphs,
151
152
  iconMode: OpenTuiConfig["icons"]["mode"],
153
+ showBar: boolean,
152
154
  ): string {
153
155
  const contextUsage = ctx.getContextUsage();
154
156
  const contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow ?? 0;
@@ -161,6 +163,7 @@ function renderContextBar(
161
163
 
162
164
  const pctText = theme.fg(stressColor(contextPct), `${contextPct.toFixed(1)}%`);
163
165
  const ctxText = `${theme.fg("text", fmtTokens(contextTokens))}${theme.fg("dim", "/")}${theme.fg("text", fmtTokens(contextWindow))}`;
166
+ if (!showBar) return `${pctText} ${theme.fg("dim", "·")} ${ctxText}`;
164
167
  const contextIcon = theme.fg(stressColor(contextPct), glyphs.context);
165
168
  // Cap the bar at `width - reserved` (with a floor of 4) so the full form
166
169
  // never forces the left segments out before compact/drop logic kicks in.
@@ -474,8 +477,8 @@ function renderFooterContent(
474
477
  let contextText = "";
475
478
  let contextCompact: string | undefined;
476
479
  if (segments.context) {
477
- contextText = renderContextBar(theme, ctx, width, glyphs, config.icons.mode);
478
- const compact = renderContextCompact(theme, ctx, glyphs);
480
+ contextText = renderContextBar(theme, ctx, width, glyphs, config.icons.mode, segments.contextBar);
481
+ const compact = renderContextCompact(theme, ctx, glyphs, segments.contextBar);
479
482
  if (compact && visibleWidth(compact) < visibleWidth(contextText)) {
480
483
  contextCompact = compact;
481
484
  }
@@ -73,6 +73,7 @@ const COPY = {
73
73
  gitCommit: "Git tag (detached HEAD)",
74
74
  runtime: "Project runtime",
75
75
  context: "Context usage",
76
+ contextBar: "Context bar",
76
77
  tokens: "Session tokens",
77
78
  cost: "Session cost",
78
79
  extensionStatuses: "Extension status line",
@@ -132,6 +133,7 @@ const COPY = {
132
133
  gitCommit: "Git 标签(分离 HEAD)",
133
134
  runtime: "项目运行环境",
134
135
  context: "上下文用量",
136
+ contextBar: "上下文进度条",
135
137
  tokens: "会话 Token",
136
138
  cost: "会话费用",
137
139
  extensionStatuses: "扩展状态行",
@@ -280,6 +282,7 @@ function buildSegmentsItems(config: OpenTuiConfig, copy: SettingsCopy): SettingG
280
282
  items: [
281
283
  { id: "runtime", label: copy.labels.runtime, currentValue: flag(segs.runtime) },
282
284
  { id: "context", label: copy.labels.context, currentValue: flag(segs.context) },
285
+ { id: "contextBar", label: copy.labels.contextBar, currentValue: flag(segs.contextBar) },
283
286
  { id: "liveTps", label: copy.labels.liveTps, currentValue: flag(segs.liveTps) },
284
287
  ],
285
288
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-open-tui",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "A polished TUI for Pi coding agent: branded header, responsive footer, framed editor, thinking preview, and compact tool views.",
5
5
  "type": "module",
6
6
  "repository": {