@each1024/pi-mini-mode 2.0.21 → 2.0.22

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
@@ -80,6 +80,7 @@ Enable **Minimal output** in `/pi-mini-mode-settings`.
80
80
  - **Tool details on demand.** Expand a tool or thinking entry, including the latest thinking, using its fold control. Thinking starts collapsed and only expands or collapses manually, including while running. Tool details show saved text, not the original custom renderer or image output.
81
81
  - **Readable summaries.** Long tool rows keep the command beginning and put the ellipsis at the end; expanding reveals the complete long or multiline input. Live thinking follows the latest returned summary, while completed thinking previews its beginning and expands to the full received text. Empty summaries show their actual state without repeating a tool command; failures and interruptions stop the thinking clock.
82
82
  - **Room for the answer.** Final Markdown streams without extra headings or backgrounds. Failures and interruptions stay explicit. Folding changes presentation, not stored session messages.
83
+ - **Surface-aware investigation replies.** Only for root-cause investigations, risk reviews and real decisions, replies open with a one-line verdict and separate `Observed` / `Inferred` / `Unverified` evidence and options. The format follows the viewer: in the fullscreen minimal transcript markers render as rounded or square pills and numbered choices appear in a bottom picker (`↑/↓` or click to send); GUI hosts such as T3 Code, Pi's native transcript and other RPC clients get emoji + bold Markdown instead of raw tags. The guide is a structured system-prompt section, so it never forces a full prompt rewrite. Routine chat stays plain.
83
84
 
84
85
  Turn **Minimal output** off in settings to restore native Pi history.
85
86
 
@@ -152,6 +153,9 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-m
152
153
  "pi-mini-mode-speed-show": true,
153
154
  "pi-mini-mode-speed-unit-show": true,
154
155
  "pi-mini-mode-minimal-show": true,
156
+ "pi-mini-mode-semantic-badges": true,
157
+ "pi-mini-mode-badge-style": "round",
158
+ "pi-mini-mode-report-guide": true,
155
159
  "pi-mini-mode-input-enhancements": true,
156
160
  "onboardingCompleted": true
157
161
  }
@@ -175,6 +179,9 @@ Settings are stored globally at Pi's agent directory (normally `~/.pi/agent/pi-m
175
179
  | `pi-mini-mode-speed-show` | `true` | Generation speed at the far right |
176
180
  | `pi-mini-mode-speed-unit-show` | `true` | Generation-speed sub-setting: append `tok/s` to the numeric value |
177
181
  | `pi-mini-mode-minimal-show` | `true` | Minimal output; off restores Pi's default conversation history |
182
+ | `pi-mini-mode-semantic-badges` | `true` | Paint status markers as pills plus the bottom option picker in the fullscreen minimal transcript; off shows emoji + bold |
183
+ | `pi-mini-mode-report-guide` | `true` | Ask for structured investigation/decision replies, formatted for the current surface; off injects nothing |
184
+ | `pi-mini-mode-badge-style` | `"round"` | Diagnostic pill shape: `"round"` (Powerline caps) or `"square"` |
178
185
  | `pi-mini-mode-input-enhancements` | `true` | Image previews, inline skills, and message file links |
179
186
  | `onboardingCompleted` | `false` initially | Internal marker that prevents another first-run prompt |
180
187
 
package/README.zh-CN.md CHANGED
@@ -79,6 +79,7 @@ pi install git:github.com/eachann1024/pi-mini-mode
79
79
  - **过程是一棵树,而非满屏输出。** 思考、工具与技能读取汇入同一棵时间顺序树,显示最新摘要,包括最新一条思考;`Ctrl+O` 展开/收起完整过程,新问题默认收起。
80
80
  - **工具详情,按需展开。** 点击工具或思考条目的折叠控件,最新一条思考也可以展开。思考默认收起,进行中与结束后均只由手动操作展开或收起。工具详情展示保存的文本,不还原原生自定义渲染器或图片输出。
81
81
  - **把空间留给答案。** 最终 Markdown 流式呈现,不添加额外标题或背景。失败和中断明确标记;折叠只改变显示,不删除原始会话消息。
82
+ - **按显示位置适配的排障汇报。** 只在排查故障、风险审查或真正需要拍板时,让回复先给一句结论,再区分「亲眼确认」「合理推测」「还没查」与可选方案。格式跟随显示位置:全屏极简输出里渲染为圆角或方角彩色胶囊,并在输入框上方提供上下键与点击速选;T3 Code 等图形界面、Pi 原生输出和其他 RPC 客户端改用表情加粗体,不再出现生硬的方括号标签。说明以结构化系统提示词分段注入,不会整段改写提示词;日常对话保持原样。
82
83
 
83
84
  在设置中关闭 **极简输出** 即恢复 Pi 原生历史。
84
85
 
@@ -143,6 +144,9 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 ◇ MCP 3 500
143
144
  "pi-mini-mode-speed-show": true,
144
145
  "pi-mini-mode-speed-unit-show": true,
145
146
  "pi-mini-mode-minimal-show": true,
147
+ "pi-mini-mode-semantic-badges": true,
148
+ "pi-mini-mode-badge-style": "round",
149
+ "pi-mini-mode-report-guide": true,
146
150
  "pi-mini-mode-input-enhancements": true,
147
151
  "onboardingCompleted": true
148
152
  }
@@ -166,6 +170,9 @@ deepseek-v4-flash high Total 45K Cached 25K CH 40.0% $0.012 ◇ MCP 3 500
166
170
  | `pi-mini-mode-speed-show` | `true` | 显示最新生成速度 |
167
171
  | `pi-mini-mode-speed-unit-show` | `true` | 速度子设置:在数字后追加 `tok/s` |
168
172
  | `pi-mini-mode-minimal-show` | `true` | 极简输出总开关;关闭则恢复 Pi 默认历史显示 |
173
+ | `pi-mini-mode-semantic-badges` | `true` | 全屏极简输出中把状态标记渲染为胶囊并提供底部方案速选;关闭显示为表情加粗体 |
174
+ | `pi-mini-mode-report-guide` | `true` | 排障与决策时按显示位置注入汇报格式说明;关闭则完全不注入 |
175
+ | `pi-mini-mode-badge-style` | `"round"` | 胶囊样式:`"round"`(圆角)或 `"square"`(方角纯色块) |
169
176
  | `pi-mini-mode-input-enhancements` | `true` | 图片预览、行内技能补全与展开、消息文件链接 |
170
177
  | `onboardingCompleted` | 初始为 `false` | 防止再次显示首次设置提示的内部标记 |
171
178
 
@@ -16,7 +16,8 @@ import { statusLine } from "../lib/footer-line.ts";
16
16
  import { contentText, minimalTurnsFromBranch, processText, pushProcess, skillNames, type MinimalTurn } from "../lib/minimal-turns.ts";
17
17
  import { minimalOutputComponent } from "../lib/minimal-output.ts";
18
18
  import { createDecisionDock, extractDecisionPrompt } from "../lib/decision-dock.ts";
19
- import { appendTriageGuidance, isBadgeStyle } from "../lib/semantic-badges.ts";
19
+ import { isBadgeStyle, plainSemanticBadges } from "../lib/semantic-badges.ts";
20
+ import { applyReportGuide, resolveReportProfile } from "../lib/report-guide.ts";
20
21
  import { createThinkingStream } from "../lib/thinking-stream.ts";
21
22
  import { PACKAGE_VERSION, isNewerVersion } from "../lib/update-banner.ts";
22
23
 
@@ -28,7 +29,8 @@ export { SPEED_REFRESH_MS } from "../lib/token-speed.ts";
28
29
  export { isPlannotatorPlanningStatus, planCapsule, settingsPreviewLine, statusLine } from "../lib/footer-line.ts";
29
30
  export { formatElapsed, formatToolElapsed, formatThinkingElapsed, minimalTurnsFromBranch, type MinimalTurn, type ThinkingClock } from "../lib/minimal-turns.ts";
30
31
  export { minimalOutputComponent } from "../lib/minimal-output.ts";
31
- export { isBadgeStyle, parseSemanticBadge, renderSemanticBadge, transformSemanticBadges, appendTriageGuidance, type BadgeStyle, type BadgeTone } from "../lib/semantic-badges.ts";
32
+ export { isBadgeStyle, parseSemanticBadge, plainSemanticBadges, renderSemanticBadge, transformSemanticBadges, type BadgeStyle, type BadgeTone } from "../lib/semantic-badges.ts";
33
+ export { applyReportGuide, reportGuide, resolveReportProfile, REPORT_SECTION, type ReportProfile } from "../lib/report-guide.ts";
32
34
  export { extractDecisionPrompt, createDecisionDock, type DecisionChoice, type DecisionPrompt } from "../lib/decision-dock.ts";
33
35
  export { PACKAGE_VERSION, UPDATE_RELEASE_DATE, isNewerVersion, renderUpdateBanner } from "../lib/update-banner.ts";
34
36
 
@@ -94,7 +96,11 @@ export default function (pi: ExtensionAPI) {
94
96
  let liveCtx: ExtensionContext | undefined;
95
97
  let messageCwd = process.cwd();
96
98
  const messageLinks = (text: string) => settings["pi-mini-mode-input-enhancements"] ? linkMessageFiles(text, messageCwd) : text;
97
- pi.registerMarkdownTransformer?.(messageLinks);
99
+ // Pi's native transcript cannot paint pills, so legacy badge tokens degrade to bold emoji text there.
100
+ pi.registerMarkdownTransformer?.((text, info) => {
101
+ const linked = messageLinks(text);
102
+ return info?.messageType === "assistant" ? plainSemanticBadges(linked) : linked;
103
+ });
98
104
  let saveChain: Promise<void> = Promise.resolve();
99
105
  const configPath = settingsPath();
100
106
  let updateBannerChecked = false;
@@ -110,9 +116,16 @@ export default function (pi: ExtensionAPI) {
110
116
  onSubmit: (replyText) => pi.sendUserMessage?.(replyText),
111
117
  requestRender: () => refreshMinimalOutput(),
112
118
  });
119
+ /**
120
+ * Pills and the decision dock exist only while the minimal fullscreen transcript is mounted;
121
+ * RPC/GUI hosts, Pi's native transcript and non-fullscreen TUI all show plain Markdown.
122
+ */
123
+ const capsulesRendered = (ctx: Pick<ExtensionContext, "mode"> | undefined) =>
124
+ settings["pi-mini-mode-minimal-show"] && settings["pi-mini-mode-semantic-badges"] && !nativeOutput
125
+ && ctx?.mode === "tui" && Boolean(restoreTranscript);
113
126
  const syncDecisionDock = () => {
114
127
  const lastTurn = minimalTurns.at(-1);
115
- const enabled = settings["pi-mini-mode-minimal-show"] && settings["pi-mini-mode-semantic-badges"] && !nativeOutput && liveCtx?.mode === "tui";
128
+ const enabled = capsulesRendered(liveCtx);
116
129
  const prompt = enabled && !activeMinimalTurn?.running && lastTurn && !lastTurn.running
117
130
  ? extractDecisionPrompt(lastTurn.final, minimalTurns.length - 1)
118
131
  : undefined;
@@ -611,14 +624,16 @@ export default function (pi: ExtensionAPI) {
611
624
  if (activeMinimalTurn) { refreshMinimalOutput(); return; }
612
625
  syncMinimalBranch(event, ctx);
613
626
  });
614
- pi.on("before_agent_start", (event) => {
627
+ pi.on("before_agent_start", (event, ctx) => {
615
628
  if (activeMinimalTurn) {
616
629
  for (const name of skillNames(event.prompt)) pushProcess(activeMinimalTurn, "skill", name);
617
630
  refreshMinimalOutput();
618
631
  }
619
- if (settings["pi-mini-mode-minimal-show"] && settings["pi-mini-mode-semantic-badges"] && !nativeOutput && typeof event.systemPrompt === "string" && event.systemPrompt) {
620
- return { systemPrompt: appendTriageGuidance(event.systemPrompt) };
621
- }
632
+ const profile = resolveReportProfile({
633
+ guideEnabled: settings["pi-mini-mode-report-guide"],
634
+ capsulesRendered: capsulesRendered(ctx ?? liveCtx),
635
+ });
636
+ return applyReportGuide(event, profile);
622
637
  });
623
638
  pi.on("ui_prompt_start", (event) => {
624
639
  activeUIPrompt = event;
@@ -6,7 +6,7 @@ import { assistantImageSpans, clearAssistantImageCaches, createAssistantImages,
6
6
  import { clearFileLinkCaches, linkToolFiles } from "./file-links.ts";
7
7
  import { createLinkHover } from "./link-hover.ts";
8
8
  import { diagramMarkdown, isFencedMarkdown, renderMinimalMarkdown } from "./minimal-markdown.ts";
9
- import type { BadgeStyle } from "./semantic-badges.ts";
9
+ import { plainSemanticBadges, type BadgeStyle } from "./semantic-badges.ts";
10
10
  import { minimalSurface, paintExpandedHeading } from "./minimal-theme.ts";
11
11
  import { formatElapsed, formatThinkingElapsed, formatToolElapsed, piLoopSummary, type MinimalTurn } from "./minimal-turns.ts";
12
12
  import { clearPrintAgentCaches } from "./print-agent.ts";
@@ -142,7 +142,10 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
142
142
  const hit = lruGet(markdownCache, key);
143
143
  if (hit !== undefined) return [...hit];
144
144
  const rows = renderMinimalMarkdown(text, width, getMarkdownTheme(), theme.getBgAnsi?.("userMessageBg") ?? "",
145
- { color: (value) => theme.fg(process ? "muted" : "text", value) }, (source, available) => transformText(placeholderText(diagramMarkdown(source, available))),
145
+ { color: (value) => theme.fg(process ? "muted" : "text", value) }, (source, available) => {
146
+ const next = transformText(placeholderText(diagramMarkdown(source, available)));
147
+ return !process && !badgeCfg.enabled ? plainSemanticBadges(next) : next;
148
+ },
146
149
  badgeCfg.enabled ? { theme, style: badgeCfg.style } : undefined);
147
150
  lruSet(markdownCache, key, rows);
148
151
  return [...rows];
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Reply-format guidance for investigations and decisions.
3
+ *
4
+ * The guide is chosen per run from the surface that will actually display the reply:
5
+ * - "capsule": Pi's TUI with the minimal transcript renders `[…]` tokens as colored pills
6
+ * and turns numbered options into the decision dock.
7
+ * - "markdown": every other surface (RPC/GUI hosts such as T3 Code, JSON, print, Pi's native
8
+ * transcript) only sees plain Markdown, so the guide asks for emoji + bold instead of tokens.
9
+ */
10
+
11
+ export type ReportProfile = "capsule" | "markdown";
12
+
13
+ /** Structured system-prompt section name; Pi wraps it as `<pi-mini-mode-reporting>…</…>`. */
14
+ export const REPORT_SECTION = "pi-mini-mode-reporting";
15
+ /** Legacy marker from the forced-prompt implementation; kept so stale prompts are not doubled. */
16
+ export const LEGACY_REPORT_MARKER = "<!-- pi-mini-mode:semantic-triage -->";
17
+
18
+ export interface ReportSurface {
19
+ guideEnabled: boolean;
20
+ /** True only when the reply will be painted by the minimal TUI transcript with pills enabled. */
21
+ capsulesRendered: boolean;
22
+ }
23
+
24
+ export function resolveReportProfile(surface: ReportSurface): ReportProfile | undefined {
25
+ if (!surface.guideEnabled) return undefined;
26
+ return surface.capsulesRendered ? "capsule" : "markdown";
27
+ }
28
+
29
+ const SCOPE = `Applies only to replies that report a bug investigation, a failed check/build/deploy, a change-risk review, or that need the user to choose between real alternatives. All other replies stay ordinary prose with none of the markers below.
30
+ - Open with one plain sentence: what happened and whether things are safe right now.
31
+ - Mark certainty only on claims where it is mixed; skip markers when everything was directly observed.
32
+ - List options only when the user must decide and you cannot reasonably decide alone: 2–4 numbered one-line options, each with its trade-off, exactly one recommended. Never invent a decision to fill the format.
33
+ - Write markers in the reply language and keep the user's tone; no box-drawing characters.`;
34
+
35
+ const CAPSULE = `Markers (this terminal renders each bracket as a colored pill; write them bare, not in backticks):
36
+ - Optional status line when several checks apply: [✓ 正常 N] [× 失败 N] [? 还没查 N] — English: [✓ Done N] [× Failed N] [? Unverified N].
37
+ - Certainty prefix on a bullet: [!亲眼确认] / [!合理推测] / [? 还没查] — English: [!Observed] / [!Inferred] / [? Unverified]. Cross-module impact: [!影响范围] / [!Shared].
38
+ - Decision: put [● 等你定] / [● Needs you] before the numbered list; tag options with [★ 推荐] / [★ Recommended] and risky ones with [! 高风险] / [! Destructive].`;
39
+
40
+ const MARKDOWN = `Markers (the viewer shows plain Markdown, so never use square-bracket tags or backtick-wrapped labels):
41
+ - Optional status line when several checks apply: ✅ 正常 N · ❌ 失败 N · ❓ 还没查 N — English: ✅ Done N · ❌ Failed N · ❓ Unverified N.
42
+ - Certainty prefix on a bullet: ✅ 亲眼确认 / 🔎 合理推测 / ❓ 还没查 — English: ✅ Observed / 🔎 Inferred / ❓ Unverified. Cross-module impact: ⚠️ 影响范围 / ⚠️ Shared.
43
+ - Decision: a bold line **👉 需要你决定** / **👉 Your call** before the numbered list; append ⭐ 推荐 / ⭐ Recommended to one option and ⚠️ 高风险 / ⚠️ Risky to dangerous ones.`;
44
+
45
+ export function reportGuide(profile: ReportProfile): string {
46
+ return `${SCOPE}\n${profile === "capsule" ? CAPSULE : MARKDOWN}`;
47
+ }
48
+
49
+ type PromptOptionsLike = { sections?: Record<string, string> } | undefined;
50
+
51
+ /**
52
+ * Install (or remove) the guide for one run.
53
+ * Prefers Pi's structured `sections` so the prompt is patched in place and the provider cache
54
+ * survives; falls back to appending to the full prompt on Pi builds without sections.
55
+ */
56
+ export function applyReportGuide(
57
+ event: { systemPrompt?: unknown; systemPromptOptions?: unknown },
58
+ profile: ReportProfile | undefined,
59
+ ): { systemPrompt: string } | undefined {
60
+ const options = event.systemPromptOptions as PromptOptionsLike;
61
+ if (options && options.sections && typeof options.sections === "object") {
62
+ if (profile) options.sections[REPORT_SECTION] = reportGuide(profile);
63
+ else delete options.sections[REPORT_SECTION];
64
+ return undefined;
65
+ }
66
+ if (!profile || typeof event.systemPrompt !== "string" || !event.systemPrompt) return undefined;
67
+ if (event.systemPrompt.includes(`<${REPORT_SECTION}>`) || event.systemPrompt.includes(LEGACY_REPORT_MARKER)) return undefined;
68
+ return { systemPrompt: `${event.systemPrompt}\n\n<${REPORT_SECTION}>\n${reportGuide(profile)}\n</${REPORT_SECTION}>` };
69
+ }
@@ -120,7 +120,9 @@ export function isDecisionBadgeText(source: string): boolean {
120
120
  return false;
121
121
  }
122
122
 
123
- function transformInlineSegment(line: string): string {
123
+ type BadgeRewrite = (candidate: string, parsed: ParsedSemanticBadge, inCode: boolean) => string | undefined;
124
+
125
+ function rewriteInlineSegment(line: string, rewrite: BadgeRewrite): string {
124
126
  let result = "";
125
127
  let index = 0;
126
128
  while (index < line.length) {
@@ -133,7 +135,9 @@ function transformInlineSegment(line: string): string {
133
135
  result += line.slice(index);
134
136
  break;
135
137
  }
136
- result += line.slice(index, close + ticks);
138
+ const inner = line.slice(index + ticks, close).trim();
139
+ const parsed = inner.length <= 34 ? parseSemanticBadge(inner) : undefined;
140
+ result += (parsed && rewrite(inner, parsed, true)) ?? line.slice(index, close + ticks);
137
141
  index = close + ticks;
138
142
  continue;
139
143
  }
@@ -142,8 +146,9 @@ function transformInlineSegment(line: string): string {
142
146
  if (close > index + 1 && close - index <= 34) {
143
147
  const next = line[close + 1] ?? "";
144
148
  const candidate = line.slice(index, close + 1);
145
- if (next !== "(" && next !== "[" && next !== ":" && parseSemanticBadge(candidate)) {
146
- result += `\`${candidate}\``;
149
+ const parsed = next !== "(" && next !== "[" && next !== ":" ? parseSemanticBadge(candidate) : undefined;
150
+ if (parsed) {
151
+ result += rewrite(candidate, parsed, false) ?? candidate;
147
152
  index = close + 1;
148
153
  continue;
149
154
  }
@@ -155,8 +160,8 @@ function transformInlineSegment(line: string): string {
155
160
  return result;
156
161
  }
157
162
 
158
- /** Wrap standalone semantic badge tokens outside code fences and links into inline code spans. */
159
- export function transformSemanticBadges(source: string): string {
163
+ /** Apply a badge rewrite to prose lines, leaving fenced code blocks and reference definitions alone. */
164
+ function rewriteSemanticBadges(source: string, rewrite: BadgeRewrite): string {
160
165
  if (!source.includes("[")) return source;
161
166
  const lines = source.split("\n");
162
167
  let fenceChar = "";
@@ -178,11 +183,35 @@ export function transformSemanticBadges(source: string): string {
178
183
  continue;
179
184
  }
180
185
  if (fenceChar || /^ {0,3}\[[^\]]+\]:/.test(line) || !line.includes("[")) continue;
181
- lines[i] = transformInlineSegment(line);
186
+ lines[i] = rewriteInlineSegment(line, rewrite);
182
187
  }
183
188
  return lines.join("\n");
184
189
  }
185
190
 
191
+ /** Wrap standalone semantic badge tokens outside code fences and links into inline code spans. */
192
+ export function transformSemanticBadges(source: string): string {
193
+ return rewriteSemanticBadges(source, (candidate, _parsed, inCode) => (inCode ? undefined : `\`${candidate}\``));
194
+ }
195
+
196
+ const PLAIN_ICON: Record<BadgeTone, string> = {
197
+ success: "✅", error: "❌", warning: "❓", action: "👉", info: "🔎", muted: "⏭️",
198
+ };
199
+
200
+ /** Emoji + text form of a badge for surfaces that cannot paint pills. */
201
+ export function plainBadgeLabel(parsed: ParsedSemanticBadge): string {
202
+ const raw = parsed.label.trim();
203
+ const text = raw.replace(/^(?:[✓✔★×✕??●⑂~»⏭!]\s*)+/u, "").trim() || raw;
204
+ let icon = PLAIN_ICON[parsed.tone];
205
+ if (raw.startsWith("★")) icon = "⭐";
206
+ else if (parsed.tone === "error" && raw.startsWith("!")) icon = "⚠️";
207
+ return `${icon} ${text}`;
208
+ }
209
+
210
+ /** Degrade badge tokens (bare or backtick-wrapped) to bold emoji text, e.g. history shown without pills. */
211
+ export function plainSemanticBadges(source: string): string {
212
+ return rewriteSemanticBadges(source, (_candidate, parsed) => `**${plainBadgeLabel(parsed)}**`);
213
+ }
214
+
186
215
  const DARK_PALETTE: Record<BadgeTone, { bg: RGB; fg: RGB }> = {
187
216
  success: { bg: [22, 56, 40], fg: [134, 239, 172] },
188
217
  error: { bg: [67, 25, 36], fg: [253, 164, 175] },
@@ -256,19 +285,3 @@ export function renderSemanticBadge(raw: string, theme: BadgeThemeLike, style: B
256
285
  }
257
286
  return `${bgCode}${fgCode}\x1b[1m ${parsed.label} \x1b[22m\x1b[49m\x1b[39m`;
258
287
  }
259
-
260
- export const TRIAGE_PROMPT_MARKER = "<!-- pi-mini-mode:semantic-triage -->";
261
-
262
- export const TRIAGE_SYSTEM_PROMPT = `${TRIAGE_PROMPT_MARKER}
263
- ## Diagnostic & Trade-off Reporting (on-demand only)
264
- Keep routine edits, coding tasks, and simple Q&A completely normal—do not add scoreboards, badges, or option menus to ordinary replies.
265
- ONLY when investigating a failure/bug, auditing deployment/change risks, or presenting trade-off options that require a user decision:
266
- 1. Open with a one-sentence plain conclusion stating what stopped/happened and whether the current system is safe.
267
- 2. When multiple checks/stages apply, summarize status on one line with inline badge spans: \`[✓ 正常 N]\` \`[× 失败 N]\` \`[? 还没查 N]\` \`[● 等你定 1]\` (or English \`[✓ Done N]\` \`[× Failed N]\` \`[? Unverified N]\` \`[● Needs you 1]\`).
268
- 3. Separate evidence certainty in a \`├─\` / \`└─\` list using \`[!亲眼确认]\` (\`[!Observed]\`), \`[!合理推测]\` (\`[!Inferred]\`), and \`[? 还没查]\` (\`[? Unverified]\`), and flag cross-module impact with \`[!影响范围]\` (\`[!Shared]\`).
269
- 4. When asking the user to choose between 2–4 options, include \`[● 等你定 1]\` (or \`[● Needs you 1]\`), list numbered options \`1. **Title** \`[★ 推荐]\` — trade-off\` (mark risky ones \`[! 高风险]\` / \`[! Destructive]\`), and propose a safe, reversible next step.`;
270
-
271
- export function appendTriageGuidance(systemPrompt: string): string {
272
- if (!systemPrompt || systemPrompt.includes(TRIAGE_PROMPT_MARKER)) return systemPrompt;
273
- return `${systemPrompt}\n\n${TRIAGE_SYSTEM_PROMPT}`;
274
- }
package/lib/settings.html CHANGED
@@ -48,13 +48,15 @@ const I18N={
48
48
  featureList:{
49
49
  zh:[
50
50
  {id:'minimal',setting:'pi-mini-mode-minimal-show',title:'极简输出',body:'在全屏模式下,把思考、工具与技能记录收进一棵可折叠过程树,保留完整回复。',points:['长用户消息显示前四行,点击展开全文','子代理始终显示,可展开活动记录与输出','Ctrl+O 展开或收起过程树,新问题默认收起','最终 Markdown 流畅呈现,失败与中断明确标记']},
51
- {id:'semantic-badges',setting:'pi-mini-mode-semantic-badges',title:'语义诊断胶囊',body:'排障调查、风险审查与多方案决策时,将证据可信度渲染为彩色胶囊,并在输入框上方提供快速选方案。',points:['区分「亲眼确认」「合理推测」与「? 还没查」,一眼看清未验证盲区','存在多方案待拍板时,上下键或点击即可确认发送,直接打字互不干扰','日常改代码与普通问答保持原样,不产生额外标签']},
51
+ {id:'report-guide',setting:'pi-mini-mode-report-guide',title:'排障汇报格式',body:'只在排障、风险审查或需要你拍板时,让回复先给一句结论,再区分证据可信度与可选方案。',points:['格式跟随显示位置:全屏终端用彩色胶囊,T3 Code 等图形界面用表情加粗体','只在真有选择时才列方案,不为凑格式硬造决策','日常改代码与普通问答保持原样']},
52
+ {id:'semantic-badges',setting:'pi-mini-mode-semantic-badges',title:'语义诊断胶囊',body:'全屏极简输出下,把排障回复里的状态标记渲染成彩色胶囊,并在输入框上方提供快速选方案。',points:['区分「亲眼确认」「合理推测」与「? 还没查」,一眼看清未验证盲区','存在多方案待拍板时,上下键或点击即可确认发送,直接打字互不干扰','关闭后标记显示为表情加粗体,历史记录同样可读']},
52
53
  {id:'input-enhancements',setting:'pi-mini-mode-input-enhancements',title:'输入增强',body:'让输入框和消息里的图片、技能与文件路径直接可用。',points:['图片默认以内联卡片陈列于输入框上方,亦可切换光标悬停','图片路径收纳为 [image1] 标签,提交时保留原图','空白后输入 / 就地搜索技能并插入光标处','左键用系统默认应用打开,全屏右键在文件管理器中定位并选中'],hint:'Ctrl+V 粘贴图片(Windows/WSL 使用 Alt+V)'},
53
54
  {id:'themes',title:'明暗主题',body:'主题让 Markdown、代码高亮、表格与 Mermaid 图表跟随明暗切换。',points:['用户消息使用主题用户背景色,与正文区分','不支持、不完整或过宽的图表保留源文本'],hint:'回到 Pi,输入 /settings → Theme,选择 cc-dark / cc-light'}
54
55
  ],
55
56
  en:[
56
57
  {id:'minimal',setting:'pi-mini-mode-minimal-show',title:'Minimal transcript',body:'In fullscreen mode, fold thinking, tools and skill reads into one process tree while keeping the full reply.',points:['Long user messages show four rendered rows; click to expand','Subagents stay visible; click to expand activity and output','Ctrl+O expands or collapses the full process tree; new questions start collapsed','Final Markdown streams plainly; failures and interrupts are marked']},
57
- {id:'semantic-badges',setting:'pi-mini-mode-semantic-badges',title:'Semantic diagnostic pills',body:'During root-cause investigations and trade-off decisions, highlight evidence certainty as colored pills with a quick option picker above the editor.',points:['Separates Observed facts, Inferred deductions and Unverified blind spots','Up/Down or click to send a numbered option; typing freely in the editor stays unobstructed','Routine coding tasks and simple Q&A stay plain without extra badges']},
58
+ {id:'report-guide',setting:'pi-mini-mode-report-guide',title:'Investigation reply format',body:'Only for investigations, risk reviews and real decisions: replies open with a one-line verdict, then separate evidence certainty and options.',points:['Format follows the viewer: colored pills in the fullscreen terminal, emoji + bold in GUI hosts such as T3 Code','Options appear only when you actually have to choose','Routine coding tasks and simple Q&A stay plain']},
59
+ {id:'semantic-badges',setting:'pi-mini-mode-semantic-badges',title:'Semantic diagnostic pills',body:'In the fullscreen minimal transcript, paint reply status markers as colored pills with a quick option picker above the editor.',points:['Separates Observed facts, Inferred deductions and Unverified blind spots','Up/Down or click to send a numbered option; typing freely in the editor stays unobstructed','When off, markers show as emoji + bold, including in history']},
58
60
  {id:'input-enhancements',setting:'pi-mini-mode-input-enhancements',title:'Input enhancements',body:'Makes images, skills and file paths usable right where you type.',points:['Images appear as inline cards above the editor by default, with optional cursor hover','Image paths collapse to [image1] labels while keeping the original path on submit','Type / after a space to search skills and insert at the cursor','Left-click opens in the default app; fullscreen right-click reveals and selects the file'],hint:'Ctrl+V pastes images (Windows/WSL: Alt+V)'},
59
61
  {id:'themes',title:'Light and dark themes',body:'Themes keep Markdown, code highlighting, tables and Mermaid diagrams in step with light and dark.',points:['User messages use the theme user background to stand out','Unsupported, incomplete or overly wide diagrams keep their source text'],hint:'In Pi, enter /settings → Theme and choose cc-dark or cc-light'}
60
62
  ]
package/lib/settings.ts CHANGED
@@ -27,6 +27,8 @@ export interface MiniLensSettings {
27
27
  "pi-mini-mode-minimal-record-limit": number;
28
28
  "pi-mini-mode-semantic-badges": boolean;
29
29
  "pi-mini-mode-badge-style": BadgeStyle;
30
+ /** Ask the model for structured investigation/decision replies, formatted for the surface that shows them. */
31
+ "pi-mini-mode-report-guide": boolean;
30
32
  "pi-mini-mode-input-enhancements": boolean;
31
33
  "pi-mini-mode-image-preview": "hover" | "inline";
32
34
  onboardingCompleted: boolean;
@@ -70,6 +72,7 @@ export const DEFAULT_SETTINGS: Readonly<MiniLensSettings> = {
70
72
  "pi-mini-mode-minimal-record-limit": 6,
71
73
  "pi-mini-mode-semantic-badges": true,
72
74
  "pi-mini-mode-badge-style": "round",
75
+ "pi-mini-mode-report-guide": true,
73
76
  "pi-mini-mode-input-enhancements": true,
74
77
  "pi-mini-mode-image-preview": "inline",
75
78
  onboardingCompleted: false,
@@ -80,11 +83,12 @@ export const FOOTER_FIELDS = ["project-branch", "model", "thinking", "branch", "
80
83
  export const FOOTER_STYLE_OPTIONS = ["context-dots", "speed-unit"] as const;
81
84
 
82
85
  export const COPY = {
83
- preview: "预览(示例数据)", minimal: "极简输出", semanticBadges: "语义诊断胶囊",
86
+ preview: "预览(示例数据)", minimal: "极简输出", semanticBadges: "语义诊断胶囊", reportGuide: "排障汇报格式",
84
87
  model: "显示模型", thinking: "显示思考等级", total: "显示会话总 token", cached: "显示会话缓存 token", miss: "显示缓存 miss", totalLabel: "Total", cachedLabel: "Cached", cacheHitLabel: "CH", cacheHit: "显示缓存命中率 (CH)", price: "显示会话价格", mcp: "显示已启用 MCP 服务器", context: "显示上下文 token 与进度条", dots: "↳ 使用点阵进度条", percent: "显示上下文百分比", speed: "显示最近生成速度", speedUnit: "↳ 显示 tok/s 单位", inputEnhancements: "输入增强",
85
88
  totalDescription: "Total:当前会话分支上的全部 token,含工具上报的 LLM 用量。", cachedDescription: "Cached:累计 cache-read + cache-write token(包含在 Total 中)。", cacheHitDescription: "CH(cache hit):cache-read / (input + cache-read)。Cache write 不计入此比率。",
86
89
  enableMinimalDescription: "开启统一折叠思考、工具和技能过程;关闭恢复 Pi 默认会话历史。",
87
- semanticBadgesDescription: "排障与多方案决策时渲染圆角语义胶囊(亲眼确认 / 合理推测 / 还没查),并在底部提供方案快速选择;日常对话保持原样。",
90
+ semanticBadgesDescription: "全屏极简输出下,把排障回复里的状态标记渲染成彩色胶囊,并在底部提供方案快速选择;关闭后标记显示为表情加粗体。",
91
+ reportGuideDescription: "仅在排障、风险审查或需要你拍板时,让模型先给一句结论、区分证据可信度并列出方案。格式自动适配显示位置:全屏终端用胶囊标记,T3 Code 等图形界面与原生输出用表情加粗体;日常对话不受影响。关闭则不再注入该说明。",
88
92
  inputEnhancementsDescription: "原生 Ctrl+V 粘贴图片(Windows/WSL:Alt+V);图片显示为 [image1] 标签,默认在输入框上方显示内联卡片(可切换光标悬停模式)。空白后 / 选择技能并在光标处插入。左键用系统默认应用打开图片标签或文件路径;全屏右键在文件管理器中定位并选中该文件。预览及点击需终端支持。关闭仅恢复原生行为。",
89
93
  tuiRequired: "/pi-mini-mode-settings 需要 TUI 模式", saveFailed: "无法保存 Pi Mini Mode 设置", onboarding: "默认开启输入增强和极简输出;极简输出需要全屏模式。仅显示分支、缓存 token 和 MCP 服务数默认关闭。选择「打开浏览器设置」可调整字段、预览方式和功能开关;推荐配置会保存主题和全屏模式。以后可用 /pi-mini-mode-settings 修改。", keepDefaults: "保留默认", configureNow: "打开浏览器设置", applyRecommended: "应用推荐配置", chooseTheme: "选择主题(主题立即应用;全屏模式需重启 Pi)", themeSaved: "已保存主题和全屏模式。请重启 Pi 以启用全屏;项目设置或命令行参数可能覆盖全局设置。", themeSaveFailed: "无法保存推荐的 Pi 主题和全屏模式;未完成首次配置。", themeApplyFailed: "推荐设置已保存,但当前主题未能立即应用;请重启 Pi。",
90
94
  } as const;
@@ -172,11 +176,11 @@ export function settingsItems(settings: MiniLensSettings): SettingItem[] {
172
176
  const labels: Record<Exclude<keyof MiniLensSettings, "onboardingCompleted" | "lastSeenVersion" | "footerOrder" | "pi-mini-mode-language" | "pi-mini-mode-image-preview" | "pi-mini-mode-badge-style" | "pi-mini-mode-minimal-record-limit">, string> = {
173
177
  "pi-mini-mode-project-branch-show": "显示项目名称和分支(互斥)",
174
178
  "pi-mini-mode-branch-show": "仅显示分支(思考等级后,互斥)",
175
- "pi-mini-mode-model-show": COPY.model, "pi-mini-mode-thinking-show": COPY.thinking, "pi-mini-mode-session-tokens-show": COPY.total, "pi-mini-mode-cache-tokens-show": COPY.cached, "pi-mini-mode-cache-miss-show": COPY.miss, "pi-mini-mode-ch-show": COPY.cacheHit, "pi-mini-mode-cost-show": COPY.price, "pi-mini-mode-mcp-show": COPY.mcp, "pi-mini-mode-context-show": COPY.context, "pi-mini-mode-context-dots-show": COPY.dots, "pi-mini-mode-context-percent-show": COPY.percent, "pi-mini-mode-speed-show": COPY.speed, "pi-mini-mode-speed-unit-show": COPY.speedUnit, "pi-mini-mode-minimal-show": COPY.minimal, "pi-mini-mode-semantic-badges": COPY.semanticBadges, "pi-mini-mode-input-enhancements": COPY.inputEnhancements,
179
+ "pi-mini-mode-model-show": COPY.model, "pi-mini-mode-thinking-show": COPY.thinking, "pi-mini-mode-session-tokens-show": COPY.total, "pi-mini-mode-cache-tokens-show": COPY.cached, "pi-mini-mode-cache-miss-show": COPY.miss, "pi-mini-mode-ch-show": COPY.cacheHit, "pi-mini-mode-cost-show": COPY.price, "pi-mini-mode-mcp-show": COPY.mcp, "pi-mini-mode-context-show": COPY.context, "pi-mini-mode-context-dots-show": COPY.dots, "pi-mini-mode-context-percent-show": COPY.percent, "pi-mini-mode-speed-show": COPY.speed, "pi-mini-mode-speed-unit-show": COPY.speedUnit, "pi-mini-mode-minimal-show": COPY.minimal, "pi-mini-mode-semantic-badges": COPY.semanticBadges, "pi-mini-mode-report-guide": COPY.reportGuide, "pi-mini-mode-input-enhancements": COPY.inputEnhancements,
176
180
  };
177
181
  return (Object.keys(labels) as Array<keyof typeof labels>).map((id) => ({
178
182
  id, label: labels[id],
179
- description: id === "pi-mini-mode-minimal-show" ? COPY.enableMinimalDescription : id === "pi-mini-mode-semantic-badges" ? COPY.semanticBadgesDescription : id === "pi-mini-mode-input-enhancements" ? COPY.inputEnhancementsDescription : id === "pi-mini-mode-session-tokens-show" ? COPY.totalDescription : id === "pi-mini-mode-cache-tokens-show" ? COPY.cachedDescription : id === "pi-mini-mode-ch-show" ? COPY.cacheHitDescription : undefined,
183
+ description: id === "pi-mini-mode-minimal-show" ? COPY.enableMinimalDescription : id === "pi-mini-mode-semantic-badges" ? COPY.semanticBadgesDescription : id === "pi-mini-mode-report-guide" ? COPY.reportGuideDescription : id === "pi-mini-mode-input-enhancements" ? COPY.inputEnhancementsDescription : id === "pi-mini-mode-session-tokens-show" ? COPY.totalDescription : id === "pi-mini-mode-cache-tokens-show" ? COPY.cachedDescription : id === "pi-mini-mode-ch-show" ? COPY.cacheHitDescription : undefined,
180
184
  currentValue: settings[id] ? values[0] : values[1], values,
181
185
  }));
182
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@each1024/pi-mini-mode",
3
- "version": "2.0.21",
3
+ "version": "2.0.22",
4
4
  "description": "A compact Pi footer with live usage metrics, theme-aware settings previews, and configurable progress bars.",
5
5
  "type": "module",
6
6
  "scripts": {