@each1024/pi-mini-mode 1.3.8 → 1.3.10
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 +6 -5
- package/README.zh-CN.md +6 -5
- package/extensions/footer-status.ts +35 -12
- package/lib/agent-view.ts +1 -8
- package/lib/input-enhancements.ts +1 -1
- package/lib/minimal-theme.ts +16 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ pi install npm:@each1024/pi-mini-mode
|
|
|
18
18
|
|
|
19
19
|
Run `/reload` in Pi, then open `/pi-mini-mode-settings` to make it yours.
|
|
20
20
|
|
|
21
|
-
**Pi ≥ 0.84.0.** Input enhancements are on by default
|
|
21
|
+
**Pi ≥ 0.84.0.** Input enhancements and minimal output are on by default. Minimal mode uses a private **Pi 0.85.x** layout adapter—see [compatibility](#compatibility) before enabling it.
|
|
22
22
|
|
|
23
23
|
<details>
|
|
24
24
|
<summary>Install from GitHub instead</summary>
|
|
@@ -77,6 +77,7 @@ This earlier screenshot and recording show footer configuration, not the newer i
|
|
|
77
77
|
| `/pi-mini-mode-settings` | Configure fields, input enhancements and minimal output |
|
|
78
78
|
| `/pi-mini-mode-minimal on` / `off` | Enable minimal output / restore native history |
|
|
79
79
|
| `Ctrl+O` | Expand or collapse the complete process tree |
|
|
80
|
+
| `Ctrl+S` | Expand or collapse completed subagent rows; yields to Pi `/model`, `/thinking`, and other selectors |
|
|
80
81
|
| `/pi-mini-mode-prompts` | Select and expand/collapse a user message¹ |
|
|
81
82
|
| `/pi-mini-mode-tools` | Select and expand/collapse saved tool text or thinking¹ |
|
|
82
83
|
| `/pi-mini-mode-history` | Browse full process entries, five at a time |
|
|
@@ -97,13 +98,13 @@ This earlier screenshot and recording show footer configuration, not the newer i
|
|
|
97
98
|
<details>
|
|
98
99
|
<summary><strong>First run & configuration</strong> — defaults, controls, and settings file</summary>
|
|
99
100
|
|
|
100
|
-
On the first interactive TUI session, Pi Mini Mode shows a preview. Footer metrics are on by default except MCP count; the dot-matrix style
|
|
101
|
+
On the first interactive TUI session, Pi Mini Mode shows a preview. Footer metrics are on by default except MCP count; the dot-matrix style is off; minimal output is on:
|
|
101
102
|
|
|
102
103
|
```text
|
|
103
104
|
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s
|
|
104
105
|
```
|
|
105
106
|
|
|
106
|
-
The first-run picker offers **Keep defaults** and **Configure now**. Keeping defaults saves the default field selection, leaves minimal output
|
|
107
|
+
The first-run picker offers **Keep defaults** and **Configure now**. Keeping defaults saves the default field selection, leaves minimal output on, and prevents the prompt from appearing again; configuring opens the same settings list immediately. Print, JSON, and other non-interactive modes never prompt.
|
|
107
108
|
|
|
108
109
|
Open that settings UI any time with:
|
|
109
110
|
|
|
@@ -131,7 +132,7 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-m
|
|
|
131
132
|
"pi-mini-mode-context-percent-show": true,
|
|
132
133
|
"pi-mini-mode-speed-show": true,
|
|
133
134
|
"pi-mini-mode-speed-unit-show": true,
|
|
134
|
-
"pi-mini-mode-minimal-show":
|
|
135
|
+
"pi-mini-mode-minimal-show": true,
|
|
135
136
|
"pi-mini-mode-input-enhancements": true,
|
|
136
137
|
"onboardingCompleted": true
|
|
137
138
|
}
|
|
@@ -151,7 +152,7 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-m
|
|
|
151
152
|
| `pi-mini-mode-context-percent-show` | `true` | Context-use percentage |
|
|
152
153
|
| `pi-mini-mode-speed-show` | `true` | Generation speed at the far right |
|
|
153
154
|
| `pi-mini-mode-speed-unit-show` | `true` | Generation-speed sub-setting: append `tok/s` to the numeric value |
|
|
154
|
-
| `pi-mini-mode-minimal-show` | `
|
|
155
|
+
| `pi-mini-mode-minimal-show` | `true` | Minimal output; off restores Pi's default conversation history |
|
|
155
156
|
| `pi-mini-mode-input-enhancements` | `true` | Image previews, inline skills, and message file links |
|
|
156
157
|
| `onboardingCompleted` | `false` initially | Internal marker that prevents another first-run prompt |
|
|
157
158
|
|
package/README.zh-CN.md
CHANGED
|
@@ -18,7 +18,7 @@ pi install npm:@each1024/pi-mini-mode
|
|
|
18
18
|
|
|
19
19
|
在 Pi 中运行 `/reload`,再用 `/pi-mini-mode-settings` 按你的习惯配置。
|
|
20
20
|
|
|
21
|
-
**需要 Pi ≥ 0.84.0。**
|
|
21
|
+
**需要 Pi ≥ 0.84.0。** 输入增强和极简输出默认开启。极简模式使用私有 **Pi 0.85.x** 布局适配器,启用前请查看[兼容性](#兼容性)。
|
|
22
22
|
|
|
23
23
|
<details>
|
|
24
24
|
<summary>也可以从 GitHub 安装</summary>
|
|
@@ -77,6 +77,7 @@ pi install git:github.com/eachann1024/pi-mini-mode
|
|
|
77
77
|
| `/pi-mini-mode-settings` | 配置字段、输入增强和极简输出 |
|
|
78
78
|
| `/pi-mini-mode-minimal on` / `off` | 开启极简输出/恢复原生历史 |
|
|
79
79
|
| `Ctrl+O` | 展开/收起完整过程树 |
|
|
80
|
+
| `Ctrl+S` | 展开/收起已完成的子代理行;打开 `/model`、`/thinking` 等选择器时交给 Pi |
|
|
80
81
|
| `/pi-mini-mode-prompts` | 选择并展开/收起用户消息¹ |
|
|
81
82
|
| `/pi-mini-mode-tools` | 选择并展开/收起保存的工具文本或思考¹ |
|
|
82
83
|
| `/pi-mini-mode-history` | 浏览完整过程记录,每次五条 |
|
|
@@ -97,13 +98,13 @@ pi install git:github.com/eachann1024/pi-mini-mode
|
|
|
97
98
|
<details>
|
|
98
99
|
<summary><strong>首次使用与配置</strong></summary>
|
|
99
100
|
|
|
100
|
-
首次进入交互式 TUI 会话时,Pi Mini Mode 显示设置预览。页脚指标除 MCP
|
|
101
|
+
首次进入交互式 TUI 会话时,Pi Mini Mode 显示设置预览。页脚指标除 MCP 数量外默认开启,点阵样式默认关闭,极简输出默认开启,例如:
|
|
101
102
|
|
|
102
103
|
```text
|
|
103
104
|
deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █░░░░░░░░░ 1% 120 tok/s
|
|
104
105
|
```
|
|
105
106
|
|
|
106
|
-
首次设置会提供 **Keep defaults(保留默认值)** 和 **Configure now
|
|
107
|
+
首次设置会提供 **Keep defaults(保留默认值)** 和 **Configure now(立即配置)**。保留默认值会保存默认字段选择、保持极简输出开启,并且不再显示首次设置提示;立即配置会直接打开同一设置列表。Print、JSON 等非交互模式不会显示提示。
|
|
107
108
|
|
|
108
109
|
设置保存在 Pi 的 agent 目录中,通常是 `~/.pi/agent/pi-mini-mode.json`;如果 Pi 使用其他配置目录,则保存在对应目录。文件缺失或格式错误时会安全回退到默认设置。设置示例:
|
|
109
110
|
|
|
@@ -121,7 +122,7 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █
|
|
|
121
122
|
"pi-mini-mode-context-percent-show": true,
|
|
122
123
|
"pi-mini-mode-speed-show": true,
|
|
123
124
|
"pi-mini-mode-speed-unit-show": true,
|
|
124
|
-
"pi-mini-mode-minimal-show":
|
|
125
|
+
"pi-mini-mode-minimal-show": true,
|
|
125
126
|
"pi-mini-mode-input-enhancements": true,
|
|
126
127
|
"onboardingCompleted": true
|
|
127
128
|
}
|
|
@@ -141,7 +142,7 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 500/1.0M █
|
|
|
141
142
|
| `pi-mini-mode-context-percent-show` | `true` | 显示上下文使用百分比 |
|
|
142
143
|
| `pi-mini-mode-speed-show` | `true` | 显示最新生成速度 |
|
|
143
144
|
| `pi-mini-mode-speed-unit-show` | `true` | 速度子设置:在数字后追加 `tok/s` |
|
|
144
|
-
| `pi-mini-mode-minimal-show` | `
|
|
145
|
+
| `pi-mini-mode-minimal-show` | `true` | 极简输出总开关;关闭则恢复 Pi 默认历史显示 |
|
|
145
146
|
| `pi-mini-mode-input-enhancements` | `true` | 图片预览、行内技能补全与展开、消息文件链接 |
|
|
146
147
|
| `onboardingCompleted` | 初始为 `false` | 防止再次显示首次设置提示的内部标记 |
|
|
147
148
|
|
|
@@ -2,7 +2,7 @@ import { AGENT_STATUS_ENTRY, savedAgentStatuses, retainAgentStatuses, agentChild
|
|
|
2
2
|
import { CONFIG_DIR_NAME, getSettingsListTheme, getMarkdownTheme, type ExtensionAPI, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { attachTranscript, type NoticeRows, type TurnNotices } from "../lib/transcript-adapter.ts";
|
|
4
4
|
import { diagramMarkdown, isFencedMarkdown, minimalMarkdownTheme } from "../lib/minimal-markdown.ts";
|
|
5
|
-
import { minimalSurface } from "../lib/minimal-theme.ts";
|
|
5
|
+
import { minimalSurface, paintExpandedHeading } from "../lib/minimal-theme.ts";
|
|
6
6
|
import { Container, Markdown, matchesKey, isKeyRelease, isKeyRepeat, sliceByColumn, type SettingItem, SettingsList, Text, type TuiMouseEvent, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
7
7
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
8
8
|
import type { InputEnhancementsCleanup } from "../lib/input-enhancements.ts";
|
|
@@ -52,7 +52,7 @@ export const DEFAULT_SETTINGS: Readonly<MiniLensSettings> = {
|
|
|
52
52
|
"pi-mini-mode-context-percent-show": true,
|
|
53
53
|
"pi-mini-mode-speed-show": true,
|
|
54
54
|
"pi-mini-mode-speed-unit-show": true,
|
|
55
|
-
"pi-mini-mode-minimal-show":
|
|
55
|
+
"pi-mini-mode-minimal-show": true,
|
|
56
56
|
"pi-mini-mode-input-enhancements": true,
|
|
57
57
|
"pi-mini-mode-minimal-thinking-show": true,
|
|
58
58
|
"pi-mini-mode-minimal-tools-show": true,
|
|
@@ -71,7 +71,7 @@ const COPY = {
|
|
|
71
71
|
totalDescription: "Total:当前会话分支上的全部 token,含工具上报的 LLM 用量。", cachedDescription: "Cached:累计 cache-read + cache-write token(包含在 Total 中)。", cacheHitDescription: "CH(cache hit):cache-read / (input + cache-read)。Cache write 不计入此比率。",
|
|
72
72
|
enableMinimalDescription: "开启统一折叠思考、工具和技能过程;关闭恢复 Pi 默认会话历史。",
|
|
73
73
|
inputEnhancementsDescription: "原生 Ctrl+V 粘贴图片(Windows/WSL:Alt+V);图片显示为 [image1] 标签,光标移入或全屏悬停可预览。空白后 / 选择技能并在光标处插入。Cmd+点击带下划线的图片标签或消息文件路径,用系统默认应用打开;预览及点击需终端支持。关闭仅恢复原生行为。",
|
|
74
|
-
tuiRequired: "/pi-mini-mode-settings 需要 TUI 模式", saveFailed: "无法保存 Pi Mini Mode 设置", minimalRequired: "/pi-mini-mode-minimal 需要 TUI 模式", minimalUsage: "用法:/pi-mini-mode-minimal [on|off]", minimalState: "Pi Mini Mode 极简输出:", onboarding: "MCP
|
|
74
|
+
tuiRequired: "/pi-mini-mode-settings 需要 TUI 模式", saveFailed: "无法保存 Pi Mini Mode 设置", minimalRequired: "/pi-mini-mode-minimal 需要 TUI 模式", minimalUsage: "用法:/pi-mini-mode-minimal [on|off]", minimalState: "Pi Mini Mode 极简输出:", onboarding: "MCP 数量和点阵样式默认关闭;极简输出、输入增强及其余项默认开启。", keepDefaults: "保留默认", configureNow: "立即配置",
|
|
75
75
|
} as const;
|
|
76
76
|
|
|
77
77
|
export function settingsPath(agentDir = process.env.PI_MINI_MODE_AGENT_DIR ?? join(homedir(), CONFIG_DIR_NAME, "agent")): string {
|
|
@@ -93,6 +93,12 @@ export function parseSettings(value: unknown): MiniLensSettings {
|
|
|
93
93
|
return settings;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/** Pi /model and other selectors own Ctrl+S; the editor exposes getText. */
|
|
97
|
+
export function focusedSelectorOwnsKeys(tui?: { getFocusedComponent?(): unknown } | null): boolean {
|
|
98
|
+
const focused = tui?.getFocusedComponent?.();
|
|
99
|
+
return !!focused && typeof focused === "object" && typeof (focused as { getText?: unknown }).getText !== "function";
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
export async function loadSettings(path = settingsPath()): Promise<{ settings: MiniLensSettings; exists: boolean }> {
|
|
97
103
|
try {
|
|
98
104
|
return { settings: parseSettings(JSON.parse(await readFile(path, "utf8"))), exists: true };
|
|
@@ -575,11 +581,11 @@ function visibleMinimalTurns(settings: MiniLensSettings, turns: MinimalTurn[]):
|
|
|
575
581
|
export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], getTurns: () => MinimalTurn[], isExpanded: () => boolean = () => false, showShortcut: (turn: MinimalTurn) => boolean = () => true, showUsage: () => boolean = () => true, subAgentsExpanded: () => boolean = () => false, agentDeadlines = new Map<string, number>(), transformText: (text: string) => string = text => text) {
|
|
576
582
|
const markdown = (text: string, width: number, process = false) => new Markdown(text, 0, 0, minimalMarkdownTheme(getMarkdownTheme()),
|
|
577
583
|
{ color: (value) => theme.fg(process ? "muted" : "text", value) }, { transform: (source, available) => transformText(diagramMarkdown(source, available)) }).render(width);
|
|
578
|
-
const surface = (rows: string[], width: number, user: boolean) => {
|
|
584
|
+
const surface = (rows: string[], width: number, user: boolean, selected = -1, expanded = false) => {
|
|
579
585
|
const padding = Math.min(2, Math.floor((width - 1) / 2));
|
|
580
|
-
return ["", ...rows, ""].map((row) => {
|
|
586
|
+
return ["", ...rows, ""].map((row, index) => {
|
|
581
587
|
const line = truncateToWidth(" ".repeat(padding) + row, width, "");
|
|
582
|
-
return minimalSurface(theme, line + " ".repeat(Math.max(0, width - visibleWidth(line))), user);
|
|
588
|
+
return minimalSurface(theme, line + " ".repeat(Math.max(0, width - visibleWidth(line))), user, expanded && index === selected);
|
|
583
589
|
});
|
|
584
590
|
};
|
|
585
591
|
let agentExpiry = Infinity;
|
|
@@ -703,6 +709,9 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
|
|
|
703
709
|
for (const id of expandedThinking) if (!thinkingIds.has(id)) expandedThinking.delete(id);
|
|
704
710
|
const inner = Math.max(1, width - 2 * Math.min(2, Math.floor((width - 1) / 2)));
|
|
705
711
|
const lines: string[] = [];
|
|
712
|
+
// An open heading wears the same full-width selectedBg band as an expanded SubAgent row.
|
|
713
|
+
const bandHeading = (row: string, open: boolean) => open
|
|
714
|
+
? paintExpandedHeading(theme, row + " ".repeat(Math.max(0, width - visibleWidth(row)))) : row;
|
|
706
715
|
for (const [index, turn] of turns.entries()) {
|
|
707
716
|
if (index > 0) lines.push("");
|
|
708
717
|
if (expandedPrompts.has(index) && expandedPrompts.get(index) !== turn.question) expandedPrompts.delete(index);
|
|
@@ -714,14 +723,17 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
|
|
|
714
723
|
// Loop wakeups are system-generated user messages. Collapse them even when
|
|
715
724
|
// their short prompt would otherwise fit the normal four-row allowance.
|
|
716
725
|
const userRows = expanded || keepFence ? [...questionRows] : loopSummary ? markdown(loopSummary, inner) : questionRows.slice(0, 4);
|
|
726
|
+
let controlIndex = -1;
|
|
717
727
|
if (!keepFence && (loopSummary || questionRows.length > 4)) {
|
|
718
728
|
const label = expanded ? "▴ 收起" : loopSummary ? "▾ 展开" : `▾ 展开 (${questionRows.length} 行)`;
|
|
719
729
|
const control = truncateToWidth(label, inner, "");
|
|
720
730
|
promptControls.push({ index, question: turn.question, y: lines.length + 1 + userRows.length,
|
|
721
731
|
x: 0, width, label });
|
|
722
732
|
userRows.push(theme.fg("accent", control) + theme.fg("muted", truncateToWidth(" · /pi-mini-mode-prompts", Math.max(0, inner - visibleWidth(control)), "")));
|
|
733
|
+
// The expanded control is this message's heading, so it keeps the band in place of the user surface.
|
|
734
|
+
controlIndex = userRows.length;
|
|
723
735
|
}
|
|
724
|
-
lines.push(...surface(userRows, width, true));
|
|
736
|
+
lines.push(...surface(userRows, width, true, controlIndex, expanded));
|
|
725
737
|
const entries = turn.process.flatMap((entry, processIndex) => {
|
|
726
738
|
if (entry.startsWith("call ")) {
|
|
727
739
|
const call = turn.agentCalls?.find(call => call.id === entry.slice(5));
|
|
@@ -795,7 +807,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
|
|
|
795
807
|
const bodyWidth = Math.max(0, width - visibleWidth(prefix));
|
|
796
808
|
const overflow = Math.max(0, visibleWidth(renderedBody) - bodyWidth);
|
|
797
809
|
const offset = overflow ? Math.max(0, Math.floor((Date.now() - (turn.startedAt ?? Date.now())) / THINKING_SCROLL_INTERVAL_MS) % (overflow + 9) - 4) : 0;
|
|
798
|
-
lines.push(truncateToWidth(prefix + (bodyWidth ? sliceByColumn(renderedBody, Math.min(overflow, offset), bodyWidth, true) : ""), width, ""));
|
|
810
|
+
lines.push(bandHeading(truncateToWidth(prefix + (bodyWidth ? sliceByColumn(renderedBody, Math.min(overflow, offset), bodyWidth, true) : ""), width, ""), open));
|
|
799
811
|
} else if (label === "Output") {
|
|
800
812
|
// Wrapped output hangs under the body column and keeps the tree rail to the next sibling.
|
|
801
813
|
const indent = visibleWidth(prefix);
|
|
@@ -804,7 +816,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
|
|
|
804
816
|
lines.push(truncateToWidth(prefix + (wrapped[0] ?? ""), width, ""));
|
|
805
817
|
for (const extra of wrapped.slice(1)) lines.push(truncateToWidth(rail + extra, width, ""));
|
|
806
818
|
} else {
|
|
807
|
-
lines.push(truncateToWidth(prefix + (entry.thinking ? markdown(body, Math.max(1, visibleWidth(body) + 1), true).join(" ").replace(/\s+/g, " ").trim() : theme.fg("muted", body)), width, controlId ? "" : "…"));
|
|
819
|
+
lines.push(bandHeading(truncateToWidth(prefix + (entry.thinking ? markdown(body, Math.max(1, visibleWidth(body) + 1), true).join(" ").replace(/\s+/g, " ").trim() : theme.fg("muted", body)), width, controlId ? "" : "…"), open));
|
|
808
820
|
}
|
|
809
821
|
if (open && call && call.id === pinnedToolId) pinnedTool = { id: call.id, y: lines.length - 1, line: lines.at(-1)! };
|
|
810
822
|
if (open && call) {
|
|
@@ -858,12 +870,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
858
870
|
let shortcutTimer: ReturnType<typeof setTimeout> | undefined;
|
|
859
871
|
let waitingTimer: ReturnType<typeof setInterval> | undefined;
|
|
860
872
|
let unsubscribeMinimalInput: (() => void) | undefined;
|
|
873
|
+
let minimalTui: { getFocusedComponent?(): unknown } | undefined;
|
|
861
874
|
let restoreAgentWidgets: (() => void) | undefined;
|
|
862
875
|
let restoreTranscript: (() => void) | undefined;
|
|
863
876
|
let persistAgentStatuses: (() => void) | undefined;
|
|
864
877
|
let promptView: ReturnType<typeof minimalOutputComponent> | undefined;
|
|
865
878
|
let lastAttachMode: string | undefined;
|
|
866
879
|
let remountQueued = false;
|
|
880
|
+
let settingsOverlayOpen = false;
|
|
867
881
|
const agentDeadlines = new Map<string, number>();
|
|
868
882
|
let minimalTurns: MinimalTurn[] = [];
|
|
869
883
|
let activeMinimalTurn: MinimalTurn | undefined;
|
|
@@ -902,6 +916,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
902
916
|
if (settings["pi-mini-mode-minimal-show"] && ctx.mode === "tui") unsubscribeMinimalInput = ctx.ui.onTerminalInput?.((data) => {
|
|
903
917
|
const nativeKey = matchesKey(data, "ctrl+alt+o");
|
|
904
918
|
const subAgentKey = matchesKey(data, "ctrl+s");
|
|
919
|
+
if (!nativeKey && focusedSelectorOwnsKeys(minimalTui)) return;
|
|
905
920
|
if (!nativeKey && (!restoreTranscript || (!subAgentKey && !matchesKey(data, "ctrl+o")))) return;
|
|
906
921
|
// Input listeners run before Pi filters Kitty release/repeat events.
|
|
907
922
|
if (isKeyRelease(data) || isKeyRepeat(data)) return { consume: true };
|
|
@@ -914,6 +929,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
914
929
|
return { consume: true };
|
|
915
930
|
});
|
|
916
931
|
if (nativeOutput || !settings["pi-mini-mode-minimal-show"] || ctx.mode !== "tui") {
|
|
932
|
+
minimalTui = undefined;
|
|
917
933
|
lastAttachMode = undefined;
|
|
918
934
|
ctx.ui.setWidget?.("pi-mini-mode-minimal-output", undefined);
|
|
919
935
|
refreshMinimalOutput();
|
|
@@ -921,6 +937,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
921
937
|
return;
|
|
922
938
|
}
|
|
923
939
|
ctx.ui.setWidget("pi-mini-mode-minimal-output", (tui, theme) => {
|
|
940
|
+
minimalTui = tui as unknown as { getFocusedComponent?(): unknown };
|
|
924
941
|
refreshMinimal = () => tui.requestRender();
|
|
925
942
|
// Retain children under their originating user turn, including while idle,
|
|
926
943
|
// after a follow-up user message, and when rebuilding a saved session.
|
|
@@ -1012,7 +1029,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
1012
1029
|
if (!restoreTranscript) {
|
|
1013
1030
|
restoreAgentWidgets?.();
|
|
1014
1031
|
restoreAgentWidgets = undefined;
|
|
1015
|
-
|
|
1032
|
+
// Settings overlay replaces the transcript; remount after it closes instead of warning.
|
|
1033
|
+
if (!settingsOverlayOpen) ctx.ui.notify(tui.mode === "regular"
|
|
1016
1034
|
? "Minimal output needs the fullscreen renderer. Quit and restart Pi — /reload does not switch TUI mode. Or set TUI mode to fullscreen in /settings."
|
|
1017
1035
|
: "Pi transcript layout not recognized; minimal mode disabled, native output preserved.", "warning");
|
|
1018
1036
|
}
|
|
@@ -1070,7 +1088,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
1070
1088
|
ctx.ui.notify(COPY.tuiRequired, "error");
|
|
1071
1089
|
return;
|
|
1072
1090
|
}
|
|
1073
|
-
|
|
1091
|
+
settingsOverlayOpen = true;
|
|
1092
|
+
try {
|
|
1093
|
+
await ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
1074
1094
|
const container = new Container();
|
|
1075
1095
|
const preview = new Text(settingsPreviewLine(theme, settings), 1, 1);
|
|
1076
1096
|
const title = new Text(theme.fg("accent", theme.bold(COPY.title)), 1, 1);
|
|
@@ -1085,7 +1105,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
1085
1105
|
items = settingsItems(settings);
|
|
1086
1106
|
cleanupInputEnhancements?.refresh();
|
|
1087
1107
|
preview.setText(settingsPreviewLine(theme, settings));
|
|
1088
|
-
mountMinimalOutput(ctx);
|
|
1089
1108
|
void persistSettings(ctx);
|
|
1090
1109
|
refresh();
|
|
1091
1110
|
refreshMinimalOutput();
|
|
@@ -1124,6 +1143,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
1124
1143
|
},
|
|
1125
1144
|
};
|
|
1126
1145
|
});
|
|
1146
|
+
} finally {
|
|
1147
|
+
settingsOverlayOpen = false;
|
|
1148
|
+
mountMinimalOutput(ctx);
|
|
1149
|
+
}
|
|
1127
1150
|
};
|
|
1128
1151
|
|
|
1129
1152
|
pi.registerCommand("pi-mini-mode-minimal", {
|
package/lib/agent-view.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { diagramMarkdown, isMarkdownProse, minimalMarkdownTheme } from "./minimal-markdown.ts";
|
|
2
2
|
import { extractNoticeBody, supervisorNoticeBody } from "./transcript-adapter.ts";
|
|
3
|
+
import { paintExpandedHeading } from "./minimal-theme.ts";
|
|
3
4
|
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
4
5
|
import { join, resolve } from "node:path";
|
|
5
6
|
import { tmpdir } from "node:os";
|
|
@@ -167,14 +168,6 @@ export function restyleAgentWidget(lines: string[], theme: Theme, width: number,
|
|
|
167
168
|
return rows;
|
|
168
169
|
}
|
|
169
170
|
|
|
170
|
-
/** Expanded heading: full-width selectedBg, keeping inner fg after resets.
|
|
171
|
-
* theme.bg only wraps the ends; older themes without getBgAnsi lose fill after \x1b[0m. */
|
|
172
|
-
function paintExpandedHeading(theme: Theme, line: string): string {
|
|
173
|
-
const background = theme.getBgAnsi?.("selectedBg") ?? "";
|
|
174
|
-
return background
|
|
175
|
-
? background + line.replace(/\x1b\[(?:0|49)?m/g, reset => reset + background) + "\x1b[49m"
|
|
176
|
-
: theme.bg("selectedBg", line);
|
|
177
|
-
}
|
|
178
171
|
function agentSummary(theme: Theme, width: number, running: number, done: number, errors: number, expanded: boolean): string {
|
|
179
172
|
const label = `Sub Agent · running ${running}${done ? ` · done ${done}` : ""}${errors ? ` · failed ${errors}` : ""}${done ? ` · Ctrl+S ${expanded ? "collapse" : "expand"}` : ""}`;
|
|
180
173
|
const summary = truncateToWidth(theme.fg(errors ? "error" : "muted", label), width);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { CustomEditor, stripFrontmatter, type ExtensionAPI, type ExtensionContext, type InputEvent, type InputEventResult } from "@earendil-works/pi-coding-agent";
|
|
15
15
|
import {
|
|
16
16
|
allocateImageId, getImageDimensions, renderImage, getCapabilities, setCapabilities, getOsc8LinkAtColumn, matchesKey, stripTerminalSequences, truncateToWidth, visibleWidth,
|
|
17
|
-
type AutocompleteItem, type AutocompleteProvider, type
|
|
17
|
+
type AutocompleteItem, type AutocompleteProvider, type EditorComponent, type TuiMouseEvent, type TUI, type OverlayHandle, type OverlayOptions,
|
|
18
18
|
} from "@earendil-works/pi-tui";
|
|
19
19
|
import { filePaths, inputCapabilities, linkRenderedPath, localPath } from "./file-links.ts";
|
|
20
20
|
import { open, readFile } from "node:fs/promises";
|
package/lib/minimal-theme.ts
CHANGED
|
@@ -14,12 +14,23 @@ function ansiColor(ansi: string): RGB | undefined {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/** Expanded heading: full-width selectedBg, keeping inner fg after resets.
|
|
18
|
+
* theme.bg only wraps the ends; older themes without getBgAnsi lose fill after \x1b[0m. */
|
|
19
|
+
export function paintExpandedHeading(theme: ExtensionContext["ui"]["theme"], line: string): string {
|
|
20
|
+
const background = theme.getBgAnsi?.("selectedBg") ?? "";
|
|
21
|
+
return background
|
|
22
|
+
? background + line.replace(/\x1b\[(?:0|49)?m/g, reset => reset + background) + "\x1b[49m"
|
|
23
|
+
: theme.bg("selectedBg", line);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** User uses the theme's soft surface directly; process keeps its secondary tint.
|
|
27
|
+
* A row inside an expanded heading (selected) keeps the band instead: the
|
|
28
|
+
* blended tint and the user surface both collapse into it. */
|
|
29
|
+
export function minimalSurface(theme: ExtensionContext["ui"]["theme"], text: string, user = false, selected = false): string {
|
|
30
|
+
const background = theme.getBgAnsi?.(selected ? "selectedBg" : "userMessageBg") ?? "";
|
|
31
|
+
if (user || selected) return background
|
|
21
32
|
? background + text.replace(/\x1b\[(?:0|49)?m/g, (reset) => reset + background) + "\x1b[49m"
|
|
22
|
-
: theme.bg("userMessageBg", text);
|
|
33
|
+
: theme.bg(selected ? "selectedBg" : "userMessageBg", text);
|
|
23
34
|
const base = ansiColor(background);
|
|
24
35
|
const accent = ansiColor(theme.fg("accent", "")) ?? ansiColor(theme.fg("success", ""));
|
|
25
36
|
if (!base || !accent) return theme.bg("userMessageBg", text);
|
package/package.json
CHANGED